@skf-design-system/ui-components 1.0.2-beta.2 → 1.0.2-beta.4
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 +7 -1
- package/dist/components/accordion/accordion-item.component.js +49 -38
- package/dist/components/accordion/accordion.component.d.ts +1 -1
- package/dist/components/accordion/accordion.component.js +10 -10
- package/dist/components/alert/alert.component.d.ts +5 -1
- package/dist/components/alert/alert.component.js +57 -54
- package/dist/components/alert/alert.styles.js +51 -47
- package/dist/components/breadcrumb/breadcrumb-item.component.js +24 -25
- package/dist/components/breadcrumb/breadcrumb-item.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.styles.js +16 -15
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +5 -2
- package/dist/components/breadcrumb/breadcrumb.component.js +51 -46
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb.styles.js +13 -10
- package/dist/components/button/button.component.js +39 -39
- package/dist/components/button/button.styles.js +2 -1
- package/dist/components/card/card.component.d.ts +5 -0
- package/dist/components/card/card.component.js +46 -24
- package/dist/components/card/card.styles.js +31 -14
- package/dist/components/{date-picker/datepicker.calendar.component.d.ts → datepicker/datepicker-calendar.component.d.ts} +4 -1
- package/dist/components/{date-picker/datepicker.calendar.component.js → datepicker/datepicker-calendar.component.js} +7 -7
- package/dist/components/datepicker/datepicker-calendar.d.ts +8 -0
- package/dist/components/datepicker/datepicker-calendar.js +6 -0
- package/dist/components/{date-picker/datepicker.component.d.ts → datepicker/datepicker-popup.component.d.ts} +5 -20
- package/dist/components/{date-picker/datepicker.component.js → datepicker/datepicker-popup.component.js} +12 -12
- package/dist/components/datepicker/datepicker-popup.d.ts +8 -0
- package/dist/components/{date-picker/datepicker.helpers.d.ts → datepicker/datepicker-popup.helpers.d.ts} +3 -3
- package/dist/components/datepicker/datepicker-popup.helpers.js +83 -0
- package/dist/components/datepicker/datepicker-popup.js +6 -0
- package/dist/components/{date-picker/datepicker.styles.js → datepicker/datepicker-popup.styles.js} +3 -3
- package/dist/components/{date-picker-input/datepicker-input.component.d.ts → datepicker/datepicker.component.d.ts} +17 -12
- package/dist/components/{date-picker-input/datepicker-input.component.js → datepicker/datepicker.component.js} +110 -97
- package/dist/components/datepicker/datepicker.d.ts +8 -0
- package/dist/components/datepicker/datepicker.js +6 -0
- package/dist/components/dialog/dialog.component.js +1 -1
- package/dist/components/dialog/dialog.d.ts +2 -2
- package/dist/components/drawer/drawer.d.ts +2 -2
- package/dist/components/header/header.d.ts +2 -2
- package/dist/components/heading/heading.component.d.ts +5 -1
- package/dist/components/heading/heading.component.js +54 -27
- package/dist/components/heading/heading.styles.js +34 -36
- package/dist/components/icon/icon.component.d.ts +4 -0
- package/dist/components/icon/icon.component.js +52 -43
- package/dist/components/icon/icon.styles.js +60 -60
- package/dist/components/input/input.component.js +26 -26
- package/dist/components/logo/logo.component.d.ts +4 -1
- package/dist/components/logo/logo.component.js +55 -51
- package/dist/components/logo/logo.styles.js +26 -16
- package/dist/components/menu/menu-item.d.ts +2 -2
- package/dist/components/menu/menu.d.ts +2 -2
- package/dist/components/nav/nav-item.component.d.ts +2 -2
- package/dist/components/nav/nav.d.ts +2 -2
- package/dist/components/popover/popover.component.js +1 -1
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/progress/progress.d.ts +2 -2
- package/dist/components/progress/progress.styles.js +8 -6
- package/dist/components/segmented-button/segmented-button-item.d.ts +2 -2
- package/dist/components/segmented-button/segmented-button.d.ts +2 -2
- package/dist/components/select/select-option-group.d.ts +2 -2
- package/dist/components/select/select-option.component.d.ts +2 -2
- package/dist/components/select/select-option.component.js +9 -9
- package/dist/components/select/select.component.d.ts +2 -2
- package/dist/components/select/select.component.js +3 -4
- package/dist/components/select/select.controllers.js +11 -14
- package/dist/components/stepper/stepper-item.component.js +47 -47
- package/dist/components/stepper/stepper-item.d.ts +2 -2
- package/dist/components/stepper/stepper.d.ts +2 -2
- package/dist/components/switch/switch.d.ts +2 -2
- package/dist/components/{tab-panel → tabs}/tab-panel.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.component.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.d.ts +2 -2
- package/dist/components/{tab-group/tab-group.component.d.ts → tabs/tabs.component.d.ts} +3 -4
- package/dist/components/{tab-group/tab-group.component.js → tabs/tabs.component.js} +35 -36
- package/dist/components/tabs/tabs.d.ts +8 -0
- package/dist/components/tabs/tabs.js +6 -0
- package/dist/components/{tab-group/tab-group.styles.js → tabs/tabs.styles.js} +16 -16
- package/dist/components/tag/tag.component.d.ts +7 -2
- package/dist/components/tag/tag.component.js +69 -65
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.styles.js +63 -50
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/custom-elements.json +233 -126
- package/dist/index.d.ts +6 -5
- package/dist/index.js +96 -93
- package/dist/internal/base-classes/popover/popover.base.js +1 -1
- package/dist/internal/components/skf-element.d.ts +1 -3
- package/dist/internal/components/skf-element.js +4 -9
- package/dist/internal/helpers/stateMap.d.ts +14 -0
- package/dist/internal/helpers/stateMap.js +68 -0
- package/dist/internal/helpers/watch.d.ts +1 -1
- package/dist/internal/helpers/watch.js +12 -12
- package/dist/styles/component.styles.js +37 -36
- package/dist/styles/{global-without-fonts.css → global-alt.css} +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +86 -44
- package/dist/types/vue/index.d.ts +86 -44
- package/dist/vscode.html-custom-data.json +103 -17
- package/dist/web-types.json +208 -55
- package/package.json +14 -20
- package/dist/components/accordion/accordion-item.test.d.ts +0 -1
- package/dist/components/accordion/accordion.test.d.ts +0 -1
- package/dist/components/checkbox/checkbox.test.d.ts +0 -1
- package/dist/components/date-picker/datepicker.d.ts +0 -10
- package/dist/components/date-picker/datepicker.helpers.js +0 -76
- package/dist/components/date-picker/datepicker.js +0 -8
- package/dist/components/date-picker-input/datepicker-input.d.ts +0 -8
- package/dist/components/date-picker-input/datepicker-input.js +0 -6
- package/dist/components/input/input.test.d.ts +0 -1
- package/dist/components/radio/radio.test.d.ts +0 -1
- package/dist/components/switch/switch.test.d.ts +0 -1
- package/dist/components/tab-group/tab-group.d.ts +0 -8
- package/dist/components/tab-group/tab-group.js +0 -6
- package/dist/internal/playwright/index.d.ts +0 -1
- /package/dist/components/{date-picker/datepicker.calendar.styles.d.ts → datepicker/datepicker-calendar.styles.d.ts} +0 -0
- /package/dist/components/{date-picker/datepicker.calendar.styles.js → datepicker/datepicker-calendar.styles.js} +0 -0
- /package/dist/components/{date-picker/datepicker.styles.d.ts → datepicker/datepicker-popup.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.d.ts → datepicker/datepicker.helpers.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.js → datepicker/datepicker.helpers.js} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.d.ts → datepicker/datepicker.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.js → datepicker/datepicker.styles.js} +0 -0
- /package/dist/components/select/{select.stories.icons.d.ts → stories/select.stories.icons.d.ts} +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.component.d.ts +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.component.js +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.js +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.d.ts +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.js +0 -0
- /package/dist/components/{tab → tabs}/tab.component.js +0 -0
- /package/dist/components/{tab → tabs}/tab.js +0 -0
- /package/dist/components/{tab → tabs}/tab.styles.d.ts +0 -0
- /package/dist/components/{tab → tabs}/tab.styles.js +0 -0
- /package/dist/components/{tab-group/tab-group.styles.d.ts → tabs/tabs.styles.d.ts} +0 -0
@@ -1,5 +1,5 @@
|
|
1
|
-
import { SkfStepperItem } from './stepper-item.component';
|
2
|
-
export * from './stepper-item.component';
|
1
|
+
import { SkfStepperItem } from './stepper-item.component.js';
|
2
|
+
export * from './stepper-item.component.js';
|
3
3
|
export default SkfStepperItem;
|
4
4
|
declare global {
|
5
5
|
interface HTMLElementTagNameMap {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { SkfStepper } from './stepper.component';
|
2
|
-
export * from './stepper.component';
|
1
|
+
import { SkfStepper } from './stepper.component.js';
|
2
|
+
export * from './stepper.component.js';
|
3
3
|
export default SkfStepper;
|
4
4
|
declare global {
|
5
5
|
interface HTMLElementTagNameMap {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { SkfTabPanel } from './tab-panel.component';
|
2
|
-
export * from './tab-panel.component';
|
1
|
+
import { SkfTabPanel } from './tab-panel.component.js';
|
2
|
+
export * from './tab-panel.component.js';
|
3
3
|
export default SkfTabPanel;
|
4
4
|
declare global {
|
5
5
|
interface HTMLElementTagNameMap {
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { SkfTabGroup } from '../tab-group/tab-group.component.js';
|
2
1
|
import { SkfElement } from '../../internal/components/skf-element';
|
3
2
|
import { type CSSResultGroup } from 'lit';
|
3
|
+
import type { SkfTabs } from './tabs.component.js';
|
4
4
|
export interface SkfTabEvent {
|
5
5
|
tab: SkfTab;
|
6
6
|
}
|
@@ -19,7 +19,7 @@ export declare class SkfTab extends SkfElement {
|
|
19
19
|
/** The name of the tab-panel this tab is associated with. The panel must be located in the same tab group. */
|
20
20
|
panel: string;
|
21
21
|
selected: boolean;
|
22
|
-
variant:
|
22
|
+
variant: SkfTabs['variant'];
|
23
23
|
constructor();
|
24
24
|
/** @internal */
|
25
25
|
handleSelectedChange(): void;
|
@@ -1,17 +1,16 @@
|
|
1
|
-
import '../card/card.js';
|
2
1
|
import { SkfElement } from '../../internal/components/skf-element';
|
3
2
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
4
3
|
/**
|
5
|
-
* The `<skf-
|
4
|
+
* The `<skf-tabs>` is a component that displays a list of actions or options
|
6
5
|
*
|
7
6
|
* @documentation See [zeroheight](https://zeroheight.com/****) for design principles
|
8
7
|
*
|
9
8
|
* @slot - Used for grouping tab panels in the tab group. Must be <skf-tab-panel> elements
|
10
9
|
* @slot tabs - Used for grouping tabs in the tab group. Must be <skf-tab> elements
|
11
10
|
*
|
12
|
-
* @tagname skf-
|
11
|
+
* @tagname skf-tabs
|
13
12
|
*/
|
14
|
-
export declare class
|
13
|
+
export declare class SkfTabs extends SkfElement {
|
15
14
|
static styles: CSSResultGroup;
|
16
15
|
/** Sets the default selected tab */
|
17
16
|
defaultSelected: number;
|
@@ -1,16 +1,15 @@
|
|
1
|
-
import "
|
2
|
-
import { SkfElement as c } from "../../internal/components/skf-element.js";
|
1
|
+
import { SkfElement as p } from "../../internal/components/skf-element.js";
|
3
2
|
import { componentStyles as b } from "../../styles/component.styles.js";
|
4
3
|
import { html as f } from "lit";
|
5
|
-
import { property as o, queryAssignedElements as
|
6
|
-
import { classMap as
|
7
|
-
import { styles as
|
8
|
-
var
|
9
|
-
for (var e = void 0,
|
10
|
-
(d = h[
|
11
|
-
return e &&
|
4
|
+
import { property as o, queryAssignedElements as c } from "lit/decorators.js";
|
5
|
+
import { classMap as y } from "lit/directives/class-map.js";
|
6
|
+
import { styles as m } from "./tabs.styles.js";
|
7
|
+
var u = Object.defineProperty, n = (h, t, s, i) => {
|
8
|
+
for (var e = void 0, r = h.length - 1, d; r >= 0; r--)
|
9
|
+
(d = h[r]) && (e = d(t, s, e) || e);
|
10
|
+
return e && u(t, s, e), e;
|
12
11
|
};
|
13
|
-
const l = class l extends
|
12
|
+
const l = class l extends p {
|
14
13
|
constructor() {
|
15
14
|
super(...arguments), this.defaultSelected = 0, this.noBorder = !1, this.noPadding = !1, this.stretch = !1, this.variant = "expanded", this._handleKeyDown = (t) => {
|
16
15
|
if (["ArrowLeft", "ArrowRight"].includes(t.key)) {
|
@@ -22,15 +21,15 @@ const l = class l extends c {
|
|
22
21
|
this._selectTab(s);
|
23
22
|
}, this._selectTab = (t) => {
|
24
23
|
this.tabs.forEach((s) => {
|
25
|
-
const
|
26
|
-
s.selected = s === t,
|
24
|
+
const i = this.panels.find((e) => e.name === s.panel);
|
25
|
+
s.selected = s === t, i && (i.active = s === t);
|
27
26
|
});
|
28
27
|
}, this._syncTabsAndPanels = () => {
|
29
28
|
this.tabs.forEach((t, s) => {
|
30
|
-
const
|
31
|
-
t.id = t.id ? t.id : `skf-tab-${
|
32
|
-
const e = this.panels.find((
|
33
|
-
e && (e.id = e.id ? e.id : `skf-tab-panel-${
|
29
|
+
const i = (s + 1).toString();
|
30
|
+
t.id = t.id ? t.id : `skf-tab-${i}`, t.selected = this.defaultSelected === s;
|
31
|
+
const e = this.panels.find((r) => r.name === t.panel);
|
32
|
+
e && (e.id = e.id ? e.id : `skf-tab-panel-${i}`, t.setAttribute("aria-controls", e.id), e.setAttribute("aria-labelledby", t.id), e.active = t.selected);
|
34
33
|
});
|
35
34
|
};
|
36
35
|
}
|
@@ -51,48 +50,48 @@ const l = class l extends c {
|
|
51
50
|
return f`
|
52
51
|
<div
|
53
52
|
@keydown=${this._handleKeyDown}
|
54
|
-
class=${
|
55
|
-
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
53
|
+
class=${y({
|
54
|
+
tabs: !0,
|
55
|
+
"tabs--compressed": this.variant === "compressed",
|
56
|
+
"tabs--expanded": this.variant === "expanded",
|
57
|
+
"tabs--no-border": this.noBorder,
|
58
|
+
"tabs--no-padding": this.noPadding,
|
59
|
+
"tabs--stretch": this.stretch
|
61
60
|
})}
|
62
61
|
>
|
63
|
-
<div class="
|
62
|
+
<div class="tabs__list" role="tablist">
|
64
63
|
<slot name="tabs"></slot>
|
65
64
|
</div>
|
66
|
-
<div class="
|
65
|
+
<div class="tabs__body">
|
67
66
|
<slot></slot>
|
68
67
|
</div>
|
69
68
|
</div>
|
70
69
|
`;
|
71
70
|
}
|
72
71
|
};
|
73
|
-
l.styles = [b,
|
72
|
+
l.styles = [b, m];
|
74
73
|
let a = l;
|
75
|
-
|
74
|
+
n([
|
76
75
|
o({ type: Number, attribute: "default-selected" })
|
77
76
|
], a.prototype, "defaultSelected");
|
78
|
-
|
77
|
+
n([
|
79
78
|
o({ type: Boolean, attribute: "no-border" })
|
80
79
|
], a.prototype, "noBorder");
|
81
|
-
|
80
|
+
n([
|
82
81
|
o({ type: Boolean, attribute: "no-padding" })
|
83
82
|
], a.prototype, "noPadding");
|
84
|
-
|
83
|
+
n([
|
85
84
|
o({ type: Boolean })
|
86
85
|
], a.prototype, "stretch");
|
87
|
-
|
86
|
+
n([
|
88
87
|
o({ reflect: !0 })
|
89
88
|
], a.prototype, "variant");
|
90
|
-
|
91
|
-
|
89
|
+
n([
|
90
|
+
c({ slot: "tabs" })
|
92
91
|
], a.prototype, "tabs");
|
93
|
-
|
94
|
-
|
92
|
+
n([
|
93
|
+
c()
|
95
94
|
], a.prototype, "panels");
|
96
95
|
export {
|
97
|
-
a as
|
96
|
+
a as SkfTabs
|
98
97
|
};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { css as
|
2
|
-
const
|
1
|
+
import { css as s } from "lit";
|
2
|
+
const r = s`
|
3
3
|
/* stylelint-disable selector-class-pattern */
|
4
4
|
@layer components {
|
5
5
|
:host {
|
@@ -13,13 +13,13 @@ const a = r`
|
|
13
13
|
/**
|
14
14
|
* Root
|
15
15
|
*/
|
16
|
-
.
|
16
|
+
.tabs {
|
17
17
|
background-color: var(--skf-bg-color-neutral-1);
|
18
18
|
}
|
19
19
|
|
20
|
-
.
|
20
|
+
.tabs--expanded {
|
21
21
|
border: var(
|
22
|
-
--_skf-
|
22
|
+
--_skf-tabs-border,
|
23
23
|
var(--skf-border-width-sm) solid var(--skf-border-color-tertiary)
|
24
24
|
);
|
25
25
|
border-end-end-radius: var(--skf-border-radius-sm);
|
@@ -31,11 +31,11 @@ const a = r`
|
|
31
31
|
}
|
32
32
|
}
|
33
33
|
|
34
|
-
.
|
35
|
-
--_skf-
|
34
|
+
.tabs--no-border {
|
35
|
+
--_skf-tabs-border: none;
|
36
36
|
}
|
37
37
|
|
38
|
-
.
|
38
|
+
.tabs--stretch {
|
39
39
|
block-size: inherit;
|
40
40
|
display: flex;
|
41
41
|
flex-direction: column;
|
@@ -44,10 +44,10 @@ const a = r`
|
|
44
44
|
/**
|
45
45
|
* Tabs
|
46
46
|
*/
|
47
|
-
.
|
47
|
+
.tabs__list {
|
48
48
|
display: flex;
|
49
49
|
|
50
|
-
.
|
50
|
+
.tabs--compressed & {
|
51
51
|
gap: var(--skf-spacing-100);
|
52
52
|
}
|
53
53
|
}
|
@@ -55,15 +55,15 @@ const a = r`
|
|
55
55
|
/**
|
56
56
|
* Body
|
57
57
|
*/
|
58
|
-
.
|
59
|
-
padding-block: var(--_skf-
|
58
|
+
.tabs__body {
|
59
|
+
padding-block: var(--_skf-tabs-body-padding-block, var(--skf-spacing-100) 0);
|
60
60
|
|
61
|
-
.
|
61
|
+
.tabs--stretch & {
|
62
62
|
overflow-y: auto;
|
63
63
|
}
|
64
64
|
|
65
|
-
.
|
66
|
-
--_skf-
|
65
|
+
.tabs--expanded:not(.tabs--no-padding) & {
|
66
|
+
--_skf-tabs-body-padding-block: var(--skf-spacing-100);
|
67
67
|
|
68
68
|
padding-inline: var(--skf-spacing-100);
|
69
69
|
}
|
@@ -71,5 +71,5 @@ const a = r`
|
|
71
71
|
}
|
72
72
|
`;
|
73
73
|
export {
|
74
|
-
|
74
|
+
r as styles
|
75
75
|
};
|
@@ -2,6 +2,7 @@ import '../icon/icon.js';
|
|
2
2
|
import { SkfElement } from '../../internal/components/skf-element';
|
3
3
|
import type { Icon, Severity } from '../../internal/types.js';
|
4
4
|
import { type CSSResultGroup } from 'lit';
|
5
|
+
type Size = 'sm' | 'md';
|
5
6
|
/**
|
6
7
|
* The `<skf-tag>` is a component that displays a list of actions or options
|
7
8
|
*
|
@@ -12,13 +13,14 @@ import { type CSSResultGroup } from 'lit';
|
|
12
13
|
* @tagname skf-tag
|
13
14
|
*/
|
14
15
|
export declare class SkfTag extends SkfElement {
|
16
|
+
#private;
|
15
17
|
static styles: CSSResultGroup;
|
16
18
|
/** @internal */
|
17
19
|
private _onClick?;
|
18
20
|
/** @internal */
|
19
|
-
|
21
|
+
private _onRemove?;
|
20
22
|
/** Specifies Tag size */
|
21
|
-
size:
|
23
|
+
size: Size;
|
22
24
|
/** If defined, displays leading/provided icon */
|
23
25
|
icon?: Icon;
|
24
26
|
/** If defined, gives the supplied appearance */
|
@@ -37,6 +39,8 @@ export declare class SkfTag extends SkfElement {
|
|
37
39
|
disconnectedCallback(): void;
|
38
40
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
39
41
|
/** @internal */
|
42
|
+
_handleStateChange(property: string, _prev: unknown, next: unknown): void;
|
43
|
+
/** @internal */
|
40
44
|
private _handleKeyDown;
|
41
45
|
/** @internal run externally provided callback (if any) first. Let click propagate to handleClick. */
|
42
46
|
private _handleRemove;
|
@@ -44,3 +48,4 @@ export declare class SkfTag extends SkfElement {
|
|
44
48
|
private _handleClick;
|
45
49
|
render(): import("lit").TemplateResult<1>;
|
46
50
|
}
|
51
|
+
export {};
|
@@ -1,35 +1,49 @@
|
|
1
|
+
var y = (e) => {
|
2
|
+
throw TypeError(e);
|
3
|
+
};
|
4
|
+
var k = (e, o, t) => o.has(e) || y("Cannot " + t);
|
5
|
+
var m = (e, o, t) => (k(e, o, "read from private field"), t ? t.call(e) : o.get(e)), d = (e, o, t) => o.has(e) ? y("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(e) : o.set(e, t), v = (e, o, t, i) => (k(e, o, "write to private field"), i ? i.call(e, t) : o.set(e, t), t);
|
1
6
|
import "../icon/icon.js";
|
2
|
-
import { SkfElement as
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
import { SkfElement as _ } from "../../internal/components/skf-element.js";
|
8
|
+
import { stateMap as g } from "../../internal/helpers/stateMap.js";
|
9
|
+
import { watch as w } from "../../internal/helpers/watch.js";
|
10
|
+
import { componentStyles as $ } from "../../styles/component.styles.js";
|
11
|
+
import { nothing as C, html as f } from "lit";
|
12
|
+
import { property as c, query as R } from "lit/decorators.js";
|
13
|
+
import { ifDefined as D } from "lit/directives/if-defined.js";
|
14
|
+
import { styles as E } from "./tag.styles.js";
|
15
|
+
var P = Object.defineProperty, z = Object.getOwnPropertyDescriptor, r = (e, o, t, i) => {
|
16
|
+
for (var s = i > 1 ? void 0 : i ? z(o, t) : o, l = e.length - 1, p; l >= 0; l--)
|
17
|
+
(p = e[l]) && (s = (i ? p(o, t, s) : p(s)) || s);
|
18
|
+
return i && s && P(o, t, s), s;
|
19
|
+
};
|
20
|
+
const b = {
|
21
|
+
size: ["sm", "md"],
|
22
|
+
color: ["error", "info", "success", "warning"]
|
13
23
|
};
|
14
|
-
|
24
|
+
var a, h;
|
25
|
+
const u = class u extends _ {
|
15
26
|
constructor() {
|
16
|
-
super(...arguments)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
27
|
+
super(...arguments);
|
28
|
+
d(this, a);
|
29
|
+
d(this, h);
|
30
|
+
v(this, a, this.attachInternals()), v(this, h, m(this, a).states), this.size = "md", this.removable = !1, this._handleKeyDown = (t) => {
|
31
|
+
(t.key === "Enter" || t.key === " ") && this.$removeButton.click();
|
32
|
+
}, this._handleRemove = (t) => {
|
33
|
+
this._onRemove && this._onRemove(t);
|
34
|
+
}, this._handleClick = (t) => {
|
35
|
+
var l;
|
36
|
+
t.stopPropagation(), t.composedPath()[0].localName === "button" ? this.remove() : (l = this.onClick) == null || l.call(this, t);
|
23
37
|
};
|
24
38
|
}
|
25
|
-
set onClick(
|
26
|
-
|
39
|
+
set onClick(t) {
|
40
|
+
t && (this._onClick = t);
|
27
41
|
}
|
28
42
|
get onClick() {
|
29
43
|
return this._onClick;
|
30
44
|
}
|
31
|
-
set onRemove(
|
32
|
-
|
45
|
+
set onRemove(t) {
|
46
|
+
t && (this._onRemove = t);
|
33
47
|
}
|
34
48
|
get onRemove() {
|
35
49
|
return this._onRemove;
|
@@ -40,62 +54,52 @@ const h = class h extends u {
|
|
40
54
|
disconnectedCallback() {
|
41
55
|
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
|
42
56
|
}
|
43
|
-
attributeChangedCallback(
|
44
|
-
super.attributeChangedCallback(
|
57
|
+
attributeChangedCallback(t, i, s) {
|
58
|
+
super.attributeChangedCallback(t, i, s), t === "removable" && s !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
|
59
|
+
}
|
60
|
+
_handleStateChange(t, i, s) {
|
61
|
+
g(m(this, h), b[t]).set(s);
|
45
62
|
}
|
46
63
|
render() {
|
47
|
-
return
|
48
|
-
<div
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
"tag--color-success": this.color === "success",
|
54
|
-
"tag--color-warning": this.color === "warning",
|
55
|
-
"tag--small": this.size === "sm"
|
56
|
-
})}
|
57
|
-
>
|
58
|
-
${this.icon ? a`
|
59
|
-
<skf-icon
|
60
|
-
class="tag__icon"
|
61
|
-
color=${_(this.color)}
|
62
|
-
name=${this.icon}
|
63
|
-
size="sm"
|
64
|
-
></skf-icon>
|
65
|
-
` : p}
|
66
|
-
<slot class="tag__slot"></slot>
|
67
|
-
${this.removable ? a`
|
68
|
-
<button @click=${this._handleRemove} class="tag__btn" type="button">
|
64
|
+
return f`
|
65
|
+
<div id="root">
|
66
|
+
${this.icon ? f`<skf-icon color=${D(this.color)} name=${this.icon} size="sm"></skf-icon>` : C}
|
67
|
+
<slot></slot>
|
68
|
+
${this.removable ? f`
|
69
|
+
<button @click=${this._handleRemove} type="button">
|
69
70
|
<skf-icon name="close" size="xs"></skf-icon>
|
70
71
|
</button>
|
71
|
-
` :
|
72
|
+
` : C}
|
72
73
|
</div>
|
73
74
|
`;
|
74
75
|
}
|
75
76
|
};
|
76
|
-
h.styles = [
|
77
|
-
let
|
77
|
+
a = new WeakMap(), h = new WeakMap(), u.styles = [$, E];
|
78
|
+
let n = u;
|
79
|
+
r([
|
80
|
+
c({ type: String })
|
81
|
+
], n.prototype, "size", 2);
|
78
82
|
r([
|
79
|
-
|
80
|
-
],
|
83
|
+
c({ type: String })
|
84
|
+
], n.prototype, "icon", 2);
|
81
85
|
r([
|
82
|
-
|
83
|
-
],
|
86
|
+
c({ type: String })
|
87
|
+
], n.prototype, "color", 2);
|
84
88
|
r([
|
85
|
-
|
86
|
-
],
|
89
|
+
c({ attribute: !1 })
|
90
|
+
], n.prototype, "onClick", 1);
|
87
91
|
r([
|
88
|
-
|
89
|
-
],
|
92
|
+
c({ attribute: !1 })
|
93
|
+
], n.prototype, "onRemove", 1);
|
90
94
|
r([
|
91
|
-
|
92
|
-
],
|
95
|
+
c({ type: Boolean })
|
96
|
+
], n.prototype, "removable", 2);
|
93
97
|
r([
|
94
|
-
|
95
|
-
],
|
98
|
+
R("button")
|
99
|
+
], n.prototype, "$removeButton", 2);
|
96
100
|
r([
|
97
|
-
|
98
|
-
],
|
101
|
+
w(Object.keys(b))
|
102
|
+
], n.prototype, "_handleStateChange", 1);
|
99
103
|
export {
|
100
|
-
|
104
|
+
n as SkfTag
|
101
105
|
};
|
@@ -1,66 +1,79 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
2
|
const s = r`
|
3
|
-
/* stylelint-disable selector-class-pattern */
|
4
3
|
@layer components {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
border: var(--skf-border-width-sm) solid
|
10
|
-
var(--_skf-tag-border-color, var(--skf-border-color-primary));
|
11
|
-
border-radius: var(--_skf-tag-border-radius, var(--skf-border-radius-md));
|
12
|
-
color: var(--_skf-tag-text-color, var(--skf-text-color-primary));
|
13
|
-
display: inline-flex;
|
14
|
-
font-size: var(--_skf-tag-font-size, var(--skf-font-size-50));
|
15
|
-
gap: var(--skf-spacing-25);
|
16
|
-
max-inline-size: 48ch;
|
17
|
-
padding-inline: var(--skf-spacing-50);
|
18
|
-
}
|
4
|
+
@layer base {
|
5
|
+
:host {
|
6
|
+
display: inline-flex;
|
7
|
+
}
|
19
8
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
9
|
+
#root {
|
10
|
+
--_skf-tag-bg-color: var(--skf-bg-color-neutral-1);
|
11
|
+
--_skf-tag-border-color: var(--skf-border-color-primary);
|
12
|
+
--_skf-tag-border-radius: var(--skf-border-radius-md);
|
13
|
+
--_skf-tag-font-size: var(--skf-font-size-50);
|
14
|
+
--_skf-tag-height: var(--skf-size-32);
|
15
|
+
--_skf-tag-text-color: var(--skf-text-color-primary);
|
24
16
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
17
|
+
align-items: center;
|
18
|
+
background-color: var(--_skf-tag-bg-color);
|
19
|
+
block-size: var(--_skf-tag-height);
|
20
|
+
border: var(--skf-border-width-sm) solid var(--_skf-tag-border-color);
|
21
|
+
border-radius: var(--_skf-tag-border-radius);
|
22
|
+
color: var(--_skf-tag-text-color);
|
23
|
+
display: flex;
|
24
|
+
font-size: var(--_skf-tag-font-size);
|
25
|
+
gap: var(--skf-spacing-25);
|
26
|
+
max-inline-size: 48ch;
|
27
|
+
padding-inline: var(--skf-spacing-50);
|
28
|
+
}
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
slot {
|
31
|
+
display: block;
|
32
|
+
overflow: hidden;
|
33
|
+
text-overflow: ellipsis;
|
34
|
+
white-space: nowrap;
|
35
|
+
}
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
--_skf-tag-border-color: var(--skf-severity-fg-color-success);
|
38
|
-
}
|
37
|
+
button {
|
38
|
+
display: flex;
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
&:focus-visible {
|
41
|
+
border-radius: var(--skf-border-radius-sm);
|
42
|
+
outline: var(--skf-border-width-md) solid var(--skf-interactive-border-color-focus);
|
43
|
+
}
|
44
|
+
}
|
43
45
|
}
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
@layer mods {
|
48
|
+
:host(:state(alert)) #root {
|
49
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-alert);
|
50
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-alert);
|
51
|
+
}
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
white-space: nowrap;
|
56
|
-
}
|
53
|
+
:host(:state(error)) #root {
|
54
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-error);
|
55
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-error);
|
56
|
+
}
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
:host(:state(info)) #root {
|
59
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-info);
|
60
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-info);
|
61
|
+
}
|
62
|
+
|
63
|
+
:host(:state(success)) #root {
|
64
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-success);
|
65
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-success);
|
66
|
+
}
|
67
|
+
|
68
|
+
:host(:state(warning)) #root {
|
69
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-warning);
|
70
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-warning);
|
71
|
+
}
|
60
72
|
|
61
|
-
|
62
|
-
border-radius:
|
63
|
-
|
73
|
+
:host(:state(sm)) #root {
|
74
|
+
--_skf-tag-border-radius: 0.25rem; /* token needed */
|
75
|
+
--_skf-tag-font-size: var(--skf-font-size-25);
|
76
|
+
--_skf-tag-height: var(--skf-size-24);
|
64
77
|
}
|
65
78
|
}
|
66
79
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { SkfTooltip } from './tooltip.component';
|
2
|
-
export * from './tooltip.component';
|
1
|
+
import { SkfTooltip } from './tooltip.component.js';
|
2
|
+
export * from './tooltip.component.js';
|
3
3
|
export default SkfTooltip;
|
4
4
|
declare global {
|
5
5
|
interface HTMLElementTagNameMap {
|