@react-aria/checkbox 3.0.0-nightly-641446f65-240905

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @react-aria/checkbox
2
+
3
+ This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
@@ -0,0 +1,21 @@
1
+ import {useCheckbox as $406796ff087fe49b$export$e375f10ce42261c5} from "./useCheckbox.mjs";
2
+ import {useCheckboxGroup as $1e9fce0cfacc738b$export$49ff6f28c54f1cbe} from "./useCheckboxGroup.mjs";
3
+ import {useCheckboxGroupItem as $fba3e38d5ca8983f$export$353b32fc6898d37d} from "./useCheckboxGroupItem.mjs";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+
19
+
20
+ export {$406796ff087fe49b$export$e375f10ce42261c5 as useCheckbox, $1e9fce0cfacc738b$export$49ff6f28c54f1cbe as useCheckboxGroup, $fba3e38d5ca8983f$export$353b32fc6898d37d as useCheckboxGroupItem};
21
+ //# sourceMappingURL=module.js.map
package/dist/main.js ADDED
@@ -0,0 +1,28 @@
1
+ var $468c774d7db917b7$exports = require("./useCheckbox.main.js");
2
+ var $253685172d17db7d$exports = require("./useCheckboxGroup.main.js");
3
+ var $07e03121d6ac83c8$exports = require("./useCheckboxGroupItem.main.js");
4
+
5
+
6
+ function $parcel$export(e, n, v, s) {
7
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
+ }
9
+
10
+ $parcel$export(module.exports, "useCheckbox", () => $468c774d7db917b7$exports.useCheckbox);
11
+ $parcel$export(module.exports, "useCheckboxGroup", () => $253685172d17db7d$exports.useCheckboxGroup);
12
+ $parcel$export(module.exports, "useCheckboxGroupItem", () => $07e03121d6ac83c8$exports.useCheckboxGroupItem);
13
+ /*
14
+ * Copyright 2020 Adobe. All rights reserved.
15
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License. You may obtain a copy
17
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software distributed under
20
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
+ * OF ANY KIND, either express or implied. See the License for the specific language
22
+ * governing permissions and limitations under the License.
23
+ */
24
+
25
+
26
+
27
+
28
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/checkbox/src/index.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 */\nexport type {CheckboxAria} from './useCheckbox';\nexport {useCheckbox} from './useCheckbox';\nexport {useCheckboxGroup} from './useCheckboxGroup';\nexport {useCheckboxGroupItem} from './useCheckboxGroupItem';\nexport type {AriaCheckboxGroupItemProps, AriaCheckboxGroupProps, AriaCheckboxProps} from '@react-types/checkbox';\nexport type {CheckboxGroupAria} from './useCheckboxGroup';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js ADDED
@@ -0,0 +1,21 @@
1
+ import {useCheckbox as $406796ff087fe49b$export$e375f10ce42261c5} from "./useCheckbox.module.js";
2
+ import {useCheckboxGroup as $1e9fce0cfacc738b$export$49ff6f28c54f1cbe} from "./useCheckboxGroup.module.js";
3
+ import {useCheckboxGroupItem as $fba3e38d5ca8983f$export$353b32fc6898d37d} from "./useCheckboxGroupItem.module.js";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+
19
+
20
+ export {$406796ff087fe49b$export$e375f10ce42261c5 as useCheckbox, $1e9fce0cfacc738b$export$49ff6f28c54f1cbe as useCheckboxGroup, $fba3e38d5ca8983f$export$353b32fc6898d37d as useCheckboxGroupItem};
21
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/checkbox/src/index.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 */\nexport type {CheckboxAria} from './useCheckbox';\nexport {useCheckbox} from './useCheckbox';\nexport {useCheckboxGroup} from './useCheckboxGroup';\nexport {useCheckboxGroupItem} from './useCheckboxGroupItem';\nexport type {AriaCheckboxGroupItemProps, AriaCheckboxGroupProps, AriaCheckboxProps} from '@react-types/checkbox';\nexport type {CheckboxGroupAria} from './useCheckboxGroup';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,56 @@
1
+ import { AriaCheckboxProps, AriaCheckboxGroupProps, AriaCheckboxGroupItemProps } from "@react-types/checkbox";
2
+ import { InputHTMLAttributes, LabelHTMLAttributes } from "react";
3
+ import { RefObject, ValidationResult, DOMAttributes } from "@react-types/shared";
4
+ import { ToggleState } from "@react-stately/toggle";
5
+ import { CheckboxGroupState } from "@react-stately/checkbox";
6
+ export interface CheckboxAria extends ValidationResult {
7
+ /** Props for the label wrapper element. */
8
+ labelProps: LabelHTMLAttributes<HTMLLabelElement>;
9
+ /** Props for the input element. */
10
+ inputProps: InputHTMLAttributes<HTMLInputElement>;
11
+ /** Whether the checkbox is selected. */
12
+ isSelected: boolean;
13
+ /** Whether the checkbox is in a pressed state. */
14
+ isPressed: boolean;
15
+ /** Whether the checkbox is disabled. */
16
+ isDisabled: boolean;
17
+ /** Whether the checkbox is read only. */
18
+ isReadOnly: boolean;
19
+ }
20
+ /**
21
+ * Provides the behavior and accessibility implementation for a checkbox component.
22
+ * Checkboxes allow users to select multiple items from a list of individual items, or
23
+ * to mark one individual item as selected.
24
+ * @param props - Props for the checkbox.
25
+ * @param state - State for the checkbox, as returned by `useToggleState`.
26
+ * @param inputRef - A ref for the HTML input element.
27
+ */
28
+ export function useCheckbox(props: AriaCheckboxProps, state: ToggleState, inputRef: RefObject<HTMLInputElement | null>): CheckboxAria;
29
+ export interface CheckboxGroupAria extends ValidationResult {
30
+ /** Props for the checkbox group wrapper element. */
31
+ groupProps: DOMAttributes;
32
+ /** Props for the checkbox group's visible label (if any). */
33
+ labelProps: DOMAttributes;
34
+ /** Props for the checkbox group description element, if any. */
35
+ descriptionProps: DOMAttributes;
36
+ /** Props for the checkbox group error message element, if any. */
37
+ errorMessageProps: DOMAttributes;
38
+ }
39
+ /**
40
+ * Provides the behavior and accessibility implementation for a checkbox group component.
41
+ * Checkbox groups allow users to select multiple items from a list of options.
42
+ * @param props - Props for the checkbox group.
43
+ * @param state - State for the checkbox group, as returned by `useCheckboxGroupState`.
44
+ */
45
+ export function useCheckboxGroup(props: AriaCheckboxGroupProps, state: CheckboxGroupState): CheckboxGroupAria;
46
+ /**
47
+ * Provides the behavior and accessibility implementation for a checkbox component contained within a checkbox group.
48
+ * Checkbox groups allow users to select multiple items from a list of options.
49
+ * @param props - Props for the checkbox.
50
+ * @param state - State for the checkbox, as returned by `useCheckboxGroupState`.
51
+ * @param inputRef - A ref for the HTML input element.
52
+ */
53
+ export function useCheckboxGroupItem(props: AriaCheckboxGroupItemProps, state: CheckboxGroupState, inputRef: RefObject<HTMLInputElement | null>): CheckboxAria;
54
+ export type { AriaCheckboxGroupItemProps, AriaCheckboxGroupProps, AriaCheckboxProps } from '@react-types/checkbox';
55
+
56
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;AAoBA,6BAA8B,SAAQ,gBAAgB;IACpD,2CAA2C;IAC3C,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,wCAAwC;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,wCAAwC;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,UAAU,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,4BAA4B,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,YAAY,CAoCpI;AE3DD,kCAAmC,SAAQ,gBAAgB;IACzD,oDAAoD;IACpD,UAAU,EAAE,aAAa,CAAC;IAC1B,6DAA6D;IAC7D,UAAU,EAAE,aAAa,CAAC;IAC1B,gEAAgE;IAChE,gBAAgB,EAAE,aAAa,CAAC;IAChC,kEAAkE;IAClE,iBAAiB,EAAE,aAAa,CAAA;CACjC;AAED;;;;;GAKG;AACH,iCAAiC,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,kBAAkB,GAAG,iBAAiB,CA0C5G;AC1DD;;;;;;GAMG;AACH,qCAAqC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,YAAY,CAuE7J;ACpFD,YAAY,EAAC,0BAA0B,EAAE,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,uBAAuB,CAAC","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 */\nexport type {CheckboxAria} from './useCheckbox';\nexport {useCheckbox} from './useCheckbox';\nexport {useCheckboxGroup} from './useCheckboxGroup';\nexport {useCheckboxGroupItem} from './useCheckboxGroupItem';\nexport type {AriaCheckboxGroupItemProps, AriaCheckboxGroupProps, AriaCheckboxProps} from '@react-types/checkbox';\nexport type {CheckboxGroupAria} from './useCheckboxGroup';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -0,0 +1,63 @@
1
+ var $ar5WQ$react = require("react");
2
+ var $ar5WQ$reactariaform = require("@react-aria/form");
3
+ var $ar5WQ$reactstatelyform = require("@react-stately/form");
4
+ var $ar5WQ$reactariatoggle = require("@react-aria/toggle");
5
+
6
+
7
+ function $parcel$export(e, n, v, s) {
8
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
+ }
10
+
11
+ $parcel$export(module.exports, "useCheckbox", () => $468c774d7db917b7$export$e375f10ce42261c5);
12
+ /*
13
+ * Copyright 2020 Adobe. All rights reserved.
14
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
+ * you may not use this file except in compliance with the License. You may obtain a copy
16
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software distributed under
19
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
+ * OF ANY KIND, either express or implied. See the License for the specific language
21
+ * governing permissions and limitations under the License.
22
+ */
23
+
24
+
25
+
26
+ function $468c774d7db917b7$export$e375f10ce42261c5(props, state, inputRef) {
27
+ // Create validation state here because it doesn't make sense to add to general useToggleState.
28
+ let validationState = (0, $ar5WQ$reactstatelyform.useFormValidationState)({
29
+ ...props,
30
+ value: state.isSelected
31
+ });
32
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = validationState.displayValidation;
33
+ let { labelProps: labelProps, inputProps: inputProps, isSelected: isSelected, isPressed: isPressed, isDisabled: isDisabled, isReadOnly: isReadOnly } = (0, $ar5WQ$reactariatoggle.useToggle)({
34
+ ...props,
35
+ isInvalid: isInvalid
36
+ }, state, inputRef);
37
+ (0, $ar5WQ$reactariaform.useFormValidation)(props, validationState, inputRef);
38
+ let { isIndeterminate: isIndeterminate, isRequired: isRequired, validationBehavior: validationBehavior = 'aria' } = props;
39
+ (0, $ar5WQ$react.useEffect)(()=>{
40
+ // indeterminate is a property, but it can only be set via javascript
41
+ // https://css-tricks.com/indeterminate-checkboxes/
42
+ if (inputRef.current) inputRef.current.indeterminate = !!isIndeterminate;
43
+ });
44
+ return {
45
+ labelProps: labelProps,
46
+ inputProps: {
47
+ ...inputProps,
48
+ checked: isSelected,
49
+ 'aria-required': isRequired && validationBehavior === 'aria' || undefined,
50
+ required: isRequired && validationBehavior === 'native'
51
+ },
52
+ isSelected: isSelected,
53
+ isPressed: isPressed,
54
+ isDisabled: isDisabled,
55
+ isReadOnly: isReadOnly,
56
+ isInvalid: isInvalid,
57
+ validationErrors: validationErrors,
58
+ validationDetails: validationDetails
59
+ };
60
+ }
61
+
62
+
63
+ //# sourceMappingURL=useCheckbox.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAY,KAAwB,EAAE,KAAkB,EAAE,QAA4C;IACpH,+FAA+F;IAC/F,IAAI,kBAAkB,CAAA,GAAA,8CAAqB,EAAE;QAAC,GAAG,KAAK;QAAE,OAAO,MAAM,UAAU;IAAA;IAC/E,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,gBAAgB,iBAAiB;IACxF,IAAI,cAAC,UAAU,cAAE,UAAU,cAAE,UAAU,aAAE,SAAS,cAAE,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,gCAAQ,EAAE;QACtF,GAAG,KAAK;mBACR;IACF,GAAG,OAAO;IAEV,CAAA,GAAA,sCAAgB,EAAE,OAAO,iBAAiB;IAE1C,IAAI,mBAAC,eAAe,cAAE,UAAU,sBAAE,qBAAqB,QAAO,GAAG;IACjE,CAAA,GAAA,sBAAQ,EAAE;QACR,qEAAqE;QACrE,mDAAmD;QACnD,IAAI,SAAS,OAAO,EAClB,SAAS,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC;IAEvC;IAEA,OAAO;oBACL;QACA,YAAY;YACV,GAAG,UAAU;YACb,SAAS;YACT,iBAAiB,AAAC,cAAc,uBAAuB,UAAW;YAClE,UAAU,cAAc,uBAAuB;QACjD;oBACA;mBACA;oBACA;oBACA;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/@react-aria/checkbox/src/useCheckbox.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, LabelHTMLAttributes, useEffect} from 'react';\nimport {RefObject, ValidationResult} from '@react-types/shared';\nimport {ToggleState} from '@react-stately/toggle';\nimport {useFormValidation} from '@react-aria/form';\nimport {useFormValidationState} from '@react-stately/form';\nimport {useToggle} from '@react-aria/toggle';\n\nexport interface CheckboxAria extends ValidationResult {\n /** Props for the label wrapper element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Whether the checkbox is selected. */\n isSelected: boolean,\n /** Whether the checkbox is in a pressed state. */\n isPressed: boolean,\n /** Whether the checkbox is disabled. */\n isDisabled: boolean,\n /** Whether the checkbox is read only. */\n isReadOnly: boolean\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 | null>): CheckboxAria {\n // Create validation state here because it doesn't make sense to add to general useToggleState.\n let validationState = useFormValidationState({...props, value: state.isSelected});\n let {isInvalid, validationErrors, validationDetails} = validationState.displayValidation;\n let {labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly} = useToggle({\n ...props,\n isInvalid\n }, state, inputRef);\n\n useFormValidation(props, validationState, inputRef);\n\n let {isIndeterminate, isRequired, validationBehavior = 'aria'} = 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 labelProps,\n inputProps: {\n ...inputProps,\n checked: isSelected,\n 'aria-required': (isRequired && validationBehavior === 'aria') || undefined,\n required: isRequired && validationBehavior === 'native'\n },\n isSelected,\n isPressed,\n isDisabled,\n isReadOnly,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useCheckbox.main.js.map"}
@@ -0,0 +1,58 @@
1
+ import {useEffect as $jNP0e$useEffect} from "react";
2
+ import {useFormValidation as $jNP0e$useFormValidation} from "@react-aria/form";
3
+ import {useFormValidationState as $jNP0e$useFormValidationState} from "@react-stately/form";
4
+ import {useToggle as $jNP0e$useToggle} from "@react-aria/toggle";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
17
+
18
+
19
+
20
+ function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
21
+ // Create validation state here because it doesn't make sense to add to general useToggleState.
22
+ let validationState = (0, $jNP0e$useFormValidationState)({
23
+ ...props,
24
+ value: state.isSelected
25
+ });
26
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = validationState.displayValidation;
27
+ let { labelProps: labelProps, inputProps: inputProps, isSelected: isSelected, isPressed: isPressed, isDisabled: isDisabled, isReadOnly: isReadOnly } = (0, $jNP0e$useToggle)({
28
+ ...props,
29
+ isInvalid: isInvalid
30
+ }, state, inputRef);
31
+ (0, $jNP0e$useFormValidation)(props, validationState, inputRef);
32
+ let { isIndeterminate: isIndeterminate, isRequired: isRequired, validationBehavior: validationBehavior = 'aria' } = props;
33
+ (0, $jNP0e$useEffect)(()=>{
34
+ // indeterminate is a property, but it can only be set via javascript
35
+ // https://css-tricks.com/indeterminate-checkboxes/
36
+ if (inputRef.current) inputRef.current.indeterminate = !!isIndeterminate;
37
+ });
38
+ return {
39
+ labelProps: labelProps,
40
+ inputProps: {
41
+ ...inputProps,
42
+ checked: isSelected,
43
+ 'aria-required': isRequired && validationBehavior === 'aria' || undefined,
44
+ required: isRequired && validationBehavior === 'native'
45
+ },
46
+ isSelected: isSelected,
47
+ isPressed: isPressed,
48
+ isDisabled: isDisabled,
49
+ isReadOnly: isReadOnly,
50
+ isInvalid: isInvalid,
51
+ validationErrors: validationErrors,
52
+ validationDetails: validationDetails
53
+ };
54
+ }
55
+
56
+
57
+ export {$406796ff087fe49b$export$e375f10ce42261c5 as useCheckbox};
58
+ //# sourceMappingURL=useCheckbox.module.js.map
@@ -0,0 +1,58 @@
1
+ import {useEffect as $jNP0e$useEffect} from "react";
2
+ import {useFormValidation as $jNP0e$useFormValidation} from "@react-aria/form";
3
+ import {useFormValidationState as $jNP0e$useFormValidationState} from "@react-stately/form";
4
+ import {useToggle as $jNP0e$useToggle} from "@react-aria/toggle";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
17
+
18
+
19
+
20
+ function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
21
+ // Create validation state here because it doesn't make sense to add to general useToggleState.
22
+ let validationState = (0, $jNP0e$useFormValidationState)({
23
+ ...props,
24
+ value: state.isSelected
25
+ });
26
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = validationState.displayValidation;
27
+ let { labelProps: labelProps, inputProps: inputProps, isSelected: isSelected, isPressed: isPressed, isDisabled: isDisabled, isReadOnly: isReadOnly } = (0, $jNP0e$useToggle)({
28
+ ...props,
29
+ isInvalid: isInvalid
30
+ }, state, inputRef);
31
+ (0, $jNP0e$useFormValidation)(props, validationState, inputRef);
32
+ let { isIndeterminate: isIndeterminate, isRequired: isRequired, validationBehavior: validationBehavior = 'aria' } = props;
33
+ (0, $jNP0e$useEffect)(()=>{
34
+ // indeterminate is a property, but it can only be set via javascript
35
+ // https://css-tricks.com/indeterminate-checkboxes/
36
+ if (inputRef.current) inputRef.current.indeterminate = !!isIndeterminate;
37
+ });
38
+ return {
39
+ labelProps: labelProps,
40
+ inputProps: {
41
+ ...inputProps,
42
+ checked: isSelected,
43
+ 'aria-required': isRequired && validationBehavior === 'aria' || undefined,
44
+ required: isRequired && validationBehavior === 'native'
45
+ },
46
+ isSelected: isSelected,
47
+ isPressed: isPressed,
48
+ isDisabled: isDisabled,
49
+ isReadOnly: isReadOnly,
50
+ isInvalid: isInvalid,
51
+ validationErrors: validationErrors,
52
+ validationDetails: validationDetails
53
+ };
54
+ }
55
+
56
+
57
+ export {$406796ff087fe49b$export$e375f10ce42261c5 as useCheckbox};
58
+ //# sourceMappingURL=useCheckbox.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAY,KAAwB,EAAE,KAAkB,EAAE,QAA4C;IACpH,+FAA+F;IAC/F,IAAI,kBAAkB,CAAA,GAAA,6BAAqB,EAAE;QAAC,GAAG,KAAK;QAAE,OAAO,MAAM,UAAU;IAAA;IAC/E,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,gBAAgB,iBAAiB;IACxF,IAAI,cAAC,UAAU,cAAE,UAAU,cAAE,UAAU,aAAE,SAAS,cAAE,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE;QACtF,GAAG,KAAK;mBACR;IACF,GAAG,OAAO;IAEV,CAAA,GAAA,wBAAgB,EAAE,OAAO,iBAAiB;IAE1C,IAAI,mBAAC,eAAe,cAAE,UAAU,sBAAE,qBAAqB,QAAO,GAAG;IACjE,CAAA,GAAA,gBAAQ,EAAE;QACR,qEAAqE;QACrE,mDAAmD;QACnD,IAAI,SAAS,OAAO,EAClB,SAAS,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC;IAEvC;IAEA,OAAO;oBACL;QACA,YAAY;YACV,GAAG,UAAU;YACb,SAAS;YACT,iBAAiB,AAAC,cAAc,uBAAuB,UAAW;YAClE,UAAU,cAAc,uBAAuB;QACjD;oBACA;mBACA;oBACA;oBACA;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/@react-aria/checkbox/src/useCheckbox.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, LabelHTMLAttributes, useEffect} from 'react';\nimport {RefObject, ValidationResult} from '@react-types/shared';\nimport {ToggleState} from '@react-stately/toggle';\nimport {useFormValidation} from '@react-aria/form';\nimport {useFormValidationState} from '@react-stately/form';\nimport {useToggle} from '@react-aria/toggle';\n\nexport interface CheckboxAria extends ValidationResult {\n /** Props for the label wrapper element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Whether the checkbox is selected. */\n isSelected: boolean,\n /** Whether the checkbox is in a pressed state. */\n isPressed: boolean,\n /** Whether the checkbox is disabled. */\n isDisabled: boolean,\n /** Whether the checkbox is read only. */\n isReadOnly: boolean\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 | null>): CheckboxAria {\n // Create validation state here because it doesn't make sense to add to general useToggleState.\n let validationState = useFormValidationState({...props, value: state.isSelected});\n let {isInvalid, validationErrors, validationDetails} = validationState.displayValidation;\n let {labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly} = useToggle({\n ...props,\n isInvalid\n }, state, inputRef);\n\n useFormValidation(props, validationState, inputRef);\n\n let {isIndeterminate, isRequired, validationBehavior = 'aria'} = 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 labelProps,\n inputProps: {\n ...inputProps,\n checked: isSelected,\n 'aria-required': (isRequired && validationBehavior === 'aria') || undefined,\n required: isRequired && validationBehavior === 'native'\n },\n isSelected,\n isPressed,\n isDisabled,\n isReadOnly,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useCheckbox.module.js.map"}
@@ -0,0 +1,68 @@
1
+ var $64fc3370e682155f$exports = require("./utils.main.js");
2
+ var $6d1SX$reactariautils = require("@react-aria/utils");
3
+ var $6d1SX$reactarialabel = require("@react-aria/label");
4
+ var $6d1SX$reactariainteractions = require("@react-aria/interactions");
5
+
6
+
7
+ function $parcel$export(e, n, v, s) {
8
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
+ }
10
+
11
+ $parcel$export(module.exports, "useCheckboxGroup", () => $253685172d17db7d$export$49ff6f28c54f1cbe);
12
+ /*
13
+ * Copyright 2020 Adobe. All rights reserved.
14
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
+ * you may not use this file except in compliance with the License. You may obtain a copy
16
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software distributed under
19
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
+ * OF ANY KIND, either express or implied. See the License for the specific language
21
+ * governing permissions and limitations under the License.
22
+ */
23
+
24
+
25
+
26
+ function $253685172d17db7d$export$49ff6f28c54f1cbe(props, state) {
27
+ let { isDisabled: isDisabled, name: name, validationBehavior: validationBehavior = 'aria' } = props;
28
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
29
+ let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $6d1SX$reactarialabel.useField)({
30
+ ...props,
31
+ // Checkbox group is not an HTML input element so it
32
+ // shouldn't be labeled by a <label> element.
33
+ labelElementType: 'span',
34
+ isInvalid: isInvalid,
35
+ errorMessage: props.errorMessage || validationErrors
36
+ });
37
+ (0, $64fc3370e682155f$exports.checkboxGroupData).set(state, {
38
+ name: name,
39
+ descriptionId: descriptionProps.id,
40
+ errorMessageId: errorMessageProps.id,
41
+ validationBehavior: validationBehavior
42
+ });
43
+ let domProps = (0, $6d1SX$reactariautils.filterDOMProps)(props, {
44
+ labelable: true
45
+ });
46
+ let { focusWithinProps: focusWithinProps } = (0, $6d1SX$reactariainteractions.useFocusWithin)({
47
+ onBlurWithin: props.onBlur,
48
+ onFocusWithin: props.onFocus,
49
+ onFocusWithinChange: props.onFocusChange
50
+ });
51
+ return {
52
+ groupProps: (0, $6d1SX$reactariautils.mergeProps)(domProps, {
53
+ role: 'group',
54
+ 'aria-disabled': isDisabled || undefined,
55
+ ...fieldProps,
56
+ ...focusWithinProps
57
+ }),
58
+ labelProps: labelProps,
59
+ descriptionProps: descriptionProps,
60
+ errorMessageProps: errorMessageProps,
61
+ isInvalid: isInvalid,
62
+ validationErrors: validationErrors,
63
+ validationDetails: validationDetails
64
+ };
65
+ }
66
+
67
+
68
+ //# sourceMappingURL=useCheckboxGroup.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA2BM,SAAS,0CAAiB,KAA6B,EAAE,KAAyB;IACvF,IAAI,cAAC,UAAU,QAAE,IAAI,sBAAE,qBAAqB,QAAO,GAAG;IACtD,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAE9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,8BAAO,EAAE;QAC3E,GAAG,KAAK;QACR,oDAAoD;QACpD,6CAA6C;QAC7C,kBAAkB;mBAClB;QACA,cAAc,MAAM,YAAY,IAAI;IACtC;IAEA,CAAA,GAAA,2CAAgB,EAAE,GAAG,CAAC,OAAO;cAC3B;QACA,eAAe,iBAAiB,EAAE;QAClC,gBAAgB,kBAAkB,EAAE;4BACpC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAErD,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,cAAc,MAAM,MAAM;QAC1B,eAAe,MAAM,OAAO;QAC5B,qBAAqB,MAAM,aAAa;IAC1C;IAEA,OAAO;QACL,YAAY,CAAA,GAAA,gCAAS,EAAE,UAAU;YAC/B,MAAM;YACN,iBAAiB,cAAc;YAC/B,GAAG,UAAU;YACb,GAAG,gBAAgB;QACrB;oBACA;0BACA;2BACA;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/@react-aria/checkbox/src/useCheckboxGroup.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 {AriaCheckboxGroupProps} from '@react-types/checkbox';\nimport {checkboxGroupData} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {DOMAttributes, ValidationResult} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {useField} from '@react-aria/label';\nimport {useFocusWithin} from '@react-aria/interactions';\n\nexport interface CheckboxGroupAria extends ValidationResult {\n /** Props for the checkbox group wrapper element. */\n groupProps: DOMAttributes,\n /** Props for the checkbox group's visible label (if any). */\n labelProps: DOMAttributes,\n /** Props for the checkbox group description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the checkbox group error message element, if any. */\n errorMessageProps: DOMAttributes\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, validationBehavior = 'aria'} = props;\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\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 isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n checkboxGroupData.set(state, {\n name,\n descriptionId: descriptionProps.id,\n errorMessageId: errorMessageProps.id,\n validationBehavior\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n let {focusWithinProps} = useFocusWithin({\n onBlurWithin: props.onBlur,\n onFocusWithin: props.onFocus,\n onFocusWithinChange: props.onFocusChange\n });\n\n return {\n groupProps: mergeProps(domProps, {\n role: 'group',\n 'aria-disabled': isDisabled || undefined,\n ...fieldProps,\n ...focusWithinProps\n }),\n labelProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useCheckboxGroup.main.js.map"}
@@ -0,0 +1,63 @@
1
+ import {checkboxGroupData as $1ae600c947479353$export$ec98120685d4f57d} from "./utils.mjs";
2
+ import {filterDOMProps as $gtLuF$filterDOMProps, mergeProps as $gtLuF$mergeProps} from "@react-aria/utils";
3
+ import {useField as $gtLuF$useField} from "@react-aria/label";
4
+ import {useFocusWithin as $gtLuF$useFocusWithin} from "@react-aria/interactions";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
17
+
18
+
19
+
20
+ function $1e9fce0cfacc738b$export$49ff6f28c54f1cbe(props, state) {
21
+ let { isDisabled: isDisabled, name: name, validationBehavior: validationBehavior = 'aria' } = props;
22
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
23
+ let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $gtLuF$useField)({
24
+ ...props,
25
+ // Checkbox group is not an HTML input element so it
26
+ // shouldn't be labeled by a <label> element.
27
+ labelElementType: 'span',
28
+ isInvalid: isInvalid,
29
+ errorMessage: props.errorMessage || validationErrors
30
+ });
31
+ (0, $1ae600c947479353$export$ec98120685d4f57d).set(state, {
32
+ name: name,
33
+ descriptionId: descriptionProps.id,
34
+ errorMessageId: errorMessageProps.id,
35
+ validationBehavior: validationBehavior
36
+ });
37
+ let domProps = (0, $gtLuF$filterDOMProps)(props, {
38
+ labelable: true
39
+ });
40
+ let { focusWithinProps: focusWithinProps } = (0, $gtLuF$useFocusWithin)({
41
+ onBlurWithin: props.onBlur,
42
+ onFocusWithin: props.onFocus,
43
+ onFocusWithinChange: props.onFocusChange
44
+ });
45
+ return {
46
+ groupProps: (0, $gtLuF$mergeProps)(domProps, {
47
+ role: 'group',
48
+ 'aria-disabled': isDisabled || undefined,
49
+ ...fieldProps,
50
+ ...focusWithinProps
51
+ }),
52
+ labelProps: labelProps,
53
+ descriptionProps: descriptionProps,
54
+ errorMessageProps: errorMessageProps,
55
+ isInvalid: isInvalid,
56
+ validationErrors: validationErrors,
57
+ validationDetails: validationDetails
58
+ };
59
+ }
60
+
61
+
62
+ export {$1e9fce0cfacc738b$export$49ff6f28c54f1cbe as useCheckboxGroup};
63
+ //# sourceMappingURL=useCheckboxGroup.module.js.map
@@ -0,0 +1,63 @@
1
+ import {checkboxGroupData as $1ae600c947479353$export$ec98120685d4f57d} from "./utils.module.js";
2
+ import {filterDOMProps as $gtLuF$filterDOMProps, mergeProps as $gtLuF$mergeProps} from "@react-aria/utils";
3
+ import {useField as $gtLuF$useField} from "@react-aria/label";
4
+ import {useFocusWithin as $gtLuF$useFocusWithin} from "@react-aria/interactions";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
17
+
18
+
19
+
20
+ function $1e9fce0cfacc738b$export$49ff6f28c54f1cbe(props, state) {
21
+ let { isDisabled: isDisabled, name: name, validationBehavior: validationBehavior = 'aria' } = props;
22
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
23
+ let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $gtLuF$useField)({
24
+ ...props,
25
+ // Checkbox group is not an HTML input element so it
26
+ // shouldn't be labeled by a <label> element.
27
+ labelElementType: 'span',
28
+ isInvalid: isInvalid,
29
+ errorMessage: props.errorMessage || validationErrors
30
+ });
31
+ (0, $1ae600c947479353$export$ec98120685d4f57d).set(state, {
32
+ name: name,
33
+ descriptionId: descriptionProps.id,
34
+ errorMessageId: errorMessageProps.id,
35
+ validationBehavior: validationBehavior
36
+ });
37
+ let domProps = (0, $gtLuF$filterDOMProps)(props, {
38
+ labelable: true
39
+ });
40
+ let { focusWithinProps: focusWithinProps } = (0, $gtLuF$useFocusWithin)({
41
+ onBlurWithin: props.onBlur,
42
+ onFocusWithin: props.onFocus,
43
+ onFocusWithinChange: props.onFocusChange
44
+ });
45
+ return {
46
+ groupProps: (0, $gtLuF$mergeProps)(domProps, {
47
+ role: 'group',
48
+ 'aria-disabled': isDisabled || undefined,
49
+ ...fieldProps,
50
+ ...focusWithinProps
51
+ }),
52
+ labelProps: labelProps,
53
+ descriptionProps: descriptionProps,
54
+ errorMessageProps: errorMessageProps,
55
+ isInvalid: isInvalid,
56
+ validationErrors: validationErrors,
57
+ validationDetails: validationDetails
58
+ };
59
+ }
60
+
61
+
62
+ export {$1e9fce0cfacc738b$export$49ff6f28c54f1cbe as useCheckboxGroup};
63
+ //# sourceMappingURL=useCheckboxGroup.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AA2BM,SAAS,0CAAiB,KAA6B,EAAE,KAAyB;IACvF,IAAI,cAAC,UAAU,QAAE,IAAI,sBAAE,qBAAqB,QAAO,GAAG;IACtD,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAE9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC3E,GAAG,KAAK;QACR,oDAAoD;QACpD,6CAA6C;QAC7C,kBAAkB;mBAClB;QACA,cAAc,MAAM,YAAY,IAAI;IACtC;IAEA,CAAA,GAAA,yCAAgB,EAAE,GAAG,CAAC,OAAO;cAC3B;QACA,eAAe,iBAAiB,EAAE;QAClC,gBAAgB,kBAAkB,EAAE;4BACpC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAErD,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,cAAc,MAAM,MAAM;QAC1B,eAAe,MAAM,OAAO;QAC5B,qBAAqB,MAAM,aAAa;IAC1C;IAEA,OAAO;QACL,YAAY,CAAA,GAAA,iBAAS,EAAE,UAAU;YAC/B,MAAM;YACN,iBAAiB,cAAc;YAC/B,GAAG,UAAU;YACb,GAAG,gBAAgB;QACrB;oBACA;0BACA;2BACA;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/@react-aria/checkbox/src/useCheckboxGroup.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 {AriaCheckboxGroupProps} from '@react-types/checkbox';\nimport {checkboxGroupData} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {DOMAttributes, ValidationResult} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {useField} from '@react-aria/label';\nimport {useFocusWithin} from '@react-aria/interactions';\n\nexport interface CheckboxGroupAria extends ValidationResult {\n /** Props for the checkbox group wrapper element. */\n groupProps: DOMAttributes,\n /** Props for the checkbox group's visible label (if any). */\n labelProps: DOMAttributes,\n /** Props for the checkbox group description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the checkbox group error message element, if any. */\n errorMessageProps: DOMAttributes\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, validationBehavior = 'aria'} = props;\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\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 isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n checkboxGroupData.set(state, {\n name,\n descriptionId: descriptionProps.id,\n errorMessageId: errorMessageProps.id,\n validationBehavior\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n let {focusWithinProps} = useFocusWithin({\n onBlurWithin: props.onBlur,\n onFocusWithin: props.onFocus,\n onFocusWithinChange: props.onFocusChange\n });\n\n return {\n groupProps: mergeProps(domProps, {\n role: 'group',\n 'aria-disabled': isDisabled || undefined,\n ...fieldProps,\n ...focusWithinProps\n }),\n labelProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useCheckboxGroup.module.js.map"}