@skf-design-system/ui-components 1.0.2-beta.5 → 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/accordion/accordion.component.d.ts +1 -1
- package/dist/components/accordion/accordion.component.js +2 -2
- 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 +151 -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.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 +11 -4
- package/dist/components/drawer/drawer.component.js +77 -55
- 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 +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 +147 -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.d.ts +15 -18
- package/dist/components/link/link.component.js +105 -107
- package/dist/components/link/link.styles.js +53 -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/menu/menu-item.component.d.ts +1 -1
- package/dist/components/menu/menu-item.component.js +8 -8
- 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/nav/nav-item.component.d.ts +4 -0
- 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.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/progress/progress.component.d.ts +2 -0
- package/dist/components/progress/progress.component.js +38 -29
- package/dist/components/progress/progress.styles.js +4 -4
- 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-group.component.d.ts +4 -0
- package/dist/components/select/select-option-group.component.js +37 -18
- package/dist/components/select/select-option-group.style.js +12 -6
- package/dist/components/select/select-option.component.d.ts +7 -2
- package/dist/components/select/select-option.component.js +70 -53
- package/dist/components/select/select-option.styles.js +43 -31
- package/dist/components/select/select.component.d.ts +18 -10
- package/dist/components/select/select.component.js +175 -132
- package/dist/components/select/select.controllers.js +2 -1
- 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 +26 -23
- 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-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +19 -16
- package/dist/components/tabs/tab.component.d.ts +1 -1
- package/dist/components/tabs/tab.component.js +17 -14
- package/dist/components/tabs/tab.styles.js +2 -2
- package/dist/components/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 +127 -118
- 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 +18 -18
- package/dist/components/tooltip/tooltip.component.d.ts +9 -2
- package/dist/components/tooltip/tooltip.component.js +13 -7
- package/dist/custom-elements.json +1305 -946
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -20
- package/dist/internal/base-classes/popover/popover.base.d.ts +24 -5
- package/dist/internal/base-classes/popover/popover.base.js +28 -29
- package/dist/internal/base-classes/popover/popover.styles.js +4 -5
- 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/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/internal/types.d.ts +4 -0
- package/dist/styles/global-alt.css +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +27 -0
- package/dist/translations/es.d.ts +3 -0
- package/dist/translations/es.js +27 -0
- package/dist/translations/index.d.ts +4 -0
- package/dist/translations/pt.d.ts +3 -0
- package/dist/translations/pt.js +27 -0
- package/dist/translations/sv.d.ts +3 -0
- package/dist/translations/sv.js +27 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +243 -128
- package/dist/types/vue/index.d.ts +136 -127
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +168 -177
- package/dist/web-types.json +411 -381
- package/package.json +34 -41
@@ -1,32 +1,40 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { watch as n } from "../../internal/helpers/watch.js";
|
4
|
-
import { Asterisk as p } from "../../internal/templates/asterisk.js";
|
5
|
-
import { componentStyles as v } from "../../styles/component.styles.js";
|
6
|
-
import { html as m } from "lit";
|
7
|
-
import { property as r, state as f, query as y } from "lit/decorators.js";
|
8
|
-
import { ifDefined as b } from "lit/directives/if-defined.js";
|
9
|
-
import { live as _ } from "lit/directives/live.js";
|
10
|
-
import { styles as g } from "./radio.styles.js";
|
11
|
-
var k = Object.defineProperty, C = Object.getOwnPropertyDescriptor, i = (u, e, s, l) => {
|
12
|
-
for (var a = l > 1 ? void 0 : l ? C(e, s) : e, o = u.length - 1, h; o >= 0; o--)
|
13
|
-
(h = u[o]) && (a = (l ? h(e, s, a) : h(a)) || a);
|
14
|
-
return l && a && k(e, s, a), a;
|
1
|
+
var p = (e) => {
|
2
|
+
throw TypeError(e);
|
15
3
|
};
|
16
|
-
|
4
|
+
var m = (e, i, t) => i.has(e) || p("Cannot " + t);
|
5
|
+
var v = (e, i, t) => (m(e, i, "read from private field"), t ? t.call(e) : i.get(e)), f = (e, i, t) => i.has(e) ? p("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t), y = (e, i, t, s) => (m(e, i, "write to private field"), s ? s.call(e, t) : i.set(e, t), t);
|
6
|
+
import "../icon/icon.js";
|
7
|
+
import { FormBase as _ } from "../../internal/components/formBase.js";
|
8
|
+
import { watch as c } from "../../internal/helpers/watch.js";
|
9
|
+
import { Asterisk as b } from "../../internal/templates/asterisk.js";
|
10
|
+
import { componentStyles as k } from "../../styles/component.styles.js";
|
11
|
+
import { LocalizeController as C } from "../../utilities/localize.js";
|
12
|
+
import { nothing as V, html as $ } from "lit";
|
13
|
+
import { property as l, state as I, query as E } from "lit/decorators.js";
|
14
|
+
import { ifDefined as w } from "lit/directives/if-defined.js";
|
15
|
+
import { live as A } from "lit/directives/live.js";
|
16
|
+
import { styles as q } from "./radio.styles.js";
|
17
|
+
var F = Object.defineProperty, D = Object.getOwnPropertyDescriptor, r = (e, i, t, s) => {
|
18
|
+
for (var o = s > 1 ? void 0 : s ? D(i, t) : i, h = e.length - 1, n; h >= 0; h--)
|
19
|
+
(n = e[h]) && (o = (s ? n(i, t, o) : n(o)) || o);
|
20
|
+
return s && o && F(i, t, o), o;
|
21
|
+
}, d;
|
22
|
+
const u = class u extends _ {
|
17
23
|
constructor() {
|
18
|
-
super(...arguments)
|
19
|
-
|
24
|
+
super(...arguments);
|
25
|
+
f(this, d);
|
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 = !!this._initialChecked), this.setFormValue(this.checked ? this.value : "");
|
20
28
|
};
|
21
29
|
}
|
22
30
|
connectedCallback() {
|
23
31
|
super.connectedCallback(), this._validateInput();
|
24
32
|
}
|
25
33
|
firstUpdated() {
|
26
|
-
var
|
27
|
-
(
|
28
|
-
var
|
29
|
-
s.stopPropagation(), this.pristine = !1, this.checked = ((
|
34
|
+
var t;
|
35
|
+
(t = this.$input) == null || t.addEventListener("change", (s) => {
|
36
|
+
var o;
|
37
|
+
s.stopPropagation(), this.pristine = !1, this.checked = ((o = this.$input) == null ? void 0 : o.checked) ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(""), this.emitEvent("change");
|
30
38
|
}), this.addEventListener("invalid", (s) => {
|
31
39
|
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && s.preventDefault();
|
32
40
|
}), this._initialChecked = this.checked, this.addEventListener("reset", this._resetValue);
|
@@ -52,16 +60,16 @@ const d = class d extends c {
|
|
52
60
|
}
|
53
61
|
/** @internal */
|
54
62
|
_uncheckSiblingRadios() {
|
55
|
-
const
|
56
|
-
if (!
|
57
|
-
(this.form ?? document).querySelectorAll(`skf-radio[name="${
|
58
|
-
const
|
59
|
-
|
63
|
+
const t = this.name;
|
64
|
+
if (!t) return;
|
65
|
+
(this.form ?? document).querySelectorAll(`skf-radio[name="${t}"]`).forEach((h) => {
|
66
|
+
const n = this.form === h.form, g = !this.form && !h.form;
|
67
|
+
h !== this && (n || g) && (h.checked = !1);
|
60
68
|
});
|
61
69
|
}
|
62
70
|
/** @internal */
|
63
71
|
_validateInput() {
|
64
|
-
var
|
72
|
+
var t;
|
65
73
|
if (this._invalid = !1, this.customInvalid) {
|
66
74
|
const s = this.getAttribute("data-customerror");
|
67
75
|
this.setValidity({ customError: !0 }, this.withFallback(s)), this._invalid = !0;
|
@@ -69,82 +77,82 @@ const d = class d extends c {
|
|
69
77
|
this.pristine || (this._invalid = !0);
|
70
78
|
const s = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
71
79
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
72
|
-
((
|
80
|
+
((t = this.$input) == null ? void 0 : t.validationMessage) || "Please check this radio if you want to proceed"
|
73
81
|
);
|
74
82
|
this.setValidity({ valueMissing: !0 }, this.withFallback(s));
|
75
83
|
} else
|
76
84
|
this.setValidity({});
|
77
85
|
}
|
78
86
|
render() {
|
79
|
-
return
|
87
|
+
return $`
|
80
88
|
<label id="root">
|
81
89
|
<input
|
82
90
|
?disabled=${this.disabled}
|
83
91
|
?required=${this.required}
|
84
|
-
.checked=${
|
92
|
+
.checked=${A(this.checked)}
|
85
93
|
aria-invalid=${!!this._invalid}
|
86
|
-
name=${
|
94
|
+
name=${w(this.name)}
|
87
95
|
type="radio"
|
88
96
|
value=${this.value}
|
89
97
|
/>
|
90
98
|
<div id="label">
|
91
99
|
<slot>${this.label}</slot>
|
92
|
-
${this.required ?
|
100
|
+
${this.required ? b(v(this, d).term("required")) : V}
|
93
101
|
</div>
|
94
102
|
</label>
|
95
103
|
`;
|
96
104
|
}
|
97
105
|
};
|
98
|
-
d.styles = [
|
99
|
-
let
|
100
|
-
|
101
|
-
|
102
|
-
],
|
103
|
-
|
104
|
-
|
105
|
-
],
|
106
|
-
|
107
|
-
|
108
|
-
],
|
109
|
-
|
110
|
-
|
111
|
-
],
|
112
|
-
|
113
|
-
|
114
|
-
],
|
115
|
-
|
116
|
-
|
117
|
-
],
|
118
|
-
|
119
|
-
|
120
|
-
],
|
121
|
-
|
122
|
-
|
123
|
-
],
|
124
|
-
|
125
|
-
|
126
|
-
],
|
127
|
-
|
128
|
-
|
129
|
-
],
|
130
|
-
|
131
|
-
|
132
|
-
],
|
133
|
-
|
134
|
-
|
135
|
-
],
|
136
|
-
|
137
|
-
|
138
|
-
],
|
139
|
-
|
140
|
-
|
141
|
-
],
|
142
|
-
|
143
|
-
|
144
|
-
],
|
145
|
-
|
146
|
-
|
147
|
-
],
|
106
|
+
d = new WeakMap(), u.styles = [k, q];
|
107
|
+
let a = u;
|
108
|
+
r([
|
109
|
+
l({ type: Boolean })
|
110
|
+
], a.prototype, "debug", 2);
|
111
|
+
r([
|
112
|
+
l({ type: Boolean, reflect: !0 })
|
113
|
+
], a.prototype, "checked", 2);
|
114
|
+
r([
|
115
|
+
l({ type: Boolean, attribute: "custom-invalid" })
|
116
|
+
], a.prototype, "customInvalid", 2);
|
117
|
+
r([
|
118
|
+
l()
|
119
|
+
], a.prototype, "label", 2);
|
120
|
+
r([
|
121
|
+
l({ type: String })
|
122
|
+
], a.prototype, "lang", 2);
|
123
|
+
r([
|
124
|
+
l()
|
125
|
+
], a.prototype, "name", 2);
|
126
|
+
r([
|
127
|
+
l({ reflect: !0 })
|
128
|
+
], a.prototype, "size", 2);
|
129
|
+
r([
|
130
|
+
l()
|
131
|
+
], a.prototype, "severity", 2);
|
132
|
+
r([
|
133
|
+
l({ type: Boolean, attribute: "show-valid" })
|
134
|
+
], a.prototype, "showValid", 2);
|
135
|
+
r([
|
136
|
+
l()
|
137
|
+
], a.prototype, "value", 2);
|
138
|
+
r([
|
139
|
+
I()
|
140
|
+
], a.prototype, "_invalid", 2);
|
141
|
+
r([
|
142
|
+
E("input")
|
143
|
+
], a.prototype, "$input", 2);
|
144
|
+
r([
|
145
|
+
c("_invalid")
|
146
|
+
], a.prototype, "handleInvalidChange", 1);
|
147
|
+
r([
|
148
|
+
c("_invalid", { afterUpdate: !0 })
|
149
|
+
], a.prototype, "handleDebugInvalid", 1);
|
150
|
+
r([
|
151
|
+
c("checked")
|
152
|
+
], a.prototype, "handleCheckedChanged", 1);
|
153
|
+
r([
|
154
|
+
c("customInvalid")
|
155
|
+
], a.prototype, "handleCustomInvalidChange", 1);
|
148
156
|
export {
|
149
|
-
|
157
|
+
a as SkfRadio
|
150
158
|
};
|
@@ -31,7 +31,7 @@ const s = class s extends n {
|
|
31
31
|
type="button"
|
32
32
|
value=${this.value}
|
33
33
|
>
|
34
|
-
${this.selected ? c`<skf-icon color="
|
34
|
+
${this.selected ? c`<skf-icon color="emphasized" name="check" size="sm"></skf-icon>` : m}
|
35
35
|
<slot></slot>
|
36
36
|
</button>
|
37
37
|
`;
|
@@ -37,7 +37,7 @@ const o = e`
|
|
37
37
|
}
|
38
38
|
|
39
39
|
&:is([aria-checked='true'], [aria-pressed='true']) {
|
40
|
-
--_skf-segmented-button-item-border: var(--skf-border-color-
|
40
|
+
--_skf-segmented-button-item-border: var(--skf-border-color-emphasized);
|
41
41
|
}
|
42
42
|
|
43
43
|
&:hover:not(:disabled) {
|
@@ -10,7 +10,11 @@ import { type CSSResultGroup } from 'lit';
|
|
10
10
|
* @tagname skf-select-option-group
|
11
11
|
*/
|
12
12
|
export declare class SkfSelectOptionGroup extends SkfElement {
|
13
|
+
#private;
|
13
14
|
static styles: CSSResultGroup;
|
14
15
|
label: string;
|
16
|
+
small: boolean;
|
17
|
+
/** @internal */
|
18
|
+
_handleStateChange(): void;
|
15
19
|
render(): import("lit").TemplateResult<1>;
|
16
20
|
}
|
@@ -1,19 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { html as p } from "lit";
|
4
|
-
import { property as d } from "lit/decorators.js";
|
5
|
-
import { styles as n } from "./select-option-group.style.js";
|
6
|
-
var v = Object.defineProperty, u = (o, s, i, b) => {
|
7
|
-
for (var r = void 0, e = o.length - 1, m; e >= 0; e--)
|
8
|
-
(m = o[e]) && (r = m(s, i, r) || r);
|
9
|
-
return r && v(s, i, r), r;
|
1
|
+
var b = (t) => {
|
2
|
+
throw TypeError(t);
|
10
3
|
};
|
11
|
-
|
4
|
+
var d = (t, e, s) => e.has(t) || b("Cannot " + s);
|
5
|
+
var h = (t, e, s) => (d(t, e, "read from private field"), s ? s.call(t) : e.get(t)), n = (t, e, s) => e.has(t) ? b("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), f = (t, e, s, r) => (d(t, e, "write to private field"), r ? r.call(t, s) : e.set(t, s), s);
|
6
|
+
import { SkfElement as u } from "../../internal/components/skf-element.js";
|
7
|
+
import { stateMap as y } from "../../internal/helpers/stateMap.js";
|
8
|
+
import { watch as _ } from "../../internal/helpers/watch.js";
|
9
|
+
import { componentStyles as g } from "../../styles/component.styles.js";
|
10
|
+
import { html as P } from "lit";
|
11
|
+
import { property as w, state as C } from "lit/decorators.js";
|
12
|
+
import { styles as D } from "./select-option-group.style.js";
|
13
|
+
var j = Object.defineProperty, x = Object.getOwnPropertyDescriptor, v = (t, e, s, r) => {
|
14
|
+
for (var l = r > 1 ? void 0 : r ? x(e, s) : e, i = t.length - 1, p; i >= 0; i--)
|
15
|
+
(p = t[i]) && (l = (r ? p(e, s, l) : p(l)) || l);
|
16
|
+
return r && l && j(e, s, l), l;
|
17
|
+
}, o, m;
|
18
|
+
const c = class c extends u {
|
12
19
|
constructor() {
|
13
|
-
super(...arguments)
|
20
|
+
super(...arguments);
|
21
|
+
n(this, o);
|
22
|
+
n(this, m);
|
23
|
+
f(this, o, this.attachInternals()), f(this, m, h(this, o).states), this.label = "Default label", this.small = !1;
|
24
|
+
}
|
25
|
+
_handleStateChange() {
|
26
|
+
y(h(this, m), "small").set(this.small);
|
14
27
|
}
|
15
28
|
render() {
|
16
|
-
return
|
29
|
+
return P`
|
17
30
|
<div role="group">
|
18
31
|
<div id="label">${this.label}</div>
|
19
32
|
<slot></slot>
|
@@ -21,11 +34,17 @@ const l = class l extends a {
|
|
21
34
|
`;
|
22
35
|
}
|
23
36
|
};
|
24
|
-
|
25
|
-
let
|
26
|
-
|
27
|
-
|
28
|
-
],
|
37
|
+
o = new WeakMap(), m = new WeakMap(), c.styles = [g, D];
|
38
|
+
let a = c;
|
39
|
+
v([
|
40
|
+
w({ reflect: !0 })
|
41
|
+
], a.prototype, "label", 2);
|
42
|
+
v([
|
43
|
+
C()
|
44
|
+
], a.prototype, "small", 2);
|
45
|
+
v([
|
46
|
+
_("small")
|
47
|
+
], a.prototype, "_handleStateChange", 1);
|
29
48
|
export {
|
30
|
-
|
49
|
+
a as SkfSelectOptionGroup
|
31
50
|
};
|
@@ -1,13 +1,19 @@
|
|
1
1
|
import { css as e } from "lit";
|
2
2
|
const t = e`
|
3
3
|
@layer components {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
display: flex;
|
8
|
-
font-weight: var(--skf-font-weight-bold);
|
4
|
+
@layer base {
|
5
|
+
#label {
|
6
|
+
--_skf-select-option-group-height: var(--skf-size-44);
|
9
7
|
|
10
|
-
|
8
|
+
align-items: center;
|
9
|
+
block-size: var(--_skf-select-option-group-height);
|
10
|
+
display: flex;
|
11
|
+
font-weight: var(--skf-font-weight-bold);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
@layer mods {
|
16
|
+
:host(:state(small)) #label {
|
11
17
|
--_skf-select-option-group-height: var(--skf-size-32);
|
12
18
|
}
|
13
19
|
}
|
@@ -9,6 +9,7 @@ export interface SelectOptionEvent {
|
|
9
9
|
}
|
10
10
|
/**
|
11
11
|
* The `<skf-select-option>` is a component is used nested in a skf-select or skf-select-option-group.
|
12
|
+
* It represents an individual option in a select dropdown.
|
12
13
|
*
|
13
14
|
* @documentation See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/6229d63d9fe16020a60657e5) for design principles
|
14
15
|
*
|
@@ -20,6 +21,7 @@ export interface SelectOptionEvent {
|
|
20
21
|
* @tagname skf-select-option
|
21
22
|
*/
|
22
23
|
export declare class SkfSelectOption extends SkfElement {
|
24
|
+
#private;
|
23
25
|
static styles: CSSResultGroup;
|
24
26
|
static shadowRootOptions: {
|
25
27
|
delegatesFocus: boolean;
|
@@ -50,19 +52,22 @@ export declare class SkfSelectOption extends SkfElement {
|
|
50
52
|
/** The option's label text (equivalent to the tags textContent) */
|
51
53
|
set text(slottedTextContent: string);
|
52
54
|
get text(): string;
|
53
|
-
/** Returns or sets the
|
55
|
+
/** Returns or sets the option value. If value is omitted, defaults to the tags slotted text. */
|
54
56
|
set value(optionValue: string);
|
55
57
|
get value(): string;
|
58
|
+
small: boolean;
|
56
59
|
/** @internal */
|
57
60
|
private _assignedNodes?;
|
58
61
|
constructor();
|
59
62
|
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
63
|
+
/** @internal */
|
64
|
+
_handleStateChange(): void;
|
60
65
|
/**
|
61
66
|
* @internal
|
62
67
|
* This internal setter is to change selected state without emitting events triggering other side effects,
|
63
68
|
* e.g deselecting previous selected in a single select. Is used by skf-select in single select mode.
|
64
69
|
*/
|
65
|
-
set setSelectedDiscrete(
|
70
|
+
set setSelectedDiscrete(isSelected: boolean);
|
66
71
|
/**
|
67
72
|
* @internal
|
68
73
|
* Returns the slotted content as a string. If no slotted content, returns an empty string.
|
@@ -1,22 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { componentStyles as f } from "../../styles/component.styles.js";
|
4
|
-
import { LitElement as m, html as d } from "lit";
|
5
|
-
import { property as l, queryAssignedNodes as _ } from "lit/decorators.js";
|
6
|
-
import { ifDefined as p } from "lit/directives/if-defined.js";
|
7
|
-
import { styles as y } from "./select-option.styles.js";
|
8
|
-
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (h, t, s, i) => {
|
9
|
-
for (var r = i > 1 ? void 0 : i ? b(t, s) : t, a = h.length - 1, c; a >= 0; a--)
|
10
|
-
(c = h[a]) && (r = (i ? c(t, s, r) : c(r)) || r);
|
11
|
-
return i && r && v(t, s, r), r;
|
1
|
+
var y = (e) => {
|
2
|
+
throw TypeError(e);
|
12
3
|
};
|
13
|
-
|
4
|
+
var b = (e, s, t) => s.has(e) || y("Cannot " + t);
|
5
|
+
var u = (e, s, t) => (b(e, s, "read from private field"), t ? t.call(e) : s.get(e)), f = (e, s, t) => s.has(e) ? y("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), m = (e, s, t, i) => (b(e, s, "write to private field"), i ? i.call(e, t) : s.set(e, t), t);
|
6
|
+
import "../icon/icon.js";
|
7
|
+
import { SkfElement as C } from "../../internal/components/skf-element.js";
|
8
|
+
import { stateMap as g } from "../../internal/helpers/stateMap.js";
|
9
|
+
import { watch as x } from "../../internal/helpers/watch.js";
|
10
|
+
import { componentStyles as N } from "../../styles/component.styles.js";
|
11
|
+
import { LitElement as T, html as _ } from "lit";
|
12
|
+
import { property as a, state as $, queryAssignedNodes as O } from "lit/decorators.js";
|
13
|
+
import { ifDefined as v } from "lit/directives/if-defined.js";
|
14
|
+
import { styles as E } from "./select-option.styles.js";
|
15
|
+
var k = Object.defineProperty, w = Object.getOwnPropertyDescriptor, l = (e, s, t, i) => {
|
16
|
+
for (var r = i > 1 ? void 0 : i ? w(s, t) : s, d = e.length - 1, p; d >= 0; d--)
|
17
|
+
(p = e[d]) && (r = (i ? p(s, t, r) : p(r)) || r);
|
18
|
+
return i && r && k(s, t, r), r;
|
19
|
+
}, n, h;
|
20
|
+
const c = class c extends C {
|
14
21
|
constructor() {
|
15
|
-
super()
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
super();
|
23
|
+
f(this, n);
|
24
|
+
f(this, h);
|
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
|
+
t.stopPropagation(), this.selected = !this.selected;
|
27
|
+
}, this._shortcutUpdate = !1;
|
20
28
|
}
|
21
29
|
set text(t) {
|
22
30
|
this.textContent = t.trim();
|
@@ -33,13 +41,16 @@ const n = class n extends u {
|
|
33
41
|
return !this._value && this._slotContainsOnlyText ? this._getSlottedContent().trim() : ((t = this._value) == null ? void 0 : t.trim()) ?? this.text;
|
34
42
|
}
|
35
43
|
updated(t) {
|
36
|
-
super.updated(t), t.has("selected") && !this._shortcutUpdate && this.emit("skf-select-option-select", {
|
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", {
|
37
45
|
detail: {
|
38
46
|
value: this.selected ? this.value : null,
|
39
47
|
option: this
|
40
48
|
}
|
41
49
|
});
|
42
50
|
}
|
51
|
+
_handleStateChange() {
|
52
|
+
g(u(this, h), "small").set(this.small);
|
53
|
+
}
|
43
54
|
/**
|
44
55
|
* @internal
|
45
56
|
* This internal setter is to change selected state without emitting events triggering other side effects,
|
@@ -60,14 +71,14 @@ const n = class n extends u {
|
|
60
71
|
/** @internal */
|
61
72
|
get _slotContainsOnlyText() {
|
62
73
|
return this._assignedNodes ? [...this._assignedNodes].every(
|
63
|
-
(
|
64
|
-
var
|
65
|
-
return
|
74
|
+
(i) => {
|
75
|
+
var r;
|
76
|
+
return i.nodeType === Node.TEXT_NODE && ((r = i.textContent) == null ? void 0 : r.trim()) !== "";
|
66
77
|
}
|
67
78
|
) : "";
|
68
79
|
}
|
69
80
|
render() {
|
70
|
-
return
|
81
|
+
return _`
|
71
82
|
<button
|
72
83
|
?disabled=${this.disabled}
|
73
84
|
@click=${this._handleClick}
|
@@ -78,46 +89,52 @@ const n = class n extends u {
|
|
78
89
|
<slot>${this.text}</slot>
|
79
90
|
<div id="adornments">
|
80
91
|
<slot name="icon">
|
81
|
-
${this.icon &&
|
92
|
+
${this.icon && _`
|
82
93
|
<skf-icon
|
83
|
-
color=${
|
84
|
-
data-color=${
|
94
|
+
color=${v(this.iconColor)}
|
95
|
+
data-color=${v((this.disabled || !this.iconColor) && "custom")}
|
85
96
|
name=${this.icon}
|
86
97
|
></skf-icon>
|
87
98
|
`}
|
88
99
|
</slot>
|
89
|
-
${this.shortLabel &&
|
100
|
+
${this.shortLabel && _`<div id="short-label">${this.shortLabel}</div>`}
|
90
101
|
</div>
|
91
102
|
</button>
|
92
103
|
`;
|
93
104
|
}
|
94
105
|
};
|
95
|
-
n.styles = [
|
96
|
-
let
|
97
|
-
|
98
|
-
|
99
|
-
],
|
100
|
-
|
101
|
-
|
102
|
-
],
|
103
|
-
|
104
|
-
|
105
|
-
],
|
106
|
-
|
107
|
-
|
108
|
-
],
|
109
|
-
|
110
|
-
|
111
|
-
],
|
112
|
-
|
113
|
-
|
114
|
-
],
|
115
|
-
|
116
|
-
|
117
|
-
],
|
118
|
-
|
119
|
-
|
120
|
-
],
|
106
|
+
n = new WeakMap(), h = new WeakMap(), c.styles = [N, E], c.shadowRootOptions = { ...T.shadowRootOptions, delegatesFocus: !0 };
|
107
|
+
let o = c;
|
108
|
+
l([
|
109
|
+
a({ type: Boolean, reflect: !0 })
|
110
|
+
], o.prototype, "disabled", 2);
|
111
|
+
l([
|
112
|
+
a({ reflect: !0 })
|
113
|
+
], o.prototype, "icon", 2);
|
114
|
+
l([
|
115
|
+
a({ reflect: !0, attribute: "icon-color" })
|
116
|
+
], o.prototype, "iconColor", 2);
|
117
|
+
l([
|
118
|
+
a({ type: Boolean, reflect: !0 })
|
119
|
+
], o.prototype, "selected", 2);
|
120
|
+
l([
|
121
|
+
a({ reflect: !0, attribute: "short-label" })
|
122
|
+
], o.prototype, "shortLabel", 2);
|
123
|
+
l([
|
124
|
+
a({ attribute: !1 })
|
125
|
+
], o.prototype, "text", 1);
|
126
|
+
l([
|
127
|
+
a({ reflect: !0 })
|
128
|
+
], o.prototype, "value", 1);
|
129
|
+
l([
|
130
|
+
$()
|
131
|
+
], o.prototype, "small", 2);
|
132
|
+
l([
|
133
|
+
O({ flatten: !0 })
|
134
|
+
], o.prototype, "_assignedNodes", 2);
|
135
|
+
l([
|
136
|
+
x("small")
|
137
|
+
], o.prototype, "_handleStateChange", 1);
|
121
138
|
export {
|
122
|
-
|
139
|
+
o as SkfSelectOption
|
123
140
|
};
|