react-aria-components 1.10.0 → 1.11.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/Breadcrumbs.main.js +9 -2
- package/dist/Breadcrumbs.main.js.map +1 -1
- package/dist/Breadcrumbs.mjs +10 -3
- package/dist/Breadcrumbs.module.js +10 -3
- package/dist/Breadcrumbs.module.js.map +1 -1
- package/dist/Button.main.js +7 -17
- package/dist/Button.main.js.map +1 -1
- package/dist/Button.mjs +7 -17
- package/dist/Button.module.js +7 -17
- package/dist/Button.module.js.map +1 -1
- package/dist/Calendar.main.js +36 -14
- package/dist/Calendar.main.js.map +1 -1
- package/dist/Calendar.mjs +38 -16
- package/dist/Calendar.module.js +38 -16
- package/dist/Calendar.module.js.map +1 -1
- package/dist/Checkbox.main.js +8 -3
- package/dist/Checkbox.main.js.map +1 -1
- package/dist/Checkbox.mjs +10 -5
- package/dist/Checkbox.module.js +10 -5
- package/dist/Checkbox.module.js.map +1 -1
- package/dist/Collection.main.js.map +1 -1
- package/dist/Collection.module.js.map +1 -1
- package/dist/ColorArea.main.js +4 -4
- package/dist/ColorArea.main.js.map +1 -1
- package/dist/ColorArea.mjs +5 -5
- package/dist/ColorArea.module.js +5 -5
- package/dist/ColorArea.module.js.map +1 -1
- package/dist/ColorField.main.js +14 -1
- package/dist/ColorField.main.js.map +1 -1
- package/dist/ColorField.mjs +14 -1
- package/dist/ColorField.module.js +14 -1
- package/dist/ColorField.module.js.map +1 -1
- package/dist/ColorSlider.main.js +3 -1
- package/dist/ColorSlider.main.js.map +1 -1
- package/dist/ColorSlider.mjs +3 -1
- package/dist/ColorSlider.module.js +3 -1
- package/dist/ColorSlider.module.js.map +1 -1
- package/dist/ColorSwatch.main.js +6 -2
- package/dist/ColorSwatch.main.js.map +1 -1
- package/dist/ColorSwatch.mjs +6 -2
- package/dist/ColorSwatch.module.js +6 -2
- package/dist/ColorSwatch.module.js.map +1 -1
- package/dist/ColorSwatchPicker.main.js.map +1 -1
- package/dist/ColorSwatchPicker.module.js.map +1 -1
- package/dist/ColorThumb.main.js +3 -1
- package/dist/ColorThumb.main.js.map +1 -1
- package/dist/ColorThumb.mjs +3 -1
- package/dist/ColorThumb.module.js +3 -1
- package/dist/ColorThumb.module.js.map +1 -1
- package/dist/ColorWheel.main.js +3 -1
- package/dist/ColorWheel.main.js.map +1 -1
- package/dist/ColorWheel.mjs +3 -1
- package/dist/ColorWheel.module.js +3 -1
- package/dist/ColorWheel.module.js.map +1 -1
- package/dist/ComboBox.main.js +4 -1
- package/dist/ComboBox.main.js.map +1 -1
- package/dist/ComboBox.mjs +4 -1
- package/dist/ComboBox.module.js +4 -1
- package/dist/ComboBox.module.js.map +1 -1
- package/dist/DateField.main.js +16 -3
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +16 -3
- package/dist/DateField.module.js +16 -3
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +15 -8
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +16 -9
- package/dist/DatePicker.module.js +16 -9
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/Dialog.main.js +4 -3
- package/dist/Dialog.main.js.map +1 -1
- package/dist/Dialog.mjs +5 -4
- package/dist/Dialog.module.js +5 -4
- package/dist/Dialog.module.js.map +1 -1
- package/dist/Disclosure.main.js +12 -10
- package/dist/Disclosure.main.js.map +1 -1
- package/dist/Disclosure.mjs +13 -11
- package/dist/Disclosure.module.js +13 -11
- package/dist/Disclosure.module.js.map +1 -1
- package/dist/DragAndDrop.main.js +31 -3
- package/dist/DragAndDrop.main.js.map +1 -1
- package/dist/DragAndDrop.mjs +31 -3
- package/dist/DragAndDrop.module.js +31 -3
- package/dist/DragAndDrop.module.js.map +1 -1
- package/dist/DropZone.main.js +4 -3
- package/dist/DropZone.main.js.map +1 -1
- package/dist/DropZone.mjs +4 -3
- package/dist/DropZone.module.js +4 -3
- package/dist/DropZone.module.js.map +1 -1
- package/dist/FieldError.main.js +3 -1
- package/dist/FieldError.main.js.map +1 -1
- package/dist/FieldError.mjs +3 -1
- package/dist/FieldError.module.js +3 -1
- package/dist/FieldError.module.js.map +1 -1
- package/dist/FileTrigger.main.js +3 -1
- package/dist/FileTrigger.main.js.map +1 -1
- package/dist/FileTrigger.mjs +3 -1
- package/dist/FileTrigger.module.js +3 -1
- package/dist/FileTrigger.module.js.map +1 -1
- package/dist/Form.main.js.map +1 -1
- package/dist/Form.module.js.map +1 -1
- package/dist/GridList.main.js +20 -13
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.mjs +21 -14
- package/dist/GridList.module.js +21 -14
- package/dist/GridList.module.js.map +1 -1
- package/dist/HiddenDateInput.main.js +118 -0
- package/dist/HiddenDateInput.main.js.map +1 -0
- package/dist/HiddenDateInput.mjs +109 -0
- package/dist/HiddenDateInput.module.js +109 -0
- package/dist/HiddenDateInput.module.js.map +1 -0
- package/dist/Link.main.js +7 -1
- package/dist/Link.main.js.map +1 -1
- package/dist/Link.mjs +7 -1
- package/dist/Link.module.js +7 -1
- package/dist/Link.module.js.map +1 -1
- package/dist/ListBox.main.js +22 -19
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +23 -20
- package/dist/ListBox.module.js +23 -20
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +15 -8
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +16 -9
- package/dist/Menu.module.js +16 -9
- package/dist/Menu.module.js.map +1 -1
- package/dist/Meter.main.js +6 -2
- package/dist/Meter.main.js.map +1 -1
- package/dist/Meter.mjs +6 -2
- package/dist/Meter.module.js +6 -2
- package/dist/Meter.module.js.map +1 -1
- package/dist/Modal.main.js +31 -6
- package/dist/Modal.main.js.map +1 -1
- package/dist/Modal.mjs +31 -6
- package/dist/Modal.module.js +31 -6
- package/dist/Modal.module.js.map +1 -1
- package/dist/NumberField.main.js +4 -1
- package/dist/NumberField.main.js.map +1 -1
- package/dist/NumberField.mjs +4 -1
- package/dist/NumberField.module.js +4 -1
- package/dist/NumberField.module.js.map +1 -1
- package/dist/Popover.main.js +3 -1
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +3 -1
- package/dist/Popover.module.js +3 -1
- package/dist/Popover.module.js.map +1 -1
- package/dist/ProgressBar.main.js +6 -2
- package/dist/ProgressBar.main.js.map +1 -1
- package/dist/ProgressBar.mjs +6 -2
- package/dist/ProgressBar.module.js +6 -2
- package/dist/ProgressBar.module.js.map +1 -1
- package/dist/RadioGroup.main.js +8 -3
- package/dist/RadioGroup.main.js.map +1 -1
- package/dist/RadioGroup.mjs +9 -4
- package/dist/RadioGroup.module.js +9 -4
- package/dist/RadioGroup.module.js.map +1 -1
- package/dist/SearchField.main.js +3 -1
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +3 -1
- package/dist/SearchField.module.js +3 -1
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Select.main.js +12 -14
- package/dist/Select.main.js.map +1 -1
- package/dist/Select.mjs +13 -15
- package/dist/Select.module.js +13 -15
- package/dist/Select.module.js.map +1 -1
- package/dist/Separator.main.js +4 -2
- package/dist/Separator.main.js.map +1 -1
- package/dist/Separator.mjs +5 -3
- package/dist/Separator.module.js +5 -3
- package/dist/Separator.module.js.map +1 -1
- package/dist/Slider.main.js +7 -5
- package/dist/Slider.main.js.map +1 -1
- package/dist/Slider.mjs +8 -6
- package/dist/Slider.module.js +8 -6
- package/dist/Slider.module.js.map +1 -1
- package/dist/Switch.main.js +4 -1
- package/dist/Switch.main.js.map +1 -1
- package/dist/Switch.mjs +4 -1
- package/dist/Switch.module.js +4 -1
- package/dist/Switch.module.js.map +1 -1
- package/dist/Table.main.js +47 -26
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +48 -27
- package/dist/Table.module.js +48 -27
- package/dist/Table.module.js.map +1 -1
- package/dist/Tabs.main.js +22 -11
- package/dist/Tabs.main.js.map +1 -1
- package/dist/Tabs.mjs +23 -12
- package/dist/Tabs.module.js +23 -12
- package/dist/Tabs.module.js.map +1 -1
- package/dist/TagGroup.main.js +14 -8
- package/dist/TagGroup.main.js.map +1 -1
- package/dist/TagGroup.mjs +14 -8
- package/dist/TagGroup.module.js +14 -8
- package/dist/TagGroup.module.js.map +1 -1
- package/dist/TextField.main.js +13 -1
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +13 -1
- package/dist/TextField.module.js +13 -1
- package/dist/TextField.module.js.map +1 -1
- package/dist/Toast.main.js +9 -5
- package/dist/Toast.main.js.map +1 -1
- package/dist/Toast.mjs +9 -5
- package/dist/Toast.module.js +9 -5
- package/dist/Toast.module.js.map +1 -1
- package/dist/ToggleButton.main.js +8 -2
- package/dist/ToggleButton.main.js.map +1 -1
- package/dist/ToggleButton.mjs +8 -2
- package/dist/ToggleButton.module.js +8 -2
- package/dist/ToggleButton.module.js.map +1 -1
- package/dist/ToggleButtonGroup.main.js +6 -2
- package/dist/ToggleButtonGroup.main.js.map +1 -1
- package/dist/ToggleButtonGroup.mjs +6 -2
- package/dist/ToggleButtonGroup.module.js +6 -2
- package/dist/ToggleButtonGroup.module.js.map +1 -1
- package/dist/Toolbar.main.js +4 -3
- package/dist/Toolbar.main.js.map +1 -1
- package/dist/Toolbar.mjs +4 -3
- package/dist/Toolbar.module.js +4 -3
- package/dist/Toolbar.module.js.map +1 -1
- package/dist/Tooltip.main.js +5 -3
- package/dist/Tooltip.main.js.map +1 -1
- package/dist/Tooltip.mjs +5 -3
- package/dist/Tooltip.module.js +5 -3
- package/dist/Tooltip.module.js.map +1 -1
- package/dist/Tree.main.js +73 -26
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +74 -27
- package/dist/Tree.module.js +74 -27
- package/dist/Tree.module.js.map +1 -1
- package/dist/TreeDropTargetDelegate.main.js +8 -5
- package/dist/TreeDropTargetDelegate.main.js.map +1 -1
- package/dist/TreeDropTargetDelegate.mjs +8 -5
- package/dist/TreeDropTargetDelegate.module.js +8 -5
- package/dist/TreeDropTargetDelegate.module.js.map +1 -1
- package/dist/import.mjs +5 -5
- package/dist/main.js +4 -4
- package/dist/main.js.map +1 -1
- package/dist/module.js +5 -5
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +212 -203
- package/dist/types.d.ts.map +1 -1
- package/dist/useDragAndDrop.main.js.map +1 -1
- package/dist/useDragAndDrop.module.js.map +1 -1
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.module.js.map +1 -1
- package/i18n/de-DE.js +1 -1
- package/i18n/de-DE.mjs +1 -1
- package/package.json +25 -25
- package/src/Breadcrumbs.tsx +10 -6
- package/src/Button.tsx +8 -30
- package/src/Calendar.tsx +41 -24
- package/src/Checkbox.tsx +8 -6
- package/src/Collection.tsx +2 -2
- package/src/ColorArea.tsx +5 -6
- package/src/ColorField.tsx +6 -4
- package/src/ColorSlider.tsx +3 -2
- package/src/ColorSwatch.tsx +6 -3
- package/src/ColorSwatchPicker.tsx +3 -3
- package/src/ColorThumb.tsx +3 -3
- package/src/ColorWheel.tsx +6 -5
- package/src/ComboBox.tsx +4 -4
- package/src/DateField.tsx +15 -10
- package/src/DatePicker.tsx +14 -12
- package/src/Dialog.tsx +6 -6
- package/src/Disclosure.tsx +10 -14
- package/src/DragAndDrop.tsx +31 -1
- package/src/DropZone.tsx +4 -5
- package/src/FieldError.tsx +3 -3
- package/src/FileTrigger.tsx +4 -3
- package/src/Form.tsx +2 -1
- package/src/GridList.tsx +25 -18
- package/src/HiddenDateInput.tsx +142 -0
- package/src/Link.tsx +7 -3
- package/src/ListBox.tsx +30 -26
- package/src/Menu.tsx +15 -12
- package/src/Meter.tsx +6 -3
- package/src/Modal.tsx +16 -5
- package/src/NumberField.tsx +4 -4
- package/src/Popover.tsx +3 -3
- package/src/ProgressBar.tsx +6 -2
- package/src/RadioGroup.tsx +8 -6
- package/src/SearchField.tsx +3 -2
- package/src/Select.tsx +13 -16
- package/src/Separator.tsx +6 -4
- package/src/Slider.tsx +9 -11
- package/src/Switch.tsx +4 -3
- package/src/Table.tsx +58 -56
- package/src/Tabs.tsx +20 -16
- package/src/TagGroup.tsx +13 -12
- package/src/TextField.tsx +5 -2
- package/src/Toast.tsx +10 -8
- package/src/ToggleButton.tsx +8 -4
- package/src/ToggleButtonGroup.tsx +6 -4
- package/src/Toolbar.tsx +4 -5
- package/src/Tooltip.tsx +6 -5
- package/src/Tree.tsx +90 -42
- package/src/TreeDropTargetDelegate.ts +5 -1
- package/src/index.ts +8 -8
- package/src/useDragAndDrop.tsx +2 -2
- package/src/utils.tsx +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAqGM,MAAM,0DAAuB,CAAA,GAAA,0BAAY,EAAoD;AAC7F,MAAM,0DAA4B,CAAA,GAAA,0BAAY,EAA6B;AAK3E,MAAM,4CAA8B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,cAAc,KAAyB,EAAE,GAAiC;IAC3J,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE,CAAA,GAAA,qCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB,IAAI,qBAAqB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,oCAA5B,kBAAA,OAAsD;IAC/E,IAAI,QAAQ,CAAA,GAAA,yCAAoB,EAAE;QAChC,GAAG,KAAK;4BACR;IACF;IACA,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM,EAC5B,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IAEnD,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAE,GAAG,YAAW,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BACA;wBACA;uBACA;YACA,YAAY,MAAM,UAAU,IAAI;QAClC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE;IAC9B,OAAO,SAAS,EAAE;IAElB,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,2BAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,sBAAoB,MAAM,eAAe,IAAI;QAC7C,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,MAAM,UAAU,IAAI;qBACnC,0DAAC,CAAA,GAAA,+BAAa;QAAE,aAAY;qBAC1B,0DAAC;QAAO,GAAG,CAAA,GAAA,2BAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Checkbox.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {AriaCheckboxGroupProps, AriaCheckboxProps, HoverEvents, mergeProps, useCheckbox, useCheckboxGroup, useCheckboxGroupItem, useFocusRing, useHover, VisuallyHidden} from 'react-aria';\nimport {CheckboxContext} from './RSPContexts';\nimport {CheckboxGroupState, useCheckboxGroupState, useToggleState} from 'react-stately';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps>, SlotProps {}\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, HoverEvents, RACValidation, RenderProps<CheckboxRenderProps>, SlotProps {\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface CheckboxGroupRenderProps {\n /**\n * Whether the checkbox group is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox group is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox group is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the checkbox group is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the checkbox group.\n */\n state: CheckboxGroupState\n}\n\nexport interface CheckboxRenderProps {\n /**\n * Whether the checkbox is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the checkbox is indeterminate.\n * @selector [data-indeterminate]\n */\n isIndeterminate: boolean,\n /**\n * Whether the checkbox is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the checkbox is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the checkbox is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the checkbox is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the checkbox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the checkbox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport const CheckboxGroupContext = createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\nexport const CheckboxGroupStateContext = createContext<CheckboxGroupState | null>(null);\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n */\nexport const CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function CheckboxGroup(props: CheckboxGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CheckboxGroupContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useCheckboxGroupState({\n ...props,\n validationBehavior\n });\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({\n ...props,\n label,\n validationBehavior\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isDisabled: state.isDisabled,\n isReadOnly: state.isReadOnly,\n isRequired: props.isRequired || false,\n isInvalid: state.isInvalid,\n state\n },\n defaultClassName: 'react-aria-CheckboxGroup'\n });\n\n return (\n <div\n {...groupProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-readonly={state.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={state.isInvalid || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [CheckboxGroupStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n\n/**\n * A checkbox allows a user to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n */\nexport const Checkbox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, CheckboxContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let groupState = useContext(CheckboxGroupStateContext);\n let inputRef = useObjectRef(useMemo(() => mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null), [userProvidedInputRef, props.inputRef]));\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...removeDataAttributes(props),\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox({\n ...removeDataAttributes(props),\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n // eslint-disable-next-line react-hooks/rules-of-hooks\n }, useToggleState(props), inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Checkbox',\n values: {\n isSelected,\n isIndeterminate: props.isIndeterminate || false,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false\n }\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-indeterminate={props.isIndeterminate || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </label>\n );\n});\n"],"names":[],"version":3,"file":"Checkbox.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAqGM,MAAM,0DAAuB,CAAA,GAAA,0BAAY,EAAoD;AAC7F,MAAM,0DAA4B,CAAA,GAAA,0BAAY,EAA6B;AAK3E,MAAM,4CAA8B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,cAAc,KAAyB,EAAE,GAAiC;IAC3J,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE,CAAA,GAAA,qCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB,IAAI,qBAAqB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,oCAA5B,kBAAA,OAAsD;IAC/E,IAAI,QAAQ,CAAA,GAAA,yCAAoB,EAAE;QAChC,GAAG,KAAK;4BACR;IACF;IACA,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM,EAC5B,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,k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C,GAAG,KAAK;QACR,YAAY;IACd;IAEA,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,iBAAiB,MAAM,eAAe,IAAI;uBAC1C;uBACA;uBACA;4BACA;wBACA;wBACA;uBACA;YACA,YAAY,MAAM,UAAU,IAAI;QAClC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAClB,OAAO,SAAS,OAAO;IAEvB,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,2BAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,sBAAoB,MAAM,eAAe,IAAI;QAC7C,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,MAAM,UAAU,IAAI;qBACnC,0DAAC,CAAA,GAAA,+BAAa;QAAE,aAAY;qBAC1B,0DAAC;QAAO,GAAG,CAAA,GAAA,2BAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Checkbox.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {AriaCheckboxGroupProps, AriaCheckboxProps, HoverEvents, mergeProps, useCheckbox, useCheckboxGroup, useCheckboxGroupItem, useFocusRing, useHover, VisuallyHidden} from 'react-aria';\nimport {CheckboxContext} from './RSPContexts';\nimport {CheckboxGroupState, useCheckboxGroupState, useToggleState} from 'react-stately';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, HoverEvents, RACValidation, RenderProps<CheckboxRenderProps>, SlotProps, Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface CheckboxGroupRenderProps {\n /**\n * Whether the checkbox group is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox group is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox group is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the checkbox group is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the checkbox group.\n */\n state: CheckboxGroupState\n}\n\nexport interface CheckboxRenderProps {\n /**\n * Whether the checkbox is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the checkbox is indeterminate.\n * @selector [data-indeterminate]\n */\n isIndeterminate: boolean,\n /**\n * Whether the checkbox is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the checkbox is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the checkbox is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the checkbox is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the checkbox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the checkbox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport const CheckboxGroupContext = createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\nexport const CheckboxGroupStateContext = createContext<CheckboxGroupState | null>(null);\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n */\nexport const CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function CheckboxGroup(props: CheckboxGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CheckboxGroupContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useCheckboxGroupState({\n ...props,\n validationBehavior\n });\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({\n ...props,\n label,\n validationBehavior\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isDisabled: state.isDisabled,\n isReadOnly: state.isReadOnly,\n isRequired: props.isRequired || false,\n isInvalid: state.isInvalid,\n state\n },\n defaultClassName: 'react-aria-CheckboxGroup'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <div\n {...mergeProps(DOMProps, renderProps, groupProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-readonly={state.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={state.isInvalid || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [CheckboxGroupStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n\n/**\n * A checkbox allows a user to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n */\nexport const Checkbox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, CheckboxContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let groupState = useContext(CheckboxGroupStateContext);\n let inputRef = useObjectRef(useMemo(() => mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null), [userProvidedInputRef, props.inputRef]));\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...removeDataAttributes(props),\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox({\n ...removeDataAttributes(props),\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n // eslint-disable-next-line react-hooks/rules-of-hooks\n }, useToggleState(props), inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Checkbox',\n values: {\n isSelected,\n isIndeterminate: props.isIndeterminate || false,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-indeterminate={props.isIndeterminate || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </label>\n );\n});\n"],"names":[],"version":3,"file":"Checkbox.main.js.map"}
|
package/dist/Checkbox.mjs
CHANGED
|
@@ -4,9 +4,9 @@ import {FieldErrorContext as $ee014567cb39d3f0$export$ff05c3ac10437e03} from "./
|
|
|
4
4
|
import {FormContext as $d3e0e05bdfcf66bd$export$c24727297075ec6a} from "./Form.mjs";
|
|
5
5
|
import {LabelContext as $01b77f81d0f07f68$export$75b6ee27786ba447} from "./Label.mjs";
|
|
6
6
|
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.mjs";
|
|
7
|
-
import {useCheckboxGroup as $kPH7g$useCheckboxGroup, useCheckboxGroupItem as $kPH7g$useCheckboxGroupItem, useCheckbox as $kPH7g$useCheckbox, useFocusRing as $kPH7g$useFocusRing, useHover as $kPH7g$useHover,
|
|
7
|
+
import {useCheckboxGroup as $kPH7g$useCheckboxGroup, mergeProps as $kPH7g$mergeProps, useCheckboxGroupItem as $kPH7g$useCheckboxGroupItem, useCheckbox as $kPH7g$useCheckbox, useFocusRing as $kPH7g$useFocusRing, useHover as $kPH7g$useHover, VisuallyHidden as $kPH7g$VisuallyHidden} from "react-aria";
|
|
8
8
|
import {useCheckboxGroupState as $kPH7g$useCheckboxGroupState, useToggleState as $kPH7g$useToggleState} from "react-stately";
|
|
9
|
-
import {
|
|
9
|
+
import {filterDOMProps as $kPH7g$filterDOMProps, useObjectRef as $kPH7g$useObjectRef, mergeRefs as $kPH7g$mergeRefs} from "@react-aria/utils";
|
|
10
10
|
import $kPH7g$react, {createContext as $kPH7g$createContext, forwardRef as $kPH7g$forwardRef, useContext as $kPH7g$useContext, useMemo as $kPH7g$useMemo} from "react";
|
|
11
11
|
|
|
12
12
|
/*
|
|
@@ -57,9 +57,11 @@ const $bc237834342dbd75$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $kPH7g$forwa
|
|
|
57
57
|
},
|
|
58
58
|
defaultClassName: 'react-aria-CheckboxGroup'
|
|
59
59
|
});
|
|
60
|
+
let DOMProps = (0, $kPH7g$filterDOMProps)(props, {
|
|
61
|
+
global: true
|
|
62
|
+
});
|
|
60
63
|
return /*#__PURE__*/ (0, $kPH7g$react).createElement("div", {
|
|
61
|
-
...groupProps,
|
|
62
|
-
...renderProps,
|
|
64
|
+
...(0, $kPH7g$mergeProps)(DOMProps, renderProps, groupProps),
|
|
63
65
|
ref: ref,
|
|
64
66
|
slot: props.slot || undefined,
|
|
65
67
|
"data-readonly": state.isReadOnly || undefined,
|
|
@@ -142,8 +144,11 @@ const $bc237834342dbd75$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $kPH7g$forwa
|
|
|
142
144
|
isRequired: props.isRequired || false
|
|
143
145
|
}
|
|
144
146
|
});
|
|
145
|
-
let DOMProps = (0, $kPH7g$filterDOMProps)(props
|
|
147
|
+
let DOMProps = (0, $kPH7g$filterDOMProps)(props, {
|
|
148
|
+
global: true
|
|
149
|
+
});
|
|
146
150
|
delete DOMProps.id;
|
|
151
|
+
delete DOMProps.onClick;
|
|
147
152
|
return /*#__PURE__*/ (0, $kPH7g$react).createElement("label", {
|
|
148
153
|
...(0, $kPH7g$mergeProps)(DOMProps, labelProps, hoverProps, renderProps),
|
|
149
154
|
ref: ref,
|
package/dist/Checkbox.module.js
CHANGED
|
@@ -4,9 +4,9 @@ import {FieldErrorContext as $ee014567cb39d3f0$export$ff05c3ac10437e03} from "./
|
|
|
4
4
|
import {FormContext as $d3e0e05bdfcf66bd$export$c24727297075ec6a} from "./Form.module.js";
|
|
5
5
|
import {LabelContext as $01b77f81d0f07f68$export$75b6ee27786ba447} from "./Label.module.js";
|
|
6
6
|
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.module.js";
|
|
7
|
-
import {useCheckboxGroup as $kPH7g$useCheckboxGroup, useCheckboxGroupItem as $kPH7g$useCheckboxGroupItem, useCheckbox as $kPH7g$useCheckbox, useFocusRing as $kPH7g$useFocusRing, useHover as $kPH7g$useHover,
|
|
7
|
+
import {useCheckboxGroup as $kPH7g$useCheckboxGroup, mergeProps as $kPH7g$mergeProps, useCheckboxGroupItem as $kPH7g$useCheckboxGroupItem, useCheckbox as $kPH7g$useCheckbox, useFocusRing as $kPH7g$useFocusRing, useHover as $kPH7g$useHover, VisuallyHidden as $kPH7g$VisuallyHidden} from "react-aria";
|
|
8
8
|
import {useCheckboxGroupState as $kPH7g$useCheckboxGroupState, useToggleState as $kPH7g$useToggleState} from "react-stately";
|
|
9
|
-
import {
|
|
9
|
+
import {filterDOMProps as $kPH7g$filterDOMProps, useObjectRef as $kPH7g$useObjectRef, mergeRefs as $kPH7g$mergeRefs} from "@react-aria/utils";
|
|
10
10
|
import $kPH7g$react, {createContext as $kPH7g$createContext, forwardRef as $kPH7g$forwardRef, useContext as $kPH7g$useContext, useMemo as $kPH7g$useMemo} from "react";
|
|
11
11
|
|
|
12
12
|
/*
|
|
@@ -57,9 +57,11 @@ const $bc237834342dbd75$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $kPH7g$forwa
|
|
|
57
57
|
},
|
|
58
58
|
defaultClassName: 'react-aria-CheckboxGroup'
|
|
59
59
|
});
|
|
60
|
+
let DOMProps = (0, $kPH7g$filterDOMProps)(props, {
|
|
61
|
+
global: true
|
|
62
|
+
});
|
|
60
63
|
return /*#__PURE__*/ (0, $kPH7g$react).createElement("div", {
|
|
61
|
-
...groupProps,
|
|
62
|
-
...renderProps,
|
|
64
|
+
...(0, $kPH7g$mergeProps)(DOMProps, renderProps, groupProps),
|
|
63
65
|
ref: ref,
|
|
64
66
|
slot: props.slot || undefined,
|
|
65
67
|
"data-readonly": state.isReadOnly || undefined,
|
|
@@ -142,8 +144,11 @@ const $bc237834342dbd75$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $kPH7g$forwa
|
|
|
142
144
|
isRequired: props.isRequired || false
|
|
143
145
|
}
|
|
144
146
|
});
|
|
145
|
-
let DOMProps = (0, $kPH7g$filterDOMProps)(props
|
|
147
|
+
let DOMProps = (0, $kPH7g$filterDOMProps)(props, {
|
|
148
|
+
global: true
|
|
149
|
+
});
|
|
146
150
|
delete DOMProps.id;
|
|
151
|
+
delete DOMProps.onClick;
|
|
147
152
|
return /*#__PURE__*/ (0, $kPH7g$react).createElement("label", {
|
|
148
153
|
...(0, $kPH7g$mergeProps)(DOMProps, labelProps, hoverProps, renderProps),
|
|
149
154
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAqGM,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAoD;AAC7F,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAA6B;AAK3E,MAA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EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Checkbox.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {AriaCheckboxGroupProps, AriaCheckboxProps, HoverEvents, mergeProps, useCheckbox, useCheckboxGroup, useCheckboxGroupItem, useFocusRing, useHover, VisuallyHidden} from 'react-aria';\nimport {CheckboxContext} from './RSPContexts';\nimport {CheckboxGroupState, useCheckboxGroupState, useToggleState} from 'react-stately';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps>, SlotProps {}\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, HoverEvents, RACValidation, RenderProps<CheckboxRenderProps>, SlotProps {\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface CheckboxGroupRenderProps {\n /**\n * Whether the checkbox group is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox group is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox group is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the checkbox group is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the checkbox group.\n */\n state: CheckboxGroupState\n}\n\nexport interface CheckboxRenderProps {\n /**\n * Whether the checkbox is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the checkbox is indeterminate.\n * @selector [data-indeterminate]\n */\n isIndeterminate: boolean,\n /**\n * Whether the checkbox is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the checkbox is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the checkbox is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the checkbox is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the checkbox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the checkbox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport const CheckboxGroupContext = createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\nexport const CheckboxGroupStateContext = createContext<CheckboxGroupState | null>(null);\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n */\nexport const CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function CheckboxGroup(props: CheckboxGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CheckboxGroupContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useCheckboxGroupState({\n ...props,\n validationBehavior\n });\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({\n ...props,\n label,\n validationBehavior\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isDisabled: state.isDisabled,\n isReadOnly: state.isReadOnly,\n isRequired: props.isRequired || false,\n isInvalid: state.isInvalid,\n state\n },\n defaultClassName: 'react-aria-CheckboxGroup'\n });\n\n return (\n <div\n {...groupProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-readonly={state.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={state.isInvalid || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [CheckboxGroupStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n\n/**\n * A checkbox allows a user to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n */\nexport const Checkbox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, CheckboxContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let groupState = useContext(CheckboxGroupStateContext);\n let inputRef = useObjectRef(useMemo(() => mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null), [userProvidedInputRef, props.inputRef]));\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...removeDataAttributes(props),\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox({\n ...removeDataAttributes(props),\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n // eslint-disable-next-line react-hooks/rules-of-hooks\n }, useToggleState(props), inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Checkbox',\n values: {\n isSelected,\n isIndeterminate: props.isIndeterminate || false,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false\n }\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-indeterminate={props.isIndeterminate || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </label>\n );\n});\n"],"names":[],"version":3,"file":"Checkbox.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAqGM,MAAM,0DAAuB,CAAA,GAA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aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,MAAM,UAAU,IAAI;qBACnC,gCAAC,CAAA,GAAA,qBAAa;QAAE,aAAY;qBAC1B,gCAAC;QAAO,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Checkbox.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {AriaCheckboxGroupProps, AriaCheckboxProps, HoverEvents, mergeProps, useCheckbox, useCheckboxGroup, useCheckboxGroupItem, useFocusRing, useHover, VisuallyHidden} from 'react-aria';\nimport {CheckboxContext} from './RSPContexts';\nimport {CheckboxGroupState, useCheckboxGroupState, useToggleState} from 'react-stately';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, HoverEvents, RACValidation, RenderProps<CheckboxRenderProps>, SlotProps, Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface CheckboxGroupRenderProps {\n /**\n * Whether the checkbox group is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox group is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox group is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the checkbox group is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the checkbox group.\n */\n state: CheckboxGroupState\n}\n\nexport interface CheckboxRenderProps {\n /**\n * Whether the checkbox is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the checkbox is indeterminate.\n * @selector [data-indeterminate]\n */\n isIndeterminate: boolean,\n /**\n * Whether the checkbox is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the checkbox is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the checkbox is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the checkbox is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the checkbox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the checkbox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport const CheckboxGroupContext = createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\nexport const CheckboxGroupStateContext = createContext<CheckboxGroupState | null>(null);\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n */\nexport const CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function CheckboxGroup(props: CheckboxGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CheckboxGroupContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useCheckboxGroupState({\n ...props,\n validationBehavior\n });\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({\n ...props,\n label,\n validationBehavior\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isDisabled: state.isDisabled,\n isReadOnly: state.isReadOnly,\n isRequired: props.isRequired || false,\n isInvalid: state.isInvalid,\n state\n },\n defaultClassName: 'react-aria-CheckboxGroup'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <div\n {...mergeProps(DOMProps, renderProps, groupProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-readonly={state.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={state.isInvalid || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [CheckboxGroupStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n\n/**\n * A checkbox allows a user to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n */\nexport const Checkbox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, CheckboxContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let groupState = useContext(CheckboxGroupStateContext);\n let inputRef = useObjectRef(useMemo(() => mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null), [userProvidedInputRef, props.inputRef]));\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...removeDataAttributes(props),\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox({\n ...removeDataAttributes(props),\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n // eslint-disable-next-line react-hooks/rules-of-hooks\n }, useToggleState(props), inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Checkbox',\n values: {\n isSelected,\n isIndeterminate: props.isIndeterminate || false,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-indeterminate={props.isIndeterminate || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </label>\n );\n});\n"],"names":[],"version":3,"file":"Checkbox.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAyFM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA8B;AAGjE,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,iDAAoB,EAAE,WAAW,CAAmB,OAAwB,KAAgC;IAC/I,IAAI,QAAC,IAAI,UAAE,MAAM,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAChC,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CAAC,CAAC,qCAAqC,EAAE,KAAK,UAAU,CAAC;IAEvE,OAAO,OAAO,OAAO,KAAK,SAAS;AACrC;AAmCO,MAAM,4CAAgD;IAC3D,gBAAe,cAAC,UAAU,uBAAE,mBAAmB,EAAC;QAC9C,OAAO,0CAAoB,YAAY,MAAM;IAC/C;IACA,kBAAiB,cAAC,UAAU,UAAE,MAAM,uBAAE,mBAAmB,EAAC;QACxD,OAAO,0CAAoB,YAAY,QAAQ;IACjD;AACF;AAEA,SAAS,0CACP,UAAsC,EACtC,MAA4B,EAC5B,mBAA2D;IAE3D,OAAO,CAAA,GAAA,6CAAgB,EAAE;QACvB,OAAO,SAAS,WAAW,WAAW,CAAE,OAAO,GAAG,IAAI;QACtD,cAAc;YAAC;SAAoB;QACnC,UAAS,IAAI;YACX,IAAI,WAAW,KAAK,MAAM,CAAE;YAC5B,IAAI,CAAC,uBAAuB,KAAK,IAAI,KAAK,QACxC,OAAO;YAGT,qBACE,sHACG,o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;AACT;AAEO,MAAM,0DAA4B,CAAA,GAAA,0BAAY,EAAsB;AAGpE,SAAS,0CAAiB,UAAsB;IACrD,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,cAAc,OAAO,IAAI,IAAI;YAAC;SAAW,IAAI,MAAM;QAAC;KAAW;AACtF","sources":["packages/react-aria-components/src/Collection.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {CollectionBase, DropTargetDelegate, ItemDropTarget, Key, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {createBranchComponent, useCachedChildren} from '@react-aria/collections';\nimport {Collection as ICollection, Node, SelectionBehavior, SelectionMode, SectionProps as SharedSectionProps} from 'react-stately';\nimport React, {cloneElement, createContext, ForwardedRef, HTMLAttributes, isValidElement, JSX, ReactElement, ReactNode, useContext, useMemo} from 'react';\nimport {StyleProps} from './utils';\n\nexport interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'> {\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: ReadonlyArray<any>\n}\n\nexport interface ItemRenderProps {\n /**\n * Whether the item is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the item is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the item is currently selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the item is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the item is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /** The selection behavior for the collection. */\n selectionBehavior: SelectionBehavior,\n /**\n * Whether the item allows dragging.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-allows-dragging]\n */\n allowsDragging?: boolean,\n /**\n * Whether the item is currently being dragged.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-dragging]\n */\n isDragging?: boolean,\n /**\n * Whether the item is currently an active drop target.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-drop-target]\n */\n isDropTarget?: boolean\n}\n\nexport interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children' | 'title'>, StyleProps {\n /** The unique id of the section. */\n id?: Key,\n /** The object value that this section represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** Static child items or a function to render children. */\n children?: ReactNode | ((item: T) => ReactElement),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: ReadonlyArray<any>\n}\n\ninterface SectionContextValue {\n name: string,\n render: (props: SectionProps<any>, ref: ForwardedRef<HTMLElement>, section: Node<any>, className?: string) => ReactElement\n}\n\nexport const SectionContext = createContext<SectionContextValue | null>(null);\n\n/** @deprecated */\nexport const Section = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: SectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>): JSX.Element => {\n let {name, render} = useContext(SectionContext)!;\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`<Section> is deprecated. Please use <${name}> instead.`);\n }\n return render(props, ref, section, 'react-aria-Section');\n});\n\nexport interface CollectionBranchProps {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** The parent node of the items to render. */\n parent: Node<unknown>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRootProps extends HTMLAttributes<HTMLElement> {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** A set of keys for items that should always be persisted in the DOM. */\n persistedKeys?: Set<Key> | null,\n /** A ref to the scroll container for the collection. */\n scrollRef?: RefObject<HTMLElement | null>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRenderer {\n /** Whether this is a virtualized collection. */\n isVirtualized?: boolean,\n /** A delegate object that provides layout information for items in the collection. */\n layoutDelegate?: LayoutDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate?: DropTargetDelegate,\n /** A component that renders the root collection items. */\n CollectionRoot: React.ComponentType<CollectionRootProps>,\n /** A component that renders the child collection items. */\n CollectionBranch: React.ComponentType<CollectionBranchProps>\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection, renderDropIndicator}) {\n return useCollectionRender(collection, null, renderDropIndicator);\n },\n CollectionBranch({collection, parent, renderDropIndicator}) {\n return useCollectionRender(collection, parent, renderDropIndicator);\n }\n};\n\nfunction useCollectionRender(\n collection: ICollection<Node<unknown>>,\n parent: Node<unknown> | null,\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n) {\n return useCachedChildren({\n items: parent ? collection.getChildren!(parent.key) : collection,\n dependencies: [renderDropIndicator],\n children(node) {\n let rendered = node.render!(node);\n if (!renderDropIndicator || node.type !== 'item') {\n return rendered;\n }\n\n return (\n <>\n {renderDropIndicator({type: 'item', key: node.key, dropPosition: 'before'})}\n {rendered}\n {renderAfterDropIndicators(collection, node, renderDropIndicator)}\n </>\n );\n }\n });\n}\n\nexport function renderAfterDropIndicators(collection: ICollection<Node<unknown>>, node: Node<unknown>, renderDropIndicator: (target: ItemDropTarget) => ReactNode): ReactNode {\n let key = node.key;\n let keyAfter = collection.getKeyAfter(key);\n let nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;\n while (nextItemInFlattenedCollection != null && nextItemInFlattenedCollection.type !== 'item') {\n keyAfter = collection.getKeyAfter(nextItemInFlattenedCollection.key);\n nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;\n }\n\n let nextItemInSameLevel = node.nextKey != null ? collection.getItem(node.nextKey) : null;\n while (nextItemInSameLevel != null && nextItemInSameLevel.type !== 'item') {\n nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;\n }\n\n // Render one or more \"after\" drop indicators when the next item in the flattened collection\n // has a smaller level, is not an item, or there are no more items in the collection.\n // Otherwise, the \"after\" position is equivalent to the next item's \"before\" position.\n let afterIndicators: ReactNode[] = [];\n if (nextItemInSameLevel == null) {\n let current: Node<unknown> | null = node;\n while (current && (!nextItemInFlattenedCollection || (current.parentKey !== nextItemInFlattenedCollection.parentKey && nextItemInFlattenedCollection.level < current.level))) {\n let indicator = renderDropIndicator({\n type: 'item',\n key: current.key,\n dropPosition: 'after'\n });\n if (isValidElement(indicator)) {\n afterIndicators.push(cloneElement(indicator, {key: `${current.key}-after`}));\n }\n current = current.parentKey != null ? collection.getItem(current.parentKey) : null;\n }\n }\n\n return afterIndicators;\n}\n\nexport const CollectionRendererContext = createContext<CollectionRenderer>(DefaultCollectionRenderer);\n\ntype PersistedKeysReturnValue = Set<Key> | null;\nexport function usePersistedKeys(focusedKey: Key | null): PersistedKeysReturnValue {\n return useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n}\n"],"names":[],"version":3,"file":"Collection.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAyFM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA8B;AAGjE,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,iDAAoB,EAAE,WAAW,CAAmB,OAAwB,KAAg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IAAI,OAAO,WAAW,OAAO,CAAC,KAAK,OAAO,IAAI;IACpF,MAAO,uBAAuB,QAAQ,oBAAoB,IAAI,KAAK,OACjE,sBAAsB,oBAAoB,OAAO,IAAI,OAAO,WAAW,OAAO,CAAC,oBAAoB,OAAO,IAAI;IAGhH,4FAA4F;IAC5F,qFAAqF;IACrF,sFAAsF;IACtF,IAAI,kBAA+B,EAAE;IACrC,IAAI,uBAAuB,MAAM;QAC/B,IAAI,UAAgC;QACpC,MAAO,WAAY,CAAA,CAAC,iCAAkC,QAAQ,SAAS,KAAK,8BAA8B,SAAS,IAAI,8BAA8B,KAAK,GAAG,QAAQ,KAAK,EAAI;YAC5K,IAAI,YAAY,oBAAoB;gBAClC,MAAM;gBACN,KAAK,QAAQ,GAAG;gBAChB,cAAc;YAChB;YACA,kBAAI,CAAA,GAAA,2BAAa,EAAE,YACjB,gBAAgB,IAAI,eAAC,CAAA,GAAA,yBAAW,EAAE,WAAW;gBAAC,KAAK,GAAG,QAAQ,GAAG,CAAC,MAAM,CAAC;YAAA;YAE3E,UAAU,QAAQ,SAAS,IAAI,OAAO,WAAW,OAAO,CAAC,QAAQ,SAAS,IAAI;QAChF;IACF;IAEA,OAAO;AACT;AAEO,MAAM,0DAA4B,CAAA,GAAA,0BAAY,EAAsB;AAGpE,SAAS,0CAAiB,UAAsB;IACrD,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,cAAc,OAAO,IAAI,IAAI;YAAC;SAAW,IAAI,MAAM;QAAC;KAAW;AACtF","sources":["packages/react-aria-components/src/Collection.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {CollectionBase, DropTargetDelegate, GlobalDOMAttributes, ItemDropTarget, Key, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {createBranchComponent, useCachedChildren} from '@react-aria/collections';\nimport {Collection as ICollection, Node, SelectionBehavior, SelectionMode, SectionProps as SharedSectionProps} from 'react-stately';\nimport React, {cloneElement, createContext, ForwardedRef, HTMLAttributes, isValidElement, JSX, ReactElement, ReactNode, useContext, useMemo} from 'react';\nimport {StyleProps} from './utils';\n\nexport interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'> {\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: ReadonlyArray<any>\n}\n\nexport interface ItemRenderProps {\n /**\n * Whether the item is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the item is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the item is currently selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the item is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the item is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /** The selection behavior for the collection. */\n selectionBehavior: SelectionBehavior,\n /**\n * Whether the item allows dragging.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-allows-dragging]\n */\n allowsDragging?: boolean,\n /**\n * Whether the item is currently being dragged.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-dragging]\n */\n isDragging?: boolean,\n /**\n * Whether the item is currently an active drop target.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-drop-target]\n */\n isDropTarget?: boolean\n}\n\nexport interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children' | 'title'>, StyleProps, GlobalDOMAttributes<HTMLElement> {\n /** The unique id of the section. */\n id?: Key,\n /** The object value that this section represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** Static child items or a function to render children. */\n children?: ReactNode | ((item: T) => ReactElement),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: ReadonlyArray<any>\n}\n\ninterface SectionContextValue {\n name: string,\n render: (props: SectionProps<any>, ref: ForwardedRef<HTMLElement>, section: Node<any>, className?: string) => ReactElement\n}\n\nexport const SectionContext = createContext<SectionContextValue | null>(null);\n\n/** @deprecated */\nexport const Section = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: SectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>): JSX.Element => {\n let {name, render} = useContext(SectionContext)!;\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`<Section> is deprecated. Please use <${name}> instead.`);\n }\n return render(props, ref, section, 'react-aria-Section');\n});\n\nexport interface CollectionBranchProps {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** The parent node of the items to render. */\n parent: Node<unknown>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRootProps extends HTMLAttributes<HTMLElement> {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** A set of keys for items that should always be persisted in the DOM. */\n persistedKeys?: Set<Key> | null,\n /** A ref to the scroll container for the collection. */\n scrollRef?: RefObject<HTMLElement | null>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRenderer {\n /** Whether this is a virtualized collection. */\n isVirtualized?: boolean,\n /** A delegate object that provides layout information for items in the collection. */\n layoutDelegate?: LayoutDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate?: DropTargetDelegate,\n /** A component that renders the root collection items. */\n CollectionRoot: React.ComponentType<CollectionRootProps>,\n /** A component that renders the child collection items. */\n CollectionBranch: React.ComponentType<CollectionBranchProps>\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection, renderDropIndicator}) {\n return useCollectionRender(collection, null, renderDropIndicator);\n },\n CollectionBranch({collection, parent, renderDropIndicator}) {\n return useCollectionRender(collection, parent, renderDropIndicator);\n }\n};\n\nfunction useCollectionRender(\n collection: ICollection<Node<unknown>>,\n parent: Node<unknown> | null,\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n) {\n return useCachedChildren({\n items: parent ? collection.getChildren!(parent.key) : collection,\n dependencies: [renderDropIndicator],\n children(node) {\n let rendered = node.render!(node);\n if (!renderDropIndicator || node.type !== 'item') {\n return rendered;\n }\n\n return (\n <>\n {renderDropIndicator({type: 'item', key: node.key, dropPosition: 'before'})}\n {rendered}\n {renderAfterDropIndicators(collection, node, renderDropIndicator)}\n </>\n );\n }\n });\n}\n\nexport function renderAfterDropIndicators(collection: ICollection<Node<unknown>>, node: Node<unknown>, renderDropIndicator: (target: ItemDropTarget) => ReactNode): ReactNode {\n let key = node.key;\n let keyAfter = collection.getKeyAfter(key);\n let nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;\n while (nextItemInFlattenedCollection != null && nextItemInFlattenedCollection.type !== 'item') {\n keyAfter = collection.getKeyAfter(nextItemInFlattenedCollection.key);\n nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;\n }\n\n let nextItemInSameLevel = node.nextKey != null ? collection.getItem(node.nextKey) : null;\n while (nextItemInSameLevel != null && nextItemInSameLevel.type !== 'item') {\n nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;\n }\n\n // Render one or more \"after\" drop indicators when the next item in the flattened collection\n // has a smaller level, is not an item, or there are no more items in the collection.\n // Otherwise, the \"after\" position is equivalent to the next item's \"before\" position.\n let afterIndicators: ReactNode[] = [];\n if (nextItemInSameLevel == null) {\n let current: Node<unknown> | null = node;\n while (current && (!nextItemInFlattenedCollection || (current.parentKey !== nextItemInFlattenedCollection.parentKey && nextItemInFlattenedCollection.level < current.level))) {\n let indicator = renderDropIndicator({\n type: 'item',\n key: current.key,\n dropPosition: 'after'\n });\n if (isValidElement(indicator)) {\n afterIndicators.push(cloneElement(indicator, {key: `${current.key}-after`}));\n }\n current = current.parentKey != null ? collection.getItem(current.parentKey) : null;\n }\n }\n\n return afterIndicators;\n}\n\nexport const CollectionRendererContext = createContext<CollectionRenderer>(DefaultCollectionRenderer);\n\ntype PersistedKeysReturnValue = Set<Key> | null;\nexport function usePersistedKeys(focusedKey: Key | null): PersistedKeysReturnValue {\n return useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n}\n"],"names":[],"version":3,"file":"Collection.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAyFM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA8B;AAGjE,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,4BAAoB,EAAE,WAAW,CAAmB,OAAwB,KAAgC;IAC/I,IAAI,QAAC,IAAI,UAAE,MAAM,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAChC,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CAAC,CAAC,qCAAqC,EAAE,KAAK,UAAU,CAAC;IAEvE,OAAO,OAAO,OAAO,KAAK,SAAS;AACrC;AAmCO,MAAM,4CAAgD;IAC3D,gBAAe,cAAC,UAAU,uBAAE,mBAAmB,EAAC;QAC9C,OAAO,0CAAoB,YAAY,MAAM;IAC/C;IACA,kBAAiB,cAAC,UAAU,UAAE,MAAM,uBAAE,mBAAmB,EAAC;QACxD,OAAO,0CAAoB,YAAY,QAAQ;IACjD;AACF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AClC,MAAM;gBACN,KAAK,QAAQ,GAAG;gBAChB,cAAc;YAChB;YACA,kBAAI,CAAA,GAAA,qBAAa,EAAE,YACjB,gBAAgB,IAAI,eAAC,CAAA,GAAA,mBAAW,EAAE,WAAW;gBAAC,KAAK,GAAG,QAAQ,GAAG,CAAC,MAAM,CAAC;YAAA;YAE3E,UAAU,QAAQ,SAAS,IAAI,OAAO,WAAW,OAAO,CAAC,QAAQ,SAAS,IAAI;QAChF;IACF;IAEA,OAAO;AACT;AAEO,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAAsB;AAGpE,SAAS,0CAAiB,UAAsB;IACrD,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,cAAc,OAAO,IAAI,IAAI;YAAC;SAAW,IAAI,MAAM;QAAC;KAAW;AACtF","sources":["packages/react-aria-components/src/Collection.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {CollectionBase, DropTargetDelegate, ItemDropTarget, Key, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {createBranchComponent, useCachedChildren} from '@react-aria/collections';\nimport {Collection as ICollection, Node, SelectionBehavior, SelectionMode, SectionProps as SharedSectionProps} from 'react-stately';\nimport React, {cloneElement, createContext, ForwardedRef, HTMLAttributes, isValidElement, JSX, ReactElement, ReactNode, useContext, useMemo} from 'react';\nimport {StyleProps} from './utils';\n\nexport interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'> {\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: ReadonlyArray<any>\n}\n\nexport interface ItemRenderProps {\n /**\n * Whether the item is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the item is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the item is currently selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the item is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the item is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /** The selection behavior for the collection. */\n selectionBehavior: SelectionBehavior,\n /**\n * Whether the item allows dragging.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-allows-dragging]\n */\n allowsDragging?: boolean,\n /**\n * Whether the item is currently being dragged.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-dragging]\n */\n isDragging?: boolean,\n /**\n * Whether the item is currently an active drop target.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-drop-target]\n */\n isDropTarget?: boolean\n}\n\nexport interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children' | 'title'>, StyleProps {\n /** The unique id of the section. */\n id?: Key,\n /** The object value that this section represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** Static child items or a function to render children. */\n children?: ReactNode | ((item: T) => ReactElement),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: ReadonlyArray<any>\n}\n\ninterface SectionContextValue {\n name: string,\n render: (props: SectionProps<any>, ref: ForwardedRef<HTMLElement>, section: Node<any>, className?: string) => ReactElement\n}\n\nexport const SectionContext = createContext<SectionContextValue | null>(null);\n\n/** @deprecated */\nexport const Section = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: SectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>): JSX.Element => {\n let {name, render} = useContext(SectionContext)!;\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`<Section> is deprecated. Please use <${name}> instead.`);\n }\n return render(props, ref, section, 'react-aria-Section');\n});\n\nexport interface CollectionBranchProps {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** The parent node of the items to render. */\n parent: Node<unknown>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRootProps extends HTMLAttributes<HTMLElement> {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** A set of keys for items that should always be persisted in the DOM. */\n persistedKeys?: Set<Key> | null,\n /** A ref to the scroll container for the collection. */\n scrollRef?: RefObject<HTMLElement | null>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRenderer {\n /** Whether this is a virtualized collection. */\n isVirtualized?: boolean,\n /** A delegate object that provides layout information for items in the collection. */\n layoutDelegate?: LayoutDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate?: DropTargetDelegate,\n /** A component that renders the root collection items. */\n CollectionRoot: React.ComponentType<CollectionRootProps>,\n /** A component that renders the child collection items. */\n CollectionBranch: React.ComponentType<CollectionBranchProps>\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection, renderDropIndicator}) {\n return useCollectionRender(collection, null, renderDropIndicator);\n },\n CollectionBranch({collection, parent, renderDropIndicator}) {\n return useCollectionRender(collection, parent, renderDropIndicator);\n }\n};\n\nfunction useCollectionRender(\n collection: ICollection<Node<unknown>>,\n parent: Node<unknown> | null,\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n) {\n return useCachedChildren({\n items: parent ? collection.getChildren!(parent.key) : collection,\n dependencies: [renderDropIndicator],\n children(node) {\n let rendered = node.render!(node);\n if (!renderDropIndicator || node.type !== 'item') {\n return rendered;\n }\n\n return (\n <>\n {renderDropIndicator({type: 'item', key: node.key, dropPosition: 'before'})}\n {rendered}\n {renderAfterDropIndicators(collection, node, renderDropIndicator)}\n </>\n );\n }\n });\n}\n\nexport function renderAfterDropIndicators(collection: ICollection<Node<unknown>>, node: Node<unknown>, renderDropIndicator: (target: ItemDropTarget) => ReactNode): ReactNode {\n let key = node.key;\n let keyAfter = collection.getKeyAfter(key);\n let nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;\n while (nextItemInFlattenedCollection != null && nextItemInFlattenedCollection.type !== 'item') {\n keyAfter = collection.getKeyAfter(nextItemInFlattenedCollection.key);\n nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;\n }\n\n let nextItemInSameLevel = node.nextKey != null ? collection.getItem(node.nextKey) : null;\n while (nextItemInSameLevel != null && nextItemInSameLevel.type !== 'item') {\n nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;\n }\n\n // Render one or more \"after\" drop indicators when the next item in the flattened collection\n // has a smaller level, is not an item, or there are no more items in the collection.\n // Otherwise, the \"after\" position is equivalent to the next item's \"before\" position.\n let afterIndicators: ReactNode[] = [];\n if (nextItemInSameLevel == null) {\n let current: Node<unknown> | null = node;\n while (current && (!nextItemInFlattenedCollection || (current.parentKey !== nextItemInFlattenedCollection.parentKey && nextItemInFlattenedCollection.level < current.level))) {\n let indicator = renderDropIndicator({\n type: 'item',\n key: current.key,\n dropPosition: 'after'\n });\n if (isValidElement(indicator)) {\n afterIndicators.push(cloneElement(indicator, {key: `${current.key}-after`}));\n }\n current = current.parentKey != null ? collection.getItem(current.parentKey) : null;\n }\n }\n\n return afterIndicators;\n}\n\nexport const CollectionRendererContext = createContext<CollectionRenderer>(DefaultCollectionRenderer);\n\ntype PersistedKeysReturnValue = Set<Key> | null;\nexport function usePersistedKeys(focusedKey: Key | null): PersistedKeysReturnValue {\n return useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n}\n"],"names":[],"version":3,"file":"Collection.module.js.map"}
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAyFM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA8B;AAGjE,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,4BAAoB,EAAE,WAAW,CAAmB,OAAwB,KAAgC;IAC/I,IAAI,QAAC,IAAI,UAAE,MAAM,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAChC,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CAAC,CAAC,qCAAqC,EAAE,KAAK,UAAU,CAAC;IAEvE,OAAO,OAAO,OAAO,KAAK,SAAS;AACrC;AAmCO,MAAM,4CAAgD;IAC3D,gBAAe,cAAC,UAAU,uBAAE,mBAAmB,EAAC;QAC9C,OAAO,0CAAoB,YAAY,MAAM;IAC/C;IACA,kBAAiB,cAAC,UAAU,UAAE,MAAM,uBAAE,mBAAmB,EAAC;QACxD,OAAO,0CAAoB,YAAY,QAAQ;IACjD;AACF;AAEA,SAAS,0CACP,UAAsC,EACtC,MAA4B,EAC5B,mBAA2D;IAE3D,OAAO,CAAA,GAAA,wBAAgB,EAAE;QACvB,OAAO,SAAS,WAAW,WAAW,CAAE,OAAO,GAAG,IAAI;QACtD,cAAc;YAAC;SAAoB;QACnC,UAAS,IAAI;YACX,IAAI,WAAW,KAAK,MAAM,CAAE;YAC5B,IAAI,CAAC,uBAAuB,KAAK,IAAI,KAAK,QACxC,OAAO;YAGT,qBACE,kEACG,oBAAoB;gBAAC,MAAM;gBAAQ,KAAK,KAAK,GAAG;gBAAE,cAAc;YAAQ,IACxE,UACA,0CAA0B,YAAY,MAAM;QAGnD;IACF;AACF;AAEO,SAAS,0CAA0B,UAAsC,EAAE,IAAmB,EAAE,mBAA0D;IAC/J,IAAI,MAAM,KAAK,GAA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-aria-components/src/Collection.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {CollectionBase, DropTargetDelegate, GlobalDOMAttributes, ItemDropTarget, Key, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {createBranchComponent, useCachedChildren} from '@react-aria/collections';\nimport {Collection as ICollection, Node, SelectionBehavior, SelectionMode, SectionProps as SharedSectionProps} from 'react-stately';\nimport React, {cloneElement, createContext, ForwardedRef, HTMLAttributes, isValidElement, JSX, ReactElement, ReactNode, useContext, useMemo} from 'react';\nimport {StyleProps} from './utils';\n\nexport interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'> {\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: ReadonlyArray<any>\n}\n\nexport interface ItemRenderProps {\n /**\n * Whether the item is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the item is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the item is currently selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the item is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the item is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /** The selection behavior for the collection. */\n selectionBehavior: SelectionBehavior,\n /**\n * Whether the item allows dragging.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-allows-dragging]\n */\n allowsDragging?: boolean,\n /**\n * Whether the item is currently being dragged.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-dragging]\n */\n isDragging?: boolean,\n /**\n * Whether the item is currently an active drop target.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-drop-target]\n */\n isDropTarget?: boolean\n}\n\nexport interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children' | 'title'>, StyleProps, GlobalDOMAttributes<HTMLElement> {\n /** The unique id of the section. */\n id?: Key,\n /** The object value that this section represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** Static child items or a function to render children. */\n children?: ReactNode | ((item: T) => ReactElement),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: ReadonlyArray<any>\n}\n\ninterface SectionContextValue {\n name: string,\n render: (props: SectionProps<any>, ref: ForwardedRef<HTMLElement>, section: Node<any>, className?: string) => ReactElement\n}\n\nexport const SectionContext = createContext<SectionContextValue | null>(null);\n\n/** @deprecated */\nexport const Section = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: SectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>): JSX.Element => {\n let {name, render} = useContext(SectionContext)!;\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`<Section> is deprecated. Please use <${name}> instead.`);\n }\n return render(props, ref, section, 'react-aria-Section');\n});\n\nexport interface CollectionBranchProps {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** The parent node of the items to render. */\n parent: Node<unknown>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRootProps extends HTMLAttributes<HTMLElement> {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** A set of keys for items that should always be persisted in the DOM. */\n persistedKeys?: Set<Key> | null,\n /** A ref to the scroll container for the collection. */\n scrollRef?: RefObject<HTMLElement | null>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRenderer {\n /** Whether this is a virtualized collection. */\n isVirtualized?: boolean,\n /** A delegate object that provides layout information for items in the collection. */\n layoutDelegate?: LayoutDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate?: DropTargetDelegate,\n /** A component that renders the root collection items. */\n CollectionRoot: React.ComponentType<CollectionRootProps>,\n /** A component that renders the child collection items. */\n CollectionBranch: React.ComponentType<CollectionBranchProps>\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection, renderDropIndicator}) {\n return useCollectionRender(collection, null, renderDropIndicator);\n },\n CollectionBranch({collection, parent, renderDropIndicator}) {\n return useCollectionRender(collection, parent, renderDropIndicator);\n }\n};\n\nfunction useCollectionRender(\n collection: ICollection<Node<unknown>>,\n parent: Node<unknown> | null,\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n) {\n return useCachedChildren({\n items: parent ? collection.getChildren!(parent.key) : collection,\n dependencies: [renderDropIndicator],\n children(node) {\n let rendered = node.render!(node);\n if (!renderDropIndicator || node.type !== 'item') {\n return rendered;\n }\n\n return (\n <>\n {renderDropIndicator({type: 'item', key: node.key, dropPosition: 'before'})}\n {rendered}\n {renderAfterDropIndicators(collection, node, renderDropIndicator)}\n </>\n );\n }\n });\n}\n\nexport function renderAfterDropIndicators(collection: ICollection<Node<unknown>>, node: Node<unknown>, renderDropIndicator: (target: ItemDropTarget) => ReactNode): ReactNode {\n let key = node.key;\n let keyAfter = collection.getKeyAfter(key);\n let nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;\n while (nextItemInFlattenedCollection != null && nextItemInFlattenedCollection.type !== 'item') {\n keyAfter = collection.getKeyAfter(nextItemInFlattenedCollection.key);\n nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;\n }\n\n let nextItemInSameLevel = node.nextKey != null ? collection.getItem(node.nextKey) : null;\n while (nextItemInSameLevel != null && nextItemInSameLevel.type !== 'item') {\n nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;\n }\n\n // Render one or more \"after\" drop indicators when the next item in the flattened collection\n // has a smaller level, is not an item, or there are no more items in the collection.\n // Otherwise, the \"after\" position is equivalent to the next item's \"before\" position.\n let afterIndicators: ReactNode[] = [];\n if (nextItemInSameLevel == null) {\n let current: Node<unknown> | null = node;\n while (current && (!nextItemInFlattenedCollection || (current.parentKey !== nextItemInFlattenedCollection.parentKey && nextItemInFlattenedCollection.level < current.level))) {\n let indicator = renderDropIndicator({\n type: 'item',\n key: current.key,\n dropPosition: 'after'\n });\n if (isValidElement(indicator)) {\n afterIndicators.push(cloneElement(indicator, {key: `${current.key}-after`}));\n }\n current = current.parentKey != null ? collection.getItem(current.parentKey) : null;\n }\n }\n\n return afterIndicators;\n}\n\nexport const CollectionRendererContext = createContext<CollectionRenderer>(DefaultCollectionRenderer);\n\ntype PersistedKeysReturnValue = Set<Key> | null;\nexport function usePersistedKeys(focusedKey: Key | null): PersistedKeysReturnValue {\n return useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n}\n"],"names":[],"version":3,"file":"Collection.module.js.map"}
|
package/dist/ColorArea.main.js
CHANGED
|
@@ -45,13 +45,13 @@ const $4b8ff932b8d77df7$export$b2103f68a961418e = /*#__PURE__*/ (0, $hLuah$react
|
|
|
45
45
|
isDisabled: props.isDisabled || false
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
let DOMProps = (0, $hLuah$reactariautils.filterDOMProps)(props
|
|
48
|
+
let DOMProps = (0, $hLuah$reactariautils.filterDOMProps)(props, {
|
|
49
|
+
global: true
|
|
50
|
+
});
|
|
49
51
|
delete DOMProps.id;
|
|
50
52
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($hLuah$react))).createElement("div", {
|
|
51
53
|
ref: ref,
|
|
52
|
-
...colorAreaProps,
|
|
53
|
-
...DOMProps,
|
|
54
|
-
...renderProps,
|
|
54
|
+
...(0, $hLuah$reactariautils.mergeProps)(DOMProps, colorAreaProps, renderProps),
|
|
55
55
|
slot: props.slot || undefined,
|
|
56
56
|
"data-disabled": props.isDisabled || undefined
|
|
57
57
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($hLuah$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,yDAAwB,CAAA,GAAA,0BAAY,EAAyB;AAKnE,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE,SAAS,UAAU,KAAqB,EAAE,GAAiC;IAC7G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK,CAAA,GAAA,0CAAe;IAC1D,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IAEvB,IAAI,QAAQ,CAAA,GAAA,qCAAgB,EAAE;IAC9B,IAAI,kBACF,cAAc,eACd,WAAW,eACX,WAAW,cACX,UAAU,EACX,GAAG,CAAA,GAAA,6BAAW,EAAE;QACf,GAAG,KAAK;mBACR;mBACA;QACA,cAAc;IAChB,GAAG;IAEH,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,cAAc,eAAe,KAAK;QAClC,QAAQ;mBACN;YACA,YAAY,MAAM,UAAU,IAAI;QAClC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAElB,qBACE,0DAAC;QACC,KAAK;QACJ,GAAG,CAAA,GAAA,gCAAS,EAAE,UAAU,gBAAgB,YAAY;QACrD,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;qBACnC,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC;gBAAuB;aAAM;YAC9B;gBAAC,CAAA,GAAA,mDAAwB;gBAAG;2BAAC;gCAAO;+BAAY;iCAAW;+BAAa;iCAAW;oBAAa,YAAY,MAAM,UAAU;gBAAA;aAAE;SAC/H;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/ColorArea.tsx"],"sourcesContent":["import {AriaColorAreaProps, useColorArea} from 'react-aria';\nimport {ColorAreaContext} from './RSPContexts';\nimport {ColorAreaState, useColorAreaState} from 'react-stately';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {InternalColorThumbContext} from './ColorThumb';\nimport {Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\n\nexport interface ColorAreaRenderProps {\n /**\n * Whether the color area is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * State of the color area.\n */\n state: ColorAreaState\n}\n\nexport interface ColorAreaProps extends AriaColorAreaProps, RenderProps<ColorAreaRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\n\nexport const ColorAreaStateContext = createContext<ColorAreaState | null>(null);\n\n/**\n * A color area allows users to adjust two channels of an RGB, HSL or HSB color value against a two-dimensional gradient background.\n */\nexport const ColorArea = forwardRef(function ColorArea(props: ColorAreaProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ColorAreaContext);\n let inputXRef = useRef(null);\n let inputYRef = useRef(null);\n\n let state = useColorAreaState(props);\n let {\n colorAreaProps,\n xInputProps,\n yInputProps,\n thumbProps\n } = useColorArea({\n ...props,\n inputXRef,\n inputYRef,\n containerRef: ref\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ColorArea',\n defaultStyle: colorAreaProps.style,\n values: {\n state,\n isDisabled: props.isDisabled || false\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <div\n ref={ref}\n {...mergeProps(DOMProps, colorAreaProps, renderProps)}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [ColorAreaStateContext, state],\n [InternalColorThumbContext, {state, thumbProps, inputXRef, xInputProps, inputYRef, yInputProps, isDisabled: props.isDisabled}]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ColorArea.main.js.map"}
|
package/dist/ColorArea.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {InternalColorThumbContext as $e2b71ec1d6016406$export$c80c0ea2ca5cb846}
|
|
|
3
3
|
import {Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
|
|
4
4
|
import {useColorArea as $xv8AM$useColorArea} from "react-aria";
|
|
5
5
|
import {useColorAreaState as $xv8AM$useColorAreaState} from "react-stately";
|
|
6
|
-
import {filterDOMProps as $xv8AM$filterDOMProps} from "@react-aria/utils";
|
|
6
|
+
import {filterDOMProps as $xv8AM$filterDOMProps, mergeProps as $xv8AM$mergeProps} from "@react-aria/utils";
|
|
7
7
|
import $xv8AM$react, {createContext as $xv8AM$createContext, forwardRef as $xv8AM$forwardRef, useRef as $xv8AM$useRef} from "react";
|
|
8
8
|
|
|
9
9
|
|
|
@@ -34,13 +34,13 @@ const $0de070065d44825d$export$b2103f68a961418e = /*#__PURE__*/ (0, $xv8AM$forwa
|
|
|
34
34
|
isDisabled: props.isDisabled || false
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
let DOMProps = (0, $xv8AM$filterDOMProps)(props
|
|
37
|
+
let DOMProps = (0, $xv8AM$filterDOMProps)(props, {
|
|
38
|
+
global: true
|
|
39
|
+
});
|
|
38
40
|
delete DOMProps.id;
|
|
39
41
|
return /*#__PURE__*/ (0, $xv8AM$react).createElement("div", {
|
|
40
42
|
ref: ref,
|
|
41
|
-
...colorAreaProps,
|
|
42
|
-
...DOMProps,
|
|
43
|
-
...renderProps,
|
|
43
|
+
...(0, $xv8AM$mergeProps)(DOMProps, colorAreaProps, renderProps),
|
|
44
44
|
slot: props.slot || undefined,
|
|
45
45
|
"data-disabled": props.isDisabled || undefined
|
|
46
46
|
}, /*#__PURE__*/ (0, $xv8AM$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
|
package/dist/ColorArea.module.js
CHANGED
|
@@ -3,7 +3,7 @@ import {InternalColorThumbContext as $e2b71ec1d6016406$export$c80c0ea2ca5cb846}
|
|
|
3
3
|
import {Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.module.js";
|
|
4
4
|
import {useColorArea as $xv8AM$useColorArea} from "react-aria";
|
|
5
5
|
import {useColorAreaState as $xv8AM$useColorAreaState} from "react-stately";
|
|
6
|
-
import {filterDOMProps as $xv8AM$filterDOMProps} from "@react-aria/utils";
|
|
6
|
+
import {filterDOMProps as $xv8AM$filterDOMProps, mergeProps as $xv8AM$mergeProps} from "@react-aria/utils";
|
|
7
7
|
import $xv8AM$react, {createContext as $xv8AM$createContext, forwardRef as $xv8AM$forwardRef, useRef as $xv8AM$useRef} from "react";
|
|
8
8
|
|
|
9
9
|
|
|
@@ -34,13 +34,13 @@ const $0de070065d44825d$export$b2103f68a961418e = /*#__PURE__*/ (0, $xv8AM$forwa
|
|
|
34
34
|
isDisabled: props.isDisabled || false
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
let DOMProps = (0, $xv8AM$filterDOMProps)(props
|
|
37
|
+
let DOMProps = (0, $xv8AM$filterDOMProps)(props, {
|
|
38
|
+
global: true
|
|
39
|
+
});
|
|
38
40
|
delete DOMProps.id;
|
|
39
41
|
return /*#__PURE__*/ (0, $xv8AM$react).createElement("div", {
|
|
40
42
|
ref: ref,
|
|
41
|
-
...colorAreaProps,
|
|
42
|
-
...DOMProps,
|
|
43
|
-
...renderProps,
|
|
43
|
+
...(0, $xv8AM$mergeProps)(DOMProps, colorAreaProps, renderProps),
|
|
44
44
|
slot: props.slot || undefined,
|
|
45
45
|
"data-disabled": props.isDisabled || undefined
|
|
46
46
|
}, /*#__PURE__*/ (0, $xv8AM$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAuBO,MAAM,yDAAwB,CAAA,GAAA,oBAAY,EAAyB;AAKnE,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE,SAAS,UAAU,KAAqB,EAAE,GAAiC;IAC7G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK,CAAA,GAAA,yCAAe;IAC1D,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IAEvB,IAAI,QAAQ,CAAA,GAAA,wBAAgB,EAAE;IAC9B,IAAI,kBACF,cAAc,eACd,WAAW,eACX,WAAW,cACX,UAAU,EACX,GAAG,CAAA,GAAA,mBAAW,EAAE;QACf,GAAG,KAAK;mBACR;mBACA;QACA,cAAc;IAChB,GAAG;IAEH,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,cAAc,eAAe,KAAK;QAClC,QAAQ;mBACN;YACA,YAAY,MAAM,UAAU,IAAI;QAClC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAElB,qBACE,gCAAC;QACC,KAAK;QACJ,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,gBAAgB,YAAY;QACrD,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;qBACnC,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAAuB;aAAM;YAC9B;gBAAC,CAAA,GAAA,yCAAwB;gBAAG;2BAAC;gCAAO;+BAAY;iCAAW;+BAAa;iCAAW;oBAAa,YAAY,MAAM,UAAU;gBAAA;aAAE;SAC/H;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/ColorArea.tsx"],"sourcesContent":["import {AriaColorAreaProps, useColorArea} from 'react-aria';\nimport {ColorAreaContext} from './RSPContexts';\nimport {ColorAreaState, useColorAreaState} from 'react-stately';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {InternalColorThumbContext} from './ColorThumb';\nimport {Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\n\nexport interface ColorAreaRenderProps {\n /**\n * Whether the color area is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * State of the color area.\n */\n state: ColorAreaState\n}\n\nexport interface ColorAreaProps extends AriaColorAreaProps, RenderProps<ColorAreaRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\n\nexport const ColorAreaStateContext = createContext<ColorAreaState | null>(null);\n\n/**\n * A color area allows users to adjust two channels of an RGB, HSL or HSB color value against a two-dimensional gradient background.\n */\nexport const ColorArea = forwardRef(function ColorArea(props: ColorAreaProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ColorAreaContext);\n let inputXRef = useRef(null);\n let inputYRef = useRef(null);\n\n let state = useColorAreaState(props);\n let {\n colorAreaProps,\n xInputProps,\n yInputProps,\n thumbProps\n } = useColorArea({\n ...props,\n inputXRef,\n inputYRef,\n containerRef: ref\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ColorArea',\n defaultStyle: colorAreaProps.style,\n values: {\n state,\n isDisabled: props.isDisabled || false\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <div\n ref={ref}\n {...mergeProps(DOMProps, colorAreaProps, renderProps)}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [ColorAreaStateContext, state],\n [InternalColorThumbContext, {state, thumbProps, inputXRef, xInputProps, inputYRef, yInputProps, isDisabled: props.isDisabled}]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ColorArea.module.js.map"}
|
package/dist/ColorField.main.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var $525402dfec7da5bc$exports = require("./RSPContexts.main.js");
|
|
2
2
|
var $846a838139f2ac6b$exports = require("./FieldError.main.js");
|
|
3
|
+
var $dcae72abc18c0045$exports = require("./Group.main.js");
|
|
3
4
|
var $1bcfcef5af644e13$exports = require("./Input.main.js");
|
|
4
5
|
var $84ae0bf5bd8e2a5f$exports = require("./Label.main.js");
|
|
5
6
|
var $c5ccf687772c0422$exports = require("./utils.main.js");
|
|
@@ -40,6 +41,7 @@ $parcel$export(module.exports, "ColorField", () => $266025a3ea7f6c3b$export$b865
|
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
|
|
44
|
+
|
|
43
45
|
const $266025a3ea7f6c3b$export$96b6d32b05a1a8ed = /*#__PURE__*/ (0, $jBBea$react.createContext)(null);
|
|
44
46
|
const $266025a3ea7f6c3b$export$b865d4358897bb17 = /*#__PURE__*/ (0, $jBBea$react.forwardRef)(function ColorField(props, ref) {
|
|
45
47
|
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, (0, $525402dfec7da5bc$exports.ColorFieldContext));
|
|
@@ -70,6 +72,7 @@ function $266025a3ea7f6c3b$var$ColorChannelField(props) {
|
|
|
70
72
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($jBBea$react))).createElement((0, ($parcel$interopDefault($jBBea$react))).Fragment, null, $266025a3ea7f6c3b$var$useChildren(props, state, props.forwardedRef, inputProps, inputRef, labelProps, labelRef, descriptionProps, errorMessageProps, validation), props.name && /*#__PURE__*/ (0, ($parcel$interopDefault($jBBea$react))).createElement("input", {
|
|
71
73
|
type: "hidden",
|
|
72
74
|
name: props.name,
|
|
75
|
+
form: props.form,
|
|
73
76
|
value: isNaN(state.numberValue) ? '' : state.numberValue
|
|
74
77
|
}));
|
|
75
78
|
}
|
|
@@ -100,7 +103,9 @@ function $266025a3ea7f6c3b$var$useChildren(props, state, ref, inputProps, inputR
|
|
|
100
103
|
},
|
|
101
104
|
defaultClassName: 'react-aria-ColorField'
|
|
102
105
|
});
|
|
103
|
-
let DOMProps = (0, $jBBea$reactariautils.filterDOMProps)(props
|
|
106
|
+
let DOMProps = (0, $jBBea$reactariautils.filterDOMProps)(props, {
|
|
107
|
+
global: true
|
|
108
|
+
});
|
|
104
109
|
delete DOMProps.id;
|
|
105
110
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($jBBea$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
|
|
106
111
|
values: [
|
|
@@ -122,6 +127,14 @@ function $266025a3ea7f6c3b$var$useChildren(props, state, ref, inputProps, inputR
|
|
|
122
127
|
ref: labelRef
|
|
123
128
|
}
|
|
124
129
|
],
|
|
130
|
+
[
|
|
131
|
+
(0, $dcae72abc18c0045$exports.GroupContext),
|
|
132
|
+
{
|
|
133
|
+
role: 'presentation',
|
|
134
|
+
isInvalid: validation.isInvalid,
|
|
135
|
+
isDisabled: props.isDisabled || false
|
|
136
|
+
}
|
|
137
|
+
],
|
|
125
138
|
[
|
|
126
139
|
(0, $a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E;IAElB,qBACE,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC;gBAAwB;aAAM;YAC/B;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,MAAM;oBAAgB,WAAW,WAAW,SAAS;oBAAE,YAAY,MAAM,UAAU,IAAI;gBAAK;aAAE;YAC9G;gBAAC,CAAA,GAAA,qCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,2CAAgB;gBAAG;aAAW;SAChC;qBACD,0DAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,gBAAc,MAAM,OAAO,IAAI;QAC/B,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;;AAG9C","sources":["packages/react-aria-components/src/ColorField.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {AriaColorFieldProps, useColorChannelField, useColorField, useLocale} from 'react-aria';\nimport {ColorChannel, ColorFieldState, ColorSpace, useColorChannelFieldState, useColorFieldState} from 'react-stately';\nimport {ColorFieldContext} from './RSPContexts';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {GlobalDOMAttributes, InputDOMProps, ValidationResult} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, Ref, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface ColorFieldRenderProps {\n /**\n * Whether the color field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the color field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * The color channel that this field edits, or \"hex\" if no `channel` prop is set.\n * @selector [data-channel=\"hex | hue | saturation | ...\"]\n */\n channel: ColorChannel | 'hex',\n /**\n * State of the color field.\n */\n state: ColorFieldState\n}\n\nexport interface ColorFieldProps extends Omit<AriaColorFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, InputDOMProps, RenderProps<ColorFieldRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The color channel that this field edits. If not provided, \n * the color is edited as a hex value.\n */\n channel?: ColorChannel,\n /**\n * The color space that the color field operates in if a `channel` prop is provided.\n * If no `channel` is provided, the color field always displays the color as an RGB hex value.\n */\n colorSpace?: ColorSpace\n}\n\nexport const ColorFieldStateContext = createContext<ColorFieldState | null>(null);\n\n/**\n * A color field allows users to edit a hex color or individual color channel value.\n */\nexport const ColorField = forwardRef(function ColorField(props: ColorFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ColorFieldContext);\n if (props.channel) {\n return <ColorChannelField {...props} channel={props.channel} forwardedRef={ref} />;\n } else {\n return <HexColorField {...props} forwardedRef={ref} />;\n }\n});\n\ninterface ColorChannelFieldProps extends Omit<ColorFieldProps, 'channel'> {\n channel: ColorChannel,\n forwardedRef: ForwardedRef<HTMLDivElement>\n}\n\nfunction ColorChannelField(props: ColorChannelFieldProps) {\n let {locale} = useLocale();\n let state = useColorChannelFieldState({\n ...props,\n locale\n });\n\n let inputRef = useRef<HTMLInputElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useColorChannelField({\n ...removeDataAttributes(props),\n label,\n validationBehavior: props.validationBehavior ?? 'native'\n }, state, inputRef);\n\n return (\n <>\n {useChildren(\n props,\n state,\n props.forwardedRef,\n inputProps,\n inputRef,\n labelProps,\n labelRef,\n descriptionProps,\n errorMessageProps,\n validation\n )}\n {props.name && <input type=\"hidden\" name={props.name} form={props.form} value={isNaN(state.numberValue) ? '' : state.numberValue} />}\n </>\n );\n}\n\ninterface HexColorFieldProps extends ColorFieldProps {\n forwardedRef: ForwardedRef<HTMLDivElement>\n}\n\nfunction HexColorField(props: HexColorFieldProps) {\n let state = useColorFieldState({\n ...props,\n validationBehavior: props.validationBehavior ?? 'native'\n });\n\n let inputRef = useRef<HTMLInputElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useColorField({\n ...removeDataAttributes(props),\n label,\n validationBehavior: props.validationBehavior ?? 'native'\n }, state, inputRef);\n\n return useChildren(\n props,\n state,\n props.forwardedRef,\n inputProps,\n inputRef,\n labelProps,\n labelRef,\n descriptionProps,\n errorMessageProps,\n validation\n );\n}\n\nfunction useChildren(\n props: ColorFieldProps,\n state: ColorFieldState,\n ref: ForwardedRef<HTMLDivElement>,\n inputProps: InputHTMLAttributes<HTMLElement>,\n inputRef: Ref<HTMLInputElement>,\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n labelRef: Ref<HTMLLabelElement>,\n descriptionProps: HTMLAttributes<HTMLElement>,\n errorMessageProps: HTMLAttributes<HTMLElement>,\n validation: ValidationResult\n) {\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n channel: props.channel || 'hex',\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false\n },\n defaultClassName: 'react-aria-ColorField'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [ColorFieldStateContext, state],\n [InputContext, {...inputProps, ref: inputRef}],\n [LabelContext, {...labelProps, ref: labelRef}],\n [GroupContext, {role: 'presentation', isInvalid: validation.isInvalid, isDisabled: props.isDisabled || false}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-channel={props.channel || 'hex'}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined} />\n </Provider>\n );\n}\n"],"names":[],"version":3,"file":"ColorField.main.js.map"}
|
package/dist/ColorField.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {ColorFieldContext as $4e85f108e88277b8$export$44644b8a16031b5b} from "./RSPContexts.mjs";
|
|
2
2
|
import {FieldErrorContext as $ee014567cb39d3f0$export$ff05c3ac10437e03} from "./FieldError.mjs";
|
|
3
|
+
import {GroupContext as $a049562f99e7db0e$export$f9c6924e160136d1} from "./Group.mjs";
|
|
3
4
|
import {InputContext as $3985021b0ad6602f$export$37fb8590cf2c088c} from "./Input.mjs";
|
|
4
5
|
import {LabelContext as $01b77f81d0f07f68$export$75b6ee27786ba447} from "./Label.mjs";
|
|
5
6
|
import {Provider as $64fa3d84918910a7$export$2881499e37b75b9a, removeDataAttributes as $64fa3d84918910a7$export$ef03459518577ad4, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3, useSlot as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8} from "./utils.mjs";
|
|
@@ -29,6 +30,7 @@ import $kjuGe$react, {createContext as $kjuGe$createContext, forwardRef as $kjuG
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
|
|
33
|
+
|
|
32
34
|
const $3ada01a82feafb94$export$96b6d32b05a1a8ed = /*#__PURE__*/ (0, $kjuGe$createContext)(null);
|
|
33
35
|
const $3ada01a82feafb94$export$b865d4358897bb17 = /*#__PURE__*/ (0, $kjuGe$forwardRef)(function ColorField(props, ref) {
|
|
34
36
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, (0, $4e85f108e88277b8$export$44644b8a16031b5b));
|
|
@@ -59,6 +61,7 @@ function $3ada01a82feafb94$var$ColorChannelField(props) {
|
|
|
59
61
|
return /*#__PURE__*/ (0, $kjuGe$react).createElement((0, $kjuGe$react).Fragment, null, $3ada01a82feafb94$var$useChildren(props, state, props.forwardedRef, inputProps, inputRef, labelProps, labelRef, descriptionProps, errorMessageProps, validation), props.name && /*#__PURE__*/ (0, $kjuGe$react).createElement("input", {
|
|
60
62
|
type: "hidden",
|
|
61
63
|
name: props.name,
|
|
64
|
+
form: props.form,
|
|
62
65
|
value: isNaN(state.numberValue) ? '' : state.numberValue
|
|
63
66
|
}));
|
|
64
67
|
}
|
|
@@ -89,7 +92,9 @@ function $3ada01a82feafb94$var$useChildren(props, state, ref, inputProps, inputR
|
|
|
89
92
|
},
|
|
90
93
|
defaultClassName: 'react-aria-ColorField'
|
|
91
94
|
});
|
|
92
|
-
let DOMProps = (0, $kjuGe$filterDOMProps)(props
|
|
95
|
+
let DOMProps = (0, $kjuGe$filterDOMProps)(props, {
|
|
96
|
+
global: true
|
|
97
|
+
});
|
|
93
98
|
delete DOMProps.id;
|
|
94
99
|
return /*#__PURE__*/ (0, $kjuGe$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
|
|
95
100
|
values: [
|
|
@@ -111,6 +116,14 @@ function $3ada01a82feafb94$var$useChildren(props, state, ref, inputProps, inputR
|
|
|
111
116
|
ref: labelRef
|
|
112
117
|
}
|
|
113
118
|
],
|
|
119
|
+
[
|
|
120
|
+
(0, $a049562f99e7db0e$export$f9c6924e160136d1),
|
|
121
|
+
{
|
|
122
|
+
role: 'presentation',
|
|
123
|
+
isInvalid: validation.isInvalid,
|
|
124
|
+
isDisabled: props.isDisabled || false
|
|
125
|
+
}
|
|
126
|
+
],
|
|
114
127
|
[
|
|
115
128
|
(0, $514c0188e459b4c0$export$9afb8bc826b033ea),
|
|
116
129
|
{
|