@skf-design-system/ui-components 1.0.2-beta.1 → 1.0.2-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +25 -1
  2. package/dist/components/accordion/accordion-item.component.js +49 -38
  3. package/dist/components/accordion/accordion.component.d.ts +2 -2
  4. package/dist/components/accordion/accordion.component.js +12 -12
  5. package/dist/components/alert/alert.component.d.ts +8 -3
  6. package/dist/components/alert/alert.component.js +59 -50
  7. package/dist/components/alert/alert.styles.js +51 -47
  8. package/dist/components/breadcrumb/breadcrumb-item.component.js +30 -32
  9. package/dist/components/breadcrumb/breadcrumb-item.d.ts +2 -2
  10. package/dist/components/breadcrumb/breadcrumb-item.styles.js +16 -15
  11. package/dist/components/breadcrumb/breadcrumb.component.d.ts +5 -2
  12. package/dist/components/breadcrumb/breadcrumb.component.js +51 -46
  13. package/dist/components/breadcrumb/breadcrumb.d.ts +2 -2
  14. package/dist/components/breadcrumb/breadcrumb.styles.js +13 -10
  15. package/dist/components/button/button.component.js +63 -67
  16. package/dist/components/button/button.styles.js +5 -4
  17. package/dist/components/card/card.component.d.ts +5 -0
  18. package/dist/components/card/card.component.js +46 -24
  19. package/dist/components/card/card.styles.js +31 -14
  20. package/dist/components/checkbox/checkbox.component.d.ts +6 -5
  21. package/dist/components/checkbox/checkbox.component.js +67 -69
  22. package/dist/components/checkbox/checkbox.styles.js +1 -1
  23. package/dist/components/{date-picker/datepicker.calendar.component.d.ts → datepicker/datepicker-calendar.component.d.ts} +8 -1
  24. package/dist/components/{date-picker/datepicker.calendar.component.js → datepicker/datepicker-calendar.component.js} +109 -115
  25. package/dist/components/datepicker/datepicker-calendar.d.ts +8 -0
  26. package/dist/components/datepicker/datepicker-calendar.js +6 -0
  27. package/dist/components/{date-picker/datepicker.component.d.ts → datepicker/datepicker-popup.component.d.ts} +9 -20
  28. package/dist/components/datepicker/datepicker-popup.component.js +272 -0
  29. package/dist/components/datepicker/datepicker-popup.d.ts +8 -0
  30. package/dist/components/{date-picker/datepicker.helpers.d.ts → datepicker/datepicker-popup.helpers.d.ts} +3 -3
  31. package/dist/components/datepicker/datepicker-popup.helpers.js +83 -0
  32. package/dist/components/datepicker/datepicker-popup.js +6 -0
  33. package/dist/components/{date-picker/datepicker.styles.js → datepicker/datepicker-popup.styles.js} +3 -3
  34. package/dist/components/{date-picker-input/datepicker-input.component.d.ts → datepicker/datepicker.component.d.ts} +21 -14
  35. package/dist/components/datepicker/datepicker.component.js +455 -0
  36. package/dist/components/datepicker/datepicker.d.ts +8 -0
  37. package/dist/components/datepicker/datepicker.js +6 -0
  38. package/dist/components/dialog/dialog.component.d.ts +3 -2
  39. package/dist/components/dialog/dialog.component.js +49 -49
  40. package/dist/components/dialog/dialog.d.ts +2 -2
  41. package/dist/components/divider/divider.component.d.ts +3 -0
  42. package/dist/components/divider/divider.component.js +43 -22
  43. package/dist/components/divider/divider.styles.js +9 -9
  44. package/dist/components/drawer/drawer.component.d.ts +12 -4
  45. package/dist/components/drawer/drawer.component.js +84 -61
  46. package/dist/components/drawer/drawer.d.ts +2 -2
  47. package/dist/components/drawer/drawer.styles.js +47 -40
  48. package/dist/components/header/header.component.d.ts +4 -2
  49. package/dist/components/header/header.component.js +64 -57
  50. package/dist/components/header/header.d.ts +2 -2
  51. package/dist/components/header/header.styles.js +2 -2
  52. package/dist/components/heading/heading.component.d.ts +5 -1
  53. package/dist/components/heading/heading.component.js +54 -27
  54. package/dist/components/heading/heading.styles.js +34 -36
  55. package/dist/components/icon/icon.component.d.ts +4 -0
  56. package/dist/components/icon/icon.component.js +62 -43
  57. package/dist/components/icon/icon.styles.js +60 -60
  58. package/dist/components/input/input.component.d.ts +4 -8
  59. package/dist/components/input/input.component.js +90 -97
  60. package/dist/components/input/input.controllers.d.ts +0 -1
  61. package/dist/components/input/input.controllers.js +14 -19
  62. package/dist/components/link/link.component.d.ts +15 -18
  63. package/dist/components/link/link.component.js +104 -107
  64. package/dist/components/link/link.styles.js +53 -45
  65. package/dist/components/loader/loader.component.d.ts +5 -3
  66. package/dist/components/loader/loader.component.js +39 -28
  67. package/dist/components/loader/loader.styles.js +6 -10
  68. package/dist/components/logo/logo.component.d.ts +4 -1
  69. package/dist/components/logo/logo.component.js +55 -51
  70. package/dist/components/logo/logo.styles.js +26 -16
  71. package/dist/components/menu/menu-item.component.d.ts +1 -1
  72. package/dist/components/menu/menu-item.component.js +8 -8
  73. package/dist/components/menu/menu-item.d.ts +2 -2
  74. package/dist/components/menu/menu-item.styles.js +13 -9
  75. package/dist/components/menu/menu.component.d.ts +5 -2
  76. package/dist/components/menu/menu.component.js +8 -8
  77. package/dist/components/menu/menu.d.ts +2 -2
  78. package/dist/components/nav/nav-item.component.d.ts +6 -2
  79. package/dist/components/nav/nav-item.component.js +44 -25
  80. package/dist/components/nav/nav-item.styles.js +29 -25
  81. package/dist/components/nav/nav.component.d.ts +9 -0
  82. package/dist/components/nav/nav.component.js +47 -21
  83. package/dist/components/nav/nav.d.ts +2 -2
  84. package/dist/components/nav/nav.styles.js +15 -9
  85. package/dist/components/popover/popover.component.d.ts +10 -3
  86. package/dist/components/popover/popover.component.js +30 -22
  87. package/dist/components/popover/popover.d.ts +2 -2
  88. package/dist/components/progress/progress.component.d.ts +2 -0
  89. package/dist/components/progress/progress.component.js +38 -29
  90. package/dist/components/progress/progress.d.ts +2 -2
  91. package/dist/components/progress/progress.styles.js +10 -8
  92. package/dist/components/radio/radio.component.d.ts +4 -2
  93. package/dist/components/radio/radio.component.js +96 -91
  94. package/dist/components/radio/radio.styles.js +1 -1
  95. package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
  96. package/dist/components/segmented-button/segmented-button-item.d.ts +2 -2
  97. package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
  98. package/dist/components/segmented-button/segmented-button.component.js +22 -24
  99. package/dist/components/segmented-button/segmented-button.d.ts +2 -2
  100. package/dist/components/select/select-option-group.component.d.ts +4 -0
  101. package/dist/components/select/select-option-group.component.js +37 -18
  102. package/dist/components/select/select-option-group.d.ts +2 -2
  103. package/dist/components/select/select-option-group.style.js +12 -6
  104. package/dist/components/select/select-option.component.d.ts +9 -4
  105. package/dist/components/select/select-option.component.js +70 -58
  106. package/dist/components/select/select-option.styles.js +43 -31
  107. package/dist/components/select/select.component.d.ts +21 -12
  108. package/dist/components/select/select.component.js +125 -87
  109. package/dist/components/select/select.controllers.js +15 -20
  110. package/dist/components/select/select.styles.js +8 -2
  111. package/dist/components/stepper/stepper-item.component.d.ts +1 -1
  112. package/dist/components/stepper/stepper-item.component.js +59 -56
  113. package/dist/components/stepper/stepper-item.d.ts +2 -2
  114. package/dist/components/stepper/stepper-item.styles.js +4 -4
  115. package/dist/components/stepper/stepper.component.js +2 -3
  116. package/dist/components/stepper/stepper.d.ts +2 -2
  117. package/dist/components/stepper/stepper.helpers.js +6 -7
  118. package/dist/components/switch/switch.component.d.ts +4 -2
  119. package/dist/components/switch/switch.component.js +64 -58
  120. package/dist/components/switch/switch.d.ts +2 -2
  121. package/dist/components/switch/switch.styles.js +1 -1
  122. package/dist/components/{tab-panel → tabs}/tab-panel.component.d.ts +1 -1
  123. package/dist/components/tabs/tab-panel.component.js +39 -0
  124. package/dist/components/{tab-panel → tabs}/tab-panel.d.ts +2 -2
  125. package/dist/components/{tab → tabs}/tab.component.d.ts +3 -3
  126. package/dist/components/{tab → tabs}/tab.component.js +17 -14
  127. package/dist/components/{tab → tabs}/tab.d.ts +2 -2
  128. package/dist/components/{tab → tabs}/tab.styles.js +2 -2
  129. package/dist/components/{tab-group/tab-group.component.d.ts → tabs/tabs.component.d.ts} +3 -4
  130. package/dist/components/{tab-group/tab-group.component.js → tabs/tabs.component.js} +35 -36
  131. package/dist/components/tabs/tabs.d.ts +8 -0
  132. package/dist/components/tabs/tabs.js +6 -0
  133. package/dist/components/{tab-group/tab-group.styles.js → tabs/tabs.styles.js} +16 -16
  134. package/dist/components/tag/tag.component.d.ts +10 -2
  135. package/dist/components/tag/tag.component.js +77 -65
  136. package/dist/components/tag/tag.d.ts +2 -2
  137. package/dist/components/tag/tag.styles.js +63 -50
  138. package/dist/components/textarea/textarea.component.d.ts +4 -2
  139. package/dist/components/textarea/textarea.component.js +102 -95
  140. package/dist/components/toast/toast-item.styles.js +13 -10
  141. package/dist/components/toast/toast.component.js +9 -9
  142. package/dist/components/toast/toast.singleton.d.ts +1 -1
  143. package/dist/components/toast/toast.singleton.js +19 -20
  144. package/dist/components/tooltip/tooltip.component.d.ts +9 -2
  145. package/dist/components/tooltip/tooltip.component.js +15 -11
  146. package/dist/components/tooltip/tooltip.d.ts +2 -2
  147. package/dist/custom-elements.json +1681 -1112
  148. package/dist/index.d.ts +8 -7
  149. package/dist/index.js +96 -93
  150. package/dist/internal/base-classes/popover/popover.base.d.ts +24 -5
  151. package/dist/internal/base-classes/popover/popover.base.js +41 -44
  152. package/dist/internal/base-classes/popover/popover.styles.js +4 -5
  153. package/dist/internal/components/formBase.d.ts +1 -0
  154. package/dist/internal/components/formBase.js +11 -19
  155. package/dist/internal/components/hint/hint.component.d.ts +4 -0
  156. package/dist/internal/components/hint/hint.component.js +47 -20
  157. package/dist/internal/components/hint/hint.styles.js +29 -25
  158. package/dist/internal/components/skf-element.d.ts +1 -3
  159. package/dist/internal/components/skf-element.js +4 -9
  160. package/dist/internal/controllers/popover.controller.d.ts +2 -0
  161. package/dist/internal/controllers/popover.controller.js +11 -14
  162. package/dist/internal/helpers/stateMap.d.ts +14 -0
  163. package/dist/internal/helpers/stateMap.js +68 -0
  164. package/dist/internal/helpers/uuid.d.ts +8 -10
  165. package/dist/internal/helpers/uuid.js +4 -11
  166. package/dist/internal/helpers/watch.d.ts +1 -1
  167. package/dist/internal/helpers/watch.js +12 -12
  168. package/dist/internal/templates/asterisk.d.ts +1 -1
  169. package/dist/internal/templates/asterisk.js +4 -4
  170. package/dist/internal/types.d.ts +4 -0
  171. package/dist/styles/component.styles.js +37 -36
  172. package/dist/styles/global-alt.css +1 -0
  173. package/dist/styles/global.css +1 -1
  174. package/dist/translations/en.d.ts +3 -0
  175. package/dist/translations/en.js +27 -0
  176. package/dist/translations/es.d.ts +3 -0
  177. package/dist/translations/es.js +27 -0
  178. package/dist/translations/index.d.ts +4 -0
  179. package/dist/translations/pt.d.ts +3 -0
  180. package/dist/translations/pt.js +27 -0
  181. package/dist/translations/sv.d.ts +3 -0
  182. package/dist/translations/sv.js +27 -0
  183. package/dist/types/jsx/custom-element-jsx.d.ts +1988 -866
  184. package/dist/types/vue/index.d.ts +220 -169
  185. package/dist/utilities/localize.d.ts +28 -0
  186. package/dist/utilities/localize.js +13 -0
  187. package/dist/vscode.html-custom-data.json +265 -188
  188. package/dist/web-types.json +731 -548
  189. package/package.json +38 -51
  190. package/dist/components/accordion/accordion-item.test.d.ts +0 -1
  191. package/dist/components/accordion/accordion.test.d.ts +0 -1
  192. package/dist/components/checkbox/checkbox.test.d.ts +0 -1
  193. package/dist/components/date-picker/datepicker.component.js +0 -261
  194. package/dist/components/date-picker/datepicker.d.ts +0 -10
  195. package/dist/components/date-picker/datepicker.helpers.js +0 -76
  196. package/dist/components/date-picker/datepicker.js +0 -8
  197. package/dist/components/date-picker-input/datepicker-input.component.js +0 -442
  198. package/dist/components/date-picker-input/datepicker-input.d.ts +0 -8
  199. package/dist/components/date-picker-input/datepicker-input.js +0 -6
  200. package/dist/components/input/input.test.d.ts +0 -1
  201. package/dist/components/radio/radio.test.d.ts +0 -1
  202. package/dist/components/switch/switch.test.d.ts +0 -1
  203. package/dist/components/tab-group/tab-group.d.ts +0 -8
  204. package/dist/components/tab-group/tab-group.js +0 -6
  205. package/dist/components/tab-panel/tab-panel.component.js +0 -36
  206. package/dist/internal/playwright/index.d.ts +0 -1
  207. /package/dist/components/{date-picker/datepicker.calendar.styles.d.ts → datepicker/datepicker-calendar.styles.d.ts} +0 -0
  208. /package/dist/components/{date-picker/datepicker.calendar.styles.js → datepicker/datepicker-calendar.styles.js} +0 -0
  209. /package/dist/components/{date-picker/datepicker.styles.d.ts → datepicker/datepicker-popup.styles.d.ts} +0 -0
  210. /package/dist/components/{date-picker-input/datepicker-input.helpers.d.ts → datepicker/datepicker.helpers.d.ts} +0 -0
  211. /package/dist/components/{date-picker-input/datepicker-input.helpers.js → datepicker/datepicker.helpers.js} +0 -0
  212. /package/dist/components/{date-picker-input/datepicker-input.styles.d.ts → datepicker/datepicker.styles.d.ts} +0 -0
  213. /package/dist/components/{date-picker-input/datepicker-input.styles.js → datepicker/datepicker.styles.js} +0 -0
  214. /package/dist/components/select/{select.stories.icons.d.ts → stories/select.stories.icons.d.ts} +0 -0
  215. /package/dist/components/{tab-panel → tabs}/tab-panel.js +0 -0
  216. /package/dist/components/{tab-panel → tabs}/tab-panel.styles.d.ts +0 -0
  217. /package/dist/components/{tab-panel → tabs}/tab-panel.styles.js +0 -0
  218. /package/dist/components/{tab → tabs}/tab.js +0 -0
  219. /package/dist/components/{tab → tabs}/tab.styles.d.ts +0 -0
  220. /package/dist/components/{tab-group/tab-group.styles.d.ts → tabs/tabs.styles.d.ts} +0 -0
