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