@react-aria/checkbox 3.8.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/import.mjs CHANGED
@@ -27,8 +27,7 @@ import {useToggleState as $cKEhs$useToggleState} from "@react-stately/toggle";
27
27
  */
28
28
 
29
29
  function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
30
- let { inputProps: inputProps } = (0, $cKEhs$useToggle)(props, state, inputRef);
31
- let { isSelected: isSelected } = state;
30
+ let { inputProps: inputProps , isSelected: isSelected , isPressed: isPressed , isDisabled: isDisabled , isReadOnly: isReadOnly } = (0, $cKEhs$useToggle)(props, state, inputRef);
32
31
  let { isIndeterminate: isIndeterminate } = props;
33
32
  (0, $cKEhs$useEffect)(()=>{
34
33
  // indeterminate is a property, but it can only be set via javascript
@@ -39,7 +38,11 @@ function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
39
38
  inputProps: {
40
39
  ...inputProps,
41
40
  checked: isSelected
42
- }
41
+ },
42
+ isSelected: isSelected,
43
+ isPressed: isPressed,
44
+ isDisabled: isDisabled,
45
+ isReadOnly: isReadOnly
43
46
  };
44
47
  }
45
48
 
@@ -122,15 +125,16 @@ function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
122
125
  if (props.onChange) props.onChange(isSelected);
123
126
  }
124
127
  });
