@scania/tegel 1.23.0-fix-form-components-slider-reset-beta.2 → 1.23.0-value-prop-beta.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.
@@ -7,6 +7,13 @@ 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
+ };
10
17
  this.setDefaultOption = () => {
11
18
  if (this.defaultValue) {
12
19
  const children = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
@@ -35,7 +42,6 @@ export class TdsDropdown {
35
42
  }
36
43
  }
37
44
  };
38
- /* Returns a list of all children that are tds-dropdown-option elements */
39
45
  this.getChildren = () => {
40
46
  const tdsDropdownOptions = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
41
47
  if (tdsDropdownOptions.length === 0) {
@@ -44,6 +50,38 @@ export class TdsDropdown {
44
50
  else
45
51
  return tdsDropdownOptions;
46
52
  };
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
+ };
47
85
  this.getOpenDirection = () => {
48
86
  var _a, _b, _c, _d, _e;
49
87
  if (this.openDirection === 'auto' || !this.openDirection) {
@@ -57,7 +95,6 @@ export class TdsDropdown {
57
95
  }
58
96
  return this.openDirection;
59
97
  };
60
- /* Toggles the open state of the Dropdown and sets focus to the input element */
61
98
  this.handleToggleOpen = () => {
62
99
  if (!this.disabled) {
63
100
  this.open = !this.open;
@@ -66,38 +103,10 @@ export class TdsDropdown {
66
103
  }
67
104
  }
68
105
  };
69
- /* Focuses the input element in the Dropdown, if the reference is present. */
70
106
  this.focusInputElement = () => {
71
107
  if (this.inputElement)
72
108
  this.inputElement.focus();
73
109
  };
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
- };
101
110
  this.handleFilter = (event) => {
102
111
  this.tdsInput.emit(event);
103
112
  const query = event.target.value.toLowerCase();
@@ -143,13 +152,6 @@ export class TdsDropdown {
143
152
  this.handleBlur = (event) => {
144
153
  this.tdsBlur.emit(event);
145
154
  };
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
- };
153
155
  this.name = undefined;
154
156
  this.disabled = false;
155
157
  this.helper = undefined;
@@ -166,107 +168,92 @@ export class TdsDropdown {
166
168
  this.normalizeText = true;
167
169
  this.noResultText = 'No result';
168
170
  this.defaultValue = undefined;
169
- this.open = false;
170
171
  this.value = undefined;
172
+ this.open = false;
173
+ this.internalValue = undefined;
171
174
  this.filterResult = undefined;
172
175
  this.filterFocus = undefined;
173
176
  }
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();
178
- this.handleChange();
179
- }
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) {
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) {
209
184
  console.warn('Tried to select multiple items, but multiselect is not enabled.');
210
- nextValue = [nextValue[0]];
185
+ // Coerce to single value for non-multiselect
186
+ this.value = valueArray[0];
187
+ return;
211
188
  }
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);
189
+ // Ensure value is always array internally for backward compatibility
190
+ this.updateSelections(valueArray);
191
+ this.handleChange();
192
+ }
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;
218
220
  }
219
221
  }
220
- this.value = nextValue;
221
- this.setValueAttribute();
222
- this.selectChildrenAsSelectedBasedOnSelectionProp();
222
+ else {
223
+ // Handle null/undefined case
224
+ this.internalValue = '';
225
+ this.value = this.multiselect ? [] : null;
226
+ }
227
+ // Emit change events
223
228
  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) => ({
229
+ // Update filter input if present
230
+ if (this.filter && this.inputElement) {
231
+ this.inputElement.value = this.internalValue;
232
+ }
233
+ this.setValueAttribute();
234
+ }
235
+ async setValue(value) {
236
+ this.value = value;
237
+ return this.getSelectedChildren().map((element) => ({
227
238
  value: element.value,
228
239
  label: element.textContent.trim(),
229
240
  }));
230
- // Update inputElement value and placeholder text
231
- if (this.filter) {
232
- this.inputElement.value = this.getValue();
233
- }
234
- return selection;
235
241
  }
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
- }
242
+ async reset() {
243
+ this.value = this.multiselect ? [] : null;
246
244
  }
247
- /** Method for removing a selected value in the Dropdown. */
248
245
  async removeValue(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
- });
246
+ if (this.multiselect && Array.isArray(this.value)) {
247
+ this.value = this.value.filter((v) => v !== oldValue);
261
248
  }
