@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,1393 @@
|
|
|
1
|
+
import { t as createPress } from "./createPress.js";
|
|
2
|
+
import { i as access, o as mergeProps } from "./env.js";
|
|
3
|
+
import { S as scrollIntoViewport } from "./utils.js";
|
|
4
|
+
import { a as getEventTarget, l as getScrollParent, t as focusSafely, y as nodeContains } from "./focus.js";
|
|
5
|
+
import { a as useLocale } from "./createCollator.js";
|
|
6
|
+
import { createId } from "../ssr/index.js";
|
|
7
|
+
import { t as createLabel } from "./createLabel.js";
|
|
8
|
+
import { createMemo, createSignal, onCleanup } from "solid-js";
|
|
9
|
+
import { DateFormatter, getLocalTimeZone } from "@internationalized/date";
|
|
10
|
+
//#region src/datepicker/createDateField.ts
|
|
11
|
+
/**
|
|
12
|
+
* createDateField hook for Solidaria
|
|
13
|
+
*
|
|
14
|
+
* Provides the behavior and accessibility implementation for a date field component.
|
|
15
|
+
* Based on @react-aria/datepicker useDateField
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Provides the behavior and accessibility implementation for a date field component.
|
|
19
|
+
*/
|
|
20
|
+
function createDateField(props, state, _ref, overlayState) {
|
|
21
|
+
const getProps = () => access(props);
|
|
22
|
+
const id = createId(getProps().id);
|
|
23
|
+
const descriptionId = createId();
|
|
24
|
+
const errorMessageId = createId();
|
|
25
|
+
const locale = useLocale();
|
|
26
|
+
const { labelProps, fieldProps: labelFieldProps } = createLabel({
|
|
27
|
+
get label() {
|
|
28
|
+
return getProps().label;
|
|
29
|
+
},
|
|
30
|
+
get "aria-label"() {
|
|
31
|
+
return getProps()["aria-label"];
|
|
32
|
+
},
|
|
33
|
+
get "aria-labelledby"() {
|
|
34
|
+
return getProps()["aria-labelledby"];
|
|
35
|
+
},
|
|
36
|
+
labelElementType: "span"
|
|
37
|
+
});
|
|
38
|
+
const getAriaDescribedBy = () => {
|
|
39
|
+
const p = getProps();
|
|
40
|
+
const ids = [];
|
|
41
|
+
if (p["aria-describedby"]) ids.push(p["aria-describedby"]);
|
|
42
|
+
if (p.description) ids.push(descriptionId);
|
|
43
|
+
if ((p.isInvalid || state.isInvalid()) && p.errorMessage) ids.push(errorMessageId);
|
|
44
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
45
|
+
};
|
|
46
|
+
const segments = createMemo(() => state.segments());
|
|
47
|
+
const getLabelId = () => labelProps.id;
|
|
48
|
+
const getRoleDescription = () => {
|
|
49
|
+
return (locale().locale.toLowerCase().split("-")[0] ?? "en") === "es" ? "Campo de fecha" : "Date field";
|
|
50
|
+
};
|
|
51
|
+
const focusSegment = (target, container) => {
|
|
52
|
+
const spinbuttons = Array.from(container.querySelectorAll("[role=\"spinbutton\"]"));
|
|
53
|
+
if (spinbuttons.length === 0) return;
|
|
54
|
+
const active = document.activeElement;
|
|
55
|
+
const currentIndex = active ? spinbuttons.indexOf(active) : -1;
|
|
56
|
+
if (target === "first") {
|
|
57
|
+
spinbuttons[0]?.focus();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (target === "last") {
|
|
61
|
+
spinbuttons[spinbuttons.length - 1]?.focus();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
let nextIndex;
|
|
65
|
+
if (currentIndex < 0) nextIndex = target === "next" ? 0 : spinbuttons.length - 1;
|
|
66
|
+
else nextIndex = target === "next" ? currentIndex + 1 : currentIndex - 1;
|
|
67
|
+
if (nextIndex >= 0 && nextIndex < spinbuttons.length) spinbuttons[nextIndex]?.focus();
|
|
68
|
+
};
|
|
69
|
+
const fieldProps = createMemo(() => {
|
|
70
|
+
const p = getProps();
|
|
71
|
+
const baseProps = mergeProps(labelFieldProps, {
|
|
72
|
+
id,
|
|
73
|
+
role: "group",
|
|
74
|
+
"aria-disabled": p.isDisabled || state.isDisabled() || void 0,
|
|
75
|
+
"aria-readonly": p.isReadOnly || state.isReadOnly() || void 0,
|
|
76
|
+
"aria-required": p.isRequired || state.isRequired() || void 0,
|
|
77
|
+
"aria-invalid": p.isInvalid || state.isInvalid() || void 0,
|
|
78
|
+
"aria-describedby": getAriaDescribedBy()
|
|
79
|
+
});
|
|
80
|
+
if (overlayState) {
|
|
81
|
+
const existingOnKeyDown = baseProps.onKeyDown;
|
|
82
|
+
baseProps.onKeyDown = (e) => {
|
|
83
|
+
existingOnKeyDown?.(e);
|
|
84
|
+
if (e.altKey && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
overlayState.open();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return baseProps;
|
|
92
|
+
});
|
|
93
|
+
const inputProps = createMemo(() => {
|
|
94
|
+
const p = getProps();
|
|
95
|
+
const labelId = getLabelId();
|
|
96
|
+
const ariaLabelledBy = labelId ? p["aria-labelledby"] ? `${labelId} ${p["aria-labelledby"]}` : labelId : p["aria-labelledby"];
|
|
97
|
+
const isDisabled = p.isDisabled || state.isDisabled();
|
|
98
|
+
const isReadOnly = p.isReadOnly || state.isReadOnly();
|
|
99
|
+
const isRequired = p.isRequired || state.isRequired();
|
|
100
|
+
const isInvalid = p.isInvalid || state.isInvalid();
|
|
101
|
+
const hasValue = state.value() != null;
|
|
102
|
+
return {
|
|
103
|
+
role: "presentation",
|
|
104
|
+
"aria-labelledby": ariaLabelledBy,
|
|
105
|
+
"aria-describedby": getAriaDescribedBy(),
|
|
106
|
+
"aria-disabled": isDisabled || void 0,
|
|
107
|
+
"aria-readonly": isReadOnly || void 0,
|
|
108
|
+
"aria-required": isRequired || void 0,
|
|
109
|
+
"aria-invalid": isInvalid || void 0,
|
|
110
|
+
"aria-roledescription": getRoleDescription(),
|
|
111
|
+
autoFocus: p.autoFocus,
|
|
112
|
+
contentEditable: true,
|
|
113
|
+
suppressContentEditableWarning: true,
|
|
114
|
+
spellCheck: false,
|
|
115
|
+
autoCorrect: "off",
|
|
116
|
+
enterKeyHint: "next",
|
|
117
|
+
inputMode: "numeric",
|
|
118
|
+
style: { caretColor: "transparent" },
|
|
119
|
+
"data-placeholder": !hasValue ? "true" : void 0,
|
|
120
|
+
onKeyDown: (e) => {
|
|
121
|
+
const target = e.target;
|
|
122
|
+
const currentTarget = e.currentTarget;
|
|
123
|
+
if (target !== currentTarget) return;
|
|
124
|
+
const rtl = locale().direction === "rtl";
|
|
125
|
+
switch (e.key) {
|
|
126
|
+
case "ArrowRight":
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
focusSegment(rtl ? "prev" : "next", currentTarget);
|
|
129
|
+
break;
|
|
130
|
+
case "ArrowLeft":
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
focusSegment(rtl ? "next" : "prev", currentTarget);
|
|
133
|
+
break;
|
|
134
|
+
case "Home":
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
focusSegment("first", currentTarget);
|
|
137
|
+
break;
|
|
138
|
+
case "End":
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
focusSegment("last", currentTarget);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
onFocus: () => {},
|
|
145
|
+
onBlur: () => {
|
|
146
|
+
state.confirmPlaceholder();
|
|
147
|
+
},
|
|
148
|
+
onClick: (e) => {
|
|
149
|
+
const target = e.target;
|
|
150
|
+
const currentTarget = e.currentTarget;
|
|
151
|
+
if (target !== currentTarget) return;
|
|
152
|
+
const spinbuttons = Array.from(currentTarget.querySelectorAll("[role=\"spinbutton\"]"));
|
|
153
|
+
if (spinbuttons.length > 0) spinbuttons[0].focus();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
const descriptionProps = createMemo(() => ({ id: descriptionId }));
|
|
158
|
+
const errorMessageProps = createMemo(() => ({
|
|
159
|
+
id: errorMessageId,
|
|
160
|
+
role: "alert"
|
|
161
|
+
}));
|
|
162
|
+
return {
|
|
163
|
+
get labelProps() {
|
|
164
|
+
return labelProps;
|
|
165
|
+
},
|
|
166
|
+
get fieldProps() {
|
|
167
|
+
return fieldProps();
|
|
168
|
+
},
|
|
169
|
+
get inputProps() {
|
|
170
|
+
return inputProps();
|
|
171
|
+
},
|
|
172
|
+
get descriptionProps() {
|
|
173
|
+
return descriptionProps();
|
|
174
|
+
},
|
|
175
|
+
get errorMessageProps() {
|
|
176
|
+
return errorMessageProps();
|
|
177
|
+
},
|
|
178
|
+
get segments() {
|
|
179
|
+
return segments();
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/datepicker/createDateSegment.ts
|
|
185
|
+
/**
|
|
186
|
+
* createDateSegment hook for Solidaria
|
|
187
|
+
*
|
|
188
|
+
* Provides the behavior and accessibility implementation for a date segment.
|
|
189
|
+
* Based on @react-aria/datepicker useDateSegment
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* Provides the behavior and accessibility implementation for a date segment.
|
|
193
|
+
*/
|
|
194
|
+
function createDateSegment(props, state, ref) {
|
|
195
|
+
const getProps = () => access(props);
|
|
196
|
+
const [isFocused, setIsFocused] = createSignal(false);
|
|
197
|
+
const [isFocusVisible, setIsFocusVisible] = createSignal(false);
|
|
198
|
+
const [isHovered, setIsHovered] = createSignal(false);
|
|
199
|
+
const [enteredKeys, setEnteredKeys] = createSignal("");
|
|
200
|
+
const [isComposing, setIsComposing] = createSignal(false);
|
|
201
|
+
const locale = useLocale();
|
|
202
|
+
const segment = createMemo(() => getProps().segment);
|
|
203
|
+
const isEditable = createMemo(() => {
|
|
204
|
+
return segment().isEditable && !state.isDisabled() && !state.isReadOnly();
|
|
205
|
+
});
|
|
206
|
+
let longPressTimeout = null;
|
|
207
|
+
let longPressInterval = null;
|
|
208
|
+
let hadPointerDown = false;
|
|
209
|
+
const clearLongPress = () => {
|
|
210
|
+
if (longPressTimeout) {
|
|
211
|
+
clearTimeout(longPressTimeout);
|
|
212
|
+
longPressTimeout = null;
|
|
213
|
+
}
|
|
214
|
+
if (longPressInterval) {
|
|
215
|
+
clearInterval(longPressInterval);
|
|
216
|
+
longPressInterval = null;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const startLongPress = (action) => {
|
|
220
|
+
clearLongPress();
|
|
221
|
+
longPressTimeout = setTimeout(() => {
|
|
222
|
+
action();
|
|
223
|
+
longPressInterval = setInterval(() => {
|
|
224
|
+
action();
|
|
225
|
+
}, 100);
|
|
226
|
+
}, 300);
|
|
227
|
+
};
|
|
228
|
+
onCleanup(() => {
|
|
229
|
+
clearLongPress();
|
|
230
|
+
});
|
|
231
|
+
const focusSegment = (target) => {
|
|
232
|
+
const el = ref?.();
|
|
233
|
+
if (!el) return;
|
|
234
|
+
const container = el.parentElement;
|
|
235
|
+
if (!container) return;
|
|
236
|
+
const segments = Array.from(container.querySelectorAll("[role=\"spinbutton\"]"));
|
|
237
|
+
if (segments.length === 0) return;
|
|
238
|
+
if (target === "first") {
|
|
239
|
+
segments[0]?.focus();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (target === "last") {
|
|
243
|
+
segments[segments.length - 1]?.focus();
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const currentIndex = segments.indexOf(el);
|
|
247
|
+
if (currentIndex < 0) return;
|
|
248
|
+
const nextIndex = target === "next" ? currentIndex + 1 : currentIndex - 1;
|
|
249
|
+
if (nextIndex >= 0 && nextIndex < segments.length) segments[nextIndex]?.focus();
|
|
250
|
+
};
|
|
251
|
+
const clearCurrentSegment = (type) => {
|
|
252
|
+
state.clearSegment(type);
|
|
253
|
+
setEnteredKeys("");
|
|
254
|
+
};
|
|
255
|
+
const handleKeyDown = (e) => {
|
|
256
|
+
if (!isEditable()) return;
|
|
257
|
+
if (isComposing()) return;
|
|
258
|
+
const seg = segment();
|
|
259
|
+
const type = seg.type;
|
|
260
|
+
if (type === "literal") return;
|
|
261
|
+
setIsFocusVisible(true);
|
|
262
|
+
switch (e.key) {
|
|
263
|
+
case "ArrowRight":
|
|
264
|
+
e.preventDefault();
|
|
265
|
+
focusSegment(locale().direction === "rtl" ? "prev" : "next");
|
|
266
|
+
break;
|
|
267
|
+
case "ArrowLeft":
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
focusSegment(locale().direction === "rtl" ? "next" : "prev");
|
|
270
|
+
break;
|
|
271
|
+
case "ArrowUp":
|
|
272
|
+
e.preventDefault();
|
|
273
|
+
state.incrementSegment(type);
|
|
274
|
+
if (!e.repeat) startLongPress(() => state.incrementSegment(type));
|
|
275
|
+
break;
|
|
276
|
+
case "ArrowDown":
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
state.decrementSegment(type);
|
|
279
|
+
if (!e.repeat) startLongPress(() => state.decrementSegment(type));
|
|
280
|
+
break;
|
|
281
|
+
case "Home":
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
focusSegment("first");
|
|
284
|
+
break;
|
|
285
|
+
case "End":
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
focusSegment("last");
|
|
288
|
+
break;
|
|
289
|
+
case "Backspace":
|
|
290
|
+
e.preventDefault();
|
|
291
|
+
if (seg.isPlaceholder) focusSegment("prev");
|
|
292
|
+
else clearCurrentSegment(type);
|
|
293
|
+
break;
|
|
294
|
+
case "Delete":
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
clearCurrentSegment(type);
|
|
297
|
+
break;
|
|
298
|
+
default:
|
|
299
|
+
const normalizedDigit = normalizeDigit$1(e.key);
|
|
300
|
+
if (normalizedDigit) {
|
|
301
|
+
e.preventDefault();
|
|
302
|
+
handleNumericInput(normalizedDigit, type, seg);
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
const handleKeyUp = () => {
|
|
308
|
+
clearLongPress();
|
|
309
|
+
};
|
|
310
|
+
const handleNumericInput = (key, type, seg) => {
|
|
311
|
+
const newKeys = enteredKeys() + key;
|
|
312
|
+
const numValue = parseInt(newKeys, 10);
|
|
313
|
+
const maxValue = seg.maxValue ?? 99;
|
|
314
|
+
const minValue = seg.minValue ?? 0;
|
|
315
|
+
const maxDigits = String(maxValue).length;
|
|
316
|
+
if (numValue <= maxValue) {
|
|
317
|
+
state.setSegment(type, numValue);
|
|
318
|
+
if (parseInt(newKeys + "0", 10) > maxValue || newKeys.length >= maxDigits) {
|
|
319
|
+
setEnteredKeys("");
|
|
320
|
+
focusSegment("next");
|
|
321
|
+
} else setEnteredKeys(newKeys);
|
|
322
|
+
} else {
|
|
323
|
+
const singleValue = parseInt(key, 10);
|
|
324
|
+
if (singleValue >= minValue && singleValue <= maxValue) {
|
|
325
|
+
state.setSegment(type, singleValue);
|
|
326
|
+
if (parseInt(key + "0", 10) > maxValue || key.length >= maxDigits) {
|
|
327
|
+
setEnteredKeys("");
|
|
328
|
+
focusSegment("next");
|
|
329
|
+
} else setEnteredKeys(key);
|
|
330
|
+
} else setEnteredKeys("");
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
const handleBeforeInput = (e) => {
|
|
334
|
+
if (!isEditable()) return;
|
|
335
|
+
if (isComposing()) return;
|
|
336
|
+
const seg = segment();
|
|
337
|
+
if (seg.type === "literal") return;
|
|
338
|
+
if (e.inputType === "deleteContentBackward" || e.inputType === "deleteContentForward") {
|
|
339
|
+
e.preventDefault();
|
|
340
|
+
clearCurrentSegment(seg.type);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (e.inputType === "insertText" && e.data) {
|
|
344
|
+
const normalizedDigit = normalizeDigit$1(e.data);
|
|
345
|
+
if (!normalizedDigit) return;
|
|
346
|
+
e.preventDefault();
|
|
347
|
+
handleNumericInput(normalizedDigit, seg.type, seg);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
const handleCompositionStart = () => {
|
|
351
|
+
if (!isEditable()) return;
|
|
352
|
+
setIsComposing(true);
|
|
353
|
+
setEnteredKeys("");
|
|
354
|
+
};
|
|
355
|
+
const handleCompositionEnd = (e) => {
|
|
356
|
+
if (!isEditable()) return;
|
|
357
|
+
setIsComposing(false);
|
|
358
|
+
const seg = segment();
|
|
359
|
+
if (seg.type === "literal") return;
|
|
360
|
+
const digits = extractNormalizedDigits$1(e.data ?? "");
|
|
361
|
+
if (digits.length === 0) return;
|
|
362
|
+
for (const digit of digits) handleNumericInput(digit, seg.type, seg);
|
|
363
|
+
};
|
|
364
|
+
const handleFocus = () => {
|
|
365
|
+
setIsFocused(true);
|
|
366
|
+
setEnteredKeys("");
|
|
367
|
+
if (!hadPointerDown) setIsFocusVisible(true);
|
|
368
|
+
hadPointerDown = false;
|
|
369
|
+
const el = ref?.();
|
|
370
|
+
if (el) scrollIntoViewport(el, { containingElement: getScrollParent(el) });
|
|
371
|
+
if (el && typeof window !== "undefined") {
|
|
372
|
+
const selection = window.getSelection();
|
|
373
|
+
if (selection) {
|
|
374
|
+
const range = new Range();
|
|
375
|
+
range.selectNodeContents(el);
|
|
376
|
+
selection.removeAllRanges();
|
|
377
|
+
selection.addRange(range);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
const handleBlur = () => {
|
|
382
|
+
setIsFocused(false);
|
|
383
|
+
setIsFocusVisible(false);
|
|
384
|
+
setEnteredKeys("");
|
|
385
|
+
clearLongPress();
|
|
386
|
+
state.confirmPlaceholder();
|
|
387
|
+
};
|
|
388
|
+
const handleMouseEnter = () => {
|
|
389
|
+
setIsHovered(true);
|
|
390
|
+
};
|
|
391
|
+
const handleMouseLeave = () => {
|
|
392
|
+
setIsHovered(false);
|
|
393
|
+
};
|
|
394
|
+
const segmentProps = createMemo(() => {
|
|
395
|
+
const seg = segment();
|
|
396
|
+
const type = seg.type;
|
|
397
|
+
const p = getProps();
|
|
398
|
+
if (type === "literal") return { "aria-hidden": true };
|
|
399
|
+
return {
|
|
400
|
+
role: "spinbutton",
|
|
401
|
+
tabIndex: isEditable() ? 0 : -1,
|
|
402
|
+
"aria-label": getSegmentLabel$1(type, locale().locale),
|
|
403
|
+
"aria-valuenow": seg.value,
|
|
404
|
+
"aria-valuemin": seg.minValue,
|
|
405
|
+
"aria-valuemax": seg.maxValue,
|
|
406
|
+
"aria-valuetext": seg.isPlaceholder ? "" : seg.text,
|
|
407
|
+
"aria-readonly": state.isReadOnly() || void 0,
|
|
408
|
+
"aria-disabled": state.isDisabled() || void 0,
|
|
409
|
+
"aria-invalid": state.isInvalid() || void 0,
|
|
410
|
+
"aria-controls": p["aria-controls"] || void 0,
|
|
411
|
+
"aria-describedby": p["aria-describedby"] || void 0,
|
|
412
|
+
contentEditable: isEditable(),
|
|
413
|
+
suppressContentEditableWarning: true,
|
|
414
|
+
inputMode: "numeric",
|
|
415
|
+
autoCorrect: "off",
|
|
416
|
+
enterKeyHint: "next",
|
|
417
|
+
spellCheck: false,
|
|
418
|
+
"data-placeholder": seg.isPlaceholder ? "true" : void 0,
|
|
419
|
+
"data-readonly": state.isReadOnly() || void 0,
|
|
420
|
+
"data-disabled": state.isDisabled() || void 0,
|
|
421
|
+
"data-invalid": state.isInvalid() || void 0,
|
|
422
|
+
"data-type": seg.type,
|
|
423
|
+
"data-hovered": isHovered() || void 0,
|
|
424
|
+
"data-focused": isFocused() || void 0,
|
|
425
|
+
"data-focus-visible": isFocusVisible() || void 0,
|
|
426
|
+
onKeyDown: handleKeyDown,
|
|
427
|
+
onKeyUp: handleKeyUp,
|
|
428
|
+
onFocus: handleFocus,
|
|
429
|
+
onBlur: handleBlur,
|
|
430
|
+
onBeforeInput: handleBeforeInput,
|
|
431
|
+
onCompositionStart: handleCompositionStart,
|
|
432
|
+
onCompositionEnd: handleCompositionEnd,
|
|
433
|
+
onMouseEnter: handleMouseEnter,
|
|
434
|
+
onMouseLeave: handleMouseLeave,
|
|
435
|
+
onPointerDown: (e) => {
|
|
436
|
+
e.preventDefault();
|
|
437
|
+
hadPointerDown = true;
|
|
438
|
+
setIsFocusVisible(false);
|
|
439
|
+
},
|
|
440
|
+
onPointerUp: () => {
|
|
441
|
+
clearLongPress();
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
});
|
|
445
|
+
const text = createMemo(() => {
|
|
446
|
+
const seg = segment();
|
|
447
|
+
return seg.isPlaceholder ? seg.placeholder : seg.text;
|
|
448
|
+
});
|
|
449
|
+
return {
|
|
450
|
+
get segmentProps() {
|
|
451
|
+
return segmentProps();
|
|
452
|
+
},
|
|
453
|
+
get isFocused() {
|
|
454
|
+
return isFocused();
|
|
455
|
+
},
|
|
456
|
+
get isEditable() {
|
|
457
|
+
return isEditable();
|
|
458
|
+
},
|
|
459
|
+
get isPlaceholder() {
|
|
460
|
+
return segment().isPlaceholder;
|
|
461
|
+
},
|
|
462
|
+
get text() {
|
|
463
|
+
return text();
|
|
464
|
+
},
|
|
465
|
+
get isHovered() {
|
|
466
|
+
return isHovered();
|
|
467
|
+
},
|
|
468
|
+
get isFocusVisible() {
|
|
469
|
+
return isFocusVisible();
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
const SEGMENT_LABELS$1 = {
|
|
474
|
+
en: {
|
|
475
|
+
year: "Year",
|
|
476
|
+
month: "Month",
|
|
477
|
+
day: "Day",
|
|
478
|
+
hour: "Hour",
|
|
479
|
+
minute: "Minute",
|
|
480
|
+
second: "Second",
|
|
481
|
+
dayPeriod: "AM/PM",
|
|
482
|
+
era: "Era",
|
|
483
|
+
timeZoneName: "Time zone"
|
|
484
|
+
},
|
|
485
|
+
es: {
|
|
486
|
+
year: "Año",
|
|
487
|
+
month: "Mes",
|
|
488
|
+
day: "Día",
|
|
489
|
+
hour: "Hora",
|
|
490
|
+
minute: "Minuto",
|
|
491
|
+
second: "Segundo",
|
|
492
|
+
dayPeriod: "AM/PM",
|
|
493
|
+
era: "Era",
|
|
494
|
+
timeZoneName: "Zona horaria"
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
function getSegmentLabel$1(type, locale) {
|
|
498
|
+
if (type === "literal") return "";
|
|
499
|
+
return (SEGMENT_LABELS$1[locale.toLowerCase().split("-")[0] ?? "en"] ?? SEGMENT_LABELS$1.en)[type];
|
|
500
|
+
}
|
|
501
|
+
function normalizeDigit$1(input) {
|
|
502
|
+
if (/^[0-9]$/.test(input)) return input;
|
|
503
|
+
const codePoint = input.codePointAt(0);
|
|
504
|
+
if (codePoint == null) return null;
|
|
505
|
+
if (codePoint >= 65296 && codePoint <= 65305) return String(codePoint - 65296);
|
|
506
|
+
return null;
|
|
507
|
+
}
|
|
508
|
+
function extractNormalizedDigits$1(value) {
|
|
509
|
+
const digits = [];
|
|
510
|
+
for (const char of value) {
|
|
511
|
+
const normalized = normalizeDigit$1(char);
|
|
512
|
+
if (normalized) digits.push(normalized);
|
|
513
|
+
}
|
|
514
|
+
return digits;
|
|
515
|
+
}
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/datepicker/createTimeField.ts
|
|
518
|
+
/**
|
|
519
|
+
* createTimeField hook for Solidaria
|
|
520
|
+
*
|
|
521
|
+
* Provides the behavior and accessibility implementation for a time field component.
|
|
522
|
+
* Based on @react-aria/datepicker useTimeField
|
|
523
|
+
*/
|
|
524
|
+
/**
|
|
525
|
+
* Provides the behavior and accessibility implementation for a time field component.
|
|
526
|
+
*/
|
|
527
|
+
function createTimeField(props, state, _ref) {
|
|
528
|
+
const getProps = () => access(props);
|
|
529
|
+
const id = createId(getProps().id);
|
|
530
|
+
const descriptionId = createId();
|
|
531
|
+
const errorMessageId = createId();
|
|
532
|
+
const { labelProps, fieldProps: labelFieldProps } = createLabel({
|
|
533
|
+
get label() {
|
|
534
|
+
return getProps().label;
|
|
535
|
+
},
|
|
536
|
+
get "aria-label"() {
|
|
537
|
+
return getProps()["aria-label"];
|
|
538
|
+
},
|
|
539
|
+
get "aria-labelledby"() {
|
|
540
|
+
return getProps()["aria-labelledby"];
|
|
541
|
+
},
|
|
542
|
+
labelElementType: "span"
|
|
543
|
+
});
|
|
544
|
+
const getAriaDescribedBy = () => {
|
|
545
|
+
const p = getProps();
|
|
546
|
+
const ids = [];
|
|
547
|
+
if (p["aria-describedby"]) ids.push(p["aria-describedby"]);
|
|
548
|
+
if (p.description) ids.push(descriptionId);
|
|
549
|
+
if ((p.isInvalid || state.isInvalid()) && p.errorMessage) ids.push(errorMessageId);
|
|
550
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
551
|
+
};
|
|
552
|
+
const segments = createMemo(() => state.segments());
|
|
553
|
+
const fieldProps = createMemo(() => {
|
|
554
|
+
const p = getProps();
|
|
555
|
+
return mergeProps(labelFieldProps, {
|
|
556
|
+
id,
|
|
557
|
+
role: "group",
|
|
558
|
+
"aria-disabled": p.isDisabled || state.isDisabled() || void 0,
|
|
559
|
+
"aria-readonly": p.isReadOnly || state.isReadOnly() || void 0,
|
|
560
|
+
"aria-required": p.isRequired || state.isRequired() || void 0,
|
|
561
|
+
"aria-invalid": p.isInvalid || state.isInvalid() || void 0,
|
|
562
|
+
"aria-describedby": getAriaDescribedBy()
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
const inputProps = createMemo(() => ({ role: "presentation" }));
|
|
566
|
+
const descriptionProps = createMemo(() => ({ id: descriptionId }));
|
|
567
|
+
const errorMessageProps = createMemo(() => ({
|
|
568
|
+
id: errorMessageId,
|
|
569
|
+
role: "alert"
|
|
570
|
+
}));
|
|
571
|
+
return {
|
|
572
|
+
get labelProps() {
|
|
573
|
+
return labelProps;
|
|
574
|
+
},
|
|
575
|
+
get fieldProps() {
|
|
576
|
+
return fieldProps();
|
|
577
|
+
},
|
|
578
|
+
get inputProps() {
|
|
579
|
+
return inputProps();
|
|
580
|
+
},
|
|
581
|
+
get descriptionProps() {
|
|
582
|
+
return descriptionProps();
|
|
583
|
+
},
|
|
584
|
+
get errorMessageProps() {
|
|
585
|
+
return errorMessageProps();
|
|
586
|
+
},
|
|
587
|
+
get segments() {
|
|
588
|
+
return segments();
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region src/datepicker/createTimeSegment.ts
|
|
594
|
+
/**
|
|
595
|
+
* createTimeSegment hook for Solidaria
|
|
596
|
+
*
|
|
597
|
+
* Provides the behavior and accessibility implementation for a time segment.
|
|
598
|
+
* Based on @react-aria/datepicker useDateSegment semantics (time-field scope).
|
|
599
|
+
*/
|
|
600
|
+
/**
|
|
601
|
+
* Provides the behavior and accessibility implementation for a time segment.
|
|
602
|
+
*/
|
|
603
|
+
function createTimeSegment(props, state, ref) {
|
|
604
|
+
const getProps = () => access(props);
|
|
605
|
+
const [isFocused, setIsFocused] = createSignal(false);
|
|
606
|
+
const [enteredKeys, setEnteredKeys] = createSignal("");
|
|
607
|
+
const [isComposing, setIsComposing] = createSignal(false);
|
|
608
|
+
const locale = useLocale();
|
|
609
|
+
const segment = createMemo(() => getProps().segment);
|
|
610
|
+
const isEditable = createMemo(() => {
|
|
611
|
+
return segment().isEditable && !state.isDisabled() && !state.isReadOnly();
|
|
612
|
+
});
|
|
613
|
+
const focusSegment = (target) => {
|
|
614
|
+
const el = ref?.();
|
|
615
|
+
if (!el) return;
|
|
616
|
+
const container = el.parentElement;
|
|
617
|
+
if (!container) return;
|
|
618
|
+
const segments = Array.from(container.querySelectorAll("[role=\"spinbutton\"]"));
|
|
619
|
+
if (segments.length === 0) return;
|
|
620
|
+
if (target === "first") {
|
|
621
|
+
segments[0]?.focus();
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
if (target === "last") {
|
|
625
|
+
segments[segments.length - 1]?.focus();
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
const currentIndex = segments.indexOf(el);
|
|
629
|
+
if (currentIndex < 0) return;
|
|
630
|
+
const nextIndex = target === "next" ? currentIndex + 1 : currentIndex - 1;
|
|
631
|
+
if (nextIndex >= 0 && nextIndex < segments.length) segments[nextIndex]?.focus();
|
|
632
|
+
};
|
|
633
|
+
const clearCurrentSegment = (type) => {
|
|
634
|
+
state.clearSegment(type);
|
|
635
|
+
setEnteredKeys("");
|
|
636
|
+
};
|
|
637
|
+
const handleNumericInput = (key, type, seg) => {
|
|
638
|
+
const newKeys = enteredKeys() + key;
|
|
639
|
+
const numValue = parseInt(newKeys, 10);
|
|
640
|
+
const maxValue = seg.maxValue ?? 99;
|
|
641
|
+
const minValue = seg.minValue ?? 0;
|
|
642
|
+
const maxDigits = String(maxValue).length;
|
|
643
|
+
if (numValue <= maxValue) {
|
|
644
|
+
state.setSegment(type, numValue);
|
|
645
|
+
if (parseInt(newKeys + "0", 10) > maxValue || newKeys.length >= maxDigits) {
|
|
646
|
+
setEnteredKeys("");
|
|
647
|
+
focusSegment("next");
|
|
648
|
+
} else setEnteredKeys(newKeys);
|
|
649
|
+
} else {
|
|
650
|
+
const singleValue = parseInt(key, 10);
|
|
651
|
+
if (singleValue >= minValue && singleValue <= maxValue) {
|
|
652
|
+
state.setSegment(type, singleValue);
|
|
653
|
+
if (parseInt(key + "0", 10) > maxValue || key.length >= maxDigits) {
|
|
654
|
+
setEnteredKeys("");
|
|
655
|
+
focusSegment("next");
|
|
656
|
+
} else setEnteredKeys(key);
|
|
657
|
+
} else setEnteredKeys("");
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
const handleKeyDown = (e) => {
|
|
661
|
+
if (!isEditable()) return;
|
|
662
|
+
if (isComposing()) return;
|
|
663
|
+
const seg = segment();
|
|
664
|
+
const type = seg.type;
|
|
665
|
+
if (type === "literal") return;
|
|
666
|
+
switch (e.key) {
|
|
667
|
+
case "ArrowRight":
|
|
668
|
+
e.preventDefault();
|
|
669
|
+
focusSegment(locale().direction === "rtl" ? "prev" : "next");
|
|
670
|
+
break;
|
|
671
|
+
case "ArrowLeft":
|
|
672
|
+
e.preventDefault();
|
|
673
|
+
focusSegment(locale().direction === "rtl" ? "next" : "prev");
|
|
674
|
+
break;
|
|
675
|
+
case "ArrowUp":
|
|
676
|
+
e.preventDefault();
|
|
677
|
+
state.incrementSegment(type);
|
|
678
|
+
break;
|
|
679
|
+
case "ArrowDown":
|
|
680
|
+
e.preventDefault();
|
|
681
|
+
state.decrementSegment(type);
|
|
682
|
+
break;
|
|
683
|
+
case "Home":
|
|
684
|
+
e.preventDefault();
|
|
685
|
+
focusSegment("first");
|
|
686
|
+
break;
|
|
687
|
+
case "End":
|
|
688
|
+
e.preventDefault();
|
|
689
|
+
focusSegment("last");
|
|
690
|
+
break;
|
|
691
|
+
case "Backspace":
|
|
692
|
+
e.preventDefault();
|
|
693
|
+
if (seg.isPlaceholder) focusSegment("prev");
|
|
694
|
+
else clearCurrentSegment(type);
|
|
695
|
+
break;
|
|
696
|
+
case "Delete":
|
|
697
|
+
e.preventDefault();
|
|
698
|
+
clearCurrentSegment(type);
|
|
699
|
+
break;
|
|
700
|
+
default:
|
|
701
|
+
const normalizedDigit = normalizeDigit(e.key);
|
|
702
|
+
if (normalizedDigit) {
|
|
703
|
+
e.preventDefault();
|
|
704
|
+
handleNumericInput(normalizedDigit, type, seg);
|
|
705
|
+
}
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
const handleBeforeInput = (e) => {
|
|
710
|
+
if (!isEditable()) return;
|
|
711
|
+
if (isComposing()) return;
|
|
712
|
+
const seg = segment();
|
|
713
|
+
if (seg.type === "literal") return;
|
|
714
|
+
if (e.inputType === "deleteContentBackward" || e.inputType === "deleteContentForward") {
|
|
715
|
+
e.preventDefault();
|
|
716
|
+
clearCurrentSegment(seg.type);
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
if (e.inputType === "insertText" && e.data) {
|
|
720
|
+
const normalizedDigit = normalizeDigit(e.data);
|
|
721
|
+
if (!normalizedDigit) return;
|
|
722
|
+
e.preventDefault();
|
|
723
|
+
handleNumericInput(normalizedDigit, seg.type, seg);
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
const handleCompositionStart = () => {
|
|
727
|
+
if (!isEditable()) return;
|
|
728
|
+
setIsComposing(true);
|
|
729
|
+
setEnteredKeys("");
|
|
730
|
+
};
|
|
731
|
+
const handleCompositionEnd = (e) => {
|
|
732
|
+
if (!isEditable()) return;
|
|
733
|
+
setIsComposing(false);
|
|
734
|
+
const seg = segment();
|
|
735
|
+
if (seg.type === "literal") return;
|
|
736
|
+
const digits = extractNormalizedDigits(e.data ?? "");
|
|
737
|
+
if (digits.length === 0) return;
|
|
738
|
+
for (const digit of digits) handleNumericInput(digit, seg.type, seg);
|
|
739
|
+
};
|
|
740
|
+
const handleFocus = () => {
|
|
741
|
+
setIsFocused(true);
|
|
742
|
+
setEnteredKeys("");
|
|
743
|
+
};
|
|
744
|
+
const handleBlur = () => {
|
|
745
|
+
setIsFocused(false);
|
|
746
|
+
setEnteredKeys("");
|
|
747
|
+
state.confirmPlaceholder?.();
|
|
748
|
+
};
|
|
749
|
+
const segmentProps = createMemo(() => {
|
|
750
|
+
const seg = segment();
|
|
751
|
+
const type = seg.type;
|
|
752
|
+
if (type === "literal") return { "aria-hidden": true };
|
|
753
|
+
return {
|
|
754
|
+
role: "spinbutton",
|
|
755
|
+
tabIndex: isEditable() ? 0 : -1,
|
|
756
|
+
"aria-label": getSegmentLabel(type, locale().locale),
|
|
757
|
+
"aria-valuenow": seg.value,
|
|
758
|
+
"aria-valuemin": seg.minValue,
|
|
759
|
+
"aria-valuemax": seg.maxValue,
|
|
760
|
+
"aria-valuetext": seg.isPlaceholder ? seg.placeholder : seg.text,
|
|
761
|
+
"aria-readonly": state.isReadOnly() || void 0,
|
|
762
|
+
"aria-disabled": state.isDisabled() || void 0,
|
|
763
|
+
"aria-invalid": state.isInvalid() || void 0,
|
|
764
|
+
contentEditable: isEditable(),
|
|
765
|
+
suppressContentEditableWarning: true,
|
|
766
|
+
inputMode: "numeric",
|
|
767
|
+
autoCorrect: "off",
|
|
768
|
+
enterKeyHint: "next",
|
|
769
|
+
spellCheck: false,
|
|
770
|
+
onKeyDown: handleKeyDown,
|
|
771
|
+
onFocus: handleFocus,
|
|
772
|
+
onBlur: handleBlur,
|
|
773
|
+
onBeforeInput: handleBeforeInput,
|
|
774
|
+
onCompositionStart: handleCompositionStart,
|
|
775
|
+
onCompositionEnd: handleCompositionEnd,
|
|
776
|
+
onMouseDown: (e) => {
|
|
777
|
+
e.preventDefault();
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
});
|
|
781
|
+
const text = createMemo(() => {
|
|
782
|
+
const seg = segment();
|
|
783
|
+
return seg.isPlaceholder ? seg.placeholder : seg.text;
|
|
784
|
+
});
|
|
785
|
+
return {
|
|
786
|
+
get segmentProps() {
|
|
787
|
+
return segmentProps();
|
|
788
|
+
},
|
|
789
|
+
get isFocused() {
|
|
790
|
+
return isFocused();
|
|
791
|
+
},
|
|
792
|
+
get isEditable() {
|
|
793
|
+
return isEditable();
|
|
794
|
+
},
|
|
795
|
+
get isPlaceholder() {
|
|
796
|
+
return segment().isPlaceholder;
|
|
797
|
+
},
|
|
798
|
+
get text() {
|
|
799
|
+
return text();
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
const SEGMENT_LABELS = {
|
|
804
|
+
en: {
|
|
805
|
+
hour: "Hour",
|
|
806
|
+
minute: "Minute",
|
|
807
|
+
second: "Second",
|
|
808
|
+
dayPeriod: "AM/PM"
|
|
809
|
+
},
|
|
810
|
+
es: {
|
|
811
|
+
hour: "Hora",
|
|
812
|
+
minute: "Minuto",
|
|
813
|
+
second: "Segundo",
|
|
814
|
+
dayPeriod: "AM/PM"
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
function getSegmentLabel(type, locale) {
|
|
818
|
+
if (type === "literal") return "";
|
|
819
|
+
return (SEGMENT_LABELS[locale.toLowerCase().split("-")[0] ?? "en"] ?? SEGMENT_LABELS.en)[type];
|
|
820
|
+
}
|
|
821
|
+
function normalizeDigit(input) {
|
|
822
|
+
if (/^[0-9]$/.test(input)) return input;
|
|
823
|
+
const code = input.codePointAt(0);
|
|
824
|
+
if (code === void 0) return null;
|
|
825
|
+
if (code >= 1632 && code <= 1641) return String(code - 1632);
|
|
826
|
+
if (code >= 1776 && code <= 1785) return String(code - 1776);
|
|
827
|
+
if (code >= 65296 && code <= 65305) return String(code - 65296);
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
function extractNormalizedDigits(input) {
|
|
831
|
+
const digits = [];
|
|
832
|
+
for (const char of input) {
|
|
833
|
+
const normalized = normalizeDigit(char);
|
|
834
|
+
if (normalized) digits.push(normalized);
|
|
835
|
+
}
|
|
836
|
+
return digits;
|
|
837
|
+
}
|
|
838
|
+
//#endregion
|
|
839
|
+
//#region src/datepicker/createDatePicker.ts
|
|
840
|
+
/**
|
|
841
|
+
* createDatePicker hook for Solidaria
|
|
842
|
+
*
|
|
843
|
+
* Provides the behavior and accessibility implementation for a date picker component.
|
|
844
|
+
* Based on @react-aria/datepicker useDatePicker
|
|
845
|
+
*/
|
|
846
|
+
/**
|
|
847
|
+
* Provides the behavior and accessibility implementation for a date picker component.
|
|
848
|
+
*/
|
|
849
|
+
function createDatePicker(props, state, overlayState, _calendarState) {
|
|
850
|
+
const locale = useLocale();
|
|
851
|
+
const getProps = () => access(props);
|
|
852
|
+
const id = createId(getProps().id);
|
|
853
|
+
const descriptionId = createId();
|
|
854
|
+
const errorMessageId = createId();
|
|
855
|
+
const dialogId = createId();
|
|
856
|
+
const buttonId = createId();
|
|
857
|
+
const fieldId = createId();
|
|
858
|
+
const { labelProps, fieldProps: labelFieldProps } = createLabel({
|
|
859
|
+
get label() {
|
|
860
|
+
return getProps().label;
|
|
861
|
+
},
|
|
862
|
+
get "aria-label"() {
|
|
863
|
+
return getProps()["aria-label"];
|
|
864
|
+
},
|
|
865
|
+
get "aria-labelledby"() {
|
|
866
|
+
return getProps()["aria-labelledby"];
|
|
867
|
+
},
|
|
868
|
+
labelElementType: "span"
|
|
869
|
+
});
|
|
870
|
+
const getAriaDescribedBy = () => {
|
|
871
|
+
const p = getProps();
|
|
872
|
+
const ids = [];
|
|
873
|
+
if (p["aria-describedby"]) ids.push(p["aria-describedby"]);
|
|
874
|
+
if (valueDescription()) ids.push(valueDescriptionId);
|
|
875
|
+
if (p.description) ids.push(descriptionId);
|
|
876
|
+
if ((p.isInvalid || state.isInvalid()) && p.errorMessage) ids.push(errorMessageId);
|
|
877
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
878
|
+
};
|
|
879
|
+
const valueDescriptionId = createId();
|
|
880
|
+
const valueDescription = createMemo(() => {
|
|
881
|
+
const v = state.value?.();
|
|
882
|
+
if (!v) return "";
|
|
883
|
+
return new DateFormatter(locale().locale, {
|
|
884
|
+
year: "numeric",
|
|
885
|
+
month: "long",
|
|
886
|
+
day: "numeric"
|
|
887
|
+
}).format(v.toDate(getLocalTimeZone()));
|
|
888
|
+
});
|
|
889
|
+
const groupProps = createMemo(() => {
|
|
890
|
+
const p = getProps();
|
|
891
|
+
const isInvalid = p.isInvalid || state.isInvalid();
|
|
892
|
+
const describedBy = getAriaDescribedBy();
|
|
893
|
+
const labelField = labelFieldProps;
|
|
894
|
+
return {
|
|
895
|
+
id,
|
|
896
|
+
role: "group",
|
|
897
|
+
"aria-label": labelField["aria-label"] || void 0,
|
|
898
|
+
"aria-labelledby": labelField["aria-labelledby"] || void 0,
|
|
899
|
+
"aria-disabled": p.isDisabled || state.isDisabled() || void 0,
|
|
900
|
+
"aria-readonly": p.isReadOnly || state.isReadOnly() || void 0,
|
|
901
|
+
"aria-required": p.isRequired || state.isRequired() || void 0,
|
|
902
|
+
"aria-invalid": isInvalid || void 0,
|
|
903
|
+
"aria-describedby": describedBy
|
|
904
|
+
};
|
|
905
|
+
});
|
|
906
|
+
const fieldProps = createMemo(() => {
|
|
907
|
+
const p = getProps();
|
|
908
|
+
return {
|
|
909
|
+
id: fieldId,
|
|
910
|
+
"aria-describedby": getAriaDescribedBy(),
|
|
911
|
+
value: state.value?.(),
|
|
912
|
+
defaultValue: state.defaultValue,
|
|
913
|
+
onChange: (value) => {
|
|
914
|
+
state.setValue?.(value);
|
|
915
|
+
},
|
|
916
|
+
placeholderValue: p.placeholderValue,
|
|
917
|
+
hideTimeZone: p.hideTimeZone,
|
|
918
|
+
hourCycle: p.hourCycle,
|
|
919
|
+
shouldForceLeadingZeros: p.shouldForceLeadingZeros,
|
|
920
|
+
granularity: p.granularity,
|
|
921
|
+
isDisabled: p.isDisabled || state.isDisabled(),
|
|
922
|
+
isReadOnly: p.isReadOnly || state.isReadOnly(),
|
|
923
|
+
isRequired: p.isRequired || state.isRequired(),
|
|
924
|
+
autoFocus: p.autoFocus,
|
|
925
|
+
name: p.name,
|
|
926
|
+
form: p.form
|
|
927
|
+
};
|
|
928
|
+
});
|
|
929
|
+
const buttonPress = createPress({
|
|
930
|
+
get isDisabled() {
|
|
931
|
+
return getProps().isDisabled || state.isDisabled();
|
|
932
|
+
},
|
|
933
|
+
onPress: () => {
|
|
934
|
+
overlayState.open();
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
const buttonProps = createMemo(() => {
|
|
938
|
+
const p = getProps();
|
|
939
|
+
const isDisabled = p.isDisabled || state.isDisabled();
|
|
940
|
+
const defaults = getDatePickerLabelDefaults(locale().locale);
|
|
941
|
+
const labelId = labelProps["id"];
|
|
942
|
+
const labelledBy = labelId ? `${buttonId} ${labelId}` : buttonId;
|
|
943
|
+
const describedBy = getAriaDescribedBy();
|
|
944
|
+
return mergeProps(buttonPress.pressProps, {
|
|
945
|
+
id: buttonId,
|
|
946
|
+
type: "button",
|
|
947
|
+
"aria-label": p.buttonAriaLabel ?? defaults.button,
|
|
948
|
+
"aria-labelledby": labelledBy,
|
|
949
|
+
"aria-haspopup": "dialog",
|
|
950
|
+
"aria-expanded": overlayState.isOpen,
|
|
951
|
+
"aria-controls": overlayState.isOpen ? dialogId : void 0,
|
|
952
|
+
"aria-describedby": describedBy,
|
|
953
|
+
"aria-disabled": isDisabled || void 0,
|
|
954
|
+
tabIndex: 0
|
|
955
|
+
});
|
|
956
|
+
});
|
|
957
|
+
const dialogProps = createMemo(() => {
|
|
958
|
+
const p = getProps();
|
|
959
|
+
const defaults = getDatePickerLabelDefaults(locale().locale);
|
|
960
|
+
const labelId = labelProps["id"];
|
|
961
|
+
return {
|
|
962
|
+
id: dialogId,
|
|
963
|
+
role: "dialog",
|
|
964
|
+
"aria-modal": true,
|
|
965
|
+
"aria-labelledby": labelId ? `${buttonId} ${labelId}` : buttonId,
|
|
966
|
+
"aria-label": p.dialogAriaLabel ?? defaults.dialog
|
|
967
|
+
};
|
|
968
|
+
});
|
|
969
|
+
const calendarProps = createMemo(() => {
|
|
970
|
+
const p = getProps();
|
|
971
|
+
const defaults = getDatePickerLabelDefaults(locale().locale);
|
|
972
|
+
const currentValue = state.value?.();
|
|
973
|
+
return {
|
|
974
|
+
autoFocus: true,
|
|
975
|
+
value: currentValue,
|
|
976
|
+
onChange: (value) => {
|
|
977
|
+
if (state.setValue) state.setValue(value);
|
|
978
|
+
},
|
|
979
|
+
minValue: p.minValue,
|
|
980
|
+
maxValue: p.maxValue,
|
|
981
|
+
isDisabled: p.isDisabled || state.isDisabled(),
|
|
982
|
+
isReadOnly: p.isReadOnly || state.isReadOnly(),
|
|
983
|
+
isDateUnavailable: p.isDateUnavailable,
|
|
984
|
+
defaultFocusedValue: currentValue ? void 0 : p.placeholderValue,
|
|
985
|
+
isInvalid: p.isInvalid || state.isInvalid(),
|
|
986
|
+
errorMessage: typeof p.errorMessage === "string" ? p.errorMessage : state.isInvalid() ? "Invalid date" : void 0,
|
|
987
|
+
firstDayOfWeek: p.firstDayOfWeek,
|
|
988
|
+
pageBehavior: p.pageBehavior,
|
|
989
|
+
"aria-label": p.calendarAriaLabel ?? p.dialogAriaLabel ?? defaults.calendar
|
|
990
|
+
};
|
|
991
|
+
});
|
|
992
|
+
const descriptionProps = createMemo(() => ({ id: descriptionId }));
|
|
993
|
+
createMemo(() => ({
|
|
994
|
+
id: valueDescriptionId,
|
|
995
|
+
"aria-hidden": true
|
|
996
|
+
}));
|
|
997
|
+
const errorMessageProps = createMemo(() => ({
|
|
998
|
+
id: errorMessageId,
|
|
999
|
+
role: "alert"
|
|
1000
|
+
}));
|
|
1001
|
+
let focusFirstSegment;
|
|
1002
|
+
let focusLastSegment;
|
|
1003
|
+
const enhancedLabelProps = createMemo(() => {
|
|
1004
|
+
return {
|
|
1005
|
+
...labelProps,
|
|
1006
|
+
onClick: () => {
|
|
1007
|
+
focusFirstSegment?.();
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
});
|
|
1011
|
+
const isInvalid = createMemo(() => {
|
|
1012
|
+
return getProps().isInvalid || state.isInvalid();
|
|
1013
|
+
});
|
|
1014
|
+
const validationErrors = createMemo(() => {
|
|
1015
|
+
const p = getProps();
|
|
1016
|
+
if (p.isInvalid && typeof p.errorMessage === "string") return [p.errorMessage];
|
|
1017
|
+
return [];
|
|
1018
|
+
});
|
|
1019
|
+
const validationDetails = createMemo(() => {
|
|
1020
|
+
const p = getProps();
|
|
1021
|
+
return {
|
|
1022
|
+
minValue: p.minValue,
|
|
1023
|
+
maxValue: p.maxValue,
|
|
1024
|
+
isDateUnavailable: p.isDateUnavailable,
|
|
1025
|
+
isInvalid: isInvalid()
|
|
1026
|
+
};
|
|
1027
|
+
});
|
|
1028
|
+
return {
|
|
1029
|
+
get groupProps() {
|
|
1030
|
+
return groupProps();
|
|
1031
|
+
},
|
|
1032
|
+
get labelProps() {
|
|
1033
|
+
return enhancedLabelProps();
|
|
1034
|
+
},
|
|
1035
|
+
get fieldProps() {
|
|
1036
|
+
return fieldProps();
|
|
1037
|
+
},
|
|
1038
|
+
get buttonProps() {
|
|
1039
|
+
return buttonProps();
|
|
1040
|
+
},
|
|
1041
|
+
get dialogProps() {
|
|
1042
|
+
return dialogProps();
|
|
1043
|
+
},
|
|
1044
|
+
get calendarProps() {
|
|
1045
|
+
return calendarProps();
|
|
1046
|
+
},
|
|
1047
|
+
get descriptionProps() {
|
|
1048
|
+
return descriptionProps();
|
|
1049
|
+
},
|
|
1050
|
+
get errorMessageProps() {
|
|
1051
|
+
return errorMessageProps();
|
|
1052
|
+
},
|
|
1053
|
+
get isInvalid() {
|
|
1054
|
+
return isInvalid();
|
|
1055
|
+
},
|
|
1056
|
+
get validationErrors() {
|
|
1057
|
+
return validationErrors();
|
|
1058
|
+
},
|
|
1059
|
+
get validationDetails() {
|
|
1060
|
+
return validationDetails();
|
|
1061
|
+
},
|
|
1062
|
+
focusManager: {
|
|
1063
|
+
focusFirst: () => focusFirstSegment?.(),
|
|
1064
|
+
focusLast: () => focusLastSegment?.(),
|
|
1065
|
+
/** @internal Wires the actual focus implementations from the component layer */
|
|
1066
|
+
_register: (first, last) => {
|
|
1067
|
+
focusFirstSegment = first;
|
|
1068
|
+
focusLastSegment = last;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
function getDatePickerLabelDefaults(locale) {
|
|
1074
|
+
if ((locale.toLowerCase().split("-")[0] ?? "en") === "es") return {
|
|
1075
|
+
button: "Abrir calendario",
|
|
1076
|
+
dialog: "Calendario",
|
|
1077
|
+
calendar: "Calendario"
|
|
1078
|
+
};
|
|
1079
|
+
return {
|
|
1080
|
+
button: "Open calendar",
|
|
1081
|
+
dialog: "Calendar",
|
|
1082
|
+
calendar: "Calendar"
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
//#endregion
|
|
1086
|
+
//#region src/datepicker/createDatePickerGroup.ts
|
|
1087
|
+
/**
|
|
1088
|
+
* createDatePickerGroup hook for Solidaria
|
|
1089
|
+
*
|
|
1090
|
+
* Provides keyboard and pointer behavior for the date picker field group.
|
|
1091
|
+
* Based on @react-aria/datepicker useDatePickerGroup
|
|
1092
|
+
*/
|
|
1093
|
+
function createDatePickerGroup(props, state, ref, disableArrowNavigation) {
|
|
1094
|
+
const locale = useLocale();
|
|
1095
|
+
const resolvedProps = createMemo(() => access(props));
|
|
1096
|
+
const onKeyDown = (e) => {
|
|
1097
|
+
if (!nodeContains(e.currentTarget, getEventTarget(e))) return;
|
|
1098
|
+
if (e.altKey && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
1099
|
+
e.preventDefault();
|
|
1100
|
+
e.stopPropagation();
|
|
1101
|
+
state.setOpen(true);
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
if (disableArrowNavigation) return;
|
|
1105
|
+
const root = ref();
|
|
1106
|
+
if (!root) return;
|
|
1107
|
+
const segments = Array.from(root.querySelectorAll("[role=\"spinbutton\"]"));
|
|
1108
|
+
if (segments.length === 0) return;
|
|
1109
|
+
const activeElement = root.ownerDocument.activeElement;
|
|
1110
|
+
let currentIndex = -1;
|
|
1111
|
+
if (activeElement) currentIndex = segments.indexOf(activeElement);
|
|
1112
|
+
const direction = locale().direction;
|
|
1113
|
+
switch (e.key) {
|
|
1114
|
+
case "ArrowLeft":
|
|
1115
|
+
e.preventDefault();
|
|
1116
|
+
e.stopPropagation();
|
|
1117
|
+
if (direction === "rtl") {
|
|
1118
|
+
const nextIndex = currentIndex >= 0 ? currentIndex + 1 : 0;
|
|
1119
|
+
if (nextIndex < segments.length) focusSafely(segments[nextIndex]);
|
|
1120
|
+
} else {
|
|
1121
|
+
const prevIndex = currentIndex >= 0 ? currentIndex - 1 : segments.length - 1;
|
|
1122
|
+
if (prevIndex >= 0) focusSafely(segments[prevIndex]);
|
|
1123
|
+
}
|
|
1124
|
+
break;
|
|
1125
|
+
case "ArrowRight":
|
|
1126
|
+
e.preventDefault();
|
|
1127
|
+
e.stopPropagation();
|
|
1128
|
+
if (direction === "rtl") {
|
|
1129
|
+
const prevIndex = currentIndex >= 0 ? currentIndex - 1 : segments.length - 1;
|
|
1130
|
+
if (prevIndex >= 0) focusSafely(segments[prevIndex]);
|
|
1131
|
+
} else {
|
|
1132
|
+
const nextIndex = currentIndex >= 0 ? currentIndex + 1 : 0;
|
|
1133
|
+
if (nextIndex < segments.length) focusSafely(segments[nextIndex]);
|
|
1134
|
+
}
|
|
1135
|
+
break;
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
const focusLast = (event) => {
|
|
1139
|
+
const root = ref();
|
|
1140
|
+
if (!root) return;
|
|
1141
|
+
const target = event ? getEventTarget(event) : null;
|
|
1142
|
+
const segments = Array.from(root.querySelectorAll("[role=\"spinbutton\"]"));
|
|
1143
|
+
if (segments.length === 0) return;
|
|
1144
|
+
let startIndex = segments.length - 1;
|
|
1145
|
+
if (target) {
|
|
1146
|
+
const targetIndex = segments.indexOf(target);
|
|
1147
|
+
if (targetIndex >= 0) startIndex = targetIndex;
|
|
1148
|
+
}
|
|
1149
|
+
for (let i = startIndex; i >= 0; i--) {
|
|
1150
|
+
const segment = segments[i];
|
|
1151
|
+
if (segment.getAttribute("data-placeholder") !== "true") {
|
|
1152
|
+
focusSafely(segment);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
const { pressProps } = createPress({
|
|
1158
|
+
isDisabled: () => resolvedProps().isDisabled || state.isDisabled(),
|
|
1159
|
+
preventFocusOnPress: true,
|
|
1160
|
+
allowTextSelectionOnPress: true,
|
|
1161
|
+
onPressStart(e) {
|
|
1162
|
+
if (e.pointerType === "mouse") focusLast(e);
|
|
1163
|
+
},
|
|
1164
|
+
onPress(e) {
|
|
1165
|
+
if (e.pointerType === "touch" || e.pointerType === "pen") focusLast(e);
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
return { get groupProps() {
|
|
1169
|
+
return mergeProps(pressProps, { onKeyDown });
|
|
1170
|
+
} };
|
|
1171
|
+
}
|
|
1172
|
+
//#endregion
|
|
1173
|
+
//#region src/datepicker/createDateRangePicker.ts
|
|
1174
|
+
/**
|
|
1175
|
+
* createDateRangePicker hook for Solidaria
|
|
1176
|
+
*
|
|
1177
|
+
* Provides behavior and accessibility wiring for range date pickers.
|
|
1178
|
+
* Compatibility target: @react-aria/datepicker useDateRangePicker.
|
|
1179
|
+
*/
|
|
1180
|
+
function createDateRangePicker(props, state, overlayState) {
|
|
1181
|
+
const locale = useLocale();
|
|
1182
|
+
const getProps = () => access(props);
|
|
1183
|
+
const id = createId(getProps().id);
|
|
1184
|
+
const startFieldId = createId();
|
|
1185
|
+
const endFieldId = createId();
|
|
1186
|
+
const descriptionId = createId();
|
|
1187
|
+
const errorMessageId = createId();
|
|
1188
|
+
const dialogId = createId();
|
|
1189
|
+
const { labelProps, fieldProps: labelFieldProps } = createLabel({
|
|
1190
|
+
get label() {
|
|
1191
|
+
return getProps().label;
|
|
1192
|
+
},
|
|
1193
|
+
get "aria-label"() {
|
|
1194
|
+
return getProps()["aria-label"];
|
|
1195
|
+
},
|
|
1196
|
+
get "aria-labelledby"() {
|
|
1197
|
+
return getProps()["aria-labelledby"];
|
|
1198
|
+
},
|
|
1199
|
+
labelElementType: "span"
|
|
1200
|
+
});
|
|
1201
|
+
const getAriaDescribedBy = () => {
|
|
1202
|
+
const p = getProps();
|
|
1203
|
+
const ids = [];
|
|
1204
|
+
if (p["aria-describedby"]) ids.push(p["aria-describedby"]);
|
|
1205
|
+
if (p.description) ids.push(descriptionId);
|
|
1206
|
+
if (p.isInvalid && p.errorMessage) ids.push(errorMessageId);
|
|
1207
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
1208
|
+
};
|
|
1209
|
+
const groupProps = createMemo(() => {
|
|
1210
|
+
const p = getProps();
|
|
1211
|
+
const isInvalid = p.isInvalid;
|
|
1212
|
+
return mergeProps(labelFieldProps, {
|
|
1213
|
+
id,
|
|
1214
|
+
role: "group",
|
|
1215
|
+
"aria-disabled": p.isDisabled || state.isDisabled() || void 0,
|
|
1216
|
+
"aria-readonly": p.isReadOnly || state.isReadOnly() || void 0,
|
|
1217
|
+
"aria-required": p.isRequired || void 0,
|
|
1218
|
+
"aria-invalid": isInvalid || void 0,
|
|
1219
|
+
"aria-describedby": getAriaDescribedBy()
|
|
1220
|
+
});
|
|
1221
|
+
});
|
|
1222
|
+
const startFieldProps = createMemo(() => {
|
|
1223
|
+
const p = getProps();
|
|
1224
|
+
const defaults = getDateRangePickerLabelDefaults(locale().locale);
|
|
1225
|
+
const isDisabled = p.isDisabled || state.isDisabled();
|
|
1226
|
+
const isReadOnly = p.isReadOnly || state.isReadOnly();
|
|
1227
|
+
const isInvalid = p.isInvalid;
|
|
1228
|
+
return {
|
|
1229
|
+
id: startFieldId,
|
|
1230
|
+
"aria-label": p.startFieldAriaLabel ?? defaults.startField,
|
|
1231
|
+
"aria-describedby": getAriaDescribedBy(),
|
|
1232
|
+
"aria-disabled": isDisabled || void 0,
|
|
1233
|
+
"aria-readonly": isReadOnly || void 0,
|
|
1234
|
+
"aria-invalid": isInvalid || void 0,
|
|
1235
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
1236
|
+
onClick: () => {
|
|
1237
|
+
if (!isDisabled) overlayState.open();
|
|
1238
|
+
},
|
|
1239
|
+
onKeyDown: (event) => {
|
|
1240
|
+
if (isDisabled) return;
|
|
1241
|
+
if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown") {
|
|
1242
|
+
event.preventDefault();
|
|
1243
|
+
overlayState.open();
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
});
|
|
1248
|
+
const endFieldProps = createMemo(() => {
|
|
1249
|
+
const p = getProps();
|
|
1250
|
+
const defaults = getDateRangePickerLabelDefaults(locale().locale);
|
|
1251
|
+
const isDisabled = p.isDisabled || state.isDisabled();
|
|
1252
|
+
const isReadOnly = p.isReadOnly || state.isReadOnly();
|
|
1253
|
+
const isInvalid = p.isInvalid;
|
|
1254
|
+
return {
|
|
1255
|
+
id: endFieldId,
|
|
1256
|
+
"aria-label": p.endFieldAriaLabel ?? defaults.endField,
|
|
1257
|
+
"aria-describedby": getAriaDescribedBy(),
|
|
1258
|
+
"aria-disabled": isDisabled || void 0,
|
|
1259
|
+
"aria-readonly": isReadOnly || void 0,
|
|
1260
|
+
"aria-invalid": isInvalid || void 0,
|
|
1261
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
1262
|
+
onClick: () => {
|
|
1263
|
+
if (!isDisabled) overlayState.open();
|
|
1264
|
+
},
|
|
1265
|
+
onKeyDown: (event) => {
|
|
1266
|
+
if (isDisabled) return;
|
|
1267
|
+
if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown") {
|
|
1268
|
+
event.preventDefault();
|
|
1269
|
+
overlayState.open();
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
});
|
|
1274
|
+
const startInputProps = createMemo(() => {
|
|
1275
|
+
const p = getProps();
|
|
1276
|
+
const defaults = getDateRangePickerLabelDefaults(locale().locale);
|
|
1277
|
+
const isDisabled = p.isDisabled || state.isDisabled();
|
|
1278
|
+
const isReadOnly = p.isReadOnly || state.isReadOnly();
|
|
1279
|
+
const isInvalid = p.isInvalid;
|
|
1280
|
+
return {
|
|
1281
|
+
id: startFieldId,
|
|
1282
|
+
"aria-label": p.startFieldAriaLabel ?? defaults.startField,
|
|
1283
|
+
"aria-describedby": getAriaDescribedBy(),
|
|
1284
|
+
"aria-disabled": isDisabled || void 0,
|
|
1285
|
+
"aria-readonly": isReadOnly || void 0,
|
|
1286
|
+
"aria-invalid": isInvalid || void 0
|
|
1287
|
+
};
|
|
1288
|
+
});
|
|
1289
|
+
const endInputProps = createMemo(() => {
|
|
1290
|
+
const p = getProps();
|
|
1291
|
+
const defaults = getDateRangePickerLabelDefaults(locale().locale);
|
|
1292
|
+
const isDisabled = p.isDisabled || state.isDisabled();
|
|
1293
|
+
const isReadOnly = p.isReadOnly || state.isReadOnly();
|
|
1294
|
+
const isInvalid = p.isInvalid;
|
|
1295
|
+
return {
|
|
1296
|
+
id: endFieldId,
|
|
1297
|
+
"aria-label": p.endFieldAriaLabel ?? defaults.endField,
|
|
1298
|
+
"aria-describedby": getAriaDescribedBy(),
|
|
1299
|
+
"aria-disabled": isDisabled || void 0,
|
|
1300
|
+
"aria-readonly": isReadOnly || void 0,
|
|
1301
|
+
"aria-invalid": isInvalid || void 0
|
|
1302
|
+
};
|
|
1303
|
+
});
|
|
1304
|
+
const buttonProps = createMemo(() => {
|
|
1305
|
+
const p = getProps();
|
|
1306
|
+
const defaults = getDateRangePickerLabelDefaults(locale().locale);
|
|
1307
|
+
const isDisabled = p.isDisabled || state.isDisabled();
|
|
1308
|
+
return {
|
|
1309
|
+
"aria-label": p.buttonAriaLabel ?? defaults.button,
|
|
1310
|
+
"aria-haspopup": "dialog",
|
|
1311
|
+
"aria-expanded": overlayState.isOpen,
|
|
1312
|
+
"aria-controls": overlayState.isOpen ? dialogId : void 0,
|
|
1313
|
+
disabled: isDisabled,
|
|
1314
|
+
tabIndex: 0,
|
|
1315
|
+
onClick: () => {
|
|
1316
|
+
if (!isDisabled) overlayState.toggle();
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
});
|
|
1320
|
+
const dialogProps = createMemo(() => {
|
|
1321
|
+
const defaults = getDateRangePickerLabelDefaults(locale().locale);
|
|
1322
|
+
return {
|
|
1323
|
+
id: dialogId,
|
|
1324
|
+
role: "dialog",
|
|
1325
|
+
"aria-modal": true,
|
|
1326
|
+
"aria-label": getProps().dialogAriaLabel ?? defaults.dialog
|
|
1327
|
+
};
|
|
1328
|
+
});
|
|
1329
|
+
const calendarProps = createMemo(() => {
|
|
1330
|
+
const defaults = getDateRangePickerLabelDefaults(locale().locale);
|
|
1331
|
+
return { "aria-label": getProps().calendarAriaLabel ?? getProps().dialogAriaLabel ?? defaults.calendar };
|
|
1332
|
+
});
|
|
1333
|
+
const descriptionProps = createMemo(() => ({ id: descriptionId }));
|
|
1334
|
+
const errorMessageProps = createMemo(() => ({
|
|
1335
|
+
id: errorMessageId,
|
|
1336
|
+
role: "alert"
|
|
1337
|
+
}));
|
|
1338
|
+
return {
|
|
1339
|
+
get groupProps() {
|
|
1340
|
+
return groupProps();
|
|
1341
|
+
},
|
|
1342
|
+
get labelProps() {
|
|
1343
|
+
return labelProps;
|
|
1344
|
+
},
|
|
1345
|
+
get startFieldProps() {
|
|
1346
|
+
return startFieldProps();
|
|
1347
|
+
},
|
|
1348
|
+
get endFieldProps() {
|
|
1349
|
+
return endFieldProps();
|
|
1350
|
+
},
|
|
1351
|
+
get startInputProps() {
|
|
1352
|
+
return startInputProps();
|
|
1353
|
+
},
|
|
1354
|
+
get endInputProps() {
|
|
1355
|
+
return endInputProps();
|
|
1356
|
+
},
|
|
1357
|
+
get buttonProps() {
|
|
1358
|
+
return buttonProps();
|
|
1359
|
+
},
|
|
1360
|
+
get dialogProps() {
|
|
1361
|
+
return dialogProps();
|
|
1362
|
+
},
|
|
1363
|
+
get calendarProps() {
|
|
1364
|
+
return calendarProps();
|
|
1365
|
+
},
|
|
1366
|
+
get descriptionProps() {
|
|
1367
|
+
return descriptionProps();
|
|
1368
|
+
},
|
|
1369
|
+
get errorMessageProps() {
|
|
1370
|
+
return errorMessageProps();
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
function getDateRangePickerLabelDefaults(locale) {
|
|
1375
|
+
if ((locale.toLowerCase().split("-")[0] ?? "en") === "es") return {
|
|
1376
|
+
button: "Abrir calendario de rango",
|
|
1377
|
+
dialog: "Calendario de rango",
|
|
1378
|
+
calendar: "Calendario de rango",
|
|
1379
|
+
startField: "Fecha de inicio",
|
|
1380
|
+
endField: "Fecha de fin"
|
|
1381
|
+
};
|
|
1382
|
+
return {
|
|
1383
|
+
button: "Open range calendar",
|
|
1384
|
+
dialog: "Range calendar",
|
|
1385
|
+
calendar: "Range calendar",
|
|
1386
|
+
startField: "Start date",
|
|
1387
|
+
endField: "End date"
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
//#endregion
|
|
1391
|
+
export { createTimeField as a, createTimeSegment as i, createDatePickerGroup as n, createDateSegment as o, createDatePicker as r, createDateField as s, createDateRangePicker as t };
|
|
1392
|
+
|
|
1393
|
+
//# sourceMappingURL=datepicker.js.map
|