@skf-design-system/ui-components 1.0.2-beta.5 → 1.0.2-beta.7

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 (124) hide show
  1. package/README.md +18 -0
  2. package/dist/components/accordion/accordion.component.d.ts +1 -1
  3. package/dist/components/accordion/accordion.component.js +2 -2
  4. package/dist/components/alert/alert.component.d.ts +3 -2
  5. package/dist/components/alert/alert.component.js +39 -33
  6. package/dist/components/button/button.styles.js +3 -3
  7. package/dist/components/checkbox/checkbox.component.d.ts +4 -2
  8. package/dist/components/checkbox/checkbox.component.js +73 -65
  9. package/dist/components/checkbox/checkbox.styles.js +1 -1
  10. package/dist/components/datepicker/datepicker-calendar.component.d.ts +4 -0
  11. package/dist/components/datepicker/datepicker-calendar.component.js +134 -127
  12. package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
  13. package/dist/components/datepicker/datepicker-popup.component.js +100 -88
  14. package/dist/components/datepicker/datepicker.component.d.ts +4 -2
  15. package/dist/components/datepicker/datepicker.component.js +151 -140
  16. package/dist/components/dialog/dialog.component.d.ts +3 -2
  17. package/dist/components/dialog/dialog.component.js +39 -37
  18. package/dist/components/divider/divider.component.d.ts +3 -0
  19. package/dist/components/divider/divider.component.js +43 -22
  20. package/dist/components/divider/divider.styles.js +9 -9
  21. package/dist/components/drawer/drawer.component.d.ts +11 -4
  22. package/dist/components/drawer/drawer.component.js +77 -55
  23. package/dist/components/drawer/drawer.styles.js +47 -40
  24. package/dist/components/header/header.component.d.ts +4 -2
  25. package/dist/components/header/header.component.js +66 -57
  26. package/dist/components/header/header.styles.js +2 -2
  27. package/dist/components/icon/icon.component.js +7 -7
  28. package/dist/components/icon/icon.styles.js +2 -2
  29. package/dist/components/input/input.component.d.ts +4 -8
  30. package/dist/components/input/input.component.js +147 -147
  31. package/dist/components/input/input.controllers.d.ts +0 -1
  32. package/dist/components/input/input.controllers.js +12 -12
  33. package/dist/components/link/link.component.d.ts +15 -18
  34. package/dist/components/link/link.component.js +105 -107
  35. package/dist/components/link/link.styles.js +53 -45
  36. package/dist/components/loader/loader.component.d.ts +5 -3
  37. package/dist/components/loader/loader.component.js +39 -28
  38. package/dist/components/loader/loader.styles.js +6 -10
  39. package/dist/components/menu/menu-item.component.d.ts +1 -1
  40. package/dist/components/menu/menu-item.component.js +8 -8
  41. package/dist/components/menu/menu-item.styles.js +13 -9
  42. package/dist/components/menu/menu.component.d.ts +5 -2
  43. package/dist/components/menu/menu.component.js +8 -8
  44. package/dist/components/nav/nav-item.component.d.ts +4 -0
  45. package/dist/components/nav/nav-item.component.js +44 -25
  46. package/dist/components/nav/nav-item.styles.js +29 -25
  47. package/dist/components/nav/nav.component.d.ts +9 -0
  48. package/dist/components/nav/nav.component.js +47 -21
  49. package/dist/components/nav/nav.styles.js +15 -9
  50. package/dist/components/popover/popover.component.d.ts +10 -3
  51. package/dist/components/popover/popover.component.js +30 -22
  52. package/dist/components/progress/progress.component.d.ts +2 -0
  53. package/dist/components/progress/progress.component.js +38 -29
  54. package/dist/components/progress/progress.styles.js +4 -4
  55. package/dist/components/radio/radio.component.d.ts +4 -2
  56. package/dist/components/radio/radio.component.js +91 -83
  57. package/dist/components/radio/radio.styles.js +1 -1
  58. package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
  59. package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
  60. package/dist/components/select/select-option-group.component.d.ts +4 -0
  61. package/dist/components/select/select-option-group.component.js +37 -18
  62. package/dist/components/select/select-option-group.style.js +12 -6
  63. package/dist/components/select/select-option.component.d.ts +7 -2
  64. package/dist/components/select/select-option.component.js +70 -53
  65. package/dist/components/select/select-option.styles.js +43 -31
  66. package/dist/components/select/select.component.d.ts +18 -10
  67. package/dist/components/select/select.component.js +175 -132
  68. package/dist/components/select/select.controllers.js +2 -1
  69. package/dist/components/select/select.styles.js +8 -2
  70. package/dist/components/stepper/stepper-item.component.d.ts +1 -1
  71. package/dist/components/stepper/stepper-item.component.js +26 -23
  72. package/dist/components/stepper/stepper-item.styles.js +4 -4
  73. package/dist/components/switch/switch.component.d.ts +4 -2
  74. package/dist/components/switch/switch.component.js +64 -56
  75. package/dist/components/switch/switch.styles.js +1 -1
  76. package/dist/components/tabs/tab-panel.component.d.ts +1 -1
  77. package/dist/components/tabs/tab-panel.component.js +19 -16
  78. package/dist/components/tabs/tab.component.d.ts +1 -1
  79. package/dist/components/tabs/tab.component.js +17 -14
  80. package/dist/components/tabs/tab.styles.js +2 -2
  81. package/dist/components/tag/tag.component.d.ts +3 -0
  82. package/dist/components/tag/tag.component.js +50 -41
  83. package/dist/components/textarea/textarea.component.d.ts +4 -2
  84. package/dist/components/textarea/textarea.component.js +127 -118
  85. package/dist/components/toast/toast-item.styles.js +13 -10
  86. package/dist/components/toast/toast.component.js +9 -9
  87. package/dist/components/toast/toast.singleton.d.ts +1 -1
  88. package/dist/components/toast/toast.singleton.js +18 -18
  89. package/dist/components/tooltip/tooltip.component.d.ts +9 -2
  90. package/dist/components/tooltip/tooltip.component.js +13 -7
  91. package/dist/custom-elements.json +1305 -946
  92. package/dist/index.d.ts +2 -2
  93. package/dist/index.js +20 -20
  94. package/dist/internal/base-classes/popover/popover.base.d.ts +24 -5
  95. package/dist/internal/base-classes/popover/popover.base.js +28 -29
  96. package/dist/internal/base-classes/popover/popover.styles.js +4 -5
  97. package/dist/internal/components/hint/hint.component.d.ts +4 -0
  98. package/dist/internal/components/hint/hint.component.js +47 -20
  99. package/dist/internal/components/hint/hint.styles.js +29 -25
  100. package/dist/internal/controllers/popover.controller.d.ts +2 -0
  101. package/dist/internal/helpers/uuid.d.ts +8 -10
  102. package/dist/internal/helpers/uuid.js +4 -11
  103. package/dist/internal/helpers/watch.d.ts +1 -1
  104. package/dist/internal/templates/asterisk.d.ts +1 -1
  105. package/dist/internal/templates/asterisk.js +4 -4
  106. package/dist/internal/types.d.ts +4 -0
  107. package/dist/styles/global-alt.css +1 -1
  108. package/dist/styles/global.css +1 -1
  109. package/dist/translations/en.d.ts +3 -0
  110. package/dist/translations/en.js +27 -0
  111. package/dist/translations/es.d.ts +3 -0
  112. package/dist/translations/es.js +27 -0
  113. package/dist/translations/index.d.ts +4 -0
  114. package/dist/translations/pt.d.ts +3 -0
  115. package/dist/translations/pt.js +27 -0
  116. package/dist/translations/sv.d.ts +3 -0
  117. package/dist/translations/sv.js +27 -0
  118. package/dist/types/jsx/custom-element-jsx.d.ts +243 -128
  119. package/dist/types/vue/index.d.ts +136 -127
  120. package/dist/utilities/localize.d.ts +28 -0
  121. package/dist/utilities/localize.js +13 -0
  122. package/dist/vscode.html-custom-data.json +168 -177
  123. package/dist/web-types.json +411 -381
  124. package/package.json +34 -41
