@skf-design-system/ui-components 1.0.2-beta.5 → 1.0.2-beta.7

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