@skf-design-system/ui-components 1.0.0-beta.5 → 1.0.1-beta.0
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 +5 -5
- package/dist/components/alert/alert.component.js +46 -35
- package/dist/components/alert/alert.styles.d.ts +1 -2
- package/dist/components/alert/alert.styles.js +29 -24
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +29 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.component.d.ts +25 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +8 -0
- package/dist/components/button/button.component.d.ts +29 -5
- package/dist/components/button/button.component.js +89 -52
- package/dist/components/button/button.styles.js +65 -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 +11 -12
- package/dist/components/checkbox/checkbox.component.js +96 -90
- 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 +74 -0
- package/dist/components/dialog/dialog.component.js +187 -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/heading/heading.component.js +13 -13
- package/dist/components/icon/icon.component.d.ts +2 -5
- package/dist/components/icon/icon.component.js +32 -23
- package/dist/components/icon/icon.styles.js +53 -47
- package/dist/components/input/input.component.d.ts +12 -11
- package/dist/components/input/input.component.js +88 -89
- package/dist/components/link/link.component.d.ts +7 -6
- package/dist/components/link/link.component.js +49 -43
- 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 +39 -32
- 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 +28 -17
- 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 +22 -0
- package/dist/components/progress/progress.component.js +49 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +6 -0
- package/dist/components/progress/progress.styles.d.ts +1 -0
- package/dist/components/progress/progress.styles.js +48 -0
- package/dist/components/radio/radio.component.d.ts +7 -9
- package/dist/components/radio/radio.component.js +95 -79
- package/dist/components/select/select.component.d.ts +10 -12
- package/dist/components/select/select.component.js +120 -120
- 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/select-option-group/select-option-group.component.js +9 -9
- 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 +17 -7
- package/dist/components/switch/switch.styles.js +16 -13
- 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 +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/textarea/textarea.component.js +2 -2
- package/dist/components/toast/toast.component.d.ts +8 -5
- package/dist/components/toast/toast.component.js +30 -26
- package/dist/components/toast/toast.singleton.d.ts +5 -10
- package/dist/components/toast/toast.singleton.js +25 -25
- package/dist/components/toast/toast.styles.d.ts +1 -0
- package/dist/components/toast-item/toast-item.component.d.ts +1 -1
- package/dist/components/toast-item/toast-item.component.js +15 -15
- package/dist/components/toast-item/toast-item.styles.js +18 -0
- package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +2 -2
- package/dist/components/toast-wrapper/toast-wrapper.component.js +11 -11
- package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
- 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 +2465 -629
- package/dist/index.d.ts +11 -0
- package/dist/index.js +77 -44
- 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/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -11
- package/dist/internal/components/hint/hint.component.d.ts +2 -2
- package/dist/internal/components/hint/hint.component.js +13 -13
- 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/helpers/watch.d.ts +27 -0
- package/dist/internal/helpers/watch.js +28 -0
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +7 -6
- package/dist/react/index.d.ts +13 -0
- package/dist/react/index.js +13 -0
- package/dist/react/skf-breadcrumb/index.d.ts +9 -0
- package/dist/react/skf-breadcrumb/index.js +17 -0
- package/dist/react/skf-breadcrumb-item/index.d.ts +3 -0
- package/dist/react/skf-breadcrumb-item/index.js +13 -0
- package/dist/react/skf-button/index.d.ts +7 -1
- package/dist/react/skf-button/index.js +5 -1
- package/dist/react/skf-dialog/index.d.ts +15 -0
- package/dist/react/skf-dialog/index.js +19 -0
- package/dist/react/skf-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-progress/index.d.ts +3 -0
- package/dist/react/skf-progress/index.js +13 -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-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-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 +603 -27
- package/dist/types/vue/index.d.ts +413 -11
- package/dist/vscode.html-custom-data.json +462 -36
- package/dist/web-types.json +944 -90
- package/package.json +43 -42
- package/dist/components/toast-item/toast-item.style.js +0 -16
- /package/dist/components/{toast/toast.style.d.ts → breadcrumb/breadcrumb.styles.d.ts} +0 -0
- /package/dist/components/{toast-wrapper/toast-wrapper.style.d.ts → breadcrumb-item/breadcrumb-item.styles.d.ts} +0 -0
- /package/dist/components/toast/{toast.style.js → toast.styles.js} +0 -0
- /package/dist/components/toast-item/{toast-item.style.d.ts → toast-item.styles.d.ts} +0 -0
- /package/dist/components/toast-wrapper/{toast-wrapper.style.js → toast-wrapper.styles.js} +0 -0
@@ -1,67 +1,67 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
|
-
import { FormBase as
|
3
|
-
import {
|
4
|
-
import v from "../../
|
5
|
-
import
|
6
|
-
import {
|
2
|
+
import { FormBase as c } from "../../internal/components/formBase.js";
|
3
|
+
import { watch as h } from "../../internal/helpers/watch.js";
|
4
|
+
import { Asterisk as v } from "../../internal/templates/asterisk.js";
|
5
|
+
import m from "../../styles/component.styles.js";
|
6
|
+
import { html as p, nothing as f } from "lit";
|
7
|
+
import { property as r, state as y, query as _ } from "lit/decorators.js";
|
7
8
|
import { ifDefined as b } from "lit/directives/if-defined.js";
|
8
|
-
import
|
9
|
-
var
|
10
|
-
for (var l = void 0, o =
|
11
|
-
(
|
12
|
-
return l &&
|
9
|
+
import g from "./checkbox.styles.js";
|
10
|
+
var $ = Object.defineProperty, I = Object.getOwnPropertyDescriptor, e = (u, i, s, a) => {
|
11
|
+
for (var l = a > 1 ? void 0 : a ? I(i, s) : i, o = u.length - 1, n; o >= 0; o--)
|
12
|
+
(n = u[o]) && (l = (a ? n(i, s, l) : n(l)) || l);
|
13
|
+
return a && l && $(i, s, l), l;
|
13
14
|
};
|
14
|
-
const
|
15
|
+
const d = class d extends c {
|
15
16
|
constructor() {
|
16
|
-
super(...arguments), this.
|
17
|
-
|
18
|
-
}, this._renderIcon = (
|
19
|
-
<skf-icon color="inverse" name=${
|
17
|
+
super(...arguments), this._initiallyChecked = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (i) => {
|
18
|
+
i.stopPropagation(), this.checked = this._initiallyChecked, this.$input && (this.$input.checked = !!this._initiallyChecked), this.setFormValue(this.checked ? this.value : null);
|
19
|
+
}, this._renderIcon = (i) => p`
|
20
|
+
<skf-icon color="inverse" name=${i} size=${this.size === "sm" ? "sm" : "md"}></skf-icon>
|
20
21
|
`;
|
21
22
|
}
|
22
|
-
|
23
|
-
|
23
|
+
handleInvalidChange() {
|
24
|
+
this._invalid ? (this.setAttribute("invalid", ""), this.showValid && this.removeAttribute("valid"), this.checkValidity()) : (this.removeAttribute("invalid"), !this.pristine && this.showValid && this.setAttribute("valid", "true"));
|
24
25
|
}
|
25
|
-
|
26
|
-
|
26
|
+
handleDebugInvalid() {
|
27
|
+
this._invalid && this.debug && !this.validity.valid && console.log(`Checkbox invalidity reason: ${this.validationMessage}`);
|
28
|
+
}
|
29
|
+
handleCustomInvalidChange() {
|
30
|
+
if (this.customInvalid) {
|
31
|
+
const s = (
|
32
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
33
|
+
this.getAttribute("data-customerror") || "Set a custom error message using the data-customerror attribute"
|
34
|
+
);
|
35
|
+
this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, s), this.checkValidity();
|
36
|
+
} else
|
37
|
+
this.setValidity({}), this._validateInput();
|
27
38
|
}
|
28
39
|
firstUpdated() {
|
29
|
-
var
|
30
|
-
(
|
40
|
+
var i;
|
41
|
+
(i = this.$input) == null || i.addEventListener("change", (s) => {
|
31
42
|
var a;
|
32
|
-
|
33
|
-
}), this.addEventListener("invalid", (
|
34
|
-
this.pristine = !1, this._invalid = !0, this.customErrorDisplay &&
|
35
|
-
}), this.
|
36
|
-
}
|
37
|
-
updated(t) {
|
38
|
-
super.updated(t), t.has("_invalid") && this._invalid && this.debug && this.debugOutput();
|
39
|
-
}
|
40
|
-
attributeChangedCallback(t, r, a) {
|
41
|
-
if (super.attributeChangedCallback(t, r, a), t === "custom-invalid")
|
42
|
-
if (typeof a == "string") {
|
43
|
-
const o = String(a).trim() || "Custom error";
|
44
|
-
this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, o), this.checkValidity();
|
45
|
-
} else
|
46
|
-
this.setValidity({}), this._validateInput();
|
47
|
-
}
|
48
|
-
debugOutput() {
|
49
|
-
this.debug && !this.validity.valid && console.log(`Checkbox invalidity reason: ${this.validationMessage}`);
|
43
|
+
s.stopPropagation(), this.pristine = !1, this.checked = (a = this.$input) == null ? void 0 : a.checked, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.emitEvent("change");
|
44
|
+
}), this.addEventListener("invalid", (s) => {
|
45
|
+
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && s.preventDefault();
|
46
|
+
}), this._initiallyChecked = this.checked, this.addEventListener("reset", this._resetValue), this._validateInput();
|
50
47
|
}
|
51
48
|
/** @internal */
|
52
49
|
_validateInput() {
|
53
|
-
var
|
50
|
+
var i;
|
54
51
|
if (this._invalid = !1, this.customInvalid)
|
55
52
|
this.setValidity({ customError: !0 }, "Custom error"), this._invalid = !0;
|
56
53
|
else if (this.required && !this.checked) {
|
57
54
|
this.pristine || (this._invalid = !0);
|
58
|
-
const
|
59
|
-
|
55
|
+
const s = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
56
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
57
|
+
((i = this.$input) == null ? void 0 : i.validationMessage) || "Please check this box if you want to proceed"
|
58
|
+
);
|
59
|
+
this.setValidity({ valueMissing: !0 }, String(s));
|
60
60
|
} else
|
61
61
|
this.setValidity({});
|
62
62
|
}
|
63
63
|
render() {
|
64
|
-
return
|
64
|
+
return p`
|
65
65
|
<label id="root">
|
66
66
|
<input
|
67
67
|
?checked=${this.checked}
|
@@ -74,58 +74,64 @@ const h = class h extends p {
|
|
74
74
|
value=${this.value}
|
75
75
|
/>
|
76
76
|
${this._renderIcon("check")} ${this._renderIcon("removeMinus")}
|
77
|
-
<div
|
77
|
+
<div id="label">
|
78
78
|
<slot>${this.label}</slot>
|
79
|
-
${this.required ?
|
79
|
+
${this.required ? v(this.requiredLabel) : f}
|
80
80
|
</div>
|
81
81
|
</label>
|
82
82
|
`;
|
83
83
|
}
|
84
84
|
};
|
85
|
-
|
86
|
-
let
|
87
|
-
|
88
|
-
|
89
|
-
],
|
90
|
-
|
91
|
-
|
92
|
-
],
|
93
|
-
|
94
|
-
|
95
|
-
],
|
96
|
-
|
97
|
-
|
98
|
-
],
|
99
|
-
|
100
|
-
|
101
|
-
],
|
102
|
-
|
103
|
-
|
104
|
-
],
|
105
|
-
|
106
|
-
|
107
|
-
],
|
108
|
-
|
109
|
-
|
110
|
-
],
|
111
|
-
|
112
|
-
|
113
|
-
],
|
114
|
-
|
115
|
-
|
116
|
-
],
|
117
|
-
|
118
|
-
|
119
|
-
],
|
120
|
-
|
121
|
-
|
122
|
-
],
|
123
|
-
|
124
|
-
|
125
|
-
],
|
126
|
-
|
127
|
-
|
128
|
-
],
|
85
|
+
d.styles = [m, g];
|
86
|
+
let t = d;
|
87
|
+
e([
|
88
|
+
r({ type: Boolean })
|
89
|
+
], t.prototype, "debug", 2);
|
90
|
+
e([
|
91
|
+
r({ type: Boolean, reflect: !0 })
|
92
|
+
], t.prototype, "checked", 2);
|
93
|
+
e([
|
94
|
+
r({ type: Boolean, attribute: "custom-invalid", reflect: !0 })
|
95
|
+
], t.prototype, "customInvalid", 2);
|
96
|
+
e([
|
97
|
+
r({ type: Boolean, reflect: !0 })
|
98
|
+
], t.prototype, "indeterminate", 2);
|
99
|
+
e([
|
100
|
+
r()
|
101
|
+
], t.prototype, "label", 2);
|
102
|
+
e([
|
103
|
+
r()
|
104
|
+
], t.prototype, "name", 2);
|
105
|
+
e([
|
106
|
+
r({ attribute: "required-label" })
|
107
|
+
], t.prototype, "requiredLabel", 2);
|
108
|
+
e([
|
109
|
+
r({ reflect: !0 })
|
110
|
+
], t.prototype, "severity", 2);
|
111
|
+
e([
|
112
|
+
r({ type: Boolean, attribute: "show-valid" })
|
113
|
+
], t.prototype, "showValid", 2);
|
114
|
+
e([
|
115
|
+
r({ reflect: !0 })
|
116
|
+
], t.prototype, "size", 2);
|
117
|
+
e([
|
118
|
+
r()
|
119
|
+
], t.prototype, "value", 2);
|
120
|
+
e([
|
121
|
+
y()
|
122
|
+
], t.prototype, "_invalid", 2);
|
123
|
+
e([
|
124
|
+
_("input")
|
125
|
+
], t.prototype, "$input", 2);
|
126
|
+
e([
|
127
|
+
h("_invalid")
|
128
|
+
], t.prototype, "handleInvalidChange", 1);
|
129
|
+
e([
|
130
|
+
h("_invalid", { afterUpdate: !0 })
|
131
|
+
], t.prototype, "handleDebugInvalid", 1);
|
132
|
+
e([
|
133
|
+
h("customInvalid")
|
134
|
+
], t.prototype, "handleCustomInvalidChange", 1);
|
129
135
|
export {
|
130
|
-
|
136
|
+
t as SkfCheckbox
|
131
137
|
};
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import '
|
2
|
-
import { SkfElement } from '
|
3
|
-
import type { HeadingType } from '
|
1
|
+
import '../icon/icon.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element.js';
|
3
|
+
import type { HeadingType } from '../../internal/constants/heading.js';
|
4
4
|
import type { CSSResultGroup } from 'lit';
|
5
5
|
/**
|
6
6
|
* The `<skf-collapse>` component is a general purpose container for content that can be collapsed / expanded.
|
@@ -16,20 +16,20 @@ import type { CSSResultGroup } from 'lit';
|
|
16
16
|
export declare class SkfCollapse extends SkfElement {
|
17
17
|
static styles: CSSResultGroup;
|
18
18
|
/** If true, will animate the expand/collapse state */
|
19
|
-
animated
|
19
|
+
animated: boolean;
|
20
20
|
/** If true, will set the collapse to be expanded by default */
|
21
|
-
expanded
|
21
|
+
expanded: boolean;
|
22
22
|
/** Heading for the collapse */
|
23
23
|
heading?: string;
|
24
24
|
/**
|
25
25
|
* Defines which heading element will be rendered
|
26
|
-
* @type { "
|
26
|
+
* @type { "h2" | "h3" | "h4" }
|
27
27
|
*/
|
28
28
|
headingAs: Exclude<HeadingType, 'h1'>;
|
29
29
|
/** If true, renders the small version */
|
30
|
-
small
|
30
|
+
small: boolean;
|
31
31
|
/** If true, will truncate the heading in collapsed state */
|
32
|
-
truncate
|
32
|
+
truncate: boolean;
|
33
33
|
/** Class method as alternative to manipulate attribute */
|
34
34
|
setClose(): void;
|
35
35
|
/** Class method as alternative to manipulate attribute */
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
|
-
import { SkfElement as
|
3
|
-
import
|
4
|
-
import { property as
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
import { SkfElement as c } from "../../internal/components/skf-element.js";
|
3
|
+
import h from "../../styles/component.styles.js";
|
4
|
+
import { property as s } from "lit/decorators.js";
|
5
|
+
import { classMap as m } from "lit/directives/class-map.js";
|
6
|
+
import { ifDefined as f } from "lit/directives/if-defined.js";
|
7
|
+
import { html as u, unsafeStatic as d } from "lit/static-html.js";
|
8
|
+
import _ from "./collapse.styles.js";
|
9
|
+
var y = Object.defineProperty, a = (i, n, r, g) => {
|
10
|
+
for (var t = void 0, l = i.length - 1, p; l >= 0; l--)
|
11
|
+
(p = i[l]) && (t = p(n, r, t) || t);
|
12
|
+
return t && y(n, r, t), t;
|
12
13
|
};
|
13
|
-
const
|
14
|
+
const o = class o extends c {
|
14
15
|
constructor() {
|
15
|
-
super(...arguments), this.headingAs = "h2", this._toggle = () => {
|
16
|
+
super(...arguments), this.animated = !1, this.expanded = !1, this.headingAs = "h2", this.small = !1, this.truncate = !1, this._toggle = () => {
|
16
17
|
this.dispatchEvent(
|
17
18
|
new CustomEvent("skf-collapse-toggle", {
|
18
19
|
bubbles: !0,
|
@@ -32,20 +33,27 @@ const n = class n extends h {
|
|
32
33
|
}
|
33
34
|
render() {
|
34
35
|
return u`
|
35
|
-
<div
|
36
|
-
|
36
|
+
<div class=${m({
|
37
|
+
collapse: !0,
|
38
|
+
"collapse--animated": this.animated,
|
39
|
+
"collapse--expanded": this.expanded,
|
40
|
+
"collapse--small": this.small,
|
41
|
+
"collapse--truncate": this.truncate
|
42
|
+
})}>
|
43
|
+
<${d(this.headingAs)} class="collapse__heading">
|
37
44
|
<button
|
38
45
|
@click=${this._toggle}
|
39
46
|
aria-controls="main"
|
40
|
-
aria-expanded=${
|
47
|
+
aria-expanded=${f(this.expanded ? "true" : "false")}
|
48
|
+
class="collapse__btn"
|
41
49
|
type="button"
|
42
50
|
>
|
43
|
-
<span
|
44
|
-
<skf-icon name=${this.expanded ? "caretUp" : "caretDown"}></skf-icon>
|
51
|
+
<span class="collapse__label">${this.heading}</span>
|
52
|
+
<skf-icon class="collapse__icon" name=${this.expanded ? "caretUp" : "caretDown"}></skf-icon>
|
45
53
|
</button>
|
46
|
-
</${
|
47
|
-
<div
|
48
|
-
<div
|
54
|
+
</${d(this.headingAs)}>
|
55
|
+
<div class="collapse__body">
|
56
|
+
<div class="collapse__main" data-testid="main" id="main">
|
49
57
|
<slot></slot>
|
50
58
|
</div>
|
51
59
|
</div>
|
@@ -53,25 +61,25 @@ const n = class n extends h {
|
|
53
61
|
`;
|
54
62
|
}
|
55
63
|
};
|
56
|
-
|
57
|
-
let e =
|
58
|
-
|
59
|
-
|
64
|
+
o.styles = [h, _];
|
65
|
+
let e = o;
|
66
|
+
a([
|
67
|
+
s({ type: Boolean, reflect: !0 })
|
60
68
|
], e.prototype, "animated");
|
61
|
-
|
62
|
-
|
69
|
+
a([
|
70
|
+
s({ type: Boolean, reflect: !0 })
|
63
71
|
], e.prototype, "expanded");
|
64
|
-
|
65
|
-
|
72
|
+
a([
|
73
|
+
s()
|
66
74
|
], e.prototype, "heading");
|
67
|
-
|
68
|
-
|
75
|
+
a([
|
76
|
+
s({ attribute: "heading-as" })
|
69
77
|
], e.prototype, "headingAs");
|
70
|
-
|
71
|
-
|
78
|
+
a([
|
79
|
+
s({ type: Boolean, reflect: !0 })
|
72
80
|
], e.prototype, "small");
|
73
|
-
|
74
|
-
|
81
|
+
a([
|
82
|
+
s({ type: Boolean, reflect: !0 })
|
75
83
|
], e.prototype, "truncate");
|
76
84
|
export {
|
77
85
|
e as SkfCollapse
|
@@ -1,22 +1,23 @@
|
|
1
|
-
import { css as
|
2
|
-
const s =
|
1
|
+
import { css as a } from "lit";
|
2
|
+
const s = a`
|
3
|
+
/* stylelint-disable selector-class-pattern */
|
3
4
|
@layer components {
|
4
|
-
|
5
|
+
.collapse {
|
5
6
|
background: var(--skf-bg-color-neutral-1);
|
6
7
|
border-bottom: var(--skf-border-width-sm) solid var(--skf-border-color-tertiary);
|
7
8
|
}
|
8
9
|
|
9
|
-
|
10
|
+
.collapse__heading {
|
10
11
|
font-size: var(--_skf-collapse-heading-size, var(--skf-font-size-100));
|
11
12
|
font-weight: var(--_skf-collapse-heading-weight, normal);
|
12
13
|
|
13
|
-
|
14
|
+
.collapse--small & {
|
14
15
|
--_skf-collapse-heading-size: var(--skf-font-size-75);
|
15
16
|
--_skf-collapse-heading-weight: var(--skf-font-weight-medium);
|
16
17
|
}
|
17
18
|
}
|
18
19
|
|
19
|
-
|
20
|
+
.collapse__btn {
|
20
21
|
align-items: center;
|
21
22
|
display: flex;
|
22
23
|
padding-block: var(--_skf-collapse-button-padding-block, var(--skf-spacing-50));
|
@@ -28,39 +29,39 @@ const s = o`
|
|
28
29
|
outline-offset: -2px;
|
29
30
|
}
|
30
31
|
|
31
|
-
|
32
|
+
.collapse--small & {
|
32
33
|
--_skf-collapse-button-padding-block: var(--skf-spacing-25);
|
33
34
|
}
|
34
35
|
}
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
.collapse__label {
|
38
|
+
.collapse--truncate:not(.collapse--expanded) & {
|
38
39
|
overflow: hidden;
|
39
40
|
text-overflow: ellipsis;
|
40
41
|
white-space: nowrap;
|
41
42
|
}
|
42
43
|
}
|
43
44
|
|
44
|
-
|
45
|
+
.collapse__icon {
|
45
46
|
margin-inline-start: auto;
|
46
47
|
}
|
47
48
|
|
48
|
-
|
49
|
+
.collapse__body {
|
49
50
|
display: grid;
|
50
51
|
grid-template-rows: var(--_skf-collapse-body-height, 0fr);
|
51
52
|
padding-inline: var(--skf-spacing-75);
|
52
53
|
|
53
|
-
|
54
|
+
.collapse--animated & {
|
54
55
|
transition: grid-template-rows calc(var(--skf-motion-duration-normal) * 1ms)
|
55
56
|
var(--skf-motion-easing-ease-in);
|
56
57
|
}
|
57
58
|
|
58
|
-
|
59
|
+
.collapse--expanded & {
|
59
60
|
--_skf-collapse-body-height: 1fr;
|
60
61
|
}
|
61
62
|
}
|
62
63
|
|
63
|
-
|
64
|
+
.collapse__main {
|
64
65
|
overflow: hidden;
|
65
66
|
|
66
67
|
&::after {
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import '../button/button.js';
|
2
|
+
import '../heading/heading.js';
|
3
|
+
import '../icon/icon.js';
|
4
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
5
|
+
import { type CSSResultGroup } from 'lit';
|
6
|
+
/**
|
7
|
+
* TODO: Is modal the right name? Should it be "blocking" or "blocking-dialog"?
|
8
|
+
*
|
9
|
+
* TBD: Should we inert the page behind the dialog? Maybe only if it is modal-dialog?
|
10
|
+
*
|
11
|
+
* TBD: Should we disable scrolling on the page behind the dialog? Maybe only if it is modal?
|
12
|
+
*/
|
13
|
+
/**
|
14
|
+
* The `<skf-dialog>` is a component that open up a dialog with the content provided
|
15
|
+
*
|
16
|
+
* @documentation See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/6229d63d9fe16020a60657e5) for design principles
|
17
|
+
*
|
18
|
+
* @slot - The dialog component's content
|
19
|
+
* @slot footer - The dialog component's buttons goes here
|
20
|
+
*
|
21
|
+
* @event skf-dialog-open - Fires when the dialog is opened (after transitioned in)
|
22
|
+
* @event skf-dialog-close - Fires when the dialog is closed (before transitioned out)
|
23
|
+
* @event close - Fires when the dialog is closed (after transitioned out)
|
24
|
+
*
|
25
|
+
* @cssproperty --skf-dialog-height - A custom height for the Dialog. Pass valid CSS **block-size** values
|
26
|
+
* @cssproperty --skf-dialog-width - A custom width for the Dialog Pass valid CSS **inline-size** values
|
27
|
+
*
|
28
|
+
* @tagname skf-dialog
|
29
|
+
*/
|
30
|
+
export declare class SkfDialog extends SkfElement {
|
31
|
+
#private;
|
32
|
+
static styles: CSSResultGroup;
|
33
|
+
/** If defined, sets the aria-label for the close button */
|
34
|
+
closeButtonAriaLabel?: string;
|
35
|
+
/** Title for the modal/dialog */
|
36
|
+
heading?: string;
|
37
|
+
/** If true, makes the dialog stretch edge to edge on screen */
|
38
|
+
fullscreen: boolean;
|
39
|
+
/** If true, removes the close button */
|
40
|
+
noCloseButton?: boolean | undefined;
|
41
|
+
/** If defined, removes the inner padding */
|
42
|
+
noPadding: boolean;
|
43
|
+
open?: boolean | null;
|
44
|
+
/** If provided, will run function on dialog close */
|
45
|
+
onClose?: ((event: Event) => void) | null;
|
46
|
+
/** @internal */
|
47
|
+
$dialog: HTMLDialogElement;
|
48
|
+
/** @internal */
|
49
|
+
footerEls?: HTMLElement[];
|
50
|
+
/** @internal */
|
51
|
+
modal: boolean;
|
52
|
+
/** @internal */
|
53
|
+
renderFoot: boolean;
|
54
|
+
protected firstUpdated(): void;
|
55
|
+
handleOpenChange(): void;
|
56
|
+
/** @internal */
|
57
|
+
show: () => Promise<boolean>;
|
58
|
+
/** @internal */
|
59
|
+
_transition(): {
|
60
|
+
entry: () => Promise<unknown>;
|
61
|
+
exit: () => Promise<unknown>;
|
62
|
+
};
|
63
|
+
/** @internal */
|
64
|
+
_handleBackdropClick: (event: MouseEvent) => void;
|
65
|
+
/** @internal */
|
66
|
+
_handleClose: (event: Event) => void;
|
67
|
+
/** @internal */
|
68
|
+
get _isModal(): boolean;
|
69
|
+
/** Method that opens the dialog in modal state */
|
70
|
+
showModal: () => Promise<boolean>;
|
71
|
+
/** Method that closes the dialog */
|
72
|
+
close: () => Promise<boolean | undefined>;
|
73
|
+
render(): import("lit").TemplateResult<1>;
|
74
|
+
}
|