diff --git a/src/elements/radio-button/radio-button-group/radio-button-group.ts b/src/elements/radio-button/radio-button-group/radio-button-group.ts index 721d101a3f..1ba317ea14 100644 --- a/src/elements/radio-button/radio-button-group/radio-button-group.ts +++ b/src/elements/radio-button/radio-button-group/radio-button-group.ts @@ -55,7 +55,7 @@ class SbbRadioButtonGroupElement extends SbbDisabledMixin(LitElement) { * The value of the radio group. */ @property() - public set value(val: any | null) { + public set value(val: string | null) { this._fallbackValue = val; if (!this._didLoad) { return; @@ -69,13 +69,13 @@ class SbbRadioButtonGroupElement extends SbbDisabledMixin(LitElement) { toCheck.checked = true; } } - public get value(): any | null { + public get value(): string | null { return this.radioButtons.find((r) => r.checked && !r.disabled)?.value ?? this._fallbackValue; } /** * Used to preserve the `value` in case the radios are not yet 'loaded' */ - private _fallbackValue: any | null = null; + private _fallbackValue: string | null = null; /** * Size variant, either xs, s or m. diff --git a/src/elements/radio-button/radio-button-group/readme.md b/src/elements/radio-button/radio-button-group/readme.md index c1c0f873c2..883b1ecdb6 100644 --- a/src/elements/radio-button/radio-button-group/readme.md +++ b/src/elements/radio-button/radio-button-group/readme.md @@ -80,7 +80,7 @@ In order to ensure readability for screen-readers, please provide an `aria-label | `radioButtons` | - | public | `(SbbRadioButtonElement \| SbbRadioButtonPanelElement)[]` | | List of contained radio buttons. | | `required` | `required` | public | `boolean` | `false` | Whether the radio group is required. | | `size` | `size` | public | `SbbRadioButtonSize` | `'m' / 'xs' (lean)` | Size variant, either xs, s or m. | -| `value` | `value` | public | `any \| null` | | The value of the radio group. | +| `value` | `value` | public | `string \| null` | | The value of the radio group. | ## Events diff --git a/src/visual-regression-app/src/components/test-case/image-diff/fullscreen-diff/fullscreen-diff.ts b/src/visual-regression-app/src/components/test-case/image-diff/fullscreen-diff/fullscreen-diff.ts index a8b39c1107..21bd1df563 100644 --- a/src/visual-regression-app/src/components/test-case/image-diff/fullscreen-diff/fullscreen-diff.ts +++ b/src/visual-regression-app/src/components/test-case/image-diff/fullscreen-diff/fullscreen-diff.ts @@ -11,6 +11,8 @@ import '@sbb-esta/lyne-elements/chip-label.js'; import '@sbb-esta/lyne-elements/radio-button.js'; import type { SbbRadioButtonGroupElement } from '@sbb-esta/lyne-elements/radio-button/radio-button-group/radio-button-group.js'; +export type DiffFileType = 'baselineFile' | 'failedFile' | 'diffFile'; + /** * Displays two images in fullscreen to overlay them. */ @@ -21,8 +23,7 @@ class FullscreenDiff extends LitElement { @property() public accessor screenshotFiles: ScreenshotFiles | null = null; - @property() public accessor selectedFile: 'baselineFile' | 'failedFile' | 'diffFile' = - 'failedFile'; + @property() public accessor selectedFile: DiffFileType = 'failedFile'; public override render(): TemplateResult { if (!this.screenshotFiles) { @@ -38,7 +39,7 @@ class FullscreenDiff extends LitElement { class="app-radio-button-group" value=${this.selectedFile} @change=${(event: Event) => - (this.selectedFile = (event.target as SbbRadioButtonGroupElement).value)} + (this.selectedFile = (event.target as SbbRadioButtonGroupElement).value as DiffFileType)} > ${!this.screenshotFiles.isNew ? html`Baseline`