@@ -1,39 +1,41 @@
1
- var y = (e) => {
1
+ var k = (e) => {
2
2
  throw TypeError(e);
3
3
  };
4
- var k = (e, o, t) => o.has(e) || y("Cannot " + t);
5
- var m = (e, o, t) => (k(e, o, "read from private field"), t ? t.call(e) : o.get(e)), d = (e, o, t) => o.has(e) ? y("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(e) : o.set(e, t), v = (e, o, t, i) => (k(e, o, "write to private field"), i ? i.call(e, t) : o.set(e, t), t);
4
+ var C = (e, o, t) => o.has(e) || k("Cannot " + t);
5
+ var m = (e, o, t) => (C(e, o, "read from private field"), t ? t.call(e) : o.get(e)), d = (e, o, t) => o.has(e) ? k("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(e) : o.set(e, t), f = (e, o, t, s) => (C(e, o, "write to private field"), s ? s.call(e, t) : o.set(e, t), t);
6
6
  import "../icon/icon.js";
7
- import { SkfElement as _ } from "../../internal/components/skf-element.js";
8
- import { stateMap as g } from "../../internal/helpers/stateMap.js";
9
- import { watch as w } from "../../internal/helpers/watch.js";
10
- import { componentStyles as $ } from "../../styles/component.styles.js";
11
- import { nothing as C, html as f } from "lit";
12
- import { property as c, query as R } from "lit/decorators.js";
13
- import { ifDefined as D } from "lit/directives/if-defined.js";
14
- import { styles as E } from "./tag.styles.js";
15
- var P = Object.defineProperty, z = Object.getOwnPropertyDescriptor, r = (e, o, t, i) => {
16
- for (var s = i > 1 ? void 0 : i ? z(o, t) : o, l = e.length - 1, p; l >= 0; l--)
17
- (p = e[l]) && (s = (i ? p(o, t, s) : p(s)) || s);
18
- return i && s && P(o, t, s), s;
7
+ import { SkfElement as g } from "../../internal/components/skf-element.js";
8
+ import { stateMap as w } from "../../internal/helpers/stateMap.js";
9
+ import { watch as $ } from "../../internal/helpers/watch.js";
10
+ import { componentStyles as R } from "../../styles/component.styles.js";
11
+ import { LocalizeController as z } from "../../utilities/localize.js";
12
+ import { nothing as b, html as u } from "lit";
13
+ import { property as l, query as D } from "lit/decorators.js";
14
+ import { ifDefined as E } from "lit/directives/if-defined.js";
15
+ import { styles as P } from "./tag.styles.js";
16
+ var S = Object.defineProperty, B = Object.getOwnPropertyDescriptor, r = (e, o, t, s) => {
17
+ for (var i = s > 1 ? void 0 : s ? B(o, t) : o, a = e.length - 1, v; a >= 0; a--)
18
+ (v = e[a]) && (i = (s ? v(o, t, i) : v(i)) || i);
19
+ return s && i && S(o, t, i), i;
19
20
  };
20
- const b = {
21
+ const _ = {
21
22
  size: ["sm", "md"],
22
23
  color: ["error", "info", "success", "warning"]
23
24
  };
24
- var a, h;
25
- const u = class u extends _ {
25
+ var c, h, p;
26
+ const y = class y extends g {
26
27
  constructor() {
27
28
  super(...arguments);
28
- d(this, a);
29
+ d(this, c);
29
30
  d(this, h);
30
- v(this, a, this.attachInternals()), v(this, h, m(this, a).states), this.size = "md", this.removable = !1, this._handleKeyDown = (t) => {
31
+ d(this, p);
32
+ f(this, c, new z(this)), f(this, h, this.attachInternals()), f(this, p, m(this, h).states), this.size = "md", this.lang = "en", this.removable = !1, this._handleKeyDown = (t) => {
31
33
  (t.key === "Enter" || t.key === " ") && this.$removeButton.click();
32
34
  }, this._handleRemove = (t) => {
33
35
  this._onRemove && this._onRemove(t);
34
36
  }, this._handleClick = (t) => {
35
- var l;
36
- t.stopPropagation(), t.composedPath()[0].localName === "button" ? this.remove() : (l = this.onClick) == null || l.call(this, t);
37
+ var a;
38
+ t.stopPropagation(), t.composedPath()[0].localName === "button" ? this.remove() : (a = this.onClick) == null || a.call(this, t);
37
39
  };
38
40
  }
39
41
  set onClick(t) {
@@ -54,51 +56,58 @@ const u = class u extends _ {
54
56
  disconnectedCallback() {
55
57
  super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
56
58
  }
57
- attributeChangedCallback(t, i, s) {
58
- super.attributeChangedCallback(t, i, s), t === "removable" && s !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
59
+ attributeChangedCallback(t, s, i) {
60
+ super.attributeChangedCallback(t, s, i), t === "removable" && i !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
59
61
  }
60
- _handleStateChange(t, i, s) {
61
- g(m(this, h), b[t]).set(s);
62
+ _handleStateChange(t, s, i) {
63
+ w(m(this, p), _[t]).set(i);
62
64
  }
63
65
  render() {
64
- return f`
66
+ return u`
65
67
  <div id="root">
66
- ${this.icon ? f`<skf-icon color=${D(this.color)} name=${this.icon} size="sm"></skf-icon>` : C}
68
+ ${this.icon ? u`<skf-icon color=${E(this.color)} name=${this.icon} size="sm"></skf-icon>` : b}
67
69
  <slot></slot>
68
- ${this.removable ? f`
69
- <button @click=${this._handleRemove} type="button">
70
+ ${this.removable ? u`
71
+ <button
72
+ @click=${this._handleRemove}
73
+ aria-label=${m(this, c).term("close")}
74
+ type="button"
75
+ >
70
76
  <skf-icon name="close" size="xs"></skf-icon>
71
77
  </button>
72
- ` : C}
78
+ ` : b}
73
79
  </div>
74
80
  `;
75
81
  }
76
82
  };
77
- a = new WeakMap(), h = new WeakMap(), u.styles = [$, E];
78
- let n = u;
83
+ c = new WeakMap(), h = new WeakMap(), p = new WeakMap(), y.styles = [R, P];
84
+ let n = y;
79
85
  r([
80
- c({ type: String })
86
+ l({ type: String })
81
87
  ], n.prototype, "size", 2);
82
88
  r([
83
- c({ type: String })
89
+ l({ type: String })
84
90
  ], n.prototype, "icon", 2);
85
91
  r([
86
- c({ type: String })
92
+ l({ type: String })
87
93
  ], n.prototype, "color", 2);
88
94
  r([
89
- c({ attribute: !1 })
95
+ l({ type: String })
96
+ ], n.prototype, "lang", 2);
97
+ r([
98
+ l({ attribute: !1 })
90
99
  ], n.prototype, "onClick", 1);
91
100
  r([
92
- c({ attribute: !1 })
101
+ l({ attribute: !1 })
93
102
  ], n.prototype, "onRemove", 1);
94
103
  r([
95
- c({ type: Boolean })
104
+ l({ type: Boolean })
96
105
  ], n.prototype, "removable", 2);
97
106
  r([
98
- R("button")
107
+ D("button")
99
108
  ], n.prototype, "$removeButton", 2);
100
109
  r([
101
- w(Object.keys(b))
110
+ $(Object.keys(_))
102
111
  ], n.prototype, "_handleStateChange", 1);
103
112
  export {
104
113
  n as SkfTag
@@ -3,6 +3,7 @@ import { FormBase } from '../../internal/components/formBase.js';
3
3
  import '../../internal/components/hint/hint.js';
4
4
  import type { FormFieldSeverity } from '../../internal/types.js';
5
5
  import type { FormFieldBaseProps } from '../../internal/types/formField.js';
6
+ import { type Language } from '../../utilities/localize.js';
6
7
  import { type CSSResultGroup } from 'lit';
7
8
  interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
8
9
  cols?: number;
@@ -26,6 +27,7 @@ interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
26
27
  * @tagname skf-textarea
27
28
  */
28
29
  export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
30
+ #private;
29
31
  static styles: CSSResultGroup;
30
32
  /** @internal */
31
33
  private customError;
@@ -42,6 +44,8 @@ export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
42
44
  hint?: string;
43
45
  /** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
44
46
  label?: string;
47
+ /** Sets the internal language of the component */
48
+ lang: Language;
45
49
  /** If defined, adds name to the input-element */
46
50
  name?: string;
47
51
  /** If defined, sets the maximum character length to accept for this input */
@@ -52,8 +56,6 @@ export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
52
56
  placeholder?: string;
53
57
  /** If true, makes the element not mutable, meaning the user can not edit the control */
54
58
  readonly: boolean;
55
- /** If defined, renders an alternative A11y text for the asterisk */
56
- requiredLabel?: string;
57
59
  /** If defined, sets the rows of the textarea */
58
60
  rows?: number;
59
61
  /** If defined, displays provided severity state */
@@ -1,29 +1,37 @@
1
+ var m = (r) => {
2
+ throw TypeError(r);
3
+ };
4
+ var c = (r, a, t) => a.has(r) || m("Cannot " + t);
5
+ var y = (r, a, t) => (c(r, a, "read from private field"), t ? t.call(r) : a.get(r)), f = (r, a, t) => a.has(r) ? m("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(r) : a.set(r, t), b = (r, a, t, i) => (c(r, a, "write to private field"), i ? i.call(r, t) : a.set(r, t), t);
1
6
  import "../icon/icon.js";
2
- import { FormBase as m } from "../../internal/components/formBase.js";
7
+ import { FormBase as $ } from "../../internal/components/formBase.js";
3
8
  import "../../internal/components/hint/hint.js";
4
- import { hintSeverity as c } from "../../internal/helpers/hintSeverity.js";
5
- import { Asterisk as y } from "../../internal/templates/asterisk.js";
6
- import { componentStyles as f } from "../../styles/component.styles.js";
7
- import { nothing as u, html as v } from "lit";
8
- import { property as r, state as b, query as g } from "lit/decorators.js";
9
- import { ifDefined as o } from "lit/directives/if-defined.js";
10
- import $ from "./textarea.styles.js";
11
- var E = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, e = (p, i, s, a) => {
12
- for (var l = a > 1 ? void 0 : a ? _(i, s) : i, n = p.length - 1, h; n >= 0; n--)
13
- (h = p[n]) && (l = (a ? h(i, s, l) : h(l)) || l);
14
- return a && l && E(i, s, l), l;
15
- };
16
- const d = class d extends m {
9
+ import { hintSeverity as E } from "../../internal/helpers/hintSeverity.js";
10
+ import { Asterisk as _ } from "../../internal/templates/asterisk.js";
11
+ import { componentStyles as V } from "../../styles/component.styles.js";
12
+ import { LocalizeController as w } from "../../utilities/localize.js";
13
+ import { nothing as u, html as g } from "lit";
14
+ import { property as o, state as x, query as I } from "lit/decorators.js";
15
+ import { ifDefined as h } from "lit/directives/if-defined.js";
16
+ import L from "./textarea.styles.js";
17
+ var A = Object.defineProperty, O = Object.getOwnPropertyDescriptor, s = (r, a, t, i) => {
18
+ for (var l = i > 1 ? void 0 : i ? O(a, t) : a, n = r.length - 1, d; n >= 0; n--)
19
+ (d = r[n]) && (l = (i ? d(a, t, l) : d(l)) || l);
20
+ return i && l && A(a, t, l), l;
21
+ }, p;
22
+ const v = class v extends $ {
17
23
  constructor() {
18
- super(...arguments), this.debug = !1, this.hideLabel = !1, this.readonly = !1, this.showValid = !1, this.size = "md", this.validateOn = "change", this.value = "", this.invalid = !1, this._resetValue = (i) => {
19
- var s;
20
- i.stopPropagation(), this.value = ((s = this.getAttribute("value")) == null ? void 0 : s.trim()) ?? "", this._internals.setFormValue(this.value), this.$input.focus();
24
+ super(...arguments);
25
+ f(this, p);
26
+ b(this, p, new w(this)), this.debug = !1, this.hideLabel = !1, this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.validateOn = "change", this.value = "", this.invalid = !1, this._resetValue = (t) => {
27
+ var i;
28
+ t.stopPropagation(), this.value = ((i = this.getAttribute("value")) == null ? void 0 : i.trim()) ?? "", this._internals.setFormValue(this.value), this.$input.focus();
21
29
  }, this._handleInput = () => {
22
30
  this.value = this.$input.value || "", this.validateOn === "input" && (this.pristine = !1, this.validateInput());
23
31
  };
24
32
  }
25
- set customInvalid(i) {
26
- this.customError = i ?? "";
33
+ set customInvalid(t) {
34
+ this.customError = t ?? "";
27
35
  }
28
36
  get customInvalid() {
29
37
  return this.customError;
@@ -31,58 +39,58 @@ const d = class d extends m {
31
39
  firstUpdated() {
32
40
  this.$input.addEventListener("change", () => {
33
41
  this.validateOn === "change" && (this.validateOn = "input", this.pristine = !1), this._internals.setFormValue(this.$input.value || ""), this.emitEvent("change"), this.validateInput();
34
- }), this.addEventListener("invalid", (i) => {
35
- this.pristine = !1, this.invalid = !0, this.customErrorDisplay && i.preventDefault();
42
+ }), this.addEventListener("invalid", (t) => {
43
+ this.pristine = !1, this.invalid = !0, this.customErrorDisplay && t.preventDefault();
36
44
  }), this.addEventListener("reset", this._resetValue), this.validateInput();
37
45
  }
38
- willUpdate(i) {
39
- if (i.has("invalid"))
46
+ willUpdate(t) {
47
+ if (t.has("invalid"))
40
48
  if (this.invalid) {
41
49
  this.setAttribute("invalid", ""), this.showValid || this.removeAttribute("valid");
42
- const s = this._internals.validationMessage;
43
- this.hint = s !== "" ? this._internals.validationMessage : "unspecified error", this.checkValidity();
50
+ const i = this._internals.validationMessage;
51
+ this.hint = i !== "" ? this._internals.validationMessage : "unspecified error", this.checkValidity();
44
52
  } else
45
53
  this.removeAttribute("invalid"), !this.pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = this.getAttribute("hint") ?? "";
46
54
  }
47
- attributeChangedCallback(i, s, a) {
48
- if (super.attributeChangedCallback(i, s, a), i === "value" && this._internals.setFormValue(a), i === "custom-invalid")
49
- if (typeof a == "string") {
50
- const n = this.withFallback(a);
51
- this.pristine = !1, this._internals.setValidity({ customError: !0 }, n), this.invalid = !0, this.hint = n, this.checkValidity();
55
+ attributeChangedCallback(t, i, l) {
56
+ if (super.attributeChangedCallback(t, i, l), t === "value" && this._internals.setFormValue(l), t === "custom-invalid")
57
+ if (typeof l == "string") {
58
+ const d = this.withFallback(l);
59
+ this.pristine = !1, this._internals.setValidity({ customError: !0 }, d), this.invalid = !0, this.hint = d, this.checkValidity();
52
60
  } else
53
61
  this._internals.setValidity({}), this.validateInput();
54
62
  }
55
63
  /** @internal */
56
64
  validateInput() {
57
65
  if (this._internals.validity.customError) return;
58
- const s = this.$input.validity;
59
- if (this.invalid = !1, s.valid)
66
+ const i = this.$input.validity;
67
+ if (this.invalid = !1, i.valid)
60
68
  this._internals.setValidity({ customError: this._internals.validity.customError });
61
69
  else {
62
- this.invalid = !this.pristine && !s.valid;
63
- let a;
64
- for (a in s) {
65
- const l = `data-${a.toString()}`;
66
- if (s[a] && !this.hasAttribute(l) && this.debug && console.log(
67
- `Add custom message on ${this.localName} using attribute: ${l.toUpperCase()}="Your custom message"`
68
- ), s[a]) {
69
- this.validationError = a.toString();
70
- const n = this.hasAttribute(l) ? this.getAttribute(l) : this.$input.validationMessage;
70
+ this.invalid = !this.pristine && !i.valid;
71
+ let l;
72
+ for (l in i) {
73
+ const n = `data-${l.toString()}`;
74
+ if (i[l] && !this.hasAttribute(n) && this.debug && console.log(
75
+ `Add custom message on ${this.localName} using attribute: ${n.toUpperCase()}="Your custom message"`
76
+ ), i[l]) {
77
+ this.validationError = l.toString();
78
+ const d = this.hasAttribute(n) ? this.getAttribute(n) : this.$input.validationMessage;
71
79
  this._internals.setValidity(
72
80
  { [this.validationError]: !0, customError: this._internals.validity.customError },
73
- this.withFallback(n)
81
+ this.withFallback(d)
74
82
  ), this.invalid && this.customErrorDisplay && this.checkValidity();
75
83
  }
76
84
  }
77
85
  }
78
86
  }
79
87
  render() {
80
- var i, s;
81
- return v`
88
+ var t, i;
89
+ return g`
82
90
  <div id="root">
83
91
  <label>
84
92
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
85
- <slot>${this.label}</slot> ${this.required ? y(this.requiredLabel) : null}
93
+ <slot>${this.label}</slot> ${this.required ? _(y(this, p).term("required")) : u}
86
94
  </div>
87
95
  <div id="input">
88
96
  <textarea
@@ -91,24 +99,25 @@ const d = class d extends m {
91
99
  ?required=${this.required}
92
100
  .value=${this.value}
93
101
  @input=${this._handleInput}
94
- aria-describedby=${o((i = this.hint) != null && i.trim() ? "hint" : u)}
95
- aria-errormessage=${o((s = this.hint) != null && s.trim() ? "hint" : u)}
102
+ aria-describedby=${h((t = this.hint) != null && t.trim() ? "hint" : u)}
103
+ aria-errormessage=${h((i = this.hint) != null && i.trim() ? "hint" : u)}
96
104
  aria-invalid=${!!this.invalid}
97
- cols=${o(this.cols)}
98
- maxlength=${o(this.maxLength)}
99
- minlength=${o(this.minLength)}
100
- name=${o(this.name)}
101
- placeholder=${o(this.placeholder)}
102
- rows=${o(this.rows)}
105
+ cols=${h(this.cols)}
106
+ maxlength=${h(this.maxLength)}
107
+ minlength=${h(this.minLength)}
108
+ name=${h(this.name)}
109
+ placeholder=${h(this.placeholder)}
110
+ rows=${h(this.rows)}
103
111
  >
104
112
  </textarea>
105
113
  </div>
106
114
  </label>
107
- ${this.hint && v`
115
+ ${this.hint && g`
108
116
  <skf-hint
117
+ ?disabled=${this.disabled}
109
118
  aria-live=${this.invalid ? "assertive" : "polite"}
110
119
  id="hint"
111
- severity=${o(c(this.invalid, this.severity))}
120
+ severity=${h(E(this.invalid, this.severity))}
112
121
  >
113
122
  ${this.customInvalid ?? this.hint}
114
123
  </skf-hint>
@@ -117,68 +126,68 @@ const d = class d extends m {
117
126
  `;
118
127
  }
119
128
  };
120
- d.styles = [f, $];
121
- let t = d;
122
- e([
123
- r({ type: Number })
124
- ], t.prototype, "cols", 2);
125
- e([
126
- r({ attribute: "custom-invalid", reflect: !0 })
127
- ], t.prototype, "customInvalid", 1);
128
- e([
129
- r({ type: Boolean })
130
- ], t.prototype, "debug", 2);
131
- e([
132
- r({ type: Boolean, attribute: "hide-label" })
133
- ], t.prototype, "hideLabel", 2);
134
- e([
135
- r()
136
- ], t.prototype, "hint", 2);
137
- e([
138
- r()
139
- ], t.prototype, "label", 2);
140
- e([
141
- r()
142
- ], t.prototype, "name", 2);
143
- e([
144
- r({ type: Number, attribute: "maxlength" })
145
- ], t.prototype, "maxLength", 2);
146
- e([
147
- r({ type: Number, attribute: "minlength" })
148
- ], t.prototype, "minLength", 2);
149
- e([
150
- r()
151
- ], t.prototype, "placeholder", 2);
152
- e([
153
- r({ type: Boolean })
154
- ], t.prototype, "readonly", 2);
155
- e([
156
- r({ attribute: "required-label" })
157
- ], t.prototype, "requiredLabel", 2);
158
- e([
159
- r({ type: Number })
160
- ], t.prototype, "rows", 2);
161
- e([
162
- r()
163
- ], t.prototype, "severity", 2);
164
- e([
165
- r({ type: Boolean, attribute: "show-valid" })
166
- ], t.prototype, "showValid", 2);
167
- e([
168
- r({ reflect: !0 })
169
- ], t.prototype, "size", 2);
170
- e([
171
- r({ attribute: "validate-on" })
172
- ], t.prototype, "validateOn", 2);
173
- e([
174
- r()
175
- ], t.prototype, "value", 2);
176
- e([
177
- b()
178
- ], t.prototype, "invalid", 2);
179
- e([
180
- g("textarea")
181
- ], t.prototype, "$input", 2);
129
+ p = new WeakMap(), v.styles = [V, L];
130
+ let e = v;
131
+ s([
132
+ o({ type: Number })
133
+ ], e.prototype, "cols", 2);
134
+ s([
135
+ o({ attribute: "custom-invalid", reflect: !0 })
136
+ ], e.prototype, "customInvalid", 1);
137
+ s([
138
+ o({ type: Boolean })
139
+ ], e.prototype, "debug", 2);
140
+ s([
141
+ o({ type: Boolean, attribute: "hide-label" })
142
+ ], e.prototype, "hideLabel", 2);
143
+ s([
144
+ o()
145
+ ], e.prototype, "hint", 2);
146
+ s([
147
+ o()
148
+ ], e.prototype, "label", 2);
149
+ s([
150
+ o({ type: String })
151
+ ], e.prototype, "lang", 2);
152
+ s([
153
+ o()
154
+ ], e.prototype, "name", 2);
155
+ s([
156
+ o({ type: Number, attribute: "maxlength" })
157
+ ], e.prototype, "maxLength", 2);
158
+ s([
159
+ o({ type: Number, attribute: "minlength" })
160
+ ], e.prototype, "minLength", 2);
161
+ s([
162
+ o()
163
+ ], e.prototype, "placeholder", 2);
164
+ s([
165
+ o({ type: Boolean })
166
+ ], e.prototype, "readonly", 2);
167
+ s([
168
+ o({ type: Number })
169
+ ], e.prototype, "rows", 2);
170
+ s([
171
+ o()
172
+ ], e.prototype, "severity", 2);
173
+ s([
174
+ o({ type: Boolean, attribute: "show-valid" })
175
+ ], e.prototype, "showValid", 2);
176
+ s([
177
+ o({ reflect: !0 })
178
+ ], e.prototype, "size", 2);
179
+ s([
180
+ o({ attribute: "validate-on" })
181
+ ], e.prototype, "validateOn", 2);
182
+ s([
183
+ o()
184
+ ], e.prototype, "value", 2);
185
+ s([
186
+ x()
187
+ ], e.prototype, "invalid", 2);
188
+ s([
189
+ I("textarea")
190
+ ], e.prototype, "$input", 2);
182
191
  export {
183
- t as SkfTextArea
192
+ e as SkfTextArea
184
193
  };
@@ -1,18 +1,21 @@
1
1
  import { css as o } from "lit";
2
- const a = o`
2
+ const e = o`
3
3
  @layer components {
4
- :host {
5
- overflow: hidden; /* Enable mask transition */
6
- padding-block-end: 3px; /* Make room for box-shadow */
7
- }
4
+ @layer overrides {
5
+ :host {
6
+ overflow: hidden; /* Enable mask transition */
7
+ padding-block-end: 3px; /* Make room for box-shadow */
8
+ }
9
+
10
+ #root {
11
+ --_skf-alert-bg-color: var(--skf-bg-color-neutral-1);
8
12
 
9
- .toast-item {
10
- background-color: var(--skf-bg-color-neutral-1);
11
- border-inline-start: var(--skf-size-8) solid
12
- var(--_skf-alert-border-color, var(--skf-border-color-primary));
13
+ /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
14
+ border-inline-start: var(--skf-size-8) solid var(--_skf-alert-border-color);
15
+ }
13
16
  }
14
17
  }
15
18
  `;
16
19
  export {
17
- a as default
20
+ e as default
18
21
  };
@@ -1,25 +1,25 @@
1
1
  import { SkfElement as l } from "../../internal/components/skf-element.js";
2
2
  import { html as f } from "lit";
3
- import { property as i, queryAssignedNodes as d } from "lit/decorators.js";
4
- import { SkfToastSingleton as y } from "./toast.singleton.js";
3
+ import { property as i, queryAssignedNodes as y } from "lit/decorators.js";
4
+ import { SkfToastSingleton as d } from "./toast.singleton.js";
5
5
  import { styles as a } from "./toast.styles.js";
6
- var u = Object.defineProperty, e = (n, o, h, g) => {
7
- for (var s = void 0, r = n.length - 1, m; r >= 0; r--)
8
- (m = n[r]) && (s = m(o, h, s) || s);
9
- return s && u(o, h, s), s;
6
+ var u = Object.defineProperty, e = (n, r, m, g) => {
7
+ for (var s = void 0, o = n.length - 1, h; o >= 0; o--)
8
+ (h = n[o]) && (s = h(r, m, s) || s);
9
+ return s && u(r, m, s), s;
10
10
  };
11
11
  const p = class p extends l {
12
12
  constructor() {
13
13
  super(), this.debug = !1, this.persistent = !1, this.severity = "info", this.timer = 5, this._singleton = void 0;
14
14
  }
15
15
  firstUpdated() {
16
- this._singleton = new y(this.getRootNode()), this._singleton.addData({
16
+ this._singleton = new d(), this._singleton.addData({
17
17
  debug: this.debug,
18
18
  icon: this.icon,
19
19
  originEl: this,
20
20
  persistent: this.persistent,
21
21
  severity: this.severity,
22
- text: this._slottedText.map((o) => o.textContent).join(),
22
+ text: this._slottedText.map((r) => r.textContent).join(),
23
23
  timer: this.timer = this.timer && this.timer < 5 ? 5 : this.timer,
24
24
  topOffset: this.topOffset
25
25
  });
@@ -49,7 +49,7 @@ e([
49
49
  i({ type: Number })
50
50
  ], t.prototype, "topOffset");
51
51
  e([
52
- d()
52
+ y()
53
53
  ], t.prototype, "_slottedText");
54
54
  export {
55
55
  t as SkfToast
@@ -10,7 +10,7 @@ export declare class SkfToastSingleton {
10
10
  data: ToastData[];
11
11
  root: Document;
12
12
  usePopover: boolean;
13
- constructor(root: Document);
13
+ constructor();
14
14
  hasToasts(): boolean;
15
15
  popToast(): ToastData | undefined;
16
16
  getData(): ToastData[];
@@ -1,8 +1,8 @@
1
1
  import "./toast-item.js";
2
2
  import "./toast-wrapper.js";
3
3
  class s {
4
- constructor(e) {
5
- if (this.data = [], this.root = e, this.usePopover = !0, this.root.nodeType !== Node.DOCUMENT_NODE)
4
+ constructor() {
5
+ if (this.data = [], this.root = globalThis.document, this.usePopover = !0, this.root.nodeType !== Node.DOCUMENT_NODE)
6
6
  throw new Error("Root node must be a document node");
7
7
  return s.instance || (s.instance = this), s.instance;
8
8
  }
@@ -15,31 +15,31 @@ class s {
15
15
  getData() {
16
16
  return this.data;
17
17
  }
18
- setData(e) {
19
- this.data = e;
18
+ setData(o) {
19
+ this.data = o;
20
20
  }
21
- addData(e) {
22
- this.data = [...this.data, e], this.udpateUI();
21
+ addData(o) {
22
+ this.data = [...this.data, o], this.udpateUI();
23
23
  }
24
24
  udpateUI() {
25
- const e = c(this.root, this.usePopover);
26
- this.usePopover && e.showPopover(), u();
25
+ const o = c(this.root, this.usePopover);
26
+ this.usePopover && o.showPopover(), u();
27
27
  function u() {
28
- const n = new s(document);
29
- for (; n.hasToasts(); ) {
30
- const t = n.popToast();
28
+ const i = new s();
29
+ for (; i.hasToasts(); ) {
30
+ const t = i.popToast();
31
31
  if (!t) return;
32
- t.debug && (e.debug = !0);
33
- const o = document.createElement("skf-toast-item");
34
- o.className = "toast-item", o.timer = t.timer, o.severity = t.severity, o.icon = t.icon, t.persistent && o.setAttribute("persistent", "true"), o.originEl = t.originEl, o.innerText = String(t.text);
32
+ t.debug && (o.debug = !0);
33
+ const e = document.createElement("skf-toast-item");
34
+ e.className = "toast-item", e.timer = t.timer, e.severity = t.severity, e.icon = t.icon, t.persistent && e.setAttribute("persistent", "true"), e.originEl = t.originEl, e.innerText = String(t.text);
35
35
  const a = document.createElement("div");
36
- a.classList.add("toast-item-wrapper"), a.appendChild(o), e.prepend(a);
36
+ a.classList.add("toast-item-wrapper"), a.appendChild(e), o.prepend(a);
37
37
  }
38
38
  }
39
- function c(n, t) {
39
+ function c(i, t) {
40
40
  var p;
41
- const a = ((p = new s(document).getData()[0]) == null ? void 0 : p.topOffset) ?? null, i = n.querySelector("body");
42
- let r = i == null ? void 0 : i.querySelector("skf-toast-wrapper");
41
+ const a = ((p = new s().getData()[0]) == null ? void 0 : p.topOffset) ?? null, n = i.querySelector("body");
42
+ let r = n == null ? void 0 : n.querySelector("skf-toast-wrapper");
43
43
  if (!r) {
44
44
  if (r = document.createElement("skf-toast-wrapper"), !r) throw new Error("Could not create toast wrapper element");
45
45
  t && r.setAttribute("popover", "auto"), a && r.setAttribute("top-offset", a.toString()), document.body.appendChild(r);