@skf-design-system/ui-components 0.0.1-beta.4 → 1.0.0-alpha.28

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 (167) hide show
  1. package/README.md +26 -6
  2. package/custom-elements.json +18265 -0
  3. package/dist/components/accordion/accordion.component.d.ts +9 -5
  4. package/dist/components/accordion/accordion.component.js +22 -19
  5. package/dist/components/accordion/accordion.d.ts +1 -1
  6. package/dist/components/accordion/accordion.styles.js +3 -3
  7. package/dist/components/alert/alert.component.d.ts +7 -4
  8. package/dist/components/alert/alert.component.js +21 -19
  9. package/dist/components/alert/alert.styles.js +50 -47
  10. package/dist/components/button/button.component.d.ts +24 -0
  11. package/dist/components/button/button.component.js +80 -56
  12. package/dist/components/button/button.styles.js +2 -1
  13. package/dist/components/card/card.component.d.ts +3 -3
  14. package/dist/components/card/card.component.js +16 -19
  15. package/dist/components/card/card.styles.js +11 -3
  16. package/dist/components/checkbox/checkbox.component.d.ts +17 -15
  17. package/dist/components/checkbox/checkbox.component.js +95 -89
  18. package/dist/components/checkbox/checkbox.styles.js +7 -2
  19. package/dist/components/checkbox/checkbox.test.d.ts +1 -0
  20. package/dist/components/collapse/collapse.component.d.ts +9 -6
  21. package/dist/components/collapse/collapse.component.js +39 -36
  22. package/dist/components/collapse/collapse.styles.js +3 -3
  23. package/dist/components/collapse/collapse.test.d.ts +1 -0
  24. package/dist/components/divider/divider.component.d.ts +13 -10
  25. package/dist/components/divider/divider.component.js +34 -29
  26. package/dist/components/divider/divider.styles.js +1 -5
  27. package/dist/components/heading/heading.component.d.ts +12 -2
  28. package/dist/components/heading/heading.component.js +14 -14
  29. package/dist/components/heading/heading.styles.js +1 -1
  30. package/dist/components/icon/icon.component.d.ts +14 -8
  31. package/dist/components/icon/icon.component.js +6 -6
  32. package/dist/components/icon/icon.styles.js +56 -54
  33. package/dist/components/input/input.component.d.ts +44 -29
  34. package/dist/components/input/input.component.js +118 -111
  35. package/dist/components/link/link.component.d.ts +15 -12
  36. package/dist/components/link/link.component.js +7 -7
  37. package/dist/components/link/link.styles.js +1 -1
  38. package/dist/components/loader/loader.component.d.ts +7 -7
  39. package/dist/components/loader/loader.component.js +35 -61
  40. package/dist/components/loader/loader.styles.js +42 -10
  41. package/dist/components/logo/logo.component.d.ts +5 -3
  42. package/dist/components/logo/logo.component.js +8 -8
  43. package/dist/components/logo/logo.styles.js +2 -2
  44. package/dist/components/progress/progress.component.d.ts +22 -0
  45. package/dist/components/progress/progress.component.js +40 -0
  46. package/dist/components/progress/progress.d.ts +8 -0
  47. package/dist/components/progress/progress.js +6 -0
  48. package/dist/components/progress/progress.styles.d.ts +1 -0
  49. package/dist/components/progress/progress.styles.js +47 -0
  50. package/dist/components/radio/radio.component.d.ts +18 -18
  51. package/dist/components/radio/radio.component.js +94 -78
  52. package/dist/components/radio/radio.styles.js +6 -1
  53. package/dist/components/select/select.component.d.ts +140 -0
  54. package/dist/components/select/select.component.js +327 -0
  55. package/dist/components/select/select.controllers.d.ts +59 -0
  56. package/dist/components/select/select.controllers.js +172 -0
  57. package/dist/components/select/select.d.ts +8 -0
  58. package/dist/components/select/select.js +6 -0
  59. package/dist/components/select/select.styles.d.ts +1 -0
  60. package/dist/components/select/select.styles.js +131 -0
  61. package/dist/components/select-option/select-option.component.d.ts +77 -0
  62. package/dist/components/select-option/select-option.component.js +123 -0
  63. package/dist/components/select-option/select-option.controllers.d.ts +9 -0
  64. package/dist/components/select-option/select-option.d.ts +8 -0
  65. package/dist/components/select-option/select-option.js +6 -0
  66. package/dist/components/select-option/select-option.styles.d.ts +1 -0
  67. package/dist/components/select-option/select-option.styles.js +53 -0
  68. package/dist/components/select-option-group/select-option-group.component.d.ts +16 -0
  69. package/dist/components/select-option-group/select-option-group.component.js +31 -0
  70. package/dist/components/select-option-group/select-option-group.d.ts +8 -0
  71. package/dist/components/select-option-group/select-option-group.js +6 -0
  72. package/dist/components/select-option-group/select-option-group.style.d.ts +1 -0
  73. package/dist/components/select-option-group/select-option-group.style.js +18 -0
  74. package/dist/components/switch/switch.component.d.ts +2 -3
  75. package/dist/components/switch/switch.component.js +5 -2
  76. package/dist/components/switch/switch.styles.js +6 -1
  77. package/dist/components/switch/switch.test.d.ts +1 -0
  78. package/dist/components/tab/tab.component.d.ts +29 -0
  79. package/dist/components/tab/tab.component.js +57 -0
  80. package/dist/components/tab/tab.d.ts +8 -0
  81. package/dist/components/tab/tab.js +6 -0
  82. package/dist/components/tab/tab.styles.d.ts +1 -0
  83. package/dist/components/tab/tab.styles.js +123 -0
  84. package/dist/components/tab-group/tab-group.component.d.ts +43 -0
  85. package/dist/components/tab-group/tab-group.component.js +98 -0
  86. package/dist/components/tab-group/tab-group.d.ts +8 -0
  87. package/dist/components/tab-group/tab-group.js +6 -0
  88. package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
  89. package/dist/components/tab-group/tab-group.styles.js +75 -0
  90. package/dist/components/tab-panel/tab-panel.component.d.ts +19 -0
  91. package/dist/components/tab-panel/tab-panel.component.js +36 -0
  92. package/dist/components/tab-panel/tab-panel.d.ts +8 -0
  93. package/dist/components/tab-panel/tab-panel.js +6 -0
  94. package/dist/components/tab-panel/tab-panel.styles.d.ts +1 -0
  95. package/dist/components/tab-panel/tab-panel.styles.js +13 -0
  96. package/dist/components/tag/tag.component.d.ts +25 -4
  97. package/dist/components/tag/tag.component.js +66 -29
  98. package/dist/components/tag/tag.styles.js +6 -5
  99. package/dist/components/textarea/textarea.component.d.ts +26 -23
  100. package/dist/components/textarea/textarea.component.js +20 -17
  101. package/dist/components/toast/toast.component.d.ts +35 -0
  102. package/dist/components/toast/toast.component.js +52 -0
  103. package/dist/components/toast/toast.d.ts +8 -0
  104. package/dist/components/toast/toast.js +6 -0
  105. package/dist/components/toast/toast.singleton.d.ts +26 -0
  106. package/dist/components/toast/toast.singleton.js +53 -0
  107. package/dist/components/toast/toast.styles.d.ts +1 -0
  108. package/dist/components/toast/toast.styles.js +9 -0
  109. package/dist/components/toast-item/toast-item.component.d.ts +21 -0
  110. package/dist/components/toast-item/toast-item.component.js +65 -0
  111. package/dist/components/toast-item/toast-item.d.ts +6 -0
  112. package/dist/components/toast-item/toast-item.js +2 -0
  113. package/dist/components/toast-item/toast-item.styles.d.ts +2 -0
  114. package/dist/components/toast-item/toast-item.styles.js +16 -0
  115. package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +24 -0
  116. package/dist/components/toast-wrapper/toast-wrapper.component.js +37 -0
  117. package/dist/components/toast-wrapper/toast-wrapper.d.ts +8 -0
  118. package/dist/components/toast-wrapper/toast-wrapper.js +6 -0
  119. package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
  120. package/dist/components/toast-wrapper/toast-wrapper.styles.js +20 -0
  121. package/dist/custom-elements.json +2146 -616
  122. package/dist/index.d.ts +8 -0
  123. package/dist/index.js +60 -36
  124. package/dist/internal/components/formBase.d.ts +19 -1
  125. package/dist/internal/components/formBase.js +29 -17
  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.d.ts +4 -4
  129. package/dist/internal/components/skf-element.js +15 -19
  130. package/dist/internal/helpers/array.d.ts +4 -0
  131. package/dist/internal/helpers/findMatchingTags.d.ts +2 -0
  132. package/dist/internal/helpers/findMatchingTags.js +12 -0
  133. package/dist/internal/helpers/hintSeverity.d.ts +2 -0
  134. package/dist/internal/helpers/hintSeverity.js +6 -0
  135. package/dist/internal/helpers/raiseError.d.ts +28 -0
  136. package/dist/internal/helpers/raiseError.js +29 -0
  137. package/dist/internal/helpers/watch.d.ts +27 -0
  138. package/dist/internal/helpers/watch.js +28 -0
  139. package/dist/internal/storybook/shadowRootTraverser.d.ts +16 -6
  140. package/dist/react/index.d.ts +9 -0
  141. package/dist/react/index.js +9 -0
  142. package/dist/react/skf-button/index.d.ts +7 -1
  143. package/dist/react/skf-button/index.js +5 -1
  144. package/dist/react/skf-progress/index.d.ts +3 -0
  145. package/dist/react/skf-progress/index.js +13 -0
  146. package/dist/react/skf-select/index.d.ts +21 -0
  147. package/dist/react/skf-select/index.js +21 -0
  148. package/dist/react/skf-select-option/index.d.ts +9 -0
  149. package/dist/react/skf-select-option/index.js +17 -0
  150. package/dist/react/skf-select-option-group/index.d.ts +3 -0
  151. package/dist/react/skf-select-option-group/index.js +13 -0
  152. package/dist/react/skf-tab/index.d.ts +12 -0
  153. package/dist/react/skf-tab/index.js +18 -0
  154. package/dist/react/skf-tab-group/index.d.ts +3 -0
  155. package/dist/react/skf-tab-group/index.js +13 -0
  156. package/dist/react/skf-tab-panel/index.d.ts +3 -0
  157. package/dist/react/skf-tab-panel/index.js +13 -0
  158. package/dist/react/skf-toast/index.d.ts +3 -0
  159. package/dist/react/skf-toast/index.js +13 -0
  160. package/dist/react/skf-toast-wrapper/index.d.ts +3 -0
  161. package/dist/react/skf-toast-wrapper/index.js +13 -0
  162. package/dist/styles/form-field.styles.js +11 -7
  163. package/dist/types/jsx/custom-element-jsx.d.ts +166 -995
  164. package/dist/types/vue/index.d.ts +368 -94
  165. package/dist/vscode.html-custom-data.json +408 -106
  166. package/dist/web-types.json +932 -281
  167. package/package.json +39 -35
