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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +18 -0
  2. package/dist/components/alert/alert.component.d.ts +3 -2
  3. package/dist/components/alert/alert.component.js +39 -33
  4. package/dist/components/breadcrumb/breadcrumb-item.component.js +11 -12
  5. package/dist/components/button/button.component.js +32 -36
  6. package/dist/components/button/button.styles.js +3 -3
  7. package/dist/components/checkbox/checkbox.component.d.ts +6 -5
  8. package/dist/components/checkbox/checkbox.component.js +67 -69
  9. package/dist/components/checkbox/checkbox.styles.js +1 -1
  10. package/dist/components/datepicker/datepicker-calendar.component.d.ts +1 -0
  11. package/dist/components/datepicker/datepicker-calendar.component.js +107 -116
  12. package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
  13. package/dist/components/datepicker/datepicker-popup.component.js +112 -100
  14. package/dist/components/datepicker/datepicker-popup.helpers.js +1 -1
  15. package/dist/components/datepicker/datepicker.component.d.ts +4 -2
  16. package/dist/components/datepicker/datepicker.component.js +159 -160
  17. package/dist/components/dialog/dialog.component.d.ts +3 -2
  18. package/dist/components/dialog/dialog.component.js +48 -48
  19. package/dist/components/divider/divider.component.d.ts +3 -0
  20. package/dist/components/divider/divider.component.js +43 -22
  21. package/dist/components/divider/divider.styles.js +9 -9
  22. package/dist/components/drawer/drawer.component.d.ts +12 -4
  23. package/dist/components/drawer/drawer.component.js +84 -61
  24. package/dist/components/drawer/drawer.styles.js +47 -40
  25. package/dist/components/header/header.component.d.ts +4 -2
  26. package/dist/components/header/header.component.js +64 -57
  27. package/dist/components/header/header.styles.js +2 -2
  28. package/dist/components/icon/icon.component.js +26 -16
  29. package/dist/components/icon/icon.styles.js +4 -4
  30. package/dist/components/input/input.component.d.ts +11 -10
  31. package/dist/components/input/input.component.js +115 -111
  32. package/dist/components/input/input.controllers.d.ts +0 -1
  33. package/dist/components/input/input.controllers.js +14 -19
  34. package/dist/components/link/link.component.d.ts +1 -0
  35. package/dist/components/link/link.component.js +86 -74
  36. package/dist/components/link/link.styles.js +7 -3
  37. package/dist/components/loader/loader.component.d.ts +0 -2
  38. package/dist/components/loader/loader.component.js +27 -30
  39. package/dist/components/loader/loader.styles.js +1 -1
  40. package/dist/components/menu/menu-item.styles.js +8 -7
  41. package/dist/components/menu/menu.component.d.ts +5 -2
  42. package/dist/components/menu/menu.component.js +8 -8
  43. package/dist/components/nav/nav.component.d.ts +3 -0
  44. package/dist/components/nav/nav.component.js +38 -33
  45. package/dist/components/popover/popover.component.d.ts +6 -7
  46. package/dist/components/popover/popover.component.js +23 -31
  47. package/dist/components/progress/progress.styles.js +3 -3
  48. package/dist/components/radio/radio.component.d.ts +4 -2
  49. package/dist/components/radio/radio.component.js +96 -91
  50. package/dist/components/radio/radio.styles.js +1 -1
  51. package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
  52. package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
  53. package/dist/components/segmented-button/segmented-button.component.js +22 -24
  54. package/dist/components/select/select-option.component.d.ts +2 -1
  55. package/dist/components/select/select-option.component.js +31 -36
  56. package/dist/components/select/select.component.d.ts +20 -10
  57. package/dist/components/select/select.component.js +139 -104
  58. package/dist/components/select/select.controllers.js +22 -20
  59. package/dist/components/select/select.styles.js +8 -2
  60. package/dist/components/stepper/stepper-item.component.d.ts +1 -1
  61. package/dist/components/stepper/stepper-item.component.js +26 -23
  62. package/dist/components/stepper/stepper-item.styles.js +4 -4
  63. package/dist/components/stepper/stepper.component.js +2 -3
  64. package/dist/components/stepper/stepper.helpers.js +6 -7
  65. package/dist/components/switch/switch.component.d.ts +4 -2
  66. package/dist/components/switch/switch.component.js +64 -58
  67. package/dist/components/switch/switch.styles.js +1 -1
  68. package/dist/components/tabs/tab-panel.component.d.ts +1 -1
  69. package/dist/components/tabs/tab-panel.component.js +19 -16
  70. package/dist/components/tabs/tab.component.d.ts +1 -1
  71. package/dist/components/tabs/tab.component.js +17 -14
  72. package/dist/components/tabs/tab.styles.js +2 -2
  73. package/dist/components/tabs/tabs.component.js +6 -6
  74. package/dist/components/tag/tag.component.d.ts +9 -6
  75. package/dist/components/tag/tag.component.js +78 -72
  76. package/dist/components/tag/tag.styles.js +5 -0
  77. package/dist/components/textarea/textarea.component.d.ts +4 -2
  78. package/dist/components/textarea/textarea.component.js +101 -95
  79. package/dist/components/toast/toast-item.styles.js +13 -10
  80. package/dist/components/toast/toast.singleton.js +6 -7
  81. package/dist/components/tooltip/tooltip.component.d.ts +7 -4
  82. package/dist/components/tooltip/tooltip.component.js +22 -14
  83. package/dist/custom-elements.json +835 -422
  84. package/dist/index.d.ts +2 -2
  85. package/dist/index.js +20 -20
  86. package/dist/internal/base-classes/popover/popover.base.d.ts +29 -9
  87. package/dist/internal/base-classes/popover/popover.base.js +79 -76
  88. package/dist/internal/components/formBase.d.ts +1 -0
  89. package/dist/internal/components/formBase.js +11 -19
  90. package/dist/internal/controllers/popover.controller.d.ts +2 -0
  91. package/dist/internal/controllers/popover.controller.js +11 -14
  92. package/dist/internal/helpers/stateMap.js +3 -3
  93. package/dist/internal/helpers/uuid.d.ts +8 -10
  94. package/dist/internal/helpers/uuid.js +4 -11
  95. package/dist/internal/helpers/watch.d.ts +1 -1
  96. package/dist/internal/templates/asterisk.d.ts +1 -1
  97. package/dist/internal/templates/asterisk.js +4 -4
  98. package/dist/internal/types.d.ts +4 -0
  99. package/dist/styles/global-alt.css +1 -1
  100. package/dist/styles/global.css +1 -1
  101. package/dist/translations/en.d.ts +3 -0
  102. package/dist/translations/en.js +27 -0
  103. package/dist/translations/es.d.ts +3 -0
  104. package/dist/translations/es.js +27 -0
  105. package/dist/translations/index.d.ts +4 -0
  106. package/dist/translations/pt.d.ts +3 -0
  107. package/dist/translations/pt.js +27 -0
  108. package/dist/translations/sv.d.ts +3 -0
  109. package/dist/translations/sv.js +27 -0
  110. package/dist/types/jsx/custom-element-jsx.d.ts +1840 -858
  111. package/dist/types/vue/index.d.ts +69 -64
  112. package/dist/utilities/localize.d.ts +28 -0
  113. package/dist/utilities/localize.js +13 -0
  114. package/dist/vscode.html-custom-data.json +75 -83
  115. package/dist/web-types.json +229 -190
  116. package/package.json +29 -35
  117. package/custom-elements.json +0 -25490
