@skf-design-system/ui-components 1.0.2-beta.1 → 1.0.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/dist/components/accordion/accordion-item.component.js +49 -38
- package/dist/components/accordion/accordion.component.d.ts +2 -2
- package/dist/components/accordion/accordion.component.js +12 -12
- package/dist/components/alert/alert.component.d.ts +8 -3
- package/dist/components/alert/alert.component.js +59 -50
- package/dist/components/alert/alert.styles.js +51 -47
- package/dist/components/breadcrumb/breadcrumb-item.component.js +30 -32
- package/dist/components/breadcrumb/breadcrumb-item.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.styles.js +16 -15
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +5 -2
- package/dist/components/breadcrumb/breadcrumb.component.js +51 -46
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb.styles.js +13 -10
- package/dist/components/button/button.component.js +63 -67
- package/dist/components/button/button.styles.js +5 -4
- package/dist/components/card/card.component.d.ts +5 -0
- package/dist/components/card/card.component.js +46 -24
- package/dist/components/card/card.styles.js +31 -14
- package/dist/components/checkbox/checkbox.component.d.ts +6 -5
- package/dist/components/checkbox/checkbox.component.js +67 -69
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/{date-picker/datepicker.calendar.component.d.ts → datepicker/datepicker-calendar.component.d.ts} +8 -1
- package/dist/components/{date-picker/datepicker.calendar.component.js → datepicker/datepicker-calendar.component.js} +109 -115
- package/dist/components/datepicker/datepicker-calendar.d.ts +8 -0
- package/dist/components/datepicker/datepicker-calendar.js +6 -0
- package/dist/components/{date-picker/datepicker.component.d.ts → datepicker/datepicker-popup.component.d.ts} +9 -20
- package/dist/components/datepicker/datepicker-popup.component.js +272 -0
- package/dist/components/datepicker/datepicker-popup.d.ts +8 -0
- package/dist/components/{date-picker/datepicker.helpers.d.ts → datepicker/datepicker-popup.helpers.d.ts} +3 -3
- package/dist/components/datepicker/datepicker-popup.helpers.js +83 -0
- package/dist/components/datepicker/datepicker-popup.js +6 -0
- package/dist/components/{date-picker/datepicker.styles.js → datepicker/datepicker-popup.styles.js} +3 -3
- package/dist/components/{date-picker-input/datepicker-input.component.d.ts → datepicker/datepicker.component.d.ts} +21 -14
- package/dist/components/datepicker/datepicker.component.js +455 -0
- package/dist/components/datepicker/datepicker.d.ts +8 -0
- package/dist/components/datepicker/datepicker.js +6 -0
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +49 -49
- package/dist/components/dialog/dialog.d.ts +2 -2
- package/dist/components/divider/divider.component.d.ts +3 -0
- package/dist/components/divider/divider.component.js +43 -22
- package/dist/components/divider/divider.styles.js +9 -9
- package/dist/components/drawer/drawer.component.d.ts +12 -4
- package/dist/components/drawer/drawer.component.js +84 -61
- package/dist/components/drawer/drawer.d.ts +2 -2
- package/dist/components/drawer/drawer.styles.js +47 -40
- package/dist/components/header/header.component.d.ts +4 -2
- package/dist/components/header/header.component.js +64 -57
- package/dist/components/header/header.d.ts +2 -2
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/heading/heading.component.d.ts +5 -1
- package/dist/components/heading/heading.component.js +54 -27
- package/dist/components/heading/heading.styles.js +34 -36
- package/dist/components/icon/icon.component.d.ts +4 -0
- package/dist/components/icon/icon.component.js +62 -43
- package/dist/components/icon/icon.styles.js +60 -60
- package/dist/components/input/input.component.d.ts +4 -8
- package/dist/components/input/input.component.js +90 -97
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +14 -19
- package/dist/components/link/link.component.d.ts +15 -18
- package/dist/components/link/link.component.js +104 -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/logo/logo.component.d.ts +4 -1
- package/dist/components/logo/logo.component.js +55 -51
- package/dist/components/logo/logo.styles.js +26 -16
- package/dist/components/menu/menu-item.component.d.ts +1 -1
- package/dist/components/menu/menu-item.component.js +8 -8
- package/dist/components/menu/menu-item.d.ts +2 -2
- package/dist/components/menu/menu-item.styles.js +13 -9
- package/dist/components/menu/menu.component.d.ts +5 -2
- package/dist/components/menu/menu.component.js +8 -8
- package/dist/components/menu/menu.d.ts +2 -2
- package/dist/components/nav/nav-item.component.d.ts +6 -2
- package/dist/components/nav/nav-item.component.js +44 -25
- package/dist/components/nav/nav-item.styles.js +29 -25
- package/dist/components/nav/nav.component.d.ts +9 -0
- package/dist/components/nav/nav.component.js +47 -21
- package/dist/components/nav/nav.d.ts +2 -2
- package/dist/components/nav/nav.styles.js +15 -9
- package/dist/components/popover/popover.component.d.ts +10 -3
- package/dist/components/popover/popover.component.js +30 -22
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/progress/progress.component.d.ts +2 -0
- package/dist/components/progress/progress.component.js +38 -29
- package/dist/components/progress/progress.d.ts +2 -2
- package/dist/components/progress/progress.styles.js +10 -8
- package/dist/components/radio/radio.component.d.ts +4 -2
- package/dist/components/radio/radio.component.js +96 -91
- package/dist/components/radio/radio.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.d.ts +2 -2
- package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button.component.js +22 -24
- package/dist/components/segmented-button/segmented-button.d.ts +2 -2
- package/dist/components/select/select-option-group.component.d.ts +4 -0
- package/dist/components/select/select-option-group.component.js +37 -18
- package/dist/components/select/select-option-group.d.ts +2 -2
- package/dist/components/select/select-option-group.style.js +12 -6
- package/dist/components/select/select-option.component.d.ts +9 -4
- package/dist/components/select/select-option.component.js +70 -58
- package/dist/components/select/select-option.styles.js +43 -31
- package/dist/components/select/select.component.d.ts +21 -12
- package/dist/components/select/select.component.js +125 -87
- package/dist/components/select/select.controllers.js +15 -20
- package/dist/components/select/select.styles.js +8 -2
- package/dist/components/stepper/stepper-item.component.d.ts +1 -1
- package/dist/components/stepper/stepper-item.component.js +59 -56
- package/dist/components/stepper/stepper-item.d.ts +2 -2
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/stepper/stepper.component.js +2 -3
- package/dist/components/stepper/stepper.d.ts +2 -2
- package/dist/components/stepper/stepper.helpers.js +6 -7
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -58
- package/dist/components/switch/switch.d.ts +2 -2
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/{tab-panel → tabs}/tab-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +39 -0
- package/dist/components/{tab-panel → tabs}/tab-panel.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.component.d.ts +3 -3
- package/dist/components/{tab → tabs}/tab.component.js +17 -14
- package/dist/components/{tab → tabs}/tab.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.styles.js +2 -2
- package/dist/components/{tab-group/tab-group.component.d.ts → tabs/tabs.component.d.ts} +3 -4
- package/dist/components/{tab-group/tab-group.component.js → tabs/tabs.component.js} +35 -36
- package/dist/components/tabs/tabs.d.ts +8 -0
- package/dist/components/tabs/tabs.js +6 -0
- package/dist/components/{tab-group/tab-group.styles.js → tabs/tabs.styles.js} +16 -16
- package/dist/components/tag/tag.component.d.ts +10 -2
- package/dist/components/tag/tag.component.js +77 -65
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.styles.js +63 -50
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +102 -95
- package/dist/components/toast/toast-item.styles.js +13 -10
- package/dist/components/toast/toast.component.js +9 -9
- package/dist/components/toast/toast.singleton.d.ts +1 -1
- package/dist/components/toast/toast.singleton.js +19 -20
- package/dist/components/tooltip/tooltip.component.d.ts +9 -2
- package/dist/components/tooltip/tooltip.component.js +15 -11
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/custom-elements.json +1681 -1112
- package/dist/index.d.ts +8 -7
- package/dist/index.js +96 -93
- package/dist/internal/base-classes/popover/popover.base.d.ts +24 -5
- package/dist/internal/base-classes/popover/popover.base.js +41 -44
- package/dist/internal/base-classes/popover/popover.styles.js +4 -5
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -19
- package/dist/internal/components/hint/hint.component.d.ts +4 -0
- package/dist/internal/components/hint/hint.component.js +47 -20
- package/dist/internal/components/hint/hint.styles.js +29 -25
- package/dist/internal/components/skf-element.d.ts +1 -3
- package/dist/internal/components/skf-element.js +4 -9
- package/dist/internal/controllers/popover.controller.d.ts +2 -0
- package/dist/internal/controllers/popover.controller.js +11 -14
- package/dist/internal/helpers/stateMap.d.ts +14 -0
- package/dist/internal/helpers/stateMap.js +68 -0
- package/dist/internal/helpers/uuid.d.ts +8 -10
- package/dist/internal/helpers/uuid.js +4 -11
- package/dist/internal/helpers/watch.d.ts +1 -1
- package/dist/internal/helpers/watch.js +12 -12
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +4 -4
- package/dist/internal/types.d.ts +4 -0
- package/dist/styles/component.styles.js +37 -36
- package/dist/styles/global-alt.css +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +27 -0
- package/dist/translations/es.d.ts +3 -0
- package/dist/translations/es.js +27 -0
- package/dist/translations/index.d.ts +4 -0
- package/dist/translations/pt.d.ts +3 -0
- package/dist/translations/pt.js +27 -0
- package/dist/translations/sv.d.ts +3 -0
- package/dist/translations/sv.js +27 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +1988 -866
- package/dist/types/vue/index.d.ts +220 -169
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +265 -188
- package/dist/web-types.json +731 -548
- package/package.json +38 -51
- package/dist/components/accordion/accordion-item.test.d.ts +0 -1
- package/dist/components/accordion/accordion.test.d.ts +0 -1
- package/dist/components/checkbox/checkbox.test.d.ts +0 -1
- package/dist/components/date-picker/datepicker.component.js +0 -261
- package/dist/components/date-picker/datepicker.d.ts +0 -10
- package/dist/components/date-picker/datepicker.helpers.js +0 -76
- package/dist/components/date-picker/datepicker.js +0 -8
- package/dist/components/date-picker-input/datepicker-input.component.js +0 -442
- package/dist/components/date-picker-input/datepicker-input.d.ts +0 -8
- package/dist/components/date-picker-input/datepicker-input.js +0 -6
- package/dist/components/input/input.test.d.ts +0 -1
- package/dist/components/radio/radio.test.d.ts +0 -1
- package/dist/components/switch/switch.test.d.ts +0 -1
- package/dist/components/tab-group/tab-group.d.ts +0 -8
- package/dist/components/tab-group/tab-group.js +0 -6
- package/dist/components/tab-panel/tab-panel.component.js +0 -36
- package/dist/internal/playwright/index.d.ts +0 -1
- /package/dist/components/{date-picker/datepicker.calendar.styles.d.ts → datepicker/datepicker-calendar.styles.d.ts} +0 -0
- /package/dist/components/{date-picker/datepicker.calendar.styles.js → datepicker/datepicker-calendar.styles.js} +0 -0
- /package/dist/components/{date-picker/datepicker.styles.d.ts → datepicker/datepicker-popup.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.d.ts → datepicker/datepicker.helpers.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.js → datepicker/datepicker.helpers.js} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.d.ts → datepicker/datepicker.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.js → datepicker/datepicker.styles.js} +0 -0
- /package/dist/components/select/{select.stories.icons.d.ts → stories/select.stories.icons.d.ts} +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.js +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.d.ts +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.js +0 -0
- /package/dist/components/{tab → tabs}/tab.js +0 -0
- /package/dist/components/{tab → tabs}/tab.styles.d.ts +0 -0
- /package/dist/components/{tab-group/tab-group.styles.d.ts → tabs/tabs.styles.d.ts} +0 -0
@@ -1,35 +1,32 @@
|
|
1
1
|
import { SkfElement as d } from "../../internal/components/skf-element.js";
|
2
|
-
import { componentStyles as
|
2
|
+
import { componentStyles as a } from "../../styles/component.styles.js";
|
3
3
|
import { html as c } from "lit";
|
4
4
|
import { property as u, state as f, queryAssignedElements as p } from "lit/decorators.js";
|
5
5
|
import { ifDefined as g } from "lit/directives/if-defined.js";
|
6
|
-
import { styles as
|
7
|
-
var
|
8
|
-
for (var
|
9
|
-
(r =
|
10
|
-
return
|
6
|
+
import { styles as v } from "./segmented-button.styles.js";
|
7
|
+
var y = Object.defineProperty, n = (m, s, t, i) => {
|
8
|
+
for (var e = void 0, o = m.length - 1, r; o >= 0; o--)
|
9
|
+
(r = m[o]) && (e = r(s, t, e) || e);
|
10
|
+
return e && y(s, t, e), e;
|
11
11
|
};
|
12
12
|
const h = class h extends d {
|
13
13
|
constructor() {
|
14
14
|
super(...arguments), this.multiple = !1, this.value = "", this._handleSegmentedButtonItemSelected = (s) => {
|
15
|
-
const
|
16
|
-
this.multiple && (
|
15
|
+
const t = s.detail.item;
|
16
|
+
this.multiple && (t.selected = !t.selected), this.value = "";
|
17
17
|
let i = [];
|
18
|
-
this.items.forEach((
|
19
|
-
this.multiple ?
|
18
|
+
this.items.forEach((e) => {
|
19
|
+
this.multiple ? e.selected && (i = [...i, e.value], this.value = i.join()) : e !== t ? e.selected = !1 : (e.selected = !0, this.value = e.value);
|
20
20
|
});
|
21
21
|
}, this._handleSlotChange = () => {
|
22
22
|
this.items.forEach((s) => {
|
23
23
|
if (s.isMultiple = this.multiple, !this.multiple) {
|
24
|
-
const
|
25
|
-
|
24
|
+
const t = this.items.filter((i) => i.selected);
|
25
|
+
t.length > 1 && t.slice(0, -1).forEach((i) => i.selected = !1);
|
26
26
|
}
|
27
27
|
});
|
28
28
|
}, this._handleKeyDown = (s) => {
|
29
|
-
|
30
|
-
const e = this._getKeyDownNextItem(s.key);
|
31
|
-
e == null || e.focus({ preventScroll: !0 });
|
32
|
-
}
|
29
|
+
["ArrowLeft", "ArrowRight"].includes(s.key) && this._getKeyDownNextItem(s.key)?.focus({ preventScroll: !0 });
|
33
30
|
};
|
34
31
|
}
|
35
32
|
firstUpdated() {
|
@@ -40,24 +37,25 @@ const h = class h extends d {
|
|
40
37
|
}
|
41
38
|
/** @internal */
|
42
39
|
_getKeyDownNextItem(s) {
|
43
|
-
const
|
44
|
-
if (
|
45
|
-
const
|
46
|
-
return this.items[
|
40
|
+
const t = this.items.findIndex((r) => r === document.activeElement);
|
41
|
+
if (t === -1) return;
|
42
|
+
const e = (t + (s === "ArrowRight" ? 1 : -1)) % this.items.length;
|
43
|
+
return this.items[e < 0 ? this.items.length - 1 : e];
|
47
44
|
}
|
48
45
|
render() {
|
49
46
|
return c`
|
50
|
-
<
|
47
|
+
<div
|
51
48
|
@keydown=${this._handleKeyDown}
|
52
|
-
@slotchange=${this._handleSlotChange}
|
53
49
|
aria-label=${g(this.ariaLabel ?? "Segmented button label")}
|
54
50
|
id="root"
|
55
51
|
role=${this.multiple ? "group" : "radiogroup"}
|
56
|
-
|
52
|
+
>
|
53
|
+
<slot @slotchange=${this._handleSlotChange}></slot>
|
54
|
+
</div>
|
57
55
|
`;
|
58
56
|
}
|
59
57
|
};
|
60
|
-
h.styles = [
|
58
|
+
h.styles = [a, v];
|
61
59
|
let l = h;
|
62
60
|
n([
|
63
61
|
u({ type: Boolean })
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { SkfSegmentedButton } from './segmented-button.component';
|
2
|
-
export * from './segmented-button.component';
|
1
|
+
import { SkfSegmentedButton } from './segmented-button.component.js';
|
2
|
+
export * from './segmented-button.component.js';
|
3
3
|
export default SkfSegmentedButton;
|
4
4
|
declare global {
|
5
5
|
interface HTMLElementTagNameMap {
|
@@ -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,5 +1,5 @@
|
|
1
|
-
import { SkfSelectOptionGroup } from './select-option-group.component';
|
2
|
-
export * from './select-option-group.component';
|
1
|
+
import { SkfSelectOptionGroup } from './select-option-group.component.js';
|
2
|
+
export * from './select-option-group.component.js';
|
3
3
|
export default SkfSelectOptionGroup;
|
4
4
|
declare global {
|
5
5
|
interface HTMLElementTagNameMap {
|
@@ -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
|
}
|
@@ -1,14 +1,15 @@
|
|
1
|
+
import '../icon/icon.js';
|
1
2
|
import { SkfElement } from '../../internal/components/skf-element.js';
|
2
3
|
import type { Icon, IconColor } from '../../internal/types.js';
|
3
4
|
import { type CSSResultGroup } from 'lit';
|
4
|
-
import '
|
5
|
-
import type { SkfSelect } from '../select/select.component.js';
|
5
|
+
import type { SkfSelect } from './select.component.js';
|
6
6
|
export interface SelectOptionEvent {
|
7
7
|
value: string | null;
|
8
8
|
option: SkfSelectOption;
|
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,45 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { LitElement as m, html as h } from "lit";
|
4
|
-
import { property as l, queryAssignedNodes as _ } from "lit/decorators.js";
|
5
|
-
import { ifDefined as p } from "lit/directives/if-defined.js";
|
6
|
-
import "../icon/icon.js";
|
7
|
-
import { styles as y } from "./select-option.styles.js";
|
8
|
-
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (d, t, s, i) => {
|
9
|
-
for (var r = i > 1 ? void 0 : i ? b(t, s) : t, a = d.length - 1, c; a >= 0; a--)
|
10
|
-
(c = d[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, r = (e, s, t, i) => {
|
16
|
+
for (var l = i > 1 ? void 0 : i ? w(s, t) : s, d = e.length - 1, p; d >= 0; d--)
|
17
|
+
(p = e[d]) && (l = (i ? p(s, t, l) : p(l)) || l);
|
18
|
+
return i && l && k(s, t, l), l;
|
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();
|
23
31
|
}
|
24
32
|
get text() {
|
25
|
-
|
26
|
-
return ((t = this.textContent) == null ? void 0 : t.trim()) ?? "";
|
33
|
+
return this.textContent?.trim() ?? "";
|
27
34
|
}
|
28
35
|
set value(t) {
|
29
36
|
this._value = t.trim();
|
30
37
|
}
|
31
38
|
get value() {
|
32
|
-
|
33
|
-
return !this._value && this._slotContainsOnlyText ? this._getSlottedContent().trim() : ((t = this._value) == null ? void 0 : t.trim()) ?? this.text;
|
39
|
+
return !this._value && this._slotContainsOnlyText ? this._getSlottedContent().trim() : this._value?.trim() ?? this.text;
|
34
40
|
}
|
35
41
|
updated(t) {
|
36
|
-
super.updated(t), t.has("selected") && !this._shortcutUpdate && this.emit("skf-select-option-select", {
|
42
|
+
super.updated(t), 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
43
|
detail: {
|
38
44
|
value: this.selected ? this.value : null,
|
39
45
|
option: this
|
40
46
|
}
|
41
47
|
});
|
42
48
|
}
|
49
|
+
_handleStateChange() {
|
50
|
+
g(u(this, h), "small").set(this.small);
|
51
|
+
}
|
43
52
|
/**
|
44
53
|
* @internal
|
45
54
|
* This internal setter is to change selected state without emitting events triggering other side effects,
|
@@ -60,14 +69,11 @@ const n = class n extends u {
|
|
60
69
|
/** @internal */
|
61
70
|
get _slotContainsOnlyText() {
|
62
71
|
return this._assignedNodes ? [...this._assignedNodes].every(
|
63
|
-
(
|
64
|
-
var i;
|
65
|
-
return s.nodeType === Node.TEXT_NODE && ((i = s.textContent) == null ? void 0 : i.trim()) !== "";
|
66
|
-
}
|
72
|
+
(i) => i.nodeType === Node.TEXT_NODE && i.textContent?.trim() !== ""
|
67
73
|
) : "";
|
68
74
|
}
|
69
75
|
render() {
|
70
|
-
return
|
76
|
+
return _`
|
71
77
|
<button
|
72
78
|
?disabled=${this.disabled}
|
73
79
|
@click=${this._handleClick}
|
@@ -78,46 +84,52 @@ const n = class n extends u {
|
|
78
84
|
<slot>${this.text}</slot>
|
79
85
|
<div id="adornments">
|
80
86
|
<slot name="icon">
|
81
|
-
${this.icon &&
|
87
|
+
${this.icon && _`
|
82
88
|
<skf-icon
|
83
|
-
|
84
|
-
color=${
|
89
|
+
color=${v(this.iconColor)}
|
90
|
+
data-color=${v((this.disabled || !this.iconColor) && "custom")}
|
85
91
|
name=${this.icon}
|
86
92
|
></skf-icon>
|
87
93
|
`}
|
88
94
|
</slot>
|
89
|
-
${this.shortLabel &&
|
95
|
+
${this.shortLabel && _`<div id="short-label">${this.shortLabel}</div>`}
|
90
96
|
</div>
|
91
97
|
</button>
|
92
98
|
`;
|
93
99
|
}
|
94
100
|
};
|
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
|
-
],
|
101
|
+
n = new WeakMap(), h = new WeakMap(), c.styles = [N, E], c.shadowRootOptions = { ...T.shadowRootOptions, delegatesFocus: !0 };
|
102
|
+
let o = c;
|
103
|
+
r([
|
104
|
+
a({ type: Boolean, reflect: !0 })
|
105
|
+
], o.prototype, "disabled", 2);
|
106
|
+
r([
|
107
|
+
a({ reflect: !0 })
|
108
|
+
], o.prototype, "icon", 2);
|
109
|
+
r([
|
110
|
+
a({ reflect: !0, attribute: "icon-color" })
|
111
|
+
], o.prototype, "iconColor", 2);
|
112
|
+
r([
|
113
|
+
a({ type: Boolean, reflect: !0 })
|
114
|
+
], o.prototype, "selected", 2);
|
115
|
+
r([
|
116
|
+
a({ reflect: !0, attribute: "short-label" })
|
117
|
+
], o.prototype, "shortLabel", 2);
|
118
|
+
r([
|
119
|
+
a({ attribute: !1 })
|
120
|
+
], o.prototype, "text", 1);
|
121
|
+
r([
|
122
|
+
a({ reflect: !0 })
|
123
|
+
], o.prototype, "value", 1);
|
124
|
+
r([
|
125
|
+
$()
|
126
|
+
], o.prototype, "small", 2);
|
127
|
+
r([
|
128
|
+
O({ flatten: !0 })
|
129
|
+
], o.prototype, "_assignedNodes", 2);
|
130
|
+
r([
|
131
|
+
x("small")
|
132
|
+
], o.prototype, "_handleStateChange", 1);
|
121
133
|
export {
|
122
|
-
|
134
|
+
o as SkfSelectOption
|
123
135
|
};
|
@@ -1,50 +1,62 @@
|
|
1
1
|
import { css as e } from "lit";
|
2
2
|
const o = e`
|
3
3
|
@layer components {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
@layer base {
|
5
|
+
button {
|
6
|
+
--_skf-select-option-bg: var(--skf-interactive-bg-color-secondary);
|
7
|
+
--_skf-select-option-color: inherit;
|
8
|
+
--_skf-select-option-height: var(--skf-size-44);
|
9
|
+
|
10
|
+
align-items: center;
|
11
|
+
background-color: var(--_skf-select-option-bg);
|
12
|
+
block-size: var(--_skf-select-option-height);
|
13
|
+
color: var(--_skf-select-option-color);
|
14
|
+
display: flex;
|
15
|
+
gap: var(--skf-spacing-50);
|
16
|
+
padding-inline: var(--skf-spacing-50);
|
17
|
+
width: 100%;
|
16
18
|
}
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
#icon-check {
|
21
|
+
opacity: 0;
|
22
|
+
|
23
|
+
:host([selected]) & {
|
24
|
+
opacity: 1;
|
25
|
+
}
|
20
26
|
}
|
21
27
|
|
22
|
-
|
23
|
-
|
28
|
+
#adornments {
|
29
|
+
align-items: inherit;
|
30
|
+
display: inherit;
|
31
|
+
gap: inherit;
|
32
|
+
margin-inline-start: auto;
|
24
33
|
}
|
25
34
|
|
26
|
-
|
27
|
-
|
35
|
+
#short-label {
|
36
|
+
color: var(--skf-text-color-tertiary);
|
28
37
|
}
|
29
38
|
}
|
30
39
|
|
31
|
-
|
32
|
-
|
40
|
+
@layer states {
|
41
|
+
button {
|
42
|
+
&:disabled {
|
43
|
+
--_skf-select-option-color: var(--skf-interactive-text-color-disabled);
|
44
|
+
}
|
33
45
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}
|
46
|
+
&:is(:hover, :focus):not(:disabled) {
|
47
|
+
--_skf-select-option-bg: var(--skf-interactive-bg-color-secondary-hover);
|
48
|
+
}
|
38
49
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
margin-inline-start: auto;
|
50
|
+
&:active:not(:disabled) {
|
51
|
+
--_skf-select-option-bg: var(--skf-interactive-bg-color-secondary-active);
|
52
|
+
}
|
53
|
+
}
|
44
54
|
}
|
45
55
|
|
46
|
-
|
47
|
-
|
56
|
+
@layer mods {
|
57
|
+
:host(:state(small)) button {
|
58
|
+
--_skf-select-option-height: var(--skf-size-32);
|
59
|
+
}
|
48
60
|
}
|
49
61
|
}
|
50
62
|
`;
|
@@ -1,10 +1,12 @@
|
|
1
|
+
import { SkfSelectOptionGroup } from '../select/select-option-group.component.js';
|
2
|
+
import '../tag/tag.js';
|
1
3
|
import { FormBase } from '../../internal/components/formBase.js';
|
4
|
+
import '../../internal/components/hint/hint.js';
|
2
5
|
import { PopoverController } from '../../internal/controllers/popover.controller.js';
|
3
6
|
import type { FormFieldSeverity } from '../../internal/types.js';
|
7
|
+
import { type Language } from '../../utilities/localize.js';
|
4
8
|
import { type CSSResultGroup } from 'lit';
|
5
|
-
import '
|
6
|
-
import '../tag/tag';
|
7
|
-
import type { SelectOptionEvent, SkfSelectOption } from './select-option.component.js';
|
9
|
+
import { SkfSelectOption, type SelectOptionEvent } from './select-option.component.js';
|
8
10
|
import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController } from './select.controllers.js';
|
9
11
|
/**
|
10
12
|
* TODO: abstract the popover logic to a separate component/helper/partial, and use it in both select and in input[datalist], combobox etc
|
@@ -26,11 +28,15 @@ import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationC
|
|
26
28
|
* @event {Event} reset - Fired when the form is reset
|
27
29
|
* @event {CustomEvent} skf-select-dropdown - {detail: {expanded: boolean}} Fired when the select dropdown is toggled
|
28
30
|
* @event {CustomEvent} skf-select-option-select - {detail: {value: string | null, option: SkfSelectOption}} Fired when the select dropdown is toggled
|
31
|
+
* @event {CustomEvent} skf-select-connected - Fires when the select options are connected, useful for setting selected option(s) via value property. E.g mySkfSelect.value = 'option1,option2';
|
29
32
|
*
|
30
33
|
* @tagname skf-select
|
31
34
|
*/
|
32
35
|
export declare class SkfSelect extends FormBase {
|
36
|
+
#private;
|
33
37
|
static styles: CSSResultGroup;
|
38
|
+
private _componentIsConnected;
|
39
|
+
private _defaultButtonLabel;
|
34
40
|
/** @internal */
|
35
41
|
selectDelay: number;
|
36
42
|
/** @internal */
|
@@ -53,6 +59,8 @@ export declare class SkfSelect extends FormBase {
|
|
53
59
|
get selectedOptionsText(): string[];
|
54
60
|
/** If defined, displays provided label */
|
55
61
|
label?: string;
|
62
|
+
/** Sets the internal language of the component */
|
63
|
+
lang: Language;
|
56
64
|
/** If defined, limits the number of selectable options */
|
57
65
|
max?: number;
|
58
66
|
/** If defined, sets the minimum number of required options */
|
@@ -61,22 +69,18 @@ export declare class SkfSelect extends FormBase {
|
|
61
69
|
multiple: boolean;
|
62
70
|
/** If defined, set name of the component */
|
63
71
|
name?: string;
|
64
|
-
/** If defined, renders an alternative A11y text for the asterisk */
|
65
|
-
requiredLabel?: string;
|
66
72
|
/** If defined, displays provided severity state */
|
67
73
|
severity?: FormFieldSeverity;
|
68
74
|
/** If true, displays valid state after interaction */
|
69
75
|
showValid: boolean;
|
70
76
|
/** Size of the Select */
|
71
77
|
size: 'sm' | 'md';
|
72
|
-
/**
|
78
|
+
/** Returns the selected value. (if multiple: in a comma separated string). If set will default set corresponding option. */
|
73
79
|
set value(newValue: string);
|
74
80
|
get value(): string;
|
75
|
-
/** @internal */
|
76
|
-
/** Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
|
81
|
+
/** @internal - Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
|
77
82
|
private _selectedOptions;
|
78
|
-
/** @internal */
|
79
|
-
/** The selected options in an array. Treat it as a read only property. See selectedValues, slectedSlots for computed value arrays. */
|
83
|
+
/** @internal - Read only. The selected options in an array. See also selectedValues, slectedSlots for computed value arrays. */
|
80
84
|
set selectedOptions(option: SkfSelectOption[]);
|
81
85
|
/** @internal */
|
82
86
|
get selectedOptions(): SkfSelectOption[];
|
@@ -92,6 +96,8 @@ export declare class SkfSelect extends FormBase {
|
|
92
96
|
/** @internal */
|
93
97
|
$popover: HTMLDivElement;
|
94
98
|
/** @internal */
|
99
|
+
_slottedItems: SkfSelectOption[] | SkfSelectOptionGroup[];
|
100
|
+
/** @internal */
|
95
101
|
protected globalClickController: GlobalClickController;
|
96
102
|
/** @internal */
|
97
103
|
protected keyboardNavController: KeyboardNavigationController;
|
@@ -102,6 +108,7 @@ export declare class SkfSelect extends FormBase {
|
|
102
108
|
constructor();
|
103
109
|
willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
|
104
110
|
firstUpdated(): void;
|
111
|
+
_handleSizeUpdate(): void;
|
105
112
|
handleExpandedChange(): void;
|
106
113
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
107
114
|
disconnectedCallback(): void;
|
@@ -131,8 +138,10 @@ export declare class SkfSelect extends FormBase {
|
|
131
138
|
_resetSelectedOptions: (target?: SkfSelectOption) => void;
|
132
139
|
/** @internal */
|
133
140
|
_handleSlotChange: () => void;
|
134
|
-
/** @internal */
|
135
|
-
|
141
|
+
/** @internal - on slot update, if value is set, select the corresponding option */
|
142
|
+
_ifValueIsSetSelectOption: () => void;
|
143
|
+
/** @internal - Computes the visible value of the select component - if multiple options are selected, shows a visually dimmed summary (meta info) */
|
144
|
+
_computeVisibleValue: () => string | null;
|
136
145
|
/** @internal */
|
137
146
|
private _validateInput;
|
138
147
|
render(): import("lit").TemplateResult<1>;
|