vueless 1.2.15-beta.2 → 1.2.15-beta.4

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 (111) hide show
  1. package/bin/commands/copy.js +1 -1
  2. package/composables/tests/useUI.test.ts +1 -1
  3. package/composables/useBreakpoint.ts +1 -1
  4. package/composables/useUI.ts +1 -5
  5. package/constants.d.ts +1 -1
  6. package/constants.js +1 -1
  7. package/index.d.ts +3 -3
  8. package/index.ts +3 -3
  9. package/locales/en.json +1 -1
  10. package/package.json +1 -1
  11. package/types.ts +2 -2
  12. package/ui.boilerplate/UBoilerplate.vue +1 -1
  13. package/ui.button/UButton.vue +1 -1
  14. package/ui.button-link/ULink.vue +1 -1
  15. package/ui.button-toggle/UToggle.vue +1 -1
  16. package/ui.container-accordion/UAccordion.vue +1 -1
  17. package/ui.container-accordion-item/UAccordionItem.vue +2 -6
  18. package/ui.container-accordion-item/tests/UAccordionItem.test.ts +5 -5
  19. package/ui.container-card/UCard.vue +1 -1
  20. package/ui.container-col/UCol.vue +1 -1
  21. package/ui.container-divider/UDivider.vue +1 -1
  22. package/ui.container-drawer/UDrawer.vue +1 -1
  23. package/ui.container-group/UGroup.vue +1 -1
  24. package/ui.container-groups/UGroups.vue +1 -1
  25. package/ui.container-modal/UModal.vue +1 -1
  26. package/ui.container-modal-confirm/UModalConfirm.vue +1 -1
  27. package/ui.container-page/UPage.vue +1 -1
  28. package/ui.container-page/config.ts +3 -3
  29. package/ui.container-row/URow.vue +1 -1
  30. package/ui.data-list/UDataList.vue +1 -1
  31. package/ui.data-list/config.ts +1 -1
  32. package/ui.data-table/UTable.vue +1 -1
  33. package/ui.data-table/UTableRow.vue +1 -1
  34. package/ui.data-table/config.ts +2 -0
  35. package/ui.data-table/storybook/stories.ts +3 -1
  36. package/ui.dropdown-badge/UDropdownBadge.vue +1 -1
  37. package/ui.dropdown-button/UDropdownButton.vue +1 -1
  38. package/ui.dropdown-link/UDropdownLink.vue +1 -1
  39. package/ui.form-calendar/UCalendar.vue +5 -1
  40. package/ui.form-calendar/UCalendarDayView.vue +1 -1
  41. package/ui.form-calendar/UCalendarMonthView.vue +1 -1
  42. package/ui.form-calendar/UCalendarYearView.vue +1 -1
  43. package/ui.form-calendar/config.ts +5 -0
  44. package/ui.form-checkbox/UCheckbox.vue +24 -5
  45. package/ui.form-checkbox/config.ts +4 -0
  46. package/ui.form-checkbox/tests/UCheckbox.test.ts +1 -1
  47. package/ui.form-checkbox-group/UCheckboxGroup.vue +1 -1
  48. package/ui.form-checkbox-multi-state/UCheckboxMultiState.vue +1 -1
  49. package/{ui.form-color-picker/UColorPicker.vue → ui.form-color-toggle/UColorToggle.vue} +1 -1
  50. package/{ui.form-color-picker → ui.form-color-toggle}/constants.ts +1 -1
  51. package/{ui.form-color-picker → ui.form-color-toggle}/storybook/stories.ts +14 -14
  52. package/{ui.form-color-picker/tests/UColorPicker.test.ts → ui.form-color-toggle/tests/UColorToggle.test.ts} +8 -8
  53. package/ui.form-date-picker/UDatePicker.vue +1 -1
  54. package/ui.form-date-picker/config.ts +5 -0
  55. package/ui.form-date-picker-range/UDatePickerRange.vue +1 -1
  56. package/ui.form-input/UInput.vue +10 -4
  57. package/ui.form-input-counter/UInputCounter.vue +10 -1
  58. package/ui.form-input-counter/config.ts +5 -0
  59. package/ui.form-input-file/UInputFile.vue +1 -1
  60. package/ui.form-input-number/UInputNumber.vue +1 -1
  61. package/ui.form-input-password/UInputPassword.vue +12 -13
  62. package/ui.form-input-password/tests/UInputPassword.test.ts +2 -2
  63. package/ui.form-input-rating/UInputRating.vue +1 -1
  64. package/ui.form-input-search/UInputSearch.vue +1 -1
  65. package/ui.form-label/ULabel.vue +6 -2
  66. package/ui.form-label/types.ts +5 -0
  67. package/ui.form-listbox/UListbox.vue +38 -12
  68. package/ui.form-radio/URadio.vue +1 -1
  69. package/ui.form-radio-group/URadioGroup.vue +1 -1
  70. package/ui.form-select/USelect.vue +38 -3
  71. package/ui.form-select/tests/USelect.test.ts +3 -1
  72. package/ui.form-switch/USwitch.vue +21 -8
  73. package/ui.form-switch/config.ts +2 -0
  74. package/ui.form-switch/tests/USwitch.test.ts +6 -4
  75. package/ui.form-textarea/UTextarea.vue +16 -6
  76. package/ui.form-textarea/tests/UTextarea.test.ts +1 -1
  77. package/ui.image-avatar/UAvatar.vue +1 -1
  78. package/ui.image-icon/UIcon.vue +1 -1
  79. package/ui.loader/ULoader.vue +1 -1
  80. package/ui.loader-overlay/ULoaderOverlay.vue +1 -1
  81. package/ui.loader-progress/ULoaderProgress.vue +1 -1
  82. package/ui.navigation-breadcrumbs/UBreadcrumbs.vue +1 -1
  83. package/ui.navigation-pagination/UPagination.vue +15 -1
  84. package/ui.navigation-pagination/config.ts +9 -0
  85. package/ui.navigation-progress/UProgress.vue +1 -1
  86. package/ui.navigation-progress/UStepperProgress.vue +1 -1
  87. package/ui.navigation-tab/UTab.vue +1 -1
  88. package/ui.navigation-tabs/UTabs.vue +1 -1
  89. package/ui.other-chip/UChip.vue +1 -1
  90. package/ui.other-dot/UDot.vue +1 -1
  91. package/ui.other-theme-color-toggle/UThemeColorToggle.vue +4 -4
  92. package/ui.other-theme-color-toggle/config.ts +2 -2
  93. package/ui.other-theme-color-toggle/tests/UThemeColorToggle.test.ts +10 -10
  94. package/ui.skeleton/USkeleton.vue +1 -1
  95. package/ui.skeleton-choice/USkeletonChoice.vue +1 -1
  96. package/ui.skeleton-input/USkeletonInput.vue +1 -1
  97. package/ui.skeleton-text/USkeletonText.vue +1 -1
  98. package/ui.text-alert/UAlert.vue +9 -1
  99. package/ui.text-alert/config.ts +4 -0
  100. package/ui.text-badge/UBadge.vue +1 -1
  101. package/ui.text-block/UText.vue +1 -1
  102. package/ui.text-block/config.ts +5 -4
  103. package/ui.text-empty/UEmpty.vue +1 -1
  104. package/ui.text-file/UFile.vue +1 -1
  105. package/ui.text-files/UFiles.vue +1 -1
  106. package/ui.text-header/UHeader.vue +1 -1
  107. package/ui.text-notify/UNotify.vue +1 -1
  108. package/ui.text-number/UNumber.vue +1 -1
  109. /package/{ui.form-color-picker → ui.form-color-toggle}/config.ts +0 -0
  110. /package/{ui.form-color-picker → ui.form-color-toggle}/storybook/docs.mdx +0 -0
  111. /package/{ui.form-color-picker → ui.form-color-toggle}/types.ts +0 -0
