@react-stately/radio 3.6.0 → 3.6.2

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/main.js CHANGED
@@ -6,18 +6,37 @@ function $parcel$export(e, n, v, s) {
6
6
  }
7
7
 
8
8
  $parcel$export(module.exports, "useRadioGroupState", () => $307db30b5687e2e8$export$bca9d026f8e704eb);
9
-
9
+ /*
10
+ * Copyright 2020 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */ /*
20
+ * Copyright 2020 Adobe. All rights reserved.
21
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
22
+ * you may not use this file except in compliance with the License. You may obtain a copy
23
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software distributed under
26
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
27
+ * OF ANY KIND, either express or implied. See the License for the specific language
28
+ * governing permissions and limitations under the License.
29
+ */
10
30
 
11
31
  let $307db30b5687e2e8$var$instance = Math.round(Math.random() * 10000000000);
12
32
  let $307db30b5687e2e8$var$i = 0;
13
33
  function $307db30b5687e2e8$export$bca9d026f8e704eb(props) {
14
34
  // Preserved here for backward compatibility. React Aria now generates the name instead of stately.
15
- let name = $6fRYN$react.useMemo(()=>props.name || `radio-group-${$307db30b5687e2e8$var$instance}-${++$307db30b5687e2e8$var$i}`
16
- , [
35
+ let name = (0, $6fRYN$react.useMemo)(()=>props.name || `radio-group-${$307db30b5687e2e8$var$instance}-${++$307db30b5687e2e8$var$i}`, [
17
36
  props.name
18
37
  ]);
19
- let [selectedValue, setSelected] = $6fRYN$reactstatelyutils.useControlledState(props.value, props.defaultValue, props.onChange);
20
- let [lastFocusedValue, setLastFocusedValue] = $6fRYN$react.useState(null);
38
+ let [selectedValue, setSelected] = (0, $6fRYN$reactstatelyutils.useControlledState)(props.value, props.defaultValue, props.onChange);
39
+ let [lastFocusedValue, setLastFocusedValue] = (0, $6fRYN$react.useState)(null);
21
40
  let setSelectedValue = (value)=>{
22
41
  if (!props.isReadOnly && !props.isDisabled) setSelected(value);
23
42
  };
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AC+CA,GAAG,CAAC,8BAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW;AACrD,GAAG,CAAC,uBAAC,GAAG,CAAC;SAMO,yCAAkB,CAAC,KAAsB,EAAoB,CAAC;IAC5E,EAAmG,AAAnG,iGAAmG;IACnG,GAAG,CAAC,IAAI,GAAG,oBAAO,KAAO,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,8BAAQ,CAAC,CAAC,IAAI,uBAAC;MAAI,CAAC;QAAA,KAAK,CAAC,IAAI;IAAA,CAAC;IACrF,GAAG,EAAE,aAAa,EAAE,WAAW,IAAI,2CAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,QAAQ;IACrG,GAAG,EAAE,gBAAgB,EAAE,mBAAmB,IAAI,qBAAQ,CAAC,IAAI;IAE3D,GAAG,CAAC,gBAAgB,IAAI,KAAK,GAAK,CAAC;QACjC,EAAE,GAAG,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,EACxC,WAAW,CAAC,KAAK;IAErB,CAAC;IAED,MAAM,CAAC,CAAC;cACN,IAAI;uBACJ,aAAa;0BACb,gBAAgB;0BAChB,gBAAgB;6BAChB,mBAAmB;QACnB,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,eAAe,EAAE,KAAK,CAAC,eAAe;IACxC,CAAC;AACH,CAAC","sources":["packages/@react-stately/radio/src/index.ts","packages/@react-stately/radio/src/useRadioGroupState.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\nexport {useRadioGroupState} from './useRadioGroupState';\n\nexport type {RadioGroupProps} from '@react-types/radio';\nexport type {RadioGroupState} from './useRadioGroupState';\n","/*\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 {RadioGroupProps} from '@react-types/radio';\nimport {useControlledState} from '@react-stately/utils';\nimport {useMemo, useState} from 'react';\nimport {ValidationState} from '@react-types/shared';\n\nexport interface RadioGroupState {\n /**\n * The name for the group, used for native form submission.\n * @deprecated\n * @private\n */\n readonly name: string,\n\n /** Whether the radio group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the radio group is read only. */\n readonly isReadOnly: boolean,\n\n /** The currently selected value. */\n readonly selectedValue: string | null,\n\n /** Sets the selected value. */\n setSelectedValue(value: string): void,\n\n /** The value of the last focused radio. */\n readonly lastFocusedValue: string | null,\n\n /** Sets the last focused value. */\n setLastFocusedValue(value: string): void,\n\n /** The current validation state of the radio group. */\n validationState: ValidationState\n}\n\nlet instance = Math.round(Math.random() * 10000000000);\nlet i = 0;\n\n/**\n * Provides state management for a radio group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useRadioGroupState(props: RadioGroupProps): RadioGroupState {\n // Preserved here for backward compatibility. React Aria now generates the name instead of stately.\n let name = useMemo(() => props.name || `radio-group-${instance}-${++i}`, [props.name]);\n let [selectedValue, setSelected] = useControlledState(props.value, props.defaultValue, props.onChange);\n let [lastFocusedValue, setLastFocusedValue] = useState(null);\n\n let setSelectedValue = (value) => {\n if (!props.isReadOnly && !props.isDisabled) {\n setSelected(value);\n }\n };\n\n return {\n name,\n selectedValue,\n setSelectedValue,\n lastFocusedValue,\n setLastFocusedValue,\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n validationState: props.validationState\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AAmCA,IAAI,iCAAW,KAAK,KAAK,CAAC,KAAK,MAAM,KAAK;AAC1C,IAAI,0BAAI;AAMD,SAAS,0CAAmB,KAAsB,EAAoB;IAC3E,mGAAmG;IACnG,IAAI,OAAO,CAAA,GAAA,oBAAO,AAAD,EAAE,IAAM,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,+BAAS,CAAC,EAAE,EAAE,wBAAE,CAAC,EAAE;QAAC,MAAM,IAAI;KAAC;IACrF,IAAI,CAAC,eAAe,YAAY,GAAG,CAAA,GAAA,2CAAiB,EAAE,MAAM,KAAK,EAAE,MAAM,YAAY,EAAE,MAAM,QAAQ;IACrG,IAAI,CAAC,kBAAkB,oBAAoB,GAAG,CAAA,GAAA,qBAAO,EAAE,IAAI;IAE3D,IAAI,mBAAmB,CAAC,QAAU;QAChC,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,MAAM,UAAU,EACxC,YAAY;IAEhB;IAEA,OAAO;cACL;uBACA;0BACA;0BACA;6BACA;QACA,YAAY,MAAM,UAAU,IAAI,KAAK;QACrC,YAAY,MAAM,UAAU,IAAI,KAAK;QACrC,iBAAiB,MAAM,eAAe;IACxC;AACF;;CDlEC,GAED","sources":["packages/@react-stately/radio/src/index.ts","packages/@react-stately/radio/src/useRadioGroupState.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\nexport {useRadioGroupState} from './useRadioGroupState';\n\nexport type {RadioGroupProps} from '@react-types/radio';\nexport type {RadioGroupState} from './useRadioGroupState';\n","/*\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 {RadioGroupProps} from '@react-types/radio';\nimport {useControlledState} from '@react-stately/utils';\nimport {useMemo, useState} from 'react';\nimport {ValidationState} from '@react-types/shared';\n\nexport interface RadioGroupState {\n /**\n * The name for the group, used for native form submission.\n * @deprecated\n * @private\n */\n readonly name: string,\n\n /** Whether the radio group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the radio group is read only. */\n readonly isReadOnly: boolean,\n\n /** The currently selected value. */\n readonly selectedValue: string | null,\n\n /** Sets the selected value. */\n setSelectedValue(value: string): void,\n\n /** The value of the last focused radio. */\n readonly lastFocusedValue: string | null,\n\n /** Sets the last focused value. */\n setLastFocusedValue(value: string): void,\n\n /** The current validation state of the radio group. */\n validationState: ValidationState\n}\n\nlet instance = Math.round(Math.random() * 10000000000);\nlet i = 0;\n\n/**\n * Provides state management for a radio group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useRadioGroupState(props: RadioGroupProps): RadioGroupState {\n // Preserved here for backward compatibility. React Aria now generates the name instead of stately.\n let name = useMemo(() => props.name || `radio-group-${instance}-${++i}`, [props.name]);\n let [selectedValue, setSelected] = useControlledState(props.value, props.defaultValue, props.onChange);\n let [lastFocusedValue, setLastFocusedValue] = useState(null);\n\n let setSelectedValue = (value) => {\n if (!props.isReadOnly && !props.isDisabled) {\n setSelected(value);\n }\n };\n\n return {\n name,\n selectedValue,\n setSelectedValue,\n lastFocusedValue,\n setLastFocusedValue,\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n validationState: props.validationState\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,18 +1,37 @@
1
1
  import {useControlledState as $fQ2SF$useControlledState} from "@react-stately/utils";
2
2
  import {useMemo as $fQ2SF$useMemo, useState as $fQ2SF$useState} from "react";
3
3
 
4
-
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */ /*
15
+ * Copyright 2020 Adobe. All rights reserved.
16
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License. You may obtain a copy
18
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software distributed under
21
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
+ * OF ANY KIND, either express or implied. See the License for the specific language
23
+ * governing permissions and limitations under the License.
24
+ */
5
25
 
6
26
  let $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 10000000000);
