@nuxt/ui 3.0.0-alpha.7 → 3.0.0-alpha.9
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/.nuxt/ui/accordion.ts +20 -0
- package/.nuxt/ui/alert.ts +242 -0
- package/.nuxt/ui/avatar-group.ts +40 -0
- package/.nuxt/ui/avatar.ts +42 -0
- package/.nuxt/ui/badge.ts +194 -0
- package/.nuxt/ui/breadcrumb.ts +45 -0
- package/.nuxt/ui/button-group.ts +16 -0
- package/.nuxt/ui/button.ts +344 -0
- package/.nuxt/ui/card.ts +8 -0
- package/.nuxt/ui/carousel.ts +41 -0
- package/.nuxt/ui/checkbox.ts +105 -0
- package/.nuxt/ui/chip.ts +67 -0
- package/.nuxt/ui/collapsible.ts +6 -0
- package/.nuxt/ui/command-palette.ts +40 -0
- package/.nuxt/ui/container.ts +3 -0
- package/.nuxt/ui/context-menu.ts +198 -0
- package/.nuxt/ui/drawer.ts +55 -0
- package/.nuxt/ui/dropdown-menu.ts +199 -0
- package/.nuxt/ui/form-field.ts +40 -0
- package/.nuxt/ui/form.ts +3 -0
- package/.nuxt/ui/index.ts +45 -0
- package/.nuxt/ui/input-menu.ts +411 -0
- package/.nuxt/ui/input-number.ts +204 -0
- package/.nuxt/ui/input.ts +263 -0
- package/.nuxt/ui/kbd.ts +19 -0
- package/.nuxt/ui/link.ts +15 -0
- package/.nuxt/ui/modal.ts +28 -0
- package/.nuxt/ui/navigation-menu.ts +390 -0
- package/.nuxt/ui/pagination.ts +8 -0
- package/.nuxt/ui/pin-input.ts +145 -0
- package/.nuxt/ui/popover.ts +6 -0
- package/.nuxt/ui/progress.ts +258 -0
- package/.nuxt/ui/radio-group.ts +112 -0
- package/.nuxt/ui/select-menu.ts +316 -0
- package/.nuxt/ui/select.ts +314 -0
- package/.nuxt/ui/separator.ts +143 -0
- package/.nuxt/ui/skeleton.ts +3 -0
- package/.nuxt/ui/slideover.ts +63 -0
- package/.nuxt/ui/slider.ts +148 -0
- package/.nuxt/ui/switch.ts +113 -0
- package/.nuxt/ui/table.ts +129 -0
- package/.nuxt/ui/tabs.ts +227 -0
- package/.nuxt/ui/textarea.ts +263 -0
- package/.nuxt/ui/toast.ts +66 -0
- package/.nuxt/ui/toaster.ts +75 -0
- package/.nuxt/ui/tooltip.ts +9 -0
- package/README.md +52 -12
- package/cli/commands/{init.mjs → make/component.mjs} +4 -4
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +2 -2
- package/cli/templates.mjs +47 -2
- package/cli/utils.mjs +14 -0
- package/dist/chunks/component-meta.cjs +77249 -0
- package/dist/chunks/component-meta.mjs +77247 -0
- package/dist/client/devtools/200.html +1 -0
- package/dist/client/devtools/404.html +1 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
- package/dist/client/devtools/_nuxt/BDC8ywlR.js +1 -0
- package/dist/client/devtools/_nuxt/BT004Uxp.js +53 -0
- package/dist/client/devtools/_nuxt/C1H2Soz3.js +1 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/client/devtools/_nuxt/builds/meta/f98c13ea-d751-4b37-8ce3-94e99708745f.json +1 -0
- package/dist/client/devtools/_nuxt/entry.Bx6WJjrx.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.Cq4qshcf.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.ax1aM34m.css +1 -0
- package/dist/client/devtools/favicon.svg +1 -0
- package/dist/client/devtools/index.html +1 -0
- package/dist/devtools/runtime/DevtoolsRenderer.vue +53 -0
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +7 -0
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +8 -0
- package/dist/devtools/runtime/examples/CardExample.vue +13 -0
- package/dist/devtools/runtime/examples/CarouselExample.vue +13 -0
- package/dist/devtools/runtime/examples/ChipExample.vue +5 -0
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +8 -0
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +29 -0
- package/dist/devtools/runtime/examples/ContainerExample.vue +5 -0
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/DrawerExample.vue +8 -0
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/FormExample.vue +30 -0
- package/dist/devtools/runtime/examples/FormFieldExample.vue +5 -0
- package/dist/devtools/runtime/examples/LinkExample.vue +5 -0
- package/dist/devtools/runtime/examples/ModalExample.vue +8 -0
- package/dist/devtools/runtime/examples/PopoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/SkeletonExample.vue +3 -0
- package/dist/devtools/runtime/examples/SlideoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/ToasterExample.vue +11 -0
- package/dist/devtools/runtime/examples/TooltipExample.vue +5 -0
- package/dist/module.cjs +223 -4
- package/dist/module.d.cts +54 -0
- package/dist/module.d.mts +10 -0
- package/dist/module.d.ts +10 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +158 -2763
- package/dist/runtime/components/Accordion.vue +32 -1
- package/dist/runtime/components/Alert.vue +8 -1
- package/dist/runtime/components/App.vue +19 -5
- package/dist/runtime/components/Avatar.vue +23 -5
- package/dist/runtime/components/AvatarGroup.vue +3 -0
- package/dist/runtime/components/Badge.vue +33 -3
- package/dist/runtime/components/Breadcrumb.vue +33 -4
- package/dist/runtime/components/Button.vue +6 -1
- package/dist/runtime/components/ButtonGroup.vue +4 -1
- package/dist/runtime/components/Card.vue +3 -0
- package/dist/runtime/components/Carousel.vue +17 -8
- package/dist/runtime/components/Checkbox.vue +4 -0
- package/dist/runtime/components/Chip.vue +9 -2
- package/dist/runtime/components/Collapsible.vue +3 -0
- package/dist/runtime/components/CommandPalette.vue +8 -4
- package/dist/runtime/components/Container.vue +3 -0
- package/dist/runtime/components/ContextMenu.vue +64 -3
- package/dist/runtime/components/ContextMenuContent.vue +10 -8
- package/dist/runtime/components/Drawer.vue +3 -0
- package/dist/runtime/components/DropdownMenu.vue +52 -3
- package/dist/runtime/components/DropdownMenuContent.vue +10 -8
- package/dist/runtime/components/Form.vue +21 -20
- package/dist/runtime/components/FormField.vue +10 -3
- package/dist/runtime/components/Input.vue +1 -0
- package/dist/runtime/components/InputMenu.vue +118 -31
- package/dist/runtime/components/InputNumber.vue +192 -0
- package/dist/runtime/components/Kbd.vue +2 -0
- package/dist/runtime/components/Link.vue +69 -6
- package/dist/runtime/components/Modal.vue +15 -3
- package/dist/runtime/components/NavigationMenu.vue +95 -46
- package/dist/runtime/components/Pagination.vue +17 -6
- package/dist/runtime/components/PinInput.vue +96 -0
- package/dist/runtime/components/Popover.vue +20 -1
- package/dist/runtime/components/Progress.vue +1 -1
- package/dist/runtime/components/RadioGroup.vue +4 -1
- package/dist/runtime/components/Select.vue +24 -13
- package/dist/runtime/components/SelectMenu.vue +130 -42
- package/dist/runtime/components/Separator.vue +1 -1
- package/dist/runtime/components/Skeleton.vue +3 -0
- package/dist/runtime/components/Slideover.vue +15 -3
- package/dist/runtime/components/Slider.vue +1 -1
- package/dist/runtime/components/Switch.vue +5 -1
- package/dist/runtime/components/Table.vue +27 -8
- package/dist/runtime/components/Tabs.vue +20 -1
- package/dist/runtime/components/Textarea.vue +1 -1
- package/dist/runtime/components/Toast.vue +8 -1
- package/dist/runtime/components/Toaster.vue +29 -14
- package/dist/runtime/components/Tooltip.vue +3 -0
- package/dist/runtime/composables/defineLocale.d.ts +9 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.js +0 -6
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
- package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
- package/dist/runtime/composables/useFormField.d.ts +4 -1
- package/dist/runtime/composables/useFormField.js +1 -1
- package/dist/runtime/composables/useKbd.d.ts +10 -3
- package/dist/runtime/composables/useKbd.js +14 -8
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +47 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +46 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +46 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +46 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +46 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +47 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +46 -0
- package/dist/runtime/locale/index.d.ts +12 -0
- package/dist/runtime/locale/index.js +12 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +46 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +46 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +46 -0
- package/dist/runtime/locale/zh_hans.d.ts +2 -0
- package/dist/runtime/locale/zh_hans.js +46 -0
- package/dist/runtime/locale/zh_hant.d.ts +2 -0
- package/dist/runtime/locale/zh_hant.js +46 -0
- package/dist/runtime/types/form.d.ts +7 -2
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/types/index.js +3 -0
- package/dist/runtime/types/locale.d.ts +48 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/utils.d.ts +7 -0
- package/dist/runtime/utils/form.d.ts +5 -9
- package/dist/runtime/utils/form.js +115 -50
- package/dist/runtime/utils/index.js +1 -1
- package/dist/runtime/utils/link.d.ts +2 -2
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Link.vue +195 -0
- package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
- package/dist/runtime/vue/plugins/color-mode.js +6 -0
- package/dist/runtime/vue/plugins/head.d.ts +4 -0
- package/dist/runtime/vue/plugins/head.js +6 -0
- package/dist/runtime/vue/stubs.d.ts +15 -0
- package/dist/runtime/vue/stubs.js +27 -0
- package/dist/shared/ui.BPnAe4QS.cjs +3030 -0
- package/dist/shared/ui.d52SSCwA.mjs +3023 -0
- package/dist/unplugin.cjs +192 -0
- package/dist/unplugin.d.cts +49 -0
- package/dist/unplugin.d.mts +49 -0
- package/dist/unplugin.d.ts +49 -0
- package/dist/unplugin.mjs +181 -0
- package/dist/vite.cjs +22 -0
- package/dist/vite.d.cts +13 -0
- package/dist/vite.d.mts +13 -0
- package/dist/vite.d.ts +13 -0
- package/dist/vite.mjs +20 -0
- package/package.json +78 -33
- package/vue-plugin.d.ts +5 -0
- package/cli/node_modules/.ignored/citty/LICENSE +0 -36
- package/cli/node_modules/.ignored/citty/README.md +0 -134
- package/cli/node_modules/.ignored/citty/dist/index.cjs +0 -475
- package/cli/node_modules/.ignored/citty/dist/index.d.cts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.mts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.ts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.mjs +0 -463
- package/cli/node_modules/.ignored/citty/package.json +0 -49
- package/cli/node_modules/.ignored/consola/LICENSE +0 -47
- package/cli/node_modules/.ignored/consola/README.md +0 -318
- package/cli/node_modules/.ignored/consola/core.d.ts +0 -1
- package/cli/node_modules/.ignored/consola/dist/basic.cjs +0 -32
- package/cli/node_modules/.ignored/consola/dist/basic.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/basic.mjs +0 -24
- package/cli/node_modules/.ignored/consola/dist/browser.cjs +0 -80
- package/cli/node_modules/.ignored/consola/dist/browser.d.ts +0 -7
- package/cli/node_modules/.ignored/consola/dist/browser.mjs +0 -72
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +0 -436
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +0 -429
- package/cli/node_modules/.ignored/consola/dist/core.cjs +0 -415
- package/cli/node_modules/.ignored/consola/dist/core.d.ts +0 -124
- package/cli/node_modules/.ignored/consola/dist/core.mjs +0 -410
- package/cli/node_modules/.ignored/consola/dist/index.cjs +0 -21
- package/cli/node_modules/.ignored/consola/dist/index.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/index.mjs +0 -8
- package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +0 -62
- package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +0 -636
- package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +0 -645
- package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +0 -65
- package/cli/node_modules/.ignored/consola/dist/utils.cjs +0 -308
- package/cli/node_modules/.ignored/consola/dist/utils.d.ts +0 -169
- package/cli/node_modules/.ignored/consola/dist/utils.mjs +0 -284
- package/cli/node_modules/.ignored/consola/lib/index.cjs +0 -9
- package/cli/node_modules/.ignored/consola/package.json +0 -101
- package/cli/node_modules/.ignored/consola/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/pathe/LICENSE +0 -44
- package/cli/node_modules/.ignored/pathe/README.md +0 -69
- package/cli/node_modules/.ignored/pathe/dist/index.cjs +0 -23
- package/cli/node_modules/.ignored/pathe/dist/index.d.cts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.mts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.ts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.mjs +0 -1
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +0 -238
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +0 -221
- package/cli/node_modules/.ignored/pathe/dist/utils.cjs +0 -58
- package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.mjs +0 -54
- package/cli/node_modules/.ignored/pathe/package.json +0 -48
- package/cli/node_modules/.ignored/pathe/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/scule/LICENSE +0 -21
- package/cli/node_modules/.ignored/scule/README.md +0 -149
- package/cli/node_modules/.ignored/scule/dist/index.cjs +0 -92
- package/cli/node_modules/.ignored/scule/dist/index.d.cts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.mts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.ts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.mjs +0 -80
- package/cli/node_modules/.ignored/scule/package.json +0 -43
- package/cli/node_modules/.package-lock.json +0 -33
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
<!-- eslint-disable vue/block-tag-newline -->
|
|
2
1
|
<script lang="ts">
|
|
3
2
|
import { tv } from 'tailwind-variants'
|
|
4
3
|
import type { ComboboxRootProps, ComboboxRootEmits } from 'radix-vue'
|
|
@@ -8,6 +7,7 @@ import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
|
|
|
8
7
|
import _appConfig from '#build/app.config'
|
|
9
8
|
import theme from '#build/ui/command-palette'
|
|
10
9
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
10
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
11
11
|
import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '../types'
|
|
12
12
|
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
13
13
|
|
|
@@ -35,7 +35,7 @@ export interface CommandPaletteGroup<T> {
|
|
|
35
35
|
slot?: string
|
|
36
36
|
items?: T[]
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Whether to filter group items with [useFuse](https://vueuse.org/integrations/useFuse).
|
|
39
39
|
* When `false`, items will not be filtered which is useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
40
40
|
* @defaultValue true
|
|
41
41
|
*/
|
|
@@ -114,6 +114,7 @@ export type CommandPaletteSlots<G extends { slot?: string }, T extends { slot?:
|
|
|
114
114
|
'item-trailing': SlotProps<T>
|
|
115
115
|
} & DynamicSlots<G, SlotProps<T>> & DynamicSlots<T, SlotProps<T>>
|
|
116
116
|
|
|
117
|
+
extendDevtoolsMeta({ example: 'CommandPaletteExample', ignoreProps: ['groups'] })
|
|
117
118
|
</script>
|
|
118
119
|
|
|
119
120
|
<script setup lang="ts" generic="G extends CommandPaletteGroup<T>, T extends CommandPaletteItem">
|
|
@@ -123,10 +124,12 @@ import { defu } from 'defu'
|
|
|
123
124
|
import { reactivePick } from '@vueuse/core'
|
|
124
125
|
import { useFuse } from '@vueuse/integrations/useFuse'
|
|
125
126
|
import { useAppConfig } from '#imports'
|
|
127
|
+
import { useLocale } from '../composables/useLocale'
|
|
126
128
|
import { omit, get } from '../utils'
|
|
127
129
|
import { highlight } from '../utils/fuse'
|
|
128
130
|
import UIcon from './Icon.vue'
|
|
129
131
|
import UAvatar from './Avatar.vue'
|
|
132
|
+
import UButton from './Button.vue'
|
|
130
133
|
import UChip from './Chip.vue'
|
|
131
134
|
import UKbd from './Kbd.vue'
|
|
132
135
|
import UInput from './Input.vue'
|
|
@@ -142,6 +145,7 @@ const slots = defineSlots<CommandPaletteSlots<G, T>>()
|
|
|
142
145
|
const searchTerm = defineModel<string>('searchTerm', { default: '' })
|
|
143
146
|
|
|
144
147
|
const appConfig = useAppConfig()
|
|
148
|
+
const { t } = useLocale()
|
|
145
149
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'disabled', 'multiple', 'modelValue', 'defaultValue', 'selectedValue', 'resetSearchTermOnBlur'), emits)
|
|
146
150
|
const inputProps = useForwardProps(reactivePick(props, 'loading', 'loadingIcon', 'placeholder'))
|
|
147
151
|
|
|
@@ -243,7 +247,7 @@ const groups = computed(() => {
|
|
|
243
247
|
size="md"
|
|
244
248
|
color="neutral"
|
|
245
249
|
variant="ghost"
|
|
246
|
-
aria-label="
|
|
250
|
+
:aria-label="t('commandPalette.close')"
|
|
247
251
|
v-bind="typeof close === 'object' ? close : undefined"
|
|
248
252
|
:class="ui.close({ class: props.ui?.close })"
|
|
249
253
|
@click="emits('update:open', false)"
|
|
@@ -257,7 +261,7 @@ const groups = computed(() => {
|
|
|
257
261
|
<ComboboxContent :class="ui.content({ class: props.ui?.content })" :dismissable="false">
|
|
258
262
|
<ComboboxEmpty :class="ui.empty({ class: props.ui?.empty })">
|
|
259
263
|
<slot name="empty" :search-term="searchTerm">
|
|
260
|
-
{{ searchTerm ?
|
|
264
|
+
{{ searchTerm ? t('commandPalette.noMatch', { searchTerm }) : t('commandPalette.noData') }}
|
|
261
265
|
</slot>
|
|
262
266
|
</ComboboxEmpty>
|
|
263
267
|
|
|
@@ -3,6 +3,7 @@ import { tv } from 'tailwind-variants'
|
|
|
3
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
4
|
import _appConfig from '#build/app.config'
|
|
5
5
|
import theme from '#build/ui/container'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
6
7
|
|
|
7
8
|
const appConfig = _appConfig as AppConfig & { ui: { container: Partial<typeof theme> } }
|
|
8
9
|
|
|
@@ -20,6 +21,8 @@ export interface ContainerProps {
|
|
|
20
21
|
export interface ContainerSlots {
|
|
21
22
|
default(props?: {}): any
|
|
22
23
|
}
|
|
24
|
+
|
|
25
|
+
extendDevtoolsMeta({ example: 'ContainerExample' })
|
|
23
26
|
</script>
|
|
24
27
|
|
|
25
28
|
<script setup lang="ts">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<!-- eslint-disable vue/block-tag-newline -->
|
|
2
1
|
<script lang="ts">
|
|
3
2
|
import { tv, type VariantProps } from 'tailwind-variants'
|
|
4
3
|
import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps } from 'radix-vue'
|
|
5
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
6
5
|
import _appConfig from '#build/app.config'
|
|
7
6
|
import theme from '#build/ui/context-menu'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
8
|
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
|
9
9
|
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
10
10
|
|
|
@@ -12,9 +12,12 @@ const appConfig = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof
|
|
|
12
12
|
|
|
13
13
|
const contextMenu = tv({ extend: tv(theme), ...(appConfig.ui?.contextMenu || {}) })
|
|
14
14
|
|
|
15
|
+
type ContextMenuVariants = VariantProps<typeof contextMenu>
|
|
16
|
+
|
|
15
17
|
export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
16
18
|
label?: string
|
|
17
19
|
icon?: string
|
|
20
|
+
color?: ContextMenuVariants['color']
|
|
18
21
|
avatar?: AvatarProps
|
|
19
22
|
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
20
23
|
kbds?: KbdProps['value'][] | KbdProps[]
|
|
@@ -34,8 +37,6 @@ export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custo
|
|
|
34
37
|
onUpdateChecked?(checked: boolean): void
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
type ContextMenuVariants = VariantProps<typeof contextMenu>
|
|
38
|
-
|
|
39
40
|
export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'> {
|
|
40
41
|
size?: ContextMenuVariants['size']
|
|
41
42
|
items?: T[] | T[][]
|
|
@@ -78,6 +79,66 @@ export type ContextMenuSlots<T extends { slot?: string }> = {
|
|
|
78
79
|
'item-trailing': SlotProps<T>
|
|
79
80
|
} & DynamicSlots<T, SlotProps<T>>
|
|
80
81
|
|
|
82
|
+
extendDevtoolsMeta({
|
|
83
|
+
example: 'ContextMenuExample',
|
|
84
|
+
ignoreProps: ['items'],
|
|
85
|
+
defaultProps: {
|
|
86
|
+
items: [
|
|
87
|
+
[{
|
|
88
|
+
label: 'My account',
|
|
89
|
+
avatar: {
|
|
90
|
+
src: 'https://avatars.githubusercontent.com/u/739984?v=4'
|
|
91
|
+
}
|
|
92
|
+
}],
|
|
93
|
+
[{
|
|
94
|
+
label: 'Appearance',
|
|
95
|
+
children: [{
|
|
96
|
+
label: 'System',
|
|
97
|
+
icon: 'i-lucide-monitor'
|
|
98
|
+
}, {
|
|
99
|
+
label: 'Light',
|
|
100
|
+
icon: 'i-lucide-sun'
|
|
101
|
+
}, {
|
|
102
|
+
label: 'Dark',
|
|
103
|
+
icon: 'i-lucide-moon'
|
|
104
|
+
}]
|
|
105
|
+
}],
|
|
106
|
+
[{
|
|
107
|
+
label: 'Show Sidebar',
|
|
108
|
+
kbds: ['meta', 'S']
|
|
109
|
+
}, {
|
|
110
|
+
label: 'Show Toolbar',
|
|
111
|
+
kbds: ['shift', 'meta', 'D']
|
|
112
|
+
}, {
|
|
113
|
+
label: 'Collapse Pinned Tabs',
|
|
114
|
+
disabled: true
|
|
115
|
+
}], [{
|
|
116
|
+
label: 'Refresh the Page'
|
|
117
|
+
}, {
|
|
118
|
+
label: 'Clear Cookies and Refresh'
|
|
119
|
+
}, {
|
|
120
|
+
label: 'Clear Cache and Refresh'
|
|
121
|
+
}, {
|
|
122
|
+
type: 'separator'
|
|
123
|
+
}, {
|
|
124
|
+
label: 'Developer',
|
|
125
|
+
children: [[{
|
|
126
|
+
label: 'View Source',
|
|
127
|
+
kbds: ['option', 'meta', 'U']
|
|
128
|
+
}, {
|
|
129
|
+
label: 'Developer Tools',
|
|
130
|
+
kbds: ['option', 'meta', 'I']
|
|
131
|
+
}], [{
|
|
132
|
+
label: 'Inspect Elements',
|
|
133
|
+
kbds: ['option', 'meta', 'C']
|
|
134
|
+
}], [{
|
|
135
|
+
label: 'JavaScript Console',
|
|
136
|
+
kbds: ['option', 'meta', 'J']
|
|
137
|
+
}]]
|
|
138
|
+
}]
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
})
|
|
81
142
|
</script>
|
|
82
143
|
|
|
83
144
|
<script setup lang="ts" generic="T extends ContextMenuItem">
|
|
@@ -34,6 +34,8 @@ import ULink from './Link.vue'
|
|
|
34
34
|
import UAvatar from './Avatar.vue'
|
|
35
35
|
import UIcon from './Icon.vue'
|
|
36
36
|
import UKbd from './Kbd.vue'
|
|
37
|
+
// eslint-disable-next-line import/no-self-import
|
|
38
|
+
import UContextMenuContent from './ContextMenuContent.vue'
|
|
37
39
|
|
|
38
40
|
const props = defineProps<ContextMenuContentProps<T>>()
|
|
39
41
|
const emits = defineEmits<ContextMenuContentEmits>()
|
|
@@ -52,8 +54,8 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
52
54
|
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
53
55
|
<slot :name="item.slot || 'item'" :item="(item as T)" :index="index">
|
|
54
56
|
<slot :name="item.slot ? `${item.slot}-leading`: 'item-leading'" :item="(item as T)" :active="active" :index="index">
|
|
55
|
-
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, loading: true })" />
|
|
56
|
-
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, active })" />
|
|
57
|
+
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, loading: true })" />
|
|
58
|
+
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, active })" />
|
|
57
59
|
<UAvatar v-else-if="item.avatar" :size="((props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: uiOverride?.itemLeadingAvatar, active })" />
|
|
58
60
|
</slot>
|
|
59
61
|
|
|
@@ -62,19 +64,19 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
62
64
|
{{ get(item, props.labelKey as string) }}
|
|
63
65
|
</slot>
|
|
64
66
|
|
|
65
|
-
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, active })" />
|
|
67
|
+
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, color: item?.color, active })" />
|
|
66
68
|
</span>
|
|
67
69
|
|
|
68
70
|
<span :class="ui.itemTrailing({ class: uiOverride?.itemTrailing })">
|
|
69
71
|
<slot :name="item.slot ? `${item.slot}-trailing`: 'item-trailing'" :item="(item as T)" :active="active" :index="index">
|
|
70
|
-
<UIcon v-if="item.children?.length" :name="appConfig.ui.icons.chevronRight" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, active })" />
|
|
72
|
+
<UIcon v-if="item.children?.length" :name="appConfig.ui.icons.chevronRight" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color, active })" />
|
|
71
73
|
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: uiOverride?.itemTrailingKbds })">
|
|
72
74
|
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
73
75
|
</span>
|
|
74
76
|
</slot>
|
|
75
77
|
|
|
76
78
|
<ContextMenu.ItemIndicator as-child>
|
|
77
|
-
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon })" />
|
|
79
|
+
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color })" />
|
|
78
80
|
</ContextMenu.ItemIndicator>
|
|
79
81
|
</span>
|
|
80
82
|
</slot>
|
|
@@ -94,7 +96,7 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
94
96
|
type="button"
|
|
95
97
|
:disabled="item.disabled"
|
|
96
98
|
:text-value="get(item, props.labelKey as string)"
|
|
97
|
-
:class="ui.item({ class: uiOverride?.item })"
|
|
99
|
+
:class="ui.item({ class: uiOverride?.item, color: item?.color })"
|
|
98
100
|
>
|
|
99
101
|
<ReuseItemTemplate :item="item" :index="index" />
|
|
100
102
|
</ContextMenu.SubTrigger>
|
|
@@ -122,7 +124,7 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
122
124
|
:checked="item.checked"
|
|
123
125
|
:disabled="item.disabled"
|
|
124
126
|
:text-value="get(item, props.labelKey as string)"
|
|
125
|
-
:class="ui.item({ class: [uiOverride?.item, item.class] })"
|
|
127
|
+
:class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color })"
|
|
126
128
|
@update:checked="item.onUpdateChecked"
|
|
127
129
|
@select="item.onSelect"
|
|
128
130
|
>
|
|
@@ -136,7 +138,7 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
136
138
|
@select="item.onSelect"
|
|
137
139
|
>
|
|
138
140
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item as Omit<ContextMenuItem, 'type'>)" custom>
|
|
139
|
-
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], active })">
|
|
141
|
+
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], active, color: item?.color })">
|
|
140
142
|
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
|
141
143
|
</ULinkBase>
|
|
142
144
|
</ULink>
|
|
@@ -5,6 +5,7 @@ import type { DialogContentProps } from 'radix-vue'
|
|
|
5
5
|
import type { AppConfig } from '@nuxt/schema'
|
|
6
6
|
import _appConfig from '#build/app.config'
|
|
7
7
|
import theme from '#build/ui/drawer'
|
|
8
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
9
|
|
|
9
10
|
const appConfig = _appConfig as AppConfig & { ui: { drawer: Partial<typeof theme> } }
|
|
10
11
|
|
|
@@ -51,6 +52,8 @@ export interface DrawerSlots {
|
|
|
51
52
|
body(props?: {}): any
|
|
52
53
|
footer(props?: {}): any
|
|
53
54
|
}
|
|
55
|
+
|
|
56
|
+
extendDevtoolsMeta({ example: 'DrawerExample' })
|
|
54
57
|
</script>
|
|
55
58
|
|
|
56
59
|
<script setup lang="ts">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<!-- eslint-disable vue/block-tag-newline -->
|
|
2
1
|
<script lang="ts">
|
|
3
2
|
import { tv, type VariantProps } from 'tailwind-variants'
|
|
4
3
|
import type { DropdownMenuRootProps, DropdownMenuRootEmits, DropdownMenuContentProps, DropdownMenuArrowProps } from 'radix-vue'
|
|
5
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
6
5
|
import _appConfig from '#build/app.config'
|
|
7
6
|
import theme from '#build/ui/dropdown-menu'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
8
|
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
|
9
9
|
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
10
10
|
|
|
@@ -12,9 +12,12 @@ const appConfig = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof
|
|
|
12
12
|
|
|
13
13
|
const dropdownMenu = tv({ extend: tv(theme), ...(appConfig.ui?.dropdownMenu || {}) })
|
|
14
14
|
|
|
15
|
+
type DropdownMenuVariants = VariantProps<typeof dropdownMenu>
|
|
16
|
+
|
|
15
17
|
export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
16
18
|
label?: string
|
|
17
19
|
icon?: string
|
|
20
|
+
color?: DropdownMenuVariants['color']
|
|
18
21
|
avatar?: AvatarProps
|
|
19
22
|
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
20
23
|
kbds?: KbdProps['value'][] | KbdProps[]
|
|
@@ -34,8 +37,6 @@ export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cust
|
|
|
34
37
|
onUpdateChecked?(checked: boolean): void
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
type DropdownMenuVariants = VariantProps<typeof dropdownMenu>
|
|
38
|
-
|
|
39
40
|
export interface DropdownMenuProps<T> extends Omit<DropdownMenuRootProps, 'dir'> {
|
|
40
41
|
size?: DropdownMenuVariants['size']
|
|
41
42
|
items?: T[] | T[][]
|
|
@@ -86,6 +87,54 @@ export type DropdownMenuSlots<T extends { slot?: string }> = {
|
|
|
86
87
|
'item-trailing': SlotProps<T>
|
|
87
88
|
} & DynamicSlots<T, SlotProps<T>>
|
|
88
89
|
|
|
90
|
+
extendDevtoolsMeta({
|
|
91
|
+
example: 'DropdownMenuExample',
|
|
92
|
+
ignoreProps: ['items'],
|
|
93
|
+
defaultProps: {
|
|
94
|
+
items: [
|
|
95
|
+
[{
|
|
96
|
+
label: 'My account',
|
|
97
|
+
avatar: {
|
|
98
|
+
src: 'https://avatars.githubusercontent.com/u/739984?v=4'
|
|
99
|
+
},
|
|
100
|
+
type: 'label'
|
|
101
|
+
}], [{
|
|
102
|
+
label: 'Profile',
|
|
103
|
+
icon: 'i-lucide-user',
|
|
104
|
+
slot: 'custom'
|
|
105
|
+
}, {
|
|
106
|
+
label: 'Billing',
|
|
107
|
+
icon: 'i-lucide-credit-card',
|
|
108
|
+
kbds: ['meta', 'b']
|
|
109
|
+
}, {
|
|
110
|
+
label: 'Settings',
|
|
111
|
+
icon: 'i-lucide-cog',
|
|
112
|
+
kbds: ['?']
|
|
113
|
+
}], [{
|
|
114
|
+
label: 'Invite users',
|
|
115
|
+
icon: 'i-lucide-user-plus',
|
|
116
|
+
children: [[{
|
|
117
|
+
label: 'Invite by email',
|
|
118
|
+
icon: 'i-lucide-send-horizontal'
|
|
119
|
+
}, {
|
|
120
|
+
label: 'Invite by link',
|
|
121
|
+
icon: 'i-lucide-link',
|
|
122
|
+
kbds: ['meta', 'i']
|
|
123
|
+
}]]
|
|
124
|
+
}],
|
|
125
|
+
[{
|
|
126
|
+
label: 'GitHub',
|
|
127
|
+
icon: 'i-simple-icons-github',
|
|
128
|
+
to: 'https://github.com/nuxt/ui',
|
|
129
|
+
target: '_blank'
|
|
130
|
+
}, {
|
|
131
|
+
label: 'Support',
|
|
132
|
+
icon: 'i-lucide-life-buoy',
|
|
133
|
+
to: '/components/dropdown-menu'
|
|
134
|
+
}]
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
})
|
|
89
138
|
</script>
|
|
90
139
|
|
|
91
140
|
<script setup lang="ts" generic="T extends DropdownMenuItem">
|
|
@@ -40,6 +40,8 @@ import ULink from './Link.vue'
|
|
|
40
40
|
import UAvatar from './Avatar.vue'
|
|
41
41
|
import UIcon from './Icon.vue'
|
|
42
42
|
import UKbd from './Kbd.vue'
|
|
43
|
+
// eslint-disable-next-line import/no-self-import
|
|
44
|
+
import UDropdownMenuContent from './DropdownMenuContent.vue'
|
|
43
45
|
|
|
44
46
|
const props = defineProps<DropdownMenuContentProps<T>>()
|
|
45
47
|
const emits = defineEmits<DropdownMenuContentEmits>()
|
|
@@ -58,8 +60,8 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
58
60
|
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
59
61
|
<slot :name="item.slot || 'item'" :item="(item as T)" :index="index">
|
|
60
62
|
<slot :name="item.slot ? `${item.slot}-leading`: 'item-leading'" :item="(item as T)" :active="active" :index="index">
|
|
61
|
-
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, loading: true })" />
|
|
62
|
-
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, active })" />
|
|
63
|
+
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, loading: true })" />
|
|
64
|
+
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, active })" />
|
|
63
65
|
<UAvatar v-else-if="item.avatar" :size="((props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: uiOverride?.itemLeadingAvatar, active })" />
|
|
64
66
|
</slot>
|
|
65
67
|
|
|
@@ -68,19 +70,19 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
68
70
|
{{ get(item, props.labelKey as string) }}
|
|
69
71
|
</slot>
|
|
70
72
|
|
|
71
|
-
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, active })" />
|
|
73
|
+
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, color: item?.color, active })" />
|
|
72
74
|
</span>
|
|
73
75
|
|
|
74
76
|
<span :class="ui.itemTrailing({ class: uiOverride?.itemTrailing })">
|
|
75
77
|
<slot :name="item.slot ? `${item.slot}-trailing`: 'item-trailing'" :item="(item as T)" :active="active" :index="index">
|
|
76
|
-
<UIcon v-if="item.children?.length" :name="appConfig.ui.icons.chevronRight" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, active })" />
|
|
78
|
+
<UIcon v-if="item.children?.length" :name="appConfig.ui.icons.chevronRight" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color, active })" />
|
|
77
79
|
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: uiOverride?.itemTrailingKbds })">
|
|
78
80
|
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
79
81
|
</span>
|
|
80
82
|
</slot>
|
|
81
83
|
|
|
82
84
|
<DropdownMenu.ItemIndicator as-child>
|
|
83
|
-
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon })" />
|
|
85
|
+
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color })" />
|
|
84
86
|
</DropdownMenu.ItemIndicator>
|
|
85
87
|
</span>
|
|
86
88
|
</slot>
|
|
@@ -100,7 +102,7 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
100
102
|
type="button"
|
|
101
103
|
:disabled="item.disabled"
|
|
102
104
|
:text-value="get(item, props.labelKey as string)"
|
|
103
|
-
:class="ui.item({ class: uiOverride?.item })"
|
|
105
|
+
:class="ui.item({ class: uiOverride?.item, color: item?.color })"
|
|
104
106
|
>
|
|
105
107
|
<ReuseItemTemplate :item="item" :index="index" />
|
|
106
108
|
</DropdownMenu.SubTrigger>
|
|
@@ -131,7 +133,7 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
131
133
|
:checked="item.checked"
|
|
132
134
|
:disabled="item.disabled"
|
|
133
135
|
:text-value="get(item, props.labelKey as string)"
|
|
134
|
-
:class="ui.item({ class: [uiOverride?.item, item.class] })"
|
|
136
|
+
:class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color })"
|
|
135
137
|
@update:checked="item.onUpdateChecked"
|
|
136
138
|
@select="item.onSelect"
|
|
137
139
|
>
|
|
@@ -145,7 +147,7 @@ const groups = computed(() => props.items?.length ? (Array.isArray(props.items[0
|
|
|
145
147
|
@select="item.onSelect"
|
|
146
148
|
>
|
|
147
149
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item as Omit<DropdownMenuItem, 'type'>)" custom>
|
|
148
|
-
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], active })">
|
|
150
|
+
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color, active })">
|
|
149
151
|
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
|
150
152
|
</ULinkBase>
|
|
151
153
|
</ULink>
|
|
@@ -3,6 +3,7 @@ import { tv } from 'tailwind-variants'
|
|
|
3
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
4
|
import _appConfig from '#build/app.config'
|
|
5
5
|
import theme from '#build/ui/form'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
6
7
|
import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, FormEvent, Form, FormErrorWithId } from '../types/form'
|
|
7
8
|
|
|
8
9
|
const appConfig = _appConfig as AppConfig & { ui: { form: Partial<typeof theme> } }
|
|
@@ -29,13 +30,15 @@ export interface FormEmits<T extends object> {
|
|
|
29
30
|
export interface FormSlots {
|
|
30
31
|
default(props?: {}): any
|
|
31
32
|
}
|
|
33
|
+
|
|
34
|
+
extendDevtoolsMeta({ example: 'FormExample' })
|
|
32
35
|
</script>
|
|
33
36
|
|
|
34
37
|
<script lang="ts" setup generic="T extends object">
|
|
35
38
|
import { provide, inject, nextTick, ref, onUnmounted, onMounted, computed, useId, readonly } from 'vue'
|
|
36
39
|
import { useEventBus } from '@vueuse/core'
|
|
37
40
|
import { formOptionsInjectionKey, formInputsInjectionKey, formBusInjectionKey, formLoadingInjectionKey } from '../composables/useFormField'
|
|
38
|
-
import {
|
|
41
|
+
import { parseSchema } from '../utils/form'
|
|
39
42
|
import { FormValidationException } from '../types/form'
|
|
40
43
|
|
|
41
44
|
const props = withDefaults(defineProps<FormProps<T>>(), {
|
|
@@ -91,13 +94,13 @@ onUnmounted(() => {
|
|
|
91
94
|
const errors = ref<FormErrorWithId[]>([])
|
|
92
95
|
provide('form-errors', errors)
|
|
93
96
|
|
|
94
|
-
const inputs = ref<Record<string, string>>({})
|
|
97
|
+
const inputs = ref<Record<string, { id?: string, pattern?: RegExp }>>({})
|
|
95
98
|
provide(formInputsInjectionKey, inputs)
|
|
96
99
|
|
|
97
100
|
function resolveErrorIds(errs: FormError[]): FormErrorWithId[] {
|
|
98
101
|
return errs.map(err => ({
|
|
99
102
|
...err,
|
|
100
|
-
id: inputs.value[err.name]
|
|
103
|
+
id: inputs.value[err.name]?.id
|
|
101
104
|
}))
|
|
102
105
|
}
|
|
103
106
|
|
|
@@ -105,20 +108,11 @@ async function getErrors(): Promise<FormErrorWithId[]> {
|
|
|
105
108
|
let errs = props.validate ? (await props.validate(props.state)) ?? [] : []
|
|
106
109
|
|
|
107
110
|
if (props.schema) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
errs = errs.concat(await getYupErrors(props.state, props.schema))
|
|
112
|
-
} else if (isJoiSchema(props.schema)) {
|
|
113
|
-
errs = errs.concat(await getJoiErrors(props.state, props.schema))
|
|
114
|
-
} else if (isValibotSchema(props.schema)) {
|
|
115
|
-
errs = errs.concat(await getValibotErrors(props.state, props.schema))
|
|
116
|
-
} else if (isSuperStructSchema(props.schema)) {
|
|
117
|
-
errs = errs.concat(await getSuperStructErrors(props.state, props.schema))
|
|
118
|
-
} else if (isStandardSchema(props.schema)) {
|
|
119
|
-
errs = errs.concat(await getStandardErrors(props.state, props.schema))
|
|
111
|
+
const { errors, result } = await parseSchema(props.state, props.schema as FormSchema<typeof props.state>)
|
|
112
|
+
if (errors) {
|
|
113
|
+
errs = errs.concat(errors)
|
|
120
114
|
} else {
|
|
121
|
-
|
|
115
|
+
Object.assign(props.state, result)
|
|
122
116
|
}
|
|
123
117
|
}
|
|
124
118
|
|
|
@@ -126,7 +120,7 @@ async function getErrors(): Promise<FormErrorWithId[]> {
|
|
|
126
120
|
}
|
|
127
121
|
|
|
128
122
|
async function _validate(opts: { name?: string | string[], silent?: boolean, nested?: boolean } = { silent: false, nested: true }): Promise<T | false> {
|
|
129
|
-
const names = opts.name && !Array.isArray(opts.name) ? [opts.name] : opts.name
|
|
123
|
+
const names = opts.name && !Array.isArray(opts.name) ? [opts.name] : opts.name as string[]
|
|
130
124
|
|
|
131
125
|
const nestedValidatePromises = !names && opts.nested
|
|
132
126
|
? Array.from(nestedForms.value.values()).map(
|
|
@@ -140,9 +134,16 @@ async function _validate(opts: { name?: string | string[], silent?: boolean, nes
|
|
|
140
134
|
: []
|
|
141
135
|
|
|
142
136
|
if (names) {
|
|
143
|
-
const otherErrors = errors.value.filter(error => !names
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
const otherErrors = errors.value.filter(error => !names.some((name) => {
|
|
138
|
+
const pattern = inputs.value?.[name]?.pattern
|
|
139
|
+
return name === error.name || (pattern && error.name.match(pattern))
|
|
140
|
+
}))
|
|
141
|
+
|
|
142
|
+
const pathErrors = (await getErrors()).filter(error => names.some((name) => {
|
|
143
|
+
const pattern = inputs.value?.[name]?.pattern
|
|
144
|
+
return name === error.name || (pattern && error.name.match(pattern))
|
|
145
|
+
}))
|
|
146
|
+
|
|
146
147
|
errors.value = otherErrors.concat(pathErrors)
|
|
147
148
|
} else {
|
|
148
149
|
errors.value = await getErrors()
|
|
@@ -3,6 +3,7 @@ import { tv, type VariantProps } from 'tailwind-variants'
|
|
|
3
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
4
|
import _appConfig from '#build/app.config'
|
|
5
5
|
import theme from '#build/ui/form-field'
|
|
6
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
6
7
|
|
|
7
8
|
const appConfig = _appConfig as AppConfig & { ui: { formField: Partial<typeof theme> } }
|
|
8
9
|
|
|
@@ -11,7 +12,10 @@ const formField = tv({ extend: tv(theme), ...(appConfig.ui?.formField || {}) })
|
|
|
11
12
|
type FormFieldVariants = VariantProps<typeof formField>
|
|
12
13
|
|
|
13
14
|
export interface FormFieldProps {
|
|
15
|
+
/** The name of the FormField. Also used to match form errors. */
|
|
14
16
|
name?: string
|
|
17
|
+
/** A regular expression to match form error names. */
|
|
18
|
+
errorPattern?: RegExp
|
|
15
19
|
label?: string
|
|
16
20
|
description?: string
|
|
17
21
|
help?: string
|
|
@@ -33,6 +37,8 @@ export interface FormFieldSlots {
|
|
|
33
37
|
error(props: { error?: string | boolean }): any
|
|
34
38
|
default(props: { error?: string | boolean }): any
|
|
35
39
|
}
|
|
40
|
+
|
|
41
|
+
extendDevtoolsMeta({ example: 'FormFieldExample', defaultProps: { label: 'Label' } })
|
|
36
42
|
</script>
|
|
37
43
|
|
|
38
44
|
<script setup lang="ts">
|
|
@@ -51,7 +57,7 @@ const ui = computed(() => formField({
|
|
|
51
57
|
|
|
52
58
|
const formErrors = inject<Ref<FormError[]> | null>('form-errors', null)
|
|
53
59
|
|
|
54
|
-
const error = computed(() => props.error || formErrors?.value?.find(error => error.name === props.name)?.message)
|
|
60
|
+
const error = computed(() => props.error || formErrors?.value?.find(error => error.name === props.name || (props.errorPattern && error.name.match(props.errorPattern)))?.message)
|
|
55
61
|
|
|
56
62
|
const id = ref(useId())
|
|
57
63
|
|
|
@@ -62,7 +68,8 @@ provide(formFieldInjectionKey, computed(() => ({
|
|
|
62
68
|
name: props.name,
|
|
63
69
|
size: props.size,
|
|
64
70
|
eagerValidation: props.eagerValidation,
|
|
65
|
-
validateOnInputDelay: props.validateOnInputDelay
|
|
71
|
+
validateOnInputDelay: props.validateOnInputDelay,
|
|
72
|
+
errorPattern: props.errorPattern
|
|
66
73
|
}) as FormFieldInjectedOptions<FormFieldProps>))
|
|
67
74
|
</script>
|
|
68
75
|
|
|
@@ -89,7 +96,7 @@ provide(formFieldInjectionKey, computed(() => ({
|
|
|
89
96
|
</p>
|
|
90
97
|
</div>
|
|
91
98
|
|
|
92
|
-
<div :class="[label && ui.container({ class: props.ui?.container })]">
|
|
99
|
+
<div :class="[(label || !!slots.label || description || !!slots.description) && ui.container({ class: props.ui?.container })]">
|
|
93
100
|
<slot :error="error" />
|
|
94
101
|
|
|
95
102
|
<p v-if="(typeof error === 'string' && error) || !!slots.error" :class="ui.error({ class: props.ui?.error })">
|
|
@@ -54,6 +54,7 @@ import { useComponentIcons } from '../composables/useComponentIcons'
|
|
|
54
54
|
import { useFormField } from '../composables/useFormField'
|
|
55
55
|
import { looseToNumber } from '../utils'
|
|
56
56
|
import UIcon from './Icon.vue'
|
|
57
|
+
import UAvatar from './Avatar.vue'
|
|
57
58
|
|
|
58
59
|
defineOptions({ inheritAttrs: false })
|
|
59
60
|
|