react-aria-components 1.15.1 → 1.16.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/Button.main.js +3 -2
- package/dist/Button.main.js.map +1 -1
- package/dist/Button.mjs +3 -2
- package/dist/Button.module.js +3 -2
- package/dist/Button.module.js.map +1 -1
- package/dist/Collection.main.js +3 -0
- package/dist/Collection.main.js.map +1 -1
- package/dist/Collection.mjs +3 -0
- package/dist/Collection.module.js +3 -0
- package/dist/Collection.module.js.map +1 -1
- package/dist/ComboBox.main.js +59 -8
- package/dist/ComboBox.main.js.map +1 -1
- package/dist/ComboBox.mjs +61 -12
- package/dist/ComboBox.module.js +61 -12
- package/dist/ComboBox.module.js.map +1 -1
- package/dist/DateField.main.js +8 -4
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +8 -4
- package/dist/DateField.module.js +8 -4
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +6 -2
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +6 -2
- package/dist/DatePicker.module.js +6 -2
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/DropZone.main.js +1 -1
- package/dist/DropZone.main.js.map +1 -1
- package/dist/DropZone.mjs +2 -2
- package/dist/DropZone.module.js +2 -2
- package/dist/DropZone.module.js.map +1 -1
- package/dist/FileTrigger.main.js +1 -1
- package/dist/FileTrigger.main.js.map +1 -1
- package/dist/FileTrigger.mjs +2 -2
- package/dist/FileTrigger.module.js +2 -2
- package/dist/FileTrigger.module.js.map +1 -1
- package/dist/GridList.main.js +7 -4
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.mjs +7 -5
- package/dist/GridList.module.js +7 -5
- package/dist/GridList.module.js.map +1 -1
- package/dist/HiddenDateInput.main.js +3 -1
- package/dist/HiddenDateInput.main.js.map +1 -1
- package/dist/HiddenDateInput.mjs +3 -1
- package/dist/HiddenDateInput.module.js +3 -1
- package/dist/HiddenDateInput.module.js.map +1 -1
- package/dist/Keyboard.main.js.map +1 -1
- package/dist/Keyboard.module.js.map +1 -1
- package/dist/ListBox.main.js +2 -1
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +3 -2
- package/dist/ListBox.module.js +3 -2
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +3 -1
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +3 -1
- package/dist/Menu.module.js +3 -1
- package/dist/Menu.module.js.map +1 -1
- package/dist/Popover.main.js +1 -1
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +3 -3
- package/dist/Popover.module.js +3 -3
- package/dist/Popover.module.js.map +1 -1
- package/dist/Tree.main.js +151 -102
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +153 -106
- package/dist/Tree.module.js +153 -106
- package/dist/Tree.module.js.map +1 -1
- package/dist/import.mjs +3 -3
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js +3 -3
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +76 -22
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.module.js.map +1 -1
- package/package.json +23 -23
- package/src/Button.tsx +4 -2
- package/src/Collection.tsx +6 -0
- package/src/ComboBox.tsx +89 -12
- package/src/DateField.tsx +14 -5
- package/src/DatePicker.tsx +11 -2
- package/src/DropZone.tsx +2 -2
- package/src/FileTrigger.tsx +2 -2
- package/src/GridList.tsx +12 -3
- package/src/HiddenDateInput.tsx +2 -1
- package/src/Keyboard.tsx +2 -2
- package/src/ListBox.tsx +5 -4
- package/src/Menu.tsx +3 -2
- package/src/Popover.tsx +3 -3
- package/src/Tree.tsx +209 -146
- package/src/index.ts +4 -3
- package/src/utils.tsx +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;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E,KAAK;oBAAU,WAAW,MAAM,SAAS;gBAAA;aAAE;YAC1E;gBAAC,CAAA,GAAA,uCAAY;gBAAG;oBAAC,GAAG,WAAW;oBAAE,WAAW,MAAM,MAAM;gBAAA;aAAE;YAC1D;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;oBAAU,aAAa;gBAAM;aAAE;YACnE;gBAAC,CAAA,GAAA,8CAAmB;gBAAG;aAAc;YACrC;gBAAC,CAAA,GAAA,oDAAyB;gBAAG;aAAM;YACnC;gBAAC,CAAA,GAAA,wCAAa;gBAAG;oBACf,SAAS;oBACT,YAAY;oBACZ,WAAW;oBACX,OAAO;wBAAC,mBAAmB;oBAAU;oBACrC,eAAe;gBACjB;aAAE;YACF;gBAAC,CAAA,GAAA,uCAAY;gBAAG;aAAY;YAC5B;gBAAC,CAAA,GAAA,0CAAe;gBAAG;oBACjB,OAAO;wBACL,OAAO;wBACP,KAAK;oBACP;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,qCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,2CAAgB;gBAAG;aAAW;SAChC;qBACD,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,gCAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,qBAAmB,aAAa;QAChC,gBAAc,MAAM,SAAS,IAAI;QACjC,sBAAoB,kBAAkB;QACtC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,aAAW,MAAM,MAAM,IAAI;;AAGnC","sources":["packages/react-aria-components/src/DatePicker.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 {AriaDatePickerProps, AriaDateRangePickerProps, DateValue, useDatePicker, useDateRangePicker, useFocusRing} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {DatePickerState, DatePickerStateOptions, DateRangePickerState, DateRangePickerStateOptions, useDatePickerState, useDateRangePickerState} from 'react-stately';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeProps, useResizeObserver} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface DatePickerRenderProps {\n /**\n * Whether an element within the date picker is focused, either via a mouse or keyboard.\n * @selector [data-focus-within]\n */\n isFocusWithin: boolean,\n /**\n * Whether an element within the date picker is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the date picker is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the date picker is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the date picker is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the date picker's popover is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * State of the date picker.\n */\n state: DatePickerState\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n /**\n * State of the date range picker.\n */\n state: DateRangePickerState\n}\n\nexport interface DatePickerProps<T extends DateValue> extends Omit<AriaDatePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DatePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DatePicker'\n */\n className?: ClassNameOrFunction<DatePickerRenderProps>\n}\nexport interface DateRangePickerProps<T extends DateValue> extends Omit<AriaDateRangePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DateRangePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DateRangePicker'\n */\n className?: ClassNameOrFunction<DateRangePickerRenderProps>\n}\n\nexport const DatePickerContext = createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext = createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<T extends DateValue>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DatePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDatePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n fieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDatePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false\n },\n defaultClassName: 'react-aria-DatePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DatePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [DateFieldContext, fieldProps],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [CalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DatePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-open={state.isOpen || undefined} />\n <HiddenDateInput\n autoComplete={props.autoComplete}\n name={props.name}\n isDisabled={props.isDisabled}\n state={state} />\n </Provider>\n );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DateRangePicker<T extends DateValue>(props: DateRangePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDateRangePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n startFieldProps,\n endFieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDateRangePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false\n },\n defaultClassName: 'react-aria-DateRangePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DateRangePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [RangeCalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DateRangePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [DateFieldContext, {\n slots: {\n start: startFieldProps,\n end: endFieldProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-open={state.isOpen || undefined} />\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DatePicker.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;AA+FM,MAAM,0DAAoB,CAAA,GAAA,0BAAY,EAAsD;AAC5F,MAAM,yDAAyB,CAAA,GAAA,0BAAY,EAA2D;AACtG,MAAM,0DAAyB,CAAA,GAAA,0BAAY,EAA0B;AACrE,MAAM,0DAA8B,CAAA,GAAA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C,GAAG,WAAW;oBAAE,WAAW,MAAM,MAAM;gBAAA;aAAE;YAC1D;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;oBAAU,aAAa;gBAAM;aAAE;YACnE;gBAAC,CAAA,GAAA,8CAAmB;gBAAG;aAAc;YACrC;gBAAC,CAAA,GAAA,oDAAyB;gBAAG;aAAM;YACnC;gBAAC,CAAA,GAAA,wCAAa;gBAAG;oBACf,SAAS;oBACT,YAAY;oBACZ,WAAW;oBACX,OAAO;wBAAC,mBAAmB;oBAAU;oBACrC,eAAe;gBACjB;aAAE;YACF;gBAAC,CAAA,GAAA,uCAAY;gBAAG;aAAY;YAC5B;gBAAC,CAAA,GAAA,0CAAe;gBAAG;oBACjB,OAAO;wBACL,OAAO;wBACP,KAAK;oBACP;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,qCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,2CAAgB;gBAAG;aAAW;SAChC;qBACD,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,gCAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,qBAAmB,aAAa;QAChC,gBAAc,MAAM,SAAS,IAAI;QACjC,sBAAoB,kBAAkB;QACtC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,aAAW,MAAM,MAAM,IAAI;;AAGnC","sources":["packages/react-aria-components/src/DatePicker.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 {AriaDatePickerProps, AriaDateRangePickerProps, DateValue, useDatePicker, useDateRangePicker, useFocusRing} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {DatePickerState, DatePickerStateOptions, DateRangePickerState, DateRangePickerStateOptions, useDatePickerState, useDateRangePickerState} from 'react-stately';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeProps, useResizeObserver} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface DatePickerRenderProps {\n /**\n * Whether an element within the date picker is focused, either via a mouse or keyboard.\n * @selector [data-focus-within]\n */\n isFocusWithin: boolean,\n /**\n * Whether an element within the date picker is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the date picker is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the date picker is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the date picker is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the date picker is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the date picker's popover is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * State of the date picker.\n */\n state: DatePickerState\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n /**\n * State of the date range picker.\n */\n state: DateRangePickerState\n}\n\nexport interface DatePickerProps<T extends DateValue> extends Omit<AriaDatePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DatePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DatePicker'\n */\n className?: ClassNameOrFunction<DatePickerRenderProps>\n}\nexport interface DateRangePickerProps<T extends DateValue> extends Omit<AriaDateRangePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DateRangePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DateRangePicker'\n */\n className?: ClassNameOrFunction<DateRangePickerRenderProps>\n}\n\nexport const DatePickerContext = createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext = createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<T extends DateValue>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DatePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDatePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n fieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDatePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DatePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DatePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [DateFieldContext, fieldProps],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [CalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DatePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined} />\n <HiddenDateInput\n autoComplete={props.autoComplete}\n name={props.name}\n isDisabled={props.isDisabled}\n state={state} />\n </Provider>\n );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DateRangePicker<T extends DateValue>(props: DateRangePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDateRangePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n startFieldProps,\n endFieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDateRangePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DateRangePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DateRangePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [RangeCalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DateRangePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [DateFieldContext, {\n slots: {\n start: startFieldProps,\n end: endFieldProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined} />\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DatePicker.main.js.map"}
|
package/dist/DatePicker.mjs
CHANGED
|
@@ -89,7 +89,8 @@ const $06d5b8ec9ee5d538$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $8nhma$forwa
|
|
|
89
89
|
isDisabled: props.isDisabled || false,
|
|
90
90
|
isInvalid: state.isInvalid,
|
|
91
91
|
isOpen: state.isOpen,
|
|
92
|
-
isReadOnly: props.isReadOnly || false
|
|
92
|
+
isReadOnly: props.isReadOnly || false,
|
|
93
|
+
isRequired: props.isRequired || false
|
|
93
94
|
},
|
|
94
95
|
defaultClassName: 'react-aria-DatePicker'
|
|
95
96
|
});
|
|
@@ -177,6 +178,7 @@ const $06d5b8ec9ee5d538$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $8nhma$forwa
|
|
|
177
178
|
"data-focus-visible": isFocusVisible || undefined,
|
|
178
179
|
"data-disabled": props.isDisabled || undefined,
|
|
179
180
|
"data-readonly": props.isReadOnly || undefined,
|
|
181
|
+
"data-required": props.isRequired || undefined,
|
|
180
182
|
"data-open": state.isOpen || undefined
|
|
181
183
|
}), /*#__PURE__*/ (0, $8nhma$react).createElement((0, $c699643d2073b351$export$eefa3e19139f00f3), {
|
|
182
184
|
autoComplete: props.autoComplete,
|
|
@@ -222,7 +224,8 @@ const $06d5b8ec9ee5d538$export$17334619f3ac2224 = /*#__PURE__*/ (0, $8nhma$forwa
|
|
|
222
224
|
isDisabled: props.isDisabled || false,
|
|
223
225
|
isInvalid: state.isInvalid,
|
|
224
226
|
isOpen: state.isOpen,
|
|
225
|
-
isReadOnly: props.isReadOnly || false
|
|
227
|
+
isReadOnly: props.isReadOnly || false,
|
|
228
|
+
isRequired: props.isRequired || false
|
|
226
229
|
},
|
|
227
230
|
defaultClassName: 'react-aria-DateRangePicker'
|
|
228
231
|
});
|
|
@@ -315,6 +318,7 @@ const $06d5b8ec9ee5d538$export$17334619f3ac2224 = /*#__PURE__*/ (0, $8nhma$forwa
|
|
|
315
318
|
"data-focus-visible": isFocusVisible || undefined,
|
|
316
319
|
"data-disabled": props.isDisabled || undefined,
|
|
317
320
|
"data-readonly": props.isReadOnly || undefined,
|
|
321
|
+
"data-required": props.isRequired || undefined,
|
|
318
322
|
"data-open": state.isOpen || undefined
|
|
319
323
|
}));
|
|
320
324
|
});
|
|
@@ -89,7 +89,8 @@ const $06d5b8ec9ee5d538$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $8nhma$forwa
|
|
|
89
89
|
isDisabled: props.isDisabled || false,
|
|
90
90
|
isInvalid: state.isInvalid,
|
|
91
91
|
isOpen: state.isOpen,
|
|
92
|
-
isReadOnly: props.isReadOnly || false
|
|
92
|
+
isReadOnly: props.isReadOnly || false,
|
|
93
|
+
isRequired: props.isRequired || false
|
|
93
94
|
},
|
|
94
95
|
defaultClassName: 'react-aria-DatePicker'
|
|
95
96
|
});
|
|
@@ -177,6 +178,7 @@ const $06d5b8ec9ee5d538$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $8nhma$forwa
|
|
|
177
178
|
"data-focus-visible": isFocusVisible || undefined,
|
|
178
179
|
"data-disabled": props.isDisabled || undefined,
|
|
179
180
|
"data-readonly": props.isReadOnly || undefined,
|
|
181
|
+
"data-required": props.isRequired || undefined,
|
|
180
182
|
"data-open": state.isOpen || undefined
|
|
181
183
|
}), /*#__PURE__*/ (0, $8nhma$react).createElement((0, $c699643d2073b351$export$eefa3e19139f00f3), {
|
|
182
184
|
autoComplete: props.autoComplete,
|
|
@@ -222,7 +224,8 @@ const $06d5b8ec9ee5d538$export$17334619f3ac2224 = /*#__PURE__*/ (0, $8nhma$forwa
|
|
|
222
224
|
isDisabled: props.isDisabled || false,
|
|
223
225
|
isInvalid: state.isInvalid,
|
|
224
226
|
isOpen: state.isOpen,
|
|
225
|
-
isReadOnly: props.isReadOnly || false
|
|
227
|
+
isReadOnly: props.isReadOnly || false,
|
|
228
|
+
isRequired: props.isRequired || false
|
|
226
229
|
},
|
|
227
230
|
defaultClassName: 'react-aria-DateRangePicker'
|
|
228
231
|
});
|
|
@@ -315,6 +318,7 @@ const $06d5b8ec9ee5d538$export$17334619f3ac2224 = /*#__PURE__*/ (0, $8nhma$forwa
|
|
|
315
318
|
"data-focus-visible": isFocusVisible || undefined,
|
|
316
319
|
"data-disabled": props.isDisabled || undefined,
|
|
317
320
|
"data-readonly": props.isReadOnly || undefined,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AAW,MAAM,MAAM,IAAI;;AAGnC","sources":["packages/react-aria-components/src/DatePicker.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 {AriaDatePickerProps, AriaDateRangePickerProps, DateValue, useDatePicker, useDateRangePicker, useFocusRing} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {DatePickerState, DatePickerStateOptions, DateRangePickerState, DateRangePickerStateOptions, useDatePickerState, useDateRangePickerState} from 'react-stately';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeProps, useResizeObserver} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface DatePickerRenderProps {\n /**\n * Whether an element within the date picker is focused, either via a mouse or keyboard.\n * @selector [data-focus-within]\n */\n isFocusWithin: boolean,\n /**\n * Whether an element within the date picker is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the date picker is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the date picker is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the date picker is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the date picker's popover is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * State of the date picker.\n */\n state: DatePickerState\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n /**\n * State of the date range picker.\n */\n state: DateRangePickerState\n}\n\nexport interface DatePickerProps<T extends DateValue> extends Omit<AriaDatePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DatePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DatePicker'\n */\n className?: ClassNameOrFunction<DatePickerRenderProps>\n}\nexport interface DateRangePickerProps<T extends DateValue> extends Omit<AriaDateRangePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DateRangePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DateRangePicker'\n */\n className?: ClassNameOrFunction<DateRangePickerRenderProps>\n}\n\nexport const DatePickerContext = createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext = createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<T extends DateValue>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DatePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDatePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n fieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDatePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false\n },\n defaultClassName: 'react-aria-DatePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DatePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [DateFieldContext, fieldProps],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [CalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DatePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-open={state.isOpen || undefined} />\n <HiddenDateInput\n autoComplete={props.autoComplete}\n name={props.name}\n isDisabled={props.isDisabled}\n state={state} />\n </Provider>\n );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DateRangePicker<T extends DateValue>(props: DateRangePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDateRangePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n startFieldProps,\n endFieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDateRangePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false\n },\n defaultClassName: 'react-aria-DateRangePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DateRangePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [RangeCalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DateRangePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [DateFieldContext, {\n slots: {\n start: startFieldProps,\n end: endFieldProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-open={state.isOpen || undefined} />\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DatePicker.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;AA+FM,MA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right 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 {AriaDatePickerProps, AriaDateRangePickerProps, DateValue, useDatePicker, useDateRangePicker, useFocusRing} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {DatePickerState, DatePickerStateOptions, DateRangePickerState, DateRangePickerStateOptions, useDatePickerState, useDateRangePickerState} from 'react-stately';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeProps, useResizeObserver} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface DatePickerRenderProps {\n /**\n * Whether an element within the date picker is focused, either via a mouse or keyboard.\n * @selector [data-focus-within]\n */\n isFocusWithin: boolean,\n /**\n * Whether an element within the date picker is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the date picker is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the date picker is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the date picker is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the date picker is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the date picker's popover is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * State of the date picker.\n */\n state: DatePickerState\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n /**\n * State of the date range picker.\n */\n state: DateRangePickerState\n}\n\nexport interface DatePickerProps<T extends DateValue> extends Omit<AriaDatePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DatePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DatePicker'\n */\n className?: ClassNameOrFunction<DatePickerRenderProps>\n}\nexport interface DateRangePickerProps<T extends DateValue> extends Omit<AriaDateRangePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DateRangePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DateRangePicker'\n */\n className?: ClassNameOrFunction<DateRangePickerRenderProps>\n}\n\nexport const DatePickerContext = createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext = createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<T extends DateValue>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DatePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDatePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n fieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDatePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DatePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DatePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [DateFieldContext, fieldProps],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [CalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DatePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined} />\n <HiddenDateInput\n autoComplete={props.autoComplete}\n name={props.name}\n isDisabled={props.isDisabled}\n state={state} />\n </Provider>\n );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DateRangePicker<T extends DateValue>(props: DateRangePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDateRangePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n startFieldProps,\n endFieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDateRangePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DateRangePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DateRangePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [RangeCalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DateRangePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [DateFieldContext, {\n slots: {\n start: startFieldProps,\n end: endFieldProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined} />\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DatePicker.module.js.map"}
|
package/dist/DropZone.main.js
CHANGED
|
@@ -101,7 +101,7 @@ const $80a65baccb138f12$export$3c6489d84dc98b6 = /*#__PURE__*/ (0, $iiEmS$react.
|
|
|
101
101
|
slot: props.slot || undefined,
|
|
102
102
|
ref: dropzoneRef,
|
|
103
103
|
onClick: (e)=>{
|
|
104
|
-
let target = e
|
|
104
|
+
let target = (0, $iiEmS$reactariautils.getEventTarget)(e);
|
|
105
105
|
while(target && (0, $iiEmS$reactariautils.nodeContains)(dropzoneRef.current, target)){
|
|
106
106
|
if ((0, $iiEmS$reactariautils.isFocusable)(target)) break;
|
|
107
107
|
else if (target === dropzoneRef.current) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAwDM,MAAM,0DAAkB,CAAA,GAAA,0BAAY,EAA+C;AAKnF,MAAM,yDAAW,CAAA,GAAA,uBAAS,EAAE,SAAS,SAAS,KAAoB,EAAE,GAAiC;IAC1G,IAAI,cAAC,aAAa,OAAM,GAAG;IAC3B,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,cAAc,CAAA,GAAA,kCAAW,EAAE;IAC/B,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAqB;IAC1C,IAAI,aAAC,SAAS,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAM,EAAE;QAAC,GAAG,KAAK;QAAE,KAAK;QAAW,eAAe;IAAI;IACvG,IAAI,eAAC,WAAW,EAAC,GAAG,CAAA,GAAA,0BAAQ,EAAE,mBAAmB,CAAC,GAAG;IACrD,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,yBAAO,EAAE;IACvC,IAAI,cAAC,UAAU,aAAE,SAAS,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,6BAAW;IACzD,IAAI,kBAAkB,CAAA,GAAA,4CAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAEhE,IAAI,SA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;QACR,QAAQ;uBAAC;uBAAW;4BAAW;0BAAgB;wBAAc;QAAU;QACvE,kBAAkB;IACpB;IACA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAElB,qBACE,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,qCAAU;gBAAG;oBAAC,IAAI;oBAAQ,MAAM;gBAAO;aAAE;SAC3C;qBACD,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,2BAAS,EAAE,UAAU,aAAa,WAAW,WAAW;QAC5D,MAAM,MAAM,IAAI,IAAI;QACpB,KAAK;QACL,SAAS,CAAC;YACR,IAAI,SAAS,CAAA,GAAA,oCAAa,EAAE;YAC5B,MAAO,UAAU,CAAA,GAAA,kCAAW,EAAE,YAAY,OAAO,EAAE,QAAS;gBAC1D,IAAI,CAAA,GAAA,iCAAU,EAAE,SACd;qBACK,IAAI,WAAW,YAAY,OAAO,EAAE;wBACzC;qBAAA,qBAAA,UAAU,OAAO,cAAjB,yCAAA,mBAAmB,KAAK;oBACxB;gBACF;gBAEA,SAAS,OAAO,aAAa;YAC/B;QACF;QACA,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,oBAAkB,gBAAgB;QAClC,iBAAe,cAAc;qBAC7B,0DAAC,CAAA,GAAA,+BAAa,uBACZ,0DAAC;QACE,GAAG,CAAA,GAAA,2BAAS,EAAE,aAAa,YAAY,gBAAgB,WAAW;QACnE,KAAK;SAER,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/DropZone.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, GlobalDOMAttributes, HoverEvents} from '@react-types/shared';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DropOptions, mergeProps, useButton, useClipboard, useDrop, useFocusRing, useHover, useLocalizedStringFormatter, VisuallyHidden} from 'react-aria';\nimport {filterDOMProps, getEventTarget, isFocusable, nodeContains, useLabels, useObjectRef, useSlotId} from '@react-aria/utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface DropZoneRenderProps {\n /**\n * Whether the dropzone is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the dropzone is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the dropzone is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the dropzone is the drop target.\n * @selector [data-drop-target]\n */\n isDropTarget: boolean,\n /**\n * Whether the dropzone is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean\n}\n\nexport interface DropZoneProps extends Omit<DropOptions, 'getDropOperationForPoint' | 'ref' | 'hasDropButton'>, HoverEvents, RenderProps<DropZoneRenderProps>, SlotProps, AriaLabelingProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DropZone'\n */\n className?: ClassNameOrFunction<DropZoneRenderProps>\n}\n\nexport const DropZoneContext = createContext<ContextValue<DropZoneProps, HTMLDivElement>>(null);\n\n/**\n * A drop zone is an area into which one or multiple objects can be dragged and dropped.\n */\nexport const DropZone = forwardRef(function DropZone(props: DropZoneProps, ref: ForwardedRef<HTMLDivElement>) {\n let {isDisabled = false} = props;\n [props, ref] = useContextProps(props, ref, DropZoneContext);\n let dropzoneRef = useObjectRef(ref);\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {dropProps, dropButtonProps, isDropTarget} = useDrop({...props, ref: buttonRef, hasDropButton: true});\n let {buttonProps} = useButton(dropButtonProps || {}, buttonRef);\n let {hoverProps, isHovered} = useHover(props);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, 'react-aria-components');\n\n let textId = useSlotId();\n let ariaLabel = props['aria-label'] || stringFormatter.format('dropzoneLabel');\n let messageId = props['aria-labelledby'];\n let ariaLabelledby = [textId, messageId].filter(Boolean).join(' ');\n let labelProps = useLabels({'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby});\n\n\n let {clipboardProps} = useClipboard({\n isDisabled,\n onPaste: (items) => props.onDrop?.({\n type: 'drop',\n items,\n x: 0,\n y: 0,\n dropOperation: 'copy'\n })\n });\n\n let renderProps = useRenderProps({\n ...props,\n values: {isHovered, isFocused, isFocusVisible, isDropTarget, isDisabled},\n defaultClassName: 'react-aria-DropZone'\n });\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [TextContext, {id: textId, slot: 'label'}]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, dropProps, hoverProps)}\n slot={props.slot || undefined}\n ref={dropzoneRef}\n onClick={(e) => {\n let target = getEventTarget(e) as HTMLElement | null;\n while (target && nodeContains(dropzoneRef.current, target)) {\n if (isFocusable(target)) {\n break;\n } else if (target === dropzoneRef.current) {\n buttonRef.current?.focus();\n break;\n }\n\n target = target.parentElement;\n }\n }}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-drop-target={isDropTarget || undefined}\n data-disabled={isDisabled || undefined}>\n <VisuallyHidden>\n <button\n {...mergeProps(buttonProps, focusProps, clipboardProps, labelProps)}\n ref={buttonRef} />\n </VisuallyHidden>\n {renderProps.children}\n </dom.div>\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DropZone.main.js.map"}
|
package/dist/DropZone.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import {dom as $64fa3d84918910a7$export$df3a06d6289f983e, Provider as $64fa3d849
|
|
|
2
2
|
import $dVbUU$intlStringsmodulejs from "./intlStrings.mjs";
|
|
3
3
|
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.mjs";
|
|
4
4
|
import {useDrop as $dVbUU$useDrop, useButton as $dVbUU$useButton, useHover as $dVbUU$useHover, useFocusRing as $dVbUU$useFocusRing, useLocalizedStringFormatter as $dVbUU$useLocalizedStringFormatter, useClipboard as $dVbUU$useClipboard, mergeProps as $dVbUU$mergeProps, VisuallyHidden as $dVbUU$VisuallyHidden} from "react-aria";
|
|
5
|
-
import {useObjectRef as $dVbUU$useObjectRef, useSlotId as $dVbUU$useSlotId, useLabels as $dVbUU$useLabels, filterDOMProps as $dVbUU$filterDOMProps, nodeContains as $dVbUU$nodeContains, isFocusable as $dVbUU$isFocusable} from "@react-aria/utils";
|
|
5
|
+
import {useObjectRef as $dVbUU$useObjectRef, useSlotId as $dVbUU$useSlotId, useLabels as $dVbUU$useLabels, filterDOMProps as $dVbUU$filterDOMProps, getEventTarget as $dVbUU$getEventTarget, nodeContains as $dVbUU$nodeContains, isFocusable as $dVbUU$isFocusable} from "@react-aria/utils";
|
|
6
6
|
import $dVbUU$react, {createContext as $dVbUU$createContext, forwardRef as $dVbUU$forwardRef, useRef as $dVbUU$useRef} from "react";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -94,7 +94,7 @@ const $cb088e721efb9218$export$3c6489d84dc98b6 = /*#__PURE__*/ (0, $dVbUU$forwar
|
|
|
94
94
|
slot: props.slot || undefined,
|
|
95
95
|
ref: dropzoneRef,
|
|
96
96
|
onClick: (e)=>{
|
|
97
|
-
let target = e
|
|
97
|
+
let target = (0, $dVbUU$getEventTarget)(e);
|
|
98
98
|
while(target && (0, $dVbUU$nodeContains)(dropzoneRef.current, target)){
|
|
99
99
|
if ((0, $dVbUU$isFocusable)(target)) break;
|
|
100
100
|
else if (target === dropzoneRef.current) {
|
package/dist/DropZone.module.js
CHANGED
|
@@ -2,7 +2,7 @@ import {dom as $64fa3d84918910a7$export$df3a06d6289f983e, Provider as $64fa3d849
|
|
|
2
2
|
import $dVbUU$intlStringsmodulejs from "./intlStrings.module.js";
|
|
3
3
|
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.module.js";
|
|
4
4
|
import {useDrop as $dVbUU$useDrop, useButton as $dVbUU$useButton, useHover as $dVbUU$useHover, useFocusRing as $dVbUU$useFocusRing, useLocalizedStringFormatter as $dVbUU$useLocalizedStringFormatter, useClipboard as $dVbUU$useClipboard, mergeProps as $dVbUU$mergeProps, VisuallyHidden as $dVbUU$VisuallyHidden} from "react-aria";
|
|
5
|
-
import {useObjectRef as $dVbUU$useObjectRef, useSlotId as $dVbUU$useSlotId, useLabels as $dVbUU$useLabels, filterDOMProps as $dVbUU$filterDOMProps, nodeContains as $dVbUU$nodeContains, isFocusable as $dVbUU$isFocusable} from "@react-aria/utils";
|
|
5
|
+
import {useObjectRef as $dVbUU$useObjectRef, useSlotId as $dVbUU$useSlotId, useLabels as $dVbUU$useLabels, filterDOMProps as $dVbUU$filterDOMProps, getEventTarget as $dVbUU$getEventTarget, nodeContains as $dVbUU$nodeContains, isFocusable as $dVbUU$isFocusable} from "@react-aria/utils";
|
|
6
6
|
import $dVbUU$react, {createContext as $dVbUU$createContext, forwardRef as $dVbUU$forwardRef, useRef as $dVbUU$useRef} from "react";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -94,7 +94,7 @@ const $cb088e721efb9218$export$3c6489d84dc98b6 = /*#__PURE__*/ (0, $dVbUU$forwar
|
|
|
94
94
|
slot: props.slot || undefined,
|
|
95
95
|
ref: dropzoneRef,
|
|
96
96
|
onClick: (e)=>{
|
|
97
|
-
let target = e
|
|
97
|
+
let target = (0, $dVbUU$getEventTarget)(e);
|
|
98
98
|
while(target && (0, $dVbUU$nodeContains)(dropzoneRef.current, target)){
|
|
99
99
|
if ((0, $dVbUU$isFocusable)(target)) break;
|
|
100
100
|
else if (target === dropzoneRef.current) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAwDM,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAA+C;AAKnF,MAAM,yDAAW,CAAA,GAAA,iBAAS,EAAE,SAAS,SAAS,KAAoB,EAAE,GAAiC;IAC1G,IAAI,cAAC,aAAa,OAAM,GAAG;IAC3B,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,cAAc,CAAA,GAAA,mBAAW,EAAE;IAC/B,IAAI,YAAY,CAAA,GAAA,aAAK,EAAqB;IAC1C,IAAI,aAAC,SAAS,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,cAAM,EAAE;QAAC,GAAG,KAAK;QAAE,KAAK;QAAW,eAAe;IAAI;IACvG,IAAI,eAAC,WAAW,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE,mBAAmB,CAAC,GAAG;IACrD,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,IAAI,cAAC,UAAU,aAAE,SAAS,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW;IACzD,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAEhE,IAAI,SAAS,CAAA,GAAA,gBAAQ;IACrB,IAAI,YAAY,KAAK,CAAC,aAAa,IAAI,gBAAgB,MAAM,CAAC;IAC9D,IA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AAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAElB,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBAAC,IAAI;oBAAQ,MAAM;gBAAO;aAAE;SAC3C;qBACD,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,WAAW,WAAW;QAC5D,MAAM,MAAM,IAAI,IAAI;QACpB,KAAK;QACL,SAAS,CAAC;YACR,IAAI,SAAS,CAAA,GAAA,qBAAa,EAAE;YAC5B,MAAO,UAAU,CAAA,GAAA,mBAAW,EAAE,YAAY,OAAO,EAAE,QAAS;gBAC1D,IAAI,CAAA,GAAA,kBAAU,EAAE,SACd;qBACK,IAAI,WAAW,YAAY,OAAO,EAAE;wBACzC;qBAAA,qBAAA,UAAU,OAAO,cAAjB,yCAAA,mBAAmB,KAAK;oBACxB;gBACF;gBAEA,SAAS,OAAO,aAAa;YAC/B;QACF;QACA,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,oBAAkB,gBAAgB;QAClC,iBAAe,cAAc;qBAC7B,gCAAC,CAAA,GAAA,qBAAa,uBACZ,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,YAAY,gBAAgB,WAAW;QACnE,KAAK;SAER,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/DropZone.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, GlobalDOMAttributes, HoverEvents} from '@react-types/shared';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DropOptions, mergeProps, useButton, useClipboard, useDrop, useFocusRing, useHover, useLocalizedStringFormatter, VisuallyHidden} from 'react-aria';\nimport {filterDOMProps, getEventTarget, isFocusable, nodeContains, useLabels, useObjectRef, useSlotId} from '@react-aria/utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface DropZoneRenderProps {\n /**\n * Whether the dropzone is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the dropzone is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the dropzone is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the dropzone is the drop target.\n * @selector [data-drop-target]\n */\n isDropTarget: boolean,\n /**\n * Whether the dropzone is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean\n}\n\nexport interface DropZoneProps extends Omit<DropOptions, 'getDropOperationForPoint' | 'ref' | 'hasDropButton'>, HoverEvents, RenderProps<DropZoneRenderProps>, SlotProps, AriaLabelingProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DropZone'\n */\n className?: ClassNameOrFunction<DropZoneRenderProps>\n}\n\nexport const DropZoneContext = createContext<ContextValue<DropZoneProps, HTMLDivElement>>(null);\n\n/**\n * A drop zone is an area into which one or multiple objects can be dragged and dropped.\n */\nexport const DropZone = forwardRef(function DropZone(props: DropZoneProps, ref: ForwardedRef<HTMLDivElement>) {\n let {isDisabled = false} = props;\n [props, ref] = useContextProps(props, ref, DropZoneContext);\n let dropzoneRef = useObjectRef(ref);\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {dropProps, dropButtonProps, isDropTarget} = useDrop({...props, ref: buttonRef, hasDropButton: true});\n let {buttonProps} = useButton(dropButtonProps || {}, buttonRef);\n let {hoverProps, isHovered} = useHover(props);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, 'react-aria-components');\n\n let textId = useSlotId();\n let ariaLabel = props['aria-label'] || stringFormatter.format('dropzoneLabel');\n let messageId = props['aria-labelledby'];\n let ariaLabelledby = [textId, messageId].filter(Boolean).join(' ');\n let labelProps = useLabels({'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby});\n\n\n let {clipboardProps} = useClipboard({\n isDisabled,\n onPaste: (items) => props.onDrop?.({\n type: 'drop',\n items,\n x: 0,\n y: 0,\n dropOperation: 'copy'\n })\n });\n\n let renderProps = useRenderProps({\n ...props,\n values: {isHovered, isFocused, isFocusVisible, isDropTarget, isDisabled},\n defaultClassName: 'react-aria-DropZone'\n });\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [TextContext, {id: textId, slot: 'label'}]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, dropProps, hoverProps)}\n slot={props.slot || undefined}\n ref={dropzoneRef}\n onClick={(e) => {\n let target = getEventTarget(e) as HTMLElement | null;\n while (target && nodeContains(dropzoneRef.current, target)) {\n if (isFocusable(target)) {\n break;\n } else if (target === dropzoneRef.current) {\n buttonRef.current?.focus();\n break;\n }\n\n target = target.parentElement;\n }\n }}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-drop-target={isDropTarget || undefined}\n data-disabled={isDisabled || undefined}>\n <VisuallyHidden>\n <button\n {...mergeProps(buttonProps, focusProps, clipboardProps, labelProps)}\n ref={buttonRef} />\n </VisuallyHidden>\n {renderProps.children}\n </dom.div>\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DropZone.module.js.map"}
|
package/dist/FileTrigger.main.js
CHANGED
|
@@ -48,7 +48,7 @@ const $8e055a19745f522c$export$6fb4a10d2c950550 = /*#__PURE__*/ (0, $g6L2B$react
|
|
|
48
48
|
display: 'none'
|
|
49
49
|
},
|
|
50
50
|
accept: acceptedFileTypes === null || acceptedFileTypes === void 0 ? void 0 : acceptedFileTypes.toString(),
|
|
51
|
-
onChange: (e)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect(e.
|
|
51
|
+
onChange: (e)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect((0, $g6L2B$reactariautils.getEventTarget)(e).files),
|
|
52
52
|
capture: defaultCamera,
|
|
53
53
|
multiple: allowsMultiple,
|
|
54
54
|
// @ts-expect-error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAsCM,MAAM,0DAAc,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAmC;IACrH,IAAI,YAAC,QAAQ,qBAAE,iBAAiB,kBAAE,cAAc,iBAAE,aAAa,YAAE,QAAQ,mBAAE,eAAe,EAAE,GAAG,MAAK,GAAG;IACvG,IAAI,WAAW,CAAA,GAAA,kCAAW,EAAE;IAC5B,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,MAAM;QAAC,QAAQ;IAAI;IAEjD,qBACE,oIACE,0DAAC,CAAA,GAAA,2CAAa;QACZ,SAAS;gBACH,mBAGJ;YAHA,KAAI,oBAAA,SAAS,OAAO,cAAhB,wCAAA,kBAAkB,KAAK,EACzB,SAAS,OAAO,CAAC,KAAK,GAAG;aAE3B,qBAAA,SAAS,OAAO,cAAhB,yCAAA,mBAAkB,KAAK;QACzB;OACC,yBAEH,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,QAAQ;QACZ,WAAU;QACV,MAAK;QACL,KAAK;QACL,OAAO;YAAC,SAAS;QAAM;QACvB,MAAM,EAAE,8BAAA,wCAAA,kBAAmB,QAAQ;QACnC,UAAU,CAAC,IAAM,qBAAA,+BAAA,SAAW,EAAE,
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAsCM,MAAM,0DAAc,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAmC;IACrH,IAAI,YAAC,QAAQ,qBAAE,iBAAiB,kBAAE,cAAc,iBAAE,aAAa,YAAE,QAAQ,mBAAE,eAAe,EAAE,GAAG,MAAK,GAAG;IACvG,IAAI,WAAW,CAAA,GAAA,kCAAW,EAAE;IAC5B,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,MAAM;QAAC,QAAQ;IAAI;IAEjD,qBACE,oIACE,0DAAC,CAAA,GAAA,2CAAa;QACZ,SAAS;gBACH,mBAGJ;YAHA,KAAI,oBAAA,SAAS,OAAO,cAAhB,wCAAA,kBAAkB,KAAK,EACzB,SAAS,OAAO,CAAC,KAAK,GAAG;aAE3B,qBAAA,SAAS,OAAO,cAAhB,yCAAA,mBAAkB,KAAK;QACzB;OACC,yBAEH,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,QAAQ;QACZ,WAAU;QACV,MAAK;QACL,KAAK;QACL,OAAO;YAAC,SAAS;QAAM;QACvB,MAAM,EAAE,8BAAA,wCAAA,kBAAmB,QAAQ;QACnC,UAAU,CAAC,IAAM,qBAAA,+BAAA,SAAW,CAAA,GAAA,oCAAa,EAAE,GAAG,KAAK;QACnD,SAAS;QACT,UAAU;QACV,mBAAmB;QACnB,iBAAiB,kBAAkB,KAAK;;AAGhD","sources":["packages/react-aria-components/src/FileTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {filterDOMProps, getEventTarget, useObjectRef} from '@react-aria/utils';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {Input} from './Input';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {ForwardedRef, forwardRef, ReactNode} from 'react';\n\nexport interface FileTriggerProps extends GlobalDOMAttributes<HTMLInputElement> {\n /**\n * Specifies what mime type of files are allowed.\n */\n acceptedFileTypes?: ReadonlyArray<string>,\n /**\n * Whether multiple files can be selected.\n */\n allowsMultiple?: boolean,\n /**\n * Specifies the use of a media capture mechanism to capture the media on the spot.\n */\n defaultCamera?: 'user' | 'environment',\n /**\n * Handler when a user selects a file.\n */\n onSelect?: (files: FileList | null) => void,\n /**\n * The children of the component.\n */\n children?: ReactNode,\n /**\n * Enables the selection of directories instead of individual files.\n */\n acceptDirectory?: boolean\n}\n\n/**\n * A FileTrigger allows a user to access the file system with any pressable React Aria or React Spectrum component, or custom components built with usePress.\n */\nexport const FileTrigger = forwardRef(function FileTrigger(props: FileTriggerProps, ref: ForwardedRef<HTMLInputElement>) {\n let {onSelect, acceptedFileTypes, allowsMultiple, defaultCamera, children, acceptDirectory, ...rest} = props;\n let inputRef = useObjectRef(ref);\n let domProps = filterDOMProps(rest, {global: true});\n\n return (\n <>\n <PressResponder\n onPress={() => {\n if (inputRef.current?.value) {\n inputRef.current.value = '';\n }\n inputRef.current?.click();\n }}>\n {children}\n </PressResponder>\n <Input\n {...domProps}\n className=\"\"\n type=\"file\"\n ref={inputRef}\n style={{display: 'none'}}\n accept={acceptedFileTypes?.toString()}\n onChange={(e) => onSelect?.(getEventTarget(e).files)}\n capture={defaultCamera}\n multiple={allowsMultiple}\n // @ts-expect-error\n webkitdirectory={acceptDirectory ? '' : undefined} />\n </>\n );\n});\n"],"names":[],"version":3,"file":"FileTrigger.main.js.map"}
|
package/dist/FileTrigger.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Input as $3985021b0ad6602f$export$f5b8910cec6cf069} from "./Input.mjs";
|
|
2
|
-
import {useObjectRef as $d1ZE7$useObjectRef, filterDOMProps as $d1ZE7$filterDOMProps} from "@react-aria/utils";
|
|
2
|
+
import {useObjectRef as $d1ZE7$useObjectRef, filterDOMProps as $d1ZE7$filterDOMProps, getEventTarget as $d1ZE7$getEventTarget} from "@react-aria/utils";
|
|
3
3
|
import {PressResponder as $d1ZE7$PressResponder} from "@react-aria/interactions";
|
|
4
4
|
import $d1ZE7$react, {forwardRef as $d1ZE7$forwardRef} from "react";
|
|
5
5
|
|
|
@@ -38,7 +38,7 @@ const $1e2864c73f66a4da$export$6fb4a10d2c950550 = /*#__PURE__*/ (0, $d1ZE7$forwa
|
|
|
38
38
|
display: 'none'
|
|
39
39
|
},
|
|
40
40
|
accept: acceptedFileTypes === null || acceptedFileTypes === void 0 ? void 0 : acceptedFileTypes.toString(),
|
|
41
|
-
onChange: (e)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect(e.
|
|
41
|
+
onChange: (e)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect((0, $d1ZE7$getEventTarget)(e).files),
|
|
42
42
|
capture: defaultCamera,
|
|
43
43
|
multiple: allowsMultiple,
|
|
44
44
|
// @ts-expect-error
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Input as $3985021b0ad6602f$export$f5b8910cec6cf069} from "./Input.module.js";
|
|
2
|
-
import {useObjectRef as $d1ZE7$useObjectRef, filterDOMProps as $d1ZE7$filterDOMProps} from "@react-aria/utils";
|
|
2
|
+
import {useObjectRef as $d1ZE7$useObjectRef, filterDOMProps as $d1ZE7$filterDOMProps, getEventTarget as $d1ZE7$getEventTarget} from "@react-aria/utils";
|
|
3
3
|
import {PressResponder as $d1ZE7$PressResponder} from "@react-aria/interactions";
|
|
4
4
|
import $d1ZE7$react, {forwardRef as $d1ZE7$forwardRef} from "react";
|
|
5
5
|
|
|
@@ -38,7 +38,7 @@ const $1e2864c73f66a4da$export$6fb4a10d2c950550 = /*#__PURE__*/ (0, $d1ZE7$forwa
|
|
|
38
38
|
display: 'none'
|
|
39
39
|
},
|
|
40
40
|
accept: acceptedFileTypes === null || acceptedFileTypes === void 0 ? void 0 : acceptedFileTypes.toString(),
|
|
41
|
-
onChange: (e)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect(e.
|
|
41
|
+
onChange: (e)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect((0, $d1ZE7$getEventTarget)(e).files),
|
|
42
42
|
capture: defaultCamera,
|
|
43
43
|
multiple: allowsMultiple,
|
|
44
44
|
// @ts-expect-error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAsCM,MAAM,0DAAc,CAAA,GAAA,iBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAmC;IACrH,IAAI,YAAC,QAAQ,qBAAE,iBAAiB,kBAAE,cAAc,iBAAE,aAAa,YAAE,QAAQ,mBAAE,eAAe,EAAE,GAAG,MAAK,GAAG;IACvG,IAAI,WAAW,CAAA,GAAA,mBAAW,EAAE;IAC5B,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,MAAM;QAAC,QAAQ;IAAI;IAEjD,qBACE,gFACE,gCAAC,CAAA,GAAA,qBAAa;QACZ,SAAS;gBACH,mBAGJ;YAHA,KAAI,oBAAA,SAAS,OAAO,cAAhB,wCAAA,kBAAkB,KAAK,EACzB,SAAS,OAAO,CAAC,KAAK,GAAG;aAE3B,qBAAA,SAAS,OAAO,cAAhB,yCAAA,mBAAkB,KAAK;QACzB;OACC,yBAEH,gCAAC,CAAA,GAAA,yCAAI;QACF,GAAG,QAAQ;QACZ,WAAU;QACV,MAAK;QACL,KAAK;QACL,OAAO;YAAC,SAAS;QAAM;QACvB,MAAM,EAAE,8BAAA,wCAAA,kBAAmB,QAAQ;QACnC,UAAU,CAAC,IAAM,qBAAA,+BAAA,SAAW,EAAE,
|
|
1
|
+
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAsCM,MAAM,0DAAc,CAAA,GAAA,iBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAmC;IACrH,IAAI,YAAC,QAAQ,qBAAE,iBAAiB,kBAAE,cAAc,iBAAE,aAAa,YAAE,QAAQ,mBAAE,eAAe,EAAE,GAAG,MAAK,GAAG;IACvG,IAAI,WAAW,CAAA,GAAA,mBAAW,EAAE;IAC5B,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,MAAM;QAAC,QAAQ;IAAI;IAEjD,qBACE,gFACE,gCAAC,CAAA,GAAA,qBAAa;QACZ,SAAS;gBACH,mBAGJ;YAHA,KAAI,oBAAA,SAAS,OAAO,cAAhB,wCAAA,kBAAkB,KAAK,EACzB,SAAS,OAAO,CAAC,KAAK,GAAG;aAE3B,qBAAA,SAAS,OAAO,cAAhB,yCAAA,mBAAkB,KAAK;QACzB;OACC,yBAEH,gCAAC,CAAA,GAAA,yCAAI;QACF,GAAG,QAAQ;QACZ,WAAU;QACV,MAAK;QACL,KAAK;QACL,OAAO;YAAC,SAAS;QAAM;QACvB,MAAM,EAAE,8BAAA,wCAAA,kBAAmB,QAAQ;QACnC,UAAU,CAAC,IAAM,qBAAA,+BAAA,SAAW,CAAA,GAAA,qBAAa,EAAE,GAAG,KAAK;QACnD,SAAS;QACT,UAAU;QACV,mBAAmB;QACnB,iBAAiB,kBAAkB,KAAK;;AAGhD","sources":["packages/react-aria-components/src/FileTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {filterDOMProps, getEventTarget, useObjectRef} from '@react-aria/utils';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {Input} from './Input';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {ForwardedRef, forwardRef, ReactNode} from 'react';\n\nexport interface FileTriggerProps extends GlobalDOMAttributes<HTMLInputElement> {\n /**\n * Specifies what mime type of files are allowed.\n */\n acceptedFileTypes?: ReadonlyArray<string>,\n /**\n * Whether multiple files can be selected.\n */\n allowsMultiple?: boolean,\n /**\n * Specifies the use of a media capture mechanism to capture the media on the spot.\n */\n defaultCamera?: 'user' | 'environment',\n /**\n * Handler when a user selects a file.\n */\n onSelect?: (files: FileList | null) => void,\n /**\n * The children of the component.\n */\n children?: ReactNode,\n /**\n * Enables the selection of directories instead of individual files.\n */\n acceptDirectory?: boolean\n}\n\n/**\n * A FileTrigger allows a user to access the file system with any pressable React Aria or React Spectrum component, or custom components built with usePress.\n */\nexport const FileTrigger = forwardRef(function FileTrigger(props: FileTriggerProps, ref: ForwardedRef<HTMLInputElement>) {\n let {onSelect, acceptedFileTypes, allowsMultiple, defaultCamera, children, acceptDirectory, ...rest} = props;\n let inputRef = useObjectRef(ref);\n let domProps = filterDOMProps(rest, {global: true});\n\n return (\n <>\n <PressResponder\n onPress={() => {\n if (inputRef.current?.value) {\n inputRef.current.value = '';\n }\n inputRef.current?.click();\n }}>\n {children}\n </PressResponder>\n <Input\n {...domProps}\n className=\"\"\n type=\"file\"\n ref={inputRef}\n style={{display: 'none'}}\n accept={acceptedFileTypes?.toString()}\n onChange={(e) => onSelect?.(getEventTarget(e).files)}\n capture={defaultCamera}\n multiple={allowsMultiple}\n // @ts-expect-error\n webkitdirectory={acceptDirectory ? '' : undefined} />\n </>\n );\n});\n"],"names":[],"version":3,"file":"FileTrigger.module.js.map"}
|
package/dist/GridList.main.js
CHANGED
|
@@ -28,6 +28,7 @@ $parcel$export(module.exports, "GridListItem", () => $132cbde493282f82$export$e9
|
|
|
28
28
|
$parcel$export(module.exports, "GridListLoadMoreItem", () => $132cbde493282f82$export$392b9a0bbc7c7e43);
|
|
29
29
|
$parcel$export(module.exports, "GridListSection", () => $132cbde493282f82$export$f696877219115b14);
|
|
30
30
|
$parcel$export(module.exports, "GridListHeaderContext", () => $132cbde493282f82$export$87f5843bfb30d205);
|
|
31
|
+
$parcel$export(module.exports, "GridListHeaderInnerContext", () => $132cbde493282f82$export$bc7e8a4031ec2a33);
|
|
31
32
|
$parcel$export(module.exports, "GridListHeader", () => $132cbde493282f82$export$1b574dbdb0075ff6);
|
|
32
33
|
/*
|
|
33
34
|
* Copyright 2022 Adobe. All rights reserved.
|
|
@@ -292,7 +293,9 @@ const $132cbde493282f82$export$e96fc9a8407faa6b = /*#__PURE__*/ (0, $UaDUV$react
|
|
|
292
293
|
selectionBehavior: state.selectionManager.selectionBehavior,
|
|
293
294
|
allowsDragging: !!dragState,
|
|
294
295
|
isDragging: isDragging,
|
|
295
|
-
isDropTarget: dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.isDropTarget
|
|
296
|
+
isDropTarget: dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.isDropTarget,
|
|
297
|
+
id: item.key,
|
|
298
|
+
state: state
|
|
296
299
|
}
|
|
297
300
|
});
|
|
298
301
|
let dragButtonRef = (0, $UaDUV$react.useRef)(null);
|
|
@@ -553,7 +556,7 @@ const $132cbde493282f82$export$f696877219115b14 = /*#__PURE__*/ (0, $UaDUV$react
|
|
|
553
556
|
}
|
|
554
557
|
],
|
|
555
558
|
[
|
|
556
|
-
$132cbde493282f82$
|
|
559
|
+
$132cbde493282f82$export$bc7e8a4031ec2a33,
|
|
557
560
|
{
|
|
558
561
|
...rowHeaderProps
|
|
559
562
|
}
|
|
@@ -565,10 +568,10 @@ const $132cbde493282f82$export$f696877219115b14 = /*#__PURE__*/ (0, $UaDUV$react
|
|
|
565
568
|
})));
|
|
566
569
|
});
|
|
567
570
|
const $132cbde493282f82$export$87f5843bfb30d205 = /*#__PURE__*/ (0, $UaDUV$react.createContext)({});
|
|
568
|
-
const $132cbde493282f82$
|
|
571
|
+
const $132cbde493282f82$export$bc7e8a4031ec2a33 = /*#__PURE__*/ (0, $UaDUV$react.createContext)(null);
|
|
569
572
|
const $132cbde493282f82$export$1b574dbdb0075ff6 = /*#__PURE__*/ (0, $UaDUV$reactariacollections.createLeafComponent)((0, $UaDUV$reactariacollections.HeaderNode), function Header(props, ref) {
|
|
570
573
|
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $132cbde493282f82$export$87f5843bfb30d205);
|
|
571
|
-
let rowHeaderProps = (0, $UaDUV$react.useContext)($132cbde493282f82$
|
|
574
|
+
let rowHeaderProps = (0, $UaDUV$react.useContext)($132cbde493282f82$export$bc7e8a4031ec2a33);
|
|
572
575
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($UaDUV$react))).createElement((0, $c5ccf687772c0422$exports.dom).div, {
|
|
573
576
|
render: props.render,
|
|
574
577
|
className: "react-aria-GridListHeader",
|