@sewadah/selaras 0.1.1 → 0.3.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 +67 -20
- package/dist/module.d.mts +10 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +123 -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 +22 -12
- 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 +8 -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/ProsePre.d.vue.ts +4 -2
- package/dist/runtime/components/ProsePre.vue +9 -3
- package/dist/runtime/components/ProsePre.vue.d.ts +4 -2
- 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 +35 -50
- package/dist/runtime/theme/prose.js +24 -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 +62 -0
- package/dist/runtime/utils/color-registry.js +191 -0
- package/dist/runtime/utils/dtcg-colors.d.ts +25 -0
- package/dist/runtime/utils/dtcg-colors.js +40 -0
- package/dist/runtime/utils/file-icons.d.ts +8 -0
- package/dist/runtime/utils/file-icons.js +131 -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/navigation-menu.d.ts +3 -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 +19 -0
- package/dist/runtime/utils/seed-colors.js +207 -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 +83 -16
- package/dist/runtime/composables/use-combobox-select.d.ts +0 -45
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { DrawerClose, DrawerContent, DrawerDescription, DrawerHandle, DrawerOverlay, DrawerPortal, DrawerRoot, DrawerTitle, DrawerTrigger, VisuallyHidden } from "reka-ui";
|
|
3
|
-
import { computed, ref, useSlots, watch, watchEffect } from "vue";
|
|
3
|
+
import { computed, getCurrentInstance, ref, useSlots, watch, watchEffect } from "vue";
|
|
4
4
|
import { useIcons } from "../composables/use-icons";
|
|
5
5
|
import { useMessages } from "../composables/use-messages";
|
|
6
6
|
import { drawerTheme } from "../theme/drawer";
|
|
7
|
-
import { resolveSlot, useComponentTheme } from "../utils/ui";
|
|
7
|
+
import { resolveSlot, useComponentTheme, useThemeBindings } from "../utils/ui";
|
|
8
8
|
import Button from "./Button.vue";
|
|
9
9
|
import Icon from "./Icon.vue";
|
|
10
10
|
const props = defineProps({
|
|
11
|
-
open: { type: Boolean, required: false },
|
|
11
|
+
open: { type: Boolean, required: false, default: void 0 },
|
|
12
|
+
defaultOpen: { type: Boolean, required: false },
|
|
12
13
|
title: { type: String, required: false },
|
|
13
14
|
description: { type: String, required: false },
|
|
14
15
|
side: { type: String, required: false, default: "bottom" },
|
|
@@ -46,15 +47,17 @@ function onContentAnimationEnd(event) {
|
|
|
46
47
|
if (event.target.getAttribute("data-state") === "closed")
|
|
47
48
|
emit("afterLeave");
|
|
48
49
|
}
|
|
49
|
-
const
|
|
50
|
+
const isControlled = Object.hasOwn(getCurrentInstance()?.vnode.props ?? {}, "open");
|
|
51
|
+
const internalOpen = ref(props.open ?? props.defaultOpen ?? false);
|
|
50
52
|
watch(() => props.open, (value) => {
|
|
51
|
-
if (
|
|
52
|
-
internalOpen.value = value;
|
|
53
|
+
if (isControlled)
|
|
54
|
+
internalOpen.value = value ?? false;
|
|
53
55
|
});
|
|
54
56
|
function onUpdateOpen(value, details) {
|
|
55
57
|
if (!props.dismissible && details?.reason === "swipe")
|
|
56
58
|
return;
|
|
57
|
-
|
|
59
|
+
if (!isControlled)
|
|
60
|
+
internalOpen.value = value;
|
|
58
61
|
emit("update:open", value);
|
|
59
62
|
}
|
|
60
63
|
watch(internalOpen, (value) => {
|
|
@@ -71,6 +74,7 @@ if (import.meta.dev) {
|
|
|
71
74
|
const icons = useIcons();
|
|
72
75
|
const messages = useMessages();
|
|
73
76
|
const theme = useComponentTheme("drawer", drawerTheme);
|
|
77
|
+
const themeBindings = useThemeBindings();
|
|
74
78
|
const ui = computed(() => theme.value({ side: props.side, transition: props.transition }));
|
|
75
79
|
const overlayProps = computed(() => resolveSlot(ui.value.overlay, props.ui?.overlay));
|
|
76
80
|
const contentProps = computed(() => resolveSlot(ui.value.content, props.ui?.content));
|
|
@@ -98,8 +102,17 @@ const footerProps = computed(() => resolveSlot(ui.value.footer, props.ui?.footer
|
|
|
98
102
|
<slot />
|
|
99
103
|
</DrawerTrigger>
|
|
100
104
|
<DrawerPortal>
|
|
101
|
-
<DrawerOverlay
|
|
105
|
+
<DrawerOverlay
|
|
106
|
+
v-if="overlay"
|
|
107
|
+
:data-selaras-theme="themeBindings['data-selaras-theme']"
|
|
108
|
+
:data-selaras-mode="themeBindings['data-selaras-mode']"
|
|
109
|
+
:style="themeBindings.style"
|
|
110
|
+
v-bind="overlayProps"
|
|
111
|
+
/>
|
|
102
112
|
<DrawerContent
|
|
113
|
+
:data-selaras-theme="themeBindings['data-selaras-theme']"
|
|
114
|
+
:data-selaras-mode="themeBindings['data-selaras-mode']"
|
|
115
|
+
:style="themeBindings.style"
|
|
103
116
|
v-bind="contentProps"
|
|
104
117
|
@escape-key-down="onEscapeKeyDown"
|
|
105
118
|
@pointer-down-outside="onPointerDownOutside"
|
|
@@ -2,6 +2,8 @@ import type { DrawerThemeSlots } from '../theme/drawer.js';
|
|
|
2
2
|
import type { UiProp } from '../utils/ui.js';
|
|
3
3
|
export interface DrawerProps {
|
|
4
4
|
open?: boolean;
|
|
5
|
+
/** Initial visibility for an uncontrolled drawer. Supplying `open` makes the parent authoritative. */
|
|
6
|
+
defaultOpen?: boolean;
|
|
5
7
|
title?: string;
|
|
6
8
|
description?: string;
|
|
7
9
|
/** Which edge the panel slides in from - also the direction it's swiped toward to dismiss it. */
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { onUnmounted } from "vue";
|
|
3
|
+
import { useDrawerService } from "../internal/programmatic-services";
|
|
4
|
+
import ProgrammaticTheme from "../internal/ProgrammaticTheme.vue";
|
|
3
5
|
import Drawer from "./Drawer.vue";
|
|
4
|
-
const { drawers, close, remove } =
|
|
6
|
+
const { instances: drawers, close, remove, dispose } = useDrawerService();
|
|
7
|
+
onUnmounted(dispose);
|
|
5
8
|
</script>
|
|
6
9
|
|
|
7
10
|
<template>
|
|
8
|
-
<
|
|
11
|
+
<ProgrammaticTheme
|
|
9
12
|
v-for="instance in drawers"
|
|
10
13
|
:key="instance.id"
|
|
11
|
-
:
|
|
12
|
-
:title="instance.title"
|
|
13
|
-
:description="instance.description"
|
|
14
|
-
:side="instance.side"
|
|
15
|
-
:handle="instance.handle"
|
|
16
|
-
:snap-points="instance.snapPoints"
|
|
17
|
-
:snap-point="instance.snapPoint"
|
|
18
|
-
:snap-to-sequential-points="instance.snapToSequentialPoints"
|
|
19
|
-
:dismissible="instance.dismissible"
|
|
20
|
-
:modal="instance.modal"
|
|
21
|
-
:overlay="instance.overlay"
|
|
22
|
-
:transition="instance.transition"
|
|
23
|
-
@update:open="(open) => !open && close(instance.id)"
|
|
24
|
-
@after-leave="remove(instance.id)"
|
|
14
|
+
:snapshot="instance._theme"
|
|
25
15
|
>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
<Drawer
|
|
17
|
+
:open="instance.isOpen"
|
|
18
|
+
:title="instance.title"
|
|
19
|
+
:description="instance.description"
|
|
20
|
+
:side="instance.side"
|
|
21
|
+
:handle="instance.handle"
|
|
22
|
+
:snap-points="instance.snapPoints"
|
|
23
|
+
:snap-point="instance.snapPoint"
|
|
24
|
+
:snap-to-sequential-points="instance.snapToSequentialPoints"
|
|
25
|
+
:dismissible="instance.dismissible"
|
|
26
|
+
:modal="instance.modal"
|
|
27
|
+
:overlay="instance.overlay"
|
|
28
|
+
:transition="instance.transition"
|
|
29
|
+
@update:open="(open) => !open && close(instance.id)"
|
|
30
|
+
@after-leave="remove(instance.id)"
|
|
31
|
+
>
|
|
32
|
+
<template #content>
|
|
33
|
+
<component :is="instance.component" v-bind="instance.props" @close="(value) => close(instance.id, value)" />
|
|
34
|
+
</template>
|
|
35
|
+
</Drawer>
|
|
36
|
+
</ProgrammaticTheme>
|
|
30
37
|
</template>
|
|
@@ -12,19 +12,29 @@ export interface DropdownItem {
|
|
|
12
12
|
}
|
|
13
13
|
export interface DropdownProps {
|
|
14
14
|
items: DropdownItem[][];
|
|
15
|
+
open?: boolean;
|
|
16
|
+
/** Initial visibility for an uncontrolled dropdown. Supplying `open` makes the parent authoritative. */
|
|
17
|
+
defaultOpen?: boolean;
|
|
15
18
|
/** Shows a small pointer triangle connecting the menu to its trigger. */
|
|
16
19
|
arrow?: boolean;
|
|
17
20
|
ui?: UiProp<DropdownThemeSlots>;
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
export interface DropdownEmits {
|
|
23
|
+
'update:open': [value: boolean];
|
|
24
|
+
}
|
|
25
|
+
declare var __VLS_16: {}, __VLS_48: {
|
|
20
26
|
item: DropdownItem;
|
|
21
27
|
};
|
|
22
28
|
type __VLS_Slots = {} & {
|
|
23
|
-
default?: (props: typeof
|
|
29
|
+
default?: (props: typeof __VLS_16) => any;
|
|
24
30
|
} & {
|
|
25
|
-
item?: (props: typeof
|
|
31
|
+
item?: (props: typeof __VLS_48) => any;
|
|
26
32
|
};
|
|
27
|
-
declare const __VLS_base: import("vue").DefineComponent<DropdownProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
declare const __VLS_base: import("vue").DefineComponent<DropdownProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
"update:open": (value: boolean) => any;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<DropdownProps> & Readonly<{
|
|
36
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
37
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
38
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
39
|
declare const _default: typeof __VLS_export;
|
|
30
40
|
export default _default;
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { DropdownMenuArrow, DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuTrigger } from "reka-ui";
|
|
3
|
-
import { computed } from "vue";
|
|
3
|
+
import { computed, getCurrentInstance, ref, watch } from "vue";
|
|
4
4
|
import { dropdownTheme } from "../theme/dropdown";
|
|
5
|
-
import { resolveSlot, useComponentTheme } from "../utils/ui";
|
|
5
|
+
import { resolveSlot, useComponentTheme, useThemeBindings } from "../utils/ui";
|
|
6
6
|
import Icon from "./Icon.vue";
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
items: { type: Array, required: true },
|
|
9
|
+
open: { type: Boolean, required: false, default: void 0 },
|
|
10
|
+
defaultOpen: { type: Boolean, required: false },
|
|
9
11
|
arrow: { type: Boolean, required: false, default: false },
|
|
10
12
|
ui: { type: Object, required: false }
|
|
11
13
|
});
|
|
14
|
+
const emit = defineEmits(["update:open"]);
|
|
15
|
+
const isControlled = Object.hasOwn(getCurrentInstance()?.vnode.props ?? {}, "open");
|
|
16
|
+
const internalOpen = ref(props.open ?? props.defaultOpen ?? false);
|
|
17
|
+
watch(() => props.open, (value) => {
|
|
18
|
+
if (isControlled)
|
|
19
|
+
internalOpen.value = value ?? false;
|
|
20
|
+
});
|
|
21
|
+
function onUpdateOpen(value) {
|
|
22
|
+
if (!isControlled)
|
|
23
|
+
internalOpen.value = value;
|
|
24
|
+
emit("update:open", value);
|
|
25
|
+
}
|
|
12
26
|
const theme = useComponentTheme("dropdown", dropdownTheme);
|
|
27
|
+
const themeBindings = useThemeBindings();
|
|
13
28
|
const ui = computed(() => theme.value());
|
|
14
29
|
const contentProps = computed(() => resolveSlot(ui.value.content, props.ui?.content));
|
|
15
30
|
const arrowProps = computed(() => resolveSlot(ui.value.arrow, props.ui?.arrow));
|
|
@@ -23,12 +38,12 @@ const separatorProps = computed(() => resolveSlot(ui.value.separator, props.ui?.
|
|
|
23
38
|
</script>
|
|
24
39
|
|
|
25
40
|
<template>
|
|
26
|
-
<DropdownMenuRoot>
|
|
41
|
+
<DropdownMenuRoot :open="internalOpen" @update:open="onUpdateOpen">
|
|
27
42
|
<DropdownMenuTrigger as-child>
|
|
28
43
|
<slot />
|
|
29
44
|
</DropdownMenuTrigger>
|
|
30
45
|
<DropdownMenuPortal>
|
|
31
|
-
<DropdownMenuContent :side-offset="6" align="start" v-bind="contentProps">
|
|
46
|
+
<DropdownMenuContent :side-offset="6" align="start" :data-selaras-theme="themeBindings['data-selaras-theme']" :data-selaras-mode="themeBindings['data-selaras-mode']" :style="themeBindings.style" v-bind="contentProps">
|
|
32
47
|
<template v-for="(group, groupIndex) in items" :key="groupIndex">
|
|
33
48
|
<DropdownMenuSeparator v-if="groupIndex > 0" v-bind="separatorProps" />
|
|
34
49
|
<DropdownMenuItem
|
|
@@ -12,19 +12,29 @@ export interface DropdownItem {
|
|
|
12
12
|
}
|
|
13
13
|
export interface DropdownProps {
|
|
14
14
|
items: DropdownItem[][];
|
|
15
|
+
open?: boolean;
|
|
16
|
+
/** Initial visibility for an uncontrolled dropdown. Supplying `open` makes the parent authoritative. */
|
|
17
|
+
defaultOpen?: boolean;
|
|
15
18
|
/** Shows a small pointer triangle connecting the menu to its trigger. */
|
|
16
19
|
arrow?: boolean;
|
|
17
20
|
ui?: UiProp<DropdownThemeSlots>;
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
export interface DropdownEmits {
|
|
23
|
+
'update:open': [value: boolean];
|
|
24
|
+
}
|
|
25
|
+
declare var __VLS_16: {}, __VLS_48: {
|
|
20
26
|
item: DropdownItem;
|
|
21
27
|
};
|
|
22
28
|
type __VLS_Slots = {} & {
|
|
23
|
-
default?: (props: typeof
|
|
29
|
+
default?: (props: typeof __VLS_16) => any;
|
|
24
30
|
} & {
|
|
25
|
-
item?: (props: typeof
|
|
31
|
+
item?: (props: typeof __VLS_48) => any;
|
|
26
32
|
};
|
|
27
|
-
declare const __VLS_base: import("vue").DefineComponent<DropdownProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
declare const __VLS_base: import("vue").DefineComponent<DropdownProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
"update:open": (value: boolean) => any;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<DropdownProps> & Readonly<{
|
|
36
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
37
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
38
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
39
|
declare const _default: typeof __VLS_export;
|
|
30
40
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FileTreeThemeSlots } from '../theme/file-tree.js';
|
|
2
|
+
import type { ColorRole } from '../utils/color-registry.js';
|
|
2
3
|
import type { UiProp } from '../utils/ui.js';
|
|
3
4
|
export interface FileTreeNode {
|
|
4
5
|
name: string;
|
|
@@ -12,6 +13,8 @@ export interface FileTreeProps {
|
|
|
12
13
|
selected?: FileTreeNode;
|
|
13
14
|
/** Whether a directory starts expanded. @default true */
|
|
14
15
|
defaultExpanded?: boolean;
|
|
16
|
+
/** The selected-file accent. @default 'primary' */
|
|
17
|
+
color?: ColorRole;
|
|
15
18
|
/** Internal - true for a recursive call rendering a directory's children, skipping the outer box. */
|
|
16
19
|
isNested?: boolean;
|
|
17
20
|
ui?: UiProp<FileTreeThemeSlots>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
3
|
import { useIcons } from "../composables/use-icons";
|
|
4
4
|
import { fileTreeTheme } from "../theme/file-tree";
|
|
5
|
+
import { resolveRegisteredColorRole } from "../utils/registered-colors";
|
|
5
6
|
import { resolveSlot, useComponentTheme, useRootProps } from "../utils/ui";
|
|
6
7
|
import Icon from "./Icon.vue";
|
|
7
8
|
defineOptions({ inheritAttrs: false });
|
|
@@ -9,6 +10,7 @@ const props = defineProps({
|
|
|
9
10
|
items: { type: Array, required: true },
|
|
10
11
|
selected: { type: Object, required: false },
|
|
11
12
|
defaultExpanded: { type: Boolean, required: false, default: true },
|
|
13
|
+
color: { type: null, required: false },
|
|
12
14
|
isNested: { type: Boolean, required: false, default: false },
|
|
13
15
|
ui: { type: Object, required: false }
|
|
14
16
|
});
|
|
@@ -37,18 +39,19 @@ function iconFor(node, index) {
|
|
|
37
39
|
return isExpanded(index) ? icons.value.folderOpen : icons.value.folder;
|
|
38
40
|
}
|
|
39
41
|
const theme = useComponentTheme("fileTree", fileTreeTheme);
|
|
40
|
-
const
|
|
42
|
+
const effectiveColor = computed(() => resolveRegisteredColorRole(props.color ?? "primary", "primary"));
|
|
43
|
+
const ui = computed(() => theme.value({ isNested: props.isNested, color: effectiveColor.value }));
|
|
41
44
|
const rootProps = useRootProps(() => props.isNested ? ui.value.list : ui.value.root, () => props.isNested ? props.ui?.list : props.ui?.root);
|
|
42
45
|
const itemProps = computed(() => resolveSlot(ui.value.item, props.ui?.item));
|
|
43
46
|
const iconProps = computed(() => resolveSlot(ui.value.icon, props.ui?.icon));
|
|
44
47
|
const labelProps = computed(() => resolveSlot(ui.value.label, props.ui?.label));
|
|
45
48
|
function rowProps(node) {
|
|
46
|
-
return resolveSlot(theme.value({ selected: props.selected === node }).row, props.ui?.row);
|
|
49
|
+
return resolveSlot(theme.value({ isNested: props.isNested, selected: props.selected === node, color: effectiveColor.value }).row, props.ui?.row);
|
|
47
50
|
}
|
|
48
51
|
</script>
|
|
49
52
|
|
|
50
53
|
<template>
|
|
51
|
-
<ul v-bind="rootProps">
|
|
54
|
+
<ul :data-selaras-color="effectiveColor" v-bind="rootProps">
|
|
52
55
|
<li v-for="(node, index) in items" :key="node.name" v-bind="itemProps">
|
|
53
56
|
<button type="button" v-bind="rowProps(node)" @click="node.children ? toggle(index) : selectFile(node)">
|
|
54
57
|
<Icon :name="iconFor(node, index)" v-bind="iconProps" />
|
|
@@ -59,6 +62,7 @@ function rowProps(node) {
|
|
|
59
62
|
:items="node.children"
|
|
60
63
|
is-nested
|
|
61
64
|
:selected="selected"
|
|
65
|
+
:color="color"
|
|
62
66
|
:default-expanded="defaultExpanded"
|
|
63
67
|
:ui="props.ui"
|
|
64
68
|
@update:selected="emit('update:selected', $event)"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FileTreeThemeSlots } from '../theme/file-tree.js';
|
|
2
|
+
import type { ColorRole } from '../utils/color-registry.js';
|
|
2
3
|
import type { UiProp } from '../utils/ui.js';
|
|
3
4
|
export interface FileTreeNode {
|
|
4
5
|
name: string;
|
|
@@ -12,6 +13,8 @@ export interface FileTreeProps {
|
|
|
12
13
|
selected?: FileTreeNode;
|
|
13
14
|
/** Whether a directory starts expanded. @default true */
|
|
14
15
|
defaultExpanded?: boolean;
|
|
16
|
+
/** The selected-file accent. @default 'primary' */
|
|
17
|
+
color?: ColorRole;
|
|
15
18
|
/** Internal - true for a recursive call rendering a directory's children, skipping the outer box. */
|
|
16
19
|
isNested?: boolean;
|
|
17
20
|
ui?: UiProp<FileTreeThemeSlots>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { VariantProps } from 'tailwind-variants';
|
|
2
2
|
import type { FileUploadThemeSlots } from '../theme/file-upload.js';
|
|
3
|
+
import type { ColorRole } from '../utils/color-registry.js';
|
|
3
4
|
import type { UiProp } from '../utils/ui.js';
|
|
4
5
|
import { fileUploadTheme } from '../theme/file-upload.js';
|
|
5
6
|
type FileUploadVariants = VariantProps<typeof fileUploadTheme>;
|
|
@@ -20,7 +21,7 @@ export interface FileUploadProps {
|
|
|
20
21
|
disabled?: boolean;
|
|
21
22
|
invalid?: boolean;
|
|
22
23
|
size?: FileUploadVariants['size'];
|
|
23
|
-
color?:
|
|
24
|
+
color?: ColorRole;
|
|
24
25
|
name?: string;
|
|
25
26
|
required?: boolean;
|
|
26
27
|
ui?: UiProp<FileUploadThemeSlots>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, ref, watch } from "vue";
|
|
2
|
+
import { computed, getCurrentInstance, mergeProps, onMounted, onUnmounted, ref, watch } from "vue";
|
|
3
3
|
import { useFormField } from "../composables/use-form-field";
|
|
4
4
|
import { useIcons } from "../composables/use-icons";
|
|
5
5
|
import { useLocale } from "../composables/use-locale";
|
|
6
6
|
import { useMessages } from "../composables/use-messages";
|
|
7
7
|
import { fileUploadTheme } from "../theme/file-upload";
|
|
8
8
|
import { formatBytes } from "../utils/format-bytes";
|
|
9
|
-
import {
|
|
9
|
+
import { resolveRegisteredColorRole } from "../utils/registered-colors";
|
|
10
|
+
import { resolveSlot, useComponentTheme, useFallthroughAttrs, useRootProps } from "../utils/ui";
|
|
10
11
|
import Button from "./Button.vue";
|
|
11
12
|
import Icon from "./Icon.vue";
|
|
12
13
|
defineOptions({ inheritAttrs: false });
|
|
@@ -28,6 +29,8 @@ const props = defineProps({
|
|
|
28
29
|
});
|
|
29
30
|
const emit = defineEmits(["update:modelValue", "error"]);
|
|
30
31
|
defineSlots();
|
|
32
|
+
const instance = getCurrentInstance();
|
|
33
|
+
const isControlled = () => Object.hasOwn(instance.vnode.props ?? {}, "modelValue") || Object.hasOwn(instance.vnode.props ?? {}, "model-value");
|
|
31
34
|
const field = useFormField();
|
|
32
35
|
const fileUploadId = computed(() => props.id ?? field?.id);
|
|
33
36
|
const fileUploadInvalid = computed(() => props.invalid || (field?.invalid.value ?? false));
|
|
@@ -38,12 +41,35 @@ const messages = useMessages();
|
|
|
38
41
|
const effectiveLocale = useLocale();
|
|
39
42
|
const internalFiles = ref(props.modelValue ?? []);
|
|
40
43
|
watch(() => props.modelValue, (value) => {
|
|
41
|
-
if (
|
|
42
|
-
internalFiles.value = value;
|
|
44
|
+
if (isControlled())
|
|
45
|
+
internalFiles.value = value ?? [];
|
|
43
46
|
});
|
|
47
|
+
function updateFiles(next) {
|
|
48
|
+
if (!isControlled())
|
|
49
|
+
internalFiles.value = next;
|
|
50
|
+
emit("update:modelValue", next);
|
|
51
|
+
}
|
|
44
52
|
const isDragging = ref(false);
|
|
45
53
|
const dropzoneEl = ref();
|
|
46
54
|
const inputEl = ref();
|
|
55
|
+
function syncNativeFiles() {
|
|
56
|
+
if (!inputEl.value || typeof DataTransfer === "undefined")
|
|
57
|
+
return;
|
|
58
|
+
const transfer = new DataTransfer();
|
|
59
|
+
internalFiles.value.forEach((file) => transfer.items.add(file));
|
|
60
|
+
inputEl.value.files = transfer.files;
|
|
61
|
+
}
|
|
62
|
+
watch(internalFiles, syncNativeFiles, { deep: true, flush: "post" });
|
|
63
|
+
let ownerForm = null;
|
|
64
|
+
onMounted(() => {
|
|
65
|
+
syncNativeFiles();
|
|
66
|
+
ownerForm = inputEl.value?.form ?? null;
|
|
67
|
+
ownerForm?.addEventListener("reset", onFormReset);
|
|
68
|
+
});
|
|
69
|
+
onUnmounted(() => {
|
|
70
|
+
ownerForm?.removeEventListener("reset", onFormReset);
|
|
71
|
+
internalFiles.value.forEach(revokePreview);
|
|
72
|
+
});
|
|
47
73
|
const previewUrls = /* @__PURE__ */ new WeakMap();
|
|
48
74
|
function previewUrlFor(file) {
|
|
49
75
|
if (!props.preview || !file.type.startsWith("image/"))
|
|
@@ -95,8 +121,7 @@ function processFiles(fileList) {
|
|
|
95
121
|
}
|
|
96
122
|
if (accepted.length) {
|
|
97
123
|
const next = props.multiple ? [...internalFiles.value, ...accepted] : accepted.slice(0, 1);
|
|
98
|
-
|
|
99
|
-
emit("update:modelValue", next);
|
|
124
|
+
updateFiles(next);
|
|
100
125
|
}
|
|
101
126
|
if (errors.length)
|
|
102
127
|
emit("error", errors);
|
|
@@ -109,7 +134,15 @@ function onInputChange(event) {
|
|
|
109
134
|
const target = event.target;
|
|
110
135
|
if (target.files?.length)
|
|
111
136
|
processFiles(target.files);
|
|
112
|
-
|
|
137
|
+
syncNativeFiles();
|
|
138
|
+
}
|
|
139
|
+
function onFormReset(event) {
|
|
140
|
+
queueMicrotask(() => {
|
|
141
|
+
if (event.defaultPrevented)
|
|
142
|
+
return;
|
|
143
|
+
updateFiles([]);
|
|
144
|
+
syncNativeFiles();
|
|
145
|
+
});
|
|
113
146
|
}
|
|
114
147
|
function onDragEnter(event) {
|
|
115
148
|
event.preventDefault();
|
|
@@ -131,25 +164,32 @@ function onDrop(event) {
|
|
|
131
164
|
processFiles(event.dataTransfer.files);
|
|
132
165
|
}
|
|
133
166
|
function removeFile(index) {
|
|
134
|
-
const file = internalFiles.value[index];
|
|
135
|
-
if (file)
|
|
136
|
-
revokePreview(file);
|
|
137
167
|
const next = internalFiles.value.filter((_, i) => i !== index);
|
|
138
|
-
|
|
139
|
-
emit("update:modelValue", next);
|
|
168
|
+
updateFiles(next);
|
|
140
169
|
}
|
|
170
|
+
watch(internalFiles, (files, previous) => {
|
|
171
|
+
previous.forEach((file) => {
|
|
172
|
+
if (!files.includes(file))
|
|
173
|
+
revokePreview(file);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
141
176
|
const theme = useComponentTheme("fileUpload", fileUploadTheme);
|
|
177
|
+
const effectiveColor = computed(() => resolveRegisteredColorRole(props.color ?? "primary", "primary"));
|
|
142
178
|
const ui = computed(() => theme.value({
|
|
143
179
|
size: effectiveSize.value,
|
|
144
|
-
color:
|
|
180
|
+
color: effectiveColor.value,
|
|
145
181
|
invalid: fileUploadInvalid.value
|
|
146
182
|
}));
|
|
147
|
-
|
|
183
|
+
function isNativeFileInputAttr(key) {
|
|
184
|
+
return ["capture", "form", "webkitdirectory"].includes(key) || /^on(?:BeforeInput|Change|CompositionEnd|CompositionStart|CompositionUpdate|Focus|Input|KeyDown|KeyUp|Paste|Select|Blur)$/.test(key);
|
|
185
|
+
}
|
|
186
|
+
const rootProps = useRootProps(() => ui.value.root, () => props.ui?.root, { exclude: isNativeFileInputAttr });
|
|
187
|
+
const nativeFileInputAttrs = useFallthroughAttrs(isNativeFileInputAttr);
|
|
148
188
|
const dropzoneProps = computed(() => resolveSlot(ui.value.dropzone, props.ui?.dropzone));
|
|
149
189
|
const iconProps = computed(() => resolveSlot(ui.value.icon, props.ui?.icon));
|
|
150
190
|
const labelProps = computed(() => resolveSlot(ui.value.label, props.ui?.label));
|
|
151
191
|
const descriptionProps = computed(() => resolveSlot(ui.value.description, props.ui?.description));
|
|
152
|
-
const inputProps = computed(() => resolveSlot(ui.value.input, props.ui?.input));
|
|
192
|
+
const inputProps = computed(() => mergeProps(resolveSlot(ui.value.input, props.ui?.input), nativeFileInputAttrs.value));
|
|
153
193
|
const fileListProps = computed(() => resolveSlot(ui.value.fileList, props.ui?.fileList));
|
|
154
194
|
const fileProps = computed(() => resolveSlot(ui.value.file, props.ui?.file));
|
|
155
195
|
const fileThumbnailProps = computed(() => resolveSlot(ui.value.fileThumbnail, props.ui?.fileThumbnail));
|
|
@@ -162,12 +202,15 @@ const removeButtonSize = computed(() => ({ sm: "sm", md: "sm", lg: "md" })[effec
|
|
|
162
202
|
</script>
|
|
163
203
|
|
|
164
204
|
<template>
|
|
165
|
-
<div v-bind="rootProps">
|
|
205
|
+
<div :data-selaras-color="fileUploadInvalid ? 'danger' : effectiveColor" v-bind="rootProps">
|
|
166
206
|
<button
|
|
167
207
|
ref="dropzoneEl"
|
|
168
208
|
type="button"
|
|
169
209
|
:disabled="disabled"
|
|
170
210
|
:data-dragging="isDragging ? '' : void 0"
|
|
211
|
+
:aria-labelledby="field?.labelId"
|
|
212
|
+
:aria-describedby="describedBy"
|
|
213
|
+
:aria-invalid="fileUploadInvalid || void 0"
|
|
171
214
|
v-bind="dropzoneProps"
|
|
172
215
|
@click="openDialog"
|
|
173
216
|
@dragenter="onDragEnter"
|
|
@@ -184,23 +227,23 @@ const removeButtonSize = computed(() => ({ sm: "sm", md: "sm", lg: "md" })[effec
|
|
|
184
227
|
<template v-if="maxSize">{{ messages.upToSize(formatBytes(maxSize, effectiveLocale)) }}</template>
|
|
185
228
|
</span>
|
|
186
229
|
</slot>
|
|
187
|
-
<input
|
|
188
|
-
:id="fileUploadId"
|
|
189
|
-
ref="inputEl"
|
|
190
|
-
type="file"
|
|
191
|
-
:accept="accept"
|
|
192
|
-
:multiple="multiple"
|
|
193
|
-
:disabled="disabled"
|
|
194
|
-
:name="name ?? field?.name"
|
|
195
|
-
:required="required"
|
|
196
|
-
:aria-invalid="fileUploadInvalid || void 0"
|
|
197
|
-
:aria-describedby="describedBy"
|
|
198
|
-
tabindex="-1"
|
|
199
|
-
v-bind="inputProps"
|
|
200
|
-
@click.stop
|
|
201
|
-
@change="onInputChange"
|
|
202
|
-
>
|
|
203
230
|
</button>
|
|
231
|
+
<input
|
|
232
|
+
:id="fileUploadId"
|
|
233
|
+
ref="inputEl"
|
|
234
|
+
type="file"
|
|
235
|
+
:accept="accept"
|
|
236
|
+
:multiple="multiple"
|
|
237
|
+
:disabled="disabled"
|
|
238
|
+
:name="name ?? field?.name"
|
|
239
|
+
:required="required"
|
|
240
|
+
:aria-invalid="fileUploadInvalid || void 0"
|
|
241
|
+
:aria-describedby="describedBy"
|
|
242
|
+
tabindex="-1"
|
|
243
|
+
v-bind="inputProps"
|
|
244
|
+
@focus="dropzoneEl?.focus()"
|
|
245
|
+
@change="onInputChange"
|
|
246
|
+
>
|
|
204
247
|
<ul v-if="internalFiles.length" v-bind="fileListProps">
|
|
205
248
|
<li v-for="(file, index) in internalFiles" :key="index" v-bind="fileProps">
|
|
206
249
|
<slot name="file" :file="file" :index="index" :remove="() => removeFile(index)">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { VariantProps } from 'tailwind-variants';
|
|
2
2
|
import type { FileUploadThemeSlots } from '../theme/file-upload.js';
|
|
3
|
+
import type { ColorRole } from '../utils/color-registry.js';
|
|
3
4
|
import type { UiProp } from '../utils/ui.js';
|
|
4
5
|
import { fileUploadTheme } from '../theme/file-upload.js';
|
|
5
6
|
type FileUploadVariants = VariantProps<typeof fileUploadTheme>;
|
|
@@ -20,7 +21,7 @@ export interface FileUploadProps {
|
|
|
20
21
|
disabled?: boolean;
|
|
21
22
|
invalid?: boolean;
|
|
22
23
|
size?: FileUploadVariants['size'];
|
|
23
|
-
color?:
|
|
24
|
+
color?: ColorRole;
|
|
24
25
|
name?: string;
|
|
25
26
|
required?: boolean;
|
|
26
27
|
ui?: UiProp<FileUploadThemeSlots>;
|
|
@@ -4,6 +4,8 @@ import type { UiProp } from '../utils/ui.js';
|
|
|
4
4
|
import { formFieldTheme } from '../theme/form-field.js';
|
|
5
5
|
type FormFieldVariants = VariantProps<typeof formFieldTheme>;
|
|
6
6
|
export interface FormFieldProps {
|
|
7
|
+
/** Stable ID for the underlying control and label relationship. Defaults to Vue's SSR-stable useId(). */
|
|
8
|
+
id?: string;
|
|
7
9
|
label?: string;
|
|
8
10
|
name?: string;
|
|
9
11
|
/** A second, muted line under the label, before the control - for context the user should read before reaching it (e.g. "We'll use this to send your receipt"). Distinct from `hint`, which sits below the control instead. */
|
|
@@ -5,6 +5,7 @@ import { formFieldTheme } from "../theme/form-field";
|
|
|
5
5
|
import { resolveSlot, useComponentTheme, useRootProps } from "../utils/ui";
|
|
6
6
|
defineOptions({ inheritAttrs: false });
|
|
7
7
|
const props = defineProps({
|
|
8
|
+
id: { type: String, required: false },
|
|
8
9
|
label: { type: String, required: false },
|
|
9
10
|
name: { type: String, required: false },
|
|
10
11
|
description: { type: String, required: false },
|
|
@@ -15,18 +16,20 @@ const props = defineProps({
|
|
|
15
16
|
orientation: { type: null, required: false, default: "vertical" },
|
|
16
17
|
ui: { type: Object, required: false }
|
|
17
18
|
});
|
|
18
|
-
const id = useId();
|
|
19
|
+
const id = props.id ?? useId();
|
|
19
20
|
const invalid = computed(() => !!props.error);
|
|
20
21
|
const errorMessage = computed(() => typeof props.error === "string" ? props.error : void 0);
|
|
21
22
|
const describedBy = computed(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const ids = [
|
|
24
|
+
props.description ? `${id}-description` : void 0,
|
|
25
|
+
props.hint ? `${id}-hint` : void 0,
|
|
26
|
+
invalid.value && errorMessage.value ? `${id}-error` : void 0
|
|
27
|
+
].filter(Boolean);
|
|
28
|
+
return ids.length ? ids.join(" ") : void 0;
|
|
27
29
|
});
|
|
28
30
|
provideFormField({
|
|
29
31
|
id,
|
|
32
|
+
labelId: props.label ? `${id}-label` : void 0,
|
|
30
33
|
name: props.name,
|
|
31
34
|
size: props.size,
|
|
32
35
|
invalid,
|
|
@@ -49,10 +52,10 @@ const errorProps = computed(() => resolveSlot(ui.value.error, props.ui?.error));
|
|
|
49
52
|
<div v-bind="rootProps">
|
|
50
53
|
<div v-bind="bodyProps">
|
|
51
54
|
<div v-bind="headerProps">
|
|
52
|
-
<label v-if="label" :for="id" v-bind="labelProps">
|
|
55
|
+
<label v-if="label" :id="`${id}-label`" :for="id" v-bind="labelProps">
|
|
53
56
|
{{ label }}<span v-if="required" v-bind="requiredProps">*</span>
|
|
54
57
|
</label>
|
|
55
|
-
<p v-if="description" v-bind="descriptionProps">
|
|
58
|
+
<p v-if="description" :id="`${id}-description`" v-bind="descriptionProps">
|
|
56
59
|
<slot name="description">
|
|
57
60
|
{{ description }}
|
|
58
61
|
</slot>
|
|
@@ -65,7 +68,7 @@ const errorProps = computed(() => resolveSlot(ui.value.error, props.ui?.error));
|
|
|
65
68
|
<p v-if="invalid && errorMessage" :id="`${id}-error`" role="alert" v-bind="errorProps">
|
|
66
69
|
{{ errorMessage }}
|
|
67
70
|
</p>
|
|
68
|
-
<p v-
|
|
71
|
+
<p v-if="hint" :id="`${id}-hint`" v-bind="hintProps">
|
|
69
72
|
{{ hint }}
|
|
70
73
|
</p>
|
|
71
74
|
</div>
|
|
@@ -4,6 +4,8 @@ import type { UiProp } from '../utils/ui.js';
|
|
|
4
4
|
import { formFieldTheme } from '../theme/form-field.js';
|
|
5
5
|
type FormFieldVariants = VariantProps<typeof formFieldTheme>;
|
|
6
6
|
export interface FormFieldProps {
|
|
7
|
+
/** Stable ID for the underlying control and label relationship. Defaults to Vue's SSR-stable useId(). */
|
|
8
|
+
id?: string;
|
|
7
9
|
label?: string;
|
|
8
10
|
name?: string;
|
|
9
11
|
/** A second, muted line under the label, before the control - for context the user should read before reaching it (e.g. "We'll use this to send your receipt"). Distinct from `hint`, which sits below the control instead. */
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { VariantProps } from 'tailwind-variants';
|
|
2
1
|
import type { IconThemeSlots } from '../theme/icon.js';
|
|
2
|
+
import type { ColorRole } from '../utils/color-registry.js';
|
|
3
3
|
import type { UiProp } from '../utils/ui.js';
|
|
4
|
-
import { iconTheme } from '../theme/icon.js';
|
|
5
|
-
type IconVariants = VariantProps<typeof iconTheme>;
|
|
6
4
|
export interface IconProps {
|
|
7
5
|
/** Any name Nuxt Icon resolves, e.g. `hugeicons:star` (or any other registered set, like `lucide:star`). */
|
|
8
6
|
name: string;
|
|
9
|
-
color?:
|
|
7
|
+
color?: ColorRole;
|
|
10
8
|
ui?: UiProp<IconThemeSlots>;
|
|
11
9
|
}
|
|
12
10
|
declare const __VLS_export: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|