@skf-design-system/ui-components 1.0.0-alpha.38 → 1.0.0-alpha.39

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 (117) hide show
  1. package/README.md +18 -0
  2. package/dist/components/alert/alert.component.d.ts +3 -2
  3. package/dist/components/alert/alert.component.js +39 -33
  4. package/dist/components/breadcrumb/breadcrumb-item.component.js +11 -12
  5. package/dist/components/button/button.component.js +32 -36
  6. package/dist/components/button/button.styles.js +3 -3
  7. package/dist/components/checkbox/checkbox.component.d.ts +6 -5
  8. package/dist/components/checkbox/checkbox.component.js +67 -69
  9. package/dist/components/checkbox/checkbox.styles.js +1 -1
  10. package/dist/components/datepicker/datepicker-calendar.component.d.ts +1 -0
  11. package/dist/components/datepicker/datepicker-calendar.component.js +107 -116
  12. package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
  13. package/dist/components/datepicker/datepicker-popup.component.js +112 -100
  14. package/dist/components/datepicker/datepicker-popup.helpers.js +1 -1
  15. package/dist/components/datepicker/datepicker.component.d.ts +4 -2
  16. package/dist/components/datepicker/datepicker.component.js +159 -160
  17. package/dist/components/dialog/dialog.component.d.ts +3 -2
  18. package/dist/components/dialog/dialog.component.js +48 -48
  19. package/dist/components/divider/divider.component.d.ts +3 -0
  20. package/dist/components/divider/divider.component.js +43 -22
  21. package/dist/components/divider/divider.styles.js +9 -9
  22. package/dist/components/drawer/drawer.component.d.ts +12 -4
  23. package/dist/components/drawer/drawer.component.js +84 -61
  24. package/dist/components/drawer/drawer.styles.js +47 -40
  25. package/dist/components/header/header.component.d.ts +4 -2
  26. package/dist/components/header/header.component.js +64 -57
  27. package/dist/components/header/header.styles.js +2 -2
  28. package/dist/components/icon/icon.component.js +26 -16
  29. package/dist/components/icon/icon.styles.js +4 -4
  30. package/dist/components/input/input.component.d.ts +11 -10
  31. package/dist/components/input/input.component.js +115 -111
  32. package/dist/components/input/input.controllers.d.ts +0 -1
  33. package/dist/components/input/input.controllers.js +14 -19
  34. package/dist/components/link/link.component.d.ts +1 -0
  35. package/dist/components/link/link.component.js +86 -74
  36. package/dist/components/link/link.styles.js +7 -3
  37. package/dist/components/loader/loader.component.d.ts +0 -2
  38. package/dist/components/loader/loader.component.js +27 -30
  39. package/dist/components/loader/loader.styles.js +1 -1
  40. package/dist/components/menu/menu-item.styles.js +8 -7
  41. package/dist/components/menu/menu.component.d.ts +5 -2
  42. package/dist/components/menu/menu.component.js +7 -7
  43. package/dist/components/nav/nav.component.d.ts +3 -0
  44. package/dist/components/nav/nav.component.js +38 -33
  45. package/dist/components/popover/popover.component.d.ts +6 -7
  46. package/dist/components/popover/popover.component.js +23 -31
  47. package/dist/components/progress/progress.styles.js +3 -3
  48. package/dist/components/radio/radio.component.d.ts +4 -2
  49. package/dist/components/radio/radio.component.js +96 -91
  50. package/dist/components/radio/radio.styles.js +1 -1
  51. package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
  52. package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
  53. package/dist/components/segmented-button/segmented-button.component.js +22 -24
  54. package/dist/components/select/select-option.component.d.ts +2 -1
  55. package/dist/components/select/select-option.component.js +31 -36
  56. package/dist/components/select/select.component.d.ts +20 -10
  57. package/dist/components/select/select.component.js +139 -104
  58. package/dist/components/select/select.controllers.js +14 -17
  59. package/dist/components/select/select.styles.js +8 -3
  60. package/dist/components/stepper/stepper-item.component.d.ts +1 -1
  61. package/dist/components/stepper/stepper-item.component.js +26 -23
  62. package/dist/components/stepper/stepper-item.styles.js +4 -4
  63. package/dist/components/stepper/stepper.component.js +2 -3
  64. package/dist/components/stepper/stepper.helpers.js +6 -7
  65. package/dist/components/switch/switch.component.d.ts +4 -2
  66. package/dist/components/switch/switch.component.js +64 -58
  67. package/dist/components/switch/switch.styles.js +1 -1
  68. package/dist/components/tabs/tab-panel.component.d.ts +1 -1
  69. package/dist/components/tabs/tab-panel.component.js +19 -16
  70. package/dist/components/tabs/tab.component.d.ts +1 -1
  71. package/dist/components/tabs/tab.component.js +17 -14
  72. package/dist/components/tabs/tab.styles.js +2 -2
  73. package/dist/components/tabs/tabs.component.js +6 -6
  74. package/dist/components/tag/tag.component.d.ts +9 -6
  75. package/dist/components/tag/tag.component.js +78 -72
  76. package/dist/components/tag/tag.styles.js +5 -0
  77. package/dist/components/textarea/textarea.component.d.ts +4 -2
  78. package/dist/components/textarea/textarea.component.js +101 -95
  79. package/dist/components/toast/toast-item.styles.js +13 -10
  80. package/dist/components/toast/toast.singleton.js +6 -7
  81. package/dist/components/tooltip/tooltip.component.d.ts +7 -4
  82. package/dist/components/tooltip/tooltip.component.js +22 -14
  83. package/dist/custom-elements.json +835 -422
  84. package/dist/index.d.ts +2 -2
  85. package/dist/index.js +20 -20
  86. package/dist/internal/base-classes/popover/popover.base.d.ts +28 -8
  87. package/dist/internal/base-classes/popover/popover.base.js +78 -74
  88. package/dist/internal/components/formBase.d.ts +1 -0
  89. package/dist/internal/components/formBase.js +11 -19
  90. package/dist/internal/controllers/popover.controller.d.ts +2 -0
  91. package/dist/internal/controllers/popover.controller.js +11 -14
  92. package/dist/internal/helpers/stateMap.js +3 -3
  93. package/dist/internal/helpers/uuid.d.ts +8 -10
  94. package/dist/internal/helpers/uuid.js +4 -11
  95. package/dist/internal/helpers/watch.d.ts +1 -1
  96. package/dist/internal/templates/asterisk.d.ts +1 -1
  97. package/dist/internal/templates/asterisk.js +4 -4
  98. package/dist/internal/types.d.ts +4 -0
  99. package/dist/styles/global-alt.css +1 -1
  100. package/dist/styles/global.css +1 -1
  101. package/dist/translations/en.d.ts +3 -0
  102. package/dist/translations/en.js +27 -0
  103. package/dist/translations/es.d.ts +3 -0
  104. package/dist/translations/es.js +27 -0
  105. package/dist/translations/index.d.ts +4 -0
  106. package/dist/translations/pt.d.ts +3 -0
  107. package/dist/translations/pt.js +27 -0
  108. package/dist/translations/sv.d.ts +3 -0
  109. package/dist/translations/sv.js +27 -0
  110. package/dist/types/jsx/custom-element-jsx.d.ts +1840 -858
  111. package/dist/types/vue/index.d.ts +69 -64
  112. package/dist/utilities/localize.d.ts +28 -0
  113. package/dist/utilities/localize.js +13 -0
  114. package/dist/vscode.html-custom-data.json +75 -83
  115. package/dist/web-types.json +229 -190
  116. package/package.json +29 -35
  117. package/custom-elements.json +0 -25490
