@scania/tegel 1.23.0-beta.0 → 1.23.0-block-nesting-beta.1

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 (49) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tds-block.cjs.entry.js +17 -13
  3. package/dist/cjs/tds-checkbox.cjs.entry.js +9 -2
  4. package/dist/cjs/tds-dropdown_2.cjs.entry.js +159 -128
  5. package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
  6. package/dist/cjs/tegel.cjs.js +1 -1
  7. package/dist/collection/components/block/block.css +11 -5
  8. package/dist/collection/components/block/block.js +16 -12
  9. package/dist/collection/components/checkbox/checkbox.js +19 -3
  10. package/dist/collection/components/dropdown/dropdown.js +209 -200
  11. package/dist/collection/components/popover-core/tds-popover-core.css +6 -16
  12. package/dist/components/{p-ca4b945d.js → p-2523819c.js} +164 -135
  13. package/dist/components/{p-e02b091c.js → p-3a32c37c.js} +1 -1
  14. package/dist/components/{p-dcfecf4d.js → p-50179eca.js} +1 -1
  15. package/dist/components/{p-e4d7c655.js → p-d921fe75.js} +10 -3
  16. package/dist/components/{p-462b77e8.js → p-e7868876.js} +1 -1
  17. package/dist/components/tds-block.js +17 -13
  18. package/dist/components/tds-checkbox.js +1 -1
  19. package/dist/components/tds-dropdown-option.js +1 -1
  20. package/dist/components/tds-dropdown.js +1 -1
  21. package/dist/components/tds-header-dropdown.js +2 -2
  22. package/dist/components/tds-header-launcher.js +2 -2
  23. package/dist/components/tds-popover-canvas.js +1 -1
  24. package/dist/components/tds-popover-core.js +1 -1
  25. package/dist/components/tds-popover-menu.js +1 -1
  26. package/dist/components/tds-table-body-row.js +1 -1
  27. package/dist/components/tds-table-footer.js +3 -3
  28. package/dist/components/tds-table-header.js +1 -1
  29. package/dist/components/tds-tooltip.js +1 -1
  30. package/dist/esm/loader.js +1 -1
  31. package/dist/esm/tds-block.entry.js +17 -13
  32. package/dist/esm/tds-checkbox.entry.js +9 -2
  33. package/dist/esm/tds-dropdown_2.entry.js +159 -128
  34. package/dist/esm/tds-popover-core.entry.js +1 -1
  35. package/dist/esm/tegel.js +1 -1
  36. package/dist/tegel/{p-590b5f55.entry.js → p-2a2756ac.entry.js} +1 -1
  37. package/dist/tegel/p-6a52ed63.entry.js +1 -0
  38. package/dist/tegel/p-979f5255.entry.js +1 -0
  39. package/dist/tegel/p-fe3cc93e.entry.js +1 -0
  40. package/dist/tegel/tegel.css +1 -1
  41. package/dist/tegel/tegel.esm.js +1 -1
  42. package/dist/types/components/block/block.d.ts +1 -2
  43. package/dist/types/components/checkbox/checkbox.d.ts +2 -0
  44. package/dist/types/components/dropdown/dropdown.d.ts +36 -20
  45. package/dist/types/components.d.ts +11 -21
  46. package/package.json +1 -1
  47. package/dist/tegel/p-a464920f.entry.js +0 -1
  48. package/dist/tegel/p-db00f607.entry.js +0 -1
  49. package/dist/tegel/p-e252ba6e.entry.js +0 -1
@@ -7,13 +7,6 @@ import appendHiddenInput from "../../utils/appendHiddenInput";
7
7
  */
