{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA6BM,SAAS,0CAAiB,KAA6B,EAAE,KAAyB;IACvF,IAAI,cAAC,UAAU,QAAE,IAAI,QAAE,IAAI,sBAAE,qBAAqB,QAAO,GAAG;IAC5D,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,yCAAO,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;cACA;QACA,eAAe,iBAAiB,EAAE;QAClC,gBAAgB,kBAAkB,EAAE;4BACpC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,yCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAErD,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,yCAAa,EAAE;QACtC,cAAc,MAAM,MAAM;QAC1B,eAAe,MAAM,OAAO;QAC5B,qBAAqB,MAAM,aAAa;IAC1C;IAEA,OAAO;QACL,YAAY,CAAA,GAAA,yCAAS,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/src/checkbox/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 {AriaLabelingProps, AriaValidationProps, DOMAttributes, DOMProps, FocusEvents, InputDOMProps, ValidationResult} from '@react-types/shared';\nimport {checkboxGroupData} from './utils';\nimport {CheckboxGroupProps, CheckboxGroupState} from 'react-stately/useCheckboxGroupState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {mergeProps} from '../utils/mergeProps';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\n\nexport interface AriaCheckboxGroupProps extends CheckboxGroupProps, InputDOMProps, DOMProps, AriaLabelingProps, AriaValidationProps, FocusEvents {}\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, form, 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    form,\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.mjs.map"}