@skf-design-system/ui-components 1.0.2-beta.6 → 1.0.2-beta.9

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 (90) 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/button/button.styles.js +3 -3
  5. package/dist/components/checkbox/checkbox.component.d.ts +6 -5
  6. package/dist/components/checkbox/checkbox.component.js +77 -76
  7. package/dist/components/checkbox/checkbox.styles.js +1 -1
  8. package/dist/components/datepicker/datepicker-calendar.component.d.ts +4 -0
  9. package/dist/components/datepicker/datepicker-calendar.component.js +134 -127
  10. package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
  11. package/dist/components/datepicker/datepicker-popup.component.js +100 -88
  12. package/dist/components/datepicker/datepicker.component.d.ts +4 -2
  13. package/dist/components/datepicker/datepicker.component.js +150 -140
  14. package/dist/components/dialog/dialog.component.d.ts +3 -2
  15. package/dist/components/dialog/dialog.component.js +39 -37
  16. package/dist/components/divider/divider.component.js +13 -13
  17. package/dist/components/divider/divider.styles.js +2 -2
  18. package/dist/components/drawer/drawer.component.d.ts +3 -2
  19. package/dist/components/drawer/drawer.component.js +37 -35
  20. package/dist/components/drawer/drawer.styles.js +1 -1
  21. package/dist/components/header/header.component.d.ts +4 -2
  22. package/dist/components/header/header.component.js +66 -57
  23. package/dist/components/header/header.styles.js +2 -2
  24. package/dist/components/icon/icon.component.js +26 -16
  25. package/dist/components/icon/icon.styles.js +4 -4
  26. package/dist/components/input/input.component.d.ts +4 -8
  27. package/dist/components/input/input.component.js +146 -147
  28. package/dist/components/input/input.controllers.d.ts +0 -1
  29. package/dist/components/input/input.controllers.js +12 -12
  30. package/dist/components/link/link.component.js +19 -12
  31. package/dist/components/link/link.styles.js +11 -3
  32. package/dist/components/loader/loader.component.d.ts +0 -2
  33. package/dist/components/loader/loader.component.js +27 -30
  34. package/dist/components/loader/loader.styles.js +1 -1
  35. package/dist/components/menu/menu-item.styles.js +8 -7
  36. package/dist/components/menu/menu.component.d.ts +4 -1
  37. package/dist/components/nav/nav.component.d.ts +3 -0
  38. package/dist/components/nav/nav.component.js +38 -33
  39. package/dist/components/popover/popover.component.d.ts +6 -3
  40. package/dist/components/progress/progress.styles.js +3 -3
  41. package/dist/components/radio/radio.component.d.ts +4 -2
  42. package/dist/components/radio/radio.component.js +91 -83
  43. package/dist/components/radio/radio.styles.js +1 -1
  44. package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
  45. package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
  46. package/dist/components/select/select-option.component.d.ts +2 -2
  47. package/dist/components/select/select-option.component.js +16 -19
  48. package/dist/components/select/select.component.d.ts +13 -9
  49. package/dist/components/select/select.component.js +169 -144
  50. package/dist/components/stepper/stepper-item.styles.js +4 -4
  51. package/dist/components/switch/switch.component.d.ts +4 -2
  52. package/dist/components/switch/switch.component.js +64 -56
  53. package/dist/components/switch/switch.styles.js +1 -1
  54. package/dist/components/tabs/tab.styles.js +2 -2
  55. package/dist/components/tag/tag.component.d.ts +3 -0
  56. package/dist/components/tag/tag.component.js +50 -41
  57. package/dist/components/textarea/textarea.component.d.ts +4 -2
  58. package/dist/components/textarea/textarea.component.js +126 -118
  59. package/dist/components/tooltip/tooltip.component.d.ts +8 -2
  60. package/dist/components/tooltip/tooltip.component.js +3 -0
  61. package/dist/custom-elements.json +734 -372
  62. package/dist/internal/base-classes/popover/popover.base.d.ts +21 -2
  63. package/dist/internal/base-classes/popover/popover.base.js +10 -12
  64. package/dist/internal/components/formBase.d.ts +1 -0
  65. package/dist/internal/components/formBase.js +11 -19
  66. package/dist/internal/controllers/popover.controller.d.ts +2 -0
  67. package/dist/internal/helpers/uuid.d.ts +8 -10
  68. package/dist/internal/helpers/uuid.js +4 -11
  69. package/dist/internal/helpers/watch.d.ts +1 -1
  70. package/dist/internal/templates/asterisk.d.ts +1 -1
  71. package/dist/internal/templates/asterisk.js +4 -4
  72. package/dist/styles/global-alt.css +1 -1
  73. package/dist/styles/global.css +1 -1
  74. package/dist/translations/en.d.ts +3 -0
  75. package/dist/translations/en.js +27 -0
  76. package/dist/translations/es.d.ts +3 -0
  77. package/dist/translations/es.js +27 -0
  78. package/dist/translations/index.d.ts +4 -0
  79. package/dist/translations/pt.d.ts +3 -0
  80. package/dist/translations/pt.js +27 -0
  81. package/dist/translations/sv.d.ts +3 -0
  82. package/dist/translations/sv.js +27 -0
  83. package/dist/types/jsx/custom-element-jsx.d.ts +1823 -846
  84. package/dist/types/vue/index.d.ts +59 -47
  85. package/dist/utilities/localize.d.ts +28 -0
  86. package/dist/utilities/localize.js +13 -0
  87. package/dist/vscode.html-custom-data.json +75 -80
  88. package/dist/web-types.json +205 -169
  89. package/package.json +27 -34
  90. 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 c = (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), y = (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 D } from "../../internal/helpers/raiseError.js";
