@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,167 @@
|
|
|
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
|
+
export { createCacheKey as a, useLocale as i, createDefaultLocale as n, isRTL as o, getDefaultLocale as r, I18nProvider as t };
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=locale.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.jsx","names":[],"sources":["../../src/i18n/utils.ts","../../src/i18n/locale.tsx"],"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"],"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,WAAW,eAChB,OAA6C,iBAC/C,OAAO,cAAc,gBACnB,UAAU,YAAa,UAAmD,iBAC7E;CAGF,IAAI;EACF,KAAK,eAAe,mBAAmB,CAAC,MAAM,CAAC;CACjD,QAAQ;EACN,SAAS;CACX;CAEA,OAAO;EACL;EACA,WAAW,MAAM,MAAM,IAAI,QAAQ;CACrC;AACF;AAEA,SAAS,eAAqB;CAC5B,gBAAgB,iBAAiB;CACjC,KAAK,MAAM,YAAY,WACrB,SAAS,aAAa;AAE1B;AAEA,MAAM,cAAc,cAAuC,IAAI;;;;;;;;;;;AAY/D,SAAgB,sBAAwC;CACtD,IAAI,CAAC,eACH,gBAAgB,iBAAiB;CAGnC,MAAM,CAAC,QAAQ,aAAa,aAAqB,aAAa;CAE9D,mBAAmB;EACjB,IAAI,OAAO,WAAW,aACpB;EAGF,IAAI,UAAU,SAAS,GACrB,OAAO,iBAAiB,kBAAkB,YAAY;EAGxD,UAAU,IAAI,SAAS;EAEvB,gBAAgB;GACd,UAAU,OAAO,SAAS;GAC1B,IAAI,UAAU,SAAS,GACrB,OAAO,oBAAoB,kBAAkB,YAAY;EAE7D,CAAC;CACH,CAAC;CAED,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,YAA8B;CAC5C,MAAM,UAAU,WAAW,WAAW;CACtC,MAAM,gBAAgB,oBAAoB;CAC1C,OAAO,WAAW;AACpB;;;;;;;;;;;;;;;;;AAkBA,SAAgB,aAAa,OAAuC;CAClE,MAAM,gBAAgB,oBAAoB;CAE1C,MAAM,SAAS,iBAAyB;EACtC,IAAI,MAAM,QACR,OAAO;GACL,QAAQ,MAAM;GACd,WAAW,MAAM,MAAM,MAAM,IAAI,QAAQ;EAC3C;EAEF,OAAO,cAAc;CACvB,CAAC;CAED,OAAO,CAAC,YAAY,SAAS,OAAO,SAAS,MAAM,SAAS,EAAE,YAAY;AAC5E"}
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import { t as createPress } from "./createPress.js";
|
|
2
|
+
import { i as mergeProps$1, t as isDevEnv } from "./env.js";
|
|
3
|
+
import { t as filterDOMProps } from "./filterDOMProps.js";
|
|
4
|
+
import { t as access } from "./reactivity.js";
|
|
5
|
+
import { p as isVirtualClick } from "./utils.js";
|
|
6
|
+
import { a as getEventTarget } from "./focus.js";
|
|
7
|
+
import { t as createFocusWithin } from "./createFocusWithin.js";
|
|
8
|
+
import { t as createFocusRing } from "./createFocusRing.js";
|
|
9
|
+
import { t as createHover } from "./createHover.js";
|
|
10
|
+
import { createId, createSlotId } from "../ssr/index.js";
|
|
11
|
+
import { t as createLabel } from "./createLabel.js";
|
|
12
|
+
import { t as createTypeSelect } from "./createTypeSelect.js";
|
|
13
|
+
import { n as createSelectableItem, r as selectItem } from "./createSelectableItem.js";
|
|
14
|
+
import { createEffect, onCleanup } from "solid-js";
|
|
15
|
+
//#region src/menu/createMenu.ts
|
|
16
|
+
/**
|
|
17
|
+
* Provides the behavior and accessibility implementation for a menu component.
|
|
18
|
+
* A menu displays a list of actions or options that a user can choose.
|
|
19
|
+
* Based on @react-aria/menu useMenu.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Default number of items to skip for page up/down when DOM measurement is not available.
|
|
23
|
+
*/
|
|
24
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
25
|
+
/**
|
|
26
|
+
* Find the next non-disabled key in a collection.
|
|
27
|
+
*/
|
|
28
|
+
function findNextNonDisabledKey(collection, currentKey, direction, isDisabled, wrap) {
|
|
29
|
+
const getNextKey = direction === "next" ? (key) => collection.getKeyAfter(key) : (key) => collection.getKeyBefore(key);
|
|
30
|
+
const getFirstKey = direction === "next" ? () => collection.getFirstKey() : () => collection.getLastKey();
|
|
31
|
+
let nextKey = currentKey != null ? getNextKey(currentKey) : getFirstKey();
|
|
32
|
+
while (nextKey != null && isDisabled(nextKey)) nextKey = getNextKey(nextKey);
|
|
33
|
+
if (nextKey == null && wrap) {
|
|
34
|
+
nextKey = getFirstKey();
|
|
35
|
+
while (nextKey != null && isDisabled(nextKey)) nextKey = getNextKey(nextKey);
|
|
36
|
+
}
|
|
37
|
+
return nextKey;
|
|
38
|
+
}
|
|
39
|
+
const menuData = /* @__PURE__ */ new WeakMap();
|
|
40
|
+
function getMenuData(state) {
|
|
41
|
+
return menuData.get(state);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Provides the behavior and accessibility implementation for a menu component.
|
|
45
|
+
* A menu displays a list of actions or options that a user can choose.
|
|
46
|
+
*/
|
|
47
|
+
function createMenu(props, state, ref) {
|
|
48
|
+
const getProps = () => access(props);
|
|
49
|
+
const id = createId(getProps().id);
|
|
50
|
+
if (isDevEnv()) {
|
|
51
|
+
const p = getProps();
|
|
52
|
+
if (!p.label && !p["aria-label"] && !p["aria-labelledby"]) console.warn("[solidaria] A Menu requires an aria-label or aria-labelledby attribute for accessibility.");
|
|
53
|
+
}
|
|
54
|
+
const domProps = () => filterDOMProps(getProps(), { labelable: true });
|
|
55
|
+
const updateSharedData = () => {
|
|
56
|
+
const p = getProps();
|
|
57
|
+
menuData.set(state, {
|
|
58
|
+
id,
|
|
59
|
+
onAction: p.onAction,
|
|
60
|
+
onClose: p.onClose,
|
|
61
|
+
isDisabled: p.isDisabled,
|
|
62
|
+
shouldCloseOnSelect: p.shouldCloseOnSelect
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
updateSharedData();
|
|
66
|
+
createEffect(() => {
|
|
67
|
+
updateSharedData();
|
|
68
|
+
onCleanup(() => {
|
|
69
|
+
menuData.delete(state);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
const { focusWithinProps } = createFocusWithin({
|
|
73
|
+
onFocusWithin: (e) => getProps().onFocus?.(e),
|
|
74
|
+
onBlurWithin: (e) => getProps().onBlur?.(e),
|
|
75
|
+
onFocusWithinChange: (isFocused) => {
|
|
76
|
+
getProps().onFocusChange?.(isFocused);
|
|
77
|
+
state.setFocused(isFocused);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const { labelProps, fieldProps } = createLabel({
|
|
81
|
+
get id() {
|
|
82
|
+
return id;
|
|
83
|
+
},
|
|
84
|
+
get label() {
|
|
85
|
+
return getProps().label;
|
|
86
|
+
},
|
|
87
|
+
get "aria-label"() {
|
|
88
|
+
return getProps()["aria-label"];
|
|
89
|
+
},
|
|
90
|
+
get "aria-labelledby"() {
|
|
91
|
+
return getProps()["aria-labelledby"];
|
|
92
|
+
},
|
|
93
|
+
labelElementType: "span"
|
|
94
|
+
});
|
|
95
|
+
const { typeSelectProps } = createTypeSelect({
|
|
96
|
+
collection: () => state.collection(),
|
|
97
|
+
focusedKey: () => state.focusedKey(),
|
|
98
|
+
onFocusedKeyChange: (key) => state.setFocusedKey(key),
|
|
99
|
+
isKeyDisabled: (key) => state.isDisabled(key),
|
|
100
|
+
get isDisabled() {
|
|
101
|
+
return getProps().disallowTypeAhead ?? false;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const onKeyDown = (e) => {
|
|
105
|
+
if (getProps().isDisabled) return;
|
|
106
|
+
const collection = state.collection();
|
|
107
|
+
const p = getProps();
|
|
108
|
+
const wrap = p.shouldFocusWrap ?? false;
|
|
109
|
+
const isDisabled = (key) => state.isDisabled(key) && state.disabledBehavior() === "all";
|
|
110
|
+
switch (e.key) {
|
|
111
|
+
case "ArrowDown": {
|
|
112
|
+
const nextKey = findNextNonDisabledKey(collection, state.focusedKey(), "next", isDisabled, wrap);
|
|
113
|
+
if (nextKey != null) {
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
state.setFocusedKey(nextKey);
|
|
116
|
+
}
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case "ArrowUp": {
|
|
120
|
+
const prevKey = findNextNonDisabledKey(collection, state.focusedKey(), "prev", isDisabled, wrap);
|
|
121
|
+
if (prevKey != null) {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
state.setFocusedKey(prevKey);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "Home": {
|
|
128
|
+
if (state.focusedKey() == null && e.shiftKey) break;
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
let firstKey = collection.getFirstKey();
|
|
131
|
+
while (firstKey != null && isDisabled(firstKey)) firstKey = collection.getKeyAfter(firstKey);
|
|
132
|
+
if (firstKey != null) state.setFocusedKey(firstKey);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case "End": {
|
|
136
|
+
if (state.focusedKey() == null && e.shiftKey) break;
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
let lastKey = collection.getLastKey();
|
|
139
|
+
while (lastKey != null && isDisabled(lastKey)) lastKey = collection.getKeyBefore(lastKey);
|
|
140
|
+
if (lastKey != null) state.setFocusedKey(lastKey);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case " ":
|
|
144
|
+
case "Enter": {
|
|
145
|
+
if (e.target !== e.currentTarget) break;
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
const focusedKey = state.focusedKey();
|
|
148
|
+
if (focusedKey != null && !isDisabled(focusedKey)) {
|
|
149
|
+
selectItem(state, focusedKey, {
|
|
150
|
+
pointerType: "keyboard",
|
|
151
|
+
shiftKey: e.shiftKey,
|
|
152
|
+
ctrlKey: e.ctrlKey,
|
|
153
|
+
metaKey: e.metaKey,
|
|
154
|
+
altKey: e.altKey
|
|
155
|
+
}, collection);
|
|
156
|
+
p.onAction?.(focusedKey, collection.getItem(focusedKey)?.value);
|
|
157
|
+
const isLink = !!collection.getItem(focusedKey)?.props?.href;
|
|
158
|
+
if (p.shouldCloseOnSelect ?? (e.key === "Enter" || state.selectionMode() === "none" || isLink)) p.onClose?.();
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
case "Escape":
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
p.onClose?.();
|
|
165
|
+
break;
|
|
166
|
+
case "PageDown": {
|
|
167
|
+
const currentKey = state.focusedKey();
|
|
168
|
+
if (currentKey == null) break;
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
const el = ref?.();
|
|
171
|
+
if (el) {
|
|
172
|
+
const visibleHeight = el.clientHeight;
|
|
173
|
+
let traveled = 0;
|
|
174
|
+
let targetKey = currentKey;
|
|
175
|
+
while (targetKey != null && traveled < visibleHeight) {
|
|
176
|
+
const nextKey = collection.getKeyAfter(targetKey);
|
|
177
|
+
if (nextKey == null) break;
|
|
178
|
+
const itemElement = el.querySelector(`[data-key="${targetKey}"]`);
|
|
179
|
+
traveled += itemElement?.clientHeight ?? 32;
|
|
180
|
+
if (!isDisabled(nextKey)) targetKey = nextKey;
|
|
181
|
+
else {
|
|
182
|
+
const afterDisabled = findNextNonDisabledKey(collection, nextKey, "next", isDisabled, false);
|
|
183
|
+
if (afterDisabled != null) targetKey = afterDisabled;
|
|
184
|
+
else break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (targetKey != null && targetKey !== currentKey) state.setFocusedKey(targetKey);
|
|
188
|
+
} else {
|
|
189
|
+
let count = DEFAULT_PAGE_SIZE;
|
|
190
|
+
let targetKey = currentKey;
|
|
191
|
+
while (count > 0 && targetKey != null) {
|
|
192
|
+
const nextKey = findNextNonDisabledKey(collection, targetKey, "next", isDisabled, false);
|
|
193
|
+
if (nextKey == null) break;
|
|
194
|
+
targetKey = nextKey;
|
|
195
|
+
count--;
|
|
196
|
+
}
|
|
197
|
+
if (targetKey != null) state.setFocusedKey(targetKey);
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
case "PageUp": {
|
|
202
|
+
const currentKey = state.focusedKey();
|
|
203
|
+
if (currentKey == null) break;
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
const el = ref?.();
|
|
206
|
+
if (el) {
|
|
207
|
+
const visibleHeight = el.clientHeight;
|
|
208
|
+
let traveled = 0;
|
|
209
|
+
let targetKey = currentKey;
|
|
210
|
+
while (targetKey != null && traveled < visibleHeight) {
|
|
211
|
+
const prevKey = collection.getKeyBefore(targetKey);
|
|
212
|
+
if (prevKey == null) break;
|
|
213
|
+
const itemElement = el.querySelector(`[data-key="${targetKey}"]`);
|
|
214
|
+
traveled += itemElement?.clientHeight ?? 32;
|
|
215
|
+
if (!isDisabled(prevKey)) targetKey = prevKey;
|
|
216
|
+
else {
|
|
217
|
+
const beforeDisabled = findNextNonDisabledKey(collection, prevKey, "prev", isDisabled, false);
|
|
218
|
+
if (beforeDisabled != null) targetKey = beforeDisabled;
|
|
219
|
+
else break;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (targetKey != null && targetKey !== currentKey) state.setFocusedKey(targetKey);
|
|
223
|
+
} else {
|
|
224
|
+
let count = DEFAULT_PAGE_SIZE;
|
|
225
|
+
let targetKey = currentKey;
|
|
226
|
+
while (count > 0 && targetKey != null) {
|
|
227
|
+
const prevKey = findNextNonDisabledKey(collection, targetKey, "prev", isDisabled, false);
|
|
228
|
+
if (prevKey == null) break;
|
|
229
|
+
targetKey = prevKey;
|
|
230
|
+
count--;
|
|
231
|
+
}
|
|
232
|
+
if (targetKey != null) state.setFocusedKey(targetKey);
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
return {
|
|
239
|
+
get labelProps() {
|
|
240
|
+
return labelProps;
|
|
241
|
+
},
|
|
242
|
+
get menuProps() {
|
|
243
|
+
const p = getProps();
|
|
244
|
+
const baseProps = mergeProps$1(domProps(), focusWithinProps, fieldProps, {
|
|
245
|
+
role: "menu",
|
|
246
|
+
get tabIndex() {
|
|
247
|
+
return getProps().isDisabled ? void 0 : state.focusedKey() == null ? 0 : -1;
|
|
248
|
+
},
|
|
249
|
+
"aria-disabled": p.isDisabled || void 0,
|
|
250
|
+
onKeyDown
|
|
251
|
+
});
|
|
252
|
+
if (!p.disallowTypeAhead) return mergeProps$1(baseProps, typeSelectProps);
|
|
253
|
+
return baseProps;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/menu/createMenuItem.ts
|
|
259
|
+
/**
|
|
260
|
+
* Provides the behavior and accessibility implementation for a menu item.
|
|
261
|
+
*/
|
|
262
|
+
function createMenuItem(props, state, ref) {
|
|
263
|
+
const getProps = () => access(props);
|
|
264
|
+
const getData = () => getMenuData(state);
|
|
265
|
+
const isDisabled = () => {
|
|
266
|
+
return Boolean(getData()?.isDisabled || getProps().isDisabled || state.isDisabled(getProps().key));
|
|
267
|
+
};
|
|
268
|
+
const selectionMode = () => {
|
|
269
|
+
return state.selectionMode();
|
|
270
|
+
};
|
|
271
|
+
const isLink = () => !!getProps().href;
|
|
272
|
+
const isTrigger = () => !!getProps()["aria-haspopup"];
|
|
273
|
+
const selectableItem = createSelectableItem(() => {
|
|
274
|
+
const p = getProps();
|
|
275
|
+
return {
|
|
276
|
+
key: p.key,
|
|
277
|
+
id: p.id ?? String(p.key),
|
|
278
|
+
isDisabled: isDisabled(),
|
|
279
|
+
isLink: isLink(),
|
|
280
|
+
href: p.href,
|
|
281
|
+
shouldSelectOnPressUp: true,
|
|
282
|
+
allowsDifferentPressOrigin: true,
|
|
283
|
+
linkBehavior: "none"
|
|
284
|
+
};
|
|
285
|
+
}, state, () => ref?.() ?? null);
|
|
286
|
+
const isFocused = () => selectableItem.isFocused();
|
|
287
|
+
const isSelected = () => {
|
|
288
|
+
return !isTrigger() && selectableItem.isSelected();
|
|
289
|
+
};
|
|
290
|
+
let interaction = null;
|
|
291
|
+
let isMenuPressActive = false;
|
|
292
|
+
let isDispatchingKeyboardClick = false;
|
|
293
|
+
let isDispatchingMenuSyntheticClick = false;
|
|
294
|
+
let selectionEventBeforeMenuPressUp = null;
|
|
295
|
+
let hasSelectionEventBeforeMenuPressUp = false;
|
|
296
|
+
let pendingSyntheticClickSelectionEvent = null;
|
|
297
|
+
let suppressNextKeyboardClick = false;
|
|
298
|
+
const getShouldClose = () => {
|
|
299
|
+
const explicitClose = getProps().closeOnSelect ?? getData()?.shouldCloseOnSelect;
|
|
300
|
+
if (explicitClose !== void 0) return explicitClose;
|
|
301
|
+
if (interaction?.pointerType === "keyboard") return interaction.key === "Enter" || selectionMode() === "none" || isLink();
|
|
302
|
+
return selectionMode() !== "multiple" || isLink();
|
|
303
|
+
};
|
|
304
|
+
const performMenuAction = (event) => {
|
|
305
|
+
if (isDisabled()) {
|
|
306
|
+
event.preventDefault();
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (suppressNextKeyboardClick && interaction == null) {
|
|
310
|
+
suppressNextKeyboardClick = false;
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const p = getProps();
|
|
314
|
+
const key = p.key;
|
|
315
|
+
const data = getData();
|
|
316
|
+
if (isTrigger()) {
|
|
317
|
+
p.onAction?.();
|
|
318
|
+
interaction = null;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
p.onAction?.();
|
|
322
|
+
const item = state.collection().getItem(key);
|
|
323
|
+
data?.onAction?.(key, item?.value);
|
|
324
|
+
if (getShouldClose()) data?.onClose?.();
|
|
325
|
+
interaction = null;
|
|
326
|
+
};
|
|
327
|
+
const { pressProps, isPressed } = createPress({
|
|
328
|
+
get isDisabled() {
|
|
329
|
+
return isDisabled();
|
|
330
|
+
},
|
|
331
|
+
onPressChange(isPressed) {
|
|
332
|
+
isMenuPressActive = isPressed;
|
|
333
|
+
},
|
|
334
|
+
onPressUp(e) {
|
|
335
|
+
if (e.pointerType !== "keyboard" && !isDispatchingKeyboardClick) interaction = { pointerType: e.pointerType };
|
|
336
|
+
if (e.pointerType === "mouse" && !isMenuPressActive && e.target instanceof HTMLElement) {
|
|
337
|
+
const selectionEventAfterPressUp = state.selectionManager.lastSelectionEvent;
|
|
338
|
+
pendingSyntheticClickSelectionEvent = hasSelectionEventBeforeMenuPressUp && selectionEventAfterPressUp != null && selectionEventAfterPressUp !== selectionEventBeforeMenuPressUp ? selectionEventAfterPressUp : null;
|
|
339
|
+
isDispatchingMenuSyntheticClick = true;
|
|
340
|
+
try {
|
|
341
|
+
e.target.click();
|
|
342
|
+
} finally {
|
|
343
|
+
isDispatchingMenuSyntheticClick = false;
|
|
344
|
+
hasSelectionEventBeforeMenuPressUp = false;
|
|
345
|
+
selectionEventBeforeMenuPressUp = null;
|
|
346
|
+
pendingSyntheticClickSelectionEvent = null;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
const captureSelectionEventBeforeMenuPressUp = () => {
|
|
352
|
+
selectionEventBeforeMenuPressUp = state.selectionManager.lastSelectionEvent;
|
|
353
|
+
hasSelectionEventBeforeMenuPressUp = true;
|
|
354
|
+
};
|
|
355
|
+
const withMenuPressUpSelectionSnapshot = (handler) => {
|
|
356
|
+
if (typeof handler !== "function") return handler;
|
|
357
|
+
return (event) => {
|
|
358
|
+
captureSelectionEventBeforeMenuPressUp();
|
|
359
|
+
handler(event);
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
const selectableItemProps = () => {
|
|
363
|
+
const props = selectableItem.itemProps;
|
|
364
|
+
const onClick = props.onClick;
|
|
365
|
+
return {
|
|
366
|
+
...props,
|
|
367
|
+
onPointerUp: withMenuPressUpSelectionSnapshot(props.onPointerUp),
|
|
368
|
+
onMouseUp: withMenuPressUpSelectionSnapshot(props.onMouseUp),
|
|
369
|
+
onClick: typeof onClick === "function" ? (event) => {
|
|
370
|
+
if (isDispatchingMenuSyntheticClick && isVirtualClick(event)) {
|
|
371
|
+
if (pendingSyntheticClickSelectionEvent != null) {
|
|
372
|
+
state.selectionManager.emitDuplicateSelectionEvent(pendingSyntheticClickSelectionEvent);
|
|
373
|
+
pendingSyntheticClickSelectionEvent = null;
|
|
374
|
+
}
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
onClick(event);
|
|
378
|
+
} : onClick
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
const menuPressProps = () => {
|
|
382
|
+
const { onKeyDown: _onKeyDown, onKeyUp: _onKeyUp, ...props } = pressProps;
|
|
383
|
+
return props;
|
|
384
|
+
};
|
|
385
|
+
const keyboardProps = {
|
|
386
|
+
onKeyDown: (event) => {
|
|
387
|
+
if (isDisabled() || event.repeat) return;
|
|
388
|
+
if (event.key !== " " && event.key !== "Enter") return;
|
|
389
|
+
event.preventDefault();
|
|
390
|
+
event.stopPropagation();
|
|
391
|
+
interaction = {
|
|
392
|
+
pointerType: "keyboard",
|
|
393
|
+
key: event.key
|
|
394
|
+
};
|
|
395
|
+
const target = getEventTarget(event) ?? ref?.();
|
|
396
|
+
if (target instanceof HTMLElement) {
|
|
397
|
+
suppressNextKeyboardClick = true;
|
|
398
|
+
isDispatchingKeyboardClick = true;
|
|
399
|
+
try {
|
|
400
|
+
target.click();
|
|
401
|
+
} finally {
|
|
402
|
+
isDispatchingKeyboardClick = false;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
onKeyUp: (event) => {
|
|
407
|
+
if (event.key === " " || event.key === "Enter") suppressNextKeyboardClick = false;
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
const { hoverProps } = createHover({
|
|
411
|
+
get isDisabled() {
|
|
412
|
+
return isDisabled();
|
|
413
|
+
},
|
|
414
|
+
onHoverStart() {
|
|
415
|
+
state.setFocusedKey(getProps().key);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
const { isFocusVisible, focusProps } = createFocusRing();
|
|
419
|
+
const labelId = `${getProps().key}-label`;
|
|
420
|
+
const descriptionId = createSlotId();
|
|
421
|
+
const keyboardId = createSlotId();
|
|
422
|
+
return {
|
|
423
|
+
get menuItemProps() {
|
|
424
|
+
const p = getProps();
|
|
425
|
+
const key = p.key;
|
|
426
|
+
const ariaLabel = p["aria-label"];
|
|
427
|
+
const mode = selectionMode();
|
|
428
|
+
const selected = isSelected();
|
|
429
|
+
const trigger = isTrigger();
|
|
430
|
+
const baseProps = {
|
|
431
|
+
role: trigger ? "menuitem" : mode === "single" ? "menuitemradio" : mode === "multiple" ? "menuitemcheckbox" : "menuitem",
|
|
432
|
+
id: p.id ?? String(key),
|
|
433
|
+
"aria-disabled": isDisabled() || void 0,
|
|
434
|
+
"aria-checked": mode !== "none" && !trigger ? selected : void 0,
|
|
435
|
+
"aria-label": ariaLabel,
|
|
436
|
+
"aria-labelledby": !ariaLabel ? labelId : void 0,
|
|
437
|
+
"aria-describedby": [descriptionId(), keyboardId()].filter(Boolean).join(" ") || void 0,
|
|
438
|
+
"aria-controls": p["aria-controls"],
|
|
439
|
+
"aria-haspopup": p["aria-haspopup"],
|
|
440
|
+
"aria-expanded": p["aria-expanded"],
|
|
441
|
+
"data-selected": selected || void 0,
|
|
442
|
+
"data-focused": isFocused() || void 0,
|
|
443
|
+
"data-focus-visible": isFocusVisible() || void 0,
|
|
444
|
+
"data-pressed": isPressed() || void 0,
|
|
445
|
+
"data-disabled": isDisabled() || void 0
|
|
446
|
+
};
|
|
447
|
+
if (isLink()) {
|
|
448
|
+
baseProps.href = isDisabled() ? void 0 : p.href;
|
|
449
|
+
if (p.target) baseProps.target = p.target;
|
|
450
|
+
if (p.rel) baseProps.rel = p.rel;
|
|
451
|
+
if (p.download != null && p.download !== false) baseProps.download = p.download === true ? "" : p.download;
|
|
452
|
+
}
|
|
453
|
+
return mergeProps$1(selectableItemProps(), menuPressProps(), hoverProps, focusProps, keyboardProps, { onClick: performMenuAction }, baseProps);
|
|
454
|
+
},
|
|
455
|
+
labelProps: { id: labelId },
|
|
456
|
+
get descriptionProps() {
|
|
457
|
+
return { id: descriptionId() };
|
|
458
|
+
},
|
|
459
|
+
get keyboardShortcutProps() {
|
|
460
|
+
return {
|
|
461
|
+
id: keyboardId(),
|
|
462
|
+
"aria-hidden": true
|
|
463
|
+
};
|
|
464
|
+
},
|
|
465
|
+
isFocused,
|
|
466
|
+
isFocusVisible: () => isFocused() && isFocusVisible(),
|
|
467
|
+
isPressed,
|
|
468
|
+
isDisabled,
|
|
469
|
+
isSelected,
|
|
470
|
+
selectionMode
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region src/menu/createMenuTrigger.ts
|
|
475
|
+
/**
|
|
476
|
+
* Provides the behavior and accessibility implementation for a menu trigger.
|
|
477
|
+
*/
|
|
478
|
+
function createMenuTrigger(props, state) {
|
|
479
|
+
const getProps = () => access(props);
|
|
480
|
+
const menuId = createId(getProps().id);
|
|
481
|
+
const onPress = () => {
|
|
482
|
+
if (!getProps().isDisabled) state.toggle();
|
|
483
|
+
};
|
|
484
|
+
const onKeyDown = (e) => {
|
|
485
|
+
if (getProps().isDisabled) return;
|
|
486
|
+
switch (e.key) {
|
|
487
|
+
case "Enter":
|
|
488
|
+
case " ":
|
|
489
|
+
case "ArrowDown":
|
|
490
|
+
e.preventDefault();
|
|
491
|
+
if (!state.isOpen()) state.open();
|
|
492
|
+
break;
|
|
493
|
+
case "ArrowUp":
|
|
494
|
+
e.preventDefault();
|
|
495
|
+
if (!state.isOpen()) state.open();
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
return {
|
|
500
|
+
get menuTriggerProps() {
|
|
501
|
+
const p = getProps();
|
|
502
|
+
const type = p.type ?? "menu";
|
|
503
|
+
const isOpen = state.isOpen();
|
|
504
|
+
return {
|
|
505
|
+
"aria-haspopup": type,
|
|
506
|
+
"aria-expanded": isOpen,
|
|
507
|
+
"aria-controls": isOpen ? menuId : void 0,
|
|
508
|
+
"aria-disabled": p.isDisabled || void 0,
|
|
509
|
+
onPress,
|
|
510
|
+
onKeyDown
|
|
511
|
+
};
|
|
512
|
+
},
|
|
513
|
+
menuProps: { id: menuId }
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
//#endregion
|
|
517
|
+
export { getMenuData as i, createMenuItem as n, createMenu as r, createMenuTrigger as t };
|
|
518
|
+
|
|
519
|
+
//# sourceMappingURL=menu.js.map
|