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

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 (117) hide show
  1. package/README.md +18 -0
  2. package/dist/components/alert/alert.component.d.ts +3 -2
  3. package/dist/components/alert/alert.component.js +39 -33
  4. package/dist/components/breadcrumb/breadcrumb-item.component.js +11 -12
  5. package/dist/components/button/button.component.js +32 -36
  6. package/dist/components/button/button.styles.js +3 -3
  7. package/dist/components/checkbox/checkbox.component.d.ts +6 -5
  8. package/dist/components/checkbox/checkbox.component.js +67 -69
  9. package/dist/components/checkbox/checkbox.styles.js +1 -1
  10. package/dist/components/datepicker/datepicker-calendar.component.d.ts +1 -0
  11. package/dist/components/datepicker/datepicker-calendar.component.js +107 -116
  12. package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
  13. package/dist/components/datepicker/datepicker-popup.component.js +112 -100
  14. package/dist/components/datepicker/datepicker-popup.helpers.js +1 -1
  15. package/dist/components/datepicker/datepicker.component.d.ts +4 -2
  16. package/dist/components/datepicker/datepicker.component.js +159 -160
  17. package/dist/components/dialog/dialog.component.d.ts +3 -2
  18. package/dist/components/dialog/dialog.component.js +48 -48
  19. package/dist/components/divider/divider.component.d.ts +3 -0
  20. package/dist/components/divider/divider.component.js +43 -22
  21. package/dist/components/divider/divider.styles.js +9 -9
  22. package/dist/components/drawer/drawer.component.d.ts +12 -4
  23. package/dist/components/drawer/drawer.component.js +84 -61
  24. package/dist/components/drawer/drawer.styles.js +47 -40
  25. package/dist/components/header/header.component.d.ts +4 -2
  26. package/dist/components/header/header.component.js +64 -57
  27. package/dist/components/header/header.styles.js +2 -2
  28. package/dist/components/icon/icon.component.js +26 -16
  29. package/dist/components/icon/icon.styles.js +4 -4
  30. package/dist/components/input/input.component.d.ts +11 -10
  31. package/dist/components/input/input.component.js +115 -111
  32. package/dist/components/input/input.controllers.d.ts +0 -1
  33. package/dist/components/input/input.controllers.js +14 -19
  34. package/dist/components/link/link.component.d.ts +1 -0
  35. package/dist/components/link/link.component.js +86 -74
  36. package/dist/components/link/link.styles.js +7 -3
  37. package/dist/components/loader/loader.component.d.ts +0 -2
  38. package/dist/components/loader/loader.component.js +27 -30
  39. package/dist/components/loader/loader.styles.js +1 -1
  40. package/dist/components/menu/menu-item.styles.js +8 -7
  41. package/dist/components/menu/menu.component.d.ts +5 -2
  42. package/dist/components/menu/menu.component.js +8 -8
  43. package/dist/components/nav/nav.component.d.ts +3 -0
  44. package/dist/components/nav/nav.component.js +38 -33
  45. package/dist/components/popover/popover.component.d.ts +6 -7
  46. package/dist/components/popover/popover.component.js +23 -31
  47. package/dist/components/progress/progress.styles.js +3 -3
  48. package/dist/components/radio/radio.component.d.ts +4 -2
  49. package/dist/components/radio/radio.component.js +96 -91
  50. package/dist/components/radio/radio.styles.js +1 -1
  51. package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
  52. package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
  53. package/dist/components/segmented-button/segmented-button.component.js +22 -24
  54. package/dist/components/select/select-option.component.d.ts +2 -1
  55. package/dist/components/select/select-option.component.js +31 -36
  56. package/dist/components/select/select.component.d.ts +20 -10
  57. package/dist/components/select/select.component.js +139 -104
  58. package/dist/components/select/select.controllers.js +22 -20
  59. package/dist/components/select/select.styles.js +8 -2
  60. package/dist/components/stepper/stepper-item.component.d.ts +1 -1
  61. package/dist/components/stepper/stepper-item.component.js +26 -23
  62. package/dist/components/stepper/stepper-item.styles.js +4 -4
  63. package/dist/components/stepper/stepper.component.js +2 -3
  64. package/dist/components/stepper/stepper.helpers.js +6 -7
  65. package/dist/components/switch/switch.component.d.ts +4 -2
  66. package/dist/components/switch/switch.component.js +64 -58
  67. package/dist/components/switch/switch.styles.js +1 -1
  68. package/dist/components/tabs/tab-panel.component.d.ts +1 -1
  69. package/dist/components/tabs/tab-panel.component.js +19 -16
  70. package/dist/components/tabs/tab.component.d.ts +1 -1
  71. package/dist/components/tabs/tab.component.js +17 -14
  72. package/dist/components/tabs/tab.styles.js +2 -2
  73. package/dist/components/tabs/tabs.component.js +6 -6
  74. package/dist/components/tag/tag.component.d.ts +9 -6
  75. package/dist/components/tag/tag.component.js +78 -72
  76. package/dist/components/tag/tag.styles.js +5 -0
  77. package/dist/components/textarea/textarea.component.d.ts +4 -2
  78. package/dist/components/textarea/textarea.component.js +101 -95
  79. package/dist/components/toast/toast-item.styles.js +13 -10
  80. package/dist/components/toast/toast.singleton.js +6 -7
  81. package/dist/components/tooltip/tooltip.component.d.ts +7 -4
  82. package/dist/components/tooltip/tooltip.component.js +22 -14
  83. package/dist/custom-elements.json +835 -422
  84. package/dist/index.d.ts +2 -2
  85. package/dist/index.js +20 -20
  86. package/dist/internal/base-classes/popover/popover.base.d.ts +29 -9
  87. package/dist/internal/base-classes/popover/popover.base.js +79 -76
  88. package/dist/internal/components/formBase.d.ts +1 -0
  89. package/dist/internal/components/formBase.js +11 -19
  90. package/dist/internal/controllers/popover.controller.d.ts +2 -0
  91. package/dist/internal/controllers/popover.controller.js +11 -14
  92. package/dist/internal/helpers/stateMap.js +3 -3
  93. package/dist/internal/helpers/uuid.d.ts +8 -10
  94. package/dist/internal/helpers/uuid.js +4 -11
  95. package/dist/internal/helpers/watch.d.ts +1 -1
  96. package/dist/internal/templates/asterisk.d.ts +1 -1
  97. package/dist/internal/templates/asterisk.js +4 -4
  98. package/dist/internal/types.d.ts +4 -0
  99. package/dist/styles/global-alt.css +1 -1
  100. package/dist/styles/global.css +1 -1
  101. package/dist/translations/en.d.ts +3 -0
  102. package/dist/translations/en.js +27 -0
  103. package/dist/translations/es.d.ts +3 -0
  104. package/dist/translations/es.js +27 -0
  105. package/dist/translations/index.d.ts +4 -0
  106. package/dist/translations/pt.d.ts +3 -0
  107. package/dist/translations/pt.js +27 -0
  108. package/dist/translations/sv.d.ts +3 -0
  109. package/dist/translations/sv.js +27 -0
  110. package/dist/types/jsx/custom-element-jsx.d.ts +1840 -858
  111. package/dist/types/vue/index.d.ts +69 -64
  112. package/dist/utilities/localize.d.ts +28 -0
  113. package/dist/utilities/localize.js +13 -0
  114. package/dist/vscode.html-custom-data.json +75 -83
  115. package/dist/web-types.json +229 -190
  116. package/package.json +29 -35
  117. package/custom-elements.json +0 -25490
