@skf-design-system/ui-components 1.0.0-alpha.35 → 1.0.0-alpha.37

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.
Files changed (54) hide show
  1. package/custom-elements.json +25490 -0
  2. package/dist/components/accordion/accordion.component.d.ts +1 -1
  3. package/dist/components/accordion/accordion.component.js +2 -2
  4. package/dist/components/card/card.component.d.ts +2 -0
  5. package/dist/components/card/card.styles.js +2 -1
  6. package/dist/components/datepicker/datepicker.component.js +1 -0
  7. package/dist/components/icon/icon.component.d.ts +1 -4
  8. package/dist/components/icon/icon.component.js +41 -53
  9. package/dist/components/icon/icon.styles.js +0 -1
  10. package/dist/components/input/input.component.js +1 -0
  11. package/dist/components/link/link.component.d.ts +15 -18
  12. package/dist/components/link/link.component.js +99 -108
  13. package/dist/components/link/link.styles.js +45 -45
  14. package/dist/components/loader/loader.component.d.ts +5 -1
  15. package/dist/components/loader/loader.component.js +43 -29
  16. package/dist/components/loader/loader.styles.js +5 -9
  17. package/dist/components/menu/menu-item.component.d.ts +1 -1
  18. package/dist/components/menu/menu-item.component.js +8 -8
  19. package/dist/components/menu/menu-item.styles.js +8 -5
  20. package/dist/components/nav/nav-item.component.d.ts +4 -0
  21. package/dist/components/nav/nav-item.component.js +44 -25
  22. package/dist/components/nav/nav-item.styles.js +29 -25
  23. package/dist/components/nav/nav.component.d.ts +6 -0
  24. package/dist/components/nav/nav.component.js +42 -21
  25. package/dist/components/nav/nav.styles.js +15 -9
  26. package/dist/components/popover/popover.component.d.ts +4 -0
  27. package/dist/components/popover/popover.component.js +31 -23
  28. package/dist/components/progress/progress.component.d.ts +2 -0
  29. package/dist/components/progress/progress.component.js +38 -29
  30. package/dist/components/progress/progress.styles.js +3 -3
  31. package/dist/components/select/select-option-group.component.d.ts +4 -0
  32. package/dist/components/select/select-option-group.component.js +37 -18
  33. package/dist/components/select/select-option-group.style.js +12 -6
  34. package/dist/components/select/select-option.component.d.ts +5 -1
  35. package/dist/components/select/select-option.component.js +69 -52
  36. package/dist/components/select/select-option.styles.js +43 -31
  37. package/dist/components/select/select.component.d.ts +5 -1
  38. package/dist/components/select/select.component.js +47 -29
  39. package/dist/components/select/select.controllers.js +4 -8
  40. package/dist/components/textarea/textarea.component.js +5 -4
  41. package/dist/components/toast/toast.component.js +9 -9
  42. package/dist/components/toast/toast.singleton.d.ts +1 -1
  43. package/dist/components/toast/toast.singleton.js +18 -18
  44. package/dist/custom-elements.json +778 -678
  45. package/dist/internal/base-classes/popover/popover.base.js +17 -17
  46. package/dist/internal/base-classes/popover/popover.styles.js +4 -5
  47. package/dist/internal/components/hint/hint.component.d.ts +4 -0
  48. package/dist/internal/components/hint/hint.component.js +47 -20
  49. package/dist/internal/components/hint/hint.styles.js +29 -25
  50. package/dist/types/jsx/custom-element-jsx.d.ts +188 -70
  51. package/dist/types/vue/index.d.ts +81 -69
  52. package/dist/vscode.html-custom-data.json +92 -96
  53. package/dist/web-types.json +206 -205
  54. package/package.json +16 -16
@@ -1,5 +1,5 @@
1
1
  import { css as r } from "lit";
