@skf-design-system/ui-components 1.0.0-beta.4 → 1.0.0-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 (159) hide show
  1. package/README.md +26 -6
  2. package/dist/components/accordion/accordion-item.d.ts +1 -1
  3. package/dist/components/accordion/accordion.component.d.ts +13 -9
  4. package/dist/components/accordion/accordion.component.js +34 -30
  5. package/dist/components/accordion/accordion.d.ts +1 -1
  6. package/dist/components/accordion/accordion.styles.d.ts +1 -2
  7. package/dist/components/accordion/accordion.styles.js +5 -4
  8. package/dist/components/alert/alert.component.d.ts +10 -7
  9. package/dist/components/alert/alert.component.js +50 -37
  10. package/dist/components/alert/alert.styles.d.ts +1 -2
  11. package/dist/components/alert/alert.styles.js +42 -34
  12. package/dist/components/button/button.component.d.ts +28 -4
  13. package/dist/components/button/button.component.js +80 -56
  14. package/dist/components/button/button.styles.js +2 -1
  15. package/dist/components/card/card.component.d.ts +1 -1
  16. package/dist/components/card/card.component.js +29 -21
  17. package/dist/components/card/card.styles.d.ts +1 -2
  18. package/dist/components/card/card.styles.js +22 -12
  19. package/dist/components/checkbox/checkbox.component.d.ts +20 -18
  20. package/dist/components/checkbox/checkbox.component.js +95 -89
  21. package/dist/components/checkbox/checkbox.styles.js +7 -2
  22. package/dist/components/checkbox/checkbox.test.d.ts +1 -0
  23. package/dist/components/collapse/collapse.component.d.ts +8 -5
  24. package/dist/components/collapse/collapse.component.js +50 -39
  25. package/dist/components/collapse/collapse.styles.js +13 -12
  26. package/dist/components/collapse/collapse.test.d.ts +1 -0
  27. package/dist/components/dialog/dialog.component.d.ts +75 -0
  28. package/dist/components/dialog/dialog.component.js +189 -0
  29. package/dist/components/dialog/dialog.d.ts +8 -0
  30. package/dist/components/dialog/dialog.js +6 -0
  31. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  32. package/dist/components/dialog/dialog.styles.js +91 -0
  33. package/dist/components/divider/divider.component.d.ts +14 -11
  34. package/dist/components/divider/divider.component.js +46 -29
  35. package/dist/components/divider/divider.styles.d.ts +1 -2
  36. package/dist/components/divider/divider.styles.js +26 -30
  37. package/dist/components/heading/heading.component.d.ts +14 -4
  38. package/dist/components/heading/heading.component.js +14 -14
  39. package/dist/components/heading/heading.styles.js +1 -1
  40. package/dist/components/icon/icon.component.d.ts +15 -9
  41. package/dist/components/icon/icon.component.js +6 -6
  42. package/dist/components/icon/icon.styles.js +56 -54
  43. package/dist/components/input/input.component.d.ts +48 -33
  44. package/dist/components/input/input.component.js +108 -99
  45. package/dist/components/link/link.component.d.ts +20 -17
  46. package/dist/components/link/link.component.js +20 -14
  47. package/dist/components/link/link.styles.js +36 -40
  48. package/dist/components/loader/loader.component.d.ts +7 -7
  49. package/dist/components/loader/loader.component.js +42 -61
  50. package/dist/components/loader/loader.styles.js +44 -11
  51. package/dist/components/logo/logo.component.d.ts +7 -5
  52. package/dist/components/logo/logo.component.js +25 -14
  53. package/dist/components/logo/logo.styles.d.ts +1 -2
  54. package/dist/components/logo/logo.styles.js +12 -10
  55. package/dist/components/progress/progress.component.d.ts +22 -0
  56. package/dist/components/progress/progress.component.js +49 -0
  57. package/dist/components/progress/progress.d.ts +8 -0
  58. package/dist/components/progress/progress.js +6 -0
  59. package/dist/components/progress/progress.styles.d.ts +1 -0
  60. package/dist/components/progress/progress.styles.js +48 -0
  61. package/dist/components/radio/radio.component.d.ts +21 -21
  62. package/dist/components/radio/radio.component.js +94 -78
  63. package/dist/components/radio/radio.styles.js +6 -1
  64. package/dist/components/select/select.component.d.ts +14 -12
  65. package/dist/components/select/select.component.js +119 -103
  66. package/dist/components/select/select.controllers.d.ts +1 -1
  67. package/dist/components/select/select.controllers.js +5 -2
  68. package/dist/components/select/select.styles.js +18 -3
  69. package/dist/components/select-option/select-option.component.d.ts +3 -3
  70. package/dist/components/select-option/select-option.component.js +16 -10
  71. package/dist/components/select-option/select-option.controllers.d.ts +1 -1
  72. package/dist/components/select-option-group/select-option-group.component.d.ts +1 -1
  73. package/dist/components/switch/switch.component.d.ts +4 -5
  74. package/dist/components/switch/switch.component.js +17 -7
  75. package/dist/components/switch/switch.styles.js +19 -11
  76. package/dist/components/switch/switch.test.d.ts +1 -0
  77. package/dist/components/tab/tab.component.d.ts +29 -0
  78. package/dist/components/tab/tab.component.js +57 -0
  79. package/dist/components/tab/tab.d.ts +8 -0
  80. package/dist/components/tab/tab.js +6 -0
  81. package/dist/components/tab/tab.styles.d.ts +1 -0
  82. package/dist/components/tab/tab.styles.js +123 -0
  83. package/dist/components/tab-group/tab-group.component.d.ts +43 -0
  84. package/dist/components/tab-group/tab-group.component.js +98 -0
  85. package/dist/components/tab-group/tab-group.d.ts +8 -0
  86. package/dist/components/tab-group/tab-group.js +6 -0
  87. package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
  88. package/dist/components/tab-group/tab-group.styles.js +75 -0
  89. package/dist/components/tab-panel/tab-panel.component.d.ts +19 -0
  90. package/dist/components/tab-panel/tab-panel.component.js +36 -0
  91. package/dist/components/tab-panel/tab-panel.d.ts +8 -0
  92. package/dist/components/tab-panel/tab-panel.js +6 -0
  93. package/dist/components/tab-panel/tab-panel.styles.d.ts +1 -0
  94. package/dist/components/tab-panel/tab-panel.styles.js +13 -0
  95. package/dist/components/tag/tag.component.d.ts +14 -9
  96. package/dist/components/tag/tag.component.js +63 -47
  97. package/dist/components/tag/tag.styles.js +35 -28
  98. package/dist/components/textarea/textarea.component.d.ts +30 -27
  99. package/dist/components/textarea/textarea.component.js +20 -17
  100. package/dist/components/toast/toast.component.d.ts +35 -0
  101. package/dist/components/toast/toast.component.js +52 -0
  102. package/dist/components/toast/toast.d.ts +8 -0
  103. package/dist/components/toast/toast.js +6 -0
  104. package/dist/components/toast/toast.singleton.d.ts +26 -0
  105. package/dist/components/toast/toast.singleton.js +53 -0
  106. package/dist/components/toast/toast.styles.d.ts +1 -0
  107. package/dist/components/toast/toast.styles.js +9 -0
  108. package/dist/components/toast-item/toast-item.component.d.ts +21 -0
  109. package/dist/components/toast-item/toast-item.component.js +65 -0
  110. package/dist/components/toast-item/toast-item.d.ts +6 -0
  111. package/dist/components/toast-item/toast-item.js +2 -0
  112. package/dist/components/toast-item/toast-item.styles.d.ts +2 -0
  113. package/dist/components/toast-item/toast-item.styles.js +16 -0
  114. package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +24 -0
  115. package/dist/components/toast-wrapper/toast-wrapper.component.js +37 -0
  116. package/dist/components/toast-wrapper/toast-wrapper.d.ts +8 -0
  117. package/dist/components/toast-wrapper/toast-wrapper.js +6 -0
  118. package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
  119. package/dist/components/toast-wrapper/toast-wrapper.styles.js +20 -0
  120. package/dist/custom-elements.json +3090 -1993
  121. package/dist/index.d.ts +6 -0
  122. package/dist/index.js +60 -42
  123. package/dist/internal/components/formBase.d.ts +1 -0
  124. package/dist/internal/components/formBase.js +11 -11
  125. package/dist/internal/components/hint/hint.component.d.ts +2 -2
  126. package/dist/internal/components/hint/hint.component.js +12 -10
  127. package/dist/internal/components/hint/hint.styles.js +26 -10
  128. package/dist/internal/components/skf-element.js +26 -25
  129. package/dist/internal/helpers/hintSeverity.d.ts +1 -1
  130. package/dist/internal/helpers/watch.d.ts +27 -0
  131. package/dist/internal/helpers/watch.js +28 -0
  132. package/dist/internal/storybook/shadowRootTraverser.d.ts +16 -8
  133. package/dist/internal/templates/asterisk.d.ts +1 -1
  134. package/dist/internal/templates/asterisk.js +7 -6
  135. package/dist/react/index.d.ts +10 -3
  136. package/dist/react/index.js +10 -3
  137. package/dist/react/skf-button/index.d.ts +7 -1
  138. package/dist/react/skf-button/index.js +5 -1
  139. package/dist/react/skf-dialog/index.d.ts +15 -0
  140. package/dist/react/skf-dialog/index.js +19 -0
  141. package/dist/react/skf-progress/index.d.ts +3 -0
  142. package/dist/react/skf-progress/index.js +13 -0
  143. package/dist/react/skf-tab/index.d.ts +12 -0
  144. package/dist/react/skf-tab/index.js +18 -0
  145. package/dist/react/skf-tab-group/index.d.ts +3 -0
  146. package/dist/react/skf-tab-group/index.js +13 -0
  147. package/dist/react/skf-tab-panel/index.d.ts +3 -0
  148. package/dist/react/skf-tab-panel/index.js +13 -0
  149. package/dist/react/skf-toast/index.d.ts +3 -0
  150. package/dist/react/skf-toast/index.js +13 -0
  151. package/dist/react/skf-toast-wrapper/index.d.ts +3 -0
  152. package/dist/react/skf-toast-wrapper/index.js +13 -0
  153. package/dist/styles/component.styles.js +15 -2
  154. package/dist/styles/form-field.styles.js +5 -1
  155. package/dist/types/jsx/custom-element-jsx.d.ts +300 -117
  156. package/dist/types/vue/index.d.ts +266 -76
  157. package/dist/vscode.html-custom-data.json +349 -216
  158. package/dist/web-types.json +686 -292
  159. package/package.json +33 -32
