@scania/tegel 1.26.0 → 1.27.0-toast-aria-live.0

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 (184) hide show
  1. package/dist/cjs/index-ca8040ad.js +4 -4
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/tds-banner.cjs.entry.js +1 -1
  4. package/dist/cjs/tds-checkbox.cjs.entry.js +10 -3
  5. package/dist/cjs/tds-chip.cjs.entry.js +7 -2
  6. package/dist/cjs/tds-dropdown_2.cjs.entry.js +71 -42
  7. package/dist/cjs/tds-folder-tab.cjs.entry.js +21 -2
  8. package/dist/cjs/tds-folder-tabs.cjs.entry.js +4 -2
  9. package/dist/cjs/tds-icon.cjs.entry.js +1 -1
  10. package/dist/cjs/tds-inline-tab.cjs.entry.js +21 -2
  11. package/dist/cjs/tds-inline-tabs.cjs.entry.js +4 -2
  12. package/dist/cjs/tds-link.cjs.entry.js +17 -3
  13. package/dist/cjs/tds-message.cjs.entry.js +15 -3
  14. package/dist/cjs/tds-modal.cjs.entry.js +74 -2
  15. package/dist/cjs/tds-navigation-tab.cjs.entry.js +21 -2
  16. package/dist/cjs/tds-navigation-tabs.cjs.entry.js +6 -4
  17. package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
  18. package/dist/cjs/tds-text-field.cjs.entry.js +13 -7
  19. package/dist/cjs/tds-textarea.cjs.entry.js +21 -9
  20. package/dist/cjs/tds-toast.cjs.entry.js +11 -4
  21. package/dist/cjs/tds-toggle.cjs.entry.js +2 -2
  22. package/dist/cjs/tds-tooltip.cjs.entry.js +14 -4
  23. package/dist/cjs/tegel.cjs.js +1 -1
  24. package/dist/collection/components/banner/banner.css +1 -1
  25. package/dist/collection/components/banner/banner.js +1 -1
  26. package/dist/collection/components/checkbox/checkbox.js +44 -3
  27. package/dist/collection/components/chip/chip.js +24 -2
  28. package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +2 -2
  29. package/dist/collection/components/dropdown/dropdown.js +86 -40
  30. package/dist/collection/components/icon/icon.js +1 -1
  31. package/dist/collection/components/icon/iconsArray.js +96 -1
  32. package/dist/collection/components/link/link.js +17 -3
  33. package/dist/collection/components/message/message.css +44 -26
  34. package/dist/collection/components/message/message.js +49 -2
  35. package/dist/collection/components/modal/modal.js +103 -3
  36. package/dist/collection/components/popover-core/tds-popover-core.css +596 -53
  37. package/dist/collection/components/tabs/folder-tabs/folder-tab/folder-tab.js +21 -2
  38. package/dist/collection/components/tabs/folder-tabs/folder-tabs.js +40 -2
  39. package/dist/collection/components/tabs/inline-tabs/inline-tab/inline-tab.js +21 -2
  40. package/dist/collection/components/tabs/inline-tabs/inline-tabs.js +40 -2
  41. package/dist/collection/components/tabs/navigation-tabs/navigation-tab/navigation-tab.js +21 -2
  42. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +42 -4
  43. package/dist/collection/components/text-field/text-field.js +31 -8
  44. package/dist/collection/components/textarea/textarea.css +11 -6
  45. package/dist/collection/components/textarea/textarea.js +38 -8
  46. package/dist/collection/components/toast/toast.css +1 -1
  47. package/dist/collection/components/toast/toast.js +45 -3
  48. package/dist/collection/components/toggle/toggle.js +2 -2
  49. package/dist/collection/components/tooltip/tooltip.js +40 -4
  50. package/dist/collection/utils/axeHelpers.js +1 -1
  51. package/dist/components/{p-c65351ab.js → p-14ab9663.js} +12 -3
  52. package/dist/components/p-17338bcb.js +115 -0
  53. package/dist/components/{p-2a43e410.js → p-2d93a742.js} +5 -5
  54. package/dist/components/p-4487c541.js +65 -0
  55. package/dist/components/{p-29d19dc8.js → p-60ff84f2.js} +1 -1
  56. package/dist/components/{p-a64dc22e.js → p-663b8e51.js} +72 -42
  57. package/dist/components/{p-4c1e3344.js → p-83db8b35.js} +1 -1
  58. package/dist/components/{p-b1d21573.js → p-a1181b1f.js} +1 -1
  59. package/dist/components/p-e71e3b2e.js +2052 -0
  60. package/dist/components/tds-accordion-item.js +1 -1
  61. package/dist/components/tds-banner.js +2 -2
  62. package/dist/components/tds-checkbox.js +1 -1
  63. package/dist/components/tds-chip.js +9 -3
  64. package/dist/components/tds-datetime.js +1 -1
  65. package/dist/components/tds-dropdown-option.js +1 -1
  66. package/dist/components/tds-dropdown.js +1 -1
  67. package/dist/components/tds-folder-tab.js +21 -2
  68. package/dist/components/tds-folder-tabs.js +7 -3
  69. package/dist/components/tds-footer-group.js +1 -1
  70. package/dist/components/tds-header-cell.js +1 -1
  71. package/dist/components/tds-header-dropdown.js +3 -3
  72. package/dist/components/tds-header-hamburger.js +1 -1
  73. package/dist/components/tds-header-launcher-button.js +1 -1
  74. package/dist/components/tds-header-launcher.js +4 -4
  75. package/dist/components/tds-icon.js +1 -1
  76. package/dist/components/tds-inline-tab.js +21 -2
  77. package/dist/components/tds-inline-tabs.js +7 -3
  78. package/dist/components/tds-link.js +17 -3
  79. package/dist/components/tds-message.js +19 -5
  80. package/dist/components/tds-modal.js +78 -4
  81. package/dist/components/tds-navigation-tab.js +21 -2
  82. package/dist/components/tds-navigation-tabs.js +9 -5
  83. package/dist/components/tds-popover-canvas.js +1 -1
  84. package/dist/components/tds-popover-core.js +1 -1
  85. package/dist/components/tds-popover-menu.js +1 -1
  86. package/dist/components/tds-side-menu-close-button.js +1 -1
  87. package/dist/components/tds-side-menu-dropdown.js +1 -1
  88. package/dist/components/tds-slider.js +1 -1
  89. package/dist/components/tds-step.js +1 -1
  90. package/dist/components/tds-table-body-input-wrapper.js +1 -1
  91. package/dist/components/tds-table-body-row.js +1 -1
  92. package/dist/components/tds-table-footer.js +4 -4
  93. package/dist/components/tds-table-header-input-wrapper.js +1 -1
  94. package/dist/components/tds-table-header.js +1 -1
  95. package/dist/components/tds-table-toolbar.js +1 -1
  96. package/dist/components/tds-text-field.js +15 -8
  97. package/dist/components/tds-textarea.js +36 -11
  98. package/dist/components/tds-toast.js +14 -5
  99. package/dist/components/tds-toggle.js +2 -2
  100. package/dist/components/tds-tooltip.js +1 -102
  101. package/dist/esm/index-51d04e39.js +4 -4
  102. package/dist/esm/loader.js +1 -1
  103. package/dist/esm/tds-banner.entry.js +1 -1
  104. package/dist/esm/tds-checkbox.entry.js +10 -3
  105. package/dist/esm/tds-chip.entry.js +7 -2
  106. package/dist/esm/tds-dropdown_2.entry.js +71 -42
  107. package/dist/esm/tds-folder-tab.entry.js +22 -3
  108. package/dist/esm/tds-folder-tabs.entry.js +4 -2
  109. package/dist/esm/tds-icon.entry.js +1 -1
  110. package/dist/esm/tds-inline-tab.entry.js +22 -3
  111. package/dist/esm/tds-inline-tabs.entry.js +4 -2
  112. package/dist/esm/tds-link.entry.js +17 -3
  113. package/dist/esm/tds-message.entry.js +15 -3
  114. package/dist/esm/tds-modal.entry.js +74 -2
  115. package/dist/esm/tds-navigation-tab.entry.js +22 -3
  116. package/dist/esm/tds-navigation-tabs.entry.js +6 -4
  117. package/dist/esm/tds-popover-core.entry.js +1 -1
  118. package/dist/esm/tds-text-field.entry.js +13 -7
  119. package/dist/esm/tds-textarea.entry.js +21 -9
  120. package/dist/esm/tds-toast.entry.js +11 -4
  121. package/dist/esm/tds-toggle.entry.js +2 -2
  122. package/dist/esm/tds-tooltip.entry.js +14 -4
  123. package/dist/esm/tegel.js +1 -1
  124. package/dist/tegel/p-0f2c9507.entry.js +1 -0
  125. package/dist/tegel/p-125a6b06.entry.js +1 -0
  126. package/dist/tegel/p-28517288.entry.js +1 -0
  127. package/dist/tegel/p-2af57972.entry.js +1 -0
  128. package/dist/tegel/{p-be1d1345.entry.js → p-4465f687.entry.js} +1 -1
  129. package/dist/tegel/p-668b7662.entry.js +1 -0
  130. package/dist/tegel/p-746e2927.entry.js +1 -0
  131. package/dist/tegel/p-754a4921.entry.js +1 -0
  132. package/dist/tegel/{p-46205cfb.entry.js → p-769d0503.entry.js} +1 -1
  133. package/dist/tegel/p-843413ba.entry.js +1 -0
  134. package/dist/tegel/p-97f10223.entry.js +1 -0
  135. package/dist/tegel/p-a21250b8.entry.js +1 -0
  136. package/dist/tegel/p-aadb2553.entry.js +1 -0
  137. package/dist/tegel/p-ad9a2141.entry.js +1 -0
  138. package/dist/tegel/p-b08886e3.entry.js +1 -0
  139. package/dist/tegel/p-b114ec3d.entry.js +1 -0
  140. package/dist/tegel/p-c3607f10.entry.js +1 -0
  141. package/dist/tegel/p-ddda64eb.entry.js +1 -0
  142. package/dist/tegel/p-eaa279dd.entry.js +1 -0
  143. package/dist/tegel/p-ee960089.entry.js +1 -0
  144. package/dist/tegel/tegel.css +13 -3
  145. package/dist/tegel/tegel.esm.js +1 -1
  146. package/dist/types/components/checkbox/checkbox.d.ts +5 -0
  147. package/dist/types/components/chip/chip.d.ts +3 -0
  148. package/dist/types/components/dropdown/dropdown.d.ts +5 -0
  149. package/dist/types/components/message/message.d.ts +5 -0
  150. package/dist/types/components/modal/modal.d.ts +6 -0
  151. package/dist/types/components/tabs/folder-tabs/folder-tab/folder-tab.d.ts +2 -0
  152. package/dist/types/components/tabs/folder-tabs/folder-tabs.d.ts +4 -0
  153. package/dist/types/components/tabs/inline-tabs/inline-tab/inline-tab.d.ts +2 -0
  154. package/dist/types/components/tabs/inline-tabs/inline-tabs.d.ts +4 -0
  155. package/dist/types/components/tabs/navigation-tabs/navigation-tab/navigation-tab.d.ts +2 -0
  156. package/dist/types/components/tabs/navigation-tabs/navigation-tabs.d.ts +4 -0
  157. package/dist/types/components/text-field/text-field.d.ts +4 -1
  158. package/dist/types/components/textarea/textarea.d.ts +7 -4
  159. package/dist/types/components/toast/toast.d.ts +5 -0
  160. package/dist/types/components/tooltip/tooltip.d.ts +3 -0
  161. package/dist/types/components.d.ts +146 -2
  162. package/dist/types/types/Icons.d.ts +1 -1
  163. package/dist/types/utils/axeHelpers.d.ts +1 -2
  164. package/package.json +1 -1
  165. package/dist/components/p-4764a1d5.js +0 -2052
  166. package/dist/components/p-a2b7bdef.js +0 -65
  167. package/dist/tegel/p-065d6f83.entry.js +0 -1
  168. package/dist/tegel/p-0c1e632d.entry.js +0 -1
  169. package/dist/tegel/p-168122a7.entry.js +0 -1
  170. package/dist/tegel/p-19eb4ae1.entry.js +0 -1
  171. package/dist/tegel/p-4e298888.entry.js +0 -1
  172. package/dist/tegel/p-4e33cbda.entry.js +0 -1
  173. package/dist/tegel/p-4ee344e5.entry.js +0 -1
  174. package/dist/tegel/p-64c80f14.entry.js +0 -1
  175. package/dist/tegel/p-72fd0083.entry.js +0 -1
  176. package/dist/tegel/p-93a4bd11.entry.js +0 -1
  177. package/dist/tegel/p-9e0b31a1.entry.js +0 -1
  178. package/dist/tegel/p-a0fc0cc2.entry.js +0 -1
  179. package/dist/tegel/p-b35e7208.entry.js +0 -1
  180. package/dist/tegel/p-b6526302.entry.js +0 -1
  181. package/dist/tegel/p-b686f1ad.entry.js +0 -1
  182. package/dist/tegel/p-cca85da0.entry.js +0 -1
  183. package/dist/tegel/p-d0abf078.entry.js +0 -1
  184. package/dist/tegel/p-dcbc35af.entry.js +0 -1
