@react-stately/radio 3.6.2 → 3.8.0

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.
@@ -0,0 +1,55 @@
1
+ import {useControlledState as $fQ2SF$useControlledState} from "@react-stately/utils";
2
+ import {useMemo as $fQ2SF$useMemo, useState as $fQ2SF$useState} from "react";
3
+
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
+ */
25
+
26
+ let $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 10000000000);
27
+ let $a54cdc5c1942b639$var$i = 0;
28
+ function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
29
+ // Preserved here for backward compatibility. React Aria now generates the name instead of stately.
30
+ let name = (0, $fQ2SF$useMemo)(()=>props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
31
+ props.name
32
+ ]);
33
+ let [selectedValue, setSelected] = (0, $fQ2SF$useControlledState)(props.value, props.defaultValue, props.onChange);
34
+ let [lastFocusedValue, setLastFocusedValue] = (0, $fQ2SF$useState)(null);
35
+ let setSelectedValue = (value)=>{
36
+ if (!props.isReadOnly && !props.isDisabled) setSelected(value);
37
+ };
38
+ return {
39
+ name: name,
40
+ selectedValue: selectedValue,
41
+ setSelectedValue: setSelectedValue,
42
+ lastFocusedValue: lastFocusedValue,
43
+ setLastFocusedValue: setLastFocusedValue,
44
+ isDisabled: props.isDisabled || false,
45
+ isReadOnly: props.isReadOnly || false,
46
+ isRequired: props.isRequired || false,
47
+ validationState: props.validationState || null
48
+ };
49
+ }
50
+
51
+
52
+
53
+
54
+ export {$a54cdc5c1942b639$export$bca9d026f8e704eb as useRadioGroupState};
55
+ //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -48,7 +48,8 @@ function $307db30b5687e2e8$export$bca9d026f8e704eb(props) {
48
48
  setLastFocusedValue: setLastFocusedValue,
49
49
  isDisabled: props.isDisabled || false,
50
50
  isReadOnly: props.isReadOnly || false,
51
- validationState: props.validationState
51
+ isRequired: props.isRequired || false,
52
+ validationState: props.validationState || null
52
53
  };
53
54
  }
54
55
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
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"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AAsCA,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,YAAY,MAAM,UAAU,IAAI,KAAK;QACrC,iBAAiB,MAAM,eAAe,IAAI,IAAI;IAChD;AACF;;CDtEC,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 /** Whether the radio group is required. */\n readonly isRequired: boolean,\n\n /** Whether the radio group is valid or invalid. */\n readonly validationState: ValidationState | null,\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\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 isRequired: props.isRequired || false,\n validationState: props.validationState || null\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -43,7 +43,8 @@ function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
43
43
  setLastFocusedValue: setLastFocusedValue,
44
44
  isDisabled: props.isDisabled || false,
45
45
  isReadOnly: props.isReadOnly || false,
46
- validationState: props.validationState
46
+ isRequired: props.isRequired || false,
47
+ validationState: props.validationState || null
47
48
  };
48
49
  }
49
50
 
@@ -1 +1 @@
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"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AAsCA,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,YAAY,MAAM,UAAU,IAAI,KAAK;QACrC,iBAAiB,MAAM,eAAe,IAAI,IAAI;IAChD;AACF;;CDtEC,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 /** Whether the radio group is required. */\n readonly isRequired: boolean,\n\n /** Whether the radio group is valid or invalid. */\n readonly validationState: ValidationState | null,\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\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 isRequired: props.isRequired || false,\n validationState: props.validationState || null\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -11,6 +11,10 @@ export interface RadioGroupState {
11
11
  readonly isDisabled: boolean;
12
12
  /** Whether the radio group is read only. */
13
13
  readonly isReadOnly: boolean;
14
+ /** Whether the radio group is required. */
15
+ readonly isRequired: boolean;
16
+ /** Whether the radio group is valid or invalid. */
17
+ readonly validationState: ValidationState | null;
14
18
  /** The currently selected value. */
15
19
  readonly selectedValue: string | null;
16
20
  /** Sets the selected value. */
@@ -19,8 +23,6 @@ export interface RadioGroupState {
19
23
  readonly lastFocusedValue: string | null;
20
24
  /** Sets the last focused value. */
21
25
  setLastFocusedValue(value: string): void;
22
- /** The current validation state of the radio group. */
23
- validationState: ValidationState;
24
26
  }
