@nuxt/ui 3.0.0-alpha.1 → 3.0.0-alpha.10
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/calendar.ts +85 -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/color-picker.ts +39 -0
- package/.nuxt/ui/command-palette.ts +50 -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 +48 -0
- package/.nuxt/ui/input-menu.ts +410 -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 +315 -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/stepper.ts +180 -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 +75 -54
- package/cli/commands/{init.mjs → make/component.mjs} +5 -5
- 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 +52 -7
- package/cli/utils.mjs +14 -0
- package/dist/chunks/component-meta.cjs +82802 -0
- package/dist/chunks/component-meta.mjs +82800 -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/B1fTd_Rf.js +1 -0
- package/dist/client/devtools/_nuxt/CSUxkedg.js +1 -0
- package/dist/client/devtools/_nuxt/CbRTGpb7.js +1 -0
- package/dist/client/devtools/_nuxt/YQTlxbcT.js +53 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/client/devtools/_nuxt/builds/meta/b3465abc-0a92-4ee7-ba6b-e5174891fcc0.json +1 -0
- package/dist/client/devtools/_nuxt/entry.DXXceQev.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.BJpkZFyY.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.D3i9VDlt.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 +54 -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/StepperExample.vue +44 -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 +38 -7
- package/dist/module.d.ts +38 -7
- package/dist/module.json +2 -1
- package/dist/module.mjs +179 -2568
- package/dist/runtime/components/Accordion.vue +49 -8
- package/dist/runtime/components/Alert.vue +13 -6
- package/dist/runtime/components/App.vue +20 -7
- package/dist/runtime/components/Avatar.vue +33 -9
- package/dist/runtime/components/AvatarGroup.vue +4 -1
- package/dist/runtime/components/Badge.vue +34 -4
- package/dist/runtime/components/Breadcrumb.vue +52 -13
- package/dist/runtime/components/Button.vue +45 -6
- package/dist/runtime/components/ButtonGroup.vue +5 -2
- package/dist/runtime/components/Calendar.vue +190 -0
- package/dist/runtime/components/Card.vue +4 -1
- package/dist/runtime/components/Carousel.vue +322 -0
- package/dist/runtime/components/Checkbox.vue +28 -33
- package/dist/runtime/components/Chip.vue +9 -2
- package/dist/runtime/components/Collapsible.vue +7 -4
- package/dist/runtime/components/ColorPicker.vue +265 -0
- package/dist/runtime/components/CommandPalette.vue +122 -96
- package/dist/runtime/components/Container.vue +4 -1
- package/dist/runtime/components/ContextMenu.vue +101 -14
- package/dist/runtime/components/ContextMenuContent.vue +48 -18
- package/dist/runtime/components/Drawer.vue +22 -11
- package/dist/runtime/components/DropdownMenu.vue +91 -16
- package/dist/runtime/components/DropdownMenuContent.vue +50 -18
- package/dist/runtime/components/Form.vue +49 -32
- package/dist/runtime/components/FormField.vue +18 -6
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +15 -6
- package/dist/runtime/components/InputMenu.vue +152 -65
- package/dist/runtime/components/InputNumber.vue +192 -0
- package/dist/runtime/components/Kbd.vue +3 -1
- package/dist/runtime/components/Link.vue +71 -8
- package/dist/runtime/components/LinkBase.vue +10 -7
- package/dist/runtime/components/Modal.vue +23 -11
- package/dist/runtime/components/NavigationMenu.vue +170 -75
- package/dist/runtime/components/Pagination.vue +31 -15
- package/dist/runtime/components/PinInput.vue +96 -0
- package/dist/runtime/components/Popover.vue +26 -7
- package/dist/runtime/components/Progress.vue +25 -8
- package/dist/runtime/components/RadioGroup.vue +28 -7
- package/dist/runtime/components/Select.vue +79 -32
- package/dist/runtime/components/SelectMenu.vue +164 -80
- package/dist/runtime/components/Separator.vue +3 -3
- package/dist/runtime/components/Skeleton.vue +4 -1
- package/dist/runtime/components/Slideover.vue +23 -11
- package/dist/runtime/components/Slider.vue +3 -3
- package/dist/runtime/components/Stepper.vue +171 -0
- package/dist/runtime/components/Switch.vue +16 -16
- package/dist/runtime/components/Table.vue +262 -0
- package/dist/runtime/components/Tabs.vue +42 -15
- package/dist/runtime/components/Textarea.vue +9 -3
- package/dist/runtime/components/Toast.vue +13 -5
- package/dist/runtime/components/Toaster.vue +31 -16
- package/dist/runtime/components/Tooltip.vue +9 -6
- package/dist/runtime/composables/defineLocale.d.ts +9 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.js +2 -8
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
- package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
- package/dist/runtime/composables/useFormField.d.ts +8 -4
- package/dist/runtime/composables/useFormField.js +2 -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/composables/useModal.d.ts +2 -2
- package/dist/runtime/composables/useSlideover.d.ts +2 -2
- package/dist/runtime/composables/useToast.d.ts +2 -2
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -0
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +53 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +52 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +52 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +52 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +52 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +53 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +52 -0
- package/dist/runtime/locale/index.d.ts +19 -0
- package/dist/runtime/locale/index.js +19 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +52 -0
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +52 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +52 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +52 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +52 -0
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +52 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +52 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +52 -0
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +52 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +52 -0
- package/dist/runtime/locale/zh_hans.d.ts +2 -0
- package/dist/runtime/locale/zh_hans.js +52 -0
- package/dist/runtime/locale/zh_hant.d.ts +2 -0
- package/dist/runtime/locale/zh_hant.js +52 -0
- package/dist/runtime/plugins/colors.js +12 -8
- package/dist/runtime/types/form.d.ts +9 -2
- package/dist/runtime/types/index.d.ts +50 -42
- package/dist/runtime/types/index.js +8 -0
- package/dist/runtime/types/locale.d.ts +54 -0
- package/dist/runtime/types/utils.d.ts +8 -3
- package/dist/runtime/utils/form.d.ts +7 -5
- package/dist/runtime/utils/form.js +117 -28
- package/dist/runtime/utils/index.d.ts +2 -1
- package/dist/runtime/utils/index.js +16 -0
- package/dist/runtime/utils/link.d.ts +5 -3
- package/dist/runtime/utils/link.js +1 -1
- 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 +208 -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.CwmIkD_Y.cjs +3269 -0
- package/dist/shared/ui.D_93iuwH.mjs +3262 -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 +98 -31
- 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
- package/dist/runtime/types/component.d.ts +0 -17
- /package/dist/runtime/types/{component.js → locale.js} +0 -0
|
@@ -3,8 +3,55 @@ import type { ButtonHTMLAttributes } from 'vue'
|
|
|
3
3
|
import { tv } from 'tailwind-variants'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
|
+
import type { RouterLinkProps, RouteLocationRaw } from 'vue-router'
|
|
6
7
|
import theme from '#build/ui/link'
|
|
7
|
-
import
|
|
8
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
9
|
+
|
|
10
|
+
interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
11
|
+
/**
|
|
12
|
+
* Route Location the link should navigate to when clicked on.
|
|
13
|
+
*/
|
|
14
|
+
to?: RouteLocationRaw // need to manually type to avoid breaking typedPages
|
|
15
|
+
/**
|
|
16
|
+
* An alias for `to`. If used with `to`, `href` will be ignored
|
|
17
|
+
*/
|
|
18
|
+
href?: NuxtLinkProps['to']
|
|
19
|
+
/**
|
|
20
|
+
* Forces the link to be considered as external (true) or internal (false). This is helpful to handle edge-cases
|
|
21
|
+
*/
|
|
22
|
+
external?: boolean
|
|
23
|
+
/**
|
|
24
|
+
* Where to display the linked URL, as the name for a browsing context.
|
|
25
|
+
*/
|
|
26
|
+
target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null
|
|
27
|
+
/**
|
|
28
|
+
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
29
|
+
*/
|
|
30
|
+
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null
|
|
31
|
+
/**
|
|
32
|
+
* If set to true, no rel attribute will be added to the link
|
|
33
|
+
*/
|
|
34
|
+
noRel?: boolean
|
|
35
|
+
/**
|
|
36
|
+
* A class to apply to links that have been prefetched.
|
|
37
|
+
*/
|
|
38
|
+
prefetchedClass?: string
|
|
39
|
+
/**
|
|
40
|
+
* When enabled will prefetch middleware, layouts and payloads of links in the viewport.
|
|
41
|
+
*/
|
|
42
|
+
prefetch?: boolean
|
|
43
|
+
/**
|
|
44
|
+
* Allows controlling when to prefetch links. By default, prefetch is triggered only on visibility.
|
|
45
|
+
*/
|
|
46
|
+
prefetchOn?: 'visibility' | 'interaction' | Partial<{
|
|
47
|
+
visibility: boolean
|
|
48
|
+
interaction: boolean
|
|
49
|
+
}>
|
|
50
|
+
/**
|
|
51
|
+
* Escape hatch to disable `prefetch` attribute.
|
|
52
|
+
*/
|
|
53
|
+
noPrefetch?: boolean
|
|
54
|
+
}
|
|
8
55
|
|
|
9
56
|
const appConfig = _appConfig as AppConfig & { ui: { link: Partial<typeof theme> } }
|
|
10
57
|
|
|
@@ -26,8 +73,8 @@ export interface LinkProps extends NuxtLinkProps {
|
|
|
26
73
|
active?: boolean
|
|
27
74
|
/** Will only be active if the current route is an exact match. */
|
|
28
75
|
exact?: boolean
|
|
29
|
-
/**
|
|
30
|
-
exactQuery?: boolean
|
|
76
|
+
/** Allows controlling how the current route query sets the link as active. */
|
|
77
|
+
exactQuery?: boolean | 'partial'
|
|
31
78
|
/** Will only be active if the current route hash is an exact match. */
|
|
32
79
|
exactHash?: boolean
|
|
33
80
|
/** The class to apply when the link is inactive. */
|
|
@@ -41,14 +88,17 @@ export interface LinkProps extends NuxtLinkProps {
|
|
|
41
88
|
export interface LinkSlots {
|
|
42
89
|
default(props: { active: boolean }): any
|
|
43
90
|
}
|
|
91
|
+
|
|
92
|
+
extendDevtoolsMeta({ example: 'LinkExample' })
|
|
44
93
|
</script>
|
|
45
94
|
|
|
46
95
|
<script setup lang="ts">
|
|
47
96
|
import { computed } from 'vue'
|
|
48
|
-
import { isEqual } from 'ohash'
|
|
49
|
-
import { useForwardProps } from '
|
|
97
|
+
import { isEqual, diff } from 'ohash'
|
|
98
|
+
import { useForwardProps } from 'reka-ui'
|
|
50
99
|
import { reactiveOmit } from '@vueuse/core'
|
|
51
100
|
import { useRoute } from '#imports'
|
|
101
|
+
import ULinkBase from './LinkBase.vue'
|
|
52
102
|
|
|
53
103
|
defineOptions({ inheritAttrs: false })
|
|
54
104
|
|
|
@@ -62,7 +112,7 @@ const props = withDefaults(defineProps<LinkProps>(), {
|
|
|
62
112
|
defineSlots<LinkSlots>()
|
|
63
113
|
|
|
64
114
|
const route = useRoute()
|
|
65
|
-
const nuxtLinkProps = useForwardProps(reactiveOmit(props, 'as', 'type', 'disabled', 'active', 'exact', 'exactQuery', 'exactHash', 'activeClass', 'inactiveClass'))
|
|
115
|
+
const nuxtLinkProps = useForwardProps(reactiveOmit(props, 'as', 'type', 'disabled', 'active', 'exact', 'exactQuery', 'exactHash', 'activeClass', 'inactiveClass', 'raw', 'class'))
|
|
66
116
|
|
|
67
117
|
const ui = computed(() => tv({
|
|
68
118
|
extend: link,
|
|
@@ -74,14 +124,27 @@ const ui = computed(() => tv({
|
|
|
74
124
|
}
|
|
75
125
|
}))
|
|
76
126
|
|
|
127
|
+
function isPartiallyEqual(item1: any, item2: any) {
|
|
128
|
+
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
129
|
+
if (q.type === 'added') {
|
|
130
|
+
filtered.push(q.key)
|
|
131
|
+
}
|
|
132
|
+
return filtered
|
|
133
|
+
}, [] as string[])
|
|
134
|
+
return isEqual(item1, item2, { excludeKeys: key => diffedKeys.includes(key) })
|
|
135
|
+
}
|
|
136
|
+
|
|
77
137
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
78
138
|
if (props.active !== undefined) {
|
|
79
139
|
return props.active
|
|
80
140
|
}
|
|
81
141
|
|
|
82
|
-
if (props.exactQuery
|
|
83
|
-
return false
|
|
142
|
+
if (props.exactQuery === 'partial') {
|
|
143
|
+
if (!isPartiallyEqual(linkRoute.query, route.query)) return false
|
|
144
|
+
} else if (props.exactQuery === true) {
|
|
145
|
+
if (!isEqual(linkRoute.query, route.query)) return false
|
|
84
146
|
}
|
|
147
|
+
|
|
85
148
|
if (props.exactHash && linkRoute.hash !== route.hash) {
|
|
86
149
|
return false
|
|
87
150
|
}
|
|
@@ -3,7 +3,7 @@ export interface LinkBaseProps {
|
|
|
3
3
|
as?: string
|
|
4
4
|
type?: string
|
|
5
5
|
disabled?: boolean
|
|
6
|
-
|
|
6
|
+
onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>
|
|
7
7
|
href?: string
|
|
8
8
|
navigate?: (e: MouseEvent) => void
|
|
9
9
|
rel?: string
|
|
@@ -13,22 +13,24 @@ export interface LinkBaseProps {
|
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
|
-
import { Primitive } from '
|
|
16
|
+
import { Primitive } from 'reka-ui'
|
|
17
17
|
|
|
18
18
|
const props = withDefaults(defineProps<LinkBaseProps>(), {
|
|
19
19
|
as: 'button',
|
|
20
20
|
type: 'button'
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
-
function
|
|
23
|
+
function onClickWrapper(e: MouseEvent) {
|
|
24
24
|
if (props.disabled) {
|
|
25
25
|
e.stopPropagation()
|
|
26
26
|
e.preventDefault()
|
|
27
27
|
return
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (props.
|
|
31
|
-
props.
|
|
30
|
+
if (props.onClick) {
|
|
31
|
+
for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick]) {
|
|
32
|
+
onClick(e)
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
if (props.href && props.navigate && !props.isExternal) {
|
|
@@ -43,7 +45,8 @@ function onClick(e: MouseEvent) {
|
|
|
43
45
|
'as': 'a',
|
|
44
46
|
'href': disabled ? undefined : href,
|
|
45
47
|
'aria-disabled': disabled ? 'true' : undefined,
|
|
46
|
-
'role': disabled ? 'link' : undefined
|
|
48
|
+
'role': disabled ? 'link' : undefined,
|
|
49
|
+
'tabindex': disabled ? -1 : undefined
|
|
47
50
|
} : as === 'button' ? {
|
|
48
51
|
as,
|
|
49
52
|
type,
|
|
@@ -53,7 +56,7 @@ function onClick(e: MouseEvent) {
|
|
|
53
56
|
}"
|
|
54
57
|
:rel="rel"
|
|
55
58
|
:target="target"
|
|
56
|
-
@click="
|
|
59
|
+
@click="onClickWrapper"
|
|
57
60
|
>
|
|
58
61
|
<slot />
|
|
59
62
|
</Primitive>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { tv } from 'tailwind-variants'
|
|
3
|
-
import type { DialogRootProps, DialogRootEmits, DialogContentProps } from '
|
|
3
|
+
import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'reka-ui'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/ui/modal'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
8
|
import type { ButtonProps } from '../types'
|
|
8
9
|
|
|
9
10
|
const appConfig = _appConfig as AppConfig & { ui: { modal: Partial<typeof theme> } }
|
|
@@ -37,7 +38,7 @@ export interface ModalProps extends DialogRootProps {
|
|
|
37
38
|
portal?: boolean
|
|
38
39
|
/**
|
|
39
40
|
* Display a close button to dismiss the modal.
|
|
40
|
-
* `{ size: 'md', color: '
|
|
41
|
+
* `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
|
|
41
42
|
* @defaultValue true
|
|
42
43
|
*/
|
|
43
44
|
close?: ButtonProps | boolean
|
|
@@ -67,13 +68,16 @@ export interface ModalSlots {
|
|
|
67
68
|
body(props?: {}): any
|
|
68
69
|
footer(props?: {}): any
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
extendDevtoolsMeta({ example: 'ModalExample' })
|
|
70
73
|
</script>
|
|
71
74
|
|
|
72
75
|
<script setup lang="ts">
|
|
73
76
|
import { computed, toRef } from 'vue'
|
|
74
|
-
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, useForwardPropsEmits } from '
|
|
77
|
+
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, useForwardPropsEmits } from 'reka-ui'
|
|
75
78
|
import { reactivePick } from '@vueuse/core'
|
|
76
79
|
import { useAppConfig } from '#imports'
|
|
80
|
+
import { useLocale } from '../composables/useLocale'
|
|
77
81
|
import UButton from './Button.vue'
|
|
78
82
|
|
|
79
83
|
const props = withDefaults(defineProps<ModalProps>(), {
|
|
@@ -86,21 +90,29 @@ const props = withDefaults(defineProps<ModalProps>(), {
|
|
|
86
90
|
const emits = defineEmits<ModalEmits>()
|
|
87
91
|
const slots = defineSlots<ModalSlots>()
|
|
88
92
|
|
|
93
|
+
const { t } = useLocale()
|
|
94
|
+
const appConfig = useAppConfig()
|
|
95
|
+
|
|
89
96
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
|
|
90
97
|
const contentProps = toRef(() => props.content)
|
|
91
98
|
const contentEvents = computed(() => {
|
|
92
99
|
if (props.preventClose) {
|
|
93
100
|
return {
|
|
94
101
|
pointerDownOutside: (e: Event) => e.preventDefault(),
|
|
95
|
-
interactOutside: (e: Event) => e.preventDefault()
|
|
102
|
+
interactOutside: (e: Event) => e.preventDefault(),
|
|
103
|
+
escapeKeyDown: (e: Event) => e.preventDefault()
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
return {
|
|
107
|
+
return {
|
|
108
|
+
interactOutside: (e: Event) => {
|
|
109
|
+
if (e.target instanceof Element && e.target.closest('[data-sonner-toaster]')) {
|
|
110
|
+
return e.preventDefault()
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
100
114
|
})
|
|
101
115
|
|
|
102
|
-
const appConfig = useAppConfig()
|
|
103
|
-
|
|
104
116
|
const ui = computed(() => modal({
|
|
105
117
|
transition: props.transition,
|
|
106
118
|
fullscreen: props.fullscreen
|
|
@@ -109,14 +121,14 @@ const ui = computed(() => modal({
|
|
|
109
121
|
|
|
110
122
|
<template>
|
|
111
123
|
<DialogRoot v-slot="{ open }" v-bind="rootProps">
|
|
112
|
-
<DialogTrigger v-if="!!slots.default" as-child>
|
|
124
|
+
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
113
125
|
<slot :open="open" />
|
|
114
126
|
</DialogTrigger>
|
|
115
127
|
|
|
116
128
|
<DialogPortal :disabled="!portal">
|
|
117
129
|
<DialogOverlay v-if="overlay" :class="ui.overlay({ class: props.ui?.overlay })" />
|
|
118
130
|
|
|
119
|
-
<DialogContent :class="ui.content({ class: [props.class, props.ui?.content] })" v-bind="contentProps" v-on="contentEvents">
|
|
131
|
+
<DialogContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" v-on="contentEvents">
|
|
120
132
|
<slot name="content">
|
|
121
133
|
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
122
134
|
<slot name="header">
|
|
@@ -138,9 +150,9 @@ const ui = computed(() => modal({
|
|
|
138
150
|
v-if="close"
|
|
139
151
|
:icon="closeIcon || appConfig.ui.icons.close"
|
|
140
152
|
size="md"
|
|
141
|
-
color="
|
|
153
|
+
color="neutral"
|
|
142
154
|
variant="ghost"
|
|
143
|
-
aria-label="
|
|
155
|
+
:aria-label="t('modal.close')"
|
|
144
156
|
v-bind="typeof close === 'object' ? close : undefined"
|
|
145
157
|
:class="ui.close({ class: props.ui?.close })"
|
|
146
158
|
/>
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
-
import type { NavigationMenuRootProps, NavigationMenuRootEmits,
|
|
3
|
+
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, CollapsibleRootProps } from 'reka-ui'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/ui/navigation-menu'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
8
|
import type { AvatarProps, BadgeProps, LinkProps } from '../types'
|
|
8
|
-
import type { DynamicSlots } from '../types/utils'
|
|
9
|
+
import type { DynamicSlots, MaybeArrayOfArray, MaybeArrayOfArrayItem, PartialString } from '../types/utils'
|
|
9
10
|
|
|
10
11
|
const appConfig = _appConfig as AppConfig & { ui: { navigationMenu: Partial<typeof theme> } }
|
|
11
12
|
|
|
12
13
|
const navigationMenu = tv({ extend: tv(theme), ...(appConfig.ui?.navigationMenu || {}) })
|
|
13
14
|
|
|
14
|
-
export interface NavigationMenuChildItem extends Omit<
|
|
15
|
-
|
|
15
|
+
export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'children'> {
|
|
16
|
+
/** Description is only used when `orientation` is `horizontal`. */
|
|
16
17
|
description?: string
|
|
17
|
-
icon?: string
|
|
18
|
-
select?(e: Event): void
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
export interface NavigationMenuItem extends Omit<LinkProps, 'raw' | 'custom'>, Pick<
|
|
20
|
+
export interface NavigationMenuItem extends Omit<LinkProps, 'raw' | 'custom'>, Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> {
|
|
22
21
|
label?: string
|
|
23
22
|
icon?: string
|
|
24
23
|
avatar?: AvatarProps
|
|
25
24
|
badge?: string | number | BadgeProps
|
|
26
25
|
trailingIcon?: string
|
|
27
26
|
slot?: string
|
|
27
|
+
value?: string
|
|
28
28
|
children?: NavigationMenuChildItem[]
|
|
29
|
-
|
|
29
|
+
onSelect?(e: Event): void
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
type NavigationMenuVariants = VariantProps<typeof navigationMenu>
|
|
33
33
|
|
|
34
|
-
export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | '
|
|
34
|
+
export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'> {
|
|
35
35
|
/**
|
|
36
36
|
* The element or component this component should render as.
|
|
37
|
-
* @defaultValue
|
|
37
|
+
* @defaultValue 'div'
|
|
38
38
|
*/
|
|
39
39
|
as?: any
|
|
40
40
|
/**
|
|
@@ -42,7 +42,7 @@ export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'd
|
|
|
42
42
|
* @defaultValue appConfig.ui.icons.chevronDown
|
|
43
43
|
*/
|
|
44
44
|
trailingIcon?: string
|
|
45
|
-
items?: T
|
|
45
|
+
items?: T
|
|
46
46
|
color?: NavigationMenuVariants['color']
|
|
47
47
|
variant?: NavigationMenuVariants['variant']
|
|
48
48
|
/**
|
|
@@ -60,8 +60,13 @@ export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'd
|
|
|
60
60
|
* @defaultValue false
|
|
61
61
|
*/
|
|
62
62
|
arrow?: boolean
|
|
63
|
+
/**
|
|
64
|
+
* The key used to get the label from the item.
|
|
65
|
+
* @defaultValue 'label'
|
|
66
|
+
*/
|
|
67
|
+
labelKey?: string
|
|
63
68
|
class?: any
|
|
64
|
-
ui?:
|
|
69
|
+
ui?: PartialString<typeof navigationMenu.slots>
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
export interface NavigationMenuEmits extends NavigationMenuRootEmits {}
|
|
@@ -73,30 +78,88 @@ export type NavigationMenuSlots<T extends { slot?: string }> = {
|
|
|
73
78
|
'item-leading': SlotProps<T>
|
|
74
79
|
'item-label': SlotProps<T>
|
|
75
80
|
'item-trailing': SlotProps<T>
|
|
81
|
+
'item-content': SlotProps<T>
|
|
76
82
|
} & DynamicSlots<T, SlotProps<T>>
|
|
83
|
+
|
|
84
|
+
extendDevtoolsMeta({
|
|
85
|
+
ignoreProps: ['items'],
|
|
86
|
+
defaultProps: {
|
|
87
|
+
items: [
|
|
88
|
+
[{
|
|
89
|
+
label: 'Documentation',
|
|
90
|
+
icon: 'i-lucide-book-open',
|
|
91
|
+
badge: 10,
|
|
92
|
+
children: [{
|
|
93
|
+
label: 'Introduction',
|
|
94
|
+
description: 'Fully styled and customizable components for Nuxt.',
|
|
95
|
+
icon: 'i-lucide-house'
|
|
96
|
+
}, {
|
|
97
|
+
label: 'Installation',
|
|
98
|
+
description: 'Learn how to install and configure Nuxt UI in your application.',
|
|
99
|
+
icon: 'i-lucide-cloud-download'
|
|
100
|
+
}, {
|
|
101
|
+
label: 'Theming',
|
|
102
|
+
description: 'Learn how to customize the look and feel of the components.',
|
|
103
|
+
icon: 'i-lucide-swatch-book'
|
|
104
|
+
}, {
|
|
105
|
+
label: 'Shortcuts',
|
|
106
|
+
description: 'Learn how to display and define keyboard shortcuts in your app.',
|
|
107
|
+
icon: 'i-lucide-monitor'
|
|
108
|
+
}]
|
|
109
|
+
}, {
|
|
110
|
+
label: 'GitHub',
|
|
111
|
+
icon: 'i-simple-icons-github',
|
|
112
|
+
to: 'https://github.com/nuxt/ui',
|
|
113
|
+
target: '_blank'
|
|
114
|
+
}, {
|
|
115
|
+
label: 'Help',
|
|
116
|
+
icon: 'i-lucide-circle-help',
|
|
117
|
+
disabled: true
|
|
118
|
+
}]
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
})
|
|
77
122
|
</script>
|
|
78
123
|
|
|
79
|
-
<script setup lang="ts" generic="T extends NavigationMenuItem">
|
|
124
|
+
<script setup lang="ts" generic="T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<NavigationMenuItem>">
|
|
80
125
|
import { computed, toRef } from 'vue'
|
|
81
|
-
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from '
|
|
82
|
-
import {
|
|
126
|
+
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from 'reka-ui'
|
|
127
|
+
import { createReusableTemplate } from '@vueuse/core'
|
|
128
|
+
import { get } from '../utils'
|
|
129
|
+
import { pickLinkProps } from '../utils/link'
|
|
83
130
|
import ULinkBase from './LinkBase.vue'
|
|
84
131
|
import ULink from './Link.vue'
|
|
85
132
|
import UAvatar from './Avatar.vue'
|
|
86
133
|
import UIcon from './Icon.vue'
|
|
87
134
|
import UBadge from './Badge.vue'
|
|
88
|
-
import
|
|
135
|
+
import UCollapsible from './Collapsible.vue'
|
|
89
136
|
|
|
90
|
-
const props = withDefaults(defineProps<NavigationMenuProps<
|
|
137
|
+
const props = withDefaults(defineProps<NavigationMenuProps<I>>(), {
|
|
91
138
|
orientation: 'horizontal',
|
|
92
|
-
delayDuration: 0
|
|
139
|
+
delayDuration: 0,
|
|
140
|
+
labelKey: 'label',
|
|
141
|
+
unmountOnHide: true
|
|
93
142
|
})
|
|
94
143
|
const emits = defineEmits<NavigationMenuEmits>()
|
|
95
144
|
const slots = defineSlots<NavigationMenuSlots<T>>()
|
|
96
145
|
|
|
97
|
-
const rootProps = useForwardPropsEmits(
|
|
146
|
+
const rootProps = useForwardPropsEmits(computed(() => ({
|
|
147
|
+
as: props.as,
|
|
148
|
+
modelValue: props.modelValue,
|
|
149
|
+
defaultValue: props.defaultValue,
|
|
150
|
+
delayDuration: props.delayDuration,
|
|
151
|
+
skipDelayDuration: props.skipDelayDuration,
|
|
152
|
+
orientation: props.orientation,
|
|
153
|
+
disableClickTrigger: props.disableClickTrigger,
|
|
154
|
+
disableHoverTrigger: props.disableHoverTrigger,
|
|
155
|
+
disablePointerLeaveClose: props.disablePointerLeaveClose,
|
|
156
|
+
unmountOnHide: props.unmountOnHide
|
|
157
|
+
})), emits)
|
|
158
|
+
|
|
98
159
|
const contentProps = toRef(() => props.content)
|
|
99
160
|
|
|
161
|
+
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: NavigationMenuItem, active?: boolean, index: number }>()
|
|
162
|
+
|
|
100
163
|
const ui = computed(() => navigationMenu({
|
|
101
164
|
orientation: props.orientation,
|
|
102
165
|
color: props.color,
|
|
@@ -109,76 +172,108 @@ const lists = computed(() => props.items?.length ? (Array.isArray(props.items[0]
|
|
|
109
172
|
</script>
|
|
110
173
|
|
|
111
174
|
<template>
|
|
175
|
+
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
176
|
+
<slot :name="item.slot || 'item'" :item="(item as T)" :index="index">
|
|
177
|
+
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="(item as T)" :active="active" :index="index">
|
|
178
|
+
<UAvatar v-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active, disabled: !!item.disabled })" />
|
|
179
|
+
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active, disabled: !!item.disabled })" />
|
|
180
|
+
</slot>
|
|
181
|
+
|
|
182
|
+
<span v-if="get(item, props.labelKey as string) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
|
|
183
|
+
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="(item as T)" :active="active" :index="index">
|
|
184
|
+
{{ get(item, props.labelKey as string) }}
|
|
185
|
+
</slot>
|
|
186
|
+
|
|
187
|
+
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
|
|
188
|
+
</span>
|
|
189
|
+
|
|
190
|
+
<span v-if="item.badge || (orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) || (orientation === 'vertical' && item.children?.length) || item.trailingIcon || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
|
|
191
|
+
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="(item as T)" :active="active" :index="index">
|
|
192
|
+
<UBadge
|
|
193
|
+
v-if="item.badge"
|
|
194
|
+
color="neutral"
|
|
195
|
+
variant="outline"
|
|
196
|
+
:size="((props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()) as BadgeProps['size'])"
|
|
197
|
+
v-bind="(typeof item.badge === 'string' || typeof item.badge === 'number') ? { label: item.badge } : item.badge"
|
|
198
|
+
:class="ui.linkTrailingBadge({ class: props.ui?.linkTrailingBadge })"
|
|
199
|
+
/>
|
|
200
|
+
|
|
201
|
+
<UIcon v-if="(orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) || (orientation === 'vertical' && item.children?.length)" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
202
|
+
<UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
203
|
+
</slot>
|
|
204
|
+
</span>
|
|
205
|
+
</slot>
|
|
206
|
+
</DefineItemTemplate>
|
|
207
|
+
|
|
112
208
|
<NavigationMenuRoot v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
113
209
|
<template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
|
|
114
210
|
<NavigationMenuList :class="ui.list({ class: props.ui?.list })">
|
|
115
|
-
<
|
|
211
|
+
<component
|
|
212
|
+
:is="(item.children?.length && orientation === 'vertical') ? UCollapsible : NavigationMenuItem"
|
|
213
|
+
v-for="(item, index) in list"
|
|
214
|
+
:key="`list-${listIndex}-${index}`"
|
|
215
|
+
as="li"
|
|
216
|
+
:value="item.value || String(index)"
|
|
217
|
+
:default-open="item.defaultOpen"
|
|
218
|
+
:unmount-on-hide="(item.children?.length && orientation === 'vertical') ? unmountOnHide : undefined"
|
|
219
|
+
:open="item.open"
|
|
220
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
221
|
+
>
|
|
116
222
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
117
223
|
<component
|
|
118
|
-
:is="item.children?.length ? NavigationMenuTrigger : NavigationMenuLink"
|
|
119
|
-
v-bind="item.children?.length ? { disabled: item.disabled } : { active }"
|
|
224
|
+
:is="(orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) ? NavigationMenuTrigger : NavigationMenuLink"
|
|
120
225
|
as-child
|
|
121
226
|
:active="active"
|
|
122
|
-
|
|
227
|
+
:disabled="item.disabled"
|
|
228
|
+
@select="item.onSelect"
|
|
123
229
|
>
|
|
124
230
|
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.class], active, disabled: !!item.disabled })">
|
|
125
|
-
<
|
|
126
|
-
<slot :name="item.slot ? `${item.slot}-leading`: 'item-leading'" :item="item" :active="active" :index="index">
|
|
127
|
-
<UAvatar v-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active, disabled: !!item.disabled })" />
|
|
128
|
-
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active, disabled: !!item.disabled })" />
|
|
129
|
-
</slot>
|
|
130
|
-
|
|
131
|
-
<span v-if="item.label || !!slots[item.slot ? `${item.slot}-label`: 'item-label']" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
|
|
132
|
-
<slot :name="item.slot ? `${item.slot}-label`: 'item-label'" :item="item" :active="active" :index="index">
|
|
133
|
-
{{ item.label }}
|
|
134
|
-
</slot>
|
|
135
|
-
|
|
136
|
-
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
|
|
137
|
-
</span>
|
|
138
|
-
|
|
139
|
-
<span v-if="item.badge || (item.children?.length && orientation === 'horizontal') || !!slots[item.slot ? `${item.slot}-trailing`: 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
|
|
140
|
-
<slot :name="item.slot ? `${item.slot}-trailing`: 'item-trailing'" :item="item" :active="active" :index="index">
|
|
141
|
-
<UBadge
|
|
142
|
-
v-if="item.badge"
|
|
143
|
-
color="gray"
|
|
144
|
-
variant="outline"
|
|
145
|
-
:size="((props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()) as BadgeProps['size'])"
|
|
146
|
-
v-bind="(typeof item.badge === 'string' || typeof item.badge === 'number') ? { label: item.badge } : item.badge"
|
|
147
|
-
:class="ui.linkTrailingBadge({ class: props.ui?.linkTrailingBadge })"
|
|
148
|
-
/>
|
|
149
|
-
<UIcon v-if="item.children?.length && orientation === 'horizontal'" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
150
|
-
</slot>
|
|
151
|
-
</span>
|
|
152
|
-
</slot>
|
|
231
|
+
<ReuseItemTemplate :item="(item as T)" :active="active" :index="index" />
|
|
153
232
|
</ULinkBase>
|
|
154
233
|
</component>
|
|
155
234
|
|
|
156
|
-
<NavigationMenuContent v-if="item.children?.length
|
|
157
|
-
<
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
235
|
+
<NavigationMenuContent v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])" v-bind="contentProps" :class="ui.content({ class: props.ui?.content })">
|
|
236
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="(item as T)" :active="active" :index="index">
|
|
237
|
+
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
238
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: props.ui?.childItem })">
|
|
239
|
+
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
240
|
+
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
241
|
+
<ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, childItem.class], active: childActive })">
|
|
242
|
+
<UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: props.ui?.childLinkIcon, active: childActive })" />
|
|
243
|
+
|
|
244
|
+
<div :class="ui.childLinkWrapper({ class: props.ui?.childLinkWrapper })">
|
|
245
|
+
<p :class="ui.childLinkLabel({ class: props.ui?.childLinkLabel, active: childActive })">
|
|
246
|
+
{{ get(childItem, props.labelKey as string) }}
|
|
247
|
+
|
|
248
|
+
<UIcon v-if="childItem.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: props.ui?.childLinkLabelExternalIcon, active: childActive })" />
|
|
249
|
+
</p>
|
|
250
|
+
<p v-if="childItem.description" :class="ui.childLinkDescription({ class: props.ui?.childLinkDescription, active: childActive })">
|
|
251
|
+
{{ childItem.description }}
|
|
252
|
+
</p>
|
|
253
|
+
</div>
|
|
254
|
+
</ULinkBase>
|
|
255
|
+
</NavigationMenuLink>
|
|
256
|
+
</ULink>
|
|
257
|
+
</li>
|
|
258
|
+
</ul>
|
|
259
|
+
</slot>
|
|
179
260
|
</NavigationMenuContent>
|
|
180
261
|
</ULink>
|
|
181
|
-
|
|
262
|
+
|
|
263
|
+
<template v-if="orientation === 'vertical' && item.children?.length" #content>
|
|
264
|
+
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
265
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: props.ui?.childItem })">
|
|
266
|
+
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
267
|
+
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
268
|
+
<ULinkBase v-bind="childSlotProps" :class="ui.link({ class: [props.ui?.link, childItem.class], active: childActive, disabled: !!childItem.disabled })">
|
|
269
|
+
<ReuseItemTemplate :item="(childItem as T)" :active="childActive" :index="childIndex" />
|
|
270
|
+
</ULinkBase>
|
|
271
|
+
</NavigationMenuLink>
|
|
272
|
+
</ULink>
|
|
273
|
+
</li>
|
|
274
|
+
</ul>
|
|
275
|
+
</template>
|
|
276
|
+
</component>
|
|
182
277
|
</NavigationMenuList>
|
|
183
278
|
|
|
184
279
|
<div v-if="orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" />
|