@skf-design-system/ui-components 1.0.0-beta.4 → 1.0.0-beta.7
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-item.d.ts +1 -1
- package/dist/components/accordion/accordion.component.d.ts +13 -9
- package/dist/components/accordion/accordion.component.js +34 -30
- package/dist/components/accordion/accordion.d.ts +1 -1
- 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 +10 -7
- package/dist/components/alert/alert.component.js +50 -37
- package/dist/components/alert/alert.styles.d.ts +1 -2
- package/dist/components/alert/alert.styles.js +42 -34
- package/dist/components/button/button.component.d.ts +28 -4
- 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 +1 -1
- package/dist/components/card/card.component.js +29 -21
- package/dist/components/card/card.styles.d.ts +1 -2
- package/dist/components/card/card.styles.js +22 -12
- package/dist/components/checkbox/checkbox.component.d.ts +20 -18
- 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 +8 -5
- package/dist/components/collapse/collapse.component.js +50 -39
- package/dist/components/collapse/collapse.styles.js +13 -12
- package/dist/components/collapse/collapse.test.d.ts +1 -0
- 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 +14 -11
- package/dist/components/divider/divider.component.js +46 -29
- package/dist/components/divider/divider.styles.d.ts +1 -2
- package/dist/components/divider/divider.styles.js +26 -30
- package/dist/components/heading/heading.component.d.ts +14 -4
- 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 +15 -9
- 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 +48 -33
- package/dist/components/input/input.component.js +108 -99
- package/dist/components/link/link.component.d.ts +20 -17
- package/dist/components/link/link.component.js +20 -14
- package/dist/components/link/link.styles.js +36 -40
- package/dist/components/loader/loader.component.d.ts +7 -7
- package/dist/components/loader/loader.component.js +42 -61
- package/dist/components/loader/loader.styles.js +44 -11
- package/dist/components/logo/logo.component.d.ts +7 -5
- 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 +12 -10
- 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 +21 -21
- 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 +14 -12
- package/dist/components/select/select.component.js +119 -103
- package/dist/components/select/select.controllers.d.ts +1 -1
- 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 +3 -3
- package/dist/components/select-option/select-option.component.js +16 -10
- 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/switch/switch.component.d.ts +4 -5
- package/dist/components/switch/switch.component.js +17 -7
- package/dist/components/switch/switch.styles.js +19 -11
- 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 +14 -9
- package/dist/components/tag/tag.component.js +63 -47
- package/dist/components/tag/tag.styles.js +35 -28
- package/dist/components/textarea/textarea.component.d.ts +30 -27
- 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 +3090 -1993
- package/dist/index.d.ts +6 -0
- package/dist/index.js +60 -42
- 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 +12 -10
- package/dist/internal/components/hint/hint.styles.js +26 -10
- package/dist/internal/components/skf-element.js +26 -25
- package/dist/internal/helpers/hintSeverity.d.ts +1 -1
- 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 -8
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +7 -6
- package/dist/react/index.d.ts +10 -3
- package/dist/react/index.js +10 -3
- 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-progress/index.d.ts +3 -0
- package/dist/react/skf-progress/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/component.styles.js +15 -2
- package/dist/styles/form-field.styles.js +5 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +300 -117
- package/dist/types/vue/index.d.ts +266 -76
- package/dist/vscode.html-custom-data.json +349 -216
- package/dist/web-types.json +686 -292
- package/package.json +33 -32
@@ -1,29 +1,29 @@
|
|
1
|
-
import { computePosition as
|
1
|
+
import { computePosition as v, flip as f, shift as _, offset as g } from "@floating-ui/dom";
|
2
2
|
import { FormBase as b } from "../../internal/components/formBase.js";
|
3
3
|
import { findMatchingTags as y } from "../../internal/helpers/findMatchingTags.js";
|
4
4
|
import { hintSeverity as O } from "../../internal/helpers/hintSeverity.js";
|
5
|
-
import { raiseError as
|
6
|
-
import { Asterisk as
|
7
|
-
import
|
8
|
-
import { html as h, nothing as
|
9
|
-
import { property as
|
10
|
-
import { classMap as
|
5
|
+
import { raiseError as w } from "../../internal/helpers/raiseError.js";
|
6
|
+
import { Asterisk as x } from "../../internal/templates/asterisk.js";
|
7
|
+
import $ from "../../styles/component.styles.js";
|
8
|
+
import { html as h, nothing as V } from "lit";
|
9
|
+
import { property as o, state as d, query as p } from "lit/decorators.js";
|
10
|
+
import { classMap as S } from "lit/directives/class-map.js";
|
11
11
|
import { ifDefined as m } from "lit/directives/if-defined.js";
|
12
12
|
import "../../internal/components/hint/hint.js";
|
13
13
|
import "../tag/tag.js";
|
14
|
-
import { ScrollController as C, ResizeController as
|
14
|
+
import { ScrollController as C, ResizeController as k, GlobalClickController as L, KeyboardNavigationController as A, DeveloperFeedbackController as E } from "./select.controllers.js";
|
15
15
|
import { styles as P } from "./select.styles.js";
|
16
|
-
var
|
17
|
-
for (var
|
18
|
-
(
|
19
|
-
return
|
16
|
+
var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor, l = (u, t, e, i) => {
|
17
|
+
for (var r = i > 1 ? void 0 : i ? D(t, e) : t, n = u.length - 1, a; n >= 0; n--)
|
18
|
+
(a = u[n]) && (r = (i ? a(t, e, r) : a(r)) || r);
|
19
|
+
return i && r && T(t, e, r), r;
|
20
20
|
};
|
21
21
|
const c = class c extends b {
|
22
22
|
constructor() {
|
23
|
-
super(), this.selectDelay =
|
23
|
+
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.scrollController = new C(this), this.resizeController = new k(this), this.globalClickController = new L(this), this.keyboardNavController = new A(this), this.developerFeedbackController = new E(this), this._handleOptionSelected = (t) => {
|
24
24
|
this._pristine = !1;
|
25
25
|
const e = this._selectedOptions.length > 0;
|
26
|
-
this.setFormValue(e ? this.
|
26
|
+
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
27
27
|
}, this._handleReset = () => {
|
28
28
|
this.emitEvent("reset"), this._resetSelectedOptions();
|
29
29
|
}, this._updateWidth = () => {
|
@@ -32,20 +32,20 @@ const c = class c extends b {
|
|
32
32
|
(t = this.$dropdown) == null || t.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
33
33
|
}, 50);
|
34
34
|
}, this._managePopover = () => ({ close: () => {
|
35
|
-
var
|
36
|
-
(
|
35
|
+
var i;
|
36
|
+
(i = this.$dropdown) == null || i.hidePopover();
|
37
37
|
}, open: () => {
|
38
|
-
const
|
39
|
-
!
|
38
|
+
const i = this.$selectBtn, r = this.$dropdown;
|
39
|
+
!i || !r || (r.showPopover(), v(i, r, {
|
40
40
|
placement: "bottom",
|
41
|
-
middleware: [
|
42
|
-
}).then(({ x:
|
43
|
-
Object.assign(
|
44
|
-
left: `${String(
|
45
|
-
top: `${String(Math.round(
|
41
|
+
middleware: [f(), _({ padding: 5 }), g(2)]
|
42
|
+
}).then(({ x: n, y: a }) => {
|
43
|
+
Object.assign(r.style, {
|
44
|
+
left: `${String(n)}px`,
|
45
|
+
top: `${String(Math.round(a - window.scrollY))}px`
|
46
46
|
});
|
47
|
-
}).catch((
|
48
|
-
console.error(
|
47
|
+
}).catch((n) => {
|
48
|
+
console.error(n);
|
49
49
|
}));
|
50
50
|
} }), this._handleDropdownToggle = (t) => {
|
51
51
|
t.stopPropagation(), this._expanded = !this._expanded;
|
@@ -55,10 +55,10 @@ const c = class c extends b {
|
|
55
55
|
this.setFormValue(null), this.requestUpdate();
|
56
56
|
break;
|
57
57
|
case this._selectedOptions.length === 1:
|
58
|
-
this.setFormValue(this.
|
58
|
+
this.setFormValue(this.selectedValues[0]);
|
59
59
|
break;
|
60
60
|
case this._selectedOptions.length > 1:
|
61
|
-
this.setFormValue(this.
|
61
|
+
this.setFormValue(this.selectedValues.join(","));
|
62
62
|
break;
|
63
63
|
default:
|
64
64
|
throw new Error("Something went wrong");
|
@@ -68,8 +68,8 @@ const c = class c extends b {
|
|
68
68
|
});
|
69
69
|
}), this._resetSelectedOptions = (t) => {
|
70
70
|
const e = !t;
|
71
|
-
this._optionsList.forEach((
|
72
|
-
(e ||
|
71
|
+
this._optionsList.forEach((i) => {
|
72
|
+
(e || i !== t) && i.removeAttribute("selected");
|
73
73
|
});
|
74
74
|
}, this._handleSlotChange = () => {
|
75
75
|
this._collectSlotOptionTags(), this._validateInput();
|
@@ -78,11 +78,23 @@ const c = class c extends b {
|
|
78
78
|
return (t = this.$selectedValue) == null || t.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${String(this._selectedOptions.length)} items selected)` : this.value ? ((e = this.$selectedValue) == null || e.classList.remove("contains-meta-info"), this.value) : this.buttonLabel;
|
79
79
|
}, this._selectedOptions = [];
|
80
80
|
}
|
81
|
-
|
81
|
+
set selectedValues(t) {
|
82
|
+
this._selectedOptions = this._optionsList.filter((e) => t.includes(e.value.trim()));
|
83
|
+
}
|
84
|
+
get selectedValues() {
|
82
85
|
return this._selectedOptions.map((t) => t.value.trim());
|
83
86
|
}
|
84
|
-
|
85
|
-
|
87
|
+
set selectedOptionsText(t) {
|
88
|
+
this._selectedOptions = this._selectedOptions.filter(
|
89
|
+
(e) => e.textContent && t.includes(e.textContent)
|
90
|
+
);
|
91
|
+
}
|
92
|
+
get selectedOptionsText() {
|
93
|
+
return this._selectedOptions.map((t) => t.textContent ?? "");
|
94
|
+
}
|
95
|
+
set value(t) {
|
96
|
+
const e = t.split(",").map((i) => i.trim());
|
97
|
+
this._selectedOptions = this._optionsList.filter((i) => e.includes(i.value.trim()));
|
86
98
|
}
|
87
99
|
get value() {
|
88
100
|
return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
|
@@ -113,21 +125,20 @@ const c = class c extends b {
|
|
113
125
|
}
|
114
126
|
firstUpdated() {
|
115
127
|
var t;
|
116
|
-
this.addEventListener("skf-select-option:select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this.
|
128
|
+
this.addEventListener("skf-select-option:select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
|
117
129
|
}
|
118
130
|
updated(t) {
|
119
|
-
var e, s;
|
120
131
|
if (t.has("_expanded")) {
|
121
|
-
const
|
122
|
-
if (this.emit("skf-select:dropdown", { detail: { expanded: this._expanded } }),
|
123
|
-
this._expanded ?
|
132
|
+
const e = !!t.get("_expanded") === this._expanded;
|
133
|
+
if (this.emit("skf-select:dropdown", { detail: { expanded: this._expanded } }), e) return;
|
134
|
+
this._expanded ? this._managePopover().open() : this._managePopover().close();
|
124
135
|
}
|
125
136
|
}
|
126
|
-
attributeChangedCallback(t, e,
|
127
|
-
if (super.attributeChangedCallback(t, e,
|
128
|
-
if (typeof
|
129
|
-
const
|
130
|
-
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 },
|
137
|
+
attributeChangedCallback(t, e, i) {
|
138
|
+
if (super.attributeChangedCallback(t, e, i), t === "custom-invalid")
|
139
|
+
if (typeof i == "string") {
|
140
|
+
const n = this.withFallback(i);
|
141
|
+
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, n), this.checkValidity();
|
131
142
|
} else
|
132
143
|
this.setValidity({}), this._validateInput();
|
133
144
|
}
|
@@ -142,8 +153,8 @@ const c = class c extends b {
|
|
142
153
|
e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
|
143
154
|
});
|
144
155
|
else {
|
145
|
-
const e = this._selectedOptions.length > 0,
|
146
|
-
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []),
|
156
|
+
const e = this._selectedOptions.length > 0, i = t.detail.value !== null;
|
157
|
+
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), i && (this.selectedOptions = [t.target]);
|
147
158
|
}
|
148
159
|
this._setValue();
|
149
160
|
}
|
@@ -154,7 +165,7 @@ const c = class c extends b {
|
|
154
165
|
/** @internal */
|
155
166
|
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
156
167
|
_collectSlotOptionTags() {
|
157
|
-
this._optionsList = y(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected),
|
168
|
+
this._optionsList = y(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), w({
|
158
169
|
assert: this._optionsList.length > 0,
|
159
170
|
reason: "no-children",
|
160
171
|
replaceStrings: [this.localName, "skf-select-option"]
|
@@ -163,42 +174,44 @@ const c = class c extends b {
|
|
163
174
|
/** @internal */
|
164
175
|
_validateInput() {
|
165
176
|
this._invalid = !1;
|
166
|
-
const t = this.required && !this.
|
177
|
+
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), i = !!(this.max && this.selectedValues.length > this.max);
|
167
178
|
if (this._internals.validity.customError) {
|
168
179
|
this._invalid = !0;
|
169
180
|
return;
|
170
181
|
} else if (t) {
|
171
|
-
const
|
172
|
-
this.setValidity({ valueMissing: !0 }, String(
|
182
|
+
const n = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
|
183
|
+
this.setValidity({ valueMissing: !0 }, String(n)), this._pristine || (this._invalid = !0);
|
173
184
|
} else if (e) {
|
174
|
-
const
|
175
|
-
this.setValidity({ rangeUnderflow: !0 }, String(
|
176
|
-
} else if (
|
177
|
-
const
|
178
|
-
this.setValidity({ rangeOverflow: !0 }, String(
|
185
|
+
const n = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
|
186
|
+
this.setValidity({ rangeUnderflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
|
187
|
+
} else if (i) {
|
188
|
+
const n = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
|
189
|
+
this.setValidity({ rangeOverflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
|
179
190
|
} else
|
180
191
|
this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
|
181
192
|
}
|
182
193
|
render() {
|
183
194
|
return h`
|
184
|
-
<div id="
|
195
|
+
<div id="root">
|
185
196
|
<label>
|
186
197
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
187
198
|
${this.label}
|
188
|
-
${this.required ?
|
199
|
+
${this.required ? x(this.requiredLabel) : null}
|
189
200
|
</div>
|
190
201
|
<button
|
191
202
|
?disabled=${this.disabled}
|
192
203
|
@click=${this._handleDropdownToggle}
|
193
204
|
aria-controls="select-dropdown"
|
194
|
-
aria-expanded
|
205
|
+
aria-expanded=${this._expanded}
|
206
|
+
aria-invalid=${this._invalid}
|
195
207
|
aria-haspopup="listbox"
|
208
|
+
class="skf-icon-host"
|
196
209
|
id="select-button"
|
197
210
|
role="combobox"
|
198
211
|
>
|
199
212
|
<span
|
200
213
|
id="selected-value"
|
201
|
-
class=${
|
214
|
+
class=${S({ "selected-value": !0, "contains-meta-info": !this.value })}>
|
202
215
|
${this._computeVisibleValue()}
|
203
216
|
</span>
|
204
217
|
<skf-icon class="arrow" name="chevronDown"></skf-icon>
|
@@ -207,27 +220,30 @@ const c = class c extends b {
|
|
207
220
|
<div aria-multiselectable=${m(this.multiple && !0)} id="select-dropdown" popover role="listbox">
|
208
221
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
209
222
|
</div>
|
210
|
-
${!this.hideTags && this.multiple ? h`
|
223
|
+
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? h`
|
211
224
|
<div id="tags">
|
212
225
|
${this.selectedOptions.map(
|
213
226
|
(t) => h`
|
214
227
|
<skf-tag
|
228
|
+
style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
215
229
|
removable
|
216
|
-
.onRemove=${(e) => (e.stopPropagation(), e.preventDefault(), t.removeAttribute("selected"),
|
230
|
+
.onRemove=${(e) => (e.stopPropagation(), e.preventDefault(), document.startViewTransition || t.removeAttribute("selected"), document.startViewTransition(() => {
|
231
|
+
t.removeAttribute("selected");
|
232
|
+
}), !1)}
|
217
233
|
>
|
218
234
|
${t.textContent}
|
219
235
|
</skf-tag>
|
220
236
|
`
|
221
237
|
)}
|
222
238
|
</div>
|
223
|
-
` :
|
239
|
+
` : V}
|
224
240
|
${this.hint && h`
|
225
241
|
<skf-hint
|
226
242
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
227
243
|
id="hint"
|
228
244
|
severity=${m(O(this.severity, this._invalid))}
|
229
245
|
>
|
230
|
-
${this.hint}
|
246
|
+
${this.customInvalid ? this.customInvalid : this.hint}
|
231
247
|
</skf-hint>
|
232
248
|
`}
|
233
249
|
</div>
|
@@ -235,77 +251,77 @@ const c = class c extends b {
|
|
235
251
|
`;
|
236
252
|
}
|
237
253
|
};
|
238
|
-
c.styles = [
|
239
|
-
let
|
254
|
+
c.styles = [$, P];
|
255
|
+
let s = c;
|
240
256
|
l([
|
241
|
-
|
242
|
-
],
|
257
|
+
o({ type: String, reflect: !0, attribute: "button-label" })
|
258
|
+
], s.prototype, "buttonLabel", 2);
|
243
259
|
l([
|
244
|
-
|
245
|
-
],
|
260
|
+
o({ attribute: "custom-invalid" })
|
261
|
+
], s.prototype, "customInvalid", 2);
|
246
262
|
l([
|
247
|
-
|
248
|
-
],
|
263
|
+
o({ type: Boolean, attribute: "hide-label" })
|
264
|
+
], s.prototype, "hideLabel", 2);
|
249
265
|
l([
|
250
|
-
|
251
|
-
],
|
266
|
+
o({ type: Boolean, reflect: !0, attribute: "hide-tags" })
|
267
|
+
], s.prototype, "hideTags", 2);
|
252
268
|
l([
|
253
|
-
|
254
|
-
],
|
269
|
+
o()
|
270
|
+
], s.prototype, "hint", 2);
|
255
271
|
l([
|
256
|
-
|
257
|
-
],
|
272
|
+
o({ type: Array, attribute: !1 })
|
273
|
+
], s.prototype, "selectedValues", 1);
|
258
274
|
l([
|
259
|
-
|
260
|
-
],
|
275
|
+
o({ type: Array, attribute: !1 })
|
276
|
+
], s.prototype, "selectedOptionsText", 1);
|
261
277
|
l([
|
262
|
-
|
263
|
-
],
|
278
|
+
o({ reflect: !0 })
|
279
|
+
], s.prototype, "label", 2);
|
264
280
|
l([
|
265
|
-
|
266
|
-
],
|
281
|
+
o({ type: Number })
|
282
|
+
], s.prototype, "max", 2);
|
267
283
|
l([
|
268
|
-
|
269
|
-
],
|
284
|
+
o({ type: Number })
|
285
|
+
], s.prototype, "min", 2);
|
270
286
|
l([
|
271
|
-
|
272
|
-
],
|
287
|
+
o({ type: Boolean, reflect: !0 })
|
288
|
+
], s.prototype, "multiple", 2);
|
273
289
|
l([
|
274
|
-
|
275
|
-
],
|
290
|
+
o()
|
291
|
+
], s.prototype, "name", 2);
|
276
292
|
l([
|
277
|
-
|
278
|
-
],
|
293
|
+
o({ attribute: "required-label" })
|
294
|
+
], s.prototype, "requiredLabel", 2);
|
279
295
|
l([
|
280
|
-
|
281
|
-
],
|
296
|
+
o()
|
297
|
+
], s.prototype, "severity", 2);
|
282
298
|
l([
|
283
|
-
|
284
|
-
],
|
299
|
+
o({ type: Boolean, attribute: "show-valid" })
|
300
|
+
], s.prototype, "showValid", 2);
|
285
301
|
l([
|
286
|
-
|
287
|
-
],
|
302
|
+
o({ reflect: !0 })
|
303
|
+
], s.prototype, "size", 2);
|
288
304
|
l([
|
289
305
|
d()
|
290
|
-
],
|
306
|
+
], s.prototype, "value", 1);
|
291
307
|
l([
|
292
308
|
d()
|
293
|
-
],
|
309
|
+
], s.prototype, "selectedOptions", 1);
|
294
310
|
l([
|
295
311
|
d()
|
296
|
-
],
|
312
|
+
], s.prototype, "_expanded", 2);
|
297
313
|
l([
|
298
314
|
d()
|
299
|
-
],
|
315
|
+
], s.prototype, "_invalid", 2);
|
300
316
|
l([
|
301
317
|
p("#select-button")
|
302
|
-
],
|
318
|
+
], s.prototype, "$selectBtn", 2);
|
303
319
|
l([
|
304
320
|
p("#selected-value")
|
305
|
-
],
|
321
|
+
], s.prototype, "$selectedValue", 2);
|
306
322
|
l([
|
307
323
|
p("#select-dropdown")
|
308
|
-
],
|
324
|
+
], s.prototype, "$dropdown", 2);
|
309
325
|
export {
|
310
|
-
|
326
|
+
s as SkfSelect
|
311
327
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { SkfSelectOption } from '
|
1
|
+
import type { SkfSelectOption } from '../select-option/select-option.component.js';
|
2
2
|
import type { ReactiveController } from 'lit';
|
3
3
|
import type { SkfSelect } from './select.component.js';
|
4
4
|
type ControllerHost = SkfSelect;
|
@@ -146,11 +146,14 @@ class _ {
|
|
146
146
|
}
|
147
147
|
_badAttributeCombinationWarning() {
|
148
148
|
r({
|
149
|
-
assert: (this.host.min ?? 0)
|
149
|
+
assert: (this.host.min ?? 0) <= (this.host.max ?? 1 / 0),
|
150
150
|
reason: "attribute-mismatch",
|
151
151
|
replaceStrings: [this.host.localName, "min", "smaller than max"]
|
152
152
|
}), r({
|
153
|
-
assert: (
|
153
|
+
assert: (
|
154
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
155
|
+
(this.host.min || this.host.max) && this.host.multiple || !(this.host.min && this.host.max)
|
156
|
+
),
|
154
157
|
reason: "attribute-mismatch",
|
155
158
|
replaceStrings: [this.host.localName, "min or max", "together with multiple"]
|
156
159
|
}), r({
|
@@ -1,19 +1,23 @@
|
|
1
1
|
import { visuallyHidden as r } from "../../styles/util.styles.js";
|
2
|
-
import { css as
|
2
|
+
import { css as o } from "lit";
|
3
3
|
const t = [
|
4
4
|
r,
|
5
|
-
|
5
|
+
o`
|
6
6
|
@layer components {
|
7
7
|
:host {
|
8
8
|
contain: initial;
|
9
9
|
}
|
10
10
|
|
11
|
-
#
|
11
|
+
#root {
|
12
12
|
color: var(--_skf-select-color, var(--skf-text-color-primary));
|
13
13
|
display: flex;
|
14
14
|
flex-direction: column;
|
15
15
|
gap: var(--skf-spacing-25);
|
16
16
|
|
17
|
+
:host([disabled]) & {
|
18
|
+
--_skf-select-color: var(--skf-interactive-text-color-disabled);
|
19
|
+
}
|
20
|
+
|
17
21
|
:host([size='sm']) & {
|
18
22
|
font-size: var(--skf-font-size-75);
|
19
23
|
font-weight: var(--skf-font-weight-medium);
|
@@ -96,6 +100,16 @@ const t = [
|
|
96
100
|
}
|
97
101
|
}
|
98
102
|
|
103
|
+
skf-icon {
|
104
|
+
transform: var(--_skf-select-icon-transform, rotateX(0deg));
|
105
|
+
transform-origin: center;
|
106
|
+
transition: transform calc(var(--skf-motion-duration-normal) * 1ms) ease-out;
|
107
|
+
|
108
|
+
[aria-expanded='true'] & {
|
109
|
+
--_skf-select-icon-transform: rotateX(180deg);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
99
113
|
#select-dropdown {
|
100
114
|
background-color: var(--skf-bg-color-neutral-1);
|
101
115
|
border: var(--skf-border-width-sm) solid var(--skf-border-color-tertiary);
|
@@ -106,6 +120,7 @@ const t = [
|
|
106
120
|
|
107
121
|
#tags {
|
108
122
|
display: flex;
|
123
|
+
flex-wrap: wrap;
|
109
124
|
gap: 0.5rem;
|
110
125
|
}
|
111
126
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { SkfElement } from '
|
2
|
-
import type {
|
1
|
+
import { SkfElement } from '../../internal/components/skf-element.js';
|
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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { SkfSelectOption } from '
|
1
|
+
import type { SkfSelectOption } from '../select-option/select-option.component.js';
|
2
2
|
import type { ReactiveController } from 'lit';
|
3
3
|
type ControllerHost = SkfSelectOption;
|
4
4
|
export declare class DeveloperFeedbackController implements ReactiveController {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { FormBase } from '
|
2
|
-
import type { FormFieldBaseProps } from '
|
1
|
+
import { FormBase } from '../../internal/components/formBase.js';
|
2
|
+
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
3
3
|
import { type CSSResultGroup } from 'lit';
|
4
4
|
/**
|
5
5
|
* The `<skf-switch>` is a component that displays a list of actions or options
|
@@ -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;
|
@@ -3,9 +3,10 @@ import { Asterisk as u } from "../../internal/templates/asterisk.js";
|
|
3
3
|
import p from "../../styles/component.styles.js";
|
4
4
|
import { html as c } from "lit";
|
5
5
|
import { property as s, state as v, query as f } from "lit/decorators.js";
|
6
|
-
import {
|
6
|
+
import { classMap as m } from "lit/directives/class-map.js";
|
7
|
+
import { ifDefined as _ } from "lit/directives/if-defined.js";
|
7
8
|
import { styles as b } from "./switch.styles.js";
|
8
|
-
var y = Object.defineProperty, i = (d, e, a,
|
9
|
+
var y = Object.defineProperty, i = (d, e, a, g) => {
|
9
10
|
for (var l = void 0, r = d.length - 1, n; r >= 0; r--)
|
10
11
|
(n = d[r]) && (l = n(e, a, l) || l);
|
11
12
|
return l && y(e, a, l), l;
|
@@ -41,14 +42,22 @@ const h = class h extends o {
|
|
41
42
|
var e;
|
42
43
|
if (this._invalid = !1, this.required && !this.checked) {
|
43
44
|
this.pristine || (this._invalid = !0);
|
44
|
-
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
45
|
+
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
46
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
47
|
+
((e = this.$input) == null ? void 0 : e.validationMessage) || "Please check this box if you want to proceed"
|
48
|
+
);
|
45
49
|
this.setValidity({ valueMissing: !0 }, String(a));
|
46
50
|
} else
|
47
51
|
this.setValidity({});
|
48
52
|
}
|
49
53
|
render() {
|
50
54
|
return c`
|
51
|
-
<label
|
55
|
+
<label
|
56
|
+
class=${m({
|
57
|
+
switch: !0,
|
58
|
+
"switch--small": this.size === "sm"
|
59
|
+
})}
|
60
|
+
>
|
52
61
|
<input
|
53
62
|
?checked=${this.checked}
|
54
63
|
?disabled=${this.disabled}
|
@@ -57,13 +66,14 @@ const h = class h extends o {
|
|
57
66
|
@invalid=${this._handleInvalid}
|
58
67
|
@reset=${this._resetValue}
|
59
68
|
aria-invalid=${!!this._invalid}
|
60
|
-
|
69
|
+
class="switch__input"
|
70
|
+
name=${_(this.name)}
|
61
71
|
type="checkbox"
|
62
72
|
value=${this.value}
|
63
73
|
/>
|
64
|
-
<div
|
74
|
+
<div class="switch__label">
|
65
75
|
<slot>${this.label}</slot>
|
66
|
-
${this.required ? u(this.requiredLabel) : null}
|
76
|
+
${this.required ? u(this.requiredLabel, "switch__asterisk") : null}
|
67
77
|
</div>
|
68
78
|
</label>
|
69
79
|
`;
|