@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,263 @@
|
|
|
1
|
+
import { t as createPress } from "./createPress.jsx";
|
|
2
|
+
import { t as createFocusRing } from "./createFocusRing.jsx";
|
|
3
|
+
import { t as createHover } from "./createHover.jsx";
|
|
4
|
+
import { i as useLocale } from "./locale.jsx";
|
|
5
|
+
import { createId } from "../ssr/index.jsx";
|
|
6
|
+
import { batch, createEffect, createMemo } from "solid-js";
|
|
7
|
+
//#region src/tabs/createTabs.ts
|
|
8
|
+
/**
|
|
9
|
+
* ARIA hooks for tab components.
|
|
10
|
+
* Based on @react-aria/tabs.
|
|
11
|
+
*/
|
|
12
|
+
const tabListIds = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
function getTabListId(state) {
|
|
14
|
+
let id = tabListIds.get(state);
|
|
15
|
+
if (!id) {
|
|
16
|
+
id = createId();
|
|
17
|
+
tabListIds.set(state, id);
|
|
18
|
+
}
|
|
19
|
+
return id;
|
|
20
|
+
}
|
|
21
|
+
function generateTabId(state, key) {
|
|
22
|
+
return `${getTabListId(state)}-tab-${String(key).replace(/\s+/g, "-")}`;
|
|
23
|
+
}
|
|
24
|
+
function generateTabPanelId(state, key) {
|
|
25
|
+
return `${getTabListId(state)}-tabpanel-${String(key).replace(/\s+/g, "-")}`;
|
|
26
|
+
}
|
|
27
|
+
function getNextKey(state, currentKey) {
|
|
28
|
+
const keys = [...state.collection()].map((node) => node.key);
|
|
29
|
+
const currentIndex = keys.indexOf(currentKey);
|
|
30
|
+
if (currentIndex === -1) return keys[0] ?? null;
|
|
31
|
+
for (let i = 1; i <= keys.length; i++) {
|
|
32
|
+
const nextKey = keys[(currentIndex + i) % keys.length];
|
|
33
|
+
if (!state.isKeyDisabled(nextKey)) return nextKey;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function getPreviousKey(state, currentKey) {
|
|
38
|
+
const keys = [...state.collection()].map((node) => node.key);
|
|
39
|
+
const currentIndex = keys.indexOf(currentKey);
|
|
40
|
+
if (currentIndex === -1) return keys[keys.length - 1] ?? null;
|
|
41
|
+
for (let i = 1; i <= keys.length; i++) {
|
|
42
|
+
const prevKey = keys[(currentIndex - i + keys.length) % keys.length];
|
|
43
|
+
if (!state.isKeyDisabled(prevKey)) return prevKey;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function getFirstKey(state) {
|
|
48
|
+
const coll = state.collection();
|
|
49
|
+
for (const node of coll) if (!state.isKeyDisabled(node.key)) return node.key;
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function getLastKey(state) {
|
|
53
|
+
const keys = [...state.collection()].map((node) => node.key).reverse();
|
|
54
|
+
for (const key of keys) if (!state.isKeyDisabled(key)) return key;
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates ARIA props for a tab list container.
|
|
59
|
+
*/
|
|
60
|
+
function createTabList(props, state) {
|
|
61
|
+
const locale = useLocale();
|
|
62
|
+
const orientation = () => props.orientation ?? state.orientation() ?? "horizontal";
|
|
63
|
+
const keyboardActivation = () => props.keyboardActivation ?? state.keyboardActivation() ?? "automatic";
|
|
64
|
+
const handleKeyDown = (e) => {
|
|
65
|
+
if (state.isDisabled()) return;
|
|
66
|
+
const currentKey = state.focusedKey() ?? state.selectedKey();
|
|
67
|
+
if (currentKey === null) return;
|
|
68
|
+
let nextKey = null;
|
|
69
|
+
const isHorizontal = orientation() === "horizontal";
|
|
70
|
+
const isRTL = locale().direction === "rtl";
|
|
71
|
+
switch (e.key) {
|
|
72
|
+
case "ArrowLeft":
|
|
73
|
+
if (isHorizontal) nextKey = isRTL ? getNextKey(state, currentKey) : getPreviousKey(state, currentKey);
|
|
74
|
+
break;
|
|
75
|
+
case "ArrowRight":
|
|
76
|
+
if (isHorizontal) nextKey = isRTL ? getPreviousKey(state, currentKey) : getNextKey(state, currentKey);
|
|
77
|
+
break;
|
|
78
|
+
case "ArrowUp":
|
|
79
|
+
if (!isHorizontal) nextKey = getPreviousKey(state, currentKey);
|
|
80
|
+
break;
|
|
81
|
+
case "ArrowDown":
|
|
82
|
+
if (!isHorizontal) nextKey = getNextKey(state, currentKey);
|
|
83
|
+
break;
|
|
84
|
+
case "Home":
|
|
85
|
+
nextKey = getFirstKey(state);
|
|
86
|
+
break;
|
|
87
|
+
case "End":
|
|
88
|
+
nextKey = getLastKey(state);
|
|
89
|
+
break;
|
|
90
|
+
case "Enter":
|
|
91
|
+
case " ":
|
|
92
|
+
if (keyboardActivation() === "manual" && state.focusedKey()) {
|
|
93
|
+
state.setSelectedKey(state.focusedKey());
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
default: return;
|
|
98
|
+
}
|
|
99
|
+
if (nextKey !== null) {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
batch(() => {
|
|
102
|
+
state.setFocusedKey(nextKey);
|
|
103
|
+
if (keyboardActivation() === "automatic") state.setSelectedKey(nextKey);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const handleFocus = () => {
|
|
108
|
+
state.setFocused(true);
|
|
109
|
+
if (state.focusedKey() === null && state.selectedKey() !== null) state.setFocusedKey(state.selectedKey());
|
|
110
|
+
};
|
|
111
|
+
const handleBlur = (e) => {
|
|
112
|
+
const relatedTarget = e.relatedTarget;
|
|
113
|
+
if (relatedTarget && e.currentTarget.contains(relatedTarget)) return;
|
|
114
|
+
state.setFocused(false);
|
|
115
|
+
};
|
|
116
|
+
return { tabListProps: {
|
|
117
|
+
role: "tablist",
|
|
118
|
+
"aria-orientation": orientation(),
|
|
119
|
+
"aria-label": props["aria-label"],
|
|
120
|
+
"aria-labelledby": props["aria-labelledby"],
|
|
121
|
+
"aria-describedby": props["aria-describedby"],
|
|
122
|
+
onKeyDown: handleKeyDown,
|
|
123
|
+
onFocusIn: handleFocus,
|
|
124
|
+
onFocusOut: handleBlur
|
|
125
|
+
} };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Creates ARIA props for an individual tab.
|
|
129
|
+
*/
|
|
130
|
+
function createTab(props, state, ref) {
|
|
131
|
+
const key = () => props.key;
|
|
132
|
+
const isSelected = createMemo(() => state.selectedKey() === key());
|
|
133
|
+
const isDisabled = createMemo(() => {
|
|
134
|
+
if (props.isDisabled) return true;
|
|
135
|
+
return state.isKeyDisabled(key());
|
|
136
|
+
});
|
|
137
|
+
const isKeyFocused = createMemo(() => state.focusedKey() === key());
|
|
138
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
139
|
+
const selectTab = () => {
|
|
140
|
+
state.setSelectedKey(key());
|
|
141
|
+
};
|
|
142
|
+
const { isPressed, pressProps } = createPress({
|
|
143
|
+
get isDisabled() {
|
|
144
|
+
return isDisabled();
|
|
145
|
+
},
|
|
146
|
+
onPressStart: (e) => {
|
|
147
|
+
if (e.pointerType === "mouse" || e.pointerType === "keyboard") selectTab();
|
|
148
|
+
},
|
|
149
|
+
onPress: (e) => {
|
|
150
|
+
if (e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual") selectTab();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
const { isHovered } = createHover({ get isDisabled() {
|
|
154
|
+
return isDisabled();
|
|
155
|
+
} });
|
|
156
|
+
const tabId = generateTabId(state, key());
|
|
157
|
+
const tabPanelId = generateTabPanelId(state, key());
|
|
158
|
+
const callHandler = (handler, event) => {
|
|
159
|
+
if (typeof handler === "function") {
|
|
160
|
+
handler(event);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (Array.isArray(handler) && handler.length >= 2 && typeof handler[1] === "function") handler[1].call(handler[0], event);
|
|
164
|
+
};
|
|
165
|
+
const handleFocus = (e) => {
|
|
166
|
+
callHandler(focusProps.onFocus, e);
|
|
167
|
+
};
|
|
168
|
+
const handleFocusIn = () => {
|
|
169
|
+
state.setFocusedKey(key());
|
|
170
|
+
};
|
|
171
|
+
const handleBlur = (e) => {
|
|
172
|
+
callHandler(focusProps.onBlur, e);
|
|
173
|
+
};
|
|
174
|
+
const handleKeyDown = (e) => {
|
|
175
|
+
callHandler(pressProps.onKeyDown, e);
|
|
176
|
+
};
|
|
177
|
+
const handleMouseDown = (e) => {
|
|
178
|
+
callHandler(pressProps.onMouseDown, e);
|
|
179
|
+
};
|
|
180
|
+
const handlePointerDown = (e) => {
|
|
181
|
+
callHandler(pressProps.onPointerDown, e);
|
|
182
|
+
};
|
|
183
|
+
const handleClick = (e) => {
|
|
184
|
+
callHandler(pressProps.onClick, e);
|
|
185
|
+
};
|
|
186
|
+
createEffect(() => {
|
|
187
|
+
const element = ref?.();
|
|
188
|
+
if (!state.isFocused() || !isKeyFocused() || !element) return;
|
|
189
|
+
if (element.ownerDocument?.activeElement !== element) element.focus();
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
tabProps: {
|
|
193
|
+
id: tabId,
|
|
194
|
+
role: "tab",
|
|
195
|
+
get "aria-selected"() {
|
|
196
|
+
return isSelected();
|
|
197
|
+
},
|
|
198
|
+
get "aria-disabled"() {
|
|
199
|
+
return isDisabled() || void 0;
|
|
200
|
+
},
|
|
201
|
+
get "aria-controls"() {
|
|
202
|
+
return isSelected() ? tabPanelId : void 0;
|
|
203
|
+
},
|
|
204
|
+
"aria-label": props["aria-label"],
|
|
205
|
+
"aria-labelledby": props["aria-labelledby"],
|
|
206
|
+
get tabIndex() {
|
|
207
|
+
if (isDisabled()) return void 0;
|
|
208
|
+
return isKeyFocused() ? 0 : -1;
|
|
209
|
+
},
|
|
210
|
+
onKeyDown: handleKeyDown,
|
|
211
|
+
onMouseDown: handleMouseDown,
|
|
212
|
+
onPointerDown: handlePointerDown,
|
|
213
|
+
onClick: handleClick,
|
|
214
|
+
onFocus: handleFocus,
|
|
215
|
+
onFocusIn: handleFocusIn,
|
|
216
|
+
onBlur: handleBlur
|
|
217
|
+
},
|
|
218
|
+
isSelected,
|
|
219
|
+
isDisabled,
|
|
220
|
+
isPressed,
|
|
221
|
+
isFocused,
|
|
222
|
+
isFocusVisible,
|
|
223
|
+
isHovered
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Creates ARIA props for a tab panel.
|
|
228
|
+
*/
|
|
229
|
+
function createTabPanel(props, state) {
|
|
230
|
+
const fallbackId = createId();
|
|
231
|
+
const associatedKey = createMemo(() => {
|
|
232
|
+
if (state === null) return null;
|
|
233
|
+
return props.id ?? state.selectedKey();
|
|
234
|
+
});
|
|
235
|
+
const isSelected = createMemo(() => {
|
|
236
|
+
if (state === null) return true;
|
|
237
|
+
if (props.id === void 0) return state.selectedKey() !== null;
|
|
238
|
+
return state.selectedKey() === props.id;
|
|
239
|
+
});
|
|
240
|
+
return {
|
|
241
|
+
tabPanelProps: {
|
|
242
|
+
get id() {
|
|
243
|
+
const key = associatedKey();
|
|
244
|
+
if (state && key !== null) return generateTabPanelId(state, key);
|
|
245
|
+
return fallbackId;
|
|
246
|
+
},
|
|
247
|
+
role: "tabpanel",
|
|
248
|
+
get "aria-labelledby"() {
|
|
249
|
+
if (props["aria-labelledby"]) return props["aria-labelledby"];
|
|
250
|
+
const key = associatedKey();
|
|
251
|
+
if (state && key !== null) return generateTabId(state, key);
|
|
252
|
+
},
|
|
253
|
+
"aria-label": props["aria-label"],
|
|
254
|
+
"aria-describedby": props["aria-describedby"],
|
|
255
|
+
tabIndex: 0
|
|
256
|
+
},
|
|
257
|
+
isSelected
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
export { createTabList as n, createTabPanel as r, createTab as t };
|
|
262
|
+
|
|
263
|
+
//# sourceMappingURL=tabs.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.jsx","names":[],"sources":["../../src/tabs/createTabs.ts"],"sourcesContent":["/**\n * ARIA hooks for tab components.\n * Based on @react-aria/tabs.\n */\n\nimport { type Accessor, batch, createEffect, createMemo } from \"solid-js\";\nimport { createFocusRing } from \"../interactions\";\nimport { createPress } from \"../interactions\";\nimport { createHover } from \"../interactions\";\nimport { createId } from \"../ssr\";\nimport { useLocale } from \"../i18n\";\nimport type { Key, Collection, CollectionNode } from \"@proyecto-viviana/solid-stately\";\n\nexport type TabOrientation = \"horizontal\" | \"vertical\";\nexport type KeyboardActivation = \"automatic\" | \"manual\";\n\nexport interface TabListState<T = unknown> {\n collection: Accessor<Collection<T>>;\n selectedKey: Accessor<Key | null>;\n setSelectedKey(key: Key): void;\n selectedItem: Accessor<CollectionNode<T> | null>;\n isDisabled: Accessor<boolean>;\n keyboardActivation: Accessor<KeyboardActivation>;\n orientation: Accessor<TabOrientation>;\n isKeyDisabled(key: Key): boolean;\n disabledKeys: Accessor<Set<Key>>;\n isFocused: Accessor<boolean>;\n setFocused(isFocused: boolean): void;\n focusedKey: Accessor<Key | null>;\n setFocusedKey(key: Key | null): void;\n}\n\nexport interface AriaTabListProps {\n /** The orientation of the tab list. */\n orientation?: TabOrientation;\n /** How tabs are activated (on focus or on click). */\n keyboardActivation?: KeyboardActivation;\n /** Whether the tab list is disabled. */\n isDisabled?: boolean;\n /** Label for the tab list. */\n \"aria-label\"?: string;\n /** ID of element that labels the tab list. */\n \"aria-labelledby\"?: string;\n /** ID of element that describes the tab list. */\n \"aria-describedby\"?: string;\n}\n\nexport interface TabListAria {\n /** Props for the tab list container element. */\n tabListProps: {\n role: \"tablist\";\n \"aria-orientation\": TabOrientation;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n onKeyDown: (e: KeyboardEvent) => void;\n // React's bubbling onFocus/onBlur map to focusin/focusout in Solid; the\n // tab list must observe focus entering/leaving its child tabs.\n onFocusIn: (e: FocusEvent) => void;\n onFocusOut: (e: FocusEvent) => void;\n };\n}\n\nexport interface AriaTabProps {\n /** The key of the tab. */\n key: Key;\n /** Whether the tab is disabled. */\n isDisabled?: boolean;\n /** Label for the tab. */\n \"aria-label\"?: string;\n /** ID reference for the tab label. */\n \"aria-labelledby\"?: string;\n}\n\nexport interface TabAria {\n /** Props for the tab element. */\n tabProps: {\n id: string;\n role: \"tab\";\n \"aria-selected\": boolean;\n \"aria-disabled\": boolean | undefined;\n \"aria-controls\": string | undefined;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n tabIndex: number | undefined;\n onKeyDown: (e: KeyboardEvent) => void;\n onMouseDown: (e: MouseEvent) => void;\n onPointerDown: (e: PointerEvent) => void;\n onClick: (e: MouseEvent) => void;\n onFocus: (e: FocusEvent) => void;\n onFocusIn: (e: FocusEvent) => void;\n onBlur: (e: FocusEvent) => void;\n };\n /** Whether the tab is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the tab is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the tab is pressed. */\n isPressed: Accessor<boolean>;\n /** Whether the tab has focus. */\n isFocused: Accessor<boolean>;\n /** Whether the tab has visible focus ring. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the tab is hovered. */\n isHovered: Accessor<boolean>;\n}\n\nexport interface AriaTabPanelProps {\n /** The key of the associated tab. */\n id?: Key;\n /** Label for the tab panel. */\n \"aria-label\"?: string;\n /** ID of element that labels the tab panel. */\n \"aria-labelledby\"?: string;\n /** ID of element that describes the tab panel. */\n \"aria-describedby\"?: string;\n}\n\nexport interface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: {\n id: string;\n role: \"tabpanel\";\n \"aria-labelledby\"?: string;\n \"aria-label\"?: string;\n \"aria-describedby\"?: string;\n tabIndex: number;\n };\n /** Whether this panel is the selected one. */\n isSelected: Accessor<boolean>;\n}\n\nconst tabListIds = new WeakMap<TabListState<unknown>, string>();\n\nfunction getTabListId<T>(state: TabListState<T>): string {\n let id = tabListIds.get(state as TabListState<unknown>);\n if (!id) {\n id = createId();\n tabListIds.set(state as TabListState<unknown>, id);\n }\n return id;\n}\n\nfunction generateTabId<T>(state: TabListState<T>, key: Key): string {\n const baseId = getTabListId(state);\n const keyStr = String(key).replace(/\\s+/g, \"-\");\n return `${baseId}-tab-${keyStr}`;\n}\n\nfunction generateTabPanelId<T>(state: TabListState<T>, key: Key): string {\n const baseId = getTabListId(state);\n const keyStr = String(key).replace(/\\s+/g, \"-\");\n return `${baseId}-tabpanel-${keyStr}`;\n}\n\nfunction getNextKey<T>(state: TabListState<T>, currentKey: Key): Key | null {\n const coll = state.collection();\n const keys = [...coll].map((node) => node.key);\n const currentIndex = keys.indexOf(currentKey);\n\n if (currentIndex === -1) return keys[0] ?? null;\n\n // Find next non-disabled key, wrapping around\n for (let i = 1; i <= keys.length; i++) {\n const nextIndex = (currentIndex + i) % keys.length;\n const nextKey = keys[nextIndex];\n if (!state.isKeyDisabled(nextKey)) {\n return nextKey;\n }\n }\n\n return null;\n}\n\nfunction getPreviousKey<T>(state: TabListState<T>, currentKey: Key): Key | null {\n const coll = state.collection();\n const keys = [...coll].map((node) => node.key);\n const currentIndex = keys.indexOf(currentKey);\n\n if (currentIndex === -1) return keys[keys.length - 1] ?? null;\n\n // Find previous non-disabled key, wrapping around\n for (let i = 1; i <= keys.length; i++) {\n const prevIndex = (currentIndex - i + keys.length) % keys.length;\n const prevKey = keys[prevIndex];\n if (!state.isKeyDisabled(prevKey)) {\n return prevKey;\n }\n }\n\n return null;\n}\n\nfunction getFirstKey<T>(state: TabListState<T>): Key | null {\n const coll = state.collection();\n for (const node of coll) {\n if (!state.isKeyDisabled(node.key)) {\n return node.key;\n }\n }\n return null;\n}\n\nfunction getLastKey<T>(state: TabListState<T>): Key | null {\n const coll = state.collection();\n const keys = [...coll].map((node) => node.key).reverse();\n for (const key of keys) {\n if (!state.isKeyDisabled(key)) {\n return key;\n }\n }\n return null;\n}\n\n/**\n * Creates ARIA props for a tab list container.\n */\nexport function createTabList<T>(props: AriaTabListProps, state: TabListState<T>): TabListAria {\n const locale = useLocale();\n const orientation = () => props.orientation ?? state.orientation() ?? \"horizontal\";\n const keyboardActivation = () =>\n props.keyboardActivation ?? state.keyboardActivation() ?? \"automatic\";\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (state.isDisabled()) return;\n\n const currentKey = state.focusedKey() ?? state.selectedKey();\n if (currentKey === null) return;\n\n let nextKey: Key | null = null;\n const isHorizontal = orientation() === \"horizontal\";\n const isRTL = locale().direction === \"rtl\";\n\n switch (e.key) {\n case \"ArrowLeft\":\n if (isHorizontal) {\n nextKey = isRTL ? getNextKey(state, currentKey) : getPreviousKey(state, currentKey);\n }\n break;\n case \"ArrowRight\":\n if (isHorizontal) {\n nextKey = isRTL ? getPreviousKey(state, currentKey) : getNextKey(state, currentKey);\n }\n break;\n case \"ArrowUp\":\n if (!isHorizontal) {\n nextKey = getPreviousKey(state, currentKey);\n }\n break;\n case \"ArrowDown\":\n if (!isHorizontal) {\n nextKey = getNextKey(state, currentKey);\n }\n break;\n case \"Home\":\n nextKey = getFirstKey(state);\n break;\n case \"End\":\n nextKey = getLastKey(state);\n break;\n case \"Enter\":\n case \" \":\n // In manual mode, Enter/Space activates the focused tab\n if (keyboardActivation() === \"manual\" && state.focusedKey()) {\n state.setSelectedKey(state.focusedKey()!);\n e.preventDefault();\n }\n return;\n default:\n return;\n }\n\n if (nextKey !== null) {\n e.preventDefault();\n // Batch the focus + selection writes so their observable ordering matches\n // React. `setFocusedKey` drives a reactive effect that moves DOM focus\n // (firing native focusout/focusin); `setSelectedKey` calls\n // `onSelectionChange` synchronously. Written bare, Solid flushes the focus\n // effect the instant `setFocusedKey` runs — so focus moves *before* the\n // selection callback, inverting React's order. React batches both state\n // updates in the handler (callback fires synchronously) and defers the\n // focus move to a layout effect. `batch()` is the Solid equivalent: it\n // holds the focus effect until the batch closes, so the synchronous\n // `onSelectionChange` fires first, then focus moves — matching upstream's\n // `callback → focusout → focusin` sequence (D4 event-sequence oracle).\n batch(() => {\n state.setFocusedKey(nextKey);\n // Selection follows focus only for keyboard navigation in automatic mode\n // (mirrors useSelectableCollection's selectOnFocus in navigateToKey).\n if (keyboardActivation() === \"automatic\") {\n state.setSelectedKey(nextKey);\n }\n });\n }\n };\n\n const handleFocus = () => {\n state.setFocused(true);\n // If no focused key, focus the selected key\n if (state.focusedKey() === null && state.selectedKey() !== null) {\n state.setFocusedKey(state.selectedKey());\n }\n };\n\n const handleBlur = (e: FocusEvent) => {\n // Only blur if focus is leaving the tab list entirely\n const relatedTarget = e.relatedTarget as Element | null;\n if (relatedTarget && (e.currentTarget as Element).contains(relatedTarget)) {\n return;\n }\n state.setFocused(false);\n };\n\n return {\n tabListProps: {\n role: \"tablist\",\n \"aria-orientation\": orientation(),\n \"aria-label\": props[\"aria-label\"],\n \"aria-labelledby\": props[\"aria-labelledby\"],\n \"aria-describedby\": props[\"aria-describedby\"],\n onKeyDown: handleKeyDown,\n onFocusIn: handleFocus,\n onFocusOut: handleBlur,\n },\n };\n}\n\n/**\n * Creates ARIA props for an individual tab.\n */\nexport function createTab<T>(\n props: AriaTabProps,\n state: TabListState<T>,\n ref?: Accessor<HTMLElement | null>,\n): TabAria {\n const key = () => props.key;\n\n const isSelected = createMemo(() => state.selectedKey() === key());\n const isDisabled = createMemo(() => {\n if (props.isDisabled) return true;\n return state.isKeyDisabled(key());\n });\n\n // Whether this tab is the roving-focus target (state layer), used for the\n // roving tabIndex and DOM focus alignment. The returned isFocused is the\n // DOM-focus-based ring state, matching upstream's useFocusRing semantics.\n const isKeyFocused = createMemo(() => state.focusedKey() === key());\n\n // Focus ring\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n\n // Press handling. Selection timing mirrors useSelectableItem's default\n // (non-shouldSelectOnPressUp) path: mouse selects on press start and\n // keyboard on key down, while touch, pen, and virtual pointers select on\n // press up.\n const selectTab = () => {\n // Press handlers select only — they do NOT set the focused key. Upstream's\n // useSelectableItem does the same: its press/onSelect path calls\n // replaceSelection, while `focusedKey` is driven exclusively by the DOM\n // `onFocus` handler (see handleFocus below). Setting the focused key here too\n // flipped the roving tabIndex synchronously at pointer-up — *before* the\n // browser's native focus reached the tab — so a touch tap logged the tapped\n // tab with tabIndex 0 at its own `focusin`, where React (which updates\n // tabIndex only on the post-event commit) still shows -1. Letting native\n // focus alone advance `focusedKey` defers the tabIndex flip past the focus\n // event, matching React's D4 event sequence.\n state.setSelectedKey(key());\n };\n const { isPressed, pressProps } = createPress({\n get isDisabled() {\n return isDisabled();\n },\n onPressStart: (e) => {\n if (e.pointerType === \"mouse\" || e.pointerType === \"keyboard\") {\n selectTab();\n }\n },\n onPress: (e) => {\n if (e.pointerType === \"touch\" || e.pointerType === \"pen\" || e.pointerType === \"virtual\") {\n selectTab();\n }\n },\n });\n\n // Hover handling\n const { isHovered } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n\n // Generate IDs\n const tabId = generateTabId(state, key());\n const tabPanelId = generateTabPanelId(state, key());\n\n // Helper to safely call event handlers that may be bound tuples\n const callHandler = <E extends Event>(handler: unknown, event: E) => {\n if (typeof handler === \"function\") {\n (handler as (e: E) => void)(event);\n return;\n }\n if (Array.isArray(handler) && handler.length >= 2 && typeof handler[1] === \"function\") {\n (handler[1] as (this: unknown, e: E) => void).call(handler[0], event);\n }\n };\n\n // Focus management. The focus ring reacts to the native `focus` event, but the\n // roving-tabindex commit is deliberately bound to `focusin` (see\n // handleFocusIn) so its DOM reflection lands one event later — matching React,\n // whose `onFocus` is a `focusin`-delegated listener at the app root.\n const handleFocus = (e: FocusEvent) => {\n callHandler(focusProps.onFocus, e);\n };\n\n // Roving-tabindex commit (D4 event-ordering). React's `onFocus` is delegated\n // to a single `focusin` listener at the app root, so the roving tabIndex it\n // drives reflects one event *after* the native `focus`. Binding the\n // focusedKey write here (to `focusin`) mirrors that timing: the D4 oracle\n // records event targets from a document-level capture-phase listener, which\n // runs before this at-target handler, so a touch tap — whose selection lands\n // on press-up, after focus — is still observed with tabIndex=-1 at `focusin`,\n // exactly as React. A mouse press selects on press-start and syncs focusedKey\n // before focus (createTabListState's selection→focus effect), so its tab\n // already reads tabIndex=0 at `focusin`, again matching React. Setting it on\n // the earlier `focus` event flipped the tab a whole event too soon, so touch\n // taps diverged at `focusin`. See recertification.md D4 event-ordering.\n const handleFocusIn = () => {\n state.setFocusedKey(key());\n };\n\n const handleBlur = (e: FocusEvent) => {\n callHandler(focusProps.onBlur, e);\n };\n\n // Combine all handlers\n const handleKeyDown = (e: KeyboardEvent) => {\n callHandler(pressProps.onKeyDown, e);\n };\n\n const handleMouseDown = (e: MouseEvent) => {\n callHandler(pressProps.onMouseDown, e);\n };\n\n const handlePointerDown = (e: PointerEvent) => {\n callHandler(pressProps.onPointerDown, e);\n };\n\n const handleClick = (e: MouseEvent) => {\n callHandler(pressProps.onClick, e);\n };\n\n // Keep DOM focus aligned with focusedKey updates from keyboard navigation.\n // Only while the tab list itself is focused (mirrors useSelectableItem's\n // manager.isFocused guard), so programmatic selection changes don't steal\n // focus from elsewhere in the document.\n createEffect(() => {\n const element = ref?.();\n if (!state.isFocused() || !isKeyFocused() || !element) return;\n\n const activeElement = element.ownerDocument?.activeElement;\n if (activeElement !== element) {\n element.focus();\n }\n });\n\n return {\n tabProps: {\n id: tabId,\n role: \"tab\",\n get \"aria-selected\"() {\n return isSelected();\n },\n get \"aria-disabled\"() {\n return isDisabled() || undefined;\n },\n get \"aria-controls\"() {\n return isSelected() ? tabPanelId : undefined;\n },\n \"aria-label\": props[\"aria-label\"],\n \"aria-labelledby\": props[\"aria-labelledby\"],\n get tabIndex() {\n // Roving tabIndex follows the focused key (mirrors useSelectableItem);\n // disabled tabs get no tabIndex at all (mirrors useTab).\n if (isDisabled()) return undefined;\n return isKeyFocused() ? 0 : -1;\n },\n onKeyDown: handleKeyDown,\n onMouseDown: handleMouseDown,\n onPointerDown: handlePointerDown,\n onClick: handleClick,\n onFocus: handleFocus,\n onFocusIn: handleFocusIn,\n onBlur: handleBlur,\n },\n isSelected,\n isDisabled,\n isPressed,\n isFocused,\n isFocusVisible,\n isHovered,\n };\n}\n\n/**\n * Creates ARIA props for a tab panel.\n */\nexport function createTabPanel<T>(\n props: AriaTabPanelProps,\n state: TabListState<T> | null,\n): TabPanelAria {\n const fallbackId = createId();\n\n // Shared panel pattern: if no explicit id is provided, associate the panel\n // with the currently selected tab.\n const associatedKey = createMemo<Key | null>(() => {\n if (state === null) return null;\n return props.id ?? state.selectedKey();\n });\n\n // If state is null, the panel is always visible (SSR fallback).\n const isSelected = createMemo(() => {\n if (state === null) return true;\n if (props.id === undefined) {\n return state.selectedKey() !== null;\n }\n return state.selectedKey() === props.id;\n });\n\n return {\n tabPanelProps: {\n get id() {\n const key = associatedKey();\n if (state && key !== null) {\n return generateTabPanelId(state, key);\n }\n return fallbackId;\n },\n role: \"tabpanel\",\n get \"aria-labelledby\"() {\n if (props[\"aria-labelledby\"]) return props[\"aria-labelledby\"];\n const key = associatedKey();\n if (state && key !== null) {\n return generateTabId(state, key);\n }\n return undefined;\n },\n \"aria-label\": props[\"aria-label\"],\n \"aria-describedby\": props[\"aria-describedby\"],\n // Make panel focusable if no tabbable children\n tabIndex: 0,\n },\n isSelected,\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { t as createPress } from "./createPress.js";
|
|
2
|
+
import { i as mergeProps$1 } from "./env.js";
|
|
3
|
+
import { t as filterDOMProps } from "./filterDOMProps.js";
|
|
4
|
+
import { t as access } from "./reactivity.js";
|
|
5
|
+
import { n as createFocusable } from "./createFocusable.js";
|
|
6
|
+
import { createId } from "../ssr/index.js";
|
|
7
|
+
import { t as createLabel } from "./createLabel.js";
|
|
8
|
+
import { createEffect, createMemo, onCleanup } from "solid-js";
|
|
9
|
+
//#region src/tag/createTagGroup.ts
|
|
10
|
+
/**
|
|
11
|
+
* TagGroup hook for Solidaria
|
|
12
|
+
*
|
|
13
|
+
* Provides the behavior and accessibility implementation for a tag group component.
|
|
14
|
+
* A tag group is a focusable list of labels, categories, keywords, filters, or other items,
|
|
15
|
+
* with support for keyboard navigation, selection, and removal.
|
|
16
|
+
*
|
|
17
|
+
* Based on @react-aria/tag useTagGroup
|
|
18
|
+
*/
|
|
19
|
+
const tagGroupData = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
function getTagGroupData(state) {
|
|
21
|
+
return tagGroupData.get(state);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Provides the behavior and accessibility implementation for a tag group component.
|
|
25
|
+
* A tag group is a focusable list of labels, categories, keywords, filters, or other items,
|
|
26
|
+
* with support for keyboard navigation, selection, and removal.
|
|
27
|
+
*/
|
|
28
|
+
function createTagGroup(props, state, _ref) {
|
|
29
|
+
const getProps = () => access(props);
|
|
30
|
+
const id = createId(getProps().id);
|
|
31
|
+
const descriptionId = createId();
|
|
32
|
+
const errorMessageId = createId();
|
|
33
|
+
const getFallbackAriaLabel = () => {
|
|
34
|
+
const p = getProps();
|
|
35
|
+
return !p.label && !p["aria-label"] && !p["aria-labelledby"] ? "Tag list" : void 0;
|
|
36
|
+
};
|
|
37
|
+
const sharedData = {
|
|
38
|
+
id,
|
|
39
|
+
get onRemove() {
|
|
40
|
+
return getProps().onRemove;
|
|
41
|
+
},
|
|
42
|
+
get direction() {
|
|
43
|
+
return getProps().direction ?? "ltr";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const domProps = () => filterDOMProps(getProps(), { labelable: true });
|
|
47
|
+
const { labelProps, fieldProps } = createLabel({
|
|
48
|
+
get label() {
|
|
49
|
+
return getProps().label;
|
|
50
|
+
},
|
|
51
|
+
get "aria-label"() {
|
|
52
|
+
return getProps()["aria-label"] ?? getFallbackAriaLabel();
|
|
53
|
+
},
|
|
54
|
+
get "aria-labelledby"() {
|
|
55
|
+
return getProps()["aria-labelledby"];
|
|
56
|
+
},
|
|
57
|
+
labelElementType: "span"
|
|
58
|
+
});
|
|
59
|
+
tagGroupData.set(state, sharedData);
|
|
60
|
+
createEffect(() => {
|
|
61
|
+
tagGroupData.set(state, sharedData);
|
|
62
|
+
onCleanup(() => {
|
|
63
|
+
if (tagGroupData.get(state) === sharedData) tagGroupData.delete(state);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const getAriaDescribedBy = () => {
|
|
67
|
+
const p = getProps();
|
|
68
|
+
const ids = [];
|
|
69
|
+
if (p["aria-describedby"]) ids.push(p["aria-describedby"]);
|
|
70
|
+
if (p.description) ids.push(descriptionId);
|
|
71
|
+
if (p.errorMessage) ids.push(errorMessageId);
|
|
72
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
73
|
+
};
|
|
74
|
+
const getRef = () => _ref?.() ?? null;
|
|
75
|
+
const getFirstNavigableKey = () => {
|
|
76
|
+
const collection = state.collection();
|
|
77
|
+
let candidate = collection.getFirstKey();
|
|
78
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyAfter(candidate);
|
|
79
|
+
return candidate;
|
|
80
|
+
};
|
|
81
|
+
const getLastNavigableKey = () => {
|
|
82
|
+
const collection = state.collection();
|
|
83
|
+
let candidate = collection.getLastKey();
|
|
84
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyBefore(candidate);
|
|
85
|
+
return candidate;
|
|
86
|
+
};
|
|
87
|
+
const onFocus = (e) => {
|
|
88
|
+
state.setFocused(true);
|
|
89
|
+
const container = e.currentTarget;
|
|
90
|
+
if (container && e.target && !container.contains(e.target)) return;
|
|
91
|
+
if (state.focusedKey() != null || getProps().isDisabled) return;
|
|
92
|
+
const relatedTarget = e.relatedTarget;
|
|
93
|
+
const enterKey = relatedTarget && container && container.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING ? getLastNavigableKey() : getFirstNavigableKey();
|
|
94
|
+
if (enterKey != null) state.setFocusedKey(enterKey);
|
|
95
|
+
};
|
|
96
|
+
const onBlur = () => {
|
|
97
|
+
state.setFocused(false);
|
|
98
|
+
};
|
|
99
|
+
createEffect(() => {
|
|
100
|
+
const key = state.focusedKey();
|
|
101
|
+
const el = getRef();
|
|
102
|
+
if (!el || key == null) return;
|
|
103
|
+
const active = document.activeElement;
|
|
104
|
+
if (!active || active !== el && !el.contains(active)) return;
|
|
105
|
+
const target = el.querySelector(`[data-key="${CSS.escape(String(key))}"]`);
|
|
106
|
+
if (target && target !== active) target.focus();
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
get gridProps() {
|
|
110
|
+
const p = getProps();
|
|
111
|
+
const hasItems = state.collection().size > 0;
|
|
112
|
+
return mergeProps$1(domProps(), fieldProps, {
|
|
113
|
+
id,
|
|
114
|
+
role: hasItems ? "grid" : "group",
|
|
115
|
+
"aria-multiselectable": hasItems && state.selectionMode() === "multiple" ? true : void 0,
|
|
116
|
+
"aria-atomic": false,
|
|
117
|
+
"aria-relevant": "additions",
|
|
118
|
+
"aria-describedby": getAriaDescribedBy(),
|
|
119
|
+
"aria-disabled": p.isDisabled || void 0,
|
|
120
|
+
tabIndex: p.isDisabled ? void 0 : state.focusedKey() != null ? -1 : 0,
|
|
121
|
+
onFocus,
|
|
122
|
+
onBlur
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
get labelProps() {
|
|
126
|
+
return labelProps;
|
|
127
|
+
},
|
|
128
|
+
get descriptionProps() {
|
|
129
|
+
return { id: descriptionId };
|
|
130
|
+
},
|
|
131
|
+
get errorMessageProps() {
|
|
132
|
+
return { id: errorMessageId };
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/tag/createTag.ts
|
|
138
|
+
/**
|
|
139
|
+
* Tag hook for Solidaria
|
|
140
|
+
*
|
|
141
|
+
* Provides the behavior and accessibility implementation for a tag component.
|
|
142
|
+
* Tags are individual items within a TagGroup.
|
|
143
|
+
*
|
|
144
|
+
* Based on @react-aria/tag useTag
|
|
145
|
+
*/
|
|
146
|
+
/**
|
|
147
|
+
* Provides the behavior and accessibility implementation for a tag component.
|
|
148
|
+
* Tags are individual items within a TagGroup.
|
|
149
|
+
*/
|
|
150
|
+
function createTag(props, state, ref) {
|
|
151
|
+
const getProps = () => access(props);
|
|
152
|
+
const rowId = createId();
|
|
153
|
+
const cellId = createId();
|
|
154
|
+
const removeButtonId = createId();
|
|
155
|
+
const getData = () => getTagGroupData(state);
|
|
156
|
+
const key = () => getProps().key;
|
|
157
|
+
const isDisabled = createMemo(() => {
|
|
158
|
+
return getProps().isDisabled || state.isDisabled(key());
|
|
159
|
+
});
|
|
160
|
+
const isSelected = createMemo(() => {
|
|
161
|
+
return state.isSelected(key());
|
|
162
|
+
});
|
|
163
|
+
const isSelectable = createMemo(() => state.selectionMode() !== "none");
|
|
164
|
+
const isFocused = createMemo(() => {
|
|
165
|
+
return state.focusedKey() === key();
|
|
166
|
+
});
|
|
167
|
+
const getFirstFocusableKey = () => {
|
|
168
|
+
const collection = state.collection();
|
|
169
|
+
let candidate = collection.getFirstKey();
|
|
170
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyAfter(candidate);
|
|
171
|
+
return candidate;
|
|
172
|
+
};
|
|
173
|
+
const getLastFocusableKey = () => {
|
|
174
|
+
const collection = state.collection();
|
|
175
|
+
let candidate = collection.getLastKey();
|
|
176
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyBefore(candidate);
|
|
177
|
+
return candidate;
|
|
178
|
+
};
|
|
179
|
+
const getNextFocusableKey = (fromKey) => {
|
|
180
|
+
const collection = state.collection();
|
|
181
|
+
let candidate = collection.getKeyAfter(fromKey);
|
|
182
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyAfter(candidate);
|
|
183
|
+
if (candidate != null) return candidate;
|
|
184
|
+
return getFirstFocusableKey();
|
|
185
|
+
};
|
|
186
|
+
const getPreviousFocusableKey = (fromKey) => {
|
|
187
|
+
const collection = state.collection();
|
|
188
|
+
let candidate = collection.getKeyBefore(fromKey);
|
|
189
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyBefore(candidate);
|
|
190
|
+
if (candidate != null) return candidate;
|
|
191
|
+
return getLastFocusableKey();
|
|
192
|
+
};
|
|
193
|
+
const focusKey = (nextKey) => {
|
|
194
|
+
if (nextKey == null) return;
|
|
195
|
+
state.setFocusedKey(nextKey);
|
|
196
|
+
const currentElement = ref();
|
|
197
|
+
if (!currentElement) return;
|
|
198
|
+
if (nextKey === key()) {
|
|
199
|
+
currentElement.focus();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const tagList = currentElement.parentElement;
|
|
203
|
+
if (!tagList) return;
|
|
204
|
+
Array.from(tagList.querySelectorAll("[role=\"option\"], [role=\"row\"]")).find((el) => el.getAttribute("data-key") === String(nextKey))?.focus();
|
|
205
|
+
};
|
|
206
|
+
const { pressProps, isPressed } = createPress({
|
|
207
|
+
isDisabled,
|
|
208
|
+
onPress: () => {
|
|
209
|
+
if (!isDisabled()) {
|
|
210
|
+
state.setFocusedKey(key());
|
|
211
|
+
state.toggleSelection(key());
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
const { focusableProps } = createFocusable({
|
|
216
|
+
isDisabled,
|
|
217
|
+
onFocus: () => {
|
|
218
|
+
state.setFocusedKey(key());
|
|
219
|
+
}
|
|
220
|
+
}, ref);
|
|
221
|
+
const handleKeyDown = (e) => {
|
|
222
|
+
if (isDisabled()) return;
|
|
223
|
+
const isRtl = getData()?.direction === "rtl";
|
|
224
|
+
switch (e.key) {
|
|
225
|
+
case "ArrowRight":
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
focusKey(isRtl ? getPreviousFocusableKey(key()) : getNextFocusableKey(key()));
|
|
228
|
+
return;
|
|
229
|
+
case "ArrowLeft":
|
|
230
|
+
e.preventDefault();
|
|
231
|
+
focusKey(isRtl ? getNextFocusableKey(key()) : getPreviousFocusableKey(key()));
|
|
232
|
+
return;
|
|
233
|
+
case "ArrowDown":
|
|
234
|
+
e.preventDefault();
|
|
235
|
+
focusKey(getNextFocusableKey(key()));
|
|
236
|
+
return;
|
|
237
|
+
case "ArrowUp":
|
|
238
|
+
e.preventDefault();
|
|
239
|
+
focusKey(getPreviousFocusableKey(key()));
|
|
240
|
+
return;
|
|
241
|
+
case "Home":
|
|
242
|
+
e.preventDefault();
|
|
243
|
+
focusKey(getFirstFocusableKey());
|
|
244
|
+
return;
|
|
245
|
+
case "End":
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
focusKey(getLastFocusableKey());
|
|
248
|
+
return;
|
|
249
|
+
default: break;
|
|
250
|
+
}
|
|
251
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
252
|
+
e.preventDefault();
|
|
253
|
+
const data = getData();
|
|
254
|
+
if (data?.onRemove) if (isSelected()) {
|
|
255
|
+
const selection = state.selectedKeys();
|
|
256
|
+
const keysToRemove = selection === "all" ? new Set(Array.from(state.collection()).map((item) => item.key)) : new Set(selection);
|
|
257
|
+
data.onRemove(keysToRemove);
|
|
258
|
+
} else data.onRemove(new Set([key()]));
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
const tabIndex = createMemo(() => {
|
|
262
|
+
if (isDisabled()) return -1;
|
|
263
|
+
return isFocused() || state.focusedKey() == null ? 0 : -1;
|
|
264
|
+
});
|
|
265
|
+
const domProps = () => filterDOMProps(getProps());
|
|
266
|
+
const allowsRemoving = createMemo(() => {
|
|
267
|
+
return !!getData()?.onRemove;
|
|
268
|
+
});
|
|
269
|
+
const rootRole = createMemo(() => getProps().role ?? "option");
|
|
270
|
+
return {
|
|
271
|
+
get rowProps() {
|
|
272
|
+
return mergeProps$1(domProps(), focusableProps, pressProps, {
|
|
273
|
+
id: rowId,
|
|
274
|
+
role: rootRole(),
|
|
275
|
+
tabIndex: tabIndex(),
|
|
276
|
+
"data-key": String(key()),
|
|
277
|
+
"aria-label": getProps().textValue,
|
|
278
|
+
"aria-selected": isSelectable() ? isSelected() : void 0,
|
|
279
|
+
"aria-disabled": isDisabled() || void 0,
|
|
280
|
+
onKeyDown: handleKeyDown
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
get gridCellProps() {
|
|
284
|
+
return {
|
|
285
|
+
id: cellId,
|
|
286
|
+
role: "gridcell",
|
|
287
|
+
"aria-describedby": allowsRemoving() ? removeButtonId : void 0
|
|
288
|
+
};
|
|
289
|
+
},
|
|
290
|
+
get removeButtonProps() {
|
|
291
|
+
const data = getData();
|
|
292
|
+
return {
|
|
293
|
+
id: removeButtonId,
|
|
294
|
+
"aria-label": "Remove",
|
|
295
|
+
"aria-labelledby": `${removeButtonId} ${rowId}`,
|
|
296
|
+
isDisabled: isDisabled(),
|
|
297
|
+
onPress: () => {
|
|
298
|
+
if (data?.onRemove && !isDisabled()) data.onRemove(new Set([key()]));
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
get allowsRemoving() {
|
|
303
|
+
return allowsRemoving();
|
|
304
|
+
},
|
|
305
|
+
get isSelected() {
|
|
306
|
+
return isSelected();
|
|
307
|
+
},
|
|
308
|
+
get isDisabled() {
|
|
309
|
+
return isDisabled();
|
|
310
|
+
},
|
|
311
|
+
get isFocused() {
|
|
312
|
+
return isFocused();
|
|
313
|
+
},
|
|
314
|
+
get isPressed() {
|
|
315
|
+
return isPressed();
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
export { createTagGroup as n, getTagGroupData as r, createTag as t };
|
|
321
|
+
|
|
322
|
+
//# sourceMappingURL=tag.js.map
|