@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,11 +1,11 @@
1
- import '@components/icon/icon.js';
2
- import { SkfElement } from '@internal/components/skf-element.js';
3
- import type { HeadingType } from '@internal/constants/heading.js';
1
+ import '../icon/icon.js';
2
+ import { SkfElement } from '../../internal/components/skf-element.js';
3
+ import type { HeadingType } from '../../internal/constants/heading.js';
4
4
  import type { CSSResultGroup } from 'lit';
5
5
  /**
6
6
  * The `<skf-collapse>` component is a general purpose container for content that can be collapsed / expanded.
7
7
  *
8
- * See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/6229e2eb8a8dacf366dc3243) for design principles.
8
+ * See [zeroheight](https://zeroheight.com/853e936c9/p/6590bf-accordion) for design principles.
9
9
  *
10
10
  * @event {CustomEvent} skf-collapse-toggle - Event emitted when toggled
11
11
  *
@@ -21,7 +21,10 @@ export declare class SkfCollapse extends SkfElement {
21
21
  expanded: boolean;
22
22
  /** Heading for the collapse */
23
23
  heading?: string;
24
- /** Controls which heading element will be rendered */
24
+ /**
25
+ * Defines which heading element will be rendered
26
+ * @type { "h2" | "h3" | "h4" }
27
+ */
25
28
  headingAs: Exclude<HeadingType, 'h1'>;
26
29
  /** If true, renders the small version */
27
30
  small: boolean;
@@ -1,15 +1,17 @@
1
1
  import "../icon/icon.js";
