@nuxt/ui 3.1.2 → 3.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/.nuxt/ui/avatar.ts +1 -1
- package/.nuxt/ui/card.ts +1 -1
- package/.nuxt/ui/carousel.ts +1 -1
- package/.nuxt/ui/checkbox-group.ts +1 -1
- package/.nuxt/ui/command-palette.ts +1 -0
- package/.nuxt/ui/context-menu.ts +2 -1
- package/.nuxt/ui/drawer.ts +1 -1
- package/.nuxt/ui/dropdown-menu.ts +2 -1
- package/.nuxt/ui/index.ts +2 -0
- package/.nuxt/ui/input-menu.ts +26 -12
- package/.nuxt/ui/input-tags.ts +310 -0
- package/.nuxt/ui/modal.ts +1 -1
- package/.nuxt/ui/navigation-menu.ts +43 -34
- package/.nuxt/ui/radio-group.ts +1 -1
- package/.nuxt/ui/select-menu.ts +13 -8
- package/.nuxt/ui/select.ts +13 -8
- package/.nuxt/ui/table.ts +3 -2
- package/.nuxt/ui/timeline.ts +321 -0
- package/.nuxt/ui/toaster.ts +1 -1
- package/.nuxt/ui/tooltip.ts +1 -1
- package/.nuxt/ui.css +4 -1
- package/cli/templates.mjs +7 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Alert.vue +0 -1
- package/dist/runtime/components/Avatar.vue +10 -2
- package/dist/runtime/components/Avatar.vue.d.ts +2 -0
- package/dist/runtime/components/Calendar.vue +4 -1
- package/dist/runtime/components/Carousel.vue +1 -2
- package/dist/runtime/components/Checkbox.vue +1 -1
- package/dist/runtime/components/CommandPalette.vue +80 -16
- package/dist/runtime/components/CommandPalette.vue.d.ts +32 -8
- package/dist/runtime/components/ContextMenuContent.vue +58 -56
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +4 -20
- package/dist/runtime/components/Drawer.vue +15 -1
- package/dist/runtime/components/DropdownMenuContent.vue +60 -58
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +4 -20
- package/dist/runtime/components/Form.vue +6 -6
- package/dist/runtime/components/Form.vue.d.ts +12 -11
- package/dist/runtime/components/Input.vue +1 -0
- package/dist/runtime/components/Input.vue.d.ts +7 -0
- package/dist/runtime/components/InputMenu.vue +3 -3
- package/dist/runtime/components/InputMenu.vue.d.ts +4 -4
- package/dist/runtime/components/InputNumber.vue +3 -2
- package/dist/runtime/components/InputNumber.vue.d.ts +1 -1
- package/dist/runtime/components/InputTags.vue +159 -0
- package/dist/runtime/components/InputTags.vue.d.ts +183 -0
- package/dist/runtime/components/Modal.vue +16 -15
- package/dist/runtime/components/Modal.vue.d.ts +17 -4
- package/dist/runtime/components/NavigationMenu.vue +85 -26
- package/dist/runtime/components/NavigationMenu.vue.d.ts +30 -17
- package/dist/runtime/components/OverlayProvider.vue +2 -2
- package/dist/runtime/components/Pagination.vue +1 -1
- package/dist/runtime/components/Pagination.vue.d.ts +0 -1
- package/dist/runtime/components/PinInput.vue +4 -3
- package/dist/runtime/components/PinInput.vue.d.ts +22 -19
- package/dist/runtime/components/Popover.vue +4 -0
- package/dist/runtime/components/Popover.vue.d.ts +1 -0
- package/dist/runtime/components/Progress.vue +2 -1
- package/dist/runtime/components/Progress.vue.d.ts +1 -1
- package/dist/runtime/components/RadioGroup.vue +2 -2
- package/dist/runtime/components/Select.vue +26 -7
- package/dist/runtime/components/Select.vue.d.ts +107 -1
- package/dist/runtime/components/SelectMenu.vue +27 -8
- package/dist/runtime/components/SelectMenu.vue.d.ts +105 -1
- package/dist/runtime/components/Slideover.vue +23 -15
- package/dist/runtime/components/Slideover.vue.d.ts +17 -4
- package/dist/runtime/components/Table.vue +7 -1
- package/dist/runtime/components/Table.vue.d.ts +10 -8
- package/dist/runtime/components/Tabs.vue +13 -2
- package/dist/runtime/components/Tabs.vue.d.ts +4 -1
- package/dist/runtime/components/Textarea.vue +4 -1
- package/dist/runtime/components/Textarea.vue.d.ts +11 -4
- package/dist/runtime/components/Timeline.vue +92 -0
- package/dist/runtime/components/Timeline.vue.d.ts +70 -0
- package/dist/runtime/components/Toast.vue +4 -5
- package/dist/runtime/components/Tree.vue +3 -2
- package/dist/runtime/components/Tree.vue.d.ts +1 -1
- package/dist/runtime/composables/defineLocale.d.ts +2 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.js +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +2 -1
- package/dist/runtime/composables/useOverlay.js +7 -6
- package/dist/runtime/locale/ar.js +2 -1
- package/dist/runtime/locale/az.js +2 -1
- package/dist/runtime/locale/bg.js +2 -1
- package/dist/runtime/locale/bn.js +2 -1
- package/dist/runtime/locale/ca.js +2 -1
- package/dist/runtime/locale/ckb.js +2 -1
- package/dist/runtime/locale/cs.js +2 -1
- package/dist/runtime/locale/da.js +2 -1
- package/dist/runtime/locale/de.js +2 -1
- package/dist/runtime/locale/el.js +2 -1
- package/dist/runtime/locale/en.js +2 -1
- package/dist/runtime/locale/es.js +2 -1
- package/dist/runtime/locale/et.js +2 -1
- package/dist/runtime/locale/fa_ir.js +2 -1
- package/dist/runtime/locale/fi.js +2 -1
- package/dist/runtime/locale/fr.js +2 -1
- package/dist/runtime/locale/he.js +2 -1
- package/dist/runtime/locale/hi.js +2 -1
- package/dist/runtime/locale/hu.js +2 -1
- package/dist/runtime/locale/hy.js +2 -1
- package/dist/runtime/locale/id.js +2 -1
- package/dist/runtime/locale/index.d.ts +7 -2
- package/dist/runtime/locale/index.js +7 -2
- package/dist/runtime/locale/it.js +2 -1
- package/dist/runtime/locale/ja.js +2 -1
- package/dist/runtime/locale/kk.js +2 -1
- package/dist/runtime/locale/km.js +2 -1
- package/dist/runtime/locale/ko.js +2 -1
- package/dist/runtime/locale/ky.d.ts +3 -0
- package/dist/runtime/locale/ky.js +55 -0
- package/dist/runtime/locale/lb.d.ts +3 -0
- package/dist/runtime/locale/lb.js +55 -0
- package/dist/runtime/locale/lt.d.ts +3 -0
- package/dist/runtime/locale/lt.js +55 -0
- package/dist/runtime/locale/mn.d.ts +3 -0
- package/dist/runtime/locale/mn.js +55 -0
- package/dist/runtime/locale/ms.d.ts +3 -0
- package/dist/runtime/locale/ms.js +55 -0
- package/dist/runtime/locale/nb_no.js +2 -1
- package/dist/runtime/locale/nl.js +2 -1
- package/dist/runtime/locale/pl.js +2 -1
- package/dist/runtime/locale/pt.js +2 -1
- package/dist/runtime/locale/pt_br.js +2 -1
- package/dist/runtime/locale/ro.js +2 -1
- package/dist/runtime/locale/ru.js +2 -1
- package/dist/runtime/locale/sk.js +2 -1
- package/dist/runtime/locale/sl.js +2 -1
- package/dist/runtime/locale/sv.js +2 -1
- package/dist/runtime/locale/th.js +2 -1
- package/dist/runtime/locale/tj.js +2 -1
- package/dist/runtime/locale/tr.js +2 -1
- package/dist/runtime/locale/ug_cn.js +2 -1
- package/dist/runtime/locale/uk.js +2 -1
- package/dist/runtime/locale/ur.js +2 -1
- package/dist/runtime/locale/uz.js +2 -1
- package/dist/runtime/locale/vi.js +2 -1
- package/dist/runtime/locale/zh_cn.js +2 -1
- package/dist/runtime/locale/zh_tw.js +2 -1
- package/dist/runtime/types/form.d.ts +11 -10
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/locale.d.ts +1 -0
- package/dist/runtime/types/utils.d.ts +3 -0
- package/dist/shared/{ui.BvUP-pSb.mjs → ui.BPVxSPGY.mjs} +332 -62
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +35 -36
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
2
|
+
import type { TagsInputRootProps, TagsInputRootEmits, AcceptableInputValue } from 'reka-ui';
|
|
3
|
+
import theme from '#build/ui/input-tags';
|
|
4
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
5
|
+
import type { ComponentConfig } from '../types/utils';
|
|
6
|
+
type InputTags = ComponentConfig<typeof theme, AppConfig, 'inputTags'>;
|
|
7
|
+
export type InputTagItem = AcceptableInputValue;
|
|
8
|
+
export interface InputTagsProps<T extends InputTagItem = InputTagItem> extends Pick<TagsInputRootProps<T>, 'modelValue' | 'defaultValue' | 'addOnPaste' | 'addOnTab' | 'addOnBlur' | 'duplicate' | 'disabled' | 'delimiter' | 'max' | 'id' | 'convertValue' | 'displayValue' | 'name' | 'required'>, UseComponentIconsProps {
|
|
9
|
+
/**
|
|
10
|
+
* The element or component this component should render as.
|
|
11
|
+
* @defaultValue 'div'
|
|
12
|
+
*/
|
|
13
|
+
as?: any;
|
|
14
|
+
/** The placeholder text when the input is empty. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @defaultValue 'primary'
|
|
18
|
+
*/
|
|
19
|
+
color?: InputTags['variants']['color'];
|
|
20
|
+
/**
|
|
21
|
+
* @defaultValue 'outline'
|
|
22
|
+
*/
|
|
23
|
+
variant?: InputTags['variants']['variant'];
|
|
24
|
+
/**
|
|
25
|
+
* @defaultValue 'md'
|
|
26
|
+
*/
|
|
27
|
+
size?: InputTags['variants']['size'];
|
|
28
|
+
autofocus?: boolean;
|
|
29
|
+
autofocusDelay?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The icon displayed to delete a tag.
|
|
32
|
+
* @defaultValue appConfig.ui.icons.close
|
|
33
|
+
* @IconifyIcon
|
|
34
|
+
*/
|
|
35
|
+
deleteIcon?: string;
|
|
36
|
+
/** Highlight the ring color like a focus state. */
|
|
37
|
+
highlight?: boolean;
|
|
38
|
+
class?: any;
|
|
39
|
+
ui?: InputTags['slots'];
|
|
40
|
+
}
|
|
41
|
+
export interface InputTagsEmits<T extends InputTagItem> extends TagsInputRootEmits<T> {
|
|
42
|
+
change: [event: Event];
|
|
43
|
+
blur: [event: FocusEvent];
|
|
44
|
+
focus: [event: FocusEvent];
|
|
45
|
+
}
|
|
46
|
+
type SlotProps<T extends InputTagItem> = (props: {
|
|
47
|
+
item: T;
|
|
48
|
+
index: number;
|
|
49
|
+
}) => any;
|
|
50
|
+
export interface InputTagsSlots<T extends InputTagItem = InputTagItem> {
|
|
51
|
+
'leading'(props?: {}): any;
|
|
52
|
+
'default'(props?: {}): any;
|
|
53
|
+
'trailing'(props?: {}): any;
|
|
54
|
+
'item-text': SlotProps<T>;
|
|
55
|
+
'item-delete': SlotProps<T>;
|
|
56
|
+
}
|
|
57
|
+
declare const _default: <T extends InputTagItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
58
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
59
|
+
readonly onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
60
|
+
readonly onChange?: ((event: Event) => any) | undefined;
|
|
61
|
+
readonly onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
62
|
+
readonly onInvalid?: ((payload: T) => any) | undefined;
|
|
63
|
+
readonly "onUpdate:modelValue"?: ((payload: T[]) => any) | undefined;
|
|
64
|
+
readonly onRemoveTag?: ((payload: T) => any) | undefined;
|
|
65
|
+
readonly onAddTag?: ((payload: T) => any) | undefined;
|
|
66
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onInvalid" | "onUpdate:modelValue" | "onRemoveTag" | "onAddTag"> & InputTagsProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
67
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
68
|
+
inputRef: import("vue").Ref<({
|
|
69
|
+
$: import("vue").ComponentInternalInstance;
|
|
70
|
+
$data: {};
|
|
71
|
+
$props: {
|
|
72
|
+
readonly placeholder?: string | undefined;
|
|
73
|
+
readonly autoFocus?: boolean | undefined;
|
|
74
|
+
readonly maxLength?: number | undefined;
|
|
75
|
+
readonly asChild?: boolean | undefined;
|
|
76
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
77
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
78
|
+
$attrs: {
|
|
79
|
+
[x: string]: unknown;
|
|
80
|
+
};
|
|
81
|
+
$refs: {
|
|
82
|
+
[x: string]: unknown;
|
|
83
|
+
};
|
|
84
|
+
$slots: Readonly<{
|
|
85
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
86
|
+
}>;
|
|
87
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
88
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
89
|
+
$host: Element | null;
|
|
90
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
91
|
+
$el: any;
|
|
92
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").TagsInputInputProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
93
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
94
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
95
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
96
|
+
created?: (() => void) | (() => void)[];
|
|
97
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
98
|
+
mounted?: (() => void) | (() => void)[];
|
|
99
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
100
|
+
updated?: (() => void) | (() => void)[];
|
|
101
|
+
activated?: (() => void) | (() => void)[];
|
|
102
|
+
deactivated?: (() => void) | (() => void)[];
|
|
103
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
104
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
105
|
+
destroyed?: (() => void) | (() => void)[];
|
|
106
|
+
unmounted?: (() => void) | (() => void)[];
|
|
107
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
108
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
109
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
110
|
+
};
|
|
111
|
+
$forceUpdate: () => void;
|
|
112
|
+
$nextTick: typeof import("vue").nextTick;
|
|
113
|
+
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
114
|
+
} & Readonly<{
|
|
115
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
116
|
+
}> & Omit<Readonly<import("reka-ui").TagsInputInputProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
117
|
+
$slots: {
|
|
118
|
+
default?(_: {}): any;
|
|
119
|
+
};
|
|
120
|
+
}) | null, ({
|
|
121
|
+
$: import("vue").ComponentInternalInstance;
|
|
122
|
+
$data: {};
|
|
123
|
+
$props: {
|
|
124
|
+
readonly placeholder?: string | undefined;
|
|
125
|
+
readonly autoFocus?: boolean | undefined;
|
|
126
|
+
readonly maxLength?: number | undefined;
|
|
127
|
+
readonly asChild?: boolean | undefined;
|
|
128
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
129
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
130
|
+
$attrs: {
|
|
131
|
+
[x: string]: unknown;
|
|
132
|
+
};
|
|
133
|
+
$refs: {
|
|
134
|
+
[x: string]: unknown;
|
|
135
|
+
};
|
|
136
|
+
$slots: Readonly<{
|
|
137
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
138
|
+
}>;
|
|
139
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
140
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
141
|
+
$host: Element | null;
|
|
142
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
143
|
+
$el: any;
|
|
144
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").TagsInputInputProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
145
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
146
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
147
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
148
|
+
created?: (() => void) | (() => void)[];
|
|
149
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
150
|
+
mounted?: (() => void) | (() => void)[];
|
|
151
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
152
|
+
updated?: (() => void) | (() => void)[];
|
|
153
|
+
activated?: (() => void) | (() => void)[];
|
|
154
|
+
deactivated?: (() => void) | (() => void)[];
|
|
155
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
156
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
157
|
+
destroyed?: (() => void) | (() => void)[];
|
|
158
|
+
unmounted?: (() => void) | (() => void)[];
|
|
159
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
160
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
161
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
162
|
+
};
|
|
163
|
+
$forceUpdate: () => void;
|
|
164
|
+
$nextTick: typeof import("vue").nextTick;
|
|
165
|
+
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
166
|
+
} & Readonly<{
|
|
167
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
168
|
+
}> & Omit<Readonly<import("reka-ui").TagsInputInputProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
169
|
+
$slots: {
|
|
170
|
+
default?(_: {}): any;
|
|
171
|
+
};
|
|
172
|
+
}) | null>;
|
|
173
|
+
}>): void;
|
|
174
|
+
attrs: any;
|
|
175
|
+
slots: InputTagsSlots<T>;
|
|
176
|
+
emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "invalid", payload: T) => void) & ((evt: "update:modelValue", payload: T[]) => void) & ((evt: "removeTag", payload: T) => void) & ((evt: "addTag", payload: T) => void);
|
|
177
|
+
}>) => import("vue").VNode & {
|
|
178
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
179
|
+
};
|
|
180
|
+
export default _default;
|
|
181
|
+
type __VLS_PrettifyLocal<T> = {
|
|
182
|
+
[K in keyof T]: T[K];
|
|
183
|
+
} & {};
|
|
@@ -28,7 +28,7 @@ const props = defineProps({
|
|
|
28
28
|
defaultOpen: { type: Boolean, required: false },
|
|
29
29
|
modal: { type: Boolean, required: false, default: true }
|
|
30
30
|
});
|
|
31
|
-
const emits = defineEmits(["after:leave", "close:prevent", "update:open"]);
|
|
31
|
+
const emits = defineEmits(["after:leave", "after:enter", "close:prevent", "update:open"]);
|
|
32
32
|
const slots = defineSlots();
|
|
33
33
|
const { t } = useLocale();
|
|
34
34
|
const appConfig = useAppConfig();
|
|
@@ -40,14 +40,14 @@ const contentEvents = computed(() => {
|
|
|
40
40
|
closeAutoFocus: (e) => e.preventDefault()
|
|
41
41
|
};
|
|
42
42
|
if (!props.dismissible) {
|
|
43
|
-
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"
|
|
43
|
+
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"];
|
|
44
44
|
return events.reduce((acc, curr) => {
|
|
45
45
|
acc[curr] = (e) => {
|
|
46
46
|
e.preventDefault();
|
|
47
47
|
emits("close:prevent");
|
|
48
48
|
};
|
|
49
49
|
return acc;
|
|
50
|
-
},
|
|
50
|
+
}, defaultEvents);
|
|
51
51
|
}
|
|
52
52
|
return defaultEvents;
|
|
53
53
|
});
|
|
@@ -58,7 +58,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
58
58
|
</script>
|
|
59
59
|
|
|
60
60
|
<template>
|
|
61
|
-
<DialogRoot v-slot="{ open }" v-bind="rootProps">
|
|
61
|
+
<DialogRoot v-slot="{ open, close }" v-bind="rootProps">
|
|
62
62
|
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
63
63
|
<slot :open="open" />
|
|
64
64
|
</DialogTrigger>
|
|
@@ -66,7 +66,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
66
66
|
<DialogPortal v-bind="portalProps">
|
|
67
67
|
<DialogOverlay v-if="overlay" :class="ui.overlay({ class: props.ui?.overlay })" />
|
|
68
68
|
|
|
69
|
-
<DialogContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" @after-leave="emits('after:leave')" v-on="contentEvents">
|
|
69
|
+
<DialogContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" @after-enter="emits('after:enter')" @after-leave="emits('after:leave')" v-on="contentEvents">
|
|
70
70
|
<VisuallyHidden v-if="!!slots.content && (title || !!slots.title || (description || !!slots.description))">
|
|
71
71
|
<DialogTitle v-if="title || !!slots.title">
|
|
72
72
|
<slot name="title">
|
|
@@ -81,9 +81,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
81
81
|
</DialogDescription>
|
|
82
82
|
</VisuallyHidden>
|
|
83
83
|
|
|
84
|
-
<slot name="content">
|
|
85
|
-
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
86
|
-
<slot name="header">
|
|
84
|
+
<slot name="content" :close="close">
|
|
85
|
+
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (props.close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
86
|
+
<slot name="header" :close="close">
|
|
87
87
|
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
88
88
|
<DialogTitle v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
|
89
89
|
<slot name="title">
|
|
@@ -98,16 +98,17 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
98
98
|
</DialogDescription>
|
|
99
99
|
</div>
|
|
100
100
|
|
|
101
|
-
<
|
|
102
|
-
|
|
101
|
+
<slot name="actions" />
|
|
102
|
+
|
|
103
|
+
<DialogClose v-if="props.close || !!slots.close" as-child>
|
|
104
|
+
<slot name="close" :close="close" :ui="ui">
|
|
103
105
|
<UButton
|
|
104
|
-
v-if="close"
|
|
106
|
+
v-if="props.close"
|
|
105
107
|
:icon="closeIcon || appConfig.ui.icons.close"
|
|
106
|
-
size="md"
|
|
107
108
|
color="neutral"
|
|
108
109
|
variant="ghost"
|
|
109
110
|
:aria-label="t('modal.close')"
|
|
110
|
-
v-bind="typeof close === 'object' ? close : {}"
|
|
111
|
+
v-bind="typeof props.close === 'object' ? props.close : {}"
|
|
111
112
|
:class="ui.close({ class: props.ui?.close })"
|
|
112
113
|
/>
|
|
113
114
|
</slot>
|
|
@@ -116,11 +117,11 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
116
117
|
</div>
|
|
117
118
|
|
|
118
119
|
<div v-if="!!slots.body" :class="ui.body({ class: props.ui?.body })">
|
|
119
|
-
<slot name="body" />
|
|
120
|
+
<slot name="body" :close="close" />
|
|
120
121
|
</div>
|
|
121
122
|
|
|
122
123
|
<div v-if="!!slots.footer" :class="ui.footer({ class: props.ui?.footer })">
|
|
123
|
-
<slot name="footer" />
|
|
124
|
+
<slot name="footer" :close="close" />
|
|
124
125
|
</div>
|
|
125
126
|
</slot>
|
|
126
127
|
</DialogContent>
|
|
@@ -51,31 +51,44 @@ export interface ModalProps extends DialogRootProps {
|
|
|
51
51
|
}
|
|
52
52
|
export interface ModalEmits extends DialogRootEmits {
|
|
53
53
|
'after:leave': [];
|
|
54
|
+
'after:enter': [];
|
|
54
55
|
'close:prevent': [];
|
|
55
56
|
}
|
|
56
57
|
export interface ModalSlots {
|
|
57
58
|
default(props: {
|
|
58
59
|
open: boolean;
|
|
59
60
|
}): any;
|
|
60
|
-
content(props
|
|
61
|
-
|
|
61
|
+
content(props: {
|
|
62
|
+
close: () => void;
|
|
63
|
+
}): any;
|
|
64
|
+
header(props: {
|
|
65
|
+
close: () => void;
|
|
66
|
+
}): any;
|
|
62
67
|
title(props?: {}): any;
|
|
63
68
|
description(props?: {}): any;
|
|
69
|
+
actions(props?: {}): any;
|
|
64
70
|
close(props: {
|
|
71
|
+
close: () => void;
|
|
65
72
|
ui: {
|
|
66
73
|
[K in keyof Required<Modal['slots']>]: (props?: Record<string, any>) => string;
|
|
67
74
|
};
|
|
68
75
|
}): any;
|
|
69
|
-
body(props
|
|
70
|
-
|
|
76
|
+
body(props: {
|
|
77
|
+
close: () => void;
|
|
78
|
+
}): any;
|
|
79
|
+
footer(props: {
|
|
80
|
+
close: () => void;
|
|
81
|
+
}): any;
|
|
71
82
|
}
|
|
72
83
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ModalProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
73
84
|
"update:open": (value: boolean) => any;
|
|
74
85
|
"after:leave": () => any;
|
|
86
|
+
"after:enter": () => any;
|
|
75
87
|
"close:prevent": () => any;
|
|
76
88
|
}, string, import("vue").PublicProps, Readonly<ModalProps> & Readonly<{
|
|
77
89
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
78
90
|
"onAfter:leave"?: (() => any) | undefined;
|
|
91
|
+
"onAfter:enter"?: (() => any) | undefined;
|
|
79
92
|
"onClose:prevent"?: (() => any) | undefined;
|
|
80
93
|
}>, {
|
|
81
94
|
close: boolean | Partial<ButtonProps>;
|
|
@@ -4,8 +4,9 @@ import theme from "#build/ui/navigation-menu";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed, toRef } from "vue";
|
|
7
|
-
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from "reka-ui";
|
|
8
|
-
import {
|
|
7
|
+
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, AccordionRoot, AccordionItem, AccordionTrigger, AccordionContent, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { defu } from "defu";
|
|
9
|
+
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
9
10
|
import { useAppConfig } from "#imports";
|
|
10
11
|
import { get, isArrayOfArray } from "../utils";
|
|
11
12
|
import { tv } from "../utils/tv";
|
|
@@ -15,7 +16,7 @@ import ULink from "./Link.vue";
|
|
|
15
16
|
import UAvatar from "./Avatar.vue";
|
|
16
17
|
import UIcon from "./Icon.vue";
|
|
17
18
|
import UBadge from "./Badge.vue";
|
|
18
|
-
import
|
|
19
|
+
import UPopover from "./Popover.vue";
|
|
19
20
|
import UTooltip from "./Tooltip.vue";
|
|
20
21
|
const props = defineProps({
|
|
21
22
|
as: { type: null, required: false },
|
|
@@ -26,6 +27,8 @@ const props = defineProps({
|
|
|
26
27
|
variant: { type: null, required: false },
|
|
27
28
|
orientation: { type: null, required: false, default: "horizontal" },
|
|
28
29
|
collapsed: { type: Boolean, required: false },
|
|
30
|
+
tooltip: { type: [Boolean, Object], required: false },
|
|
31
|
+
popover: { type: [Boolean, Object], required: false },
|
|
29
32
|
highlight: { type: Boolean, required: false },
|
|
30
33
|
highlightColor: { type: null, required: false },
|
|
31
34
|
content: { type: Object, required: false },
|
|
@@ -41,7 +44,10 @@ const props = defineProps({
|
|
|
41
44
|
disableHoverTrigger: { type: Boolean, required: false },
|
|
42
45
|
skipDelayDuration: { type: Number, required: false },
|
|
43
46
|
disablePointerLeaveClose: { type: Boolean, required: false },
|
|
44
|
-
unmountOnHide: { type: Boolean, required: false, default: true }
|
|
47
|
+
unmountOnHide: { type: Boolean, required: false, default: true },
|
|
48
|
+
disabled: { type: Boolean, required: false },
|
|
49
|
+
type: { type: String, required: false, default: "multiple" },
|
|
50
|
+
collapsible: { type: Boolean, required: false, default: true }
|
|
45
51
|
});
|
|
46
52
|
const emits = defineEmits(["update:modelValue"]);
|
|
47
53
|
const slots = defineSlots();
|
|
@@ -58,7 +64,10 @@ const rootProps = useForwardPropsEmits(computed(() => ({
|
|
|
58
64
|
disablePointerLeaveClose: props.disablePointerLeaveClose,
|
|
59
65
|
unmountOnHide: props.unmountOnHide
|
|
60
66
|
})), emits);
|
|
67
|
+
const accordionProps = useForwardPropsEmits(reactivePick(props, "collapsible", "disabled", "type", "unmountOnHide"), emits);
|
|
61
68
|
const contentProps = toRef(() => props.content);
|
|
69
|
+
const tooltipProps = toRef(() => defu(typeof props.tooltip === "boolean" ? {} : props.tooltip, { delayDuration: 0, content: { side: "right" } }));
|
|
70
|
+
const popoverProps = toRef(() => defu(typeof props.popover === "boolean" ? {} : props.popover, { mode: "hover", content: { side: "right", align: "start", alignOffset: 2 } }));
|
|
62
71
|
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate();
|
|
63
72
|
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
|
|
64
73
|
props: {
|
|
@@ -69,7 +78,7 @@ const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
|
|
|
69
78
|
});
|
|
70
79
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.navigationMenu || {} })({
|
|
71
80
|
orientation: props.orientation,
|
|
72
|
-
contentOrientation: props.contentOrientation,
|
|
81
|
+
contentOrientation: props.orientation === "vertical" ? void 0 : props.contentOrientation,
|
|
73
82
|
collapsed: props.collapsed,
|
|
74
83
|
color: props.color,
|
|
75
84
|
variant: props.variant,
|
|
@@ -79,6 +88,15 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.navigationMen
|
|
|
79
88
|
const lists = computed(
|
|
80
89
|
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
81
90
|
);
|
|
91
|
+
function getAccordionDefaultValue(list, level = 0) {
|
|
92
|
+
const indexes = list.reduce((acc, item, index) => {
|
|
93
|
+
if (item.defaultOpen || item.open) {
|
|
94
|
+
acc.push(item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`));
|
|
95
|
+
}
|
|
96
|
+
return acc;
|
|
97
|
+
}, []);
|
|
98
|
+
return props.type === "single" ? indexes[0] : indexes;
|
|
99
|
+
}
|
|
82
100
|
</script>
|
|
83
101
|
|
|
84
102
|
<template>
|
|
@@ -100,7 +118,7 @@ const lists = computed(
|
|
|
100
118
|
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: [props.ui?.linkLabelExternalIcon, item.ui?.linkLabelExternalIcon], active })" />
|
|
101
119
|
</span>
|
|
102
120
|
|
|
103
|
-
<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, item.ui?.linkTrailing] })">
|
|
121
|
+
<component :is="orientation === 'vertical' && item.children?.length && !collapsed ? AccordionTrigger : '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'])" as="span" :class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })" @click.stop.prevent>
|
|
104
122
|
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
|
|
105
123
|
<UBadge
|
|
106
124
|
v-if="item.badge"
|
|
@@ -111,36 +129,62 @@ const lists = computed(
|
|
|
111
129
|
:class="ui.linkTrailingBadge({ class: [props.ui?.linkTrailingBadge, item.ui?.linkTrailingBadge] })"
|
|
112
130
|
/>
|
|
113
131
|
|
|
114
|
-
<UIcon v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length
|
|
132
|
+
<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, item.ui?.linkTrailingIcon], active })" />
|
|
115
133
|
<UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })" />
|
|
116
134
|
</slot>
|
|
117
|
-
</
|
|
135
|
+
</component>
|
|
118
136
|
</slot>
|
|
119
137
|
</DefineLinkTemplate>
|
|
120
138
|
|
|
121
139
|
<DefineItemTemplate v-slot="{ item, index, level = 0 }">
|
|
122
140
|
<component
|
|
123
|
-
:is="orientation === 'vertical' &&
|
|
141
|
+
:is="orientation === 'vertical' && !collapsed ? AccordionItem : NavigationMenuItem"
|
|
124
142
|
as="li"
|
|
125
|
-
:value="item.value || `item-${index}`"
|
|
126
|
-
:default-open="item.defaultOpen"
|
|
127
|
-
:disabled="orientation === 'vertical' && item.children?.length ? item.collapsible === false : void 0"
|
|
128
|
-
:unmount-on-hide="orientation === 'vertical' && item.children?.length ? unmountOnHide : void 0"
|
|
129
|
-
:open="item.open"
|
|
143
|
+
:value="item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`)"
|
|
130
144
|
>
|
|
131
|
-
<div v-if="orientation === 'vertical' && item.type === 'label'" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
|
|
145
|
+
<div v-if="orientation === 'vertical' && item.type === 'label' && !collapsed" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
|
|
132
146
|
<ReuseLinkTemplate :item="item" :index="index" />
|
|
133
147
|
</div>
|
|
134
|
-
<ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="orientation === 'vertical' && item.children?.length && item.
|
|
148
|
+
<ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="orientation === 'vertical' && item.children?.length && !collapsed && item.type === 'trigger' ? {} : pickLinkProps(item)" custom>
|
|
135
149
|
<component
|
|
136
|
-
:is="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) ? NavigationMenuTrigger : NavigationMenuLink"
|
|
150
|
+
:is="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) ? NavigationMenuTrigger : orientation === 'vertical' && item.children?.length && !collapsed && !slotProps.href ? AccordionTrigger : NavigationMenuLink"
|
|
137
151
|
as-child
|
|
138
152
|
:active="active || item.active"
|
|
139
153
|
:disabled="item.disabled"
|
|
140
154
|
@select="item.onSelect"
|
|
141
155
|
>
|
|
142
|
-
<
|
|
143
|
-
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level:
|
|
156
|
+
<UPopover v-if="orientation === 'vertical' && collapsed && item.children?.length && (!!props.popover || !!item.popover)" v-bind="{ ...popoverProps, ...typeof item.popover === 'boolean' ? {} : item.popover || {} }" :ui="{ content: ui.content({ class: [props.ui?.content, item.ui?.content] }) }">
|
|
157
|
+
<ULinkBase 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 })">
|
|
158
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
159
|
+
</ULinkBase>
|
|
160
|
+
|
|
161
|
+
<template #content>
|
|
162
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active || item.active" :index="index">
|
|
163
|
+
<ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })">
|
|
164
|
+
<li :class="ui.childLabel({ class: [props.ui?.childLabel, item.ui?.childLabel] })">
|
|
165
|
+
{{ get(item, props.labelKey) }}
|
|
166
|
+
</li>
|
|
167
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })">
|
|
168
|
+
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
169
|
+
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
170
|
+
<ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })">
|
|
171
|
+
<UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" />
|
|
172
|
+
|
|
173
|
+
<span :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })">
|
|
174
|
+
{{ get(childItem, props.labelKey) }}
|
|
175
|
+
|
|
176
|
+
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" />
|
|
177
|
+
</span>
|
|
178
|
+
</ULinkBase>
|
|
179
|
+
</NavigationMenuLink>
|
|
180
|
+
</ULink>
|
|
181
|
+
</li>
|
|
182
|
+
</ul>
|
|
183
|
+
</slot>
|
|
184
|
+
</template>
|
|
185
|
+
</UPopover>
|
|
186
|
+
<UTooltip v-else-if="orientation === 'vertical' && collapsed && (!!props.tooltip || !!item.tooltip)" :text="get(item, props.labelKey)" v-bind="{ ...tooltipProps, ...typeof item.tooltip === 'boolean' ? {} : item.tooltip || {} }">
|
|
187
|
+
<ULinkBase 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 })">
|
|
144
188
|
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
145
189
|
</ULinkBase>
|
|
146
190
|
</UTooltip>
|
|
@@ -150,7 +194,7 @@ const lists = computed(
|
|
|
150
194
|
</component>
|
|
151
195
|
|
|
152
196
|
<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, item.ui?.content] })">
|
|
153
|
-
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active" :index="index">
|
|
197
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active || item.active" :index="index">
|
|
154
198
|
<ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })">
|
|
155
199
|
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })">
|
|
156
200
|
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
@@ -177,8 +221,15 @@ const lists = computed(
|
|
|
177
221
|
</NavigationMenuContent>
|
|
178
222
|
</ULink>
|
|
179
223
|
|
|
180
|
-
<
|
|
181
|
-
<
|
|
224
|
+
<AccordionContent v-if="orientation === 'vertical' && item.children?.length && !collapsed" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })">
|
|
225
|
+
<AccordionRoot
|
|
226
|
+
v-bind="{
|
|
227
|
+
...accordionProps,
|
|
228
|
+
defaultValue: getAccordionDefaultValue(item.children, level + 1)
|
|
229
|
+
}"
|
|
230
|
+
as="ul"
|
|
231
|
+
:class="ui.childList({ class: props.ui?.childList })"
|
|
232
|
+
>
|
|
182
233
|
<ReuseItemTemplate
|
|
183
234
|
v-for="(childItem, childIndex) in item.children"
|
|
184
235
|
:key="childIndex"
|
|
@@ -187,8 +238,8 @@ const lists = computed(
|
|
|
187
238
|
:level="level + 1"
|
|
188
239
|
:class="ui.childItem({ class: [props.ui?.childItem, childItem.ui?.childItem] })"
|
|
189
240
|
/>
|
|
190
|
-
</
|
|
191
|
-
</
|
|
241
|
+
</AccordionRoot>
|
|
242
|
+
</AccordionContent>
|
|
192
243
|
</component>
|
|
193
244
|
</DefineItemTemplate>
|
|
194
245
|
|
|
@@ -196,9 +247,17 @@ const lists = computed(
|
|
|
196
247
|
<slot name="list-leading" />
|
|
197
248
|
|
|
198
249
|
<template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
|
|
199
|
-
<
|
|
250
|
+
<component
|
|
251
|
+
v-bind="orientation === 'vertical' && !collapsed ? {
|
|
252
|
+
...accordionProps,
|
|
253
|
+
defaultValue: getAccordionDefaultValue(list)
|
|
254
|
+
} : {}"
|
|
255
|
+
:is="orientation === 'vertical' && !collapsed ? AccordionRoot : NavigationMenuList"
|
|
256
|
+
as="ul"
|
|
257
|
+
:class="ui.list({ class: props.ui?.list })"
|
|
258
|
+
>
|
|
200
259
|
<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] })" />
|
|
201
|
-
</
|
|
260
|
+
</component>
|
|
202
261
|
|
|
203
262
|
<div v-if="orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" />
|
|
204
263
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, NavigationMenuContentEmits,
|
|
1
|
+
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, NavigationMenuContentEmits, AccordionRootProps } from 'reka-ui';
|
|
2
2
|
import type { AppConfig } from '@nuxt/schema';
|
|
3
3
|
import theme from '#build/ui/navigation-menu';
|
|
4
|
-
import type { AvatarProps, BadgeProps, LinkProps, TooltipProps } from '../types';
|
|
4
|
+
import type { AvatarProps, BadgeProps, LinkProps, PopoverProps, TooltipProps } from '../types';
|
|
5
5
|
import type { ArrayOrNested, DynamicSlots, MergeTypes, NestedItem, EmitsToProps, ComponentConfig } from '../types/utils';
|
|
6
6
|
type NavigationMenu = ComponentConfig<typeof theme, AppConfig, 'navigationMenu'>;
|
|
7
7
|
export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'type' | 'ui'> {
|
|
@@ -9,7 +9,7 @@ export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'type'
|
|
|
9
9
|
description?: string;
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
|
-
export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'
|
|
12
|
+
export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
13
13
|
label?: string;
|
|
14
14
|
/**
|
|
15
15
|
* @IconifyIcon
|
|
@@ -22,40 +22,41 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|
|
22
22
|
*/
|
|
23
23
|
badge?: string | number | BadgeProps;
|
|
24
24
|
/**
|
|
25
|
-
* Display a tooltip on the item.
|
|
26
|
-
*
|
|
27
|
-
* `{ content: { side: 'right' } }`{lang="ts-type"}
|
|
25
|
+
* Display a tooltip on the item when the menu is collapsed with the label of the item.
|
|
26
|
+
* This has priority over the global `tooltip` prop.
|
|
28
27
|
*/
|
|
29
|
-
tooltip?: TooltipProps;
|
|
28
|
+
tooltip?: boolean | TooltipProps;
|
|
29
|
+
/**
|
|
30
|
+
* Display a popover on the item when the menu is collapsed with the children list.
|
|
31
|
+
* This has priority over the global `popover` prop.
|
|
32
|
+
*/
|
|
33
|
+
popover?: boolean | PopoverProps;
|
|
30
34
|
/**
|
|
31
35
|
* @IconifyIcon
|
|
32
36
|
*/
|
|
33
37
|
trailingIcon?: string;
|
|
34
38
|
/**
|
|
35
39
|
* The type of the item.
|
|
36
|
-
* The `label` type only
|
|
40
|
+
* The `label` type is only displayed in `vertical` orientation.
|
|
41
|
+
* The `trigger` type is used to force the item to be collapsible when its a link in `vertical` orientation.
|
|
37
42
|
* @defaultValue 'link'
|
|
38
43
|
*/
|
|
39
|
-
type?: 'label' | 'link';
|
|
44
|
+
type?: 'label' | 'trigger' | 'link';
|
|
40
45
|
slot?: string;
|
|
41
46
|
/**
|
|
42
47
|
* The value of the item. Avoid using `index` as the value to prevent conflicts in horizontal orientation with Reka UI.
|
|
43
48
|
* @defaultValue `item-${index}`
|
|
44
49
|
*/
|
|
45
50
|
value?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Make the item collapsible.
|
|
48
|
-
* Only works when `orientation` is `vertical`.
|
|
49
|
-
* @defaultValue true
|
|
50
|
-
*/
|
|
51
|
-
collapsible?: boolean;
|
|
52
51
|
children?: NavigationMenuChildItem[];
|
|
52
|
+
defaultOpen?: boolean;
|
|
53
|
+
open?: boolean;
|
|
53
54
|
onSelect?(e: Event): void;
|
|
54
55
|
class?: any;
|
|
55
|
-
ui?: Pick<NavigationMenu['slots'], 'item' | 'linkLeadingAvatarSize' | 'linkLeadingAvatar' | 'linkLeadingIcon' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkTrailing' | 'linkTrailingBadgeSize' | 'linkTrailingBadge' | 'linkTrailingIcon' | 'label' | 'link' | 'content' | 'childList' | 'childItem' | 'childLink' | 'childLinkIcon' | 'childLinkWrapper' | 'childLinkLabel' | 'childLinkLabelExternalIcon' | 'childLinkDescription'>;
|
|
56
|
+
ui?: Pick<NavigationMenu['slots'], 'item' | 'linkLeadingAvatarSize' | 'linkLeadingAvatar' | 'linkLeadingIcon' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkTrailing' | 'linkTrailingBadgeSize' | 'linkTrailingBadge' | 'linkTrailingIcon' | 'label' | 'link' | 'content' | 'childList' | 'childLabel' | 'childItem' | 'childLink' | 'childLinkIcon' | 'childLinkWrapper' | 'childLinkLabel' | 'childLinkLabelExternalIcon' | 'childLinkDescription'>;
|
|
56
57
|
[key: string]: any;
|
|
57
58
|
}
|
|
58
|
-
export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'> {
|
|
59
|
+
export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'>, Pick<AccordionRootProps, 'disabled' | 'type' | 'collapsible'> {
|
|
59
60
|
/**
|
|
60
61
|
* The element or component this component should render as.
|
|
61
62
|
* @defaultValue 'div'
|
|
@@ -94,6 +95,18 @@ export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem>
|
|
|
94
95
|
* @defaultValue false
|
|
95
96
|
*/
|
|
96
97
|
collapsed?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Display a tooltip on the items when the menu is collapsed with the label of the item.
|
|
100
|
+
* `{ delayDuration: 0, content: { side: 'right' } }`{lang="ts-type"}
|
|
101
|
+
* @defaultValue false
|
|
102
|
+
*/
|
|
103
|
+
tooltip?: boolean | TooltipProps;
|
|
104
|
+
/**
|
|
105
|
+
* Display a popover on the items when the menu is collapsed with the children list.
|
|
106
|
+
* `{ mode: 'hover', content: { side: 'right', align: 'start', alignOffset: 2 } }`{lang="ts-type"}
|
|
107
|
+
* @defaultValue false
|
|
108
|
+
*/
|
|
109
|
+
popover?: boolean | PopoverProps;
|
|
97
110
|
/** Display a line next to the active item. */
|
|
98
111
|
highlight?: boolean;
|
|
99
112
|
/**
|