@react-aria/radio 3.10.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AriaRadioProps, AriaRadioGroupProps } from "@react-types/radio";
2
- import { InputHTMLAttributes, LabelHTMLAttributes, RefObject } from "react";
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;
@@ -1 +1 @@
1
- {"mappings":";;;;ACqBA;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,CAAC,GAAG,SAAS,CA8EnH;ACjGD,+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
+ {"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"}
@@ -26,11 +26,11 @@ $parcel$export(module.exports, "useRadio", () => $e184702b1b7f1863$export$37b096
26
26
 
27
27
 
28
28
  function $e184702b1b7f1863$export$37b0961d2f4751e2(props, state, ref) {
29
- let { value: value, children: children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby } = props;
29
+ let { value: value, children: children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby } = props;
30
30
  const isDisabled = props.isDisabled || state.isDisabled;
31
31
  let hasChildren = children != null;
32
32
  let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;
33
- if (!hasChildren && !hasAriaLabel) console.warn("If you do not provide children, you must specify an aria-label for accessibility");
33
+ if (!hasChildren && !hasAriaLabel) console.warn('If you do not provide children, you must specify an aria-label for accessibility');
34
34
  let checked = state.selectedValue === value;
35
35
  let onChange = (e)=>{
36
36
  e.stopPropagation();
@@ -69,19 +69,19 @@ function $e184702b1b7f1863$export$37b0961d2f4751e2(props, state, ref) {
69
69
  }),
70
70
  inputProps: (0, $gWC9A$reactariautils.mergeProps)(domProps, {
71
71
  ...interactions,
72
- type: "radio",
72
+ type: 'radio',
73
73
  name: name,
74
74
  tabIndex: tabIndex,
75
75
  disabled: isDisabled,
76
- required: state.isRequired && validationBehavior === "native",
76
+ required: state.isRequired && validationBehavior === 'native',
77
77
  checked: checked,
78
78
  value: value,
79
79
  onChange: onChange,
80
- "aria-describedby": [
81
- props["aria-describedby"],
80
+ 'aria-describedby': [
81
+ props['aria-describedby'],
82
82
  state.isInvalid ? errorMessageId : null,
83
83
  descriptionId
84
- ].filter(Boolean).join(" ") || undefined
84
+ ].filter(Boolean).join(' ') || undefined
85
85
  }),
86
86
  isDisabled: isDisabled,
87
87
  isSelected: checked,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA+BM,SAAS,0CAAS,KAAqB,EAAE,KAAsB,EAAE,GAAgC;IACtG,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, RefObject} from 'react';\nimport {radioGroupData} from './utils';\nimport {RadioGroupState} from '@react-stately/radio';\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>): 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
+ {"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"}
package/dist/useRadio.mjs CHANGED
@@ -20,11 +20,11 @@ import {usePress as $5jJ3f$usePress} from "@react-aria/interactions";
20
20
 
21
21
 
22
22
  function $0d5c49892c1215da$export$37b0961d2f4751e2(props, state, ref) {
23
- let { value: value, children: children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby } = props;
23
+ let { value: value, children: children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby } = props;
24
24
  const isDisabled = props.isDisabled || state.isDisabled;
25
25
  let hasChildren = children != null;
26
26
  let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;
27
- if (!hasChildren && !hasAriaLabel) console.warn("If you do not provide children, you must specify an aria-label for accessibility");
27
+ if (!hasChildren && !hasAriaLabel) console.warn('If you do not provide children, you must specify an aria-label for accessibility');
28
28
  let checked = state.selectedValue === value;
29
29
  let onChange = (e)=>{
30
30
  e.stopPropagation();
@@ -63,19 +63,19 @@ function $0d5c49892c1215da$export$37b0961d2f4751e2(props, state, ref) {
63
63
  }),
64
64
  inputProps: (0, $5jJ3f$mergeProps)(domProps, {
65
65
  ...interactions,
66
- type: "radio",
66
+ type: 'radio',
67
67
  name: name,
68
68
  tabIndex: tabIndex,
69
69
  disabled: isDisabled,
70
- required: state.isRequired && validationBehavior === "native",
70
+ required: state.isRequired && validationBehavior === 'native',
71
71
  checked: checked,
72
72
  value: value,
73
73
  onChange: onChange,
74
- "aria-describedby": [
75
- props["aria-describedby"],
74
+ 'aria-describedby': [
75
+ props['aria-describedby'],
76
76
  state.isInvalid ? errorMessageId : null,
77
77
  descriptionId
78
- ].filter(Boolean).join(" ") || undefined
78
+ ].filter(Boolean).join(' ') || undefined
79
79
  }),
80
80
  isDisabled: isDisabled,
81
81
  isSelected: checked,
@@ -85,4 +85,4 @@ function $0d5c49892c1215da$export$37b0961d2f4751e2(props, state, ref) {
85
85
 
86
86
 
87
87
  export {$0d5c49892c1215da$export$37b0961d2f4751e2 as useRadio};
88
- //# sourceMappingURL=useRadio.mjs.map
88
+ //# sourceMappingURL=useRadio.module.js.map
@@ -20,11 +20,11 @@ import {usePress as $5jJ3f$usePress} from "@react-aria/interactions";
20
20
 
21
21
 
22
22
  function $0d5c49892c1215da$export$37b0961d2f4751e2(props, state, ref) {
23
- let { value: value, children: children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby } = props;
23
+ let { value: value, children: children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby } = props;
24
24
  const isDisabled = props.isDisabled || state.isDisabled;
25
25
  let hasChildren = children != null;
26
26
  let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;
27
- if (!hasChildren && !hasAriaLabel) console.warn("If you do not provide children, you must specify an aria-label for accessibility");
27
+ if (!hasChildren && !hasAriaLabel) console.warn('If you do not provide children, you must specify an aria-label for accessibility');
28
28
  let checked = state.selectedValue === value;
29
29
  let onChange = (e)=>{
30
30
  e.stopPropagation();
@@ -63,19 +63,19 @@ function $0d5c49892c1215da$export$37b0961d2f4751e2(props, state, ref) {
63
63
  }),
64
64
  inputProps: (0, $5jJ3f$mergeProps)(domProps, {
65
65
  ...interactions,
66
- type: "radio",
66
+ type: 'radio',
67
67
  name: name,
68
68
  tabIndex: tabIndex,
69
69
  disabled: isDisabled,
70
- required: state.isRequired && validationBehavior === "native",
70
+ required: state.isRequired && validationBehavior === 'native',
71
71
  checked: checked,
72
72
  value: value,
73
73
  onChange: onChange,
74
- "aria-describedby": [
75
- props["aria-describedby"],
74
+ 'aria-describedby': [
75
+ props['aria-describedby'],
76
76
  state.isInvalid ? errorMessageId : null,
77
77
  descriptionId
78
- ].filter(Boolean).join(" ") || undefined
78
+ ].filter(Boolean).join(' ') || undefined
79
79
  }),
80
80
  isDisabled: isDisabled,
81
81
  isSelected: checked,
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA+BM,SAAS,0CAAS,KAAqB,EAAE,KAAsB,EAAE,GAAgC;IACtG,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, RefObject} from 'react';\nimport {radioGroupData} from './utils';\nimport {RadioGroupState} from '@react-stately/radio';\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>): 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"}
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"}
@@ -28,14 +28,14 @@ $parcel$export(module.exports, "useRadioGroup", () => $dfcade00a56a6317$export$6
28
28
 
29
29
 
30
30
  function $dfcade00a56a6317$export$62b9571f283ff5c2(props, state) {
31
- let { name: name, isReadOnly: isReadOnly, isRequired: isRequired, isDisabled: isDisabled, orientation: orientation = "vertical", validationBehavior: validationBehavior = "aria" } = props;
31
+ let { name: name, isReadOnly: isReadOnly, isRequired: isRequired, isDisabled: isDisabled, orientation: orientation = 'vertical', validationBehavior: validationBehavior = 'aria' } = props;
32
32
  let { direction: direction } = (0, $bNSfM$reactariai18n.useLocale)();
33
33
  let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
34
34
  let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $bNSfM$reactarialabel.useField)({
35
35
  ...props,
36
36
  // Radio group is not an HTML input element so it
37
37
  // shouldn't be labeled by a <label> element.
38
- labelElementType: "span",
38
+ labelElementType: 'span',
39
39
  isInvalid: state.isInvalid,
40
40
  errorMessage: props.errorMessage || validationErrors
41
41
  });
@@ -57,19 +57,19 @@ function $dfcade00a56a6317$export$62b9571f283ff5c2(props, state) {
57
57
  let onKeyDown = (e)=>{
58
58
  let nextDir;
59
59
  switch(e.key){
60
- case "ArrowRight":
61
- if (direction === "rtl" && orientation !== "vertical") nextDir = "prev";
62
- else nextDir = "next";
60
+ case 'ArrowRight':
61
+ if (direction === 'rtl' && orientation !== 'vertical') nextDir = 'prev';
62
+ else nextDir = 'next';
63
63
  break;
64
- case "ArrowLeft":
65
- if (direction === "rtl" && orientation !== "vertical") nextDir = "next";
66
- else nextDir = "prev";
64
+ case 'ArrowLeft':
65
+ if (direction === 'rtl' && orientation !== 'vertical') nextDir = 'next';
66
+ else nextDir = 'prev';
67
67
  break;
68
- case "ArrowDown":
69
- nextDir = "next";
68
+ case 'ArrowDown':
69
+ nextDir = 'next';
70
70
  break;
71
- case "ArrowUp":
72
- nextDir = "prev";
71
+ case 'ArrowUp':
72
+ nextDir = 'prev';
73
73
  break;
74
74
  default:
75
75
  return;
@@ -79,7 +79,7 @@ function $dfcade00a56a6317$export$62b9571f283ff5c2(props, state) {
79
79
  from: e.target
80
80
  });
81
81
  let nextElem;
82
- if (nextDir === "next") {
82
+ if (nextDir === 'next') {
83
83
  nextElem = walker.nextNode();
84
84
  if (!nextElem) {
85
85
  walker.currentNode = e.currentTarget;
@@ -108,14 +108,14 @@ function $dfcade00a56a6317$export$62b9571f283ff5c2(props, state) {
108
108
  return {
109
109
  radioGroupProps: (0, $bNSfM$reactariautils.mergeProps)(domProps, {
110
110
  // https://www.w3.org/TR/wai-aria-1.2/#radiogroup
111
- role: "radiogroup",
111
+ role: 'radiogroup',
112
112
  onKeyDown: onKeyDown,
113
- "aria-invalid": state.isInvalid || undefined,
114
- "aria-errormessage": props["aria-errormessage"],
115
- "aria-readonly": isReadOnly || undefined,
116
- "aria-required": isRequired || undefined,
117
- "aria-disabled": isDisabled || undefined,
118
- "aria-orientation": orientation,
113
+ 'aria-invalid': state.isInvalid || undefined,
114
+ 'aria-errormessage': props['aria-errormessage'],
115
+ 'aria-readonly': isReadOnly || undefined,
116
+ 'aria-required': isRequired || undefined,
117
+ 'aria-disabled': isDisabled || undefined,
118
+ 'aria-orientation': orientation,
119
119
  ...fieldProps,
120
120
  ...focusWithinProps
121
121
  }),
@@ -22,14 +22,14 @@ import {useLocale as $czmJy$useLocale} from "@react-aria/i18n";
22
22
 
23
23
 
24
24
  function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
25
- let { name: name, isReadOnly: isReadOnly, isRequired: isRequired, isDisabled: isDisabled, orientation: orientation = "vertical", validationBehavior: validationBehavior = "aria" } = props;
25
+ let { name: name, isReadOnly: isReadOnly, isRequired: isRequired, isDisabled: isDisabled, orientation: orientation = 'vertical', validationBehavior: validationBehavior = 'aria' } = props;
26
26
  let { direction: direction } = (0, $czmJy$useLocale)();
27
27
  let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
28
28
  let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $czmJy$useField)({
29
29
  ...props,
30
30
  // Radio group is not an HTML input element so it
31
31
  // shouldn't be labeled by a <label> element.
32
- labelElementType: "span",
32
+ labelElementType: 'span',
33
33
  isInvalid: state.isInvalid,
34
34
  errorMessage: props.errorMessage || validationErrors
35
35
  });
@@ -51,19 +51,19 @@ function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
51
51
  let onKeyDown = (e)=>{
52
52
  let nextDir;
53
53
  switch(e.key){
54
- case "ArrowRight":
55
- if (direction === "rtl" && orientation !== "vertical") nextDir = "prev";
56
- else nextDir = "next";
54
+ case 'ArrowRight':
55
+ if (direction === 'rtl' && orientation !== 'vertical') nextDir = 'prev';
56
+ else nextDir = 'next';
57
57
  break;
58
- case "ArrowLeft":
59
- if (direction === "rtl" && orientation !== "vertical") nextDir = "next";
60
- else nextDir = "prev";
58
+ case 'ArrowLeft':
59
+ if (direction === 'rtl' && orientation !== 'vertical') nextDir = 'next';
60
+ else nextDir = 'prev';
61
61
  break;
62
- case "ArrowDown":
63
- nextDir = "next";
62
+ case 'ArrowDown':
63
+ nextDir = 'next';
64
64
  break;
65
- case "ArrowUp":
66
- nextDir = "prev";
65
+ case 'ArrowUp':
66
+ nextDir = 'prev';
67
67
  break;
68
68
  default:
69
69
  return;
@@ -73,7 +73,7 @@ function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
73
73
  from: e.target
74
74
  });
75
75
  let nextElem;
76
- if (nextDir === "next") {
76
+ if (nextDir === 'next') {
77
77
  nextElem = walker.nextNode();
78
78
  if (!nextElem) {
79
79
  walker.currentNode = e.currentTarget;
@@ -102,14 +102,14 @@ function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
102
102
  return {
103
103
  radioGroupProps: (0, $czmJy$mergeProps)(domProps, {
104
104
  // https://www.w3.org/TR/wai-aria-1.2/#radiogroup
105
- role: "radiogroup",
105
+ role: 'radiogroup',
106
106
  onKeyDown: onKeyDown,
107
- "aria-invalid": state.isInvalid || undefined,
108
- "aria-errormessage": props["aria-errormessage"],
109
- "aria-readonly": isReadOnly || undefined,
110
- "aria-required": isRequired || undefined,
111
- "aria-disabled": isDisabled || undefined,
112
- "aria-orientation": orientation,
107
+ 'aria-invalid': state.isInvalid || undefined,
108
+ 'aria-errormessage': props['aria-errormessage'],
109
+ 'aria-readonly': isReadOnly || undefined,
110
+ 'aria-required': isRequired || undefined,
111
+ 'aria-disabled': isDisabled || undefined,
112
+ 'aria-orientation': orientation,
113
113
  ...fieldProps,
114
114
  ...focusWithinProps
115
115
  }),
@@ -124,4 +124,4 @@ function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
124
124
 
125
125
 
126
126
  export {$430f30ed08ec25fa$export$62b9571f283ff5c2 as useRadioGroup};
127
- //# sourceMappingURL=useRadioGroup.mjs.map
127
+ //# sourceMappingURL=useRadioGroup.module.js.map
@@ -22,14 +22,14 @@ import {useLocale as $czmJy$useLocale} from "@react-aria/i18n";
22
22
 
23
23
 
24
24
  function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
25
- let { name: name, isReadOnly: isReadOnly, isRequired: isRequired, isDisabled: isDisabled, orientation: orientation = "vertical", validationBehavior: validationBehavior = "aria" } = props;
25
+ let { name: name, isReadOnly: isReadOnly, isRequired: isRequired, isDisabled: isDisabled, orientation: orientation = 'vertical', validationBehavior: validationBehavior = 'aria' } = props;
26
26
  let { direction: direction } = (0, $czmJy$useLocale)();
27
27
  let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
28
28
  let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $czmJy$useField)({
29
29
  ...props,
30
30
  // Radio group is not an HTML input element so it
31
31
  // shouldn't be labeled by a <label> element.
32
- labelElementType: "span",
32
+ labelElementType: 'span',
33
33
  isInvalid: state.isInvalid,
34
34
  errorMessage: props.errorMessage || validationErrors
35
35
  });
@@ -51,19 +51,19 @@ function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
51
51
  let onKeyDown = (e)=>{
52
52
  let nextDir;
53
53
  switch(e.key){
54
- case "ArrowRight":
55
- if (direction === "rtl" && orientation !== "vertical") nextDir = "prev";
56
- else nextDir = "next";
54
+ case 'ArrowRight':
55
+ if (direction === 'rtl' && orientation !== 'vertical') nextDir = 'prev';
56
+ else nextDir = 'next';
57
57
  break;
58
- case "ArrowLeft":
59
- if (direction === "rtl" && orientation !== "vertical") nextDir = "next";
60
- else nextDir = "prev";
58
+ case 'ArrowLeft':
59
+ if (direction === 'rtl' && orientation !== 'vertical') nextDir = 'next';
60
+ else nextDir = 'prev';
61
61
  break;
62
- case "ArrowDown":
63
- nextDir = "next";
62
+ case 'ArrowDown':
63
+ nextDir = 'next';
64
64
  break;
65
- case "ArrowUp":
66
- nextDir = "prev";
65
+ case 'ArrowUp':
66
+ nextDir = 'prev';
67
67
  break;
68
68
  default:
69
69
  return;
@@ -73,7 +73,7 @@ function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
73
73
  from: e.target
74
74
  });
75
75
  let nextElem;
76
- if (nextDir === "next") {
76
+ if (nextDir === 'next') {
77
77
  nextElem = walker.nextNode();
78
78
  if (!nextElem) {
79
79
  walker.currentNode = e.currentTarget;
@@ -102,14 +102,14 @@ function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
102
102
  return {
103
103
  radioGroupProps: (0, $czmJy$mergeProps)(domProps, {
104
104
  // https://www.w3.org/TR/wai-aria-1.2/#radiogroup
105
- role: "radiogroup",
105
+ role: 'radiogroup',
106
106
  onKeyDown: onKeyDown,
107
- "aria-invalid": state.isInvalid || undefined,
108
- "aria-errormessage": props["aria-errormessage"],
109
- "aria-readonly": isReadOnly || undefined,
110
- "aria-required": isRequired || undefined,
111
- "aria-disabled": isDisabled || undefined,
112
- "aria-orientation": orientation,
107
+ 'aria-invalid': state.isInvalid || undefined,
108
+ 'aria-errormessage': props['aria-errormessage'],
109
+ 'aria-readonly': isReadOnly || undefined,
110
+ 'aria-required': isRequired || undefined,
111
+ 'aria-disabled': isDisabled || undefined,
112
+ 'aria-orientation': orientation,
113
113
  ...fieldProps,
114
114
  ...focusWithinProps
115
115
  }),
package/dist/utils.mjs CHANGED
@@ -12,4 +12,4 @@
12
12
 
13
13
 
14
14
  export {$884aeceb3d67f00f$export$37b65e5b5444d35c as radioGroupData};
15
- //# sourceMappingURL=utils.mjs.map
15
+ //# sourceMappingURL=utils.module.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/radio",
3
- "version": "3.10.3",
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.17.0",
26
- "@react-aria/form": "^3.0.4",
27
- "@react-aria/i18n": "^3.11.0",
28
- "@react-aria/interactions": "^3.21.2",
29
- "@react-aria/label": "^3.7.7",
30
- "@react-aria/utils": "^3.24.0",
31
- "@react-stately/radio": "^3.10.3",
32
- "@react-types/radio": "^3.8.0",
33
- "@react-types/shared": "^3.23.0",
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": "f645f29edc1322153fd60af4640cbcab1d992dbd"
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, RefObject} from 'react';
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,