@skf-design-system/ui-components 1.0.0-beta.3 → 1.0.0-beta.5

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 (54) hide show
  1. package/README.md +26 -6
  2. package/dist/components/alert/alert.component.js +20 -18
  3. package/dist/components/alert/alert.styles.js +50 -47
  4. package/dist/components/button/button.component.d.ts +2 -0
  5. package/dist/components/button/button.component.js +5 -5
  6. package/dist/components/checkbox/checkbox.styles.js +6 -1
  7. package/dist/components/icon/icon.styles.js +56 -54
  8. package/dist/components/input/input.component.d.ts +9 -0
  9. package/dist/components/input/input.component.js +32 -24
  10. package/dist/components/radio/radio.styles.js +7 -2
  11. package/dist/components/select/select.component.d.ts +5 -2
  12. package/dist/components/select/select.component.js +99 -86
  13. package/dist/components/select/select.controllers.js +5 -2
  14. package/dist/components/select/select.styles.js +15 -0
  15. package/dist/components/select-option/select-option.component.d.ts +2 -2
  16. package/dist/components/select-option/select-option.component.js +16 -10
  17. package/dist/components/switch/switch.styles.js +5 -0
  18. package/dist/components/toast/toast.component.d.ts +35 -0
  19. package/dist/components/toast/toast.component.js +52 -0
  20. package/dist/components/toast/toast.d.ts +8 -0
  21. package/dist/components/toast/toast.js +6 -0
  22. package/dist/components/toast/toast.singleton.d.ts +26 -0
  23. package/dist/components/toast/toast.singleton.js +53 -0
  24. package/dist/components/toast/toast.style.d.ts +1 -0
  25. package/dist/components/toast/toast.style.js +9 -0
  26. package/dist/components/toast-item/toast-item.component.d.ts +21 -0
  27. package/dist/components/toast-item/toast-item.component.js +65 -0
  28. package/dist/components/toast-item/toast-item.d.ts +6 -0
  29. package/dist/components/toast-item/toast-item.js +2 -0
  30. package/dist/components/toast-item/toast-item.style.d.ts +2 -0
  31. package/dist/components/toast-item/toast-item.style.js +16 -0
  32. package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +24 -0
  33. package/dist/components/toast-wrapper/toast-wrapper.component.js +37 -0
  34. package/dist/components/toast-wrapper/toast-wrapper.d.ts +8 -0
  35. package/dist/components/toast-wrapper/toast-wrapper.js +6 -0
  36. package/dist/components/toast-wrapper/toast-wrapper.style.d.ts +1 -0
  37. package/dist/components/toast-wrapper/toast-wrapper.style.js +20 -0
  38. package/dist/custom-elements.json +450 -12
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.js +43 -40
  41. package/dist/internal/components/hint/hint.component.js +12 -10
  42. package/dist/internal/components/hint/hint.styles.js +26 -10
  43. package/dist/react/index.d.ts +2 -0
  44. package/dist/react/index.js +2 -0
  45. package/dist/react/skf-toast/index.d.ts +3 -0
  46. package/dist/react/skf-toast/index.js +13 -0
  47. package/dist/react/skf-toast-wrapper/index.d.ts +3 -0
  48. package/dist/react/skf-toast-wrapper/index.js +13 -0
  49. package/dist/styles/form-field.styles.js +4 -0
  50. package/dist/types/jsx/custom-element-jsx.d.ts +41 -3
  51. package/dist/types/vue/index.d.ts +42 -2
  52. package/dist/vscode.html-custom-data.json +40 -1
  53. package/dist/web-types.json +90 -4
  54. package/package.json +3 -3
@@ -1,29 +1,29 @@
1
- import { computePosition as f, flip as v, shift as _, offset as g } from "@floating-ui/dom";
1
+ import { computePosition as v, flip as _, shift as f, offset as g } from "@floating-ui/dom";
2
2
  import { FormBase as b } from "../../internal/components/formBase.js";
3
3
  import { findMatchingTags as y } from "../../internal/helpers/findMatchingTags.js";
4
4
  import { hintSeverity as O } from "../../internal/helpers/hintSeverity.js";
