@skf-design-system/ui-components 1.0.0-alpha.29 → 1.0.0-alpha.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion-item.d.ts +1 -1
- package/dist/components/accordion/accordion.component.d.ts +4 -4
- package/dist/components/accordion/accordion.component.js +18 -17
- package/dist/components/accordion/accordion.styles.d.ts +1 -2
- package/dist/components/accordion/accordion.styles.js +5 -4
- package/dist/components/alert/alert.component.d.ts +3 -3
- package/dist/components/alert/alert.component.js +44 -33
- package/dist/components/alert/alert.styles.d.ts +1 -2
- package/dist/components/alert/alert.styles.js +29 -24
- package/dist/components/button/button.component.d.ts +6 -4
- package/dist/components/button/button.component.js +59 -47
- package/dist/components/button/button.styles.js +55 -45
- package/dist/components/card/card.component.d.ts +4 -4
- package/dist/components/card/card.component.js +35 -24
- package/dist/components/card/card.styles.d.ts +1 -2
- package/dist/components/card/card.styles.js +14 -12
- package/dist/components/checkbox/checkbox.component.d.ts +3 -3
- package/dist/components/collapse/collapse.component.d.ts +8 -8
- package/dist/components/collapse/collapse.component.js +42 -34
- package/dist/components/collapse/collapse.styles.js +15 -14
- package/dist/components/dialog/dialog.component.d.ts +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 +3 -3
- package/dist/components/divider/divider.component.js +39 -27
- package/dist/components/divider/divider.styles.d.ts +1 -2
- package/dist/components/divider/divider.styles.js +26 -26
- package/dist/components/heading/heading.component.d.ts +2 -2
- package/dist/components/icon/icon.component.d.ts +7 -8
- package/dist/components/icon/icon.component.js +51 -29
- package/dist/components/icon/icon.styles.js +53 -47
- package/dist/components/input/input.component.d.ts +4 -4
- package/dist/components/link/link.component.d.ts +7 -6
- package/dist/components/link/link.component.js +33 -27
- package/dist/components/link/link.styles.js +36 -40
- package/dist/components/loader/loader.component.d.ts +2 -2
- package/dist/components/loader/loader.component.js +32 -25
- package/dist/components/loader/loader.styles.js +11 -10
- package/dist/components/logo/logo.component.d.ts +3 -3
- package/dist/components/logo/logo.component.js +25 -14
- package/dist/components/logo/logo.styles.d.ts +1 -2
- package/dist/components/logo/logo.styles.js +11 -9
- package/dist/components/menu/menu.component.d.ts +24 -0
- package/dist/components/menu/menu.component.js +18 -0
- package/dist/components/menu/menu.d.ts +8 -0
- package/dist/components/menu/menu.js +6 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +11 -0
- package/dist/components/menu-item/menu-item.component.d.ts +25 -0
- package/dist/components/menu-item/menu-item.component.js +13 -0
- package/dist/components/menu-item/menu-item.d.ts +8 -0
- package/dist/components/menu-item/menu-item.js +6 -0
- package/dist/components/menu-item/menu-item.styles.d.ts +1 -0
- package/dist/components/menu-item/menu-item.styles.js +19 -0
- package/dist/components/popover/popover.component.d.ts +29 -0
- package/dist/components/popover/popover.component.js +37 -0
- package/dist/components/popover/popover.d.ts +8 -0
- package/dist/components/popover/popover.js +6 -0
- package/dist/components/popover/popover.styles.d.ts +1 -0
- package/dist/components/popover/popover.styles.js +12 -0
- package/dist/components/progress/progress.component.d.ts +2 -2
- package/dist/components/progress/progress.component.js +31 -22
- package/dist/components/progress/progress.styles.js +19 -18
- package/dist/components/radio/radio.component.d.ts +3 -3
- package/dist/components/select/select.component.d.ts +10 -12
- package/dist/components/select/select.component.js +115 -118
- package/dist/components/select/select.controllers.d.ts +1 -26
- package/dist/components/select/select.controllers.js +35 -95
- package/dist/components/select-option/select-option.component.d.ts +1 -1
- package/dist/components/select-option/select-option.controllers.d.ts +1 -1
- package/dist/components/select-option-group/select-option-group.component.d.ts +1 -1
- package/dist/components/stepper/stepper.component.d.ts +38 -0
- package/dist/components/stepper/stepper.component.js +91 -0
- package/dist/components/stepper/stepper.d.ts +8 -0
- package/dist/components/stepper/stepper.helpers.d.ts +16 -0
- package/dist/components/stepper/stepper.helpers.js +18 -0
- package/dist/components/stepper/stepper.js +6 -0
- package/dist/components/stepper/stepper.styles.d.ts +1 -0
- package/dist/components/stepper/stepper.styles.js +15 -0
- package/dist/components/stepper-item/stepper-item.component.d.ts +47 -0
- package/dist/components/stepper-item/stepper-item.component.js +113 -0
- package/dist/components/stepper-item/stepper-item.d.ts +8 -0
- package/dist/components/stepper-item/stepper-item.js +6 -0
- package/dist/components/stepper-item/stepper-item.styles.d.ts +1 -0
- package/dist/components/stepper-item/stepper-item.styles.js +98 -0
- package/dist/components/switch/switch.component.d.ts +2 -2
- package/dist/components/switch/switch.component.js +13 -6
- package/dist/components/switch/switch.styles.js +16 -13
- package/dist/components/tab/tab.component.d.ts +2 -2
- package/dist/components/tab-group/tab-group.component.d.ts +2 -2
- package/dist/components/tab-panel/tab-panel.component.d.ts +1 -1
- package/dist/components/tag/tag.component.d.ts +2 -2
- package/dist/components/tag/tag.component.js +61 -45
- package/dist/components/tag/tag.styles.js +30 -28
- package/dist/components/textarea/textarea.component.d.ts +4 -4
- package/dist/components/toast/toast.component.d.ts +1 -1
- package/dist/components/toast/toast.singleton.d.ts +3 -3
- package/dist/components/toast-item/toast-item.component.d.ts +1 -1
- package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +2 -2
- package/dist/components/tooltip/tooltip.component.d.ts +24 -0
- package/dist/components/tooltip/tooltip.component.js +18 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +6 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.styles.js +12 -0
- package/dist/custom-elements.json +1329 -79
- package/dist/index.d.ts +7 -0
- package/dist/index.js +73 -52
- package/dist/internal/base-classes/popover/popover.base.d.ts +29 -0
- package/dist/internal/base-classes/popover/popover.base.js +116 -0
- package/dist/internal/base-classes/popover/popover.styles.d.ts +1 -0
- package/dist/internal/base-classes/popover/popover.styles.js +29 -0
- package/dist/internal/components/hint/hint.component.d.ts +2 -2
- package/dist/internal/components/skf-element.js +26 -25
- package/dist/internal/controllers/popover.controller.d.ts +16 -0
- package/dist/internal/controllers/popover.controller.js +44 -0
- package/dist/internal/helpers/hintSeverity.d.ts +2 -2
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +7 -6
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.js +7 -0
- package/dist/react/skf-dialog/index.d.ts +15 -0
- package/dist/react/skf-dialog/index.js +19 -0
- package/dist/react/skf-menu/index.d.ts +12 -0
- package/dist/react/skf-menu/index.js +18 -0
- package/dist/react/skf-menu-item/index.d.ts +27 -0
- package/dist/react/skf-menu-item/index.js +23 -0
- package/dist/react/skf-popover/index.d.ts +12 -0
- package/dist/react/skf-popover/index.js +18 -0
- package/dist/react/skf-stepper/index.d.ts +9 -0
- package/dist/react/skf-stepper/index.js +17 -0
- package/dist/react/skf-stepper-item/index.d.ts +9 -0
- package/dist/react/skf-stepper-item/index.js +17 -0
- package/dist/react/skf-tooltip/index.d.ts +12 -0
- package/dist/react/skf-tooltip/index.js +18 -0
- package/dist/styles/component.styles.js +15 -2
- package/dist/types/jsx/custom-element-jsx.d.ts +1263 -228
- package/dist/types/vue/index.d.ts +260 -2
- package/dist/vscode.html-custom-data.json +335 -8
- package/dist/web-types.json +623 -38
- package/package.json +31 -30
- package/custom-elements.json +0 -18265
@@ -1,6 +1,6 @@
|
|
1
|
-
import '
|
2
|
-
import { SkfElement } from '
|
3
|
-
import type { HeadingType } from '
|
1
|
+
import '../collapse/collapse.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element.js';
|
3
|
+
import type { HeadingType } from '../../internal/constants/heading.js';
|
4
4
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
5
5
|
/**
|
6
6
|
* The `<skf-accordion>` component consists of multiple `<skf-collapse>`, working together.
|
@@ -21,7 +21,7 @@ export declare class SkfAccordion extends SkfElement {
|
|
21
21
|
*/
|
22
22
|
headingAs: Exclude<HeadingType, 'h1'>;
|
23
23
|
/** If true, adds a gap between each item */
|
24
|
-
gap
|
24
|
+
gap: boolean;
|
25
25
|
/** If true, allowes multiple accordion items to open */
|
26
26
|
multiple?: boolean;
|
27
27
|
/** If true, renders the small version */
|
@@ -1,17 +1,18 @@
|
|
1
1
|
import "../collapse/collapse.js";
|
2
|
-
import { SkfElement as
|
2
|
+
import { SkfElement as h } from "../../internal/components/skf-element.js";
|
3
3
|
import m from "../../styles/component.styles.js";
|
4
4
|
import { html as f } from "lit";
|
5
5
|
import { property as a, queryAssignedNodes as d } from "lit/decorators.js";
|
6
|
-
import c from "
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
import { classMap as c } from "lit/directives/class-map.js";
|
7
|
+
import { styles as g } from "./accordion.styles.js";
|
8
|
+
var y = Object.defineProperty, s = (p, t, i, o) => {
|
9
|
+
for (var r = void 0, l = p.length - 1, u; l >= 0; l--)
|
10
|
+
(u = p[l]) && (r = u(t, i, r) || r);
|
11
|
+
return r && y(t, i, r), r;
|
11
12
|
};
|
12
|
-
const n = class n extends
|
13
|
+
const n = class n extends h {
|
13
14
|
constructor() {
|
14
|
-
super(...arguments), this.headingAs = "h2", this._setItemAttributes = () => {
|
15
|
+
super(...arguments), this.headingAs = "h2", this.gap = !1, this._setItemAttributes = () => {
|
15
16
|
this.items.forEach((t) => {
|
16
17
|
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
18
|
});
|
@@ -33,7 +34,7 @@ const n = class n extends p {
|
|
33
34
|
}
|
34
35
|
render() {
|
35
36
|
return f`
|
36
|
-
<div
|
37
|
+
<div class=${c({ "accordion--gap": this.gap })}>
|
37
38
|
<slot
|
38
39
|
@skf-collapse-toggle=${(t) => {
|
39
40
|
this._onChildToggle(t);
|
@@ -44,27 +45,27 @@ const n = class n extends p {
|
|
44
45
|
`;
|
45
46
|
}
|
46
47
|
};
|
47
|
-
n.styles = [
|
48
|
+
n.styles = [g, m];
|
48
49
|
let e = n;
|
49
|
-
|
50
|
+
s([
|
50
51
|
a({ type: Boolean, reflect: !0 })
|
51
52
|
], e.prototype, "animated");
|
52
|
-
|
53
|
+
s([
|
53
54
|
a({ attribute: "heading-as" })
|
54
55
|
], e.prototype, "headingAs");
|
55
|
-
|
56
|
+
s([
|
56
57
|
a({ type: Boolean, reflect: !0 })
|
57
58
|
], e.prototype, "gap");
|
58
|
-
|
59
|
+
s([
|
59
60
|
a({ type: Boolean })
|
60
61
|
], e.prototype, "multiple");
|
61
|
-
|
62
|
+
s([
|
62
63
|
a({ type: Boolean, reflect: !0 })
|
63
64
|
], e.prototype, "small");
|
64
|
-
|
65
|
+
s([
|
65
66
|
a({ type: Boolean, reflect: !0 })
|
66
67
|
], e.prototype, "truncate");
|
67
|
-
|
68
|
+
s([
|
68
69
|
d()
|
69
70
|
], e.prototype, "$accordionItems");
|
70
71
|
export {
|
@@ -1,2 +1 @@
|
|
1
|
-
declare const
|
2
|
-
export default _default;
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import { css as
|
2
|
-
const
|
1
|
+
import { css as s } from "lit";
|
2
|
+
const l = s`
|
3
|
+
/* stylelint-disable selector-class-pattern */
|
3
4
|
@layer components {
|
4
|
-
|
5
|
+
.accordion--gap {
|
5
6
|
display: flex;
|
6
7
|
flex-direction: column;
|
7
8
|
gap: var(--skf-spacing-300);
|
@@ -9,5 +10,5 @@ const t = o`
|
|
9
10
|
}
|
10
11
|
`;
|
11
12
|
export {
|
12
|
-
|
13
|
+
l as styles
|
13
14
|
};
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { SkfIcon } from '
|
2
|
-
import '
|
3
|
-
import { SkfElement } from '
|
1
|
+
import type { SkfIcon } from '../icon/icon.component.js';
|
2
|
+
import '../icon/icon.js';
|
3
|
+
import { SkfElement } from '../../internal/components/skf-element.js';
|
4
4
|
import type { SeverityFgColor } from '@skf-design-system/ui-assets';
|
5
5
|
import { type CSSResultGroup } from 'lit';
|
6
6
|
/**
|
@@ -1,16 +1,17 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
|
-
import { SkfElement as
|
2
|
+
import { SkfElement as y } from "../../internal/components/skf-element.js";
|
3
3
|
import b from "../../styles/component.styles.js";
|
4
4
|
import { html as p, nothing as f } from "lit";
|
5
|
-
import { property as
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
import { property as r } from "lit/decorators.js";
|
6
|
+
import { classMap as h } from "lit/directives/class-map.js";
|
7
|
+
import { ifDefined as o } from "lit/directives/if-defined.js";
|
8
|
+
import { styles as v } from "./alert.styles.js";
|
9
|
+
var u = Object.defineProperty, s = (a, n, c, d) => {
|
10
|
+
for (var e = void 0, i = a.length - 1, m; i >= 0; i--)
|
11
|
+
(m = a[i]) && (e = m(n, c, e) || e);
|
12
|
+
return e && u(n, c, e), e;
|
12
13
|
};
|
13
|
-
const l = class l extends
|
14
|
+
const l = class l extends y {
|
14
15
|
constructor() {
|
15
16
|
super(...arguments), this.buttonLabel = "Close", this._handleClose = () => {
|
16
17
|
this.emit("skf-alert-close");
|
@@ -19,24 +20,34 @@ const l = class l extends d {
|
|
19
20
|
render() {
|
20
21
|
return p`
|
21
22
|
<div
|
22
|
-
id="root"
|
23
23
|
aria-describedby="main"
|
24
|
-
aria-modal=${
|
24
|
+
aria-modal=${o(this.closeable && "true")}
|
25
|
+
class=${h({
|
26
|
+
alert: !0,
|
27
|
+
"alert--severity-alert": this.severity === "alert",
|
28
|
+
"alert--severity-error": this.severity === "error",
|
29
|
+
"alert--severity-info": this.severity === "info",
|
30
|
+
"alert--severity-success": this.severity === "success",
|
31
|
+
"alert--severity-warning": this.severity === "warning"
|
32
|
+
})}
|
25
33
|
role=${this.closeable ? "alertdialog" : "alert"}
|
26
34
|
>
|
27
35
|
<skf-icon
|
28
|
-
color=${
|
29
|
-
name=${
|
36
|
+
color=${o(this.severity ?? "secondary")}
|
37
|
+
name=${o(this.icon)}
|
30
38
|
size="sm"
|
31
39
|
></skf-icon>
|
32
|
-
<div
|
33
|
-
<
|
34
|
-
<slot></slot>
|
35
|
-
</div>
|
40
|
+
<div class="alert__body">
|
41
|
+
<slot class="alert__main" id="main"></slot>
|
36
42
|
<slot name="link"></slot>
|
37
43
|
</div>
|
38
44
|
${this.closeable ? p`
|
39
|
-
<button
|
45
|
+
<button
|
46
|
+
@click="${this._handleClose}"
|
47
|
+
aria-label=${this.buttonLabel}
|
48
|
+
class="alert__btn"
|
49
|
+
type="button"
|
50
|
+
>
|
40
51
|
<skf-icon name="close" size="sm"></skf-icon>
|
41
52
|
</button>
|
42
53
|
` : f}
|
@@ -44,20 +55,20 @@ const l = class l extends d {
|
|
44
55
|
`;
|
45
56
|
}
|
46
57
|
};
|
47
|
-
l.styles = [b,
|
48
|
-
let
|
49
|
-
|
50
|
-
|
51
|
-
],
|
52
|
-
|
53
|
-
|
54
|
-
],
|
55
|
-
|
56
|
-
|
57
|
-
],
|
58
|
-
|
59
|
-
|
60
|
-
],
|
58
|
+
l.styles = [b, v];
|
59
|
+
let t = l;
|
60
|
+
s([
|
61
|
+
r({ type: Boolean, reflect: !0 })
|
62
|
+
], t.prototype, "closeable");
|
63
|
+
s([
|
64
|
+
r({ attribute: "button-label" })
|
65
|
+
], t.prototype, "buttonLabel");
|
66
|
+
s([
|
67
|
+
r()
|
68
|
+
], t.prototype, "icon");
|
69
|
+
s([
|
70
|
+
r({ reflect: !0 })
|
71
|
+
], t.prototype, "severity");
|
61
72
|
export {
|
62
|
-
|
73
|
+
t as SkfAlert
|
63
74
|
};
|
@@ -1,2 +1 @@
|
|
1
|
-
declare const
|
2
|
-
export default _default;
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
2
|
const s = r`
|
3
|
+
/* stylelint-disable selector-class-pattern */
|
3
4
|
@layer components {
|
4
5
|
:host {
|
5
6
|
contain: layout;
|
6
7
|
}
|
7
8
|
|
8
|
-
|
9
|
+
.alert {
|
9
10
|
background-color: var(--_skf-alert-bg-color, var(--skf-bg-color-neutral-2));
|
10
11
|
border: var(--skf-border-width-sm) solid
|
11
12
|
var(--_skf-alert-border-color, var(--skf-border-color-primary));
|
@@ -16,34 +17,34 @@ const s = r`
|
|
16
17
|
gap: var(--skf-spacing-50);
|
17
18
|
padding-block: var(--skf-spacing-75);
|
18
19
|
padding-inline: var(--skf-spacing-50);
|
20
|
+
}
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
.alert--severity-alert {
|
23
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-alert);
|
24
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-alert);
|
25
|
+
}
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
.alert--severity-error {
|
28
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-error);
|
29
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-error);
|
30
|
+
}
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
.alert--severity-info {
|
33
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-info);
|
34
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-info);
|
35
|
+
}
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
.alert--severity-success {
|
38
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-success);
|
39
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-success);
|
40
|
+
}
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}
|
42
|
+
.alert--severity-warning {
|
43
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-warning);
|
44
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-warning);
|
44
45
|
}
|
45
46
|
|
46
|
-
|
47
|
+
.alert__body {
|
47
48
|
display: flex;
|
48
49
|
flex: auto;
|
49
50
|
flex-wrap: wrap;
|
@@ -51,16 +52,20 @@ const s = r`
|
|
51
52
|
justify-content: space-between;
|
52
53
|
}
|
53
54
|
|
55
|
+
.alert__main {
|
56
|
+
display: block;
|
57
|
+
}
|
58
|
+
|
54
59
|
::slotted(skf-link) {
|
55
60
|
text-transform: uppercase;
|
56
61
|
}
|
57
62
|
|
58
|
-
|
63
|
+
.alert__btn {
|
59
64
|
cursor: pointer;
|
60
65
|
display: inline-flex;
|
61
66
|
}
|
62
67
|
}
|
63
68
|
`;
|
64
69
|
export {
|
65
|
-
s as
|
70
|
+
s as styles
|
66
71
|
};
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import type { SkfIcon } from '
|
2
|
-
import '
|
3
|
-
import '
|
4
|
-
import { SkfElement } from '
|
1
|
+
import type { SkfIcon } from '../icon/icon.component.js';
|
2
|
+
import '../icon/icon.js';
|
3
|
+
import '../loader/loader.js';
|
4
|
+
import { SkfElement } from '../../internal/components/skf-element.js';
|
5
5
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
6
6
|
/**
|
7
7
|
* Component to be used in forms or for interactivity
|
@@ -31,6 +31,8 @@ export declare class SkfButton extends SkfElement {
|
|
31
31
|
/** If provided, renders an icon before or after the text */
|
32
32
|
/** @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" } */
|
33
33
|
icon?: SkfIcon['name'];
|
34
|
+
/** If true, removes border */
|
35
|
+
iconOnly: boolean;
|
34
36
|
/** If provided, determines the positioning of the icon in relation to the text */
|
35
37
|
iconPosition?: 'left' | 'right';
|
36
38
|
/** If true, hides text & icon and shows loading indicator. **Notice!** Only applicable if `variant` is `primary`. */
|
@@ -1,27 +1,28 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
2
|
import "../loader/loader.js";
|
3
|
-
import { SkfElement as
|
4
|
-
import
|
5
|
-
import { html as h, LitElement as m } from "lit";
|
6
|
-
import { property as
|
3
|
+
import { SkfElement as b } from "../../internal/components/skf-element.js";
|
4
|
+
import f from "../../styles/component.styles.js";
|
5
|
+
import { html as h, LitElement as m, nothing as u } from "lit";
|
6
|
+
import { property as e, state as _, query as p } from "lit/decorators.js";
|
7
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
7
8
|
import { ifDefined as y } from "lit/directives/if-defined.js";
|
8
|
-
import
|
9
|
-
var
|
10
|
-
for (var
|
11
|
-
(l = c[
|
12
|
-
return
|
9
|
+
import $ from "./button.styles.js";
|
10
|
+
var g = Object.defineProperty, s = (c, t, a, n) => {
|
11
|
+
for (var o = void 0, r = c.length - 1, l; r >= 0; r--)
|
12
|
+
(l = c[r]) && (o = l(t, a, o) || o);
|
13
|
+
return o && g(t, a, o), o;
|
13
14
|
};
|
14
|
-
const d = class d extends
|
15
|
+
const d = class d extends b {
|
15
16
|
constructor() {
|
16
17
|
super(), this._transitionOptions = {
|
17
18
|
duration: 200,
|
18
19
|
fill: "forwards"
|
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
|
+
}, this.destructive = !1, this.disabled = !1, this.iconOnly = !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
21
|
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
22
|
}, this._submitForm = () => {
|
22
|
-
var
|
23
|
-
const t = !((
|
24
|
-
(
|
23
|
+
var o, r, l;
|
24
|
+
const t = !((o = this._internals.form) != null && o.reportValidity()), a = !this.noValidate, n = !((r = this._internals.form) != null && r.hasAttribute("no-validate"));
|
25
|
+
(a || n) && t || (l = this._internals.form) == null || l.submit();
|
25
26
|
}, this._resetForm = () => {
|
26
27
|
var t;
|
27
28
|
(t = this._internals.form) == null || t.reset();
|
@@ -33,8 +34,8 @@ const d = class d extends f {
|
|
33
34
|
this._loaderVisible = !0, this.$body.style.opacity = "0", this.$loader.style.opacity = "1";
|
34
35
|
}
|
35
36
|
}
|
36
|
-
attributeChangedCallback(t,
|
37
|
-
super.attributeChangedCallback(t,
|
37
|
+
attributeChangedCallback(t, a, n) {
|
38
|
+
super.attributeChangedCallback(t, a, n), t === "loading" && (n !== null ? this._showLoader() : this._hideLoader());
|
38
39
|
}
|
39
40
|
/** Simulates a click on the button. */
|
40
41
|
click() {
|
@@ -55,62 +56,73 @@ const d = class d extends f {
|
|
55
56
|
<button
|
56
57
|
?disabled=${this.disabled || this.loading}
|
57
58
|
aria-busy=${this.loading}
|
58
|
-
|
59
|
+
class=${v({
|
60
|
+
btn: !0,
|
61
|
+
"btn--destructive": this.destructive,
|
62
|
+
"btn--icon-only": this.iconOnly,
|
63
|
+
"btn--size-lg": this.size === "lg",
|
64
|
+
"btn--size-md": this.size === "md",
|
65
|
+
"btn--size-sm": this.size === "sm",
|
66
|
+
"btn--variant-primary": this.variant === "primary",
|
67
|
+
"btn--variant-secondary": this.variant === "secondary"
|
68
|
+
})}
|
59
69
|
type=${y(this.type)}
|
60
70
|
@click=${this._handleClick}
|
61
|
-
title=${
|
71
|
+
title=${/* An empty title prevents browser validation tooltips from appearing on hover */
|
72
|
+
this.title}
|
62
73
|
>
|
63
|
-
${this.variant === "primary" && this._loaderVisible ? h`<skf-loader invert size="sm"></skf-loader>` : ""}
|
64
|
-
<div id="body">
|
74
|
+
${this.variant === "primary" && this._loaderVisible ? h`<skf-loader class="btn__loader" invert size="sm"></skf-loader>` : ""}
|
75
|
+
<div class="btn__body" id="body">
|
65
76
|
${this.icon && this.iconPosition === "left" ? this._renderIcon() : ""}
|
66
|
-
|
67
|
-
<slot></slot>
|
68
|
-
</div>
|
77
|
+
${this.iconOnly ? u : h`<slot class="btn__label"></slot>`}
|
69
78
|
${this.icon && this.iconPosition === "right" ? this._renderIcon() : ""}
|
70
79
|
</div>
|
71
80
|
</button>
|
72
81
|
`;
|
73
82
|
}
|
74
83
|
};
|
75
|
-
d.formAssociated = !0, d.shadowRootOptions = { ...m.shadowRootOptions, delegatesFocus: !0 }, d.styles = [
|
84
|
+
d.formAssociated = !0, d.shadowRootOptions = { ...m.shadowRootOptions, delegatesFocus: !0 }, d.styles = [f, $];
|
76
85
|
let i = d;
|
77
|
-
|
78
|
-
|
86
|
+
s([
|
87
|
+
e({ type: Boolean })
|
79
88
|
], i.prototype, "destructive");
|
80
|
-
|
81
|
-
|
89
|
+
s([
|
90
|
+
e({ type: Boolean })
|
82
91
|
], i.prototype, "disabled");
|
83
|
-
|
84
|
-
|
92
|
+
s([
|
93
|
+
e()
|
85
94
|
], i.prototype, "icon");
|
86
|
-
|
87
|
-
|
95
|
+
s([
|
96
|
+
e({ type: Boolean })
|
97
|
+
], i.prototype, "iconOnly");
|
98
|
+
s([
|
99
|
+
e({ attribute: "icon-position" })
|
88
100
|
], i.prototype, "iconPosition");
|
89
|
-
|
90
|
-
|
101
|
+
s([
|
102
|
+
e({ type: Boolean })
|
91
103
|
], i.prototype, "loading");
|
92
|
-
|
93
|
-
|
104
|
+
s([
|
105
|
+
e({ type: Boolean, attribute: "no-validate" })
|
94
106
|
], i.prototype, "noValidate");
|
95
|
-
|
96
|
-
|
107
|
+
s([
|
108
|
+
e({ reflect: !0 })
|
97
109
|
], i.prototype, "size");
|
98
|
-
|
99
|
-
|
110
|
+
s([
|
111
|
+
e()
|
100
112
|
], i.prototype, "type");
|
101
|
-
|
102
|
-
|
113
|
+
s([
|
114
|
+
e({ reflect: !0 })
|
103
115
|
], i.prototype, "variant");
|
104
|
-
|
105
|
-
|
116
|
+
s([
|
117
|
+
_()
|
106
118
|
], i.prototype, "_loaderVisible");
|
107
|
-
|
119
|
+
s([
|
108
120
|
p("skf-loader")
|
109
121
|
], i.prototype, "$loader");
|
110
|
-
|
122
|
+
s([
|
111
123
|
p("#body")
|
112
124
|
], i.prototype, "$body");
|
113
|
-
|
125
|
+
s([
|
114
126
|
p("button")
|
115
127
|
], i.prototype, "$button");
|
116
128
|
export {
|