@proyecto-viviana/solidaria 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunk/actiongroup.js +207 -0
- package/dist/_chunk/actiongroup.js.map +1 -0
- package/dist/_chunk/actiongroup.jsx +207 -0
- package/dist/_chunk/actiongroup.jsx.map +1 -0
- package/dist/_chunk/ariaHideOutside.js +122 -0
- package/dist/_chunk/ariaHideOutside.js.map +1 -0
- package/dist/_chunk/ariaHideOutside.jsx +122 -0
- package/dist/_chunk/ariaHideOutside.jsx.map +1 -0
- package/dist/_chunk/autocomplete.js +196 -0
- package/dist/_chunk/autocomplete.js.map +1 -0
- package/dist/_chunk/autocomplete.jsx +196 -0
- package/dist/_chunk/autocomplete.jsx.map +1 -0
- package/dist/_chunk/breadcrumbs.js +119 -0
- package/dist/_chunk/breadcrumbs.js.map +1 -0
- package/dist/_chunk/breadcrumbs.jsx +119 -0
- package/dist/_chunk/breadcrumbs.jsx.map +1 -0
- package/dist/_chunk/button.js +276 -0
- package/dist/_chunk/button.js.map +1 -0
- package/dist/_chunk/button.jsx +276 -0
- package/dist/_chunk/button.jsx.map +1 -0
- package/dist/_chunk/calendar.js +1036 -0
- package/dist/_chunk/calendar.js.map +1 -0
- package/dist/_chunk/calendar.jsx +1036 -0
- package/dist/_chunk/calendar.jsx.map +1 -0
- package/dist/_chunk/checkbox.js +234 -0
- package/dist/_chunk/checkbox.js.map +1 -0
- package/dist/_chunk/checkbox.jsx +234 -0
- package/dist/_chunk/checkbox.jsx.map +1 -0
- package/dist/_chunk/color.js +1174 -0
- package/dist/_chunk/color.js.map +1 -0
- package/dist/_chunk/color.jsx +1174 -0
- package/dist/_chunk/color.jsx.map +1 -0
- package/dist/_chunk/combobox.js +436 -0
- package/dist/_chunk/combobox.js.map +1 -0
- package/dist/_chunk/combobox.jsx +436 -0
- package/dist/_chunk/combobox.jsx.map +1 -0
- package/dist/_chunk/createCollator.js +229 -0
- package/dist/_chunk/createCollator.js.map +1 -0
- package/dist/_chunk/createCollator.jsx +223 -0
- package/dist/_chunk/createCollator.jsx.map +1 -0
- package/dist/_chunk/createCollectionRowInteraction.js +133 -0
- package/dist/_chunk/createCollectionRowInteraction.js.map +1 -0
- package/dist/_chunk/createCollectionRowInteraction.jsx +133 -0
- package/dist/_chunk/createCollectionRowInteraction.jsx.map +1 -0
- package/dist/_chunk/createField.js +54 -0
- package/dist/_chunk/createField.js.map +1 -0
- package/dist/_chunk/createField.jsx +54 -0
- package/dist/_chunk/createField.jsx.map +1 -0
- package/dist/_chunk/createFocus.js +101 -0
- package/dist/_chunk/createFocus.js.map +1 -0
- package/dist/_chunk/createFocus.jsx +101 -0
- package/dist/_chunk/createFocus.jsx.map +1 -0
- package/dist/_chunk/createFocusRing.js +54 -0
- package/dist/_chunk/createFocusRing.js.map +1 -0
- package/dist/_chunk/createFocusRing.jsx +54 -0
- package/dist/_chunk/createFocusRing.jsx.map +1 -0
- package/dist/_chunk/createFocusWithin.js +121 -0
- package/dist/_chunk/createFocusWithin.js.map +1 -0
- package/dist/_chunk/createFocusWithin.jsx +121 -0
- package/dist/_chunk/createFocusWithin.jsx.map +1 -0
- package/dist/_chunk/createFocusable.js +131 -0
- package/dist/_chunk/createFocusable.js.map +1 -0
- package/dist/_chunk/createFocusable.jsx +131 -0
- package/dist/_chunk/createFocusable.jsx.map +1 -0
- package/dist/_chunk/createFormValidation.js +135 -0
- package/dist/_chunk/createFormValidation.js.map +1 -0
- package/dist/_chunk/createFormValidation.jsx +135 -0
- package/dist/_chunk/createFormValidation.jsx.map +1 -0
- package/dist/_chunk/createHover.js +130 -0
- package/dist/_chunk/createHover.js.map +1 -0
- package/dist/_chunk/createHover.jsx +130 -0
- package/dist/_chunk/createHover.jsx.map +1 -0
- package/dist/_chunk/createInteractionModality.js +269 -0
- package/dist/_chunk/createInteractionModality.js.map +1 -0
- package/dist/_chunk/createInteractionModality.jsx +269 -0
- package/dist/_chunk/createInteractionModality.jsx.map +1 -0
- package/dist/_chunk/createLabel.js +46 -0
- package/dist/_chunk/createLabel.js.map +1 -0
- package/dist/_chunk/createLabel.jsx +46 -0
- package/dist/_chunk/createLabel.jsx.map +1 -0
- package/dist/_chunk/createLabels.js +31 -0
- package/dist/_chunk/createLabels.js.map +1 -0
- package/dist/_chunk/createLabels.jsx +31 -0
- package/dist/_chunk/createLabels.jsx.map +1 -0
- package/dist/_chunk/createLandmark.js +198 -0
- package/dist/_chunk/createLandmark.js.map +1 -0
- package/dist/_chunk/createLandmark.jsx +198 -0
- package/dist/_chunk/createLandmark.jsx.map +1 -0
- package/dist/_chunk/createLongPress.js +91 -0
- package/dist/_chunk/createLongPress.js.map +1 -0
- package/dist/_chunk/createLongPress.jsx +91 -0
- package/dist/_chunk/createLongPress.jsx.map +1 -0
- package/dist/_chunk/createOverlay.js +327 -0
- package/dist/_chunk/createOverlay.js.map +1 -0
- package/dist/_chunk/createOverlay.jsx +327 -0
- package/dist/_chunk/createOverlay.jsx.map +1 -0
- package/dist/_chunk/createPress.js +526 -0
- package/dist/_chunk/createPress.js.map +1 -0
- package/dist/_chunk/createPress.jsx +526 -0
- package/dist/_chunk/createPress.jsx.map +1 -0
- package/dist/_chunk/createProgressBar.js +81 -0
- package/dist/_chunk/createProgressBar.js.map +1 -0
- package/dist/_chunk/createProgressBar.jsx +81 -0
- package/dist/_chunk/createProgressBar.jsx.map +1 -0
- package/dist/_chunk/createSelectableItem.js +298 -0
- package/dist/_chunk/createSelectableItem.js.map +1 -0
- package/dist/_chunk/createSelectableItem.jsx +298 -0
- package/dist/_chunk/createSelectableItem.jsx.map +1 -0
- package/dist/_chunk/createToggle.js +158 -0
- package/dist/_chunk/createToggle.js.map +1 -0
- package/dist/_chunk/createToggle.jsx +158 -0
- package/dist/_chunk/createToggle.jsx.map +1 -0
- package/dist/_chunk/createTypeSelect.js +125 -0
- package/dist/_chunk/createTypeSelect.js.map +1 -0
- package/dist/_chunk/createTypeSelect.jsx +125 -0
- package/dist/_chunk/createTypeSelect.jsx.map +1 -0
- package/dist/_chunk/datepicker.js +1393 -0
- package/dist/_chunk/datepicker.js.map +1 -0
- package/dist/_chunk/datepicker.jsx +1393 -0
- package/dist/_chunk/datepicker.jsx.map +1 -0
- package/dist/_chunk/dialog.js +62 -0
- package/dist/_chunk/dialog.js.map +1 -0
- package/dist/_chunk/dialog.jsx +62 -0
- package/dist/_chunk/dialog.jsx.map +1 -0
- package/dist/_chunk/disclosure.js +185 -0
- package/dist/_chunk/disclosure.js.map +1 -0
- package/dist/_chunk/disclosure.jsx +185 -0
- package/dist/_chunk/disclosure.jsx.map +1 -0
- package/dist/_chunk/dnd.js +1304 -0
- package/dist/_chunk/dnd.js.map +1 -0
- package/dist/_chunk/dnd.jsx +1304 -0
- package/dist/_chunk/dnd.jsx.map +1 -0
- package/dist/_chunk/env.js +105 -0
- package/dist/_chunk/env.js.map +1 -0
- package/dist/_chunk/env.jsx +105 -0
- package/dist/_chunk/env.jsx.map +1 -0
- package/dist/_chunk/filterDOMProps.js +82 -0
- package/dist/_chunk/filterDOMProps.js.map +1 -0
- package/dist/_chunk/filterDOMProps.jsx +82 -0
- package/dist/_chunk/filterDOMProps.jsx.map +1 -0
- package/dist/_chunk/focus.js +399 -0
- package/dist/_chunk/focus.js.map +1 -0
- package/dist/_chunk/focus.jsx +399 -0
- package/dist/_chunk/focus.jsx.map +1 -0
- package/dist/_chunk/focus2.js +895 -0
- package/dist/_chunk/focus2.js.map +1 -0
- package/dist/_chunk/focus2.jsx +870 -0
- package/dist/_chunk/focus2.jsx.map +1 -0
- package/dist/_chunk/form.js +39 -0
- package/dist/_chunk/form.js.map +1 -0
- package/dist/_chunk/form.jsx +39 -0
- package/dist/_chunk/form.jsx.map +1 -0
- package/dist/_chunk/grid.js +623 -0
- package/dist/_chunk/grid.js.map +1 -0
- package/dist/_chunk/grid.jsx +623 -0
- package/dist/_chunk/grid.jsx.map +1 -0
- package/dist/_chunk/gridlist.js +364 -0
- package/dist/_chunk/gridlist.js.map +1 -0
- package/dist/_chunk/gridlist.jsx +364 -0
- package/dist/_chunk/gridlist.jsx.map +1 -0
- package/dist/_chunk/i18n.js +254 -0
- package/dist/_chunk/i18n.js.map +1 -0
- package/dist/_chunk/i18n.jsx +254 -0
- package/dist/_chunk/i18n.jsx.map +1 -0
- package/dist/_chunk/interactions.js +241 -0
- package/dist/_chunk/interactions.js.map +1 -0
- package/dist/_chunk/interactions.jsx +237 -0
- package/dist/_chunk/interactions.jsx.map +1 -0
- package/dist/_chunk/link.js +96 -0
- package/dist/_chunk/link.js.map +1 -0
- package/dist/_chunk/link.jsx +96 -0
- package/dist/_chunk/link.jsx.map +1 -0
- package/dist/_chunk/listbox.js +324 -0
- package/dist/_chunk/listbox.js.map +1 -0
- package/dist/_chunk/listbox.jsx +324 -0
- package/dist/_chunk/listbox.jsx.map +1 -0
- package/dist/_chunk/live-announcer.js +207 -0
- package/dist/_chunk/live-announcer.js.map +1 -0
- package/dist/_chunk/live-announcer.jsx +207 -0
- package/dist/_chunk/live-announcer.jsx.map +1 -0
- package/dist/_chunk/menu.js +518 -0
- package/dist/_chunk/menu.js.map +1 -0
- package/dist/_chunk/menu.jsx +518 -0
- package/dist/_chunk/menu.jsx.map +1 -0
- package/dist/_chunk/meter.js +33 -0
- package/dist/_chunk/meter.js.map +1 -0
- package/dist/_chunk/meter.jsx +33 -0
- package/dist/_chunk/meter.jsx.map +1 -0
- package/dist/_chunk/numberfield.js +258 -0
- package/dist/_chunk/numberfield.js.map +1 -0
- package/dist/_chunk/numberfield.jsx +258 -0
- package/dist/_chunk/numberfield.jsx.map +1 -0
- package/dist/_chunk/overlays.js +186 -0
- package/dist/_chunk/overlays.js.map +1 -0
- package/dist/_chunk/overlays.jsx +162 -0
- package/dist/_chunk/overlays.jsx.map +1 -0
- package/dist/_chunk/popover.js +574 -0
- package/dist/_chunk/popover.js.map +1 -0
- package/dist/_chunk/popover.jsx +574 -0
- package/dist/_chunk/popover.jsx.map +1 -0
- package/dist/_chunk/radio.js +319 -0
- package/dist/_chunk/radio.js.map +1 -0
- package/dist/_chunk/radio.jsx +319 -0
- package/dist/_chunk/radio.jsx.map +1 -0
- package/dist/_chunk/searchfield.js +209 -0
- package/dist/_chunk/searchfield.js.map +1 -0
- package/dist/_chunk/searchfield.jsx +209 -0
- package/dist/_chunk/searchfield.jsx.map +1 -0
- package/dist/_chunk/select.js +403 -0
- package/dist/_chunk/select.js.map +1 -0
- package/dist/_chunk/select.jsx +394 -0
- package/dist/_chunk/select.jsx.map +1 -0
- package/dist/_chunk/selection.js +679 -0
- package/dist/_chunk/selection.js.map +1 -0
- package/dist/_chunk/selection.jsx +679 -0
- package/dist/_chunk/selection.jsx.map +1 -0
- package/dist/_chunk/separator.js +29 -0
- package/dist/_chunk/separator.js.map +1 -0
- package/dist/_chunk/separator.jsx +29 -0
- package/dist/_chunk/separator.jsx.map +1 -0
- package/dist/_chunk/slider.js +255 -0
- package/dist/_chunk/slider.js.map +1 -0
- package/dist/_chunk/slider.jsx +255 -0
- package/dist/_chunk/slider.jsx.map +1 -0
- package/dist/_chunk/steplist.js +66 -0
- package/dist/_chunk/steplist.js.map +1 -0
- package/dist/_chunk/steplist.jsx +66 -0
- package/dist/_chunk/steplist.jsx.map +1 -0
- package/dist/_chunk/switch.js +34 -0
- package/dist/_chunk/switch.js.map +1 -0
- package/dist/_chunk/switch.jsx +34 -0
- package/dist/_chunk/switch.jsx.map +1 -0
- package/dist/_chunk/table.js +1051 -0
- package/dist/_chunk/table.js.map +1 -0
- package/dist/_chunk/table.jsx +1051 -0
- package/dist/_chunk/table.jsx.map +1 -0
- package/dist/_chunk/tabs.js +260 -0
- package/dist/_chunk/tabs.js.map +1 -0
- package/dist/_chunk/tabs.jsx +260 -0
- package/dist/_chunk/tabs.jsx.map +1 -0
- package/dist/_chunk/tag.js +286 -0
- package/dist/_chunk/tag.js.map +1 -0
- package/dist/_chunk/tag.jsx +286 -0
- package/dist/_chunk/tag.jsx.map +1 -0
- package/dist/_chunk/textfield.js +109 -0
- package/dist/_chunk/textfield.js.map +1 -0
- package/dist/_chunk/textfield.jsx +109 -0
- package/dist/_chunk/textfield.jsx.map +1 -0
- package/dist/_chunk/toast.js +250 -0
- package/dist/_chunk/toast.js.map +1 -0
- package/dist/_chunk/toast.jsx +250 -0
- package/dist/_chunk/toast.jsx.map +1 -0
- package/dist/_chunk/toolbar.js +258 -0
- package/dist/_chunk/toolbar.js.map +1 -0
- package/dist/_chunk/toolbar.jsx +258 -0
- package/dist/_chunk/toolbar.jsx.map +1 -0
- package/dist/_chunk/tooltip.js +185 -0
- package/dist/_chunk/tooltip.js.map +1 -0
- package/dist/_chunk/tooltip.jsx +185 -0
- package/dist/_chunk/tooltip.jsx.map +1 -0
- package/dist/_chunk/tree.js +424 -0
- package/dist/_chunk/tree.js.map +1 -0
- package/dist/_chunk/tree.jsx +424 -0
- package/dist/_chunk/tree.jsx.map +1 -0
- package/dist/_chunk/utils.js +665 -0
- package/dist/_chunk/utils.js.map +1 -0
- package/dist/_chunk/utils.jsx +665 -0
- package/dist/_chunk/utils.jsx.map +1 -0
- package/dist/_chunk/visually-hidden.js +92 -0
- package/dist/_chunk/visually-hidden.js.map +1 -0
- package/dist/_chunk/visually-hidden.jsx +92 -0
- package/dist/_chunk/visually-hidden.jsx.map +1 -0
- package/dist/actiongroup/index.js +2 -0
- package/dist/actiongroup/index.jsx +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
- package/dist/autocomplete/index.js +2 -0
- package/dist/autocomplete/index.jsx +2 -0
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/index.jsx +2 -0
- package/dist/button/index.js +2 -0
- package/dist/button/index.jsx +2 -0
- package/dist/calendar/createCalendar.d.ts.map +1 -1
- package/dist/calendar/createCalendarCell.d.ts.map +1 -1
- package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
- package/dist/calendar/createCalendarMonthPicker.d.ts +41 -0
- package/dist/calendar/createCalendarMonthPicker.d.ts.map +1 -0
- package/dist/calendar/createCalendarYearPicker.d.ts +49 -0
- package/dist/calendar/createCalendarYearPicker.d.ts.map +1 -0
- package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
- package/dist/calendar/index.d.ts +2 -0
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +2 -0
- package/dist/calendar/index.jsx +2 -0
- package/dist/calendar/utils.d.ts +4 -0
- package/dist/calendar/utils.d.ts.map +1 -1
- package/dist/checkbox/createCheckbox.d.ts +4 -0
- package/dist/checkbox/createCheckbox.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox/index.jsx +2 -0
- package/dist/collections/index.js +160 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/index.jsx +160 -0
- package/dist/collections/index.jsx.map +1 -0
- package/dist/color/index.js +2 -0
- package/dist/color/index.jsx +2 -0
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.jsx +2 -0
- package/dist/datepicker/createDateSegment.d.ts.map +1 -1
- package/dist/datepicker/index.js +2 -0
- package/dist/datepicker/index.jsx +2 -0
- package/dist/dialog/index.js +2 -0
- package/dist/dialog/index.jsx +2 -0
- package/dist/disclosure/index.js +2 -0
- package/dist/disclosure/index.jsx +2 -0
- package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
- package/dist/dnd/index.js +2 -0
- package/dist/dnd/index.jsx +2 -0
- package/dist/dnd/utils.d.ts +2 -2
- package/dist/dnd/utils.d.ts.map +1 -1
- package/dist/focus/FocusScope.d.ts.map +1 -1
- package/dist/focus/index.js +2 -0
- package/dist/focus/index.jsx +2 -0
- package/dist/form/createFormValidation.d.ts.map +1 -1
- package/dist/form/index.js +3 -0
- package/dist/form/index.jsx +3 -0
- package/dist/grid/index.js +2 -0
- package/dist/grid/index.jsx +2 -0
- package/dist/gridlist/createGridList.d.ts +7 -1
- package/dist/gridlist/createGridList.d.ts.map +1 -1
- package/dist/gridlist/createGridListItem.d.ts +1 -1
- package/dist/gridlist/createGridListItem.d.ts.map +1 -1
- package/dist/gridlist/createGridListSection.d.ts +15 -0
- package/dist/gridlist/createGridListSection.d.ts.map +1 -0
- package/dist/gridlist/index.d.ts +2 -1
- package/dist/gridlist/index.d.ts.map +1 -1
- package/dist/gridlist/index.js +2 -0
- package/dist/gridlist/index.jsx +2 -0
- package/dist/gridlist/types.d.ts +50 -0
- package/dist/gridlist/types.d.ts.map +1 -1
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/index.jsx +3 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -18311
- package/dist/index.jsx +71 -18242
- package/dist/interactions/PressEvent.d.ts +11 -0
- package/dist/interactions/PressEvent.d.ts.map +1 -1
- package/dist/interactions/createInteractionModality.d.ts +0 -1
- package/dist/interactions/createInteractionModality.d.ts.map +1 -1
- package/dist/interactions/createKeyboard.d.ts.map +1 -1
- package/dist/interactions/createPress.d.ts.map +1 -1
- package/dist/interactions/index.js +10 -0
- package/dist/interactions/index.jsx +10 -0
- package/dist/label/index.js +4 -0
- package/dist/label/index.jsx +4 -0
- package/dist/landmark/index.js +2 -0
- package/dist/landmark/index.jsx +2 -0
- package/dist/link/index.js +2 -0
- package/dist/link/index.jsx +2 -0
- package/dist/listbox/createListBox.d.ts +37 -0
- package/dist/listbox/createListBox.d.ts.map +1 -1
- package/dist/listbox/createOption.d.ts +6 -0
- package/dist/listbox/createOption.d.ts.map +1 -1
- package/dist/listbox/index.js +2 -0
- package/dist/listbox/index.jsx +2 -0
- package/dist/live-announcer/index.js +2 -0
- package/dist/live-announcer/index.jsx +2 -0
- package/dist/menu/createMenu.d.ts +7 -4
- package/dist/menu/createMenu.d.ts.map +1 -1
- package/dist/menu/createMenuItem.d.ts +9 -1
- package/dist/menu/createMenuItem.d.ts.map +1 -1
- package/dist/menu/index.js +2 -0
- package/dist/menu/index.jsx +2 -0
- package/dist/meter/index.js +2 -0
- package/dist/meter/index.jsx +2 -0
- package/dist/numberfield/createNumberField.d.ts.map +1 -1
- package/dist/numberfield/index.js +2 -0
- package/dist/numberfield/index.jsx +2 -0
- package/dist/overlays/index.js +4 -0
- package/dist/overlays/index.jsx +4 -0
- package/dist/popover/calculatePosition.d.ts +2 -0
- package/dist/popover/calculatePosition.d.ts.map +1 -1
- package/dist/popover/createOverlayPosition.d.ts +8 -0
- package/dist/popover/createOverlayPosition.d.ts.map +1 -1
- package/dist/popover/index.js +2 -0
- package/dist/popover/index.jsx +2 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/index.jsx +2 -0
- package/dist/radio/createRadio.d.ts +2 -0
- package/dist/radio/createRadio.d.ts.map +1 -1
- package/dist/radio/index.js +2 -0
- package/dist/radio/index.jsx +2 -0
- package/dist/searchfield/index.js +2 -0
- package/dist/searchfield/index.jsx +2 -0
- package/dist/select/createSelect.d.ts.map +1 -1
- package/dist/select/index.js +2 -0
- package/dist/select/index.jsx +2 -0
- package/dist/selection/DOMLayoutDelegate.d.ts +58 -0
- package/dist/selection/DOMLayoutDelegate.d.ts.map +1 -0
- package/dist/selection/ListKeyboardDelegate.d.ts +95 -0
- package/dist/selection/ListKeyboardDelegate.d.ts.map +1 -0
- package/dist/selection/constants.d.ts +15 -0
- package/dist/selection/constants.d.ts.map +1 -0
- package/dist/selection/createCollectionRowInteraction.d.ts +13 -0
- package/dist/selection/createCollectionRowInteraction.d.ts.map +1 -0
- package/dist/selection/createScrollIntoViewOnFocus.d.ts +31 -0
- package/dist/selection/createScrollIntoViewOnFocus.d.ts.map +1 -0
- package/dist/selection/createSelectableCollection.d.ts +69 -0
- package/dist/selection/createSelectableCollection.d.ts.map +1 -0
- package/dist/selection/createSelectableItem.d.ts +154 -0
- package/dist/selection/createSelectableItem.d.ts.map +1 -0
- package/dist/selection/createSelectableList.d.ts +43 -0
- package/dist/selection/createSelectableList.d.ts.map +1 -0
- package/dist/selection/createTypeSelect.d.ts.map +1 -1
- package/dist/selection/index.d.ts +9 -0
- package/dist/selection/index.d.ts.map +1 -1
- package/dist/selection/index.js +4 -0
- package/dist/selection/index.jsx +4 -0
- package/dist/selection/selectItem.d.ts +29 -0
- package/dist/selection/selectItem.d.ts.map +1 -0
- package/dist/selection/utils.d.ts +40 -0
- package/dist/selection/utils.d.ts.map +1 -0
- package/dist/separator/index.js +2 -0
- package/dist/separator/index.jsx +2 -0
- package/dist/slider/createSlider.d.ts.map +1 -1
- package/dist/slider/index.js +2 -0
- package/dist/slider/index.jsx +2 -0
- package/dist/ssr/index.d.ts +17 -0
- package/dist/ssr/index.d.ts.map +1 -1
- package/dist/ssr/index.js +299 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/index.jsx +292 -0
- package/dist/ssr/index.jsx.map +1 -0
- package/dist/steplist/index.js +2 -0
- package/dist/steplist/index.jsx +2 -0
- package/dist/switch/createSwitch.d.ts +4 -0
- package/dist/switch/createSwitch.d.ts.map +1 -1
- package/dist/switch/index.js +2 -0
- package/dist/switch/index.jsx +2 -0
- package/dist/table/createTable.d.ts.map +1 -1
- package/dist/table/createTableRow.d.ts +1 -1
- package/dist/table/createTableRow.d.ts.map +1 -1
- package/dist/table/createTableSelectAllCheckbox.d.ts.map +1 -1
- package/dist/table/index.js +2 -0
- package/dist/table/index.jsx +2 -0
- package/dist/table/types.d.ts +27 -1
- package/dist/table/types.d.ts.map +1 -1
- package/dist/tabs/createTabs.d.ts +4 -3
- package/dist/tabs/createTabs.d.ts.map +1 -1
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/index.jsx +2 -0
- package/dist/tag/createTag.d.ts +2 -0
- package/dist/tag/createTag.d.ts.map +1 -1
- package/dist/tag/index.js +2 -0
- package/dist/tag/index.jsx +2 -0
- package/dist/textfield/index.js +2 -0
- package/dist/textfield/index.jsx +2 -0
- package/dist/toast/createToast.d.ts.map +1 -1
- package/dist/toast/index.js +2 -0
- package/dist/toast/index.jsx +2 -0
- package/dist/toggle/createToggle.d.ts +4 -0
- package/dist/toggle/createToggle.d.ts.map +1 -1
- package/dist/toggle/index.js +3 -0
- package/dist/toggle/index.jsx +3 -0
- package/dist/toolbar/createToolbar.d.ts +1 -1
- package/dist/toolbar/createToolbar.d.ts.map +1 -1
- package/dist/toolbar/index.js +2 -0
- package/dist/toolbar/index.jsx +2 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/index.jsx +2 -0
- package/dist/tree/createTree.d.ts +5 -1
- package/dist/tree/createTree.d.ts.map +1 -1
- package/dist/tree/createTreeItem.d.ts +1 -1
- package/dist/tree/createTreeItem.d.ts.map +1 -1
- package/dist/tree/index.js +2 -0
- package/dist/tree/index.jsx +2 -0
- package/dist/tree/types.d.ts +10 -0
- package/dist/tree/types.d.ts.map +1 -1
- package/dist/utils/animation.d.ts +60 -0
- package/dist/utils/animation.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +48 -2
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.jsx +5 -0
- package/dist/utils/keyboard.d.ts +17 -0
- package/dist/utils/keyboard.d.ts.map +1 -0
- package/dist/utils/mergeProps.d.ts.map +1 -1
- package/dist/utils/scrollIntoView.d.ts +30 -0
- package/dist/utils/scrollIntoView.d.ts.map +1 -0
- package/dist/visually-hidden/index.js +2 -0
- package/dist/visually-hidden/index.jsx +2 -0
- package/package.json +304 -3
- package/src/autocomplete/createAutocomplete.ts +67 -21
- package/src/calendar/createCalendar.ts +2 -0
- package/src/calendar/createCalendarCell.ts +19 -2
- package/src/calendar/createCalendarGrid.ts +43 -9
- package/src/calendar/createCalendarMonthPicker.ts +105 -0
- package/src/calendar/createCalendarYearPicker.ts +144 -0
- package/src/calendar/createRangeCalendar.ts +2 -0
- package/src/calendar/index.ts +17 -0
- package/src/calendar/utils.ts +4 -0
- package/src/checkbox/createCheckbox.ts +10 -0
- package/src/checkbox/createCheckboxGroupItem.ts +12 -16
- package/src/datepicker/createDateSegment.ts +6 -1
- package/src/dnd/createDroppableCollection.ts +4 -1
- package/src/dnd/utils.ts +27 -3
- package/src/focus/FocusScope.tsx +152 -18
- package/src/form/createFormValidation.ts +8 -1
- package/src/gridlist/createGridList.ts +145 -42
- package/src/gridlist/createGridListItem.ts +87 -155
- package/src/gridlist/createGridListSection.ts +54 -0
- package/src/gridlist/index.ts +3 -0
- package/src/gridlist/types.ts +47 -0
- package/src/index.ts +40 -0
- package/src/interactions/PressEvent.ts +14 -0
- package/src/interactions/createInteractionModality.ts +21 -12
- package/src/interactions/createKeyboard.ts +10 -0
- package/src/interactions/createPress.ts +29 -6
- package/src/listbox/createListBox.ts +129 -8
- package/src/listbox/createOption.ts +68 -73
- package/src/menu/createMenu.ts +93 -16
- package/src/menu/createMenuItem.ts +253 -41
- package/src/numberfield/createNumberField.ts +82 -14
- package/src/popover/calculatePosition.ts +19 -7
- package/src/popover/createOverlayPosition.ts +9 -0
- package/src/radio/createRadio.ts +19 -2
- package/src/select/createSelect.ts +18 -2
- package/src/selection/DOMLayoutDelegate.ts +102 -0
- package/src/selection/ListKeyboardDelegate.ts +398 -0
- package/src/selection/constants.ts +16 -0
- package/src/selection/createCollectionRowInteraction.ts +209 -0
- package/src/selection/createScrollIntoViewOnFocus.ts +65 -0
- package/src/selection/createSelectableCollection.ts +645 -0
- package/src/selection/createSelectableItem.ts +498 -0
- package/src/selection/createSelectableList.ts +93 -0
- package/src/selection/createTypeSelect.ts +112 -51
- package/src/selection/index.ts +31 -0
- package/src/selection/selectItem.ts +80 -0
- package/src/selection/utils.ts +82 -0
- package/src/slider/createSlider.ts +48 -1
- package/src/ssr/index.tsx +31 -0
- package/src/switch/createSwitch.ts +10 -0
- package/src/table/createTable.ts +56 -26
- package/src/table/createTableRow.ts +198 -203
- package/src/table/createTableSelectAllCheckbox.ts +3 -4
- package/src/table/types.ts +29 -1
- package/src/tabs/createTabs.ts +50 -20
- package/src/tag/createTag.ts +9 -4
- package/src/toast/createToast.ts +1 -0
- package/src/toggle/createToggle.ts +20 -0
- package/src/toolbar/createToolbar.ts +43 -42
- package/src/tree/createTree.ts +100 -42
- package/src/tree/createTreeItem.ts +105 -120
- package/src/tree/types.ts +10 -0
- package/src/utils/animation.ts +151 -0
- package/src/utils/dom.ts +215 -25
- package/src/utils/index.ts +8 -0
- package/src/utils/keyboard.ts +25 -0
- package/src/utils/mergeProps.ts +8 -1
- package/src/utils/scrollIntoView.ts +181 -0
- package/dist/index.js.map +0 -1
- package/dist/index.jsx.map +0 -1
|
@@ -0,0 +1,260 @@
|
|
|
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 { a as useLocale } from "./createCollator.jsx";
|
|
5
|
+
import { createId } from "../ssr/index.jsx";
|
|
6
|
+
import { 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
|
+
state.setFocusedKey(nextKey);
|
|
102
|
+
if (keyboardActivation() === "automatic") state.setSelectedKey(nextKey);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const handleFocus = () => {
|
|
106
|
+
state.setFocused(true);
|
|
107
|
+
if (state.focusedKey() === null && state.selectedKey() !== null) state.setFocusedKey(state.selectedKey());
|
|
108
|
+
};
|
|
109
|
+
const handleBlur = (e) => {
|
|
110
|
+
const relatedTarget = e.relatedTarget;
|
|
111
|
+
if (relatedTarget && e.currentTarget.contains(relatedTarget)) return;
|
|
112
|
+
state.setFocused(false);
|
|
113
|
+
};
|
|
114
|
+
return { tabListProps: {
|
|
115
|
+
role: "tablist",
|
|
116
|
+
"aria-orientation": orientation(),
|
|
117
|
+
"aria-label": props["aria-label"],
|
|
118
|
+
"aria-labelledby": props["aria-labelledby"],
|
|
119
|
+
"aria-describedby": props["aria-describedby"],
|
|
120
|
+
onKeyDown: handleKeyDown,
|
|
121
|
+
onFocusIn: handleFocus,
|
|
122
|
+
onFocusOut: handleBlur
|
|
123
|
+
} };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Creates ARIA props for an individual tab.
|
|
127
|
+
*/
|
|
128
|
+
function createTab(props, state, ref) {
|
|
129
|
+
const key = () => props.key;
|
|
130
|
+
const isSelected = createMemo(() => state.selectedKey() === key());
|
|
131
|
+
const isDisabled = createMemo(() => {
|
|
132
|
+
if (props.isDisabled) return true;
|
|
133
|
+
return state.isKeyDisabled(key());
|
|
134
|
+
});
|
|
135
|
+
const isKeyFocused = createMemo(() => state.focusedKey() === key());
|
|
136
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
137
|
+
const selectTab = () => {
|
|
138
|
+
const tabKey = key();
|
|
139
|
+
state.setFocusedKey(tabKey);
|
|
140
|
+
state.setSelectedKey(tabKey);
|
|
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
|
+
state.setFocusedKey(key());
|
|
167
|
+
callHandler(focusProps.onFocus, e);
|
|
168
|
+
};
|
|
169
|
+
const handleBlur = (e) => {
|
|
170
|
+
callHandler(focusProps.onBlur, e);
|
|
171
|
+
};
|
|
172
|
+
const handleKeyDown = (e) => {
|
|
173
|
+
callHandler(pressProps.onKeyDown, e);
|
|
174
|
+
};
|
|
175
|
+
const handleMouseDown = (e) => {
|
|
176
|
+
callHandler(pressProps.onMouseDown, e);
|
|
177
|
+
};
|
|
178
|
+
const handlePointerDown = (e) => {
|
|
179
|
+
callHandler(pressProps.onPointerDown, e);
|
|
180
|
+
};
|
|
181
|
+
const handleClick = (e) => {
|
|
182
|
+
callHandler(pressProps.onClick, e);
|
|
183
|
+
};
|
|
184
|
+
createEffect(() => {
|
|
185
|
+
const element = ref?.();
|
|
186
|
+
if (!state.isFocused() || !isKeyFocused() || !element) return;
|
|
187
|
+
if (element.ownerDocument?.activeElement !== element) element.focus();
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
tabProps: {
|
|
191
|
+
id: tabId,
|
|
192
|
+
role: "tab",
|
|
193
|
+
get "aria-selected"() {
|
|
194
|
+
return isSelected();
|
|
195
|
+
},
|
|
196
|
+
get "aria-disabled"() {
|
|
197
|
+
return isDisabled() || void 0;
|
|
198
|
+
},
|
|
199
|
+
get "aria-controls"() {
|
|
200
|
+
return isSelected() ? tabPanelId : void 0;
|
|
201
|
+
},
|
|
202
|
+
"aria-label": props["aria-label"],
|
|
203
|
+
"aria-labelledby": props["aria-labelledby"],
|
|
204
|
+
get tabIndex() {
|
|
205
|
+
if (isDisabled()) return void 0;
|
|
206
|
+
return isKeyFocused() ? 0 : -1;
|
|
207
|
+
},
|
|
208
|
+
onKeyDown: handleKeyDown,
|
|
209
|
+
onMouseDown: handleMouseDown,
|
|
210
|
+
onPointerDown: handlePointerDown,
|
|
211
|
+
onClick: handleClick,
|
|
212
|
+
onFocus: handleFocus,
|
|
213
|
+
onBlur: handleBlur
|
|
214
|
+
},
|
|
215
|
+
isSelected,
|
|
216
|
+
isDisabled,
|
|
217
|
+
isPressed,
|
|
218
|
+
isFocused,
|
|
219
|
+
isFocusVisible,
|
|
220
|
+
isHovered
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Creates ARIA props for a tab panel.
|
|
225
|
+
*/
|
|
226
|
+
function createTabPanel(props, state) {
|
|
227
|
+
const fallbackId = createId();
|
|
228
|
+
const associatedKey = createMemo(() => {
|
|
229
|
+
if (state === null) return null;
|
|
230
|
+
return props.id ?? state.selectedKey();
|
|
231
|
+
});
|
|
232
|
+
const isSelected = createMemo(() => {
|
|
233
|
+
if (state === null) return true;
|
|
234
|
+
if (props.id === void 0) return state.selectedKey() !== null;
|
|
235
|
+
return state.selectedKey() === props.id;
|
|
236
|
+
});
|
|
237
|
+
return {
|
|
238
|
+
tabPanelProps: {
|
|
239
|
+
get id() {
|
|
240
|
+
const key = associatedKey();
|
|
241
|
+
if (state && key !== null) return generateTabPanelId(state, key);
|
|
242
|
+
return fallbackId;
|
|
243
|
+
},
|
|
244
|
+
role: "tabpanel",
|
|
245
|
+
get "aria-labelledby"() {
|
|
246
|
+
if (props["aria-labelledby"]) return props["aria-labelledby"];
|
|
247
|
+
const key = associatedKey();
|
|
248
|
+
if (state && key !== null) return generateTabId(state, key);
|
|
249
|
+
},
|
|
250
|
+
"aria-label": props["aria-label"],
|
|
251
|
+
"aria-describedby": props["aria-describedby"],
|
|
252
|
+
tabIndex: 0
|
|
253
|
+
},
|
|
254
|
+
isSelected
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
export { createTabList as n, createTabPanel as r, createTab as t };
|
|
259
|
+
|
|
260
|
+
//# 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, 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 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 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 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 const tabKey = key();\n state.setFocusedKey(tabKey);\n state.setSelectedKey(tabKey);\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\n const handleFocus = (e: FocusEvent) => {\n state.setFocusedKey(key());\n callHandler(focusProps.onFocus, e);\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 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":";;;;;;;;;;;AAmIA,MAAM,6BAAa,IAAI,QAAuC;AAE9D,SAAS,aAAgB,OAAgC;CACvD,IAAI,KAAK,WAAW,IAAI,KAA8B;CACtD,IAAI,CAAC,IAAI;EACP,KAAK,SAAS;EACd,WAAW,IAAI,OAAgC,EAAE;CACnD;CACA,OAAO;AACT;AAEA,SAAS,cAAiB,OAAwB,KAAkB;CAGlE,OAAO,GAFQ,aAAa,KAEb,EAAE,OADF,OAAO,GAAG,CAAC,CAAC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EACA;EACA;EACA;CACF;AACF;;;;AAKA,SAAgB,eACd,OACA,OACc;CACd,MAAM,aAAa,SAAS;CAI5B,MAAM,gBAAgB,iBAA6B;EACjD,IAAI,UAAU,MAAM,OAAO;EAC3B,OAAO,MAAM,MAAM,MAAM,YAAY;CACvC,CAAC;CAGD,MAAM,aAAa,iBAAiB;EAClC,IAAI,UAAU,MAAM,OAAO;EAC3B,IAAI,MAAM,OAAO,KAAA,GACf,OAAO,MAAM,YAAY,MAAM;EAEjC,OAAO,MAAM,YAAY,MAAM,MAAM;CACvC,CAAC;CAED,OAAO;EACL,eAAe;GACb,IAAI,KAAK;IACP,MAAM,MAAM,cAAc;IAC1B,IAAI,SAAS,QAAQ,MACnB,OAAO,mBAAmB,OAAO,GAAG;IAEtC,OAAO;GACT;GACA,MAAM;GACN,IAAI,oBAAoB;IACtB,IAAI,MAAM,oBAAoB,OAAO,MAAM;IAC3C,MAAM,MAAM,cAAc;IAC1B,IAAI,SAAS,QAAQ,MACnB,OAAO,cAAc,OAAO,GAAG;GAGnC;GACA,cAAc,MAAM;GACpB,oBAAoB,MAAM;GAE1B,UAAU;EACZ;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { t as createPress } from "./createPress.js";
|
|
2
|
+
import { i as access, o as mergeProps } from "./env.js";
|
|
3
|
+
import { t as filterDOMProps } from "./filterDOMProps.js";
|
|
4
|
+
import { n as createFocusable } from "./createFocusable.js";
|
|
5
|
+
import { createId } from "../ssr/index.js";
|
|
6
|
+
import { t as createLabel } from "./createLabel.js";
|
|
7
|
+
import { createEffect, createMemo, onCleanup } from "solid-js";
|
|
8
|
+
//#region src/tag/createTagGroup.ts
|
|
9
|
+
/**
|
|
10
|
+
* TagGroup hook for Solidaria
|
|
11
|
+
*
|
|
12
|
+
* Provides the behavior and accessibility implementation for a tag group component.
|
|
13
|
+
* A tag group is a focusable list of labels, categories, keywords, filters, or other items,
|
|
14
|
+
* with support for keyboard navigation, selection, and removal.
|
|
15
|
+
*
|
|
16
|
+
* Based on @react-aria/tag useTagGroup
|
|
17
|
+
*/
|
|
18
|
+
const tagGroupData = /* @__PURE__ */ new WeakMap();
|
|
19
|
+
function getTagGroupData(state) {
|
|
20
|
+
return tagGroupData.get(state);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Provides the behavior and accessibility implementation for a tag group component.
|
|
24
|
+
* A tag group is a focusable list of labels, categories, keywords, filters, or other items,
|
|
25
|
+
* with support for keyboard navigation, selection, and removal.
|
|
26
|
+
*/
|
|
27
|
+
function createTagGroup(props, state, _ref) {
|
|
28
|
+
const getProps = () => access(props);
|
|
29
|
+
const id = createId(getProps().id);
|
|
30
|
+
const descriptionId = createId();
|
|
31
|
+
const errorMessageId = createId();
|
|
32
|
+
const getFallbackAriaLabel = () => {
|
|
33
|
+
const p = getProps();
|
|
34
|
+
return !p.label && !p["aria-label"] && !p["aria-labelledby"] ? "Tag list" : void 0;
|
|
35
|
+
};
|
|
36
|
+
const sharedData = {
|
|
37
|
+
id,
|
|
38
|
+
get onRemove() {
|
|
39
|
+
return getProps().onRemove;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const domProps = () => filterDOMProps(getProps(), { labelable: true });
|
|
43
|
+
const { labelProps, fieldProps } = createLabel({
|
|
44
|
+
get label() {
|
|
45
|
+
return getProps().label;
|
|
46
|
+
},
|
|
47
|
+
get "aria-label"() {
|
|
48
|
+
return getProps()["aria-label"] ?? getFallbackAriaLabel();
|
|
49
|
+
},
|
|
50
|
+
get "aria-labelledby"() {
|
|
51
|
+
return getProps()["aria-labelledby"];
|
|
52
|
+
},
|
|
53
|
+
labelElementType: "span"
|
|
54
|
+
});
|
|
55
|
+
tagGroupData.set(state, sharedData);
|
|
56
|
+
createEffect(() => {
|
|
57
|
+
tagGroupData.set(state, sharedData);
|
|
58
|
+
onCleanup(() => {
|
|
59
|
+
if (tagGroupData.get(state) === sharedData) tagGroupData.delete(state);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
const getAriaDescribedBy = () => {
|
|
63
|
+
const p = getProps();
|
|
64
|
+
const ids = [];
|
|
65
|
+
if (p["aria-describedby"]) ids.push(p["aria-describedby"]);
|
|
66
|
+
if (p.description) ids.push(descriptionId);
|
|
67
|
+
if (p.errorMessage) ids.push(errorMessageId);
|
|
68
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
get gridProps() {
|
|
72
|
+
const p = getProps();
|
|
73
|
+
const hasItems = state.collection().size > 0;
|
|
74
|
+
return mergeProps(domProps(), fieldProps, {
|
|
75
|
+
id,
|
|
76
|
+
role: hasItems ? "grid" : "group",
|
|
77
|
+
"aria-multiselectable": hasItems && state.selectionMode() === "multiple" ? true : void 0,
|
|
78
|
+
"aria-atomic": false,
|
|
79
|
+
"aria-relevant": "additions",
|
|
80
|
+
"aria-describedby": getAriaDescribedBy(),
|
|
81
|
+
"aria-disabled": p.isDisabled || void 0
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
get labelProps() {
|
|
85
|
+
return labelProps;
|
|
86
|
+
},
|
|
87
|
+
get descriptionProps() {
|
|
88
|
+
return { id: descriptionId };
|
|
89
|
+
},
|
|
90
|
+
get errorMessageProps() {
|
|
91
|
+
return { id: errorMessageId };
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/tag/createTag.ts
|
|
97
|
+
/**
|
|
98
|
+
* Tag hook for Solidaria
|
|
99
|
+
*
|
|
100
|
+
* Provides the behavior and accessibility implementation for a tag component.
|
|
101
|
+
* Tags are individual items within a TagGroup.
|
|
102
|
+
*
|
|
103
|
+
* Based on @react-aria/tag useTag
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* Provides the behavior and accessibility implementation for a tag component.
|
|
107
|
+
* Tags are individual items within a TagGroup.
|
|
108
|
+
*/
|
|
109
|
+
function createTag(props, state, ref) {
|
|
110
|
+
const getProps = () => access(props);
|
|
111
|
+
const rowId = createId();
|
|
112
|
+
const cellId = createId();
|
|
113
|
+
const removeButtonId = createId();
|
|
114
|
+
const getData = () => getTagGroupData(state);
|
|
115
|
+
const key = () => getProps().key;
|
|
116
|
+
const isDisabled = createMemo(() => {
|
|
117
|
+
return getProps().isDisabled || state.isDisabled(key());
|
|
118
|
+
});
|
|
119
|
+
const isSelected = createMemo(() => {
|
|
120
|
+
return state.isSelected(key());
|
|
121
|
+
});
|
|
122
|
+
const isSelectable = createMemo(() => state.selectionMode() !== "none");
|
|
123
|
+
const isFocused = createMemo(() => {
|
|
124
|
+
return state.focusedKey() === key();
|
|
125
|
+
});
|
|
126
|
+
const getFirstFocusableKey = () => {
|
|
127
|
+
const collection = state.collection();
|
|
128
|
+
let candidate = collection.getFirstKey();
|
|
129
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyAfter(candidate);
|
|
130
|
+
return candidate;
|
|
131
|
+
};
|
|
132
|
+
const getLastFocusableKey = () => {
|
|
133
|
+
const collection = state.collection();
|
|
134
|
+
let candidate = collection.getLastKey();
|
|
135
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyBefore(candidate);
|
|
136
|
+
return candidate;
|
|
137
|
+
};
|
|
138
|
+
const getNextFocusableKey = (fromKey) => {
|
|
139
|
+
const collection = state.collection();
|
|
140
|
+
let candidate = collection.getKeyAfter(fromKey);
|
|
141
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyAfter(candidate);
|
|
142
|
+
if (candidate != null) return candidate;
|
|
143
|
+
return getFirstFocusableKey();
|
|
144
|
+
};
|
|
145
|
+
const getPreviousFocusableKey = (fromKey) => {
|
|
146
|
+
const collection = state.collection();
|
|
147
|
+
let candidate = collection.getKeyBefore(fromKey);
|
|
148
|
+
while (candidate != null && state.isDisabled(candidate)) candidate = collection.getKeyBefore(candidate);
|
|
149
|
+
if (candidate != null) return candidate;
|
|
150
|
+
return getLastFocusableKey();
|
|
151
|
+
};
|
|
152
|
+
const focusKey = (nextKey) => {
|
|
153
|
+
if (nextKey == null) return;
|
|
154
|
+
state.setFocusedKey(nextKey);
|
|
155
|
+
const currentElement = ref();
|
|
156
|
+
if (!currentElement) return;
|
|
157
|
+
if (nextKey === key()) {
|
|
158
|
+
currentElement.focus();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const tagList = currentElement.parentElement;
|
|
162
|
+
if (!tagList) return;
|
|
163
|
+
Array.from(tagList.querySelectorAll("[role=\"option\"], [role=\"row\"]")).find((el) => el.getAttribute("data-key") === String(nextKey))?.focus();
|
|
164
|
+
};
|
|
165
|
+
const { pressProps, isPressed } = createPress({
|
|
166
|
+
isDisabled,
|
|
167
|
+
onPress: () => {
|
|
168
|
+
if (!isDisabled()) {
|
|
169
|
+
state.setFocusedKey(key());
|
|
170
|
+
state.toggleSelection(key());
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
const { focusableProps } = createFocusable({
|
|
175
|
+
isDisabled,
|
|
176
|
+
onFocus: () => {
|
|
177
|
+
state.setFocusedKey(key());
|
|
178
|
+
}
|
|
179
|
+
}, ref);
|
|
180
|
+
const handleKeyDown = (e) => {
|
|
181
|
+
if (isDisabled()) return;
|
|
182
|
+
switch (e.key) {
|
|
183
|
+
case "ArrowRight":
|
|
184
|
+
case "ArrowDown":
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
focusKey(getNextFocusableKey(key()));
|
|
187
|
+
return;
|
|
188
|
+
case "ArrowLeft":
|
|
189
|
+
case "ArrowUp":
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
focusKey(getPreviousFocusableKey(key()));
|
|
192
|
+
return;
|
|
193
|
+
case "Home":
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
focusKey(getFirstFocusableKey());
|
|
196
|
+
return;
|
|
197
|
+
case "End":
|
|
198
|
+
e.preventDefault();
|
|
199
|
+
focusKey(getLastFocusableKey());
|
|
200
|
+
return;
|
|
201
|
+
default: break;
|
|
202
|
+
}
|
|
203
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
const data = getData();
|
|
206
|
+
if (data?.onRemove) if (isSelected()) {
|
|
207
|
+
const selection = state.selectedKeys();
|
|
208
|
+
const keysToRemove = selection === "all" ? new Set(Array.from(state.collection()).map((item) => item.key)) : new Set(selection);
|
|
209
|
+
data.onRemove(keysToRemove);
|
|
210
|
+
} else data.onRemove(new Set([key()]));
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
const tabIndex = createMemo(() => {
|
|
214
|
+
if (isDisabled()) return -1;
|
|
215
|
+
if (isFocused()) return 0;
|
|
216
|
+
if (state.focusedKey() !== null) return -1;
|
|
217
|
+
const collection = state.collection();
|
|
218
|
+
let defaultTabStop = null;
|
|
219
|
+
if (state.selectionMode() !== "none") {
|
|
220
|
+
for (const item of collection) if (!state.isDisabled(item.key) && state.isSelected(item.key)) {
|
|
221
|
+
defaultTabStop = item.key;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (defaultTabStop == null) defaultTabStop = getFirstFocusableKey();
|
|
226
|
+
if (key() === defaultTabStop) return 0;
|
|
227
|
+
return -1;
|
|
228
|
+
});
|
|
229
|
+
const domProps = () => filterDOMProps(getProps());
|
|
230
|
+
const allowsRemoving = createMemo(() => {
|
|
231
|
+
return !!getData()?.onRemove;
|
|
232
|
+
});
|
|
233
|
+
const rootRole = createMemo(() => getProps().role ?? "option");
|
|
234
|
+
return {
|
|
235
|
+
get rowProps() {
|
|
236
|
+
return mergeProps(domProps(), focusableProps, pressProps, {
|
|
237
|
+
id: rowId,
|
|
238
|
+
role: rootRole(),
|
|
239
|
+
tabIndex: tabIndex(),
|
|
240
|
+
"data-key": String(key()),
|
|
241
|
+
"aria-label": getProps().textValue,
|
|
242
|
+
"aria-selected": isSelectable() ? isSelected() : void 0,
|
|
243
|
+
"aria-disabled": isDisabled() || void 0,
|
|
244
|
+
onKeyDown: handleKeyDown
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
get gridCellProps() {
|
|
248
|
+
return {
|
|
249
|
+
id: cellId,
|
|
250
|
+
role: "gridcell",
|
|
251
|
+
"aria-describedby": allowsRemoving() ? removeButtonId : void 0
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
get removeButtonProps() {
|
|
255
|
+
const data = getData();
|
|
256
|
+
return {
|
|
257
|
+
id: removeButtonId,
|
|
258
|
+
"aria-label": "Remove",
|
|
259
|
+
"aria-labelledby": `${removeButtonId} ${rowId}`,
|
|
260
|
+
isDisabled: isDisabled(),
|
|
261
|
+
onPress: () => {
|
|
262
|
+
if (data?.onRemove && !isDisabled()) data.onRemove(new Set([key()]));
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
get allowsRemoving() {
|
|
267
|
+
return allowsRemoving();
|
|
268
|
+
},
|
|
269
|
+
get isSelected() {
|
|
270
|
+
return isSelected();
|
|
271
|
+
},
|
|
272
|
+
get isDisabled() {
|
|
273
|
+
return isDisabled();
|
|
274
|
+
},
|
|
275
|
+
get isFocused() {
|
|
276
|
+
return isFocused();
|
|
277
|
+
},
|
|
278
|
+
get isPressed() {
|
|
279
|
+
return isPressed();
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
export { createTagGroup as n, getTagGroupData as r, createTag as t };
|
|
285
|
+
|
|
286
|
+
//# sourceMappingURL=tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.js","names":[],"sources":["../../src/tag/createTagGroup.ts","../../src/tag/createTag.ts"],"sourcesContent":["/**\n * TagGroup hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a tag group component.\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * Based on @react-aria/tag useTagGroup\n */\n\nimport { createEffect, onCleanup } from \"solid-js\";\nimport { createLabel } from \"../label/createLabel\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { ListState, Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaTagGroupProps {\n /** An ID for the tag group. */\n id?: string;\n /** Whether the tag group is disabled. */\n isDisabled?: boolean;\n /** The label for the tag group. */\n label?: string;\n /** An accessible label for the tag group when no visible label is provided. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the tag group. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the tag group. */\n \"aria-describedby\"?: string;\n /** A description of the tag group. */\n description?: string;\n /** An error message for the tag group. */\n errorMessage?: string;\n /** Handler that is called when a user removes a tag. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagGroupAria {\n /** Props for the tag group container element. */\n gridProps: Record<string, unknown>;\n /** Props for the tag group's visible label (if any). */\n labelProps: Record<string, unknown>;\n /** Props for the tag group description element, if any. */\n descriptionProps: Record<string, unknown>;\n /** Props for the tag group error message element, if any. */\n errorMessageProps: Record<string, unknown>;\n}\n\n// Shared data between tag group and tags\nconst tagGroupData = new WeakMap<object, TagGroupData>();\n\ninterface TagGroupData {\n id: string;\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport function getTagGroupData(state: ListState): TagGroupData | undefined {\n return tagGroupData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tag group component.\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\nexport function createTagGroup<T>(\n props: MaybeAccessor<AriaTagGroupProps>,\n state: ListState<T>,\n _ref?: () => HTMLElement | null,\n): TagGroupAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n const getFallbackAriaLabel = () => {\n const p = getProps();\n return !p.label && !p[\"aria-label\"] && !p[\"aria-labelledby\"] ? \"Tag list\" : undefined;\n };\n const sharedData: TagGroupData = {\n id,\n get onRemove() {\n return getProps().onRemove;\n },\n };\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Create label handling\n const { labelProps, fieldProps } = createLabel({\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"] ?? getFallbackAriaLabel();\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Share data with child tags before they create their aria state.\n tagGroupData.set(state, sharedData);\n\n // Clean up the shared state when the tag group owner is disposed.\n createEffect(() => {\n tagGroupData.set(state, sharedData);\n\n onCleanup(() => {\n if (tagGroupData.get(state) === sharedData) {\n tagGroupData.delete(state);\n }\n });\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p[\"aria-describedby\"]) {\n ids.push(p[\"aria-describedby\"]);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if (p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(\" \") : undefined;\n };\n\n return {\n get gridProps() {\n const p = getProps();\n const hasItems = state.collection().size > 0;\n\n return mergeProps(domProps(), fieldProps as Record<string, unknown>, {\n id,\n role: hasItems ? \"grid\" : \"group\",\n \"aria-multiselectable\": hasItems && state.selectionMode() === \"multiple\" ? true : undefined,\n \"aria-atomic\": false,\n \"aria-relevant\": \"additions\",\n \"aria-describedby\": getAriaDescribedBy(),\n \"aria-disabled\": p.isDisabled || undefined,\n });\n },\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n };\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n };\n },\n };\n}\n","/**\n * Tag hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a tag component.\n * Tags are individual items within a TagGroup.\n *\n * Based on @react-aria/tag useTag\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createFocusable } from \"../interactions/createFocusable\";\nimport { createPress } from \"../interactions/createPress\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { getTagGroupData } from \"./createTagGroup\";\nimport type { ListState, Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaTagProps {\n /** The unique key for this tag. */\n key: Key;\n /** The role for the tag root. Components use row semantics inside a grid. */\n role?: \"option\" | \"row\";\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for the tag used for accessibility. */\n textValue?: string;\n}\n\nexport interface TagAria {\n /** Props for the tag row element. */\n rowProps: Record<string, unknown>;\n /** Props for the tag cell element. */\n gridCellProps: Record<string, unknown>;\n /** Props for the tag remove button. */\n removeButtonProps: Record<string, unknown>;\n /** Whether the tag can be removed. */\n allowsRemoving: boolean;\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tag component.\n * Tags are individual items within a TagGroup.\n */\nexport function createTag<T>(\n props: MaybeAccessor<AriaTagProps>,\n state: ListState<T>,\n ref: () => HTMLElement | null,\n): TagAria {\n const getProps = () => access(props);\n const rowId = createId();\n const cellId = createId();\n const removeButtonId = createId();\n\n // Get shared data from tag group\n const getData = () => getTagGroupData(state);\n\n // Get key\n const key = () => getProps().key;\n\n // Compute states\n const isDisabled = createMemo(() => {\n const p = getProps();\n return p.isDisabled || state.isDisabled(key());\n });\n\n const isSelected = createMemo(() => {\n return state.isSelected(key());\n });\n\n const isSelectable = createMemo(() => state.selectionMode() !== \"none\");\n\n const isFocused = createMemo(() => {\n return state.focusedKey() === key();\n });\n\n const getFirstFocusableKey = (): Key | null => {\n const collection = state.collection();\n let candidate = collection.getFirstKey();\n while (candidate != null && state.isDisabled(candidate)) {\n candidate = collection.getKeyAfter(candidate);\n }\n return candidate;\n };\n\n const getLastFocusableKey = (): Key | null => {\n const collection = state.collection();\n let candidate = collection.getLastKey();\n while (candidate != null && state.isDisabled(candidate)) {\n candidate = collection.getKeyBefore(candidate);\n }\n return candidate;\n };\n\n const getNextFocusableKey = (fromKey: Key): Key | null => {\n const collection = state.collection();\n let candidate = collection.getKeyAfter(fromKey);\n while (candidate != null && state.isDisabled(candidate)) {\n candidate = collection.getKeyAfter(candidate);\n }\n\n if (candidate != null) {\n return candidate;\n }\n\n return getFirstFocusableKey();\n };\n\n const getPreviousFocusableKey = (fromKey: Key): Key | null => {\n const collection = state.collection();\n let candidate = collection.getKeyBefore(fromKey);\n while (candidate != null && state.isDisabled(candidate)) {\n candidate = collection.getKeyBefore(candidate);\n }\n\n if (candidate != null) {\n return candidate;\n }\n\n return getLastFocusableKey();\n };\n\n const focusKey = (nextKey: Key | null) => {\n if (nextKey == null) {\n return;\n }\n\n state.setFocusedKey(nextKey);\n const currentElement = ref();\n\n if (!currentElement) {\n return;\n }\n\n if (nextKey === key()) {\n currentElement.focus();\n return;\n }\n\n const tagList = currentElement.parentElement;\n if (!tagList) {\n return;\n }\n\n const nextTag = Array.from(\n tagList.querySelectorAll<HTMLElement>('[role=\"option\"], [role=\"row\"]'),\n ).find((el) => el.getAttribute(\"data-key\") === String(nextKey));\n\n nextTag?.focus();\n };\n\n // Handle press for selection\n const { pressProps, isPressed } = createPress({\n isDisabled,\n onPress: () => {\n if (!isDisabled()) {\n state.setFocusedKey(key());\n state.toggleSelection(key());\n }\n },\n });\n\n // Handle focusable\n const { focusableProps } = createFocusable(\n {\n isDisabled,\n onFocus: () => {\n state.setFocusedKey(key());\n },\n },\n ref,\n );\n\n // Handle keyboard for navigation and removal\n const handleKeyDown = (e: KeyboardEvent) => {\n if (isDisabled()) return;\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n e.preventDefault();\n focusKey(getNextFocusableKey(key()));\n return;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n e.preventDefault();\n focusKey(getPreviousFocusableKey(key()));\n return;\n case \"Home\":\n e.preventDefault();\n focusKey(getFirstFocusableKey());\n return;\n case \"End\":\n e.preventDefault();\n focusKey(getLastFocusableKey());\n return;\n default:\n break;\n }\n\n if (e.key === \"Delete\" || e.key === \"Backspace\") {\n e.preventDefault();\n const data = getData();\n if (data?.onRemove) {\n // Remove selected keys if this tag is selected, otherwise just this tag\n if (isSelected()) {\n const selection = state.selectedKeys();\n const keysToRemove =\n selection === \"all\"\n ? new Set(Array.from(state.collection()).map((item) => (item as { key: Key }).key))\n : new Set(selection);\n data.onRemove(keysToRemove);\n } else {\n data.onRemove(new Set([key()]));\n }\n }\n }\n };\n\n // Compute tabIndex\n const tabIndex = createMemo(() => {\n if (isDisabled()) return -1;\n\n if (isFocused()) {\n return 0;\n }\n\n if (state.focusedKey() !== null) {\n return -1;\n }\n\n const collection = state.collection();\n let defaultTabStop: Key | null = null;\n\n if (state.selectionMode() !== \"none\") {\n for (const item of collection) {\n if (!state.isDisabled(item.key) && state.isSelected(item.key)) {\n defaultTabStop = item.key;\n break;\n }\n }\n }\n\n if (defaultTabStop == null) {\n defaultTabStop = getFirstFocusableKey();\n }\n\n if (key() === defaultTabStop) {\n return 0;\n }\n\n return -1;\n });\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>);\n\n // Check if removal is allowed\n const allowsRemoving = createMemo(() => {\n const data = getData();\n return !!data?.onRemove;\n });\n\n const rootRole = createMemo(() => getProps().role ?? \"option\");\n\n return {\n get rowProps() {\n return mergeProps(\n domProps(),\n focusableProps as Record<string, unknown>,\n pressProps as Record<string, unknown>,\n {\n id: rowId,\n role: rootRole(),\n tabIndex: tabIndex(),\n \"data-key\": String(key()),\n \"aria-label\": getProps().textValue,\n \"aria-selected\": isSelectable() ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n onKeyDown: handleKeyDown,\n },\n );\n },\n get gridCellProps() {\n return {\n id: cellId,\n role: \"gridcell\",\n \"aria-describedby\": allowsRemoving() ? removeButtonId : undefined,\n };\n },\n get removeButtonProps() {\n const data = getData();\n return {\n id: removeButtonId,\n \"aria-label\": \"Remove\",\n \"aria-labelledby\": `${removeButtonId} ${rowId}`,\n isDisabled: isDisabled(),\n onPress: () => {\n if (data?.onRemove && !isDisabled()) {\n data.onRemove(new Set([key()]));\n }\n },\n };\n },\n get allowsRemoving() {\n return allowsRemoving();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isFocused() {\n return isFocused();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmDA,MAAM,+BAAe,IAAI,QAA8B;AAOvD,SAAgB,gBAAgB,OAA4C;CAC1E,OAAO,aAAa,IAAI,KAAK;AAC/B;;;;;;AAOA,SAAgB,eACd,OACA,OACA,MACc;CACd,MAAM,iBAAiB,OAAO,KAAK;CACnC,MAAM,KAAK,SAAS,SAAS,CAAC,CAAC,EAAE;CACjC,MAAM,gBAAgB,SAAS;CAC/B,MAAM,iBAAiB,SAAS;CAChC,MAAM,6BAA6B;EACjC,MAAM,IAAI,SAAS;EACnB,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,iBAAiB,CAAC,EAAE,qBAAqB,aAAa,KAAA;CAC9E;CACA,MAAM,aAA2B;EAC/B;EACA,IAAI,WAAW;GACb,OAAO,SAAS,CAAC,CAAC;EACpB;CACF;CAGA,MAAM,iBACJ,eAAe,SAAS,GAAyC,EAAE,WAAW,KAAK,CAAC;CAGtF,MAAM,EAAE,YAAY,eAAe,YAAY;EAC7C,IAAI,QAAQ;GACV,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,eAAe;GACjB,OAAO,SAAS,CA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