@@ -1,52 +1,57 @@
1
- var y = (e) => {
2
- throw TypeError(e);
1
+ var f = (t) => {
2
+ throw TypeError(t);
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 u = (t, o, e) => o.has(t) || f("Cannot " + e);
5
+ var p = (t, o, e) => (u(t, o, "read from private field"), e ? e.call(t) : o.get(t)), m = (t, o, e) => o.has(t) ? f("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(t) : o.set(t, e), k = (t, o, e, s) => (u(t, o, "write to private field"), s ? s.call(t, e) : o.set(t, e), e);
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 z } from "../../styles/component.styles.js";
11
+ import { LocalizeController as R } from "../../utilities/localize.js";
12
+ import { nothing as y, html as v } from "lit";
13
+ import { property as h, 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, l = (t, o, e, s) => {
17
+ for (var i = s > 1 ? void 0 : s ? B(o, e) : o, d = t.length - 1, b; d >= 0; d--)
18
+ (b = t[d]) && (i = (s ? b(o, e, i) : b(i)) || i);
19
+ return s && i && S(o, e, 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 n, a, c;
26
+ const C = class C extends g {
26
27
  constructor() {
27
28
  super(...arguments);
28
- d(this, a);
29
- 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
- (t.key === "Enter" || t.key === " ") && this.$removeButton.click();
32
- }, this._handleRemove = (t) => {
33
- this._onRemove && this._onRemove(t);
34
- }, this._handleClick = (t) => {
35
- var l;
36
- t.stopPropagation(), t.composedPath()[0].localName === "button" ? this.remove() : (l = this.onClick) == null || l.call(this, t);
29
+ m(this, n);
30
+ m(this, a);
31
+ m(this, c);
32
+ k(this, n, new R(this)), k(this, a, this.attachInternals()), k(this, c, p(this, a).states), this.size = "md", this.lang = "en", this.removable = !1, this._handleKeyDown = (e) => {
33
+ (e.key === "Enter" || e.key === " ") && this.$removeButton.click();
34
+ }, this._handleRemove = (e) => {
35
+ this._preRemoveCallback && this._preRemoveCallback(e);
36
+ }, this._handleClick = (e) => {
37
+ e.stopPropagation(), e.composedPath()[0].localName === "button" ? this.remove() : this.clickCallback?.(e);
37
38
  };
38
39
  }
39
- set onClick(t) {
40
- t && (this._onClick = t);
40
+ /** If defined, accepts a function that runs on click */
41
+ // @property({ attribute: false })
42
+ set clickCallback(e) {
43
+ e && (this._clickCallback = e);
41
44
  }
42
- get onClick() {
43
- return this._onClick;
45
+ get clickCallback() {
46
+ return this._clickCallback;
44
47
  }
45
- set onRemove(t) {
46
- t && (this._onRemove = t);
48
+ /** If defined, accepts a function that runs on click. Self removal can be overridden by using `event.stopPropagation()`. */
49
+ // @property({ attribute: false })
50
+ set preRemoveCallback(e) {
51
+ e && (this._preRemoveCallback = e);
47
52
  }
48
- get onRemove() {
49
- return this._onRemove;
53
+ get preRemoveCallback() {
54
+ return this._preRemoveCallback;
50
55
  }
51
56
  connectedCallback() {
52
57
  super.connectedCallback(), this.addEventListener("click", this._handleClick);
@@ -54,52 +59,53 @@ const u = class u extends _ {
54
59
  disconnectedCallback() {
55
60
  super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
56
61
  }
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);
62
+ attributeChangedCallback(e, s, i) {
63
+ super.attributeChangedCallback(e, s, i), e === "removable" && i !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
59
64
  }
60
- _handleStateChange(t, i, s) {
61
- g(m(this, h), b[t]).set(s);
65
+ _handleStateChange(e, s, i) {
66
+ w(p(this, c), _[e]).set(i);
62
67
  }
63
68
  render() {
64
- return f`
69
+ return v`
65
70
  <div id="root">
66
- ${this.icon ? f`<skf-icon color=${D(this.color)} name=${this.icon} size="sm"></skf-icon>` : C}
71
+ ${this.icon ? v`<skf-icon color=${E(this.color)} name=${this.icon} size="sm"></skf-icon>` : y}
67
72
  <slot></slot>
68
- ${this.removable ? f`
69
- <button @click=${this._handleRemove} type="button">
73
+ ${this.removable ? v`
74
+ <button
75
+ @click=${this._handleRemove}
76
+ aria-label=${p(this, n).term("close")}
77
+ type="button"
78
+ >
70
79
  <skf-icon name="close" size="xs"></skf-icon>
71
80
  </button>
72
- ` : C}
81
+ ` : y}
73
82
  </div>
74
83
  `;
75
84
  }
76
85
  };
77
- a = new WeakMap(), h = new WeakMap(), u.styles = [$, E];
78
- let n = u;
79
- r([
80
- c({ type: String })
81
- ], n.prototype, "size", 2);
82
- r([
83
- c({ type: String })
84
- ], n.prototype, "icon", 2);
85
- r([
86
- c({ type: String })
87
- ], n.prototype, "color", 2);
88
- r([
89
- c({ attribute: !1 })
90
- ], n.prototype, "onClick", 1);
91
- r([
92
- c({ attribute: !1 })
93
- ], n.prototype, "onRemove", 1);
94
- r([
95
- c({ type: Boolean })
96
- ], n.prototype, "removable", 2);
97
- r([
98
- R("button")
99
- ], n.prototype, "$removeButton", 2);
100
- r([
101
- w(Object.keys(b))
102
- ], n.prototype, "_handleStateChange", 1);
86
+ n = new WeakMap(), a = new WeakMap(), c = new WeakMap(), C.styles = [z, P];
87
+ let r = C;
88
+ l([
89
+ h({ type: String })
90
+ ], r.prototype, "size", 2);
91
+ l([
92
+ h({ type: String })
93
+ ], r.prototype, "icon", 2);
94
+ l([
95
+ h({ type: String })
96
+ ], r.prototype, "color", 2);
97
+ l([
98
+ h({ type: String })
99
+ ], r.prototype, "lang", 2);
100
+ l([
101
+ h({ type: Boolean })
102
+ ], r.prototype, "removable", 2);
103
+ l([
104
+ D("button")
105
+ ], r.prototype, "$removeButton", 2);
106
+ l([
107
+ $(Object.keys(_))
108
+ ], r.prototype, "_handleStateChange", 1);
103
109
  export {
104
- n as SkfTag
110
+ r as SkfTag
105
111
  };
@@ -41,6 +41,11 @@ const s = r`
41
41
  border-radius: var(--skf-border-radius-sm);
42
42
  outline: var(--skf-border-width-md) solid var(--skf-interactive-border-color-focus);
43
43
  }
44
+
45
+ /* let button be first item in composedPath array */
46
+ & > * {
47
+ pointer-events: none;
48
+ }
44
49
  }
45
50
  }
46
51
 
@@ -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,36 @@
1
+ var m = (s) => {
2
+ throw TypeError(s);
3
+ };
4
+ var c = (s, r, t) => r.has(s) || m("Cannot " + t);
5
+ var y = (s, r, t) => (c(s, r, "read from private field"), t ? t.call(s) : r.get(s)), f = (s, r, t) => r.has(s) ? m("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(s) : r.set(s, t), b = (s, r, t, o) => (c(s, r, "write to private field"), o ? o.call(s, t) : r.set(s, 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 b } from "../../styles/component.styles.js";
7
- import { nothing as u, html as v } from "lit";
8
- import { property as r, state as f, 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 l, 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, e = (s, r, t, o) => {
18
+ for (var a = o > 1 ? void 0 : o ? O(r, t) : r, n = s.length - 1, d; n >= 0; n--)
19
+ (d = s[n]) && (a = (o ? d(r, t, a) : d(a)) || a);
20
+ return o && a && A(r, t, a), a;
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
+ t.stopPropagation(), this.value = this.getAttribute("value")?.trim() ?? "", this._internals.setFormValue(this.value), this.$input.focus();
21
28
  }, this._handleInput = () => {
22
29
  this.value = this.$input.value || "", this.validateOn === "input" && (this.pristine = !1, this.validateInput());
23
30
  };
24
31
  }
25
- set customInvalid(i) {
26
- this.customError = i ?? "";
32
+ set customInvalid(t) {
33
+ this.customError = t ?? "";
27
34
  }
28
35
  get customInvalid() {
29
36
  return this.customError;
@@ -31,58 +38,57 @@ const d = class d extends m {
31
38
  firstUpdated() {
32
39
  this.$input.addEventListener("change", () => {
33
40
  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();
41
+ }), this.addEventListener("invalid", (t) => {
42
+ this.pristine = !1, this.invalid = !0, this.customErrorDisplay && t.preventDefault();
36
43
  }), this.addEventListener("reset", this._resetValue), this.validateInput();
37
44
  }
38
- willUpdate(i) {
39
- if (i.has("invalid"))
45
+ willUpdate(t) {
46
+ if (t.has("invalid"))
40
47
  if (this.invalid) {
41
48
  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();
49
+ const o = this._internals.validationMessage;
50
+ this.hint = o !== "" ? this._internals.validationMessage : "unspecified error", this.checkValidity();
44
51
  } else
45
52
  this.removeAttribute("invalid"), !this.pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = this.getAttribute("hint") ?? "";
46
53
  }
47
- attributeChangedCallback(i, s, a) {
48
- if (super.attributeChangedCallback(i, s, a), i === "value" && this._internals.setFormValue(a), i === "custom-invalid")
54
+ attributeChangedCallback(t, o, a) {
55
+ if (super.attributeChangedCallback(t, o, a), t === "value" && this._internals.setFormValue(a), t === "custom-invalid")
49
56
  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();
57
+ const d = this.withFallback(a);
58
+ this.pristine = !1, this._internals.setValidity({ customError: !0 }, d), this.invalid = !0, this.hint = d, this.checkValidity();
52
59
  } else
53
60
  this._internals.setValidity({}), this.validateInput();
54
61
  }
55
62
  /** @internal */
56
63
  validateInput() {
57
64
  if (this._internals.validity.customError) return;
58
- const s = this.$input.validity;
59
- if (this.invalid = !1, s.valid)
65
+ const o = this.$input.validity;
66
+ if (this.invalid = !1, o.valid)
60
67
  this._internals.setValidity({ customError: this._internals.validity.customError });
61
68
  else {
62
- this.invalid = !this.pristine && !s.valid;
69
+ this.invalid = !this.pristine && !o.valid;
63
70
  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]) {
71
+ for (a in o) {
72
+ const n = `data-${a.toString()}`;
73
+ if (o[a] && !this.hasAttribute(n) && this.debug && console.log(
74
+ `Add custom message on ${this.localName} using attribute: ${n.toUpperCase()}="Your custom message"`
75
+ ), o[a]) {
69
76
  this.validationError = a.toString();
70
- const n = this.hasAttribute(l) ? this.getAttribute(l) : this.$input.validationMessage;
77
+ const d = this.hasAttribute(n) ? this.getAttribute(n) : this.$input.validationMessage;
71
78
  this._internals.setValidity(
72
79
  { [this.validationError]: !0, customError: this._internals.validity.customError },
73
- this.withFallback(n)
80
+ this.withFallback(d)
74
81
  ), this.invalid && this.customErrorDisplay && this.checkValidity();
75
82
  }
76
83
  }
77
84
  }
78
85
  }
79
86
  render() {
80
- var i, s;
81
- return v`
87
+ return g`
82
88
  <div id="root">
83
89
  <label>
84
90
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
85
- <slot>${this.label}</slot> ${this.required ? y(this.requiredLabel) : null}
91
+ <slot>${this.label}</slot> ${this.required ? _(y(this, p).term("required")) : u}
86
92
  </div>
87
93
  <div id="input">
88
94
  <textarea
@@ -91,25 +97,25 @@ const d = class d extends m {
91
97
  ?required=${this.required}
92
98
  .value=${this.value}
93
99
  @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)}
100
+ aria-describedby=${h(this.hint?.trim() ? "hint" : u)}
101
+ aria-errormessage=${h(this.hint?.trim() ? "hint" : u)}
96
102
  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)}
103
+ cols=${h(this.cols)}
104
+ maxlength=${h(this.maxLength)}
105
+ minlength=${h(this.minLength)}
106
+ name=${h(this.name)}
107
+ placeholder=${h(this.placeholder)}
108
+ rows=${h(this.rows)}
103
109
  >
104
110
  </textarea>
105
111
  </div>
106
112
  </label>
107
- ${this.hint && v`
113
+ ${this.hint && g`
108
114
  <skf-hint
109
115
  ?disabled=${this.disabled}
110
116
  aria-live=${this.invalid ? "assertive" : "polite"}
111
117
  id="hint"
112
- severity=${o(c(this.invalid, this.severity))}
118
+ severity=${h(E(this.invalid, this.severity))}
113
119
  >
114
120
  ${this.customInvalid ?? this.hint}
115
121
  </skf-hint>
@@ -118,68 +124,68 @@ const d = class d extends m {
118
124
  `;
119
125
  }
120
126
  };
121
- d.styles = [b, $];
122
- let t = d;
127
+ p = new WeakMap(), v.styles = [V, L];
128
+ let i = v;
123
129
  e([
124
- r({ type: Number })
125
- ], t.prototype, "cols", 2);
130
+ l({ type: Number })
131
+ ], i.prototype, "cols", 2);
126
132
  e([
127
- r({ attribute: "custom-invalid", reflect: !0 })
128
- ], t.prototype, "customInvalid", 1);
133
+ l({ attribute: "custom-invalid", reflect: !0 })
134
+ ], i.prototype, "customInvalid", 1);
129
135
  e([
130
- r({ type: Boolean })
131
- ], t.prototype, "debug", 2);
136
+ l({ type: Boolean })
137
+ ], i.prototype, "debug", 2);
132
138
  e([
133
- r({ type: Boolean, attribute: "hide-label" })
134
- ], t.prototype, "hideLabel", 2);
139
+ l({ type: Boolean, attribute: "hide-label" })
140
+ ], i.prototype, "hideLabel", 2);
135
141
  e([
136
- r()
137
- ], t.prototype, "hint", 2);
142
+ l()
143
+ ], i.prototype, "hint", 2);
138
144
  e([
139
- r()
140
- ], t.prototype, "label", 2);
145
+ l()
146
+ ], i.prototype, "label", 2);
141
147
  e([
142
- r()
143
- ], t.prototype, "name", 2);
148
+ l({ type: String })
149
+ ], i.prototype, "lang", 2);
144
150
  e([
145
- r({ type: Number, attribute: "maxlength" })
146
- ], t.prototype, "maxLength", 2);
151
+ l()
152
+ ], i.prototype, "name", 2);
147
153
  e([
148
- r({ type: Number, attribute: "minlength" })
149
- ], t.prototype, "minLength", 2);
154
+ l({ type: Number, attribute: "maxlength" })
155
+ ], i.prototype, "maxLength", 2);
150
156
  e([
151
- r()
152
- ], t.prototype, "placeholder", 2);
157
+ l({ type: Number, attribute: "minlength" })
158
+ ], i.prototype, "minLength", 2);
153
159
  e([
154
- r({ type: Boolean })
155
- ], t.prototype, "readonly", 2);
160
+ l()
161
+ ], i.prototype, "placeholder", 2);
156
162
  e([
157
- r({ attribute: "required-label" })
158
- ], t.prototype, "requiredLabel", 2);
163
+ l({ type: Boolean })
164
+ ], i.prototype, "readonly", 2);
159
165
  e([
160
- r({ type: Number })
161
- ], t.prototype, "rows", 2);
166
+ l({ type: Number })
167
+ ], i.prototype, "rows", 2);
162
168
  e([
163
- r()
164
- ], t.prototype, "severity", 2);
169
+ l()
170
+ ], i.prototype, "severity", 2);
165
171
  e([
166
- r({ type: Boolean, attribute: "show-valid" })
167
- ], t.prototype, "showValid", 2);
172
+ l({ type: Boolean, attribute: "show-valid" })
173
+ ], i.prototype, "showValid", 2);
168
174
  e([
169
- r({ reflect: !0 })
170
- ], t.prototype, "size", 2);
175
+ l({ reflect: !0 })
176
+ ], i.prototype, "size", 2);
171
177
  e([
172
- r({ attribute: "validate-on" })
173
- ], t.prototype, "validateOn", 2);
178
+ l({ attribute: "validate-on" })
179
+ ], i.prototype, "validateOn", 2);
174
180
  e([
175
- r()
176
- ], t.prototype, "value", 2);
181
+ l()
182
+ ], i.prototype, "value", 2);
177
183
  e([
178
- f()
179
- ], t.prototype, "invalid", 2);
184
+ x()
185
+ ], i.prototype, "invalid", 2);
180
186
  e([
181
- g("textarea")
182
- ], t.prototype, "$input", 2);
187
+ I("textarea")
188
+ ], i.prototype, "$input", 2);
183
189
  export {
184
- t as SkfTextArea
190
+ i as SkfTextArea
185
191
  };
@@ -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
  };
@@ -22,9 +22,9 @@ class s {
22
22
  this.data = [...this.data, o], this.udpateUI();
23
23
  }
24
24
  udpateUI() {
25
- const o = c(this.root, this.usePopover);
26
- this.usePopover && o.showPopover(), u();
27
- function u() {
25
+ const o = p(this.root, this.usePopover);
26
+ this.usePopover && o.showPopover(), n();
27
+ function n() {
28
28
  const i = new s();
29
29
  for (; i.hasToasts(); ) {
30
30
  const t = i.popToast();
@@ -36,10 +36,9 @@ class s {
36
36
  a.classList.add("toast-item-wrapper"), a.appendChild(e), o.prepend(a);
37
37
  }
38
38
  }
39
- function c(i, t) {
40
- var p;
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");
39
+ function p(i, t) {
40
+ const a = new s().getData()[0]?.topOffset ?? null;
41
+ let r = i.querySelector("body")?.querySelector("skf-toast-wrapper");
43
42
  if (!r) {
44
43
  if (r = document.createElement("skf-toast-wrapper"), !r) throw new Error("Could not create toast wrapper element");
45
44
  t && r.setAttribute("popover", "auto"), a && r.setAttribute("top-offset", a.toString()), document.body.appendChild(r);
@@ -8,8 +8,11 @@ import type { CSSResultGroup } from 'lit';
8
8
  * @attribute {"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end"} [placement='bottom-start'] - The placement of the dropdown
9
9
  * @attribute {string} [anchor] - The id of the element the dropdown will be anchored to
10
10
  *
11
- * @event skf-opened - Fired when the dropdown is opened
12
- * @event skf-closed - Fired when the dropdown is closed
11
+ * @property {(void) => void} open() - Method that opens the tooltip
12
+ * @property {(void) => void} close() - Method that closes the tooltip
13
+ *
14
+ * @event {CustomEvent} skf-opened - Fired when the tooltip is opened
15
+ * @event {CustomEvent} skf-closed - Fired when the tooltip is closed
13
16
  *
14
17
  * @slot - The tooltip popover content
15
18
  *
@@ -18,7 +21,7 @@ import type { CSSResultGroup } from 'lit';
18
21
  export declare class SkfTooltip extends SkfPopoverBase {
19
22
  static styles: CSSResultGroup;
20
23
  constructor();
21
- openExtended(): void;
22
- closeExtended(): void;
24
+ connectedCallback(): void;
25
+ /** @internal */
23
26
  addEventListeners($element: HTMLElement | Element): void;
24
27
  }