@@ -47,6 +47,7 @@ export class TdsChip {
47
47
  this.name = undefined;
48
48
  this.value = undefined;
49
49
  this.disabled = false;
50
+ this.tdsAriaLabel = undefined;
50
51
  }
51
52
  handleInternaRadioChange(event) {
52
53
  const { chipId, checked, groupName } = event.detail;
@@ -67,12 +68,16 @@ export class TdsChip {
67
68
  }
68
69
  return Object.assign(Object.assign({}, commonAttributes), { onClick: () => this.handleClick() });
69
70
  }
71
+ connectedCallback() {
72
+ if (!this.tdsAriaLabel) {
73
+ console.warn('Tegel Chip component: tdsAriaLabel prop is missing');
74
+ }
75
+ }
70
76
  render() {
71
77
  const inputAttributes = this.renderInputAttributes();
72
78
  const hasPrefixSlot = hasSlot('prefix', this.host);
73
79
  const hasLabelSlot = hasSlot('label', this.host);
74
80
  const hasSuffixSlot = hasSlot('suffix', this.host);
75
- const textInsideLabel = this.host.querySelector(`[slot="label"]`).innerHTML;
76
81
  const chipClasses = {
77
82
  'tds-chip-component': true,
78
83
  'sm': this.size === 'sm',
@@ -81,7 +86,7 @@ export class TdsChip {
81
86
  'suffix': hasSuffixSlot,
82
87
  'disabled': this.disabled,
83
88
  };
84
- return (h(Host, { key: 'e7a9ea9750272388e5a8988622865d3aef8104d0' }, h("div", { key: '96ef34ec0764c1c2082d32d6403a86fef836d83b', class: "component" }, h("div", { key: '3a565a0fcb663e8bae82e962d810f6316bd72843', class: chipClasses }, h("input", Object.assign({ key: 'fe6d46749f8d45d90ca4990d009db405ce3c00c2', type: this.type, id: this.chipId, "aria-checked": this.type === 'button' ? undefined : String(this.checked), role: this.type, "aria-label": hasLabelSlot && textInsideLabel ? textInsideLabel : 'Chip' }, inputAttributes)), h("label", { key: 'b395ede6ab012ed36bd32ad95490da2bfbd3c8a7', onClick: (event) => event.stopPropagation(), htmlFor: this.chipId }, hasPrefixSlot && h("slot", { key: '2713979e0184a424ea5d9dc6c3f2ed19d10564ca', name: "prefix" }), hasLabelSlot && h("slot", { key: '7707873c5ea761b6c64e1591064c7126e85686ba', name: "label" }), hasSuffixSlot && h("slot", { key: '73d2517b2cbc1ef6b690fa7c6ef7b1fda126bee2', name: "suffix" }))))));
89
+ return (h(Host, { key: 'c5e27b57accf13ea6af61b6544050b64c16a745c' }, h("div", { key: 'b4f3b429a307cfab3e7dd8356951d19fc5a01293', class: "component" }, h("div", { key: '273c7437e97862fc03c7d93386d07cc425437458', class: chipClasses }, h("input", Object.assign({ key: 'a143b14527b00c255a7205fc86a2473bb8b8c000', type: this.type, id: this.chipId, "aria-checked": this.type === 'button' ? undefined : String(this.checked), role: this.type, "aria-label": this.tdsAriaLabel }, inputAttributes)), h("label", { key: 'a86d26d9f9fe805e84fad6b9c79b24da48efa2f1', onClick: (event) => event.stopPropagation(), htmlFor: this.chipId }, hasPrefixSlot && h("slot", { key: 'ca7e6af86cbac4fc87ac3815fc414f2952d851d0', name: "prefix" }), hasLabelSlot && h("slot", { key: '986cd743afd9f6014cb08e21d5c6c192e579b087', name: "label" }), hasSuffixSlot && h("slot", { key: '1cbbd42853fe0edc52da713f23b9ef3f99d8f4b2', name: "suffix" }))))));
85
90
  }
86
91
  static get is() { return "tds-chip"; }
87
92
  static get encapsulation() { return "scoped"; }
@@ -220,6 +225,23 @@ export class TdsChip {
220
225
  "attribute": "disabled",
221
226
  "reflect": false,
222
227
  "defaultValue": "false"
228
+ },
229
+ "tdsAriaLabel": {
230
+ "type": "string",
231
+ "mutable": false,
232
+ "complexType": {
233
+ "original": "string",
234
+ "resolved": "string",
235
+ "references": {}
236
+ },
237
+ "required": false,
238
+ "optional": false,
239
+ "docs": {
240
+ "tags": [],
241
+ "text": "Value to be used for the aria-label attribute"
242
+ },
243
+ "attribute": "tds-aria-label",
244
+ "reflect": false
223
245
  }
224
246
  };
