@nuxt/ui 2.11.1 → 2.12.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/dist/module.d.mts +100 -28
- package/dist/module.d.ts +100 -28
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/data/Table.vue +26 -18
- package/dist/runtime/components/data/Table.vue.d.ts +21 -12
- package/dist/runtime/components/elements/Accordion.vue +8 -4
- package/dist/runtime/components/elements/Accordion.vue.d.ts +4 -4
- package/dist/runtime/components/elements/Alert.vue +8 -2
- package/dist/runtime/components/elements/Alert.vue.d.ts +5 -10
- package/dist/runtime/components/elements/Button.vue.d.ts +1 -1
- package/dist/runtime/components/elements/Chip.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Dropdown.vue +64 -15
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +30 -2
- package/dist/runtime/components/elements/Link.vue +2 -2
- package/dist/runtime/components/forms/Form.vue +16 -7
- package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
- package/dist/runtime/components/forms/Input.vue +1 -1
- package/dist/runtime/components/forms/Input.vue.d.ts +1 -1
- package/dist/runtime/components/forms/InputMenu.vue +410 -0
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +331 -0
- package/dist/runtime/components/forms/RadioGroup.vue +1 -1
- package/dist/runtime/components/forms/Select.vue +1 -1
- package/dist/runtime/components/forms/Select.vue.d.ts +1 -1
- package/dist/runtime/components/forms/SelectMenu.vue +52 -19
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +28 -8
- package/dist/runtime/components/forms/Toggle.vue +1 -1
- package/dist/runtime/components/forms/Toggle.vue.d.ts +2 -1
- package/dist/runtime/components/navigation/Breadcrumb.vue +7 -4
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +3 -0
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Pagination.vue +9 -4
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +9 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue +54 -37
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +7 -3
- package/dist/runtime/components/overlays/Modal.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Popover.vue +49 -13
- package/dist/runtime/components/overlays/Popover.vue.d.ts +14 -4
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
- package/dist/runtime/composables/useShortcuts.mjs +3 -1
- package/dist/runtime/types/alert.d.ts +5 -0
- package/dist/runtime/types/breadcrumb.d.ts +1 -0
- package/dist/runtime/types/dropdown.d.ts +2 -0
- package/dist/runtime/types/form.d.ts +1 -0
- package/dist/runtime/types/vertical-navigation.d.ts +1 -0
- package/dist/runtime/ui.config/forms/input.mjs +12 -12
- package/dist/runtime/ui.config/forms/inputMenu.d.ts +64 -0
- package/dist/runtime/ui.config/forms/inputMenu.mjs +62 -0
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +14 -12
- package/dist/runtime/ui.config/forms/selectMenu.mjs +7 -41
- package/dist/runtime/ui.config/index.d.ts +1 -0
- package/dist/runtime/ui.config/index.mjs +1 -0
- package/dist/runtime/ui.config/layout/card.mjs +1 -1
- package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +1 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +1 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +5 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +5 -0
- package/dist/runtime/ui.config/popper.mjs +2 -1
- package/dist/runtime/utils/index.mjs +11 -3
- package/dist/runtime/utils/uid.mjs +2 -1
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +27 -24
|
@@ -13,7 +13,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
13
13
|
rows: {
|
|
14
14
|
type: PropType<{
|
|
15
15
|
[key: string]: any;
|
|
16
|
-
click?: Function | undefined;
|
|
17
16
|
}[]>;
|
|
18
17
|
default: () => never[];
|
|
19
18
|
};
|
|
@@ -22,6 +21,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
21
|
[key: string]: any;
|
|
23
22
|
key: string;
|
|
24
23
|
sortable?: boolean | undefined;
|
|
24
|
+
sort?: ((a: any, b: any, direction: 'asc' | 'desc') => number) | undefined;
|
|
25
25
|
direction?: "asc" | "desc" | undefined;
|
|
26
26
|
class?: string | undefined;
|
|
27
27
|
}[]>;
|
|
@@ -38,6 +38,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
38
38
|
}>;
|
|
39
39
|
default: () => {};
|
|
40
40
|
};
|
|
41
|
+
sortMode: {
|
|
42
|
+
type: PropType<"auto" | "manual">;
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
41
45
|
sortButton: {
|
|
42
46
|
type: PropType<Button>;
|
|
43
47
|
default: () => Button;
|
|
@@ -81,20 +85,20 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
81
85
|
attrs: import("vue").ComputedRef<Pick<{
|
|
82
86
|
[x: string]: unknown;
|
|
83
87
|
}, string>>;
|
|
84
|
-
sort: import("vue").
|
|
85
|
-
direction: string;
|
|
88
|
+
sort: import("vue").WritableComputedRef<{
|
|
86
89
|
column: string;
|
|
90
|
+
direction: 'asc' | 'desc';
|
|
87
91
|
}>;
|
|
88
92
|
columns: import("vue").ComputedRef<{
|
|
89
93
|
[key: string]: any;
|
|
90
94
|
key: string;
|
|
91
95
|
sortable?: boolean | undefined;
|
|
96
|
+
sort?: ((a: any, b: any, direction: 'asc' | 'desc') => number) | undefined;
|
|
92
97
|
direction?: "asc" | "desc" | undefined;
|
|
93
98
|
class?: string | undefined;
|
|
94
99
|
}[]>;
|
|
95
100
|
rows: import("vue").ComputedRef<{
|
|
96
101
|
[key: string]: any;
|
|
97
|
-
click?: Function | undefined;
|
|
98
102
|
}[]>;
|
|
99
103
|
selected: import("vue").WritableComputedRef<unknown[]>;
|
|
100
104
|
indeterminate: import("vue").ComputedRef<boolean>;
|
|
@@ -120,7 +124,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
120
124
|
rows: {
|
|
121
125
|
type: PropType<{
|
|
122
126
|
[key: string]: any;
|
|
123
|
-
click?: Function | undefined;
|
|
124
127
|
}[]>;
|
|
125
128
|
default: () => never[];
|
|
126
129
|
};
|
|
@@ -129,6 +132,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
129
132
|
[key: string]: any;
|
|
130
133
|
key: string;
|
|
131
134
|
sortable?: boolean | undefined;
|
|
135
|
+
sort?: ((a: any, b: any, direction: 'asc' | 'desc') => number) | undefined;
|
|
132
136
|
direction?: "asc" | "desc" | undefined;
|
|
133
137
|
class?: string | undefined;
|
|
134
138
|
}[]>;
|
|
@@ -145,6 +149,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
145
149
|
}>;
|
|
146
150
|
default: () => {};
|
|
147
151
|
};
|
|
152
|
+
sortMode: {
|
|
153
|
+
type: PropType<"auto" | "manual">;
|
|
154
|
+
default: string;
|
|
155
|
+
};
|
|
148
156
|
sortButton: {
|
|
149
157
|
type: PropType<Button>;
|
|
150
158
|
default: () => Button;
|
|
@@ -192,21 +200,22 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
192
200
|
direction: 'asc' | 'desc';
|
|
193
201
|
};
|
|
194
202
|
ui: any;
|
|
195
|
-
class: any;
|
|
196
|
-
modelValue: unknown[];
|
|
197
|
-
by: string | Function;
|
|
198
|
-
rows: {
|
|
199
|
-
[key: string]: any;
|
|
200
|
-
click?: Function | undefined;
|
|
201
|
-
}[];
|
|
202
203
|
columns: {
|
|
203
204
|
[key: string]: any;
|
|
204
205
|
key: string;
|
|
205
206
|
sortable?: boolean | undefined;
|
|
207
|
+
sort?: ((a: any, b: any, direction: 'asc' | 'desc') => number) | undefined;
|
|
206
208
|
direction?: "asc" | "desc" | undefined;
|
|
207
209
|
class?: string | undefined;
|
|
208
210
|
}[];
|
|
211
|
+
class: any;
|
|
212
|
+
modelValue: unknown[];
|
|
213
|
+
by: string | Function;
|
|
214
|
+
rows: {
|
|
215
|
+
[key: string]: any;
|
|
216
|
+
}[];
|
|
209
217
|
columnAttribute: string;
|
|
218
|
+
sortMode: "auto" | "manual";
|
|
210
219
|
sortButton: Button;
|
|
211
220
|
sortAscIcon: string;
|
|
212
221
|
sortDescIcon: string;
|
|
@@ -108,20 +108,24 @@ export default defineComponent({
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
function onEnter(
|
|
111
|
+
function onEnter(_el, done) {
|
|
112
|
+
const el = _el;
|
|
112
113
|
el.style.height = "0";
|
|
113
114
|
el.offsetHeight;
|
|
114
115
|
el.style.height = el.scrollHeight + "px";
|
|
115
116
|
el.addEventListener("transitionend", done, { once: true });
|
|
116
117
|
}
|
|
117
|
-
function onBeforeLeave(
|
|
118
|
+
function onBeforeLeave(_el) {
|
|
119
|
+
const el = _el;
|
|
118
120
|
el.style.height = el.scrollHeight + "px";
|
|
119
121
|
el.offsetHeight;
|
|
120
122
|
}
|
|
121
|
-
function onAfterEnter(
|
|
123
|
+
function onAfterEnter(_el) {
|
|
124
|
+
const el = _el;
|
|
122
125
|
el.style.height = "auto";
|
|
123
126
|
}
|
|
124
|
-
function onLeave(
|
|
127
|
+
function onLeave(_el, done) {
|
|
128
|
+
const el = _el;
|
|
125
129
|
el.style.height = "0";
|
|
126
130
|
el.addEventListener("transitionend", done, { once: true });
|
|
127
131
|
}
|
|
@@ -42,10 +42,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
42
42
|
}[]>;
|
|
43
43
|
closeOthers: (currentIndex: number, e: Event) => void;
|
|
44
44
|
omit: typeof omit;
|
|
45
|
-
onEnter: (
|
|
46
|
-
onBeforeLeave: (
|
|
47
|
-
onAfterEnter: (
|
|
48
|
-
onLeave: (
|
|
45
|
+
onEnter: (_el: Element, done: () => void) => void;
|
|
46
|
+
onBeforeLeave: (_el: Element) => void;
|
|
47
|
+
onAfterEnter: (_el: Element) => void;
|
|
48
|
+
onLeave: (_el: Element, done: () => void) => void;
|
|
49
49
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
50
50
|
items: {
|
|
51
51
|
type: PropType<AccordionItem[]>;
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
19
|
<div v-if="(description || $slots.description) && actions.length" :class="ui.actions">
|
|
20
|
-
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="action
|
|
20
|
+
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
<div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(ui.actions, 'mt-0')">
|
|
24
24
|
<template v-if="!description && !$slots.description && actions.length">
|
|
25
|
-
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="action
|
|
25
|
+
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<UButton v-if="closeButton" aria-label="Close" v-bind="{ ...(ui.default.closeButton || {}), ...closeButton }" @click.stop="$emit('close')" />
|
|
@@ -113,11 +113,17 @@ export default defineComponent({
|
|
|
113
113
|
variant?.replaceAll("{color}", props.color)
|
|
114
114
|
), props.class);
|
|
115
115
|
});
|
|
116
|
+
function onAction(action) {
|
|
117
|
+
if (action.click) {
|
|
118
|
+
action.click();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
116
121
|
return {
|
|
117
122
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
118
123
|
ui,
|
|
119
124
|
attrs,
|
|
120
125
|
alertClass,
|
|
126
|
+
onAction,
|
|
121
127
|
twMerge
|
|
122
128
|
};
|
|
123
129
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { Avatar, Button, AlertVariant } from '../../types';
|
|
2
|
+
import type { Avatar, Button, AlertVariant, AlertAction } from '../../types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
title: {
|
|
5
5
|
type: StringConstructor;
|
|
@@ -22,9 +22,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
22
|
default: () => Button;
|
|
23
23
|
};
|
|
24
24
|
actions: {
|
|
25
|
-
type: PropType<
|
|
26
|
-
click?: Function | undefined;
|
|
27
|
-
})[]>;
|
|
25
|
+
type: PropType<AlertAction[]>;
|
|
28
26
|
default: () => never[];
|
|
29
27
|
};
|
|
30
28
|
color: {
|
|
@@ -51,6 +49,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
51
49
|
[x: string]: unknown;
|
|
52
50
|
}, string>>;
|
|
53
51
|
alertClass: import("vue").ComputedRef<string>;
|
|
52
|
+
onAction: (action: AlertAction) => void;
|
|
54
53
|
twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
|
|
55
54
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
56
55
|
title: {
|
|
@@ -74,9 +73,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
74
73
|
default: () => Button;
|
|
75
74
|
};
|
|
76
75
|
actions: {
|
|
77
|
-
type: PropType<
|
|
78
|
-
click?: Function | undefined;
|
|
79
|
-
})[]>;
|
|
76
|
+
type: PropType<AlertAction[]>;
|
|
80
77
|
default: () => never[];
|
|
81
78
|
};
|
|
82
79
|
color: {
|
|
@@ -105,9 +102,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
105
102
|
icon: string;
|
|
106
103
|
avatar: Avatar;
|
|
107
104
|
closeButton: Button;
|
|
108
|
-
actions:
|
|
109
|
-
click?: Function | undefined;
|
|
110
|
-
})[];
|
|
105
|
+
actions: AlertAction[];
|
|
111
106
|
color: any;
|
|
112
107
|
class: any;
|
|
113
108
|
variant: AlertVariant;
|
|
@@ -180,6 +180,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
180
180
|
icon: string;
|
|
181
181
|
color: any;
|
|
182
182
|
type: string;
|
|
183
|
+
leading: boolean;
|
|
183
184
|
class: any;
|
|
184
185
|
label: string;
|
|
185
186
|
loading: boolean;
|
|
@@ -191,7 +192,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
191
192
|
leadingIcon: string;
|
|
192
193
|
trailingIcon: string;
|
|
193
194
|
trailing: boolean;
|
|
194
|
-
leading: boolean;
|
|
195
195
|
square: boolean;
|
|
196
196
|
}, {}>;
|
|
197
197
|
export default _default;
|
|
@@ -81,10 +81,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
81
81
|
size: "sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl";
|
|
82
82
|
ui: any;
|
|
83
83
|
color: any;
|
|
84
|
+
inset: boolean;
|
|
85
|
+
position: "top-right" | "bottom-right" | "top-left" | "bottom-left";
|
|
84
86
|
class: any;
|
|
85
87
|
text: string | number;
|
|
86
|
-
position: "top-right" | "bottom-right" | "top-left" | "bottom-left";
|
|
87
|
-
inset: boolean;
|
|
88
88
|
show: boolean;
|
|
89
89
|
}, {}>;
|
|
90
90
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<!-- eslint-disable-next-line vue/no-template-shadow -->
|
|
2
3
|
<HMenu v-slot="{ open }" as="div" :class="ui.wrapper" v-bind="attrs" @mouseleave="onMouseLeave">
|
|
3
4
|
<HMenuButton
|
|
4
5
|
ref="trigger"
|
|
@@ -19,23 +20,24 @@
|
|
|
19
20
|
<Transition appear v-bind="ui.transition">
|
|
20
21
|
<div>
|
|
21
22
|
<div v-if="popper.arrow" data-popper-arrow :class="Object.values(ui.arrow)" />
|
|
23
|
+
|
|
22
24
|
<HMenuItems :class="[ui.base, ui.divide, ui.ring, ui.rounded, ui.shadow, ui.background, ui.height]" static>
|
|
23
25
|
<div v-for="(subItems, index) of items" :key="index" :class="ui.padding">
|
|
24
|
-
<NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal }" v-bind="omit(item, ['label', 'slot', 'icon', 'iconClass', 'avatar', 'shortcuts', 'disabled', 'click'])" custom>
|
|
26
|
+
<NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal }" v-bind="omit(item, ['label', 'labelClass', 'slot', 'icon', 'iconClass', 'avatar', 'shortcuts', 'disabled', 'class', 'click'])" custom>
|
|
25
27
|
<HMenuItem v-slot="{ active, disabled: itemDisabled, close }" :disabled="item.disabled">
|
|
26
28
|
<component
|
|
27
29
|
:is="!!href ? 'a' : 'button'"
|
|
28
30
|
:href="!itemDisabled ? href : undefined"
|
|
29
31
|
:rel="rel"
|
|
30
32
|
:target="target"
|
|
31
|
-
:class="
|
|
33
|
+
:class="twMerge(twJoin(ui.item.base, ui.item.padding, ui.item.size, ui.item.rounded, active ? ui.item.active : ui.item.inactive, itemDisabled && ui.item.disabled), item.class)"
|
|
32
34
|
@click="onClick($event, item, { href, navigate, close, isExternal })"
|
|
33
35
|
>
|
|
34
36
|
<slot :name="item.slot || 'item'" :item="item">
|
|
35
|
-
<UIcon v-if="item.icon" :name="item.icon" :class="
|
|
37
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="twMerge(twJoin(ui.item.icon.base, active ? ui.item.icon.active : ui.item.icon.inactive), item.iconClass)" />
|
|
36
38
|
<UAvatar v-else-if="item.avatar" v-bind="{ size: ui.item.avatar.size, ...item.avatar }" :class="ui.item.avatar.base" />
|
|
37
39
|
|
|
38
|
-
<span :class="ui.item.label">{{ item.label }}</span>
|
|
40
|
+
<span :class="twMerge(ui.item.label, item.labelClass)">{{ item.label }}</span>
|
|
39
41
|
|
|
40
42
|
<span v-if="item.shortcuts?.length" :class="ui.item.shortcuts">
|
|
41
43
|
<UKbd v-for="shortcut of item.shortcuts" :key="shortcut">{{ shortcut }}</UKbd>
|
|
@@ -53,9 +55,10 @@
|
|
|
53
55
|
</template>
|
|
54
56
|
|
|
55
57
|
<script>
|
|
56
|
-
import { defineComponent, ref, computed, toRef, onMounted, resolveComponent } from "vue";
|
|
58
|
+
import { defineComponent, ref, computed, watch, toRef, onMounted, resolveComponent } from "vue";
|
|
57
59
|
import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem } from "@headlessui/vue";
|
|
58
60
|
import { defu } from "defu";
|
|
61
|
+
import { twMerge, twJoin } from "tailwind-merge";
|
|
59
62
|
import UIcon from "../elements/Icon.vue";
|
|
60
63
|
import UAvatar from "../elements/Avatar.vue";
|
|
61
64
|
import UKbd from "../elements/Kbd.vue";
|
|
@@ -86,6 +89,10 @@ export default defineComponent({
|
|
|
86
89
|
default: "click",
|
|
87
90
|
validator: (value) => ["click", "hover"].includes(value)
|
|
88
91
|
},
|
|
92
|
+
open: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: void 0
|
|
95
|
+
},
|
|
89
96
|
disabled: {
|
|
90
97
|
type: Boolean,
|
|
91
98
|
default: false
|
|
@@ -111,7 +118,8 @@ export default defineComponent({
|
|
|
111
118
|
default: () => ({})
|
|
112
119
|
}
|
|
113
120
|
},
|
|
114
|
-
|
|
121
|
+
emits: ["update:open"],
|
|
122
|
+
setup(props, { emit }) {
|
|
115
123
|
const { ui, attrs } = useUI("dropdown", toRef(props, "ui"), config, toRef(props, "class"));
|
|
116
124
|
const popper = computed(() => defu(props.mode === "hover" ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper));
|
|
117
125
|
const [trigger, container] = usePopper(popper.value);
|
|
@@ -119,18 +127,41 @@ export default defineComponent({
|
|
|
119
127
|
let openTimeout = null;
|
|
120
128
|
let closeTimeout = null;
|
|
121
129
|
onMounted(() => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
const menuProvides = trigger.value?.$.provides;
|
|
131
|
+
if (!menuProvides) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const menuProvidesSymbols = Object.getOwnPropertySymbols(menuProvides);
|
|
135
|
+
menuApi.value = menuProvidesSymbols.length && menuProvides[menuProvidesSymbols[0]];
|
|
136
|
+
if (props.open) {
|
|
137
|
+
menuApi.value?.openMenu();
|
|
138
|
+
}
|
|
130
139
|
});
|
|
131
140
|
const containerStyle = computed(() => {
|
|
141
|
+
if (props.mode !== "hover") {
|
|
142
|
+
return {};
|
|
143
|
+
}
|
|
132
144
|
const offsetDistance = props.popper?.offsetDistance || ui.value.popper?.offsetDistance || 8;
|
|
133
|
-
|
|
145
|
+
const placement = popper.value.placement?.split("-")[0];
|
|
146
|
+
const padding = `${offsetDistance}px`;
|
|
147
|
+
if (placement === "top" || placement === "bottom") {
|
|
148
|
+
return {
|
|
149
|
+
paddingTop: padding,
|
|
150
|
+
paddingBottom: padding
|
|
151
|
+
};
|
|
152
|
+
} else if (placement === "left" || placement === "right") {
|
|
153
|
+
return {
|
|
154
|
+
paddingLeft: padding,
|
|
155
|
+
paddingRight: padding
|
|
156
|
+
};
|
|
157
|
+
} else {
|
|
158
|
+
return {
|
|
159
|
+
paddingTop: padding,
|
|
160
|
+
paddingBottom: padding,
|
|
161
|
+
paddingLeft: padding,
|
|
162
|
+
paddingRight: padding
|
|
163
|
+
};
|
|
164
|
+
}
|
|
134
165
|
});
|
|
135
166
|
function onMouseOver() {
|
|
136
167
|
if (props.mode !== "hover" || !menuApi.value) {
|
|
@@ -173,6 +204,22 @@ export default defineComponent({
|
|
|
173
204
|
close();
|
|
174
205
|
}
|
|
175
206
|
}
|
|
207
|
+
watch(() => props.open, (newValue, oldValue) => {
|
|
208
|
+
if (!menuApi.value)
|
|
209
|
+
return;
|
|
210
|
+
if (oldValue === void 0 || newValue === oldValue)
|
|
211
|
+
return;
|
|
212
|
+
if (newValue) {
|
|
213
|
+
menuApi.value.openMenu();
|
|
214
|
+
} else {
|
|
215
|
+
menuApi.value.closeMenu();
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
watch(() => menuApi.value?.menuState, (newValue, oldValue) => {
|
|
219
|
+
if (oldValue === void 0 || newValue === oldValue)
|
|
220
|
+
return;
|
|
221
|
+
emit("update:open", newValue === 0);
|
|
222
|
+
});
|
|
176
223
|
const NuxtLink = resolveComponent("NuxtLink");
|
|
177
224
|
return {
|
|
178
225
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
@@ -187,6 +234,8 @@ export default defineComponent({
|
|
|
187
234
|
onMouseLeave,
|
|
188
235
|
onClick,
|
|
189
236
|
omit,
|
|
237
|
+
twMerge,
|
|
238
|
+
twJoin,
|
|
190
239
|
NuxtLink
|
|
191
240
|
};
|
|
192
241
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
+
import { twJoin } from 'tailwind-merge';
|
|
2
3
|
import { omit } from '../../utils';
|
|
3
4
|
import type { DropdownItem, PopperOptions } from '../../types';
|
|
4
5
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -11,6 +12,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
12
|
default: string;
|
|
12
13
|
validator: (value: string) => boolean;
|
|
13
14
|
};
|
|
15
|
+
open: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
14
19
|
disabled: {
|
|
15
20
|
type: BooleanConstructor;
|
|
16
21
|
default: boolean;
|
|
@@ -44,11 +49,25 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
44
49
|
trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
45
50
|
container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
46
51
|
containerStyle: import("vue").ComputedRef<{
|
|
52
|
+
paddingTop?: undefined;
|
|
53
|
+
paddingBottom?: undefined;
|
|
54
|
+
paddingLeft?: undefined;
|
|
55
|
+
paddingRight?: undefined;
|
|
56
|
+
} | {
|
|
47
57
|
paddingTop: string;
|
|
48
58
|
paddingBottom: string;
|
|
59
|
+
paddingLeft?: undefined;
|
|
60
|
+
paddingRight?: undefined;
|
|
49
61
|
} | {
|
|
62
|
+
paddingLeft: string;
|
|
63
|
+
paddingRight: string;
|
|
50
64
|
paddingTop?: undefined;
|
|
51
65
|
paddingBottom?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
paddingTop: string;
|
|
68
|
+
paddingBottom: string;
|
|
69
|
+
paddingLeft: string;
|
|
70
|
+
paddingRight: string;
|
|
52
71
|
}>;
|
|
53
72
|
onMouseOver: () => void;
|
|
54
73
|
onMouseLeave: () => void;
|
|
@@ -59,8 +78,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
78
|
isExternal: any;
|
|
60
79
|
}) => void;
|
|
61
80
|
omit: typeof omit;
|
|
81
|
+
twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
|
|
82
|
+
twJoin: typeof twJoin;
|
|
62
83
|
NuxtLink: string | import("vue").ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
63
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
84
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:open"[], "update:open", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
64
85
|
items: {
|
|
65
86
|
type: PropType<DropdownItem[][]>;
|
|
66
87
|
default: () => never[];
|
|
@@ -70,6 +91,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
70
91
|
default: string;
|
|
71
92
|
validator: (value: string) => boolean;
|
|
72
93
|
};
|
|
94
|
+
open: {
|
|
95
|
+
type: BooleanConstructor;
|
|
96
|
+
default: undefined;
|
|
97
|
+
};
|
|
73
98
|
disabled: {
|
|
74
99
|
type: BooleanConstructor;
|
|
75
100
|
default: boolean;
|
|
@@ -94,12 +119,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
94
119
|
type: PropType<any>;
|
|
95
120
|
default: () => {};
|
|
96
121
|
};
|
|
97
|
-
}
|
|
122
|
+
}>> & {
|
|
123
|
+
"onUpdate:open"?: ((...args: any[]) => any) | undefined;
|
|
124
|
+
}, {
|
|
98
125
|
ui: any;
|
|
99
126
|
popper: PopperOptions;
|
|
100
127
|
class: any;
|
|
101
128
|
disabled: boolean;
|
|
102
129
|
items: DropdownItem[][];
|
|
130
|
+
open: boolean;
|
|
103
131
|
mode: "click" | "hover";
|
|
104
132
|
openDelay: number;
|
|
105
133
|
closeDelay: number;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:role="disabled ? 'link' : undefined"
|
|
22
22
|
:rel="rel"
|
|
23
23
|
:target="target"
|
|
24
|
-
:class="active ? activeClass : resolveLinkClass(route, $route, { isActive, isExactActive })"
|
|
24
|
+
:class="active !== undefined ? (active ? activeClass : inactiveClass) : resolveLinkClass(route, $route, { isActive, isExactActive })"
|
|
25
25
|
@click="(e) => !isExternal && navigate(e)"
|
|
26
26
|
>
|
|
27
27
|
<slot v-bind="{ isActive: exact ? isExactActive : isActive }" />
|
|
@@ -47,7 +47,7 @@ export default defineComponent({
|
|
|
47
47
|
},
|
|
48
48
|
active: {
|
|
49
49
|
type: Boolean,
|
|
50
|
-
default:
|
|
50
|
+
default: void 0
|
|
51
51
|
},
|
|
52
52
|
exact: {
|
|
53
53
|
type: Boolean,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
-
import { provide, ref, defineComponent } from "vue";
|
|
8
|
+
import { provide, ref, defineComponent, onUnmounted, onMounted } from "vue";
|
|
9
9
|
import { useEventBus } from "@vueuse/core";
|
|
10
10
|
import { uid } from "../../utils/uid";
|
|
11
11
|
class FormException extends Error {
|
|
@@ -37,10 +37,15 @@ export default defineComponent({
|
|
|
37
37
|
emits: ["submit", "error"],
|
|
38
38
|
setup(props, { expose, emit }) {
|
|
39
39
|
const bus = useEventBus(`form-${uid()}`);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
bus.on(async (event) => {
|
|
42
|
+
if (event.type !== "submit" && props.validateOn?.includes(event.type)) {
|
|
43
|
+
await validate(event.path, { silent: true });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
onUnmounted(() => {
|
|
48
|
+
bus.reset();
|
|
44
49
|
});
|
|
45
50
|
const errors = ref([]);
|
|
46
51
|
provide("form-errors", errors);
|
|
@@ -83,7 +88,8 @@ export default defineComponent({
|
|
|
83
88
|
}
|
|
84
89
|
return props.state;
|
|
85
90
|
}
|
|
86
|
-
async function onSubmit(
|
|
91
|
+
async function onSubmit(payload) {
|
|
92
|
+
const event = payload;
|
|
87
93
|
try {
|
|
88
94
|
if (props.validateOn?.includes("submit")) {
|
|
89
95
|
await validate();
|
|
@@ -120,6 +126,9 @@ export default defineComponent({
|
|
|
120
126
|
errors.value = errs;
|
|
121
127
|
}
|
|
122
128
|
},
|
|
129
|
+
async submit() {
|
|
130
|
+
await onSubmit(new Event("submit"));
|
|
131
|
+
},
|
|
123
132
|
getErrors(path) {
|
|
124
133
|
if (path) {
|
|
125
134
|
return errors.value.filter((err) => err.path === path);
|
|
@@ -128,7 +137,7 @@ export default defineComponent({
|
|
|
128
137
|
},
|
|
129
138
|
clear(path) {
|
|
130
139
|
if (path) {
|
|
131
|
-
errors.value = errors.value.filter((err) => err.path
|
|
140
|
+
errors.value = errors.value.filter((err) => err.path !== path);
|
|
132
141
|
} else {
|
|
133
142
|
errors.value = [];
|
|
134
143
|
}
|
|
@@ -22,7 +22,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
22
|
default: () => string[];
|
|
23
23
|
};
|
|
24
24
|
}, {
|
|
25
|
-
onSubmit: (
|
|
25
|
+
onSubmit: (payload: Event) => Promise<void>;
|
|
26
26
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("error" | "submit")[], "error" | "submit", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
27
|
schema: {
|
|
28
28
|
type: PropType<ZodSchema<any, import("zod").ZodTypeDef, any>> | PropType<YupObjectSchema<any, import("yup").AnyObject, any, "">> | PropType<JoiSchema> | PropType<ValibotObjectSchema<any>>;
|
|
@@ -239,6 +239,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
239
239
|
color: any;
|
|
240
240
|
type: string;
|
|
241
241
|
name: string;
|
|
242
|
+
leading: boolean;
|
|
242
243
|
class: any;
|
|
243
244
|
modelValue: string | number;
|
|
244
245
|
loading: boolean;
|
|
@@ -251,7 +252,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
251
252
|
leadingIcon: string;
|
|
252
253
|
trailingIcon: string;
|
|
253
254
|
trailing: boolean;
|
|
254
|
-
leading: boolean;
|
|
255
255
|
autofocus: boolean;
|
|
256
256
|
inputClass: string;
|
|
257
257
|
autofocusDelay: number;
|