@skf-design-system/ui-components 1.0.0-alpha.38 → 1.0.0-alpha.39
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/breadcrumb/breadcrumb-item.component.js +11 -12
- package/dist/components/button/button.component.js +32 -36
- 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 +67 -69
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/datepicker/datepicker-calendar.component.d.ts +1 -0
- package/dist/components/datepicker/datepicker-calendar.component.js +107 -116
- package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-popup.component.js +112 -100
- package/dist/components/datepicker/datepicker-popup.helpers.js +1 -1
- package/dist/components/datepicker/datepicker.component.d.ts +4 -2
- package/dist/components/datepicker/datepicker.component.js +159 -160
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +48 -48
- package/dist/components/divider/divider.component.d.ts +3 -0
- package/dist/components/divider/divider.component.js +43 -22
- package/dist/components/divider/divider.styles.js +9 -9
- package/dist/components/drawer/drawer.component.d.ts +12 -4
- package/dist/components/drawer/drawer.component.js +84 -61
- package/dist/components/drawer/drawer.styles.js +47 -40
- package/dist/components/header/header.component.d.ts +4 -2
- package/dist/components/header/header.component.js +64 -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 +11 -10
- package/dist/components/input/input.component.js +115 -111
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +14 -19
- package/dist/components/link/link.component.d.ts +1 -0
- package/dist/components/link/link.component.js +86 -74
- package/dist/components/link/link.styles.js +7 -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 +5 -2
- package/dist/components/menu/menu.component.js +7 -7
- 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 -7
- package/dist/components/popover/popover.component.js +23 -31
- 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 +96 -91
- 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/segmented-button/segmented-button.component.js +22 -24
- package/dist/components/select/select-option.component.d.ts +2 -1
- package/dist/components/select/select-option.component.js +31 -36
- package/dist/components/select/select.component.d.ts +20 -10
- package/dist/components/select/select.component.js +139 -104
- package/dist/components/select/select.controllers.js +14 -17
- package/dist/components/select/select.styles.js +8 -3
- package/dist/components/stepper/stepper-item.component.d.ts +1 -1
- package/dist/components/stepper/stepper-item.component.js +26 -23
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/stepper/stepper.component.js +2 -3
- package/dist/components/stepper/stepper.helpers.js +6 -7
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -58
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/tabs/tab-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +19 -16
- package/dist/components/tabs/tab.component.d.ts +1 -1
- package/dist/components/tabs/tab.component.js +17 -14
- package/dist/components/tabs/tab.styles.js +2 -2
- package/dist/components/tabs/tabs.component.js +6 -6
- package/dist/components/tag/tag.component.d.ts +9 -6
- package/dist/components/tag/tag.component.js +78 -72
- package/dist/components/tag/tag.styles.js +5 -0
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +101 -95
- package/dist/components/toast/toast-item.styles.js +13 -10
- package/dist/components/toast/toast.singleton.js +6 -7
- package/dist/components/tooltip/tooltip.component.d.ts +7 -4
- package/dist/components/tooltip/tooltip.component.js +22 -14
- package/dist/custom-elements.json +835 -422
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -20
- package/dist/internal/base-classes/popover/popover.base.d.ts +28 -8
- package/dist/internal/base-classes/popover/popover.base.js +78 -74
- 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/controllers/popover.controller.js +11 -14
- package/dist/internal/helpers/stateMap.js +3 -3
- 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/internal/types.d.ts +4 -0
- 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 +1840 -858
- package/dist/types/vue/index.d.ts +69 -64
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +75 -83
- package/dist/web-types.json +229 -190
- package/package.json +29 -35
- 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 u = (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), b = (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 I } from "../../internal/helpers/raiseError.js";
|
15
|
+
import { watch as S } from "../../internal/helpers/watch.js";
|
16
|
+
import { Asterisk as D } from "../../internal/templates/asterisk.js";
|
17
|
+
import { componentStyles as P } from "../../styles/component.styles.js";
|
18
|
+
import { LocalizeController as F } from "../../utilities/localize.js";
|
19
|
+
import { nothing as y, html as p } from "lit";
|
20
|
+
import { property as n, state as c, query as m, queryAssignedElements as T } from "lit/decorators.js";
|
21
|
+
import { classMap as z } from "lit/directives/class-map.js";
|
22
|
+
import { ifDefined as O } from "lit/directives/if-defined.js";
|
23
|
+
import { SkfSelectOption as U } from "./select-option.component.js";
|
24
|
+
import { GlobalClickController as M, KeyboardNavigationController as B, DeveloperFeedbackController as N } from "./select.controllers.js";
|
25
|
+
import { styles as H } from "./select.styles.js";
|
26
|
+
var q = Object.defineProperty, R = Object.getOwnPropertyDescriptor, s = (l, r, t, e) => {
|
27
|
+
for (var o = e > 1 ? void 0 : e ? R(r, t) : r, a = l.length - 1, h; a >= 0; a--)
|
28
|
+
(h = l[a]) && (o = (e ? h(r, t, o) : h(o)) || o);
|
29
|
+
return e && o && q(r, t, o), o;
|
30
|
+
}, d;
|
31
|
+
const f = class f extends L {
|
26
32
|
constructor() {
|
27
|
-
super()
|
33
|
+
super();
|
34
|
+
g(this, d);
|
35
|
+
b(this, d, new F(this)), this._componentIsConnected = !1, this._defaultButtonLabel = "Select an option", this.selectDelay = 200, this._optionsList = [], this.buttonLabel = this._defaultButtonLabel, 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 B(this), this.developerFeedbackController = new N(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,20 +69,34 @@ 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((o) => {
|
78
|
+
(e || o !== t) && o.removeAttribute("selected");
|
79
|
+
}), this._optionsList = [];
|
72
80
|
}, this._handleSlotChange = () => {
|
73
|
-
this._handleSizeUpdate(), this._collectSlotOptionTags(), this._validateInput();
|
74
|
-
}, this.
|
75
|
-
|
76
|
-
|
77
|
-
|
81
|
+
this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0, this.emitEvent("skf-select-connected");
|
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
|
+
(o) => o.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((o) => o.value.toLowerCase().trim() === t);
|
95
|
+
e && (e.setSelectedDiscrete = !0, this.selectedOptions = [e], this._setValue().catch((o) => {
|
96
|
+
console.error(o);
|
97
|
+
}));
|
98
|
+
}
|
99
|
+
}, this._computeVisibleValue = () => this.buttonLabel !== this._defaultButtonLabel ? this.buttonLabel : (this.$selectedValue?.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${u(this, d).term("itemsSelected", this._selectedOptions.length)})` : this.value ? (this.$selectedValue?.classList.remove("contains-meta-info"), this._selectedOptions[0].textContent) : (this.$selectedValue?.classList.add("contains-meta-info"), this.buttonLabel)), this._selectedOptions = [];
|
78
100
|
}
|
79
101
|
set selectedValues(t) {
|
80
102
|
this._selectedOptions = this._optionsList.filter((e) => t.includes(e.value.trim()));
|
@@ -92,11 +114,11 @@ const c = class c extends O {
|
|
92
114
|
}
|
93
115
|
set value(t) {
|
94
116
|
let e = [];
|
95
|
-
this.multiple ? e = t.split(",").map((
|
96
|
-
(
|
97
|
-
), this._optionsList.forEach((
|
98
|
-
|
99
|
-
}), this._selectedOptions.forEach((
|
117
|
+
this._componentIsConnected && (this.multiple ? e = String(t).split(",").map((a) => a.toLowerCase().trim()) : e = [String(t).toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
|
118
|
+
(a) => e.includes(a.value.toLowerCase().trim())
|
119
|
+
), this._optionsList.forEach((a) => {
|
120
|
+
a.selected && (a.setSelectedDiscrete = !1);
|
121
|
+
}), this._selectedOptions.forEach((a) => a.setSelectedDiscrete = !0)), this._setValue();
|
100
122
|
}
|
101
123
|
get value() {
|
102
124
|
return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
|
@@ -126,30 +148,36 @@ const c = class c extends O {
|
|
126
148
|
this.removeAttribute("invalid"), !this._pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = this.getAttribute("hint") ?? "";
|
127
149
|
}
|
128
150
|
firstUpdated() {
|
129
|
-
|
130
|
-
this.addEventListener("skf-select-option-select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
|
151
|
+
this.addEventListener("skf-select-option-select", this._handleOptionSelected), this._internals.form?.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
|
131
152
|
}
|
132
153
|
_handleSizeUpdate() {
|
133
154
|
this._slottedItems.forEach((t) => {
|
134
|
-
(t instanceof
|
155
|
+
(t instanceof U || t instanceof w) && (t.small = this.size === "sm");
|
135
156
|
});
|
136
157
|
}
|
137
|
-
|
158
|
+
_handleExpandedChange() {
|
138
159
|
this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
|
139
160
|
console.error(t);
|
140
|
-
})), this.
|
161
|
+
})), this.desiredPopupHeight = this._getOptionalDropdownHeight(
|
162
|
+
this._slottedItems[0]
|
163
|
+
), this.desiredPopupHeight ? this.$popover.style.height = `${this.desiredPopupHeight.toString()}px` : this.$popover.style.height = "", this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
|
141
164
|
}
|
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 },
|
165
|
+
attributeChangedCallback(t, e, o) {
|
166
|
+
if (super.attributeChangedCallback(t, e, o), t === "custom-invalid")
|
167
|
+
if (typeof o == "string") {
|
168
|
+
const h = this.withFallback(o);
|
169
|
+
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, h), this.checkValidity();
|
147
170
|
} else
|
148
171
|
this.setValidity({}), this._validateInput();
|
149
172
|
}
|
150
173
|
disconnectedCallback() {
|
151
|
-
|
152
|
-
|
174
|
+
super.disconnectedCallback(), this._internals.form?.removeEventListener("reset", this._handleReset);
|
175
|
+
}
|
176
|
+
/** @internal */
|
177
|
+
_getOptionalDropdownHeight(t) {
|
178
|
+
if (!this.maxVisibleItems) return;
|
179
|
+
const e = this._slottedItems.length;
|
180
|
+
return this.maxVisibleItems >= e ? void 0 : t.getBoundingClientRect().height * this.maxVisibleItems;
|
153
181
|
}
|
154
182
|
/** @internal */
|
155
183
|
_updateState(t) {
|
@@ -158,8 +186,8 @@ const c = class c extends O {
|
|
158
186
|
e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
|
159
187
|
});
|
160
188
|
else {
|
161
|
-
const e = this._selectedOptions.length > 0,
|
162
|
-
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []),
|
189
|
+
const e = this._selectedOptions.length > 0, o = t.detail.value !== null;
|
190
|
+
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), o && (this.selectedOptions = [t.target]);
|
163
191
|
}
|
164
192
|
this._setValue();
|
165
193
|
}
|
@@ -170,7 +198,7 @@ const c = class c extends O {
|
|
170
198
|
/** @internal */
|
171
199
|
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
172
200
|
_collectSlotOptionTags() {
|
173
|
-
this._optionsList =
|
201
|
+
this._optionsList = k(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), I({
|
174
202
|
assert: this._optionsList.length > 0,
|
175
203
|
reason: "no-children",
|
176
204
|
replaceStrings: [this.localName, "skf-select-option"]
|
@@ -179,55 +207,56 @@ const c = class c extends O {
|
|
179
207
|
/** @internal */
|
180
208
|
_validateInput() {
|
181
209
|
this._invalid = !1;
|
182
|
-
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min),
|
210
|
+
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), o = !!(this.max && this.selectedValues.length > this.max);
|
183
211
|
if (this._internals.validity.customError) {
|
184
212
|
this._invalid = !0;
|
185
213
|
return;
|
186
214
|
} else if (t) {
|
187
|
-
const
|
188
|
-
this.setValidity({ valueMissing: !0 }, String(
|
215
|
+
const h = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
|
216
|
+
this.setValidity({ valueMissing: !0 }, String(h)), this._pristine || (this._invalid = !0);
|
189
217
|
} else if (e) {
|
190
|
-
const
|
191
|
-
this.setValidity({ rangeUnderflow: !0 }, String(
|
192
|
-
} else if (
|
193
|
-
const
|
194
|
-
this.setValidity({ rangeOverflow: !0 }, String(
|
218
|
+
const h = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
|
219
|
+
this.setValidity({ rangeUnderflow: !0 }, String(h)), this._pristine || (this._invalid = !0);
|
220
|
+
} else if (o) {
|
221
|
+
const h = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
|
222
|
+
this.setValidity({ rangeOverflow: !0 }, String(h)), this._pristine || (this._invalid = !0);
|
195
223
|
} else
|
196
224
|
this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
|
197
225
|
}
|
198
226
|
render() {
|
199
|
-
return
|
227
|
+
return p`
|
200
228
|
<div id="root">
|
201
229
|
<label>
|
202
230
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
203
231
|
${this.label}
|
204
|
-
${this.required ?
|
232
|
+
${this.required ? D(u(this, d).term("required")) : y}
|
205
233
|
</div>
|
206
234
|
<button
|
207
235
|
?disabled=${this.disabled}
|
208
236
|
@click=${this._handleDropdownToggle}
|
209
237
|
aria-controls="select-dropdown"
|
210
238
|
aria-expanded=${this._expanded}
|
211
|
-
aria-invalid=${this._invalid}
|
212
239
|
aria-haspopup="listbox"
|
240
|
+
aria-invalid=${this._invalid}
|
241
|
+
aria-labelledby="label"
|
213
242
|
id="select-button"
|
214
243
|
role="combobox"
|
215
244
|
>
|
216
245
|
<span
|
217
246
|
id="selected-value"
|
218
|
-
class=${
|
247
|
+
class=${z({ "selected-value": !0, "contains-meta-info": !this.value })}>
|
219
248
|
${this._computeVisibleValue()}
|
220
249
|
</span>
|
221
250
|
<skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
|
222
251
|
</button>
|
223
252
|
</label>
|
224
|
-
<div aria-multiselectable=${
|
253
|
+
<div aria-labelledby="select-button" aria-multiselectable=${O(this.multiple && !0)} id="select-dropdown" popover role="listbox">
|
225
254
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
226
255
|
</div>
|
227
|
-
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ?
|
256
|
+
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? p`
|
228
257
|
<div id="tags">
|
229
258
|
${this.selectedOptions.map(
|
230
|
-
(t) =>
|
259
|
+
(t) => p`
|
231
260
|
<skf-tag
|
232
261
|
style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
233
262
|
removable
|
@@ -240,13 +269,13 @@ const c = class c extends O {
|
|
240
269
|
`
|
241
270
|
)}
|
242
271
|
</div>
|
243
|
-
` :
|
244
|
-
${this.hint &&
|
272
|
+
` : y}
|
273
|
+
${this.hint && p`
|
245
274
|
<skf-hint
|
246
275
|
?disabled=${this.disabled}
|
247
276
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
248
277
|
id="hint"
|
249
|
-
severity=${
|
278
|
+
severity=${O(A(this._invalid, this.severity))}
|
250
279
|
>
|
251
280
|
${this.customInvalid ?? this.hint}
|
252
281
|
</skf-hint>
|
@@ -256,86 +285,92 @@ const c = class c extends O {
|
|
256
285
|
`;
|
257
286
|
}
|
258
287
|
};
|
259
|
-
|
260
|
-
let i =
|
288
|
+
d = new WeakMap(), f.styles = [P, H];
|
289
|
+
let i = f;
|
261
290
|
s([
|
262
|
-
|
291
|
+
n({ type: String, reflect: !0, attribute: "button-label" })
|
263
292
|
], i.prototype, "buttonLabel", 2);
|
264
293
|
s([
|
265
|
-
|
294
|
+
n({ type: String, attribute: "custom-invalid" })
|
266
295
|
], i.prototype, "customInvalid", 2);
|
267
296
|
s([
|
268
|
-
|
297
|
+
n({ type: Boolean, attribute: "hide-label" })
|
269
298
|
], i.prototype, "hideLabel", 2);
|
270
299
|
s([
|
271
|
-
|
300
|
+
n({ type: Boolean, reflect: !0, attribute: "hide-tags" })
|
272
301
|
], i.prototype, "hideTags", 2);
|
273
302
|
s([
|
274
|
-
|
303
|
+
n({ type: String })
|
275
304
|
], i.prototype, "hint", 2);
|
276
305
|
s([
|
277
|
-
|
306
|
+
n({ type: Array, attribute: !1 })
|
278
307
|
], i.prototype, "selectedValues", 1);
|
279
308
|
s([
|
280
|
-
|
309
|
+
n({ type: Array, attribute: !1 })
|
281
310
|
], i.prototype, "selectedOptionsText", 1);
|
282
311
|
s([
|
283
|
-
|
312
|
+
n({ type: String, reflect: !0 })
|
284
313
|
], i.prototype, "label", 2);
|
285
314
|
s([
|
286
|
-
|
315
|
+
n({ type: String })
|
316
|
+
], i.prototype, "lang", 2);
|
317
|
+
s([
|
318
|
+
n({ type: Number })
|
287
319
|
], i.prototype, "max", 2);
|
288
320
|
s([
|
289
|
-
|
321
|
+
n({ type: Number, attribute: "max-visible-items" })
|
322
|
+
], i.prototype, "maxVisibleItems", 2);
|
323
|
+
s([
|
324
|
+
n({ type: Number })
|
290
325
|
], i.prototype, "min", 2);
|
291
326
|
s([
|
292
|
-
|
327
|
+
n({ type: Boolean, reflect: !0 })
|
293
328
|
], i.prototype, "multiple", 2);
|
294
329
|
s([
|
295
|
-
|
330
|
+
n({ type: String })
|
296
331
|
], i.prototype, "name", 2);
|
297
332
|
s([
|
298
|
-
|
299
|
-
], i.prototype, "requiredLabel", 2);
|
300
|
-
s([
|
301
|
-
o()
|
333
|
+
n()
|
302
334
|
], i.prototype, "severity", 2);
|
303
335
|
s([
|
304
|
-
|
336
|
+
n({ type: Boolean, attribute: "show-valid" })
|
305
337
|
], i.prototype, "showValid", 2);
|
306
338
|
s([
|
307
|
-
|
339
|
+
n({ reflect: !0 })
|
308
340
|
], i.prototype, "size", 2);
|
309
341
|
s([
|
310
|
-
|
342
|
+
n({ type: String, attribute: !1 })
|
311
343
|
], i.prototype, "value", 1);
|
312
344
|
s([
|
313
|
-
|
345
|
+
c()
|
314
346
|
], i.prototype, "selectedOptions", 1);
|
315
347
|
s([
|
316
|
-
|
348
|
+
c()
|
317
349
|
], i.prototype, "_expanded", 2);
|
318
350
|
s([
|
319
|
-
|
351
|
+
c()
|
320
352
|
], i.prototype, "_invalid", 2);
|
321
353
|
s([
|
322
|
-
|
354
|
+
c()
|
355
|
+
], i.prototype, "desiredPopupHeight", 2);
|
356
|
+
s([
|
357
|
+
m("#select-button")
|
323
358
|
], i.prototype, "$anchor", 2);
|
324
359
|
s([
|
325
|
-
|
360
|
+
m("#selected-value")
|
326
361
|
], i.prototype, "$selectedValue", 2);
|
327
362
|
s([
|
328
|
-
|
363
|
+
m("#select-dropdown")
|
329
364
|
], i.prototype, "$popover", 2);
|
330
365
|
s([
|
331
|
-
|
366
|
+
T()
|
332
367
|
], i.prototype, "_slottedItems", 2);
|
333
368
|
s([
|
334
|
-
|
369
|
+
S("size", { waitUntilFirstUpdate: !0 })
|
335
370
|
], i.prototype, "_handleSizeUpdate", 1);
|
336
371
|
s([
|
337
|
-
|
338
|
-
], i.prototype, "
|
372
|
+
S("_expanded", { afterUpdate: !0 })
|
373
|
+
], i.prototype, "_handleExpandedChange", 1);
|
339
374
|
export {
|
340
375
|
i as SkfSelect
|
341
376
|
};
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import { raiseError as
|
1
|
+
import { raiseError as l } from "../../internal/helpers/raiseError.js";
|
2
2
|
class d {
|
3
3
|
constructor(t) {
|
4
4
|
this._globalClickHandler = (e) => {
|
5
|
-
|
6
|
-
!((s = this.host) != null && s.localName) || e.target.closest(this.host.localName) || (this.host._expanded = !1);
|
5
|
+
!this.host?.localName || e.target.closest(this.host.localName) || (this.host._expanded = !1);
|
7
6
|
}, (this.host = t).addController(this);
|
8
7
|
}
|
9
8
|
// hostConnected() {
|
@@ -13,8 +12,7 @@ class d {
|
|
13
12
|
this.disableGlobalClickDetection();
|
14
13
|
}
|
15
14
|
hostUpdated() {
|
16
|
-
|
17
|
-
(t = this.host) != null && t._expanded ? this.enableGlobalClickDetection() : this.disableGlobalClickDetection();
|
15
|
+
this.host?._expanded ? this.enableGlobalClickDetection() : this.disableGlobalClickDetection();
|
18
16
|
}
|
19
17
|
enableGlobalClickDetection() {
|
20
18
|
document.addEventListener("click", this._globalClickHandler);
|
@@ -48,8 +46,7 @@ class p {
|
|
48
46
|
this.removeKeyboardListener();
|
49
47
|
}
|
50
48
|
hostUpdated() {
|
51
|
-
|
52
|
-
(t = this.host) != null && t._expanded && !this._listenerActivated && this.setupKeyboardListener(), !((e = this.host) != null && e._expanded) && this._listenerActivated && this.removeKeyboardListener();
|
49
|
+
this.host?._expanded && !this._listenerActivated && this.setupKeyboardListener(), !this.host?._expanded && this._listenerActivated && this.removeKeyboardListener();
|
53
50
|
}
|
54
51
|
setupKeyboardListener() {
|
55
52
|
this._listenerActivated = !0, this.host.addEventListener("keydown", this._handleKeyDown);
|
@@ -64,16 +61,16 @@ class p {
|
|
64
61
|
});
|
65
62
|
}
|
66
63
|
_focusSiblingOption(t) {
|
67
|
-
const e = (
|
68
|
-
if (!
|
64
|
+
const e = (n) => n === document.activeElement, s = this._selectableOptions.find((n) => e(n));
|
65
|
+
if (!s) {
|
69
66
|
this._focusFirstOption();
|
70
67
|
return;
|
71
68
|
}
|
72
|
-
const
|
73
|
-
let
|
74
|
-
|
75
|
-
const h = this._selectableOptions[t === "next" ?
|
76
|
-
|
69
|
+
const r = this._selectableOptions.indexOf(s);
|
70
|
+
let i = r - 1, o = r + 1;
|
71
|
+
i < 0 && (i = this._selectableOptions.length - 1), o >= this._selectableOptions.length && (o = 0);
|
72
|
+
const h = this._selectableOptions[t === "next" ? o : i];
|
73
|
+
s.blur(), h.focus();
|
77
74
|
}
|
78
75
|
_selectFocusedOption(t) {
|
79
76
|
t.selected = !0;
|
@@ -92,18 +89,18 @@ class b {
|
|
92
89
|
_badAttributeCombinationWarning() {
|
93
90
|
if (!this.host) return;
|
94
91
|
const t = this.host.localName ?? "never";
|
95
|
-
|
92
|
+
l({
|
96
93
|
assert: (this.host.min ?? 0) <= (this.host.max ?? 1 / 0),
|
97
94
|
reason: "attribute-mismatch",
|
98
95
|
replaceStrings: [t, "min", "smaller than max"]
|
99
|
-
}),
|
96
|
+
}), l({
|
100
97
|
assert: (
|
101
98
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
102
99
|
(this.host.min || this.host.max) && this.host.multiple || !(this.host.min && this.host.max)
|
103
100
|
),
|
104
101
|
reason: "attribute-mismatch",
|
105
102
|
replaceStrings: [t, "min or max", "together with multiple"]
|
106
|
-
}),
|
103
|
+
}), l({
|
107
104
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
108
105
|
assert: this.host.hideTags && this.host.multiple || !this.host.hideTags,
|
109
106
|
reason: "attribute-mismatch",
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { visuallyHidden as r } from "../../styles/util.styles.js";
|
2
|
-
import { css as
|
2
|
+
import { css as e } from "lit";
|
3
3
|
const t = [
|
4
4
|
r,
|
5
|
-
|
5
|
+
e`
|
6
6
|
@layer components {
|
7
7
|
:host {
|
8
8
|
contain: initial;
|
@@ -52,7 +52,12 @@ const t = [
|
|
52
52
|
gap: 0 var(--skf-spacing-75);
|
53
53
|
justify-content: space-between;
|
54
54
|
padding-inline: var(--skf-spacing-75);
|
55
|
-
|
55
|
+
|
56
|
+
span {
|
57
|
+
overflow: hidden;
|
58
|
+
text-overflow: ellipsis;
|
59
|
+
white-space: nowrap;
|
60
|
+
}
|
56
61
|
|
57
62
|
&:hover {
|
58
63
|
--_skf-select-button-bg-color: var(--skf-interactive-bg-color-secondary-hover);
|
@@ -35,7 +35,7 @@ export declare class SkfStepperItem extends SkfElement {
|
|
35
35
|
/** @internal */
|
36
36
|
set _setInternalState(state: typeof this._uiState);
|
37
37
|
get _setInternalState(): typeof this._uiState;
|
38
|
-
|
38
|
+
connectedCallback(): void;
|
39
39
|
protected firstUpdated(): void;
|
40
40
|
/** @internal */
|
41
41
|
_handleState(): void;
|
@@ -2,30 +2,30 @@ var v = (e) => {
|
|
2
2
|
throw TypeError(e);
|
3
3
|
};
|
4
4
|
var u = (e, i, t) => i.has(e) || v("Cannot " + t);
|
5
|
-
var
|
5
|
+
var m = (e, i, t) => (u(e, i, "read from private field"), t ? t.call(e) : i.get(e)), _ = (e, i, t) => i.has(e) ? v("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t), r = (e, i, t, a) => (u(e, i, "write to private field"), a ? a.call(e, t) : i.set(e, t), t);
|
6
6
|
import "../icon/icon.js";
|
7
|
-
import { SkfElement as
|
8
|
-
import { watch as
|
7
|
+
import { SkfElement as C } from "../../internal/components/skf-element.js";
|
8
|
+
import { watch as g } from "../../internal/helpers/watch.js";
|
9
9
|
import { componentStyles as x } from "../../styles/component.styles.js";
|
10
10
|
import "lit";
|
11
|
-
import { property as b, state as
|
11
|
+
import { property as b, state as n } from "lit/decorators.js";
|
12
12
|
import { classMap as $ } from "lit/directives/class-map.js";
|
13
13
|
import { ifDefined as w } from "lit/directives/if-defined.js";
|
14
14
|
import { literal as S, html as y } from "lit/static-html.js";
|
15
15
|
import { styles as U } from "./stepper-item.styles.js";
|
16
16
|
var I = Object.defineProperty, O = Object.getOwnPropertyDescriptor, o = (e, i, t, a) => {
|
17
|
-
for (var p = a > 1 ? void 0 : a ? O(i, t) : i,
|
18
|
-
(
|
17
|
+
for (var p = a > 1 ? void 0 : a ? O(i, t) : i, d = e.length - 1, h; d >= 0; d--)
|
18
|
+
(h = e[d]) && (p = (a ? h(i, t, p) : h(p)) || p);
|
19
19
|
return a && p && I(i, t, p), p;
|
20
|
-
}, l,
|
21
|
-
const f = class f extends
|
20
|
+
}, l, c;
|
21
|
+
const f = class f extends C {
|
22
22
|
constructor() {
|
23
|
-
super();
|
23
|
+
super(...arguments);
|
24
24
|
_(this, l);
|
25
|
-
_(this,
|
26
|
-
r(this, l, !1), r(this,
|
25
|
+
_(this, c);
|
26
|
+
r(this, l, !1), r(this, c, !1), this.completed = !1, this._index = 0, this._linear = !1, this._handleClick = () => {
|
27
27
|
this._linear || (this.state = "active");
|
28
|
-
}
|
28
|
+
};
|
29
29
|
}
|
30
30
|
set _setInternalState(t) {
|
31
31
|
r(this, l, !0), this._uiState = t, t === "active" || t === "activeCompleted" ? this.state = t === "active" ? "active" : "completed" : this.state = void 0, setTimeout(() => {
|
@@ -35,6 +35,9 @@ const f = class f extends g {
|
|
35
35
|
get _setInternalState() {
|
36
36
|
return this.state;
|
37
37
|
}
|
38
|
+
connectedCallback() {
|
39
|
+
super.connectedCallback(), this.role = "listitem";
|
40
|
+
}
|
38
41
|
firstUpdated() {
|
39
42
|
this._handleState();
|
40
43
|
}
|
@@ -44,20 +47,20 @@ const f = class f extends g {
|
|
44
47
|
this._setInternalState = "activeCompleted";
|
45
48
|
return;
|
46
49
|
}
|
47
|
-
if (
|
50
|
+
if (m(this, l)) {
|
48
51
|
r(this, l, !1);
|
49
52
|
return;
|
50
53
|
}
|
51
|
-
r(this,
|
54
|
+
r(this, c, ["active", "completed"].includes(String(this.state)) && !["active", "activeCompleted"].includes(String(this._uiState))), this._emitUpdate();
|
52
55
|
}
|
53
56
|
/** @internal */
|
54
57
|
_emitUpdate() {
|
55
58
|
this.emit("skf-stepper-item-select", {
|
56
59
|
detail: {
|
57
60
|
item: this,
|
58
|
-
triggerActiveIndexUpdate:
|
61
|
+
triggerActiveIndexUpdate: m(this, c)
|
59
62
|
}
|
60
|
-
}), r(this,
|
63
|
+
}), r(this, c, !1);
|
61
64
|
}
|
62
65
|
render() {
|
63
66
|
const t = this._linear ? S`div` : S`button`;
|
@@ -82,7 +85,7 @@ const f = class f extends g {
|
|
82
85
|
`;
|
83
86
|
}
|
84
87
|
};
|
85
|
-
l = new WeakMap(),
|
88
|
+
l = new WeakMap(), c = new WeakMap(), f.styles = [x, U];
|
86
89
|
let s = f;
|
87
90
|
o([
|
88
91
|
b({ reflect: !0 })
|
@@ -91,22 +94,22 @@ o([
|
|
91
94
|
b({ type: Boolean })
|
92
95
|
], s.prototype, "completed", 2);
|
93
96
|
o([
|
94
|
-
|
97
|
+
n()
|
95
98
|
], s.prototype, "_disabled", 2);
|
96
99
|
o([
|
97
|
-
|
100
|
+
n()
|
98
101
|
], s.prototype, "_index", 2);
|
99
102
|
o([
|
100
|
-
|
103
|
+
n()
|
101
104
|
], s.prototype, "_linear", 2);
|
102
105
|
o([
|
103
|
-
|
106
|
+
n()
|
104
107
|
], s.prototype, "_uiState", 2);
|
105
108
|
o([
|
106
|
-
|
109
|
+
n()
|
107
110
|
], s.prototype, "_setInternalState", 1);
|
108
111
|
o([
|
109
|
-
|
112
|
+
g("state")
|
110
113
|
], s.prototype, "_handleState", 1);
|
111
114
|
export {
|
112
115
|
s as SkfStepperItem
|