@nuxt/ui 2.14.1 → 2.15.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 +3 -0
- package/dist/module.d.ts +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -1
- package/dist/runtime/components/data/Table.vue.d.ts +1 -1
- 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 +7 -3
- package/dist/runtime/components/elements/Carousel.vue +4 -1
- package/dist/runtime/components/elements/Dropdown.vue +19 -7
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +3 -2
- package/dist/runtime/components/forms/Checkbox.vue +5 -3
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +2 -2
- package/dist/runtime/components/forms/Form.vue.d.ts +9 -3
- package/dist/runtime/components/forms/Input.vue +2 -1
- 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 +1 -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 +8 -7
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +3 -3
- 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/navigation/CommandPaletteGroup.vue +2 -2
- package/dist/runtime/components/overlays/Notification.vue +1 -1
- package/dist/runtime/components/overlays/Popover.vue +16 -4
- package/dist/runtime/components/overlays/Popover.vue.d.ts +2 -1
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Slideovers.client.vue +17 -0
- package/dist/runtime/components/overlays/Tooltip.vue +3 -3
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.mjs +8 -0
- package/dist/runtime/composables/useModal.d.ts +1 -1
- package/dist/runtime/composables/useShortcuts.d.ts +2 -2
- 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/radioGroup.d.ts +1 -0
- package/dist/runtime/ui.config/forms/radioGroup.mjs +1 -0
- 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/navigation/horizontalNavigation.mjs +1 -1
- package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +1 -1
- package/dist/runtime/ui.config/overlays/modal.mjs +1 -1
- package/dist/runtime/ui.config/overlays/tooltip.mjs +4 -1
- package/package.json +21 -21
package/dist/module.d.mts
CHANGED
|
@@ -1271,6 +1271,7 @@ declare const _default$n: {
|
|
|
1271
1271
|
|
|
1272
1272
|
declare const _default$m: {
|
|
1273
1273
|
wrapper: string;
|
|
1274
|
+
fieldset: string;
|
|
1274
1275
|
legend: string;
|
|
1275
1276
|
default: {
|
|
1276
1277
|
color: string;
|
|
@@ -1366,10 +1367,12 @@ declare const _default$j: {
|
|
|
1366
1367
|
};
|
|
1367
1368
|
on: string;
|
|
1368
1369
|
off: string;
|
|
1370
|
+
loading: string;
|
|
1369
1371
|
};
|
|
1370
1372
|
default: {
|
|
1371
1373
|
onIcon: any;
|
|
1372
1374
|
offIcon: any;
|
|
1375
|
+
loadingIcon: string;
|
|
1373
1376
|
color: string;
|
|
1374
1377
|
size: string;
|
|
1375
1378
|
};
|
package/dist/module.d.ts
CHANGED
|
@@ -1271,6 +1271,7 @@ declare const _default$n: {
|
|
|
1271
1271
|
|
|
1272
1272
|
declare const _default$m: {
|
|
1273
1273
|
wrapper: string;
|
|
1274
|
+
fieldset: string;
|
|
1274
1275
|
legend: string;
|
|
1275
1276
|
default: {
|
|
1276
1277
|
color: string;
|
|
@@ -1366,10 +1367,12 @@ declare const _default$j: {
|
|
|
1366
1367
|
};
|
|
1367
1368
|
on: string;
|
|
1368
1369
|
off: string;
|
|
1370
|
+
loading: string;
|
|
1369
1371
|
};
|
|
1370
1372
|
default: {
|
|
1371
1373
|
onIcon: any;
|
|
1372
1374
|
offIcon: any;
|
|
1375
|
+
loadingIcon: string;
|
|
1373
1376
|
color: string;
|
|
1374
1377
|
size: string;
|
|
1375
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.0";
|
|
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,
|
|
@@ -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">
|
|
@@ -10,7 +14,7 @@
|
|
|
10
14
|
{{ title }}
|
|
11
15
|
</slot>
|
|
12
16
|
</p>
|
|
13
|
-
<p v-if="description || $slots.description" :class="ui.description">
|
|
17
|
+
<p v-if="description || $slots.description" :class="twMerge(ui.description, !(title && $slots.title) && 'mt-0 leading-5')">
|
|
14
18
|
<slot name="description" :description="description">
|
|
15
19
|
{{ description }}
|
|
16
20
|
</slot>
|
|
@@ -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
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
:disabled="disabled"
|
|
8
8
|
:class="ui.trigger"
|
|
9
9
|
role="button"
|
|
10
|
-
@
|
|
10
|
+
@mouseenter="onMouseEnter"
|
|
11
|
+
@touchstart.passive="onTouchStart"
|
|
11
12
|
>
|
|
12
13
|
<slot :open="open" :disabled="disabled">
|
|
13
14
|
<button :disabled="disabled">
|
|
@@ -16,25 +17,25 @@
|
|
|
16
17
|
</slot>
|
|
17
18
|
</HMenuButton>
|
|
18
19
|
|
|
19
|
-
<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">
|
|
20
21
|
<Transition appear v-bind="ui.transition">
|
|
21
22
|
<div>
|
|
22
23
|
<div v-if="popper.arrow" data-popper-arrow :class="Object.values(ui.arrow)" />
|
|
23
24
|
|
|
24
25
|
<HMenuItems :class="[ui.base, ui.divide, ui.ring, ui.rounded, ui.shadow, ui.background, ui.height]" static>
|
|
25
26
|
<div v-for="(subItems, index) of items" :key="index" :class="ui.padding">
|
|
26
|
-
<NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal }" v-bind="getNuxtLinkProps(item)" custom>
|
|
27
|
+
<NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal, isActive }" v-bind="getNuxtLinkProps(item)" custom>
|
|
27
28
|
<HMenuItem v-slot="{ active, disabled: itemDisabled, close }" :disabled="item.disabled">
|
|
28
29
|
<component
|
|
29
30
|
:is="!!href ? 'a' : 'button'"
|
|
30
31
|
:href="!itemDisabled ? href : undefined"
|
|
31
32
|
:rel="rel"
|
|
32
33
|
:target="target"
|
|
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)"
|
|
34
|
+
:class="twMerge(twJoin(ui.item.base, ui.item.padding, ui.item.size, ui.item.rounded, active || isActive ? ui.item.active : ui.item.inactive, itemDisabled && ui.item.disabled), item.class)"
|
|
34
35
|
@click="onClick($event, item, { href, navigate, close, isExternal })"
|
|
35
36
|
>
|
|
36
37
|
<slot :name="item.slot || 'item'" :item="item">
|
|
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)" />
|
|
38
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="twMerge(twJoin(ui.item.icon.base, active || isActive ? ui.item.icon.active : ui.item.icon.inactive), item.iconClass)" />
|
|
38
39
|
<UAvatar v-else-if="item.avatar" v-bind="{ size: ui.item.avatar.size, ...item.avatar }" :class="ui.item.avatar.base" />
|
|
39
40
|
|
|
40
41
|
<span :class="twMerge(ui.item.label, item.labelClass)">{{ item.label }}</span>
|
|
@@ -164,7 +165,17 @@ export default defineComponent({
|
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
167
|
});
|
|
167
|
-
function
|
|
168
|
+
function onTouchStart() {
|
|
169
|
+
if (!menuApi.value) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (menuApi.value.menuState === 0) {
|
|
173
|
+
menuApi.value.closeMenu();
|
|
174
|
+
} else {
|
|
175
|
+
menuApi.value.openMenu();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function onMouseEnter() {
|
|
168
179
|
if (props.mode !== "hover" || !menuApi.value) {
|
|
169
180
|
return;
|
|
170
181
|
}
|
|
@@ -232,7 +243,8 @@ export default defineComponent({
|
|
|
232
243
|
trigger,
|
|
233
244
|
container,
|
|
234
245
|
containerStyle,
|
|
235
|
-
|
|
246
|
+
onTouchStart,
|
|
247
|
+
onMouseEnter,
|
|
236
248
|
onMouseLeave,
|
|
237
249
|
onClick,
|
|
238
250
|
getNuxtLinkProps,
|
|
@@ -68,7 +68,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
68
68
|
paddingLeft: string;
|
|
69
69
|
paddingRight: string;
|
|
70
70
|
}>;
|
|
71
|
-
|
|
71
|
+
onTouchStart: () => void;
|
|
72
|
+
onMouseEnter: () => void;
|
|
72
73
|
onMouseLeave: () => void;
|
|
73
74
|
onClick: (e: any, item: any, { href, navigate, close, isExternal }: {
|
|
74
75
|
href: any;
|
|
@@ -125,8 +126,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
125
126
|
class: any;
|
|
126
127
|
popper: PopperOptions;
|
|
127
128
|
disabled: boolean;
|
|
128
|
-
items: DropdownItem[][];
|
|
129
129
|
open: boolean;
|
|
130
|
+
items: DropdownItem[][];
|
|
130
131
|
mode: "click" | "hover";
|
|
131
132
|
openDelay: number;
|
|
132
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"
|
|
@@ -35,6 +35,7 @@ import { useFormGroup } from "../../composables/useFormGroup";
|
|
|
35
35
|
import { mergeConfig } from "../../utils";
|
|
36
36
|
import appConfig from "#build/app.config";
|
|
37
37
|
import { checkbox } from "#ui/ui.config";
|
|
38
|
+
import { useId } from "#app";
|
|
38
39
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.checkbox, checkbox);
|
|
39
40
|
export default defineComponent({
|
|
40
41
|
inheritAttrs: false,
|
|
@@ -98,7 +99,8 @@ export default defineComponent({
|
|
|
98
99
|
emits: ["update:modelValue", "change"],
|
|
99
100
|
setup(props, { emit }) {
|
|
100
101
|
const { ui, attrs } = useUI("checkbox", toRef(props, "ui"), config, toRef(props, "class"));
|
|
101
|
-
const { emitFormChange, color, name, inputId } = useFormGroup(props);
|
|
102
|
+
const { emitFormChange, color, name, inputId: _inputId } = useFormGroup(props);
|
|
103
|
+
const inputId = _inputId.value ?? useId();
|
|
102
104
|
const toggle = computed({
|
|
103
105
|
get() {
|
|
104
106
|
return props.modelValue;
|
|
@@ -108,7 +110,7 @@ export default defineComponent({
|
|
|
108
110
|
}
|
|
109
111
|
});
|
|
110
112
|
const onChange = (event) => {
|
|
111
|
-
emit("change", event);
|
|
113
|
+
emit("change", event.target.value);
|
|
112
114
|
emitFormChange();
|
|
113
115
|
};
|
|
114
116
|
const inputClass = computed(() => {
|
|
@@ -59,7 +59,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
59
|
[x: string]: unknown;
|
|
60
60
|
}, string>>;
|
|
61
61
|
toggle: import("vue").WritableComputedRef<boolean | unknown[]>;
|
|
62
|
-
inputId:
|
|
62
|
+
inputId: any;
|
|
63
63
|
name: import("vue").ComputedRef<string | undefined>;
|
|
64
64
|
inputClass: import("vue").ComputedRef<string>;
|
|
65
65
|
onChange: (event: Event) => void;
|
|
@@ -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 });
|
|
@@ -188,6 +188,7 @@ export default defineComponent({
|
|
|
188
188
|
};
|
|
189
189
|
const onChange = (event) => {
|
|
190
190
|
const value = event.target.value;
|
|
191
|
+
emit("change", value);
|
|
191
192
|
if (modelModifiers.value.lazy) {
|
|
192
193
|
updateInput(value);
|
|
193
194
|
}
|
|
@@ -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;
|
|
@@ -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 {
|
|
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;
|
|
@@ -358,6 +358,7 @@ export default defineComponent({
|
|
|
358
358
|
return ["string", "number"].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute];
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
+
return null;
|
|
361
362
|
});
|
|
362
363
|
const selectClass = computed(() => {
|
|
363
364
|
const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
|
|
@@ -371,7 +372,7 @@ export default defineComponent({
|
|
|
371
372
|
variant?.replaceAll("{color}", color.value),
|
|
372
373
|
(isLeading.value || slots.leading) && ui.value.leading.padding[size.value],
|
|
373
374
|
(isTrailing.value || slots.trailing) && ui.value.trailing.padding[size.value]
|
|
374
|
-
), props.placeholder &&
|
|
375
|
+
), props.placeholder && (props.modelValue === void 0 && props.modelValue === null) && ui.value.placeholder, props.selectClass);
|
|
375
376
|
});
|
|
376
377
|
const isLeading = computed(() => {
|
|
377
378
|
return props.icon && props.leading || props.icon && !props.trailing || props.loading && !props.trailing || props.leadingIcon;
|
|
@@ -470,10 +471,10 @@ export default defineComponent({
|
|
|
470
471
|
});
|
|
471
472
|
function onUpdate(event) {
|
|
472
473
|
emit("update:modelValue", event);
|
|
473
|
-
emit("change", event);
|
|
474
|
-
emitFormChange();
|
|
475
474
|
}
|
|
476
475
|
function onChange(event) {
|
|
476
|
+
emit("change", event.target.value);
|
|
477
|
+
emitFormChange();
|
|
477
478
|
query.value = event.target.value;
|
|
478
479
|
}
|
|
479
480
|
provideUseId(() => useId());
|