@nuxt/ui 3.0.0-alpha.9 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/ui/accordion.ts +2 -2
- package/.nuxt/ui/alert.ts +122 -95
- package/.nuxt/ui/avatar-group.ts +14 -2
- package/.nuxt/ui/avatar.ts +16 -4
- package/.nuxt/ui/badge.ts +139 -93
- package/.nuxt/ui/breadcrumb.ts +5 -5
- package/.nuxt/ui/button-group.ts +13 -0
- package/.nuxt/ui/button.ts +167 -136
- package/.nuxt/ui/calendar.ts +103 -0
- package/.nuxt/ui/card.ts +27 -1
- package/.nuxt/ui/carousel.ts +7 -5
- package/.nuxt/ui/checkbox.ts +45 -27
- package/.nuxt/ui/chip.ts +44 -15
- package/.nuxt/ui/color-picker.ts +47 -0
- package/.nuxt/ui/command-palette.ts +28 -18
- package/.nuxt/ui/container.ts +1 -1
- package/.nuxt/ui/context-menu.ts +64 -46
- package/.nuxt/ui/drawer.ts +83 -15
- package/.nuxt/ui/dropdown-menu.ts +65 -47
- package/.nuxt/ui/form-field.ts +15 -7
- package/.nuxt/ui/index.ts +5 -1
- package/.nuxt/ui/input-menu.ts +150 -116
- package/.nuxt/ui/input-number.ts +102 -71
- package/.nuxt/ui/input.ts +111 -76
- package/.nuxt/ui/kbd.ts +18 -6
- package/.nuxt/ui/link.ts +3 -3
- package/.nuxt/ui/modal.ts +8 -7
- package/.nuxt/ui/navigation-menu.ts +244 -131
- package/.nuxt/ui/pin-input.ts +77 -51
- package/.nuxt/ui/popover.ts +2 -2
- package/.nuxt/ui/progress.ts +111 -72
- package/.nuxt/ui/radio-group.ts +45 -22
- package/.nuxt/ui/select-menu.ts +122 -86
- package/.nuxt/ui/select.ts +120 -84
- package/.nuxt/ui/separator.ts +60 -31
- package/.nuxt/ui/skeleton.ts +1 -1
- package/.nuxt/ui/slideover.ts +17 -9
- package/.nuxt/ui/slider.ts +61 -38
- package/.nuxt/ui/stepper.ts +202 -0
- package/.nuxt/ui/switch.ts +40 -22
- package/.nuxt/ui/table.ts +48 -31
- package/.nuxt/ui/tabs.ts +100 -72
- package/.nuxt/ui/textarea.ts +111 -76
- package/.nuxt/ui/toast.ts +53 -33
- package/.nuxt/ui/toaster.ts +31 -15
- package/.nuxt/ui/tooltip.ts +2 -2
- package/.nuxt/ui/tree.ts +154 -0
- package/.nuxt/ui.css +92 -0
- package/README.md +19 -8
- package/cli/commands/make/component.mjs +12 -0
- package/cli/package.json +2 -2
- package/cli/templates.mjs +27 -22
- package/dist/module.cjs +9 -171
- package/dist/module.d.cts +5 -15
- package/dist/module.d.mts +5 -15
- package/dist/module.d.ts +5 -15
- package/dist/module.json +2 -2
- package/dist/module.mjs +12 -168
- package/dist/runtime/components/Accordion.vue +8 -39
- package/dist/runtime/components/Alert.vue +22 -21
- package/dist/runtime/components/App.vue +9 -15
- package/dist/runtime/components/Avatar.vue +33 -21
- package/dist/runtime/components/AvatarGroup.vue +5 -7
- package/dist/runtime/components/Badge.vue +10 -8
- package/dist/runtime/components/Breadcrumb.vue +5 -31
- package/dist/runtime/components/Button.vue +5 -8
- package/dist/runtime/components/ButtonGroup.vue +5 -7
- package/dist/runtime/components/Calendar.vue +194 -0
- package/dist/runtime/components/Card.vue +10 -9
- package/dist/runtime/components/Carousel.vue +15 -10
- package/dist/runtime/components/Checkbox.vue +32 -38
- package/dist/runtime/components/Chip.vue +6 -8
- package/dist/runtime/components/Collapsible.vue +10 -11
- package/dist/runtime/components/ColorPicker.vue +297 -0
- package/dist/runtime/components/CommandPalette.vue +111 -97
- package/dist/runtime/components/Container.vue +4 -7
- package/dist/runtime/components/ContextMenu.vue +16 -69
- package/dist/runtime/components/ContextMenuContent.vue +12 -10
- package/dist/runtime/components/Drawer.vue +23 -12
- package/dist/runtime/components/DropdownMenu.vue +18 -59
- package/dist/runtime/components/DropdownMenuContent.vue +12 -10
- package/dist/runtime/components/Form.vue +65 -34
- package/dist/runtime/components/FormField.vue +22 -13
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +15 -7
- package/dist/runtime/components/InputMenu.vue +95 -104
- package/dist/runtime/components/InputNumber.vue +14 -9
- package/dist/runtime/components/Kbd.vue +5 -6
- package/dist/runtime/components/Link.vue +5 -8
- package/dist/runtime/components/LinkBase.vue +1 -1
- package/dist/runtime/components/Modal.vue +51 -38
- package/dist/runtime/components/NavigationMenu.vue +129 -114
- package/dist/runtime/components/OverlayProvider.vue +28 -0
- package/dist/runtime/components/Pagination.vue +6 -9
- package/dist/runtime/components/PinInput.vue +10 -11
- package/dist/runtime/components/Popover.vue +16 -18
- package/dist/runtime/components/Progress.vue +28 -12
- package/dist/runtime/components/RadioGroup.vue +9 -12
- package/dist/runtime/components/Select.vue +60 -34
- package/dist/runtime/components/SelectMenu.vue +160 -165
- package/dist/runtime/components/Separator.vue +6 -5
- package/dist/runtime/components/Skeleton.vue +4 -7
- package/dist/runtime/components/Slideover.vue +51 -37
- package/dist/runtime/components/Slider.vue +8 -7
- package/dist/runtime/components/Stepper.vue +170 -0
- package/dist/runtime/components/Switch.vue +19 -23
- package/dist/runtime/components/Table.vue +146 -31
- package/dist/runtime/components/Tabs.vue +12 -31
- package/dist/runtime/components/Textarea.vue +17 -8
- package/dist/runtime/components/Toast.vue +36 -25
- package/dist/runtime/components/Toaster.vue +10 -11
- package/dist/runtime/components/Tooltip.vue +9 -12
- package/dist/runtime/components/Tree.vue +196 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.js +2 -2
- package/dist/runtime/composables/useFormField.d.ts +7 -3
- package/dist/runtime/composables/useFormField.js +18 -8
- package/dist/runtime/composables/useLocale.js +1 -1
- package/dist/runtime/composables/useOverlay.d.ts +30 -0
- package/dist/runtime/composables/useOverlay.js +70 -0
- package/dist/runtime/composables/useToast.d.ts +4 -3
- package/dist/runtime/composables/useToast.js +20 -6
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -1
- package/dist/runtime/locale/ar.js +9 -1
- package/dist/runtime/locale/az.js +54 -0
- package/dist/runtime/locale/bn.js +54 -0
- package/dist/runtime/locale/cs.js +9 -1
- package/dist/runtime/locale/da.d.ts +2 -0
- package/dist/runtime/locale/da.js +54 -0
- package/dist/runtime/locale/de.js +11 -3
- package/dist/runtime/locale/el.d.ts +2 -0
- package/dist/runtime/locale/el.js +54 -0
- package/dist/runtime/locale/en.js +9 -1
- package/dist/runtime/locale/es.js +9 -1
- package/dist/runtime/locale/et.d.ts +2 -0
- package/dist/runtime/locale/et.js +54 -0
- package/dist/runtime/locale/fa_ir.js +9 -1
- package/dist/runtime/locale/fi.d.ts +2 -0
- package/dist/runtime/locale/fi.js +54 -0
- package/dist/runtime/locale/fr.js +9 -1
- package/dist/runtime/locale/he.d.ts +2 -0
- package/dist/runtime/locale/he.js +53 -0
- package/dist/runtime/locale/hi.d.ts +2 -0
- package/dist/runtime/locale/hi.js +54 -0
- package/dist/runtime/locale/hu.d.ts +2 -0
- package/dist/runtime/locale/hu.js +54 -0
- package/dist/runtime/locale/id.d.ts +2 -0
- package/dist/runtime/locale/id.js +54 -0
- package/dist/runtime/locale/index.d.ts +25 -3
- package/dist/runtime/locale/index.js +25 -3
- package/dist/runtime/locale/it.js +9 -1
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +54 -0
- package/dist/runtime/locale/km.d.ts +2 -0
- package/dist/runtime/locale/km.js +54 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +54 -0
- package/dist/runtime/locale/nb_no.d.ts +2 -0
- package/dist/runtime/locale/nb_no.js +54 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +54 -0
- package/dist/runtime/locale/pl.js +9 -1
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +54 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +54 -0
- package/dist/runtime/locale/ru.js +9 -1
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +54 -0
- package/dist/runtime/locale/sv.d.ts +2 -0
- package/dist/runtime/locale/sv.js +54 -0
- package/dist/runtime/locale/th.d.ts +2 -0
- package/dist/runtime/locale/th.js +54 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +54 -0
- package/dist/runtime/locale/uk.d.ts +2 -0
- package/dist/runtime/locale/uk.js +54 -0
- package/dist/runtime/locale/vi.d.ts +2 -0
- package/dist/runtime/locale/vi.js +54 -0
- package/dist/runtime/locale/zh_cn.d.ts +2 -0
- package/dist/runtime/locale/{zh_hans.js → zh_cn.js} +10 -2
- package/dist/runtime/locale/zh_tw.d.ts +2 -0
- package/dist/runtime/locale/{zh_hant.js → zh_tw.js} +16 -8
- package/dist/runtime/plugins/colors.js +8 -5
- package/dist/runtime/types/form.d.ts +24 -15
- package/dist/runtime/types/form.js +2 -2
- package/dist/runtime/types/index.d.ts +5 -0
- package/dist/runtime/types/index.js +5 -0
- package/dist/runtime/types/locale.d.ts +8 -0
- package/dist/runtime/types/utils.d.ts +7 -3
- package/dist/runtime/utils/form.d.ts +4 -4
- package/dist/runtime/utils/form.js +6 -8
- package/dist/runtime/utils/index.d.ts +1 -1
- package/dist/runtime/utils/index.js +15 -2
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/runtime/vue/components/Link.vue +87 -23
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +2 -0
- package/dist/runtime/vue/plugins/head.d.ts +1 -1
- package/dist/runtime/vue/plugins/head.js +3 -3
- package/dist/runtime/vue/stubs.d.ts +19 -0
- package/dist/runtime/vue/stubs.js +37 -0
- package/dist/shared/{ui.d52SSCwA.mjs → ui.DSPu6Y8j.mjs} +905 -401
- package/dist/shared/{ui.BPnAe4QS.cjs → ui.DfK2RX6G.cjs} +908 -401
- package/dist/unplugin.cjs +62 -26
- package/dist/unplugin.d.cts +13 -1
- package/dist/unplugin.d.mts +13 -1
- package/dist/unplugin.d.ts +13 -1
- package/dist/unplugin.mjs +61 -25
- package/dist/vite.cjs +3 -2
- package/dist/vite.d.cts +2 -0
- package/dist/vite.d.mts +2 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.mjs +3 -2
- package/package.json +103 -67
- package/dist/chunks/component-meta.cjs +0 -77249
- package/dist/chunks/component-meta.mjs +0 -77247
- package/dist/client/devtools/200.html +0 -1
- package/dist/client/devtools/404.html +0 -1
- 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 +0 -1
- package/dist/client/devtools/_nuxt/BT004Uxp.js +0 -53
- package/dist/client/devtools/_nuxt/C1H2Soz3.js +0 -1
- package/dist/client/devtools/_nuxt/builds/latest.json +0 -1
- package/dist/client/devtools/_nuxt/builds/meta/f98c13ea-d751-4b37-8ce3-94e99708745f.json +0 -1
- package/dist/client/devtools/_nuxt/entry.Bx6WJjrx.css +0 -1
- package/dist/client/devtools/_nuxt/error-404.Cq4qshcf.css +0 -1
- package/dist/client/devtools/_nuxt/error-500.ax1aM34m.css +0 -1
- package/dist/client/devtools/favicon.svg +0 -1
- package/dist/client/devtools/index.html +0 -1
- package/dist/devtools/runtime/DevtoolsRenderer.vue +0 -53
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +0 -7
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +0 -8
- package/dist/devtools/runtime/examples/CardExample.vue +0 -13
- package/dist/devtools/runtime/examples/CarouselExample.vue +0 -13
- package/dist/devtools/runtime/examples/ChipExample.vue +0 -5
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +0 -8
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +0 -29
- package/dist/devtools/runtime/examples/ContainerExample.vue +0 -5
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +0 -5
- package/dist/devtools/runtime/examples/DrawerExample.vue +0 -8
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +0 -5
- package/dist/devtools/runtime/examples/FormExample.vue +0 -30
- package/dist/devtools/runtime/examples/FormFieldExample.vue +0 -5
- package/dist/devtools/runtime/examples/LinkExample.vue +0 -5
- package/dist/devtools/runtime/examples/ModalExample.vue +0 -8
- package/dist/devtools/runtime/examples/PopoverExample.vue +0 -8
- package/dist/devtools/runtime/examples/SkeletonExample.vue +0 -3
- package/dist/devtools/runtime/examples/SlideoverExample.vue +0 -8
- package/dist/devtools/runtime/examples/ToasterExample.vue +0 -11
- package/dist/devtools/runtime/examples/TooltipExample.vue +0 -5
- package/dist/runtime/components/ModalProvider.vue +0 -12
- package/dist/runtime/components/SlideoverProvider.vue +0 -12
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +0 -7
- package/dist/runtime/composables/extendDevtoolsMeta.js +0 -2
- package/dist/runtime/composables/useModal.d.ts +0 -17
- package/dist/runtime/composables/useModal.js +0 -46
- package/dist/runtime/composables/useSlideover.d.ts +0 -17
- package/dist/runtime/composables/useSlideover.js +0 -46
- package/dist/runtime/plugins/modal.d.ts +0 -2
- package/dist/runtime/plugins/modal.js +0 -10
- package/dist/runtime/plugins/slideover.d.ts +0 -2
- package/dist/runtime/plugins/slideover.js +0 -10
- /package/dist/runtime/locale/{zh_hans.d.ts → az.d.ts} +0 -0
- /package/dist/runtime/locale/{zh_hant.d.ts → bn.d.ts} +0 -0
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'radix-vue'
|
|
2
|
+
import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'reka-ui'
|
|
4
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
4
|
import _appConfig from '#build/app.config'
|
|
6
5
|
import theme from '#build/ui/modal'
|
|
7
|
-
import {
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
8
7
|
import type { ButtonProps } from '../types'
|
|
9
8
|
|
|
10
|
-
const
|
|
9
|
+
const appConfigModal = _appConfig as AppConfig & { ui: { modal: Partial<typeof theme> } }
|
|
11
10
|
|
|
12
|
-
const modal = tv({ extend: tv(theme), ...(
|
|
11
|
+
const modal = tv({ extend: tv(theme), ...(appConfigModal.ui?.modal || {}) })
|
|
13
12
|
|
|
14
13
|
export interface ModalProps extends DialogRootProps {
|
|
15
14
|
title?: string
|
|
@@ -41,22 +40,24 @@ export interface ModalProps extends DialogRootProps {
|
|
|
41
40
|
* `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
|
|
42
41
|
* @defaultValue true
|
|
43
42
|
*/
|
|
44
|
-
close?:
|
|
43
|
+
close?: boolean | Partial<ButtonProps>
|
|
45
44
|
/**
|
|
46
45
|
* The icon displayed in the close button.
|
|
47
46
|
* @defaultValue appConfig.ui.icons.close
|
|
48
47
|
*/
|
|
49
48
|
closeIcon?: string
|
|
50
49
|
/**
|
|
51
|
-
* When `
|
|
52
|
-
* @defaultValue
|
|
50
|
+
* When `false`, the modal will not close when clicking outside or pressing escape.
|
|
51
|
+
* @defaultValue true
|
|
53
52
|
*/
|
|
54
|
-
|
|
53
|
+
dismissible?: boolean
|
|
55
54
|
class?: any
|
|
56
55
|
ui?: Partial<typeof modal.slots>
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
export interface ModalEmits extends DialogRootEmits {
|
|
58
|
+
export interface ModalEmits extends DialogRootEmits {
|
|
59
|
+
'after:leave': []
|
|
60
|
+
}
|
|
60
61
|
|
|
61
62
|
export interface ModalSlots {
|
|
62
63
|
default(props: { open: boolean }): any
|
|
@@ -68,13 +69,11 @@ export interface ModalSlots {
|
|
|
68
69
|
body(props?: {}): any
|
|
69
70
|
footer(props?: {}): any
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
-
extendDevtoolsMeta({ example: 'ModalExample' })
|
|
73
72
|
</script>
|
|
74
73
|
|
|
75
74
|
<script setup lang="ts">
|
|
76
75
|
import { computed, toRef } from 'vue'
|
|
77
|
-
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, useForwardPropsEmits } from '
|
|
76
|
+
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, VisuallyHidden, useForwardPropsEmits } from 'reka-ui'
|
|
78
77
|
import { reactivePick } from '@vueuse/core'
|
|
79
78
|
import { useAppConfig } from '#imports'
|
|
80
79
|
import { useLocale } from '../composables/useLocale'
|
|
@@ -85,34 +84,32 @@ const props = withDefaults(defineProps<ModalProps>(), {
|
|
|
85
84
|
portal: true,
|
|
86
85
|
overlay: true,
|
|
87
86
|
transition: true,
|
|
88
|
-
modal: true
|
|
87
|
+
modal: true,
|
|
88
|
+
dismissible: true
|
|
89
89
|
})
|
|
90
90
|
const emits = defineEmits<ModalEmits>()
|
|
91
91
|
const slots = defineSlots<ModalSlots>()
|
|
92
92
|
|
|
93
|
+
const { t } = useLocale()
|
|
94
|
+
const appConfig = useAppConfig()
|
|
95
|
+
|
|
93
96
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'modal'), emits)
|
|
94
97
|
const contentProps = toRef(() => props.content)
|
|
95
98
|
const contentEvents = computed(() => {
|
|
96
|
-
if (props.
|
|
99
|
+
if (!props.dismissible) {
|
|
97
100
|
return {
|
|
98
101
|
pointerDownOutside: (e: Event) => e.preventDefault(),
|
|
99
102
|
interactOutside: (e: Event) => e.preventDefault(),
|
|
100
|
-
escapeKeyDown: (e: Event) => e.preventDefault()
|
|
103
|
+
escapeKeyDown: (e: Event) => e.preventDefault(),
|
|
104
|
+
closeAutoFocus: (e: Event) => e.preventDefault()
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
return {
|
|
105
|
-
|
|
106
|
-
if (e.target instanceof Element && e.target.closest('[data-sonner-toaster]')) {
|
|
107
|
-
return e.preventDefault()
|
|
108
|
-
}
|
|
109
|
-
}
|
|
109
|
+
closeAutoFocus: (e: Event) => e.preventDefault()
|
|
110
110
|
}
|
|
111
111
|
})
|
|
112
112
|
|
|
113
|
-
const appConfig = useAppConfig()
|
|
114
|
-
const { t } = useLocale()
|
|
115
|
-
|
|
116
113
|
const ui = computed(() => modal({
|
|
117
114
|
transition: props.transition,
|
|
118
115
|
fullscreen: props.fullscreen
|
|
@@ -121,28 +118,44 @@ const ui = computed(() => modal({
|
|
|
121
118
|
|
|
122
119
|
<template>
|
|
123
120
|
<DialogRoot v-slot="{ open }" v-bind="rootProps">
|
|
124
|
-
<DialogTrigger v-if="!!slots.default" as-child>
|
|
121
|
+
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
125
122
|
<slot :open="open" />
|
|
126
123
|
</DialogTrigger>
|
|
127
124
|
|
|
128
125
|
<DialogPortal :disabled="!portal">
|
|
129
126
|
<DialogOverlay v-if="overlay" :class="ui.overlay({ class: props.ui?.overlay })" />
|
|
130
127
|
|
|
131
|
-
<DialogContent :class="ui.content({ class: [props.class, props.ui?.content] })" v-bind="contentProps" v-on="contentEvents">
|
|
128
|
+
<DialogContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" @after-leave="emits('after:leave')" v-on="contentEvents">
|
|
129
|
+
<VisuallyHidden v-if="!!slots.content && ((title || !!slots.title) || (description || !!slots.description))">
|
|
130
|
+
<DialogTitle v-if="title || !!slots.title">
|
|
131
|
+
<slot name="title">
|
|
132
|
+
{{ title }}
|
|
133
|
+
</slot>
|
|
134
|
+
</DialogTitle>
|
|
135
|
+
|
|
136
|
+
<DialogDescription v-if="description || !!slots.description">
|
|
137
|
+
<slot name="description">
|
|
138
|
+
{{ description }}
|
|
139
|
+
</slot>
|
|
140
|
+
</DialogDescription>
|
|
141
|
+
</VisuallyHidden>
|
|
142
|
+
|
|
132
143
|
<slot name="content">
|
|
133
144
|
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
134
145
|
<slot name="header">
|
|
135
|
-
<
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
147
|
+
<DialogTitle v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
|
148
|
+
<slot name="title">
|
|
149
|
+
{{ title }}
|
|
150
|
+
</slot>
|
|
151
|
+
</DialogTitle>
|
|
152
|
+
|
|
153
|
+
<DialogDescription v-if="description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
|
|
154
|
+
<slot name="description">
|
|
155
|
+
{{ description }}
|
|
156
|
+
</slot>
|
|
157
|
+
</DialogDescription>
|
|
158
|
+
</div>
|
|
146
159
|
|
|
147
160
|
<DialogClose as-child>
|
|
148
161
|
<slot name="close" :ui="ui">
|
|
@@ -153,7 +166,7 @@ const ui = computed(() => modal({
|
|
|
153
166
|
color="neutral"
|
|
154
167
|
variant="ghost"
|
|
155
168
|
:aria-label="t('modal.close')"
|
|
156
|
-
v-bind="typeof close === 'object' ? close :
|
|
169
|
+
v-bind="(typeof close === 'object' ? close as Partial<ButtonProps> : {})"
|
|
157
170
|
:class="ui.close({ class: props.ui?.close })"
|
|
158
171
|
/>
|
|
159
172
|
</slot>
|
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, CollapsibleRootProps } from '
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
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 {
|
|
7
|
+
import { tv } from '../utils/tv'
|
|
8
8
|
import type { AvatarProps, BadgeProps, LinkProps } from '../types'
|
|
9
9
|
import type { DynamicSlots, MaybeArrayOfArray, MaybeArrayOfArrayItem, PartialString } from '../types/utils'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const appConfigNavigationMenu = _appConfig as AppConfig & { ui: { navigationMenu: Partial<typeof theme> } }
|
|
12
12
|
|
|
13
|
-
const navigationMenu = tv({ extend: tv(theme), ...(
|
|
13
|
+
const navigationMenu = tv({ extend: tv(theme), ...(appConfigNavigationMenu.ui?.navigationMenu || {}) })
|
|
14
14
|
|
|
15
|
-
export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'children'> {
|
|
15
|
+
export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'children' | 'type'> {
|
|
16
16
|
/** Description is only used when `orientation` is `horizontal`. */
|
|
17
17
|
description?: string
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export interface NavigationMenuItem extends Omit<LinkProps, 'raw' | 'custom'>, Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> {
|
|
20
|
+
export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'>, Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> {
|
|
21
21
|
label?: string
|
|
22
22
|
icon?: string
|
|
23
23
|
avatar?: AvatarProps
|
|
24
|
+
/**
|
|
25
|
+
* Display a badge on the item.
|
|
26
|
+
* `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"}
|
|
27
|
+
*/
|
|
24
28
|
badge?: string | number | BadgeProps
|
|
25
29
|
trailingIcon?: string
|
|
30
|
+
/**
|
|
31
|
+
* The type of the item.
|
|
32
|
+
* The `label` type only works on `vertical` orientation.
|
|
33
|
+
* @defaultValue 'link'
|
|
34
|
+
*/
|
|
35
|
+
type?: 'label' | 'link'
|
|
26
36
|
slot?: string
|
|
27
37
|
value?: string
|
|
28
38
|
children?: NavigationMenuChildItem[]
|
|
@@ -31,7 +41,7 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'raw' | 'custom'>, P
|
|
|
31
41
|
|
|
32
42
|
type NavigationMenuVariants = VariantProps<typeof navigationMenu>
|
|
33
43
|
|
|
34
|
-
export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | '
|
|
44
|
+
export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'> {
|
|
35
45
|
/**
|
|
36
46
|
* The element or component this component should render as.
|
|
37
47
|
* @defaultValue 'div'
|
|
@@ -42,6 +52,12 @@ export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'd
|
|
|
42
52
|
* @defaultValue appConfig.ui.icons.chevronDown
|
|
43
53
|
*/
|
|
44
54
|
trailingIcon?: string
|
|
55
|
+
/**
|
|
56
|
+
* The icon displayed when the item is an external link.
|
|
57
|
+
* Set to `false` to hide the external icon.
|
|
58
|
+
* @defaultValue appConfig.ui.icons.external
|
|
59
|
+
*/
|
|
60
|
+
externalIcon?: boolean | string
|
|
45
61
|
items?: T
|
|
46
62
|
color?: NavigationMenuVariants['color']
|
|
47
63
|
variant?: NavigationMenuVariants['variant']
|
|
@@ -50,11 +66,23 @@ export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'd
|
|
|
50
66
|
* @defaultValue 'horizontal'
|
|
51
67
|
*/
|
|
52
68
|
orientation?: NavigationMenuRootProps['orientation']
|
|
69
|
+
/**
|
|
70
|
+
* Collapse the navigation menu to only show icons.
|
|
71
|
+
* Only works when `orientation` is `vertical`.
|
|
72
|
+
* @defaultValue false
|
|
73
|
+
*/
|
|
74
|
+
collapsed?: boolean
|
|
53
75
|
/** Display a line next to the active item. */
|
|
54
76
|
highlight?: boolean
|
|
55
77
|
highlightColor?: NavigationMenuVariants['highlightColor']
|
|
56
78
|
/** The content of the menu. */
|
|
57
79
|
content?: Omit<NavigationMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
80
|
+
/**
|
|
81
|
+
* The orientation of the content.
|
|
82
|
+
* Only works when `orientation` is `horizontal`.
|
|
83
|
+
* @defaultValue 'horizontal'
|
|
84
|
+
*/
|
|
85
|
+
contentOrientation?: NavigationMenuVariants['contentOrientation']
|
|
58
86
|
/**
|
|
59
87
|
* Display an arrow alongside the menu.
|
|
60
88
|
* @defaultValue false
|
|
@@ -80,51 +108,13 @@ export type NavigationMenuSlots<T extends { slot?: string }> = {
|
|
|
80
108
|
'item-trailing': SlotProps<T>
|
|
81
109
|
'item-content': SlotProps<T>
|
|
82
110
|
} & 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
|
-
})
|
|
122
111
|
</script>
|
|
123
112
|
|
|
124
113
|
<script setup lang="ts" generic="T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<NavigationMenuItem>">
|
|
125
|
-
import { computed,
|
|
126
|
-
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from '
|
|
114
|
+
import { computed, toRef } from 'vue'
|
|
115
|
+
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from 'reka-ui'
|
|
127
116
|
import { createReusableTemplate } from '@vueuse/core'
|
|
117
|
+
import { useAppConfig } from '#imports'
|
|
128
118
|
import { get } from '../utils'
|
|
129
119
|
import { pickLinkProps } from '../utils/link'
|
|
130
120
|
import ULinkBase from './LinkBase.vue'
|
|
@@ -136,27 +126,44 @@ import UCollapsible from './Collapsible.vue'
|
|
|
136
126
|
|
|
137
127
|
const props = withDefaults(defineProps<NavigationMenuProps<I>>(), {
|
|
138
128
|
orientation: 'horizontal',
|
|
129
|
+
contentOrientation: 'horizontal',
|
|
130
|
+
externalIcon: true,
|
|
139
131
|
delayDuration: 0,
|
|
132
|
+
unmountOnHide: true,
|
|
140
133
|
labelKey: 'label'
|
|
141
134
|
})
|
|
142
135
|
const emits = defineEmits<NavigationMenuEmits>()
|
|
143
136
|
const slots = defineSlots<NavigationMenuSlots<T>>()
|
|
144
137
|
|
|
145
|
-
const rootProps = useForwardPropsEmits(
|
|
138
|
+
const rootProps = useForwardPropsEmits(computed(() => ({
|
|
146
139
|
as: props.as,
|
|
147
140
|
modelValue: props.modelValue,
|
|
148
141
|
defaultValue: props.defaultValue,
|
|
149
142
|
delayDuration: props.delayDuration,
|
|
150
143
|
skipDelayDuration: props.skipDelayDuration,
|
|
151
|
-
orientation: props.orientation
|
|
152
|
-
|
|
144
|
+
orientation: props.orientation,
|
|
145
|
+
disableClickTrigger: props.disableClickTrigger,
|
|
146
|
+
disableHoverTrigger: props.disableHoverTrigger,
|
|
147
|
+
disablePointerLeaveClose: props.disablePointerLeaveClose,
|
|
148
|
+
unmountOnHide: props.unmountOnHide
|
|
149
|
+
})), emits)
|
|
153
150
|
|
|
154
151
|
const contentProps = toRef(() => props.content)
|
|
155
152
|
|
|
156
|
-
const
|
|
153
|
+
const appConfig = useAppConfig()
|
|
154
|
+
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate<{ item: NavigationMenuItem, index: number, active?: boolean }>()
|
|
155
|
+
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: NavigationMenuItem, index: number, level?: number }>({
|
|
156
|
+
props: {
|
|
157
|
+
item: Object,
|
|
158
|
+
index: Number,
|
|
159
|
+
level: Number
|
|
160
|
+
}
|
|
161
|
+
})
|
|
157
162
|
|
|
158
163
|
const ui = computed(() => navigationMenu({
|
|
159
164
|
orientation: props.orientation,
|
|
165
|
+
contentOrientation: props.contentOrientation,
|
|
166
|
+
collapsed: props.collapsed,
|
|
160
167
|
color: props.color,
|
|
161
168
|
variant: props.variant,
|
|
162
169
|
highlight: props.highlight,
|
|
@@ -167,22 +174,25 @@ const lists = computed(() => props.items?.length ? (Array.isArray(props.items[0]
|
|
|
167
174
|
</script>
|
|
168
175
|
|
|
169
176
|
<template>
|
|
170
|
-
<
|
|
177
|
+
<DefineLinkTemplate v-slot="{ item, active, index }">
|
|
171
178
|
<slot :name="item.slot || 'item'" :item="(item as T)" :index="index">
|
|
172
179
|
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="(item as T)" :active="active" :index="index">
|
|
173
180
|
<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 })" />
|
|
174
181
|
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active, disabled: !!item.disabled })" />
|
|
175
182
|
</slot>
|
|
176
183
|
|
|
177
|
-
<span
|
|
184
|
+
<span
|
|
185
|
+
v-if="(!collapsed || orientation !== 'vertical') && (get(item, props.labelKey as string) || !!slots[item.slot ? `${item.slot}-label` : 'item-label'])"
|
|
186
|
+
:class="ui.linkLabel({ class: props.ui?.linkLabel })"
|
|
187
|
+
>
|
|
178
188
|
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="(item as T)" :active="active" :index="index">
|
|
179
189
|
{{ get(item, props.labelKey as string) }}
|
|
180
190
|
</slot>
|
|
181
191
|
|
|
182
|
-
<UIcon v-if="item.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
|
|
192
|
+
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
|
|
183
193
|
</span>
|
|
184
194
|
|
|
185
|
-
<span v-if="item.badge || item.children?.length || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
|
|
195
|
+
<span v-if="(!collapsed || orientation !== 'vertical') && (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 })">
|
|
186
196
|
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="(item as T)" :active="active" :index="index">
|
|
187
197
|
<UBadge
|
|
188
198
|
v-if="item.badge"
|
|
@@ -194,79 +204,84 @@ const lists = computed(() => props.items?.length ? (Array.isArray(props.items[0]
|
|
|
194
204
|
/>
|
|
195
205
|
|
|
196
206
|
<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 })" />
|
|
207
|
+
<UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
197
208
|
</slot>
|
|
198
209
|
</span>
|
|
199
210
|
</slot>
|
|
200
|
-
</
|
|
211
|
+
</DefineLinkTemplate>
|
|
201
212
|
|
|
202
|
-
<
|
|
203
|
-
<
|
|
204
|
-
|
|
213
|
+
<DefineItemTemplate v-slot="{ item, index, level = 0 }">
|
|
214
|
+
<component
|
|
215
|
+
:is="(orientation === 'vertical' && item.children?.length && !collapsed) ? UCollapsible : NavigationMenuItem"
|
|
216
|
+
as="li"
|
|
217
|
+
:value="item.value || String(index)"
|
|
218
|
+
:default-open="item.defaultOpen"
|
|
219
|
+
:unmount-on-hide="(orientation === 'vertical' && item.children?.length && !collapsed) ? unmountOnHide : undefined"
|
|
220
|
+
:open="item.open"
|
|
221
|
+
>
|
|
222
|
+
<div v-if="orientation === 'vertical' && item.type === 'label'" :class="ui.label({ class: props.ui?.label })">
|
|
223
|
+
<ReuseLinkTemplate :item="(item as T)" :index="index" />
|
|
224
|
+
</div>
|
|
225
|
+
<ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="(orientation === 'vertical' && item.children?.length && !collapsed) ? {} : pickLinkProps(item as Omit<NavigationMenuItem, 'type'>)" custom>
|
|
205
226
|
<component
|
|
206
|
-
:is="(item.children?.length
|
|
207
|
-
|
|
208
|
-
:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
:default-open="item.defaultOpen"
|
|
212
|
-
:open="item.open"
|
|
213
|
-
:class="ui.item({ class: props.ui?.item })"
|
|
227
|
+
:is="(orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])) ? NavigationMenuTrigger : NavigationMenuLink"
|
|
228
|
+
as-child
|
|
229
|
+
:active="active || item.active"
|
|
230
|
+
:disabled="item.disabled"
|
|
231
|
+
@select="item.onSelect"
|
|
214
232
|
>
|
|
215
|
-
<
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
:active="active"
|
|
220
|
-
:disabled="item.disabled"
|
|
221
|
-
@select="item.onSelect"
|
|
222
|
-
>
|
|
223
|
-
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.class], active, disabled: !!item.disabled })">
|
|
224
|
-
<ReuseItemTemplate :item="(item as T)" :active="active" :index="index" />
|
|
225
|
-
</ULinkBase>
|
|
226
|
-
</component>
|
|
227
|
-
|
|
228
|
-
<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 })">
|
|
229
|
-
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="(item as T)" :active="active" :index="index">
|
|
230
|
-
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
231
|
-
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: props.ui?.childItem })">
|
|
232
|
-
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
233
|
-
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
234
|
-
<ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, childItem.class], active: childActive })">
|
|
235
|
-
<UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: props.ui?.childLinkIcon, active: childActive })" />
|
|
236
|
-
|
|
237
|
-
<div :class="ui.childLinkWrapper({ class: props.ui?.childLinkWrapper })">
|
|
238
|
-
<p :class="ui.childLinkLabel({ class: props.ui?.childLinkLabel, active: childActive })">
|
|
239
|
-
{{ get(childItem, props.labelKey as string) }}
|
|
240
|
-
|
|
241
|
-
<UIcon v-if="childItem.target === '_blank'" :name="appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: props.ui?.childLinkLabelExternalIcon, active: childActive })" />
|
|
242
|
-
</p>
|
|
243
|
-
<p v-if="childItem.description" :class="ui.childLinkDescription({ class: props.ui?.childLinkDescription, active: childActive })">
|
|
244
|
-
{{ childItem.description }}
|
|
245
|
-
</p>
|
|
246
|
-
</div>
|
|
247
|
-
</ULinkBase>
|
|
248
|
-
</NavigationMenuLink>
|
|
249
|
-
</ULink>
|
|
250
|
-
</li>
|
|
251
|
-
</ul>
|
|
252
|
-
</slot>
|
|
253
|
-
</NavigationMenuContent>
|
|
254
|
-
</ULink>
|
|
233
|
+
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: orientation === 'horizontal' || level > 0 })">
|
|
234
|
+
<ReuseLinkTemplate :item="(item as T)" :active="active || item.active" :index="index" />
|
|
235
|
+
</ULinkBase>
|
|
236
|
+
</component>
|
|
255
237
|
|
|
256
|
-
|
|
238
|
+
<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 })">
|
|
239
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="(item as T)" :active="active" :index="index">
|
|
257
240
|
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
258
241
|
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: props.ui?.childItem })">
|
|
259
242
|
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
260
243
|
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
261
|
-
<ULinkBase v-bind="childSlotProps" :class="ui.
|
|
262
|
-
<
|
|
244
|
+
<ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, childItem.class], active: childActive })">
|
|
245
|
+
<UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: props.ui?.childLinkIcon, active: childActive })" />
|
|
246
|
+
|
|
247
|
+
<div :class="ui.childLinkWrapper({ class: props.ui?.childLinkWrapper })">
|
|
248
|
+
<p :class="ui.childLinkLabel({ class: props.ui?.childLinkLabel, active: childActive })">
|
|
249
|
+
{{ get(childItem, props.labelKey as string) }}
|
|
250
|
+
|
|
251
|
+
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: props.ui?.childLinkLabelExternalIcon, active: childActive })" />
|
|
252
|
+
</p>
|
|
253
|
+
<p v-if="childItem.description" :class="ui.childLinkDescription({ class: props.ui?.childLinkDescription, active: childActive })">
|
|
254
|
+
{{ childItem.description }}
|
|
255
|
+
</p>
|
|
256
|
+
</div>
|
|
263
257
|
</ULinkBase>
|
|
264
258
|
</NavigationMenuLink>
|
|
265
259
|
</ULink>
|
|
266
260
|
</li>
|
|
267
261
|
</ul>
|
|
268
|
-
</
|
|
269
|
-
</
|
|
262
|
+
</slot>
|
|
263
|
+
</NavigationMenuContent>
|
|
264
|
+
</ULink>
|
|
265
|
+
|
|
266
|
+
<template v-if="orientation === 'vertical' && item.children?.length && !collapsed" #content>
|
|
267
|
+
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
268
|
+
<ReuseItemTemplate
|
|
269
|
+
v-for="(childItem, childIndex) in item.children"
|
|
270
|
+
:key="childIndex"
|
|
271
|
+
:item="childItem"
|
|
272
|
+
:index="childIndex"
|
|
273
|
+
:level="level + 1"
|
|
274
|
+
:class="ui.childItem({ class: props.ui?.childItem })"
|
|
275
|
+
/>
|
|
276
|
+
</ul>
|
|
277
|
+
</template>
|
|
278
|
+
</component>
|
|
279
|
+
</DefineItemTemplate>
|
|
280
|
+
|
|
281
|
+
<NavigationMenuRoot v-bind="rootProps" :data-collapsed="collapsed" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
282
|
+
<template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
|
|
283
|
+
<NavigationMenuList :class="ui.list({ class: props.ui?.list })">
|
|
284
|
+
<ReuseItemTemplate v-for="(item, index) in list" :key="`list-${listIndex}-${index}`" :item="item" :index="index" :class="ui.item({ class: props.ui?.item })" />
|
|
270
285
|
</NavigationMenuList>
|
|
271
286
|
|
|
272
287
|
<div v-if="orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" />
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useOverlay, type Overlay } from '../composables/useOverlay'
|
|
3
|
+
|
|
4
|
+
const { overlays, unMount, close } = useOverlay()
|
|
5
|
+
|
|
6
|
+
const mountedOverlays = computed(() => overlays.filter((overlay: Overlay) => overlay.isMounted))
|
|
7
|
+
|
|
8
|
+
const onAfterLeave = (id: symbol) => {
|
|
9
|
+
close(id)
|
|
10
|
+
unMount(id)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const onClose = (id: symbol, value: any) => {
|
|
14
|
+
close(id, value)
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<component
|
|
20
|
+
:is="overlay.component"
|
|
21
|
+
v-for="overlay in mountedOverlays"
|
|
22
|
+
:key="overlay.id"
|
|
23
|
+
v-bind="overlay.props"
|
|
24
|
+
v-model:open="overlay.modelValue"
|
|
25
|
+
@close="(value:any) => onClose(overlay.id, value)"
|
|
26
|
+
@after:leave="onAfterLeave(overlay.id)"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { PaginationRootProps, PaginationRootEmits } from 'radix-vue'
|
|
2
|
+
import type { PaginationRootProps, PaginationRootEmits } from 'reka-ui'
|
|
4
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
4
|
import type { RouteLocationRaw } from '#vue-router'
|
|
6
5
|
import _appConfig from '#build/app.config'
|
|
7
6
|
import theme from '#build/ui/pagination'
|
|
8
|
-
import {
|
|
7
|
+
import { tv } from '../utils/tv'
|
|
9
8
|
import type { ButtonProps } from '../types'
|
|
10
9
|
|
|
11
|
-
const
|
|
10
|
+
const appConfigPagination = _appConfig as AppConfig & { ui: { pagination: Partial<typeof theme> } }
|
|
12
11
|
|
|
13
|
-
const pagination = tv({ extend: tv(theme), ...(
|
|
12
|
+
const pagination = tv({ extend: tv(theme), ...(appConfigPagination.ui?.pagination || {}) })
|
|
14
13
|
|
|
15
|
-
export interface PaginationProps extends Pick<PaginationRootProps, 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'
|
|
14
|
+
export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'>> {
|
|
16
15
|
/**
|
|
17
16
|
* The element or component this component should render as.
|
|
18
17
|
* @defaultValue 'div'
|
|
@@ -98,13 +97,11 @@ export interface PaginationSlots {
|
|
|
98
97
|
index: number
|
|
99
98
|
}): any
|
|
100
99
|
}
|
|
101
|
-
|
|
102
|
-
extendDevtoolsMeta({ defaultProps: { total: 50 } })
|
|
103
100
|
</script>
|
|
104
101
|
|
|
105
102
|
<script setup lang="ts">
|
|
106
103
|
import { computed } from 'vue'
|
|
107
|
-
import { PaginationRoot, PaginationList, PaginationListItem, PaginationFirst, PaginationPrev, PaginationEllipsis, PaginationNext, PaginationLast, useForwardPropsEmits } from '
|
|
104
|
+
import { PaginationRoot, PaginationList, PaginationListItem, PaginationFirst, PaginationPrev, PaginationEllipsis, PaginationNext, PaginationLast, useForwardPropsEmits } from 'reka-ui'
|
|
108
105
|
import { reactivePick } from '@vueuse/core'
|
|
109
106
|
import { useAppConfig } from '#imports'
|
|
110
107
|
import { useLocale } from '../composables/useLocale'
|