@skf-design-system/ui-components 1.0.2-beta.14 → 1.0.2-beta.16
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/button/button.component.d.ts +2 -0
- package/dist/components/checkbox/checkbox.component.js +7 -7
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/datepicker/datepicker.component.js +6 -6
- package/dist/components/icon/icon.styles.js +2 -2
- package/dist/components/input/input.component.js +8 -8
- package/dist/components/radio/radio.component.js +2 -2
- package/dist/components/radio/radio.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.component.d.ts +2 -0
- package/dist/components/select/select-option.component.d.ts +2 -0
- package/dist/components/select/select-option.component.js +2 -2
- package/dist/components/select/select.component.d.ts +1 -1
- package/dist/components/select/select.component.js +43 -43
- package/dist/components/switch/switch.component.js +2 -2
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/tag/tag.component.d.ts +5 -3
- package/dist/components/tag/tag.component.js +64 -61
- package/dist/components/textarea/textarea.component.js +3 -3
- package/dist/components/toast/toast-item.component.js +1 -1
- package/dist/components/toast/toast.singleton.js +1 -1
- package/dist/custom-elements.json +143 -125
- package/dist/internal/base-classes/popover/popover.base.d.ts +0 -1
- package/dist/internal/base-classes/popover/popover.base.js +52 -50
- package/dist/internal/components/formBase.d.ts +2 -18
- package/dist/internal/components/formBase.js +21 -38
- package/dist/internal/components/skf-element.d.ts +19 -2
- package/dist/internal/components/skf-element.js +27 -69
- package/dist/types/jsx/custom-element-jsx.d.ts +64 -36
- package/dist/types/vue/index.d.ts +24 -22
- package/dist/vscode.html-custom-data.json +27 -22
- package/dist/web-types.json +54 -44
- package/package.json +22 -22
|
@@ -21,6 +21,8 @@ export declare class SkfButton extends SkfElement {
|
|
|
21
21
|
static formAssociated: boolean;
|
|
22
22
|
static shadowRootOptions: {
|
|
23
23
|
delegatesFocus: boolean;
|
|
24
|
+
clonable?: boolean;
|
|
25
|
+
customElementRegistry?: CustomElementRegistry;
|
|
24
26
|
mode: ShadowRootMode;
|
|
25
27
|
serializable?: boolean;
|
|
26
28
|
slotAssignment?: SlotAssignmentMode;
|
|
@@ -11,8 +11,8 @@ import { componentStyles as k } from "../../styles/component.styles.js";
|
|
|
11
11
|
import { LocalizeController as $ } from "../../utilities/localize.js";
|
|
12
12
|
import { html as g, nothing as I } from "lit";
|
|
13
13
|
import { property as r, state as V, query as C } from "lit/decorators.js";
|
|
14
|
-
import { ifDefined as
|
|
15
|
-
import { styles as
|
|
14
|
+
import { ifDefined as w } from "lit/directives/if-defined.js";
|
|
15
|
+
import { styles as E } from "./checkbox.styles.js";
|
|
16
16
|
var A = Object.defineProperty, D = Object.getOwnPropertyDescriptor, a = (i, s, t, l) => {
|
|
17
17
|
for (var h = l > 1 ? void 0 : l ? D(s, t) : s, d = i.length - 1, u; d >= 0; d--)
|
|
18
18
|
(u = i[d]) && (h = (l ? u(s, t, h) : u(h)) || h);
|
|
@@ -23,13 +23,13 @@ const p = class p extends _ {
|
|
|
23
23
|
super(...arguments);
|
|
24
24
|
f(this, o);
|
|
25
25
|
this._initiallyChecked = !1, y(this, o, new $(this)), this.debug = !1, this.checked = !1, this.customInvalid = !1, this.indeterminate = !1, this.lang = "en", this.showValid = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (t) => {
|
|
26
|
-
t.stopPropagation(), this.checked = this._initiallyChecked, this.$input && (this.$input.checked =
|
|
26
|
+
t.stopPropagation(), this.checked = this._initiallyChecked, this.$input && (this.$input.checked = this._initiallyChecked), this.setFormValue(this.checked ? this.value : null);
|
|
27
27
|
}, this._renderIcon = (t) => g`
|
|
28
28
|
<skf-icon color="inverse" name=${t} size=${this.size === "sm" ? "sm" : "md"}></skf-icon>
|
|
29
29
|
`;
|
|
30
30
|
}
|
|
31
31
|
_handleCheckedChange() {
|
|
32
|
-
this.setFormValue(this.checked ? this.value : null), this._validateInput(), this.$input && (this.$input.checked =
|
|
32
|
+
this.setFormValue(this.checked ? this.value : null), this._validateInput(), this.$input && (this.$input.checked = this.checked);
|
|
33
33
|
}
|
|
34
34
|
handleInvalidChange() {
|
|
35
35
|
this._invalid ? (this.setAttribute("invalid", ""), this.showValid && this.removeAttribute("valid"), this.checkValidity()) : (this.removeAttribute("invalid"), !this.pristine && this.showValid && this.setAttribute("valid", "true"));
|
|
@@ -49,7 +49,7 @@ const p = class p extends _ {
|
|
|
49
49
|
}
|
|
50
50
|
firstUpdated() {
|
|
51
51
|
this.$input?.addEventListener("change", (t) => {
|
|
52
|
-
t.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.
|
|
52
|
+
t.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.emit("change");
|
|
53
53
|
}), this.addEventListener("invalid", (t) => {
|
|
54
54
|
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && t.preventDefault();
|
|
55
55
|
}), this._initiallyChecked = this.checked, this.addEventListener("reset", this._resetValue), this._validateInput();
|
|
@@ -77,7 +77,7 @@ const p = class p extends _ {
|
|
|
77
77
|
?required=${this.required}
|
|
78
78
|
.indeterminate=${this.indeterminate}
|
|
79
79
|
aria-invalid=${!!this._invalid}
|
|
80
|
-
name=${
|
|
80
|
+
name=${w(this.name)}
|
|
81
81
|
type="checkbox"
|
|
82
82
|
value=${this.value}
|
|
83
83
|
/>
|
|
@@ -90,7 +90,7 @@ const p = class p extends _ {
|
|
|
90
90
|
`;
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
o = new WeakMap(), p.styles = [k,
|
|
93
|
+
o = new WeakMap(), p.styles = [k, E];
|
|
94
94
|
let e = p;
|
|
95
95
|
a([
|
|
96
96
|
r({ type: Boolean })
|
|
@@ -12,7 +12,7 @@ const i = [
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
color: var(--_skf-checkbox-color, var(--skf-text-color-primary));
|
|
14
14
|
display: grid;
|
|
15
|
-
|
|
15
|
+
gap: var(--skf-spacing-50);
|
|
16
16
|
grid-template: 'input label' / auto minmax(0, 1fr);
|
|
17
17
|
|
|
18
18
|
:host([disabled]) & {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P = (o) => {
|
|
2
2
|
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var D = (o, l, e) => (
|
|
4
|
+
var S = (o, l, e) => l.has(o) || P("Cannot " + e);
|
|
5
|
+
var D = (o, l, e) => (S(o, l, "read from private field"), e ? e.call(o) : l.get(o)), E = (o, l, e) => l.has(o) ? P("Cannot add the same private member more than once") : l instanceof WeakSet ? l.add(o) : l.set(o, e), C = (o, l, e, t) => (S(o, l, "write to private field"), t ? t.call(o, e) : l.set(o, e), e);
|
|
6
6
|
import "../icon/icon.js";
|
|
7
7
|
import { computePosition as T, flip as B, offset as x } from "@floating-ui/dom";
|
|
8
8
|
import { FormBase as R } from "../../internal/components/formBase.js";
|
|
@@ -73,7 +73,7 @@ const w = class w extends R {
|
|
|
73
73
|
}, this.clearInput = () => {
|
|
74
74
|
this.value = "", this.$datepickerPopup.clearSelection();
|
|
75
75
|
}, this._handleInput = (e) => {
|
|
76
|
-
const t = e.target, i =
|
|
76
|
+
const t = e.target, i = t.value.replace(/[^0-9-]/g, "");
|
|
77
77
|
if (t.value = i, t.setCustomValidity(this.customError ?? ""), !!m(t.value).ISO()) {
|
|
78
78
|
if (this.focusTimeoutId && clearTimeout(this.focusTimeoutId), this.$datepickerPopup.date = t.value, this.range) {
|
|
79
79
|
this.$datepickerPopup.selectedDateRange = {
|
|
@@ -205,9 +205,9 @@ const w = class w extends R {
|
|
|
205
205
|
this.invalid = !this._pristine && !t.valid;
|
|
206
206
|
let a;
|
|
207
207
|
for (a in t) {
|
|
208
|
-
const n = `data-${a
|
|
208
|
+
const n = `data-${a}`;
|
|
209
209
|
if (t[a]) {
|
|
210
|
-
this.validationError = a
|
|
210
|
+
this.validationError = a;
|
|
211
211
|
const c = this.hasAttribute(n) ? this.getAttribute(n) : i[a];
|
|
212
212
|
this._internals.setValidity(
|
|
213
213
|
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
|
@@ -4,6 +4,8 @@ const r = o`
|
|
|
4
4
|
@layer base {
|
|
5
5
|
:host {
|
|
6
6
|
display: inline-flex;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
user-select: none;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
#root {
|
|
@@ -13,8 +15,6 @@ const r = o`
|
|
|
13
15
|
block-size: var(--_skf-icon-size);
|
|
14
16
|
flex-shrink: 0; /* Prevents shrink when flex-child */
|
|
15
17
|
inline-size: var(--_skf-icon-size);
|
|
16
|
-
pointer-events: none;
|
|
17
|
-
user-select: none;
|
|
18
18
|
|
|
19
19
|
:host(:not([data-color='custom'])) & {
|
|
20
20
|
color: var(--_skf-icon-color);
|
|
@@ -2,9 +2,9 @@ var f = (a) => {
|
|
|
2
2
|
throw TypeError(a);
|
|
3
3
|
};
|
|
4
4
|
var b = (a, n, t) => n.has(a) || f("Cannot " + t);
|
|
5
|
-
var c = (a, n, t) => (b(a, n, "read from private field"), t ? t.call(a) : n.get(a)), _ = (a, n, t) => n.has(a) ? f("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t),
|
|
5
|
+
var c = (a, n, t) => (b(a, n, "read from private field"), t ? t.call(a) : n.get(a)), _ = (a, n, t) => n.has(a) ? f("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t), $ = (a, n, t, r) => (b(a, n, "write to private field"), r ? r.call(a, t) : n.set(a, t), t);
|
|
6
6
|
import "../icon/icon.js";
|
|
7
|
-
import { FormBase as
|
|
7
|
+
import { FormBase as g } from "../../internal/components/formBase.js";
|
|
8
8
|
import "../../internal/components/hint/hint.js";
|
|
9
9
|
import { hintSeverity as w } from "../../internal/helpers/hintSeverity.js";
|
|
10
10
|
import { watch as E } from "../../internal/helpers/watch.js";
|
|
@@ -22,14 +22,14 @@ var L = Object.defineProperty, D = Object.getOwnPropertyDescriptor, e = (a, n, t
|
|
|
22
22
|
(u = a[h]) && (o = (r ? u(n, t, o) : u(o)) || o);
|
|
23
23
|
return r && o && L(n, t, o), o;
|
|
24
24
|
}, d;
|
|
25
|
-
const y = class y extends
|
|
25
|
+
const y = class y extends g {
|
|
26
26
|
constructor() {
|
|
27
27
|
super(...arguments);
|
|
28
28
|
_(this, d);
|
|
29
|
-
|
|
29
|
+
$(this, d, new C(this)), this._value = "", this.autofocus = !1, this.debug = !1, this.hideLabel = !1, this.inputmode = "text", this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.type = "text", this.validateOn = "change", this.invalid = !1, this._buttonDown = !1, this._numberController = new A(this), this._passwordController = new V(this), this._handleInput = () => {
|
|
30
30
|
this._value = this.$input?.value ?? "", this.validateOn === "input" && (this._pristine = !1, this.validateInput());
|
|
31
31
|
}, this._resetValue = (t) => {
|
|
32
|
-
t.stopPropagation(), this.value = this.getAttribute("value")?.trim() ?? "", this._value = this.value, this._internals.setFormValue(this.value), this.$input?.focus(), this.
|
|
32
|
+
t.stopPropagation(), this.value = this.getAttribute("value")?.trim() ?? "", this._value = this.value, this._internals.setFormValue(this.value), this.$input?.focus(), this.emit("cleared");
|
|
33
33
|
}, this._handlePressStart = (t) => {
|
|
34
34
|
this._buttonDown = !0, this.type === "number" && this._numberController.handleActionBtnLongPressStart(t);
|
|
35
35
|
}, this._handlePressEnd = () => {
|
|
@@ -91,7 +91,7 @@ const y = class y extends $ {
|
|
|
91
91
|
}
|
|
92
92
|
firstUpdated() {
|
|
93
93
|
this.$input?.addEventListener("change", () => {
|
|
94
|
-
this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(this.$input?.value ?? ""), this.
|
|
94
|
+
this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(this.$input?.value ?? ""), this.emit("change"), this.validateInput();
|
|
95
95
|
}), this.addEventListener("invalid", (t) => {
|
|
96
96
|
this._pristine = !1, this.invalid = !0, this.customErrorDisplay && t.preventDefault();
|
|
97
97
|
}), this.value = this.getAttribute("value")?.trim() ?? "", this.autofocus && this.$input?.focus(), this.addEventListener("reset", this._resetValue), this.validateInput();
|
|
@@ -135,11 +135,11 @@ const y = class y extends $ {
|
|
|
135
135
|
this.invalid = !this._pristine && !r.valid;
|
|
136
136
|
let o;
|
|
137
137
|
for (o in r) {
|
|
138
|
-
const h = `data-${o
|
|
138
|
+
const h = `data-${o}`;
|
|
139
139
|
if (r[o] && !this.hasAttribute(h) && this.debug && console.log(
|
|
140
140
|
`Add custom message on ${this.localName} using attribute: ${h.toUpperCase()}="Your custom message"`
|
|
141
141
|
), r[o]) {
|
|
142
|
-
this.validationError = o
|
|
142
|
+
this.validationError = o;
|
|
143
143
|
const u = this.hasAttribute(h) ? this.getAttribute(h) : this.$input.validationMessage;
|
|
144
144
|
this._internals.setValidity(
|
|
145
145
|
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
|
@@ -24,7 +24,7 @@ const u = class u extends _ {
|
|
|
24
24
|
super(...arguments);
|
|
25
25
|
f(this, d);
|
|
26
26
|
y(this, d, new C(this)), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.customInvalid = !1, this.lang = "en", this.size = "md", this.showValid = !1, this.value = "", this._invalid = !1, this._resetValue = (t) => {
|
|
27
|
-
t.stopPropagation(), this.checked = this._initialChecked, this.$input && (this.$input.checked =
|
|
27
|
+
t.stopPropagation(), this.checked = this._initialChecked, this.$input && (this.$input.checked = this._initialChecked), this.setFormValue(this.checked ? this.value : "");
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
connectedCallback() {
|
|
@@ -32,7 +32,7 @@ const u = class u extends _ {
|
|
|
32
32
|
}
|
|
33
33
|
firstUpdated() {
|
|
34
34
|
this.$input?.addEventListener("change", (t) => {
|
|
35
|
-
t.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(""), this.
|
|
35
|
+
t.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(""), this.emit("change");
|
|
36
36
|
}), this.addEventListener("invalid", (t) => {
|
|
37
37
|
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && t.preventDefault();
|
|
38
38
|
}), this._initialChecked = this.checked, this.addEventListener("reset", this._resetValue);
|
|
@@ -12,7 +12,7 @@ const e = [
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
color: var(--_skf-radio-color, var(--skf-text-color-primary));
|
|
14
14
|
display: flex;
|
|
15
|
-
|
|
15
|
+
gap: var(--skf-spacing-50);
|
|
16
16
|
|
|
17
17
|
:host([disabled]) & {
|
|
18
18
|
--_skf-radio-color: var(--skf-interactive-text-color-disabled);
|
|
@@ -17,6 +17,8 @@ export declare class SkfSegmentedButtonItem extends SkfElement {
|
|
|
17
17
|
static styles: CSSResultGroup;
|
|
18
18
|
static shadowRootOptions: {
|
|
19
19
|
delegatesFocus: boolean;
|
|
20
|
+
clonable?: boolean;
|
|
21
|
+
customElementRegistry?: CustomElementRegistry;
|
|
20
22
|
mode: ShadowRootMode;
|
|
21
23
|
serializable?: boolean;
|
|
22
24
|
slotAssignment?: SlotAssignmentMode;
|
|
@@ -25,6 +25,8 @@ export declare class SkfSelectOption extends SkfElement {
|
|
|
25
25
|
static styles: CSSResultGroup;
|
|
26
26
|
static shadowRootOptions: {
|
|
27
27
|
delegatesFocus: boolean;
|
|
28
|
+
clonable?: boolean;
|
|
29
|
+
customElementRegistry?: CustomElementRegistry;
|
|
28
30
|
mode: ShadowRootMode;
|
|
29
31
|
serializable?: boolean;
|
|
30
32
|
slotAssignment?: SlotAssignmentMode;
|
|
@@ -30,7 +30,7 @@ const c = class c extends C {
|
|
|
30
30
|
this.textContent = t.trim();
|
|
31
31
|
}
|
|
32
32
|
get text() {
|
|
33
|
-
return this.textContent
|
|
33
|
+
return this.textContent.trim();
|
|
34
34
|
}
|
|
35
35
|
set value(t) {
|
|
36
36
|
this._value = t.trim();
|
|
@@ -69,7 +69,7 @@ const c = class c extends C {
|
|
|
69
69
|
/** @internal */
|
|
70
70
|
get _slotContainsOnlyText() {
|
|
71
71
|
return this._assignedNodes ? [...this._assignedNodes].every(
|
|
72
|
-
(i) => i.nodeType === Node.TEXT_NODE && i.textContent
|
|
72
|
+
(i) => i.nodeType === Node.TEXT_NODE && i.textContent.trim() !== ""
|
|
73
73
|
) : "";
|
|
74
74
|
}
|
|
75
75
|
render() {
|
|
@@ -146,7 +146,7 @@ export declare class SkfSelect extends FormBase {
|
|
|
146
146
|
/** @internal - on slot update, if value is set, select the corresponding option */
|
|
147
147
|
_ifValueIsSetSelectOption: () => void;
|
|
148
148
|
/** @internal - Computes the visible value of the select component - if multiple options are selected, shows a visually dimmed summary (meta info) */
|
|
149
|
-
_computeVisibleValue: () => string
|
|
149
|
+
_computeVisibleValue: () => string;
|
|
150
150
|
/** @internal */
|
|
151
151
|
private _validateInput;
|
|
152
152
|
render(): import("lit").TemplateResult<1>;
|
|
@@ -3,41 +3,41 @@ var _ = (l) => {
|
|
|
3
3
|
};
|
|
4
4
|
var v = (l, r, t) => r.has(l) || _("Cannot " + t);
|
|
5
5
|
var u = (l, r, t) => (v(l, r, "read from private field"), t ? t.call(l) : r.get(l)), g = (l, r, t) => r.has(l) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(l) : r.set(l, t), b = (l, r, t, e) => (v(l, r, "write to private field"), e ? e.call(l, t) : r.set(l, t), t);
|
|
6
|
-
import { SkfSelectOptionGroup as
|
|
6
|
+
import { SkfSelectOptionGroup as S } from "./select-option-group.component.js";
|
|
7
7
|
import "../tag/tag.js";
|
|
8
8
|
import { computePosition as x, flip as C, shift as V, offset as $ } from "@floating-ui/dom";
|
|
9
9
|
import { FormBase as L } from "../../internal/components/formBase.js";
|
|
10
10
|
import "../../internal/components/hint/hint.js";
|
|
11
|
-
import { PopoverController as
|
|
12
|
-
import { findMatchingTags as
|
|
11
|
+
import { PopoverController as k } from "../../internal/controllers/popover.controller.js";
|
|
12
|
+
import { findMatchingTags as E } from "../../internal/helpers/findMatchingTags.js";
|
|
13
13
|
import { hintSeverity as A } from "../../internal/helpers/hintSeverity.js";
|
|
14
14
|
import { raiseError as I } from "../../internal/helpers/raiseError.js";
|
|
15
|
-
import { watch as
|
|
15
|
+
import { watch as w } from "../../internal/helpers/watch.js";
|
|
16
16
|
import { Asterisk as D } from "../../internal/templates/asterisk.js";
|
|
17
17
|
import { componentStyles as P } from "../../styles/component.styles.js";
|
|
18
18
|
import { LocalizeController as F } from "../../utilities/localize.js";
|
|
19
19
|
import { nothing as y, html as p } from "lit";
|
|
20
|
-
import { property as
|
|
20
|
+
import { property as a, state as c, query as m, queryAssignedElements as T } from "lit/decorators.js";
|
|
21
21
|
import { classMap as z } from "lit/directives/class-map.js";
|
|
22
22
|
import { ifDefined as O } from "lit/directives/if-defined.js";
|
|
23
23
|
import { SkfSelectOption as U } from "./select-option.component.js";
|
|
24
24
|
import { GlobalClickController as M, KeyboardNavigationController as B, DeveloperFeedbackController as N } from "./select.controllers.js";
|
|
25
25
|
import { styles as H } from "./select.styles.js";
|
|
26
26
|
var q = Object.defineProperty, R = Object.getOwnPropertyDescriptor, s = (l, r, t, e) => {
|
|
27
|
-
for (var o = e > 1 ? void 0 : e ? R(r, t) : r,
|
|
28
|
-
(h = l[
|
|
27
|
+
for (var o = e > 1 ? void 0 : e ? R(r, t) : r, n = l.length - 1, h; n >= 0; n--)
|
|
28
|
+
(h = l[n]) && (o = (e ? h(r, t, o) : h(o)) || o);
|
|
29
29
|
return e && o && q(r, t, o), o;
|
|
30
30
|
}, d;
|
|
31
31
|
const f = class f extends L {
|
|
32
32
|
constructor() {
|
|
33
33
|
super();
|
|
34
34
|
g(this, d);
|
|
35
|
-
b(this, d, new F(this)), this._componentIsConnected = !1, this._defaultButtonLabel = "Select an option", this.selectDelay = 200, this._optionsList = [], this.buttonLabel = this._defaultButtonLabel, this.hideLabel = !1, this.hideTags = !1, this.lang = "en", this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new M(this), this.keyboardNavController = new B(this), this.developerFeedbackController = new N(this), this.popoverController = new
|
|
35
|
+
b(this, d, new F(this)), this._componentIsConnected = !1, this._defaultButtonLabel = "Select an option", this.selectDelay = 200, this._optionsList = [], this.buttonLabel = this._defaultButtonLabel, this.hideLabel = !1, this.hideTags = !1, this.lang = "en", this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new M(this), this.keyboardNavController = new B(this), this.developerFeedbackController = new N(this), this.popoverController = new k(this), this._handleOptionSelected = (t) => {
|
|
36
36
|
this._pristine = !1;
|
|
37
37
|
const e = this._selectedOptions.length > 0;
|
|
38
38
|
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
|
39
39
|
}, this._handleReset = () => {
|
|
40
|
-
this.
|
|
40
|
+
this.emit("reset"), this._resetSelectedOptions();
|
|
41
41
|
}, this._updateWidth = () => {
|
|
42
42
|
setTimeout(() => {
|
|
43
43
|
this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
|
@@ -69,7 +69,7 @@ const f = class f extends L {
|
|
|
69
69
|
default:
|
|
70
70
|
throw new Error("Something went wrong");
|
|
71
71
|
}
|
|
72
|
-
this._componentIsConnected && this.
|
|
72
|
+
this._componentIsConnected && this.emit("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
|
|
73
73
|
this.multiple || (this._expanded = !1), t("done");
|
|
74
74
|
});
|
|
75
75
|
}), this._resetSelectedOptions = (t) => {
|
|
@@ -78,11 +78,11 @@ const f = class f extends L {
|
|
|
78
78
|
(e || o !== t) && o.removeAttribute("selected");
|
|
79
79
|
}), this._optionsList = [];
|
|
80
80
|
}, this._handleSlotChange = () => {
|
|
81
|
-
this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0, this.
|
|
81
|
+
this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0, this.emit("skf-select-connected");
|
|
82
82
|
}, this._ifValueIsSetSelectOption = () => {
|
|
83
83
|
if (this.value)
|
|
84
84
|
if (this.multiple) {
|
|
85
|
-
const t =
|
|
85
|
+
const t = this.value.split(",").map((e) => e.toLowerCase().trim());
|
|
86
86
|
this._optionsList.forEach((e) => {
|
|
87
87
|
t.includes(e.value.toLowerCase().trim()) ? (e.setSelectedDiscrete = !0, this.selectedOptions = [...this.selectedOptions, e]) : (e.setSelectedDiscrete = !1, this._selectedOptions = this._selectedOptions.filter(
|
|
88
88
|
(o) => o.value.toLowerCase().trim() !== e.value.toLowerCase().trim()
|
|
@@ -110,15 +110,15 @@ const f = class f extends L {
|
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
112
|
get selectedOptionsText() {
|
|
113
|
-
return this._selectedOptions.map((t) => t.textContent
|
|
113
|
+
return this._selectedOptions.map((t) => t.textContent);
|
|
114
114
|
}
|
|
115
115
|
set value(t) {
|
|
116
116
|
let e = [];
|
|
117
|
-
this._componentIsConnected && (this.multiple ? e =
|
|
118
|
-
(
|
|
119
|
-
), this._optionsList.forEach((
|
|
120
|
-
|
|
121
|
-
}), this._selectedOptions.forEach((
|
|
117
|
+
this._componentIsConnected && (this.multiple ? e = t.split(",").map((n) => n.toLowerCase().trim()) : e = [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();
|
|
122
122
|
}
|
|
123
123
|
get value() {
|
|
124
124
|
return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
|
|
@@ -143,7 +143,7 @@ const f = class f extends L {
|
|
|
143
143
|
if (this._invalid) {
|
|
144
144
|
this.setAttribute("invalid", ""), this.showValid && this.removeAttribute("valid");
|
|
145
145
|
const e = this._internals.validationMessage;
|
|
146
|
-
this.hint = e !== "" ? this._internals.validationMessage : "", this.checkValidity(), this.
|
|
146
|
+
this.hint = e !== "" ? this._internals.validationMessage : "", this.checkValidity(), this.emit("invalid");
|
|
147
147
|
} else
|
|
148
148
|
this.removeAttribute("invalid"), !this._pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = this.getAttribute("hint") ?? "";
|
|
149
149
|
}
|
|
@@ -152,7 +152,7 @@ const f = class f extends L {
|
|
|
152
152
|
}
|
|
153
153
|
_handleSizeUpdate() {
|
|
154
154
|
this._slottedItems.forEach((t) => {
|
|
155
|
-
(t instanceof U || t instanceof
|
|
155
|
+
(t instanceof U || t instanceof S) && (t.small = this.size === "sm");
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
_handleExpandedChange() {
|
|
@@ -198,7 +198,7 @@ const f = class f extends L {
|
|
|
198
198
|
/** @internal */
|
|
199
199
|
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
|
200
200
|
_collectSlotOptionTags() {
|
|
201
|
-
this._optionsList =
|
|
201
|
+
this._optionsList = E(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), I({
|
|
202
202
|
assert: this._optionsList.length > 0,
|
|
203
203
|
reason: "no-children",
|
|
204
204
|
replaceStrings: [this.localName, "skf-select-option"]
|
|
@@ -258,9 +258,9 @@ const f = class f extends L {
|
|
|
258
258
|
${this.selectedOptions.map(
|
|
259
259
|
(t) => p`
|
|
260
260
|
<skf-tag
|
|
261
|
-
style="${`view-transition-name: tag-${
|
|
261
|
+
style="${`view-transition-name: tag-${t.textContent.replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
|
262
262
|
removable
|
|
263
|
-
.
|
|
263
|
+
.callbackOnRemove=${(e) => (e.stopPropagation(), e.preventDefault(), document.startViewTransition || t.removeAttribute("selected"), document.startViewTransition(() => {
|
|
264
264
|
t.removeAttribute("selected");
|
|
265
265
|
}), !1)}
|
|
266
266
|
>
|
|
@@ -288,58 +288,58 @@ const f = class f extends L {
|
|
|
288
288
|
d = new WeakMap(), f.styles = [P, H];
|
|
289
289
|
let i = f;
|
|
290
290
|
s([
|
|
291
|
-
|
|
291
|
+
a({ type: String, reflect: !0, attribute: "button-label" })
|
|
292
292
|
], i.prototype, "buttonLabel", 2);
|
|
293
293
|
s([
|
|
294
|
-
|
|
294
|
+
a({ type: String, attribute: "custom-invalid" })
|
|
295
295
|
], i.prototype, "customInvalid", 2);
|
|
296
296
|
s([
|
|
297
|
-
|
|
297
|
+
a({ type: Boolean, attribute: "hide-label" })
|
|
298
298
|
], i.prototype, "hideLabel", 2);
|
|
299
299
|
s([
|
|
300
|
-
|
|
300
|
+
a({ type: Boolean, reflect: !0, attribute: "hide-tags" })
|
|
301
301
|
], i.prototype, "hideTags", 2);
|
|
302
302
|
s([
|
|
303
|
-
|
|
303
|
+
a({ type: String })
|
|
304
304
|
], i.prototype, "hint", 2);
|
|
305
305
|
s([
|
|
306
|
-
|
|
306
|
+
a({ type: Array, attribute: !1 })
|
|
307
307
|
], i.prototype, "selectedValues", 1);
|
|
308
308
|
s([
|
|
309
|
-
|
|
309
|
+
a({ type: Array, attribute: !1 })
|
|
310
310
|
], i.prototype, "selectedOptionsText", 1);
|
|
311
311
|
s([
|
|
312
|
-
|
|
312
|
+
a({ type: String, reflect: !0 })
|
|
313
313
|
], i.prototype, "label", 2);
|
|
314
314
|
s([
|
|
315
|
-
|
|
315
|
+
a({ type: String })
|
|
316
316
|
], i.prototype, "lang", 2);
|
|
317
317
|
s([
|
|
318
|
-
|
|
318
|
+
a({ type: Number })
|
|
319
319
|
], i.prototype, "max", 2);
|
|
320
320
|
s([
|
|
321
|
-
|
|
321
|
+
a({ type: Number, attribute: "max-visible-items" })
|
|
322
322
|
], i.prototype, "maxVisibleItems", 2);
|
|
323
323
|
s([
|
|
324
|
-
|
|
324
|
+
a({ type: Number })
|
|
325
325
|
], i.prototype, "min", 2);
|
|
326
326
|
s([
|
|
327
|
-
|
|
327
|
+
a({ type: Boolean, reflect: !0 })
|
|
328
328
|
], i.prototype, "multiple", 2);
|
|
329
329
|
s([
|
|
330
|
-
|
|
330
|
+
a({ type: String })
|
|
331
331
|
], i.prototype, "name", 2);
|
|
332
332
|
s([
|
|
333
|
-
|
|
333
|
+
a()
|
|
334
334
|
], i.prototype, "severity", 2);
|
|
335
335
|
s([
|
|
336
|
-
|
|
336
|
+
a({ type: Boolean, attribute: "show-valid" })
|
|
337
337
|
], i.prototype, "showValid", 2);
|
|
338
338
|
s([
|
|
339
|
-
|
|
339
|
+
a({ reflect: !0 })
|
|
340
340
|
], i.prototype, "size", 2);
|
|
341
341
|
s([
|
|
342
|
-
|
|
342
|
+
a({ type: String, attribute: !1 })
|
|
343
343
|
], i.prototype, "value", 1);
|
|
344
344
|
s([
|
|
345
345
|
c()
|
|
@@ -366,10 +366,10 @@ s([
|
|
|
366
366
|
T()
|
|
367
367
|
], i.prototype, "_slottedItems", 2);
|
|
368
368
|
s([
|
|
369
|
-
|
|
369
|
+
w("size", { waitUntilFirstUpdate: !0 })
|
|
370
370
|
], i.prototype, "_handleSizeUpdate", 1);
|
|
371
371
|
s([
|
|
372
|
-
|
|
372
|
+
w("_expanded", { afterUpdate: !0 })
|
|
373
373
|
], i.prototype, "_handleExpandedChange", 1);
|
|
374
374
|
export {
|
|
375
375
|
i as SkfSelect
|
|
@@ -22,11 +22,11 @@ const o = class o extends _ {
|
|
|
22
22
|
super(...arguments);
|
|
23
23
|
f(this, r);
|
|
24
24
|
m(this, r, new g(this)), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.hideLabel = !1, this.lang = "en", this.size = "md", this.value = "", this._invalid = !1, this._handleChange = (e) => {
|
|
25
|
-
e.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(null), this.
|
|
25
|
+
e.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(null), this.emit("change");
|
|
26
26
|
}, this._handleInvalid = (e) => {
|
|
27
27
|
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && e.preventDefault();
|
|
28
28
|
}, this._resetValue = (e) => {
|
|
29
|
-
e.stopPropagation(), this.checked = this._initialChecked, this.$input && (this.$input.checked =
|
|
29
|
+
e.stopPropagation(), this.checked = this._initialChecked, this.$input && (this.$input.checked = this._initialChecked), this.setFormValue(this.checked ? this.value : null);
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
connectedCallback() {
|
|
@@ -13,7 +13,7 @@ const o = [
|
|
|
13
13
|
align-items: center;
|
|
14
14
|
color: var(--_skf-switch-color, var(--skf-text-color-primary));
|
|
15
15
|
display: flex;
|
|
16
|
-
|
|
16
|
+
gap: var(--skf-spacing-50);
|
|
17
17
|
|
|
18
18
|
&:has(:disabled) {
|
|
19
19
|
--_skf-switch-color: var(--skf-interactive-text-color-disabled);
|
|
@@ -19,9 +19,11 @@ export declare class SkfTag extends SkfElement {
|
|
|
19
19
|
/** @internal */
|
|
20
20
|
private _clickCallback?;
|
|
21
21
|
/** @internal */
|
|
22
|
-
private
|
|
22
|
+
private _callbackOnRemove?;
|
|
23
23
|
/** Specifies Tag size */
|
|
24
24
|
size: Size;
|
|
25
|
+
/** If defined, prevents DOM updates. I.e in React, Preact handle self removal externally in virtual DOM. */
|
|
26
|
+
preventDomUpdates: boolean;
|
|
25
27
|
/** If defined, displays leading/provided icon */
|
|
26
28
|
icon?: Icon;
|
|
27
29
|
/** If defined, gives the supplied appearance */
|
|
@@ -32,8 +34,8 @@ export declare class SkfTag extends SkfElement {
|
|
|
32
34
|
set clickCallback(clickCallbackFn: ((event: Event) => void) | undefined);
|
|
33
35
|
get clickCallback(): ((event: Event) => void) | undefined;
|
|
34
36
|
/** If defined, accepts a function that runs on click. Self removal can be overridden by using `event.stopPropagation()`. */
|
|
35
|
-
set
|
|
36
|
-
get
|
|
37
|
+
set callbackOnRemove(callbackOnRemoveFn: ((event: Event) => void) | undefined);
|
|
38
|
+
get callbackOnRemove(): ((event: Event) => void) | undefined;
|
|
37
39
|
/** If true, adds trailing button to remove tag */
|
|
38
40
|
removable: boolean;
|
|
39
41
|
/** @internal */
|