2
- import { SkfElement as h } from "../../internal/components/skf-element.js";
3
- import m from "../../styles/component.styles.js";
4
- import { property as a } from "lit/decorators.js";
5
- import { html as c, unsafeStatic as l } from "lit/static-html.js";
6
- import u from "./collapse.styles.js";
7
- var f = Object.defineProperty, s = (o, r, d, y) => {
8
- for (var t = void 0, i = o.length - 1, p; i >= 0; i--)
9
- (p = o[i]) && (t = p(r, d, t) || t);
10
- return t && f(r, d, t), t;
2
+ import { SkfElement as c } from "../../internal/components/skf-element.js";
3
+ import h from "../../styles/component.styles.js";
4
+ import { property as s } from "lit/decorators.js";
5
+ import { classMap as m } from "lit/directives/class-map.js";
6
+ import { ifDefined as f } from "lit/directives/if-defined.js";
7
+ import { html as u, unsafeStatic as d } from "lit/static-html.js";
8
+ import _ from "./collapse.styles.js";
9
+ var y = Object.defineProperty, a = (i, n, r, g) => {
10
+ for (var t = void 0, l = i.length - 1, p; l >= 0; l--)
11
+ (p = i[l]) && (t = p(n, r, t) || t);
12
+ return t && y(n, r, t), t;
11
13
  };
12
- const n = class n extends h {
14
+ const o = class o extends c {
13
15
  constructor() {
14
16
  super(...arguments), this.animated = !1, this.expanded = !1, this.headingAs = "h2", this.small = !1, this.truncate = !1, this._toggle = () => {
15
17
  this.dispatchEvent(
@@ -30,45 +32,54 @@ const n = class n extends h {
30
32
  this.expanded = !0;
31
33
  }
32
34
  render() {
33
- return c`
34
- <${l(this.headingAs)} id="heading">
35
- <button
36
- @click=${this._toggle}
37
- aria-controls="main"
38
- aria-expanded=${this.expanded}
39
- type="button"
40
- >
41
- <span id="label">${this.heading}</span>
42
- <skf-icon name=${this.expanded ? "caretUp" : "caretDown"}></skf-icon>
43
- </button>
44
- </${l(this.headingAs)}>
45
- <div id="body">
46
- <div id="main" data-testid="main">
47
- <slot></slot>
35
+ return u`
36
+ <div class=${m({
37
+ collapse: !0,
38
+ "collapse--animated": this.animated,
39
+ "collapse--expanded": this.expanded,
40
+ "collapse--small": this.small,
41
+ "collapse--truncate": this.truncate
42
+ })}>
43
+ <${d(this.headingAs)} class="collapse__heading">
44
+ <button
45
+ @click=${this._toggle}
46
+ aria-controls="main"
47
+ aria-expanded=${f(this.expanded ? "true" : "false")}
48
+ class="collapse__btn"
49
+ type="button"
50
+ >
51
+ <span class="collapse__label">${this.heading}</span>
52
+ <skf-icon class="collapse__icon" name=${this.expanded ? "caretUp" : "caretDown"}></skf-icon>
53
+ </button>
54
+ </${d(this.headingAs)}>
55
+ <div class="collapse__body">
56
+ <div class="collapse__main" data-testid="main" id="main">
57
+ <slot></slot>
58
+ </div>
48
59
  </div>
49
60
  </div>
50
61
  `;
51
62
  }
52
63
  };
53
- n.styles = [m, u];
54
- let e = n;
55
- s([
56
- a({ type: Boolean, reflect: !0 })
64
+ o.styles = [h, _];
65
+ let e = o;
66
+ a([
67
+ s({ type: Boolean, reflect: !0 })
57
68
  ], e.prototype, "animated");
58
- s([
59
- a({ type: Boolean, reflect: !0 })
69
+ a([
70
+ s({ type: Boolean, reflect: !0 })
60
71
  ], e.prototype, "expanded");
61
- s([
62
- a()
72
+ a([
73
+ s()
63
74
  ], e.prototype, "heading");
64
- s([
65
- a({ attribute: "heading-as" })
75
+ a([
76
+ s({ attribute: "heading-as" })
66
77
  ], e.prototype, "headingAs");
67
- s([
68
- a({ type: Boolean, reflect: !0 })
78
+ a([
79
+ s({ type: Boolean, reflect: !0 })
69
80
  ], e.prototype, "small");
70
- s([
71
- a({ type: Boolean, reflect: !0 })
81
+ a([
82
+ s({ type: Boolean, reflect: !0 })
72
83
  ], e.prototype, "truncate");
73
84
  export {
74
85
  e as SkfCollapse
@@ -1,22 +1,23 @@
1
1
  import { css as a } from "lit";
2
2
  const s = a`
3
+ /* stylelint-disable selector-class-pattern */
3
4
  @layer components {
4
- :host {
5
+ .collapse {
5
6
  background: var(--skf-bg-color-neutral-1);
6
7
  border-bottom: var(--skf-border-width-sm) solid var(--skf-border-color-tertiary);
7
8
  }
8
9
 
9
- #heading {
10
+ .collapse__heading {
10
11
  font-size: var(--_skf-collapse-heading-size, var(--skf-font-size-100));
11
12
  font-weight: var(--_skf-collapse-heading-weight, normal);
12
13
 
13
- :host([small]) & {
14
+ .collapse--small & {
14
15
  --_skf-collapse-heading-size: var(--skf-font-size-75);
15
16
  --_skf-collapse-heading-weight: var(--skf-font-weight-medium);
16
17
  }
17
18
  }
18
19
 
19
- button {
20
+ .collapse__btn {
20
21
  align-items: center;
21
22
  display: flex;
22
23
  padding-block: var(--_skf-collapse-button-padding-block, var(--skf-spacing-50));
@@ -28,39 +29,39 @@ const s = a`
28
29
  outline-offset: -2px;
29
30
  }
30
31
 
31
- :host([small]) & {
32
+ .collapse--small & {
32
33
  --_skf-collapse-button-padding-block: var(--skf-spacing-25);
33
34
  }
34
35
  }
35
36
 
36
- #label {
37
- :host([truncate]:not([expanded])) & {
37
+ .collapse__label {
38
+ .collapse--truncate:not(.collapse--expanded) & {
38
39
  overflow: hidden;
39
40
  text-overflow: ellipsis;
40
41
  white-space: nowrap;
41
42
  }
42
43
  }
43
44
 
44
- skf-icon {
45
+ .collapse__icon {
45
46
  margin-inline-start: auto;
46
47
  }
47
48
 
48
- #body {
49
+ .collapse__body {
49
50
  display: grid;
50
51
  grid-template-rows: var(--_skf-collapse-body-height, 0fr);
51
52
  padding-inline: var(--skf-spacing-75);
52
53
 
53
- :host([animated]) & {
54
+ .collapse--animated & {
54
55
  transition: grid-template-rows calc(var(--skf-motion-duration-normal) * 1ms)
55
56
  var(--skf-motion-easing-ease-in);
56
57
  }
57
58
 
58
- :host([expanded]) & {
59
+ .collapse--expanded & {
59
60
  --_skf-collapse-body-height: 1fr;
60
61
  }
61
62
  }
62
63
 
63
- #main {
64
+ .collapse__main {
64
65
  overflow: hidden;
65
66
 
66
67
  &::after {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,75 @@
1
+ import '../button/button.js';
2
+ import '../heading/heading.js';
3
+ import '../icon/icon.js';
4
+ import { SkfElement } from '../../internal/components/skf-element';
5
+ import { type CSSResultGroup } from 'lit';
6
+ /**
7
+ * TODO: Is modal the right name? Should it be "blocking" or "blocking-dialog"?
8
+ *
9
+ * TBD: Should we inert the page behind the dialog? Maybe only if it is modal-dialog?
10
+ *
11
+ * TBD: Should we disable scrolling on the page behind the dialog? Maybe only if it is modal?
12
+ */
13
+ /**
14
+ * The `<skf-dialog>` is a component that open up a dialog with the content provided
15
+ *
16
+ * @documentation See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/6229d63d9fe16020a60657e5) for design principles
17
+ *
18
+ * @slot - The dialog component's content
19
+ * @slot heading - The dialog component's heading
20
+ * @slot footer - The dialog component's buttons goes here
21
+ *
22
+ * @event skf-dialog-open - Fires when the dialog is opened (after transitioned in)
23
+ * @event skf-dialog-close - Fires when the dialog is closed (before transitioned out)
24
+ * @event close - Fires when the dialog is closed (after transitioned out)
25
+ *
26
+ * @cssproperty --skf-dialog-height - A custom height for the Dialog. Pass valid CSS **block-size** values
27
+ * @cssproperty --skf-dialog-width - A custom width for the Dialog Pass valid CSS **inline-size** values
28
+ *
29
+ * @tagname skf-dialog
30
+ */
31
+ export declare class SkfDialog extends SkfElement {
32
+ #private;
33
+ static styles: CSSResultGroup;
34
+ /** If defined, sets the aria-label for the close button */
35
+ closeButtonAriaLabel?: string;
36
+ /** Title for the modal/dialog */
37
+ heading?: string;
38
+ /** If true, makes the dialog stretch edge to edge on screen */
39
+ fullscreen: boolean;
40
+ /** If true, removes the close button */
41
+ noCloseButton?: boolean | undefined;
42
+ /** If defined, removes the inner padding */
43
+ noPadding: boolean;
44
+ open?: boolean | null;
45
+ /** If provided, will run function on dialog close */
46
+ onClose?: ((event: Event) => void) | null;
47
+ /** @internal */
48
+ $dialog: HTMLDialogElement;
49
+ /** @internal */
50
+ footerEls?: HTMLElement[];
51
+ /** @internal */
52
+ modal: boolean;
53
+ /** @internal */
54
+ renderFoot: boolean;
55
+ protected firstUpdated(): void;
56
+ handleOpenChange(): void;
57
+ /** @internal */
58
+ show: () => Promise<boolean>;
59
+ /** @internal */
60
+ _transition(): {
61
+ entry: () => Promise<unknown>;
62
+ exit: () => Promise<unknown>;
63
+ };
64
+ /** @internal */
65
+ _handleBackdropClick: (event: MouseEvent) => void;
66
+ /** @internal */
67
+ _handleClose: (event: Event) => void;
68
+ /** @internal */
69
+ get _isModal(): boolean;
70
+ /** Method that opens the dialog in modal state */
71
+ showModal: () => Promise<boolean>;
72
+ /** Method that closes the dialog */
73
+ close: () => Promise<boolean | undefined>;
74
+ render(): import("lit").TemplateResult<1>;
75
+ }
@@ -0,0 +1,189 @@
1
+ var _ = (t) => {
2
+ throw TypeError(t);
3
+ };
4
+ var w = (t, e, o) => e.has(t) || _("Cannot " + o);
5
+ var f = (t, e, o) => (w(t, e, "read from private field"), o ? o.call(t) : e.get(t)), g = (t, e, o) => e.has(t) ? _("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, o), h = (t, e, o, a) => (w(t, e, "write to private field"), a ? a.call(t, o) : e.set(t, o), o);
6
+ import "../button/button.js";
7
+ import "../heading/heading.js";
8
+ import "../icon/icon.js";
9
+ import { SkfElement as v } from "../../internal/components/skf-element.js";
10
+ import { watch as C } from "../../internal/helpers/watch.js";
11
+ import B from "../../styles/component.styles.js";
12
+ import { html as b, nothing as k } from "lit";
13
+ import { property as c, state as m, query as P, queryAssignedElements as M } from "lit/decorators.js";
14
+ import { classMap as $ } from "lit/directives/class-map.js";
15
+ import { styles as O } from "./dialog.styles.js";
16
+ var A = Object.defineProperty, E = Object.getOwnPropertyDescriptor, i = (t, e, o, a) => {
17
+ for (var n = a > 1 ? void 0 : a ? E(e, o) : e, l = t.length - 1, r; l >= 0; l--)
18
+ (r = t[l]) && (n = (a ? r(e, o, n) : r(n)) || n);
19
+ return a && n && A(e, o, n), n;
20
+ }, p, u, d;
21
+ const y = class y extends v {
22
+ constructor() {
23
+ super(...arguments);
24
+ g(this, p);
25
+ g(this, u);
26
+ g(this, d);
27
+ h(this, p, 0), h(this, u, 20), h(this, d, !1), this.fullscreen = !1, this.noCloseButton = !1, this.noPadding = !1, this.onClose = null, this.modal = !0, this.renderFoot = !1, this.show = async () => await this.showModal(), this._handleBackdropClick = (o) => {
28
+ this._isModal || o.target !== this.$dialog || this.close();
29
+ }, this._handleClose = (o) => {
30
+ console.log("Handle close reached"), this.onClose && this.onClose(o), this.close();
31
+ }, this.showModal = async () => await (async () => (console.log("%cmodal ->", "color: red", this.modal), this.$dialog.showModal(), await this._transition().entry(), this.emit("skf-dialog-open"), !0))(), this.close = async () => (console.log("close reached"), f(this, d) ? void 0 : (h(this, d, !0), await (async () => (this.emit("skf-dialog-close"), await this._transition().exit(), this.$dialog.close(), this.open = !1, h(this, d, !1), !0))()));
32
+ }
33
+ firstUpdated() {
34
+ this.$dialog.addEventListener("close", (o) => {
35
+ o.stopPropagation(), console.log("close event detected 1", o), this.emit("close");
36
+ });
37
+ }
38
+ handleOpenChange() {
39
+ var o;
40
+ switch (!0) {
41
+ case (this.open === !0 && !!this.modal):
42
+ this.showModal();
43
+ break;
44
+ case (this.open === !0 && !this.modal):
45
+ this.show();
46
+ break;
47
+ case this.open === !1:
48
+ this.close();
49
+ break;
50
+ }
51
+ this.open && (this.renderFoot = !!((o = this.footerEls) != null && o.length));
52
+ }
53
+ /** @internal */
54
+ _transition() {
55
+ const o = this.fullscreen ? {} : {
56
+ translate: `${String(f(this, p))} ${String(f(this, u))}px`
57
+ };
58
+ return { entry: () => new Promise((l) => {
59
+ const r = this.$dialog.animate(
60
+ [
61
+ {
62
+ opacity: 0,
63
+ ...o
64
+ },
65
+ { opacity: 1, translate: "0 0" }
66
+ ],
67
+ {
68
+ duration: 200,
69
+ fill: "forwards",
70
+ easing: "ease-out"
71
+ }
72
+ );
73
+ this.$dialog.animate([{ opacity: 0 }, { opacity: 1 }], {
74
+ duration: 200,
75
+ fill: "forwards",
76
+ pseudoElement: "::backdrop"
77
+ }), r.onfinish = () => {
78
+ l("opened");
79
+ };
80
+ }), exit: () => new Promise((l) => {
81
+ const r = this.$dialog.animate(
82
+ [
83
+ { opacity: 1, translate: "0 0" },
84
+ {
85
+ opacity: 0,
86
+ ...o
87
+ }
88
+ ],
89
+ {
90
+ duration: 200,
91
+ fill: "forwards",
92
+ easing: "ease-in"
93
+ }
94
+ );
95
+ this.$dialog.animate([{ opacity: 1 }, { opacity: 0 }], {
96
+ duration: 200,
97
+ fill: "forwards",
98
+ pseudoElement: "::backdrop"
99
+ }), r.onfinish = () => {
100
+ l("closed");
101
+ };
102
+ }) };
103
+ }
104
+ /** @internal */
105
+ get _isModal() {
106
+ return typeof this.modal == "string";
107
+ }
108
+ render() {
109
+ return b`
110
+ <dialog
111
+ @close=${this._handleClose}
112
+ @mousedown=${this._handleBackdropClick}
113
+ @touchstart=${this._handleBackdropClick}
114
+ autofocus
115
+ class=${$({
116
+ dialog: !0,
117
+ "dialog--fullscreen": this.fullscreen,
118
+ "dialog--no-padding": this.noPadding
119
+ })}
120
+ >
121
+ <div class="dialog__head">
122
+ <h2 class="dialog__heading">
123
+ <slot name="heading"></slot>
124
+ </h2>
125
+ ${this.noCloseButton ? k : b`
126
+ <button
127
+ @click=${this._handleClose}
128
+ aria-label=${this.closeButtonAriaLabel ?? "Close dialog"}
129
+ class="dialog__close-btn"
130
+ >
131
+ <skf-icon name="close" color="inverse"></skf-icon>
132
+ </button>
133
+ `}
134
+ </div>
135
+ <div class="dialog__body">
136
+ <slot class="dialog__main"></slot>
137
+ <slot
138
+ class=${$({
139
+ dialog__foot: !0,
140
+ "dialog__foot-hidden": !this.renderFoot
141
+ })}
142
+ name="footer"
143
+ ></slot>
144
+ </div>
145
+ </dialog>
146
+ `;
147
+ }
148
+ };
149
+ p = new WeakMap(), u = new WeakMap(), d = new WeakMap(), y.styles = [B, O];
150
+ let s = y;
151
+ i([
152
+ c({ attribute: "close-button-aria-label" })
153
+ ], s.prototype, "closeButtonAriaLabel", 2);
154
+ i([
155
+ c()
156
+ ], s.prototype, "heading", 2);
157
+ i([
158
+ c({ type: Boolean })
159
+ ], s.prototype, "fullscreen", 2);
160
+ i([
161
+ c({ type: Boolean, attribute: "no-close-button" })
162
+ ], s.prototype, "noCloseButton", 2);
163
+ i([
164
+ c({ type: Boolean, attribute: "no-padding" })
165
+ ], s.prototype, "noPadding", 2);
166
+ i([
167
+ c({ type: Boolean, reflect: !0 })
168
+ ], s.prototype, "open", 2);
169
+ i([
170
+ m()
171
+ ], s.prototype, "onClose", 2);
172
+ i([
173
+ P("dialog")
174
+ ], s.prototype, "$dialog", 2);
175
+ i([
176
+ M({ slot: "footer" })
177
+ ], s.prototype, "footerEls", 2);
178
+ i([
179
+ m()
180
+ ], s.prototype, "modal", 2);
181
+ i([
182
+ m()
183
+ ], s.prototype, "renderFoot", 2);
184
+ i([
185
+ C("open")
186
+ ], s.prototype, "handleOpenChange", 1);
187
+ export {
188
+ s as SkfDialog
189
+ };
@@ -0,0 +1,8 @@
1
+ import { SkfDialog } from './dialog.component';
2
+ export * from './dialog.component';
3
+ export default SkfDialog;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'skf-dialog': SkfDialog;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { SkfDialog as f } from "./dialog.component.js";
2
+ f.define("skf-dialog");
3
+ export {
4
+ f as SkfDialog,
5
+ f as default
6
+ };
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,91 @@
1
+ import { css as a } from "lit";
2
+ const o = a`
3
+ /* stylelint-disable selector-class-pattern */
4
+ @layer components {
5
+ .dialog {
6
+ --_skf-dialog-head-height: var(--skf-size-48);
7
+ --_skf-dialog-inset: var(--skf-spacing-100);
8
+
9
+ all: unset;
10
+ background-color: var(--skf-bg-color-neutral-1);
11
+ display: none;
12
+ grid-template:
13
+ 'head' auto
14
+ 'body' calc(100% - var(--_skf-dialog-head-height)) / 1fr;
15
+ inset: var(--_skf-dialog-inset);
16
+ max-block-size: calc(100% - var(--_skf-dialog-inset) * 2);
17
+ overflow: hidden;
18
+ position: fixed;
19
+
20
+ &[open] {
21
+ display: grid;
22
+ }
23
+
24
+ &:not(.dialog--fullscreen) {
25
+ block-size: var(--skf-dialog-height, fit-content);
26
+ margin: auto;
27
+ max-inline-size: min(100%, var(--skf-dialog-width, 400px));
28
+ }
29
+
30
+ &::backdrop {
31
+ background-color: color-mix(in srgb, var(--skf-bg-color-neutral-7), transparent);
32
+ }
33
+ }
34
+
35
+ .dialog__head {
36
+ align-items: center;
37
+ background-color: var(--skf-color-brand-base);
38
+ block-size: var(--_skf-dialog-head-height);
39
+ display: flex;
40
+ grid-area: head;
41
+ justify-content: space-between;
42
+ padding-inline: var(--skf-box-spacing);
43
+ }
44
+
45
+ .dialog__heading {
46
+ color: var(--skf-text-color-inverse);
47
+ font-size: var(--skf-font-size-200);
48
+ }
49
+
50
+ .dialog__close-btn {
51
+ align-items: center;
52
+ display: flex;
53
+
54
+ &:focus-visible {
55
+ border-radius: var(--skf-border-radius-sm);
56
+ outline: var(--skf-border-width-sm) solid var(--skf-interactive-text-color-inverse);
57
+ }
58
+ }
59
+
60
+ .dialog__body {
61
+ /* block-size: calc(100% - (var(--_skf-dialog-head-height) + (var(--skf-box-spacing) * 2))); */
62
+ display: flex;
63
+ flex-direction: column;
64
+ row-gap: var(--skf-spacing-100);
65
+
66
+ .dialog:not(.dialog--no-padding) & {
67
+ padding: var(--skf-box-spacing);
68
+ }
69
+ }
70
+
71
+ .dialog__main {
72
+ display: block;
73
+ flex: 1;
74
+ overflow-y: auto;
75
+ }
76
+
77
+ .dialog__foot {
78
+ display: flex;
79
+ flex-wrap: wrap;
80
+ gap: var(--skf-spacing-100);
81
+ justify-content: flex-end;
82
+ }
83
+
84
+ .dialog__foot--hidden {
85
+ display: none;
86
+ }
87
+ }
88
+ `;
89
+ export {
90
+ o as styles
91
+ };
@@ -1,8 +1,10 @@
1
- import { SkfElement } from '@internal/components/skf-element.js';
1
+ import { SkfElement } from '../../internal/components/skf-element.js';
2
2
  import type { BorderColor } from '@skf-design-system/ui-assets';
3
3
  import { type CSSResultGroup } from 'lit';
4
4
  /**
5
- * The `<Divider>` component can separate items from each other, to visually emphasize their lack of a relationship between groups of information.
5
+ * The `<Divider>` component can separate items from each other, to visually emphasize their lack of a relationship between groups of information
6
+ *
7
+ * @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/3831f1-divider) for design principles
6
8
  *
7
9
  * @cssproperty --skf-divider-spacing - The amount of space the divider occupies. Pass valid CSS **margin-block** values when horizontal and **margin-inline** when vertical
8
10
  * @cssproperty --skf-divider-inset - The amount of space the divider should be indented. Pass valid CSS **margin-inline** values when horizontal and **margin-block** when vertical
@@ -10,17 +12,18 @@ import { type CSSResultGroup } from 'lit';
10
12
  * @tagname skf-divider
11
13
  */
12
14
  export declare class SkfDivider extends SkfElement {
15
+ #private;
13
16
  static styles: CSSResultGroup;
14
- /** If provided, alters the Divider color */
15
- /** @type { "emphasised" | "primary" | "secondary" | "tertiary" | "inverse" } */
16
- color?: BorderColor;
17
+ /**
18
+ * Defines the Divider color
19
+ * @type { "emphasised" | "primary" | "secondary" | "tertiary" | "inverse" }
20
+ */
21
+ color: BorderColor;
17
22
  /** If true, renders a div for presentational purpose instead of the semantic hr-element */
18
- decorative?: boolean | undefined;
23
+ decorative: boolean;
19
24
  /** If true, renders the divider vertically */
20
- vertical?: boolean | undefined;
21
- /** @internal */
22
- private renderDecorative;
23
- /** @internal */
24
- private renderDefault;
25
+ vertical: boolean;
26
+ constructor();
27
+ connectedCallback(): void;
25
28
  render(): import("lit").TemplateResult<1>;
26
29
  }