@sewadah/selaras 0.1.1 → 0.2.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/README.md +31 -13
- package/dist/module.d.mts +10 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +120 -36
- package/dist/runtime/components/Accordion.d.vue.ts +3 -0
- package/dist/runtime/components/Accordion.vue +5 -1
- package/dist/runtime/components/Accordion.vue.d.ts +3 -0
- package/dist/runtime/components/Alert.d.vue.ts +2 -1
- package/dist/runtime/components/Alert.vue +6 -3
- package/dist/runtime/components/Alert.vue.d.ts +2 -1
- package/dist/runtime/components/AlertDialog.d.vue.ts +2 -0
- package/dist/runtime/components/AlertDialog.vue +21 -8
- package/dist/runtime/components/AlertDialog.vue.d.ts +2 -0
- package/dist/runtime/components/App.vue +9 -2
- package/dist/runtime/components/Autocomplete.d.vue.ts +22 -58
- package/dist/runtime/components/Autocomplete.vue +50 -11
- package/dist/runtime/components/Autocomplete.vue.d.ts +22 -58
- package/dist/runtime/components/Avatar.d.vue.ts +2 -1
- package/dist/runtime/components/Avatar.vue +4 -2
- package/dist/runtime/components/Avatar.vue.d.ts +2 -1
- package/dist/runtime/components/Badge.d.vue.ts +3 -2
- package/dist/runtime/components/Badge.vue +8 -5
- package/dist/runtime/components/Badge.vue.d.ts +3 -2
- package/dist/runtime/components/Breadcrumb.d.vue.ts +3 -0
- package/dist/runtime/components/Breadcrumb.vue +5 -2
- package/dist/runtime/components/Breadcrumb.vue.d.ts +3 -0
- package/dist/runtime/components/Button.d.vue.ts +5 -2
- package/dist/runtime/components/Button.vue +5 -2
- package/dist/runtime/components/Button.vue.d.ts +5 -2
- package/dist/runtime/components/Checkbox.d.vue.ts +2 -1
- package/dist/runtime/components/Checkbox.vue +4 -2
- package/dist/runtime/components/Checkbox.vue.d.ts +2 -1
- package/dist/runtime/components/Chip.d.vue.ts +2 -1
- package/dist/runtime/components/Chip.vue +4 -2
- package/dist/runtime/components/Chip.vue.d.ts +2 -1
- package/dist/runtime/components/Collapsible.d.vue.ts +3 -0
- package/dist/runtime/components/Collapsible.vue +11 -6
- package/dist/runtime/components/Collapsible.vue.d.ts +3 -0
- package/dist/runtime/components/ColorPicker.d.vue.ts +13 -3
- package/dist/runtime/components/ColorPicker.vue +60 -14
- package/dist/runtime/components/ColorPicker.vue.d.ts +13 -3
- package/dist/runtime/components/Column.d.ts +1 -1
- package/dist/runtime/components/CommandPalette.vue +18 -16
- package/dist/runtime/components/ContentNavigation.d.vue.ts +3 -0
- package/dist/runtime/components/ContentNavigation.vue +6 -3
- package/dist/runtime/components/ContentNavigation.vue.d.ts +3 -0
- package/dist/runtime/components/ContentSurround.d.vue.ts +3 -0
- package/dist/runtime/components/ContentSurround.vue +7 -4
- package/dist/runtime/components/ContentSurround.vue.d.ts +3 -0
- package/dist/runtime/components/ContentToc.d.vue.ts +3 -0
- package/dist/runtime/components/ContentToc.vue +8 -5
- package/dist/runtime/components/ContentToc.vue.d.ts +3 -0
- package/dist/runtime/components/ContextMenu.vue +3 -2
- package/dist/runtime/components/DashboardSidebar.vue +1 -1
- package/dist/runtime/components/DashboardSidebarToggle.d.vue.ts +1 -0
- package/dist/runtime/components/DashboardSidebarToggle.vue +3 -1
- package/dist/runtime/components/DashboardSidebarToggle.vue.d.ts +1 -0
- package/dist/runtime/components/DatePicker.d.vue.ts +32 -23
- package/dist/runtime/components/DatePicker.vue +130 -60
- package/dist/runtime/components/DatePicker.vue.d.ts +32 -23
- package/dist/runtime/components/Drawer.d.vue.ts +2 -0
- package/dist/runtime/components/Drawer.vue +21 -8
- package/dist/runtime/components/Drawer.vue.d.ts +2 -0
- package/dist/runtime/components/DrawerRenderer.vue +28 -21
- package/dist/runtime/components/Dropdown.d.vue.ts +14 -4
- package/dist/runtime/components/Dropdown.vue +19 -4
- package/dist/runtime/components/Dropdown.vue.d.ts +14 -4
- package/dist/runtime/components/FileTree.d.vue.ts +3 -0
- package/dist/runtime/components/FileTree.vue +7 -3
- package/dist/runtime/components/FileTree.vue.d.ts +3 -0
- package/dist/runtime/components/FileUpload.d.vue.ts +2 -1
- package/dist/runtime/components/FileUpload.vue +75 -32
- package/dist/runtime/components/FileUpload.vue.d.ts +2 -1
- package/dist/runtime/components/FormField.d.vue.ts +2 -0
- package/dist/runtime/components/FormField.vue +12 -9
- package/dist/runtime/components/FormField.vue.d.ts +2 -0
- package/dist/runtime/components/Icon.d.vue.ts +2 -4
- package/dist/runtime/components/Icon.vue +7 -2
- package/dist/runtime/components/Icon.vue.d.ts +2 -4
- package/dist/runtime/components/Input.d.vue.ts +2 -1
- package/dist/runtime/components/Input.vue +12 -6
- package/dist/runtime/components/Input.vue.d.ts +2 -1
- package/dist/runtime/components/InputNumber.d.vue.ts +4 -1
- package/dist/runtime/components/InputNumber.vue +21 -8
- package/dist/runtime/components/InputNumber.vue.d.ts +4 -1
- package/dist/runtime/components/Modal.d.vue.ts +2 -0
- package/dist/runtime/components/Modal.vue +21 -8
- package/dist/runtime/components/Modal.vue.d.ts +2 -0
- package/dist/runtime/components/ModalRenderer.vue +23 -16
- package/dist/runtime/components/NavigationMenu.d.vue.ts +2 -4
- package/dist/runtime/components/NavigationMenu.vue +6 -4
- package/dist/runtime/components/NavigationMenu.vue.d.ts +2 -4
- package/dist/runtime/components/NavigationMenuAccordionItem.d.vue.ts +2 -4
- package/dist/runtime/components/NavigationMenuAccordionItem.vue +5 -3
- package/dist/runtime/components/NavigationMenuAccordionItem.vue.d.ts +2 -4
- package/dist/runtime/components/NavigationMenuFlyoutList.d.vue.ts +2 -4
- package/dist/runtime/components/NavigationMenuFlyoutList.vue +7 -4
- package/dist/runtime/components/NavigationMenuFlyoutList.vue.d.ts +2 -4
- package/dist/runtime/components/NavigationMenuFlyoutTrigger.d.vue.ts +2 -4
- package/dist/runtime/components/NavigationMenuFlyoutTrigger.vue +9 -2
- package/dist/runtime/components/NavigationMenuFlyoutTrigger.vue.d.ts +2 -4
- package/dist/runtime/components/Pagination.d.vue.ts +3 -2
- package/dist/runtime/components/Pagination.vue.d.ts +3 -2
- package/dist/runtime/components/PinInput.d.vue.ts +2 -1
- package/dist/runtime/components/PinInput.vue +17 -6
- package/dist/runtime/components/PinInput.vue.d.ts +2 -1
- package/dist/runtime/components/Popover.d.vue.ts +2 -0
- package/dist/runtime/components/Popover.vue +14 -7
- package/dist/runtime/components/Popover.vue.d.ts +2 -0
- package/dist/runtime/components/Progress.d.vue.ts +2 -1
- package/dist/runtime/components/Progress.vue +6 -4
- package/dist/runtime/components/Progress.vue.d.ts +2 -1
- package/dist/runtime/components/ProseH1.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH1.vue +7 -4
- package/dist/runtime/components/ProseH1.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH2.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH2.vue +7 -4
- package/dist/runtime/components/ProseH2.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH3.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH3.vue +7 -4
- package/dist/runtime/components/ProseH3.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH4.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH4.vue +7 -4
- package/dist/runtime/components/ProseH4.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH5.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH5.vue +7 -4
- package/dist/runtime/components/ProseH5.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH6.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH6.vue +7 -4
- package/dist/runtime/components/ProseH6.vue.d.ts +2 -0
- package/dist/runtime/components/RadioGroup.d.vue.ts +2 -1
- package/dist/runtime/components/RadioGroup.vue +9 -5
- package/dist/runtime/components/RadioGroup.vue.d.ts +2 -1
- package/dist/runtime/components/Rating.d.vue.ts +2 -1
- package/dist/runtime/components/Rating.vue +4 -1
- package/dist/runtime/components/Rating.vue.d.ts +2 -1
- package/dist/runtime/components/ReadMore.d.vue.ts +3 -0
- package/dist/runtime/components/ReadMore.vue +24 -6
- package/dist/runtime/components/ReadMore.vue.d.ts +3 -0
- package/dist/runtime/components/Select.d.vue.ts +21 -57
- package/dist/runtime/components/Select.vue +58 -9
- package/dist/runtime/components/Select.vue.d.ts +21 -57
- package/dist/runtime/components/Separator.d.vue.ts +2 -1
- package/dist/runtime/components/Separator.vue +4 -2
- package/dist/runtime/components/Separator.vue.d.ts +2 -1
- package/dist/runtime/components/Slideover.d.vue.ts +2 -0
- package/dist/runtime/components/Slideover.vue +21 -8
- package/dist/runtime/components/Slideover.vue.d.ts +2 -0
- package/dist/runtime/components/SlideoverRenderer.vue +25 -18
- package/dist/runtime/components/Slider.d.vue.ts +2 -1
- package/dist/runtime/components/Slider.vue +4 -1
- package/dist/runtime/components/Slider.vue.d.ts +2 -1
- package/dist/runtime/components/SplitterResizeHandle.d.vue.ts +3 -0
- package/dist/runtime/components/SplitterResizeHandle.vue +5 -2
- package/dist/runtime/components/SplitterResizeHandle.vue.d.ts +3 -0
- package/dist/runtime/components/Stepper.d.vue.ts +2 -1
- package/dist/runtime/components/Stepper.vue +4 -1
- package/dist/runtime/components/Stepper.vue.d.ts +2 -1
- package/dist/runtime/components/Switch.d.vue.ts +2 -1
- package/dist/runtime/components/Switch.vue +4 -2
- package/dist/runtime/components/Switch.vue.d.ts +2 -1
- package/dist/runtime/components/Table.d.vue.ts +28 -80
- package/dist/runtime/components/Table.vue +25 -13
- package/dist/runtime/components/Table.vue.d.ts +28 -80
- package/dist/runtime/components/Tabs.d.vue.ts +3 -0
- package/dist/runtime/components/Tabs.vue +5 -1
- package/dist/runtime/components/Tabs.vue.d.ts +3 -0
- package/dist/runtime/components/Textarea.d.vue.ts +2 -1
- package/dist/runtime/components/Textarea.vue +11 -6
- package/dist/runtime/components/Textarea.vue.d.ts +2 -1
- package/dist/runtime/components/Theme.d.vue.ts +16 -5
- package/dist/runtime/components/Theme.vue +30 -5
- package/dist/runtime/components/Theme.vue.d.ts +16 -5
- package/dist/runtime/components/Toast.vue +11 -39
- package/dist/runtime/components/Toggle.d.vue.ts +2 -1
- package/dist/runtime/components/Toggle.vue +4 -1
- package/dist/runtime/components/Toggle.vue.d.ts +2 -1
- package/dist/runtime/components/ToggleGroup.d.vue.ts +2 -1
- package/dist/runtime/components/ToggleGroup.vue +4 -1
- package/dist/runtime/components/ToggleGroup.vue.d.ts +2 -1
- package/dist/runtime/components/Tooltip.vue +3 -2
- package/dist/runtime/components/Tree.d.vue.ts +5 -2
- package/dist/runtime/components/Tree.vue +5 -1
- package/dist/runtime/components/Tree.vue.d.ts +5 -2
- package/dist/runtime/composables/use-drawer.d.ts +1 -22
- package/dist/runtime/composables/use-drawer.js +12 -18
- package/dist/runtime/composables/use-form-field.d.ts +1 -0
- package/dist/runtime/composables/use-icons.d.ts +2 -2
- package/dist/runtime/composables/use-icons.js +1 -1
- package/dist/runtime/composables/use-locale.d.ts +2 -2
- package/dist/runtime/composables/use-locale.js +1 -1
- package/dist/runtime/composables/use-media-query.d.ts +6 -8
- package/dist/runtime/composables/use-media-query.js +7 -2
- package/dist/runtime/composables/use-messages.d.ts +2 -2
- package/dist/runtime/composables/use-messages.js +1 -1
- package/dist/runtime/composables/use-modal.d.ts +1 -17
- package/dist/runtime/composables/use-modal.js +12 -18
- package/dist/runtime/composables/use-ripple.d.ts +2 -2
- package/dist/runtime/composables/use-ripple.js +1 -1
- package/dist/runtime/composables/use-slideover.d.ts +1 -19
- package/dist/runtime/composables/use-slideover.js +12 -18
- package/dist/runtime/composables/use-table.d.ts +74 -17
- package/dist/runtime/composables/use-table.js +4 -1
- package/dist/runtime/composables/use-toast.d.ts +8 -8
- package/dist/runtime/composables/use-toast.js +9 -11
- package/dist/runtime/default-color-metadata.d.ts +4 -0
- package/dist/runtime/default-color-metadata.js +4 -0
- package/dist/runtime/default-colors.css +1 -0
- package/dist/runtime/internal/ColorPickerBody.d.vue.ts +1 -0
- package/dist/runtime/internal/ColorPickerBody.vue +24 -1
- package/dist/runtime/internal/ColorPickerBody.vue.d.ts +1 -0
- package/dist/runtime/internal/ComboboxSelectBase.d.vue.ts +50 -46
- package/dist/runtime/internal/ComboboxSelectBase.vue +340 -93
- package/dist/runtime/internal/ComboboxSelectBase.vue.d.ts +50 -46
- package/dist/runtime/internal/ComboboxSelectBody.d.vue.ts +29 -23
- package/dist/runtime/internal/ComboboxSelectBody.vue +74 -40
- package/dist/runtime/internal/ComboboxSelectBody.vue.d.ts +29 -23
- package/dist/runtime/internal/DatePickerCalendarBody.d.vue.ts +3 -5
- package/dist/runtime/internal/DatePickerCalendarBody.vue +2 -2
- package/dist/runtime/internal/DatePickerCalendarBody.vue.d.ts +3 -5
- package/dist/runtime/internal/DatePickerRangeCalendarBody.d.vue.ts +3 -5
- package/dist/runtime/internal/DatePickerRangeCalendarBody.vue +1 -1
- package/dist/runtime/internal/DatePickerRangeCalendarBody.vue.d.ts +3 -5
- package/dist/runtime/internal/DatePickerTimeBody.d.vue.ts +2 -4
- package/dist/runtime/internal/DatePickerTimeBody.vue.d.ts +2 -4
- package/dist/runtime/internal/ProgrammaticTheme.d.vue.ts +17 -0
- package/dist/runtime/internal/ProgrammaticTheme.vue +41 -0
- package/dist/runtime/internal/ProgrammaticTheme.vue.d.ts +17 -0
- package/dist/runtime/internal/TimeStepper.vue +1 -1
- package/dist/runtime/internal/ToastItemRenderer.d.vue.ts +14 -0
- package/dist/runtime/internal/ToastItemRenderer.vue +54 -0
- package/dist/runtime/internal/ToastItemRenderer.vue.d.ts +14 -0
- package/dist/runtime/internal/combobox-select.d.ts +52 -0
- package/dist/runtime/{composables/use-combobox-select.js → internal/combobox-select.js} +26 -11
- package/dist/runtime/internal/programmatic-services.d.ts +71 -0
- package/dist/runtime/internal/programmatic-services.js +61 -0
- package/dist/runtime/prose.css +1 -1
- package/dist/runtime/structural.css +1 -0
- package/dist/runtime/table.d.ts +3 -0
- package/dist/runtime/table.js +1 -0
- package/dist/runtime/theme/accordion.d.ts +27 -0
- package/dist/runtime/theme/accordion.js +15 -6
- package/dist/runtime/theme/alert-dialog.js +5 -5
- package/dist/runtime/theme/alert.js +6 -15
- package/dist/runtime/theme/avatar-group.js +2 -2
- package/dist/runtime/theme/avatar.js +12 -18
- package/dist/runtime/theme/badge.d.ts +39 -9
- package/dist/runtime/theme/badge.js +11 -40
- package/dist/runtime/theme/breadcrumb.d.ts +29 -47
- package/dist/runtime/theme/breadcrumb.js +16 -5
- package/dist/runtime/theme/button.d.ts +45 -15
- package/dist/runtime/theme/button.js +10 -57
- package/dist/runtime/theme/callout.js +7 -7
- package/dist/runtime/theme/card.js +7 -7
- package/dist/runtime/theme/checkbox.d.ts +21 -84
- package/dist/runtime/theme/checkbox.js +15 -36
- package/dist/runtime/theme/chip.js +4 -22
- package/dist/runtime/theme/code-button.js +2 -2
- package/dist/runtime/theme/code-tree.d.ts +3 -3
- package/dist/runtime/theme/code-tree.js +4 -4
- package/dist/runtime/theme/collapsible.d.ts +27 -0
- package/dist/runtime/theme/collapsible.js +12 -3
- package/dist/runtime/theme/color-picker.d.ts +18 -54
- package/dist/runtime/theme/color-picker.js +19 -18
- package/dist/runtime/theme/command-palette.d.ts +6 -6
- package/dist/runtime/theme/command-palette.js +12 -10
- package/dist/runtime/theme/content-navigation.d.ts +27 -0
- package/dist/runtime/theme/content-navigation.js +14 -5
- package/dist/runtime/theme/content-surround.d.ts +27 -0
- package/dist/runtime/theme/content-surround.js +13 -4
- package/dist/runtime/theme/content-toc.d.ts +27 -0
- package/dist/runtime/theme/content-toc.js +14 -5
- package/dist/runtime/theme/context-menu.js +7 -7
- package/dist/runtime/theme/dashboard-navbar.d.ts +6 -6
- package/dist/runtime/theme/dashboard-navbar.js +2 -2
- package/dist/runtime/theme/dashboard-resize-handle.js +3 -3
- package/dist/runtime/theme/dashboard-sidebar.js +3 -3
- package/dist/runtime/theme/date-picker.js +10 -10
- package/dist/runtime/theme/drawer.js +9 -9
- package/dist/runtime/theme/dropdown.js +7 -7
- package/dist/runtime/theme/file-tree.d.ts +27 -0
- package/dist/runtime/theme/file-tree.js +12 -3
- package/dist/runtime/theme/file-upload.d.ts +18 -72
- package/dist/runtime/theme/file-upload.js +20 -19
- package/dist/runtime/theme/form-field.js +5 -5
- package/dist/runtime/theme/header.d.ts +3 -3
- package/dist/runtime/theme/header.js +1 -1
- package/dist/runtime/theme/icon.d.ts +30 -57
- package/dist/runtime/theme/icon.js +19 -9
- package/dist/runtime/theme/input-number.d.ts +21 -63
- package/dist/runtime/theme/input-number.js +12 -12
- package/dist/runtime/theme/input.d.ts +21 -63
- package/dist/runtime/theme/input.js +12 -12
- package/dist/runtime/theme/kbd.js +1 -1
- package/dist/runtime/theme/modal.js +4 -4
- package/dist/runtime/theme/navigation-menu.d.ts +2 -0
- package/dist/runtime/theme/navigation-menu.js +17 -28
- package/dist/runtime/theme/page-header.js +3 -3
- package/dist/runtime/theme/pagination.js +1 -1
- package/dist/runtime/theme/pin-input.d.ts +21 -63
- package/dist/runtime/theme/pin-input.js +13 -11
- package/dist/runtime/theme/popover.js +2 -2
- package/dist/runtime/theme/progress.d.ts +21 -84
- package/dist/runtime/theme/progress.js +12 -12
- package/dist/runtime/theme/prose.d.ts +29 -50
- package/dist/runtime/theme/prose.js +22 -11
- package/dist/runtime/theme/radio-group.d.ts +21 -84
- package/dist/runtime/theme/radio-group.js +16 -22
- package/dist/runtime/theme/rating.d.ts +21 -63
- package/dist/runtime/theme/rating.js +10 -10
- package/dist/runtime/theme/read-more.d.ts +27 -0
- package/dist/runtime/theme/read-more.js +13 -4
- package/dist/runtime/theme/scroll-area.d.ts +3 -3
- package/dist/runtime/theme/scroll-area.js +2 -2
- package/dist/runtime/theme/select.d.ts +21 -54
- package/dist/runtime/theme/select.js +32 -24
- package/dist/runtime/theme/separator.d.ts +18 -54
- package/dist/runtime/theme/separator.js +16 -12
- package/dist/runtime/theme/skeleton.js +4 -4
- package/dist/runtime/theme/slideover.js +5 -5
- package/dist/runtime/theme/slider.d.ts +21 -84
- package/dist/runtime/theme/slider.js +14 -14
- package/dist/runtime/theme/splitter-resize-handle.d.ts +27 -0
- package/dist/runtime/theme/splitter-resize-handle.js +11 -1
- package/dist/runtime/theme/stepper.d.ts +21 -84
- package/dist/runtime/theme/stepper.js +12 -33
- package/dist/runtime/theme/switch.d.ts +21 -84
- package/dist/runtime/theme/switch.js +13 -13
- package/dist/runtime/theme/table.d.ts +27 -0
- package/dist/runtime/theme/table.js +31 -21
- package/dist/runtime/theme/tabs.d.ts +27 -0
- package/dist/runtime/theme/tabs.js +17 -7
- package/dist/runtime/theme/textarea.d.ts +21 -63
- package/dist/runtime/theme/textarea.js +12 -12
- package/dist/runtime/theme/toast.d.ts +12 -48
- package/dist/runtime/theme/toast.js +9 -9
- package/dist/runtime/theme/toggle-group.js +5 -11
- package/dist/runtime/theme/toggle.js +2 -12
- package/dist/runtime/theme/tooltip.d.ts +3 -3
- package/dist/runtime/theme/tooltip.js +3 -3
- package/dist/runtime/theme/tree.d.ts +27 -0
- package/dist/runtime/theme/tree.js +13 -3
- package/dist/runtime/theme-api.d.ts +15 -0
- package/dist/runtime/theme-api.js +12 -0
- package/dist/runtime/theme-config.d.ts +470 -0
- package/dist/runtime/theme-config.js +0 -0
- package/dist/runtime/theme.css +1 -1
- package/dist/runtime/types/app-config.d.ts +11 -8
- package/dist/runtime/types/index.d.ts +19 -1
- package/dist/runtime/utils/app-scoped-state.d.ts +2 -0
- package/dist/runtime/utils/app-scoped-state.js +13 -0
- package/dist/runtime/utils/autocomplete-contracts.d.ts +24 -0
- package/dist/runtime/utils/autocomplete-contracts.js +0 -0
- package/dist/runtime/utils/color-registry.d.ts +60 -0
- package/dist/runtime/utils/color-registry.js +187 -0
- package/dist/runtime/utils/dtcg-colors.d.ts +25 -0
- package/dist/runtime/utils/dtcg-colors.js +40 -0
- package/dist/runtime/utils/functional-tokens.d.ts +26 -0
- package/dist/runtime/utils/functional-tokens.js +54 -0
- package/dist/runtime/utils/icons.d.ts +3 -0
- package/dist/runtime/utils/icons.js +4 -0
- package/dist/runtime/utils/injection-keys.d.ts +12 -3
- package/dist/runtime/utils/native-input.d.ts +5 -0
- package/dist/runtime/utils/native-input.js +32 -0
- package/dist/runtime/utils/programmatic-theme.d.ts +17 -0
- package/dist/runtime/utils/programmatic-theme.js +59 -0
- package/dist/runtime/utils/registered-colors.d.ts +3 -0
- package/dist/runtime/utils/registered-colors.js +14 -0
- package/dist/runtime/utils/seed-colors.d.ts +18 -0
- package/dist/runtime/utils/seed-colors.js +199 -0
- package/dist/runtime/utils/select-contracts.d.ts +101 -0
- package/dist/runtime/utils/select-contracts.js +0 -0
- package/dist/runtime/utils/table-contracts.d.ts +60 -0
- package/dist/runtime/utils/table-contracts.js +0 -0
- package/dist/runtime/utils/ui.d.ts +26 -4
- package/dist/runtime/utils/ui.js +38 -5
- package/dist/tokens/default-colors.tokens.json +879 -0
- package/package.json +66 -10
- package/dist/runtime/composables/use-combobox-select.d.ts +0 -45
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
ComboboxPortal,
|
|
8
8
|
ComboboxRoot,
|
|
9
9
|
ComboboxTrigger,
|
|
10
|
+
DialogClose,
|
|
11
|
+
ListboxRoot,
|
|
10
12
|
TagsInputInput,
|
|
11
13
|
TagsInputItem,
|
|
12
14
|
TagsInputItemDelete,
|
|
@@ -14,28 +16,34 @@ import {
|
|
|
14
16
|
TagsInputRoot,
|
|
15
17
|
useDirection
|
|
16
18
|
} from "reka-ui";
|
|
17
|
-
import { computed, ref } from "vue";
|
|
19
|
+
import { computed, getCurrentInstance, mergeProps, nextTick, onMounted, onUnmounted, ref, useId, watch } from "vue";
|
|
18
20
|
import Button from "../components/Button.vue";
|
|
19
21
|
import Chip from "../components/Chip.vue";
|
|
20
22
|
import Icon from "../components/Icon.vue";
|
|
21
23
|
import Modal from "../components/Modal.vue";
|
|
22
24
|
import Tooltip from "../components/Tooltip.vue";
|
|
23
|
-
import { useComboboxSelect } from "../composables/use-combobox-select";
|
|
24
25
|
import { useFormField } from "../composables/use-form-field";
|
|
25
26
|
import { useIcons } from "../composables/use-icons";
|
|
26
27
|
import { useIsMobile } from "../composables/use-media-query";
|
|
27
28
|
import { useMessages } from "../composables/use-messages";
|
|
28
29
|
import { selectTheme } from "../theme/select";
|
|
29
|
-
import {
|
|
30
|
+
import { isNativeInputA11yAttr, isNativeInputAttr, isNativeInputEvent } from "../utils/native-input";
|
|
31
|
+
import { resolveRegisteredColorRole } from "../utils/registered-colors";
|
|
32
|
+
import { resolveSlot, useComponentTheme, useFallthroughAttrs, useRootProps, useThemeBindings } from "../utils/ui";
|
|
33
|
+
import { useComboboxSelect } from "./combobox-select";
|
|
30
34
|
import ComboboxSelectBody from "./ComboboxSelectBody.vue";
|
|
31
35
|
defineOptions({ inheritAttrs: false });
|
|
32
36
|
const props = defineProps({
|
|
33
37
|
id: { type: String, required: false },
|
|
34
38
|
name: { type: String, required: false },
|
|
35
|
-
|
|
39
|
+
form: { type: String, required: false },
|
|
40
|
+
items: { type: null, required: true },
|
|
36
41
|
valueKey: { type: String, required: false },
|
|
37
42
|
labelKey: { type: String, required: false },
|
|
38
|
-
|
|
43
|
+
open: { type: Boolean, required: false },
|
|
44
|
+
defaultOpen: { type: Boolean, required: false },
|
|
45
|
+
modelValue: { type: [String, Number, Array], required: false },
|
|
46
|
+
defaultValue: { type: [String, Number, Array], required: false },
|
|
39
47
|
multiple: { type: Boolean, required: false },
|
|
40
48
|
searchable: { type: Boolean, required: false },
|
|
41
49
|
virtualize: { type: [Boolean, Object], required: false },
|
|
@@ -44,6 +52,7 @@ const props = defineProps({
|
|
|
44
52
|
loading: { type: Boolean, required: false },
|
|
45
53
|
placeholder: { type: String, required: false },
|
|
46
54
|
disabled: { type: Boolean, required: false },
|
|
55
|
+
required: { type: Boolean, required: false },
|
|
47
56
|
size: { type: null, required: false },
|
|
48
57
|
invalid: { type: Boolean, required: false },
|
|
49
58
|
color: { type: null, required: false, default: "primary" },
|
|
@@ -55,12 +64,77 @@ const props = defineProps({
|
|
|
55
64
|
resetSearchTermOnBlur: { type: Boolean, required: false, default: true },
|
|
56
65
|
resetSearchTermOnSelect: { type: Boolean, required: false, default: true },
|
|
57
66
|
arrow: { type: Boolean, required: false, default: false },
|
|
58
|
-
|
|
67
|
+
adaptive: { type: Boolean, required: false },
|
|
59
68
|
ui: { type: Object, required: false }
|
|
60
69
|
});
|
|
61
|
-
const emit = defineEmits(["update:modelValue", "update:searchTerm"]);
|
|
70
|
+
const emit = defineEmits(["update:open", "update:modelValue", "update:searchTerm"]);
|
|
71
|
+
const instance = getCurrentInstance();
|
|
72
|
+
const initialValue = Array.isArray(props.defaultValue) ? [...props.defaultValue] : props.defaultValue;
|
|
73
|
+
const isControlled = () => Object.hasOwn(instance.vnode.props ?? {}, "modelValue") || Object.hasOwn(instance.vnode.props ?? {}, "model-value");
|
|
74
|
+
function selectionForMode(value, multiple) {
|
|
75
|
+
if (multiple) {
|
|
76
|
+
if (value === void 0)
|
|
77
|
+
return [];
|
|
78
|
+
return Array.isArray(value) ? [...value] : [value];
|
|
79
|
+
}
|
|
80
|
+
return Array.isArray(value) ? value[0] : value;
|
|
81
|
+
}
|
|
82
|
+
function assertControlledSelectionShape(value, multiple) {
|
|
83
|
+
if (value === void 0)
|
|
84
|
+
return;
|
|
85
|
+
if (multiple && !Array.isArray(value))
|
|
86
|
+
throw new TypeError("[selaras] A controlled Select or Autocomplete with multiple=true requires modelValue to be an array.");
|
|
87
|
+
if (!multiple && Array.isArray(value))
|
|
88
|
+
throw new TypeError("[selaras] A controlled Select or Autocomplete with multiple=false requires modelValue to be a scalar or undefined.");
|
|
89
|
+
}
|
|
90
|
+
function assertUniqueMultipleSelection(value, property) {
|
|
91
|
+
if (!Array.isArray(value))
|
|
92
|
+
return;
|
|
93
|
+
const values = /* @__PURE__ */ new Set();
|
|
94
|
+
for (const selectedValue of value) {
|
|
95
|
+
if (values.has(selectedValue))
|
|
96
|
+
throw new TypeError(`[selaras] A multiple Select or Autocomplete requires unique ${property} values.`);
|
|
97
|
+
values.add(selectedValue);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const localValue = ref(selectionForMode(initialValue, !!props.multiple));
|
|
101
|
+
const selection = computed(() => {
|
|
102
|
+
const value = isControlled() ? props.modelValue : localValue.value;
|
|
103
|
+
if (isControlled()) {
|
|
104
|
+
assertControlledSelectionShape(value, !!props.multiple);
|
|
105
|
+
if (props.multiple)
|
|
106
|
+
assertUniqueMultipleSelection(value, "modelValue");
|
|
107
|
+
}
|
|
108
|
+
return value;
|
|
109
|
+
});
|
|
110
|
+
const rekaSelection = computed(() => selection.value ?? (props.multiple ? [] : null));
|
|
111
|
+
function updateSelection(event, value) {
|
|
112
|
+
if (!isControlled())
|
|
113
|
+
localValue.value = value;
|
|
114
|
+
emit(event, value);
|
|
115
|
+
}
|
|
116
|
+
const editableInput = ref();
|
|
117
|
+
const comboboxRootKey = ref(0);
|
|
118
|
+
function setEditableInput(element) {
|
|
119
|
+
const candidate = typeof HTMLInputElement !== "undefined" && element instanceof HTMLInputElement ? element : element?.$el;
|
|
120
|
+
editableInput.value = typeof HTMLInputElement !== "undefined" && candidate instanceof HTMLInputElement ? candidate : void 0;
|
|
121
|
+
}
|
|
122
|
+
assertUniqueMultipleSelection(initialValue, "defaultValue");
|
|
123
|
+
if (isControlled()) {
|
|
124
|
+
assertControlledSelectionShape(props.modelValue, !!props.multiple);
|
|
125
|
+
if (props.multiple)
|
|
126
|
+
assertUniqueMultipleSelection(props.modelValue, "modelValue");
|
|
127
|
+
}
|
|
128
|
+
const formAnchor = ref();
|
|
129
|
+
let ownerForm = null;
|
|
130
|
+
onMounted(() => {
|
|
131
|
+
ownerForm = formAnchor.value?.form ?? null;
|
|
132
|
+
ownerForm?.addEventListener("reset", resetSelection);
|
|
133
|
+
});
|
|
134
|
+
onUnmounted(() => ownerForm?.removeEventListener("reset", resetSelection));
|
|
62
135
|
const {
|
|
63
136
|
flatOptions,
|
|
137
|
+
selectedValues,
|
|
64
138
|
selectedOptions,
|
|
65
139
|
visibleOptions,
|
|
66
140
|
overflowOptions,
|
|
@@ -71,7 +145,9 @@ const {
|
|
|
71
145
|
removeValue,
|
|
72
146
|
hasMatchingOption,
|
|
73
147
|
commitCreatableText
|
|
74
|
-
} = useComboboxSelect(props,
|
|
148
|
+
} = useComboboxSelect(new Proxy(props, {
|
|
149
|
+
get: (target, key) => key === "modelValue" ? selection.value : Reflect.get(target, key)
|
|
150
|
+
}), updateSelection, { creatable: props.creatable });
|
|
75
151
|
function clear() {
|
|
76
152
|
setValue(props.multiple ? [] : void 0);
|
|
77
153
|
}
|
|
@@ -110,7 +186,7 @@ function onTriggerKeydown(event) {
|
|
|
110
186
|
selectedChipValue.value = chips[0].value;
|
|
111
187
|
} else if (event.key === "End") {
|
|
112
188
|
selectedChipValue.value = lastValue;
|
|
113
|
-
} else if (
|
|
189
|
+
} else if (selectedChipValue.value === void 0) {
|
|
114
190
|
if (!isNext)
|
|
115
191
|
selectedChipValue.value = lastValue;
|
|
116
192
|
} else {
|
|
@@ -132,14 +208,26 @@ function onTriggerKeydown(event) {
|
|
|
132
208
|
}
|
|
133
209
|
}
|
|
134
210
|
}
|
|
135
|
-
const internalSearchText = ref(props.searchTerm ?? "");
|
|
211
|
+
const internalSearchText = ref(props.searchTerm ?? (props.creatable && !props.multiple && props.resetSearchTermOnSelect ? selectedOptions.value[0]?.label ?? "" : ""));
|
|
212
|
+
const modeSearchLock = ref(false);
|
|
136
213
|
const searchText = computed({
|
|
137
214
|
get: () => props.searchTerm ?? internalSearchText.value,
|
|
138
215
|
set: (value) => {
|
|
216
|
+
if (modeSearchLock.value)
|
|
217
|
+
return;
|
|
139
218
|
internalSearchText.value = value;
|
|
140
219
|
emit("update:searchTerm", value);
|
|
141
220
|
}
|
|
142
221
|
});
|
|
222
|
+
const isSearchComposing = ref(false);
|
|
223
|
+
function onSearchCompositionStart() {
|
|
224
|
+
isSearchComposing.value = true;
|
|
225
|
+
}
|
|
226
|
+
function onSearchCompositionEnd() {
|
|
227
|
+
nextTick(() => {
|
|
228
|
+
isSearchComposing.value = false;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
143
231
|
function revertUnmatchedText() {
|
|
144
232
|
if (!props.forceSelection || !searchText.value || hasMatchingOption(searchText.value))
|
|
145
233
|
return false;
|
|
@@ -147,12 +235,16 @@ function revertUnmatchedText() {
|
|
|
147
235
|
return true;
|
|
148
236
|
}
|
|
149
237
|
function onSearchKeydown(event) {
|
|
150
|
-
if (event.key !== "Enter")
|
|
238
|
+
if (event.key !== "Enter" || event.isComposing || isSearchComposing.value || event.keyCode === 229)
|
|
151
239
|
return;
|
|
152
|
-
if (revertUnmatchedText())
|
|
240
|
+
if (revertUnmatchedText()) {
|
|
241
|
+
event.preventDefault();
|
|
153
242
|
return;
|
|
154
|
-
|
|
243
|
+
}
|
|
244
|
+
if (commitCreatableText(searchText.value)) {
|
|
155
245
|
searchText.value = "";
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
}
|
|
156
248
|
}
|
|
157
249
|
function onSearchBlur() {
|
|
158
250
|
if (revertUnmatchedText())
|
|
@@ -164,10 +256,63 @@ function onDropdownClick() {
|
|
|
164
256
|
searchText.value = "";
|
|
165
257
|
}
|
|
166
258
|
function displayValue(value) {
|
|
167
|
-
if (!props.creatable || props.multiple ||
|
|
259
|
+
if (!props.creatable || props.multiple || value == null || Array.isArray(value))
|
|
168
260
|
return "";
|
|
169
261
|
return resolveOption(value).label;
|
|
170
262
|
}
|
|
263
|
+
function singleSelectionLabel(value) {
|
|
264
|
+
return value === void 0 || Array.isArray(value) ? "" : resolveOption(value).label;
|
|
265
|
+
}
|
|
266
|
+
watch(
|
|
267
|
+
[() => !!props.multiple, selection],
|
|
268
|
+
([multiple, currentValue], [previousMultiple, previousValue]) => {
|
|
269
|
+
if (multiple === previousMultiple)
|
|
270
|
+
return;
|
|
271
|
+
const wasEditableFocused = props.creatable && typeof document !== "undefined" && document.activeElement === editableInput.value;
|
|
272
|
+
const abortingComposition = !!props.creatable && isSearchComposing.value;
|
|
273
|
+
const previouslyIdle = props.creatable && props.searchTerm === void 0 && searchText.value === (previousMultiple || !props.resetSearchTermOnSelect ? "" : singleSelectionLabel(previousValue));
|
|
274
|
+
const savedSearchText = searchText.value;
|
|
275
|
+
let nextValue = currentValue;
|
|
276
|
+
if (isControlled()) {
|
|
277
|
+
assertControlledSelectionShape(currentValue, multiple);
|
|
278
|
+
} else {
|
|
279
|
+
nextValue = selectionForMode(currentValue, multiple);
|
|
280
|
+
updateSelection("update:modelValue", nextValue);
|
|
281
|
+
}
|
|
282
|
+
selectedChipValue.value = void 0;
|
|
283
|
+
if (props.creatable)
|
|
284
|
+
isSearchComposing.value = false;
|
|
285
|
+
if (abortingComposition) {
|
|
286
|
+
searchText.value = "";
|
|
287
|
+
updateOpen(false);
|
|
288
|
+
comboboxRootKey.value++;
|
|
289
|
+
}
|
|
290
|
+
const nextSearchText = abortingComposition ? "" : previouslyIdle ? multiple || !props.resetSearchTermOnSelect ? "" : singleSelectionLabel(nextValue) : savedSearchText;
|
|
291
|
+
if (props.creatable || props.searchable) {
|
|
292
|
+
modeSearchLock.value = true;
|
|
293
|
+
if (props.searchTerm === void 0)
|
|
294
|
+
internalSearchText.value = nextSearchText;
|
|
295
|
+
}
|
|
296
|
+
const priorInput = editableInput.value;
|
|
297
|
+
nextTick(() => {
|
|
298
|
+
if (props.creatable || props.searchable) {
|
|
299
|
+
if (props.searchTerm === void 0)
|
|
300
|
+
internalSearchText.value = nextSearchText;
|
|
301
|
+
nextTick(() => {
|
|
302
|
+
modeSearchLock.value = false;
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
if (!wasEditableFocused)
|
|
306
|
+
return;
|
|
307
|
+
if (typeof document === "undefined")
|
|
308
|
+
return;
|
|
309
|
+
if (document.activeElement !== document.body && document.activeElement !== priorInput)
|
|
310
|
+
return;
|
|
311
|
+
editableInput.value?.focus();
|
|
312
|
+
});
|
|
313
|
+
},
|
|
314
|
+
{ flush: "pre" }
|
|
315
|
+
);
|
|
171
316
|
const virtualizeConfig = computed(() => {
|
|
172
317
|
if (!props.virtualize)
|
|
173
318
|
return null;
|
|
@@ -192,9 +337,17 @@ const clearSize = computed(() => ({ sm: "sm", md: "sm", lg: "md" })[effectiveSiz
|
|
|
192
337
|
const icons = useIcons();
|
|
193
338
|
const messages = useMessages();
|
|
194
339
|
const theme = useComponentTheme("select", selectTheme);
|
|
195
|
-
const
|
|
196
|
-
const
|
|
197
|
-
const
|
|
340
|
+
const themeBindings = useThemeBindings();
|
|
341
|
+
const effectiveColor = computed(() => resolveRegisteredColorRole(props.color ?? "primary", "primary"));
|
|
342
|
+
const colorRoleMarker = computed(() => effectiveColor.value);
|
|
343
|
+
const ui = computed(() => theme.value({ size: effectiveSize.value, color: effectiveColor.value, invalid: selectInvalid.value }));
|
|
344
|
+
const nativeTriggerAttrs = useFallthroughAttrs((key) => !props.creatable && (isNativeInputA11yAttr(key) || !props.searchable && isNativeInputEvent(key)));
|
|
345
|
+
const rootProps = useRootProps(() => ui.value.root, () => props.ui?.root, { exclude: (key) => isNativeInputA11yAttr(key) || isNativeInputEvent(key) || (props.creatable || props.searchable) && isNativeInputAttr(key) });
|
|
346
|
+
const nativeSearchInputAttrs = useFallthroughAttrs((key) => isNativeInputAttr(key) || props.creatable && isNativeInputA11yAttr(key));
|
|
347
|
+
const triggerProps = computed(() => mergeProps(
|
|
348
|
+
resolveSlot(ui.value.trigger, props.ui?.trigger),
|
|
349
|
+
!props.creatable ? nativeTriggerAttrs.value : {}
|
|
350
|
+
));
|
|
198
351
|
const valueProps = computed(() => resolveSlot(ui.value.value, props.ui?.value));
|
|
199
352
|
const commaValueProps = computed(() => {
|
|
200
353
|
const override = props.ui?.value;
|
|
@@ -209,7 +362,11 @@ const iconProps = computed(() => resolveSlot(ui.value.icon, props.ui?.icon));
|
|
|
209
362
|
const clearProps = computed(() => resolveSlot(ui.value.clear, props.ui?.clear));
|
|
210
363
|
const dropdownProps = computed(() => resolveSlot(ui.value.dropdown, props.ui?.dropdown));
|
|
211
364
|
const searchWrapperProps = computed(() => resolveSlot(ui.value.searchWrapper, props.ui?.searchWrapper));
|
|
212
|
-
const searchInputProps = computed(() =>
|
|
365
|
+
const searchInputProps = computed(() => mergeProps(
|
|
366
|
+
resolveSlot(ui.value.searchInput, props.ui?.searchInput),
|
|
367
|
+
nativeSearchInputAttrs.value,
|
|
368
|
+
{ onCompositionstart: onSearchCompositionStart, onCompositionend: onSearchCompositionEnd }
|
|
369
|
+
));
|
|
213
370
|
const contentProps = computed(() => resolveSlot(ui.value.content, props.ui?.content));
|
|
214
371
|
const arrowProps = computed(() => resolveSlot(ui.value.arrow, props.ui?.arrow));
|
|
215
372
|
const viewportProps = computed(() => resolveSlot(ui.value.viewport, props.ui?.viewport));
|
|
@@ -218,9 +375,89 @@ const itemProps = computed(() => resolveSlot(ui.value.item, props.ui?.item));
|
|
|
218
375
|
const itemIndicatorProps = computed(() => resolveSlot(ui.value.itemIndicator, props.ui?.itemIndicator));
|
|
219
376
|
const emptyProps = computed(() => resolveSlot(ui.value.empty, props.ui?.empty));
|
|
220
377
|
const mobileContentProps = computed(() => resolveSlot(ui.value.mobileContent, props.ui?.mobileContent));
|
|
221
|
-
const
|
|
378
|
+
const mobilePanelProps = computed(() => mergeProps(
|
|
379
|
+
{
|
|
380
|
+
style: {
|
|
381
|
+
width: "min(calc(100vw - 2rem), 36rem)",
|
|
382
|
+
minWidth: "0",
|
|
383
|
+
maxHeight: "min(50vh, 28rem)"
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
resolveSlot(ui.value.mobilePanel, props.ui?.mobilePanel)
|
|
387
|
+
));
|
|
388
|
+
const localOpen = ref(props.defaultOpen ?? false);
|
|
389
|
+
const isOpenControlled = () => Object.hasOwn(instance.vnode.props ?? {}, "open");
|
|
390
|
+
const open = computed(() => isOpenControlled() ? props.open ?? false : localOpen.value);
|
|
391
|
+
watch(flatOptions, (options, previousOptions) => {
|
|
392
|
+
const value = selection.value;
|
|
393
|
+
if (!props.creatable || props.multiple || open.value || props.searchTerm !== void 0 || !props.resetSearchTermOnSelect || value === void 0 || Array.isArray(value))
|
|
394
|
+
return;
|
|
395
|
+
const previousLabel = previousOptions.find((option) => option.value === value)?.label ?? String(value);
|
|
396
|
+
const nextLabel = options.find((option) => option.value === value)?.label ?? String(value);
|
|
397
|
+
if (previousLabel !== nextLabel && searchText.value === previousLabel)
|
|
398
|
+
searchText.value = nextLabel;
|
|
399
|
+
});
|
|
400
|
+
function updateOpen(value) {
|
|
401
|
+
if (!isOpenControlled())
|
|
402
|
+
localOpen.value = value;
|
|
403
|
+
emit("update:open", value);
|
|
404
|
+
}
|
|
405
|
+
function resetSelection(event) {
|
|
406
|
+
queueMicrotask(() => {
|
|
407
|
+
if (event.defaultPrevented)
|
|
408
|
+
return;
|
|
409
|
+
setValue(selectionForMode(initialValue, !!props.multiple));
|
|
410
|
+
searchText.value = props.creatable && !props.multiple && props.resetSearchTermOnSelect ? singleSelectionLabel(selection.value) : "";
|
|
411
|
+
selectedChipValue.value = void 0;
|
|
412
|
+
updateOpen(false);
|
|
413
|
+
});
|
|
414
|
+
}
|
|
222
415
|
const isMobile = useIsMobile();
|
|
223
|
-
const
|
|
416
|
+
const mobilePresentation = ref(false);
|
|
417
|
+
watch(open, (open2) => {
|
|
418
|
+
if (!open2 && mobilePresentation.value && !props.creatable && props.resetSearchTermOnBlur)
|
|
419
|
+
searchText.value = "";
|
|
420
|
+
mobilePresentation.value = open2 && !!props.adaptive && isMobile.value;
|
|
421
|
+
});
|
|
422
|
+
onMounted(() => {
|
|
423
|
+
if (!open.value)
|
|
424
|
+
return;
|
|
425
|
+
mobilePresentation.value = !!props.adaptive && isMobile.value;
|
|
426
|
+
if (mobilePresentation.value && props.creatable && !props.disabled) {
|
|
427
|
+
nextTick(() => {
|
|
428
|
+
editableInput.value?.focus();
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
const showMobileSelectModal = computed(() => mobilePresentation.value && !props.creatable);
|
|
433
|
+
const showMobileAutocompletePanel = computed(() => mobilePresentation.value && !!props.creatable);
|
|
434
|
+
const modalId = `selaras-select-modal-${useId()}`;
|
|
435
|
+
const selectTrigger = ref();
|
|
436
|
+
const modalBody = ref();
|
|
437
|
+
const modalTriggerAttrs = computed(() => !props.creatable && (open.value ? showMobileSelectModal.value : props.adaptive && isMobile.value) ? { "aria-haspopup": "dialog", "aria-controls": modalId } : {});
|
|
438
|
+
function onModalSelection(value) {
|
|
439
|
+
setValue(value == null ? props.multiple ? [] : void 0 : value);
|
|
440
|
+
if (!props.multiple)
|
|
441
|
+
updateOpen(false);
|
|
442
|
+
}
|
|
443
|
+
const adaptiveUi = computed(() => ({
|
|
444
|
+
content: {
|
|
445
|
+
class: "rounded-[var(--selaras-resolved-radius-md)]",
|
|
446
|
+
...!props.creatable ? {
|
|
447
|
+
"id": modalId,
|
|
448
|
+
"aria-modal": true,
|
|
449
|
+
"onOpenAutoFocus": (event) => {
|
|
450
|
+
if (props.searchable && modalBody.value?.focusSearch())
|
|
451
|
+
event.preventDefault();
|
|
452
|
+
},
|
|
453
|
+
"onCloseAutoFocus": (event) => {
|
|
454
|
+
event.preventDefault();
|
|
455
|
+
if (!props.disabled && selectTrigger.value?.$el?.isConnected)
|
|
456
|
+
selectTrigger.value.$el.focus();
|
|
457
|
+
}
|
|
458
|
+
} : {}
|
|
459
|
+
}
|
|
460
|
+
}));
|
|
224
461
|
const bodyProps = computed(() => ({
|
|
225
462
|
searchable: props.searchable,
|
|
226
463
|
creatable: props.creatable,
|
|
@@ -246,17 +483,18 @@ const bodyProps = computed(() => ({
|
|
|
246
483
|
|
|
247
484
|
<template>
|
|
248
485
|
<ComboboxRoot
|
|
249
|
-
:
|
|
250
|
-
:
|
|
486
|
+
:key="comboboxRootKey"
|
|
487
|
+
:open="open"
|
|
488
|
+
:model-value="rekaSelection"
|
|
251
489
|
:multiple="multiple"
|
|
252
490
|
:disabled="disabled"
|
|
253
|
-
:name="name ?? field?.name"
|
|
254
491
|
:ignore-filter="!searchable"
|
|
255
492
|
:reset-search-term-on-blur="resetSearchTermOnBlur"
|
|
256
493
|
:reset-search-term-on-select="resetSearchTermOnSelect"
|
|
494
|
+
:data-selaras-color="colorRoleMarker"
|
|
257
495
|
v-bind="rootProps"
|
|
258
|
-
@update:open="
|
|
259
|
-
@update:model-value="(
|
|
496
|
+
@update:open="updateOpen($event)"
|
|
497
|
+
@update:model-value="(value2) => setValue(value2 == null ? multiple ? [] : void 0 : value2)"
|
|
260
498
|
>
|
|
261
499
|
<ComboboxAnchor>
|
|
262
500
|
<!--
|
|
@@ -267,11 +505,7 @@ const bodyProps = computed(() => ({
|
|
|
267
505
|
-->
|
|
268
506
|
<div
|
|
269
507
|
v-if="creatable"
|
|
270
|
-
:id="selectId"
|
|
271
508
|
data-ui-group-item
|
|
272
|
-
:aria-invalid="selectInvalid || void 0"
|
|
273
|
-
:aria-describedby="describedBy"
|
|
274
|
-
:aria-busy="loading || void 0"
|
|
275
509
|
v-bind="triggerProps"
|
|
276
510
|
>
|
|
277
511
|
<!--
|
|
@@ -310,15 +544,18 @@ const bodyProps = computed(() => ({
|
|
|
310
544
|
color="primary"
|
|
311
545
|
variant="soft"
|
|
312
546
|
removable
|
|
313
|
-
:ui="{ root: 'data-[state=active]:ring-2 data-[state=active]:ring-[var(--
|
|
547
|
+
:ui="{ root: 'data-[state=active]:ring-2 data-[state=active]:ring-[var(--_selaras-color-fill)]' }"
|
|
314
548
|
>
|
|
315
549
|
<TagsInputItemText as="span">
|
|
316
|
-
<slot name="item" :item="option.raw">
|
|
550
|
+
<slot v-if="option.raw" name="item" :item="option.raw">
|
|
317
551
|
{{ option.label }}
|
|
318
552
|
</slot>
|
|
553
|
+
<template v-else>
|
|
554
|
+
{{ option.label }}
|
|
555
|
+
</template>
|
|
319
556
|
</TagsInputItemText>
|
|
320
557
|
<template #remove="{ class: removeClass }">
|
|
321
|
-
<TagsInputItemDelete :class="removeClass" :aria-label="messages.removeItem(option.label)">
|
|
558
|
+
<TagsInputItemDelete :class="removeClass" :aria-labelledby="undefined" :aria-label="messages.removeItem(option.label)">
|
|
322
559
|
<Icon :name="icons.close" class="size-3" />
|
|
323
560
|
</TagsInputItemDelete>
|
|
324
561
|
</template>
|
|
@@ -326,8 +563,13 @@ const bodyProps = computed(() => ({
|
|
|
326
563
|
</TagsInputItem>
|
|
327
564
|
<ComboboxInput v-model="searchText" as-child>
|
|
328
565
|
<TagsInputInput
|
|
566
|
+
:id="selectId"
|
|
567
|
+
:ref="setEditableInput"
|
|
329
568
|
:display-value="displayValue"
|
|
330
569
|
:placeholder="placeholder"
|
|
570
|
+
:aria-invalid="selectInvalid || void 0"
|
|
571
|
+
:aria-describedby="describedBy"
|
|
572
|
+
:aria-busy="loading || void 0"
|
|
331
573
|
v-bind="searchInputProps"
|
|
332
574
|
@keydown="onSearchKeydown"
|
|
333
575
|
@blur="onSearchBlur"
|
|
@@ -336,9 +578,14 @@ const bodyProps = computed(() => ({
|
|
|
336
578
|
</TagsInputRoot>
|
|
337
579
|
<ComboboxInput
|
|
338
580
|
v-else
|
|
581
|
+
:id="selectId"
|
|
582
|
+
:ref="setEditableInput"
|
|
339
583
|
v-model="searchText"
|
|
340
584
|
:display-value="displayValue"
|
|
341
585
|
:placeholder="placeholder"
|
|
586
|
+
:aria-invalid="selectInvalid || void 0"
|
|
587
|
+
:aria-describedby="describedBy"
|
|
588
|
+
:aria-busy="loading || void 0"
|
|
342
589
|
v-bind="searchInputProps"
|
|
343
590
|
@keydown="onSearchKeydown"
|
|
344
591
|
@blur="onSearchBlur"
|
|
@@ -386,11 +633,12 @@ const bodyProps = computed(() => ({
|
|
|
386
633
|
<ComboboxTrigger
|
|
387
634
|
v-else
|
|
388
635
|
:id="selectId"
|
|
636
|
+
ref="selectTrigger"
|
|
389
637
|
data-ui-group-item
|
|
390
638
|
:aria-invalid="selectInvalid || void 0"
|
|
391
639
|
:aria-describedby="describedBy"
|
|
392
640
|
:aria-busy="loading || void 0"
|
|
393
|
-
v-bind="triggerProps"
|
|
641
|
+
v-bind="mergeProps(triggerProps, modalTriggerAttrs)"
|
|
394
642
|
tabindex="0"
|
|
395
643
|
@keydown="onTriggerKeydown"
|
|
396
644
|
@blur="selectedChipValue = void 0"
|
|
@@ -413,11 +661,14 @@ const bodyProps = computed(() => ({
|
|
|
413
661
|
removable
|
|
414
662
|
:data-state="option.value === selectedChipValue ? 'active' : 'inactive'"
|
|
415
663
|
:aria-current="option.value === selectedChipValue || void 0"
|
|
416
|
-
:ui="{ root: 'data-[state=active]:ring-2 data-[state=active]:ring-[var(--
|
|
664
|
+
:ui="{ root: 'data-[state=active]:ring-2 data-[state=active]:ring-[var(--_selaras-color-fill)]' }"
|
|
417
665
|
>
|
|
418
|
-
<slot name="item" :item="option.raw">
|
|
666
|
+
<slot v-if="option.raw" name="item" :item="option.raw">
|
|
419
667
|
{{ option.label }}
|
|
420
668
|
</slot>
|
|
669
|
+
<template v-else>
|
|
670
|
+
{{ option.label }}
|
|
671
|
+
</template>
|
|
421
672
|
<!-- role="button", not a real <button> - this trigger already IS a <button> (ComboboxTrigger), see the clear button below for why. -->
|
|
422
673
|
<template #remove="{ class: removeClass }">
|
|
423
674
|
<span role="button" tabindex="-1" :class="removeClass" :aria-label="messages.removeItem(option.label)" @click.stop="removeValue(option.value)">
|
|
@@ -489,8 +740,12 @@ const bodyProps = computed(() => ({
|
|
|
489
740
|
</ComboboxTrigger>
|
|
490
741
|
</ComboboxAnchor>
|
|
491
742
|
|
|
492
|
-
<ComboboxPortal v-if="!
|
|
493
|
-
<ComboboxContent
|
|
743
|
+
<ComboboxPortal v-if="!showMobileSelectModal">
|
|
744
|
+
<ComboboxContent
|
|
745
|
+
position="popper" :side-offset="4"
|
|
746
|
+
:data-selaras-theme="themeBindings['data-selaras-theme']" :data-selaras-mode="themeBindings['data-selaras-mode']" :style="themeBindings.style" :data-selaras-color="colorRoleMarker"
|
|
747
|
+
v-bind="showMobileAutocompletePanel ? mergeProps(contentProps, mobilePanelProps) : contentProps"
|
|
748
|
+
>
|
|
494
749
|
<ComboboxSelectBody v-bind="bodyProps" @update:search-text="searchText = $event">
|
|
495
750
|
<template #header>
|
|
496
751
|
<slot name="header" />
|
|
@@ -518,73 +773,65 @@ const bodyProps = computed(() => ({
|
|
|
518
773
|
</ComboboxContent>
|
|
519
774
|
</ComboboxPortal>
|
|
520
775
|
<!--
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
#content as a whole, nesting a second teleport inside it would be
|
|
526
|
-
redundant. ComboboxContent still wraps it (no `position` prop, so
|
|
527
|
-
Reka renders it as a plain unstyled box rather than applying its own
|
|
528
|
-
Floating-UI positioning - confirmed by reading ComboboxContentImpl
|
|
529
|
-
directly) since ComboboxViewport/ComboboxItem's own context still
|
|
530
|
-
expects a ComboboxContent ancestor. `title`/`description` are
|
|
531
|
-
passed explicitly here - Modal's own dev-mode a11y warning is
|
|
532
|
-
satisfied merely by the content slot existing, so it won't catch a
|
|
533
|
-
name-less dialog on its own; Modal registers both with Reka
|
|
534
|
-
(visually hidden) even though the content slot replaces its own
|
|
535
|
-
visible header.
|
|
536
|
-
-->
|
|
537
|
-
<!--
|
|
538
|
-
auto-focus="!creatable" - Select's own trigger is a one-off tap (a
|
|
539
|
-
button; once the modal opens, the next interaction is tapping an
|
|
540
|
-
item, or typing into a *different* search box that lives inside the
|
|
541
|
-
modal itself), so Reka's default open-autofocus is fine, even
|
|
542
|
-
helpful for a keyboard user. Autocomplete's trigger *is* the search
|
|
543
|
-
input itself, typed into continuously while the modal stays open -
|
|
544
|
-
Reka's default there stole focus away on the very first keystroke
|
|
545
|
-
(confirmed live: opening via typing immediately re-focused the
|
|
546
|
-
modal's own content, silently dropping every character typed
|
|
547
|
-
afterward) - the same class of bug DatePicker's own range-mode
|
|
548
|
-
autofocus interference was, just triggered by every keystroke
|
|
549
|
-
instead of a single click.
|
|
550
|
-
:ui content - overrides Modal's own default rounded-lg down to
|
|
551
|
-
rounded-md, matching every other floating panel in this library
|
|
552
|
-
(Select/Autocomplete/DatePicker's own desktop popovers all use
|
|
553
|
-
rounded-md) - rounded-lg reads noticeably heavier/rounder than the
|
|
554
|
-
desktop equivalent for what's otherwise the same surface.
|
|
776
|
+
Modal owns Select's focus/dismissal; Listbox only supplies selection.
|
|
777
|
+
The content slot retains Modal's registered title/description.
|
|
778
|
+
Autocomplete stays in the nonmodal ComboboxContent branch above: its
|
|
779
|
+
editable input is the one focus and dismissal owner for that surface.
|
|
555
780
|
-->
|
|
556
781
|
<Modal
|
|
557
|
-
v-else :open="
|
|
558
|
-
:auto-focus="
|
|
559
|
-
@update:open="
|
|
782
|
+
v-else :open="open" :title="placeholder || messages.search" :description="messages.searchDescription"
|
|
783
|
+
:auto-focus="true" :ui="adaptiveUi"
|
|
784
|
+
@update:open="updateOpen($event)"
|
|
560
785
|
>
|
|
561
786
|
<template #content>
|
|
562
|
-
<
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
<slot name="empty" />
|
|
572
|
-
</template>
|
|
573
|
-
<template #empty-filter>
|
|
574
|
-
<slot name="empty-filter" />
|
|
787
|
+
<ListboxRoot
|
|
788
|
+
v-if="!creatable"
|
|
789
|
+
:model-value="rekaSelection" :multiple="multiple" :disabled="disabled"
|
|
790
|
+
:data-selaras-theme="themeBindings['data-selaras-theme']" :data-selaras-mode="themeBindings['data-selaras-mode']" :style="themeBindings.style" :data-selaras-color="colorRoleMarker" v-bind="mobileContentProps"
|
|
791
|
+
@update:model-value="onModalSelection"
|
|
792
|
+
>
|
|
793
|
+
<ComboboxSelectBody ref="modalBody" v-bind="bodyProps" listbox @update:search-text="searchText = $event">
|
|
794
|
+
<template v-for="slotName in ['header', 'filter-icon', 'empty', 'empty-filter', 'footer'].filter((slotName) => $slots[slotName])" #[slotName]>
|
|
795
|
+
<slot :name="slotName" />
|
|
575
796
|
</template>
|
|
576
|
-
<template #item="scope">
|
|
797
|
+
<template v-if="$slots.item" #item="scope">
|
|
577
798
|
<slot name="item" v-bind="scope" />
|
|
578
799
|
</template>
|
|
579
|
-
<template #group="scope">
|
|
800
|
+
<template v-if="$slots.group" #group="scope">
|
|
580
801
|
<slot name="group" v-bind="scope" />
|
|
581
802
|
</template>
|
|
582
|
-
<template #footer>
|
|
583
|
-
<slot name="footer" />
|
|
584
|
-
</template>
|
|
585
803
|
</ComboboxSelectBody>
|
|
586
|
-
</
|
|
804
|
+
</ListboxRoot>
|
|
805
|
+
<div v-if="!creatable" class="flex justify-end p-2">
|
|
806
|
+
<DialogClose as-child>
|
|
807
|
+
<Button variant="ghost" color="neutral">
|
|
808
|
+
{{ multiple ? messages.done : messages.cancel }}
|
|
809
|
+
</Button>
|
|
810
|
+
</DialogClose>
|
|
811
|
+
</div>
|
|
587
812
|
</template>
|
|
588
813
|
</Modal>
|
|
814
|
+
<input
|
|
815
|
+
ref="formAnchor"
|
|
816
|
+
:type="required ? 'text' : 'hidden'"
|
|
817
|
+
:class="required ? 'sr-only' : void 0"
|
|
818
|
+
:name="required && !selectedValues.length ? name ?? field?.name : void 0"
|
|
819
|
+
:form="form"
|
|
820
|
+
:required="required && !disabled && !selectedValues.length"
|
|
821
|
+
:disabled="disabled || !!selectedValues.length"
|
|
822
|
+
aria-hidden="true"
|
|
823
|
+
tabindex="-1"
|
|
824
|
+
autocomplete="off"
|
|
825
|
+
>
|
|
826
|
+
<input
|
|
827
|
+
v-for="(value, index) in selectedValues"
|
|
828
|
+
:key="index"
|
|
829
|
+
type="hidden"
|
|
830
|
+
:name="name ?? field?.name"
|
|
831
|
+
:form="form"
|
|
832
|
+
:value="String(value)"
|
|
833
|
+
:disabled="disabled"
|
|
834
|
+
:required="required && !disabled && index === 0"
|
|
835
|
+
>
|
|
589
836
|
</ComboboxRoot>
|
|
590
837
|
</template>
|