react-aria 3.50.0 → 3.51.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/index.cjs +15 -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/utils/domHelpers.cjs +1 -0
- package/dist/exports/private/utils/domHelpers.cjs.map +1 -1
- package/dist/exports/private/utils/domHelpers.js +2 -2
- package/dist/exports/private/utils/domHelpers.js.map +1 -1
- package/dist/exports/private/utils/domHelpers.mjs +2 -2
- package/dist/exports/private/utils/domHelpers.mjs.map +1 -1
- package/dist/exports/private/utils/platform.cjs +1 -0
- package/dist/exports/private/utils/platform.cjs.map +1 -1
- package/dist/exports/private/utils/platform.js +2 -2
- package/dist/exports/private/utils/platform.js.map +1 -1
- package/dist/exports/private/utils/platform.mjs +2 -2
- package/dist/exports/private/utils/platform.mjs.map +1 -1
- package/dist/exports/private/utils/shadowdom/DOMFunctions.cjs +1 -0
- package/dist/exports/private/utils/shadowdom/DOMFunctions.cjs.map +1 -1
- package/dist/exports/private/utils/shadowdom/DOMFunctions.js +2 -2
- package/dist/exports/private/utils/shadowdom/DOMFunctions.js.map +1 -1
- package/dist/exports/private/utils/shadowdom/DOMFunctions.mjs +2 -2
- package/dist/exports/private/utils/shadowdom/DOMFunctions.mjs.map +1 -1
- package/dist/exports/useContextMenu.cjs +22 -0
- package/dist/exports/useContextMenu.cjs.map +1 -0
- package/dist/exports/useContextMenu.js +17 -0
- package/dist/exports/useContextMenu.js.map +1 -0
- package/dist/exports/useContextMenu.mjs +17 -0
- package/dist/exports/useContextMenu.mjs.map +1 -0
- package/dist/exports/usePreviewTrigger.cjs +22 -0
- package/dist/exports/usePreviewTrigger.cjs.map +1 -0
- package/dist/exports/usePreviewTrigger.js +17 -0
- package/dist/exports/usePreviewTrigger.js.map +1 -0
- package/dist/exports/usePreviewTrigger.mjs +17 -0
- package/dist/exports/usePreviewTrigger.mjs.map +1 -0
- package/dist/exports/useTokenField.cjs +27 -0
- package/dist/exports/useTokenField.cjs.map +1 -0
- package/dist/exports/useTokenField.js +19 -0
- package/dist/exports/useTokenField.js.map +1 -0
- package/dist/exports/useTokenField.mjs +19 -0
- package/dist/exports/useTokenField.mjs.map +1 -0
- package/dist/private/actiongroup/useActionGroup.cjs +24 -19
- package/dist/private/actiongroup/useActionGroup.cjs.map +1 -1
- package/dist/private/actiongroup/useActionGroup.js +24 -19
- package/dist/private/actiongroup/useActionGroup.js.map +1 -1
- package/dist/private/actiongroup/useActionGroup.mjs +24 -19
- package/dist/private/actiongroup/useActionGroup.mjs.map +1 -1
- package/dist/private/autocomplete/useAutocomplete.cjs +2 -1
- package/dist/private/autocomplete/useAutocomplete.cjs.map +1 -1
- package/dist/private/autocomplete/useAutocomplete.js +2 -1
- package/dist/private/autocomplete/useAutocomplete.js.map +1 -1
- package/dist/private/autocomplete/useAutocomplete.mjs +2 -1
- package/dist/private/autocomplete/useAutocomplete.mjs.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbItem.cjs +2 -0
- package/dist/private/breadcrumbs/useBreadcrumbItem.cjs.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbItem.js +2 -0
- package/dist/private/breadcrumbs/useBreadcrumbItem.js.map +1 -1
- package/dist/private/breadcrumbs/useBreadcrumbItem.mjs +2 -0
- package/dist/private/breadcrumbs/useBreadcrumbItem.mjs.map +1 -1
- package/dist/private/button/useButton.cjs +2 -1
- package/dist/private/button/useButton.cjs.map +1 -1
- package/dist/private/button/useButton.js +2 -1
- package/dist/private/button/useButton.js.map +1 -1
- package/dist/private/button/useButton.mjs +2 -1
- package/dist/private/button/useButton.mjs.map +1 -1
- package/dist/private/button/useToggleButtonGroup.cjs +3 -0
- package/dist/private/button/useToggleButtonGroup.cjs.map +1 -1
- package/dist/private/button/useToggleButtonGroup.js +3 -0
- package/dist/private/button/useToggleButtonGroup.js.map +1 -1
- package/dist/private/button/useToggleButtonGroup.mjs +3 -0
- package/dist/private/button/useToggleButtonGroup.mjs.map +1 -1
- package/dist/private/calendar/useCalendarCell.cjs +3 -0
- package/dist/private/calendar/useCalendarCell.cjs.map +1 -1
- package/dist/private/calendar/useCalendarCell.js +3 -0
- package/dist/private/calendar/useCalendarCell.js.map +1 -1
- package/dist/private/calendar/useCalendarCell.mjs +3 -0
- package/dist/private/calendar/useCalendarCell.mjs.map +1 -1
- package/dist/private/calendar/useCalendarGrid.cjs +47 -52
- package/dist/private/calendar/useCalendarGrid.cjs.map +1 -1
- package/dist/private/calendar/useCalendarGrid.js +47 -52
- package/dist/private/calendar/useCalendarGrid.js.map +1 -1
- package/dist/private/calendar/useCalendarGrid.mjs +47 -52
- package/dist/private/calendar/useCalendarGrid.mjs.map +1 -1
- package/dist/private/calendar/useRangeCalendar.cjs +1 -0
- package/dist/private/calendar/useRangeCalendar.cjs.map +1 -1
- package/dist/private/calendar/useRangeCalendar.js +1 -0
- package/dist/private/calendar/useRangeCalendar.js.map +1 -1
- package/dist/private/calendar/useRangeCalendar.mjs +1 -0
- package/dist/private/calendar/useRangeCalendar.mjs.map +1 -1
- package/dist/private/collections/CollectionBuilder.cjs +8 -3
- package/dist/private/collections/CollectionBuilder.cjs.map +1 -1
- package/dist/private/collections/CollectionBuilder.js +8 -3
- package/dist/private/collections/CollectionBuilder.js.map +1 -1
- package/dist/private/collections/CollectionBuilder.mjs +8 -3
- package/dist/private/collections/CollectionBuilder.mjs.map +1 -1
- package/dist/private/collections/Document.cjs +4 -0
- package/dist/private/collections/Document.cjs.map +1 -1
- package/dist/private/collections/Document.js +4 -0
- package/dist/private/collections/Document.js.map +1 -1
- package/dist/private/collections/Document.mjs +4 -0
- package/dist/private/collections/Document.mjs.map +1 -1
- package/dist/private/collections/Hidden.cjs +1 -0
- package/dist/private/collections/Hidden.cjs.map +1 -1
- package/dist/private/collections/Hidden.js +1 -0
- package/dist/private/collections/Hidden.js.map +1 -1
- package/dist/private/collections/Hidden.mjs +1 -0
- package/dist/private/collections/Hidden.mjs.map +1 -1
- package/dist/private/collections/useCachedChildren.cjs +1 -0
- package/dist/private/collections/useCachedChildren.cjs.map +1 -1
- package/dist/private/collections/useCachedChildren.js +1 -0
- package/dist/private/collections/useCachedChildren.js.map +1 -1
- package/dist/private/collections/useCachedChildren.mjs +1 -0
- package/dist/private/collections/useCachedChildren.mjs.map +1 -1
- package/dist/private/color/useColorArea.cjs +31 -34
- package/dist/private/color/useColorArea.cjs.map +1 -1
- package/dist/private/color/useColorArea.js +31 -34
- package/dist/private/color/useColorArea.js.map +1 -1
- package/dist/private/color/useColorArea.mjs +31 -34
- package/dist/private/color/useColorArea.mjs.map +1 -1
- package/dist/private/color/useColorSlider.cjs +4 -2
- package/dist/private/color/useColorSlider.cjs.map +1 -1
- package/dist/private/color/useColorSlider.js +4 -2
- package/dist/private/color/useColorSlider.js.map +1 -1
- package/dist/private/color/useColorSlider.mjs +4 -2
- package/dist/private/color/useColorSlider.mjs.map +1 -1
- package/dist/private/color/useColorWheel.cjs +16 -23
- package/dist/private/color/useColorWheel.cjs.map +1 -1
- package/dist/private/color/useColorWheel.js +16 -23
- package/dist/private/color/useColorWheel.js.map +1 -1
- package/dist/private/color/useColorWheel.mjs +16 -23
- package/dist/private/color/useColorWheel.mjs.map +1 -1
- package/dist/private/combobox/useComboBox.cjs +92 -29
- package/dist/private/combobox/useComboBox.cjs.map +1 -1
- package/dist/private/combobox/useComboBox.js +93 -29
- package/dist/private/combobox/useComboBox.js.map +1 -1
- package/dist/private/combobox/useComboBox.mjs +92 -29
- package/dist/private/combobox/useComboBox.mjs.map +1 -1
- package/dist/private/datepicker/useDateField.cjs +3 -6
- package/dist/private/datepicker/useDateField.cjs.map +1 -1
- package/dist/private/datepicker/useDateField.js +3 -6
- package/dist/private/datepicker/useDateField.js.map +1 -1
- package/dist/private/datepicker/useDateField.mjs +3 -6
- package/dist/private/datepicker/useDateField.mjs.map +1 -1
- package/dist/private/datepicker/useDatePickerGroup.cjs +48 -27
- package/dist/private/datepicker/useDatePickerGroup.cjs.map +1 -1
- package/dist/private/datepicker/useDatePickerGroup.js +49 -28
- package/dist/private/datepicker/useDatePickerGroup.js.map +1 -1
- package/dist/private/datepicker/useDatePickerGroup.mjs +49 -28
- package/dist/private/datepicker/useDatePickerGroup.mjs.map +1 -1
- package/dist/private/datepicker/useDateSegment.cjs +21 -16
- package/dist/private/datepicker/useDateSegment.cjs.map +1 -1
- package/dist/private/datepicker/useDateSegment.js +22 -17
- package/dist/private/datepicker/useDateSegment.js.map +1 -1
- package/dist/private/datepicker/useDateSegment.mjs +22 -17
- package/dist/private/datepicker/useDateSegment.mjs.map +1 -1
- package/dist/private/dialog/useDialog.cjs +8 -1
- package/dist/private/dialog/useDialog.cjs.map +1 -1
- package/dist/private/dialog/useDialog.js +10 -1
- package/dist/private/dialog/useDialog.js.map +1 -1
- package/dist/private/dialog/useDialog.mjs +8 -1
- package/dist/private/dialog/useDialog.mjs.map +1 -1
- package/dist/private/dnd/DragManager.cjs +3 -1
- package/dist/private/dnd/DragManager.cjs.map +1 -1
- package/dist/private/dnd/DragManager.js +3 -1
- package/dist/private/dnd/DragManager.js.map +1 -1
- package/dist/private/dnd/DragManager.mjs +3 -1
- package/dist/private/dnd/DragManager.mjs.map +1 -1
- package/dist/private/dnd/useAutoScroll.cjs +3 -1
- package/dist/private/dnd/useAutoScroll.cjs.map +1 -1
- package/dist/private/dnd/useAutoScroll.js +3 -1
- package/dist/private/dnd/useAutoScroll.js.map +1 -1
- package/dist/private/dnd/useAutoScroll.mjs +3 -1
- package/dist/private/dnd/useAutoScroll.mjs.map +1 -1
- package/dist/private/dnd/useDrag.cjs +4 -1
- package/dist/private/dnd/useDrag.cjs.map +1 -1
- package/dist/private/dnd/useDrag.js +4 -1
- package/dist/private/dnd/useDrag.js.map +1 -1
- package/dist/private/dnd/useDrag.mjs +4 -1
- package/dist/private/dnd/useDrag.mjs.map +1 -1
- package/dist/private/dnd/useDraggableItem.cjs +4 -0
- package/dist/private/dnd/useDraggableItem.cjs.map +1 -1
- package/dist/private/dnd/useDraggableItem.js +4 -0
- package/dist/private/dnd/useDraggableItem.js.map +1 -1
- package/dist/private/dnd/useDraggableItem.mjs +4 -0
- package/dist/private/dnd/useDraggableItem.mjs.map +1 -1
- package/dist/private/dnd/useDroppableCollection.cjs +4 -0
- package/dist/private/dnd/useDroppableCollection.cjs.map +1 -1
- package/dist/private/dnd/useDroppableCollection.js +4 -0
- package/dist/private/dnd/useDroppableCollection.js.map +1 -1
- package/dist/private/dnd/useDroppableCollection.mjs +4 -0
- package/dist/private/dnd/useDroppableCollection.mjs.map +1 -1
- package/dist/private/focus/FocusScope.cjs +5 -3
- package/dist/private/focus/FocusScope.cjs.map +1 -1
- package/dist/private/focus/FocusScope.js +5 -4
- package/dist/private/focus/FocusScope.js.map +1 -1
- package/dist/private/focus/FocusScope.mjs +5 -3
- package/dist/private/focus/FocusScope.mjs.map +1 -1
- package/dist/private/focus/useFocusRing.cjs +2 -1
- package/dist/private/focus/useFocusRing.cjs.map +1 -1
- package/dist/private/focus/useFocusRing.js +2 -1
- package/dist/private/focus/useFocusRing.js.map +1 -1
- package/dist/private/focus/useFocusRing.mjs +2 -1
- package/dist/private/focus/useFocusRing.mjs.map +1 -1
- package/dist/private/form/useFormValidation.cjs +6 -0
- package/dist/private/form/useFormValidation.cjs.map +1 -1
- package/dist/private/form/useFormValidation.js +6 -0
- package/dist/private/form/useFormValidation.js.map +1 -1
- package/dist/private/form/useFormValidation.mjs +6 -0
- package/dist/private/form/useFormValidation.mjs.map +1 -1
- package/dist/private/grid/useGrid.cjs +3 -2
- package/dist/private/grid/useGrid.cjs.map +1 -1
- package/dist/private/grid/useGrid.js +3 -2
- package/dist/private/grid/useGrid.js.map +1 -1
- package/dist/private/grid/useGrid.mjs +3 -2
- package/dist/private/grid/useGrid.mjs.map +1 -1
- package/dist/private/grid/useGridCell.cjs +44 -8
- package/dist/private/grid/useGridCell.cjs.map +1 -1
- package/dist/private/grid/useGridCell.js +44 -8
- package/dist/private/grid/useGridCell.js.map +1 -1
- package/dist/private/grid/useGridCell.mjs +44 -8
- package/dist/private/grid/useGridCell.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/useGridListItem.cjs +38 -30
- package/dist/private/gridlist/useGridListItem.cjs.map +1 -1
- package/dist/private/gridlist/useGridListItem.js +38 -30
- package/dist/private/gridlist/useGridListItem.js.map +1 -1
- package/dist/private/gridlist/useGridListItem.mjs +38 -30
- package/dist/private/gridlist/useGridListItem.mjs.map +1 -1
- package/dist/private/interactions/PressResponder.cjs +1 -0
- package/dist/private/interactions/PressResponder.cjs.map +1 -1
- package/dist/private/interactions/PressResponder.js +1 -0
- package/dist/private/interactions/PressResponder.js.map +1 -1
- package/dist/private/interactions/PressResponder.mjs +1 -0
- package/dist/private/interactions/PressResponder.mjs.map +1 -1
- package/dist/private/interactions/Pressable.cjs +1 -0
- package/dist/private/interactions/Pressable.cjs.map +1 -1
- package/dist/private/interactions/Pressable.js +1 -0
- package/dist/private/interactions/Pressable.js.map +1 -1
- package/dist/private/interactions/Pressable.mjs +1 -0
- package/dist/private/interactions/Pressable.mjs.map +1 -1
- package/dist/private/interactions/createEventHandler.cjs +3 -2
- package/dist/private/interactions/createEventHandler.cjs.map +1 -1
- package/dist/private/interactions/createEventHandler.js +3 -2
- package/dist/private/interactions/createEventHandler.js.map +1 -1
- package/dist/private/interactions/createEventHandler.mjs +3 -2
- package/dist/private/interactions/createEventHandler.mjs.map +1 -1
- package/dist/private/interactions/createKeyboardShortcutHandler.cjs +130 -0
- package/dist/private/interactions/createKeyboardShortcutHandler.cjs.map +1 -0
- package/dist/private/interactions/createKeyboardShortcutHandler.js +125 -0
- package/dist/private/interactions/createKeyboardShortcutHandler.js.map +1 -0
- package/dist/private/interactions/createKeyboardShortcutHandler.mjs +125 -0
- package/dist/private/interactions/createKeyboardShortcutHandler.mjs.map +1 -0
- package/dist/private/interactions/textSelection.cjs +2 -2
- package/dist/private/interactions/textSelection.cjs.map +1 -1
- package/dist/private/interactions/textSelection.js +3 -3
- package/dist/private/interactions/textSelection.js.map +1 -1
- package/dist/private/interactions/textSelection.mjs +3 -3
- package/dist/private/interactions/textSelection.mjs.map +1 -1
- package/dist/private/interactions/useContextMenu.cjs +104 -0
- package/dist/private/interactions/useContextMenu.cjs.map +1 -0
- package/dist/private/interactions/useContextMenu.js +99 -0
- package/dist/private/interactions/useContextMenu.js.map +1 -0
- package/dist/private/interactions/useContextMenu.mjs +99 -0
- package/dist/private/interactions/useContextMenu.mjs.map +1 -0
- package/dist/private/interactions/useFocusVisible.cjs +2 -2
- package/dist/private/interactions/useFocusVisible.cjs.map +1 -1
- package/dist/private/interactions/useFocusVisible.js +2 -2
- package/dist/private/interactions/useFocusVisible.js.map +1 -1
- package/dist/private/interactions/useFocusVisible.mjs +2 -2
- package/dist/private/interactions/useFocusVisible.mjs.map +1 -1
- package/dist/private/interactions/useFocusable.cjs +1 -0
- package/dist/private/interactions/useFocusable.cjs.map +1 -1
- package/dist/private/interactions/useFocusable.js +1 -0
- package/dist/private/interactions/useFocusable.js.map +1 -1
- package/dist/private/interactions/useFocusable.mjs +1 -0
- package/dist/private/interactions/useFocusable.mjs.map +1 -1
- package/dist/private/interactions/useHover.cjs +2 -1
- package/dist/private/interactions/useHover.cjs.map +1 -1
- package/dist/private/interactions/useHover.js +2 -1
- package/dist/private/interactions/useHover.js.map +1 -1
- package/dist/private/interactions/useHover.mjs +2 -1
- package/dist/private/interactions/useHover.mjs.map +1 -1
- package/dist/private/interactions/useKeyboard.cjs +46 -2
- package/dist/private/interactions/useKeyboard.cjs.map +1 -1
- package/dist/private/interactions/useKeyboard.js +48 -2
- package/dist/private/interactions/useKeyboard.js.map +1 -1
- package/dist/private/interactions/useKeyboard.mjs +46 -2
- package/dist/private/interactions/useKeyboard.mjs.map +1 -1
- package/dist/private/interactions/useLongPress.cjs +22 -22
- package/dist/private/interactions/useLongPress.cjs.map +1 -1
- package/dist/private/interactions/useLongPress.js +22 -22
- package/dist/private/interactions/useLongPress.js.map +1 -1
- package/dist/private/interactions/useLongPress.mjs +22 -22
- package/dist/private/interactions/useLongPress.mjs.map +1 -1
- package/dist/private/interactions/useMove.cjs +1 -8
- package/dist/private/interactions/useMove.cjs.map +1 -1
- package/dist/private/interactions/useMove.js +1 -8
- package/dist/private/interactions/useMove.js.map +1 -1
- package/dist/private/interactions/useMove.mjs +1 -8
- package/dist/private/interactions/useMove.mjs.map +1 -1
- package/dist/private/interactions/usePress.cjs +18 -33
- package/dist/private/interactions/usePress.cjs.map +1 -1
- package/dist/private/interactions/usePress.js +18 -33
- package/dist/private/interactions/usePress.js.map +1 -1
- package/dist/private/interactions/usePress.mjs +18 -33
- package/dist/private/interactions/usePress.mjs.map +1 -1
- package/dist/private/interactions/utils.cjs +10 -10
- package/dist/private/interactions/utils.cjs.map +1 -1
- package/dist/private/interactions/utils.js +10 -10
- package/dist/private/interactions/utils.js.map +1 -1
- package/dist/private/interactions/utils.mjs +10 -10
- package/dist/private/interactions/utils.mjs.map +1 -1
- package/dist/private/intl/combobox/fi-FI.cjs +5 -5
- package/dist/private/intl/combobox/fi-FI.cjs.map +1 -1
- package/dist/private/intl/combobox/fi-FI.js +5 -5
- package/dist/private/intl/combobox/fi-FI.js.map +1 -1
- package/dist/private/intl/combobox/fi-FI.mjs +5 -5
- package/dist/private/intl/combobox/fi-FI.mjs.map +1 -1
- package/dist/private/intl/previewtrigger/ar-AE.cjs +6 -0
- package/dist/private/intl/previewtrigger/ar-AE.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/ar-AE.js +8 -0
- package/dist/private/intl/previewtrigger/ar-AE.js.map +1 -0
- package/dist/private/intl/previewtrigger/ar-AE.mjs +8 -0
- package/dist/private/intl/previewtrigger/ar-AE.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/bg-BG.cjs +6 -0
- package/dist/private/intl/previewtrigger/bg-BG.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/bg-BG.js +8 -0
- package/dist/private/intl/previewtrigger/bg-BG.js.map +1 -0
- package/dist/private/intl/previewtrigger/bg-BG.mjs +8 -0
- package/dist/private/intl/previewtrigger/bg-BG.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/cs-CZ.cjs +6 -0
- package/dist/private/intl/previewtrigger/cs-CZ.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/cs-CZ.js +8 -0
- package/dist/private/intl/previewtrigger/cs-CZ.js.map +1 -0
- package/dist/private/intl/previewtrigger/cs-CZ.mjs +8 -0
- package/dist/private/intl/previewtrigger/cs-CZ.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/da-DK.cjs +6 -0
- package/dist/private/intl/previewtrigger/da-DK.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/da-DK.js +8 -0
- package/dist/private/intl/previewtrigger/da-DK.js.map +1 -0
- package/dist/private/intl/previewtrigger/da-DK.mjs +8 -0
- package/dist/private/intl/previewtrigger/da-DK.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/de-DE.cjs +6 -0
- package/dist/private/intl/previewtrigger/de-DE.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/de-DE.js +8 -0
- package/dist/private/intl/previewtrigger/de-DE.js.map +1 -0
- package/dist/private/intl/previewtrigger/de-DE.mjs +8 -0
- package/dist/private/intl/previewtrigger/de-DE.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/el-GR.cjs +6 -0
- package/dist/private/intl/previewtrigger/el-GR.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/el-GR.js +8 -0
- package/dist/private/intl/previewtrigger/el-GR.js.map +1 -0
- package/dist/private/intl/previewtrigger/el-GR.mjs +8 -0
- package/dist/private/intl/previewtrigger/el-GR.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/en-US.cjs +6 -0
- package/dist/private/intl/previewtrigger/en-US.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/en-US.js +8 -0
- package/dist/private/intl/previewtrigger/en-US.js.map +1 -0
- package/dist/private/intl/previewtrigger/en-US.mjs +8 -0
- package/dist/private/intl/previewtrigger/en-US.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/es-ES.cjs +6 -0
- package/dist/private/intl/previewtrigger/es-ES.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/es-ES.js +8 -0
- package/dist/private/intl/previewtrigger/es-ES.js.map +1 -0
- package/dist/private/intl/previewtrigger/es-ES.mjs +8 -0
- package/dist/private/intl/previewtrigger/es-ES.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/et-EE.cjs +6 -0
- package/dist/private/intl/previewtrigger/et-EE.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/et-EE.js +8 -0
- package/dist/private/intl/previewtrigger/et-EE.js.map +1 -0
- package/dist/private/intl/previewtrigger/et-EE.mjs +8 -0
- package/dist/private/intl/previewtrigger/et-EE.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/fi-FI.cjs +6 -0
- package/dist/private/intl/previewtrigger/fi-FI.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/fi-FI.js +8 -0
- package/dist/private/intl/previewtrigger/fi-FI.js.map +1 -0
- package/dist/private/intl/previewtrigger/fi-FI.mjs +8 -0
- package/dist/private/intl/previewtrigger/fi-FI.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/fr-FR.cjs +6 -0
- package/dist/private/intl/previewtrigger/fr-FR.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/fr-FR.js +8 -0
- package/dist/private/intl/previewtrigger/fr-FR.js.map +1 -0
- package/dist/private/intl/previewtrigger/fr-FR.mjs +8 -0
- package/dist/private/intl/previewtrigger/fr-FR.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/he-IL.cjs +6 -0
- package/dist/private/intl/previewtrigger/he-IL.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/he-IL.js +8 -0
- package/dist/private/intl/previewtrigger/he-IL.js.map +1 -0
- package/dist/private/intl/previewtrigger/he-IL.mjs +8 -0
- package/dist/private/intl/previewtrigger/he-IL.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/hr-HR.cjs +6 -0
- package/dist/private/intl/previewtrigger/hr-HR.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/hr-HR.js +8 -0
- package/dist/private/intl/previewtrigger/hr-HR.js.map +1 -0
- package/dist/private/intl/previewtrigger/hr-HR.mjs +8 -0
- package/dist/private/intl/previewtrigger/hr-HR.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/hu-HU.cjs +6 -0
- package/dist/private/intl/previewtrigger/hu-HU.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/hu-HU.js +8 -0
- package/dist/private/intl/previewtrigger/hu-HU.js.map +1 -0
- package/dist/private/intl/previewtrigger/hu-HU.mjs +8 -0
- package/dist/private/intl/previewtrigger/hu-HU.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/it-IT.cjs +6 -0
- package/dist/private/intl/previewtrigger/it-IT.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/it-IT.js +8 -0
- package/dist/private/intl/previewtrigger/it-IT.js.map +1 -0
- package/dist/private/intl/previewtrigger/it-IT.mjs +8 -0
- package/dist/private/intl/previewtrigger/it-IT.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/ja-JP.cjs +6 -0
- package/dist/private/intl/previewtrigger/ja-JP.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/ja-JP.js +8 -0
- package/dist/private/intl/previewtrigger/ja-JP.js.map +1 -0
- package/dist/private/intl/previewtrigger/ja-JP.mjs +8 -0
- package/dist/private/intl/previewtrigger/ja-JP.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/ko-KR.cjs +6 -0
- package/dist/private/intl/previewtrigger/ko-KR.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/ko-KR.js +8 -0
- package/dist/private/intl/previewtrigger/ko-KR.js.map +1 -0
- package/dist/private/intl/previewtrigger/ko-KR.mjs +8 -0
- package/dist/private/intl/previewtrigger/ko-KR.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/lt-LT.cjs +6 -0
- package/dist/private/intl/previewtrigger/lt-LT.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/lt-LT.js +8 -0
- package/dist/private/intl/previewtrigger/lt-LT.js.map +1 -0
- package/dist/private/intl/previewtrigger/lt-LT.mjs +8 -0
- package/dist/private/intl/previewtrigger/lt-LT.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/lv-LV.cjs +6 -0
- package/dist/private/intl/previewtrigger/lv-LV.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/lv-LV.js +8 -0
- package/dist/private/intl/previewtrigger/lv-LV.js.map +1 -0
- package/dist/private/intl/previewtrigger/lv-LV.mjs +8 -0
- package/dist/private/intl/previewtrigger/lv-LV.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/nb-NO.cjs +6 -0
- package/dist/private/intl/previewtrigger/nb-NO.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/nb-NO.js +8 -0
- package/dist/private/intl/previewtrigger/nb-NO.js.map +1 -0
- package/dist/private/intl/previewtrigger/nb-NO.mjs +8 -0
- package/dist/private/intl/previewtrigger/nb-NO.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/nl-NL.cjs +6 -0
- package/dist/private/intl/previewtrigger/nl-NL.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/nl-NL.js +8 -0
- package/dist/private/intl/previewtrigger/nl-NL.js.map +1 -0
- package/dist/private/intl/previewtrigger/nl-NL.mjs +8 -0
- package/dist/private/intl/previewtrigger/nl-NL.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/pl-PL.cjs +6 -0
- package/dist/private/intl/previewtrigger/pl-PL.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/pl-PL.js +8 -0
- package/dist/private/intl/previewtrigger/pl-PL.js.map +1 -0
- package/dist/private/intl/previewtrigger/pl-PL.mjs +8 -0
- package/dist/private/intl/previewtrigger/pl-PL.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/pt-BR.cjs +6 -0
- package/dist/private/intl/previewtrigger/pt-BR.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/pt-BR.js +8 -0
- package/dist/private/intl/previewtrigger/pt-BR.js.map +1 -0
- package/dist/private/intl/previewtrigger/pt-BR.mjs +8 -0
- package/dist/private/intl/previewtrigger/pt-BR.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/pt-PT.cjs +6 -0
- package/dist/private/intl/previewtrigger/pt-PT.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/pt-PT.js +8 -0
- package/dist/private/intl/previewtrigger/pt-PT.js.map +1 -0
- package/dist/private/intl/previewtrigger/pt-PT.mjs +8 -0
- package/dist/private/intl/previewtrigger/pt-PT.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/ro-RO.cjs +6 -0
- package/dist/private/intl/previewtrigger/ro-RO.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/ro-RO.js +8 -0
- package/dist/private/intl/previewtrigger/ro-RO.js.map +1 -0
- package/dist/private/intl/previewtrigger/ro-RO.mjs +8 -0
- package/dist/private/intl/previewtrigger/ro-RO.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/ru-RU.cjs +6 -0
- package/dist/private/intl/previewtrigger/ru-RU.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/ru-RU.js +8 -0
- package/dist/private/intl/previewtrigger/ru-RU.js.map +1 -0
- package/dist/private/intl/previewtrigger/ru-RU.mjs +8 -0
- package/dist/private/intl/previewtrigger/ru-RU.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/sk-SK.cjs +6 -0
- package/dist/private/intl/previewtrigger/sk-SK.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/sk-SK.js +8 -0
- package/dist/private/intl/previewtrigger/sk-SK.js.map +1 -0
- package/dist/private/intl/previewtrigger/sk-SK.mjs +8 -0
- package/dist/private/intl/previewtrigger/sk-SK.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/sl-SI.cjs +6 -0
- package/dist/private/intl/previewtrigger/sl-SI.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/sl-SI.js +8 -0
- package/dist/private/intl/previewtrigger/sl-SI.js.map +1 -0
- package/dist/private/intl/previewtrigger/sl-SI.mjs +8 -0
- package/dist/private/intl/previewtrigger/sl-SI.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/sr-SP.cjs +6 -0
- package/dist/private/intl/previewtrigger/sr-SP.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/sr-SP.js +8 -0
- package/dist/private/intl/previewtrigger/sr-SP.js.map +1 -0
- package/dist/private/intl/previewtrigger/sr-SP.mjs +8 -0
- package/dist/private/intl/previewtrigger/sr-SP.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/sv-SE.cjs +6 -0
- package/dist/private/intl/previewtrigger/sv-SE.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/sv-SE.js +8 -0
- package/dist/private/intl/previewtrigger/sv-SE.js.map +1 -0
- package/dist/private/intl/previewtrigger/sv-SE.mjs +8 -0
- package/dist/private/intl/previewtrigger/sv-SE.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/tr-TR.cjs +6 -0
- package/dist/private/intl/previewtrigger/tr-TR.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/tr-TR.js +8 -0
- package/dist/private/intl/previewtrigger/tr-TR.js.map +1 -0
- package/dist/private/intl/previewtrigger/tr-TR.mjs +8 -0
- package/dist/private/intl/previewtrigger/tr-TR.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/uk-UA.cjs +6 -0
- package/dist/private/intl/previewtrigger/uk-UA.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/uk-UA.js +8 -0
- package/dist/private/intl/previewtrigger/uk-UA.js.map +1 -0
- package/dist/private/intl/previewtrigger/uk-UA.mjs +8 -0
- package/dist/private/intl/previewtrigger/uk-UA.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/zh-CN.cjs +6 -0
- package/dist/private/intl/previewtrigger/zh-CN.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/zh-CN.js +8 -0
- package/dist/private/intl/previewtrigger/zh-CN.js.map +1 -0
- package/dist/private/intl/previewtrigger/zh-CN.mjs +8 -0
- package/dist/private/intl/previewtrigger/zh-CN.mjs.map +1 -0
- package/dist/private/intl/previewtrigger/zh-TW.cjs +6 -0
- package/dist/private/intl/previewtrigger/zh-TW.cjs.map +1 -0
- package/dist/private/intl/previewtrigger/zh-TW.js +8 -0
- package/dist/private/intl/previewtrigger/zh-TW.js.map +1 -0
- package/dist/private/intl/previewtrigger/zh-TW.mjs +8 -0
- package/dist/private/intl/previewtrigger/zh-TW.mjs.map +1 -0
- package/dist/private/intl/table/ar-AE.cjs +3 -3
- package/dist/private/intl/table/ar-AE.cjs.map +1 -1
- package/dist/private/intl/table/ar-AE.js +3 -3
- package/dist/private/intl/table/ar-AE.js.map +1 -1
- package/dist/private/intl/table/ar-AE.mjs +3 -3
- package/dist/private/intl/table/ar-AE.mjs.map +1 -1
- package/dist/private/intl/table/bg-BG.cjs +3 -3
- package/dist/private/intl/table/bg-BG.cjs.map +1 -1
- package/dist/private/intl/table/bg-BG.js +3 -3
- package/dist/private/intl/table/bg-BG.js.map +1 -1
- package/dist/private/intl/table/bg-BG.mjs +3 -3
- package/dist/private/intl/table/bg-BG.mjs.map +1 -1
- package/dist/private/intl/table/cs-CZ.cjs +3 -3
- package/dist/private/intl/table/cs-CZ.cjs.map +1 -1
- package/dist/private/intl/table/cs-CZ.js +3 -3
- package/dist/private/intl/table/cs-CZ.js.map +1 -1
- package/dist/private/intl/table/cs-CZ.mjs +3 -3
- package/dist/private/intl/table/cs-CZ.mjs.map +1 -1
- package/dist/private/intl/table/da-DK.cjs +3 -3
- package/dist/private/intl/table/da-DK.cjs.map +1 -1
- package/dist/private/intl/table/da-DK.js +3 -3
- package/dist/private/intl/table/da-DK.js.map +1 -1
- package/dist/private/intl/table/da-DK.mjs +3 -3
- package/dist/private/intl/table/da-DK.mjs.map +1 -1
- package/dist/private/intl/table/de-DE.cjs +3 -3
- package/dist/private/intl/table/de-DE.cjs.map +1 -1
- package/dist/private/intl/table/de-DE.js +3 -3
- package/dist/private/intl/table/de-DE.js.map +1 -1
- package/dist/private/intl/table/de-DE.mjs +3 -3
- package/dist/private/intl/table/de-DE.mjs.map +1 -1
- package/dist/private/intl/table/el-GR.cjs +3 -3
- package/dist/private/intl/table/el-GR.cjs.map +1 -1
- package/dist/private/intl/table/el-GR.js +3 -3
- package/dist/private/intl/table/el-GR.js.map +1 -1
- package/dist/private/intl/table/el-GR.mjs +3 -3
- package/dist/private/intl/table/el-GR.mjs.map +1 -1
- package/dist/private/intl/table/es-ES.cjs +3 -3
- package/dist/private/intl/table/es-ES.cjs.map +1 -1
- package/dist/private/intl/table/es-ES.js +3 -3
- package/dist/private/intl/table/es-ES.js.map +1 -1
- package/dist/private/intl/table/es-ES.mjs +3 -3
- package/dist/private/intl/table/es-ES.mjs.map +1 -1
- package/dist/private/intl/table/et-EE.cjs +3 -3
- package/dist/private/intl/table/et-EE.cjs.map +1 -1
- package/dist/private/intl/table/et-EE.js +3 -3
- package/dist/private/intl/table/et-EE.js.map +1 -1
- package/dist/private/intl/table/et-EE.mjs +3 -3
- package/dist/private/intl/table/et-EE.mjs.map +1 -1
- package/dist/private/intl/table/fi-FI.cjs +3 -3
- package/dist/private/intl/table/fi-FI.cjs.map +1 -1
- package/dist/private/intl/table/fi-FI.js +3 -3
- package/dist/private/intl/table/fi-FI.js.map +1 -1
- package/dist/private/intl/table/fi-FI.mjs +3 -3
- package/dist/private/intl/table/fi-FI.mjs.map +1 -1
- package/dist/private/intl/table/fr-FR.cjs +3 -3
- package/dist/private/intl/table/fr-FR.cjs.map +1 -1
- package/dist/private/intl/table/fr-FR.js +3 -3
- package/dist/private/intl/table/fr-FR.js.map +1 -1
- package/dist/private/intl/table/fr-FR.mjs +3 -3
- package/dist/private/intl/table/fr-FR.mjs.map +1 -1
- package/dist/private/intl/table/he-IL.cjs +3 -3
- package/dist/private/intl/table/he-IL.cjs.map +1 -1
- package/dist/private/intl/table/he-IL.js +3 -3
- package/dist/private/intl/table/he-IL.js.map +1 -1
- package/dist/private/intl/table/he-IL.mjs +3 -3
- package/dist/private/intl/table/he-IL.mjs.map +1 -1
- package/dist/private/intl/table/hr-HR.cjs +3 -3
- package/dist/private/intl/table/hr-HR.cjs.map +1 -1
- package/dist/private/intl/table/hr-HR.js +3 -3
- package/dist/private/intl/table/hr-HR.js.map +1 -1
- package/dist/private/intl/table/hr-HR.mjs +3 -3
- package/dist/private/intl/table/hr-HR.mjs.map +1 -1
- package/dist/private/intl/table/hu-HU.cjs +3 -3
- package/dist/private/intl/table/hu-HU.cjs.map +1 -1
- package/dist/private/intl/table/hu-HU.js +3 -3
- package/dist/private/intl/table/hu-HU.js.map +1 -1
- package/dist/private/intl/table/hu-HU.mjs +3 -3
- package/dist/private/intl/table/hu-HU.mjs.map +1 -1
- package/dist/private/intl/table/it-IT.cjs +3 -3
- package/dist/private/intl/table/it-IT.cjs.map +1 -1
- package/dist/private/intl/table/it-IT.js +3 -3
- package/dist/private/intl/table/it-IT.js.map +1 -1
- package/dist/private/intl/table/it-IT.mjs +3 -3
- package/dist/private/intl/table/it-IT.mjs.map +1 -1
- package/dist/private/intl/table/ja-JP.cjs +3 -3
- package/dist/private/intl/table/ja-JP.cjs.map +1 -1
- package/dist/private/intl/table/ja-JP.js +3 -3
- package/dist/private/intl/table/ja-JP.js.map +1 -1
- package/dist/private/intl/table/ja-JP.mjs +3 -3
- package/dist/private/intl/table/ja-JP.mjs.map +1 -1
- package/dist/private/intl/table/ko-KR.cjs +3 -3
- package/dist/private/intl/table/ko-KR.cjs.map +1 -1
- package/dist/private/intl/table/ko-KR.js +3 -3
- package/dist/private/intl/table/ko-KR.js.map +1 -1
- package/dist/private/intl/table/ko-KR.mjs +3 -3
- package/dist/private/intl/table/ko-KR.mjs.map +1 -1
- package/dist/private/intl/table/lt-LT.cjs +3 -3
- package/dist/private/intl/table/lt-LT.cjs.map +1 -1
- package/dist/private/intl/table/lt-LT.js +3 -3
- package/dist/private/intl/table/lt-LT.js.map +1 -1
- package/dist/private/intl/table/lt-LT.mjs +3 -3
- package/dist/private/intl/table/lt-LT.mjs.map +1 -1
- package/dist/private/intl/table/lv-LV.cjs +3 -3
- package/dist/private/intl/table/lv-LV.cjs.map +1 -1
- package/dist/private/intl/table/lv-LV.js +3 -3
- package/dist/private/intl/table/lv-LV.js.map +1 -1
- package/dist/private/intl/table/lv-LV.mjs +3 -3
- package/dist/private/intl/table/lv-LV.mjs.map +1 -1
- package/dist/private/intl/table/nb-NO.cjs +3 -3
- package/dist/private/intl/table/nb-NO.cjs.map +1 -1
- package/dist/private/intl/table/nb-NO.js +3 -3
- package/dist/private/intl/table/nb-NO.js.map +1 -1
- package/dist/private/intl/table/nb-NO.mjs +3 -3
- package/dist/private/intl/table/nb-NO.mjs.map +1 -1
- package/dist/private/intl/table/nl-NL.cjs +3 -3
- package/dist/private/intl/table/nl-NL.cjs.map +1 -1
- package/dist/private/intl/table/nl-NL.js +3 -3
- package/dist/private/intl/table/nl-NL.js.map +1 -1
- package/dist/private/intl/table/nl-NL.mjs +3 -3
- package/dist/private/intl/table/nl-NL.mjs.map +1 -1
- package/dist/private/intl/table/pl-PL.cjs +3 -3
- package/dist/private/intl/table/pl-PL.cjs.map +1 -1
- package/dist/private/intl/table/pl-PL.js +3 -3
- package/dist/private/intl/table/pl-PL.js.map +1 -1
- package/dist/private/intl/table/pl-PL.mjs +3 -3
- package/dist/private/intl/table/pl-PL.mjs.map +1 -1
- package/dist/private/intl/table/pt-BR.cjs +3 -3
- package/dist/private/intl/table/pt-BR.cjs.map +1 -1
- package/dist/private/intl/table/pt-BR.js +3 -3
- package/dist/private/intl/table/pt-BR.js.map +1 -1
- package/dist/private/intl/table/pt-BR.mjs +3 -3
- package/dist/private/intl/table/pt-BR.mjs.map +1 -1
- package/dist/private/intl/table/pt-PT.cjs +3 -3
- package/dist/private/intl/table/pt-PT.cjs.map +1 -1
- package/dist/private/intl/table/pt-PT.js +3 -3
- package/dist/private/intl/table/pt-PT.js.map +1 -1
- package/dist/private/intl/table/pt-PT.mjs +3 -3
- package/dist/private/intl/table/pt-PT.mjs.map +1 -1
- package/dist/private/intl/table/ro-RO.cjs +3 -3
- package/dist/private/intl/table/ro-RO.cjs.map +1 -1
- package/dist/private/intl/table/ro-RO.js +3 -3
- package/dist/private/intl/table/ro-RO.js.map +1 -1
- package/dist/private/intl/table/ro-RO.mjs +3 -3
- package/dist/private/intl/table/ro-RO.mjs.map +1 -1
- package/dist/private/intl/table/ru-RU.cjs +3 -3
- package/dist/private/intl/table/ru-RU.cjs.map +1 -1
- package/dist/private/intl/table/ru-RU.js +3 -3
- package/dist/private/intl/table/ru-RU.js.map +1 -1
- package/dist/private/intl/table/ru-RU.mjs +3 -3
- package/dist/private/intl/table/ru-RU.mjs.map +1 -1
- package/dist/private/intl/table/sk-SK.cjs +3 -3
- package/dist/private/intl/table/sk-SK.cjs.map +1 -1
- package/dist/private/intl/table/sk-SK.js +3 -3
- package/dist/private/intl/table/sk-SK.js.map +1 -1
- package/dist/private/intl/table/sk-SK.mjs +3 -3
- package/dist/private/intl/table/sk-SK.mjs.map +1 -1
- package/dist/private/intl/table/sl-SI.cjs +3 -3
- package/dist/private/intl/table/sl-SI.cjs.map +1 -1
- package/dist/private/intl/table/sl-SI.js +3 -3
- package/dist/private/intl/table/sl-SI.js.map +1 -1
- package/dist/private/intl/table/sl-SI.mjs +3 -3
- package/dist/private/intl/table/sl-SI.mjs.map +1 -1
- package/dist/private/intl/table/sr-SP.cjs +3 -3
- package/dist/private/intl/table/sr-SP.cjs.map +1 -1
- package/dist/private/intl/table/sr-SP.js +3 -3
- package/dist/private/intl/table/sr-SP.js.map +1 -1
- package/dist/private/intl/table/sr-SP.mjs +3 -3
- package/dist/private/intl/table/sr-SP.mjs.map +1 -1
- package/dist/private/intl/table/sv-SE.cjs +3 -3
- package/dist/private/intl/table/sv-SE.cjs.map +1 -1
- package/dist/private/intl/table/sv-SE.js +3 -3
- package/dist/private/intl/table/sv-SE.js.map +1 -1
- package/dist/private/intl/table/sv-SE.mjs +3 -3
- package/dist/private/intl/table/sv-SE.mjs.map +1 -1
- package/dist/private/intl/table/tr-TR.cjs +3 -3
- package/dist/private/intl/table/tr-TR.cjs.map +1 -1
- package/dist/private/intl/table/tr-TR.js +3 -3
- package/dist/private/intl/table/tr-TR.js.map +1 -1
- package/dist/private/intl/table/tr-TR.mjs +3 -3
- package/dist/private/intl/table/tr-TR.mjs.map +1 -1
- package/dist/private/intl/table/uk-UA.cjs +3 -3
- package/dist/private/intl/table/uk-UA.cjs.map +1 -1
- package/dist/private/intl/table/uk-UA.js +3 -3
- package/dist/private/intl/table/uk-UA.js.map +1 -1
- package/dist/private/intl/table/uk-UA.mjs +3 -3
- package/dist/private/intl/table/uk-UA.mjs.map +1 -1
- package/dist/private/intl/table/zh-CN.cjs +4 -4
- package/dist/private/intl/table/zh-CN.cjs.map +1 -1
- package/dist/private/intl/table/zh-CN.js +4 -4
- package/dist/private/intl/table/zh-CN.js.map +1 -1
- package/dist/private/intl/table/zh-CN.mjs +4 -4
- package/dist/private/intl/table/zh-CN.mjs.map +1 -1
- package/dist/private/intl/table/zh-TW.cjs +3 -3
- package/dist/private/intl/table/zh-TW.cjs.map +1 -1
- package/dist/private/intl/table/zh-TW.js +3 -3
- package/dist/private/intl/table/zh-TW.js.map +1 -1
- package/dist/private/intl/table/zh-TW.mjs +3 -3
- package/dist/private/intl/table/zh-TW.mjs.map +1 -1
- package/dist/private/intl/tree/es-ES.cjs +1 -1
- package/dist/private/intl/tree/es-ES.cjs.map +1 -1
- package/dist/private/intl/tree/es-ES.js +1 -1
- package/dist/private/intl/tree/es-ES.js.map +1 -1
- package/dist/private/intl/tree/es-ES.mjs +1 -1
- package/dist/private/intl/tree/es-ES.mjs.map +1 -1
- package/dist/private/link/useLink.cjs +2 -1
- package/dist/private/link/useLink.cjs.map +1 -1
- package/dist/private/link/useLink.js +2 -1
- package/dist/private/link/useLink.js.map +1 -1
- package/dist/private/link/useLink.mjs +2 -1
- package/dist/private/link/useLink.mjs.map +1 -1
- package/dist/private/menu/useMenuItem.cjs +33 -33
- package/dist/private/menu/useMenuItem.cjs.map +1 -1
- package/dist/private/menu/useMenuItem.js +33 -33
- package/dist/private/menu/useMenuItem.js.map +1 -1
- package/dist/private/menu/useMenuItem.mjs +33 -33
- package/dist/private/menu/useMenuItem.mjs.map +1 -1
- package/dist/private/menu/useMenuTrigger.cjs +96 -30
- package/dist/private/menu/useMenuTrigger.cjs.map +1 -1
- package/dist/private/menu/useMenuTrigger.js +96 -30
- package/dist/private/menu/useMenuTrigger.js.map +1 -1
- package/dist/private/menu/useMenuTrigger.mjs +96 -30
- package/dist/private/menu/useMenuTrigger.mjs.map +1 -1
- package/dist/private/menu/useSubmenuTrigger.cjs +44 -36
- package/dist/private/menu/useSubmenuTrigger.cjs.map +1 -1
- package/dist/private/menu/useSubmenuTrigger.js +44 -36
- package/dist/private/menu/useSubmenuTrigger.js.map +1 -1
- package/dist/private/menu/useSubmenuTrigger.mjs +44 -36
- package/dist/private/menu/useSubmenuTrigger.mjs.map +1 -1
- package/dist/private/numberfield/useNumberField.cjs +24 -19
- package/dist/private/numberfield/useNumberField.cjs.map +1 -1
- package/dist/private/numberfield/useNumberField.js +24 -19
- package/dist/private/numberfield/useNumberField.js.map +1 -1
- package/dist/private/numberfield/useNumberField.mjs +24 -19
- package/dist/private/numberfield/useNumberField.mjs.map +1 -1
- package/dist/private/overlays/Overlay.cjs +5 -1
- package/dist/private/overlays/Overlay.cjs.map +1 -1
- package/dist/private/overlays/Overlay.js +5 -1
- package/dist/private/overlays/Overlay.js.map +1 -1
- package/dist/private/overlays/Overlay.mjs +5 -1
- package/dist/private/overlays/Overlay.mjs.map +1 -1
- package/dist/private/overlays/ariaHideOutside.cjs +12 -8
- package/dist/private/overlays/ariaHideOutside.cjs.map +1 -1
- package/dist/private/overlays/ariaHideOutside.js +13 -9
- package/dist/private/overlays/ariaHideOutside.js.map +1 -1
- package/dist/private/overlays/ariaHideOutside.mjs +13 -9
- package/dist/private/overlays/ariaHideOutside.mjs.map +1 -1
- package/dist/private/overlays/useCloseOnScroll.cjs +3 -4
- package/dist/private/overlays/useCloseOnScroll.cjs.map +1 -1
- package/dist/private/overlays/useCloseOnScroll.js +4 -5
- package/dist/private/overlays/useCloseOnScroll.js.map +1 -1
- package/dist/private/overlays/useCloseOnScroll.mjs +4 -5
- package/dist/private/overlays/useCloseOnScroll.mjs.map +1 -1
- package/dist/private/overlays/useOverlay.cjs +13 -7
- package/dist/private/overlays/useOverlay.cjs.map +1 -1
- package/dist/private/overlays/useOverlay.js +13 -7
- package/dist/private/overlays/useOverlay.js.map +1 -1
- package/dist/private/overlays/useOverlay.mjs +13 -7
- package/dist/private/overlays/useOverlay.mjs.map +1 -1
- package/dist/private/overlays/useOverlayPosition.cjs +6 -0
- package/dist/private/overlays/useOverlayPosition.cjs.map +1 -1
- package/dist/private/overlays/useOverlayPosition.js +6 -0
- package/dist/private/overlays/useOverlayPosition.js.map +1 -1
- package/dist/private/overlays/useOverlayPosition.mjs +6 -0
- package/dist/private/overlays/useOverlayPosition.mjs.map +1 -1
- package/dist/private/overlays/usePopover.cjs +6 -2
- package/dist/private/overlays/usePopover.cjs.map +1 -1
- package/dist/private/overlays/usePopover.js +7 -2
- package/dist/private/overlays/usePopover.js.map +1 -1
- package/dist/private/overlays/usePopover.mjs +6 -2
- package/dist/private/overlays/usePopover.mjs.map +1 -1
- package/dist/private/overlays/usePreventScroll.cjs +2 -5
- package/dist/private/overlays/usePreventScroll.cjs.map +1 -1
- package/dist/private/overlays/usePreventScroll.js +3 -6
- package/dist/private/overlays/usePreventScroll.js.map +1 -1
- package/dist/private/overlays/usePreventScroll.mjs +3 -6
- package/dist/private/overlays/usePreventScroll.mjs.map +1 -1
- package/dist/private/progress/useProgressBar.cjs +2 -1
- package/dist/private/progress/useProgressBar.cjs.map +1 -1
- package/dist/private/progress/useProgressBar.js +2 -1
- package/dist/private/progress/useProgressBar.js.map +1 -1
- package/dist/private/progress/useProgressBar.mjs +2 -1
- package/dist/private/progress/useProgressBar.mjs.map +1 -1
- package/dist/private/radio/useRadioGroup.cjs +26 -23
- package/dist/private/radio/useRadioGroup.cjs.map +1 -1
- package/dist/private/radio/useRadioGroup.js +26 -23
- package/dist/private/radio/useRadioGroup.js.map +1 -1
- package/dist/private/radio/useRadioGroup.mjs +26 -23
- package/dist/private/radio/useRadioGroup.mjs.map +1 -1
- package/dist/private/searchfield/useSearchField.cjs +28 -22
- package/dist/private/searchfield/useSearchField.cjs.map +1 -1
- package/dist/private/searchfield/useSearchField.js +28 -22
- package/dist/private/searchfield/useSearchField.js.map +1 -1
- package/dist/private/searchfield/useSearchField.mjs +28 -22
- package/dist/private/searchfield/useSearchField.mjs.map +1 -1
- package/dist/private/select/useSelect.cjs +21 -23
- package/dist/private/select/useSelect.cjs.map +1 -1
- package/dist/private/select/useSelect.js +23 -25
- package/dist/private/select/useSelect.js.map +1 -1
- package/dist/private/select/useSelect.mjs +21 -23
- package/dist/private/select/useSelect.mjs.map +1 -1
- package/dist/private/selection/useSelectableCollection.cjs +203 -146
- package/dist/private/selection/useSelectableCollection.cjs.map +1 -1
- package/dist/private/selection/useSelectableCollection.js +207 -150
- package/dist/private/selection/useSelectableCollection.js.map +1 -1
- package/dist/private/selection/useSelectableCollection.mjs +203 -146
- package/dist/private/selection/useSelectableCollection.mjs.map +1 -1
- package/dist/private/selection/useSelectableItem.cjs +58 -13
- package/dist/private/selection/useSelectableItem.cjs.map +1 -1
- package/dist/private/selection/useSelectableItem.js +58 -13
- package/dist/private/selection/useSelectableItem.js.map +1 -1
- package/dist/private/selection/useSelectableItem.mjs +58 -13
- package/dist/private/selection/useSelectableItem.mjs.map +1 -1
- package/dist/private/slider/useSlider.cjs.map +1 -1
- package/dist/private/slider/useSlider.js.map +1 -1
- package/dist/private/slider/useSlider.mjs.map +1 -1
- package/dist/private/slider/useSliderThumb.cjs +28 -26
- package/dist/private/slider/useSliderThumb.cjs.map +1 -1
- package/dist/private/slider/useSliderThumb.js +28 -26
- package/dist/private/slider/useSliderThumb.js.map +1 -1
- package/dist/private/slider/useSliderThumb.mjs +28 -26
- package/dist/private/slider/useSliderThumb.mjs.map +1 -1
- package/dist/private/spinbutton/useSpinButton.cjs +49 -34
- package/dist/private/spinbutton/useSpinButton.cjs.map +1 -1
- package/dist/private/spinbutton/useSpinButton.js +49 -34
- package/dist/private/spinbutton/useSpinButton.js.map +1 -1
- package/dist/private/spinbutton/useSpinButton.mjs +49 -34
- package/dist/private/spinbutton/useSpinButton.mjs.map +1 -1
- package/dist/private/ssr/SSRProvider.cjs +12 -3
- package/dist/private/ssr/SSRProvider.cjs.map +1 -1
- package/dist/private/ssr/SSRProvider.js +12 -3
- package/dist/private/ssr/SSRProvider.js.map +1 -1
- package/dist/private/ssr/SSRProvider.mjs +12 -3
- package/dist/private/ssr/SSRProvider.mjs.map +1 -1
- package/dist/private/steplist/useStepListItem.cjs +0 -9
- package/dist/private/steplist/useStepListItem.cjs.map +1 -1
- package/dist/private/steplist/useStepListItem.js +0 -10
- package/dist/private/steplist/useStepListItem.js.map +1 -1
- package/dist/private/steplist/useStepListItem.mjs +0 -9
- package/dist/private/steplist/useStepListItem.mjs.map +1 -1
- package/dist/private/table/useTable.cjs +4 -2
- package/dist/private/table/useTable.cjs.map +1 -1
- package/dist/private/table/useTable.js +4 -2
- package/dist/private/table/useTable.js.map +1 -1
- package/dist/private/table/useTable.mjs +4 -2
- package/dist/private/table/useTable.mjs.map +1 -1
- package/dist/private/table/useTableCell.cjs +2 -0
- package/dist/private/table/useTableCell.cjs.map +1 -1
- package/dist/private/table/useTableCell.js +2 -0
- package/dist/private/table/useTableCell.js.map +1 -1
- package/dist/private/table/useTableCell.mjs +2 -0
- package/dist/private/table/useTableCell.mjs.map +1 -1
- package/dist/private/table/useTableColumnHeader.cjs +2 -3
- package/dist/private/table/useTableColumnHeader.cjs.map +1 -1
- package/dist/private/table/useTableColumnHeader.js +2 -3
- package/dist/private/table/useTableColumnHeader.js.map +1 -1
- package/dist/private/table/useTableColumnHeader.mjs +2 -3
- package/dist/private/table/useTableColumnHeader.mjs.map +1 -1
- package/dist/private/table/useTableColumnResize.cjs +32 -14
- package/dist/private/table/useTableColumnResize.cjs.map +1 -1
- package/dist/private/table/useTableColumnResize.js +33 -15
- package/dist/private/table/useTableColumnResize.js.map +1 -1
- package/dist/private/table/useTableColumnResize.mjs +33 -15
- package/dist/private/table/useTableColumnResize.mjs.map +1 -1
- package/dist/private/table/useTableRow.cjs +4 -2
- package/dist/private/table/useTableRow.cjs.map +1 -1
- package/dist/private/table/useTableRow.js +4 -2
- package/dist/private/table/useTableRow.js.map +1 -1
- package/dist/private/table/useTableRow.mjs +4 -2
- package/dist/private/table/useTableRow.mjs.map +1 -1
- package/dist/private/tag/useTag.cjs +21 -11
- package/dist/private/tag/useTag.cjs.map +1 -1
- package/dist/private/tag/useTag.js +21 -11
- package/dist/private/tag/useTag.js.map +1 -1
- package/dist/private/tag/useTag.mjs +21 -11
- package/dist/private/tag/useTag.mjs.map +1 -1
- package/dist/private/textfield/useFormattedTextField.cjs +1 -0
- package/dist/private/textfield/useFormattedTextField.cjs.map +1 -1
- package/dist/private/textfield/useFormattedTextField.js +1 -0
- package/dist/private/textfield/useFormattedTextField.js.map +1 -1
- package/dist/private/textfield/useFormattedTextField.mjs +1 -0
- package/dist/private/textfield/useFormattedTextField.mjs.map +1 -1
- package/dist/private/toast/useToastRegion.cjs +5 -0
- package/dist/private/toast/useToastRegion.cjs.map +1 -1
- package/dist/private/toast/useToastRegion.js +5 -0
- package/dist/private/toast/useToastRegion.js.map +1 -1
- package/dist/private/toast/useToastRegion.mjs +5 -0
- package/dist/private/toast/useToastRegion.mjs.map +1 -1
- package/dist/private/toggle/useToggle.cjs +1 -0
- package/dist/private/toggle/useToggle.cjs.map +1 -1
- package/dist/private/toggle/useToggle.js +1 -0
- package/dist/private/toggle/useToggle.js.map +1 -1
- package/dist/private/toggle/useToggle.mjs +1 -0
- package/dist/private/toggle/useToggle.mjs.map +1 -1
- package/dist/private/tokenfield/useToken.cjs +46 -0
- package/dist/private/tokenfield/useToken.cjs.map +1 -0
- package/dist/private/tokenfield/useToken.js +41 -0
- package/dist/private/tokenfield/useToken.js.map +1 -0
- package/dist/private/tokenfield/useToken.mjs +41 -0
- package/dist/private/tokenfield/useToken.mjs.map +1 -0
- package/dist/private/tokenfield/useTokenField.cjs +587 -0
- package/dist/private/tokenfield/useTokenField.cjs.map +1 -0
- package/dist/private/tokenfield/useTokenField.js +590 -0
- package/dist/private/tokenfield/useTokenField.js.map +1 -0
- package/dist/private/tokenfield/useTokenField.mjs +579 -0
- package/dist/private/tokenfield/useTokenField.mjs.map +1 -0
- package/dist/private/toolbar/useToolbar.cjs +1 -0
- package/dist/private/toolbar/useToolbar.cjs.map +1 -1
- package/dist/private/toolbar/useToolbar.js +1 -0
- package/dist/private/toolbar/useToolbar.js.map +1 -1
- package/dist/private/toolbar/useToolbar.mjs +1 -0
- package/dist/private/toolbar/useToolbar.mjs.map +1 -1
- package/dist/private/tooltip/intlStrings.cjs +108 -0
- package/dist/private/tooltip/intlStrings.cjs.map +1 -0
- package/dist/private/tooltip/intlStrings.js +110 -0
- package/dist/private/tooltip/intlStrings.js.map +1 -0
- package/dist/private/tooltip/intlStrings.mjs +110 -0
- package/dist/private/tooltip/intlStrings.mjs.map +1 -0
- package/dist/private/tooltip/usePreviewTrigger.cjs +212 -0
- package/dist/private/tooltip/usePreviewTrigger.cjs.map +1 -0
- package/dist/private/tooltip/usePreviewTrigger.js +208 -0
- package/dist/private/tooltip/usePreviewTrigger.js.map +1 -0
- package/dist/private/tooltip/usePreviewTrigger.mjs +207 -0
- package/dist/private/tooltip/usePreviewTrigger.mjs.map +1 -0
- package/dist/private/tooltip/useSafeArea.cjs +134 -0
- package/dist/private/tooltip/useSafeArea.cjs.map +1 -0
- package/dist/private/tooltip/useSafeArea.js +130 -0
- package/dist/private/tooltip/useSafeArea.js.map +1 -0
- package/dist/private/tooltip/useSafeArea.mjs +129 -0
- package/dist/private/tooltip/useSafeArea.mjs.map +1 -0
- package/dist/private/tooltip/useTooltipTrigger.cjs +1 -0
- package/dist/private/tooltip/useTooltipTrigger.cjs.map +1 -1
- package/dist/private/tooltip/useTooltipTrigger.js +1 -0
- package/dist/private/tooltip/useTooltipTrigger.js.map +1 -1
- package/dist/private/tooltip/useTooltipTrigger.mjs +1 -0
- package/dist/private/tooltip/useTooltipTrigger.mjs.map +1 -1
- package/dist/private/tree/useTree.cjs +1 -0
- package/dist/private/tree/useTree.cjs.map +1 -1
- package/dist/private/tree/useTree.js +1 -0
- package/dist/private/tree/useTree.js.map +1 -1
- package/dist/private/tree/useTree.mjs +1 -0
- package/dist/private/tree/useTree.mjs.map +1 -1
- package/dist/private/utils/domHelpers.cjs +43 -12
- package/dist/private/utils/domHelpers.cjs.map +1 -1
- package/dist/private/utils/domHelpers.js +45 -14
- package/dist/private/utils/domHelpers.js.map +1 -1
- package/dist/private/utils/domHelpers.mjs +43 -13
- package/dist/private/utils/domHelpers.mjs.map +1 -1
- package/dist/private/utils/isVirtualEvent.cjs +1 -1
- package/dist/private/utils/isVirtualEvent.cjs.map +1 -1
- package/dist/private/utils/isVirtualEvent.js +1 -1
- package/dist/private/utils/isVirtualEvent.js.map +1 -1
- package/dist/private/utils/isVirtualEvent.mjs +1 -1
- package/dist/private/utils/isVirtualEvent.mjs.map +1 -1
- package/dist/private/utils/openLink.cjs +4 -2
- package/dist/private/utils/openLink.cjs.map +1 -1
- package/dist/private/utils/openLink.js +4 -2
- package/dist/private/utils/openLink.js.map +1 -1
- package/dist/private/utils/openLink.mjs +4 -2
- package/dist/private/utils/openLink.mjs.map +1 -1
- package/dist/private/utils/platform.cjs +8 -4
- package/dist/private/utils/platform.cjs.map +1 -1
- package/dist/private/utils/platform.js +7 -4
- package/dist/private/utils/platform.js.map +1 -1
- package/dist/private/utils/platform.mjs +7 -4
- package/dist/private/utils/platform.mjs.map +1 -1
- package/dist/private/utils/scrollIntoView.cjs +3 -3
- package/dist/private/utils/scrollIntoView.cjs.map +1 -1
- package/dist/private/utils/scrollIntoView.js +4 -4
- package/dist/private/utils/scrollIntoView.js.map +1 -1
- package/dist/private/utils/scrollIntoView.mjs +4 -4
- package/dist/private/utils/scrollIntoView.mjs.map +1 -1
- package/dist/private/utils/shadowdom/DOMFunctions.cjs +28 -1
- package/dist/private/utils/shadowdom/DOMFunctions.cjs.map +1 -1
- package/dist/private/utils/shadowdom/DOMFunctions.js +30 -2
- package/dist/private/utils/shadowdom/DOMFunctions.js.map +1 -1
- package/dist/private/utils/shadowdom/DOMFunctions.mjs +28 -2
- package/dist/private/utils/shadowdom/DOMFunctions.mjs.map +1 -1
- package/dist/private/utils/useDeepMemo.cjs +4 -1
- package/dist/private/utils/useDeepMemo.cjs.map +1 -1
- package/dist/private/utils/useDeepMemo.js +4 -1
- package/dist/private/utils/useDeepMemo.js.map +1 -1
- package/dist/private/utils/useDeepMemo.mjs +4 -1
- package/dist/private/utils/useDeepMemo.mjs.map +1 -1
- package/dist/private/utils/useDrag1D.cjs +2 -0
- package/dist/private/utils/useDrag1D.cjs.map +1 -1
- package/dist/private/utils/useDrag1D.js +2 -0
- package/dist/private/utils/useDrag1D.js.map +1 -1
- package/dist/private/utils/useDrag1D.mjs +2 -0
- package/dist/private/utils/useDrag1D.mjs.map +1 -1
- package/dist/private/utils/useFormReset.cjs +4 -0
- package/dist/private/utils/useFormReset.cjs.map +1 -1
- package/dist/private/utils/useFormReset.js +4 -0
- package/dist/private/utils/useFormReset.js.map +1 -1
- package/dist/private/utils/useFormReset.mjs +4 -0
- package/dist/private/utils/useFormReset.mjs.map +1 -1
- package/dist/private/utils/useId.cjs +23 -4
- package/dist/private/utils/useId.cjs.map +1 -1
- package/dist/private/utils/useId.js +23 -4
- package/dist/private/utils/useId.js.map +1 -1
- package/dist/private/utils/useId.mjs +23 -4
- package/dist/private/utils/useId.mjs.map +1 -1
- package/dist/private/utils/useLoadMoreSentinel.cjs +7 -3
- package/dist/private/utils/useLoadMoreSentinel.cjs.map +1 -1
- package/dist/private/utils/useLoadMoreSentinel.js +7 -3
- package/dist/private/utils/useLoadMoreSentinel.js.map +1 -1
- package/dist/private/utils/useLoadMoreSentinel.mjs +7 -3
- package/dist/private/utils/useLoadMoreSentinel.mjs.map +1 -1
- package/dist/private/utils/useObjectRef.cjs +3 -1
- package/dist/private/utils/useObjectRef.cjs.map +1 -1
- package/dist/private/utils/useObjectRef.js +3 -1
- package/dist/private/utils/useObjectRef.js.map +1 -1
- package/dist/private/utils/useObjectRef.mjs +3 -1
- package/dist/private/utils/useObjectRef.mjs.map +1 -1
- package/dist/private/utils/useSyncRef.cjs +2 -0
- package/dist/private/utils/useSyncRef.cjs.map +1 -1
- package/dist/private/utils/useSyncRef.js +2 -0
- package/dist/private/utils/useSyncRef.js.map +1 -1
- package/dist/private/utils/useSyncRef.mjs +2 -0
- package/dist/private/utils/useSyncRef.mjs.map +1 -1
- package/dist/private/utils/useViewportSize.cjs +3 -3
- package/dist/private/utils/useViewportSize.cjs.map +1 -1
- package/dist/private/utils/useViewportSize.js +4 -4
- package/dist/private/utils/useViewportSize.js.map +1 -1
- package/dist/private/utils/useViewportSize.mjs +4 -4
- package/dist/private/utils/useViewportSize.mjs.map +1 -1
- package/dist/private/virtualizer/ScrollView.cjs +7 -4
- package/dist/private/virtualizer/ScrollView.cjs.map +1 -1
- package/dist/private/virtualizer/ScrollView.js +8 -5
- package/dist/private/virtualizer/ScrollView.js.map +1 -1
- package/dist/private/virtualizer/ScrollView.mjs +8 -5
- package/dist/private/virtualizer/ScrollView.mjs.map +1 -1
- package/dist/private/virtualizer/VirtualizerItem.cjs +3 -2
- package/dist/private/virtualizer/VirtualizerItem.cjs.map +1 -1
- package/dist/private/virtualizer/VirtualizerItem.js +3 -2
- package/dist/private/virtualizer/VirtualizerItem.js.map +1 -1
- package/dist/private/virtualizer/VirtualizerItem.mjs +3 -2
- package/dist/private/virtualizer/VirtualizerItem.mjs.map +1 -1
- package/dist/private/virtualizer/useVirtualizerItem.cjs +35 -2
- package/dist/private/virtualizer/useVirtualizerItem.cjs.map +1 -1
- package/dist/private/virtualizer/useVirtualizerItem.js +36 -3
- package/dist/private/virtualizer/useVirtualizerItem.js.map +1 -1
- package/dist/private/virtualizer/useVirtualizerItem.mjs +36 -3
- package/dist/private/virtualizer/useVirtualizerItem.mjs.map +1 -1
- package/dist/private/visually-hidden/VisuallyHidden.cjs +2 -1
- package/dist/private/visually-hidden/VisuallyHidden.cjs.map +1 -1
- package/dist/private/visually-hidden/VisuallyHidden.js +2 -1
- package/dist/private/visually-hidden/VisuallyHidden.js.map +1 -1
- package/dist/private/visually-hidden/VisuallyHidden.mjs +2 -1
- package/dist/private/visually-hidden/VisuallyHidden.mjs.map +1 -1
- package/dist/types/exports/index.d.ts +9 -0
- package/dist/types/exports/private/utils/domHelpers.d.ts +1 -1
- package/dist/types/exports/private/utils/platform.d.ts +1 -1
- package/dist/types/exports/private/utils/shadowdom/DOMFunctions.d.ts +1 -1
- package/dist/types/exports/useContextMenu.d.ts +2 -0
- package/dist/types/exports/usePreviewTrigger.d.ts +2 -0
- package/dist/types/exports/useTokenField.d.ts +4 -0
- package/dist/types/src/button/useToggleButtonGroup.d.ts +8 -0
- package/dist/types/src/combobox/useComboBox.d.ts +7 -1
- package/dist/types/src/dialog/useDialog.d.ts +2 -0
- package/dist/types/src/grid/useGrid.d.ts +7 -0
- package/dist/types/src/grid/useGridCell.d.ts +8 -1
- package/dist/types/src/grid/utils.d.ts +1 -0
- package/dist/types/src/gridlist/useGridListItem.d.ts +13 -0
- package/dist/types/src/interactions/createKeyboardShortcutHandler.d.ts +56 -0
- package/dist/types/src/interactions/useContextMenu.d.ts +21 -0
- package/dist/types/src/interactions/useKeyboard.d.ts +7 -0
- package/dist/types/src/interactions/useLongPress.d.ts +2 -0
- package/dist/types/src/overlays/usePopover.d.ts +2 -1
- package/dist/types/src/table/useTableCell.d.ts +12 -0
- package/dist/types/src/table/useTableColumnHeader.d.ts +12 -0
- package/dist/types/src/table/useTableColumnResize.d.ts +5 -0
- package/dist/types/src/tokenfield/useToken.d.ts +14 -0
- package/dist/types/src/tokenfield/useTokenField.d.ts +57 -0
- package/dist/types/src/tooltip/usePreviewTrigger.d.ts +27 -0
- package/dist/types/src/tooltip/useSafeArea.d.ts +26 -0
- package/dist/types/src/utils/domHelpers.d.ts +20 -5
- package/dist/types/src/utils/platform.d.ts +1 -0
- package/dist/types/src/utils/shadowdom/DOMFunctions.d.ts +11 -0
- package/dist/types/src/utils/useLoadMoreSentinel.d.ts +7 -0
- package/dist/types/src/virtualizer/VirtualizerItem.d.ts +1 -0
- package/dist/types/src/virtualizer/useVirtualizerItem.d.ts +1 -0
- package/i18n/ar-AE.js +1 -1
- package/i18n/ar-AE.mjs +1 -1
- package/i18n/bg-BG.js +1 -1
- package/i18n/bg-BG.mjs +1 -1
- package/i18n/cs-CZ.js +1 -1
- package/i18n/cs-CZ.mjs +1 -1
- package/i18n/da-DK.js +1 -1
- package/i18n/da-DK.mjs +1 -1
- package/i18n/de-DE.js +1 -1
- package/i18n/de-DE.mjs +1 -1
- package/i18n/el-GR.js +1 -1
- package/i18n/el-GR.mjs +1 -1
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.mjs +1 -1
- package/i18n/es-ES.js +1 -1
- package/i18n/es-ES.mjs +1 -1
- package/i18n/et-EE.js +1 -1
- package/i18n/et-EE.mjs +1 -1
- package/i18n/fi-FI.js +1 -1
- package/i18n/fi-FI.mjs +1 -1
- package/i18n/fr-FR.js +1 -1
- package/i18n/fr-FR.mjs +1 -1
- package/i18n/he-IL.js +1 -1
- package/i18n/he-IL.mjs +1 -1
- package/i18n/hr-HR.js +1 -1
- package/i18n/hr-HR.mjs +1 -1
- package/i18n/hu-HU.js +1 -1
- package/i18n/hu-HU.mjs +1 -1
- package/i18n/it-IT.js +1 -1
- package/i18n/it-IT.mjs +1 -1
- package/i18n/ja-JP.js +1 -1
- package/i18n/ja-JP.mjs +1 -1
- package/i18n/ko-KR.js +1 -1
- package/i18n/ko-KR.mjs +1 -1
- package/i18n/lt-LT.js +1 -1
- package/i18n/lt-LT.mjs +1 -1
- package/i18n/lv-LV.js +1 -1
- package/i18n/lv-LV.mjs +1 -1
- package/i18n/nb-NO.js +1 -1
- package/i18n/nb-NO.mjs +1 -1
- package/i18n/nl-NL.js +1 -1
- package/i18n/nl-NL.mjs +1 -1
- package/i18n/pl-PL.js +1 -1
- package/i18n/pl-PL.mjs +1 -1
- package/i18n/pt-BR.js +1 -1
- package/i18n/pt-BR.mjs +1 -1
- package/i18n/pt-PT.js +1 -1
- package/i18n/pt-PT.mjs +1 -1
- package/i18n/ro-RO.js +1 -1
- package/i18n/ro-RO.mjs +1 -1
- package/i18n/ru-RU.js +1 -1
- package/i18n/ru-RU.mjs +1 -1
- package/i18n/sk-SK.js +1 -1
- package/i18n/sk-SK.mjs +1 -1
- package/i18n/sl-SI.js +1 -1
- package/i18n/sl-SI.mjs +1 -1
- package/i18n/sr-SP.js +1 -1
- package/i18n/sr-SP.mjs +1 -1
- package/i18n/sv-SE.js +1 -1
- package/i18n/sv-SE.mjs +1 -1
- package/i18n/tr-TR.js +1 -1
- package/i18n/tr-TR.mjs +1 -1
- package/i18n/uk-UA.js +1 -1
- package/i18n/uk-UA.mjs +1 -1
- package/i18n/zh-CN.js +1 -1
- package/i18n/zh-CN.mjs +1 -1
- package/i18n/zh-TW.js +1 -1
- package/i18n/zh-TW.mjs +1 -1
- package/package.json +6 -6
- package/useContextMenu/package.json +5 -0
- package/usePreviewTrigger/package.json +5 -0
- package/useTokenField/package.json +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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,QAAQ,CAAC,YAAY;gBACzC,cAAc,MAAM,QAAQ,CAAC,YAAY;uBACzC;YACF;QACF;QAEA,MAAM,gBAAgB,CAAC;QAEvB,0DAA0D;QAC1D,wGAAwG;QACxG,IAAI,uBAAuB,YAAY,CAAC,kCAAY,QAAQ,CAAC,KAAK,EAChE,MAAM,iBAAiB,CAAC,kCAAY,iBAAiB;IAEzD;AACF","sources":["packages/react-aria/src/numberfield/useNumberField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\nimport {AriaButtonProps} from '../button/useButton';\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n TextInputDOMEvents,\n TextInputDOMProps,\n ValidationResult\n} from '@react-types/shared';\nimport {chain} from '../utils/chain';\nimport {\n type ClipboardEvent,\n type ClipboardEventHandler,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useMemo,\n useState\n} from 'react';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {flushSync} from 'react-dom';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport intlMessages from '../../intl/numberfield/*.json';\nimport {isAndroid, isIOS, isIPhone} from '../utils/platform';\nimport {mergeProps} from '../utils/mergeProps';\nimport {NumberFieldProps, NumberFieldState} from 'react-stately/useNumberFieldState';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useFocus} from '../interactions/useFocus';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormattedTextField} from '../textfield/useFormattedTextField';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useNumberFormatter} from '../i18n/useNumberFormatter';\nimport {useScrollWheel} from '../interactions/useScrollWheel';\nimport {useSpinButton} from '../spinbutton/useSpinButton';\n\nexport interface AriaNumberFieldProps\n extends NumberFieldProps, DOMProps, AriaLabelingProps, TextInputDOMEvents {\n /**\n * A custom aria-label for the decrement button. If not provided, the localized string \"Decrement\"\n * is used.\n */\n decrementAriaLabel?: string;\n /**\n * A custom aria-label for the increment button. If not provided, the localized string \"Increment\"\n * is used.\n */\n incrementAriaLabel?: string;\n /**\n * Enables or disables changing the value with scroll.\n */\n isWheelDisabled?: boolean;\n}\n\nexport interface NumberFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: GroupDOMAttributes;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button, to be passed to `useButton`. */\n incrementButtonProps: AriaButtonProps;\n /** Props for the decrement button, to be passed to `useButton`. */\n decrementButtonProps: AriaButtonProps;\n /** Props for the number field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the number field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component. Number\n * fields allow users to enter a number, and increment or decrement the value using stepper\n * buttons.\n */\nexport function useNumberField(\n props: AriaNumberFieldProps,\n state: NumberFieldState,\n inputRef: RefObject<HTMLInputElement | null>\n): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n label,\n formatOptions,\n onBlur = () => {},\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage,\n isWheelDisabled,\n ...otherProps\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n inputValue,\n commit,\n commitValidation\n } = state;\n\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/numberfield');\n let commitAndAnnounce = useCallback(() => {\n let oldValue = inputRef.current?.value ?? '';\n // Set input value to normalized valid value\n flushSync(() => {\n commit();\n });\n\n if (inputRef.current?.value !== oldValue) {\n announce(inputRef.current?.value ?? '', 'assertive');\n }\n }, [commit, inputRef]);\n\n let inputId = useId(id);\n let {focusProps} = useFocus({\n onBlur() {\n commitAndAnnounce();\n }\n });\n\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n\n // Replace negative textValue formatted using currencySign: 'accounting'\n // with a textValue that can be announced using a minus sign.\n let textValueFormatter = useNumberFormatter({...formatOptions, currencySign: undefined});\n let textValue = useMemo(\n () => (isNaN(numberValue) ? '' : textValueFormatter.format(numberValue)),\n [textValueFormatter, numberValue]\n );\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback(\n e => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let hasDecimals = (intlOptions.maximumFractionDigits ?? 0) > 0;\n let hasNegative = state.minValue === undefined || isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let onPaste: ClipboardEventHandler<HTMLInputElement> = (e: ClipboardEvent<HTMLInputElement>) => {\n props.onPaste?.(e);\n let inputElement = getEventTarget(e) as HTMLInputElement;\n // we can only handle the case where the paste takes over the entire input, otherwise things get very complicated\n // trying to calculate the new string based on what the paste is replacing and where in the source string it is\n if (\n inputElement &&\n (inputElement.selectionEnd ?? -1) - (inputElement.selectionStart ?? 0) ===\n inputElement.value.length\n ) {\n e.preventDefault();\n // commit so that the user gets to see what it formats to immediately\n // paste happens before inputRef's value is updated, so have to prevent the default and do it ourselves\n // spin button will then handle announcing the new value, this should work with controlled state as well\n // because the announcement is done as a result of the new rendered input value if there is one\n commit(e.clipboardData?.getData?.('text/plain')?.trim() ?? '');\n }\n };\n\n let domProps = filterDOMProps(props);\n let onKeyDownEnter = useCallback(\n e => {\n if (e.nativeEvent.isComposing) {\n return;\n }\n\n if (e.key === 'Enter') {\n flushSync(() => {\n commit();\n });\n commitValidation();\n } else {\n e.continuePropagation();\n }\n },\n [commit, commitValidation]\n );\n\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {\n labelProps,\n inputProps: textFieldProps,\n descriptionProps,\n errorMessageProps\n } = useFormattedTextField(\n {\n ...otherProps,\n ...domProps,\n // These props are added to a hidden input rather than the formatted textfield.\n name: undefined,\n form: undefined,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validate: undefined,\n [privateValidationStateProp]: state,\n value: inputValue,\n defaultValue: '!', // an invalid value so that form reset is ignored in onChange above\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || undefined,\n 'aria-labelledby': props['aria-labelledby'] || undefined,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onKeyDown: useMemo(() => chain(onKeyDownEnter, onKeyDown), [onKeyDownEnter, onKeyDown]),\n onKeyUp,\n onPaste,\n description,\n errorMessage\n },\n state,\n inputRef\n );\n\n useFormReset(inputRef, state.defaultNumberValue, state.setNumberValue);\n useNativeValidation(\n state,\n props.validationBehavior,\n props.commitBehavior,\n inputRef,\n state.minValue,\n state.maxValue,\n props.step,\n state.numberValue\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = mergeProps(\n spinButtonProps,\n focusProps,\n textFieldProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': !isIOS() ? stringFormatter.format('numberField') : null,\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n if (props.validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n let onButtonPressStart = e => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (getActiveElement() === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current?.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string | undefined;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || stringFormatter.format('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || stringFormatter.format('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n ...focusWithinProps,\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': isInvalid ? 'true' : undefined\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nlet numberInput: HTMLInputElement | null = null;\n\nfunction useNativeValidation(\n state: NumberFieldState,\n validationBehavior: 'native' | 'aria' | undefined,\n commitBehavior: 'snap' | 'validate' | undefined,\n inputRef: RefObject<HTMLInputElement | null>,\n min: number | undefined,\n max: number | undefined,\n step: number | undefined,\n value: number | undefined\n) {\n useLayoutEffect(() => {\n let input = inputRef.current;\n if (\n commitBehavior !== 'validate' ||\n state.realtimeValidation.isInvalid ||\n !input ||\n input.disabled\n ) {\n return;\n }\n\n // Create a native number input and use it to implement validation of min/max/step.\n // This lets us get the native validation message provided by the browser instead of needing our own translations.\n if (!numberInput && typeof document !== 'undefined') {\n numberInput = document.createElement('input');\n numberInput.type = 'number';\n }\n\n if (!numberInput) {\n // For TypeScript.\n return;\n }\n\n numberInput.min = min != null && !isNaN(min) ? String(min) : '';\n numberInput.max = max != null && !isNaN(max) ? String(max) : '';\n numberInput.step = step != null && !isNaN(step) ? String(step) : '';\n numberInput.value = value != null && !isNaN(value) ? String(value) : '';\n\n // Merge validity with the visible text input (for other validations like required).\n let valid = input.validity.valid && numberInput.validity.valid;\n let validationMessage = input.validationMessage || numberInput.validationMessage;\n let validity = {\n isInvalid: !valid,\n validationErrors: validationMessage ? [validationMessage] : [],\n validationDetails: {\n badInput: input.validity.badInput,\n customError: input.validity.customError,\n patternMismatch: input.validity.patternMismatch,\n rangeOverflow: numberInput.validity.rangeOverflow,\n rangeUnderflow: numberInput.validity.rangeUnderflow,\n stepMismatch: numberInput.validity.stepMismatch,\n tooLong: input.validity.tooLong,\n tooShort: input.validity.tooShort,\n typeMismatch: input.validity.typeMismatch,\n valueMissing: input.validity.valueMissing,\n valid\n }\n };\n\n state.updateValidation(validity);\n\n // Block form submission if validation behavior is native.\n // This won't overwrite any user-defined validation message because we checked realtimeValidation above.\n if (validationBehavior === 'native' && !numberInput.validity.valid) {\n input.setCustomValidity(numberInput.validationMessage);\n }\n });\n}\n"],"names":[],"version":3,"file":"useNumberField.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;AAmFM,SAAS,0CACd,KAA2B,EAC3B,KAAuB,EACvB,QAA4C;IAE5C,IAAI,MACF,EAAE,sBACF,kBAAkB,sBAClB,kBAAkB,cAClB,UAAU,cACV,UAAU,cACV,UAAU,YACV,QAAQ,YACR,QAAQ,aACR,SAAS,SACT,KAAK,iBACL,aAAa,UACb,SAAS,KAAO,YAChB,OAAO,iBACP,aAAa,aACb,SAAS,WACT,OAAO,eACP,WAAW,gBACX,YAAY,mBACZ,eAAe,EACf,GAAG,YACJ,GAAG;IAEJ,IAAI,aACF,SAAS,kBACT,cAAc,aACd,SAAS,kBACT,cAAc,eACd,WAAW,cACX,UAAU,UACV,MAAM,oBACN,gBAAgB,EACjB,GAAG;IAEJ,MAAM,kBAAkB,CAAA,GAAA,qDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAClE,IAAI,oBAAoB,CAAA,GAAA,wBAAU,EAAE;QAClC,IAAI,WAAW,SAAS,OAAO,EAAE,SAAS;QAC1C,4CAA4C;QAC5C,CAAA,GAAA,yBAAQ,EAAE;YACR;QACF;QAEA,IAAI,SAAS,OAAO,EAAE,UAAU,UAC9B,CAAA,GAAA,kCAAO,EAAE,SAAS,OAAO,EAA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AAiB;QAChF,IAAI,WAAW;YACb,WAAW,CAAC;YACZ,kBAAkB,oBAAoB;gBAAC;aAAkB,GAAG,EAAE;YAC9D,mBAAmB;gBACjB,UAAU,MAAM,QAAQ,CAAC,QAAQ;gBACjC,aAAa,MAAM,QAAQ,CAAC,WAAW;gBACvC,iBAAiB,MAAM,QAAQ,CAAC,eAAe;gBAC/C,eAAe,kCAAY,QAAQ,CAAC,aAAa;gBACjD,gBAAgB,kCAAY,QAAQ,CAAC,cAAc;gBACnD,cAAc,kCAAY,QAAQ,CAAC,YAAY;gBAC/C,SAAS,MAAM,QAAQ,CAAC,OAAO;gBAC/B,UAAU,MAAM,QAAQ,CAAC,QAAQ;gBACjC,cAAc,MAAM,QAAQ,CAAC,YAAY;gBACzC,cAAc,MAAM,QAAQ,CAAC,YAAY;uBACzC;YACF;QACF;QAEA,MAAM,gBAAgB,CAAC;QAEvB,0DAA0D;QAC1D,wGAAwG;QACxG,IAAI,uBAAuB,YAAY,CAAC,kCAAY,QAAQ,CAAC,KAAK,EAChE,MAAM,iBAAiB,CAAC,kCAAY,iBAAiB;IAEzD;AACF","sources":["packages/react-aria/src/numberfield/useNumberField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\nimport {AriaButtonProps} from '../button/useButton';\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n TextInputDOMEvents,\n TextInputDOMProps,\n ValidationResult\n} from '@react-types/shared';\nimport {\n type ClipboardEvent,\n type ClipboardEventHandler,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useMemo,\n useState\n} from 'react';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {flushSync} from 'react-dom';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport intlMessages from '../../intl/numberfield/*.json';\nimport {isAndroid, isIOS, isIPhone} from '../utils/platform';\nimport {mergeProps} from '../utils/mergeProps';\nimport {NumberFieldProps, NumberFieldState} from 'react-stately/useNumberFieldState';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useFocus} from '../interactions/useFocus';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormattedTextField} from '../textfield/useFormattedTextField';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\nimport {useKeyboard} from '../interactions/useKeyboard';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useNumberFormatter} from '../i18n/useNumberFormatter';\nimport {useScrollWheel} from '../interactions/useScrollWheel';\nimport {useSpinButton} from '../spinbutton/useSpinButton';\n\nexport interface AriaNumberFieldProps\n extends NumberFieldProps, DOMProps, AriaLabelingProps, TextInputDOMEvents {\n /**\n * A custom aria-label for the decrement button. If not provided, the localized string \"Decrement\"\n * is used.\n */\n decrementAriaLabel?: string;\n /**\n * A custom aria-label for the increment button. If not provided, the localized string \"Increment\"\n * is used.\n */\n incrementAriaLabel?: string;\n /**\n * Enables or disables changing the value with scroll.\n */\n isWheelDisabled?: boolean;\n}\n\nexport interface NumberFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: GroupDOMAttributes;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button, to be passed to `useButton`. */\n incrementButtonProps: AriaButtonProps;\n /** Props for the decrement button, to be passed to `useButton`. */\n decrementButtonProps: AriaButtonProps;\n /** Props for the number field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the number field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component. Number\n * fields allow users to enter a number, and increment or decrement the value using stepper\n * buttons.\n */\nexport function useNumberField(\n props: AriaNumberFieldProps,\n state: NumberFieldState,\n inputRef: RefObject<HTMLInputElement | null>\n): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n label,\n formatOptions,\n onBlur = () => {},\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage,\n isWheelDisabled,\n ...otherProps\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n inputValue,\n commit,\n commitValidation\n } = state;\n\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/numberfield');\n let commitAndAnnounce = useCallback(() => {\n let oldValue = inputRef.current?.value ?? '';\n // Set input value to normalized valid value\n flushSync(() => {\n commit();\n });\n\n if (inputRef.current?.value !== oldValue) {\n announce(inputRef.current?.value ?? '', 'assertive');\n }\n }, [commit, inputRef]);\n\n let inputId = useId(id);\n let {focusProps} = useFocus({\n onBlur() {\n commitAndAnnounce();\n }\n });\n\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n\n // Replace negative textValue formatted using currencySign: 'accounting'\n // with a textValue that can be announced using a minus sign.\n let textValueFormatter = useNumberFormatter({...formatOptions, currencySign: undefined});\n let textValue = useMemo(\n () => (isNaN(numberValue) ? '' : textValueFormatter.format(numberValue)),\n [textValueFormatter, numberValue]\n );\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback(\n e => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let hasDecimals = (intlOptions.maximumFractionDigits ?? 0) > 0;\n let hasNegative = state.minValue === undefined || isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let onPaste: ClipboardEventHandler<HTMLInputElement> = (e: ClipboardEvent<HTMLInputElement>) => {\n props.onPaste?.(e);\n let inputElement = getEventTarget(e) as HTMLInputElement;\n // we can only handle the case where the paste takes over the entire input, otherwise things get very complicated\n // trying to calculate the new string based on what the paste is replacing and where in the source string it is\n if (\n inputElement &&\n (inputElement.selectionEnd ?? -1) - (inputElement.selectionStart ?? 0) ===\n inputElement.value.length\n ) {\n e.preventDefault();\n // commit so that the user gets to see what it formats to immediately\n // paste happens before inputRef's value is updated, so have to prevent the default and do it ourselves\n // spin button will then handle announcing the new value, this should work with controlled state as well\n // because the announcement is done as a result of the new rendered input value if there is one\n commit(e.clipboardData?.getData?.('text/plain')?.trim() ?? '');\n }\n };\n\n let domProps = filterDOMProps(props);\n let {keyboardProps} = useKeyboard({\n isDisabled: isDisabled || isReadOnly,\n shortcuts: {\n Enter: () => {\n flushSync(() => {\n commit();\n });\n commitValidation();\n return {shouldPreventDefault: false};\n }\n },\n onKeyDown,\n onKeyUp\n });\n\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {\n labelProps,\n inputProps: textFieldPropsFromHook,\n descriptionProps,\n errorMessageProps\n } = useFormattedTextField(\n {\n ...otherProps,\n ...domProps,\n // These props are added to a hidden input rather than the formatted textfield.\n name: undefined,\n form: undefined,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validate: undefined,\n [privateValidationStateProp]: state,\n value: inputValue,\n defaultValue: '!', // an invalid value so that form reset is ignored in onChange above\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || undefined,\n 'aria-labelledby': props['aria-labelledby'] || undefined,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onPaste,\n description,\n errorMessage\n },\n state,\n inputRef\n );\n\n // Merge outside useFormattedTextField so useKeyboard's createEventHandler is not nested inside\n // useTextField/useFocusable's createEventHandler (avoids redundant stopPropagation on RS events).\n // Shortcuts run first (mergeProps chains the second argument after the first).\n let textFieldProps = mergeProps(keyboardProps, textFieldPropsFromHook);\n\n useFormReset(inputRef, state.defaultNumberValue, state.setNumberValue);\n useNativeValidation(\n state,\n props.validationBehavior,\n props.commitBehavior,\n inputRef,\n state.minValue,\n state.maxValue,\n props.step,\n state.numberValue\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = mergeProps(\n spinButtonProps,\n focusProps,\n textFieldProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': !isIOS() ? stringFormatter.format('numberField') : null,\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n if (props.validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n let onButtonPressStart = e => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (getActiveElement() === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current?.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string | undefined;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n // oxlint-disable-next-line react/react-compiler\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || stringFormatter.format('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n // oxlint-disable-next-line react/react-compiler\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || stringFormatter.format('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n ...focusWithinProps,\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': isInvalid ? 'true' : undefined\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nlet numberInput: HTMLInputElement | null = null;\n\nfunction useNativeValidation(\n state: NumberFieldState,\n validationBehavior: 'native' | 'aria' | undefined,\n commitBehavior: 'snap' | 'validate' | undefined,\n inputRef: RefObject<HTMLInputElement | null>,\n min: number | undefined,\n max: number | undefined,\n step: number | undefined,\n value: number | undefined\n) {\n useLayoutEffect(() => {\n let input = inputRef.current;\n if (\n commitBehavior !== 'validate' ||\n state.realtimeValidation.isInvalid ||\n !input ||\n input.disabled\n ) {\n return;\n }\n\n // Create a native number input and use it to implement validation of min/max/step.\n // This lets us get the native validation message provided by the browser instead of needing our own translations.\n if (!numberInput && typeof document !== 'undefined') {\n numberInput = document.createElement('input');\n numberInput.type = 'number';\n }\n\n if (!numberInput) {\n // For TypeScript.\n return;\n }\n\n numberInput.min = min != null && !isNaN(min) ? String(min) : '';\n numberInput.max = max != null && !isNaN(max) ? String(max) : '';\n numberInput.step = step != null && !isNaN(step) ? String(step) : '';\n numberInput.value = value != null && !isNaN(value) ? String(value) : '';\n\n // Merge validity with the visible text input (for other validations like required).\n let valid = input.validity.valid && numberInput.validity.valid;\n let validationMessage = input.validationMessage || numberInput.validationMessage;\n let validity = {\n isInvalid: !valid,\n validationErrors: validationMessage ? [validationMessage] : [],\n validationDetails: {\n badInput: input.validity.badInput,\n customError: input.validity.customError,\n patternMismatch: input.validity.patternMismatch,\n rangeOverflow: numberInput.validity.rangeOverflow,\n rangeUnderflow: numberInput.validity.rangeUnderflow,\n stepMismatch: numberInput.validity.stepMismatch,\n tooLong: input.validity.tooLong,\n tooShort: input.validity.tooShort,\n typeMismatch: input.validity.typeMismatch,\n valueMissing: input.validity.valueMissing,\n valid\n }\n };\n\n state.updateValidation(validity);\n\n // Block form submission if validation behavior is native.\n // This won't overwrite any user-defined validation message because we checked realtimeValidation above.\n if (validationBehavior === 'native' && !numberInput.validity.valid) {\n input.setCustomValidity(numberInput.validationMessage);\n }\n });\n}\n"],"names":[],"version":3,"file":"useNumberField.cjs.map"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {announce as $a53edfcc12185fd0$export$a9b970dcc4ae71a9} from "../live-announcer/LiveAnnouncer.js";
|
|
2
|
-
import {chain as $2cf8bb4b9e45dc81$export$e08e3b67e392101e} from "../utils/chain.js";
|
|
3
2
|
import {filterDOMProps as $6a28a4717b9a4e1c$export$457c3d6518dd4c6f} from "../utils/filterDOMProps.js";
|
|
4
3
|
import {getActiveElement as $d8ac7ed472840322$export$cd4e5573fbe2b576, getEventTarget as $d8ac7ed472840322$export$e58f029f0fbfdb29} from "../utils/shadowdom/DOMFunctions.js";
|
|
5
4
|
import $6zmuR$intlStringsjs from "./intlStrings.js";
|
|
@@ -10,6 +9,7 @@ import {useFocusWithin as $b842b95ed9b5d4d5$export$420e68273165f4ec} from "../in
|
|
|
10
9
|
import {useFormattedTextField as $a97100a6dd40f368$export$4f384c9210e583c3} from "../textfield/useFormattedTextField.js";
|
|
11
10
|
import {useFormReset as $5dfd40f1661a7fc3$export$5add1d006293d136} from "../utils/useFormReset.js";
|
|
12
11
|
import {useId as $0292efe68908de6b$export$f680877a34711e37} from "../utils/useId.js";
|
|
12
|
+
import {useKeyboard as $bf74df7506f65576$export$8f71654801c2f7cd} from "../interactions/useKeyboard.js";
|
|
13
13
|
import {useLayoutEffect as $53fed047b798be36$export$e5c5a5f917a5871c} from "../utils/useLayoutEffect.js";
|
|
14
14
|
import {useLocalizedStringFormatter as $1adfa757ef3cd864$export$f12b703ca79dfbb1} from "../i18n/useLocalizedStringFormatter.js";
|
|
15
15
|
import {useNumberFormatter as $1dc719caba1a3f1f$export$b7a616150fdb9f44} from "../i18n/useNumberFormatter.js";
|
|
@@ -169,20 +169,24 @@ function $f5cd4e5cf0095772$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
let domProps = (0, $6a28a4717b9a4e1c$export$457c3d6518dd4c6f)(props);
|
|
172
|
-
let
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
172
|
+
let { keyboardProps: keyboardProps } = (0, $bf74df7506f65576$export$8f71654801c2f7cd)({
|
|
173
|
+
isDisabled: isDisabled || isReadOnly,
|
|
174
|
+
shortcuts: {
|
|
175
|
+
Enter: ()=>{
|
|
176
|
+
(0, $6zmuR$flushSync)(()=>{
|
|
177
|
+
commit();
|
|
178
|
+
});
|
|
179
|
+
commitValidation();
|
|
180
|
+
return {
|
|
181
|
+
shouldPreventDefault: false
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
onKeyDown: onKeyDown,
|
|
186
|
+
onKeyUp: onKeyUp
|
|
187
|
+
});
|
|
184
188
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
185
|
-
let { labelProps: labelProps, inputProps:
|
|
189
|
+
let { labelProps: labelProps, inputProps: textFieldPropsFromHook, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $a97100a6dd40f368$export$4f384c9210e583c3)({
|
|
186
190
|
...otherProps,
|
|
187
191
|
...domProps,
|
|
188
192
|
// These props are added to a hidden input rather than the formatted textfield.
|
|
@@ -207,15 +211,14 @@ function $f5cd4e5cf0095772$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
207
211
|
onBlur: onBlur,
|
|
208
212
|
onFocus: onFocus,
|
|
209
213
|
onFocusChange: onFocusChange,
|
|
210
|
-
onKeyDown: (0, $6zmuR$useMemo)(()=>(0, $2cf8bb4b9e45dc81$export$e08e3b67e392101e)(onKeyDownEnter, onKeyDown), [
|
|
211
|
-
onKeyDownEnter,
|
|
212
|
-
onKeyDown
|
|
213
|
-
]),
|
|
214
|
-
onKeyUp: onKeyUp,
|
|
215
214
|
onPaste: onPaste,
|
|
216
215
|
description: description,
|
|
217
216
|
errorMessage: errorMessage
|
|
218
217
|
}, state, inputRef);
|
|
218
|
+
// Merge outside useFormattedTextField so useKeyboard's createEventHandler is not nested inside
|
|
219
|
+
// useTextField/useFocusable's createEventHandler (avoids redundant stopPropagation on RS events).
|
|
220
|
+
// Shortcuts run first (mergeProps chains the second argument after the first).
|
|
221
|
+
let textFieldProps = (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(keyboardProps, textFieldPropsFromHook);
|
|
219
222
|
(0, $5dfd40f1661a7fc3$export$5add1d006293d136)(inputRef, state.defaultNumberValue, state.setNumberValue);
|
|
220
223
|
$f5cd4e5cf0095772$var$useNativeValidation(state, props.validationBehavior, props.commitBehavior, inputRef, state.minValue, state.maxValue, props.step, state.numberValue);
|
|
221
224
|
let inputProps = (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(spinButtonProps, focusProps, textFieldProps, {
|
|
@@ -257,6 +260,7 @@ function $f5cd4e5cf0095772$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
257
260
|
if (!fieldLabel) ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];
|
|
258
261
|
let incrementId = (0, $0292efe68908de6b$export$f680877a34711e37)();
|
|
259
262
|
let decrementId = (0, $0292efe68908de6b$export$f680877a34711e37)();
|
|
263
|
+
// oxlint-disable-next-line react/react-compiler
|
|
260
264
|
let incrementButtonProps = (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(incButtonProps, {
|
|
261
265
|
'aria-label': incrementAriaLabel || stringFormatter.format('increase', {
|
|
262
266
|
fieldLabel: fieldLabel
|
|
@@ -270,6 +274,7 @@ function $f5cd4e5cf0095772$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
270
274
|
isDisabled: !state.canIncrement,
|
|
271
275
|
onPressStart: onButtonPressStart
|
|
272
276
|
});
|
|
277
|
+
// oxlint-disable-next-line react/react-compiler
|
|
273
278
|
let decrementButtonProps = (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(decButtonProps, {
|
|
274
279
|
'aria-label': decrementAriaLabel || stringFormatter.format('decrease', {
|
|
275
280
|
fieldLabel: fieldLabel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;AAmFM,SAAS,0CACd,KAA2B,EAC3B,KAAuB,EACvB,QAA4C;IAE5C,IAAI,MACF,EAAE,sBAC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AkB,oBAAoB;gBAAC;aAAkB,GAAG,EAAE;YAC9D,mBAAmB;gBACjB,UAAU,MAAM,QAAQ,CAAC,QAAQ;gBACjC,aAAa,MAAM,QAAQ,CAAC,WAAW;gBACvC,iBAAiB,MAAM,QAAQ,CAAC,eAAe;gBAC/C,eAAe,kCAAY,QAAQ,CAAC,aAAa;gBACjD,gBAAgB,kCAAY,QAAQ,CAAC,cAAc;gBACnD,cAAc,kCAAY,QAAQ,CAAC,YAAY;gBAC/C,SAAS,MAAM,QAAQ,CAAC,OAAO;gBAC/B,UAAU,MAAM,QAAQ,CAAC,QAAQ;gBACjC,cAAc,MAAM,QAAQ,CAAC,YAAY;gBACzC,cAAc,MAAM,QAAQ,CAAC,YAAY;uBACzC;YACF;QACF;QAEA,MAAM,gBAAgB,CAAC;QAEvB,0DAA0D;QAC1D,wGAAwG;QACxG,IAAI,uBAAuB,YAAY,CAAC,kCAAY,QAAQ,CAAC,KAAK,EAChE,MAAM,iBAAiB,CAAC,kCAAY,iBAAiB;IAEzD;AACF","sources":["packages/react-aria/src/numberfield/useNumberField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\nimport {AriaButtonProps} from '../button/useButton';\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n TextInputDOMEvents,\n TextInputDOMProps,\n ValidationResult\n} from '@react-types/shared';\nimport {chain} from '../utils/chain';\nimport {\n type ClipboardEvent,\n type ClipboardEventHandler,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useMemo,\n useState\n} from 'react';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {flushSync} from 'react-dom';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport intlMessages from '../../intl/numberfield/*.json';\nimport {isAndroid, isIOS, isIPhone} from '../utils/platform';\nimport {mergeProps} from '../utils/mergeProps';\nimport {NumberFieldProps, NumberFieldState} from 'react-stately/useNumberFieldState';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useFocus} from '../interactions/useFocus';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormattedTextField} from '../textfield/useFormattedTextField';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useNumberFormatter} from '../i18n/useNumberFormatter';\nimport {useScrollWheel} from '../interactions/useScrollWheel';\nimport {useSpinButton} from '../spinbutton/useSpinButton';\n\nexport interface AriaNumberFieldProps\n extends NumberFieldProps, DOMProps, AriaLabelingProps, TextInputDOMEvents {\n /**\n * A custom aria-label for the decrement button. If not provided, the localized string \"Decrement\"\n * is used.\n */\n decrementAriaLabel?: string;\n /**\n * A custom aria-label for the increment button. If not provided, the localized string \"Increment\"\n * is used.\n */\n incrementAriaLabel?: string;\n /**\n * Enables or disables changing the value with scroll.\n */\n isWheelDisabled?: boolean;\n}\n\nexport interface NumberFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: GroupDOMAttributes;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button, to be passed to `useButton`. */\n incrementButtonProps: AriaButtonProps;\n /** Props for the decrement button, to be passed to `useButton`. */\n decrementButtonProps: AriaButtonProps;\n /** Props for the number field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the number field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component. Number\n * fields allow users to enter a number, and increment or decrement the value using stepper\n * buttons.\n */\nexport function useNumberField(\n props: AriaNumberFieldProps,\n state: NumberFieldState,\n inputRef: RefObject<HTMLInputElement | null>\n): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n label,\n formatOptions,\n onBlur = () => {},\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage,\n isWheelDisabled,\n ...otherProps\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n inputValue,\n commit,\n commitValidation\n } = state;\n\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/numberfield');\n let commitAndAnnounce = useCallback(() => {\n let oldValue = inputRef.current?.value ?? '';\n // Set input value to normalized valid value\n flushSync(() => {\n commit();\n });\n\n if (inputRef.current?.value !== oldValue) {\n announce(inputRef.current?.value ?? '', 'assertive');\n }\n }, [commit, inputRef]);\n\n let inputId = useId(id);\n let {focusProps} = useFocus({\n onBlur() {\n commitAndAnnounce();\n }\n });\n\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n\n // Replace negative textValue formatted using currencySign: 'accounting'\n // with a textValue that can be announced using a minus sign.\n let textValueFormatter = useNumberFormatter({...formatOptions, currencySign: undefined});\n let textValue = useMemo(\n () => (isNaN(numberValue) ? '' : textValueFormatter.format(numberValue)),\n [textValueFormatter, numberValue]\n );\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback(\n e => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let hasDecimals = (intlOptions.maximumFractionDigits ?? 0) > 0;\n let hasNegative = state.minValue === undefined || isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let onPaste: ClipboardEventHandler<HTMLInputElement> = (e: ClipboardEvent<HTMLInputElement>) => {\n props.onPaste?.(e);\n let inputElement = getEventTarget(e) as HTMLInputElement;\n // we can only handle the case where the paste takes over the entire input, otherwise things get very complicated\n // trying to calculate the new string based on what the paste is replacing and where in the source string it is\n if (\n inputElement &&\n (inputElement.selectionEnd ?? -1) - (inputElement.selectionStart ?? 0) ===\n inputElement.value.length\n ) {\n e.preventDefault();\n // commit so that the user gets to see what it formats to immediately\n // paste happens before inputRef's value is updated, so have to prevent the default and do it ourselves\n // spin button will then handle announcing the new value, this should work with controlled state as well\n // because the announcement is done as a result of the new rendered input value if there is one\n commit(e.clipboardData?.getData?.('text/plain')?.trim() ?? '');\n }\n };\n\n let domProps = filterDOMProps(props);\n let onKeyDownEnter = useCallback(\n e => {\n if (e.nativeEvent.isComposing) {\n return;\n }\n\n if (e.key === 'Enter') {\n flushSync(() => {\n commit();\n });\n commitValidation();\n } else {\n e.continuePropagation();\n }\n },\n [commit, commitValidation]\n );\n\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {\n labelProps,\n inputProps: textFieldProps,\n descriptionProps,\n errorMessageProps\n } = useFormattedTextField(\n {\n ...otherProps,\n ...domProps,\n // These props are added to a hidden input rather than the formatted textfield.\n name: undefined,\n form: undefined,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validate: undefined,\n [privateValidationStateProp]: state,\n value: inputValue,\n defaultValue: '!', // an invalid value so that form reset is ignored in onChange above\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || undefined,\n 'aria-labelledby': props['aria-labelledby'] || undefined,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onKeyDown: useMemo(() => chain(onKeyDownEnter, onKeyDown), [onKeyDownEnter, onKeyDown]),\n onKeyUp,\n onPaste,\n description,\n errorMessage\n },\n state,\n inputRef\n );\n\n useFormReset(inputRef, state.defaultNumberValue, state.setNumberValue);\n useNativeValidation(\n state,\n props.validationBehavior,\n props.commitBehavior,\n inputRef,\n state.minValue,\n state.maxValue,\n props.step,\n state.numberValue\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = mergeProps(\n spinButtonProps,\n focusProps,\n textFieldProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': !isIOS() ? stringFormatter.format('numberField') : null,\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n if (props.validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n let onButtonPressStart = e => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (getActiveElement() === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current?.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string | undefined;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || stringFormatter.format('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || stringFormatter.format('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n ...focusWithinProps,\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': isInvalid ? 'true' : undefined\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nlet numberInput: HTMLInputElement | null = null;\n\nfunction useNativeValidation(\n state: NumberFieldState,\n validationBehavior: 'native' | 'aria' | undefined,\n commitBehavior: 'snap' | 'validate' | undefined,\n inputRef: RefObject<HTMLInputElement | null>,\n min: number | undefined,\n max: number | undefined,\n step: number | undefined,\n value: number | undefined\n) {\n useLayoutEffect(() => {\n let input = inputRef.current;\n if (\n commitBehavior !== 'validate' ||\n state.realtimeValidation.isInvalid ||\n !input ||\n input.disabled\n ) {\n return;\n }\n\n // Create a native number input and use it to implement validation of min/max/step.\n // This lets us get the native validation message provided by the browser instead of needing our own translations.\n if (!numberInput && typeof document !== 'undefined') {\n numberInput = document.createElement('input');\n numberInput.type = 'number';\n }\n\n if (!numberInput) {\n // For TypeScript.\n return;\n }\n\n numberInput.min = min != null && !isNaN(min) ? String(min) : '';\n numberInput.max = max != null && !isNaN(max) ? String(max) : '';\n numberInput.step = step != null && !isNaN(step) ? String(step) : '';\n numberInput.value = value != null && !isNaN(value) ? String(value) : '';\n\n // Merge validity with the visible text input (for other validations like required).\n let valid = input.validity.valid && numberInput.validity.valid;\n let validationMessage = input.validationMessage || numberInput.validationMessage;\n let validity = {\n isInvalid: !valid,\n validationErrors: validationMessage ? [validationMessage] : [],\n validationDetails: {\n badInput: input.validity.badInput,\n customError: input.validity.customError,\n patternMismatch: input.validity.patternMismatch,\n rangeOverflow: numberInput.validity.rangeOverflow,\n rangeUnderflow: numberInput.validity.rangeUnderflow,\n stepMismatch: numberInput.validity.stepMismatch,\n tooLong: input.validity.tooLong,\n tooShort: input.validity.tooShort,\n typeMismatch: input.validity.typeMismatch,\n valueMissing: input.validity.valueMissing,\n valid\n }\n };\n\n state.updateValidation(validity);\n\n // Block form submission if validation behavior is native.\n // This won't overwrite any user-defined validation message because we checked realtimeValidation above.\n if (validationBehavior === 'native' && !numberInput.validity.valid) {\n input.setCustomValidity(numberInput.validationMessage);\n }\n });\n}\n"],"names":[],"version":3,"file":"useNumberField.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;AAmFM,SAAS,0CACd,KAA2B,EAC3B,KAAuB,EACvB,QAA4C;IAE5C,IAAI,MACF,EAAE,sBACF,kBAAkB,sBAClB,kBAAkB,cAClB,UAAU,cACV,UAAU,cACV,UAAU,YACV,QAAQ,YACR,QAAQ,aACR,SAAS,SACT,KAAK,iBACL,aAAa,UACb,SAAS,KAAO,YAChB,OAAO,iBACP,aAAa,aACb,SAAS,WACT,OAAO,eACP,WAAW,gBACX,YAAY,mBACZ,eAAe,EACf,GAAG,YACJ,GAAG;IAEJ,IAAI,aACF,SAAS,kBACT,cAAc,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AAY,QAAQ,CAAC,YAAY;gBAC/C,SAAS,MAAM,QAAQ,CAAC,OAAO;gBAC/B,UAAU,MAAM,QAAQ,CAAC,QAAQ;gBACjC,cAAc,MAAM,QAAQ,CAAC,YAAY;gBACzC,cAAc,MAAM,QAAQ,CAAC,YAAY;uBACzC;YACF;QACF;QAEA,MAAM,gBAAgB,CAAC;QAEvB,0DAA0D;QAC1D,wGAAwG;QACxG,IAAI,uBAAuB,YAAY,CAAC,kCAAY,QAAQ,CAAC,KAAK,EAChE,MAAM,iBAAiB,CAAC,kCAAY,iBAAiB;IAEzD;AACF","sources":["packages/react-aria/src/numberfield/useNumberField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\nimport {AriaButtonProps} from '../button/useButton';\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n TextInputDOMEvents,\n TextInputDOMProps,\n ValidationResult\n} from '@react-types/shared';\nimport {\n type ClipboardEvent,\n type ClipboardEventHandler,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useMemo,\n useState\n} from 'react';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {flushSync} from 'react-dom';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport intlMessages from '../../intl/numberfield/*.json';\nimport {isAndroid, isIOS, isIPhone} from '../utils/platform';\nimport {mergeProps} from '../utils/mergeProps';\nimport {NumberFieldProps, NumberFieldState} from 'react-stately/useNumberFieldState';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useFocus} from '../interactions/useFocus';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormattedTextField} from '../textfield/useFormattedTextField';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\nimport {useKeyboard} from '../interactions/useKeyboard';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useNumberFormatter} from '../i18n/useNumberFormatter';\nimport {useScrollWheel} from '../interactions/useScrollWheel';\nimport {useSpinButton} from '../spinbutton/useSpinButton';\n\nexport interface AriaNumberFieldProps\n extends NumberFieldProps, DOMProps, AriaLabelingProps, TextInputDOMEvents {\n /**\n * A custom aria-label for the decrement button. If not provided, the localized string \"Decrement\"\n * is used.\n */\n decrementAriaLabel?: string;\n /**\n * A custom aria-label for the increment button. If not provided, the localized string \"Increment\"\n * is used.\n */\n incrementAriaLabel?: string;\n /**\n * Enables or disables changing the value with scroll.\n */\n isWheelDisabled?: boolean;\n}\n\nexport interface NumberFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: GroupDOMAttributes;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button, to be passed to `useButton`. */\n incrementButtonProps: AriaButtonProps;\n /** Props for the decrement button, to be passed to `useButton`. */\n decrementButtonProps: AriaButtonProps;\n /** Props for the number field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the number field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component. Number\n * fields allow users to enter a number, and increment or decrement the value using stepper\n * buttons.\n */\nexport function useNumberField(\n props: AriaNumberFieldProps,\n state: NumberFieldState,\n inputRef: RefObject<HTMLInputElement | null>\n): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n label,\n formatOptions,\n onBlur = () => {},\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage,\n isWheelDisabled,\n ...otherProps\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n inputValue,\n commit,\n commitValidation\n } = state;\n\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/numberfield');\n let commitAndAnnounce = useCallback(() => {\n let oldValue = inputRef.current?.value ?? '';\n // Set input value to normalized valid value\n flushSync(() => {\n commit();\n });\n\n if (inputRef.current?.value !== oldValue) {\n announce(inputRef.current?.value ?? '', 'assertive');\n }\n }, [commit, inputRef]);\n\n let inputId = useId(id);\n let {focusProps} = useFocus({\n onBlur() {\n commitAndAnnounce();\n }\n });\n\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n\n // Replace negative textValue formatted using currencySign: 'accounting'\n // with a textValue that can be announced using a minus sign.\n let textValueFormatter = useNumberFormatter({...formatOptions, currencySign: undefined});\n let textValue = useMemo(\n () => (isNaN(numberValue) ? '' : textValueFormatter.format(numberValue)),\n [textValueFormatter, numberValue]\n );\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback(\n e => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let hasDecimals = (intlOptions.maximumFractionDigits ?? 0) > 0;\n let hasNegative = state.minValue === undefined || isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let onPaste: ClipboardEventHandler<HTMLInputElement> = (e: ClipboardEvent<HTMLInputElement>) => {\n props.onPaste?.(e);\n let inputElement = getEventTarget(e) as HTMLInputElement;\n // we can only handle the case where the paste takes over the entire input, otherwise things get very complicated\n // trying to calculate the new string based on what the paste is replacing and where in the source string it is\n if (\n inputElement &&\n (inputElement.selectionEnd ?? -1) - (inputElement.selectionStart ?? 0) ===\n inputElement.value.length\n ) {\n e.preventDefault();\n // commit so that the user gets to see what it formats to immediately\n // paste happens before inputRef's value is updated, so have to prevent the default and do it ourselves\n // spin button will then handle announcing the new value, this should work with controlled state as well\n // because the announcement is done as a result of the new rendered input value if there is one\n commit(e.clipboardData?.getData?.('text/plain')?.trim() ?? '');\n }\n };\n\n let domProps = filterDOMProps(props);\n let {keyboardProps} = useKeyboard({\n isDisabled: isDisabled || isReadOnly,\n shortcuts: {\n Enter: () => {\n flushSync(() => {\n commit();\n });\n commitValidation();\n return {shouldPreventDefault: false};\n }\n },\n onKeyDown,\n onKeyUp\n });\n\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {\n labelProps,\n inputProps: textFieldPropsFromHook,\n descriptionProps,\n errorMessageProps\n } = useFormattedTextField(\n {\n ...otherProps,\n ...domProps,\n // These props are added to a hidden input rather than the formatted textfield.\n name: undefined,\n form: undefined,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validate: undefined,\n [privateValidationStateProp]: state,\n value: inputValue,\n defaultValue: '!', // an invalid value so that form reset is ignored in onChange above\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || undefined,\n 'aria-labelledby': props['aria-labelledby'] || undefined,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onPaste,\n description,\n errorMessage\n },\n state,\n inputRef\n );\n\n // Merge outside useFormattedTextField so useKeyboard's createEventHandler is not nested inside\n // useTextField/useFocusable's createEventHandler (avoids redundant stopPropagation on RS events).\n // Shortcuts run first (mergeProps chains the second argument after the first).\n let textFieldProps = mergeProps(keyboardProps, textFieldPropsFromHook);\n\n useFormReset(inputRef, state.defaultNumberValue, state.setNumberValue);\n useNativeValidation(\n state,\n props.validationBehavior,\n props.commitBehavior,\n inputRef,\n state.minValue,\n state.maxValue,\n props.step,\n state.numberValue\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = mergeProps(\n spinButtonProps,\n focusProps,\n textFieldProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': !isIOS() ? stringFormatter.format('numberField') : null,\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n if (props.validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n let onButtonPressStart = e => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (getActiveElement() === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current?.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string | undefined;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n // oxlint-disable-next-line react/react-compiler\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || stringFormatter.format('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n // oxlint-disable-next-line react/react-compiler\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || stringFormatter.format('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n ...focusWithinProps,\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': isInvalid ? 'true' : undefined\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nlet numberInput: HTMLInputElement | null = null;\n\nfunction useNativeValidation(\n state: NumberFieldState,\n validationBehavior: 'native' | 'aria' | undefined,\n commitBehavior: 'snap' | 'validate' | undefined,\n inputRef: RefObject<HTMLInputElement | null>,\n min: number | undefined,\n max: number | undefined,\n step: number | undefined,\n value: number | undefined\n) {\n useLayoutEffect(() => {\n let input = inputRef.current;\n if (\n commitBehavior !== 'validate' ||\n state.realtimeValidation.isInvalid ||\n !input ||\n input.disabled\n ) {\n return;\n }\n\n // Create a native number input and use it to implement validation of min/max/step.\n // This lets us get the native validation message provided by the browser instead of needing our own translations.\n if (!numberInput && typeof document !== 'undefined') {\n numberInput = document.createElement('input');\n numberInput.type = 'number';\n }\n\n if (!numberInput) {\n // For TypeScript.\n return;\n }\n\n numberInput.min = min != null && !isNaN(min) ? String(min) : '';\n numberInput.max = max != null && !isNaN(max) ? String(max) : '';\n numberInput.step = step != null && !isNaN(step) ? String(step) : '';\n numberInput.value = value != null && !isNaN(value) ? String(value) : '';\n\n // Merge validity with the visible text input (for other validations like required).\n let valid = input.validity.valid && numberInput.validity.valid;\n let validationMessage = input.validationMessage || numberInput.validationMessage;\n let validity = {\n isInvalid: !valid,\n validationErrors: validationMessage ? [validationMessage] : [],\n validationDetails: {\n badInput: input.validity.badInput,\n customError: input.validity.customError,\n patternMismatch: input.validity.patternMismatch,\n rangeOverflow: numberInput.validity.rangeOverflow,\n rangeUnderflow: numberInput.validity.rangeUnderflow,\n stepMismatch: numberInput.validity.stepMismatch,\n tooLong: input.validity.tooLong,\n tooShort: input.validity.tooShort,\n typeMismatch: input.validity.typeMismatch,\n valueMissing: input.validity.valueMissing,\n valid\n }\n };\n\n state.updateValidation(validity);\n\n // Block form submission if validation behavior is native.\n // This won't overwrite any user-defined validation message because we checked realtimeValidation above.\n if (validationBehavior === 'native' && !numberInput.validity.valid) {\n input.setCustomValidity(numberInput.validationMessage);\n }\n });\n}\n"],"names":[],"version":3,"file":"useNumberField.js.map"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {announce as $a46cf152bb926da5$export$a9b970dcc4ae71a9} from "../live-announcer/LiveAnnouncer.mjs";
|
|
2
|
-
import {chain as $a4e76a5424781910$export$e08e3b67e392101e} from "../utils/chain.mjs";
|
|
3
2
|
import {filterDOMProps as $8e9d2fae0ecb9001$export$457c3d6518dd4c6f} from "../utils/filterDOMProps.mjs";
|
|
4
3
|
import {getActiveElement as $23f2114a1b82827e$export$cd4e5573fbe2b576, getEventTarget as $23f2114a1b82827e$export$e58f029f0fbfdb29} from "../utils/shadowdom/DOMFunctions.mjs";
|
|
5
4
|
import $jCxNY$intlStringsmjs from "./intlStrings.mjs";
|
|
@@ -10,6 +9,7 @@ import {useFocusWithin as $2c9edc598a03d523$export$420e68273165f4ec} from "../in
|
|
|
10
9
|
import {useFormattedTextField as $62888b2ec35be488$export$4f384c9210e583c3} from "../textfield/useFormattedTextField.mjs";
|
|
11
10
|
import {useFormReset as $3274bf1495747a7b$export$5add1d006293d136} from "../utils/useFormReset.mjs";
|
|
12
11
|
import {useId as $390e54f620492c70$export$f680877a34711e37} from "../utils/useId.mjs";
|
|
12
|
+
import {useKeyboard as $8296dad1a4c5e0dc$export$8f71654801c2f7cd} from "../interactions/useKeyboard.mjs";
|
|
13
13
|
import {useLayoutEffect as $c4867b2f328c2698$export$e5c5a5f917a5871c} from "../utils/useLayoutEffect.mjs";
|
|
14
14
|
import {useLocalizedStringFormatter as $cf2482eff2eeeec2$export$f12b703ca79dfbb1} from "../i18n/useLocalizedStringFormatter.mjs";
|
|
15
15
|
import {useNumberFormatter as $bd90acf18e792be6$export$b7a616150fdb9f44} from "../i18n/useNumberFormatter.mjs";
|
|
@@ -161,20 +161,24 @@ function $cd2fa56213693c5e$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
163
|
let domProps = (0, $8e9d2fae0ecb9001$export$457c3d6518dd4c6f)(props);
|
|
164
|
-
let
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
let { keyboardProps: keyboardProps } = (0, $8296dad1a4c5e0dc$export$8f71654801c2f7cd)({
|
|
165
|
+
isDisabled: isDisabled || isReadOnly,
|
|
166
|
+
shortcuts: {
|
|
167
|
+
Enter: ()=>{
|
|
168
|
+
(0, $jCxNY$flushSync)(()=>{
|
|
169
|
+
commit();
|
|
170
|
+
});
|
|
171
|
+
commitValidation();
|
|
172
|
+
return {
|
|
173
|
+
shouldPreventDefault: false
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
onKeyDown: onKeyDown,
|
|
178
|
+
onKeyUp: onKeyUp
|
|
179
|
+
});
|
|
176
180
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
177
|
-
let { labelProps: labelProps, inputProps:
|
|
181
|
+
let { labelProps: labelProps, inputProps: textFieldPropsFromHook, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $62888b2ec35be488$export$4f384c9210e583c3)({
|
|
178
182
|
...otherProps,
|
|
179
183
|
...domProps,
|
|
180
184
|
// These props are added to a hidden input rather than the formatted textfield.
|
|
@@ -199,15 +203,14 @@ function $cd2fa56213693c5e$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
199
203
|
onBlur: onBlur,
|
|
200
204
|
onFocus: onFocus,
|
|
201
205
|
onFocusChange: onFocusChange,
|
|
202
|
-
onKeyDown: (0, $jCxNY$useMemo)(()=>(0, $a4e76a5424781910$export$e08e3b67e392101e)(onKeyDownEnter, onKeyDown), [
|
|
203
|
-
onKeyDownEnter,
|
|
204
|
-
onKeyDown
|
|
205
|
-
]),
|
|
206
|
-
onKeyUp: onKeyUp,
|
|
207
206
|
onPaste: onPaste,
|
|
208
207
|
description: description,
|
|
209
208
|
errorMessage: errorMessage
|
|
210
209
|
}, state, inputRef);
|
|
210
|
+
// Merge outside useFormattedTextField so useKeyboard's createEventHandler is not nested inside
|
|
211
|
+
// useTextField/useFocusable's createEventHandler (avoids redundant stopPropagation on RS events).
|
|
212
|
+
// Shortcuts run first (mergeProps chains the second argument after the first).
|
|
213
|
+
let textFieldProps = (0, $bbaa08b3cd72f041$export$9d1611c77c2fe928)(keyboardProps, textFieldPropsFromHook);
|
|
211
214
|
(0, $3274bf1495747a7b$export$5add1d006293d136)(inputRef, state.defaultNumberValue, state.setNumberValue);
|
|
212
215
|
$cd2fa56213693c5e$var$useNativeValidation(state, props.validationBehavior, props.commitBehavior, inputRef, state.minValue, state.maxValue, props.step, state.numberValue);
|
|
213
216
|
let inputProps = (0, $bbaa08b3cd72f041$export$9d1611c77c2fe928)(spinButtonProps, focusProps, textFieldProps, {
|
|
@@ -248,6 +251,7 @@ function $cd2fa56213693c5e$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
248
251
|
if (!fieldLabel) ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];
|
|
249
252
|
let incrementId = (0, $390e54f620492c70$export$f680877a34711e37)();
|
|
250
253
|
let decrementId = (0, $390e54f620492c70$export$f680877a34711e37)();
|
|
254
|
+
// oxlint-disable-next-line react/react-compiler
|
|
251
255
|
let incrementButtonProps = (0, $bbaa08b3cd72f041$export$9d1611c77c2fe928)(incButtonProps, {
|
|
252
256
|
'aria-label': incrementAriaLabel || stringFormatter.format('increase', {
|
|
253
257
|
fieldLabel: fieldLabel
|
|
@@ -261,6 +265,7 @@ function $cd2fa56213693c5e$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
261
265
|
isDisabled: !state.canIncrement,
|
|
262
266
|
onPressStart: onButtonPressStart
|
|
263
267
|
});
|
|
268
|
+
// oxlint-disable-next-line react/react-compiler
|
|
264
269
|
let decrementButtonProps = (0, $bbaa08b3cd72f041$export$9d1611c77c2fe928)(decButtonProps, {
|
|
265
270
|
'aria-label': decrementAriaLabel || stringFormatter.format('decrease', {
|
|
266
271
|
fieldLabel: fieldLabel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;AAmFM,SAAS,0CACd,KAA2B,EAC3B,KAAuB,EACvB,QAA4C;IAE5C,IAAI,MACF,EAAE,sBACF,kBAAkB,sBAClB,kBAAkB,cAClB,UAAU,cACV,UAAU,cACV,UAAU,YACV,QAAQ,YACR,QAAQ,aACR,SAAS,SACT,KAAK,iBACL,aAAa,UACb,SAAS,KAAO,YAChB,OAAO,iBACP,aAAa,aACb,SAAS,WACT,OAAO,eACP,WAAW,gBACX,YAAY,mBACZ,eAAe,EACf,GAAG,YACJ,GAAG;IAEJ,IAAI,aACF,SAAS,kBACT,cAAc,aACd,SAAS,kBACT,cAAc,eACd,WAAW,cAC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AY,GAAG,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,OAAO,OAAO;QAC7D,kCAAY,IAAI,GAAG,QAAQ,QAAQ,CAAC,MAAM,QAAQ,OAAO,QAAQ;QACjE,kCAAY,KAAK,GAAG,SAAS,QAAQ,CAAC,MAAM,SAAS,OAAO,SAAS;QAErE,oFAAoF;QACpF,IAAI,QAAQ,MAAM,QAAQ,CAAC,KAAK,IAAI,kCAAY,QAAQ,CAAC,KAAK;QAC9D,IAAI,oBAAoB,MAAM,iBAAiB,IAAI,kCAAY,iBAAiB;QAChF,IAAI,WAAW;YACb,WAAW,CAAC;YACZ,kBAAkB,oBAAoB;gBAAC;aAAkB,GAAG,EAAE;YAC9D,mBAAmB;gBACjB,UAAU,MAAM,QAAQ,CAAC,QAAQ;gBACjC,aAAa,MAAM,QAAQ,CAAC,WAAW;gBACvC,iBAAiB,MAAM,QAAQ,CAAC,eAAe;gBAC/C,eAAe,kCAAY,QAAQ,CAAC,aAAa;gBACjD,gBAAgB,kCAAY,QAAQ,CAAC,cAAc;gBACnD,cAAc,kCAAY,QAAQ,CAAC,YAAY;gBAC/C,SAAS,MAAM,QAAQ,CAAC,OAAO;gBAC/B,UAAU,MAAM,QAAQ,CAAC,QAAQ;gBACjC,cAAc,MAAM,QAAQ,CAAC,YAAY;gBACzC,cAAc,MAAM,QAAQ,CAAC,YAAY;uBACzC;YACF;QACF;QAEA,MAAM,gBAAgB,CAAC;QAEvB,0DAA0D;QAC1D,wGAAwG;QACxG,IAAI,uBAAuB,YAAY,CAAC,kCAAY,QAAQ,CAAC,KAAK,EAChE,MAAM,iBAAiB,CAAC,kCAAY,iBAAiB;IAEzD;AACF","sources":["packages/react-aria/src/numberfield/useNumberField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\nimport {AriaButtonProps} from '../button/useButton';\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n TextInputDOMEvents,\n TextInputDOMProps,\n ValidationResult\n} from '@react-types/shared';\nimport {chain} from '../utils/chain';\nimport {\n type ClipboardEvent,\n type ClipboardEventHandler,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useMemo,\n useState\n} from 'react';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {flushSync} from 'react-dom';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport intlMessages from '../../intl/numberfield/*.json';\nimport {isAndroid, isIOS, isIPhone} from '../utils/platform';\nimport {mergeProps} from '../utils/mergeProps';\nimport {NumberFieldProps, NumberFieldState} from 'react-stately/useNumberFieldState';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useFocus} from '../interactions/useFocus';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormattedTextField} from '../textfield/useFormattedTextField';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useNumberFormatter} from '../i18n/useNumberFormatter';\nimport {useScrollWheel} from '../interactions/useScrollWheel';\nimport {useSpinButton} from '../spinbutton/useSpinButton';\n\nexport interface AriaNumberFieldProps\n extends NumberFieldProps, DOMProps, AriaLabelingProps, TextInputDOMEvents {\n /**\n * A custom aria-label for the decrement button. If not provided, the localized string \"Decrement\"\n * is used.\n */\n decrementAriaLabel?: string;\n /**\n * A custom aria-label for the increment button. If not provided, the localized string \"Increment\"\n * is used.\n */\n incrementAriaLabel?: string;\n /**\n * Enables or disables changing the value with scroll.\n */\n isWheelDisabled?: boolean;\n}\n\nexport interface NumberFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: GroupDOMAttributes;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button, to be passed to `useButton`. */\n incrementButtonProps: AriaButtonProps;\n /** Props for the decrement button, to be passed to `useButton`. */\n decrementButtonProps: AriaButtonProps;\n /** Props for the number field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the number field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component. Number\n * fields allow users to enter a number, and increment or decrement the value using stepper\n * buttons.\n */\nexport function useNumberField(\n props: AriaNumberFieldProps,\n state: NumberFieldState,\n inputRef: RefObject<HTMLInputElement | null>\n): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n label,\n formatOptions,\n onBlur = () => {},\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage,\n isWheelDisabled,\n ...otherProps\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n inputValue,\n commit,\n commitValidation\n } = state;\n\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/numberfield');\n let commitAndAnnounce = useCallback(() => {\n let oldValue = inputRef.current?.value ?? '';\n // Set input value to normalized valid value\n flushSync(() => {\n commit();\n });\n\n if (inputRef.current?.value !== oldValue) {\n announce(inputRef.current?.value ?? '', 'assertive');\n }\n }, [commit, inputRef]);\n\n let inputId = useId(id);\n let {focusProps} = useFocus({\n onBlur() {\n commitAndAnnounce();\n }\n });\n\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n\n // Replace negative textValue formatted using currencySign: 'accounting'\n // with a textValue that can be announced using a minus sign.\n let textValueFormatter = useNumberFormatter({...formatOptions, currencySign: undefined});\n let textValue = useMemo(\n () => (isNaN(numberValue) ? '' : textValueFormatter.format(numberValue)),\n [textValueFormatter, numberValue]\n );\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback(\n e => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let hasDecimals = (intlOptions.maximumFractionDigits ?? 0) > 0;\n let hasNegative = state.minValue === undefined || isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let onPaste: ClipboardEventHandler<HTMLInputElement> = (e: ClipboardEvent<HTMLInputElement>) => {\n props.onPaste?.(e);\n let inputElement = getEventTarget(e) as HTMLInputElement;\n // we can only handle the case where the paste takes over the entire input, otherwise things get very complicated\n // trying to calculate the new string based on what the paste is replacing and where in the source string it is\n if (\n inputElement &&\n (inputElement.selectionEnd ?? -1) - (inputElement.selectionStart ?? 0) ===\n inputElement.value.length\n ) {\n e.preventDefault();\n // commit so that the user gets to see what it formats to immediately\n // paste happens before inputRef's value is updated, so have to prevent the default and do it ourselves\n // spin button will then handle announcing the new value, this should work with controlled state as well\n // because the announcement is done as a result of the new rendered input value if there is one\n commit(e.clipboardData?.getData?.('text/plain')?.trim() ?? '');\n }\n };\n\n let domProps = filterDOMProps(props);\n let onKeyDownEnter = useCallback(\n e => {\n if (e.nativeEvent.isComposing) {\n return;\n }\n\n if (e.key === 'Enter') {\n flushSync(() => {\n commit();\n });\n commitValidation();\n } else {\n e.continuePropagation();\n }\n },\n [commit, commitValidation]\n );\n\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {\n labelProps,\n inputProps: textFieldProps,\n descriptionProps,\n errorMessageProps\n } = useFormattedTextField(\n {\n ...otherProps,\n ...domProps,\n // These props are added to a hidden input rather than the formatted textfield.\n name: undefined,\n form: undefined,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validate: undefined,\n [privateValidationStateProp]: state,\n value: inputValue,\n defaultValue: '!', // an invalid value so that form reset is ignored in onChange above\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || undefined,\n 'aria-labelledby': props['aria-labelledby'] || undefined,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onKeyDown: useMemo(() => chain(onKeyDownEnter, onKeyDown), [onKeyDownEnter, onKeyDown]),\n onKeyUp,\n onPaste,\n description,\n errorMessage\n },\n state,\n inputRef\n );\n\n useFormReset(inputRef, state.defaultNumberValue, state.setNumberValue);\n useNativeValidation(\n state,\n props.validationBehavior,\n props.commitBehavior,\n inputRef,\n state.minValue,\n state.maxValue,\n props.step,\n state.numberValue\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = mergeProps(\n spinButtonProps,\n focusProps,\n textFieldProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': !isIOS() ? stringFormatter.format('numberField') : null,\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n if (props.validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n let onButtonPressStart = e => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (getActiveElement() === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current?.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string | undefined;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || stringFormatter.format('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || stringFormatter.format('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n ...focusWithinProps,\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': isInvalid ? 'true' : undefined\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nlet numberInput: HTMLInputElement | null = null;\n\nfunction useNativeValidation(\n state: NumberFieldState,\n validationBehavior: 'native' | 'aria' | undefined,\n commitBehavior: 'snap' | 'validate' | undefined,\n inputRef: RefObject<HTMLInputElement | null>,\n min: number | undefined,\n max: number | undefined,\n step: number | undefined,\n value: number | undefined\n) {\n useLayoutEffect(() => {\n let input = inputRef.current;\n if (\n commitBehavior !== 'validate' ||\n state.realtimeValidation.isInvalid ||\n !input ||\n input.disabled\n ) {\n return;\n }\n\n // Create a native number input and use it to implement validation of min/max/step.\n // This lets us get the native validation message provided by the browser instead of needing our own translations.\n if (!numberInput && typeof document !== 'undefined') {\n numberInput = document.createElement('input');\n numberInput.type = 'number';\n }\n\n if (!numberInput) {\n // For TypeScript.\n return;\n }\n\n numberInput.min = min != null && !isNaN(min) ? String(min) : '';\n numberInput.max = max != null && !isNaN(max) ? String(max) : '';\n numberInput.step = step != null && !isNaN(step) ? String(step) : '';\n numberInput.value = value != null && !isNaN(value) ? String(value) : '';\n\n // Merge validity with the visible text input (for other validations like required).\n let valid = input.validity.valid && numberInput.validity.valid;\n let validationMessage = input.validationMessage || numberInput.validationMessage;\n let validity = {\n isInvalid: !valid,\n validationErrors: validationMessage ? [validationMessage] : [],\n validationDetails: {\n badInput: input.validity.badInput,\n customError: input.validity.customError,\n patternMismatch: input.validity.patternMismatch,\n rangeOverflow: numberInput.validity.rangeOverflow,\n rangeUnderflow: numberInput.validity.rangeUnderflow,\n stepMismatch: numberInput.validity.stepMismatch,\n tooLong: input.validity.tooLong,\n tooShort: input.validity.tooShort,\n typeMismatch: input.validity.typeMismatch,\n valueMissing: input.validity.valueMissing,\n valid\n }\n };\n\n state.updateValidation(validity);\n\n // Block form submission if validation behavior is native.\n // This won't overwrite any user-defined validation message because we checked realtimeValidation above.\n if (validationBehavior === 'native' && !numberInput.validity.valid) {\n input.setCustomValidity(numberInput.validationMessage);\n }\n });\n}\n"],"names":[],"version":3,"file":"useNumberField.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;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,CAAC,YAAY;gBACzC,cAAc,MAAM,QAAQ,CAAC,YAAY;uBACzC;YACF;QACF;QAEA,MAAM,gBAAgB,CAAC;QAEvB,0DAA0D;QAC1D,wGAAwG;QACxG,IAAI,uBAAuB,YAAY,CAAC,kCAAY,QAAQ,CAAC,KAAK,EAChE,MAAM,iBAAiB,CAAC,kCAAY,iBAAiB;IAEzD;AACF","sources":["packages/react-aria/src/numberfield/useNumberField.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '../live-announcer/LiveAnnouncer';\nimport {AriaButtonProps} from '../button/useButton';\nimport {\n AriaLabelingProps,\n DOMAttributes,\n DOMProps,\n GroupDOMAttributes,\n TextInputDOMEvents,\n TextInputDOMProps,\n ValidationResult\n} from '@react-types/shared';\nimport {\n type ClipboardEvent,\n type ClipboardEventHandler,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useMemo,\n useState\n} from 'react';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {flushSync} from 'react-dom';\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport intlMessages from '../../intl/numberfield/*.json';\nimport {isAndroid, isIOS, isIPhone} from '../utils/platform';\nimport {mergeProps} from '../utils/mergeProps';\nimport {NumberFieldProps, NumberFieldState} from 'react-stately/useNumberFieldState';\nimport {privateValidationStateProp} from 'react-stately/private/form/useFormValidationState';\nimport {useFocus} from '../interactions/useFocus';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useFormattedTextField} from '../textfield/useFormattedTextField';\nimport {useFormReset} from '../utils/useFormReset';\nimport {useId} from '../utils/useId';\nimport {useKeyboard} from '../interactions/useKeyboard';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useNumberFormatter} from '../i18n/useNumberFormatter';\nimport {useScrollWheel} from '../interactions/useScrollWheel';\nimport {useSpinButton} from '../spinbutton/useSpinButton';\n\nexport interface AriaNumberFieldProps\n extends NumberFieldProps, DOMProps, AriaLabelingProps, TextInputDOMEvents {\n /**\n * A custom aria-label for the decrement button. If not provided, the localized string \"Decrement\"\n * is used.\n */\n decrementAriaLabel?: string;\n /**\n * A custom aria-label for the increment button. If not provided, the localized string \"Increment\"\n * is used.\n */\n incrementAriaLabel?: string;\n /**\n * Enables or disables changing the value with scroll.\n */\n isWheelDisabled?: boolean;\n}\n\nexport interface NumberFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: GroupDOMAttributes;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button, to be passed to `useButton`. */\n incrementButtonProps: AriaButtonProps;\n /** Props for the decrement button, to be passed to `useButton`. */\n decrementButtonProps: AriaButtonProps;\n /** Props for the number field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the number field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component. Number\n * fields allow users to enter a number, and increment or decrement the value using stepper\n * buttons.\n */\nexport function useNumberField(\n props: AriaNumberFieldProps,\n state: NumberFieldState,\n inputRef: RefObject<HTMLInputElement | null>\n): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n label,\n formatOptions,\n onBlur = () => {},\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage,\n isWheelDisabled,\n ...otherProps\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n inputValue,\n commit,\n commitValidation\n } = state;\n\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/numberfield');\n let commitAndAnnounce = useCallback(() => {\n let oldValue = inputRef.current?.value ?? '';\n // Set input value to normalized valid value\n flushSync(() => {\n commit();\n });\n\n if (inputRef.current?.value !== oldValue) {\n announce(inputRef.current?.value ?? '', 'assertive');\n }\n }, [commit, inputRef]);\n\n let inputId = useId(id);\n let {focusProps} = useFocus({\n onBlur() {\n commitAndAnnounce();\n }\n });\n\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n\n // Replace negative textValue formatted using currencySign: 'accounting'\n // with a textValue that can be announced using a minus sign.\n let textValueFormatter = useNumberFormatter({...formatOptions, currencySign: undefined});\n let textValue = useMemo(\n () => (isNaN(numberValue) ? '' : textValueFormatter.format(numberValue)),\n [textValueFormatter, numberValue]\n );\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback(\n e => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let hasDecimals = (intlOptions.maximumFractionDigits ?? 0) > 0;\n let hasNegative = state.minValue === undefined || isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = value => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let onPaste: ClipboardEventHandler<HTMLInputElement> = (e: ClipboardEvent<HTMLInputElement>) => {\n props.onPaste?.(e);\n let inputElement = getEventTarget(e) as HTMLInputElement;\n // we can only handle the case where the paste takes over the entire input, otherwise things get very complicated\n // trying to calculate the new string based on what the paste is replacing and where in the source string it is\n if (\n inputElement &&\n (inputElement.selectionEnd ?? -1) - (inputElement.selectionStart ?? 0) ===\n inputElement.value.length\n ) {\n e.preventDefault();\n // commit so that the user gets to see what it formats to immediately\n // paste happens before inputRef's value is updated, so have to prevent the default and do it ourselves\n // spin button will then handle announcing the new value, this should work with controlled state as well\n // because the announcement is done as a result of the new rendered input value if there is one\n commit(e.clipboardData?.getData?.('text/plain')?.trim() ?? '');\n }\n };\n\n let domProps = filterDOMProps(props);\n let {keyboardProps} = useKeyboard({\n isDisabled: isDisabled || isReadOnly,\n shortcuts: {\n Enter: () => {\n flushSync(() => {\n commit();\n });\n commitValidation();\n return {shouldPreventDefault: false};\n }\n },\n onKeyDown,\n onKeyUp\n });\n\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {\n labelProps,\n inputProps: textFieldPropsFromHook,\n descriptionProps,\n errorMessageProps\n } = useFormattedTextField(\n {\n ...otherProps,\n ...domProps,\n // These props are added to a hidden input rather than the formatted textfield.\n name: undefined,\n form: undefined,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validate: undefined,\n [privateValidationStateProp]: state,\n value: inputValue,\n defaultValue: '!', // an invalid value so that form reset is ignored in onChange above\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || undefined,\n 'aria-labelledby': props['aria-labelledby'] || undefined,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onPaste,\n description,\n errorMessage\n },\n state,\n inputRef\n );\n\n // Merge outside useFormattedTextField so useKeyboard's createEventHandler is not nested inside\n // useTextField/useFocusable's createEventHandler (avoids redundant stopPropagation on RS events).\n // Shortcuts run first (mergeProps chains the second argument after the first).\n let textFieldProps = mergeProps(keyboardProps, textFieldPropsFromHook);\n\n useFormReset(inputRef, state.defaultNumberValue, state.setNumberValue);\n useNativeValidation(\n state,\n props.validationBehavior,\n props.commitBehavior,\n inputRef,\n state.minValue,\n state.maxValue,\n props.step,\n state.numberValue\n );\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = mergeProps(\n spinButtonProps,\n focusProps,\n textFieldProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': !isIOS() ? stringFormatter.format('numberField') : null,\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n if (props.validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n let onButtonPressStart = e => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (getActiveElement() === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current?.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string | undefined;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n // oxlint-disable-next-line react/react-compiler\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || stringFormatter.format('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n // oxlint-disable-next-line react/react-compiler\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || stringFormatter.format('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby':\n ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n ...focusWithinProps,\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': isInvalid ? 'true' : undefined\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n\nlet numberInput: HTMLInputElement | null = null;\n\nfunction useNativeValidation(\n state: NumberFieldState,\n validationBehavior: 'native' | 'aria' | undefined,\n commitBehavior: 'snap' | 'validate' | undefined,\n inputRef: RefObject<HTMLInputElement | null>,\n min: number | undefined,\n max: number | undefined,\n step: number | undefined,\n value: number | undefined\n) {\n useLayoutEffect(() => {\n let input = inputRef.current;\n if (\n commitBehavior !== 'validate' ||\n state.realtimeValidation.isInvalid ||\n !input ||\n input.disabled\n ) {\n return;\n }\n\n // Create a native number input and use it to implement validation of min/max/step.\n // This lets us get the native validation message provided by the browser instead of needing our own translations.\n if (!numberInput && typeof document !== 'undefined') {\n numberInput = document.createElement('input');\n numberInput.type = 'number';\n }\n\n if (!numberInput) {\n // For TypeScript.\n return;\n }\n\n numberInput.min = min != null && !isNaN(min) ? String(min) : '';\n numberInput.max = max != null && !isNaN(max) ? String(max) : '';\n numberInput.step = step != null && !isNaN(step) ? String(step) : '';\n numberInput.value = value != null && !isNaN(value) ? String(value) : '';\n\n // Merge validity with the visible text input (for other validations like required).\n let valid = input.validity.valid && numberInput.validity.valid;\n let validationMessage = input.validationMessage || numberInput.validationMessage;\n let validity = {\n isInvalid: !valid,\n validationErrors: validationMessage ? [validationMessage] : [],\n validationDetails: {\n badInput: input.validity.badInput,\n customError: input.validity.customError,\n patternMismatch: input.validity.patternMismatch,\n rangeOverflow: numberInput.validity.rangeOverflow,\n rangeUnderflow: numberInput.validity.rangeUnderflow,\n stepMismatch: numberInput.validity.stepMismatch,\n tooLong: input.validity.tooLong,\n tooShort: input.validity.tooShort,\n typeMismatch: input.validity.typeMismatch,\n valueMissing: input.validity.valueMissing,\n valid\n }\n };\n\n state.updateValidation(validity);\n\n // Block form submission if validation behavior is native.\n // This won't overwrite any user-defined validation message because we checked realtimeValidation above.\n if (validationBehavior === 'native' && !numberInput.validity.valid) {\n input.setCustomValidity(numberInput.validationMessage);\n }\n });\n}\n"],"names":[],"version":3,"file":"useNumberField.mjs.map"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var $271711dcf3cbfb6a$exports = require("../interactions/PressResponder.cjs");
|
|
2
|
+
var $cfe896014413cb8c$exports = require("../interactions/useFocusable.cjs");
|
|
2
3
|
var $9fb4ac1cc58342cc$exports = require("../focus/FocusScope.cjs");
|
|
3
4
|
var $25c7fefe1bb8073e$exports = require("../ssr/SSRProvider.cjs");
|
|
4
5
|
var $429333cab433657c$exports = require("../utils/useLayoutEffect.cjs");
|
|
@@ -34,6 +35,7 @@ $parcel$export(module.exports, "useOverlayFocusContain", function () { return $6
|
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
|
|
38
|
+
|
|
37
39
|
const $6d3a394e4e7927ef$export$a2200b96afd16271 = /*#__PURE__*/ (0, ($parcel$interopDefault($gvH4Z$react))).createContext(null);
|
|
38
40
|
function $6d3a394e4e7927ef$export$c6fdb837b070b4ff(props) {
|
|
39
41
|
let isSSR = (0, $25c7fefe1bb8073e$exports.useIsSSR)();
|
|
@@ -56,7 +58,9 @@ function $6d3a394e4e7927ef$export$c6fdb837b070b4ff(props) {
|
|
|
56
58
|
}, contents);
|
|
57
59
|
contents = /*#__PURE__*/ (0, ($parcel$interopDefault($gvH4Z$react))).createElement($6d3a394e4e7927ef$export$a2200b96afd16271.Provider, {
|
|
58
60
|
value: contextValue
|
|
59
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($gvH4Z$react))).createElement((0, $271711dcf3cbfb6a$exports.ClearPressResponder), null,
|
|
61
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($gvH4Z$react))).createElement((0, $271711dcf3cbfb6a$exports.ClearPressResponder), null, /*#__PURE__*/ (0, ($parcel$interopDefault($gvH4Z$react))).createElement((0, $cfe896014413cb8c$exports.FocusableContext).Provider, {
|
|
62
|
+
value: null
|
|
63
|
+
}, contents)));
|
|
60
64
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($gvH4Z$reactdom))).createPortal(contents, portalContainer);
|
|
61
65
|
}
|
|
62
66
|
function $6d3a394e4e7927ef$export$14c98a7594375490() {
|