@@ -1,30 +1,38 @@
1
- import { SkfSelectOptionGroup as v } from "./select-option-group.component.js";
1
+ var _ = (l) => {
2
+ throw TypeError(l);
3
+ };
4
+ var v = (l, r, t) => r.has(l) || _("Cannot " + t);
5
+ var u = (l, r, t) => (v(l, r, "read from private field"), t ? t.call(l) : r.get(l)), g = (l, r, t) => r.has(l) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(l) : r.set(l, t), b = (l, r, t, e) => (v(l, r, "write to private field"), e ? e.call(l, t) : r.set(l, t), t);
6
+ import { SkfSelectOptionGroup as w } from "./select-option-group.component.js";
2
7
  import "../tag/tag.js";
3
- import { computePosition as _, flip as g, shift as b, offset as y } from "@floating-ui/dom";
4
- import { FormBase as O } from "../../internal/components/formBase.js";
8
+ import { computePosition as x, flip as C, shift as V, offset as $ } from "@floating-ui/dom";
9
+ import { FormBase as L } from "../../internal/components/formBase.js";
5
10
  import "../../internal/components/hint/hint.js";
6
- import { PopoverController as x } from "../../internal/controllers/popover.controller.js";
7
- import { findMatchingTags as w } from "../../internal/helpers/findMatchingTags.js";
8
- import { hintSeverity as S } from "../../internal/helpers/hintSeverity.js";
9
- import { raiseError as $ } from "../../internal/helpers/raiseError.js";
10
- import { watch as f } from "../../internal/helpers/watch.js";
11
- import { Asterisk as V } from "../../internal/templates/asterisk.js";
12
- import { componentStyles as C } from "../../styles/component.styles.js";
13
- import { nothing as E, html as n } from "lit";
14
- import { property as o, state as h, query as p, queryAssignedElements as L } from "lit/decorators.js";
15
- import { classMap as k } from "lit/directives/class-map.js";
16
- import { ifDefined as m } from "lit/directives/if-defined.js";
17
- import { SkfSelectOption as A } from "./select-option.component.js";
18
- import { GlobalClickController as P, KeyboardNavigationController as T, DeveloperFeedbackController as D } from "./select.controllers.js";
19
- import { styles as F } from "./select.styles.js";
20
- var U = Object.defineProperty, M = Object.getOwnPropertyDescriptor, s = (u, t, e, l) => {
21
- for (var r = l > 1 ? void 0 : l ? M(t, e) : t, a = u.length - 1, d; a >= 0; a--)
22
- (d = u[a]) && (r = (l ? d(t, e, r) : d(r)) || r);
23
- return l && r && U(t, e, r), r;
24
- };
25
- const c = class c extends O {
11
+ import { PopoverController as E } from "../../internal/controllers/popover.controller.js";
12
+ import { findMatchingTags as k } from "../../internal/helpers/findMatchingTags.js";
13
+ import { hintSeverity as A } from "../../internal/helpers/hintSeverity.js";
14
+ import { raiseError as I } from "../../internal/helpers/raiseError.js";
15
+ import { watch as S } from "../../internal/helpers/watch.js";
16
+ import { Asterisk as D } from "../../internal/templates/asterisk.js";
17
+ import { componentStyles as P } from "../../styles/component.styles.js";
18
+ import { LocalizeController as F } from "../../utilities/localize.js";
19
+ import { nothing as y, html as p } from "lit";
20
+ import { property as n, state as c, query as m, queryAssignedElements as T } from "lit/decorators.js";
21
+ import { classMap as z } from "lit/directives/class-map.js";
22
+ import { ifDefined as O } from "lit/directives/if-defined.js";
23
+ import { SkfSelectOption as U } from "./select-option.component.js";
24
+ import { GlobalClickController as M, KeyboardNavigationController as B, DeveloperFeedbackController as N } from "./select.controllers.js";
25
+ import { styles as H } from "./select.styles.js";
26
+ var q = Object.defineProperty, R = Object.getOwnPropertyDescriptor, s = (l, r, t, e) => {
27
+ for (var o = e > 1 ? void 0 : e ? R(r, t) : r, a = l.length - 1, h; a >= 0; a--)
28
+ (h = l[a]) && (o = (e ? h(r, t, o) : h(o)) || o);
29
+ return e && o && q(r, t, o), o;
30
+ }, d;
31
+ const f = class f extends L {
26
32
  constructor() {
27
- super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.hideLabel = !1, this.hideTags = !1, this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new P(this), this.keyboardNavController = new T(this), this.developerFeedbackController = new D(this), this.popoverController = new x(this), this._handleOptionSelected = (t) => {
33
+ super();
34
+ g(this, d);
35
+ b(this, d, new F(this)), this._componentIsConnected = !1, this._defaultButtonLabel = "Select an option", this.selectDelay = 200, this._optionsList = [], this.buttonLabel = this._defaultButtonLabel, this.hideLabel = !1, this.hideTags = !1, this.lang = "en", this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new M(this), this.keyboardNavController = new B(this), this.developerFeedbackController = new N(this), this.popoverController = new E(this), this._handleOptionSelected = (t) => {
28
36
  this._pristine = !1;
29
37
  const e = this._selectedOptions.length > 0;
30
38
  this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
@@ -35,9 +43,9 @@ const c = class c extends O {
35
43
  this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
36
44
  }, 50);
37
45
  }, this.reposition = async () => {
38
- const { x: t, y: e } = await _(this.$anchor, this.$popover, {
46
+ const { x: t, y: e } = await x(this.$anchor, this.$popover, {
39
47
  placement: "bottom",
40
- middleware: [g(), b({ padding: 5 }), y(2)],
48
+ middleware: [C(), V(), $(2)],
41
49
  strategy: "fixed"
42
50
  });
43
51
  Object.assign(this.$popover.style, {
@@ -61,20 +69,34 @@ const c = class c extends O {
61
69
  default:
62
70
  throw new Error("Something went wrong");
63
71
  }
64
- this.emitEvent("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
72
+ this._componentIsConnected && this.emitEvent("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
65
73
  this.multiple || (this._expanded = !1), t("done");
66
74
  });
67
75
  }), this._resetSelectedOptions = (t) => {
68
76
  const e = !t;
69
- this._optionsList.forEach((l) => {
70
- (e || l !== t) && l.removeAttribute("selected");
71
- });
77
+ this._optionsList.forEach((o) => {
78
+ (e || o !== t) && o.removeAttribute("selected");
79
+ }), this._optionsList = [];
72
80
  }, this._handleSlotChange = () => {
73
- this._handleSizeUpdate(), this._collectSlotOptionTags(), this._validateInput();
74
- }, this._computeVisibleValue = () => {
75
- var t, e;
76
- return (t = this.$selectedValue) == null || t.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${String(this._selectedOptions.length)} items selected)` : this.value ? ((e = this.$selectedValue) == null || e.classList.remove("contains-meta-info"), this.value) : this.buttonLabel;
77
- }, this._selectedOptions = [];
81
+ this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0, this.emitEvent("skf-select-connected");
82
+ }, this._ifValueIsSetSelectOption = () => {
83
+ if (this.value)
84
+ if (this.multiple) {
85
+ const t = String(this.value).split(",").map((e) => e.toLowerCase().trim());
86
+ this._optionsList.forEach((e) => {
87
+ t.includes(e.value.toLowerCase().trim()) ? (e.setSelectedDiscrete = !0, this.selectedOptions = [...this.selectedOptions, e]) : (e.setSelectedDiscrete = !1, this._selectedOptions = this._selectedOptions.filter(
88
+ (o) => o.value.toLowerCase().trim() !== e.value.toLowerCase().trim()
89
+ ));
90
+ }), this._setValue().catch((e) => {
91
+ console.error(e);
92
+ });
93
+ } else {
94
+ const t = this.value.toLowerCase().trim(), e = this._optionsList.find((o) => o.value.toLowerCase().trim() === t);
95
+ e && (e.setSelectedDiscrete = !0, this.selectedOptions = [e], this._setValue().catch((o) => {
96
+ console.error(o);
97
+ }));
98
+ }
99
+ }, this._computeVisibleValue = () => this.buttonLabel !== this._defaultButtonLabel ? this.buttonLabel : (this.$selectedValue?.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${u(this, d).term("itemsSelected", this._selectedOptions.length)})` : this.value ? (this.$selectedValue?.classList.remove("contains-meta-info"), this._selectedOptions[0].textContent) : (this.$selectedValue?.classList.add("contains-meta-info"), this.buttonLabel)), this._selectedOptions = [];
78
100
  }
79
101
  set selectedValues(t) {
80
102
  this._selectedOptions = this._optionsList.filter((e) => t.includes(e.value.trim()));
@@ -92,11 +114,11 @@ const c = class c extends O {
92
114
  }
93
115
  set value(t) {
94
116
  let e = [];
95
- this.multiple ? e = t.split(",").map((l) => l.toLowerCase().trim()) : e = [t.toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
96
- (l) => e.includes(l.value.toLowerCase().trim())
97
- ), this._optionsList.forEach((l) => {
98
- l.selected && (l.setSelectedDiscrete = !1);
99
- }), this._selectedOptions.forEach((l) => l.setSelectedDiscrete = !0), this._setValue();
117
+ this._componentIsConnected && (this.multiple ? e = String(t).split(",").map((a) => a.toLowerCase().trim()) : e = [String(t).toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
118
+ (a) => e.includes(a.value.toLowerCase().trim())
119
+ ), this._optionsList.forEach((a) => {
120
+ a.selected && (a.setSelectedDiscrete = !1);
121
+ }), this._selectedOptions.forEach((a) => a.setSelectedDiscrete = !0)), this._setValue();
100
122
  }
101
123
  get value() {
102
124
  return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
@@ -126,30 +148,36 @@ const c = class c extends O {
126
148
  this.removeAttribute("invalid"), !this._pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = this.getAttribute("hint") ?? "";
127
149
  }
128
150
  firstUpdated() {
129
- var t;
130
- this.addEventListener("skf-select-option-select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
151
+ this.addEventListener("skf-select-option-select", this._handleOptionSelected), this._internals.form?.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
131
152
  }
132
153
  _handleSizeUpdate() {
133
154
  this._slottedItems.forEach((t) => {
134
- (t instanceof A || t instanceof v) && (t.small = this.size === "sm");
155
+ (t instanceof U || t instanceof w) && (t.small = this.size === "sm");
135
156
  });
136
157
  }
137
- handleExpandedChange() {
158
+ _handleExpandedChange() {
138
159
  this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
139
160
  console.error(t);
140
- })), this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
161
+ })), this.desiredPopupHeight = this._getOptionalDropdownHeight(
162
+ this._slottedItems[0]
163
+ ), this.desiredPopupHeight ? this.$popover.style.height = `${this.desiredPopupHeight.toString()}px` : this.$popover.style.height = "", this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
141
164
  }
142
- attributeChangedCallback(t, e, l) {
143
- if (super.attributeChangedCallback(t, e, l), t === "custom-invalid")
144
- if (typeof l == "string") {
145
- const a = this.withFallback(l);
146
- this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, a), this.checkValidity();
165
+ attributeChangedCallback(t, e, o) {
166
+ if (super.attributeChangedCallback(t, e, o), t === "custom-invalid")
167
+ if (typeof o == "string") {
168
+ const h = this.withFallback(o);
169
+ this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, h), this.checkValidity();
147
170
  } else
148
171
  this.setValidity({}), this._validateInput();
149
172
  }
150
173
  disconnectedCallback() {
151
- var t;
152
- super.disconnectedCallback(), (t = this._internals.form) == null || t.removeEventListener("reset", this._handleReset);
174
+ super.disconnectedCallback(), this._internals.form?.removeEventListener("reset", this._handleReset);
175
+ }
176
+ /** @internal */
177
+ _getOptionalDropdownHeight(t) {
178
+ if (!this.maxVisibleItems) return;
179
+ const e = this._slottedItems.length;
180
+ return this.maxVisibleItems >= e ? void 0 : t.getBoundingClientRect().height * this.maxVisibleItems;
153
181
  }
154
182
  /** @internal */
155
183
  _updateState(t) {
@@ -158,8 +186,8 @@ const c = class c extends O {
158
186
  e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
159
187
  });
160
188
  else {
161
- const e = this._selectedOptions.length > 0, l = t.detail.value !== null;
162
- e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), l && (this.selectedOptions = [t.target]);
189
+ const e = this._selectedOptions.length > 0, o = t.detail.value !== null;
190
+ e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), o && (this.selectedOptions = [t.target]);
163
191
  }