@@ -2,7 +2,7 @@
2
2
  import { watch, computed, useId, ref, useTemplateRef, nextTick } from "vue";
3
3
  import { isEqual } from "lodash-es";
4
4
 
5
- import useUI from "../composables/useUI";
5
+ import { useUI } from "../composables/useUI";
6
6
  import { getDefaults } from "../utils/ui";
7
7
  import { isMac } from "../utils/platform";
8
8
  import { filterOptions, filterGroups } from "./utilListbox";
@@ -110,6 +110,19 @@ const addOptionKeyCombination = computed(() => {
110
110
  return isMac ? "(⌘ + Enter)" : "(Ctrl + Enter)";
111
111
  });
112
112
 
113
+ const listboxAriaMultiselectable = computed(() => props.multiple || undefined);
114
+
115
+ const listboxAriaActivedescendant = computed(() =>
116
+ pointer.value >= 0 ? `${elementId}-${pointer.value}` : undefined,
117
+ );
118
+
119
+ const getOptionAriaSelected = (option: Option) => {
120
+ if (option && option.groupLabel) return undefined;
121
+ if (option.divider) return undefined;
122
+
123
+ return !!isSelectedOption(option);
124
+ };
125
+
113
126
  const filteredOptions = computed(() => {
114
127
  const normalizedSearch = searchModel.value.toLowerCase().trim();
115
128
 
@@ -337,6 +350,12 @@ function onInputSearchBlur(event: FocusEvent) {
337
350
  }
338
351
 
339
352
  defineExpose({
353
+ /**
354
+ * Current pointer index value.
355
+ * @property {Ref<number>}
356
+ */
357
+ pointer,
358
+
340
359
  /**
341
360
  * Allows setting the pointer to a specific index.
342
361
  * @property {Function}
@@ -442,14 +461,20 @@ const {
442
461
  @update:model-value="onSearchChange"
443
462
  />
444
463
 
445
- <ul :id="`listbox-${elementId}`" v-bind="listAttrs" role="listbox">
464
+ <ul
465
+ v-bind="listAttrs"
466
+ role="listbox"
467
+ :aria-multiselectable="listboxAriaMultiselectable"
468
+ :aria-activedescendant="listboxAriaActivedescendant"
469
+ >
446
470
  <li
447
471
  v-for="(option, index) of filteredOptions"
448
- :id="`${elementId}-${index}`"
449
472
  :key="index"
450
473
  v-bind="listItemAttrs"
451
474
  ref="option"
452
475
  :role="!(option && option.groupLabel) ? 'option' : undefined"
476
+ :aria-selected="getOptionAriaSelected(option)"
477
+ :aria-disabled="Boolean(option.disabled) || undefined"
453
478
  :data-group-label="Boolean(option.groupLabel)"
454
479
  >
455
480
  <UDivider v-if="option.divider" v-bind="optionDividerAttrs" />
@@ -505,10 +530,18 @@ const {
505
530
 
506
531
  <!-- group title -->
507
532
  <template v-if="option && (option.groupLabel || option.isSubGroup) && !option.isHidden">
508
- <div v-if="option.groupLabel" v-bind="groupAttrs" v-text="option.groupLabel" />
533
+ <div
534
+ v-if="option.groupLabel"
535
+ role="group"
536
+ :aria-label="option.groupLabel"
537
+ v-bind="groupAttrs"
538
+ v-text="option.groupLabel"
539
+ />
509
540
 
510
541
  <div
511
542
  v-else-if="option.isSubGroup"
543
+ role="group"
544
+ :aria-label="String(option[labelKey])"
512
545
  :style="getMarginForSubCategory(option.level)"
513
546
  v-bind="subGroupAttrs"
514
547
  v-text="option[labelKey]"
@@ -516,13 +549,7 @@ const {
516
549
  </template>
517
550
  </li>
518
551
 
519
- <li
520
- v-if="!filteredOptions.length"
521
- :id="`${elementId}-empty`"
522
- ref="empty-option"
523
- role="option"
524
- v-bind="optionAttrs"
525
- >
552
+ <li v-if="!filteredOptions.length" ref="empty-option" role="option" v-bind="optionAttrs">
526
553
  <!-- @slot Use it to add something instead of empty state. -->
527
554
  <slot name="empty">
528
555
  <span v-bind="optionContentAttrs" v-text="localeMessages.noDataToShow" />
@@ -532,7 +559,6 @@ const {
532
559
  <!-- Add button -->
533
560
  <template v-if="addOption">
534
561
  <li
535
- :id="`${elementId}-addOption`"
536
562
  ref="add-option"
537
563
  role="option"
538
564
  v-bind="addOptionLabelWrapperAttrs"
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, inject, onMounted, ref, watchEffect, toValue, useId } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import ULabel from "../ui.form-label/ULabel.vue";
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, provide, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import ULabel from "../ui.form-label/ULabel.vue";
@@ -7,7 +7,7 @@ import UListbox from "../ui.form-listbox/UListbox.vue";
7
7
  import UBadge from "../ui.text-badge/UBadge.vue";
8
8
  import ULink from "../ui.button-link/ULink.vue";
9
9
 
10
- import useUI from "../composables/useUI";
10
+ import { useUI } from "../composables/useUI";
11
11
  import { hasSlotContent } from "../utils/helper";
12
12
  import { getDefaults } from "../utils/ui";
13
13
  import { isMac } from "../utils/platform";
@@ -218,6 +218,28 @@ const toggleIconName = computed(() => {
218
218
  return props.toggleIcon ? config.value.defaults.toggleIcon : "";
219
219
  });
220
220
 
221
+ const ariaExpanded = computed(() => isOpen.value);
222
+
223
+ const ariaActiveDescendant = computed(() => {
224
+ if (!isOpen.value || !listboxRef.value) return undefined;
225
+ const pointer = listboxRef.value.pointer;
226
+
227
+ if (pointer === undefined || pointer < 0) return undefined;
228
+
229
+ return `${elementId}-${pointer}`;
230
+ });
231
+
232
+ const ariaInvalid = computed(() => Boolean(props.error) ?? undefined);
233
+
234
+ const ariaLabelledBy = computed(() => (props.label ? elementId : undefined));
235
+
236
+ const ariaDescribedBy = computed(() => {
237
+ if (props.error) return `error-${elementId}`;
238
+ if (props.description) return `description-${elementId}`;
239
+
240
+ return undefined;
241
+ });
242
+
221
243
  watch(localValue, setLabelPosition, { deep: true });
222
244
 
223
245
  onMounted(() => {
@@ -232,6 +254,10 @@ function onSearchChange(query: string) {
232
254
  emit("searchChange", query);
233
255
  }
234
256
 
257
+ function onSearchUpdate(query: string) {
258
+ emit("update:search", query);
259
+ }
260
+
235
261
  function onKeydownAddOption(event: KeyboardEvent) {
236
262
  if (!isOpen.value) return;
237
263
 
@@ -484,6 +510,7 @@ const {
484
510
  <template>
485
511
  <ULabel
486
512
  ref="labelComponent"
513
+ :for="elementId"
487
514
  :size="size"
488
515
  :label="label"
489
516
  :error="error"
@@ -515,7 +542,15 @@ const {
515
542
  ref="wrapper"
516
543
  :tabindex="searchable || disabled ? -1 : 0"
517
544
  role="combobox"
518
- :aria-owns="'listbox-' + elementId"
545
+ :aria-expanded="ariaExpanded"
546
+ aria-haspopup="listbox"
547
+ :aria-controls="`listbox-${elementId}`"
548
+ :aria-activedescendant="ariaActiveDescendant"
549
+ :aria-disabled="disabled || undefined"
550
+ :aria-invalid="ariaInvalid"
551
+ :aria-labelledby="ariaLabelledBy"
552
+ :aria-describedby="ariaDescribedBy"
553
+ :aria-autocomplete="searchable ? 'list' : undefined"
519
554
  v-bind="wrapperAttrs"
520
555
  @focus="activate"
521
556
  @blur="onBlur"
@@ -830,7 +865,7 @@ const {
830
865
  @blur="onListboxBlur"
831
866
  @search-blur="onListboxSearchBlur"
832
867
  @search-change="onSearchChange"
833
- @update:search="(value) => emit('update:search', value)"
868
+ @update:search="onSearchUpdate"
834
869
  >
835
870
  <template #before-option="{ option, index }">
836
871
  <!--
@@ -448,7 +448,9 @@ describe("USelect.vue", () => {
448
448
  },
449
449
  });
450
450
 
451
- expect(component.find("[vl-key='wrapper']").attributes("aria-owns")).toBe(`listbox-${id}`);
451
+ expect(component.find("[vl-key='wrapper']").attributes("aria-controls")).toBe(
452
+ `listbox-${id}`,
453
+ );
452
454
  });
453
455
 
454
456
  it("Data Test – applies the correct data-test attributes", async () => {
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { computed, useId, useTemplateRef } from "vue";
2
+ import { computed, useId, useSlots, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
  import { useComponentLocaleMessages } from "../composables/useComponentLocaleMassages";
7
7
 
@@ -29,7 +29,7 @@ const emit = defineEmits([
29
29
  "update:modelValue",
30
30
  ]);
31
31
 
32
- const wrapperRef = useTemplateRef<HTMLLabelElement>("wrapper");
32
+ const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
33
33
 
34
34
  const { localeMessages } = useComponentLocaleMessages<typeof defaultConfig.i18n>(
35
35
  COMPONENT_NAME,
@@ -42,8 +42,14 @@ const checkedValue = computed({
42
42
  set: (value) => emit("update:modelValue", value),
43
43
  });
44
44
 
45
+ const slots = useSlots();
46
+
45
47
  const elementId = props.id || useId();
46
48
 
49
+ const hasLabel = computed(() => Boolean(props.label || slots.label));
50
+
51
+ const inputAriaLabelledBy = computed(() => (hasLabel.value ? elementId : undefined));
52
+
47
53
  const switchLabel = computed(() => {
48
54
  return checkedValue.value ? localeMessages.value.active : localeMessages.value.inactive;
49
55
  });
@@ -62,7 +68,8 @@ function toggle() {
62
68
  }
63
69
  }
64
70
 
65
- function onClickToggle() {
71
+ function onClickToggle(event: Event) {
72
+ event.stopPropagation();
66
73
  toggle();
67
74
  }
68
75
 
@@ -70,10 +77,14 @@ function onKeydownSpace() {
70
77
  toggle();
71
78
  }
72
79
 
80
+ function onClickWrapper() {
81
+ toggle();
82
+ }
83
+
73
84
  defineExpose({
74
85
  /**
75
86
  * A reference to the component's wrapper element for direct DOM manipulation.
76
- * @property {HTMLLabelElement}
87
+ * @property {HTMLDivElement}
77
88
  */
78
89
  wrapperRef,
79
90
  });
@@ -118,13 +129,13 @@ const {
118
129
  <slot name="label" :label="label" />
119
130
  </template>
120
131
 
121
- <label
132
+ <div
122
133
  ref="wrapper"
123
134
  tabindex="0"
124
- :for="elementId"
125
135
  v-bind="wrapperAttrs"
126
136
  @keydown.enter="onKeydownSpace"
127
137
  @keydown.space.prevent="onKeydownSpace"
138
+ @click="onClickWrapper"
128
139
  >
129
140
  <input
130
141
  :id="elementId"
@@ -132,6 +143,8 @@ const {
132
143
  tabindex="-1"
133
144
  type="checkbox"
134
145
  :disabled="disabled"
146
+ :aria-labelledby="inputAriaLabelledBy"
147
+ :aria-label="!hasLabel ? localeMessages.switch : undefined"
135
148
  v-bind="inputAttrs"
136
149
  @click="onClickToggle"
137
150
  />
@@ -146,6 +159,6 @@ const {
146
159
  </span>
147
160
 
148
161
  <span v-if="toggleLabel" v-bind="toggleLabelAttrs" v-text="switchLabel" />
149
- </label>
162
+ </div>
150
163
  </ULabel>
151
164
  </template>
@@ -74,7 +74,9 @@ export default /*tw*/ {
74
74
  },
75
75
  ],
76
76
  },
77
+ /* These are used for a11y. */
77
78
  i18n: {
79
+ switch: "Switch",
78
80
  inactive: "Off",
79
81
  active: "On",
80
82
  },
@@ -106,7 +106,7 @@ describe("USwitch.vue", () => {
106
106
  },
107
107
  });
108
108
 
109
- expect(component.find("label").attributes("class")).toContain(color);
109
+ expect(component.get("[vl-key='wrapper']").attributes("class")).toContain(`bg-${color}`);
110
110
  });