@@ -1,51 +1,70 @@
1
- import { SkfElement as f } from "../../internal/components/skf-element.js";
2
- import { ICONS as c } from "@skf-design-system/ui-assets";
3
- import { componentStyles as d } from "../../styles/component.styles.js";
4
- import { html as h } from "lit";
5
- import { property as t } from "lit/decorators.js";
6
- import { classMap as u } from "lit/directives/class-map.js";
7
- import { ifDefined as s } from "lit/directives/if-defined.js";
8
- import { styles as v } from "./icon.styles.js";
9
- var y = Object.defineProperty, o = (m, p, a, $) => {
10
- for (var r = void 0, i = m.length - 1, n; i >= 0; i--)
11
- (n = m[i]) && (r = n(p, a, r) || r);
12
- return r && y(p, a, r), r;
1
+ var u = (t) => {
2
+ throw TypeError(t);
13
3
  };
14
- const l = class l extends f {
4
+ var g = (t, e, r) => e.has(t) || u("Cannot " + r);
5
+ var c = (t, e, r) => (g(t, e, "read from private field"), r ? r.call(t) : e.get(t)), y = (t, e, r) => e.has(t) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), d = (t, e, r, o) => (g(t, e, "write to private field"), o ? o.call(t, r) : e.set(t, r), r);
6
+ import { SkfElement as v } from "../../internal/components/skf-element.js";
7
+ import { stateMap as b } from "../../internal/helpers/stateMap.js";
8
+ import { watch as _ } from "../../internal/helpers/watch.js";
9
+ import { ICONS as S } from "@skf-design-system/ui-assets";
10
+ import { componentStyles as C } from "../../styles/component.styles.js";
11
+ import { html as z } from "lit";
12
+ import { property as n } from "lit/decorators.js";
13
+ import { styles as O } from "./icon.styles.js";
14
+ var w = Object.defineProperty, P = Object.getOwnPropertyDescriptor, l = (t, e, r, o) => {
15
+ for (var s = o > 1 ? void 0 : o ? P(e, r) : e, m = t.length - 1, h; m >= 0; m--)
16
+ (h = t[m]) && (s = (o ? h(e, r, s) : h(s)) || s);
17
+ return o && s && w(e, r, s), s;
18
+ };
19
+ const x = {
20
+ color: [
21
+ "emphasized",
22
+ "error",
23
+ "info",
24
+ "inverse",
25
+ "primary",
26
+ "purple",
27
+ "secondary",
28
+ "success",
29
+ "warning"
30
+ ],
31
+ size: ["lg", "md", "sm", "xs"]
32
+ };
33
+ var a, p;
34
+ const f = class f extends v {
15
35
  constructor() {
16
- super(...arguments), this.color = "primary", this.size = "md";
36
+ super(...arguments);
37
+ y(this, a);
38
+ y(this, p);
39
+ d(this, a, this.attachInternals()), d(this, p, c(this, a).states), this.color = "primary", this.size = "md";
40
+ }
41
+ connectedCallback() {
42
+ super.connectedCallback(), this.ariaHidden = this.label ? null : "true", this.ariaLabel = this.label ?? null, this.role = this.label ? "img" : null;
43
+ }
44
+ _handleStateChange(r, o, s) {
45
+ b(c(this, p), x[r]).set(s);
17
46
  }
18
47
  render() {
19
- return h`
20
- <div
21
- aria-hidden=${s(this.label ? void 0 : "true")}
22
- aria-label=${s(this.label)}
23
- class=${u({
24
- icon: !0,
25
- [`icon--color-${this.color}`]: !0,
26
- [`icon--size-${this.size}`]: !0
27
- })}
28
- role=${s(this.label ? "img" : void 0)}
29
- >
30
- ${c[this.name]}
31
- </div>
32
- `;
48
+ return z`<div id="root">${S[this.name]}</div>`;
33
49
  }
34
50
  };
35
- l.styles = [d, v];
36
- let e = l;
37
- o([
38
- t({ reflect: !0 })
39
- ], e.prototype, "color");
40
- o([
41
- t()
42
- ], e.prototype, "label");
43
- o([
44
- t()
45
- ], e.prototype, "name");
46
- o([
47
- t({ reflect: !0 })
48
- ], e.prototype, "size");
51
+ a = new WeakMap(), p = new WeakMap(), f.styles = [C, O];
52
+ let i = f;
53
+ l([
54
+ n({ type: String })
55
+ ], i.prototype, "color", 2);
56
+ l([
57
+ n({ type: String })
58
+ ], i.prototype, "label", 2);
59
+ l([
60
+ n({ type: String })
61
+ ], i.prototype, "name", 2);
62
+ l([
63
+ n({ type: String })
64
+ ], i.prototype, "size", 2);
65
+ l([
66
+ _(["color", "size"])
67
+ ], i.prototype, "_handleStateChange", 1);
49
68
  export {
50
- e as SkfIcon
69
+ i as SkfIcon
51
70
  };
@@ -1,84 +1,84 @@
1
1
  import { css as o } from "lit";
2
- const i = o`
3
- /* stylelint-disable selector-class-pattern */
2
+ const r = o`
4
3
  @layer components {
5
- :host {
6
- display: inline-flex;
7
- }
4
+ @layer base {
5
+ :host {
6
+ display: inline-flex;
7
+ }
8
8
 
9
- :host-context(.skf-icon-host) {
10
- color: inherit;
11
- }
9
+ #root {
10
+ --_skf-icon-color: var(--skf-icon-color-primary);
11
+ --_skf-icon-size: var(--skf-icon-size-md);
12
12
 
13
- .icon {
14
- block-size: var(--_skf-icon-size);
15
- display: inline-flex;
16
- flex-shrink: 0; /* Prevents shrink when flex-child */
17
- inline-size: var(--_skf-icon-size);
18
- pointer-events: none;
19
- user-select: none;
13
+ block-size: var(--_skf-icon-size);
14
+ flex-shrink: 0; /* Prevents shrink when flex-child */
15
+ inline-size: var(--_skf-icon-size);
16
+ pointer-events: none;
17
+ user-select: none;
20
18
 
21
- :not(:host-context(.skf-icon-host)) & {
22
- color: var(--_skf-icon-color, var(--skf-icon-color-primary));
19
+ :host(:not([data-color='custom'])) & {
20
+ color: var(--_skf-icon-color);
21
+ }
23
22
  }
24
23
  }
25
24
 
26
- /**
27
- * Colors
28
- */
29
- .icon--color-secondary {
30
- --_skf-icon-color: var(--skf-icon-color-secondary);
31
- }
25
+ @layer mods {
26
+ /**
27
+ * Color
28
+ */
29
+ :host([data-color='custom']) {
30
+ color: inherit;
31
+ }
32
32
 
33
- .icon--color-inverse {
34
- --_skf-icon-color: var(--skf-icon-color-inverse);
35
- }
33
+ :host(:state(secondary)) #root {
34
+ --_skf-icon-color: var(--skf-icon-color-secondary);
35
+ }
36
36
 
37
- .icon--color-emphasised {
38
- --_skf-icon-color: var(--skf-icon-color-emphasised);
39
- }
37
+ :host(:state(inverse)) #root {
38
+ --_skf-icon-color: var(--skf-icon-color-inverse);
39
+ }
40
40
 
41
- /* Severity */
42
- .icon--color-alert {
43
- --_skf-icon-color: var(--skf-severity-fg-color-alert);
44
- }
41
+ :host(:state(emphasized)) #root {
42
+ --_skf-icon-color: var(--skf-icon-color-emphasized);
43
+ }
45
44
 
46
- .icon--color-error {
47
- --_skf-icon-color: var(--skf-severity-fg-color-error);
48
- }
45
+ :host(:state(purple)) #root {
46
+ --_skf-icon-color: var(--skf-icon-color-purple);
47
+ }
49
48
 
