react-aria 3.48.0 → 3.50.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 +16 -7
- package/dist/private/autocomplete/useAutocomplete.cjs.map +1 -1
- package/dist/private/autocomplete/useAutocomplete.js +16 -7
- package/dist/private/autocomplete/useAutocomplete.js.map +1 -1
- package/dist/private/autocomplete/useAutocomplete.mjs +16 -7
- 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 +5 -3
- package/dist/private/combobox/useComboBox.cjs.map +1 -1
- package/dist/private/combobox/useComboBox.js +5 -3
- package/dist/private/combobox/useComboBox.js.map +1 -1
- package/dist/private/combobox/useComboBox.mjs +5 -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 +1 -2
- package/dist/private/datepicker/useDisplayNames.cjs.map +1 -1
- package/dist/private/datepicker/useDisplayNames.js +1 -2
- package/dist/private/datepicker/useDisplayNames.js.map +1 -1
- package/dist/private/datepicker/useDisplayNames.mjs +1 -2
- 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 +4 -1
- package/dist/private/dnd/DragManager.cjs.map +1 -1
- package/dist/private/dnd/DragManager.js +4 -1
- package/dist/private/dnd/DragManager.js.map +1 -1
- package/dist/private/dnd/DragManager.mjs +4 -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 +14 -4
- package/dist/private/dnd/utils.cjs.map +1 -1
- package/dist/private/dnd/utils.js +14 -4
- package/dist/private/dnd/utils.js.map +1 -1
- package/dist/private/dnd/utils.mjs +14 -4
- 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 +1 -1
- package/dist/private/form/useFormValidation.cjs.map +1 -1
- package/dist/private/form/useFormValidation.js +1 -1
- package/dist/private/form/useFormValidation.js.map +1 -1
- package/dist/private/form/useFormValidation.mjs +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 +2 -1
- package/dist/private/gridlist/useGridList.cjs.map +1 -1
- package/dist/private/gridlist/useGridList.js +2 -1
- package/dist/private/gridlist/useGridList.js.map +1 -1
- package/dist/private/gridlist/useGridList.mjs +2 -1
- package/dist/private/gridlist/useGridList.mjs.map +1 -1
- package/dist/private/gridlist/useGridListItem.cjs +66 -23
- package/dist/private/gridlist/useGridListItem.cjs.map +1 -1
- package/dist/private/gridlist/useGridListItem.js +67 -23
- package/dist/private/gridlist/useGridListItem.js.map +1 -1
- package/dist/private/gridlist/useGridListItem.mjs +66 -23
- 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 +3 -0
- package/dist/private/interactions/createEventHandler.cjs.map +1 -1
- package/dist/private/interactions/createEventHandler.js +3 -0
- package/dist/private/interactions/createEventHandler.js.map +1 -1
- package/dist/private/interactions/createEventHandler.mjs +3 -0
- 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 +20 -8
- package/dist/private/interactions/useFocusVisible.cjs.map +1 -1
- package/dist/private/interactions/useFocusVisible.js +20 -8
- package/dist/private/interactions/useFocusVisible.js.map +1 -1
- package/dist/private/interactions/useFocusVisible.mjs +20 -8
- 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 +1 -1
- package/dist/private/menu/useMenuItem.cjs.map +1 -1
- package/dist/private/menu/useMenuItem.js +1 -1
- package/dist/private/menu/useMenuItem.js.map +1 -1
- package/dist/private/menu/useMenuItem.mjs +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 +19 -20
- package/dist/private/overlays/calculatePosition.cjs.map +1 -1
- package/dist/private/overlays/calculatePosition.js +20 -21
- package/dist/private/overlays/calculatePosition.js.map +1 -1
- package/dist/private/overlays/calculatePosition.mjs +19 -20
- 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 +3 -2
- package/dist/private/overlays/useOverlayPosition.cjs.map +1 -1
- package/dist/private/overlays/useOverlayPosition.js +3 -2
- package/dist/private/overlays/useOverlayPosition.js.map +1 -1
- package/dist/private/overlays/useOverlayPosition.mjs +3 -2
- 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 +3 -4
- package/dist/private/select/useSelect.cjs.map +1 -1
- package/dist/private/select/useSelect.js +3 -4
- package/dist/private/select/useSelect.js.map +1 -1
- package/dist/private/select/useSelect.mjs +3 -4
- package/dist/private/select/useSelect.mjs.map +1 -1
- package/dist/private/selection/ListKeyboardDelegate.cjs +56 -28
- package/dist/private/selection/ListKeyboardDelegate.cjs.map +1 -1
- package/dist/private/selection/ListKeyboardDelegate.js +57 -29
- package/dist/private/selection/ListKeyboardDelegate.js.map +1 -1
- package/dist/private/selection/ListKeyboardDelegate.mjs +56 -28
- package/dist/private/selection/ListKeyboardDelegate.mjs.map +1 -1
- package/dist/private/selection/useSelectableCollection.cjs +21 -14
- package/dist/private/selection/useSelectableCollection.cjs.map +1 -1
- package/dist/private/selection/useSelectableCollection.js +27 -19
- package/dist/private/selection/useSelectableCollection.js.map +1 -1
- package/dist/private/selection/useSelectableCollection.mjs +21 -14
- 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 +50 -18
- package/dist/private/selection/useTypeSelect.cjs.map +1 -1
- package/dist/private/selection/useTypeSelect.js +51 -19
- package/dist/private/selection/useTypeSelect.js.map +1 -1
- package/dist/private/selection/useTypeSelect.mjs +51 -19
- 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 +2 -2
- package/dist/private/tabs/TabsKeyboardDelegate.cjs.map +1 -1
- package/dist/private/tabs/TabsKeyboardDelegate.js +2 -2
- package/dist/private/tabs/TabsKeyboardDelegate.js.map +1 -1
- package/dist/private/tabs/TabsKeyboardDelegate.mjs +2 -2
- 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 +0 -1
- package/dist/private/toolbar/useToolbar.cjs.map +1 -1
- package/dist/private/toolbar/useToolbar.js +0 -1
- package/dist/private/toolbar/useToolbar.js.map +1 -1
- package/dist/private/toolbar/useToolbar.mjs +0 -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 +1 -1
- package/dist/private/utils/isElementVisible.cjs.map +1 -1
- package/dist/private/utils/isElementVisible.js +1 -1
- package/dist/private/utils/isElementVisible.js.map +1 -1
- package/dist/private/utils/isElementVisible.mjs +1 -1
- package/dist/private/utils/isElementVisible.mjs.map +1 -1
- package/dist/private/utils/isFocusable.cjs +3 -1
- package/dist/private/utils/isFocusable.cjs.map +1 -1
- package/dist/private/utils/isFocusable.js +3 -1
- package/dist/private/utils/isFocusable.js.map +1 -1
- package/dist/private/utils/isFocusable.mjs +3 -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 +3 -3
- 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 +20 -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 +3 -1
- 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/menu/utils.d.ts +1 -1
- 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 +3 -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 +18 -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 +19 -6
- package/dist/types/src/selection/useSelectableCollection.d.ts +17 -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 +5 -3
- 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
|
@@ -14,12 +14,14 @@ import {hideOthers as $03QC9$hideOthers} from "aria-hidden";
|
|
|
14
14
|
const $200419fd6cc32a88$var$currentDocument = typeof document !== 'undefined' ? document : undefined;
|
|
15
15
|
function $200419fd6cc32a88$export$11dddb85aae73809(selector = 'body', { document: document1 = $200419fd6cc32a88$var$currentDocument } = {}) {
|
|
16
16
|
/**
|
|
17
|
-
* Listen for additions to the child list of the selected element (defaults to body). This is
|
|
18
|
-
* When one is added, see if there is a modal inside it, if
|
|
19
|
-
*
|
|
17
|
+
* Listen for additions to the child list of the selected element (defaults to body). This is
|
|
18
|
+
* where providers render modal portals. When one is added, see if there is a modal inside it, if
|
|
19
|
+
* there is, then hide everything else from screen readers. If there was already a modal open and
|
|
20
|
+
* a new one was added, undo everything that the previous modal had hidden and hide based on the
|
|
21
|
+
* new one.
|
|
20
22
|
*
|
|
21
|
-
* If a modal container is removed, then undo the hiding based on the last hide others. Check if
|
|
22
|
-
* hide based on the last one added.
|
|
23
|
+
* If a modal container is removed, then undo the hiding based on the last hide others. Check if
|
|
24
|
+
* there are any other modals still around, and hide based on the last one added.
|
|
23
25
|
*/ if (!document1) return ()=>{};
|
|
24
26
|
let target = document1.querySelector(selector);
|
|
25
27
|
if (!target) return ()=>{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAMD,MAAM,wCAAkB,OAAO,aAAa,cAAc,WAAW;
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAMD,MAAM,wCAAkB,OAAO,aAAa,cAAc,WAAW;AAM9D,SAAS,0CACd,WAAmB,MAAM,EACzB,EAAC,UAAA,YAAW,qCAAe,EAAwB,GAAG,CAAC,CAAC;IAExD;;;;;;;;;GASC,GACD,IAAI,CAAC,WACH,OAAO,KAAO;IAEhB,IAAI,SAAS,UAAS,aAAa,CAAC;IACpC,IAAI,CAAC,QACH,OAAO,KAAO;IAEhB,IAAI,SAAS;QAAC,WAAW;IAAI;IAC7B,IAAI,kBAAkC,EAAE;IACxC,IAAI;IAEJ,IAAI,WAAW,IAAI,iBAAiB,CAAA;QAClC,MAAM,gBAAgB,UAAS,aAAa,CAAC;QAC7C,KAAK,IAAI,YAAY,eAAgB;YACnC,IAAI,SAAS,IAAI,KAAK,eAAe,SAAS,UAAU,CAAC,MAAM,GAAG,GAAG;gBACnE,IAAI,UAAmB,MAAM,IAAI,CAAC,SAAS,UAAU,EAAE,IAAI,CAAC,CAAC,OAC3D,KAAK,aAAa,GAAG;gBAEvB,IAAI,SAAS;oBACX,gBAAgB,IAAI,CAAC;oBACrB,IAAI,QAAQ,QAAQ,aAAa,CAC/B;oBAEF;oBACA,IAAI,SAAS;wBAAC;2BAAW,gBAAgB;4BAAC;yBAA6B,GAAG,EAAE;qBAAE;oBAC9E,OAAO,CAAA,GAAA,iBAAS,EAAE;gBACpB;YACF,OAAO,IAAI,SAAS,IAAI,KAAK,eAAe,SAAS,YAAY,CAAC,MAAM,GAAG,GAAG;gBAC5E,IAAI,eAAe,MAAM,IAAI,CAAC,SAAS,YAAY;gBACnD,IAAI,kBAAkB,gBAAgB,SAAS,CAAC,CAAA,YAC9C,aAAa,QAAQ,CAAC;gBAExB,IAAI,mBAAmB,GAAG;oBACxB;oBACA,kBAAkB,gBAAgB,MAAM,CAAC,CAAC,KAAK,IAAM,MAAM;oBAC3D,IAAI,gBAAgB,MAAM,GAAG,GAAG;wBAC9B,IAAI,QAAQ,eAAe,CAAC,gBAAgB,MAAM,GAAG,EAAE,CAAC,aAAa,CACnE;wBAEF,IAAI,SAAS;4BAAC;+BAAW,gBAAgB;gCAAC;6BAA6B,GAAG,EAAE;yBAAE;wBAC9E,OAAO,CAAA,GAAA,iBAAS,EAAE;oBACpB,OACE,OAAO;gBAEX;YACF;QACF;IACF;IACA,SAAS,OAAO,CAAC,QAAQ;IACzB,OAAO;QACL;QACA,SAAS,UAAU;IACrB;AACF","sources":["packages/react-aria/src/aria-modal-polyfill/ariaModalPolyfill.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 {hideOthers} from 'aria-hidden';\n\ntype Revert = () => void;\n\nconst currentDocument = typeof document !== 'undefined' ? document : undefined;\n\n/**\n * Acts as a polyfill for `aria-modal` by watching for added modals and hiding any surrounding DOM\n * elements with `aria-hidden`.\n */\nexport function watchModals(\n selector: string = 'body',\n {document = currentDocument}: {document?: Document} = {}\n): Revert {\n /**\n * Listen for additions to the child list of the selected element (defaults to body). This is\n * where providers render modal portals. When one is added, see if there is a modal inside it, if\n * there is, then hide everything else from screen readers. If there was already a modal open and\n * a new one was added, undo everything that the previous modal had hidden and hide based on the\n * new one.\n *\n * If a modal container is removed, then undo the hiding based on the last hide others. Check if\n * there are any other modals still around, and hide based on the last one added.\n */\n if (!document) {\n return () => {};\n }\n let target = document.querySelector(selector);\n if (!target) {\n return () => {};\n }\n let config = {childList: true};\n let modalContainers: Array<Element> = [];\n let undo: Revert | undefined;\n\n let observer = new MutationObserver(mutationRecord => {\n const liveAnnouncer = document.querySelector('[data-live-announcer=\"true\"]');\n for (let mutation of mutationRecord) {\n if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {\n let addNode: Element = Array.from(mutation.addedNodes).find((node: any) =>\n node.querySelector?.('[aria-modal=\"true\"], [data-ismodal=\"true\"]')\n ) as HTMLElement;\n if (addNode) {\n modalContainers.push(addNode);\n let modal = addNode.querySelector(\n '[aria-modal=\"true\"], [data-ismodal=\"true\"]'\n ) as HTMLElement;\n undo?.();\n let others = [modal, ...(liveAnnouncer ? [liveAnnouncer as HTMLElement] : [])];\n undo = hideOthers(others);\n }\n } else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {\n let removedNodes = Array.from(mutation.removedNodes);\n let nodeIndexRemove = modalContainers.findIndex(container =>\n removedNodes.includes(container)\n );\n if (nodeIndexRemove >= 0) {\n undo?.();\n modalContainers = modalContainers.filter((val, i) => i !== nodeIndexRemove);\n if (modalContainers.length > 0) {\n let modal = modalContainers[modalContainers.length - 1].querySelector(\n '[aria-modal=\"true\"], [data-ismodal=\"true\"]'\n ) as HTMLElement;\n let others = [modal, ...(liveAnnouncer ? [liveAnnouncer as HTMLElement] : [])];\n undo = hideOthers(others);\n } else {\n undo = undefined;\n }\n }\n }\n }\n });\n observer.observe(target, config);\n return () => {\n undo?.();\n observer.disconnect();\n };\n}\n"],"names":[],"version":3,"file":"ariaModalPolyfill.mjs.map"}
|
|
@@ -68,6 +68,7 @@ function $520542e1cf209aea$export$1e40b3ca02d92d21(props, state) {
|
|
|
68
68
|
// Tracks if a collection has been connected to the autocomplete. If false, we don't want to add various attributes to the autocomplete input
|
|
69
69
|
// since it isn't attached to a filterable collection (e.g. Tabs)
|
|
70
70
|
let [hasCollection, setHasCollection] = (0, $7JMdJ$react.useState)(false);
|
|
71
|
+
let [autoFocusOnMount, setAutoFocusOnMount] = (0, $7JMdJ$react.useState)(false);
|
|
71
72
|
(0, $7JMdJ$react.useEffect)(()=>{
|
|
72
73
|
return ()=>clearTimeout(timeout.current);
|
|
73
74
|
}, []);
|
|
@@ -125,6 +126,10 @@ function $520542e1cf209aea$export$1e40b3ca02d92d21(props, state) {
|
|
|
125
126
|
callbackRef
|
|
126
127
|
]));
|
|
127
128
|
let focusFirstItem = (0, $7JMdJ$react.useCallback)(()=>{
|
|
129
|
+
if (!collectionRef.current) {
|
|
130
|
+
setAutoFocusOnMount(true);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
128
133
|
delayNextActiveDescendant.current = true;
|
|
129
134
|
collectionRef.current?.dispatchEvent(new CustomEvent((0, $79558b1ff24cb93a$exports.FOCUS_EVENT), {
|
|
130
135
|
cancelable: true,
|
|
@@ -137,6 +142,7 @@ function $520542e1cf209aea$export$1e40b3ca02d92d21(props, state) {
|
|
|
137
142
|
collectionRef
|
|
138
143
|
]);
|
|
139
144
|
let clearVirtualFocus = (0, $7JMdJ$react.useCallback)((clearFocusKey)=>{
|
|
145
|
+
setAutoFocusOnMount(false);
|
|
140
146
|
(0, $4f541c01c875ab4e$exports.moveVirtualFocus)((0, $da02ee888921bc9e$exports.getActiveElement)());
|
|
141
147
|
queuedActiveDescendant.current = null;
|
|
142
148
|
state.setFocusedNodeId(null);
|
|
@@ -155,14 +161,16 @@ function $520542e1cf209aea$export$1e40b3ca02d92d21(props, state) {
|
|
|
155
161
|
state
|
|
156
162
|
]);
|
|
157
163
|
let lastInputType = (0, $7JMdJ$react.useRef)('');
|
|
158
|
-
(0, $6e76e65001bbcda2$exports.useEvent)(inputRef, '
|
|
164
|
+
(0, $6e76e65001bbcda2$exports.useEvent)(inputRef, 'beforeinput', (e)=>{
|
|
159
165
|
let { inputType: inputType } = e;
|
|
160
166
|
lastInputType.current = inputType;
|
|
161
167
|
});
|
|
162
168
|
let onChange = (value)=>{
|
|
163
169
|
// Tell wrapped collection to focus the first element in the list when typing forward and to clear focused key when modifying the text via
|
|
164
170
|
// copy paste/backspacing/undo/redo for screen reader announcements
|
|
165
|
-
if (lastInputType.current === 'insertText'
|
|
171
|
+
if ((lastInputType.current === 'insertText' || // IME composition (e.g. CJK input) reports 'insertCompositionText'/'insertFromComposition'
|
|
172
|
+
// instead of 'insertText'. Treat these as forward typing so the first item gets virtual focus.
|
|
173
|
+
lastInputType.current === 'insertCompositionText' || lastInputType.current === 'insertFromComposition') && !disableAutoFocusFirst) focusFirstItem();
|
|
166
174
|
else if (lastInputType.current && (lastInputType.current.includes('insert') || lastInputType.current.includes('delete') || lastInputType.current.includes('history'))) {
|
|
167
175
|
clearVirtualFocus(true);
|
|
168
176
|
// If onChange was triggered before the timeout actually updated the activedescendant, we need to fire
|
|
@@ -216,7 +224,7 @@ function $520542e1cf209aea$export$1e40b3ca02d92d21(props, state) {
|
|
|
216
224
|
// to the wrapped collection if there is a focused node so that a user can continue moving the
|
|
217
225
|
// virtual focus. However, if the user doesn't have a focus in the collection, just move the text
|
|
218
226
|
// cursor instead. They can move focus down into the collection via down/up arrow if need be
|
|
219
|
-
if (
|
|
227
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
220
228
|
if (focusedNodeId == null) {
|
|
221
229
|
if (!e.isPropagationStopped()) e.stopPropagation();
|
|
222
230
|
return;
|
|
@@ -337,11 +345,11 @@ function $520542e1cf209aea$export$1e40b3ca02d92d21(props, state) {
|
|
|
337
345
|
onFocus: onFocus,
|
|
338
346
|
onPointerDown: onPointerDown
|
|
339
347
|
};
|
|
340
|
-
|
|
348
|
+
inputProps = {
|
|
341
349
|
...inputProps,
|
|
342
|
-
...shouldUseVirtualFocus && virtualFocusProps,
|
|
350
|
+
...shouldUseVirtualFocus && hasCollection && virtualFocusProps,
|
|
343
351
|
enterKeyHint: 'go',
|
|
344
|
-
'aria-controls': collectionId,
|
|
352
|
+
'aria-controls': hasCollection ? collectionId : undefined,
|
|
345
353
|
// TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)
|
|
346
354
|
'aria-autocomplete': 'list',
|
|
347
355
|
// This disable's iOS's autocorrect suggestions, since the autocomplete provides its own suggestions.
|
|
@@ -354,7 +362,8 @@ function $520542e1cf209aea$export$1e40b3ca02d92d21(props, state) {
|
|
|
354
362
|
inputProps: inputProps,
|
|
355
363
|
collectionProps: (0, $89b39774f3b79dbb$exports.mergeProps)(collectionProps, {
|
|
356
364
|
shouldUseVirtualFocus: shouldUseVirtualFocus,
|
|
357
|
-
disallowTypeAhead: shouldUseVirtualFocus
|
|
365
|
+
disallowTypeAhead: shouldUseVirtualFocus,
|
|
366
|
+
autoFocus: autoFocusOnMount ? 'first' : false
|
|
358
367
|
}),
|
|
359
368
|
collectionRef: mergedCollectionRef,
|
|
360
369
|
filter: filter != null ? filterFn : undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;AA0FM,SAAS,0CAAmB,KAAiC,EAAE,KAAwB;IAC5F,IAAI,YACF,QAAQ,iBACR,aAAa,UACb,MAAM,yBACN,wBAAwB,4BACxB,sBAAsB,OACvB,GAAG;IAEJ,IAAI,eAAe,CAAA,GAAA,+BAAI;IACvB,IAAI,UAAU,CAAA,GAAA,mBAAK,EAA6C;IAChE,IAAI,4BAA4B,CAAA,GAAA,mBAAK,EAAE;IACvC,IAAI,yBAAyB,CAAA,GAAA,mBAAK,EAAiB;IAEnD,2HAA2H;IAC3H,uCAAuC;IACvC,IAAI,uBAAuB,CAAA,GAAA,gDAAqB,QAAQ,aAAc,CAAA,CAAA,GAAA,+BAAI,OAAO,CAAA,GAAA,mCAAQ,GAAE;IAC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C;YACA,mBAAmB;QACrB;QACA,eAAe;QACf,QAAQ,UAAU,OAAO,WAAW;IACtC;AACF","sources":["packages/react-aria/src/autocomplete/useAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2024 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, BaseEvent, DOMProps, FocusableElement, FocusEvents, KeyboardEvents, Node, RefObject, ValueBase} from '@react-types/shared';\nimport {AriaTextFieldProps} from '../textfield/useTextField';\nimport {AutocompleteProps, AutocompleteState} from 'react-stately/private/autocomplete/useAutocompleteState';\nimport {CLEAR_FOCUS_EVENT, FOCUS_EVENT} from '../utils/constants';\nimport {\n dispatchVirtualBlur,\n dispatchVirtualFocus,\n getVirtuallyFocusedElement,\n moveVirtualFocus\n} from '../focus/virtualFocus';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getInteractionModality, getPointerType} from '../interactions/useFocusVisible';\nimport {getOwnerDocument} from '../utils/domHelpers';\nimport intlMessages from '../../intl/autocomplete/*.json';\nimport {isAndroid, isIOS} from '../utils/platform';\nimport {isCtrlKeyPressed} from '../utils/keyboard';\nimport {mergeProps} from '../utils/mergeProps';\nimport {mergeRefs} from '../utils/mergeRefs';\nimport {FocusEvent as ReactFocusEvent, KeyboardEvent as ReactKeyboardEvent, PointerEvent as ReactPointerEvent, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {useEffectEvent} from '../utils/useEffectEvent';\nimport {useEvent} from '../utils/useEvent';\n\nimport {useId} from '../utils/useId';\n\nimport {useLabels} from '../utils/useLabels';\n// @ts-ignore\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useObjectRef} from '../utils/useObjectRef';\n\nexport interface CollectionOptions extends DOMProps, AriaLabelingProps {\n /** Whether the collection items should use virtual focus instead of being focused directly. */\n shouldUseVirtualFocus: boolean,\n /** Whether typeahead is disabled. */\n disallowTypeAhead: boolean\n}\n\nexport interface InputProps<T = FocusableElement> extends DOMProps,\n FocusEvents<T>,\n KeyboardEvents,\n Pick<ValueBase<string>, 'onChange' | 'value'>,\n Pick<AriaTextFieldProps, 'enterKeyHint' | 'aria-controls' | 'aria-autocomplete' | 'aria-activedescendant' | 'spellCheck' | 'autoCorrect' | 'autoComplete'> {}\n\nexport interface AriaAutocompleteProps<T> extends AutocompleteProps {\n /**\n * An optional filter function used to determine if a option should be included in the autocomplete list.\n * Include this if the items you are providing to your wrapped collection aren't filtered by default.\n */\n filter?: (textValue: string, inputValue: string, node: Node<T>) => boolean,\n\n /**\n * Whether or not to focus the first item in the collection after a filter is performed. Note this is only applicable\n * if virtual focus behavior is not turned off via `disableVirtualFocus`.\n * @default false\n */\n disableAutoFocusFirst?: boolean,\n\n /**\n * Whether the autocomplete should disable virtual focus, instead making the wrapped collection directly tabbable.\n * @default false\n */\n disableVirtualFocus?: boolean\n}\n\nexport interface AriaAutocompleteOptions<T> extends Omit<AriaAutocompleteProps<T>, 'children'> {\n /** The ref for the wrapped collection element. */\n inputRef: RefObject<HTMLInputElement | null>,\n /** The ref for the wrapped collection element. */\n collectionRef: RefObject<HTMLElement | null>\n}\n\nexport interface AutocompleteAria<T> {\n /** Props for the autocomplete input element. These should be passed to the input's aria hooks (e.g. useTextField/useSearchField/etc) respectively. */\n inputProps: InputProps,\n /** Props for the collection, to be passed to collection's respective aria hook (e.g. useMenu). */\n collectionProps: CollectionOptions,\n /** Ref to attach to the wrapped collection. */\n collectionRef: RefObject<HTMLElement | null>,\n /** A filter function that returns if the provided collection node should be filtered out of the collection. */\n filter?: (nodeTextValue: string, node: Node<T>) => boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an autocomplete component.\n * An autocomplete combines a text input with a collection, allowing users to filter the collection's contents match a query.\n * @param props - Props for the autocomplete.\n * @param state - State for the autocomplete, as returned by `useAutocompleteState`.\n */\nexport function useAutocomplete<T>(props: AriaAutocompleteOptions<T>, state: AutocompleteState): AutocompleteAria<T> {\n let {\n inputRef,\n collectionRef,\n filter,\n disableAutoFocusFirst = false,\n disableVirtualFocus = false\n } = props;\n\n let collectionId = useId();\n let timeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n let delayNextActiveDescendant = useRef(false);\n let queuedActiveDescendant = useRef<string | null>(null);\n\n // For mobile screen readers, we don't want virtual focus, instead opting to disable FocusScope's restoreFocus and manually\n // moving focus back to the subtriggers\n let isMobileScreenReader = getInteractionModality() === 'virtual' && (isIOS() || isAndroid());\n let [shouldUseVirtualFocus, setShouldUseVirtualFocus] = useState(!isMobileScreenReader && !disableVirtualFocus);\n // Tracks if a collection has been connected to the autocomplete. If false, we don't want to add various attributes to the autocomplete input\n // since it isn't attached to a filterable collection (e.g. Tabs)\n let [hasCollection, setHasCollection] = useState(false);\n\n useEffect(() => {\n return () => clearTimeout(timeout.current);\n }, []);\n\n let updateActiveDescendantEvent = useEffectEvent((e: Event) => {\n // Ensure input is focused if the user clicks on the collection directly.\n // don't trigger on touch so that mobile keyboard doesnt appear when tapping on options\n if (!e.isTrusted && shouldUseVirtualFocus && inputRef.current && getActiveElement(getOwnerDocument(inputRef.current)) !== inputRef.current && getPointerType() !== 'touch') {\n inputRef.current.focus();\n }\n\n let target = getEventTarget(e) as Element | null;\n if (e.isTrusted || !target || queuedActiveDescendant.current === target.id) {\n return;\n }\n\n clearTimeout(timeout.current);\n if (target !== collectionRef.current) {\n if (delayNextActiveDescendant.current) {\n queuedActiveDescendant.current = target.id;\n timeout.current = setTimeout(() => {\n state.setFocusedNodeId(target.id);\n }, 500);\n } else {\n queuedActiveDescendant.current = target.id;\n state.setFocusedNodeId(target.id);\n }\n } else if (queuedActiveDescendant.current && !document.getElementById(queuedActiveDescendant.current)) {\n // If we recieve a focus event refocusing the collection, either we have newly refocused the input and are waiting for the\n // wrapped collection to refocus the previously focused node if any OR\n // we are in a state where we've filtered to such a point that there aren't any matching items in the collection to focus.\n // In this case we want to clear tracked item if any and clear active descendant\n queuedActiveDescendant.current = null;\n state.setFocusedNodeId(null);\n }\n\n delayNextActiveDescendant.current = false;\n });\n\n let [collectionNode, setCollectionNode] = useState<HTMLElement | null>(null);\n let callbackRef = useCallback((node) => {\n setCollectionNode(node);\n if (node != null) {\n // If useSelectableCollection isn't passed shouldUseVirtualFocus even when useAutocomplete provides it\n // that means the collection doesn't support it (e.g. Table). If that is the case, we need to disable it here regardless\n // of what the user's provided so that the input doesn't recieve the onKeyDown and autocomplete props.\n if (node.getAttribute('tabindex') != null) {\n setShouldUseVirtualFocus(false);\n }\n setHasCollection(true);\n } else {\n setHasCollection(false);\n }\n }, []);\n useLayoutEffect(() => {\n if (collectionNode != null) {\n // When typing forward, we want to delay the setting of active descendant to not interrupt the native screen reader announcement\n // of the letter you just typed. If we recieve another focus event then we clear the queued update\n collectionNode.addEventListener('focusin', updateActiveDescendantEvent);\n }\n return () => {\n collectionNode?.removeEventListener('focusin', updateActiveDescendantEvent);\n };\n }, [collectionNode]);\n\n // Make sure to memo so that React doesn't keep registering a new event listeners on every rerender of the wrapped collection\n let mergedCollectionRef = useObjectRef(useMemo(() => mergeRefs(collectionRef, callbackRef), [collectionRef, callbackRef]));\n\n let focusFirstItem = useCallback(() => {\n delayNextActiveDescendant.current = true;\n collectionRef.current?.dispatchEvent(\n new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: {\n focusStrategy: 'first'\n }\n })\n );\n }, [collectionRef]);\n\n let clearVirtualFocus = useCallback((clearFocusKey?: boolean) => {\n moveVirtualFocus(getActiveElement());\n queuedActiveDescendant.current = null;\n state.setFocusedNodeId(null);\n let clearFocusEvent = new CustomEvent(CLEAR_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: {\n clearFocusKey\n }\n });\n clearTimeout(timeout.current);\n delayNextActiveDescendant.current = false;\n collectionRef.current?.dispatchEvent(clearFocusEvent);\n }, [collectionRef, state]);\n\n let lastInputType = useRef('');\n useEvent(inputRef, 'input', e => {\n let {inputType} = e as InputEvent;\n lastInputType.current = inputType;\n });\n\n let onChange = (value: string) => {\n // Tell wrapped collection to focus the first element in the list when typing forward and to clear focused key when modifying the text via\n // copy paste/backspacing/undo/redo for screen reader announcements\n if (lastInputType.current === 'insertText' && !disableAutoFocusFirst) {\n focusFirstItem();\n } else if (lastInputType.current && (lastInputType.current.includes('insert') || lastInputType.current.includes('delete') || lastInputType.current.includes('history'))) {\n clearVirtualFocus(true);\n\n // If onChange was triggered before the timeout actually updated the activedescendant, we need to fire\n // our own dispatchVirtualFocus so focusVisible gets reapplied on the input\n if (getVirtuallyFocusedElement(document) === inputRef.current) {\n dispatchVirtualFocus(inputRef.current!, null);\n }\n }\n\n state.setInputValue(value);\n };\n\n let keyDownTarget = useRef<Element | null>(null);\n // For textfield specific keydown operations\n let onKeyDown = (e: BaseEvent<ReactKeyboardEvent<any>>) => {\n keyDownTarget.current = getEventTarget(e) as Element;\n if (e.nativeEvent.isComposing) {\n return;\n }\n\n let focusedNodeId = queuedActiveDescendant.current;\n if (focusedNodeId !== null && getOwnerDocument(inputRef.current).getElementById(focusedNodeId) == null) {\n // if the focused id doesn't exist in document, then we need to clear the tracked focused node, otherwise\n // we will be attempting to fire key events on a non-existing node instead of trying to focus the newly swapped wrapped collection.\n // This can happen if you are swapping out the Autocomplete wrapped collection component like in the docs search.\n queuedActiveDescendant.current = null;\n focusedNodeId = null;\n }\n\n switch (e.key) {\n case 'a':\n if (isCtrlKeyPressed(e)) {\n return;\n }\n break;\n case 'Escape':\n // Early return for Escape here so it doesn't leak the Escape event from the simulated collection event below and\n // close the dialog prematurely. Ideally that should be up to the discretion of the input element hence the check\n // for isPropagationStopped\n if (e.isDefaultPrevented()) {\n return;\n }\n break;\n case ' ':\n // Space shouldn't trigger onAction so early return.\n return;\n case 'Tab':\n // Don't propogate Tab down to the collection, otherwise we will try to focus the collection via useSelectableCollection's Tab handler (aka shift tab logic)\n // We want FocusScope to handle Tab if one exists (aka sub dialog), so special casepropogate\n if ('continuePropagation' in e) {\n e.continuePropagation();\n }\n return;\n case 'Home':\n case 'End':\n case 'PageDown':\n case 'PageUp':\n case 'ArrowUp':\n case 'ArrowDown':\n case 'ArrowRight':\n case 'ArrowLeft': {\n if ((e.key === 'Home' || e.key === 'End') && focusedNodeId == null && e.shiftKey) {\n return;\n }\n\n // If there is text within the input field, we'll want continue propagating events down\n // to the wrapped collection if there is a focused node so that a user can continue moving the\n // virtual focus. However, if the user doesn't have a focus in the collection, just move the text\n // cursor instead. They can move focus down into the collection via down/up arrow if need be\n if ((e.key === 'ArrowRight' || e.key === 'ArrowLeft') && state.inputValue.length > 0) {\n if (focusedNodeId == null) {\n if (!e.isPropagationStopped()) {\n e.stopPropagation();\n }\n return;\n }\n\n break;\n }\n\n // Prevent these keys from moving the text cursor in the input\n e.preventDefault();\n // Move virtual focus into the wrapped collection\n let focusCollection = new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true\n });\n\n collectionRef.current?.dispatchEvent(focusCollection);\n break;\n }\n }\n\n // Emulate the keyboard events that happen in the input field in the wrapped collection. This is for triggering things like onAction via Enter\n // or moving focus from one item to another. Stop propagation on the input event if it isn't already stopped so it doesn't leak out. For events\n // like ESC, the dispatched event below will bubble out of the collection and be stopped if handled by useSelectableCollection, otherwise will bubble\n // as expected\n if (!e.isPropagationStopped()) {\n e.stopPropagation();\n }\n\n let shouldPerformDefaultAction = true;\n if (collectionRef.current !== null) {\n if (focusedNodeId == null) {\n shouldPerformDefaultAction = collectionRef.current?.dispatchEvent(\n new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)\n ) || false;\n } else {\n let item = document.getElementById(focusedNodeId);\n if (item) {\n shouldPerformDefaultAction = item?.dispatchEvent(\n new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)\n ) || false;\n }\n }\n }\n\n if (shouldPerformDefaultAction) {\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n // Clear the activedescendant so NVDA announcements aren't interrupted but retain the focused key in the collection so the\n // user's keyboard navigation restarts from where they left off\n clearVirtualFocus();\n break;\n }\n case 'Enter':\n // Trigger click action on item when Enter key was pressed.\n if (focusedNodeId != null) {\n let item = document.getElementById(focusedNodeId);\n item?.dispatchEvent(new PointerEvent('click', e.nativeEvent));\n }\n break;\n }\n } else {\n // TODO: check if we can do this, want to stop textArea from using its default Enter behavior so items are properly triggered\n e.preventDefault();\n }\n };\n\n let onKeyUpCapture = useEffectEvent((e) => {\n // Dispatch simulated key up events for things like triggering links in listbox\n // Make sure to stop the propagation of the input keyup event so that the simulated keyup/down pair\n // is detected by usePress instead of the original keyup originating from the input\n if (getEventTarget(e) === keyDownTarget.current) {\n e.stopImmediatePropagation();\n let focusedNodeId = queuedActiveDescendant.current;\n if (focusedNodeId == null) {\n collectionRef.current?.dispatchEvent(\n new KeyboardEvent(e.type, e)\n );\n } else {\n let item = document.getElementById(focusedNodeId);\n item?.dispatchEvent(\n new KeyboardEvent(e.type, e)\n );\n }\n }\n });\n\n useEffect(() => {\n document.addEventListener('keyup', onKeyUpCapture, true);\n return () => {\n document.removeEventListener('keyup', onKeyUpCapture, true);\n };\n }, []);\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/autocomplete');\n let collectionProps = useLabels({\n id: collectionId,\n 'aria-label': stringFormatter.format('collectionLabel')\n });\n\n let filterFn = useCallback((nodeTextValue: string, node: Node<T>) => {\n if (filter) {\n return filter(nodeTextValue, state.inputValue, node);\n }\n\n return true;\n }, [state.inputValue, filter]);\n\n // Be sure to clear/restore the virtual + collection focus when blurring/refocusing the field so we only show the\n // focus ring on the virtually focused collection when are actually interacting with the Autocomplete\n let onBlur = (e: ReactFocusEvent) => {\n if (!e.isTrusted) {\n return;\n }\n\n let lastFocusedNode = queuedActiveDescendant.current ? document.getElementById(queuedActiveDescendant.current) : null;\n if (lastFocusedNode) {\n dispatchVirtualBlur(lastFocusedNode, e.relatedTarget);\n }\n };\n\n let onFocus = (e: ReactFocusEvent) => {\n if (!e.isTrusted) {\n return;\n }\n\n let curFocusedNode = queuedActiveDescendant.current ? document.getElementById(queuedActiveDescendant.current) : null;\n if (curFocusedNode) {\n let target = getEventTarget(e);\n queueMicrotask(() => {\n // instead of focusing the last focused node, just focus the collection instead and have the collection handle what item to focus via useSelectableCollection/Item\n dispatchVirtualBlur(target, collectionRef.current);\n dispatchVirtualFocus(collectionRef.current!, target);\n });\n }\n };\n\n // Clicking back into the input can happen after focus moved elsewhere in the dialog, while\n // virtual focus is still on an option. Clear virtual focus on pointer down so mouse\n // interactions restore the input state before the click's focus handling runs.\n // Touch is excluded because touch interactions should not move focus back to the input.\n let onPointerDown = (e: ReactPointerEvent) => {\n if (e.button !== 0 || e.pointerType === 'touch' || queuedActiveDescendant.current == null || inputRef.current == null) {\n return;\n }\n\n if (getEventTarget(e) === inputRef.current) {\n clearVirtualFocus();\n }\n };\n\n // Only apply the autocomplete specific behaviors if the collection component wrapped by it is actually\n // being filtered/allows filtering by the Autocomplete.\n let inputProps = {\n value: state.inputValue,\n onChange\n } as AriaTextFieldProps<FocusableElement>;\n\n let virtualFocusProps = {\n onKeyDown,\n 'aria-activedescendant': state.focusedNodeId ?? undefined,\n onBlur,\n onFocus,\n onPointerDown\n };\n\n if (hasCollection) {\n inputProps = {\n ...inputProps,\n ...(shouldUseVirtualFocus && virtualFocusProps),\n enterKeyHint: 'go',\n 'aria-controls': collectionId,\n // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)\n 'aria-autocomplete': 'list',\n // This disable's iOS's autocorrect suggestions, since the autocomplete provides its own suggestions.\n autoCorrect: 'off',\n // This disable's the macOS Safari spell check auto corrections.\n spellCheck: 'false',\n autoComplete: 'off'\n };\n }\n\n return {\n inputProps,\n collectionProps: mergeProps(collectionProps, {\n shouldUseVirtualFocus,\n disallowTypeAhead: shouldUseVirtualFocus\n }),\n collectionRef: mergedCollectionRef,\n filter: filter != null ? filterFn : undefined\n };\n}\n"],"names":[],"version":3,"file":"useAutocomplete.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;AAoIM,SAAS,0CACd,KAAiC,EACjC,KAAwB;IAExB,IAAI,YACF,QAAQ,iBACR,aAAa,UACb,MAAM,yBACN,wBAAwB,4BACxB,sBAAsB,OACvB,GAAG;IAEJ,IAAI,eAAe,CAAA,GAAA,+BAAI;IACvB,IAAI,UAAU,CAAA,GAAA,mBAAK,EAA6C;IAChE,IAAI,4BAA4B,CAAA,GAAA,mBAAK,EAAE;IACvC,IAAI,yBAAyB,CAAA,GAAA,mBAAK,EAAiB;IAEnD,2HAA2H;IAC3H,uCAAuC;IACvC,IAAI,uBAAuB,CAAA,GAAA,gDAAqB,QAAQ,aAAc,CAAA,CAAA,GAAA,+BAAI,OAAO,CAAA,GAAA,mCAAQ,GAAE;IAC3F,IAAI,CAAC,uBAAuB,yBAAyB,GAAG,CAAA,GAAA,qBAAO,EAC7D,CAAC,wBAAwB,CAAC;IAE5B,6IAA6I;IAC7I,iEAAiE;IACjE,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAE;IACjD,IAAI,CAAC,kBAAkB,oBAAoB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAEvD,CAAA,GAAA,sBAAQ,EAAE;QACR,OAAO,IAAM,aAAa,QAAQ,OAAO;IAC3C,GAAG,EAAE;IAEL,IAAI,8BAA8B,CAAA,GAAA,wCAAa,EAAE,CAAC;QAChD,yEAAyE;QACzE,uFAAuF;QACvF,IACE,CAAC,EAAE,SAAS,IACZ,yBACA,S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SAAS,cAAc,CAAC,uBAAuB,OAAO,IACtD;QACJ,IAAI,gBAAgB;YAClB,IAAI,SAAS,CAAA,GAAA,wCAAa,EAAE;YAC5B,eAAe;gBACb,kKAAkK;gBAClK,CAAA,GAAA,6CAAkB,EAAE,QAAQ,cAAc,OAAO;gBACjD,CAAA,GAAA,8CAAmB,EAAE,cAAc,OAAO,EAAG;YAC/C;QACF;IACF;IAEA,2FAA2F;IAC3F,oFAAoF;IACpF,+EAA+E;IAC/E,wFAAwF;IACxF,IAAI,gBAAgB,CAAC;QACnB,IACE,EAAE,MAAM,KAAK,KACb,EAAE,WAAW,KAAK,WAClB,uBAAuB,OAAO,IAAI,QAClC,SAAS,OAAO,IAAI,MAEpB;QAGF,IAAI,CAAA,GAAA,wCAAa,EAAE,OAAO,SAAS,OAAO,EACxC;IAEJ;IAEA,uGAAuG;IACvG,uDAAuD;IACvD,IAAI,aAAa;QACf,OAAO,MAAM,UAAU;kBACvB;IACF;IAEA,IAAI,oBAAoB;mBACtB;QACA,yBAAyB,MAAM,aAAa,IAAI;gBAChD;iBACA;uBACA;IACF;IAEA,aAAa;QACX,GAAG,UAAU;QACb,GAAI,yBAAyB,iBAAiB,iBAAiB;QAC/D,cAAc;QACd,iBAAiB,gBAAgB,eAAe;QAChD,mFAAmF;QACnF,qBAAqB;QACrB,qGAAqG;QACrG,aAAa;QACb,gEAAgE;QAChE,YAAY;QACZ,cAAc;IAChB;IAEA,OAAO;oBACL;QACA,iBAAiB,CAAA,GAAA,oCAAS,EAAE,iBAAiB;mCAC3C;YACA,mBAAmB;YACnB,WAAW,mBAAmB,UAAU;QAC1C;QACA,eAAe;QACf,QAAQ,UAAU,OAAO,WAAW;IACtC;AACF","sources":["packages/react-aria/src/autocomplete/useAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2024 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 BaseEvent,\n DOMProps,\n FocusableElement,\n FocusEvents,\n KeyboardEvents,\n Node,\n RefObject,\n ValueBase\n} from '@react-types/shared';\nimport {AriaTextFieldProps} from '../textfield/useTextField';\nimport {\n AutocompleteProps,\n AutocompleteState\n} from 'react-stately/private/autocomplete/useAutocompleteState';\nimport {CLEAR_FOCUS_EVENT, FOCUS_EVENT} from '../utils/constants';\nimport {\n dispatchVirtualBlur,\n dispatchVirtualFocus,\n getVirtuallyFocusedElement,\n moveVirtualFocus\n} from '../focus/virtualFocus';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getInteractionModality, getPointerType} from '../interactions/useFocusVisible';\nimport {getOwnerDocument} from '../utils/domHelpers';\nimport intlMessages from '../../intl/autocomplete/*.json';\nimport {isAndroid, isIOS} from '../utils/platform';\nimport {isCtrlKeyPressed} from '../utils/keyboard';\nimport {mergeProps} from '../utils/mergeProps';\nimport {mergeRefs} from '../utils/mergeRefs';\nimport {\n FocusEvent as ReactFocusEvent,\n KeyboardEvent as ReactKeyboardEvent,\n PointerEvent as ReactPointerEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useEffectEvent} from '../utils/useEffectEvent';\nimport {useEvent} from '../utils/useEvent';\nimport {useId} from '../utils/useId';\nimport {useLabels} from '../utils/useLabels';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useObjectRef} from '../utils/useObjectRef';\n\nexport interface CollectionOptions extends DOMProps, AriaLabelingProps {\n /** Whether the collection items should use virtual focus instead of being focused directly. */\n shouldUseVirtualFocus: boolean;\n /** Whether typeahead is disabled. */\n disallowTypeAhead: boolean;\n}\n\nexport interface InputProps<T = FocusableElement>\n extends\n DOMProps,\n FocusEvents<T>,\n KeyboardEvents,\n Pick<ValueBase<string>, 'onChange' | 'value'>,\n Pick<\n AriaTextFieldProps,\n | 'enterKeyHint'\n | 'aria-controls'\n | 'aria-autocomplete'\n | 'aria-activedescendant'\n | 'spellCheck'\n | 'autoCorrect'\n | 'autoComplete'\n > {}\n\nexport interface AriaAutocompleteProps<T> extends AutocompleteProps {\n /**\n * An optional filter function used to determine if a option should be included in the\n * autocomplete list. Include this if the items you are providing to your wrapped collection\n * aren't filtered by default.\n */\n filter?: (textValue: string, inputValue: string, node: Node<T>) => boolean;\n\n /**\n * Whether or not to focus the first item in the collection after a filter is performed. Note this\n * is only applicable if virtual focus behavior is not turned off via `disableVirtualFocus`.\n *\n * @default false\n */\n disableAutoFocusFirst?: boolean;\n\n /**\n * Whether the autocomplete should disable virtual focus, instead making the wrapped collection\n * directly tabbable.\n *\n * @default false\n */\n disableVirtualFocus?: boolean;\n}\n\nexport interface AriaAutocompleteOptions<T> extends Omit<AriaAutocompleteProps<T>, 'children'> {\n /** The ref for the wrapped collection element. */\n inputRef: RefObject<HTMLInputElement | null>;\n /** The ref for the wrapped collection element. */\n collectionRef: RefObject<HTMLElement | null>;\n}\n\nexport interface AutocompleteAria<T> {\n /**\n * Props for the autocomplete input element. These should be passed to the input's aria hooks\n * (e.g. useTextField/useSearchField/etc) respectively.\n */\n inputProps: InputProps;\n /** Props for the collection, to be passed to collection's respective aria hook (e.g. useMenu). */\n collectionProps: CollectionOptions;\n /** Ref to attach to the wrapped collection. */\n collectionRef: RefObject<HTMLElement | null>;\n /**\n * A filter function that returns if the provided collection node should be filtered out of the\n * collection.\n */\n filter?: (nodeTextValue: string, node: Node<T>) => boolean;\n}\n\n/**\n * Provides the behavior and accessibility implementation for an autocomplete component. An\n * autocomplete combines a text input with a collection, allowing users to filter the collection's\n * contents match a query.\n *\n * @param props - Props for the autocomplete.\n * @param state - State for the autocomplete, as returned by `useAutocompleteState`.\n */\nexport function useAutocomplete<T>(\n props: AriaAutocompleteOptions<T>,\n state: AutocompleteState\n): AutocompleteAria<T> {\n let {\n inputRef,\n collectionRef,\n filter,\n disableAutoFocusFirst = false,\n disableVirtualFocus = false\n } = props;\n\n let collectionId = useId();\n let timeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n let delayNextActiveDescendant = useRef(false);\n let queuedActiveDescendant = useRef<string | null>(null);\n\n // For mobile screen readers, we don't want virtual focus, instead opting to disable FocusScope's restoreFocus and manually\n // moving focus back to the subtriggers\n let isMobileScreenReader = getInteractionModality() === 'virtual' && (isIOS() || isAndroid());\n let [shouldUseVirtualFocus, setShouldUseVirtualFocus] = useState(\n !isMobileScreenReader && !disableVirtualFocus\n );\n // Tracks if a collection has been connected to the autocomplete. If false, we don't want to add various attributes to the autocomplete input\n // since it isn't attached to a filterable collection (e.g. Tabs)\n let [hasCollection, setHasCollection] = useState(false);\n let [autoFocusOnMount, setAutoFocusOnMount] = useState(false);\n\n useEffect(() => {\n return () => clearTimeout(timeout.current);\n }, []);\n\n let updateActiveDescendantEvent = useEffectEvent((e: Event) => {\n // Ensure input is focused if the user clicks on the collection directly.\n // don't trigger on touch so that mobile keyboard doesnt appear when tapping on options\n if (\n !e.isTrusted &&\n shouldUseVirtualFocus &&\n inputRef.current &&\n getActiveElement(getOwnerDocument(inputRef.current)) !== inputRef.current &&\n getPointerType() !== 'touch'\n ) {\n inputRef.current.focus();\n }\n\n let target = getEventTarget(e) as Element | null;\n if (e.isTrusted || !target || queuedActiveDescendant.current === target.id) {\n return;\n }\n\n clearTimeout(timeout.current);\n if (target !== collectionRef.current) {\n if (delayNextActiveDescendant.current) {\n queuedActiveDescendant.current = target.id;\n timeout.current = setTimeout(() => {\n state.setFocusedNodeId(target.id);\n }, 500);\n } else {\n queuedActiveDescendant.current = target.id;\n state.setFocusedNodeId(target.id);\n }\n } else if (\n queuedActiveDescendant.current &&\n !document.getElementById(queuedActiveDescendant.current)\n ) {\n // If we recieve a focus event refocusing the collection, either we have newly refocused the input and are waiting for the\n // wrapped collection to refocus the previously focused node if any OR\n // we are in a state where we've filtered to such a point that there aren't any matching items in the collection to focus.\n // In this case we want to clear tracked item if any and clear active descendant\n queuedActiveDescendant.current = null;\n state.setFocusedNodeId(null);\n }\n\n delayNextActiveDescendant.current = false;\n });\n\n let [collectionNode, setCollectionNode] = useState<HTMLElement | null>(null);\n let callbackRef = useCallback(node => {\n setCollectionNode(node);\n if (node != null) {\n // If useSelectableCollection isn't passed shouldUseVirtualFocus even when useAutocomplete provides it\n // that means the collection doesn't support it (e.g. Table). If that is the case, we need to disable it here regardless\n // of what the user's provided so that the input doesn't recieve the onKeyDown and autocomplete props.\n if (node.getAttribute('tabindex') != null) {\n setShouldUseVirtualFocus(false);\n }\n setHasCollection(true);\n } else {\n setHasCollection(false);\n }\n }, []);\n useLayoutEffect(() => {\n if (collectionNode != null) {\n // When typing forward, we want to delay the setting of active descendant to not interrupt the native screen reader announcement\n // of the letter you just typed. If we recieve another focus event then we clear the queued update\n collectionNode.addEventListener('focusin', updateActiveDescendantEvent);\n }\n return () => {\n collectionNode?.removeEventListener('focusin', updateActiveDescendantEvent);\n };\n }, [collectionNode]);\n\n // Make sure to memo so that React doesn't keep registering a new event listeners on every rerender of the wrapped collection\n let mergedCollectionRef = useObjectRef(\n useMemo(() => mergeRefs(collectionRef, callbackRef), [collectionRef, callbackRef])\n );\n\n let focusFirstItem = useCallback(() => {\n if (!collectionRef.current) {\n setAutoFocusOnMount(true);\n return;\n }\n\n delayNextActiveDescendant.current = true;\n collectionRef.current?.dispatchEvent(\n new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: {\n focusStrategy: 'first'\n }\n })\n );\n }, [collectionRef]);\n\n let clearVirtualFocus = useCallback(\n (clearFocusKey?: boolean) => {\n setAutoFocusOnMount(false);\n moveVirtualFocus(getActiveElement());\n queuedActiveDescendant.current = null;\n state.setFocusedNodeId(null);\n let clearFocusEvent = new CustomEvent(CLEAR_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: {\n clearFocusKey\n }\n });\n clearTimeout(timeout.current);\n delayNextActiveDescendant.current = false;\n collectionRef.current?.dispatchEvent(clearFocusEvent);\n },\n [collectionRef, state]\n );\n\n let lastInputType = useRef('');\n useEvent(inputRef, 'beforeinput', e => {\n let {inputType} = e as InputEvent;\n lastInputType.current = inputType;\n });\n\n let onChange = (value: string) => {\n // Tell wrapped collection to focus the first element in the list when typing forward and to clear focused key when modifying the text via\n // copy paste/backspacing/undo/redo for screen reader announcements\n if (\n (lastInputType.current === 'insertText' ||\n // IME composition (e.g. CJK input) reports 'insertCompositionText'/'insertFromComposition'\n // instead of 'insertText'. Treat these as forward typing so the first item gets virtual focus.\n lastInputType.current === 'insertCompositionText' ||\n lastInputType.current === 'insertFromComposition') &&\n !disableAutoFocusFirst\n ) {\n focusFirstItem();\n } else if (\n lastInputType.current &&\n (lastInputType.current.includes('insert') ||\n lastInputType.current.includes('delete') ||\n lastInputType.current.includes('history'))\n ) {\n clearVirtualFocus(true);\n\n // If onChange was triggered before the timeout actually updated the activedescendant, we need to fire\n // our own dispatchVirtualFocus so focusVisible gets reapplied on the input\n if (getVirtuallyFocusedElement(document) === inputRef.current) {\n dispatchVirtualFocus(inputRef.current!, null);\n }\n }\n\n state.setInputValue(value);\n };\n\n let keyDownTarget = useRef<Element | null>(null);\n // For textfield specific keydown operations\n let onKeyDown = (e: BaseEvent<ReactKeyboardEvent<any>>) => {\n keyDownTarget.current = getEventTarget(e) as Element;\n if (e.nativeEvent.isComposing) {\n return;\n }\n\n let focusedNodeId = queuedActiveDescendant.current;\n if (\n focusedNodeId !== null &&\n getOwnerDocument(inputRef.current).getElementById(focusedNodeId) == null\n ) {\n // if the focused id doesn't exist in document, then we need to clear the tracked focused node, otherwise\n // we will be attempting to fire key events on a non-existing node instead of trying to focus the newly swapped wrapped collection.\n // This can happen if you are swapping out the Autocomplete wrapped collection component like in the docs search.\n queuedActiveDescendant.current = null;\n focusedNodeId = null;\n }\n\n switch (e.key) {\n case 'a':\n if (isCtrlKeyPressed(e)) {\n return;\n }\n break;\n case 'Escape':\n // Early return for Escape here so it doesn't leak the Escape event from the simulated collection event below and\n // close the dialog prematurely. Ideally that should be up to the discretion of the input element hence the check\n // for isPropagationStopped\n if (e.isDefaultPrevented()) {\n return;\n }\n break;\n case ' ':\n // Space shouldn't trigger onAction so early return.\n return;\n case 'Tab':\n // Don't propogate Tab down to the collection, otherwise we will try to focus the collection via useSelectableCollection's Tab handler (aka shift tab logic)\n // We want FocusScope to handle Tab if one exists (aka sub dialog), so special casepropogate\n if ('continuePropagation' in e) {\n e.continuePropagation();\n }\n return;\n case 'Home':\n case 'End':\n case 'PageDown':\n case 'PageUp':\n case 'ArrowUp':\n case 'ArrowDown':\n case 'ArrowRight':\n case 'ArrowLeft': {\n if ((e.key === 'Home' || e.key === 'End') && focusedNodeId == null && e.shiftKey) {\n return;\n }\n\n // If there is text within the input field, we'll want continue propagating events down\n // to the wrapped collection if there is a focused node so that a user can continue moving the\n // virtual focus. However, if the user doesn't have a focus in the collection, just move the text\n // cursor instead. They can move focus down into the collection via down/up arrow if need be\n if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {\n if (focusedNodeId == null) {\n if (!e.isPropagationStopped()) {\n e.stopPropagation();\n }\n return;\n }\n\n break;\n }\n\n // Prevent these keys from moving the text cursor in the input\n e.preventDefault();\n // Move virtual focus into the wrapped collection\n let focusCollection = new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true\n });\n\n collectionRef.current?.dispatchEvent(focusCollection);\n break;\n }\n }\n\n // Emulate the keyboard events that happen in the input field in the wrapped collection. This is for triggering things like onAction via Enter\n // or moving focus from one item to another. Stop propagation on the input event if it isn't already stopped so it doesn't leak out. For events\n // like ESC, the dispatched event below will bubble out of the collection and be stopped if handled by useSelectableCollection, otherwise will bubble\n // as expected\n if (!e.isPropagationStopped()) {\n e.stopPropagation();\n }\n\n let shouldPerformDefaultAction = true;\n if (collectionRef.current !== null) {\n if (focusedNodeId == null) {\n shouldPerformDefaultAction =\n collectionRef.current?.dispatchEvent(\n new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)\n ) || false;\n } else {\n let item = document.getElementById(focusedNodeId);\n if (item) {\n shouldPerformDefaultAction =\n item?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)) || false;\n }\n }\n }\n\n if (shouldPerformDefaultAction) {\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n // Clear the activedescendant so NVDA announcements aren't interrupted but retain the focused key in the collection so the\n // user's keyboard navigation restarts from where they left off\n clearVirtualFocus();\n break;\n }\n case 'Enter':\n // Trigger click action on item when Enter key was pressed.\n if (focusedNodeId != null) {\n let item = document.getElementById(focusedNodeId);\n item?.dispatchEvent(new PointerEvent('click', e.nativeEvent));\n }\n break;\n }\n } else {\n // TODO: check if we can do this, want to stop textArea from using its default Enter behavior so items are properly triggered\n e.preventDefault();\n }\n };\n\n let onKeyUpCapture = useEffectEvent(e => {\n // Dispatch simulated key up events for things like triggering links in listbox\n // Make sure to stop the propagation of the input keyup event so that the simulated keyup/down pair\n // is detected by usePress instead of the original keyup originating from the input\n if (getEventTarget(e) === keyDownTarget.current) {\n e.stopImmediatePropagation();\n let focusedNodeId = queuedActiveDescendant.current;\n if (focusedNodeId == null) {\n collectionRef.current?.dispatchEvent(new KeyboardEvent(e.type, e));\n } else {\n let item = document.getElementById(focusedNodeId);\n item?.dispatchEvent(new KeyboardEvent(e.type, e));\n }\n }\n });\n\n useEffect(() => {\n document.addEventListener('keyup', onKeyUpCapture, true);\n return () => {\n document.removeEventListener('keyup', onKeyUpCapture, true);\n };\n }, []);\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/autocomplete');\n let collectionProps = useLabels({\n id: collectionId,\n 'aria-label': stringFormatter.format('collectionLabel')\n });\n\n let filterFn = useCallback(\n (nodeTextValue: string, node: Node<T>) => {\n if (filter) {\n return filter(nodeTextValue, state.inputValue, node);\n }\n\n return true;\n },\n [state.inputValue, filter]\n );\n\n // Be sure to clear/restore the virtual + collection focus when blurring/refocusing the field so we only show the\n // focus ring on the virtually focused collection when are actually interacting with the Autocomplete\n let onBlur = (e: ReactFocusEvent) => {\n if (!e.isTrusted) {\n return;\n }\n\n let lastFocusedNode = queuedActiveDescendant.current\n ? document.getElementById(queuedActiveDescendant.current)\n : null;\n if (lastFocusedNode) {\n dispatchVirtualBlur(lastFocusedNode, e.relatedTarget);\n }\n };\n\n let onFocus = (e: ReactFocusEvent) => {\n if (!e.isTrusted) {\n return;\n }\n\n let curFocusedNode = queuedActiveDescendant.current\n ? document.getElementById(queuedActiveDescendant.current)\n : null;\n if (curFocusedNode) {\n let target = getEventTarget(e);\n queueMicrotask(() => {\n // instead of focusing the last focused node, just focus the collection instead and have the collection handle what item to focus via useSelectableCollection/Item\n dispatchVirtualBlur(target, collectionRef.current);\n dispatchVirtualFocus(collectionRef.current!, target);\n });\n }\n };\n\n // Clicking back into the input can happen after focus moved elsewhere in the dialog, while\n // virtual focus is still on an option. Clear virtual focus on pointer down so mouse\n // interactions restore the input state before the click's focus handling runs.\n // Touch is excluded because touch interactions should not move focus back to the input.\n let onPointerDown = (e: ReactPointerEvent) => {\n if (\n e.button !== 0 ||\n e.pointerType === 'touch' ||\n queuedActiveDescendant.current == null ||\n inputRef.current == null\n ) {\n return;\n }\n\n if (getEventTarget(e) === inputRef.current) {\n clearVirtualFocus();\n }\n };\n\n // Only apply the autocomplete specific behaviors if the collection component wrapped by it is actually\n // being filtered/allows filtering by the Autocomplete.\n let inputProps = {\n value: state.inputValue,\n onChange\n } as AriaTextFieldProps<FocusableElement>;\n\n let virtualFocusProps = {\n onKeyDown,\n 'aria-activedescendant': state.focusedNodeId ?? undefined,\n onBlur,\n onFocus,\n onPointerDown\n };\n\n inputProps = {\n ...inputProps,\n ...(shouldUseVirtualFocus && hasCollection && virtualFocusProps),\n enterKeyHint: 'go',\n 'aria-controls': hasCollection ? collectionId : undefined,\n // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)\n 'aria-autocomplete': 'list',\n // This disable's iOS's autocorrect suggestions, since the autocomplete provides its own suggestions.\n autoCorrect: 'off',\n // This disable's the macOS Safari spell check auto corrections.\n spellCheck: 'false',\n autoComplete: 'off'\n };\n\n return {\n inputProps,\n collectionProps: mergeProps(collectionProps, {\n shouldUseVirtualFocus,\n disallowTypeAhead: shouldUseVirtualFocus,\n autoFocus: autoFocusOnMount ? 'first' : false\n }),\n collectionRef: mergedCollectionRef,\n filter: filter != null ? filterFn : undefined\n };\n}\n"],"names":[],"version":3,"file":"useAutocomplete.cjs.map"}
|
|
@@ -62,6 +62,7 @@ function $e9f66e10c06d1e5c$export$1e40b3ca02d92d21(props, state) {
|
|
|
62
62
|
// Tracks if a collection has been connected to the autocomplete. If false, we don't want to add various attributes to the autocomplete input
|
|
63
63
|
// since it isn't attached to a filterable collection (e.g. Tabs)
|
|
64
64
|
let [hasCollection, setHasCollection] = (0, $8FiQn$useState)(false);
|
|
65
|
+
let [autoFocusOnMount, setAutoFocusOnMount] = (0, $8FiQn$useState)(false);
|
|
65
66
|
(0, $8FiQn$useEffect)(()=>{
|
|
66
67
|
return ()=>clearTimeout(timeout.current);
|
|
67
68
|
}, []);
|
|
@@ -120,6 +121,10 @@ function $e9f66e10c06d1e5c$export$1e40b3ca02d92d21(props, state) {
|
|
|
120
121
|
]));
|
|
121
122
|
let focusFirstItem = (0, $8FiQn$useCallback)(()=>{
|
|
122
123
|
var _collectionRef_current;
|
|
124
|
+
if (!collectionRef.current) {
|
|
125
|
+
setAutoFocusOnMount(true);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
123
128
|
delayNextActiveDescendant.current = true;
|
|
124
129
|
(_collectionRef_current = collectionRef.current) === null || _collectionRef_current === void 0 ? void 0 : _collectionRef_current.dispatchEvent(new CustomEvent((0, $7376cba1b89d16ef$export$831c820ad60f9d12), {
|
|
125
130
|
cancelable: true,
|
|
@@ -133,6 +138,7 @@ function $e9f66e10c06d1e5c$export$1e40b3ca02d92d21(props, state) {
|
|
|
133
138
|
]);
|
|
134
139
|
let clearVirtualFocus = (0, $8FiQn$useCallback)((clearFocusKey)=>{
|
|
135
140
|
var _collectionRef_current;
|
|
141
|
+
setAutoFocusOnMount(false);
|
|
136
142
|
(0, $57a86975180d30a8$export$76e4e37e5339496d)((0, $d8ac7ed472840322$export$cd4e5573fbe2b576)());
|
|
137
143
|
queuedActiveDescendant.current = null;
|
|
138
144
|
state.setFocusedNodeId(null);
|
|
@@ -151,14 +157,16 @@ function $e9f66e10c06d1e5c$export$1e40b3ca02d92d21(props, state) {
|
|
|
151
157
|
state
|
|
152
158
|
]);
|
|
153
159
|
let lastInputType = (0, $8FiQn$useRef)('');
|
|
154
|
-
(0, $c3cab330536504ec$export$90fc3a17d93f704c)(inputRef, '
|
|
160
|
+
(0, $c3cab330536504ec$export$90fc3a17d93f704c)(inputRef, 'beforeinput', (e)=>{
|
|
155
161
|
let { inputType: inputType } = e;
|
|
156
162
|
lastInputType.current = inputType;
|
|
157
163
|
});
|
|
158
164
|
let onChange = (value)=>{
|
|
159
165
|
// Tell wrapped collection to focus the first element in the list when typing forward and to clear focused key when modifying the text via
|
|
160
166
|
// copy paste/backspacing/undo/redo for screen reader announcements
|
|
161
|
-
if (lastInputType.current === 'insertText'
|
|
167
|
+
if ((lastInputType.current === 'insertText' || // IME composition (e.g. CJK input) reports 'insertCompositionText'/'insertFromComposition'
|
|
168
|
+
// instead of 'insertText'. Treat these as forward typing so the first item gets virtual focus.
|
|
169
|
+
lastInputType.current === 'insertCompositionText' || lastInputType.current === 'insertFromComposition') && !disableAutoFocusFirst) focusFirstItem();
|
|
162
170
|
else if (lastInputType.current && (lastInputType.current.includes('insert') || lastInputType.current.includes('delete') || lastInputType.current.includes('history'))) {
|
|
163
171
|
clearVirtualFocus(true);
|
|
164
172
|
// If onChange was triggered before the timeout actually updated the activedescendant, we need to fire
|
|
@@ -213,7 +221,7 @@ function $e9f66e10c06d1e5c$export$1e40b3ca02d92d21(props, state) {
|
|
|
213
221
|
// to the wrapped collection if there is a focused node so that a user can continue moving the
|
|
214
222
|
// virtual focus. However, if the user doesn't have a focus in the collection, just move the text
|
|
215
223
|
// cursor instead. They can move focus down into the collection via down/up arrow if need be
|
|
216
|
-
if (
|
|
224
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
217
225
|
if (focusedNodeId == null) {
|
|
218
226
|
if (!e.isPropagationStopped()) e.stopPropagation();
|
|
219
227
|
return;
|
|
@@ -337,11 +345,11 @@ function $e9f66e10c06d1e5c$export$1e40b3ca02d92d21(props, state) {
|
|
|
337
345
|
onFocus: onFocus,
|
|
338
346
|
onPointerDown: onPointerDown
|
|
339
347
|
};
|
|
340
|
-
|
|
348
|
+
inputProps = {
|
|
341
349
|
...inputProps,
|
|
342
|
-
...shouldUseVirtualFocus && virtualFocusProps,
|
|
350
|
+
...shouldUseVirtualFocus && hasCollection && virtualFocusProps,
|
|
343
351
|
enterKeyHint: 'go',
|
|
344
|
-
'aria-controls': collectionId,
|
|
352
|
+
'aria-controls': hasCollection ? collectionId : undefined,
|
|
345
353
|
// TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)
|
|
346
354
|
'aria-autocomplete': 'list',
|
|
347
355
|
// This disable's iOS's autocorrect suggestions, since the autocomplete provides its own suggestions.
|
|
@@ -354,7 +362,8 @@ function $e9f66e10c06d1e5c$export$1e40b3ca02d92d21(props, state) {
|
|
|
354
362
|
inputProps: inputProps,
|
|
355
363
|
collectionProps: (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(collectionProps, {
|
|
356
364
|
shouldUseVirtualFocus: shouldUseVirtualFocus,
|
|
357
|
-
disallowTypeAhead: shouldUseVirtualFocus
|
|
365
|
+
disallowTypeAhead: shouldUseVirtualFocus,
|
|
366
|
+
autoFocus: autoFocusOnMount ? 'first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O,IAAI;QAChH,IAAI,gBAAgB;YAClB,IAAI,SAAS,CAAA,GAAA,yCAAa,EAAE;YAC5B,eAAe;gBACb,kKAAkK;gBAClK,CAAA,GAAA,yCAAkB,EAAE,QAAQ,cAAc,OAAO;gBACjD,CAAA,GAAA,yCAAmB,EAAE,cAAc,OAAO,EAAG;YAC/C;QACF;IACF;IAEA,2FAA2F;IAC3F,oFAAoF;IACpF,+EAA+E;IAC/E,wFAAwF;IACxF,IAAI,gBAAgB,CAAC;QACnB,IAAI,EAAE,MAAM,KAAK,KAAK,EAAE,WAAW,KAAK,WAAW,uBAAuB,OAAO,IAAI,QAAQ,SAAS,OAAO,IAAI,MAC/G;QAGF,IAAI,CAAA,GAAA,yCAAa,EAAE,OAAO,SAAS,OAAO,EACxC;IAEJ;IAEA,uGAAuG;IACvG,uDAAuD;IACvD,IAAI,aAAa;QACf,OAAO,MAAM,UAAU;kBACvB;IACF;QAI2B;IAF3B,IAAI,oBAAoB;mBACtB;QACA,yBAAyB,CAAA,uBAAA,MAAM,aAAa,cAAnB,kCAAA,uBAAuB;gBAChD;iBACA;uBACA;IACF;IAEA,IAAI,eACF,aAAa;QACX,GAAG,UAAU;QACb,GAAI,yBAAyB,iBAAiB;QAC9C,cAAc;QACd,iBAAiB;QACjB,mFAAmF;QACnF,qBAAqB;QACrB,qGAAqG;QACrG,aAAa;QACb,gEAAgE;QAChE,YAAY;QACZ,cAAc;IAChB;IAGF,OAAO;oBACL;QACA,iBAAiB,CAAA,GAAA,yCAAS,EAAE,iBAAiB;mCAC3C;YACA,mBAAmB;QACrB;QACA,eAAe;QACf,QAAQ,UAAU,OAAO,WAAW;IACtC;AACF","sources":["packages/react-aria/src/autocomplete/useAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2024 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, BaseEvent, DOMProps, FocusableElement, FocusEvents, KeyboardEvents, Node, RefObject, ValueBase} from '@react-types/shared';\nimport {AriaTextFieldProps} from '../textfield/useTextField';\nimport {AutocompleteProps, AutocompleteState} from 'react-stately/private/autocomplete/useAutocompleteState';\nimport {CLEAR_FOCUS_EVENT, FOCUS_EVENT} from '../utils/constants';\nimport {\n dispatchVirtualBlur,\n dispatchVirtualFocus,\n getVirtuallyFocusedElement,\n moveVirtualFocus\n} from '../focus/virtualFocus';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getInteractionModality, getPointerType} from '../interactions/useFocusVisible';\nimport {getOwnerDocument} from '../utils/domHelpers';\nimport intlMessages from '../../intl/autocomplete/*.json';\nimport {isAndroid, isIOS} from '../utils/platform';\nimport {isCtrlKeyPressed} from '../utils/keyboard';\nimport {mergeProps} from '../utils/mergeProps';\nimport {mergeRefs} from '../utils/mergeRefs';\nimport {FocusEvent as ReactFocusEvent, KeyboardEvent as ReactKeyboardEvent, PointerEvent as ReactPointerEvent, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {useEffectEvent} from '../utils/useEffectEvent';\nimport {useEvent} from '../utils/useEvent';\n\nimport {useId} from '../utils/useId';\n\nimport {useLabels} from '../utils/useLabels';\n// @ts-ignore\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useObjectRef} from '../utils/useObjectRef';\n\nexport interface CollectionOptions extends DOMProps, AriaLabelingProps {\n /** Whether the collection items should use virtual focus instead of being focused directly. */\n shouldUseVirtualFocus: boolean,\n /** Whether typeahead is disabled. */\n disallowTypeAhead: boolean\n}\n\nexport interface InputProps<T = FocusableElement> extends DOMProps,\n FocusEvents<T>,\n KeyboardEvents,\n Pick<ValueBase<string>, 'onChange' | 'value'>,\n Pick<AriaTextFieldProps, 'enterKeyHint' | 'aria-controls' | 'aria-autocomplete' | 'aria-activedescendant' | 'spellCheck' | 'autoCorrect' | 'autoComplete'> {}\n\nexport interface AriaAutocompleteProps<T> extends AutocompleteProps {\n /**\n * An optional filter function used to determine if a option should be included in the autocomplete list.\n * Include this if the items you are providing to your wrapped collection aren't filtered by default.\n */\n filter?: (textValue: string, inputValue: string, node: Node<T>) => boolean,\n\n /**\n * Whether or not to focus the first item in the collection after a filter is performed. Note this is only applicable\n * if virtual focus behavior is not turned off via `disableVirtualFocus`.\n * @default false\n */\n disableAutoFocusFirst?: boolean,\n\n /**\n * Whether the autocomplete should disable virtual focus, instead making the wrapped collection directly tabbable.\n * @default false\n */\n disableVirtualFocus?: boolean\n}\n\nexport interface AriaAutocompleteOptions<T> extends Omit<AriaAutocompleteProps<T>, 'children'> {\n /** The ref for the wrapped collection element. */\n inputRef: RefObject<HTMLInputElement | null>,\n /** The ref for the wrapped collection element. */\n collectionRef: RefObject<HTMLElement | null>\n}\n\nexport interface AutocompleteAria<T> {\n /** Props for the autocomplete input element. These should be passed to the input's aria hooks (e.g. useTextField/useSearchField/etc) respectively. */\n inputProps: InputProps,\n /** Props for the collection, to be passed to collection's respective aria hook (e.g. useMenu). */\n collectionProps: CollectionOptions,\n /** Ref to attach to the wrapped collection. */\n collectionRef: RefObject<HTMLElement | null>,\n /** A filter function that returns if the provided collection node should be filtered out of the collection. */\n filter?: (nodeTextValue: string, node: Node<T>) => boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for an autocomplete component.\n * An autocomplete combines a text input with a collection, allowing users to filter the collection's contents match a query.\n * @param props - Props for the autocomplete.\n * @param state - State for the autocomplete, as returned by `useAutocompleteState`.\n */\nexport function useAutocomplete<T>(props: AriaAutocompleteOptions<T>, state: AutocompleteState): AutocompleteAria<T> {\n let {\n inputRef,\n collectionRef,\n filter,\n disableAutoFocusFirst = false,\n disableVirtualFocus = false\n } = props;\n\n let collectionId = useId();\n let timeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n let delayNextActiveDescendant = useRef(false);\n let queuedActiveDescendant = useRef<string | null>(null);\n\n // For mobile screen readers, we don't want virtual focus, instead opting to disable FocusScope's restoreFocus and manually\n // moving focus back to the subtriggers\n let isMobileScreenReader = getInteractionModality() === 'virtual' && (isIOS() || isAndroid());\n let [shouldUseVirtualFocus, setShouldUseVirtualFocus] = useState(!isMobileScreenReader && !disableVirtualFocus);\n // Tracks if a collection has been connected to the autocomplete. If false, we don't want to add various attributes to the autocomplete input\n // since it isn't attached to a filterable collection (e.g. Tabs)\n let [hasCollection, setHasCollection] = useState(false);\n\n useEffect(() => {\n return () => clearTimeout(timeout.current);\n }, []);\n\n let updateActiveDescendantEvent = useEffectEvent((e: Event) => {\n // Ensure input is focused if the user clicks on the collection directly.\n // don't trigger on touch so that mobile keyboard doesnt appear when tapping on options\n if (!e.isTrusted && shouldUseVirtualFocus && inputRef.current && getActiveElement(getOwnerDocument(inputRef.current)) !== inputRef.current && getPointerType() !== 'touch') {\n inputRef.current.focus();\n }\n\n let target = getEventTarget(e) as Element | null;\n if (e.isTrusted || !target || queuedActiveDescendant.current === target.id) {\n return;\n }\n\n clearTimeout(timeout.current);\n if (target !== collectionRef.current) {\n if (delayNextActiveDescendant.current) {\n queuedActiveDescendant.current = target.id;\n timeout.current = setTimeout(() => {\n state.setFocusedNodeId(target.id);\n }, 500);\n } else {\n queuedActiveDescendant.current = target.id;\n state.setFocusedNodeId(target.id);\n }\n } else if (queuedActiveDescendant.current && !document.getElementById(queuedActiveDescendant.current)) {\n // If we recieve a focus event refocusing the collection, either we have newly refocused the input and are waiting for the\n // wrapped collection to refocus the previously focused node if any OR\n // we are in a state where we've filtered to such a point that there aren't any matching items in the collection to focus.\n // In this case we want to clear tracked item if any and clear active descendant\n queuedActiveDescendant.current = null;\n state.setFocusedNodeId(null);\n }\n\n delayNextActiveDescendant.current = false;\n });\n\n let [collectionNode, setCollectionNode] = useState<HTMLElement | null>(null);\n let callbackRef = useCallback((node) => {\n setCollectionNode(node);\n if (node != null) {\n // If useSelectableCollection isn't passed shouldUseVirtualFocus even when useAutocomplete provides it\n // that means the collection doesn't support it (e.g. Table). If that is the case, we need to disable it here regardless\n // of what the user's provided so that the input doesn't recieve the onKeyDown and autocomplete props.\n if (node.getAttribute('tabindex') != null) {\n setShouldUseVirtualFocus(false);\n }\n setHasCollection(true);\n } else {\n setHasCollection(false);\n }\n }, []);\n useLayoutEffect(() => {\n if (collectionNode != null) {\n // When typing forward, we want to delay the setting of active descendant to not interrupt the native screen reader announcement\n // of the letter you just typed. If we recieve another focus event then we clear the queued update\n collectionNode.addEventListener('focusin', updateActiveDescendantEvent);\n }\n return () => {\n collectionNode?.removeEventListener('focusin', updateActiveDescendantEvent);\n };\n }, [collectionNode]);\n\n // Make sure to memo so that React doesn't keep registering a new event listeners on every rerender of the wrapped collection\n let mergedCollectionRef = useObjectRef(useMemo(() => mergeRefs(collectionRef, callbackRef), [collectionRef, callbackRef]));\n\n let focusFirstItem = useCallback(() => {\n delayNextActiveDescendant.current = true;\n collectionRef.current?.dispatchEvent(\n new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: {\n focusStrategy: 'first'\n }\n })\n );\n }, [collectionRef]);\n\n let clearVirtualFocus = useCallback((clearFocusKey?: boolean) => {\n moveVirtualFocus(getActiveElement());\n queuedActiveDescendant.current = null;\n state.setFocusedNodeId(null);\n let clearFocusEvent = new CustomEvent(CLEAR_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: {\n clearFocusKey\n }\n });\n clearTimeout(timeout.current);\n delayNextActiveDescendant.current = false;\n collectionRef.current?.dispatchEvent(clearFocusEvent);\n }, [collectionRef, state]);\n\n let lastInputType = useRef('');\n useEvent(inputRef, 'input', e => {\n let {inputType} = e as InputEvent;\n lastInputType.current = inputType;\n });\n\n let onChange = (value: string) => {\n // Tell wrapped collection to focus the first element in the list when typing forward and to clear focused key when modifying the text via\n // copy paste/backspacing/undo/redo for screen reader announcements\n if (lastInputType.current === 'insertText' && !disableAutoFocusFirst) {\n focusFirstItem();\n } else if (lastInputType.current && (lastInputType.current.includes('insert') || lastInputType.current.includes('delete') || lastInputType.current.includes('history'))) {\n clearVirtualFocus(true);\n\n // If onChange was triggered before the timeout actually updated the activedescendant, we need to fire\n // our own dispatchVirtualFocus so focusVisible gets reapplied on the input\n if (getVirtuallyFocusedElement(document) === inputRef.current) {\n dispatchVirtualFocus(inputRef.current!, null);\n }\n }\n\n state.setInputValue(value);\n };\n\n let keyDownTarget = useRef<Element | null>(null);\n // For textfield specific keydown operations\n let onKeyDown = (e: BaseEvent<ReactKeyboardEvent<any>>) => {\n keyDownTarget.current = getEventTarget(e) as Element;\n if (e.nativeEvent.isComposing) {\n return;\n }\n\n let focusedNodeId = queuedActiveDescendant.current;\n if (focusedNodeId !== null && getOwnerDocument(inputRef.current).getElementById(focusedNodeId) == null) {\n // if the focused id doesn't exist in document, then we need to clear the tracked focused node, otherwise\n // we will be attempting to fire key events on a non-existing node instead of trying to focus the newly swapped wrapped collection.\n // This can happen if you are swapping out the Autocomplete wrapped collection component like in the docs search.\n queuedActiveDescendant.current = null;\n focusedNodeId = null;\n }\n\n switch (e.key) {\n case 'a':\n if (isCtrlKeyPressed(e)) {\n return;\n }\n break;\n case 'Escape':\n // Early return for Escape here so it doesn't leak the Escape event from the simulated collection event below and\n // close the dialog prematurely. Ideally that should be up to the discretion of the input element hence the check\n // for isPropagationStopped\n if (e.isDefaultPrevented()) {\n return;\n }\n break;\n case ' ':\n // Space shouldn't trigger onAction so early return.\n return;\n case 'Tab':\n // Don't propogate Tab down to the collection, otherwise we will try to focus the collection via useSelectableCollection's Tab handler (aka shift tab logic)\n // We want FocusScope to handle Tab if one exists (aka sub dialog), so special casepropogate\n if ('continuePropagation' in e) {\n e.continuePropagation();\n }\n return;\n case 'Home':\n case 'End':\n case 'PageDown':\n case 'PageUp':\n case 'ArrowUp':\n case 'ArrowDown':\n case 'ArrowRight':\n case 'ArrowLeft': {\n if ((e.key === 'Home' || e.key === 'End') && focusedNodeId == null && e.shiftKey) {\n return;\n }\n\n // If there is text within the input field, we'll want continue propagating events down\n // to the wrapped collection if there is a focused node so that a user can continue moving the\n // virtual focus. However, if the user doesn't have a focus in the collection, just move the text\n // cursor instead. They can move focus down into the collection via down/up arrow if need be\n if ((e.key === 'ArrowRight' || e.key === 'ArrowLeft') && state.inputValue.length > 0) {\n if (focusedNodeId == null) {\n if (!e.isPropagationStopped()) {\n e.stopPropagation();\n }\n return;\n }\n\n break;\n }\n\n // Prevent these keys from moving the text cursor in the input\n e.preventDefault();\n // Move virtual focus into the wrapped collection\n let focusCollection = new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true\n });\n\n collectionRef.current?.dispatchEvent(focusCollection);\n break;\n }\n }\n\n // Emulate the keyboard events that happen in the input field in the wrapped collection. This is for triggering things like onAction via Enter\n // or moving focus from one item to another. Stop propagation on the input event if it isn't already stopped so it doesn't leak out. For events\n // like ESC, the dispatched event below will bubble out of the collection and be stopped if handled by useSelectableCollection, otherwise will bubble\n // as expected\n if (!e.isPropagationStopped()) {\n e.stopPropagation();\n }\n\n let shouldPerformDefaultAction = true;\n if (collectionRef.current !== null) {\n if (focusedNodeId == null) {\n shouldPerformDefaultAction = collectionRef.current?.dispatchEvent(\n new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)\n ) || false;\n } else {\n let item = document.getElementById(focusedNodeId);\n if (item) {\n shouldPerformDefaultAction = item?.dispatchEvent(\n new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)\n ) || false;\n }\n }\n }\n\n if (shouldPerformDefaultAction) {\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n // Clear the activedescendant so NVDA announcements aren't interrupted but retain the focused key in the collection so the\n // user's keyboard navigation restarts from where they left off\n clearVirtualFocus();\n break;\n }\n case 'Enter':\n // Trigger click action on item when Enter key was pressed.\n if (focusedNodeId != null) {\n let item = document.getElementById(focusedNodeId);\n item?.dispatchEvent(new PointerEvent('click', e.nativeEvent));\n }\n break;\n }\n } else {\n // TODO: check if we can do this, want to stop textArea from using its default Enter behavior so items are properly triggered\n e.preventDefault();\n }\n };\n\n let onKeyUpCapture = useEffectEvent((e) => {\n // Dispatch simulated key up events for things like triggering links in listbox\n // Make sure to stop the propagation of the input keyup event so that the simulated keyup/down pair\n // is detected by usePress instead of the original keyup originating from the input\n if (getEventTarget(e) === keyDownTarget.current) {\n e.stopImmediatePropagation();\n let focusedNodeId = queuedActiveDescendant.current;\n if (focusedNodeId == null) {\n collectionRef.current?.dispatchEvent(\n new KeyboardEvent(e.type, e)\n );\n } else {\n let item = document.getElementById(focusedNodeId);\n item?.dispatchEvent(\n new KeyboardEvent(e.type, e)\n );\n }\n }\n });\n\n useEffect(() => {\n document.addEventListener('keyup', onKeyUpCapture, true);\n return () => {\n document.removeEventListener('keyup', onKeyUpCapture, true);\n };\n }, []);\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/autocomplete');\n let collectionProps = useLabels({\n id: collectionId,\n 'aria-label': stringFormatter.format('collectionLabel')\n });\n\n let filterFn = useCallback((nodeTextValue: string, node: Node<T>) => {\n if (filter) {\n return filter(nodeTextValue, state.inputValue, node);\n }\n\n return true;\n }, [state.inputValue, filter]);\n\n // Be sure to clear/restore the virtual + collection focus when blurring/refocusing the field so we only show the\n // focus ring on the virtually focused collection when are actually interacting with the Autocomplete\n let onBlur = (e: ReactFocusEvent) => {\n if (!e.isTrusted) {\n return;\n }\n\n let lastFocusedNode = queuedActiveDescendant.current ? document.getElementById(queuedActiveDescendant.current) : null;\n if (lastFocusedNode) {\n dispatchVirtualBlur(lastFocusedNode, e.relatedTarget);\n }\n };\n\n let onFocus = (e: ReactFocusEvent) => {\n if (!e.isTrusted) {\n return;\n }\n\n let curFocusedNode = queuedActiveDescendant.current ? document.getElementById(queuedActiveDescendant.current) : null;\n if (curFocusedNode) {\n let target = getEventTarget(e);\n queueMicrotask(() => {\n // instead of focusing the last focused node, just focus the collection instead and have the collection handle what item to focus via useSelectableCollection/Item\n dispatchVirtualBlur(target, collectionRef.current);\n dispatchVirtualFocus(collectionRef.current!, target);\n });\n }\n };\n\n // Clicking back into the input can happen after focus moved elsewhere in the dialog, while\n // virtual focus is still on an option. Clear virtual focus on pointer down so mouse\n // interactions restore the input state before the click's focus handling runs.\n // Touch is excluded because touch interactions should not move focus back to the input.\n let onPointerDown = (e: ReactPointerEvent) => {\n if (e.button !== 0 || e.pointerType === 'touch' || queuedActiveDescendant.current == null || inputRef.current == null) {\n return;\n }\n\n if (getEventTarget(e) === inputRef.current) {\n clearVirtualFocus();\n }\n };\n\n // Only apply the autocomplete specific behaviors if the collection component wrapped by it is actually\n // being filtered/allows filtering by the Autocomplete.\n let inputProps = {\n value: state.inputValue,\n onChange\n } as AriaTextFieldProps<FocusableElement>;\n\n let virtualFocusProps = {\n onKeyDown,\n 'aria-activedescendant': state.focusedNodeId ?? undefined,\n onBlur,\n onFocus,\n onPointerDown\n };\n\n if (hasCollection) {\n inputProps = {\n ...inputProps,\n ...(shouldUseVirtualFocus && virtualFocusProps),\n enterKeyHint: 'go',\n 'aria-controls': collectionId,\n // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)\n 'aria-autocomplete': 'list',\n // This disable's iOS's autocorrect suggestions, since the autocomplete provides its own suggestions.\n autoCorrect: 'off',\n // This disable's the macOS Safari spell check auto corrections.\n spellCheck: 'false',\n autoComplete: 'off'\n };\n }\n\n return {\n inputProps,\n collectionProps: mergeProps(collectionProps, {\n shouldUseVirtualFocus,\n disallowTypeAhead: shouldUseVirtualFocus\n }),\n collectionRef: mergedCollectionRef,\n filter: filter != null ? filterFn : undefined\n };\n}\n"],"names":[],"version":3,"file":"useAutocomplete.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;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AuB,OAAO,IACtD;QACJ,IAAI,gBAAgB;YAClB,IAAI,SAAS,CAAA,GAAA,yCAAa,EAAE;YAC5B,eAAe;gBACb,kKAAkK;gBAClK,CAAA,GAAA,yCAAkB,EAAE,QAAQ,cAAc,OAAO;gBACjD,CAAA,GAAA,yCAAmB,EAAE,cAAc,OAAO,EAAG;YAC/C;QACF;IACF;IAEA,2FAA2F;IAC3F,oFAAoF;IACpF,+EAA+E;IAC/E,wFAAwF;IACxF,IAAI,gBAAgB,CAAC;QACnB,IACE,EAAE,MAAM,KAAK,KACb,EAAE,WAAW,KAAK,WAClB,uBAAuB,OAAO,IAAI,QAClC,SAAS,OAAO,IAAI,MAEpB;QAGF,IAAI,CAAA,GAAA,yCAAa,EAAE,OAAO,SAAS,OAAO,EACxC;IAEJ;IAEA,uGAAuG;IACvG,uDAAuD;IACvD,IAAI,aAAa;QACf,OAAO,MAAM,UAAU;kBACvB;IACF;QAI2B;IAF3B,IAAI,oBAAoB;mBACtB;QACA,yBAAyB,CAAA,uBAAA,MAAM,aAAa,cAAnB,kCAAA,uBAAuB;gBAChD;iBACA;uBACA;IACF;IAEA,aAAa;QACX,GAAG,UAAU;QACb,GAAI,yBAAyB,iBAAiB,iBAAiB;QAC/D,cAAc;QACd,iBAAiB,gBAAgB,eAAe;QAChD,mFAAmF;QACnF,qBAAqB;QACrB,qGAAqG;QACrG,aAAa;QACb,gEAAgE;QAChE,YAAY;QACZ,cAAc;IAChB;IAEA,OAAO;oBACL;QACA,iBAAiB,CAAA,GAAA,yCAAS,EAAE,iBAAiB;mCAC3C;YACA,mBAAmB;YACnB,WAAW,mBAAmB,UAAU;QAC1C;QACA,eAAe;QACf,QAAQ,UAAU,OAAO,WAAW;IACtC;AACF","sources":["packages/react-aria/src/autocomplete/useAutocomplete.ts"],"sourcesContent":["/*\n * Copyright 2024 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 BaseEvent,\n DOMProps,\n FocusableElement,\n FocusEvents,\n KeyboardEvents,\n Node,\n RefObject,\n ValueBase\n} from '@react-types/shared';\nimport {AriaTextFieldProps} from '../textfield/useTextField';\nimport {\n AutocompleteProps,\n AutocompleteState\n} from 'react-stately/private/autocomplete/useAutocompleteState';\nimport {CLEAR_FOCUS_EVENT, FOCUS_EVENT} from '../utils/constants';\nimport {\n dispatchVirtualBlur,\n dispatchVirtualFocus,\n getVirtuallyFocusedElement,\n moveVirtualFocus\n} from '../focus/virtualFocus';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getInteractionModality, getPointerType} from '../interactions/useFocusVisible';\nimport {getOwnerDocument} from '../utils/domHelpers';\nimport intlMessages from '../../intl/autocomplete/*.json';\nimport {isAndroid, isIOS} from '../utils/platform';\nimport {isCtrlKeyPressed} from '../utils/keyboard';\nimport {mergeProps} from '../utils/mergeProps';\nimport {mergeRefs} from '../utils/mergeRefs';\nimport {\n FocusEvent as ReactFocusEvent,\n KeyboardEvent as ReactKeyboardEvent,\n PointerEvent as ReactPointerEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useEffectEvent} from '../utils/useEffectEvent';\nimport {useEvent} from '../utils/useEvent';\nimport {useId} from '../utils/useId';\nimport {useLabels} from '../utils/useLabels';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useObjectRef} from '../utils/useObjectRef';\n\nexport interface CollectionOptions extends DOMProps, AriaLabelingProps {\n /** Whether the collection items should use virtual focus instead of being focused directly. */\n shouldUseVirtualFocus: boolean;\n /** Whether typeahead is disabled. */\n disallowTypeAhead: boolean;\n}\n\nexport interface InputProps<T = FocusableElement>\n extends\n DOMProps,\n FocusEvents<T>,\n KeyboardEvents,\n Pick<ValueBase<string>, 'onChange' | 'value'>,\n Pick<\n AriaTextFieldProps,\n | 'enterKeyHint'\n | 'aria-controls'\n | 'aria-autocomplete'\n | 'aria-activedescendant'\n | 'spellCheck'\n | 'autoCorrect'\n | 'autoComplete'\n > {}\n\nexport interface AriaAutocompleteProps<T> extends AutocompleteProps {\n /**\n * An optional filter function used to determine if a option should be included in the\n * autocomplete list. Include this if the items you are providing to your wrapped collection\n * aren't filtered by default.\n */\n filter?: (textValue: string, inputValue: string, node: Node<T>) => boolean;\n\n /**\n * Whether or not to focus the first item in the collection after a filter is performed. Note this\n * is only applicable if virtual focus behavior is not turned off via `disableVirtualFocus`.\n *\n * @default false\n */\n disableAutoFocusFirst?: boolean;\n\n /**\n * Whether the autocomplete should disable virtual focus, instead making the wrapped collection\n * directly tabbable.\n *\n * @default false\n */\n disableVirtualFocus?: boolean;\n}\n\nexport interface AriaAutocompleteOptions<T> extends Omit<AriaAutocompleteProps<T>, 'children'> {\n /** The ref for the wrapped collection element. */\n inputRef: RefObject<HTMLInputElement | null>;\n /** The ref for the wrapped collection element. */\n collectionRef: RefObject<HTMLElement | null>;\n}\n\nexport interface AutocompleteAria<T> {\n /**\n * Props for the autocomplete input element. These should be passed to the input's aria hooks\n * (e.g. useTextField/useSearchField/etc) respectively.\n */\n inputProps: InputProps;\n /** Props for the collection, to be passed to collection's respective aria hook (e.g. useMenu). */\n collectionProps: CollectionOptions;\n /** Ref to attach to the wrapped collection. */\n collectionRef: RefObject<HTMLElement | null>;\n /**\n * A filter function that returns if the provided collection node should be filtered out of the\n * collection.\n */\n filter?: (nodeTextValue: string, node: Node<T>) => boolean;\n}\n\n/**\n * Provides the behavior and accessibility implementation for an autocomplete component. An\n * autocomplete combines a text input with a collection, allowing users to filter the collection's\n * contents match a query.\n *\n * @param props - Props for the autocomplete.\n * @param state - State for the autocomplete, as returned by `useAutocompleteState`.\n */\nexport function useAutocomplete<T>(\n props: AriaAutocompleteOptions<T>,\n state: AutocompleteState\n): AutocompleteAria<T> {\n let {\n inputRef,\n collectionRef,\n filter,\n disableAutoFocusFirst = false,\n disableVirtualFocus = false\n } = props;\n\n let collectionId = useId();\n let timeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n let delayNextActiveDescendant = useRef(false);\n let queuedActiveDescendant = useRef<string | null>(null);\n\n // For mobile screen readers, we don't want virtual focus, instead opting to disable FocusScope's restoreFocus and manually\n // moving focus back to the subtriggers\n let isMobileScreenReader = getInteractionModality() === 'virtual' && (isIOS() || isAndroid());\n let [shouldUseVirtualFocus, setShouldUseVirtualFocus] = useState(\n !isMobileScreenReader && !disableVirtualFocus\n );\n // Tracks if a collection has been connected to the autocomplete. If false, we don't want to add various attributes to the autocomplete input\n // since it isn't attached to a filterable collection (e.g. Tabs)\n let [hasCollection, setHasCollection] = useState(false);\n let [autoFocusOnMount, setAutoFocusOnMount] = useState(false);\n\n useEffect(() => {\n return () => clearTimeout(timeout.current);\n }, []);\n\n let updateActiveDescendantEvent = useEffectEvent((e: Event) => {\n // Ensure input is focused if the user clicks on the collection directly.\n // don't trigger on touch so that mobile keyboard doesnt appear when tapping on options\n if (\n !e.isTrusted &&\n shouldUseVirtualFocus &&\n inputRef.current &&\n getActiveElement(getOwnerDocument(inputRef.current)) !== inputRef.current &&\n getPointerType() !== 'touch'\n ) {\n inputRef.current.focus();\n }\n\n let target = getEventTarget(e) as Element | null;\n if (e.isTrusted || !target || queuedActiveDescendant.current === target.id) {\n return;\n }\n\n clearTimeout(timeout.current);\n if (target !== collectionRef.current) {\n if (delayNextActiveDescendant.current) {\n queuedActiveDescendant.current = target.id;\n timeout.current = setTimeout(() => {\n state.setFocusedNodeId(target.id);\n }, 500);\n } else {\n queuedActiveDescendant.current = target.id;\n state.setFocusedNodeId(target.id);\n }\n } else if (\n queuedActiveDescendant.current &&\n !document.getElementById(queuedActiveDescendant.current)\n ) {\n // If we recieve a focus event refocusing the collection, either we have newly refocused the input and are waiting for the\n // wrapped collection to refocus the previously focused node if any OR\n // we are in a state where we've filtered to such a point that there aren't any matching items in the collection to focus.\n // In this case we want to clear tracked item if any and clear active descendant\n queuedActiveDescendant.current = null;\n state.setFocusedNodeId(null);\n }\n\n delayNextActiveDescendant.current = false;\n });\n\n let [collectionNode, setCollectionNode] = useState<HTMLElement | null>(null);\n let callbackRef = useCallback(node => {\n setCollectionNode(node);\n if (node != null) {\n // If useSelectableCollection isn't passed shouldUseVirtualFocus even when useAutocomplete provides it\n // that means the collection doesn't support it (e.g. Table). If that is the case, we need to disable it here regardless\n // of what the user's provided so that the input doesn't recieve the onKeyDown and autocomplete props.\n if (node.getAttribute('tabindex') != null) {\n setShouldUseVirtualFocus(false);\n }\n setHasCollection(true);\n } else {\n setHasCollection(false);\n }\n }, []);\n useLayoutEffect(() => {\n if (collectionNode != null) {\n // When typing forward, we want to delay the setting of active descendant to not interrupt the native screen reader announcement\n // of the letter you just typed. If we recieve another focus event then we clear the queued update\n collectionNode.addEventListener('focusin', updateActiveDescendantEvent);\n }\n return () => {\n collectionNode?.removeEventListener('focusin', updateActiveDescendantEvent);\n };\n }, [collectionNode]);\n\n // Make sure to memo so that React doesn't keep registering a new event listeners on every rerender of the wrapped collection\n let mergedCollectionRef = useObjectRef(\n useMemo(() => mergeRefs(collectionRef, callbackRef), [collectionRef, callbackRef])\n );\n\n let focusFirstItem = useCallback(() => {\n if (!collectionRef.current) {\n setAutoFocusOnMount(true);\n return;\n }\n\n delayNextActiveDescendant.current = true;\n collectionRef.current?.dispatchEvent(\n new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: {\n focusStrategy: 'first'\n }\n })\n );\n }, [collectionRef]);\n\n let clearVirtualFocus = useCallback(\n (clearFocusKey?: boolean) => {\n setAutoFocusOnMount(false);\n moveVirtualFocus(getActiveElement());\n queuedActiveDescendant.current = null;\n state.setFocusedNodeId(null);\n let clearFocusEvent = new CustomEvent(CLEAR_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: {\n clearFocusKey\n }\n });\n clearTimeout(timeout.current);\n delayNextActiveDescendant.current = false;\n collectionRef.current?.dispatchEvent(clearFocusEvent);\n },\n [collectionRef, state]\n );\n\n let lastInputType = useRef('');\n useEvent(inputRef, 'beforeinput', e => {\n let {inputType} = e as InputEvent;\n lastInputType.current = inputType;\n });\n\n let onChange = (value: string) => {\n // Tell wrapped collection to focus the first element in the list when typing forward and to clear focused key when modifying the text via\n // copy paste/backspacing/undo/redo for screen reader announcements\n if (\n (lastInputType.current === 'insertText' ||\n // IME composition (e.g. CJK input) reports 'insertCompositionText'/'insertFromComposition'\n // instead of 'insertText'. Treat these as forward typing so the first item gets virtual focus.\n lastInputType.current === 'insertCompositionText' ||\n lastInputType.current === 'insertFromComposition') &&\n !disableAutoFocusFirst\n ) {\n focusFirstItem();\n } else if (\n lastInputType.current &&\n (lastInputType.current.includes('insert') ||\n lastInputType.current.includes('delete') ||\n lastInputType.current.includes('history'))\n ) {\n clearVirtualFocus(true);\n\n // If onChange was triggered before the timeout actually updated the activedescendant, we need to fire\n // our own dispatchVirtualFocus so focusVisible gets reapplied on the input\n if (getVirtuallyFocusedElement(document) === inputRef.current) {\n dispatchVirtualFocus(inputRef.current!, null);\n }\n }\n\n state.setInputValue(value);\n };\n\n let keyDownTarget = useRef<Element | null>(null);\n // For textfield specific keydown operations\n let onKeyDown = (e: BaseEvent<ReactKeyboardEvent<any>>) => {\n keyDownTarget.current = getEventTarget(e) as Element;\n if (e.nativeEvent.isComposing) {\n return;\n }\n\n let focusedNodeId = queuedActiveDescendant.current;\n if (\n focusedNodeId !== null &&\n getOwnerDocument(inputRef.current).getElementById(focusedNodeId) == null\n ) {\n // if the focused id doesn't exist in document, then we need to clear the tracked focused node, otherwise\n // we will be attempting to fire key events on a non-existing node instead of trying to focus the newly swapped wrapped collection.\n // This can happen if you are swapping out the Autocomplete wrapped collection component like in the docs search.\n queuedActiveDescendant.current = null;\n focusedNodeId = null;\n }\n\n switch (e.key) {\n case 'a':\n if (isCtrlKeyPressed(e)) {\n return;\n }\n break;\n case 'Escape':\n // Early return for Escape here so it doesn't leak the Escape event from the simulated collection event below and\n // close the dialog prematurely. Ideally that should be up to the discretion of the input element hence the check\n // for isPropagationStopped\n if (e.isDefaultPrevented()) {\n return;\n }\n break;\n case ' ':\n // Space shouldn't trigger onAction so early return.\n return;\n case 'Tab':\n // Don't propogate Tab down to the collection, otherwise we will try to focus the collection via useSelectableCollection's Tab handler (aka shift tab logic)\n // We want FocusScope to handle Tab if one exists (aka sub dialog), so special casepropogate\n if ('continuePropagation' in e) {\n e.continuePropagation();\n }\n return;\n case 'Home':\n case 'End':\n case 'PageDown':\n case 'PageUp':\n case 'ArrowUp':\n case 'ArrowDown':\n case 'ArrowRight':\n case 'ArrowLeft': {\n if ((e.key === 'Home' || e.key === 'End') && focusedNodeId == null && e.shiftKey) {\n return;\n }\n\n // If there is text within the input field, we'll want continue propagating events down\n // to the wrapped collection if there is a focused node so that a user can continue moving the\n // virtual focus. However, if the user doesn't have a focus in the collection, just move the text\n // cursor instead. They can move focus down into the collection via down/up arrow if need be\n if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {\n if (focusedNodeId == null) {\n if (!e.isPropagationStopped()) {\n e.stopPropagation();\n }\n return;\n }\n\n break;\n }\n\n // Prevent these keys from moving the text cursor in the input\n e.preventDefault();\n // Move virtual focus into the wrapped collection\n let focusCollection = new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true\n });\n\n collectionRef.current?.dispatchEvent(focusCollection);\n break;\n }\n }\n\n // Emulate the keyboard events that happen in the input field in the wrapped collection. This is for triggering things like onAction via Enter\n // or moving focus from one item to another. Stop propagation on the input event if it isn't already stopped so it doesn't leak out. For events\n // like ESC, the dispatched event below will bubble out of the collection and be stopped if handled by useSelectableCollection, otherwise will bubble\n // as expected\n if (!e.isPropagationStopped()) {\n e.stopPropagation();\n }\n\n let shouldPerformDefaultAction = true;\n if (collectionRef.current !== null) {\n if (focusedNodeId == null) {\n shouldPerformDefaultAction =\n collectionRef.current?.dispatchEvent(\n new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)\n ) || false;\n } else {\n let item = document.getElementById(focusedNodeId);\n if (item) {\n shouldPerformDefaultAction =\n item?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)) || false;\n }\n }\n }\n\n if (shouldPerformDefaultAction) {\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n // Clear the activedescendant so NVDA announcements aren't interrupted but retain the focused key in the collection so the\n // user's keyboard navigation restarts from where they left off\n clearVirtualFocus();\n break;\n }\n case 'Enter':\n // Trigger click action on item when Enter key was pressed.\n if (focusedNodeId != null) {\n let item = document.getElementById(focusedNodeId);\n item?.dispatchEvent(new PointerEvent('click', e.nativeEvent));\n }\n break;\n }\n } else {\n // TODO: check if we can do this, want to stop textArea from using its default Enter behavior so items are properly triggered\n e.preventDefault();\n }\n };\n\n let onKeyUpCapture = useEffectEvent(e => {\n // Dispatch simulated key up events for things like triggering links in listbox\n // Make sure to stop the propagation of the input keyup event so that the simulated keyup/down pair\n // is detected by usePress instead of the original keyup originating from the input\n if (getEventTarget(e) === keyDownTarget.current) {\n e.stopImmediatePropagation();\n let focusedNodeId = queuedActiveDescendant.current;\n if (focusedNodeId == null) {\n collectionRef.current?.dispatchEvent(new KeyboardEvent(e.type, e));\n } else {\n let item = document.getElementById(focusedNodeId);\n item?.dispatchEvent(new KeyboardEvent(e.type, e));\n }\n }\n });\n\n useEffect(() => {\n document.addEventListener('keyup', onKeyUpCapture, true);\n return () => {\n document.removeEventListener('keyup', onKeyUpCapture, true);\n };\n }, []);\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/autocomplete');\n let collectionProps = useLabels({\n id: collectionId,\n 'aria-label': stringFormatter.format('collectionLabel')\n });\n\n let filterFn = useCallback(\n (nodeTextValue: string, node: Node<T>) => {\n if (filter) {\n return filter(nodeTextValue, state.inputValue, node);\n }\n\n return true;\n },\n [state.inputValue, filter]\n );\n\n // Be sure to clear/restore the virtual + collection focus when blurring/refocusing the field so we only show the\n // focus ring on the virtually focused collection when are actually interacting with the Autocomplete\n let onBlur = (e: ReactFocusEvent) => {\n if (!e.isTrusted) {\n return;\n }\n\n let lastFocusedNode = queuedActiveDescendant.current\n ? document.getElementById(queuedActiveDescendant.current)\n : null;\n if (lastFocusedNode) {\n dispatchVirtualBlur(lastFocusedNode, e.relatedTarget);\n }\n };\n\n let onFocus = (e: ReactFocusEvent) => {\n if (!e.isTrusted) {\n return;\n }\n\n let curFocusedNode = queuedActiveDescendant.current\n ? document.getElementById(queuedActiveDescendant.current)\n : null;\n if (curFocusedNode) {\n let target = getEventTarget(e);\n queueMicrotask(() => {\n // instead of focusing the last focused node, just focus the collection instead and have the collection handle what item to focus via useSelectableCollection/Item\n dispatchVirtualBlur(target, collectionRef.current);\n dispatchVirtualFocus(collectionRef.current!, target);\n });\n }\n };\n\n // Clicking back into the input can happen after focus moved elsewhere in the dialog, while\n // virtual focus is still on an option. Clear virtual focus on pointer down so mouse\n // interactions restore the input state before the click's focus handling runs.\n // Touch is excluded because touch interactions should not move focus back to the input.\n let onPointerDown = (e: ReactPointerEvent) => {\n if (\n e.button !== 0 ||\n e.pointerType === 'touch' ||\n queuedActiveDescendant.current == null ||\n inputRef.current == null\n ) {\n return;\n }\n\n if (getEventTarget(e) === inputRef.current) {\n clearVirtualFocus();\n }\n };\n\n // Only apply the autocomplete specific behaviors if the collection component wrapped by it is actually\n // being filtered/allows filtering by the Autocomplete.\n let inputProps = {\n value: state.inputValue,\n onChange\n } as AriaTextFieldProps<FocusableElement>;\n\n let virtualFocusProps = {\n onKeyDown,\n 'aria-activedescendant': state.focusedNodeId ?? undefined,\n onBlur,\n onFocus,\n onPointerDown\n };\n\n inputProps = {\n ...inputProps,\n ...(shouldUseVirtualFocus && hasCollection && virtualFocusProps),\n enterKeyHint: 'go',\n 'aria-controls': hasCollection ? collectionId : undefined,\n // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)\n 'aria-autocomplete': 'list',\n // This disable's iOS's autocorrect suggestions, since the autocomplete provides its own suggestions.\n autoCorrect: 'off',\n // This disable's the macOS Safari spell check auto corrections.\n spellCheck: 'false',\n autoComplete: 'off'\n };\n\n return {\n inputProps,\n collectionProps: mergeProps(collectionProps, {\n shouldUseVirtualFocus,\n disallowTypeAhead: shouldUseVirtualFocus,\n autoFocus: autoFocusOnMount ? 'first' : false\n }),\n collectionRef: mergedCollectionRef,\n filter: filter != null ? filterFn : undefined\n };\n}\n"],"names":[],"version":3,"file":"useAutocomplete.js.map"}
|
|
@@ -62,6 +62,7 @@ function $134103e19bdfd846$export$1e40b3ca02d92d21(props, state) {
|
|
|
62
62
|
// Tracks if a collection has been connected to the autocomplete. If false, we don't want to add various attributes to the autocomplete input
|
|
63
63
|
// since it isn't attached to a filterable collection (e.g. Tabs)
|
|
64
64
|
let [hasCollection, setHasCollection] = (0, $7qCLe$useState)(false);
|
|
65
|
+
let [autoFocusOnMount, setAutoFocusOnMount] = (0, $7qCLe$useState)(false);
|
|
65
66
|
(0, $7qCLe$useEffect)(()=>{
|
|
66
67
|
return ()=>clearTimeout(timeout.current);
|
|
67
68
|
}, []);
|
|
@@ -119,6 +120,10 @@ function $134103e19bdfd846$export$1e40b3ca02d92d21(props, state) {
|
|
|
119
120
|
callbackRef
|
|
120
121
|
]));
|
|
121
122
|
let focusFirstItem = (0, $7qCLe$useCallback)(()=>{
|
|
123
|
+
if (!collectionRef.current) {
|
|
124
|
+
setAutoFocusOnMount(true);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
122
127
|
delayNextActiveDescendant.current = true;
|
|
123
128
|
collectionRef.current?.dispatchEvent(new CustomEvent((0, $8b2399d051d06d4c$export$831c820ad60f9d12), {
|
|
124
129
|
cancelable: true,
|
|
@@ -131,6 +136,7 @@ function $134103e19bdfd846$export$1e40b3ca02d92d21(props, state) {
|
|
|
131
136
|
collectionRef
|
|
132
137
|
]);
|
|
133
138
|
let clearVirtualFocus = (0, $7qCLe$useCallback)((clearFocusKey)=>{
|
|
139
|
+
setAutoFocusOnMount(false);
|
|
134
140
|
(0, $b72f3f7b3b5f42c6$export$76e4e37e5339496d)((0, $23f2114a1b82827e$export$cd4e5573fbe2b576)());
|
|
135
141
|
queuedActiveDescendant.current = null;
|
|
136
142
|
state.setFocusedNodeId(null);
|
|
@@ -149,14 +155,16 @@ function $134103e19bdfd846$export$1e40b3ca02d92d21(props, state) {
|
|
|
149
155
|
state
|
|
150
156
|
]);
|
|
151
157
|
let lastInputType = (0, $7qCLe$useRef)('');
|
|
152
|
-
(0, $600b3cf69ae46262$export$90fc3a17d93f704c)(inputRef, '
|
|
158
|
+
(0, $600b3cf69ae46262$export$90fc3a17d93f704c)(inputRef, 'beforeinput', (e)=>{
|
|
153
159
|
let { inputType: inputType } = e;
|
|
154
160
|
lastInputType.current = inputType;
|
|
155
161
|
});
|
|
156
162
|
let onChange = (value)=>{
|
|
157
163
|
// Tell wrapped collection to focus the first element in the list when typing forward and to clear focused key when modifying the text via
|
|
158
164
|
// copy paste/backspacing/undo/redo for screen reader announcements
|
|
159
|
-
if (lastInputType.current === 'insertText'
|
|
165
|
+
if ((lastInputType.current === 'insertText' || // IME composition (e.g. CJK input) reports 'insertCompositionText'/'insertFromComposition'
|
|
166
|
+
// instead of 'insertText'. Treat these as forward typing so the first item gets virtual focus.
|
|
167
|
+
lastInputType.current === 'insertCompositionText' || lastInputType.current === 'insertFromComposition') && !disableAutoFocusFirst) focusFirstItem();
|
|
160
168
|
else if (lastInputType.current && (lastInputType.current.includes('insert') || lastInputType.current.includes('delete') || lastInputType.current.includes('history'))) {
|
|
161
169
|
clearVirtualFocus(true);
|
|
162
170
|
// If onChange was triggered before the timeout actually updated the activedescendant, we need to fire
|
|
@@ -210,7 +218,7 @@ function $134103e19bdfd846$export$1e40b3ca02d92d21(props, state) {
|
|
|
210
218
|
// to the wrapped collection if there is a focused node so that a user can continue moving the
|
|
211
219
|
// virtual focus. However, if the user doesn't have a focus in the collection, just move the text
|
|
212
220
|
// cursor instead. They can move focus down into the collection via down/up arrow if need be
|
|
213
|
-
if (
|
|
221
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
214
222
|
if (focusedNodeId == null) {
|
|
215
223
|
if (!e.isPropagationStopped()) e.stopPropagation();
|
|
216
224
|
return;
|
|
@@ -331,11 +339,11 @@ function $134103e19bdfd846$export$1e40b3ca02d92d21(props, state) {
|
|
|
331
339
|
onFocus: onFocus,
|
|
332
340
|
onPointerDown: onPointerDown
|
|
333
341
|
};
|
|
334
|
-
|
|
342
|
+
inputProps = {
|
|
335
343
|
...inputProps,
|
|
336
|
-
...shouldUseVirtualFocus && virtualFocusProps,
|
|
344
|
+
...shouldUseVirtualFocus && hasCollection && virtualFocusProps,
|
|
337
345
|
enterKeyHint: 'go',
|
|
338
|
-
'aria-controls': collectionId,
|
|
346
|
+
'aria-controls': hasCollection ? collectionId : undefined,
|
|
339
347
|
// TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)
|
|
340
348
|
'aria-autocomplete': 'list',
|
|
341
349
|
// This disable's iOS's autocorrect suggestions, since the autocomplete provides its own suggestions.
|
|
@@ -348,7 +356,8 @@ function $134103e19bdfd846$export$1e40b3ca02d92d21(props, state) {
|
|
|
348
356
|
inputProps: inputProps,
|
|
349
357
|
collectionProps: (0, $bbaa08b3cd72f041$export$9d1611c77c2fe928)(collectionProps, {
|
|
350
358
|
shouldUseVirtualFocus: shouldUseVirtualFocus,
|
|
351
|
-
disallowTypeAhead: shouldUseVirtualFocus
|
|
359
|
+
disallowTypeAhead: shouldUseVirtualFocus,
|
|
360
|
+
autoFocus: autoFocusOnMount ? 'first' : false
|
|
352
361
|
}),
|
|
353
362
|
collectionRef: mergedCollectionRef,
|
|
354
363
|
filter: filter != null ? filterFn : undefined
|