111
111
  });
112
112
 
@@ -169,7 +169,9 @@ describe("USwitch.vue", () => {
169
169
  const labelComponent = component.findComponent(ULabel);
170
170
 
171
171
  expect(labelComponent.props("disabled")).toBe(true);
172
- expect(component.find("label").attributes("class")).toContain("pointer-events-none");
172
+ expect(component.get("[vl-key='wrapper']").attributes("class")).toContain(
173
+ "pointer-events-none",
174
+ );
173
175
  });
174
176
 
175
177
  it("Id – applies the correct id attribute", () => {
@@ -210,7 +212,7 @@ describe("USwitch.vue", () => {
210
212
  },
211
213
  });
212
214
 
213
- expect(component.findAll("label")[1].text()).toBe(customLabelContent);
215
+ expect(component.find("label").text()).toBe(customLabelContent);
214
216
  });
215
217
 
216
218
  it("Label – exposes label prop to slot", () => {
@@ -225,7 +227,7 @@ describe("USwitch.vue", () => {
225
227
  },
226
228
  });
227
229
 
228
- expect(component.findAll("label")[1].text()).toBe(`Modified ${defaultLabel}`);
230
+ expect(component.find("label").text()).toBe(`Modified ${defaultLabel}`);
229
231
  });
230
232
  });
