@byyuurin/ui 0.0.11 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -58
- package/dist/module.d.mts +4 -13
- package/dist/module.json +4 -4
- package/dist/module.mjs +54 -20
- package/dist/runtime/components/Accordion.vue +28 -23
- package/dist/runtime/components/Accordion.vue.d.ts +51 -29
- package/dist/runtime/components/Alert.vue +47 -27
- package/dist/runtime/components/Alert.vue.d.ts +37 -25
- package/dist/runtime/components/App.vue +9 -8
- package/dist/runtime/components/App.vue.d.ts +22 -20
- package/dist/runtime/components/Avatar.vue +65 -21
- package/dist/runtime/components/Avatar.vue.d.ts +27 -13
- package/dist/runtime/components/AvatarGroup.vue +14 -10
- package/dist/runtime/components/AvatarGroup.vue.d.ts +12 -9
- package/dist/runtime/components/Badge.vue +64 -32
- package/dist/runtime/components/Badge.vue.d.ts +30 -29
- package/dist/runtime/components/Breadcrumb.vue +40 -22
- package/dist/runtime/components/Breadcrumb.vue.d.ts +48 -21
- package/dist/runtime/components/Button.vue +113 -52
- package/dist/runtime/components/Button.vue.d.ts +36 -20
- package/dist/runtime/components/Calendar.vue +50 -43
- package/dist/runtime/components/Calendar.vue.d.ts +58 -31
- package/dist/runtime/components/Card.vue +18 -14
- package/dist/runtime/components/Card.vue.d.ts +18 -14
- package/dist/runtime/components/Carousel.vue +99 -46
- package/dist/runtime/components/Carousel.vue.d.ts +46 -25
- package/dist/runtime/components/Checkbox.vue +60 -35
- package/dist/runtime/components/Checkbox.vue.d.ts +35 -28
- package/dist/runtime/components/CheckboxGroup.vue +131 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +89 -0
- package/dist/runtime/components/Chip.vue +35 -32
- package/dist/runtime/components/Chip.vue.d.ts +33 -15
- package/dist/runtime/components/Collapsible.vue +13 -9
- package/dist/runtime/components/Collapsible.vue.d.ts +16 -8
- package/dist/runtime/components/Drawer.vue +80 -70
- package/dist/runtime/components/Drawer.vue.d.ts +51 -28
- package/dist/runtime/components/DropdownMenu.vue +23 -16
- package/dist/runtime/components/DropdownMenu.vue.d.ts +77 -36
- package/dist/runtime/components/DropdownMenuContent.vue +136 -106
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +38 -26
- package/dist/runtime/components/FieldGroup.vue +33 -0
- package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Form.vue +172 -88
- package/dist/runtime/components/Form.vue.d.ts +69 -44
- package/dist/runtime/components/FormField.vue +108 -0
- package/dist/runtime/components/FormField.vue.d.ts +63 -0
- package/dist/runtime/components/Icon.vue +20 -0
- package/dist/runtime/components/Icon.vue.d.ts +9 -0
- package/dist/runtime/components/Input.vue +84 -79
- package/dist/runtime/components/Input.vue.d.ts +55 -43
- package/dist/runtime/components/InputNumber.vue +66 -52
- package/dist/runtime/components/InputNumber.vue.d.ts +50 -109
- package/dist/runtime/components/InputTags.vue +155 -0
- package/dist/runtime/components/InputTags.vue.d.ts +85 -0
- package/dist/runtime/components/Kbd.vue +11 -5
- package/dist/runtime/components/Kbd.vue.d.ts +17 -11
- package/dist/runtime/components/Link.vue +54 -197
- package/dist/runtime/components/Link.vue.d.ts +17 -17
- package/dist/runtime/components/LinkBase.vue +11 -33
- package/dist/runtime/components/LinkBase.vue.d.ts +8 -3
- package/dist/runtime/components/Marquee.vue +38 -0
- package/dist/runtime/components/Marquee.vue.d.ts +54 -0
- package/dist/runtime/components/Modal.vue +53 -39
- package/dist/runtime/components/Modal.vue.d.ts +64 -34
- package/dist/runtime/components/NavigationMenu.vue +345 -0
- package/dist/runtime/components/NavigationMenu.vue.d.ts +216 -0
- package/dist/runtime/components/OverlayProvider.vue +3 -3
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -1
- package/dist/runtime/components/Pagination.vue +39 -47
- package/dist/runtime/components/Pagination.vue.d.ts +54 -31
- package/dist/runtime/components/PinInput.vue +46 -32
- package/dist/runtime/components/PinInput.vue.d.ts +40 -21
- package/dist/runtime/components/Popover.vue +33 -19
- package/dist/runtime/components/Popover.vue.d.ts +57 -32
- package/dist/runtime/components/Progress.vue +31 -26
- package/dist/runtime/components/Progress.vue.d.ts +32 -23
- package/dist/runtime/components/RadioGroup.vue +75 -48
- package/dist/runtime/components/RadioGroup.vue.d.ts +58 -36
- package/dist/runtime/components/ScrollArea.vue +33 -31
- package/dist/runtime/components/ScrollArea.vue.d.ts +9 -5
- package/dist/runtime/components/Select.vue +166 -76
- package/dist/runtime/components/Select.vue.d.ts +206 -65
- package/dist/runtime/components/Separator.vue +42 -16
- package/dist/runtime/components/Separator.vue.d.ts +35 -14
- package/dist/runtime/components/Skeleton.vue +18 -6
- package/dist/runtime/components/Skeleton.vue.d.ts +4 -4
- package/dist/runtime/components/Slider.vue +42 -24
- package/dist/runtime/components/Slider.vue.d.ts +43 -27
- package/dist/runtime/components/Switch.vue +40 -31
- package/dist/runtime/components/Switch.vue.d.ts +36 -27
- package/dist/runtime/components/Table.vue +329 -79
- package/dist/runtime/components/Table.vue.d.ts +152 -66
- package/dist/runtime/components/Tabs.vue +70 -23
- package/dist/runtime/components/Tabs.vue.d.ts +61 -29
- package/dist/runtime/components/Textarea.vue +102 -54
- package/dist/runtime/components/Textarea.vue.d.ts +57 -41
- package/dist/runtime/components/Timeline.vue +102 -0
- package/dist/runtime/components/Timeline.vue.d.ts +74 -0
- package/dist/runtime/components/Toast.vue +84 -38
- package/dist/runtime/components/Toast.vue.d.ts +48 -27
- package/dist/runtime/components/ToastProvider.vue +31 -22
- package/dist/runtime/components/ToastProvider.vue.d.ts +30 -17
- package/dist/runtime/components/Tooltip.vue +33 -21
- package/dist/runtime/components/Tooltip.vue.d.ts +37 -15
- package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
- package/dist/runtime/composables/defineShortcuts.js +129 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
- package/dist/runtime/composables/useAvatarGroup.js +10 -3
- package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
- package/dist/runtime/composables/useComponentIcons.js +4 -4
- package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
- package/dist/runtime/composables/useFieldGroup.js +14 -0
- package/dist/runtime/composables/useFormField.d.ts +62 -0
- package/dist/runtime/composables/useFormField.js +99 -0
- package/dist/runtime/composables/useKbd.d.ts +3 -2
- package/dist/runtime/composables/useKbd.js +3 -2
- package/dist/runtime/composables/useLocale.d.ts +68 -5
- package/dist/runtime/composables/useLocale.js +11 -11
- package/dist/runtime/composables/useOverlay.d.ts +51 -15
- package/dist/runtime/composables/useOverlay.js +44 -30
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/composables/useToast.d.ts +12 -5
- package/dist/runtime/composables/useToast.js +12 -7
- package/dist/runtime/locale/en.d.ts +30 -1
- package/dist/runtime/locale/en.js +2 -1
- package/dist/runtime/locale/index.d.ts +2 -2
- package/dist/runtime/locale/index.js +1 -1
- package/dist/runtime/locale/zh_tw.d.ts +31 -0
- package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.js +50 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/form.d.ts +58 -17
- package/dist/runtime/types/form.js +11 -0
- package/dist/runtime/types/index.d.ts +56 -8
- package/dist/runtime/types/index.js +49 -1
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/locale.d.ts +5 -0
- package/dist/runtime/types/style.d.ts +33 -0
- package/dist/runtime/types/style.js +0 -0
- package/dist/runtime/types/unocss.d.ts +4 -0
- package/dist/runtime/types/utils.d.ts +41 -37
- package/dist/runtime/utils/form.d.ts +5 -1
- package/dist/runtime/utils/form.js +49 -0
- package/dist/runtime/utils/index.d.ts +10 -13
- package/dist/runtime/utils/index.js +41 -48
- package/dist/runtime/utils/link.d.ts +3 -2
- package/dist/runtime/utils/link.js +16 -2
- package/dist/runtime/utils/locale.d.ts +5 -0
- package/dist/runtime/utils/locale.js +10 -0
- package/dist/runtime/utils/style.d.ts +94 -0
- package/dist/runtime/utils/style.js +37 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
- package/dist/runtime/vue/components/Link.vue +163 -0
- package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +4 -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 +9 -0
- package/dist/runtime/vue/stubs.d.ts +16 -1
- package/dist/runtime/vue/stubs.js +32 -1
- package/dist/setup.d.mts +13 -0
- package/dist/setup.mjs +12 -0
- package/dist/shared/ui.CzIlLITK.mjs +51 -0
- package/dist/shared/ui.DLOxhmP0.mjs +4242 -0
- package/dist/shared/ui.DpbffTXs.d.mts +84 -0
- package/dist/shared/ui.IulR-OYx.d.mts +64 -0
- package/dist/types.d.mts +3 -1
- package/dist/unocss.d.mts +12 -52
- package/dist/unocss.mjs +144 -254
- package/dist/unplugin.d.mts +13 -26
- package/dist/unplugin.mjs +193 -18
- package/dist/vite.d.mts +10 -1
- package/dist/vite.mjs +12 -3
- package/package.json +154 -87
- package/vue-plugin.d.ts +5 -0
- package/dist/module.d.ts +0 -13
- package/dist/module.mjs.map +0 -1
- package/dist/runtime/app/injections.d.ts +0 -9331
- package/dist/runtime/app/injections.js +0 -61
- package/dist/runtime/components/ButtonGroup.vue +0 -26
- package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -26
- package/dist/runtime/components/FormItem.vue +0 -90
- package/dist/runtime/components/FormItem.vue.d.ts +0 -60
- package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
- package/dist/runtime/composables/useButtonGroup.js +0 -9
- package/dist/runtime/composables/useFormItem.d.ts +0 -27
- package/dist/runtime/composables/useFormItem.js +0 -64
- package/dist/runtime/composables/useTheme.d.ts +0 -9
- package/dist/runtime/composables/useTheme.js +0 -23
- package/dist/runtime/index.d.ts +0 -44
- package/dist/runtime/index.js +0 -44
- package/dist/runtime/locale/zh-tw.d.ts +0 -2
- package/dist/runtime/theme/accordion.d.ts +0 -50
- package/dist/runtime/theme/accordion.js +0 -28
- package/dist/runtime/theme/alert.d.ts +0 -119
- package/dist/runtime/theme/alert.js +0 -47
- package/dist/runtime/theme/app.d.ts +0 -19
- package/dist/runtime/theme/app.js +0 -19
- package/dist/runtime/theme/avatar-group.d.ts +0 -46
- package/dist/runtime/theme/avatar-group.js +0 -32
- package/dist/runtime/theme/avatar.d.ts +0 -50
- package/dist/runtime/theme/avatar.js +0 -34
- package/dist/runtime/theme/badge.d.ts +0 -76
- package/dist/runtime/theme/badge.js +0 -92
- package/dist/runtime/theme/breadcrumb.d.ts +0 -61
- package/dist/runtime/theme/breadcrumb.js +0 -44
- package/dist/runtime/theme/button-group.d.ts +0 -60
- package/dist/runtime/theme/button-group.js +0 -42
- package/dist/runtime/theme/button.d.ts +0 -184
- package/dist/runtime/theme/button.js +0 -164
- package/dist/runtime/theme/calendar.d.ts +0 -58
- package/dist/runtime/theme/calendar.js +0 -86
- package/dist/runtime/theme/card.d.ts +0 -56
- package/dist/runtime/theme/card.js +0 -37
- package/dist/runtime/theme/carousel.d.ts +0 -107
- package/dist/runtime/theme/carousel.js +0 -43
- package/dist/runtime/theme/checkbox.d.ts +0 -82
- package/dist/runtime/theme/checkbox.js +0 -54
- package/dist/runtime/theme/chip.d.ts +0 -61
- package/dist/runtime/theme/chip.js +0 -66
- package/dist/runtime/theme/collapsible.d.ts +0 -32
- package/dist/runtime/theme/collapsible.js +0 -10
- package/dist/runtime/theme/drawer.d.ts +0 -142
- package/dist/runtime/theme/drawer.js +0 -113
- package/dist/runtime/theme/dropdown-menu.d.ts +0 -65
- package/dist/runtime/theme/dropdown-menu.js +0 -83
- package/dist/runtime/theme/form-item.d.ts +0 -70
- package/dist/runtime/theme/form-item.js +0 -34
- package/dist/runtime/theme/form.d.ts +0 -2
- package/dist/runtime/theme/form.js +0 -7
- package/dist/runtime/theme/index.d.ts +0 -41
- package/dist/runtime/theme/index.js +0 -41
- package/dist/runtime/theme/input-number.d.ts +0 -115
- package/dist/runtime/theme/input-number.js +0 -95
- package/dist/runtime/theme/input.d.ts +0 -172
- package/dist/runtime/theme/input.js +0 -151
- package/dist/runtime/theme/kbd.d.ts +0 -33
- package/dist/runtime/theme/kbd.js +0 -26
- package/dist/runtime/theme/link.d.ts +0 -38
- package/dist/runtime/theme/link.js +0 -26
- package/dist/runtime/theme/modal.d.ts +0 -42
- package/dist/runtime/theme/modal.js +0 -55
- package/dist/runtime/theme/pagination.d.ts +0 -74
- package/dist/runtime/theme/pagination.js +0 -17
- package/dist/runtime/theme/pinInput.d.ts +0 -94
- package/dist/runtime/theme/pinInput.js +0 -111
- package/dist/runtime/theme/popover.d.ts +0 -32
- package/dist/runtime/theme/popover.js +0 -13
- package/dist/runtime/theme/progress.d.ts +0 -180
- package/dist/runtime/theme/progress.js +0 -95
- package/dist/runtime/theme/radio-group.d.ts +0 -104
- package/dist/runtime/theme/radio-group.js +0 -61
- package/dist/runtime/theme/scroll-area.d.ts +0 -67
- package/dist/runtime/theme/scroll-area.js +0 -33
- package/dist/runtime/theme/select.d.ts +0 -186
- package/dist/runtime/theme/select.js +0 -173
- package/dist/runtime/theme/separator.d.ts +0 -74
- package/dist/runtime/theme/separator.js +0 -53
- package/dist/runtime/theme/skeleton.d.ts +0 -2
- package/dist/runtime/theme/skeleton.js +0 -7
- package/dist/runtime/theme/slider.d.ts +0 -70
- package/dist/runtime/theme/slider.js +0 -52
- package/dist/runtime/theme/switch.d.ts +0 -116
- package/dist/runtime/theme/switch.js +0 -78
- package/dist/runtime/theme/table.d.ts +0 -86
- package/dist/runtime/theme/table.js +0 -36
- package/dist/runtime/theme/tabs.d.ts +0 -129
- package/dist/runtime/theme/tabs.js +0 -146
- package/dist/runtime/theme/textarea.d.ts +0 -90
- package/dist/runtime/theme/textarea.js +0 -116
- package/dist/runtime/theme/toast-provider.d.ts +0 -116
- package/dist/runtime/theme/toast-provider.js +0 -97
- package/dist/runtime/theme/toast.d.ts +0 -83
- package/dist/runtime/theme/toast.js +0 -35
- package/dist/runtime/theme/tooltip.d.ts +0 -38
- package/dist/runtime/theme/tooltip.js +0 -11
- package/dist/runtime/types/components.d.ts +0 -42
- package/dist/runtime/utils/extend-theme.d.ts +0 -9
- package/dist/runtime/utils/extend-theme.js +0 -27
- package/dist/runtime/utils/styler.d.ts +0 -4
- package/dist/runtime/utils/styler.js +0 -10
- package/dist/runtime/utils/translator.d.ts +0 -18
- package/dist/runtime/utils/translator.js +0 -8
- package/dist/shared/ui.D1BTWZFB.mjs +0 -5
- package/dist/shared/ui.D1BTWZFB.mjs.map +0 -1
- package/dist/unocss.d.ts +0 -52
- package/dist/unocss.mjs.map +0 -1
- package/dist/unplugin.d.ts +0 -26
- package/dist/unplugin.mjs.map +0 -1
- package/dist/vite.d.ts +0 -9
- package/dist/vite.mjs.map +0 -1
- /package/dist/runtime/types/{components.js → input.js} +0 -0
|
@@ -1,79 +1,92 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
2
|
+
import theme from "#build/ui/modal";
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { reactivePick } from "@vueuse/core";
|
|
7
7
|
import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, useForwardPropsEmits, VisuallyHidden } from "reka-ui";
|
|
8
8
|
import { computed, toRef } from "vue";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
9
10
|
import { useLocale } from "../composables/useLocale";
|
|
10
|
-
import {
|
|
11
|
+
import { usePortal } from "../composables/usePortal";
|
|
12
|
+
import { cv, merge } from "../utils/style";
|
|
11
13
|
import Button from "./Button.vue";
|
|
12
14
|
const props = defineProps({
|
|
13
15
|
title: { type: String, required: false },
|
|
14
16
|
description: { type: String, required: false },
|
|
15
|
-
size: { type: null, required: false },
|
|
16
17
|
content: { type: Object, required: false },
|
|
17
|
-
portal: { type: Boolean, required: false, default: true },
|
|
18
18
|
overlay: { type: Boolean, required: false, default: true },
|
|
19
19
|
transition: { type: Boolean, required: false, default: true },
|
|
20
|
+
fullscreen: { type: Boolean, required: false },
|
|
21
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
22
|
+
close: { type: [Boolean, Object], required: false, default: true },
|
|
23
|
+
closeIcon: { type: [String, Object], required: false },
|
|
20
24
|
dismissible: { type: Boolean, required: false, default: true },
|
|
21
|
-
close: { type: [Object, Boolean], required: false, default: true },
|
|
22
|
-
closeIcon: { type: String, required: false },
|
|
23
|
-
class: { type: null, required: false },
|
|
24
25
|
ui: { type: null, required: false },
|
|
26
|
+
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
25
27
|
open: { type: Boolean, required: false },
|
|
26
28
|
defaultOpen: { type: Boolean, required: false },
|
|
27
29
|
modal: { type: Boolean, required: false, default: true }
|
|
28
30
|
});
|
|
29
|
-
const emit = defineEmits(["after-leave", "update:open"]);
|
|
31
|
+
const emit = defineEmits(["after-leave", "after-enter", "close-prevent", "update:open"]);
|
|
30
32
|
const slots = defineSlots();
|
|
31
33
|
const rootProps = useForwardPropsEmits(reactivePick(props, "open", "defaultOpen", "modal"), emit);
|
|
32
|
-
const
|
|
34
|
+
const portalProps = usePortal(toRef(() => props.portal));
|
|
35
|
+
const contentProps = computed(() => ({
|
|
33
36
|
...props.content,
|
|
34
|
-
|
|
37
|
+
...!!slots.content || !!slots.header || !props.description && !slots.description ? { "aria-describedby": void 0 } : {}
|
|
35
38
|
}));
|
|
36
39
|
const contentEvents = computed(() => {
|
|
37
40
|
if (props.dismissible)
|
|
38
41
|
return {};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"];
|
|
43
|
+
return events.reduce((acc, curr) => {
|
|
44
|
+
acc[curr] = (e) => {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
emit("close-prevent");
|
|
47
|
+
};
|
|
48
|
+
return acc;
|
|
49
|
+
}, {});
|
|
44
50
|
});
|
|
45
51
|
const { t } = useLocale();
|
|
46
|
-
const
|
|
47
|
-
const
|
|
52
|
+
const appConfig = useAppConfig();
|
|
53
|
+
const ui = computed(() => {
|
|
54
|
+
const styler = cv(merge(theme, appConfig.ui.modal));
|
|
55
|
+
return styler(props);
|
|
56
|
+
});
|
|
48
57
|
</script>
|
|
49
58
|
|
|
50
59
|
<template>
|
|
51
|
-
<DialogRoot v-slot="{ open }" v-bind="rootProps">
|
|
52
|
-
<DialogTrigger
|
|
53
|
-
v-if="slots.default"
|
|
54
|
-
:class="props.class"
|
|
55
|
-
as-child
|
|
56
|
-
>
|
|
60
|
+
<DialogRoot v-slot="{ open, close }" v-bind="rootProps">
|
|
61
|
+
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
57
62
|
<slot :open="open"></slot>
|
|
58
63
|
</DialogTrigger>
|
|
59
|
-
<DialogPortal :disabled="!props.portal">
|
|
60
|
-
<DialogOverlay v-if="props.overlay" :class="style.overlay({ class: props.ui?.overlay })" data-part="overlay" />
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
<DialogPortal v-bind="portalProps">
|
|
66
|
+
<DialogOverlay v-if="props.overlay" :class="ui.overlay({ class: props.ui?.overlay })" data-part="overlay" />
|
|
67
|
+
|
|
68
|
+
<DialogContent
|
|
69
|
+
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
70
|
+
v-bind="contentProps"
|
|
71
|
+
data-part="content"
|
|
72
|
+
@after-enter="emit('after-enter')"
|
|
73
|
+
@after-leave="emit('after-leave')"
|
|
74
|
+
v-on="contentEvents"
|
|
75
|
+
>
|
|
76
|
+
<VisuallyHidden v-if="!!slots.content || !!slots.header || !props.title && !slots.title">
|
|
64
77
|
<DialogTitle />
|
|
65
78
|
</VisuallyHidden>
|
|
66
79
|
|
|
67
|
-
<slot name="content">
|
|
80
|
+
<slot name="content" :close="close">
|
|
68
81
|
<div
|
|
69
82
|
v-if="slots.header || props.title || slots.title || props.description || slots.description || props.close || slots.close"
|
|
70
|
-
:class="
|
|
83
|
+
:class="ui.header({ class: props.ui?.header })"
|
|
71
84
|
data-part="header"
|
|
72
85
|
>
|
|
73
|
-
<slot name="header">
|
|
86
|
+
<slot name="header" :close="close">
|
|
74
87
|
<DialogTitle
|
|
75
88
|
v-if="props.title || slots.title"
|
|
76
|
-
:class="
|
|
89
|
+
:class="ui.title({ class: props.ui?.title })"
|
|
77
90
|
data-part="title"
|
|
78
91
|
>
|
|
79
92
|
<slot name="title">
|
|
@@ -82,13 +95,14 @@ const style = computed(() => generateStyle("modal", props));
|
|
|
82
95
|
</DialogTitle>
|
|
83
96
|
|
|
84
97
|
<DialogClose v-if="props.close || slots.close" as-child>
|
|
85
|
-
<slot name="close" :ui="
|
|
98
|
+
<slot name="close" :close="close" :ui="ui">
|
|
86
99
|
<Button
|
|
87
100
|
variant="ghost"
|
|
88
|
-
|
|
101
|
+
color="neutral"
|
|
102
|
+
:icon="props.closeIcon || appConfig.ui.icons.close"
|
|
89
103
|
v-bind="typeof props.close === 'boolean' ? {} : props.close"
|
|
90
104
|
:aria-label="t('modal.close')"
|
|
91
|
-
:class="
|
|
105
|
+
:class="ui.close({ class: props.ui?.close })"
|
|
92
106
|
data-part="close"
|
|
93
107
|
/>
|
|
94
108
|
</slot>
|
|
@@ -96,7 +110,7 @@ const style = computed(() => generateStyle("modal", props));
|
|
|
96
110
|
|
|
97
111
|
<DialogDescription
|
|
98
112
|
v-if="props.description || slots.description"
|
|
99
|
-
:class="
|
|
113
|
+
:class="ui.description({ class: props.ui?.description })"
|
|
100
114
|
data-part="description"
|
|
101
115
|
>
|
|
102
116
|
<slot name="description">
|
|
@@ -106,12 +120,12 @@ const style = computed(() => generateStyle("modal", props));
|
|
|
106
120
|
</slot>
|
|
107
121
|
</div>
|
|
108
122
|
|
|
109
|
-
<div v-if="slots.body" :class="
|
|
110
|
-
<slot name="body"></slot>
|
|
123
|
+
<div v-if="slots.body" :class="ui.body({ class: props.ui?.body })" data-part="body">
|
|
124
|
+
<slot name="body" :close="close"></slot>
|
|
111
125
|
</div>
|
|
112
126
|
|
|
113
|
-
<div v-if="slots.footer" :class="
|
|
114
|
-
<slot name="footer"></slot>
|
|
127
|
+
<div v-if="slots.footer" :class="ui.footer({ class: props.ui?.footer })" data-part="footer">
|
|
128
|
+
<slot name="footer" :close="close"></slot>
|
|
115
129
|
</div>
|
|
116
130
|
</slot>
|
|
117
131
|
</DialogContent>
|
|
@@ -1,63 +1,93 @@
|
|
|
1
|
-
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
1
|
import type { DialogContentEmits, DialogContentProps, DialogRootEmits, DialogRootProps } from 'reka-ui';
|
|
3
|
-
import
|
|
4
|
-
import type { ButtonProps,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export interface ModalSlots {
|
|
9
|
-
default?: (props: {
|
|
10
|
-
open: boolean;
|
|
11
|
-
}) => any;
|
|
12
|
-
content?: any;
|
|
13
|
-
header?: any;
|
|
14
|
-
title?: any;
|
|
15
|
-
description?: any;
|
|
16
|
-
close?: (props: {
|
|
17
|
-
ui: ComponentAttrs<typeof modal>['ui'];
|
|
18
|
-
}) => any;
|
|
19
|
-
body?: any;
|
|
20
|
-
footer?: any;
|
|
21
|
-
}
|
|
22
|
-
type ModalVariants = VariantProps<typeof modal>;
|
|
23
|
-
export interface ModalProps extends ComponentAttrs<typeof modal>, DialogRootProps {
|
|
2
|
+
import theme from '#build/ui/modal';
|
|
3
|
+
import type { ButtonProps, ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps } from '../types';
|
|
4
|
+
import type { EmitsToProps, StaticSlot } from '../types/utils';
|
|
5
|
+
export interface ModalProps extends ComponentBaseProps, DialogRootProps {
|
|
24
6
|
title?: string;
|
|
25
7
|
description?: string;
|
|
26
|
-
|
|
8
|
+
/** The content of the modal. */
|
|
27
9
|
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Render an overlay behind the modal.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
31
14
|
overlay?: boolean;
|
|
32
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Animate the modal when opening or closing.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
33
19
|
transition?: boolean;
|
|
34
20
|
/**
|
|
35
|
-
* When `
|
|
21
|
+
* When `true`, the modal will take up the full screen.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
fullscreen?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Render the modal in a portal.
|
|
36
27
|
* @default true
|
|
37
28
|
*/
|
|
38
|
-
|
|
29
|
+
portal?: boolean | string | HTMLElement;
|
|
39
30
|
/**
|
|
40
31
|
* Display a close button to dismiss the modal.
|
|
41
32
|
* @default true
|
|
42
33
|
*/
|
|
43
|
-
close?:
|
|
34
|
+
close?: boolean | Partial<ButtonProps>;
|
|
44
35
|
/** @default app.icons.close */
|
|
45
|
-
closeIcon?:
|
|
36
|
+
closeIcon?: IconProps['name'];
|
|
37
|
+
/**
|
|
38
|
+
* When `false`, the modal will not close when clicking outside or pressing escape.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
dismissible?: boolean;
|
|
42
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
43
|
+
}
|
|
44
|
+
export interface ModalEmits extends DialogRootEmits {
|
|
45
|
+
'after-leave': [];
|
|
46
|
+
'after-enter': [];
|
|
47
|
+
'close-prevent': [];
|
|
48
|
+
}
|
|
49
|
+
export interface ModalSlots {
|
|
50
|
+
default: StaticSlot<{
|
|
51
|
+
open: boolean;
|
|
52
|
+
}>;
|
|
53
|
+
content: StaticSlot<{
|
|
54
|
+
close: () => void;
|
|
55
|
+
}>;
|
|
56
|
+
header: StaticSlot<{
|
|
57
|
+
close: () => void;
|
|
58
|
+
}>;
|
|
59
|
+
title: StaticSlot;
|
|
60
|
+
description: StaticSlot;
|
|
61
|
+
close?: StaticSlot<{
|
|
62
|
+
close: () => void;
|
|
63
|
+
ui: ComponentStyler<typeof theme>;
|
|
64
|
+
}>;
|
|
65
|
+
body: StaticSlot<{
|
|
66
|
+
close: () => void;
|
|
67
|
+
}>;
|
|
68
|
+
footer: StaticSlot<{
|
|
69
|
+
close: () => void;
|
|
70
|
+
}>;
|
|
46
71
|
}
|
|
47
|
-
declare const
|
|
72
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ModalProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
48
73
|
"update:open": (value: boolean) => any;
|
|
49
74
|
"after-leave": () => any;
|
|
75
|
+
"after-enter": () => any;
|
|
76
|
+
"close-prevent": () => any;
|
|
50
77
|
}, string, import("vue").PublicProps, Readonly<ModalProps> & Readonly<{
|
|
51
78
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
52
79
|
"onAfter-leave"?: (() => any) | undefined;
|
|
80
|
+
"onAfter-enter"?: (() => any) | undefined;
|
|
81
|
+
"onClose-prevent"?: (() => any) | undefined;
|
|
53
82
|
}>, {
|
|
54
|
-
close: ButtonProps | boolean;
|
|
55
83
|
overlay: boolean;
|
|
84
|
+
close: boolean | Partial<ButtonProps>;
|
|
56
85
|
transition: boolean;
|
|
57
86
|
modal: boolean;
|
|
58
|
-
portal: boolean;
|
|
87
|
+
portal: boolean | string | HTMLElement;
|
|
59
88
|
dismissible: boolean;
|
|
60
89
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ModalSlots>;
|
|
90
|
+
declare const _default: typeof __VLS_export;
|
|
61
91
|
export default _default;
|
|
62
92
|
type __VLS_WithSlots<T, S> = T & {
|
|
63
93
|
new (): {
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/navigation-menu";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { createReusableTemplate, reactivePick } from "@vueuse/core";
|
|
7
|
+
import { defu } from "defu";
|
|
8
|
+
import { AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, useForwardPropsEmits } from "reka-ui";
|
|
9
|
+
import { computed, toRef } from "vue";
|
|
10
|
+
import { useAppConfig } from "#imports";
|
|
11
|
+
import { get, isArrayOfArray, pickLinkProps } from "../utils";
|
|
12
|
+
import { cv, merge } from "../utils/style";
|
|
13
|
+
import Avatar from "./Avatar.vue";
|
|
14
|
+
import Badge from "./Badge.vue";
|
|
15
|
+
import Icon from "./Icon.vue";
|
|
16
|
+
import Link from "./Link.vue";
|
|
17
|
+
import LinkBase from "./LinkBase.vue";
|
|
18
|
+
import Popover from "./Popover.vue";
|
|
19
|
+
import Tooltip from "./Tooltip.vue";
|
|
20
|
+
defineOptions({ inheritAttrs: false });
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
as: { type: null, required: false },
|
|
23
|
+
type: { type: null, required: false, default: "multiple" },
|
|
24
|
+
modelValue: { type: null, required: false },
|
|
25
|
+
defaultValue: { type: null, required: false },
|
|
26
|
+
trailingIcon: { type: [String, Object], required: false },
|
|
27
|
+
externalIcon: { type: [Boolean, String, Object], required: false, default: true },
|
|
28
|
+
items: { type: null, required: false },
|
|
29
|
+
color: { type: null, required: false },
|
|
30
|
+
variant: { type: null, required: false },
|
|
31
|
+
orientation: { type: null, required: false, default: "horizontal" },
|
|
32
|
+
collapsed: { type: Boolean, required: false },
|
|
33
|
+
tooltip: { type: [Boolean, Object], required: false, default: true },
|
|
34
|
+
popover: { type: [Boolean, Object], required: false, default: true },
|
|
35
|
+
highlight: { type: Boolean, required: false },
|
|
36
|
+
highlightColor: { type: null, required: false },
|
|
37
|
+
content: { type: Object, required: false },
|
|
38
|
+
contentOrientation: { type: null, required: false, default: "horizontal" },
|
|
39
|
+
arrow: { type: Boolean, required: false },
|
|
40
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
41
|
+
ui: { type: null, required: false },
|
|
42
|
+
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
43
|
+
delayDuration: { type: Number, required: false, default: 0 },
|
|
44
|
+
disableClickTrigger: { type: Boolean, required: false },
|
|
45
|
+
disableHoverTrigger: { type: Boolean, required: false },
|
|
46
|
+
skipDelayDuration: { type: Number, required: false },
|
|
47
|
+
disablePointerLeaveClose: { type: Boolean, required: false },
|
|
48
|
+
unmountOnHide: { type: Boolean, required: false, default: true },
|
|
49
|
+
disabled: { type: Boolean, required: false },
|
|
50
|
+
collapsible: { type: Boolean, required: false, default: true }
|
|
51
|
+
});
|
|
52
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
53
|
+
const slots = defineSlots();
|
|
54
|
+
const rootProps = useForwardPropsEmits(computed(() => ({
|
|
55
|
+
as: props.as,
|
|
56
|
+
delayDuration: props.delayDuration,
|
|
57
|
+
skipDelayDuration: props.skipDelayDuration,
|
|
58
|
+
orientation: props.orientation,
|
|
59
|
+
disableClickTrigger: props.disableClickTrigger,
|
|
60
|
+
disableHoverTrigger: props.disableHoverTrigger,
|
|
61
|
+
disablePointerLeaveClose: props.disablePointerLeaveClose,
|
|
62
|
+
unmountOnHide: props.unmountOnHide
|
|
63
|
+
})), emit);
|
|
64
|
+
const accordionProps = useForwardPropsEmits(reactivePick(props, "collapsible", "disabled", "type", "unmountOnHide"), emit);
|
|
65
|
+
const contentProps = toRef(() => props.content);
|
|
66
|
+
const tooltipProps = toRef(() => defu(typeof props.tooltip === "boolean" ? {} : props.tooltip, { delayDuration: 0, content: { side: "right" } }));
|
|
67
|
+
const popoverProps = toRef(() => defu(typeof props.popover === "boolean" ? {} : props.popover, { mode: "hover", content: { side: "right", align: "start", alignOffset: 2 } }));
|
|
68
|
+
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate();
|
|
69
|
+
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
|
|
70
|
+
props: {
|
|
71
|
+
item: Object,
|
|
72
|
+
index: Number,
|
|
73
|
+
level: Number
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const lists = computed(
|
|
77
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
78
|
+
);
|
|
79
|
+
const appConfig = useAppConfig();
|
|
80
|
+
const ui = computed(() => {
|
|
81
|
+
const styler = cv(merge(theme, appConfig.ui.navigationMenu));
|
|
82
|
+
return styler({
|
|
83
|
+
...props,
|
|
84
|
+
contentOrientation: props.orientation === "vertical" ? void 0 : props.contentOrientation,
|
|
85
|
+
highlightColor: props.highlightColor || props.color
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
function getAccordionDefaultValue(list, level = 0) {
|
|
89
|
+
const indexes = list.reduce((acc, item, index) => {
|
|
90
|
+
if (item.defaultOpen || item.open)
|
|
91
|
+
acc.push(item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`));
|
|
92
|
+
return acc;
|
|
93
|
+
}, []);
|
|
94
|
+
return props.type === "single" ? indexes[0] : indexes;
|
|
95
|
+
}
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<template>
|
|
99
|
+
<DefineLinkTemplate v-slot="{ item, active, index }">
|
|
100
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index" :active="active" :ui="ui">
|
|
101
|
+
<slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="active" :index="index" :ui="ui">
|
|
102
|
+
<Avatar
|
|
103
|
+
v-if="item.avatar"
|
|
104
|
+
:size="item.ui?.linkLeadingAvatarSize || props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()"
|
|
105
|
+
v-bind="item.avatar"
|
|
106
|
+
:class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active, disabled: item.disabled })"
|
|
107
|
+
data-part="linkLeadingAvatar"
|
|
108
|
+
/>
|
|
109
|
+
<Icon
|
|
110
|
+
v-else-if="item.icon"
|
|
111
|
+
:name="item.icon"
|
|
112
|
+
:class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active, disabled: !!item.disabled })"
|
|
113
|
+
data-part="linkLeadingIcon"
|
|
114
|
+
/>
|
|
115
|
+
</slot>
|
|
116
|
+
|
|
117
|
+
<span
|
|
118
|
+
v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]"
|
|
119
|
+
:class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })"
|
|
120
|
+
data-part="linkLabel"
|
|
121
|
+
>
|
|
122
|
+
<slot :name="`${item.slot || 'item'}-label`" :item="item" :active="active" :index="index">
|
|
123
|
+
{{ get(item, props.labelKey) }}
|
|
124
|
+
</slot>
|
|
125
|
+
|
|
126
|
+
<Icon
|
|
127
|
+
v-if="item.target === '_blank' && props.externalIcon !== false"
|
|
128
|
+
:name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external"
|
|
129
|
+
:class="ui.linkLabelExternalIcon({ class: [props.ui?.linkLabelExternalIcon, item.ui?.linkLabelExternalIcon], active })"
|
|
130
|
+
data-part="linkLabelExternalIcon"
|
|
131
|
+
/>
|
|
132
|
+
</span>
|
|
133
|
+
|
|
134
|
+
<component
|
|
135
|
+
:is="props.orientation === 'vertical' && item.children?.length && !props.collapsed ? AccordionTrigger : 'span'"
|
|
136
|
+
v-if="item.badge !== void 0 || orientation === 'horizontal' && (item.children?.length || !!slots[`${item.slot || 'item'}-content`]) || orientation === 'vertical' && item.children?.length || item.trailingIcon || !!slots[`${item.slot || 'item'}-trailing`]"
|
|
137
|
+
as="span"
|
|
138
|
+
:class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })"
|
|
139
|
+
data-part="linkTrailing"
|
|
140
|
+
@click.stop.prevent
|
|
141
|
+
>
|
|
142
|
+
<slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="active" :index="index" :ui="ui">
|
|
143
|
+
<Badge
|
|
144
|
+
v-if="item.badge !== void 0"
|
|
145
|
+
color="neutral"
|
|
146
|
+
variant="outline"
|
|
147
|
+
:size="item.ui?.linkTrailingBadgeSize || props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
|
|
148
|
+
v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
|
|
149
|
+
:class="ui.linkTrailingBadge({ class: [props.ui?.linkTrailingBadge, item.ui?.linkTrailingBadge] })"
|
|
150
|
+
data-part="linkTrailingBadge"
|
|
151
|
+
/>
|
|
152
|
+
|
|
153
|
+
<Icon
|
|
154
|
+
v-if="orientation === 'horizontal' && (item.children?.length || !!slots[`${item.slot || 'item'}-content`]) || orientation === 'vertical' && item.children?.length"
|
|
155
|
+
:name="item.trailingIcon || props.trailingIcon || appConfig.ui.icons.chevronDown"
|
|
156
|
+
:class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })"
|
|
157
|
+
data-part="linkTrailingIcon"
|
|
158
|
+
/>
|
|
159
|
+
<Icon
|
|
160
|
+
v-else-if="item.trailingIcon"
|
|
161
|
+
:name="item.trailingIcon"
|
|
162
|
+
:class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })"
|
|
163
|
+
data-part="linkTrailingIcon"
|
|
164
|
+
/>
|
|
165
|
+
</slot>
|
|
166
|
+
</component>
|
|
167
|
+
</slot>
|
|
168
|
+
</DefineLinkTemplate>
|
|
169
|
+
|
|
170
|
+
<DefineItemTemplate v-slot="{ item, index, level = 0 }">
|
|
171
|
+
<component
|
|
172
|
+
:is="props.orientation === 'vertical' && !props.collapsed ? AccordionItem : NavigationMenuItem"
|
|
173
|
+
as="li"
|
|
174
|
+
:value="item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`)"
|
|
175
|
+
>
|
|
176
|
+
<div v-if="props.orientation === 'vertical' && item.type === 'label' && !props.collapsed" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })" data-part="label">
|
|
177
|
+
<ReuseLinkTemplate :item="item" :index="index" />
|
|
178
|
+
</div>
|
|
179
|
+
<Link
|
|
180
|
+
v-else-if="item.type !== 'label'"
|
|
181
|
+
v-slot="{ active, ...slotProps }"
|
|
182
|
+
v-bind="props.orientation === 'vertical' && item.children?.length && !props.collapsed && item.type === 'trigger' ? {} : pickLinkProps(item)"
|
|
183
|
+
custom
|
|
184
|
+
>
|
|
185
|
+
<component
|
|
186
|
+
:is="
|
|
187
|
+
props.orientation === 'horizontal' && (item.children?.length || slots[`${item.slot || 'item'}-content`]) ? NavigationMenuTrigger : orientation === 'vertical' && item.children?.length && !props.collapsed && !slotProps.href ? AccordionTrigger : NavigationMenuLink
|
|
188
|
+
"
|
|
189
|
+
:active="active || item.active"
|
|
190
|
+
:disabled="item.disabled"
|
|
191
|
+
as-child
|
|
192
|
+
@select="item.onSelect"
|
|
193
|
+
>
|
|
194
|
+
<Popover
|
|
195
|
+
v-if="props.orientation === 'vertical' && props.collapsed && item.children?.length && (!!props.popover || !!item.popover)"
|
|
196
|
+
v-bind="{ ...popoverProps, ...typeof item.popover === 'boolean' ? {} : item.popover || {} }"
|
|
197
|
+
:ui="{ content: ui.content({ class: [props.ui?.content, item.ui?.content] }) }"
|
|
198
|
+
data-part="content"
|
|
199
|
+
>
|
|
200
|
+
<LinkBase
|
|
201
|
+
v-bind="slotProps"
|
|
202
|
+
:class="ui.link({
|
|
203
|
+
class: [props.ui?.link, item.ui?.link, item.class],
|
|
204
|
+
active: active || item.active,
|
|
205
|
+
disabled: item.disabled,
|
|
206
|
+
level: level > 0
|
|
207
|
+
})"
|
|
208
|
+
data-part="link"
|
|
209
|
+
>
|
|
210
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
211
|
+
</LinkBase>
|
|
212
|
+
|
|
213
|
+
<template #content="{ close }">
|
|
214
|
+
<slot :name="`${item.slot || 'item'}-content`" :item="item" :active="active || item.active" :index="index" :ui="ui" :close="close">
|
|
215
|
+
<ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })" data-part="childList">
|
|
216
|
+
<li :class="ui.childLabel({ class: [props.ui?.childLabel, item.ui?.childLabel] })" data-part="childLabel">
|
|
217
|
+
{{ get(item, props.labelKey) }}
|
|
218
|
+
</li>
|
|
219
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })" data-part="childItem">
|
|
220
|
+
<Link v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
221
|
+
<NavigationMenuLink :active="childActive" as-child @select="childItem.onSelect">
|
|
222
|
+
<LinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })" data-part="childLink">
|
|
223
|
+
<Icon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" data-part="childLinkIcon" />
|
|
224
|
+
|
|
225
|
+
<span :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })" data-part="childLinkLabel">
|
|
226
|
+
{{ get(childItem, props.labelKey) }}
|
|
227
|
+
|
|
228
|
+
<Icon v-if="childItem.target === '_blank' && props.externalIcon !== false" :name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" data-part="childLinkLabelExternalIcon" />
|
|
229
|
+
</span>
|
|
230
|
+
</LinkBase>
|
|
231
|
+
</NavigationMenuLink>
|
|
232
|
+
</Link>
|
|
233
|
+
</li>
|
|
234
|
+
</ul>
|
|
235
|
+
</slot>
|
|
236
|
+
</template>
|
|
237
|
+
</Popover>
|
|
238
|
+
<Tooltip v-else-if="props.orientation === 'vertical' && props.collapsed && (!!props.tooltip || !!item.tooltip)" :text="get(item, props.labelKey)" v-bind="{ ...tooltipProps, ...typeof item.tooltip === 'boolean' ? {} : item.tooltip || {} }">
|
|
239
|
+
<LinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: item.disabled, level: level > 0 })" data-part="link">
|
|
240
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
241
|
+
</LinkBase>
|
|
242
|
+
</Tooltip>
|
|
243
|
+
<LinkBase v-else v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: item.disabled, level: props.orientation === 'horizontal' || level > 0 })" data-part="link">
|
|
244
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
245
|
+
</LinkBase>
|
|
246
|
+
</component>
|
|
247
|
+
|
|
248
|
+
<NavigationMenuContent
|
|
249
|
+
v-if="props.orientation === 'horizontal' && (item.children?.length || slots[`${item.slot || 'item'}-content`])"
|
|
250
|
+
v-bind="contentProps"
|
|
251
|
+
:class="ui.content({ class: [props.ui?.content, item.ui?.content] })"
|
|
252
|
+
data-part="content"
|
|
253
|
+
>
|
|
254
|
+
<slot :name="`${item.slot || 'item'}-content`" :item="item" :active="active" :index="index" :ui="ui">
|
|
255
|
+
<ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })" data-part="childList">
|
|
256
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })" data-part="childItem">
|
|
257
|
+
<Link v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
258
|
+
<NavigationMenuLink :active="childActive" as-child @select="childItem.onSelect">
|
|
259
|
+
<LinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })" data-part="childLink">
|
|
260
|
+
<Icon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" data-part="childLinkIcon" />
|
|
261
|
+
|
|
262
|
+
<div :class="ui.childLinkWrapper({ class: [props.ui?.childLinkWrapper, item.ui?.childLinkWrapper] })" data-part="childLinkWrapper">
|
|
263
|
+
<p :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })" data-part="childLinkLabel">
|
|
264
|
+
{{ get(childItem, props.labelKey) }}
|
|
265
|
+
|
|
266
|
+
<Icon v-if="childItem.target === '_blank' && props.externalIcon !== false" :name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" data-part="childLinkLabelExternalIcon" />
|
|
267
|
+
</p>
|
|
268
|
+
<p v-if="childItem.description" :class="ui.childLinkDescription({ class: [props.ui?.childLinkDescription, item.ui?.childLinkDescription], active: childActive })" data-part="childLinkDescription">
|
|
269
|
+
{{ childItem.description }}
|
|
270
|
+
</p>
|
|
271
|
+
</div>
|
|
272
|
+
</LinkBase>
|
|
273
|
+
</NavigationMenuLink>
|
|
274
|
+
</Link>
|
|
275
|
+
</li>
|
|
276
|
+
</ul>
|
|
277
|
+
</slot>
|
|
278
|
+
</NavigationMenuContent>
|
|
279
|
+
</Link>
|
|
280
|
+
|
|
281
|
+
<AccordionContent v-if="props.orientation === 'vertical' && item.children?.length && !props.collapsed" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })" data-part="content">
|
|
282
|
+
<AccordionRoot
|
|
283
|
+
v-bind="{ ...accordionProps, defaultValue: getAccordionDefaultValue(item.children, level + 1) }"
|
|
284
|
+
as="ul"
|
|
285
|
+
:class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })"
|
|
286
|
+
data-part="childList"
|
|
287
|
+
>
|
|
288
|
+
<ReuseItemTemplate
|
|
289
|
+
v-for="(childItem, childIndex) in item.children"
|
|
290
|
+
:key="childIndex"
|
|
291
|
+
:item="childItem"
|
|
292
|
+
:index="childIndex"
|
|
293
|
+
:level="level + 1"
|
|
294
|
+
:class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })"
|
|
295
|
+
data-part="childItem"
|
|
296
|
+
/>
|
|
297
|
+
</AccordionRoot>
|
|
298
|
+
</AccordionContent>
|
|
299
|
+
</component>
|
|
300
|
+
</DefineItemTemplate>
|
|
301
|
+
|
|
302
|
+
<NavigationMenuRoot
|
|
303
|
+
v-bind="{
|
|
304
|
+
...rootProps,
|
|
305
|
+
...props.orientation === 'horizontal' ? {
|
|
306
|
+
modelValue: props.modelValue,
|
|
307
|
+
defaultValue: props.defaultValue
|
|
308
|
+
} : {},
|
|
309
|
+
...$attrs
|
|
310
|
+
}"
|
|
311
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
312
|
+
:data-collapsed="props.collapsed"
|
|
313
|
+
data-part="root"
|
|
314
|
+
>
|
|
315
|
+
<slot name="list-leading"></slot>
|
|
316
|
+
|
|
317
|
+
<template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
|
|
318
|
+
<component
|
|
319
|
+
v-bind="props.orientation === 'vertical' && !props.collapsed ? {
|
|
320
|
+
...accordionProps,
|
|
321
|
+
modelValue: props.modelValue,
|
|
322
|
+
defaultValue: props.defaultValue ?? getAccordionDefaultValue(list)
|
|
323
|
+
} : {}"
|
|
324
|
+
:is="props.orientation === 'vertical' ? AccordionRoot : NavigationMenuList"
|
|
325
|
+
as="ul"
|
|
326
|
+
:class="ui.list({ class: props.ui?.list })"
|
|
327
|
+
data-part="list"
|
|
328
|
+
>
|
|
329
|
+
<ReuseItemTemplate v-for="(item, index) in list" :key="`list-${listIndex}-${index}`" :item="item" :index="index" :class="ui.item({ class: [props.ui?.item, item.ui?.item] })" data-part="item" />
|
|
330
|
+
</component>
|
|
331
|
+
|
|
332
|
+
<div v-if="props.orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" data-part="separator"></div>
|
|
333
|
+
</template>
|
|
334
|
+
|
|
335
|
+
<slot name="list-trailing"></slot>
|
|
336
|
+
|
|
337
|
+
<div v-if="props.orientation === 'horizontal'" :class="ui.viewportWrapper({ class: props.ui?.viewportWrapper })" data-part="viewportWrapper">
|
|
338
|
+
<NavigationMenuIndicator v-if="props.arrow" :class="ui.indicator({ class: props.ui?.indicator })" data-part="indicator">
|
|
339
|
+
<div :class="ui.arrow({ class: props.ui?.arrow })" data-part="arrow"></div>
|
|
340
|
+
</NavigationMenuIndicator>
|
|
341
|
+
|
|
342
|
+
<NavigationMenuViewport :class="ui.viewport({ class: props.ui?.viewport })" data-part="viewport" />
|
|
343
|
+
</div>
|
|
344
|
+
</NavigationMenuRoot>
|
|
345
|
+
</template>
|