@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
@@ -1,5 +1,5 @@
|
|
1
1
|
import { SkfElement } from '@internal/components/skf-element.js';
|
2
|
-
import type {
|
2
|
+
import type { SeverityFgColor } from '@skf-design-system/ui-assets';
|
3
3
|
import { type CSSResultGroup } from 'lit';
|
4
4
|
import '../icon/icon';
|
5
5
|
import { SkfIcon } from '../icon/icon';
|
@@ -43,7 +43,7 @@ export declare class SkfSelectOption extends SkfElement {
|
|
43
43
|
/** If defined, set an icon */
|
44
44
|
icon?: SkfIcon['name'];
|
45
45
|
/** If defined, sets provided color on the icon */
|
46
|
-
iconColor?:
|
46
|
+
iconColor?: SeverityFgColor;
|
47
47
|
/** If true, sets the option as selected */
|
48
48
|
selected?: boolean;
|
49
49
|
/** If defined, sets a short label */
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { SkfElement as
|
2
|
-
import
|
3
|
-
import { LitElement as
|
4
|
-
import { property as n, queryAssignedNodes as
|
5
|
-
import { ifDefined as
|
1
|
+
import { SkfElement as u } from "../../internal/components/skf-element.js";
|
2
|
+
import f from "../../styles/component.styles.js";
|
3
|
+
import { LitElement as m, html as h } from "lit";
|
4
|
+
import { property as n, queryAssignedNodes as _ } from "lit/decorators.js";
|
5
|
+
import { ifDefined as p } from "lit/directives/if-defined.js";
|
6
6
|
import "../icon/icon.js";
|
7
7
|
import { styles as y } from "./select-option.styles.js";
|
8
8
|
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (d, t, s, i) => {
|
@@ -10,7 +10,7 @@ var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (d, t, s
|
|
10
10
|
(c = d[a]) && (r = (i ? c(t, s, r) : c(r)) || r);
|
11
11
|
return i && r && v(t, s, r), r;
|
12
12
|
};
|
13
|
-
const l = class l extends
|
13
|
+
const l = class l extends u {
|
14
14
|
constructor() {
|
15
15
|
super(), this._handleClick = (s) => {
|
16
16
|
s.stopPropagation(), this.selected = !this.selected;
|
@@ -69,16 +69,22 @@ const l = class l extends p {
|
|
69
69
|
render() {
|
70
70
|
return h`
|
71
71
|
<button
|
72
|
+
?disabled=${this.disabled}
|
72
73
|
@click=${this._handleClick}
|
73
74
|
aria-selected=${this.selected ? "true" : "false"}
|
74
|
-
?disabled=${this.disabled}
|
75
75
|
role="option"
|
76
76
|
>
|
77
77
|
<skf-icon id="icon-check" name="check" size="sm"></skf-icon>
|
78
78
|
<slot>${this.text}</slot>
|
79
79
|
<div id="adornments">
|
80
80
|
<slot name="icon">
|
81
|
-
${this.icon && h
|
81
|
+
${this.icon && h`
|
82
|
+
<skf-icon
|
83
|
+
class=${p((this.disabled ?? !this.iconColor) && "skf-icon-host")}
|
84
|
+
color=${p(this.iconColor)}
|
85
|
+
name=${this.icon}
|
86
|
+
></skf-icon>
|
87
|
+
`}
|
82
88
|
</slot>
|
83
89
|
${this.shortLabel && h`<div id="short-label">${this.shortLabel}</div>`}
|
84
90
|
</div>
|
@@ -86,7 +92,7 @@ const l = class l extends p {
|
|
86
92
|
`;
|
87
93
|
}
|
88
94
|
};
|
89
|
-
l.styles = [
|
95
|
+
l.styles = [f, y], l.shadowRootOptions = { ...m.shadowRootOptions, delegatesFocus: !0 };
|
90
96
|
let e = l;
|
91
97
|
o([
|
92
98
|
n({ type: Boolean, reflect: !0 })
|
@@ -110,7 +116,7 @@ o([
|
|
110
116
|
n({ reflect: !0 })
|
111
117
|
], e.prototype, "value", 1);
|
112
118
|
o([
|
113
|
-
|
119
|
+
_({ flatten: !0 })
|
114
120
|
], e.prototype, "_assignedNodes", 2);
|
115
121
|
export {
|
116
122
|
e as SkfSelectOption
|
@@ -9,13 +9,12 @@ import { type CSSResultGroup } from 'lit';
|
|
9
9
|
* @attribute {boolean} disabled - If true, sets disabled state
|
10
10
|
* @attribute {boolean} required - If true, value is required or must be checked for the form to be submittable
|
11
11
|
*
|
12
|
-
* @slot - The
|
12
|
+
* @slot - The Switchs label. Alternatively, you can use the `label` attribute.
|
13
13
|
*
|
14
14
|
* @tagname skf-switch
|
15
15
|
*/
|
16
16
|
export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
|
17
17
|
static styles: CSSResultGroup;
|
18
|
-
/** @internal */
|
19
18
|
private _initialChecked;
|
20
19
|
/** If true, outputs helping hints in console */
|
21
20
|
debug?: boolean;
|
@@ -23,7 +22,7 @@ export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
|
|
23
22
|
checked?: boolean;
|
24
23
|
/** If true, hides the label visually */
|
25
24
|
hideLabel?: boolean;
|
26
|
-
/** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
|
25
|
+
/** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
|
27
26
|
label?: string;
|
28
27
|
/** If defined, adds name to the input-element */
|
29
28
|
name?: string;
|
@@ -8,11 +8,16 @@ const t = [
|
|
8
8
|
contain: layout;
|
9
9
|
}
|
10
10
|
|
11
|
-
|
11
|
+
#root {
|
12
12
|
align-items: center;
|
13
|
+
color: var(--_skf-switch-color, var(--skf-text-color-primary));
|
13
14
|
display: flex;
|
14
15
|
grid-gap: var(--skf-spacing-50);
|
15
16
|
|
17
|
+
:host([disabled]) & {
|
18
|
+
--_skf-switch-color: var(--skf-interactive-text-color-disabled);
|
19
|
+
}
|
20
|
+
|
16
21
|
:host([size='sm']) & {
|
17
22
|
--_skf-switch-height: var(--skf-size-20);
|
18
23
|
--_skf-switch-width: var(--skf-size-32);
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -13,24 +13,29 @@ import { type CSSResultGroup } from 'lit';
|
|
13
13
|
*/
|
14
14
|
export declare class SkfTag extends SkfElement {
|
15
15
|
static styles: CSSResultGroup;
|
16
|
-
/** @internal */
|
17
16
|
private _onClick?;
|
18
|
-
/** @internal */
|
19
17
|
protected _onRemove?: (event: Event) => void;
|
20
|
-
/** Specifies Tag size
|
18
|
+
/** Specifies Tag size */
|
21
19
|
size: 'sm' | 'md' | 'lg';
|
22
|
-
/**
|
20
|
+
/**
|
21
|
+
* If defined, displays leading/provided icon
|
22
|
+
* @type { "arrowDown" | "arrowDownUp" | "arrowLeft" | "arrowRight" | "arrowUp" | "article" | "artificialIntelligence" | "asset" | "attachment" | "bandCursor" | "bands" | "batteryEmpty" | "batteryFull" | "batteryLow" | "bearingFault" | "book" | "bulb" | "burger" | "cPM" | "calendar" | "calendarBooked" | "calendarEmpty" | "calendarNotBooked" | "calendarRecurring" | "caretDown" | "caretUp" | "caretUpDown" | "chat" | "check" | "checkCircle" | "checkSmall" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "chevronUpDown" | "close" | "closeAllFaults" | "closeFault" | "closeSmall" | "columnGraph" | "comment" | "connection1" | "connection2" | "connection3" | "connection4" | "danger" | "defectFrequencies" | "defectFrequenciesAlternative" | "doubleChevronLeft" | "doubleChevronRight" | "download" | "draft" | "draftFilled" | "draftOutlined" | "dragNDrop" | "drop" | "duplicate" | "edit" | "emailFilled" | "emailOutlined" | "exclamation" | "eye" | "eyeHidden" | "eyeVisible" | "filter" | "forbidden" | "fullScreen" | "fullScreenExit" | "functionalLocation" | "harmonicCursor" | "heatmap" | "hierarchy" | "history" | "historyAlt" | "hourglassFramedFilled" | "hourglassFramedOutlined" | "hourglassOutlined" | "hz" | "iMX" | "image" | "infoCircleFilled" | "infoCircleOutlined" | "integration" | "kebab" | "link" | "listGroup" | "listItem" | "locationPin" | "lock" | "logOut" | "meatballs" | "microphone" | "minus" | "minusSmall" | "noData" | "o" | "openInNew" | "overlayBaseline" | "pDF" | "paper" | "pause" | "pieChart" | "pin" | "play" | "plus" | "powerOff" | "printer" | "proCollect" | "recAction" | "received" | "refresh" | "reorder" | "replace" | "reply" | "rewalkableRoute" | "routes" | "search" | "send" | "sensorA" | "sensorB" | "settings" | "sidebandCursor" | "singleCursor" | "spectrum" | "starFilled" | "starOutlined" | "statusCircle" | "stop" | "structuralVibration" | "sync" | "timewave" | "trash" | "trend" | "trendingUp" | "undo" | "unknownCircle" | "unknownDiamond" | "unlink" | "unlock" | "unscheduledAction" | "upload" | "user" | "viewFull" | "viewHorizontal" | "viewVertical" | "warning" | "warningCircle" | "warningDiamond" | "zoomIn" | "zoomOut" }
|
23
|
+
*/
|
23
24
|
icon?: Icon;
|
24
|
-
/**
|
25
|
+
/**
|
26
|
+
* If defined, gives the supplied appearance
|
27
|
+
* @type { "warning" | "success" | "info" | "error" | "alert" }
|
28
|
+
*/
|
25
29
|
color?: SeverityBgColor;
|
26
|
-
/** If
|
30
|
+
/** If defined, accepts a function that runs on click */
|
27
31
|
set onClick(onClickFn: ((event: Event) => void) | undefined);
|
28
32
|
get onClick(): ((event: Event) => void) | undefined;
|
29
|
-
/** If
|
33
|
+
/** If defined, accepts a function that runs on click. Self removal can be overridden by using `event.stopPropagation()`. */
|
30
34
|
set onRemove(onRemoveFn: ((event: Event) => void) | undefined);
|
31
35
|
get onRemove(): ((event: Event) => void) | undefined;
|
32
36
|
/** If true, adds trailing button to remove tag */
|
33
37
|
removable?: boolean;
|
38
|
+
/** @internal */
|
34
39
|
$removeButton: HTMLButtonElement;
|
35
40
|
connectedCallback(): void;
|
36
41
|
disconnectedCallback(): void;
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
|
-
import { SkfElement as
|
3
|
-
import
|
2
|
+
import { SkfElement as u } from "../../internal/components/skf-element.js";
|
3
|
+
import d from "../../styles/component.styles.js";
|
4
4
|
import { html as a, nothing as m } from "lit";
|
5
|
-
import { property as
|
5
|
+
import { property as s, query as f } from "lit/decorators.js";
|
6
6
|
import { ifDefined as v } from "lit/directives/if-defined.js";
|
7
7
|
import { styles as k } from "./tag.styles.js";
|
8
|
-
var
|
9
|
-
for (var t = n > 1 ? void 0 : n ?
|
8
|
+
var y = Object.defineProperty, C = Object.getOwnPropertyDescriptor, r = (p, e, i, n) => {
|
9
|
+
for (var t = n > 1 ? void 0 : n ? C(e, i) : e, l = p.length - 1, c; l >= 0; l--)
|
10
10
|
(c = p[l]) && (t = (n ? c(e, i, t) : c(t)) || t);
|
11
|
-
return n && t &&
|
11
|
+
return n && t && y(e, i, t), t;
|
12
12
|
};
|
13
|
-
const h = class h extends
|
13
|
+
const h = class h extends u {
|
14
14
|
constructor() {
|
15
15
|
super(...arguments), this.size = "md", this._handleKeyDown = (e) => {
|
16
16
|
(e.key === "Enter" || e.key === " ") && this.$removeButton.click();
|
@@ -20,7 +20,7 @@ const h = class h extends d {
|
|
20
20
|
var t;
|
21
21
|
e.stopPropagation();
|
22
22
|
const i = e.composedPath()[0];
|
23
|
-
|
23
|
+
console.log("$clickTarget", i), i.localName === "button" ? this.remove() : (t = this.onClick) == null || t.call(this, e);
|
24
24
|
};
|
25
25
|
}
|
26
26
|
set onClick(e) {
|
@@ -42,11 +42,11 @@ const h = class h extends d {
|
|
42
42
|
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
|
43
43
|
}
|
44
44
|
attributeChangedCallback(e, i, n) {
|
45
|
-
super.attributeChangedCallback(e, i, n), e === "removable" && n !== null ?
|
45
|
+
super.attributeChangedCallback(e, i, n), e === "removable" && n !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
|
46
46
|
}
|
47
47
|
render() {
|
48
48
|
return a`
|
49
|
-
<div id="
|
49
|
+
<div id="root">
|
50
50
|
${this.icon ? a`<skf-icon color=${v(this.color)} name=${this.icon} size="sm"></skf-icon>` : m}
|
51
51
|
<span>
|
52
52
|
<slot></slot>
|
@@ -60,27 +60,27 @@ const h = class h extends d {
|
|
60
60
|
`;
|
61
61
|
}
|
62
62
|
};
|
63
|
-
h.styles = [
|
63
|
+
h.styles = [d, k];
|
64
64
|
let o = h;
|
65
|
-
|
66
|
-
|
65
|
+
r([
|
66
|
+
s({ reflect: !0 })
|
67
67
|
], o.prototype, "size", 2);
|
68
|
-
|
69
|
-
|
68
|
+
r([
|
69
|
+
s()
|
70
70
|
], o.prototype, "icon", 2);
|
71
|
-
|
72
|
-
|
71
|
+
r([
|
72
|
+
s({ reflect: !0 })
|
73
73
|
], o.prototype, "color", 2);
|
74
|
-
|
75
|
-
|
74
|
+
r([
|
75
|
+
s({ attribute: !1 })
|
76
76
|
], o.prototype, "onClick", 1);
|
77
|
-
|
78
|
-
|
77
|
+
r([
|
78
|
+
s({ attribute: !1 })
|
79
79
|
], o.prototype, "onRemove", 1);
|
80
|
-
|
81
|
-
|
80
|
+
r([
|
81
|
+
s({ type: Boolean, reflect: !0 })
|
82
82
|
], o.prototype, "removable", 2);
|
83
|
-
|
83
|
+
r([
|
84
84
|
f("button")
|
85
85
|
], o.prototype, "$removeButton", 2);
|
86
86
|
export {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
2
|
const s = r`
|
3
3
|
@layer components {
|
4
|
-
#
|
4
|
+
#root {
|
5
5
|
align-items: center;
|
6
6
|
background-color: var(--_skf-tag-bg-color, var(--skf-bg-color-neutral-1));
|
7
7
|
block-size: var(--_skf-tag-height, var(--skf-size-32));
|
@@ -55,6 +55,11 @@ const s = r`
|
|
55
55
|
|
56
56
|
button {
|
57
57
|
display: flex;
|
58
|
+
|
59
|
+
&:focus-visible {
|
60
|
+
border-radius: var(--skf-border-radius-sm);
|
61
|
+
outline: var(--skf-border-width-md) solid var(--skf-interactive-border-color-focus);
|
62
|
+
}
|
58
63
|
}
|
59
64
|
}
|
60
65
|
`;
|
@@ -12,7 +12,7 @@ interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
|
|
12
12
|
/**
|
13
13
|
* The skf-textarea is used to create a textarea. Use it inside a form element or wherever you like.
|
14
14
|
*
|
15
|
-
* @documentation See [
|
15
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/143f9d-text-area) for design principles.
|
16
16
|
*
|
17
17
|
* @attribute {boolean} disabled - If true, sets disabled state
|
18
18
|
* @attribute {boolean} required - If true, value is required or must be checked for the form to be submittable
|
@@ -20,48 +20,51 @@ interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
|
|
20
20
|
* @event change - Fires when the value of the input changes
|
21
21
|
* @event invalid - Fires when the input is invalid
|
22
22
|
*
|
23
|
-
* @slot The textareas label. Alternatively, you can use the `label` attribute.
|
23
|
+
* @slot - The textareas label. Alternatively, you can use the `label` attribute.
|
24
24
|
*
|
25
25
|
* @tagname skf-textarea
|
26
26
|
*/
|
27
27
|
export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
|
28
28
|
static styles: CSSResultGroup;
|
29
29
|
private customError;
|
30
|
-
/** If
|
31
|
-
cols?: number
|
32
|
-
/** If
|
30
|
+
/** If defined, sets the cols of the textarea */
|
31
|
+
cols?: number;
|
32
|
+
/** If defined, forces component to invalid state until removed. Its value is used as hint text. */
|
33
33
|
set customInvalid(value: string | undefined);
|
34
34
|
get customInvalid(): string | undefined;
|
35
|
-
/** If
|
36
|
-
debug
|
37
|
-
/**
|
38
|
-
hideLabel
|
39
|
-
/** If
|
35
|
+
/** If true, outputs helping hints in console */
|
36
|
+
debug?: boolean;
|
37
|
+
/** If true, hides the label visually */
|
38
|
+
hideLabel?: boolean;
|
39
|
+
/** If defined, displays informational text below the field */
|
40
40
|
hint?: string;
|
41
|
-
/**
|
42
|
-
label
|
43
|
-
/** If
|
41
|
+
/** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
|
42
|
+
label?: string;
|
43
|
+
/** If defined, adds name to the input-element */
|
44
44
|
name?: string;
|
45
|
-
/** If
|
45
|
+
/** If defined, sets the maximum character length to accept for this input */
|
46
46
|
maxLength?: number;
|
47
|
-
/** If
|
47
|
+
/** If defined, sets the minimum character length to accept for this input */
|
48
48
|
minLength?: number;
|
49
|
-
/** If
|
49
|
+
/** If defined, displays placeholder text */
|
50
50
|
placeholder?: string;
|
51
51
|
/** If true, makes the element not mutable, meaning the user can not edit the control */
|
52
52
|
readonly?: boolean;
|
53
|
-
/** If
|
53
|
+
/** If defined, renders an alternative A11y text for the asterisk */
|
54
54
|
requiredLabel?: string;
|
55
|
-
/** If
|
56
|
-
rows?: number
|
57
|
-
/**
|
55
|
+
/** If defined, sets the rows of the textarea */
|
56
|
+
rows?: number;
|
57
|
+
/**
|
58
|
+
* If defined, displays provided severity state
|
59
|
+
* @type {"success" | "info" | "warning" | "alert"}
|
60
|
+
*/
|
58
61
|
severity?: SkfTextAreaProps['severity'];
|
59
62
|
/** If true, displays valid state after interaction */
|
60
63
|
showValid?: boolean;
|
61
|
-
/**
|
64
|
+
/** Size of the Textarea */
|
62
65
|
size?: 'sm' | 'md';
|
63
|
-
/**
|
64
|
-
validateOn
|
66
|
+
/** Sets validation start */
|
67
|
+
validateOn: 'input' | 'change' | 'submit';
|
65
68
|
/** The current value of the text area */
|
66
69
|
value: string;
|
67
70
|
/** @internal */
|
@@ -14,7 +14,7 @@ var $ = Object.defineProperty, E = Object.getOwnPropertyDescriptor, e = (h, t, s
|
|
14
14
|
};
|
15
15
|
const u = class u extends m {
|
16
16
|
constructor() {
|
17
|
-
super(...arguments), this.
|
17
|
+
super(...arguments), this.size = "md", this.validateOn = "change", this.value = "", this.invalid = !1, this._resetValue = (t) => {
|
18
18
|
var s;
|
19
19
|
t.stopPropagation(), this.value = ((s = this.getAttribute("value")) == null ? void 0 : s.trim()) ?? "", this._internals.setFormValue(this.value), this.$input.focus();
|
20
20
|
}, this._handleInput = () => {
|
@@ -22,7 +22,7 @@ const u = class u extends m {
|
|
22
22
|
};
|
23
23
|
}
|
24
24
|
set customInvalid(t) {
|
25
|
-
this.customError =
|
25
|
+
this.customError = t || "";
|
26
26
|
}
|
27
27
|
get customInvalid() {
|
28
28
|
return this.customError;
|
@@ -78,14 +78,15 @@ const u = class u extends m {
|
|
78
78
|
render() {
|
79
79
|
var t, s;
|
80
80
|
return p`
|
81
|
-
<div id="
|
81
|
+
<div id="root">
|
82
82
|
<label>
|
83
83
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
84
|
-
|
84
|
+
<slot>${this.label}</slot> ${this.required ? c(this.requiredLabel) : null}
|
85
85
|
</div>
|
86
86
|
<div id="input">
|
87
87
|
<textarea
|
88
88
|
?disabled=${this.disabled}
|
89
|
+
?readonly=${this.readonly}
|
89
90
|
?required=${this.required}
|
90
91
|
.value=${this.value}
|
91
92
|
@input=${this._handleInput}
|
@@ -93,22 +94,24 @@ const u = class u extends m {
|
|
93
94
|
aria-errormessage=${n((s = this.hint) != null && s.trim() ? "hint" : v)}
|
94
95
|
aria-invalid=${!!this.invalid}
|
95
96
|
cols=${n(this.cols)}
|
96
|
-
name=${n(this.name)}
|
97
97
|
maxlength=${n(this.maxLength)}
|
98
98
|
minlength=${n(this.minLength)}
|
99
|
+
name=${n(this.name)}
|
99
100
|
placeholder=${n(this.placeholder)}
|
100
|
-
?readonly=${this.readonly}
|
101
101
|
rows=${n(this.rows)}
|
102
102
|
>
|
103
103
|
</textarea>
|
104
104
|
</div>
|
105
105
|
</label>
|
106
|
-
${this.hint && p
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
106
|
+
${this.hint && p`
|
107
|
+
<skf-hint
|
108
|
+
aria-live=${this.invalid ? "assertive" : "polite"}
|
109
|
+
id="hint"
|
110
|
+
severity=${n(_(this.severity, this.invalid))}
|
111
|
+
>
|
112
|
+
${this.customInvalid ? this.customInvalid : this.hint}
|
113
|
+
</skf-hint>
|
114
|
+
`}
|
112
115
|
</div>
|
113
116
|
`;
|
114
117
|
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { SkfElement } from '@internal/components/skf-element';
|
2
|
+
import { type CSSResultGroup } from 'lit';
|
3
|
+
/**
|
4
|
+
* 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.
|
5
|
+
* The singleton instance will create a new toast notification (using SkfAlert) and append it to SkfToastWrapper (or append SkfToastWrapper if it doesn't exist yet) and mount that to the DOM.
|
6
|
+
* Once a toast notification is created, it will be removed after a set amount of time (if not set as a closeable SkfToast) together with the original SkfToast.
|
7
|
+
* Once the queue in the singleton is empty, the SkfToastWrapper will be removed from the DOM.
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* A simple toast component that displays a message to the user. Use by appending a <skf-toast> tag to the DOM. Position in DOM is irrelevant.
|
11
|
+
*
|
12
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/98e432-toast) for design principles
|
13
|
+
*
|
14
|
+
* @slot - The component's placeholder content
|
15
|
+
*
|
16
|
+
* @tagname skf-toast
|
17
|
+
*/
|
18
|
+
export declare class SkfToast extends SkfElement {
|
19
|
+
static styles: CSSResultGroup;
|
20
|
+
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
|
+
debug: boolean;
|
24
|
+
/** Severity of the toast. */
|
25
|
+
severity: 'info' | 'success' | 'warning' | 'error';
|
26
|
+
/** Time in seconds before the toast disappears. */
|
27
|
+
timer: number;
|
28
|
+
/** offsets where toasts emerge vertically */
|
29
|
+
topOffset?: number;
|
30
|
+
/** @internal */
|
31
|
+
_slottedText: Node[];
|
32
|
+
constructor();
|
33
|
+
firstUpdated(): void;
|
34
|
+
render(): import("lit").TemplateResult<1>;
|
35
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { Singleton as f } from "./toast.singleton.js";
|
2
|
+
import { SkfElement as m } from "../../internal/components/skf-element.js";
|
3
|
+
import { html as h } from "lit";
|
4
|
+
import { property as s, queryAssignedNodes as y } from "lit/decorators.js";
|
5
|
+
import { styles as a } from "./toast.style.js";
|
6
|
+
var u = Object.defineProperty, o = (l, r, n, b) => {
|
7
|
+
for (var e = void 0, i = l.length - 1, d; i >= 0; i--)
|
8
|
+
(d = l[i]) && (e = d(r, n, e) || e);
|
9
|
+
return e && u(r, n, e), e;
|
10
|
+
};
|
11
|
+
const p = class p extends m {
|
12
|
+
constructor() {
|
13
|
+
super(), this.closeable = !1, this.debug = !1, this.severity = "info", this.timer = 5, this._singleton = void 0;
|
14
|
+
}
|
15
|
+
firstUpdated() {
|
16
|
+
this._singleton = new f(this.getRootNode()), this._singleton.addData({
|
17
|
+
text: this._slottedText.map((r) => r.textContent).join(),
|
18
|
+
timer: this.timer,
|
19
|
+
closeable: this.closeable,
|
20
|
+
originEl: this,
|
21
|
+
severity: this.severity,
|
22
|
+
topOffset: this.topOffset,
|
23
|
+
debug: this.debug
|
24
|
+
});
|
25
|
+
}
|
26
|
+
render() {
|
27
|
+
return h`<slot></slot>`;
|
28
|
+
}
|
29
|
+
};
|
30
|
+
p.styles = [a];
|
31
|
+
let t = p;
|
32
|
+
o([
|
33
|
+
s({ type: Boolean })
|
34
|
+
], t.prototype, "closeable");
|
35
|
+
o([
|
36
|
+
s({ type: Boolean })
|
37
|
+
], t.prototype, "debug");
|
38
|
+
o([
|
39
|
+
s()
|
40
|
+
], t.prototype, "severity");
|
41
|
+
o([
|
42
|
+
s({ type: Number })
|
43
|
+
], t.prototype, "timer");
|
44
|
+
o([
|
45
|
+
s({ type: Number })
|
46
|
+
], t.prototype, "topOffset");
|
47
|
+
o([
|
48
|
+
y()
|
49
|
+
], t.prototype, "_slottedText");
|
50
|
+
export {
|
51
|
+
t as SkfToast
|
52
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import '@components/toast-item/toast-item.js';
|
2
|
+
import '@components/toast-wrapper/toast-wrapper.js';
|
3
|
+
import type { SkfToast } from '@components/toast/toast.component.js';
|
4
|
+
interface ToastData {
|
5
|
+
text: string;
|
6
|
+
timer: number;
|
7
|
+
closeable: boolean;
|
8
|
+
topOffset?: number;
|
9
|
+
originEl: SkfToast;
|
10
|
+
severity: 'info' | 'success' | 'warning' | 'error';
|
11
|
+
debug: boolean;
|
12
|
+
}
|
13
|
+
export declare class Singleton {
|
14
|
+
private static instance?;
|
15
|
+
data: ToastData[];
|
16
|
+
root: Document;
|
17
|
+
usePopover: boolean;
|
18
|
+
constructor(root: Document);
|
19
|
+
hasToasts(): boolean;
|
20
|
+
popToast(): ToastData | undefined;
|
21
|
+
getData(): ToastData[];
|
22
|
+
setData(data: ToastData[]): void;
|
23
|
+
addData(data: ToastData): void;
|
24
|
+
udpateUI(): void;
|
25
|
+
}
|
26
|
+
export {};
|
@@ -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;
|