@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,244 @@
|
|
|
1
|
+
import { a as getEventTarget, i as getActiveElement } from "./focus.jsx";
|
|
2
|
+
import { s as getPointerType } from "./createInteractionModality.jsx";
|
|
3
|
+
import { createId, getOwnerDocument } from "../ssr/index.jsx";
|
|
4
|
+
import { n as FOCUS_EVENT, t as CLEAR_FOCUS_EVENT } from "./constants.jsx";
|
|
5
|
+
import { createEffect, createSignal, onCleanup } from "solid-js";
|
|
6
|
+
//#region src/autocomplete/createAutocomplete.ts
|
|
7
|
+
/**
|
|
8
|
+
* createAutocomplete - Accessibility hook for autocomplete components
|
|
9
|
+
*
|
|
10
|
+
* Provides keyboard navigation, virtual focus via aria-activedescendant,
|
|
11
|
+
* and filtering capabilities for autocomplete inputs.
|
|
12
|
+
*
|
|
13
|
+
* Based on @react-aria/autocomplete useAutocomplete.
|
|
14
|
+
*/
|
|
15
|
+
function toKeyboardEventInit(e) {
|
|
16
|
+
return {
|
|
17
|
+
key: e.key,
|
|
18
|
+
code: e.code,
|
|
19
|
+
location: e.location,
|
|
20
|
+
repeat: e.repeat,
|
|
21
|
+
isComposing: e.isComposing,
|
|
22
|
+
ctrlKey: e.ctrlKey,
|
|
23
|
+
shiftKey: e.shiftKey,
|
|
24
|
+
altKey: e.altKey,
|
|
25
|
+
metaKey: e.metaKey,
|
|
26
|
+
bubbles: e.bubbles,
|
|
27
|
+
cancelable: e.cancelable
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** @deprecated Use {@link FOCUS_EVENT} from the selection layer. */
|
|
31
|
+
const AUTOCOMPLETE_FOCUS_EVENT = FOCUS_EVENT;
|
|
32
|
+
/** @deprecated Use {@link CLEAR_FOCUS_EVENT} from the selection layer. */
|
|
33
|
+
const AUTOCOMPLETE_CLEAR_FOCUS_EVENT = CLEAR_FOCUS_EVENT;
|
|
34
|
+
/**
|
|
35
|
+
* Provides the behavior and accessibility implementation for an autocomplete component.
|
|
36
|
+
* An autocomplete combines a text input with a collection, allowing users to filter
|
|
37
|
+
* the collection's contents to match a query.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* const state = createAutocompleteState({ defaultInputValue: '' });
|
|
42
|
+
* let inputRef, collectionRef;
|
|
43
|
+
*
|
|
44
|
+
* const { inputProps, collectionProps, filter } = createAutocomplete({
|
|
45
|
+
* inputRef: () => inputRef,
|
|
46
|
+
* collectionRef: () => collectionRef,
|
|
47
|
+
* filter: (textValue, inputValue) =>
|
|
48
|
+
* textValue.toLowerCase().includes(inputValue.toLowerCase()),
|
|
49
|
+
* }, state);
|
|
50
|
+
*
|
|
51
|
+
* return (
|
|
52
|
+
* <div>
|
|
53
|
+
* <input ref={inputRef} {...inputProps} />
|
|
54
|
+
* <ul ref={collectionRef} {...collectionProps}>
|
|
55
|
+
* {items.filter(item => filter?.(item.name) ?? true).map(item => (
|
|
56
|
+
* <li key={item.id}>{item.name}</li>
|
|
57
|
+
* ))}
|
|
58
|
+
* </ul>
|
|
59
|
+
* </div>
|
|
60
|
+
* );
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
function createAutocomplete(props, state) {
|
|
64
|
+
const { inputRef, collectionRef, filter, collectionId: collectionIdProp, collectionAriaLabel, disableAutoFocusFirst = false, disableVirtualFocus = false } = props;
|
|
65
|
+
const collectionId = collectionIdProp ?? createId();
|
|
66
|
+
const [shouldUseVirtualFocus] = createSignal(!disableVirtualFocus);
|
|
67
|
+
const [autoFocusOnMount, setAutoFocusOnMount] = createSignal(false);
|
|
68
|
+
let lastInputType = "";
|
|
69
|
+
let queuedActiveDescendant = null;
|
|
70
|
+
let delayNextActiveDescendant = false;
|
|
71
|
+
let activeDescendantTimeout;
|
|
72
|
+
const ACTIVE_DESCENDANT_DELAY = 500;
|
|
73
|
+
const handleBeforeInput = (e) => {
|
|
74
|
+
lastInputType = e.inputType || "";
|
|
75
|
+
};
|
|
76
|
+
createEffect(() => {
|
|
77
|
+
const input = inputRef();
|
|
78
|
+
if (input) {
|
|
79
|
+
input.addEventListener("beforeinput", handleBeforeInput);
|
|
80
|
+
onCleanup(() => {
|
|
81
|
+
input.removeEventListener("beforeinput", handleBeforeInput);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const focusFirstItem = () => {
|
|
86
|
+
delayNextActiveDescendant = true;
|
|
87
|
+
const collection = collectionRef();
|
|
88
|
+
if (!collection) {
|
|
89
|
+
setAutoFocusOnMount(true);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
collection.dispatchEvent(new CustomEvent(FOCUS_EVENT, {
|
|
93
|
+
cancelable: true,
|
|
94
|
+
bubbles: true,
|
|
95
|
+
detail: { focusStrategy: "first" }
|
|
96
|
+
}));
|
|
97
|
+
};
|
|
98
|
+
const clearVirtualFocus = (clearFocusKey = false) => {
|
|
99
|
+
setAutoFocusOnMount(false);
|
|
100
|
+
clearTimeout(activeDescendantTimeout);
|
|
101
|
+
queuedActiveDescendant = null;
|
|
102
|
+
delayNextActiveDescendant = false;
|
|
103
|
+
state.setFocusedNodeId(null);
|
|
104
|
+
const collection = collectionRef();
|
|
105
|
+
if (collection) collection.dispatchEvent(new CustomEvent(CLEAR_FOCUS_EVENT, {
|
|
106
|
+
cancelable: true,
|
|
107
|
+
bubbles: true,
|
|
108
|
+
detail: { clearFocusKey }
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
111
|
+
const onChange = (value) => {
|
|
112
|
+
if ((lastInputType === "insertText" || lastInputType === "insertCompositionText" || lastInputType === "insertFromComposition") && !disableAutoFocusFirst) focusFirstItem();
|
|
113
|
+
else if (lastInputType && (lastInputType.includes("insert") || lastInputType.includes("delete") || lastInputType.includes("history"))) clearVirtualFocus(true);
|
|
114
|
+
state.setInputValue(value);
|
|
115
|
+
};
|
|
116
|
+
const onKeyDown = (e) => {
|
|
117
|
+
if ("isComposing" in e && e.isComposing) return;
|
|
118
|
+
const focusedNodeId = queuedActiveDescendant;
|
|
119
|
+
const collection = collectionRef();
|
|
120
|
+
const ownerDocument = getOwnerDocument(inputRef() ?? collection);
|
|
121
|
+
switch (e.key) {
|
|
122
|
+
case "Escape":
|
|
123
|
+
if (e.defaultPrevented) return;
|
|
124
|
+
break;
|
|
125
|
+
case " ": return;
|
|
126
|
+
case "Tab": return;
|
|
127
|
+
case "ArrowUp":
|
|
128
|
+
case "ArrowDown":
|
|
129
|
+
case "Home":
|
|
130
|
+
case "End":
|
|
131
|
+
case "PageUp":
|
|
132
|
+
case "PageDown":
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
if (collection) collection.dispatchEvent(new CustomEvent(FOCUS_EVENT, {
|
|
135
|
+
cancelable: true,
|
|
136
|
+
bubbles: true
|
|
137
|
+
}));
|
|
138
|
+
break;
|
|
139
|
+
case "ArrowLeft":
|
|
140
|
+
case "ArrowRight":
|
|
141
|
+
if (!focusedNodeId) {
|
|
142
|
+
e.stopPropagation();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
case "Enter":
|
|
147
|
+
if (focusedNodeId) {
|
|
148
|
+
const item = ownerDocument?.getElementById(focusedNodeId);
|
|
149
|
+
if (item) {
|
|
150
|
+
item.click();
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (collection) {
|
|
157
|
+
e.stopPropagation();
|
|
158
|
+
let shouldPerformDefaultAction = true;
|
|
159
|
+
if (focusedNodeId) {
|
|
160
|
+
const item = ownerDocument?.getElementById(focusedNodeId);
|
|
161
|
+
if (item) shouldPerformDefaultAction = item.dispatchEvent(new KeyboardEvent(e.type, toKeyboardEventInit(e)));
|
|
162
|
+
} else shouldPerformDefaultAction = collection.dispatchEvent(new KeyboardEvent(e.type, toKeyboardEventInit(e)));
|
|
163
|
+
if (shouldPerformDefaultAction && (e.key === "ArrowLeft" || e.key === "ArrowRight")) clearVirtualFocus();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const onFocus = (e) => {
|
|
167
|
+
if (!e.isTrusted) return;
|
|
168
|
+
const focusedNodeId = state.focusedNodeId();
|
|
169
|
+
if (focusedNodeId) {
|
|
170
|
+
if (document.getElementById(focusedNodeId)) {}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const onBlur = (e) => {
|
|
174
|
+
if (!e.isTrusted) return;
|
|
175
|
+
};
|
|
176
|
+
const updateActiveDescendant = (e) => {
|
|
177
|
+
const input = inputRef();
|
|
178
|
+
if (!e.isTrusted && shouldUseVirtualFocus() && input && getActiveElement(getOwnerDocument(input)) !== input && getPointerType() !== "touch") input.focus();
|
|
179
|
+
const target = getEventTarget(e);
|
|
180
|
+
if (e.isTrusted || !target || queuedActiveDescendant === target.id) return;
|
|
181
|
+
const collection = collectionRef();
|
|
182
|
+
clearTimeout(activeDescendantTimeout);
|
|
183
|
+
if (target !== collection) {
|
|
184
|
+
const targetId = target.id;
|
|
185
|
+
if (delayNextActiveDescendant) {
|
|
186
|
+
queuedActiveDescendant = targetId;
|
|
187
|
+
activeDescendantTimeout = setTimeout(() => {
|
|
188
|
+
state.setFocusedNodeId(targetId);
|
|
189
|
+
}, ACTIVE_DESCENDANT_DELAY);
|
|
190
|
+
} else {
|
|
191
|
+
queuedActiveDescendant = targetId;
|
|
192
|
+
state.setFocusedNodeId(targetId);
|
|
193
|
+
}
|
|
194
|
+
} else if (queuedActiveDescendant && !getOwnerDocument(collection)?.getElementById(queuedActiveDescendant)) {
|
|
195
|
+
queuedActiveDescendant = null;
|
|
196
|
+
state.setFocusedNodeId(null);
|
|
197
|
+
}
|
|
198
|
+
delayNextActiveDescendant = false;
|
|
199
|
+
};
|
|
200
|
+
createEffect(() => {
|
|
201
|
+
if (!shouldUseVirtualFocus()) return;
|
|
202
|
+
const collection = collectionRef();
|
|
203
|
+
if (collection) {
|
|
204
|
+
collection.addEventListener("focusin", updateActiveDescendant);
|
|
205
|
+
onCleanup(() => {
|
|
206
|
+
collection.removeEventListener("focusin", updateActiveDescendant);
|
|
207
|
+
clearTimeout(activeDescendantTimeout);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
const filterFn = filter ? (nodeTextValue, node) => filter(nodeTextValue, state.inputValue(), node) : void 0;
|
|
212
|
+
return {
|
|
213
|
+
inputProps: {
|
|
214
|
+
value: state.inputValue,
|
|
215
|
+
onChange,
|
|
216
|
+
onKeyDown,
|
|
217
|
+
onFocus,
|
|
218
|
+
onBlur,
|
|
219
|
+
get "aria-activedescendant"() {
|
|
220
|
+
return () => shouldUseVirtualFocus() ? state.focusedNodeId() ?? void 0 : void 0;
|
|
221
|
+
},
|
|
222
|
+
"aria-controls": collectionId,
|
|
223
|
+
"aria-autocomplete": "list",
|
|
224
|
+
enterKeyHint: "go",
|
|
225
|
+
autoCorrect: "off",
|
|
226
|
+
spellCheck: "false",
|
|
227
|
+
autoComplete: "off"
|
|
228
|
+
},
|
|
229
|
+
collectionProps: {
|
|
230
|
+
id: collectionId,
|
|
231
|
+
"aria-label": collectionAriaLabel,
|
|
232
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus(),
|
|
233
|
+
disallowTypeAhead: shouldUseVirtualFocus(),
|
|
234
|
+
get autoFocus() {
|
|
235
|
+
return autoFocusOnMount() ? "first" : false;
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
filter: filterFn
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
export { AUTOCOMPLETE_FOCUS_EVENT as n, createAutocomplete as r, AUTOCOMPLETE_CLEAR_FOCUS_EVENT as t };
|
|
243
|
+
|
|
244
|
+
//# sourceMappingURL=autocomplete.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.jsx","names":["inputEvent"],"sources":["../../src/autocomplete/createAutocomplete.ts"],"sourcesContent":["/**\n * createAutocomplete - Accessibility hook for autocomplete components\n *\n * Provides keyboard navigation, virtual focus via aria-activedescendant,\n * and filtering capabilities for autocomplete inputs.\n *\n * Based on @react-aria/autocomplete useAutocomplete.\n */\n\nimport { createSignal, createEffect, onCleanup, type Accessor } from \"solid-js\";\nimport { createId, getOwnerDocument } from \"../ssr\";\nimport { type AutocompleteState, type CollectionNode } from \"@proyecto-viviana/solid-stately\";\nimport { FOCUS_EVENT, CLEAR_FOCUS_EVENT } from \"../selection/constants\";\nimport { getActiveElement, getEventTarget } from \"../utils/dom\";\nimport { getPointerType } from \"../interactions\";\n\nexport interface CollectionOptions {\n /** The id of the collection element. */\n id?: string;\n /** Accessible label for the collection. */\n \"aria-label\"?: string;\n /** Whether the collection items should use virtual focus instead of being focused directly. */\n shouldUseVirtualFocus: boolean;\n /** Whether typeahead is disabled. */\n disallowTypeAhead: boolean;\n /** Whether and where to focus an item when the collection mounts. */\n autoFocus?: boolean | \"first\" | \"last\";\n}\n\nexport interface AutocompleteInputProps {\n /** Current input value. */\n value: Accessor<string>;\n /** Handler for input value changes. */\n onChange: (value: string) => void;\n /** Handler for key events. */\n onKeyDown: (e: KeyboardEvent) => void;\n /** Handler for focus events. */\n onFocus: (e: FocusEvent) => void;\n /** Handler for blur events. */\n onBlur: (e: FocusEvent) => void;\n /** The id of the currently focused item for aria-activedescendant. */\n \"aria-activedescendant\": Accessor<string | undefined>;\n /** The id of the controlled collection. */\n \"aria-controls\": string;\n /** Autocomplete type. */\n \"aria-autocomplete\": \"list\" | \"none\" | \"inline\" | \"both\";\n /** Enter key hint for mobile keyboards. */\n enterKeyHint: \"go\";\n /** Disable autocorrect. */\n autoCorrect: \"off\";\n /** Disable spell check. */\n spellCheck: \"false\";\n /** Disable browser autocomplete. */\n autoComplete: \"off\";\n}\n\nexport interface AriaAutocompleteOptions<T = unknown> {\n /** Ref accessor for the input element. */\n inputRef: Accessor<HTMLInputElement | undefined>;\n /** Ref accessor for the collection element. */\n collectionRef: Accessor<HTMLElement | undefined>;\n /** Optional id override for the controlled collection element. */\n collectionId?: string;\n /** Optional accessible name for the controlled collection element. */\n collectionAriaLabel?: string;\n /**\n * An optional filter function used to determine if an option should be included.\n * @param textValue - The text value of the item\n * @param inputValue - The current input value\n * @param node - The collection node being filtered\n */\n filter?: (textValue: string, inputValue: string, node: CollectionNode<T>) => boolean;\n /**\n * Whether to focus the first item after filtering.\n * @default false\n */\n disableAutoFocusFirst?: boolean;\n /**\n * Whether to disable virtual focus (aria-activedescendant).\n * @default false\n */\n disableVirtualFocus?: boolean;\n}\n\nexport interface AutocompleteAria<T = unknown> {\n /** Props for the autocomplete input element. */\n inputProps: AutocompleteInputProps;\n /** Props for the collection (ListBox/Menu). */\n collectionProps: CollectionOptions;\n /** A filter function that returns if the item should be shown. */\n filter?: (nodeTextValue: string, node: CollectionNode<T>) => boolean;\n}\n\nfunction toKeyboardEventInit(e: KeyboardEvent): KeyboardEventInit {\n return {\n key: e.key,\n code: e.code,\n location: e.location,\n repeat: e.repeat,\n isComposing: e.isComposing,\n ctrlKey: e.ctrlKey,\n shiftKey: e.shiftKey,\n altKey: e.altKey,\n metaKey: e.metaKey,\n bubbles: e.bubbles,\n cancelable: e.cancelable,\n };\n}\n\n// Custom event names for collection communication.\n// These are the shared @react-aria/selection constants the collection's\n// createSelectableCollection listens for (FOCUS_EVENT / CLEAR_FOCUS_EVENT);\n// the aliases below are retained for backwards-compatible re-exports.\n/** @deprecated Use {@link FOCUS_EVENT} from the selection layer. */\nexport const AUTOCOMPLETE_FOCUS_EVENT = FOCUS_EVENT;\n/** @deprecated Use {@link CLEAR_FOCUS_EVENT} from the selection layer. */\nexport const AUTOCOMPLETE_CLEAR_FOCUS_EVENT = CLEAR_FOCUS_EVENT;\n\n/**\n * Provides the behavior and accessibility implementation for an autocomplete component.\n * An autocomplete combines a text input with a collection, allowing users to filter\n * the collection's contents to match a query.\n *\n * @example\n * ```tsx\n * const state = createAutocompleteState({ defaultInputValue: '' });\n * let inputRef, collectionRef;\n *\n * const { inputProps, collectionProps, filter } = createAutocomplete({\n * inputRef: () => inputRef,\n * collectionRef: () => collectionRef,\n * filter: (textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase()),\n * }, state);\n *\n * return (\n * <div>\n * <input ref={inputRef} {...inputProps} />\n * <ul ref={collectionRef} {...collectionProps}>\n * {items.filter(item => filter?.(item.name) ?? true).map(item => (\n * <li key={item.id}>{item.name}</li>\n * ))}\n * </ul>\n * </div>\n * );\n * ```\n */\nexport function createAutocomplete<T = unknown>(\n props: AriaAutocompleteOptions<T>,\n state: AutocompleteState,\n): AutocompleteAria<T> {\n const {\n inputRef,\n collectionRef,\n filter,\n collectionId: collectionIdProp,\n collectionAriaLabel,\n disableAutoFocusFirst = false,\n disableVirtualFocus = false,\n } = props;\n\n const collectionId = collectionIdProp ?? createId();\n const [shouldUseVirtualFocus] = createSignal(!disableVirtualFocus);\n // When the first item should be focused but the collection hasn't mounted yet,\n // defer it by threading autoFocus through collectionProps so the collection\n // focuses on mount (mirrors upstream's autoFocusOnMount state).\n const [autoFocusOnMount, setAutoFocusOnMount] = createSignal(false);\n let lastInputType = \"\";\n\n // Reverse-focus (collection → input aria-activedescendant) bookkeeping, mirroring\n // useAutocomplete's queuedActiveDescendant / delayNextActiveDescendant / timeout\n // refs. `queuedActiveDescendant` is the id of the option the collection has\n // virtually focused — tracked synchronously on every collection `focusin`, even\n // while the visible aria-activedescendant reflection is deferred, so key\n // navigation always dispatches to the right item. When typing forward,\n // `delayNextActiveDescendant` defers the next reflection behind a 500ms timeout so\n // a screen reader finishes announcing the just-typed letter before naming the\n // active option; every new focusin (and teardown) clears the pending timeout.\n let queuedActiveDescendant: string | null = null;\n let delayNextActiveDescendant = false;\n let activeDescendantTimeout: ReturnType<typeof setTimeout> | undefined;\n const ACTIVE_DESCENDANT_DELAY = 500;\n\n // Track the input type for determining focus behavior. We listen to\n // `beforeinput` (not `input`) so `lastInputType` is set before the input's\n // `onChange` runs, mirroring @react-aria/autocomplete.\n const handleBeforeInput = (e: Event) => {\n const inputEvent = e as InputEvent;\n lastInputType = inputEvent.inputType || \"\";\n };\n\n // Set up beforeinput event listener\n createEffect(() => {\n const input = inputRef();\n if (input) {\n input.addEventListener(\"beforeinput\", handleBeforeInput);\n onCleanup(() => {\n input.removeEventListener(\"beforeinput\", handleBeforeInput);\n });\n }\n });\n\n // Focus first item in collection\n const focusFirstItem = () => {\n // Typing forward focuses the first filtered row, but the resulting\n // aria-activedescendant reflection must wait so the SR announces the typed\n // letter first (see updateActiveDescendant). Mirrors useAutocomplete\n // setting delayNextActiveDescendant.current = true before the focus event.\n delayNextActiveDescendant = true;\n const collection = collectionRef();\n if (!collection) {\n // Collection isn't mounted yet — defer focusing the first item to mount\n // time via collectionProps.autoFocus instead of firing a focus event into\n // a not-yet-rendered collection.\n setAutoFocusOnMount(true);\n return;\n }\n collection.dispatchEvent(\n new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: { focusStrategy: \"first\" },\n }),\n );\n };\n\n // Clear virtual focus\n const clearVirtualFocus = (clearFocusKey = false) => {\n setAutoFocusOnMount(false);\n // Drop any pending delayed reflection and the tracked item alongside the\n // active descendant so a subsequent focusin can't resurrect a stale id\n // (mirrors useAutocomplete clearing queuedActiveDescendant / the timeout /\n // delayNextActiveDescendant in clearVirtualFocus).\n clearTimeout(activeDescendantTimeout);\n queuedActiveDescendant = null;\n delayNextActiveDescendant = false;\n state.setFocusedNodeId(null);\n const collection = collectionRef();\n if (collection) {\n collection.dispatchEvent(\n new CustomEvent(CLEAR_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: { clearFocusKey },\n }),\n );\n }\n };\n\n // Handle input value changes\n const onChange = (value: string) => {\n // Focus first item when typing forward, clear when backspacing/pasting.\n // IME composition (e.g. CJK input) reports 'insertCompositionText'/\n // 'insertFromComposition' instead of 'insertText'; treat those as forward\n // typing so the first item still gets virtual focus.\n if (\n (lastInputType === \"insertText\" ||\n lastInputType === \"insertCompositionText\" ||\n lastInputType === \"insertFromComposition\") &&\n !disableAutoFocusFirst\n ) {\n focusFirstItem();\n } else if (\n lastInputType &&\n (lastInputType.includes(\"insert\") ||\n lastInputType.includes(\"delete\") ||\n lastInputType.includes(\"history\"))\n ) {\n clearVirtualFocus(true);\n }\n\n state.setInputValue(value);\n };\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n if (\"isComposing\" in e && e.isComposing) {\n return;\n }\n\n // Navigate against the id the collection has virtually focused, tracked\n // synchronously on every focusin, NOT the (possibly still-delayed)\n // aria-activedescendant reflection in state — mirrors useAutocomplete\n // reading queuedActiveDescendant.current here. Reading state.focusedNodeId()\n // would be null during the post-type reflection delay, so arrows would\n // re-focus the first row instead of advancing.\n const focusedNodeId = queuedActiveDescendant;\n const collection = collectionRef();\n const ownerDocument = getOwnerDocument(inputRef() ?? collection);\n\n switch (e.key) {\n case \"Escape\":\n // Let the input handle Escape (e.g., clear value)\n if (e.defaultPrevented) {\n return;\n }\n break;\n\n case \" \":\n // Space shouldn't trigger item action\n return;\n\n case \"Tab\":\n // Let Tab propagate normally for focus management\n return;\n\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"Home\":\n case \"End\":\n case \"PageUp\":\n case \"PageDown\": {\n // Prevent cursor movement in input\n e.preventDefault();\n\n // Dispatch focus event to collection\n if (collection) {\n collection.dispatchEvent(\n new CustomEvent(FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n }),\n );\n }\n break;\n }\n\n case \"ArrowLeft\":\n case \"ArrowRight\":\n // With no virtual focus, just let the arrow move the text cursor; stop\n // propagation so it doesn't leak into the collection. With virtual focus,\n // fall through to dispatch the key to the focused item below, then clear\n // the active descendant only after the item has seen it.\n if (!focusedNodeId) {\n e.stopPropagation();\n return;\n }\n break;\n\n case \"Enter\":\n // Trigger click on focused item\n if (focusedNodeId) {\n const item = ownerDocument?.getElementById(focusedNodeId);\n if (item) {\n item.click();\n e.preventDefault();\n }\n }\n return;\n }\n\n // Forward keyboard events to the focused item (or the collection when there\n // is no virtual focus) so the collection can act on them, e.g. onAction.\n // Gated only on the collection existing — NOT on e.defaultPrevented: arrows\n // call preventDefault above to stop the input's text cursor moving, but the\n // key must still be re-dispatched to the row so navigation advances (mirrors\n // useAutocomplete forwarding whenever collectionRef.current !== null).\n if (collection) {\n e.stopPropagation();\n\n let shouldPerformDefaultAction = true;\n if (focusedNodeId) {\n const item = ownerDocument?.getElementById(focusedNodeId);\n if (item) {\n shouldPerformDefaultAction = item.dispatchEvent(\n new KeyboardEvent(e.type, toKeyboardEventInit(e)),\n );\n }\n } else {\n shouldPerformDefaultAction = collection.dispatchEvent(\n new KeyboardEvent(e.type, toKeyboardEventInit(e)),\n );\n }\n\n // After the focused item has seen ArrowLeft/ArrowRight, clear the active\n // descendant so SR announcements aren't interrupted, but retain the\n // collection's focused key so navigation restarts where it left off. If\n // the item consumed the key (e.g. an expandable row collapsing), it\n // cancels the event and we keep virtual focus.\n if (shouldPerformDefaultAction && (e.key === \"ArrowLeft\" || e.key === \"ArrowRight\")) {\n clearVirtualFocus();\n }\n }\n };\n\n // Handle focus events\n const onFocus = (e: FocusEvent) => {\n if (!e.isTrusted) return;\n\n // Restore virtual focus when refocusing input\n const focusedNodeId = state.focusedNodeId();\n if (focusedNodeId) {\n const item = document.getElementById(focusedNodeId);\n if (item) {\n // Item still exists, keep focus on it\n }\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n if (!e.isTrusted) return;\n // Virtual focus blur handling would go here\n };\n\n // Reverse path: mirror the collection's virtually-focused option into the\n // input's aria-activedescendant. The collection dispatches a synthetic,\n // bubbling `focusin` (via moveVirtualFocus) on its focused option; we read the\n // target id, track it in `queuedActiveDescendant` synchronously (so key nav\n // always dispatches to the right item), and reflect it into AutocompleteState\n // — immediately, or, when `delayNextActiveDescendant` was set by forward\n // typing, behind a 500ms timeout so the SR finishes announcing the typed\n // letter before naming the active option. Faithful port of useAutocomplete's\n // updateActiveDescendantEvent.\n const updateActiveDescendant = (e: Event) => {\n const input = inputRef();\n // If the user clicks/taps an option directly (non-touch), pull real focus\n // back to the input so typing keeps working.\n if (\n !e.isTrusted &&\n shouldUseVirtualFocus() &&\n input &&\n getActiveElement(getOwnerDocument(input)) !== input &&\n getPointerType() !== \"touch\"\n ) {\n input.focus();\n }\n\n const target = getEventTarget<Element>(e);\n if (e.isTrusted || !target || queuedActiveDescendant === target.id) {\n return;\n }\n\n const collection = collectionRef();\n // A new focusin supersedes any pending delayed reflection.\n clearTimeout(activeDescendantTimeout);\n if (target !== collection) {\n const targetId = target.id;\n if (delayNextActiveDescendant) {\n // Forward typing just focused the first row: track it now, but defer the\n // aria-activedescendant reflection so the just-typed letter is announced\n // before the active option.\n queuedActiveDescendant = targetId;\n activeDescendantTimeout = setTimeout(() => {\n state.setFocusedNodeId(targetId);\n }, ACTIVE_DESCENDANT_DELAY);\n } else {\n queuedActiveDescendant = targetId;\n state.setFocusedNodeId(targetId);\n }\n } else if (\n queuedActiveDescendant &&\n !getOwnerDocument(collection)?.getElementById(queuedActiveDescendant)\n ) {\n // Refocus of the collection itself while the previously focused node no\n // longer exists (filtered away, or the input was refocused): clear the\n // tracked item and the active descendant.\n queuedActiveDescendant = null;\n state.setFocusedNodeId(null);\n }\n // Reflection delay is a one-shot; the next focusin reflects immediately\n // unless forward typing sets the flag again.\n delayNextActiveDescendant = false;\n };\n\n createEffect(() => {\n if (!shouldUseVirtualFocus()) return;\n const collection = collectionRef();\n if (collection) {\n collection.addEventListener(\"focusin\", updateActiveDescendant);\n onCleanup(() => {\n collection.removeEventListener(\"focusin\", updateActiveDescendant);\n clearTimeout(activeDescendantTimeout);\n });\n }\n });\n\n // Create filter function. The user's 3-arg predicate (textValue, inputValue,\n // node) is closed over the current input value and exposed to the collection\n // as the 2-arg (nodeTextValue, node) shape that UNSTABLE_useFilteredListState\n // (createFilteredListState) expects.\n const filterFn = filter\n ? (nodeTextValue: string, node: CollectionNode<T>) =>\n filter(nodeTextValue, state.inputValue(), node)\n : undefined;\n\n return {\n inputProps: {\n value: state.inputValue,\n onChange,\n onKeyDown,\n onFocus,\n onBlur,\n get \"aria-activedescendant\"() {\n return () => (shouldUseVirtualFocus() ? (state.focusedNodeId() ?? undefined) : undefined);\n },\n \"aria-controls\": collectionId,\n \"aria-autocomplete\": \"list\",\n enterKeyHint: \"go\",\n autoCorrect: \"off\",\n spellCheck: \"false\",\n autoComplete: \"off\",\n },\n collectionProps: {\n id: collectionId,\n \"aria-label\": collectionAriaLabel,\n shouldUseVirtualFocus: shouldUseVirtualFocus(),\n disallowTypeAhead: shouldUseVirtualFocus(),\n get autoFocus() {\n return autoFocusOnMount() ? \"first\" : false;\n },\n },\n filter: filterFn,\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { i as mergeProps } from "./env.js";
|
|
2
|
+
import { t as filterDOMProps } from "./filterDOMProps.js";
|
|
3
|
+
import { t as access } from "./reactivity.js";
|
|
4
|
+
import { t as createLink } from "./link.js";
|
|
5
|
+
//#region src/breadcrumbs/createBreadcrumbs.ts
|
|
6
|
+
/**
|
|
7
|
+
* Breadcrumbs hooks for Solidaria
|
|
8
|
+
*
|
|
9
|
+
* Provides accessibility implementation for breadcrumb navigation.
|
|
10
|
+
* Port of @react-aria/breadcrumbs.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Provides accessibility implementation for the breadcrumbs navigation container.
|
|
14
|
+
*/
|
|
15
|
+
function createBreadcrumbs(props = {}) {
|
|
16
|
+
const getProps = () => access(props);
|
|
17
|
+
const getNavProps = () => {
|
|
18
|
+
const p = getProps();
|
|
19
|
+
const ariaLabel = p["aria-label"] ?? (p["aria-labelledby"] ? void 0 : "Breadcrumbs");
|
|
20
|
+
return mergeProps(filterDOMProps(p, { labelable: true }), {
|
|
21
|
+
"aria-label": ariaLabel,
|
|
22
|
+
"aria-details": p["aria-details"]
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return { get navProps() {
|
|
26
|
+
return getNavProps();
|
|
27
|
+
} };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Provides accessibility implementation for an individual breadcrumb item.
|
|
31
|
+
*/
|
|
32
|
+
function createBreadcrumbItem(props = {}) {
|
|
33
|
+
const getProps = () => access(props);
|
|
34
|
+
const isCurrent = () => getProps().isCurrent ?? false;
|
|
35
|
+
const isDisabled = () => getProps().isDisabled ?? false;
|
|
36
|
+
const elementType = () => getProps().elementType ?? "a";
|
|
37
|
+
const linkAria = createLink({
|
|
38
|
+
get isDisabled() {
|
|
39
|
+
return isDisabled() || isCurrent();
|
|
40
|
+
},
|
|
41
|
+
get elementType() {
|
|
42
|
+
return elementType();
|
|
43
|
+
},
|
|
44
|
+
get href() {
|
|
45
|
+
return isCurrent() ? void 0 : getProps().href;
|
|
46
|
+
},
|
|
47
|
+
get target() {
|
|
48
|
+
return getProps().target;
|
|
49
|
+
},
|
|
50
|
+
get rel() {
|
|
51
|
+
return getProps().rel;
|
|
52
|
+
},
|
|
53
|
+
get onPress() {
|
|
54
|
+
return getProps().onPress;
|
|
55
|
+
},
|
|
56
|
+
get onPressStart() {
|
|
57
|
+
return getProps().onPressStart;
|
|
58
|
+
},
|
|
59
|
+
get onPressEnd() {
|
|
60
|
+
return getProps().onPressEnd;
|
|
61
|
+
},
|
|
62
|
+
get onClick() {
|
|
63
|
+
return getProps().onClick;
|
|
64
|
+
},
|
|
65
|
+
get onFocus() {
|
|
66
|
+
return getProps().onFocus;
|
|
67
|
+
},
|
|
68
|
+
get onBlur() {
|
|
69
|
+
return getProps().onBlur;
|
|
70
|
+
},
|
|
71
|
+
get onFocusChange() {
|
|
72
|
+
return getProps().onFocusChange;
|
|
73
|
+
},
|
|
74
|
+
get onKeyDown() {
|
|
75
|
+
return getProps().onKeyDown;
|
|
76
|
+
},
|
|
77
|
+
get onKeyUp() {
|
|
78
|
+
return getProps().onKeyUp;
|
|
79
|
+
},
|
|
80
|
+
get autoFocus() {
|
|
81
|
+
return getProps().autoFocus;
|
|
82
|
+
},
|
|
83
|
+
get "aria-label"() {
|
|
84
|
+
return getProps()["aria-label"];
|
|
85
|
+
},
|
|
86
|
+
get "aria-labelledby"() {
|
|
87
|
+
return getProps()["aria-labelledby"];
|
|
88
|
+
},
|
|
89
|
+
get "aria-describedby"() {
|
|
90
|
+
return getProps()["aria-describedby"];
|
|
91
|
+
},
|
|
92
|
+
get "aria-details"() {
|
|
93
|
+
return getProps()["aria-details"];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const getItemProps = () => {
|
|
97
|
+
const p = getProps();
|
|
98
|
+
const current = isCurrent();
|
|
99
|
+
const linkProps = linkAria.linkProps;
|
|
100
|
+
let baseProps = p.id ? mergeProps(linkProps, { id: p.id }) : linkProps;
|
|
101
|
+
if (current) {
|
|
102
|
+
const ariaCurrent = p["aria-current"] ?? "page";
|
|
103
|
+
baseProps = mergeProps(baseProps, { "aria-current": ariaCurrent });
|
|
104
|
+
}
|
|
105
|
+
if (isDisabled()) baseProps = mergeProps(baseProps, { "aria-disabled": true });
|
|
106
|
+
return baseProps;
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
get itemProps() {
|
|
110
|
+
return getItemProps();
|
|
111
|
+
},
|
|
112
|
+
get linkProps() {
|
|
113
|
+
return linkAria.linkProps;
|
|
114
|
+
},
|
|
115
|
+
isPressed: linkAria.isPressed
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { createBreadcrumbs as n, createBreadcrumbItem as t };
|
|
120
|
+
|
|
121
|
+
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","names":[],"sources":["../../src/breadcrumbs/createBreadcrumbs.ts"],"sourcesContent":["/**\n * Breadcrumbs hooks for Solidaria\n *\n * Provides accessibility implementation for breadcrumb navigation.\n * Port of @react-aria/breadcrumbs.\n */\n\nimport { createLink, type AriaLinkProps, type LinkAria } from \"../link\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface AriaBreadcrumbsProps {\n /** Provides a label for the breadcrumbs navigation. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the breadcrumbs. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the breadcrumbs. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide a detailed description. */\n \"aria-details\"?: string;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n}\n\nexport interface BreadcrumbsAria {\n /** Props for the breadcrumbs nav element. */\n navProps: Record<string, unknown>;\n}\n\nexport interface AriaBreadcrumbItemProps extends Omit<AriaLinkProps, \"aria-current\"> {\n /** The DOM id for the breadcrumb item. */\n id?: string;\n /** Whether this is the current/last item in the breadcrumb trail. */\n isCurrent?: boolean;\n /** The type of current location for aria-current. @default 'page' */\n \"aria-current\"?: \"page\" | \"step\" | \"location\" | \"date\" | \"time\" | boolean;\n /** The HTML element type. @default 'a' */\n elementType?: string;\n}\n\nexport interface BreadcrumbItemAria extends LinkAria {\n /** Props for the breadcrumb item element. */\n itemProps: Record<string, unknown>;\n}\n\n/**\n * Provides accessibility implementation for the breadcrumbs navigation container.\n */\nexport function createBreadcrumbs(\n props: MaybeAccessor<AriaBreadcrumbsProps> = {},\n): BreadcrumbsAria {\n const getProps = () => access(props);\n\n const getNavProps = (): Record<string, unknown> => {\n const p = getProps();\n\n // Only apply a default label when no other label source exists.\n const ariaLabel = p[\"aria-label\"] ?? (p[\"aria-labelledby\"] ? undefined : \"Breadcrumbs\");\n\n return mergeProps(filterDOMProps(p as Record<string, unknown>, { labelable: true }), {\n \"aria-label\": ariaLabel,\n \"aria-details\": p[\"aria-details\"],\n });\n };\n\n return {\n get navProps() {\n return getNavProps();\n },\n };\n}\n\n/**\n * Provides accessibility implementation for an individual breadcrumb item.\n */\nexport function createBreadcrumbItem(\n props: MaybeAccessor<AriaBreadcrumbItemProps> = {},\n): BreadcrumbItemAria {\n const getProps = () => access(props);\n\n const isCurrent = () => getProps().isCurrent ?? false;\n const isDisabled = () => getProps().isDisabled ?? false;\n const elementType = () => getProps().elementType ?? \"a\";\n\n // Use createLink for base link behavior\n // Current items are treated as disabled (can't navigate to current page).\n // Keep the whole return value (do NOT destructure linkProps): `linkProps` is a\n // reactive getter, and destructuring it here would snapshot getLinkProps() once\n // at mount — freezing role/tabIndex to whatever elementType was during the\n // transient first render (e.g. before isCurrent settles). Reading\n // linkAria.linkProps fresh inside getItemProps keeps it live, mirroring React\n // re-running useLink every render.\n const linkAria = createLink({\n get isDisabled() {\n return isDisabled() || isCurrent();\n },\n get elementType() {\n return elementType();\n },\n get href() {\n return isCurrent() ? undefined : getProps().href;\n },\n get target() {\n return getProps().target;\n },\n get rel() {\n return getProps().rel;\n },\n get onPress() {\n return getProps().onPress;\n },\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onClick() {\n return getProps().onClick;\n },\n get onFocus() {\n return getProps().onFocus;\n },\n get onBlur() {\n return getProps().onBlur;\n },\n get onFocusChange() {\n return getProps().onFocusChange;\n },\n get onKeyDown() {\n return getProps().onKeyDown;\n },\n get onKeyUp() {\n return getProps().onKeyUp;\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return getProps()[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return getProps()[\"aria-details\"];\n },\n });\n\n const getItemProps = (): Record<string, unknown> => {\n const p = getProps();\n const current = isCurrent();\n // Read fresh each call so elementType-driven role/tabIndex stay reactive.\n const linkProps = linkAria.linkProps;\n\n // Start with link props, forwarding id if provided\n let baseProps: Record<string, unknown> = p.id ? mergeProps(linkProps, { id: p.id }) : linkProps;\n\n // Add aria-current for current page\n if (current) {\n const ariaCurrent = p[\"aria-current\"] ?? \"page\";\n baseProps = mergeProps(baseProps, {\n \"aria-current\": ariaCurrent,\n });\n }\n\n // Add aria-disabled for disabled items\n if (isDisabled()) {\n baseProps = mergeProps(baseProps, {\n \"aria-disabled\": true,\n });\n }\n\n return baseProps;\n };\n\n return {\n get itemProps() {\n return getItemProps();\n },\n get linkProps() {\n return linkAria.linkProps;\n },\n isPressed: linkAria.isPressed,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAiDA,SAAgB,kBACd,QAA6C,CAAC,GAC7B;CACjB,MAAM,iBAAiB,OAAO,KAAK;CAEnC,MAAM,oBAA6C;EACjD,MAAM,IAAI,SAAS;EAGnB,MAAM,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,KAAA,IAAY;EAEzE,OAAO,WAAW,eAAe,GAA8B,EAAE,WAAW,KAAK,CAAC,GAAG;GACnF,cAAc;GACd,gBAAgB,EAAE;EACpB,CAAC;CACH;CAEA,OAAO,EACL,IAAI,WAAW;EACb,OAAO,YAAY;CACrB,EACF;AACF;;;;AAKA,SAAgB,qBACd,QAAgD,CAAC,GAC7B;CACpB,MAAM,iBAAiB,OAAO,KAAK;CAEnC,MAAM,kBAAkB,SAAS,CAAC,CAAC,aAAa;CAChD,MAAM,mBAAmB,SAAS,CAAC,CAAC,cAAc;CAClD,MAAM,oBAAoB,SAAS,CAAC,CAAC,eAAe;CAUpD,MAAM,WAAW,WAAW;EAC1B,IAAI,aAAa;GACf,OAAO,WAAW,KAAK,UAAU;EACnC;EACA,IAAI,cAAc;GAChB,OAAO,YAAY;EACrB;EACA,IAAI,OAAO;GACT,OAAO,UAAU,IAAI,KAAA,IAAY,SAAS,CAAC,CAAC;EAC9C;EACA,IAAI,SAAS;GACX,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,MAAM;GACR,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,UAAU;GACZ,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,eAAe;GACjB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,aAAa;GACf,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,UAAU;GACZ,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,UAAU;GACZ,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,SAAS;GACX,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,gBAAgB;GAClB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,YAAY;GACd,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,UAAU;GACZ,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,YAAY;GACd,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,eAAe;GACjB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,oBAAoB;GACtB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,qBAAqB;GACvB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,iBAAiB;GACnB,OAAO,SAAS,CAAC,CAAC;EACpB;CACF,CAAC;CAED,MAAM,qBAA8C;EAClD,MAAM,IAAI,SAAS;EACnB,MAAM,UAAU,UAAU;EAE1B,MAAM,YAAY,SAAS;EAG3B,IAAI,YAAqC,EAAE,KAAK,WAAW,WAAW,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI;EAGtF,IAAI,SAAS;GACX,MAAM,cAAc,EAAE,mBAAmB;GACzC,YAAY,WAAW,WAAW,EAChC,gBAAgB,YAClB,CAAC;EACH;EAGA,IAAI,WAAW,GACb,YAAY,WAAW,WAAW,EAChC,iBAAiB,KACnB,CAAC;EAGH,OAAO;CACT;CAEA,OAAO;EACL,IAAI,YAAY;GACd,OAAO,aAAa;EACtB;EACA,IAAI,YAAY;GACd,OAAO,SAAS;EAClB;EACA,WAAW,SAAS;CACtB;AACF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { i as mergeProps } from "./env.jsx";
|
|
2
|
+
import { t as filterDOMProps } from "./filterDOMProps.jsx";
|
|
3
|
+
import { t as access } from "./reactivity.jsx";
|
|
4
|
+
import { t as createLink } from "./link.jsx";
|
|
5
|
+
//#region src/breadcrumbs/createBreadcrumbs.ts
|
|
6
|
+
/**
|
|
7
|
+
* Breadcrumbs hooks for Solidaria
|
|
8
|
+
*
|
|
9
|
+
* Provides accessibility implementation for breadcrumb navigation.
|
|
10
|
+
* Port of @react-aria/breadcrumbs.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Provides accessibility implementation for the breadcrumbs navigation container.
|
|
14
|
+
*/
|
|
15
|
+
function createBreadcrumbs(props = {}) {
|
|
16
|
+
const getProps = () => access(props);
|
|
17
|
+
const getNavProps = () => {
|
|
18
|
+
const p = getProps();
|
|
19
|
+
const ariaLabel = p["aria-label"] ?? (p["aria-labelledby"] ? void 0 : "Breadcrumbs");
|
|
20
|
+
return mergeProps(filterDOMProps(p, { labelable: true }), {
|
|
21
|
+
"aria-label": ariaLabel,
|
|
22
|
+
"aria-details": p["aria-details"]
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return { get navProps() {
|
|
26
|
+
return getNavProps();
|
|
27
|
+
} };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Provides accessibility implementation for an individual breadcrumb item.
|
|
31
|
+
*/
|
|
32
|
+
function createBreadcrumbItem(props = {}) {
|
|
33
|
+
const getProps = () => access(props);
|
|
34
|
+
const isCurrent = () => getProps().isCurrent ?? false;
|
|
35
|
+
const isDisabled = () => getProps().isDisabled ?? false;
|
|
36
|
+
const elementType = () => getProps().elementType ?? "a";
|
|
37
|
+
const linkAria = createLink({
|
|
38
|
+
get isDisabled() {
|
|
39
|
+
return isDisabled() || isCurrent();
|
|
40
|
+
},
|
|
41
|
+
get elementType() {
|
|
42
|
+
return elementType();
|
|
43
|
+
},
|
|
44
|
+
get href() {
|
|
45
|
+
return isCurrent() ? void 0 : getProps().href;
|
|
46
|
+
},
|
|
47
|
+
get target() {
|
|
48
|
+
return getProps().target;
|
|
49
|
+
},
|
|
50
|
+
get rel() {
|
|
51
|
+
return getProps().rel;
|
|
52
|
+
},
|
|
53
|
+
get onPress() {
|
|
54
|
+
return getProps().onPress;
|
|
55
|
+
},
|
|
56
|
+
get onPressStart() {
|
|
57
|
+
return getProps().onPressStart;
|
|
58
|
+
},
|
|
59
|
+
get onPressEnd() {
|
|
60
|
+
return getProps().onPressEnd;
|
|
61
|
+
},
|
|
62
|
+
get onClick() {
|
|
63
|
+
return getProps().onClick;
|
|
64
|
+
},
|
|
65
|
+
get onFocus() {
|
|
66
|
+
return getProps().onFocus;
|
|
67
|
+
},
|
|
68
|
+
get onBlur() {
|
|
69
|
+
return getProps().onBlur;
|
|
70
|
+
},
|
|
71
|
+
get onFocusChange() {
|
|
72
|
+
return getProps().onFocusChange;
|
|
73
|
+
},
|
|
74
|
+
get onKeyDown() {
|
|
75
|
+
return getProps().onKeyDown;
|
|
76
|
+
},
|
|
77
|
+
get onKeyUp() {
|
|
78
|
+
return getProps().onKeyUp;
|
|
79
|
+
},
|
|
80
|
+
get autoFocus() {
|
|
81
|
+
return getProps().autoFocus;
|
|
82
|
+
},
|
|
83
|
+
get "aria-label"() {
|
|
84
|
+
return getProps()["aria-label"];
|
|
85
|
+
},
|
|
86
|
+
get "aria-labelledby"() {
|
|
87
|
+
return getProps()["aria-labelledby"];
|
|
88
|
+
},
|
|
89
|
+
get "aria-describedby"() {
|
|
90
|
+
return getProps()["aria-describedby"];
|
|
91
|
+
},
|
|
92
|
+
get "aria-details"() {
|
|
93
|
+
return getProps()["aria-details"];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const getItemProps = () => {
|
|
97
|
+
const p = getProps();
|
|
98
|
+
const current = isCurrent();
|
|
99
|
+
const linkProps = linkAria.linkProps;
|
|
100
|
+
let baseProps = p.id ? mergeProps(linkProps, { id: p.id }) : linkProps;
|
|
101
|
+
if (current) {
|
|
102
|
+
const ariaCurrent = p["aria-current"] ?? "page";
|
|
103
|
+
baseProps = mergeProps(baseProps, { "aria-current": ariaCurrent });
|
|
104
|
+
}
|
|
105
|
+
if (isDisabled()) baseProps = mergeProps(baseProps, { "aria-disabled": true });
|
|
106
|
+
return baseProps;
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
get itemProps() {
|
|
110
|
+
return getItemProps();
|
|
111
|
+
},
|
|
112
|
+
get linkProps() {
|
|
113
|
+
return linkAria.linkProps;
|
|
114
|
+
},
|
|
115
|
+
isPressed: linkAria.isPressed
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { createBreadcrumbs as n, createBreadcrumbItem as t };
|
|
120
|
+
|
|
121
|
+
//# sourceMappingURL=breadcrumbs.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.jsx","names":[],"sources":["../../src/breadcrumbs/createBreadcrumbs.ts"],"sourcesContent":["/**\n * Breadcrumbs hooks for Solidaria\n *\n * Provides accessibility implementation for breadcrumb navigation.\n * Port of @react-aria/breadcrumbs.\n */\n\nimport { createLink, type AriaLinkProps, type LinkAria } from \"../link\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface AriaBreadcrumbsProps {\n /** Provides a label for the breadcrumbs navigation. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the breadcrumbs. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the breadcrumbs. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide a detailed description. */\n \"aria-details\"?: string;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n}\n\nexport interface BreadcrumbsAria {\n /** Props for the breadcrumbs nav element. */\n navProps: Record<string, unknown>;\n}\n\nexport interface AriaBreadcrumbItemProps extends Omit<AriaLinkProps, \"aria-current\"> {\n /** The DOM id for the breadcrumb item. */\n id?: string;\n /** Whether this is the current/last item in the breadcrumb trail. */\n isCurrent?: boolean;\n /** The type of current location for aria-current. @default 'page' */\n \"aria-current\"?: \"page\" | \"step\" | \"location\" | \"date\" | \"time\" | boolean;\n /** The HTML element type. @default 'a' */\n elementType?: string;\n}\n\nexport interface BreadcrumbItemAria extends LinkAria {\n /** Props for the breadcrumb item element. */\n itemProps: Record<string, unknown>;\n}\n\n/**\n * Provides accessibility implementation for the breadcrumbs navigation container.\n */\nexport function createBreadcrumbs(\n props: MaybeAccessor<AriaBreadcrumbsProps> = {},\n): BreadcrumbsAria {\n const getProps = () => access(props);\n\n const getNavProps = (): Record<string, unknown> => {\n const p = getProps();\n\n // Only apply a default label when no other label source exists.\n const ariaLabel = p[\"aria-label\"] ?? (p[\"aria-labelledby\"] ? undefined : \"Breadcrumbs\");\n\n return mergeProps(filterDOMProps(p as Record<string, unknown>, { labelable: true }), {\n \"aria-label\": ariaLabel,\n \"aria-details\": p[\"aria-details\"],\n });\n };\n\n return {\n get navProps() {\n return getNavProps();\n },\n };\n}\n\n/**\n * Provides accessibility implementation for an individual breadcrumb item.\n */\nexport function createBreadcrumbItem(\n props: MaybeAccessor<AriaBreadcrumbItemProps> = {},\n): BreadcrumbItemAria {\n const getProps = () => access(props);\n\n const isCurrent = () => getProps().isCurrent ?? false;\n const isDisabled = () => getProps().isDisabled ?? false;\n const elementType = () => getProps().elementType ?? \"a\";\n\n // Use createLink for base link behavior\n // Current items are treated as disabled (can't navigate to current page).\n // Keep the whole return value (do NOT destructure linkProps): `linkProps` is a\n // reactive getter, and destructuring it here would snapshot getLinkProps() once\n // at mount — freezing role/tabIndex to whatever elementType was during the\n // transient first render (e.g. before isCurrent settles). Reading\n // linkAria.linkProps fresh inside getItemProps keeps it live, mirroring React\n // re-running useLink every render.\n const linkAria = createLink({\n get isDisabled() {\n return isDisabled() || isCurrent();\n },\n get elementType() {\n return elementType();\n },\n get href() {\n return isCurrent() ? undefined : getProps().href;\n },\n get target() {\n return getProps().target;\n },\n get rel() {\n return getProps().rel;\n },\n get onPress() {\n return getProps().onPress;\n },\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onClick() {\n return getProps().onClick;\n },\n get onFocus() {\n return getProps().onFocus;\n },\n get onBlur() {\n return getProps().onBlur;\n },\n get onFocusChange() {\n return getProps().onFocusChange;\n },\n get onKeyDown() {\n return getProps().onKeyDown;\n },\n get onKeyUp() {\n return getProps().onKeyUp;\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return getProps()[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return getProps()[\"aria-details\"];\n },\n });\n\n const getItemProps = (): Record<string, unknown> => {\n const p = getProps();\n const current = isCurrent();\n // Read fresh each call so elementType-driven role/tabIndex stay reactive.\n const linkProps = linkAria.linkProps;\n\n // Start with link props, forwarding id if provided\n let baseProps: Record<string, unknown> = p.id ? mergeProps(linkProps, { id: p.id }) : linkProps;\n\n // Add aria-current for current page\n if (current) {\n const ariaCurrent = p[\"aria-current\"] ?? \"page\";\n baseProps = mergeProps(baseProps, {\n \"aria-current\": ariaCurrent,\n });\n }\n\n // Add aria-disabled for disabled items\n if (isDisabled()) {\n baseProps = mergeProps(baseProps, {\n \"aria-disabled\": true,\n });\n }\n\n return baseProps;\n };\n\n return {\n get itemProps() {\n return getItemProps();\n },\n get linkProps() {\n return linkAria.linkProps;\n },\n isPressed: linkAria.isPressed,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAiDA,SAAgB,kBACd,QAA6C,CAAC,GAC7B;CACjB,MAAM,iBAAiB,OAAO,KAAK;CAEnC,MAAM,oBAA6C;EACjD,MAAM,IAAI,SAAS;EAGnB,MAAM,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,KAAA,IAAY;EAEzE,OAAO,WAAW,eAAe,GAA8B,EAAE,WAAW,KAAK,CAAC,GAAG;GACnF,cAAc;GACd,gBAAgB,EAAE;EACpB,CAAC;CACH;CAEA,OAAO,EACL,IAAI,WAAW;EACb,OAAO,YAAY;CACrB,EACF;AACF;;;;AAKA,SAAgB,qBACd,QAAgD,CAAC,GAC7B;CACpB,MAAM,iBAAiB,OAAO,KAAK;CAEnC,MAAM,kBAAkB,SAAS,CAAC,CAAC,aAAa;CAChD,MAAM,mBAAmB,SAAS,CAAC,CAAC,cAAc;CAClD,MAAM,oBAAoB,SAAS,CAAC,CAAC,eAAe;CAUpD,MAAM,WAAW,WAAW;EAC1B,IAAI,aAAa;GACf,OAAO,WAAW,KAAK,UAAU;EACnC;EACA,IAAI,cAAc;GAChB,OAAO,YAAY;EACrB;EACA,IAAI,OAAO;GACT,OAAO,UAAU,IAAI,KAAA,IAAY,SAAS,CAAC,CAAC;EAC9C;EACA,IAAI,SAAS;GACX,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,MAAM;GACR,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,UAAU;GACZ,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,eAAe;GACjB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,aAAa;GACf,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,UAAU;GACZ,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,UAAU;GACZ,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,SAAS;GACX,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,gBAAgB;GAClB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,YAAY;GACd,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,UAAU;GACZ,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,YAAY;GACd,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,eAAe;GACjB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,oBAAoB;GACtB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,qBAAqB;GACvB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,iBAAiB;GACnB,OAAO,SAAS,CAAC,CAAC;EACpB;CACF,CAAC;CAED,MAAM,qBAA8C;EAClD,MAAM,IAAI,SAAS;EACnB,MAAM,UAAU,UAAU;EAE1B,MAAM,YAAY,SAAS;EAG3B,IAAI,YAAqC,EAAE,KAAK,WAAW,WAAW,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI;EAGtF,IAAI,SAAS;GACX,MAAM,cAAc,EAAE,mBAAmB;GACzC,YAAY,WAAW,WAAW,EAChC,gBAAgB,YAClB,CAAC;EACH;EAGA,IAAI,WAAW,GACb,YAAY,WAAW,WAAW,EAChC,iBAAiB,KACnB,CAAC;EAGH,OAAO;CACT;CAEA,OAAO;EACL,IAAI,YAAY;GACd,OAAO,aAAa;EACtB;EACA,IAAI,YAAY;GACd,OAAO,SAAS;EAClB;EACA,WAAW,SAAS;CACtB;AACF"}
|