25
27
  /**
26
28
  * Provides state management for a radio group component. Provides a name for the group,
@@ -1 +1 @@
1
- {"mappings":";;AAiBA;IACE;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,oCAAoC;IACpC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC,+BAA+B;IAC/B,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC,2CAA2C;IAC3C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC,mCAAmC;IACnC,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC,uDAAuD;IACvD,eAAe,EAAE,eAAe,CAAA;CACjC;AAKD;;;GAGG;AACH,mCAAmC,KAAK,EAAE,eAAe,GAAG,eAAe,CAsB1E;AC9DD,YAAY,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-stately/radio/src/packages/@react-stately/radio/src/useRadioGroupState.ts","packages/@react-stately/radio/src/packages/@react-stately/radio/src/index.ts","packages/@react-stately/radio/src/index.ts"],"sourcesContent":[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 */\n\nexport {useRadioGroupState} from './useRadioGroupState';\n\nexport type {RadioGroupProps} from '@react-types/radio';\nexport type {RadioGroupState} from './useRadioGroupState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAiBA;IACE;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,mDAAmD;IACnD,QAAQ,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IAEjD,oCAAoC;IACpC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC,+BAA+B;IAC/B,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC,2CAA2C;IAC3C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC,mCAAmC;IACnC,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACzC;AAKD;;;GAGG;AACH,mCAAmC,KAAK,EAAE,eAAe,GAAG,eAAe,CAuB1E;AClED,YAAY,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-stately/radio/src/packages/@react-stately/radio/src/useRadioGroupState.ts","packages/@react-stately/radio/src/packages/@react-stately/radio/src/index.ts","packages/@react-stately/radio/src/index.ts"],"sourcesContent":[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 */\n\nexport {useRadioGroupState} from './useRadioGroupState';\n\nexport type {RadioGroupProps} from '@react-types/radio';\nexport type {RadioGroupState} from './useRadioGroupState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@react-stately/radio",
3
- "version": "3.6.2",
3
+ "version": "3.8.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/module.js",
8
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
8
13
  "types": "dist/types.d.ts",
9
14
  "source": "src/index.ts",
10
15
  "files": [
@@ -17,9 +22,9 @@
17
22
  "url": "https://github.com/adobe/react-spectrum"
18
23
  },
19
24
  "dependencies": {
20
- "@react-stately/utils": "^3.5.2",
21
- "@react-types/radio": "^3.3.1",
22
- "@react-types/shared": "^3.16.0",
25
+ "@react-stately/utils": "^3.6.0",
26
+ "@react-types/radio": "^3.4.1",
27
+ "@react-types/shared": "^3.18.0",
23
28
  "@swc/helpers": "^0.4.14"
24
29
  },
25
30
  "peerDependencies": {
@@ -28,5 +33,5 @@
28
33
  "publishConfig": {
29
34
  "access": "public"
30
35
  },
31
- "gitHead": "5480d76bd815e239366f92852c76b6831ad2a4fd"
36
+ "gitHead": "9d1ba9bd8ebcd63bf3495ade16d349bcb71795ce"
32
37
  }
@@ -29,6 +29,12 @@ export interface RadioGroupState {
29
29
  /** Whether the radio group is read only. */
30
30
  readonly isReadOnly: boolean,
31
31
 
32
+ /** Whether the radio group is required. */
33
+ readonly isRequired: boolean,
34
+
35
+ /** Whether the radio group is valid or invalid. */
36
+ readonly validationState: ValidationState | null,
37
+
32
38
  /** The currently selected value. */
33
39
  readonly selectedValue: string | null,
34
40
 
@@ -39,10 +45,7 @@ export interface RadioGroupState {
39
45
  readonly lastFocusedValue: string | null,
40
46
 
41
47
  /** Sets the last focused value. */
42
- setLastFocusedValue(value: string): void,
43
-
44
- /** The current validation state of the radio group. */
45
- validationState: ValidationState
48
+ setLastFocusedValue(value: string): void
46
49
  }
47
50
 
48
51
  let instance = Math.round(Math.random() * 10000000000);
@@ -72,6 +75,7 @@ export function useRadioGroupState(props: RadioGroupProps): RadioGroupState {
72
75
  setLastFocusedValue,
73
76
  isDisabled: props.isDisabled || false,
74
77
  isReadOnly: props.isReadOnly || false,
75
- validationState: props.validationState
78
+ isRequired: props.isRequired || false,
79
+ validationState: props.validationState || null
76
80
  };
77
81
  }