@nuxt/ui 2.18.4 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -2
- package/cli/commands/init.mjs +83 -0
- package/cli/index.mjs +15 -0
- package/cli/node_modules/.ignored/citty/LICENSE +36 -0
- package/cli/node_modules/.ignored/citty/README.md +134 -0
- package/cli/node_modules/.ignored/citty/dist/index.cjs +475 -0
- package/cli/node_modules/.ignored/citty/dist/index.d.cts +80 -0
- package/cli/node_modules/.ignored/citty/dist/index.d.mts +80 -0
- package/cli/node_modules/.ignored/citty/dist/index.d.ts +80 -0
- package/cli/node_modules/.ignored/citty/dist/index.mjs +463 -0
- package/cli/node_modules/.ignored/citty/package.json +49 -0
- package/cli/node_modules/.ignored/consola/LICENSE +47 -0
- package/cli/node_modules/.ignored/consola/README.md +318 -0
- package/cli/node_modules/.ignored/consola/core.d.ts +1 -0
- package/cli/node_modules/.ignored/consola/dist/basic.cjs +32 -0
- package/cli/node_modules/.ignored/consola/dist/basic.d.ts +9 -0
- package/cli/node_modules/.ignored/consola/dist/basic.mjs +24 -0
- package/cli/node_modules/.ignored/consola/dist/browser.cjs +80 -0
- package/cli/node_modules/.ignored/consola/dist/browser.d.ts +7 -0
- package/cli/node_modules/.ignored/consola/dist/browser.mjs +72 -0
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +436 -0
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +429 -0
- package/cli/node_modules/.ignored/consola/dist/core.cjs +415 -0
- package/cli/node_modules/.ignored/consola/dist/core.d.ts +124 -0
- package/cli/node_modules/.ignored/consola/dist/core.mjs +410 -0
- package/cli/node_modules/.ignored/consola/dist/index.cjs +21 -0
- package/cli/node_modules/.ignored/consola/dist/index.d.ts +9 -0
- package/cli/node_modules/.ignored/consola/dist/index.mjs +8 -0
- package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +62 -0
- package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +636 -0
- package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +645 -0
- package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +65 -0
- package/cli/node_modules/.ignored/consola/dist/utils.cjs +308 -0
- package/cli/node_modules/.ignored/consola/dist/utils.d.ts +169 -0
- package/cli/node_modules/.ignored/consola/dist/utils.mjs +284 -0
- package/cli/node_modules/.ignored/consola/lib/index.cjs +9 -0
- package/cli/node_modules/.ignored/consola/package.json +101 -0
- package/cli/node_modules/.ignored/consola/utils.d.ts +1 -0
- package/cli/node_modules/.ignored/pathe/LICENSE +44 -0
- package/cli/node_modules/.ignored/pathe/README.md +69 -0
- package/cli/node_modules/.ignored/pathe/dist/index.cjs +23 -0
- package/cli/node_modules/.ignored/pathe/dist/index.d.cts +36 -0
- package/cli/node_modules/.ignored/pathe/dist/index.d.mts +36 -0
- package/cli/node_modules/.ignored/pathe/dist/index.d.ts +36 -0
- package/cli/node_modules/.ignored/pathe/dist/index.mjs +1 -0
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +238 -0
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +221 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.cjs +58 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +5 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +5 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +5 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.mjs +54 -0
- package/cli/node_modules/.ignored/pathe/package.json +48 -0
- package/cli/node_modules/.ignored/pathe/utils.d.ts +1 -0
- package/cli/node_modules/.ignored/scule/LICENSE +21 -0
- package/cli/node_modules/.ignored/scule/README.md +149 -0
- package/cli/node_modules/.ignored/scule/dist/index.cjs +92 -0
- package/cli/node_modules/.ignored/scule/dist/index.d.cts +57 -0
- package/cli/node_modules/.ignored/scule/dist/index.d.mts +57 -0
- package/cli/node_modules/.ignored/scule/dist/index.d.ts +57 -0
- package/cli/node_modules/.ignored/scule/dist/index.mjs +80 -0
- package/cli/node_modules/.ignored/scule/package.json +43 -0
- package/cli/node_modules/.package-lock.json +33 -0
- package/cli/package.json +13 -0
- package/cli/templates.mjs +171 -0
- package/cli/utils.mjs +17 -0
- package/dist/module.d.mts +10 -26
- package/dist/module.d.ts +10 -26
- package/dist/module.json +4 -4
- package/dist/module.mjs +2574 -154
- package/dist/runtime/components/Accordion.vue +110 -0
- package/dist/runtime/components/Alert.vue +130 -0
- package/dist/runtime/components/App.vue +42 -0
- package/dist/runtime/components/Avatar.vue +69 -0
- package/dist/runtime/components/AvatarGroup.vue +98 -0
- package/dist/runtime/components/Badge.vue +46 -0
- package/dist/runtime/components/Breadcrumb.vue +98 -0
- package/dist/runtime/components/Button.vue +82 -0
- package/dist/runtime/components/ButtonGroup.vue +53 -0
- package/dist/runtime/components/Card.vue +52 -0
- package/dist/runtime/components/Checkbox.vue +128 -0
- package/dist/runtime/components/Chip.vue +76 -0
- package/dist/runtime/components/Collapsible.vue +54 -0
- package/dist/runtime/components/CommandPalette.vue +303 -0
- package/dist/runtime/components/Container.vue +36 -0
- package/dist/runtime/components/ContextMenu.vue +103 -0
- package/dist/runtime/components/ContextMenuContent.vue +122 -0
- package/dist/runtime/components/Drawer.vue +115 -0
- package/dist/runtime/components/DropdownMenu.vue +115 -0
- package/dist/runtime/components/DropdownMenuContent.vue +129 -0
- package/dist/runtime/components/Form.vue +227 -0
- package/dist/runtime/components/FormField.vue +107 -0
- package/dist/runtime/components/Icon.vue +26 -0
- package/dist/runtime/components/Input.vue +180 -0
- package/dist/runtime/components/InputMenu.vue +371 -0
- package/dist/runtime/components/Kbd.vue +49 -0
- package/dist/runtime/components/Link.vue +147 -0
- package/dist/runtime/components/LinkBase.vue +60 -0
- package/dist/runtime/components/Modal.vue +163 -0
- package/dist/runtime/components/ModalProvider.vue +12 -0
- package/dist/runtime/components/NavigationMenu.vue +195 -0
- package/dist/runtime/components/Pagination.vue +173 -0
- package/dist/runtime/components/Popover.vue +88 -0
- package/dist/runtime/components/Progress.vue +164 -0
- package/dist/runtime/components/RadioGroup.vue +159 -0
- package/dist/runtime/components/Select.vue +230 -0
- package/dist/runtime/components/SelectMenu.vue +306 -0
- package/dist/runtime/components/Separator.vue +82 -0
- package/dist/runtime/components/Skeleton.vue +31 -0
- package/dist/runtime/components/Slideover.vue +162 -0
- package/dist/runtime/components/SlideoverProvider.vue +12 -0
- package/dist/runtime/components/Slider.vue +113 -0
- package/dist/runtime/components/Switch.vue +124 -0
- package/dist/runtime/components/Tabs.vue +114 -0
- package/dist/runtime/components/Textarea.vue +189 -0
- package/dist/runtime/components/Toast.vue +161 -0
- package/dist/runtime/components/Toaster.vue +130 -0
- package/dist/runtime/components/Tooltip.vue +88 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +7 -5
- package/dist/runtime/composables/defineShortcuts.js +94 -65
- package/dist/runtime/composables/useAvatarGroup.d.ts +10 -0
- package/dist/runtime/composables/useAvatarGroup.js +10 -0
- package/dist/runtime/composables/useButtonGroup.d.ts +12 -17
- package/dist/runtime/composables/useButtonGroup.js +6 -56
- package/dist/runtime/composables/useComponentIcons.d.ts +26 -0
- package/dist/runtime/composables/useComponentIcons.js +26 -0
- package/dist/runtime/composables/useFormField.d.ts +34 -0
- package/dist/runtime/composables/useFormField.js +54 -0
- package/dist/runtime/composables/useKbd.d.ts +28 -0
- package/dist/runtime/composables/useKbd.js +46 -0
- package/dist/runtime/composables/useModal.d.ts +8 -4
- package/dist/runtime/composables/useModal.js +1 -0
- package/dist/runtime/composables/useSlideover.d.ts +9 -5
- package/dist/runtime/composables/useSlideover.js +3 -2
- package/dist/runtime/composables/useToast.d.ts +9 -17
- package/dist/runtime/composables/useToast.js +27 -13
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/plugins/colors.js +9 -17
- package/dist/runtime/plugins/{slideovers.js → slideover.js} +3 -3
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/component.d.ts +17 -14
- package/dist/runtime/types/component.js +0 -0
- package/dist/runtime/types/form.d.ts +62 -32
- package/dist/runtime/types/form.js +12 -0
- package/dist/runtime/types/index.d.ts +41 -30
- package/dist/runtime/types/index.js +42 -31
- package/dist/runtime/types/utils.d.ts +13 -32
- package/dist/runtime/types/utils.js +0 -0
- package/dist/runtime/utils/form.d.ts +15 -0
- package/dist/runtime/utils/form.js +66 -0
- package/dist/runtime/utils/fuse.d.ts +4 -0
- package/dist/runtime/utils/fuse.js +63 -0
- package/dist/runtime/utils/index.d.ts +4 -10
- package/dist/runtime/utils/index.js +40 -60
- package/dist/runtime/utils/link.d.ts +26 -71
- package/dist/runtime/utils/link.js +4 -124
- package/package.json +50 -49
- package/dist/runtime/components/data/Table.vue +0 -355
- package/dist/runtime/components/data/Table.vue.d.ts +0 -439
- package/dist/runtime/components/elements/Accordion.vue +0 -185
- package/dist/runtime/components/elements/Accordion.vue.d.ts +0 -223
- package/dist/runtime/components/elements/Alert.vue +0 -139
- package/dist/runtime/components/elements/Alert.vue.d.ts +0 -194
- package/dist/runtime/components/elements/Avatar.vue +0 -160
- package/dist/runtime/components/elements/Avatar.vue.d.ts +0 -255
- package/dist/runtime/components/elements/AvatarGroup.d.ts +0 -56
- package/dist/runtime/components/elements/AvatarGroup.js +0 -58
- package/dist/runtime/components/elements/Badge.vue +0 -75
- package/dist/runtime/components/elements/Badge.vue.d.ts +0 -109
- package/dist/runtime/components/elements/Button.vue +0 -193
- package/dist/runtime/components/elements/Button.vue.d.ts +0 -504
- package/dist/runtime/components/elements/ButtonGroup.d.ts +0 -153
- package/dist/runtime/components/elements/ButtonGroup.js +0 -51
- package/dist/runtime/components/elements/Carousel.vue +0 -165
- package/dist/runtime/components/elements/Carousel.vue.d.ts +0 -159
- package/dist/runtime/components/elements/Chip.vue +0 -85
- package/dist/runtime/components/elements/Chip.vue.d.ts +0 -162
- package/dist/runtime/components/elements/Dropdown.vue +0 -254
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +0 -254
- package/dist/runtime/components/elements/Icon.vue +0 -30
- package/dist/runtime/components/elements/Icon.vue.d.ts +0 -47
- package/dist/runtime/components/elements/Kbd.vue +0 -59
- package/dist/runtime/components/elements/Kbd.vue.d.ts +0 -86
- package/dist/runtime/components/elements/Link.vue +0 -95
- package/dist/runtime/components/elements/Link.vue.d.ts +0 -225
- package/dist/runtime/components/elements/Meter.vue +0 -170
- package/dist/runtime/components/elements/Meter.vue.d.ts +0 -279
- package/dist/runtime/components/elements/MeterGroup.d.ts +0 -135
- package/dist/runtime/components/elements/MeterGroup.js +0 -159
- package/dist/runtime/components/elements/Progress.vue +0 -203
- package/dist/runtime/components/elements/Progress.vue.d.ts +0 -280
- package/dist/runtime/components/forms/Checkbox.vue +0 -143
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +0 -179
- package/dist/runtime/components/forms/Form.vue +0 -219
- package/dist/runtime/components/forms/Form.vue.d.ts +0 -53
- package/dist/runtime/components/forms/FormGroup.vue +0 -128
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +0 -169
- package/dist/runtime/components/forms/Input.vue +0 -300
- package/dist/runtime/components/forms/Input.vue.d.ts +0 -482
- package/dist/runtime/components/forms/InputMenu.vue +0 -439
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +0 -700
- package/dist/runtime/components/forms/Radio.vue +0 -140
- package/dist/runtime/components/forms/Radio.vue.d.ts +0 -168
- package/dist/runtime/components/forms/RadioGroup.vue +0 -145
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +0 -176
- package/dist/runtime/components/forms/Range.vue +0 -173
- package/dist/runtime/components/forms/Range.vue.d.ts +0 -268
- package/dist/runtime/components/forms/Select.vue +0 -322
- package/dist/runtime/components/forms/Select.vue.d.ts +0 -471
- package/dist/runtime/components/forms/SelectMenu.vue +0 -546
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +0 -754
- package/dist/runtime/components/forms/Textarea.vue +0 -231
- package/dist/runtime/components/forms/Textarea.vue.d.ts +0 -436
- package/dist/runtime/components/forms/Toggle.vue +0 -171
- package/dist/runtime/components/forms/Toggle.vue.d.ts +0 -262
- package/dist/runtime/components/layout/Card.vue +0 -63
- package/dist/runtime/components/layout/Card.vue.d.ts +0 -89
- package/dist/runtime/components/layout/Container.vue +0 -48
- package/dist/runtime/components/layout/Container.vue.d.ts +0 -53
- package/dist/runtime/components/layout/Divider.vue +0 -108
- package/dist/runtime/components/layout/Divider.vue.d.ts +0 -198
- package/dist/runtime/components/layout/Skeleton.vue +0 -46
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +0 -53
- package/dist/runtime/components/navigation/Breadcrumb.vue +0 -82
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +0 -95
- package/dist/runtime/components/navigation/CommandPalette.vue +0 -345
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +0 -390
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +0 -152
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +0 -60
- package/dist/runtime/components/navigation/HorizontalNavigation.vue +0 -102
- package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +0 -99
- package/dist/runtime/components/navigation/Pagination.vue +0 -270
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +0 -260
- package/dist/runtime/components/navigation/Tabs.vue +0 -163
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +0 -165
- package/dist/runtime/components/navigation/VerticalNavigation.vue +0 -105
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +0 -113
- package/dist/runtime/components/overlays/ContextMenu.vue +0 -85
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +0 -126
- package/dist/runtime/components/overlays/Modal.vue +0 -122
- package/dist/runtime/components/overlays/Modal.vue.d.ts +0 -166
- package/dist/runtime/components/overlays/Modals.client.vue +0 -18
- package/dist/runtime/components/overlays/Notification.vue +0 -212
- package/dist/runtime/components/overlays/Notification.vue.d.ts +0 -235
- package/dist/runtime/components/overlays/Notifications.vue +0 -69
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +0 -66
- package/dist/runtime/components/overlays/Popover.vue +0 -213
- package/dist/runtime/components/overlays/Popover.vue.d.ts +0 -220
- package/dist/runtime/components/overlays/Slideover.vue +0 -152
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +0 -167
- package/dist/runtime/components/overlays/Slideovers.client.vue +0 -18
- package/dist/runtime/components/overlays/Tooltip.vue +0 -127
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +0 -165
- package/dist/runtime/composables/useCarouselScroll.d.ts +0 -2
- package/dist/runtime/composables/useCarouselScroll.js +0 -37
- package/dist/runtime/composables/useCopyToClipboard.d.ts +0 -10
- package/dist/runtime/composables/useCopyToClipboard.js +0 -26
- package/dist/runtime/composables/useFormGroup.d.ts +0 -18
- package/dist/runtime/composables/useFormGroup.js +0 -45
- package/dist/runtime/composables/usePopper.d.ts +0 -268
- package/dist/runtime/composables/usePopper.js +0 -94
- package/dist/runtime/composables/useShortcuts.d.ts +0 -12
- package/dist/runtime/composables/useShortcuts.js +0 -26
- package/dist/runtime/composables/useTimer.d.ts +0 -8
- package/dist/runtime/composables/useTimer.js +0 -51
- package/dist/runtime/composables/useUI.d.ts +0 -10
- package/dist/runtime/composables/useUI.js +0 -24
- package/dist/runtime/types/accordion.d.ts +0 -9
- package/dist/runtime/types/alert.d.ts +0 -12
- package/dist/runtime/types/avatar.d.ts +0 -17
- package/dist/runtime/types/badge.d.ts +0 -15
- package/dist/runtime/types/breadcrumb.d.ts +0 -10
- package/dist/runtime/types/button.d.ts +0 -31
- package/dist/runtime/types/chip.d.ts +0 -15
- package/dist/runtime/types/clipboard.d.ts +0 -3
- package/dist/runtime/types/command-palette.d.ts +0 -29
- package/dist/runtime/types/divider.d.ts +0 -3
- package/dist/runtime/types/dropdown.d.ts +0 -15
- package/dist/runtime/types/form-group.d.ts +0 -5
- package/dist/runtime/types/horizontal-navigation.d.ts +0 -13
- package/dist/runtime/types/input.d.ts +0 -8
- package/dist/runtime/types/kbd.d.ts +0 -5
- package/dist/runtime/types/link.d.ts +0 -12
- package/dist/runtime/types/meter.d.ts +0 -5
- package/dist/runtime/types/modal.d.ts +0 -18
- package/dist/runtime/types/notification.d.ts +0 -24
- package/dist/runtime/types/popper.d.ts +0 -17
- package/dist/runtime/types/progress.d.ts +0 -6
- package/dist/runtime/types/range.d.ts +0 -7
- package/dist/runtime/types/select.d.ts +0 -8
- package/dist/runtime/types/slideover.d.ts +0 -16
- package/dist/runtime/types/tabs.d.ts +0 -8
- package/dist/runtime/types/textarea.d.ts +0 -8
- package/dist/runtime/types/toggle.d.ts +0 -7
- package/dist/runtime/types/tooltip.d.ts +0 -7
- package/dist/runtime/types/vertical-navigation.d.ts +0 -13
- package/dist/runtime/ui.config/data/table.d.ts +0 -81
- package/dist/runtime/ui.config/data/table.js +0 -80
- package/dist/runtime/ui.config/elements/accordion.d.ts +0 -23
- package/dist/runtime/ui.config/elements/accordion.js +0 -22
- package/dist/runtime/ui.config/elements/alert.d.ts +0 -41
- package/dist/runtime/ui.config/elements/alert.js +0 -40
- package/dist/runtime/ui.config/elements/avatar.d.ts +0 -60
- package/dist/runtime/ui.config/elements/avatar.js +0 -59
- package/dist/runtime/ui.config/elements/avatarGroup.d.ts +0 -6
- package/dist/runtime/ui.config/elements/avatarGroup.js +0 -5
- package/dist/runtime/ui.config/elements/badge.d.ts +0 -34
- package/dist/runtime/ui.config/elements/badge.js +0 -33
- package/dist/runtime/ui.config/elements/button.d.ts +0 -81
- package/dist/runtime/ui.config/elements/button.js +0 -80
- package/dist/runtime/ui.config/elements/buttonGroup.d.ts +0 -101
- package/dist/runtime/ui.config/elements/buttonGroup.js +0 -19
- package/dist/runtime/ui.config/elements/carousel.d.ts +0 -27
- package/dist/runtime/ui.config/elements/carousel.js +0 -26
- package/dist/runtime/ui.config/elements/chip.d.ts +0 -35
- package/dist/runtime/ui.config/elements/chip.js +0 -34
- package/dist/runtime/ui.config/elements/dropdown.d.ts +0 -59
- package/dist/runtime/ui.config/elements/dropdown.js +0 -57
- package/dist/runtime/ui.config/elements/kbd.d.ts +0 -17
- package/dist/runtime/ui.config/elements/kbd.js +0 -16
- package/dist/runtime/ui.config/elements/meter.d.ts +0 -77
- package/dist/runtime/ui.config/elements/meter.js +0 -76
- package/dist/runtime/ui.config/elements/meterGroup.d.ts +0 -52
- package/dist/runtime/ui.config/elements/meterGroup.js +0 -24
- package/dist/runtime/ui.config/elements/progress.d.ts +0 -75
- package/dist/runtime/ui.config/elements/progress.js +0 -74
- package/dist/runtime/ui.config/forms/checkbox.d.ts +0 -19
- package/dist/runtime/ui.config/forms/checkbox.js +0 -18
- package/dist/runtime/ui.config/forms/formGroup.d.ts +0 -26
- package/dist/runtime/ui.config/forms/formGroup.js +0 -26
- package/dist/runtime/ui.config/forms/input.d.ts +0 -110
- package/dist/runtime/ui.config/forms/input.js +0 -109
- package/dist/runtime/ui.config/forms/inputMenu.d.ts +0 -64
- package/dist/runtime/ui.config/forms/inputMenu.js +0 -62
- package/dist/runtime/ui.config/forms/radio.d.ts +0 -18
- package/dist/runtime/ui.config/forms/radio.js +0 -17
- package/dist/runtime/ui.config/forms/radioGroup.d.ts +0 -9
- package/dist/runtime/ui.config/forms/radioGroup.js +0 -8
- package/dist/runtime/ui.config/forms/range.d.ts +0 -64
- package/dist/runtime/ui.config/forms/range.js +0 -63
- package/dist/runtime/ui.config/forms/select.d.ts +0 -111
- package/dist/runtime/ui.config/forms/select.js +0 -13
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +0 -70
- package/dist/runtime/ui.config/forms/selectMenu.js +0 -32
- package/dist/runtime/ui.config/forms/textarea.d.ts +0 -109
- package/dist/runtime/ui.config/forms/textarea.js +0 -10
- package/dist/runtime/ui.config/forms/toggle.d.ts +0 -63
- package/dist/runtime/ui.config/forms/toggle.js +0 -62
- package/dist/runtime/ui.config/index.d.ts +0 -43
- package/dist/runtime/ui.config/index.js +0 -43
- package/dist/runtime/ui.config/layout/card.d.ts +0 -24
- package/dist/runtime/ui.config/layout/card.js +0 -23
- package/dist/runtime/ui.config/layout/container.d.ts +0 -6
- package/dist/runtime/ui.config/layout/container.js +0 -5
- package/dist/runtime/ui.config/layout/divider.d.ts +0 -52
- package/dist/runtime/ui.config/layout/divider.js +0 -51
- package/dist/runtime/ui.config/layout/skeleton.d.ts +0 -6
- package/dist/runtime/ui.config/layout/skeleton.js +0 -5
- package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +0 -21
- package/dist/runtime/ui.config/navigation/breadcrumb.js +0 -20
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +0 -72
- package/dist/runtime/ui.config/navigation/commandPalette.js +0 -71
- package/dist/runtime/ui.config/navigation/horizontalNavigation.d.ts +0 -27
- package/dist/runtime/ui.config/navigation/horizontalNavigation.js +0 -26
- package/dist/runtime/ui.config/navigation/pagination.d.ts +0 -35
- package/dist/runtime/ui.config/navigation/pagination.js +0 -34
- package/dist/runtime/ui.config/navigation/tabs.d.ts +0 -35
- package/dist/runtime/ui.config/navigation/tabs.js +0 -34
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +0 -34
- package/dist/runtime/ui.config/navigation/verticalNavigation.js +0 -33
- package/dist/runtime/ui.config/overlays/contextMenu.d.ts +0 -31
- package/dist/runtime/ui.config/overlays/contextMenu.js +0 -25
- package/dist/runtime/ui.config/overlays/modal.d.ts +0 -36
- package/dist/runtime/ui.config/overlays/modal.js +0 -37
- package/dist/runtime/ui.config/overlays/notification.d.ts +0 -50
- package/dist/runtime/ui.config/overlays/notification.js +0 -50
- package/dist/runtime/ui.config/overlays/notifications.d.ts +0 -7
- package/dist/runtime/ui.config/overlays/notifications.js +0 -6
- package/dist/runtime/ui.config/overlays/popover.d.ts +0 -47
- package/dist/runtime/ui.config/overlays/popover.js +0 -41
- package/dist/runtime/ui.config/overlays/slideover.d.ts +0 -35
- package/dist/runtime/ui.config/overlays/slideover.js +0 -36
- package/dist/runtime/ui.config/overlays/tooltip.d.ts +0 -37
- package/dist/runtime/ui.config/overlays/tooltip.js +0 -34
- package/dist/runtime/ui.config/popper.d.ts +0 -8
- package/dist/runtime/ui.config/popper.js +0 -9
- package/dist/runtime/ui.css +0 -1
- package/dist/runtime/utils/colors.d.ts +0 -11
- package/dist/runtime/utils/colors.js +0 -307
- package/dist/runtime/utils/lodash.d.ts +0 -2
- package/dist/runtime/utils/lodash.js +0 -23
- package/dist/runtime/plugins/{modals.d.ts → modal.d.ts} +0 -0
- package/dist/runtime/plugins/{modals.js → modal.js} +1 -1
- /package/dist/runtime/plugins/{slideovers.d.ts → slideover.d.ts} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/button-group'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const buttonGroup = tv({ extend: tv(theme), ...(appConfig.ui?.buttonGroup) })
|
|
10
|
+
|
|
11
|
+
type ButtonGroupVariants = VariantProps<typeof buttonGroup>
|
|
12
|
+
|
|
13
|
+
export interface ButtonGroupProps {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @defaultValue 'div'
|
|
17
|
+
*/
|
|
18
|
+
as?: any
|
|
19
|
+
size?: ButtonGroupVariants['size']
|
|
20
|
+
/**
|
|
21
|
+
* The orientation the buttons are laid out.
|
|
22
|
+
* @defaultValue 'horizontal'
|
|
23
|
+
*/
|
|
24
|
+
orientation?: ButtonGroupVariants['orientation']
|
|
25
|
+
class?: any
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ButtonGroupSlots {
|
|
29
|
+
default(props?: {}): any
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import { provide, computed } from 'vue'
|
|
35
|
+
import { Primitive } from 'radix-vue'
|
|
36
|
+
import { buttonGroupInjectionKey } from '../composables/useButtonGroup'
|
|
37
|
+
|
|
38
|
+
const props = withDefaults(defineProps<ButtonGroupProps>(), {
|
|
39
|
+
orientation: 'horizontal'
|
|
40
|
+
})
|
|
41
|
+
defineSlots<ButtonGroupSlots>()
|
|
42
|
+
|
|
43
|
+
provide(buttonGroupInjectionKey, computed(() => ({
|
|
44
|
+
orientation: props.orientation,
|
|
45
|
+
size: props.size
|
|
46
|
+
})))
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<Primitive :as="as" :class="buttonGroup({ orientation })">
|
|
51
|
+
<slot />
|
|
52
|
+
</Primitive>
|
|
53
|
+
</template>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/card'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const card = tv({ extend: tv(theme), ...(appConfig.ui?.card || {}) })
|
|
10
|
+
|
|
11
|
+
export interface CardProps {
|
|
12
|
+
/**
|
|
13
|
+
* The element or component this component should render as.
|
|
14
|
+
* @defaultValue 'div'
|
|
15
|
+
*/
|
|
16
|
+
as?: any
|
|
17
|
+
class?: any
|
|
18
|
+
ui?: Partial<typeof card.slots>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CardSlots {
|
|
22
|
+
header(props?: {}): any
|
|
23
|
+
default(props?: {}): any
|
|
24
|
+
footer(props?: {}): any
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { Primitive } from 'radix-vue'
|
|
30
|
+
|
|
31
|
+
const props = defineProps<CardProps>()
|
|
32
|
+
const slots = defineSlots<CardSlots>()
|
|
33
|
+
|
|
34
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
35
|
+
const ui = card()
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
40
|
+
<div v-if="!!slots.header" :class="ui.header({ class: props.ui?.header })">
|
|
41
|
+
<slot name="header" />
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div v-if="!!slots.default" :class="ui.body({ class: props.ui?.body })">
|
|
45
|
+
<slot />
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div v-if="!!slots.footer" :class="ui.footer({ class: props.ui?.footer })">
|
|
49
|
+
<slot name="footer" />
|
|
50
|
+
</div>
|
|
51
|
+
</Primitive>
|
|
52
|
+
</template>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { InputHTMLAttributes } from 'vue'
|
|
3
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
4
|
+
import type { CheckboxRootProps } from 'radix-vue'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/checkbox'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const checkbox = tv({ extend: tv(theme), ...(appConfig.ui?.checkbox || {}) })
|
|
12
|
+
|
|
13
|
+
type CheckboxVariants = VariantProps<typeof checkbox>
|
|
14
|
+
|
|
15
|
+
export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id'> {
|
|
16
|
+
label?: string
|
|
17
|
+
description?: string
|
|
18
|
+
color?: CheckboxVariants['color']
|
|
19
|
+
size?: CheckboxVariants['size']
|
|
20
|
+
/**
|
|
21
|
+
* The icon displayed when checked.
|
|
22
|
+
* @defaultValue appConfig.ui.icons.check
|
|
23
|
+
*/
|
|
24
|
+
icon?: string
|
|
25
|
+
indeterminate?: InputHTMLAttributes['indeterminate']
|
|
26
|
+
/**
|
|
27
|
+
* The icon displayed when the checkbox is indeterminate.
|
|
28
|
+
* @defaultValue appConfig.ui.icons.minus
|
|
29
|
+
*/
|
|
30
|
+
indeterminateIcon?: string
|
|
31
|
+
/** The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. */
|
|
32
|
+
defaultValue?: boolean
|
|
33
|
+
class?: any
|
|
34
|
+
ui?: Partial<typeof checkbox.slots>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CheckboxEmits {
|
|
38
|
+
(e: 'update:modelValue', payload: boolean): void
|
|
39
|
+
(e: 'change', payload: Event): void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface CheckboxSlots {
|
|
43
|
+
label(props: { label?: string }): any
|
|
44
|
+
description(props: { description?: string }): any
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { computed, useId } from 'vue'
|
|
50
|
+
import { CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from 'radix-vue'
|
|
51
|
+
import { reactivePick } from '@vueuse/core'
|
|
52
|
+
import { useAppConfig } from '#imports'
|
|
53
|
+
import { useFormField } from '../composables/useFormField'
|
|
54
|
+
|
|
55
|
+
const props = defineProps<CheckboxProps>()
|
|
56
|
+
const slots = defineSlots<CheckboxSlots>()
|
|
57
|
+
const emits = defineEmits<CheckboxEmits>()
|
|
58
|
+
|
|
59
|
+
const modelValue = defineModel<boolean | undefined>({ default: undefined })
|
|
60
|
+
|
|
61
|
+
const rootProps = useForwardProps(reactivePick(props, 'required', 'value'))
|
|
62
|
+
|
|
63
|
+
const appConfig = useAppConfig()
|
|
64
|
+
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<CheckboxProps>(props)
|
|
65
|
+
const id = _id.value ?? useId()
|
|
66
|
+
|
|
67
|
+
const indeterminate = computed(() => (modelValue.value === undefined && props.indeterminate))
|
|
68
|
+
|
|
69
|
+
const checked = computed({
|
|
70
|
+
get() {
|
|
71
|
+
return indeterminate.value ? 'indeterminate' : modelValue.value
|
|
72
|
+
},
|
|
73
|
+
set(value) {
|
|
74
|
+
modelValue.value = value === 'indeterminate' ? undefined : value
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const ui = computed(() => checkbox({
|
|
79
|
+
size: size.value,
|
|
80
|
+
color: color.value,
|
|
81
|
+
required: props.required,
|
|
82
|
+
disabled: disabled.value,
|
|
83
|
+
checked: (modelValue.value ?? props.defaultValue) || indeterminate.value
|
|
84
|
+
}))
|
|
85
|
+
|
|
86
|
+
function onUpdate(value: any) {
|
|
87
|
+
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
88
|
+
const event = new Event('change', { target: { value } })
|
|
89
|
+
emits('change', event)
|
|
90
|
+
emitFormChange()
|
|
91
|
+
emitFormInput()
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<template>
|
|
96
|
+
<div :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
97
|
+
<div :class="ui.container({ class: props.ui?.container })">
|
|
98
|
+
<CheckboxRoot
|
|
99
|
+
:id="id"
|
|
100
|
+
v-model:checked="checked"
|
|
101
|
+
:default-checked="defaultValue"
|
|
102
|
+
v-bind="rootProps"
|
|
103
|
+
:name="name"
|
|
104
|
+
:disabled="disabled"
|
|
105
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
106
|
+
@update:checked="onUpdate"
|
|
107
|
+
>
|
|
108
|
+
<CheckboxIndicator as-child>
|
|
109
|
+
<UIcon v-if="indeterminate" :name="indeterminateIcon || appConfig.ui.icons.minus" :class="ui.icon({ class: props.ui?.icon })" />
|
|
110
|
+
<UIcon v-else :name="icon || appConfig.ui.icons.check" :class="ui.icon({ class: props.ui?.icon })" />
|
|
111
|
+
</CheckboxIndicator>
|
|
112
|
+
</CheckboxRoot>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div v-if="(label || !!slots.label) || (description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
116
|
+
<Label v-if="label || !!slots.label" :for="id" :class="ui.label({ class: props.ui?.label })">
|
|
117
|
+
<slot name="label" :label="label">
|
|
118
|
+
{{ label }}
|
|
119
|
+
</slot>
|
|
120
|
+
</Label>
|
|
121
|
+
<p v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
|
|
122
|
+
<slot name="description" :description="description">
|
|
123
|
+
{{ description }}
|
|
124
|
+
</slot>
|
|
125
|
+
</p>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/chip'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { chip: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const chip = tv({ extend: tv(theme), ...(appConfig.ui?.chip || {}) })
|
|
10
|
+
|
|
11
|
+
type ChipVariants = VariantProps<typeof chip>
|
|
12
|
+
|
|
13
|
+
export interface ChipProps {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @defaultValue 'div'
|
|
17
|
+
*/
|
|
18
|
+
as?: any
|
|
19
|
+
/** Display some text inside the chip. */
|
|
20
|
+
text?: string | number
|
|
21
|
+
color?: ChipVariants['color']
|
|
22
|
+
size?: ChipVariants['size']
|
|
23
|
+
position?: ChipVariants['position']
|
|
24
|
+
/** When `true`, translate the chip at the edge for non rounded elements. */
|
|
25
|
+
inset?: boolean
|
|
26
|
+
/** When `true`, render the chip relatively to the parent. */
|
|
27
|
+
standalone?: boolean
|
|
28
|
+
class?: any
|
|
29
|
+
ui?: Partial<typeof chip.slots>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ChipEmits {
|
|
33
|
+
(e: 'update:show', payload: boolean): void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ChipSlots {
|
|
37
|
+
default(props?: {}): any
|
|
38
|
+
content(props?: {}): any
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import { computed } from 'vue'
|
|
44
|
+
import { Primitive } from 'radix-vue'
|
|
45
|
+
import { useAvatarGroup } from '../composables/useAvatarGroup'
|
|
46
|
+
|
|
47
|
+
const props = withDefaults(defineProps<ChipProps>(), {
|
|
48
|
+
inset: false,
|
|
49
|
+
standalone: false
|
|
50
|
+
})
|
|
51
|
+
defineSlots<ChipSlots>()
|
|
52
|
+
|
|
53
|
+
const show = defineModel<boolean>('show', { default: true })
|
|
54
|
+
|
|
55
|
+
const { size } = useAvatarGroup(props)
|
|
56
|
+
|
|
57
|
+
const ui = computed(() => chip({
|
|
58
|
+
color: props.color,
|
|
59
|
+
size: size.value,
|
|
60
|
+
position: props.position,
|
|
61
|
+
inset: props.inset,
|
|
62
|
+
standalone: props.standalone
|
|
63
|
+
}))
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<template>
|
|
67
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
68
|
+
<slot />
|
|
69
|
+
|
|
70
|
+
<span v-if="show" :class="ui.base({ class: props.ui?.base })">
|
|
71
|
+
<slot name="content">
|
|
72
|
+
{{ text }}
|
|
73
|
+
</slot>
|
|
74
|
+
</span>
|
|
75
|
+
</Primitive>
|
|
76
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { CollapsibleRootProps, CollapsibleRootEmits } from 'radix-vue'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/collapsible'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { collapsible: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const collapsible = tv({ extend: tv(theme), ...(appConfig.ui?.collapsible || {}) })
|
|
11
|
+
|
|
12
|
+
export interface CollapsibleProps extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled'> {
|
|
13
|
+
/**
|
|
14
|
+
* The element or component this component should render as.
|
|
15
|
+
* @defaultValue 'div'
|
|
16
|
+
*/
|
|
17
|
+
as?: any
|
|
18
|
+
class?: any
|
|
19
|
+
ui?: Partial<typeof collapsible.slots>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CollapsibleEmits extends CollapsibleRootEmits {}
|
|
23
|
+
|
|
24
|
+
export interface CollapsibleSlots {
|
|
25
|
+
default(props: { open: boolean }): any
|
|
26
|
+
content(props?: {}): any
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, useForwardPropsEmits } from 'radix-vue'
|
|
32
|
+
import { reactivePick } from '@vueuse/core'
|
|
33
|
+
|
|
34
|
+
const props = defineProps<CollapsibleProps>()
|
|
35
|
+
const emits = defineEmits<CollapsibleEmits>()
|
|
36
|
+
const slots = defineSlots<CollapsibleSlots>()
|
|
37
|
+
|
|
38
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'disabled'), emits)
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
41
|
+
const ui = collapsible()
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<CollapsibleRoot v-slot="{ open }" v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
46
|
+
<CollapsibleTrigger v-if="!!slots.default" as-child>
|
|
47
|
+
<slot :open="open" />
|
|
48
|
+
</CollapsibleTrigger>
|
|
49
|
+
|
|
50
|
+
<CollapsibleContent :class="ui.content({ class: props.ui?.content })">
|
|
51
|
+
<slot name="content" />
|
|
52
|
+
</CollapsibleContent>
|
|
53
|
+
</CollapsibleRoot>
|
|
54
|
+
</template>
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxItemProps } from 'radix-vue'
|
|
4
|
+
import type { FuseResult } from 'fuse.js'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
|
|
7
|
+
import _appConfig from '#build/app.config'
|
|
8
|
+
import theme from '#build/ui/command-palette'
|
|
9
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
10
|
+
import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '../types'
|
|
11
|
+
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
12
|
+
|
|
13
|
+
const appConfig = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } }
|
|
14
|
+
|
|
15
|
+
const commandPalette = tv({ extend: tv(theme), ...(appConfig.ui?.commandPalette || {}) })
|
|
16
|
+
|
|
17
|
+
export interface CommandPaletteItem extends Pick<ComboboxItemProps, 'disabled'> {
|
|
18
|
+
prefix?: string
|
|
19
|
+
label?: string
|
|
20
|
+
suffix?: string
|
|
21
|
+
icon?: string
|
|
22
|
+
avatar?: AvatarProps
|
|
23
|
+
chip?: ChipProps
|
|
24
|
+
kbds?: KbdProps['value'][] | KbdProps[]
|
|
25
|
+
slot?: string
|
|
26
|
+
select?(e?: Event): void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CommandPaletteGroup<T> {
|
|
30
|
+
id: string
|
|
31
|
+
label?: string
|
|
32
|
+
slot?: string
|
|
33
|
+
items?: T[]
|
|
34
|
+
/**
|
|
35
|
+
* Wether to filter group items with [useFuse](https://vueuse.org/integrations/useFuse).
|
|
36
|
+
* When `false`, items will not be filtered which is useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
37
|
+
* @defaultValue true
|
|
38
|
+
*/
|
|
39
|
+
filter?: boolean
|
|
40
|
+
/** Filter group items after the search happened. */
|
|
41
|
+
postFilter?: (searchTerm: string, items: T[]) => T[]
|
|
42
|
+
/** The icon displayed when an item is highlighted. */
|
|
43
|
+
highlightedIcon?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface CommandPaletteProps<G, T> extends Pick<ComboboxRootProps, 'multiple' | 'disabled' | 'modelValue' | 'defaultValue' | 'selectedValue' | 'resetSearchTermOnBlur'>, Pick<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
|
|
47
|
+
/**
|
|
48
|
+
* The element or component this component should render as.
|
|
49
|
+
* @defaultValue 'div'
|
|
50
|
+
*/
|
|
51
|
+
as?: any
|
|
52
|
+
/**
|
|
53
|
+
* The icon displayed in the input.
|
|
54
|
+
* @defaultValue appConfig.ui.icons.search
|
|
55
|
+
*/
|
|
56
|
+
icon?: string
|
|
57
|
+
/**
|
|
58
|
+
* The icon displayed when an item is selected.
|
|
59
|
+
* @defaultValue appConfig.ui.icons.check
|
|
60
|
+
*/
|
|
61
|
+
selectedIcon?: string
|
|
62
|
+
/**
|
|
63
|
+
* The placeholder text for the input.
|
|
64
|
+
* @defaultValue 'Type a command or search...'
|
|
65
|
+
*/
|
|
66
|
+
placeholder?: InputProps['placeholder']
|
|
67
|
+
/**
|
|
68
|
+
* Display a close button in the input (useful when inside a `UModal`).
|
|
69
|
+
* `{ size: 'md', color: 'gray', variant: 'ghost' }`{lang="ts-type"}
|
|
70
|
+
* @defaultValue false
|
|
71
|
+
*/
|
|
72
|
+
close?: ButtonProps | boolean
|
|
73
|
+
/**
|
|
74
|
+
* The icon displayed in the close button.
|
|
75
|
+
* @defaultValue appConfig.ui.icons.close
|
|
76
|
+
*/
|
|
77
|
+
closeIcon?: string
|
|
78
|
+
groups?: G[]
|
|
79
|
+
/**
|
|
80
|
+
* Options for [useFuse](https://vueuse.org/integrations/useFuse).
|
|
81
|
+
* @defaultValue { ignoreLocation: true, threshold: 0.1, keys: ['label', 'suffix'], resultLimit: 12, matchAllWhenSearchEmpty: true }
|
|
82
|
+
*/
|
|
83
|
+
fuse?: UseFuseOptions<T>
|
|
84
|
+
class?: any
|
|
85
|
+
ui?: PartialString<typeof commandPalette.slots>
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type CommandPaletteEmits<T> = ComboboxRootEmits<T>
|
|
89
|
+
|
|
90
|
+
type SlotProps<T> = (props: { item: T, index: number }) => any
|
|
91
|
+
|
|
92
|
+
export type CommandPaletteSlots<G extends { slot?: string }, T extends { slot?: string }> = {
|
|
93
|
+
'empty'(props: { searchTerm?: string }): any
|
|
94
|
+
'close'(props: { ui: any }): any
|
|
95
|
+
'item': SlotProps<T>
|
|
96
|
+
'item-leading': SlotProps<T>
|
|
97
|
+
'item-label': SlotProps<T>
|
|
98
|
+
'item-trailing': SlotProps<T>
|
|
99
|
+
} & DynamicSlots<G, SlotProps<T>> & DynamicSlots<T, SlotProps<T>>
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<script setup lang="ts" generic="G extends CommandPaletteGroup<T>, T extends CommandPaletteItem">
|
|
103
|
+
import { computed } from 'vue'
|
|
104
|
+
import { ComboboxRoot, ComboboxInput, ComboboxPortal, ComboboxContent, ComboboxEmpty, ComboboxViewport, ComboboxGroup, ComboboxLabel, ComboboxItem, ComboboxItemIndicator, useForwardProps, useForwardPropsEmits } from 'radix-vue'
|
|
105
|
+
import { defu } from 'defu'
|
|
106
|
+
import { reactivePick } from '@vueuse/core'
|
|
107
|
+
import { useFuse } from '@vueuse/integrations/useFuse'
|
|
108
|
+
import { useAppConfig } from '#imports'
|
|
109
|
+
import UIcon from './Icon.vue'
|
|
110
|
+
import UAvatar from './Avatar.vue'
|
|
111
|
+
import UChip from './Chip.vue'
|
|
112
|
+
import UKbd from './Kbd.vue'
|
|
113
|
+
import UInput from './Input.vue'
|
|
114
|
+
import { omit } from '../utils'
|
|
115
|
+
import { highlight } from '../utils/fuse'
|
|
116
|
+
|
|
117
|
+
const props = withDefaults(defineProps<CommandPaletteProps<G, T>>(), {
|
|
118
|
+
modelValue: '',
|
|
119
|
+
placeholder: 'Type a command or search...'
|
|
120
|
+
})
|
|
121
|
+
const emits = defineEmits<CommandPaletteEmits<T>>()
|
|
122
|
+
const slots = defineSlots<CommandPaletteSlots<G, T>>()
|
|
123
|
+
|
|
124
|
+
const searchTerm = defineModel<string>('searchTerm', { default: '' })
|
|
125
|
+
|
|
126
|
+
const appConfig = useAppConfig()
|
|
127
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'disabled', 'multiple', 'modelValue', 'defaultValue', 'selectedValue', 'resetSearchTermOnBlur'), emits)
|
|
128
|
+
const inputProps = useForwardProps(reactivePick(props, 'loading', 'loadingIcon', 'placeholder'))
|
|
129
|
+
|
|
130
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
131
|
+
const ui = commandPalette()
|
|
132
|
+
|
|
133
|
+
const fuse = computed(() => defu({}, props.fuse, {
|
|
134
|
+
fuseOptions: {
|
|
135
|
+
ignoreLocation: true,
|
|
136
|
+
threshold: 0.1,
|
|
137
|
+
keys: ['label', 'suffix']
|
|
138
|
+
},
|
|
139
|
+
resultLimit: 12,
|
|
140
|
+
matchAllWhenSearchEmpty: true
|
|
141
|
+
}))
|
|
142
|
+
|
|
143
|
+
const items = computed(() => props.groups?.filter((group) => {
|
|
144
|
+
if (!group.id) {
|
|
145
|
+
console.warn(`[@nuxt/ui] CommandPalette group is missing an \`id\` property`)
|
|
146
|
+
return false
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (group.filter === false) {
|
|
150
|
+
return false
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return true
|
|
154
|
+
}).flatMap(group => group.items?.map(item => ({ ...item, group: group.id })) || []) || [])
|
|
155
|
+
|
|
156
|
+
const { results: fuseResults } = useFuse<typeof items.value[number]>(searchTerm, items, fuse)
|
|
157
|
+
|
|
158
|
+
function getGroupWithItems(group: G, items: (T & { matches?: FuseResult<T>['matches'] })[]) {
|
|
159
|
+
if (group?.postFilter && typeof group.postFilter === 'function') {
|
|
160
|
+
items = group.postFilter(searchTerm.value, items)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
...group,
|
|
165
|
+
items: items.slice(0, fuse.value.resultLimit).map((item) => {
|
|
166
|
+
return {
|
|
167
|
+
...item,
|
|
168
|
+
labelHtml: highlight<T>(item, searchTerm.value, 'label'),
|
|
169
|
+
suffixHtml: highlight<T>(item, searchTerm.value, undefined, ['label'])
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const groups = computed(() => {
|
|
176
|
+
const groupsById = fuseResults.value.reduce((acc, result) => {
|
|
177
|
+
const { item, matches } = result
|
|
178
|
+
if (!item.group) {
|
|
179
|
+
return acc
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
acc[item.group] ||= []
|
|
183
|
+
acc[item.group].push({ ...item, matches })
|
|
184
|
+
|
|
185
|
+
return acc
|
|
186
|
+
}, {} as Record<string, (T & { matches?: FuseResult<T>['matches'] })[]>)
|
|
187
|
+
|
|
188
|
+
const fuseGroups = Object.entries(groupsById).map(([id, items]) => {
|
|
189
|
+
const group = props.groups?.find(group => group.id === id)
|
|
190
|
+
if (!group) {
|
|
191
|
+
return
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return getGroupWithItems(group, items)
|
|
195
|
+
}).filter(group => !!group)
|
|
196
|
+
|
|
197
|
+
const nonFuseGroups = props.groups?.filter(group => group.filter === false && group.items?.length).map((group) => {
|
|
198
|
+
return getGroupWithItems(group, group.items || [])
|
|
199
|
+
}) || []
|
|
200
|
+
|
|
201
|
+
return [
|
|
202
|
+
...fuseGroups,
|
|
203
|
+
...nonFuseGroups
|
|
204
|
+
]
|
|
205
|
+
})
|
|
206
|
+
</script>
|
|
207
|
+
|
|
208
|
+
<!-- eslint-disable vue/no-v-html -->
|
|
209
|
+
<template>
|
|
210
|
+
<ComboboxRoot v-bind="rootProps" v-model:search-term="searchTerm" open :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
211
|
+
<ComboboxInput as-child>
|
|
212
|
+
<UInput
|
|
213
|
+
variant="none"
|
|
214
|
+
autofocus
|
|
215
|
+
size="lg"
|
|
216
|
+
v-bind="inputProps"
|
|
217
|
+
:icon="icon || appConfig.ui.icons.search"
|
|
218
|
+
:class="ui.input({ class: props.ui?.input })"
|
|
219
|
+
>
|
|
220
|
+
<template v-if="close || !!slots.close" #trailing>
|
|
221
|
+
<slot name="close" :ui="ui">
|
|
222
|
+
<UButton
|
|
223
|
+
v-if="close"
|
|
224
|
+
:icon="closeIcon || appConfig.ui.icons.close"
|
|
225
|
+
size="md"
|
|
226
|
+
color="gray"
|
|
227
|
+
variant="ghost"
|
|
228
|
+
aria-label="Close"
|
|
229
|
+
v-bind="typeof close === 'object' ? close : undefined"
|
|
230
|
+
:class="ui.close({ class: props.ui?.close })"
|
|
231
|
+
@click="emits('update:open', false)"
|
|
232
|
+
/>
|
|
233
|
+
</slot>
|
|
234
|
+
</template>
|
|
235
|
+
</UInput>
|
|
236
|
+
</ComboboxInput>
|
|
237
|
+
|
|
238
|
+
<ComboboxPortal disabled>
|
|
239
|
+
<ComboboxContent :class="ui.content({ class: props.ui?.content })" :dismissable="false">
|
|
240
|
+
<ComboboxEmpty :class="ui.empty({ class: props.ui?.empty })">
|
|
241
|
+
<slot name="empty" :search-term="searchTerm">
|
|
242
|
+
{{ searchTerm ? `No results for ${searchTerm}` : 'No results' }}
|
|
243
|
+
</slot>
|
|
244
|
+
</ComboboxEmpty>
|
|
245
|
+
|
|
246
|
+
<ComboboxViewport :class="ui.viewport({ class: props.ui?.viewport })">
|
|
247
|
+
<ComboboxGroup v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: props.ui?.group })">
|
|
248
|
+
<ComboboxLabel v-if="group.label" :class="ui.label({ class: props.ui?.label })">
|
|
249
|
+
{{ group.label }}
|
|
250
|
+
</ComboboxLabel>
|
|
251
|
+
|
|
252
|
+
<ComboboxItem
|
|
253
|
+
v-for="(item, index) in group.items"
|
|
254
|
+
:key="`group-${groupIndex}-${index}`"
|
|
255
|
+
:value="omit(item, ['matches' as any, 'group' as any, 'select', 'labelHtml', 'suffixHtml'])"
|
|
256
|
+
:disabled="item.disabled"
|
|
257
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
258
|
+
@select="item.select"
|
|
259
|
+
>
|
|
260
|
+
<slot :name="item.slot || group.slot || 'item'" :item="item" :index="index">
|
|
261
|
+
<slot :name="item.slot ? `${item.slot}-leading` : group.slot ? `${group.slot}-leading` : `item-leading`" :item="item" :index="index">
|
|
262
|
+
<UAvatar v-if="item.avatar" :size="((props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar })" />
|
|
263
|
+
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon })" />
|
|
264
|
+
<UChip
|
|
265
|
+
v-else-if="item.chip"
|
|
266
|
+
:size="((props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
|
267
|
+
inset
|
|
268
|
+
standalone
|
|
269
|
+
v-bind="item.chip"
|
|
270
|
+
:class="ui.itemLeadingChip({ class: props.ui?.itemLeadingChip })"
|
|
271
|
+
/>
|
|
272
|
+
</slot>
|
|
273
|
+
|
|
274
|
+
<span v-if="item.label || !!slots[item.slot ? `${item.slot}-label` : group.slot ? `${group.slot}-label` : `item-label`]" :class="ui.itemLabel({ class: props.ui?.itemLabel })">
|
|
275
|
+
<slot :name="item.slot ? `${item.slot}-label` : group.slot ? `${group.slot}-label` : `item-label`" :item="item" :index="index">
|
|
276
|
+
<span v-if="item.prefix" :class="ui.itemLabelPrefix({ class: props.ui?.itemLabelPrefix })">{{ item.prefix }}</span>
|
|
277
|
+
|
|
278
|
+
<span :class="ui.itemLabelBase({ class: props.ui?.itemLabelBase })" v-html="item.labelHtml || item.label" />
|
|
279
|
+
|
|
280
|
+
<span :class="ui.itemLabelSuffix({ class: props.ui?.itemLabelSuffix })" v-html="item.suffixHtml || item.suffix" />
|
|
281
|
+
</slot>
|
|
282
|
+
</span>
|
|
283
|
+
|
|
284
|
+
<span :class="ui.itemTrailing({ class: props.ui?.itemTrailing })">
|
|
285
|
+
<slot :name="item.slot ? `${item.slot}-trailing` : group.slot ? `${group.slot}-trailing` : `item-trailing`" :item="item" :index="index">
|
|
286
|
+
<span v-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: props.ui?.itemTrailingKbds })">
|
|
287
|
+
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((props.ui?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
288
|
+
</span>
|
|
289
|
+
<UIcon v-else-if="group.highlightedIcon" :name="group.highlightedIcon" :class="ui.itemTrailingHighlightedIcon({ class: props.ui?.itemTrailingHighlightedIcon })" />
|
|
290
|
+
</slot>
|
|
291
|
+
|
|
292
|
+
<ComboboxItemIndicator as-child>
|
|
293
|
+
<UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: props.ui?.itemTrailingIcon })" />
|
|
294
|
+
</ComboboxItemIndicator>
|
|
295
|
+
</span>
|
|
296
|
+
</slot>
|
|
297
|
+
</ComboboxItem>
|
|
298
|
+
</ComboboxGroup>
|
|
299
|
+
</ComboboxViewport>
|
|
300
|
+
</ComboboxContent>
|
|
301
|
+
</ComboboxPortal>
|
|
302
|
+
</ComboboxRoot>
|
|
303
|
+
</template>
|