231
233
 
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, nextTick, onMounted, ref, watch, useSlots, useId, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
  import { hasSlotContent } from "../utils/helper";
7
7
 
@@ -63,7 +63,7 @@ const elementId = props.id || useId();
63
63
  const textareaRef = useTemplateRef<HTMLTextAreaElement>("textarea");
64
64
  const labelComponentRef = useTemplateRef<InstanceType<typeof ULabel>>("labelComponent");
65
65
  const leftSlotWrapperRef = useTemplateRef<HTMLDivElement>("leftSlotWrapper");
66
- const wrapperRef = useTemplateRef<HTMLLabelElement>("wrapper");
66
+ const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
67
67
 
68
68
  const currentRows = ref(Number(props.rows));
69
69
 
@@ -192,10 +192,14 @@ function onMousedown() {
192
192
  emit("mousedown");
193
193
  }
194
194
 
195
+ function onSlotClick() {
196
+ textareaRef.value?.focus();
197
+ }
198
+
195
199
  defineExpose({
196
200
  /**
197
201
  * A reference to the component's wrapper element for direct DOM manipulation.
198
- * @property {HTMLLabelElement}
202
+ * @property {HTMLDivElement}
199
203
  */
200
204
  wrapperRef,
201
205
 
@@ -246,12 +250,13 @@ const {
246
250
  <slot name="label" :label="label" />
247
251
  </template>
248
252
 
249
- <label ref="wrapper" :for="elementId" v-bind="wrapperAttrs">
253
+ <div ref="wrapper" v-bind="wrapperAttrs">
250
254
  <span
251
255
  v-if="hasSlotContent($slots['left'])"
252
256
  ref="leftSlotWrapper"
253
257
  :for="elementId"
254
258
  v-bind="leftSlotAttrs"
259
+ @click="onSlotClick"
255
260
  >
256
261
  <!-- @slot Use it to add something before the text. -->
257
262
  <slot name="left" />
@@ -277,10 +282,15 @@ const {
277
282
  @click="onClick"
278
283
  />
279
284
 
280
- <span v-if="hasSlotContent($slots['right'])" :for="elementId" v-bind="rightSlotAttrs">
285
+ <span
286
+ v-if="hasSlotContent($slots['right'])"
287
+ :for="elementId"
288
+ v-bind="rightSlotAttrs"
289
+ @click="onSlotClick"
290
+ >
281
291
  <!-- @slot Use it to add something after the text. -->
282
292
  <slot name="right" />
283
293
  </span>
284
- </label>
294
+ </div>
285
295
  </ULabel>
286
296
  </template>
@@ -528,7 +528,7 @@ describe("UTextarea.vue", () => {
528
528
  });
529
529
 
530
530
  expect(component.vm.wrapperRef).toBeDefined();
531
- expect(component.vm.wrapperRef!.tagName).toBe("LABEL");
531
+ expect(component.vm.wrapperRef!.tagName).toBe("DIV");
532
532
  });
533
533
 
534
534
  it("Textarea Element – exposes textarea element ref", () => {
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import UIcon from "../ui.image-icon/UIcon.vue";
@@ -2,7 +2,7 @@
2
2
  import { computed, defineAsyncComponent, useTemplateRef } from "vue";
3
3
  import { cachedIcons } from "virtual:vueless/icons";
4
4
 
5
- import useUI from "../composables/useUI";
5
+ import { useUI } from "../composables/useUI";
6
6
  import { getDefaults } from "../utils/ui";
7
7
  import { ICONS_CACHED_DIR, INTERNAL_ICONS_LIBRARY, STORYBOOK_ICONS_LIBRARY } from "../constants";
8
8
 
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import { COMPONENT_NAME, ELLIPSES_AMOUNT } from "./constants";
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, onMounted, onUnmounted, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import ULoader from "../ui.loader/ULoader.vue";
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, watch, ref, useTemplateRef, onBeforeMount, onBeforeUnmount } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
  import { getRequestWithoutQuery } from "../utils/requestQueue";
7
7
 
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import defaultConfig from "./config";
@@ -2,8 +2,9 @@
2
2
  import { computed, useTemplateRef } from "vue";
3
3
  import { range } from "lodash-es";
4
4
 
5
- import useUI from "../composables/useUI";
5
+ import { useUI } from "../composables/useUI";
6
6
  import { getDefaults } from "../utils/ui";
7
+ import { useComponentLocaleMessages } from "../composables/useComponentLocaleMassages";
7
8
 
8
9
  import UButton from "../ui.button/UButton.vue";
9
10
  import UIcon from "../ui.image-icon/UIcon.vue";
@@ -32,6 +33,12 @@ const emit = defineEmits([
32
33
  "update:modelValue",
33
34
  ]);
34
35
 
36
+ const { localeMessages } = useComponentLocaleMessages<typeof defaultConfig.i18n>(
37
+ COMPONENT_NAME,
38
+ defaultConfig.i18n,
39
+ props?.config?.i18n,
40
+ );
41
+
35
42
  const paginationRef = useTemplateRef<HTMLDivElement>("pagination");
36
43
 
37
44
  const currentPage = computed({
@@ -133,6 +140,7 @@ const {
133
140
  :label="firstLabel"
134
141
  :square="!firstLabel"
135
142
  :disabled="prevIsDisabled"
143
+ :aria-label="firstLabel || localeMessages.first"
136
144
  v-bind="firstButtonAttrs"
137
145
  :data-test="getDataTest('first')"
138
146
  @click="goToFirstPage"
@@ -156,6 +164,7 @@ const {
156
164
  :label="prevLabel"
157
165
  :square="!prevLabel"
158
166
  :disabled="prevIsDisabled"
167
+ :aria-label="prevLabel || localeMessages.prev"
159
168
  v-bind="prevButtonAttrs"
160
169
  :data-test="getDataTest('prev')"
161
170
  @click="goToPrevPage"
@@ -185,6 +194,8 @@ const {
185
194
  :variant="variant"
186
195
  :label="String(page.number)"
187
196
  :disabled="disabled"
197
+ :aria-label="`${localeMessages.currentPage} ${page.number}`"
198
+ :aria-current="true"
188
199
  v-bind="activeButtonAttrs"
189
200
  :data-test="getDataTest('active')"
190
201
  />
@@ -194,6 +205,7 @@ const {
194
205
  variant="ghost"
195
206
  :label="String(page.number)"
196
207
  :disabled="disabled"
208
+ :aria-label="`${localeMessages.goToPage} ${page.number}`"
197
209
  v-bind="inactiveButtonAttrs"
198
210
  :data-test="getDataTest('inactive')"
199
211
  @click="selectPage(page.number)"
@@ -205,6 +217,7 @@ const {
205
217
  :label="nextLabel"
206
218
  :square="!nextLabel"
207
219
  :disabled="nextIsDisabled"
220
+ :aria-label="nextLabel || localeMessages.next"
208
221
  v-bind="nextButtonAttrs"
209
222
  :data-test="getDataTest('next')"
210
223
  @click="goToNextPage"
@@ -229,6 +242,7 @@ const {
229
242
  :label="lastLabel"
230
243
  :square="!lastLabel"
231
244
  :disabled="nextIsDisabled"
245
+ :aria-label="lastLabel || localeMessages.last"
232
246
  v-bind="lastButtonAttrs"
233
247
  :data-test="getDataTest('last')"
234
248
  @click="goToLastPage"
@@ -34,6 +34,15 @@ export default /*tw*/ {
34
34
  firstIcon: "{>paginationIcon}",
35
35
  prevIcon: "{>paginationIcon}",
36
36
  nextIcon: "{>paginationIcon}",
37
+ /* These are used for a11y. */
38
+ i18n: {
39
+ first: "Go to first page",
40
+ last: "Go to last page",
41
+ prev: "Go to previous page",
42
+ next: "Go to next page",
43
+ currentPage: "Current page, page",
44
+ goToPage: "Go to page",
45
+ },
37
46
  defaults: {
38
47
  variant: "solid",
39
48
  size: "md",
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import defaultConfig from "./config";
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
 
6
6
  import defaultConfig from "./config";
7
7
 
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, inject, toValue, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
  import UButton from "../ui.button/UButton.vue";
7
7
 
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, computed, provide, onMounted, onUnmounted, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import UTab from "../ui.navigation-tab/UTab.vue";
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import defaultConfig from "./config";
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { useTemplateRef } from "vue";
3
3
 
4
- import useUI from "../composables/useUI";
4
+ import { useUI } from "../composables/useUI";
5
5
  import { getDefaults } from "../utils/ui";
6
6
 
7
7
  import { COMPONENT_NAME } from "./constants";