@skf-design-system/ui-components 1.0.0-beta.5 → 1.0.1-beta.0
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 +5 -5
- package/dist/components/alert/alert.component.js +46 -35
- package/dist/components/alert/alert.styles.d.ts +1 -2
- package/dist/components/alert/alert.styles.js +29 -24
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +29 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.component.d.ts +25 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +8 -0
- package/dist/components/button/button.component.d.ts +29 -5
- package/dist/components/button/button.component.js +89 -52
- package/dist/components/button/button.styles.js +65 -45
- 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 +96 -90
- 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 +74 -0
- package/dist/components/dialog/dialog.component.js +187 -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 +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/heading/heading.component.js +13 -13
- package/dist/components/icon/icon.component.d.ts +2 -5
- package/dist/components/icon/icon.component.js +32 -23
- package/dist/components/icon/icon.styles.js +53 -47
- 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 +7 -6
- package/dist/components/link/link.component.js +49 -43
- 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 +39 -32
- 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 +28 -17
- package/dist/components/logo/logo.styles.d.ts +1 -2
- package/dist/components/logo/logo.styles.js +11 -9
- package/dist/components/menu/menu.component.d.ts +24 -0
- package/dist/components/menu/menu.component.js +18 -0
- package/dist/components/menu/menu.d.ts +8 -0
- package/dist/components/menu/menu.js +6 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +11 -0
- package/dist/components/menu-item/menu-item.component.d.ts +25 -0
- package/dist/components/menu-item/menu-item.component.js +13 -0
- package/dist/components/menu-item/menu-item.d.ts +8 -0
- package/dist/components/menu-item/menu-item.js +6 -0
- package/dist/components/menu-item/menu-item.styles.d.ts +1 -0
- package/dist/components/menu-item/menu-item.styles.js +19 -0
- package/dist/components/popover/popover.component.d.ts +29 -0
- package/dist/components/popover/popover.component.js +37 -0
- package/dist/components/popover/popover.d.ts +8 -0
- package/dist/components/popover/popover.js +6 -0
- package/dist/components/popover/popover.styles.d.ts +1 -0
- package/dist/components/popover/popover.styles.js +12 -0
- 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 +7 -9
- package/dist/components/radio/radio.component.js +95 -79
- package/dist/components/select/select.component.d.ts +10 -12
- package/dist/components/select/select.component.js +120 -120
- package/dist/components/select/select.controllers.d.ts +1 -26
- package/dist/components/select/select.controllers.js +35 -95
- 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/select-option-group/select-option-group.component.js +9 -9
- package/dist/components/stepper/stepper.component.d.ts +38 -0
- package/dist/components/stepper/stepper.component.js +91 -0
- package/dist/components/stepper/stepper.d.ts +8 -0
- package/dist/components/stepper/stepper.helpers.d.ts +16 -0
- package/dist/components/stepper/stepper.helpers.js +18 -0
- package/dist/components/stepper/stepper.js +6 -0
- package/dist/components/stepper/stepper.styles.d.ts +1 -0
- package/dist/components/stepper/stepper.styles.js +15 -0
- package/dist/components/stepper-item/stepper-item.component.d.ts +47 -0
- package/dist/components/stepper-item/stepper-item.component.js +113 -0
- package/dist/components/stepper-item/stepper-item.d.ts +8 -0
- package/dist/components/stepper-item/stepper-item.js +6 -0
- package/dist/components/stepper-item/stepper-item.styles.d.ts +1 -0
- package/dist/components/stepper-item/stepper-item.styles.js +98 -0
- 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 +2 -2
- package/dist/components/toast/toast.component.d.ts +8 -5
- package/dist/components/toast/toast.component.js +30 -26
- package/dist/components/toast/toast.singleton.d.ts +5 -10
- package/dist/components/toast/toast.singleton.js +25 -25
- 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 +15 -15
- package/dist/components/toast-item/toast-item.styles.js +18 -0
- package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +2 -2
- package/dist/components/toast-wrapper/toast-wrapper.component.js +11 -11
- package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.component.d.ts +24 -0
- package/dist/components/tooltip/tooltip.component.js +18 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +6 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.styles.js +12 -0
- package/dist/custom-elements.json +2465 -629
- package/dist/index.d.ts +11 -0
- package/dist/index.js +77 -44
- package/dist/internal/base-classes/popover/popover.base.d.ts +29 -0
- package/dist/internal/base-classes/popover/popover.base.js +116 -0
- package/dist/internal/base-classes/popover/popover.styles.d.ts +1 -0
- package/dist/internal/base-classes/popover/popover.styles.js +29 -0
- 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 +13 -13
- package/dist/internal/components/skf-element.js +26 -25
- package/dist/internal/controllers/popover.controller.d.ts +16 -0
- package/dist/internal/controllers/popover.controller.js +44 -0
- package/dist/internal/helpers/hintSeverity.d.ts +2 -2
- 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 +13 -0
- package/dist/react/index.js +13 -0
- package/dist/react/skf-breadcrumb/index.d.ts +9 -0
- package/dist/react/skf-breadcrumb/index.js +17 -0
- package/dist/react/skf-breadcrumb-item/index.d.ts +3 -0
- package/dist/react/skf-breadcrumb-item/index.js +13 -0
- 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-menu/index.d.ts +12 -0
- package/dist/react/skf-menu/index.js +18 -0
- package/dist/react/skf-menu-item/index.d.ts +27 -0
- package/dist/react/skf-menu-item/index.js +23 -0
- package/dist/react/skf-popover/index.d.ts +12 -0
- package/dist/react/skf-popover/index.js +18 -0
- package/dist/react/skf-progress/index.d.ts +3 -0
- package/dist/react/skf-progress/index.js +13 -0
- package/dist/react/skf-stepper/index.d.ts +9 -0
- package/dist/react/skf-stepper/index.js +17 -0
- package/dist/react/skf-stepper-item/index.d.ts +9 -0
- package/dist/react/skf-stepper-item/index.js +17 -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-tooltip/index.d.ts +12 -0
- package/dist/react/skf-tooltip/index.js +18 -0
- package/dist/styles/component.styles.js +15 -2
- package/dist/types/jsx/custom-element-jsx.d.ts +603 -27
- package/dist/types/vue/index.d.ts +413 -11
- package/dist/vscode.html-custom-data.json +462 -36
- package/dist/web-types.json +944 -90
- package/package.json +43 -42
- package/dist/components/toast-item/toast-item.style.js +0 -16
- /package/dist/components/{toast/toast.style.d.ts → breadcrumb/breadcrumb.styles.d.ts} +0 -0
- /package/dist/components/{toast-wrapper/toast-wrapper.style.d.ts → breadcrumb-item/breadcrumb-item.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-wrapper/{toast-wrapper.style.js → toast-wrapper.styles.js} +0 -0
@@ -1,36 +1,37 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
2
|
import { SkfElement as u } from "../../internal/components/skf-element.js";
|
3
|
-
import
|
4
|
-
import { html as a, nothing as
|
5
|
-
import { property as
|
6
|
-
import {
|
3
|
+
import f from "../../styles/component.styles.js";
|
4
|
+
import { html as a, nothing as p } from "lit";
|
5
|
+
import { property as n, query as d } from "lit/decorators.js";
|
6
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
7
|
+
import { ifDefined as _ } from "lit/directives/if-defined.js";
|
7
8
|
import { styles as k } from "./tag.styles.js";
|
8
|
-
var
|
9
|
-
for (var
|
10
|
-
(c =
|
11
|
-
return
|
9
|
+
var b = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (m, t, s, r) => {
|
10
|
+
for (var e = r > 1 ? void 0 : r ? y(t, s) : t, l = m.length - 1, c; l >= 0; l--)
|
11
|
+
(c = m[l]) && (e = (r ? c(t, s, e) : c(e)) || e);
|
12
|
+
return r && e && b(t, s, e), e;
|
12
13
|
};
|
13
14
|
const h = class h extends u {
|
14
15
|
constructor() {
|
15
|
-
super(...arguments), this.size = "md", this._handleKeyDown = (
|
16
|
-
(
|
17
|
-
}, this._handleRemove = (
|
18
|
-
this._onRemove && this._onRemove(
|
19
|
-
}, this._handleClick = (
|
20
|
-
var
|
21
|
-
|
22
|
-
const
|
23
|
-
console.log("$clickTarget",
|
16
|
+
super(...arguments), this.size = "md", this._handleKeyDown = (t) => {
|
17
|
+
(t.key === "Enter" || t.key === " ") && this.$removeButton.click();
|
18
|
+
}, this._handleRemove = (t) => {
|
19
|
+
this._onRemove && this._onRemove(t);
|
20
|
+
}, this._handleClick = (t) => {
|
21
|
+
var e;
|
22
|
+
t.stopPropagation();
|
23
|
+
const s = t.composedPath()[0];
|
24
|
+
console.log("$clickTarget", s), s.localName === "button" ? this.remove() : (e = this.onClick) == null || e.call(this, t);
|
24
25
|
};
|
25
26
|
}
|
26
|
-
set onClick(
|
27
|
-
|
27
|
+
set onClick(t) {
|
28
|
+
t && (this._onClick = t);
|
28
29
|
}
|
29
30
|
get onClick() {
|
30
31
|
return this._onClick;
|
31
32
|
}
|
32
|
-
set onRemove(
|
33
|
-
|
33
|
+
set onRemove(t) {
|
34
|
+
t && (this._onRemove = t);
|
34
35
|
}
|
35
36
|
get onRemove() {
|
36
37
|
return this._onRemove;
|
@@ -41,47 +42,62 @@ const h = class h extends u {
|
|
41
42
|
disconnectedCallback() {
|
42
43
|
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
|
43
44
|
}
|
44
|
-
attributeChangedCallback(
|
45
|
-
super.attributeChangedCallback(
|
45
|
+
attributeChangedCallback(t, s, r) {
|
46
|
+
super.attributeChangedCallback(t, s, r), t === "removable" && r !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
|
46
47
|
}
|
47
48
|
render() {
|
48
49
|
return a`
|
49
|
-
<div
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
<div
|
51
|
+
class=${v({
|
52
|
+
tag: !0,
|
53
|
+
"tag--color-alert": this.color === "alert",
|
54
|
+
"tag--color-error": this.color === "error",
|
55
|
+
"tag--color-info": this.color === "info",
|
56
|
+
"tag--color-success": this.color === "success",
|
57
|
+
"tag--color-warning": this.color === "warning",
|
58
|
+
"tag--small": this.size === "sm"
|
59
|
+
})}
|
60
|
+
>
|
61
|
+
${this.icon ? a`
|
62
|
+
<skf-icon
|
63
|
+
class="tag__icon"
|
64
|
+
color=${_(this.color)}
|
65
|
+
name=${this.icon}
|
66
|
+
size="sm"
|
67
|
+
></skf-icon>
|
68
|
+
` : p}
|
69
|
+
<slot class="tag__slot"></slot>
|
54
70
|
${this.removable ? a`
|
55
|
-
<button @click=${this._handleRemove} type="button">
|
71
|
+
<button @click=${this._handleRemove} class="tag__btn" type="button">
|
56
72
|
<skf-icon name="close" size="xs"></skf-icon>
|
57
73
|
</button>
|
58
|
-
` :
|
74
|
+
` : p}
|
59
75
|
</div>
|
60
76
|
`;
|
61
77
|
}
|
62
78
|
};
|
63
|
-
h.styles = [
|
79
|
+
h.styles = [f, k];
|
64
80
|
let o = h;
|
65
|
-
|
66
|
-
|
81
|
+
i([
|
82
|
+
n({ reflect: !0 })
|
67
83
|
], o.prototype, "size", 2);
|
68
|
-
|
69
|
-
|
84
|
+
i([
|
85
|
+
n()
|
70
86
|
], o.prototype, "icon", 2);
|
71
|
-
|
72
|
-
|
87
|
+
i([
|
88
|
+
n({ reflect: !0 })
|
73
89
|
], o.prototype, "color", 2);
|
74
|
-
|
75
|
-
|
90
|
+
i([
|
91
|
+
n({ attribute: !1 })
|
76
92
|
], o.prototype, "onClick", 1);
|
77
|
-
|
78
|
-
|
93
|
+
i([
|
94
|
+
n({ attribute: !1 })
|
79
95
|
], o.prototype, "onRemove", 1);
|
80
|
-
|
81
|
-
|
96
|
+
i([
|
97
|
+
n({ type: Boolean, reflect: !0 })
|
82
98
|
], o.prototype, "removable", 2);
|
83
|
-
|
84
|
-
|
99
|
+
i([
|
100
|
+
d("button")
|
85
101
|
], o.prototype, "$removeButton", 2);
|
86
102
|
export {
|
87
103
|
o as SkfTag
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
2
|
const s = r`
|
3
|
+
/* stylelint-disable selector-class-pattern */
|
3
4
|
@layer components {
|
4
|
-
|
5
|
+
.tag {
|
5
6
|
align-items: center;
|
6
7
|
background-color: var(--_skf-tag-bg-color, var(--skf-bg-color-neutral-1));
|
7
8
|
block-size: var(--_skf-tag-height, var(--skf-size-32));
|
@@ -14,46 +15,47 @@ const s = r`
|
|
14
15
|
gap: var(--skf-spacing-25);
|
15
16
|
max-inline-size: 48ch;
|
16
17
|
padding-inline: var(--skf-spacing-50);
|
18
|
+
}
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
.tag--color-alert {
|
21
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-alert);
|
22
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-alert);
|
23
|
+
}
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
.tag--color-error {
|
26
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-error);
|
27
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-error);
|
28
|
+
}
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
.tag--color-info {
|
31
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-info);
|
32
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-info);
|
33
|
+
}
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
.tag--color-success {
|
36
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-success);
|
37
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-success);
|
38
|
+
}
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
.tag--color-warning {
|
41
|
+
--_skf-tag-bg-color: var(--skf-severity-bg-color-warning);
|
42
|
+
--_skf-tag-border-color: var(--skf-severity-fg-color-warning);
|
43
|
+
}
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
45
|
+
.tag--small {
|
46
|
+
--_skf-tag-border-radius: 0.25rem; /* token needed */
|
47
|
+
--_skf-tag-font-size: var(--skf-font-size-25);
|
48
|
+
--_skf-tag-height: var(--skf-size-24);
|
48
49
|
}
|
49
50
|
|
50
|
-
|
51
|
+
.tag__slot {
|
52
|
+
display: block;
|
51
53
|
overflow: hidden;
|
52
54
|
text-overflow: ellipsis;
|
53
55
|
white-space: nowrap;
|
54
56
|
}
|
55
57
|
|
56
|
-
|
58
|
+
.tag__btn {
|
57
59
|
display: flex;
|
58
60
|
|
59
61
|
&:focus-visible {
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import '
|
2
|
-
import { FormBase } from '
|
3
|
-
import '
|
4
|
-
import type { FormFieldBaseProps } from '
|
1
|
+
import '../icon/icon.js';
|
2
|
+
import { FormBase } from '../../internal/components/formBase.js';
|
3
|
+
import '../../internal/components/hint/hint.js';
|
4
|
+
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
5
5
|
import { type CSSResultGroup } from 'lit';
|
6
6
|
interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
|
7
7
|
cols?: number;
|
@@ -46,7 +46,7 @@ const u = class u extends m {
|
|
46
46
|
attributeChangedCallback(t, s, a) {
|
47
47
|
if (super.attributeChangedCallback(t, s, a), t === "value" && this._internals.setFormValue(a), t === "custom-invalid")
|
48
48
|
if (typeof a == "string") {
|
49
|
-
const o =
|
49
|
+
const o = this.withFallback(a);
|
50
50
|
this.pristine = !1, this._internals.setValidity({ customError: !0 }, o), this.invalid = !0, this.hint = o, this.checkValidity();
|
51
51
|
} else
|
52
52
|
this._internals.setValidity({}), this.validateInput();
|
@@ -69,7 +69,7 @@ const u = class u extends m {
|
|
69
69
|
const o = this.hasAttribute(l) ? this.getAttribute(l) : this.$input.validationMessage;
|
70
70
|
this._internals.setValidity(
|
71
71
|
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
72
|
-
o
|
72
|
+
this.withFallback(o)
|
73
73
|
), this.invalid && this.customErrorDisplay && this.checkValidity();
|
74
74
|
}
|
75
75
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import type { SkfAlert } from '../alert/alert.component.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
2
3
|
import { type CSSResultGroup } from 'lit';
|
3
4
|
/**
|
4
5
|
* SkfToast is the only component a user (developer) interacts with to create a toast notification. Once rendered it will invoke a singleton instance to manage the toast notifications.
|
@@ -18,11 +19,13 @@ import { type CSSResultGroup } from 'lit';
|
|
18
19
|
export declare class SkfToast extends SkfElement {
|
19
20
|
static styles: CSSResultGroup;
|
20
21
|
private _singleton?;
|
21
|
-
/** If provided, adds a close button to the toast and will not disapear until user actively dismisses it. */
|
22
|
-
closeable: boolean;
|
23
22
|
debug: boolean;
|
24
|
-
/**
|
25
|
-
|
23
|
+
/** If defined, displays leading icon */
|
24
|
+
icon?: SkfAlert['icon'];
|
25
|
+
/** If true, renders with an close button and sets aria-role to `status` */
|
26
|
+
persistent: SkfAlert['persistent'];
|
27
|
+
/** If defined, gives the supplied appearance */
|
28
|
+
severity: SkfAlert['severity'];
|
26
29
|
/** Time in seconds before the toast disappears. */
|
27
30
|
timer: number;
|
28
31
|
/** offsets where toasts emerge vertically */
|
@@ -1,50 +1,54 @@
|
|
1
|
-
import { Singleton as
|
2
|
-
import { SkfElement as
|
3
|
-
import { html as
|
1
|
+
import { Singleton as d } from "./toast.singleton.js";
|
2
|
+
import { SkfElement as f } from "../../internal/components/skf-element.js";
|
3
|
+
import { html as l } from "lit";
|
4
4
|
import { property as s, queryAssignedNodes as y } from "lit/decorators.js";
|
5
|
-
import { styles as
|
6
|
-
var
|
7
|
-
for (var
|
8
|
-
(
|
9
|
-
return
|
5
|
+
import { styles as u } from "./toast.styles.js";
|
6
|
+
var a = Object.defineProperty, e = (n, r, h, g) => {
|
7
|
+
for (var i = void 0, o = n.length - 1, m; o >= 0; o--)
|
8
|
+
(m = n[o]) && (i = m(r, h, i) || i);
|
9
|
+
return i && a(r, h, i), i;
|
10
10
|
};
|
11
|
-
const p = class p extends
|
11
|
+
const p = class p extends f {
|
12
12
|
constructor() {
|
13
|
-
super(), this.
|
13
|
+
super(), this.debug = !1, this.persistent = !1, this.severity = "info", this.timer = 5, this._singleton = void 0;
|
14
14
|
}
|
15
15
|
firstUpdated() {
|
16
|
-
this._singleton = new
|
17
|
-
|
18
|
-
|
19
|
-
closeable: this.closeable,
|
16
|
+
this._singleton = new d(this.getRootNode()), this._singleton.addData({
|
17
|
+
debug: this.debug,
|
18
|
+
icon: this.icon,
|
20
19
|
originEl: this,
|
20
|
+
persistent: this.persistent,
|
21
21
|
severity: this.severity,
|
22
|
-
|
23
|
-
|
22
|
+
text: this._slottedText.map((r) => r.textContent).join(),
|
23
|
+
timer: this.timer = this.timer && this.timer < 5 ? 5 : this.timer,
|
24
|
+
topOffset: this.topOffset
|
24
25
|
});
|
25
26
|
}
|
26
27
|
render() {
|
27
|
-
return
|
28
|
+
return l`<slot></slot>`;
|
28
29
|
}
|
29
30
|
};
|
30
|
-
p.styles = [
|
31
|
+
p.styles = [u];
|
31
32
|
let t = p;
|
32
|
-
|
33
|
-
s({ type: Boolean })
|
34
|
-
], t.prototype, "closeable");
|
35
|
-
o([
|
33
|
+
e([
|
36
34
|
s({ type: Boolean })
|
37
35
|
], t.prototype, "debug");
|
38
|
-
|
36
|
+
e([
|
37
|
+
s()
|
38
|
+
], t.prototype, "icon");
|
39
|
+
e([
|
40
|
+
s({ type: Boolean })
|
41
|
+
], t.prototype, "persistent");
|
42
|
+
e([
|
39
43
|
s()
|
40
44
|
], t.prototype, "severity");
|
41
|
-
|
45
|
+
e([
|
42
46
|
s({ type: Number })
|
43
47
|
], t.prototype, "timer");
|
44
|
-
|
48
|
+
e([
|
45
49
|
s({ type: Number })
|
46
50
|
], t.prototype, "topOffset");
|
47
|
-
|
51
|
+
e([
|
48
52
|
y()
|
49
53
|
], t.prototype, "_slottedText");
|
50
54
|
export {
|
@@ -1,14 +1,9 @@
|
|
1
|
-
import '
|
2
|
-
import '
|
3
|
-
import type { SkfToast } from '
|
4
|
-
interface ToastData {
|
5
|
-
text: string;
|
6
|
-
timer: number;
|
7
|
-
closeable: boolean;
|
8
|
-
topOffset?: number;
|
1
|
+
import '../toast-item/toast-item.js';
|
2
|
+
import '../toast-wrapper/toast-wrapper.js';
|
3
|
+
import type { SkfToast } from '../toast/toast.component.js';
|
4
|
+
interface ToastData extends Pick<SkfToast, 'debug' | 'icon' | 'persistent' | 'severity' | 'timer' | 'topOffset'> {
|
9
5
|
originEl: SkfToast;
|
10
|
-
|
11
|
-
debug: boolean;
|
6
|
+
text: string;
|
12
7
|
}
|
13
8
|
export declare class Singleton {
|
14
9
|
private static instance?;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import "../toast-item/toast-item.js";
|
2
2
|
import "../toast-wrapper/toast-wrapper.js";
|
3
|
-
class
|
4
|
-
constructor(
|
5
|
-
if (this.data = [], this.root =
|
3
|
+
class r {
|
4
|
+
constructor(e) {
|
5
|
+
if (this.data = [], this.root = e, this.usePopover = !0, this.root.nodeType !== Node.DOCUMENT_NODE)
|
6
6
|
throw new Error("Root node must be a document node");
|
7
|
-
return
|
7
|
+
return r.instance || (r.instance = this), r.instance;
|
8
8
|
}
|
9
9
|
hasToasts() {
|
10
10
|
return this.data.length > 0;
|
@@ -15,39 +15,39 @@ class a {
|
|
15
15
|
getData() {
|
16
16
|
return this.data;
|
17
17
|
}
|
18
|
-
setData(
|
19
|
-
this.data =
|
18
|
+
setData(e) {
|
19
|
+
this.data = e;
|
20
20
|
}
|
21
|
-
addData(
|
22
|
-
this.data = [...this.data,
|
21
|
+
addData(e) {
|
22
|
+
this.data = [...this.data, e], this.udpateUI();
|
23
23
|
}
|
24
24
|
udpateUI() {
|
25
|
-
const
|
26
|
-
this.usePopover &&
|
25
|
+
const e = c(this.root, this.usePopover);
|
26
|
+
this.usePopover && e.showPopover(), u();
|
27
27
|
function u() {
|
28
|
-
const n = new
|
28
|
+
const n = new r(document);
|
29
29
|
for (; n.hasToasts(); ) {
|
30
|
-
const
|
31
|
-
if (!
|
32
|
-
|
30
|
+
const t = n.popToast();
|
31
|
+
if (!t) return;
|
32
|
+
t.debug && (e.debug = !0);
|
33
33
|
const o = document.createElement("skf-toast-item");
|
34
|
-
o.timer =
|
35
|
-
const
|
36
|
-
|
34
|
+
o.className = "toast-item", o.timer = t.timer, o.severity = t.severity, o.icon = t.icon, t.persistent && o.setAttribute("persistent", "true"), o.originEl = t.originEl, o.innerText = String(t.text);
|
35
|
+
const a = document.createElement("div");
|
36
|
+
a.classList.add("toast-item-wrapper"), a.appendChild(o), e.prepend(a);
|
37
37
|
}
|
38
38
|
}
|
39
|
-
function c(n,
|
39
|
+
function c(n, t) {
|
40
40
|
var p;
|
41
|
-
const
|
42
|
-
let
|
43
|
-
if (!
|
44
|
-
if (
|
45
|
-
|
41
|
+
const a = ((p = new r(document).getData()[0]) == null ? void 0 : p.topOffset) ?? null, i = n.querySelector("body");
|
42
|
+
let s = i == null ? void 0 : i.querySelector("skf-toast-wrapper");
|
43
|
+
if (!s) {
|
44
|
+
if (s = document.createElement("skf-toast-wrapper"), !s) throw new Error("Could not create toast wrapper element");
|
45
|
+
t && s.setAttribute("popover", "auto"), a && s.setAttribute("top-offset", a.toString()), document.body.appendChild(s);
|
46
46
|
}
|
47
|
-
return
|
47
|
+
return s;
|
48
48
|
}
|
49
49
|
}
|
50
50
|
}
|
51
51
|
export {
|
52
|
-
|
52
|
+
r as Singleton
|
53
53
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import { SkfAlert as
|
2
|
-
import { MOTION_DURATIONS as
|
3
|
-
import { property as
|
4
|
-
import
|
5
|
-
var d = Object.defineProperty, f = (a, t, e,
|
1
|
+
import { SkfAlert as h } from "../alert/alert.component.js";
|
2
|
+
import { MOTION_DURATIONS as m } from "@skf-design-system/ui-assets";
|
3
|
+
import { property as p } from "lit/decorators.js";
|
4
|
+
import u from "./toast-item.styles.js";
|
5
|
+
var d = Object.defineProperty, f = (a, t, e, l) => {
|
6
6
|
for (var i = void 0, r = a.length - 1, o; r >= 0; r--)
|
7
7
|
(o = a[r]) && (i = o(t, e, i) || i);
|
8
8
|
return i && d(t, e, i), i;
|
9
9
|
};
|
10
|
-
const n = class n extends
|
10
|
+
const n = class n extends h {
|
11
11
|
constructor() {
|
12
12
|
super(), this.timer = 0, this._handleMouseEnter = () => {
|
13
|
-
this._closeableInitialState || (this.
|
13
|
+
this._closeableInitialState || (this.persistent = !0, this._timeleft = this.timer * 1e3 - (Date.now() - this._timeoutStarted), this._currentTimeoutId && clearTimeout(this._currentTimeoutId));
|
14
14
|
}, this._handleMouseLeave = () => {
|
15
|
-
this._closeableInitialState || (this.
|
15
|
+
this._closeableInitialState || (this.persistent = this._closeableInitialState, this._currentTimeoutId = setTimeout(this._removeToast, this._timeleft));
|
16
16
|
}, this._removeToast = () => {
|
17
17
|
const e = this.parentAnimationDiv.animate(
|
18
18
|
[
|
@@ -20,17 +20,17 @@ const n = class n extends l {
|
|
20
20
|
{ gridTemplateRows: "0fr", opacity: 0 }
|
21
21
|
],
|
22
22
|
{
|
23
|
-
duration:
|
23
|
+
duration: m.normal,
|
24
24
|
fill: "forwards"
|
25
25
|
}
|
26
26
|
);
|
27
27
|
e.onfinish = () => {
|
28
28
|
this.originEl && this.originEl.remove(), this.parentAnimationDiv.remove();
|
29
29
|
};
|
30
|
-
}, this.originEl = null, this._parentAnimationDiv = this.parentElement, this._currentTimeoutId = null, this._timeleft = 0, this._timeoutStarted = 0, this._closeableInitialState = !!this.
|
30
|
+
}, this.originEl = null, this._parentAnimationDiv = this.parentElement, this._currentTimeoutId = null, this._timeleft = 0, this._timeoutStarted = 0, this._closeableInitialState = !!this.persistent;
|
31
31
|
}
|
32
32
|
firstUpdated() {
|
33
|
-
this.addEventListener("skf-alert-close", this._removeToast), this.
|
33
|
+
this.addEventListener("skf-alert-close", this._removeToast), this.persistent || (this.addEventListener("mouseenter", this._handleMouseEnter), this.addEventListener("mouseout", this._handleMouseLeave)), this._animateIn();
|
34
34
|
}
|
35
35
|
_animateIn() {
|
36
36
|
const t = this.parentAnimationDiv;
|
@@ -41,12 +41,12 @@ const n = class n extends l {
|
|
41
41
|
{ gridTemplateRows: "1fr", opacity: 1 }
|
42
42
|
],
|
43
43
|
{
|
44
|
-
duration:
|
44
|
+
duration: m.slow,
|
45
45
|
fill: "forwards"
|
46
46
|
}
|
47
47
|
);
|
48
48
|
e.onfinish = () => {
|
49
|
-
this.timer > 0 && !this.
|
49
|
+
this.timer > 0 && !this.persistent && (this._timeoutStarted = Date.now(), this._currentTimeoutId = setTimeout(this._removeToast, this.timer * 1e3));
|
50
50
|
};
|
51
51
|
}
|
52
52
|
get parentAnimationDiv() {
|
@@ -55,10 +55,10 @@ const n = class n extends l {
|
|
55
55
|
return t;
|
56
56
|
}
|
57
57
|
};
|
58
|
-
n.styles = [
|
58
|
+
n.styles = [h.styles, u];
|
59
59
|
let s = n;
|
60
60
|
f([
|
61
|
-
|
61
|
+
p({ type: Number, reflect: !0 })
|
62
62
|
], s.prototype, "timer");
|
63
63
|
export {
|
64
64
|
s as SkfToastItem
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { css as o } from "lit";
|
2
|
+
const a = o`
|
3
|
+
@layer components {
|
4
|
+
:host {
|
5
|
+
overflow: hidden; /* Enable mask transition */
|
6
|
+
padding-block-end: 3px; /* Make room for box-shadow */
|
7
|
+
}
|
8
|
+
|
9
|
+
.toast-item {
|
10
|
+
background-color: var(--skf-bg-color-neutral-1);
|
11
|
+
border-inline-start: var(--skf-size-8) solid
|
12
|
+
var(--_skf-alert-border-color, var(--skf-border-color-primary));
|
13
|
+
}
|
14
|
+
}
|
15
|
+
`;
|
16
|
+
export {
|
17
|
+
a as default
|
18
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { SkfAlert } from '
|
2
|
-
import { SkfElement } from '
|
1
|
+
import type { SkfAlert } from '../alert/alert.component.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
3
3
|
import { type CSSResultGroup } from 'lit';
|
4
4
|
/**
|
5
5
|
* The `<skf-toast-wrapper>` is a component without UI that positions where the toast shows up on the screen. The toast-wrapper is used internally by the toast component.
|
@@ -2,13 +2,13 @@ import { SkfElement as h } from "../../internal/components/skf-element.js";
|
|
2
2
|
import d from "../../styles/component.styles.js";
|
3
3
|
import { html as m } from "lit";
|
4
4
|
import { property as p, queryAssignedElements as a } from "lit/decorators.js";
|
5
|
-
import { styles as u } from "./toast-wrapper.
|
6
|
-
var y = Object.defineProperty,
|
7
|
-
for (var t = void 0,
|
8
|
-
(f = l[
|
9
|
-
return t && y(
|
5
|
+
import { styles as u } from "./toast-wrapper.styles.js";
|
6
|
+
var y = Object.defineProperty, s = (l, n, i, g) => {
|
7
|
+
for (var t = void 0, r = l.length - 1, f; r >= 0; r--)
|
8
|
+
(f = l[r]) && (t = f(n, i, t) || t);
|
9
|
+
return t && y(n, i, t), t;
|
10
10
|
};
|
11
|
-
const
|
11
|
+
const o = class o extends h {
|
12
12
|
constructor() {
|
13
13
|
super(...arguments), this.debug = !1, this._handleSlotChange = () => {
|
14
14
|
this._slottedChildren.length === 0 && this.remove();
|
@@ -21,15 +21,15 @@ const s = class s extends h {
|
|
21
21
|
return m`<slot @slotchange=${this._handleSlotChange}></slot>`;
|
22
22
|
}
|
23
23
|
};
|
24
|
-
|
25
|
-
let e =
|
26
|
-
|
24
|
+
o.styles = [d, u];
|
25
|
+
let e = o;
|
26
|
+
s([
|
27
27
|
p({ type: Boolean, reflect: !0 })
|
28
28
|
], e.prototype, "debug");
|
29
|
-
|
29
|
+
s([
|
30
30
|
a()
|
31
31
|
], e.prototype, "_slottedChildren");
|
32
|
-
|
32
|
+
s([
|
33
33
|
p({ type: Number, reflect: !0 })
|
34
34
|
], e.prototype, "topOffset");
|
35
35
|
export {
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|