@@ -0,0 +1,18 @@
1
+ import { css as e } from "lit";
2
+ const t = e`
3
+ @layer components {
4
+ #label {
5
+ align-items: center;
6
+ block-size: var(--_skf-select-option-group-height, var(--skf-size-44));
7
+ display: flex;
8
+ font-weight: var(--skf-font-weight-bold);
9
+
10
+ :host-context(skf-select[size='sm']) & {
11
+ --_skf-select-option-group-height: var(--skf-size-32);
12
+ }
13
+ }
14
+ }
15
+ `;
16
+ export {
17
+ t as styles
18
+ };
@@ -9,13 +9,12 @@ import { type CSSResultGroup } from 'lit';
9
9
  * @attribute {boolean} disabled - If true, sets disabled state
10
10
  * @attribute {boolean} required - If true, value is required or must be checked for the form to be submittable
11
11
  *
12
- * @slot - The component's placeholder content
12
+ * @slot - The Switchs label. Alternatively, you can use the `label` attribute.
13
13
  *
14
14
  * @tagname skf-switch
15
15
  */
16
16
  export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
17
17
  static styles: CSSResultGroup;
18
- /** @internal */
19
18
  private _initialChecked;
20
19
  /** If true, outputs helping hints in console */
21
20
  debug?: boolean;
