@react-stately/radio 3.6.2 → 3.7.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.
Files changed (2) hide show
  1. package/dist/import.mjs +54 -0
  2. package/package.json +10 -5
@@ -0,0 +1,54 @@
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
+ validationState: props.validationState
47
+ };
48
+ }
49
+
50
+
51
+
52
+
53
+ export {$a54cdc5c1942b639$export$bca9d026f8e704eb as useRadioGroupState};
54
+ //# sourceMappingURL=module.js.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.7.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.0",
27
+ "@react-types/shared": "^3.17.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": "a0efee84aa178cb1a202951dfd6d8de02b292307"
32
37
  }