@skf-design-system/ui-components 1.0.0-beta.5 → 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/dist/components/accordion/accordion-item.d.ts +1 -1
- package/dist/components/accordion/accordion.component.d.ts +4 -4
- package/dist/components/accordion/accordion.component.js +18 -17
- 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 +3 -3
- package/dist/components/alert/alert.component.js +44 -33
- package/dist/components/alert/alert.styles.d.ts +1 -2
- package/dist/components/alert/alert.styles.js +29 -24
- package/dist/components/button/button.component.d.ts +26 -4
- package/dist/components/button/button.component.js +78 -54
- package/dist/components/button/button.styles.js +1 -0
- package/dist/components/card/card.component.d.ts +4 -4
- package/dist/components/card/card.component.js +35 -24
- package/dist/components/card/card.styles.d.ts +1 -2
- package/dist/components/card/card.styles.js +14 -12
- package/dist/components/checkbox/checkbox.component.d.ts +11 -12
- package/dist/components/checkbox/checkbox.component.js +95 -89
- package/dist/components/collapse/collapse.component.d.ts +8 -8
- package/dist/components/collapse/collapse.component.js +42 -34
- package/dist/components/collapse/collapse.styles.js +15 -14
- 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.js +91 -0
- package/dist/components/divider/divider.component.d.ts +3 -3
- package/dist/components/divider/divider.component.js +39 -27
- package/dist/components/divider/divider.styles.d.ts +1 -2
- package/dist/components/divider/divider.styles.js +26 -26
- package/dist/components/heading/heading.component.d.ts +2 -2
- package/dist/components/icon/icon.component.d.ts +1 -1
- package/dist/components/input/input.component.d.ts +12 -11
- package/dist/components/input/input.component.js +88 -89
- package/dist/components/link/link.component.d.ts +6 -6
- 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 +2 -2
- package/dist/components/loader/loader.component.js +32 -25
- package/dist/components/loader/loader.styles.js +11 -10
- package/dist/components/logo/logo.component.d.ts +3 -3
- 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 +11 -9
- 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.js +48 -0
- package/dist/components/radio/radio.component.d.ts +7 -9
- package/dist/components/radio/radio.component.js +93 -77
- package/dist/components/select/select.component.d.ts +2 -2
- package/dist/components/select/select.component.js +16 -13
- package/dist/components/select/select.controllers.d.ts +1 -1
- package/dist/components/select-option/select-option.component.d.ts +1 -1
- 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 +2 -2
- package/dist/components/switch/switch.component.js +17 -7
- package/dist/components/switch/switch.styles.js +16 -13
- 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 +2 -2
- package/dist/components/tag/tag.component.js +61 -45
- package/dist/components/tag/tag.styles.js +30 -28
- package/dist/components/textarea/textarea.component.d.ts +4 -4
- package/dist/components/textarea/textarea.component.js +5 -5
- package/dist/components/toast/toast.component.d.ts +1 -1
- package/dist/components/toast/toast.component.js +13 -13
- package/dist/components/toast/toast.singleton.d.ts +3 -3
- package/dist/components/toast/toast.styles.d.ts +1 -0
- package/dist/components/toast-item/toast-item.component.d.ts +1 -1
- package/dist/components/toast-item/toast-item.component.js +1 -1
- package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +2 -2
- package/dist/components/toast-wrapper/toast-wrapper.component.js +1 -1
- package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
- package/dist/custom-elements.json +1170 -511
- package/dist/index.d.ts +5 -0
- package/dist/index.js +59 -44
- 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/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/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +7 -6
- package/dist/react/index.d.ts +7 -2
- package/dist/react/index.js +7 -2
- 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/styles/component.styles.js +15 -2
- package/dist/types/jsx/custom-element-jsx.d.ts +246 -101
- package/dist/types/vue/index.d.ts +215 -65
- package/dist/vscode.html-custom-data.json +276 -182
- package/dist/web-types.json +556 -248
- package/package.json +33 -32
- /package/dist/components/{toast-wrapper/toast-wrapper.style.d.ts → dialog/dialog.styles.d.ts} +0 -0
- /package/dist/components/{toast/toast.style.d.ts → progress/progress.styles.d.ts} +0 -0
- /package/dist/components/toast/{toast.style.js → toast.styles.js} +0 -0
- /package/dist/components/toast-item/{toast-item.style.d.ts → toast-item.styles.d.ts} +0 -0
- /package/dist/components/toast-item/{toast-item.style.js → toast-item.styles.js} +0 -0
- /package/dist/components/toast-wrapper/{toast-wrapper.style.js → toast-wrapper.styles.js} +0 -0
@@ -1,26 +1,26 @@
|
|
1
|
-
import { computePosition as v, flip as
|
1
|
+
import { computePosition as v, flip as f, shift as _, offset as g } from "@floating-ui/dom";
|
2
2
|
import { FormBase as b } from "../../internal/components/formBase.js";
|
3
3
|
import { findMatchingTags as y } from "../../internal/helpers/findMatchingTags.js";
|
4
4
|
import { hintSeverity as O } from "../../internal/helpers/hintSeverity.js";
|
5
5
|
import { raiseError as w } from "../../internal/helpers/raiseError.js";
|
6
6
|
import { Asterisk as x } from "../../internal/templates/asterisk.js";
|
7
7
|
import $ from "../../styles/component.styles.js";
|
8
|
-
import { html as h, nothing as
|
8
|
+
import { html as h, nothing as V } from "lit";
|
9
9
|
import { property as o, state as d, query as p } from "lit/decorators.js";
|
10
|
-
import { classMap as
|
10
|
+
import { classMap as S } from "lit/directives/class-map.js";
|
11
11
|
import { ifDefined as m } from "lit/directives/if-defined.js";
|
12
12
|
import "../../internal/components/hint/hint.js";
|
13
13
|
import "../tag/tag.js";
|
14
|
-
import { ScrollController as C, ResizeController as k, GlobalClickController as
|
14
|
+
import { ScrollController as C, ResizeController as k, GlobalClickController as L, KeyboardNavigationController as A, DeveloperFeedbackController as E } from "./select.controllers.js";
|
15
15
|
import { styles as P } from "./select.styles.js";
|
16
|
-
var
|
17
|
-
for (var r = i > 1 ? void 0 : i ?
|
16
|
+
var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor, l = (u, t, e, i) => {
|
17
|
+
for (var r = i > 1 ? void 0 : i ? D(t, e) : t, n = u.length - 1, a; n >= 0; n--)
|
18
18
|
(a = u[n]) && (r = (i ? a(t, e, r) : a(r)) || r);
|
19
|
-
return i && r &&
|
19
|
+
return i && r && T(t, e, r), r;
|
20
20
|
};
|
21
21
|
const c = class c extends b {
|
22
22
|
constructor() {
|
23
|
-
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.scrollController = new C(this), this.resizeController = new k(this), this.globalClickController = new
|
23
|
+
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.scrollController = new C(this), this.resizeController = new k(this), this.globalClickController = new L(this), this.keyboardNavController = new A(this), this.developerFeedbackController = new E(this), this._handleOptionSelected = (t) => {
|
24
24
|
this._pristine = !1;
|
25
25
|
const e = this._selectedOptions.length > 0;
|
26
26
|
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
@@ -38,7 +38,7 @@ const c = class c extends b {
|
|
38
38
|
const i = this.$selectBtn, r = this.$dropdown;
|
39
39
|
!i || !r || (r.showPopover(), v(i, r, {
|
40
40
|
placement: "bottom",
|
41
|
-
middleware: [
|
41
|
+
middleware: [f(), _({ padding: 5 }), g(2)]
|
42
42
|
}).then(({ x: n, y: a }) => {
|
43
43
|
Object.assign(r.style, {
|
44
44
|
left: `${String(n)}px`,
|
@@ -137,7 +137,7 @@ const c = class c extends b {
|
|
137
137
|
attributeChangedCallback(t, e, i) {
|
138
138
|
if (super.attributeChangedCallback(t, e, i), t === "custom-invalid")
|
139
139
|
if (typeof i == "string") {
|
140
|
-
const n =
|
140
|
+
const n = this.withFallback(i);
|
141
141
|
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, n), this.checkValidity();
|
142
142
|
} else
|
143
143
|
this.setValidity({}), this._validateInput();
|
@@ -211,7 +211,7 @@ const c = class c extends b {
|
|
211
211
|
>
|
212
212
|
<span
|
213
213
|
id="selected-value"
|
214
|
-
class=${
|
214
|
+
class=${S({ "selected-value": !0, "contains-meta-info": !this.value })}>
|
215
215
|
${this._computeVisibleValue()}
|
216
216
|
</span>
|
217
217
|
<skf-icon class="arrow" name="chevronDown"></skf-icon>
|
@@ -225,15 +225,18 @@ const c = class c extends b {
|
|
225
225
|
${this.selectedOptions.map(
|
226
226
|
(t) => h`
|
227
227
|
<skf-tag
|
228
|
+
style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
228
229
|
removable
|
229
|
-
.onRemove=${(e) => (e.stopPropagation(), e.preventDefault(), t.removeAttribute("selected"),
|
230
|
+
.onRemove=${(e) => (e.stopPropagation(), e.preventDefault(), document.startViewTransition || t.removeAttribute("selected"), document.startViewTransition(() => {
|
231
|
+
t.removeAttribute("selected");
|
232
|
+
}), !1)}
|
230
233
|
>
|
231
234
|
${t.textContent}
|
232
235
|
</skf-tag>
|
233
236
|
`
|
234
237
|
)}
|
235
238
|
</div>
|
236
|
-
` :
|
239
|
+
` : V}
|
237
240
|
${this.hint && h`
|
238
241
|
<skf-hint
|
239
242
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { SkfSelectOption } from '
|
1
|
+
import type { SkfSelectOption } from '../select-option/select-option.component.js';
|
2
2
|
import type { ReactiveController } from 'lit';
|
3
3
|
import type { SkfSelect } from './select.component.js';
|
4
4
|
type ControllerHost = SkfSelect;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { SkfElement } from '
|
1
|
+
import { SkfElement } from '../../internal/components/skf-element.js';
|
2
2
|
import type { SeverityFgColor } from '@skf-design-system/ui-assets';
|
3
3
|
import { type CSSResultGroup } from 'lit';
|
4
4
|
import '../icon/icon';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { SkfSelectOption } from '
|
1
|
+
import type { SkfSelectOption } from '../select-option/select-option.component.js';
|
2
2
|
import type { ReactiveController } from 'lit';
|
3
3
|
type ControllerHost = SkfSelectOption;
|
4
4
|
export declare class DeveloperFeedbackController implements ReactiveController {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { FormBase } from '
|
2
|
-
import type { FormFieldBaseProps } from '
|
1
|
+
import { FormBase } from '../../internal/components/formBase.js';
|
2
|
+
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
3
3
|
import { type CSSResultGroup } from 'lit';
|
4
4
|
/**
|
5
5
|
* The `<skf-switch>` is a component that displays a list of actions or options
|
@@ -3,9 +3,10 @@ import { Asterisk as u } from "../../internal/templates/asterisk.js";
|
|
3
3
|
import p from "../../styles/component.styles.js";
|
4
4
|
import { html as c } from "lit";
|
5
5
|
import { property as s, state as v, query as f } from "lit/decorators.js";
|
6
|
-
import {
|
6
|
+
import { classMap as m } from "lit/directives/class-map.js";
|
7
|
+
import { ifDefined as _ } from "lit/directives/if-defined.js";
|
7
8
|
import { styles as b } from "./switch.styles.js";
|
8
|
-
var y = Object.defineProperty, i = (d, e, a,
|
9
|
+
var y = Object.defineProperty, i = (d, e, a, g) => {
|
9
10
|
for (var l = void 0, r = d.length - 1, n; r >= 0; r--)
|
10
11
|
(n = d[r]) && (l = n(e, a, l) || l);
|
11
12
|
return l && y(e, a, l), l;
|
@@ -41,14 +42,22 @@ const h = class h extends o {
|
|
41
42
|
var e;
|
42
43
|
if (this._invalid = !1, this.required && !this.checked) {
|
43
44
|
this.pristine || (this._invalid = !0);
|
44
|
-
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
45
|
+
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
46
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
47
|
+
((e = this.$input) == null ? void 0 : e.validationMessage) || "Please check this box if you want to proceed"
|
48
|
+
);
|
45
49
|
this.setValidity({ valueMissing: !0 }, String(a));
|
46
50
|
} else
|
47
51
|
this.setValidity({});
|
48
52
|
}
|
49
53
|
render() {
|
50
54
|
return c`
|
51
|
-
<label
|
55
|
+
<label
|
56
|
+
class=${m({
|
57
|
+
switch: !0,
|
58
|
+
"switch--small": this.size === "sm"
|
59
|
+
})}
|
60
|
+
>
|
52
61
|
<input
|
53
62
|
?checked=${this.checked}
|
54
63
|
?disabled=${this.disabled}
|
@@ -57,13 +66,14 @@ const h = class h extends o {
|
|
57
66
|
@invalid=${this._handleInvalid}
|
58
67
|
@reset=${this._resetValue}
|
59
68
|
aria-invalid=${!!this._invalid}
|
60
|
-
|
69
|
+
class="switch__input"
|
70
|
+
name=${_(this.name)}
|
61
71
|
type="checkbox"
|
62
72
|
value=${this.value}
|
63
73
|
/>
|
64
|
-
<div
|
74
|
+
<div class="switch__label">
|
65
75
|
<slot>${this.label}</slot>
|
66
|
-
${this.required ? u(this.requiredLabel) : null}
|
76
|
+
${this.required ? u(this.requiredLabel, "switch__asterisk") : null}
|
67
77
|
</div>
|
68
78
|
</label>
|
69
79
|
`;
|
@@ -1,33 +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;
|
13
14
|
color: var(--_skf-switch-color, var(--skf-text-color-primary));
|
14
15
|
display: flex;
|
15
16
|
grid-gap: var(--skf-spacing-50);
|
16
17
|
|
17
|
-
:
|
18
|
+
&:has(:disabled) {
|
18
19
|
--_skf-switch-color: var(--skf-interactive-text-color-disabled);
|
19
20
|
}
|
21
|
+
}
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
font-size: var(--skf-font-size-75);
|
26
|
-
font-weight: var(--skf-font-weight-medium);
|
27
|
-
}
|
23
|
+
.switch--small {
|
24
|
+
font-size: var(--skf-font-size-75);
|
25
|
+
font-weight: var(--skf-font-weight-medium);
|
28
26
|
}
|
29
27
|
|
30
|
-
|
28
|
+
.switch__input {
|
31
29
|
--_skf-switch-width: var(--skf-size-44);
|
32
30
|
--_skf-switch-height: var(--skf-size-24);
|
33
31
|
|
@@ -72,14 +70,19 @@ const t = [
|
|
72
70
|
&:disabled {
|
73
71
|
--_skf-switch-bg-color: var(--skf-interactive-bg-color-disabled);
|
74
72
|
}
|
73
|
+
|
74
|
+
.switch--small & {
|
75
|
+
--_skf-switch-height: var(--skf-size-20);
|
76
|
+
--_skf-switch-width: var(--skf-size-32);
|
77
|
+
}
|
75
78
|
}
|
76
79
|
|
77
|
-
|
80
|
+
.switch__asterisk {
|
78
81
|
color: var(--skf-severity-fg-color-error);
|
79
82
|
}
|
80
83
|
}
|
81
84
|
`
|
82
85
|
];
|
83
86
|
export {
|
84
|
-
|
87
|
+
o as styles
|
85
88
|
};
|
@@ -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;
|