@skf-design-system/ui-components 0.0.1-beta.4 → 1.0.0-alpha.28
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/custom-elements.json +18265 -0
- 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 +24 -0
- 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 +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 +17 -15
- 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 +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 +44 -29
- package/dist/components/input/input.component.js +118 -111
- 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/progress/progress.component.d.ts +22 -0
- package/dist/components/progress/progress.component.js +40 -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 +47 -0
- package/dist/components/radio/radio.component.d.ts +18 -18
- 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 +140 -0
- package/dist/components/select/select.component.js +327 -0
- package/dist/components/select/select.controllers.d.ts +59 -0
- package/dist/components/select/select.controllers.js +172 -0
- package/dist/components/select/select.d.ts +8 -0
- package/dist/components/select/select.js +6 -0
- package/dist/components/select/select.styles.d.ts +1 -0
- package/dist/components/select/select.styles.js +131 -0
- package/dist/components/select-option/select-option.component.d.ts +77 -0
- package/dist/components/select-option/select-option.component.js +123 -0
- package/dist/components/select-option/select-option.controllers.d.ts +9 -0
- package/dist/components/select-option/select-option.d.ts +8 -0
- package/dist/components/select-option/select-option.js +6 -0
- package/dist/components/select-option/select-option.styles.d.ts +1 -0
- package/dist/components/select-option/select-option.styles.js +53 -0
- package/dist/components/select-option-group/select-option-group.component.d.ts +16 -0
- package/dist/components/select-option-group/select-option-group.component.js +31 -0
- package/dist/components/select-option-group/select-option-group.d.ts +8 -0
- package/dist/components/select-option-group/select-option-group.js +6 -0
- package/dist/components/select-option-group/select-option-group.style.d.ts +1 -0
- package/dist/components/select-option-group/select-option-group.style.js +18 -0
- package/dist/components/switch/switch.component.d.ts +2 -3
- package/dist/components/switch/switch.component.js +5 -2
- package/dist/components/switch/switch.styles.js +6 -1
- 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 +25 -4
- package/dist/components/tag/tag.component.js +66 -29
- package/dist/components/tag/tag.styles.js +6 -5
- package/dist/components/textarea/textarea.component.d.ts +26 -23
- 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 +2146 -616
- package/dist/index.d.ts +8 -0
- package/dist/index.js +60 -36
- package/dist/internal/components/formBase.d.ts +19 -1
- package/dist/internal/components/formBase.js +29 -17
- 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.d.ts +4 -4
- package/dist/internal/components/skf-element.js +15 -19
- package/dist/internal/helpers/array.d.ts +4 -0
- package/dist/internal/helpers/findMatchingTags.d.ts +2 -0
- package/dist/internal/helpers/findMatchingTags.js +12 -0
- package/dist/internal/helpers/hintSeverity.d.ts +2 -0
- package/dist/internal/helpers/hintSeverity.js +6 -0
- package/dist/internal/helpers/raiseError.d.ts +28 -0
- package/dist/internal/helpers/raiseError.js +29 -0
- 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 -6
- package/dist/react/index.d.ts +9 -0
- package/dist/react/index.js +9 -0
- package/dist/react/skf-button/index.d.ts +7 -1
- package/dist/react/skf-button/index.js +5 -1
- package/dist/react/skf-progress/index.d.ts +3 -0
- package/dist/react/skf-progress/index.js +13 -0
- package/dist/react/skf-select/index.d.ts +21 -0
- package/dist/react/skf-select/index.js +21 -0
- package/dist/react/skf-select-option/index.d.ts +9 -0
- package/dist/react/skf-select-option/index.js +17 -0
- package/dist/react/skf-select-option-group/index.d.ts +3 -0
- package/dist/react/skf-select-option-group/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/form-field.styles.js +11 -7
- package/dist/types/jsx/custom-element-jsx.d.ts +166 -995
- package/dist/types/vue/index.d.ts +368 -94
- package/dist/vscode.html-custom-data.json +408 -106
- package/dist/web-types.json +932 -281
- package/package.json +39 -35
@@ -1,23 +1,26 @@
|
|
1
1
|
import '@components/collapse/collapse.js';
|
2
2
|
import { SkfElement } from '@internal/components/skf-element.js';
|
3
3
|
import type { HeadingType } from '@internal/constants/heading.js';
|
4
|
-
import { type CSSResultGroup } from 'lit';
|
4
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
5
5
|
/**
|
6
6
|
* The `<skf-accordion>` component consists of multiple `<skf-collapse>`, working together.
|
7
7
|
*
|
8
|
-
* See [
|
8
|
+
* See [zeroheight](https://zeroheight.com/853e936c9/p/6590bf-accordion) for design principles.
|
9
9
|
*
|
10
10
|
* @slot - Expects one or more <skf-accordion-item> element(s)
|
11
11
|
*
|
12
|
-
* @
|
12
|
+
* @tagname skf-accordion
|
13
13
|
*/
|
14
14
|
export declare class SkfAccordion extends SkfElement {
|
15
15
|
static styles: CSSResultGroup;
|
16
16
|
/** If true, will animate the expand/collapse state */
|
17
17
|
animated?: boolean;
|
18
|
-
/**
|
18
|
+
/**
|
19
|
+
* Defines which heading element will be rendered
|
20
|
+
* @type { "h1" | "h2" | "h3" | "h4" }
|
21
|
+
*/
|
19
22
|
headingAs: Exclude<HeadingType, 'h1'>;
|
20
|
-
/** If
|
23
|
+
/** If true, adds a gap between each item */
|
21
24
|
gap?: boolean;
|
22
25
|
/** If true, allowes multiple accordion items to open */
|
23
26
|
multiple?: boolean;
|
@@ -27,6 +30,7 @@ export declare class SkfAccordion extends SkfElement {
|
|
27
30
|
truncate?: boolean;
|
28
31
|
/** @internal */
|
29
32
|
private $accordionItems;
|
33
|
+
protected updated(_changedProperties: PropertyValues): void;
|
30
34
|
/** @internal */
|
31
35
|
private get items();
|
32
36
|
/** @internal */
|
@@ -1,22 +1,25 @@
|
|
1
1
|
import "../collapse/collapse.js";
|
2
|
-
import { SkfElement as
|
2
|
+
import { SkfElement as p } from "../../internal/components/skf-element.js";
|
3
3
|
import m from "../../styles/component.styles.js";
|
4
|
-
import { html as
|
5
|
-
import { property as
|
4
|
+
import { html as f } from "lit";
|
5
|
+
import { property as a, queryAssignedNodes as d } from "lit/decorators.js";
|
6
6
|
import c from "./accordion.styles.js";
|
7
|
-
var g = Object.defineProperty, r = (
|
8
|
-
for (var s = void 0, l =
|
9
|
-
(h =
|
7
|
+
var g = Object.defineProperty, r = (u, t, i, o) => {
|
8
|
+
for (var s = void 0, l = u.length - 1, h; l >= 0; l--)
|
9
|
+
(h = u[l]) && (s = h(t, i, s) || s);
|
10
10
|
return s && g(t, i, s), s;
|
11
11
|
};
|
12
|
-
const n = class n extends
|
12
|
+
const n = class n extends p {
|
13
13
|
constructor() {
|
14
14
|
super(...arguments), this.headingAs = "h2", this._setItemAttributes = () => {
|
15
15
|
this.items.forEach((t) => {
|
16
|
-
t.setAttribute("heading-as", this.headingAs), this.animated
|
16
|
+
t.setAttribute("heading-as", this.headingAs), this.animated ? t.setAttribute("animated", "") : t.hasAttribute("animated") && t.removeAttribute("animated"), this.small ? t.setAttribute("small", "") : t.hasAttribute("small") && t.removeAttribute("small"), this.truncate ? t.setAttribute("truncate", "") : t.hasAttribute("truncate") && t.removeAttribute("truncate");
|
17
17
|
});
|
18
18
|
};
|
19
19
|
}
|
20
|
+
updated(t) {
|
21
|
+
(t.has("animated") || t.has("headingAs") || t.has("small") || t.has("truncate")) && this._setItemAttributes();
|
22
|
+
}
|
20
23
|
/** @internal */
|
21
24
|
get items() {
|
22
25
|
return [...this.$accordionItems].filter((t) => t.localName === "skf-accordion-item");
|
@@ -24,13 +27,13 @@ const n = class n extends u {
|
|
24
27
|
_onChildToggle(t) {
|
25
28
|
if (this.multiple || t.defaultPrevented) return;
|
26
29
|
const i = t.target;
|
27
|
-
this.items.length && this.items.forEach((
|
28
|
-
|
30
|
+
this.items.length && this.items.forEach((o) => {
|
31
|
+
o !== i && o.hasAttribute("expanded") && o.setClose();
|
29
32
|
});
|
30
33
|
}
|
31
34
|
render() {
|
32
|
-
return
|
33
|
-
<div id="
|
35
|
+
return f`
|
36
|
+
<div id="root">
|
34
37
|
<slot
|
35
38
|
@skf-collapse-toggle=${(t) => {
|
36
39
|
this._onChildToggle(t);
|
@@ -44,25 +47,25 @@ const n = class n extends u {
|
|
44
47
|
n.styles = [c, m];
|
45
48
|
let e = n;
|
46
49
|
r([
|
47
|
-
|
50
|
+
a({ type: Boolean, reflect: !0 })
|
48
51
|
], e.prototype, "animated");
|
49
52
|
r([
|
50
|
-
|
53
|
+
a({ attribute: "heading-as" })
|
51
54
|
], e.prototype, "headingAs");
|
52
55
|
r([
|
53
|
-
|
56
|
+
a({ type: Boolean, reflect: !0 })
|
54
57
|
], e.prototype, "gap");
|
55
58
|
r([
|
56
|
-
|
59
|
+
a({ type: Boolean })
|
57
60
|
], e.prototype, "multiple");
|
58
61
|
r([
|
59
|
-
|
62
|
+
a({ type: Boolean, reflect: !0 })
|
60
63
|
], e.prototype, "small");
|
61
64
|
r([
|
62
|
-
|
65
|
+
a({ type: Boolean, reflect: !0 })
|
63
66
|
], e.prototype, "truncate");
|
64
67
|
r([
|
65
|
-
|
68
|
+
d()
|
66
69
|
], e.prototype, "$accordionItems");
|
67
70
|
export {
|
68
71
|
e as SkfAccordion
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { css as o } from "lit";
|
2
|
-
const
|
2
|
+
const t = o`
|
3
3
|
@layer components {
|
4
|
-
:host([gap]) #
|
4
|
+
:host([gap]) #root {
|
5
5
|
display: flex;
|
6
6
|
flex-direction: column;
|
7
7
|
gap: var(--skf-spacing-300);
|
@@ -9,5 +9,5 @@ const a = o`
|
|
9
9
|
}
|
10
10
|
`;
|
11
11
|
export {
|
12
|
-
|
12
|
+
t as default
|
13
13
|
};
|
@@ -6,24 +6,27 @@ import { type CSSResultGroup } from 'lit';
|
|
6
6
|
/**
|
7
7
|
* The `<skf-alert>` is a type of notification that appears in-line
|
8
8
|
*
|
9
|
-
* @documentation See [
|
9
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/990ec5-alert) for design principles
|
10
10
|
*
|
11
11
|
* @event skf-alert-close - Fires when the close button is clicked
|
12
12
|
*
|
13
13
|
* @slot - Alert message. **Notice!** See design principles for approved content
|
14
|
-
* @slot link -
|
14
|
+
* @slot link - Slot for the link
|
15
15
|
*
|
16
16
|
* @tagname skf-alert
|
17
17
|
*/
|
18
18
|
export declare class SkfAlert extends SkfElement {
|
19
19
|
static styles: CSSResultGroup;
|
20
|
-
/** If true, alert is being used as a toast with an close button */
|
20
|
+
/** If true, alert is being used as a toast (alertdialog) with an close button */
|
21
21
|
closeable?: boolean;
|
22
22
|
/** Close button aria-label */
|
23
23
|
buttonLabel: string;
|
24
24
|
/** If defined, displays leading icon */
|
25
25
|
icon?: SkfIcon['name'];
|
26
|
-
/**
|
26
|
+
/**
|
27
|
+
* If defined, gives the supplied appearance
|
28
|
+
* @type { "error" | "info" | "warning" | "success" | "alert" }
|
29
|
+
*/
|
27
30
|
severity?: SeverityFgColor;
|
28
31
|
/** @internal */
|
29
32
|
private _handleClose;
|
@@ -1,30 +1,32 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
|
-
import { SkfElement as
|
2
|
+
import { SkfElement as d } from "../../internal/components/skf-element.js";
|
3
3
|
import b from "../../styles/component.styles.js";
|
4
|
-
import { html as
|
4
|
+
import { html as p, nothing as f } from "lit";
|
5
5
|
import { property as o } from "lit/decorators.js";
|
6
|
-
import { ifDefined as
|
7
|
-
import
|
8
|
-
var
|
9
|
-
for (var t = void 0,
|
10
|
-
(
|
11
|
-
return t &&
|
6
|
+
import { ifDefined as s } from "lit/directives/if-defined.js";
|
7
|
+
import u from "./alert.styles.js";
|
8
|
+
var h = Object.defineProperty, i = (n, a, m, y) => {
|
9
|
+
for (var t = void 0, r = n.length - 1, c; r >= 0; r--)
|
10
|
+
(c = n[r]) && (t = c(a, m, t) || t);
|
11
|
+
return t && h(a, m, t), t;
|
12
12
|
};
|
13
|
-
const l = class l extends
|
13
|
+
const l = class l extends d {
|
14
14
|
constructor() {
|
15
|
-
super(...arguments), this.buttonLabel = "Close", this._handleClose = () =>
|
15
|
+
super(...arguments), this.buttonLabel = "Close", this._handleClose = () => {
|
16
|
+
this.emit("skf-alert-close");
|
17
|
+
};
|
16
18
|
}
|
17
19
|
render() {
|
18
|
-
return
|
20
|
+
return p`
|
19
21
|
<div
|
20
|
-
id="
|
22
|
+
id="root"
|
21
23
|
aria-describedby="main"
|
22
|
-
aria-modal=${
|
24
|
+
aria-modal=${s(this.closeable && "true")}
|
23
25
|
role=${this.closeable ? "alertdialog" : "alert"}
|
24
26
|
>
|
25
27
|
<skf-icon
|
26
|
-
color=${
|
27
|
-
name=${
|
28
|
+
color=${s(this.severity ?? "secondary")}
|
29
|
+
name=${s(this.icon)}
|
28
30
|
size="sm"
|
29
31
|
></skf-icon>
|
30
32
|
<div id="body">
|
@@ -33,7 +35,7 @@ const l = class l extends c {
|
|
33
35
|
</div>
|
34
36
|
<slot name="link"></slot>
|
35
37
|
</div>
|
36
|
-
${this.closeable ?
|
38
|
+
${this.closeable ? p`
|
37
39
|
<button @click="${this._handleClose}" aria-label=${this.buttonLabel} type="button">
|
38
40
|
<skf-icon name="close" size="sm"></skf-icon>
|
39
41
|
</button>
|
@@ -42,10 +44,10 @@ const l = class l extends c {
|
|
42
44
|
`;
|
43
45
|
}
|
44
46
|
};
|
45
|
-
l.styles = [b,
|
47
|
+
l.styles = [b, u];
|
46
48
|
let e = l;
|
47
49
|
i([
|
48
|
-
o({ type: Boolean })
|
50
|
+
o({ type: Boolean, reflect: !0 })
|
49
51
|
], e.prototype, "closeable");
|
50
52
|
i([
|
51
53
|
o({ attribute: "button-label" })
|
@@ -54,7 +56,7 @@ i([
|
|
54
56
|
o()
|
55
57
|
], e.prototype, "icon");
|
56
58
|
i([
|
57
|
-
o()
|
59
|
+
o({ reflect: !0 })
|
58
60
|
], e.prototype, "severity");
|
59
61
|
export {
|
60
62
|
e as SkfAlert
|
@@ -1,61 +1,64 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
2
|
const s = r`
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
#alert {
|
8
|
-
background-color: var(--_skf-alert-bg-color, var(--skf-bg-color-neutral-2));
|
9
|
-
border: var(--skf-border-width-sm) solid
|
10
|
-
var(--_skf-alert-border-color, var(--skf-border-color-primary));
|
11
|
-
border-radius: var(--skf-border-radius-sm);
|
12
|
-
box-shadow: var(--skf-shadow-md);
|
13
|
-
display: flex;
|
14
|
-
font-size: var(--skf-font-size-75);
|
15
|
-
gap: var(--skf-spacing-50);
|
16
|
-
padding-block: var(--skf-spacing-75);
|
17
|
-
padding-inline: var(--skf-spacing-50);
|
18
|
-
|
19
|
-
:host([severity='alert']) & {
|
20
|
-
--_skf-alert-bg-color: var(--skf-severity-bg-color-alert);
|
21
|
-
--_skf-alert-border-color: var(--skf-severity-fg-color-alert);
|
3
|
+
@layer components {
|
4
|
+
:host {
|
5
|
+
contain: layout;
|
22
6
|
}
|
23
7
|
|
24
|
-
|
25
|
-
--_skf-alert-bg-color
|
26
|
-
|
27
|
-
|
8
|
+
#root {
|
9
|
+
background-color: var(--_skf-alert-bg-color, var(--skf-bg-color-neutral-2));
|
10
|
+
border: var(--skf-border-width-sm) solid
|
11
|
+
var(--_skf-alert-border-color, var(--skf-border-color-primary));
|
12
|
+
border-radius: var(--skf-border-radius-sm);
|
13
|
+
box-shadow: var(--skf-shadow-md);
|
14
|
+
display: flex;
|
15
|
+
font-size: var(--skf-font-size-75);
|
16
|
+
gap: var(--skf-spacing-50);
|
17
|
+
padding-block: var(--skf-spacing-75);
|
18
|
+
padding-inline: var(--skf-spacing-50);
|
28
19
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
20
|
+
:host([severity='alert']) & {
|
21
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-alert);
|
22
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-alert);
|
23
|
+
}
|
33
24
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
25
|
+
:host([severity='error']) & {
|
26
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-error);
|
27
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-error);
|
28
|
+
}
|
29
|
+
|
30
|
+
:host([severity='info']) & {
|
31
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-info);
|
32
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-info);
|
33
|
+
}
|
34
|
+
|
35
|
+
:host([severity='success']) & {
|
36
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-success);
|
37
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-success);
|
38
|
+
}
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
:host([severity='warning']) & {
|
41
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-warning);
|
42
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-warning);
|
43
|
+
}
|
42
44
|
}
|
43
|
-
}
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
#body {
|
47
|
+
display: flex;
|
48
|
+
flex: auto;
|
49
|
+
flex-wrap: wrap;
|
50
|
+
gap: var(--skf-spacing-25) var(--skf-spacing-100);
|
51
|
+
justify-content: space-between;
|
52
|
+
}
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
::slotted(skf-link) {
|
55
|
+
text-transform: uppercase;
|
56
|
+
}
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
button {
|
59
|
+
cursor: pointer;
|
60
|
+
display: inline-flex;
|
61
|
+
}
|
59
62
|
}
|
60
63
|
`;
|
61
64
|
export {
|
@@ -8,12 +8,22 @@ import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8
8
|
*
|
9
9
|
* @slot - The Primary content
|
10
10
|
*
|
11
|
+
* @event click - Fires when the button is clicked
|
12
|
+
*
|
11
13
|
* @tagname skf-button
|
12
14
|
*/
|
13
15
|
export declare class SkfButton extends SkfElement {
|
16
|
+
static formAssociated: boolean;
|
17
|
+
static shadowRootOptions: {
|
18
|
+
delegatesFocus: boolean;
|
19
|
+
mode: ShadowRootMode;
|
20
|
+
serializable?: boolean;
|
21
|
+
slotAssignment?: SlotAssignmentMode;
|
22
|
+
};
|
14
23
|
static styles: CSSResultGroup;
|
15
24
|
/** @internal */
|
16
25
|
private _transitionOptions;
|
26
|
+
_internals: ElementInternals;
|
17
27
|
/** If true, gives destructive appearance. **Notice!** Only applicable if `variant` is `primary`. */
|
18
28
|
destructive: boolean;
|
19
29
|
/** If true, removes border */
|
@@ -25,6 +35,7 @@ export declare class SkfButton extends SkfElement {
|
|
25
35
|
iconPosition?: 'left' | 'right';
|
26
36
|
/** If true, hides text & icon and shows loading indicator. **Notice!** Only applicable if `variant` is `primary`. */
|
27
37
|
loading: boolean;
|
38
|
+
noValidate: boolean;
|
28
39
|
/** If provided, displays an alternative size */
|
29
40
|
size: 'sm' | 'md' | 'lg';
|
30
41
|
/** If provided, changes the button type */
|
@@ -38,9 +49,22 @@ export declare class SkfButton extends SkfElement {
|
|
38
49
|
private $loader?;
|
39
50
|
/** @internal */
|
40
51
|
private $body?;
|
52
|
+
/** @internal */
|
53
|
+
private $button?;
|
54
|
+
constructor();
|
41
55
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
42
56
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
57
|
+
/** @internal */
|
58
|
+
_handleClick: (e: MouseEvent) => void;
|
59
|
+
/** @internal */
|
60
|
+
_submitForm: () => void;
|
61
|
+
/** @internal */
|
62
|
+
_resetForm: () => void;
|
63
|
+
/** Simulates a click on the button. */
|
64
|
+
click(): void;
|
65
|
+
/** @internal */
|
43
66
|
private _showLoader;
|
67
|
+
/** @internal */
|
44
68
|
private _hideLoader;
|
45
69
|
/** @internal */
|
46
70
|
private _renderIcon;
|
@@ -1,48 +1,66 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
2
|
import "../loader/loader.js";
|
3
|
-
import { SkfElement as
|
3
|
+
import { SkfElement as f } from "../../internal/components/skf-element.js";
|
4
4
|
import b from "../../styles/component.styles.js";
|
5
|
-
import { html as
|
6
|
-
import { property as
|
5
|
+
import { html as h, LitElement as m } from "lit";
|
6
|
+
import { property as s, state as u, query as p } from "lit/decorators.js";
|
7
7
|
import { ifDefined as y } from "lit/directives/if-defined.js";
|
8
|
-
import
|
9
|
-
var
|
10
|
-
for (var
|
11
|
-
(
|
12
|
-
return
|
8
|
+
import _ from "./button.styles.js";
|
9
|
+
var $ = Object.defineProperty, o = (c, t, r, n) => {
|
10
|
+
for (var e = void 0, a = c.length - 1, l; a >= 0; a--)
|
11
|
+
(l = c[a]) && (e = l(t, r, e) || e);
|
12
|
+
return e && $(t, r, e), e;
|
13
13
|
};
|
14
|
-
const
|
14
|
+
const d = class d extends f {
|
15
15
|
constructor() {
|
16
|
-
super(
|
16
|
+
super(), this._transitionOptions = {
|
17
17
|
duration: 200,
|
18
18
|
fill: "forwards"
|
19
|
-
}, this.destructive = !1, this.disabled = !1, this.iconPosition = "left", this.loading = !1, this.size = "md", this.type = "button", this.variant = "primary", this._loaderVisible = !1, this.
|
19
|
+
}, this.destructive = !1, this.disabled = !1, this.iconPosition = "left", this.loading = !1, this.noValidate = !1, this.size = "md", this.type = "button", this.variant = "primary", this._loaderVisible = !1, this._handleClick = (t) => {
|
20
|
+
t.preventDefault(), t.stopPropagation(), !(this.disabled || this.loading) && (this.dispatchEvent(new CustomEvent("click", { bubbles: !0, composed: !0, detail: t })), this.type === "submit" && this._submitForm(), this.type === "reset" && this._resetForm());
|
21
|
+
}, this._submitForm = () => {
|
22
|
+
var e, a, l;
|
23
|
+
const t = !((e = this._internals.form) != null && e.reportValidity()), r = !this.noValidate, n = !((a = this._internals.form) != null && a.hasAttribute("no-validate"));
|
24
|
+
(r || n) && t || (l = this._internals.form) == null || l.submit();
|
25
|
+
}, this._resetForm = () => {
|
26
|
+
var t;
|
27
|
+
(t = this._internals.form) == null || t.reset();
|
28
|
+
}, this._renderIcon = () => h`<skf-icon class="skf-icon-host" name=${y(this.icon)}></skf-icon>`, this._internals = this.attachInternals();
|
20
29
|
}
|
21
|
-
firstUpdated(
|
22
|
-
if (
|
30
|
+
firstUpdated(t) {
|
31
|
+
if (t.has("loading") && this.loading) {
|
23
32
|
if (!this.$body || !this.$loader) return;
|
24
33
|
this._loaderVisible = !0, this.$body.style.opacity = "0", this.$loader.style.opacity = "1";
|
25
34
|
}
|
26
35
|
}
|
27
|
-
attributeChangedCallback(
|
28
|
-
super.attributeChangedCallback(
|
36
|
+
attributeChangedCallback(t, r, n) {
|
37
|
+
super.attributeChangedCallback(t, r, n), t === "loading" && (n !== null ? this._showLoader() : this._hideLoader());
|
29
38
|
}
|
39
|
+
/** Simulates a click on the button. */
|
40
|
+
click() {
|
41
|
+
var t;
|
42
|
+
(t = this.$button) == null || t.click();
|
43
|
+
}
|
44
|
+
/** @internal */
|
30
45
|
async _showLoader() {
|
31
|
-
var
|
32
|
-
this._loaderVisible = !0, await ((
|
46
|
+
var t;
|
47
|
+
this._loaderVisible = !0, await ((t = this.$body) == null ? void 0 : t.animate({ opacity: 0 }, this._transitionOptions).finished), !(!this.$body || !this.$loader) && this.$loader.animate({ opacity: 1 }, this._transitionOptions);
|
33
48
|
}
|
49
|
+
/** @internal */
|
34
50
|
async _hideLoader() {
|
35
51
|
!this.$body || !this.$loader || (await this.$loader.animate({ opacity: 0 }, this._transitionOptions).finished, this._loaderVisible = !1, this.$body.animate({ opacity: 1 }, this._transitionOptions));
|
36
52
|
}
|
37
53
|
render() {
|
38
|
-
return
|
54
|
+
return h`
|
39
55
|
<button
|
40
56
|
?disabled=${this.disabled || this.loading}
|
41
57
|
aria-busy=${this.loading}
|
42
|
-
id="
|
58
|
+
id="root"
|
43
59
|
type=${y(this.type)}
|
60
|
+
@click=${this._handleClick}
|
61
|
+
title=${this.title}
|
44
62
|
>
|
45
|
-
${this.variant === "primary" && this._loaderVisible ?
|
63
|
+
${this.variant === "primary" && this._loaderVisible ? h`<skf-loader invert size="sm"></skf-loader>` : ""}
|
46
64
|
<div id="body">
|
47
65
|
${this.icon && this.iconPosition === "left" ? this._renderIcon() : ""}
|
48
66
|
<div id="label">
|
@@ -54,41 +72,47 @@ const l = class l extends c {
|
|
54
72
|
`;
|
55
73
|
}
|
56
74
|
};
|
57
|
-
|
58
|
-
let
|
59
|
-
|
60
|
-
|
61
|
-
],
|
62
|
-
|
63
|
-
|
64
|
-
],
|
65
|
-
|
66
|
-
|
67
|
-
],
|
68
|
-
|
69
|
-
|
70
|
-
],
|
71
|
-
|
72
|
-
|
73
|
-
],
|
74
|
-
|
75
|
-
|
76
|
-
],
|
77
|
-
|
78
|
-
|
79
|
-
],
|
80
|
-
|
81
|
-
|
82
|
-
],
|
83
|
-
|
84
|
-
|
85
|
-
],
|
86
|
-
|
87
|
-
|
88
|
-
],
|
89
|
-
|
90
|
-
|
91
|
-
],
|
75
|
+
d.formAssociated = !0, d.shadowRootOptions = { ...m.shadowRootOptions, delegatesFocus: !0 }, d.styles = [b, _];
|
76
|
+
let i = d;
|
77
|
+
o([
|
78
|
+
s({ type: Boolean })
|
79
|
+
], i.prototype, "destructive");
|
80
|
+
o([
|
81
|
+
s({ type: Boolean })
|
82
|
+
], i.prototype, "disabled");
|
83
|
+
o([
|
84
|
+
s()
|
85
|
+
], i.prototype, "icon");
|
86
|
+
o([
|
87
|
+
s({ attribute: "icon-position" })
|
88
|
+
], i.prototype, "iconPosition");
|
89
|
+
o([
|
90
|
+
s({ type: Boolean })
|
91
|
+
], i.prototype, "loading");
|
92
|
+
o([
|
93
|
+
s({ type: Boolean, attribute: "no-validate" })
|
94
|
+
], i.prototype, "noValidate");
|
95
|
+
o([
|
96
|
+
s({ reflect: !0 })
|
97
|
+
], i.prototype, "size");
|
98
|
+
o([
|
99
|
+
s()
|
100
|
+
], i.prototype, "type");
|
101
|
+
o([
|
102
|
+
s({ reflect: !0 })
|
103
|
+
], i.prototype, "variant");
|
104
|
+
o([
|
105
|
+
u()
|
106
|
+
], i.prototype, "_loaderVisible");
|
107
|
+
o([
|
108
|
+
p("skf-loader")
|
109
|
+
], i.prototype, "$loader");
|
110
|
+
o([
|
111
|
+
p("#body")
|
112
|
+
], i.prototype, "$body");
|
113
|
+
o([
|
114
|
+
p("button")
|
115
|
+
], i.prototype, "$button");
|
92
116
|
export {
|
93
|
-
|
117
|
+
i as SkfButton
|
94
118
|
};
|
@@ -3,9 +3,10 @@ const r = o`
|
|
3
3
|
@layer components {
|
4
4
|
:host {
|
5
5
|
contain: initial;
|
6
|
+
display: inline-flex;
|
6
7
|
}
|
7
8
|
|
8
|
-
#
|
9
|
+
#root {
|
9
10
|
background-color: var(--_skf-button-state-bg-color, var(--_skf-button-bg-color));
|
10
11
|
block-size: var(--_skf-button-block-size);
|
11
12
|
border: var(--skf-border-width-sm) solid
|
@@ -12,10 +12,10 @@ import { type CSSResultGroup } from 'lit';
|
|
12
12
|
export declare class SkfCard extends SkfElement {
|
13
13
|
static styles: CSSResultGroup;
|
14
14
|
/** If true, removes border */
|
15
|
-
noBorder
|
15
|
+
noBorder?: boolean;
|
16
16
|
/** If true, removes padding */
|
17
|
-
noPadding
|
17
|
+
noPadding?: boolean;
|
18
18
|
/** If true, the Card fills the parent element height */
|
19
|
-
stretch
|
19
|
+
stretch?: boolean;
|
20
20
|
render(): import("lit").TemplateResult<1>;
|
21
21
|
}
|