react-aria 3.48.0 → 3.49.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/exports/CollectionBuilder.cjs.map +1 -1
- package/dist/exports/CollectionBuilder.js.map +1 -1
- package/dist/exports/CollectionBuilder.mjs.map +1 -1
- package/dist/exports/index.cjs +12 -0
- package/dist/exports/index.cjs.map +1 -1
- package/dist/exports/index.js +9 -1
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/index.mjs +9 -1
- package/dist/exports/index.mjs.map +1 -1
- package/dist/exports/private/actiongroup/useActionGroup.cjs.map +1 -1
- package/dist/exports/private/actiongroup/useActionGroup.js.map +1 -1
- package/dist/exports/private/actiongroup/useActionGroup.mjs.map +1 -1
- package/dist/exports/private/actiongroup/useActionGroupItem.cjs.map +1 -1
- package/dist/exports/private/actiongroup/useActionGroupItem.js.map +1 -1
- package/dist/exports/private/actiongroup/useActionGroupItem.mjs.map +1 -1
- package/dist/exports/private/autocomplete/useSearchAutocomplete.cjs.map +1 -1
- package/dist/exports/private/autocomplete/useSearchAutocomplete.js.map +1 -1
- package/dist/exports/private/autocomplete/useSearchAutocomplete.mjs.map +1 -1
- package/dist/exports/private/collections/BaseCollection.cjs.map +1 -1
- package/dist/exports/private/collections/BaseCollection.js.map +1 -1
- package/dist/exports/private/collections/BaseCollection.mjs.map +1 -1
- package/dist/exports/private/collections/useCachedChildren.cjs.map +1 -1
- package/dist/exports/private/collections/useCachedChildren.js.map +1 -1
- package/dist/exports/private/collections/useCachedChildren.mjs.map +1 -1
- package/dist/exports/private/focus/FocusScope.cjs.map +1 -1
- package/dist/exports/private/focus/FocusScope.js.map +1 -1
- package/dist/exports/private/focus/FocusScope.mjs.map +1 -1
- package/dist/exports/private/focus/virtualFocus.cjs.map +1 -1
- package/dist/exports/private/focus/virtualFocus.js.map +1 -1
- package/dist/exports/private/focus/virtualFocus.mjs.map +1 -1
- package/dist/exports/private/grid/GridKeyboardDelegate.cjs.map +1 -1
- package/dist/exports/private/grid/GridKeyboardDelegate.js.map +1 -1
- package/dist/exports/private/grid/GridKeyboardDelegate.mjs.map +1 -1
- package/dist/exports/private/grid/useGridSelectionAnnouncement.cjs.map +1 -1
- package/dist/exports/private/grid/useGridSelectionAnnouncement.js.map +1 -1
- package/dist/exports/private/grid/useGridSelectionAnnouncement.mjs.map +1 -1
- package/dist/exports/private/grid/useGridSelectionCheckbox.cjs.map +1 -1
- package/dist/exports/private/grid/useGridSelectionCheckbox.js.map +1 -1
- package/dist/exports/private/grid/useGridSelectionCheckbox.mjs.map +1 -1
- package/dist/exports/private/grid/useHighlightSelectionDescription.cjs.map +1 -1
- package/dist/exports/private/grid/useHighlightSelectionDescription.js.map +1 -1
- package/dist/exports/private/grid/useHighlightSelectionDescription.mjs.map +1 -1
- package/dist/exports/private/interactions/useFocusVisible.cjs.map +1 -1
- package/dist/exports/private/interactions/useFocusVisible.js.map +1 -1
- package/dist/exports/private/interactions/useFocusVisible.mjs.map +1 -1
- package/dist/exports/private/interactions/useFocusable.cjs.map +1 -1
- package/dist/exports/private/interactions/useFocusable.js.map +1 -1
- package/dist/exports/private/interactions/useFocusable.mjs.map +1 -1
- package/dist/exports/private/landmark/useLandmark.cjs.map +1 -1
- package/dist/exports/private/landmark/useLandmark.js.map +1 -1
- package/dist/exports/private/landmark/useLandmark.mjs.map +1 -1
- package/dist/exports/private/live-announcer/LiveAnnouncer.cjs.map +1 -1
- package/dist/exports/private/live-announcer/LiveAnnouncer.js.map +1 -1
- package/dist/exports/private/live-announcer/LiveAnnouncer.mjs.map +1 -1
- package/dist/exports/private/overlays/useModal.cjs.map +1 -1
- package/dist/exports/private/overlays/useModal.js.map +1 -1
- package/dist/exports/private/overlays/useModal.mjs.map +1 -1
- package/dist/exports/private/selection/useSelectableCollection.cjs.map +1 -1
- package/dist/exports/private/selection/useSelectableCollection.js.map +1 -1
- package/dist/exports/private/selection/useSelectableCollection.mjs.map +1 -1
- package/dist/exports/private/selection/useSelectableItem.cjs.map +1 -1
- package/dist/exports/private/selection/useSelectableItem.js.map +1 -1
- package/dist/exports/private/selection/useSelectableItem.mjs.map +1 -1
- package/dist/exports/private/selection/useSelectableList.cjs.map +1 -1
- package/dist/exports/private/selection/useSelectableList.js.map +1 -1
- package/dist/exports/private/selection/useSelectableList.mjs.map +1 -1
- package/dist/exports/private/selection/useTypeSelect.cjs.map +1 -1
- package/dist/exports/private/selection/useTypeSelect.js.map +1 -1
- package/dist/exports/private/selection/useTypeSelect.mjs.map +1 -1
- package/dist/exports/private/spinbutton/useSpinButton.cjs.map +1 -1
- package/dist/exports/private/spinbutton/useSpinButton.js.map +1 -1
- package/dist/exports/private/spinbutton/useSpinButton.mjs.map +1 -1
- package/dist/exports/private/steplist/useStepList.cjs.map +1 -1
- package/dist/exports/private/steplist/useStepList.js.map +1 -1
- package/dist/exports/private/steplist/useStepList.mjs.map +1 -1
- package/dist/exports/private/steplist/useStepListItem.cjs.map +1 -1
- package/dist/exports/private/steplist/useStepListItem.js.map +1 -1
- package/dist/exports/private/steplist/useStepListItem.mjs.map +1 -1
- package/dist/exports/private/utils/openLink.cjs.map +1 -1
- package/dist/exports/private/utils/openLink.js.map +1 -1
- package/dist/exports/private/utils/openLink.mjs.map +1 -1
- package/dist/exports/private/utils/platform.cjs.map +1 -1
- package/dist/exports/private/utils/platform.js.map +1 -1
- package/dist/exports/private/utils/platform.mjs.map +1 -1
- package/dist/exports/private/utils/shadowdom/DOMFunctions.cjs.map +1 -1
- package/dist/exports/private/utils/shadowdom/DOMFunctions.js.map +1 -1
- package/dist/exports/private/utils/shadowdom/DOMFunctions.mjs.map +1 -1
- package/dist/exports/private/utils/shadowdom/ShadowTreeWalker.cjs.map +1 -1
- package/dist/exports/private/utils/shadowdom/ShadowTreeWalker.js.map +1 -1
- package/dist/exports/private/utils/shadowdom/ShadowTreeWalker.mjs.map +1 -1
- package/dist/exports/private/utils/useLoadMoreSentinel.cjs.map +1 -1
- package/dist/exports/private/utils/useLoadMoreSentinel.js.map +1 -1
- package/dist/exports/private/utils/useLoadMoreSentinel.mjs.map +1 -1
- package/dist/exports/private/virtualizer/useVirtualizerItem.cjs.map +1 -1
- package/dist/exports/private/virtualizer/useVirtualizerItem.js.map +1 -1
- package/dist/exports/private/virtualizer/useVirtualizerItem.mjs.map +1 -1
- package/dist/exports/private/virtualizer/utils.cjs.map +1 -1
- package/dist/exports/private/virtualizer/utils.js.map +1 -1
- package/dist/exports/private/virtualizer/utils.mjs.map +1 -1
- package/dist/exports/useAutocomplete.cjs.map +1 -1
- package/dist/exports/useAutocomplete.js.map +1 -1
- package/dist/exports/useAutocomplete.mjs.map +1 -1
- package/dist/exports/useBreadcrumbs.cjs.map +1 -1
- package/dist/exports/useBreadcrumbs.js.map +1 -1
- package/dist/exports/useBreadcrumbs.mjs.map +1 -1
- package/dist/exports/useButton.cjs.map +1 -1
- package/dist/exports/useButton.js.map +1 -1
- package/dist/exports/useButton.mjs.map +1 -1
- package/dist/exports/useCalendar.cjs +9 -0
- package/dist/exports/useCalendar.cjs.map +1 -1
- package/dist/exports/useCalendar.js +7 -1
- package/dist/exports/useCalendar.js.map +1 -1
- package/dist/exports/useCalendar.mjs +7 -1
- package/dist/exports/useCalendar.mjs.map +1 -1
- package/dist/exports/useClipboard.cjs.map +1 -1
- package/dist/exports/useClipboard.js.map +1 -1
- package/dist/exports/useClipboard.mjs.map +1 -1
- package/dist/exports/useColorArea.cjs.map +1 -1
- package/dist/exports/useColorArea.js.map +1 -1
- package/dist/exports/useColorArea.mjs.map +1 -1
- package/dist/exports/useColorField.cjs.map +1 -1
- package/dist/exports/useColorField.js.map +1 -1
- package/dist/exports/useColorField.mjs.map +1 -1
- package/dist/exports/useColorSlider.cjs.map +1 -1
- package/dist/exports/useColorSlider.js.map +1 -1
- package/dist/exports/useColorSlider.mjs.map +1 -1
- package/dist/exports/useColorWheel.cjs.map +1 -1
- package/dist/exports/useColorWheel.js.map +1 -1
- package/dist/exports/useColorWheel.mjs.map +1 -1
- package/dist/exports/useComboBox.cjs.map +1 -1
- package/dist/exports/useComboBox.js.map +1 -1
- package/dist/exports/useComboBox.mjs.map +1 -1
- package/dist/exports/useDateField.cjs.map +1 -1
- package/dist/exports/useDateField.js.map +1 -1
- package/dist/exports/useDateField.mjs.map +1 -1
- package/dist/exports/useDateRangePicker.cjs.map +1 -1
- package/dist/exports/useDateRangePicker.js.map +1 -1
- package/dist/exports/useDateRangePicker.mjs.map +1 -1
- package/dist/exports/useDisclosure.cjs +1 -1
- package/dist/exports/useDisclosure.cjs.map +1 -1
- package/dist/exports/useDisclosure.js +1 -1
- package/dist/exports/useDisclosure.js.map +1 -1
- package/dist/exports/useDisclosure.mjs +1 -1
- package/dist/exports/useDisclosure.mjs.map +1 -1
- package/dist/exports/useDrag.cjs.map +1 -1
- package/dist/exports/useDrag.js.map +1 -1
- package/dist/exports/useDrag.mjs.map +1 -1
- package/dist/exports/useDraggableCollection.cjs.map +1 -1
- package/dist/exports/useDraggableCollection.js.map +1 -1
- package/dist/exports/useDraggableCollection.mjs.map +1 -1
- package/dist/exports/useDrop.cjs.map +1 -1
- package/dist/exports/useDrop.js.map +1 -1
- package/dist/exports/useDrop.mjs.map +1 -1
- package/dist/exports/useDroppableCollection.cjs.map +1 -1
- package/dist/exports/useDroppableCollection.js.map +1 -1
- package/dist/exports/useDroppableCollection.mjs.map +1 -1
- package/dist/exports/useFocusable.cjs.map +1 -1
- package/dist/exports/useFocusable.js.map +1 -1
- package/dist/exports/useFocusable.mjs.map +1 -1
- package/dist/exports/useGridList.cjs.map +1 -1
- package/dist/exports/useGridList.js.map +1 -1
- package/dist/exports/useGridList.mjs.map +1 -1
- package/dist/exports/useInteractOutside.cjs.map +1 -1
- package/dist/exports/useInteractOutside.js.map +1 -1
- package/dist/exports/useInteractOutside.mjs.map +1 -1
- package/dist/exports/useLandmark.cjs.map +1 -1
- package/dist/exports/useLandmark.js.map +1 -1
- package/dist/exports/useLandmark.mjs.map +1 -1
- package/dist/exports/useListBox.cjs.map +1 -1
- package/dist/exports/useListBox.js.map +1 -1
- package/dist/exports/useListBox.mjs.map +1 -1
- package/dist/exports/useLocalizedStringFormatter.cjs.map +1 -1
- package/dist/exports/useLocalizedStringFormatter.js.map +1 -1
- package/dist/exports/useLocalizedStringFormatter.mjs.map +1 -1
- package/dist/exports/useMove.cjs.map +1 -1
- package/dist/exports/useMove.js.map +1 -1
- package/dist/exports/useMove.mjs.map +1 -1
- package/dist/exports/useOverlayPosition.cjs.map +1 -1
- package/dist/exports/useOverlayPosition.js.map +1 -1
- package/dist/exports/useOverlayPosition.mjs.map +1 -1
- package/dist/exports/useProgressBar.cjs.map +1 -1
- package/dist/exports/useProgressBar.js.map +1 -1
- package/dist/exports/useProgressBar.mjs.map +1 -1
- package/dist/exports/useRangeCalendar.cjs +15 -0
- package/dist/exports/useRangeCalendar.cjs.map +1 -1
- package/dist/exports/useRangeCalendar.js +11 -1
- package/dist/exports/useRangeCalendar.js.map +1 -1
- package/dist/exports/useRangeCalendar.mjs +11 -1
- package/dist/exports/useRangeCalendar.mjs.map +1 -1
- package/dist/exports/useSelect.cjs.map +1 -1
- package/dist/exports/useSelect.js.map +1 -1
- package/dist/exports/useSelect.mjs.map +1 -1
- package/dist/exports/useSlider.cjs.map +1 -1
- package/dist/exports/useSlider.js.map +1 -1
- package/dist/exports/useSlider.mjs.map +1 -1
- package/dist/exports/useTable.cjs.map +1 -1
- package/dist/exports/useTable.js.map +1 -1
- package/dist/exports/useTable.mjs.map +1 -1
- package/dist/exports/useTimeField.cjs.map +1 -1
- package/dist/exports/useTimeField.js.map +1 -1
- package/dist/exports/useTimeField.mjs.map +1 -1
- package/dist/exports/useToggleButton.cjs.map +1 -1
- package/dist/exports/useToggleButton.js.map +1 -1
- package/dist/exports/useToggleButton.mjs.map +1 -1
- package/dist/exports/useToggleButtonGroup.cjs.map +1 -1
- package/dist/exports/useToggleButtonGroup.js.map +1 -1
- package/dist/exports/useToggleButtonGroup.mjs.map +1 -1
- package/dist/exports/useTree.cjs.map +1 -1
- package/dist/exports/useTree.js.map +1 -1
- package/dist/exports/useTree.mjs.map +1 -1
- package/dist/private/actiongroup/useActionGroup.cjs +3 -3
- package/dist/private/actiongroup/useActionGroup.cjs.map +1 -1
- package/dist/private/actiongroup/useActionGroup.js +3 -3
- package/dist/private/actiongroup/useActionGroup.js.map +1 -1
- package/dist/private/actiongroup/useActionGroup.mjs +3 -3
- package/dist/private/actiongroup/useActionGroup.mjs.map +1 -1
- package/dist/private/actiongroup/useActionGroupItem.cjs +5 -4
- package/dist/private/actiongroup/useActionGroupItem.cjs.map +1 -1
- package/dist/private/actiongroup/useActionGroupItem.js +5 -4
- package/dist/private/actiongroup/useActionGroupItem.js.map +1 -1
- package/dist/private/actiongroup/useActionGroupItem.mjs +5 -4
- package/dist/private/actiongroup/useActionGroupItem.mjs.map +1 -1
- package/dist/private/aria-modal-polyfill/ariaModalPolyfill.cjs +7 -5
- package/dist/private/aria-modal-polyfill/ariaModalPolyfill.cjs.map +1 -1
- package/dist/private/aria-modal-polyfill/ariaModalPolyfill.js +7 -5
- package/dist/private/aria-modal-polyfill/ariaModalPolyfill.js.map +1 -1
- package/dist/private/aria-modal-polyfill/ariaModalPolyfill.mjs +7 -5
- package/dist/private/aria-modal-polyfill/ariaModalPolyfill.mjs.map +1 -1
- package/dist/private/autocomplete/useAutocomplete.cjs.map +1 -1
- package/dist/private/autocomplete/useAutocomplete.js.map +1 -1
- package/dist/private/autocomplete/useAutocomplete.mjs.map +1 -1
- package/dist/private/autocomplete/useSearchAutocomplete.cjs.map +1 -1
- package/dist/private/autocomplete/useSearchAutocomplete.js.map +1 -1
- package/dist/private/autocomplete/useSearchAutocomplete.mjs.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbItem.cjs.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbItem.js.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbItem.mjs.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbs.cjs.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbs.js.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbs.mjs.map +1 -1
- package/dist/private/button/useButton.cjs.map +1 -1
- package/dist/private/button/useButton.js.map +1 -1
- package/dist/private/button/useButton.mjs.map +1 -1
- package/dist/private/button/useToggleButton.cjs.map +1 -1
- package/dist/private/button/useToggleButton.js.map +1 -1
- package/dist/private/button/useToggleButton.mjs.map +1 -1
- package/dist/private/button/useToggleButtonGroup.cjs.map +1 -1
- package/dist/private/button/useToggleButtonGroup.js.map +1 -1
- package/dist/private/button/useToggleButtonGroup.mjs.map +1 -1
- package/dist/private/calendar/useCalendar.cjs.map +1 -1
- package/dist/private/calendar/useCalendar.js.map +1 -1
- package/dist/private/calendar/useCalendar.mjs.map +1 -1
- package/dist/private/calendar/useCalendarBase.cjs.map +1 -1
- package/dist/private/calendar/useCalendarBase.js.map +1 -1
- package/dist/private/calendar/useCalendarBase.mjs.map +1 -1
- package/dist/private/calendar/useCalendarCell.cjs +10 -14
- package/dist/private/calendar/useCalendarCell.cjs.map +1 -1
- package/dist/private/calendar/useCalendarCell.js +10 -14
- package/dist/private/calendar/useCalendarCell.js.map +1 -1
- package/dist/private/calendar/useCalendarCell.mjs +10 -14
- package/dist/private/calendar/useCalendarCell.mjs.map +1 -1
- package/dist/private/calendar/useCalendarGrid.cjs +9 -5
- package/dist/private/calendar/useCalendarGrid.cjs.map +1 -1
- package/dist/private/calendar/useCalendarGrid.js +10 -6
- package/dist/private/calendar/useCalendarGrid.js.map +1 -1
- package/dist/private/calendar/useCalendarGrid.mjs +10 -6
- package/dist/private/calendar/useCalendarGrid.mjs.map +1 -1
- package/dist/private/calendar/useCalendarHeading.cjs +56 -0
- package/dist/private/calendar/useCalendarHeading.cjs.map +1 -0
- package/dist/private/calendar/useCalendarHeading.js +52 -0
- package/dist/private/calendar/useCalendarHeading.js.map +1 -0
- package/dist/private/calendar/useCalendarHeading.mjs +51 -0
- package/dist/private/calendar/useCalendarHeading.mjs.map +1 -0
- package/dist/private/calendar/useCalendarMonthPicker.cjs +66 -0
- package/dist/private/calendar/useCalendarMonthPicker.cjs.map +1 -0
- package/dist/private/calendar/useCalendarMonthPicker.js +61 -0
- package/dist/private/calendar/useCalendarMonthPicker.js.map +1 -0
- package/dist/private/calendar/useCalendarMonthPicker.mjs +61 -0
- package/dist/private/calendar/useCalendarMonthPicker.mjs.map +1 -0
- package/dist/private/calendar/useCalendarYearPicker.cjs +90 -0
- package/dist/private/calendar/useCalendarYearPicker.cjs.map +1 -0
- package/dist/private/calendar/useCalendarYearPicker.js +86 -0
- package/dist/private/calendar/useCalendarYearPicker.js.map +1 -0
- package/dist/private/calendar/useCalendarYearPicker.mjs +85 -0
- package/dist/private/calendar/useCalendarYearPicker.mjs.map +1 -0
- package/dist/private/calendar/useRangeCalendar.cjs +1 -1
- package/dist/private/calendar/useRangeCalendar.cjs.map +1 -1
- package/dist/private/calendar/useRangeCalendar.js +1 -1
- package/dist/private/calendar/useRangeCalendar.js.map +1 -1
- package/dist/private/calendar/useRangeCalendar.mjs +1 -1
- package/dist/private/calendar/useRangeCalendar.mjs.map +1 -1
- package/dist/private/calendar/utils.cjs +20 -4
- package/dist/private/calendar/utils.cjs.map +1 -1
- package/dist/private/calendar/utils.js +22 -5
- package/dist/private/calendar/utils.js.map +1 -1
- package/dist/private/calendar/utils.mjs +20 -4
- package/dist/private/calendar/utils.mjs.map +1 -1
- package/dist/private/checkbox/useCheckbox.cjs +6 -35
- package/dist/private/checkbox/useCheckbox.cjs.map +1 -1
- package/dist/private/checkbox/useCheckbox.js +6 -35
- package/dist/private/checkbox/useCheckbox.js.map +1 -1
- package/dist/private/checkbox/useCheckbox.mjs +6 -35
- package/dist/private/checkbox/useCheckbox.mjs.map +1 -1
- package/dist/private/checkbox/useCheckboxGroup.cjs.map +1 -1
- package/dist/private/checkbox/useCheckboxGroup.js.map +1 -1
- package/dist/private/checkbox/useCheckboxGroup.mjs.map +1 -1
- package/dist/private/checkbox/useCheckboxGroupItem.cjs +1 -1
- package/dist/private/checkbox/useCheckboxGroupItem.cjs.map +1 -1
- package/dist/private/checkbox/useCheckboxGroupItem.js +1 -1
- package/dist/private/checkbox/useCheckboxGroupItem.js.map +1 -1
- package/dist/private/checkbox/useCheckboxGroupItem.mjs +1 -1
- package/dist/private/checkbox/useCheckboxGroupItem.mjs.map +1 -1
- package/dist/private/checkbox/utils.cjs.map +1 -1
- package/dist/private/checkbox/utils.js.map +1 -1
- package/dist/private/checkbox/utils.mjs.map +1 -1
- package/dist/private/collections/BaseCollection.cjs +4 -4
- package/dist/private/collections/BaseCollection.cjs.map +1 -1
- package/dist/private/collections/BaseCollection.js +4 -4
- package/dist/private/collections/BaseCollection.js.map +1 -1
- package/dist/private/collections/BaseCollection.mjs +4 -4
- package/dist/private/collections/BaseCollection.mjs.map +1 -1
- package/dist/private/collections/CollectionBuilder.cjs +5 -3
- package/dist/private/collections/CollectionBuilder.cjs.map +1 -1
- package/dist/private/collections/CollectionBuilder.js +5 -3
- package/dist/private/collections/CollectionBuilder.js.map +1 -1
- package/dist/private/collections/CollectionBuilder.mjs +5 -3
- package/dist/private/collections/CollectionBuilder.mjs.map +1 -1
- package/dist/private/collections/Document.cjs.map +1 -1
- package/dist/private/collections/Document.js.map +1 -1
- package/dist/private/collections/Document.mjs.map +1 -1
- package/dist/private/collections/Hidden.cjs.map +1 -1
- package/dist/private/collections/Hidden.js.map +1 -1
- package/dist/private/collections/Hidden.mjs.map +1 -1
- package/dist/private/collections/useCachedChildren.cjs +29 -8
- package/dist/private/collections/useCachedChildren.cjs.map +1 -1
- package/dist/private/collections/useCachedChildren.js +29 -8
- package/dist/private/collections/useCachedChildren.js.map +1 -1
- package/dist/private/collections/useCachedChildren.mjs +29 -8
- package/dist/private/collections/useCachedChildren.mjs.map +1 -1
- package/dist/private/color/useColorArea.cjs.map +1 -1
- package/dist/private/color/useColorArea.js.map +1 -1
- package/dist/private/color/useColorArea.mjs.map +1 -1
- package/dist/private/color/useColorAreaGradient.cjs +1 -1
- package/dist/private/color/useColorAreaGradient.cjs.map +1 -1
- package/dist/private/color/useColorAreaGradient.js +1 -1
- package/dist/private/color/useColorAreaGradient.js.map +1 -1
- package/dist/private/color/useColorAreaGradient.mjs +1 -1
- package/dist/private/color/useColorAreaGradient.mjs.map +1 -1
- package/dist/private/color/useColorChannelField.cjs.map +1 -1
- package/dist/private/color/useColorChannelField.js.map +1 -1
- package/dist/private/color/useColorChannelField.mjs.map +1 -1
- package/dist/private/color/useColorField.cjs +1 -1
- package/dist/private/color/useColorField.cjs.map +1 -1
- package/dist/private/color/useColorField.js +1 -1
- package/dist/private/color/useColorField.js.map +1 -1
- package/dist/private/color/useColorField.mjs +1 -1
- package/dist/private/color/useColorField.mjs.map +1 -1
- package/dist/private/color/useColorSlider.cjs +2 -2
- package/dist/private/color/useColorSlider.cjs.map +1 -1
- package/dist/private/color/useColorSlider.js +2 -2
- package/dist/private/color/useColorSlider.js.map +1 -1
- package/dist/private/color/useColorSlider.mjs +2 -2
- package/dist/private/color/useColorSlider.mjs.map +1 -1
- package/dist/private/color/useColorSwatch.cjs.map +1 -1
- package/dist/private/color/useColorSwatch.js.map +1 -1
- package/dist/private/color/useColorSwatch.mjs.map +1 -1
- package/dist/private/color/useColorWheel.cjs.map +1 -1
- package/dist/private/color/useColorWheel.js.map +1 -1
- package/dist/private/color/useColorWheel.mjs.map +1 -1
- package/dist/private/combobox/useComboBox.cjs +3 -3
- package/dist/private/combobox/useComboBox.cjs.map +1 -1
- package/dist/private/combobox/useComboBox.js +3 -3
- package/dist/private/combobox/useComboBox.js.map +1 -1
- package/dist/private/combobox/useComboBox.mjs +3 -3
- package/dist/private/combobox/useComboBox.mjs.map +1 -1
- package/dist/private/datepicker/useDateField.cjs.map +1 -1
- package/dist/private/datepicker/useDateField.js.map +1 -1
- package/dist/private/datepicker/useDateField.mjs.map +1 -1
- package/dist/private/datepicker/useDatePicker.cjs.map +1 -1
- package/dist/private/datepicker/useDatePicker.js.map +1 -1
- package/dist/private/datepicker/useDatePicker.mjs.map +1 -1
- package/dist/private/datepicker/useDatePickerGroup.cjs.map +1 -1
- package/dist/private/datepicker/useDatePickerGroup.js.map +1 -1
- package/dist/private/datepicker/useDatePickerGroup.mjs.map +1 -1
- package/dist/private/datepicker/useDateRangePicker.cjs.map +1 -1
- package/dist/private/datepicker/useDateRangePicker.js.map +1 -1
- package/dist/private/datepicker/useDateRangePicker.mjs.map +1 -1
- package/dist/private/datepicker/useDateSegment.cjs +2 -2
- package/dist/private/datepicker/useDateSegment.cjs.map +1 -1
- package/dist/private/datepicker/useDateSegment.js +2 -2
- package/dist/private/datepicker/useDateSegment.js.map +1 -1
- package/dist/private/datepicker/useDateSegment.mjs +2 -2
- package/dist/private/datepicker/useDateSegment.mjs.map +1 -1
- package/dist/private/datepicker/useDisplayNames.cjs.map +1 -1
- package/dist/private/datepicker/useDisplayNames.js.map +1 -1
- package/dist/private/datepicker/useDisplayNames.mjs.map +1 -1
- package/dist/private/dialog/useDialog.cjs.map +1 -1
- package/dist/private/dialog/useDialog.js.map +1 -1
- package/dist/private/dialog/useDialog.mjs.map +1 -1
- package/dist/private/disclosure/useDisclosure.cjs.map +1 -1
- package/dist/private/disclosure/useDisclosure.js.map +1 -1
- package/dist/private/disclosure/useDisclosure.mjs.map +1 -1
- package/dist/private/dnd/DragManager.cjs.map +1 -1
- package/dist/private/dnd/DragManager.js.map +1 -1
- package/dist/private/dnd/DragManager.mjs.map +1 -1
- package/dist/private/dnd/DragPreview.cjs.map +1 -1
- package/dist/private/dnd/DragPreview.js.map +1 -1
- package/dist/private/dnd/DragPreview.mjs.map +1 -1
- package/dist/private/dnd/DropTargetKeyboardNavigation.cjs +16 -4
- package/dist/private/dnd/DropTargetKeyboardNavigation.cjs.map +1 -1
- package/dist/private/dnd/DropTargetKeyboardNavigation.js +16 -4
- package/dist/private/dnd/DropTargetKeyboardNavigation.js.map +1 -1
- package/dist/private/dnd/DropTargetKeyboardNavigation.mjs +16 -4
- package/dist/private/dnd/DropTargetKeyboardNavigation.mjs.map +1 -1
- package/dist/private/dnd/ListDropTargetDelegate.cjs.map +1 -1
- package/dist/private/dnd/ListDropTargetDelegate.js.map +1 -1
- package/dist/private/dnd/ListDropTargetDelegate.mjs.map +1 -1
- package/dist/private/dnd/constants.cjs.map +1 -1
- package/dist/private/dnd/constants.js.map +1 -1
- package/dist/private/dnd/constants.mjs.map +1 -1
- package/dist/private/dnd/useAutoScroll.cjs.map +1 -1
- package/dist/private/dnd/useAutoScroll.js.map +1 -1
- package/dist/private/dnd/useAutoScroll.mjs.map +1 -1
- package/dist/private/dnd/useClipboard.cjs.map +1 -1
- package/dist/private/dnd/useClipboard.js.map +1 -1
- package/dist/private/dnd/useClipboard.mjs.map +1 -1
- package/dist/private/dnd/useDrag.cjs.map +1 -1
- package/dist/private/dnd/useDrag.js.map +1 -1
- package/dist/private/dnd/useDrag.mjs.map +1 -1
- package/dist/private/dnd/useDraggableCollection.cjs.map +1 -1
- package/dist/private/dnd/useDraggableCollection.js.map +1 -1
- package/dist/private/dnd/useDraggableCollection.mjs.map +1 -1
- package/dist/private/dnd/useDraggableItem.cjs.map +1 -1
- package/dist/private/dnd/useDraggableItem.js.map +1 -1
- package/dist/private/dnd/useDraggableItem.mjs.map +1 -1
- package/dist/private/dnd/useDrop.cjs.map +1 -1
- package/dist/private/dnd/useDrop.js.map +1 -1
- package/dist/private/dnd/useDrop.mjs.map +1 -1
- package/dist/private/dnd/useDropIndicator.cjs.map +1 -1
- package/dist/private/dnd/useDropIndicator.js.map +1 -1
- package/dist/private/dnd/useDropIndicator.mjs.map +1 -1
- package/dist/private/dnd/useDroppableCollection.cjs.map +1 -1
- package/dist/private/dnd/useDroppableCollection.js.map +1 -1
- package/dist/private/dnd/useDroppableCollection.mjs.map +1 -1
- package/dist/private/dnd/useDroppableItem.cjs.map +1 -1
- package/dist/private/dnd/useDroppableItem.js.map +1 -1
- package/dist/private/dnd/useDroppableItem.mjs.map +1 -1
- package/dist/private/dnd/useVirtualDrop.cjs.map +1 -1
- package/dist/private/dnd/useVirtualDrop.js.map +1 -1
- package/dist/private/dnd/useVirtualDrop.mjs.map +1 -1
- package/dist/private/dnd/utils.cjs +1 -1
- package/dist/private/dnd/utils.cjs.map +1 -1
- package/dist/private/dnd/utils.js +1 -1
- package/dist/private/dnd/utils.js.map +1 -1
- package/dist/private/dnd/utils.mjs +1 -1
- package/dist/private/dnd/utils.mjs.map +1 -1
- package/dist/private/focus/FocusRing.cjs.map +1 -1
- package/dist/private/focus/FocusRing.js.map +1 -1
- package/dist/private/focus/FocusRing.mjs.map +1 -1
- package/dist/private/focus/FocusScope.cjs +4 -1
- package/dist/private/focus/FocusScope.cjs.map +1 -1
- package/dist/private/focus/FocusScope.js +4 -1
- package/dist/private/focus/FocusScope.js.map +1 -1
- package/dist/private/focus/FocusScope.mjs +4 -1
- package/dist/private/focus/FocusScope.mjs.map +1 -1
- package/dist/private/focus/useFocusRing.cjs.map +1 -1
- package/dist/private/focus/useFocusRing.js.map +1 -1
- package/dist/private/focus/useFocusRing.mjs.map +1 -1
- package/dist/private/focus/useHasTabbableChild.cjs.map +1 -1
- package/dist/private/focus/useHasTabbableChild.js.map +1 -1
- package/dist/private/focus/useHasTabbableChild.mjs.map +1 -1
- package/dist/private/form/useFormValidation.cjs.map +1 -1
- package/dist/private/form/useFormValidation.js.map +1 -1
- package/dist/private/form/useFormValidation.mjs.map +1 -1
- package/dist/private/grid/GridKeyboardDelegate.cjs +9 -9
- package/dist/private/grid/GridKeyboardDelegate.cjs.map +1 -1
- package/dist/private/grid/GridKeyboardDelegate.js +10 -10
- package/dist/private/grid/GridKeyboardDelegate.js.map +1 -1
- package/dist/private/grid/GridKeyboardDelegate.mjs +9 -9
- package/dist/private/grid/GridKeyboardDelegate.mjs.map +1 -1
- package/dist/private/grid/useGrid.cjs.map +1 -1
- package/dist/private/grid/useGrid.js.map +1 -1
- package/dist/private/grid/useGrid.mjs.map +1 -1
- package/dist/private/grid/useGridCell.cjs.map +1 -1
- package/dist/private/grid/useGridCell.js.map +1 -1
- package/dist/private/grid/useGridCell.mjs.map +1 -1
- package/dist/private/grid/useGridRow.cjs.map +1 -1
- package/dist/private/grid/useGridRow.js.map +1 -1
- package/dist/private/grid/useGridRow.mjs.map +1 -1
- package/dist/private/grid/useGridRowGroup.cjs.map +1 -1
- package/dist/private/grid/useGridRowGroup.js.map +1 -1
- package/dist/private/grid/useGridRowGroup.mjs.map +1 -1
- package/dist/private/grid/useGridSelectionAnnouncement.cjs.map +1 -1
- package/dist/private/grid/useGridSelectionAnnouncement.js.map +1 -1
- package/dist/private/grid/useGridSelectionAnnouncement.mjs.map +1 -1
- package/dist/private/grid/useGridSelectionCheckbox.cjs.map +1 -1
- package/dist/private/grid/useGridSelectionCheckbox.js.map +1 -1
- package/dist/private/grid/useGridSelectionCheckbox.mjs.map +1 -1
- package/dist/private/grid/useHighlightSelectionDescription.cjs.map +1 -1
- package/dist/private/grid/useHighlightSelectionDescription.js.map +1 -1
- package/dist/private/grid/useHighlightSelectionDescription.mjs.map +1 -1
- package/dist/private/grid/utils.cjs.map +1 -1
- package/dist/private/grid/utils.js.map +1 -1
- package/dist/private/grid/utils.mjs.map +1 -1
- package/dist/private/gridlist/useGridList.cjs.map +1 -1
- package/dist/private/gridlist/useGridList.js.map +1 -1
- package/dist/private/gridlist/useGridList.mjs.map +1 -1
- package/dist/private/gridlist/useGridListItem.cjs +5 -3
- package/dist/private/gridlist/useGridListItem.cjs.map +1 -1
- package/dist/private/gridlist/useGridListItem.js +6 -3
- package/dist/private/gridlist/useGridListItem.js.map +1 -1
- package/dist/private/gridlist/useGridListItem.mjs +5 -3
- package/dist/private/gridlist/useGridListItem.mjs.map +1 -1
- package/dist/private/gridlist/useGridListSection.cjs +3 -1
- package/dist/private/gridlist/useGridListSection.cjs.map +1 -1
- package/dist/private/gridlist/useGridListSection.js +3 -1
- package/dist/private/gridlist/useGridListSection.js.map +1 -1
- package/dist/private/gridlist/useGridListSection.mjs +3 -1
- package/dist/private/gridlist/useGridListSection.mjs.map +1 -1
- package/dist/private/gridlist/useGridListSelectionCheckbox.cjs.map +1 -1
- package/dist/private/gridlist/useGridListSelectionCheckbox.js.map +1 -1
- package/dist/private/gridlist/useGridListSelectionCheckbox.mjs.map +1 -1
- package/dist/private/gridlist/utils.cjs.map +1 -1
- package/dist/private/gridlist/utils.js.map +1 -1
- package/dist/private/gridlist/utils.mjs.map +1 -1
- package/dist/private/i18n/I18nProvider.cjs.map +1 -1
- package/dist/private/i18n/I18nProvider.js.map +1 -1
- package/dist/private/i18n/I18nProvider.mjs.map +1 -1
- package/dist/private/i18n/server.cjs.map +1 -1
- package/dist/private/i18n/server.js.map +1 -1
- package/dist/private/i18n/server.mjs.map +1 -1
- package/dist/private/i18n/useCollator.cjs.map +1 -1
- package/dist/private/i18n/useCollator.js.map +1 -1
- package/dist/private/i18n/useCollator.mjs.map +1 -1
- package/dist/private/i18n/useDateFormatter.cjs.map +1 -1
- package/dist/private/i18n/useDateFormatter.js.map +1 -1
- package/dist/private/i18n/useDateFormatter.mjs.map +1 -1
- package/dist/private/i18n/useDefaultLocale.cjs +2 -1
- package/dist/private/i18n/useDefaultLocale.cjs.map +1 -1
- package/dist/private/i18n/useDefaultLocale.js +2 -1
- package/dist/private/i18n/useDefaultLocale.js.map +1 -1
- package/dist/private/i18n/useDefaultLocale.mjs +2 -1
- package/dist/private/i18n/useDefaultLocale.mjs.map +1 -1
- package/dist/private/i18n/useFilter.cjs.map +1 -1
- package/dist/private/i18n/useFilter.js.map +1 -1
- package/dist/private/i18n/useFilter.mjs.map +1 -1
- package/dist/private/i18n/useListFormatter.cjs.map +1 -1
- package/dist/private/i18n/useListFormatter.js.map +1 -1
- package/dist/private/i18n/useListFormatter.mjs.map +1 -1
- package/dist/private/i18n/useLocalizedStringFormatter.cjs.map +1 -1
- package/dist/private/i18n/useLocalizedStringFormatter.js.map +1 -1
- package/dist/private/i18n/useLocalizedStringFormatter.mjs.map +1 -1
- package/dist/private/i18n/useNumberFormatter.cjs.map +1 -1
- package/dist/private/i18n/useNumberFormatter.js.map +1 -1
- package/dist/private/i18n/useNumberFormatter.mjs.map +1 -1
- package/dist/private/i18n/utils.cjs +2 -2
- package/dist/private/i18n/utils.cjs.map +1 -1
- package/dist/private/i18n/utils.js +2 -2
- package/dist/private/i18n/utils.js.map +1 -1
- package/dist/private/i18n/utils.mjs +2 -2
- package/dist/private/i18n/utils.mjs.map +1 -1
- package/dist/private/interactions/PressResponder.cjs.map +1 -1
- package/dist/private/interactions/PressResponder.js.map +1 -1
- package/dist/private/interactions/PressResponder.mjs.map +1 -1
- package/dist/private/interactions/Pressable.cjs.map +1 -1
- package/dist/private/interactions/Pressable.js.map +1 -1
- package/dist/private/interactions/Pressable.mjs.map +1 -1
- package/dist/private/interactions/context.cjs.map +1 -1
- package/dist/private/interactions/context.js.map +1 -1
- package/dist/private/interactions/context.mjs.map +1 -1
- package/dist/private/interactions/createEventHandler.cjs.map +1 -1
- package/dist/private/interactions/createEventHandler.js.map +1 -1
- package/dist/private/interactions/createEventHandler.mjs.map +1 -1
- package/dist/private/interactions/focusSafely.cjs.map +1 -1
- package/dist/private/interactions/focusSafely.js.map +1 -1
- package/dist/private/interactions/focusSafely.mjs.map +1 -1
- package/dist/private/interactions/textSelection.cjs.map +1 -1
- package/dist/private/interactions/textSelection.js.map +1 -1
- package/dist/private/interactions/textSelection.mjs.map +1 -1
- package/dist/private/interactions/useFocus.cjs.map +1 -1
- package/dist/private/interactions/useFocus.js.map +1 -1
- package/dist/private/interactions/useFocus.mjs.map +1 -1
- package/dist/private/interactions/useFocusVisible.cjs +4 -3
- package/dist/private/interactions/useFocusVisible.cjs.map +1 -1
- package/dist/private/interactions/useFocusVisible.js +4 -3
- package/dist/private/interactions/useFocusVisible.js.map +1 -1
- package/dist/private/interactions/useFocusVisible.mjs +4 -3
- package/dist/private/interactions/useFocusVisible.mjs.map +1 -1
- package/dist/private/interactions/useFocusWithin.cjs.map +1 -1
- package/dist/private/interactions/useFocusWithin.js.map +1 -1
- package/dist/private/interactions/useFocusWithin.mjs.map +1 -1
- package/dist/private/interactions/useFocusable.cjs.map +1 -1
- package/dist/private/interactions/useFocusable.js.map +1 -1
- package/dist/private/interactions/useFocusable.mjs.map +1 -1
- package/dist/private/interactions/useHover.cjs.map +1 -1
- package/dist/private/interactions/useHover.js.map +1 -1
- package/dist/private/interactions/useHover.mjs.map +1 -1
- package/dist/private/interactions/useInteractOutside.cjs.map +1 -1
- package/dist/private/interactions/useInteractOutside.js.map +1 -1
- package/dist/private/interactions/useInteractOutside.mjs.map +1 -1
- package/dist/private/interactions/useKeyboard.cjs.map +1 -1
- package/dist/private/interactions/useKeyboard.js.map +1 -1
- package/dist/private/interactions/useKeyboard.mjs.map +1 -1
- package/dist/private/interactions/useLongPress.cjs.map +1 -1
- package/dist/private/interactions/useLongPress.js.map +1 -1
- package/dist/private/interactions/useLongPress.mjs.map +1 -1
- package/dist/private/interactions/useMove.cjs.map +1 -1
- package/dist/private/interactions/useMove.js.map +1 -1
- package/dist/private/interactions/useMove.mjs.map +1 -1
- package/dist/private/interactions/usePress.cjs +11 -0
- package/dist/private/interactions/usePress.cjs.map +1 -1
- package/dist/private/interactions/usePress.js +12 -1
- package/dist/private/interactions/usePress.js.map +1 -1
- package/dist/private/interactions/usePress.mjs +12 -1
- package/dist/private/interactions/usePress.mjs.map +1 -1
- package/dist/private/interactions/useScrollWheel.cjs.map +1 -1
- package/dist/private/interactions/useScrollWheel.js.map +1 -1
- package/dist/private/interactions/useScrollWheel.mjs.map +1 -1
- package/dist/private/interactions/utils.cjs.map +1 -1
- package/dist/private/interactions/utils.js.map +1 -1
- package/dist/private/interactions/utils.mjs.map +1 -1
- package/dist/private/intl/tag/en-US.cjs.map +1 -1
- package/dist/private/intl/tag/en-US.js.map +1 -1
- package/dist/private/intl/tag/en-US.mjs.map +1 -1
- package/dist/private/label/useField.cjs.map +1 -1
- package/dist/private/label/useField.js.map +1 -1
- package/dist/private/label/useField.mjs.map +1 -1
- package/dist/private/label/useLabel.cjs.map +1 -1
- package/dist/private/label/useLabel.js.map +1 -1
- package/dist/private/label/useLabel.mjs.map +1 -1
- package/dist/private/landmark/useLandmark.cjs +2 -1
- package/dist/private/landmark/useLandmark.cjs.map +1 -1
- package/dist/private/landmark/useLandmark.js +2 -1
- package/dist/private/landmark/useLandmark.js.map +1 -1
- package/dist/private/landmark/useLandmark.mjs +2 -1
- package/dist/private/landmark/useLandmark.mjs.map +1 -1
- package/dist/private/link/useLink.cjs.map +1 -1
- package/dist/private/link/useLink.js.map +1 -1
- package/dist/private/link/useLink.mjs.map +1 -1
- package/dist/private/listbox/useListBox.cjs.map +1 -1
- package/dist/private/listbox/useListBox.js.map +1 -1
- package/dist/private/listbox/useListBox.mjs.map +1 -1
- package/dist/private/listbox/useListBoxSection.cjs.map +1 -1
- package/dist/private/listbox/useListBoxSection.js.map +1 -1
- package/dist/private/listbox/useListBoxSection.mjs.map +1 -1
- package/dist/private/listbox/useOption.cjs.map +1 -1
- package/dist/private/listbox/useOption.js.map +1 -1
- package/dist/private/listbox/useOption.mjs.map +1 -1
- package/dist/private/listbox/utils.cjs.map +1 -1
- package/dist/private/listbox/utils.js.map +1 -1
- package/dist/private/listbox/utils.mjs.map +1 -1
- package/dist/private/live-announcer/LiveAnnouncer.cjs +2 -2
- package/dist/private/live-announcer/LiveAnnouncer.cjs.map +1 -1
- package/dist/private/live-announcer/LiveAnnouncer.js +2 -2
- package/dist/private/live-announcer/LiveAnnouncer.js.map +1 -1
- package/dist/private/live-announcer/LiveAnnouncer.mjs +2 -2
- package/dist/private/live-announcer/LiveAnnouncer.mjs.map +1 -1
- package/dist/private/menu/useMenu.cjs.map +1 -1
- package/dist/private/menu/useMenu.js.map +1 -1
- package/dist/private/menu/useMenu.mjs.map +1 -1
- package/dist/private/menu/useMenuItem.cjs.map +1 -1
- package/dist/private/menu/useMenuItem.js.map +1 -1
- package/dist/private/menu/useMenuItem.mjs.map +1 -1
- package/dist/private/menu/useMenuSection.cjs.map +1 -1
- package/dist/private/menu/useMenuSection.js.map +1 -1
- package/dist/private/menu/useMenuSection.mjs.map +1 -1
- package/dist/private/menu/useMenuTrigger.cjs.map +1 -1
- package/dist/private/menu/useMenuTrigger.js.map +1 -1
- package/dist/private/menu/useMenuTrigger.mjs.map +1 -1
- package/dist/private/menu/useSafelyMouseToSubmenu.cjs.map +1 -1
- package/dist/private/menu/useSafelyMouseToSubmenu.js.map +1 -1
- package/dist/private/menu/useSafelyMouseToSubmenu.mjs.map +1 -1
- package/dist/private/menu/useSubmenuTrigger.cjs.map +1 -1
- package/dist/private/menu/useSubmenuTrigger.js.map +1 -1
- package/dist/private/menu/useSubmenuTrigger.mjs.map +1 -1
- package/dist/private/menu/utils.cjs.map +1 -1
- package/dist/private/menu/utils.js.map +1 -1
- package/dist/private/menu/utils.mjs.map +1 -1
- package/dist/private/meter/useMeter.cjs.map +1 -1
- package/dist/private/meter/useMeter.js.map +1 -1
- package/dist/private/meter/useMeter.mjs.map +1 -1
- package/dist/private/numberfield/useNumberField.cjs.map +1 -1
- package/dist/private/numberfield/useNumberField.js.map +1 -1
- package/dist/private/numberfield/useNumberField.mjs.map +1 -1
- package/dist/private/overlays/DismissButton.cjs.map +1 -1
- package/dist/private/overlays/DismissButton.js.map +1 -1
- package/dist/private/overlays/DismissButton.mjs.map +1 -1
- package/dist/private/overlays/Overlay.cjs.map +1 -1
- package/dist/private/overlays/Overlay.js.map +1 -1
- package/dist/private/overlays/Overlay.mjs.map +1 -1
- package/dist/private/overlays/PortalProvider.cjs.map +1 -1
- package/dist/private/overlays/PortalProvider.js.map +1 -1
- package/dist/private/overlays/PortalProvider.mjs.map +1 -1
- package/dist/private/overlays/ariaHideOutside.cjs.map +1 -1
- package/dist/private/overlays/ariaHideOutside.js.map +1 -1
- package/dist/private/overlays/ariaHideOutside.mjs.map +1 -1
- package/dist/private/overlays/calculatePosition.cjs +12 -13
- package/dist/private/overlays/calculatePosition.cjs.map +1 -1
- package/dist/private/overlays/calculatePosition.js +13 -14
- package/dist/private/overlays/calculatePosition.js.map +1 -1
- package/dist/private/overlays/calculatePosition.mjs +12 -13
- package/dist/private/overlays/calculatePosition.mjs.map +1 -1
- package/dist/private/overlays/useCloseOnScroll.cjs.map +1 -1
- package/dist/private/overlays/useCloseOnScroll.js.map +1 -1
- package/dist/private/overlays/useCloseOnScroll.mjs.map +1 -1
- package/dist/private/overlays/useModal.cjs.map +1 -1
- package/dist/private/overlays/useModal.js.map +1 -1
- package/dist/private/overlays/useModal.mjs.map +1 -1
- package/dist/private/overlays/useModalOverlay.cjs.map +1 -1
- package/dist/private/overlays/useModalOverlay.js.map +1 -1
- package/dist/private/overlays/useModalOverlay.mjs.map +1 -1
- package/dist/private/overlays/useOverlay.cjs.map +1 -1
- package/dist/private/overlays/useOverlay.js.map +1 -1
- package/dist/private/overlays/useOverlay.mjs.map +1 -1
- package/dist/private/overlays/useOverlayPosition.cjs.map +1 -1
- package/dist/private/overlays/useOverlayPosition.js.map +1 -1
- package/dist/private/overlays/useOverlayPosition.mjs.map +1 -1
- package/dist/private/overlays/useOverlayTrigger.cjs.map +1 -1
- package/dist/private/overlays/useOverlayTrigger.js.map +1 -1
- package/dist/private/overlays/useOverlayTrigger.mjs.map +1 -1
- package/dist/private/overlays/usePopover.cjs.map +1 -1
- package/dist/private/overlays/usePopover.js.map +1 -1
- package/dist/private/overlays/usePopover.mjs.map +1 -1
- package/dist/private/overlays/usePreventScroll.cjs.map +1 -1
- package/dist/private/overlays/usePreventScroll.js.map +1 -1
- package/dist/private/overlays/usePreventScroll.mjs.map +1 -1
- package/dist/private/progress/useProgressBar.cjs.map +1 -1
- package/dist/private/progress/useProgressBar.js.map +1 -1
- package/dist/private/progress/useProgressBar.mjs.map +1 -1
- package/dist/private/radio/useRadio.cjs +5 -0
- package/dist/private/radio/useRadio.cjs.map +1 -1
- package/dist/private/radio/useRadio.js +5 -0
- package/dist/private/radio/useRadio.js.map +1 -1
- package/dist/private/radio/useRadio.mjs +5 -0
- package/dist/private/radio/useRadio.mjs.map +1 -1
- package/dist/private/radio/useRadioGroup.cjs.map +1 -1
- package/dist/private/radio/useRadioGroup.js.map +1 -1
- package/dist/private/radio/useRadioGroup.mjs.map +1 -1
- package/dist/private/radio/utils.cjs.map +1 -1
- package/dist/private/radio/utils.js.map +1 -1
- package/dist/private/radio/utils.mjs.map +1 -1
- package/dist/private/searchfield/useSearchField.cjs.map +1 -1
- package/dist/private/searchfield/useSearchField.js.map +1 -1
- package/dist/private/searchfield/useSearchField.mjs.map +1 -1
- package/dist/private/select/HiddenSelect.cjs +2 -1
- package/dist/private/select/HiddenSelect.cjs.map +1 -1
- package/dist/private/select/HiddenSelect.js +2 -1
- package/dist/private/select/HiddenSelect.js.map +1 -1
- package/dist/private/select/HiddenSelect.mjs +2 -1
- package/dist/private/select/HiddenSelect.mjs.map +1 -1
- package/dist/private/select/useSelect.cjs +2 -2
- package/dist/private/select/useSelect.cjs.map +1 -1
- package/dist/private/select/useSelect.js +2 -2
- package/dist/private/select/useSelect.js.map +1 -1
- package/dist/private/select/useSelect.mjs +2 -2
- package/dist/private/select/useSelect.mjs.map +1 -1
- package/dist/private/selection/ListKeyboardDelegate.cjs +25 -25
- package/dist/private/selection/ListKeyboardDelegate.cjs.map +1 -1
- package/dist/private/selection/ListKeyboardDelegate.js +26 -26
- package/dist/private/selection/ListKeyboardDelegate.js.map +1 -1
- package/dist/private/selection/ListKeyboardDelegate.mjs +25 -25
- package/dist/private/selection/ListKeyboardDelegate.mjs.map +1 -1
- package/dist/private/selection/useSelectableCollection.cjs +1 -0
- package/dist/private/selection/useSelectableCollection.cjs.map +1 -1
- package/dist/private/selection/useSelectableCollection.js +1 -0
- package/dist/private/selection/useSelectableCollection.js.map +1 -1
- package/dist/private/selection/useSelectableCollection.mjs +1 -0
- package/dist/private/selection/useSelectableCollection.mjs.map +1 -1
- package/dist/private/selection/useSelectableItem.cjs.map +1 -1
- package/dist/private/selection/useSelectableItem.js.map +1 -1
- package/dist/private/selection/useSelectableItem.mjs.map +1 -1
- package/dist/private/selection/useSelectableList.cjs.map +1 -1
- package/dist/private/selection/useSelectableList.js.map +1 -1
- package/dist/private/selection/useSelectableList.mjs.map +1 -1
- package/dist/private/selection/useTypeSelect.cjs.map +1 -1
- package/dist/private/selection/useTypeSelect.js.map +1 -1
- package/dist/private/selection/useTypeSelect.mjs.map +1 -1
- package/dist/private/selection/utils.cjs.map +1 -1
- package/dist/private/selection/utils.js.map +1 -1
- package/dist/private/selection/utils.mjs.map +1 -1
- package/dist/private/separator/useSeparator.cjs.map +1 -1
- package/dist/private/separator/useSeparator.js.map +1 -1
- package/dist/private/separator/useSeparator.mjs.map +1 -1
- package/dist/private/slider/useSlider.cjs +4 -2
- package/dist/private/slider/useSlider.cjs.map +1 -1
- package/dist/private/slider/useSlider.js +4 -2
- package/dist/private/slider/useSlider.js.map +1 -1
- package/dist/private/slider/useSlider.mjs +4 -2
- package/dist/private/slider/useSlider.mjs.map +1 -1
- package/dist/private/slider/useSliderThumb.cjs.map +1 -1
- package/dist/private/slider/useSliderThumb.js.map +1 -1
- package/dist/private/slider/useSliderThumb.mjs.map +1 -1
- package/dist/private/slider/utils.cjs.map +1 -1
- package/dist/private/slider/utils.js.map +1 -1
- package/dist/private/slider/utils.mjs.map +1 -1
- package/dist/private/spinbutton/useSpinButton.cjs +2 -0
- package/dist/private/spinbutton/useSpinButton.cjs.map +1 -1
- package/dist/private/spinbutton/useSpinButton.js +2 -0
- package/dist/private/spinbutton/useSpinButton.js.map +1 -1
- package/dist/private/spinbutton/useSpinButton.mjs +2 -0
- package/dist/private/spinbutton/useSpinButton.mjs.map +1 -1
- package/dist/private/ssr/SSRProvider.cjs +6 -6
- package/dist/private/ssr/SSRProvider.cjs.map +1 -1
- package/dist/private/ssr/SSRProvider.js +6 -6
- package/dist/private/ssr/SSRProvider.js.map +1 -1
- package/dist/private/ssr/SSRProvider.mjs +6 -6
- package/dist/private/ssr/SSRProvider.mjs.map +1 -1
- package/dist/private/steplist/useStepList.cjs.map +1 -1
- package/dist/private/steplist/useStepList.js.map +1 -1
- package/dist/private/steplist/useStepList.mjs.map +1 -1
- package/dist/private/steplist/useStepListItem.cjs.map +1 -1
- package/dist/private/steplist/useStepListItem.js.map +1 -1
- package/dist/private/steplist/useStepListItem.mjs.map +1 -1
- package/dist/private/switch/useSwitch.cjs +2 -4
- package/dist/private/switch/useSwitch.cjs.map +1 -1
- package/dist/private/switch/useSwitch.js +2 -4
- package/dist/private/switch/useSwitch.js.map +1 -1
- package/dist/private/switch/useSwitch.mjs +2 -4
- package/dist/private/switch/useSwitch.mjs.map +1 -1
- package/dist/private/table/TableKeyboardDelegate.cjs +4 -4
- package/dist/private/table/TableKeyboardDelegate.cjs.map +1 -1
- package/dist/private/table/TableKeyboardDelegate.js +4 -4
- package/dist/private/table/TableKeyboardDelegate.js.map +1 -1
- package/dist/private/table/TableKeyboardDelegate.mjs +4 -4
- package/dist/private/table/TableKeyboardDelegate.mjs.map +1 -1
- package/dist/private/table/useTable.cjs.map +1 -1
- package/dist/private/table/useTable.js.map +1 -1
- package/dist/private/table/useTable.mjs.map +1 -1
- package/dist/private/table/useTableCell.cjs.map +1 -1
- package/dist/private/table/useTableCell.js.map +1 -1
- package/dist/private/table/useTableCell.mjs.map +1 -1
- package/dist/private/table/useTableColumnHeader.cjs.map +1 -1
- package/dist/private/table/useTableColumnHeader.js.map +1 -1
- package/dist/private/table/useTableColumnHeader.mjs.map +1 -1
- package/dist/private/table/useTableColumnResize.cjs +1 -1
- package/dist/private/table/useTableColumnResize.cjs.map +1 -1
- package/dist/private/table/useTableColumnResize.js +1 -1
- package/dist/private/table/useTableColumnResize.js.map +1 -1
- package/dist/private/table/useTableColumnResize.mjs +1 -1
- package/dist/private/table/useTableColumnResize.mjs.map +1 -1
- package/dist/private/table/useTableHeaderRow.cjs +2 -1
- package/dist/private/table/useTableHeaderRow.cjs.map +1 -1
- package/dist/private/table/useTableHeaderRow.js +2 -1
- package/dist/private/table/useTableHeaderRow.js.map +1 -1
- package/dist/private/table/useTableHeaderRow.mjs +2 -1
- package/dist/private/table/useTableHeaderRow.mjs.map +1 -1
- package/dist/private/table/useTableRow.cjs +2 -2
- package/dist/private/table/useTableRow.cjs.map +1 -1
- package/dist/private/table/useTableRow.js +2 -2
- package/dist/private/table/useTableRow.js.map +1 -1
- package/dist/private/table/useTableRow.mjs +2 -2
- package/dist/private/table/useTableRow.mjs.map +1 -1
- package/dist/private/table/useTableSelectionCheckbox.cjs.map +1 -1
- package/dist/private/table/useTableSelectionCheckbox.js.map +1 -1
- package/dist/private/table/useTableSelectionCheckbox.mjs.map +1 -1
- package/dist/private/table/utils.cjs.map +1 -1
- package/dist/private/table/utils.js.map +1 -1
- package/dist/private/table/utils.mjs.map +1 -1
- package/dist/private/tabs/TabsKeyboardDelegate.cjs.map +1 -1
- package/dist/private/tabs/TabsKeyboardDelegate.js.map +1 -1
- package/dist/private/tabs/TabsKeyboardDelegate.mjs.map +1 -1
- package/dist/private/tabs/useTab.cjs.map +1 -1
- package/dist/private/tabs/useTab.js.map +1 -1
- package/dist/private/tabs/useTab.mjs.map +1 -1
- package/dist/private/tabs/useTabList.cjs +10 -10
- package/dist/private/tabs/useTabList.cjs.map +1 -1
- package/dist/private/tabs/useTabList.js +10 -10
- package/dist/private/tabs/useTabList.js.map +1 -1
- package/dist/private/tabs/useTabList.mjs +10 -10
- package/dist/private/tabs/useTabList.mjs.map +1 -1
- package/dist/private/tabs/useTabPanel.cjs.map +1 -1
- package/dist/private/tabs/useTabPanel.js.map +1 -1
- package/dist/private/tabs/useTabPanel.mjs.map +1 -1
- package/dist/private/tabs/utils.cjs.map +1 -1
- package/dist/private/tabs/utils.js.map +1 -1
- package/dist/private/tabs/utils.mjs.map +1 -1
- package/dist/private/tag/useTag.cjs.map +1 -1
- package/dist/private/tag/useTag.js.map +1 -1
- package/dist/private/tag/useTag.mjs.map +1 -1
- package/dist/private/tag/useTagGroup.cjs.map +1 -1
- package/dist/private/tag/useTagGroup.js.map +1 -1
- package/dist/private/tag/useTagGroup.mjs.map +1 -1
- package/dist/private/textfield/useFormattedTextField.cjs.map +1 -1
- package/dist/private/textfield/useFormattedTextField.js.map +1 -1
- package/dist/private/textfield/useFormattedTextField.mjs.map +1 -1
- package/dist/private/textfield/useTextField.cjs.map +1 -1
- package/dist/private/textfield/useTextField.js.map +1 -1
- package/dist/private/textfield/useTextField.mjs.map +1 -1
- package/dist/private/toast/useToast.cjs +2 -1
- package/dist/private/toast/useToast.cjs.map +1 -1
- package/dist/private/toast/useToast.js +2 -1
- package/dist/private/toast/useToast.js.map +1 -1
- package/dist/private/toast/useToast.mjs +2 -1
- package/dist/private/toast/useToast.mjs.map +1 -1
- package/dist/private/toast/useToastRegion.cjs.map +1 -1
- package/dist/private/toast/useToastRegion.js.map +1 -1
- package/dist/private/toast/useToastRegion.mjs.map +1 -1
- package/dist/private/toggle/useToggle.cjs +70 -8
- package/dist/private/toggle/useToggle.cjs.map +1 -1
- package/dist/private/toggle/useToggle.js +70 -8
- package/dist/private/toggle/useToggle.js.map +1 -1
- package/dist/private/toggle/useToggle.mjs +70 -8
- package/dist/private/toggle/useToggle.mjs.map +1 -1
- package/dist/private/toolbar/useToolbar.cjs.map +1 -1
- package/dist/private/toolbar/useToolbar.js.map +1 -1
- package/dist/private/toolbar/useToolbar.mjs.map +1 -1
- package/dist/private/tooltip/useTooltip.cjs.map +1 -1
- package/dist/private/tooltip/useTooltip.js.map +1 -1
- package/dist/private/tooltip/useTooltip.mjs.map +1 -1
- package/dist/private/tooltip/useTooltipTrigger.cjs.map +1 -1
- package/dist/private/tooltip/useTooltipTrigger.js.map +1 -1
- package/dist/private/tooltip/useTooltipTrigger.mjs.map +1 -1
- package/dist/private/tree/useTree.cjs.map +1 -1
- package/dist/private/tree/useTree.js.map +1 -1
- package/dist/private/tree/useTree.mjs.map +1 -1
- package/dist/private/tree/useTreeItem.cjs.map +1 -1
- package/dist/private/tree/useTreeItem.js.map +1 -1
- package/dist/private/tree/useTreeItem.mjs.map +1 -1
- package/dist/private/utils/animation.cjs.map +1 -1
- package/dist/private/utils/animation.js.map +1 -1
- package/dist/private/utils/animation.mjs.map +1 -1
- package/dist/private/utils/domHelpers.cjs +2 -1
- package/dist/private/utils/domHelpers.cjs.map +1 -1
- package/dist/private/utils/domHelpers.js +2 -1
- package/dist/private/utils/domHelpers.js.map +1 -1
- package/dist/private/utils/domHelpers.mjs +2 -1
- package/dist/private/utils/domHelpers.mjs.map +1 -1
- package/dist/private/utils/filterDOMProps.cjs.map +1 -1
- package/dist/private/utils/filterDOMProps.js.map +1 -1
- package/dist/private/utils/filterDOMProps.mjs.map +1 -1
- package/dist/private/utils/focusWithoutScrolling.cjs.map +1 -1
- package/dist/private/utils/focusWithoutScrolling.js.map +1 -1
- package/dist/private/utils/focusWithoutScrolling.mjs.map +1 -1
- package/dist/private/utils/getNonce.cjs.map +1 -1
- package/dist/private/utils/getNonce.js.map +1 -1
- package/dist/private/utils/getNonce.mjs.map +1 -1
- package/dist/private/utils/getOffset.cjs.map +1 -1
- package/dist/private/utils/getOffset.js.map +1 -1
- package/dist/private/utils/getOffset.mjs.map +1 -1
- package/dist/private/utils/getScrollParent.cjs.map +1 -1
- package/dist/private/utils/getScrollParent.js.map +1 -1
- package/dist/private/utils/getScrollParent.mjs.map +1 -1
- package/dist/private/utils/getScrollParents.cjs +3 -2
- package/dist/private/utils/getScrollParents.cjs.map +1 -1
- package/dist/private/utils/getScrollParents.js +3 -2
- package/dist/private/utils/getScrollParents.js.map +1 -1
- package/dist/private/utils/getScrollParents.mjs +3 -2
- package/dist/private/utils/getScrollParents.mjs.map +1 -1
- package/dist/private/utils/isElementVisible.cjs.map +1 -1
- package/dist/private/utils/isElementVisible.js.map +1 -1
- package/dist/private/utils/isElementVisible.mjs.map +1 -1
- package/dist/private/utils/isFocusable.cjs.map +1 -1
- package/dist/private/utils/isFocusable.js.map +1 -1
- package/dist/private/utils/isFocusable.mjs.map +1 -1
- package/dist/private/utils/isVirtualEvent.cjs.map +1 -1
- package/dist/private/utils/isVirtualEvent.js.map +1 -1
- package/dist/private/utils/isVirtualEvent.mjs.map +1 -1
- package/dist/private/utils/keyboard.cjs.map +1 -1
- package/dist/private/utils/keyboard.js.map +1 -1
- package/dist/private/utils/keyboard.mjs.map +1 -1
- package/dist/private/utils/mergeProps.cjs.map +1 -1
- package/dist/private/utils/mergeProps.js.map +1 -1
- package/dist/private/utils/mergeProps.mjs.map +1 -1
- package/dist/private/utils/mergeRefs.cjs.map +1 -1
- package/dist/private/utils/mergeRefs.js.map +1 -1
- package/dist/private/utils/mergeRefs.mjs.map +1 -1
- package/dist/private/utils/openLink.cjs +12 -8
- package/dist/private/utils/openLink.cjs.map +1 -1
- package/dist/private/utils/openLink.js +12 -8
- package/dist/private/utils/openLink.js.map +1 -1
- package/dist/private/utils/openLink.mjs +12 -8
- package/dist/private/utils/openLink.mjs.map +1 -1
- package/dist/private/utils/platform.cjs.map +1 -1
- package/dist/private/utils/platform.js.map +1 -1
- package/dist/private/utils/platform.mjs.map +1 -1
- package/dist/private/utils/scrollIntoView.cjs +21 -18
- package/dist/private/utils/scrollIntoView.cjs.map +1 -1
- package/dist/private/utils/scrollIntoView.js +21 -18
- package/dist/private/utils/scrollIntoView.js.map +1 -1
- package/dist/private/utils/scrollIntoView.mjs +21 -18
- package/dist/private/utils/scrollIntoView.mjs.map +1 -1
- package/dist/private/utils/shadowdom/DOMFunctions.cjs.map +1 -1
- package/dist/private/utils/shadowdom/DOMFunctions.js.map +1 -1
- package/dist/private/utils/shadowdom/DOMFunctions.mjs.map +1 -1
- package/dist/private/utils/shadowdom/ShadowTreeWalker.cjs +6 -6
- package/dist/private/utils/shadowdom/ShadowTreeWalker.cjs.map +1 -1
- package/dist/private/utils/shadowdom/ShadowTreeWalker.js +6 -6
- package/dist/private/utils/shadowdom/ShadowTreeWalker.js.map +1 -1
- package/dist/private/utils/shadowdom/ShadowTreeWalker.mjs +6 -6
- package/dist/private/utils/shadowdom/ShadowTreeWalker.mjs.map +1 -1
- package/dist/private/utils/useDeepMemo.cjs +1 -1
- package/dist/private/utils/useDeepMemo.cjs.map +1 -1
- package/dist/private/utils/useDeepMemo.js +1 -1
- package/dist/private/utils/useDeepMemo.js.map +1 -1
- package/dist/private/utils/useDeepMemo.mjs +1 -1
- package/dist/private/utils/useDeepMemo.mjs.map +1 -1
- package/dist/private/utils/useDescription.cjs.map +1 -1
- package/dist/private/utils/useDescription.js.map +1 -1
- package/dist/private/utils/useDescription.mjs.map +1 -1
- package/dist/private/utils/useDrag1D.cjs +1 -1
- package/dist/private/utils/useDrag1D.cjs.map +1 -1
- package/dist/private/utils/useDrag1D.js +1 -1
- package/dist/private/utils/useDrag1D.js.map +1 -1
- package/dist/private/utils/useDrag1D.mjs +1 -1
- package/dist/private/utils/useDrag1D.mjs.map +1 -1
- package/dist/private/utils/useFormReset.cjs.map +1 -1
- package/dist/private/utils/useFormReset.js.map +1 -1
- package/dist/private/utils/useFormReset.mjs.map +1 -1
- package/dist/private/utils/useGlobalListeners.cjs.map +1 -1
- package/dist/private/utils/useGlobalListeners.js.map +1 -1
- package/dist/private/utils/useGlobalListeners.mjs.map +1 -1
- package/dist/private/utils/useId.cjs.map +1 -1
- package/dist/private/utils/useId.js.map +1 -1
- package/dist/private/utils/useId.mjs.map +1 -1
- package/dist/private/utils/useLabels.cjs.map +1 -1
- package/dist/private/utils/useLabels.js.map +1 -1
- package/dist/private/utils/useLabels.mjs.map +1 -1
- package/dist/private/utils/useLayoutEffect.cjs.map +1 -1
- package/dist/private/utils/useLayoutEffect.js.map +1 -1
- package/dist/private/utils/useLayoutEffect.mjs.map +1 -1
- package/dist/private/utils/useLoadMore.cjs.map +1 -1
- package/dist/private/utils/useLoadMore.js.map +1 -1
- package/dist/private/utils/useLoadMore.mjs.map +1 -1
- package/dist/private/utils/useLoadMoreSentinel.cjs.map +1 -1
- package/dist/private/utils/useLoadMoreSentinel.js.map +1 -1
- package/dist/private/utils/useLoadMoreSentinel.mjs.map +1 -1
- package/dist/private/utils/useObjectRef.cjs.map +1 -1
- package/dist/private/utils/useObjectRef.js.map +1 -1
- package/dist/private/utils/useObjectRef.mjs.map +1 -1
- package/dist/private/utils/useResizeObserver.cjs.map +1 -1
- package/dist/private/utils/useResizeObserver.js.map +1 -1
- package/dist/private/utils/useResizeObserver.mjs.map +1 -1
- package/dist/private/utils/useSlot.cjs +54 -0
- package/dist/private/utils/useSlot.cjs.map +1 -0
- package/dist/private/utils/useSlot.js +49 -0
- package/dist/private/utils/useSlot.js.map +1 -0
- package/dist/private/utils/useSlot.mjs +49 -0
- package/dist/private/utils/useSlot.mjs.map +1 -0
- package/dist/private/utils/useSyncRef.cjs +2 -1
- package/dist/private/utils/useSyncRef.cjs.map +1 -1
- package/dist/private/utils/useSyncRef.js +2 -1
- package/dist/private/utils/useSyncRef.js.map +1 -1
- package/dist/private/utils/useSyncRef.mjs +2 -1
- package/dist/private/utils/useSyncRef.mjs.map +1 -1
- package/dist/private/utils/useUpdateEffect.cjs.map +1 -1
- package/dist/private/utils/useUpdateEffect.js.map +1 -1
- package/dist/private/utils/useUpdateEffect.mjs.map +1 -1
- package/dist/private/utils/useValueEffect.cjs.map +1 -1
- package/dist/private/utils/useValueEffect.js.map +1 -1
- package/dist/private/utils/useValueEffect.mjs.map +1 -1
- package/dist/private/utils/useViewportSize.cjs +3 -1
- package/dist/private/utils/useViewportSize.cjs.map +1 -1
- package/dist/private/utils/useViewportSize.js +3 -1
- package/dist/private/utils/useViewportSize.js.map +1 -1
- package/dist/private/utils/useViewportSize.mjs +3 -1
- package/dist/private/utils/useViewportSize.mjs.map +1 -1
- package/dist/private/virtualizer/ScrollView.cjs +2 -2
- package/dist/private/virtualizer/ScrollView.cjs.map +1 -1
- package/dist/private/virtualizer/ScrollView.js +2 -2
- package/dist/private/virtualizer/ScrollView.js.map +1 -1
- package/dist/private/virtualizer/ScrollView.mjs +2 -2
- package/dist/private/virtualizer/ScrollView.mjs.map +1 -1
- package/dist/private/virtualizer/Virtualizer.cjs.map +1 -1
- package/dist/private/virtualizer/Virtualizer.js.map +1 -1
- package/dist/private/virtualizer/Virtualizer.mjs.map +1 -1
- package/dist/private/virtualizer/VirtualizerItem.cjs.map +1 -1
- package/dist/private/virtualizer/VirtualizerItem.js.map +1 -1
- package/dist/private/virtualizer/VirtualizerItem.mjs.map +1 -1
- package/dist/private/virtualizer/useVirtualizerItem.cjs.map +1 -1
- package/dist/private/virtualizer/useVirtualizerItem.js.map +1 -1
- package/dist/private/virtualizer/useVirtualizerItem.mjs.map +1 -1
- package/dist/private/virtualizer/utils.cjs.map +1 -1
- package/dist/private/virtualizer/utils.js.map +1 -1
- package/dist/private/virtualizer/utils.mjs.map +1 -1
- package/dist/private/visually-hidden/VisuallyHidden.cjs.map +1 -1
- package/dist/private/visually-hidden/VisuallyHidden.js.map +1 -1
- package/dist/private/visually-hidden/VisuallyHidden.mjs.map +1 -1
- package/dist/types/exports/index.d.ts +7 -0
- package/dist/types/exports/useCalendar.d.ts +6 -0
- package/dist/types/exports/useRangeCalendar.d.ts +11 -0
- package/dist/types/src/actiongroup/useActionGroup.d.ts +5 -1
- package/dist/types/src/aria-modal-polyfill/ariaModalPolyfill.d.ts +2 -1
- package/dist/types/src/autocomplete/useAutocomplete.d.ts +21 -9
- package/dist/types/src/autocomplete/useSearchAutocomplete.d.ts +15 -8
- package/dist/types/src/breadcrumbs/useBreadcrumbItem.d.ts +2 -0
- package/dist/types/src/button/useButton.d.ts +25 -7
- package/dist/types/src/button/useToggleButtonGroup.d.ts +1 -0
- package/dist/types/src/calendar/useCalendar.d.ts +3 -3
- package/dist/types/src/calendar/useCalendarBase.d.ts +2 -2
- package/dist/types/src/calendar/useCalendarCell.d.ts +9 -8
- package/dist/types/src/calendar/useCalendarGrid.d.ts +8 -4
- package/dist/types/src/calendar/useCalendarHeading.d.ts +22 -0
- package/dist/types/src/calendar/useCalendarMonthPicker.d.ts +22 -0
- package/dist/types/src/calendar/useCalendarYearPicker.d.ts +32 -0
- package/dist/types/src/calendar/useRangeCalendar.d.ts +5 -5
- package/dist/types/src/calendar/utils.d.ts +3 -3
- package/dist/types/src/checkbox/useCheckbox.d.ts +6 -1
- package/dist/types/src/checkbox/useCheckboxGroup.d.ts +1 -0
- package/dist/types/src/checkbox/useCheckboxGroupItem.d.ts +3 -2
- package/dist/types/src/collections/CollectionBuilder.d.ts +8 -7
- package/dist/types/src/collections/useCachedChildren.d.ts +1 -1
- package/dist/types/src/color/useColorArea.d.ts +7 -4
- package/dist/types/src/color/useColorChannelField.d.ts +2 -2
- package/dist/types/src/combobox/useComboBox.d.ts +5 -3
- package/dist/types/src/datepicker/useDateField.d.ts +2 -1
- package/dist/types/src/datepicker/useDatePicker.d.ts +5 -3
- package/dist/types/src/dialog/useDialog.d.ts +1 -0
- package/dist/types/src/disclosure/useDisclosure.d.ts +1 -0
- package/dist/types/src/dnd/ListDropTargetDelegate.d.ts +3 -0
- package/dist/types/src/dnd/useDrag.d.ts +11 -4
- package/dist/types/src/dnd/useDraggableCollection.d.ts +2 -2
- package/dist/types/src/dnd/useDraggableItem.d.ts +7 -6
- package/dist/types/src/dnd/useDrop.d.ts +5 -4
- package/dist/types/src/dnd/useDroppableCollection.d.ts +2 -2
- package/dist/types/src/dnd/utils.d.ts +1 -1
- package/dist/types/src/focus/FocusRing.d.ts +1 -0
- package/dist/types/src/focus/useFocusRing.d.ts +1 -0
- package/dist/types/src/focus/useHasTabbableChild.d.ts +1 -0
- package/dist/types/src/grid/GridKeyboardDelegate.d.ts +8 -4
- package/dist/types/src/grid/useGrid.d.ts +12 -4
- package/dist/types/src/grid/useGridCell.d.ts +11 -3
- package/dist/types/src/grid/useGridRow.d.ts +7 -2
- package/dist/types/src/grid/useGridSelectionAnnouncement.d.ts +3 -1
- package/dist/types/src/grid/useGridSelectionCheckbox.d.ts +1 -0
- package/dist/types/src/grid/useHighlightSelectionDescription.d.ts +1 -0
- package/dist/types/src/gridlist/useGridList.d.ts +13 -5
- package/dist/types/src/gridlist/useGridListItem.d.ts +5 -1
- package/dist/types/src/gridlist/useGridListSection.d.ts +1 -0
- package/dist/types/src/gridlist/useGridListSelectionCheckbox.d.ts +1 -0
- package/dist/types/src/i18n/useCollator.d.ts +3 -2
- package/dist/types/src/i18n/useDateFormatter.d.ts +3 -2
- package/dist/types/src/i18n/useFilter.d.ts +3 -2
- package/dist/types/src/i18n/useListFormatter.d.ts +3 -2
- package/dist/types/src/i18n/useLocalizedStringFormatter.d.ts +3 -1
- package/dist/types/src/i18n/useNumberFormatter.d.ts +3 -2
- package/dist/types/src/i18n/utils.d.ts +2 -1
- package/dist/types/src/interactions/createEventHandler.d.ts +2 -1
- package/dist/types/src/interactions/useFocusVisible.d.ts +11 -9
- package/dist/types/src/interactions/useLongPress.d.ts +3 -2
- package/dist/types/src/interactions/utils.d.ts +4 -3
- package/dist/types/src/label/useField.d.ts +3 -2
- package/dist/types/src/label/useLabel.d.ts +2 -0
- package/dist/types/src/landmark/useLandmark.d.ts +4 -1
- package/dist/types/src/link/useLink.d.ts +1 -0
- package/dist/types/src/listbox/useListBox.d.ts +8 -3
- package/dist/types/src/listbox/useListBoxSection.d.ts +1 -0
- package/dist/types/src/listbox/useOption.d.ts +7 -0
- package/dist/types/src/menu/useMenu.d.ts +2 -0
- package/dist/types/src/menu/useMenuItem.d.ts +10 -1
- package/dist/types/src/menu/useMenuSection.d.ts +1 -0
- package/dist/types/src/menu/useMenuTrigger.d.ts +1 -0
- package/dist/types/src/menu/useSafelyMouseToSubmenu.d.ts +3 -2
- package/dist/types/src/menu/useSubmenuTrigger.d.ts +7 -2
- package/dist/types/src/numberfield/useNumberField.d.ts +11 -4
- package/dist/types/src/overlays/Overlay.d.ts +1 -0
- package/dist/types/src/overlays/PortalProvider.d.ts +4 -1
- package/dist/types/src/overlays/ariaHideOutside.d.ts +1 -0
- package/dist/types/src/overlays/calculatePosition.d.ts +2 -1
- package/dist/types/src/overlays/useModal.d.ts +8 -7
- package/dist/types/src/overlays/useModalOverlay.d.ts +2 -0
- package/dist/types/src/overlays/useOverlay.d.ts +2 -0
- package/dist/types/src/overlays/useOverlayPosition.d.ts +10 -0
- package/dist/types/src/progress/useProgressBar.d.ts +5 -1
- package/dist/types/src/radio/useRadio.d.ts +4 -1
- package/dist/types/src/radio/useRadioGroup.d.ts +1 -0
- package/dist/types/src/searchfield/useSearchField.d.ts +7 -2
- package/dist/types/src/select/HiddenSelect.d.ts +2 -1
- package/dist/types/src/select/useSelect.d.ts +3 -1
- package/dist/types/src/selection/ListKeyboardDelegate.d.ts +18 -6
- package/dist/types/src/selection/useSelectableCollection.d.ts +10 -2
- package/dist/types/src/selection/useSelectableItem.d.ts +9 -7
- package/dist/types/src/selection/useSelectableList.d.ts +5 -2
- package/dist/types/src/separator/useSeparator.d.ts +1 -0
- package/dist/types/src/slider/useSlider.d.ts +5 -4
- package/dist/types/src/slider/useSliderThumb.d.ts +3 -1
- package/dist/types/src/switch/useSwitch.d.ts +14 -27
- package/dist/types/src/table/TableKeyboardDelegate.d.ts +6 -2
- package/dist/types/src/table/useTable.d.ts +8 -4
- package/dist/types/src/table/useTableCell.d.ts +7 -2
- package/dist/types/src/table/useTableColumnHeader.d.ts +9 -2
- package/dist/types/src/table/useTableColumnResize.d.ts +12 -6
- package/dist/types/src/table/useTableHeaderRow.d.ts +1 -0
- package/dist/types/src/table/useTableRow.d.ts +1 -0
- package/dist/types/src/table/useTableSelectionCheckbox.d.ts +2 -0
- package/dist/types/src/tabs/useTabList.d.ts +2 -0
- package/dist/types/src/tabs/useTabPanel.d.ts +2 -2
- package/dist/types/src/tag/useTag.d.ts +1 -0
- package/dist/types/src/tag/useTagGroup.d.ts +7 -3
- package/dist/types/src/textfield/useTextField.d.ts +26 -11
- package/dist/types/src/toast/useToast.d.ts +2 -2
- package/dist/types/src/toast/useToastRegion.d.ts +5 -3
- package/dist/types/src/toggle/useToggle.d.ts +8 -3
- package/dist/types/src/toolbar/useToolbar.d.ts +2 -0
- package/dist/types/src/tree/useTree.d.ts +4 -2
- package/dist/types/src/tree/useTreeItem.d.ts +5 -1
- package/dist/types/src/utils/filterDOMProps.d.ts +1 -0
- package/dist/types/src/utils/getNonce.d.ts +3 -2
- package/dist/types/src/utils/isElementVisible.d.ts +1 -0
- package/dist/types/src/utils/mergeProps.d.ts +3 -2
- package/dist/types/src/utils/scrollIntoView.d.ts +5 -3
- package/dist/types/src/utils/shadowdom/DOMFunctions.d.ts +1 -0
- package/dist/types/src/utils/useId.d.ts +2 -0
- package/dist/types/src/utils/useLabels.d.ts +1 -0
- package/dist/types/src/utils/useLoadMore.d.ts +6 -4
- package/dist/types/src/utils/useLoadMoreSentinel.d.ts +5 -3
- package/dist/types/src/utils/useSlot.d.ts +8 -0
- package/dist/types/src/visually-hidden/VisuallyHidden.d.ts +1 -0
- package/package.json +10 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;AAiFM,SAAS,0CAAmD,KAAgC,EAAE,KAA0B;IAC7H,IAAI,aACF,SAAS,cACT,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,kBAChB,cAAc,mBACd,8BAA8B;IAC9B,eAAe,cACf,UAAU,cACV,UAAU,EACX,GAAG;IACJ,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,YAAY,sBAAA,uBAAA,YAAa;IAEzB,IAAI,kBAAkB,CAAA,GAAA,yCAA0B,EAAE,CAAA,GAAA,8CAAW,GAAG;IAChE,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAa,EAC/C;QACE,MAAM;QACN,YAAY,cAAc;IAC5B,GACA,OACA;IAGF,gEAAgE;IAChE,CAAA,GAAA,yCAAO,EAAE,GAAG,CAAC,OAAO;QAAC,IAAI,UAAU,EAAE;IAAA;IAErC,0HAA0H;IAC1H,qFAAqF;IACrF,I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d,GAAG;QAAC;QAAI;QAAQ;KAAS;IAEzB,OAAO,SAAS,KAAK;AACvB","sources":["packages/react-aria/src/combobox/useComboBox.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\n\nimport {AriaButtonProps} from '../button/useButton';\nimport {ariaHideOutside} from '../overlays/ariaHideOutside';\nimport {AriaLabelingProps, BaseEvent, DOMAttributes, DOMProps, InputDOMProps, KeyboardDelegate, LayoutDelegate, PressEvent, RefObject, RouterOptions, ValidationResult} from '@react-types/shared';\nimport {AriaListBoxOptions} from '../listbox/useListBox';\nimport {chain} from '../utils/chain';\nimport {ComboBoxProps, ComboBoxState, SelectionMode} from 'react-stately/useComboBoxState';\nimport {dispatchVirtualFocus} from '../focus/virtualFocus';\nimport {FocusEvent, InputHTMLAttributes, KeyboardEvent, TouchEvent, useEffect, useMemo, useRef, useState} from 'react';\nimport {getActiveElement, getEventTarget, nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {getChildNodes} from 'react-stately/private/collections/getChildNodes';\nimport {getItemCount} from 'react-stately/private/collections/getItemCount';\nimport {getItemId, listData} from '../listbox/utils';\nimport {getOwnerDocument} from '../utils/domHelpers';\nimport intlMessages from '../../intl/combobox/*.json';\nimport {isAppleDevice} from '../utils/platform';\nimport {ListKeyboardDelegate} from '../selection/ListKeyboardDelegate';\nimport {mergeProps} from '../utils/mergeProps';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useEvent} from '../utils/useEvent';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\n// @ts-ignore\nimport {useLabels} from '../utils/useLabels';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useMenuTrigger} from '../menu/useMenuTrigger';\nimport {useRouter} from '../utils/openLink';\nimport {useSelectableCollection} from '../selection/useSelectableCollection';\nimport {useTextField} from '../textfield/useTextField';\nimport {useUpdateEffect} from '../utils/useUpdateEffect';\n\nexport interface AriaComboBoxProps<T, M extends SelectionMode = 'single'> extends ComboBoxProps<T, M>, DOMProps, InputDOMProps, AriaLabelingProps {\n /** Whether keyboard navigation is circular. */\n shouldFocusWrap?: boolean\n}\n\nexport interface AriaComboBoxOptions<T, M extends SelectionMode = 'single'> extends Omit<AriaComboBoxProps<T, M>, 'children'> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement | null>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<Element | null>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement | null>,\n /** The ref for the optional list box popup trigger button. */\n buttonRef?: RefObject<Element | null>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate\n}\n\nexport interface ComboBoxAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the combo box input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to `useListBox`. */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the optional trigger button, to be passed to `useButton`. */\n buttonProps: AriaButtonProps,\n /** Props for the element representing the selected value. */\n valueProps: DOMAttributes,\n /** Props for the combo box description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the combo box error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a combo box component.\n * A combo box combines a text input with a listbox, allowing users to filter a list of options to items matching a query.\n * @param props - Props for the combo box.\n * @param state - State for the select, as returned by `useComboBoxState`.\n */\nexport function useComboBox<T, M extends SelectionMode = 'single'>(props: AriaComboBoxOptions<T, M>, state: ComboBoxState<T, M>): ComboBoxAria<T> {\n let {\n buttonRef,\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n layoutDelegate,\n // completionMode = 'suggest',\n shouldFocusWrap,\n isReadOnly,\n isDisabled\n } = props;\n let backupBtnRef = useRef(null);\n buttonRef = buttonRef ?? backupBtnRef;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/combobox');\n let {menuTriggerProps, menuProps} = useMenuTrigger<T>(\n {\n type: 'listbox',\n isDisabled: isDisabled || isReadOnly\n },\n state,\n buttonRef\n );\n\n // Set listbox id so it can be used when calling getItemId later\n listData.set(state, {id: menuProps.id});\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let {collection} = state;\n let {disabledKeys} = state.selectionManager;\n let delegate = useMemo(() => (\n keyboardDelegate || new ListKeyboardDelegate({\n collection,\n disabledKeys,\n ref: listBoxRef,\n layoutDelegate\n })\n ), [keyboardDelegate, layoutDelegate, collection, disabledKeys, listBoxRef]);\n\n // Use useSelectableCollection to get the keyboard handlers to apply to the textfield\n let {collectionProps} = useSelectableCollection({\n selectionManager: state.selectionManager,\n keyboardDelegate: delegate,\n disallowTypeAhead: true,\n disallowEmptySelection: true,\n shouldFocusWrap,\n ref: inputRef,\n // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component\n isVirtualized: true\n });\n\n let router = useRouter();\n\n // For textfield specific keydown operations\n let onKeyDown = (e: BaseEvent<KeyboardEvent<any>>) => {\n if (e.nativeEvent.isComposing) {\n return;\n }\n switch (e.key) {\n case 'Enter':\n case 'Tab':\n // Prevent form submission if menu is open since we may be selecting a option\n if (state.isOpen && e.key === 'Enter') {\n e.preventDefault();\n }\n\n // If the focused item is a link, trigger opening it. Items that are links are not selectable.\n if (state.isOpen && listBoxRef.current && state.selectionManager.focusedKey != null) {\n let collectionItem = state.collection.getItem(state.selectionManager.focusedKey);\n if (collectionItem?.props.href) {\n let item = listBoxRef.current.querySelector(`[data-key=\"${CSS.escape(state.selectionManager.focusedKey.toString())}\"]`);\n if (e.key === 'Enter' && item instanceof HTMLAnchorElement) {\n router.open(item, e, collectionItem.props.href, collectionItem.props.routerOptions as RouterOptions);\n }\n state.close();\n break;\n } else if (collectionItem?.props.onAction) {\n collectionItem.props.onAction();\n state.close();\n break;\n }\n }\n if (e.key === 'Enter' || state.isOpen) {\n state.commit();\n }\n break;\n case 'Escape':\n if (\n !state.selectionManager.isEmpty ||\n state.inputValue === '' ||\n props.allowsCustomValue\n ) {\n e.continuePropagation();\n }\n state.revert();\n break;\n case 'ArrowDown':\n state.open('first', 'manual');\n break;\n case 'ArrowUp':\n state.open('last', 'manual');\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n state.selectionManager.setFocusedKey(null);\n break;\n }\n };\n\n let onBlur = (e: FocusEvent<HTMLInputElement>) => {\n let blurFromButton = buttonRef?.current && buttonRef.current === e.relatedTarget;\n let blurIntoPopover = nodeContains(popoverRef.current, e.relatedTarget);\n // Ignore blur if focused moved to the button(if exists) or into the popover.\n if (blurFromButton || blurIntoPopover) {\n return;\n }\n\n if (props.onBlur) {\n props.onBlur(e);\n }\n\n state.setFocused(false);\n };\n\n let onFocus = (e: FocusEvent<HTMLInputElement>) => {\n if (state.isFocused) {\n return;\n }\n\n if (props.onFocus) {\n props.onFocus(e);\n }\n\n state.setFocused(true);\n };\n\n let valueId = useValueId([state.selectionManager.selectedKeys, state.selectionManager.selectionMode]);\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField({\n ...props,\n // In multi-select mode, only set required if the selection is empty.\n isRequired: props.selectionMode === 'multiple' ? props.isRequired && state.selectionManager.isEmpty : props.isRequired,\n onChange: state.setInputValue,\n onKeyDown: !isReadOnly ? chain(state.isOpen && collectionProps.onKeyDown, onKeyDown, props.onKeyDown) : props.onKeyDown,\n onBlur,\n value: state.inputValue,\n defaultValue: state.defaultInputValue,\n onFocus,\n autoComplete: 'off',\n validate: undefined,\n [privateValidationStateProp]: state,\n 'aria-describedby': [valueId, props['aria-describedby']].filter(Boolean).join(' ') || undefined\n }, inputRef);\n\n useFormReset(inputRef, state.defaultValue, state.setValue);\n\n // Press handlers for the ComboBox button\n let onPress = (e: PressEvent) => {\n if (e.pointerType === 'touch') {\n // Focus the input field in case it isn't focused yet\n inputRef.current?.focus();\n state.toggle(null, 'manual');\n }\n };\n\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType !== 'touch') {\n inputRef.current?.focus();\n state.toggle((e.pointerType === 'keyboard' || e.pointerType === 'virtual') ? 'first' : null, 'manual');\n }\n };\n\n let triggerLabelProps = useLabels({\n id: menuTriggerProps.id,\n 'aria-label': stringFormatter.format('buttonLabel'),\n 'aria-labelledby': props['aria-labelledby'] || labelProps.id\n });\n\n let listBoxProps = useLabels({\n id: menuProps.id,\n 'aria-label': stringFormatter.format('listboxLabel'),\n 'aria-labelledby': props['aria-labelledby'] || labelProps.id\n });\n\n // If a touch happens on direct center of ComboBox input, might be virtual click from iPad so open ComboBox menu\n let lastEventTime = useRef(0);\n let onTouchEnd = (e: TouchEvent) => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n // Sometimes VoiceOver on iOS fires two touchend events in quick succession. Ignore the second one.\n if (e.timeStamp - lastEventTime.current < 500) {\n e.preventDefault();\n inputRef.current?.focus();\n return;\n }\n\n let rect = (getEventTarget(e) as Element).getBoundingClientRect();\n let touch = e.changedTouches[0];\n\n let centerX = Math.ceil(rect.left + .5 * rect.width);\n let centerY = Math.ceil(rect.top + .5 * rect.height);\n\n if (touch.clientX === centerX && touch.clientY === centerY) {\n e.preventDefault();\n inputRef.current?.focus();\n state.toggle(null, 'manual');\n\n lastEventTime.current = e.timeStamp;\n }\n };\n\n // VoiceOver has issues with announcing aria-activedescendant properly on change\n // (especially on iOS). We use a live region announcer to announce focus changes\n // manually. In addition, section titles are announced when navigating into a new section.\n let focusedItem = state.selectionManager.focusedKey != null && state.isOpen\n ? state.collection.getItem(state.selectionManager.focusedKey)\n : undefined;\n let sectionKey = focusedItem?.parentKey ?? null;\n let itemKey = state.selectionManager.focusedKey ?? null;\n let lastSection = useRef(sectionKey);\n let lastItem = useRef(itemKey);\n useEffect(() => {\n if (isAppleDevice() && focusedItem != null && itemKey != null && itemKey !== lastItem.current) {\n let isSelected = state.selectionManager.isSelected(itemKey);\n let section = sectionKey != null ? state.collection.getItem(sectionKey) : null;\n let sectionTitle = section?.['aria-label'] || (typeof section?.rendered === 'string' ? section.rendered : '') || '';\n\n let announcement = stringFormatter.format('focusAnnouncement', {\n isGroupChange: (section && sectionKey !== lastSection.current) ?? false,\n groupTitle: sectionTitle,\n groupCount: section ? [...getChildNodes(section, state.collection)].length : 0,\n optionText: focusedItem['aria-label'] || focusedItem.textValue || '',\n isSelected\n });\n\n announce(announcement);\n }\n\n lastSection.current = sectionKey;\n lastItem.current = itemKey;\n });\n\n // Announce the number of available suggestions when it changes\n let optionCount = getItemCount(state.collection);\n let lastSize = useRef(optionCount);\n let lastOpen = useRef(state.isOpen);\n useEffect(() => {\n // Only announce the number of options available when the menu opens if there is no\n // focused item, otherwise screen readers will typically read e.g. \"1 of 6\".\n // The exception is VoiceOver since this isn't included in the message above.\n let didOpenWithoutFocusedItem =\n state.isOpen !== lastOpen.current &&\n (state.selectionManager.focusedKey == null || isAppleDevice());\n\n if (state.isOpen && (didOpenWithoutFocusedItem || optionCount !== lastSize.current)) {\n let announcement = stringFormatter.format('countAnnouncement', {optionCount});\n announce(announcement);\n }\n\n lastSize.current = optionCount;\n lastOpen.current = state.isOpen;\n });\n\n // Announce when a selection occurs for VoiceOver. Other screen readers typically do this automatically.\n // TODO: do we need to do this for multi-select?\n let lastSelectedKey = useRef(state.selectedKey);\n useEffect(() => {\n if (isAppleDevice() && state.isFocused && state.selectedItem && state.selectedKey !== lastSelectedKey.current) {\n let optionText = state.selectedItem['aria-label'] || state.selectedItem.textValue || '';\n let announcement = stringFormatter.format('selectedAnnouncement', {optionText});\n announce(announcement);\n }\n\n lastSelectedKey.current = state.selectedKey;\n });\n\n useEffect(() => {\n if (state.isOpen) {\n return ariaHideOutside([inputRef.current, popoverRef.current].filter(element => element != null));\n }\n }, [state.isOpen, inputRef, popoverRef]);\n\n useUpdateEffect(() => {\n // Re-show focus ring when there is no virtually focused item.\n if (!focusedItem && inputRef.current && getActiveElement(getOwnerDocument(inputRef.current)) === inputRef.current) {\n dispatchVirtualFocus(inputRef.current, null);\n }\n }, [focusedItem]);\n\n useEvent(listBoxRef, 'react-aria-item-action', state.isOpen ? () => {\n state.close();\n } : undefined);\n\n return {\n labelProps,\n buttonProps: {\n ...menuTriggerProps,\n ...triggerLabelProps,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n onPress,\n onPressStart,\n isDisabled: isDisabled || isReadOnly\n },\n inputProps: mergeProps(inputProps, {\n role: 'combobox',\n 'aria-expanded': menuTriggerProps['aria-expanded'],\n 'aria-controls': state.isOpen ? menuProps.id : undefined,\n // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)\n 'aria-autocomplete': 'list',\n 'aria-activedescendant': focusedItem ? getItemId(state, focusedItem.key) : undefined,\n onTouchEnd,\n // This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.\n autoCorrect: 'off',\n // This disable's the macOS Safari spell check auto corrections.\n spellCheck: 'false'\n }),\n listBoxProps: mergeProps(menuProps, listBoxProps, {\n autoFocus: state.focusStrategy || true,\n shouldUseVirtualFocus: true,\n shouldSelectOnPressUp: true,\n shouldFocusOnHover: true,\n linkBehavior: 'selection' as const,\n ['UNSTABLE_itemBehavior']: 'action'\n }),\n valueProps: {\n id: valueId\n },\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\n// This is a modified version of useSlotId that uses useEffect instead of useLayoutEffect.\n// Triggering re-renders from useLayoutEffect breaks useComboBoxState's useEffect logic in React 18.\n// These re-renders preempt async state updates in the useEffect, which ends up running multiple times\n// prior to the state being updated. This results in onSelectionChange being called multiple times.\n// TODO: refactor useComboBoxState to avoid this.\nfunction useValueId(depArray: ReadonlyArray<any> = []): string | undefined {\n let id = useId();\n let [exists, setExists] = useState(true);\n let [lastDeps, setLastDeps] = useState(depArray);\n\n // If the deps changed, set exists to true so we can test whether the element exists.\n if (lastDeps.some((v, i) => !Object.is(v, depArray[i]))) {\n setExists(true);\n setLastDeps(depArray);\n }\n\n useEffect(() => {\n if (exists && !document.getElementById(id)) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setExists(false);\n }\n }, [id, exists, lastDeps]);\n\n return exists ? id : undefined;\n}\n"],"names":[],"version":3,"file":"useComboBox.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;AA4GM,SAAS,0CACd,KAAgC,EAChC,KAA0B;IAE1B,IAAI,aACF,SAAS,cACT,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,kBAChB,cAAc,mBACd,8BAA8B;IAC9B,eAAe,cACf,UAAU,cACV,UAAU,EACX,GAAG;IACJ,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,YAAY,sBAAA,uBAAA,YAAa;IAEzB,IAAI,kBAAkB,CAAA,GAAA,yCAA0B,EAAE,CAAA,GAAA,8CAAW,GAAG;IAChE,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAa,EAC/C;QACE,MAAM;QACN,YAAY,cAAc;IAC5B,GACA,OACA;IAGF,gEAAgE;IAChE,CAAA,GAAA,yCAAO,EAAE,GAAG,CAAC,OAAO;QAAC,IAAI,UAAU,EAA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;IAEd,GAAG;QAAC;QAAI;QAAQ;KAAS;IAEzB,OAAO,SAAS,KAAK;AACvB","sources":["packages/react-aria/src/combobox/useComboBox.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\n\nimport {AriaButtonProps} from '../button/useButton';\nimport {ariaHideOutside} from '../overlays/ariaHideOutside';\nimport {\n AriaLabelingProps,\n BaseEvent,\n DOMAttributes,\n DOMProps,\n InputDOMProps,\n KeyboardDelegate,\n LayoutDelegate,\n PressEvent,\n RefObject,\n RouterOptions,\n ValidationResult\n} from '@react-types/shared';\nimport {AriaListBoxOptions} from '../listbox/useListBox';\nimport {chain} from '../utils/chain';\nimport {ComboBoxProps, ComboBoxState, SelectionMode} from 'react-stately/useComboBoxState';\nimport {dispatchVirtualFocus} from '../focus/virtualFocus';\nimport {\n FocusEvent,\n InputHTMLAttributes,\n KeyboardEvent,\n TouchEvent,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {getActiveElement, getEventTarget, nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {getChildNodes} from 'react-stately/private/collections/getChildNodes';\nimport {getItemCount} from 'react-stately/private/collections/getItemCount';\nimport {getItemId, listData} from '../listbox/utils';\nimport {getOwnerDocument} from '../utils/domHelpers';\nimport intlMessages from '../../intl/combobox/*.json';\nimport {isAppleDevice} from '../utils/platform';\nimport {ListKeyboardDelegate} from '../selection/ListKeyboardDelegate';\nimport {mergeProps} from '../utils/mergeProps';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useEvent} from '../utils/useEvent';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\n// @ts-ignore\nimport {useLabels} from '../utils/useLabels';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useMenuTrigger} from '../menu/useMenuTrigger';\nimport {useRouter} from '../utils/openLink';\nimport {useSelectableCollection} from '../selection/useSelectableCollection';\nimport {useTextField} from '../textfield/useTextField';\nimport {useUpdateEffect} from '../utils/useUpdateEffect';\n\nexport interface AriaComboBoxProps<T, M extends SelectionMode = 'single'>\n extends ComboBoxProps<T, M>, DOMProps, InputDOMProps, AriaLabelingProps {\n /** Whether keyboard navigation is circular. */\n shouldFocusWrap?: boolean;\n}\n\nexport interface AriaComboBoxOptions<T, M extends SelectionMode = 'single'> extends Omit<\n AriaComboBoxProps<T, M>,\n 'children'\n> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement | null>;\n /** The ref for the list box popover. */\n popoverRef: RefObject<Element | null>;\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement | null>;\n /** The ref for the optional list box popup trigger button. */\n buttonRef?: RefObject<Element | null>;\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate;\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate;\n}\n\nexport interface ComboBoxAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes;\n /** Props for the combo box input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the list box, to be passed to `useListBox`. */\n listBoxProps: AriaListBoxOptions<T>;\n /** Props for the optional trigger button, to be passed to `useButton`. */\n buttonProps: AriaButtonProps;\n /** Props for the element representing the selected value. */\n valueProps: DOMAttributes;\n /** Props for the combo box description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the combo box error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a combo box component. A combo box\n * combines a text input with a listbox, allowing users to filter a list of options to items\n * matching a query.\n *\n * @param props - Props for the combo box.\n * @param state - State for the select, as returned by `useComboBoxState`.\n */\nexport function useComboBox<T, M extends SelectionMode = 'single'>(\n props: AriaComboBoxOptions<T, M>,\n state: ComboBoxState<T, M>\n): ComboBoxAria<T> {\n let {\n buttonRef,\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n layoutDelegate,\n // completionMode = 'suggest',\n shouldFocusWrap,\n isReadOnly,\n isDisabled\n } = props;\n let backupBtnRef = useRef(null);\n buttonRef = buttonRef ?? backupBtnRef;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/combobox');\n let {menuTriggerProps, menuProps} = useMenuTrigger<T>(\n {\n type: 'listbox',\n isDisabled: isDisabled || isReadOnly\n },\n state,\n buttonRef\n );\n\n // Set listbox id so it can be used when calling getItemId later\n listData.set(state, {id: menuProps.id});\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let {collection} = state;\n let {disabledKeys} = state.selectionManager;\n let delegate = useMemo(\n () =>\n keyboardDelegate ||\n new ListKeyboardDelegate({\n collection,\n disabledKeys,\n ref: listBoxRef,\n layoutDelegate\n }),\n [keyboardDelegate, layoutDelegate, collection, disabledKeys, listBoxRef]\n );\n\n // Use useSelectableCollection to get the keyboard handlers to apply to the textfield\n let {collectionProps} = useSelectableCollection({\n selectionManager: state.selectionManager,\n keyboardDelegate: delegate,\n disallowTypeAhead: true,\n disallowEmptySelection: true,\n shouldFocusWrap,\n ref: inputRef,\n // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component\n isVirtualized: true\n });\n\n let router = useRouter();\n\n // For textfield specific keydown operations\n let onKeyDown = (e: BaseEvent<KeyboardEvent<any>>) => {\n if (e.nativeEvent.isComposing) {\n return;\n }\n switch (e.key) {\n case 'Enter':\n case 'Tab':\n // Prevent form submission if menu is open since we may be selecting a option\n if (state.isOpen && e.key === 'Enter') {\n e.preventDefault();\n }\n\n // If the focused item is a link, trigger opening it. Items that are links are not selectable.\n if (state.isOpen && listBoxRef.current && state.selectionManager.focusedKey != null) {\n let collectionItem = state.collection.getItem(state.selectionManager.focusedKey);\n if (collectionItem?.props.href) {\n let item = listBoxRef.current.querySelector(\n `[data-key=\"${CSS.escape(state.selectionManager.focusedKey.toString())}\"]`\n );\n if (e.key === 'Enter' && item instanceof HTMLAnchorElement) {\n router.open(\n item,\n e,\n collectionItem.props.href,\n collectionItem.props.routerOptions as RouterOptions\n );\n }\n state.close();\n break;\n } else if (collectionItem?.props.onAction) {\n collectionItem.props.onAction();\n state.close();\n break;\n }\n }\n if (e.key === 'Enter' || state.isOpen) {\n state.commit();\n }\n break;\n case 'Escape':\n if (!state.selectionManager.isEmpty || state.inputValue === '' || props.allowsCustomValue) {\n e.continuePropagation();\n }\n state.revert();\n break;\n case 'ArrowDown':\n state.open('first', 'manual');\n break;\n case 'ArrowUp':\n state.open('last', 'manual');\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n state.selectionManager.setFocusedKey(null);\n break;\n }\n };\n\n let onBlur = (e: FocusEvent<HTMLInputElement>) => {\n let blurFromButton = buttonRef?.current && buttonRef.current === e.relatedTarget;\n let blurIntoPopover = nodeContains(popoverRef.current, e.relatedTarget);\n // Ignore blur if focused moved to the button(if exists) or into the popover.\n if (blurFromButton || blurIntoPopover) {\n return;\n }\n\n if (props.onBlur) {\n props.onBlur(e);\n }\n\n state.setFocused(false);\n };\n\n let onFocus = (e: FocusEvent<HTMLInputElement>) => {\n if (state.isFocused) {\n return;\n }\n\n if (props.onFocus) {\n props.onFocus(e);\n }\n\n state.setFocused(true);\n };\n\n let valueId = useValueId([\n state.selectionManager.selectedKeys,\n state.selectionManager.selectionMode\n ]);\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField(\n {\n ...props,\n // In multi-select mode, only set required if the selection is empty.\n isRequired:\n props.selectionMode === 'multiple'\n ? props.isRequired && state.selectionManager.isEmpty\n : props.isRequired,\n onChange: state.setInputValue,\n onKeyDown: !isReadOnly\n ? chain(state.isOpen && collectionProps.onKeyDown, onKeyDown, props.onKeyDown)\n : props.onKeyDown,\n onBlur,\n value: state.inputValue,\n defaultValue: state.defaultInputValue,\n onFocus,\n autoComplete: 'off',\n validate: undefined,\n [privateValidationStateProp]: state,\n 'aria-describedby':\n [valueId, props['aria-describedby']].filter(Boolean).join(' ') || undefined\n },\n inputRef\n );\n\n useFormReset(inputRef, state.defaultValue, state.setValue);\n\n // Press handlers for the ComboBox button\n let onPress = (e: PressEvent) => {\n if (e.pointerType === 'touch') {\n // Focus the input field in case it isn't focused yet\n inputRef.current?.focus();\n state.toggle(null, 'manual');\n }\n };\n\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType !== 'touch') {\n inputRef.current?.focus();\n state.toggle(\n e.pointerType === 'keyboard' || e.pointerType === 'virtual' ? 'first' : null,\n 'manual'\n );\n }\n };\n\n let triggerLabelProps = useLabels({\n id: menuTriggerProps.id,\n 'aria-label': stringFormatter.format('buttonLabel'),\n 'aria-labelledby': props['aria-labelledby'] || labelProps.id\n });\n\n let listBoxProps = useLabels({\n id: menuProps.id,\n 'aria-label': stringFormatter.format('listboxLabel'),\n 'aria-labelledby': props['aria-labelledby'] || labelProps.id\n });\n\n // If a touch happens on direct center of ComboBox input, might be virtual click from iPad so open ComboBox menu\n let lastEventTime = useRef(0);\n let onTouchEnd = (e: TouchEvent) => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n // Sometimes VoiceOver on iOS fires two touchend events in quick succession. Ignore the second one.\n if (e.timeStamp - lastEventTime.current < 500) {\n e.preventDefault();\n inputRef.current?.focus();\n return;\n }\n\n let rect = (getEventTarget(e) as Element).getBoundingClientRect();\n let touch = e.changedTouches[0];\n\n let centerX = Math.ceil(rect.left + 0.5 * rect.width);\n let centerY = Math.ceil(rect.top + 0.5 * rect.height);\n\n if (touch.clientX === centerX && touch.clientY === centerY) {\n e.preventDefault();\n inputRef.current?.focus();\n state.toggle(null, 'manual');\n\n lastEventTime.current = e.timeStamp;\n }\n };\n\n // VoiceOver has issues with announcing aria-activedescendant properly on change\n // (especially on iOS). We use a live region announcer to announce focus changes\n // manually. In addition, section titles are announced when navigating into a new section.\n let focusedItem =\n state.selectionManager.focusedKey != null && state.isOpen\n ? state.collection.getItem(state.selectionManager.focusedKey)\n : undefined;\n let sectionKey = focusedItem?.parentKey ?? null;\n let itemKey = state.selectionManager.focusedKey ?? null;\n let lastSection = useRef(sectionKey);\n let lastItem = useRef(itemKey);\n useEffect(() => {\n if (isAppleDevice() && focusedItem != null && itemKey != null && itemKey !== lastItem.current) {\n let isSelected = state.selectionManager.isSelected(itemKey);\n let section = sectionKey != null ? state.collection.getItem(sectionKey) : null;\n let sectionTitle =\n section?.['aria-label'] ||\n (typeof section?.rendered === 'string' ? section.rendered : '') ||\n '';\n\n let announcement = stringFormatter.format('focusAnnouncement', {\n isGroupChange: (section && sectionKey !== lastSection.current) ?? false,\n groupTitle: sectionTitle,\n groupCount: section ? [...getChildNodes(section, state.collection)].length : 0,\n optionText: focusedItem['aria-label'] || focusedItem.textValue || '',\n isSelected\n });\n\n announce(announcement);\n }\n\n lastSection.current = sectionKey;\n lastItem.current = itemKey;\n });\n\n // Announce the number of available suggestions when it changes\n let optionCount = getItemCount(state.collection);\n let lastSize = useRef(optionCount);\n let lastOpen = useRef(state.isOpen);\n useEffect(() => {\n // Only announce the number of options available when the menu opens if there is no\n // focused item, otherwise screen readers will typically read e.g. \"1 of 6\".\n // The exception is VoiceOver since this isn't included in the message above.\n let didOpenWithoutFocusedItem =\n state.isOpen !== lastOpen.current &&\n (state.selectionManager.focusedKey == null || isAppleDevice());\n\n if (state.isOpen && (didOpenWithoutFocusedItem || optionCount !== lastSize.current)) {\n let announcement = stringFormatter.format('countAnnouncement', {optionCount});\n announce(announcement);\n }\n\n lastSize.current = optionCount;\n lastOpen.current = state.isOpen;\n });\n\n // Announce when a selection occurs for VoiceOver. Other screen readers typically do this automatically.\n // TODO: do we need to do this for multi-select?\n let lastSelectedKey = useRef(state.selectedKey);\n useEffect(() => {\n if (\n isAppleDevice() &&\n state.isFocused &&\n state.selectedItem &&\n state.selectedKey !== lastSelectedKey.current\n ) {\n let optionText = state.selectedItem['aria-label'] || state.selectedItem.textValue || '';\n let announcement = stringFormatter.format('selectedAnnouncement', {optionText});\n announce(announcement);\n }\n\n lastSelectedKey.current = state.selectedKey;\n });\n\n useEffect(() => {\n if (state.isOpen) {\n return ariaHideOutside(\n [inputRef.current, popoverRef.current].filter(element => element != null)\n );\n }\n }, [state.isOpen, inputRef, popoverRef]);\n\n useUpdateEffect(() => {\n // Re-show focus ring when there is no virtually focused item.\n if (\n !focusedItem &&\n inputRef.current &&\n getActiveElement(getOwnerDocument(inputRef.current)) === inputRef.current\n ) {\n dispatchVirtualFocus(inputRef.current, null);\n }\n }, [focusedItem]);\n\n useEvent(\n listBoxRef,\n 'react-aria-item-action',\n state.isOpen\n ? () => {\n state.close();\n }\n : undefined\n );\n\n return {\n labelProps,\n buttonProps: {\n ...menuTriggerProps,\n ...triggerLabelProps,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n onPress,\n onPressStart,\n isDisabled: isDisabled || isReadOnly\n },\n inputProps: mergeProps(inputProps, {\n role: 'combobox',\n 'aria-expanded': menuTriggerProps['aria-expanded'],\n 'aria-controls': state.isOpen ? menuProps.id : undefined,\n // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)\n 'aria-autocomplete': 'list',\n 'aria-activedescendant': focusedItem ? getItemId(state, focusedItem.key) : undefined,\n onTouchEnd,\n // This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.\n autoCorrect: 'off',\n // This disable's the macOS Safari spell check auto corrections.\n spellCheck: 'false'\n }),\n listBoxProps: mergeProps(menuProps, listBoxProps, {\n autoFocus: state.focusStrategy || true,\n shouldUseVirtualFocus: true,\n shouldSelectOnPressUp: true,\n shouldFocusOnHover: true,\n linkBehavior: 'selection' as const,\n ['UNSTABLE_itemBehavior']: 'action'\n }),\n valueProps: {\n id: valueId\n },\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\n// This is a modified version of useSlotId that uses useEffect instead of useLayoutEffect.\n// Triggering re-renders from useLayoutEffect breaks useComboBoxState's useEffect logic in React 18.\n// These re-renders preempt async state updates in the useEffect, which ends up running multiple times\n// prior to the state being updated. This results in onSelectionChange being called multiple times.\n// TODO: refactor useComboBoxState to avoid this.\nfunction useValueId(depArray: ReadonlyArray<any> = []): string | undefined {\n let id = useId();\n let [exists, setExists] = useState(true);\n let [lastDeps, setLastDeps] = useState(depArray);\n\n // If the deps changed, set exists to true so we can test whether the element exists.\n if (lastDeps.some((v, i) => !Object.is(v, depArray[i]))) {\n setExists(true);\n setLastDeps(depArray);\n }\n\n useEffect(() => {\n if (exists && !document.getElementById(id)) {\n // oxlint-disable-next-line react-hooks-js/set-state-in-effect\n setExists(false);\n }\n }, [id, exists, lastDeps]);\n\n return exists ? id : undefined;\n}\n"],"names":[],"version":3,"file":"useComboBox.js.map"}
|
|
@@ -218,8 +218,8 @@ function $bf505c7417d9b616$export$8c18d1b4f7232bbf(props, state) {
|
|
|
218
218
|
}
|
|
219
219
|
let rect = (0, $23f2114a1b82827e$export$e58f029f0fbfdb29)(e).getBoundingClientRect();
|
|
220
220
|
let touch = e.changedTouches[0];
|
|
221
|
-
let centerX = Math.ceil(rect.left + .5 * rect.width);
|
|
222
|
-
let centerY = Math.ceil(rect.top + .5 * rect.height);
|
|
221
|
+
let centerX = Math.ceil(rect.left + 0.5 * rect.width);
|
|
222
|
+
let centerY = Math.ceil(rect.top + 0.5 * rect.height);
|
|
223
223
|
if (touch.clientX === centerX && touch.clientY === centerY) {
|
|
224
224
|
e.preventDefault();
|
|
225
225
|
inputRef.current?.focus();
|
|
@@ -361,7 +361,7 @@ function $bf505c7417d9b616$var$useValueId(depArray = []) {
|
|
|
361
361
|
setLastDeps(depArray);
|
|
362
362
|
}
|
|
363
363
|
(0, $b3TGe$useEffect)(()=>{
|
|
364
|
-
if (exists && !document.getElementById(id)) //
|
|
364
|
+
if (exists && !document.getElementById(id)) // oxlint-disable-next-line react-hooks-js/set-state-in-effect
|
|
365
365
|
setExists(false);
|
|
366
366
|
}, [
|
|
367
367
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;AAiFM,SAAS,0CAAmD,KAAgC,EAAE,KAA0B;IAC7H,IAAI,aACF,SAAS,cACT,UAAU,YACV,QAAQ,cACR,UAAU,oBACV,gBAAgB,kBAChB,cAAc,mBACd,8BAA8B;IAC9B,eAAe,cACf,UAAU,cACV,UAAU,EACX,GAAG;IACJ,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,YAAY,aAAa;IAEzB,IAAI,kBAAkB,CAAA,GAAA,yCAA0B,EAAE,CAAA,GAAA,+CAAW,GAAG;IAChE,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAa,EAC/C;QACE,MAAM;QACN,YAAY,cAAc;IAC5B,GACA,OACA;IAGF,gEAAgE;IAChE,CAAA,GAAA,yCAAO,EAAE,GAAG,CAAC,OAAO;QAAC,IAAI,UAAU,EAAE;IAAA;IAErC,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,gBAAC,YAAY,EAAC,GAAG,MAAM,gBAAgB;IAC3C,IAAI,WAAW,CAAA,GAAA,cAAM,EAAE,IACrB,oBAAoB,IAAI,CAAA,GAAA,yCAAmB,EAAE;wBAC3C;0BACA;YACA,KAAK;4BACL;QACF,IACC;QAAC;QAAk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BAAoB;YACpB,cAAc;YACd,CAAC,wBAAwB,EAAE;QAC7B;QACA,YAAY;YACV,IAAI;QACN;0BACA;2BACA;mBACA;0BACA;2BACA;IACF;AACF;AAEA,0FAA0F;AAC1F,oGAAoG;AACpG,sGAAsG;AACtG,mGAAmG;AACnG,iDAAiD;AACjD,SAAS,iCAAW,WAA+B,EAAE;IACnD,IAAI,KAAK,CAAA,GAAA,yCAAI;IACb,IAAI,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,eAAO,EAAE;IACnC,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAE;IAEvC,qFAAqF;IACrF,IAAI,SAAS,IAAI,CAAC,CAAC,GAAG,IAAM,CAAC,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI;QACvD,UAAU;QACV,YAAY;IACd;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,UAAU,CAAC,SAAS,cAAc,CAAC,KACrC,2DAA2D;QAC3D,UAAU;IAEd,GAAG;QAAC;QAAI;QAAQ;KAAS;IAEzB,OAAO,SAAS,KAAK;AACvB","sources":["packages/react-aria/src/combobox/useComboBox.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\n\nimport {AriaButtonProps} from '../button/useButton';\nimport {ariaHideOutside} from '../overlays/ariaHideOutside';\nimport {AriaLabelingProps, BaseEvent, DOMAttributes, DOMProps, InputDOMProps, KeyboardDelegate, LayoutDelegate, PressEvent, RefObject, RouterOptions, ValidationResult} from '@react-types/shared';\nimport {AriaListBoxOptions} from '../listbox/useListBox';\nimport {chain} from '../utils/chain';\nimport {ComboBoxProps, ComboBoxState, SelectionMode} from 'react-stately/useComboBoxState';\nimport {dispatchVirtualFocus} from '../focus/virtualFocus';\nimport {FocusEvent, InputHTMLAttributes, KeyboardEvent, TouchEvent, useEffect, useMemo, useRef, useState} from 'react';\nimport {getActiveElement, getEventTarget, nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {getChildNodes} from 'react-stately/private/collections/getChildNodes';\nimport {getItemCount} from 'react-stately/private/collections/getItemCount';\nimport {getItemId, listData} from '../listbox/utils';\nimport {getOwnerDocument} from '../utils/domHelpers';\nimport intlMessages from '../../intl/combobox/*.json';\nimport {isAppleDevice} from '../utils/platform';\nimport {ListKeyboardDelegate} from '../selection/ListKeyboardDelegate';\nimport {mergeProps} from '../utils/mergeProps';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useEvent} from '../utils/useEvent';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\n// @ts-ignore\nimport {useLabels} from '../utils/useLabels';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useMenuTrigger} from '../menu/useMenuTrigger';\nimport {useRouter} from '../utils/openLink';\nimport {useSelectableCollection} from '../selection/useSelectableCollection';\nimport {useTextField} from '../textfield/useTextField';\nimport {useUpdateEffect} from '../utils/useUpdateEffect';\n\nexport interface AriaComboBoxProps<T, M extends SelectionMode = 'single'> extends ComboBoxProps<T, M>, DOMProps, InputDOMProps, AriaLabelingProps {\n /** Whether keyboard navigation is circular. */\n shouldFocusWrap?: boolean\n}\n\nexport interface AriaComboBoxOptions<T, M extends SelectionMode = 'single'> extends Omit<AriaComboBoxProps<T, M>, 'children'> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement | null>,\n /** The ref for the list box popover. */\n popoverRef: RefObject<Element | null>,\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement | null>,\n /** The ref for the optional list box popup trigger button. */\n buttonRef?: RefObject<Element | null>,\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate\n}\n\nexport interface ComboBoxAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes,\n /** Props for the combo box input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the list box, to be passed to `useListBox`. */\n listBoxProps: AriaListBoxOptions<T>,\n /** Props for the optional trigger button, to be passed to `useButton`. */\n buttonProps: AriaButtonProps,\n /** Props for the element representing the selected value. */\n valueProps: DOMAttributes,\n /** Props for the combo box description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the combo box error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a combo box component.\n * A combo box combines a text input with a listbox, allowing users to filter a list of options to items matching a query.\n * @param props - Props for the combo box.\n * @param state - State for the select, as returned by `useComboBoxState`.\n */\nexport function useComboBox<T, M extends SelectionMode = 'single'>(props: AriaComboBoxOptions<T, M>, state: ComboBoxState<T, M>): ComboBoxAria<T> {\n let {\n buttonRef,\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n layoutDelegate,\n // completionMode = 'suggest',\n shouldFocusWrap,\n isReadOnly,\n isDisabled\n } = props;\n let backupBtnRef = useRef(null);\n buttonRef = buttonRef ?? backupBtnRef;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/combobox');\n let {menuTriggerProps, menuProps} = useMenuTrigger<T>(\n {\n type: 'listbox',\n isDisabled: isDisabled || isReadOnly\n },\n state,\n buttonRef\n );\n\n // Set listbox id so it can be used when calling getItemId later\n listData.set(state, {id: menuProps.id});\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let {collection} = state;\n let {disabledKeys} = state.selectionManager;\n let delegate = useMemo(() => (\n keyboardDelegate || new ListKeyboardDelegate({\n collection,\n disabledKeys,\n ref: listBoxRef,\n layoutDelegate\n })\n ), [keyboardDelegate, layoutDelegate, collection, disabledKeys, listBoxRef]);\n\n // Use useSelectableCollection to get the keyboard handlers to apply to the textfield\n let {collectionProps} = useSelectableCollection({\n selectionManager: state.selectionManager,\n keyboardDelegate: delegate,\n disallowTypeAhead: true,\n disallowEmptySelection: true,\n shouldFocusWrap,\n ref: inputRef,\n // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component\n isVirtualized: true\n });\n\n let router = useRouter();\n\n // For textfield specific keydown operations\n let onKeyDown = (e: BaseEvent<KeyboardEvent<any>>) => {\n if (e.nativeEvent.isComposing) {\n return;\n }\n switch (e.key) {\n case 'Enter':\n case 'Tab':\n // Prevent form submission if menu is open since we may be selecting a option\n if (state.isOpen && e.key === 'Enter') {\n e.preventDefault();\n }\n\n // If the focused item is a link, trigger opening it. Items that are links are not selectable.\n if (state.isOpen && listBoxRef.current && state.selectionManager.focusedKey != null) {\n let collectionItem = state.collection.getItem(state.selectionManager.focusedKey);\n if (collectionItem?.props.href) {\n let item = listBoxRef.current.querySelector(`[data-key=\"${CSS.escape(state.selectionManager.focusedKey.toString())}\"]`);\n if (e.key === 'Enter' && item instanceof HTMLAnchorElement) {\n router.open(item, e, collectionItem.props.href, collectionItem.props.routerOptions as RouterOptions);\n }\n state.close();\n break;\n } else if (collectionItem?.props.onAction) {\n collectionItem.props.onAction();\n state.close();\n break;\n }\n }\n if (e.key === 'Enter' || state.isOpen) {\n state.commit();\n }\n break;\n case 'Escape':\n if (\n !state.selectionManager.isEmpty ||\n state.inputValue === '' ||\n props.allowsCustomValue\n ) {\n e.continuePropagation();\n }\n state.revert();\n break;\n case 'ArrowDown':\n state.open('first', 'manual');\n break;\n case 'ArrowUp':\n state.open('last', 'manual');\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n state.selectionManager.setFocusedKey(null);\n break;\n }\n };\n\n let onBlur = (e: FocusEvent<HTMLInputElement>) => {\n let blurFromButton = buttonRef?.current && buttonRef.current === e.relatedTarget;\n let blurIntoPopover = nodeContains(popoverRef.current, e.relatedTarget);\n // Ignore blur if focused moved to the button(if exists) or into the popover.\n if (blurFromButton || blurIntoPopover) {\n return;\n }\n\n if (props.onBlur) {\n props.onBlur(e);\n }\n\n state.setFocused(false);\n };\n\n let onFocus = (e: FocusEvent<HTMLInputElement>) => {\n if (state.isFocused) {\n return;\n }\n\n if (props.onFocus) {\n props.onFocus(e);\n }\n\n state.setFocused(true);\n };\n\n let valueId = useValueId([state.selectionManager.selectedKeys, state.selectionManager.selectionMode]);\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField({\n ...props,\n // In multi-select mode, only set required if the selection is empty.\n isRequired: props.selectionMode === 'multiple' ? props.isRequired && state.selectionManager.isEmpty : props.isRequired,\n onChange: state.setInputValue,\n onKeyDown: !isReadOnly ? chain(state.isOpen && collectionProps.onKeyDown, onKeyDown, props.onKeyDown) : props.onKeyDown,\n onBlur,\n value: state.inputValue,\n defaultValue: state.defaultInputValue,\n onFocus,\n autoComplete: 'off',\n validate: undefined,\n [privateValidationStateProp]: state,\n 'aria-describedby': [valueId, props['aria-describedby']].filter(Boolean).join(' ') || undefined\n }, inputRef);\n\n useFormReset(inputRef, state.defaultValue, state.setValue);\n\n // Press handlers for the ComboBox button\n let onPress = (e: PressEvent) => {\n if (e.pointerType === 'touch') {\n // Focus the input field in case it isn't focused yet\n inputRef.current?.focus();\n state.toggle(null, 'manual');\n }\n };\n\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType !== 'touch') {\n inputRef.current?.focus();\n state.toggle((e.pointerType === 'keyboard' || e.pointerType === 'virtual') ? 'first' : null, 'manual');\n }\n };\n\n let triggerLabelProps = useLabels({\n id: menuTriggerProps.id,\n 'aria-label': stringFormatter.format('buttonLabel'),\n 'aria-labelledby': props['aria-labelledby'] || labelProps.id\n });\n\n let listBoxProps = useLabels({\n id: menuProps.id,\n 'aria-label': stringFormatter.format('listboxLabel'),\n 'aria-labelledby': props['aria-labelledby'] || labelProps.id\n });\n\n // If a touch happens on direct center of ComboBox input, might be virtual click from iPad so open ComboBox menu\n let lastEventTime = useRef(0);\n let onTouchEnd = (e: TouchEvent) => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n // Sometimes VoiceOver on iOS fires two touchend events in quick succession. Ignore the second one.\n if (e.timeStamp - lastEventTime.current < 500) {\n e.preventDefault();\n inputRef.current?.focus();\n return;\n }\n\n let rect = (getEventTarget(e) as Element).getBoundingClientRect();\n let touch = e.changedTouches[0];\n\n let centerX = Math.ceil(rect.left + .5 * rect.width);\n let centerY = Math.ceil(rect.top + .5 * rect.height);\n\n if (touch.clientX === centerX && touch.clientY === centerY) {\n e.preventDefault();\n inputRef.current?.focus();\n state.toggle(null, 'manual');\n\n lastEventTime.current = e.timeStamp;\n }\n };\n\n // VoiceOver has issues with announcing aria-activedescendant properly on change\n // (especially on iOS). We use a live region announcer to announce focus changes\n // manually. In addition, section titles are announced when navigating into a new section.\n let focusedItem = state.selectionManager.focusedKey != null && state.isOpen\n ? state.collection.getItem(state.selectionManager.focusedKey)\n : undefined;\n let sectionKey = focusedItem?.parentKey ?? null;\n let itemKey = state.selectionManager.focusedKey ?? null;\n let lastSection = useRef(sectionKey);\n let lastItem = useRef(itemKey);\n useEffect(() => {\n if (isAppleDevice() && focusedItem != null && itemKey != null && itemKey !== lastItem.current) {\n let isSelected = state.selectionManager.isSelected(itemKey);\n let section = sectionKey != null ? state.collection.getItem(sectionKey) : null;\n let sectionTitle = section?.['aria-label'] || (typeof section?.rendered === 'string' ? section.rendered : '') || '';\n\n let announcement = stringFormatter.format('focusAnnouncement', {\n isGroupChange: (section && sectionKey !== lastSection.current) ?? false,\n groupTitle: sectionTitle,\n groupCount: section ? [...getChildNodes(section, state.collection)].length : 0,\n optionText: focusedItem['aria-label'] || focusedItem.textValue || '',\n isSelected\n });\n\n announce(announcement);\n }\n\n lastSection.current = sectionKey;\n lastItem.current = itemKey;\n });\n\n // Announce the number of available suggestions when it changes\n let optionCount = getItemCount(state.collection);\n let lastSize = useRef(optionCount);\n let lastOpen = useRef(state.isOpen);\n useEffect(() => {\n // Only announce the number of options available when the menu opens if there is no\n // focused item, otherwise screen readers will typically read e.g. \"1 of 6\".\n // The exception is VoiceOver since this isn't included in the message above.\n let didOpenWithoutFocusedItem =\n state.isOpen !== lastOpen.current &&\n (state.selectionManager.focusedKey == null || isAppleDevice());\n\n if (state.isOpen && (didOpenWithoutFocusedItem || optionCount !== lastSize.current)) {\n let announcement = stringFormatter.format('countAnnouncement', {optionCount});\n announce(announcement);\n }\n\n lastSize.current = optionCount;\n lastOpen.current = state.isOpen;\n });\n\n // Announce when a selection occurs for VoiceOver. Other screen readers typically do this automatically.\n // TODO: do we need to do this for multi-select?\n let lastSelectedKey = useRef(state.selectedKey);\n useEffect(() => {\n if (isAppleDevice() && state.isFocused && state.selectedItem && state.selectedKey !== lastSelectedKey.current) {\n let optionText = state.selectedItem['aria-label'] || state.selectedItem.textValue || '';\n let announcement = stringFormatter.format('selectedAnnouncement', {optionText});\n announce(announcement);\n }\n\n lastSelectedKey.current = state.selectedKey;\n });\n\n useEffect(() => {\n if (state.isOpen) {\n return ariaHideOutside([inputRef.current, popoverRef.current].filter(element => element != null));\n }\n }, [state.isOpen, inputRef, popoverRef]);\n\n useUpdateEffect(() => {\n // Re-show focus ring when there is no virtually focused item.\n if (!focusedItem && inputRef.current && getActiveElement(getOwnerDocument(inputRef.current)) === inputRef.current) {\n dispatchVirtualFocus(inputRef.current, null);\n }\n }, [focusedItem]);\n\n useEvent(listBoxRef, 'react-aria-item-action', state.isOpen ? () => {\n state.close();\n } : undefined);\n\n return {\n labelProps,\n buttonProps: {\n ...menuTriggerProps,\n ...triggerLabelProps,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n onPress,\n onPressStart,\n isDisabled: isDisabled || isReadOnly\n },\n inputProps: mergeProps(inputProps, {\n role: 'combobox',\n 'aria-expanded': menuTriggerProps['aria-expanded'],\n 'aria-controls': state.isOpen ? menuProps.id : undefined,\n // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)\n 'aria-autocomplete': 'list',\n 'aria-activedescendant': focusedItem ? getItemId(state, focusedItem.key) : undefined,\n onTouchEnd,\n // This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.\n autoCorrect: 'off',\n // This disable's the macOS Safari spell check auto corrections.\n spellCheck: 'false'\n }),\n listBoxProps: mergeProps(menuProps, listBoxProps, {\n autoFocus: state.focusStrategy || true,\n shouldUseVirtualFocus: true,\n shouldSelectOnPressUp: true,\n shouldFocusOnHover: true,\n linkBehavior: 'selection' as const,\n ['UNSTABLE_itemBehavior']: 'action'\n }),\n valueProps: {\n id: valueId\n },\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\n// This is a modified version of useSlotId that uses useEffect instead of useLayoutEffect.\n// Triggering re-renders from useLayoutEffect breaks useComboBoxState's useEffect logic in React 18.\n// These re-renders preempt async state updates in the useEffect, which ends up running multiple times\n// prior to the state being updated. This results in onSelectionChange being called multiple times.\n// TODO: refactor useComboBoxState to avoid this.\nfunction useValueId(depArray: ReadonlyArray<any> = []): string | undefined {\n let id = useId();\n let [exists, setExists] = useState(true);\n let [lastDeps, setLastDeps] = useState(depArray);\n\n // If the deps changed, set exists to true so we can test whether the element exists.\n if (lastDeps.some((v, i) => !Object.is(v, depArray[i]))) {\n setExists(true);\n setLastDeps(depArray);\n }\n\n useEffect(() => {\n if (exists && !document.getElementById(id)) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setExists(false);\n }\n }, [id, exists, lastDeps]);\n\n return exists ? id : undefined;\n}\n"],"names":[],"version":3,"file":"useComboBox.mjs.map"}
|
|
1
|
+
{"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C,qFAAqF;IACrF,IAAI,SAAS,IAAI,CAAC,CAAC,GAAG,IAAM,CAAC,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI;QACvD,UAAU;QACV,YAAY;IACd;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,UAAU,CAAC,SAAS,cAAc,CAAC,KACrC,8DAA8D;QAC9D,UAAU;IAEd,GAAG;QAAC;QAAI;QAAQ;KAAS;IAEzB,OAAO,SAAS,KAAK;AACvB","sources":["packages/react-aria/src/combobox/useComboBox.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\n\nimport {AriaButtonProps} from '../button/useButton';\nimport {ariaHideOutside} from '../overlays/ariaHideOutside';\nimport {\n AriaLabelingProps,\n BaseEvent,\n DOMAttributes,\n DOMProps,\n InputDOMProps,\n KeyboardDelegate,\n LayoutDelegate,\n PressEvent,\n RefObject,\n RouterOptions,\n ValidationResult\n} from '@react-types/shared';\nimport {AriaListBoxOptions} from '../listbox/useListBox';\nimport {chain} from '../utils/chain';\nimport {ComboBoxProps, ComboBoxState, SelectionMode} from 'react-stately/useComboBoxState';\nimport {dispatchVirtualFocus} from '../focus/virtualFocus';\nimport {\n FocusEvent,\n InputHTMLAttributes,\n KeyboardEvent,\n TouchEvent,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {getActiveElement, getEventTarget, nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {getChildNodes} from 'react-stately/private/collections/getChildNodes';\nimport {getItemCount} from 'react-stately/private/collections/getItemCount';\nimport {getItemId, listData} from '../listbox/utils';\nimport {getOwnerDocument} from '../utils/domHelpers';\nimport intlMessages from '../../intl/combobox/*.json';\nimport {isAppleDevice} from '../utils/platform';\nimport {ListKeyboardDelegate} from '../selection/ListKeyboardDelegate';\nimport {mergeProps} from '../utils/mergeProps';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useEvent} from '../utils/useEvent';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\n// @ts-ignore\nimport {useLabels} from '../utils/useLabels';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useMenuTrigger} from '../menu/useMenuTrigger';\nimport {useRouter} from '../utils/openLink';\nimport {useSelectableCollection} from '../selection/useSelectableCollection';\nimport {useTextField} from '../textfield/useTextField';\nimport {useUpdateEffect} from '../utils/useUpdateEffect';\n\nexport interface AriaComboBoxProps<T, M extends SelectionMode = 'single'>\n extends ComboBoxProps<T, M>, DOMProps, InputDOMProps, AriaLabelingProps {\n /** Whether keyboard navigation is circular. */\n shouldFocusWrap?: boolean;\n}\n\nexport interface AriaComboBoxOptions<T, M extends SelectionMode = 'single'> extends Omit<\n AriaComboBoxProps<T, M>,\n 'children'\n> {\n /** The ref for the input element. */\n inputRef: RefObject<HTMLInputElement | null>;\n /** The ref for the list box popover. */\n popoverRef: RefObject<Element | null>;\n /** The ref for the list box. */\n listBoxRef: RefObject<HTMLElement | null>;\n /** The ref for the optional list box popup trigger button. */\n buttonRef?: RefObject<Element | null>;\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate;\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate;\n}\n\nexport interface ComboBoxAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: DOMAttributes;\n /** Props for the combo box input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the list box, to be passed to `useListBox`. */\n listBoxProps: AriaListBoxOptions<T>;\n /** Props for the optional trigger button, to be passed to `useButton`. */\n buttonProps: AriaButtonProps;\n /** Props for the element representing the selected value. */\n valueProps: DOMAttributes;\n /** Props for the combo box description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the combo box error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a combo box component. A combo box\n * combines a text input with a listbox, allowing users to filter a list of options to items\n * matching a query.\n *\n * @param props - Props for the combo box.\n * @param state - State for the select, as returned by `useComboBoxState`.\n */\nexport function useComboBox<T, M extends SelectionMode = 'single'>(\n props: AriaComboBoxOptions<T, M>,\n state: ComboBoxState<T, M>\n): ComboBoxAria<T> {\n let {\n buttonRef,\n popoverRef,\n inputRef,\n listBoxRef,\n keyboardDelegate,\n layoutDelegate,\n // completionMode = 'suggest',\n shouldFocusWrap,\n isReadOnly,\n isDisabled\n } = props;\n let backupBtnRef = useRef(null);\n buttonRef = buttonRef ?? backupBtnRef;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/combobox');\n let {menuTriggerProps, menuProps} = useMenuTrigger<T>(\n {\n type: 'listbox',\n isDisabled: isDisabled || isReadOnly\n },\n state,\n buttonRef\n );\n\n // Set listbox id so it can be used when calling getItemId later\n listData.set(state, {id: menuProps.id});\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let {collection} = state;\n let {disabledKeys} = state.selectionManager;\n let delegate = useMemo(\n () =>\n keyboardDelegate ||\n new ListKeyboardDelegate({\n collection,\n disabledKeys,\n ref: listBoxRef,\n layoutDelegate\n }),\n [keyboardDelegate, layoutDelegate, collection, disabledKeys, listBoxRef]\n );\n\n // Use useSelectableCollection to get the keyboard handlers to apply to the textfield\n let {collectionProps} = useSelectableCollection({\n selectionManager: state.selectionManager,\n keyboardDelegate: delegate,\n disallowTypeAhead: true,\n disallowEmptySelection: true,\n shouldFocusWrap,\n ref: inputRef,\n // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component\n isVirtualized: true\n });\n\n let router = useRouter();\n\n // For textfield specific keydown operations\n let onKeyDown = (e: BaseEvent<KeyboardEvent<any>>) => {\n if (e.nativeEvent.isComposing) {\n return;\n }\n switch (e.key) {\n case 'Enter':\n case 'Tab':\n // Prevent form submission if menu is open since we may be selecting a option\n if (state.isOpen && e.key === 'Enter') {\n e.preventDefault();\n }\n\n // If the focused item is a link, trigger opening it. Items that are links are not selectable.\n if (state.isOpen && listBoxRef.current && state.selectionManager.focusedKey != null) {\n let collectionItem = state.collection.getItem(state.selectionManager.focusedKey);\n if (collectionItem?.props.href) {\n let item = listBoxRef.current.querySelector(\n `[data-key=\"${CSS.escape(state.selectionManager.focusedKey.toString())}\"]`\n );\n if (e.key === 'Enter' && item instanceof HTMLAnchorElement) {\n router.open(\n item,\n e,\n collectionItem.props.href,\n collectionItem.props.routerOptions as RouterOptions\n );\n }\n state.close();\n break;\n } else if (collectionItem?.props.onAction) {\n collectionItem.props.onAction();\n state.close();\n break;\n }\n }\n if (e.key === 'Enter' || state.isOpen) {\n state.commit();\n }\n break;\n case 'Escape':\n if (!state.selectionManager.isEmpty || state.inputValue === '' || props.allowsCustomValue) {\n e.continuePropagation();\n }\n state.revert();\n break;\n case 'ArrowDown':\n state.open('first', 'manual');\n break;\n case 'ArrowUp':\n state.open('last', 'manual');\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n state.selectionManager.setFocusedKey(null);\n break;\n }\n };\n\n let onBlur = (e: FocusEvent<HTMLInputElement>) => {\n let blurFromButton = buttonRef?.current && buttonRef.current === e.relatedTarget;\n let blurIntoPopover = nodeContains(popoverRef.current, e.relatedTarget);\n // Ignore blur if focused moved to the button(if exists) or into the popover.\n if (blurFromButton || blurIntoPopover) {\n return;\n }\n\n if (props.onBlur) {\n props.onBlur(e);\n }\n\n state.setFocused(false);\n };\n\n let onFocus = (e: FocusEvent<HTMLInputElement>) => {\n if (state.isFocused) {\n return;\n }\n\n if (props.onFocus) {\n props.onFocus(e);\n }\n\n state.setFocused(true);\n };\n\n let valueId = useValueId([\n state.selectionManager.selectedKeys,\n state.selectionManager.selectionMode\n ]);\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField(\n {\n ...props,\n // In multi-select mode, only set required if the selection is empty.\n isRequired:\n props.selectionMode === 'multiple'\n ? props.isRequired && state.selectionManager.isEmpty\n : props.isRequired,\n onChange: state.setInputValue,\n onKeyDown: !isReadOnly\n ? chain(state.isOpen && collectionProps.onKeyDown, onKeyDown, props.onKeyDown)\n : props.onKeyDown,\n onBlur,\n value: state.inputValue,\n defaultValue: state.defaultInputValue,\n onFocus,\n autoComplete: 'off',\n validate: undefined,\n [privateValidationStateProp]: state,\n 'aria-describedby':\n [valueId, props['aria-describedby']].filter(Boolean).join(' ') || undefined\n },\n inputRef\n );\n\n useFormReset(inputRef, state.defaultValue, state.setValue);\n\n // Press handlers for the ComboBox button\n let onPress = (e: PressEvent) => {\n if (e.pointerType === 'touch') {\n // Focus the input field in case it isn't focused yet\n inputRef.current?.focus();\n state.toggle(null, 'manual');\n }\n };\n\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType !== 'touch') {\n inputRef.current?.focus();\n state.toggle(\n e.pointerType === 'keyboard' || e.pointerType === 'virtual' ? 'first' : null,\n 'manual'\n );\n }\n };\n\n let triggerLabelProps = useLabels({\n id: menuTriggerProps.id,\n 'aria-label': stringFormatter.format('buttonLabel'),\n 'aria-labelledby': props['aria-labelledby'] || labelProps.id\n });\n\n let listBoxProps = useLabels({\n id: menuProps.id,\n 'aria-label': stringFormatter.format('listboxLabel'),\n 'aria-labelledby': props['aria-labelledby'] || labelProps.id\n });\n\n // If a touch happens on direct center of ComboBox input, might be virtual click from iPad so open ComboBox menu\n let lastEventTime = useRef(0);\n let onTouchEnd = (e: TouchEvent) => {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n // Sometimes VoiceOver on iOS fires two touchend events in quick succession. Ignore the second one.\n if (e.timeStamp - lastEventTime.current < 500) {\n e.preventDefault();\n inputRef.current?.focus();\n return;\n }\n\n let rect = (getEventTarget(e) as Element).getBoundingClientRect();\n let touch = e.changedTouches[0];\n\n let centerX = Math.ceil(rect.left + 0.5 * rect.width);\n let centerY = Math.ceil(rect.top + 0.5 * rect.height);\n\n if (touch.clientX === centerX && touch.clientY === centerY) {\n e.preventDefault();\n inputRef.current?.focus();\n state.toggle(null, 'manual');\n\n lastEventTime.current = e.timeStamp;\n }\n };\n\n // VoiceOver has issues with announcing aria-activedescendant properly on change\n // (especially on iOS). We use a live region announcer to announce focus changes\n // manually. In addition, section titles are announced when navigating into a new section.\n let focusedItem =\n state.selectionManager.focusedKey != null && state.isOpen\n ? state.collection.getItem(state.selectionManager.focusedKey)\n : undefined;\n let sectionKey = focusedItem?.parentKey ?? null;\n let itemKey = state.selectionManager.focusedKey ?? null;\n let lastSection = useRef(sectionKey);\n let lastItem = useRef(itemKey);\n useEffect(() => {\n if (isAppleDevice() && focusedItem != null && itemKey != null && itemKey !== lastItem.current) {\n let isSelected = state.selectionManager.isSelected(itemKey);\n let section = sectionKey != null ? state.collection.getItem(sectionKey) : null;\n let sectionTitle =\n section?.['aria-label'] ||\n (typeof section?.rendered === 'string' ? section.rendered : '') ||\n '';\n\n let announcement = stringFormatter.format('focusAnnouncement', {\n isGroupChange: (section && sectionKey !== lastSection.current) ?? false,\n groupTitle: sectionTitle,\n groupCount: section ? [...getChildNodes(section, state.collection)].length : 0,\n optionText: focusedItem['aria-label'] || focusedItem.textValue || '',\n isSelected\n });\n\n announce(announcement);\n }\n\n lastSection.current = sectionKey;\n lastItem.current = itemKey;\n });\n\n // Announce the number of available suggestions when it changes\n let optionCount = getItemCount(state.collection);\n let lastSize = useRef(optionCount);\n let lastOpen = useRef(state.isOpen);\n useEffect(() => {\n // Only announce the number of options available when the menu opens if there is no\n // focused item, otherwise screen readers will typically read e.g. \"1 of 6\".\n // The exception is VoiceOver since this isn't included in the message above.\n let didOpenWithoutFocusedItem =\n state.isOpen !== lastOpen.current &&\n (state.selectionManager.focusedKey == null || isAppleDevice());\n\n if (state.isOpen && (didOpenWithoutFocusedItem || optionCount !== lastSize.current)) {\n let announcement = stringFormatter.format('countAnnouncement', {optionCount});\n announce(announcement);\n }\n\n lastSize.current = optionCount;\n lastOpen.current = state.isOpen;\n });\n\n // Announce when a selection occurs for VoiceOver. Other screen readers typically do this automatically.\n // TODO: do we need to do this for multi-select?\n let lastSelectedKey = useRef(state.selectedKey);\n useEffect(() => {\n if (\n isAppleDevice() &&\n state.isFocused &&\n state.selectedItem &&\n state.selectedKey !== lastSelectedKey.current\n ) {\n let optionText = state.selectedItem['aria-label'] || state.selectedItem.textValue || '';\n let announcement = stringFormatter.format('selectedAnnouncement', {optionText});\n announce(announcement);\n }\n\n lastSelectedKey.current = state.selectedKey;\n });\n\n useEffect(() => {\n if (state.isOpen) {\n return ariaHideOutside(\n [inputRef.current, popoverRef.current].filter(element => element != null)\n );\n }\n }, [state.isOpen, inputRef, popoverRef]);\n\n useUpdateEffect(() => {\n // Re-show focus ring when there is no virtually focused item.\n if (\n !focusedItem &&\n inputRef.current &&\n getActiveElement(getOwnerDocument(inputRef.current)) === inputRef.current\n ) {\n dispatchVirtualFocus(inputRef.current, null);\n }\n }, [focusedItem]);\n\n useEvent(\n listBoxRef,\n 'react-aria-item-action',\n state.isOpen\n ? () => {\n state.close();\n }\n : undefined\n );\n\n return {\n labelProps,\n buttonProps: {\n ...menuTriggerProps,\n ...triggerLabelProps,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n onPress,\n onPressStart,\n isDisabled: isDisabled || isReadOnly\n },\n inputProps: mergeProps(inputProps, {\n role: 'combobox',\n 'aria-expanded': menuTriggerProps['aria-expanded'],\n 'aria-controls': state.isOpen ? menuProps.id : undefined,\n // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)\n 'aria-autocomplete': 'list',\n 'aria-activedescendant': focusedItem ? getItemId(state, focusedItem.key) : undefined,\n onTouchEnd,\n // This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.\n autoCorrect: 'off',\n // This disable's the macOS Safari spell check auto corrections.\n spellCheck: 'false'\n }),\n listBoxProps: mergeProps(menuProps, listBoxProps, {\n autoFocus: state.focusStrategy || true,\n shouldUseVirtualFocus: true,\n shouldSelectOnPressUp: true,\n shouldFocusOnHover: true,\n linkBehavior: 'selection' as const,\n ['UNSTABLE_itemBehavior']: 'action'\n }),\n valueProps: {\n id: valueId\n },\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\n// This is a modified version of useSlotId that uses useEffect instead of useLayoutEffect.\n// Triggering re-renders from useLayoutEffect breaks useComboBoxState's useEffect logic in React 18.\n// These re-renders preempt async state updates in the useEffect, which ends up running multiple times\n// prior to the state being updated. This results in onSelectionChange being called multiple times.\n// TODO: refactor useComboBoxState to avoid this.\nfunction useValueId(depArray: ReadonlyArray<any> = []): string | undefined {\n let id = useId();\n let [exists, setExists] = useState(true);\n let [lastDeps, setLastDeps] = useState(depArray);\n\n // If the deps changed, set exists to true so we can test whether the element exists.\n if (lastDeps.some((v, i) => !Object.is(v, depArray[i]))) {\n setExists(true);\n setLastDeps(depArray);\n }\n\n useEffect(() => {\n if (exists && !document.getElementById(id)) {\n // oxlint-disable-next-line react-hooks-js/set-state-in-effect\n setExists(false);\n }\n }, [id, exists, lastDeps]);\n\n return exists ? id : undefined;\n}\n"],"names":[],"version":3,"file":"useComboBox.mjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAqDM,MAAM,4CAA8C,IAAI;AAKxD,MAAM,4CAAqB;AAC3B,MAAM,4CAA6B;AAOnC,SAAS,0CAAkC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kBAAkB,KAAK,UAAU;QACzC,qEAAqE;QACrE,iFAAiF;QACjF,WAAW,IAAI,GAAG;QAClB,WAAW,MAAM,GAAG;QACpB,WAAW,QAAQ,GAAG,MAAM,UAAU;QACtC,wBAAwB;QACxB,WAAW,QAAQ,GAAG,KAAO;IAC/B;IAEA,IAAI,WAAW,CAAA,GAAA,wCAAa,EAAE;IAC9B,OAAO;QACL,YAAY;YACV,GAAG,UAAU;YACb,SAAS;gBACP,aAAa,UAAU;YACzB;QACF;QACA,YAAY,CAAA,GAAA,oCAAS,EAAE,UAAU,eAAe,YAAY,kBAAkB;YAC5E,WAAU,CAAgB;gBACxB,IAAI,MAAM,SAAS,EACjB,MAAM,SAAS,CAAC;YAEpB;YACA,SAAQ,CAAgB;gBACtB,IAAI,MAAM,OAAO,EACf,MAAM,OAAO,CAAC;YAElB;YACA,OAAO;gBACL,aAAa;YACf;QACF;oBACA;0BACA;2BACA;mBACA;0BACA;2BACA;IACF;AACF;AAcO,SAAS,0CAAkC,KAA8B,EAAE,KAAqB,EAAE,GAA8B;IACrI,IAAI,MAAM,0CAAa,OAAO,OAAO;IACrC,IAAI,UAAU,CAAC,KAAK,GAAG,MAAM,SAAS,EAAE,cAAc;IACtD,OAAO;AACT","sources":["packages/react-aria/src/datepicker/useDateField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, GroupDOMAttributes, InputDOMProps, KeyboardEvent, RefObject, ValidationResult} from '@react-types/shared';\nimport {createFocusManager, FocusManager} from '../focus/FocusScope';\nimport {DateFieldProps, DateFieldState, DateValue} from 'react-stately/useDateFieldState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {InputHTMLAttributes, useEffect, useMemo, useRef} from 'react';\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {TimeFieldState, TimePickerProps, TimeValue} from 'react-stately/useTimeFieldState';\nimport {useDatePickerGroup} from './useDatePickerGroup';\n// @ts-ignore\nimport {useDescription} from '../utils/useDescription';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useFormValidation} from '../form/useFormValidation';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\n\nexport interface AriaDateFieldProps<T extends DateValue> extends DateFieldProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {\n /**\n * Describes the type of autocomplete functionality the input should provide if any. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).\n */\n autoComplete?: string\n}\n\n// Allows this hook to also be used with TimeField\nexport interface AriaDateFieldOptions<T extends DateValue> extends Omit<AriaDateFieldProps<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue' | 'validate'> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface DateFieldAria extends ValidationResult {\n /** Props for the field's visible label element, if any. */\n labelProps: DOMAttributes,\n /** Props for the field grouping element. */\n fieldProps: GroupDOMAttributes,\n /** Props for the hidden input element for HTML form submission. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n// Data that is passed between useDateField and useDateSegment.\ninterface HookData {\n ariaLabel?: string,\n ariaLabelledBy?: string,\n ariaDescribedBy?: string,\n focusManager: FocusManager\n}\n\nexport const hookData: WeakMap<DateFieldState, HookData> = new WeakMap<DateFieldState, HookData>();\n\n// Private props that we pass from useDatePicker/useDateRangePicker.\n// Ideally we'd use a Symbol for this, but React doesn't support them: https://github.com/facebook/react/issues/7552\n// These need to be stable across server and client module evaluation for SSR hydration.\nexport const roleSymbol: string = '__reactAriaDateFieldRole';\nexport const focusManagerSymbol: string = '__reactAriaDateFieldFocusManager';\n\n/**\n * Provides the behavior and accessibility implementation for a date field component.\n * A date field allows users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nexport function useDateField<T extends DateValue>(props: AriaDateFieldOptions<T>, state: DateFieldState, ref: RefObject<Element | null>): DateFieldAria {\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let valueOnFocus = useRef<DateValue | null>(null);\n let {focusWithinProps} = useFocusWithin({\n ...props,\n onFocusWithin(e) {\n valueOnFocus.current = state.value;\n props.onFocus?.(e);\n },\n onBlurWithin: (e) => {\n state.confirmPlaceholder();\n if (state.value !== valueOnFocus.current) {\n state.commitValidation();\n }\n props.onBlur?.(e);\n },\n onFocusWithinChange: props.onFocusChange\n });\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';\n let field = state.maxGranularity === 'hour' ? 'time' : 'date';\n let description = state.value ? stringFormatter.format(message, {[field]: state.formatValue({month: 'long'})}) : '';\n let descProps = useDescription(description);\n\n // If within a date picker or date range picker, the date field will have role=\"presentation\" and an aria-describedby\n // will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.\n let describedBy = props[roleSymbol] === 'presentation'\n ? fieldProps['aria-describedby']\n : [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;\n let propsFocusManager = props[focusManagerSymbol];\n let focusManager = useMemo(() => propsFocusManager || createFocusManager(ref), [propsFocusManager, ref]);\n let groupProps = useDatePickerGroup(state, ref, props[roleSymbol] === 'presentation');\n\n // Pass labels and other information to segments.\n hookData.set(state, {\n ariaLabel: props['aria-label'],\n ariaLabelledBy: [labelProps.id, props['aria-labelledby']].filter(Boolean).join(' ') || undefined,\n ariaDescribedBy: describedBy,\n focusManager\n });\n\n let autoFocusRef = useRef(props.autoFocus);\n\n // When used within a date picker or date range picker, the field gets role=\"presentation\"\n // rather than role=\"group\". Since the date picker/date range picker already has a role=\"group\"\n // with a label and description, and the segments are already labeled by this as well, this\n // avoids very verbose duplicate announcements.\n let fieldDOMProps: GroupDOMAttributes;\n if (props[roleSymbol] === 'presentation') {\n fieldDOMProps = {\n role: 'presentation'\n };\n } else {\n fieldDOMProps = mergeProps(fieldProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || undefined,\n 'aria-describedby': describedBy\n });\n }\n\n useEffect(() => {\n if (autoFocusRef.current) {\n focusManager.focusFirst();\n }\n autoFocusRef.current = false;\n }, [focusManager]);\n\n useFormReset(props.inputRef, state.defaultValue, state.setValue);\n useFormValidation({\n ...props,\n focus() {\n focusManager.focusFirst();\n }\n }, state, props.inputRef);\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name: props.name,\n form: props.form,\n value: state.value?.toString() || '',\n disabled: props.isDisabled\n };\n\n if (props.validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = props.isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n let domProps = filterDOMProps(props);\n return {\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n fieldProps: mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps, {\n onKeyDown(e: KeyboardEvent) {\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n },\n style: {\n unicodeBidi: 'isolate'\n }\n }),\n inputProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nexport interface AriaTimeFieldProps<T extends TimeValue> extends TimePickerProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {}\n\nexport interface AriaTimeFieldOptions<T extends TimeValue> extends AriaTimeFieldProps<T> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a time field component.\n * A time field allows users to enter and edit time values using a keyboard.\n * Each part of a time value is displayed in an individually editable segment.\n */\nexport function useTimeField<T extends TimeValue>(props: AriaTimeFieldOptions<T>, state: TimeFieldState, ref: RefObject<Element | null>): DateFieldAria {\n let res = useDateField(props, state, ref);\n res.inputProps.value = state.timeValue?.toString() || '';\n return res;\n}\n"],"names":[],"version":3,"file":"useDateField.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAmEM,MAAM,4CAA8C,IAAI;AAKxD,MAAM,4CAAqB;AAC3B,MAAM,4CAA6B;AAOnC,SAAS,0CACd,KAA8B,EAC9B,KAAqB,EACrB,GAA8B;IAE9B,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAC9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QAC3E,GAAG,KAAK;QACR,kBAAkB;mBAClB;QACA,cAAc,MAAM,YAAY,IAAI;IACtC;IAEA,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAoB;IAC5C,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA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,IAAI,MAAM,SAAS,EACjB,MAAM,SAAS,CAAC;YAEpB;YACA,SAAQ,CAAgB;gBACtB,IAAI,MAAM,OAAO,EACf,MAAM,OAAO,CAAC;YAElB;YACA,OAAO;gBACL,aAAa;YACf;QACF;oBACA;0BACA;2BACA;mBACA;0BACA;2BACA;IACF;AACF;AAeO,SAAS,0CACd,KAA8B,EAC9B,KAAqB,EACrB,GAA8B;IAE9B,IAAI,MAAM,0CAAa,OAAO,OAAO;IACrC,IAAI,UAAU,CAAC,KAAK,GAAG,MAAM,SAAS,EAAE,cAAc;IACtD,OAAO;AACT","sources":["packages/react-aria/src/datepicker/useDateField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n InputDOMProps,\n KeyboardEvent,\n RefObject,\n ValidationResult\n} from '@react-types/shared';\nimport {createFocusManager, FocusManager} from '../focus/FocusScope';\nimport {DateFieldProps, DateFieldState, DateValue} from 'react-stately/useDateFieldState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {InputHTMLAttributes, useEffect, useMemo, useRef} from 'react';\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {TimeFieldState, TimePickerProps, TimeValue} from 'react-stately/useTimeFieldState';\nimport {useDatePickerGroup} from './useDatePickerGroup';\n// @ts-ignore\nimport {useDescription} from '../utils/useDescription';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useFormValidation} from '../form/useFormValidation';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\n\nexport interface AriaDateFieldProps<T extends DateValue>\n extends DateFieldProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {\n /**\n * Describes the type of autocomplete functionality the input should provide if any. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).\n */\n autoComplete?: string;\n}\n\n// Allows this hook to also be used with TimeField\nexport interface AriaDateFieldOptions<T extends DateValue> extends Omit<\n AriaDateFieldProps<T>,\n 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue' | 'validate'\n> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\nexport interface DateFieldAria extends ValidationResult {\n /** Props for the field's visible label element, if any. */\n labelProps: DOMAttributes;\n /** Props for the field grouping element. */\n fieldProps: GroupDOMAttributes;\n /** Props for the hidden input element for HTML form submission. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n// Data that is passed between useDateField and useDateSegment.\ninterface HookData {\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n focusManager: FocusManager;\n}\n\nexport const hookData: WeakMap<DateFieldState, HookData> = new WeakMap<DateFieldState, HookData>();\n\n// Private props that we pass from useDatePicker/useDateRangePicker.\n// Ideally we'd use a Symbol for this, but React doesn't support them: https://github.com/facebook/react/issues/7552\n// These need to be stable across server and client module evaluation for SSR hydration.\nexport const roleSymbol: string = '__reactAriaDateFieldRole';\nexport const focusManagerSymbol: string = '__reactAriaDateFieldFocusManager';\n\n/**\n * Provides the behavior and accessibility implementation for a date field component.\n * A date field allows users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nexport function useDateField<T extends DateValue>(\n props: AriaDateFieldOptions<T>,\n state: DateFieldState,\n ref: RefObject<Element | null>\n): DateFieldAria {\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let valueOnFocus = useRef<DateValue | null>(null);\n let {focusWithinProps} = useFocusWithin({\n ...props,\n onFocusWithin(e) {\n valueOnFocus.current = state.value;\n props.onFocus?.(e);\n },\n onBlurWithin: e => {\n state.confirmPlaceholder();\n if (state.value !== valueOnFocus.current) {\n state.commitValidation();\n }\n props.onBlur?.(e);\n },\n onFocusWithinChange: props.onFocusChange\n });\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n let message =\n state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';\n let field = state.maxGranularity === 'hour' ? 'time' : 'date';\n let description = state.value\n ? stringFormatter.format(message, {[field]: state.formatValue({month: 'long'})})\n : '';\n let descProps = useDescription(description);\n\n // If within a date picker or date range picker, the date field will have role=\"presentation\" and an aria-describedby\n // will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.\n let describedBy =\n props[roleSymbol] === 'presentation'\n ? fieldProps['aria-describedby']\n : [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') ||\n undefined;\n let propsFocusManager = props[focusManagerSymbol];\n let focusManager = useMemo(\n () => propsFocusManager || createFocusManager(ref),\n [propsFocusManager, ref]\n );\n let groupProps = useDatePickerGroup(state, ref, props[roleSymbol] === 'presentation');\n\n // Pass labels and other information to segments.\n hookData.set(state, {\n ariaLabel: props['aria-label'],\n ariaLabelledBy:\n [labelProps.id, props['aria-labelledby']].filter(Boolean).join(' ') || undefined,\n ariaDescribedBy: describedBy,\n focusManager\n });\n\n let autoFocusRef = useRef(props.autoFocus);\n\n // When used within a date picker or date range picker, the field gets role=\"presentation\"\n // rather than role=\"group\". Since the date picker/date range picker already has a role=\"group\"\n // with a label and description, and the segments are already labeled by this as well, this\n // avoids very verbose duplicate announcements.\n let fieldDOMProps: GroupDOMAttributes;\n if (props[roleSymbol] === 'presentation') {\n fieldDOMProps = {\n role: 'presentation'\n };\n } else {\n fieldDOMProps = mergeProps(fieldProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || undefined,\n 'aria-describedby': describedBy\n });\n }\n\n useEffect(() => {\n if (autoFocusRef.current) {\n focusManager.focusFirst();\n }\n autoFocusRef.current = false;\n }, [focusManager]);\n\n useFormReset(props.inputRef, state.defaultValue, state.setValue);\n useFormValidation(\n {\n ...props,\n focus() {\n focusManager.focusFirst();\n }\n },\n state,\n props.inputRef\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name: props.name,\n form: props.form,\n value: state.value?.toString() || '',\n disabled: props.isDisabled\n };\n\n if (props.validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = props.isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n let domProps = filterDOMProps(props);\n return {\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n fieldProps: mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps, {\n onKeyDown(e: KeyboardEvent) {\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n },\n style: {\n unicodeBidi: 'isolate'\n }\n }),\n inputProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nexport interface AriaTimeFieldProps<T extends TimeValue>\n extends TimePickerProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {}\n\nexport interface AriaTimeFieldOptions<T extends TimeValue> extends AriaTimeFieldProps<T> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a time field component.\n * A time field allows users to enter and edit time values using a keyboard.\n * Each part of a time value is displayed in an individually editable segment.\n */\nexport function useTimeField<T extends TimeValue>(\n props: AriaTimeFieldOptions<T>,\n state: TimeFieldState,\n ref: RefObject<Element | null>\n): DateFieldAria {\n let res = useDateField(props, state, ref);\n res.inputProps.value = state.timeValue?.toString() || '';\n return res;\n}\n"],"names":[],"version":3,"file":"useDateField.cjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAqDM,MAAM,4CAA8C,IAAI;AAKxD,MAAM,4CAAqB;AAC3B,MAAM,4CAA6B;AAOnC,SAAS,0CAAkC,KAA8B,EAAE,KAAqB,EAAE,GAA8B;QAuF5H;IAtFT,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAC9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;QAC3E,GAAG,KAAK;QACR,kBAAkB;mBAClB;QACA,cAAc,MAAM,YAAY,IAAI;IACtC;IAEA,IAAI,eAAe,CAAA,GAAA,aAAK,EAAoB;IAC5C,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,yCAAa,EAAE;QACtC,GAAG,KAAK;QACR,eAAc,CAAC;gBAEb;YADA,aAAa,OAAO,GAAG,MAAM,KAAK;aAClC,iBAAA,MAAM,OAAO,cAAb,qCAAA,oBAAA,OAAgB;QAClB;QACA,cAAc,CAAC;gBAKb;YAJA,MAAM,kBAAkB;YACxB,IAAI,MAAM,KAAK,KAAK,aAAa,OAAO,EACtC,MAAM,gBAAgB;aAExB,gBAAA,MAAM,MAAM,cAAZ,o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0BACA;2BACA;IACF;AACF;AAcO,SAAS,0CAAkC,KAA8B,EAAE,KAAqB,EAAE,GAA8B;QAE9G;IADvB,IAAI,MAAM,0CAAa,OAAO,OAAO;IACrC,IAAI,UAAU,CAAC,KAAK,GAAG,EAAA,mBAAA,MAAM,SAAS,cAAf,uCAAA,iBAAiB,QAAQ,OAAM;IACtD,OAAO;AACT","sources":["packages/react-aria/src/datepicker/useDateField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, GroupDOMAttributes, InputDOMProps, KeyboardEvent, RefObject, ValidationResult} from '@react-types/shared';\nimport {createFocusManager, FocusManager} from '../focus/FocusScope';\nimport {DateFieldProps, DateFieldState, DateValue} from 'react-stately/useDateFieldState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {InputHTMLAttributes, useEffect, useMemo, useRef} from 'react';\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {TimeFieldState, TimePickerProps, TimeValue} from 'react-stately/useTimeFieldState';\nimport {useDatePickerGroup} from './useDatePickerGroup';\n// @ts-ignore\nimport {useDescription} from '../utils/useDescription';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useFormValidation} from '../form/useFormValidation';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\n\nexport interface AriaDateFieldProps<T extends DateValue> extends DateFieldProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {\n /**\n * Describes the type of autocomplete functionality the input should provide if any. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).\n */\n autoComplete?: string\n}\n\n// Allows this hook to also be used with TimeField\nexport interface AriaDateFieldOptions<T extends DateValue> extends Omit<AriaDateFieldProps<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue' | 'validate'> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface DateFieldAria extends ValidationResult {\n /** Props for the field's visible label element, if any. */\n labelProps: DOMAttributes,\n /** Props for the field grouping element. */\n fieldProps: GroupDOMAttributes,\n /** Props for the hidden input element for HTML form submission. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n// Data that is passed between useDateField and useDateSegment.\ninterface HookData {\n ariaLabel?: string,\n ariaLabelledBy?: string,\n ariaDescribedBy?: string,\n focusManager: FocusManager\n}\n\nexport const hookData: WeakMap<DateFieldState, HookData> = new WeakMap<DateFieldState, HookData>();\n\n// Private props that we pass from useDatePicker/useDateRangePicker.\n// Ideally we'd use a Symbol for this, but React doesn't support them: https://github.com/facebook/react/issues/7552\n// These need to be stable across server and client module evaluation for SSR hydration.\nexport const roleSymbol: string = '__reactAriaDateFieldRole';\nexport const focusManagerSymbol: string = '__reactAriaDateFieldFocusManager';\n\n/**\n * Provides the behavior and accessibility implementation for a date field component.\n * A date field allows users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nexport function useDateField<T extends DateValue>(props: AriaDateFieldOptions<T>, state: DateFieldState, ref: RefObject<Element | null>): DateFieldAria {\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let valueOnFocus = useRef<DateValue | null>(null);\n let {focusWithinProps} = useFocusWithin({\n ...props,\n onFocusWithin(e) {\n valueOnFocus.current = state.value;\n props.onFocus?.(e);\n },\n onBlurWithin: (e) => {\n state.confirmPlaceholder();\n if (state.value !== valueOnFocus.current) {\n state.commitValidation();\n }\n props.onBlur?.(e);\n },\n onFocusWithinChange: props.onFocusChange\n });\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';\n let field = state.maxGranularity === 'hour' ? 'time' : 'date';\n let description = state.value ? stringFormatter.format(message, {[field]: state.formatValue({month: 'long'})}) : '';\n let descProps = useDescription(description);\n\n // If within a date picker or date range picker, the date field will have role=\"presentation\" and an aria-describedby\n // will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.\n let describedBy = props[roleSymbol] === 'presentation'\n ? fieldProps['aria-describedby']\n : [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;\n let propsFocusManager = props[focusManagerSymbol];\n let focusManager = useMemo(() => propsFocusManager || createFocusManager(ref), [propsFocusManager, ref]);\n let groupProps = useDatePickerGroup(state, ref, props[roleSymbol] === 'presentation');\n\n // Pass labels and other information to segments.\n hookData.set(state, {\n ariaLabel: props['aria-label'],\n ariaLabelledBy: [labelProps.id, props['aria-labelledby']].filter(Boolean).join(' ') || undefined,\n ariaDescribedBy: describedBy,\n focusManager\n });\n\n let autoFocusRef = useRef(props.autoFocus);\n\n // When used within a date picker or date range picker, the field gets role=\"presentation\"\n // rather than role=\"group\". Since the date picker/date range picker already has a role=\"group\"\n // with a label and description, and the segments are already labeled by this as well, this\n // avoids very verbose duplicate announcements.\n let fieldDOMProps: GroupDOMAttributes;\n if (props[roleSymbol] === 'presentation') {\n fieldDOMProps = {\n role: 'presentation'\n };\n } else {\n fieldDOMProps = mergeProps(fieldProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || undefined,\n 'aria-describedby': describedBy\n });\n }\n\n useEffect(() => {\n if (autoFocusRef.current) {\n focusManager.focusFirst();\n }\n autoFocusRef.current = false;\n }, [focusManager]);\n\n useFormReset(props.inputRef, state.defaultValue, state.setValue);\n useFormValidation({\n ...props,\n focus() {\n focusManager.focusFirst();\n }\n }, state, props.inputRef);\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name: props.name,\n form: props.form,\n value: state.value?.toString() || '',\n disabled: props.isDisabled\n };\n\n if (props.validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = props.isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n let domProps = filterDOMProps(props);\n return {\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n fieldProps: mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps, {\n onKeyDown(e: KeyboardEvent) {\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n },\n style: {\n unicodeBidi: 'isolate'\n }\n }),\n inputProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nexport interface AriaTimeFieldProps<T extends TimeValue> extends TimePickerProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {}\n\nexport interface AriaTimeFieldOptions<T extends TimeValue> extends AriaTimeFieldProps<T> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a time field component.\n * A time field allows users to enter and edit time values using a keyboard.\n * Each part of a time value is displayed in an individually editable segment.\n */\nexport function useTimeField<T extends TimeValue>(props: AriaTimeFieldOptions<T>, state: TimeFieldState, ref: RefObject<Element | null>): DateFieldAria {\n let res = useDateField(props, state, ref);\n res.inputProps.value = state.timeValue?.toString() || '';\n return res;\n}\n"],"names":[],"version":3,"file":"useDateField.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAmEM,MAAM,4CAA8C,IAAI;AAKxD,MAAM,4CAAqB;AAC3B,MAAM,4CAA6B;AAOnC,SAAS,0CACd,KAA8B,EAC9B,KAAqB,EACrB,GAA8B;QAqGrB;IAnGT,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAC9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;QAC3E,GAAG,KAAK;QACR,kBAAkB;mBAClB;QACA,cAAc,MAAM,YAAY,IAAI;IACtC;IAEA,IAAI,eAAe,CAAA,GAAA,aAAK,EAAoB;IAC5C,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,yCAAa,EAAE;QACtC,GAAG,KAAK;QACR,eAAc,CAAC;gBAEb;YADA,aAAa,OAAO,GAAG,MAAM,KAAK;aAClC,iBAAA,MAAM,OAAO,cAAb,qCAAA,oBAAA,OAAgB;QAClB;QACA,cAAc,CAAA;gBAKZ;YAJA,MAAM,kBAAkB;YACxB,IAAI,MAAM,KAAK,KAAK,aAAa,OAAO,EACtC,MAAM,gBAAgB;aAExB,gBAAA,MAAM,MAAM,cAAZ,oCAAA,mBAAA,OAAe;QACjB;QACA,qBAAqB,MAAM,aAAa;IAC1C;IAEA,IAAI,kBAAkB,CAAA,GAAA,yCAA0B,EAAE,CAAA,GAAA,8CAAW,GAAG;IAChE,IAAI,UACF,MAAM,cAAc,KAAK,SAAS,4BAA4B;IAChE,IAAI,QAAQ,MAAM,cAAc,KAAK,SAAS,SAAS;IACvD,IAAI,cAAc,MAAM,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ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n InputDOMProps,\n KeyboardEvent,\n RefObject,\n ValidationResult\n} from '@react-types/shared';\nimport {createFocusManager, FocusManager} from '../focus/FocusScope';\nimport {DateFieldProps, DateFieldState, DateValue} from 'react-stately/useDateFieldState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {InputHTMLAttributes, useEffect, useMemo, useRef} from 'react';\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {TimeFieldState, TimePickerProps, TimeValue} from 'react-stately/useTimeFieldState';\nimport {useDatePickerGroup} from './useDatePickerGroup';\n// @ts-ignore\nimport {useDescription} from '../utils/useDescription';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useFormValidation} from '../form/useFormValidation';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\n\nexport interface AriaDateFieldProps<T extends DateValue>\n extends DateFieldProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {\n /**\n * Describes the type of autocomplete functionality the input should provide if any. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).\n */\n autoComplete?: string;\n}\n\n// Allows this hook to also be used with TimeField\nexport interface AriaDateFieldOptions<T extends DateValue> extends Omit<\n AriaDateFieldProps<T>,\n 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue' | 'validate'\n> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\nexport interface DateFieldAria extends ValidationResult {\n /** Props for the field's visible label element, if any. */\n labelProps: DOMAttributes;\n /** Props for the field grouping element. */\n fieldProps: GroupDOMAttributes;\n /** Props for the hidden input element for HTML form submission. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n// Data that is passed between useDateField and useDateSegment.\ninterface HookData {\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n focusManager: FocusManager;\n}\n\nexport const hookData: WeakMap<DateFieldState, HookData> = new WeakMap<DateFieldState, HookData>();\n\n// Private props that we pass from useDatePicker/useDateRangePicker.\n// Ideally we'd use a Symbol for this, but React doesn't support them: https://github.com/facebook/react/issues/7552\n// These need to be stable across server and client module evaluation for SSR hydration.\nexport const roleSymbol: string = '__reactAriaDateFieldRole';\nexport const focusManagerSymbol: string = '__reactAriaDateFieldFocusManager';\n\n/**\n * Provides the behavior and accessibility implementation for a date field component.\n * A date field allows users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nexport function useDateField<T extends DateValue>(\n props: AriaDateFieldOptions<T>,\n state: DateFieldState,\n ref: RefObject<Element | null>\n): DateFieldAria {\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let valueOnFocus = useRef<DateValue | null>(null);\n let {focusWithinProps} = useFocusWithin({\n ...props,\n onFocusWithin(e) {\n valueOnFocus.current = state.value;\n props.onFocus?.(e);\n },\n onBlurWithin: e => {\n state.confirmPlaceholder();\n if (state.value !== valueOnFocus.current) {\n state.commitValidation();\n }\n props.onBlur?.(e);\n },\n onFocusWithinChange: props.onFocusChange\n });\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n let message =\n state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';\n let field = state.maxGranularity === 'hour' ? 'time' : 'date';\n let description = state.value\n ? stringFormatter.format(message, {[field]: state.formatValue({month: 'long'})})\n : '';\n let descProps = useDescription(description);\n\n // If within a date picker or date range picker, the date field will have role=\"presentation\" and an aria-describedby\n // will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.\n let describedBy =\n props[roleSymbol] === 'presentation'\n ? fieldProps['aria-describedby']\n : [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') ||\n undefined;\n let propsFocusManager = props[focusManagerSymbol];\n let focusManager = useMemo(\n () => propsFocusManager || createFocusManager(ref),\n [propsFocusManager, ref]\n );\n let groupProps = useDatePickerGroup(state, ref, props[roleSymbol] === 'presentation');\n\n // Pass labels and other information to segments.\n hookData.set(state, {\n ariaLabel: props['aria-label'],\n ariaLabelledBy:\n [labelProps.id, props['aria-labelledby']].filter(Boolean).join(' ') || undefined,\n ariaDescribedBy: describedBy,\n focusManager\n });\n\n let autoFocusRef = useRef(props.autoFocus);\n\n // When used within a date picker or date range picker, the field gets role=\"presentation\"\n // rather than role=\"group\". Since the date picker/date range picker already has a role=\"group\"\n // with a label and description, and the segments are already labeled by this as well, this\n // avoids very verbose duplicate announcements.\n let fieldDOMProps: GroupDOMAttributes;\n if (props[roleSymbol] === 'presentation') {\n fieldDOMProps = {\n role: 'presentation'\n };\n } else {\n fieldDOMProps = mergeProps(fieldProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || undefined,\n 'aria-describedby': describedBy\n });\n }\n\n useEffect(() => {\n if (autoFocusRef.current) {\n focusManager.focusFirst();\n }\n autoFocusRef.current = false;\n }, [focusManager]);\n\n useFormReset(props.inputRef, state.defaultValue, state.setValue);\n useFormValidation(\n {\n ...props,\n focus() {\n focusManager.focusFirst();\n }\n },\n state,\n props.inputRef\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name: props.name,\n form: props.form,\n value: state.value?.toString() || '',\n disabled: props.isDisabled\n };\n\n if (props.validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = props.isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n let domProps = filterDOMProps(props);\n return {\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n fieldProps: mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps, {\n onKeyDown(e: KeyboardEvent) {\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n },\n style: {\n unicodeBidi: 'isolate'\n }\n }),\n inputProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nexport interface AriaTimeFieldProps<T extends TimeValue>\n extends TimePickerProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {}\n\nexport interface AriaTimeFieldOptions<T extends TimeValue> extends AriaTimeFieldProps<T> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a time field component.\n * A time field allows users to enter and edit time values using a keyboard.\n * Each part of a time value is displayed in an individually editable segment.\n */\nexport function useTimeField<T extends TimeValue>(\n props: AriaTimeFieldOptions<T>,\n state: TimeFieldState,\n ref: RefObject<Element | null>\n): DateFieldAria {\n let res = useDateField(props, state, ref);\n res.inputProps.value = state.timeValue?.toString() || '';\n return res;\n}\n"],"names":[],"version":3,"file":"useDateField.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;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QACN,MAAM,MAAM,IAAI;QAChB,MAAM,MAAM,IAAI;QAChB,OAAO,MAAM,KAAK,EAAE,cAAc;QAClC,UAAU,MAAM,UAAU;IAC5B;IAEA,IAAI,MAAM,kBAAkB,KAAK,UAAU;QACzC,qEAAqE;QACrE,iFAAiF;QACjF,WAAW,IAAI,GAAG;QAClB,WAAW,MAAM,GAAG;QACpB,WAAW,QAAQ,GAAG,MAAM,UAAU;QACtC,wBAAwB;QACxB,WAAW,QAAQ,GAAG,KAAO;IAC/B;IAEA,IAAI,WAAW,CAAA,GAAA,yCAAa,EAAE;IAC9B,OAAO;QACL,YAAY;YACV,GAAG,UAAU;YACb,SAAS;gBACP,aAAa,UAAU;YACzB;QACF;QACA,YAAY,CAAA,GAAA,yCAAS,EAAE,UAAU,eAAe,YAAY,kBAAkB;YAC5E,WAAU,CAAgB;gBACxB,IAAI,MAAM,SAAS,EACjB,MAAM,SAAS,CAAC;YAEpB;YACA,SAAQ,CAAgB;gBACtB,IAAI,MAAM,OAAO,EACf,MAAM,OAAO,CAAC;YAElB;YACA,OAAO;gBACL,aAAa;YACf;QACF;oBACA;0BACA;2BACA;mBACA;0BACA;2BACA;IACF;AACF;AAcO,SAAS,0CAAkC,KAA8B,EAAE,KAAqB,EAAE,GAA8B;IACrI,IAAI,MAAM,0CAAa,OAAO,OAAO;IACrC,IAAI,UAAU,CAAC,KAAK,GAAG,MAAM,SAAS,EAAE,cAAc;IACtD,OAAO;AACT","sources":["packages/react-aria/src/datepicker/useDateField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, GroupDOMAttributes, InputDOMProps, KeyboardEvent, RefObject, ValidationResult} from '@react-types/shared';\nimport {createFocusManager, FocusManager} from '../focus/FocusScope';\nimport {DateFieldProps, DateFieldState, DateValue} from 'react-stately/useDateFieldState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {InputHTMLAttributes, useEffect, useMemo, useRef} from 'react';\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {TimeFieldState, TimePickerProps, TimeValue} from 'react-stately/useTimeFieldState';\nimport {useDatePickerGroup} from './useDatePickerGroup';\n// @ts-ignore\nimport {useDescription} from '../utils/useDescription';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useFormValidation} from '../form/useFormValidation';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\n\nexport interface AriaDateFieldProps<T extends DateValue> extends DateFieldProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {\n /**\n * Describes the type of autocomplete functionality the input should provide if any. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).\n */\n autoComplete?: string\n}\n\n// Allows this hook to also be used with TimeField\nexport interface AriaDateFieldOptions<T extends DateValue> extends Omit<AriaDateFieldProps<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue' | 'validate'> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface DateFieldAria extends ValidationResult {\n /** Props for the field's visible label element, if any. */\n labelProps: DOMAttributes,\n /** Props for the field grouping element. */\n fieldProps: GroupDOMAttributes,\n /** Props for the hidden input element for HTML form submission. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n// Data that is passed between useDateField and useDateSegment.\ninterface HookData {\n ariaLabel?: string,\n ariaLabelledBy?: string,\n ariaDescribedBy?: string,\n focusManager: FocusManager\n}\n\nexport const hookData: WeakMap<DateFieldState, HookData> = new WeakMap<DateFieldState, HookData>();\n\n// Private props that we pass from useDatePicker/useDateRangePicker.\n// Ideally we'd use a Symbol for this, but React doesn't support them: https://github.com/facebook/react/issues/7552\n// These need to be stable across server and client module evaluation for SSR hydration.\nexport const roleSymbol: string = '__reactAriaDateFieldRole';\nexport const focusManagerSymbol: string = '__reactAriaDateFieldFocusManager';\n\n/**\n * Provides the behavior and accessibility implementation for a date field component.\n * A date field allows users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nexport function useDateField<T extends DateValue>(props: AriaDateFieldOptions<T>, state: DateFieldState, ref: RefObject<Element | null>): DateFieldAria {\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let valueOnFocus = useRef<DateValue | null>(null);\n let {focusWithinProps} = useFocusWithin({\n ...props,\n onFocusWithin(e) {\n valueOnFocus.current = state.value;\n props.onFocus?.(e);\n },\n onBlurWithin: (e) => {\n state.confirmPlaceholder();\n if (state.value !== valueOnFocus.current) {\n state.commitValidation();\n }\n props.onBlur?.(e);\n },\n onFocusWithinChange: props.onFocusChange\n });\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';\n let field = state.maxGranularity === 'hour' ? 'time' : 'date';\n let description = state.value ? stringFormatter.format(message, {[field]: state.formatValue({month: 'long'})}) : '';\n let descProps = useDescription(description);\n\n // If within a date picker or date range picker, the date field will have role=\"presentation\" and an aria-describedby\n // will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.\n let describedBy = props[roleSymbol] === 'presentation'\n ? fieldProps['aria-describedby']\n : [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;\n let propsFocusManager = props[focusManagerSymbol];\n let focusManager = useMemo(() => propsFocusManager || createFocusManager(ref), [propsFocusManager, ref]);\n let groupProps = useDatePickerGroup(state, ref, props[roleSymbol] === 'presentation');\n\n // Pass labels and other information to segments.\n hookData.set(state, {\n ariaLabel: props['aria-label'],\n ariaLabelledBy: [labelProps.id, props['aria-labelledby']].filter(Boolean).join(' ') || undefined,\n ariaDescribedBy: describedBy,\n focusManager\n });\n\n let autoFocusRef = useRef(props.autoFocus);\n\n // When used within a date picker or date range picker, the field gets role=\"presentation\"\n // rather than role=\"group\". Since the date picker/date range picker already has a role=\"group\"\n // with a label and description, and the segments are already labeled by this as well, this\n // avoids very verbose duplicate announcements.\n let fieldDOMProps: GroupDOMAttributes;\n if (props[roleSymbol] === 'presentation') {\n fieldDOMProps = {\n role: 'presentation'\n };\n } else {\n fieldDOMProps = mergeProps(fieldProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || undefined,\n 'aria-describedby': describedBy\n });\n }\n\n useEffect(() => {\n if (autoFocusRef.current) {\n focusManager.focusFirst();\n }\n autoFocusRef.current = false;\n }, [focusManager]);\n\n useFormReset(props.inputRef, state.defaultValue, state.setValue);\n useFormValidation({\n ...props,\n focus() {\n focusManager.focusFirst();\n }\n }, state, props.inputRef);\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name: props.name,\n form: props.form,\n value: state.value?.toString() || '',\n disabled: props.isDisabled\n };\n\n if (props.validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = props.isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n let domProps = filterDOMProps(props);\n return {\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n fieldProps: mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps, {\n onKeyDown(e: KeyboardEvent) {\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n },\n style: {\n unicodeBidi: 'isolate'\n }\n }),\n inputProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nexport interface AriaTimeFieldProps<T extends TimeValue> extends TimePickerProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {}\n\nexport interface AriaTimeFieldOptions<T extends TimeValue> extends AriaTimeFieldProps<T> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a time field component.\n * A time field allows users to enter and edit time values using a keyboard.\n * Each part of a time value is displayed in an individually editable segment.\n */\nexport function useTimeField<T extends TimeValue>(props: AriaTimeFieldOptions<T>, state: TimeFieldState, ref: RefObject<Element | null>): DateFieldAria {\n let res = useDateField(props, state, ref);\n res.inputProps.value = state.timeValue?.toString() || '';\n return res;\n}\n"],"names":[],"version":3,"file":"useDateField.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAmEM,MAAM,4CAA8C,IAAI;AAKxD,MAAM,4CAAqB;AAC3B,MAAM,4CAA6B;AAOnC,SAAS,0CACd,KAA8B,EAC9B,KAAqB,EACrB,GAA8B;IAE9B,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAC9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;QAC3E,GAAG,KAAK;QACR,kBAAkB;mBAClB;QACA,cAAc,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BACP,aAAa,UAAU;YACzB;QACF;QACA,YAAY,CAAA,GAAA,yCAAS,EAAE,UAAU,eAAe,YAAY,kBAAkB;YAC5E,WAAU,CAAgB;gBACxB,IAAI,MAAM,SAAS,EACjB,MAAM,SAAS,CAAC;YAEpB;YACA,SAAQ,CAAgB;gBACtB,IAAI,MAAM,OAAO,EACf,MAAM,OAAO,CAAC;YAElB;YACA,OAAO;gBACL,aAAa;YACf;QACF;oBACA;0BACA;2BACA;mBACA;0BACA;2BACA;IACF;AACF;AAeO,SAAS,0CACd,KAA8B,EAC9B,KAAqB,EACrB,GAA8B;IAE9B,IAAI,MAAM,0CAAa,OAAO,OAAO;IACrC,IAAI,UAAU,CAAC,KAAK,GAAG,MAAM,SAAS,EAAE,cAAc;IACtD,OAAO;AACT","sources":["packages/react-aria/src/datepicker/useDateField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n InputDOMProps,\n KeyboardEvent,\n RefObject,\n ValidationResult\n} from '@react-types/shared';\nimport {createFocusManager, FocusManager} from '../focus/FocusScope';\nimport {DateFieldProps, DateFieldState, DateValue} from 'react-stately/useDateFieldState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {InputHTMLAttributes, useEffect, useMemo, useRef} from 'react';\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {TimeFieldState, TimePickerProps, TimeValue} from 'react-stately/useTimeFieldState';\nimport {useDatePickerGroup} from './useDatePickerGroup';\n// @ts-ignore\nimport {useDescription} from '../utils/useDescription';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useFormValidation} from '../form/useFormValidation';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\n\nexport interface AriaDateFieldProps<T extends DateValue>\n extends DateFieldProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {\n /**\n * Describes the type of autocomplete functionality the input should provide if any. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).\n */\n autoComplete?: string;\n}\n\n// Allows this hook to also be used with TimeField\nexport interface AriaDateFieldOptions<T extends DateValue> extends Omit<\n AriaDateFieldProps<T>,\n 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue' | 'validate'\n> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\nexport interface DateFieldAria extends ValidationResult {\n /** Props for the field's visible label element, if any. */\n labelProps: DOMAttributes;\n /** Props for the field grouping element. */\n fieldProps: GroupDOMAttributes;\n /** Props for the hidden input element for HTML form submission. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n// Data that is passed between useDateField and useDateSegment.\ninterface HookData {\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n focusManager: FocusManager;\n}\n\nexport const hookData: WeakMap<DateFieldState, HookData> = new WeakMap<DateFieldState, HookData>();\n\n// Private props that we pass from useDatePicker/useDateRangePicker.\n// Ideally we'd use a Symbol for this, but React doesn't support them: https://github.com/facebook/react/issues/7552\n// These need to be stable across server and client module evaluation for SSR hydration.\nexport const roleSymbol: string = '__reactAriaDateFieldRole';\nexport const focusManagerSymbol: string = '__reactAriaDateFieldFocusManager';\n\n/**\n * Provides the behavior and accessibility implementation for a date field component.\n * A date field allows users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nexport function useDateField<T extends DateValue>(\n props: AriaDateFieldOptions<T>,\n state: DateFieldState,\n ref: RefObject<Element | null>\n): DateFieldAria {\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let valueOnFocus = useRef<DateValue | null>(null);\n let {focusWithinProps} = useFocusWithin({\n ...props,\n onFocusWithin(e) {\n valueOnFocus.current = state.value;\n props.onFocus?.(e);\n },\n onBlurWithin: e => {\n state.confirmPlaceholder();\n if (state.value !== valueOnFocus.current) {\n state.commitValidation();\n }\n props.onBlur?.(e);\n },\n onFocusWithinChange: props.onFocusChange\n });\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n let message =\n state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';\n let field = state.maxGranularity === 'hour' ? 'time' : 'date';\n let description = state.value\n ? stringFormatter.format(message, {[field]: state.formatValue({month: 'long'})})\n : '';\n let descProps = useDescription(description);\n\n // If within a date picker or date range picker, the date field will have role=\"presentation\" and an aria-describedby\n // will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.\n let describedBy =\n props[roleSymbol] === 'presentation'\n ? fieldProps['aria-describedby']\n : [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') ||\n undefined;\n let propsFocusManager = props[focusManagerSymbol];\n let focusManager = useMemo(\n () => propsFocusManager || createFocusManager(ref),\n [propsFocusManager, ref]\n );\n let groupProps = useDatePickerGroup(state, ref, props[roleSymbol] === 'presentation');\n\n // Pass labels and other information to segments.\n hookData.set(state, {\n ariaLabel: props['aria-label'],\n ariaLabelledBy:\n [labelProps.id, props['aria-labelledby']].filter(Boolean).join(' ') || undefined,\n ariaDescribedBy: describedBy,\n focusManager\n });\n\n let autoFocusRef = useRef(props.autoFocus);\n\n // When used within a date picker or date range picker, the field gets role=\"presentation\"\n // rather than role=\"group\". Since the date picker/date range picker already has a role=\"group\"\n // with a label and description, and the segments are already labeled by this as well, this\n // avoids very verbose duplicate announcements.\n let fieldDOMProps: GroupDOMAttributes;\n if (props[roleSymbol] === 'presentation') {\n fieldDOMProps = {\n role: 'presentation'\n };\n } else {\n fieldDOMProps = mergeProps(fieldProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || undefined,\n 'aria-describedby': describedBy\n });\n }\n\n useEffect(() => {\n if (autoFocusRef.current) {\n focusManager.focusFirst();\n }\n autoFocusRef.current = false;\n }, [focusManager]);\n\n useFormReset(props.inputRef, state.defaultValue, state.setValue);\n useFormValidation(\n {\n ...props,\n focus() {\n focusManager.focusFirst();\n }\n },\n state,\n props.inputRef\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name: props.name,\n form: props.form,\n value: state.value?.toString() || '',\n disabled: props.isDisabled\n };\n\n if (props.validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = props.isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n let domProps = filterDOMProps(props);\n return {\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n fieldProps: mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps, {\n onKeyDown(e: KeyboardEvent) {\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n },\n style: {\n unicodeBidi: 'isolate'\n }\n }),\n inputProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nexport interface AriaTimeFieldProps<T extends TimeValue>\n extends TimePickerProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {}\n\nexport interface AriaTimeFieldOptions<T extends TimeValue> extends AriaTimeFieldProps<T> {\n /** A ref for the hidden input element for HTML form submission. */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a time field component.\n * A time field allows users to enter and edit time values using a keyboard.\n * Each part of a time value is displayed in an individually editable segment.\n */\nexport function useTimeField<T extends TimeValue>(\n props: AriaTimeFieldOptions<T>,\n state: TimeFieldState,\n ref: RefObject<Element | null>\n): DateFieldAria {\n let res = useDateField(props, state, ref);\n res.inputProps.value = state.timeValue?.toString() || '';\n return res;\n}\n"],"names":[],"version":3,"file":"useDateField.mjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAuDM,SAAS,0CAAmC,KAA6B,EAAE,KAAsB,EAAE,GAA8B;IACtI,IAAI,WAAW,CAAA,GAAA,+BAAI;IACnB,IAAI,WAAW,CAAA,GAAA,+BAAI;IACnB,IAAI,UAAU,CAAA,GAAA,+BAAI;IAClB,IAAI,kBAAkB,CAAA,GAAA,qDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAEhE,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAC9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QAC3E,GAAG,KAAK;QACR,kBAAkB;mBAClB;QACA,cAAc,MAAM,YAAY,IAAI;IACtC;IAEA,IAAI,aAAa,CAAA,GAAA,4CAAiB,EAAE,OAAO;IAE3C,IAAI,aAAa,UAAU,CAAC,kBAAkB,IAAI,WAAW,EAAE;IAE/D,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA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AU;YAC5B,mBAAmB,MAAM,iBAAiB;YAC1C,qBAAqB,MAAM,SAAS,GAAG,YAAY,MAAM,gBAAgB;YACzE,WAAW,MAAM,SAAS;YAC1B,cAAc,OAAO,MAAM,YAAY,KAAK,aAAa,MAAM,YAAY,CAAC,MAAM,iBAAiB,IAAK,MAAM,YAAY,IAAI,MAAM,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAC5K,gBAAgB,MAAM,cAAc;YACpC,cAAc,MAAM,YAAY;QAClC;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/react-aria/src/datepicker/useDatePicker.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '../button/useButton';\n\nimport {AriaDialogProps} from '../dialog/useDialog';\nimport {AriaLabelingProps, DOMAttributes, DOMProps, GroupDOMAttributes, InputDOMProps, KeyboardEvent, RefObject, ValidationResult} from '@react-types/shared';\nimport {CalendarProps} from 'react-stately/useCalendarState';\nimport {createFocusManager} from '../focus/FocusScope';\nimport {DatePickerProps, DatePickerState, DateValue} from 'react-stately/useDatePickerState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\n// @ts-ignore\nimport {roleSymbol} from './useDateField';\nimport {useDatePickerGroup} from './useDatePickerGroup';\nimport {useDescription} from '../utils/useDescription';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useId} from '../utils/useId';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useMemo, useRef} from 'react';\n\nexport interface AriaDatePickerProps<T extends DateValue> extends DatePickerProps<T>, AriaLabelingProps, InputDOMProps, DOMProps, InputDOMProps {\n /**\n * Describes the type of autocomplete functionality the input should provide if any. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).\n */\n autoComplete?: string\n}\n\nexport interface DatePickerAria extends ValidationResult {\n /** Props for the date picker's visible label element, if any. */\n labelProps: DOMAttributes,\n /** Props for the grouping element containing the date field and button. */\n groupProps: GroupDOMAttributes,\n /** Props for the date field. */\n fieldProps: AriaDatePickerProps<DateValue>,\n /** Props for the popover trigger button. */\n buttonProps: AriaButtonProps,\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes,\n /** Props for the popover dialog. */\n dialogProps: AriaDialogProps,\n /** Props for the calendar within the popover dialog. */\n calendarProps: CalendarProps<DateValue>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a date picker component.\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 function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>, state: DatePickerState, ref: RefObject<Element | null>): DatePickerAria {\n let buttonId = useId();\n let dialogId = useId();\n let fieldId = useId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let groupProps = useDatePickerGroup(state, ref);\n\n let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;\n\n let {locale} = useLocale();\n let date = state.formatValue(locale, {month: 'long'});\n let description = date ? stringFormatter.format('selectedDateDescription', {date}) : '';\n let descProps = useDescription(description);\n let ariaDescribedBy = [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;\n let domProps = filterDOMProps(props);\n let focusManager = useMemo(() => createFocusManager(ref), [ref]);\n\n let isFocused = useRef(false);\n let {focusWithinProps} = useFocusWithin({\n ...props,\n isDisabled: state.isOpen,\n onBlurWithin: e => {\n // Ignore when focus moves into the popover.\n let dialog = document.getElementById(dialogId);\n if (!nodeContains(dialog, e.relatedTarget)) {\n isFocused.current = false;\n props.onBlur?.(e);\n props.onFocusChange?.(false);\n }\n },\n onFocusWithin: e => {\n if (!isFocused.current) {\n isFocused.current = true;\n props.onFocus?.(e);\n props.onFocusChange?.(true);\n }\n }\n });\n\n return {\n groupProps: mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || null,\n 'aria-labelledby': labelledBy,\n 'aria-describedby': ariaDescribedBy,\n onKeyDown(e: KeyboardEvent) {\n if (state.isOpen) {\n return;\n }\n\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (state.isOpen) {\n return;\n }\n\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n }\n }),\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n fieldProps: {\n ...fieldProps,\n id: fieldId,\n [roleSymbol]: 'presentation',\n 'aria-describedby': ariaDescribedBy,\n value: state.value,\n defaultValue: state.defaultValue,\n onChange: state.setValue,\n placeholderValue: props.placeholderValue,\n hideTimeZone: props.hideTimeZone,\n hourCycle: props.hourCycle,\n shouldForceLeadingZeros: props.shouldForceLeadingZeros,\n granularity: props.granularity,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isRequired: props.isRequired,\n validationBehavior: props.validationBehavior,\n // DatePicker owns the validation state for the date field.\n [privateValidationStateProp]: state,\n autoFocus: props.autoFocus,\n name: props.name,\n form: props.form\n },\n descriptionProps,\n errorMessageProps,\n buttonProps: {\n ...descProps,\n id: buttonId,\n 'aria-haspopup': 'dialog',\n 'aria-label': stringFormatter.format('calendar'),\n 'aria-labelledby': `${buttonId} ${labelledBy}`,\n 'aria-describedby': ariaDescribedBy,\n 'aria-expanded': state.isOpen,\n isDisabled: props.isDisabled || props.isReadOnly,\n onPress: () => state.setOpen(true)\n },\n dialogProps: {\n id: dialogId,\n 'aria-labelledby': `${buttonId} ${labelledBy}`\n },\n calendarProps: {\n autoFocus: true,\n value: state.dateValue,\n onChange: state.setDateValue,\n minValue: props.minValue,\n maxValue: props.maxValue,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isDateUnavailable: props.isDateUnavailable,\n defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,\n isInvalid: state.isInvalid,\n errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : (props.errorMessage || state.displayValidation.validationErrors.join(' ')),\n firstDayOfWeek: props.firstDayOfWeek,\n pageBehavior: props.pageBehavior\n },\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useDatePicker.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAmEM,SAAS,0CACd,KAA6B,EAC7B,KAAsB,EACtB,GAA8B;IAE9B,IAAI,WAAW,CAAA,GAAA,+BAAI;IACnB,IAAI,WAAW,CAAA,GAAA,+BAAI;IACnB,IAAI,UAAU,CAAA,GAAA,+BAAI;IAClB,IAAI,kBAAkB,CAAA,GAAA,qDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAEhE,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAC9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,i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,MAAM,OAAO,CAAC;QAC/B;QACA,aAAa;YACX,IAAI;YACJ,mBAAmB,GAAG,SAAS,CAAC,EAAE,YAAY;QAChD;QACA,eAAe;YACb,WAAW;YACX,OAAO,MAAM,SAAS;YACtB,UAAU,MAAM,YAAY;YAC5B,UAAU,MAAM,QAAQ;YACxB,UAAU,MAAM,QAAQ;YACxB,YAAY,MAAM,UAAU;YAC5B,YAAY,MAAM,UAAU;YAC5B,mBAAmB,MAAM,iBAAiB;YAC1C,qBAAqB,MAAM,SAAS,GAAG,YAAY,MAAM,gBAAgB;YACzE,WAAW,MAAM,SAAS;YAC1B,cACE,OAAO,MAAM,YAAY,KAAK,aAC1B,MAAM,YAAY,CAAC,MAAM,iBAAiB,IAC1C,MAAM,YAAY,IAAI,MAAM,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAC1E,gBAAgB,MAAM,cAAc;YACpC,cAAc,MAAM,YAAY;QAClC;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/react-aria/src/datepicker/useDatePicker.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '../button/useButton';\n\nimport {AriaDialogProps} from '../dialog/useDialog';\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n InputDOMProps,\n KeyboardEvent,\n RefObject,\n ValidationResult\n} from '@react-types/shared';\nimport {CalendarProps} from 'react-stately/useCalendarState';\nimport {createFocusManager} from '../focus/FocusScope';\nimport {DatePickerProps, DatePickerState, DateValue} from 'react-stately/useDatePickerState';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {nodeContains} from '../utils/shadowdom/DOMFunctions';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\n// @ts-ignore\nimport {roleSymbol} from './useDateField';\nimport {useDatePickerGroup} from './useDatePickerGroup';\nimport {useDescription} from '../utils/useDescription';\nimport {useField} from '../label/useField';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useId} from '../utils/useId';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useMemo, useRef} from 'react';\n\nexport interface AriaDatePickerProps<T extends DateValue>\n extends DatePickerProps<T>, AriaLabelingProps, InputDOMProps, DOMProps, InputDOMProps {\n /**\n * Describes the type of autocomplete functionality the input should provide if any. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete).\n */\n autoComplete?: string;\n}\n\nexport interface DatePickerAria extends ValidationResult {\n /** Props for the date picker's visible label element, if any. */\n labelProps: DOMAttributes;\n /** Props for the grouping element containing the date field and button. */\n groupProps: GroupDOMAttributes;\n /** Props for the date field. */\n fieldProps: AriaDatePickerProps<DateValue>;\n /** Props for the popover trigger button. */\n buttonProps: AriaButtonProps;\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes;\n /** Props for the popover dialog. */\n dialogProps: AriaDialogProps;\n /** Props for the calendar within the popover dialog. */\n calendarProps: CalendarProps<DateValue>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a date picker component. A date picker\n * combines a DateField and a Calendar popover to allow users to enter or select a date and time\n * value.\n */\nexport function useDatePicker<T extends DateValue>(\n props: AriaDatePickerProps<T>,\n state: DatePickerState,\n ref: RefObject<Element | null>\n): DatePickerAria {\n let buttonId = useId();\n let dialogId = useId();\n let fieldId = useId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let groupProps = useDatePickerGroup(state, ref);\n\n let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;\n\n let {locale} = useLocale();\n let date = state.formatValue(locale, {month: 'long'});\n let description = date ? stringFormatter.format('selectedDateDescription', {date}) : '';\n let descProps = useDescription(description);\n let ariaDescribedBy =\n [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') ||\n undefined;\n let domProps = filterDOMProps(props);\n let focusManager = useMemo(() => createFocusManager(ref), [ref]);\n\n let isFocused = useRef(false);\n let {focusWithinProps} = useFocusWithin({\n ...props,\n isDisabled: state.isOpen,\n onBlurWithin: e => {\n // Ignore when focus moves into the popover.\n let dialog = document.getElementById(dialogId);\n if (!nodeContains(dialog, e.relatedTarget)) {\n isFocused.current = false;\n props.onBlur?.(e);\n props.onFocusChange?.(false);\n }\n },\n onFocusWithin: e => {\n if (!isFocused.current) {\n isFocused.current = true;\n props.onFocus?.(e);\n props.onFocusChange?.(true);\n }\n }\n });\n\n return {\n groupProps: mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || null,\n 'aria-labelledby': labelledBy,\n 'aria-describedby': ariaDescribedBy,\n onKeyDown(e: KeyboardEvent) {\n if (state.isOpen) {\n return;\n }\n\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (state.isOpen) {\n return;\n }\n\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n }\n }),\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n fieldProps: {\n ...fieldProps,\n id: fieldId,\n [roleSymbol]: 'presentation',\n 'aria-describedby': ariaDescribedBy,\n value: state.value,\n defaultValue: state.defaultValue,\n onChange: state.setValue,\n placeholderValue: props.placeholderValue,\n hideTimeZone: props.hideTimeZone,\n hourCycle: props.hourCycle,\n shouldForceLeadingZeros: props.shouldForceLeadingZeros,\n granularity: props.granularity,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isRequired: props.isRequired,\n validationBehavior: props.validationBehavior,\n // DatePicker owns the validation state for the date field.\n [privateValidationStateProp]: state,\n autoFocus: props.autoFocus,\n name: props.name,\n form: props.form\n },\n descriptionProps,\n errorMessageProps,\n buttonProps: {\n ...descProps,\n id: buttonId,\n 'aria-haspopup': 'dialog',\n 'aria-label': stringFormatter.format('calendar'),\n 'aria-labelledby': `${buttonId} ${labelledBy}`,\n 'aria-describedby': ariaDescribedBy,\n 'aria-expanded': state.isOpen,\n isDisabled: props.isDisabled || props.isReadOnly,\n onPress: () => state.setOpen(true)\n },\n dialogProps: {\n id: dialogId,\n 'aria-labelledby': `${buttonId} ${labelledBy}`\n },\n calendarProps: {\n autoFocus: true,\n value: state.dateValue,\n onChange: state.setDateValue,\n minValue: props.minValue,\n maxValue: props.maxValue,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isDateUnavailable: props.isDateUnavailable,\n defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,\n isInvalid: state.isInvalid,\n errorMessage:\n typeof props.errorMessage === 'function'\n ? props.errorMessage(state.displayValidation)\n : props.errorMessage || state.displayValidation.validationErrors.join(' '),\n firstDayOfWeek: props.firstDayOfWeek,\n pageBehavior: props.pageBehavior\n },\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useDatePicker.cjs.map"}
|