15
+ import { watch as S } from "../../internal/helpers/watch.js";
16
+ import { Asterisk as I } from "../../internal/templates/asterisk.js";
17
+ import { componentStyles as P } from "../../styles/component.styles.js";
18
+ import { LocalizeController as T } from "../../utilities/localize.js";
19
+ import { nothing as b, html as p } from "lit";
20
+ import { property as a, state as u, query as m, queryAssignedElements as F } from "lit/decorators.js";
21
+ import { classMap as U } from "lit/directives/class-map.js";
22
+ import { ifDefined as O } from "lit/directives/if-defined.js";
23
+ import { SkfSelectOption as z } from "./select-option.component.js";
24
+ import { GlobalClickController as M, KeyboardNavigationController as q, DeveloperFeedbackController as j } from "./select.controllers.js";
25
+ import { styles as N } from "./select.styles.js";
26
+ var B = Object.defineProperty, R = Object.getOwnPropertyDescriptor, o = (l, r, t, e) => {
27
+ for (var i = e > 1 ? void 0 : e ? R(r, t) : r, d = l.length - 1, n; d >= 0; d--)
28
+ (n = l[d]) && (i = (e ? n(r, t, i) : n(i)) || i);
29
+ return e && i && B(r, t, i), i;
30
+ }, h;
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, h);
35
+ y(this, h, new T(this)), this._componentIsConnected = !1, this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", 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 q(this), this.developerFeedbackController = new j(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(), y(2)],
48
+ middleware: [C(), V(), $(2)],
41
49
  strategy: "fixed"
42
50
  });
