@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.
- package/README.md +26 -6
- package/dist/components/accordion/accordion-item.d.ts +1 -1
- package/dist/components/accordion/accordion.component.d.ts +13 -9
- package/dist/components/accordion/accordion.component.js +34 -30
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordion.styles.d.ts +1 -2
- package/dist/components/accordion/accordion.styles.js +5 -4
- package/dist/components/alert/alert.component.d.ts +10 -7
- package/dist/components/alert/alert.component.js +50 -37
- package/dist/components/alert/alert.styles.d.ts +1 -2
- package/dist/components/alert/alert.styles.js +42 -34
- package/dist/components/button/button.component.d.ts +28 -4
- package/dist/components/button/button.component.js +80 -56
- package/dist/components/button/button.styles.js +2 -1
- package/dist/components/card/card.component.d.ts +1 -1
- package/dist/components/card/card.component.js +29 -21
- package/dist/components/card/card.styles.d.ts +1 -2
- package/dist/components/card/card.styles.js +22 -12
- package/dist/components/checkbox/checkbox.component.d.ts +20 -18
- package/dist/components/checkbox/checkbox.component.js +95 -89
- package/dist/components/checkbox/checkbox.styles.js +7 -2
- package/dist/components/checkbox/checkbox.test.d.ts +1 -0
- package/dist/components/collapse/collapse.component.d.ts +8 -5
- package/dist/components/collapse/collapse.component.js +50 -39
- package/dist/components/collapse/collapse.styles.js +13 -12
- package/dist/components/collapse/collapse.test.d.ts +1 -0
- package/dist/components/dialog/dialog.component.d.ts +75 -0
- package/dist/components/dialog/dialog.component.js +189 -0
- package/dist/components/dialog/dialog.d.ts +8 -0
- package/dist/components/dialog/dialog.js +6 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +91 -0
- package/dist/components/divider/divider.component.d.ts +14 -11
- package/dist/components/divider/divider.component.js +46 -29
- package/dist/components/divider/divider.styles.d.ts +1 -2
- package/dist/components/divider/divider.styles.js +26 -30
- package/dist/components/heading/heading.component.d.ts +14 -4
- package/dist/components/heading/heading.component.js +14 -14
- package/dist/components/heading/heading.styles.js +1 -1
- package/dist/components/icon/icon.component.d.ts +15 -9
- package/dist/components/icon/icon.component.js +6 -6
- package/dist/components/icon/icon.styles.js +56 -54
- package/dist/components/input/input.component.d.ts +48 -33
- package/dist/components/input/input.component.js +108 -99
- package/dist/components/link/link.component.d.ts +20 -17
- package/dist/components/link/link.component.js +20 -14
- package/dist/components/link/link.styles.js +36 -40
- package/dist/components/loader/loader.component.d.ts +7 -7
- package/dist/components/loader/loader.component.js +42 -61
- package/dist/components/loader/loader.styles.js +44 -11
- package/dist/components/logo/logo.component.d.ts +7 -5
- package/dist/components/logo/logo.component.js +25 -14
- package/dist/components/logo/logo.styles.d.ts +1 -2
- package/dist/components/logo/logo.styles.js +12 -10
- package/dist/components/progress/progress.component.d.ts +22 -0
- package/dist/components/progress/progress.component.js +49 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +6 -0
- package/dist/components/progress/progress.styles.d.ts +1 -0
- package/dist/components/progress/progress.styles.js +48 -0
- package/dist/components/radio/radio.component.d.ts +21 -21
- package/dist/components/radio/radio.component.js +94 -78
- package/dist/components/radio/radio.styles.js +6 -1
- package/dist/components/select/select.component.d.ts +14 -12
- package/dist/components/select/select.component.js +119 -103
- package/dist/components/select/select.controllers.d.ts +1 -1
- package/dist/components/select/select.controllers.js +5 -2
- package/dist/components/select/select.styles.js +18 -3
- package/dist/components/select-option/select-option.component.d.ts +3 -3
- package/dist/components/select-option/select-option.component.js +16 -10
- package/dist/components/select-option/select-option.controllers.d.ts +1 -1
- package/dist/components/select-option-group/select-option-group.component.d.ts +1 -1
- package/dist/components/switch/switch.component.d.ts +4 -5
- package/dist/components/switch/switch.component.js +17 -7
- package/dist/components/switch/switch.styles.js +19 -11
- package/dist/components/switch/switch.test.d.ts +1 -0
- package/dist/components/tab/tab.component.d.ts +29 -0
- package/dist/components/tab/tab.component.js +57 -0
- package/dist/components/tab/tab.d.ts +8 -0
- package/dist/components/tab/tab.js +6 -0
- package/dist/components/tab/tab.styles.d.ts +1 -0
- package/dist/components/tab/tab.styles.js +123 -0
- package/dist/components/tab-group/tab-group.component.d.ts +43 -0
- package/dist/components/tab-group/tab-group.component.js +98 -0
- package/dist/components/tab-group/tab-group.d.ts +8 -0
- package/dist/components/tab-group/tab-group.js +6 -0
- package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
- package/dist/components/tab-group/tab-group.styles.js +75 -0
- package/dist/components/tab-panel/tab-panel.component.d.ts +19 -0
- package/dist/components/tab-panel/tab-panel.component.js +36 -0
- package/dist/components/tab-panel/tab-panel.d.ts +8 -0
- package/dist/components/tab-panel/tab-panel.js +6 -0
- package/dist/components/tab-panel/tab-panel.styles.d.ts +1 -0
- package/dist/components/tab-panel/tab-panel.styles.js +13 -0
- package/dist/components/tag/tag.component.d.ts +14 -9
- package/dist/components/tag/tag.component.js +63 -47
- package/dist/components/tag/tag.styles.js +35 -28
- package/dist/components/textarea/textarea.component.d.ts +30 -27
- package/dist/components/textarea/textarea.component.js +20 -17
- package/dist/components/toast/toast.component.d.ts +35 -0
- package/dist/components/toast/toast.component.js +52 -0
- package/dist/components/toast/toast.d.ts +8 -0
- package/dist/components/toast/toast.js +6 -0
- package/dist/components/toast/toast.singleton.d.ts +26 -0
- package/dist/components/toast/toast.singleton.js +53 -0
- package/dist/components/toast/toast.styles.d.ts +1 -0
- package/dist/components/toast/toast.styles.js +9 -0
- package/dist/components/toast-item/toast-item.component.d.ts +21 -0
- package/dist/components/toast-item/toast-item.component.js +65 -0
- package/dist/components/toast-item/toast-item.d.ts +6 -0
- package/dist/components/toast-item/toast-item.js +2 -0
- package/dist/components/toast-item/toast-item.styles.d.ts +2 -0
- package/dist/components/toast-item/toast-item.styles.js +16 -0
- package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +24 -0
- package/dist/components/toast-wrapper/toast-wrapper.component.js +37 -0
- package/dist/components/toast-wrapper/toast-wrapper.d.ts +8 -0
- package/dist/components/toast-wrapper/toast-wrapper.js +6 -0
- package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
- package/dist/components/toast-wrapper/toast-wrapper.styles.js +20 -0
- package/dist/custom-elements.json +3090 -1993
- package/dist/index.d.ts +6 -0
- package/dist/index.js +60 -42
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -11
- package/dist/internal/components/hint/hint.component.d.ts +2 -2
- package/dist/internal/components/hint/hint.component.js +12 -10
- package/dist/internal/components/hint/hint.styles.js +26 -10
- package/dist/internal/components/skf-element.js +26 -25
- package/dist/internal/helpers/hintSeverity.d.ts +1 -1
- package/dist/internal/helpers/watch.d.ts +27 -0
- package/dist/internal/helpers/watch.js +28 -0
- package/dist/internal/storybook/shadowRootTraverser.d.ts +16 -8
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +7 -6
- package/dist/react/index.d.ts +10 -3
- package/dist/react/index.js +10 -3
- package/dist/react/skf-button/index.d.ts +7 -1
- package/dist/react/skf-button/index.js +5 -1
- package/dist/react/skf-dialog/index.d.ts +15 -0
- package/dist/react/skf-dialog/index.js +19 -0
- package/dist/react/skf-progress/index.d.ts +3 -0
- package/dist/react/skf-progress/index.js +13 -0
- package/dist/react/skf-tab/index.d.ts +12 -0
- package/dist/react/skf-tab/index.js +18 -0
- package/dist/react/skf-tab-group/index.d.ts +3 -0
- package/dist/react/skf-tab-group/index.js +13 -0
- package/dist/react/skf-tab-panel/index.d.ts +3 -0
- package/dist/react/skf-tab-panel/index.js +13 -0
- package/dist/react/skf-toast/index.d.ts +3 -0
- package/dist/react/skf-toast/index.js +13 -0
- package/dist/react/skf-toast-wrapper/index.d.ts +3 -0
- package/dist/react/skf-toast-wrapper/index.js +13 -0
- package/dist/styles/component.styles.js +15 -2
- package/dist/styles/form-field.styles.js +5 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +300 -117
- package/dist/types/vue/index.d.ts +266 -76
- package/dist/vscode.html-custom-data.json +349 -216
- package/dist/web-types.json +686 -292
- package/package.json +33 -32
@@ -1,28 +1,31 @@
|
|
1
1
|
import { visuallyHidden as s } from "../../styles/util.styles.js";
|
2
2
|
import { css as r } from "lit";
|
3
|
-
const
|
3
|
+
const o = [
|
4
4
|
s,
|
5
5
|
r`
|
6
|
+
/* stylelint-disable selector-class-pattern */
|
6
7
|
@layer components {
|
7
8
|
:host {
|
8
9
|
contain: layout;
|
9
10
|
}
|
10
11
|
|
11
|
-
|
12
|
+
.switch {
|
12
13
|
align-items: center;
|
14
|
+
color: var(--_skf-switch-color, var(--skf-text-color-primary));
|
13
15
|
display: flex;
|
14
16
|
grid-gap: var(--skf-spacing-50);
|
15
17
|
|
16
|
-
:
|
17
|
-
--_skf-switch-
|
18
|
-
--_skf-switch-width: var(--skf-size-32);
|
19
|
-
|
20
|
-
font-size: var(--skf-font-size-75);
|
21
|
-
font-weight: var(--skf-font-weight-medium);
|
18
|
+
&:has(:disabled) {
|
19
|
+
--_skf-switch-color: var(--skf-interactive-text-color-disabled);
|
22
20
|
}
|
23
21
|
}
|
24
22
|
|
25
|
-
|
23
|
+
.switch--small {
|
24
|
+
font-size: var(--skf-font-size-75);
|
25
|
+
font-weight: var(--skf-font-weight-medium);
|
26
|
+
}
|
27
|
+
|
28
|
+
.switch__input {
|
26
29
|
--_skf-switch-width: var(--skf-size-44);
|
27
30
|
--_skf-switch-height: var(--skf-size-24);
|
28
31
|
|
@@ -67,14 +70,19 @@ const t = [
|
|
67
70
|
&:disabled {
|
68
71
|
--_skf-switch-bg-color: var(--skf-interactive-bg-color-disabled);
|
69
72
|
}
|
73
|
+
|
74
|
+
.switch--small & {
|
75
|
+
--_skf-switch-height: var(--skf-size-20);
|
76
|
+
--_skf-switch-width: var(--skf-size-32);
|
77
|
+
}
|
70
78
|
}
|
71
79
|
|
72
|
-
|
80
|
+
.switch__asterisk {
|
73
81
|
color: var(--skf-severity-fg-color-error);
|
74
82
|
}
|
75
83
|
}
|
76
84
|
`
|
77
85
|
];
|
78
86
|
export {
|
79
|
-
|
87
|
+
o as styles
|
80
88
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import type { SkfTabGroup } from '../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 @@
|
|
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 '../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 @@
|
|
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 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|