@proyecto-viviana/solidaria 0.3.0 → 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/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/index.js +2 -0
- package/dist/actiongroup/index.jsx +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
- package/dist/autocomplete/index.js +2 -0
- package/dist/autocomplete/index.jsx +2 -0
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/index.jsx +2 -0
- package/dist/button/index.js +2 -0
- package/dist/button/index.jsx +2 -0
- package/dist/calendar/createCalendar.d.ts.map +1 -1
- package/dist/calendar/createCalendarCell.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/calendar/index.d.ts +2 -0
- 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/utils.d.ts +4 -0
- package/dist/calendar/utils.d.ts.map +1 -1
- package/dist/checkbox/createCheckbox.d.ts +4 -0
- package/dist/checkbox/createCheckbox.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox/index.jsx +2 -0
- 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/index.js +2 -0
- package/dist/color/index.jsx +2 -0
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.jsx +2 -0
- package/dist/datepicker/createDateSegment.d.ts.map +1 -1
- package/dist/datepicker/index.js +2 -0
- package/dist/datepicker/index.jsx +2 -0
- package/dist/dialog/index.js +2 -0
- package/dist/dialog/index.jsx +2 -0
- package/dist/disclosure/index.js +2 -0
- package/dist/disclosure/index.jsx +2 -0
- package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
- package/dist/dnd/index.js +2 -0
- package/dist/dnd/index.jsx +2 -0
- package/dist/dnd/utils.d.ts +2 -2
- package/dist/dnd/utils.d.ts.map +1 -1
- package/dist/focus/FocusScope.d.ts.map +1 -1
- package/dist/focus/index.js +2 -0
- package/dist/focus/index.jsx +2 -0
- package/dist/form/createFormValidation.d.ts.map +1 -1
- package/dist/form/index.js +3 -0
- package/dist/form/index.jsx +3 -0
- package/dist/grid/index.js +2 -0
- package/dist/grid/index.jsx +2 -0
- package/dist/gridlist/createGridList.d.ts +7 -1
- package/dist/gridlist/createGridList.d.ts.map +1 -1
- package/dist/gridlist/createGridListItem.d.ts +1 -1
- 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/index.d.ts +2 -1
- 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 +50 -0
- package/dist/gridlist/types.d.ts.map +1 -1
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/index.jsx +3 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -18311
- package/dist/index.jsx +71 -18242
- package/dist/interactions/PressEvent.d.ts +11 -0
- package/dist/interactions/PressEvent.d.ts.map +1 -1
- package/dist/interactions/createInteractionModality.d.ts +0 -1
- package/dist/interactions/createInteractionModality.d.ts.map +1 -1
- package/dist/interactions/createKeyboard.d.ts.map +1 -1
- package/dist/interactions/createPress.d.ts.map +1 -1
- package/dist/interactions/index.js +10 -0
- package/dist/interactions/index.jsx +10 -0
- package/dist/label/index.js +4 -0
- package/dist/label/index.jsx +4 -0
- package/dist/landmark/index.js +2 -0
- package/dist/landmark/index.jsx +2 -0
- package/dist/link/index.js +2 -0
- package/dist/link/index.jsx +2 -0
- package/dist/listbox/createListBox.d.ts +37 -0
- package/dist/listbox/createListBox.d.ts.map +1 -1
- package/dist/listbox/createOption.d.ts +6 -0
- package/dist/listbox/createOption.d.ts.map +1 -1
- package/dist/listbox/index.js +2 -0
- package/dist/listbox/index.jsx +2 -0
- package/dist/live-announcer/index.js +2 -0
- package/dist/live-announcer/index.jsx +2 -0
- package/dist/menu/createMenu.d.ts +7 -4
- package/dist/menu/createMenu.d.ts.map +1 -1
- package/dist/menu/createMenuItem.d.ts +9 -1
- package/dist/menu/createMenuItem.d.ts.map +1 -1
- package/dist/menu/index.js +2 -0
- package/dist/menu/index.jsx +2 -0
- package/dist/meter/index.js +2 -0
- package/dist/meter/index.jsx +2 -0
- package/dist/numberfield/createNumberField.d.ts.map +1 -1
- package/dist/numberfield/index.js +2 -0
- package/dist/numberfield/index.jsx +2 -0
- package/dist/overlays/index.js +4 -0
- package/dist/overlays/index.jsx +4 -0
- package/dist/popover/calculatePosition.d.ts +2 -0
- package/dist/popover/calculatePosition.d.ts.map +1 -1
- package/dist/popover/createOverlayPosition.d.ts +8 -0
- package/dist/popover/createOverlayPosition.d.ts.map +1 -1
- package/dist/popover/index.js +2 -0
- package/dist/popover/index.jsx +2 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/index.jsx +2 -0
- package/dist/radio/createRadio.d.ts +2 -0
- package/dist/radio/createRadio.d.ts.map +1 -1
- package/dist/radio/index.js +2 -0
- package/dist/radio/index.jsx +2 -0
- package/dist/searchfield/index.js +2 -0
- package/dist/searchfield/index.jsx +2 -0
- package/dist/select/createSelect.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.map +1 -1
- package/dist/selection/index.d.ts +9 -0
- 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/index.js +2 -0
- package/dist/separator/index.jsx +2 -0
- package/dist/slider/createSlider.d.ts.map +1 -1
- package/dist/slider/index.js +2 -0
- package/dist/slider/index.jsx +2 -0
- package/dist/ssr/index.d.ts +17 -0
- 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/index.js +2 -0
- package/dist/steplist/index.jsx +2 -0
- package/dist/switch/createSwitch.d.ts +4 -0
- package/dist/switch/createSwitch.d.ts.map +1 -1
- package/dist/switch/index.js +2 -0
- package/dist/switch/index.jsx +2 -0
- package/dist/table/createTable.d.ts.map +1 -1
- package/dist/table/createTableRow.d.ts +1 -1
- package/dist/table/createTableRow.d.ts.map +1 -1
- package/dist/table/createTableSelectAllCheckbox.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 +27 -1
- package/dist/table/types.d.ts.map +1 -1
- package/dist/tabs/createTabs.d.ts +4 -3
- package/dist/tabs/createTabs.d.ts.map +1 -1
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/index.jsx +2 -0
- package/dist/tag/createTag.d.ts +2 -0
- package/dist/tag/createTag.d.ts.map +1 -1
- package/dist/tag/index.js +2 -0
- package/dist/tag/index.jsx +2 -0
- package/dist/textfield/index.js +2 -0
- package/dist/textfield/index.jsx +2 -0
- package/dist/toast/createToast.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 +4 -0
- package/dist/toggle/createToggle.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 +1 -1
- package/dist/toolbar/createToolbar.d.ts.map +1 -1
- package/dist/toolbar/index.js +2 -0
- package/dist/toolbar/index.jsx +2 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/index.jsx +2 -0
- package/dist/tree/createTree.d.ts +5 -1
- package/dist/tree/createTree.d.ts.map +1 -1
- package/dist/tree/createTreeItem.d.ts +1 -1
- package/dist/tree/createTreeItem.d.ts.map +1 -1
- package/dist/tree/index.js +2 -0
- package/dist/tree/index.jsx +2 -0
- package/dist/tree/types.d.ts +10 -0
- 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/dom.d.ts +48 -2
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- 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/scrollIntoView.d.ts +30 -0
- package/dist/utils/scrollIntoView.d.ts.map +1 -0
- package/dist/visually-hidden/index.js +2 -0
- package/dist/visually-hidden/index.jsx +2 -0
- package/package.json +304 -3
- package/src/autocomplete/createAutocomplete.ts +67 -21
- package/src/calendar/createCalendar.ts +2 -0
- package/src/calendar/createCalendarCell.ts +19 -2
- package/src/calendar/createCalendarGrid.ts +43 -9
- package/src/calendar/createCalendarMonthPicker.ts +105 -0
- package/src/calendar/createCalendarYearPicker.ts +144 -0
- package/src/calendar/createRangeCalendar.ts +2 -0
- package/src/calendar/index.ts +17 -0
- package/src/calendar/utils.ts +4 -0
- package/src/checkbox/createCheckbox.ts +10 -0
- package/src/checkbox/createCheckboxGroupItem.ts +12 -16
- package/src/datepicker/createDateSegment.ts +6 -1
- package/src/dnd/createDroppableCollection.ts +4 -1
- package/src/dnd/utils.ts +27 -3
- package/src/focus/FocusScope.tsx +152 -18
- package/src/form/createFormValidation.ts +8 -1
- package/src/gridlist/createGridList.ts +145 -42
- package/src/gridlist/createGridListItem.ts +87 -155
- package/src/gridlist/createGridListSection.ts +54 -0
- package/src/gridlist/index.ts +3 -0
- package/src/gridlist/types.ts +47 -0
- package/src/index.ts +40 -0
- package/src/interactions/PressEvent.ts +14 -0
- package/src/interactions/createInteractionModality.ts +21 -12
- package/src/interactions/createKeyboard.ts +10 -0
- package/src/interactions/createPress.ts +29 -6
- package/src/listbox/createListBox.ts +129 -8
- package/src/listbox/createOption.ts +68 -73
- package/src/menu/createMenu.ts +93 -16
- package/src/menu/createMenuItem.ts +253 -41
- package/src/numberfield/createNumberField.ts +82 -14
- package/src/popover/calculatePosition.ts +19 -7
- package/src/popover/createOverlayPosition.ts +9 -0
- package/src/radio/createRadio.ts +19 -2
- package/src/select/createSelect.ts +18 -2
- 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 +112 -51
- package/src/selection/index.ts +31 -0
- package/src/selection/selectItem.ts +80 -0
- package/src/selection/utils.ts +82 -0
- package/src/slider/createSlider.ts +48 -1
- package/src/ssr/index.tsx +31 -0
- package/src/switch/createSwitch.ts +10 -0
- package/src/table/createTable.ts +56 -26
- package/src/table/createTableRow.ts +198 -203
- package/src/table/createTableSelectAllCheckbox.ts +3 -4
- package/src/table/types.ts +29 -1
- package/src/tabs/createTabs.ts +50 -20
- package/src/tag/createTag.ts +9 -4
- package/src/toast/createToast.ts +1 -0
- package/src/toggle/createToggle.ts +20 -0
- package/src/toolbar/createToolbar.ts +43 -42
- package/src/tree/createTree.ts +100 -42
- package/src/tree/createTreeItem.ts +105 -120
- package/src/tree/types.ts +10 -0
- package/src/utils/animation.ts +151 -0
- package/src/utils/dom.ts +215 -25
- package/src/utils/index.ts +8 -0
- package/src/utils/keyboard.ts +25 -0
- package/src/utils/mergeProps.ts +8 -1
- package/src/utils/scrollIntoView.ts +181 -0
- package/dist/index.js.map +0 -1
- package/dist/index.jsx.map +0 -1
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createSelectableCollection - keyboard, focus, and selection interactions for a
|
|
3
|
+
* selectable collection. Based on @react-aria/selection's
|
|
4
|
+
* `useSelectableCollection`.
|
|
5
|
+
*
|
|
6
|
+
* React → Solid adaptations (faithful to upstream behavior):
|
|
7
|
+
* - `ref` / `scrollRef` are Solid accessors; `keyboardDelegate` may be an
|
|
8
|
+
* accessor so a recreated delegate stays current.
|
|
9
|
+
* - Per-render React effects become `createEffect`s that read the manager's
|
|
10
|
+
* reactive getters: the autofocus and scroll-into-view effects track
|
|
11
|
+
* `isFocused` / `focusedKey` / `collection.size` and run when those change.
|
|
12
|
+
* `useUpdateLayoutEffect` (skip-first) maps to `on(..., { defer: true })`.
|
|
13
|
+
* - Plain closure variables replace `useRef` (a Solid component body runs once).
|
|
14
|
+
* - React's bubbling `onFocus` / `onBlur` are `onFocusIn` / `onFocusOut`
|
|
15
|
+
* (the native bubbling focus events) here.
|
|
16
|
+
* - The link branch opens the anchor directly (we have no router abstraction)
|
|
17
|
+
* and needs no `flushSync` — `setFocusedKey` is synchronous and the keyed
|
|
18
|
+
* item element already exists in the DOM.
|
|
19
|
+
* - Virtual-focus cursor movement (`moveVirtualFocus` / `dispatchVirtualFocus`)
|
|
20
|
+
* is not yet modeled — a documented gap, consistent with createSelectableItem.
|
|
21
|
+
* The focused-key bookkeeping around it is preserved.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { createEffect, on, onCleanup, type JSX } from "solid-js";
|
|
25
|
+
import type { FocusStrategy, Key, SelectionManager } from "@proyecto-viviana/solid-stately";
|
|
26
|
+
import type { KeyboardDelegate } from "../grid/types";
|
|
27
|
+
import { access, type MaybeAccessor } from "../utils/reactivity";
|
|
28
|
+
import { mergeProps } from "../utils/mergeProps";
|
|
29
|
+
import {
|
|
30
|
+
getActiveElement,
|
|
31
|
+
getEventTarget,
|
|
32
|
+
getFocusableTreeWalker,
|
|
33
|
+
isFocusWithin,
|
|
34
|
+
isTabbable,
|
|
35
|
+
nodeContains,
|
|
36
|
+
openLink,
|
|
37
|
+
} from "../utils/dom";
|
|
38
|
+
import { focusSafely, focusWithoutScrolling } from "../utils/focus";
|
|
39
|
+
import { scrollIntoView, scrollIntoViewport } from "../utils/scrollIntoView";
|
|
40
|
+
import { getInteractionModality } from "../interactions/createInteractionModality";
|
|
41
|
+
import { isCtrlKeyPressed } from "../utils/keyboard";
|
|
42
|
+
import { useLocale } from "../i18n";
|
|
43
|
+
import { createTypeSelect } from "./createTypeSelect";
|
|
44
|
+
import { getItemElement, isNonContiguousSelectionModifier, registerCollectionId } from "./utils";
|
|
45
|
+
import { CLEAR_FOCUS_EVENT, FOCUS_EVENT } from "./constants";
|
|
46
|
+
|
|
47
|
+
export interface CreateSelectableCollectionOptions<T = unknown> {
|
|
48
|
+
/** An interface for reading and updating multiple selection state. */
|
|
49
|
+
selectionManager: SelectionManager<T>;
|
|
50
|
+
/** A delegate object that implements behavior for keyboard focus movement. */
|
|
51
|
+
keyboardDelegate: MaybeAccessor<KeyboardDelegate>;
|
|
52
|
+
/** The ref accessor attached to the element representing the collection. */
|
|
53
|
+
ref: () => HTMLElement | null;
|
|
54
|
+
/** Whether the collection or one of its items should be auto-focused. @default false */
|
|
55
|
+
autoFocus?: boolean | FocusStrategy;
|
|
56
|
+
/** Whether focus should wrap around when the end/start is reached. @default false */
|
|
57
|
+
shouldFocusWrap?: boolean;
|
|
58
|
+
/** Whether the collection allows empty selection. @default false */
|
|
59
|
+
disallowEmptySelection?: boolean;
|
|
60
|
+
/** Whether the user can select all items via keyboard shortcut. @default false */
|
|
61
|
+
disallowSelectAll?: boolean;
|
|
62
|
+
/** Whether Escape clears selection. @default 'clearSelection' */
|
|
63
|
+
escapeKeyBehavior?: "clearSelection" | "none";
|
|
64
|
+
/** Whether selection should occur automatically on focus. @default selectionBehavior === 'replace' */
|
|
65
|
+
selectOnFocus?: boolean;
|
|
66
|
+
/** Whether typeahead is disabled. @default false */
|
|
67
|
+
disallowTypeAhead?: boolean;
|
|
68
|
+
/** Whether the collection items use virtual focus instead of being focused directly. */
|
|
69
|
+
shouldUseVirtualFocus?: boolean;
|
|
70
|
+
/** Whether navigation through the Tab key is enabled. */
|
|
71
|
+
allowsTabNavigation?: boolean;
|
|
72
|
+
/** Whether the collection items are contained in a virtual scroller. */
|
|
73
|
+
isVirtualized?: boolean;
|
|
74
|
+
/** The ref accessor attached to the scrollable body. Defaults to the collection ref. */
|
|
75
|
+
scrollRef?: () => HTMLElement | null;
|
|
76
|
+
/** The behavior of links in the collection. @default 'action' */
|
|
77
|
+
linkBehavior?: "action" | "selection" | "override";
|
|
78
|
+
/** Which item to focus when tabbing into the collection. @private */
|
|
79
|
+
UNSTABLE_focusOnEntry?: "first" | "last";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface SelectableCollectionAria {
|
|
83
|
+
/** Props for the collection element. */
|
|
84
|
+
collectionProps: JSX.HTMLAttributes<HTMLElement>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Handles interactions with selectable collections.
|
|
89
|
+
*/
|
|
90
|
+
export function createSelectableCollection<T = unknown>(
|
|
91
|
+
options: CreateSelectableCollectionOptions<T>,
|
|
92
|
+
): SelectableCollectionAria {
|
|
93
|
+
const manager = options.selectionManager;
|
|
94
|
+
const delegate = (): KeyboardDelegate => access(options.keyboardDelegate);
|
|
95
|
+
const ref = options.ref;
|
|
96
|
+
const scrollRef = options.scrollRef ?? ref;
|
|
97
|
+
const autoFocus = options.autoFocus ?? false;
|
|
98
|
+
const shouldFocusWrap = options.shouldFocusWrap ?? false;
|
|
99
|
+
const disallowEmptySelection = options.disallowEmptySelection ?? false;
|
|
100
|
+
const disallowSelectAll = options.disallowSelectAll ?? false;
|
|
101
|
+
const escapeKeyBehavior = options.escapeKeyBehavior ?? "clearSelection";
|
|
102
|
+
const disallowTypeAhead = options.disallowTypeAhead ?? false;
|
|
103
|
+
const shouldUseVirtualFocus = options.shouldUseVirtualFocus ?? false;
|
|
104
|
+
const allowsTabNavigation = options.allowsTabNavigation ?? false;
|
|
105
|
+
const linkBehavior = options.linkBehavior ?? "action";
|
|
106
|
+
const focusOnEntry = options.UNSTABLE_focusOnEntry;
|
|
107
|
+
|
|
108
|
+
// Read at call time so a long-press toggling selectionBehavior is reflected.
|
|
109
|
+
const selectOnFocus = (): boolean =>
|
|
110
|
+
options.selectOnFocus ?? manager.selectionBehavior === "replace";
|
|
111
|
+
|
|
112
|
+
const locale = useLocale();
|
|
113
|
+
const direction = (): "ltr" | "rtl" => locale().direction;
|
|
114
|
+
|
|
115
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
116
|
+
const d = delegate();
|
|
117
|
+
// Prevent option + tab from doing anything since it doesn't move focus to
|
|
118
|
+
// the cells, only buttons/checkboxes.
|
|
119
|
+
if (e.altKey && e.key === "Tab") {
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Keyboard events bubble through portals. Don't handle keyboard events for
|
|
124
|
+
// elements outside the collection (e.g. menus).
|
|
125
|
+
const root = ref();
|
|
126
|
+
if (!root || !nodeContains(root, getEventTarget(e) as Element)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const navigateToKey = (key: Key | undefined | null, childFocus?: FocusStrategy) => {
|
|
131
|
+
if (key == null) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (
|
|
136
|
+
manager.isLink(key) &&
|
|
137
|
+
linkBehavior === "selection" &&
|
|
138
|
+
selectOnFocus() &&
|
|
139
|
+
!isNonContiguousSelectionModifier(e)
|
|
140
|
+
) {
|
|
141
|
+
manager.setFocusedKey(key, childFocus);
|
|
142
|
+
const item = getItemElement(ref, key);
|
|
143
|
+
if (item instanceof HTMLAnchorElement) {
|
|
144
|
+
openLink(item, e);
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
manager.setFocusedKey(key, childFocus);
|
|
150
|
+
|
|
151
|
+
if (manager.isLink(key) && linkBehavior === "override") {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (e.shiftKey && manager.selectionMode === "multiple") {
|
|
156
|
+
manager.extendSelection(key);
|
|
157
|
+
} else if (selectOnFocus() && !isNonContiguousSelectionModifier(e)) {
|
|
158
|
+
manager.replaceSelection(key);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
switch (e.key) {
|
|
163
|
+
case "ArrowDown": {
|
|
164
|
+
if (d.getKeyBelow) {
|
|
165
|
+
let nextKey =
|
|
166
|
+
manager.focusedKey != null ? d.getKeyBelow(manager.focusedKey) : d.getFirstKey?.();
|
|
167
|
+
if (nextKey == null && shouldFocusWrap) {
|
|
168
|
+
nextKey = d.getFirstKey?.(manager.focusedKey ?? undefined);
|
|
169
|
+
}
|
|
170
|
+
if (nextKey != null) {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
navigateToKey(nextKey);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case "ArrowUp": {
|
|
178
|
+
if (d.getKeyAbove) {
|
|
179
|
+
let nextKey =
|
|
180
|
+
manager.focusedKey != null ? d.getKeyAbove(manager.focusedKey) : d.getLastKey?.();
|
|
181
|
+
if (nextKey == null && shouldFocusWrap) {
|
|
182
|
+
nextKey = d.getLastKey?.(manager.focusedKey ?? undefined);
|
|
183
|
+
}
|
|
184
|
+
if (nextKey != null) {
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
navigateToKey(nextKey);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
case "ArrowLeft": {
|
|
192
|
+
if (d.getKeyLeftOf) {
|
|
193
|
+
let nextKey =
|
|
194
|
+
manager.focusedKey != null ? d.getKeyLeftOf(manager.focusedKey) : d.getFirstKey?.();
|
|
195
|
+
if (nextKey == null && shouldFocusWrap) {
|
|
196
|
+
nextKey =
|
|
197
|
+
direction() === "rtl"
|
|
198
|
+
? d.getFirstKey?.(manager.focusedKey ?? undefined)
|
|
199
|
+
: d.getLastKey?.(manager.focusedKey ?? undefined);
|
|
200
|
+
}
|
|
201
|
+
if (nextKey != null) {
|
|
202
|
+
e.preventDefault();
|
|
203
|
+
navigateToKey(nextKey, direction() === "rtl" ? "first" : "last");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
case "ArrowRight": {
|
|
209
|
+
if (d.getKeyRightOf) {
|
|
210
|
+
let nextKey =
|
|
211
|
+
manager.focusedKey != null ? d.getKeyRightOf(manager.focusedKey) : d.getFirstKey?.();
|
|
212
|
+
if (nextKey == null && shouldFocusWrap) {
|
|
213
|
+
nextKey =
|
|
214
|
+
direction() === "rtl"
|
|
215
|
+
? d.getLastKey?.(manager.focusedKey ?? undefined)
|
|
216
|
+
: d.getFirstKey?.(manager.focusedKey ?? undefined);
|
|
217
|
+
}
|
|
218
|
+
if (nextKey != null) {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
navigateToKey(nextKey, direction() === "rtl" ? "last" : "first");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
case "Home":
|
|
226
|
+
if (d.getFirstKey) {
|
|
227
|
+
if (manager.focusedKey == null && e.shiftKey) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
e.preventDefault();
|
|
232
|
+
const firstKey = d.getFirstKey(manager.focusedKey ?? undefined, isCtrlKeyPressed(e));
|
|
233
|
+
manager.setFocusedKey(firstKey);
|
|
234
|
+
if (firstKey != null) {
|
|
235
|
+
if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === "multiple") {
|
|
236
|
+
manager.extendSelection(firstKey);
|
|
237
|
+
} else if (selectOnFocus()) {
|
|
238
|
+
manager.replaceSelection(firstKey);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
case "End":
|
|
244
|
+
if (d.getLastKey) {
|
|
245
|
+
if (manager.focusedKey == null && e.shiftKey) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
e.preventDefault();
|
|
249
|
+
const lastKey = d.getLastKey(manager.focusedKey ?? undefined, isCtrlKeyPressed(e));
|
|
250
|
+
manager.setFocusedKey(lastKey);
|
|
251
|
+
if (lastKey != null) {
|
|
252
|
+
if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === "multiple") {
|
|
253
|
+
manager.extendSelection(lastKey);
|
|
254
|
+
} else if (selectOnFocus()) {
|
|
255
|
+
manager.replaceSelection(lastKey);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
case "PageDown":
|
|
261
|
+
if (d.getKeyPageBelow && manager.focusedKey != null) {
|
|
262
|
+
const nextKey = d.getKeyPageBelow(manager.focusedKey);
|
|
263
|
+
if (nextKey != null) {
|
|
264
|
+
e.preventDefault();
|
|
265
|
+
navigateToKey(nextKey);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case "PageUp":
|
|
270
|
+
if (d.getKeyPageAbove && manager.focusedKey != null) {
|
|
271
|
+
const nextKey = d.getKeyPageAbove(manager.focusedKey);
|
|
272
|
+
if (nextKey != null) {
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
navigateToKey(nextKey);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
case "a":
|
|
279
|
+
if (
|
|
280
|
+
isCtrlKeyPressed(e) &&
|
|
281
|
+
manager.selectionMode === "multiple" &&
|
|
282
|
+
disallowSelectAll !== true
|
|
283
|
+
) {
|
|
284
|
+
e.preventDefault();
|
|
285
|
+
manager.selectAll();
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
case "Escape":
|
|
289
|
+
if (
|
|
290
|
+
escapeKeyBehavior === "clearSelection" &&
|
|
291
|
+
!disallowEmptySelection &&
|
|
292
|
+
manager.selectedKeys.size !== 0
|
|
293
|
+
) {
|
|
294
|
+
e.stopPropagation();
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
manager.clearSelection();
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
299
|
+
case "Tab": {
|
|
300
|
+
if (!allowsTabNavigation) {
|
|
301
|
+
// There may be elements that are "tabbable" inside a collection (e.g.
|
|
302
|
+
// a button in a grid cell). Collections are a single tab stop with
|
|
303
|
+
// internal arrow-key navigation, so on Tab we move focus to the
|
|
304
|
+
// first/last tabbable element so the browser default continues from
|
|
305
|
+
// there rather than the currently focused item.
|
|
306
|
+
if (e.shiftKey) {
|
|
307
|
+
root.focus();
|
|
308
|
+
} else {
|
|
309
|
+
const walker = getFocusableTreeWalker(root, { tabbable: true });
|
|
310
|
+
let next: HTMLElement | undefined;
|
|
311
|
+
let last: Node | null;
|
|
312
|
+
do {
|
|
313
|
+
last = walker.lastChild();
|
|
314
|
+
if (last) {
|
|
315
|
+
next = last as HTMLElement;
|
|
316
|
+
}
|
|
317
|
+
} while (last);
|
|
318
|
+
|
|
319
|
+
const activeElement = getActiveElement();
|
|
320
|
+
if (next && (!isFocusWithin(next) || (activeElement && !isTabbable(activeElement)))) {
|
|
321
|
+
focusWithoutScrolling(next);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// Store the scroll position so we can restore it later.
|
|
331
|
+
const scrollPos = { top: 0, left: 0 };
|
|
332
|
+
addRefListener(scrollRef, "scroll", () => {
|
|
333
|
+
const sr = scrollRef();
|
|
334
|
+
scrollPos.top = sr?.scrollTop ?? 0;
|
|
335
|
+
scrollPos.left = sr?.scrollLeft ?? 0;
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const onFocusIn = (e: FocusEvent) => {
|
|
339
|
+
const currentTarget = e.currentTarget as Element;
|
|
340
|
+
if (manager.isFocused) {
|
|
341
|
+
// If a focus event bubbled through a portal, reset focus state.
|
|
342
|
+
if (!nodeContains(currentTarget, getEventTarget(e) as Node)) {
|
|
343
|
+
manager.setFocused(false);
|
|
344
|
+
}
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Focus events can bubble through portals. Ignore these events.
|
|
349
|
+
if (!nodeContains(currentTarget, getEventTarget(e) as Node)) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const modality = getInteractionModality();
|
|
354
|
+
manager.setFocused(true);
|
|
355
|
+
const navigate = (key: Key | undefined | null) => {
|
|
356
|
+
if (key != null) {
|
|
357
|
+
manager.setFocusedKey(key);
|
|
358
|
+
if (selectOnFocus() && !manager.isSelected(key)) {
|
|
359
|
+
manager.replaceSelection(key);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
if (focusOnEntry && (modality === "keyboard" || modality === "virtual")) {
|
|
365
|
+
navigate(focusOnEntry === "first" ? delegate().getFirstKey?.() : delegate().getLastKey?.());
|
|
366
|
+
} else if (manager.focusedKey == null) {
|
|
367
|
+
// If the user hasn't yet interacted with the collection there will be no
|
|
368
|
+
// focusedKey set. Detect whether the user is tabbing forward or backward
|
|
369
|
+
// and focus the first or last item accordingly.
|
|
370
|
+
const relatedTarget = e.relatedTarget as Element | null;
|
|
371
|
+
if (
|
|
372
|
+
relatedTarget &&
|
|
373
|
+
currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING
|
|
374
|
+
) {
|
|
375
|
+
navigate(manager.lastSelectedKey ?? delegate().getLastKey?.());
|
|
376
|
+
} else {
|
|
377
|
+
navigate(manager.firstSelectedKey ?? delegate().getFirstKey?.());
|
|
378
|
+
}
|
|
379
|
+
} else if (scrollRef()) {
|
|
380
|
+
// Restore the scroll position to what it was before.
|
|
381
|
+
const sr = scrollRef()!;
|
|
382
|
+
sr.scrollTop = scrollPos.top;
|
|
383
|
+
sr.scrollLeft = scrollPos.left;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (manager.focusedKey != null && scrollRef()) {
|
|
387
|
+
// Refocus and scroll the focused item into view if it exists within the
|
|
388
|
+
// scrollable region.
|
|
389
|
+
const element = getItemElement(ref, manager.focusedKey);
|
|
390
|
+
if (element instanceof HTMLElement) {
|
|
391
|
+
// Prevents a flash of focus on the first/last element, or the collection.
|
|
392
|
+
if (!isFocusWithin(element) && !shouldUseVirtualFocus) {
|
|
393
|
+
focusWithoutScrolling(element);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if (modality === "keyboard" || (focusOnEntry && modality === "virtual")) {
|
|
397
|
+
scrollIntoViewport(element, { containingElement: ref()! });
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const onFocusOut = (e: FocusEvent) => {
|
|
404
|
+
const currentTarget = e.currentTarget as Element;
|
|
405
|
+
// Don't set blurred and then focused again if moving focus within the collection.
|
|
406
|
+
if (!nodeContains(currentTarget, e.relatedTarget as Node)) {
|
|
407
|
+
manager.setFocused(false);
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// Whether to auto-focus the first item once the collection updates (used by
|
|
412
|
+
// virtual focus / autocomplete as the user types).
|
|
413
|
+
let shouldVirtualFocusFirst = false;
|
|
414
|
+
|
|
415
|
+
if (shouldUseVirtualFocus) {
|
|
416
|
+
addRefListener(ref, FOCUS_EVENT, (e: Event) => {
|
|
417
|
+
const detail = (e as CustomEvent).detail;
|
|
418
|
+
e.stopPropagation();
|
|
419
|
+
manager.setFocused(true);
|
|
420
|
+
// If the user is typing forwards, autofocus the first option in the list.
|
|
421
|
+
if (detail?.focusStrategy === "first") {
|
|
422
|
+
shouldVirtualFocusFirst = true;
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
addRefListener(ref, CLEAR_FOCUS_EVENT, (e: Event) => {
|
|
427
|
+
e.stopPropagation();
|
|
428
|
+
manager.setFocused(false);
|
|
429
|
+
if ((e as CustomEvent).detail?.clearFocusKey) {
|
|
430
|
+
manager.setFocusedKey(null);
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// Update active descendant (skip-first; runs on [firstKey, collection.size]).
|
|
436
|
+
createEffect(
|
|
437
|
+
on(
|
|
438
|
+
() => [delegate().getFirstKey?.() ?? null, manager.collection.size] as const,
|
|
439
|
+
([firstKey]) => {
|
|
440
|
+
if (!shouldVirtualFocusFirst) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (firstKey == null) {
|
|
444
|
+
// No focusable items: clear the virtual-focus intent once the
|
|
445
|
+
// collection is settled. We don't move an AT cursor here (the
|
|
446
|
+
// moveVirtualFocus / dispatchVirtualFocus gap noted above).
|
|
447
|
+
if (manager.collection.size > 0) {
|
|
448
|
+
shouldVirtualFocusFirst = false;
|
|
449
|
+
}
|
|
450
|
+
} else {
|
|
451
|
+
manager.setFocusedKey(firstKey);
|
|
452
|
+
shouldVirtualFocusFirst = false;
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
{ defer: true },
|
|
456
|
+
),
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
// Reset the focus-first flag if the focused key changed by any other means.
|
|
460
|
+
createEffect(
|
|
461
|
+
on(
|
|
462
|
+
() => manager.focusedKey,
|
|
463
|
+
() => {
|
|
464
|
+
if (manager.collection.size > 0) {
|
|
465
|
+
shouldVirtualFocusFirst = false;
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
{ defer: true },
|
|
469
|
+
),
|
|
470
|
+
);
|
|
471
|
+
|
|
472
|
+
// Auto-focus the collection (or its first/last/selected item) on mount, once
|
|
473
|
+
// the collection has items. Re-runs as the collection size changes.
|
|
474
|
+
let autoFocusActive = autoFocus !== false;
|
|
475
|
+
let didAutoFocus = false;
|
|
476
|
+
createEffect(() => {
|
|
477
|
+
const size = manager.collection.size;
|
|
478
|
+
const selectedKeys = manager.selectedKeys;
|
|
479
|
+
if (!autoFocusActive) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
let focusedKey: Key | null = null;
|
|
484
|
+
if (autoFocus === "first") {
|
|
485
|
+
focusedKey = delegate().getFirstKey?.() ?? null;
|
|
486
|
+
}
|
|
487
|
+
if (autoFocus === "last") {
|
|
488
|
+
focusedKey = delegate().getLastKey?.() ?? null;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// If there are any selected keys, make the first selectable one the focus target.
|
|
492
|
+
if (selectedKeys.size) {
|
|
493
|
+
for (const key of selectedKeys) {
|
|
494
|
+
if (manager.canSelectItem(key)) {
|
|
495
|
+
focusedKey = key;
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
manager.setFocused(true);
|
|
502
|
+
manager.setFocusedKey(focusedKey);
|
|
503
|
+
|
|
504
|
+
// If no default focus key is selected, focus the collection itself.
|
|
505
|
+
const root = ref();
|
|
506
|
+
if (focusedKey == null && !shouldUseVirtualFocus && root) {
|
|
507
|
+
focusSafely(root);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// Wait until the collection has items to finish auto-focusing.
|
|
511
|
+
if (size > 0) {
|
|
512
|
+
autoFocusActive = false;
|
|
513
|
+
didAutoFocus = true;
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
// Scroll the focused element into view when the focusedKey changes.
|
|
518
|
+
let lastFocusedKey = manager.focusedKey;
|
|
519
|
+
let raf: number | null = null;
|
|
520
|
+
createEffect(() => {
|
|
521
|
+
const isFocused = manager.isFocused;
|
|
522
|
+
const focusedKey = manager.focusedKey;
|
|
523
|
+
const root = ref();
|
|
524
|
+
const sr = scrollRef();
|
|
525
|
+
if (
|
|
526
|
+
isFocused &&
|
|
527
|
+
focusedKey != null &&
|
|
528
|
+
(focusedKey !== lastFocusedKey || didAutoFocus) &&
|
|
529
|
+
sr &&
|
|
530
|
+
root
|
|
531
|
+
) {
|
|
532
|
+
const modality = getInteractionModality();
|
|
533
|
+
const element = getItemElement(ref, focusedKey);
|
|
534
|
+
if (!(element instanceof HTMLElement)) {
|
|
535
|
+
// The element wasn't found yet (e.g. a virtualizer hasn't rendered it).
|
|
536
|
+
// Return without updating bookkeeping so we retry on the next change.
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (modality === "keyboard" || didAutoFocus) {
|
|
541
|
+
if (raf != null) {
|
|
542
|
+
cancelAnimationFrame(raf);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
raf = requestAnimationFrame(() => {
|
|
546
|
+
const scrollEl = scrollRef();
|
|
547
|
+
if (scrollEl) {
|
|
548
|
+
scrollIntoView(scrollEl, element);
|
|
549
|
+
// Avoid scroll in iOS VO, since it may cause an overlay to close.
|
|
550
|
+
if (modality !== "virtual") {
|
|
551
|
+
scrollIntoViewport(element, { containingElement: ref()! });
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// If the focused key became null (e.g. the last item was deleted), focus the
|
|
559
|
+
// whole collection.
|
|
560
|
+
if (
|
|
561
|
+
!shouldUseVirtualFocus &&
|
|
562
|
+
isFocused &&
|
|
563
|
+
focusedKey == null &&
|
|
564
|
+
lastFocusedKey != null &&
|
|
565
|
+
root
|
|
566
|
+
) {
|
|
567
|
+
focusSafely(root);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
lastFocusedKey = focusedKey;
|
|
571
|
+
didAutoFocus = false;
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
onCleanup(() => {
|
|
575
|
+
if (raf != null) {
|
|
576
|
+
cancelAnimationFrame(raf);
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
// Intercept FocusScope restoration since virtualized collections can reuse DOM nodes.
|
|
581
|
+
addRefListener(ref, "react-aria-focus-scope-restore", (e: Event) => {
|
|
582
|
+
e.preventDefault();
|
|
583
|
+
manager.setFocused(true);
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
const onMouseDown = (e: MouseEvent) => {
|
|
587
|
+
// Ignore events that bubbled through portals.
|
|
588
|
+
if (scrollRef() === getEventTarget(e)) {
|
|
589
|
+
// Prevent focus going to the collection when clicking on the scrollbar.
|
|
590
|
+
e.preventDefault();
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
const { typeSelectProps } = createTypeSelect<T>({
|
|
595
|
+
collection: () => manager.collection,
|
|
596
|
+
focusedKey: () => manager.focusedKey,
|
|
597
|
+
onFocusedKeyChange: (key) => manager.setFocusedKey(key),
|
|
598
|
+
isKeyDisabled: (key) => manager.isDisabled(key),
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
// A stable id shared with this collection's items (keyed by the manager) so
|
|
602
|
+
// getItemElement can scope a query by `data-collection`.
|
|
603
|
+
const collectionId = registerCollectionId(manager);
|
|
604
|
+
|
|
605
|
+
return {
|
|
606
|
+
get collectionProps(): JSX.HTMLAttributes<HTMLElement> {
|
|
607
|
+
let tabIndex: number | undefined;
|
|
608
|
+
if (!shouldUseVirtualFocus) {
|
|
609
|
+
tabIndex = manager.focusedKey == null ? 0 : -1;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
let handlers: Record<string, unknown> = {
|
|
613
|
+
onKeyDown,
|
|
614
|
+
onFocusIn,
|
|
615
|
+
onFocusOut,
|
|
616
|
+
onMouseDown,
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
if (!disallowTypeAhead) {
|
|
620
|
+
handlers = mergeProps(typeSelectProps as Record<string, unknown>, handlers);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
return mergeProps(handlers, {
|
|
624
|
+
tabIndex,
|
|
625
|
+
"data-collection": collectionId,
|
|
626
|
+
}) as JSX.HTMLAttributes<HTMLElement>;
|
|
627
|
+
},
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/** Attaches `type` to the element from `ref`, re-binding when the element changes. */
|
|
632
|
+
function addRefListener(
|
|
633
|
+
ref: () => HTMLElement | null,
|
|
634
|
+
type: string,
|
|
635
|
+
handler: (e: Event) => void,
|
|
636
|
+
): void {
|
|
637
|
+
createEffect(() => {
|
|
638
|
+
const el = ref();
|
|
639
|
+
if (!el) {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
el.addEventListener(type, handler);
|
|
643
|
+
onCleanup(() => el.removeEventListener(type, handler));
|
|
644
|
+
});
|
|
645
|
+
}
|