43
51
  Object.assign(this.$popover.style, {
@@ -61,19 +69,36 @@ 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((i) => {
78
+ (e || i !== t) && i.removeAttribute("selected");
79
+ }), this._optionsList = [];
72
80
  }, this._handleSlotChange = () => {
73
- this._handleSizeUpdate(), this._collectSlotOptionTags(), this._validateInput();
81
+ this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0;
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
+ (i) => i.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((i) => i.value.toLowerCase().trim() === t);
95
+ e && (e.setSelectedDiscrete = !0, this.selectedOptions = [e], this._setValue().catch((i) => {
96
+ console.error(i);
97
+ }));
98
+ }
74
99
  }, this._computeVisibleValue = () => {
75
100
  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;
101
+ return (t = this.$selectedValue) == null || t.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${c(this, h).term("itemsSelected", this._selectedOptions.length)})` : this.value ? ((e = this.$selectedValue) == null || e.classList.remove("contains-meta-info"), this._selectedOptions[0].textContent) : this.buttonLabel;
77
102
  }, this._selectedOptions = [];
78
103
  }
79
104
  set selectedValues(t) {
@@ -92,11 +117,11 @@ const c = class c extends O {
92
117
  }
93
118
  set value(t) {
94
119
  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();
120
+ this.multiple ? e = String(t).split(",").map((i) => i.toLowerCase().trim()) : e = [String(t).toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
121
+ (i) => e.includes(i.value.toLowerCase().trim())
122
+ ), this._optionsList.forEach((i) => {
123
+ i.selected && (i.setSelectedDiscrete = !1);
124
+ }), this._selectedOptions.forEach((i) => i.setSelectedDiscrete = !0), this._setValue();
100
125
  }
101
126
  get value() {
102
127
  return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
@@ -131,7 +156,7 @@ const c = class c extends O {
131
156
  }
132
157
  _handleSizeUpdate() {
133
158
  this._slottedItems.forEach((t) => {
134
- (t instanceof A || t instanceof v) && (t.small = this.size === "sm");
159
+ (t instanceof z || t instanceof w) && (t.small = this.size === "sm");
135
160
  });
136
161
  }
137
162
  handleExpandedChange() {
@@ -139,11 +164,11 @@ const c = class c extends O {
139
164
  console.error(t);
140
165
  })), this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
141
166
  }
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();
167
+ attributeChangedCallback(t, e, i) {
168
+ if (super.attributeChangedCallback(t, e, i), t === "custom-invalid")
169
+ if (typeof i == "string") {
170
+ const n = this.withFallback(i);
171
+ this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, n), this.checkValidity();
147
172
  } else
148
173
  this.setValidity({}), this._validateInput();
149
174
  }
@@ -158,8 +183,8 @@ const c = class c extends O {
158
183
  e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
159
184
  });
160
185
  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]);
186
+ const e = this._selectedOptions.length > 0, i = t.detail.value !== null;
187
+ e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), i && (this.selectedOptions = [t.target]);
163
188
  }
164
189
  this._setValue();
165
190
  }
@@ -170,7 +195,7 @@ const c = class c extends O {
170
195
  /** @internal */
171
196
  /** Filter out elements other than skf-select-option and store in this._optionsList */
172
197
  _collectSlotOptionTags() {
173
- this._optionsList = w(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), $({
198
+ this._optionsList = k(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), D({
174
199
  assert: this._optionsList.length > 0,
175
200
  reason: "no-children",
176
201
  replaceStrings: [this.localName, "skf-select-option"]
@@ -179,29 +204,29 @@ const c = class c extends O {
179
204
  /** @internal */
180
205
  _validateInput() {
181
206
  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);
207
+ const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), i = !!(this.max && this.selectedValues.length > this.max);
183
208
  if (this._internals.validity.customError) {
184
209
  this._invalid = !0;
185
210
  return;
186
211
  } 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);
212
+ const n = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
213
+ this.setValidity({ valueMissing: !0 }, String(n)), this._pristine || (this._invalid = !0);
189
214
  } 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);
215
+ const n = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
216
+ this.setValidity({ rangeUnderflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
217
+ } else if (i) {
218
+ const n = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
219
+ this.setValidity({ rangeOverflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
195
220
  } else
196
221
  this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
197
222
  }
198
223
  render() {
199
- return n`
224
+ return p`
200
225
  <div id="root">
201
226
  <label>
202
227
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
203
228
  ${this.label}
204
- ${this.required ? V(this.requiredLabel) : null}
229
+ ${this.required ? I(c(this, h).term("required")) : b}
205
230
  </div>
206
231
  <button
207
232
  ?disabled=${this.disabled}
@@ -215,19 +240,19 @@ const c = class c extends O {
215
240
  >
216
241
  <span
217
242
  id="selected-value"
218
- class=${k({ "selected-value": !0, "contains-meta-info": !this.value })}>
243
+ class=${U({ "selected-value": !0, "contains-meta-info": !this.value })}>
219
244
  ${this._computeVisibleValue()}
220
245
  </span>
221
246
  <skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
222
247
  </button>
223
248
  </label>
224
- <div aria-multiselectable=${m(this.multiple && !0)} id="select-dropdown" popover role="listbox">
249
+ <div aria-multiselectable=${O(this.multiple && !0)} id="select-dropdown" popover role="listbox">
225
250
  <slot @slotchange=${this._handleSlotChange}></slot>
226
251
  </div>
227
- ${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? n`
252
+ ${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? p`
228
253
  <div id="tags">
229
254
  ${this.selectedOptions.map(
230
- (t) => n`
255
+ (t) => p`
231
256
  <skf-tag
232
257
  style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
233
258
  removable
@@ -240,13 +265,13 @@ const c = class c extends O {
240
265
  `
241
266
  )}
