vueless 1.2.15-beta.3 → 1.2.15-beta.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/locales/en.json +1 -1
- package/package.json +1 -1
- package/ui.container-accordion-item/UAccordionItem.vue +1 -5
- package/ui.container-accordion-item/tests/UAccordionItem.test.ts +5 -5
- package/ui.data-list/config.ts +1 -1
- package/ui.data-list/storybook/stories.ts +24 -24
- package/ui.data-list/tests/UDataList.test.ts +7 -7
- package/ui.data-table/config.ts +2 -0
- package/ui.data-table/storybook/stories.ts +3 -1
- package/ui.dropdown-badge/config.ts +1 -1
- package/ui.dropdown-badge/storybook/stories.ts +3 -3
- package/ui.dropdown-badge/tests/UDropdownBadge.test.ts +5 -5
- package/ui.dropdown-button/config.ts +1 -1
- package/ui.dropdown-button/storybook/stories.ts +7 -7
- package/ui.dropdown-button/tests/UDropdownButton.test.ts +5 -5
- package/ui.dropdown-link/config.ts +1 -1
- package/ui.dropdown-link/storybook/stories.ts +3 -3
- package/ui.dropdown-link/tests/UDropdownLink.test.ts +5 -5
- package/ui.form-calendar/UCalendar.vue +4 -0
- package/ui.form-calendar/config.ts +5 -0
- package/ui.form-checkbox/UCheckbox.vue +23 -4
- package/ui.form-checkbox/config.ts +4 -0
- package/ui.form-checkbox/tests/UCheckbox.test.ts +1 -1
- package/ui.form-checkbox-group/UCheckboxGroup.vue +2 -2
- package/ui.form-checkbox-group/config.ts +2 -0
- package/ui.form-checkbox-group/storybook/stories.ts +46 -9
- package/ui.form-checkbox-group/tests/UCheckboxGroup.test.ts +65 -0
- package/ui.form-checkbox-group/types.ts +10 -0
- package/ui.form-date-picker/config.ts +5 -0
- package/ui.form-input/UInput.vue +9 -3
- package/ui.form-input-counter/UInputCounter.vue +9 -0
- package/ui.form-input-counter/config.ts +5 -0
- package/ui.form-input-password/UInputPassword.vue +11 -12
- package/ui.form-input-password/tests/UInputPassword.test.ts +2 -2
- package/ui.form-label/ULabel.vue +5 -1
- package/ui.form-label/types.ts +5 -0
- package/ui.form-listbox/UListbox.vue +37 -11
- package/ui.form-listbox/config.ts +1 -1
- package/ui.form-listbox/storybook/stories.ts +25 -25
- package/ui.form-listbox/tests/UListbox.test.ts +6 -6
- package/ui.form-radio-group/URadioGroup.vue +2 -2
- package/ui.form-radio-group/config.ts +2 -0
- package/ui.form-radio-group/storybook/stories.ts +48 -8
- package/ui.form-radio-group/tests/URadioGroup.test.ts +68 -0
- package/ui.form-radio-group/types.ts +18 -4
- package/ui.form-select/USelect.vue +37 -2
- package/ui.form-select/config.ts +1 -1
- package/ui.form-select/tests/USelect.test.ts +6 -4
- package/ui.form-switch/USwitch.vue +20 -7
- package/ui.form-switch/config.ts +2 -0
- package/ui.form-switch/tests/USwitch.test.ts +6 -4
- package/ui.form-textarea/UTextarea.vue +15 -5
- package/ui.form-textarea/tests/UTextarea.test.ts +1 -1
- package/ui.navigation-pagination/UPagination.vue +14 -0
- package/ui.navigation-pagination/config.ts +9 -0
- package/ui.text-alert/UAlert.vue +8 -0
- package/ui.text-alert/config.ts +4 -0
- package/icons/storybook/notifications.svg +0 -1
package/locales/en.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"USelect":{"listIsEmpty":"List is empty.","noDataToShow":"No data to show.","clear":"clear","addMore":"Add more..."},"USwitch":{"inactive":"Off","active":"On"},"UInputFile":{"sizeError":"File size is too big.","formatError":"Format is not supported.","noFile":"No file selected","uploadFile":"Choose file"},"UListbox":{"noDataToShow":"No data to show.","add":"Add","search":"Search..."},"UModalConfirm":{"confirm":"Confirm","cancel":"Cancel"},"UTable":{"noData":"There is no data in the table."},"UCalendar":{"today":"Today","yesterday":"Yesterday","tomorrow":"Tomorrow","weekdays":{"shorthand":{"sunday":"Sun","monday":"Mon","tuesday":"Tue","wednesday":"Wed","thursday":"Thu","friday":"Fri","saturday":"Sat"},"longhand":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"},"userFormat":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"}},"months":{"shorthand":{"january":"Jan","february":"Feb","march":"Mar","april":"Apr","may":"May","june":"Jun","july":"Jul","august":"Aug","september":"Sep","october":"Oct","november":"Nov","december":"Dec"},"longhand":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"},"userFormat":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"}},"timeLabel":"Time","okLabel":"Ok"},"UDatePicker":{"today":"Today","yesterday":"Yesterday","tomorrow":"Tomorrow","weekdays":{"shorthand":{"sunday":"Sun","monday":"Mon","tuesday":"Tue","wednesday":"Wed","thursday":"Thu","friday":"Fri","saturday":"Sat"},"longhand":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"},"userFormat":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"}},"months":{"shorthand":{"january":"Jan","february":"Feb","march":"Mar","april":"Apr","may":"May","june":"Jun","july":"Jul","august":"Aug","september":"Sep","october":"Oct","november":"Nov","december":"Dec"},"longhand":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"},"userFormat":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"}},"timeLabel":"Time","okLabel":"Ok"},"UDatePickerRange":{"ownRange":"Own range","week":"Week","month":"Month","quarter":"Quarter","year":"Year","dateFormatWithDot":"The date should be in format 'dd.mm.yyyy'.","notCorrectMonthNumber":"Wrong month number.","notCorrectDayNumber":"Wrong day in month.","fromDateGraterThanSecond":"The 'from' date should be less than the 'to' date.","toDateSmallerThanFirst":"The 'to' date should be greater than the 'from' date.","today":"Today","yesterday":"Yesterday","tomorrow":"Tomorrow","weekdays":{"shorthand":{"sunday":"Sun","monday":"Mon","tuesday":"Tue","wednesday":"Wed","thursday":"Thu","friday":"Fri","saturday":"Sat"},"longhand":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"},"userFormat":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"}},"months":{"shorthand":{"january":"Jan","february":"Feb","march":"Mar","april":"Apr","may":"May","june":"Jun","july":"Jul","august":"Aug","september":"Sep","october":"Oct","november":"Nov","december":"Dec"},"longhand":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"},"userFormat":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"}}},"UDataList":{"emptyTitle":"","emptyDescription":"There is no data in the list."},"UNotify":{"success":{"default":"Operation successful."},"warning":{"default":"Operation warning."},"error":{"default":"Operation error."}}}
|
|
1
|
+
{"USelect":{"listIsEmpty":"List is empty.","noDataToShow":"No data to show.","clear":"clear","addMore":"Add more..."},"USwitch":{"switch":"Switch","inactive":"Off","active":"On"},"UInputFile":{"sizeError":"File size is too big.","formatError":"Format is not supported.","noFile":"No file selected","uploadFile":"Choose file"},"UListbox":{"noDataToShow":"No data to show.","add":"Add","search":"Search..."},"UModalConfirm":{"confirm":"Confirm","cancel":"Cancel"},"UTable":{"noData":"There is no data in the table.","checkbox":"Checkbox"},"UCalendar":{"today":"Today","yesterday":"Yesterday","tomorrow":"Tomorrow","weekdays":{"shorthand":{"sunday":"Sun","monday":"Mon","tuesday":"Tue","wednesday":"Wed","thursday":"Thu","friday":"Fri","saturday":"Sat"},"longhand":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"},"userFormat":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"}},"months":{"shorthand":{"january":"Jan","february":"Feb","march":"Mar","april":"Apr","may":"May","june":"Jun","july":"Jul","august":"Aug","september":"Sep","october":"Oct","november":"Nov","december":"Dec"},"longhand":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"},"userFormat":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"}},"timeLabel":"Time","okLabel":"Ok","previousYear":"Previous Year","nextYear":"Next Year","previousMonth":"Previous Month","nextMonth":"Next Month"},"UDatePicker":{"today":"Today","yesterday":"Yesterday","tomorrow":"Tomorrow","weekdays":{"shorthand":{"sunday":"Sun","monday":"Mon","tuesday":"Tue","wednesday":"Wed","thursday":"Thu","friday":"Fri","saturday":"Sat"},"longhand":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"},"userFormat":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"}},"months":{"shorthand":{"january":"Jan","february":"Feb","march":"Mar","april":"Apr","may":"May","june":"Jun","july":"Jul","august":"Aug","september":"Sep","october":"Oct","november":"Nov","december":"Dec"},"longhand":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"},"userFormat":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"}},"timeLabel":"Time","okLabel":"Ok","previousYear":"Previous Year","nextYear":"Next Year","previousMonth":"Previous Month","nextMonth":"Next Month"},"UDatePickerRange":{"ownRange":"Own range","week":"Week","month":"Month","quarter":"Quarter","year":"Year","dateFormatWithDot":"The date should be in format 'dd.mm.yyyy'.","notCorrectMonthNumber":"Wrong month number.","notCorrectDayNumber":"Wrong day in month.","fromDateGraterThanSecond":"The 'from' date should be less than the 'to' date.","toDateSmallerThanFirst":"The 'to' date should be greater than the 'from' date.","today":"Today","yesterday":"Yesterday","tomorrow":"Tomorrow","weekdays":{"shorthand":{"sunday":"Sun","monday":"Mon","tuesday":"Tue","wednesday":"Wed","thursday":"Thu","friday":"Fri","saturday":"Sat"},"longhand":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"},"userFormat":{"sunday":"Sunday","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday"}},"months":{"shorthand":{"january":"Jan","february":"Feb","march":"Mar","april":"Apr","may":"May","june":"Jun","july":"Jul","august":"Aug","september":"Sep","october":"Oct","november":"Nov","december":"Dec"},"longhand":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"},"userFormat":{"january":"January","february":"February","march":"March","april":"April","may":"May","june":"June","july":"July","august":"August","september":"September","october":"October","november":"November","december":"December"}}},"UDataList":{"emptyTitle":"","emptyDescription":"There is no data in the list."},"UNotify":{"success":{"default":"Operation successful."},"warning":{"default":"Operation warning."},"error":{"default":"Operation error."}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "1.2.15-beta.
|
|
3
|
+
"version": "1.2.15-beta.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",
|
|
@@ -145,11 +145,7 @@ const {
|
|
|
145
145
|
</slot>
|
|
146
146
|
</div>
|
|
147
147
|
|
|
148
|
-
<div
|
|
149
|
-
v-if="description || hasSlotContent(slots['description'])"
|
|
150
|
-
:id="`description-${elementId}`"
|
|
151
|
-
v-bind="descriptionAttrs"
|
|
152
|
-
>
|
|
148
|
+
<div v-if="description || hasSlotContent(slots['description'])" v-bind="descriptionAttrs">
|
|
153
149
|
<!--
|
|
154
150
|
@slot Use it to add custom description content.
|
|
155
151
|
@binding {string} description
|
|
@@ -91,7 +91,7 @@ describe("UAccordionItem", () => {
|
|
|
91
91
|
},
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
expect(component.find(`[
|
|
94
|
+
expect(component.find(`[vl-key='description']`).exists()).toBe(true);
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
// DataTest prop
|
|
@@ -381,13 +381,13 @@ describe("UAccordionItem", () => {
|
|
|
381
381
|
},
|
|
382
382
|
});
|
|
383
383
|
|
|
384
|
-
expect(component.find("[
|
|
384
|
+
expect(component.find("[vl-key='description']").classes()).not.toContain("opacity-100");
|
|
385
385
|
|
|
386
386
|
await component.find(`.${slotClass}`).trigger("click");
|
|
387
|
-
expect(component.find("[
|
|
387
|
+
expect(component.find("[vl-key='description']").classes()).toContain("opacity-100");
|
|
388
388
|
|
|
389
389
|
await component.find(`.${slotClass}`).trigger("click");
|
|
390
|
-
expect(component.find("[
|
|
390
|
+
expect(component.find("[vl-key='description']").classes()).not.toContain("opacity-100");
|
|
391
391
|
});
|
|
392
392
|
|
|
393
393
|
it("description slot content is always visible when slot is provided", () => {
|
|
@@ -461,7 +461,7 @@ describe("UAccordionItem", () => {
|
|
|
461
461
|
},
|
|
462
462
|
});
|
|
463
463
|
|
|
464
|
-
const descriptionElement = component.find("[
|
|
464
|
+
const descriptionElement = component.find("[vl-key='description']");
|
|
465
465
|
|
|
466
466
|
// Initially not opened
|
|
467
467
|
expect(descriptionElement.classes()).not.toContain(openedClass);
|
package/ui.data-list/config.ts
CHANGED
|
@@ -30,9 +30,9 @@ export default {
|
|
|
30
30
|
component: UDataList,
|
|
31
31
|
args: {
|
|
32
32
|
list: [
|
|
33
|
-
{ label: "Expenses",
|
|
34
|
-
{ label: "Revenue Streams",
|
|
35
|
-
{ label: "Departments",
|
|
33
|
+
{ label: "Expenses", value: 1 },
|
|
34
|
+
{ label: "Revenue Streams", value: 2 },
|
|
35
|
+
{ label: "Departments", value: 3 },
|
|
36
36
|
],
|
|
37
37
|
},
|
|
38
38
|
argTypes: {
|
|
@@ -87,29 +87,29 @@ Nesting.args = {
|
|
|
87
87
|
list: [
|
|
88
88
|
{
|
|
89
89
|
label: "Expenses",
|
|
90
|
-
|
|
90
|
+
value: 1,
|
|
91
91
|
children: [
|
|
92
|
-
{ label: "Office Supplies",
|
|
93
|
-
{ label: "Travel & Lodging",
|
|
94
|
-
{ label: "Utilities",
|
|
92
|
+
{ label: "Office Supplies", value: 1.1 },
|
|
93
|
+
{ label: "Travel & Lodging", value: 1.2 },
|
|
94
|
+
{ label: "Utilities", value: 1.3 },
|
|
95
95
|
],
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
label: "Revenue Streams",
|
|
99
|
-
|
|
99
|
+
value: 2,
|
|
100
100
|
children: [
|
|
101
|
-
{ label: "Product Sales",
|
|
102
|
-
{ label: "Subscription Services",
|
|
103
|
-
{ label: "Consulting",
|
|
101
|
+
{ label: "Product Sales", value: 2.1 },
|
|
102
|
+
{ label: "Subscription Services", value: 2.2 },
|
|
103
|
+
{ label: "Consulting", value: 2.3 },
|
|
104
104
|
],
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
label: "Departments",
|
|
108
|
-
|
|
108
|
+
value: 3,
|
|
109
109
|
children: [
|
|
110
|
-
{ label: "Engineering",
|
|
111
|
-
{ label: "Marketing",
|
|
112
|
-
{ label: "Finance",
|
|
110
|
+
{ label: "Engineering", value: 3.1 },
|
|
111
|
+
{ label: "Marketing", value: 3.2 },
|
|
112
|
+
{ label: "Finance", value: 3.3 },
|
|
113
113
|
],
|
|
114
114
|
},
|
|
115
115
|
],
|
|
@@ -159,17 +159,17 @@ DragSlot.args = {
|
|
|
159
159
|
list: [
|
|
160
160
|
{
|
|
161
161
|
label: "John Doe (Engineering)",
|
|
162
|
-
|
|
162
|
+
value: 1,
|
|
163
163
|
avatar: "https://cdn-icons-png.flaticon.com/128/1999/1999625.png",
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
label: "Michael Johnson (Finance)",
|
|
167
|
-
|
|
167
|
+
value: 2,
|
|
168
168
|
avatar: "https://cdn-icons-png.flaticon.com/128/4140/4140057.png",
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
label: "Emma Smith (Marketing)",
|
|
172
|
-
|
|
172
|
+
value: 3,
|
|
173
173
|
avatar: "https://cdn-icons-png.flaticon.com/128/4140/4140047.png",
|
|
174
174
|
},
|
|
175
175
|
],
|
|
@@ -183,18 +183,18 @@ DragSlot.args = {
|
|
|
183
183
|
export const ActionsSlot = DefaultTemplate.bind({});
|
|
184
184
|
ActionsSlot.args = {
|
|
185
185
|
list: [
|
|
186
|
-
{ label: "Expenses",
|
|
186
|
+
{ label: "Expenses", value: 1 },
|
|
187
187
|
{
|
|
188
188
|
label: "Revenue Streams",
|
|
189
|
-
|
|
189
|
+
value: 2,
|
|
190
190
|
actions: false,
|
|
191
191
|
children: [
|
|
192
|
-
{ label: "Product Sales",
|
|
193
|
-
{ label: "Subscription Services",
|
|
194
|
-
{ label: "Consulting",
|
|
192
|
+
{ label: "Product Sales", value: 2.1 },
|
|
193
|
+
{ label: "Subscription Services", value: 2.2 },
|
|
194
|
+
{ label: "Consulting", value: 2.3, actions: false },
|
|
195
195
|
],
|
|
196
196
|
},
|
|
197
|
-
{ label: "Departments",
|
|
197
|
+
{ label: "Departments", value: 3, crossed: true },
|
|
198
198
|
],
|
|
199
199
|
slotTemplate: `
|
|
200
200
|
<template #actions="{ item }">
|
|
@@ -10,21 +10,21 @@ import type { Props, DataListItem } from "../types";
|
|
|
10
10
|
|
|
11
11
|
describe("UDataList.vue", () => {
|
|
12
12
|
const defaultList: DataListItem[] = [
|
|
13
|
-
{
|
|
14
|
-
{
|
|
15
|
-
{
|
|
13
|
+
{ value: 1, label: "Item 1" },
|
|
14
|
+
{ value: 2, label: "Item 2", crossed: true },
|
|
15
|
+
{ value: 3, label: "Item 3", actions: false },
|
|
16
16
|
];
|
|
17
17
|
|
|
18
18
|
const nestedList: DataListItem[] = [
|
|
19
19
|
{
|
|
20
|
-
|
|
20
|
+
value: 1,
|
|
21
21
|
label: "Parent 1",
|
|
22
22
|
children: [
|
|
23
|
-
{
|
|
24
|
-
{
|
|
23
|
+
{ value: 11, label: "Child 1.1" },
|
|
24
|
+
{ value: 12, label: "Child 1.2" },
|
|
25
25
|
],
|
|
26
26
|
},
|
|
27
|
-
{
|
|
27
|
+
{ value: 2, label: "Parent 2" },
|
|
28
28
|
];
|
|
29
29
|
|
|
30
30
|
describe("Props", () => {
|
package/ui.data-table/config.ts
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
} from "../../utils/storybook";
|
|
8
8
|
import { getRandomId } from "../../utils/helper";
|
|
9
9
|
|
|
10
|
+
import defaultConfig from "../config";
|
|
11
|
+
|
|
10
12
|
import UTable from "../UTable.vue";
|
|
11
13
|
import UButton from "../../ui.button/UButton.vue";
|
|
12
14
|
import ULink from "../../ui.button-link/ULink.vue";
|
|
@@ -731,7 +733,7 @@ export const EmptyStateSlot = DefaultTemplate.bind({});
|
|
|
731
733
|
EmptyStateSlot.args = {
|
|
732
734
|
rows: [],
|
|
733
735
|
config: {
|
|
734
|
-
i18n: { noData: "Fetching data..." },
|
|
736
|
+
i18n: { ...defaultConfig.i18n, noData: "Fetching data..." },
|
|
735
737
|
bodyEmptyStateCell: "py-10",
|
|
736
738
|
},
|
|
737
739
|
slotTemplate: `
|
|
@@ -41,9 +41,9 @@ export default {
|
|
|
41
41
|
args: {
|
|
42
42
|
label: "Order Status",
|
|
43
43
|
options: [
|
|
44
|
-
{ label: "Pending",
|
|
45
|
-
{ label: "Delivered",
|
|
46
|
-
{ label: "Cancelled",
|
|
44
|
+
{ label: "Pending", value: "pending" },
|
|
45
|
+
{ label: "Delivered", value: "delivered" },
|
|
46
|
+
{ label: "Cancelled", value: "cancelled" },
|
|
47
47
|
],
|
|
48
48
|
},
|
|
49
49
|
argTypes: {
|
|
@@ -10,9 +10,9 @@ import type { Props } from "../types";
|
|
|
10
10
|
|
|
11
11
|
describe("UDropdownBadge.vue", () => {
|
|
12
12
|
const defaultOptions = [
|
|
13
|
-
{
|
|
14
|
-
{
|
|
15
|
-
{
|
|
13
|
+
{ value: 1, label: "Option 1" },
|
|
14
|
+
{ value: 2, label: "Option 2" },
|
|
15
|
+
{ value: 3, label: "Option 3" },
|
|
16
16
|
];
|
|
17
17
|
|
|
18
18
|
// Props tests
|
|
@@ -43,7 +43,7 @@ describe("UDropdownBadge.vue", () => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
// Find the selected option's label
|
|
46
|
-
const selectedOption = defaultOptions.find((option) => option.
|
|
46
|
+
const selectedOption = defaultOptions.find((option) => option.value === modelValue);
|
|
47
47
|
|
|
48
48
|
expect(component.findComponent(UBadge).props("label")).toBe(selectedOption?.label);
|
|
49
49
|
});
|
|
@@ -61,7 +61,7 @@ describe("UDropdownBadge.vue", () => {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// Find the selected options' labels
|
|
64
|
-
const selectedOptions = defaultOptions.filter((option) => modelValue.includes(option.
|
|
64
|
+
const selectedOptions = defaultOptions.filter((option) => modelValue.includes(option.value));
|
|
65
65
|
const expectedLabel = selectedOptions.map((option) => option.label).join(", ");
|
|
66
66
|
|
|
67
67
|
expect(component.findComponent(UBadge).props("label")).toBe(expectedLabel);
|
|
@@ -41,9 +41,9 @@ export default {
|
|
|
41
41
|
args: {
|
|
42
42
|
label: "Actions",
|
|
43
43
|
options: [
|
|
44
|
-
{ label: "Edit",
|
|
45
|
-
{ label: "Copy",
|
|
46
|
-
{ label: "Remove",
|
|
44
|
+
{ label: "Edit", value: "edit" },
|
|
45
|
+
{ label: "Copy", value: "copy" },
|
|
46
|
+
{ label: "Remove", value: "delete" },
|
|
47
47
|
],
|
|
48
48
|
},
|
|
49
49
|
argTypes: {
|
|
@@ -365,7 +365,7 @@ export const OptionSlots: StoryFn<DefaultUDropdownButtonArgs> = (args) => ({
|
|
|
365
365
|
:options="[
|
|
366
366
|
{
|
|
367
367
|
label: 'John Doe',
|
|
368
|
-
|
|
368
|
+
value: '1',
|
|
369
369
|
role: 'Developer',
|
|
370
370
|
avatar: johnDoe,
|
|
371
371
|
status: 'online',
|
|
@@ -373,7 +373,7 @@ export const OptionSlots: StoryFn<DefaultUDropdownButtonArgs> = (args) => ({
|
|
|
373
373
|
},
|
|
374
374
|
{
|
|
375
375
|
label: 'Jane Smith',
|
|
376
|
-
|
|
376
|
+
value: '2',
|
|
377
377
|
role: 'Designer',
|
|
378
378
|
avatar: emilyDavis,
|
|
379
379
|
status: 'away',
|
|
@@ -381,7 +381,7 @@ export const OptionSlots: StoryFn<DefaultUDropdownButtonArgs> = (args) => ({
|
|
|
381
381
|
},
|
|
382
382
|
{
|
|
383
383
|
label: 'Mike Johnson',
|
|
384
|
-
|
|
384
|
+
value: '3',
|
|
385
385
|
role: 'Product Manager',
|
|
386
386
|
avatar: alexJohnson,
|
|
387
387
|
status: 'offline',
|
|
@@ -389,7 +389,7 @@ export const OptionSlots: StoryFn<DefaultUDropdownButtonArgs> = (args) => ({
|
|
|
389
389
|
},
|
|
390
390
|
{
|
|
391
391
|
label: 'Sarah Wilson',
|
|
392
|
-
|
|
392
|
+
value: '4',
|
|
393
393
|
role: 'QA Engineer',
|
|
394
394
|
avatar: patMorgan,
|
|
395
395
|
status: 'online',
|
|
@@ -10,9 +10,9 @@ import type { Props } from "../types";
|
|
|
10
10
|
|
|
11
11
|
describe("UDropdownButton.vue", () => {
|
|
12
12
|
const defaultOptions = [
|
|
13
|
-
{
|
|
14
|
-
{
|
|
15
|
-
{
|
|
13
|
+
{ value: 1, label: "Option 1" },
|
|
14
|
+
{ value: 2, label: "Option 2" },
|
|
15
|
+
{ value: 3, label: "Option 3" },
|
|
16
16
|
];
|
|
17
17
|
|
|
18
18
|
// Props tests
|
|
@@ -43,7 +43,7 @@ describe("UDropdownButton.vue", () => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
// Find the selected option's label
|
|
46
|
-
const selectedOption = defaultOptions.find((option) => option.
|
|
46
|
+
const selectedOption = defaultOptions.find((option) => option.value === modelValue);
|
|
47
47
|
|
|
48
48
|
expect(component.findComponent(UButton).props("label")).toBe(selectedOption?.label);
|
|
49
49
|
});
|
|
@@ -61,7 +61,7 @@ describe("UDropdownButton.vue", () => {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// Find the selected options' labels
|
|
64
|
-
const selectedOptions = defaultOptions.filter((option) => modelValue.includes(option.
|
|
64
|
+
const selectedOptions = defaultOptions.filter((option) => modelValue.includes(option.value));
|
|
65
65
|
const expectedLabel = selectedOptions.map((option) => option.label).join(", ");
|
|
66
66
|
|
|
67
67
|
expect(component.findComponent(UButton).props("label")).toBe(expectedLabel);
|
|
@@ -40,9 +40,9 @@ export default {
|
|
|
40
40
|
args: {
|
|
41
41
|
label: "Account",
|
|
42
42
|
options: [
|
|
43
|
-
{ label: "Profile",
|
|
44
|
-
{ label: "Settings",
|
|
45
|
-
{ label: "Logout",
|
|
43
|
+
{ label: "Profile", value: "profile" },
|
|
44
|
+
{ label: "Settings", value: "settings" },
|
|
45
|
+
{ label: "Logout", value: "logout" },
|
|
46
46
|
],
|
|
47
47
|
},
|
|
48
48
|
argTypes: {
|
|
@@ -10,9 +10,9 @@ import type { Props } from "../types";
|
|
|
10
10
|
|
|
11
11
|
describe("UDropdownLink.vue", () => {
|
|
12
12
|
const defaultOptions = [
|
|
13
|
-
{
|
|
14
|
-
{
|
|
15
|
-
{
|
|
13
|
+
{ value: 1, label: "Option 1" },
|
|
14
|
+
{ value: 2, label: "Option 2" },
|
|
15
|
+
{ value: 3, label: "Option 3" },
|
|
16
16
|
];
|
|
17
17
|
|
|
18
18
|
// Props tests
|
|
@@ -43,7 +43,7 @@ describe("UDropdownLink.vue", () => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
// Find the selected option's label
|
|
46
|
-
const selectedOption = defaultOptions.find((option) => option.
|
|
46
|
+
const selectedOption = defaultOptions.find((option) => option.value === modelValue);
|
|
47
47
|
|
|
48
48
|
expect(component.findComponent(ULink).props("label")).toBe(selectedOption?.label);
|
|
49
49
|
});
|
|
@@ -61,7 +61,7 @@ describe("UDropdownLink.vue", () => {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// Find the selected options' labels
|
|
64
|
-
const selectedOptions = defaultOptions.filter((option) => modelValue.includes(option.
|
|
64
|
+
const selectedOptions = defaultOptions.filter((option) => modelValue.includes(option.value));
|
|
65
65
|
const expectedLabel = selectedOptions.map((option) => option.label).join(", ");
|
|
66
66
|
|
|
67
67
|
expect(component.findComponent(ULink).props("label")).toBe(expectedLabel);
|
|
@@ -829,6 +829,7 @@ const {
|
|
|
829
829
|
color="grayscale"
|
|
830
830
|
variant="ghost"
|
|
831
831
|
:icon="config.defaults.prevYearIcon"
|
|
832
|
+
:aria-label="localeMessages.previousYear"
|
|
832
833
|
v-bind="nextPrevButtonAttrs"
|
|
833
834
|
:data-test="getDataTest('prev-year')"
|
|
834
835
|
@mousedown.prevent.capture
|
|
@@ -841,6 +842,7 @@ const {
|
|
|
841
842
|
color="grayscale"
|
|
842
843
|
variant="ghost"
|
|
843
844
|
:icon="config.defaults.prevIcon"
|
|
845
|
+
:aria-label="localeMessages.previousMonth"
|
|
844
846
|
v-bind="nextPrevButtonAttrs"
|
|
845
847
|
:data-test="getDataTest('prev')"
|
|
846
848
|
@mousedown.prevent.capture
|
|
@@ -866,6 +868,7 @@ const {
|
|
|
866
868
|
color="grayscale"
|
|
867
869
|
variant="ghost"
|
|
868
870
|
:icon="config.defaults.nextIcon"
|
|
871
|
+
:aria-label="localeMessages.nextMonth"
|
|
869
872
|
v-bind="nextPrevButtonAttrs"
|
|
870
873
|
:data-test="getDataTest('next')"
|
|
871
874
|
@mousedown.prevent.capture
|
|
@@ -879,6 +882,7 @@ const {
|
|
|
879
882
|
color="grayscale"
|
|
880
883
|
variant="ghost"
|
|
881
884
|
:icon="config.defaults.nextYearIcon"
|
|
885
|
+
:aria-label="localeMessages.nextYear"
|
|
882
886
|
v-bind="nextPrevButtonAttrs"
|
|
883
887
|
:data-test="getDataTest('next-year')"
|
|
884
888
|
@mousedown.prevent.capture
|
|
@@ -144,6 +144,11 @@ export default /*tw*/ {
|
|
|
144
144
|
},
|
|
145
145
|
timeLabel: "Time",
|
|
146
146
|
okLabel: "Ok",
|
|
147
|
+
/* These are used for a11y. */
|
|
148
|
+
previousYear: "Previous Year",
|
|
149
|
+
nextYear: "Next Year",
|
|
150
|
+
previousMonth: "Previous Month",
|
|
151
|
+
nextMonth: "Next Month",
|
|
147
152
|
},
|
|
148
153
|
defaults: {
|
|
149
154
|
userDateFormat: "j F, Y",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { inject, ref, onMounted, computed, watchEffect, toValue, useId } from "vue";
|
|
2
|
+
import { inject, ref, onMounted, computed, watchEffect, toValue, useId, useSlots } from "vue";
|
|
3
3
|
import { isEqual } from "lodash-es";
|
|
4
4
|
|
|
5
5
|
import { useUI } from "../composables/useUI";
|
|
6
6
|
import { getDefaults } from "../utils/ui";
|
|
7
|
+
import { useComponentLocaleMessages } from "../composables/useComponentLocaleMassages";
|
|
7
8
|
|
|
8
9
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
9
10
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
@@ -48,12 +49,24 @@ const emit = defineEmits([
|
|
|
48
49
|
"input",
|
|
49
50
|
]);
|
|
50
51
|
|
|
52
|
+
const { localeMessages } = useComponentLocaleMessages<typeof defaultConfig.i18n>(
|
|
53
|
+
COMPONENT_NAME,
|
|
54
|
+
defaultConfig.i18n,
|
|
55
|
+
props?.config?.i18n,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const slots = useSlots();
|
|
59
|
+
|
|
51
60
|
const checkboxName = ref("");
|
|
52
61
|
const checkboxSize = ref(props.size);
|
|
53
62
|
const checkboxColor = ref(props.color);
|
|
54
63
|
|
|
55
64
|
const elementId = props.id || useId();
|
|
56
65
|
|
|
66
|
+
const hasLabel = computed(() => Boolean(props.label || slots.label));
|
|
67
|
+
|
|
68
|
+
const inputAriaLabelledBy = computed(() => (hasLabel.value ? elementId : undefined));
|
|
69
|
+
|
|
57
70
|
const isBinary = computed(() => !Array.isArray(props.modelValue));
|
|
58
71
|
const isCheckboxInGroup = computed(() => Boolean(toValue(getCheckboxGroupName)));
|
|
59
72
|
|
|
@@ -108,6 +121,10 @@ function onChange() {
|
|
|
108
121
|
emit("input", newModelValue);
|
|
109
122
|
}
|
|
110
123
|
|
|
124
|
+
function onIconClick() {
|
|
125
|
+
document.getElementById(elementId)?.click();
|
|
126
|
+
}
|
|
127
|
+
|
|
111
128
|
/**
|
|
112
129
|
* Get element / nested component attributes for each config token ✨
|
|
113
130
|
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
@@ -161,15 +178,17 @@ const {
|
|
|
161
178
|
:name="checkboxName"
|
|
162
179
|
:checked="isChecked"
|
|
163
180
|
:disabled="disabled"
|
|
181
|
+
:aria-labelledby="inputAriaLabelledBy"
|
|
182
|
+
:aria-label="!hasLabel ? localeMessages.checkbox : undefined"
|
|
164
183
|
v-bind="checkboxAttrs"
|
|
165
184
|
:data-test="getDataTest()"
|
|
166
185
|
@change="onChange"
|
|
167
186
|
/>
|
|
168
187
|
|
|
169
|
-
<
|
|
188
|
+
<div
|
|
170
189
|
v-if="isChecked"
|
|
171
190
|
v-bind="partial ? partiallyCheckedAttrs : checkedAttrs"
|
|
172
|
-
|
|
191
|
+
@click="onIconClick"
|
|
173
192
|
>
|
|
174
193
|
<UIcon
|
|
175
194
|
v-if="partial"
|
|
@@ -179,7 +198,7 @@ const {
|
|
|
179
198
|
/>
|
|
180
199
|
|
|
181
200
|
<UIcon v-else :name="config.defaults.checkedIcon" color="inherit" v-bind="checkedIconAttrs" />
|
|
182
|
-
</
|
|
201
|
+
</div>
|
|
183
202
|
|
|
184
203
|
<template #bottom>
|
|
185
204
|
<!-- @slot Use it to add something below the checkbox. -->
|
|
@@ -103,10 +103,10 @@ const { getDataTest, groupLabelAttrs, groupCheckboxAttrs, listAttrs } =
|
|
|
103
103
|
v-for="(option, index) in options"
|
|
104
104
|
:key="index"
|
|
105
105
|
:model-value="modelValue"
|
|
106
|
-
:value="option
|
|
106
|
+
:value="option[valueKey]"
|
|
107
107
|
:true-value="option.trueValue"
|
|
108
108
|
:false-value="option.falseValue"
|
|
109
|
-
:label="option
|
|
109
|
+
:label="String(option[labelKey] || undefined)"
|
|
110
110
|
:description="option.description"
|
|
111
111
|
:disabled="disabled"
|
|
112
112
|
v-bind="groupCheckboxAttrs"
|