8
8
  export class TdsDropdown {
9
9
  constructor() {
10
- this.handleChange = () => {
11
- const value = Array.isArray(this.value) ? this.value.join(',') : this.value;
12
- this.tdsChange.emit({
13
- name: this.name,
14
- value: value !== null && value !== void 0 ? value : null,
15
- });
16
- };
17
10
  this.setDefaultOption = () => {
18
11
  if (this.defaultValue) {
19
12
  const children = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
@@ -42,6 +35,7 @@ export class TdsDropdown {
42
35
  }
43
36
  }
44
37
  };
38
+ /* Returns a list of all children that are tds-dropdown-option elements */
45
39
  this.getChildren = () => {
46
40
  const tdsDropdownOptions = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
47
41
  if (tdsDropdownOptions.length === 0) {
@@ -50,38 +44,6 @@ export class TdsDropdown {
50
44
  else
51
45
  return tdsDropdownOptions;
52
46
  };
53
- this.getSelectedChildren = () => {
54
- if (!this.value)
55
- return [];
56
- const valueArray = Array.isArray(this.value) ? this.value : [this.value];
57
- return valueArray
58
- .map((stringValue) => {
59
- const matchingElement = this.getChildren().find((element) => element.value === stringValue);
60
- return matchingElement;
61
- })
62
- .filter(Boolean);
63
- };
64
- this.getSelectedChildrenLabels = () => {
65
- var _a;
66
- return (_a = this.getSelectedChildren()) === null || _a === void 0 ? void 0 : _a.map((element) => element.textContent.trim());
67
- };
68
- this.getValue = () => {
69
- const labels = this.getSelectedChildrenLabels();
70
- if (!labels) {
71
- return '';
72
- }
73
- return labels === null || labels === void 0 ? void 0 : labels.join(', ');
74
- };
75
- this.setValueAttribute = () => {
76
- var _a;
77
- if (!this.value || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) === '') {
78
- this.host.removeAttribute('value');
79
- }
80
- else {
81
- const valueArray = Array.isArray(this.value) ? this.value : [this.value];
82
- this.host.setAttribute('value', valueArray.map((val) => val).toString());
83
- }
84
- };
85
47
  this.getOpenDirection = () => {
86
48
  var _a, _b, _c, _d, _e;
87
49
  if (this.openDirection === 'auto' || !this.openDirection) {
@@ -95,6 +57,7 @@ export class TdsDropdown {
95
57
  }
96
58
  return this.openDirection;
97
59
  };
60
+ /* Toggles the open state of the Dropdown and sets focus to the input element */
98
61
  this.handleToggleOpen = () => {
99
62
  if (!this.disabled) {
100
63
  this.open = !this.open;
@@ -103,10 +66,38 @@ export class TdsDropdown {
103
66
  }
104
67
  }
105
68
  };
69
+ /* Focuses the input element in the Dropdown, if the reference is present. */
106
70
  this.focusInputElement = () => {
107
71
  if (this.inputElement)
108
72
  this.inputElement.focus();
109
73
  };
74
+ this.getSelectedChildren = () => {
75
+ var _a;
76
+ return (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((stringValue) => {
77
+ const matchingElement = this.getChildren().find((element) => element.value === stringValue);
78
+ return matchingElement;
79
+ }).filter(Boolean);
80
+ };
81
+ this.getSelectedChildrenLabels = () => {
82
+ var _a;
83
+ return (_a = this.getSelectedChildren()) === null || _a === void 0 ? void 0 : _a.map((element) => element.textContent.trim());
84
+ };
85
+ this.getValue = () => {
86
+ const labels = this.getSelectedChildrenLabels();
87
+ if (!labels) {
88
+ return '';
89
+ }
90
+ return labels === null || labels === void 0 ? void 0 : labels.join(', ');
91
+ };
92
+ this.setValueAttribute = () => {
93
+ var _a;
94
+ if (!this.value || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) === '') {
95
+ this.host.removeAttribute('value');
96
+ }
97
+ else {
98
+ this.host.setAttribute('value', this.value.map((val) => val).toString());
99
+ }
100
+ };
110
101
  this.handleFilter = (event) => {
111
102
  this.tdsInput.emit(event);
112
103
  const query = event.target.value.toLowerCase();
@@ -152,6 +143,13 @@ export class TdsDropdown {
152
143
  this.handleBlur = (event) => {
153
144
  this.tdsBlur.emit(event);
154
145
  };
146
+ this.handleChange = () => {
147
+ var _a, _b;
148
+ this.tdsChange.emit({
149
+ name: this.name,
150
+ value: (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString()) !== null && _b !== void 0 ? _b : null,
151
+ });
152
+ };
155
153
  this.name = undefined;
156
154
  this.disabled = false;
157
155
  this.helper = undefined;
@@ -168,92 +166,107 @@ export class TdsDropdown {
168
166
  this.normalizeText = true;
169
167
  this.noResultText = 'No result';
170
168
  this.defaultValue = undefined;
171
- this.value = undefined;
172
169
  this.open = false;
173
- this.internalValue = undefined;
170
+ this.value = undefined;
174
171
  this.filterResult = undefined;
175
172
  this.filterFocus = undefined;
176
173
  }
177
- handleValueChange(newValue) {
178
- if (newValue === undefined)
179
- return;
180
- // Ensure consistent internal array representation
181
- const valueArray = Array.isArray(newValue) ? newValue : newValue ? [newValue] : null;
182
- // Handle multiselect validation
183
- if (!this.multiselect && Array.isArray(valueArray) && valueArray.length > 1) {
184
- console.warn('Tried to select multiple items, but multiselect is not enabled.');
185
- // Coerce to single value for non-multiselect
186
- this.value = valueArray[0];
187
- return;
188
- }
189
- // Ensure value is always array internally for backward compatibility
190
- this.updateSelections(valueArray);
174
+ /** Method that resets the Dropdown, marks all children as non-selected and resets the value to null. */
175
+ async reset() {
176
+ this.dropdownList.scrollTop = 0;
177
+ this.internalReset();
191
178
  this.handleChange();
192
179
  }
193
- updateSelections(valueArray) {
194
- // Reset current selections
195
- this.getChildren().forEach((element) => {
196
- element.setSelected(false);
197
- });
198
- if (valueArray) {
199
- // Validate and filter values
200
- const validValues = valueArray.filter((val) => {
201
- const optionExists = this.getChildren().some((element) => element.value === val);
202
- if (!optionExists) {
203
- console.warn(`Option with value "${val}" does not exist`);
204
- }
205
- return optionExists;
206
- });
207
- // Update internal state and selections
208
- this.internalValue = validValues.join(', ');
209
- this.getChildren().forEach((element) => {
210
- if (validValues.includes(element.value)) {
211
- element.setSelected(true);
212
- }
213
- });
214
- // Update value prop with validated values
215
- if (this.multiselect) {
216
- this.value = validValues;
217
- }
218
- else {
219
- this.value = validValues[0] || null;
220
- }
221
- }
222
- else {
223
- // Handle null/undefined case
224
- this.internalValue = '';
225
- this.value = this.multiselect ? [] : null;
180
+ /** Method that forces focus on the input element. */
181
+ async focusElement() {
182
+ this.focusInputElement();
183
+ this.handleFocus({});
184
+ }
185
+ /** Method for setting the value of the Dropdown.
186
+ *
187
+ * Single selection example:
188
+ *
189
+ * <code>
190
+ * dropdown.setValue('option-1', 'Option 1');
191
+ * </code>
192
+ *
193
+ * Multiselect example:
194
+ *
195
+ * <code>
196
+ * dropdown.setValue(['option-1', 'option-2']);
197
+ * </code>
198
+ */
199
+ // The label is optional here ONLY to not break the API. Should be removed for 2.0.
200
+ // @ts-ignore
201
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
202
+ async setValue(value, label) {
203
+ let nextValue;
204
+ if (typeof value === 'string')
205
+ nextValue = [value];
206
+ else
207
+ nextValue = value;
208
+ if (!this.multiselect && nextValue.length > 1) {
209
+ console.warn('Tried to select multiple items, but multiselect is not enabled.');
210
+ nextValue = [nextValue[0]];
226
211
  }
227
- // Emit change events
228
- this.handleChange();
229
- // Update filter input if present
230
- if (this.filter && this.inputElement) {
231
- this.inputElement.value = this.internalValue;
212
+ nextValue = [...new Set(nextValue)];
213
+ this.internalReset();
214
+ for (let i = 0; i < nextValue.length; i++) {
215
+ const optionExist = this.getChildren().some((element) => element.value === nextValue[i]);
216
+ if (!optionExist) {
217
+ nextValue.splice(i, 1);
218
+ }
232
219
  }
220
+ this.value = nextValue;
233
221
  this.setValueAttribute();
234
- }
235
- async setValue(value) {
236
- this.value = value;
237
- return this.getSelectedChildren().map((element) => ({
222
+ this.selectChildrenAsSelectedBasedOnSelectionProp();
223
+ this.handleChange();
224
+ /* This returns an array of object with a value and label pair. This is ONLY to not break the API. Should be removed for 2.0. */
225
+ /* https://tegel.atlassian.net/browse/CDEP-2703 */
226
+ const selection = this.getSelectedChildren().map((element) => ({
238
227
  value: element.value,
239
228
  label: element.textContent.trim(),
240
229
  }));
230
+ // Update inputElement value and placeholder text
231
+ if (this.filter) {
232
+ this.inputElement.value = this.getValue();
233
+ }
234
+ return selection;
241
235
  }
242
- async reset() {
243
- this.value = this.multiselect ? [] : null;
236
+ /**
237
+ * @internal
238
+ */
239
+ async appendValue(value) {
240
+ if (this.multiselect && this.value) {
241
+ this.setValue([...this.value, value]);
242
+ }
243
+ else {
244
+ this.setValue(value);
245
+ }
244
246
  }
247
+ /** Method for removing a selected value in the Dropdown. */
245
248
  async removeValue(oldValue) {
246
- if (this.multiselect && Array.isArray(this.value)) {
247
- this.value = this.value.filter((v) => v !== oldValue);
249
+ var _a, _b;
250
+ let label;
251
+ if (this.multiselect) {
252
+ (_a = this.getChildren()) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
253
+ var _a;
254
+ if (element.value === oldValue) {
255
+ this.value = (_a = this.value) === null || _a === void 0 ? void 0 : _a.filter((value) => value !== element.value);
256
+ label = element.textContent.trim();
257
+ element.setSelected(false);
258
+ }
259
+ return element;
260
+ });
248
261
  }
249
262
  else {
250
- this.value = null;
263
+ this.reset();
251
264
  }
252
- }
253
- /** Method that forces focus on the input element. */
254
- async focusElement() {
255
- this.focusInputElement();
256
- this.handleFocus({});
265
+ this.handleChange();
266
+ this.setValueAttribute();
267
+ /* This returns an array of object with a value and label pair. This is ONLY to not break the API. Should be removed for 2.0. */
268
+ /* https://tegel.atlassian.net/browse/CDEP-2703 */
269
+ return (_b = this.value) === null || _b === void 0 ? void 0 : _b.map((value) => ({ value, label }));
257
270
  }
258
271
  /** Method for closing the Dropdown. */
259
272
  async close() {
@@ -307,9 +320,6 @@ export class TdsDropdown {
307
320
  }
308
321
  }
309
322
  componentWillLoad() {
310
- if (this.defaultValue && !this.value) {
311
- this.value = this.defaultValue;
312
- }
313
323
  this.setDefaultOption();
314
324
  }
315
325
  /** Method to handle slot changes */
@@ -320,19 +330,34 @@ export class TdsDropdown {
320
330
  normalizeString(text) {
321
331
  return this.normalizeText ? text.normalize('NFD').replace(/\p{Diacritic}/gu, '') : text;
322
332
  }
323
- async appendValue(value) {
324
- if (this.multiselect) {
325
- this.value = Array.isArray(this.value) ? [...this.value, value] : [value];
326
- }
327
- else {
328
- this.value = value;
329
- }
333
+ /** Method that resets the dropdown without emitting an event. */
334
+ internalReset() {
335
+ this.getChildren().forEach((element) => {
336
+ element.setSelected(false);
337
+ return element;
338
+ });
339
+ this.value = null;
340
+ this.setValueAttribute();
341
+ }
342
+ selectChildrenAsSelectedBasedOnSelectionProp() {
343
+ this.getChildren().forEach((element) => {
344
+ this.value.forEach((selection) => {
345
+ if (element.value !== selection) {
346
+ // If not multiselect, we need to unselect all other options.
347
+ if (!this.multiselect) {
348
+ element.setSelected(false);
349
+ }
350
+ }
351
+ else {
352
+ element.setSelected(true);
353
+ }
354
+ });
355
+ });
330
356
  }
331
357
  render() {
332
- var _a, _b, _c;
333
- const valueArray = Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
334
- appendHiddenInput(this.host, this.name, valueArray.map((value) => value).toString(), this.disabled);
335
- return (h(Host, { key: '2d1d0d7551c4f5a3197538a21b245b06abb95a5b', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: '44bf815fc834febcf5bf90aeabeb4ff75ca74e0b', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'fe8bddaad6f52c6860a8a3b02db796d927553c64', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
358
+ var _a, _b, _c, _d;
359
+ appendHiddenInput(this.host, this.name, (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString(), this.disabled);
360
+ return (h(Host, { key: '1c4995be9b1e47e254ec9976b334c4d74a44263b', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: 'ad423934dedc56ff39d06bf7746e47d011bed002', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: '99c87c0add1152f47533bf6ef5e6794cffdbb18c', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
336
361
  filter: true,
337
362
  focus: this.filterFocus,
338
363
  disabled: this.disabled,
@@ -340,7 +365,7 @@ export class TdsDropdown {
340
365
  } }, h("div", { class: "value-wrapper" }, this.label && this.labelPosition === 'inside' && this.placeholder && (h("div", { class: `label-inside ${this.size}` }, this.label)), this.label && this.labelPosition === 'inside' && !this.placeholder && (h("div", { class: `
341
366
  label-inside-as-placeholder
342
367
  ${this.size}
343
- ${((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) ? 'selected' : ''}
368
+ ${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
344
369
  ` }, this.label)), h("input", {
345
370
  // eslint-disable-next-line no-return-assign
346
371
  ref: (inputEl) => (this.inputElement = inputEl), class: `${this.labelPosition === 'inside' ? 'placeholder' : ''}`, type: "text", placeholder: this.filterFocus ? '' : this.placeholder, value: this.multiselect && this.filterFocus ? '' : this.getValue(), disabled: this.disabled, onInput: (event) => this.handleFilter(event), onBlur: (event) => {
@@ -349,7 +374,15 @@ export class TdsDropdown {
349
374
  this.inputElement.value = this.getValue();
350
375
  }
351
376
  this.handleBlur(event);
352
- }, onFocus: (event) => this.handleFocus(event), onKeyDown: (event) => {
377
+ }, onFocus: (event) => {
378
+ this.open = true;
379
+ this.filterFocus = true;
380
+ if (this.multiselect) {
381
+ this.inputElement.value = '';
382
+ }
383
+ this.handleFocus(event);
384
+ this.handleFilter({ target: { value: '' } });
385
+ }, onKeyDown: (event) => {
353
386
  if (event.key === 'Escape') {
354
387
  this.open = false;
355
388
  }
@@ -373,8 +406,8 @@ export class TdsDropdown {
373
406
  `, disabled: this.disabled }, h("div", { class: `value-wrapper ${this.size}` }, this.label && this.labelPosition === 'inside' && this.placeholder && (h("div", { class: `label-inside ${this.size}` }, this.label)), this.label && this.labelPosition === 'inside' && !this.placeholder && (h("div", { class: `
374
407
  label-inside-as-placeholder
375
408
  ${this.size}
376
- ${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
377
- ` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((_c = this.value) === null || _c === void 0 ? void 0 : _c.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: '5a725e0e42ada175ff588849debe814f4558f907', ref: (element) => (this.dropdownList = element), class: {
409
+ ${((_c = this.value) === null || _c === void 0 ? void 0 : _c.length) ? 'selected' : ''}
410
+ ` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((_d = this.value) === null || _d === void 0 ? void 0 : _d.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: 'dd850ac34b473f9cac51ad5bdc8417d994b7946a', ref: (element) => (this.dropdownList = element), class: {
378
411
  'dropdown-list': true,
379
412
  [this.size]: true,
380
413
  [this.getOpenDirection()]: true,
@@ -383,7 +416,7 @@ export class TdsDropdown {
383
416
  'closed': !this.open,
384
417
  [`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
385
418
  [`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
386
- } }, h("slot", { key: '7cece8ee2247cf1249719673734408216b1b9ad6', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: 'c8e1bfb413f6247710b34707e6e86e454b04739c', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: '90dcb3ed5268866c95f88bb53a9a066451ebc505', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: 'a216d63de9d7d6011c4bce0ee0b64f6ea90fa4e4', name: "error", size: "16px" }), this.helper))));
419
+ } }, h("slot", { key: '790885487da46ec88e05ad98272cbd43eb6fc7ac', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: '7d9c9f695c5dc2c734fa51a746c6c1c3547d5dec', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: 'b044b0d4dd3e39000fa0262a838aa860451e5986', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: '506204fd3f113c6a903b616372660902295d0886', name: "error", size: "16px" }), this.helper))));
387
420
  }
388
421
  static get is() { return "tds-dropdown"; }
389
422
  static get encapsulation() { return "shadow"; }
@@ -680,30 +713,13 @@ export class TdsDropdown {
680
713
  },
681
714
  "attribute": "default-value",
682
715
  "reflect": false
683
- },
684
- "value": {
685
- "type": "string",
686
- "mutable": true,
687
- "complexType": {
688
- "original": "string | string[]",
689
- "resolved": "string | string[]",
690
- "references": {}
691
- },
692
- "required": false,
693
- "optional": false,
694
- "docs": {
695
- "tags": [],
696
- "text": "Value of the dropdown. For multiselect, provide array of strings. For single select, provide a string."
697
- },
698
- "attribute": "value",
699
- "reflect": false
700
716
  }
701
717
  };
702
718
  }
703
719
  static get states() {
704
720
  return {
705
721
  "open": {},
706
- "internalValue": {},
722
+ "value": {},
707
723
  "filterResult": {},
708
724
  "filterFocus": {}
709
725
  };
@@ -784,51 +800,28 @@ export class TdsDropdown {
784
800
  }
785
801
  }
786
802
  }
787
- }, {
788
- "method": "tdsValueChange",
789
- "name": "tdsValueChange",
790
- "bubbles": true,
791
- "cancelable": false,
792
- "composed": true,
793
- "docs": {
794
- "tags": [],
795
- "text": "Value change event for the Dropdown."
796
- },
797
- "complexType": {
798
- "original": "{\n name: string;\n value: string;\n }",
799
- "resolved": "{ name: string; value: string; }",
800
- "references": {}
801
- }
802
803
  }];
803
804
  }
804
805
  static get methods() {
805
806
  return {
806
- "setValue": {
807
+ "reset": {
807
808
  "complexType": {
808
- "signature": "(value: string | string[]) => Promise<{ value: string; label: string; }[]>",
809
- "parameters": [{
810
- "name": "value",
811
- "type": "string | string[]",
812
- "docs": ""
813
- }],
809
+ "signature": "() => Promise<void>",
810
+ "parameters": [],
814
811
  "references": {
815
812
  "Promise": {
816
813
  "location": "global",
817
814
  "id": "global::Promise"
818
- },
819
- "HTMLTdsDropdownOptionElement": {
820
- "location": "global",
821
- "id": "global::HTMLTdsDropdownOptionElement"
822
815
  }
823
816
  },
824
- "return": "Promise<{ value: string; label: string; }[]>"
817
+ "return": "Promise<void>"
825
818
  },
826
819
  "docs": {
827
- "text": "",
820
+ "text": "Method that resets the Dropdown, marks all children as non-selected and resets the value to null.",
828
821
  "tags": []
829
822
  }
830
823
  },
831
- "reset": {
824
+ "focusElement": {
832
825
  "complexType": {
833
826
  "signature": "() => Promise<void>",
834
827
  "parameters": [],
@@ -841,15 +834,19 @@ export class TdsDropdown {
841
834
  "return": "Promise<void>"
842
835
  },
843
836
  "docs": {
844
- "text": "",
837
+ "text": "Method that forces focus on the input element.",
845
838
  "tags": []
846
839
  }
847
840
  },
848
- "removeValue": {
841
+ "setValue": {
849
842
  "complexType": {
850
- "signature": "(oldValue: string) => Promise<void>",
843
+ "signature": "(value: string | string[], label?: string) => Promise<{ value: string; label: string; }[]>",
851
844
  "parameters": [{
852
- "name": "oldValue",
845
+ "name": "value",
846
+ "type": "string | string[]",
847
+ "docs": ""
848
+ }, {
849
+ "name": "label",
853
850
  "type": "string",
854
851
  "docs": ""
855
852
  }],
@@ -857,19 +854,27 @@ export class TdsDropdown {
857
854
  "Promise": {
858
855
  "location": "global",
859
856
  "id": "global::Promise"
857
+ },
858
+ "HTMLTdsDropdownOptionElement": {
859
+ "location": "global",
860
+ "id": "global::HTMLTdsDropdownOptionElement"
860
861
  }
861
862
  },
862
- "return": "Promise<void>"
863
+ "return": "Promise<{ value: string; label: string; }[]>"
863
864
  },
864
865
  "docs": {
865
- "text": "",
866
+ "text": "Method for setting the value of the Dropdown.\n\nSingle selection example:\n\n<code>\ndropdown.setValue('option-1', 'Option 1');\n</code>\n\nMultiselect example:\n\n<code>\ndropdown.setValue(['option-1', 'option-2']);\n</code>",
866
867
  "tags": []
867
868
  }
868
869
  },
869
- "focusElement": {
870
+ "appendValue": {
870
871
  "complexType": {
871
- "signature": "() => Promise<void>",
872
- "parameters": [],
872
+ "signature": "(value: string) => Promise<void>",
873
+ "parameters": [{
874
+ "name": "value",
875
+ "type": "string",
876
+ "docs": ""
877
+ }],
873
878
  "references": {
874
879
  "Promise": {
875
880
  "location": "global",
@@ -879,35 +884,42 @@ export class TdsDropdown {
879
884
  "return": "Promise<void>"
880
885
  },
881
886
  "docs": {
882
- "text": "Method that forces focus on the input element.",
883
- "tags": []
887
+ "text": "",
888
+ "tags": [{
889
+ "name": "internal",
890
+ "text": undefined
891
+ }]
884
892
  }
885
893
  },
886
- "close": {
894
+ "removeValue": {
887
895
  "complexType": {
888
- "signature": "() => Promise<void>",
889
- "parameters": [],
896
+ "signature": "(oldValue: string) => Promise<{ value: string; label: string; }[]>",
897
+ "parameters": [{
898
+ "name": "oldValue",
899
+ "type": "string",
900
+ "docs": ""
901
+ }],
890
902
  "references": {
891
903
  "Promise": {
892
904
  "location": "global",
893
905
  "id": "global::Promise"
906
+ },
907
+ "HTMLTdsDropdownOptionElement": {
908
+ "location": "global",
909
+ "id": "global::HTMLTdsDropdownOptionElement"
894
910
  }
895
911
  },
896
- "return": "Promise<void>"
912
+ "return": "Promise<{ value: string; label: string; }[]>"
897
913
  },
898
914
  "docs": {
899
- "text": "Method for closing the Dropdown.",
915
+ "text": "Method for removing a selected value in the Dropdown.",
900
916
  "tags": []
901
917
  }
902
918
  },
903
- "appendValue": {
919
+ "close": {
904
920
  "complexType": {
905
- "signature": "(value: string) => Promise<void>",
906
- "parameters": [{
907
- "name": "value",
908
- "type": "string",
909
- "docs": ""
910
- }],
921
+ "signature": "() => Promise<void>",
922
+ "parameters": [],
911
923
  "references": {
912
924
  "Promise": {
913
925
  "location": "global",
@@ -917,7 +929,7 @@ export class TdsDropdown {
917
929
  "return": "Promise<void>"
918
930
  },
919
931
  "docs": {
920
- "text": "",
932
+ "text": "Method for closing the Dropdown.",
921
933
  "tags": []
922
934
  }
923
935
  }
@@ -926,9 +938,6 @@ export class TdsDropdown {
926
938
  static get elementRef() { return "host"; }
927
939
  static get watchers() {
928
940
  return [{
929
- "propName": "value",
930
- "methodName": "handleValueChange"
931
- }, {
932
941
  "propName": "open",
933
942
  "methodName": "handleOpenState"
934
943
  }];