@proyecto-viviana/solidaria 0.4.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 +13 -79
- package/dist/_chunk/actiongroup.js.map +1 -1
- package/dist/_chunk/actiongroup.jsx +13 -79
- package/dist/_chunk/actiongroup.jsx.map +1 -1
- package/dist/_chunk/{live-announcer.js → announce.js} +1 -1
- package/dist/_chunk/announce.js.map +1 -0
- package/dist/_chunk/{live-announcer.jsx → announce.jsx} +1 -1
- package/dist/_chunk/announce.jsx.map +1 -0
- package/dist/_chunk/autocomplete.js +56 -8
- package/dist/_chunk/autocomplete.js.map +1 -1
- package/dist/_chunk/autocomplete.jsx +56 -8
- package/dist/_chunk/autocomplete.jsx.map +1 -1
- package/dist/_chunk/breadcrumbs.js +6 -4
- package/dist/_chunk/breadcrumbs.js.map +1 -1
- package/dist/_chunk/breadcrumbs.jsx +6 -4
- package/dist/_chunk/breadcrumbs.jsx.map +1 -1
- package/dist/_chunk/button.js +8 -9
- package/dist/_chunk/button.js.map +1 -1
- package/dist/_chunk/button.jsx +8 -9
- package/dist/_chunk/button.jsx.map +1 -1
- package/dist/_chunk/calendar.js +27 -26
- package/dist/_chunk/calendar.js.map +1 -1
- package/dist/_chunk/calendar.jsx +27 -26
- package/dist/_chunk/calendar.jsx.map +1 -1
- package/dist/_chunk/checkbox.js +5 -4
- package/dist/_chunk/checkbox.js.map +1 -1
- package/dist/_chunk/checkbox.jsx +5 -4
- package/dist/_chunk/checkbox.jsx.map +1 -1
- package/dist/_chunk/color.js +302 -18
- package/dist/_chunk/color.js.map +1 -1
- package/dist/_chunk/color.jsx +302 -18
- package/dist/_chunk/color.jsx.map +1 -1
- package/dist/_chunk/combobox.js +638 -12
- package/dist/_chunk/combobox.js.map +1 -1
- package/dist/_chunk/combobox.jsx +638 -12
- package/dist/_chunk/combobox.jsx.map +1 -1
- 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 +3 -171
- package/dist/_chunk/createCollator.js.map +1 -1
- package/dist/_chunk/createCollator.jsx +3 -165
- package/dist/_chunk/createCollator.jsx.map +1 -1
- package/dist/_chunk/createField.js +2 -1
- package/dist/_chunk/createField.js.map +1 -1
- package/dist/_chunk/createField.jsx +2 -1
- package/dist/_chunk/createField.jsx.map +1 -1
- package/dist/_chunk/createFocus.js +12 -8
- package/dist/_chunk/createFocus.js.map +1 -1
- package/dist/_chunk/createFocus.jsx +12 -8
- package/dist/_chunk/createFocus.jsx.map +1 -1
- package/dist/_chunk/createFocusWithin.js +12 -13
- package/dist/_chunk/createFocusWithin.js.map +1 -1
- package/dist/_chunk/createFocusWithin.jsx +12 -13
- package/dist/_chunk/createFocusWithin.jsx.map +1 -1
- package/dist/_chunk/createFocusable.js +3 -3
- package/dist/_chunk/createFocusable.js.map +1 -1
- package/dist/_chunk/createFocusable.jsx +3 -3
- package/dist/_chunk/createFocusable.jsx.map +1 -1
- package/dist/_chunk/{form.js → createFormReset.js} +1 -1
- package/dist/_chunk/createFormReset.js.map +1 -0
- package/dist/_chunk/{form.jsx → createFormReset.jsx} +1 -1
- package/dist/_chunk/createFormReset.jsx.map +1 -0
- package/dist/_chunk/createHover.js +2 -1
- package/dist/_chunk/createHover.js.map +1 -1
- package/dist/_chunk/createHover.jsx +2 -1
- package/dist/_chunk/createHover.jsx.map +1 -1
- package/dist/_chunk/createInteractionModality.js +2 -3
- package/dist/_chunk/createInteractionModality.js.map +1 -1
- package/dist/_chunk/createInteractionModality.jsx +2 -3
- package/dist/_chunk/createInteractionModality.jsx.map +1 -1
- package/dist/_chunk/createLabel.js +2 -1
- package/dist/_chunk/createLabel.js.map +1 -1
- package/dist/_chunk/createLabel.jsx +2 -1
- package/dist/_chunk/createLabel.jsx.map +1 -1
- package/dist/_chunk/createLabels.js +3 -2
- package/dist/_chunk/createLabels.js.map +1 -1
- package/dist/_chunk/createLabels.jsx +3 -2
- package/dist/_chunk/createLabels.jsx.map +1 -1
- package/dist/_chunk/createLandmark.js +1 -1
- package/dist/_chunk/createLandmark.jsx +1 -1
- package/dist/_chunk/createProgressBar.js +2 -1
- package/dist/_chunk/createProgressBar.js.map +1 -1
- package/dist/_chunk/createProgressBar.jsx +2 -1
- package/dist/_chunk/createProgressBar.jsx.map +1 -1
- package/dist/_chunk/createSelectableItem.js +7 -3
- package/dist/_chunk/createSelectableItem.js.map +1 -1
- package/dist/_chunk/createSelectableItem.jsx +7 -3
- package/dist/_chunk/createSelectableItem.jsx.map +1 -1
- 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 +5 -4
- package/dist/_chunk/createToggle.js.map +1 -1
- package/dist/_chunk/createToggle.jsx +5 -4
- package/dist/_chunk/createToggle.jsx.map +1 -1
- package/dist/_chunk/datepicker.js +1413 -1100
- package/dist/_chunk/datepicker.js.map +1 -1
- package/dist/_chunk/datepicker.jsx +1413 -1100
- package/dist/_chunk/datepicker.jsx.map +1 -1
- package/dist/_chunk/disclosure.js +2 -2
- package/dist/_chunk/disclosure.js.map +1 -1
- package/dist/_chunk/disclosure.jsx +2 -2
- package/dist/_chunk/disclosure.jsx.map +1 -1
- package/dist/_chunk/dnd.js +1586 -495
- package/dist/_chunk/dnd.js.map +1 -1
- package/dist/_chunk/dnd.jsx +1586 -495
- package/dist/_chunk/dnd.jsx.map +1 -1
- package/dist/_chunk/env.js +1 -19
- package/dist/_chunk/env.js.map +1 -1
- package/dist/_chunk/env.jsx +1 -19
- package/dist/_chunk/env.jsx.map +1 -1
- package/dist/_chunk/focus.js +1 -1
- package/dist/_chunk/focus.js.map +1 -1
- package/dist/_chunk/focus.jsx +1 -1
- package/dist/_chunk/focus.jsx.map +1 -1
- package/dist/_chunk/focus2.js +54 -318
- package/dist/_chunk/focus2.js.map +1 -1
- package/dist/_chunk/focus2.jsx +53 -292
- package/dist/_chunk/focus2.jsx.map +1 -1
- package/dist/_chunk/grid.js +1 -1
- package/dist/_chunk/grid.jsx +1 -1
- package/dist/_chunk/gridlist.js +14 -9
- package/dist/_chunk/gridlist.js.map +1 -1
- package/dist/_chunk/gridlist.jsx +14 -9
- package/dist/_chunk/gridlist.jsx.map +1 -1
- package/dist/_chunk/i18n.js +3 -58
- package/dist/_chunk/i18n.js.map +1 -1
- package/dist/_chunk/i18n.jsx +3 -58
- package/dist/_chunk/i18n.jsx.map +1 -1
- package/dist/_chunk/interactions.js +99 -9
- package/dist/_chunk/interactions.js.map +1 -1
- package/dist/_chunk/interactions.jsx +97 -9
- package/dist/_chunk/interactions.jsx.map +1 -1
- package/dist/_chunk/link.js +2 -1
- package/dist/_chunk/link.js.map +1 -1
- package/dist/_chunk/link.jsx +2 -1
- package/dist/_chunk/link.jsx.map +1 -1
- package/dist/_chunk/listbox.js +42 -10
- package/dist/_chunk/listbox.js.map +1 -1
- package/dist/_chunk/listbox.jsx +42 -10
- package/dist/_chunk/listbox.jsx.map +1 -1
- 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 +5 -4
- package/dist/_chunk/menu.js.map +1 -1
- package/dist/_chunk/menu.jsx +5 -4
- package/dist/_chunk/menu.jsx.map +1 -1
- package/dist/_chunk/numberfield.js +3 -2
- package/dist/_chunk/numberfield.js.map +1 -1
- package/dist/_chunk/numberfield.jsx +3 -2
- package/dist/_chunk/numberfield.jsx.map +1 -1
- package/dist/_chunk/overlays.js +1 -1
- package/dist/_chunk/overlays.jsx +1 -1
- package/dist/_chunk/popover.js +3 -3
- package/dist/_chunk/popover.js.map +1 -1
- package/dist/_chunk/popover.jsx +3 -3
- package/dist/_chunk/popover.jsx.map +1 -1
- package/dist/_chunk/radio.js +7 -6
- package/dist/_chunk/radio.js.map +1 -1
- package/dist/_chunk/radio.jsx +7 -6
- package/dist/_chunk/radio.jsx.map +1 -1
- 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 +2 -1
- package/dist/_chunk/searchfield.js.map +1 -1
- package/dist/_chunk/searchfield.jsx +2 -1
- package/dist/_chunk/searchfield.jsx.map +1 -1
- package/dist/_chunk/select.js +8 -5
- package/dist/_chunk/select.js.map +1 -1
- package/dist/_chunk/select.jsx +8 -5
- package/dist/_chunk/select.jsx.map +1 -1
- package/dist/_chunk/selection.js +8 -21
- package/dist/_chunk/selection.js.map +1 -1
- package/dist/_chunk/selection.jsx +8 -21
- package/dist/_chunk/selection.jsx.map +1 -1
- package/dist/_chunk/separator.js +1 -1
- package/dist/_chunk/separator.jsx +1 -1
- package/dist/_chunk/slider.js +5 -4
- package/dist/_chunk/slider.js.map +1 -1
- package/dist/_chunk/slider.jsx +5 -4
- package/dist/_chunk/slider.jsx.map +1 -1
- 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/table.js +45 -8
- package/dist/_chunk/table.js.map +1 -1
- package/dist/_chunk/table.jsx +45 -8
- package/dist/_chunk/table.jsx.map +1 -1
- package/dist/_chunk/tabs.js +11 -8
- package/dist/_chunk/tabs.js.map +1 -1
- package/dist/_chunk/tabs.jsx +11 -8
- package/dist/_chunk/tabs.jsx.map +1 -1
- package/dist/_chunk/tag.js +54 -18
- package/dist/_chunk/tag.js.map +1 -1
- package/dist/_chunk/tag.jsx +54 -18
- package/dist/_chunk/tag.jsx.map +1 -1
- package/dist/_chunk/textfield.js +2 -1
- package/dist/_chunk/textfield.js.map +1 -1
- package/dist/_chunk/textfield.jsx +2 -1
- package/dist/_chunk/textfield.jsx.map +1 -1
- package/dist/_chunk/toolbar.js +4 -36
- package/dist/_chunk/toolbar.js.map +1 -1
- package/dist/_chunk/toolbar.jsx +4 -36
- package/dist/_chunk/toolbar.jsx.map +1 -1
- package/dist/_chunk/tooltip.js +2 -2
- package/dist/_chunk/tooltip.js.map +1 -1
- package/dist/_chunk/tooltip.jsx +2 -2
- package/dist/_chunk/tooltip.jsx.map +1 -1
- package/dist/_chunk/tree.js +42 -14
- package/dist/_chunk/tree.js.map +1 -1
- package/dist/_chunk/tree.jsx +42 -14
- package/dist/_chunk/tree.jsx.map +1 -1
- package/dist/_chunk/utils.js +59 -19
- package/dist/_chunk/utils.js.map +1 -1
- package/dist/_chunk/utils.jsx +59 -19
- package/dist/_chunk/utils.jsx.map +1 -1
- package/dist/_chunk/visually-hidden.js +3 -2
- package/dist/_chunk/visually-hidden.js.map +1 -1
- package/dist/_chunk/visually-hidden.jsx +3 -2
- package/dist/_chunk/visually-hidden.jsx.map +1 -1
- package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
- package/dist/autocomplete/createAutocomplete.d.ts +10 -7
- package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
- package/dist/breadcrumbs/createBreadcrumbs.d.ts.map +1 -1
- package/dist/button/createToggleButtonGroup.d.ts.map +1 -1
- 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/createRangeCalendar.d.ts.map +1 -1
- package/dist/calendar/createRangeCalendarCell.d.ts.map +1 -1
- package/dist/calendar/intl/index.d.ts +1 -1
- package/dist/calendar/intl/index.d.ts.map +1 -1
- package/dist/collections/index.js +1 -1
- package/dist/collections/index.jsx +1 -1
- 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/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/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 -2
- package/dist/datepicker/index.jsx +2 -2
- package/dist/datepicker/intl.d.ts +12 -0
- package/dist/datepicker/intl.d.ts.map +1 -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 -2
- package/dist/dnd/index.jsx +3 -2
- 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 +5 -0
- 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 -2
- package/dist/focus/index.jsx +3 -2
- package/dist/focus/virtualFocus.d.ts +26 -0
- package/dist/focus/virtualFocus.d.ts.map +1 -0
- package/dist/form/index.js +1 -1
- package/dist/form/index.jsx +1 -1
- package/dist/gridlist/createGridList.d.ts.map +1 -1
- package/dist/i18n/index.js +4 -2
- package/dist/i18n/index.jsx +4 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -12
- package/dist/index.jsx +18 -12
- package/dist/interactions/FocusableProvider.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.map +1 -1
- package/dist/interactions/index.js +1 -2
- package/dist/interactions/index.jsx +1 -2
- package/dist/label/createLabels.d.ts.map +1 -1
- package/dist/listbox/createListBox.d.ts.map +1 -1
- package/dist/listbox/createOption.d.ts +1 -1
- package/dist/listbox/createOption.d.ts.map +1 -1
- package/dist/live-announcer/index.js +1 -1
- package/dist/live-announcer/index.jsx +1 -1
- package/dist/select/createSelect.d.ts +2 -0
- package/dist/select/createSelect.d.ts.map +1 -1
- package/dist/selection/createSelectableItem.d.ts.map +1 -1
- package/dist/selection/index.js +2 -1
- package/dist/selection/index.jsx +2 -1
- 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/table/createTable.d.ts.map +1 -1
- package/dist/table/createTableColumnHeader.d.ts.map +1 -1
- package/dist/table/createTableRow.d.ts.map +1 -1
- package/dist/table/createTableSelectionCheckbox.d.ts.map +1 -1
- package/dist/table/types.d.ts +8 -0
- 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 +1 -0
- package/dist/tabs/createTabs.d.ts.map +1 -1
- 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/toolbar/createToolbar.d.ts.map +1 -1
- package/dist/tree/createTree.d.ts.map +1 -1
- package/dist/tree/createTreeSelectionCheckbox.d.ts.map +1 -1
- package/dist/utils/animation.d.ts.map +1 -1
- package/dist/utils/dom.d.ts +1 -0
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -3
- package/dist/utils/index.jsx +4 -3
- package/package.json +2 -2
- package/src/actiongroup/createActionGroup.ts +26 -109
- package/src/autocomplete/createAutocomplete.ts +136 -15
- package/src/breadcrumbs/createBreadcrumbs.ts +12 -4
- package/src/button/createToggleButtonGroup.ts +19 -14
- package/src/calendar/createCalendar.ts +3 -4
- package/src/calendar/createCalendarCell.ts +17 -3
- package/src/calendar/createCalendarGrid.ts +5 -4
- package/src/calendar/createRangeCalendar.ts +27 -17
- package/src/calendar/createRangeCalendarCell.ts +17 -3
- package/src/calendar/intl/index.ts +8 -0
- 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 -389
- 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 +487 -373
- 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 +36 -0
- package/src/focus/FocusScope.tsx +120 -12
- package/src/focus/index.ts +8 -0
- package/src/focus/virtualFocus.ts +55 -0
- package/src/gridlist/createGridList.ts +52 -16
- package/src/index.ts +11 -3
- package/src/interactions/FocusableProvider.tsx +11 -6
- package/src/interactions/createFocus.ts +26 -21
- package/src/interactions/createFocusWithin.ts +23 -24
- package/src/interactions/createInteractionModality.ts +5 -3
- package/src/label/createLabels.ts +7 -4
- package/src/listbox/createListBox.ts +74 -2
- package/src/listbox/createOption.ts +16 -1
- package/src/select/createSelect.ts +23 -2
- package/src/selection/createSelectableItem.ts +14 -0
- package/src/spinbutton/createSpinButton.ts +163 -0
- package/src/spinbutton/index.ts +10 -0
- package/src/spinbutton/intl.ts +115 -0
- package/src/table/createTable.ts +26 -1
- package/src/table/createTableColumnHeader.ts +10 -0
- package/src/table/createTableRow.ts +10 -0
- package/src/table/createTableSelectionCheckbox.ts +24 -1
- package/src/table/types.ts +8 -0
- package/src/table/utils.ts +41 -0
- package/src/tabs/createTabs.ts +53 -12
- package/src/tag/createTag.ts +21 -32
- package/src/tag/createTagGroup.ts +92 -0
- package/src/toolbar/createToolbar.ts +6 -58
- package/src/tree/createTree.ts +69 -14
- package/src/tree/createTreeSelectionCheckbox.ts +14 -1
- package/src/utils/animation.ts +119 -27
- package/src/utils/dom.ts +3 -2
- package/src/utils/index.ts +2 -0
- package/dist/_chunk/createLongPress.js +0 -91
- package/dist/_chunk/createLongPress.js.map +0 -1
- package/dist/_chunk/createLongPress.jsx +0 -91
- package/dist/_chunk/createLongPress.jsx.map +0 -1
- package/dist/_chunk/form.js.map +0 -1
- package/dist/_chunk/form.jsx.map +0 -1
- package/dist/_chunk/live-announcer.js.map +0 -1
- package/dist/_chunk/live-announcer.jsx.map +0 -1
- package/dist/datepicker/createTimeSegment.d.ts +0 -29
- package/dist/datepicker/createTimeSegment.d.ts.map +0 -1
- package/src/datepicker/createTimeSegment.ts +0 -352
package/src/utils/animation.ts
CHANGED
|
@@ -27,7 +27,14 @@
|
|
|
27
27
|
* the `CSSTransition` reference is only touched on the client.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
createComputed,
|
|
32
|
+
createEffect,
|
|
33
|
+
createMemo,
|
|
34
|
+
createSignal,
|
|
35
|
+
onCleanup,
|
|
36
|
+
type Accessor,
|
|
37
|
+
} from "solid-js";
|
|
31
38
|
|
|
32
39
|
/** A reactive accessor for the animated element (null until mounted). */
|
|
33
40
|
export type ElementAccessor = () => Element | null | undefined;
|
|
@@ -35,11 +42,24 @@ export type ElementAccessor = () => Element | null | undefined;
|
|
|
35
42
|
/**
|
|
36
43
|
* Runs `onEnd` once the element's animations settle while `isActive` is true.
|
|
37
44
|
* Mirrors the private `useAnimation` helper in react-aria's animation utils.
|
|
45
|
+
*
|
|
46
|
+
* `deferNoAnimation` mirrors React's timing for the no-animation case. Upstream
|
|
47
|
+
* runs `onEnd` inside a `useLayoutEffect`, so an animation-less exit unmounts
|
|
48
|
+
* *after* React commits — i.e. after the triggering input event finishes
|
|
49
|
+
* dispatching (empirically, an Escape's teardown lands after `keyup`, not
|
|
50
|
+
* between `keydown` and `keyup`). A Solid `createEffect` runs synchronously
|
|
51
|
+
* inside the handler, so an animation-less exit would tear the overlay out
|
|
52
|
+
* mid-gesture, firing `focusout` before `keyup` and retargeting `keyup` to the
|
|
53
|
+
* body. Deferring `onEnd` to the next frame — the same primitive `FocusScope`
|
|
54
|
+
* uses to defer focus restore — reproduces React's post-commit ordering. Only
|
|
55
|
+
* the real-browser no-animation branch defers; the JSDOM branch stays
|
|
56
|
+
* synchronous so unit tests that assert immediate unmount are unaffected.
|
|
38
57
|
*/
|
|
39
58
|
function createAnimation(
|
|
40
59
|
ref: ElementAccessor,
|
|
41
60
|
isActive: Accessor<boolean>,
|
|
42
61
|
onEnd: () => void,
|
|
62
|
+
deferNoAnimation = false,
|
|
43
63
|
): void {
|
|
44
64
|
createEffect(() => {
|
|
45
65
|
if (!isActive()) return;
|
|
@@ -52,19 +72,49 @@ function createAnimation(
|
|
|
52
72
|
return;
|
|
53
73
|
}
|
|
54
74
|
|
|
75
|
+
// `settle` mirrors React's post-commit `useLayoutEffect` timing (see the
|
|
76
|
+
// `deferNoAnimation` note above): a Solid effect runs synchronously inside
|
|
77
|
+
// the triggering input handler, and even the Web-Animations `finished`
|
|
78
|
+
// promise resolves in a microtask that drains *before* the gesture's later
|
|
79
|
+
// events (e.g. an Escape's `keyup`). Deferring the settle to the next frame
|
|
80
|
+
// pushes the overlay teardown past the rest of the current event dispatch,
|
|
81
|
+
// reproducing React's ordering (teardown after `keyup`, not between
|
|
82
|
+
// `keydown` and `keyup`). A real, non-trivial exit transition already
|
|
83
|
+
// finishes long after the gesture, so the extra frame is imperceptible; it
|
|
84
|
+
// only matters for the instant/near-zero-duration exits that would
|
|
85
|
+
// otherwise tear the focused overlay out mid-gesture. Unit environments
|
|
86
|
+
// (no `requestAnimationFrame`, or the no-defer callers) settle synchronously.
|
|
87
|
+
//
|
|
88
|
+
// A single owner-bound `onCleanup` tracks both the pending frame and a
|
|
89
|
+
// `canceled` flag — the flag guards the promise path, whose `.then` runs
|
|
90
|
+
// outside the reactive owner where `onCleanup` could not register.
|
|
91
|
+
let canceled = false;
|
|
92
|
+
let frame: number | undefined;
|
|
93
|
+
const settle = () => {
|
|
94
|
+
if (canceled) return;
|
|
95
|
+
if (deferNoAnimation && typeof requestAnimationFrame === "function") {
|
|
96
|
+
frame = requestAnimationFrame(() => {
|
|
97
|
+
if (!canceled) onEnd();
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
onEnd();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
55
104
|
const animations = element.getAnimations();
|
|
56
105
|
if (animations.length === 0) {
|
|
57
|
-
|
|
58
|
-
|
|
106
|
+
settle();
|
|
107
|
+
} else {
|
|
108
|
+
Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {
|
|
109
|
+
settle();
|
|
110
|
+
});
|
|
59
111
|
}
|
|
60
112
|
|
|
61
|
-
let canceled = false;
|
|
62
|
-
Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {
|
|
63
|
-
if (!canceled) onEnd();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
113
|
onCleanup(() => {
|
|
67
114
|
canceled = true;
|
|
115
|
+
if (frame !== undefined && typeof cancelAnimationFrame === "function") {
|
|
116
|
+
cancelAnimationFrame(frame);
|
|
117
|
+
}
|
|
68
118
|
});
|
|
69
119
|
});
|
|
70
120
|
}
|
|
@@ -125,27 +175,69 @@ export function createExitAnimation(
|
|
|
125
175
|
ref: ElementAccessor,
|
|
126
176
|
isOpen: Accessor<boolean>,
|
|
127
177
|
): Accessor<boolean> {
|
|
128
|
-
|
|
129
|
-
|
|
178
|
+
// The state machine's synchronous edges (open→exiting on close, →open on
|
|
179
|
+
// reopen) are computed in a `createMemo`, NOT a `createEffect`. This is the
|
|
180
|
+
// Solid equivalent of react-aria's `setState`-*during-render*: because the
|
|
181
|
+
// memo is a dependency of the caller's mount gate (`isOpen() || isExiting()`),
|
|
182
|
+
// Solid recomputes it *before* the gate in the same synchronous propagation
|
|
183
|
+
// that flips `isOpen`. A `createEffect` runs in the later effects phase, so
|
|
184
|
+
// the gate would first observe `!isOpen && !isExiting` and unmount the
|
|
185
|
+
// overlay, then the effect would flip `exiting` true and remount it from
|
|
186
|
+
// scratch — recreating the whole subtree (Dialog section, focus scope) and
|
|
187
|
+
// firing a spurious focus bounce mid-gesture. The memo closes that window so
|
|
188
|
+
// the overlay stays mounted continuously through the exit, matching React's
|
|
189
|
+
// single-commit `isOpen || isExiting`.
|
|
190
|
+
//
|
|
191
|
+
// Only the *async* edge (exiting→closed, when the animation settles) stays
|
|
192
|
+
// event-driven: `createAnimation` bumps `exitFinished`, and the memo
|
|
193
|
+
// acknowledges the new value via `ackedFinish` carried in its own previous
|
|
194
|
+
// result — a pure epoch/ack so the memo never mutates external state.
|
|
195
|
+
type ExitState = "closed" | "open" | "exiting";
|
|
196
|
+
const [exitFinished, setExitFinished] = createSignal(0);
|
|
197
|
+
|
|
198
|
+
const exitState = createMemo<{ state: ExitState; ackedFinish: number }>(
|
|
199
|
+
(prev) => {
|
|
200
|
+
const open = isOpen();
|
|
201
|
+
const finish = exitFinished();
|
|
202
|
+
const compute = (): { state: ExitState; ackedFinish: number } => {
|
|
203
|
+
if (open) return { state: "open", ackedFinish: finish };
|
|
204
|
+
// Open element requested to close: begin exiting.
|
|
205
|
+
if (prev.state === "open") return { state: "exiting", ackedFinish: finish };
|
|
206
|
+
// Mid-exit: settle to closed only once the animation reports a new finish.
|
|
207
|
+
if (prev.state === "exiting") {
|
|
208
|
+
if (finish !== prev.ackedFinish) return { state: "closed", ackedFinish: finish };
|
|
209
|
+
return prev;
|
|
210
|
+
}
|
|
211
|
+
return { state: "closed", ackedFinish: finish };
|
|
212
|
+
};
|
|
213
|
+
return compute();
|
|
214
|
+
},
|
|
215
|
+
{ state: isOpen() ? "open" : "closed", ackedFinish: 0 },
|
|
130
216
|
);
|
|
131
217
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
218
|
+
const isExiting = () => exitState().state === "exiting";
|
|
219
|
+
|
|
220
|
+
// Keep the state machine eagerly subscribed. The caller's mount gate
|
|
221
|
+
// `isOpen() || isExiting()` short-circuits on `isOpen()` while open and never
|
|
222
|
+
// reads `isExiting`, so this lazy memo would go unobserved for the whole open
|
|
223
|
+
// lifetime — never advancing to "open". Then on close it would recompute once,
|
|
224
|
+
// straight from its stale initial "closed" back to "closed" (the "open→exiting"
|
|
225
|
+
// edge never taken), collapsing the exit: `combinedExiting` stays false, the
|
|
226
|
+
// caller's `<Show>` sees the gate go falsy, and the overlay Portal unmounts
|
|
227
|
+
// synchronously mid-gesture (blurring the focused dialog to <body> before the
|
|
228
|
+
// triggering key's `keyup`). An eager reader forces the memo to track `isOpen`
|
|
229
|
+
// continuously so `prev.state === "open"` holds when the close edge runs —
|
|
230
|
+
// mirroring React, whose component re-renders and re-derives this every commit.
|
|
231
|
+
createComputed(() => void exitState());
|
|
232
|
+
|
|
233
|
+
createAnimation(
|
|
234
|
+
ref,
|
|
235
|
+
isExiting,
|
|
236
|
+
() => {
|
|
237
|
+
setExitFinished((n) => n + 1);
|
|
238
|
+
},
|
|
239
|
+
true,
|
|
240
|
+
);
|
|
149
241
|
|
|
150
242
|
return isExiting;
|
|
151
243
|
}
|
package/src/utils/dom.ts
CHANGED
|
@@ -502,9 +502,10 @@ export function isFocusWithin(element: Element): boolean {
|
|
|
502
502
|
*/
|
|
503
503
|
export function getFocusableTreeWalker(
|
|
504
504
|
root: Element,
|
|
505
|
-
opts?: { tabbable?: boolean; from?: Node },
|
|
505
|
+
opts?: { tabbable?: boolean; from?: Node; accept?: (node: Element) => boolean },
|
|
506
506
|
): TreeWalker {
|
|
507
|
-
const accept = (node: Element) =>
|
|
507
|
+
const accept = (node: Element) =>
|
|
508
|
+
(opts?.tabbable ? isTabbable(node) : isFocusable(node)) && (!opts?.accept || opts.accept(node));
|
|
508
509
|
const walker = getOwnerDocument(root).createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
|
|
509
510
|
acceptNode(node) {
|
|
510
511
|
// Skip nodes inside the optional starting node.
|
package/src/utils/index.ts
CHANGED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { t as createPress } from "./createPress.js";
|
|
2
|
-
import { o as mergeProps } from "./env.js";
|
|
3
|
-
import { i as createDescription, s as createGlobalListeners } from "./utils.js";
|
|
4
|
-
import { n as focusWithoutScrolling } from "./focus.js";
|
|
5
|
-
import { onCleanup } from "solid-js";
|
|
6
|
-
//#region src/interactions/createLongPress.ts
|
|
7
|
-
/**
|
|
8
|
-
* createLongPress - Handles long press interactions across mouse and touch.
|
|
9
|
-
*
|
|
10
|
-
* Port of @react-aria/interactions useLongPress, adapted for SolidJS.
|
|
11
|
-
*/
|
|
12
|
-
const DEFAULT_THRESHOLD = 500;
|
|
13
|
-
function isDisabledValue(isDisabled) {
|
|
14
|
-
return typeof isDisabled === "function" ? isDisabled() : !!isDisabled;
|
|
15
|
-
}
|
|
16
|
-
function createLongPressEvent(type, e) {
|
|
17
|
-
return {
|
|
18
|
-
type,
|
|
19
|
-
pointerType: e.pointerType,
|
|
20
|
-
target: e.target,
|
|
21
|
-
shiftKey: e.shiftKey,
|
|
22
|
-
ctrlKey: e.ctrlKey,
|
|
23
|
-
metaKey: e.metaKey,
|
|
24
|
-
altKey: e.altKey,
|
|
25
|
-
x: e.x,
|
|
26
|
-
y: e.y
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Handles long press interactions across mouse and touch devices.
|
|
31
|
-
*/
|
|
32
|
-
function createLongPress(props = {}) {
|
|
33
|
-
const { isDisabled, onLongPressStart, onLongPressEnd, onLongPress, threshold = DEFAULT_THRESHOLD, accessibilityDescription } = props;
|
|
34
|
-
let timeoutId;
|
|
35
|
-
const { addGlobalListener } = createGlobalListeners();
|
|
36
|
-
const { pressProps } = createPress({
|
|
37
|
-
isDisabled,
|
|
38
|
-
onPressStart(e) {
|
|
39
|
-
e.continuePropagation();
|
|
40
|
-
if (e.pointerType === "mouse" || e.pointerType === "touch") {
|
|
41
|
-
onLongPressStart?.(createLongPressEvent("longpressstart", e));
|
|
42
|
-
timeoutId = setTimeout(() => {
|
|
43
|
-
e.target.dispatchEvent(new PointerEvent("pointercancel", { bubbles: true }));
|
|
44
|
-
if (document.activeElement !== e.target) focusWithoutScrolling(e.target);
|
|
45
|
-
onLongPress?.(createLongPressEvent("longpress", e));
|
|
46
|
-
timeoutId = void 0;
|
|
47
|
-
}, threshold);
|
|
48
|
-
if (e.pointerType === "touch") {
|
|
49
|
-
const onContextMenu = (event) => {
|
|
50
|
-
event.preventDefault();
|
|
51
|
-
};
|
|
52
|
-
const target = e.target;
|
|
53
|
-
target.addEventListener("contextmenu", onContextMenu, { once: true });
|
|
54
|
-
addGlobalListener("pointerup", () => {
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
target.removeEventListener("contextmenu", onContextMenu);
|
|
57
|
-
}, 30);
|
|
58
|
-
}, {
|
|
59
|
-
isWindow: true,
|
|
60
|
-
once: true
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
onPressEnd(e) {
|
|
66
|
-
if (timeoutId) {
|
|
67
|
-
clearTimeout(timeoutId);
|
|
68
|
-
timeoutId = void 0;
|
|
69
|
-
}
|
|
70
|
-
if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch")) onLongPressEnd(createLongPressEvent("longpressend", e));
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const descriptionProps = createDescription(() => onLongPress && !isDisabledValue(isDisabled) ? accessibilityDescription : void 0);
|
|
74
|
-
onCleanup(() => {
|
|
75
|
-
if (timeoutId) {
|
|
76
|
-
clearTimeout(timeoutId);
|
|
77
|
-
timeoutId = void 0;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
const longPressProps = mergeProps(pressProps);
|
|
81
|
-
Object.defineProperty(longPressProps, "aria-describedby", {
|
|
82
|
-
get: () => descriptionProps["aria-describedby"],
|
|
83
|
-
enumerable: true,
|
|
84
|
-
configurable: true
|
|
85
|
-
});
|
|
86
|
-
return { longPressProps };
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
export { createLongPress as t };
|
|
90
|
-
|
|
91
|
-
//# sourceMappingURL=createLongPress.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createLongPress.js","names":[],"sources":["../../src/interactions/createLongPress.ts"],"sourcesContent":["/**\n * createLongPress - Handles long press interactions across mouse and touch.\n *\n * Port of @react-aria/interactions useLongPress, adapted for SolidJS.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { createPress, type PressEvent } from \"./createPress\";\nimport { mergeProps, focusWithoutScrolling, createGlobalListeners } from \"../utils\";\nimport { createDescription } from \"../utils/createDescription\";\nimport { type MaybeAccessor } from \"../utils/reactivity\";\n\nexport interface LongPressEvent {\n /** The type of long press event being fired. */\n type: \"longpressstart\" | \"longpressend\" | \"longpress\";\n /** The pointer type that triggered the long press. */\n pointerType: PressEvent[\"pointerType\"];\n /** The target element of the long press event. */\n target: Element;\n /** Whether the shift keyboard modifier was held during the long press event. */\n shiftKey: boolean;\n /** Whether the ctrl keyboard modifier was held during the long press event. */\n ctrlKey: boolean;\n /** Whether the meta keyboard modifier was held during the long press event. */\n metaKey: boolean;\n /** Whether the alt keyboard modifier was held during the long press event. */\n altKey: boolean;\n /** X position relative to the target. */\n x: number;\n /** Y position relative to the target. */\n y: number;\n}\n\nexport interface LongPressProps {\n /** Whether long press events should be disabled. */\n isDisabled?: MaybeAccessor<boolean>;\n /** Handler that is called when a long press interaction starts. */\n onLongPressStart?: (e: LongPressEvent) => void;\n /**\n * Handler that is called when a long press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onLongPressEnd?: (e: LongPressEvent) => void;\n /**\n * Handler that is called when the threshold time is met while\n * the press is over the target.\n */\n onLongPress?: (e: LongPressEvent) => void;\n /**\n * The amount of time in milliseconds to wait before triggering a long press.\n * @default 500ms\n */\n threshold?: number;\n /**\n * A description for assistive technology users indicating that a long press\n * action is available, e.g. \"Long press to open menu\".\n */\n accessibilityDescription?: string;\n}\n\nexport interface LongPressResult {\n /** Props to spread on the target element. */\n longPressProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nconst DEFAULT_THRESHOLD = 500;\n\nfunction isDisabledValue(isDisabled: MaybeAccessor<boolean> | undefined): boolean {\n return typeof isDisabled === \"function\" ? isDisabled() : !!isDisabled;\n}\n\nfunction createLongPressEvent(type: LongPressEvent[\"type\"], e: PressEvent): LongPressEvent {\n return {\n type,\n pointerType: e.pointerType,\n target: e.target,\n shiftKey: e.shiftKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n altKey: e.altKey,\n x: e.x,\n y: e.y,\n };\n}\n\n/**\n * Handles long press interactions across mouse and touch devices.\n */\nexport function createLongPress(props: LongPressProps = {}): LongPressResult {\n const {\n isDisabled,\n onLongPressStart,\n onLongPressEnd,\n onLongPress,\n threshold = DEFAULT_THRESHOLD,\n accessibilityDescription,\n } = props;\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n const { addGlobalListener } = createGlobalListeners();\n\n const { pressProps } = createPress({\n isDisabled,\n onPressStart(e) {\n e.continuePropagation();\n if (e.pointerType === \"mouse\" || e.pointerType === \"touch\") {\n onLongPressStart?.(createLongPressEvent(\"longpressstart\", e));\n\n timeoutId = setTimeout(() => {\n // Prevent other press handlers from also handling this event.\n e.target.dispatchEvent(new PointerEvent(\"pointercancel\", { bubbles: true }));\n\n // Ensure target is focused. On touch devices, browsers typically focus on pointer up.\n if (document.activeElement !== e.target) {\n focusWithoutScrolling(e.target as HTMLElement);\n }\n\n onLongPress?.(createLongPressEvent(\"longpress\", e));\n timeoutId = undefined;\n }, threshold);\n\n if (e.pointerType === \"touch\") {\n const onContextMenu = (event: Event) => {\n event.preventDefault();\n };\n const target = e.target as HTMLElement;\n target.addEventListener(\"contextmenu\", onContextMenu, { once: true });\n\n addGlobalListener(\n \"pointerup\",\n () => {\n setTimeout(() => {\n target.removeEventListener(\"contextmenu\", onContextMenu);\n }, 30);\n },\n { isWindow: true, once: true },\n );\n }\n }\n },\n onPressEnd(e) {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n if (onLongPressEnd && (e.pointerType === \"mouse\" || e.pointerType === \"touch\")) {\n onLongPressEnd(createLongPressEvent(\"longpressend\", e));\n }\n },\n });\n\n const descriptionProps = createDescription(() =>\n onLongPress && !isDisabledValue(isDisabled) ? accessibilityDescription : undefined,\n );\n\n onCleanup(() => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n });\n\n const longPressProps = mergeProps(pressProps) as JSX.HTMLAttributes<HTMLElement>;\n Object.defineProperty(longPressProps, \"aria-describedby\", {\n get: () => descriptionProps[\"aria-describedby\"],\n enumerable: true,\n configurable: true,\n });\n\n return {\n longPressProps,\n };\n}\n"],"mappings":";;;;;;;;;;;AAiEA,MAAM,oBAAoB;AAE1B,SAAS,gBAAgB,YAAyD;CAChF,OAAO,OAAO,eAAe,aAAa,WAAW,IAAI,CAAC,CAAC;AAC7D;AAEA,SAAS,qBAAqB,MAA8B,GAA+B;CACzF,OAAO;EACL;EACA,aAAa,EAAE;EACf,QAAQ,EAAE;EACV,UAAU,EAAE;EACZ,SAAS,EAAE;EACX,SAAS,EAAE;EACX,QAAQ,EAAE;EACV,GAAG,EAAE;EACL,GAAG,EAAE;CACP;AACF;;;;AAKA,SAAgB,gBAAgB,QAAwB,CAAC,GAAoB;CAC3E,MAAM,EACJ,YACA,kBACA,gBACA,aACA,YAAY,mBACZ,6BACE;CAEJ,IAAI;CACJ,MAAM,EAAE,sBAAsB,sBAAsB;CAEpD,MAAM,EAAE,eAAe,YAAY;EACjC;EACA,aAAa,GAAG;GACd,EAAE,oBAAoB;GACtB,IAAI,EAAE,gBAAgB,WAAW,EAAE,gBAAgB,SAAS;IAC1D,mBAAmB,qBAAqB,kBAAkB,CAAC,CAAC;IAE5D,YAAY,iBAAiB;KAE3B,EAAE,OAAO,cAAc,IAAI,aAAa,iBAAiB,EAAE,SAAS,KAAK,CAAC,CAAC;KAG3E,IAAI,SAAS,kBAAkB,EAAE,QAC/B,sBAAsB,EAAE,MAAqB;KAG/C,cAAc,qBAAqB,aAAa,CAAC,CAAC;KAClD,YAAY,KAAA;IACd,GAAG,SAAS;IAEZ,IAAI,EAAE,gBAAgB,SAAS;KAC7B,MAAM,iBAAiB,UAAiB;MACtC,MAAM,eAAe;KACvB;KACA,MAAM,SAAS,EAAE;KACjB,OAAO,iBAAiB,eAAe,eAAe,EAAE,MAAM,KAAK,CAAC;KAEpE,kBACE,mBACM;MACJ,iBAAiB;OACf,OAAO,oBAAoB,eAAe,aAAa;MACzD,GAAG,EAAE;KACP,GACA;MAAE,UAAU;MAAM,MAAM;KAAK,CAC/B;IACF;GACF;EACF;EACA,WAAW,GAAG;GACZ,IAAI,WAAW;IACb,aAAa,SAAS;IACtB,YAAY,KAAA;GACd;GAEA,IAAI,mBAAmB,EAAE,gBAAgB,WAAW,EAAE,gBAAgB,UACpE,eAAe,qBAAqB,gBAAgB,CAAC,CAAC;EAE1D;CACF,CAAC;CAED,MAAM,mBAAmB,wBACvB,eAAe,CAAC,gBAAgB,UAAU,IAAI,2BAA2B,KAAA,CAC3E;CAEA,gBAAgB;EACd,IAAI,WAAW;GACb,aAAa,SAAS;GACtB,YAAY,KAAA;EACd;CACF,CAAC;CAED,MAAM,iBAAiB,WAAW,UAAU;CAC5C,OAAO,eAAe,gBAAgB,oBAAoB;EACxD,WAAW,iBAAiB;EAC5B,YAAY;EACZ,cAAc;CAChB,CAAC;CAED,OAAO,EACL,eACF;AACF"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { t as createPress } from "./createPress.jsx";
|
|
2
|
-
import { o as mergeProps } from "./env.jsx";
|
|
3
|
-
import { i as createDescription, s as createGlobalListeners } from "./utils.jsx";
|
|
4
|
-
import { n as focusWithoutScrolling } from "./focus.jsx";
|
|
5
|
-
import { onCleanup } from "solid-js";
|
|
6
|
-
//#region src/interactions/createLongPress.ts
|
|
7
|
-
/**
|
|
8
|
-
* createLongPress - Handles long press interactions across mouse and touch.
|
|
9
|
-
*
|
|
10
|
-
* Port of @react-aria/interactions useLongPress, adapted for SolidJS.
|
|
11
|
-
*/
|
|
12
|
-
const DEFAULT_THRESHOLD = 500;
|
|
13
|
-
function isDisabledValue(isDisabled) {
|
|
14
|
-
return typeof isDisabled === "function" ? isDisabled() : !!isDisabled;
|
|
15
|
-
}
|
|
16
|
-
function createLongPressEvent(type, e) {
|
|
17
|
-
return {
|
|
18
|
-
type,
|
|
19
|
-
pointerType: e.pointerType,
|
|
20
|
-
target: e.target,
|
|
21
|
-
shiftKey: e.shiftKey,
|
|
22
|
-
ctrlKey: e.ctrlKey,
|
|
23
|
-
metaKey: e.metaKey,
|
|
24
|
-
altKey: e.altKey,
|
|
25
|
-
x: e.x,
|
|
26
|
-
y: e.y
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Handles long press interactions across mouse and touch devices.
|
|
31
|
-
*/
|
|
32
|
-
function createLongPress(props = {}) {
|
|
33
|
-
const { isDisabled, onLongPressStart, onLongPressEnd, onLongPress, threshold = DEFAULT_THRESHOLD, accessibilityDescription } = props;
|
|
34
|
-
let timeoutId;
|
|
35
|
-
const { addGlobalListener } = createGlobalListeners();
|
|
36
|
-
const { pressProps } = createPress({
|
|
37
|
-
isDisabled,
|
|
38
|
-
onPressStart(e) {
|
|
39
|
-
e.continuePropagation();
|
|
40
|
-
if (e.pointerType === "mouse" || e.pointerType === "touch") {
|
|
41
|
-
onLongPressStart?.(createLongPressEvent("longpressstart", e));
|
|
42
|
-
timeoutId = setTimeout(() => {
|
|
43
|
-
e.target.dispatchEvent(new PointerEvent("pointercancel", { bubbles: true }));
|
|
44
|
-
if (document.activeElement !== e.target) focusWithoutScrolling(e.target);
|
|
45
|
-
onLongPress?.(createLongPressEvent("longpress", e));
|
|
46
|
-
timeoutId = void 0;
|
|
47
|
-
}, threshold);
|
|
48
|
-
if (e.pointerType === "touch") {
|
|
49
|
-
const onContextMenu = (event) => {
|
|
50
|
-
event.preventDefault();
|
|
51
|
-
};
|
|
52
|
-
const target = e.target;
|
|
53
|
-
target.addEventListener("contextmenu", onContextMenu, { once: true });
|
|
54
|
-
addGlobalListener("pointerup", () => {
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
target.removeEventListener("contextmenu", onContextMenu);
|
|
57
|
-
}, 30);
|
|
58
|
-
}, {
|
|
59
|
-
isWindow: true,
|
|
60
|
-
once: true
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
onPressEnd(e) {
|
|
66
|
-
if (timeoutId) {
|
|
67
|
-
clearTimeout(timeoutId);
|
|
68
|
-
timeoutId = void 0;
|
|
69
|
-
}
|
|
70
|
-
if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch")) onLongPressEnd(createLongPressEvent("longpressend", e));
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const descriptionProps = createDescription(() => onLongPress && !isDisabledValue(isDisabled) ? accessibilityDescription : void 0);
|
|
74
|
-
onCleanup(() => {
|
|
75
|
-
if (timeoutId) {
|
|
76
|
-
clearTimeout(timeoutId);
|
|
77
|
-
timeoutId = void 0;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
const longPressProps = mergeProps(pressProps);
|
|
81
|
-
Object.defineProperty(longPressProps, "aria-describedby", {
|
|
82
|
-
get: () => descriptionProps["aria-describedby"],
|
|
83
|
-
enumerable: true,
|
|
84
|
-
configurable: true
|
|
85
|
-
});
|
|
86
|
-
return { longPressProps };
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
export { createLongPress as t };
|
|
90
|
-
|
|
91
|
-
//# sourceMappingURL=createLongPress.jsx.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createLongPress.jsx","names":[],"sources":["../../src/interactions/createLongPress.ts"],"sourcesContent":["/**\n * createLongPress - Handles long press interactions across mouse and touch.\n *\n * Port of @react-aria/interactions useLongPress, adapted for SolidJS.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { createPress, type PressEvent } from \"./createPress\";\nimport { mergeProps, focusWithoutScrolling, createGlobalListeners } from \"../utils\";\nimport { createDescription } from \"../utils/createDescription\";\nimport { type MaybeAccessor } from \"../utils/reactivity\";\n\nexport interface LongPressEvent {\n /** The type of long press event being fired. */\n type: \"longpressstart\" | \"longpressend\" | \"longpress\";\n /** The pointer type that triggered the long press. */\n pointerType: PressEvent[\"pointerType\"];\n /** The target element of the long press event. */\n target: Element;\n /** Whether the shift keyboard modifier was held during the long press event. */\n shiftKey: boolean;\n /** Whether the ctrl keyboard modifier was held during the long press event. */\n ctrlKey: boolean;\n /** Whether the meta keyboard modifier was held during the long press event. */\n metaKey: boolean;\n /** Whether the alt keyboard modifier was held during the long press event. */\n altKey: boolean;\n /** X position relative to the target. */\n x: number;\n /** Y position relative to the target. */\n y: number;\n}\n\nexport interface LongPressProps {\n /** Whether long press events should be disabled. */\n isDisabled?: MaybeAccessor<boolean>;\n /** Handler that is called when a long press interaction starts. */\n onLongPressStart?: (e: LongPressEvent) => void;\n /**\n * Handler that is called when a long press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onLongPressEnd?: (e: LongPressEvent) => void;\n /**\n * Handler that is called when the threshold time is met while\n * the press is over the target.\n */\n onLongPress?: (e: LongPressEvent) => void;\n /**\n * The amount of time in milliseconds to wait before triggering a long press.\n * @default 500ms\n */\n threshold?: number;\n /**\n * A description for assistive technology users indicating that a long press\n * action is available, e.g. \"Long press to open menu\".\n */\n accessibilityDescription?: string;\n}\n\nexport interface LongPressResult {\n /** Props to spread on the target element. */\n longPressProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nconst DEFAULT_THRESHOLD = 500;\n\nfunction isDisabledValue(isDisabled: MaybeAccessor<boolean> | undefined): boolean {\n return typeof isDisabled === \"function\" ? isDisabled() : !!isDisabled;\n}\n\nfunction createLongPressEvent(type: LongPressEvent[\"type\"], e: PressEvent): LongPressEvent {\n return {\n type,\n pointerType: e.pointerType,\n target: e.target,\n shiftKey: e.shiftKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n altKey: e.altKey,\n x: e.x,\n y: e.y,\n };\n}\n\n/**\n * Handles long press interactions across mouse and touch devices.\n */\nexport function createLongPress(props: LongPressProps = {}): LongPressResult {\n const {\n isDisabled,\n onLongPressStart,\n onLongPressEnd,\n onLongPress,\n threshold = DEFAULT_THRESHOLD,\n accessibilityDescription,\n } = props;\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n const { addGlobalListener } = createGlobalListeners();\n\n const { pressProps } = createPress({\n isDisabled,\n onPressStart(e) {\n e.continuePropagation();\n if (e.pointerType === \"mouse\" || e.pointerType === \"touch\") {\n onLongPressStart?.(createLongPressEvent(\"longpressstart\", e));\n\n timeoutId = setTimeout(() => {\n // Prevent other press handlers from also handling this event.\n e.target.dispatchEvent(new PointerEvent(\"pointercancel\", { bubbles: true }));\n\n // Ensure target is focused. On touch devices, browsers typically focus on pointer up.\n if (document.activeElement !== e.target) {\n focusWithoutScrolling(e.target as HTMLElement);\n }\n\n onLongPress?.(createLongPressEvent(\"longpress\", e));\n timeoutId = undefined;\n }, threshold);\n\n if (e.pointerType === \"touch\") {\n const onContextMenu = (event: Event) => {\n event.preventDefault();\n };\n const target = e.target as HTMLElement;\n target.addEventListener(\"contextmenu\", onContextMenu, { once: true });\n\n addGlobalListener(\n \"pointerup\",\n () => {\n setTimeout(() => {\n target.removeEventListener(\"contextmenu\", onContextMenu);\n }, 30);\n },\n { isWindow: true, once: true },\n );\n }\n }\n },\n onPressEnd(e) {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n if (onLongPressEnd && (e.pointerType === \"mouse\" || e.pointerType === \"touch\")) {\n onLongPressEnd(createLongPressEvent(\"longpressend\", e));\n }\n },\n });\n\n const descriptionProps = createDescription(() =>\n onLongPress && !isDisabledValue(isDisabled) ? accessibilityDescription : undefined,\n );\n\n onCleanup(() => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n });\n\n const longPressProps = mergeProps(pressProps) as JSX.HTMLAttributes<HTMLElement>;\n Object.defineProperty(longPressProps, \"aria-describedby\", {\n get: () => descriptionProps[\"aria-describedby\"],\n enumerable: true,\n configurable: true,\n });\n\n return {\n longPressProps,\n };\n}\n"],"mappings":";;;;;;;;;;;AAiEA,MAAM,oBAAoB;AAE1B,SAAS,gBAAgB,YAAyD;CAChF,OAAO,OAAO,eAAe,aAAa,WAAW,IAAI,CAAC,CAAC;AAC7D;AAEA,SAAS,qBAAqB,MAA8B,GAA+B;CACzF,OAAO;EACL;EACA,aAAa,EAAE;EACf,QAAQ,EAAE;EACV,UAAU,EAAE;EACZ,SAAS,EAAE;EACX,SAAS,EAAE;EACX,QAAQ,EAAE;EACV,GAAG,EAAE;EACL,GAAG,EAAE;CACP;AACF;;;;AAKA,SAAgB,gBAAgB,QAAwB,CAAC,GAAoB;CAC3E,MAAM,EACJ,YACA,kBACA,gBACA,aACA,YAAY,mBACZ,6BACE;CAEJ,IAAI;CACJ,MAAM,EAAE,sBAAsB,sBAAsB;CAEpD,MAAM,EAAE,eAAe,YAAY;EACjC;EACA,aAAa,GAAG;GACd,EAAE,oBAAoB;GACtB,IAAI,EAAE,gBAAgB,WAAW,EAAE,gBAAgB,SAAS;IAC1D,mBAAmB,qBAAqB,kBAAkB,CAAC,CAAC;IAE5D,YAAY,iBAAiB;KAE3B,EAAE,OAAO,cAAc,IAAI,aAAa,iBAAiB,EAAE,SAAS,KAAK,CAAC,CAAC;KAG3E,IAAI,SAAS,kBAAkB,EAAE,QAC/B,sBAAsB,EAAE,MAAqB;KAG/C,cAAc,qBAAqB,aAAa,CAAC,CAAC;KAClD,YAAY,KAAA;IACd,GAAG,SAAS;IAEZ,IAAI,EAAE,gBAAgB,SAAS;KAC7B,MAAM,iBAAiB,UAAiB;MACtC,MAAM,eAAe;KACvB;KACA,MAAM,SAAS,EAAE;KACjB,OAAO,iBAAiB,eAAe,eAAe,EAAE,MAAM,KAAK,CAAC;KAEpE,kBACE,mBACM;MACJ,iBAAiB;OACf,OAAO,oBAAoB,eAAe,aAAa;MACzD,GAAG,EAAE;KACP,GACA;MAAE,UAAU;MAAM,MAAM;KAAK,CAC/B;IACF;GACF;EACF;EACA,WAAW,GAAG;GACZ,IAAI,WAAW;IACb,aAAa,SAAS;IACtB,YAAY,KAAA;GACd;GAEA,IAAI,mBAAmB,EAAE,gBAAgB,WAAW,EAAE,gBAAgB,UACpE,eAAe,qBAAqB,gBAAgB,CAAC,CAAC;EAE1D;CACF,CAAC;CAED,MAAM,mBAAmB,wBACvB,eAAe,CAAC,gBAAgB,UAAU,IAAI,2BAA2B,KAAA,CAC3E;CAEA,gBAAgB;EACd,IAAI,WAAW;GACb,aAAa,SAAS;GACtB,YAAY,KAAA;EACd;CACF,CAAC;CAED,MAAM,iBAAiB,WAAW,UAAU;CAC5C,OAAO,eAAe,gBAAgB,oBAAoB;EACxD,WAAW,iBAAiB;EAC5B,YAAY;EACZ,cAAc;CAChB,CAAC;CAED,OAAO,EACL,eACF;AACF"}
|
package/dist/_chunk/form.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","names":[],"sources":["../../src/form/createFormReset.ts"],"sourcesContent":["/**\n * createFormReset - Handles form reset events for form fields.\n *\n * Resets the field value to its default when the containing form is reset.\n * Port of @react-aria/utils useFormReset.\n */\n\nimport { type Accessor, createEffect, onCleanup } from \"solid-js\";\n\nexport interface FormResetOptions<T> {\n /** The default value to reset to. */\n defaultValue: T;\n /** Function to set the current value. */\n onReset: (value: T) => void;\n}\n\n/**\n * Listens for form reset events and resets the field value to its default.\n *\n * @example\n * ```tsx\n * createFormReset(\n * () => inputRef,\n * { label: 'Default' },\n * (value) => state.setSelectedKey(value.key)\n * );\n * ```\n */\nexport function createFormReset<T>(\n ref: Accessor<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | undefined>,\n defaultValue: T,\n onReset: (value: T) => void,\n): void {\n createEffect(() => {\n const element = ref();\n if (!element) return;\n\n const form = element.form;\n if (!form) return;\n\n const handleReset = () => {\n onReset(defaultValue);\n };\n\n form.addEventListener(\"reset\", handleReset);\n\n onCleanup(() => {\n form.removeEventListener(\"reset\", handleReset);\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,gBACd,KACA,cACA,SACM;CACN,mBAAmB;EACjB,MAAM,UAAU,IAAI;EACpB,IAAI,CAAC,SAAS;EAEd,MAAM,OAAO,QAAQ;EACrB,IAAI,CAAC,MAAM;EAEX,MAAM,oBAAoB;GACxB,QAAQ,YAAY;EACtB;EAEA,KAAK,iBAAiB,SAAS,WAAW;EAE1C,gBAAgB;GACd,KAAK,oBAAoB,SAAS,WAAW;EAC/C,CAAC;CACH,CAAC;AACH"}
|
package/dist/_chunk/form.jsx.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form.jsx","names":[],"sources":["../../src/form/createFormReset.ts"],"sourcesContent":["/**\n * createFormReset - Handles form reset events for form fields.\n *\n * Resets the field value to its default when the containing form is reset.\n * Port of @react-aria/utils useFormReset.\n */\n\nimport { type Accessor, createEffect, onCleanup } from \"solid-js\";\n\nexport interface FormResetOptions<T> {\n /** The default value to reset to. */\n defaultValue: T;\n /** Function to set the current value. */\n onReset: (value: T) => void;\n}\n\n/**\n * Listens for form reset events and resets the field value to its default.\n *\n * @example\n * ```tsx\n * createFormReset(\n * () => inputRef,\n * { label: 'Default' },\n * (value) => state.setSelectedKey(value.key)\n * );\n * ```\n */\nexport function createFormReset<T>(\n ref: Accessor<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | undefined>,\n defaultValue: T,\n onReset: (value: T) => void,\n): void {\n createEffect(() => {\n const element = ref();\n if (!element) return;\n\n const form = element.form;\n if (!form) return;\n\n const handleReset = () => {\n onReset(defaultValue);\n };\n\n form.addEventListener(\"reset\", handleReset);\n\n onCleanup(() => {\n form.removeEventListener(\"reset\", handleReset);\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,gBACd,KACA,cACA,SACM;CACN,mBAAmB;EACjB,MAAM,UAAU,IAAI;EACpB,IAAI,CAAC,SAAS;EAEd,MAAM,OAAO,QAAQ;EACrB,IAAI,CAAC,MAAM;EAEX,MAAM,oBAAoB;GACxB,QAAQ,YAAY;EACtB;EAEA,KAAK,iBAAiB,SAAS,WAAW;EAE1C,gBAAgB;GACd,KAAK,oBAAoB,SAAS,WAAW;EAC/C,CAAC;CACH,CAAC;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"live-announcer.js","names":[],"sources":["../../src/live-announcer/announce.ts"],"sourcesContent":["/**\n * Live announcer for solidaria\n *\n * Provides functions to make announcements to screen readers using\n * ARIA live regions. Useful for announcing dynamic content changes.\n *\n * Port of react-aria's @react-aria/live-announcer.\n *\n * SSR Safety: All functions are safe to call during SSR. The announcer\n * will only be created when running in the browser.\n */\n\nimport { onCleanup, createEffect } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\n\nexport type Assertiveness = \"assertive\" | \"polite\";\n\nexport type Message = string | { \"aria-labelledby\": string };\n\nconst LIVEREGION_TIMEOUT_DELAY = 7000;\n\n/**\n * Singleton class that manages live region announcements.\n * Implemented using vanilla DOM for simplicity and framework independence.\n */\nclass LiveAnnouncer {\n node: HTMLElement | null = null;\n assertiveLog: HTMLElement | null = null;\n politeLog: HTMLElement | null = null;\n\n constructor() {\n if (typeof document !== \"undefined\") {\n this.node = document.createElement(\"div\");\n this.node.dataset.liveAnnouncer = \"true\";\n // Visually hidden styles\n Object.assign(this.node.style, {\n border: \"0\",\n clip: \"rect(0 0 0 0)\",\n clipPath: \"inset(50%)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0\",\n position: \"absolute\",\n width: \"1px\",\n whiteSpace: \"nowrap\",\n });\n\n this.assertiveLog = this.createLog(\"assertive\");\n this.node.appendChild(this.assertiveLog);\n\n this.politeLog = this.createLog(\"polite\");\n this.node.appendChild(this.politeLog);\n\n document.body.prepend(this.node);\n }\n }\n\n isAttached(): boolean {\n return this.node?.isConnected ?? false;\n }\n\n createLog(ariaLive: string): HTMLElement {\n const node = document.createElement(\"div\");\n node.setAttribute(\"role\", \"log\");\n node.setAttribute(\"aria-live\", ariaLive);\n node.setAttribute(\"aria-relevant\", \"additions\");\n return node;\n }\n\n destroy(): void {\n if (!this.node) {\n return;\n }\n\n document.body.removeChild(this.node);\n this.node = null;\n }\n\n announce(\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n ): void {\n if (!this.node) {\n return;\n }\n\n const node = document.createElement(\"div\");\n if (typeof message === \"object\") {\n // To read an aria-labelledby, the element must have an appropriate role, such as img.\n node.setAttribute(\"role\", \"img\");\n node.setAttribute(\"aria-labelledby\", message[\"aria-labelledby\"]);\n } else {\n node.textContent = message;\n }\n\n if (assertiveness === \"assertive\") {\n this.assertiveLog?.appendChild(node);\n } else {\n this.politeLog?.appendChild(node);\n }\n\n if (message !== \"\") {\n setTimeout(() => {\n node.remove();\n }, timeout);\n }\n }\n\n clear(assertiveness?: Assertiveness): void {\n if (!this.node) {\n return;\n }\n\n if ((!assertiveness || assertiveness === \"assertive\") && this.assertiveLog) {\n this.assertiveLog.innerHTML = \"\";\n }\n\n if ((!assertiveness || assertiveness === \"polite\") && this.politeLog) {\n this.politeLog.innerHTML = \"\";\n }\n }\n}\n\nlet liveAnnouncer: LiveAnnouncer | null = null;\n\n/**\n * Announces a message to screen readers using ARIA live regions.\n *\n * @param message - The message to announce, or an object with aria-labelledby\n * @param assertiveness - 'assertive' interrupts, 'polite' waits for a pause\n * @param timeout - How long to keep the message in the DOM (default 7000ms)\n *\n * @example\n * ```tsx\n * // Simple announcement\n * announce('Item added to cart');\n *\n * // Polite announcement (won't interrupt)\n * announce('3 results found', 'polite');\n *\n * // Using aria-labelledby for complex content\n * announce({ 'aria-labelledby': 'my-element-id' });\n * ```\n */\nexport function announce(\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n): void {\n if (!liveAnnouncer) {\n liveAnnouncer = new LiveAnnouncer();\n // Wait for the live announcer regions to be added to the DOM, then announce.\n // Otherwise Safari won't announce the message if it's added too quickly.\n // Found most times less than 100ms were not consistent when announcing with Safari.\n\n // Check for test environment\n const isTestEnv =\n typeof (globalThis as Record<string, unknown>).IS_SOLIDARIA_TEST === \"boolean\"\n ? (globalThis as Record<string, unknown>).IS_SOLIDARIA_TEST\n : typeof (globalThis as Record<string, unknown>).vitest !== \"undefined\";\n\n if (!isTestEnv) {\n setTimeout(() => {\n if (liveAnnouncer?.isAttached()) {\n liveAnnouncer?.announce(message, assertiveness, timeout);\n }\n }, 100);\n } else {\n liveAnnouncer.announce(message, assertiveness, timeout);\n }\n } else {\n liveAnnouncer.announce(message, assertiveness, timeout);\n }\n}\n\n/**\n * Clears all queued announcements for the given assertiveness level.\n *\n * @param assertiveness - Which log to clear ('assertive' or 'polite')\n *\n * @example\n * ```tsx\n * // Clear assertive announcements\n * clearAnnouncer('assertive');\n *\n * // Clear polite announcements\n * clearAnnouncer('polite');\n * ```\n */\nexport function clearAnnouncer(assertiveness?: Assertiveness): void {\n if (liveAnnouncer) {\n liveAnnouncer.clear(assertiveness);\n }\n}\n\n/**\n * Removes the live announcer from the DOM entirely.\n * Call this when unmounting your app or when announcements are no longer needed.\n *\n * @example\n * ```tsx\n * // Clean up on app unmount\n * onCleanup(() => {\n * destroyAnnouncer();\n * });\n * ```\n */\nexport function destroyAnnouncer(): void {\n if (liveAnnouncer) {\n liveAnnouncer.destroy();\n liveAnnouncer = null;\n }\n}\n\nexport interface UseAnnouncerResult {\n /** Announce a message to screen readers. */\n announce: (message: Message, assertiveness?: Assertiveness, timeout?: number) => void;\n /** Clear announcements for the given assertiveness level. */\n clear: (assertiveness?: Assertiveness) => void;\n}\n\n/**\n * Hook that provides access to the live announcer with automatic cleanup.\n *\n * This is the recommended way to use the announcer in SolidJS components.\n * It ensures the announcer is created only on the client and provides\n * type-safe methods for announcing and clearing messages.\n *\n * SSR Safety: Returns no-op functions during SSR. The announcer is only\n * created when the component mounts on the client.\n *\n * @example\n * ```tsx\n * function SearchResults(props) {\n * const announcer = useAnnouncer();\n *\n * createEffect(() => {\n * const count = props.results.length;\n * announcer.announce(`${count} results found`, 'polite');\n * });\n *\n * return <ul>...</ul>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * function Form() {\n * const announcer = useAnnouncer();\n *\n * const onSubmit = async () => {\n * try {\n * await submitForm();\n * announcer.announce('Form submitted successfully');\n * } catch (error) {\n * announcer.announce('Error submitting form', 'assertive');\n * }\n * };\n *\n * return <form onSubmit={onSubmit}>...</form>;\n * }\n * ```\n */\nexport function useAnnouncer(): UseAnnouncerResult {\n // During SSR, return no-op functions\n if (isServer) {\n return {\n announce: () => {},\n clear: () => {},\n };\n }\n\n // Ensure the announcer is initialized\n createEffect(() => {\n // Initialize on first use\n if (!liveAnnouncer) {\n liveAnnouncer = new LiveAnnouncer();\n }\n });\n\n return {\n announce: (\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n ) => {\n announce(message, assertiveness, timeout);\n },\n clear: (assertiveness?: Assertiveness) => {\n clearAnnouncer(assertiveness);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAM,2BAA2B;;;;;AAMjC,IAAM,gBAAN,MAAoB;CAClB,OAA2B;CAC3B,eAAmC;CACnC,YAAgC;CAEhC,cAAc;EACZ,IAAI,OAAO,aAAa,aAAa;GACnC,KAAK,OAAO,SAAS,cAAc,KAAK;GACxC,KAAK,KAAK,QAAQ,gBAAgB;GAElC,OAAO,OAAO,KAAK,KAAK,OAAO;IAC7B,QAAQ;IACR,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,UAAU;IACV,OAAO;IACP,YAAY;GACd,CAAC;GAED,KAAK,eAAe,KAAK,UAAU,WAAW;GAC9C,KAAK,KAAK,YAAY,KAAK,YAAY;GAEvC,KAAK,YAAY,KAAK,UAAU,QAAQ;GACxC,KAAK,KAAK,YAAY,KAAK,SAAS;GAEpC,SAAS,KAAK,QAAQ,KAAK,IAAI;EACjC;CACF;CAEA,aAAsB;EACpB,OAAO,KAAK,MAAM,eAAe;CACnC;CAEA,UAAU,UAA+B;EACvC,MAAM,OAAO,SAAS,cAAc,KAAK;EACzC,KAAK,aAAa,QAAQ,KAAK;EAC/B,KAAK,aAAa,aAAa,QAAQ;EACvC,KAAK,aAAa,iBAAiB,WAAW;EAC9C,OAAO;CACT;CAEA,UAAgB;EACd,IAAI,CAAC,KAAK,MACR;EAGF,SAAS,KAAK,YAAY,KAAK,IAAI;EACnC,KAAK,OAAO;CACd;CAEA,SACE,SACA,gBAA+B,aAC/B,UAAkB,0BACZ;EACN,IAAI,CAAC,KAAK,MACR;EAGF,MAAM,OAAO,SAAS,cAAc,KAAK;EACzC,IAAI,OAAO,YAAY,UAAU;GAE/B,KAAK,aAAa,QAAQ,KAAK;GAC/B,KAAK,aAAa,mBAAmB,QAAQ,kBAAkB;EACjE,OACE,KAAK,cAAc;EAGrB,IAAI,kBAAkB,aACpB,KAAK,cAAc,YAAY,IAAI;OAEnC,KAAK,WAAW,YAAY,IAAI;EAGlC,IAAI,YAAY,IACd,iBAAiB;GACf,KAAK,OAAO;EACd,GAAG,OAAO;CAEd;CAEA,MAAM,eAAqC;EACzC,IAAI,CAAC,KAAK,MACR;EAGF,KAAK,CAAC,iBAAiB,kBAAkB,gBAAgB,KAAK,cAC5D,KAAK,aAAa,YAAY;EAGhC,KAAK,CAAC,iBAAiB,kBAAkB,aAAa,KAAK,WACzD,KAAK,UAAU,YAAY;CAE/B;AACF;AAEA,IAAI,gBAAsC;;;;;;;;;;;;;;;;;;;;AAqB1C,SAAgB,SACd,SACA,gBAA+B,aAC/B,UAAkB,0BACZ;CACN,IAAI,CAAC,eAAe;EAClB,gBAAgB,IAAI,cAAc;EAWlC,IAAI,EAJF,OAAQ,WAAuC,sBAAsB,YAChE,WAAuC,oBACxC,OAAQ,WAAuC,WAAW,cAG9D,iBAAiB;GACf,IAAI,eAAe,WAAW,GAC5B,eAAe,SAAS,SAAS,eAAe,OAAO;EAE3D,GAAG,GAAG;OAEN,cAAc,SAAS,SAAS,eAAe,OAAO;CAE1D,OACE,cAAc,SAAS,SAAS,eAAe,OAAO;AAE1D;;;;;;;;;;;;;;;AAgBA,SAAgB,eAAe,eAAqC;CAClE,IAAI,eACF,cAAc,MAAM,aAAa;AAErC;;;;;;;;;;;;;AAcA,SAAgB,mBAAyB;CACvC,IAAI,eAAe;EACjB,cAAc,QAAQ;EACtB,gBAAgB;CAClB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgB,eAAmC;CAEjD,IAAI,UACF,OAAO;EACL,gBAAgB,CAAC;EACjB,aAAa,CAAC;CAChB;CAIF,mBAAmB;EAEjB,IAAI,CAAC,eACH,gBAAgB,IAAI,cAAc;CAEtC,CAAC;CAED,OAAO;EACL,WACE,SACA,gBAA+B,aAC/B,UAAkB,6BACf;GACH,SAAS,SAAS,eAAe,OAAO;EAC1C;EACA,QAAQ,kBAAkC;GACxC,eAAe,aAAa;EAC9B;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"live-announcer.jsx","names":[],"sources":["../../src/live-announcer/announce.ts"],"sourcesContent":["/**\n * Live announcer for solidaria\n *\n * Provides functions to make announcements to screen readers using\n * ARIA live regions. Useful for announcing dynamic content changes.\n *\n * Port of react-aria's @react-aria/live-announcer.\n *\n * SSR Safety: All functions are safe to call during SSR. The announcer\n * will only be created when running in the browser.\n */\n\nimport { onCleanup, createEffect } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\n\nexport type Assertiveness = \"assertive\" | \"polite\";\n\nexport type Message = string | { \"aria-labelledby\": string };\n\nconst LIVEREGION_TIMEOUT_DELAY = 7000;\n\n/**\n * Singleton class that manages live region announcements.\n * Implemented using vanilla DOM for simplicity and framework independence.\n */\nclass LiveAnnouncer {\n node: HTMLElement | null = null;\n assertiveLog: HTMLElement | null = null;\n politeLog: HTMLElement | null = null;\n\n constructor() {\n if (typeof document !== \"undefined\") {\n this.node = document.createElement(\"div\");\n this.node.dataset.liveAnnouncer = \"true\";\n // Visually hidden styles\n Object.assign(this.node.style, {\n border: \"0\",\n clip: \"rect(0 0 0 0)\",\n clipPath: \"inset(50%)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0\",\n position: \"absolute\",\n width: \"1px\",\n whiteSpace: \"nowrap\",\n });\n\n this.assertiveLog = this.createLog(\"assertive\");\n this.node.appendChild(this.assertiveLog);\n\n this.politeLog = this.createLog(\"polite\");\n this.node.appendChild(this.politeLog);\n\n document.body.prepend(this.node);\n }\n }\n\n isAttached(): boolean {\n return this.node?.isConnected ?? false;\n }\n\n createLog(ariaLive: string): HTMLElement {\n const node = document.createElement(\"div\");\n node.setAttribute(\"role\", \"log\");\n node.setAttribute(\"aria-live\", ariaLive);\n node.setAttribute(\"aria-relevant\", \"additions\");\n return node;\n }\n\n destroy(): void {\n if (!this.node) {\n return;\n }\n\n document.body.removeChild(this.node);\n this.node = null;\n }\n\n announce(\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n ): void {\n if (!this.node) {\n return;\n }\n\n const node = document.createElement(\"div\");\n if (typeof message === \"object\") {\n // To read an aria-labelledby, the element must have an appropriate role, such as img.\n node.setAttribute(\"role\", \"img\");\n node.setAttribute(\"aria-labelledby\", message[\"aria-labelledby\"]);\n } else {\n node.textContent = message;\n }\n\n if (assertiveness === \"assertive\") {\n this.assertiveLog?.appendChild(node);\n } else {\n this.politeLog?.appendChild(node);\n }\n\n if (message !== \"\") {\n setTimeout(() => {\n node.remove();\n }, timeout);\n }\n }\n\n clear(assertiveness?: Assertiveness): void {\n if (!this.node) {\n return;\n }\n\n if ((!assertiveness || assertiveness === \"assertive\") && this.assertiveLog) {\n this.assertiveLog.innerHTML = \"\";\n }\n\n if ((!assertiveness || assertiveness === \"polite\") && this.politeLog) {\n this.politeLog.innerHTML = \"\";\n }\n }\n}\n\nlet liveAnnouncer: LiveAnnouncer | null = null;\n\n/**\n * Announces a message to screen readers using ARIA live regions.\n *\n * @param message - The message to announce, or an object with aria-labelledby\n * @param assertiveness - 'assertive' interrupts, 'polite' waits for a pause\n * @param timeout - How long to keep the message in the DOM (default 7000ms)\n *\n * @example\n * ```tsx\n * // Simple announcement\n * announce('Item added to cart');\n *\n * // Polite announcement (won't interrupt)\n * announce('3 results found', 'polite');\n *\n * // Using aria-labelledby for complex content\n * announce({ 'aria-labelledby': 'my-element-id' });\n * ```\n */\nexport function announce(\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n): void {\n if (!liveAnnouncer) {\n liveAnnouncer = new LiveAnnouncer();\n // Wait for the live announcer regions to be added to the DOM, then announce.\n // Otherwise Safari won't announce the message if it's added too quickly.\n // Found most times less than 100ms were not consistent when announcing with Safari.\n\n // Check for test environment\n const isTestEnv =\n typeof (globalThis as Record<string, unknown>).IS_SOLIDARIA_TEST === \"boolean\"\n ? (globalThis as Record<string, unknown>).IS_SOLIDARIA_TEST\n : typeof (globalThis as Record<string, unknown>).vitest !== \"undefined\";\n\n if (!isTestEnv) {\n setTimeout(() => {\n if (liveAnnouncer?.isAttached()) {\n liveAnnouncer?.announce(message, assertiveness, timeout);\n }\n }, 100);\n } else {\n liveAnnouncer.announce(message, assertiveness, timeout);\n }\n } else {\n liveAnnouncer.announce(message, assertiveness, timeout);\n }\n}\n\n/**\n * Clears all queued announcements for the given assertiveness level.\n *\n * @param assertiveness - Which log to clear ('assertive' or 'polite')\n *\n * @example\n * ```tsx\n * // Clear assertive announcements\n * clearAnnouncer('assertive');\n *\n * // Clear polite announcements\n * clearAnnouncer('polite');\n * ```\n */\nexport function clearAnnouncer(assertiveness?: Assertiveness): void {\n if (liveAnnouncer) {\n liveAnnouncer.clear(assertiveness);\n }\n}\n\n/**\n * Removes the live announcer from the DOM entirely.\n * Call this when unmounting your app or when announcements are no longer needed.\n *\n * @example\n * ```tsx\n * // Clean up on app unmount\n * onCleanup(() => {\n * destroyAnnouncer();\n * });\n * ```\n */\nexport function destroyAnnouncer(): void {\n if (liveAnnouncer) {\n liveAnnouncer.destroy();\n liveAnnouncer = null;\n }\n}\n\nexport interface UseAnnouncerResult {\n /** Announce a message to screen readers. */\n announce: (message: Message, assertiveness?: Assertiveness, timeout?: number) => void;\n /** Clear announcements for the given assertiveness level. */\n clear: (assertiveness?: Assertiveness) => void;\n}\n\n/**\n * Hook that provides access to the live announcer with automatic cleanup.\n *\n * This is the recommended way to use the announcer in SolidJS components.\n * It ensures the announcer is created only on the client and provides\n * type-safe methods for announcing and clearing messages.\n *\n * SSR Safety: Returns no-op functions during SSR. The announcer is only\n * created when the component mounts on the client.\n *\n * @example\n * ```tsx\n * function SearchResults(props) {\n * const announcer = useAnnouncer();\n *\n * createEffect(() => {\n * const count = props.results.length;\n * announcer.announce(`${count} results found`, 'polite');\n * });\n *\n * return <ul>...</ul>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * function Form() {\n * const announcer = useAnnouncer();\n *\n * const onSubmit = async () => {\n * try {\n * await submitForm();\n * announcer.announce('Form submitted successfully');\n * } catch (error) {\n * announcer.announce('Error submitting form', 'assertive');\n * }\n * };\n *\n * return <form onSubmit={onSubmit}>...</form>;\n * }\n * ```\n */\nexport function useAnnouncer(): UseAnnouncerResult {\n // During SSR, return no-op functions\n if (isServer) {\n return {\n announce: () => {},\n clear: () => {},\n };\n }\n\n // Ensure the announcer is initialized\n createEffect(() => {\n // Initialize on first use\n if (!liveAnnouncer) {\n liveAnnouncer = new LiveAnnouncer();\n }\n });\n\n return {\n announce: (\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n ) => {\n announce(message, assertiveness, timeout);\n },\n clear: (assertiveness?: Assertiveness) => {\n clearAnnouncer(assertiveness);\n },\n };\n}\n"],"mappings":"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"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* createTimeSegment hook for Solidaria
|
|
3
|
-
*
|
|
4
|
-
* Provides the behavior and accessibility implementation for a time segment.
|
|
5
|
-
* Based on @react-aria/datepicker useDateSegment semantics (time-field scope).
|
|
6
|
-
*/
|
|
7
|
-
import { type MaybeAccessor } from "../utils/reactivity";
|
|
8
|
-
import type { TimeFieldState, TimeSegment } from "@proyecto-viviana/solid-stately";
|
|
9
|
-
export interface AriaTimeSegmentProps {
|
|
10
|
-
/** The segment data. */
|
|
11
|
-
segment: TimeSegment;
|
|
12
|
-
}
|
|
13
|
-
export interface TimeSegmentAria {
|
|
14
|
-
/** Props for the segment element. */
|
|
15
|
-
segmentProps: Record<string, unknown>;
|
|
16
|
-
/** Whether the segment is focused. */
|
|
17
|
-
isFocused: boolean;
|
|
18
|
-
/** Whether the segment is editable. */
|
|
19
|
-
isEditable: boolean;
|
|
20
|
-
/** Whether the segment is a placeholder. */
|
|
21
|
-
isPlaceholder: boolean;
|
|
22
|
-
/** The text to display. */
|
|
23
|
-
text: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Provides the behavior and accessibility implementation for a time segment.
|
|
27
|
-
*/
|
|
28
|
-
export declare function createTimeSegment<T extends TimeFieldState>(props: MaybeAccessor<AriaTimeSegmentProps>, state: T, ref?: () => HTMLElement | null): TimeSegmentAria;
|
|
29
|
-
//# sourceMappingURL=createTimeSegment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTimeSegment.d.ts","sourceRoot":"","sources":["../../src/datepicker/createTimeSegment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAmB,MAAM,iCAAiC,CAAC;AAEpG,MAAM,WAAW,oBAAoB;IACnC,wBAAwB;IACxB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,sCAAsC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,4CAA4C;IAC5C,aAAa,EAAE,OAAO,CAAC;IACvB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EACxD,KAAK,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAC1C,KAAK,EAAE,CAAC,EACR,GAAG,CAAC,EAAE,MAAM,WAAW,GAAG,IAAI,GAC7B,eAAe,CA+PjB"}
|