@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,229 @@
|
|
|
1
|
+
import { createContext, createEffect, createMemo, createSignal, onCleanup, useContext } from "solid-js";
|
|
2
|
+
import { createComponent } from "solid-js/web";
|
|
3
|
+
//#region src/i18n/utils.ts
|
|
4
|
+
/**
|
|
5
|
+
* i18n utilities for solidaria
|
|
6
|
+
*
|
|
7
|
+
* RTL detection and locale utilities.
|
|
8
|
+
*
|
|
9
|
+
* Port of @react-aria/i18n utils.
|
|
10
|
+
*/
|
|
11
|
+
const RTL_SCRIPTS = new Set([
|
|
12
|
+
"Arab",
|
|
13
|
+
"Syrc",
|
|
14
|
+
"Samr",
|
|
15
|
+
"Mand",
|
|
16
|
+
"Thaa",
|
|
17
|
+
"Mend",
|
|
18
|
+
"Nkoo",
|
|
19
|
+
"Adlm",
|
|
20
|
+
"Rohg",
|
|
21
|
+
"Hebr"
|
|
22
|
+
]);
|
|
23
|
+
const RTL_LANGS = new Set([
|
|
24
|
+
"ae",
|
|
25
|
+
"ar",
|
|
26
|
+
"arc",
|
|
27
|
+
"bcc",
|
|
28
|
+
"bqi",
|
|
29
|
+
"ckb",
|
|
30
|
+
"dv",
|
|
31
|
+
"fa",
|
|
32
|
+
"glk",
|
|
33
|
+
"he",
|
|
34
|
+
"ku",
|
|
35
|
+
"mzn",
|
|
36
|
+
"nqo",
|
|
37
|
+
"pnb",
|
|
38
|
+
"ps",
|
|
39
|
+
"sd",
|
|
40
|
+
"ug",
|
|
41
|
+
"ur",
|
|
42
|
+
"yi"
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* Determines if a locale is read right to left.
|
|
46
|
+
* Uses Intl.Locale API when available for accurate detection.
|
|
47
|
+
*/
|
|
48
|
+
function isRTL(localeString) {
|
|
49
|
+
if (typeof Intl !== "undefined" && Intl.Locale) try {
|
|
50
|
+
const locale = new Intl.Locale(localeString).maximize();
|
|
51
|
+
const localeAny = locale;
|
|
52
|
+
const textInfo = typeof localeAny.getTextInfo === "function" ? localeAny.getTextInfo() : localeAny.textInfo;
|
|
53
|
+
if (textInfo) return textInfo.direction === "rtl";
|
|
54
|
+
if (locale.script) return RTL_SCRIPTS.has(locale.script);
|
|
55
|
+
} catch {}
|
|
56
|
+
const lang = localeString.split("-")[0];
|
|
57
|
+
return RTL_LANGS.has(lang);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a cache key for formatter options.
|
|
61
|
+
*/
|
|
62
|
+
function createCacheKey(locale, options) {
|
|
63
|
+
if (!options) return locale;
|
|
64
|
+
return locale + Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join();
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/i18n/locale.tsx
|
|
68
|
+
/**
|
|
69
|
+
* Locale context and provider for solidaria
|
|
70
|
+
*
|
|
71
|
+
* Provides locale and text direction to the component tree.
|
|
72
|
+
*
|
|
73
|
+
* Port of @react-aria/i18n context and useDefaultLocale.
|
|
74
|
+
*/
|
|
75
|
+
const localeSymbol = Symbol.for("solidaria.i18n.locale");
|
|
76
|
+
let currentLocale = null;
|
|
77
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
78
|
+
/**
|
|
79
|
+
* Gets the default locale from the browser/system.
|
|
80
|
+
*/
|
|
81
|
+
function getDefaultLocale() {
|
|
82
|
+
let locale = typeof window !== "undefined" && window[localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
83
|
+
try {
|
|
84
|
+
Intl.DateTimeFormat.supportedLocalesOf([locale]);
|
|
85
|
+
} catch {
|
|
86
|
+
locale = "en-US";
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
locale,
|
|
90
|
+
direction: isRTL(locale) ? "rtl" : "ltr"
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function updateLocale() {
|
|
94
|
+
currentLocale = getDefaultLocale();
|
|
95
|
+
for (const listener of listeners) listener(currentLocale);
|
|
96
|
+
}
|
|
97
|
+
const I18nContext = createContext(null);
|
|
98
|
+
/**
|
|
99
|
+
* Returns the current browser/system locale, and updates when it changes.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* const locale = createDefaultLocale();
|
|
104
|
+
* console.log(locale().locale); // 'en-US'
|
|
105
|
+
* console.log(locale().direction); // 'ltr'
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
function createDefaultLocale() {
|
|
109
|
+
if (!currentLocale) currentLocale = getDefaultLocale();
|
|
110
|
+
const [locale, setLocale] = createSignal(currentLocale);
|
|
111
|
+
createEffect(() => {
|
|
112
|
+
if (typeof window === "undefined") return;
|
|
113
|
+
if (listeners.size === 0) window.addEventListener("languagechange", updateLocale);
|
|
114
|
+
listeners.add(setLocale);
|
|
115
|
+
onCleanup(() => {
|
|
116
|
+
listeners.delete(setLocale);
|
|
117
|
+
if (listeners.size === 0) window.removeEventListener("languagechange", updateLocale);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
return locale;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Returns the current locale and layout direction from context or browser default.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```tsx
|
|
127
|
+
* function MyComponent() {
|
|
128
|
+
* const locale = useLocale();
|
|
129
|
+
* return <div dir={locale().direction}>{locale().locale}</div>;
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
function useLocale() {
|
|
134
|
+
const context = useContext(I18nContext);
|
|
135
|
+
const defaultLocale = createDefaultLocale();
|
|
136
|
+
return context || defaultLocale;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Provides the locale for the application to all child components.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```tsx
|
|
143
|
+
* // Use browser default locale
|
|
144
|
+
* <I18nProvider>
|
|
145
|
+
* <App />
|
|
146
|
+
* </I18nProvider>
|
|
147
|
+
*
|
|
148
|
+
* // Override with specific locale
|
|
149
|
+
* <I18nProvider locale="ar-SA">
|
|
150
|
+
* <App /> // Will have RTL direction
|
|
151
|
+
* </I18nProvider>
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
function I18nProvider(props) {
|
|
155
|
+
const defaultLocale = createDefaultLocale();
|
|
156
|
+
const locale = createMemo(() => {
|
|
157
|
+
if (props.locale) return {
|
|
158
|
+
locale: props.locale,
|
|
159
|
+
direction: isRTL(props.locale) ? "rtl" : "ltr"
|
|
160
|
+
};
|
|
161
|
+
return defaultLocale();
|
|
162
|
+
});
|
|
163
|
+
return createComponent(I18nContext.Provider, {
|
|
164
|
+
value: locale,
|
|
165
|
+
get children() {
|
|
166
|
+
return props.children;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/i18n/createCollator.ts
|
|
172
|
+
/**
|
|
173
|
+
* createCollator hook for solidaria
|
|
174
|
+
*
|
|
175
|
+
* Provides localized string comparison/collation with caching.
|
|
176
|
+
*
|
|
177
|
+
* Port of @react-aria/i18n useCollator.
|
|
178
|
+
*/
|
|
179
|
+
const collatorCache = /* @__PURE__ */ new Map();
|
|
180
|
+
/**
|
|
181
|
+
* Gets or creates a cached collator.
|
|
182
|
+
*/
|
|
183
|
+
function getCachedCollator(locale, options) {
|
|
184
|
+
const cacheKey = createCacheKey(locale, options);
|
|
185
|
+
if (collatorCache.has(cacheKey)) return collatorCache.get(cacheKey);
|
|
186
|
+
const collator = new Intl.Collator(locale, options);
|
|
187
|
+
collatorCache.set(cacheKey, collator);
|
|
188
|
+
return collator;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Provides localized string collation for the current locale.
|
|
192
|
+
* Useful for sorting strings according to locale-specific rules.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```tsx
|
|
196
|
+
* function SortedList(props: { items: string[] }) {
|
|
197
|
+
* const collator = createCollator();
|
|
198
|
+
*
|
|
199
|
+
* const sortedItems = () =>
|
|
200
|
+
* [...props.items].sort((a, b) => collator().compare(a, b));
|
|
201
|
+
*
|
|
202
|
+
* return (
|
|
203
|
+
* <ul>
|
|
204
|
+
* <For each={sortedItems()}>
|
|
205
|
+
* {(item) => <li>{item}</li>}
|
|
206
|
+
* </For>
|
|
207
|
+
* </ul>
|
|
208
|
+
* );
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```tsx
|
|
214
|
+
* // Case-insensitive sorting
|
|
215
|
+
* const collator = createCollator({ sensitivity: 'base' });
|
|
216
|
+
*
|
|
217
|
+
* // Numeric sorting
|
|
218
|
+
* const numericCollator = createCollator({ numeric: true });
|
|
219
|
+
* // ['a1', 'a10', 'a2'].sort(numericCollator().compare) -> ['a1', 'a2', 'a10']
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
function createCollator(options) {
|
|
223
|
+
const locale = useLocale();
|
|
224
|
+
return createMemo(() => getCachedCollator(locale().locale, options));
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
export { useLocale as a, getDefaultLocale as i, I18nProvider as n, createCacheKey as o, createDefaultLocale as r, isRTL as s, createCollator as t };
|
|
228
|
+
|
|
229
|
+
//# sourceMappingURL=createCollator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCollator.js","names":["Accessor","JSX","ParentProps","createContext","createEffect","createMemo","createSignal","onCleanup","useContext","isRTL","Direction","Locale","locale","direction","I18nProviderProps","localeSymbol","Symbol","for","currentLocale","listeners","Set","getDefaultLocale","window","Record","navigator","language","userLanguage","Intl","DateTimeFormat","supportedLocalesOf","updateLocale","listener","I18nContext","createDefaultLocale","setLocale","size","addEventListener","add","delete","removeEventListener","useLocale","context","defaultLocale","I18nProvider","props","Element","_$createComponent","Provider","value","children"],"sources":["../../src/i18n/utils.ts","../../src/i18n/locale.tsx","../../src/i18n/createCollator.ts"],"sourcesContent":["/**\n * i18n utilities for solidaria\n *\n * RTL detection and locale utilities.\n *\n * Port of @react-aria/i18n utils.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set([\n \"Arab\",\n \"Syrc\",\n \"Samr\",\n \"Mand\",\n \"Thaa\",\n \"Mend\",\n \"Nkoo\",\n \"Adlm\",\n \"Rohg\",\n \"Hebr\",\n]);\n\nconst RTL_LANGS = new Set([\n \"ae\",\n \"ar\",\n \"arc\",\n \"bcc\",\n \"bqi\",\n \"ckb\",\n \"dv\",\n \"fa\",\n \"glk\",\n \"he\",\n \"ku\",\n \"mzn\",\n \"nqo\",\n \"pnb\",\n \"ps\",\n \"sd\",\n \"ug\",\n \"ur\",\n \"yi\",\n]);\n\n/**\n * Determines if a locale is read right to left.\n * Uses Intl.Locale API when available for accurate detection.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (typeof Intl !== \"undefined\" && Intl.Locale) {\n try {\n const locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // getTextInfo() was implemented as a property by some browsers before it was standardized as a function.\n const localeAny = locale as unknown as {\n getTextInfo?: () => { direction: string };\n textInfo?: { direction: string };\n };\n const textInfo =\n typeof localeAny.getTextInfo === \"function\" ? localeAny.getTextInfo() : localeAny.textInfo;\n\n if (textInfo) {\n return textInfo.direction === \"rtl\";\n }\n\n // Fallback: guess using the script.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n } catch {\n // Fall through to language-based detection\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n const lang = localeString.split(\"-\")[0];\n return RTL_LANGS.has(lang);\n}\n\n/**\n * Creates a cache key for formatter options.\n */\nexport function createCacheKey(locale: string, options?: Record<string, unknown>): string {\n if (!options) {\n return locale;\n }\n return (\n locale +\n Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n );\n}\n","/**\n * Locale context and provider for solidaria\n *\n * Provides locale and text direction to the component tree.\n *\n * Port of @react-aria/i18n context and useDefaultLocale.\n */\n\nimport {\n type Accessor,\n type JSX,\n type ParentProps,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n useContext,\n} from \"solid-js\";\nimport { isRTL } from \"./utils\";\n\n/** Text direction: left-to-right or right-to-left. */\nexport type Direction = \"ltr\" | \"rtl\";\n\n/** Locale information including language code and text direction. */\nexport interface Locale {\n /** The BCP47 language code for the locale (e.g., 'en-US', 'ar-SA'). */\n locale: string;\n /** The writing direction for the locale. */\n direction: Direction;\n}\n\nexport interface I18nProviderProps extends ParentProps {\n /** The locale to apply to the children. If not provided, uses browser default. */\n locale?: string;\n}\n\n// Symbol for server-provided locale\nconst localeSymbol = Symbol.for(\"solidaria.i18n.locale\");\n\nlet currentLocale: Locale | null = null;\nconst listeners = new Set<(locale: Locale) => void>();\n\n/**\n * Gets the default locale from the browser/system.\n */\nexport function getDefaultLocale(): Locale {\n let locale =\n (typeof window !== \"undefined\" &&\n (window as unknown as Record<symbol, string>)[localeSymbol]) ||\n (typeof navigator !== \"undefined\" &&\n (navigator.language || (navigator as unknown as { userLanguage?: string }).userLanguage)) ||\n \"en-US\";\n\n // Validate the locale is supported\n try {\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch {\n locale = \"en-US\";\n }\n\n return {\n locale,\n direction: isRTL(locale) ? \"rtl\" : \"ltr\",\n };\n}\n\nfunction updateLocale(): void {\n currentLocale = getDefaultLocale();\n for (const listener of listeners) {\n listener(currentLocale);\n }\n}\n\nconst I18nContext = createContext<Accessor<Locale> | null>(null);\n\n/**\n * Returns the current browser/system locale, and updates when it changes.\n *\n * @example\n * ```tsx\n * const locale = createDefaultLocale();\n * console.log(locale().locale); // 'en-US'\n * console.log(locale().direction); // 'ltr'\n * ```\n */\nexport function createDefaultLocale(): Accessor<Locale> {\n if (!currentLocale) {\n currentLocale = getDefaultLocale();\n }\n\n const [locale, setLocale] = createSignal<Locale>(currentLocale);\n\n createEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n if (listeners.size === 0) {\n window.addEventListener(\"languagechange\", updateLocale);\n }\n\n listeners.add(setLocale);\n\n onCleanup(() => {\n listeners.delete(setLocale);\n if (listeners.size === 0) {\n window.removeEventListener(\"languagechange\", updateLocale);\n }\n });\n });\n\n return locale;\n}\n\n/**\n * Returns the current locale and layout direction from context or browser default.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const locale = useLocale();\n * return <div dir={locale().direction}>{locale().locale}</div>;\n * }\n * ```\n */\nexport function useLocale(): Accessor<Locale> {\n const context = useContext(I18nContext);\n const defaultLocale = createDefaultLocale();\n return context || defaultLocale;\n}\n\n/**\n * Provides the locale for the application to all child components.\n *\n * @example\n * ```tsx\n * // Use browser default locale\n * <I18nProvider>\n * <App />\n * </I18nProvider>\n *\n * // Override with specific locale\n * <I18nProvider locale=\"ar-SA\">\n * <App /> // Will have RTL direction\n * </I18nProvider>\n * ```\n */\nexport function I18nProvider(props: I18nProviderProps): JSX.Element {\n const defaultLocale = createDefaultLocale();\n\n const locale = createMemo<Locale>(() => {\n if (props.locale) {\n return {\n locale: props.locale,\n direction: isRTL(props.locale) ? \"rtl\" : \"ltr\",\n };\n }\n return defaultLocale();\n });\n\n return <I18nContext.Provider value={locale}>{props.children}</I18nContext.Provider>;\n}\n","/**\n * createCollator hook for solidaria\n *\n * Provides localized string comparison/collation with caching.\n *\n * Port of @react-aria/i18n useCollator.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { useLocale } from \"./locale\";\nimport { createCacheKey } from \"./utils\";\n\nconst collatorCache = new Map<string, Intl.Collator>();\n\n/**\n * Gets or creates a cached collator.\n */\nfunction getCachedCollator(locale: string, options?: Intl.CollatorOptions): Intl.Collator {\n const cacheKey = createCacheKey(locale, options as Record<string, unknown>);\n\n if (collatorCache.has(cacheKey)) {\n return collatorCache.get(cacheKey)!;\n }\n\n const collator = new Intl.Collator(locale, options);\n collatorCache.set(cacheKey, collator);\n return collator;\n}\n\n/**\n * Provides localized string collation for the current locale.\n * Useful for sorting strings according to locale-specific rules.\n *\n * @example\n * ```tsx\n * function SortedList(props: { items: string[] }) {\n * const collator = createCollator();\n *\n * const sortedItems = () =>\n * [...props.items].sort((a, b) => collator().compare(a, b));\n *\n * return (\n * <ul>\n * <For each={sortedItems()}>\n * {(item) => <li>{item}</li>}\n * </For>\n * </ul>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Case-insensitive sorting\n * const collator = createCollator({ sensitivity: 'base' });\n *\n * // Numeric sorting\n * const numericCollator = createCollator({ numeric: true });\n * // ['a1', 'a10', 'a2'].sort(numericCollator().compare) -> ['a1', 'a2', 'a10']\n * ```\n */\nexport function createCollator(options?: Intl.CollatorOptions): () => Intl.Collator {\n const locale = useLocale();\n\n return createMemo(() => getCachedCollator(locale().locale, options));\n}\n"],"mappings":";;;;;;;;;;AASA,MAAM,cAAc,IAAI,IAAI;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,YAAY,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,SAAgB,MAAM,cAA+B;CAEnD,IA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B,OAAO,CAAC,CAAC,QAAQ,OAAO,CAAC;AACrE"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { createContext, createEffect, createMemo, createSignal, onCleanup, useContext } from "solid-js";
|
|
2
|
+
//#region src/i18n/utils.ts
|
|
3
|
+
/**
|
|
4
|
+
* i18n utilities for solidaria
|
|
5
|
+
*
|
|
6
|
+
* RTL detection and locale utilities.
|
|
7
|
+
*
|
|
8
|
+
* Port of @react-aria/i18n utils.
|
|
9
|
+
*/
|
|
10
|
+
const RTL_SCRIPTS = new Set([
|
|
11
|
+
"Arab",
|
|
12
|
+
"Syrc",
|
|
13
|
+
"Samr",
|
|
14
|
+
"Mand",
|
|
15
|
+
"Thaa",
|
|
16
|
+
"Mend",
|
|
17
|
+
"Nkoo",
|
|
18
|
+
"Adlm",
|
|
19
|
+
"Rohg",
|
|
20
|
+
"Hebr"
|
|
21
|
+
]);
|
|
22
|
+
const RTL_LANGS = new Set([
|
|
23
|
+
"ae",
|
|
24
|
+
"ar",
|
|
25
|
+
"arc",
|
|
26
|
+
"bcc",
|
|
27
|
+
"bqi",
|
|
28
|
+
"ckb",
|
|
29
|
+
"dv",
|
|
30
|
+
"fa",
|
|
31
|
+
"glk",
|
|
32
|
+
"he",
|
|
33
|
+
"ku",
|
|
34
|
+
"mzn",
|
|
35
|
+
"nqo",
|
|
36
|
+
"pnb",
|
|
37
|
+
"ps",
|
|
38
|
+
"sd",
|
|
39
|
+
"ug",
|
|
40
|
+
"ur",
|
|
41
|
+
"yi"
|
|
42
|
+
]);
|
|
43
|
+
/**
|
|
44
|
+
* Determines if a locale is read right to left.
|
|
45
|
+
* Uses Intl.Locale API when available for accurate detection.
|
|
46
|
+
*/
|
|
47
|
+
function isRTL(localeString) {
|
|
48
|
+
if (typeof Intl !== "undefined" && Intl.Locale) try {
|
|
49
|
+
const locale = new Intl.Locale(localeString).maximize();
|
|
50
|
+
const localeAny = locale;
|
|
51
|
+
const textInfo = typeof localeAny.getTextInfo === "function" ? localeAny.getTextInfo() : localeAny.textInfo;
|
|
52
|
+
if (textInfo) return textInfo.direction === "rtl";
|
|
53
|
+
if (locale.script) return RTL_SCRIPTS.has(locale.script);
|
|
54
|
+
} catch {}
|
|
55
|
+
const lang = localeString.split("-")[0];
|
|
56
|
+
return RTL_LANGS.has(lang);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Creates a cache key for formatter options.
|
|
60
|
+
*/
|
|
61
|
+
function createCacheKey(locale, options) {
|
|
62
|
+
if (!options) return locale;
|
|
63
|
+
return locale + Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join();
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/i18n/locale.tsx
|
|
67
|
+
/**
|
|
68
|
+
* Locale context and provider for solidaria
|
|
69
|
+
*
|
|
70
|
+
* Provides locale and text direction to the component tree.
|
|
71
|
+
*
|
|
72
|
+
* Port of @react-aria/i18n context and useDefaultLocale.
|
|
73
|
+
*/
|
|
74
|
+
const localeSymbol = Symbol.for("solidaria.i18n.locale");
|
|
75
|
+
let currentLocale = null;
|
|
76
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
77
|
+
/**
|
|
78
|
+
* Gets the default locale from the browser/system.
|
|
79
|
+
*/
|
|
80
|
+
function getDefaultLocale() {
|
|
81
|
+
let locale = typeof window !== "undefined" && window[localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
82
|
+
try {
|
|
83
|
+
Intl.DateTimeFormat.supportedLocalesOf([locale]);
|
|
84
|
+
} catch {
|
|
85
|
+
locale = "en-US";
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
locale,
|
|
89
|
+
direction: isRTL(locale) ? "rtl" : "ltr"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function updateLocale() {
|
|
93
|
+
currentLocale = getDefaultLocale();
|
|
94
|
+
for (const listener of listeners) listener(currentLocale);
|
|
95
|
+
}
|
|
96
|
+
const I18nContext = createContext(null);
|
|
97
|
+
/**
|
|
98
|
+
* Returns the current browser/system locale, and updates when it changes.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```tsx
|
|
102
|
+
* const locale = createDefaultLocale();
|
|
103
|
+
* console.log(locale().locale); // 'en-US'
|
|
104
|
+
* console.log(locale().direction); // 'ltr'
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
function createDefaultLocale() {
|
|
108
|
+
if (!currentLocale) currentLocale = getDefaultLocale();
|
|
109
|
+
const [locale, setLocale] = createSignal(currentLocale);
|
|
110
|
+
createEffect(() => {
|
|
111
|
+
if (typeof window === "undefined") return;
|
|
112
|
+
if (listeners.size === 0) window.addEventListener("languagechange", updateLocale);
|
|
113
|
+
listeners.add(setLocale);
|
|
114
|
+
onCleanup(() => {
|
|
115
|
+
listeners.delete(setLocale);
|
|
116
|
+
if (listeners.size === 0) window.removeEventListener("languagechange", updateLocale);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
return locale;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Returns the current locale and layout direction from context or browser default.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* function MyComponent() {
|
|
127
|
+
* const locale = useLocale();
|
|
128
|
+
* return <div dir={locale().direction}>{locale().locale}</div>;
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
function useLocale() {
|
|
133
|
+
const context = useContext(I18nContext);
|
|
134
|
+
const defaultLocale = createDefaultLocale();
|
|
135
|
+
return context || defaultLocale;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Provides the locale for the application to all child components.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* // Use browser default locale
|
|
143
|
+
* <I18nProvider>
|
|
144
|
+
* <App />
|
|
145
|
+
* </I18nProvider>
|
|
146
|
+
*
|
|
147
|
+
* // Override with specific locale
|
|
148
|
+
* <I18nProvider locale="ar-SA">
|
|
149
|
+
* <App /> // Will have RTL direction
|
|
150
|
+
* </I18nProvider>
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
function I18nProvider(props) {
|
|
154
|
+
const defaultLocale = createDefaultLocale();
|
|
155
|
+
const locale = createMemo(() => {
|
|
156
|
+
if (props.locale) return {
|
|
157
|
+
locale: props.locale,
|
|
158
|
+
direction: isRTL(props.locale) ? "rtl" : "ltr"
|
|
159
|
+
};
|
|
160
|
+
return defaultLocale();
|
|
161
|
+
});
|
|
162
|
+
return <I18nContext.Provider value={locale}>{props.children}</I18nContext.Provider>;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/i18n/createCollator.ts
|
|
166
|
+
/**
|
|
167
|
+
* createCollator hook for solidaria
|
|
168
|
+
*
|
|
169
|
+
* Provides localized string comparison/collation with caching.
|
|
170
|
+
*
|
|
171
|
+
* Port of @react-aria/i18n useCollator.
|
|
172
|
+
*/
|
|
173
|
+
const collatorCache = /* @__PURE__ */ new Map();
|
|
174
|
+
/**
|
|
175
|
+
* Gets or creates a cached collator.
|
|
176
|
+
*/
|
|
177
|
+
function getCachedCollator(locale, options) {
|
|
178
|
+
const cacheKey = createCacheKey(locale, options);
|
|
179
|
+
if (collatorCache.has(cacheKey)) return collatorCache.get(cacheKey);
|
|
180
|
+
const collator = new Intl.Collator(locale, options);
|
|
181
|
+
collatorCache.set(cacheKey, collator);
|
|
182
|
+
return collator;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Provides localized string collation for the current locale.
|
|
186
|
+
* Useful for sorting strings according to locale-specific rules.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```tsx
|
|
190
|
+
* function SortedList(props: { items: string[] }) {
|
|
191
|
+
* const collator = createCollator();
|
|
192
|
+
*
|
|
193
|
+
* const sortedItems = () =>
|
|
194
|
+
* [...props.items].sort((a, b) => collator().compare(a, b));
|
|
195
|
+
*
|
|
196
|
+
* return (
|
|
197
|
+
* <ul>
|
|
198
|
+
* <For each={sortedItems()}>
|
|
199
|
+
* {(item) => <li>{item}</li>}
|
|
200
|
+
* </For>
|
|
201
|
+
* </ul>
|
|
202
|
+
* );
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```tsx
|
|
208
|
+
* // Case-insensitive sorting
|
|
209
|
+
* const collator = createCollator({ sensitivity: 'base' });
|
|
210
|
+
*
|
|
211
|
+
* // Numeric sorting
|
|
212
|
+
* const numericCollator = createCollator({ numeric: true });
|
|
213
|
+
* // ['a1', 'a10', 'a2'].sort(numericCollator().compare) -> ['a1', 'a2', 'a10']
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
function createCollator(options) {
|
|
217
|
+
const locale = useLocale();
|
|
218
|
+
return createMemo(() => getCachedCollator(locale().locale, options));
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
export { useLocale as a, getDefaultLocale as i, I18nProvider as n, createCacheKey as o, createDefaultLocale as r, isRTL as s, createCollator as t };
|
|
222
|
+
|
|
223
|
+
//# sourceMappingURL=createCollator.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCollator.jsx","names":[],"sources":["../../src/i18n/utils.ts","../../src/i18n/locale.tsx","../../src/i18n/createCollator.ts"],"sourcesContent":["/**\n * i18n utilities for solidaria\n *\n * RTL detection and locale utilities.\n *\n * Port of @react-aria/i18n utils.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set([\n \"Arab\",\n \"Syrc\",\n \"Samr\",\n \"Mand\",\n \"Thaa\",\n \"Mend\",\n \"Nkoo\",\n \"Adlm\",\n \"Rohg\",\n \"Hebr\",\n]);\n\nconst RTL_LANGS = new Set([\n \"ae\",\n \"ar\",\n \"arc\",\n \"bcc\",\n \"bqi\",\n \"ckb\",\n \"dv\",\n \"fa\",\n \"glk\",\n \"he\",\n \"ku\",\n \"mzn\",\n \"nqo\",\n \"pnb\",\n \"ps\",\n \"sd\",\n \"ug\",\n \"ur\",\n \"yi\",\n]);\n\n/**\n * Determines if a locale is read right to left.\n * Uses Intl.Locale API when available for accurate detection.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (typeof Intl !== \"undefined\" && Intl.Locale) {\n try {\n const locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // getTextInfo() was implemented as a property by some browsers before it was standardized as a function.\n const localeAny = locale as unknown as {\n getTextInfo?: () => { direction: string };\n textInfo?: { direction: string };\n };\n const textInfo =\n typeof localeAny.getTextInfo === \"function\" ? localeAny.getTextInfo() : localeAny.textInfo;\n\n if (textInfo) {\n return textInfo.direction === \"rtl\";\n }\n\n // Fallback: guess using the script.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n } catch {\n // Fall through to language-based detection\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n const lang = localeString.split(\"-\")[0];\n return RTL_LANGS.has(lang);\n}\n\n/**\n * Creates a cache key for formatter options.\n */\nexport function createCacheKey(locale: string, options?: Record<string, unknown>): string {\n if (!options) {\n return locale;\n }\n return (\n locale +\n Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n );\n}\n","/**\n * Locale context and provider for solidaria\n *\n * Provides locale and text direction to the component tree.\n *\n * Port of @react-aria/i18n context and useDefaultLocale.\n */\n\nimport {\n type Accessor,\n type JSX,\n type ParentProps,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n useContext,\n} from \"solid-js\";\nimport { isRTL } from \"./utils\";\n\n/** Text direction: left-to-right or right-to-left. */\nexport type Direction = \"ltr\" | \"rtl\";\n\n/** Locale information including language code and text direction. */\nexport interface Locale {\n /** The BCP47 language code for the locale (e.g., 'en-US', 'ar-SA'). */\n locale: string;\n /** The writing direction for the locale. */\n direction: Direction;\n}\n\nexport interface I18nProviderProps extends ParentProps {\n /** The locale to apply to the children. If not provided, uses browser default. */\n locale?: string;\n}\n\n// Symbol for server-provided locale\nconst localeSymbol = Symbol.for(\"solidaria.i18n.locale\");\n\nlet currentLocale: Locale | null = null;\nconst listeners = new Set<(locale: Locale) => void>();\n\n/**\n * Gets the default locale from the browser/system.\n */\nexport function getDefaultLocale(): Locale {\n let locale =\n (typeof window !== \"undefined\" &&\n (window as unknown as Record<symbol, string>)[localeSymbol]) ||\n (typeof navigator !== \"undefined\" &&\n (navigator.language || (navigator as unknown as { userLanguage?: string }).userLanguage)) ||\n \"en-US\";\n\n // Validate the locale is supported\n try {\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch {\n locale = \"en-US\";\n }\n\n return {\n locale,\n direction: isRTL(locale) ? \"rtl\" : \"ltr\",\n };\n}\n\nfunction updateLocale(): void {\n currentLocale = getDefaultLocale();\n for (const listener of listeners) {\n listener(currentLocale);\n }\n}\n\nconst I18nContext = createContext<Accessor<Locale> | null>(null);\n\n/**\n * Returns the current browser/system locale, and updates when it changes.\n *\n * @example\n * ```tsx\n * const locale = createDefaultLocale();\n * console.log(locale().locale); // 'en-US'\n * console.log(locale().direction); // 'ltr'\n * ```\n */\nexport function createDefaultLocale(): Accessor<Locale> {\n if (!currentLocale) {\n currentLocale = getDefaultLocale();\n }\n\n const [locale, setLocale] = createSignal<Locale>(currentLocale);\n\n createEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n if (listeners.size === 0) {\n window.addEventListener(\"languagechange\", updateLocale);\n }\n\n listeners.add(setLocale);\n\n onCleanup(() => {\n listeners.delete(setLocale);\n if (listeners.size === 0) {\n window.removeEventListener(\"languagechange\", updateLocale);\n }\n });\n });\n\n return locale;\n}\n\n/**\n * Returns the current locale and layout direction from context or browser default.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const locale = useLocale();\n * return <div dir={locale().direction}>{locale().locale}</div>;\n * }\n * ```\n */\nexport function useLocale(): Accessor<Locale> {\n const context = useContext(I18nContext);\n const defaultLocale = createDefaultLocale();\n return context || defaultLocale;\n}\n\n/**\n * Provides the locale for the application to all child components.\n *\n * @example\n * ```tsx\n * // Use browser default locale\n * <I18nProvider>\n * <App />\n * </I18nProvider>\n *\n * // Override with specific locale\n * <I18nProvider locale=\"ar-SA\">\n * <App /> // Will have RTL direction\n * </I18nProvider>\n * ```\n */\nexport function I18nProvider(props: I18nProviderProps): JSX.Element {\n const defaultLocale = createDefaultLocale();\n\n const locale = createMemo<Locale>(() => {\n if (props.locale) {\n return {\n locale: props.locale,\n direction: isRTL(props.locale) ? \"rtl\" : \"ltr\",\n };\n }\n return defaultLocale();\n });\n\n return <I18nContext.Provider value={locale}>{props.children}</I18nContext.Provider>;\n}\n","/**\n * createCollator hook for solidaria\n *\n * Provides localized string comparison/collation with caching.\n *\n * Port of @react-aria/i18n useCollator.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { useLocale } from \"./locale\";\nimport { createCacheKey } from \"./utils\";\n\nconst collatorCache = new Map<string, Intl.Collator>();\n\n/**\n * Gets or creates a cached collator.\n */\nfunction getCachedCollator(locale: string, options?: Intl.CollatorOptions): Intl.Collator {\n const cacheKey = createCacheKey(locale, options as Record<string, unknown>);\n\n if (collatorCache.has(cacheKey)) {\n return collatorCache.get(cacheKey)!;\n }\n\n const collator = new Intl.Collator(locale, options);\n collatorCache.set(cacheKey, collator);\n return collator;\n}\n\n/**\n * Provides localized string collation for the current locale.\n * Useful for sorting strings according to locale-specific rules.\n *\n * @example\n * ```tsx\n * function SortedList(props: { items: string[] }) {\n * const collator = createCollator();\n *\n * const sortedItems = () =>\n * [...props.items].sort((a, b) => collator().compare(a, b));\n *\n * return (\n * <ul>\n * <For each={sortedItems()}>\n * {(item) => <li>{item}</li>}\n * </For>\n * </ul>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Case-insensitive sorting\n * const collator = createCollator({ sensitivity: 'base' });\n *\n * // Numeric sorting\n * const numericCollator = createCollator({ numeric: true });\n * // ['a1', 'a10', 'a2'].sort(numericCollator().compare) -> ['a1', 'a2', 'a10']\n * ```\n */\nexport function createCollator(options?: Intl.CollatorOptions): () => Intl.Collator {\n const locale = useLocale();\n\n return createMemo(() => getCachedCollator(locale().locale, options));\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,cAAc,IAAI,IAAI;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,YAAY,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,SAAgB,MAAM,cAA+B;CAEnD,IAAI,OAAO,SAAS,eAAe,KAAK,QACtC,IAAI;EACF,MAAM,SAAS,IAAI,KAAK,OAAO,YAAY,CAAC,CAAC,SAAS;EAItD,MAAM,YAAY;EAIlB,MAAM,WACJ,OAAO,UAAU,gBAAgB,aAAa,UAAU,YAAY,IAAI,UAAU;EAEpF,IAAI,UACF,OAAO,SAAS,cAAc;EAIhC,IAAI,OAAO,QACT,OAAO,YAAY,IAAI,OAAO,MAAM;CAExC,QAAQ,CAER;CAIF,MAAM,OAAO,aAAa,MAAM,GAAG,CAAC,CAAC;CACrC,OAAO,UAAU,IAAI,IAAI;AAC3B;;;;AAKA,SAAgB,eAAe,QAAgB,SAA2C;CACxF,IAAI,CAAC,SACH,OAAO;CAET,OACE,SACA,OAAO,QAAQ,OAAO,CAAC,CACpB,MAAM,GAAG,MAAO,EAAE,KAAK,EAAE,KAAK,KAAK,CAAE,CAAC,CACtC,KAAK;AAEZ;;;;;;;;;;ACxDA,MAAM,eAAe,OAAO,IAAI,uBAAuB;AAEvD,IAAI,gBAA+B;AACnC,MAAM,4BAAY,IAAI,IAA8B;;;;AAKpD,SAAgB,mBAA2B;CACzC,IAAI,SACD,OAAO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gB,SAA+C;CACxF,MAAM,WAAW,eAAe,QAAQ,OAAkC;CAE1E,IAAI,cAAc,IAAI,QAAQ,GAC5B,OAAO,cAAc,IAAI,QAAQ;CAGnC,MAAM,WAAW,IAAI,KAAK,SAAS,QAAQ,OAAO;CAClD,cAAc,IAAI,UAAU,QAAQ;CACpC,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,eAAe,SAAqD;CAClF,MAAM,SAAS,UAAU;CAEzB,OAAO,iBAAiB,kBAAkB,OAAO,CAAC,CAAC,QAAQ,OAAO,CAAC;AACrE"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { S as scrollIntoViewport } from "./utils.js";
|
|
2
|
+
import { a as getEventTarget, g as isTabbable, i as getActiveElement, l as getScrollParent, o as getFocusableTreeWalker, t as focusSafely, y as nodeContains } from "./focus.js";
|
|
3
|
+
//#region src/selection/createCollectionRowInteraction.ts
|
|
4
|
+
function lastFocusable(walker) {
|
|
5
|
+
let last = null;
|
|
6
|
+
let next;
|
|
7
|
+
while (next = walker.nextNode()) last = next;
|
|
8
|
+
return last instanceof HTMLElement ? last : null;
|
|
9
|
+
}
|
|
10
|
+
function scrollFocusedElementIntoView(row, element) {
|
|
11
|
+
focusSafely(element);
|
|
12
|
+
scrollIntoViewport(element, { containingElement: getScrollParent(row) });
|
|
13
|
+
}
|
|
14
|
+
function redispatchCollectionArrowKey(row, event) {
|
|
15
|
+
row.parentElement?.dispatchEvent(new KeyboardEvent(event.type, {
|
|
16
|
+
altKey: event.altKey,
|
|
17
|
+
bubbles: true,
|
|
18
|
+
cancelable: event.cancelable,
|
|
19
|
+
code: event.code,
|
|
20
|
+
composed: event.composed,
|
|
21
|
+
ctrlKey: event.ctrlKey,
|
|
22
|
+
key: event.key,
|
|
23
|
+
location: event.location,
|
|
24
|
+
metaKey: event.metaKey,
|
|
25
|
+
repeat: event.repeat,
|
|
26
|
+
shiftKey: event.shiftKey
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
function shouldIgnoreRowEvent(event, row) {
|
|
30
|
+
const target = getEventTarget(event);
|
|
31
|
+
const currentTarget = event.currentTarget;
|
|
32
|
+
return !target || !currentTarget || !nodeContains(currentTarget, target) || !nodeContains(row, target);
|
|
33
|
+
}
|
|
34
|
+
function mergeCollectionRowInteractionProps(rowProps, options) {
|
|
35
|
+
const baseOnKeyDownCapture = rowProps.onKeyDownCapture;
|
|
36
|
+
const baseOnKeyDown = rowProps.onKeyDown;
|
|
37
|
+
const baseOnPointerDown = rowProps.onPointerDown;
|
|
38
|
+
const baseOnMouseDown = rowProps.onMouseDown;
|
|
39
|
+
const onKeyDownCapture = (event) => {
|
|
40
|
+
const row = options.ref();
|
|
41
|
+
const activeElement = getActiveElement(row?.ownerDocument);
|
|
42
|
+
if (options.keyboardNavigationBehavior() !== "arrow" || !row || !activeElement || shouldIgnoreRowEvent(event, row)) {
|
|
43
|
+
baseOnKeyDownCapture?.(event);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const direction = options.direction?.() ?? "ltr";
|
|
47
|
+
const walker = getFocusableTreeWalker(row);
|
|
48
|
+
walker.currentNode = activeElement;
|
|
49
|
+
switch (event.key) {
|
|
50
|
+
case "ArrowLeft": {
|
|
51
|
+
const focusable = direction === "rtl" ? walker.nextNode() : walker.previousNode();
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
event.stopPropagation();
|
|
54
|
+
if (focusable) scrollFocusedElementIntoView(row, focusable);
|
|
55
|
+
else if (direction === "rtl") scrollFocusedElementIntoView(row, row);
|
|
56
|
+
else {
|
|
57
|
+
walker.currentNode = row;
|
|
58
|
+
const lastElement = lastFocusable(walker);
|
|
59
|
+
if (lastElement) scrollFocusedElementIntoView(row, lastElement);
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case "ArrowRight": {
|
|
64
|
+
const focusable = direction === "rtl" ? walker.previousNode() : walker.nextNode();
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
event.stopPropagation();
|
|
67
|
+
if (focusable) scrollFocusedElementIntoView(row, focusable);
|
|
68
|
+
else if (direction === "ltr") scrollFocusedElementIntoView(row, row);
|
|
69
|
+
else {
|
|
70
|
+
walker.currentNode = row;
|
|
71
|
+
const lastElement = lastFocusable(walker);
|
|
72
|
+
if (lastElement) scrollFocusedElementIntoView(row, lastElement);
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case "ArrowUp":
|
|
77
|
+
case "ArrowDown":
|
|
78
|
+
if (!event.altKey) {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
event.stopPropagation();
|
|
81
|
+
redispatchCollectionArrowKey(row, event);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
if (!event.cancelBubble) baseOnKeyDownCapture?.(event);
|
|
86
|
+
};
|
|
87
|
+
const onKeyDown = (event) => {
|
|
88
|
+
const row = options.ref();
|
|
89
|
+
const target = getEventTarget(event);
|
|
90
|
+
const activeElement = getActiveElement(row?.ownerDocument);
|
|
91
|
+
if (row && target && activeElement && !shouldIgnoreRowEvent(event, row)) {
|
|
92
|
+
if (options.keyboardNavigationBehavior() === "tab" && target !== row && event.key !== "Tab") {
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (options.keyboardNavigationBehavior() === "tab" && event.key === "Tab") {
|
|
97
|
+
const walker = getFocusableTreeWalker(row, { tabbable: true });
|
|
98
|
+
walker.currentNode = activeElement;
|
|
99
|
+
if (event.shiftKey ? walker.previousNode() : walker.nextNode()) event.stopPropagation();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!event.cancelBubble) baseOnKeyDown?.(event);
|
|
103
|
+
};
|
|
104
|
+
const onPointerDown = (event) => {
|
|
105
|
+
const row = options.ref();
|
|
106
|
+
const target = getEventTarget(event);
|
|
107
|
+
if (row && target && target !== row && isTabbable(target)) {
|
|
108
|
+
event.stopPropagation();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
baseOnPointerDown?.(event);
|
|
112
|
+
};
|
|
113
|
+
const onMouseDown = (event) => {
|
|
114
|
+
const row = options.ref();
|
|
115
|
+
const target = getEventTarget(event);
|
|
116
|
+
if (row && target && target !== row && isTabbable(target)) {
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
baseOnMouseDown?.(event);
|
|
121
|
+
};
|
|
122
|
+
return {
|
|
123
|
+
...rowProps,
|
|
124
|
+
onKeyDownCapture: options.keyboardNavigationBehavior() === "arrow" ? onKeyDownCapture : baseOnKeyDownCapture,
|
|
125
|
+
onKeyDown,
|
|
126
|
+
onPointerDown,
|
|
127
|
+
onMouseDown
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { mergeCollectionRowInteractionProps as t };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=createCollectionRowInteraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCollectionRowInteraction.js","names":[],"sources":["../../src/selection/createCollectionRowInteraction.ts"],"sourcesContent":["import type { Accessor, JSX } from \"solid-js\";\nimport {\n getActiveElement,\n getEventTarget,\n getFocusableTreeWalker,\n getScrollParent,\n isTabbable,\n nodeContains,\n} from \"../utils/dom\";\nimport { focusSafely } from \"../utils/focus\";\nimport { scrollIntoViewport } from \"../utils/scrollIntoView\";\n\ntype KeyboardNavigationBehavior = \"arrow\" | \"tab\";\n\ninterface CollectionRowInteractionOptions {\n ref: Accessor<HTMLElement | null>;\n keyboardNavigationBehavior: Accessor<KeyboardNavigationBehavior>;\n direction?: Accessor<\"ltr\" | \"rtl\">;\n}\n\ntype CollectionRowInteractionProps<T extends HTMLElement> = JSX.HTMLAttributes<T> & {\n onKeyDownCapture?: JSX.EventHandler<T, KeyboardEvent>;\n};\n\nfunction lastFocusable(walker: TreeWalker): HTMLElement | null {\n let last: Node | null = null;\n let next: Node | null;\n while ((next = walker.nextNode())) {\n last = next;\n }\n return last instanceof HTMLElement ? last : null;\n}\n\nfunction scrollFocusedElementIntoView(row: HTMLElement, element: HTMLElement): void {\n focusSafely(element);\n scrollIntoViewport(element, { containingElement: getScrollParent(row) });\n}\n\nfunction redispatchCollectionArrowKey(row: HTMLElement, event: KeyboardEvent): void {\n row.parentElement?.dispatchEvent(\n new KeyboardEvent(event.type, {\n altKey: event.altKey,\n bubbles: true,\n cancelable: event.cancelable,\n code: event.code,\n composed: event.composed,\n ctrlKey: event.ctrlKey,\n key: event.key,\n location: event.location,\n metaKey: event.metaKey,\n repeat: event.repeat,\n shiftKey: event.shiftKey,\n }),\n );\n}\n\nfunction shouldIgnoreRowEvent(event: Event, row: HTMLElement): boolean {\n const target = getEventTarget<Element>(event);\n const currentTarget = event.currentTarget as Element | null;\n return (\n !target || !currentTarget || !nodeContains(currentTarget, target) || !nodeContains(row, target)\n );\n}\n\nexport function mergeCollectionRowInteractionProps<T extends HTMLElement>(\n rowProps: CollectionRowInteractionProps<T>,\n options: CollectionRowInteractionOptions,\n): CollectionRowInteractionProps<T> {\n const baseOnKeyDownCapture = rowProps.onKeyDownCapture as\n | ((event: KeyboardEvent) => void)\n | undefined;\n const baseOnKeyDown = rowProps.onKeyDown as ((event: KeyboardEvent) => void) | undefined;\n const baseOnPointerDown = rowProps.onPointerDown as ((event: PointerEvent) => void) | undefined;\n const baseOnMouseDown = rowProps.onMouseDown as ((event: MouseEvent) => void) | undefined;\n\n const onKeyDownCapture = (event: KeyboardEvent) => {\n const row = options.ref();\n const activeElement = getActiveElement(row?.ownerDocument);\n if (\n options.keyboardNavigationBehavior() !== \"arrow\" ||\n !row ||\n !activeElement ||\n shouldIgnoreRowEvent(event, row)\n ) {\n baseOnKeyDownCapture?.(event);\n return;\n }\n\n const direction = options.direction?.() ?? \"ltr\";\n const walker = getFocusableTreeWalker(row);\n walker.currentNode = activeElement;\n\n switch (event.key) {\n case \"ArrowLeft\": {\n const focusable =\n direction === \"rtl\"\n ? (walker.nextNode() as HTMLElement | null)\n : (walker.previousNode() as HTMLElement | null);\n\n event.preventDefault();\n event.stopPropagation();\n\n if (focusable) {\n scrollFocusedElementIntoView(row, focusable);\n } else if (direction === \"rtl\") {\n scrollFocusedElementIntoView(row, row);\n } else {\n walker.currentNode = row;\n const lastElement = lastFocusable(walker);\n if (lastElement) {\n scrollFocusedElementIntoView(row, lastElement);\n }\n }\n break;\n }\n case \"ArrowRight\": {\n const focusable =\n direction === \"rtl\"\n ? (walker.previousNode() as HTMLElement | null)\n : (walker.nextNode() as HTMLElement | null);\n\n event.preventDefault();\n event.stopPropagation();\n\n if (focusable) {\n scrollFocusedElementIntoView(row, focusable);\n } else if (direction === \"ltr\") {\n scrollFocusedElementIntoView(row, row);\n } else {\n walker.currentNode = row;\n const lastElement = lastFocusable(walker);\n if (lastElement) {\n scrollFocusedElementIntoView(row, lastElement);\n }\n }\n break;\n }\n case \"ArrowUp\":\n case \"ArrowDown\": {\n if (!event.altKey) {\n event.preventDefault();\n event.stopPropagation();\n redispatchCollectionArrowKey(row, event);\n }\n break;\n }\n }\n\n if (!event.cancelBubble) {\n baseOnKeyDownCapture?.(event);\n }\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n const row = options.ref();\n const target = getEventTarget<Element>(event);\n const activeElement = getActiveElement(row?.ownerDocument);\n\n if (row && target && activeElement && !shouldIgnoreRowEvent(event, row)) {\n if (options.keyboardNavigationBehavior() === \"tab\" && target !== row && event.key !== \"Tab\") {\n event.stopPropagation();\n return;\n }\n\n if (options.keyboardNavigationBehavior() === \"tab\" && event.key === \"Tab\") {\n const walker = getFocusableTreeWalker(row, { tabbable: true });\n walker.currentNode = activeElement;\n const next = event.shiftKey ? walker.previousNode() : walker.nextNode();\n\n if (next) {\n event.stopPropagation();\n }\n }\n }\n\n if (!event.cancelBubble) {\n baseOnKeyDown?.(event);\n }\n };\n\n const onPointerDown = (event: PointerEvent) => {\n const row = options.ref();\n const target = getEventTarget<Element>(event);\n if (row && target && target !== row && isTabbable(target)) {\n event.stopPropagation();\n return;\n }\n baseOnPointerDown?.(event);\n };\n\n const onMouseDown = (event: MouseEvent) => {\n const row = options.ref();\n const target = getEventTarget<Element>(event);\n if (row && target && target !== row && isTabbable(target)) {\n event.stopPropagation();\n return;\n }\n baseOnMouseDown?.(event);\n };\n\n return {\n ...rowProps,\n onKeyDownCapture:\n options.keyboardNavigationBehavior() === \"arrow\" ? onKeyDownCapture : baseOnKeyDownCapture,\n onKeyDown,\n onPointerDown,\n onMouseDown,\n };\n}\n"],"mappings":";;;AAwBA,SAAS,cAAc,QAAwC;CAC7D,IAAI,OAAoB;CACxB,IAAI;CACJ,OAAQ,OAAO,OAAO,SAAS,GAC7B,OAAO;CAET,OAAO,gBAAgB,cAAc,OAAO;AAC9C;AAEA,SAAS,6BAA6B,KAAkB,SAA4B;CAClF,YAAY,OAAO;CACnB,mBAAmB,SAAS,EAAE,mBAAmB,gBAAgB,GAAG,EAAE,CAAC;AACzE;AAEA,SAAS,6BAA6B,KAAkB,OAA4B;CAClF,IAAI,eAAe,cACjB,IAAI,cAAc,MAAM,MAAM;EAC5B,QAAQ,MAAM;EACd,SAAS;EACT,YAAY,MAAM;EAClB,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,KAAK,MAAM;EACX,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,UAAU,MAAM;CAClB,CAAC,CACH;AACF;AAEA,SAAS,qBAAqB,OAAc,KAA2B;CACrE,MAAM,SAAS,eAAwB,KAAK;CAC5C,MAAM,gBAAgB,MAAM;CAC5B,OACE,CAAC,UAAU,CAAC,iBAAiB,CAAC,aAAa,eAAe,MAAM,KAAK,CAAC,aAAa,KAAK,MAAM;AAElG;AAEA,SAAgB,mCACd,UACA,SACkC;CAClC,MAAM,uBAAuB,SAAS;CAGtC,MAAM,gBAAgB,SAAS;CAC/B,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