50
- .icon--color-info {
51
- --_skf-icon-color: var(--skf-severity-fg-color-info);
52
- }
49
+ :host(:state(error)) #root {
50
+ --_skf-icon-color: var(--skf-severity-fg-color-error);
51
+ }
53
52
 
54
- .icon--color-success {
55
- --_skf-icon-color: var(--skf-severity-fg-color-success);
56
- }
53
+ :host(:state(info)) #root {
54
+ --_skf-icon-color: var(--skf-severity-fg-color-info);
55
+ }
57
56
 
58
- .icon--color-warning {
59
- --_skf-icon-color: var(--skf-severity-fg-color-warning);
60
- }
57
+ :host(:state(success)) #root {
58
+ --_skf-icon-color: var(--skf-severity-fg-color-success);
59
+ }
61
60
 
62
- /**
63
- * Sizes
64
- */
65
- .icon--size-xs {
66
- --_skf-icon-size: var(--skf-icon-size-xs);
67
- }
61
+ :host(:state(warning)) #root {
62
+ --_skf-icon-color: var(--skf-severity-fg-color-warning);
63
+ }
68
64
 
69
- .icon--size-sm {
70
- --_skf-icon-size: var(--skf-icon-size-sm);
71
- }
65
+ /**
66
+ * Size
67
+ */
68
+ :host(:state(xs)) #root {
69
+ --_skf-icon-size: var(--skf-icon-size-xs);
70
+ }
72
71
 