7
27
  let $a54cdc5c1942b639$var$i = 0;
8
28
  function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
9
29
  // Preserved here for backward compatibility. React Aria now generates the name instead of stately.
10
- let name = $fQ2SF$useMemo(()=>props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`
11
- , [
30
+ let name = (0, $fQ2SF$useMemo)(()=>props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
12
31
  props.name
13
32
  ]);
14
- let [selectedValue, setSelected] = $fQ2SF$useControlledState(props.value, props.defaultValue, props.onChange);
15
- let [lastFocusedValue, setLastFocusedValue] = $fQ2SF$useState(null);
33
+ let [selectedValue, setSelected] = (0, $fQ2SF$useControlledState)(props.value, props.defaultValue, props.onChange);
34
+ let [lastFocusedValue, setLastFocusedValue] = (0, $fQ2SF$useState)(null);
16
35
  let setSelectedValue = (value)=>{
17
36
  if (!props.isReadOnly && !props.isDisabled) setSelected(value);
18
37
  };
@@ -1 +1 @@
1
- {"mappings":";;;;;AC+CA,GAAG,CAAC,8BAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW;AACrD,GAAG,CAAC,uBAAC,GAAG,CAAC;SAMO,yCAAkB,CAAC,KAAsB,EAAoB,CAAC;IAC5E,EAAmG,AAAnG,iGAAmG;IACnG,GAAG,CAAC,IAAI,GAAG,cAAO,KAAO,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,8BAAQ,CAAC,CAAC,IAAI,uBAAC;MAAI,CAAC;QAAA,KAAK,CAAC,IAAI;IAAA,CAAC;IACrF,GAAG,EAAE,aAAa,EAAE,WAAW,IAAI,yBAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,QAAQ;IACrG,GAAG,EAAE,gBAAgB,EAAE,mBAAmB,IAAI,eAAQ,CAAC,IAAI;IAE3D,GAAG,CAAC,gBAAgB,IAAI,KAAK,GAAK,CAAC;QACjC,EAAE,GAAG,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,EACxC,WAAW,CAAC,KAAK;IAErB,CAAC;IAED,MAAM,CAAC,CAAC;cACN,IAAI;uBACJ,aAAa;0BACb,gBAAgB;0BAChB,gBAAgB;6BAChB,mBAAmB;QACnB,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;QACrC,eAAe,EAAE,KAAK,CAAC,eAAe;IACxC,CAAC;AACH,CAAC","sources":["packages/@react-stately/radio/src/index.ts","packages/@react-stately/radio/src/useRadioGroupState.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\nexport {useRadioGroupState} from './useRadioGroupState';\n\nexport type {RadioGroupProps} from '@react-types/radio';\nexport type {RadioGroupState} from './useRadioGroupState';\n","/*\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 {RadioGroupProps} from '@react-types/radio';\nimport {useControlledState} from '@react-stately/utils';\nimport {useMemo, useState} from 'react';\nimport {ValidationState} from '@react-types/shared';\n\nexport interface RadioGroupState {\n /**\n * The name for the group, used for native form submission.\n * @deprecated\n * @private\n */\n readonly name: string,\n\n /** Whether the radio group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the radio group is read only. */\n readonly isReadOnly: boolean,\n\n /** The currently selected value. */\n readonly selectedValue: string | null,\n\n /** Sets the selected value. */\n setSelectedValue(value: string): void,\n\n /** The value of the last focused radio. */\n readonly lastFocusedValue: string | null,\n\n /** Sets the last focused value. */\n setLastFocusedValue(value: string): void,\n\n /** The current validation state of the radio group. */\n validationState: ValidationState\n}\n\nlet instance = Math.round(Math.random() * 10000000000);\nlet i = 0;\n\n/**\n * Provides state management for a radio group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useRadioGroupState(props: RadioGroupProps): RadioGroupState {\n // Preserved here for backward compatibility. React Aria now generates the name instead of stately.\n let name = useMemo(() => props.name || `radio-group-${instance}-${++i}`, [props.name]);\n let [selectedValue, setSelected] = useControlledState(props.value, props.defaultValue, props.onChange);\n let [lastFocusedValue, setLastFocusedValue] = useState(null);\n\n let setSelectedValue = (value) => {\n if (!props.isReadOnly && !props.isDisabled) {\n setSelected(value);\n }\n };\n\n return {\n name,\n selectedValue,\n setSelectedValue,\n lastFocusedValue,\n setLastFocusedValue,\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n validationState: props.validationState\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AAmCA,IAAI,iCAAW,KAAK,KAAK,CAAC,KAAK,MAAM,KAAK;AAC1C,IAAI,0BAAI;AAMD,SAAS,0CAAmB,KAAsB,EAAoB;IAC3E,mGAAmG;IACnG,IAAI,OAAO,CAAA,GAAA,cAAO,AAAD,EAAE,IAAM,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,+BAAS,CAAC,EAAE,EAAE,wBAAE,CAAC,EAAE;QAAC,MAAM,IAAI;KAAC;IACrF,IAAI,CAAC,eAAe,YAAY,GAAG,CAAA,GAAA,yBAAiB,EAAE,MAAM,KAAK,EAAE,MAAM,YAAY,EAAE,MAAM,QAAQ;IACrG,IAAI,CAAC,kBAAkB,oBAAoB,GAAG,CAAA,GAAA,eAAO,EAAE,IAAI;IAE3D,IAAI,mBAAmB,CAAC,QAAU;QAChC,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,MAAM,UAAU,EACxC,YAAY;IAEhB;IAEA,OAAO;cACL;uBACA;0BACA;0BACA;6BACA;QACA,YAAY,MAAM,UAAU,IAAI,KAAK;QACrC,YAAY,MAAM,UAAU,IAAI,KAAK;QACrC,iBAAiB,MAAM,eAAe;IACxC;AACF;;CDlEC,GAED","sources":["packages/@react-stately/radio/src/index.ts","packages/@react-stately/radio/src/useRadioGroupState.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\nexport {useRadioGroupState} from './useRadioGroupState';\n\nexport type {RadioGroupProps} from '@react-types/radio';\nexport type {RadioGroupState} from './useRadioGroupState';\n","/*\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 {RadioGroupProps} from '@react-types/radio';\nimport {useControlledState} from '@react-stately/utils';\nimport {useMemo, useState} from 'react';\nimport {ValidationState} from '@react-types/shared';\n\nexport interface RadioGroupState {\n /**\n * The name for the group, used for native form submission.\n * @deprecated\n * @private\n */\n readonly name: string,\n\n /** Whether the radio group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the radio group is read only. */\n readonly isReadOnly: boolean,\n\n /** The currently selected value. */\n readonly selectedValue: string | null,\n\n /** Sets the selected value. */\n setSelectedValue(value: string): void,\n\n /** The value of the last focused radio. */\n readonly lastFocusedValue: string | null,\n\n /** Sets the last focused value. */\n setLastFocusedValue(value: string): void,\n\n /** The current validation state of the radio group. */\n validationState: ValidationState\n}\n\nlet instance = Math.round(Math.random() * 10000000000);\nlet i = 0;\n\n/**\n * Provides state management for a radio group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useRadioGroupState(props: RadioGroupProps): RadioGroupState {\n // Preserved here for backward compatibility. React Aria now generates the name instead of stately.\n let name = useMemo(() => props.name || `radio-group-${instance}-${++i}`, [props.name]);\n let [selectedValue, setSelected] = useControlledState(props.value, props.defaultValue, props.onChange);\n let [lastFocusedValue, setLastFocusedValue] = useState(null);\n\n let setSelectedValue = (value) => {\n if (!props.isReadOnly && !props.isDisabled) {\n setSelected(value);\n }\n };\n\n return {\n name,\n selectedValue,\n setSelectedValue,\n lastFocusedValue,\n setLastFocusedValue,\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n validationState: props.validationState\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/radio",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -17,10 +17,10 @@
17
17
  "url": "https://github.com/adobe/react-spectrum"
18
18
  },
19
19
  "dependencies": {
20
- "@babel/runtime": "^7.6.2",
21
- "@react-stately/utils": "^3.5.1",
22
- "@react-types/radio": "^3.3.0",
23
- "@react-types/shared": "^3.15.0"
20
+ "@react-stately/utils": "^3.5.2",
21
+ "@react-types/radio": "^3.3.1",
22
+ "@react-types/shared": "^3.16.0",
23
+ "@swc/helpers": "^0.4.14"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "9202ef59e8c104dd06ffe33148445ef7932a5d1b"
31
+ "gitHead": "5480d76bd815e239366f92852c76b6831ad2a4fd"
32
32
  }