242
267
  </div>
243
- ` : E}
244
- ${this.hint && n`
268
+ ` : b}
269
+ ${this.hint && p`
245
270
  <skf-hint
246
271
  ?disabled=${this.disabled}
247
272
  aria-live=${this._invalid ? "assertive" : "polite"}
248
273
  id="hint"
249
- severity=${m(S(this._invalid, this.severity))}
274
+ severity=${O(A(this._invalid, this.severity))}
250
275
  >
251
276
  ${this.customInvalid ?? this.hint}
252
277
  </skf-hint>
@@ -256,86 +281,86 @@ const c = class c extends O {
256
281
  `;
257
282
  }
258
283
  };
259
- c.styles = [C, F];
260
- let i = c;
261
- s([
262
- o({ type: String, reflect: !0, attribute: "button-label" })
263
- ], i.prototype, "buttonLabel", 2);
264
- s([
265
- o({ attribute: "custom-invalid" })
266
- ], i.prototype, "customInvalid", 2);
267
- s([
268
- o({ type: Boolean, attribute: "hide-label" })
269
- ], i.prototype, "hideLabel", 2);
270
- s([
271
- o({ type: Boolean, reflect: !0, attribute: "hide-tags" })
272
- ], i.prototype, "hideTags", 2);
273
- s([
274
- o()
275
- ], i.prototype, "hint", 2);
276
- s([
277
- o({ type: Array, attribute: !1 })
278
- ], i.prototype, "selectedValues", 1);
279
- s([
280
- o({ type: Array, attribute: !1 })
281
- ], i.prototype, "selectedOptionsText", 1);
282
- s([
283
- o({ reflect: !0 })
284
- ], i.prototype, "label", 2);
285
- s([
286
- o({ type: Number })
287
- ], i.prototype, "max", 2);
288
- s([
289
- o({ type: Number })
290
- ], i.prototype, "min", 2);
291
- s([
292
- o({ type: Boolean, reflect: !0 })
293
- ], i.prototype, "multiple", 2);
294
- s([
295
- o()
296
- ], i.prototype, "name", 2);
297
- s([
298
- o({ attribute: "required-label" })
299
- ], i.prototype, "requiredLabel", 2);
300
- s([
301
- o()
302
- ], i.prototype, "severity", 2);
303
- s([
304
- o({ type: Boolean, attribute: "show-valid" })
305
- ], i.prototype, "showValid", 2);
306
- s([
307
- o({ reflect: !0 })
308
- ], i.prototype, "size", 2);
309
- s([
310
- h()
311
- ], i.prototype, "value", 1);
312
- s([
313
- h()
314
- ], i.prototype, "selectedOptions", 1);
315
- s([
316
- h()
317
- ], i.prototype, "_expanded", 2);
318
- s([
319
- h()
320
- ], i.prototype, "_invalid", 2);
321
- s([
322
- p("#select-button")
323
- ], i.prototype, "$anchor", 2);
324
- s([
325
- p("#selected-value")
326
- ], i.prototype, "$selectedValue", 2);
327
- s([
328
- p("#select-dropdown")
329
- ], i.prototype, "$popover", 2);
330
- s([
331
- L()
332
- ], i.prototype, "_slottedItems", 2);
333
- s([
334
- f("size", { waitUntilFirstUpdate: !0 })
335
- ], i.prototype, "_handleSizeUpdate", 1);
336
- s([
337
- f("_expanded", { afterUpdate: !0 })
338
- ], i.prototype, "handleExpandedChange", 1);
284
+ h = new WeakMap(), f.styles = [P, N];
285
+ let s = f;
286
+ o([
287
+ a({ type: String, reflect: !0, attribute: "button-label" })
288
+ ], s.prototype, "buttonLabel", 2);
289
+ o([
290
+ a({ type: String, attribute: "custom-invalid" })
291
+ ], s.prototype, "customInvalid", 2);
292
+ o([
293
+ a({ type: Boolean, attribute: "hide-label" })
294
+ ], s.prototype, "hideLabel", 2);
295
+ o([
296
+ a({ type: Boolean, reflect: !0, attribute: "hide-tags" })
297
+ ], s.prototype, "hideTags", 2);
298
+ o([
299
+ a({ type: String })
300
+ ], s.prototype, "hint", 2);
301
+ o([
302
+ a({ type: Array, attribute: !1 })
303
+ ], s.prototype, "selectedValues", 1);
304
+ o([
305
+ a({ type: Array, attribute: !1 })
306
+ ], s.prototype, "selectedOptionsText", 1);
307
+ o([
308
+ a({ type: String, reflect: !0 })
309
+ ], s.prototype, "label", 2);
310
+ o([
311
+ a({ type: String })
312
+ ], s.prototype, "lang", 2);
313
+ o([
314
+ a({ type: Number })
315
+ ], s.prototype, "max", 2);
316
+ o([
317
+ a({ type: Number })
318
+ ], s.prototype, "min", 2);
319
+ o([
320
+ a({ type: Boolean, reflect: !0 })
321
+ ], s.prototype, "multiple", 2);
322
+ o([
323
+ a({ type: String })
324
+ ], s.prototype, "name", 2);
325
+ o([
326
+ a()
327
+ ], s.prototype, "severity", 2);
328
+ o([
329
+ a({ type: Boolean, attribute: "show-valid" })
330
+ ], s.prototype, "showValid", 2);
331
+ o([
332
+ a({ reflect: !0 })
333
+ ], s.prototype, "size", 2);
334
+ o([
335
+ a({ type: String, attribute: !1 })
336
+ ], s.prototype, "value", 1);
337
+ o([
338
+ u()
339
+ ], s.prototype, "selectedOptions", 1);
340
+ o([
341
+ u()
342
+ ], s.prototype, "_expanded", 2);
343
+ o([
344
+ u()
345
+ ], s.prototype, "_invalid", 2);
346
+ o([
347
+ m("#select-button")
348
+ ], s.prototype, "$anchor", 2);
349
+ o([
350
+ m("#selected-value")
351
+ ], s.prototype, "$selectedValue", 2);
352
+ o([
353
+ m("#select-dropdown")
354
+ ], s.prototype, "$popover", 2);
355
+ o([
356
+ F()
357
+ ], s.prototype, "_slottedItems", 2);
358
+ o([
359
+ S("size", { waitUntilFirstUpdate: !0 })
360
+ ], s.prototype, "_handleSizeUpdate", 1);
361
+ o([
362
+ S("_expanded", { afterUpdate: !0 })
363
+ ], s.prototype, "handleExpandedChange", 1);
339
364
  export {
340
- i as SkfSelect
365
+ s as SkfSelect
341
366
  };
@@ -50,7 +50,7 @@ const s = e`
50
50
  }
