@proyecto-viviana/solidaria 0.3.0 → 0.4.1
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/DragManager.js +627 -0
- package/dist/_chunk/DragManager.js.map +1 -0
- package/dist/_chunk/DragManager.jsx +627 -0
- package/dist/_chunk/DragManager.jsx.map +1 -0
- package/dist/_chunk/FocusScope.js +400 -0
- package/dist/_chunk/FocusScope.js.map +1 -0
- package/dist/_chunk/FocusScope.jsx +375 -0
- package/dist/_chunk/FocusScope.jsx.map +1 -0
- package/dist/_chunk/actiongroup.js +141 -0
- package/dist/_chunk/actiongroup.js.map +1 -0
- package/dist/_chunk/actiongroup.jsx +141 -0
- package/dist/_chunk/actiongroup.jsx.map +1 -0
- package/dist/_chunk/announce.js +207 -0
- package/dist/_chunk/announce.js.map +1 -0
- package/dist/_chunk/announce.jsx +207 -0
- package/dist/_chunk/announce.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 +244 -0
- package/dist/_chunk/autocomplete.js.map +1 -0
- package/dist/_chunk/autocomplete.jsx +244 -0
- package/dist/_chunk/autocomplete.jsx.map +1 -0
- package/dist/_chunk/breadcrumbs.js +121 -0
- package/dist/_chunk/breadcrumbs.js.map +1 -0
- package/dist/_chunk/breadcrumbs.jsx +121 -0
- package/dist/_chunk/breadcrumbs.jsx.map +1 -0
- package/dist/_chunk/button.js +275 -0
- package/dist/_chunk/button.js.map +1 -0
- package/dist/_chunk/button.jsx +275 -0
- package/dist/_chunk/button.jsx.map +1 -0
- package/dist/_chunk/calendar.js +1037 -0
- package/dist/_chunk/calendar.js.map +1 -0
- package/dist/_chunk/calendar.jsx +1037 -0
- package/dist/_chunk/calendar.jsx.map +1 -0
- package/dist/_chunk/checkbox.js +235 -0
- package/dist/_chunk/checkbox.js.map +1 -0
- package/dist/_chunk/checkbox.jsx +235 -0
- package/dist/_chunk/checkbox.jsx.map +1 -0
- package/dist/_chunk/color.js +1458 -0
- package/dist/_chunk/color.js.map +1 -0
- package/dist/_chunk/color.jsx +1458 -0
- package/dist/_chunk/color.jsx.map +1 -0
- package/dist/_chunk/combobox.js +1062 -0
- package/dist/_chunk/combobox.js.map +1 -0
- package/dist/_chunk/combobox.jsx +1062 -0
- package/dist/_chunk/combobox.jsx.map +1 -0
- package/dist/_chunk/constants.js +19 -0
- package/dist/_chunk/constants.js.map +1 -0
- package/dist/_chunk/constants.jsx +19 -0
- package/dist/_chunk/constants.jsx.map +1 -0
- package/dist/_chunk/createCollator.js +61 -0
- package/dist/_chunk/createCollator.js.map +1 -0
- package/dist/_chunk/createCollator.jsx +61 -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 +55 -0
- package/dist/_chunk/createField.js.map +1 -0
- package/dist/_chunk/createField.jsx +55 -0
- package/dist/_chunk/createField.jsx.map +1 -0
- package/dist/_chunk/createFocus.js +105 -0
- package/dist/_chunk/createFocus.js.map +1 -0
- package/dist/_chunk/createFocus.jsx +105 -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 +120 -0
- package/dist/_chunk/createFocusWithin.js.map +1 -0
- package/dist/_chunk/createFocusWithin.jsx +120 -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/createFormReset.js +39 -0
- package/dist/_chunk/createFormReset.js.map +1 -0
- package/dist/_chunk/createFormReset.jsx +39 -0
- package/dist/_chunk/createFormReset.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 +131 -0
- package/dist/_chunk/createHover.js.map +1 -0
- package/dist/_chunk/createHover.jsx +131 -0
- package/dist/_chunk/createHover.jsx.map +1 -0
- package/dist/_chunk/createInteractionModality.js +268 -0
- package/dist/_chunk/createInteractionModality.js.map +1 -0
- package/dist/_chunk/createInteractionModality.jsx +268 -0
- package/dist/_chunk/createInteractionModality.jsx.map +1 -0
- package/dist/_chunk/createLabel.js +47 -0
- package/dist/_chunk/createLabel.js.map +1 -0
- package/dist/_chunk/createLabel.jsx +47 -0
- package/dist/_chunk/createLabel.jsx.map +1 -0
- package/dist/_chunk/createLabels.js +32 -0
- package/dist/_chunk/createLabels.js.map +1 -0
- package/dist/_chunk/createLabels.jsx +32 -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/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 +82 -0
- package/dist/_chunk/createProgressBar.js.map +1 -0
- package/dist/_chunk/createProgressBar.jsx +82 -0
- package/dist/_chunk/createProgressBar.jsx.map +1 -0
- package/dist/_chunk/createSelectableItem.js +302 -0
- package/dist/_chunk/createSelectableItem.js.map +1 -0
- package/dist/_chunk/createSelectableItem.jsx +302 -0
- package/dist/_chunk/createSelectableItem.jsx.map +1 -0
- package/dist/_chunk/createStringFormatter.js +61 -0
- package/dist/_chunk/createStringFormatter.js.map +1 -0
- package/dist/_chunk/createStringFormatter.jsx +61 -0
- package/dist/_chunk/createStringFormatter.jsx.map +1 -0
- package/dist/_chunk/createToggle.js +159 -0
- package/dist/_chunk/createToggle.js.map +1 -0
- package/dist/_chunk/createToggle.jsx +159 -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 +1706 -0
- package/dist/_chunk/datepicker.js.map +1 -0
- package/dist/_chunk/datepicker.jsx +1706 -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 +2395 -0
- package/dist/_chunk/dnd.js.map +1 -0
- package/dist/_chunk/dnd.jsx +2395 -0
- package/dist/_chunk/dnd.jsx.map +1 -0
- package/dist/_chunk/env.js +87 -0
- package/dist/_chunk/env.js.map +1 -0
- package/dist/_chunk/env.jsx +87 -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 +631 -0
- package/dist/_chunk/focus2.js.map +1 -0
- package/dist/_chunk/focus2.jsx +631 -0
- package/dist/_chunk/focus2.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 +369 -0
- package/dist/_chunk/gridlist.js.map +1 -0
- package/dist/_chunk/gridlist.jsx +369 -0
- package/dist/_chunk/gridlist.jsx.map +1 -0
- package/dist/_chunk/i18n.js +199 -0
- package/dist/_chunk/i18n.js.map +1 -0
- package/dist/_chunk/i18n.jsx +199 -0
- package/dist/_chunk/i18n.jsx.map +1 -0
- package/dist/_chunk/interactions.js +331 -0
- package/dist/_chunk/interactions.js.map +1 -0
- package/dist/_chunk/interactions.jsx +325 -0
- package/dist/_chunk/interactions.jsx.map +1 -0
- package/dist/_chunk/link.js +97 -0
- package/dist/_chunk/link.js.map +1 -0
- package/dist/_chunk/link.jsx +97 -0
- package/dist/_chunk/link.jsx.map +1 -0
- package/dist/_chunk/listbox.js +356 -0
- package/dist/_chunk/listbox.js.map +1 -0
- package/dist/_chunk/listbox.jsx +356 -0
- package/dist/_chunk/listbox.jsx.map +1 -0
- package/dist/_chunk/locale.js +173 -0
- package/dist/_chunk/locale.js.map +1 -0
- package/dist/_chunk/locale.jsx +167 -0
- package/dist/_chunk/locale.jsx.map +1 -0
- package/dist/_chunk/menu.js +519 -0
- package/dist/_chunk/menu.js.map +1 -0
- package/dist/_chunk/menu.jsx +519 -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 +259 -0
- package/dist/_chunk/numberfield.js.map +1 -0
- package/dist/_chunk/numberfield.jsx +259 -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 +320 -0
- package/dist/_chunk/radio.js.map +1 -0
- package/dist/_chunk/radio.jsx +320 -0
- package/dist/_chunk/radio.jsx.map +1 -0
- package/dist/_chunk/reactivity.js +21 -0
- package/dist/_chunk/reactivity.js.map +1 -0
- package/dist/_chunk/reactivity.jsx +21 -0
- package/dist/_chunk/reactivity.jsx.map +1 -0
- package/dist/_chunk/searchfield.js +210 -0
- package/dist/_chunk/searchfield.js.map +1 -0
- package/dist/_chunk/searchfield.jsx +210 -0
- package/dist/_chunk/searchfield.jsx.map +1 -0
- package/dist/_chunk/select.js +406 -0
- package/dist/_chunk/select.js.map +1 -0
- package/dist/_chunk/select.jsx +397 -0
- package/dist/_chunk/select.jsx.map +1 -0
- package/dist/_chunk/selection.js +666 -0
- package/dist/_chunk/selection.js.map +1 -0
- package/dist/_chunk/selection.jsx +666 -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 +256 -0
- package/dist/_chunk/slider.js.map +1 -0
- package/dist/_chunk/slider.jsx +256 -0
- package/dist/_chunk/slider.jsx.map +1 -0
- package/dist/_chunk/spinbutton.js +153 -0
- package/dist/_chunk/spinbutton.js.map +1 -0
- package/dist/_chunk/spinbutton.jsx +153 -0
- package/dist/_chunk/spinbutton.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 +1088 -0
- package/dist/_chunk/table.js.map +1 -0
- package/dist/_chunk/table.jsx +1088 -0
- package/dist/_chunk/table.jsx.map +1 -0
- package/dist/_chunk/tabs.js +263 -0
- package/dist/_chunk/tabs.js.map +1 -0
- package/dist/_chunk/tabs.jsx +263 -0
- package/dist/_chunk/tabs.jsx.map +1 -0
- package/dist/_chunk/tag.js +322 -0
- package/dist/_chunk/tag.js.map +1 -0
- package/dist/_chunk/tag.jsx +322 -0
- package/dist/_chunk/tag.jsx.map +1 -0
- package/dist/_chunk/textfield.js +110 -0
- package/dist/_chunk/textfield.js.map +1 -0
- package/dist/_chunk/textfield.jsx +110 -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 +226 -0
- package/dist/_chunk/toolbar.js.map +1 -0
- package/dist/_chunk/toolbar.jsx +226 -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 +452 -0
- package/dist/_chunk/tree.js.map +1 -0
- package/dist/_chunk/tree.jsx +452 -0
- package/dist/_chunk/tree.jsx.map +1 -0
- package/dist/_chunk/utils.js +705 -0
- package/dist/_chunk/utils.js.map +1 -0
- package/dist/_chunk/utils.jsx +705 -0
- package/dist/_chunk/utils.jsx.map +1 -0
- package/dist/_chunk/visually-hidden.js +93 -0
- package/dist/_chunk/visually-hidden.js.map +1 -0
- package/dist/_chunk/visually-hidden.jsx +93 -0
- package/dist/_chunk/visually-hidden.jsx.map +1 -0
- package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
- package/dist/actiongroup/index.js +2 -0
- package/dist/actiongroup/index.jsx +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts +12 -7
- 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/createBreadcrumbs.d.ts.map +1 -1
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/index.jsx +2 -0
- package/dist/button/createToggleButtonGroup.d.ts.map +1 -1
- 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/createRangeCalendarCell.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/intl/index.d.ts +1 -1
- package/dist/calendar/intl/index.d.ts.map +1 -1
- 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/createColorArea.d.ts.map +1 -1
- package/dist/color/createColorField.d.ts.map +1 -1
- package/dist/color/createColorSlider.d.ts.map +1 -1
- package/dist/color/createColorSwatch.d.ts.map +1 -1
- package/dist/color/createColorWheel.d.ts.map +1 -1
- package/dist/color/index.js +2 -0
- package/dist/color/index.jsx +2 -0
- package/dist/color/intl/index.d.ts +30 -0
- package/dist/color/intl/index.d.ts.map +1 -0
- package/dist/combobox/createComboBox.d.ts.map +1 -1
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.jsx +2 -0
- package/dist/combobox/intl/generated-locales.d.ts +16 -0
- package/dist/combobox/intl/generated-locales.d.ts.map +1 -0
- package/dist/combobox/intl/index.d.ts +2 -2
- package/dist/combobox/intl/index.d.ts.map +1 -1
- package/dist/datepicker/createDateField.d.ts +45 -23
- package/dist/datepicker/createDateField.d.ts.map +1 -1
- package/dist/datepicker/createDatePicker.d.ts +34 -6
- package/dist/datepicker/createDatePicker.d.ts.map +1 -1
- package/dist/datepicker/createDatePickerGroup.d.ts +13 -13
- package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -1
- package/dist/datepicker/createDateRangePicker.d.ts +55 -7
- package/dist/datepicker/createDateRangePicker.d.ts.map +1 -1
- package/dist/datepicker/createDateSegment.d.ts +6 -15
- package/dist/datepicker/createDateSegment.d.ts.map +1 -1
- package/dist/datepicker/createDisplayNames.d.ts +17 -0
- package/dist/datepicker/createDisplayNames.d.ts.map +1 -0
- package/dist/datepicker/createTimeField.d.ts +12 -49
- package/dist/datepicker/createTimeField.d.ts.map +1 -1
- package/dist/datepicker/index.d.ts +3 -3
- 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/datepicker/intl.d.ts +12 -0
- package/dist/datepicker/intl.d.ts.map +1 -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/DragManager.d.ts +86 -0
- package/dist/dnd/DragManager.d.ts.map +1 -0
- package/dist/dnd/DropTargetKeyboardNavigation.d.ts +42 -0
- package/dist/dnd/DropTargetKeyboardNavigation.d.ts.map +1 -0
- package/dist/dnd/createDrag.d.ts.map +1 -1
- package/dist/dnd/createDraggableCollection.d.ts.map +1 -1
- package/dist/dnd/createDraggableItem.d.ts +12 -7
- package/dist/dnd/createDraggableItem.d.ts.map +1 -1
- package/dist/dnd/createDroppableCollection.d.ts +7 -15
- package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
- package/dist/dnd/index.d.ts +5 -1
- package/dist/dnd/index.d.ts.map +1 -1
- package/dist/dnd/index.js +3 -0
- package/dist/dnd/index.jsx +3 -0
- package/dist/dnd/intl/index.d.ts +39 -0
- package/dist/dnd/intl/index.d.ts.map +1 -0
- package/dist/dnd/utils.d.ts +7 -2
- package/dist/dnd/utils.d.ts.map +1 -1
- package/dist/focus/FocusScope.d.ts +7 -0
- package/dist/focus/FocusScope.d.ts.map +1 -1
- package/dist/focus/index.d.ts +2 -1
- package/dist/focus/index.d.ts.map +1 -1
- package/dist/focus/index.js +3 -0
- package/dist/focus/index.jsx +3 -0
- package/dist/focus/virtualFocus.d.ts +26 -0
- package/dist/focus/virtualFocus.d.ts.map +1 -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 +5 -0
- package/dist/i18n/index.jsx +5 -0
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +77 -18311
- package/dist/index.jsx +77 -18242
- package/dist/interactions/FocusableProvider.d.ts.map +1 -1
- package/dist/interactions/PressEvent.d.ts +11 -0
- package/dist/interactions/PressEvent.d.ts.map +1 -1
- package/dist/interactions/createFocus.d.ts.map +1 -1
- package/dist/interactions/createFocusWithin.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 +9 -0
- package/dist/interactions/index.jsx +9 -0
- package/dist/label/createLabels.d.ts.map +1 -1
- 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 +7 -1
- 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 +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 +5 -0
- package/dist/selection/index.jsx +5 -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/spinbutton/createSpinButton.d.ts +41 -0
- package/dist/spinbutton/createSpinButton.d.ts.map +1 -0
- package/dist/spinbutton/index.d.ts +3 -0
- package/dist/spinbutton/index.d.ts.map +1 -0
- package/dist/spinbutton/index.js +2 -0
- package/dist/spinbutton/index.jsx +2 -0
- package/dist/spinbutton/intl.d.ts +5 -0
- package/dist/spinbutton/intl.d.ts.map +1 -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/createTableColumnHeader.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/createTableSelectionCheckbox.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 +35 -1
- package/dist/table/types.d.ts.map +1 -1
- package/dist/table/utils.d.ts +15 -0
- package/dist/table/utils.d.ts.map +1 -0
- package/dist/tabs/createTabs.d.ts +5 -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/createTagGroup.d.ts +7 -0
- package/dist/tag/createTagGroup.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/createTreeSelectionCheckbox.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 +49 -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 +6 -0
- package/dist/utils/index.jsx +6 -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/actiongroup/createActionGroup.ts +26 -109
- package/src/autocomplete/createAutocomplete.ts +202 -35
- package/src/breadcrumbs/createBreadcrumbs.ts +12 -4
- package/src/button/createToggleButtonGroup.ts +19 -14
- package/src/calendar/createCalendar.ts +5 -4
- package/src/calendar/createCalendarCell.ts +36 -5
- package/src/calendar/createCalendarGrid.ts +47 -12
- package/src/calendar/createCalendarMonthPicker.ts +105 -0
- package/src/calendar/createCalendarYearPicker.ts +144 -0
- package/src/calendar/createRangeCalendar.ts +27 -15
- package/src/calendar/createRangeCalendarCell.ts +17 -3
- package/src/calendar/index.ts +17 -0
- package/src/calendar/intl/index.ts +8 -0
- package/src/calendar/utils.ts +4 -0
- package/src/checkbox/createCheckbox.ts +10 -0
- package/src/checkbox/createCheckboxGroupItem.ts +12 -16
- package/src/color/createColorArea.ts +17 -10
- package/src/color/createColorField.ts +8 -1
- package/src/color/createColorSlider.ts +1 -2
- package/src/color/createColorSwatch.ts +4 -2
- package/src/color/createColorWheel.ts +0 -6
- package/src/color/intl/index.ts +316 -0
- package/src/combobox/createComboBox.ts +35 -4
- package/src/combobox/intl/generated-locales.ts +635 -0
- package/src/combobox/intl/index.ts +8 -2
- package/src/datepicker/createDateField.ts +228 -213
- package/src/datepicker/createDatePicker.ts +157 -146
- package/src/datepicker/createDatePickerGroup.ts +88 -82
- package/src/datepicker/createDateRangePicker.ts +230 -179
- package/src/datepicker/createDateSegment.ts +386 -384
- package/src/datepicker/createDisplayNames.ts +45 -0
- package/src/datepicker/createTimeField.ts +36 -129
- package/src/datepicker/index.ts +13 -14
- package/src/datepicker/intl.ts +633 -0
- package/src/dnd/DragManager.ts +693 -0
- package/src/dnd/DropTargetKeyboardNavigation.ts +337 -0
- package/src/dnd/createDrag.ts +31 -5
- package/src/dnd/createDraggableCollection.ts +33 -15
- package/src/dnd/createDraggableItem.ts +92 -5
- package/src/dnd/createDroppableCollection.ts +488 -371
- package/src/dnd/index.ts +11 -0
- package/src/dnd/intl/ar-AE.json +29 -0
- package/src/dnd/intl/bg-BG.json +29 -0
- package/src/dnd/intl/cs-CZ.json +29 -0
- package/src/dnd/intl/da-DK.json +29 -0
- package/src/dnd/intl/de-DE.json +29 -0
- package/src/dnd/intl/el-GR.json +29 -0
- package/src/dnd/intl/en-US.json +29 -0
- package/src/dnd/intl/es-ES.json +29 -0
- package/src/dnd/intl/et-EE.json +29 -0
- package/src/dnd/intl/fi-FI.json +29 -0
- package/src/dnd/intl/fr-FR.json +29 -0
- package/src/dnd/intl/he-IL.json +29 -0
- package/src/dnd/intl/hr-HR.json +29 -0
- package/src/dnd/intl/hu-HU.json +29 -0
- package/src/dnd/intl/index.ts +139 -0
- package/src/dnd/intl/it-IT.json +29 -0
- package/src/dnd/intl/ja-JP.json +29 -0
- package/src/dnd/intl/ko-KR.json +29 -0
- package/src/dnd/intl/lt-LT.json +29 -0
- package/src/dnd/intl/lv-LV.json +29 -0
- package/src/dnd/intl/nb-NO.json +29 -0
- package/src/dnd/intl/nl-NL.json +29 -0
- package/src/dnd/intl/pl-PL.json +29 -0
- package/src/dnd/intl/pt-BR.json +29 -0
- package/src/dnd/intl/pt-PT.json +29 -0
- package/src/dnd/intl/ro-RO.json +29 -0
- package/src/dnd/intl/ru-RU.json +29 -0
- package/src/dnd/intl/sk-SK.json +29 -0
- package/src/dnd/intl/sl-SI.json +29 -0
- package/src/dnd/intl/sr-SP.json +29 -0
- package/src/dnd/intl/sv-SE.json +29 -0
- package/src/dnd/intl/tr-TR.json +29 -0
- package/src/dnd/intl/uk-UA.json +29 -0
- package/src/dnd/intl/zh-CN.json +29 -0
- package/src/dnd/intl/zh-TW.json +29 -0
- package/src/dnd/utils.ts +63 -3
- package/src/focus/FocusScope.tsx +266 -24
- package/src/focus/index.ts +8 -0
- package/src/focus/virtualFocus.ts +55 -0
- package/src/form/createFormValidation.ts +8 -1
- package/src/gridlist/createGridList.ts +187 -48
- 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 +51 -3
- package/src/interactions/FocusableProvider.tsx +11 -6
- package/src/interactions/PressEvent.ts +14 -0
- package/src/interactions/createFocus.ts +26 -21
- package/src/interactions/createFocusWithin.ts +23 -24
- package/src/interactions/createInteractionModality.ts +26 -15
- package/src/interactions/createKeyboard.ts +10 -0
- package/src/interactions/createPress.ts +29 -6
- package/src/label/createLabels.ts +7 -4
- package/src/listbox/createListBox.ts +203 -10
- package/src/listbox/createOption.ts +84 -74
- 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 +41 -4
- 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 +512 -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/spinbutton/createSpinButton.ts +163 -0
- package/src/spinbutton/index.ts +10 -0
- package/src/spinbutton/intl.ts +115 -0
- package/src/ssr/index.tsx +31 -0
- package/src/switch/createSwitch.ts +10 -0
- package/src/table/createTable.ts +82 -27
- package/src/table/createTableColumnHeader.ts +10 -0
- package/src/table/createTableRow.ts +208 -203
- package/src/table/createTableSelectAllCheckbox.ts +3 -4
- package/src/table/createTableSelectionCheckbox.ts +24 -1
- package/src/table/types.ts +37 -1
- package/src/table/utils.ts +41 -0
- package/src/tabs/createTabs.ts +95 -24
- package/src/tag/createTag.ts +30 -36
- package/src/tag/createTagGroup.ts +92 -0
- package/src/toast/createToast.ts +1 -0
- package/src/toggle/createToggle.ts +20 -0
- package/src/toolbar/createToolbar.ts +43 -94
- package/src/tree/createTree.ts +165 -52
- package/src/tree/createTreeItem.ts +105 -120
- package/src/tree/createTreeSelectionCheckbox.ts +14 -1
- package/src/tree/types.ts +10 -0
- package/src/utils/animation.ts +243 -0
- package/src/utils/dom.ts +216 -25
- package/src/utils/index.ts +10 -0
- package/src/utils/keyboard.ts +25 -0
- package/src/utils/mergeProps.ts +8 -1
- package/src/utils/scrollIntoView.ts +181 -0
- package/dist/datepicker/createTimeSegment.d.ts +0 -29
- package/dist/datepicker/createTimeSegment.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.jsx.map +0 -1
- package/src/datepicker/createTimeSegment.ts +0 -352
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ListKeyboardDelegate - keyboard navigation for a list/stack collection.
|
|
3
|
+
* Based on @react-aria/selection's `ListKeyboardDelegate`.
|
|
4
|
+
*
|
|
5
|
+
* React → Solid adaptations (faithful to upstream behavior):
|
|
6
|
+
* - The ref is a Solid accessor (`() => HTMLElement | null`) rather than a
|
|
7
|
+
* React `RefObject`; `this.ref()` replaces `this.ref.current`.
|
|
8
|
+
* - Only the options-object constructor is kept. Upstream also retains a legacy
|
|
9
|
+
* positional overload for old `useSelectableCollection` callers; we have none.
|
|
10
|
+
* - `getKeyLeftOf` / `getKeyRightOf` are still removed for a vertical stack
|
|
11
|
+
* (so `delegate.getKeyLeftOf` is `undefined`, exactly as upstream), which the
|
|
12
|
+
* selectable-collection handler relies on to no-op Left/Right.
|
|
13
|
+
* - Disabled resolution reads our node shape: per-item disabled lives on the
|
|
14
|
+
* top-level `node.isDisabled` (and is also funneled into `disabledKeys`),
|
|
15
|
+
* while upstream reads `node.props.isDisabled`. We check both so the delegate
|
|
16
|
+
* is correct whether constructed from a manager or directly in a test.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { Accessor } from "solid-js";
|
|
20
|
+
import type {
|
|
21
|
+
Collection,
|
|
22
|
+
CollectionNode,
|
|
23
|
+
DisabledBehavior,
|
|
24
|
+
Key,
|
|
25
|
+
} from "@proyecto-viviana/solid-stately";
|
|
26
|
+
import type { KeyboardDelegate } from "../grid/types";
|
|
27
|
+
import { isScrollable } from "../utils/dom";
|
|
28
|
+
import { getItemElement } from "./utils";
|
|
29
|
+
import { DOMLayoutDelegate, type LayoutDelegate, type Rect } from "./DOMLayoutDelegate";
|
|
30
|
+
|
|
31
|
+
/** The primary orientation of a list's items. */
|
|
32
|
+
export type Orientation = "horizontal" | "vertical";
|
|
33
|
+
/** Text direction. */
|
|
34
|
+
export type Direction = "ltr" | "rtl";
|
|
35
|
+
|
|
36
|
+
export interface ListKeyboardDelegateOptions<T> {
|
|
37
|
+
/** The collection to navigate. */
|
|
38
|
+
collection: Collection<T>;
|
|
39
|
+
/** A Solid ref accessor to the collection element. */
|
|
40
|
+
ref: Accessor<HTMLElement | null>;
|
|
41
|
+
/** A locale-aware collator used for typeahead search. */
|
|
42
|
+
collator?: Intl.Collator;
|
|
43
|
+
/** The layout of the items: a 1D `stack` (default) or a 2D `grid`. */
|
|
44
|
+
layout?: "stack" | "grid";
|
|
45
|
+
/** The primary orientation of the items. @default 'vertical' */
|
|
46
|
+
orientation?: Orientation;
|
|
47
|
+
/** The text direction. */
|
|
48
|
+
direction?: Direction;
|
|
49
|
+
/** The item keys that are disabled. */
|
|
50
|
+
disabledKeys?: Set<Key>;
|
|
51
|
+
/** Whether disabled items are skipped by navigation. @default 'all' */
|
|
52
|
+
disabledBehavior?: DisabledBehavior;
|
|
53
|
+
/** A delegate providing layout information (defaults to a DOM-backed one). */
|
|
54
|
+
layoutDelegate?: LayoutDelegate;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A keyboard delegate that handles navigation within a list/stack collection.
|
|
59
|
+
*/
|
|
60
|
+
export class ListKeyboardDelegate<T> implements KeyboardDelegate {
|
|
61
|
+
private collection: Collection<T>;
|
|
62
|
+
private disabledKeys: Set<Key>;
|
|
63
|
+
private disabledBehavior: DisabledBehavior;
|
|
64
|
+
private ref: Accessor<HTMLElement | null>;
|
|
65
|
+
private collator: Intl.Collator | undefined;
|
|
66
|
+
private layout: "stack" | "grid";
|
|
67
|
+
private orientation: Orientation;
|
|
68
|
+
private direction: Direction | undefined;
|
|
69
|
+
private layoutDelegate: LayoutDelegate;
|
|
70
|
+
|
|
71
|
+
/** Present unless this is a vertical stack (mirrors upstream's method deletion). */
|
|
72
|
+
getKeyLeftOf?: (key: Key, options?: { includeDisabled?: boolean }) => Key | null;
|
|
73
|
+
/** Present unless this is a vertical stack (mirrors upstream's method deletion). */
|
|
74
|
+
getKeyRightOf?: (key: Key, options?: { includeDisabled?: boolean }) => Key | null;
|
|
75
|
+
|
|
76
|
+
constructor(options: ListKeyboardDelegateOptions<T>) {
|
|
77
|
+
this.collection = options.collection;
|
|
78
|
+
this.ref = options.ref;
|
|
79
|
+
this.collator = options.collator;
|
|
80
|
+
this.disabledKeys = options.disabledKeys ?? new Set();
|
|
81
|
+
this.disabledBehavior = options.disabledBehavior ?? "all";
|
|
82
|
+
this.orientation = options.orientation ?? "vertical";
|
|
83
|
+
this.direction = options.direction;
|
|
84
|
+
this.layout = options.layout ?? "stack";
|
|
85
|
+
this.layoutDelegate = options.layoutDelegate ?? new DOMLayoutDelegate(options.ref);
|
|
86
|
+
|
|
87
|
+
// For anything but a vertical stack, expose the left/right methods. Leaving
|
|
88
|
+
// them undefined for a vertical stack matches upstream, which deletes them so
|
|
89
|
+
// the selectable-collection handler treats Left/Right as no-ops.
|
|
90
|
+
if (!(this.layout === "stack" && this.orientation === "vertical")) {
|
|
91
|
+
this.getKeyLeftOf = (key, opts) => this.computeKeyLeftOf(key, opts);
|
|
92
|
+
this.getKeyRightOf = (key, opts) => this.computeKeyRightOf(key, opts);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private isDisabled(item: CollectionNode<T>): boolean {
|
|
97
|
+
return (
|
|
98
|
+
this.disabledBehavior === "all" &&
|
|
99
|
+
(item.props?.isDisabled === true ||
|
|
100
|
+
item.isDisabled === true ||
|
|
101
|
+
this.disabledKeys.has(item.key)) &&
|
|
102
|
+
item.props?.disabledBehavior !== "selection"
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private findNextNonDisabled(
|
|
107
|
+
key: Key | null,
|
|
108
|
+
getNext: (key: Key) => Key | null,
|
|
109
|
+
includeDisabled = false,
|
|
110
|
+
): Key | null {
|
|
111
|
+
let nextKey = key;
|
|
112
|
+
while (nextKey != null) {
|
|
113
|
+
const item = this.collection.getItem(nextKey);
|
|
114
|
+
if (item?.type === "item" && (includeDisabled || !this.isDisabled(item))) {
|
|
115
|
+
return nextKey;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
nextKey = getNext(nextKey);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
getNextKey(key: Key, options?: { includeDisabled?: boolean }): Key | null {
|
|
125
|
+
let nextKey: Key | null = key;
|
|
126
|
+
nextKey = this.collection.getKeyAfter(nextKey);
|
|
127
|
+
return this.findNextNonDisabled(
|
|
128
|
+
nextKey,
|
|
129
|
+
(k) => this.collection.getKeyAfter(k),
|
|
130
|
+
options?.includeDisabled,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
getPreviousKey(key: Key, options?: { includeDisabled?: boolean }): Key | null {
|
|
135
|
+
let nextKey: Key | null = key;
|
|
136
|
+
nextKey = this.collection.getKeyBefore(nextKey);
|
|
137
|
+
return this.findNextNonDisabled(
|
|
138
|
+
nextKey,
|
|
139
|
+
(k) => this.collection.getKeyBefore(k),
|
|
140
|
+
options?.includeDisabled,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private findKey(
|
|
145
|
+
key: Key,
|
|
146
|
+
nextKey: (key: Key) => Key | null,
|
|
147
|
+
shouldSkip: (prevRect: Rect, itemRect: Rect) => boolean,
|
|
148
|
+
): Key | null {
|
|
149
|
+
let tempKey: Key | null = key;
|
|
150
|
+
let itemRect = this.layoutDelegate.getItemRect(tempKey);
|
|
151
|
+
if (!itemRect || tempKey == null) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Find the item above or below in the same column.
|
|
156
|
+
const prevRect = itemRect;
|
|
157
|
+
do {
|
|
158
|
+
tempKey = nextKey(tempKey);
|
|
159
|
+
if (tempKey == null) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
itemRect = this.layoutDelegate.getItemRect(tempKey);
|
|
163
|
+
} while (itemRect && shouldSkip(prevRect, itemRect) && tempKey != null);
|
|
164
|
+
|
|
165
|
+
return tempKey;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
private isSameRow(prevRect: Rect, itemRect: Rect): boolean {
|
|
169
|
+
return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private isSameColumn(prevRect: Rect, itemRect: Rect): boolean {
|
|
173
|
+
return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Checks whether the next/prev key is spatially above/below the current key.
|
|
177
|
+
// If not, we are in a reversed (column-reverse) layout and need to flip.
|
|
178
|
+
private isReversed(key: Key): boolean {
|
|
179
|
+
const nextKey = this.getNextKey(key);
|
|
180
|
+
const currentEl = getItemElement(this.ref, key);
|
|
181
|
+
if (nextKey != null) {
|
|
182
|
+
const nextEl = getItemElement(this.ref, nextKey);
|
|
183
|
+
if (!currentEl || !nextEl) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
return currentEl.getBoundingClientRect().top > nextEl.getBoundingClientRect().top;
|
|
187
|
+
}
|
|
188
|
+
const prevKey = this.getPreviousKey(key);
|
|
189
|
+
if (prevKey != null) {
|
|
190
|
+
const prevEl = getItemElement(this.ref, prevKey);
|
|
191
|
+
if (!currentEl || !prevEl) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
return prevEl.getBoundingClientRect().top > currentEl.getBoundingClientRect().top;
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
getKeyBelow(key: Key, options?: { includeDisabled?: boolean }): Key | null {
|
|
200
|
+
if (this.layout === "grid" && this.orientation === "vertical") {
|
|
201
|
+
return this.findKey(key, (k) => this.getNextKey(k, options), this.isSameRow);
|
|
202
|
+
} else if (this.orientation === "vertical") {
|
|
203
|
+
return this.isReversed(key)
|
|
204
|
+
? this.getPreviousKey(key, options)
|
|
205
|
+
: this.getNextKey(key, options);
|
|
206
|
+
} else {
|
|
207
|
+
return this.getNextKey(key, options);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
getKeyAbove(key: Key, options?: { includeDisabled?: boolean }): Key | null {
|
|
212
|
+
if (this.layout === "grid" && this.orientation === "vertical") {
|
|
213
|
+
return this.findKey(key, (k) => this.getPreviousKey(k, options), this.isSameRow);
|
|
214
|
+
} else if (this.orientation === "vertical") {
|
|
215
|
+
return this.isReversed(key)
|
|
216
|
+
? this.getNextKey(key, options)
|
|
217
|
+
: this.getPreviousKey(key, options);
|
|
218
|
+
} else {
|
|
219
|
+
return this.getPreviousKey(key, options);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private getNextColumn(
|
|
224
|
+
key: Key,
|
|
225
|
+
right: boolean,
|
|
226
|
+
options?: { includeDisabled?: boolean },
|
|
227
|
+
): Key | null {
|
|
228
|
+
return right ? this.getPreviousKey(key, options) : this.getNextKey(key, options);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
private computeKeyRightOf(key: Key, options?: { includeDisabled?: boolean }): Key | null {
|
|
232
|
+
const method = this.direction === "ltr" ? "getKeyRightOf" : "getKeyLeftOf";
|
|
233
|
+
const layoutMethod = this.layoutDelegate[method];
|
|
234
|
+
if (layoutMethod) {
|
|
235
|
+
const next = layoutMethod.call(this.layoutDelegate, key);
|
|
236
|
+
return this.findNextNonDisabled(
|
|
237
|
+
next,
|
|
238
|
+
(k) => this.layoutDelegate[method]?.call(this.layoutDelegate, k) ?? null,
|
|
239
|
+
options?.includeDisabled,
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (this.layout === "grid") {
|
|
244
|
+
if (this.orientation === "vertical") {
|
|
245
|
+
return this.getNextColumn(key, this.direction === "rtl", options);
|
|
246
|
+
} else {
|
|
247
|
+
return this.findKey(
|
|
248
|
+
key,
|
|
249
|
+
(k) => this.getNextColumn(k, this.direction === "rtl", options),
|
|
250
|
+
this.isSameColumn,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
} else if (this.orientation === "horizontal") {
|
|
254
|
+
return this.getNextColumn(key, this.direction === "rtl", options);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
private computeKeyLeftOf(key: Key, options?: { includeDisabled?: boolean }): Key | null {
|
|
261
|
+
const method = this.direction === "ltr" ? "getKeyLeftOf" : "getKeyRightOf";
|
|
262
|
+
const layoutMethod = this.layoutDelegate[method];
|
|
263
|
+
if (layoutMethod) {
|
|
264
|
+
const next = layoutMethod.call(this.layoutDelegate, key);
|
|
265
|
+
return this.findNextNonDisabled(
|
|
266
|
+
next,
|
|
267
|
+
(k) => this.layoutDelegate[method]?.call(this.layoutDelegate, k) ?? null,
|
|
268
|
+
options?.includeDisabled,
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (this.layout === "grid") {
|
|
273
|
+
if (this.orientation === "vertical") {
|
|
274
|
+
return this.getNextColumn(key, this.direction === "ltr", options);
|
|
275
|
+
} else {
|
|
276
|
+
return this.findKey(
|
|
277
|
+
key,
|
|
278
|
+
(k) => this.getNextColumn(k, this.direction === "ltr", options),
|
|
279
|
+
this.isSameColumn,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
} else if (this.orientation === "horizontal") {
|
|
283
|
+
return this.getNextColumn(key, this.direction === "ltr", options);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
getFirstKey(): Key | null {
|
|
290
|
+
const key = this.collection.getFirstKey();
|
|
291
|
+
return this.findNextNonDisabled(key, (k) => this.collection.getKeyAfter(k));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
getLastKey(): Key | null {
|
|
295
|
+
const key = this.collection.getLastKey();
|
|
296
|
+
return this.findNextNonDisabled(key, (k) => this.collection.getKeyBefore(k));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
getKeyPageAbove(key: Key): Key | null {
|
|
300
|
+
const menu = this.ref();
|
|
301
|
+
let itemRect = this.layoutDelegate.getItemRect(key);
|
|
302
|
+
if (!itemRect) {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const reversed = this.isReversed(key);
|
|
307
|
+
if (menu && !isScrollable(menu)) {
|
|
308
|
+
return this.getFirstKey();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
let nextKey: Key | null = key;
|
|
312
|
+
if (this.orientation === "horizontal") {
|
|
313
|
+
const pageX = Math.max(
|
|
314
|
+
0,
|
|
315
|
+
itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width,
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
while (itemRect && itemRect.x > pageX && nextKey != null) {
|
|
319
|
+
nextKey = this.getKeyAbove(nextKey);
|
|
320
|
+
itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
const visibleRect = this.layoutDelegate.getVisibleRect();
|
|
324
|
+
// Column-reverse makes y negative for items, so use current pos - height instead.
|
|
325
|
+
const pageY = reversed
|
|
326
|
+
? itemRect.y - visibleRect.height
|
|
327
|
+
: Math.max(0, itemRect.y + itemRect.height - visibleRect.height);
|
|
328
|
+
|
|
329
|
+
while (itemRect && itemRect.y > pageY && nextKey != null) {
|
|
330
|
+
nextKey = this.getKeyAbove(nextKey);
|
|
331
|
+
itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return nextKey ?? (reversed ? this.getLastKey() : this.getFirstKey());
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
getKeyPageBelow(key: Key): Key | null {
|
|
339
|
+
const menu = this.ref();
|
|
340
|
+
let itemRect = this.layoutDelegate.getItemRect(key);
|
|
341
|
+
if (!itemRect) {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const reversed = this.isReversed(key);
|
|
346
|
+
if (menu && !isScrollable(menu)) {
|
|
347
|
+
return this.getLastKey();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
let nextKey: Key | null = key;
|
|
351
|
+
if (this.orientation === "horizontal") {
|
|
352
|
+
const pageX = Math.min(
|
|
353
|
+
this.layoutDelegate.getContentSize().width,
|
|
354
|
+
itemRect.x - itemRect.width + this.layoutDelegate.getVisibleRect().width,
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
while (itemRect && itemRect.x < pageX && nextKey != null) {
|
|
358
|
+
nextKey = this.getKeyBelow(nextKey);
|
|
359
|
+
itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
|
|
360
|
+
}
|
|
361
|
+
} else {
|
|
362
|
+
const pageY = Math.min(
|
|
363
|
+
this.layoutDelegate.getContentSize().height,
|
|
364
|
+
itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height,
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
while (itemRect && itemRect.y < pageY && nextKey != null) {
|
|
368
|
+
nextKey = this.getKeyBelow(nextKey);
|
|
369
|
+
itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return nextKey ?? (reversed ? this.getFirstKey() : this.getLastKey());
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
getKeyForSearch(search: string, fromKey?: Key): Key | null {
|
|
377
|
+
if (!this.collator) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const collection = this.collection;
|
|
382
|
+
let key = fromKey ?? this.getFirstKey();
|
|
383
|
+
while (key != null) {
|
|
384
|
+
const item = collection.getItem(key);
|
|
385
|
+
if (!item) {
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
const substring = item.textValue.slice(0, search.length);
|
|
389
|
+
if (item.textValue && this.collator.compare(substring, search) === 0) {
|
|
390
|
+
return key;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
key = this.getNextKey(key);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom DOM event names used to drive virtual focus into a selectable
|
|
3
|
+
* collection from an outside controller (e.g. an Autocomplete input). Mirrors
|
|
4
|
+
* @react-aria/selection's `utils/constants` (`FOCUS_EVENT` / `CLEAR_FOCUS_EVENT`).
|
|
5
|
+
*
|
|
6
|
+
* Canonical home is here, in the selection layer, because the collection is the
|
|
7
|
+
* consumer that listens for them. A controller that wants to move virtual focus
|
|
8
|
+
* (the deferred autocomplete-collection bridge) dispatches these onto the
|
|
9
|
+
* collection ref.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Dispatched onto a collection to focus it (optionally its first item). */
|
|
13
|
+
export const FOCUS_EVENT = "react-aria-focus";
|
|
14
|
+
|
|
15
|
+
/** Dispatched onto a collection to blur it (optionally clearing the focused key). */
|
|
16
|
+
export const CLEAR_FOCUS_EVENT = "react-aria-clear-focus";
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { Accessor, JSX } from "solid-js";
|
|
2
|
+
import {
|
|
3
|
+
getActiveElement,
|
|
4
|
+
getEventTarget,
|
|
5
|
+
getFocusableTreeWalker,
|
|
6
|
+
getScrollParent,
|
|
7
|
+
isTabbable,
|
|
8
|
+
nodeContains,
|
|
9
|
+
} from "../utils/dom";
|
|
10
|
+
import { focusSafely } from "../utils/focus";
|
|
11
|
+
import { scrollIntoViewport } from "../utils/scrollIntoView";
|
|
12
|
+
|
|
13
|
+
type KeyboardNavigationBehavior = "arrow" | "tab";
|
|
14
|
+
|
|
15
|
+
interface CollectionRowInteractionOptions {
|
|
16
|
+
ref: Accessor<HTMLElement | null>;
|
|
17
|
+
keyboardNavigationBehavior: Accessor<KeyboardNavigationBehavior>;
|
|
18
|
+
direction?: Accessor<"ltr" | "rtl">;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type CollectionRowInteractionProps<T extends HTMLElement> = JSX.HTMLAttributes<T> & {
|
|
22
|
+
onKeyDownCapture?: JSX.EventHandler<T, KeyboardEvent>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function lastFocusable(walker: TreeWalker): HTMLElement | null {
|
|
26
|
+
let last: Node | null = null;
|
|
27
|
+
let next: Node | null;
|
|
28
|
+
while ((next = walker.nextNode())) {
|
|
29
|
+
last = next;
|
|
30
|
+
}
|
|
31
|
+
return last instanceof HTMLElement ? last : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function scrollFocusedElementIntoView(row: HTMLElement, element: HTMLElement): void {
|
|
35
|
+
focusSafely(element);
|
|
36
|
+
scrollIntoViewport(element, { containingElement: getScrollParent(row) });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function redispatchCollectionArrowKey(row: HTMLElement, event: KeyboardEvent): void {
|
|
40
|
+
row.parentElement?.dispatchEvent(
|
|
41
|
+
new KeyboardEvent(event.type, {
|
|
42
|
+
altKey: event.altKey,
|
|
43
|
+
bubbles: true,
|
|
44
|
+
cancelable: event.cancelable,
|
|
45
|
+
code: event.code,
|
|
46
|
+
composed: event.composed,
|
|
47
|
+
ctrlKey: event.ctrlKey,
|
|
48
|
+
key: event.key,
|
|
49
|
+
location: event.location,
|
|
50
|
+
metaKey: event.metaKey,
|
|
51
|
+
repeat: event.repeat,
|
|
52
|
+
shiftKey: event.shiftKey,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function shouldIgnoreRowEvent(event: Event, row: HTMLElement): boolean {
|
|
58
|
+
const target = getEventTarget<Element>(event);
|
|
59
|
+
const currentTarget = event.currentTarget as Element | null;
|
|
60
|
+
return (
|
|
61
|
+
!target || !currentTarget || !nodeContains(currentTarget, target) || !nodeContains(row, target)
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function mergeCollectionRowInteractionProps<T extends HTMLElement>(
|
|
66
|
+
rowProps: CollectionRowInteractionProps<T>,
|
|
67
|
+
options: CollectionRowInteractionOptions,
|
|
68
|
+
): CollectionRowInteractionProps<T> {
|
|
69
|
+
const baseOnKeyDownCapture = rowProps.onKeyDownCapture as
|
|
70
|
+
| ((event: KeyboardEvent) => void)
|
|
71
|
+
| undefined;
|
|
72
|
+
const baseOnKeyDown = rowProps.onKeyDown as ((event: KeyboardEvent) => void) | undefined;
|
|
73
|
+
const baseOnPointerDown = rowProps.onPointerDown as ((event: PointerEvent) => void) | undefined;
|
|
74
|
+
const baseOnMouseDown = rowProps.onMouseDown as ((event: MouseEvent) => void) | undefined;
|
|
75
|
+
|
|
76
|
+
const onKeyDownCapture = (event: KeyboardEvent) => {
|
|
77
|
+
const row = options.ref();
|
|
78
|
+
const activeElement = getActiveElement(row?.ownerDocument);
|
|
79
|
+
if (
|
|
80
|
+
options.keyboardNavigationBehavior() !== "arrow" ||
|
|
81
|
+
!row ||
|
|
82
|
+
!activeElement ||
|
|
83
|
+
shouldIgnoreRowEvent(event, row)
|
|
84
|
+
) {
|
|
85
|
+
baseOnKeyDownCapture?.(event);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const direction = options.direction?.() ?? "ltr";
|
|
90
|
+
const walker = getFocusableTreeWalker(row);
|
|
91
|
+
walker.currentNode = activeElement;
|
|
92
|
+
|
|
93
|
+
switch (event.key) {
|
|
94
|
+
case "ArrowLeft": {
|
|
95
|
+
const focusable =
|
|
96
|
+
direction === "rtl"
|
|
97
|
+
? (walker.nextNode() as HTMLElement | null)
|
|
98
|
+
: (walker.previousNode() as HTMLElement | null);
|
|
99
|
+
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
event.stopPropagation();
|
|
102
|
+
|
|
103
|
+
if (focusable) {
|
|
104
|
+
scrollFocusedElementIntoView(row, focusable);
|
|
105
|
+
} else if (direction === "rtl") {
|
|
106
|
+
scrollFocusedElementIntoView(row, row);
|
|
107
|
+
} else {
|
|
108
|
+
walker.currentNode = row;
|
|
109
|
+
const lastElement = lastFocusable(walker);
|
|
110
|
+
if (lastElement) {
|
|
111
|
+
scrollFocusedElementIntoView(row, lastElement);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case "ArrowRight": {
|
|
117
|
+
const focusable =
|
|
118
|
+
direction === "rtl"
|
|
119
|
+
? (walker.previousNode() as HTMLElement | null)
|
|
120
|
+
: (walker.nextNode() as HTMLElement | null);
|
|
121
|
+
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
event.stopPropagation();
|
|
124
|
+
|
|
125
|
+
if (focusable) {
|
|
126
|
+
scrollFocusedElementIntoView(row, focusable);
|
|
127
|
+
} else if (direction === "ltr") {
|
|
128
|
+
scrollFocusedElementIntoView(row, row);
|
|
129
|
+
} else {
|
|
130
|
+
walker.currentNode = row;
|
|
131
|
+
const lastElement = lastFocusable(walker);
|
|
132
|
+
if (lastElement) {
|
|
133
|
+
scrollFocusedElementIntoView(row, lastElement);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case "ArrowUp":
|
|
139
|
+
case "ArrowDown": {
|
|
140
|
+
if (!event.altKey) {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
event.stopPropagation();
|
|
143
|
+
redispatchCollectionArrowKey(row, event);
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (!event.cancelBubble) {
|
|
150
|
+
baseOnKeyDownCapture?.(event);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
155
|
+
const row = options.ref();
|
|
156
|
+
const target = getEventTarget<Element>(event);
|
|
157
|
+
const activeElement = getActiveElement(row?.ownerDocument);
|
|
158
|
+
|
|
159
|
+
if (row && target && activeElement && !shouldIgnoreRowEvent(event, row)) {
|
|
160
|
+
if (options.keyboardNavigationBehavior() === "tab" && target !== row && event.key !== "Tab") {
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (options.keyboardNavigationBehavior() === "tab" && event.key === "Tab") {
|
|
166
|
+
const walker = getFocusableTreeWalker(row, { tabbable: true });
|
|
167
|
+
walker.currentNode = activeElement;
|
|
168
|
+
const next = event.shiftKey ? walker.previousNode() : walker.nextNode();
|
|
169
|
+
|
|
170
|
+
if (next) {
|
|
171
|
+
event.stopPropagation();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (!event.cancelBubble) {
|
|
177
|
+
baseOnKeyDown?.(event);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const onPointerDown = (event: PointerEvent) => {
|
|
182
|
+
const row = options.ref();
|
|
183
|
+
const target = getEventTarget<Element>(event);
|
|
184
|
+
if (row && target && target !== row && isTabbable(target)) {
|
|
185
|
+
event.stopPropagation();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
baseOnPointerDown?.(event);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const onMouseDown = (event: MouseEvent) => {
|
|
192
|
+
const row = options.ref();
|
|
193
|
+
const target = getEventTarget<Element>(event);
|
|
194
|
+
if (row && target && target !== row && isTabbable(target)) {
|
|
195
|
+
event.stopPropagation();
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
baseOnMouseDown?.(event);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
...rowProps,
|
|
203
|
+
onKeyDownCapture:
|
|
204
|
+
options.keyboardNavigationBehavior() === "arrow" ? onKeyDownCapture : baseOnKeyDownCapture,
|
|
205
|
+
onKeyDown,
|
|
206
|
+
onPointerDown,
|
|
207
|
+
onMouseDown,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reveals the virtually-focused collection item when the focused key changes via
|
|
3
|
+
* keyboard navigation.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the focused-key scroll effect in @react-aria/selection's
|
|
6
|
+
* `useSelectableCollection`. Activedescendant collections (ListBox / Menu /
|
|
7
|
+
* ComboBox) keep real DOM focus on the container and point at the active item
|
|
8
|
+
* with `aria-activedescendant`, so the browser never natively scrolls the
|
|
9
|
+
* focused option into view the way a roving-tabindex collection would. This
|
|
10
|
+
* effect restores that behavior through our `scrollIntoViewport` util.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { createEffect } from "solid-js";
|
|
14
|
+
import { isServer } from "solid-js/web";
|
|
15
|
+
import type { Key } from "@proyecto-viviana/solid-stately";
|
|
16
|
+
import { getInteractionModality } from "../interactions/createInteractionModality";
|
|
17
|
+
import { scrollIntoViewport } from "../utils";
|
|
18
|
+
|
|
19
|
+
export interface ScrollIntoViewOnFocusOptions {
|
|
20
|
+
/** The currently focused collection key. */
|
|
21
|
+
focusedKey: () => Key | null;
|
|
22
|
+
/** The collection element, which is also the scroll container. */
|
|
23
|
+
ref: () => HTMLElement | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the collection is the active focus target. When this returns false
|
|
26
|
+
* the scroll is suppressed so a background focused-key change can't move the
|
|
27
|
+
* page. Mirrors upstream's `manager.isFocused` gate. Defaults to always active.
|
|
28
|
+
*/
|
|
29
|
+
isActive?: () => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the DOM element for a focused key within `root`. Defaults to a
|
|
32
|
+
* `[data-key]` lookup, which every collection item carries.
|
|
33
|
+
*/
|
|
34
|
+
getItemElement?: (root: HTMLElement, key: Key) => HTMLElement | null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function createScrollIntoViewOnFocus(options: ScrollIntoViewOnFocusOptions): void {
|
|
38
|
+
if (isServer) return;
|
|
39
|
+
|
|
40
|
+
const getItemElement =
|
|
41
|
+
options.getItemElement ??
|
|
42
|
+
((root, key) => root.querySelector<HTMLElement>(`[data-key="${key}"]`));
|
|
43
|
+
|
|
44
|
+
createEffect(() => {
|
|
45
|
+
const key = options.focusedKey();
|
|
46
|
+
if (key == null) return;
|
|
47
|
+
if (options.isActive && !options.isActive()) return;
|
|
48
|
+
// Pointer-driven focus changes (e.g. hovering an option) shouldn't yank the
|
|
49
|
+
// scroll position under the user's cursor — only reveal on keyboard nav.
|
|
50
|
+
// Matches the modality gate `createTable` uses for its real-focus rows.
|
|
51
|
+
if (getInteractionModality() === "pointer") return;
|
|
52
|
+
|
|
53
|
+
const root = options.ref();
|
|
54
|
+
if (!root) return;
|
|
55
|
+
|
|
56
|
+
// Defer a microtask so a virtualizer that force-renders the focused item has
|
|
57
|
+
// committed it to the DOM before we measure and scroll it into view.
|
|
58
|
+
queueMicrotask(() => {
|
|
59
|
+
const element = getItemElement(root, key);
|
|
60
|
+
if (element) {
|
|
61
|
+
scrollIntoViewport(element, { containingElement: root });
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|