5
- import { raiseError as S } from "../../internal/helpers/raiseError.js";
6
- import { Asterisk as w } from "../../internal/templates/asterisk.js";
7
- import x from "../../styles/component.styles.js";
8
- import { html as h, nothing as $ } from "lit";
9
- import { property as r, state as d, query as p } from "lit/decorators.js";
5
+ import { raiseError as w } from "../../internal/helpers/raiseError.js";
6
+ import { Asterisk as x } from "../../internal/templates/asterisk.js";
7
+ import $ from "../../styles/component.styles.js";
8
+ import { html as h, nothing as S } from "lit";
9
+ import { property as o, state as d, query as p } from "lit/decorators.js";
10
10
  import { classMap as V } from "lit/directives/class-map.js";
11
11
  import { ifDefined as m } from "lit/directives/if-defined.js";
12
12
  import "../../internal/components/hint/hint.js";
13
13
  import "../tag/tag.js";
14
- import { ScrollController as C, ResizeController as A, GlobalClickController as E, KeyboardNavigationController as k, DeveloperFeedbackController as L } from "./select.controllers.js";
14
+ import { ScrollController as C, ResizeController as k, GlobalClickController as E, KeyboardNavigationController as L, DeveloperFeedbackController as A } from "./select.controllers.js";
15
15
  import { styles as P } from "./select.styles.js";
