Skip to content

Commit

Permalink
fix(radio-button-group): fix event type (#2238)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB authored Nov 29, 2023
1 parent 2a0a51d commit 159f518
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ import type {

import style from './radio-button-group.scss?lit&inline';

export type SbbRadioButtonGroupEventDetail = { value: any | null };

/**
* It can be used as a container for one or more `sbb-radio-button`.
*
* @slot - Use the unnamed slot to add `sbb-radio-button` elements to the `sbb-radio-button-group`.
* @slot error - Use this to provide a `sbb-form-error` to show an error message.
* @event {CustomEvent<void>} didChange - Deprecated. Only used for React. Will probably be removed once React 19 is available. Emits whenever the `sbb-radio-group` value changes.
* @event {CustomEvent<void>} change - Emits whenever the `sbb-radio-group` value changes.
* @event {CustomEvent<void>} input - Emits whenever the `sbb-radio-group` value changes.
* @event {CustomEvent<SbbRadioButtonGroupEventDetail>} didChange - Deprecated. Only used for React. Will probably be removed once React 19 is available. Emits whenever the `sbb-radio-group` value changes.
* @event {CustomEvent<SbbRadioButtonGroupEventDetail>} change - Emits whenever the `sbb-radio-group` value changes.
* @event {CustomEvent<SbbRadioButtonGroupEventDetail>} input - Emits whenever the `sbb-radio-group` value changes.
*/
@customElement('sbb-radio-button-group')
export class SbbRadioButtonGroup extends LitElement {
Expand Down Expand Up @@ -153,17 +155,26 @@ export class SbbRadioButtonGroup extends LitElement {
* Emits whenever the `sbb-radio-group` value changes.
* @deprecated only used for React. Will probably be removed once React 19 is available.
*/
private _didChange: EventEmitter = new EventEmitter(this, SbbRadioButtonGroup.events.didChange);
private _didChange: EventEmitter = new EventEmitter<SbbRadioButtonGroupEventDetail>(
this,
SbbRadioButtonGroup.events.didChange,
);

/**
* Emits whenever the `sbb-radio-group` value changes.
*/
private _change: EventEmitter = new EventEmitter(this, SbbRadioButtonGroup.events.change);
private _change: EventEmitter = new EventEmitter<SbbRadioButtonGroupEventDetail>(
this,
SbbRadioButtonGroup.events.change,
);

/**
* Emits whenever the `sbb-radio-group` value changes.
*/
private _input: EventEmitter = new EventEmitter(this, SbbRadioButtonGroup.events.input);
private _input: EventEmitter = new EventEmitter<SbbRadioButtonGroupEventDetail>(
this,
SbbRadioButtonGroup.events.input,
);

private _handlerRepository = new HandlerRepository(
this,
Expand Down
10 changes: 5 additions & 5 deletions src/components/radio-button/radio-button-group/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ In order to ensure readability for screen-readers, please provide an `aria-label

## Events

| Name | Type | Description | Inherited From |
| ----------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
| `didChange` | `CustomEvent<void>` | Deprecated. Only used for React. Will probably be removed once React 19 is available. Emits whenever the `sbb-radio-group` value changes. | |
| `change` | `CustomEvent<void>` | Emits whenever the `sbb-radio-group` value changes. | |
| `input` | `CustomEvent<void>` | Emits whenever the `sbb-radio-group` value changes. | |
| Name | Type | Description | Inherited From |
| ----------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
| `didChange` | `CustomEvent<SbbRadioButtonGroupEventDetail>` | Deprecated. Only used for React. Will probably be removed once React 19 is available. Emits whenever the `sbb-radio-group` value changes. | |
| `change` | `CustomEvent<SbbRadioButtonGroupEventDetail>` | Emits whenever the `sbb-radio-group` value changes. | |
| `input` | `CustomEvent<SbbRadioButtonGroupEventDetail>` | Emits whenever the `sbb-radio-group` value changes. | |

## Slots

Expand Down

0 comments on commit 159f518

Please sign in to comment.