dap-design-system 0.62.1 → 0.62.2

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 (42) hide show
  1. package/dist/components/combobox/comboboxBase.d.ts +6 -0
  2. package/dist/components/combobox/comboboxBase.js +79 -61
  3. package/dist/components/combobox/comboboxBase.js.map +1 -1
  4. package/dist/components/datatable/datatable.component.d.ts +2 -0
  5. package/dist/components/datatable/datatable.component.js +131 -112
  6. package/dist/components/datatable/datatable.component.js.map +1 -1
  7. package/dist/components/datatable/datatable.scss.js +1 -1
  8. package/dist/components/icon-button/icon-button.component.js +15 -12
  9. package/dist/components/icon-button/icon-button.component.js.map +1 -1
  10. package/dist/components/input/input-base-element.js +42 -38
  11. package/dist/components/input/input-base-element.js.map +1 -1
  12. package/dist/components/input/input.component.d.ts +1 -0
  13. package/dist/components/input/input.component.js.map +1 -1
  14. package/dist/components/option-list/option-list.component.js +16 -12
  15. package/dist/components/option-list/option-list.component.js.map +1 -1
  16. package/dist/components/select/select.component.js +71 -66
  17. package/dist/components/select/select.component.js.map +1 -1
  18. package/dist/components/snackbar/snackbar-message.component.js +16 -18
  19. package/dist/components/snackbar/snackbar-message.component.js.map +1 -1
  20. package/dist/components/snackbar/snackbar.component.js +48 -35
  21. package/dist/components/snackbar/snackbar.component.js.map +1 -1
  22. package/dist/components/table/table.component.d.ts +3 -0
  23. package/dist/components/table/table.component.js +30 -27
  24. package/dist/components/table/table.component.js.map +1 -1
  25. package/dist/components/textarea/textarea.component.d.ts +6 -1
  26. package/dist/components/textarea/textarea.component.js +43 -36
  27. package/dist/components/textarea/textarea.component.js.map +1 -1
  28. package/dist/components/tooltip/tooltip.component.d.ts +2 -0
  29. package/dist/components/tooltip/tooltip.component.js +51 -53
  30. package/dist/components/tooltip/tooltip.component.js.map +1 -1
  31. package/dist/internal/mixin/labelableMixin.d.ts +3 -0
  32. package/dist/internal/mixin/labelableMixin.js +15 -12
  33. package/dist/internal/mixin/labelableMixin.js.map +1 -1
  34. package/dist/manifest/types/vue/index.d.ts +436 -433
  35. package/dist/manifest/vscode.html-custom-data.json +152 -148
  36. package/dist/manifest/web-types.json +745 -735
  37. package/dist/react/dap-ds-input/index.d.ts +1 -0
  38. package/dist/react/dap-ds-input/index.js.map +1 -1
  39. package/dist/react/index.d.ts +18 -18
  40. package/dist/react-types.ts +18 -18
  41. package/dist/react.js +80 -80
  42. package/package.json +1 -1
