@nuxt/ui 2.14.2 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +2 -0
- package/dist/module.d.ts +2 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -1
- package/dist/runtime/components/data/Table.vue +2 -2
- package/dist/runtime/components/data/Table.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Accordion.vue +13 -2
- package/dist/runtime/components/elements/Accordion.vue.d.ts +4 -2
- package/dist/runtime/components/elements/Alert.vue +6 -2
- package/dist/runtime/components/elements/Avatar.vue +7 -2
- package/dist/runtime/components/elements/Avatar.vue.d.ts +9 -0
- package/dist/runtime/components/elements/Carousel.vue +4 -1
- package/dist/runtime/components/elements/Dropdown.vue +2 -2
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +1 -1
- package/dist/runtime/components/forms/Checkbox.vue +2 -2
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +1 -1
- package/dist/runtime/components/forms/Form.vue.d.ts +9 -3
- package/dist/runtime/components/forms/Input.vue +13 -7
- package/dist/runtime/components/forms/Input.vue.d.ts +3 -2
- package/dist/runtime/components/forms/InputMenu.vue +6 -6
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +3 -3
- package/dist/runtime/components/forms/Radio.vue +8 -3
- package/dist/runtime/components/forms/Radio.vue.d.ts +2 -1
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +1 -1
- package/dist/runtime/components/forms/Range.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 +11 -11
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +5 -5
- package/dist/runtime/components/forms/Textarea.vue +2 -1
- package/dist/runtime/components/forms/Textarea.vue.d.ts +3 -2
- package/dist/runtime/components/forms/Toggle.vue +31 -4
- package/dist/runtime/components/forms/Toggle.vue.d.ts +19 -0
- package/dist/runtime/components/overlays/Popover.vue +2 -2
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Slideovers.client.vue +17 -0
- package/dist/runtime/composables/useButtonGroup.mjs +8 -0
- package/dist/runtime/composables/useModal.d.ts +1 -1
- package/dist/runtime/composables/useShortcuts.mjs +1 -1
- package/dist/runtime/composables/useSlideover.d.ts +12 -0
- package/dist/runtime/composables/useSlideover.mjs +40 -0
- package/dist/runtime/composables/useUI.d.ts +2 -2
- package/dist/runtime/plugins/colors.mjs +1 -1
- package/dist/runtime/plugins/slideovers.d.ts +2 -0
- package/dist/runtime/plugins/slideovers.mjs +10 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/slideover.d.ts +17 -0
- package/dist/runtime/ui.config/forms/inputMenu.mjs +1 -1
- package/dist/runtime/ui.config/forms/toggle.d.ts +2 -0
- package/dist/runtime/ui.config/forms/toggle.mjs +3 -1
- package/dist/runtime/ui.config/layout/divider.mjs +2 -2
- package/package.json +19 -19
package/dist/module.d.mts
CHANGED
|
@@ -1367,10 +1367,12 @@ declare const _default$j: {
|
|
|
1367
1367
|
};
|
|
1368
1368
|
on: string;
|
|
1369
1369
|
off: string;
|
|
1370
|
+
loading: string;
|
|
1370
1371
|
};
|
|
1371
1372
|
default: {
|
|
1372
1373
|
onIcon: any;
|
|
1373
1374
|
offIcon: any;
|
|
1375
|
+
loadingIcon: string;
|
|
1374
1376
|
color: string;
|
|
1375
1377
|
size: string;
|
|
1376
1378
|
};
|
package/dist/module.d.ts
CHANGED
|
@@ -1367,10 +1367,12 @@ declare const _default$j: {
|
|
|
1367
1367
|
};
|
|
1368
1368
|
on: string;
|
|
1369
1369
|
off: string;
|
|
1370
|
+
loading: string;
|
|
1370
1371
|
};
|
|
1371
1372
|
default: {
|
|
1372
1373
|
onIcon: any;
|
|
1373
1374
|
offIcon: any;
|
|
1375
|
+
loadingIcon: string;
|
|
1374
1376
|
color: string;
|
|
1375
1377
|
size: string;
|
|
1376
1378
|
};
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -14,7 +14,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
|
14
14
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
15
15
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
16
16
|
const name = "@nuxt/ui";
|
|
17
|
-
const version = "2.
|
|
17
|
+
const version = "2.15.1";
|
|
18
18
|
|
|
19
19
|
function createTemplates(nuxt = useNuxt()) {
|
|
20
20
|
const template = addTemplate({
|
|
@@ -424,6 +424,9 @@ const module = defineNuxtModule({
|
|
|
424
424
|
addPlugin({
|
|
425
425
|
src: resolve(runtimeDir, "plugins", "modals")
|
|
426
426
|
});
|
|
427
|
+
addPlugin({
|
|
428
|
+
src: resolve(runtimeDir, "plugins", "slideovers")
|
|
429
|
+
});
|
|
427
430
|
addComponentsDir({
|
|
428
431
|
path: resolve(runtimeDir, "components", "elements"),
|
|
429
432
|
prefix: options.prefix,
|
|
@@ -249,8 +249,8 @@ export default defineComponent({
|
|
|
249
249
|
selected.value.push(row);
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
|
-
function onChange(
|
|
253
|
-
if (
|
|
252
|
+
function onChange(checked) {
|
|
253
|
+
if (checked) {
|
|
254
254
|
selectAllRows();
|
|
255
255
|
} else {
|
|
256
256
|
selected.value = [];
|
|
@@ -117,7 +117,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
117
117
|
direction?: 'asc' | 'desc';
|
|
118
118
|
}) => void;
|
|
119
119
|
onSelect: (row: any) => void;
|
|
120
|
-
onChange: (
|
|
120
|
+
onChange: (checked: boolean) => void;
|
|
121
121
|
getRowData: (row: Object, rowKey: string | string[], defaultValue?: any) => any;
|
|
122
122
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:sort")[], "update:modelValue" | "update:sort", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
123
123
|
modelValue: {
|
|
@@ -219,6 +219,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
219
219
|
};
|
|
220
220
|
ui: any;
|
|
221
221
|
class: any;
|
|
222
|
+
modelValue: unknown[];
|
|
222
223
|
columns: {
|
|
223
224
|
[key: string]: any;
|
|
224
225
|
key: string;
|
|
@@ -227,7 +228,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
227
228
|
direction?: "asc" | "desc" | undefined;
|
|
228
229
|
class?: string | undefined;
|
|
229
230
|
}[];
|
|
230
|
-
modelValue: unknown[];
|
|
231
231
|
by: string | Function;
|
|
232
232
|
rows: {
|
|
233
233
|
[key: string]: any;
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
54
|
<script>
|
|
55
|
-
import { ref, computed, toRef, defineComponent } from "vue";
|
|
55
|
+
import { ref, computed, toRef, defineComponent, watch } from "vue";
|
|
56
56
|
import { Disclosure as HDisclosure, DisclosureButton as HDisclosureButton, DisclosurePanel as HDisclosurePanel, provideUseId } from "@headlessui/vue";
|
|
57
57
|
import UIcon from "../elements/Icon.vue";
|
|
58
58
|
import UButton from "../elements/Button.vue";
|
|
@@ -102,10 +102,21 @@ export default defineComponent({
|
|
|
102
102
|
default: () => ({})
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
|
-
|
|
105
|
+
emits: ["open"],
|
|
106
|
+
setup(props, { emit }) {
|
|
106
107
|
const { ui, attrs } = useUI("accordion", toRef(props, "ui"), config, toRef(props, "class"));
|
|
107
108
|
const uiButton = computed(() => configButton);
|
|
108
109
|
const buttonRefs = ref([]);
|
|
110
|
+
const openedStates = computed(() => buttonRefs.value.map(({ open }) => open));
|
|
111
|
+
watch(openedStates, (newValue, oldValue) => {
|
|
112
|
+
for (const index in newValue) {
|
|
113
|
+
const isOpenBefore = oldValue[index];
|
|
114
|
+
const isOpenAfter = newValue[index];
|
|
115
|
+
if (!isOpenBefore && isOpenAfter) {
|
|
116
|
+
emit("open", index);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}, { immediate: true });
|
|
109
120
|
function closeOthers(currentIndex, e) {
|
|
110
121
|
if (!props.items[currentIndex].closeOthers && props.multiple) {
|
|
111
122
|
return;
|
|
@@ -46,7 +46,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
46
46
|
onBeforeLeave: (_el: Element) => void;
|
|
47
47
|
onAfterEnter: (_el: Element) => void;
|
|
48
48
|
onLeave: (_el: Element, done: () => void) => void;
|
|
49
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
49
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "open"[], "open", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
50
50
|
items: {
|
|
51
51
|
type: PropType<AccordionItem[]>;
|
|
52
52
|
default: () => never[];
|
|
@@ -75,7 +75,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
75
75
|
type: PropType<any>;
|
|
76
76
|
default: () => {};
|
|
77
77
|
};
|
|
78
|
-
}
|
|
78
|
+
}>> & {
|
|
79
|
+
onOpen?: ((...args: any[]) => any) | undefined;
|
|
80
|
+
}, {
|
|
79
81
|
ui: any;
|
|
80
82
|
class: any;
|
|
81
83
|
defaultOpen: boolean;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="alertClass" v-bind="attrs">
|
|
3
3
|
<div class="flex" :class="[ui.gap, { 'items-start': (description || $slots.description), 'items-center': !description && !$slots.description }]">
|
|
4
|
-
<
|
|
5
|
-
|
|
4
|
+
<slot name="icon" :icon="icon">
|
|
5
|
+
<UIcon v-if="icon" :name="icon" :ui="ui.icon.base" />
|
|
6
|
+
</slot>
|
|
7
|
+
<slot name="avatar" :avatar="avatar">
|
|
8
|
+
<UAvatar v-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
|
|
9
|
+
</slot>
|
|
6
10
|
|
|
7
11
|
<div :class="ui.inner">
|
|
8
12
|
<p v-if="(title || $slots.title)" :class="ui.title">
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span :class="wrapperClass">
|
|
3
|
-
<
|
|
3
|
+
<component
|
|
4
|
+
:is="as"
|
|
4
5
|
v-if="url && !error"
|
|
5
6
|
:class="imgClass"
|
|
6
7
|
:alt="alt"
|
|
7
8
|
:src="url"
|
|
8
9
|
v-bind="attrs"
|
|
9
10
|
@error="onError"
|
|
10
|
-
|
|
11
|
+
/>
|
|
11
12
|
<span v-else-if="text" :class="ui.text">{{ text }}</span>
|
|
12
13
|
<UIcon v-else-if="icon" :name="icon" :class="iconClass" />
|
|
13
14
|
<span v-else-if="placeholder" :class="ui.placeholder">{{ placeholder }}</span>
|
|
@@ -34,6 +35,10 @@ export default defineComponent({
|
|
|
34
35
|
},
|
|
35
36
|
inheritAttrs: false,
|
|
36
37
|
props: {
|
|
38
|
+
as: {
|
|
39
|
+
type: [String, Object],
|
|
40
|
+
default: "img"
|
|
41
|
+
},
|
|
37
42
|
src: {
|
|
38
43
|
type: [String, Boolean],
|
|
39
44
|
default: null
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
2
|
import type { AvatarSize } from '../../types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
as: {
|
|
5
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
4
8
|
src: {
|
|
5
9
|
type: (BooleanConstructor | StringConstructor)[];
|
|
6
10
|
default: null;
|
|
@@ -62,6 +66,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
62
66
|
error: import("vue").Ref<boolean>;
|
|
63
67
|
onError: () => void;
|
|
64
68
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
69
|
+
as: {
|
|
70
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
65
73
|
src: {
|
|
66
74
|
type: (BooleanConstructor | StringConstructor)[];
|
|
67
75
|
default: null;
|
|
@@ -115,6 +123,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
115
123
|
ui: any;
|
|
116
124
|
icon: string;
|
|
117
125
|
class: any;
|
|
126
|
+
as: string | Record<string, any>;
|
|
118
127
|
src: string | boolean;
|
|
119
128
|
text: string;
|
|
120
129
|
chipColor: any;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
v-for="(item, index) in items"
|
|
6
6
|
:key="index"
|
|
7
7
|
:class="ui.item"
|
|
8
|
+
:role="indicators ? 'tabpanel' : null"
|
|
8
9
|
>
|
|
9
10
|
<slot :item="item" :index="index" />
|
|
10
11
|
</div>
|
|
@@ -34,11 +35,13 @@
|
|
|
34
35
|
</slot>
|
|
35
36
|
</div>
|
|
36
37
|
|
|
37
|
-
<div v-if="indicators" :class="ui.indicators.wrapper">
|
|
38
|
+
<div v-if="indicators" role="tablist" :class="ui.indicators.wrapper">
|
|
38
39
|
<template v-for="page in pages" :key="page">
|
|
39
40
|
<slot name="indicator" :on-click="onClick" :active="page === currentPage" :page="page">
|
|
40
41
|
<button
|
|
41
42
|
type="button"
|
|
43
|
+
role="tab"
|
|
44
|
+
:aria-selected="page === currentPage"
|
|
42
45
|
:class="[
|
|
43
46
|
ui.indicators.base,
|
|
44
47
|
page === currentPage ? ui.indicators.active : ui.indicators.inactive
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
:class="ui.trigger"
|
|
9
9
|
role="button"
|
|
10
10
|
@mouseenter="onMouseEnter"
|
|
11
|
-
@touchstart.
|
|
11
|
+
@touchstart.passive="onTouchStart"
|
|
12
12
|
>
|
|
13
13
|
<slot :open="open" :disabled="disabled">
|
|
14
14
|
<button :disabled="disabled">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</slot>
|
|
18
18
|
</HMenuButton>
|
|
19
19
|
|
|
20
|
-
<div v-if="open && items.length" ref="container" :class="[ui.container, ui.width]" :style="containerStyle">
|
|
20
|
+
<div v-if="open && items.length" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseenter="onMouseEnter">
|
|
21
21
|
<Transition appear v-bind="ui.transition">
|
|
22
22
|
<div>
|
|
23
23
|
<div v-if="popper.arrow" data-popper-arrow :class="Object.values(ui.arrow)" />
|
|
@@ -126,8 +126,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
126
126
|
class: any;
|
|
127
127
|
popper: PopperOptions;
|
|
128
128
|
disabled: boolean;
|
|
129
|
-
items: DropdownItem[][];
|
|
130
129
|
open: boolean;
|
|
130
|
+
items: DropdownItem[][];
|
|
131
131
|
mode: "click" | "hover";
|
|
132
132
|
openDelay: number;
|
|
133
133
|
closeDelay: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="ui.wrapper">
|
|
2
|
+
<div :class="ui.wrapper" :data-n-ids="attrs['data-n-ids']">
|
|
3
3
|
<div :class="ui.container">
|
|
4
4
|
<input
|
|
5
5
|
:id="inputId"
|
|
@@ -110,7 +110,7 @@ export default defineComponent({
|
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
const onChange = (event) => {
|
|
113
|
-
emit("change", event);
|
|
113
|
+
emit("change", event.target.checked);
|
|
114
114
|
emitFormChange();
|
|
115
115
|
};
|
|
116
116
|
const inputClass = computed(() => {
|
|
@@ -127,8 +127,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
127
127
|
color: any;
|
|
128
128
|
class: any;
|
|
129
129
|
name: string;
|
|
130
|
-
label: string;
|
|
131
130
|
modelValue: boolean | unknown[];
|
|
131
|
+
label: string;
|
|
132
132
|
indeterminate: boolean;
|
|
133
133
|
disabled: boolean;
|
|
134
134
|
required: boolean;
|
|
@@ -6,7 +6,9 @@ import type { ObjectSchemaAsync as ValibotObjectSchema } from 'valibot';
|
|
|
6
6
|
import type { FormError, FormEventType } from '../../types/form';
|
|
7
7
|
declare const _default: import("vue").DefineComponent<{
|
|
8
8
|
schema: {
|
|
9
|
-
type: PropType<ZodSchema<any, import("zod").ZodTypeDef, any>> | PropType<YupObjectSchema<any, import("yup").AnyObject, any, "">> | PropType<JoiSchema> | PropType<ValibotObjectSchema<any
|
|
9
|
+
type: PropType<ZodSchema<any, import("zod").ZodTypeDef, any>> | PropType<YupObjectSchema<any, import("yup").AnyObject, any, "">> | PropType<JoiSchema> | PropType<ValibotObjectSchema<any, undefined, {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}>>;
|
|
10
12
|
default: undefined;
|
|
11
13
|
};
|
|
12
14
|
state: {
|
|
@@ -25,7 +27,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
25
27
|
onSubmit: (payload: Event) => Promise<void>;
|
|
26
28
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("error" | "submit")[], "error" | "submit", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
29
|
schema: {
|
|
28
|
-
type: PropType<ZodSchema<any, import("zod").ZodTypeDef, any>> | PropType<YupObjectSchema<any, import("yup").AnyObject, any, "">> | PropType<JoiSchema> | PropType<ValibotObjectSchema<any
|
|
30
|
+
type: PropType<ZodSchema<any, import("zod").ZodTypeDef, any>> | PropType<YupObjectSchema<any, import("yup").AnyObject, any, "">> | PropType<JoiSchema> | PropType<ValibotObjectSchema<any, undefined, {
|
|
31
|
+
[x: string]: any;
|
|
32
|
+
}>>;
|
|
29
33
|
default: undefined;
|
|
30
34
|
};
|
|
31
35
|
state: {
|
|
@@ -44,7 +48,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
44
48
|
onError?: ((...args: any[]) => any) | undefined;
|
|
45
49
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
46
50
|
}, {
|
|
47
|
-
schema: ZodSchema<any, import("zod").ZodTypeDef, any> | YupObjectSchema<any, import("yup").AnyObject, any, ""> | import("joi").AnySchema<any> | ValibotObjectSchema<any
|
|
51
|
+
schema: ZodSchema<any, import("zod").ZodTypeDef, any> | YupObjectSchema<any, import("yup").AnyObject, any, ""> | import("joi").AnySchema<any> | ValibotObjectSchema<any, undefined, {
|
|
52
|
+
[x: string]: any;
|
|
53
|
+
}>;
|
|
48
54
|
validate: ((state: any) => Promise<FormError[]>) | ((state: any) => FormError[]);
|
|
49
55
|
validateOn: FormEventType[];
|
|
50
56
|
}, {}>;
|
|
@@ -158,7 +158,7 @@ export default defineComponent({
|
|
|
158
158
|
default: () => ({})
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
|
-
emits: ["update:modelValue", "blur"],
|
|
161
|
+
emits: ["update:modelValue", "blur", "change"],
|
|
162
162
|
setup(props, { emit, slots }) {
|
|
163
163
|
const { ui, attrs } = useUI("input", toRef(props, "ui"), config, toRef(props, "class"));
|
|
164
164
|
const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
|
|
@@ -187,12 +187,18 @@ export default defineComponent({
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
const onChange = (event) => {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
if (props.type === "file") {
|
|
191
|
+
const value = event.target.files;
|
|
192
|
+
emit("change", value);
|
|
193
|
+
} else {
|
|
194
|
+
const value = event.target.value;
|
|
195
|
+
emit("change", value);
|
|
196
|
+
if (modelModifiers.value.lazy) {
|
|
197
|
+
updateInput(value);
|
|
198
|
+
}
|
|
199
|
+
if (modelModifiers.value.trim) {
|
|
200
|
+
event.target.value = value.trim();
|
|
201
|
+
}
|
|
196
202
|
}
|
|
197
203
|
};
|
|
198
204
|
const onBlur = (event) => {
|
|
@@ -124,7 +124,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
124
124
|
onInput: (event: Event) => void;
|
|
125
125
|
onChange: (event: Event) => void;
|
|
126
126
|
onBlur: (event: FocusEvent) => void;
|
|
127
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "update:modelValue")[], "blur" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
127
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "change" | "update:modelValue")[], "blur" | "change" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
128
128
|
modelValue: {
|
|
129
129
|
type: (NumberConstructor | StringConstructor)[];
|
|
130
130
|
default: string;
|
|
@@ -230,6 +230,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
230
230
|
};
|
|
231
231
|
}>> & {
|
|
232
232
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
233
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
233
234
|
onBlur?: ((...args: any[]) => any) | undefined;
|
|
234
235
|
}, {
|
|
235
236
|
size: InputSize;
|
|
@@ -240,9 +241,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
240
241
|
type: string;
|
|
241
242
|
class: any;
|
|
242
243
|
name: string;
|
|
244
|
+
modelValue: string | number;
|
|
243
245
|
leading: boolean;
|
|
244
246
|
variant: InputVariant;
|
|
245
|
-
modelValue: string | number;
|
|
246
247
|
loading: boolean;
|
|
247
248
|
disabled: boolean;
|
|
248
249
|
placeholder: string;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
autocomplete="off"
|
|
22
22
|
v-bind="attrs"
|
|
23
23
|
:display-value="() => query ? query : label"
|
|
24
|
-
@change="
|
|
24
|
+
@change="onQueryChange"
|
|
25
25
|
/>
|
|
26
26
|
|
|
27
27
|
<span v-if="(isLeading && leadingIconName) || $slots.leading" :class="leadingWrapperIconClass">
|
|
@@ -385,13 +385,13 @@ export default defineComponent({
|
|
|
385
385
|
emitFormBlur();
|
|
386
386
|
}
|
|
387
387
|
});
|
|
388
|
-
function onUpdate(
|
|
388
|
+
function onUpdate(value) {
|
|
389
389
|
query.value = "";
|
|
390
|
-
emit("update:modelValue",
|
|
391
|
-
emit("change",
|
|
390
|
+
emit("update:modelValue", value);
|
|
391
|
+
emit("change", value);
|
|
392
392
|
emitFormChange();
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function onQueryChange(event) {
|
|
395
395
|
query.value = event.target.value;
|
|
396
396
|
}
|
|
397
397
|
provideUseId(() => useId());
|
|
@@ -423,7 +423,7 @@ export default defineComponent({
|
|
|
423
423
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
424
424
|
query,
|
|
425
425
|
onUpdate,
|
|
426
|
-
|
|
426
|
+
onQueryChange
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
429
|
});
|
|
@@ -158,8 +158,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
158
158
|
trailingWrapperIconClass: import("vue").ComputedRef<string>;
|
|
159
159
|
filteredOptions: import("vue").Ref<any[]>;
|
|
160
160
|
query: import("vue").WritableComputedRef<string>;
|
|
161
|
-
onUpdate: (
|
|
162
|
-
|
|
161
|
+
onUpdate: (value: any) => void;
|
|
162
|
+
onQueryChange: (event: any) => void;
|
|
163
163
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open" | "update:query")[], "change" | "close" | "update:modelValue" | "open" | "update:query", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
164
164
|
modelValue: {
|
|
165
165
|
type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
@@ -314,10 +314,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
314
314
|
}[];
|
|
315
315
|
popper: PopperOptions;
|
|
316
316
|
name: string;
|
|
317
|
+
modelValue: string | number | unknown[] | Record<string, any>;
|
|
317
318
|
leading: boolean;
|
|
318
319
|
search: (query: string) => Promise<any[]> | any[];
|
|
319
320
|
variant: InputVariant;
|
|
320
|
-
modelValue: string | number | unknown[] | Record<string, any>;
|
|
321
321
|
by: string;
|
|
322
322
|
loading: boolean;
|
|
323
323
|
disabled: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="ui.wrapper">
|
|
2
|
+
<div :class="ui.wrapper" :data-n-ids="attrs['data-n-ids']">
|
|
3
3
|
<div :class="ui.container">
|
|
4
4
|
<input
|
|
5
5
|
:id="inputId"
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
type="radio"
|
|
12
12
|
:class="inputClass"
|
|
13
13
|
v-bind="attrs"
|
|
14
|
+
@change="onChange"
|
|
14
15
|
>
|
|
15
16
|
</div>
|
|
16
17
|
<div v-if="label || $slots.label" :class="ui.inner">
|
|
@@ -36,6 +37,7 @@ import { radio } from "#ui/ui.config";
|
|
|
36
37
|
import { useId } from "#imports";
|
|
37
38
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.radio, radio);
|
|
38
39
|
export default defineComponent({
|
|
40
|
+
inheritAttrs: false,
|
|
39
41
|
props: {
|
|
40
42
|
id: {
|
|
41
43
|
type: String,
|
|
@@ -101,12 +103,14 @@ export default defineComponent({
|
|
|
101
103
|
},
|
|
102
104
|
set(value) {
|
|
103
105
|
emit("update:modelValue", value);
|
|
104
|
-
emit("change", value);
|
|
105
106
|
if (!radioGroup) {
|
|
106
107
|
emitFormChange();
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
});
|
|
111
|
+
function onChange(event) {
|
|
112
|
+
emit("change", event.target.value);
|
|
113
|
+
}
|
|
110
114
|
const inputClass = computed(() => {
|
|
111
115
|
return twMerge(twJoin(
|
|
112
116
|
ui.value.base,
|
|
@@ -126,7 +130,8 @@ export default defineComponent({
|
|
|
126
130
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
127
131
|
name,
|
|
128
132
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
129
|
-
inputClass
|
|
133
|
+
inputClass,
|
|
134
|
+
onChange
|
|
130
135
|
};
|
|
131
136
|
}
|
|
132
137
|
});
|
|
@@ -58,6 +58,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
58
58
|
pick: import("vue").WritableComputedRef<string | number | boolean | Record<string, any>>;
|
|
59
59
|
name: import("vue").ComputedRef<string | undefined>;
|
|
60
60
|
inputClass: import("vue").ComputedRef<string>;
|
|
61
|
+
onChange: (event: Event) => void;
|
|
61
62
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
62
63
|
id: {
|
|
63
64
|
type: StringConstructor;
|
|
@@ -118,8 +119,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
118
119
|
color: any;
|
|
119
120
|
class: any;
|
|
120
121
|
name: string;
|
|
121
|
-
label: string;
|
|
122
122
|
modelValue: string | number | boolean | Record<string, any>;
|
|
123
|
+
label: string;
|
|
123
124
|
disabled: boolean;
|
|
124
125
|
required: boolean;
|
|
125
126
|
help: string;
|
|
@@ -108,8 +108,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
108
108
|
class: any;
|
|
109
109
|
options: unknown[];
|
|
110
110
|
name: string;
|
|
111
|
-
legend: string;
|
|
112
111
|
modelValue: string | number | Record<string, any>;
|
|
112
|
+
legend: string;
|
|
113
113
|
disabled: boolean;
|
|
114
114
|
optionAttribute: string;
|
|
115
115
|
valueAttribute: string;
|
|
@@ -184,8 +184,8 @@ export default defineComponent({
|
|
|
184
184
|
emit("update:modelValue", event.target.value);
|
|
185
185
|
};
|
|
186
186
|
const onChange = (event) => {
|
|
187
|
+
emit("change", event.target.value);
|
|
187
188
|
emitFormChange();
|
|
188
|
-
emit("change", event);
|
|
189
189
|
};
|
|
190
190
|
const guessOptionValue = (option) => {
|
|
191
191
|
return get(option, props.valueAttribute, get(option, props.optionAttribute));
|
|
@@ -229,9 +229,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
229
229
|
class: any;
|
|
230
230
|
options: unknown[];
|
|
231
231
|
name: string;
|
|
232
|
+
modelValue: string | number | Record<string, any>;
|
|
232
233
|
leading: boolean;
|
|
233
234
|
variant: SelectVariant;
|
|
234
|
-
modelValue: string | number | Record<string, any>;
|
|
235
235
|
loading: boolean;
|
|
236
236
|
disabled: boolean;
|
|
237
237
|
placeholder: string;
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
autofocus
|
|
64
64
|
autocomplete="off"
|
|
65
65
|
:class="uiMenu.input"
|
|
66
|
-
@change="
|
|
66
|
+
@change="onQueryChange"
|
|
67
67
|
/>
|
|
68
68
|
<component
|
|
69
69
|
:is="searchable ? 'HComboboxOption' : 'HListboxOption'"
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
</div>
|
|
106
106
|
</li>
|
|
107
107
|
</component>
|
|
108
|
-
<p v-else-if="searchable && query && !filteredOptions
|
|
108
|
+
<p v-else-if="searchable && query && !filteredOptions?.length" :class="uiMenu.option.empty">
|
|
109
109
|
<slot name="option-empty" :query="query">
|
|
110
110
|
No results for "{{ query }}".
|
|
111
111
|
</slot>
|
|
112
112
|
</p>
|
|
113
|
-
<p v-else-if="!filteredOptions
|
|
113
|
+
<p v-else-if="!filteredOptions?.length" :class="uiMenu.empty">
|
|
114
114
|
<slot name="empty" :query="query">
|
|
115
115
|
No options.
|
|
116
116
|
</slot>
|
|
@@ -168,7 +168,7 @@ export default defineComponent({
|
|
|
168
168
|
inheritAttrs: false,
|
|
169
169
|
props: {
|
|
170
170
|
modelValue: {
|
|
171
|
-
type: [String, Number, Object, Array],
|
|
171
|
+
type: [String, Number, Object, Array, Boolean],
|
|
172
172
|
default: ""
|
|
173
173
|
},
|
|
174
174
|
query: {
|
|
@@ -350,7 +350,7 @@ export default defineComponent({
|
|
|
350
350
|
} else {
|
|
351
351
|
return null;
|
|
352
352
|
}
|
|
353
|
-
} else if (props.modelValue) {
|
|
353
|
+
} else if (props.modelValue !== void 0 && props.modelValue !== null) {
|
|
354
354
|
if (props.valueAttribute) {
|
|
355
355
|
const option = props.options.find((option2) => option2[props.valueAttribute] === props.modelValue);
|
|
356
356
|
return option ? option[props.optionAttribute] : null;
|
|
@@ -372,7 +372,7 @@ export default defineComponent({
|
|
|
372
372
|
variant?.replaceAll("{color}", color.value),
|
|
373
373
|
(isLeading.value || slots.leading) && ui.value.leading.padding[size.value],
|
|
374
374
|
(isTrailing.value || slots.trailing) && ui.value.trailing.padding[size.value]
|
|
375
|
-
), props.placeholder &&
|
|
375
|
+
), props.placeholder && (props.modelValue === void 0 && props.modelValue === null) && ui.value.placeholder, props.selectClass);
|
|
376
376
|
});
|
|
377
377
|
const isLeading = computed(() => {
|
|
378
378
|
return props.icon && props.leading || props.icon && !props.trailing || props.loading && !props.trailing || props.leadingIcon;
|
|
@@ -469,12 +469,12 @@ export default defineComponent({
|
|
|
469
469
|
emitFormBlur();
|
|
470
470
|
}
|
|
471
471
|
});
|
|
472
|
-
function onUpdate(
|
|
473
|
-
emit("update:modelValue",
|
|
474
|
-
emit("change",
|
|
472
|
+
function onUpdate(value) {
|
|
473
|
+
emit("update:modelValue", value);
|
|
474
|
+
emit("change", value);
|
|
475
475
|
emitFormChange();
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function onQueryChange(event) {
|
|
478
478
|
query.value = event.target.value;
|
|
479
479
|
}
|
|
480
480
|
provideUseId(() => useId());
|
|
@@ -507,7 +507,7 @@ export default defineComponent({
|
|
|
507
507
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
508
508
|
query,
|
|
509
509
|
onUpdate,
|
|
510
|
-
|
|
510
|
+
onQueryChange
|
|
511
511
|
};
|
|
512
512
|
}
|
|
513
513
|
});
|
|
@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
|
|
|
2
2
|
import type { SelectSize, SelectVariant, PopperOptions } from '../../types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
modelValue: {
|
|
5
|
-
type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
5
|
+
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
6
6
|
default: string;
|
|
7
7
|
};
|
|
8
8
|
query: {
|
|
@@ -177,11 +177,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
177
177
|
[x: string]: string;
|
|
178
178
|
} | null>;
|
|
179
179
|
query: import("vue").WritableComputedRef<string>;
|
|
180
|
-
onUpdate: (
|
|
181
|
-
|
|
180
|
+
onUpdate: (value: any) => void;
|
|
181
|
+
onQueryChange: (event: any) => void;
|
|
182
182
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open" | "update:query")[], "change" | "close" | "update:modelValue" | "open" | "update:query", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
183
183
|
modelValue: {
|
|
184
|
-
type: (ObjectConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
184
|
+
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
185
185
|
default: string;
|
|
186
186
|
};
|
|
187
187
|
query: {
|
|
@@ -349,9 +349,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
349
349
|
}[];
|
|
350
350
|
popper: PopperOptions;
|
|
351
351
|
name: string;
|
|
352
|
+
modelValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
352
353
|
leading: boolean;
|
|
353
354
|
variant: SelectVariant;
|
|
354
|
-
modelValue: string | number | unknown[] | Record<string, any>;
|
|
355
355
|
by: string;
|
|
356
356
|
loading: boolean;
|
|
357
357
|
disabled: boolean;
|
|
@@ -126,7 +126,7 @@ export default defineComponent({
|
|
|
126
126
|
default: () => ({})
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
|
-
emits: ["update:modelValue", "blur"],
|
|
129
|
+
emits: ["update:modelValue", "blur", "change"],
|
|
130
130
|
setup(props, { emit }) {
|
|
131
131
|
const { ui, attrs } = useUI("textarea", toRef(props, "ui"), config, toRef(props, "class"));
|
|
132
132
|
const { emitFormBlur, emitFormInput, inputId, color, size, name } = useFormGroup(props, config);
|
|
@@ -173,6 +173,7 @@ export default defineComponent({
|
|
|
173
173
|
};
|
|
174
174
|
const onChange = (event) => {
|
|
175
175
|
const value = event.target.value;
|
|
176
|
+
emit("change", value);
|
|
176
177
|
if (modelModifiers.value.lazy) {
|
|
177
178
|
updateInput(value);
|
|
178
179
|
}
|
|
@@ -100,7 +100,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
100
100
|
onInput: (event: Event) => void;
|
|
101
101
|
onChange: (event: Event) => void;
|
|
102
102
|
onBlur: (event: FocusEvent) => void;
|
|
103
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "update:modelValue")[], "blur" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
103
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "change" | "update:modelValue")[], "blur" | "change" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
104
104
|
modelValue: {
|
|
105
105
|
type: (NumberConstructor | StringConstructor)[];
|
|
106
106
|
default: string;
|
|
@@ -190,6 +190,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
190
190
|
};
|
|
191
191
|
}>> & {
|
|
192
192
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
193
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
193
194
|
onBlur?: ((...args: any[]) => any) | undefined;
|
|
194
195
|
}, {
|
|
195
196
|
resize: boolean;
|
|
@@ -199,8 +200,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
199
200
|
color: any;
|
|
200
201
|
class: any;
|
|
201
202
|
name: string;
|
|
202
|
-
variant: TextareaVariant;
|
|
203
203
|
modelValue: string | number;
|
|
204
|
+
variant: TextareaVariant;
|
|
204
205
|
rows: number;
|
|
205
206
|
disabled: boolean;
|
|
206
207
|
placeholder: string;
|
|
@@ -3,15 +3,26 @@
|
|
|
3
3
|
:id="inputId"
|
|
4
4
|
v-model="active"
|
|
5
5
|
:name="name"
|
|
6
|
-
:disabled="disabled"
|
|
6
|
+
:disabled="disabled || loading"
|
|
7
7
|
:class="switchClass"
|
|
8
8
|
v-bind="attrs"
|
|
9
9
|
>
|
|
10
10
|
<span :class="containerClass">
|
|
11
|
-
<span v-if="
|
|
11
|
+
<span v-if="loading" :class="[ui.icon.active, ui.icon.base]" aria-hidden="true">
|
|
12
|
+
<UIcon :name="loadingIcon" :class="loadingIconClass" />
|
|
13
|
+
</span>
|
|
14
|
+
<span
|
|
15
|
+
v-if="!loading && onIcon"
|
|
16
|
+
:class="[active ? ui.icon.active : ui.icon.inactive, ui.icon.base]"
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
>
|
|
12
19
|
<UIcon :name="onIcon" :class="onIconClass" />
|
|
13
20
|
</span>
|
|
14
|
-
<span
|
|
21
|
+
<span
|
|
22
|
+
v-if="!loading && offIcon"
|
|
23
|
+
:class="[active ? ui.icon.inactive : ui.icon.active, ui.icon.base]"
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
>
|
|
15
26
|
<UIcon :name="offIcon" :class="offIconClass" />
|
|
16
27
|
</span>
|
|
17
28
|
</span>
|
|
@@ -53,6 +64,10 @@ export default defineComponent({
|
|
|
53
64
|
type: Boolean,
|
|
54
65
|
default: false
|
|
55
66
|
},
|
|
67
|
+
loading: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
56
71
|
onIcon: {
|
|
57
72
|
type: String,
|
|
58
73
|
default: () => config.default.onIcon
|
|
@@ -61,6 +76,10 @@ export default defineComponent({
|
|
|
61
76
|
type: String,
|
|
62
77
|
default: () => config.default.offIcon
|
|
63
78
|
},
|
|
79
|
+
loadingIcon: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: () => config.default.loadingIcon
|
|
82
|
+
},
|
|
64
83
|
color: {
|
|
65
84
|
type: String,
|
|
66
85
|
default: () => config.default.color,
|
|
@@ -94,6 +113,7 @@ export default defineComponent({
|
|
|
94
113
|
},
|
|
95
114
|
set(value) {
|
|
96
115
|
emit("update:modelValue", value);
|
|
116
|
+
emit("change", value);
|
|
97
117
|
emitFormChange();
|
|
98
118
|
}
|
|
99
119
|
});
|
|
@@ -125,6 +145,12 @@ export default defineComponent({
|
|
|
125
145
|
color.value && ui.value.icon.off.replaceAll("{color}", color.value)
|
|
126
146
|
);
|
|
127
147
|
});
|
|
148
|
+
const loadingIconClass = computed(() => {
|
|
149
|
+
return twJoin(
|
|
150
|
+
ui.value.icon.size[props.size],
|
|
151
|
+
color.value && ui.value.icon.loading.replaceAll("{color}", color.value)
|
|
152
|
+
);
|
|
153
|
+
});
|
|
128
154
|
provideUseId(() => useId());
|
|
129
155
|
return {
|
|
130
156
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
@@ -137,7 +163,8 @@ export default defineComponent({
|
|
|
137
163
|
switchClass,
|
|
138
164
|
containerClass,
|
|
139
165
|
onIconClass,
|
|
140
|
-
offIconClass
|
|
166
|
+
offIconClass,
|
|
167
|
+
loadingIconClass
|
|
141
168
|
};
|
|
142
169
|
}
|
|
143
170
|
});
|
|
@@ -17,6 +17,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
17
17
|
type: BooleanConstructor;
|
|
18
18
|
default: boolean;
|
|
19
19
|
};
|
|
20
|
+
loading: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
20
24
|
onIcon: {
|
|
21
25
|
type: StringConstructor;
|
|
22
26
|
default: () => any;
|
|
@@ -25,6 +29,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
25
29
|
type: StringConstructor;
|
|
26
30
|
default: () => any;
|
|
27
31
|
};
|
|
32
|
+
loadingIcon: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: () => any;
|
|
35
|
+
};
|
|
28
36
|
color: {
|
|
29
37
|
type: PropType<any>;
|
|
30
38
|
default: () => any;
|
|
@@ -55,6 +63,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
55
63
|
containerClass: import("vue").ComputedRef<string>;
|
|
56
64
|
onIconClass: import("vue").ComputedRef<string>;
|
|
57
65
|
offIconClass: import("vue").ComputedRef<string>;
|
|
66
|
+
loadingIconClass: import("vue").ComputedRef<string>;
|
|
58
67
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
59
68
|
id: {
|
|
60
69
|
type: StringConstructor;
|
|
@@ -72,6 +81,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
72
81
|
type: BooleanConstructor;
|
|
73
82
|
default: boolean;
|
|
74
83
|
};
|
|
84
|
+
loading: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
default: boolean;
|
|
87
|
+
};
|
|
75
88
|
onIcon: {
|
|
76
89
|
type: StringConstructor;
|
|
77
90
|
default: () => any;
|
|
@@ -80,6 +93,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
80
93
|
type: StringConstructor;
|
|
81
94
|
default: () => any;
|
|
82
95
|
};
|
|
96
|
+
loadingIcon: {
|
|
97
|
+
type: StringConstructor;
|
|
98
|
+
default: () => any;
|
|
99
|
+
};
|
|
83
100
|
color: {
|
|
84
101
|
type: PropType<any>;
|
|
85
102
|
default: () => any;
|
|
@@ -109,7 +126,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
109
126
|
class: any;
|
|
110
127
|
name: string;
|
|
111
128
|
modelValue: boolean;
|
|
129
|
+
loading: boolean;
|
|
112
130
|
disabled: boolean;
|
|
131
|
+
loadingIcon: string;
|
|
113
132
|
onIcon: string;
|
|
114
133
|
offIcon: string;
|
|
115
134
|
}, {}>;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
:class="ui.trigger"
|
|
9
9
|
role="button"
|
|
10
10
|
@mouseenter="onMouseEnter"
|
|
11
|
-
@touchstart.
|
|
11
|
+
@touchstart.passive="onTouchStart"
|
|
12
12
|
>
|
|
13
13
|
<slot :open="open" :close="close">
|
|
14
14
|
<button :disabled="disabled">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<div v-if="open" :class="[ui.overlay.base, ui.overlay.background]" />
|
|
22
22
|
</Transition>
|
|
23
23
|
|
|
24
|
-
<div v-if="open" ref="container" :class="[ui.container, ui.width]" :style="containerStyle">
|
|
24
|
+
<div v-if="open" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseenter="onMouseEnter">
|
|
25
25
|
<Transition appear v-bind="ui.transition">
|
|
26
26
|
<div>
|
|
27
27
|
<div v-if="popper.arrow" data-popper-arrow :class="Object.values(ui.arrow)" />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="slideoverState.component"
|
|
4
|
+
v-if="slideoverState"
|
|
5
|
+
v-bind="slideoverState.props"
|
|
6
|
+
v-model="isOpen"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import { inject } from 'vue'
|
|
12
|
+
import { useSlideover, slidOverInjectionKey } from '../../composables/useSlideover'
|
|
13
|
+
|
|
14
|
+
const slideoverState = inject(slidOverInjectionKey)
|
|
15
|
+
|
|
16
|
+
const { isOpen } = useSlideover()
|
|
17
|
+
</script>
|
|
@@ -19,6 +19,14 @@ export function useProvideButtonGroup(buttonGroupProps) {
|
|
|
19
19
|
}
|
|
20
20
|
export function useInjectButtonGroup({ ui, props }) {
|
|
21
21
|
const instance = getCurrentInstance();
|
|
22
|
+
provide("ButtonGroupContextConsumer", true);
|
|
23
|
+
const isParentPartOfGroup = inject("ButtonGroupContextConsumer", false);
|
|
24
|
+
if (isParentPartOfGroup) {
|
|
25
|
+
return {
|
|
26
|
+
size: computed(() => props.size),
|
|
27
|
+
rounded: computed(() => ui.value.rounded)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
22
30
|
let parent = instance.parent;
|
|
23
31
|
let groupContext;
|
|
24
32
|
while (parent && !groupContext) {
|
|
@@ -4,7 +4,7 @@ import type { Modal, ModalState } from '../types/modal';
|
|
|
4
4
|
export declare const modalInjectionKey: InjectionKey<ShallowRef<ModalState>>;
|
|
5
5
|
declare function _useModal(): {
|
|
6
6
|
isOpen: import("vue").Ref<boolean>;
|
|
7
|
-
open: <T extends Component>(component: T, props?:
|
|
7
|
+
open: <T extends Component>(component: T, props?: Modal & ComponentProps<T>) => void;
|
|
8
8
|
close: () => void;
|
|
9
9
|
patch: <T_1 extends Component = {}>(props: Partial<Modal & ComponentProps<T_1>>) => void;
|
|
10
10
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSharedComposable, useActiveElement } from "@vueuse/core";
|
|
2
2
|
import { ref, computed, onMounted } from "vue";
|
|
3
3
|
export const _useShortcuts = () => {
|
|
4
|
-
const macOS = computed(() =>
|
|
4
|
+
const macOS = computed(() => import.meta.client && navigator && navigator.userAgent && navigator.userAgent.match(/Macintosh;/));
|
|
5
5
|
const metaSymbol = ref(" ");
|
|
6
6
|
const activeElement = useActiveElement();
|
|
7
7
|
const usingInput = computed(() => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ShallowRef, Component, InjectionKey } from 'vue';
|
|
2
|
+
import type { ComponentProps } from '../types/component';
|
|
3
|
+
import type { Slideover, SlideoverState } from '../types/slideover';
|
|
4
|
+
export declare const slidOverInjectionKey: InjectionKey<ShallowRef<SlideoverState>>;
|
|
5
|
+
declare function _useSlideover(): {
|
|
6
|
+
open: <T extends Component>(component: T, props?: Slideover & ComponentProps<T>) => void;
|
|
7
|
+
close: () => void;
|
|
8
|
+
patch: <T_1 extends Component = {}>(props: Partial<Slideover & ComponentProps<T_1>>) => void;
|
|
9
|
+
isOpen: import("vue").Ref<boolean>;
|
|
10
|
+
};
|
|
11
|
+
export declare const useSlideover: typeof _useSlideover;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ref, inject } from "vue";
|
|
2
|
+
import { createSharedComposable } from "@vueuse/core";
|
|
3
|
+
export const slidOverInjectionKey = Symbol("nuxt-ui.slideover");
|
|
4
|
+
function _useSlideover() {
|
|
5
|
+
const slideoverState = inject(slidOverInjectionKey);
|
|
6
|
+
const isOpen = ref(false);
|
|
7
|
+
function open(component, props) {
|
|
8
|
+
if (!slideoverState) {
|
|
9
|
+
throw new Error("useSlideover() is called without provider");
|
|
10
|
+
}
|
|
11
|
+
slideoverState.value = {
|
|
12
|
+
component,
|
|
13
|
+
props: props ?? {}
|
|
14
|
+
};
|
|
15
|
+
isOpen.value = true;
|
|
16
|
+
}
|
|
17
|
+
function close() {
|
|
18
|
+
if (!slideoverState)
|
|
19
|
+
return;
|
|
20
|
+
isOpen.value = false;
|
|
21
|
+
}
|
|
22
|
+
function patch(props) {
|
|
23
|
+
if (!slideoverState)
|
|
24
|
+
return;
|
|
25
|
+
slideoverState.value = {
|
|
26
|
+
...slideoverState.value,
|
|
27
|
+
props: {
|
|
28
|
+
...slideoverState.value.props,
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
open,
|
|
35
|
+
close,
|
|
36
|
+
patch,
|
|
37
|
+
isOpen
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export const useSlideover = createSharedComposable(_useSlideover);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import type { Strategy } from '../types';
|
|
3
3
|
export declare const useUI: <T>(key: any, $ui?: Ref<(Partial<T> & {
|
|
4
|
-
strategy?: Strategy
|
|
5
|
-
}) | undefined
|
|
4
|
+
strategy?: Strategy;
|
|
5
|
+
}) | undefined>, $config?: Ref<T> | T, $wrapperClass?: Ref<string>, withAppConfig?: boolean) => {
|
|
6
6
|
ui: import("vue").ComputedRef<T>;
|
|
7
7
|
attrs: import("vue").ComputedRef<Pick<{
|
|
8
8
|
[x: string]: unknown;
|
|
@@ -33,7 +33,7 @@ ${Object.entries(gray || colors.cool).map(([key, value]) => `--color-gray-${key}
|
|
|
33
33
|
id: "nuxt-ui-colors"
|
|
34
34
|
}]
|
|
35
35
|
};
|
|
36
|
-
if (
|
|
36
|
+
if (import.meta.client && nuxtApp.isHydrating && !nuxtApp.payload.serverRendered) {
|
|
37
37
|
const style = document.createElement("style");
|
|
38
38
|
style.innerHTML = root.value;
|
|
39
39
|
style.setAttribute("data-nuxt-ui-colors", "");
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from "#imports";
|
|
2
|
+
import { shallowRef } from "vue";
|
|
3
|
+
import { slidOverInjectionKey } from "../composables/useSlideover.mjs";
|
|
4
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
5
|
+
const slideoverState = shallowRef({
|
|
6
|
+
component: "div",
|
|
7
|
+
props: {}
|
|
8
|
+
});
|
|
9
|
+
nuxtApp.vueApp.provide(slidOverInjectionKey, slideoverState);
|
|
10
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Component } from 'vue'
|
|
2
|
+
|
|
3
|
+
interface Slideover {
|
|
4
|
+
ui?: any;
|
|
5
|
+
side?: 'right' | 'left';
|
|
6
|
+
transition?: boolean;
|
|
7
|
+
appear?: boolean;
|
|
8
|
+
overlay?: boolean;
|
|
9
|
+
preventClose?: boolean;
|
|
10
|
+
modelValue?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface SlideoverState {
|
|
14
|
+
component: Component | string;
|
|
15
|
+
props: Slideover;
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -49,11 +49,13 @@ export default {
|
|
|
49
49
|
"2xl": "h-6 w-6"
|
|
50
50
|
},
|
|
51
51
|
on: "text-{color}-500 dark:text-{color}-400",
|
|
52
|
-
off: "text-gray-400 dark:text-gray-500"
|
|
52
|
+
off: "text-gray-400 dark:text-gray-500",
|
|
53
|
+
loading: "animate-spin text-{color}-500 dark:text-{color}-400"
|
|
53
54
|
},
|
|
54
55
|
default: {
|
|
55
56
|
onIcon: null,
|
|
56
57
|
offIcon: null,
|
|
58
|
+
loadingIcon: "i-heroicons-arrow-path-20-solid",
|
|
57
59
|
color: "primary",
|
|
58
60
|
size: "md"
|
|
59
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.1",
|
|
4
4
|
"repository": "nuxt/ui",
|
|
5
5
|
"homepage": "https://ui.nuxt.com",
|
|
6
6
|
"type": "module",
|
|
@@ -37,50 +37,50 @@
|
|
|
37
37
|
"@headlessui/tailwindcss": "^0.2.0",
|
|
38
38
|
"@headlessui/vue": "^1.7.19",
|
|
39
39
|
"@iconify-json/heroicons": "^1.1.20",
|
|
40
|
-
"@nuxt/kit": "^3.
|
|
41
|
-
"@nuxtjs/color-mode": "^3.3.
|
|
40
|
+
"@nuxt/kit": "^3.11.1",
|
|
41
|
+
"@nuxtjs/color-mode": "^3.3.3",
|
|
42
42
|
"@nuxtjs/tailwindcss": "^6.11.4",
|
|
43
43
|
"@popperjs/core": "^2.11.8",
|
|
44
44
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
45
45
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
46
46
|
"@tailwindcss/forms": "^0.5.7",
|
|
47
|
-
"@tailwindcss/typography": "^0.5.
|
|
47
|
+
"@tailwindcss/typography": "^0.5.12",
|
|
48
48
|
"@vueuse/core": "^10.9.0",
|
|
49
49
|
"@vueuse/integrations": "^10.9.0",
|
|
50
50
|
"@vueuse/math": "^10.9.0",
|
|
51
51
|
"defu": "^6.1.4",
|
|
52
52
|
"fuse.js": "^6.6.2",
|
|
53
|
-
"nuxt-icon": "^0.6.
|
|
53
|
+
"nuxt-icon": "^0.6.10",
|
|
54
54
|
"ohash": "^1.1.3",
|
|
55
55
|
"pathe": "^1.1.2",
|
|
56
56
|
"scule": "^1.3.0",
|
|
57
|
-
"tailwind-merge": "^2.2.
|
|
58
|
-
"tailwindcss": "^3.4.
|
|
57
|
+
"tailwind-merge": "^2.2.2",
|
|
58
|
+
"tailwindcss": "^3.4.3"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@nuxt/eslint-config": "^0.2.0",
|
|
62
62
|
"@nuxt/module-builder": "^0.5.5",
|
|
63
|
-
"@nuxt/test-utils": "^3.
|
|
63
|
+
"@nuxt/test-utils": "^3.12.0",
|
|
64
64
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
65
|
-
"@vue/test-utils": "^2.4.
|
|
65
|
+
"@vue/test-utils": "^2.4.5",
|
|
66
66
|
"eslint": "^8.57.0",
|
|
67
|
-
"happy-dom": "^
|
|
67
|
+
"happy-dom": "^14.3.10",
|
|
68
68
|
"joi": "^17.12.2",
|
|
69
|
-
"nuxt": "^3.
|
|
69
|
+
"nuxt": "^3.11.1",
|
|
70
70
|
"release-it": "^17.1.1",
|
|
71
|
-
"typescript": "^5.
|
|
71
|
+
"typescript": "^5.4.3",
|
|
72
72
|
"unbuild": "^2.0.0",
|
|
73
|
-
"valibot": "^0.
|
|
74
|
-
"vitest": "^1.
|
|
73
|
+
"valibot": "^0.30.0",
|
|
74
|
+
"vitest": "^1.4.0",
|
|
75
75
|
"vitest-environment-nuxt": "^1.0.0",
|
|
76
|
-
"vue-tsc": "^2.0.
|
|
77
|
-
"yup": "^1.
|
|
76
|
+
"vue-tsc": "^2.0.7",
|
|
77
|
+
"yup": "^1.4.0",
|
|
78
78
|
"zod": "^3.22.4"
|
|
79
79
|
},
|
|
80
80
|
"resolutions": {
|
|
81
|
-
"@nuxt/kit": "3.
|
|
82
|
-
"@nuxt/schema": "3.
|
|
83
|
-
"tailwindcss": "3.4.
|
|
81
|
+
"@nuxt/kit": "^3.11.1",
|
|
82
|
+
"@nuxt/schema": "3.11.1",
|
|
83
|
+
"tailwindcss": "^3.4.3",
|
|
84
84
|
"@headlessui/vue": "1.7.19",
|
|
85
85
|
"vue": "3.4.21"
|
|
86
86
|
}
|