@skf-design-system/ui-components 1.0.0-beta.7 → 1.0.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion.component.js +3 -3
- package/dist/components/alert/alert.component.d.ts +2 -2
- package/dist/components/alert/alert.component.js +32 -32
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +29 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb/breadcrumb.styles.d.ts +1 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.component.d.ts +25 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +8 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.styles.d.ts +1 -0
- package/dist/components/button/button.component.d.ts +3 -1
- package/dist/components/button/button.component.js +60 -47
- package/dist/components/button/button.styles.js +64 -45
- package/dist/components/card/card.component.js +4 -4
- package/dist/components/checkbox/checkbox.component.js +4 -4
- package/dist/components/dialog/dialog.component.d.ts +0 -1
- package/dist/components/dialog/dialog.component.js +21 -23
- package/dist/components/divider/divider.component.js +12 -12
- package/dist/components/heading/heading.component.js +13 -13
- package/dist/components/icon/icon.component.d.ts +1 -4
- package/dist/components/icon/icon.component.js +32 -23
- package/dist/components/icon/icon.styles.js +53 -47
- package/dist/components/link/link.component.d.ts +1 -0
- package/dist/components/link/link.component.js +42 -42
- package/dist/components/loader/loader.component.js +19 -19
- package/dist/components/logo/logo.component.js +6 -6
- package/dist/components/menu/menu.component.d.ts +24 -0
- package/dist/components/menu/menu.component.js +18 -0
- package/dist/components/menu/menu.d.ts +8 -0
- package/dist/components/menu/menu.js +6 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +11 -0
- package/dist/components/menu-item/menu-item.component.d.ts +25 -0
- package/dist/components/menu-item/menu-item.component.js +13 -0
- package/dist/components/menu-item/menu-item.d.ts +8 -0
- package/dist/components/menu-item/menu-item.js +6 -0
- package/dist/components/menu-item/menu-item.styles.d.ts +1 -0
- package/dist/components/menu-item/menu-item.styles.js +19 -0
- package/dist/components/popover/popover.component.d.ts +29 -0
- package/dist/components/popover/popover.component.js +37 -0
- package/dist/components/popover/popover.d.ts +8 -0
- package/dist/components/popover/popover.js +6 -0
- package/dist/components/popover/popover.styles.d.ts +1 -0
- package/dist/components/popover/popover.styles.js +12 -0
- package/dist/components/progress/progress.component.js +7 -7
- package/dist/components/radio/radio.component.js +4 -4
- package/dist/components/select/select.component.d.ts +8 -10
- package/dist/components/select/select.component.js +115 -118
- package/dist/components/select/select.controllers.d.ts +0 -25
- package/dist/components/select/select.controllers.js +35 -95
- package/dist/components/select-option-group/select-option-group.component.js +9 -9
- package/dist/components/stepper/stepper.component.d.ts +38 -0
- package/dist/components/stepper/stepper.component.js +91 -0
- package/dist/components/stepper/stepper.d.ts +8 -0
- package/dist/components/stepper/stepper.helpers.d.ts +16 -0
- package/dist/components/stepper/stepper.helpers.js +18 -0
- package/dist/components/stepper/stepper.js +6 -0
- package/dist/components/stepper/stepper.styles.d.ts +1 -0
- package/dist/components/stepper/stepper.styles.js +15 -0
- package/dist/components/stepper-item/stepper-item.component.d.ts +47 -0
- package/dist/components/stepper-item/stepper-item.component.js +113 -0
- package/dist/components/stepper-item/stepper-item.d.ts +8 -0
- package/dist/components/stepper-item/stepper-item.js +6 -0
- package/dist/components/stepper-item/stepper-item.styles.d.ts +1 -0
- package/dist/components/stepper-item/stepper-item.styles.js +98 -0
- package/dist/components/tab/tab.component.js +4 -4
- package/dist/components/tab-panel/tab-panel.component.js +12 -12
- package/dist/components/tag/tag.component.js +9 -9
- package/dist/components/textarea/textarea.component.js +3 -3
- package/dist/components/toast/toast.component.d.ts +7 -4
- package/dist/components/toast/toast.component.js +30 -26
- package/dist/components/toast/toast.singleton.d.ts +2 -7
- package/dist/components/toast/toast.singleton.js +25 -25
- package/dist/components/toast-item/toast-item.component.js +15 -15
- package/dist/components/toast-item/toast-item.styles.js +13 -11
- package/dist/components/toast-wrapper/toast-wrapper.component.js +10 -10
- package/dist/components/tooltip/tooltip.component.d.ts +24 -0
- package/dist/components/tooltip/tooltip.component.js +18 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +6 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.styles.js +12 -0
- package/dist/custom-elements.json +2179 -1002
- package/dist/index.d.ts +6 -0
- package/dist/index.js +72 -54
- package/dist/internal/base-classes/popover/popover.base.d.ts +29 -0
- package/dist/internal/base-classes/popover/popover.base.js +116 -0
- package/dist/internal/base-classes/popover/popover.styles.d.ts +1 -0
- package/dist/internal/base-classes/popover/popover.styles.js +29 -0
- package/dist/internal/components/hint/hint.component.js +13 -13
- package/dist/internal/controllers/popover.controller.d.ts +16 -0
- package/dist/internal/controllers/popover.controller.js +44 -0
- package/dist/internal/helpers/hintSeverity.d.ts +1 -1
- package/dist/react/index.d.ts +10 -2
- package/dist/react/index.js +10 -2
- package/dist/react/skf-breadcrumb/index.d.ts +9 -0
- package/dist/react/skf-breadcrumb/index.js +17 -0
- package/dist/react/skf-breadcrumb-item/index.d.ts +3 -0
- package/dist/react/skf-breadcrumb-item/index.js +13 -0
- package/dist/react/skf-menu/index.d.ts +12 -0
- package/dist/react/skf-menu/index.js +18 -0
- package/dist/react/skf-menu-item/index.d.ts +27 -0
- package/dist/react/skf-menu-item/index.js +23 -0
- package/dist/react/skf-popover/index.d.ts +12 -0
- package/dist/react/skf-popover/index.js +18 -0
- package/dist/react/skf-stepper/index.d.ts +9 -0
- package/dist/react/skf-stepper/index.js +17 -0
- package/dist/react/skf-stepper-item/index.d.ts +9 -0
- package/dist/react/skf-stepper-item/index.js +17 -0
- package/dist/react/skf-tooltip/index.d.ts +12 -0
- package/dist/react/skf-tooltip/index.js +18 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +594 -163
- package/dist/types/vue/index.d.ts +326 -74
- package/dist/vscode.html-custom-data.json +722 -390
- package/dist/web-types.json +836 -290
- package/package.json +33 -33
@@ -1,26 +1,28 @@
|
|
1
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
|
-
import {
|
4
|
-
import {
|
3
|
+
import { PopoverController as y } from "../../internal/controllers/popover.controller.js";
|
4
|
+
import { findMatchingTags as O } from "../../internal/helpers/findMatchingTags.js";
|
5
|
+
import { hintSeverity as x } from "../../internal/helpers/hintSeverity.js";
|
5
6
|
import { raiseError as w } from "../../internal/helpers/raiseError.js";
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import {
|
10
|
-
import {
|
7
|
+
import { watch as $ } from "../../internal/helpers/watch.js";
|
8
|
+
import { Asterisk as V } from "../../internal/templates/asterisk.js";
|
9
|
+
import S from "../../styles/component.styles.js";
|
10
|
+
import { html as n, nothing as C } from "lit";
|
11
|
+
import { property as o, state as h, query as p } from "lit/decorators.js";
|
12
|
+
import { classMap as E } from "lit/directives/class-map.js";
|
11
13
|
import { ifDefined as m } from "lit/directives/if-defined.js";
|
12
14
|
import "../../internal/components/hint/hint.js";
|
13
15
|
import "../tag/tag.js";
|
14
|
-
import {
|
16
|
+
import { GlobalClickController as k, KeyboardNavigationController as L, DeveloperFeedbackController as A } from "./select.controllers.js";
|
15
17
|
import { styles as P } from "./select.styles.js";
|
16
|
-
var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor,
|
17
|
-
for (var
|
18
|
-
(
|
19
|
-
return
|
18
|
+
var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor, s = (u, t, e, l) => {
|
19
|
+
for (var a = l > 1 ? void 0 : l ? D(t, e) : t, r = u.length - 1, d; r >= 0; r--)
|
20
|
+
(d = u[r]) && (a = (l ? d(t, e, a) : d(a)) || a);
|
21
|
+
return l && a && T(t, e, a), a;
|
20
22
|
};
|
21
23
|
const c = class c extends b {
|
22
24
|
constructor() {
|
23
|
-
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.
|
25
|
+
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new k(this), this.keyboardNavController = new L(this), this.developerFeedbackController = new A(this), this.popoverController = new y(this), this._handleOptionSelected = (t) => {
|
24
26
|
this._pristine = !1;
|
25
27
|
const e = this._selectedOptions.length > 0;
|
26
28
|
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
@@ -28,26 +30,20 @@ const c = class c extends b {
|
|
28
30
|
this.emitEvent("reset"), this._resetSelectedOptions();
|
29
31
|
}, this._updateWidth = () => {
|
30
32
|
setTimeout(() => {
|
31
|
-
|
32
|
-
(t = this.$dropdown) == null || t.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
33
|
+
this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
33
34
|
}, 50);
|
34
|
-
}, this.
|
35
|
-
|
36
|
-
(i = this.$dropdown) == null || i.hidePopover();
|
37
|
-
}, open: () => {
|
38
|
-
const i = this.$selectBtn, r = this.$dropdown;
|
39
|
-
!i || !r || (r.showPopover(), v(i, r, {
|
35
|
+
}, this.reposition = async () => {
|
36
|
+
const { x: t, y: e } = await v(this.$anchor, this.$popover, {
|
40
37
|
placement: "bottom",
|
41
|
-
middleware: [f(), _({ padding: 5 }), g(2)]
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
} }), this._handleDropdownToggle = (t) => {
|
38
|
+
middleware: [f(), _({ padding: 5 }), g(2)],
|
39
|
+
strategy: "fixed"
|
40
|
+
});
|
41
|
+
Object.assign(this.$popover.style, {
|
42
|
+
left: `${String(t)}px`,
|
43
|
+
top: `${String(e)}px`,
|
44
|
+
width: `${String(this.$anchor.offsetWidth)}px`
|
45
|
+
});
|
46
|
+
}, this._handleDropdownToggle = (t) => {
|
51
47
|
t.stopPropagation(), this._expanded = !this._expanded;
|
52
48
|
}, this._setValue = async () => new Promise((t) => {
|
53
49
|
switch (!0) {
|
@@ -68,8 +64,8 @@ const c = class c extends b {
|
|
68
64
|
});
|
69
65
|
}), this._resetSelectedOptions = (t) => {
|
70
66
|
const e = !t;
|
71
|
-
this._optionsList.forEach((
|
72
|
-
(e ||
|
67
|
+
this._optionsList.forEach((l) => {
|
68
|
+
(e || l !== t) && l.removeAttribute("selected");
|
73
69
|
});
|
74
70
|
}, this._handleSlotChange = () => {
|
75
71
|
this._collectSlotOptionTags(), this._validateInput();
|
@@ -93,8 +89,8 @@ const c = class c extends b {
|
|
93
89
|
return this._selectedOptions.map((t) => t.textContent ?? "");
|
94
90
|
}
|
95
91
|
set value(t) {
|
96
|
-
const e = t.split(",").map((
|
97
|
-
this._selectedOptions = this._optionsList.filter((
|
92
|
+
const e = t.split(",").map((l) => l.trim());
|
93
|
+
this._selectedOptions = this._optionsList.filter((l) => e.includes(l.value.trim()));
|
98
94
|
}
|
99
95
|
get value() {
|
100
96
|
return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
|
@@ -127,18 +123,16 @@ const c = class c extends b {
|
|
127
123
|
var t;
|
128
124
|
this.addEventListener("skf-select-option:select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
|
129
125
|
}
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
this._expanded ? this._managePopover().open() : this._managePopover().close();
|
135
|
-
}
|
126
|
+
handleExpandedChange() {
|
127
|
+
this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
|
128
|
+
console.error(t);
|
129
|
+
})), this.emit("skf-select:dropdown", { detail: { expanded: this._expanded } });
|
136
130
|
}
|
137
|
-
attributeChangedCallback(t, e,
|
138
|
-
if (super.attributeChangedCallback(t, e,
|
139
|
-
if (typeof
|
140
|
-
const
|
141
|
-
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 },
|
131
|
+
attributeChangedCallback(t, e, l) {
|
132
|
+
if (super.attributeChangedCallback(t, e, l), t === "custom-invalid")
|
133
|
+
if (typeof l == "string") {
|
134
|
+
const r = this.withFallback(l);
|
135
|
+
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, r), this.checkValidity();
|
142
136
|
} else
|
143
137
|
this.setValidity({}), this._validateInput();
|
144
138
|
}
|
@@ -153,8 +147,8 @@ const c = class c extends b {
|
|
153
147
|
e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
|
154
148
|
});
|
155
149
|
else {
|
156
|
-
const e = this._selectedOptions.length > 0,
|
157
|
-
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []),
|
150
|
+
const e = this._selectedOptions.length > 0, l = t.detail.value !== null;
|
151
|
+
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), l && (this.selectedOptions = [t.target]);
|
158
152
|
}
|
159
153
|
this._setValue();
|
160
154
|
}
|
@@ -165,7 +159,7 @@ const c = class c extends b {
|
|
165
159
|
/** @internal */
|
166
160
|
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
167
161
|
_collectSlotOptionTags() {
|
168
|
-
this._optionsList =
|
162
|
+
this._optionsList = O(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), w({
|
169
163
|
assert: this._optionsList.length > 0,
|
170
164
|
reason: "no-children",
|
171
165
|
replaceStrings: [this.localName, "skf-select-option"]
|
@@ -174,29 +168,29 @@ const c = class c extends b {
|
|
174
168
|
/** @internal */
|
175
169
|
_validateInput() {
|
176
170
|
this._invalid = !1;
|
177
|
-
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min),
|
171
|
+
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), l = !!(this.max && this.selectedValues.length > this.max);
|
178
172
|
if (this._internals.validity.customError) {
|
179
173
|
this._invalid = !0;
|
180
174
|
return;
|
181
175
|
} else if (t) {
|
182
|
-
const
|
183
|
-
this.setValidity({ valueMissing: !0 }, String(
|
176
|
+
const r = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
|
177
|
+
this.setValidity({ valueMissing: !0 }, String(r)), this._pristine || (this._invalid = !0);
|
184
178
|
} else if (e) {
|
185
|
-
const
|
186
|
-
this.setValidity({ rangeUnderflow: !0 }, String(
|
187
|
-
} else if (
|
188
|
-
const
|
189
|
-
this.setValidity({ rangeOverflow: !0 }, String(
|
179
|
+
const r = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
|
180
|
+
this.setValidity({ rangeUnderflow: !0 }, String(r)), this._pristine || (this._invalid = !0);
|
181
|
+
} else if (l) {
|
182
|
+
const r = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
|
183
|
+
this.setValidity({ rangeOverflow: !0 }, String(r)), this._pristine || (this._invalid = !0);
|
190
184
|
} else
|
191
185
|
this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
|
192
186
|
}
|
193
187
|
render() {
|
194
|
-
return
|
188
|
+
return n`
|
195
189
|
<div id="root">
|
196
190
|
<label>
|
197
191
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
198
192
|
${this.label}
|
199
|
-
${this.required ?
|
193
|
+
${this.required ? V(this.requiredLabel) : null}
|
200
194
|
</div>
|
201
195
|
<button
|
202
196
|
?disabled=${this.disabled}
|
@@ -211,7 +205,7 @@ const c = class c extends b {
|
|
211
205
|
>
|
212
206
|
<span
|
213
207
|
id="selected-value"
|
214
|
-
class=${
|
208
|
+
class=${E({ "selected-value": !0, "contains-meta-info": !this.value })}>
|
215
209
|
${this._computeVisibleValue()}
|
216
210
|
</span>
|
217
211
|
<skf-icon class="arrow" name="chevronDown"></skf-icon>
|
@@ -220,10 +214,10 @@ const c = class c extends b {
|
|
220
214
|
<div aria-multiselectable=${m(this.multiple && !0)} id="select-dropdown" popover role="listbox">
|
221
215
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
222
216
|
</div>
|
223
|
-
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ?
|
217
|
+
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? n`
|
224
218
|
<div id="tags">
|
225
219
|
${this.selectedOptions.map(
|
226
|
-
(t) =>
|
220
|
+
(t) => n`
|
227
221
|
<skf-tag
|
228
222
|
style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
229
223
|
removable
|
@@ -236,12 +230,12 @@ const c = class c extends b {
|
|
236
230
|
`
|
237
231
|
)}
|
238
232
|
</div>
|
239
|
-
` :
|
240
|
-
${this.hint &&
|
233
|
+
` : C}
|
234
|
+
${this.hint && n`
|
241
235
|
<skf-hint
|
242
236
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
243
237
|
id="hint"
|
244
|
-
severity=${m(
|
238
|
+
severity=${m(x(this.severity, this._invalid))}
|
245
239
|
>
|
246
240
|
${this.customInvalid ? this.customInvalid : this.hint}
|
247
241
|
</skf-hint>
|
@@ -251,77 +245,80 @@ const c = class c extends b {
|
|
251
245
|
`;
|
252
246
|
}
|
253
247
|
};
|
254
|
-
c.styles = [
|
255
|
-
let
|
256
|
-
|
248
|
+
c.styles = [S, P];
|
249
|
+
let i = c;
|
250
|
+
s([
|
257
251
|
o({ type: String, reflect: !0, attribute: "button-label" })
|
258
|
-
],
|
259
|
-
|
252
|
+
], i.prototype, "buttonLabel", 2);
|
253
|
+
s([
|
260
254
|
o({ attribute: "custom-invalid" })
|
261
|
-
],
|
262
|
-
|
255
|
+
], i.prototype, "customInvalid", 2);
|
256
|
+
s([
|
263
257
|
o({ type: Boolean, attribute: "hide-label" })
|
264
|
-
],
|
265
|
-
|
258
|
+
], i.prototype, "hideLabel", 2);
|
259
|
+
s([
|
266
260
|
o({ type: Boolean, reflect: !0, attribute: "hide-tags" })
|
267
|
-
],
|
268
|
-
|
261
|
+
], i.prototype, "hideTags", 2);
|
262
|
+
s([
|
269
263
|
o()
|
270
|
-
],
|
271
|
-
|
264
|
+
], i.prototype, "hint", 2);
|
265
|
+
s([
|
272
266
|
o({ type: Array, attribute: !1 })
|
273
|
-
],
|
274
|
-
|
267
|
+
], i.prototype, "selectedValues", 1);
|
268
|
+
s([
|
275
269
|
o({ type: Array, attribute: !1 })
|
276
|
-
],
|
277
|
-
|
270
|
+
], i.prototype, "selectedOptionsText", 1);
|
271
|
+
s([
|
278
272
|
o({ reflect: !0 })
|
279
|
-
],
|
280
|
-
|
273
|
+
], i.prototype, "label", 2);
|
274
|
+
s([
|
281
275
|
o({ type: Number })
|
282
|
-
],
|
283
|
-
|
276
|
+
], i.prototype, "max", 2);
|
277
|
+
s([
|
284
278
|
o({ type: Number })
|
285
|
-
],
|
286
|
-
|
279
|
+
], i.prototype, "min", 2);
|
280
|
+
s([
|
287
281
|
o({ type: Boolean, reflect: !0 })
|
288
|
-
],
|
289
|
-
|
282
|
+
], i.prototype, "multiple", 2);
|
283
|
+
s([
|
290
284
|
o()
|
291
|
-
],
|
292
|
-
|
285
|
+
], i.prototype, "name", 2);
|
286
|
+
s([
|
293
287
|
o({ attribute: "required-label" })
|
294
|
-
],
|
295
|
-
|
288
|
+
], i.prototype, "requiredLabel", 2);
|
289
|
+
s([
|
296
290
|
o()
|
297
|
-
],
|
298
|
-
|
291
|
+
], i.prototype, "severity", 2);
|
292
|
+
s([
|
299
293
|
o({ type: Boolean, attribute: "show-valid" })
|
300
|
-
],
|
301
|
-
|
294
|
+
], i.prototype, "showValid", 2);
|
295
|
+
s([
|
302
296
|
o({ reflect: !0 })
|
303
|
-
],
|
304
|
-
|
305
|
-
|
306
|
-
],
|
307
|
-
|
308
|
-
|
309
|
-
],
|
310
|
-
|
311
|
-
|
312
|
-
],
|
313
|
-
|
314
|
-
|
315
|
-
],
|
316
|
-
|
297
|
+
], i.prototype, "size", 2);
|
298
|
+
s([
|
299
|
+
h()
|
300
|
+
], i.prototype, "value", 1);
|
301
|
+
s([
|
302
|
+
h()
|
303
|
+
], i.prototype, "selectedOptions", 1);
|
304
|
+
s([
|
305
|
+
h()
|
306
|
+
], i.prototype, "_expanded", 2);
|
307
|
+
s([
|
308
|
+
h()
|
309
|
+
], i.prototype, "_invalid", 2);
|
310
|
+
s([
|
317
311
|
p("#select-button")
|
318
|
-
],
|
319
|
-
|
312
|
+
], i.prototype, "$anchor", 2);
|
313
|
+
s([
|
320
314
|
p("#selected-value")
|
321
|
-
],
|
322
|
-
|
315
|
+
], i.prototype, "$selectedValue", 2);
|
316
|
+
s([
|
323
317
|
p("#select-dropdown")
|
324
|
-
],
|
318
|
+
], i.prototype, "$popover", 2);
|
319
|
+
s([
|
320
|
+
$("_expanded", { afterUpdate: !0 })
|
321
|
+
], i.prototype, "handleExpandedChange", 1);
|
325
322
|
export {
|
326
|
-
|
323
|
+
i as SkfSelect
|
327
324
|
};
|
@@ -2,31 +2,6 @@ import type { SkfSelectOption } from '../select-option/select-option.component.j
|
|
2
2
|
import type { ReactiveController } from 'lit';
|
3
3
|
import type { SkfSelect } from './select.component.js';
|
4
4
|
type ControllerHost = SkfSelect;
|
5
|
-
export declare class ScrollController implements ReactiveController {
|
6
|
-
_scrollHandler?: () => void;
|
7
|
-
host?: ControllerHost;
|
8
|
-
localExpanded: boolean;
|
9
|
-
constructor(host: ControllerHost);
|
10
|
-
hostDisconnected(): void;
|
11
|
-
hostUpdated(): void;
|
12
|
-
enableScrollDetection(): void;
|
13
|
-
disableScrollDetection(): void;
|
14
|
-
/** @internal */
|
15
|
-
_onScrollOutOfView(): void;
|
16
|
-
/** @internal */
|
17
|
-
_onScrollIntoView(): void;
|
18
|
-
}
|
19
|
-
export declare class ResizeController implements ReactiveController {
|
20
|
-
host: ControllerHost;
|
21
|
-
_resizeObserver?: ResizeObserver;
|
22
|
-
constructor(host: ControllerHost);
|
23
|
-
hostConnected(): void;
|
24
|
-
hostDisconnected(): void;
|
25
|
-
enableResizeObserver(): void;
|
26
|
-
disableResizeObserver(): void;
|
27
|
-
/** @internal */
|
28
|
-
_onResize: () => void;
|
29
|
-
}
|
30
5
|
export declare class GlobalClickController implements ReactiveController {
|
31
6
|
host: ControllerHost;
|
32
7
|
constructor(host: ControllerHost);
|
@@ -1,67 +1,9 @@
|
|
1
|
-
import { raiseError as
|
1
|
+
import { raiseError as l } from "../../internal/helpers/raiseError.js";
|
2
2
|
class d {
|
3
|
-
constructor(
|
4
|
-
this.
|
5
|
-
|
6
|
-
|
7
|
-
this.disableScrollDetection();
|
8
|
-
}
|
9
|
-
hostUpdated() {
|
10
|
-
var e, t, s;
|
11
|
-
((e = this.host) == null ? void 0 : e._expanded) !== this.localExpanded && (this.localExpanded = !!((t = this.host) != null && t._expanded), (s = this.host) != null && s._expanded ? this.enableScrollDetection() : this.disableScrollDetection());
|
12
|
-
}
|
13
|
-
enableScrollDetection() {
|
14
|
-
if (this._scrollHandler = () => {
|
15
|
-
if (!this.host) return;
|
16
|
-
this.host._expanded = !1;
|
17
|
-
const t = this.host.getBoundingClientRect();
|
18
|
-
t.top < 0 || t.bottom > window.innerHeight || t.left < 0 || t.right > window.innerWidth ? this._onScrollOutOfView() : this._onScrollIntoView();
|
19
|
-
}, window.addEventListener("scroll", this._scrollHandler, !0), !this.host) return;
|
20
|
-
let e = this.host.parentElement;
|
21
|
-
for (; e; )
|
22
|
-
(e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth) && e.addEventListener("scroll", this._scrollHandler, !0), e = e.parentElement;
|
23
|
-
}
|
24
|
-
disableScrollDetection() {
|
25
|
-
if (!this._scrollHandler || (window.removeEventListener("scroll", this._scrollHandler, !0), !this.host)) return;
|
26
|
-
let e = this.host.parentElement;
|
27
|
-
for (; e; )
|
28
|
-
(e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth) && e.removeEventListener("scroll", this._scrollHandler, !0), e = e.parentElement;
|
29
|
-
}
|
30
|
-
/** @internal */
|
31
|
-
_onScrollOutOfView() {
|
32
|
-
this.host && (this.host._expanded = !1);
|
33
|
-
}
|
34
|
-
/** @internal */
|
35
|
-
_onScrollIntoView() {
|
36
|
-
}
|
37
|
-
}
|
38
|
-
class b {
|
39
|
-
constructor(e) {
|
40
|
-
this._onResize = () => {
|
41
|
-
this.host._expanded = !1;
|
42
|
-
}, this.host = e, e.addController(this);
|
43
|
-
}
|
44
|
-
hostConnected() {
|
45
|
-
this.enableResizeObserver();
|
46
|
-
}
|
47
|
-
hostDisconnected() {
|
48
|
-
this.disableResizeObserver();
|
49
|
-
}
|
50
|
-
enableResizeObserver() {
|
51
|
-
this._resizeObserver = new ResizeObserver(() => {
|
52
|
-
this.host._expanded = !1, this.host._updateWidth();
|
53
|
-
}), this._resizeObserver.observe(document.body), this._resizeObserver.observe(this.host);
|
54
|
-
}
|
55
|
-
disableResizeObserver() {
|
56
|
-
var e;
|
57
|
-
(e = this._resizeObserver) == null || e.disconnect();
|
58
|
-
}
|
59
|
-
}
|
60
|
-
class p {
|
61
|
-
constructor(e) {
|
62
|
-
this._globalClickHandler = (t) => {
|
63
|
-
t.target.closest(this.host.localName) || (this.host._expanded = !1);
|
64
|
-
}, this.host = e, e.addController(this);
|
3
|
+
constructor(t) {
|
4
|
+
this._globalClickHandler = (e) => {
|
5
|
+
e.target.closest(this.host.localName) || (this.host._expanded = !1);
|
6
|
+
}, this.host = t, t.addController(this);
|
65
7
|
}
|
66
8
|
// hostConnected() {
|
67
9
|
// this.enableGlobalClickDetection();
|
@@ -79,26 +21,26 @@ class p {
|
|
79
21
|
document.removeEventListener("click", this._globalClickHandler);
|
80
22
|
}
|
81
23
|
}
|
82
|
-
class
|
83
|
-
constructor(
|
84
|
-
this._handleKeyDown = (
|
85
|
-
switch (
|
24
|
+
class p {
|
25
|
+
constructor(t) {
|
26
|
+
this._handleKeyDown = (e) => {
|
27
|
+
switch (e.key) {
|
86
28
|
case "ArrowDown":
|
87
|
-
|
29
|
+
e.preventDefault(), this._focusSiblingOption("next");
|
88
30
|
break;
|
89
31
|
case "ArrowUp":
|
90
|
-
|
32
|
+
e.preventDefault(), this._focusSiblingOption("prev");
|
91
33
|
break;
|
92
34
|
case "Enter":
|
93
|
-
|
35
|
+
e.preventDefault(), this._selectFocusedOption(e.target);
|
94
36
|
break;
|
95
37
|
case "Escape":
|
96
|
-
|
38
|
+
e.preventDefault(), this.host._expanded = !1, setTimeout(() => {
|
97
39
|
this.host.focus();
|
98
40
|
});
|
99
41
|
break;
|
100
42
|
}
|
101
|
-
}, this.host =
|
43
|
+
}, this.host = t, t.addController(this), this._listenerActivated = !1;
|
102
44
|
}
|
103
45
|
hostDisconnected() {
|
104
46
|
this.removeKeyboardListener();
|
@@ -113,50 +55,50 @@ class u {
|
|
113
55
|
this.host.removeEventListener("keydown", this._handleKeyDown), this._listenerActivated = !1;
|
114
56
|
}
|
115
57
|
_focusFirstOption() {
|
116
|
-
const
|
58
|
+
const t = this._selectableOptions[0];
|
117
59
|
setTimeout(() => {
|
118
|
-
|
60
|
+
t.focus();
|
119
61
|
});
|
120
62
|
}
|
121
|
-
_focusSiblingOption(
|
122
|
-
const
|
63
|
+
_focusSiblingOption(t) {
|
64
|
+
const e = (n) => n === document.activeElement, s = this._selectableOptions.find((n) => e(n));
|
123
65
|
if (!s) {
|
124
66
|
this._focusFirstOption();
|
125
67
|
return;
|
126
68
|
}
|
127
|
-
const
|
128
|
-
let
|
129
|
-
|
130
|
-
const
|
131
|
-
s.blur(),
|
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();
|
132
74
|
}
|
133
|
-
_selectFocusedOption(
|
134
|
-
|
75
|
+
_selectFocusedOption(t) {
|
76
|
+
t.selected = !0;
|
135
77
|
}
|
136
78
|
get _selectableOptions() {
|
137
|
-
return this.host._optionsList.filter((
|
79
|
+
return this.host._optionsList.filter((t) => !t.disabled);
|
138
80
|
}
|
139
81
|
}
|
140
|
-
class
|
141
|
-
constructor(
|
142
|
-
this.host =
|
82
|
+
class b {
|
83
|
+
constructor(t) {
|
84
|
+
this.host = t, t.addController(this);
|
143
85
|
}
|
144
86
|
hostConnected() {
|
145
87
|
this._badAttributeCombinationWarning();
|
146
88
|
}
|
147
89
|
_badAttributeCombinationWarning() {
|
148
|
-
|
90
|
+
l({
|
149
91
|
assert: (this.host.min ?? 0) <= (this.host.max ?? 1 / 0),
|
150
92
|
reason: "attribute-mismatch",
|
151
93
|
replaceStrings: [this.host.localName, "min", "smaller than max"]
|
152
|
-
}),
|
94
|
+
}), l({
|
153
95
|
assert: (
|
154
96
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
155
97
|
(this.host.min || this.host.max) && this.host.multiple || !(this.host.min && this.host.max)
|
156
98
|
),
|
157
99
|
reason: "attribute-mismatch",
|
158
100
|
replaceStrings: [this.host.localName, "min or max", "together with multiple"]
|
159
|
-
}),
|
101
|
+
}), l({
|
160
102
|
assert: (this.host.hideTags && this.host.multiple) ?? !this.host.hideTags,
|
161
103
|
reason: "attribute-mismatch",
|
162
104
|
replaceStrings: [this.host.localName, "hide-tags", "together with multiple"]
|
@@ -164,9 +106,7 @@ class _ {
|
|
164
106
|
}
|
165
107
|
}
|
166
108
|
export {
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
b as ResizeController,
|
171
|
-
d as ScrollController
|
109
|
+
b as DeveloperFeedbackController,
|
110
|
+
d as GlobalClickController,
|
111
|
+
p as KeyboardNavigationController
|
172
112
|
};
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import { SkfElement as a } from "../../internal/components/skf-element.js";
|
2
2
|
import f from "../../styles/component.styles.js";
|
3
|
-
import { html as
|
3
|
+
import { html as n } from "lit";
|
4
4
|
import { property as d } from "lit/decorators.js";
|
5
|
-
import { styles as
|
6
|
-
var
|
7
|
-
for (var r = void 0, e =
|
8
|
-
(m =
|
9
|
-
return r &&
|
5
|
+
import { styles as p } from "./select-option-group.style.js";
|
6
|
+
var u = Object.defineProperty, v = (s, o, i, b) => {
|
7
|
+
for (var r = void 0, e = s.length - 1, m; e >= 0; e--)
|
8
|
+
(m = s[e]) && (r = m(o, i, r) || r);
|
9
|
+
return r && u(o, i, r), r;
|
10
10
|
};
|
11
11
|
const l = class l extends a {
|
12
12
|
constructor() {
|
13
13
|
super(...arguments), this.label = "Default label";
|
14
14
|
}
|
15
15
|
render() {
|
16
|
-
return
|
16
|
+
return n`
|
17
17
|
<div role="group">
|
18
18
|
<div id="label">${this.label}</div>
|
19
19
|
<slot></slot>
|
@@ -21,9 +21,9 @@ const l = class l extends a {
|
|
21
21
|
`;
|
22
22
|
}
|
23
23
|
};
|
24
|
-
l.styles = [f,
|
24
|
+
l.styles = [f, p];
|
25
25
|
let t = l;
|
26
|
-
|
26
|
+
v([
|
27
27
|
d({ reflect: !0 })
|
28
28
|
], t.prototype, "label");
|
29
29
|
export {
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { SkfStepperItem } from '../stepper-item/stepper-item.component.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
3
|
+
import { type CSSResultGroup } from 'lit';
|
4
|
+
/**
|
5
|
+
* The `<skf-stepper>` is a component that displays a list of actions or options.
|
6
|
+
*
|
7
|
+
* @documentation See [zeroheight](https://zeroheight.com/****) for design principles
|
8
|
+
*
|
9
|
+
* @slot - One or more `<skf-stepper-item>`
|
10
|
+
*
|
11
|
+
* @event skf-stepper-item-select - Dispatched when the stepper item is selected
|
12
|
+
*
|
13
|
+
* @tagname skf-stepper
|
14
|
+
*/
|
15
|
+
export declare class SkfStepper extends SkfElement {
|
16
|
+
#private;
|
17
|
+
static styles: CSSResultGroup;
|
18
|
+
/** Sets the active item */
|
19
|
+
activeIndex: number;
|
20
|
+
/** If true, sets linear mode (user can't go back to completed steps due to dependencies) */
|
21
|
+
linear: boolean;
|
22
|
+
/** @internal */
|
23
|
+
_items?: NodeListOf<SkfStepperItem>;
|
24
|
+
constructor();
|
25
|
+
firstUpdated(): void;
|
26
|
+
/** @internal activeIndex is the source of truth. Once updated all stepper states are recalculated. */
|
27
|
+
_handleActiveIndexChanged(): void;
|
28
|
+
/** @internal */
|
29
|
+
_handleLinearMode(): void;
|
30
|
+
private _handleSelected;
|
31
|
+
/** @internal */
|
32
|
+
private _resetActive;
|
33
|
+
/** @internal */
|
34
|
+
private _getCurrentActiveIndex;
|
35
|
+
/** @internal Not much can be handled before this kick off */
|
36
|
+
private _handleSlotChanged;
|
37
|
+
render(): import("lit").TemplateResult<1>;
|
38
|
+
}
|