@@ -2,6 +2,7 @@ import '../icon/icon.js';
2
2
  import { FormBase } from '../../internal/components/formBase.js';
3
3
  import type { FormFieldSeverity } from '../../internal/types.js';
4
4
  import type { FormFieldBaseProps } from '../../internal/types/formField.js';
5
+ import { type Language } from '../../utilities/localize.js';
5
6
  import { type CSSResultGroup } from 'lit';
6
7
  /**
7
8
  * The `<skf-radio>` component is used to create a radio input
@@ -18,6 +19,7 @@ import { type CSSResultGroup } from 'lit';
18
19
  * @tagname skf-radio
19
20
  */
20
21
  export declare class SkfRadio extends FormBase implements FormFieldBaseProps {
22
+ #private;
21
23
  static styles: CSSResultGroup;
22
24
  /**
23
25
  * @internal
@@ -32,10 +34,10 @@ export declare class SkfRadio extends FormBase implements FormFieldBaseProps {
32
34
  customInvalid: boolean;
33
35
  /** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
34
36
  label?: string;
37
+ /** Sets the internal language of the component */
38
+ lang: Language;
35
39
  /** If defined, adds name to the input-element */
36
40
  name?: string;
37
- /** If defined, renders an alternative A11y text for the asterisk */
38
- requiredLabel?: string;
39
41
  /** Size of the Radio */
40
42
  size: 'sm' | 'md';
41
43
  /** If defined, displays provided severity state */
@@ -1,34 +1,40 @@
1
- import "../icon/icon.js";
2
- import { FormBase as c } from "../../internal/components/formBase.js";
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
- const d = class d extends c {
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, r) => (m(e, i, "write to private field"), r ? r.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 o, 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, a = (e, i, t, r) => {
18
+ for (var l = r > 1 ? void 0 : r ? D(i, t) : i, h = e.length - 1, n; h >= 0; h--)
19
+ (n = e[h]) && (l = (r ? n(i, t, l) : n(l)) || l);
20
+ return r && l && F(i, t, l), l;
21
+ }, d;
22
+ const u = class u extends _ {
17
23
  constructor() {
18
- super(...arguments), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.customInvalid = !1, this.size = "md", this.showValid = !1, this.value = "", this._invalid = !1, this._resetValue = (e) => {
19
- e.stopPropagation(), this.checked = this._initialChecked, this.$input && (this.$input.checked = !!this._initialChecked), this.setFormValue(this.checked ? this.value : "");
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 e;
27
- (e = this.$input) == null || e.addEventListener("change", (s) => {
28
- var l;
29
- s.stopPropagation(), this.pristine = !1, this.checked = ((l = this.$input) == null ? void 0 : l.checked) ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(""), this.emitEvent("change");
30
- }), this.addEventListener("invalid", (s) => {
31
- this.pristine = !1, this._invalid = !0, this.customErrorDisplay && s.preventDefault();
34
+ this.$input?.addEventListener("change", (t) => {
35
+ t.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(""), this.emitEvent("change");
36
+ }), this.addEventListener("invalid", (t) => {
37
+ this.pristine = !1, this._invalid = !0, this.customErrorDisplay && t.preventDefault();
32
38
  }), this._initialChecked = this.checked, this.addEventListener("reset", this._resetValue);
33
39
  }
34
40
  handleInvalidChange() {
@@ -42,109 +48,108 @@ const d = class d extends c {
42
48
  }
43
49
  handleCustomInvalidChange() {
44
50
  if (this.customInvalid) {
45
- const s = (
51
+ const r = (
46
52
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
47
53
  this.getAttribute("data-customerror") || "Set a custom error message using the data-customerror attribute"
48
54
  );
49
- this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, s), this.checkValidity();
55
+ this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, r), this.checkValidity();
50
56
  } else
51
57
  this.setValidity({}), this._validateInput();
52
58
  }
53
59
  /** @internal */
54
60
  _uncheckSiblingRadios() {
55
- const e = this.name;
56
- if (!e) return;
57
- (this.form ?? document).querySelectorAll(`skf-radio[name="${e}"]`).forEach((a) => {
58
- const o = this.form === a.form, h = !this.form && !a.form;
59
- a !== this && (o || h) && (a.checked = !1);
61
+ const t = this.name;
62
+ if (!t) return;
63
+ (this.form ?? document).querySelectorAll(`skf-radio[name="${t}"]`).forEach((h) => {
64
+ const n = this.form === h.form, g = !this.form && !h.form;
65
+ h !== this && (n || g) && (h.checked = !1);
60
66
  });
61
67
  }
62
68
  /** @internal */
63
69
  _validateInput() {
64
- var e;
65
70
  if (this._invalid = !1, this.customInvalid) {
66
- const s = this.getAttribute("data-customerror");
67
- this.setValidity({ customError: !0 }, this.withFallback(s)), this._invalid = !0;
71
+ const t = this.getAttribute("data-customerror");
72
+ this.setValidity({ customError: !0 }, this.withFallback(t)), this._invalid = !0;
68
73
  } else if (this.required && !this.checked) {
69
74
  this.pristine || (this._invalid = !0);
70
- const s = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
75
+ const t = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
71
76
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
72
- ((e = this.$input) == null ? void 0 : e.validationMessage) || "Please check this radio if you want to proceed"
77
+ this.$input?.validationMessage || "Please check this radio if you want to proceed"
73
78
  );
74
- this.setValidity({ valueMissing: !0 }, this.withFallback(s));
79
+ this.setValidity({ valueMissing: !0 }, this.withFallback(t));
75
80
  } else
76
81
  this.setValidity({});
77
82
  }
78
83
  render() {
79
- return m`
84
+ return $`
80
85
  <label id="root">
81
86
  <input
82
87
  ?disabled=${this.disabled}
83
88
  ?required=${this.required}
84
- .checked=${_(this.checked)}
89
+ .checked=${A(this.checked)}
85
90
  aria-invalid=${!!this._invalid}
86
- name=${b(this.name)}
91
+ name=${w(this.name)}
87
92
  type="radio"
88
93
  value=${this.value}
89
94
  />
90
95
  <div id="label">
91
96
  <slot>${this.label}</slot>
92
- ${this.required ? p(this.requiredLabel) : null}
97
+ ${this.required ? b(v(this, d).term("required")) : V}
93
98
  </div>
94
99
  </label>
95
100
  `;
96
101
  }
97
102
  };
98
- d.styles = [v, g];
99
- let t = d;
100
- i([
101
- r({ type: Boolean })
102
- ], t.prototype, "debug", 2);
103
- i([
104
- r({ type: Boolean, reflect: !0 })
105
- ], t.prototype, "checked", 2);
106
- i([
107
- r({ type: Boolean, attribute: "custom-invalid" })
108
- ], t.prototype, "customInvalid", 2);
109
- i([
110
- r()
111
- ], t.prototype, "label", 2);
112
- i([
113
- r()
114
- ], t.prototype, "name", 2);
115
- i([
116
- r({ attribute: "required-label" })
117
- ], t.prototype, "requiredLabel", 2);
118
- i([
119
- r({ reflect: !0 })
120
- ], t.prototype, "size", 2);
121
- i([
122
- r()
123
- ], t.prototype, "severity", 2);
124
- i([
125
- r({ type: Boolean, attribute: "show-valid" })
126
- ], t.prototype, "showValid", 2);
127
- i([
128
- r()
129
- ], t.prototype, "value", 2);
130
- i([
131
- f()
132
- ], t.prototype, "_invalid", 2);
133
- i([
134
- y("input")
135
- ], t.prototype, "$input", 2);
136
- i([
137
- n("_invalid")
138
- ], t.prototype, "handleInvalidChange", 1);
139
- i([
140
- n("_invalid", { afterUpdate: !0 })
141
- ], t.prototype, "handleDebugInvalid", 1);
142
- i([
143
- n("checked")
144
- ], t.prototype, "handleCheckedChanged", 1);
145
- i([
146
- n("customInvalid")
147
- ], t.prototype, "handleCustomInvalidChange", 1);
103
+ d = new WeakMap(), u.styles = [k, q];
104
+ let s = u;
105
+ a([
106
+ o({ type: Boolean })
107
+ ], s.prototype, "debug", 2);
108
+ a([
109
+ o({ type: Boolean, reflect: !0 })
110
+ ], s.prototype, "checked", 2);
111
+ a([
112
+ o({ type: Boolean, attribute: "custom-invalid" })
113
+ ], s.prototype, "customInvalid", 2);
114
+ a([
115
+ o()
116
+ ], s.prototype, "label", 2);
117
+ a([
118
+ o({ type: String })
119
+ ], s.prototype, "lang", 2);
120
+ a([
121
+ o()
122
+ ], s.prototype, "name", 2);
123
+ a([
124
+ o({ reflect: !0 })
125
+ ], s.prototype, "size", 2);
126
+ a([
127
+ o()
128
+ ], s.prototype, "severity", 2);
129
+ a([
130
+ o({ type: Boolean, attribute: "show-valid" })
131
+ ], s.prototype, "showValid", 2);
132
+ a([
133
+ o()
134
+ ], s.prototype, "value", 2);
135
+ a([
136
+ I()
137
+ ], s.prototype, "_invalid", 2);
138
+ a([
139
+ E("input")
140
+ ], s.prototype, "$input", 2);
141
+ a([
142
+ c("_invalid")
143
+ ], s.prototype, "handleInvalidChange", 1);
144
+ a([
145
+ c("_invalid", { afterUpdate: !0 })
146
+ ], s.prototype, "handleDebugInvalid", 1);
147
+ a([
148
+ c("checked")
149
+ ], s.prototype, "handleCheckedChanged", 1);
150
+ a([
151
+ c("customInvalid")
152
+ ], s.prototype, "handleCustomInvalidChange", 1);
148
153
  export {
149
- t as SkfRadio
154
+ s as SkfRadio
150
155
  };
@@ -51,7 +51,7 @@ const e = [
51
51
  }
52
52
 
53
53
  &:checked:not(:disabled) {
54
- --_skf-radio-bg-color: var(--skf-bg-color-emphasised);
54
+ --_skf-radio-bg-color: var(--skf-bg-color-emphasized);
55
55
  --_skf-radio-border-color: transparent;
56
56
  --_skf-radio-marker-content: '';
57
57
  }
@@ -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="emphasised" name="check" size="sm"></skf-icon>` : m}
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-emphasised);
40
+ --_skf-segmented-button-item-border: var(--skf-border-color-emphasized);
41
41
  }
42
42
 
43
43
  &:hover:not(:disabled) {
@@ -1,35 +1,32 @@
1
1
  import { SkfElement as d } from "../../internal/components/skf-element.js";
2
- import { componentStyles as m } from "../../styles/component.styles.js";
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 y } from "./segmented-button.styles.js";
7
- var v = Object.defineProperty, n = (a, s, e, i) => {
8
- for (var t = void 0, o = a.length - 1, r; o >= 0; o--)
9
- (r = a[o]) && (t = r(s, e, t) || t);
10
- return t && v(s, e, t), t;
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 e = s.detail.item;
16
- this.multiple && (e.selected = !e.selected), this.value = "";
15
+ const t = s.detail.item;
16
+ this.multiple && (t.selected = !t.selected), this.value = "";
17
17
  let i = [];
18
- this.items.forEach((t) => {
19
- this.multiple ? t.selected && (i = [...i, t.value], this.value = i.join()) : t !== e ? t.selected = !1 : (t.selected = !0, this.value = t.value);
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 e = this.items.filter((i) => i.selected);
25
- e.length > 1 && e.slice(0, -1).forEach((i) => i.selected = !1);
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
- if (["ArrowLeft", "ArrowRight"].includes(s.key)) {
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 e = this.items.findIndex((r) => r === document.activeElement);
44
- if (e === -1) return;
45
- const t = (e + (s === "ArrowRight" ? 1 : -1)) % this.items.length;
46
- return this.items[t < 0 ? this.items.length - 1 : t];
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
- <slot
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
- ></slot>
52
+ >
53
+ <slot @slotchange=${this._handleSlotChange}></slot>
54
+ </div>
57
55
  `;
58
56
  }
59
57
  };
60
- h.styles = [m, y];
58
+ h.styles = [a, v];
61
59
  let l = h;
62
60
  n([
63
61
  u({ type: Boolean })
@@ -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
  *
@@ -51,7 +52,7 @@ export declare class SkfSelectOption extends SkfElement {
51
52
  /** The option's label text (equivalent to the tags textContent) */
52
53
  set text(slottedTextContent: string);
53
54
  get text(): string;
54
- /** Returns or sets the tags value. If value is omitted, defaults to the tags text. */
55
+ /** Returns or sets the option value. If value is omitted, defaults to the tags slotted text. */
55
56
  set value(optionValue: string);
56
57
  get value(): string;
57
58
  small: boolean;
@@ -1,47 +1,45 @@
1
1
  var y = (e) => {
2
2
  throw TypeError(e);
3
3
  };
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);
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
6
  import "../icon/icon.js";
7
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";
8
+ import { stateMap as g } from "../../internal/helpers/stateMap.js";
9
+ import { watch as x } from "../../internal/helpers/watch.js";
10
10
  import { componentStyles as N } from "../../styles/component.styles.js";
11
11
  import { LitElement as T, html as _ } from "lit";
12
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";
13
+ import { ifDefined as v } from "lit/directives/if-defined.js";
14
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;
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
19
  }, n, h;
20
20
  const c = class c extends C {
21
21
  constructor() {
22
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) => {
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
26
  t.stopPropagation(), this.selected = !this.selected;
27
- }, this.role = "option", this._parent = this.closest("skf-select"), this._shortcutUpdate = !1;
27
+ }, this._shortcutUpdate = !1;
28
28
  }
29
29
  set text(t) {
30
30
  this.textContent = t.trim();
31
31
  }
32
32
  get text() {
33
- var t;
34
- return ((t = this.textContent) == null ? void 0 : t.trim()) ?? "";
33
+ return this.textContent?.trim() ?? "";
35
34
  }
36
35
  set value(t) {
37
36
  this._value = t.trim();
38
37
  }
39
38
  get value() {
40
- var t;
41
- 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;
42
40
  }
43
41
  updated(t) {
44
- 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", {
45
43
  detail: {
46
44
  value: this.selected ? this.value : null,
47
45
  option: this
@@ -49,7 +47,7 @@ const c = class c extends C {
49
47
  });
50
48
  }
51
49
  _handleStateChange() {
52
- x(u(this, h), "small").set(this.small);
50
+ g(u(this, h), "small").set(this.small);
53
51
  }
54
52
  /**
55
53
  * @internal
@@ -71,10 +69,7 @@ const c = class c extends C {
71
69
  /** @internal */
72
70
  get _slotContainsOnlyText() {
73
71
  return this._assignedNodes ? [...this._assignedNodes].every(
74
- (i) => {
75
- var r;
76
- return i.nodeType === Node.TEXT_NODE && ((r = i.textContent) == null ? void 0 : r.trim()) !== "";
77
- }
72
+ (i) => i.nodeType === Node.TEXT_NODE && i.textContent?.trim() !== ""
78
73
  ) : "";
79
74
  }
80
75
  render() {
@@ -91,8 +86,8 @@ const c = class c extends C {
91
86
  <slot name="icon">
92
87
  ${this.icon && _`
93
88
  <skf-icon
94
- color=${b(this.iconColor)}
95
- data-color=${b((this.disabled || !this.iconColor) && "custom")}
89
+ color=${v(this.iconColor)}
90
+ data-color=${v((this.disabled || !this.iconColor) && "custom")}
96
91
  name=${this.icon}
97
92
  ></skf-icon>
98
93
  `}
@@ -105,35 +100,35 @@ const c = class c extends C {
105
100
  };
106
101
  n = new WeakMap(), h = new WeakMap(), c.styles = [N, E], c.shadowRootOptions = { ...T.shadowRootOptions, delegatesFocus: !0 };
107
102
  let o = c;
108
- l([
103
+ r([
109
104
  a({ type: Boolean, reflect: !0 })
110
105
  ], o.prototype, "disabled", 2);
111
- l([
106
+ r([
112
107
  a({ reflect: !0 })
113
108
  ], o.prototype, "icon", 2);
114
- l([
109
+ r([
115
110
  a({ reflect: !0, attribute: "icon-color" })
116
111
  ], o.prototype, "iconColor", 2);
117
- l([
112
+ r([
118
113
  a({ type: Boolean, reflect: !0 })
119
114
  ], o.prototype, "selected", 2);
120
- l([
115
+ r([
121
116
  a({ reflect: !0, attribute: "short-label" })
122
117
  ], o.prototype, "shortLabel", 2);
123
- l([
118
+ r([
124
119
  a({ attribute: !1 })
125
120
  ], o.prototype, "text", 1);
126
- l([
121
+ r([
127
122
  a({ reflect: !0 })
128
123
  ], o.prototype, "value", 1);
129
- l([
124
+ r([
130
125
  $()
131
126
  ], o.prototype, "small", 2);
132
- l([
127
+ r([
133
128
  O({ flatten: !0 })
134
129
  ], o.prototype, "_assignedNodes", 2);
135
- l([
136
- g("small")
130
+ r([
131
+ x("small")
137
132
  ], o.prototype, "_handleStateChange", 1);
138
133
  export {
139
134
  o as SkfSelectOption
@@ -4,6 +4,7 @@ import { FormBase } from '../../internal/components/formBase.js';
4
4
  import '../../internal/components/hint/hint.js';
5
5
  import { PopoverController } from '../../internal/controllers/popover.controller.js';
6
6
  import type { FormFieldSeverity } from '../../internal/types.js';
7
+ import { type Language } from '../../utilities/localize.js';
7
8
  import { type CSSResultGroup } from 'lit';
8
9
  import { SkfSelectOption, type SelectOptionEvent } from './select-option.component.js';
9
10
  import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController } from './select.controllers.js';
@@ -27,11 +28,15 @@ import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationC
27
28
  * @event {Event} reset - Fired when the form is reset
28
29
  * @event {CustomEvent} skf-select-dropdown - {detail: {expanded: boolean}} Fired when the select dropdown is toggled
29
30
  * @event {CustomEvent} skf-select-option-select - {detail: {value: string | null, option: SkfSelectOption}} Fired when the select dropdown is toggled
31
+ * @event {CustomEvent} skf-select-connected - Fires when the select options are connected, useful for setting selected option(s) via value property. E.g mySkfSelect.value = 'option1,option2';
30
32
  *
31
33
  * @tagname skf-select
32
34
  */
33
35
  export declare class SkfSelect extends FormBase {
36
+ #private;
34
37
  static styles: CSSResultGroup;
38
+ private _componentIsConnected;
39
+ private _defaultButtonLabel;
35
40
  /** @internal */
36
41
  selectDelay: number;
37
42
  /** @internal */
@@ -54,30 +59,29 @@ export declare class SkfSelect extends FormBase {
54
59
  get selectedOptionsText(): string[];
55
60
  /** If defined, displays provided label */
56
61
  label?: string;
62
+ /** Sets the internal language of the component */
63
+ lang: Language;
57
64
  /** If defined, limits the number of selectable options */
58
65
  max?: number;
66
+ maxVisibleItems?: number;
59
67
  /** If defined, sets the minimum number of required options */
60
68
  min?: number;
61
69
  /** If true, allows for multiple options to be selected */
62
70
  multiple: boolean;
63
71
  /** If defined, set name of the component */
64
72
  name?: string;
65
- /** If defined, renders an alternative A11y text for the asterisk */
66
- requiredLabel?: string;
67
73
  /** If defined, displays provided severity state */
68
74
  severity?: FormFieldSeverity;
69
75
  /** If true, displays valid state after interaction */
70
76
  showValid: boolean;
71
77
  /** Size of the Select */
72
78
  size: 'sm' | 'md';
73
- /** Read only, returns the selected value. (if multiple: in a comma separated string) */
79
+ /** Returns the selected value. (if multiple: in a comma separated string). If set will default set corresponding option. */
74
80
  set value(newValue: string);
75
81
  get value(): string;
76
- /** @internal */
77
- /** Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
82
+ /** @internal - Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
78
83
  private _selectedOptions;
79
- /** @internal */
80
- /** The selected options in an array. Treat it as a read only property. See selectedValues, slectedSlots for computed value arrays. */
84
+ /** @internal - Read only. The selected options in an array. See also selectedValues, slectedSlots for computed value arrays. */
81
85
  set selectedOptions(option: SkfSelectOption[]);
82
86
  /** @internal */
83
87
  get selectedOptions(): SkfSelectOption[];
@@ -86,6 +90,7 @@ export declare class SkfSelect extends FormBase {
86
90
  /** @internal */
87
91
  /** True if the internal state is invalid */
88
92
  private _invalid;
93
+ private desiredPopupHeight?;
89
94
  /** @internal */
90
95
  $anchor: HTMLButtonElement;
91
96
  /** @internal */
@@ -106,10 +111,13 @@ export declare class SkfSelect extends FormBase {
106
111
  willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
107
112
  firstUpdated(): void;
108
113
  _handleSizeUpdate(): void;
109
- handleExpandedChange(): void;
114
+ /** @internal */
115
+ _handleExpandedChange(): void;
110
116
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
111
117
  disconnectedCallback(): void;
112
118
  /** @internal */
119
+ _getOptionalDropdownHeight(_skfSelectOption: SkfSelectOption): number | undefined;
120
+ /** @internal */
113
121
  _handleOptionSelected: EventListener;
114
122
  /** @internal */
115
123
  _updateState(event: CustomEvent<SelectOptionEvent>): void;
@@ -135,8 +143,10 @@ export declare class SkfSelect extends FormBase {
135
143
  _resetSelectedOptions: (target?: SkfSelectOption) => void;
136
144
  /** @internal */
137
145
  _handleSlotChange: () => void;
138
- /** @internal */
139
- _computeVisibleValue: () => string;
146
+ /** @internal - on slot update, if value is set, select the corresponding option */
147
+ _ifValueIsSetSelectOption: () => void;
148
+ /** @internal - Computes the visible value of the select component - if multiple options are selected, shows a visually dimmed summary (meta info) */
149
+ _computeVisibleValue: () => string | null;
140
150
  /** @internal */
141
151
  private _validateInput;
142
152
  render(): import("lit").TemplateResult<1>;