vueless 1.0.2-beta.51 → 1.0.2-beta.52
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/package.json +1 -1
- package/ui.container-col/UCol.vue +4 -4
- package/ui.container-col/config.ts +1 -0
- package/ui.container-col/tests/UCol.test.ts +15 -0
- package/ui.container-col/types.ts +5 -0
- package/ui.container-modal/UModal.vue +16 -3
- package/ui.container-modal/config.ts +9 -1
- package/ui.container-row/URow.vue +4 -4
- package/ui.container-row/config.ts +1 -0
- package/ui.container-row/tests/URow.test.ts +15 -0
- package/ui.container-row/types.ts +5 -0
package/package.json
CHANGED
|
@@ -14,12 +14,12 @@ withDefaults(defineProps<Props>(), {
|
|
|
14
14
|
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
const wrapperRef = useTemplateRef<
|
|
17
|
+
const wrapperRef = useTemplateRef<HTMLElement>("wrapper");
|
|
18
18
|
|
|
19
19
|
defineExpose({
|
|
20
20
|
/**
|
|
21
21
|
* A reference to the component's wrapper element for direct DOM manipulation.
|
|
22
|
-
* @property {
|
|
22
|
+
* @property {HTMLElement}
|
|
23
23
|
*/
|
|
24
24
|
wrapperRef,
|
|
25
25
|
});
|
|
@@ -33,8 +33,8 @@ const { getDataTest, wrapperAttrs } = useUI<Config>(defaultConfig);
|
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
<template>
|
|
36
|
-
<
|
|
36
|
+
<component :is="tag" ref="wrapper" v-bind="wrapperAttrs" :data-test="getDataTest()">
|
|
37
37
|
<!-- @slot Use it to add something inside. -->
|
|
38
38
|
<slot />
|
|
39
|
-
</
|
|
39
|
+
</component>
|
|
40
40
|
</template>
|
|
@@ -148,6 +148,21 @@ describe("UCol.vue", () => {
|
|
|
148
148
|
expect(component.attributes("class")).toContain(expectedClasses);
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
+
// Tag prop
|
|
152
|
+
it("renders the correct HTML tag", () => {
|
|
153
|
+
const tags = ["div", "section", "article", "main", "aside", "nav", "span"];
|
|
154
|
+
|
|
155
|
+
tags.forEach((tag) => {
|
|
156
|
+
const component = mount(UCol, {
|
|
157
|
+
props: {
|
|
158
|
+
tag,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
expect(component.element.tagName.toLowerCase()).toBe(tag);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
151
166
|
// DataTest prop
|
|
152
167
|
it("applies the correct data-test attribute", () => {
|
|
153
168
|
const dataTest = "col-test";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, useSlots, watch, useId, useTemplateRef, nextTick } from "vue";
|
|
2
|
+
import { computed, useSlots, watch, useId, useTemplateRef, nextTick, ref } from "vue";
|
|
3
3
|
|
|
4
4
|
import useUI from "../composables/useUI.ts";
|
|
5
5
|
import { getDefaults } from "../utils/ui.ts";
|
|
@@ -48,6 +48,8 @@ const slots = useSlots();
|
|
|
48
48
|
|
|
49
49
|
const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
|
|
50
50
|
|
|
51
|
+
const isWrapperTransitionComplete = ref(false);
|
|
52
|
+
|
|
51
53
|
const isShownModal = computed({
|
|
52
54
|
get: () => props.modelValue,
|
|
53
55
|
set: (value) => emit("update:modelValue", value),
|
|
@@ -114,6 +116,8 @@ function onChangeShownModal(newValue: boolean) {
|
|
|
114
116
|
|
|
115
117
|
if (newValue) {
|
|
116
118
|
nextTick(() => wrapperRef.value?.focus());
|
|
119
|
+
} else {
|
|
120
|
+
isWrapperTransitionComplete.value = false;
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
|
|
@@ -173,6 +177,11 @@ defineExpose({
|
|
|
173
177
|
* Get element / nested component attributes for each config token ✨
|
|
174
178
|
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
175
179
|
*/
|
|
180
|
+
const mutatedProps = computed(() => ({
|
|
181
|
+
/* component state, not a props */
|
|
182
|
+
wrapperTransitionCompleted: isWrapperTransitionComplete.value,
|
|
183
|
+
}));
|
|
184
|
+
|
|
176
185
|
const {
|
|
177
186
|
getDataTest,
|
|
178
187
|
config,
|
|
@@ -194,7 +203,7 @@ const {
|
|
|
194
203
|
closeButtonAttrs,
|
|
195
204
|
beforeTitleAttrs,
|
|
196
205
|
titleFallbackAttrs,
|
|
197
|
-
} = useUI<Config>(defaultConfig);
|
|
206
|
+
} = useUI<Config>(defaultConfig, mutatedProps);
|
|
198
207
|
</script>
|
|
199
208
|
|
|
200
209
|
<template>
|
|
@@ -202,7 +211,11 @@ const {
|
|
|
202
211
|
<div v-if="isShownModal" v-bind="overlayAttrs" />
|
|
203
212
|
</Transition>
|
|
204
213
|
|
|
205
|
-
<Transition
|
|
214
|
+
<Transition
|
|
215
|
+
v-bind="config.wrapperTransition"
|
|
216
|
+
@after-enter="isWrapperTransitionComplete = true"
|
|
217
|
+
@leave="isWrapperTransitionComplete = false"
|
|
218
|
+
>
|
|
206
219
|
<div
|
|
207
220
|
v-if="isShownModal"
|
|
208
221
|
:id="elementId"
|
|
@@ -17,7 +17,15 @@ export default /*tw*/ {
|
|
|
17
17
|
leaveFromClass: "opacity-100",
|
|
18
18
|
leaveToClass: "opacity-0",
|
|
19
19
|
},
|
|
20
|
-
innerWrapper:
|
|
20
|
+
innerWrapper: {
|
|
21
|
+
base: "py-12 w-full h-screen scroll-container [scrollbar-gutter:stable]",
|
|
22
|
+
variants: {
|
|
23
|
+
wrapperTransitionCompleted: {
|
|
24
|
+
true: "overflow-y-auto",
|
|
25
|
+
false: "overflow-y-hidden",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
21
29
|
header: "flex justify-between px-4 md:px-6 py-6",
|
|
22
30
|
beforeTitle: "flex items-center gap-3",
|
|
23
31
|
titleFallback: "flex flex-col",
|
|
@@ -15,12 +15,12 @@ withDefaults(defineProps<Props>(), {
|
|
|
15
15
|
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
const wrapperRef = useTemplateRef<
|
|
18
|
+
const wrapperRef = useTemplateRef<HTMLElement>("wrapper");
|
|
19
19
|
|
|
20
20
|
defineExpose({
|
|
21
21
|
/**
|
|
22
22
|
* A reference to the component's wrapper element for direct DOM manipulation.
|
|
23
|
-
* @property {
|
|
23
|
+
* @property {HTMLElement}
|
|
24
24
|
*/
|
|
25
25
|
wrapperRef,
|
|
26
26
|
});
|
|
@@ -33,8 +33,8 @@ const { getDataTest, wrapperAttrs } = useUI<Config>(defaultConfig);
|
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
<template>
|
|
36
|
-
<
|
|
36
|
+
<component :is="tag" ref="wrapper" v-bind="wrapperAttrs" :data-test="getDataTest()">
|
|
37
37
|
<!-- @slot Use it to add something inside. -->
|
|
38
38
|
<slot />
|
|
39
|
-
</
|
|
39
|
+
</component>
|
|
40
40
|
</template>
|
|
@@ -146,6 +146,21 @@ describe("URow.vue", () => {
|
|
|
146
146
|
expect(component.attributes("class")).toContain(expectedClasses);
|
|
147
147
|
});
|
|
148
148
|
|
|
149
|
+
// Tag prop
|
|
150
|
+
it("renders the correct HTML tag", () => {
|
|
151
|
+
const tags = ["div", "section", "article", "main", "aside", "nav", "span"];
|
|
152
|
+
|
|
153
|
+
tags.forEach((tag) => {
|
|
154
|
+
const component = mount(URow, {
|
|
155
|
+
props: {
|
|
156
|
+
tag,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
expect(component.element.tagName.toLowerCase()).toBe(tag);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
149
164
|
// DataTest prop
|
|
150
165
|
it("applies the correct data-test attribute", () => {
|
|
151
166
|
const dataTest = "test-row";
|