@nuxt/ui 2.10.0 → 2.11.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 +11 -0
- package/dist/module.d.mts +191 -82
- package/dist/module.d.ts +191 -82
- package/dist/module.json +1 -1
- package/dist/module.mjs +12 -5
- package/dist/runtime/components/elements/Alert.vue +7 -6
- package/dist/runtime/components/elements/Alert.vue.d.ts +6 -5
- package/dist/runtime/components/elements/Avatar.vue.d.ts +5 -4
- package/dist/runtime/components/elements/AvatarGroup.d.ts +4 -3
- package/dist/runtime/components/elements/Badge.vue +4 -2
- package/dist/runtime/components/elements/Badge.vue.d.ts +5 -5
- package/dist/runtime/components/elements/Button.vue +8 -6
- package/dist/runtime/components/elements/Button.vue.d.ts +6 -6
- package/dist/runtime/components/elements/ButtonGroup.d.ts +5 -4
- package/dist/runtime/components/elements/ButtonGroup.mjs +19 -32
- package/dist/runtime/components/elements/Chip.vue +85 -0
- package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
- package/dist/runtime/components/elements/Dropdown.vue +31 -17
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +6 -0
- package/dist/runtime/components/elements/Icon.vue +16 -2
- package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
- package/dist/runtime/components/elements/Kbd.vue.d.ts +5 -4
- package/dist/runtime/components/elements/Link.vue +2 -5
- package/dist/runtime/components/elements/Meter.vue.d.ts +3 -3
- package/dist/runtime/components/elements/MeterGroup.d.ts +2 -2
- package/dist/runtime/components/elements/Progress.vue +1 -1
- package/dist/runtime/components/forms/Checkbox.vue +2 -4
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +5 -5
- package/dist/runtime/components/forms/FormGroup.vue +7 -3
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +15 -5
- package/dist/runtime/components/forms/Input.vue +36 -5
- package/dist/runtime/components/forms/Input.vue.d.ts +32 -9
- package/dist/runtime/components/forms/Radio.vue +12 -6
- package/dist/runtime/components/forms/Radio.vue.d.ts +5 -4
- package/dist/runtime/components/forms/RadioGroup.vue +1 -1
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +1 -1
- package/dist/runtime/components/forms/Range.vue.d.ts +6 -5
- package/dist/runtime/components/forms/Select.vue +5 -2
- package/dist/runtime/components/forms/Select.vue.d.ts +9 -8
- package/dist/runtime/components/forms/SelectMenu.vue +24 -7
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +18 -9
- package/dist/runtime/components/forms/Textarea.vue +33 -3
- package/dist/runtime/components/forms/Textarea.vue.d.ts +31 -8
- package/dist/runtime/components/forms/Toggle.vue +19 -1
- package/dist/runtime/components/forms/Toggle.vue.d.ts +15 -2
- package/dist/runtime/components/layout/Divider.vue.d.ts +3 -3
- package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
- package/dist/runtime/components/navigation/CommandPalette.vue +8 -4
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +4 -4
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Notification.vue +27 -28
- package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
- package/dist/runtime/components/overlays/Notifications.vue +16 -14
- package/dist/runtime/components/overlays/Popover.vue +9 -0
- package/dist/runtime/components/overlays/Popover.vue.d.ts +13 -2
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.mjs +8 -4
- package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
- package/dist/runtime/composables/useButtonGroup.mjs +52 -0
- package/dist/runtime/composables/useFormGroup.d.ts +4 -2
- package/dist/runtime/composables/useFormGroup.mjs +3 -2
- package/dist/runtime/composables/useShortcuts.d.ts +2 -2
- package/dist/runtime/types/alert.d.ts +7 -0
- package/dist/runtime/types/avatar.d.ts +3 -1
- package/dist/runtime/types/badge.d.ts +5 -4
- package/dist/runtime/types/breadcrumb.d.ts +7 -0
- package/dist/runtime/types/button.d.ts +5 -4
- package/dist/runtime/types/chip.d.ts +11 -0
- package/dist/runtime/types/dropdown.d.ts +2 -2
- package/dist/runtime/types/form-group.d.ts +5 -0
- package/dist/runtime/types/form.d.ts +2 -1
- package/dist/runtime/types/index.d.ts +10 -0
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/kbd.d.ts +5 -0
- package/dist/runtime/types/range.d.ts +5 -0
- package/dist/runtime/types/select.d.ts +8 -0
- package/dist/runtime/types/textarea.d.ts +8 -0
- package/dist/runtime/types/toggle.d.ts +5 -0
- package/dist/runtime/types/utils.d.ts +22 -5
- package/dist/runtime/ui.config/_popperArrow.d.ts +9 -0
- package/dist/runtime/ui.config/_popperArrow.mjs +8 -0
- package/dist/runtime/ui.config/data/table.d.ts +60 -0
- package/dist/runtime/ui.config/data/table.mjs +59 -0
- package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
- package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
- package/dist/runtime/ui.config/elements/alert.d.ts +40 -0
- package/dist/runtime/ui.config/elements/alert.mjs +39 -0
- package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
- package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
- package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
- package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
- package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
- package/dist/runtime/ui.config/elements/badge.mjs +33 -0
- package/dist/runtime/ui.config/elements/button.d.ts +77 -0
- package/dist/runtime/ui.config/elements/button.mjs +76 -0
- package/dist/runtime/ui.config/elements/buttonGroup.d.ts +9 -0
- package/dist/runtime/ui.config/elements/buttonGroup.mjs +8 -0
- package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
- package/dist/runtime/ui.config/elements/chip.mjs +34 -0
- package/dist/runtime/ui.config/elements/dropdown.d.ts +53 -0
- package/dist/runtime/ui.config/elements/dropdown.mjs +51 -0
- package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
- package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
- package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
- package/dist/runtime/ui.config/elements/meter.mjs +76 -0
- package/dist/runtime/ui.config/elements/meterGroup.d.ts +12 -0
- package/dist/runtime/ui.config/elements/meterGroup.mjs +11 -0
- package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
- package/dist/runtime/ui.config/elements/progress.mjs +74 -0
- package/dist/runtime/ui.config/forms/checkbox.d.ts +16 -0
- package/dist/runtime/ui.config/forms/checkbox.mjs +15 -0
- package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
- package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
- package/dist/runtime/ui.config/forms/input.d.ts +105 -0
- package/dist/runtime/ui.config/forms/input.mjs +104 -0
- package/dist/runtime/ui.config/forms/radio.d.ts +15 -0
- package/dist/runtime/ui.config/forms/radio.mjs +14 -0
- package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
- package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
- package/dist/runtime/ui.config/forms/range.d.ts +64 -0
- package/dist/runtime/ui.config/forms/range.mjs +63 -0
- package/dist/runtime/ui.config/forms/select.d.ts +106 -0
- package/dist/runtime/ui.config/forms/select.mjs +12 -0
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +63 -0
- package/dist/runtime/ui.config/forms/selectMenu.mjs +61 -0
- package/dist/runtime/ui.config/forms/textarea.d.ts +104 -0
- package/dist/runtime/ui.config/forms/textarea.mjs +9 -0
- package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
- package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
- package/dist/runtime/ui.config/index.d.ts +40 -0
- package/dist/runtime/ui.config/index.mjs +40 -0
- package/dist/runtime/ui.config/layout/card.d.ts +24 -0
- package/dist/runtime/ui.config/layout/card.mjs +23 -0
- package/dist/runtime/ui.config/layout/container.d.ts +6 -0
- package/dist/runtime/ui.config/layout/container.mjs +5 -0
- package/dist/runtime/ui.config/layout/divider.d.ts +30 -0
- package/dist/runtime/ui.config/layout/divider.mjs +29 -0
- package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
- package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +68 -0
- package/dist/runtime/ui.config/navigation/commandPalette.mjs +67 -0
- package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
- package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
- package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
- package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
- package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
- package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
- package/dist/runtime/ui.config/overlays/modal.d.ts +35 -0
- package/dist/runtime/ui.config/overlays/modal.mjs +36 -0
- package/dist/runtime/ui.config/overlays/notification.d.ts +49 -0
- package/dist/runtime/ui.config/overlays/notification.mjs +49 -0
- package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
- package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
- package/dist/runtime/ui.config/overlays/popover.d.ts +42 -0
- package/dist/runtime/ui.config/overlays/popover.mjs +36 -0
- package/dist/runtime/ui.config/overlays/slideover.d.ts +27 -0
- package/dist/runtime/ui.config/overlays/slideover.mjs +28 -0
- package/dist/runtime/ui.config/overlays/tooltip.d.ts +32 -0
- package/dist/runtime/ui.config/overlays/tooltip.mjs +26 -0
- package/dist/runtime/utils/index.d.ts +5 -0
- package/dist/runtime/utils/index.mjs +6 -2
- package/dist/types.d.mts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +32 -19
- package/dist/runtime/ui.config.d.ts +0 -1470
- package/dist/runtime/ui.config.mjs +0 -1273
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav aria-label="Breadcrumb" :class="ui.wrapper" v-bind="attrs">
|
|
3
|
+
<ol :class="ui.ol">
|
|
4
|
+
<li v-for="(link, index) in links" :key="index" :class="ui.li">
|
|
5
|
+
<ULink
|
|
6
|
+
as="span"
|
|
7
|
+
:class="[ui.base, index === links.length - 1 ? ui.active : !!link.to ? ui.inactive : '']"
|
|
8
|
+
v-bind="omit(link, ['label', 'icon', 'iconClass'])"
|
|
9
|
+
:aria-current="index === links.length - 1 ? 'page' : undefined"
|
|
10
|
+
>
|
|
11
|
+
<slot name="icon" :link="link" :index="index" :is-active="index === links.length - 1">
|
|
12
|
+
<UIcon
|
|
13
|
+
v-if="link.icon"
|
|
14
|
+
:name="link.icon"
|
|
15
|
+
:class="[ui.icon.base, index === links.length - 1 ? ui.icon.active : !!link.to ? ui.icon.inactive : '', link.iconClass]"
|
|
16
|
+
/>
|
|
17
|
+
</slot>
|
|
18
|
+
|
|
19
|
+
<slot :link="link" :index="index" :is-active="index === links.length - 1">
|
|
20
|
+
{{ link.label }}
|
|
21
|
+
</slot>
|
|
22
|
+
</ULink>
|
|
23
|
+
|
|
24
|
+
<slot v-if="index < links.length - 1" name="divider">
|
|
25
|
+
<template v-if="divider">
|
|
26
|
+
<UIcon v-if="divider.startsWith('i-')" :name="divider" :class="ui.divider.base" role="presentation" />
|
|
27
|
+
<span v-else role="presentation">{{ divider }}</span>
|
|
28
|
+
</template>
|
|
29
|
+
</slot>
|
|
30
|
+
</li>
|
|
31
|
+
</ol>
|
|
32
|
+
</nav>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import { defineComponent, toRef } from "vue";
|
|
37
|
+
import UIcon from "../elements/Icon.vue";
|
|
38
|
+
import ULink from "../elements/Link.vue";
|
|
39
|
+
import { useUI } from "../../composables/useUI";
|
|
40
|
+
import { mergeConfig, omit } from "../../utils";
|
|
41
|
+
import appConfig from "#build/app.config";
|
|
42
|
+
import { breadcrumb } from "#ui/ui.config";
|
|
43
|
+
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.breadcrumb, breadcrumb);
|
|
44
|
+
export default defineComponent({
|
|
45
|
+
components: {
|
|
46
|
+
UIcon,
|
|
47
|
+
ULink
|
|
48
|
+
},
|
|
49
|
+
inheritAttrs: false,
|
|
50
|
+
props: {
|
|
51
|
+
links: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default: () => []
|
|
54
|
+
},
|
|
55
|
+
divider: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: () => config.default.divider
|
|
58
|
+
},
|
|
59
|
+
class: {
|
|
60
|
+
type: [String, Object, Array],
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
ui: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default: void 0
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
setup(props) {
|
|
69
|
+
const { ui, attrs } = useUI("breadcrumb", toRef(props, "ui"), config, toRef(props, "class"));
|
|
70
|
+
return {
|
|
71
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
72
|
+
ui,
|
|
73
|
+
attrs,
|
|
74
|
+
omit
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
</script>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import { omit } from '../../utils';
|
|
3
|
+
import type { BreadcrumbLink } from '../../types';
|
|
4
|
+
declare const _default: import("vue").DefineComponent<{
|
|
5
|
+
links: {
|
|
6
|
+
type: PropType<BreadcrumbLink[]>;
|
|
7
|
+
default: () => never[];
|
|
8
|
+
};
|
|
9
|
+
divider: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
default: () => any;
|
|
12
|
+
};
|
|
13
|
+
class: {
|
|
14
|
+
type: PropType<any>;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
ui: {
|
|
18
|
+
type: PropType<Partial<any>>;
|
|
19
|
+
default: undefined;
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
ui: import("vue").ComputedRef<any>;
|
|
23
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
24
|
+
[x: string]: unknown;
|
|
25
|
+
}, string>>;
|
|
26
|
+
omit: typeof omit;
|
|
27
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
links: {
|
|
29
|
+
type: PropType<BreadcrumbLink[]>;
|
|
30
|
+
default: () => never[];
|
|
31
|
+
};
|
|
32
|
+
divider: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: () => any;
|
|
35
|
+
};
|
|
36
|
+
class: {
|
|
37
|
+
type: PropType<any>;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
ui: {
|
|
41
|
+
type: PropType<Partial<any>>;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
}>>, {
|
|
45
|
+
ui: Partial<any>;
|
|
46
|
+
class: any;
|
|
47
|
+
divider: string;
|
|
48
|
+
links: BreadcrumbLink[];
|
|
49
|
+
}, {}>;
|
|
50
|
+
export default _default;
|
|
@@ -181,7 +181,7 @@ export default defineComponent({
|
|
|
181
181
|
const isLoading = ref(false);
|
|
182
182
|
onMounted(() => {
|
|
183
183
|
if (props.autoselect) {
|
|
184
|
-
|
|
184
|
+
activateNextOption();
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
187
|
onMounted(() => {
|
|
@@ -254,12 +254,11 @@ export default defineComponent({
|
|
|
254
254
|
searchResults.value[group.key] = await group.search(query.value);
|
|
255
255
|
}));
|
|
256
256
|
isLoading.value = false;
|
|
257
|
+
activateFirstOption();
|
|
257
258
|
}, props.debounce);
|
|
258
259
|
watch(query, () => {
|
|
259
260
|
debouncedSearch();
|
|
260
|
-
|
|
261
|
-
comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "PageUp" }));
|
|
262
|
-
}, 0);
|
|
261
|
+
activateFirstOption();
|
|
263
262
|
});
|
|
264
263
|
const iconName = computed(() => {
|
|
265
264
|
if ((props.loading || isLoading.value) && props.loadingIcon) {
|
|
@@ -276,6 +275,11 @@ export default defineComponent({
|
|
|
276
275
|
});
|
|
277
276
|
const emptyState = computed(() => ({ ...ui.value.default.emptyState, ...props.emptyState }));
|
|
278
277
|
function activateFirstOption() {
|
|
278
|
+
setTimeout(() => {
|
|
279
|
+
comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "PageUp" }));
|
|
280
|
+
}, 0);
|
|
281
|
+
}
|
|
282
|
+
function activateNextOption() {
|
|
279
283
|
setTimeout(() => {
|
|
280
284
|
comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown" }));
|
|
281
285
|
}, 0);
|
|
@@ -196,9 +196,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
196
196
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
197
197
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
198
198
|
}, {
|
|
199
|
+
ui: Partial<any>;
|
|
199
200
|
icon: string;
|
|
200
201
|
closeButton: Button;
|
|
201
|
-
ui: Partial<any>;
|
|
202
202
|
class: any;
|
|
203
203
|
modelValue: string | number | unknown[] | Record<string, any>;
|
|
204
204
|
by: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { Button } from '../../types';
|
|
2
|
+
import type { Button, ButtonSize } from '../../types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
modelValue: {
|
|
5
5
|
type: NumberConstructor;
|
|
@@ -19,7 +19,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
19
19
|
validate(value: any): boolean;
|
|
20
20
|
};
|
|
21
21
|
size: {
|
|
22
|
-
type: PropType<
|
|
22
|
+
type: PropType<ButtonSize>;
|
|
23
23
|
default: () => any;
|
|
24
24
|
validator(value: string): boolean;
|
|
25
25
|
};
|
|
@@ -101,7 +101,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
101
101
|
validate(value: any): boolean;
|
|
102
102
|
};
|
|
103
103
|
size: {
|
|
104
|
-
type: PropType<
|
|
104
|
+
type: PropType<ButtonSize>;
|
|
105
105
|
default: () => any;
|
|
106
106
|
validator(value: string): boolean;
|
|
107
107
|
};
|
|
@@ -152,9 +152,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
152
152
|
}>> & {
|
|
153
153
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
154
154
|
}, {
|
|
155
|
+
size: ButtonSize;
|
|
155
156
|
ui: Partial<any>;
|
|
156
157
|
class: any;
|
|
157
|
-
size: string | number | symbol;
|
|
158
158
|
max: number;
|
|
159
159
|
divider: string;
|
|
160
160
|
pageCount: number;
|
|
@@ -66,11 +66,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
66
66
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
67
67
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
68
68
|
}, {
|
|
69
|
+
orientation: "horizontal" | "vertical";
|
|
69
70
|
ui: Partial<any>;
|
|
70
71
|
class: any;
|
|
71
72
|
modelValue: number;
|
|
72
73
|
items: TabItem[];
|
|
73
|
-
orientation: "horizontal" | "vertical";
|
|
74
74
|
defaultIndex: number;
|
|
75
75
|
}, {}>;
|
|
76
76
|
export default _default;
|
|
@@ -2,40 +2,38 @@
|
|
|
2
2
|
<Transition appear v-bind="ui.transition">
|
|
3
3
|
<div
|
|
4
4
|
:class="wrapperClass"
|
|
5
|
-
role="status"
|
|
5
|
+
role="status"
|
|
6
6
|
v-bind="attrs"
|
|
7
|
-
@mouseover="onMouseover"
|
|
7
|
+
@mouseover="onMouseover"
|
|
8
8
|
@mouseleave="onMouseleave"
|
|
9
9
|
>
|
|
10
10
|
<div :class="[ui.container, ui.rounded, ui.ring]">
|
|
11
|
-
<div :class="ui.padding">
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
<UAvatar v-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
|
|
11
|
+
<div class="flex" :class="[ui.padding, ui.gap, { 'items-start': description || $slots.description, 'items-center': !description && !$slots.description }]">
|
|
12
|
+
<UIcon v-if="icon" :name="icon" :class="iconClass" />
|
|
13
|
+
<UAvatar v-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
<div class="w-0 flex-1">
|
|
16
|
+
<p :class="ui.title">
|
|
17
|
+
<slot name="title" :title="title">
|
|
18
|
+
{{ title }}
|
|
19
|
+
</slot>
|
|
20
|
+
</p>
|
|
21
|
+
<p v-if="(description || $slots.description)" :class="ui.description">
|
|
22
|
+
<slot name="description" :description="description">
|
|
23
|
+
{{ description }}
|
|
24
|
+
</slot>
|
|
25
|
+
</p>
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</div>
|
|
27
|
+
<div v-if="(description || $slots.description) && actions.length" :class="ui.actions">
|
|
28
|
+
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
|
|
31
29
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
</div>
|
|
31
|
+
<div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(ui.actions, 'mt-0')">
|
|
32
|
+
<template v-if="!description && !$slots.description && actions.length">
|
|
33
|
+
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
|
|
34
|
+
</template>
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
</div>
|
|
36
|
+
<UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="onClose" />
|
|
39
37
|
</div>
|
|
40
38
|
</div>
|
|
41
39
|
<div v-if="timeout" :class="progressClass" :style="progressStyle" />
|
|
@@ -90,7 +88,7 @@ export default defineComponent({
|
|
|
90
88
|
},
|
|
91
89
|
timeout: {
|
|
92
90
|
type: Number,
|
|
93
|
-
default:
|
|
91
|
+
default: () => config.default.timeout
|
|
94
92
|
},
|
|
95
93
|
actions: {
|
|
96
94
|
type: Array,
|
|
@@ -200,7 +198,8 @@ export default defineComponent({
|
|
|
200
198
|
onMouseover,
|
|
201
199
|
onMouseleave,
|
|
202
200
|
onClose,
|
|
203
|
-
onAction
|
|
201
|
+
onAction,
|
|
202
|
+
twMerge
|
|
204
203
|
};
|
|
205
204
|
}
|
|
206
205
|
});
|
|
@@ -27,7 +27,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
27
27
|
};
|
|
28
28
|
timeout: {
|
|
29
29
|
type: NumberConstructor;
|
|
30
|
-
default:
|
|
30
|
+
default: () => any;
|
|
31
31
|
};
|
|
32
32
|
actions: {
|
|
33
33
|
type: PropType<NotificationAction[]>;
|
|
@@ -65,6 +65,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
65
65
|
onMouseleave: () => void;
|
|
66
66
|
onClose: () => void;
|
|
67
67
|
onAction: (action: NotificationAction) => void;
|
|
68
|
+
twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
|
|
68
69
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
69
70
|
id: {
|
|
70
71
|
type: (NumberConstructor | StringConstructor)[];
|
|
@@ -92,7 +93,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
92
93
|
};
|
|
93
94
|
timeout: {
|
|
94
95
|
type: NumberConstructor;
|
|
95
|
-
default:
|
|
96
|
+
default: () => any;
|
|
96
97
|
};
|
|
97
98
|
actions: {
|
|
98
99
|
type: PropType<NotificationAction[]>;
|
|
@@ -118,6 +119,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
118
119
|
}>> & {
|
|
119
120
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
120
121
|
}, {
|
|
122
|
+
ui: Partial<any>;
|
|
121
123
|
description: string;
|
|
122
124
|
icon: string;
|
|
123
125
|
avatar: Avatar;
|
|
@@ -126,7 +128,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
126
128
|
actions: NotificationAction[];
|
|
127
129
|
callback: Function;
|
|
128
130
|
color: any;
|
|
129
|
-
ui: Partial<any>;
|
|
130
131
|
class: any;
|
|
131
132
|
}, {}>;
|
|
132
133
|
export default _default;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<div
|
|
4
|
-
<div v-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<div :class="wrapperClass" role="region" v-bind="attrs">
|
|
4
|
+
<div v-if="notifications.length" :class="ui.container">
|
|
5
|
+
<div v-for="notification of notifications" :key="notification.id">
|
|
6
|
+
<UNotification
|
|
7
|
+
v-bind="notification"
|
|
8
|
+
:class="notification.click && 'cursor-pointer'"
|
|
9
|
+
@click="notification.click && notification.click(notification)"
|
|
10
|
+
@close="toast.remove(notification.id)"
|
|
11
|
+
>
|
|
12
|
+
<template v-for="(_, name) in $slots" #[name]="slotData">
|
|
13
|
+
<slot :name="name" v-bind="slotData" />
|
|
14
|
+
</template>
|
|
15
|
+
</UNotification>
|
|
16
|
+
</div>
|
|
15
17
|
</div>
|
|
16
18
|
</div>
|
|
17
|
-
</
|
|
19
|
+
</Teleport>
|
|
18
20
|
</template>
|
|
19
21
|
|
|
20
22
|
<script>
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
</slot>
|
|
16
16
|
</HPopoverButton>
|
|
17
17
|
|
|
18
|
+
<Transition v-if="overlay" appear v-bind="ui.overlay.transition">
|
|
19
|
+
<div v-if="(open !== undefined) ? open : headlessOpen" :class="[ui.overlay.base, ui.overlay.background]" @click="$emit('update:open')" />
|
|
20
|
+
</Transition>
|
|
21
|
+
|
|
18
22
|
<div v-if="(open !== undefined) ? open : headlessOpen" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
|
|
19
23
|
<Transition appear v-bind="ui.transition">
|
|
20
24
|
<div>
|
|
@@ -67,6 +71,10 @@ export default defineComponent({
|
|
|
67
71
|
type: Number,
|
|
68
72
|
default: 0
|
|
69
73
|
},
|
|
74
|
+
overlay: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
70
78
|
popper: {
|
|
71
79
|
type: Object,
|
|
72
80
|
default: () => ({})
|
|
@@ -80,6 +88,7 @@ export default defineComponent({
|
|
|
80
88
|
default: void 0
|
|
81
89
|
}
|
|
82
90
|
},
|
|
91
|
+
emits: ["update:open"],
|
|
83
92
|
setup(props) {
|
|
84
93
|
const { ui, attrs } = useUI("popover", toRef(props, "ui"), config, toRef(props, "class"));
|
|
85
94
|
const popper = computed(() => defu(props.mode === "hover" ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper));
|
|
@@ -22,6 +22,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
22
|
type: NumberConstructor;
|
|
23
23
|
default: number;
|
|
24
24
|
};
|
|
25
|
+
overlay: {
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
default: boolean;
|
|
28
|
+
};
|
|
25
29
|
popper: {
|
|
26
30
|
type: PropType<PopperOptions>;
|
|
27
31
|
default: () => {};
|
|
@@ -56,7 +60,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
56
60
|
}>;
|
|
57
61
|
onMouseOver: () => void;
|
|
58
62
|
onMouseLeave: () => void;
|
|
59
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
63
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:open"[], "update:open", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
60
64
|
mode: {
|
|
61
65
|
type: PropType<"click" | "hover">;
|
|
62
66
|
default: string;
|
|
@@ -78,6 +82,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
78
82
|
type: NumberConstructor;
|
|
79
83
|
default: number;
|
|
80
84
|
};
|
|
85
|
+
overlay: {
|
|
86
|
+
type: BooleanConstructor;
|
|
87
|
+
default: boolean;
|
|
88
|
+
};
|
|
81
89
|
popper: {
|
|
82
90
|
type: PropType<PopperOptions>;
|
|
83
91
|
default: () => {};
|
|
@@ -90,7 +98,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
90
98
|
type: PropType<Partial<any>>;
|
|
91
99
|
default: undefined;
|
|
92
100
|
};
|
|
93
|
-
}
|
|
101
|
+
}>> & {
|
|
102
|
+
"onUpdate:open"?: ((...args: any[]) => any) | undefined;
|
|
103
|
+
}, {
|
|
94
104
|
ui: Partial<any>;
|
|
95
105
|
popper: PopperOptions;
|
|
96
106
|
class: any;
|
|
@@ -99,5 +109,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
99
109
|
mode: "click" | "hover";
|
|
100
110
|
openDelay: number;
|
|
101
111
|
closeDelay: number;
|
|
112
|
+
overlay: boolean;
|
|
102
113
|
}, {}>;
|
|
103
114
|
export default _default;
|
|
@@ -2,7 +2,7 @@ import type { WatchSource } from 'vue';
|
|
|
2
2
|
export interface ShortcutConfig {
|
|
3
3
|
handler: Function;
|
|
4
4
|
usingInput?: string | boolean;
|
|
5
|
-
whenever?: WatchSource<
|
|
5
|
+
whenever?: WatchSource<boolean>[];
|
|
6
6
|
}
|
|
7
7
|
export interface ShortcutsConfig {
|
|
8
8
|
[key: string]: ShortcutConfig | Function;
|
|
@@ -2,6 +2,8 @@ import { ref, computed } from "vue";
|
|
|
2
2
|
import { logicAnd, logicNot } from "@vueuse/math";
|
|
3
3
|
import { useEventListener, useDebounceFn } from "@vueuse/core";
|
|
4
4
|
import { useShortcuts } from "./useShortcuts.mjs";
|
|
5
|
+
const chainedShortcutRegex = /^[^-]+.*-.*[^-]+$/;
|
|
6
|
+
const combinedShortcutRegex = /^[^_]+.*_.*[^_]+$/;
|
|
5
7
|
export const defineShortcuts = (config, options = {}) => {
|
|
6
8
|
const { macOS, usingInput } = useShortcuts();
|
|
7
9
|
let shortcuts = [];
|
|
@@ -58,11 +60,13 @@ export const defineShortcuts = (config, options = {}) => {
|
|
|
58
60
|
return null;
|
|
59
61
|
}
|
|
60
62
|
let shortcut;
|
|
61
|
-
if (key.includes("-") && key.
|
|
62
|
-
console.trace(
|
|
63
|
-
|
|
63
|
+
if (key.includes("-") && key !== "-" && !key.match(chainedShortcutRegex)?.length) {
|
|
64
|
+
console.trace(`[Shortcut] Invalid key: "${key}"`);
|
|
65
|
+
}
|
|
66
|
+
if (key.includes("_") && key !== "_" && !key.match(combinedShortcutRegex)?.length) {
|
|
67
|
+
console.trace(`[Shortcut] Invalid key: "${key}"`);
|
|
64
68
|
}
|
|
65
|
-
const chained = key.includes("-");
|
|
69
|
+
const chained = key.includes("-") && key !== "-";
|
|
66
70
|
if (chained) {
|
|
67
71
|
shortcut = {
|
|
68
72
|
key: key.toLowerCase(),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import { buttonGroup } from '#ui/ui.config';
|
|
3
|
+
type ButtonGroupProps = {
|
|
4
|
+
orientation?: Ref<'horizontal' | 'vertical'>;
|
|
5
|
+
size?: Ref<string>;
|
|
6
|
+
ui?: Ref<Partial<typeof buttonGroup>>;
|
|
7
|
+
rounded?: Ref<{
|
|
8
|
+
start: string;
|
|
9
|
+
end: string;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
export declare function useProvideButtonGroup(buttonGroupProps: ButtonGroupProps): void;
|
|
13
|
+
export declare function useInjectButtonGroup({ ui, props }: {
|
|
14
|
+
ui: any;
|
|
15
|
+
props: any;
|
|
16
|
+
}): {
|
|
17
|
+
size: import("vue").ComputedRef<any>;
|
|
18
|
+
rounded: import("vue").ComputedRef<any>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { computed, ref, provide, inject, onMounted, onUnmounted, getCurrentInstance } from "vue";
|
|
2
|
+
export function useProvideButtonGroup(buttonGroupProps) {
|
|
3
|
+
const instance = getCurrentInstance();
|
|
4
|
+
const groupKey = `group-${instance.uid}`;
|
|
5
|
+
const state = ref({
|
|
6
|
+
children: [],
|
|
7
|
+
register(child) {
|
|
8
|
+
this.children.push(child);
|
|
9
|
+
},
|
|
10
|
+
unregister(child) {
|
|
11
|
+
const index = this.children.indexOf(child);
|
|
12
|
+
if (index > -1) {
|
|
13
|
+
this.children.splice(index, 1);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
...buttonGroupProps
|
|
17
|
+
});
|
|
18
|
+
provide(groupKey, state);
|
|
19
|
+
}
|
|
20
|
+
export function useInjectButtonGroup({ ui, props }) {
|
|
21
|
+
const instance = getCurrentInstance();
|
|
22
|
+
let parent = instance.parent;
|
|
23
|
+
let groupContext;
|
|
24
|
+
while (parent && !groupContext) {
|
|
25
|
+
if (parent.type.name === "ButtonGroup") {
|
|
26
|
+
groupContext = inject(`group-${parent.uid}`);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
parent = parent.parent;
|
|
30
|
+
}
|
|
31
|
+
const positionInGroup = computed(() => groupContext?.value.children.indexOf(instance));
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
groupContext?.value.register(instance);
|
|
34
|
+
});
|
|
35
|
+
onUnmounted(() => {
|
|
36
|
+
groupContext?.value.unregister(instance);
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
size: computed(() => groupContext?.value.size || props.size),
|
|
40
|
+
rounded: computed(() => {
|
|
41
|
+
if (!groupContext || positionInGroup.value === -1)
|
|
42
|
+
return ui.value.rounded;
|
|
43
|
+
if (groupContext.value.children.length === 1)
|
|
44
|
+
return groupContext.value.ui.rounded;
|
|
45
|
+
if (positionInGroup.value === 0)
|
|
46
|
+
return groupContext.value.rounded.start;
|
|
47
|
+
if (positionInGroup.value === groupContext.value.children.length - 1)
|
|
48
|
+
return groupContext.value.rounded.end;
|
|
49
|
+
return "rounded-none";
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
type InputProps = {
|
|
2
|
-
id?: string;
|
|
2
|
+
id?: string | null;
|
|
3
3
|
size?: string | number | symbol;
|
|
4
4
|
color?: string;
|
|
5
5
|
name?: string;
|
|
6
|
+
isFieldset?: boolean;
|
|
7
|
+
eagerValidation?: boolean;
|
|
6
8
|
};
|
|
7
9
|
export declare const useFormGroup: (inputProps?: InputProps, config?: any) => {
|
|
8
|
-
inputId: import("vue").Ref<string | undefined>;
|
|
10
|
+
inputId: import("vue").Ref<string | null | undefined>;
|
|
9
11
|
name: import("vue").ComputedRef<string | undefined>;
|
|
10
12
|
size: import("vue").ComputedRef<any>;
|
|
11
13
|
color: import("vue").ComputedRef<string | undefined>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { inject, ref, computed, onMounted } from "vue";
|
|
2
2
|
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
+
import { uid } from "../utils/uid.mjs";
|
|
3
4
|
export const useFormGroup = (inputProps, config) => {
|
|
4
5
|
const formBus = inject("form-events", void 0);
|
|
5
6
|
const formGroup = inject("form-group", void 0);
|
|
6
7
|
const formInputs = inject("form-inputs", void 0);
|
|
7
8
|
const inputId = ref(inputProps?.id);
|
|
8
9
|
onMounted(() => {
|
|
9
|
-
inputId.value = inputProps?.id ??
|
|
10
|
+
inputId.value = inputProps?.isFieldset ? null : inputProps?.id ?? uid();
|
|
10
11
|
if (formGroup) {
|
|
11
12
|
formGroup.inputId.value = inputId.value;
|
|
12
13
|
if (formInputs) {
|
|
@@ -28,7 +29,7 @@ export const useFormGroup = (inputProps, config) => {
|
|
|
28
29
|
emitFormEvent("change", formGroup?.name.value);
|
|
29
30
|
}
|
|
30
31
|
const emitFormInput = useDebounceFn(() => {
|
|
31
|
-
if (blurred.value) {
|
|
32
|
+
if (blurred.value || formGroup?.eagerValidation.value) {
|
|
32
33
|
emitFormEvent("input", formGroup?.name.value);
|
|
33
34
|
}
|
|
34
35
|
}, 300);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare const _useShortcuts: () => {
|
|
2
|
-
macOS: import("vue").ComputedRef<
|
|
2
|
+
macOS: import("vue").ComputedRef<false | "" | RegExpMatchArray | null | undefined>;
|
|
3
3
|
metaSymbol: import("vue").Ref<string>;
|
|
4
4
|
activeElement: import("@vueuse/shared").ComputedRefWithControl<HTMLElement | null | undefined>;
|
|
5
5
|
usingInput: import("vue").ComputedRef<string | boolean>;
|
|
6
6
|
};
|
|
7
7
|
export declare const useShortcuts: () => {
|
|
8
|
-
macOS: import("vue").ComputedRef<
|
|
8
|
+
macOS: import("vue").ComputedRef<false | "" | RegExpMatchArray | null | undefined>;
|
|
9
9
|
metaSymbol: import("vue").Ref<string>;
|
|
10
10
|
activeElement: import("@vueuse/shared").ComputedRefWithControl<HTMLElement | null | undefined>;
|
|
11
11
|
usingInput: import("vue").ComputedRef<string | boolean>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { alert } from '../ui.config'
|
|
2
|
+
import type { NestedKeyOf, ExtractDeepKey, ExtractDeepObject } from '.'
|
|
3
|
+
import colors from '#ui-colors'
|
|
4
|
+
import type { AppConfig } from 'nuxt/schema'
|
|
5
|
+
|
|
6
|
+
export type AlertColor = keyof typeof alert.color | ExtractDeepKey<AppConfig, ['ui', 'alert', 'color']> | typeof colors[number]
|
|
7
|
+
export type AlertVariant = keyof typeof alert.variant | ExtractDeepKey<AppConfig, ['ui', 'alert', 'variant']> | NestedKeyOf<typeof alert.color> | NestedKeyOf<ExtractDeepObject<AppConfig, ['ui', 'alert', 'color']>>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { avatar } from '../ui.config'
|
|
2
|
+
import type { ExtractDeepKey } from '.'
|
|
2
3
|
import colors from '#ui-colors'
|
|
4
|
+
import type { AppConfig } from 'nuxt/schema'
|
|
3
5
|
|
|
4
|
-
export type AvatarSize = keyof typeof avatar.size
|
|
6
|
+
export type AvatarSize = keyof typeof avatar.size | ExtractDeepKey<AppConfig, ['ui', 'avatar', 'size']>
|
|
5
7
|
export type AvatarChipColor = 'gray' | typeof colors[number]
|
|
6
8
|
export type AvatarChipPosition = keyof typeof avatar.chip.position
|
|
7
9
|
|