@proyecto-viviana/solidaria 0.2.8 → 0.4.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/README.md +31 -236
- package/dist/_chunk/actiongroup.js +207 -0
- package/dist/_chunk/actiongroup.js.map +1 -0
- package/dist/_chunk/actiongroup.jsx +207 -0
- package/dist/_chunk/actiongroup.jsx.map +1 -0
- package/dist/_chunk/ariaHideOutside.js +122 -0
- package/dist/_chunk/ariaHideOutside.js.map +1 -0
- package/dist/_chunk/ariaHideOutside.jsx +122 -0
- package/dist/_chunk/ariaHideOutside.jsx.map +1 -0
- package/dist/_chunk/autocomplete.js +196 -0
- package/dist/_chunk/autocomplete.js.map +1 -0
- package/dist/_chunk/autocomplete.jsx +196 -0
- package/dist/_chunk/autocomplete.jsx.map +1 -0
- package/dist/_chunk/breadcrumbs.js +119 -0
- package/dist/_chunk/breadcrumbs.js.map +1 -0
- package/dist/_chunk/breadcrumbs.jsx +119 -0
- package/dist/_chunk/breadcrumbs.jsx.map +1 -0
- package/dist/_chunk/button.js +276 -0
- package/dist/_chunk/button.js.map +1 -0
- package/dist/_chunk/button.jsx +276 -0
- package/dist/_chunk/button.jsx.map +1 -0
- package/dist/_chunk/calendar.js +1036 -0
- package/dist/_chunk/calendar.js.map +1 -0
- package/dist/_chunk/calendar.jsx +1036 -0
- package/dist/_chunk/calendar.jsx.map +1 -0
- package/dist/_chunk/checkbox.js +234 -0
- package/dist/_chunk/checkbox.js.map +1 -0
- package/dist/_chunk/checkbox.jsx +234 -0
- package/dist/_chunk/checkbox.jsx.map +1 -0
- package/dist/_chunk/color.js +1174 -0
- package/dist/_chunk/color.js.map +1 -0
- package/dist/_chunk/color.jsx +1174 -0
- package/dist/_chunk/color.jsx.map +1 -0
- package/dist/_chunk/combobox.js +436 -0
- package/dist/_chunk/combobox.js.map +1 -0
- package/dist/_chunk/combobox.jsx +436 -0
- package/dist/_chunk/combobox.jsx.map +1 -0
- package/dist/_chunk/createCollator.js +229 -0
- package/dist/_chunk/createCollator.js.map +1 -0
- package/dist/_chunk/createCollator.jsx +223 -0
- package/dist/_chunk/createCollator.jsx.map +1 -0
- package/dist/_chunk/createCollectionRowInteraction.js +133 -0
- package/dist/_chunk/createCollectionRowInteraction.js.map +1 -0
- package/dist/_chunk/createCollectionRowInteraction.jsx +133 -0
- package/dist/_chunk/createCollectionRowInteraction.jsx.map +1 -0
- package/dist/_chunk/createField.js +54 -0
- package/dist/_chunk/createField.js.map +1 -0
- package/dist/_chunk/createField.jsx +54 -0
- package/dist/_chunk/createField.jsx.map +1 -0
- package/dist/_chunk/createFocus.js +101 -0
- package/dist/_chunk/createFocus.js.map +1 -0
- package/dist/_chunk/createFocus.jsx +101 -0
- package/dist/_chunk/createFocus.jsx.map +1 -0
- package/dist/_chunk/createFocusRing.js +54 -0
- package/dist/_chunk/createFocusRing.js.map +1 -0
- package/dist/_chunk/createFocusRing.jsx +54 -0
- package/dist/_chunk/createFocusRing.jsx.map +1 -0
- package/dist/_chunk/createFocusWithin.js +121 -0
- package/dist/_chunk/createFocusWithin.js.map +1 -0
- package/dist/_chunk/createFocusWithin.jsx +121 -0
- package/dist/_chunk/createFocusWithin.jsx.map +1 -0
- package/dist/_chunk/createFocusable.js +131 -0
- package/dist/_chunk/createFocusable.js.map +1 -0
- package/dist/_chunk/createFocusable.jsx +131 -0
- package/dist/_chunk/createFocusable.jsx.map +1 -0
- package/dist/_chunk/createFormValidation.js +135 -0
- package/dist/_chunk/createFormValidation.js.map +1 -0
- package/dist/_chunk/createFormValidation.jsx +135 -0
- package/dist/_chunk/createFormValidation.jsx.map +1 -0
- package/dist/_chunk/createHover.js +130 -0
- package/dist/_chunk/createHover.js.map +1 -0
- package/dist/_chunk/createHover.jsx +130 -0
- package/dist/_chunk/createHover.jsx.map +1 -0
- package/dist/_chunk/createInteractionModality.js +269 -0
- package/dist/_chunk/createInteractionModality.js.map +1 -0
- package/dist/_chunk/createInteractionModality.jsx +269 -0
- package/dist/_chunk/createInteractionModality.jsx.map +1 -0
- package/dist/_chunk/createLabel.js +46 -0
- package/dist/_chunk/createLabel.js.map +1 -0
- package/dist/_chunk/createLabel.jsx +46 -0
- package/dist/_chunk/createLabel.jsx.map +1 -0
- package/dist/_chunk/createLabels.js +31 -0
- package/dist/_chunk/createLabels.js.map +1 -0
- package/dist/_chunk/createLabels.jsx +31 -0
- package/dist/_chunk/createLabels.jsx.map +1 -0
- package/dist/_chunk/createLandmark.js +198 -0
- package/dist/_chunk/createLandmark.js.map +1 -0
- package/dist/_chunk/createLandmark.jsx +198 -0
- package/dist/_chunk/createLandmark.jsx.map +1 -0
- package/dist/_chunk/createLongPress.js +91 -0
- package/dist/_chunk/createLongPress.js.map +1 -0
- package/dist/_chunk/createLongPress.jsx +91 -0
- package/dist/_chunk/createLongPress.jsx.map +1 -0
- package/dist/_chunk/createOverlay.js +327 -0
- package/dist/_chunk/createOverlay.js.map +1 -0
- package/dist/_chunk/createOverlay.jsx +327 -0
- package/dist/_chunk/createOverlay.jsx.map +1 -0
- package/dist/_chunk/createPress.js +526 -0
- package/dist/_chunk/createPress.js.map +1 -0
- package/dist/_chunk/createPress.jsx +526 -0
- package/dist/_chunk/createPress.jsx.map +1 -0
- package/dist/_chunk/createProgressBar.js +81 -0
- package/dist/_chunk/createProgressBar.js.map +1 -0
- package/dist/_chunk/createProgressBar.jsx +81 -0
- package/dist/_chunk/createProgressBar.jsx.map +1 -0
- package/dist/_chunk/createSelectableItem.js +298 -0
- package/dist/_chunk/createSelectableItem.js.map +1 -0
- package/dist/_chunk/createSelectableItem.jsx +298 -0
- package/dist/_chunk/createSelectableItem.jsx.map +1 -0
- package/dist/_chunk/createToggle.js +158 -0
- package/dist/_chunk/createToggle.js.map +1 -0
- package/dist/_chunk/createToggle.jsx +158 -0
- package/dist/_chunk/createToggle.jsx.map +1 -0
- package/dist/_chunk/createTypeSelect.js +125 -0
- package/dist/_chunk/createTypeSelect.js.map +1 -0
- package/dist/_chunk/createTypeSelect.jsx +125 -0
- package/dist/_chunk/createTypeSelect.jsx.map +1 -0
- package/dist/_chunk/datepicker.js +1393 -0
- package/dist/_chunk/datepicker.js.map +1 -0
- package/dist/_chunk/datepicker.jsx +1393 -0
- package/dist/_chunk/datepicker.jsx.map +1 -0
- package/dist/_chunk/dialog.js +62 -0
- package/dist/_chunk/dialog.js.map +1 -0
- package/dist/_chunk/dialog.jsx +62 -0
- package/dist/_chunk/dialog.jsx.map +1 -0
- package/dist/_chunk/disclosure.js +185 -0
- package/dist/_chunk/disclosure.js.map +1 -0
- package/dist/_chunk/disclosure.jsx +185 -0
- package/dist/_chunk/disclosure.jsx.map +1 -0
- package/dist/_chunk/dnd.js +1304 -0
- package/dist/_chunk/dnd.js.map +1 -0
- package/dist/_chunk/dnd.jsx +1304 -0
- package/dist/_chunk/dnd.jsx.map +1 -0
- package/dist/_chunk/env.js +105 -0
- package/dist/_chunk/env.js.map +1 -0
- package/dist/_chunk/env.jsx +105 -0
- package/dist/_chunk/env.jsx.map +1 -0
- package/dist/_chunk/filterDOMProps.js +82 -0
- package/dist/_chunk/filterDOMProps.js.map +1 -0
- package/dist/_chunk/filterDOMProps.jsx +82 -0
- package/dist/_chunk/filterDOMProps.jsx.map +1 -0
- package/dist/_chunk/focus.js +399 -0
- package/dist/_chunk/focus.js.map +1 -0
- package/dist/_chunk/focus.jsx +399 -0
- package/dist/_chunk/focus.jsx.map +1 -0
- package/dist/_chunk/focus2.js +895 -0
- package/dist/_chunk/focus2.js.map +1 -0
- package/dist/_chunk/focus2.jsx +870 -0
- package/dist/_chunk/focus2.jsx.map +1 -0
- package/dist/_chunk/form.js +39 -0
- package/dist/_chunk/form.js.map +1 -0
- package/dist/_chunk/form.jsx +39 -0
- package/dist/_chunk/form.jsx.map +1 -0
- package/dist/_chunk/grid.js +623 -0
- package/dist/_chunk/grid.js.map +1 -0
- package/dist/_chunk/grid.jsx +623 -0
- package/dist/_chunk/grid.jsx.map +1 -0
- package/dist/_chunk/gridlist.js +364 -0
- package/dist/_chunk/gridlist.js.map +1 -0
- package/dist/_chunk/gridlist.jsx +364 -0
- package/dist/_chunk/gridlist.jsx.map +1 -0
- package/dist/_chunk/i18n.js +254 -0
- package/dist/_chunk/i18n.js.map +1 -0
- package/dist/_chunk/i18n.jsx +254 -0
- package/dist/_chunk/i18n.jsx.map +1 -0
- package/dist/_chunk/interactions.js +241 -0
- package/dist/_chunk/interactions.js.map +1 -0
- package/dist/_chunk/interactions.jsx +237 -0
- package/dist/_chunk/interactions.jsx.map +1 -0
- package/dist/_chunk/link.js +96 -0
- package/dist/_chunk/link.js.map +1 -0
- package/dist/_chunk/link.jsx +96 -0
- package/dist/_chunk/link.jsx.map +1 -0
- package/dist/_chunk/listbox.js +324 -0
- package/dist/_chunk/listbox.js.map +1 -0
- package/dist/_chunk/listbox.jsx +324 -0
- package/dist/_chunk/listbox.jsx.map +1 -0
- package/dist/_chunk/live-announcer.js +207 -0
- package/dist/_chunk/live-announcer.js.map +1 -0
- package/dist/_chunk/live-announcer.jsx +207 -0
- package/dist/_chunk/live-announcer.jsx.map +1 -0
- package/dist/_chunk/menu.js +518 -0
- package/dist/_chunk/menu.js.map +1 -0
- package/dist/_chunk/menu.jsx +518 -0
- package/dist/_chunk/menu.jsx.map +1 -0
- package/dist/_chunk/meter.js +33 -0
- package/dist/_chunk/meter.js.map +1 -0
- package/dist/_chunk/meter.jsx +33 -0
- package/dist/_chunk/meter.jsx.map +1 -0
- package/dist/_chunk/numberfield.js +258 -0
- package/dist/_chunk/numberfield.js.map +1 -0
- package/dist/_chunk/numberfield.jsx +258 -0
- package/dist/_chunk/numberfield.jsx.map +1 -0
- package/dist/_chunk/overlays.js +186 -0
- package/dist/_chunk/overlays.js.map +1 -0
- package/dist/_chunk/overlays.jsx +162 -0
- package/dist/_chunk/overlays.jsx.map +1 -0
- package/dist/_chunk/popover.js +574 -0
- package/dist/_chunk/popover.js.map +1 -0
- package/dist/_chunk/popover.jsx +574 -0
- package/dist/_chunk/popover.jsx.map +1 -0
- package/dist/_chunk/radio.js +319 -0
- package/dist/_chunk/radio.js.map +1 -0
- package/dist/_chunk/radio.jsx +319 -0
- package/dist/_chunk/radio.jsx.map +1 -0
- package/dist/_chunk/searchfield.js +209 -0
- package/dist/_chunk/searchfield.js.map +1 -0
- package/dist/_chunk/searchfield.jsx +209 -0
- package/dist/_chunk/searchfield.jsx.map +1 -0
- package/dist/_chunk/select.js +403 -0
- package/dist/_chunk/select.js.map +1 -0
- package/dist/_chunk/select.jsx +394 -0
- package/dist/_chunk/select.jsx.map +1 -0
- package/dist/_chunk/selection.js +679 -0
- package/dist/_chunk/selection.js.map +1 -0
- package/dist/_chunk/selection.jsx +679 -0
- package/dist/_chunk/selection.jsx.map +1 -0
- package/dist/_chunk/separator.js +29 -0
- package/dist/_chunk/separator.js.map +1 -0
- package/dist/_chunk/separator.jsx +29 -0
- package/dist/_chunk/separator.jsx.map +1 -0
- package/dist/_chunk/slider.js +255 -0
- package/dist/_chunk/slider.js.map +1 -0
- package/dist/_chunk/slider.jsx +255 -0
- package/dist/_chunk/slider.jsx.map +1 -0
- package/dist/_chunk/steplist.js +66 -0
- package/dist/_chunk/steplist.js.map +1 -0
- package/dist/_chunk/steplist.jsx +66 -0
- package/dist/_chunk/steplist.jsx.map +1 -0
- package/dist/_chunk/switch.js +34 -0
- package/dist/_chunk/switch.js.map +1 -0
- package/dist/_chunk/switch.jsx +34 -0
- package/dist/_chunk/switch.jsx.map +1 -0
- package/dist/_chunk/table.js +1051 -0
- package/dist/_chunk/table.js.map +1 -0
- package/dist/_chunk/table.jsx +1051 -0
- package/dist/_chunk/table.jsx.map +1 -0
- package/dist/_chunk/tabs.js +260 -0
- package/dist/_chunk/tabs.js.map +1 -0
- package/dist/_chunk/tabs.jsx +260 -0
- package/dist/_chunk/tabs.jsx.map +1 -0
- package/dist/_chunk/tag.js +286 -0
- package/dist/_chunk/tag.js.map +1 -0
- package/dist/_chunk/tag.jsx +286 -0
- package/dist/_chunk/tag.jsx.map +1 -0
- package/dist/_chunk/textfield.js +109 -0
- package/dist/_chunk/textfield.js.map +1 -0
- package/dist/_chunk/textfield.jsx +109 -0
- package/dist/_chunk/textfield.jsx.map +1 -0
- package/dist/_chunk/toast.js +250 -0
- package/dist/_chunk/toast.js.map +1 -0
- package/dist/_chunk/toast.jsx +250 -0
- package/dist/_chunk/toast.jsx.map +1 -0
- package/dist/_chunk/toolbar.js +258 -0
- package/dist/_chunk/toolbar.js.map +1 -0
- package/dist/_chunk/toolbar.jsx +258 -0
- package/dist/_chunk/toolbar.jsx.map +1 -0
- package/dist/_chunk/tooltip.js +185 -0
- package/dist/_chunk/tooltip.js.map +1 -0
- package/dist/_chunk/tooltip.jsx +185 -0
- package/dist/_chunk/tooltip.jsx.map +1 -0
- package/dist/_chunk/tree.js +424 -0
- package/dist/_chunk/tree.js.map +1 -0
- package/dist/_chunk/tree.jsx +424 -0
- package/dist/_chunk/tree.jsx.map +1 -0
- package/dist/_chunk/utils.js +665 -0
- package/dist/_chunk/utils.js.map +1 -0
- package/dist/_chunk/utils.jsx +665 -0
- package/dist/_chunk/utils.jsx.map +1 -0
- package/dist/_chunk/visually-hidden.js +92 -0
- package/dist/_chunk/visually-hidden.js.map +1 -0
- package/dist/_chunk/visually-hidden.jsx +92 -0
- package/dist/_chunk/visually-hidden.jsx.map +1 -0
- package/dist/actiongroup/createActionGroup.d.ts +5 -5
- package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
- package/dist/actiongroup/index.d.ts +1 -1
- package/dist/actiongroup/index.js +2 -0
- package/dist/actiongroup/index.jsx +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts +12 -10
- package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
- package/dist/autocomplete/index.d.ts +1 -1
- package/dist/autocomplete/index.d.ts.map +1 -1
- package/dist/autocomplete/index.js +2 -0
- package/dist/autocomplete/index.jsx +2 -0
- package/dist/breadcrumbs/createBreadcrumbs.d.ts +9 -7
- package/dist/breadcrumbs/createBreadcrumbs.d.ts.map +1 -1
- package/dist/breadcrumbs/index.d.ts +1 -1
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/index.jsx +2 -0
- package/dist/button/createButton.d.ts +1 -1
- package/dist/button/createButton.d.ts.map +1 -1
- package/dist/button/createToggleButton.d.ts +3 -3
- package/dist/button/createToggleButtonGroup.d.ts +7 -7
- package/dist/button/createToggleButtonGroup.d.ts.map +1 -1
- package/dist/button/index.d.ts +6 -6
- package/dist/button/index.d.ts.map +1 -1
- package/dist/button/index.js +2 -0
- package/dist/button/index.jsx +2 -0
- package/dist/button/types.d.ts +18 -12
- package/dist/button/types.d.ts.map +1 -1
- package/dist/calendar/createCalendar.d.ts +15 -5
- package/dist/calendar/createCalendar.d.ts.map +1 -1
- package/dist/calendar/createCalendarCell.d.ts +6 -2
- package/dist/calendar/createCalendarCell.d.ts.map +1 -1
- package/dist/calendar/createCalendarGrid.d.ts +4 -4
- package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
- package/dist/calendar/createCalendarMonthPicker.d.ts +41 -0
- package/dist/calendar/createCalendarMonthPicker.d.ts.map +1 -0
- package/dist/calendar/createCalendarYearPicker.d.ts +49 -0
- package/dist/calendar/createCalendarYearPicker.d.ts.map +1 -0
- package/dist/calendar/createRangeCalendar.d.ts +15 -5
- package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
- package/dist/calendar/createRangeCalendarCell.d.ts +4 -2
- package/dist/calendar/createRangeCalendarCell.d.ts.map +1 -1
- package/dist/calendar/index.d.ts +7 -5
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +2 -0
- package/dist/calendar/index.jsx +2 -0
- package/dist/calendar/intl/index.d.ts +12 -0
- package/dist/calendar/intl/index.d.ts.map +1 -0
- package/dist/calendar/utils.d.ts +16 -0
- package/dist/calendar/utils.d.ts.map +1 -0
- package/dist/checkbox/createCheckbox.d.ts +10 -6
- package/dist/checkbox/createCheckbox.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroup.d.ts +7 -7
- package/dist/checkbox/createCheckboxGroup.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroupItem.d.ts +4 -4
- package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroupState.d.ts +2 -2
- package/dist/checkbox/createCheckboxGroupState.d.ts.map +1 -1
- package/dist/checkbox/index.d.ts +8 -8
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox/index.jsx +2 -0
- package/dist/collections/index.d.ts +3 -3
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/collections/index.js +160 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/index.jsx +160 -0
- package/dist/collections/index.jsx.map +1 -0
- package/dist/color/createColorArea.d.ts +3 -3
- package/dist/color/createColorArea.d.ts.map +1 -1
- package/dist/color/createColorField.d.ts +4 -4
- package/dist/color/createColorField.d.ts.map +1 -1
- package/dist/color/createColorSlider.d.ts +4 -4
- package/dist/color/createColorSlider.d.ts.map +1 -1
- package/dist/color/createColorSwatch.d.ts +2 -2
- package/dist/color/createColorSwatch.d.ts.map +1 -1
- package/dist/color/createColorWheel.d.ts +3 -3
- package/dist/color/createColorWheel.d.ts.map +1 -1
- package/dist/color/index.d.ts +6 -6
- package/dist/color/index.js +2 -0
- package/dist/color/index.jsx +2 -0
- package/dist/color/types.d.ts +98 -16
- package/dist/color/types.d.ts.map +1 -1
- package/dist/combobox/createComboBox.d.ts +10 -7
- package/dist/combobox/createComboBox.d.ts.map +1 -1
- package/dist/combobox/index.d.ts +1 -1
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.jsx +2 -0
- package/dist/combobox/intl/index.d.ts +1 -1
- package/dist/datepicker/createDateField.d.ts +18 -6
- package/dist/datepicker/createDateField.d.ts.map +1 -1
- package/dist/datepicker/createDatePicker.d.ts +51 -5
- package/dist/datepicker/createDatePicker.d.ts.map +1 -1
- package/dist/datepicker/createDatePickerGroup.d.ts +19 -0
- package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -0
- package/dist/datepicker/createDateRangePicker.d.ts +8 -6
- package/dist/datepicker/createDateRangePicker.d.ts.map +1 -1
- package/dist/datepicker/createDateSegment.d.ts +10 -2
- package/dist/datepicker/createDateSegment.d.ts.map +1 -1
- package/dist/datepicker/createTimeField.d.ts +11 -5
- package/dist/datepicker/createTimeField.d.ts.map +1 -1
- package/dist/datepicker/createTimeSegment.d.ts +2 -2
- package/dist/datepicker/createTimeSegment.d.ts.map +1 -1
- package/dist/datepicker/index.d.ts +7 -6
- package/dist/datepicker/index.d.ts.map +1 -1
- package/dist/datepicker/index.js +2 -0
- package/dist/datepicker/index.jsx +2 -0
- package/dist/dialog/createDialog.d.ts +5 -5
- package/dist/dialog/createDialog.d.ts.map +1 -1
- package/dist/dialog/index.d.ts +2 -2
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +2 -0
- package/dist/dialog/index.jsx +2 -0
- package/dist/dialog/types.d.ts +4 -4
- package/dist/disclosure/createDisclosure.d.ts +5 -2
- package/dist/disclosure/createDisclosure.d.ts.map +1 -1
- package/dist/disclosure/createDisclosureGroup.d.ts +4 -4
- package/dist/disclosure/createDisclosureGroup.d.ts.map +1 -1
- package/dist/disclosure/index.d.ts +2 -2
- package/dist/disclosure/index.js +2 -0
- package/dist/disclosure/index.jsx +2 -0
- package/dist/dnd/createDrag.d.ts +2 -2
- package/dist/dnd/createDrag.d.ts.map +1 -1
- package/dist/dnd/createDraggableCollection.d.ts +2 -2
- package/dist/dnd/createDraggableItem.d.ts +3 -3
- package/dist/dnd/createDraggableItem.d.ts.map +1 -1
- package/dist/dnd/createDrop.d.ts +2 -2
- package/dist/dnd/createDrop.d.ts.map +1 -1
- package/dist/dnd/createDroppableCollection.d.ts +26 -6
- package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
- package/dist/dnd/createDroppableItem.d.ts +3 -3
- package/dist/dnd/index.d.ts +12 -12
- package/dist/dnd/index.d.ts.map +1 -1
- package/dist/dnd/index.js +2 -0
- package/dist/dnd/index.jsx +2 -0
- package/dist/dnd/types.d.ts +2 -2
- package/dist/dnd/types.d.ts.map +1 -1
- package/dist/dnd/utils.d.ts +2 -2
- package/dist/dnd/utils.d.ts.map +1 -1
- package/dist/focus/FocusScope.d.ts +1 -1
- package/dist/focus/FocusScope.d.ts.map +1 -1
- package/dist/focus/createAutoFocus.d.ts.map +1 -1
- package/dist/focus/createFocusRestore.d.ts.map +1 -1
- package/dist/focus/createVirtualFocus.d.ts +4 -4
- package/dist/focus/createVirtualFocus.d.ts.map +1 -1
- package/dist/focus/index.d.ts +4 -4
- package/dist/focus/index.d.ts.map +1 -1
- package/dist/focus/index.js +2 -0
- package/dist/focus/index.jsx +2 -0
- package/dist/form/createFormReset.d.ts +1 -1
- package/dist/form/createFormValidation.d.ts +3 -3
- package/dist/form/createFormValidation.d.ts.map +1 -1
- package/dist/form/index.d.ts +2 -2
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +3 -0
- package/dist/form/index.jsx +3 -0
- package/dist/grid/GridKeyboardDelegate.d.ts +5 -5
- package/dist/grid/createGrid.d.ts +3 -3
- package/dist/grid/createGridCell.d.ts +3 -3
- package/dist/grid/createGridRow.d.ts +3 -3
- package/dist/grid/index.d.ts +5 -5
- package/dist/grid/index.js +2 -0
- package/dist/grid/index.jsx +2 -0
- package/dist/grid/types.d.ts +8 -8
- package/dist/gridlist/createGridList.d.ts +12 -4
- package/dist/gridlist/createGridList.d.ts.map +1 -1
- package/dist/gridlist/createGridListItem.d.ts +4 -4
- package/dist/gridlist/createGridListItem.d.ts.map +1 -1
- package/dist/gridlist/createGridListSection.d.ts +15 -0
- package/dist/gridlist/createGridListSection.d.ts.map +1 -0
- package/dist/gridlist/createGridListSelectionCheckbox.d.ts +3 -3
- package/dist/gridlist/createGridListSelectionCheckbox.d.ts.map +1 -1
- package/dist/gridlist/index.d.ts +5 -4
- package/dist/gridlist/index.d.ts.map +1 -1
- package/dist/gridlist/index.js +2 -0
- package/dist/gridlist/index.jsx +2 -0
- package/dist/gridlist/types.d.ts +61 -7
- package/dist/gridlist/types.d.ts.map +1 -1
- package/dist/i18n/createCollator.d.ts.map +1 -1
- package/dist/i18n/createDateFormatter.d.ts.map +1 -1
- package/dist/i18n/createFilter.d.ts.map +1 -1
- package/dist/i18n/createNumberFormatter.d.ts +1 -1
- package/dist/i18n/createNumberFormatter.d.ts.map +1 -1
- package/dist/i18n/createStringFormatter.d.ts +2 -2
- package/dist/i18n/createStringFormatter.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +8 -8
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/index.jsx +3 -0
- package/dist/i18n/locale.d.ts +2 -2
- package/dist/i18n/locale.d.ts.map +1 -1
- package/dist/i18n/utils.d.ts.map +1 -1
- package/dist/index.d.ts +56 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -17119
- package/dist/index.jsx +71 -0
- package/dist/interactions/FocusableProvider.d.ts +2 -2
- package/dist/interactions/FocusableProvider.d.ts.map +1 -1
- package/dist/interactions/PressEvent.d.ts +13 -2
- package/dist/interactions/PressEvent.d.ts.map +1 -1
- package/dist/interactions/createFocus.d.ts +1 -1
- package/dist/interactions/createFocus.d.ts.map +1 -1
- package/dist/interactions/createFocusRing.d.ts +1 -1
- package/dist/interactions/createFocusRing.d.ts.map +1 -1
- package/dist/interactions/createFocusWithin.d.ts +1 -1
- package/dist/interactions/createFocusWithin.d.ts.map +1 -1
- package/dist/interactions/createFocusable.d.ts +3 -3
- package/dist/interactions/createFocusable.d.ts.map +1 -1
- package/dist/interactions/createHover.d.ts +5 -5
- package/dist/interactions/createHover.d.ts.map +1 -1
- package/dist/interactions/createInteractionModality.d.ts +3 -4
- package/dist/interactions/createInteractionModality.d.ts.map +1 -1
- package/dist/interactions/createKeyboard.d.ts +1 -1
- package/dist/interactions/createKeyboard.d.ts.map +1 -1
- package/dist/interactions/createLongPress.d.ts +5 -5
- package/dist/interactions/createMove.d.ts +5 -5
- package/dist/interactions/createMove.d.ts.map +1 -1
- package/dist/interactions/createPress.d.ts +4 -4
- package/dist/interactions/createPress.d.ts.map +1 -1
- package/dist/interactions/index.d.ts +12 -12
- package/dist/interactions/index.d.ts.map +1 -1
- package/dist/interactions/index.js +10 -0
- package/dist/interactions/index.jsx +10 -0
- package/dist/label/createField.d.ts +4 -4
- package/dist/label/createField.d.ts.map +1 -1
- package/dist/label/createLabel.d.ts +7 -7
- package/dist/label/createLabel.d.ts.map +1 -1
- package/dist/label/createLabels.d.ts +1 -1
- package/dist/label/createLabels.d.ts.map +1 -1
- package/dist/label/index.d.ts +5 -5
- package/dist/label/index.js +4 -0
- package/dist/label/index.jsx +4 -0
- package/dist/landmark/createLandmark.d.ts +5 -5
- package/dist/landmark/createLandmark.d.ts.map +1 -1
- package/dist/landmark/index.d.ts +1 -1
- package/dist/landmark/index.js +2 -0
- package/dist/landmark/index.jsx +2 -0
- package/dist/link/createLink.d.ts +14 -8
- package/dist/link/createLink.d.ts.map +1 -1
- package/dist/link/index.d.ts +1 -1
- package/dist/link/index.js +2 -0
- package/dist/link/index.jsx +2 -0
- package/dist/listbox/createListBox.d.ts +48 -6
- package/dist/listbox/createListBox.d.ts.map +1 -1
- package/dist/listbox/createOption.d.ts +27 -4
- package/dist/listbox/createOption.d.ts.map +1 -1
- package/dist/listbox/index.d.ts +2 -2
- package/dist/listbox/index.d.ts.map +1 -1
- package/dist/listbox/index.js +2 -0
- package/dist/listbox/index.jsx +2 -0
- package/dist/live-announcer/announce.d.ts +2 -2
- package/dist/live-announcer/announce.d.ts.map +1 -1
- package/dist/live-announcer/index.d.ts +1 -1
- package/dist/live-announcer/index.js +2 -0
- package/dist/live-announcer/index.jsx +2 -0
- package/dist/menu/createMenu.d.ts +14 -11
- package/dist/menu/createMenu.d.ts.map +1 -1
- package/dist/menu/createMenuItem.d.ts +25 -5
- package/dist/menu/createMenuItem.d.ts.map +1 -1
- package/dist/menu/createMenuTrigger.d.ts +4 -4
- package/dist/menu/index.d.ts +3 -3
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +2 -0
- package/dist/menu/index.jsx +2 -0
- package/dist/meter/createMeter.d.ts +6 -6
- package/dist/meter/createMeter.d.ts.map +1 -1
- package/dist/meter/index.d.ts +1 -1
- package/dist/meter/index.js +2 -0
- package/dist/meter/index.jsx +2 -0
- package/dist/numberfield/createNumberField.d.ts +9 -8
- package/dist/numberfield/createNumberField.d.ts.map +1 -1
- package/dist/numberfield/index.d.ts +1 -1
- package/dist/numberfield/index.js +2 -0
- package/dist/numberfield/index.jsx +2 -0
- package/dist/overlays/ariaHideOutside.d.ts.map +1 -1
- package/dist/overlays/createModal.d.ts +3 -3
- package/dist/overlays/createModal.d.ts.map +1 -1
- package/dist/overlays/createOverlay.d.ts +1 -1
- package/dist/overlays/createOverlay.d.ts.map +1 -1
- package/dist/overlays/createOverlayTrigger.d.ts +6 -6
- package/dist/overlays/index.d.ts +6 -6
- package/dist/overlays/index.d.ts.map +1 -1
- package/dist/overlays/index.js +4 -0
- package/dist/overlays/index.jsx +4 -0
- package/dist/popover/calculatePosition.d.ts +6 -4
- package/dist/popover/calculatePosition.d.ts.map +1 -1
- package/dist/popover/createOverlayPosition.d.ts +11 -3
- package/dist/popover/createOverlayPosition.d.ts.map +1 -1
- package/dist/popover/createPopover.d.ts +4 -4
- package/dist/popover/createPopover.d.ts.map +1 -1
- package/dist/popover/index.d.ts +3 -3
- package/dist/popover/index.js +2 -0
- package/dist/popover/index.jsx +2 -0
- package/dist/progress/createProgressBar.d.ts +7 -5
- package/dist/progress/createProgressBar.d.ts.map +1 -1
- package/dist/progress/index.d.ts +1 -1
- package/dist/progress/index.js +2 -0
- package/dist/progress/index.jsx +2 -0
- package/dist/radio/createRadio.d.ts +9 -7
- package/dist/radio/createRadio.d.ts.map +1 -1
- package/dist/radio/createRadioGroup.d.ts +10 -10
- package/dist/radio/createRadioGroup.d.ts.map +1 -1
- package/dist/radio/createRadioGroupState.d.ts +3 -3
- package/dist/radio/createRadioGroupState.d.ts.map +1 -1
- package/dist/radio/index.d.ts +3 -3
- package/dist/radio/index.d.ts.map +1 -1
- package/dist/radio/index.js +2 -0
- package/dist/radio/index.jsx +2 -0
- package/dist/searchfield/createSearchField.d.ts +7 -7
- package/dist/searchfield/createSearchField.d.ts.map +1 -1
- package/dist/searchfield/index.d.ts +2 -2
- package/dist/searchfield/index.js +2 -0
- package/dist/searchfield/index.jsx +2 -0
- package/dist/select/createHiddenSelect.d.ts +4 -4
- package/dist/select/createHiddenSelect.d.ts.map +1 -1
- package/dist/select/createSelect.d.ts +14 -6
- package/dist/select/createSelect.d.ts.map +1 -1
- package/dist/select/index.d.ts +2 -2
- package/dist/select/index.d.ts.map +1 -1
- package/dist/select/index.js +2 -0
- package/dist/select/index.jsx +2 -0
- package/dist/selection/DOMLayoutDelegate.d.ts +58 -0
- package/dist/selection/DOMLayoutDelegate.d.ts.map +1 -0
- package/dist/selection/ListKeyboardDelegate.d.ts +95 -0
- package/dist/selection/ListKeyboardDelegate.d.ts.map +1 -0
- package/dist/selection/constants.d.ts +15 -0
- package/dist/selection/constants.d.ts.map +1 -0
- package/dist/selection/createCollectionRowInteraction.d.ts +13 -0
- package/dist/selection/createCollectionRowInteraction.d.ts.map +1 -0
- package/dist/selection/createScrollIntoViewOnFocus.d.ts +31 -0
- package/dist/selection/createScrollIntoViewOnFocus.d.ts.map +1 -0
- package/dist/selection/createSelectableCollection.d.ts +69 -0
- package/dist/selection/createSelectableCollection.d.ts.map +1 -0
- package/dist/selection/createSelectableItem.d.ts +154 -0
- package/dist/selection/createSelectableItem.d.ts.map +1 -0
- package/dist/selection/createSelectableList.d.ts +43 -0
- package/dist/selection/createSelectableList.d.ts.map +1 -0
- package/dist/selection/createTypeSelect.d.ts +2 -2
- package/dist/selection/createTypeSelect.d.ts.map +1 -1
- package/dist/selection/index.d.ts +10 -1
- package/dist/selection/index.d.ts.map +1 -1
- package/dist/selection/index.js +4 -0
- package/dist/selection/index.jsx +4 -0
- package/dist/selection/selectItem.d.ts +29 -0
- package/dist/selection/selectItem.d.ts.map +1 -0
- package/dist/selection/utils.d.ts +40 -0
- package/dist/selection/utils.d.ts.map +1 -0
- package/dist/separator/createSeparator.d.ts +9 -5
- package/dist/separator/createSeparator.d.ts.map +1 -1
- package/dist/separator/index.d.ts +1 -1
- package/dist/separator/index.js +2 -0
- package/dist/separator/index.jsx +2 -0
- package/dist/slider/createSlider.d.ts +11 -7
- package/dist/slider/createSlider.d.ts.map +1 -1
- package/dist/slider/index.d.ts +2 -2
- package/dist/slider/index.js +2 -0
- package/dist/slider/index.jsx +2 -0
- package/dist/ssr/index.d.ts +18 -1
- package/dist/ssr/index.d.ts.map +1 -1
- package/dist/ssr/index.js +299 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/index.jsx +292 -0
- package/dist/ssr/index.jsx.map +1 -0
- package/dist/steplist/createStepList.d.ts +36 -0
- package/dist/steplist/createStepList.d.ts.map +1 -0
- package/dist/steplist/index.d.ts +2 -0
- package/dist/steplist/index.d.ts.map +1 -0
- package/dist/steplist/index.js +2 -0
- package/dist/steplist/index.jsx +2 -0
- package/dist/switch/createSwitch.d.ts +10 -4
- package/dist/switch/createSwitch.d.ts.map +1 -1
- package/dist/switch/index.d.ts +1 -1
- package/dist/switch/index.js +2 -0
- package/dist/switch/index.jsx +2 -0
- package/dist/table/createTable.d.ts +3 -3
- package/dist/table/createTable.d.ts.map +1 -1
- package/dist/table/createTableCell.d.ts +3 -3
- package/dist/table/createTableCell.d.ts.map +1 -1
- package/dist/table/createTableColumnHeader.d.ts +3 -3
- package/dist/table/createTableColumnHeader.d.ts.map +1 -1
- package/dist/table/createTableColumnResize.d.ts +41 -0
- package/dist/table/createTableColumnResize.d.ts.map +1 -0
- package/dist/table/createTableHeaderRow.d.ts +3 -3
- package/dist/table/createTableRow.d.ts +4 -4
- package/dist/table/createTableRow.d.ts.map +1 -1
- package/dist/table/createTableRowGroup.d.ts +2 -2
- package/dist/table/createTableRowGroup.d.ts.map +1 -1
- package/dist/table/createTableSelectAllCheckbox.d.ts +3 -3
- package/dist/table/createTableSelectionCheckbox.d.ts +3 -3
- package/dist/table/index.d.ts +11 -9
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +2 -0
- package/dist/table/index.jsx +2 -0
- package/dist/table/types.d.ts +41 -7
- package/dist/table/types.d.ts.map +1 -1
- package/dist/tabs/createTabs.d.ts +32 -28
- package/dist/tabs/createTabs.d.ts.map +1 -1
- package/dist/tabs/index.d.ts +1 -1
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/index.jsx +2 -0
- package/dist/tag/createTag.d.ts +4 -2
- package/dist/tag/createTag.d.ts.map +1 -1
- package/dist/tag/createTagGroup.d.ts +5 -5
- package/dist/tag/createTagGroup.d.ts.map +1 -1
- package/dist/tag/index.d.ts +2 -2
- package/dist/tag/index.d.ts.map +1 -1
- package/dist/tag/index.js +2 -0
- package/dist/tag/index.jsx +2 -0
- package/dist/textfield/createTextField.d.ts +17 -11
- package/dist/textfield/createTextField.d.ts.map +1 -1
- package/dist/textfield/index.d.ts +1 -1
- package/dist/textfield/index.d.ts.map +1 -1
- package/dist/textfield/index.js +2 -0
- package/dist/textfield/index.jsx +2 -0
- package/dist/toast/createToast.d.ts +2 -2
- package/dist/toast/createToast.d.ts.map +1 -1
- package/dist/toast/createToastRegion.d.ts +5 -3
- package/dist/toast/createToastRegion.d.ts.map +1 -1
- package/dist/toast/index.d.ts +2 -2
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +2 -0
- package/dist/toast/index.jsx +2 -0
- package/dist/toggle/createToggle.d.ts +13 -9
- package/dist/toggle/createToggle.d.ts.map +1 -1
- package/dist/toggle/createToggleState.d.ts +2 -2
- package/dist/toggle/createToggleState.d.ts.map +1 -1
- package/dist/toggle/index.d.ts +4 -4
- package/dist/toggle/index.d.ts.map +1 -1
- package/dist/toggle/index.js +3 -0
- package/dist/toggle/index.jsx +3 -0
- package/dist/toolbar/createToolbar.d.ts +9 -9
- package/dist/toolbar/createToolbar.d.ts.map +1 -1
- package/dist/toolbar/index.d.ts +1 -1
- package/dist/toolbar/index.d.ts.map +1 -1
- package/dist/toolbar/index.js +2 -0
- package/dist/toolbar/index.jsx +2 -0
- package/dist/tooltip/createTooltip.d.ts +5 -5
- package/dist/tooltip/createTooltip.d.ts.map +1 -1
- package/dist/tooltip/createTooltipTrigger.d.ts +10 -5
- package/dist/tooltip/createTooltipTrigger.d.ts.map +1 -1
- package/dist/tooltip/index.d.ts +2 -2
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/index.jsx +2 -0
- package/dist/tree/createTree.d.ts +8 -4
- package/dist/tree/createTree.d.ts.map +1 -1
- package/dist/tree/createTreeItem.d.ts +4 -4
- package/dist/tree/createTreeItem.d.ts.map +1 -1
- package/dist/tree/createTreeSelectionCheckbox.d.ts +3 -3
- package/dist/tree/createTreeSelectionCheckbox.d.ts.map +1 -1
- package/dist/tree/index.d.ts +4 -4
- package/dist/tree/index.js +2 -0
- package/dist/tree/index.jsx +2 -0
- package/dist/tree/types.d.ts +20 -6
- package/dist/tree/types.d.ts.map +1 -1
- package/dist/utils/animation.d.ts +60 -0
- package/dist/utils/animation.d.ts.map +1 -0
- package/dist/utils/createDescription.d.ts +2 -2
- package/dist/utils/createDescription.d.ts.map +1 -1
- package/dist/utils/dom.d.ts +48 -2
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/focus.d.ts +1 -1
- package/dist/utils/focus.d.ts.map +1 -1
- package/dist/utils/geometry.d.ts.map +1 -1
- package/dist/utils/index.d.ts +15 -12
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.jsx +5 -0
- package/dist/utils/keyboard.d.ts +17 -0
- package/dist/utils/keyboard.d.ts.map +1 -0
- package/dist/utils/mergeProps.d.ts.map +1 -1
- package/dist/utils/reactivity.d.ts +1 -1
- package/dist/utils/scrollIntoView.d.ts +30 -0
- package/dist/utils/scrollIntoView.d.ts.map +1 -0
- package/dist/visually-hidden/createVisuallyHidden.d.ts +2 -2
- package/dist/visually-hidden/createVisuallyHidden.d.ts.map +1 -1
- package/dist/visually-hidden/index.d.ts +1 -1
- package/dist/visually-hidden/index.js +2 -0
- package/dist/visually-hidden/index.jsx +2 -0
- package/package.json +334 -33
- package/src/actiongroup/createActionGroup.ts +101 -91
- package/src/actiongroup/index.ts +1 -1
- package/src/autocomplete/createAutocomplete.ts +177 -148
- package/src/autocomplete/index.ts +1 -1
- package/src/breadcrumbs/createBreadcrumbs.ts +33 -42
- package/src/breadcrumbs/index.ts +1 -1
- package/src/button/createButton.ts +102 -73
- package/src/button/createToggleButton.ts +10 -10
- package/src/button/createToggleButtonGroup.ts +25 -32
- package/src/button/index.ts +6 -9
- package/src/button/types.ts +18 -12
- package/src/calendar/createCalendar.ts +64 -29
- package/src/calendar/createCalendarCell.ts +115 -46
- package/src/calendar/createCalendarGrid.ts +97 -41
- package/src/calendar/createCalendarMonthPicker.ts +105 -0
- package/src/calendar/createCalendarYearPicker.ts +144 -0
- package/src/calendar/createRangeCalendar.ts +68 -31
- package/src/calendar/createRangeCalendarCell.ts +92 -31
- package/src/calendar/index.ts +21 -8
- package/src/calendar/intl/index.ts +210 -0
- package/src/calendar/utils.ts +231 -0
- package/src/checkbox/createCheckbox.ts +23 -21
- package/src/checkbox/createCheckboxGroup.ts +68 -44
- package/src/checkbox/createCheckboxGroupItem.ts +26 -41
- package/src/checkbox/createCheckboxGroupState.ts +3 -22
- package/src/checkbox/index.ts +8 -10
- package/src/collections/index.ts +33 -29
- package/src/color/createColorArea.ts +232 -154
- package/src/color/createColorField.ts +107 -58
- package/src/color/createColorSlider.ts +231 -73
- package/src/color/createColorSwatch.ts +38 -13
- package/src/color/createColorWheel.ts +208 -83
- package/src/color/index.ts +6 -6
- package/src/color/types.ts +98 -16
- package/src/combobox/createComboBox.ts +157 -100
- package/src/combobox/index.ts +1 -1
- package/src/combobox/intl/index.ts +5 -5
- package/src/datepicker/createDateField.ts +192 -39
- package/src/datepicker/createDatePicker.ts +260 -67
- package/src/datepicker/createDatePickerGroup.ts +149 -0
- package/src/datepicker/createDateRangePicker.ts +105 -57
- package/src/datepicker/createDateSegment.ts +188 -96
- package/src/datepicker/createTimeField.ts +38 -34
- package/src/datepicker/createTimeSegment.ts +67 -85
- package/src/datepicker/index.ts +13 -14
- package/src/dialog/createDialog.ts +45 -38
- package/src/dialog/index.ts +2 -2
- package/src/dialog/types.ts +4 -4
- package/src/disclosure/createDisclosure.ts +138 -33
- package/src/disclosure/createDisclosureGroup.ts +8 -21
- package/src/disclosure/index.ts +2 -2
- package/src/dnd/createDrag.ts +19 -25
- package/src/dnd/createDraggableCollection.ts +4 -4
- package/src/dnd/createDraggableItem.ts +20 -19
- package/src/dnd/createDrop.ts +42 -51
- package/src/dnd/createDroppableCollection.ts +293 -173
- package/src/dnd/createDroppableItem.ts +34 -34
- package/src/dnd/index.ts +23 -12
- package/src/dnd/types.ts +4 -7
- package/src/dnd/utils.ts +58 -47
- package/src/focus/FocusScope.tsx +301 -176
- package/src/focus/createAutoFocus.ts +4 -20
- package/src/focus/createFocusRestore.ts +15 -28
- package/src/focus/createVirtualFocus.ts +20 -36
- package/src/focus/index.ts +4 -8
- package/src/form/createFormReset.ts +4 -4
- package/src/form/createFormValidation.ts +23 -39
- package/src/form/index.ts +2 -5
- package/src/grid/GridKeyboardDelegate.ts +30 -30
- package/src/grid/createGrid.ts +36 -36
- package/src/grid/createGridCell.ts +18 -18
- package/src/grid/createGridRow.ts +14 -14
- package/src/grid/index.ts +5 -5
- package/src/grid/types.ts +8 -8
- package/src/gridlist/createGridList.ts +172 -64
- package/src/gridlist/createGridListItem.ts +98 -121
- package/src/gridlist/createGridListSection.ts +54 -0
- package/src/gridlist/createGridListSelectionCheckbox.ts +12 -9
- package/src/gridlist/index.ts +7 -4
- package/src/gridlist/types.ts +58 -7
- package/src/i18n/createCollator.ts +5 -18
- package/src/i18n/createDateFormatter.ts +5 -13
- package/src/i18n/createFilter.ts +11 -24
- package/src/i18n/createNumberFormatter.ts +4 -6
- package/src/i18n/createStringFormatter.ts +19 -15
- package/src/i18n/index.ts +8 -11
- package/src/i18n/locale.tsx +15 -40
- package/src/i18n/utils.ts +35 -39
- package/src/index.ts +111 -172
- package/src/interactions/FocusableProvider.tsx +3 -7
- package/src/interactions/PressEvent.ts +18 -4
- package/src/interactions/createFocus.ts +12 -8
- package/src/interactions/createFocusRing.ts +21 -19
- package/src/interactions/createFocusWithin.ts +20 -13
- package/src/interactions/createFocusable.ts +15 -16
- package/src/interactions/createHover.ts +70 -55
- package/src/interactions/createInteractionModality.ts +96 -94
- package/src/interactions/createKeyboard.ts +12 -2
- package/src/interactions/createLongPress.ts +23 -23
- package/src/interactions/createMove.ts +72 -62
- package/src/interactions/createPress.ts +192 -92
- package/src/interactions/index.ts +24 -16
- package/src/label/createField.ts +18 -19
- package/src/label/createLabel.ts +18 -30
- package/src/label/createLabels.ts +8 -12
- package/src/label/index.ts +5 -5
- package/src/landmark/createLandmark.ts +30 -51
- package/src/landmark/index.ts +1 -1
- package/src/link/createLink.ts +83 -56
- package/src/link/index.ts +1 -1
- package/src/listbox/createListBox.ts +198 -66
- package/src/listbox/createOption.ts +112 -71
- package/src/listbox/index.ts +2 -6
- package/src/live-announcer/announce.ts +44 -71
- package/src/live-announcer/index.ts +1 -1
- package/src/menu/createMenu.ts +171 -65
- package/src/menu/createMenuItem.ts +315 -51
- package/src/menu/createMenuTrigger.ts +15 -15
- package/src/menu/index.ts +3 -12
- package/src/meter/createMeter.ts +7 -15
- package/src/meter/index.ts +1 -1
- package/src/numberfield/createNumberField.ts +205 -80
- package/src/numberfield/index.ts +1 -1
- package/src/overlays/ariaHideOutside.ts +14 -10
- package/src/overlays/createInteractOutside.ts +21 -18
- package/src/overlays/createModal.tsx +17 -17
- package/src/overlays/createOverlay.ts +38 -8
- package/src/overlays/createOverlayTrigger.ts +16 -16
- package/src/overlays/createPreventScroll.ts +46 -24
- package/src/overlays/index.ts +6 -17
- package/src/popover/calculatePosition.ts +134 -124
- package/src/popover/createOverlayPosition.ts +55 -40
- package/src/popover/createPopover.ts +42 -17
- package/src/popover/index.ts +3 -3
- package/src/progress/createProgressBar.ts +31 -32
- package/src/progress/index.ts +1 -1
- package/src/radio/createRadio.ts +114 -75
- package/src/radio/createRadioGroup.ts +83 -77
- package/src/radio/createRadioGroupState.ts +7 -31
- package/src/radio/index.ts +3 -8
- package/src/searchfield/createSearchField.ts +57 -29
- package/src/searchfield/index.ts +2 -2
- package/src/select/createHiddenSelect.tsx +57 -44
- package/src/select/createSelect.ts +146 -73
- package/src/select/index.ts +2 -7
- package/src/selection/DOMLayoutDelegate.ts +102 -0
- package/src/selection/ListKeyboardDelegate.ts +398 -0
- package/src/selection/constants.ts +16 -0
- package/src/selection/createCollectionRowInteraction.ts +209 -0
- package/src/selection/createScrollIntoViewOnFocus.ts +65 -0
- package/src/selection/createSelectableCollection.ts +645 -0
- package/src/selection/createSelectableItem.ts +498 -0
- package/src/selection/createSelectableList.ts +93 -0
- package/src/selection/createTypeSelect.ts +120 -59
- package/src/selection/index.ts +32 -1
- package/src/selection/selectItem.ts +80 -0
- package/src/selection/utils.ts +82 -0
- package/src/separator/createSeparator.ts +20 -25
- package/src/separator/index.ts +1 -1
- package/src/slider/createSlider.ts +128 -112
- package/src/slider/index.ts +2 -2
- package/src/ssr/index.tsx +38 -46
- package/src/steplist/createStepList.ts +106 -0
- package/src/steplist/index.ts +8 -0
- package/src/switch/createSwitch.ts +19 -14
- package/src/switch/index.ts +1 -1
- package/src/table/createTable.ts +192 -95
- package/src/table/createTableCell.ts +17 -16
- package/src/table/createTableColumnHeader.ts +67 -20
- package/src/table/createTableColumnResize.ts +256 -0
- package/src/table/createTableHeaderRow.ts +7 -7
- package/src/table/createTableRow.ts +206 -91
- package/src/table/createTableRowGroup.ts +5 -7
- package/src/table/createTableSelectAllCheckbox.ts +14 -14
- package/src/table/createTableSelectionCheckbox.ts +8 -8
- package/src/table/index.ts +14 -9
- package/src/table/types.ts +43 -7
- package/src/tabs/createTabs.ts +123 -111
- package/src/tabs/index.ts +1 -1
- package/src/tag/createTag.ts +57 -50
- package/src/tag/createTagGroup.ts +47 -41
- package/src/tag/index.ts +2 -6
- package/src/textfield/createTextField.ts +67 -35
- package/src/textfield/index.ts +1 -5
- package/src/toast/createToast.ts +29 -26
- package/src/toast/createToastRegion.ts +169 -26
- package/src/toast/index.ts +2 -6
- package/src/toggle/createToggle.ts +115 -53
- package/src/toggle/createToggleState.ts +2 -10
- package/src/toggle/index.ts +4 -5
- package/src/toolbar/createToolbar.ts +214 -230
- package/src/toolbar/index.ts +1 -1
- package/src/tooltip/createTooltip.ts +11 -24
- package/src/tooltip/createTooltipTrigger.ts +61 -49
- package/src/tooltip/index.ts +2 -2
- package/src/tree/createTree.ts +128 -72
- package/src/tree/createTreeItem.ts +120 -135
- package/src/tree/createTreeSelectionCheckbox.ts +11 -8
- package/src/tree/index.ts +4 -4
- package/src/tree/types.ts +20 -6
- package/src/utils/animation.ts +151 -0
- package/src/utils/createDescription.ts +6 -23
- package/src/utils/dom.ts +265 -68
- package/src/utils/env.ts +9 -11
- package/src/utils/events.ts +7 -7
- package/src/utils/filterDOMProps.ts +49 -49
- package/src/utils/focus.ts +60 -68
- package/src/utils/geometry.ts +1 -4
- package/src/utils/globalListeners.ts +9 -9
- package/src/utils/index.ts +20 -22
- package/src/utils/keyboard.ts +25 -0
- package/src/utils/mergeProps.ts +49 -15
- package/src/utils/platform.ts +2 -2
- package/src/utils/reactivity.ts +3 -3
- package/src/utils/scrollIntoView.ts +181 -0
- package/src/utils/textSelection.ts +16 -16
- package/src/visually-hidden/createVisuallyHidden.ts +16 -28
- package/src/visually-hidden/index.ts +1 -1
- package/dist/i18n/NumberFormatter.d.ts +0 -43
- package/dist/i18n/NumberFormatter.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.ssr.js +0 -17082
- package/dist/index.ssr.js.map +0 -1
- package/src/i18n/NumberFormatter.ts +0 -266
|
@@ -0,0 +1,895 @@
|
|
|
1
|
+
import { g as isTabbable, p as isFocusable, s as getOwnerDocument, t as focusSafely } from "./focus.js";
|
|
2
|
+
import { createContext, createEffect, createSignal, onCleanup, onMount, useContext } from "solid-js";
|
|
3
|
+
import { createComponent, getNextElement, isServer, memo, template, use } from "solid-js/web";
|
|
4
|
+
//#region src/focus/FocusScope.tsx
|
|
5
|
+
/**
|
|
6
|
+
* FocusScope component for managing focus containment, restoration, and auto-focus.
|
|
7
|
+
* Based on @react-aria/focus FocusScope.
|
|
8
|
+
*/
|
|
9
|
+
var _tmpl$ = /*#__PURE__*/ template(`<span data-focus-scope-start hidden>`), _tmpl$2 = /*#__PURE__*/ template(`<span data-focus-scope-end hidden>`);
|
|
10
|
+
const FocusScopeContext = createContext(null);
|
|
11
|
+
/**
|
|
12
|
+
* Returns a FocusManager interface for the parent FocusScope.
|
|
13
|
+
* A FocusManager can be used to programmatically move focus within
|
|
14
|
+
* a FocusScope, e.g. in response to user events like keyboard navigation.
|
|
15
|
+
*/
|
|
16
|
+
function useFocusManager() {
|
|
17
|
+
return useContext(FocusScopeContext)?.focusManager;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets all focusable elements within a scope.
|
|
21
|
+
*/
|
|
22
|
+
function getFocusableElements(scope, tabbable = false) {
|
|
23
|
+
const elements = [];
|
|
24
|
+
const filter = tabbable ? isTabbable : isFocusable;
|
|
25
|
+
for (const scopeElement of scope) {
|
|
26
|
+
if (filter(scopeElement)) elements.push(scopeElement);
|
|
27
|
+
const descendants = scopeElement.querySelectorAll("*");
|
|
28
|
+
for (let i = 0; i < descendants.length; i++) {
|
|
29
|
+
const el = descendants[i];
|
|
30
|
+
if (filter(el)) elements.push(el);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return elements;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Checks if an element is within a scope.
|
|
37
|
+
*/
|
|
38
|
+
function isElementInScope(element, scope) {
|
|
39
|
+
if (!element) return false;
|
|
40
|
+
return scope.some((node) => node.contains(element));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the active element, accounting for shadow DOM.
|
|
44
|
+
*/
|
|
45
|
+
function getActiveElement$1(doc) {
|
|
46
|
+
let activeElement = doc.activeElement;
|
|
47
|
+
while (activeElement?.shadowRoot?.activeElement) activeElement = activeElement.shadowRoot.activeElement;
|
|
48
|
+
return activeElement;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A registry of the live FocusScopes and their parent/child relationships,
|
|
52
|
+
* mirroring @react-aria/focus's `focusScopeTree`. The DOM tree alone can't
|
|
53
|
+
* express scope nesting because a child scope (e.g. a menu opened from inside a
|
|
54
|
+
* modal popover) is rendered in a portal, outside its parent scope's subtree.
|
|
55
|
+
* The tree records that nesting so containment can recognize a portaled
|
|
56
|
+
* descendant scope as "inside".
|
|
57
|
+
*/
|
|
58
|
+
var FocusScopeTree = class {
|
|
59
|
+
root;
|
|
60
|
+
fastMap = /* @__PURE__ */ new Map();
|
|
61
|
+
constructor() {
|
|
62
|
+
this.root = {
|
|
63
|
+
scopeRef: null,
|
|
64
|
+
parent: null,
|
|
65
|
+
children: /* @__PURE__ */ new Set()
|
|
66
|
+
};
|
|
67
|
+
this.fastMap.set(null, this.root);
|
|
68
|
+
}
|
|
69
|
+
getTreeNode(scopeRef) {
|
|
70
|
+
return this.fastMap.get(scopeRef);
|
|
71
|
+
}
|
|
72
|
+
addTreeNode(scopeRef, parent) {
|
|
73
|
+
const parentNode = this.fastMap.get(parent) ?? this.root;
|
|
74
|
+
const node = {
|
|
75
|
+
scopeRef,
|
|
76
|
+
parent: parentNode,
|
|
77
|
+
children: /* @__PURE__ */ new Set()
|
|
78
|
+
};
|
|
79
|
+
parentNode.children.add(node);
|
|
80
|
+
this.fastMap.set(scopeRef, node);
|
|
81
|
+
}
|
|
82
|
+
removeTreeNode(scopeRef) {
|
|
83
|
+
if (scopeRef === null) return;
|
|
84
|
+
const node = this.fastMap.get(scopeRef);
|
|
85
|
+
if (!node) return;
|
|
86
|
+
const parentNode = node.parent;
|
|
87
|
+
if (parentNode) {
|
|
88
|
+
parentNode.children.delete(node);
|
|
89
|
+
for (const child of node.children) {
|
|
90
|
+
child.parent = parentNode;
|
|
91
|
+
parentNode.children.add(child);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
this.fastMap.delete(scopeRef);
|
|
95
|
+
}
|
|
96
|
+
*traverse(node = this.root) {
|
|
97
|
+
if (node.scopeRef != null) yield node;
|
|
98
|
+
for (const child of node.children) yield* this.traverse(child);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const focusScopeTree = new FocusScopeTree();
|
|
102
|
+
/**
|
|
103
|
+
* Whether the element is inside `scope` or any of its descendant scopes.
|
|
104
|
+
*
|
|
105
|
+
* `isElementInScope`'s `node.contains` already covers descendant scopes that
|
|
106
|
+
* are DOM children, but not those rendered in a portal. Walking the scope
|
|
107
|
+
* subtree closes that gap so focus moving into a portaled child scope still
|
|
108
|
+
* counts as "inside". Mirrors @react-aria/focus's `isElementInChildScope`.
|
|
109
|
+
*/
|
|
110
|
+
function isElementInChildScope(element, scope = null) {
|
|
111
|
+
if (element instanceof Element && element.closest("[data-react-aria-top-layer]")) return true;
|
|
112
|
+
for (const node of focusScopeTree.traverse(focusScopeTree.getTreeNode(scope))) if (node.scopeRef && isElementInScope(element, node.scopeRef())) return true;
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A FocusScope manages focus for its descendants. It supports containing focus inside
|
|
117
|
+
* the scope, restoring focus to the previously focused element on unmount, and auto
|
|
118
|
+
* focusing children on mount. It also acts as a container for a programmatic focus
|
|
119
|
+
* management interface that can be used to move focus forward and back in response
|
|
120
|
+
* to user events.
|
|
121
|
+
*/
|
|
122
|
+
const FocusScope = (props) => {
|
|
123
|
+
if (isServer) return memo(() => props.children);
|
|
124
|
+
let startRef;
|
|
125
|
+
let endRef;
|
|
126
|
+
const [scopeElements, setScopeElements] = createSignal([]);
|
|
127
|
+
const parentScopeRef = useContext(FocusScopeContext)?.scopeRef ?? null;
|
|
128
|
+
let nodeToRestore = null;
|
|
129
|
+
const getRestorableElement = (element, doc) => {
|
|
130
|
+
if (!element || element === doc.body || element === doc.documentElement) return null;
|
|
131
|
+
return element;
|
|
132
|
+
};
|
|
133
|
+
const focusManager = {
|
|
134
|
+
focusNext(opts = {}) {
|
|
135
|
+
const scope = scopeElements();
|
|
136
|
+
if (scope.length === 0) return null;
|
|
137
|
+
const { from, tabbable = true, wrap = false, accept } = opts;
|
|
138
|
+
const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));
|
|
139
|
+
const doc = getOwnerDocument(scope[0]);
|
|
140
|
+
const current = from || getActiveElement$1(doc);
|
|
141
|
+
if (!current || elements.length === 0) return null;
|
|
142
|
+
let nextIndex = elements.indexOf(current) + 1;
|
|
143
|
+
if (nextIndex >= elements.length) if (wrap) nextIndex = 0;
|
|
144
|
+
else return null;
|
|
145
|
+
const nextElement = elements[nextIndex];
|
|
146
|
+
if (nextElement) {
|
|
147
|
+
focusSafely(nextElement);
|
|
148
|
+
return nextElement;
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
},
|
|
152
|
+
focusPrevious(opts = {}) {
|
|
153
|
+
const scope = scopeElements();
|
|
154
|
+
if (scope.length === 0) return null;
|
|
155
|
+
const { from, tabbable = true, wrap = false, accept } = opts;
|
|
156
|
+
const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));
|
|
157
|
+
const doc = getOwnerDocument(scope[0]);
|
|
158
|
+
const current = from || getActiveElement$1(doc);
|
|
159
|
+
if (!current || elements.length === 0) return null;
|
|
160
|
+
let prevIndex = elements.indexOf(current) - 1;
|
|
161
|
+
if (prevIndex < 0) if (wrap) prevIndex = elements.length - 1;
|
|
162
|
+
else return null;
|
|
163
|
+
const prevElement = elements[prevIndex];
|
|
164
|
+
if (prevElement) {
|
|
165
|
+
focusSafely(prevElement);
|
|
166
|
+
return prevElement;
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
},
|
|
170
|
+
focusFirst(opts = {}) {
|
|
171
|
+
const scope = scopeElements();
|
|
172
|
+
if (scope.length === 0) return null;
|
|
173
|
+
const { tabbable = true, accept } = opts;
|
|
174
|
+
const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));
|
|
175
|
+
if (elements.length > 0) {
|
|
176
|
+
focusSafely(elements[0]);
|
|
177
|
+
return elements[0];
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
},
|
|
181
|
+
focusLast(opts = {}) {
|
|
182
|
+
const scope = scopeElements();
|
|
183
|
+
if (scope.length === 0) return null;
|
|
184
|
+
const { tabbable = true, accept } = opts;
|
|
185
|
+
const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));
|
|
186
|
+
if (elements.length > 0) {
|
|
187
|
+
const lastElement = elements[elements.length - 1];
|
|
188
|
+
focusSafely(lastElement);
|
|
189
|
+
return lastElement;
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
onMount(() => {
|
|
195
|
+
if (!startRef || !endRef) return;
|
|
196
|
+
const nodes = [];
|
|
197
|
+
let node = startRef.nextSibling;
|
|
198
|
+
while (node && node !== endRef) {
|
|
199
|
+
if (node.nodeType === Node.ELEMENT_NODE) nodes.push(node);
|
|
200
|
+
node = node.nextSibling;
|
|
201
|
+
}
|
|
202
|
+
setScopeElements(nodes);
|
|
203
|
+
});
|
|
204
|
+
onMount(() => {
|
|
205
|
+
focusScopeTree.addTreeNode(scopeElements, parentScopeRef);
|
|
206
|
+
});
|
|
207
|
+
onCleanup(() => {
|
|
208
|
+
focusScopeTree.removeTreeNode(scopeElements);
|
|
209
|
+
});
|
|
210
|
+
onMount(() => {
|
|
211
|
+
if (!props.restoreFocus) return;
|
|
212
|
+
const scopeDoc = startRef ? getOwnerDocument(startRef) : document;
|
|
213
|
+
const scopeActive = getActiveElement$1(scopeDoc);
|
|
214
|
+
const topActive = getActiveElement$1(document);
|
|
215
|
+
if (scopeDoc !== document && document.activeElement instanceof HTMLIFrameElement && document.activeElement.contentDocument === scopeDoc && scopeActive && scopeActive !== scopeDoc.body) {
|
|
216
|
+
nodeToRestore = getRestorableElement(scopeActive, scopeDoc);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
nodeToRestore = getRestorableElement(topActive, document);
|
|
220
|
+
});
|
|
221
|
+
createEffect(() => {
|
|
222
|
+
if (!props.autoFocus) return;
|
|
223
|
+
const scope = scopeElements();
|
|
224
|
+
if (scope.length === 0) return;
|
|
225
|
+
if (!isElementInScope(getActiveElement$1(getOwnerDocument(scope[0])), scope)) focusManager.focusFirst();
|
|
226
|
+
});
|
|
227
|
+
createEffect(() => {
|
|
228
|
+
if (!props.contain) return;
|
|
229
|
+
const scope = scopeElements();
|
|
230
|
+
if (scope.length === 0) return;
|
|
231
|
+
const doc = getOwnerDocument(scope[0]);
|
|
232
|
+
let focusedNode = null;
|
|
233
|
+
const onKeyDown = (e) => {
|
|
234
|
+
if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
235
|
+
const scope = scopeElements();
|
|
236
|
+
const activeElement = getActiveElement$1(doc);
|
|
237
|
+
if (!isElementInScope(activeElement, scope)) return;
|
|
238
|
+
const elements = getFocusableElements(scope, true);
|
|
239
|
+
if (elements.length === 0) return;
|
|
240
|
+
const firstElement = elements[0];
|
|
241
|
+
const lastElement = elements[elements.length - 1];
|
|
242
|
+
if (e.shiftKey && activeElement === firstElement) {
|
|
243
|
+
e.preventDefault();
|
|
244
|
+
focusSafely(lastElement);
|
|
245
|
+
} else if (!e.shiftKey && activeElement === lastElement) {
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
focusSafely(firstElement);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
const onFocusIn = (e) => {
|
|
251
|
+
const scope = scopeElements();
|
|
252
|
+
const target = e.target;
|
|
253
|
+
if (isElementInScope(target, scope)) focusedNode = target;
|
|
254
|
+
else if (isElementInChildScope(target, scopeElements)) focusedNode = target;
|
|
255
|
+
else if (focusedNode) focusSafely(focusedNode);
|
|
256
|
+
else focusManager.focusFirst();
|
|
257
|
+
};
|
|
258
|
+
let restoreRaf = null;
|
|
259
|
+
const onFocusOut = (e) => {
|
|
260
|
+
const target = e.target;
|
|
261
|
+
if (!isElementInScope(target, scopeElements())) return;
|
|
262
|
+
const win = doc.defaultView ?? window;
|
|
263
|
+
if (restoreRaf != null) win.cancelAnimationFrame(restoreRaf);
|
|
264
|
+
restoreRaf = win.requestAnimationFrame(() => {
|
|
265
|
+
restoreRaf = null;
|
|
266
|
+
const scope = scopeElements();
|
|
267
|
+
const activeElement = getActiveElement$1(doc);
|
|
268
|
+
if (activeElement && (isElementInScope(activeElement, scope) || isElementInChildScope(activeElement, scopeElements))) return;
|
|
269
|
+
if (doc.body.contains(target)) {
|
|
270
|
+
focusedNode = target;
|
|
271
|
+
focusSafely(target);
|
|
272
|
+
} else focusManager.focusFirst();
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
doc.addEventListener("keydown", onKeyDown, true);
|
|
276
|
+
doc.addEventListener("focusin", onFocusIn, true);
|
|
277
|
+
doc.addEventListener("focusout", onFocusOut, true);
|
|
278
|
+
onCleanup(() => {
|
|
279
|
+
doc.removeEventListener("keydown", onKeyDown, true);
|
|
280
|
+
doc.removeEventListener("focusin", onFocusIn, true);
|
|
281
|
+
doc.removeEventListener("focusout", onFocusOut, true);
|
|
282
|
+
if (restoreRaf != null) (doc.defaultView ?? window).cancelAnimationFrame(restoreRaf);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
onCleanup(() => {
|
|
286
|
+
if (props.restoreFocus && nodeToRestore && nodeToRestore.focus) {
|
|
287
|
+
const doc = getOwnerDocument(nodeToRestore);
|
|
288
|
+
(doc.defaultView ?? window).requestAnimationFrame(() => {
|
|
289
|
+
if (nodeToRestore && doc.body.contains(nodeToRestore)) nodeToRestore.focus();
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
return createComponent(FocusScopeContext.Provider, {
|
|
294
|
+
value: {
|
|
295
|
+
focusManager,
|
|
296
|
+
scopeRef: scopeElements
|
|
297
|
+
},
|
|
298
|
+
get children() {
|
|
299
|
+
return [
|
|
300
|
+
(() => {
|
|
301
|
+
var _el$ = getNextElement(_tmpl$);
|
|
302
|
+
var _ref$ = startRef;
|
|
303
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : startRef = _el$;
|
|
304
|
+
return _el$;
|
|
305
|
+
})(),
|
|
306
|
+
memo(() => props.children),
|
|
307
|
+
(() => {
|
|
308
|
+
var _el$2 = getNextElement(_tmpl$2);
|
|
309
|
+
var _ref$2 = endRef;
|
|
310
|
+
typeof _ref$2 === "function" ? use(_ref$2, _el$2) : endRef = _el$2;
|
|
311
|
+
return _el$2;
|
|
312
|
+
})()
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/focus/createFocusRestore.ts
|
|
319
|
+
/**
|
|
320
|
+
* Focus restoration utilities for solidaria
|
|
321
|
+
*
|
|
322
|
+
* Provides enhanced focus restoration with retry logic, cross-scope tracking,
|
|
323
|
+
* and safe restoration patterns.
|
|
324
|
+
*/
|
|
325
|
+
const focusStack = [];
|
|
326
|
+
/**
|
|
327
|
+
* Push an element onto the focus stack.
|
|
328
|
+
*/
|
|
329
|
+
function pushFocusStack(element) {
|
|
330
|
+
focusStack.push(element);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Pop the last element from the focus stack.
|
|
334
|
+
*/
|
|
335
|
+
function popFocusStack() {
|
|
336
|
+
return focusStack.pop();
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Get the current focus stack length.
|
|
340
|
+
*/
|
|
341
|
+
function getFocusStackLength() {
|
|
342
|
+
return focusStack.length;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Clear the entire focus stack.
|
|
346
|
+
*/
|
|
347
|
+
function clearFocusStack() {
|
|
348
|
+
focusStack.length = 0;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Gets the active element, accounting for shadow DOM.
|
|
352
|
+
*/
|
|
353
|
+
function getActiveElement(doc) {
|
|
354
|
+
let activeElement = doc.activeElement;
|
|
355
|
+
while (activeElement?.shadowRoot?.activeElement) activeElement = activeElement.shadowRoot.activeElement;
|
|
356
|
+
return activeElement;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Checks if an element is still valid for focus restoration.
|
|
360
|
+
*/
|
|
361
|
+
function isValidForRestore(element) {
|
|
362
|
+
if (!element) return false;
|
|
363
|
+
if (!document.body.contains(element)) return false;
|
|
364
|
+
if (element.hasAttribute("disabled")) return false;
|
|
365
|
+
if (element.getAttribute("aria-disabled") === "true") return false;
|
|
366
|
+
if (element.getAttribute("aria-hidden") === "true") return false;
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Attempts to restore focus with retries.
|
|
371
|
+
*/
|
|
372
|
+
function tryRestoreFocus(element, options) {
|
|
373
|
+
const { maxRetries, retryDelay, preventScroll, onRestore, onRestoreFailed } = options;
|
|
374
|
+
let attempts = 0;
|
|
375
|
+
const attempt = () => {
|
|
376
|
+
if (!element) {
|
|
377
|
+
onRestoreFailed?.();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (isValidForRestore(element)) {
|
|
381
|
+
if (preventScroll) focusSafely(element);
|
|
382
|
+
else element.focus();
|
|
383
|
+
onRestore?.(element);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
attempts++;
|
|
387
|
+
if (attempts < maxRetries) setTimeout(attempt, retryDelay);
|
|
388
|
+
else onRestoreFailed?.();
|
|
389
|
+
};
|
|
390
|
+
requestAnimationFrame(attempt);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Creates a focus restoration manager.
|
|
394
|
+
*
|
|
395
|
+
* This hook saves the currently focused element when mounted and provides
|
|
396
|
+
* methods to restore focus later, with retry logic for reliability.
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```tsx
|
|
400
|
+
* function Modal(props) {
|
|
401
|
+
* const focusRestore = createFocusRestore({
|
|
402
|
+
* restoreOnUnmount: true,
|
|
403
|
+
* onRestore: () => console.log('Focus restored'),
|
|
404
|
+
* });
|
|
405
|
+
*
|
|
406
|
+
* return (
|
|
407
|
+
* <div role="dialog">
|
|
408
|
+
* {props.children}
|
|
409
|
+
* <button onClick={() => focusRestore.restore()}>
|
|
410
|
+
* Close
|
|
411
|
+
* </button>
|
|
412
|
+
* </div>
|
|
413
|
+
* );
|
|
414
|
+
* }
|
|
415
|
+
* ```
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```tsx
|
|
419
|
+
* // Manual focus management
|
|
420
|
+
* function Dropdown() {
|
|
421
|
+
* const focusRestore = createFocusRestore({ restoreOnUnmount: false });
|
|
422
|
+
*
|
|
423
|
+
* const onOpen = () => {
|
|
424
|
+
* focusRestore.saveCurrentFocus();
|
|
425
|
+
* // Focus dropdown content
|
|
426
|
+
* };
|
|
427
|
+
*
|
|
428
|
+
* const onClose = () => {
|
|
429
|
+
* focusRestore.restore();
|
|
430
|
+
* };
|
|
431
|
+
*
|
|
432
|
+
* return <div>...</div>;
|
|
433
|
+
* }
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
function createFocusRestore(options = {}) {
|
|
437
|
+
const { restoreOnUnmount = true, maxRetries = 3, retryDelay = 50, onRestore, onRestoreFailed, preventScroll = true } = options;
|
|
438
|
+
if (isServer) return {
|
|
439
|
+
restore: () => false,
|
|
440
|
+
getSavedElement: () => null,
|
|
441
|
+
saveCurrentFocus: () => {},
|
|
442
|
+
clear: () => {}
|
|
443
|
+
};
|
|
444
|
+
let savedElement = null;
|
|
445
|
+
onMount(() => {
|
|
446
|
+
saveCurrentFocus();
|
|
447
|
+
});
|
|
448
|
+
onCleanup(() => {
|
|
449
|
+
if (restoreOnUnmount && savedElement) tryRestoreFocus(savedElement, {
|
|
450
|
+
maxRetries,
|
|
451
|
+
retryDelay,
|
|
452
|
+
preventScroll,
|
|
453
|
+
onRestore: onRestore ?? (() => {}),
|
|
454
|
+
onRestoreFailed: onRestoreFailed ?? (() => {})
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
function saveCurrentFocus() {
|
|
458
|
+
const doc = typeof document !== "undefined" ? document : null;
|
|
459
|
+
if (!doc) return;
|
|
460
|
+
const active = getActiveElement(doc);
|
|
461
|
+
if (active && active !== doc.body) {
|
|
462
|
+
savedElement = active;
|
|
463
|
+
pushFocusStack(active);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function restore() {
|
|
467
|
+
if (!savedElement) return false;
|
|
468
|
+
if (isValidForRestore(savedElement)) {
|
|
469
|
+
if (preventScroll) focusSafely(savedElement);
|
|
470
|
+
else savedElement.focus();
|
|
471
|
+
onRestore?.(savedElement);
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
while (focusStack.length > 0) {
|
|
475
|
+
const stackElement = popFocusStack();
|
|
476
|
+
if (stackElement && isValidForRestore(stackElement)) {
|
|
477
|
+
if (preventScroll) focusSafely(stackElement);
|
|
478
|
+
else stackElement.focus();
|
|
479
|
+
onRestore?.(stackElement);
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
onRestoreFailed?.();
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
function getSavedElement() {
|
|
487
|
+
return savedElement;
|
|
488
|
+
}
|
|
489
|
+
function clear() {
|
|
490
|
+
savedElement = null;
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
restore,
|
|
494
|
+
getSavedElement,
|
|
495
|
+
saveCurrentFocus,
|
|
496
|
+
clear
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region src/focus/createVirtualFocus.ts
|
|
501
|
+
/**
|
|
502
|
+
* Virtual focus management for solidaria
|
|
503
|
+
*
|
|
504
|
+
* Provides virtual focus for large collections where tracking DOM focus
|
|
505
|
+
* on every item is impractical. Instead, a single element receives real
|
|
506
|
+
* focus while aria-activedescendant indicates the virtually focused item.
|
|
507
|
+
*
|
|
508
|
+
* This is commonly used in:
|
|
509
|
+
* - Virtualized lists (where not all items are in the DOM)
|
|
510
|
+
* - Large trees
|
|
511
|
+
* - Autocomplete/combobox suggestions
|
|
512
|
+
* - Grid/table navigation
|
|
513
|
+
*/
|
|
514
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
515
|
+
/**
|
|
516
|
+
* Creates virtual focus management for a collection.
|
|
517
|
+
*
|
|
518
|
+
* Virtual focus uses aria-activedescendant to indicate which item is
|
|
519
|
+
* "focused" while keeping real DOM focus on a container element. This
|
|
520
|
+
* is more performant for large collections and required for virtualized
|
|
521
|
+
* lists where items may not be in the DOM.
|
|
522
|
+
*
|
|
523
|
+
* @example
|
|
524
|
+
* ```tsx
|
|
525
|
+
* function Listbox(props) {
|
|
526
|
+
* const virtualFocus = createVirtualFocus({
|
|
527
|
+
* items: () => props.items,
|
|
528
|
+
* getKey: (item) => item.id,
|
|
529
|
+
* isDisabled: (item) => item.disabled,
|
|
530
|
+
* });
|
|
531
|
+
*
|
|
532
|
+
* return (
|
|
533
|
+
* <ul
|
|
534
|
+
* role="listbox"
|
|
535
|
+
* tabIndex={0}
|
|
536
|
+
* aria-activedescendant={virtualFocus.containerProps['aria-activedescendant']()}
|
|
537
|
+
* onKeyDown={virtualFocus.containerProps.onKeyDown}
|
|
538
|
+
* >
|
|
539
|
+
* <For each={props.items}>
|
|
540
|
+
* {(item) => (
|
|
541
|
+
* <li
|
|
542
|
+
* {...virtualFocus.getItemProps(item.id)}
|
|
543
|
+
* role="option"
|
|
544
|
+
* aria-selected={virtualFocus.isFocused(item.id)}
|
|
545
|
+
* >
|
|
546
|
+
* {item.name}
|
|
547
|
+
* </li>
|
|
548
|
+
* )}
|
|
549
|
+
* </For>
|
|
550
|
+
* </ul>
|
|
551
|
+
* );
|
|
552
|
+
* }
|
|
553
|
+
* ```
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* ```tsx
|
|
557
|
+
* // With controlled focus
|
|
558
|
+
* function ControlledListbox() {
|
|
559
|
+
* const [focusedKey, setFocusedKey] = createSignal<string | null>(null);
|
|
560
|
+
*
|
|
561
|
+
* const virtualFocus = createVirtualFocus({
|
|
562
|
+
* items: () => items,
|
|
563
|
+
* getKey: (item) => item.id,
|
|
564
|
+
* focusedKey: focusedKey,
|
|
565
|
+
* onFocusChange: setFocusedKey,
|
|
566
|
+
* });
|
|
567
|
+
*
|
|
568
|
+
* return <ul>...</ul>;
|
|
569
|
+
* }
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
function createVirtualFocus(options) {
|
|
573
|
+
const { items, getKey, isDisabled = () => false, defaultFocusedKey, focusedKey: controlledFocusedKey, onFocusChange, wrap = true, skipDisabled = true, orientation = "vertical" } = options;
|
|
574
|
+
if (isServer) {
|
|
575
|
+
const emptyAccessor = () => null;
|
|
576
|
+
return {
|
|
577
|
+
focusedKey: emptyAccessor,
|
|
578
|
+
focusedItem: emptyAccessor,
|
|
579
|
+
setFocusedKey: () => {},
|
|
580
|
+
focusNext: () => {},
|
|
581
|
+
focusPrevious: () => {},
|
|
582
|
+
focusFirst: () => {},
|
|
583
|
+
focusLast: () => {},
|
|
584
|
+
focusPageDown: () => {},
|
|
585
|
+
focusPageUp: () => {},
|
|
586
|
+
isFocused: () => false,
|
|
587
|
+
containerProps: {
|
|
588
|
+
"aria-activedescendant": () => void 0,
|
|
589
|
+
onKeyDown: () => {}
|
|
590
|
+
},
|
|
591
|
+
getItemProps: (key) => ({ id: `item-${key}` })
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
const [internalKey, setInternalKey] = createSignal(defaultFocusedKey ?? null);
|
|
595
|
+
const focusedKey = controlledFocusedKey ?? internalKey;
|
|
596
|
+
const setFocusedKey = (key) => {
|
|
597
|
+
if (controlledFocusedKey) onFocusChange?.(key);
|
|
598
|
+
else {
|
|
599
|
+
setInternalKey(key);
|
|
600
|
+
onFocusChange?.(key);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
const focusedItem = () => {
|
|
604
|
+
const key = focusedKey();
|
|
605
|
+
if (!key) return null;
|
|
606
|
+
return items().find((item) => getKey(item) === key) ?? null;
|
|
607
|
+
};
|
|
608
|
+
const getValidItems = () => {
|
|
609
|
+
if (!skipDisabled) return items();
|
|
610
|
+
return items().filter((item) => !isDisabled(item));
|
|
611
|
+
};
|
|
612
|
+
const getKeyIndex = (key) => {
|
|
613
|
+
if (!key) return -1;
|
|
614
|
+
return getValidItems().findIndex((item) => getKey(item) === key);
|
|
615
|
+
};
|
|
616
|
+
const focusByIndex = (index) => {
|
|
617
|
+
const validItems = getValidItems();
|
|
618
|
+
if (validItems.length === 0) return;
|
|
619
|
+
let targetIndex = index;
|
|
620
|
+
if (wrap) targetIndex = (index % validItems.length + validItems.length) % validItems.length;
|
|
621
|
+
else targetIndex = Math.max(0, Math.min(index, validItems.length - 1));
|
|
622
|
+
const item = validItems[targetIndex];
|
|
623
|
+
if (item) setFocusedKey(getKey(item));
|
|
624
|
+
};
|
|
625
|
+
const focusNext = () => {
|
|
626
|
+
focusByIndex(getKeyIndex(focusedKey()) + 1);
|
|
627
|
+
};
|
|
628
|
+
const focusPrevious = () => {
|
|
629
|
+
const currentIndex = getKeyIndex(focusedKey());
|
|
630
|
+
if (currentIndex === -1) focusByIndex(getValidItems().length - 1);
|
|
631
|
+
else focusByIndex(currentIndex - 1);
|
|
632
|
+
};
|
|
633
|
+
const focusFirst = () => {
|
|
634
|
+
focusByIndex(0);
|
|
635
|
+
};
|
|
636
|
+
const focusLast = () => {
|
|
637
|
+
focusByIndex(getValidItems().length - 1);
|
|
638
|
+
};
|
|
639
|
+
const focusPageDown = (pageSize = DEFAULT_PAGE_SIZE) => {
|
|
640
|
+
focusByIndex(getKeyIndex(focusedKey()) + pageSize);
|
|
641
|
+
};
|
|
642
|
+
const focusPageUp = (pageSize = DEFAULT_PAGE_SIZE) => {
|
|
643
|
+
const currentIndex = getKeyIndex(focusedKey());
|
|
644
|
+
if (currentIndex === -1) focusByIndex(getValidItems().length - 1);
|
|
645
|
+
else focusByIndex(currentIndex - pageSize);
|
|
646
|
+
};
|
|
647
|
+
const isFocused = (key) => {
|
|
648
|
+
return focusedKey() === key;
|
|
649
|
+
};
|
|
650
|
+
const onKeyDown = (e) => {
|
|
651
|
+
const isVertical = orientation === "vertical" || orientation === "both";
|
|
652
|
+
const isHorizontal = orientation === "horizontal" || orientation === "both";
|
|
653
|
+
switch (e.key) {
|
|
654
|
+
case "ArrowDown":
|
|
655
|
+
if (isVertical) {
|
|
656
|
+
e.preventDefault();
|
|
657
|
+
focusNext();
|
|
658
|
+
}
|
|
659
|
+
break;
|
|
660
|
+
case "ArrowUp":
|
|
661
|
+
if (isVertical) {
|
|
662
|
+
e.preventDefault();
|
|
663
|
+
focusPrevious();
|
|
664
|
+
}
|
|
665
|
+
break;
|
|
666
|
+
case "ArrowRight":
|
|
667
|
+
if (isHorizontal) {
|
|
668
|
+
e.preventDefault();
|
|
669
|
+
focusNext();
|
|
670
|
+
}
|
|
671
|
+
break;
|
|
672
|
+
case "ArrowLeft":
|
|
673
|
+
if (isHorizontal) {
|
|
674
|
+
e.preventDefault();
|
|
675
|
+
focusPrevious();
|
|
676
|
+
}
|
|
677
|
+
break;
|
|
678
|
+
case "Home":
|
|
679
|
+
e.preventDefault();
|
|
680
|
+
focusFirst();
|
|
681
|
+
break;
|
|
682
|
+
case "End":
|
|
683
|
+
e.preventDefault();
|
|
684
|
+
focusLast();
|
|
685
|
+
break;
|
|
686
|
+
case "PageDown":
|
|
687
|
+
e.preventDefault();
|
|
688
|
+
focusPageDown();
|
|
689
|
+
break;
|
|
690
|
+
case "PageUp":
|
|
691
|
+
e.preventDefault();
|
|
692
|
+
focusPageUp();
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
const containerProps = {
|
|
697
|
+
"aria-activedescendant": () => {
|
|
698
|
+
const key = focusedKey();
|
|
699
|
+
return key ? `item-${key}` : void 0;
|
|
700
|
+
},
|
|
701
|
+
onKeyDown
|
|
702
|
+
};
|
|
703
|
+
const getItemProps = (key) => ({ id: `item-${key}` });
|
|
704
|
+
return {
|
|
705
|
+
focusedKey,
|
|
706
|
+
focusedItem,
|
|
707
|
+
setFocusedKey,
|
|
708
|
+
focusNext,
|
|
709
|
+
focusPrevious,
|
|
710
|
+
focusFirst,
|
|
711
|
+
focusLast,
|
|
712
|
+
focusPageDown,
|
|
713
|
+
focusPageUp,
|
|
714
|
+
isFocused,
|
|
715
|
+
containerProps,
|
|
716
|
+
getItemProps
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/focus/createAutoFocus.ts
|
|
721
|
+
/**
|
|
722
|
+
* Auto-focus management for solidaria
|
|
723
|
+
*
|
|
724
|
+
* Provides priority-based auto-focus with deferred execution
|
|
725
|
+
* and conflict resolution for multiple auto-focus elements.
|
|
726
|
+
*/
|
|
727
|
+
let autoFocusQueue = [];
|
|
728
|
+
let processingTimeout = null;
|
|
729
|
+
/**
|
|
730
|
+
* Process the auto-focus queue and focus the highest priority element.
|
|
731
|
+
*/
|
|
732
|
+
function processAutoFocusQueue() {
|
|
733
|
+
if (processingTimeout) {
|
|
734
|
+
clearTimeout(processingTimeout);
|
|
735
|
+
processingTimeout = null;
|
|
736
|
+
}
|
|
737
|
+
if (autoFocusQueue.length === 0) return;
|
|
738
|
+
autoFocusQueue.sort((a, b) => b.priority - a.priority);
|
|
739
|
+
const winner = autoFocusQueue[0];
|
|
740
|
+
const losers = autoFocusQueue.slice(1);
|
|
741
|
+
autoFocusQueue = [];
|
|
742
|
+
for (const loser of losers) loser.onSkip?.();
|
|
743
|
+
const element = winner.ref();
|
|
744
|
+
if (!element) {
|
|
745
|
+
winner.onSkip?.();
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
const activeElement = document.activeElement;
|
|
749
|
+
if (!(winner.force || !activeElement || activeElement === document.body || activeElement === document.documentElement)) {
|
|
750
|
+
winner.onSkip?.();
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
if (winner.delay > 0) setTimeout(() => {
|
|
754
|
+
const el = winner.ref();
|
|
755
|
+
if (el && document.body.contains(el)) {
|
|
756
|
+
if (winner.preventScroll) focusSafely(el);
|
|
757
|
+
else el.focus();
|
|
758
|
+
winner.onFocus?.(el);
|
|
759
|
+
}
|
|
760
|
+
}, winner.delay);
|
|
761
|
+
else {
|
|
762
|
+
if (winner.preventScroll) focusSafely(element);
|
|
763
|
+
else element.focus();
|
|
764
|
+
winner.onFocus?.(element);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Queue an element for auto-focus.
|
|
769
|
+
*/
|
|
770
|
+
function queueAutoFocus(item) {
|
|
771
|
+
autoFocusQueue.push(item);
|
|
772
|
+
if (processingTimeout === null) processingTimeout = setTimeout(processAutoFocusQueue, 0);
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Remove an item from the auto-focus queue.
|
|
776
|
+
*/
|
|
777
|
+
function removeFromQueue(ref) {
|
|
778
|
+
autoFocusQueue = autoFocusQueue.filter((item) => item.ref !== ref);
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Creates auto-focus behavior for an element.
|
|
782
|
+
*
|
|
783
|
+
* This hook registers the element for auto-focus when mounted. If multiple
|
|
784
|
+
* elements request auto-focus, the one with the highest priority wins.
|
|
785
|
+
*
|
|
786
|
+
* @param ref - Accessor for the element to focus
|
|
787
|
+
* @param options - Auto-focus options
|
|
788
|
+
*
|
|
789
|
+
* @example
|
|
790
|
+
* ```tsx
|
|
791
|
+
* function Dialog(props) {
|
|
792
|
+
* let contentRef: HTMLDivElement | undefined;
|
|
793
|
+
*
|
|
794
|
+
* createAutoFocus(() => contentRef, {
|
|
795
|
+
* priority: 10, // High priority for dialogs
|
|
796
|
+
* onFocus: () => console.log('Dialog focused'),
|
|
797
|
+
* });
|
|
798
|
+
*
|
|
799
|
+
* return (
|
|
800
|
+
* <div ref={contentRef} tabIndex={-1}>
|
|
801
|
+
* {props.children}
|
|
802
|
+
* </div>
|
|
803
|
+
* );
|
|
804
|
+
* }
|
|
805
|
+
* ```
|
|
806
|
+
*
|
|
807
|
+
* @example
|
|
808
|
+
* ```tsx
|
|
809
|
+
* // With delay for animations
|
|
810
|
+
* function AnimatedPanel() {
|
|
811
|
+
* let panelRef: HTMLDivElement | undefined;
|
|
812
|
+
*
|
|
813
|
+
* createAutoFocus(() => panelRef, {
|
|
814
|
+
* delay: 300, // Wait for animation
|
|
815
|
+
* });
|
|
816
|
+
*
|
|
817
|
+
* return <div ref={panelRef} class="animated-panel">...</div>;
|
|
818
|
+
* }
|
|
819
|
+
* ```
|
|
820
|
+
*
|
|
821
|
+
* @example
|
|
822
|
+
* ```tsx
|
|
823
|
+
* // Conditional auto-focus
|
|
824
|
+
* function Input(props) {
|
|
825
|
+
* let inputRef: HTMLInputElement | undefined;
|
|
826
|
+
*
|
|
827
|
+
* createAutoFocus(() => inputRef, {
|
|
828
|
+
* isEnabled: props.autoFocus,
|
|
829
|
+
* });
|
|
830
|
+
*
|
|
831
|
+
* return <input ref={inputRef} />;
|
|
832
|
+
* }
|
|
833
|
+
* ```
|
|
834
|
+
*/
|
|
835
|
+
function createAutoFocus(ref, options = {}) {
|
|
836
|
+
const { isEnabled = true, priority = 0, delay = 0, force = false, preventScroll = true, onFocus, onSkip } = options;
|
|
837
|
+
if (isServer) return {
|
|
838
|
+
focus: () => {},
|
|
839
|
+
cancel: () => {}
|
|
840
|
+
};
|
|
841
|
+
let canceled = false;
|
|
842
|
+
onMount(() => {
|
|
843
|
+
if (!isEnabled || canceled) return;
|
|
844
|
+
queueAutoFocus({
|
|
845
|
+
ref,
|
|
846
|
+
priority,
|
|
847
|
+
delay,
|
|
848
|
+
force,
|
|
849
|
+
preventScroll,
|
|
850
|
+
onFocus,
|
|
851
|
+
onSkip
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
onCleanup(() => {
|
|
855
|
+
removeFromQueue(ref);
|
|
856
|
+
});
|
|
857
|
+
const focus = () => {
|
|
858
|
+
if (canceled) return;
|
|
859
|
+
const element = ref();
|
|
860
|
+
if (!element) return;
|
|
861
|
+
if (preventScroll) focusSafely(element);
|
|
862
|
+
else element.focus();
|
|
863
|
+
onFocus?.(element);
|
|
864
|
+
};
|
|
865
|
+
const cancel = () => {
|
|
866
|
+
canceled = true;
|
|
867
|
+
removeFromQueue(ref);
|
|
868
|
+
};
|
|
869
|
+
return {
|
|
870
|
+
focus,
|
|
871
|
+
cancel
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Clears all pending auto-focus requests.
|
|
876
|
+
* Useful for testing or when navigating away.
|
|
877
|
+
*/
|
|
878
|
+
function clearAutoFocusQueue() {
|
|
879
|
+
if (processingTimeout) {
|
|
880
|
+
clearTimeout(processingTimeout);
|
|
881
|
+
processingTimeout = null;
|
|
882
|
+
}
|
|
883
|
+
autoFocusQueue = [];
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Gets the current auto-focus queue length.
|
|
887
|
+
* Useful for debugging.
|
|
888
|
+
*/
|
|
889
|
+
function getAutoFocusQueueLength() {
|
|
890
|
+
return autoFocusQueue.length;
|
|
891
|
+
}
|
|
892
|
+
//#endregion
|
|
893
|
+
export { clearFocusStack as a, popFocusStack as c, useFocusManager as d, createVirtualFocus as i, pushFocusStack as l, createAutoFocus as n, createFocusRestore as o, getAutoFocusQueueLength as r, getFocusStackLength as s, clearAutoFocusQueue as t, FocusScope as u };
|
|
894
|
+
|
|
895
|
+
//# sourceMappingURL=focus2.js.map
|