@@ -1,5 +1,5 @@
1
- import '@components/icon/icon.js';
2
- import { SkfElement } from '@internal/components/skf-element';
1
+ import '../icon/icon.js';
2
+ import { SkfElement } from '../../internal/components/skf-element';
3
3
  import type { Icon, SeverityBgColor } from '@skf-design-system/ui-assets';
4
4
  import { type CSSResultGroup } from 'lit';
5
5
  /**
@@ -13,24 +13,29 @@ import { type CSSResultGroup } from 'lit';
13
13
  */
14
14
  export declare class SkfTag extends SkfElement {
15
15
  static styles: CSSResultGroup;
16
- /** @internal */
17
16
  private _onClick?;
18
- /** @internal */
19
17
  protected _onRemove?: (event: Event) => void;
20
- /** Specifies Tag size - @default "md" */
18
+ /** Specifies Tag size */
21
19
  size: 'sm' | 'md' | 'lg';
22
- /** If defined, displays leading/provided icon - @type { "arrowDown" | "arrowDownUp" | "arrowLeft" | "arrowRight" | "arrowUp" | "article" | "artificialIntelligence" | "asset" | "attachment" | "bandCursor" | "bands" | "batteryEmpty" | "batteryFull" | "batteryLow" | "bearingFault" | "book" | "bulb" | "burger" | "cPM" | "calendar" | "calendarBooked" | "calendarEmpty" | "calendarNotBooked" | "calendarRecurring" | "caretDown" | "caretUp" | "caretUpDown" | "chat" | "check" | "checkCircle" | "checkSmall" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "chevronUpDown" | "close" | "closeAllFaults" | "closeFault" | "closeSmall" | "columnGraph" | "comment" | "connection1" | "connection2" | "connection3" | "connection4" | "danger" | "defectFrequencies" | "defectFrequenciesAlternative" | "doubleChevronLeft" | "doubleChevronRight" | "download" | "draft" | "draftFilled" | "draftOutlined" | "dragNDrop" | "drop" | "duplicate" | "edit" | "emailFilled" | "emailOutlined" | "exclamation" | "eye" | "eyeHidden" | "eyeVisible" | "filter" | "forbidden" | "fullScreen" | "fullScreenExit" | "functionalLocation" | "harmonicCursor" | "heatmap" | "hierarchy" | "history" | "historyAlt" | "hourglassFramedFilled" | "hourglassFramedOutlined" | "hourglassOutlined" | "hz" | "iMX" | "image" | "infoCircleFilled" | "infoCircleOutlined" | "integration" | "kebab" | "link" | "listGroup" | "listItem" | "locationPin" | "lock" | "logOut" | "meatballs" | "microphone" | "minus" | "minusSmall" | "noData" | "o" | "openInNew" | "overlayBaseline" | "pDF" | "paper" | "pause" | "pieChart" | "pin" | "play" | "plus" | "powerOff" | "printer" | "proCollect" | "recAction" | "received" | "refresh" | "reorder" | "replace" | "reply" | "rewalkableRoute" | "routes" | "search" | "send" | "sensorA" | "sensorB" | "settings" | "sidebandCursor" | "singleCursor" | "spectrum" | "starFilled" | "starOutlined" | "statusCircle" | "stop" | "structuralVibration" | "sync" | "timewave" | "trash" | "trend" | "trendingUp" | "undo" | "unknownCircle" | "unknownDiamond" | "unlink" | "unlock" | "unscheduledAction" | "upload" | "user" | "viewFull" | "viewHorizontal" | "viewVertical" | "warning" | "warningCircle" | "warningDiamond" | "zoomIn" | "zoomOut" } */
20
+ /**
21
+ * If defined, displays leading/provided icon
22
+ * @type { "arrowDown" | "arrowDownUp" | "arrowLeft" | "arrowRight" | "arrowUp" | "article" | "artificialIntelligence" | "asset" | "attachment" | "bandCursor" | "bands" | "batteryEmpty" | "batteryFull" | "batteryLow" | "bearingFault" | "book" | "bulb" | "burger" | "cPM" | "calendar" | "calendarBooked" | "calendarEmpty" | "calendarNotBooked" | "calendarRecurring" | "caretDown" | "caretUp" | "caretUpDown" | "chat" | "check" | "checkCircle" | "checkSmall" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "chevronUpDown" | "close" | "closeAllFaults" | "closeFault" | "closeSmall" | "columnGraph" | "comment" | "connection1" | "connection2" | "connection3" | "connection4" | "danger" | "defectFrequencies" | "defectFrequenciesAlternative" | "doubleChevronLeft" | "doubleChevronRight" | "download" | "draft" | "draftFilled" | "draftOutlined" | "dragNDrop" | "drop" | "duplicate" | "edit" | "emailFilled" | "emailOutlined" | "exclamation" | "eye" | "eyeHidden" | "eyeVisible" | "filter" | "forbidden" | "fullScreen" | "fullScreenExit" | "functionalLocation" | "harmonicCursor" | "heatmap" | "hierarchy" | "history" | "historyAlt" | "hourglassFramedFilled" | "hourglassFramedOutlined" | "hourglassOutlined" | "hz" | "iMX" | "image" | "infoCircleFilled" | "infoCircleOutlined" | "integration" | "kebab" | "link" | "listGroup" | "listItem" | "locationPin" | "lock" | "logOut" | "meatballs" | "microphone" | "minus" | "minusSmall" | "noData" | "o" | "openInNew" | "overlayBaseline" | "pDF" | "paper" | "pause" | "pieChart" | "pin" | "play" | "plus" | "powerOff" | "printer" | "proCollect" | "recAction" | "received" | "refresh" | "reorder" | "replace" | "reply" | "rewalkableRoute" | "routes" | "search" | "send" | "sensorA" | "sensorB" | "settings" | "sidebandCursor" | "singleCursor" | "spectrum" | "starFilled" | "starOutlined" | "statusCircle" | "stop" | "structuralVibration" | "sync" | "timewave" | "trash" | "trend" | "trendingUp" | "undo" | "unknownCircle" | "unknownDiamond" | "unlink" | "unlock" | "unscheduledAction" | "upload" | "user" | "viewFull" | "viewHorizontal" | "viewVertical" | "warning" | "warningCircle" | "warningDiamond" | "zoomIn" | "zoomOut" }
23
+ */
23
24
  icon?: Icon;
24
- /** If defined, gives the supplied appearance - @type { "warning" | "success" | "info" | "error" | "alert" } */
25
+ /**
26
+ * If defined, gives the supplied appearance
27
+ * @type { "warning" | "success" | "info" | "error" | "alert" }
28
+ */
25
29
  color?: SeverityBgColor;
26
- /** If provided, accepts a function that runs on click. */
30
+ /** If defined, accepts a function that runs on click */
27
31
  set onClick(onClickFn: ((event: Event) => void) | undefined);
28
32
  get onClick(): ((event: Event) => void) | undefined;
29
- /** If provided, accepts a function that runs on click. Self removal can be overridden by using `event.stopPropagation()`. */
33
+ /** If defined, accepts a function that runs on click. Self removal can be overridden by using `event.stopPropagation()`. */
30
34
  set onRemove(onRemoveFn: ((event: Event) => void) | undefined);
31
35
  get onRemove(): ((event: Event) => void) | undefined;
32
36
  /** If true, adds trailing button to remove tag */
33
37
  removable?: boolean;
38
+ /** @internal */
34
39
  $removeButton: HTMLButtonElement;
35
40
  connectedCallback(): void;
36
41
  disconnectedCallback(): void;
@@ -1,36 +1,37 @@
1
1
  import "../icon/icon.js";
2
- import { SkfElement as d } from "../../internal/components/skf-element.js";
3
- import u from "../../styles/component.styles.js";
4
- import { html as a, nothing as m } from "lit";
5
- import { property as r, query as f } from "lit/decorators.js";
6
- import { ifDefined as v } from "lit/directives/if-defined.js";
2
+ import { SkfElement as u } from "../../internal/components/skf-element.js";
3
+ import f from "../../styles/component.styles.js";
4
+ import { html as a, nothing as p } from "lit";
5
+ import { property as l, 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 b = Object.defineProperty, y = Object.getOwnPropertyDescriptor, s = (p, e, i, n) => {
9
- for (var t = n > 1 ? void 0 : n ? y(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 && b(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, n = m.length - 1, c; n >= 0; n--)
11
+ (c = m[n]) && (e = (r ? c(t, s, e) : c(e)) || e);
12
+ return r && e && b(t, s, e), e;
12
13
  };
13
- const h = class h extends d {
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
- i.localName === "skf-icon" && i.getAttribute("name") === "close" ? 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 d {
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.tabIndex = 0, this.addEventListener("keydown", this._handleKeyDown)) : (this.tabIndex = -1, 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="tag">
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 = [u, k];
79
+ h.styles = [f, k];
64
80
  let o = h;
65
- s([
66
- r({ reflect: !0 })
81
+ i([
82
+ l({ reflect: !0 })
67
83
  ], o.prototype, "size", 2);
68
- s([
69
- r()
84
+ i([
85
+ l()
70
86
  ], o.prototype, "icon", 2);
71
- s([
72
- r({ reflect: !0 })
87
+ i([
88
+ l({ reflect: !0 })
73
89
  ], o.prototype, "color", 2);
74
- s([
75
- r({ attribute: !1 })
90
+ i([
91
+ l({ attribute: !1 })
76
92
  ], o.prototype, "onClick", 1);
77
- s([
78
- r({ attribute: !1 })
93
+ i([
94
+ l({ attribute: !1 })
79
95
  ], o.prototype, "onRemove", 1);
80
- s([
81
- r({ type: Boolean, reflect: !0 })
96
+ i([
97
+ l({ type: Boolean, reflect: !0 })
82
98
  ], o.prototype, "removable", 2);
83
- s([
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
- #tag {
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,47 +15,53 @@ 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;
60
+
61
+ &:focus-visible {
62
+ border-radius: var(--skf-border-radius-sm);
63
+ outline: var(--skf-border-width-md) solid var(--skf-interactive-border-color-focus);
64
+ }
58
65
  }
59
66
  }
60
67
  `;
@@ -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;
@@ -12,7 +12,7 @@ interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
12
12
  /**
13
13
  * The skf-textarea is used to create a textarea. Use it inside a form element or wherever you like.
14
14
  *
15
- * @documentation See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/619e4125b3d2147c0c584b11) for design principles.
15
+ * @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/143f9d-text-area) for design principles.
16
16
  *
17
17
  * @attribute {boolean} disabled - If true, sets disabled state
18
18
  * @attribute {boolean} required - If true, value is required or must be checked for the form to be submittable
@@ -20,48 +20,51 @@ interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
20
20
  * @event change - Fires when the value of the input changes
21
21
  * @event invalid - Fires when the input is invalid
22
22
  *
23
- * @slot The textareas label. Alternatively, you can use the `label` attribute.
23
+ * @slot - The textareas label. Alternatively, you can use the `label` attribute.
24
24
  *
25
25
  * @tagname skf-textarea
26
26
  */
27
27
  export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
28
28
  static styles: CSSResultGroup;
29
29
  private customError;
30
- /** If provided, sets the cols of the textarea */
31
- cols?: number | undefined;
32
- /** If provided, forces component to invalid state until removed. Its value is used as hint text. */
30
+ /** If defined, sets the cols of the textarea */
31
+ cols?: number;
32
+ /** If defined, forces component to invalid state until removed. Its value is used as hint text. */
33
33
  set customInvalid(value: string | undefined);
34
34
  get customInvalid(): string | undefined;
35
- /** If provided, outputs helping hints in console */
36
- debug: boolean;
37
- /** hide-label - If true, hides the label visually */
38
- hideLabel: boolean;
39
- /** If provided, displays informational text below the field */
35
+ /** If true, outputs helping hints in console */
36
+ debug?: boolean;
37
+ /** If true, hides the label visually */
38
+ hideLabel?: boolean;
39
+ /** If defined, displays informational text below the field */
40
40
  hint?: string;
41
- /** The input's label. Alternatively, you can use the component slot. */
42
- label: string;
43
- /** If provided, adds name to the input-element */
41
+ /** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
42
+ label?: string;
43
+ /** If defined, adds name to the input-element */
44
44
  name?: string;
45
- /** If provided, sets the maximum character length to accept for this input */
45
+ /** If defined, sets the maximum character length to accept for this input */
46
46
  maxLength?: number;
47
- /** If provided, sets the minimum character length to accept for this input */
47
+ /** If defined, sets the minimum character length to accept for this input */
48
48
  minLength?: number;
49
- /** If provided, displays placeholder text */
49
+ /** If defined, displays placeholder text */
50
50
  placeholder?: string;
51
51
  /** If true, makes the element not mutable, meaning the user can not edit the control */
52
52
  readonly?: boolean;
53
- /** If provided, renders an alternative A11y text for the asterisk */
53
+ /** If defined, renders an alternative A11y text for the asterisk */
54
54
  requiredLabel?: string;
55
- /** If provided, sets the rows of the textarea */
56
- rows?: number | undefined;
57
- /** @type { "success" | "error" } - If provided, displays provided severity state */
55
+ /** If defined, sets the rows of the textarea */
56
+ rows?: number;
57
+ /**
58
+ * If defined, displays provided severity state
59
+ * @type {"success" | "info" | "warning" | "alert"}
60
+ */
58
61
  severity?: SkfTextAreaProps['severity'];
59
62
  /** If true, displays valid state after interaction */
60
63
  showValid?: boolean;
61
- /** If provided, displays an alternative size */
64
+ /** Size of the Textarea */
62
65
  size?: 'sm' | 'md';
63
- /** If provided, sets validation start, "input", "change" or "submit" */
64
- validateOn?: 'input' | 'change' | 'submit';
66
+ /** Sets validation start */
67
+ validateOn: 'input' | 'change' | 'submit';
65
68
  /** The current value of the text area */
66
69
  value: string;
67
70
  /** @internal */
@@ -4,7 +4,7 @@ import "../../internal/components/hint/hint.js";
4
4
  import { Asterisk as c } from "../../internal/templates/asterisk.js";
5
5
  import y from "../../styles/component.styles.js";
6
6
  import { html as p, nothing as v } from "lit";
7
- import { property as r, state as f, query as b } from "lit/decorators.js";
7
+ import { property as r, state as b, query as f } from "lit/decorators.js";
8
8
  import { ifDefined as n } from "lit/directives/if-defined.js";
9
9
  import g from "./textarea.styles.js";
10
10
  var $ = Object.defineProperty, E = Object.getOwnPropertyDescriptor, e = (h, t, s, a) => {
@@ -14,7 +14,7 @@ var $ = Object.defineProperty, E = Object.getOwnPropertyDescriptor, e = (h, t, s
14
14
  };
15
15
  const u = class u extends m {
16
16
  constructor() {
17
- super(...arguments), this.cols = 20, this.debug = !1, this.hideLabel = !1, this.label = "Default label", this.rows = 2, this.size = "md", this.validateOn = "change", this.value = "", this.invalid = !1, this._resetValue = (t) => {
17
+ super(...arguments), this.size = "md", this.validateOn = "change", this.value = "", this.invalid = !1, this._resetValue = (t) => {
18
18
  var s;
19
19
  t.stopPropagation(), this.value = ((s = this.getAttribute("value")) == null ? void 0 : s.trim()) ?? "", this._internals.setFormValue(this.value), this.$input.focus();
20
20
  }, this._handleInput = () => {
@@ -22,7 +22,7 @@ const u = class u extends m {
22
22
  };
23
23
  }
24
24
  set customInvalid(t) {
25
- this.customError = String(t);
25
+ this.customError = t || "";
26
26
  }
27
27
  get customInvalid() {
28
28
  return this.customError;
@@ -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
  }
@@ -78,14 +78,15 @@ const u = class u extends m {
78
78
  render() {
79
79
  var t, s;
80
80
  return p`
81
- <div id="field">
81
+ <div id="root">
82
82
  <label>
83
83
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
84
- ${this.label} ${this.required ? c(this.requiredLabel) : null}
84
+ <slot>${this.label}</slot> ${this.required ? c(this.requiredLabel) : null}
85
85
  </div>
86
86
  <div id="input">
87
87
  <textarea
88
88
  ?disabled=${this.disabled}
89
+ ?readonly=${this.readonly}
89
90
  ?required=${this.required}
90
91
  .value=${this.value}
91
92
  @input=${this._handleInput}
@@ -93,22 +94,24 @@ const u = class u extends m {
93
94
  aria-errormessage=${n((s = this.hint) != null && s.trim() ? "hint" : v)}
94
95
  aria-invalid=${!!this.invalid}
95
96
  cols=${n(this.cols)}
96
- name=${n(this.name)}
97
97
  maxlength=${n(this.maxLength)}
98
98
  minlength=${n(this.minLength)}
99
+ name=${n(this.name)}
99
100
  placeholder=${n(this.placeholder)}
100
- ?readonly=${this.readonly}
101
101
  rows=${n(this.rows)}
102
102
  >
103
103
  </textarea>
104
104
  </div>
105
105
  </label>
106
- ${this.hint && p`<skf-hint
107
- aria-live=${this.invalid ? "assertive" : "polite"}
108
- id="hint"
109
- severity=${n(_(this.severity, this.invalid))}
110
- >${this.hint}</skf-hint
111
- >`}
106
+ ${this.hint && p`
107
+ <skf-hint
108
+ aria-live=${this.invalid ? "assertive" : "polite"}
109
+ id="hint"
110
+ severity=${n(_(this.severity, this.invalid))}
111
+ >
112
+ ${this.customInvalid ? this.customInvalid : this.hint}
113
+ </skf-hint>
114
+ `}
112
115
  </div>
113
116
  `;
114
117
  }
@@ -170,10 +173,10 @@ e([
170
173
  r()
171
174
  ], i.prototype, "value", 2);
172
175
  e([
173
- f()
176
+ b()
174
177
  ], i.prototype, "invalid", 2);
175
178
  e([
176
- b("textarea")
179
+ f("textarea")
177
180
  ], i.prototype, "$input", 2);
178
181
  function _(h, t) {
179
182
  return t ? "error" : h;
@@ -0,0 +1,35 @@
1
+ import { SkfElement } from '../../internal/components/skf-element';
2
+ import { type CSSResultGroup } from 'lit';
3
+ /**
4
+ * SkfToast is the only component a user (developer) interacts with to create a toast notification. Once rendered it will invoke a singleton instance to manage the toast notifications.
5
+ * The singleton instance will create a new toast notification (using SkfAlert) and append it to SkfToastWrapper (or append SkfToastWrapper if it doesn't exist yet) and mount that to the DOM.
6
+ * Once a toast notification is created, it will be removed after a set amount of time (if not set as a closeable SkfToast) together with the original SkfToast.
7
+ * Once the queue in the singleton is empty, the SkfToastWrapper will be removed from the DOM.
8
+ */
9
+ /**
10
+ * A simple toast component that displays a message to the user. Use by appending a &lt;skf-toast&gt; tag to the DOM. Position in DOM is irrelevant.
11
+ *
12
+ * @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/98e432-toast) for design principles
13
+ *
14
+ * @slot - The component's placeholder content
15
+ *
16
+ * @tagname skf-toast
17
+ */
18
+ export declare class SkfToast extends SkfElement {
19
+ static styles: CSSResultGroup;
20
+ private _singleton?;
21
+ /** If provided, adds a close button to the toast and will not disapear until user actively dismisses it. */
22
+ closeable: boolean;
23
+ debug: boolean;
24
+ /** Severity of the toast. */
25
+ severity: 'info' | 'success' | 'warning' | 'error';
26
+ /** Time in seconds before the toast disappears. */
27
+ timer: number;
28
+ /** offsets where toasts emerge vertically */
29
+ topOffset?: number;
30
+ /** @internal */
31
+ _slottedText: Node[];
32
+ constructor();
33
+ firstUpdated(): void;
34
+ render(): import("lit").TemplateResult<1>;
35
+ }
@@ -0,0 +1,52 @@
1
+ import { Singleton as h } from "./toast.singleton.js";
2
+ import { SkfElement as d } from "../../internal/components/skf-element.js";
3
+ import { html as f } from "lit";
4
+ import { property as s, queryAssignedNodes as y } from "lit/decorators.js";
5
+ import { styles as a } from "./toast.styles.js";
6
+ var u = Object.defineProperty, o = (l, i, n, b) => {
7
+ for (var e = void 0, r = l.length - 1, m; r >= 0; r--)
8
+ (m = l[r]) && (e = m(i, n, e) || e);
9
+ return e && u(i, n, e), e;
10
+ };
11
+ const p = class p extends d {
12
+ constructor() {
13
+ super(), this.closeable = !1, this.debug = !1, this.severity = "info", this.timer = 5, this._singleton = void 0;
14
+ }
15
+ firstUpdated() {
16
+ this._singleton = new h(this.getRootNode()), this._singleton.addData({
17
+ text: this._slottedText.map((i) => i.textContent).join(),
18
+ timer: this.timer = this.timer && this.timer < 5 ? 5 : this.timer,
19
+ closeable: this.closeable,
20
+ originEl: this,
21
+ severity: this.severity,
22
+ topOffset: this.topOffset,
23
+ debug: this.debug
24
+ });
25
+ }
26
+ render() {
27
+ return f`<slot></slot>`;
28
+ }
29
+ };
30
+ p.styles = [a];
31
+ let t = p;
32
+ o([
33
+ s({ type: Boolean })
34
+ ], t.prototype, "closeable");
35
+ o([
36
+ s({ type: Boolean })
37
+ ], t.prototype, "debug");
38
+ o([
39
+ s()
40
+ ], t.prototype, "severity");
41
+ o([
42
+ s({ type: Number })
43
+ ], t.prototype, "timer");
44
+ o([
45
+ s({ type: Number })
46
+ ], t.prototype, "topOffset");
47
+ o([
48
+ y()
49
+ ], t.prototype, "_slottedText");
50
+ export {
51
+ t as SkfToast
52
+ };
@@ -0,0 +1,8 @@
1
+ import { SkfToast } from './toast.component';
2
+ export * from './toast.component';
3
+ export default SkfToast;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'skf-toast': SkfToast;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { SkfToast as t } from "./toast.component.js";
2
+ t.define("skf-toast");
3
+ export {
4
+ t as SkfToast,
5
+ t as default
6
+ };
@@ -0,0 +1,26 @@
1
+ import '../toast-item/toast-item.js';
2
+ import '../toast-wrapper/toast-wrapper.js';
3
+ import type { SkfToast } from '../toast/toast.component.js';
4
+ interface ToastData {
5
+ text: string;
6
+ timer: number;
7
+ closeable: boolean;
8
+ topOffset?: number;
9
+ originEl: SkfToast;
10
+ severity: 'info' | 'success' | 'warning' | 'error';
11
+ debug: boolean;
12
+ }
13
+ export declare class Singleton {
14
+ private static instance?;
15
+ data: ToastData[];
16
+ root: Document;
17
+ usePopover: boolean;
18
+ constructor(root: Document);
19
+ hasToasts(): boolean;
20
+ popToast(): ToastData | undefined;
21
+ getData(): ToastData[];
22
+ setData(data: ToastData[]): void;
23
+ addData(data: ToastData): void;
24
+ udpateUI(): void;
25
+ }
26
+ export {};