vueless 1.4.4 → 1.4.5
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
5
5
|
"author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@vue/eslint-config-typescript": "^14.6.0",
|
|
58
58
|
"@vue/test-utils": "^2.4.6",
|
|
59
59
|
"@vue/tsconfig": "^0.7.0",
|
|
60
|
-
"@vueless/storybook": "^1.
|
|
60
|
+
"@vueless/storybook": "^1.5.2",
|
|
61
61
|
"eslint": "^9.32.0",
|
|
62
62
|
"eslint-plugin-storybook": "^10.0.2",
|
|
63
63
|
"eslint-plugin-vue": "^10.3.0",
|
package/ui.form-input/UInput.vue
CHANGED
|
@@ -290,6 +290,14 @@ const {
|
|
|
290
290
|
<slot name="label" :label="label" />
|
|
291
291
|
</template>
|
|
292
292
|
|
|
293
|
+
<template #description>
|
|
294
|
+
<!--
|
|
295
|
+
@slot Use this to add custom content instead of the description.
|
|
296
|
+
@binding {string} description
|
|
297
|
+
-->
|
|
298
|
+
<slot name="description" :description="description" />
|
|
299
|
+
</template>
|
|
300
|
+
|
|
293
301
|
<div ref="wrapper" v-bind="wrapperAttrs">
|
|
294
302
|
<span
|
|
295
303
|
v-if="hasSlotContent($slots['left'], { iconName: leftIcon }) || leftIcon"
|
|
@@ -341,6 +341,24 @@ describe("UInput.vue", () => {
|
|
|
341
341
|
expect(labelElement.text()).toBe(`Modified ${defaultLabel}`);
|
|
342
342
|
});
|
|
343
343
|
|
|
344
|
+
it("Description – renders custom content from description slot", () => {
|
|
345
|
+
const customDescription = "Custom description content";
|
|
346
|
+
|
|
347
|
+
const component = mount(UInput, {
|
|
348
|
+
props: {
|
|
349
|
+
description: "Default description",
|
|
350
|
+
},
|
|
351
|
+
slots: {
|
|
352
|
+
description: customDescription,
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
const labelComponent = component.getComponent(ULabel);
|
|
357
|
+
const descriptionElement = labelComponent.find("[vl-child-key='description']");
|
|
358
|
+
|
|
359
|
+
expect(descriptionElement.text()).toBe(customDescription);
|
|
360
|
+
});
|
|
361
|
+
|
|
344
362
|
it("Left – renders custom content from left slot", () => {
|
|
345
363
|
const slotText = "Custom Left Content";
|
|
346
364
|
const slotClass = "custom-left";
|
package/ui.form-label/ULabel.vue
CHANGED
|
@@ -80,6 +80,9 @@ defineExpose({
|
|
|
80
80
|
const mutatedProps = computed(() => ({
|
|
81
81
|
error: Boolean(props.error) && !props.disabled,
|
|
82
82
|
label: Boolean(props.label) || hasSlotContent(slots["label"], { label: props.label }),
|
|
83
|
+
description:
|
|
84
|
+
Boolean(props.description) ||
|
|
85
|
+
hasSlotContent(slots["description"], { description: props.description }),
|
|
83
86
|
for: Boolean(props.for),
|
|
84
87
|
}));
|
|
85
88
|
|
|
@@ -100,7 +103,15 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
|
|
|
100
103
|
</div>
|
|
101
104
|
|
|
102
105
|
<!-- `v-bind` isn't assigned, because the div is system -->
|
|
103
|
-
<div
|
|
106
|
+
<div
|
|
107
|
+
v-if="
|
|
108
|
+
label ||
|
|
109
|
+
hasSlotContent(slots['label'], { label }) ||
|
|
110
|
+
error ||
|
|
111
|
+
description ||
|
|
112
|
+
hasSlotContent(slots['description'], { description })
|
|
113
|
+
"
|
|
114
|
+
>
|
|
104
115
|
<component
|
|
105
116
|
:is="tag"
|
|
106
117
|
v-if="label || hasSlotContent(slots['label'], { label })"
|
|
@@ -128,11 +139,20 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
|
|
|
128
139
|
/>
|
|
129
140
|
|
|
130
141
|
<div
|
|
131
|
-
v-if="
|
|
142
|
+
v-if="
|
|
143
|
+
(description || hasSlotContent(slots['description'], { description })) && !isShownError
|
|
144
|
+
"
|
|
132
145
|
v-bind="descriptionAttrs"
|
|
133
146
|
:data-test="getDataTest('description')"
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
>
|
|
148
|
+
<!--
|
|
149
|
+
@slot Use this to add custom content instead of the description.
|
|
150
|
+
@binding {string} description
|
|
151
|
+
-->
|
|
152
|
+
<slot name="description" :description="description">
|
|
153
|
+
{{ description }}
|
|
154
|
+
</slot>
|
|
155
|
+
</div>
|
|
136
156
|
|
|
137
157
|
<!-- @slot Use it to add something below the label content. -->
|
|
138
158
|
<slot name="bottom" />
|
|
@@ -167,11 +187,18 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
|
|
|
167
187
|
<div v-if="isShownError" v-bind="errorAttrs" :data-test="getDataTest('error')" v-text="error" />
|
|
168
188
|
|
|
169
189
|
<div
|
|
170
|
-
v-if="description && !isShownError"
|
|
190
|
+
v-if="(description || hasSlotContent(slots['description'], { description })) && !isShownError"
|
|
171
191
|
v-bind="descriptionAttrs"
|
|
172
192
|
:data-test="getDataTest('description')"
|
|
173
|
-
|
|
174
|
-
|
|
193
|
+
>
|
|
194
|
+
<!--
|
|
195
|
+
@slot Use this to add custom content instead of the description.
|
|
196
|
+
@binding {string} description
|
|
197
|
+
-->
|
|
198
|
+
<slot name="description" :description="description">
|
|
199
|
+
{{ description }}
|
|
200
|
+
</slot>
|
|
201
|
+
</div>
|
|
175
202
|
|
|
176
203
|
<!-- @slot Use it to add something below the label content. -->
|
|
177
204
|
<slot name="bottom" />
|
|
@@ -302,6 +302,25 @@ describe("ULabel.vue", () => {
|
|
|
302
302
|
expect(labelElement.text()).not.toContain(defaultLabel);
|
|
303
303
|
});
|
|
304
304
|
|
|
305
|
+
it("Description – renders content from description slot", () => {
|
|
306
|
+
const slotContent = "Custom description";
|
|
307
|
+
const defaultDescription = "Default description";
|
|
308
|
+
|
|
309
|
+
const component = mount(ULabel, {
|
|
310
|
+
props: {
|
|
311
|
+
description: defaultDescription,
|
|
312
|
+
},
|
|
313
|
+
slots: {
|
|
314
|
+
description: slotContent,
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
const descriptionElement = component.find("[vl-key='description']");
|
|
319
|
+
|
|
320
|
+
expect(descriptionElement.text()).toBe(slotContent);
|
|
321
|
+
expect(descriptionElement.text()).not.toContain(defaultDescription);
|
|
322
|
+
});
|
|
323
|
+
|
|
305
324
|
it("Label – exposes label content", () => {
|
|
306
325
|
const defaultLabel = "Label Content";
|
|
307
326
|
const slotContent = "Modified Label Content";
|