@react-aria/checkbox 3.2.3 → 3.3.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 +100 -134
- package/dist/main.js.map +1 -1
- package/dist/module.js +91 -117
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/main.js
CHANGED
|
@@ -1,149 +1,115 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var $k0DcK$react = require("react");
|
|
2
|
+
var $k0DcK$reactariatoggle = require("@react-aria/toggle");
|
|
3
|
+
var $k0DcK$reactariautils = require("@react-aria/utils");
|
|
4
|
+
var $k0DcK$reactarialabel = require("@react-aria/label");
|
|
5
|
+
var $k0DcK$reactstatelytoggle = require("@react-stately/toggle");
|
|
6
|
+
|
|
7
|
+
function $parcel$exportWildcard(dest, source) {
|
|
8
|
+
Object.keys(source).forEach(function(key) {
|
|
9
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
4
12
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
Object.defineProperty(dest, key, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return source[key];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
8
20
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
return dest;
|
|
22
|
+
}
|
|
23
|
+
function $parcel$export(e, n, v, s) {
|
|
24
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
25
|
+
}
|
|
26
|
+
var $468c774d7db917b7$exports = {};
|
|
27
|
+
|
|
28
|
+
$parcel$export($468c774d7db917b7$exports, "useCheckbox", () => $468c774d7db917b7$export$e375f10ce42261c5);
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function $468c774d7db917b7$export$e375f10ce42261c5(props, state, inputRef) {
|
|
32
|
+
let { inputProps: inputProps } = $k0DcK$reactariatoggle.useToggle(props, state, inputRef);
|
|
33
|
+
let { isSelected: isSelected } = state;
|
|
34
|
+
let { isIndeterminate: isIndeterminate } = props;
|
|
35
|
+
$k0DcK$react.useEffect(()=>{
|
|
36
|
+
// indeterminate is a property, but it can only be set via javascript
|
|
37
|
+
// https://css-tricks.com/indeterminate-checkboxes/
|
|
38
|
+
if (inputRef.current) inputRef.current.indeterminate = isIndeterminate;
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
inputProps: {
|
|
42
|
+
...inputProps,
|
|
43
|
+
checked: isSelected,
|
|
44
|
+
'aria-checked': isIndeterminate ? 'mixed' : isSelected
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
13
48
|
|
|
14
|
-
var {
|
|
15
|
-
useToggle
|
|
16
|
-
} = require("@react-aria/toggle");
|
|
17
49
|
|
|
18
|
-
var {
|
|
19
|
-
|
|
20
|
-
|
|
50
|
+
var $253685172d17db7d$exports = {};
|
|
51
|
+
|
|
52
|
+
$parcel$export($253685172d17db7d$exports, "useCheckboxGroup", () => $253685172d17db7d$export$49ff6f28c54f1cbe);
|
|
53
|
+
const $64fc3370e682155f$export$31440636951aa68c = new WeakMap();
|
|
21
54
|
|
|
22
|
-
var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
|
|
23
55
|
|
|
24
|
-
function $parcel$interopDefault(a) {
|
|
25
|
-
return a && a.__esModule ? a.default : a;
|
|
26
|
-
}
|
|
27
56
|
|
|
28
|
-
/**
|
|
29
|
-
* Provides the behavior and accessibility implementation for a checkbox component.
|
|
30
|
-
* Checkboxes allow users to select multiple items from a list of individual items, or
|
|
31
|
-
* to mark one individual item as selected.
|
|
32
|
-
* @param props - Props for the checkbox.
|
|
33
|
-
* @param state - State for the checkbox, as returned by `useToggleState`.
|
|
34
|
-
* @param inputRef - A ref for the HTML input element.
|
|
35
|
-
*/
|
|
36
|
-
function useCheckbox(props, state, inputRef) {
|
|
37
|
-
let {
|
|
38
|
-
inputProps
|
|
39
|
-
} = useToggle(props, state, inputRef);
|
|
40
|
-
let {
|
|
41
|
-
isSelected
|
|
42
|
-
} = state;
|
|
43
|
-
let {
|
|
44
|
-
isIndeterminate
|
|
45
|
-
} = props;
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
// indeterminate is a property, but it can only be set via javascript
|
|
48
|
-
// https://css-tricks.com/indeterminate-checkboxes/
|
|
49
|
-
if (inputRef.current) {
|
|
50
|
-
inputRef.current.indeterminate = isIndeterminate;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
inputProps: _babelRuntimeHelpersExtends({}, inputProps, {
|
|
55
|
-
checked: isSelected,
|
|
56
|
-
'aria-checked': isIndeterminate ? 'mixed' : isSelected
|
|
57
|
-
})
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
function useCheckboxGroup(props, state) {
|
|
83
|
-
let {
|
|
84
|
-
isDisabled,
|
|
85
|
-
name
|
|
86
|
-
} = props;
|
|
87
|
-
let {
|
|
88
|
-
labelProps,
|
|
89
|
-
fieldProps
|
|
90
|
-
} = useLabel(_babelRuntimeHelpersExtends({}, props, {
|
|
91
|
-
// Checkbox group is not an HTML input element so it
|
|
92
|
-
// shouldn't be labeled by a <label> element.
|
|
93
|
-
labelElementType: 'span'
|
|
94
|
-
}));
|
|
95
|
-
let domProps = filterDOMProps(props, {
|
|
96
|
-
labelable: true
|
|
97
|
-
}); // Pass name prop from group to all items by attaching to the state.
|
|
98
|
-
|
|
99
|
-
$f32b30d8fc9d5c8adba5193c65e11d$export$checkboxGroupNames.set(state, name);
|
|
100
|
-
return {
|
|
101
|
-
groupProps: mergeProps(domProps, _babelRuntimeHelpersExtends({
|
|
102
|
-
role: 'group',
|
|
103
|
-
'aria-disabled': isDisabled || undefined
|
|
104
|
-
}, fieldProps)),
|
|
105
|
-
labelProps
|
|
106
|
-
};
|
|
58
|
+
function $253685172d17db7d$export$49ff6f28c54f1cbe(props, state) {
|
|
59
|
+
let { isDisabled: isDisabled , name: name } = props;
|
|
60
|
+
let { labelProps: labelProps , fieldProps: fieldProps } = $k0DcK$reactarialabel.useLabel({
|
|
61
|
+
...props,
|
|
62
|
+
// Checkbox group is not an HTML input element so it
|
|
63
|
+
// shouldn't be labeled by a <label> element.
|
|
64
|
+
labelElementType: 'span'
|
|
65
|
+
});
|
|
66
|
+
let domProps = $k0DcK$reactariautils.filterDOMProps(props, {
|
|
67
|
+
labelable: true
|
|
68
|
+
});
|
|
69
|
+
// Pass name prop from group to all items by attaching to the state.
|
|
70
|
+
$64fc3370e682155f$export$31440636951aa68c.set(state, name);
|
|
71
|
+
return {
|
|
72
|
+
groupProps: $k0DcK$reactariautils.mergeProps(domProps, {
|
|
73
|
+
role: 'group',
|
|
74
|
+
'aria-disabled': isDisabled || undefined,
|
|
75
|
+
...fieldProps
|
|
76
|
+
}),
|
|
77
|
+
labelProps: labelProps
|
|
78
|
+
};
|
|
107
79
|
}
|
|
108
80
|
|
|
109
|
-
exports.useCheckboxGroup = useCheckboxGroup;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Provides the behavior and accessibility implementation for a checkbox component contained within a checkbox group.
|
|
113
|
-
* Checkbox groups allow users to select multiple items from a list of options.
|
|
114
|
-
* @param props - Props for the checkbox.
|
|
115
|
-
* @param state - State for the checkbox, as returned by `useCheckboxGroupState`.
|
|
116
|
-
* @param inputRef - A ref for the HTML input element.
|
|
117
|
-
*/
|
|
118
|
-
function useCheckboxGroupItem(props, state, inputRef) {
|
|
119
|
-
const toggleState = useToggleState({
|
|
120
|
-
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
121
|
-
isSelected: state.isSelected(props.value),
|
|
122
|
-
|
|
123
|
-
onChange(isSelected) {
|
|
124
|
-
if (isSelected) {
|
|
125
|
-
state.addValue(props.value);
|
|
126
|
-
} else {
|
|
127
|
-
state.removeValue(props.value);
|
|
128
|
-
}
|
|
129
81
|
|
|
130
|
-
|
|
131
|
-
props.onChange(isSelected);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
82
|
+
var $07e03121d6ac83c8$exports = {};
|
|
134
83
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
84
|
+
$parcel$export($07e03121d6ac83c8$exports, "useCheckboxGroupItem", () => $07e03121d6ac83c8$export$353b32fc6898d37d);
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
function $07e03121d6ac83c8$export$353b32fc6898d37d(props, state, inputRef) {
|
|
89
|
+
const toggleState = $k0DcK$reactstatelytoggle.useToggleState({
|
|
90
|
+
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
91
|
+
isSelected: state.isSelected(props.value),
|
|
92
|
+
onChange (isSelected) {
|
|
93
|
+
if (isSelected) state.addValue(props.value);
|
|
94
|
+
else state.removeValue(props.value);
|
|
95
|
+
if (props.onChange) props.onChange(isSelected);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
let { inputProps: inputProps } = $468c774d7db917b7$export$e375f10ce42261c5({
|
|
99
|
+
...props,
|
|
100
|
+
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
101
|
+
isDisabled: props.isDisabled || state.isDisabled,
|
|
102
|
+
name: props.name || $64fc3370e682155f$export$31440636951aa68c.get(state)
|
|
103
|
+
}, toggleState, inputRef);
|
|
104
|
+
return {
|
|
105
|
+
inputProps: inputProps
|
|
106
|
+
};
|
|
146
107
|
}
|
|
147
108
|
|
|
148
|
-
|
|
109
|
+
|
|
110
|
+
$parcel$exportWildcard(module.exports, $468c774d7db917b7$exports);
|
|
111
|
+
$parcel$exportWildcard(module.exports, $253685172d17db7d$exports);
|
|
112
|
+
$parcel$exportWildcard(module.exports, $07e03121d6ac83c8$exports);
|
|
113
|
+
|
|
114
|
+
|
|
149
115
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;ACoBD;;;;;;;;AAQO,SAASG,WAAT,CAAqBC,KAArB,EAA+CC,KAA/C,EAAmEC,QAAnE,EAAwH;AAC7H,MAAI;AAACC,IAAAA;AAAD,MAAeC,SAAS,CAACJ,KAAD,EAAQC,KAAR,EAAeC,QAAf,CAA5B;AACA,MAAI;AAACG,IAAAA;AAAD,MAAeJ,KAAnB;AAEA,MAAI;AAACK,IAAAA;AAAD,MAAoBN,KAAxB;AACAO,EAAAA,SAAS,CAAC,MAAM;AACd;AACA;AACA,QAAIL,QAAQ,CAACM,OAAb,EAAsB;AACpBN,MAAAA,QAAQ,CAACM,OAAT,CAAiBC,aAAjB,GAAiCH,eAAjC;AACD;AACF,GANQ,CAAT;AAQA,SAAO;AACLH,IAAAA,UAAU,kCACLA,UADK;AAERO,MAAAA,OAAO,EAAEL,UAFD;AAGR,sBAAgBC,eAAe,GAAG,OAAH,GAAaD;AAHpC;AADL,GAAP;AAOD;;;;AClDD;;;;;;;;;;;AAcO,MAAMM,yDAAkB,GAAG,IAAIC,OAAJ,EAA3B;;ACYP;;;;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;;AAbgC,GAAD,CAAlC;AAgBA,MAAI;AAACF,IAAAA;AAAD,MAAe,4CACdH,KADc;AAEjB+B,IAAAA,UAAU,EAAE/B,KAAK,CAAC+B,UAAN,IAAoB9B,KAAK,CAAC8B,UAFrB;AAGjBjB,IAAAA,UAAU,EAAEd,KAAK,CAACc,UAAN,IAAoBb,KAAK,CAACa,UAHrB;AAIjBC,IAAAA,IAAI,EAAEf,KAAK,CAACe,IAAN,IAAc,0DAAmBqB,GAAnB,CAAuBnC,KAAvB;AAJH,MAKhB4B,WALgB,EAKH3B,QALG,CAAnB;AAOA,SAAO;AAACC,IAAAA;AAAD,GAAP;AACD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/@react-aria/checkbox/src/useCheckbox.ts","./packages/@react-aria/checkbox/src/utils.ts","./packages/@react-aria/checkbox/src/useCheckboxGroup.ts","./packages/@react-aria/checkbox/src/useCheckboxGroupItem.ts"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {InputHTMLAttributes, RefObject, useEffect} from 'react';\nimport {ToggleState} from '@react-stately/toggle';\nimport {useToggle} from '@react-aria/toggle';\n\nexport interface CheckboxAria {\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component.\n * Checkboxes allow users to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `useToggleState`.\n * @param inputRef - A ref for the HTML input element.\n */\nexport function useCheckbox(props: AriaCheckboxProps, state: ToggleState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {\n let {inputProps} = useToggle(props, state, inputRef);\n let {isSelected} = state;\n\n let {isIndeterminate} = props;\n useEffect(() => {\n // indeterminate is a property, but it can only be set via javascript\n // https://css-tricks.com/indeterminate-checkboxes/\n if (inputRef.current) {\n inputRef.current.indeterminate = isIndeterminate;\n }\n });\n\n return {\n inputProps: {\n ...inputProps,\n checked: isSelected,\n 'aria-checked': isIndeterminate ? 'mixed' : isSelected\n }\n };\n}\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 {CheckboxGroupState} from '@react-stately/checkbox';\n\nexport const checkboxGroupNames = new WeakMap<CheckboxGroupState, string>();\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 {AriaCheckboxGroupProps} from '@react-types/checkbox';\nimport {checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes} from 'react';\nimport {useLabel} from '@react-aria/label';\n\ninterface CheckboxGroupAria {\n /** Props for the checkbox group wrapper element. */\n groupProps: HTMLAttributes<HTMLElement>,\n /** Props for the checkbox group's visible label (if any). */\n labelProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox group.\n * @param state - State for the checkbox group, as returned by `useCheckboxGroupState`.\n */\nexport function useCheckboxGroup(props: AriaCheckboxGroupProps, state: CheckboxGroupState): CheckboxGroupAria {\n let {isDisabled, name} = props;\n\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Checkbox group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n // Pass name prop from group to all items by attaching to the state.\n checkboxGroupNames.set(state, name);\n\n return {\n groupProps: mergeProps(domProps, {\n role: 'group',\n 'aria-disabled': isDisabled || undefined,\n ...fieldProps\n }),\n labelProps\n };\n}\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 {AriaCheckboxGroupItemProps} from '@react-types/checkbox';\nimport {CheckboxAria, useCheckbox} from './useCheckbox';\nimport {checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {RefObject} from 'react';\nimport {useToggleState} from '@react-stately/toggle';\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component contained within a checkbox group.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `useCheckboxGroupState`.\n * @param inputRef - A ref for the HTML input element.\n */\nexport function useCheckboxGroupItem(props: AriaCheckboxGroupItemProps, state: CheckboxGroupState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {\n const toggleState = useToggleState({\n isReadOnly: props.isReadOnly || state.isReadOnly,\n isSelected: state.isSelected(props.value),\n onChange(isSelected) {\n if (isSelected) {\n state.addValue(props.value);\n } else {\n state.removeValue(props.value);\n }\n\n if (props.onChange) {\n props.onChange(isSelected);\n }\n }\n });\n\n let {inputProps} = useCheckbox({\n ...props,\n isReadOnly: props.isReadOnly || state.isReadOnly,\n isDisabled: props.isDisabled || state.isDisabled,\n name: props.name || checkboxGroupNames.get(state)\n }, toggleState, inputRef);\n\n return {inputProps};\n}\n"],"names":["$parcel$interopDefault","a","__esModule","default","useCheckbox","props","state","inputRef","inputProps","useToggle","isSelected","isIndeterminate","useEffect","current","indeterminate","checked","checkboxGroupNames","WeakMap","useCheckboxGroup","isDisabled","name","labelProps","fieldProps","useLabel","labelElementType","domProps","filterDOMProps","labelable","set","groupProps","mergeProps","role","undefined","useCheckboxGroupItem","toggleState","useToggleState","isReadOnly","value","onChange","addValue","removeValue","get"],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SC8B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E,gCAAU,CAAC,QAAQ,EAAE,CAAC;YAChC,IAAI,EAAE,CAAO;YACb,CAAe,gBAAE,UAAU,IAAI,SAAS;eACrC,UAAU;QACf,CAAC;oBACD,UAAU;IACZ,CAAC;AACH,CAAC;;;;;;;;;SE7Be,yCAAoB,CAAC,KAAiC,EAAE,KAAyB,EAAE,QAAqC,EAAgB,CAAC;IACvJ,KAAK,CAAC,WAAW,GAAG,wCAAc,CAAC,CAAC;QAClC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU;QAChD,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;QACxC,QAAQ,EAAC,UAAU,EAAE,CAAC;YACpB,EAAE,EAAE,UAAU,EACZ,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK;iBAE1B,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK;YAG/B,EAAE,EAAE,KAAK,CAAC,QAAQ,EAChB,KAAK,CAAC,QAAQ,CAAC,UAAU;QAE7B,CAAC;IACH,CAAC;IAED,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,yCAAW,CAAC,CAAC;WAC3B,KAAK;QACR,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU;QAChD,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU;QAChD,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,yCAAkB,CAAC,GAAG,CAAC,KAAK;IAClD,CAAC,EAAE,WAAW,EAAE,QAAQ;IAExB,MAAM,CAAC,CAAC;oBAAA,UAAU;IAAA,CAAC;AACrB,CAAC;","sources":["packages/@react-aria/checkbox/src/index.ts","packages/@react-aria/checkbox/src/useCheckbox.ts","packages/@react-aria/checkbox/src/useCheckboxGroup.ts","packages/@react-aria/checkbox/src/utils.ts","packages/@react-aria/checkbox/src/useCheckboxGroupItem.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 './useCheckbox';\nexport * from './useCheckboxGroup';\nexport * from './useCheckboxGroupItem';\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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {InputHTMLAttributes, RefObject, useEffect} from 'react';\nimport {ToggleState} from '@react-stately/toggle';\nimport {useToggle} from '@react-aria/toggle';\n\nexport interface CheckboxAria {\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component.\n * Checkboxes allow users to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `useToggleState`.\n * @param inputRef - A ref for the HTML input element.\n */\nexport function useCheckbox(props: AriaCheckboxProps, state: ToggleState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {\n let {inputProps} = useToggle(props, state, inputRef);\n let {isSelected} = state;\n\n let {isIndeterminate} = props;\n useEffect(() => {\n // indeterminate is a property, but it can only be set via javascript\n // https://css-tricks.com/indeterminate-checkboxes/\n if (inputRef.current) {\n inputRef.current.indeterminate = isIndeterminate;\n }\n });\n\n return {\n inputProps: {\n ...inputProps,\n checked: isSelected,\n 'aria-checked': isIndeterminate ? 'mixed' : isSelected\n }\n };\n}\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 {AriaCheckboxGroupProps} from '@react-types/checkbox';\nimport {checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes} from 'react';\nimport {useLabel} from '@react-aria/label';\n\ninterface CheckboxGroupAria {\n /** Props for the checkbox group wrapper element. */\n groupProps: HTMLAttributes<HTMLElement>,\n /** Props for the checkbox group's visible label (if any). */\n labelProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox group.\n * @param state - State for the checkbox group, as returned by `useCheckboxGroupState`.\n */\nexport function useCheckboxGroup(props: AriaCheckboxGroupProps, state: CheckboxGroupState): CheckboxGroupAria {\n let {isDisabled, name} = props;\n\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Checkbox group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n // Pass name prop from group to all items by attaching to the state.\n checkboxGroupNames.set(state, name);\n\n return {\n groupProps: mergeProps(domProps, {\n role: 'group',\n 'aria-disabled': isDisabled || undefined,\n ...fieldProps\n }),\n labelProps\n };\n}\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 {CheckboxGroupState} from '@react-stately/checkbox';\n\nexport const checkboxGroupNames = new WeakMap<CheckboxGroupState, string>();\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 {AriaCheckboxGroupItemProps} from '@react-types/checkbox';\nimport {CheckboxAria, useCheckbox} from './useCheckbox';\nimport {checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {RefObject} from 'react';\nimport {useToggleState} from '@react-stately/toggle';\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component contained within a checkbox group.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `useCheckboxGroupState`.\n * @param inputRef - A ref for the HTML input element.\n */\nexport function useCheckboxGroupItem(props: AriaCheckboxGroupItemProps, state: CheckboxGroupState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {\n const toggleState = useToggleState({\n isReadOnly: props.isReadOnly || state.isReadOnly,\n isSelected: state.isSelected(props.value),\n onChange(isSelected) {\n if (isSelected) {\n state.addValue(props.value);\n } else {\n state.removeValue(props.value);\n }\n\n if (props.onChange) {\n props.onChange(isSelected);\n }\n }\n });\n\n let {inputProps} = useCheckbox({\n ...props,\n isReadOnly: props.isReadOnly || state.isReadOnly,\n isDisabled: props.isDisabled || state.isDisabled,\n name: props.name || checkboxGroupNames.get(state)\n }, toggleState, inputRef);\n\n return {inputProps};\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,123 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { filterDOMProps, mergeProps } from "@react-aria/utils";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
return {
|
|
34
|
-
inputProps: _babelRuntimeHelpersEsmExtends({}, inputProps, {
|
|
35
|
-
checked: isSelected,
|
|
36
|
-
'aria-checked': isIndeterminate ? 'mixed' : isSelected
|
|
37
|
-
})
|
|
38
|
-
};
|
|
1
|
+
import {useEffect as $cKEhs$useEffect} from "react";
|
|
2
|
+
import {useToggle as $cKEhs$useToggle} from "@react-aria/toggle";
|
|
3
|
+
import {filterDOMProps as $cKEhs$filterDOMProps, mergeProps as $cKEhs$mergeProps} from "@react-aria/utils";
|
|
4
|
+
import {useLabel as $cKEhs$useLabel} from "@react-aria/label";
|
|
5
|
+
import {useToggleState as $cKEhs$useToggleState} from "@react-stately/toggle";
|
|
6
|
+
|
|
7
|
+
function $parcel$export(e, n, v, s) {
|
|
8
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
|
+
}
|
|
10
|
+
var $406796ff087fe49b$exports = {};
|
|
11
|
+
|
|
12
|
+
$parcel$export($406796ff087fe49b$exports, "useCheckbox", () => $406796ff087fe49b$export$e375f10ce42261c5);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
|
|
16
|
+
let { inputProps: inputProps } = $cKEhs$useToggle(props, state, inputRef);
|
|
17
|
+
let { isSelected: isSelected } = state;
|
|
18
|
+
let { isIndeterminate: isIndeterminate } = props;
|
|
19
|
+
$cKEhs$useEffect(()=>{
|
|
20
|
+
// indeterminate is a property, but it can only be set via javascript
|
|
21
|
+
// https://css-tricks.com/indeterminate-checkboxes/
|
|
22
|
+
if (inputRef.current) inputRef.current.indeterminate = isIndeterminate;
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
inputProps: {
|
|
26
|
+
...inputProps,
|
|
27
|
+
checked: isSelected,
|
|
28
|
+
'aria-checked': isIndeterminate ? 'mixed' : isSelected
|
|
29
|
+
}
|
|
30
|
+
};
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
labelElementType: 'span'
|
|
72
|
-
}));
|
|
73
|
-
let domProps = filterDOMProps(props, {
|
|
74
|
-
labelable: true
|
|
75
|
-
}); // Pass name prop from group to all items by attaching to the state.
|
|
76
|
-
|
|
77
|
-
$c1125120fa765e2757aafb57a69ea88$export$checkboxGroupNames.set(state, name);
|
|
78
|
-
return {
|
|
79
|
-
groupProps: mergeProps(domProps, _babelRuntimeHelpersEsmExtends({
|
|
80
|
-
role: 'group',
|
|
81
|
-
'aria-disabled': isDisabled || undefined
|
|
82
|
-
}, fieldProps)),
|
|
83
|
-
labelProps
|
|
84
|
-
};
|
|
33
|
+
|
|
34
|
+
var $1e9fce0cfacc738b$exports = {};
|
|
35
|
+
|
|
36
|
+
$parcel$export($1e9fce0cfacc738b$exports, "useCheckboxGroup", () => $1e9fce0cfacc738b$export$49ff6f28c54f1cbe);
|
|
37
|
+
const $1ae600c947479353$export$31440636951aa68c = new WeakMap();
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
function $1e9fce0cfacc738b$export$49ff6f28c54f1cbe(props, state) {
|
|
43
|
+
let { isDisabled: isDisabled , name: name } = props;
|
|
44
|
+
let { labelProps: labelProps , fieldProps: fieldProps } = $cKEhs$useLabel({
|
|
45
|
+
...props,
|
|
46
|
+
// Checkbox group is not an HTML input element so it
|
|
47
|
+
// shouldn't be labeled by a <label> element.
|
|
48
|
+
labelElementType: 'span'
|
|
49
|
+
});
|
|
50
|
+
let domProps = $cKEhs$filterDOMProps(props, {
|
|
51
|
+
labelable: true
|
|
52
|
+
});
|
|
53
|
+
// Pass name prop from group to all items by attaching to the state.
|
|
54
|
+
$1ae600c947479353$export$31440636951aa68c.set(state, name);
|
|
55
|
+
return {
|
|
56
|
+
groupProps: $cKEhs$mergeProps(domProps, {
|
|
57
|
+
role: 'group',
|
|
58
|
+
'aria-disabled': isDisabled || undefined,
|
|
59
|
+
...fieldProps
|
|
60
|
+
}),
|
|
61
|
+
labelProps: labelProps
|
|
62
|
+
};
|
|
85
63
|
}
|
|
86
64
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
props.
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
inputProps
|
|
114
|
-
} = useCheckbox(_babelRuntimeHelpersEsmExtends({}, props, {
|
|
115
|
-
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
116
|
-
isDisabled: props.isDisabled || state.isDisabled,
|
|
117
|
-
name: props.name || $c1125120fa765e2757aafb57a69ea88$export$checkboxGroupNames.get(state)
|
|
118
|
-
}), toggleState, inputRef);
|
|
119
|
-
return {
|
|
120
|
-
inputProps
|
|
121
|
-
};
|
|
65
|
+
|
|
66
|
+
var $fba3e38d5ca8983f$exports = {};
|
|
67
|
+
|
|
68
|
+
$parcel$export($fba3e38d5ca8983f$exports, "useCheckboxGroupItem", () => $fba3e38d5ca8983f$export$353b32fc6898d37d);
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
|
|
73
|
+
const toggleState = $cKEhs$useToggleState({
|
|
74
|
+
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
75
|
+
isSelected: state.isSelected(props.value),
|
|
76
|
+
onChange (isSelected) {
|
|
77
|
+
if (isSelected) state.addValue(props.value);
|
|
78
|
+
else state.removeValue(props.value);
|
|
79
|
+
if (props.onChange) props.onChange(isSelected);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
let { inputProps: inputProps } = $406796ff087fe49b$export$e375f10ce42261c5({
|
|
83
|
+
...props,
|
|
84
|
+
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
85
|
+
isDisabled: props.isDisabled || state.isDisabled,
|
|
86
|
+
name: props.name || $1ae600c947479353$export$31440636951aa68c.get(state)
|
|
87
|
+
}, toggleState, inputRef);
|
|
88
|
+
return {
|
|
89
|
+
inputProps: inputProps
|
|
90
|
+
};
|
|
122
91
|
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
export {$406796ff087fe49b$export$e375f10ce42261c5 as useCheckbox, $1e9fce0cfacc738b$export$49ff6f28c54f1cbe as useCheckboxGroup, $fba3e38d5ca8983f$export$353b32fc6898d37d as useCheckboxGroupItem};
|
|
123
97
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAsBA;;;;;;;;OAQO,SAASA,WAAT,CAAqBC,KAArB,EAA+CC,KAA/C,EAAmEC,QAAnE,EAAwH;AAC7H,MAAI;AAACC,IAAAA;AAAD,MAAeC,SAAS,CAACJ,KAAD,EAAQC,KAAR,EAAeC,QAAf,CAA5B;AACA,MAAI;AAACG,IAAAA;AAAD,MAAeJ,KAAnB;AAEA,MAAI;AAACK,IAAAA;AAAD,MAAoBN,KAAxB;AACAO,EAAAA,SAAS,CAAC,MAAM;AACd;AACA;AACA,QAAIL,QAAQ,CAACM,OAAb,EAAsB;AACpBN,MAAAA,QAAQ,CAACM,OAAT,CAAiBC,aAAjB,GAAiCH,eAAjC;AACD;AACF,GANQ,CAAT;AAQA,SAAO;AACLH,IAAAA,UAAU,qCACLA,UADK;AAERO,MAAAA,OAAO,EAAEL,UAFD;AAGR,sBAAgBC,eAAe,GAAG,OAAH,GAAaD;AAHpC;AADL,GAAP;AAOD;;AClDD;;;;;;;;;;;AAcO,MAAMM,0DAAkB,GAAG,IAAIC,OAAJ,EAA3B;;ACYP;;;;;;OAMO,SAASC,gBAAT,CAA0Bb,KAA1B,EAAyDC,KAAzD,EAAuG;AAC5G,MAAI;AAACa,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAAqBf,KAAzB;AAEA,MAAI;AAACgB,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAA2BC,QAAQ,oCAClClB,KADkC;AAErC;AACA;AACAmB,IAAAA,gBAAgB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IAAI,EAAEf,KAAK,CAACe,IAAN,IAAc,2DAAmBqB,GAAnB,CAAuBnC,KAAvB;AAJH,MAKhB4B,WALgB,EAKH3B,QALG,CAAnB;AAOA,SAAO;AAACC,IAAAA;AAAD,GAAP;AACD","sources":["./packages/@react-aria/checkbox/src/useCheckbox.ts","./packages/@react-aria/checkbox/src/utils.ts","./packages/@react-aria/checkbox/src/useCheckboxGroup.ts","./packages/@react-aria/checkbox/src/useCheckboxGroupItem.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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {InputHTMLAttributes, RefObject, useEffect} from 'react';\nimport {ToggleState} from '@react-stately/toggle';\nimport {useToggle} from '@react-aria/toggle';\n\nexport interface CheckboxAria {\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component.\n * Checkboxes allow users to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `useToggleState`.\n * @param inputRef - A ref for the HTML input element.\n */\nexport function useCheckbox(props: AriaCheckboxProps, state: ToggleState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {\n let {inputProps} = useToggle(props, state, inputRef);\n let {isSelected} = state;\n\n let {isIndeterminate} = props;\n useEffect(() => {\n // indeterminate is a property, but it can only be set via javascript\n // https://css-tricks.com/indeterminate-checkboxes/\n if (inputRef.current) {\n inputRef.current.indeterminate = isIndeterminate;\n }\n });\n\n return {\n inputProps: {\n ...inputProps,\n checked: isSelected,\n 'aria-checked': isIndeterminate ? 'mixed' : isSelected\n }\n };\n}\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 {CheckboxGroupState} from '@react-stately/checkbox';\n\nexport const checkboxGroupNames = new WeakMap<CheckboxGroupState, string>();\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 {AriaCheckboxGroupProps} from '@react-types/checkbox';\nimport {checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes} from 'react';\nimport {useLabel} from '@react-aria/label';\n\ninterface CheckboxGroupAria {\n /** Props for the checkbox group wrapper element. */\n groupProps: HTMLAttributes<HTMLElement>,\n /** Props for the checkbox group's visible label (if any). */\n labelProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox group.\n * @param state - State for the checkbox group, as returned by `useCheckboxGroupState`.\n */\nexport function useCheckboxGroup(props: AriaCheckboxGroupProps, state: CheckboxGroupState): CheckboxGroupAria {\n let {isDisabled, name} = props;\n\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Checkbox group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n // Pass name prop from group to all items by attaching to the state.\n checkboxGroupNames.set(state, name);\n\n return {\n groupProps: mergeProps(domProps, {\n role: 'group',\n 'aria-disabled': isDisabled || undefined,\n ...fieldProps\n }),\n labelProps\n };\n}\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 {AriaCheckboxGroupItemProps} from '@react-types/checkbox';\nimport {CheckboxAria, useCheckbox} from './useCheckbox';\nimport {checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {RefObject} from 'react';\nimport {useToggleState} from '@react-stately/toggle';\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component contained within a checkbox group.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `useCheckboxGroupState`.\n * @param inputRef - A ref for the HTML input element.\n */\nexport function useCheckboxGroupItem(props: AriaCheckboxGroupItemProps, state: CheckboxGroupState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {\n const toggleState = useToggleState({\n isReadOnly: props.isReadOnly || state.isReadOnly,\n isSelected: state.isSelected(props.value),\n onChange(isSelected) {\n if (isSelected) {\n state.addValue(props.value);\n } else {\n state.removeValue(props.value);\n }\n\n if (props.onChange) {\n props.onChange(isSelected);\n }\n }\n });\n\n let {inputProps} = useCheckbox({\n ...props,\n isReadOnly: props.isReadOnly || state.isReadOnly,\n isDisabled: props.isDisabled || state.isDisabled,\n name: props.name || checkboxGroupNames.get(state)\n }, toggleState, inputRef);\n\n return {inputProps};\n}\n"],"names":["useCheckbox","props","state","inputRef","inputProps","useToggle","isSelected","isIndeterminate","useEffect","current","indeterminate","checked","checkboxGroupNames","WeakMap","useCheckboxGroup","isDisabled","name","labelProps","fieldProps","useLabel","labelElementType","domProps","filterDOMProps","labelable","set","groupProps","mergeProps","role","undefined","useCheckboxGroupItem","toggleState","useToggleState","isReadOnly","value","onChange","addValue","removeValue","get"],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;SC8BgB,yCAAW,CAAC,KAAwB,EAAE,KAAkB,EAAE,QAAqC,EAAgB,CAAC;IAC9H,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,gBAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ;IACnD,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,KAAK;IAExB,GAAG,CAAC,CAAC,kBAAA,eAAe,EAAA,CAAC,GAAG,KAAK;IAC7B,gBAAS,KAAO,CAAC;QACf,EAAqE,AAArE,mEAAqE;QACrE,EAAmD,AAAnD,iDAAmD;QACnD,EAAE,EAAE,QAAQ,CAAC,OAAO,EAClB,QAAQ,CAAC,OAAO,CAAC,aAAa,GAAG,eAAe;IAEpD,CAAC;IAED,MAAM,CAAC,CAAC;QACN,UAAU,EAAE,CAAC;eACR,UAAU;YACb,OAAO,EAAE,UAAU;YACnB,CAAc,eAAE,eAAe,GAAG,CAAO,SAAG,UAAU;QACxD,CAAC;IACH,CAAC;AACH,CAAC;;;;;;AEpCM,KAAK,CAAC,yCAAkB,GAAG,GAAG,CAAC,OAAO;;;;;SDkB7B,yCAAgB,CAAC,KAA6B,EAAE,KAAyB,EAAqB,CAAC;IAC7G,GAAG,CAAC,CAAC,aAAA,UAAU,SAAE,IAAI,EAAA,CAAC,GAAG,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AU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU;QAChD,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,yCAAkB,CAAC,GAAG,CAAC,KAAK;IAClD,CAAC,EAAE,WAAW,EAAE,QAAQ;IAExB,MAAM,CAAC,CAAC;oBAAA,UAAU;IAAA,CAAC;AACrB,CAAC;","sources":["packages/@react-aria/checkbox/src/index.ts","packages/@react-aria/checkbox/src/useCheckbox.ts","packages/@react-aria/checkbox/src/useCheckboxGroup.ts","packages/@react-aria/checkbox/src/utils.ts","packages/@react-aria/checkbox/src/useCheckboxGroupItem.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 './useCheckbox';\nexport * from './useCheckboxGroup';\nexport * from './useCheckboxGroupItem';\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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {InputHTMLAttributes, RefObject, useEffect} from 'react';\nimport {ToggleState} from '@react-stately/toggle';\nimport {useToggle} from '@react-aria/toggle';\n\nexport interface CheckboxAria {\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component.\n * Checkboxes allow users to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `useToggleState`.\n * @param inputRef - A ref for the HTML input element.\n */\nexport function useCheckbox(props: AriaCheckboxProps, state: ToggleState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {\n let {inputProps} = useToggle(props, state, inputRef);\n let {isSelected} = state;\n\n let {isIndeterminate} = props;\n useEffect(() => {\n // indeterminate is a property, but it can only be set via javascript\n // https://css-tricks.com/indeterminate-checkboxes/\n if (inputRef.current) {\n inputRef.current.indeterminate = isIndeterminate;\n }\n });\n\n return {\n inputProps: {\n ...inputProps,\n checked: isSelected,\n 'aria-checked': isIndeterminate ? 'mixed' : isSelected\n }\n };\n}\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 {AriaCheckboxGroupProps} from '@react-types/checkbox';\nimport {checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes} from 'react';\nimport {useLabel} from '@react-aria/label';\n\ninterface CheckboxGroupAria {\n /** Props for the checkbox group wrapper element. */\n groupProps: HTMLAttributes<HTMLElement>,\n /** Props for the checkbox group's visible label (if any). */\n labelProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox group.\n * @param state - State for the checkbox group, as returned by `useCheckboxGroupState`.\n */\nexport function useCheckboxGroup(props: AriaCheckboxGroupProps, state: CheckboxGroupState): CheckboxGroupAria {\n let {isDisabled, name} = props;\n\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Checkbox group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n // Pass name prop from group to all items by attaching to the state.\n checkboxGroupNames.set(state, name);\n\n return {\n groupProps: mergeProps(domProps, {\n role: 'group',\n 'aria-disabled': isDisabled || undefined,\n ...fieldProps\n }),\n labelProps\n };\n}\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 {CheckboxGroupState} from '@react-stately/checkbox';\n\nexport const checkboxGroupNames = new WeakMap<CheckboxGroupState, string>();\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 {AriaCheckboxGroupItemProps} from '@react-types/checkbox';\nimport {CheckboxAria, useCheckbox} from './useCheckbox';\nimport {checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {RefObject} from 'react';\nimport {useToggleState} from '@react-stately/toggle';\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component contained within a checkbox group.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `useCheckboxGroupState`.\n * @param inputRef - A ref for the HTML input element.\n */\nexport function useCheckboxGroupItem(props: AriaCheckboxGroupItemProps, state: CheckboxGroupState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {\n const toggleState = useToggleState({\n isReadOnly: props.isReadOnly || state.isReadOnly,\n isSelected: state.isSelected(props.value),\n onChange(isSelected) {\n if (isSelected) {\n state.addValue(props.value);\n } else {\n state.removeValue(props.value);\n }\n\n if (props.onChange) {\n props.onChange(isSelected);\n }\n }\n });\n\n let {inputProps} = useCheckbox({\n ...props,\n isReadOnly: props.isReadOnly || state.isReadOnly,\n isDisabled: props.isDisabled || state.isDisabled,\n name: props.name || checkboxGroupNames.get(state)\n }, toggleState, inputRef);\n\n return {inputProps};\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;AAiBA;IACE,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAA;CAClD;AAED;;;;;;;GAOG;AACH,4BAA4B,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,gBAAgB,CAAC,GAAG,YAAY,CAoB7H;AE/BD;IACE,oDAAoD;IACpD,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,6DAA6D;IAC7D,UAAU,EAAE,eAAe,WAAW,CAAC,CAAA;CACxC;AAED;;;;;GAKG;AACH,iCAAiC,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,kBAAkB,GAAG,iBAAiB,CAuB5G;ACpCD;;;;;;GAMG;AACH,qCAAqC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,gBAAgB,CAAC,GAAG,YAAY,CAyBtJ","sources":["packages/@react-aria/checkbox/src/packages/@react-aria/checkbox/src/useCheckbox.ts","packages/@react-aria/checkbox/src/packages/@react-aria/checkbox/src/utils.ts","packages/@react-aria/checkbox/src/packages/@react-aria/checkbox/src/useCheckboxGroup.ts","packages/@react-aria/checkbox/src/packages/@react-aria/checkbox/src/useCheckboxGroupItem.ts","packages/@react-aria/checkbox/src/packages/@react-aria/checkbox/src/index.ts","packages/@react-aria/checkbox/src/index.ts"],"sourcesContent":[null,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 */\n\nexport * from './useCheckbox';\nexport * from './useCheckboxGroup';\nexport * from './useCheckboxGroupItem';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/checkbox",
|
|
3
|
-
"version": "3.2
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/label": "^3.
|
|
22
|
-
"@react-aria/toggle": "^3.
|
|
23
|
-
"@react-aria/utils": "^3.
|
|
24
|
-
"@react-stately/checkbox": "^3.0.
|
|
25
|
-
"@react-stately/toggle": "^3.2.
|
|
26
|
-
"@react-types/checkbox": "^3.2.
|
|
21
|
+
"@react-aria/label": "^3.2.4",
|
|
22
|
+
"@react-aria/toggle": "^3.2.2",
|
|
23
|
+
"@react-aria/utils": "^3.11.3",
|
|
24
|
+
"@react-stately/checkbox": "^3.0.6",
|
|
25
|
+
"@react-stately/toggle": "^3.2.6",
|
|
26
|
+
"@react-types/checkbox": "^3.2.6"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "ed8d8d984c2f7f2c31e8b18795b97858a95e4729"
|
|
35
35
|
}
|