@nuxt/ui 2.15.1 → 2.15.2
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 +1 -8
- package/dist/module.d.mts +3 -0
- package/dist/module.d.ts +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/data/Table.vue +2 -2
- package/dist/runtime/components/elements/Accordion.vue +25 -7
- package/dist/runtime/components/elements/Accordion.vue.d.ts +9 -0
- package/dist/runtime/components/elements/Carousel.vue +10 -4
- package/dist/runtime/components/elements/Carousel.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Dropdown.vue +2 -2
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Modal.vue +6 -2
- package/dist/runtime/components/overlays/Modal.vue.d.ts +3 -1
- package/dist/runtime/components/overlays/Modals.client.vue +8 -2
- package/dist/runtime/components/overlays/Popover.vue +2 -2
- package/dist/runtime/components/overlays/Popover.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Slideover.vue +6 -2
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +3 -1
- package/dist/runtime/components/overlays/Slideovers.client.vue +2 -1
- package/dist/runtime/composables/useModal.d.ts +3 -2
- package/dist/runtime/composables/useModal.mjs +13 -3
- package/dist/runtime/composables/useSlideover.d.ts +2 -1
- package/dist/runtime/composables/useSlideover.mjs +8 -1
- package/dist/runtime/ui.config/data/table.d.ts +3 -0
- package/dist/runtime/ui.config/data/table.mjs +3 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -27,14 +27,7 @@ Read more on [ui.nuxt.com](https://ui.nuxt.com)
|
|
|
27
27
|
## Installation
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
|
|
31
|
-
npm install @nuxt/ui
|
|
32
|
-
# yarn
|
|
33
|
-
yarn add @nuxt/ui
|
|
34
|
-
# pnpm
|
|
35
|
-
pnpm add @nuxt/ui
|
|
36
|
-
# bun
|
|
37
|
-
bun add @nuxt/ui
|
|
30
|
+
npx nuxi@latest module add ui
|
|
38
31
|
```
|
|
39
32
|
|
|
40
33
|
Then, register the module in your `nuxt.config.ts`:
|
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
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.15.
|
|
17
|
+
const version = "2.15.2";
|
|
18
18
|
|
|
19
19
|
function createTemplates(nuxt = useNuxt()) {
|
|
20
20
|
const template = addTemplate({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<thead :class="ui.thead">
|
|
5
5
|
<tr :class="ui.tr.base">
|
|
6
6
|
<th v-if="modelValue" scope="col" :class="ui.checkbox.padding">
|
|
7
|
-
<UCheckbox :model-value="indeterminate || selected.length === rows.length" :indeterminate="indeterminate" aria-label="Select all" @change="onChange" />
|
|
7
|
+
<UCheckbox :model-value="indeterminate || selected.length === rows.length" :indeterminate="indeterminate" v-bind="ui.default.checkbox" aria-label="Select all" @change="onChange" />
|
|
8
8
|
</th>
|
|
9
9
|
|
|
10
10
|
<th v-for="(column, index) in columns" :key="index" scope="col" :class="[ui.th.base, ui.th.padding, ui.th.color, ui.th.font, ui.th.size, column.class]">
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<template v-else>
|
|
58
58
|
<tr v-for="(row, index) in rows" :key="index" :class="[ui.tr.base, isSelected(row) && ui.tr.selected, $attrs.onSelect && ui.tr.active, row?.class]" @click="() => onSelect(row)">
|
|
59
59
|
<td v-if="modelValue" :class="ui.checkbox.padding">
|
|
60
|
-
<UCheckbox v-model="selected" :value="row" aria-label="Select row" @click.stop />
|
|
60
|
+
<UCheckbox v-model="selected" :value="row" v-bind="ui.default.checkbox" aria-label="Select row" @click.stop />
|
|
61
61
|
</td>
|
|
62
62
|
|
|
63
63
|
<td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, row[column.key]?.class]">
|
|
@@ -39,13 +39,27 @@
|
|
|
39
39
|
@before-leave="onBeforeLeave"
|
|
40
40
|
@leave="onLeave"
|
|
41
41
|
>
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
<HDisclosurePanel
|
|
43
|
+
v-if="unmount"
|
|
44
|
+
:class="[ui.item.base, ui.item.size, ui.item.color, ui.item.padding]"
|
|
45
|
+
unmount
|
|
46
|
+
>
|
|
47
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index" :open="open" :close="close">
|
|
48
|
+
{{ item.content }}
|
|
49
|
+
</slot>
|
|
50
|
+
</HDisclosurePanel>
|
|
51
|
+
<template v-else>
|
|
52
|
+
<div v-show="open">
|
|
53
|
+
<HDisclosurePanel
|
|
54
|
+
:class="[ui.item.base, ui.item.size, ui.item.color, ui.item.padding]"
|
|
55
|
+
static
|
|
56
|
+
>
|
|
57
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index" :open="open" :close="close">
|
|
58
|
+
{{ item.content }}
|
|
59
|
+
</slot>
|
|
60
|
+
</HDisclosurePanel>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
49
63
|
</Transition>
|
|
50
64
|
</HDisclosure>
|
|
51
65
|
</div>
|
|
@@ -85,6 +99,10 @@ export default defineComponent({
|
|
|
85
99
|
type: String,
|
|
86
100
|
default: () => config.default.openIcon
|
|
87
101
|
},
|
|
102
|
+
unmount: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false
|
|
105
|
+
},
|
|
88
106
|
closeIcon: {
|
|
89
107
|
type: String,
|
|
90
108
|
default: () => config.default.closeIcon
|
|
@@ -14,6 +14,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
14
14
|
type: StringConstructor;
|
|
15
15
|
default: () => any;
|
|
16
16
|
};
|
|
17
|
+
unmount: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
17
21
|
closeIcon: {
|
|
18
22
|
type: StringConstructor;
|
|
19
23
|
default: () => any;
|
|
@@ -59,6 +63,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
63
|
type: StringConstructor;
|
|
60
64
|
default: () => any;
|
|
61
65
|
};
|
|
66
|
+
unmount: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
62
70
|
closeIcon: {
|
|
63
71
|
type: StringConstructor;
|
|
64
72
|
default: () => any;
|
|
@@ -81,6 +89,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
81
89
|
ui: any;
|
|
82
90
|
class: any;
|
|
83
91
|
defaultOpen: boolean;
|
|
92
|
+
unmount: boolean;
|
|
84
93
|
items: AccordionItem[];
|
|
85
94
|
openIcon: string;
|
|
86
95
|
closeIcon: string;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</template>
|
|
57
57
|
|
|
58
58
|
<script>
|
|
59
|
-
import { ref, toRef,
|
|
59
|
+
import { ref, toRef, computed, defineComponent } from "vue";
|
|
60
60
|
import { twMerge } from "tailwind-merge";
|
|
61
61
|
import { mergeConfig } from "../../utils";
|
|
62
62
|
import UButton from "../elements/Button.vue";
|
|
@@ -105,21 +105,27 @@ export default defineComponent({
|
|
|
105
105
|
const { ui, attrs } = useUI("carousel", toRef(props, "ui"), config, toRef(props, "class"));
|
|
106
106
|
const carouselRef = ref();
|
|
107
107
|
const itemWidth = ref(0);
|
|
108
|
-
const { x
|
|
108
|
+
const { x } = useScroll(carouselRef, { behavior: "smooth" });
|
|
109
109
|
const { width: carouselWidth } = useElementSize(carouselRef);
|
|
110
|
-
const { left: isFirst, right: isLast } = toRefs(arrivedState);
|
|
111
110
|
useCarouselScroll(carouselRef);
|
|
112
111
|
useResizeObserver(carouselRef, (entries) => {
|
|
113
112
|
const [entry] = entries;
|
|
114
113
|
itemWidth.value = entry?.target?.firstElementChild?.clientWidth || 0;
|
|
115
114
|
});
|
|
116
|
-
const currentPage = computed(() =>
|
|
115
|
+
const currentPage = computed(() => {
|
|
116
|
+
if (!itemWidth.value) {
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
return Math.round(x.value / itemWidth.value) + 1;
|
|
120
|
+
});
|
|
117
121
|
const pages = computed(() => {
|
|
118
122
|
if (!itemWidth.value) {
|
|
119
123
|
return 0;
|
|
120
124
|
}
|
|
121
125
|
return props.items.length - Math.round(carouselWidth.value / itemWidth.value) + 1;
|
|
122
126
|
});
|
|
127
|
+
const isFirst = computed(() => currentPage.value <= 1);
|
|
128
|
+
const isLast = computed(() => currentPage.value === pages.value);
|
|
123
129
|
function onClickNext() {
|
|
124
130
|
x.value += itemWidth.value;
|
|
125
131
|
}
|
|
@@ -42,8 +42,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
42
42
|
attrs: import("vue").ComputedRef<Pick<{
|
|
43
43
|
[x: string]: unknown;
|
|
44
44
|
}, string>>;
|
|
45
|
-
isFirst: import("vue").
|
|
46
|
-
isLast: import("vue").
|
|
45
|
+
isFirst: import("vue").ComputedRef<boolean>;
|
|
46
|
+
isLast: import("vue").ComputedRef<boolean>;
|
|
47
47
|
carouselRef: import("vue").Ref<HTMLElement | undefined>;
|
|
48
48
|
pages: import("vue").ComputedRef<number>;
|
|
49
49
|
currentPage: import("vue").ComputedRef<number>;
|
|
@@ -165,8 +165,8 @@ export default defineComponent({
|
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
|
-
function onTouchStart() {
|
|
169
|
-
if (!menuApi.value) {
|
|
168
|
+
function onTouchStart(event) {
|
|
169
|
+
if (!event.cancelable || !menuApi.value) {
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
if (menuApi.value.menuState === 0) {
|
|
@@ -68,7 +68,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
68
68
|
paddingLeft: string;
|
|
69
69
|
paddingRight: string;
|
|
70
70
|
}>;
|
|
71
|
-
onTouchStart: () => void;
|
|
71
|
+
onTouchStart: (event: TouchEvent) => void;
|
|
72
72
|
onMouseEnter: () => void;
|
|
73
73
|
onMouseLeave: () => void;
|
|
74
74
|
onClick: (e: any, item: any, { href, navigate, close, isExternal }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<TransitionRoot :appear="appear" :show="isOpen" as="template">
|
|
2
|
+
<TransitionRoot :appear="appear" :show="isOpen" as="template" @after-leave="onAfterLeave">
|
|
3
3
|
<HDialog :class="ui.wrapper" v-bind="attrs" @close="close">
|
|
4
4
|
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition">
|
|
5
5
|
<div :class="[ui.overlay.base, ui.overlay.background]" />
|
|
@@ -77,7 +77,7 @@ export default defineComponent({
|
|
|
77
77
|
default: () => ({})
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
emits: ["update:modelValue", "close", "close-prevented"],
|
|
80
|
+
emits: ["update:modelValue", "close", "close-prevented", "after-leave"],
|
|
81
81
|
setup(props, { emit }) {
|
|
82
82
|
const { ui, attrs } = useUI("modal", toRef(props, "ui"), config, toRef(props, "class"));
|
|
83
83
|
const isOpen = computed({
|
|
@@ -104,6 +104,9 @@ export default defineComponent({
|
|
|
104
104
|
isOpen.value = value;
|
|
105
105
|
emit("close");
|
|
106
106
|
}
|
|
107
|
+
const onAfterLeave = () => {
|
|
108
|
+
emit("after-leave");
|
|
109
|
+
};
|
|
107
110
|
provideUseId(() => useId());
|
|
108
111
|
return {
|
|
109
112
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
@@ -111,6 +114,7 @@ export default defineComponent({
|
|
|
111
114
|
attrs,
|
|
112
115
|
isOpen,
|
|
113
116
|
transitionClass,
|
|
117
|
+
onAfterLeave,
|
|
114
118
|
close
|
|
115
119
|
};
|
|
116
120
|
}
|
|
@@ -39,8 +39,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
39
39
|
}, string>>;
|
|
40
40
|
isOpen: import("vue").WritableComputedRef<boolean>;
|
|
41
41
|
transitionClass: import("vue").ComputedRef<any>;
|
|
42
|
+
onAfterLeave: () => void;
|
|
42
43
|
close: (value: boolean) => void;
|
|
43
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "update:modelValue" | "close-prevented")[], "close" | "update:modelValue" | "close-prevented", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "update:modelValue" | "close-prevented" | "after-leave")[], "close" | "update:modelValue" | "close-prevented" | "after-leave", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
45
|
modelValue: {
|
|
45
46
|
type: BooleanConstructor;
|
|
46
47
|
default: boolean;
|
|
@@ -77,6 +78,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
77
78
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
78
79
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
79
80
|
"onClose-prevented"?: ((...args: any[]) => any) | undefined;
|
|
81
|
+
"onAfter-leave"?: ((...args: any[]) => any) | undefined;
|
|
80
82
|
}, {
|
|
81
83
|
ui: any;
|
|
82
84
|
appear: boolean;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component
|
|
2
|
+
<component
|
|
3
|
+
:is="modalState.component"
|
|
4
|
+
v-if="modalState"
|
|
5
|
+
v-bind="modalState.props"
|
|
6
|
+
v-model="isOpen"
|
|
7
|
+
@after-leave="reset"
|
|
8
|
+
/>
|
|
3
9
|
</template>
|
|
4
10
|
|
|
5
11
|
<script lang="ts" setup>
|
|
@@ -8,5 +14,5 @@ import { useModal, modalInjectionKey } from '../../composables/useModal'
|
|
|
8
14
|
|
|
9
15
|
const modalState = inject(modalInjectionKey)
|
|
10
16
|
|
|
11
|
-
const { isOpen } = useModal()
|
|
17
|
+
const { isOpen, reset } = useModal()
|
|
12
18
|
</script>
|
|
@@ -138,8 +138,8 @@ export default defineComponent({
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
|
-
function onTouchStart() {
|
|
142
|
-
if (!popoverApi.value) {
|
|
141
|
+
function onTouchStart(event) {
|
|
142
|
+
if (!event.cancelable || !popoverApi.value) {
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
if (popoverApi.value.popoverState === 0) {
|
|
@@ -68,7 +68,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
68
68
|
paddingLeft: string;
|
|
69
69
|
paddingRight: string;
|
|
70
70
|
}>;
|
|
71
|
-
onTouchStart: () => void;
|
|
71
|
+
onTouchStart: (event: TouchEvent) => void;
|
|
72
72
|
onMouseEnter: () => void;
|
|
73
73
|
onMouseLeave: () => void;
|
|
74
74
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:open"[], "update:open", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<TransitionRoot as="template" :appear="appear" :show="isOpen">
|
|
2
|
+
<TransitionRoot as="template" :appear="appear" :show="isOpen" @after-leave="onAfterLeave">
|
|
3
3
|
<HDialog :class="[ui.wrapper, { 'justify-end': side === 'right' }]" v-bind="attrs" @close="close">
|
|
4
4
|
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition">
|
|
5
5
|
<div :class="[ui.overlay.base, ui.overlay.background]" />
|
|
@@ -66,7 +66,7 @@ export default defineComponent({
|
|
|
66
66
|
default: () => ({})
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
emits: ["update:modelValue", "close", "close-prevented"],
|
|
69
|
+
emits: ["update:modelValue", "close", "close-prevented", "after-leave"],
|
|
70
70
|
setup(props, { emit }) {
|
|
71
71
|
const { ui, attrs } = useUI("slideover", toRef(props, "ui"), config, toRef(props, "class"));
|
|
72
72
|
const isOpen = computed({
|
|
@@ -97,6 +97,9 @@ export default defineComponent({
|
|
|
97
97
|
isOpen.value = value;
|
|
98
98
|
emit("close");
|
|
99
99
|
}
|
|
100
|
+
const onAfterLeave = () => {
|
|
101
|
+
emit("after-leave");
|
|
102
|
+
};
|
|
100
103
|
provideUseId(() => useId());
|
|
101
104
|
return {
|
|
102
105
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
@@ -104,6 +107,7 @@ export default defineComponent({
|
|
|
104
107
|
attrs,
|
|
105
108
|
isOpen,
|
|
106
109
|
transitionClass,
|
|
110
|
+
onAfterLeave,
|
|
107
111
|
close
|
|
108
112
|
};
|
|
109
113
|
}
|
|
@@ -40,8 +40,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
40
40
|
}, string>>;
|
|
41
41
|
isOpen: WritableComputedRef<boolean>;
|
|
42
42
|
transitionClass: import("vue").ComputedRef<any>;
|
|
43
|
+
onAfterLeave: () => void;
|
|
43
44
|
close: (value: boolean) => void;
|
|
44
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "update:modelValue" | "close-prevented")[], "close" | "update:modelValue" | "close-prevented", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "update:modelValue" | "close-prevented" | "after-leave")[], "close" | "update:modelValue" | "close-prevented" | "after-leave", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
46
|
modelValue: {
|
|
46
47
|
type: PropType<boolean>;
|
|
47
48
|
default: boolean;
|
|
@@ -79,6 +80,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
79
80
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
80
81
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
81
82
|
"onClose-prevented"?: ((...args: any[]) => any) | undefined;
|
|
83
|
+
"onAfter-leave"?: ((...args: any[]) => any) | undefined;
|
|
82
84
|
}, {
|
|
83
85
|
ui: any;
|
|
84
86
|
appear: boolean;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
v-if="slideoverState"
|
|
5
5
|
v-bind="slideoverState.props"
|
|
6
6
|
v-model="isOpen"
|
|
7
|
+
@after-leave="reset"
|
|
7
8
|
/>
|
|
8
9
|
</template>
|
|
9
10
|
|
|
@@ -13,5 +14,5 @@ import { useSlideover, slidOverInjectionKey } from '../../composables/useSlideov
|
|
|
13
14
|
|
|
14
15
|
const slideoverState = inject(slidOverInjectionKey)
|
|
15
16
|
|
|
16
|
-
const { isOpen } = useSlideover()
|
|
17
|
+
const { isOpen, reset } = useSlideover()
|
|
17
18
|
</script>
|
|
@@ -3,10 +3,11 @@ import type { ComponentProps } from '../types/component';
|
|
|
3
3
|
import type { Modal, ModalState } from '../types/modal';
|
|
4
4
|
export declare const modalInjectionKey: InjectionKey<ShallowRef<ModalState>>;
|
|
5
5
|
declare function _useModal(): {
|
|
6
|
-
isOpen: import("vue").Ref<boolean>;
|
|
7
6
|
open: <T extends Component>(component: T, props?: Modal & ComponentProps<T>) => void;
|
|
8
|
-
close: () => void
|
|
7
|
+
close: () => Promise<void>;
|
|
8
|
+
reset: () => void;
|
|
9
9
|
patch: <T_1 extends Component = {}>(props: Partial<Modal & ComponentProps<T_1>>) => void;
|
|
10
|
+
isOpen: import("vue").Ref<boolean>;
|
|
10
11
|
};
|
|
11
12
|
export declare const useModal: typeof _useModal;
|
|
12
13
|
export {};
|
|
@@ -5,20 +5,29 @@ function _useModal() {
|
|
|
5
5
|
const modalState = inject(modalInjectionKey);
|
|
6
6
|
const isOpen = ref(false);
|
|
7
7
|
function open(component, props) {
|
|
8
|
+
if (!modalState) {
|
|
9
|
+
throw new Error("useModal() is called without provider");
|
|
10
|
+
}
|
|
8
11
|
modalState.value = {
|
|
9
12
|
component,
|
|
10
13
|
props: props ?? {}
|
|
11
14
|
};
|
|
12
15
|
isOpen.value = true;
|
|
13
16
|
}
|
|
14
|
-
function close() {
|
|
17
|
+
async function close() {
|
|
18
|
+
if (!modalState)
|
|
19
|
+
return;
|
|
15
20
|
isOpen.value = false;
|
|
21
|
+
}
|
|
22
|
+
function reset() {
|
|
16
23
|
modalState.value = {
|
|
17
24
|
component: "div",
|
|
18
25
|
props: {}
|
|
19
26
|
};
|
|
20
27
|
}
|
|
21
28
|
function patch(props) {
|
|
29
|
+
if (!modalState)
|
|
30
|
+
return;
|
|
22
31
|
modalState.value = {
|
|
23
32
|
...modalState.value,
|
|
24
33
|
props: {
|
|
@@ -28,10 +37,11 @@ function _useModal() {
|
|
|
28
37
|
};
|
|
29
38
|
}
|
|
30
39
|
return {
|
|
31
|
-
isOpen,
|
|
32
40
|
open,
|
|
33
41
|
close,
|
|
34
|
-
|
|
42
|
+
reset,
|
|
43
|
+
patch,
|
|
44
|
+
isOpen
|
|
35
45
|
};
|
|
36
46
|
}
|
|
37
47
|
export const useModal = createSharedComposable(_useModal);
|
|
@@ -4,7 +4,8 @@ import type { Slideover, SlideoverState } from '../types/slideover';
|
|
|
4
4
|
export declare const slidOverInjectionKey: InjectionKey<ShallowRef<SlideoverState>>;
|
|
5
5
|
declare function _useSlideover(): {
|
|
6
6
|
open: <T extends Component>(component: T, props?: Slideover & ComponentProps<T>) => void;
|
|
7
|
-
close: () => void
|
|
7
|
+
close: () => Promise<void>;
|
|
8
|
+
reset: () => void;
|
|
8
9
|
patch: <T_1 extends Component = {}>(props: Partial<Slideover & ComponentProps<T_1>>) => void;
|
|
9
10
|
isOpen: import("vue").Ref<boolean>;
|
|
10
11
|
};
|
|
@@ -14,11 +14,17 @@ function _useSlideover() {
|
|
|
14
14
|
};
|
|
15
15
|
isOpen.value = true;
|
|
16
16
|
}
|
|
17
|
-
function close() {
|
|
17
|
+
async function close() {
|
|
18
18
|
if (!slideoverState)
|
|
19
19
|
return;
|
|
20
20
|
isOpen.value = false;
|
|
21
21
|
}
|
|
22
|
+
function reset() {
|
|
23
|
+
slideoverState.value = {
|
|
24
|
+
component: "div",
|
|
25
|
+
props: {}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
22
28
|
function patch(props) {
|
|
23
29
|
if (!slideoverState)
|
|
24
30
|
return;
|
|
@@ -33,6 +39,7 @@ function _useSlideover() {
|
|
|
33
39
|
return {
|
|
34
40
|
open,
|
|
35
41
|
close,
|
|
42
|
+
reset,
|
|
36
43
|
patch,
|
|
37
44
|
isOpen
|
|
38
45
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
wrapper: "relative",
|
|
2
|
+
wrapper: "relative min-w-0",
|
|
3
3
|
ol: "flex items-center gap-x-1.5",
|
|
4
4
|
li: "flex items-center gap-x-1.5 text-gray-500 dark:text-gray-400 text-sm leading-6 min-w-0",
|
|
5
5
|
base: "flex items-center gap-x-1.5 group font-semibold min-w-0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/ui",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.2",
|
|
4
4
|
"repository": "nuxt/ui",
|
|
5
5
|
"homepage": "https://ui.nuxt.com",
|
|
6
6
|
"type": "module",
|
|
@@ -37,8 +37,8 @@
|
|
|
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.11.
|
|
41
|
-
"@nuxtjs/color-mode": "^3.
|
|
40
|
+
"@nuxt/kit": "^3.11.2",
|
|
41
|
+
"@nuxtjs/color-mode": "^3.4.0",
|
|
42
42
|
"@nuxtjs/tailwindcss": "^6.11.4",
|
|
43
43
|
"@popperjs/core": "^2.11.8",
|
|
44
44
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
@@ -58,28 +58,28 @@
|
|
|
58
58
|
"tailwindcss": "^3.4.3"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@nuxt/eslint-config": "^0.
|
|
61
|
+
"@nuxt/eslint-config": "^0.3.6",
|
|
62
62
|
"@nuxt/module-builder": "^0.5.5",
|
|
63
63
|
"@nuxt/test-utils": "^3.12.0",
|
|
64
64
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
65
65
|
"@vue/test-utils": "^2.4.5",
|
|
66
66
|
"eslint": "^8.57.0",
|
|
67
|
-
"happy-dom": "^14.
|
|
68
|
-
"joi": "^17.12.
|
|
69
|
-
"nuxt": "^3.11.
|
|
70
|
-
"release-it": "^17.
|
|
71
|
-
"typescript": "^5.4.
|
|
67
|
+
"happy-dom": "^14.7.1",
|
|
68
|
+
"joi": "^17.12.3",
|
|
69
|
+
"nuxt": "^3.11.2",
|
|
70
|
+
"release-it": "^17.2.0",
|
|
71
|
+
"typescript": "^5.4.5",
|
|
72
72
|
"unbuild": "^2.0.0",
|
|
73
73
|
"valibot": "^0.30.0",
|
|
74
|
-
"vitest": "^1.
|
|
74
|
+
"vitest": "^1.5.0",
|
|
75
75
|
"vitest-environment-nuxt": "^1.0.0",
|
|
76
|
-
"vue-tsc": "^2.0.
|
|
76
|
+
"vue-tsc": "^2.0.13",
|
|
77
77
|
"yup": "^1.4.0",
|
|
78
78
|
"zod": "^3.22.4"
|
|
79
79
|
},
|
|
80
80
|
"resolutions": {
|
|
81
|
-
"@nuxt/kit": "^3.11.
|
|
82
|
-
"@nuxt/schema": "3.11.
|
|
81
|
+
"@nuxt/kit": "^3.11.2",
|
|
82
|
+
"@nuxt/schema": "3.11.2",
|
|
83
83
|
"tailwindcss": "^3.4.3",
|
|
84
84
|
"@headlessui/vue": "1.7.19",
|
|
85
85
|
"vue": "3.4.21"
|