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