@imaginario27/air-ui-ds 1.13.7 → 1.13.8

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.
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <div
3
+ :id="id"
3
4
  role="group"
4
- aria-label="Options"
5
+ :aria-label="ariaLabel || 'Options'"
5
6
  :class="[
6
7
  'flex',
7
8
  'flex-wrap gap-2',
@@ -28,6 +29,8 @@
28
29
 
29
30
  <script setup lang="ts">
30
31
  const props = defineProps({
32
+ id: String as PropType<string>,
33
+ ariaLabel: String as PropType<string>,
31
34
  modelValue: {
32
35
  type: [String, Number, Array] as PropType<string | number | string[]>,
33
36
  default: 'button-1',
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <div
3
+ :id="id"
3
4
  role="group"
4
- aria-label="Toggle options"
5
+ :aria-label="ariaLabel || 'Toggle options'"
5
6
  :class="[
6
7
  'flex',
7
8
  groupStyle === ToggleButtonGroupStyle.GROUPED ? 'border border-border-default' : 'flex-wrap gap-3',
@@ -51,6 +52,8 @@
51
52
  <script setup lang="ts">
52
53
  // Props
53
54
  defineProps({
55
+ id: String as PropType<string>,
56
+ ariaLabel: String as PropType<string>,
54
57
  modelValue: {
55
58
  type: String as PropType<string>,
56
59
  default: 'button-1',
@@ -17,10 +17,11 @@
17
17
  <template #activator="{ isOpen }">
18
18
  <!-- Select Box -->
19
19
  <div
20
+ :id="id"
20
21
  role="combobox"
21
22
  :aria-expanded="isOpen"
22
23
  aria-haspopup="listbox"
23
- :aria-label="placeholder"
24
+ :aria-label="ariaLabel || placeholder"
24
25
  :tabindex="disabled ? -1 : 0"
25
26
  :class="[
26
27
  'select-box',
@@ -221,6 +222,7 @@ import missingImagePlaceholder from '@/assets/images/placeholders/missing-image-
221
222
  // Props
222
223
  const props = defineProps({
223
224
  id: String as PropType<string>,
225
+ ariaLabel: String as PropType<string>,
224
226
  options: {
225
227
  type: Array as PropType<SelectOption[]>,
226
228
  default: () => [
@@ -5,6 +5,7 @@
5
5
  type="checkbox"
6
6
  :checked="modelValue"
7
7
  class="sr-only"
8
+ :aria-label="ariaLabel || id"
8
9
  :disabled="disabled"
9
10
  @change="handleNativeChange"
10
11
  @keydown.space.prevent="toggleCheckbox"
@@ -13,7 +14,7 @@
13
14
  <div
14
15
  role="checkbox"
15
16
  :aria-checked="modelValue"
16
- :aria-label="id"
17
+ :aria-label="ariaLabel || id"
17
18
  :class="[
18
19
  'flex items-center justify-center',
19
20
  controlFieldSizeClass,
@@ -43,6 +44,7 @@ const props = defineProps({
43
44
  type: String as PropType<string>,
44
45
  required: true,
45
46
  },
47
+ ariaLabel: String as PropType<string>,
46
48
  modelValue: {
47
49
  type: Boolean as PropType<boolean>,
48
50
  default: false,
@@ -13,6 +13,7 @@
13
13
  {{ label }}
14
14
  </label>
15
15
  <ActionButton
16
+ :aria-label="!label ? ariaLabel : undefined"
16
17
  :text
17
18
  :size
18
19
  :icon
@@ -40,6 +41,7 @@ const props = defineProps({
40
41
  required: true,
41
42
  },
42
43
  label: String as PropType<string>,
44
+ ariaLabel: String as PropType<string>,
43
45
  actionType: {
44
46
  type: String as PropType<ButtonActionType>,
45
47
  default: ButtonActionType.ACTION,
@@ -21,7 +21,7 @@
21
21
  >
22
22
  <!-- Label (inverted)-->
23
23
  <label
24
- v-if="inverse"
24
+ v-if="inverse && label"
25
25
  :for="id"
26
26
  :class="[
27
27
  disabled && 'text-text-neutral-disabled',
@@ -32,6 +32,7 @@
32
32
 
33
33
  <Checkbox
34
34
  :id="id"
35
+ :ariaLabel="!label ? (ariaLabel || legend) : undefined"
35
36
  :modelValue="modelValue"
36
37
  :disabled="disabled"
37
38
  :size="size"
@@ -40,7 +41,7 @@
40
41
 
41
42
  <!-- Label (natural position) -->
42
43
  <label
43
- v-if="!inverse"
44
+ v-if="!inverse && label"
44
45
  :for="id"
45
46
  :class="[
46
47
  disabled && 'text-text-neutral-disabled',
@@ -75,6 +76,7 @@ const props = defineProps({
75
76
  type: String as PropType<string>,
76
77
  default: 'Text',
77
78
  },
79
+ ariaLabel: String as PropType<string>,
78
80
  legend: String as PropType<string>,
79
81
  helpText: String as PropType<string>,
80
82
  modelValue: {
@@ -37,6 +37,7 @@
37
37
  v-if="hasCopyToClipboardButton"
38
38
  icon="mdi:content-copy"
39
39
  :size="ButtonSize.XS"
40
+ :ariaLabel="copyButtonAriaLabel"
40
41
  @click="handleCopyToClipboard"
41
42
  />
42
43
  </div>
@@ -76,6 +77,7 @@ const props = defineProps({
76
77
  required: true,
77
78
  },
78
79
  label: String as PropType<string>,
80
+ ariaLabel: String as PropType<string>,
79
81
  text: [String, Number] as PropType<string | number>,
80
82
  emptyText: {
81
83
  type: String as PropType<string>,
@@ -101,6 +103,18 @@ const isEmpty = computed(() => {
101
103
  return props.text === '' || props.text === null || props.text === undefined || props.text === 0
102
104
  })
103
105
 
106
+ const copyButtonAriaLabel = computed(() => {
107
+ if (props.ariaLabel) {
108
+ return props.ariaLabel
109
+ }
110
+
111
+ if (props.label) {
112
+ return `Copy ${props.label}`
113
+ }
114
+
115
+ return 'Copy value'
116
+ })
117
+
104
118
  // Toast
105
119
  const { $toast } = useNuxtApp()
106
120
 
@@ -25,7 +25,7 @@
25
25
  >
26
26
  <img
27
27
  :src="previewImageUrl"
28
- :alt="label || 'Preview'"
28
+ :alt="label || ariaLabel || 'Preview'"
29
29
  class="w-full h-full object-cover rounded-md"
30
30
  @error="handlePreviewError"
31
31
  >
@@ -43,6 +43,7 @@
43
43
  v-model="selectedFiles"
44
44
  v-model:total-progress="localTotalProgress"
45
45
  :title="computedTitleText"
46
+ :aria-label="!label ? ariaLabel : undefined"
46
47
  :description="computedDescriptionText"
47
48
  :singleFileTitleText
48
49
  :icon
@@ -124,6 +125,7 @@ const props = defineProps({
124
125
  required: true,
125
126
  },
126
127
  label: String as PropType<string>,
128
+ ariaLabel: String as PropType<string>,
127
129
  title: {
128
130
  type: String as PropType<string>,
129
131
  default: 'Drag and drop files here',
@@ -52,6 +52,7 @@
52
52
  <input
53
53
  :id
54
54
  :type="props.type === 'password' ? passwordInputType : props.type"
55
+ :aria-label="!label ? ariaLabel : undefined"
55
56
  :placeholder
56
57
  :value="modelValue"
57
58
  :maxlength="maxLength"
@@ -154,6 +155,7 @@ const props = defineProps({
154
155
  required: true,
155
156
  },
156
157
  label: String as PropType<string>,
158
+ ariaLabel: String as PropType<string>,
157
159
  type: {
158
160
  type: String as PropType<AllowedInputType>,
159
161
  default: 'text',
@@ -21,6 +21,8 @@
21
21
  </label>
22
22
 
23
23
  <OptionButtonGroup
24
+ :id
25
+ :ariaLabel="!label ? ariaLabel : label"
24
26
  :buttons
25
27
  :modelValue
26
28
  :disabled
@@ -55,6 +57,7 @@ const props = defineProps({
55
57
  required: true,
56
58
  },
57
59
  label: String as PropType<string>,
60
+ ariaLabel: String as PropType<string>,
58
61
  helpText: String as PropType<string>,
59
62
  buttons: Array as PropType<OptionButton[]>,
60
63
  modelValue: {
@@ -27,6 +27,7 @@
27
27
  :key="index"
28
28
  :ref="el => setInputRef(el, index)"
29
29
  type="text"
30
+ :aria-label="getInputAriaLabel(index)"
30
31
  :inputmode="type === 'number' ? 'numeric' : 'text'"
31
32
  maxlength="1"
32
33
  :value="displayValue(value)"
@@ -93,6 +94,7 @@ const props = defineProps({
93
94
  validator: (value: InputSize) => Object.values(InputSize).includes(value),
94
95
  },
95
96
  label: String as PropType<string>,
97
+ ariaLabel: String as PropType<string>,
96
98
  placeholder: String as PropType<string>,
97
99
  helpText: String as PropType<string>,
98
100
  mask: {
@@ -280,6 +282,11 @@ const displayValue = (value: string) => {
280
282
  return value
281
283
  }
282
284
 
285
+ const getInputAriaLabel = (index: number) => {
286
+ const baseLabel = props.label || props.ariaLabel || 'PIN code'
287
+ return `${baseLabel} ${index + 1}`
288
+ }
289
+
283
290
  const setInputRef = (el: Element | ComponentPublicInstance | null, index: number) => {
284
291
  if (!el) return
285
292
  inputs.value[index] = el as HTMLInputElement
@@ -21,6 +21,7 @@
21
21
  :styleType="ButtonStyleType.NEUTRAL_OUTLINED"
22
22
  icon="mdi:plus-circle-outline"
23
23
  :size="ButtonSize.SM"
24
+ :ariaLabel="addItemAriaLabel"
24
25
  @click="addItem"
25
26
  />
26
27
 
@@ -30,6 +31,7 @@
30
31
  :styleType="ButtonStyleType.DELETE_SOFT"
31
32
  icon="mdi:minus-circle-outline"
32
33
  :size="ButtonSize.SM"
34
+ :ariaLabel="removeItemAriaLabel"
33
35
  @click="removeItem(index)"
34
36
  />
35
37
  </div>
@@ -47,6 +49,14 @@ const props = defineProps({
47
49
  type: Object,
48
50
  default: () => ({}),
49
51
  },
52
+ addItemAriaLabel: {
53
+ type: String as PropType<string>,
54
+ default: 'Add item',
55
+ },
56
+ removeItemAriaLabel: {
57
+ type: String as PropType<string>,
58
+ default: 'Remove item',
59
+ },
50
60
  })
51
61
 
52
62
  const emit = defineEmits(['update:modelValue'])
@@ -28,6 +28,7 @@
28
28
  >
29
29
  <SelectField
30
30
  :id="`${id}-item-${index}`"
31
+ :ariaLabel="`${itemFieldAriaLabel} ${index + 1}`"
31
32
  :modelValue="rule.item"
32
33
  :options="itemOptions"
33
34
  :placeholder="itemPlaceholder"
@@ -37,6 +38,7 @@
37
38
 
38
39
  <SelectField
39
40
  :id="`${id}-operator-${index}`"
41
+ :ariaLabel="`${operatorFieldAriaLabel} ${index + 1}`"
40
42
  :modelValue="rule.operator"
41
43
  :options="getFilteredOperators(getRuleInputType(rule))"
42
44
  :placeholder="operatorPlaceholder"
@@ -46,6 +48,7 @@
46
48
 
47
49
  <InputField
48
50
  :id="`${id}-value-${index}`"
51
+ :ariaLabel="`${valueFieldAriaLabel} ${index + 1}`"
49
52
  :modelValue="rule.value"
50
53
  :type="getRuleInputType(rule)"
51
54
  :placeholder="valuePlaceholder"
@@ -57,6 +60,7 @@
57
60
  <ActionIconButton
58
61
  :id="`${id}-action-${index}`"
59
62
  :icon="getRowActionIcon(index)"
63
+ :ariaLabel="index === rules.length - 1 ? addRuleAriaLabel : removeRuleAriaLabel"
60
64
  :styleType="getActionButtonStyle(index)"
61
65
  :size="ButtonSize.MD"
62
66
  :disabled="isActionDisabled(index)"
@@ -100,6 +104,26 @@ const props = defineProps({
100
104
  required: true,
101
105
  },
102
106
  label: String as PropType<string>,
107
+ itemFieldAriaLabel: {
108
+ type: String as PropType<string>,
109
+ default: 'Rule item',
110
+ },
111
+ operatorFieldAriaLabel: {
112
+ type: String as PropType<string>,
113
+ default: 'Rule operator',
114
+ },
115
+ valueFieldAriaLabel: {
116
+ type: String as PropType<string>,
117
+ default: 'Rule value',
118
+ },
119
+ addRuleAriaLabel: {
120
+ type: String as PropType<string>,
121
+ default: 'Add rule',
122
+ },
123
+ removeRuleAriaLabel: {
124
+ type: String as PropType<string>,
125
+ default: 'Remove rule',
126
+ },
103
127
  helpText: String as PropType<string>,
104
128
  itemOptions: {
105
129
  type: Array as PropType<SelectOption[]>,
@@ -45,6 +45,7 @@
45
45
  <!-- Input -->
46
46
  <input
47
47
  :id
48
+ :aria-label="!label ? ariaLabel : undefined"
48
49
  :placeholder
49
50
  :value="modelValue"
50
51
  :maxlength="maxLength"
@@ -93,6 +94,7 @@ const props = defineProps({
93
94
  required: true,
94
95
  },
95
96
  label: String as PropType<string>,
97
+ ariaLabel: String as PropType<string>,
96
98
  placeholder: {
97
99
  type: String as PropType<string>,
98
100
  default: 'Search',
@@ -30,6 +30,7 @@
30
30
  <DropdownSelect
31
31
  :id
32
32
  :key="computedPlaceholder"
33
+ :ariaLabel="!label ? ariaLabel : undefined"
33
34
  :modelValue
34
35
  :options
35
36
  :type
@@ -71,6 +72,7 @@ const props = defineProps({
71
72
  required: true,
72
73
  },
73
74
  label: String as PropType<string>,
75
+ ariaLabel: String as PropType<string>,
74
76
  helpText: String as PropType<string>,
75
77
  required: {
76
78
  type: Boolean as PropType<boolean>,
@@ -73,6 +73,7 @@
73
73
 
74
74
  <Slider
75
75
  :modelValue="modelValue"
76
+ :ariaLabel="!label ? ariaLabel : label"
76
77
  :type="type"
77
78
  :color="color"
78
79
  :size="size"
@@ -155,6 +156,7 @@ const props = defineProps({
155
156
  required: true,
156
157
  },
157
158
  label: String as PropType<string>,
159
+ ariaLabel: String as PropType<string>,
158
160
  helpText: String as PropType<string>,
159
161
  required: {
160
162
  type: Boolean as PropType<boolean>,
@@ -21,6 +21,7 @@
21
21
  >
22
22
  <slot
23
23
  :id
24
+ :ariaLabel
24
25
  :error
25
26
  :hasError
26
27
  :helpText
@@ -50,6 +51,7 @@ const props = defineProps({
50
51
  required: true,
51
52
  },
52
53
  label: String as PropType<string>,
54
+ ariaLabel: String as PropType<string>,
53
55
  helpText: String as PropType<string>,
54
56
  error: {
55
57
  type: String as PropType<string>,
@@ -60,6 +60,7 @@
60
60
  type="checkbox"
61
61
  :checked="modelValue"
62
62
  class="sr-only"
63
+ :aria-label="ariaLabel || label || legend || 'Toggle'"
63
64
  :disabled="disabled"
64
65
  @change="handleChange"
65
66
  @keydown.space.prevent="toggleCheckbox"
@@ -69,7 +70,7 @@
69
70
  <div
70
71
  role="switch"
71
72
  :aria-checked="modelValue"
72
- :aria-label="label || legend || 'Toggle'"
73
+ :aria-label="ariaLabel || label || legend || 'Toggle'"
73
74
  :class="[
74
75
  'relative flex items-center',
75
76
  controlFieldSizeClass,
@@ -114,6 +115,7 @@ const props = defineProps({
114
115
  required: true,
115
116
  },
116
117
  label: String as PropType<string>,
118
+ ariaLabel: String as PropType<string>,
117
119
  legend: String as PropType<string>,
118
120
  helpText: String as PropType<string>,
119
121
 
@@ -64,6 +64,7 @@
64
64
  :id
65
65
  ref="inputRef"
66
66
  type="text"
67
+ :aria-label="!label ? ariaLabel : undefined"
67
68
  :value="inputValue"
68
69
  :placeholder="computedPlaceholder"
69
70
  :autofocus
@@ -116,6 +117,7 @@ const props = defineProps({
116
117
  required: true,
117
118
  },
118
119
  label: String as PropType<string>,
120
+ ariaLabel: String as PropType<string>,
119
121
  placeholder: {
120
122
  type: String as PropType<string>,
121
123
  default: 'Enter values separated by commas',
@@ -36,6 +36,7 @@
36
36
  <textarea
37
37
  :id
38
38
  ref="textareaRef"
39
+ :aria-label="!label ? ariaLabel : undefined"
39
40
  :placeholder
40
41
  :value="modelValue"
41
42
  :maxlength="maxLength"
@@ -104,6 +105,7 @@ const props = defineProps({
104
105
  required: true,
105
106
  },
106
107
  label: String as PropType<string>,
108
+ ariaLabel: String as PropType<string>,
107
109
  placeholder: {
108
110
  type: String as PropType<string>,
109
111
  default: 'Placeholder',
@@ -20,6 +20,8 @@
20
20
  </label>
21
21
 
22
22
  <ToggleButtonGroup
23
+ :id
24
+ :ariaLabel="!label ? ariaLabel : label"
23
25
  :buttons
24
26
  :modelValue
25
27
  :groupStyle
@@ -49,6 +51,7 @@ defineProps({
49
51
  required: true,
50
52
  },
51
53
  label: String as PropType<string>,
54
+ ariaLabel: String as PropType<string>,
52
55
  helpText: String as PropType<string>,
53
56
  buttons: Array as PropType<ToggleButton[] | ToggleIconButton[]>,
54
57
  onlyIcon: {
@@ -76,7 +76,8 @@
76
76
  :name="name"
77
77
  :value="value"
78
78
  :checked="modelValue === value"
79
- class="hidden"
79
+ class="sr-only"
80
+ :aria-label="!label ? ariaLabel : undefined"
80
81
  :disabled
81
82
  @change="selectRadio"
82
83
  >
@@ -120,6 +121,7 @@ const props = defineProps({
120
121
  required: true,
121
122
  },
122
123
  label: String as PropType<string>,
124
+ ariaLabel: String as PropType<string>,
123
125
  helpText: String as PropType<string>,
124
126
  value: { // Value of the radio button
125
127
  type: [String, Number, Boolean] as PropType<string | number | boolean>,
@@ -10,7 +10,7 @@
10
10
  >
11
11
  <!-- Label (inverted position) -->
12
12
  <label
13
- v-if="inverse"
13
+ v-if="inverse && label"
14
14
  :for="id"
15
15
  :class="[
16
16
  disabled && 'text-text-neutral-disabled',
@@ -26,7 +26,8 @@
26
26
  :name="name"
27
27
  :value="value"
28
28
  :checked="modelValue === value"
29
- class="hidden"
29
+ class="sr-only"
30
+ :aria-label="!label ? ariaLabel : undefined"
30
31
  :disabled="disabled"
31
32
  @change="selectRadio"
32
33
  >
@@ -58,7 +59,7 @@
58
59
 
59
60
  <!-- Label (natural position) -->
60
61
  <label
61
- v-if="!inverse"
62
+ v-if="!inverse && label"
62
63
  :for="id"
63
64
  :class="[
64
65
  disabled ? 'text-text-neutral-disabled' : undefined,
@@ -97,10 +98,8 @@ const props = defineProps({
97
98
  type: [String, Number, Boolean] as PropType<string | number | boolean>,
98
99
  required: true,
99
100
  },
100
- label: {
101
- type: String as PropType<string>,
102
- default: 'Text',
103
- },
101
+ label: String as PropType<string>,
102
+ ariaLabel: String as PropType<string>,
104
103
  helpText: String as PropType<string>,
105
104
  required: {
106
105
  type: Boolean as PropType<boolean>,
@@ -33,6 +33,7 @@
33
33
  :name
34
34
  :value="option.value"
35
35
  :label="option.label"
36
+ :ariaLabel="option.ariaLabel"
36
37
  :required
37
38
  :disabled="option.disabled ? option.disabled : disabled"
38
39
  :helpText="option.helpText"
@@ -49,6 +50,7 @@
49
50
  :name
50
51
  :value="option.value"
51
52
  :label="option.label"
53
+ :ariaLabel="option.ariaLabel"
52
54
  :required
53
55
  :helpText="option.helpText"
54
56
  :disabled="option.disabled ? option.disabled : disabled"
@@ -83,7 +85,7 @@ const props = defineProps({
83
85
  type: Array as PropType<RadioOption[]>,
84
86
  required: true,
85
87
  validator: (value: RadioOption[]) =>
86
- value.every((option) => option.id !== undefined && option.value !== undefined && option.label !== undefined),
88
+ value.every((option) => option.id !== undefined && option.value !== undefined && (option.label !== undefined || option.ariaLabel !== undefined)),
87
89
  },
88
90
  modelValue: {
89
91
  type: [String, Number, Boolean, null] as PropType<string | number | boolean | null>,
@@ -49,7 +49,7 @@
49
49
  ]"
50
50
  :style="[thumbStyle(index, value), radiusStyle]"
51
51
  :disabled
52
- :aria-label="isRange ? `Slider thumb ${index + 1}` : 'Slider thumb'"
52
+ :aria-label="getThumbAriaLabel(index)"
53
53
  :aria-orientation="orientation"
54
54
  :data-testid="`slider-thumb-${index}`"
55
55
  @pointerdown.stop.prevent="startThumbDrag(index, $event)"
@@ -75,6 +75,7 @@
75
75
  <script setup lang="ts">
76
76
  // Props
77
77
  const props = defineProps({
78
+ ariaLabel: String as PropType<string>,
78
79
  modelValue: {
79
80
  type: [Number, Array] as PropType<number | [number, number]>,
80
81
  default: 0,
@@ -141,6 +142,16 @@ const isRange = computed(() => {
141
142
  return props.type === SliderType.RANGE || props.multiple || Array.isArray(props.modelValue)
142
143
  })
143
144
 
145
+ const getThumbAriaLabel = (index: number) => {
146
+ const baseLabel = props.ariaLabel || 'Slider'
147
+
148
+ if (!isRange.value) {
149
+ return `${baseLabel} thumb`
150
+ }
151
+
152
+ return `${baseLabel} thumb ${index + 1}`
153
+ }
154
+
144
155
  const safeMax = computed(() => {
145
156
  if (props.max <= props.min) {
146
157
  return props.min + 1
@@ -1,7 +1,8 @@
1
1
  export interface RadioOption {
2
2
  id: string | number
3
3
  value: string | number | boolean
4
- label: string
4
+ label?: string
5
+ ariaLabel?: string
5
6
  helpText?: string
6
7
  disabled?: boolean
7
8
  type?: ColorAccent.INFO | ColorAccent.SUCCESS | ColorAccent.DANGER | ColorAccent.PRIMARY_BRAND | ColorAccent.SECONDARY_BRAND
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imaginario27/air-ui-ds",
3
- "version": "1.13.7",
3
+ "version": "1.13.8",
4
4
  "author": "imaginario27",
5
5
  "type": "module",
6
6
  "homepage": "https://air-ui.netlify.app/",