73
- .icon--size-md {
74
- --_skf-icon-size: var(--skf-icon-size-md);
75
- }
72
+ :host(:state(sm)) #root {
73
+ --_skf-icon-size: var(--skf-icon-size-sm);
74
+ }
76
75
 
77
- .icon--size-lg {
78
- --_skf-icon-size: var(--skf-icon-size-lg);
76
+ :host(:state(lg)) #root {
77
+ --_skf-icon-size: var(--skf-icon-size-lg);
78
+ }
79
79
  }
80
80
  }
81
81
  `;
82
82
  export {
83
- i as styles
83
+ r as styles
84
84
  };
@@ -3,6 +3,7 @@ import { FormBase } from '../../internal/components/formBase.js';
3
3
  import '../../internal/components/hint/hint';
4
4
  import type { FormFieldSeverity } from '../../internal/types.js';
5
5
  import type { FormFieldBaseProps } from '../../internal/types/formField.js';
6
+ import { type Language } from '../../utilities/localize.js';
6
7
  import { type CSSResultGroup } from 'lit';
7
8
  /**
8
9
  * The skf-text-field is used to create a text input field. It can be used inside a form element or standalone
@@ -23,6 +24,7 @@ import { type CSSResultGroup } from 'lit';
23
24
  * behaviour: validate-on-input, validate-on-submit and native-validation
24
25
  */
25
26
  export declare class SkfInput extends FormBase implements FormFieldBaseProps {
27
+ #private;
26
28
  static styles: CSSResultGroup;
27
29
  private customError;
28
30
  /** @internal intermediary value for reset to function, e.g value attribute act as default value */
@@ -32,12 +34,6 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
32
34
  * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details.
33
35
  */
34
36
  autocomplete?: HTMLInputElement['autocomplete'];
35
- /** Custom aria-label for the clear button. **Notice!** Only applicable to type=search. */
36
- buttonAriaLabelClear: string;
37
- /** Custom aria-label for the visibility button. **Notice!** Only applicable to type=password. */
38
- buttonAriaLabelHide: string;
39
- /** Custom aria-label for the visibility button **Notice!** Only applicable to type=password. */
40
- buttonAriaLabelShow: string;
41
37
  /** If defined, forces component to invalid state until removed. Its value is used as hint text. */
42
38
  set customInvalid(value: string | undefined);
43
39
  get customInvalid(): string | undefined;
@@ -54,6 +50,8 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
54
50
  inputmode: HTMLInputElement['inputMode'];
55
51
  /** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
56
52
  label?: string;
53
+ /** Sets the internal language of the component */
54
+ lang: Language;
57
55
  /** If defined, displays a prefix/adornment before the input-element */
58
56
  leading?: string;
59
57
  /** If defined, sets the maximum value to accept for this input */
@@ -72,8 +70,6 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
72
70
  placeholder?: string;
73
71
  /** If true, makes the element not mutable, meaning the user can not edit the control */
74
72
  readonly: boolean;
75
- /** If defined, renders an alternative A11y text for the asterisk */
76
- requiredLabel?: string;
77
73
  /** If defined, displays provided severity state */
78
74
  severity?: FormFieldSeverity;
79
75
  /** If true, displays valid state after interaction */
@@ -1,34 +1,40 @@
1
+ var f = (a) => {
2
+ throw TypeError(a);
3
+ };
4
+ var b = (a, n, t) => n.has(a) || f("Cannot " + t);
5
+ var c = (a, n, t) => (b(a, n, "read from private field"), t ? t.call(a) : n.get(a)), _ = (a, n, t) => n.has(a) ? f("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t), $ = (a, n, t, r) => (b(a, n, "write to private field"), r ? r.call(a, t) : n.set(a, t), t);
1
6
  import "../icon/icon.js";
2
- import { FormBase as c } from "../../internal/components/formBase.js";
7
+ import { FormBase as g } from "../../internal/components/formBase.js";
3
8
  import "../../internal/components/hint/hint.js";
4
- import { hintSeverity as b } from "../../internal/helpers/hintSeverity.js";
5
- import { watch as y } from "../../internal/helpers/watch.js";
6
- import { Asterisk as f } from "../../internal/templates/asterisk.js";
7
- import { componentStyles as _ } from "../../styles/component.styles.js";
8
- import { html as h, nothing as u } from "lit";
9
- import { state as p, property as s, query as $, queryAssignedNodes as g } from "lit/decorators.js";
10
- import { ifDefined as o } from "lit/directives/if-defined.js";
11
- import { live as w } from "lit/directives/live.js";
12
- import { InputNumberController as E, InputPasswordController as C } from "./input.controllers.js";
13
- import A from "./input.styles.js";
14
- var L = Object.defineProperty, P = Object.getOwnPropertyDescriptor, e = (v, t, r, a) => {
15
- for (var n = a > 1 ? void 0 : a ? P(t, r) : t, l = v.length - 1, d; l >= 0; l--)
16
- (d = v[l]) && (n = (a ? d(t, r, n) : d(n)) || n);
17
- return a && n && L(t, r, n), n;
18
- };
19
- const m = class m extends c {
9
+ import { hintSeverity as w } from "../../internal/helpers/hintSeverity.js";
10
+ import { watch as E } from "../../internal/helpers/watch.js";
11
+ import { Asterisk as P } from "../../internal/templates/asterisk.js";
12
+ import { componentStyles as C } from "../../styles/component.styles.js";
13
+ import { LocalizeController as k } from "../../utilities/localize.js";
14
+ import { html as p, nothing as m } from "lit";
15
+ import { state as v, property as s, query as S, queryAssignedNodes as x } from "lit/decorators.js";
16
+ import { ifDefined as l } from "lit/directives/if-defined.js";
17
+ import { live as B } from "lit/directives/live.js";
18
+ import { InputNumberController as A, InputPasswordController as V } from "./input.controllers.js";
19
+ import I from "./input.styles.js";
20
+ var L = Object.defineProperty, D = Object.getOwnPropertyDescriptor, e = (a, n, t, r) => {
21
+ for (var o = r > 1 ? void 0 : r ? D(n, t) : n, h = a.length - 1, d; h >= 0; h--)
22
+ (d = a[h]) && (o = (r ? d(n, t, o) : d(o)) || o);
23
+ return r && o && L(n, t, o), o;
24
+ }, u;
25
+ const y = class y extends g {
20
26
  constructor() {
21
- super(...arguments), this._value = "", this.buttonAriaLabelClear = "Clear input", this.buttonAriaLabelHide = "Hide password", this.buttonAriaLabelShow = "Show password", this.debug = !1, this.hideLabel = !1, this.inputmode = "text", this.readonly = !1, this.showValid = !1, this.size = "md", this.type = "text", this.validateOn = "change", this.invalid = !1, this._buttonDown = !1, this._numberController = new E(this), this._passwordController = new C(this), this._handleInput = () => {
22
- var t;
23
- this._value = ((t = this.$input) == null ? void 0 : t.value) ?? "", this.validateOn === "input" && (this._pristine = !1, this.validateInput());
27
+ super(...arguments);
28
+ _(this, u);
29
+ $(this, u, new k(this)), this._value = "", this.debug = !1, this.hideLabel = !1, this.inputmode = "text", this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.type = "text", this.validateOn = "change", this.invalid = !1, this._buttonDown = !1, this._numberController = new A(this), this._passwordController = new V(this), this._handleInput = () => {
30
+ this._value = this.$input?.value ?? "", this.validateOn === "input" && (this._pristine = !1, this.validateInput());
24
31
  }, this._resetValue = (t) => {
25
- var r, a;
26
- t.stopPropagation(), this.value = ((r = this.getAttribute("value")) == null ? void 0 : r.trim()) ?? "", this._value = this.value, this._internals.setFormValue(this.value), (a = this.$input) == null || a.focus();
32
+ t.stopPropagation(), this.value = this.getAttribute("value")?.trim() ?? "", this._value = this.value, this._internals.setFormValue(this.value), this.$input?.focus();
27
33
  }, this._handlePressStart = (t) => {
28
34
  this._buttonDown = !0, this.type === "number" && this._numberController.handleActionBtnLongPressStart(t);
29
35
  }, this._handlePressEnd = () => {
30
36
  this._buttonDown = !1, this.type === "number" && this._numberController.handleActionBtnLongPressEnd();
31
- }, this._renderNumberButton = (t) => h`
37
+ }, this._renderNumberButton = (t) => p`
32
38
  <button
33
39
  ?disabled=${this.disabled}
34
40
  @click=${(r) => {
@@ -43,10 +49,10 @@ const m = class m extends c {
43
49
  >
44
50
  <skf-icon name="${t === "inc" ? "chevronUp" : "chevronDown"}" size="sm"></skf-icon>
45
51
  </button>
46
- `, this._renderPasswordButton = () => h`
52
+ `, this._renderPasswordButton = () => p`
47
53
  <button
48
54
  @click=${this._passwordController.toggleVisibility}
49
- aria-label=${o(this._passwordController._buttonAriaLabel)}
55
+ aria-label=${this._passwordController._type === "password" ? c(this, u).term("showPassword") : c(this, u).term("hidePassword")}
50
56
  class="password skf-icon-host"
51
57
  type="button"
52
58
  @mousedown="${this._handlePressStart}"
@@ -55,21 +61,20 @@ const m = class m extends c {
55
61
  >
56
62
  <skf-icon name=${this._passwordController._icon} size="sm"></skf-icon>
57
63
  </button>
58
- `, this._renderSearchButton = () => h`
64
+ `, this._renderSearchButton = () => p`
59
65
  <button
60
66
  @click=${this._resetValue}
61
67
  @mousedown=${this._handlePressStart}
62
68
  @mouseup=${this._handlePressEnd}
63
69
  @mouseleave=${this._handlePressEnd}
64
- aria-label=${o(this.buttonAriaLabelClear)}
70
+ aria-label=${c(this, u).term("clearEntry")}
65
71
  class="search skf-icon-host"
66
72
  type="button"
67
73
  >
68
74
  <skf-icon name="close" size="sm"></skf-icon>
69
75
  </button>
70
76
  `, this._onBlur = () => {
71
- var t;
72
- this._buttonDown && ((t = this.$input) == null || t.focus());
77
+ this._buttonDown && this.$input?.focus();
73
78
  };