51
51
 
52
52
  :is(.stepper-item--active, .stepper-item--completed) {
53
- --_skf-stepper-color: var(--skf-text-color-emphasised);
53
+ --_skf-stepper-color: var(--skf-text-color-emphasized);
54
54
  }
55
55
 
56
56
  .stepper-item--enabled {
@@ -70,17 +70,17 @@ const s = e`
70
70
  user-select: none;
71
71
 
72
72
  :is(.stepper-item--active, .stepper-item--active-completed, .stepper-item--completed) & {
73
- --_skf-stepper-circle-border-color: var(--skf-border-color-emphasised);
73
+ --_skf-stepper-circle-border-color: var(--skf-border-color-emphasized);
74
74
  }
75
75
 
76
76
  :is(.stepper-item--active, .stepper-item--active-completed) & {
77
77
  --_skf-stepper-circle-color: var(--skf-text-color-inverse);
78
- --_skf-stepper-circle-bg-color: var(--skf-bg-color-emphasised);
78
+ --_skf-stepper-circle-bg-color: var(--skf-bg-color-emphasized);
79
79
  }
80
80
 
81
81
  .stepper-item--enabled & {
82
82
  --_skf-stepper-circle-border-color: #6292e4; /* Missing token */
83
- --_skf-stepper-circle-color: var(--skf-text-color-emphasised);
83
+ --_skf-stepper-circle-color: var(--skf-text-color-emphasized);
84
84
  }
85
85
  }
86
86
 
@@ -1,5 +1,6 @@
1
1
  import { FormBase } from '../../internal/components/formBase.js';
2
2
  import type { FormFieldBaseProps } from '../../internal/types/formField.js';
3
+ import { type Language } from '../../utilities/localize.js';
3
4
  import { type CSSResultGroup } from 'lit';
4
5
  /**
5
6
  * The `<skf-switch>` is a component that displays a list of actions or options
@@ -14,6 +15,7 @@ import { type CSSResultGroup } from 'lit';
14
15
  * @tagname skf-switch
15
16
  */
16
17
  export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
18
+ #private;
17
19
  static styles: CSSResultGroup;
18
20
  /** @internal */
19
21
  private _initialChecked;
@@ -25,10 +27,10 @@ export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
25
27
  hideLabel: boolean;
26
28
  /** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
27
29
  label?: string;
30
+ /** Sets the internal language of the component */
31
+ lang: Language;
28
32
  /** If defined, adds name to the input-element */
29
33
  name?: string;
30
- /** If defined, renders an alternative A11y text for the asterisk */
31
- requiredLabel?: string;
32
34
  /** Size of the Switch */
33
35
  size: 'sm' | 'md';
34
36
  /** The current value of the input field */
@@ -1,21 +1,29 @@
1
- import { FormBase as o } from "../../internal/components/formBase.js";
2
- import { Asterisk as u } from "../../internal/templates/asterisk.js";
3
- import { componentStyles as p } from "../../styles/component.styles.js";
4
- import { nothing as c, html as v } from "lit";
5
- import { property as s, state as f, query as m } from "lit/decorators.js";
6
- import { classMap as _ } from "lit/directives/class-map.js";
7
- import { ifDefined as b } from "lit/directives/if-defined.js";
8
- import { styles as y } from "./switch.styles.js";
9
- var g = Object.defineProperty, i = (d, e, a, k) => {
10
- for (var l = void 0, h = d.length - 1, n; h >= 0; h--)
11
- (n = d[h]) && (l = n(e, a, l) || l);
12
- return l && g(e, a, l), l;
1
+ var p = (t) => {
2
+ throw TypeError(t);
13
3
  };
14
- const r = class r extends o {
4
+ var c = (t, i, e) => i.has(t) || p("Cannot " + e);
5
+ var v = (t, i, e) => (c(t, i, "read from private field"), e ? e.call(t) : i.get(t)), f = (t, i, e) => i.has(t) ? p("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), m = (t, i, e, l) => (c(t, i, "write to private field"), l ? l.call(t, e) : i.set(t, e), e);
6
+ import { FormBase as _ } from "../../internal/components/formBase.js";
7
+ import { Asterisk as y } from "../../internal/templates/asterisk.js";
8
+ import { componentStyles as b } from "../../styles/component.styles.js";
9
+ import { LocalizeController as g } from "../../utilities/localize.js";
10
+ import { nothing as k, html as $ } from "lit";
11
+ import { property as h, state as C, query as V } from "lit/decorators.js";
12
+ import { classMap as w } from "lit/directives/class-map.js";
13
+ import { ifDefined as q } from "lit/directives/if-defined.js";
14
+ import { styles as z } from "./switch.styles.js";
15
+ var A = Object.defineProperty, a = (t, i, e, l) => {
16
+ for (var r = void 0, d = t.length - 1, u; d >= 0; d--)
17
+ (u = t[d]) && (r = u(i, e, r) || r);
18
+ return r && A(i, e, r), r;
19
+ }, n;
20
+ const o = class o extends _ {
15
21
  constructor() {
16
- super(...arguments), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.hideLabel = !1, this.size = "md", this.value = "", this._invalid = !1, this._handleChange = (e) => {
17
- var a;
18
- e.stopPropagation(), this.pristine = !1, this.checked = ((a = this.$input) == null ? void 0 : a.checked) ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(null), this.emitEvent("change");
22
+ super(...arguments);
23
+ f(this, n);
24
+ m(this, n, new g(this)), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.hideLabel = !1, this.lang = "en", this.size = "md", this.value = "", this._invalid = !1, this._handleChange = (e) => {
25
+ var l;
26
+ e.stopPropagation(), this.pristine = !1, this.checked = ((l = this.$input) == null ? void 0 : l.checked) ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(null), this.emitEvent("change");
19
27
  }, this._handleInvalid = (e) => {
20
28
  this.pristine = !1, this._invalid = !0, this.customErrorDisplay && e.preventDefault();
21
29
  }, this._resetValue = (e) => {
@@ -42,18 +50,18 @@ const r = class r extends o {
42
50
  var e;
43
51
  if (this._invalid = !1, this.required && !this.checked) {
44
52
  this.pristine || (this._invalid = !0);
45
- const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
53
+ const l = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
46
54
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
47
55
  ((e = this.$input) == null ? void 0 : e.validationMessage) || "Please check this box if you want to proceed"
48
56
  );
49
- this.setValidity({ valueMissing: !0 }, String(a));
57
+ this.setValidity({ valueMissing: !0 }, String(l));
50
58
  } else
51
59
  this.setValidity({});
52
60
  }
53
61
  render() {
54
- return v`
62
+ return $`
55
63
  <label
56
- class=${_({
64
+ class=${w({
57
65
  switch: !0,
58
66
  "switch--small": this.size === "sm"
59
67
  })}
@@ -67,50 +75,50 @@ const r = class r extends o {
67
75
  @reset=${this._resetValue}
68
76
  aria-invalid=${!!this._invalid}
69
77
  class="switch__input"
70
- name=${b(this.name)}
78
+ name=${q(this.name)}
71
79
  type="checkbox"
72
80
  value=${this.value}
73
81
  />
74
- <div class="switch__label ${this.hideLabel ? "visually-hidden" : c}">
82
+ <div class="switch__label ${this.hideLabel ? "visually-hidden" : k}">
75
83
  <slot>${this.label}</slot>
76
- ${this.required ? u(this.requiredLabel, "switch__asterisk") : null}
84
+ ${this.required ? y(v(this, n).term("required"), "switch__asterisk") : null}
77
85
  </div>
78
86
  </label>
79
87
  `;
80
88
  }
