@scania/tegel 1.23.0-fix-form-components-slider-reset-beta.2 → 1.23.0-value-prop.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.
@@ -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,12 +152,11 @@ 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
- });
155
+ this.resetInput = () => {
156
+ const inputEl = this.host.querySelector('input');
157
+ if (inputEl) {
158
+ this.reset();
159
+ }
152
160
  };
153
161
  this.name = undefined;
154
162
  this.disabled = false;
@@ -166,107 +174,93 @@ export class TdsDropdown {
166
174
  this.normalizeText = true;
167
175
  this.noResultText = 'No result';
168
176
  this.defaultValue = undefined;
169
- this.open = false;
170
177
  this.value = undefined;
178
+ this.open = false;
179
+ this.internalValue = undefined;
171
180
  this.filterResult = undefined;
172
181
  this.filterFocus = undefined;
173
182
  }
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) {
209
- console.warn('Tried to select multiple items, but multiselect is not enabled.');
210
- nextValue = [nextValue[0]];
183
+ handleValueChange(newValue) {
184
+ // Convert both newValue and this.value to arrays for comparison
185
+ const newValueArray = Array.isArray(newValue) ? newValue : newValue ? [newValue] : [];
186
+ const currentValueArray = Array.isArray(this.value)
187
+ ? this.value
188
+ : this.value
189
+ ? [this.value]
190
+ : [];
191
+ // Check if the new value is different from the current value
192
+ const hasChanged = newValueArray.length !== currentValueArray.length ||
193
+ newValueArray.some((val, index) => val !== currentValueArray[index]);
194
+ if (hasChanged) {
195
+ // Proceed with updating selections and emitting changes
196
+ this.updateSelections(newValueArray);
197
+ this.handleChange();
211
198
  }
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);
199
+ }
200
+ updateSelections(valueArray) {
201
+ // Reset current selections
202
+ this.getChildren().forEach((element) => {
203
+ element.setSelected(false);
204
+ });
205
+ if (valueArray) {
206
+ // Validate and filter values
207
+ const validValues = valueArray.filter((val) => {
208
+ const optionExists = this.getChildren().some((element) => element.value === val);
209
+ if (!optionExists) {
210
+ console.warn(`Option with value "${val}" does not exist`);
211
+ }
212
+ return optionExists;
213
+ });
214
+ // Update internal state and selections
215
+ this.internalValue = validValues.join(', ');
216
+ this.getChildren().forEach((element) => {
217
+ if (validValues.includes(element.value)) {
218
+ element.setSelected(true);
219
+ }
220
+ });
221
+ // Update value prop with validated values
222
+ if (this.multiselect) {
223
+ this.value = validValues;
224
+ }
225
+ else {
226
+ this.value = validValues[0] || null;
218
227
  }
219
228
  }
220
- this.value = nextValue;
221
- this.setValueAttribute();
222
- this.selectChildrenAsSelectedBasedOnSelectionProp();
229
+ else {
230
+ // Handle null/undefined case
231
+ this.internalValue = '';
232
+ this.value = this.multiselect ? [] : null;
233
+ }
234
+ // Emit change events
223
235
  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) => ({
236
+ // Update filter input if present
237
+ if (this.filter && this.inputElement) {
238
+ this.inputElement.value = this.internalValue;
239
+ }
240
+ this.setValueAttribute();
241
+ }
242
+ async setValue(value) {
243
+ this.value = value;
244
+ return this.getSelectedChildren().map((element) => ({
227
245
  value: element.value,
228
246
  label: element.textContent.trim(),
229
247
  }));
230
- // Update inputElement value and placeholder text
231
- if (this.filter) {
232
- this.inputElement.value = this.getValue();
233
- }
234
- return selection;
235
248
  }
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
- }
249
+ async reset() {
250
+ this.value = this.multiselect ? [] : null;
246
251
  }
247
- /** Method for removing a selected value in the Dropdown. */
248
252
  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
- });
253
+ if (this.multiselect && Array.isArray(this.value)) {
254
+ this.value = this.value.filter((v) => v !== oldValue);
261
255
  }
262
256
  else {
263
- this.reset();
257
+ this.value = null;
264
258
  }
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 }));
259
+ }
260
+ /** Method that forces focus on the input element. */
261
+ async focusElement() {
262
+ this.focusInputElement();
263
+ this.handleFocus({});
270
264
  }
271
265
  /** Method for closing the Dropdown. */
272
266
  async close() {
@@ -320,6 +314,9 @@ export class TdsDropdown {
320
314
  }
321
315
  }
322
316
  componentWillLoad() {
317
+ if (this.defaultValue && !this.value) {
318
+ this.value = this.defaultValue;
319
+ }
323
320
  this.setDefaultOption();
324
321
  }
325
322
  /** Method to handle slot changes */