225
247
  }
@@ -80,7 +80,7 @@ export class TdsDropdownOption {
80
80
  this.internalValue = convertToString(this.value);
81
81
  }
82
82
  render() {
83
- return (h(Host, { key: 'af1229553e89c02aca1d7c11bbc80acd25ce44b5', role: "option", "aria-disabled": this.disabled, "aria-selected": this.selected }, h("div", { key: 'c93eb33d1864028690ab981c0f676f03993265c4', class: `dropdown-option
83
+ return (h(Host, { key: 'f471d5238869b3a522b36d99d7549c1229cd83a2' }, h("div", { key: 'da9edccba96999b0ee40f8c599325774593de814', class: `dropdown-option
84
84
  ${this.size}
85
85
  ${this.selected ? 'selected' : ''}
86
86
  ${this.disabled ? 'disabled' : ''}
@@ -92,7 +92,7 @@ export class TdsDropdownOption {
92
92
  this.handleMultiselect(event);
93
93
  }, disabled: this.disabled, checked: this.selected, class: {
94
94
  [this.size]: true,
95
- } }, h("div", { slot: "label" }, h("slot", null))))) : (h("button", { onClick: () => {
95
+ } }, h("div", { slot: "label" }, h("slot", null))))) : (h("button", { role: "option", "aria-disabled": this.disabled, "aria-selected": this.selected, onClick: () => {
96
96
  this.handleSingleSelect();
97
97
  }, onFocus: (event) => this.handleFocus(event), onBlur: (event) => this.handleBlur(event), disabled: this.disabled, class: this.size }, h("div", { class: "single-select" }, h("slot", null), this.selected && h("tds-icon", { name: "tick", size: "16px" })))))));
