@sebgroup/green-core 3.17.2-rc.20260708123416223 → 3.17.3

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.
@@ -133,7 +133,6 @@ declare class Dropdown extends GdsFormControlElement implements OptionsContainer
133
133
  * Update value assignment and request update when the light DOM changes.
134
134
  */
135
135
  private _handleLightDOMChange;
136
- private _handleValueChange;
137
136
  /**
138
137
  * Emits `gds-ui-state`event and does some other house-keeping when the open state changes.
139
138
  */
@@ -277,14 +277,19 @@ let Dropdown = class extends GdsFormControlElement {
277
277
  * If the dropdown is in multiple mode, this will be a comma separated list of the selected values.
278
278
  */
279
279
  get displayValue() {
280
+ if (this.value === void 0) {
281
+ return this.placeholder?.innerText || "";
282
+ }
280
283
  let displayValue;
281
284
  if (Array.isArray(this.value)) {
282
285
  displayValue = this.value.slice(0, 5).reduce(
283
- (acc, cur) => acc + this.options.find((v) => v.value === cur)?.innerText + ", ",
286
+ (acc, cur) => acc + this.options.find((v) => this.compareWith(v.value, cur))?.innerText + ", ",
284
287
  ""
285
288
  ).slice(0, -2).replace(/(.{25})(.*)/, "$1...");
286
289
  } else {
287
- displayValue = this.options.find((v) => v.selected)?.innerText;
290
+ displayValue = this.options.find(
291
+ (v) => this.compareWith(v.value, this.value)
292
+ )?.innerText;
288
293
  }
289
294
  return displayValue || this.placeholder?.innerText || "";
290
295
  }
@@ -307,7 +312,6 @@ let Dropdown = class extends GdsFormControlElement {
307
312
  this.addEventListener("blur", __privateGet(this, _handleBlur));
308
313
  this.updateComplete.then(() => {
309
314
  this._handleLightDOMChange();
310
- this._handleValueChange();
311
315
  this._handleOpenChange();
312
316
  });
313
317
  }
@@ -412,6 +416,7 @@ let Dropdown = class extends GdsFormControlElement {
412
416
  id="listbox"
413
417
  .multiple="${ifDefined(this.multiple)}"
414
418
  .compareWith="${this.compareWith}"
419
+ .selection="${this.multiple ? this.value : [this.value]}"
415
420
  @change="${__privateMethod(this, _handleSelectionChange, handleSelectionChange_fn)}"
416
421
  @gds-focus="${__privateGet(this, _handleOptionFocusChange)}"
417
422
  @keydown=${__privateGet(this, _handleListboxKeyDown)}
@@ -446,7 +451,6 @@ let Dropdown = class extends GdsFormControlElement {
446
451
  this.requestUpdate();
447
452
  __privateSet(this, _optionElements, this.querySelectorAll("[gds-element=gds-option]"));
448
453
  if (this.multiple) {
449
- this._handleValueChange();
450
454
  return;
451
455
  }
452
456
  if (this.value === void 0) {
@@ -458,17 +462,6 @@ let Dropdown = class extends GdsFormControlElement {
458
462
  this.options[0] && (this.options[0].selected = true);
459
463
  this.value = this.options[0]?.value;
460
464
  }
461
- this._handleValueChange();
462
- }
463
- _handleValueChange() {
464
- this._elListbox.then((listbox) => {
465
- if (listbox) {
466
- if (Array.isArray(this.value))
467
- listbox.selection = this.value;
468
- else
469
- listbox.selection = [this.value];
470
- }
471
- });
472
465
  }
473
466
  _handleOpenChange() {
474
467
  const open = this.open;
@@ -603,9 +596,6 @@ __decorateClass([
603
596
  characterData: true
604
597
  })
605
598
  ], Dropdown.prototype, "_handleLightDOMChange", 1);
606
- __decorateClass([
607
- watch("value")
608
- ], Dropdown.prototype, "_handleValueChange", 1);
609
599
  __decorateClass([
610
600
  watch("open")
611
601
  ], Dropdown.prototype, "_handleOpenChange", 1);