@skf-design-system/ui-components 1.0.0-beta.4 → 1.0.0-beta.5
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.component.d.ts +9 -5
- package/dist/components/accordion/accordion.component.js +22 -19
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordion.styles.js +3 -3
- package/dist/components/alert/alert.component.d.ts +7 -4
- package/dist/components/alert/alert.component.js +21 -19
- package/dist/components/alert/alert.styles.js +50 -47
- package/dist/components/button/button.component.d.ts +2 -0
- package/dist/components/button/button.component.js +6 -6
- package/dist/components/button/button.styles.js +1 -1
- package/dist/components/card/card.component.d.ts +3 -3
- package/dist/components/card/card.component.js +16 -19
- package/dist/components/card/card.styles.js +11 -3
- package/dist/components/checkbox/checkbox.component.d.ts +9 -6
- package/dist/components/checkbox/checkbox.component.js +7 -7
- 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 +9 -6
- package/dist/components/collapse/collapse.component.js +39 -36
- package/dist/components/collapse/collapse.styles.js +3 -3
- package/dist/components/collapse/collapse.test.d.ts +1 -0
- package/dist/components/divider/divider.component.d.ts +13 -10
- package/dist/components/divider/divider.component.js +34 -29
- package/dist/components/divider/divider.styles.js +1 -5
- package/dist/components/heading/heading.component.d.ts +12 -2
- 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 +14 -8
- 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 +43 -29
- package/dist/components/input/input.component.js +46 -36
- package/dist/components/link/link.component.d.ts +15 -12
- package/dist/components/link/link.component.js +7 -7
- package/dist/components/link/link.styles.js +1 -1
- package/dist/components/loader/loader.component.d.ts +7 -7
- package/dist/components/loader/loader.component.js +35 -61
- package/dist/components/loader/loader.styles.js +42 -10
- package/dist/components/logo/logo.component.d.ts +5 -3
- package/dist/components/logo/logo.component.js +8 -8
- package/dist/components/logo/logo.styles.js +2 -2
- package/dist/components/radio/radio.component.d.ts +15 -13
- package/dist/components/radio/radio.component.js +3 -3
- package/dist/components/radio/radio.styles.js +6 -1
- package/dist/components/select/select.component.d.ts +12 -10
- package/dist/components/select/select.component.js +113 -100
- 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 +2 -2
- package/dist/components/select-option/select-option.component.js +16 -10
- package/dist/components/switch/switch.component.d.ts +2 -3
- package/dist/components/switch/switch.component.js +1 -1
- package/dist/components/switch/switch.styles.js +6 -1
- package/dist/components/switch/switch.test.d.ts +1 -0
- package/dist/components/tag/tag.component.d.ts +12 -7
- package/dist/components/tag/tag.component.js +24 -24
- package/dist/components/tag/tag.styles.js +6 -1
- package/dist/components/textarea/textarea.component.d.ts +26 -23
- package/dist/components/textarea/textarea.component.js +15 -12
- 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.style.d.ts +1 -0
- package/dist/components/toast/toast.style.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.style.d.ts +2 -0
- package/dist/components/toast-item/toast-item.style.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.style.d.ts +1 -0
- package/dist/components/toast-wrapper/toast-wrapper.style.js +20 -0
- package/dist/custom-elements.json +676 -238
- package/dist/index.d.ts +1 -0
- package/dist/index.js +43 -40
- package/dist/internal/components/hint/hint.component.js +12 -10
- package/dist/internal/components/hint/hint.styles.js +26 -10
- package/dist/internal/storybook/shadowRootTraverser.d.ts +16 -8
- package/dist/react/index.d.ts +5 -3
- package/dist/react/index.js +5 -3
- 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/form-field.styles.js +5 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +88 -50
- package/dist/types/vue/index.d.ts +91 -51
- package/dist/vscode.html-custom-data.json +101 -62
- package/dist/web-types.json +208 -122
- package/package.json +3 -3
@@ -0,0 +1,21 @@
|
|
1
|
+
import { SkfAlert } from '@components/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.style.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 '@components/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.style.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
|
+
};
|