164
192
  this._setValue();
165
193
  }
@@ -170,7 +198,7 @@ const c = class c extends O {
170
198
  /** @internal */
171
199
  /** Filter out elements other than skf-select-option and store in this._optionsList */
172
200
  _collectSlotOptionTags() {
173
- this._optionsList = w(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), $({
201
+ this._optionsList = k(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), I({
174
202
  assert: this._optionsList.length > 0,
175
203
  reason: "no-children",
176
204
  replaceStrings: [this.localName, "skf-select-option"]
@@ -179,55 +207,56 @@ const c = class c extends O {
179
207
  /** @internal */
180
208
  _validateInput() {
181
209
  this._invalid = !1;
182
- const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), l = !!(this.max && this.selectedValues.length > this.max);
210
+ const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), o = !!(this.max && this.selectedValues.length > this.max);
183
211
  if (this._internals.validity.customError) {
184
212
  this._invalid = !0;
185
213
  return;
186
214
  } else if (t) {
187
- const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
188
- this.setValidity({ valueMissing: !0 }, String(a)), this._pristine || (this._invalid = !0);
215
+ const h = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
216
+ this.setValidity({ valueMissing: !0 }, String(h)), this._pristine || (this._invalid = !0);
189
217
  } else if (e) {
190
- const a = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
191
- this.setValidity({ rangeUnderflow: !0 }, String(a)), this._pristine || (this._invalid = !0);
192
- } else if (l) {
193
- const a = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
194
- this.setValidity({ rangeOverflow: !0 }, String(a)), this._pristine || (this._invalid = !0);
218
+ const h = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
219
+ this.setValidity({ rangeUnderflow: !0 }, String(h)), this._pristine || (this._invalid = !0);
220
+ } else if (o) {
221
+ const h = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
222
+ this.setValidity({ rangeOverflow: !0 }, String(h)), this._pristine || (this._invalid = !0);
195
223
  } else
196
224
  this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
197
225
  }
198
226
  render() {
199
- return n`
227
+ return p`
200
228
  <div id="root">
201
229
  <label>
202
230
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
203
231
  ${this.label}
204
- ${this.required ? V(this.requiredLabel) : null}
232
+ ${this.required ? D(u(this, d).term("required")) : y}
205
233
  </div>
206
234
  <button
207
235
  ?disabled=${this.disabled}
208
236
  @click=${this._handleDropdownToggle}
209
237
  aria-controls="select-dropdown"
210
238
  aria-expanded=${this._expanded}
211
- aria-invalid=${this._invalid}
212
239
  aria-haspopup="listbox"
240
+ aria-invalid=${this._invalid}
241
+ aria-labelledby="label"
213
242
  id="select-button"
214
243
  role="combobox"
215
244
  >
216
245
  <span
217
246
  id="selected-value"
218
- class=${k({ "selected-value": !0, "contains-meta-info": !this.value })}>
247
+ class=${z({ "selected-value": !0, "contains-meta-info": !this.value })}>
219
248
  ${this._computeVisibleValue()}
220
249
  </span>
221
250
  <skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
222
251
  </button>
223
252
  </label>
224
- <div aria-multiselectable=${m(this.multiple && !0)} id="select-dropdown" popover role="listbox">
253
+ <div aria-labelledby="select-button" aria-multiselectable=${O(this.multiple && !0)} id="select-dropdown" popover role="listbox">
225
254
  <slot @slotchange=${this._handleSlotChange}></slot>
226
255
  </div>
227
- ${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? n`
256
+ ${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? p`
228
257
  <div id="tags">
229
258
  ${this.selectedOptions.map(
230
- (t) => n`
259
+ (t) => p`
231
260
  <skf-tag
232
261
  style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
233
262
  removable
@@ -240,13 +269,13 @@ const c = class c extends O {
240
269
  `
241
270
  )}
242
271
  </div>
243
- ` : E}
244
- ${this.hint && n`
272
+ ` : y}
273
+ ${this.hint && p`
245
274
  <skf-hint
246
275
  ?disabled=${this.disabled}
247
276
  aria-live=${this._invalid ? "assertive" : "polite"}
248
277
  id="hint"
249
- severity=${m(S(this._invalid, this.severity))}
278
+ severity=${O(A(this._invalid, this.severity))}
250
279
  >
251
280
  ${this.customInvalid ?? this.hint}
252
281
  </skf-hint>
@@ -256,86 +285,92 @@ const c = class c extends O {
256
285
  `;
257
286
  }
258
287
  };
259
- c.styles = [C, F];
260
- let i = c;
288
+ d = new WeakMap(), f.styles = [P, H];
289
+ let i = f;
261
290
  s([
262
- o({ type: String, reflect: !0, attribute: "button-label" })
291
+ n({ type: String, reflect: !0, attribute: "button-label" })
263
292
  ], i.prototype, "buttonLabel", 2);
264
293
  s([
265
- o({ attribute: "custom-invalid" })
294
+ n({ type: String, attribute: "custom-invalid" })
266
295
  ], i.prototype, "customInvalid", 2);
267
296
  s([
268
- o({ type: Boolean, attribute: "hide-label" })
297
+ n({ type: Boolean, attribute: "hide-label" })
269
298
  ], i.prototype, "hideLabel", 2);
270
299
  s([
271
- o({ type: Boolean, reflect: !0, attribute: "hide-tags" })
300
+ n({ type: Boolean, reflect: !0, attribute: "hide-tags" })
272
301
  ], i.prototype, "hideTags", 2);
273
302
  s([
274
- o()
303
+ n({ type: String })
275
304
  ], i.prototype, "hint", 2);
276
305
  s([
277
- o({ type: Array, attribute: !1 })
306
+ n({ type: Array, attribute: !1 })
278
307
  ], i.prototype, "selectedValues", 1);
279
308
  s([
280
- o({ type: Array, attribute: !1 })
309
+ n({ type: Array, attribute: !1 })
281
310
  ], i.prototype, "selectedOptionsText", 1);
282
311
  s([
283
- o({ reflect: !0 })
312
+ n({ type: String, reflect: !0 })
284
313
  ], i.prototype, "label", 2);
285
314
  s([
286
- o({ type: Number })
315
+ n({ type: String })
316
+ ], i.prototype, "lang", 2);
317
+ s([
318
+ n({ type: Number })
287
319
  ], i.prototype, "max", 2);
288
320
  s([
289
- o({ type: Number })
321
+ n({ type: Number, attribute: "max-visible-items" })
322
+ ], i.prototype, "maxVisibleItems", 2);
323
+ s([
324
+ n({ type: Number })
290
325
  ], i.prototype, "min", 2);
291
326
  s([
292
- o({ type: Boolean, reflect: !0 })
327
+ n({ type: Boolean, reflect: !0 })
293
328
  ], i.prototype, "multiple", 2);
294
329
  s([
295
- o()
330
+ n({ type: String })
296
331
  ], i.prototype, "name", 2);
297
332
  s([
298
- o({ attribute: "required-label" })
299
- ], i.prototype, "requiredLabel", 2);
300
- s([
301
- o()
333
+ n()
302
334
  ], i.prototype, "severity", 2);
303
335
  s([
304
- o({ type: Boolean, attribute: "show-valid" })
336
+ n({ type: Boolean, attribute: "show-valid" })
305
337
  ], i.prototype, "showValid", 2);
306
338
  s([
307
- o({ reflect: !0 })
339
+ n({ reflect: !0 })
308
340
  ], i.prototype, "size", 2);
309
341
  s([
310
- h()
342
+ n({ type: String, attribute: !1 })
311
343
  ], i.prototype, "value", 1);
312
344
  s([
313
- h()
345
+ c()
314
346
  ], i.prototype, "selectedOptions", 1);
315
347
  s([
316
- h()
348
+ c()
317
349
  ], i.prototype, "_expanded", 2);
318
350
  s([
319
- h()
351
+ c()
320
352
  ], i.prototype, "_invalid", 2);
321
353
  s([
322
- p("#select-button")
354
+ c()
355
+ ], i.prototype, "desiredPopupHeight", 2);
356
+ s([
357
+ m("#select-button")
323
358
  ], i.prototype, "$anchor", 2);
324
359
  s([
325
- p("#selected-value")
360
+ m("#selected-value")
326
361
  ], i.prototype, "$selectedValue", 2);
327
362
  s([
328
- p("#select-dropdown")
363
+ m("#select-dropdown")
329
364
  ], i.prototype, "$popover", 2);
330
365
  s([
331
- L()
366
+ T()
332
367
  ], i.prototype, "_slottedItems", 2);
333
368
  s([
334
- f("size", { waitUntilFirstUpdate: !0 })
369
+ S("size", { waitUntilFirstUpdate: !0 })
335
370
  ], i.prototype, "_handleSizeUpdate", 1);
336
371
  s([
337
- f("_expanded", { afterUpdate: !0 })
338
- ], i.prototype, "handleExpandedChange", 1);
372
+ S("_expanded", { afterUpdate: !0 })
373
+ ], i.prototype, "_handleExpandedChange", 1);
339
374
  export {
340
375
  i as SkfSelect
341
376
  };
@@ -1,9 +1,8 @@
1
- import { raiseError as a } from "../../internal/helpers/raiseError.js";
1
+ import { raiseError as l } from "../../internal/helpers/raiseError.js";
2
2
  class d {
3
3
  constructor(t) {
4
4
  this._globalClickHandler = (e) => {
5
- var s;
6
- !((s = this.host) != null && s.localName) || e.target.closest(this.host.localName) || (this.host._expanded = !1);
5
+ !this.host?.localName || e.target.closest(this.host.localName) || (this.host._expanded = !1);
7
6
  }, (this.host = t).addController(this);
8
7
  }
9
8
  // hostConnected() {
@@ -13,8 +12,7 @@ class d {
13
12
  this.disableGlobalClickDetection();
14
13
  }
15
14
  hostUpdated() {
16
- var t;
17
- (t = this.host) != null && t._expanded ? this.enableGlobalClickDetection() : this.disableGlobalClickDetection();
15
+ this.host?._expanded ? this.enableGlobalClickDetection() : this.disableGlobalClickDetection();
18
16
  }
19
17
  enableGlobalClickDetection() {
20
18
  document.addEventListener("click", this._globalClickHandler);
@@ -48,8 +46,7 @@ class p {
48
46
  this.removeKeyboardListener();
49
47
  }
50
48
  hostUpdated() {
51
- var t, e;
52
- (t = this.host) != null && t._expanded && !this._listenerActivated && this.setupKeyboardListener(), !((e = this.host) != null && e._expanded) && this._listenerActivated && this.removeKeyboardListener();
49
+ this.host?._expanded && !this._listenerActivated && this.setupKeyboardListener(), !this.host?._expanded && this._listenerActivated && this.removeKeyboardListener();
53
50
  }
54
51
  setupKeyboardListener() {
55
52
  this._listenerActivated = !0, this.host.addEventListener("keydown", this._handleKeyDown);
@@ -64,16 +61,16 @@ class p {
64
61
  });
65
62
  }
66
63
  _focusSiblingOption(t) {
67
- const e = (l) => l === document.activeElement, i = this._selectableOptions.find((l) => e(l));
68
- if (!i) {
64
+ const e = (n) => n === document.activeElement, s = this._selectableOptions.find((n) => e(n));
65
+ if (!s) {
69
66
  this._focusFirstOption();
70
67
  return;
71
68
  }
72
- const s = this._selectableOptions.indexOf(i);
73
- let o = s - 1, n = s + 1;
74
- o < 0 && (o = this._selectableOptions.length - 1), n >= this._selectableOptions.length && (n = 0);
75
- const h = this._selectableOptions[t === "next" ? n : o];
76
- i.blur(), h.focus();
69
+ const r = this._selectableOptions.indexOf(s);
70
+ let i = r - 1, o = r + 1;
71
+ i < 0 && (i = this._selectableOptions.length - 1), o >= this._selectableOptions.length && (o = 0);
72
+ const h = this._selectableOptions[t === "next" ? o : i];
73
+ s.blur(), h.focus();
77
74
  }
78
75
  _selectFocusedOption(t) {
79
76
  t.selected = !0;
@@ -92,18 +89,18 @@ class b {
92
89
  _badAttributeCombinationWarning() {
93
90
  if (!this.host) return;
94
91
  const t = this.host.localName ?? "never";
95
- a({
92
+ l({
96
93
  assert: (this.host.min ?? 0) <= (this.host.max ?? 1 / 0),
97
94
  reason: "attribute-mismatch",
98
95
  replaceStrings: [t, "min", "smaller than max"]
99
- }), a({
96
+ }), l({
100
97
  assert: (
101
98
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
102
99
  (this.host.min || this.host.max) && this.host.multiple || !(this.host.min && this.host.max)
103
100
  ),
104
101
  reason: "attribute-mismatch",
105
102
  replaceStrings: [t, "min or max", "together with multiple"]
106
- }), a({
103
+ }), l({
107
104
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
108
105
  assert: this.host.hideTags && this.host.multiple || !this.host.hideTags,
109
106
  reason: "attribute-mismatch",
@@ -1,8 +1,8 @@
1
1
  import { visuallyHidden as r } from "../../styles/util.styles.js";
2
- import { css as o } from "lit";
2
+ import { css as e } from "lit";
3
3
  const t = [
4
4
  r,
5
- o`
5
+ e`
6
6
  @layer components {
7
7
  :host {
8
8
  contain: initial;
@@ -52,7 +52,12 @@ const t = [
52
52
  gap: 0 var(--skf-spacing-75);
53
53
  justify-content: space-between;
54
54
  padding-inline: var(--skf-spacing-75);
55
- white-space: nowrap;
55
+
56
+ span {
57
+ overflow: hidden;
58
+ text-overflow: ellipsis;
59
+ white-space: nowrap;
60
+ }
56
61
 
57
62
  &:hover {
58
63
  --_skf-select-button-bg-color: var(--skf-interactive-bg-color-secondary-hover);
@@ -35,7 +35,7 @@ export declare class SkfStepperItem extends SkfElement {
35
35
  /** @internal */
36
36
  set _setInternalState(state: typeof this._uiState);
37
37
  get _setInternalState(): typeof this._uiState;
38
- constructor();
38
+ connectedCallback(): void;
39
39
  protected firstUpdated(): void;
40
40
  /** @internal */
41
41
  _handleState(): void;
@@ -2,30 +2,30 @@ var v = (e) => {
2
2
  throw TypeError(e);
3
3
  };
4
4
  var u = (e, i, t) => i.has(e) || v("Cannot " + t);
5
- var d = (e, i, t) => (u(e, i, "read from private field"), t ? t.call(e) : i.get(e)), _ = (e, i, t) => i.has(e) ? v("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t), r = (e, i, t, a) => (u(e, i, "write to private field"), a ? a.call(e, t) : i.set(e, t), t);
5
+ var m = (e, i, t) => (u(e, i, "read from private field"), t ? t.call(e) : i.get(e)), _ = (e, i, t) => i.has(e) ? v("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t), r = (e, i, t, a) => (u(e, i, "write to private field"), a ? a.call(e, t) : i.set(e, t), t);
6
6
  import "../icon/icon.js";
7
- import { SkfElement as g } from "../../internal/components/skf-element.js";
8
- import { watch as C } from "../../internal/helpers/watch.js";
7
+ import { SkfElement as C } from "../../internal/components/skf-element.js";
8
+ import { watch as g } from "../../internal/helpers/watch.js";
9
9
  import { componentStyles as x } from "../../styles/component.styles.js";
10
10
  import "lit";
11
- import { property as b, state as c } from "lit/decorators.js";
11
+ import { property as b, state as n } from "lit/decorators.js";
12
12
  import { classMap as $ } from "lit/directives/class-map.js";
13
13
  import { ifDefined as w } from "lit/directives/if-defined.js";
14
14
  import { literal as S, html as y } from "lit/static-html.js";
15
15
  import { styles as U } from "./stepper-item.styles.js";
16
16
  var I = Object.defineProperty, O = Object.getOwnPropertyDescriptor, o = (e, i, t, a) => {
17
- for (var p = a > 1 ? void 0 : a ? O(i, t) : i, h = e.length - 1, m; h >= 0; h--)
18
- (m = e[h]) && (p = (a ? m(i, t, p) : m(p)) || p);
17
+ for (var p = a > 1 ? void 0 : a ? O(i, t) : i, d = e.length - 1, h; d >= 0; d--)
18
+ (h = e[d]) && (p = (a ? h(i, t, p) : h(p)) || p);
19
19
  return a && p && I(i, t, p), p;
20
- }, l, n;
21
- const f = class f extends g {
20
+ }, l, c;
21
+ const f = class f extends C {
22
22
  constructor() {
23
- super();
23
+ super(...arguments);
24
24
  _(this, l);
25
- _(this, n);
26
- r(this, l, !1), r(this, n, !1), this.completed = !1, this._index = 0, this._linear = !1, this._handleClick = () => {
25
+ _(this, c);
26
+ r(this, l, !1), r(this, c, !1), this.completed = !1, this._index = 0, this._linear = !1, this._handleClick = () => {
27
27
  this._linear || (this.state = "active");
28
- }, this.role = "listitem";
28
+ };
29
29
  }
30
30
  set _setInternalState(t) {
31
31
  r(this, l, !0), this._uiState = t, t === "active" || t === "activeCompleted" ? this.state = t === "active" ? "active" : "completed" : this.state = void 0, setTimeout(() => {
@@ -35,6 +35,9 @@ const f = class f extends g {
35
35
  get _setInternalState() {
36
36
  return this.state;
37
37
  }
38
+ connectedCallback() {
39
+ super.connectedCallback(), this.role = "listitem";
40
+ }
38
41
  firstUpdated() {
39
42
  this._handleState();
40
43
  }
@@ -44,20 +47,20 @@ const f = class f extends g {
44
47
  this._setInternalState = "activeCompleted";
45
48
  return;
46
49
  }
47
- if (d(this, l)) {
50
+ if (m(this, l)) {
48
51
  r(this, l, !1);
49
52
  return;
50
53
  }
51
- r(this, n, ["active", "completed"].includes(String(this.state)) && !["active", "activeCompleted"].includes(String(this._uiState))), this._emitUpdate();
54
+ r(this, c, ["active", "completed"].includes(String(this.state)) && !["active", "activeCompleted"].includes(String(this._uiState))), this._emitUpdate();
52
55
  }
53
56
  /** @internal */
54
57
  _emitUpdate() {
55
58
  this.emit("skf-stepper-item-select", {
56
59
  detail: {
57
60
  item: this,
58
- triggerActiveIndexUpdate: d(this, n)
61
+ triggerActiveIndexUpdate: m(this, c)
59
62
  }
60
- }), r(this, n, !1);
63
+ }), r(this, c, !1);
61
64
  }
62
65
  render() {
63
66
  const t = this._linear ? S`div` : S`button`;
@@ -82,7 +85,7 @@ const f = class f extends g {
82
85
  `;
83
86
  }
84
87
  };
85
- l = new WeakMap(), n = new WeakMap(), f.styles = [x, U];
88
+ l = new WeakMap(), c = new WeakMap(), f.styles = [x, U];
86
89
  let s = f;
87
90
  o([
88
91
  b({ reflect: !0 })
@@ -91,22 +94,22 @@ o([
91
94
  b({ type: Boolean })
92
95
  ], s.prototype, "completed", 2);
93
96
  o([
94
- c()
97
+ n()
95
98
  ], s.prototype, "_disabled", 2);
96
99
  o([
97
- c()
100
+ n()
98
101
  ], s.prototype, "_index", 2);
99
102
  o([
100
- c()
103
+ n()
101
104
  ], s.prototype, "_linear", 2);
102
105
  o([
103
- c()
106
+ n()
104
107
  ], s.prototype, "_uiState", 2);
105
108
  o([
106
- c()
109
+ n()
107
110
  ], s.prototype, "_setInternalState", 1);
108
111
  o([
109
- C("state")
112
+ g("state")
110
113
  ], s.prototype, "_handleState", 1);
111
114
  export {
112
115
  s as SkfStepperItem