@@ -330,34 +327,31 @@ export class TdsDropdown {
330
327
  normalizeString(text) {
331
328
  return this.normalizeText ? text.normalize('NFD').replace(/\p{Diacritic}/gu, '') : text;
332
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();
330
+ async appendValue(value) {
331
+ if (this.multiselect) {
332
+ this.value = Array.isArray(this.value) ? [...this.value, value] : [value];
333
+ }
334
+ else {
335
+ this.value = value;
336
+ }
341
337
  }
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
- });
338
+ componentDidRender() {
339
+ const form = this.host.closest('form');
340
+ if (form) {
341
+ form.addEventListener('reset', this.resetInput);
342
+ }
343
+ }
344
+ disconnectedCallback() {
345
+ const form = this.host.closest('form');
346
+ if (form) {
347
+ form.removeEventListener('reset', this.resetInput);
348
+ }
356
349
  }
357
350
  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: {
351
+ var _a, _b, _c;
352
+ const valueArray = Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
353
+ appendHiddenInput(this.host, this.name, valueArray.map((value) => value).toString(), this.disabled);
354
+ return (h(Host, { key: '65dc50a4788d2fdade55db41bfc6cdfcad76b7d5', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: '389e82159e7756782fc12af15d7efb43d8cfeafb', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'e7e4585e630ebbab3ae178bbe7b0d3eb0793ba60', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
361
355
  filter: true,
362
356
  focus: this.filterFocus,
363
357
  disabled: this.disabled,
@@ -365,7 +359,7 @@ export class TdsDropdown {
365
359
  } }, 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
360
  label-inside-as-placeholder
367
361
  ${this.size}
368
- ${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
362
+ ${((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) ? 'selected' : ''}
369
363
  ` }, this.label)), h("input", {
370
364
  // eslint-disable-next-line no-return-assign
371
365
  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 +368,7 @@ export class TdsDropdown {
374
368
  this.inputElement.value = this.getValue();
375
369
  }
376
370
  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) => {
371
+ }, onFocus: (event) => this.handleFocus(event), onKeyDown: (event) => {
386
372
  if (event.key === 'Escape') {
387
373
  this.open = false;
388
374
  }
@@ -406,8 +392,8 @@ export class TdsDropdown {
406
392
  `, 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
393
  label-inside-as-placeholder
408
394
  ${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: {
395
+ ${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
396
+ ` }, 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: 'c79561725649f2cda46d13e7290ec0ea698f930e', ref: (element) => (this.dropdownList = element), class: {
411
397
  'dropdown-list': true,
412
398
  [this.size]: true,
413
399
  [this.getOpenDirection()]: true,
@@ -416,7 +402,7 @@ export class TdsDropdown {
416
402
  'closed': !this.open,
417
403
  [`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
418
404
  [`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))));
405
+ } }, h("slot", { key: '958aa0e620a825c8d20ec4cfeae334c3c59e85dc', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: '8138e3340cd62d46ea8938b2d9f0609c03951a1f', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: '3e7a1e9e8520eadc5b805d5512c6fbe177d69755', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: '882c2152620d7d7c2ad576db12ecd65d04446600', name: "error", size: "16px" }), this.helper))));
420
406
  }
421
407
  static get is() { return "tds-dropdown"; }
422
408
  static get encapsulation() { return "shadow"; }
@@ -713,13 +699,30 @@ export class TdsDropdown {
713
699
  },
714
700
  "attribute": "default-value",
715
701
  "reflect": false
702
+ },
703
+ "value": {
704
+ "type": "string",
705
+ "mutable": true,
706
+ "complexType": {
707
+ "original": "string | string[]",
708
+ "resolved": "string | string[]",
709
+ "references": {}
710
+ },
711
+ "required": false,
712
+ "optional": false,
713
+ "docs": {
714
+ "tags": [],
715
+ "text": "Value of the dropdown. For multiselect, provide array of strings. For single select, provide a string."
716
+ },
717
+ "attribute": "value",
718
+ "reflect": false
716
719
  }
717
720
  };
718
721
  }
719
722
  static get states() {
720
723
  return {
721
724
  "open": {},
722
- "value": {},
725
+ "internalValue": {},
723
726
  "filterResult": {},
724
727
  "filterFocus": {}
725
728
  };
@@ -800,28 +803,51 @@ export class TdsDropdown {
800
803
  }
801
804
  }
802
805
  }
806
+ }, {
807
+ "method": "tdsValueChange",
808
+ "name": "tdsValueChange",
809
+ "bubbles": true,
810
+ "cancelable": false,
811
+ "composed": true,
812
+ "docs": {
813
+ "tags": [],
814
+ "text": "Value change event for the Dropdown."
815
+ },
816
+ "complexType": {
817
+ "original": "{\n name: string;\n value: string;\n }",
818
+ "resolved": "{ name: string; value: string; }",
819
+ "references": {}
820
+ }
803
821
  }];
804
822
  }
805
823
  static get methods() {
806
824
  return {
807
- "reset": {
825
+ "setValue": {
808
826
  "complexType": {
809
- "signature": "() => Promise<void>",
810
- "parameters": [],
827
+ "signature": "(value: string | string[]) => Promise<{ value: string; label: string; }[]>",
828
+ "parameters": [{
829
+ "name": "value",
830
+ "type": "string | string[]",
831
+ "docs": ""
832
+ }],
811
833
  "references": {
812
834
  "Promise": {
813
835
  "location": "global",
814
836
  "id": "global::Promise"
837
+ },
838
+ "HTMLTdsDropdownOptionElement": {
839
+ "location": "global",
840
+ "id": "global::HTMLTdsDropdownOptionElement"
815
841
  }
816
842
  },
817
- "return": "Promise<void>"
843
+ "return": "Promise<{ value: string; label: string; }[]>"
818
844
  },
819
845
  "docs": {
820
- "text": "Method that resets the Dropdown, marks all children as non-selected and resets the value to null.",
846
+ "text": "",
821
847
  "tags": []
822
848
  }
823
849
  },
824
- "focusElement": {
850
+ "reset": {
825
851
  "complexType": {
826
852
  "signature": "() => Promise<void>",
827
853
  "parameters": [],
@@ -834,19 +860,15 @@ export class TdsDropdown {
834
860
  "return": "Promise<void>"
835
861
  },
836
862
  "docs": {
837
- "text": "Method that forces focus on the input element.",
863
+ "text": "",
838
864
  "tags": []
839
865
  }
840
866
  },
841
- "setValue": {
867
+ "removeValue": {
842
868
  "complexType": {
843
- "signature": "(value: string | string[], label?: string) => Promise<{ value: string; label: string; }[]>",
869
+ "signature": "(oldValue: string) => Promise<void>",
844
870
  "parameters": [{
845
- "name": "value",
846
- "type": "string | string[]",
847
- "docs": ""
848
- }, {
849
- "name": "label",
871
+ "name": "oldValue",
850
872
  "type": "string",
851
873
  "docs": ""
852
874
  }],
@@ -854,27 +876,19 @@ export class TdsDropdown {
854
876
  "Promise": {
855
877
  "location": "global",
856
878
  "id": "global::Promise"
857
- },
858
- "HTMLTdsDropdownOptionElement": {
859
- "location": "global",
860
- "id": "global::HTMLTdsDropdownOptionElement"
861
879
  }
862
880
  },
863
- "return": "Promise<{ value: string; label: string; }[]>"
881
+ "return": "Promise<void>"
864
882
  },
865
883
  "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>",
884
+ "text": "",
867
885
  "tags": []
868
886
  }
869
887
  },
870
- "appendValue": {
888
+ "focusElement": {
871
889
  "complexType": {
872
- "signature": "(value: string) => Promise<void>",
873
- "parameters": [{
874
- "name": "value",
875
- "type": "string",
876
- "docs": ""
877
- }],
890
+ "signature": "() => Promise<void>",
891
+ "parameters": [],
878
892
  "references": {
879
893
  "Promise": {
880
894
  "location": "global",
@@ -884,42 +898,35 @@ export class TdsDropdown {
884
898
  "return": "Promise<void>"
885
899
  },
886
900
  "docs": {
887
- "text": "",
888
- "tags": [{
889
- "name": "internal",
890
- "text": undefined
891
- }]
901
+ "text": "Method that forces focus on the input element.",
902
+ "tags": []
892
903
  }
893
904
  },
894
- "removeValue": {
905
+ "close": {
895
906
  "complexType": {
896
- "signature": "(oldValue: string) => Promise<{ value: string; label: string; }[]>",
897
- "parameters": [{
898
- "name": "oldValue",
899
- "type": "string",
900
- "docs": ""
901
- }],
907
+ "signature": "() => Promise<void>",
908
+ "parameters": [],
902
909
  "references": {
903
910
  "Promise": {
904
911
  "location": "global",
905
912
  "id": "global::Promise"
906
- },
907
- "HTMLTdsDropdownOptionElement": {
908
- "location": "global",
909
- "id": "global::HTMLTdsDropdownOptionElement"
910
913
  }
911
914
  },
912
- "return": "Promise<{ value: string; label: string; }[]>"
915
+ "return": "Promise<void>"
913
916
  },
914
917
  "docs": {
915
- "text": "Method for removing a selected value in the Dropdown.",
918
+ "text": "Method for closing the Dropdown.",
916
919
  "tags": []
917
920
  }
918
921
  },
919
- "close": {
922
+ "appendValue": {
920
923
  "complexType": {
921
- "signature": "() => Promise<void>",
922
- "parameters": [],
924
+ "signature": "(value: string) => Promise<void>",
925
+ "parameters": [{
926
+ "name": "value",
927
+ "type": "string",
928
+ "docs": ""
929
+ }],
923
930
  "references": {
924
931
  "Promise": {
925
932
  "location": "global",
@@ -929,7 +936,7 @@ export class TdsDropdown {
929
936
  "return": "Promise<void>"
930
937
  },
931
938
  "docs": {
932
- "text": "Method for closing the Dropdown.",
939
+ "text": "",
933
940
  "tags": []
934
941
  }
935
942
  }
@@ -938,6 +945,9 @@ export class TdsDropdown {
938
945
  static get elementRef() { return "host"; }
939
946
  static get watchers() {
940
947
  return [{
948
+ "propName": "value",
949
+ "methodName": "handleValueChange"
950
+ }, {
941
951
  "propName": "open",
942
952
  "methodName": "handleOpenState"
943
953
  }];