@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,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,12 @@
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';
7
+ import { type Language } from '../../utilities/localize.js';
6
8
  import { type CSSResultGroup } from 'lit';
7
- import type { SelectOptionEvent, SkfSelectOption } from './select-option.component.js';
9
+ import { SkfSelectOption, type SelectOptionEvent } from './select-option.component.js';
8
10
  import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController } from './select.controllers.js';
9
11
  /**
10
12
  * TODO: abstract the popover logic to a separate component/helper/partial, and use it in both select and in input[datalist], combobox etc
@@ -26,11 +28,14 @@ import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationC
26
28
  * @event {Event} reset - Fired when the form is reset
27
29
  * @event {CustomEvent} skf-select-dropdown - {detail: {expanded: boolean}} Fired when the select dropdown is toggled
28
30
  * @event {CustomEvent} skf-select-option-select - {detail: {value: string | null, option: SkfSelectOption}} Fired when the select dropdown is toggled
31
+ * @event {CustomEvent} skf-update-calendar-view - Fires when the calendar view is updated
29
32
  *
30
33
  * @tagname skf-select
31
34
  */
32
35
  export declare class SkfSelect extends FormBase {
36
+ #private;
33
37
  static styles: CSSResultGroup;
38
+ private _componentIsConnected;
34
39
  /** @internal */
35
40
  selectDelay: number;
36
41
  /** @internal */
@@ -53,6 +58,8 @@ export declare class SkfSelect extends FormBase {
53
58
  get selectedOptionsText(): string[];
54
59
  /** If defined, displays provided label */
55
60
  label?: string;
61
+ /** Sets the internal language of the component */
62
+ lang: Language;
56
63
  /** If defined, limits the number of selectable options */
57
64
  max?: number;
58
65
  /** If defined, sets the minimum number of required options */
@@ -61,22 +68,18 @@ export declare class SkfSelect extends FormBase {
61
68
  multiple: boolean;
62
69
  /** If defined, set name of the component */
63
70
  name?: string;
64
- /** If defined, renders an alternative A11y text for the asterisk */
65
- requiredLabel?: string;
66
71
  /** If defined, displays provided severity state */
67
72
  severity?: FormFieldSeverity;
68
73
  /** If true, displays valid state after interaction */
69
74
  showValid: boolean;
70
75
  /** Size of the Select */
71
76
  size: 'sm' | 'md';
72
- /** Read only, returns the selected value. (if multiple: in a comma separated string) */
77
+ /** Returns the selected value. (if multiple: in a comma separated string). If set will default set corresponding option. */
73
78
  set value(newValue: string);
74
79
  get value(): string;
75
- /** @internal */
76
- /** Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
80
+ /** @internal - Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
77
81
  private _selectedOptions;
78
- /** @internal */
79
- /** The selected options in an array. Treat it as a read only property. See selectedValues, slectedSlots for computed value arrays. */
82
+ /** @internal - Read only. The selected options in an array. See also selectedValues, slectedSlots for computed value arrays. */
80
83
  set selectedOptions(option: SkfSelectOption[]);
81
84
  /** @internal */
82
85
  get selectedOptions(): SkfSelectOption[];
@@ -92,6 +95,8 @@ export declare class SkfSelect extends FormBase {
92
95
  /** @internal */
93
96
  $popover: HTMLDivElement;
94
97
  /** @internal */
98
+ _slottedItems: SkfSelectOption[] | SkfSelectOptionGroup[];
99
+ /** @internal */
95
100
  protected globalClickController: GlobalClickController;
96
101
  /** @internal */
97
102
  protected keyboardNavController: KeyboardNavigationController;
@@ -102,6 +107,7 @@ export declare class SkfSelect extends FormBase {
102
107
  constructor();
103
108
  willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
104
109
  firstUpdated(): void;
110
+ _handleSizeUpdate(): void;
105
111
  handleExpandedChange(): void;
106
112
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
107
113
  disconnectedCallback(): void;
@@ -131,8 +137,10 @@ export declare class SkfSelect extends FormBase {
131
137
  _resetSelectedOptions: (target?: SkfSelectOption) => void;
132
138
  /** @internal */
133
139
  _handleSlotChange: () => void;
134
- /** @internal */
135
- _computeVisibleValue: () => string;
140
+ /** @internal - on slot update, if value is set, select the corresponding option */
141
+ _ifValueIsSetSelectOption: () => void;
142
+ /** @internal - Computes the visible value of the select component - if multiple options are selected, shows a visually dimmed summary (meta info) */
143
+ _computeVisibleValue: () => string | null;
136
144
  /** @internal */
137
145
  private _validateInput;
138
146
  render(): import("lit").TemplateResult<1>;
@@ -1,28 +1,38 @@
1
+ var _ = (l) => {
2
+ throw TypeError(l);
3
+ };
4
+ var v = (l, r, t) => r.has(l) || _("Cannot " + t);
5
+ var c = (l, r, t) => (v(l, r, "read from private field"), t ? t.call(l) : r.get(l)), g = (l, r, t) => r.has(l) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(l) : r.set(l, t), y = (l, r, t, e) => (v(l, r, "write to private field"), e ? e.call(l, t) : r.set(l, t), t);
6
+ import { SkfSelectOptionGroup as w } from "./select-option-group.component.js";
1
7
  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";
8
+ import { computePosition as x, flip as C, shift as V, offset as $ } from "@floating-ui/dom";
9
+ import { FormBase as L } from "../../internal/components/formBase.js";
4
10
  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";
10
- 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";
15
- 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--)
20
- (d = u[a]) && (r = (l ? d(t, e, r) : d(r)) || r);
21
- return l && r && T(t, e, r), r;
22
- };
23
- const c = class c extends b {
11
+ import { PopoverController as E } from "../../internal/controllers/popover.controller.js";
12
+ import { findMatchingTags as k } from "../../internal/helpers/findMatchingTags.js";
13
+ import { hintSeverity as A } from "../../internal/helpers/hintSeverity.js";
14
+ import { raiseError as D } from "../../internal/helpers/raiseError.js";
15
+ import { watch as S } from "../../internal/helpers/watch.js";
16
+ import { Asterisk as I } from "../../internal/templates/asterisk.js";
17
+ import { componentStyles as P } from "../../styles/component.styles.js";
18
+ import { LocalizeController as T } from "../../utilities/localize.js";
19
+ import { nothing as b, html as p } from "lit";
20
+ import { property as a, state as u, query as m, queryAssignedElements as F } from "lit/decorators.js";
21
+ import { classMap as U } from "lit/directives/class-map.js";
22
+ import { ifDefined as O } from "lit/directives/if-defined.js";
23
+ import { SkfSelectOption as z } from "./select-option.component.js";
24
+ import { GlobalClickController as M, KeyboardNavigationController as q, DeveloperFeedbackController as j } from "./select.controllers.js";
25
+ import { styles as N } from "./select.styles.js";
26
+ var B = Object.defineProperty, R = Object.getOwnPropertyDescriptor, o = (l, r, t, e) => {
27
+ for (var i = e > 1 ? void 0 : e ? R(r, t) : r, d = l.length - 1, n; d >= 0; d--)
28
+ (n = l[d]) && (i = (e ? n(r, t, i) : n(i)) || i);
29
+ return e && i && B(r, t, i), i;
30
+ }, h;
31
+ const f = class f extends L {
24
32
  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) => {
33
+ super();
34
+ g(this, h);
35
+ y(this, h, new T(this)), this._componentIsConnected = !1, this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.hideLabel = !1, this.hideTags = !1, this.lang = "en", this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new M(this), this.keyboardNavController = new q(this), this.developerFeedbackController = new j(this), this.popoverController = new E(this), this._handleOptionSelected = (t) => {
26
36
  this._pristine = !1;
27
37
  const e = this._selectedOptions.length > 0;
28
38
  this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
@@ -33,9 +43,9 @@ const c = class c extends b {
33
43
  this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
34
44
  }, 50);
35
45
  }, this.reposition = async () => {
36
- const { x: t, y: e } = await v(this.$anchor, this.$popover, {
46
+ const { x: t, y: e } = await x(this.$anchor, this.$popover, {
37
47
  placement: "bottom",
38
- middleware: [f(), _({ padding: 5 }), g(2)],
48
+ middleware: [C(), V(), $(2)],
39
49
  strategy: "fixed"
40
50
  });
41
51
  Object.assign(this.$popover.style, {
@@ -59,19 +69,36 @@ const c = class c extends b {
59
69
  default:
60
70
  throw new Error("Something went wrong");
61
71
  }
62
- this.emitEvent("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
72
+ this._componentIsConnected && this.emitEvent("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
63
73
  this.multiple || (this._expanded = !1), t("done");
64
74
  });
65
75
  }), this._resetSelectedOptions = (t) => {
66
76
  const e = !t;
67
- this._optionsList.forEach((l) => {
68
- (e || l !== t) && l.removeAttribute("selected");
69
- });
77
+ this._optionsList.forEach((i) => {
78
+ (e || i !== t) && i.removeAttribute("selected");
79
+ }), this._optionsList = [];
70
80
  }, this._handleSlotChange = () => {
71
- this._collectSlotOptionTags(), this._validateInput();
81
+ this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0;
82
+ }, this._ifValueIsSetSelectOption = () => {
83
+ if (this.value)
84
+ if (this.multiple) {
85
+ const t = String(this.value).split(",").map((e) => e.toLowerCase().trim());
86
+ this._optionsList.forEach((e) => {
87
+ t.includes(e.value.toLowerCase().trim()) ? (e.setSelectedDiscrete = !0, this.selectedOptions = [...this.selectedOptions, e]) : (e.setSelectedDiscrete = !1, this._selectedOptions = this._selectedOptions.filter(
88
+ (i) => i.value.toLowerCase().trim() !== e.value.toLowerCase().trim()
89
+ ));
90
+ }), this._setValue().catch((e) => {
91
+ console.error(e);
92
+ });
93
+ } else {
94
+ const t = this.value.toLowerCase().trim(), e = this._optionsList.find((i) => i.value.toLowerCase().trim() === t);
95
+ e && (e.setSelectedDiscrete = !0, this.selectedOptions = [e], this._setValue().catch((i) => {
96
+ console.error(i);
97
+ }));
98
+ }
72
99
  }, this._computeVisibleValue = () => {
73
100
  var t, e;
74
- 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;
101
+ return (t = this.$selectedValue) == null || t.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${c(this, h).term("itemsSelected", this._selectedOptions.length)})` : this.value ? ((e = this.$selectedValue) == null || e.classList.remove("contains-meta-info"), this._selectedOptions[0].textContent) : this.buttonLabel;
75
102
  }, this._selectedOptions = [];
76
103
  }
77
104
  set selectedValues(t) {
@@ -89,8 +116,12 @@ const c = class c extends b {
89
116
  return this._selectedOptions.map((t) => t.textContent ?? "");
90
117
  }
91
118
  set value(t) {
92
- const e = t.split(",").map((l) => l.trim());
93
- this._selectedOptions = this._optionsList.filter((l) => e.includes(l.value.trim()));
119
+ let e = [];
120
+ this.multiple ? e = String(t).split(",").map((i) => i.toLowerCase().trim()) : e = [String(t).toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
121
+ (i) => e.includes(i.value.toLowerCase().trim())
122
+ ), this._optionsList.forEach((i) => {
123
+ i.selected && (i.setSelectedDiscrete = !1);
124
+ }), this._selectedOptions.forEach((i) => i.setSelectedDiscrete = !0), this._setValue();
94
125
  }
95
126
  get value() {
96
127
  return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
@@ -123,16 +154,21 @@ const c = class c extends b {
123
154
  var t;
124
155
  this.addEventListener("skf-select-option-select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
125
156
  }
157
+ _handleSizeUpdate() {
158
+ this._slottedItems.forEach((t) => {
159
+ (t instanceof z || t instanceof w) && (t.small = this.size === "sm");
160
+ });
161
+ }
126
162
  handleExpandedChange() {
127
163
  this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
128
164
  console.error(t);
129
165
  })), this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
130
166
  }
131
- attributeChangedCallback(t, e, l) {
132
- if (super.attributeChangedCallback(t, e, l), t === "custom-invalid")
133
- if (typeof l == "string") {
134
- const a = this.withFallback(l);
135
- this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, a), this.checkValidity();
167
+ attributeChangedCallback(t, e, i) {
168
+ if (super.attributeChangedCallback(t, e, i), t === "custom-invalid")
169
+ if (typeof i == "string") {
170
+ const n = this.withFallback(i);
171
+ this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, n), this.checkValidity();
136
172
  } else
137
173
  this.setValidity({}), this._validateInput();
138
174
  }
@@ -147,8 +183,8 @@ const c = class c extends b {
147
183
  e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
148
184
  });
149
185
  else {
150
- const e = this._selectedOptions.length > 0, l = t.detail.value !== null;
151
- e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), l && (this.selectedOptions = [t.target]);
186
+ const e = this._selectedOptions.length > 0, i = t.detail.value !== null;
187
+ e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), i && (this.selectedOptions = [t.target]);
152
188
  }
153
189
  this._setValue();
154
190
  }
@@ -159,7 +195,7 @@ const c = class c extends b {
159
195
  /** @internal */
160
196
  /** Filter out elements other than skf-select-option and store in this._optionsList */
161
197
  _collectSlotOptionTags() {
162
- this._optionsList = O(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), w({
198
+ this._optionsList = k(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), D({
163
199
  assert: this._optionsList.length > 0,
164
200
  reason: "no-children",
165
201
  replaceStrings: [this.localName, "skf-select-option"]
@@ -168,29 +204,29 @@ const c = class c extends b {
168
204
  /** @internal */
169
205
  _validateInput() {
170
206
  this._invalid = !1;
171
- const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), l = !!(this.max && this.selectedValues.length > this.max);
207
+ const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), i = !!(this.max && this.selectedValues.length > this.max);
172
208
  if (this._internals.validity.customError) {
173
209
  this._invalid = !0;
174
210
  return;
175
211
  } else if (t) {
176
- const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
177
- this.setValidity({ valueMissing: !0 }, String(a)), this._pristine || (this._invalid = !0);
212
+ const n = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
213
+ this.setValidity({ valueMissing: !0 }, String(n)), this._pristine || (this._invalid = !0);
178
214
  } else if (e) {
179
- const a = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
180
- this.setValidity({ rangeUnderflow: !0 }, String(a)), this._pristine || (this._invalid = !0);
181
- } else if (l) {
182
- const a = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
183
- this.setValidity({ rangeOverflow: !0 }, String(a)), this._pristine || (this._invalid = !0);
215
+ const n = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
216
+ this.setValidity({ rangeUnderflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
217
+ } else if (i) {
218
+ const n = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
219
+ this.setValidity({ rangeOverflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
184
220
  } else
185
221
  this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
186
222
  }
187
223
  render() {
188
- return n`
224
+ return p`
189
225
  <div id="root">
190
226
  <label>
191
227
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
192
228
  ${this.label}
193
- ${this.required ? V(this.requiredLabel) : null}
229
+ ${this.required ? I(c(this, h).term("required")) : b}
194
230
  </div>
195
231
  <button
196
232
  ?disabled=${this.disabled}
@@ -204,19 +240,19 @@ const c = class c extends b {
204
240
  >
205
241
  <span
206
242
  id="selected-value"
207
- class=${E({ "selected-value": !0, "contains-meta-info": !this.value })}>
243
+ class=${U({ "selected-value": !0, "contains-meta-info": !this.value })}>
208
244
  ${this._computeVisibleValue()}
209
245
  </span>
210
246
  <skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
211
247
  </button>
212
248
  </label>
213
- <div aria-multiselectable=${m(this.multiple && !0)} id="select-dropdown" popover role="listbox">
249
+ <div aria-multiselectable=${O(this.multiple && !0)} id="select-dropdown" popover role="listbox">
214
250
  <slot @slotchange=${this._handleSlotChange}></slot>
215
251
  </div>
216
- ${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? n`
252
+ ${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? p`
217
253
  <div id="tags">
218
254
  ${this.selectedOptions.map(
219
- (t) => n`
255
+ (t) => p`
220
256
  <skf-tag
221
257
  style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
222
258
  removable
@@ -229,12 +265,13 @@ const c = class c extends b {
229
265
  `
230
266
  )}
231
267
  </div>
232
- ` : C}
233
- ${this.hint && n`
268
+ ` : b}
269
+ ${this.hint && p`
234
270
  <skf-hint
271
+ ?disabled=${this.disabled}
235
272
  aria-live=${this._invalid ? "assertive" : "polite"}
236
273
  id="hint"
237
- severity=${m(x(this._invalid, this.severity))}
274
+ severity=${O(A(this._invalid, this.severity))}
238
275
  >
239
276
  ${this.customInvalid ?? this.hint}
240
277
  </skf-hint>
@@ -244,80 +281,86 @@ const c = class c extends b {
244
281
  `;
245
282
  }
246
283
  };
247
- c.styles = [S, P];
248
- let i = c;
249
- s([
250
- o({ type: String, reflect: !0, attribute: "button-label" })
251
- ], i.prototype, "buttonLabel", 2);
252
- s([
253
- o({ attribute: "custom-invalid" })
254
- ], i.prototype, "customInvalid", 2);
255
- s([
256
- o({ type: Boolean, attribute: "hide-label" })
257
- ], i.prototype, "hideLabel", 2);
258
- s([
259
- o({ type: Boolean, reflect: !0, attribute: "hide-tags" })
260
- ], i.prototype, "hideTags", 2);
261
- s([
262
- o()
263
- ], i.prototype, "hint", 2);
264
- s([
265
- o({ type: Array, attribute: !1 })
266
- ], i.prototype, "selectedValues", 1);
267
- s([
268
- o({ type: Array, attribute: !1 })
269
- ], i.prototype, "selectedOptionsText", 1);
270
- s([
271
- o({ reflect: !0 })
272
- ], i.prototype, "label", 2);
273
- s([
274
- o({ type: Number })
275
- ], i.prototype, "max", 2);
276
- s([
277
- o({ type: Number })
278
- ], i.prototype, "min", 2);
279
- s([
280
- o({ type: Boolean, reflect: !0 })
281
- ], i.prototype, "multiple", 2);
282
- s([
283
- o()
284
- ], i.prototype, "name", 2);
285
- s([
286
- o({ attribute: "required-label" })
287
- ], i.prototype, "requiredLabel", 2);
288
- s([
289
- o()
290
- ], i.prototype, "severity", 2);
291
- s([
292
- o({ type: Boolean, attribute: "show-valid" })
293
- ], i.prototype, "showValid", 2);
294
- s([
295
- o({ reflect: !0 })
296
- ], i.prototype, "size", 2);
297
- s([
298
- h()
299
- ], i.prototype, "value", 1);
300
- s([
301
- h()
302
- ], i.prototype, "selectedOptions", 1);
303
- s([
304
- h()
305
- ], i.prototype, "_expanded", 2);
306
- s([
307
- h()
308
- ], i.prototype, "_invalid", 2);
309
- s([
310
- p("#select-button")
311
- ], i.prototype, "$anchor", 2);
312
- s([
313
- p("#selected-value")
314
- ], i.prototype, "$selectedValue", 2);
315
- s([
316
- p("#select-dropdown")
317
- ], i.prototype, "$popover", 2);
318
- s([
319
- $("_expanded", { afterUpdate: !0 })
320
- ], i.prototype, "handleExpandedChange", 1);
284
+ h = new WeakMap(), f.styles = [P, N];
285
+ let s = f;
286
+ o([
287
+ a({ type: String, reflect: !0, attribute: "button-label" })
288
+ ], s.prototype, "buttonLabel", 2);
289
+ o([
290
+ a({ type: String, attribute: "custom-invalid" })
291
+ ], s.prototype, "customInvalid", 2);
292
+ o([
293
+ a({ type: Boolean, attribute: "hide-label" })
294
+ ], s.prototype, "hideLabel", 2);
295
+ o([
296
+ a({ type: Boolean, reflect: !0, attribute: "hide-tags" })
297
+ ], s.prototype, "hideTags", 2);
298
+ o([
299
+ a({ type: String })
300
+ ], s.prototype, "hint", 2);
301
+ o([
302
+ a({ type: Array, attribute: !1 })
303
+ ], s.prototype, "selectedValues", 1);
304
+ o([
305
+ a({ type: Array, attribute: !1 })
306
+ ], s.prototype, "selectedOptionsText", 1);
307
+ o([
308
+ a({ type: String, reflect: !0 })
309
+ ], s.prototype, "label", 2);
310
+ o([
311
+ a({ type: String })
312
+ ], s.prototype, "lang", 2);
313
+ o([
314
+ a({ type: Number })
315
+ ], s.prototype, "max", 2);
316
+ o([
317
+ a({ type: Number })
318
+ ], s.prototype, "min", 2);
319
+ o([
320
+ a({ type: Boolean, reflect: !0 })
321
+ ], s.prototype, "multiple", 2);
322
+ o([
323
+ a({ type: String })
324
+ ], s.prototype, "name", 2);
325
+ o([
326
+ a()
327
+ ], s.prototype, "severity", 2);
328
+ o([
329
+ a({ type: Boolean, attribute: "show-valid" })
330
+ ], s.prototype, "showValid", 2);
331
+ o([
332
+ a({ reflect: !0 })
333
+ ], s.prototype, "size", 2);
334
+ o([
335
+ a({ type: String, attribute: !1 })
336
+ ], s.prototype, "value", 1);
337
+ o([
338
+ u()
339
+ ], s.prototype, "selectedOptions", 1);
340
+ o([
341
+ u()
342
+ ], s.prototype, "_expanded", 2);
343
+ o([
344
+ u()
345
+ ], s.prototype, "_invalid", 2);
346
+ o([
347
+ m("#select-button")
348
+ ], s.prototype, "$anchor", 2);
349
+ o([
350
+ m("#selected-value")
351
+ ], s.prototype, "$selectedValue", 2);
352
+ o([
353
+ m("#select-dropdown")
354
+ ], s.prototype, "$popover", 2);
355
+ o([
356
+ F()
357
+ ], s.prototype, "_slottedItems", 2);
358
+ o([
359
+ S("size", { waitUntilFirstUpdate: !0 })
360
+ ], s.prototype, "_handleSizeUpdate", 1);
361
+ o([
362
+ S("_expanded", { afterUpdate: !0 })
363
+ ], s.prototype, "handleExpandedChange", 1);
321
364
  export {
322
- i as SkfSelect
365
+ s as SkfSelect
323
366
  };
@@ -104,7 +104,8 @@ class b {
104
104
  reason: "attribute-mismatch",
105
105
  replaceStrings: [t, "min or max", "together with multiple"]
106
106
  }), a({
107
- assert: (this.host.hideTags && this.host.multiple) ?? !this.host.hideTags,
107
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
108
+ assert: this.host.hideTags && this.host.multiple || !this.host.hideTags,
108
109
  reason: "attribute-mismatch",
109
110
  replaceStrings: [t, "hide-tags", "together with multiple"]
110
111
  });
@@ -1,8 +1,8 @@
1
1
  import { visuallyHidden as r } from "../../styles/util.styles.js";
2
- import { css as o } from "lit";
2
+ import { css as e } from "lit";
3
3
  const t = [
4
4
  r,
5
- o`
5
+ e`
6
6
  @layer components {
7
7
  :host {
8
8
  contain: initial;
@@ -53,6 +53,12 @@ const t = [
53
53
  justify-content: space-between;
54
54
  padding-inline: var(--skf-spacing-75);
55
55
 
56
+ span {
57
+ overflow: hidden;
58
+ text-overflow: ellipsis;
59
+ white-space: nowrap;
60
+ }
61
+
56
62
  &:hover {
57
63
  --_skf-select-button-bg-color: var(--skf-interactive-bg-color-secondary-hover);
58
64
  }