98
98
  }
@@ -14,16 +14,15 @@ export class TdsDropdown {
14
14
  const defaultValues = this.multiselect
15
15
  ? this.internalDefaultValue.split(',')
16
16
  : [this.internalDefaultValue];
17
- this.updateDropdownState(defaultValues);
17
+ this.updateDropdownStateInternal(defaultValues);
18
18
  }
19
19
  };
20
20
  this.getChildren = () => {
21
21
  const tdsDropdownOptions = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
22
22
  if (tdsDropdownOptions.length === 0) {
23
- console.warn('TDS DROPDOWN: Data missing. Disregard if loading data asynchronously.');
23
+ console.warn('TDS DROPDOWN: No options found. Disregard if loading data asynchronously.');
24
24
  }
25
- else
26
- return tdsDropdownOptions;
25
+ return tdsDropdownOptions;
27
26
  };
28
27
  this.getSelectedChildren = () => {
29
28
  if (this.selectedOptions.length === 0)
@@ -150,6 +149,7 @@ export class TdsDropdown {
150
149
  this.noResultText = 'No result';
151
150
  this.defaultValue = undefined;
152
151
  this.value = null;
152
+ this.tdsAriaLabel = undefined;
153
153
  this.open = false;
154
154
  this.internalValue = undefined;
155
155
  this.filterResult = undefined;
@@ -162,50 +162,69 @@ export class TdsDropdown {
162
162
  const normalizedValue = this.normalizeValue(newValue);
163
163
  // Only update if actually changed
164
164
  if (this.hasValueChanged(normalizedValue, this.selectedOptions)) {
165
- this.updateDropdownState(normalizedValue);
165
+ this.updateDropdownStateFromUser(normalizedValue);
166
166
  }
167
167
  }
168
168
  normalizeValue(value) {
169
169
  if (!value || value === '')
170
- return []; // Handle both null and empty string
171
- // For multiselect, keep array. For single select, wrap in array
172
- if (this.multiselect) {
170
+ return [];
171
+ // For single select, ensure we handle both string and array inputs
172
+ if (!this.multiselect) {
173
+ // If array is passed to single select, take first value
173
174
  if (Array.isArray(value)) {
174
- return convertArrayToStrings(value);
175
+ return [convertToString(value[0])];
175
176
  }
176
- return value
177
- .toString()
178
- .split(',')
179
- .filter((v) => v !== '');
177
+ return [convertToString(value)];
178
+ }
179
+ // For multiselect
180
+ if (Array.isArray(value)) {
181
+ return convertArrayToStrings(value);
180
182
  }
181
- // Single select - convert to string array
182
- return Array.isArray(value) ? convertArrayToStrings(value) : [convertToString(value)];
183
+ // Handle comma-separated string for multiselect
184
+ return value
185
+ .toString()
186
+ .split(',')
187
+ .filter((v) => v !== '');
183
188
  }
184
189
  hasValueChanged(newValue, currentValue) {
185
190
  if (newValue.length !== currentValue.length)
186
191
  return true;
187
192
  return newValue.some((val) => !currentValue.includes(val));
188
193
  }
189
- updateDropdownState(values) {
194
+ updateDropdownStateInternal(values) {
195
+ this.updateDropdownState(values, false);
196
+ }
197
+ updateDropdownStateFromUser(values) {
198
+ this.updateDropdownState(values, true);
199
+ }
200
+ updateDropdownState(values, emitChange = true) {
201
+ // Validate the values first
202
+ const validValues = this.validateValues(values);
190
203
  // Update internal state
191
- this.selectedOptions = [...this.validateValues(values)]; // Force new array reference
192
- // Then update the value prop to match
204
+ this.selectedOptions = [...validValues];
205
+ // Update the value prop
193
206
  this.value = this.multiselect ? this.selectedOptions : this.selectedOptions[0] || null;
194
- // Force update of internal value
207
+ // Update internal value for display
195
208
  this.internalValue = this.getValue();
196
209
  // Update DOM
197
210
  this.updateOptionElements();
198
211
  // Update display value
199
212
  this.updateDisplayValue();
200
- // Emit change event
201
- this.emitChange();
213
+ // Emit change event only if value has changed by user
214
+ if (emitChange)
215
+ this.emitChange();
202
216
  // Update value attribute
203
217
  this.setValueAttribute();
204
218
  }
205
219
  validateValues(values) {
220
+ // Make sure we have children before validation
221
+ const children = this.getChildren();
222
+ if (!children || children.length === 0) {
223
+ console.warn('No dropdown options found');
224
+ return values; // Return original values if no children yet
225
+ }
206
226
  return values.filter((val) => {
207
- var _a;
208
- const isValid = (_a = this.getChildren()) === null || _a === void 0 ? void 0 : _a.some((element) => element.value === val);
227
+ const isValid = children.some((element) => convertToString(element.value) === convertToString(val));
209
228
  if (!isValid) {
210
229
  console.warn(`Option with value "${val}" does not exist`);
211
230
  }
@@ -242,18 +261,18 @@ export class TdsDropdown {
242
261
  else {
243
262
  normalizedValue = [convertToString(value)];
244
263
  }
245
- this.updateDropdownState(normalizedValue);
264
+ this.updateDropdownStateFromUser(normalizedValue);
246
265
  return this.getSelectedChildren().map((element) => ({
247
266
  value: element.value,
248
267
  label: element.textContent.trim(),
249
268
  }));
250
269
  }
251
270
  async reset() {
252
- this.updateDropdownState([]);
271
+ this.updateDropdownStateFromUser([]);
253
272
  }
254
273
  async removeValue(oldValue) {
255
274
  const newValues = this.selectedOptions.filter((v) => v !== oldValue);
256
- this.updateDropdownState(newValues);
275
+ this.updateDropdownStateFromUser(newValues);
257
276
  }
258
277
  /** Method that forces focus on the input element. */
259
278
  async focusElement() {
@@ -331,13 +350,19 @@ export class TdsDropdown {
331
350
  }
332
351
  }
333
352
  componentWillLoad() {
334
- if (this.defaultValue && !this.value) {
335
- // Convert defaultValue to string before splitting
353
+ // First handle the value prop if it exists
354
+ if (this.value !== null && this.value !== undefined) {
355
+ const normalizedValue = this.normalizeValue(this.value);
356
+ this.updateDropdownStateInternal(normalizedValue);
357
+ return; // Exit early if we handled the value prop
358
+ }
359
+ // Only use defaultValue if no value prop was provided
360
+ if (this.defaultValue !== null && this.defaultValue !== undefined) {
336
361
  const defaultValueStr = convertToString(this.defaultValue);
337
362
  const initialValue = this.multiselect
338
363
  ? defaultValueStr.split(',').map(convertToString)
339
364
  : [convertToString(this.defaultValue)];
340
- this.updateDropdownState(initialValue);
365
+ this.updateDropdownStateInternal(initialValue);
341
366
  }
342
367
  }
343
368
  /** Method to handle slot changes */
@@ -353,10 +378,10 @@ export class TdsDropdown {
353
378
  */
354
379
  async appendValue(value) {
355
380
  if (this.multiselect) {
356
- this.updateDropdownState([...this.selectedOptions, value]);
381
+ this.updateDropdownStateFromUser([...this.selectedOptions, value]);
357
382
  }
358
383
  else {
359
- this.updateDropdownState([value]);
384
+ this.updateDropdownStateFromUser([value]);
360
385
  }
361
386
  }
362
387
  componentDidRender() {
@@ -371,11 +396,16 @@ export class TdsDropdown {
371
396
  form.removeEventListener('reset', this.resetInput);
372
397
  }
373
398
  }
399
+ connectedCallback() {
400
+ if (!this.tdsAriaLabel) {
401
+ console.warn('Tegel Dropdown component: tdsAriaLabel prop is missing');
402
+ }
403
+ }
374
404
  render() {
375
405
  appendHiddenInput(this.host, this.name, this.selectedOptions.join(','), this.disabled);
376
- return (h(Host, { key: '490d34545b3a09c3b4342fa09d38f6bf9c782498', role: "select", class: {
406
+ return (h(Host, { key: 'dbd588020c5f634d489ca464c2a4fd568e9b905a', class: {
377
407
  [`tds-mode-variant-${this.modeVariant}`]: Boolean(this.modeVariant),
378
- } }, this.label && this.labelPosition === 'outside' && (h("div", { key: '7eb96c0134032654df98a3b68ffb692a2cd91d2b', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: '439fddb188ad65239e9d5451a82ab3bbe8f47fb7', class: {
408
+ } }, this.label && this.labelPosition === 'outside' && (h("div", { key: 'e0b7d8efe2206136140695647f7b0656de6f4559', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'abc333e48a6ecc7d89f2ddeec0ff587371baf78c', class: {
379
409
  'dropdown-select': true,
380
410
  [this.size]: true,
381
411
  'disabled': this.disabled,
@@ -388,7 +418,7 @@ export class TdsDropdown {
388
418
  label-inside-as-placeholder
389
419
  ${this.size}
390
420
  ${this.selectedOptions.length ? 'selected' : ''}
391
- ` }, this.label)), h("input", {
421
+ ` }, this.label)), h("input", { "aria-label": this.tdsAriaLabel, "aria-disabled": this.disabled,
392
422
  // eslint-disable-next-line no-return-assign
393
423
  ref: (inputEl) => (this.inputElement = inputEl), class: {
394
424
  placeholder: this.labelPosition === 'inside',
@@ -402,8 +432,7 @@ export class TdsDropdown {
402
432
  if (event.key === 'Escape') {
403
433
  this.open = false;
404
434
  }
405
- }
406
- })), h("tds-icon", { tabIndex: 0, role: "button", "aria-label": "Clear filter", svgTitle: "Clear filter", onClick: this.handleFilterReset, onKeyDown: (event) => {
435
+ } })), h("tds-icon", { tabIndex: 0, role: "button", "aria-label": "Clear filter", svgTitle: "Clear filter", onClick: this.handleFilterReset, onKeyDown: (event) => {
407
436
  if (event.key === 'Enter') {
408
437
  this.handleFilterReset();
409
438
  }
@@ -414,7 +443,7 @@ export class TdsDropdown {
414
443
  if (event.key === 'Enter') {
415
444
  this.handleToggleOpen();
416
445
  }
417
- }, class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))) : (h("button", { onClick: () => this.handleToggleOpen(), onKeyDown: (event) => {
446
+ }, class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))) : (h("button", { "aria-label": this.tdsAriaLabel, "aria-disabled": this.disabled, onClick: () => this.handleToggleOpen(), onKeyDown: (event) => {
418
447
  if (event.key === 'Escape') {
419
448
  this.open = false;
420
449
  }
@@ -426,7 +455,7 @@ export class TdsDropdown {
426
455
  label-inside-as-placeholder
427
456
  ${this.size}
428
457
  ${this.selectedOptions.length ? 'selected' : ''}
429
- ` }, this.label)), h("div", { class: `placeholder ${this.size}` }, this.selectedOptions.length ? this.getValue() : this.placeholder), h("tds-icon", { "aria-label": "Open/Close dropdown", svgTitle: "Open/Close dropdown", class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))))), h("div", { key: 'd6381f78466994f05415cf8981b3cedaaf4df6a9', ref: (element) => {
458
+ ` }, this.label)), h("div", { class: `placeholder ${this.size}` }, this.selectedOptions.length ? this.getValue() : this.placeholder), h("tds-icon", { "aria-label": "Open/Close dropdown", svgTitle: "Open/Close dropdown", class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))))), h("div", { key: 'd83c66bf81a1d2878827d5ed71cdeee73625cbd0', role: "listbox", "aria-label": this.tdsAriaLabel, "aria-orientation": "vertical", "aria-multiselectable": this.multiselect, ref: (element) => {
430
459
  this.dropdownList = element;
431
460
  }, class: {
432
461
  'dropdown-list': true,
@@ -437,11 +466,11 @@ export class TdsDropdown {
437
466
  'closed': !this.open,
438
467
  [`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
439
468
  [`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
440
- } }, h("slot", { key: 'c36a9cb5398a7d290f11576431982e869986e4a0', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: '5ec07552d105f8a4addc46da0172f67cf9233817', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: 'b3e240c31060f2d2bce6e3647f903f9ff1250ed5', class: {
469
+ } }, h("slot", { key: '0133acc19540fb2ebfd44611fb906b5895d300d6', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: '3cdf4874c3e5f593850b3238b9f87508ad67c312', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: 'a51e0a23e67f22427010ee9c965ab7535c46176e', class: {
441
470
  helper: true,
442
471
  error: this.error,
443
472
  disabled: this.disabled,
444
- } }, this.error && h("tds-icon", { key: 'c0eb10dfeaa5236f5ac02dabf44329e85d52dcda', name: "error", size: "16px" }), this.helper))));
473
+ } }, this.error && h("tds-icon", { key: '719a9da93ed73509c1a0694d3011f8e304d73cf9', name: "error", size: "16px" }), this.helper))));
445
474
  }
446
475
  static get is() { return "tds-dropdown"; }
447
476
  static get encapsulation() { return "shadow"; }
@@ -756,6 +785,23 @@ export class TdsDropdown {
756
785
  "attribute": "value",
757
786
  "reflect": false,
758
787
  "defaultValue": "null"
788
+ },
789
+ "tdsAriaLabel": {
790
+ "type": "string",
791
+ "mutable": false,
792
+ "complexType": {
793
+ "original": "string",
794
+ "resolved": "string",
795
+ "references": {}
796
+ },
797
+ "required": false,
798
+ "optional": false,
799
+ "docs": {
800
+ "tags": [],
801
+ "text": "Defines aria-label attribute for input"
802
+ },
803
+ "attribute": "tds-aria-label",
804
+ "reflect": false
759
805
  }
760
806
  };
761
807
  }
@@ -49,7 +49,7 @@ export class Icon {
49
49
  "mutable": false,
50
50
  "complexType": {
51
51
  "original": "IconNames",
52
- "resolved": "\"profile\" | \"expand\" | \"info\" | \"error\" | \"global\" | \"copy\" | \"document\" | \"link\" | \"image\" | \"download\" | \"target\" | \"history\" | \"print\" | \"24v_battery_inactive\" | \"24v_battery\" | \"arrow_diagonal\" | \"arrow_down\" | \"arrow_left\" | \"arrow_right\" | \"arrow_up\" | \"audio_inactive\" | \"back\" | \"backward_inactive\" | \"backward\" | \"bento\" | \"burger\" | \"calendar_inactive\" | \"calendar\" | \"card\" | \"cart\" | \"charging_speed_inactive\" | \"charging_speed\" | \"charging_stopped\" | \"chevron_down\" | \"chevron_left\" | \"chevron_right\" | \"chevron_up\" | \"clock_inactive\" | \"clock\" | \"contact_inactive\" | \"contact\" | \"cross\" | \"dashboard\" | \"document_check\" | \"document_doc\" | \"document_eye\" | \"document_pdf\" | \"document_ppt\" | \"document_tool\" | \"document_wrong\" | \"document_xls\" | \"dollar\" | \"doner\" | \"double_kebab\" | \"edit_inactive\" | \"edit\" | \"email\" | \"export_inactive\" | \"export\" | \"eye_inactive\" | \"eye\" | \"face_dissatisfied\" | \"face_neutral\" | \"face_satisfied\" | \"filters_inactive\" | \"filters\" | \"flash\" | \"folder\" | \"forward_inactive\" | \"fuel_gauge_inactive\" | \"fuel_gauge\" | \"hatch_open_inactive\" | \"heart_inactive\" | \"heart\" | \"heating_inactive_screen\" | \"history_inactive\" | \"home_inactive\" | \"home\" | \"image_add\" | \"image_inactive\" | \"image_set\" | \"insights\" | \"kebab\" | \"link_broken\" | \"lock_inactive\" | \"lock\" | \"maximize_fullscreen\" | \"meatballs\" | \"message_inactive\" | \"message\" | \"mileage_inactive\" | \"mileage\" | \"minimize_fullscreen\" | \"minus\" | \"notification_inactive\" | \"notification\" | \"pause_inactive\" | \"pause\" | \"phone_inactive\" | \"phone\" | \"pie_chart\" | \"pin_inactive\" | \"pin\" | \"plus\" | \"print_inactive\" | \"profile_inactive\" | \"proportions_inactive\" | \"proportions\" | \"range_inactive\" | \"range\" | \"redirect\" | \"refresh_inactive\" | \"refresh\" | \"reload_inactive\" | \"reload\" | \"report_inactive\" | \"report\" | \"save_inactive\" | \"save\" | \"search\" | \"send_inactive\" | \"send\" | \"settings\" | \"share\" | \"skip_backwards\" | \"skip_forward\" | \"smartphone_inactive\" | \"smartphone\" | \"sorting\" | \"speedometer_inactive\" | \"speedometer\" | \"star\" | \"support\" | \"target_inactive\" | \"text_inactive\" | \"tick\" | \"timer\" | \"tool_inactive\" | \"tool\" | \"trailer\" | \"trash_inactive\" | \"trash\" | \"truck\" | \"upload\" | \"wallet\" | \"warning\" | \"wifi_inactive\" | \"wifi\"",
52
+ "resolved": "\"profile\" | \"expand\" | \"info\" | \"error\" | \"global\" | \"merge\" | \"copy\" | \"document\" | \"audio\" | \"link\" | \"video\" | \"image\" | \"text\" | \"download\" | \"target\" | \"placeholder\" | \"history\" | \"print\" | \"key\" | \"24v_battery_inactive\" | \"24v_battery\" | \"acceleration_inactive\" | \"acceleration\" | \"adblue_inactive\" | \"adblue\" | \"arrow_diagonal\" | \"arrow_down\" | \"arrow_left\" | \"arrow_right\" | \"arrow_up\" | \"audio_inactive\" | \"award\" | \"back\" | \"backward_inactive\" | \"backward\" | \"bento\" | \"bug_inactive\" | \"bug\" | \"burger\" | \"bus_inactive\" | \"bus\" | \"calendar_inactive\" | \"calendar\" | \"camera_inactive\" | \"camera\" | \"card\" | \"cart\" | \"charging_complete\" | \"charging_failed\" | \"charging_speed_inactive\" | \"charging_speed\" | \"charging_stopped\" | \"chevron_down\" | \"chevron_left\" | \"chevron_right\" | \"chevron_up\" | \"clock_inactive\" | \"clock\" | \"contact_inactive\" | \"contact\" | \"cookie_inactive\" | \"cookie\" | \"coolant_level_inactive\" | \"coolant_level\" | \"cross\" | \"cup_inactive\" | \"cup\" | \"dashboard\" | \"department_inactive\" | \"department\" | \"departure_scheduling_inactive\" | \"departure_scheduling\" | \"diamond_inactive\" | \"diamond\" | \"document_check\" | \"document_doc\" | \"document_eye\" | \"document_pdf\" | \"document_plus_inactive\" | \"document_plus\" | \"document_ppt\" | \"document_tool\" | \"document_wrong\" | \"document_xls\" | \"dollar\" | \"doner\" | \"double_kebab\" | \"driving_licence_inactive\" | \"driving_licence\" | \"drop_inactive\" | \"drop\" | \"edit_inactive\" | \"edit\" | \"email\" | \"engine_inactive\" | \"engine\" | \"environment_inactive\" | \"environment\" | \"exit\" | \"expand_inactive\" | \"export_inactive\" | \"export\" | \"eye_inactive\" | \"eye\" | \"face_dissatisfied\" | \"face_neutral\" | \"face_satisfied\" | \"factory_inactive\" | \"factory\" | \"ferry_inactive\" | \"ferry\" | \"filters_inactive\" | \"filters\" | \"flash_inactive\" | \"flash\" | \"folder\" | \"forward_inactive\" | \"forward\" | \"fuel_gauge_inactive\" | \"fuel_gauge\" | \"fuel_inactive\" | \"fuel\" | \"gift inactive\" | \"gift\" | \"guided_tour_inactive\" | \"guided_tour\" | \"hatch_open_1\" | \"hatch_open_2\" | \"hatch_open_inactive\" | \"hatch_open\" | \"heart_inactive\" | \"heart\" | \"heating_inactive_screen\" | \"history_inactive\" | \"home_inactive\" | \"home\" | \"idea_inactive\" | \"idea\" | \"image_add\" | \"image_inactive\" | \"image_set\" | \"insights\" | \"kebab\" | \"key_inactive\" | \"layer_inactive\" | \"layer\" | \"link_broken\" | \"list_inactive\" | \"list\" | \"lock_inactive\" | \"lock\" | \"map_cursor_inactive\" | \"map_cursor\" | \"maximize_fullscreen\" | \"meatballs\" | \"merge_inactive\" | \"message_inactive\" | \"message\" | \"mileage_inactive\" | \"mileage\" | \"minimize_fullscreen\" | \"minus\" | \"navigate_inactive\" | \"navigate\" | \"notification_inactive\" | \"notification\" | \"oil_level_inactive\" | \"oil_level\" | \"pause_inactive\" | \"pause\" | \"phone_inactive\" | \"phone\" | \"pie_chart\" | \"pin_inactive\" | \"pin\" | \"play_inactive\" | \"play\" | \"plus\" | \"powerplug_inactive\" | \"powerplug\" | \"print_inactive\" | \"privacy_inactive\" | \"privacy\" | \"profile_inactive\" | \"proportions_inactive\" | \"proportions\" | \"range_inactive\" | \"range\" | \"redirect\" | \"refresh_inactive\" | \"refresh\" | \"reload_inactive\" | \"reload\" | \"repeat\" | \"report_inactive\" | \"report\" | \"route_inactive\" | \"route\" | \"save_inactive\" | \"save\" | \"search\" | \"send_inactive\" | \"send\" | \"settings\" | \"share\" | \"skip_backwards\" | \"skip_forward\" | \"smartphone_inactive\" | \"smartphone\" | \"sorting\" | \"speedometer_inactive\" | \"speedometer\" | \"star\" | \"support\" | \"target_inactive\" | \"temperature_inactive\" | \"temperature\" | \"text_inactive\" | \"thumbs_down\" | \"thumbs_up\" | \"tick\" | \"timer\" | \"tool_inactive\" | \"tool\" | \"trailer_inactive\" | \"trailer\" | \"trash_inactive\" | \"trash\" | \"truck_inactive\" | \"truck\" | \"undo_inactive\" | \"undo\" | \"unlock\" | \"upload\" | \"video_inactive\" | \"wallet\" | \"warning\" | \"weight_inactive\" | \"weight\" | \"wifi_inactive\" | \"wifi\" | \"windscreen_heating_inactive\" | \"windscreen_heating\"",
53
53
  "references": {
54
54
  "IconNames": {
55
55
  "location": "import",