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

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 (204) hide show
  1. package/dist/components/accordion/accordion-item.d.ts +1 -1
  2. package/dist/components/accordion/accordion.component.d.ts +4 -4
  3. package/dist/components/accordion/accordion.component.js +18 -17
  4. package/dist/components/accordion/accordion.styles.d.ts +1 -2
  5. package/dist/components/accordion/accordion.styles.js +5 -4
  6. package/dist/components/alert/alert.component.d.ts +5 -5
  7. package/dist/components/alert/alert.component.js +46 -35
  8. package/dist/components/alert/alert.styles.d.ts +1 -2
  9. package/dist/components/alert/alert.styles.js +29 -24
  10. package/dist/components/breadcrumb/breadcrumb.component.d.ts +29 -0
  11. package/dist/components/breadcrumb/breadcrumb.d.ts +8 -0
  12. package/dist/components/breadcrumb-item/breadcrumb-item.component.d.ts +25 -0
  13. package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +8 -0
  14. package/dist/components/button/button.component.d.ts +29 -5
  15. package/dist/components/button/button.component.js +89 -52
  16. package/dist/components/button/button.styles.js +65 -45
  17. package/dist/components/card/card.component.d.ts +4 -4
  18. package/dist/components/card/card.component.js +35 -24
  19. package/dist/components/card/card.styles.d.ts +1 -2
  20. package/dist/components/card/card.styles.js +14 -12
  21. package/dist/components/checkbox/checkbox.component.d.ts +11 -12
  22. package/dist/components/checkbox/checkbox.component.js +96 -90
  23. package/dist/components/collapse/collapse.component.d.ts +8 -8
  24. package/dist/components/collapse/collapse.component.js +42 -34
  25. package/dist/components/collapse/collapse.styles.js +15 -14
  26. package/dist/components/dialog/dialog.component.d.ts +74 -0
  27. package/dist/components/dialog/dialog.component.js +187 -0
  28. package/dist/components/dialog/dialog.d.ts +8 -0
  29. package/dist/components/dialog/dialog.js +6 -0
  30. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  31. package/dist/components/dialog/dialog.styles.js +91 -0
  32. package/dist/components/divider/divider.component.d.ts +3 -3
  33. package/dist/components/divider/divider.component.js +39 -27
  34. package/dist/components/divider/divider.styles.d.ts +1 -2
  35. package/dist/components/divider/divider.styles.js +26 -26
  36. package/dist/components/heading/heading.component.d.ts +2 -2
  37. package/dist/components/heading/heading.component.js +13 -13
  38. package/dist/components/icon/icon.component.d.ts +2 -5
  39. package/dist/components/icon/icon.component.js +32 -23
  40. package/dist/components/icon/icon.styles.js +53 -47
  41. package/dist/components/input/input.component.d.ts +12 -11
  42. package/dist/components/input/input.component.js +88 -89
  43. package/dist/components/link/link.component.d.ts +7 -6
  44. package/dist/components/link/link.component.js +49 -43
  45. package/dist/components/link/link.styles.js +36 -40
  46. package/dist/components/loader/loader.component.d.ts +2 -2
  47. package/dist/components/loader/loader.component.js +39 -32
  48. package/dist/components/loader/loader.styles.js +11 -10
  49. package/dist/components/logo/logo.component.d.ts +3 -3
  50. package/dist/components/logo/logo.component.js +28 -17
  51. package/dist/components/logo/logo.styles.d.ts +1 -2
  52. package/dist/components/logo/logo.styles.js +11 -9
  53. package/dist/components/menu/menu.component.d.ts +24 -0
  54. package/dist/components/menu/menu.component.js +18 -0
  55. package/dist/components/menu/menu.d.ts +8 -0
  56. package/dist/components/menu/menu.js +6 -0
  57. package/dist/components/menu/menu.styles.d.ts +1 -0
  58. package/dist/components/menu/menu.styles.js +11 -0
  59. package/dist/components/menu-item/menu-item.component.d.ts +25 -0
  60. package/dist/components/menu-item/menu-item.component.js +13 -0
  61. package/dist/components/menu-item/menu-item.d.ts +8 -0
  62. package/dist/components/menu-item/menu-item.js +6 -0
  63. package/dist/components/menu-item/menu-item.styles.d.ts +1 -0
  64. package/dist/components/menu-item/menu-item.styles.js +19 -0
  65. package/dist/components/popover/popover.component.d.ts +29 -0
  66. package/dist/components/popover/popover.component.js +37 -0
  67. package/dist/components/popover/popover.d.ts +8 -0
  68. package/dist/components/popover/popover.js +6 -0
  69. package/dist/components/popover/popover.styles.d.ts +1 -0
  70. package/dist/components/popover/popover.styles.js +12 -0
  71. package/dist/components/progress/progress.component.d.ts +22 -0
  72. package/dist/components/progress/progress.component.js +49 -0
  73. package/dist/components/progress/progress.d.ts +8 -0
  74. package/dist/components/progress/progress.js +6 -0
  75. package/dist/components/progress/progress.styles.d.ts +1 -0
  76. package/dist/components/progress/progress.styles.js +48 -0
  77. package/dist/components/radio/radio.component.d.ts +7 -9
  78. package/dist/components/radio/radio.component.js +95 -79
  79. package/dist/components/select/select.component.d.ts +10 -12
  80. package/dist/components/select/select.component.js +120 -120
  81. package/dist/components/select/select.controllers.d.ts +1 -26
  82. package/dist/components/select/select.controllers.js +35 -95
  83. package/dist/components/select-option/select-option.component.d.ts +1 -1
  84. package/dist/components/select-option/select-option.controllers.d.ts +1 -1
  85. package/dist/components/select-option-group/select-option-group.component.d.ts +1 -1
  86. package/dist/components/select-option-group/select-option-group.component.js +9 -9
  87. package/dist/components/stepper/stepper.component.d.ts +38 -0
  88. package/dist/components/stepper/stepper.component.js +91 -0
  89. package/dist/components/stepper/stepper.d.ts +8 -0
  90. package/dist/components/stepper/stepper.helpers.d.ts +16 -0
  91. package/dist/components/stepper/stepper.helpers.js +18 -0
  92. package/dist/components/stepper/stepper.js +6 -0
  93. package/dist/components/stepper/stepper.styles.d.ts +1 -0
  94. package/dist/components/stepper/stepper.styles.js +15 -0
  95. package/dist/components/stepper-item/stepper-item.component.d.ts +47 -0
  96. package/dist/components/stepper-item/stepper-item.component.js +113 -0
  97. package/dist/components/stepper-item/stepper-item.d.ts +8 -0
  98. package/dist/components/stepper-item/stepper-item.js +6 -0
  99. package/dist/components/stepper-item/stepper-item.styles.d.ts +1 -0
  100. package/dist/components/stepper-item/stepper-item.styles.js +98 -0
  101. package/dist/components/switch/switch.component.d.ts +2 -2
  102. package/dist/components/switch/switch.component.js +17 -7
  103. package/dist/components/switch/switch.styles.js +16 -13
  104. package/dist/components/tab/tab.component.d.ts +29 -0
  105. package/dist/components/tab/tab.component.js +57 -0
  106. package/dist/components/tab/tab.d.ts +8 -0
  107. package/dist/components/tab/tab.js +6 -0
  108. package/dist/components/tab/tab.styles.d.ts +1 -0
  109. package/dist/components/tab/tab.styles.js +123 -0
  110. package/dist/components/tab-group/tab-group.component.d.ts +43 -0
  111. package/dist/components/tab-group/tab-group.component.js +98 -0
  112. package/dist/components/tab-group/tab-group.d.ts +8 -0
  113. package/dist/components/tab-group/tab-group.js +6 -0
  114. package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
  115. package/dist/components/tab-group/tab-group.styles.js +75 -0
  116. package/dist/components/tab-panel/tab-panel.component.d.ts +19 -0
  117. package/dist/components/tab-panel/tab-panel.component.js +36 -0
  118. package/dist/components/tab-panel/tab-panel.d.ts +8 -0
  119. package/dist/components/tab-panel/tab-panel.js +6 -0
  120. package/dist/components/tab-panel/tab-panel.styles.d.ts +1 -0
  121. package/dist/components/tab-panel/tab-panel.styles.js +13 -0
  122. package/dist/components/tag/tag.component.d.ts +2 -2
  123. package/dist/components/tag/tag.component.js +61 -45
  124. package/dist/components/tag/tag.styles.js +30 -28
  125. package/dist/components/textarea/textarea.component.d.ts +4 -4
  126. package/dist/components/textarea/textarea.component.js +2 -2
  127. package/dist/components/toast/toast.component.d.ts +8 -5
  128. package/dist/components/toast/toast.component.js +30 -26
  129. package/dist/components/toast/toast.singleton.d.ts +5 -10
  130. package/dist/components/toast/toast.singleton.js +25 -25
  131. package/dist/components/toast/toast.styles.d.ts +1 -0
  132. package/dist/components/toast-item/toast-item.component.d.ts +1 -1
  133. package/dist/components/toast-item/toast-item.component.js +15 -15
  134. package/dist/components/toast-item/toast-item.styles.js +18 -0
  135. package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +2 -2
  136. package/dist/components/toast-wrapper/toast-wrapper.component.js +11 -11
  137. package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
  138. package/dist/components/tooltip/tooltip.component.d.ts +24 -0
  139. package/dist/components/tooltip/tooltip.component.js +18 -0
  140. package/dist/components/tooltip/tooltip.d.ts +8 -0
  141. package/dist/components/tooltip/tooltip.js +6 -0
  142. package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
  143. package/dist/components/tooltip/tooltip.styles.js +12 -0
  144. package/dist/custom-elements.json +2465 -629
  145. package/dist/index.d.ts +11 -0
  146. package/dist/index.js +77 -44
  147. package/dist/internal/base-classes/popover/popover.base.d.ts +29 -0
  148. package/dist/internal/base-classes/popover/popover.base.js +116 -0
  149. package/dist/internal/base-classes/popover/popover.styles.d.ts +1 -0
  150. package/dist/internal/base-classes/popover/popover.styles.js +29 -0
  151. package/dist/internal/components/formBase.d.ts +1 -0
  152. package/dist/internal/components/formBase.js +11 -11
  153. package/dist/internal/components/hint/hint.component.d.ts +2 -2
  154. package/dist/internal/components/hint/hint.component.js +13 -13
  155. package/dist/internal/components/skf-element.js +26 -25
  156. package/dist/internal/controllers/popover.controller.d.ts +16 -0
  157. package/dist/internal/controllers/popover.controller.js +44 -0
  158. package/dist/internal/helpers/hintSeverity.d.ts +2 -2
  159. package/dist/internal/helpers/watch.d.ts +27 -0
  160. package/dist/internal/helpers/watch.js +28 -0
  161. package/dist/internal/templates/asterisk.d.ts +1 -1
  162. package/dist/internal/templates/asterisk.js +7 -6
  163. package/dist/react/index.d.ts +13 -0
  164. package/dist/react/index.js +13 -0
  165. package/dist/react/skf-breadcrumb/index.d.ts +9 -0
  166. package/dist/react/skf-breadcrumb/index.js +17 -0
  167. package/dist/react/skf-breadcrumb-item/index.d.ts +3 -0
  168. package/dist/react/skf-breadcrumb-item/index.js +13 -0
  169. package/dist/react/skf-button/index.d.ts +7 -1
  170. package/dist/react/skf-button/index.js +5 -1
  171. package/dist/react/skf-dialog/index.d.ts +15 -0
  172. package/dist/react/skf-dialog/index.js +19 -0
  173. package/dist/react/skf-menu/index.d.ts +12 -0
  174. package/dist/react/skf-menu/index.js +18 -0
  175. package/dist/react/skf-menu-item/index.d.ts +27 -0
  176. package/dist/react/skf-menu-item/index.js +23 -0
  177. package/dist/react/skf-popover/index.d.ts +12 -0
  178. package/dist/react/skf-popover/index.js +18 -0
  179. package/dist/react/skf-progress/index.d.ts +3 -0
  180. package/dist/react/skf-progress/index.js +13 -0
  181. package/dist/react/skf-stepper/index.d.ts +9 -0
  182. package/dist/react/skf-stepper/index.js +17 -0
  183. package/dist/react/skf-stepper-item/index.d.ts +9 -0
  184. package/dist/react/skf-stepper-item/index.js +17 -0
  185. package/dist/react/skf-tab/index.d.ts +12 -0
  186. package/dist/react/skf-tab/index.js +18 -0
  187. package/dist/react/skf-tab-group/index.d.ts +3 -0
  188. package/dist/react/skf-tab-group/index.js +13 -0
  189. package/dist/react/skf-tab-panel/index.d.ts +3 -0
  190. package/dist/react/skf-tab-panel/index.js +13 -0
  191. package/dist/react/skf-tooltip/index.d.ts +12 -0
  192. package/dist/react/skf-tooltip/index.js +18 -0
  193. package/dist/styles/component.styles.js +15 -2
  194. package/dist/types/jsx/custom-element-jsx.d.ts +603 -27
  195. package/dist/types/vue/index.d.ts +413 -11
  196. package/dist/vscode.html-custom-data.json +462 -36
  197. package/dist/web-types.json +944 -90
  198. package/package.json +43 -42
  199. package/dist/components/toast-item/toast-item.style.js +0 -16
  200. /package/dist/components/{toast/toast.style.d.ts → breadcrumb/breadcrumb.styles.d.ts} +0 -0
  201. /package/dist/components/{toast-wrapper/toast-wrapper.style.d.ts → breadcrumb-item/breadcrumb-item.styles.d.ts} +0 -0
  202. /package/dist/components/toast/{toast.style.js → toast.styles.js} +0 -0
  203. /package/dist/components/toast-item/{toast-item.style.d.ts → toast-item.styles.d.ts} +0 -0
  204. /package/dist/components/toast-wrapper/{toast-wrapper.style.js → toast-wrapper.styles.js} +0 -0