262
249
  else {
263
- this.reset();
250
+ this.value = null;
264
251
  }
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 }));
252
+ }
253
+ /** Method that forces focus on the input element. */
254
+ async focusElement() {
255
+ this.focusInputElement();
256
+ this.handleFocus({});
270
257
  }
271
258
  /** Method for closing the Dropdown. */
272
259
  async close() {
@@ -320,6 +307,9 @@ export class TdsDropdown {
320
307
  }
321
308
  }
322
309
  componentWillLoad() {
310
+ if (this.defaultValue && !this.value) {
311
+ this.value = this.defaultValue;
312
+ }
323
313
  this.setDefaultOption();
324
314
  }
325
315
  /** Method to handle slot changes */
@@ -330,34 +320,19 @@ export class TdsDropdown {
330
320
  normalizeString(text) {
331
321
  return this.normalizeText ? text.normalize('NFD').replace(/\p{Diacritic}/gu, '') : text;
332
322
  }
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
- });
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
+ }
356
330
  }
357
331
  render() {
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: {
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: {
361
336
  filter: true,
362
337
  focus: this.filterFocus,
363
338
  disabled: this.disabled,
@@ -365,7 +340,7 @@ export class TdsDropdown {
365
340
  } }, 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: `
366
341
  label-inside-as-placeholder
367
342
  ${this.size}
368
- ${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
343
+ ${((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) ? 'selected' : ''}
369
344
  ` }, this.label)), h("input", {
370
345
  // eslint-disable-next-line no-return-assign
371
346
  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) => {
@@ -374,15 +349,7 @@ export class TdsDropdown {
374
349
  this.inputElement.value = this.getValue();
375
350
  }
376
351
  this.handleBlur(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) => {
352
+ }, onFocus: (event) => this.handleFocus(event), onKeyDown: (event) => {
386
353
  if (event.key === 'Escape') {
387
354
  this.open = false;
388
355
  }
@@ -406,8 +373,8 @@ export class TdsDropdown {
406
373
  `, 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: `
407
374
  label-inside-as-placeholder
408
375
  ${this.size}
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: {
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: {
411
378
  'dropdown-list': true,
412
379
  [this.size]: true,
413
380
  [this.getOpenDirection()]: true,
@@ -416,7 +383,7 @@ export class TdsDropdown {
416
383
  'closed': !this.open,
417
384
  [`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
418
385
  [`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
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))));
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))));
420
387
  }
421
388
  static get is() { return "tds-dropdown"; }
422
389
  static get encapsulation() { return "shadow"; }
@@ -713,13 +680,30 @@ export class TdsDropdown {
713
680
  },
714
681
  "attribute": "default-value",
715
682
  "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
716
700
  }
717
701
  };
718
702
  }
719
703
  static get states() {
720
704
  return {
721
705
  "open": {},
722
- "value": {},
706
+ "internalValue": {},
723
707
  "filterResult": {},
724
708
  "filterFocus": {}
725
709
  };
@@ -800,28 +784,51 @@ export class TdsDropdown {
800
784
  }
801
785
  }
802
786
  }
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
+ }
803
802
  }];
804
803
  }
