vueless 1.4.6-beta.1 → 1.4.6

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.
Files changed (31) hide show
  1. package/icons/internal/home.svg +0 -1
  2. package/icons/storybook/keep.svg +0 -1
  3. package/package.json +1 -1
  4. package/ui.form-checkbox/UCheckbox.vue +0 -8
  5. package/ui.form-checkbox/tests/UCheckbox.test.ts +0 -18
  6. package/ui.form-checkbox-group/UCheckboxGroup.vue +0 -8
  7. package/ui.form-checkbox-group/tests/UCheckboxGroup.test.ts +0 -18
  8. package/ui.form-date-picker/UDatePicker.vue +0 -8
  9. package/ui.form-date-picker/tests/UDatePicker.test.ts +0 -19
  10. package/ui.form-date-picker-range/UDatePickerRange.vue +0 -8
  11. package/ui.form-date-picker-range/tests/UDatePickerRange.test.ts +0 -20
  12. package/ui.form-input/UInput.vue +0 -8
  13. package/ui.form-input/tests/UInput.test.ts +0 -18
  14. package/ui.form-input-file/UInputFile.vue +0 -8
  15. package/ui.form-input-file/tests/UInputFile.test.ts +0 -18
  16. package/ui.form-input-number/UInputNumber.vue +0 -8
  17. package/ui.form-input-number/tests/UInputNumber.test.ts +0 -18
  18. package/ui.form-input-password/UInputPassword.vue +0 -8
  19. package/ui.form-input-password/tests/UInputPassword.test.ts +0 -18
  20. package/ui.form-input-search/UInputSearch.vue +0 -8
  21. package/ui.form-input-search/tests/UInputSearch.test.ts +0 -18
  22. package/ui.form-label/ULabel.vue +14 -30
  23. package/ui.form-label/tests/ULabel.test.ts +0 -19
  24. package/ui.form-radio/URadio.vue +0 -8
  25. package/ui.form-radio/tests/URadio.test.ts +0 -18
  26. package/ui.form-radio-group/URadioGroup.vue +0 -8
  27. package/ui.form-radio-group/tests/URadioGroup.test.ts +0 -19
  28. package/ui.form-select/USelect.vue +0 -8
  29. package/ui.form-select/tests/USelect.test.ts +0 -19
  30. package/ui.form-textarea/UTextarea.vue +0 -8
  31. package/ui.form-textarea/tests/UTextarea.test.ts +0 -18
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M222.15-182.15h143.78v-251.92h228.14v251.92h143.78v-386.89L480-762.37 222.15-568.96v386.81Zm-68.13 68.13v-489.09L480-847.65l326.22 244.54v489.09H528.57v-254.55h-97.14v254.55H154.02ZM480-472.76Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m640.22-454.22 86 77v68.37H514.07v240.28L480-34.5l-34.07-34.07v-240.28H234.02v-68.37l80-77v-327.45h-50v-68.13h426.2v68.13h-50v327.45Zm-313.96 77h301.48l-55.89-51.89v-352.56h-189.7v352.56l-55.89 51.89Zm150.74 0Z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "1.4.6-beta.1",
3
+ "version": "1.4.6",
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",
@@ -173,14 +173,6 @@ const {
173
173
  <slot name="description" :description="description" />
174
174
  </template>
175
175
 
176
- <template #error>
177
- <!--
178
- @slot Use this to add custom content instead of the error message.
179
- @binding {string | boolean} error
180
- -->
181
- <slot name="error" :error="error" />
182
- </template>
183
-
184
176
  <input
185
177
  :id="elementId"
186
178
  type="checkbox"
@@ -302,24 +302,6 @@ describe("UCheckbox.vue", () => {
302
302
  expect(descriptionElement.text()).toBe(customDescription);
303
303
  });
304
304
 
305
- it("Error – renders custom content from error slot", () => {
306
- const customError = "Custom error content";
307
-
308
- const component = mount(UCheckbox, {
309
- props: {
310
- error: "Default error message",
311
- },
312
- slots: {
313
- error: customError,
314
- },
315
- });
316
-
317
- const labelComponent = component.getComponent(ULabel);
318
- const errorElement = labelComponent.find("[vl-child-key='error']");
319
-
320
- expect(errorElement.text()).toBe(customError);
321
- });
322
-
323
305
  it("Bottom – renders custom content from bottom slot", () => {
324
306
  const customBottomContent = "Custom Bottom Content";
325
307
 
@@ -104,14 +104,6 @@ const { getDataTest, groupLabelAttrs, groupCheckboxAttrs, listAttrs } =
104
104
  <slot name="description" :description="description" />
105
105
  </template>
106
106
 
107
- <template #error>
108
- <!--
109
- @slot Use this to add custom content instead of the error message.
110
- @binding {string | boolean} error
111
- -->
112
- <slot name="error" :error="error" />
113
- </template>
114
-
115
107
  <div ref="list" v-bind="listAttrs">
116
108
  <!-- @slot Use it to add UCheckbox directly. -->
117
109
  <slot>
@@ -307,24 +307,6 @@ describe("UCheckboxGroup.vue", () => {
307
307
  expect(descriptionElement.text()).toBe(customDescription);
308
308
  });
309
309
 
310
- it("Error – renders custom content from error slot", () => {
311
- const customError = "Custom error content";
312
-
313
- const component = mount(UCheckboxGroup, {
314
- props: {
315
- error: "Default error message",
316
- },
317
- slots: {
318
- error: customError,
319
- },
320
- });
321
-
322
- const labelComponent = component.getComponent(ULabel);
323
- const errorElement = labelComponent.find("[vl-child-key='error']");
324
-
325
- expect(errorElement.text()).toBe(customError);
326
- });
327
-
328
310
  it("Default slot – renders custom UCheckbox components", () => {
329
311
  const component = mount(UCheckboxGroup, {
330
312
  props: {
@@ -312,14 +312,6 @@ watchEffect(() => {
312
312
  <slot name="description" :description="description" />
313
313
  </template>
314
314
 
315
- <template #error>
316
- <!--
317
- @slot Use this to add custom content instead of the error message.
318
- @binding {string | boolean} error
319
- -->
320
- <slot name="error" :error="error" />
321
- </template>
322
-
323
315
  <template #left="{ iconName }">
324
316
  <!--
325
317
  @slot Use it add something before the date.
@@ -496,25 +496,6 @@ describe("UDatePicker.vue", () => {
496
496
 
497
497
  expect(descriptionElement.text()).toBe(customDescription);
498
498
  });
499
-
500
- it("Error – renders custom content from error slot", () => {
501
- const customError = "Custom error content";
502
-
503
- const component = mount(UDatePicker, {
504
- props: {
505
- modelValue: new Date(),
506
- error: "Default error message",
507
- },
508
- slots: {
509
- error: customError,
510
- },
511
- });
512
-
513
- const labelComponent = component.getComponent(UInput).getComponent(ULabel);
514
- const errorElement = labelComponent.find("[vl-child-key='error']");
515
-
516
- expect(errorElement.text()).toBe(customError);
517
- });
518
499
  });
519
500
 
520
501
  describe("Exposed Properties", () => {
@@ -647,14 +647,6 @@ watchEffect(() => {
647
647
  <slot name="description" :description="description" />
648
648
  </template>
649
649
 
650
- <template #error>
651
- <!--
652
- @slot Use this to add custom content instead of the error message.
653
- @binding {string | boolean} error
654
- -->
655
- <slot name="error" :error="error" />
656
- </template>
657
-
658
650
  <template #left="{ iconName }">
659
651
  <!--
660
652
  @slot Use it to add something before the date.
@@ -604,26 +604,6 @@ describe("UDatePickerRange.vue", () => {
604
604
 
605
605
  expect(descriptionElement.text()).toBe(customDescription);
606
606
  });
607
-
608
- it("Error – renders custom content from error slot", () => {
609
- const customError = "Custom error content";
610
-
611
- const component = mount(UDatePickerRange, {
612
- props: {
613
- variant: "input",
614
- modelValue: { from: null, to: null },
615
- error: "Default error message",
616
- },
617
- slots: {
618
- error: customError,
619
- },
620
- });
621
-
622
- const labelComponent = component.getComponent(UInput).getComponent(ULabel);
623
- const errorElement = labelComponent.find("[vl-child-key='error']");
624
-
625
- expect(errorElement.text()).toBe(customError);
626
- });
627
607
  });
628
608
 
629
609
  describe("Events", () => {
@@ -298,14 +298,6 @@ const {
298
298
  <slot name="description" :description="description" />
299
299
  </template>
300
300
 
301
- <template #error>
302
- <!--
303
- @slot Use this to add custom content instead of the error message.
304
- @binding {string | boolean} error
305
- -->
306
- <slot name="error" :error="error" />
307
- </template>
308
-
309
301
  <div ref="wrapper" v-bind="wrapperAttrs">
310
302
  <span
311
303
  v-if="hasSlotContent($slots['left'], { iconName: leftIcon }) || leftIcon"
@@ -359,24 +359,6 @@ describe("UInput.vue", () => {
359
359
  expect(descriptionElement.text()).toBe(customDescription);
360
360
  });
361
361
 
362
- it("Error – renders custom content from error slot", () => {
363
- const customError = "Custom error content";
364
-
365
- const component = mount(UInput, {
366
- props: {
367
- error: "Default error message",
368
- },
369
- slots: {
370
- error: customError,
371
- },
372
- });
373
-
374
- const labelComponent = component.getComponent(ULabel);
375
- const errorElement = labelComponent.find("[vl-child-key='error']");
376
-
377
- expect(errorElement.text()).toBe(customError);
378
- });
379
-
380
362
  it("Left – renders custom content from left slot", () => {
381
363
  const slotText = "Custom Left Content";
382
364
  const slotClass = "custom-left";
@@ -321,14 +321,6 @@ const {
321
321
  <slot name="description" :description="description" />
322
322
  </template>
323
323
 
324
- <template #error>
325
- <!--
326
- @slot Use this to add custom content instead of the error message.
327
- @binding {string | boolean} error
328
- -->
329
- <slot name="error" :error="currentError" />
330
- </template>
331
-
332
324
  <div ref="dropZone" :ondrop="onDrop" v-bind="dropzoneAttrs">
333
325
  <UText v-if="hasSlotContent($slots['top'])" :size="size" v-bind="descriptionTopAttrs">
334
326
  <!-- @slot Use it to add something above the component content. -->
@@ -310,24 +310,6 @@ describe("UInputFile.vue", () => {
310
310
  expect(descriptionElement.text()).toBe(customDescription);
311
311
  });
312
312
 
313
- it("Error – renders custom content from error slot", () => {
314
- const customError = "Custom error content";
315
-
316
- const component = mount(UInputFile, {
317
- props: {
318
- error: "Default error message",
319
- },
320
- slots: {
321
- error: customError,
322
- },
323
- });
324
-
325
- const labelComponent = component.getComponent(ULabel);
326
- const errorElement = labelComponent.find("[vl-child-key='error']");
327
-
328
- expect(errorElement.text()).toBe(customError);
329
- });
330
-
331
313
  it("Top – renders custom content from top slot", () => {
332
314
  const testClass = "custom-top";
333
315
 
@@ -187,14 +187,6 @@ const { getDataTest, numberInputAttrs } = useUI<Config>(defaultConfig);
187
187
  <slot name="description" :description="description" />
188
188
  </template>
189
189
 
190
- <template #error>
191
- <!--
192
- @slot Use this to add custom content instead of the error message.
193
- @binding {string | boolean} error
194
- -->
195
- <slot name="error" :error="error" />
196
- </template>
197
-
198
190
  <template #left>
199
191
  <!--
200
192
  @slot Use it to add something left.
@@ -431,24 +431,6 @@ describe("UInputNumber.vue", () => {
431
431
 
432
432
  expect(descriptionElement.text()).toBe(customDescription);
433
433
  });
434
-
435
- it("Error – renders custom content from error slot", () => {
436
- const customError = "Custom error content";
437
-
438
- const component = mount(UInputNumber, {
439
- props: {
440
- error: "Default error message",
441
- },
442
- slots: {
443
- error: customError,
444
- },
445
- });
446
-
447
- const labelComponent = component.getComponent(UInput).getComponent(ULabel);
448
- const errorElement = labelComponent.find("[vl-child-key='error']");
449
-
450
- expect(errorElement.text()).toBe(customError);
451
- });
452
434
  });
453
435
 
454
436
  describe("Exposed properties", () => {
@@ -133,14 +133,6 @@ const { getDataTest, config, passwordInputAttrs, passwordIconAttrs, passwordIcon
133
133
  <slot name="description" :description="description" />
134
134
  </template>
135
135
 
136
- <template #error>
137
- <!--
138
- @slot Use this to add custom content instead of the error message.
139
- @binding {string | boolean} error
140
- -->
141
- <slot name="error" :error="error" />
142
- </template>
143
-
144
136
  <template #right>
145
137
  <div v-bind="passwordIconWrapperAttrs" @click="onClickShowPassword">
146
138
  <!--
@@ -318,23 +318,5 @@ describe("UInputPassword.vue", () => {
318
318
 
319
319
  expect(descriptionElement.text()).toBe(customDescription);
320
320
  });
321
-
322
- it("Error – renders custom content from error slot", () => {
323
- const customError = "Custom error content";
324
-
325
- const component = mount(UInputPassword, {
326
- props: {
327
- error: "Default error message",
328
- },
329
- slots: {
330
- error: customError,
331
- },
332
- });
333
-
334
- const labelComponent = component.getComponent(UInput).getComponent(ULabel);
335
- const errorElement = labelComponent.find("[vl-child-key='error']");
336
-
337
- expect(errorElement.text()).toBe(customError);
338
- });
339
321
  });
340
322
  });
@@ -152,14 +152,6 @@ const {
152
152
  <slot name="description" :description="description" />
153
153
  </template>
154
154
 
155
- <template #error>
156
- <!--
157
- @slot Use this to add custom content instead of the error message.
158
- @binding {string | boolean} error
159
- -->
160
- <slot name="error" :error="error" />
161
- </template>
162
-
163
155
  <template #left>
164
156
  <!-- @slot Use it to add something before the text. -->
165
157
  <slot name="left" />
@@ -320,24 +320,6 @@ describe("UInputSearch.vue", () => {
320
320
 
321
321
  expect(descriptionElement.text()).toBe(customDescription);
322
322
  });
323
-
324
- it("Error – renders custom content from error slot", () => {
325
- const customError = "Custom error content";
326
-
327
- const component = mount(UInputSearch, {
328
- props: {
329
- error: "Default error message",
330
- },
331
- slots: {
332
- error: customError,
333
- },
334
- });
335
-
336
- const labelComponent = component.getComponent(UInput).getComponent(ULabel);
337
- const errorElement = labelComponent.find("[vl-child-key='error']");
338
-
339
- expect(errorElement.text()).toBe(customError);
340
- });
341
323
  });
342
324
 
343
325
  describe("Events", () => {
@@ -55,17 +55,8 @@ const hasErrorState = computed(() => {
55
55
  return Boolean(props.error) && !props.disabled;
56
56
  });
57
57
 
58
- const errorFallbackText = computed(() => {
59
- return typeof props.error === "string" ? props.error : "";
60
- });
61
-
62
- const showErrorBlock = computed(() => {
63
- if (!hasErrorState.value) return false;
64
-
65
- return (
66
- hasSlotContent(slots["error"], { error: props.error }) ||
67
- (typeof props.error !== "boolean" && Boolean(props.error))
68
- );
58
+ const showErrorMessage = computed(() => {
59
+ return hasErrorState.value && typeof props.error !== "boolean";
69
60
  });
70
61
 
71
62
  function onClick(event: MouseEvent) {
@@ -121,7 +112,6 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
121
112
  label ||
122
113
  hasSlotContent(slots['label'], { label }) ||
123
114
  error ||
124
- hasSlotContent(slots['error'], { error }) ||
125
115
  description ||
126
116
  hasSlotContent(slots['description'], { description })
127
117
  "
@@ -145,15 +135,12 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
145
135
  </slot>
146
136
  </component>
147
137
 
148
- <div v-if="showErrorBlock" v-bind="errorAttrs" :data-test="getDataTest('error')">
149
- <!--
150
- @slot Use this to add custom content instead of the error message.
151
- @binding {string | boolean} error
152
- -->
153
- <slot name="error" :error="error">
154
- {{ errorFallbackText }}
155
- </slot>
156
- </div>
138
+ <div
139
+ v-if="showErrorMessage"
140
+ v-bind="errorAttrs"
141
+ :data-test="getDataTest('error')"
142
+ v-text="error"
143
+ />
157
144
 
158
145
  <div
159
146
  v-if="
@@ -201,15 +188,12 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
201
188
  <slot />
202
189
  </div>
203
190
 
204
- <div v-if="showErrorBlock" v-bind="errorAttrs" :data-test="getDataTest('error')">
205
- <!--
206
- @slot Use this to add custom content instead of the error message.
207
- @binding {string | boolean} error
208
- -->
209
- <slot name="error" :error="error">
210
- {{ errorFallbackText }}
211
- </slot>
212
- </div>
191
+ <div
192
+ v-if="showErrorMessage"
193
+ v-bind="errorAttrs"
194
+ :data-test="getDataTest('error')"
195
+ v-text="error"
196
+ />
213
197
 
214
198
  <div
215
199
  v-if="
@@ -111,25 +111,6 @@ describe("ULabel.vue", () => {
111
111
  expect(component.find("[vl-key='error']").exists()).toBe(false);
112
112
  });
113
113
 
114
- it("Error – renders content from error slot", () => {
115
- const slotContent = "Custom error from slot";
116
- const defaultError = "Default error";
117
-
118
- const component = mount(ULabel, {
119
- props: {
120
- error: defaultError,
121
- },
122
- slots: {
123
- error: slotContent,
124
- },
125
- });
126
-
127
- const errorElement = component.find("[vl-key='error']");
128
-
129
- expect(errorElement.text()).toBe(slotContent);
130
- expect(errorElement.text()).not.toContain(defaultError);
131
- });
132
-
133
114
  it("Align – applies correct classes for align prop", () => {
134
115
  const alignCases = {
135
116
  top: "flex-col",
@@ -132,14 +132,6 @@ const { getDataTest, radioLabelAttrs, radioAttrs } = useUI<Config>(defaultConfig
132
132
  <slot name="description" :description="description" />
133
133
  </template>
134
134
 
135
- <template #error>
136
- <!--
137
- @slot Use this to add custom content instead of the error message.
138
- @binding {string | boolean} error
139
- -->
140
- <slot name="error" :error="error" />
141
- </template>
142
-
143
135
  <input
144
136
  :id="elementId"
145
137
  type="radio"
@@ -224,24 +224,6 @@ describe("URadio.vue", () => {
224
224
  expect(descriptionElement.text()).toBe(customDescription);
225
225
  });
226
226
 
227
- it("Error – renders custom content from error slot", () => {
228
- const customError = "Custom error content";
229
-
230
- const component = mount(URadio, {
231
- props: {
232
- error: "Default error message",
233
- },
234
- slots: {
235
- error: customError,
236
- },
237
- });
238
-
239
- const labelComponent = component.getComponent(ULabel);
240
- const errorElement = labelComponent.find("[vl-child-key='error']");
241
-
242
- expect(errorElement.text()).toBe(customError);
243
- });
244
-
245
227
  it("Bottom – renders custom content from bottom slot", () => {
246
228
  const customBottomContent = "Custom Bottom Content";
247
229
 
@@ -87,14 +87,6 @@ const { getDataTest, groupLabelAttrs, listAttrs, groupRadioAttrs } = useUI<Confi
87
87
  <slot name="description" :description="description" />
88
88
  </template>
89
89
 
90
- <template #error>
91
- <!--
92
- @slot Use this to add custom content instead of the error message.
93
- @binding {string | boolean} error
94
- -->
95
- <slot name="error" :error="error" />
96
- </template>
97
-
98
90
  <div ref="list" v-bind="listAttrs">
99
91
  <!-- @slot Use it to add URadio directly. -->
100
92
  <slot>
@@ -322,25 +322,6 @@ describe("URadioGroup.vue", () => {
322
322
  expect(descriptionElement.text()).toBe(customDescription);
323
323
  });
324
324
 
325
- it("Error – renders custom content from error slot", () => {
326
- const customError = "Custom error content";
327
-
328
- const component = mount(URadioGroup, {
329
- props: {
330
- error: "Default error message",
331
- name: defaultName,
332
- },
333
- slots: {
334
- error: customError,
335
- },
336
- });
337
-
338
- const labelComponent = component.getComponent(ULabel);
339
- const errorElement = labelComponent.find("[vl-child-key='error']");
340
-
341
- expect(errorElement.text()).toBe(customError);
342
- });
343
-
344
325
  it("Default slot – renders custom URadio components", () => {
345
326
  const component = mount(URadioGroup, {
346
327
  props: {
@@ -546,14 +546,6 @@ const {
546
546
  <slot name="description" :description="description" />
547
547
  </template>
548
548
 
549
- <template #error>
550
- <!--
551
- @slot Use this to add custom content instead of the error message.
552
- @binding {string | boolean} error
553
- -->
554
- <slot name="error" :error="error" />
555
- </template>
556
-
557
549
  <div
558
550
  ref="wrapper"
559
551
  :tabindex="searchable || disabled ? -1 : 0"
@@ -606,25 +606,6 @@ describe("USelect.vue", () => {
606
606
  expect(descriptionElement.text()).toBe(customDescription);
607
607
  });
608
608
 
609
- it("Error – renders custom content from error slot", () => {
610
- const customError = "Custom error content";
611
-
612
- const component = mount(USelect, {
613
- props: {
614
- error: "Default error message",
615
- options: defaultOptions,
616
- },
617
- slots: {
618
- error: customError,
619
- },
620
- });
621
-
622
- const labelComponent = component.getComponent(ULabel);
623
- const errorElement = labelComponent.find("[vl-child-key='error']");
624
-
625
- expect(errorElement.text()).toBe(customError);
626
- });
627
-
628
609
  it("Left – renders custom content from left slot", () => {
629
610
  const slotContent = "Left Slot Content";
630
611
 
@@ -258,14 +258,6 @@ const {
258
258
  <slot name="description" :description="description" />
259
259
  </template>
260
260
 
261
- <template #error>
262
- <!--
263
- @slot Use this to add custom content instead of the error message.
264
- @binding {string | boolean} error
265
- -->
266
- <slot name="error" :error="error" />
267
- </template>
268
-
269
261
  <div ref="wrapper" v-bind="wrapperAttrs">
270
262
  <span
271
263
  v-if="hasSlotContent($slots['left'])"
@@ -448,24 +448,6 @@ describe("UTextarea.vue", () => {
448
448
  expect(descriptionElement.text()).toBe(customDescription);
449
449
  });
450
450
 
451
- it("Error – renders custom content from error slot", () => {
452
- const customError = "Custom error content";
453
-
454
- const component = mount(UTextarea, {
455
- props: {
456
- error: "Default error message",
457
- },
458
- slots: {
459
- error: customError,
460
- },
461
- });
462
-
463
- const labelComponent = component.getComponent(ULabel);
464
- const errorElement = labelComponent.find("[vl-child-key='error']");
465
-
466
- expect(errorElement.text()).toBe(customError);
467
- });
468
-
469
451
  it("Left – renders custom content from left slot", () => {
470
452
  const slotText = "Custom Left Content";
471
453
  const testClass = "custom-left";