From 479225711a1e304df74f0cfc585e32b5454afd66 Mon Sep 17 00:00:00 2001 From: metonym Date: Sun, 17 Dec 2023 09:42:28 -0800 Subject: [PATCH] fix(radio-button): allow `value` type to be a number (#1868) --- COMPONENT_INDEX.md | 18 +++++++++--------- docs/src/COMPONENT_API.json | 6 +++--- src/RadioButton/RadioButton.svelte | 5 ++++- src/RadioButtonGroup/RadioButtonGroup.svelte | 4 ++-- types/RadioButton/RadioButton.svelte.d.ts | 2 +- .../RadioButtonGroup.svelte.d.ts | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 56fd01f49d..58135e53bd 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -2937,7 +2937,7 @@ None. | :------------ | :------- | :--------------- | :------- | ----------------------------------------- | ------------------------------------------------ | --------------------------------------------------- | | ref | No | let | Yes | null | HTMLInputElement | null | Obtain a reference to the input HTML element | | checked | No | let | Yes | boolean | false | Set to `true` to check the radio button | -| value | No | let | No | string | "" | Specify the value of the radio button | +| value | No | let | No | string | number | "" | Specify the value of the radio button | | disabled | No | let | No | boolean | false | Set to `true` to disable the radio button | | required | No | let | No | boolean | false | Set to `true` to mark the field as required | | labelPosition | No | let | No | "right" | "left" | "right" | Specify the label position | @@ -2964,7 +2964,7 @@ None. | Prop name | Required | Kind | Reactive | Type | Default value | Description | | :------------ | :------- | :--------------- | :------- | ------------------------------------------- | ------------------------- | -------------------------------------------------------- | -| selected | No | let | Yes | string | undefined | Set the selected radio button value | +| selected | No | let | Yes | string | number | undefined | Set the selected radio button value | | disabled | No | let | No | boolean | false | Set to `true` to disable the radio buttons | | required | No | let | No | boolean | undefined | Set to `true` to require the selection of a radio button | | name | No | let | No | string | undefined | Specify a name attribute for the radio button inputs | @@ -2983,13 +2983,13 @@ None. ### Events -| Event name | Type | Detail | -| :--------- | :--------- | :------------------ | -| change | dispatched | string | -| click | forwarded | -- | -| mouseover | forwarded | -- | -| mouseenter | forwarded | -- | -| mouseleave | forwarded | -- | +| Event name | Type | Detail | +| :--------- | :--------- | :-------------------------------- | +| change | dispatched | string | number | +| click | forwarded | -- | +| mouseover | forwarded | -- | +| mouseenter | forwarded | -- | +| mouseleave | forwarded | -- | ## `RadioButtonSkeleton` diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 6a1d816914..601783022f 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -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, @@ -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, @@ -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" }, diff --git a/src/RadioButton/RadioButton.svelte b/src/RadioButton/RadioButton.svelte index 9cc6e9f678..233faf28c5 100644 --- a/src/RadioButton/RadioButton.svelte +++ b/src/RadioButton/RadioButton.svelte @@ -1,5 +1,8 @@