74
79
  }
75
80
  set customInvalid(t) {
@@ -82,16 +87,13 @@ const m = class m extends c {
82
87
  this.$input && (this.$input.value = t, this._value = t, this._internals.setFormValue(t), this.validateInput());
83
88
  }
84
89
  get value() {
85
- var t;
86
- return ((t = this.$input) == null ? void 0 : t.value) ?? "";
90
+ return this.$input?.value ?? "";
87
91
  }
88
92
  firstUpdated() {
89
- var t;
90
- (t = this.$input) == null || t.addEventListener("change", () => {
91
- var r;
92
- this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(((r = this.$input) == null ? void 0 : r.value) ?? ""), this.emitEvent("change"), this.validateInput();
93
- }), this.addEventListener("invalid", (r) => {
94
- this._pristine = !1, this.invalid = !0, this.customErrorDisplay && r.preventDefault();
93
+ this.$input?.addEventListener("change", () => {
94
+ this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(this.$input?.value ?? ""), this.emitEvent("change"), this.validateInput();
95
+ }), this.addEventListener("invalid", (t) => {
96
+ this._pristine = !1, this.invalid = !0, this.customErrorDisplay && t.preventDefault();
95
97
  }), this.addEventListener("reset", this._resetValue), this.validateInput();
96
98
  }
97
99
  willUpdate(t) {
@@ -106,11 +108,11 @@ const m = class m extends c {
106
108
  valueChanged() {
107
109
  this._internals.setFormValue(this.value), this.validateInput();
108
110
  }
109
- attributeChangedCallback(t, r, a) {
110
- if (super.attributeChangedCallback(t, r, a), t === "value" && this._internals.setFormValue(a), t === "custom-invalid")
111
- if (typeof a == "string") {
112
- const l = this.withFallback(a);
113
- this._pristine = !1, this._internals.setValidity({ customError: !0 }, l), this.invalid = !0, this.hint = l, this.checkValidity();
111
+ attributeChangedCallback(t, r, o) {
112
+ if (super.attributeChangedCallback(t, r, o), t === "value" && this._internals.setFormValue(o), t === "custom-invalid")
113
+ if (typeof o == "string") {
114
+ const d = this.withFallback(o);
115
+ this._pristine = !1, this._internals.setValidity({ customError: !0 }, d), this.invalid = !0, this.hint = d, this.checkValidity();
114
116
  } else
115
117
  this._internals.setValidity({}), this.validateInput();
116
118
  }
@@ -122,78 +124,78 @@ const m = class m extends c {
122
124
  this._internals.setValidity({ customError: this._internals.validity.customError });
123
125
  else {
124
126
  this.invalid = !this._pristine && !r.valid;
125
- let a;
126
- for (a in r) {
127
- const n = `data-${a.toString()}`;
128
- if (r[a] && !this.hasAttribute(n) && this.debug && console.log(
129
- `Add custom message on ${this.localName} using attribute: ${n.toUpperCase()}="Your custom message"`
130
- ), r[a]) {
131
- this.validationError = a.toString();
132
- const l = this.hasAttribute(n) ? this.getAttribute(n) : this.$input.validationMessage;
127
+ let o;
128
+ for (o in r) {
129
+ const h = `data-${o.toString()}`;
130
+ if (r[o] && !this.hasAttribute(h) && this.debug && console.log(
131
+ `Add custom message on ${this.localName} using attribute: ${h.toUpperCase()}="Your custom message"`
132
+ ), r[o]) {
133
+ this.validationError = o.toString();
134
+ const d = this.hasAttribute(h) ? this.getAttribute(h) : this.$input.validationMessage;
133
135
  this._internals.setValidity(
134
136
  { [this.validationError]: !0, customError: this._internals.validity.customError },
135
- this.withFallback(l)
137
+ this.withFallback(d)
136
138
  ), this.invalid && this.customErrorDisplay && this.checkValidity();
137
139
  }
138
140
  }
139
141
  }
140
142
  }
141
143
  render() {
142
- var r, a, n, l;
143
- const t = (this._defaultSlot.length === 0 || !((a = (r = this._defaultSlot[0]) == null ? void 0 : r.textContent) != null && a.trim())) && !this.label;
144
- return h`
144
+ const t = (this._defaultSlot.length === 0 || !this._defaultSlot[0]?.textContent?.trim()) && !this.label;
145
+ return p`
145
146
  <div id="root">
146
147
  <label>
147
148
  <div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${t} id="label">
148
149
  <slot>${this.label}</slot>
149
- ${this.required ? f(this.requiredLabel) : null}
150
+ ${this.required ? P(c(this, u).term("required")) : m}
150
151
  </div>
151
152
  <div id="input">
152
- ${this.type === "search" ? h`<skf-icon class="skf-icon-host" name="search" size="sm"></skf-icon>` : u}
153
+ ${this.type === "search" ? p`<skf-icon class="skf-icon-host" name="search" size="sm"></skf-icon>` : m}
153
154
  <div
154
- data-leading=${o(this.leading)}
155
- data-trailing=${o(this.trailing)}
155
+ data-leading=${l(this.leading)}
156
+ data-trailing=${l(this.trailing)}
156
157
  id="affix"
157
158
  >
158
159
  <input
159
160
  ?disabled=${this.disabled}
160
161
  ?readonly=${this.readonly}
161
162
  ?required=${this.required}
162
- .value=${w(this.value)}
163
+ .autocomplete=${this.autocomplete ?? "off"}
164
+ .value=${B(this.value)}
163
165
  @blur=${this._onBlur}
164
166
  @input=${this._handleInput}
165
- .autocomplete=${this.autocomplete}
166
- aria-describedby=${o((n = this.hint) != null && n.trim() ? "hint" : u)}
167
- aria-errormessage=${o((l = this.hint) != null && l.trim() ? "hint" : u)}
167
+ aria-describedby=${l(this.hint?.trim() ? "hint" : m)}
168
+ aria-errormessage=${l(this.hint?.trim() ? "hint" : m)}
168
169
  aria-invalid=${!!this.invalid}
169
170
  data-testid="field-input"
170
- inputmode=${o(this.inputMode)}
171
- max=${o(this.max)}
172
- maxlength=${o(this.maxLength)}
173
- min=${o(this.min)}
174
- minlength=${o(this.minLength)}
175
- name=${o(this.name)}
176
- pattern=${o(this.pattern)}
177
- placeholder=${o(this.placeholder)}
178
- type=${o(
171
+ inputmode=${l(this.inputMode)}
172
+ max=${l(this.max)}
173
+ maxlength=${l(this.maxLength)}
174
+ min=${l(this.min)}
175
+ minlength=${l(this.minLength)}
176
+ name=${l(this.name)}
177
+ pattern=${l(this.pattern)}
178
+ placeholder=${l(this.placeholder)}
179
+ type=${l(
179
180
  this.type === "password" ? this._passwordController._type : this.type
180
181
  )}
181
182
  />
182
183
  </div>
183
- ${this.type === "number" ? h`
184
+ ${this.type === "number" ? p`
184
185
  <div id="action">
185
186
  ${this._renderNumberButton("inc")} ${this._renderNumberButton("dec")}
186
187
  </div>
187
- ` : u}
188
- ${this.type === "password" ? this._renderPasswordButton() : u}
189
- ${this.type === "search" && this._value.length > 0 ? this._renderSearchButton() : u}
188
+ ` : m}
189
+ ${this.type === "password" ? this._renderPasswordButton() : m}
190
+ ${this.type === "search" && this._value.length > 0 ? this._renderSearchButton() : m}
190
191
  </div>
191
192
  </label>
192
- ${this.hint && h`
193
+ ${this.hint && p`
193
194
  <skf-hint
195
+ ?disabled=${this.disabled}
194
196
  aria-live=${this.invalid ? "assertive" : "polite"}
195
197
  id="hint"
196
- severity=${o(b(this.invalid, this.severity))}
198
+ severity=${l(w(this.invalid, this.severity))}
197
199
  >${this.customInvalid ?? this.hint}
198
200
  </skf-hint>
199
201
  `}
@@ -201,23 +203,14 @@ const m = class m extends c {
201
203
  `;
202
204
  }
203
205
  };
204
- m.styles = [_, A];
205
- let i = m;
206
+ u = new WeakMap(), y.styles = [C, I];
207
+ let i = y;
206
208
  e([
207
- p()
209
+ v()
208
210
  ], i.prototype, "_value", 2);
209
211
  e([
210
212
  s()
211
213
  ], i.prototype, "autocomplete", 2);
212
- e([
213
- s({ attribute: "button-aria-label-clear" })
214
- ], i.prototype, "buttonAriaLabelClear", 2);
215
- e([
216
- s({ attribute: "button-aria-label-hide" })
217
- ], i.prototype, "buttonAriaLabelHide", 2);
218
- e([
219
- s({ attribute: "button-aria-label-show" })
220
- ], i.prototype, "buttonAriaLabelShow", 2);
221
214
  e([
222
215
  s({ attribute: "custom-invalid", reflect: !0 })
223
216
  ], i.prototype, "customInvalid", 1);
@@ -236,6 +229,9 @@ e([
236
229
  e([
237
230
  s()
238
231
  ], i.prototype, "label", 2);
232
+ e([
233
+ s({ type: String })
234
+ ], i.prototype, "lang", 2);
239
235
  e([
240
236
  s()
241
237
  ], i.prototype, "leading", 2);
@@ -263,9 +259,6 @@ e([
263
259
  e([
264
260
  s({ type: Boolean })
265
261
  ], i.prototype, "readonly", 2);
266
- e([
267
- s({ attribute: "required-label" })
268
- ], i.prototype, "requiredLabel", 2);
269
262
  e([
270
263
  s({ reflect: !0 })
271
264
  ], i.prototype, "severity", 2);
@@ -288,19 +281,19 @@ e([
288
281
  s({})
289
282
  ], i.prototype, "value", 1);
290
283
  e([
291
- p()
284
+ v()
292
285
  ], i.prototype, "invalid", 2);
293
286
  e([
294
- p()
287
+ v()
295
288
  ], i.prototype, "_buttonDown", 2);
296
289
  e([
297
- $("input")
290
+ S("input")
298
291
  ], i.prototype, "$input", 2);
299
292
  e([
300
- g({ flatten: !0 })
293
+ x({ flatten: !0 })
301
294
  ], i.prototype, "_defaultSlot", 2);
302
295
  e([
303
- y("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
296
+ E("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
304
297
  ], i.prototype, "valueChanged", 1);
305
298
  export {
306
299
  i as SkfInput
@@ -38,7 +38,6 @@ export declare class InputPasswordController implements ReactiveController {
38
38
  host?: ReactiveControllerHost & Partial<ControllerHostProps>;
39
39
  _inputElement?: HTMLInputElement;
40
40
  _icon: Extract<Icon, 'visibility' | 'visibilityOff'>;
41
- _buttonAriaLabel: string;
42
41
  _type: Extract<SkfInput['type'], 'password' | 'text'>;
43
42
  constructor(host: ReactiveControllerHost);
44
43
  hostUpdated(): void;