@@ -38,6 +38,12 @@ export default class ComboboxBaseElement extends GenericFormElement {
38
38
  /** True when the search input currently holds non-whitespace text. */
39
39
  private get hasSearchText();
40
40
  selectedItem: any;
41
+ /**
42
+ * Display text of the selected item. `selectedItem` is either an option element
43
+ * (has `optionText`) when set from `value`, or an option event detail (has `text`)
44
+ * when picked by the user; reading `.text` alone yields "undefined" for the former.
45
+ */
46
+ private get selectedItemText();
41
47
  selectedItems: any[];
42
48
  currentItem: any;
43
49
  selectedText: string;
@@ -1,20 +1,20 @@
1
1
  var w = Object.getPrototypeOf;
2
2
  var S = Reflect.get;
3
3
  var x = (m, e, t) => S(w(m), t, e);
4
- var o = (m, e, t) => new Promise((i, a) => {
4
+ var h = (m, e, t) => new Promise((i, a) => {
5
5
  var n = (u) => {
6
6
  try {
7
7
  c(t.next(u));
8
8
  } catch (b) {
9
9
  a(b);
10
10
  }
11
- }, h = (u) => {
11
+ }, o = (u) => {
12
12
  try {
13
13
  c(t.throw(u));
14
14
  } catch (b) {
15
15
  a(b);
16
16
  }
17
- }, c = (u) => u.done ? i(u.value) : Promise.resolve(u.value).then(n, h);
17
+ }, c = (u) => u.done ? i(u.value) : Promise.resolve(u.value).then(n, o);
18
18
  c((t = t.apply(m, e)).next());
19
19
  });
20
20
  import { clsx as g } from "../../node_modules/clsx/dist/clsx.js";
@@ -26,54 +26,61 @@ import { state as v } from "../../node_modules/@lit/reactive-element/decorators/
26
26
  import { query as C } from "../../node_modules/@lit/reactive-element/decorators/query.js";
27
27
  import { ifDefined as p } from "../../node_modules/lit-html/directives/if-defined.js";
28
28
  import { html as d } from "../../node_modules/lit-html/static.js";
29
- import { getValidityStateObject as V } from "../../common/utils.js";
30
- import { GenericFormElement as $ } from "../../internal/mixin/genericFormElement.js";
29
+ import { getValidityStateObject as D } from "../../common/utils.js";
30
+ import { GenericFormElement as V } from "../../internal/mixin/genericFormElement.js";
31
31
  import "../../localization/localization.js";
32
- import D from "./combobox.scss.js";
32
+ import $ from "./combobox.scss.js";
33
33
  import { t as y } from "../../node_modules/i18next/dist/esm/i18next.js";
34
34
  import { unsafeCSS as O } from "../../node_modules/@lit/reactive-element/css-tag.js";
35
35
  var T = Object.defineProperty, l = (m, e, t, i) => {
36
- for (var a = void 0, n = m.length - 1, h; n >= 0; n--)
37
- (h = m[n]) && (a = h(e, t, a) || a);
36
+ for (var a = void 0, n = m.length - 1, o; n >= 0; n--)
37
+ (o = m[n]) && (a = o(e, t, a) || a);
38
38
  return a && T(e, t, a), a;
39
39
  };
40
- const f = class f extends $ {
40
+ const f = class f extends V {
41
41
  constructor() {
42
42
  super(...arguments), this.placement = "bottom-start", this.opened = !1, this.searchMode = "autocomplete", this.search = !1, this.clearButton = "true", this.allowManualInput = !1, this.searchForText = !1, this.searchOnValueSet = "false", this.loading = !1, this.selectable = "true", this.noAnimation = !1, this.textComplete = !1, this.openOnEmpty = !1, this.disableViewportAutoClose = !1, this.multiselect = !1, this.clearButtonTestId = "combobox-clear-button", this.searchButtonTestId = "combobox-search-button", this.disableSearchWhenEmpty = !1, this.selectedItems = [], this.optionListObserver = null, this.isUserInteraction = !1, this.pendingInitialValues = [], this.handleClick = () => {
43
43
  !this.getComboboxOptions().length && !this.openOnEmpty ? this.hideDropDown() : this.opened ? this.hideDropDown() : this.showDropDown();
44
- }, this.handleKeyDown = (e) => o(this, null, function* () {
44
+ }, this.handleKeyDown = (e) => h(this, null, function* () {
45
45
  var t, i;
46
- if (e.key !== "Tab") {
47
- if (e.key === "Enter")
48
- return this.handleEnterKey(e);
49
- if (e.key === "Escape")
50
- return this.hideDropDown(), this.focus();
51
- if (e.key === "Backspace" && this.multiselect && (((t = this.triggerInput) == null ? void 0 : t.value) || "") === "" && this.selectedItems.length > 0) {
52
- e.preventDefault();
53
- const n = this.selectedItems[this.selectedItems.length - 1];
54
- this.removeSelectedItem(n), this.emit("dds-change", {
55
- value: this.selectedItems.map((h) => h.value).join(","),
56
- selectedItems: this.selectedItems,
57
- type: "remove",
58
- item: n
59
- }), this.setValidity();
60
- return;
61
- }
62
- if ((e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "ArrowLeft" || e.key === "ArrowRight") && this.isAutoComplete)
63
- return this.handleArrowKeys(e);
64
- if (this.isAutoComplete && ((i = this.triggerInput) != null && i.value) && !this.opened) {
65
- const a = this.getComboboxOptions().length > 0;
66
- (this.openOnEmpty || a) && this.showDropDown();
67
- }
46
+ if (e.key === "Tab") {
47
+ this.hideDropDown({ skipFocus: !0 });
48
+ return;
49
+ }
50
+ if (e.key === "Enter")
51
+ return this.handleEnterKey(e);
52
+ if (e.key === "Escape")
53
+ return this.hideDropDown(), this.focus();
54
+ if (e.key === "Backspace" && this.multiselect && (((t = this.triggerInput) == null ? void 0 : t.value) || "") === "" && this.selectedItems.length > 0) {
55
+ e.preventDefault();
56
+ const n = this.selectedItems[this.selectedItems.length - 1];
57
+ this.removeSelectedItem(n), this.emit("dds-change", {
58
+ value: this.selectedItems.map((o) => o.value).join(","),
59
+ selectedItems: this.selectedItems,
60
+ type: "remove",
61
+ item: n
62
+ }), this.setValidity();
63
+ return;
64
+ }
65
+ if ((e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "ArrowLeft" || e.key === "ArrowRight") && this.isAutoComplete)
66
+ return this.handleArrowKeys(e);
67
+ if (this.isAutoComplete && ((i = this.triggerInput) != null && i.value) && !this.opened) {
68
+ const a = this.getComboboxOptions().length > 0;
69
+ (this.openOnEmpty || a) && this.showDropDown();
68
70
  }
69
- }), this.handleInput = (e) => o(this, null, function* () {
71
+ }), this.handleInput = (e) => h(this, null, function* () {
70
72
  const t = this.triggerInput;
71
73
  if (this.isUserInteraction = !0, e.inputType !== "deleteContentBackward" || e.inputType === "deleteContentBackward" && this.allowManualInput ? (this.selectedText = t.value, this.search && (this.value = t.value)) : this.search ? (this.selectedText = t.value, this.value = t.value) : t.value === "" && e.inputType === "deleteContentBackward" && this.clearSelection(), this.emit("dds-input", { input: t.value, originalEvent: e }), this.setValidity(), this.requestUpdate(), this.isAutoComplete && t.value && !this.opened) {
72
74
  const i = this.getComboboxOptions().length > 0;
73
75
  (this.openOnEmpty || i) && this.showDropDown();
74
76
  }
75
77
  }), this.handleListKeyDown = (e) => {
76
- e.detail.key === "Escape" && (this.hideDropDown(), this.currentItem = this.selectedItem, this.selectedText = "", this.triggerInput.value = this.selectedItem.text, this.triggerInput.focus());
78
+ var t, i;
79
+ if (((t = e.detail) == null ? void 0 : t.key) === "Tab") {
80
+ this.hideDropDown({ skipFocus: !0 }), this.triggerInput.focus();
81
+ return;
82
+ }
83
+ ((i = e.detail) == null ? void 0 : i.key) === "Escape" && (this.hideDropDown(), this.currentItem = this.selectedItem, this.selectedText = "", this.selectedItem && (this.triggerInput.value = this.selectedItemText), this.triggerInput.focus());
77
84
  }, this.handleDocumentMouseDown = (e) => {
78
85
  const t = e.composedPath();
79
86
  this && !t.includes(this) && this.hideDropDown();
@@ -83,7 +90,7 @@ const f = class f extends $ {
83
90
  this.emit("dds-focus");
84
91
  }, this.handleBlur = () => {
85
92
  this.emit("dds-blur");
86
- }, this.handleSelectedChange = (e) => o(this, null, function* () {
93
+ }, this.handleSelectedChange = (e) => h(this, null, function* () {
87
94
  var t;
88
95
  if (e.preventDefault(), e.stopPropagation(), this.searchForText)
89
96
  this.selectedText = e.detail.text, this.value = e.detail.text, this.triggerInput.value = e.detail.text, this.emit("dds-search", { search: this.selectedText }), this.requestUpdate(), this.setValidity();
@@ -130,11 +137,19 @@ const f = class f extends $ {
130
137
  }
131
138
  /** True when the search input currently holds non-whitespace text. */
132
139
  get hasSearchText() {
133
- var t;
134
- return (this.selectedText || ((t = this.selectedItem) == null ? void 0 : t.text) || this.value || "").trim().length > 0;
140
+ return (this.selectedText || this.selectedItemText || this.value || "").trim().length > 0;
141
+ }
142
+ /**
143
+ * Display text of the selected item. `selectedItem` is either an option element
144
+ * (has `optionText`) when set from `value`, or an option event detail (has `text`)
145
+ * when picked by the user; reading `.text` alone yields "undefined" for the former.
146
+ */
147
+ get selectedItemText() {
148
+ var e, t, i, a;
149
+ return (a = (i = (e = this.selectedItem) == null ? void 0 : e.text) != null ? i : (t = this.selectedItem) == null ? void 0 : t.optionText) != null ? a : "";
135
150
  }
136
151
  firstUpdated(e) {
137
- return o(this, null, function* () {
152
+ return h(this, null, function* () {
138
153
  var a;
139
154
  x(f.prototype, this, "firstUpdated").call(this, e), yield this.optionList.updateComplete, yield new Promise((n) => requestAnimationFrame(n));
140
155
  const t = this.getComboboxOptions();
@@ -142,7 +157,7 @@ const f = class f extends $ {
142
157
  const i = x(f.prototype, this, "value");
143
158
  if (i)
144
159
  if (this.multiselect) {
145
- const n = i.split(",").map((h) => h.trim()).filter((h) => h);
160
+ const n = i.split(",").map((o) => o.trim()).filter((o) => o);
146
161
  this.pendingInitialValues = n, this.updateMultipleSelectionsFromValues(n);
147
162
  } else
148
163
  this.selectedItem = (a = this.optionList) == null ? void 0 : a.getAllOptions().find((n) => n.value === i), this.selectedItem ? this.selectedText = this.selectedItem.optionText || "" : this.selectedText = "", !this.selectedText && (this.allowManualInput || this.searchMode === "none") && (this.selectedText = i);
@@ -179,9 +194,9 @@ const f = class f extends $ {
179
194
  e.forEach((i) => {
180
195
  if (i.type === "childList") {
181
196
  const a = Array.from(i.addedNodes).some(
182
- (h) => h.nodeName === "DAP-DS-OPTION-ITEM"
197
+ (o) => o.nodeName === "DAP-DS-OPTION-ITEM"
183
198
  ), n = Array.from(i.removedNodes).some(
184
- (h) => h.nodeName === "DAP-DS-OPTION-ITEM"
199
+ (o) => o.nodeName === "DAP-DS-OPTION-ITEM"
185
200
  );
186
201
  (a || n) && (t = !0);
187
202
  }
@@ -243,32 +258,32 @@ const f = class f extends $ {
243
258
  return this.placeholder && this.placeholder.trim() !== "" ? !1 : e === "";
244
259
  }
245
260
  handleEnterKey(e) {
246
- return o(this, null, function* () {
261
+ return h(this, null, function* () {
247
262
  return e.preventDefault(), e.stopPropagation(), this.allowManualInput ? this.handleSearchEnter() : this.currentItem && this.opened ? this.handleCurrentItemEnter() : this.search && !this.isAutoComplete ? this.handleSearchEnter() : this.handleDefaultEnter();
248
263
  });
249
264
  }
250
265
  handleCurrentItemEnter() {
251
- return o(this, null, function* () {
266
+ return h(this, null, function* () {
252
267
  var e, t;
253
268
  if (this.currentItem.value === ((e = this.selectedItem) == null ? void 0 : e.value)) {
254
- this.hideDropDown(), this.triggerInput.value = this.selectedItem.text, this.triggerInput.focus();
269
+ this.hideDropDown(), this.triggerInput.value = this.selectedItemText, this.triggerInput.focus();
255
270
  return;
256
271
  }
257
272
  this.currentItem.value !== ((t = this.selectedItem) == null ? void 0 : t.value) && (this.searchForText ? yield this.handleTextSearch(this.currentItem.text) : yield this.handleSelectedItemChange(this.currentItem));
258
273
  });
259
274
  }
260
275
  handleSearchEnter() {
261
- return o(this, null, function* () {
276
+ return h(this, null, function* () {
262
277
  return this.emit("dds-search", { search: this.selectedText }), this.setValidity(), this.hideDropDown();
263
278
  });
264
279
  }
265
280
  handleDefaultEnter() {
266
- return o(this, null, function* () {
281
+ return h(this, null, function* () {
267
282
  return this.opened ? this.hideDropDown() : (this.openOnEmpty || this.getComboboxOptions().length || this.isAutoComplete) && this.showDropDown();
268
283
  });
269
284
  }
270
285
  handleSelectedItemChange(e) {
271
- return o(this, null, function* () {
286
+ return h(this, null, function* () {
272
287
  this.selectedItem = e, this.emit("dds-change", {
273
288
  value: this.selectedItem.value,
274
289
  selectedItem: this.selectedItem,
@@ -277,12 +292,12 @@ const f = class f extends $ {
277
292
  });
278
293
  }
279
294
  handleTextSearch(e) {
280
- return o(this, null, function* () {
295
+ return h(this, null, function* () {
281
296
  this.value = e, this.selectedText = e, this.triggerInput.value = e, this.triggerInput.focus(), this.emit("dds-search", { search: e }), this.setValidity();
282
297
  });
283
298
  }
284
299
  handleArrowKeys(e) {
285
- return o(this, null, function* () {
300
+ return h(this, null, function* () {
286
301
  if (e.preventDefault(), !this.opened)
287
302
  if (this.openOnEmpty || this.getComboboxOptions().length || this.isAutoComplete)
288
303
  this.showDropDown();
@@ -292,7 +307,7 @@ const f = class f extends $ {
292
307
  });
293
308
  }
294
309
  clearSelection() {
295
- return o(this, null, function* () {
310
+ return h(this, null, function* () {
296
311
  var t;
297
312
  this.isUserInteraction = !1;
298
313
  const e = !!(this.value || this.selectedText || (t = this.triggerInput) != null && t.value);
@@ -338,10 +353,10 @@ const f = class f extends $ {
338
353
  this.selectedItems.length === 0 && (this.selectedItems = []);
339
354
  let a = !1;
340
355
  e.forEach((n) => {
341
- const h = t.find(
356
+ const o = t.find(
342
357
  (c) => c.value === n || c.getAttribute("value") === n
343
358
  );
344
- h && (this.selectedItems.some((u) => u.value === n) || (this.selectedItems.push(h), a = !0));
359
+ o && (this.selectedItems.some((u) => u.value === n) || (this.selectedItems.push(o), a = !0));
345
360
  }), a && this.pendingInitialValues.length > 0 && (this.pendingInitialValues = []), this.requestUpdate();
346
361
  }
347
362
  /**
@@ -362,12 +377,12 @@ const f = class f extends $ {
362
377
  super.value = e;
363
378
  }
364
379
  showDropDown() {
365
- return o(this, null, function* () {
380
+ return h(this, null, function* () {
366
381
  this.disabled || this.readonly || !this.isAutoComplete || this.opened || !this.openOnEmpty && !this.getComboboxOptions().length && !this.isAutoComplete || (this.opened = !0, document.addEventListener("mousedown", this.handleDocumentMouseDown));
367
382
  });
368
383
  }
369
384
  hideDropDown(e) {
370
- return o(this, null, function* () {
385
+ return h(this, null, function* () {
371
386
  this.opened && (this.opened = !1, document.removeEventListener("mousedown", this.handleDocumentMouseDown), yield this.updateComplete, e != null && e.skipFocus || this.focus(), this.clearSelectionRange());
372
387
  });
373
388
  }
@@ -385,7 +400,10 @@ const f = class f extends $ {
385
400
  return this.multiselect ? this.getMultiSelectValidity() : this.isAutoComplete ? this.getAutoCompleteValidity() : this.getBasicValidity();
386
401
  }
387
402
  formResetCallback() {
388
- this.internals.setValidity({}), this.internals.setFormValue(this.defaultValue), this.value = this.defaultValue, this.multiselect ? this.selectedItems = [] : this.selectedItem = this.defaultValue;
403
+ var e;
404
+ this.internals.setValidity({}), this.internals.setFormValue(this.defaultValue), this.value = this.defaultValue, this.multiselect ? this.selectedItems = [] : this.selectedItem = (e = this.getComboboxOptions().find(
405
+ (t) => t.value === this.defaultValue
406
+ )) != null ? e : null;
389
407
  }
390
408
  getMultiSelectValidity() {
391
409
  return !this.required || this.selectedItems.length > 0;
@@ -407,7 +425,7 @@ const f = class f extends $ {
407
425
  }
408
426
  // custom validation
409
427
  get validity() {
410
- return this.internals.validity ? this.internals.validity : V({
428
+ return this.internals.validity ? this.internals.validity : D({
411
429
  valueMissing: this.required && !this.getValidity()
412
430
  });
413
431
  }
@@ -480,8 +498,8 @@ const f = class f extends $ {
480
498
  `;
481
499
  }
482
500
  renderInput() {
483
- var t, i, a;
484
- const e = this.multiselect ? this.selectedText : this.selectedText !== "" ? this.selectedText : ((t = this.selectedItem) == null ? void 0 : t.text) || "";
501
+ var t, i;
502
+ const e = this.multiselect ? this.selectedText : this.selectedText !== "" ? this.selectedText : this.selectedItemText;
485
503
  return d`<input
486
504
  id="input"
487
505
  part="input"
@@ -498,7 +516,7 @@ const f = class f extends $ {
498
516
  aria-disabled=${this.disabled}
499
517
  aria-autocomplete="both"
500
518
  aria-controls="option-list"
501
- aria-activedescendant=${p((i = this.getActiveDescendant()) == null ? void 0 : i.id)}
519
+ aria-activedescendant=${p((t = this.getActiveDescendant()) == null ? void 0 : t.id)}
502
520
  aria-multiselectable=${this.multiselect ? "true" : "false"}
503
521
  ?required=${this.required}
504
522
  ?readonly=${this.readonly}
@@ -506,7 +524,7 @@ const f = class f extends $ {
506
524
  autocomplete=${this.autocomplete}
507
525
  ?disabled=${this.disabled}
508
526
  value=${e}
509
- placeholder=${p((a = this.placeholder) != null ? a : "")}
527
+ placeholder=${p((i = this.placeholder) != null ? i : "")}
510
528
  type=${this.search ? "search" : "text"}
511
529
  @blur=${this.handleBlur}
512
530
  @focus=${this.handleFocus}
@@ -643,7 +661,7 @@ const f = class f extends $ {
643
661
  </div>`;
644
662
  }
645
663
  };
646
- f.styles = O(D);
664
+ f.styles = O($);
647
665
  let s = f;
648
666
  l([
649
667
  C("input")