@@ -1,36 +1,37 @@
1
1
  import "../icon/icon.js";
2
2
  import { SkfElement as u } from "../../internal/components/skf-element.js";
3
- import d from "../../styles/component.styles.js";
4
- import { html as a, nothing as m } from "lit";
5
- import { property as s, query as f } from "lit/decorators.js";
6
- import { ifDefined as v } from "lit/directives/if-defined.js";
3
+ import f from "../../styles/component.styles.js";
4
+ import { html as a, nothing as p } from "lit";
5
+ import { property as n, query as d } from "lit/decorators.js";
6
+ import { classMap as v } from "lit/directives/class-map.js";
7
+ import { ifDefined as _ } from "lit/directives/if-defined.js";
7
8
  import { styles as k } from "./tag.styles.js";
8
- var y = Object.defineProperty, C = Object.getOwnPropertyDescriptor, r = (p, e, i, n) => {
9
- for (var t = n > 1 ? void 0 : n ? C(e, i) : e, l = p.length - 1, c; l >= 0; l--)
10
- (c = p[l]) && (t = (n ? c(e, i, t) : c(t)) || t);
11
- return n && t && y(e, i, t), t;
9
+ var b = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (m, t, s, r) => {
10
+ for (var e = r > 1 ? void 0 : r ? y(t, s) : t, l = m.length - 1, c; l >= 0; l--)
11
+ (c = m[l]) && (e = (r ? c(t, s, e) : c(e)) || e);
12
+ return r && e && b(t, s, e), e;
12
13
  };
13
14
  const h = class h extends u {
14
15
  constructor() {
15
- super(...arguments), this.size = "md", this._handleKeyDown = (e) => {
16
- (e.key === "Enter" || e.key === " ") && this.$removeButton.click();
17
- }, this._handleRemove = (e) => {
18
- this._onRemove && this._onRemove(e);
19
- }, this._handleClick = (e) => {
20
- var t;
21
- e.stopPropagation();
22
- const i = e.composedPath()[0];
23
- console.log("$clickTarget", i), i.localName === "button" ? this.remove() : (t = this.onClick) == null || t.call(this, e);
16
+ super(...arguments), this.size = "md", this._handleKeyDown = (t) => {
17
+ (t.key === "Enter" || t.key === " ") && this.$removeButton.click();
18
+ }, this._handleRemove = (t) => {
19
+ this._onRemove && this._onRemove(t);
20
+ }, this._handleClick = (t) => {
21
+ var e;
22
+ t.stopPropagation();
23
+ const s = t.composedPath()[0];
24
+ console.log("$clickTarget", s), s.localName === "button" ? this.remove() : (e = this.onClick) == null || e.call(this, t);
24
25
  };
25
26
  }
26
- set onClick(e) {
27
- e && (this._onClick = e);
27
+ set onClick(t) {
28
+ t && (this._onClick = t);
28
29
  }
29
30
  get onClick() {
30
31
  return this._onClick;
31
32
  }
32
- set onRemove(e) {
33
- e && (this._onRemove = e);
33
+ set onRemove(t) {
34
+ t && (this._onRemove = t);
34
35
  }
35
36
  get onRemove() {
36
37
  return this._onRemove;
@@ -41,47 +42,62 @@ const h = class h extends u {
41
42
  disconnectedCallback() {
42
43
  super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
43
44
  }
44
- attributeChangedCallback(e, i, n) {
45
- super.attributeChangedCallback(e, i, n), e === "removable" && n !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
45
+ attributeChangedCallback(t, s, r) {
46
+ super.attributeChangedCallback(t, s, r), t === "removable" && r !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
46
47
  }
47
48
  render() {
48
49
  return a`
49
- <div id="root">
50
- ${this.icon ? a`<skf-icon color=${v(this.color)} name=${this.icon} size="sm"></skf-icon>` : m}
51
- <span>
52
- <slot></slot>
53
- </span>
50
+ <div
51
+ class=${v({
52
+ tag: !0,
53
+ "tag--color-alert": this.color === "alert",
54
+ "tag--color-error": this.color === "error",
55
+ "tag--color-info": this.color === "info",
56
+ "tag--color-success": this.color === "success",
57
+ "tag--color-warning": this.color === "warning",
58
+ "tag--small": this.size === "sm"
59
+ })}
60
+ >
61
+ ${this.icon ? a`
62
+ <skf-icon
63
+ class="tag__icon"
64
+ color=${_(this.color)}
65
+ name=${this.icon}
66
+ size="sm"
67
+ ></skf-icon>
68
+ ` : p}
69
+ <slot class="tag__slot"></slot>
54
70
  ${this.removable ? a`
55
- <button @click=${this._handleRemove} type="button">
71
+ <button @click=${this._handleRemove} class="tag__btn" type="button">
56
72
  <skf-icon name="close" size="xs"></skf-icon>
57
73
  </button>
58
- ` : m}
74
+ ` : p}
59
75
  </div>
60
76
  `;
61
77
  }
62
78
  };
63
- h.styles = [d, k];
79
+ h.styles = [f, k];
64
80
  let o = h;
65
- r([
66
- s({ reflect: !0 })
81
+ i([
82
+ n({ reflect: !0 })
67
83
  ], o.prototype, "size", 2);
68
- r([
69
- s()
84
+ i([
85
+ n()
70
86
  ], o.prototype, "icon", 2);
71
- r([
72
- s({ reflect: !0 })
87
+ i([
88
+ n({ reflect: !0 })
73
89
  ], o.prototype, "color", 2);
74
- r([
75
- s({ attribute: !1 })
90
+ i([
91
+ n({ attribute: !1 })
76
92
  ], o.prototype, "onClick", 1);
77
- r([
78
- s({ attribute: !1 })
93
+ i([
94
+ n({ attribute: !1 })
79
95
  ], o.prototype, "onRemove", 1);
80
- r([
81
- s({ type: Boolean, reflect: !0 })
96
+ i([
97
+ n({ type: Boolean, reflect: !0 })
82
98
  ], o.prototype, "removable", 2);
83
- r([
84
- f("button")
99
+ i([
100
+ d("button")
85
101
  ], o.prototype, "$removeButton", 2);
86
102
  export {
87
103
  o as SkfTag
@@ -1,7 +1,8 @@
1
1
  import { css as r } from "lit";
2
2
  const s = r`
3
+ /* stylelint-disable selector-class-pattern */
3
4
  @layer components {
4
- #root {
5
+ .tag {
5
6
  align-items: center;
6
7
  background-color: var(--_skf-tag-bg-color, var(--skf-bg-color-neutral-1));
7
8
  block-size: var(--_skf-tag-height, var(--skf-size-32));
@@ -14,46 +15,47 @@ const s = r`
14
15
  gap: var(--skf-spacing-25);
15
16
  max-inline-size: 48ch;
16
17
  padding-inline: var(--skf-spacing-50);
18
+ }
17
19
 
18
- :host([color='alert']) & {
19
- --_skf-tag-bg-color: var(--skf-severity-bg-color-alert);
20
- --_skf-tag-border-color: var(--skf-severity-fg-color-alert);
21
- }
20
+ .tag--color-alert {
21
+ --_skf-tag-bg-color: var(--skf-severity-bg-color-alert);
22
+ --_skf-tag-border-color: var(--skf-severity-fg-color-alert);
23
+ }
22
24
 
23
- :host([color='error']) & {
24
- --_skf-tag-bg-color: var(--skf-severity-bg-color-error);
25
- --_skf-tag-border-color: var(--skf-severity-fg-color-error);
26
- }
25
+ .tag--color-error {
26
+ --_skf-tag-bg-color: var(--skf-severity-bg-color-error);
27
+ --_skf-tag-border-color: var(--skf-severity-fg-color-error);
28
+ }
27
29
 
28
- :host([color='info']) & {
29
- --_skf-tag-bg-color: var(--skf-severity-bg-color-info);
30
- --_skf-tag-border-color: var(--skf-severity-fg-color-info);
31
- }
30
+ .tag--color-info {
31
+ --_skf-tag-bg-color: var(--skf-severity-bg-color-info);
32
+ --_skf-tag-border-color: var(--skf-severity-fg-color-info);
33
+ }
32
34
 
33
- :host([color='success']) & {
34
- --_skf-tag-bg-color: var(--skf-severity-bg-color-success);
35
- --_skf-tag-border-color: var(--skf-severity-fg-color-success);
36
- }
35
+ .tag--color-success {
36
+ --_skf-tag-bg-color: var(--skf-severity-bg-color-success);
37
+ --_skf-tag-border-color: var(--skf-severity-fg-color-success);
38
+ }
37
39
 
38
- :host([color='warning']) & {
39
- --_skf-tag-bg-color: var(--skf-severity-bg-color-warning);
40
- --_skf-tag-border-color: var(--skf-severity-fg-color-warning);
41
- }
40
+ .tag--color-warning {
41
+ --_skf-tag-bg-color: var(--skf-severity-bg-color-warning);
42
+ --_skf-tag-border-color: var(--skf-severity-fg-color-warning);
43
+ }
42
44
 
43
- :host([size='sm']) & {
44
- --_skf-tag-border-radius: 0.25rem; /* token needed */
45
- --_skf-tag-font-size: var(--skf-font-size-25);
46
- --_skf-tag-height: var(--skf-size-24);
47
- }
45
+ .tag--small {
46
+ --_skf-tag-border-radius: 0.25rem; /* token needed */
47
+ --_skf-tag-font-size: var(--skf-font-size-25);
48
+ --_skf-tag-height: var(--skf-size-24);
48
49
  }
49
50
 
50
- span {
51
+ .tag__slot {
52
+ display: block;
51
53
  overflow: hidden;
52
54
  text-overflow: ellipsis;
53
55
  white-space: nowrap;
54
56
  }
55
57
 
56
- button {
58
+ .tag__btn {
57
59
  display: flex;
58
60
 
59
61
  &:focus-visible {
@@ -1,7 +1,7 @@
1
- import '@components/icon/icon.js';
2
- import { FormBase } from '@internal/components/formBase.js';
3
- import '@internal/components/hint/hint.js';
4
- import type { FormFieldBaseProps } from '@internal/types/formField.js';
1
+ import '../icon/icon.js';
2
+ import { FormBase } from '../../internal/components/formBase.js';
3
+ import '../../internal/components/hint/hint.js';
4
+ import type { FormFieldBaseProps } from '../../internal/types/formField.js';
5
5
  import { type CSSResultGroup } from 'lit';
6
6
  interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
7
7
  cols?: number;
@@ -46,7 +46,7 @@ const u = class u extends m {
46
46
  attributeChangedCallback(t, s, a) {
47
47
  if (super.attributeChangedCallback(t, s, a), t === "value" && this._internals.setFormValue(a), t === "custom-invalid")
48
48
  if (typeof a == "string") {
49
- const o = String(a).trim();
49
+ const o = this.withFallback(a);
50
50
  this.pristine = !1, this._internals.setValidity({ customError: !0 }, o), this.invalid = !0, this.hint = o, this.checkValidity();
51
51
  } else
52
52
  this._internals.setValidity({}), this.validateInput();
@@ -69,7 +69,7 @@ const u = class u extends m {
69
69
  const o = this.hasAttribute(l) ? this.getAttribute(l) : this.$input.validationMessage;
70
70
  this._internals.setValidity(
71
71
  { [this.validationError]: !0, customError: this._internals.validity.customError },
72
- o ?? ""
72
+ this.withFallback(o)
73
73
  ), this.invalid && this.customErrorDisplay && this.checkValidity();
74
74
  }
75
75
  }
@@ -1,4 +1,5 @@
1
- import { SkfElement } from '@internal/components/skf-element';
1
+ import type { SkfAlert } from '../alert/alert.component.js';
2
+ import { SkfElement } from '../../internal/components/skf-element';
2
3
  import { type CSSResultGroup } from 'lit';
3
4
  /**
4
5
  * 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.
@@ -18,11 +19,13 @@ import { type CSSResultGroup } from 'lit';
18
19
  export declare class SkfToast extends SkfElement {
19
20
  static styles: CSSResultGroup;
20
21
  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
22
  debug: boolean;
24
- /** Severity of the toast. */
25
- severity: 'info' | 'success' | 'warning' | 'error';
23
+ /** If defined, displays leading icon */
24
+ icon?: SkfAlert['icon'];
25
+ /** If true, renders with an close button and sets aria-role to `status` */
26
+ persistent: SkfAlert['persistent'];
27
+ /** If defined, gives the supplied appearance */
28
+ severity: SkfAlert['severity'];
26
29
  /** Time in seconds before the toast disappears. */
27
30
  timer: number;
28
31
  /** offsets where toasts emerge vertically */
@@ -1,50 +1,54 @@
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";
1
+ import { Singleton as d } from "./toast.singleton.js";
2
+ import { SkfElement as f } from "../../internal/components/skf-element.js";
3
+ import { html as l } from "lit";
4
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;
5
+ import { styles as u } from "./toast.styles.js";
6
+ var a = Object.defineProperty, e = (n, r, h, g) => {
7
+ for (var i = void 0, o = n.length - 1, m; o >= 0; o--)
8
+ (m = n[o]) && (i = m(r, h, i) || i);
9
+ return i && a(r, h, i), i;
10
10
  };
11
- const p = class p extends m {
11
+ const p = class p extends f {
12
12
  constructor() {
13
- super(), this.closeable = !1, this.debug = !1, this.severity = "info", this.timer = 5, this._singleton = void 0;
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 f(this.getRootNode()), this._singleton.addData({
17
- text: this._slottedText.map((r) => r.textContent).join(),
18
- timer: this.timer,
19
- closeable: this.closeable,
16
+ this._singleton = new d(this.getRootNode()), this._singleton.addData({
17
+ debug: this.debug,
18
+ icon: this.icon,
20
19
  originEl: this,
20
+ persistent: this.persistent,
21
21
  severity: this.severity,
22
- topOffset: this.topOffset,
23
- debug: this.debug
22
+ text: this._slottedText.map((r) => r.textContent).join(),
23
+ timer: this.timer = this.timer && this.timer < 5 ? 5 : this.timer,
24
+ topOffset: this.topOffset
24
25
  });
25
26
  }
26
27
  render() {
27
- return h`<slot></slot>`;
28
+ return l`<slot></slot>`;
28
29
  }
29
30
  };
30
- p.styles = [a];
31
+ p.styles = [u];
31
32
  let t = p;
32
- o([
33
- s({ type: Boolean })
34
- ], t.prototype, "closeable");
35
- o([
33
+ e([
36
34
  s({ type: Boolean })
37
35
  ], t.prototype, "debug");
38
- o([
36
+ e([
37
+ s()
38
+ ], t.prototype, "icon");
39
+ e([
40
+ s({ type: Boolean })
41
+ ], t.prototype, "persistent");
42
+ e([
39
43
  s()
40
44
  ], t.prototype, "severity");
41
- o([
45
+ e([
42
46
  s({ type: Number })
43
47
  ], t.prototype, "timer");
44
- o([
48
+ e([
45
49
  s({ type: Number })
46
50
  ], t.prototype, "topOffset");
47
- o([
51
+ e([
48
52
  y()
49
53
  ], t.prototype, "_slottedText");
50
54
  export {
@@ -1,14 +1,9 @@
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;
1
+ import '../toast-item/toast-item.js';
2
+ import '../toast-wrapper/toast-wrapper.js';
3
+ import type { SkfToast } from '../toast/toast.component.js';
4
+ interface ToastData extends Pick<SkfToast, 'debug' | 'icon' | 'persistent' | 'severity' | 'timer' | 'topOffset'> {
9
5
  originEl: SkfToast;
10
- severity: 'info' | 'success' | 'warning' | 'error';
11
- debug: boolean;
6
+ text: string;
12
7
  }
13
8
  export declare class Singleton {
14
9
  private static instance?;
@@ -1,10 +1,10 @@
1
1
  import "../toast-item/toast-item.js";
2
2
  import "../toast-wrapper/toast-wrapper.js";
3
- class a {
4
- constructor(t) {
5
- if (this.data = [], this.root = t, this.usePopover = !0, this.root.nodeType !== Node.DOCUMENT_NODE)
3
+ class r {
4
+ constructor(e) {
5
+ if (this.data = [], this.root = e, this.usePopover = !0, this.root.nodeType !== Node.DOCUMENT_NODE)
6
6
  throw new Error("Root node must be a document node");
7
- return a.instance || (a.instance = this), a.instance;
7
+ return r.instance || (r.instance = this), r.instance;
8
8
  }
9
9
  hasToasts() {
10
10
  return this.data.length > 0;
@@ -15,39 +15,39 @@ class a {
15
15
  getData() {
16
16
  return this.data;
17
17
  }
18
- setData(t) {
19
- this.data = t;
18
+ setData(e) {
19
+ this.data = e;
20
20
  }
21
- addData(t) {
22
- this.data = [...this.data, t], this.udpateUI();
21
+ addData(e) {
22
+ this.data = [...this.data, e], this.udpateUI();
23
23
  }
24
24
  udpateUI() {
25
- const t = c(this.root, this.usePopover);
26
- this.usePopover && t.showPopover(), u();
25
+ const e = c(this.root, this.usePopover);
26
+ this.usePopover && e.showPopover(), u();
27
27
  function u() {
28
- const n = new a(document);
28
+ const n = new r(document);
29
29
  for (; n.hasToasts(); ) {
30
- const e = n.popToast();
31
- if (!e) return;
32
- e.debug && (t.debug = !0);
30
+ const t = n.popToast();
31
+ if (!t) return;
32
+ t.debug && (e.debug = !0);
33
33
  const o = document.createElement("skf-toast-item");
34
- o.timer = e.timer, o.severity = e.severity, o.icon = "warning", e.closeable && o.setAttribute("closeable", "true"), o.originEl = e.originEl, o.innerText = String(e.text);
35
- const s = document.createElement("div");
36
- s.classList.add("toast-item-wrapper"), s.appendChild(o), t.prepend(s);
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);
35
+ const a = document.createElement("div");
36
+ a.classList.add("toast-item-wrapper"), a.appendChild(o), e.prepend(a);
37
37
  }
38
38
  }
39
- function c(n, e) {
39
+ function c(n, t) {
40
40
  var p;
41
- const s = ((p = new a(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");
43
- if (!r) {
44
- if (r = document.createElement("skf-toast-wrapper"), !r) throw new Error("Could not create toast wrapper element");
45
- e && r.setAttribute("popover", "auto"), s && r.setAttribute("top-offset", s.toString()), document.body.appendChild(r);
41
+ const a = ((p = new r(document).getData()[0]) == null ? void 0 : p.topOffset) ?? null, i = n.querySelector("body");
42
+ let s = i == null ? void 0 : i.querySelector("skf-toast-wrapper");
43
+ if (!s) {
44
+ if (s = document.createElement("skf-toast-wrapper"), !s) throw new Error("Could not create toast wrapper element");
45
+ t && s.setAttribute("popover", "auto"), a && s.setAttribute("top-offset", a.toString()), document.body.appendChild(s);
46
46
  }
47
- return r;
47
+ return s;
48
48
  }
49
49
  }
50
50
  }
51
51
  export {
52
- a as Singleton
52
+ r as Singleton
53
53
  };
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -1,4 +1,4 @@
1
- import { SkfAlert } from '@components/alert/alert.component.js';
1
+ import { SkfAlert } from '../alert/alert.component.js';
2
2
  export declare class SkfToastItem extends SkfAlert {
3
3
  static styles: import("lit").CSSResultGroup[];
4
4
  protected _closeableInitialState: boolean;
@@ -1,18 +1,18 @@
1
- import { SkfAlert as l } from "../alert/alert.component.js";
2
- import { MOTION_DURATIONS as h } from "@skf-design-system/ui-assets";
3
- import { property as u } from "lit/decorators.js";
4
- import p from "./toast-item.style.js";
5
- var d = Object.defineProperty, f = (a, t, e, m) => {
1
+ import { SkfAlert as h } from "../alert/alert.component.js";
2
+ import { MOTION_DURATIONS as m } from "@skf-design-system/ui-assets";
3
+ import { property as p } from "lit/decorators.js";
4
+ import u from "./toast-item.styles.js";
5
+ var d = Object.defineProperty, f = (a, t, e, l) => {
6
6
  for (var i = void 0, r = a.length - 1, o; r >= 0; r--)
7
7
  (o = a[r]) && (i = o(t, e, i) || i);
8
8
  return i && d(t, e, i), i;
9
9
  };
10
- const n = class n extends l {
10
+ const n = class n extends h {
11
11
  constructor() {
12
12
  super(), this.timer = 0, this._handleMouseEnter = () => {
13
- this._closeableInitialState || (this.closeable = !0, this._timeleft = this.timer * 1e3 - (Date.now() - this._timeoutStarted), this._currentTimeoutId && clearTimeout(this._currentTimeoutId));
13
+ this._closeableInitialState || (this.persistent = !0, this._timeleft = this.timer * 1e3 - (Date.now() - this._timeoutStarted), this._currentTimeoutId && clearTimeout(this._currentTimeoutId));
14
14
  }, this._handleMouseLeave = () => {
15
- this._closeableInitialState || (this.closeable = this._closeableInitialState, this._currentTimeoutId = setTimeout(this._removeToast, this._timeleft));
15
+ this._closeableInitialState || (this.persistent = this._closeableInitialState, this._currentTimeoutId = setTimeout(this._removeToast, this._timeleft));
16
16
  }, this._removeToast = () => {
17
17
  const e = this.parentAnimationDiv.animate(
18
18
  [
@@ -20,17 +20,17 @@ const n = class n extends l {
20
20
  { gridTemplateRows: "0fr", opacity: 0 }
21
21
  ],
22
22
  {
23
- duration: h.normal,
23
+ duration: m.normal,
24
24
  fill: "forwards"
25
25
  }
26
26
  );
27
27
  e.onfinish = () => {
28
28
  this.originEl && this.originEl.remove(), this.parentAnimationDiv.remove();
29
29
  };
30
- }, this.originEl = null, this._parentAnimationDiv = this.parentElement, this._currentTimeoutId = null, this._timeleft = 0, this._timeoutStarted = 0, this._closeableInitialState = !!this.closeable;
30
+ }, this.originEl = null, this._parentAnimationDiv = this.parentElement, this._currentTimeoutId = null, this._timeleft = 0, this._timeoutStarted = 0, this._closeableInitialState = !!this.persistent;
31
31
  }
32
32
  firstUpdated() {
33
- this.addEventListener("skf-alert-close", this._removeToast), this.closeable || (this.addEventListener("mouseenter", this._handleMouseEnter), this.addEventListener("mouseout", this._handleMouseLeave)), this._animateIn();
33
+ this.addEventListener("skf-alert-close", this._removeToast), this.persistent || (this.addEventListener("mouseenter", this._handleMouseEnter), this.addEventListener("mouseout", this._handleMouseLeave)), this._animateIn();
34
34
  }
35
35
  _animateIn() {
36
36
  const t = this.parentAnimationDiv;
@@ -41,12 +41,12 @@ const n = class n extends l {
41
41
  { gridTemplateRows: "1fr", opacity: 1 }
42
42
  ],
43
43
  {
44
- duration: h.slow,
44
+ duration: m.slow,
45
45
  fill: "forwards"
46
46
  }
47
47
  );
48
48
  e.onfinish = () => {
49
- this.timer > 0 && !this.closeable && (this._timeoutStarted = Date.now(), this._currentTimeoutId = setTimeout(this._removeToast, this.timer * 1e3));
49
+ this.timer > 0 && !this.persistent && (this._timeoutStarted = Date.now(), this._currentTimeoutId = setTimeout(this._removeToast, this.timer * 1e3));
50
50
  };
51
51
  }
52
52
  get parentAnimationDiv() {
@@ -55,10 +55,10 @@ const n = class n extends l {
55
55
  return t;
56
56
  }
57
57
  };
58
- n.styles = [l.styles, p];
58
+ n.styles = [h.styles, u];
59
59
  let s = n;
60
60
  f([
61
- u({ type: Number, reflect: !0 })
61
+ p({ type: Number, reflect: !0 })
62
62
  ], s.prototype, "timer");
63
63
  export {
64
64
  s as SkfToastItem
@@ -0,0 +1,18 @@
1
+ import { css as o } from "lit";
2
+ const a = o`
3
+ @layer components {
4
+ :host {
5
+ overflow: hidden; /* Enable mask transition */
6
+ padding-block-end: 3px; /* Make room for box-shadow */
7
+ }
8
+
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
+ }
14
+ }
15
+ `;
16
+ export {
17
+ a as default
18
+ };
@@ -1,5 +1,5 @@
1
- import type { SkfAlert } from '@components/alert/alert.component.js';
2
- import { SkfElement } from '@internal/components/skf-element';
1
+ import type { SkfAlert } from '../alert/alert.component.js';
2
+ import { SkfElement } from '../../internal/components/skf-element';
3
3
  import { type CSSResultGroup } from 'lit';
4
4
  /**
5
5
  * The `<skf-toast-wrapper>` is a component without UI that positions where the toast shows up on the screen. The toast-wrapper is used internally by the toast component.
@@ -2,13 +2,13 @@ import { SkfElement as h } from "../../internal/components/skf-element.js";
2
2
  import d from "../../styles/component.styles.js";
3
3
  import { html as m } from "lit";
4
4
  import { property as p, queryAssignedElements as a } from "lit/decorators.js";
5
- import { styles as u } from "./toast-wrapper.style.js";
6
- var y = Object.defineProperty, r = (l, i, n, g) => {
7
- for (var t = void 0, o = l.length - 1, f; o >= 0; o--)
8
- (f = l[o]) && (t = f(i, n, t) || t);
9
- return t && y(i, n, t), t;
5
+ import { styles as u } from "./toast-wrapper.styles.js";
6
+ var y = Object.defineProperty, s = (l, n, i, g) => {
7
+ for (var t = void 0, r = l.length - 1, f; r >= 0; r--)
8
+ (f = l[r]) && (t = f(n, i, t) || t);
9
+ return t && y(n, i, t), t;
10
10
  };
11
- const s = class s extends h {
11
+ const o = class o extends h {
12
12
  constructor() {
13
13
  super(...arguments), this.debug = !1, this._handleSlotChange = () => {
14
14
  this._slottedChildren.length === 0 && this.remove();
@@ -21,15 +21,15 @@ const s = class s extends h {
21
21
  return m`<slot @slotchange=${this._handleSlotChange}></slot>`;
22
22
  }
23
23
  };
24
- s.styles = [d, u];
25
- let e = s;
26
- r([
24
+ o.styles = [d, u];
25
+ let e = o;
26
+ s([
27
27
  p({ type: Boolean, reflect: !0 })
28
28
  ], e.prototype, "debug");
29
- r([
29
+ s([
30
30
  a()
31
31
  ], e.prototype, "_slottedChildren");
32
- r([
32
+ s([
33
33
  p({ type: Number, reflect: !0 })
34
34
  ], e.prototype, "topOffset");
35
35
  export {
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;