16
- var D = Object.defineProperty, M = Object.getOwnPropertyDescriptor, l = (u, t, e, s) => {
17
- for (var o = s > 1 ? void 0 : s ? M(t, e) : t, n = u.length - 1, a; n >= 0; n--)
18
- (a = u[n]) && (o = (s ? a(t, e, o) : a(o)) || o);
19
- return s && o && D(t, e, o), o;
16
+ var D = Object.defineProperty, M = Object.getOwnPropertyDescriptor, l = (u, t, e, i) => {
17
+ for (var r = i > 1 ? void 0 : i ? M(t, e) : t, n = u.length - 1, a; n >= 0; n--)
18
+ (a = u[n]) && (r = (i ? a(t, e, r) : a(r)) || r);
19
+ return i && r && D(t, e, r), r;
20
20
  };
21
21
  const c = class c extends b {
22
22
  constructor() {
23
- super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.scrollController = new C(this), this.resizeController = new A(this), this.globalClickController = new E(this), this.keyboardNavController = new k(this), this.developerFeedbackController = new L(this), this._handleOptionSelected = (t) => {
23
+ super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.scrollController = new C(this), this.resizeController = new k(this), this.globalClickController = new E(this), this.keyboardNavController = new L(this), this.developerFeedbackController = new A(this), this._handleOptionSelected = (t) => {
24
24
  this._pristine = !1;
25
25
  const e = this._selectedOptions.length > 0;
26
- this.setFormValue(e ? this.getSelectedValues.join(",") : null), this._updateState(t);
26
+ this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
27
27
  }, this._handleReset = () => {
28
28
  this.emitEvent("reset"), this._resetSelectedOptions();
29
29
  }, this._updateWidth = () => {
@@ -32,15 +32,15 @@ const c = class c extends b {
32
32
  (t = this.$dropdown) == null || t.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
33
33
  }, 50);
34
34
  }, this._managePopover = () => ({ close: () => {
35
- var s;
36
- (s = this.$dropdown) == null || s.hidePopover();
35
+ var i;
36
+ (i = this.$dropdown) == null || i.hidePopover();
37
37
  }, open: () => {
38
- const s = this.$selectBtn, o = this.$dropdown;
39
- !s || !o || (o.showPopover(), f(s, o, {
38
+ const i = this.$selectBtn, r = this.$dropdown;
39
+ !i || !r || (r.showPopover(), v(i, r, {
40
40
  placement: "bottom",
41
- middleware: [v(), _({ padding: 5 }), g(2)]
41
+ middleware: [_(), f({ padding: 5 }), g(2)]
42
42
  }).then(({ x: n, y: a }) => {
43
- Object.assign(o.style, {
43
+ Object.assign(r.style, {
44
44
  left: `${String(n)}px`,
45
45
  top: `${String(Math.round(a - window.scrollY))}px`
46
46
  });
@@ -55,10 +55,10 @@ const c = class c extends b {
55
55
  this.setFormValue(null), this.requestUpdate();
56
56
  break;
57
57
  case this._selectedOptions.length === 1:
58
- this.setFormValue(this.getSelectedValues[0]);
58
+ this.setFormValue(this.selectedValues[0]);
59
59
  break;
60
60
  case this._selectedOptions.length > 1:
61
- this.setFormValue(this.getSelectedValues.join(","));
61
+ this.setFormValue(this.selectedValues.join(","));
62
62
  break;
63
63
  default:
64
64
  throw new Error("Something went wrong");
@@ -68,8 +68,8 @@ const c = class c extends b {
68
68
  });
69
69
  }), this._resetSelectedOptions = (t) => {
70
70
  const e = !t;
71
- this._optionsList.forEach((s) => {
72
- (e || s !== t) && s.removeAttribute("selected");
71
+ this._optionsList.forEach((i) => {
72
+ (e || i !== t) && i.removeAttribute("selected");
73
73
  });
74
74
  }, this._handleSlotChange = () => {
75
75
  this._collectSlotOptionTags(), this._validateInput();
@@ -78,11 +78,23 @@ const c = class c extends b {
78
78
  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;
79
79
  }, this._selectedOptions = [];
80
80
  }
81
- get getSelectedValues() {
81
+ set selectedValues(t) {
82
+ this._selectedOptions = this._optionsList.filter((e) => t.includes(e.value.trim()));
83
+ }
84
+ get selectedValues() {
82
85
  return this._selectedOptions.map((t) => t.value.trim());
83
86
  }
84
- get getSelectedOptionsText() {
85
- return this._selectedOptions.map((t) => t.textContent);
87
+ set selectedOptionsText(t) {
88
+ this._selectedOptions = this._selectedOptions.filter(
89
+ (e) => e.textContent && t.includes(e.textContent)
90
+ );
91
+ }
92
+ get selectedOptionsText() {
93
+ return this._selectedOptions.map((t) => t.textContent ?? "");
94
+ }
95
+ set value(t) {
96
+ const e = t.split(",").map((i) => i.trim());
97
+ this._selectedOptions = this._optionsList.filter((i) => e.includes(i.value.trim()));
86
98
  }
87
99
  get value() {
88
100
  return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
@@ -113,20 +125,19 @@ const c = class c extends b {
113
125
  }
114
126
  firstUpdated() {
115
127
  var t;
116
- this.addEventListener("skf-select-option:select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._collectSlotOptionTags(), this._validateInput();
128
+ this.addEventListener("skf-select-option:select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
117
129
  }
118
130
  updated(t) {
119
- var e, s;
120
131
  if (t.has("_expanded")) {
121
- const o = !!t.get("_expanded") === this._expanded;
122
- if (this.emit("skf-select:dropdown", { detail: { expanded: this._expanded } }), o) return;
123
- this._expanded ? ((e = this.$selectBtn) == null || e.setAttribute("aria-expanded", "true"), this._managePopover().open()) : ((s = this.$selectBtn) == null || s.setAttribute("aria-expanded", "false"), this._managePopover().close());
132
+ const e = !!t.get("_expanded") === this._expanded;
133
+ if (this.emit("skf-select:dropdown", { detail: { expanded: this._expanded } }), e) return;
134
+ this._expanded ? this._managePopover().open() : this._managePopover().close();
124
135
  }
125
136
  }
126
- attributeChangedCallback(t, e, s) {
127
- if (super.attributeChangedCallback(t, e, s), t === "custom-invalid")
128
- if (typeof s == "string") {
129
- const n = String(s).trim() || "Custom error";
137
+ attributeChangedCallback(t, e, i) {
138
+ if (super.attributeChangedCallback(t, e, i), t === "custom-invalid")
139
+ if (typeof i == "string") {
140
+ const n = String(i).trim() || "Custom error";
130
141
  this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, n), this.checkValidity();
131
142
  } else
132
143
  this.setValidity({}), this._validateInput();
@@ -142,8 +153,8 @@ const c = class c extends b {
142
153
  e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
143
154
  });
144
155
  else {
145
- const e = this._selectedOptions.length > 0, s = t.detail.value !== null;
146
- e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), s && (this.selectedOptions = [t.target]);
156
+ const e = this._selectedOptions.length > 0, i = t.detail.value !== null;
157
+ e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), i && (this.selectedOptions = [t.target]);
147
158
  }
148
159
  this._setValue();
149
160
  }
@@ -154,7 +165,7 @@ const c = class c extends b {
154
165
  /** @internal */
155
166
  /** Filter out elements other than skf-select-option and store in this._optionsList */
156
167
  _collectSlotOptionTags() {
157
- this._optionsList = y(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), S({
168
+ this._optionsList = y(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), w({
158
169
  assert: this._optionsList.length > 0,
159
170
  reason: "no-children",
160
171
  replaceStrings: [this.localName, "skf-select-option"]
@@ -163,7 +174,7 @@ const c = class c extends b {
163
174
  /** @internal */
164
175
  _validateInput() {
165
176
  this._invalid = !1;
166
- const t = this.required && !this.getSelectedValues.length || this.min === 1, e = !!(this.min && this.getSelectedValues.length < this.min), s = !!(this.max && this.getSelectedValues.length > this.max);
177
+ 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);
167
178
  if (this._internals.validity.customError) {
168
179
  this._invalid = !0;
169
180
  return;
@@ -173,7 +184,7 @@ const c = class c extends b {
173
184
  } else if (e) {
174
185
  const n = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
175
186
  this.setValidity({ rangeUnderflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
176
- } else if (s) {
187
+ } else if (i) {
177
188
  const n = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
178
189
  this.setValidity({ rangeOverflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
179
190
  } else
@@ -185,14 +196,16 @@ const c = class c extends b {
185
196
  <label>
186
197
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
187
198
  ${this.label}
188
- ${this.required ? w(this.requiredLabel) : null}
199
+ ${this.required ? x(this.requiredLabel) : null}
189
200
  </div>
190
201
  <button
191
202
  ?disabled=${this.disabled}
192
203
  @click=${this._handleDropdownToggle}
193
204
  aria-controls="select-dropdown"
194
- aria-expanded="false"
205
+ aria-expanded=${this._expanded}
206
+ aria-invalid=${this._invalid}
195
207
  aria-haspopup="listbox"
208
+ class="skf-icon-host"
196
209
  id="select-button"
197
210
  role="combobox"
198
211
  >
@@ -207,7 +220,7 @@ const c = class c extends b {
207
220
  <div aria-multiselectable=${m(this.multiple && !0)} id="select-dropdown" popover role="listbox">
208
221
  <slot @slotchange=${this._handleSlotChange}></slot>
209
222
  </div>
210
- ${!this.hideTags && this.multiple ? h`
223
+ ${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? h`
211
224
  <div id="tags">
212
225
  ${this.selectedOptions.map(
213
226
  (t) => h`
@@ -220,7 +233,7 @@ const c = class c extends b {
220
233
  `
221
234
  )}
222
235
  </div>
223
- ` : $}
236
+ ` : S}
224
237
  ${this.hint && h`
225
238
  <skf-hint
226
239
  aria-live=${this._invalid ? "assertive" : "polite"}
@@ -235,77 +248,77 @@ const c = class c extends b {
235
248
  `;
236
249
  }
237
250
  };
238
- c.styles = [x, P];
239
- let i = c;
251
+ c.styles = [$, P];
252
+ let s = c;
240
253
  l([
241
- r({ type: String, reflect: !0, attribute: "button-label" })
242
- ], i.prototype, "buttonLabel", 2);
254
+ o({ type: String, reflect: !0, attribute: "button-label" })
255
+ ], s.prototype, "buttonLabel", 2);
243
256
  l([
244
- r({ attribute: "custom-invalid" })
245
- ], i.prototype, "customInvalid", 2);
257
+ o({ attribute: "custom-invalid" })
258
+ ], s.prototype, "customInvalid", 2);
246
259
  l([
247
- r({ type: Boolean, attribute: "hide-label" })
248
- ], i.prototype, "hideLabel", 2);
260
+ o({ type: Boolean, attribute: "hide-label" })
261
+ ], s.prototype, "hideLabel", 2);
249
262
  l([
250
- r({ type: Boolean, reflect: !0, attribute: "hide-tags" })
251
- ], i.prototype, "hideTags", 2);
263
+ o({ type: Boolean, reflect: !0, attribute: "hide-tags" })
264
+ ], s.prototype, "hideTags", 2);
252
265
  l([
253
- r()
254
- ], i.prototype, "hint", 2);
266
+ o()
267
+ ], s.prototype, "hint", 2);
255
268
  l([
256
- r({ type: Array, attribute: !1 })
257
- ], i.prototype, "getSelectedValues", 1);
269
+ o({ type: Array, attribute: !1 })
270
+ ], s.prototype, "selectedValues", 1);
258
271
  l([
259
- r({ type: Array, attribute: !1 })
260
- ], i.prototype, "getSelectedOptionsText", 1);
272
+ o({ type: Array, attribute: !1 })
273
+ ], s.prototype, "selectedOptionsText", 1);
261
274
  l([
262
- r({ reflect: !0 })
263
- ], i.prototype, "label", 2);
275
+ o({ reflect: !0 })
276
+ ], s.prototype, "label", 2);
264
277
  l([
265
- r({ type: Number })
266
- ], i.prototype, "max", 2);
278
+ o({ type: Number })
279
+ ], s.prototype, "max", 2);
267
280
  l([
268
- r({ type: Number })
269
- ], i.prototype, "min", 2);
281
+ o({ type: Number })
282
+ ], s.prototype, "min", 2);
270
283
  l([
271
- r({ type: Boolean, reflect: !0 })
272
- ], i.prototype, "multiple", 2);
284
+ o({ type: Boolean, reflect: !0 })
285
+ ], s.prototype, "multiple", 2);
273
286
  l([
274
- r()
275
- ], i.prototype, "name", 2);
287
+ o()
288
+ ], s.prototype, "name", 2);
276
289
  l([
277
- r({ attribute: "required-label" })
278
- ], i.prototype, "requiredLabel", 2);
290
+ o({ attribute: "required-label" })
291
+ ], s.prototype, "requiredLabel", 2);
279
292
  l([
280
- r()
281
- ], i.prototype, "severity", 2);
293
+ o()
294
+ ], s.prototype, "severity", 2);
282
295
  l([
283
- r({ type: Boolean, attribute: "show-valid" })
284
- ], i.prototype, "showValid", 2);
296
+ o({ type: Boolean, attribute: "show-valid" })
297
+ ], s.prototype, "showValid", 2);
285
298
  l([
286
- r({ reflect: !0 })
287
- ], i.prototype, "size", 2);
299
+ o({ reflect: !0 })
300
+ ], s.prototype, "size", 2);
288
301
  l([
289
302
  d()
290
- ], i.prototype, "value", 1);
303
+ ], s.prototype, "value", 1);
291
304
  l([
292
305
  d()
293
- ], i.prototype, "selectedOptions", 1);
306
+ ], s.prototype, "selectedOptions", 1);
294
307
  l([
295
308
  d()
296
- ], i.prototype, "_expanded", 2);
309
+ ], s.prototype, "_expanded", 2);
297
310
  l([
298
311
  d()
299
- ], i.prototype, "_invalid", 2);
312
+ ], s.prototype, "_invalid", 2);
300
313
  l([
301
314
  p("#select-button")
302
- ], i.prototype, "$selectBtn", 2);
315
+ ], s.prototype, "$selectBtn", 2);
303
316
  l([
304
317
  p("#selected-value")
305
- ], i.prototype, "$selectedValue", 2);
318
+ ], s.prototype, "$selectedValue", 2);
306
319
  l([
307
320
  p("#select-dropdown")
308
- ], i.prototype, "$dropdown", 2);
321
+ ], s.prototype, "$dropdown", 2);
309
322
  export {
310
- i as SkfSelect
323
+ s as SkfSelect
311
324
  };
