Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(radio-button): allow value type to be a number #1868

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions COMPONENT_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,7 @@ None.
| :------------ | :------- | :--------------- | :------- | ----------------------------------------- | ------------------------------------------------ | --------------------------------------------------- |
| ref | No | <code>let</code> | Yes | <code>null &#124; HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
| checked | No | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to check the radio button |
| value | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the value of the radio button |
| value | No | <code>let</code> | No | <code>string &#124; number</code> | <code>""</code> | Specify the value of the radio button |
| disabled | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the radio button |
| required | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to mark the field as required |
| labelPosition | No | <code>let</code> | No | <code>"right" &#124; "left"</code> | <code>"right"</code> | Specify the label position |
Expand All @@ -2964,7 +2964,7 @@ None.

| Prop name | Required | Kind | Reactive | Type | Default value | Description |
| :------------ | :------- | :--------------- | :------- | ------------------------------------------- | ------------------------- | -------------------------------------------------------- |
| selected | No | <code>let</code> | Yes | <code>string</code> | <code>undefined</code> | Set the selected radio button value |
| selected | No | <code>let</code> | Yes | <code>string &#124; number</code> | <code>undefined</code> | Set the selected radio button value |
| disabled | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the radio buttons |
| required | No | <code>let</code> | No | <code>boolean</code> | <code>undefined</code> | Set to `true` to require the selection of a radio button |
| name | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify a name attribute for the radio button inputs |
Expand All @@ -2983,13 +2983,13 @@ None.

### Events

| Event name | Type | Detail |
| :--------- | :--------- | :------------------ |
| change | dispatched | <code>string</code> |
| click | forwarded | -- |
| mouseover | forwarded | -- |
| mouseenter | forwarded | -- |
| mouseleave | forwarded | -- |
| Event name | Type | Detail |
| :--------- | :--------- | :-------------------------------- |
| change | dispatched | <code>string &#124; number</code> |
| click | forwarded | -- |
| mouseover | forwarded | -- |
| mouseenter | forwarded | -- |
| mouseleave | forwarded | -- |

## `RadioButtonSkeleton`

Expand Down
6 changes: 3 additions & 3 deletions docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -9366,7 +9366,7 @@
"name": "value",
"kind": "let",
"description": "Specify the value of the radio button",
"type": "string",
"type": "string | number",
"value": "\"\"",
"isFunction": false,
"isFunctionDeclaration": false,
Expand Down Expand Up @@ -9503,7 +9503,7 @@
"name": "selected",
"kind": "let",
"description": "Set the selected radio button value",
"type": "string",
"type": "string | number",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -9615,7 +9615,7 @@
}
],
"events": [
{ "type": "dispatched", "name": "change", "detail": "string" },
{ "type": "dispatched", "name": "change", "detail": "string | number" },
{ "type": "forwarded", "name": "click", "element": "div" },
{ "type": "forwarded", "name": "mouseover", "element": "div" },
{ "type": "forwarded", "name": "mouseenter", "element": "div" },
Expand Down
5 changes: 4 additions & 1 deletion src/RadioButton/RadioButton.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<script>
/** Specify the value of the radio button */
/**
* Specify the value of the radio button
* @type {string | number}
*/
export let value = "";

/** Set to `true` to check the radio button */
Expand Down
4 changes: 2 additions & 2 deletions src/RadioButtonGroup/RadioButtonGroup.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script>
/**
* @event {string} change
* @event {string | number} change
*/

/**
* Set the selected radio button value
* @type {string}
* @type {string | number}
*/
export let selected = undefined;

Expand Down
2 changes: 1 addition & 1 deletion types/RadioButton/RadioButton.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface RadioButtonProps extends RestProps {
* Specify the value of the radio button
* @default ""
*/
value?: string;
value?: string | number;

/**
* Set to `true` to check the radio button
Expand Down
4 changes: 2 additions & 2 deletions types/RadioButtonGroup/RadioButtonGroup.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface RadioButtonGroupProps extends RestProps {
* Set the selected radio button value
* @default undefined
*/
selected?: string;
selected?: string | number;

/**
* Set to `true` to disable the radio buttons
Expand Down Expand Up @@ -64,7 +64,7 @@ export interface RadioButtonGroupProps extends RestProps {
export default class RadioButtonGroup extends SvelteComponentTyped<
RadioButtonGroupProps,
{
change: CustomEvent<string>;
change: CustomEvent<string | number>;
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
Expand Down
Loading