81
89
  };
82
- r.styles = [p, y];
83
- let t = r;
84
- i([
85
- s({ type: Boolean })
86
- ], t.prototype, "debug");
87
- i([
88
- s({ type: Boolean, reflect: !0 })
89
- ], t.prototype, "checked");
90
- i([
91
- s({ type: Boolean, attribute: "hide-label", reflect: !0 })
92
- ], t.prototype, "hideLabel");
93
- i([
94
- s()
95
- ], t.prototype, "label");
96
- i([
97
- s()
98
- ], t.prototype, "name");
99
- i([
100
- s({ attribute: "required-label" })
101
- ], t.prototype, "requiredLabel");
102
- i([
103
- s({ reflect: !0 })
104
- ], t.prototype, "size");
105
- i([
106
- s()
107
- ], t.prototype, "value");
108
- i([
109
- f()
110
- ], t.prototype, "_invalid");
111
- i([
112
- m("input")
113
- ], t.prototype, "$input");
90
+ n = new WeakMap(), o.styles = [b, z];
91
+ let s = o;
92
+ a([
93
+ h({ type: Boolean })
94
+ ], s.prototype, "debug");
95
+ a([
96
+ h({ type: Boolean, reflect: !0 })
97
+ ], s.prototype, "checked");
98
+ a([
99
+ h({ type: Boolean, attribute: "hide-label", reflect: !0 })
100
+ ], s.prototype, "hideLabel");
101
+ a([
102
+ h()
103
+ ], s.prototype, "label");
104
+ a([
105
+ h({ type: String })
106
+ ], s.prototype, "lang");
107
+ a([
108
+ h()
109
+ ], s.prototype, "name");
110
+ a([
111
+ h({ reflect: !0 })
112
+ ], s.prototype, "size");
113
+ a([
114
+ h()
115
+ ], s.prototype, "value");
116
+ a([
117
+ C()
118
+ ], s.prototype, "_invalid");
119
+ a([
120
+ V("input")
121
+ ], s.prototype, "$input");
114
122
  export {
115
- t as SkfSwitch
123
+ s as SkfSwitch
116
124
  };