@skf-design-system/ui-components 1.0.0-beta.4 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -6
- package/dist/components/accordion/accordion-item.d.ts +1 -1
- package/dist/components/accordion/accordion.component.d.ts +13 -9
- package/dist/components/accordion/accordion.component.js +34 -30
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordion.styles.d.ts +1 -2
- package/dist/components/accordion/accordion.styles.js +5 -4
- package/dist/components/alert/alert.component.d.ts +10 -7
- package/dist/components/alert/alert.component.js +50 -37
- package/dist/components/alert/alert.styles.d.ts +1 -2
- package/dist/components/alert/alert.styles.js +42 -34
- package/dist/components/button/button.component.d.ts +28 -4
- package/dist/components/button/button.component.js +80 -56
- package/dist/components/button/button.styles.js +2 -1
- package/dist/components/card/card.component.d.ts +1 -1
- package/dist/components/card/card.component.js +29 -21
- package/dist/components/card/card.styles.d.ts +1 -2
- package/dist/components/card/card.styles.js +22 -12
- package/dist/components/checkbox/checkbox.component.d.ts +20 -18
- package/dist/components/checkbox/checkbox.component.js +95 -89
- package/dist/components/checkbox/checkbox.styles.js +7 -2
- package/dist/components/checkbox/checkbox.test.d.ts +1 -0
- package/dist/components/collapse/collapse.component.d.ts +8 -5
- package/dist/components/collapse/collapse.component.js +50 -39
- package/dist/components/collapse/collapse.styles.js +13 -12
- package/dist/components/collapse/collapse.test.d.ts +1 -0
- package/dist/components/dialog/dialog.component.d.ts +75 -0
- package/dist/components/dialog/dialog.component.js +189 -0
- package/dist/components/dialog/dialog.d.ts +8 -0
- package/dist/components/dialog/dialog.js +6 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +91 -0
- package/dist/components/divider/divider.component.d.ts +14 -11
- package/dist/components/divider/divider.component.js +46 -29
- package/dist/components/divider/divider.styles.d.ts +1 -2
- package/dist/components/divider/divider.styles.js +26 -30
- package/dist/components/heading/heading.component.d.ts +14 -4
- package/dist/components/heading/heading.component.js +14 -14
- package/dist/components/heading/heading.styles.js +1 -1
- package/dist/components/icon/icon.component.d.ts +15 -9
- package/dist/components/icon/icon.component.js +6 -6
- package/dist/components/icon/icon.styles.js +56 -54
- package/dist/components/input/input.component.d.ts +48 -33
- package/dist/components/input/input.component.js +108 -99
- package/dist/components/link/link.component.d.ts +20 -17
- package/dist/components/link/link.component.js +20 -14
- package/dist/components/link/link.styles.js +36 -40
- package/dist/components/loader/loader.component.d.ts +7 -7
- package/dist/components/loader/loader.component.js +42 -61
- package/dist/components/loader/loader.styles.js +44 -11
- package/dist/components/logo/logo.component.d.ts +7 -5
- package/dist/components/logo/logo.component.js +25 -14
- package/dist/components/logo/logo.styles.d.ts +1 -2
- package/dist/components/logo/logo.styles.js +12 -10
- package/dist/components/progress/progress.component.d.ts +22 -0
- package/dist/components/progress/progress.component.js +49 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +6 -0
- package/dist/components/progress/progress.styles.d.ts +1 -0
- package/dist/components/progress/progress.styles.js +48 -0
- package/dist/components/radio/radio.component.d.ts +21 -21
- package/dist/components/radio/radio.component.js +94 -78
- package/dist/components/radio/radio.styles.js +6 -1
- package/dist/components/select/select.component.d.ts +14 -12
- package/dist/components/select/select.component.js +119 -103
- package/dist/components/select/select.controllers.d.ts +1 -1
- package/dist/components/select/select.controllers.js +5 -2
- package/dist/components/select/select.styles.js +18 -3
- package/dist/components/select-option/select-option.component.d.ts +3 -3
- package/dist/components/select-option/select-option.component.js +16 -10
- package/dist/components/select-option/select-option.controllers.d.ts +1 -1
- package/dist/components/select-option-group/select-option-group.component.d.ts +1 -1
- package/dist/components/switch/switch.component.d.ts +4 -5
- package/dist/components/switch/switch.component.js +17 -7
- package/dist/components/switch/switch.styles.js +19 -11
- package/dist/components/switch/switch.test.d.ts +1 -0
- package/dist/components/tab/tab.component.d.ts +29 -0
- package/dist/components/tab/tab.component.js +57 -0
- package/dist/components/tab/tab.d.ts +8 -0
- package/dist/components/tab/tab.js +6 -0
- package/dist/components/tab/tab.styles.d.ts +1 -0
- package/dist/components/tab/tab.styles.js +123 -0
- package/dist/components/tab-group/tab-group.component.d.ts +43 -0
- package/dist/components/tab-group/tab-group.component.js +98 -0
- package/dist/components/tab-group/tab-group.d.ts +8 -0
- package/dist/components/tab-group/tab-group.js +6 -0
- package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
- package/dist/components/tab-group/tab-group.styles.js +75 -0
- package/dist/components/tab-panel/tab-panel.component.d.ts +19 -0
- package/dist/components/tab-panel/tab-panel.component.js +36 -0
- package/dist/components/tab-panel/tab-panel.d.ts +8 -0
- package/dist/components/tab-panel/tab-panel.js +6 -0
- package/dist/components/tab-panel/tab-panel.styles.d.ts +1 -0
- package/dist/components/tab-panel/tab-panel.styles.js +13 -0
- package/dist/components/tag/tag.component.d.ts +14 -9
- package/dist/components/tag/tag.component.js +63 -47
- package/dist/components/tag/tag.styles.js +35 -28
- package/dist/components/textarea/textarea.component.d.ts +30 -27
- package/dist/components/textarea/textarea.component.js +20 -17
- package/dist/components/toast/toast.component.d.ts +35 -0
- package/dist/components/toast/toast.component.js +52 -0
- package/dist/components/toast/toast.d.ts +8 -0
- package/dist/components/toast/toast.js +6 -0
- package/dist/components/toast/toast.singleton.d.ts +26 -0
- package/dist/components/toast/toast.singleton.js +53 -0
- package/dist/components/toast/toast.styles.d.ts +1 -0
- package/dist/components/toast/toast.styles.js +9 -0
- package/dist/components/toast-item/toast-item.component.d.ts +21 -0
- package/dist/components/toast-item/toast-item.component.js +65 -0
- package/dist/components/toast-item/toast-item.d.ts +6 -0
- package/dist/components/toast-item/toast-item.js +2 -0
- package/dist/components/toast-item/toast-item.styles.d.ts +2 -0
- package/dist/components/toast-item/toast-item.styles.js +16 -0
- package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +24 -0
- package/dist/components/toast-wrapper/toast-wrapper.component.js +37 -0
- package/dist/components/toast-wrapper/toast-wrapper.d.ts +8 -0
- package/dist/components/toast-wrapper/toast-wrapper.js +6 -0
- package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
- package/dist/components/toast-wrapper/toast-wrapper.styles.js +20 -0
- package/dist/custom-elements.json +3090 -1993
- package/dist/index.d.ts +6 -0
- package/dist/index.js +60 -42
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -11
- package/dist/internal/components/hint/hint.component.d.ts +2 -2
- package/dist/internal/components/hint/hint.component.js +12 -10
- package/dist/internal/components/hint/hint.styles.js +26 -10
- package/dist/internal/components/skf-element.js +26 -25
- package/dist/internal/helpers/hintSeverity.d.ts +1 -1
- package/dist/internal/helpers/watch.d.ts +27 -0
- package/dist/internal/helpers/watch.js +28 -0
- package/dist/internal/storybook/shadowRootTraverser.d.ts +16 -8
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +7 -6
- package/dist/react/index.d.ts +10 -3
- package/dist/react/index.js +10 -3
- package/dist/react/skf-button/index.d.ts +7 -1
- package/dist/react/skf-button/index.js +5 -1
- package/dist/react/skf-dialog/index.d.ts +15 -0
- package/dist/react/skf-dialog/index.js +19 -0
- package/dist/react/skf-progress/index.d.ts +3 -0
- package/dist/react/skf-progress/index.js +13 -0
- package/dist/react/skf-tab/index.d.ts +12 -0
- package/dist/react/skf-tab/index.js +18 -0
- package/dist/react/skf-tab-group/index.d.ts +3 -0
- package/dist/react/skf-tab-group/index.js +13 -0
- package/dist/react/skf-tab-panel/index.d.ts +3 -0
- package/dist/react/skf-tab-panel/index.js +13 -0
- package/dist/react/skf-toast/index.d.ts +3 -0
- package/dist/react/skf-toast/index.js +13 -0
- package/dist/react/skf-toast-wrapper/index.d.ts +3 -0
- package/dist/react/skf-toast-wrapper/index.js +13 -0
- package/dist/styles/component.styles.js +15 -2
- package/dist/styles/form-field.styles.js +5 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +300 -117
- package/dist/types/vue/index.d.ts +266 -76
- package/dist/vscode.html-custom-data.json +349 -216
- package/dist/web-types.json +686 -292
- package/package.json +33 -32
@@ -0,0 +1,53 @@
|
|
1
|
+
import "../toast-item/toast-item.js";
|
2
|
+
import "../toast-wrapper/toast-wrapper.js";
|
3
|
+
class a {
|
4
|
+
constructor(t) {
|
5
|
+
if (this.data = [], this.root = t, this.usePopover = !0, this.root.nodeType !== Node.DOCUMENT_NODE)
|
6
|
+
throw new Error("Root node must be a document node");
|
7
|
+
return a.instance || (a.instance = this), a.instance;
|
8
|
+
}
|
9
|
+
hasToasts() {
|
10
|
+
return this.data.length > 0;
|
11
|
+
}
|
12
|
+
popToast() {
|
13
|
+
return this.data.pop();
|
14
|
+
}
|
15
|
+
getData() {
|
16
|
+
return this.data;
|
17
|
+
}
|
18
|
+
setData(t) {
|
19
|
+
this.data = t;
|
20
|
+
}
|
21
|
+
addData(t) {
|
22
|
+
this.data = [...this.data, t], this.udpateUI();
|
23
|
+
}
|
24
|
+
udpateUI() {
|
25
|
+
const t = c(this.root, this.usePopover);
|
26
|
+
this.usePopover && t.showPopover(), u();
|
27
|
+
function u() {
|
28
|
+
const n = new a(document);
|
29
|
+
for (; n.hasToasts(); ) {
|
30
|
+
const e = n.popToast();
|
31
|
+
if (!e) return;
|
32
|
+
e.debug && (t.debug = !0);
|
33
|
+
const o = document.createElement("skf-toast-item");
|
34
|
+
o.timer = e.timer, o.severity = e.severity, o.icon = "warning", e.closeable && o.setAttribute("closeable", "true"), o.originEl = e.originEl, o.innerText = String(e.text);
|
35
|
+
const s = document.createElement("div");
|
36
|
+
s.classList.add("toast-item-wrapper"), s.appendChild(o), t.prepend(s);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
function c(n, e) {
|
40
|
+
var p;
|
41
|
+
const s = ((p = new a(document).getData()[0]) == null ? void 0 : p.topOffset) ?? null, i = n.querySelector("body");
|
42
|
+
let r = i == null ? void 0 : i.querySelector("skf-toast-wrapper");
|
43
|
+
if (!r) {
|
44
|
+
if (r = document.createElement("skf-toast-wrapper"), !r) throw new Error("Could not create toast wrapper element");
|
45
|
+
e && r.setAttribute("popover", "auto"), s && r.setAttribute("top-offset", s.toString()), document.body.appendChild(r);
|
46
|
+
}
|
47
|
+
return r;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
export {
|
52
|
+
a as Singleton
|
53
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { SkfAlert } from '../alert/alert.component.js';
|
2
|
+
export declare class SkfToastItem extends SkfAlert {
|
3
|
+
static styles: import("lit").CSSResultGroup[];
|
4
|
+
protected _closeableInitialState: boolean;
|
5
|
+
protected _parentAnimationDiv: HTMLDivElement | null;
|
6
|
+
/** If not cloaseable, timeout id for the toast */
|
7
|
+
private _currentTimeoutId;
|
8
|
+
/** If not closseable, time left on the timer when the mouse enters the toast */
|
9
|
+
private _timeleft;
|
10
|
+
/** If not closseable, time when the timeout started */
|
11
|
+
private _timeoutStarted;
|
12
|
+
originEl: HTMLElement | null;
|
13
|
+
timer: number;
|
14
|
+
constructor();
|
15
|
+
firstUpdated(): void;
|
16
|
+
_animateIn(): void;
|
17
|
+
_handleMouseEnter: () => void;
|
18
|
+
_handleMouseLeave: () => void;
|
19
|
+
_removeToast: () => void;
|
20
|
+
get parentAnimationDiv(): HTMLDivElement;
|
21
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { SkfAlert as l } from "../alert/alert.component.js";
|
2
|
+
import { MOTION_DURATIONS as h } from "@skf-design-system/ui-assets";
|
3
|
+
import { property as u } from "lit/decorators.js";
|
4
|
+
import p from "./toast-item.styles.js";
|
5
|
+
var d = Object.defineProperty, f = (a, t, e, m) => {
|
6
|
+
for (var i = void 0, r = a.length - 1, o; r >= 0; r--)
|
7
|
+
(o = a[r]) && (i = o(t, e, i) || i);
|
8
|
+
return i && d(t, e, i), i;
|
9
|
+
};
|
10
|
+
const n = class n extends l {
|
11
|
+
constructor() {
|
12
|
+
super(), this.timer = 0, this._handleMouseEnter = () => {
|
13
|
+
this._closeableInitialState || (this.closeable = !0, this._timeleft = this.timer * 1e3 - (Date.now() - this._timeoutStarted), this._currentTimeoutId && clearTimeout(this._currentTimeoutId));
|
14
|
+
}, this._handleMouseLeave = () => {
|
15
|
+
this._closeableInitialState || (this.closeable = this._closeableInitialState, this._currentTimeoutId = setTimeout(this._removeToast, this._timeleft));
|
16
|
+
}, this._removeToast = () => {
|
17
|
+
const e = this.parentAnimationDiv.animate(
|
18
|
+
[
|
19
|
+
{ gridTemplateRows: "1fr", opacity: 1 },
|
20
|
+
{ gridTemplateRows: "0fr", opacity: 0 }
|
21
|
+
],
|
22
|
+
{
|
23
|
+
duration: h.normal,
|
24
|
+
fill: "forwards"
|
25
|
+
}
|
26
|
+
);
|
27
|
+
e.onfinish = () => {
|
28
|
+
this.originEl && this.originEl.remove(), this.parentAnimationDiv.remove();
|
29
|
+
};
|
30
|
+
}, this.originEl = null, this._parentAnimationDiv = this.parentElement, this._currentTimeoutId = null, this._timeleft = 0, this._timeoutStarted = 0, this._closeableInitialState = !!this.closeable;
|
31
|
+
}
|
32
|
+
firstUpdated() {
|
33
|
+
this.addEventListener("skf-alert-close", this._removeToast), this.closeable || (this.addEventListener("mouseenter", this._handleMouseEnter), this.addEventListener("mouseout", this._handleMouseLeave)), this._animateIn();
|
34
|
+
}
|
35
|
+
_animateIn() {
|
36
|
+
const t = this.parentAnimationDiv;
|
37
|
+
"vibrate" in navigator && navigator.vibrate(500);
|
38
|
+
const e = t.animate(
|
39
|
+
[
|
40
|
+
{ gridTemplateRows: "0fr", opacity: 0 },
|
41
|
+
{ gridTemplateRows: "1fr", opacity: 1 }
|
42
|
+
],
|
43
|
+
{
|
44
|
+
duration: h.slow,
|
45
|
+
fill: "forwards"
|
46
|
+
}
|
47
|
+
);
|
48
|
+
e.onfinish = () => {
|
49
|
+
this.timer > 0 && !this.closeable && (this._timeoutStarted = Date.now(), this._currentTimeoutId = setTimeout(this._removeToast, this.timer * 1e3));
|
50
|
+
};
|
51
|
+
}
|
52
|
+
get parentAnimationDiv() {
|
53
|
+
const t = this.parentElement;
|
54
|
+
if (!t) throw new Error("Parent animation div not found");
|
55
|
+
return t;
|
56
|
+
}
|
57
|
+
};
|
58
|
+
n.styles = [l.styles, p];
|
59
|
+
let s = n;
|
60
|
+
f([
|
61
|
+
u({ type: Number, reflect: !0 })
|
62
|
+
], s.prototype, "timer");
|
63
|
+
export {
|
64
|
+
s as SkfToastItem
|
65
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { css as r } from "lit";
|
2
|
+
const s = r`
|
3
|
+
:host {
|
4
|
+
overflow: hidden;
|
5
|
+
padding-block-end: 3px;
|
6
|
+
}
|
7
|
+
|
8
|
+
#root {
|
9
|
+
background-color: var(--skf-bg-color-neutral-1);
|
10
|
+
border-inline-start: var(--skf-size-8) solid
|
11
|
+
var(--_skf-alert-border-color, var(--skf-border-color-primary));
|
12
|
+
}
|
13
|
+
`;
|
14
|
+
export {
|
15
|
+
s as default
|
16
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import type { SkfAlert } from '../alert/alert.component.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
3
|
+
import { type CSSResultGroup } from 'lit';
|
4
|
+
/**
|
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.
|
6
|
+
*
|
7
|
+
* @documentation See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/6229d63d9fe16020a60657e5) for design principles
|
8
|
+
*
|
9
|
+
* @slot - The alert components that the toast creates will render here.
|
10
|
+
*
|
11
|
+
* @tagname skf-toast-wrapper
|
12
|
+
*/
|
13
|
+
export declare class SkfToastWrapper extends SkfElement {
|
14
|
+
static styles: CSSResultGroup;
|
15
|
+
debug: boolean;
|
16
|
+
/** @internal */
|
17
|
+
_slottedChildren: SkfAlert[];
|
18
|
+
/** @internal */
|
19
|
+
topOffset?: number;
|
20
|
+
firstUpdated(): void;
|
21
|
+
/** @internal */
|
22
|
+
_handleSlotChange: () => void;
|
23
|
+
render(): import("lit").TemplateResult<1>;
|
24
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { SkfElement as h } from "../../internal/components/skf-element.js";
|
2
|
+
import d from "../../styles/component.styles.js";
|
3
|
+
import { html as m } from "lit";
|
4
|
+
import { property as p, queryAssignedElements as a } from "lit/decorators.js";
|
5
|
+
import { styles as u } from "./toast-wrapper.styles.js";
|
6
|
+
var y = Object.defineProperty, r = (l, i, n, g) => {
|
7
|
+
for (var t = void 0, o = l.length - 1, f; o >= 0; o--)
|
8
|
+
(f = l[o]) && (t = f(i, n, t) || t);
|
9
|
+
return t && y(i, n, t), t;
|
10
|
+
};
|
11
|
+
const s = class s extends h {
|
12
|
+
constructor() {
|
13
|
+
super(...arguments), this.debug = !1, this._handleSlotChange = () => {
|
14
|
+
this._slottedChildren.length === 0 && this.remove();
|
15
|
+
};
|
16
|
+
}
|
17
|
+
firstUpdated() {
|
18
|
+
this._handleSlotChange(), this.topOffset && this.style.setProperty("--skf-toast-offset-top", `${this.topOffset.toString()}px`);
|
19
|
+
}
|
20
|
+
render() {
|
21
|
+
return m`<slot @slotchange=${this._handleSlotChange}></slot>`;
|
22
|
+
}
|
23
|
+
};
|
24
|
+
s.styles = [d, u];
|
25
|
+
let e = s;
|
26
|
+
r([
|
27
|
+
p({ type: Boolean, reflect: !0 })
|
28
|
+
], e.prototype, "debug");
|
29
|
+
r([
|
30
|
+
a()
|
31
|
+
], e.prototype, "_slottedChildren");
|
32
|
+
r([
|
33
|
+
p({ type: Number, reflect: !0 })
|
34
|
+
], e.prototype, "topOffset");
|
35
|
+
export {
|
36
|
+
e as SkfToastWrapper
|
37
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { css as s } from "lit";
|
2
|
+
const t = s`
|
3
|
+
:host {
|
4
|
+
all: unset;
|
5
|
+
display: flex;
|
6
|
+
flex-direction: column;
|
7
|
+
gap: calc(0.5rem - 3px);
|
8
|
+
inline-size: min(calc(100% - var(--skf-spacing-200)), 520px);
|
9
|
+
inset: var(--skf-toast-offset-top, var(--skf-spacing-100)) 0 auto;
|
10
|
+
margin-inline: auto;
|
11
|
+
position: fixed;
|
12
|
+
}
|
13
|
+
|
14
|
+
::slotted(.toast-item-wrapper) {
|
15
|
+
display: grid;
|
16
|
+
}
|
17
|
+
`;
|
18
|
+
export {
|
19
|
+
t as styles
|
20
|
+
};
|