@@ -146,11 +146,14 @@ class _ {
146
146
  }
147
147
  _badAttributeCombinationWarning() {
148
148
  r({
149
- assert: (this.host.min ?? 0) < (this.host.max ?? 1 / 0),
149
+ assert: (this.host.min ?? 0) <= (this.host.max ?? 1 / 0),
150
150
  reason: "attribute-mismatch",
151
151
  replaceStrings: [this.host.localName, "min", "smaller than max"]
152
152
  }), r({
153
- assert: ((this.host.min ?? this.host.max) && this.host.multiple) ?? !(this.host.min && this.host.max),
153
+ assert: (
154
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
155
+ (this.host.min || this.host.max) && this.host.multiple || !(this.host.min && this.host.max)
156
+ ),
154
157
  reason: "attribute-mismatch",
155
158
  replaceStrings: [this.host.localName, "min or max", "together with multiple"]
156
159
  }), r({
@@ -14,6 +14,10 @@ const t = [
14
14
  flex-direction: column;
15
15
  gap: var(--skf-spacing-25);
16
16
 
17
+ :host([disabled]) & {
18
+ --_skf-select-color: var(--skf-interactive-text-color-disabled);
19
+ }
20
+
17
21
  :host([size='sm']) & {
18
22
  font-size: var(--skf-font-size-75);
19
23
  font-weight: var(--skf-font-weight-medium);
@@ -96,6 +100,16 @@ const t = [
96
100
  }
97
101
  }
98
102
 
103
+ skf-icon {
104
+ transform: var(--_skf-select-icon-transform, rotateX(0deg));
105
+ transform-origin: center;
106
+ transition: transform calc(var(--skf-motion-duration-normal) * 1ms) ease-out;
107
+
108
+ [aria-expanded='true'] & {
109
+ --_skf-select-icon-transform: rotateX(180deg);
110
+ }
111
+ }
112
+
99
113
  #select-dropdown {
100
114
  background-color: var(--skf-bg-color-neutral-1);
101
115
  border: var(--skf-border-width-sm) solid var(--skf-border-color-tertiary);
@@ -106,6 +120,7 @@ const t = [
106
120
 
107
121
  #tags {
108
122
  display: flex;
123
+ flex-wrap: wrap;
109
124
  gap: 0.5rem;
110
125
  }
111
126
  }
@@ -1,5 +1,5 @@
1
1
  import { SkfElement } from '@internal/components/skf-element.js';
2
- import type { IconColor } from '@skf-design-system/ui-assets';
2
+ import type { SeverityFgColor } from '@skf-design-system/ui-assets';
3
3
  import { type CSSResultGroup } from 'lit';
4
4
  import '../icon/icon';
5
5
  import { SkfIcon } from '../icon/icon';
@@ -43,7 +43,7 @@ export declare class SkfSelectOption extends SkfElement {
43
43
  /** If defined, set an icon */
44
44
  icon?: SkfIcon['name'];
45
45
  /** If defined, sets provided color on the icon */
46
- iconColor?: IconColor;
46
+ iconColor?: SeverityFgColor;
47
47
  /** If true, sets the option as selected */
48
48
  selected?: boolean;
49
49
  /** If defined, sets a short label */
@@ -1,8 +1,8 @@
1
- import { SkfElement as p } from "../../internal/components/skf-element.js";
2
- import u from "../../styles/component.styles.js";
3
- import { LitElement as f, html as h } from "lit";
4
- import { property as n, queryAssignedNodes as m } from "lit/decorators.js";
5
- import { ifDefined as _ } from "lit/directives/if-defined.js";
1
+ import { SkfElement as u } from "../../internal/components/skf-element.js";
2
+ import f from "../../styles/component.styles.js";
3
+ import { LitElement as m, html as h } from "lit";
4
+ import { property as n, queryAssignedNodes as _ } from "lit/decorators.js";
5
+ import { ifDefined as p } from "lit/directives/if-defined.js";
6
6
  import "../icon/icon.js";
7
7
  import { styles as y } from "./select-option.styles.js";
8
8
  var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (d, t, s, i) => {
@@ -10,7 +10,7 @@ var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (d, t, s
10
10
  (c = d[a]) && (r = (i ? c(t, s, r) : c(r)) || r);
11
11
  return i && r && v(t, s, r), r;
12
12
  };
13
- const l = class l extends p {
13
+ const l = class l extends u {
14
14
  constructor() {
15
15
  super(), this._handleClick = (s) => {
16
16
  s.stopPropagation(), this.selected = !this.selected;
@@ -69,16 +69,22 @@ const l = class l extends p {
69
69
  render() {
70
70
  return h`
71
71
  <button
72
+ ?disabled=${this.disabled}
72
73
  @click=${this._handleClick}
73
74
  aria-selected=${this.selected ? "true" : "false"}
74
- ?disabled=${this.disabled}
75
75
  role="option"
76
76
  >
77
77
  <skf-icon id="icon-check" name="check" size="sm"></skf-icon>
78
78
  <slot>${this.text}</slot>
79
79
  <div id="adornments">
80
80
  <slot name="icon">
81
- ${this.icon && h`<skf-icon name=${this.icon} color=${_(this.iconColor)}></skf-icon>`}
81
+ ${this.icon && h`
82
+ <skf-icon
83
+ class=${p((this.disabled ?? !this.iconColor) && "skf-icon-host")}
84
+ color=${p(this.iconColor)}
85
+ name=${this.icon}
86
+ ></skf-icon>
87
+ `}
82
88
  </slot>
83
89
  ${this.shortLabel && h`<div id="short-label">${this.shortLabel}</div>`}
84
90
  </div>
@@ -86,7 +92,7 @@ const l = class l extends p {
86
92
  `;
87
93
  }
88
94
  };
89
- l.styles = [u, y], l.shadowRootOptions = { ...f.shadowRootOptions, delegatesFocus: !0 };
95
+ l.styles = [f, y], l.shadowRootOptions = { ...m.shadowRootOptions, delegatesFocus: !0 };
90
96
  let e = l;
91
97
  o([
92
98
  n({ type: Boolean, reflect: !0 })
@@ -110,7 +116,7 @@ o([
110
116
  n({ reflect: !0 })
111
117
  ], e.prototype, "value", 1);
112
118
  o([
113
- m({ flatten: !0 })
119
+ _({ flatten: !0 })
114
120
  ], e.prototype, "_assignedNodes", 2);
115
121
  export {
116
122
  e as SkfSelectOption
@@ -10,9 +10,14 @@ const t = [
10
10
 
11
11
  #root {
12
12
  align-items: center;
13
+ color: var(--_skf-switch-color, var(--skf-text-color-primary));
13
14
  display: flex;
14
15
  grid-gap: var(--skf-spacing-50);
15
16
 
17
+ :host([disabled]) & {
18
+ --_skf-switch-color: var(--skf-interactive-text-color-disabled);
19
+ }
20
+
16
21
  :host([size='sm']) & {
17
22
  --_skf-switch-height: var(--skf-size-20);
18
23
  --_skf-switch-width: var(--skf-size-32);
@@ -0,0 +1,35 @@
1
+ import { SkfElement } from '@internal/components/skf-element';
2
+ import { type CSSResultGroup } from 'lit';
3
+ /**
4
+ * SkfToast is the only component a user (developer) interacts with to create a toast notification. Once rendered it will invoke a singleton instance to manage the toast notifications.
5
+ * The singleton instance will create a new toast notification (using SkfAlert) and append it to SkfToastWrapper (or append SkfToastWrapper if it doesn't exist yet) and mount that to the DOM.
6
+ * Once a toast notification is created, it will be removed after a set amount of time (if not set as a closeable SkfToast) together with the original SkfToast.
7
+ * Once the queue in the singleton is empty, the SkfToastWrapper will be removed from the DOM.
8
+ */
9
+ /**
10
+ * A simple toast component that displays a message to the user. Use by appending a &lt;skf-toast&gt; tag to the DOM. Position in DOM is irrelevant.
11
+ *
12
+ * @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/98e432-toast) for design principles
13
+ *
14
+ * @slot - The component's placeholder content
15
+ *
16
+ * @tagname skf-toast
17
+ */
18
+ export declare class SkfToast extends SkfElement {
19
+ static styles: CSSResultGroup;
20
+ private _singleton?;
21
+ /** If provided, adds a close button to the toast and will not disapear until user actively dismisses it. */
22
+ closeable: boolean;
23
+ debug: boolean;
24
+ /** Severity of the toast. */
25
+ severity: 'info' | 'success' | 'warning' | 'error';
26
+ /** Time in seconds before the toast disappears. */
27
+ timer: number;
28
+ /** offsets where toasts emerge vertically */
29
+ topOffset?: number;
30
+ /** @internal */
31
+ _slottedText: Node[];
32
+ constructor();
33
+ firstUpdated(): void;
34
+ render(): import("lit").TemplateResult<1>;
35
+ }
@@ -0,0 +1,52 @@
1
+ import { Singleton as f } from "./toast.singleton.js";
2
+ import { SkfElement as m } from "../../internal/components/skf-element.js";
3
+ import { html as h } from "lit";
4
+ import { property as s, queryAssignedNodes as y } from "lit/decorators.js";
5
+ import { styles as a } from "./toast.style.js";
6
+ var u = Object.defineProperty, o = (l, r, n, b) => {
7
+ for (var e = void 0, i = l.length - 1, d; i >= 0; i--)
8
+ (d = l[i]) && (e = d(r, n, e) || e);
9
+ return e && u(r, n, e), e;
10
+ };
11
+ const p = class p extends m {
12
+ constructor() {
13
+ super(), this.closeable = !1, this.debug = !1, this.severity = "info", this.timer = 5, this._singleton = void 0;
14
+ }
15
+ firstUpdated() {
16
+ this._singleton = new f(this.getRootNode()), this._singleton.addData({
17
+ text: this._slottedText.map((r) => r.textContent).join(),
18
+ timer: this.timer,
19
+ closeable: this.closeable,
20
+ originEl: this,
21
+ severity: this.severity,
22
+ topOffset: this.topOffset,
23
+ debug: this.debug
24
+ });
25
+ }
26
+ render() {
27
+ return h`<slot></slot>`;
28
+ }
29
+ };
30
+ p.styles = [a];
31
+ let t = p;
32
+ o([
33
+ s({ type: Boolean })
34
+ ], t.prototype, "closeable");
35
+ o([
36
+ s({ type: Boolean })
37
+ ], t.prototype, "debug");
38
+ o([
39
+ s()
40
+ ], t.prototype, "severity");
41
+ o([
42
+ s({ type: Number })
43
+ ], t.prototype, "timer");
44
+ o([
45
+ s({ type: Number })
46
+ ], t.prototype, "topOffset");
47
+ o([
48
+ y()
49
+ ], t.prototype, "_slottedText");
50
+ export {
51
+ t as SkfToast
52
+ };
@@ -0,0 +1,8 @@
1
+ import { SkfToast } from './toast.component';
2
+ export * from './toast.component';
3
+ export default SkfToast;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'skf-toast': SkfToast;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { SkfToast as t } from "./toast.component.js";
2
+ t.define("skf-toast");
3
+ export {
4
+ t as SkfToast,
5
+ t as default
6
+ };
@@ -0,0 +1,26 @@
1
+ import '@components/toast-item/toast-item.js';
2
+ import '@components/toast-wrapper/toast-wrapper.js';
3
+ import type { SkfToast } from '@components/toast/toast.component.js';
4
+ interface ToastData {
5
+ text: string;
6
+ timer: number;
7
+ closeable: boolean;
8
+ topOffset?: number;
9
+ originEl: SkfToast;
10
+ severity: 'info' | 'success' | 'warning' | 'error';
11
+ debug: boolean;
12
+ }
13
+ export declare class Singleton {
14
+ private static instance?;
15
+ data: ToastData[];
16
+ root: Document;
17
+ usePopover: boolean;
18
+ constructor(root: Document);
19
+ hasToasts(): boolean;
20
+ popToast(): ToastData | undefined;
21
+ getData(): ToastData[];
22
+ setData(data: ToastData[]): void;
23
+ addData(data: ToastData): void;
24
+ udpateUI(): void;
25
+ }
26
+ export {};