125
- let { inputProps: inputProps } = (0, $406796ff087fe49b$export$e375f10ce42261c5)({
128
+ let res = (0, $406796ff087fe49b$export$e375f10ce42261c5)({
126
129
  ...props,
127
130
  isReadOnly: props.isReadOnly || state.isReadOnly,
128
131
  isDisabled: props.isDisabled || state.isDisabled,
129
132
  name: props.name || (0, $1ae600c947479353$export$31440636951aa68c).get(state)
130
133
  }, toggleState, inputRef);
131
134
  return {
135
+ ...res,
132
136
  inputProps: {
133
- ...inputProps,
137
+ ...res.inputProps,
134
138
  "aria-describedby": [
135
139
  state.validationState === "invalid" ? (0, $1ae600c947479353$export$d5679492e2864181).get(state) : null,
136
140
  (0, $1ae600c947479353$export$a3077e9c93f7360f).get(state)
package/dist/main.js CHANGED
@@ -34,8 +34,7 @@ $parcel$export(module.exports, "useCheckboxGroupItem", () => $07e03121d6ac83c8$e
34
34
  */
35
35
 
36
36
  function $468c774d7db917b7$export$e375f10ce42261c5(props, state, inputRef) {
37
- let { inputProps: inputProps } = (0, $k0DcK$reactariatoggle.useToggle)(props, state, inputRef);
38
- let { isSelected: isSelected } = state;
37
+ let { inputProps: inputProps , isSelected: isSelected , isPressed: isPressed , isDisabled: isDisabled , isReadOnly: isReadOnly } = (0, $k0DcK$reactariatoggle.useToggle)(props, state, inputRef);
39
38
  let { isIndeterminate: isIndeterminate } = props;
40
39
  (0, $k0DcK$react.useEffect)(()=>{
41
40
  // indeterminate is a property, but it can only be set via javascript
@@ -46,7 +45,11 @@ function $468c774d7db917b7$export$e375f10ce42261c5(props, state, inputRef) {
46
45
  inputProps: {
47
46
  ...inputProps,
48
47
  checked: isSelected
49
- }
48
+ },
49
+ isSelected: isSelected,
50
+ isPressed: isPressed,
51
+ isDisabled: isDisabled,
52
+ isReadOnly: isReadOnly
50
53
  };
51
54
  }
52
55
 
@@ -129,15 +132,16 @@ function $07e03121d6ac83c8$export$353b32fc6898d37d(props, state, inputRef) {
129
132
  if (props.onChange) props.onChange(isSelected);
130
133
  }
131
134
  });
132
- let { inputProps: inputProps } = (0, $468c774d7db917b7$export$e375f10ce42261c5)({
135
+ let res = (0, $468c774d7db917b7$export$e375f10ce42261c5)({
133
136
  ...props,
134
137
  isReadOnly: props.isReadOnly || state.isReadOnly,
135
138
  isDisabled: props.isDisabled || state.isDisabled,
136
139
  name: props.name || (0, $64fc3370e682155f$export$31440636951aa68c).get(state)
137
140
  }, toggleState, inputRef);
138
141
  return {
142
+ ...res,
139
143
  inputProps: {
140
- ...inputProps,
144
+ ...res.inputProps,
141
145
  "aria-describedby": [
142
146
  state.validationState === "invalid" ? (0, $64fc3370e682155f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D,oEAAoE;IACpE,CAAA,GAAA,yCAAiB,EAAE,GAAG,CAAC,OAAO;IAE9B,OAAO;QACL,YAAY,CAAA,GAAA,gCAAU,AAAD,EAAE,UAAU;YAC/B,MAAM;YACN,iBAAiB,cAAc;YAC/B,GAAG,UAAU;QACf;oBACA;0BACA;2BACA;IACF;AACF;;;AE/DA;;;;;;;;;;CAUC,GAED;;;AAcO,SAAS,0CAAqB,KAAiC,EAAE,KAAyB,EAAE,QAAqC,EAAgB;IACtJ,MAAM,cAAc,CAAA,GAAA,wCAAa,EAAE;QACjC,YAAY,MAAM,UAAU,IAAI,MAAM,UAAU;QAChD,YAAY,MAAM,UAAU,CAAC,MAAM,KAAK;QACxC,UAAS,UAAU,EAAE;YACnB,IAAI,YACF,MAAM,QAAQ,CAAC,MAAM,KAAK;iBAE1B,MAAM,WAAW,CAAC,MAAM,KAAK;YAG/B,IAAI,MAAM,QAAQ,EAChB,MAAM,QAAQ,CAAC;QAEnB;IACF;IAEA,IAAI,cAAC,WAAU,EAAC,GAAG,CAAA,GAAA,yCAAW,AAAD,EAAE;QAC7B,GAAG,KAAK;QACR,YAAY,MAAM,UAAU,IAAI,MAAM,UAAU;QAChD,YAAY,MAAM,UAAU,IAAI,MAAM,UAAU;QAChD,MAAM,MAAM,IAAI,IAAI,CAAA,GAAA,yCAAiB,EAAE,GAAG,CAAC;IAC7C,GAAG,aAAa;IAEhB,OAAO;QACL,YAAY;YACV,GAAG,UAAU;YACb,oBAAoB;gBAClB,MAAM,eAAe,KAAK,YAAY,CAAA,GAAA,yCAA4B,AAAD,EAAE,GAAG,CAAC,SAAS,IAAI;gBACpF,CAAA,GAAA,yCAA0B,EAAE,GAAG,CAAC;aACjC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;QACjC;IACF;AACF;;","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 */\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","/*\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 }\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 {checkboxGroupDescriptionIds, checkboxGroupErrorMessageIds, checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {useField} from '@react-aria/label';\n\nexport interface CheckboxGroupAria {\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} = props;\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 });\n checkboxGroupDescriptionIds.set(state, descriptionProps.id);\n checkboxGroupErrorMessageIds.set(state, errorMessageProps.id);\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 descriptionProps,\n errorMessageProps\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>();\nexport const checkboxGroupDescriptionIds = new WeakMap<CheckboxGroupState, string>();\nexport const checkboxGroupErrorMessageIds = 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 {checkboxGroupDescriptionIds, checkboxGroupErrorMessageIds, 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 {\n inputProps: {\n ...inputProps,\n 'aria-describedby': [\n state.validationState === 'invalid' ? checkboxGroupErrorMessageIds.get(state) : null,\n checkboxGroupDescriptionIds.get(state)\n ].filter(Boolean).join(' ') || undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AA0BO,SAAS,0CAAY,KAAwB,EAAE,KAAkB,EAAE,QAAqC,EAAgB;IAC7H,IAAI,cAAC,WAAU,cAAE,WAAU,aAAE,UAAS,cAAE,WAAU,cAAE,WAAU,EAAC,GAAG,CAAA,GAAA,gCAAS,AAAD,EAAE,OAAO,OAAO;IAE1F,IAAI,mBAAC,gBAAe,EAAC,GAAG;IACxB,CAAA,GAAA,sBAAS,AAAD,EAAE,IAAM;QACd,qEAAqE;QACrE,mD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,UAAS,UAAU,EAAE;YACnB,IAAI,YACF,MAAM,QAAQ,CAAC,MAAM,KAAK;iBAE1B,MAAM,WAAW,CAAC,MAAM,KAAK;YAG/B,IAAI,MAAM,QAAQ,EAChB,MAAM,QAAQ,CAAC;QAEnB;IACF;IAEA,IAAI,MAAM,CAAA,GAAA,yCAAU,EAAE;QACpB,GAAG,KAAK;QACR,YAAY,MAAM,UAAU,IAAI,MAAM,UAAU;QAChD,YAAY,MAAM,UAAU,IAAI,MAAM,UAAU;QAChD,MAAM,MAAM,IAAI,IAAI,CAAA,GAAA,yCAAiB,EAAE,GAAG,CAAC;IAC7C,GAAG,aAAa;IAEhB,OAAO;QACL,GAAG,GAAG;QACN,YAAY;YACV,GAAG,IAAI,UAAU;YACjB,oBAAoB;gBAClB,MAAM,eAAe,KAAK,YAAY,CAAA,GAAA,yCAA4B,AAAD,EAAE,GAAG,CAAC,SAAS,IAAI;gBACpF,CAAA,GAAA,yCAA0B,EAAE,GAAG,CAAC;aACjC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;QACjC;IACF;AACF;;","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 */\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","/*\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 /** 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>): CheckboxAria {\n let {inputProps, isSelected, isPressed, isDisabled, isReadOnly} = useToggle(props, state, inputRef);\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 },\n isSelected,\n isPressed,\n isDisabled,\n isReadOnly\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 {checkboxGroupDescriptionIds, checkboxGroupErrorMessageIds, checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {useField} from '@react-aria/label';\n\nexport interface CheckboxGroupAria {\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} = props;\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 });\n checkboxGroupDescriptionIds.set(state, descriptionProps.id);\n checkboxGroupErrorMessageIds.set(state, errorMessageProps.id);\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 descriptionProps,\n errorMessageProps\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>();\nexport const checkboxGroupDescriptionIds = new WeakMap<CheckboxGroupState, string>();\nexport const checkboxGroupErrorMessageIds = 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 {checkboxGroupDescriptionIds, checkboxGroupErrorMessageIds, 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 res = 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 {\n ...res,\n inputProps: {\n ...res.inputProps,\n 'aria-describedby': [\n state.validationState === 'invalid' ? checkboxGroupErrorMessageIds.get(state) : null,\n checkboxGroupDescriptionIds.get(state)\n ].filter(Boolean).join(' ') || undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -27,8 +27,7 @@ import {useToggleState as $cKEhs$useToggleState} from "@react-stately/toggle";
27
27
  */
28
28
 
29
29
  function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
30
- let { inputProps: inputProps } = (0, $cKEhs$useToggle)(props, state, inputRef);
31
- let { isSelected: isSelected } = state;
30
+ let { inputProps: inputProps , isSelected: isSelected , isPressed: isPressed , isDisabled: isDisabled , isReadOnly: isReadOnly } = (0, $cKEhs$useToggle)(props, state, inputRef);
32
31
  let { isIndeterminate: isIndeterminate } = props;
33
32
  (0, $cKEhs$useEffect)(()=>{
34
33
  // indeterminate is a property, but it can only be set via javascript
@@ -39,7 +38,11 @@ function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
39
38
  inputProps: {
40
39
  ...inputProps,
41
40
  checked: isSelected
42
- }
41
+ },
42
+ isSelected: isSelected,
43
+ isPressed: isPressed,
44
+ isDisabled: isDisabled,
45
+ isReadOnly: isReadOnly
43
46
  };
44
47
  }
45
48
 
@@ -122,15 +125,16 @@ function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
122
125
  if (props.onChange) props.onChange(isSelected);
123
126
  }
124
127
  });
125
- let { inputProps: inputProps } = (0, $406796ff087fe49b$export$e375f10ce42261c5)({
128
+ let res = (0, $406796ff087fe49b$export$e375f10ce42261c5)({
126
129
  ...props,
127
130
  isReadOnly: props.isReadOnly || state.isReadOnly,
128
131
  isDisabled: props.isDisabled || state.isDisabled,
129
132
  name: props.name || (0, $1ae600c947479353$export$31440636951aa68c).get(state)
130
133
  }, toggleState, inputRef);
131
134
  return {
135
+ ...res,
132
136
  inputProps: {
133
- ...inputProps,
137
+ ...res.inputProps,
134
138
  "aria-describedby": [
135
139
  state.validationState === "invalid" ? (0, $1ae600c947479353$export$d5679492e2864181).get(state) : null,
136
140
  (0, $1ae600c947479353$export$a3077e9c93f7360f).get(state)
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AAkBO,SAAS,0CAAY,KAAwB,EAAE,KAAkB,EAAE,QAAqC,EAAgB;IAC7H,IAAI,cAAC,WAAU,EAAC,GAAG,CAAA,GAAA,gBAAS,AAAD,EAAE,OAAO,OAAO;IAC3C,IAAI,cAAC,WAAU,EAAC,GAAG;IAEnB,IAAI,mBAAC,gBAAe,EAAC,GAAG;IACxB,CAAA,GAAA,gBAAS,AAAD,EAAE,IAAM;QACd,qEAAqE;QACrE,mDAAmD;QACnD,IAAI,SAAS,OAAO,EAClB,SAAS,OAAO,CAAC,aAAa,GAAG;IAErC;IAEA,OAAO;QACL,YAAY;YACV,GAAG,UAAU;YACb,SAAS;QACX;IACF;AACF;;CDvCC,GACD;AEXA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED,AAEO,MAAM,4CAAqB,IAAI;AAC/B,MAAM,4CAA8B,IAAI;AACxC,MAAM,4CAA+B,IAAI;;CDN/C,G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AAM,UAAU,IAAI,MAAM,UAAU;QAChD,MAAM,MAAM,IAAI,IAAI,CAAA,GAAA,yCAAiB,EAAE,GAAG,CAAC;IAC7C,GAAG,aAAa;IAEhB,OAAO;QACL,YAAY;YACV,GAAG,UAAU;YACb,oBAAoB;gBAClB,MAAM,eAAe,KAAK,YAAY,CAAA,GAAA,yCAA4B,AAAD,EAAE,GAAG,CAAC,SAAS,IAAI;gBACpF,CAAA,GAAA,yCAA0B,EAAE,GAAG,CAAC;aACjC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;QACjC;IACF;AACF;;","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 */\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","/*\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 }\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 {checkboxGroupDescriptionIds, checkboxGroupErrorMessageIds, checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {useField} from '@react-aria/label';\n\nexport interface CheckboxGroupAria {\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} = props;\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 });\n checkboxGroupDescriptionIds.set(state, descriptionProps.id);\n checkboxGroupErrorMessageIds.set(state, errorMessageProps.id);\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 descriptionProps,\n errorMessageProps\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>();\nexport const checkboxGroupDescriptionIds = new WeakMap<CheckboxGroupState, string>();\nexport const checkboxGroupErrorMessageIds = 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 {checkboxGroupDescriptionIds, checkboxGroupErrorMessageIds, 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 {\n inputProps: {\n ...inputProps,\n 'aria-describedby': [\n state.validationState === 'invalid' ? checkboxGroupErrorMessageIds.get(state) : null,\n checkboxGroupDescriptionIds.get(state)\n ].filter(Boolean).join(' ') || undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AA0BO,SAAS,0CAAY,KAAwB,EAAE,KAAkB,EAAE,QAAqC,EAAgB;IAC7H,IAAI,cAAC,WAAU,cAAE,WAAU,aAAE,UAAS,cAAE,WAAU,cAAE,WAAU,EAAC,GAAG,CAAA,GAAA,gBAAS,AAAD,EAAE,OAAO,OAAO;IAE1F,IAAI,mBAAC,gBAAe,EAAC,GAAG;IACxB,CAAA,GAAA,gBAAS,AAAD,EAAE,IAAM;QACd,qEAAqE;QACrE,mDAAmD;QACnD,IAAI,SAAS,OAAO,EAClB,SAAS,OAAO,CAAC,aAAa,GAAG;IAErC;IAEA,OAAO;QACL,YAAY;YACV,GAAG,UAAU;YACb,SAAS;QACX;oBACA;mBACA;oBACA;oBACA;IACF;AACF;;CDlDC,GACD;AEXA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED,AAEO,MAAM,4CAAqB,IAAI;AAC/B,MAAM,4CAA8B,IAAI;AACxC,MAAM,4CAA+B,IAAI;;CDN/C,GAED;;;AAwBO,SAAS,0CAAiB,KAA6B,EAAE,KAAyB,EAAqB;IAC5G,IAAI,cAAC,WAAU,QAAE,KAAI,EAAC,GAAG;IAEzB,IAAI,cAAC,WAAU,cAAE,WAAU,oBAAE,iBAAgB,qBAAE,kBAAiB,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC3E,GAAG,KAAK;QACR,oDAAoD;QACpD,6CAA6C;QAC7C,kBAAkB;IACpB;IACA,CAAA,GAAA,yCAA0B,EAAE,GAAG,CAAC,OAAO,iBAAiB,EAAE;IAC1D,CAAA,GAAA,yCAA2B,EAAE,GAAG,CAAC,OAAO,kBAAkB,EAAE;IAE5D,IAAI,WAAW,CAAA,GAAA,qBAAa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box/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 */\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","/*\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 /** 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>): CheckboxAria {\n let {inputProps, isSelected, isPressed, isDisabled, isReadOnly} = useToggle(props, state, inputRef);\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 },\n isSelected,\n isPressed,\n isDisabled,\n isReadOnly\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 {checkboxGroupDescriptionIds, checkboxGroupErrorMessageIds, checkboxGroupNames} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {useField} from '@react-aria/label';\n\nexport interface CheckboxGroupAria {\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} = props;\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 });\n checkboxGroupDescriptionIds.set(state, descriptionProps.id);\n checkboxGroupErrorMessageIds.set(state, errorMessageProps.id);\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 descriptionProps,\n errorMessageProps\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>();\nexport const checkboxGroupDescriptionIds = new WeakMap<CheckboxGroupState, string>();\nexport const checkboxGroupErrorMessageIds = 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 {checkboxGroupDescriptionIds, checkboxGroupErrorMessageIds, 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 res = 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 {\n ...res,\n inputProps: {\n ...res.inputProps,\n 'aria-describedby': [\n state.validationState === 'invalid' ? checkboxGroupErrorMessageIds.get(state) : null,\n checkboxGroupDescriptionIds.get(state)\n ].filter(Boolean).join(' ') || undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -6,6 +6,14 @@ import { DOMAttributes } from "@react-types/shared";
6
6
  export interface CheckboxAria {
7
7
  /** Props for the input element. */
8
8
  inputProps: InputHTMLAttributes<HTMLInputElement>;
9
+ /** Whether the checkbox is selected. */
10
+ isSelected: boolean;
11
+ /** Whether the checkbox is in a pressed state. */
12
+ isPressed: boolean;
13
+ /** Whether the checkbox is disabled. */
14
+ isDisabled: boolean;
15
+ /** Whether the checkbox is read only. */
16
+ isReadOnly: boolean;
9
17
  }
10
18
  /**
11
19
  * Provides the behavior and accessibility implementation for a checkbox component.
@@ -1 +1 @@
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,CAmB7H;AE9BD;IACE,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,CA2B5G;AC5CD;;;;;;GAMG;AACH,qCAAqC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,gBAAgB,CAAC,GAAG,YAAY,CAiCtJ;AC5CD,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"}
1
+ {"mappings":";;;;;AAiBA;IACE,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,CAAC,GAAG,YAAY,CAsB7H;AEzCD;IACE,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,CA2B5G;AC5CD;;;;;;GAMG;AACH,qCAAqC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,gBAAgB,CAAC,GAAG,YAAY,CAkCtJ;AC7CD,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/checkbox",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,13 +22,13 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/label": "^3.5.0",
26
- "@react-aria/toggle": "^3.5.0",
27
- "@react-aria/utils": "^3.15.0",
28
- "@react-stately/checkbox": "^3.4.0",
29
- "@react-stately/toggle": "^3.5.0",
30
- "@react-types/checkbox": "^3.4.2",
31
- "@react-types/shared": "^3.17.0",
25
+ "@react-aria/label": "^3.5.1",
26
+ "@react-aria/toggle": "^3.6.0",
27
+ "@react-aria/utils": "^3.16.0",
28
+ "@react-stately/checkbox": "^3.4.1",
29
+ "@react-stately/toggle": "^3.5.1",
30
+ "@react-types/checkbox": "^3.4.3",
31
+ "@react-types/shared": "^3.18.0",
32
32
  "@swc/helpers": "^0.4.14"
33
33
  },
34
34
  "peerDependencies": {
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "a0efee84aa178cb1a202951dfd6d8de02b292307"
40
+ "gitHead": "9d1ba9bd8ebcd63bf3495ade16d349bcb71795ce"
41
41
  }
@@ -17,7 +17,15 @@ import {useToggle} from '@react-aria/toggle';
17
17
 
18
18
  export interface CheckboxAria {
19
19
  /** Props for the input element. */
20
- inputProps: InputHTMLAttributes<HTMLInputElement>
20
+ inputProps: InputHTMLAttributes<HTMLInputElement>,
21
+ /** Whether the checkbox is selected. */
22
+ isSelected: boolean,
23
+ /** Whether the checkbox is in a pressed state. */
24
+ isPressed: boolean,
25
+ /** Whether the checkbox is disabled. */
26
+ isDisabled: boolean,
27
+ /** Whether the checkbox is read only. */
28
+ isReadOnly: boolean
21
29
  }
22
30
 
23
31
  /**
@@ -29,8 +37,7 @@ export interface CheckboxAria {
29
37
  * @param inputRef - A ref for the HTML input element.
30
38
  */
31
39
  export function useCheckbox(props: AriaCheckboxProps, state: ToggleState, inputRef: RefObject<HTMLInputElement>): CheckboxAria {
32
- let {inputProps} = useToggle(props, state, inputRef);
33
- let {isSelected} = state;
40
+ let {inputProps, isSelected, isPressed, isDisabled, isReadOnly} = useToggle(props, state, inputRef);
34
41
 
35
42
  let {isIndeterminate} = props;
36
43
  useEffect(() => {
@@ -45,6 +52,10 @@ export function useCheckbox(props: AriaCheckboxProps, state: ToggleState, inputR
45
52
  inputProps: {
46
53
  ...inputProps,
47
54
  checked: isSelected
48
- }
55
+ },
56
+ isSelected,
57
+ isPressed,
58
+ isDisabled,
59
+ isReadOnly
49
60
  };
50
61
  }
@@ -41,7 +41,7 @@ export function useCheckboxGroupItem(props: AriaCheckboxGroupItemProps, state: C
41
41
  }
42
42
  });
43
43
 
44
- let {inputProps} = useCheckbox({
44
+ let res = useCheckbox({
45
45
  ...props,
46
46
  isReadOnly: props.isReadOnly || state.isReadOnly,
47
47
  isDisabled: props.isDisabled || state.isDisabled,
@@ -49,8 +49,9 @@ export function useCheckboxGroupItem(props: AriaCheckboxGroupItemProps, state: C
49
49
  }, toggleState, inputRef);
50
50
 
51
51
  return {
52
+ ...res,
52
53
  inputProps: {
53
- ...inputProps,
54
+ ...res.inputProps,
54
55
  'aria-describedby': [
55
56
  state.validationState === 'invalid' ? checkboxGroupErrorMessageIds.get(state) : null,
56
57
  checkboxGroupDescriptionIds.get(state)