@sebgroup/green-core 3.17.2 → 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.
- package/components/dropdown/dropdown.component.d.ts +0 -1
- package/components/dropdown/dropdown.component.js +8 -18
- package/custom-elements.json +44265 -44265
- package/gds-element.js +1 -1
- package/generated/mcp/components.json +1 -1
- package/generated/mcp/icons.json +1 -1
- package/generated/mcp/index.json +1 -1
- package/generated/mcp/list-item-pattern-01/guidelines.md +7 -34
- package/generated/mcp/tokens.json +1 -1
- package/generated/react/index.d.ts +2 -2
- package/generated/react/index.js +2 -2
- package/package.json +1 -1
- package/utils/helpers/custom-element-scoping.js +1 -1
|
@@ -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
|
|
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(
|
|
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);
|