@react-aria/radio 3.10.4 → 3.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/useRadio.main.js.map +1 -1
- package/dist/useRadio.module.js.map +1 -1
- package/package.json +12 -12
- package/src/useRadio.ts +3 -2
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AriaRadioProps, AriaRadioGroupProps } from "@react-types/radio";
|
|
2
|
-
import { InputHTMLAttributes, LabelHTMLAttributes
|
|
2
|
+
import { InputHTMLAttributes, LabelHTMLAttributes } from "react";
|
|
3
3
|
import { RadioGroupState } from "@react-stately/radio";
|
|
4
|
-
import { DOMAttributes, ValidationResult } from "@react-types/shared";
|
|
4
|
+
import { RefObject, DOMAttributes, ValidationResult } from "@react-types/shared";
|
|
5
5
|
export interface RadioAria {
|
|
6
6
|
/** Props for the label wrapper element. */
|
|
7
7
|
labelProps: LabelHTMLAttributes<HTMLLabelElement>;
|
|
@@ -21,7 +21,7 @@ export interface RadioAria {
|
|
|
21
21
|
* @param state - State for the radio group, as returned by `useRadioGroupState`.
|
|
22
22
|
* @param ref - Ref to the HTML input element.
|
|
23
23
|
*/
|
|
24
|
-
export function useRadio(props: AriaRadioProps, state: RadioGroupState, ref: RefObject<HTMLInputElement>): RadioAria;
|
|
24
|
+
export function useRadio(props: AriaRadioProps, state: RadioGroupState, ref: RefObject<HTMLInputElement | null>): RadioAria;
|
|
25
25
|
export interface RadioGroupAria extends ValidationResult {
|
|
26
26
|
/** Props for the radio group wrapper element. */
|
|
27
27
|
radioGroupProps: DOMAttributes;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;
|
|
1
|
+
{"mappings":";;;;ACsBA;IACE,2CAA2C;IAC3C,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;GAMG;AACH,yBAAyB,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,SAAS,CA8E1H;AClGD,+BAAgC,SAAQ,gBAAgB;IACtD,iDAAiD;IACjD,eAAe,EAAE,aAAa,CAAC;IAC/B,0DAA0D;IAC1D,UAAU,EAAE,aAAa,CAAC;IAC1B,6DAA6D;IAC7D,gBAAgB,EAAE,aAAa,CAAC;IAChC,+DAA+D;IAC/D,iBAAiB,EAAE,aAAa,CAAA;CACjC;AAED;;;;;GAKG;AACH,8BAA8B,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,eAAe,GAAG,cAAc,CAmHhG;AC7ID,YAAY,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAC5E,YAAY,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/radio/src/packages/@react-aria/radio/src/utils.ts","packages/@react-aria/radio/src/packages/@react-aria/radio/src/useRadio.ts","packages/@react-aria/radio/src/packages/@react-aria/radio/src/useRadioGroup.ts","packages/@react-aria/radio/src/packages/@react-aria/radio/src/index.ts","packages/@react-aria/radio/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useRadio} from './useRadio';\nexport {useRadioGroup} from './useRadioGroup';\nexport type {AriaRadioGroupProps, AriaRadioProps} from '@react-types/radio';\nexport type {Orientation} from '@react-types/shared';\nexport type {RadioAria} from './useRadio';\nexport type {RadioGroupAria} from './useRadioGroup';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAgCM,SAAS,0CAAS,KAAqB,EAAE,KAAsB,EAAE,GAAuC;IAC7G,IAAI,SACF,KAAK,YACL,QAAQ,EACR,cAAc,SAAS,EACvB,mBAAmB,cAAc,EAClC,GAAG;IAEJ,MAAM,aAAa,MAAM,UAAU,IAAI,MAAM,UAAU;IAEvD,IAAI,cAAc,YAAY;IAC9B,IAAI,eAAe,aAAa,QAAQ,kBAAkB;IAC1D,IAAI,CAAC,eAAe,CAAC,cACnB,QAAQ,IAAI,CAAC;IAGf,IAAI,UAAU,MAAM,aAAa,KAAK;IAEtC,IAAI,WAAW,CAAC;QACd,EAAE,eAAe;QACjB,MAAM,gBAAgB,CAAC;IACzB;IAEA,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBACrC;IACF;IAEA,8FAA8F;IAC9F,IAAI,EAAC,YAAY,UAAU,EAAE,WAAW,cAAc,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;oBACjE;QACA;YACE,MAAM,gBAAgB,CAAC;QACzB;IACF;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,kCAAW,EAAE,CAAA,GAAA,gCAAS,EAAE,OAAO;QACpD,SAAS,IAAM,MAAM,mBAAmB,CAAC;IAC3C,IAAI;IACJ,IAAI,eAAe,CAAA,GAAA,gCAAS,EAAE,YAAY;IAC1C,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,WAA+B;IACnC,IAAI,MAAM,aAAa,IAAI,MACzB;QAAA,IAAI,MAAM,aAAa,KAAK,OAC1B,WAAW;IACb,OACK,IAAI,MAAM,gBAAgB,KAAK,SAAS,MAAM,gBAAgB,IAAI,MACvE,WAAW;IAEb,IAAI,YACF,WAAW;IAGb,IAAI,QAAC,IAAI,iBAAE,aAAa,kBAAE,cAAc,sBAAE,kBAAkB,EAAC,GAAG,CAAA,GAAA,wCAAa,EAAE,GAAG,CAAC;IACnF,CAAA,GAAA,kCAAW,EAAE,KAAK,MAAM,aAAa,EAAE,MAAM,gBAAgB;IAC7D,CAAA,GAAA,sCAAgB,EAAE;4BAAC;IAAkB,GAAG,OAAO;IAE/C,OAAO;QACL,YAAY,CAAA,GAAA,gCAAS,EAAE,YAAY;YAAC,SAAS,CAAA,IAAK,EAAE,cAAc;QAAE;QACpE,YAAY,CAAA,GAAA,gCAAS,EAAE,UAAU;YAC/B,GAAG,YAAY;YACf,MAAM;kBACN;sBACA;YACA,UAAU;YACV,UAAU,MAAM,UAAU,IAAI,uBAAuB;qBACrD;mBACA;sBACA;YACA,oBAAoB;gBAClB,KAAK,CAAC,mBAAmB;gBACzB,MAAM,SAAS,GAAG,iBAAiB;gBACnC;aACD,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;QACjC;oBACA;QACA,YAAY;QACZ,WAAW,aAAa;IAC1B;AACF","sources":["packages/@react-aria/radio/src/useRadio.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaRadioProps} from '@react-types/radio';\nimport {filterDOMProps, mergeProps, useFormReset} from '@react-aria/utils';\nimport {InputHTMLAttributes, LabelHTMLAttributes} from 'react';\nimport {radioGroupData} from './utils';\nimport {RadioGroupState} from '@react-stately/radio';\nimport {RefObject} from '@react-types/shared';\nimport {useFocusable} from '@react-aria/focus';\nimport {useFormValidation} from '@react-aria/form';\nimport {usePress} from '@react-aria/interactions';\n\nexport interface RadioAria {\n /** Props for the label wrapper element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Whether the radio is disabled. */\n isDisabled: boolean,\n /** Whether the radio is currently selected. */\n isSelected: boolean,\n /** Whether the radio is in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an individual\n * radio button in a radio group.\n * @param props - Props for the radio.\n * @param state - State for the radio group, as returned by `useRadioGroupState`.\n * @param ref - Ref to the HTML input element.\n */\nexport function useRadio(props: AriaRadioProps, state: RadioGroupState, ref: RefObject<HTMLInputElement | null>): RadioAria {\n let {\n value,\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n } = props;\n\n const isDisabled = props.isDisabled || state.isDisabled;\n\n let hasChildren = children != null;\n let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;\n if (!hasChildren && !hasAriaLabel) {\n console.warn('If you do not provide children, you must specify an aria-label for accessibility');\n }\n\n let checked = state.selectedValue === value;\n\n let onChange = (e) => {\n e.stopPropagation();\n state.setSelectedValue(value);\n };\n\n let {pressProps, isPressed} = usePress({\n isDisabled\n });\n\n // iOS does not toggle radios if you drag off and back onto the label, so handle it ourselves.\n let {pressProps: labelProps, isPressed: isLabelPressed} = usePress({\n isDisabled,\n onPress() {\n state.setSelectedValue(value);\n }\n });\n\n let {focusableProps} = useFocusable(mergeProps(props, {\n onFocus: () => state.setLastFocusedValue(value)\n }), ref);\n let interactions = mergeProps(pressProps, focusableProps);\n let domProps = filterDOMProps(props, {labelable: true});\n let tabIndex: number | undefined = -1;\n if (state.selectedValue != null) {\n if (state.selectedValue === value) {\n tabIndex = 0;\n }\n } else if (state.lastFocusedValue === value || state.lastFocusedValue == null) {\n tabIndex = 0;\n }\n if (isDisabled) {\n tabIndex = undefined;\n }\n\n let {name, descriptionId, errorMessageId, validationBehavior} = radioGroupData.get(state)!;\n useFormReset(ref, state.selectedValue, state.setSelectedValue);\n useFormValidation({validationBehavior}, state, ref);\n\n return {\n labelProps: mergeProps(labelProps, {onClick: e => e.preventDefault()}),\n inputProps: mergeProps(domProps, {\n ...interactions,\n type: 'radio',\n name,\n tabIndex,\n disabled: isDisabled,\n required: state.isRequired && validationBehavior === 'native',\n checked,\n value,\n onChange,\n 'aria-describedby': [\n props['aria-describedby'],\n state.isInvalid ? errorMessageId : null,\n descriptionId\n ].filter(Boolean).join(' ') || undefined\n }),\n isDisabled,\n isSelected: checked,\n isPressed: isPressed || isLabelPressed\n };\n}\n"],"names":[],"version":3,"file":"useRadio.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAgCM,SAAS,0CAAS,KAAqB,EAAE,KAAsB,EAAE,GAAuC;IAC7G,IAAI,SACF,KAAK,YACL,QAAQ,EACR,cAAc,SAAS,EACvB,mBAAmB,cAAc,EAClC,GAAG;IAEJ,MAAM,aAAa,MAAM,UAAU,IAAI,MAAM,UAAU;IAEvD,IAAI,cAAc,YAAY;IAC9B,IAAI,eAAe,aAAa,QAAQ,kBAAkB;IAC1D,IAAI,CAAC,eAAe,CAAC,cACnB,QAAQ,IAAI,CAAC;IAGf,IAAI,UAAU,MAAM,aAAa,KAAK;IAEtC,IAAI,WAAW,CAAC;QACd,EAAE,eAAe;QACjB,MAAM,gBAAgB,CAAC;IACzB;IAEA,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBACrC;IACF;IAEA,8FAA8F;IAC9F,IAAI,EAAC,YAAY,UAAU,EAAE,WAAW,cAAc,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBACjE;QACA;YACE,MAAM,gBAAgB,CAAC;QACzB;IACF;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,CAAA,GAAA,iBAAS,EAAE,OAAO;QACpD,SAAS,IAAM,MAAM,mBAAmB,CAAC;IAC3C,IAAI;IACJ,IAAI,eAAe,CAAA,GAAA,iBAAS,EAAE,YAAY;IAC1C,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,WAA+B;IACnC,IAAI,MAAM,aAAa,IAAI,MACzB;QAAA,IAAI,MAAM,aAAa,KAAK,OAC1B,WAAW;IACb,OACK,IAAI,MAAM,gBAAgB,KAAK,SAAS,MAAM,gBAAgB,IAAI,MACvE,WAAW;IAEb,IAAI,YACF,WAAW;IAGb,IAAI,QAAC,IAAI,iBAAE,aAAa,kBAAE,cAAc,sBAAE,kBAAkB,EAAC,GAAG,CAAA,GAAA,yCAAa,EAAE,GAAG,CAAC;IACnF,CAAA,GAAA,mBAAW,EAAE,KAAK,MAAM,aAAa,EAAE,MAAM,gBAAgB;IAC7D,CAAA,GAAA,wBAAgB,EAAE;4BAAC;IAAkB,GAAG,OAAO;IAE/C,OAAO;QACL,YAAY,CAAA,GAAA,iBAAS,EAAE,YAAY;YAAC,SAAS,CAAA,IAAK,EAAE,cAAc;QAAE;QACpE,YAAY,CAAA,GAAA,iBAAS,EAAE,UAAU;YAC/B,GAAG,YAAY;YACf,MAAM;kBACN;sBACA;YACA,UAAU;YACV,UAAU,MAAM,UAAU,IAAI,uBAAuB;qBACrD;mBACA;sBACA;YACA,oBAAoB;gBAClB,KAAK,CAAC,mBAAmB;gBACzB,MAAM,SAAS,GAAG,iBAAiB;gBACnC;aACD,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;QACjC;oBACA;QACA,YAAY;QACZ,WAAW,aAAa;IAC1B;AACF","sources":["packages/@react-aria/radio/src/useRadio.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaRadioProps} from '@react-types/radio';\nimport {filterDOMProps, mergeProps, useFormReset} from '@react-aria/utils';\nimport {InputHTMLAttributes, LabelHTMLAttributes} from 'react';\nimport {radioGroupData} from './utils';\nimport {RadioGroupState} from '@react-stately/radio';\nimport {RefObject} from '@react-types/shared';\nimport {useFocusable} from '@react-aria/focus';\nimport {useFormValidation} from '@react-aria/form';\nimport {usePress} from '@react-aria/interactions';\n\nexport interface RadioAria {\n /** Props for the label wrapper element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Whether the radio is disabled. */\n isDisabled: boolean,\n /** Whether the radio is currently selected. */\n isSelected: boolean,\n /** Whether the radio is in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an individual\n * radio button in a radio group.\n * @param props - Props for the radio.\n * @param state - State for the radio group, as returned by `useRadioGroupState`.\n * @param ref - Ref to the HTML input element.\n */\nexport function useRadio(props: AriaRadioProps, state: RadioGroupState, ref: RefObject<HTMLInputElement | null>): RadioAria {\n let {\n value,\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n } = props;\n\n const isDisabled = props.isDisabled || state.isDisabled;\n\n let hasChildren = children != null;\n let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;\n if (!hasChildren && !hasAriaLabel) {\n console.warn('If you do not provide children, you must specify an aria-label for accessibility');\n }\n\n let checked = state.selectedValue === value;\n\n let onChange = (e) => {\n e.stopPropagation();\n state.setSelectedValue(value);\n };\n\n let {pressProps, isPressed} = usePress({\n isDisabled\n });\n\n // iOS does not toggle radios if you drag off and back onto the label, so handle it ourselves.\n let {pressProps: labelProps, isPressed: isLabelPressed} = usePress({\n isDisabled,\n onPress() {\n state.setSelectedValue(value);\n }\n });\n\n let {focusableProps} = useFocusable(mergeProps(props, {\n onFocus: () => state.setLastFocusedValue(value)\n }), ref);\n let interactions = mergeProps(pressProps, focusableProps);\n let domProps = filterDOMProps(props, {labelable: true});\n let tabIndex: number | undefined = -1;\n if (state.selectedValue != null) {\n if (state.selectedValue === value) {\n tabIndex = 0;\n }\n } else if (state.lastFocusedValue === value || state.lastFocusedValue == null) {\n tabIndex = 0;\n }\n if (isDisabled) {\n tabIndex = undefined;\n }\n\n let {name, descriptionId, errorMessageId, validationBehavior} = radioGroupData.get(state)!;\n useFormReset(ref, state.selectedValue, state.setSelectedValue);\n useFormValidation({validationBehavior}, state, ref);\n\n return {\n labelProps: mergeProps(labelProps, {onClick: e => e.preventDefault()}),\n inputProps: mergeProps(domProps, {\n ...interactions,\n type: 'radio',\n name,\n tabIndex,\n disabled: isDisabled,\n required: state.isRequired && validationBehavior === 'native',\n checked,\n value,\n onChange,\n 'aria-describedby': [\n props['aria-describedby'],\n state.isInvalid ? errorMessageId : null,\n descriptionId\n ].filter(Boolean).join(' ') || undefined\n }),\n isDisabled,\n isSelected: checked,\n isPressed: isPressed || isLabelPressed\n };\n}\n"],"names":[],"version":3,"file":"useRadio.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/radio",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.5",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,22 +22,22 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "^3.
|
|
26
|
-
"@react-aria/form": "^3.0.
|
|
27
|
-
"@react-aria/i18n": "^3.
|
|
28
|
-
"@react-aria/interactions": "^3.
|
|
29
|
-
"@react-aria/label": "^3.7.
|
|
30
|
-
"@react-aria/utils": "^3.
|
|
31
|
-
"@react-stately/radio": "^3.10.
|
|
32
|
-
"@react-types/radio": "^3.8.
|
|
33
|
-
"@react-types/shared": "^3.
|
|
25
|
+
"@react-aria/focus": "^3.18.0",
|
|
26
|
+
"@react-aria/form": "^3.0.6",
|
|
27
|
+
"@react-aria/i18n": "^3.12.0",
|
|
28
|
+
"@react-aria/interactions": "^3.22.0",
|
|
29
|
+
"@react-aria/label": "^3.7.9",
|
|
30
|
+
"@react-aria/utils": "^3.25.0",
|
|
31
|
+
"@react-stately/radio": "^3.10.5",
|
|
32
|
+
"@react-types/radio": "^3.8.2",
|
|
33
|
+
"@react-types/shared": "^3.24.0",
|
|
34
34
|
"@swc/helpers": "^0.5.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
|
37
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "86d80e3216bc32e75108831cf3a5a720bc849206"
|
|
43
43
|
}
|
package/src/useRadio.ts
CHANGED
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
import {AriaRadioProps} from '@react-types/radio';
|
|
14
14
|
import {filterDOMProps, mergeProps, useFormReset} from '@react-aria/utils';
|
|
15
|
-
import {InputHTMLAttributes, LabelHTMLAttributes
|
|
15
|
+
import {InputHTMLAttributes, LabelHTMLAttributes} from 'react';
|
|
16
16
|
import {radioGroupData} from './utils';
|
|
17
17
|
import {RadioGroupState} from '@react-stately/radio';
|
|
18
|
+
import {RefObject} from '@react-types/shared';
|
|
18
19
|
import {useFocusable} from '@react-aria/focus';
|
|
19
20
|
import {useFormValidation} from '@react-aria/form';
|
|
20
21
|
import {usePress} from '@react-aria/interactions';
|
|
@@ -39,7 +40,7 @@ export interface RadioAria {
|
|
|
39
40
|
* @param state - State for the radio group, as returned by `useRadioGroupState`.
|
|
40
41
|
* @param ref - Ref to the HTML input element.
|
|
41
42
|
*/
|
|
42
|
-
export function useRadio(props: AriaRadioProps, state: RadioGroupState, ref: RefObject<HTMLInputElement>): RadioAria {
|
|
43
|
+
export function useRadio(props: AriaRadioProps, state: RadioGroupState, ref: RefObject<HTMLInputElement | null>): RadioAria {
|
|
43
44
|
let {
|
|
44
45
|
value,
|
|
45
46
|
children,
|