@react-stately/checkbox 3.0.4-nightly.3036 → 3.0.4-nightly.3047
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 +61 -70
- package/dist/main.js.map +1 -1
- package/dist/module.js +48 -69
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/main.js
CHANGED
|
@@ -1,80 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
useControlledState
|
|
3
|
-
} = require("@react-stately/utils");
|
|
1
|
+
var $6X91M$reactstatelyutils = require("@react-stately/utils");
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (props === void 0) {
|
|
11
|
-
props = {};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let [selectedValues, setValue] = useControlledState(props.value, props.defaultValue || [], props.onChange);
|
|
15
|
-
const state = {
|
|
16
|
-
value: selectedValues,
|
|
17
|
-
|
|
18
|
-
setValue(value) {
|
|
19
|
-
if (props.isReadOnly || props.isDisabled) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
setValue(value);
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
isDisabled: props.isDisabled || false,
|
|
27
|
-
isReadOnly: props.isReadOnly || false,
|
|
28
|
-
|
|
29
|
-
isSelected(value) {
|
|
30
|
-
return selectedValues.includes(value);
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
addValue(value) {
|
|
34
|
-
if (props.isReadOnly || props.isDisabled) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
setValue(values => {
|
|
39
|
-
if (!values.includes(value)) {
|
|
40
|
-
return values.concat(value);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return values;
|
|
44
|
-
});
|
|
45
|
-
},
|
|
3
|
+
function $parcel$exportWildcard(dest, source) {
|
|
4
|
+
Object.keys(source).forEach(function(key) {
|
|
5
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
46
8
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
9
|
+
Object.defineProperty(dest, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return source[key];
|
|
50
13
|
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
51
16
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
17
|
+
return dest;
|
|
18
|
+
}
|
|
19
|
+
function $parcel$export(e, n, v, s) {
|
|
20
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
21
|
+
}
|
|
22
|
+
var $ed6cc164b76540d4$exports = {};
|
|
23
|
+
|
|
24
|
+
$parcel$export($ed6cc164b76540d4$exports, "useCheckboxGroupState", () => $ed6cc164b76540d4$export$daff6da51032a415);
|
|
25
|
+
|
|
26
|
+
function $ed6cc164b76540d4$export$daff6da51032a415(props = {
|
|
27
|
+
}) {
|
|
28
|
+
let [selectedValues, setValue] = $6X91M$reactstatelyutils.useControlledState(props.value, props.defaultValue || [], props.onChange);
|
|
29
|
+
const state = {
|
|
30
|
+
value: selectedValues,
|
|
31
|
+
setValue (value) {
|
|
32
|
+
if (props.isReadOnly || props.isDisabled) return;
|
|
33
|
+
setValue(value);
|
|
34
|
+
},
|
|
35
|
+
isDisabled: props.isDisabled || false,
|
|
36
|
+
isReadOnly: props.isReadOnly || false,
|
|
37
|
+
isSelected (value) {
|
|
38
|
+
return selectedValues.includes(value);
|
|
39
|
+
},
|
|
40
|
+
addValue (value) {
|
|
41
|
+
if (props.isReadOnly || props.isDisabled) return;
|
|
42
|
+
setValue((values)=>{
|
|
43
|
+
if (!values.includes(value)) return values.concat(value);
|
|
44
|
+
return values;
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
removeValue (value) {
|
|
48
|
+
if (props.isReadOnly || props.isDisabled) return;
|
|
49
|
+
setValue((values)=>{
|
|
50
|
+
if (values.includes(value)) return values.filter((existingValue)=>existingValue !== value
|
|
51
|
+
);
|
|
52
|
+
return values;
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
toggleValue (value) {
|
|
56
|
+
if (props.isReadOnly || props.isDisabled) return;
|
|
57
|
+
setValue((values)=>{
|
|
58
|
+
if (values.includes(value)) return values.filter((existingValue)=>existingValue !== value
|
|
59
|
+
);
|
|
60
|
+
return values.concat(value);
|
|
61
|
+
});
|
|
55
62
|
}
|
|
63
|
+
};
|
|
64
|
+
return state;
|
|
65
|
+
}
|
|
56
66
|
|
|
57
|
-
return values;
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
toggleValue(value) {
|
|
62
|
-
if (props.isReadOnly || props.isDisabled) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
setValue(values => {
|
|
67
|
-
if (values.includes(value)) {
|
|
68
|
-
return values.filter(existingValue => existingValue !== value);
|
|
69
|
-
}
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
});
|
|
73
|
-
}
|
|
68
|
+
$parcel$exportWildcard(module.exports, $ed6cc164b76540d4$exports);
|
|
74
69
|
|
|
75
|
-
};
|
|
76
|
-
return state;
|
|
77
|
-
}
|
|
78
70
|
|
|
79
|
-
exports.useCheckboxGroupState = useCheckboxGroupState;
|
|
80
71
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;SC6CgB,yCAAqB,CAAC,KAAyB,GAAG,CAAC;AAAA,CAAC,EAAsB,CAAC;IACzF,GAAG,EAAE,cAAc,EAAE,QAAQ,IAAI,2CAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,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AAK,GACvB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAC,aAAa,GAAI,aAAa,KAAK,KAAK;;gBAE/D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/src/useCheckboxGroupState.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 * from './useCheckboxGroupState';\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 {CheckboxGroupProps} from '@react-types/checkbox';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface CheckboxGroupState {\n /** Current selected values. */\n readonly value: readonly string[],\n\n /** Whether the checkbox group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the checkbox group is read only. */\n readonly isReadOnly: boolean,\n\n /** Returns whether the given value is selected. */\n isSelected(value: string): boolean,\n\n /** Sets the selected values. */\n setValue(value: string[]): void,\n\n /** Adds a value to the set of selected values. */\n addValue(value: string): void,\n\n /** Removes a value from the set of selected values. */\n removeValue(value: string): void,\n\n /** Toggles a value in the set of selected values. */\n toggleValue(value: string): void\n}\n\n/**\n * Provides state management for a checkbox group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useCheckboxGroupState(props: CheckboxGroupProps = {}): CheckboxGroupState {\n let [selectedValues, setValue] = useControlledState(props.value, props.defaultValue || [], props.onChange);\n\n const state: CheckboxGroupState = {\n value: selectedValues,\n setValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n\n setValue(value);\n },\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n isSelected(value) {\n return selectedValues.includes(value);\n },\n addValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n setValue(values => {\n if (!values.includes(value)) {\n return values.concat(value);\n }\n return values;\n });\n },\n removeValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n setValue(values => {\n if (values.includes(value)) {\n return values.filter(existingValue => existingValue !== value);\n }\n return values;\n });\n },\n toggleValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n setValue(values => {\n if (values.includes(value)) {\n return values.filter(existingValue => existingValue !== value);\n }\n return values.concat(value);\n });\n }\n };\n\n return state;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,76 +1,55 @@
|
|
|
1
|
-
import { useControlledState
|
|
1
|
+
import {useControlledState as $53VKu$useControlledState} from "@react-stately/utils";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (props.isReadOnly || props.isDisabled) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
setValue(values => {
|
|
51
|
-
if (values.includes(value)) {
|
|
52
|
-
return values.filter(existingValue => existingValue !== value);
|
|
3
|
+
function $parcel$export(e, n, v, s) {
|
|
4
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
5
|
+
}
|
|
6
|
+
var $22741eebe88b9d6f$exports = {};
|
|
7
|
+
|
|
8
|
+
$parcel$export($22741eebe88b9d6f$exports, "useCheckboxGroupState", () => $22741eebe88b9d6f$export$daff6da51032a415);
|
|
9
|
+
|
|
10
|
+
function $22741eebe88b9d6f$export$daff6da51032a415(props = {
|
|
11
|
+
}) {
|
|
12
|
+
let [selectedValues, setValue] = $53VKu$useControlledState(props.value, props.defaultValue || [], props.onChange);
|
|
13
|
+
const state = {
|
|
14
|
+
value: selectedValues,
|
|
15
|
+
setValue (value) {
|
|
16
|
+
if (props.isReadOnly || props.isDisabled) return;
|
|
17
|
+
setValue(value);
|
|
18
|
+
},
|
|
19
|
+
isDisabled: props.isDisabled || false,
|
|
20
|
+
isReadOnly: props.isReadOnly || false,
|
|
21
|
+
isSelected (value) {
|
|
22
|
+
return selectedValues.includes(value);
|
|
23
|
+
},
|
|
24
|
+
addValue (value) {
|
|
25
|
+
if (props.isReadOnly || props.isDisabled) return;
|
|
26
|
+
setValue((values)=>{
|
|
27
|
+
if (!values.includes(value)) return values.concat(value);
|
|
28
|
+
return values;
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
removeValue (value) {
|
|
32
|
+
if (props.isReadOnly || props.isDisabled) return;
|
|
33
|
+
setValue((values)=>{
|
|
34
|
+
if (values.includes(value)) return values.filter((existingValue)=>existingValue !== value
|
|
35
|
+
);
|
|
36
|
+
return values;
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
toggleValue (value) {
|
|
40
|
+
if (props.isReadOnly || props.isDisabled) return;
|
|
41
|
+
setValue((values)=>{
|
|
42
|
+
if (values.includes(value)) return values.filter((existingValue)=>existingValue !== value
|
|
43
|
+
);
|
|
44
|
+
return values.concat(value);
|
|
45
|
+
});
|
|
53
46
|
}
|
|
47
|
+
};
|
|
48
|
+
return state;
|
|
49
|
+
}
|
|
54
50
|
|
|
55
|
-
return values;
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
toggleValue(value) {
|
|
60
|
-
if (props.isReadOnly || props.isDisabled) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
51
|
|
|
64
|
-
setValue(values => {
|
|
65
|
-
if (values.includes(value)) {
|
|
66
|
-
return values.filter(existingValue => existingValue !== value);
|
|
67
|
-
}
|
|
68
52
|
|
|
69
|
-
return values.concat(value);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
53
|
|
|
73
|
-
|
|
74
|
-
return state;
|
|
75
|
-
}
|
|
54
|
+
export {$22741eebe88b9d6f$export$daff6da51032a415 as useCheckboxGroupState};
|
|
76
55
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;SC6CgB,yCAAqB,CAAC,KAAyB,GAAG,CAAC;AAAA,CAAC,EAAsB,CAAC;IACzF,GAAG,EAAE,cAAc,EAAE,QAAQ,IAAI,yBAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ;IAEzG,KAAK,CAAC,KAAK,GAAuB,CAAC;QACjC,KAAK,EAAE,cAAc;QACrB,QAAQ,EAAC,KAAK,E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K;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/src/useCheckboxGroupState.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 * from './useCheckboxGroupState';\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 {CheckboxGroupProps} from '@react-types/checkbox';\nimport {useControlledState} from '@react-stately/utils';\n\nexport interface CheckboxGroupState {\n /** Current selected values. */\n readonly value: readonly string[],\n\n /** Whether the checkbox group is disabled. */\n readonly isDisabled: boolean,\n\n /** Whether the checkbox group is read only. */\n readonly isReadOnly: boolean,\n\n /** Returns whether the given value is selected. */\n isSelected(value: string): boolean,\n\n /** Sets the selected values. */\n setValue(value: string[]): void,\n\n /** Adds a value to the set of selected values. */\n addValue(value: string): void,\n\n /** Removes a value from the set of selected values. */\n removeValue(value: string): void,\n\n /** Toggles a value in the set of selected values. */\n toggleValue(value: string): void\n}\n\n/**\n * Provides state management for a checkbox group component. Provides a name for the group,\n * and manages selection and focus state.\n */\nexport function useCheckboxGroupState(props: CheckboxGroupProps = {}): CheckboxGroupState {\n let [selectedValues, setValue] = useControlledState(props.value, props.defaultValue || [], props.onChange);\n\n const state: CheckboxGroupState = {\n value: selectedValues,\n setValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n\n setValue(value);\n },\n isDisabled: props.isDisabled || false,\n isReadOnly: props.isReadOnly || false,\n isSelected(value) {\n return selectedValues.includes(value);\n },\n addValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n setValue(values => {\n if (!values.includes(value)) {\n return values.concat(value);\n }\n return values;\n });\n },\n removeValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n setValue(values => {\n if (values.includes(value)) {\n return values.filter(existingValue => existingValue !== value);\n }\n return values;\n });\n },\n toggleValue(value) {\n if (props.isReadOnly || props.isDisabled) {\n return;\n }\n setValue(values => {\n if (values.includes(value)) {\n return values.filter(existingValue => existingValue !== value);\n }\n return values.concat(value);\n });\n }\n };\n\n return state;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";AAeA;IACE,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAElC,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,mDAAmD;IACnD,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAEnC,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEhC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,uDAAuD;IACvD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,qDAAqD;IACrD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED;;;GAGG;AACH,sCAAsC,KAAK,GAAE,kBAAuB,GAAG,kBAAkB,CAqDxF","sources":["packages/@react-stately/checkbox/src/packages/@react-stately/checkbox/src/useCheckboxGroupState.ts","packages/@react-stately/checkbox/src/packages/@react-stately/checkbox/src/index.ts","packages/@react-stately/checkbox/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 * from './useCheckboxGroupState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/checkbox",
|
|
3
|
-
"version": "3.0.4-nightly.
|
|
3
|
+
"version": "3.0.4-nightly.3047+87960ad25",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-stately/toggle": "3.0.0-nightly.
|
|
22
|
-
"@react-stately/utils": "3.0.0-nightly.
|
|
23
|
-
"@react-types/checkbox": "3.0.0-nightly.
|
|
21
|
+
"@react-stately/toggle": "3.0.0-nightly.1356+87960ad25",
|
|
22
|
+
"@react-stately/utils": "3.0.0-nightly.1356+87960ad25",
|
|
23
|
+
"@react-types/checkbox": "3.0.0-nightly.1356+87960ad25"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "87960ad25c26bc4cd6af506bb5e7e0f06621556c"
|
|
32
32
|
}
|