@skf-design-system/ui-components 1.0.2-beta.6 → 1.0.2-beta.9
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 +18 -0
- package/dist/components/alert/alert.component.d.ts +3 -2
- package/dist/components/alert/alert.component.js +39 -33
- package/dist/components/button/button.styles.js +3 -3
- package/dist/components/checkbox/checkbox.component.d.ts +6 -5
- package/dist/components/checkbox/checkbox.component.js +77 -76
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/datepicker/datepicker-calendar.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-calendar.component.js +134 -127
- package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-popup.component.js +100 -88
- package/dist/components/datepicker/datepicker.component.d.ts +4 -2
- package/dist/components/datepicker/datepicker.component.js +150 -140
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +39 -37
- package/dist/components/divider/divider.component.js +13 -13
- package/dist/components/divider/divider.styles.js +2 -2
- package/dist/components/drawer/drawer.component.d.ts +3 -2
- package/dist/components/drawer/drawer.component.js +37 -35
- package/dist/components/drawer/drawer.styles.js +1 -1
- package/dist/components/header/header.component.d.ts +4 -2
- package/dist/components/header/header.component.js +66 -57
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/icon/icon.component.js +26 -16
- package/dist/components/icon/icon.styles.js +4 -4
- package/dist/components/input/input.component.d.ts +4 -8
- package/dist/components/input/input.component.js +146 -147
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +12 -12
- package/dist/components/link/link.component.js +19 -12
- package/dist/components/link/link.styles.js +11 -3
- package/dist/components/loader/loader.component.d.ts +0 -2
- package/dist/components/loader/loader.component.js +27 -30
- package/dist/components/loader/loader.styles.js +1 -1
- package/dist/components/menu/menu-item.styles.js +8 -7
- package/dist/components/menu/menu.component.d.ts +4 -1
- package/dist/components/nav/nav.component.d.ts +3 -0
- package/dist/components/nav/nav.component.js +38 -33
- package/dist/components/popover/popover.component.d.ts +6 -3
- package/dist/components/progress/progress.styles.js +3 -3
- package/dist/components/radio/radio.component.d.ts +4 -2
- package/dist/components/radio/radio.component.js +91 -83
- package/dist/components/radio/radio.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
- package/dist/components/select/select-option.component.d.ts +2 -2
- package/dist/components/select/select-option.component.js +16 -19
- package/dist/components/select/select.component.d.ts +13 -9
- package/dist/components/select/select.component.js +169 -144
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -56
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/tabs/tab.styles.js +2 -2
- package/dist/components/tag/tag.component.d.ts +3 -0
- package/dist/components/tag/tag.component.js +50 -41
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +126 -118
- package/dist/components/tooltip/tooltip.component.d.ts +8 -2
- package/dist/components/tooltip/tooltip.component.js +3 -0
- package/dist/custom-elements.json +734 -372
- package/dist/internal/base-classes/popover/popover.base.d.ts +21 -2
- package/dist/internal/base-classes/popover/popover.base.js +10 -12
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -19
- package/dist/internal/controllers/popover.controller.d.ts +2 -0
- package/dist/internal/helpers/uuid.d.ts +8 -10
- package/dist/internal/helpers/uuid.js +4 -11
- package/dist/internal/helpers/watch.d.ts +1 -1
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +4 -4
- package/dist/styles/global-alt.css +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +27 -0
- package/dist/translations/es.d.ts +3 -0
- package/dist/translations/es.js +27 -0
- package/dist/translations/index.d.ts +4 -0
- package/dist/translations/pt.d.ts +3 -0
- package/dist/translations/pt.js +27 -0
- package/dist/translations/sv.d.ts +3 -0
- package/dist/translations/sv.js +27 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +1823 -846
- package/dist/types/vue/index.d.ts +59 -47
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +75 -80
- package/dist/web-types.json +205 -169
- package/package.json +27 -34
- package/custom-elements.json +0 -25490
@@ -1,30 +1,38 @@
|
|
1
|
-
|
1
|
+
var _ = (l) => {
|
2
|
+
throw TypeError(l);
|
3
|
+
};
|
4
|
+
var v = (l, r, t) => r.has(l) || _("Cannot " + t);
|
5
|
+
var c = (l, r, t) => (v(l, r, "read from private field"), t ? t.call(l) : r.get(l)), g = (l, r, t) => r.has(l) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(l) : r.set(l, t), y = (l, r, t, e) => (v(l, r, "write to private field"), e ? e.call(l, t) : r.set(l, t), t);
|
6
|
+
import { SkfSelectOptionGroup as w } from "./select-option-group.component.js";
|
2
7
|
import "../tag/tag.js";
|
3
|
-
import { computePosition as
|
4
|
-
import { FormBase as
|
8
|
+
import { computePosition as x, flip as C, shift as V, offset as $ } from "@floating-ui/dom";
|
9
|
+
import { FormBase as L } from "../../internal/components/formBase.js";
|
5
10
|
import "../../internal/components/hint/hint.js";
|
6
|
-
import { PopoverController as
|
7
|
-
import { findMatchingTags as
|
8
|
-
import { hintSeverity as
|
9
|
-
import { raiseError as
|
10
|
-
import { watch as
|
11
|
-
import { Asterisk as
|
12
|
-
import { componentStyles as
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
import {
|
19
|
-
import {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
11
|
+
import { PopoverController as E } from "../../internal/controllers/popover.controller.js";
|
12
|
+
import { findMatchingTags as k } from "../../internal/helpers/findMatchingTags.js";
|
13
|
+
import { hintSeverity as A } from "../../internal/helpers/hintSeverity.js";
|
14
|
+
import { raiseError as D } from "../../internal/helpers/raiseError.js";
|
15
|
+
import { watch as S } from "../../internal/helpers/watch.js";
|
16
|
+
import { Asterisk as I } from "../../internal/templates/asterisk.js";
|
17
|
+
import { componentStyles as P } from "../../styles/component.styles.js";
|
18
|
+
import { LocalizeController as T } from "../../utilities/localize.js";
|
19
|
+
import { nothing as b, html as p } from "lit";
|
20
|
+
import { property as a, state as u, query as m, queryAssignedElements as F } from "lit/decorators.js";
|
21
|
+
import { classMap as U } from "lit/directives/class-map.js";
|
22
|
+
import { ifDefined as O } from "lit/directives/if-defined.js";
|
23
|
+
import { SkfSelectOption as z } from "./select-option.component.js";
|
24
|
+
import { GlobalClickController as M, KeyboardNavigationController as q, DeveloperFeedbackController as j } from "./select.controllers.js";
|
25
|
+
import { styles as N } from "./select.styles.js";
|
26
|
+
var B = Object.defineProperty, R = Object.getOwnPropertyDescriptor, o = (l, r, t, e) => {
|
27
|
+
for (var i = e > 1 ? void 0 : e ? R(r, t) : r, d = l.length - 1, n; d >= 0; d--)
|
28
|
+
(n = l[d]) && (i = (e ? n(r, t, i) : n(i)) || i);
|
29
|
+
return e && i && B(r, t, i), i;
|
30
|
+
}, h;
|
31
|
+
const f = class f extends L {
|
26
32
|
constructor() {
|
27
|
-
super()
|
33
|
+
super();
|
34
|
+
g(this, h);
|
35
|
+
y(this, h, new T(this)), this._componentIsConnected = !1, this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.hideLabel = !1, this.hideTags = !1, this.lang = "en", this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new M(this), this.keyboardNavController = new q(this), this.developerFeedbackController = new j(this), this.popoverController = new E(this), this._handleOptionSelected = (t) => {
|
28
36
|
this._pristine = !1;
|
29
37
|
const e = this._selectedOptions.length > 0;
|
30
38
|
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
@@ -35,9 +43,9 @@ const c = class c extends O {
|
|
35
43
|
this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
36
44
|
}, 50);
|
37
45
|
}, this.reposition = async () => {
|
38
|
-
const { x: t, y: e } = await
|
46
|
+
const { x: t, y: e } = await x(this.$anchor, this.$popover, {
|
39
47
|
placement: "bottom",
|
40
|
-
middleware: [
|
48
|
+
middleware: [C(), V(), $(2)],
|
41
49
|
strategy: "fixed"
|
42
50
|
});
|
43
51
|
Object.assign(this.$popover.style, {
|
@@ -61,19 +69,36 @@ const c = class c extends O {
|
|
61
69
|
default:
|
62
70
|
throw new Error("Something went wrong");
|
63
71
|
}
|
64
|
-
this.emitEvent("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
|
72
|
+
this._componentIsConnected && this.emitEvent("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
|
65
73
|
this.multiple || (this._expanded = !1), t("done");
|
66
74
|
});
|
67
75
|
}), this._resetSelectedOptions = (t) => {
|
68
76
|
const e = !t;
|
69
|
-
this._optionsList.forEach((
|
70
|
-
(e ||
|
71
|
-
});
|
77
|
+
this._optionsList.forEach((i) => {
|
78
|
+
(e || i !== t) && i.removeAttribute("selected");
|
79
|
+
}), this._optionsList = [];
|
72
80
|
}, this._handleSlotChange = () => {
|
73
|
-
this._handleSizeUpdate(), this._collectSlotOptionTags(), this._validateInput();
|
81
|
+
this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0;
|
82
|
+
}, this._ifValueIsSetSelectOption = () => {
|
83
|
+
if (this.value)
|
84
|
+
if (this.multiple) {
|
85
|
+
const t = String(this.value).split(",").map((e) => e.toLowerCase().trim());
|
86
|
+
this._optionsList.forEach((e) => {
|
87
|
+
t.includes(e.value.toLowerCase().trim()) ? (e.setSelectedDiscrete = !0, this.selectedOptions = [...this.selectedOptions, e]) : (e.setSelectedDiscrete = !1, this._selectedOptions = this._selectedOptions.filter(
|
88
|
+
(i) => i.value.toLowerCase().trim() !== e.value.toLowerCase().trim()
|
89
|
+
));
|
90
|
+
}), this._setValue().catch((e) => {
|
91
|
+
console.error(e);
|
92
|
+
});
|
93
|
+
} else {
|
94
|
+
const t = this.value.toLowerCase().trim(), e = this._optionsList.find((i) => i.value.toLowerCase().trim() === t);
|
95
|
+
e && (e.setSelectedDiscrete = !0, this.selectedOptions = [e], this._setValue().catch((i) => {
|
96
|
+
console.error(i);
|
97
|
+
}));
|
98
|
+
}
|
74
99
|
}, this._computeVisibleValue = () => {
|
75
100
|
var t, e;
|
76
|
-
return (t = this.$selectedValue) == null || t.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${
|
101
|
+
return (t = this.$selectedValue) == null || t.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${c(this, h).term("itemsSelected", this._selectedOptions.length)})` : this.value ? ((e = this.$selectedValue) == null || e.classList.remove("contains-meta-info"), this._selectedOptions[0].textContent) : this.buttonLabel;
|
77
102
|
}, this._selectedOptions = [];
|
78
103
|
}
|
79
104
|
set selectedValues(t) {
|
@@ -92,11 +117,11 @@ const c = class c extends O {
|
|
92
117
|
}
|
93
118
|
set value(t) {
|
94
119
|
let e = [];
|
95
|
-
this.multiple ? e = t.split(",").map((
|
96
|
-
(
|
97
|
-
), this._optionsList.forEach((
|
98
|
-
|
99
|
-
}), this._selectedOptions.forEach((
|
120
|
+
this.multiple ? e = String(t).split(",").map((i) => i.toLowerCase().trim()) : e = [String(t).toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
|
121
|
+
(i) => e.includes(i.value.toLowerCase().trim())
|
122
|
+
), this._optionsList.forEach((i) => {
|
123
|
+
i.selected && (i.setSelectedDiscrete = !1);
|
124
|
+
}), this._selectedOptions.forEach((i) => i.setSelectedDiscrete = !0), this._setValue();
|
100
125
|
}
|
101
126
|
get value() {
|
102
127
|
return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
|
@@ -131,7 +156,7 @@ const c = class c extends O {
|
|
131
156
|
}
|
132
157
|
_handleSizeUpdate() {
|
133
158
|
this._slottedItems.forEach((t) => {
|
134
|
-
(t instanceof
|
159
|
+
(t instanceof z || t instanceof w) && (t.small = this.size === "sm");
|
135
160
|
});
|
136
161
|
}
|
137
162
|
handleExpandedChange() {
|
@@ -139,11 +164,11 @@ const c = class c extends O {
|
|
139
164
|
console.error(t);
|
140
165
|
})), this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
|
141
166
|
}
|
142
|
-
attributeChangedCallback(t, e,
|
143
|
-
if (super.attributeChangedCallback(t, e,
|
144
|
-
if (typeof
|
145
|
-
const
|
146
|
-
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 },
|
167
|
+
attributeChangedCallback(t, e, i) {
|
168
|
+
if (super.attributeChangedCallback(t, e, i), t === "custom-invalid")
|
169
|
+
if (typeof i == "string") {
|
170
|
+
const n = this.withFallback(i);
|
171
|
+
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, n), this.checkValidity();
|
147
172
|
} else
|
148
173
|
this.setValidity({}), this._validateInput();
|
149
174
|
}
|
@@ -158,8 +183,8 @@ const c = class c extends O {
|
|
158
183
|
e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
|
159
184
|
});
|
160
185
|
else {
|
161
|
-
const e = this._selectedOptions.length > 0,
|
162
|
-
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []),
|
186
|
+
const e = this._selectedOptions.length > 0, i = t.detail.value !== null;
|
187
|
+
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), i && (this.selectedOptions = [t.target]);
|
163
188
|
}
|
164
189
|
this._setValue();
|
165
190
|
}
|
@@ -170,7 +195,7 @@ const c = class c extends O {
|
|
170
195
|
/** @internal */
|
171
196
|
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
172
197
|
_collectSlotOptionTags() {
|
173
|
-
this._optionsList =
|
198
|
+
this._optionsList = k(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), D({
|
174
199
|
assert: this._optionsList.length > 0,
|
175
200
|
reason: "no-children",
|
176
201
|
replaceStrings: [this.localName, "skf-select-option"]
|
@@ -179,29 +204,29 @@ const c = class c extends O {
|
|
179
204
|
/** @internal */
|
180
205
|
_validateInput() {
|
181
206
|
this._invalid = !1;
|
182
|
-
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min),
|
207
|
+
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);
|
183
208
|
if (this._internals.validity.customError) {
|
184
209
|
this._invalid = !0;
|
185
210
|
return;
|
186
211
|
} else if (t) {
|
187
|
-
const
|
188
|
-
this.setValidity({ valueMissing: !0 }, String(
|
212
|
+
const n = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
|
213
|
+
this.setValidity({ valueMissing: !0 }, String(n)), this._pristine || (this._invalid = !0);
|
189
214
|
} else if (e) {
|
190
|
-
const
|
191
|
-
this.setValidity({ rangeUnderflow: !0 }, String(
|
192
|
-
} else if (
|
193
|
-
const
|
194
|
-
this.setValidity({ rangeOverflow: !0 }, String(
|
215
|
+
const n = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
|
216
|
+
this.setValidity({ rangeUnderflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
|
217
|
+
} else if (i) {
|
218
|
+
const n = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
|
219
|
+
this.setValidity({ rangeOverflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
|
195
220
|
} else
|
196
221
|
this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
|
197
222
|
}
|
198
223
|
render() {
|
199
|
-
return
|
224
|
+
return p`
|
200
225
|
<div id="root">
|
201
226
|
<label>
|
202
227
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
203
228
|
${this.label}
|
204
|
-
${this.required ?
|
229
|
+
${this.required ? I(c(this, h).term("required")) : b}
|
205
230
|
</div>
|
206
231
|
<button
|
207
232
|
?disabled=${this.disabled}
|
@@ -215,19 +240,19 @@ const c = class c extends O {
|
|
215
240
|
>
|
216
241
|
<span
|
217
242
|
id="selected-value"
|
218
|
-
class=${
|
243
|
+
class=${U({ "selected-value": !0, "contains-meta-info": !this.value })}>
|
219
244
|
${this._computeVisibleValue()}
|
220
245
|
</span>
|
221
246
|
<skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
|
222
247
|
</button>
|
223
248
|
</label>
|
224
|
-
<div aria-multiselectable=${
|
249
|
+
<div aria-multiselectable=${O(this.multiple && !0)} id="select-dropdown" popover role="listbox">
|
225
250
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
226
251
|
</div>
|
227
|
-
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ?
|
252
|
+
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? p`
|
228
253
|
<div id="tags">
|
229
254
|
${this.selectedOptions.map(
|
230
|
-
(t) =>
|
255
|
+
(t) => p`
|
231
256
|
<skf-tag
|
232
257
|
style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
233
258
|
removable
|
@@ -240,13 +265,13 @@ const c = class c extends O {
|
|
240
265
|
`
|
241
266
|
)}
|
242
267
|
</div>
|
243
|
-
` :
|
244
|
-
${this.hint &&
|
268
|
+
` : b}
|
269
|
+
${this.hint && p`
|
245
270
|
<skf-hint
|
246
271
|
?disabled=${this.disabled}
|
247
272
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
248
273
|
id="hint"
|
249
|
-
severity=${
|
274
|
+
severity=${O(A(this._invalid, this.severity))}
|
250
275
|
>
|
251
276
|
${this.customInvalid ?? this.hint}
|
252
277
|
</skf-hint>
|
@@ -256,86 +281,86 @@ const c = class c extends O {
|
|
256
281
|
`;
|
257
282
|
}
|
258
283
|
};
|
259
|
-
|
260
|
-
let
|
261
|
-
|
262
|
-
|
263
|
-
],
|
264
|
-
|
265
|
-
|
266
|
-
],
|
267
|
-
|
268
|
-
|
269
|
-
],
|
270
|
-
|
271
|
-
|
272
|
-
],
|
273
|
-
|
274
|
-
|
275
|
-
],
|
276
|
-
|
277
|
-
|
278
|
-
],
|
279
|
-
|
280
|
-
|
281
|
-
],
|
282
|
-
|
283
|
-
|
284
|
-
],
|
285
|
-
|
286
|
-
|
287
|
-
],
|
288
|
-
|
289
|
-
|
290
|
-
],
|
291
|
-
|
292
|
-
|
293
|
-
],
|
294
|
-
|
295
|
-
|
296
|
-
],
|
297
|
-
|
298
|
-
|
299
|
-
],
|
300
|
-
|
301
|
-
|
302
|
-
],
|
303
|
-
|
304
|
-
|
305
|
-
],
|
306
|
-
|
307
|
-
|
308
|
-
],
|
309
|
-
|
310
|
-
|
311
|
-
],
|
312
|
-
|
313
|
-
|
314
|
-
],
|
315
|
-
|
316
|
-
|
317
|
-
],
|
318
|
-
|
319
|
-
|
320
|
-
],
|
321
|
-
|
322
|
-
|
323
|
-
],
|
324
|
-
|
325
|
-
|
326
|
-
],
|
327
|
-
|
328
|
-
|
329
|
-
],
|
330
|
-
|
331
|
-
|
332
|
-
],
|
333
|
-
|
334
|
-
|
335
|
-
],
|
336
|
-
|
337
|
-
|
338
|
-
],
|
284
|
+
h = new WeakMap(), f.styles = [P, N];
|
285
|
+
let s = f;
|
286
|
+
o([
|
287
|
+
a({ type: String, reflect: !0, attribute: "button-label" })
|
288
|
+
], s.prototype, "buttonLabel", 2);
|
289
|
+
o([
|
290
|
+
a({ type: String, attribute: "custom-invalid" })
|
291
|
+
], s.prototype, "customInvalid", 2);
|
292
|
+
o([
|
293
|
+
a({ type: Boolean, attribute: "hide-label" })
|
294
|
+
], s.prototype, "hideLabel", 2);
|
295
|
+
o([
|
296
|
+
a({ type: Boolean, reflect: !0, attribute: "hide-tags" })
|
297
|
+
], s.prototype, "hideTags", 2);
|
298
|
+
o([
|
299
|
+
a({ type: String })
|
300
|
+
], s.prototype, "hint", 2);
|
301
|
+
o([
|
302
|
+
a({ type: Array, attribute: !1 })
|
303
|
+
], s.prototype, "selectedValues", 1);
|
304
|
+
o([
|
305
|
+
a({ type: Array, attribute: !1 })
|
306
|
+
], s.prototype, "selectedOptionsText", 1);
|
307
|
+
o([
|
308
|
+
a({ type: String, reflect: !0 })
|
309
|
+
], s.prototype, "label", 2);
|
310
|
+
o([
|
311
|
+
a({ type: String })
|
312
|
+
], s.prototype, "lang", 2);
|
313
|
+
o([
|
314
|
+
a({ type: Number })
|
315
|
+
], s.prototype, "max", 2);
|
316
|
+
o([
|
317
|
+
a({ type: Number })
|
318
|
+
], s.prototype, "min", 2);
|
319
|
+
o([
|
320
|
+
a({ type: Boolean, reflect: !0 })
|
321
|
+
], s.prototype, "multiple", 2);
|
322
|
+
o([
|
323
|
+
a({ type: String })
|
324
|
+
], s.prototype, "name", 2);
|
325
|
+
o([
|
326
|
+
a()
|
327
|
+
], s.prototype, "severity", 2);
|
328
|
+
o([
|
329
|
+
a({ type: Boolean, attribute: "show-valid" })
|
330
|
+
], s.prototype, "showValid", 2);
|
331
|
+
o([
|
332
|
+
a({ reflect: !0 })
|
333
|
+
], s.prototype, "size", 2);
|
334
|
+
o([
|
335
|
+
a({ type: String, attribute: !1 })
|
336
|
+
], s.prototype, "value", 1);
|
337
|
+
o([
|
338
|
+
u()
|
339
|
+
], s.prototype, "selectedOptions", 1);
|
340
|
+
o([
|
341
|
+
u()
|
342
|
+
], s.prototype, "_expanded", 2);
|
343
|
+
o([
|
344
|
+
u()
|
345
|
+
], s.prototype, "_invalid", 2);
|
346
|
+
o([
|
347
|
+
m("#select-button")
|
348
|
+
], s.prototype, "$anchor", 2);
|
349
|
+
o([
|
350
|
+
m("#selected-value")
|
351
|
+
], s.prototype, "$selectedValue", 2);
|
352
|
+
o([
|
353
|
+
m("#select-dropdown")
|
354
|
+
], s.prototype, "$popover", 2);
|
355
|
+
o([
|
356
|
+
F()
|
357
|
+
], s.prototype, "_slottedItems", 2);
|
358
|
+
o([
|
359
|
+
S("size", { waitUntilFirstUpdate: !0 })
|
360
|
+
], s.prototype, "_handleSizeUpdate", 1);
|
361
|
+
o([
|
362
|
+
S("_expanded", { afterUpdate: !0 })
|
363
|
+
], s.prototype, "handleExpandedChange", 1);
|
339
364
|
export {
|
340
|
-
|
365
|
+
s as SkfSelect
|
341
366
|
};
|
@@ -50,7 +50,7 @@ const s = e`
|
|
50
50
|
}
|
51
51
|
|
52
52
|
:is(.stepper-item--active, .stepper-item--completed) {
|
53
|
-
--_skf-stepper-color: var(--skf-text-color-
|
53
|
+
--_skf-stepper-color: var(--skf-text-color-emphasized);
|
54
54
|
}
|
55
55
|
|
56
56
|
.stepper-item--enabled {
|
@@ -70,17 +70,17 @@ const s = e`
|
|
70
70
|
user-select: none;
|
71
71
|
|
72
72
|
:is(.stepper-item--active, .stepper-item--active-completed, .stepper-item--completed) & {
|
73
|
-
--_skf-stepper-circle-border-color: var(--skf-border-color-
|
73
|
+
--_skf-stepper-circle-border-color: var(--skf-border-color-emphasized);
|
74
74
|
}
|
75
75
|
|
76
76
|
:is(.stepper-item--active, .stepper-item--active-completed) & {
|
77
77
|
--_skf-stepper-circle-color: var(--skf-text-color-inverse);
|
78
|
-
--_skf-stepper-circle-bg-color: var(--skf-bg-color-
|
78
|
+
--_skf-stepper-circle-bg-color: var(--skf-bg-color-emphasized);
|
79
79
|
}
|
80
80
|
|
81
81
|
.stepper-item--enabled & {
|
82
82
|
--_skf-stepper-circle-border-color: #6292e4; /* Missing token */
|
83
|
-
--_skf-stepper-circle-color: var(--skf-text-color-
|
83
|
+
--_skf-stepper-circle-color: var(--skf-text-color-emphasized);
|
84
84
|
}
|
85
85
|
}
|
86
86
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { FormBase } from '../../internal/components/formBase.js';
|
2
2
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
3
|
+
import { type Language } from '../../utilities/localize.js';
|
3
4
|
import { type CSSResultGroup } from 'lit';
|
4
5
|
/**
|
5
6
|
* The `<skf-switch>` is a component that displays a list of actions or options
|
@@ -14,6 +15,7 @@ import { type CSSResultGroup } from 'lit';
|
|
14
15
|
* @tagname skf-switch
|
15
16
|
*/
|
16
17
|
export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
|
18
|
+
#private;
|
17
19
|
static styles: CSSResultGroup;
|
18
20
|
/** @internal */
|
19
21
|
private _initialChecked;
|
@@ -25,10 +27,10 @@ export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
|
|
25
27
|
hideLabel: boolean;
|
26
28
|
/** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
|
27
29
|
label?: string;
|
30
|
+
/** Sets the internal language of the component */
|
31
|
+
lang: Language;
|
28
32
|
/** If defined, adds name to the input-element */
|
29
33
|
name?: string;
|
30
|
-
/** If defined, renders an alternative A11y text for the asterisk */
|
31
|
-
requiredLabel?: string;
|
32
34
|
/** Size of the Switch */
|
33
35
|
size: 'sm' | 'md';
|
34
36
|
/** The current value of the input field */
|
@@ -1,21 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { componentStyles as p } from "../../styles/component.styles.js";
|
4
|
-
import { nothing as c, html as v } from "lit";
|
5
|
-
import { property as s, state as f, query as m } from "lit/decorators.js";
|
6
|
-
import { classMap as _ } from "lit/directives/class-map.js";
|
7
|
-
import { ifDefined as b } from "lit/directives/if-defined.js";
|
8
|
-
import { styles as y } from "./switch.styles.js";
|
9
|
-
var g = Object.defineProperty, i = (d, e, a, k) => {
|
10
|
-
for (var l = void 0, h = d.length - 1, n; h >= 0; h--)
|
11
|
-
(n = d[h]) && (l = n(e, a, l) || l);
|
12
|
-
return l && g(e, a, l), l;
|
1
|
+
var p = (t) => {
|
2
|
+
throw TypeError(t);
|
13
3
|
};
|
14
|
-
|
4
|
+
var c = (t, i, e) => i.has(t) || p("Cannot " + e);
|
5
|
+
var v = (t, i, e) => (c(t, i, "read from private field"), e ? e.call(t) : i.get(t)), f = (t, i, e) => i.has(t) ? p("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), m = (t, i, e, l) => (c(t, i, "write to private field"), l ? l.call(t, e) : i.set(t, e), e);
|
6
|
+
import { FormBase as _ } from "../../internal/components/formBase.js";
|
7
|
+
import { Asterisk as y } from "../../internal/templates/asterisk.js";
|
8
|
+
import { componentStyles as b } from "../../styles/component.styles.js";
|
9
|
+
import { LocalizeController as g } from "../../utilities/localize.js";
|
10
|
+
import { nothing as k, html as $ } from "lit";
|
11
|
+
import { property as h, state as C, query as V } from "lit/decorators.js";
|
12
|
+
import { classMap as w } from "lit/directives/class-map.js";
|
13
|
+
import { ifDefined as q } from "lit/directives/if-defined.js";
|
14
|
+
import { styles as z } from "./switch.styles.js";
|
15
|
+
var A = Object.defineProperty, a = (t, i, e, l) => {
|
16
|
+
for (var r = void 0, d = t.length - 1, u; d >= 0; d--)
|
17
|
+
(u = t[d]) && (r = u(i, e, r) || r);
|
18
|
+
return r && A(i, e, r), r;
|
19
|
+
}, n;
|
20
|
+
const o = class o extends _ {
|
15
21
|
constructor() {
|
16
|
-
super(...arguments)
|
17
|
-
|
18
|
-
|
22
|
+
super(...arguments);
|
23
|
+
f(this, n);
|
24
|
+
m(this, n, new g(this)), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.hideLabel = !1, this.lang = "en", this.size = "md", this.value = "", this._invalid = !1, this._handleChange = (e) => {
|
25
|
+
var l;
|
26
|
+
e.stopPropagation(), this.pristine = !1, this.checked = ((l = this.$input) == null ? void 0 : l.checked) ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(null), this.emitEvent("change");
|
19
27
|
}, this._handleInvalid = (e) => {
|
20
28
|
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && e.preventDefault();
|
21
29
|
}, this._resetValue = (e) => {
|
@@ -42,18 +50,18 @@ const r = class r extends o {
|
|
42
50
|
var e;
|
43
51
|
if (this._invalid = !1, this.required && !this.checked) {
|
44
52
|
this.pristine || (this._invalid = !0);
|
45
|
-
const
|
53
|
+
const l = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
46
54
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
47
55
|
((e = this.$input) == null ? void 0 : e.validationMessage) || "Please check this box if you want to proceed"
|
48
56
|
);
|
49
|
-
this.setValidity({ valueMissing: !0 }, String(
|
57
|
+
this.setValidity({ valueMissing: !0 }, String(l));
|
50
58
|
} else
|
51
59
|
this.setValidity({});
|
52
60
|
}
|
53
61
|
render() {
|
54
|
-
return
|
62
|
+
return $`
|
55
63
|
<label
|
56
|
-
class=${
|
64
|
+
class=${w({
|
57
65
|
switch: !0,
|
58
66
|
"switch--small": this.size === "sm"
|
59
67
|
})}
|
@@ -67,50 +75,50 @@ const r = class r extends o {
|
|
67
75
|
@reset=${this._resetValue}
|
68
76
|
aria-invalid=${!!this._invalid}
|
69
77
|
class="switch__input"
|
70
|
-
name=${
|
78
|
+
name=${q(this.name)}
|
71
79
|
type="checkbox"
|
72
80
|
value=${this.value}
|
73
81
|
/>
|
74
|
-
<div class="switch__label ${this.hideLabel ? "visually-hidden" :
|
82
|
+
<div class="switch__label ${this.hideLabel ? "visually-hidden" : k}">
|
75
83
|
<slot>${this.label}</slot>
|
76
|
-
${this.required ?
|
84
|
+
${this.required ? y(v(this, n).term("required"), "switch__asterisk") : null}
|
77
85
|
</div>
|
78
86
|
</label>
|
79
87
|
`;
|
80
88
|
}
|
81
89
|
};
|
82
|
-
|
83
|
-
let
|
84
|
-
|
85
|
-
|
86
|
-
],
|
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
|
-
],
|
90
|
+
n = new WeakMap(), o.styles = [b, z];
|
91
|
+
let s = o;
|
92
|
+
a([
|
93
|
+
h({ type: Boolean })
|
94
|
+
], s.prototype, "debug");
|
95
|
+
a([
|
96
|
+
h({ type: Boolean, reflect: !0 })
|
97
|
+
], s.prototype, "checked");
|
98
|
+
a([
|
99
|
+
h({ type: Boolean, attribute: "hide-label", reflect: !0 })
|
100
|
+
], s.prototype, "hideLabel");
|
101
|
+
a([
|
102
|
+
h()
|
103
|
+
], s.prototype, "label");
|
104
|
+
a([
|
105
|
+
h({ type: String })
|
106
|
+
], s.prototype, "lang");
|
107
|
+
a([
|
108
|
+
h()
|
109
|
+
], s.prototype, "name");
|
110
|
+
a([
|
111
|
+
h({ reflect: !0 })
|
112
|
+
], s.prototype, "size");
|
113
|
+
a([
|
114
|
+
h()
|
115
|
+
], s.prototype, "value");
|
116
|
+
a([
|
117
|
+
C()
|
118
|
+
], s.prototype, "_invalid");
|
119
|
+
a([
|
120
|
+
V("input")
|
121
|
+
], s.prototype, "$input");
|
114
122
|
export {
|
115
|
-
|
123
|
+
s as SkfSwitch
|
116
124
|
};
|