@@ -23,7 +22,7 @@ export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
23
22
  checked?: boolean;
24
23
  /** If true, hides the label visually */
25
24
  hideLabel?: boolean;
26
- /** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
25
+ /** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
27
26
  label?: string;
28
27
  /** If defined, adds name to the input-element */
29
28
  name?: string;
@@ -41,14 +41,17 @@ const h = class h extends o {
41
41
  var e;
42
42
  if (this._invalid = !1, this.required && !this.checked) {
43
43
  this.pristine || (this._invalid = !0);
44
- const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : ((e = this.$input) == null ? void 0 : e.validationMessage) ?? "Please check this box if you want to proceed";
44
+ const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
45
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
46
+ ((e = this.$input) == null ? void 0 : e.validationMessage) || "Please check this box if you want to proceed"
47
+ );
45
48
  this.setValidity({ valueMissing: !0 }, String(a));
46
49
  } else
47
50
  this.setValidity({});
48
51
  }
49
52
  render() {
50
53
  return c`
51
- <label id="switch">
54
+ <label id="root">
52
55
  <input
53
56
  ?checked=${this.checked}
54
57
  ?disabled=${this.disabled}
@@ -8,11 +8,16 @@ const t = [
8
8
  contain: layout;
9
9
  }
10
10
 
11
- label {
11
+ #root {
12
12
  align-items: center;
13
+ color: var(--_skf-switch-color, var(--skf-text-color-primary));
13
14
  display: flex;
14
15
  grid-gap: var(--skf-spacing-50);
15
16
 
17
+ :host([disabled]) & {
18
+ --_skf-switch-color: var(--skf-interactive-text-color-disabled);
19
+ }
20
+
16
21
  :host([size='sm']) & {
17
22
  --_skf-switch-height: var(--skf-size-20);
18
23
  --_skf-switch-width: var(--skf-size-32);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { SkfTabGroup } from '@components/tab-group/tab-group.component.js';
2
+ import { SkfElement } from '@internal/components/skf-element';
3
+ import { type CSSResultGroup } from 'lit';
4
+ export interface SkfTabEvent {
5
+ tab: SkfTab;
6
+ }
7
+ /**
8
+ * The `<skf-tab>` is a component that displays a list of actions or options
9
+ *
10
+ * @event {CustomEvent} skf-tab-select - {detail: { selected: true, tab: SkfTab }} Fires when the tab is selected
11
+ * @event click - Fired when the component is clicked
12
+ *
13
+ * @slot - The tab's label
14
+ *
15
+ * @tagname skf-tab
16
+ */
17
+ export declare class SkfTab extends SkfElement {
18
+ static styles: CSSResultGroup;
19
+ /** The name of the tab-panel this tab is associated with. The panel must be located in the same tab group. */
20
+ panel: string;
21
+ selected: boolean;
22
+ variant: SkfTabGroup['variant'];
23
+ constructor();
24
+ /** @internal */
25
+ handleSelectedChange(): void;
26
+ /** @internal */
27
+ private _handleClick;
28
+ render(): import("lit").TemplateResult<1>;
29
+ }
@@ -0,0 +1,57 @@
1
+ import { SkfElement as n } from "../../internal/components/skf-element.js";
2
+ import { watch as h } from "../../internal/helpers/watch.js";
3
+ import m from "../../styles/component.styles.js";
4
+ import { html as f } from "lit";
5
+ import { property as v, state as d } from "lit/decorators.js";
6
+ import { classMap as b } from "lit/directives/class-map.js";
7
+ import { styles as _ } from "./tab.styles.js";
8
+ var u = Object.defineProperty, y = Object.getOwnPropertyDescriptor, a = (c, s, l, r) => {
9
+ for (var e = r > 1 ? void 0 : r ? y(s, l) : s, i = c.length - 1, o; i >= 0; i--)
10
+ (o = c[i]) && (e = (r ? o(s, l, e) : o(e)) || e);
11
+ return r && e && u(s, l, e), e;
12
+ };
13
+ const p = class p extends n {
14
+ constructor() {
15
+ super(), this.panel = "", this.selected = !1, this.variant = "expanded", this._handleClick = () => {
16
+ this.emit("skf-tab-select", {
17
+ detail: {
18
+ tab: this
19
+ }
20
+ });
21
+ }, this.role = "tab", this.addEventListener("click", this._handleClick);
22
+ }
23
+ handleSelectedChange() {
24
+ this.ariaSelected = this.selected ? "true" : "false", this.tabIndex = this.selected ? 0 : -1;
25
+ }
26
+ render() {
27
+ return f`
28
+ <div
29
+ class=${b({
30
+ tab: !0,
31
+ "tab--expanded": this.variant === "expanded",
32
+ "tab--compressed": this.variant === "compressed",
33
+ "tab--selected": this.selected
34
+ })}
35
+ >
36
+ <slot class="tab__label"></slot>
37
+ </div>
38
+ `;
39
+ }
40
+ };
41
+ p.styles = [m, _];
42
+ let t = p;
43
+ a([
44
+ v({ reflect: !0 })
45
+ ], t.prototype, "panel", 2);
46
+ a([
47
+ d()
48
+ ], t.prototype, "selected", 2);
49
+ a([
50
+ d()
51
+ ], t.prototype, "variant", 2);
52
+ a([
53
+ h("selected")
54
+ ], t.prototype, "handleSelectedChange", 1);
55
+ export {
56
+ t as SkfTab
57
+ };
@@ -0,0 +1,8 @@
1
+ import { SkfTab } from './tab.component';
2
+ export * from './tab.component';
3
+ export default SkfTab;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'skf-tab': SkfTab;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { SkfTab as f } from "./tab.component.js";
2
+ f.define("skf-tab");
3
+ export {
4
+ f as SkfTab,
5
+ f as default
6
+ };
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,123 @@
1
+ import { css as o } from "lit";
2
+ const e = o`
3
+ /* stylelint-disable selector-class-pattern */
4
+ @layer components {
5
+ :host {
6
+ contain: layout;
7
+ min-width: 0; /* Needed for truncation */
8
+ outline: transparent;
9
+ }
10
+
11
+ .tab {
12
+ color: var(--_skf-tab-color, var(--skf-text-color-primary));
13
+ cursor: pointer;
14
+ position: relative;
15
+
16
+ /* Indicator */
17
+ &::after {
18
+ background-color: var(--skf-color-brand-base);
19
+ block-size: 3px;
20
+ content: '';
21
+ inset-inline: 50%;
22
+ opacity: 0;
23
+ position: absolute;
24
+ transition: all calc(var(--skf-motion-duration-fast) * 1ms) var(--skf-motion-easing-ease-in);
25
+ }
26
+
27
+ :host(:focus-visible) & {
28
+ outline: var(--skf-border-width-md) solid var(--skf-color-brand-base);
29
+ }
30
+ }
31
+
32
+ .tab--selected::after {
33
+ inset-inline: 0;
34
+ opacity: 1;
35
+ }
36
+
37
+ /**
38
+ * Compressed
39
+ */
40
+ .tab--compressed {
41
+ padding-block-end: var(--skf-spacing-25);
42
+
43
+ /* Invisible bold label copy, to avoid layout shifts when selected */
44
+ &::before {
45
+ block-size: 0;
46
+ content: attr(data-label);
47
+ display: block;
48
+ font-weight: var(--skf-font-weight-bold);
49
+ visibility: hidden;
50
+ }
51
+
52
+ &::after {
53
+ inset-block-end: 0;
54
+ }
55
+
56
+ &:hover,
57
+ &:active {
58
+ &::after {
59
+ inset-inline: 0;
60
+ opacity: 1;
61
+ }
62
+ }
63
+
64
+ :host(:focus-visible) & {
65
+ outline-offset: 2px;
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Expanded
71
+ */
72
+ .tab--expanded {
73
+ align-items: center;
74
+ background-color: var(--_skf-tab-bg-color, var(--skf-color-neutral-lightest));
75
+ block-size: var(--skf-size-44);
76
+ border-block-end: var(--skf-border-width-sm) solid
77
+ var(--_skf-tab-border-bottom-color, var(--skf-border-color-tertiary));
78
+ display: flex;
79
+ justify-content: center;
80
+ padding-inline: var(--skf-spacing-50);
81
+ transition: background-color calc(var(--skf-motion-duration-fast) * 1ms)
82
+ var(--skf-motion-easing-ease-in);
83
+
84
+ &::after {
85
+ inset-block-start: 0;
86
+ }
87
+
88
+ &:hover {
89
+ --_skf-tab-bg-color: var(--skf-color-blue-lighest);
90
+ }
91
+
92
+ :host(:focus-visible) & {
93
+ outline-offset: -2px;
94
+ }
95
+ }
96
+
97
+ .tab--expanded.tab--selected {
98
+ --_skf-tab-bg-color: var(--skf-bg-color-neutral-1);
99
+ --_skf-tab-border-bottom-color: transparent;
100
+ --_skf-tab-color: var(--skf-text-color-emphasised);
101
+
102
+ font-weight: var(--skf-font-weight-bold);
103
+
104
+ :host(:not(:first-of-type)) & {
105
+ border-inline-start: var(--skf-border-width-sm) solid var(--skf-border-color-tertiary);
106
+ }
107
+
108
+ :host(:not(:last-of-type)) & {
109
+ border-inline-end: var(--skf-border-width-sm) solid var(--skf-border-color-tertiary);
110
+ }
111
+ }
112
+
113
+ .tab__label {
114
+ display: block;
115
+ overflow-x: auto;
116
+ text-overflow: ellipsis;
117
+ white-space: nowrap;
118
+ }
119
+ }
120
+ `;
121
+ export {
122
+ e as styles
123
+ };
@@ -0,0 +1,43 @@
1
+ import '@components/card/card.js';
2
+ import { SkfElement } from '@internal/components/skf-element';
3
+ import { type CSSResultGroup, type PropertyValues } from 'lit';
4
+ /**
5
+ * The `<skf-tab-group>` is a component that displays a list of actions or options.
6
+ *
7
+ * @documentation See [zeroheight](https://zeroheight.com/****) for design principles
8
+ *
9
+ * @slot - Used for grouping tab panels in the tab group. Must be <skf-tab-panel> elements
10
+ * @slot tabs - Used for grouping tabs in the tab group. Must be <skf-tab> elements
11
+ *
12
+ * @tagname skf-tab-group
13
+ */
14
+ export declare class SkfTabGroup extends SkfElement {
15
+ static styles: CSSResultGroup;
16
+ /** Sets the default selected tab */
17
+ defaultSelected: number;
18
+ /** If true, removes border */
19
+ noBorder: boolean;
20
+ /** If true, removes padding */
21
+ noPadding: boolean;
22
+ /** If true, component fills the parent element height */
23
+ stretch: boolean;
24
+ /** Sets the appearance of the tabs */
25
+ variant: 'compressed' | 'expanded';
26
+ /** @internal */
27
+ private tabs;
28
+ /** @internal */
29
+ private panels;
30
+ firstUpdated(): void;
31
+ protected updated(_changedProperties: PropertyValues): void;
32
+ /** @internal */
33
+ private _getKeyDownNextTab;
34
+ /** @internal */
35
+ private _handleKeyDown;
36
+ /** @internal */
37
+ private _handleTabSelected;
38
+ /** @internal */
39
+ private _selectTab;
40
+ /** @internal */
41
+ private _syncTabsAndPanels;
42
+ render(): import("lit").TemplateResult<1>;
43
+ }
@@ -0,0 +1,98 @@
1
+ import "../card/card.js";
2
+ import { SkfElement as c } from "../../internal/components/skf-element.js";
3
+ import b from "../../styles/component.styles.js";
4
+ import { html as f } from "lit";
5
+ import { property as o, queryAssignedElements as p } from "lit/decorators.js";
6
+ import { classMap as u } from "lit/directives/class-map.js";
7
+ import { styles as y } from "./tab-group.styles.js";
8
+ var g = Object.defineProperty, i = (h, t, s, r) => {
9
+ for (var e = void 0, n = h.length - 1, d; n >= 0; n--)
10
+ (d = h[n]) && (e = d(t, s, e) || e);
11
+ return e && g(t, s, e), e;
12
+ };
13
+ const l = class l extends c {
14
+ constructor() {
15
+ super(...arguments), this.defaultSelected = 0, this.noBorder = !1, this.noPadding = !1, this.stretch = !1, this.variant = "expanded", this._handleKeyDown = (t) => {
16
+ if (["ArrowLeft", "ArrowRight"].includes(t.key)) {
17
+ const s = this._getKeyDownNextTab(t.key);
18
+ s.focus({ preventScroll: !0 }), this._selectTab(s);
19
+ }
20
+ }, this._handleTabSelected = (t) => {
21
+ const s = t.detail.tab;
22
+ this._selectTab(s);
23
+ }, this._selectTab = (t) => {
24
+ this.tabs.forEach((s) => {
25
+ const r = this.panels.find((e) => e.name === s.panel);
26
+ s.selected = s === t, r && (r.active = s === t);
27
+ });
28
+ }, this._syncTabsAndPanels = () => {
29
+ this.tabs.forEach((t, s) => {
30
+ const r = (s + 1).toString();
31
+ t.id = t.id ? t.id : `skf-tab-${r}`, t.selected = this.defaultSelected === s;
32
+ const e = this.panels.find((n) => n.name === t.panel);
33
+ e && (e.id = e.id ? e.id : `skf-tab-panel-${r}`, t.setAttribute("aria-controls", e.id), e.setAttribute("aria-labelledby", t.id), e.active = t.selected);
34
+ });
35
+ };
36
+ }
37
+ firstUpdated() {
38
+ this.addEventListener("skf-tab-select", this._handleTabSelected), this._syncTabsAndPanels();
39
+ }
40
+ updated(t) {
41
+ t.has("variant") && this.tabs.forEach((s) => {
42
+ s.variant = this.variant;
43
+ });
44
+ }
45
+ /** @internal */
46
+ _getKeyDownNextTab(t) {
47
+ const e = (this.tabs.findIndex((d) => d.selected) + (t === "ArrowRight" ? 1 : -1)) % this.tabs.length;
48
+ return this.tabs[e < 0 ? this.tabs.length - 1 : e];
49
+ }
50
+ render() {
51
+ return f`
52
+ <div
53
+ @keydown=${this._handleKeyDown}
54
+ class=${u({
55
+ "tab-group": !0,
56
+ "tab-group--compressed": this.variant === "compressed",
57
+ "tab-group--expanded": this.variant === "expanded",
58
+ "tab-group--no-border": this.noBorder,
59
+ "tab-group--no-padding": this.noPadding,
60
+ "tab-group--stretch": this.stretch
61
+ })}
62
+ >
63
+ <div class="tab-group__tabs" role="tablist">
64
+ <slot name="tabs"></slot>
65
+ </div>
66
+ <div class="tab-group__body">
67
+ <slot></slot>
68
+ </div>
69
+ </div>
70
+ `;
71
+ }
72
+ };
73
+ l.styles = [b, y];
74
+ let a = l;
75
+ i([
76
+ o({ type: Number, attribute: "default-selected" })
77
+ ], a.prototype, "defaultSelected");
78
+ i([
79
+ o({ type: Boolean, attribute: "no-border" })
80
+ ], a.prototype, "noBorder");
81
+ i([
82
+ o({ type: Boolean, attribute: "no-padding" })
83
+ ], a.prototype, "noPadding");
84
+ i([
85
+ o({ type: Boolean })
86
+ ], a.prototype, "stretch");
87
+ i([
88
+ o({ reflect: !0 })
89
+ ], a.prototype, "variant");
90
+ i([
91
+ p({ slot: "tabs" })
92
+ ], a.prototype, "tabs");
93
+ i([
94
+ p()
95
+ ], a.prototype, "panels");
96
+ export {
97
+ a as SkfTabGroup
98
+ };
@@ -0,0 +1,8 @@
1
+ import { SkfTabGroup } from './tab-group.component';
2
+ export * from './tab-group.component';
3
+ export default SkfTabGroup;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'skf-tab-group': SkfTabGroup;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { SkfTabGroup as f } from "./tab-group.component.js";
2
+ f.define("skf-tab-group");
3
+ export {
4
+ f as SkfTabGroup,
5
+ f as default
6
+ };
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,75 @@
1
+ import { css as r } from "lit";
2
+ const a = r`
3
+ /* stylelint-disable selector-class-pattern */
4
+ @layer components {
5
+ :host {
6
+ contain: layout;
7
+ }
8
+
9
+ :host([stretch]) {
10
+ block-size: 100%;
11
+ }
12
+
13
+ /**
14
+ * Root
15
+ */
16
+ .tab-group {
17
+ background-color: var(--skf-bg-color-neutral-1);
18
+ }
19
+
20
+ .tab-group--expanded {
21
+ border: var(
22
+ --_skf-tab-group-border,
23
+ var(--skf-border-width-sm) solid var(--skf-border-color-tertiary)
24
+ );
25
+ border-end-end-radius: var(--skf-border-radius-sm);
26
+ border-end-start-radius: var(--skf-border-radius-sm);
27
+ box-shadow: var(--skf-shadow-md);
28
+
29
+ ::slotted(skf-tab) {
30
+ flex: 1;
31
+ }
32
+ }
33
+
34
+ .tab-group--no-border {
35
+ --_skf-tab-group-border: none;
36
+ }
37
+
38
+ .tab-group--stretch {
39
+ block-size: inherit;
40
+ display: flex;
41
+ flex-direction: column;
42
+ }
43
+
44
+ /**
45
+ * Tabs
46
+ */
47
+ .tab-group__tabs {
48
+ display: flex;
49
+
50
+ .tab-group--compressed & {
51
+ gap: var(--skf-spacing-100);
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Body
57
+ */
58
+ .tab-group__body {
59
+ padding-block: var(--_skf-tab-group-body-padding-block, var(--skf-spacing-100) 0);
60
+
61
+ .tab-group--stretch & {
62
+ overflow-y: auto;
63
+ }
64
+
65
+ .tab-group--expanded:not(.tab-group--no-padding) & {
66
+ --_skf-tab-group-body-padding-block: var(--skf-spacing-100);
67
+
68
+ padding-inline: var(--skf-spacing-100);
69
+ }
70
+ }
71
+ }
72
+ `;
73
+ export {
74
+ a as styles
75
+ };
@@ -0,0 +1,19 @@
1
+ import { SkfElement } from '@internal/components/skf-element';
2
+ import { type CSSResultGroup } from 'lit';
3
+ /**
4
+ * The `<skf-tab-panel>` is a component that displays a list of actions or options.
5
+ *
6
+ * @slot - The tab panel's content
7
+ *
8
+ * @tagname skf-tab-panel
9
+ */
10
+ export declare class SkfTabPanel extends SkfElement {
11
+ static styles: CSSResultGroup;
12
+ /** The tab panel's name. */
13
+ name: string;
14
+ active: boolean;
15
+ constructor();
16
+ /** @internal */
17
+ handleActiveChanged(): void;
18
+ render(): import("lit").TemplateResult<1>;
19
+ }
@@ -0,0 +1,36 @@
1
+ import { SkfElement as c } from "../../internal/components/skf-element.js";
2
+ import { watch as h } from "../../internal/helpers/watch.js";
3
+ import l from "../../styles/component.styles.js";
4
+ import { html as v } from "lit";
5
+ import { property as f, state as d } from "lit/decorators.js";
6
+ import { styles as y } from "./tab-panel.styles.js";
7
+ var u = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, a = (n, r, s, o) => {
8
+ for (var t = o > 1 ? void 0 : o ? _(r, s) : r, i = n.length - 1, p; i >= 0; i--)
9
+ (p = n[i]) && (t = (o ? p(r, s, t) : p(t)) || t);
10
+ return o && t && u(r, s, t), t;
11
+ };
12
+ const m = class m extends c {
13
+ constructor() {
14
+ super(), this.name = "", this.active = !1, this.role = "tabpanel";
15
+ }
16
+ handleActiveChanged() {
17
+ this.ariaHidden = this.active ? "false" : "true", this.tabIndex = this.active ? 0 : -1;
18
+ }
19
+ render() {
20
+ return v`<slot></slot>`;
21
+ }
22
+ };
23
+ m.styles = [l, y];
24
+ let e = m;
25
+ a([
26
+ f()
27
+ ], e.prototype, "name", 2);
28
+ a([
29
+ d()
30
+ ], e.prototype, "active", 2);
31
+ a([
32
+ h("active")
33
+ ], e.prototype, "handleActiveChanged", 1);
34
+ export {
35
+ e as SkfTabPanel
36
+ };
@@ -0,0 +1,8 @@
1
+ import { SkfTabPanel } from './tab-panel.component';
2
+ export * from './tab-panel.component';
3
+ export default SkfTabPanel;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'skf-tab-panel': SkfTabPanel;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { SkfTabPanel as a } from "./tab-panel.component.js";
2
+ a.define("skf-tab-panel");
3
+ export {
4
+ a as SkfTabPanel,
5
+ a as default
6
+ };
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,13 @@
1
+ import { css as i } from "lit";
2
+ const s = i`
3
+ :host {
4
+ content-visibility: hidden;
5
+ }
6
+
7
+ :host([aria-hidden='false']) {
8
+ content-visibility: visible;
9
+ }
10
+ `;
11
+ export {
12
+ s as styles
13
+ };