805
804
  static get methods() {
806
805
  return {
807
- "reset": {
806
+ "setValue": {
808
807
  "complexType": {
809
- "signature": "() => Promise<void>",
810
- "parameters": [],
808
+ "signature": "(value: string | string[]) => Promise<{ value: string; label: string; }[]>",
809
+ "parameters": [{
810
+ "name": "value",
811
+ "type": "string | string[]",
812
+ "docs": ""
813
+ }],
811
814
  "references": {
812
815
  "Promise": {
813
816
  "location": "global",
814
817
  "id": "global::Promise"
818
+ },
819
+ "HTMLTdsDropdownOptionElement": {
820
+ "location": "global",
821
+ "id": "global::HTMLTdsDropdownOptionElement"
815
822
  }
816
823
  },
817
- "return": "Promise<void>"
824
+ "return": "Promise<{ value: string; label: string; }[]>"
818
825
  },
819
826
  "docs": {
820
- "text": "Method that resets the Dropdown, marks all children as non-selected and resets the value to null.",
827
+ "text": "",
821
828
  "tags": []
822
829
  }
823
830
  },
824
- "focusElement": {
831
+ "reset": {
825
832
  "complexType": {
826
833
  "signature": "() => Promise<void>",
827
834
  "parameters": [],
@@ -834,19 +841,15 @@ export class TdsDropdown {
834
841
  "return": "Promise<void>"
835
842
  },
836
843
  "docs": {
837
- "text": "Method that forces focus on the input element.",
844
+ "text": "",
838
845
  "tags": []
839
846
  }
840
847
  },
841
- "setValue": {
848
+ "removeValue": {
842
849
  "complexType": {
843
- "signature": "(value: string | string[], label?: string) => Promise<{ value: string; label: string; }[]>",
850
+ "signature": "(oldValue: string) => Promise<void>",
844
851
  "parameters": [{
845
- "name": "value",
846
- "type": "string | string[]",
847
- "docs": ""
848
- }, {
849
- "name": "label",
852
+ "name": "oldValue",
850
853
  "type": "string",
851
854
  "docs": ""
852
855
  }],
@@ -854,27 +857,19 @@ export class TdsDropdown {
854
857
  "Promise": {
855
858
  "location": "global",
856
859
  "id": "global::Promise"
857
- },
858
- "HTMLTdsDropdownOptionElement": {
859
- "location": "global",
860
- "id": "global::HTMLTdsDropdownOptionElement"
861
860
  }
862
861
  },
863
- "return": "Promise<{ value: string; label: string; }[]>"
862
+ "return": "Promise<void>"
864
863
  },
865
864
  "docs": {
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>",
865
+ "text": "",
867
866
  "tags": []
868
867
  }
869
868
  },
870
- "appendValue": {
869
+ "focusElement": {
871
870
  "complexType": {
872
- "signature": "(value: string) => Promise<void>",
873
- "parameters": [{
874
- "name": "value",
875
- "type": "string",
876
- "docs": ""
877
- }],
871
+ "signature": "() => Promise<void>",
872
+ "parameters": [],
878
873
  "references": {
879
874
  "Promise": {
880
875
  "location": "global",
@@ -884,42 +879,35 @@ export class TdsDropdown {
884
879
  "return": "Promise<void>"
885
880
  },
886
881
  "docs": {
887
- "text": "",
888
- "tags": [{
889
- "name": "internal",
890
- "text": undefined
891
- }]
882
+ "text": "Method that forces focus on the input element.",
883
+ "tags": []
892
884
  }
893
885
  },
894
- "removeValue": {
886
+ "close": {
895
887
  "complexType": {
896
- "signature": "(oldValue: string) => Promise<{ value: string; label: string; }[]>",
897
- "parameters": [{
898
- "name": "oldValue",
899
- "type": "string",
900
- "docs": ""
901
- }],
888
+ "signature": "() => Promise<void>",
889
+ "parameters": [],
902
890
  "references": {
903
891
  "Promise": {
904
892
  "location": "global",
905
893
  "id": "global::Promise"
906
- },
907
- "HTMLTdsDropdownOptionElement": {
908
- "location": "global",
909
- "id": "global::HTMLTdsDropdownOptionElement"
910
894
  }
911
895
  },
912
- "return": "Promise<{ value: string; label: string; }[]>"
896
+ "return": "Promise<void>"
913
897
  },
914
898
  "docs": {
915
- "text": "Method for removing a selected value in the Dropdown.",
899
+ "text": "Method for closing the Dropdown.",
916
900
  "tags": []
917
901
  }
918
902
  },
919
- "close": {
903
+ "appendValue": {
920
904
  "complexType": {
921
- "signature": "() => Promise<void>",
922
- "parameters": [],
905
+ "signature": "(value: string) => Promise<void>",
906
+ "parameters": [{
907
+ "name": "value",
908
+ "type": "string",
909
+ "docs": ""
910
+ }],
923
911
  "references": {
924
912
  "Promise": {
925
913
  "location": "global",
@@ -929,7 +917,7 @@ export class TdsDropdown {
929
917
  "return": "Promise<void>"
930
918
  },
931
919
  "docs": {
932
- "text": "Method for closing the Dropdown.",
920
+ "text": "",
933
921
  "tags": []
934
922
  }
935
923
  }
@@ -938,6 +926,9 @@ export class TdsDropdown {
938
926
  static get elementRef() { return "host"; }
939
927
  static get watchers() {
940
928
  return [{
929
+ "propName": "value",
930
+ "methodName": "handleValueChange"
931
+ }, {
941
932
  "propName": "open",
942
933
  "methodName": "handleOpenState"
943
934
  }];