2
- const o = r`
2
+ const s = r`
3
3
  @layer components {
4
4
  @layer base {
5
5
  #root {
@@ -24,7 +24,7 @@ const o = r`
24
24
  }
25
25
 
26
26
  @layer mods {
27
- :host([animated]) {
27
+ :host(:state(animated)) {
28
28
  #root::after {
29
29
  animation: skf-progress-animation calc(var(--skf-motion-duration-slow) * 1ms) linear
30
30
  infinite reverse;
@@ -51,5 +51,5 @@ const o = r`
51
51
  }
52
52
  `;
53
53
  export {
54
- o as styles
54
+ s as styles
55
55
  };
@@ -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
- import { SkfElement as a } from "../../internal/components/skf-element.js";
2
- import { componentStyles as f } from "../../styles/component.styles.js";
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
- const l = class l extends a {
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), this.label = "Default label";
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 p`
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
- l.styles = [f, n];
25
- let t = l;
26
- u([
27
- d({ reflect: !0 })
28
- ], t.prototype, "label");
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
- t as SkfSelectOptionGroup
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
- #label {
5
- align-items: center;
6
- block-size: var(--_skf-select-option-group-height, var(--skf-size-44));
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
- :host-context(skf-select[size='sm']) & {
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
  }
@@ -20,6 +20,7 @@ export interface SelectOptionEvent {
20
20
  * @tagname skf-select-option
21
21
  */
22
22
  export declare class SkfSelectOption extends SkfElement {
23
+ #private;
23
24
  static styles: CSSResultGroup;
24
25
  static shadowRootOptions: {
25
26
  delegatesFocus: boolean;
@@ -53,16 +54,19 @@ export declare class SkfSelectOption extends SkfElement {
53
54
  /** Returns or sets the tags value. If value is omitted, defaults to the tags text. */
54
55
  set value(optionValue: string);
55
56
  get value(): string;
57
+ small: boolean;
56
58
  /** @internal */
57
59
  private _assignedNodes?;
58
60
  constructor();
59
61
  updated(changedProperties: Map<string | number | symbol, unknown>): void;
62
+ /** @internal */
63
+ _handleStateChange(): void;
60
64
  /**
61
65
  * @internal
62
66
  * This internal setter is to change selected state without emitting events triggering other side effects,
63
67
  * e.g deselecting previous selected in a single select. Is used by skf-select in single select mode.
64
68
  */
65
- set setSelectedDiscrete(value: boolean);
69
+ set setSelectedDiscrete(isSelected: boolean);
66
70
  /**
67
71
  * @internal
68
72
  * Returns the slotted content as a string. If no slotted content, returns an empty string.
@@ -1,22 +1,30 @@
1
- import "../icon/icon.js";
2
- import { SkfElement as u } from "../../internal/components/skf-element.js";
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
- const n = class n extends u {
4
+ var v = (e, s, t) => s.has(e) || y("Cannot " + t);
5
+ var u = (e, s, t) => (v(e, s, "read from private field"), t ? t.call(e) : s.get(e)), m = (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), f = (e, s, t, i) => (v(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 x } from "../../internal/helpers/stateMap.js";
9
+ import { watch as g } 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 b } from "lit/directives/if-defined.js";
14
+ import { styles as E } from "./select-option.styles.js";
15
+ var w = Object.defineProperty, D = Object.getOwnPropertyDescriptor, l = (e, s, t, i) => {
16
+ for (var r = i > 1 ? void 0 : i ? D(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 && w(s, t, r), r;
19
+ }, n, h;
20
+ const c = class c extends C {
14
21
  constructor() {
15
- super(), this._shortcutUpdate = !1, this.disabled = !1, this.selected = !1, this._handleClick = (s) => {
16
- s.stopPropagation(), this.selected = !this.selected;
17
- };
18
- const t = this.attachInternals();
19
- t.role = "option", this._parent = this.closest("skf-select"), this._shortcutUpdate = !1;
22
+ super();
23
+ m(this, n);
24
+ m(this, h);
25
+ f(this, n, this.attachInternals()), f(this, h, u(this, n).states), this._shortcutUpdate = !1, this.disabled = !1, this.selected = !1, this.small = !1, this._handleClick = (t) => {
26
+ t.stopPropagation(), this.selected = !this.selected;
27
+ }, this.role = "option", this._parent = this.closest("skf-select"), this._shortcutUpdate = !1;
20
28
  }
21
29
  set text(t) {
22
30
  this.textContent = t.trim();
@@ -40,6 +48,9 @@ const n = class n extends u {
40
48
  }
41
49
  });
42
50
  }
51
+ _handleStateChange() {
52
+ x(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
- (s) => {
64
- var i;
65
- return s.nodeType === Node.TEXT_NODE && ((i = s.textContent) == null ? void 0 : i.trim()) !== "";
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 d`
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 && d`
92
+ ${this.icon && _`
82
93
  <skf-icon
83
- color=${p(this.iconColor)}
84
- data-color=${p((this.disabled || !this.iconColor) && "custom")}
94
+ color=${b(this.iconColor)}
95
+ data-color=${b((this.disabled || !this.iconColor) && "custom")}
85
96
  name=${this.icon}
86
97
  ></skf-icon>
87
98
  `}
88
99
  </slot>
89
- ${this.shortLabel && d`<div id="short-label">${this.shortLabel}</div>`}
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 = [f, y], n.shadowRootOptions = { ...m.shadowRootOptions, delegatesFocus: !0 };
96
- let e = n;
97
- o([
98
- l({ type: Boolean, reflect: !0 })
99
- ], e.prototype, "disabled", 2);
100
- o([
101
- l({ reflect: !0 })
102
- ], e.prototype, "icon", 2);
103
- o([
104
- l({ reflect: !0, attribute: "icon-color" })
105
- ], e.prototype, "iconColor", 2);
106
- o([
107
- l({ type: Boolean, reflect: !0 })
108
- ], e.prototype, "selected", 2);
109
- o([
110
- l({ reflect: !0, attribute: "short-label" })
111
- ], e.prototype, "shortLabel", 2);
112
- o([
113
- l({ attribute: !1 })
114
- ], e.prototype, "text", 1);
115
- o([
116
- l({ reflect: !0 })
117
- ], e.prototype, "value", 1);
118
- o([
119
- _({ flatten: !0 })
120
- ], e.prototype, "_assignedNodes", 2);
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
+ g("small")
137
+ ], o.prototype, "_handleStateChange", 1);
121
138
  export {
122
- e as SkfSelectOption
139
+ o as SkfSelectOption
123
140
  };
@@ -1,50 +1,62 @@
1
1
  import { css as e } from "lit";
2
2
  const o = e`
3
3
  @layer components {
4
- button {
5
- align-items: center;
6
- background-color: var(--_skf-select-option-bg, var(--skf-interactive-bg-color-secondary));
7
- block-size: var(--_skf-select-option-height, var(--skf-size-44));
8
- color: var(--_skf-select-option-color, inherit);
9
- display: flex;
10
- gap: var(--skf-spacing-50);
11
- padding-inline: var(--skf-spacing-50);
12
- width: 100%;
13
-
14
- &:disabled {
15
- --_skf-select-option-color: var(--skf-interactive-text-color-disabled);
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
- &:is(:hover, :focus):not(:disabled) {
19
- --_skf-select-option-bg: var(--skf-interactive-bg-color-secondary-hover);
20
+ #icon-check {
21
+ opacity: 0;
22
+
23
+ :host([selected]) & {
24
+ opacity: 1;
25
+ }
20
26
  }
21
27
 
22
- &:active:not(:disabled) {
23
- --_skf-select-option-bg: var(--skf-interactive-bg-color-secondary-active);
28
+ #adornments {
29
+ align-items: inherit;
30
+ display: inherit;
31
+ gap: inherit;
32
+ margin-inline-start: auto;
24
33
  }
25
34
 
26
- :host-context(skf-select[size='sm']) & {
27
- --_skf-select-option-height: var(--skf-size-32);
35
+ #short-label {
36
+ color: var(--skf-text-color-tertiary);
28
37
  }
29
38
  }
30
39
 
31
- #icon-check {
32
- opacity: 0;
40
+ @layer states {
41
+ button {
42
+ &:disabled {
43
+ --_skf-select-option-color: var(--skf-interactive-text-color-disabled);
44
+ }
33
45
 
34
- :host([selected]) & {
35
- opacity: 1;
36
- }
37
- }
46
+ &:is(:hover, :focus):not(:disabled) {
47
+ --_skf-select-option-bg: var(--skf-interactive-bg-color-secondary-hover);
48
+ }
38
49
 
39
- #adornments {
40
- align-items: inherit;
41
- display: inherit;
42
- gap: inherit;
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
- #short-label {
47
- color: var(--skf-text-color-tertiary);
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,11 @@
1
+ import { SkfSelectOptionGroup } from '../select/select-option-group.component.js';
1
2
  import '../tag/tag.js';
2
3
  import { FormBase } from '../../internal/components/formBase.js';
3
4
  import '../../internal/components/hint/hint.js';
4
5
  import { PopoverController } from '../../internal/controllers/popover.controller.js';
5
6
  import type { FormFieldSeverity } from '../../internal/types.js';
6
7
  import { type CSSResultGroup } from 'lit';
7
- import type { SelectOptionEvent, SkfSelectOption } from './select-option.component.js';
8
+ import { SkfSelectOption, type SelectOptionEvent } from './select-option.component.js';
8
9
  import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController } from './select.controllers.js';
9
10
  /**
10
11
  * TODO: abstract the popover logic to a separate component/helper/partial, and use it in both select and in input[datalist], combobox etc
@@ -92,6 +93,8 @@ export declare class SkfSelect extends FormBase {
92
93
  /** @internal */
93
94
  $popover: HTMLDivElement;
94
95
  /** @internal */
96
+ _slottedItems: SkfSelectOption[] | SkfSelectOptionGroup[];
97
+ /** @internal */
95
98
  protected globalClickController: GlobalClickController;
96
99
  /** @internal */
97
100
  protected keyboardNavController: KeyboardNavigationController;
@@ -102,6 +105,7 @@ export declare class SkfSelect extends FormBase {
102
105
  constructor();
103
106
  willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
104
107
  firstUpdated(): void;
108
+ _handleSizeUpdate(): void;
105
109
  handleExpandedChange(): void;
106
110
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
107
111
  disconnectedCallback(): void;
@@ -1,28 +1,30 @@
1
+ import { SkfSelectOptionGroup as v } from "./select-option-group.component.js";
1
2
  import "../tag/tag.js";
2
- import { computePosition as v, flip as f, shift as _, offset as g } from "@floating-ui/dom";
3
- import { FormBase as b } from "../../internal/components/formBase.js";
3
+ import { computePosition as _, flip as g, shift as b, offset as y } from "@floating-ui/dom";
4
+ import { FormBase as O } from "../../internal/components/formBase.js";
4
5
  import "../../internal/components/hint/hint.js";
5
- import { PopoverController as y } from "../../internal/controllers/popover.controller.js";
6
- import { findMatchingTags as O } from "../../internal/helpers/findMatchingTags.js";
7
- import { hintSeverity as x } from "../../internal/helpers/hintSeverity.js";
8
- import { raiseError as w } from "../../internal/helpers/raiseError.js";
9
- import { watch as $ } from "../../internal/helpers/watch.js";
6
+ import { PopoverController as x } from "../../internal/controllers/popover.controller.js";
7
+ import { findMatchingTags as w } from "../../internal/helpers/findMatchingTags.js";
8
+ import { hintSeverity as S } from "../../internal/helpers/hintSeverity.js";
9
+ import { raiseError as $ } from "../../internal/helpers/raiseError.js";
10
+ import { watch as f } from "../../internal/helpers/watch.js";
10
11
  import { Asterisk as V } from "../../internal/templates/asterisk.js";
11
- import { componentStyles as S } from "../../styles/component.styles.js";
12
- import { nothing as C, html as n } from "lit";
13
- import { property as o, state as h, query as p } from "lit/decorators.js";
14
- import { classMap as E } from "lit/directives/class-map.js";
12
+ import { componentStyles as C } from "../../styles/component.styles.js";
13
+ import { nothing as E, html as n } from "lit";
14
+ import { property as o, state as h, query as p, queryAssignedElements as L } from "lit/decorators.js";
15
+ import { classMap as k } from "lit/directives/class-map.js";
15
16
  import { ifDefined as m } from "lit/directives/if-defined.js";
16
- import { GlobalClickController as L, KeyboardNavigationController as k, DeveloperFeedbackController as A } from "./select.controllers.js";
17
- import { styles as P } from "./select.styles.js";
18
- var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor, s = (u, t, e, l) => {
19
- for (var r = l > 1 ? void 0 : l ? D(t, e) : t, a = u.length - 1, d; a >= 0; a--)
17
+ import { SkfSelectOption as A } from "./select-option.component.js";
18
+ import { GlobalClickController as P, KeyboardNavigationController as T, DeveloperFeedbackController as D } from "./select.controllers.js";
19
+ import { styles as F } from "./select.styles.js";
20
+ var U = Object.defineProperty, M = Object.getOwnPropertyDescriptor, s = (u, t, e, l) => {
21
+ for (var r = l > 1 ? void 0 : l ? M(t, e) : t, a = u.length - 1, d; a >= 0; a--)
20
22
  (d = u[a]) && (r = (l ? d(t, e, r) : d(r)) || r);
21
- return l && r && T(t, e, r), r;
23
+ return l && r && U(t, e, r), r;
22
24
  };
23
- const c = class c extends b {
25
+ const c = class c extends O {
24
26
  constructor() {
25
- super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.hideLabel = !1, this.hideTags = !1, this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new L(this), this.keyboardNavController = new k(this), this.developerFeedbackController = new A(this), this.popoverController = new y(this), this._handleOptionSelected = (t) => {
27
+ super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.hideLabel = !1, this.hideTags = !1, this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new P(this), this.keyboardNavController = new T(this), this.developerFeedbackController = new D(this), this.popoverController = new x(this), this._handleOptionSelected = (t) => {
26
28
  this._pristine = !1;
27
29
  const e = this._selectedOptions.length > 0;
28
30
  this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
@@ -33,9 +35,9 @@ const c = class c extends b {
33
35
  this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
34
36
  }, 50);
35
37
  }, this.reposition = async () => {
36
- const { x: t, y: e } = await v(this.$anchor, this.$popover, {
38
+ const { x: t, y: e } = await _(this.$anchor, this.$popover, {
37
39
  placement: "bottom",
38
- middleware: [f(), _({ padding: 5 }), g(2)],
40
+ middleware: [g(), b({ padding: 5 }), y(2)],
39
41
  strategy: "fixed"
40
42
  });
41
43
  Object.assign(this.$popover.style, {
@@ -68,7 +70,7 @@ const c = class c extends b {
68
70
  (e || l !== t) && l.removeAttribute("selected");
69
71
  });
70
72
  }, this._handleSlotChange = () => {
71
- this._collectSlotOptionTags(), this._validateInput();
73
+ this._handleSizeUpdate(), this._collectSlotOptionTags(), this._validateInput();
72
74
  }, this._computeVisibleValue = () => {
73
75
  var t, e;
74
76
  return (t = this.$selectedValue) == null || t.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${String(this._selectedOptions.length)} items selected)` : this.value ? ((e = this.$selectedValue) == null || e.classList.remove("contains-meta-info"), this.value) : this.buttonLabel;
@@ -89,8 +91,12 @@ const c = class c extends b {
89
91
  return this._selectedOptions.map((t) => t.textContent ?? "");
90
92
  }
91
93
  set value(t) {
92
- const e = t.split(",").map((l) => l.trim());
93
- this._selectedOptions = this._optionsList.filter((l) => e.includes(l.value.trim()));
94
+ let e = [];
95
+ this.multiple ? e = t.split(",").map((l) => l.toLowerCase().trim()) : e = [t.toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
96
+ (l) => e.includes(l.value.toLowerCase().trim())
97
+ ), this._optionsList.forEach((l) => {
98
+ l.selected && (l.setSelectedDiscrete = !1);
99
+ }), this._selectedOptions.forEach((l) => l.setSelectedDiscrete = !0), this._setValue();
94
100
  }
95
101
  get value() {
96
102
  return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
@@ -123,6 +129,11 @@ const c = class c extends b {
123
129
  var t;
124
130
  this.addEventListener("skf-select-option-select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
125
131
  }
132
+ _handleSizeUpdate() {
133
+ this._slottedItems.forEach((t) => {
134
+ (t instanceof A || t instanceof v) && (t.small = this.size === "sm");
135
+ });
136
+ }
126
137
  handleExpandedChange() {
127
138
  this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
128
139
  console.error(t);
@@ -159,7 +170,7 @@ const c = class c extends b {
159
170
  /** @internal */
160
171
  /** Filter out elements other than skf-select-option and store in this._optionsList */
161
172
  _collectSlotOptionTags() {
162
- this._optionsList = O(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), w({
173
+ this._optionsList = w(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), $({
163
174
  assert: this._optionsList.length > 0,
164
175
  reason: "no-children",
165
176
  replaceStrings: [this.localName, "skf-select-option"]
@@ -204,7 +215,7 @@ const c = class c extends b {
204
215
  >
205
216
  <span
206
217
  id="selected-value"
207
- class=${E({ "selected-value": !0, "contains-meta-info": !this.value })}>
218
+ class=${k({ "selected-value": !0, "contains-meta-info": !this.value })}>
208
219
  ${this._computeVisibleValue()}
209
220
  </span>
210
221
  <skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
@@ -229,12 +240,13 @@ const c = class c extends b {
229
240
  `
230
241
  )}
231
242
  </div>
232
- ` : C}
243
+ ` : E}
233
244
  ${this.hint && n`
234
245
  <skf-hint
246
+ ?disabled=${this.disabled}
235
247
  aria-live=${this._invalid ? "assertive" : "polite"}
236
248
  id="hint"
237
- severity=${m(x(this._invalid, this.severity))}
249
+ severity=${m(S(this._invalid, this.severity))}
238
250
  >
239
251
  ${this.customInvalid ?? this.hint}
240
252
  </skf-hint>
@@ -244,7 +256,7 @@ const c = class c extends b {
244
256
  `;
245
257
  }
246
258
  };
247
- c.styles = [S, P];
259
+ c.styles = [C, F];
248
260
  let i = c;
249
261
  s([
250
262
  o({ type: String, reflect: !0, attribute: "button-label" })
@@ -316,7 +328,13 @@ s([
316
328
  p("#select-dropdown")
317
329
  ], i.prototype, "$popover", 2);
318
330
  s([
319
- $("_expanded", { afterUpdate: !0 })
331
+ L()
332
+ ], i.prototype, "_slottedItems", 2);
333
+ s([
334
+ f("size", { waitUntilFirstUpdate: !0 })
335
+ ], i.prototype, "_handleSizeUpdate", 1);
336
+ s([
337
+ f("_expanded", { afterUpdate: !0 })
320
338
  ], i.prototype, "handleExpandedChange", 1);
321
339
  export {
322
340
  i as SkfSelect
@@ -23,7 +23,7 @@ class d {
23
23
  document.removeEventListener("click", this._globalClickHandler);
24
24
  }
25
25
  }
26
- class p {
26
+ class b {
27
27
  constructor(t) {
28
28
  this._handleKeyDown = (e) => {
29
29
  switch (e.key) {
@@ -82,7 +82,7 @@ class p {
82
82
  return !this.host || !this.host._optionsList ? [] : this.host._optionsList.filter((t) => !t.disabled);
83
83
  }
84
84
  }
85
- class b {
85
+ class p {
86
86
  constructor(t) {
87
87
  (this.host = t).addController(this);
88
88
  }
@@ -103,15 +103,11 @@ class b {
103
103
  ),
104
104
  reason: "attribute-mismatch",
105
105
  replaceStrings: [t, "min or max", "together with multiple"]
106
- }), a({
107
- assert: (this.host.hideTags && this.host.multiple) ?? !this.host.hideTags,
108
- reason: "attribute-mismatch",
109
- replaceStrings: [t, "hide-tags", "together with multiple"]
110
106
  });
111
107
  }
112
108
  }
113
109
  export {
114
- b as DeveloperFeedbackController,
110
+ p as DeveloperFeedbackController,
115
111
  d as GlobalClickController,
116
- p as KeyboardNavigationController
112
+ b as KeyboardNavigationController
117
113
  };