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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +18 -0
  2. package/dist/components/alert/alert.component.d.ts +3 -2
  3. package/dist/components/alert/alert.component.js +39 -33
  4. package/dist/components/breadcrumb/breadcrumb-item.component.js +11 -12
  5. package/dist/components/button/button.component.js +32 -36
  6. package/dist/components/button/button.styles.js +3 -3
  7. package/dist/components/checkbox/checkbox.component.d.ts +6 -5
  8. package/dist/components/checkbox/checkbox.component.js +67 -69
  9. package/dist/components/checkbox/checkbox.styles.js +1 -1
  10. package/dist/components/datepicker/datepicker-calendar.component.d.ts +1 -0
  11. package/dist/components/datepicker/datepicker-calendar.component.js +107 -116
  12. package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
  13. package/dist/components/datepicker/datepicker-popup.component.js +112 -100
  14. package/dist/components/datepicker/datepicker-popup.helpers.js +1 -1
  15. package/dist/components/datepicker/datepicker.component.d.ts +4 -2
  16. package/dist/components/datepicker/datepicker.component.js +159 -160
  17. package/dist/components/dialog/dialog.component.d.ts +3 -2
  18. package/dist/components/dialog/dialog.component.js +48 -48
  19. package/dist/components/divider/divider.component.d.ts +3 -0
  20. package/dist/components/divider/divider.component.js +43 -22
  21. package/dist/components/divider/divider.styles.js +9 -9
  22. package/dist/components/drawer/drawer.component.d.ts +12 -4
  23. package/dist/components/drawer/drawer.component.js +84 -61
  24. package/dist/components/drawer/drawer.styles.js +47 -40
  25. package/dist/components/header/header.component.d.ts +4 -2
  26. package/dist/components/header/header.component.js +64 -57
  27. package/dist/components/header/header.styles.js +2 -2
  28. package/dist/components/icon/icon.component.js +26 -16
  29. package/dist/components/icon/icon.styles.js +4 -4
  30. package/dist/components/input/input.component.d.ts +11 -10
  31. package/dist/components/input/input.component.js +115 -111
  32. package/dist/components/input/input.controllers.d.ts +0 -1
  33. package/dist/components/input/input.controllers.js +14 -19
  34. package/dist/components/link/link.component.d.ts +1 -0
  35. package/dist/components/link/link.component.js +86 -74
  36. package/dist/components/link/link.styles.js +7 -3
  37. package/dist/components/loader/loader.component.d.ts +0 -2
  38. package/dist/components/loader/loader.component.js +27 -30
  39. package/dist/components/loader/loader.styles.js +1 -1
  40. package/dist/components/menu/menu-item.styles.js +8 -7
  41. package/dist/components/menu/menu.component.d.ts +5 -2
  42. package/dist/components/menu/menu.component.js +7 -7
  43. package/dist/components/nav/nav.component.d.ts +3 -0
  44. package/dist/components/nav/nav.component.js +38 -33
  45. package/dist/components/popover/popover.component.d.ts +6 -7
  46. package/dist/components/popover/popover.component.js +23 -31
  47. package/dist/components/progress/progress.styles.js +3 -3
  48. package/dist/components/radio/radio.component.d.ts +4 -2
  49. package/dist/components/radio/radio.component.js +96 -91
  50. package/dist/components/radio/radio.styles.js +1 -1
  51. package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
  52. package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
  53. package/dist/components/segmented-button/segmented-button.component.js +22 -24
  54. package/dist/components/select/select-option.component.d.ts +2 -1
  55. package/dist/components/select/select-option.component.js +31 -36
  56. package/dist/components/select/select.component.d.ts +20 -10
  57. package/dist/components/select/select.component.js +139 -104
  58. package/dist/components/select/select.controllers.js +14 -17
  59. package/dist/components/select/select.styles.js +8 -3
  60. package/dist/components/stepper/stepper-item.component.d.ts +1 -1
  61. package/dist/components/stepper/stepper-item.component.js +26 -23
  62. package/dist/components/stepper/stepper-item.styles.js +4 -4
  63. package/dist/components/stepper/stepper.component.js +2 -3
  64. package/dist/components/stepper/stepper.helpers.js +6 -7
  65. package/dist/components/switch/switch.component.d.ts +4 -2
  66. package/dist/components/switch/switch.component.js +64 -58
  67. package/dist/components/switch/switch.styles.js +1 -1
  68. package/dist/components/tabs/tab-panel.component.d.ts +1 -1
  69. package/dist/components/tabs/tab-panel.component.js +19 -16
  70. package/dist/components/tabs/tab.component.d.ts +1 -1
  71. package/dist/components/tabs/tab.component.js +17 -14
  72. package/dist/components/tabs/tab.styles.js +2 -2
  73. package/dist/components/tabs/tabs.component.js +6 -6
  74. package/dist/components/tag/tag.component.d.ts +9 -6
  75. package/dist/components/tag/tag.component.js +78 -72
  76. package/dist/components/tag/tag.styles.js +5 -0
  77. package/dist/components/textarea/textarea.component.d.ts +4 -2
  78. package/dist/components/textarea/textarea.component.js +101 -95
  79. package/dist/components/toast/toast-item.styles.js +13 -10
  80. package/dist/components/toast/toast.singleton.js +6 -7
  81. package/dist/components/tooltip/tooltip.component.d.ts +7 -4
  82. package/dist/components/tooltip/tooltip.component.js +22 -14
  83. package/dist/custom-elements.json +835 -422
  84. package/dist/index.d.ts +2 -2
  85. package/dist/index.js +20 -20
  86. package/dist/internal/base-classes/popover/popover.base.d.ts +28 -8
  87. package/dist/internal/base-classes/popover/popover.base.js +78 -74
  88. package/dist/internal/components/formBase.d.ts +1 -0
  89. package/dist/internal/components/formBase.js +11 -19
  90. package/dist/internal/controllers/popover.controller.d.ts +2 -0
  91. package/dist/internal/controllers/popover.controller.js +11 -14
  92. package/dist/internal/helpers/stateMap.js +3 -3
  93. package/dist/internal/helpers/uuid.d.ts +8 -10
  94. package/dist/internal/helpers/uuid.js +4 -11
  95. package/dist/internal/helpers/watch.d.ts +1 -1
  96. package/dist/internal/templates/asterisk.d.ts +1 -1
  97. package/dist/internal/templates/asterisk.js +4 -4
  98. package/dist/internal/types.d.ts +4 -0
  99. package/dist/styles/global-alt.css +1 -1
  100. package/dist/styles/global.css +1 -1
  101. package/dist/translations/en.d.ts +3 -0
  102. package/dist/translations/en.js +27 -0
  103. package/dist/translations/es.d.ts +3 -0
  104. package/dist/translations/es.js +27 -0
  105. package/dist/translations/index.d.ts +4 -0
  106. package/dist/translations/pt.d.ts +3 -0
  107. package/dist/translations/pt.js +27 -0
  108. package/dist/translations/sv.d.ts +3 -0
  109. package/dist/translations/sv.js +27 -0
  110. package/dist/types/jsx/custom-element-jsx.d.ts +1840 -858
  111. package/dist/types/vue/index.d.ts +69 -64
  112. package/dist/utilities/localize.d.ts +28 -0
  113. package/dist/utilities/localize.js +13 -0
  114. package/dist/vscode.html-custom-data.json +75 -83
  115. package/dist/web-types.json +229 -190
  116. package/package.json +29 -35
  117. package/custom-elements.json +0 -25490
package/README.md CHANGED
@@ -351,6 +351,24 @@ Checklist:
351
351
 
352
352
  </details>
353
353
 
354
+ ## Known inconsistencies coming from the React library and v1 Web Components
355
+
356
+ Our focus going forward is on the v2 package of Web Components (new brand design) and as our bandwidth is limited work done to the v1 Web Compnent library will be very limited.
357
+
358
+ | React Component | WC v1 - Solution |
359
+ | --------------- | ----------------------------------------------------------------------------- |
360
+ | IconButton | Use `skf-link` without text or `skf-button` variant tertiary, without a label |
361
+ | Search | Search is now a variant of `skf-input` |
362
+ | Image | Was deemed not adding value over the native `picture`/`img` tag |
363
+ | Paragraph | Was deemed not adding value over the native p tag |
364
+ | useTooltip | Not needed, `skf-tooltip` handles it common state internally |
365
+ | usePopup | Renamed `skf-popover`, no need for a hook |
366
+ | EmptyState | Missing but easy to copy svg from React and recreate |
367
+ | SkfUiProvider | Not needed, you add our global css as mentioned above |
368
+ | ToastProvider | `skf-toast` handles its own internal state, no provider needed |
369
+ | ts tokens | The global css contains all tokens as css custom vars which should suffice |
370
+ | Missing tokens | A few tokens are missing. Report as issue but expect to create your own |
371
+
354
372
  ## 🧑‍⚖️ License
355
373
 
356
374
  Copyright SKF 2024
@@ -1,6 +1,7 @@
1
1
  import '../icon/icon.js';
2
2
  import { SkfElement } from '../../internal/components/skf-element.js';
3
3
  import type { Icon, Severity } from '../../internal/types.js';
4
+ import { type Language } from '../../utilities/localize.js';
4
5
  import { type CSSResultGroup } from 'lit';
5
6
  /**
6
7
  * The `<skf-alert>` is a type of notification that appears in-line
@@ -17,10 +18,10 @@ import { type CSSResultGroup } from 'lit';
17
18
  export declare class SkfAlert extends SkfElement {
18
19
  #private;
19
20
  static styles: CSSResultGroup;
20
- /** Close button aria-label */
21
- buttonLabel: string;
22
21
  /** If defined, displays leading icon */
23
22
  icon?: Icon;
23
+ /** Sets the internal language of the component */
24
+ lang: Language;
24
25
  /** If true, renders with an close button and sets aria-role to `status` */
25
26
  persistent: boolean;
26
27
  /** If defined, gives the supplied appearance */
@@ -1,28 +1,30 @@
1
1
  var u = (t) => {
2
2
  throw TypeError(t);
3
3
  };
4
- var d = (t, e, s) => e.has(t) || u("Cannot " + s);
5
- var m = (t, e, s) => (d(t, e, "read from private field"), s ? s.call(t) : e.get(t)), f = (t, e, s) => e.has(t) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), y = (t, e, s, o) => (d(t, e, "write to private field"), o ? o.call(t, s) : e.set(t, s), s);
4
+ var g = (t, e, s) => e.has(t) || u("Cannot " + s);
5
+ var c = (t, e, s) => (g(t, e, "read from private field"), s ? s.call(t) : e.get(t)), h = (t, e, s) => e.has(t) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), m = (t, e, s, o) => (g(t, e, "write to private field"), o ? o.call(t, s) : e.set(t, s), s);
6
6
  import "../icon/icon.js";
7
- import { SkfElement as g } from "../../internal/components/skf-element.js";
8
- import { stateMap as C } from "../../internal/helpers/stateMap.js";
7
+ import { SkfElement as C } from "../../internal/components/skf-element.js";
8
+ import { stateMap as w } from "../../internal/helpers/stateMap.js";
9
9
  import { watch as S } from "../../internal/helpers/watch.js";
10
10
  import { componentStyles as $ } from "../../styles/component.styles.js";
11
- import { nothing as w, html as v } from "lit";
12
- import { property as p } from "lit/decorators.js";
11
+ import { LocalizeController as z } from "../../utilities/localize.js";
12
+ import { nothing as O, html as b } from "lit";
13
+ import { property as f } from "lit/decorators.js";
13
14
  import { ifDefined as _ } from "lit/directives/if-defined.js";
14
- import { styles as O } from "./alert.styles.js";
15
- var P = Object.defineProperty, k = Object.getOwnPropertyDescriptor, l = (t, e, s, o) => {
16
- for (var i = o > 1 ? void 0 : o ? k(e, s) : e, c = t.length - 1, h; c >= 0; c--)
17
- (h = t[c]) && (i = (o ? h(e, s, i) : h(i)) || i);
18
- return o && i && P(e, s, i), i;
19
- }, n, a;
20
- const b = class b extends g {
15
+ import { styles as P } from "./alert.styles.js";
16
+ var k = Object.defineProperty, D = Object.getOwnPropertyDescriptor, p = (t, e, s, o) => {
17
+ for (var i = o > 1 ? void 0 : o ? D(e, s) : e, y = t.length - 1, d; y >= 0; y--)
18
+ (d = t[y]) && (i = (o ? d(e, s, i) : d(i)) || i);
19
+ return o && i && k(e, s, i), i;
20
+ }, n, a, l;
21
+ const v = class v extends C {
21
22
  constructor() {
22
23
  super(...arguments);
23
- f(this, n);
24
- f(this, a);
25
- y(this, n, this.attachInternals()), y(this, a, m(this, n).states), this.buttonLabel = "Close", this.persistent = !1, this._handleClose = () => {
24
+ h(this, n);
25
+ h(this, a);
26
+ h(this, l);
27
+ m(this, n, new z(this)), m(this, a, this.attachInternals()), m(this, l, c(this, a).states), this.lang = "en", this.persistent = !1, this._handleClose = () => {
26
28
  this.emit("skf-alert-close");
27
29
  };
28
30
  }
@@ -31,10 +33,10 @@ const b = class b extends g {
31
33
  }
32
34
  _handleStateChange() {
33
35
  const s = ["error", "info", "success", "warning"];
34
- C(m(this, a), s).set(this.severity);
36
+ w(c(this, l), s).set(this.severity);
35
37
  }
36
38
  render() {
37
- return v`
39
+ return b`
38
40
  <div id="root">
39
41
  <skf-icon
40
42
  color=${_(this.severity ?? "secondary")}
@@ -45,30 +47,34 @@ const b = class b extends g {
45
47
  <slot id="main"></slot>
46
48
  <slot name="link"></slot>
47
49
  </div>
48
- ${this.persistent ? v`
49
- <button @click="${this._handleClose}" aria-label=${this.buttonLabel} type="button">
50
+ ${this.persistent ? b`
51
+ <button
52
+ @click="${this._handleClose}"
53
+ aria-label=${c(this, n).term("close")}
54
+ type="button"
55
+ >
50
56
  <skf-icon name="close" size="sm"></skf-icon>
51
57
  </button>
52
- ` : w}
58
+ ` : O}
53
59
  </div>
54
60
  `;
55
61
  }
56
62
  };
57
- n = new WeakMap(), a = new WeakMap(), b.styles = [$, O];
58
- let r = b;
59
- l([
60
- p({ type: String, attribute: "button-label" })
61
- ], r.prototype, "buttonLabel", 2);
62
- l([
63
- p({ type: String })
63
+ n = new WeakMap(), a = new WeakMap(), l = new WeakMap(), v.styles = [$, P];
64
+ let r = v;
65
+ p([
66
+ f({ type: String })
64
67
  ], r.prototype, "icon", 2);
65
- l([
66
- p({ type: Boolean })
68
+ p([
69
+ f({ type: String })
70
+ ], r.prototype, "lang", 2);
71
+ p([
72
+ f({ type: Boolean })
67
73
  ], r.prototype, "persistent", 2);
68
- l([
69
- p({ type: String })
74
+ p([
75
+ f({ type: String })
70
76
  ], r.prototype, "severity", 2);
71
- l([
77
+ p([
72
78
  S("severity")
73
79
  ], r.prototype, "_handleStateChange", 1);
74
80
  export {
@@ -5,16 +5,15 @@ import { html as n } from "lit";
5
5
  import { property as f, state as _ } from "lit/decorators.js";
6
6
  import { ifDefined as u } from "lit/directives/if-defined.js";
7
7
  import { styles as C } from "./breadcrumb-item.styles.js";
8
- var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, p = (a, t, s, r) => {
9
- for (var e = r > 1 ? void 0 : r ? y(t, s) : t, o = a.length - 1, l; o >= 0; o--)
10
- (l = a[o]) && (e = (r ? l(t, s, e) : l(e)) || e);
11
- return r && e && v(t, s, e), e;
8
+ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, p = (a, t, e, i) => {
9
+ for (var r = i > 1 ? void 0 : i ? y(t, e) : t, o = a.length - 1, l; o >= 0; o--)
10
+ (l = a[o]) && (r = (i ? l(t, e, r) : l(r)) || r);
11
+ return i && r && v(t, e, r), r;
12
12
  };
13
13
  const c = class c extends h {
14
14
  constructor() {
15
- super(...arguments), this._isCurrent = !1, this._clickHandler = (t, s) => {
16
- var r;
17
- this._onClick && t.preventDefault(), (r = this._onClick) == null || r.call(this, t, s);
15
+ super(...arguments), this._isCurrent = !1, this._clickHandler = (t, e) => {
16
+ this._onClick && t.preventDefault(), this._onClick?.(t, e);
18
17
  };
19
18
  }
20
19
  set onClick(t) {
@@ -45,16 +44,16 @@ const c = class c extends h {
45
44
  }
46
45
  };
47
46
  c.styles = [m, C];
48
- let i = c;
47
+ let s = c;
49
48
  p([
50
49
  f({ type: String })
51
- ], i.prototype, "href", 2);
50
+ ], s.prototype, "href", 2);
52
51
  p([
53
52
  f({ attribute: !1 })
54
- ], i.prototype, "onClick", 1);
53
+ ], s.prototype, "onClick", 1);
55
54
  p([
56
55
  _()
57
- ], i.prototype, "_isCurrent", 2);
56
+ ], s.prototype, "_isCurrent", 2);
58
57
  export {
59
- i as SkfBreadcrumbItem
58
+ s as SkfBreadcrumbItem
60
59
  };
@@ -1,40 +1,38 @@
1
- var u = (i) => {
1
+ var f = (i) => {
2
2
  throw TypeError(i);
3
3
  };
4
- var _ = (i, e, t) => e.has(i) || u("Cannot " + t);
5
- var p = (i, e, t) => (_(i, e, "read from private field"), t ? t.call(i) : e.get(i)), v = (i, e, t) => e.has(i) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), $ = (i, e, t, a) => (_(i, e, "write to private field"), a ? a.call(i, t) : e.set(i, t), t);
4
+ var u = (i, e, t) => e.has(i) || f("Cannot " + t);
5
+ var h = (i, e, t) => (u(i, e, "read from private field"), t ? t.call(i) : e.get(i)), _ = (i, e, t) => e.has(i) ? f("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), v = (i, e, t, a) => (u(i, e, "write to private field"), a ? a.call(i, t) : e.set(i, t), t);
6
6
  import "../icon/icon.js";
7
7
  import "../loader/loader.js";
8
- import { SkfElement as O } from "../../internal/components/skf-element.js";
9
- import { watch as V } from "../../internal/helpers/watch.js";
10
- import { componentStyles as w } from "../../styles/component.styles.js";
11
- import { html as y, LitElement as z, nothing as b } from "lit";
12
- import { property as r, state as P, query as m } from "lit/decorators.js";
13
- import { classMap as L } from "lit/directives/class-map.js";
14
- import { ifDefined as g } from "lit/directives/if-defined.js";
15
- import { styles as C } from "./button.styles.js";
16
- var F = Object.defineProperty, q = Object.getOwnPropertyDescriptor, s = (i, e, t, a) => {
17
- for (var n = a > 1 ? void 0 : a ? q(e, t) : e, h = i.length - 1, d; h >= 0; h--)
18
- (d = i[h]) && (n = (a ? d(e, t, n) : d(n)) || n);
19
- return a && n && F(e, t, n), n;
8
+ import { SkfElement as g } from "../../internal/components/skf-element.js";
9
+ import { watch as O } from "../../internal/helpers/watch.js";
10
+ import { componentStyles as V } from "../../styles/component.styles.js";
11
+ import { html as p, LitElement as w, nothing as b } from "lit";
12
+ import { property as r, state as z, query as m } from "lit/decorators.js";
13
+ import { classMap as P } from "lit/directives/class-map.js";
14
+ import { ifDefined as $ } from "lit/directives/if-defined.js";
15
+ import { styles as L } from "./button.styles.js";
16
+ var C = Object.defineProperty, F = Object.getOwnPropertyDescriptor, s = (i, e, t, a) => {
17
+ for (var n = a > 1 ? void 0 : a ? F(e, t) : e, c = i.length - 1, y; c >= 0; c--)
18
+ (y = i[c]) && (n = (a ? y(e, t, n) : y(n)) || n);
19
+ return a && n && C(e, t, n), n;
20
20
  }, l;
21
- const c = class c extends O {
21
+ const d = class d extends g {
22
22
  constructor() {
23
23
  super();
24
- v(this, l);
24
+ _(this, l);
25
25
  this._transitionOptions = {
26
26
  duration: 200,
27
27
  fill: "forwards"
28
28
  }, this.destructive = !1, this.disabled = !1, this.iconOnly = !1, this.iconPosition = "left", this.loading = !1, this.noValidate = !1, this.size = "md", this.type = "button", this.variant = "primary", this._loaderVisible = !1, this._handleClick = (t) => {
29
29
  t.preventDefault(), t.stopPropagation(), !(this.disabled || this.loading) && (this.dispatchEvent(new CustomEvent("click", { bubbles: !0, composed: !0, detail: t })), this.type === "submit" && this._submitForm(), this.type === "reset" && this._resetForm());
30
30
  }, this._submitForm = () => {
31
- var h, d, f;
32
- const t = !((h = p(this, l).form) != null && h.reportValidity()), a = !this.noValidate, n = !((d = p(this, l).form) != null && d.hasAttribute("no-validate"));
33
- (a || n) && t || (f = p(this, l).form) == null || f.requestSubmit();
31
+ const t = !h(this, l).form?.reportValidity(), a = !this.noValidate, n = !h(this, l).form?.hasAttribute("no-validate");
32
+ (a || n) && t || h(this, l).form?.requestSubmit();
34
33
  }, this._resetForm = () => {
35
- var t;
36
- (t = p(this, l).form) == null || t.reset();
37
- }, this._renderIcon = () => y`<skf-icon data-color="custom" name=${g(this.icon)}></skf-icon>`, $(this, l, this.attachInternals());
34
+ h(this, l).form?.reset();
35
+ }, this._renderIcon = () => p`<skf-icon data-color="custom" name=${$(this.icon)}></skf-icon>`, v(this, l, this.attachInternals());
38
36
  }
39
37
  firstUpdated(t) {
40
38
  if (t.has("loading") && this.loading) {
@@ -47,25 +45,23 @@ const c = class c extends O {
47
45
  }
48
46
  /** Simulates a click on the button. */
49
47
  click() {
50
- var t;
51
- (t = this.$button) == null || t.click();
48
+ this.$button?.click();
52
49
  }
53
50
  /** @internal */
54
51
  async _showLoader() {
55
- var t;
56
- this._loaderVisible = !0, await ((t = this.$body) == null ? void 0 : t.animate({ opacity: 0 }, this._transitionOptions).finished), !(!this.$body || !this.$loader) && this.$loader.animate({ opacity: 1 }, this._transitionOptions);
52
+ this._loaderVisible = !0, await this.$body?.animate({ opacity: 0 }, this._transitionOptions).finished, !(!this.$body || !this.$loader) && this.$loader.animate({ opacity: 1 }, this._transitionOptions);
57
53
  }
58
54
  /** @internal */
59
55
  async _hideLoader() {
60
56
  !this.$body || !this.$loader || (await this.$loader.animate({ opacity: 0 }, this._transitionOptions).finished, this._loaderVisible = !1, this.$body.animate({ opacity: 1 }, this._transitionOptions));
61
57
  }
62
58
  render() {
63
- return y`
59
+ return p`
64
60
  <button
65
61
  ?disabled=${this.disabled || this.loading}
66
62
  @click=${this._handleClick}
67
63
  aria-busy=${this.loading}
68
- class=${L({
64
+ class=${P({
69
65
  btn: !0,
70
66
  "btn--destructive": this.destructive,
71
67
  "btn--icon-only": this.iconOnly,
@@ -76,22 +72,22 @@ const c = class c extends O {
76
72
  "btn--variant-secondary": this.variant === "secondary",
77
73
  "btn--variant-tertiary": this.variant === "tertiary"
78
74
  })}
79
- type=${g(this.type)}
75
+ type=${$(this.type)}
80
76
  title=${/* An empty title prevents browser validation tooltips from appearing on hover */
81
77
  this.title}
82
78
  >
83
- ${this.variant === "primary" && this._loaderVisible ? y`<skf-loader class="btn__loader" invert size="sm"></skf-loader>` : ""}
79
+ ${this.variant === "primary" && this._loaderVisible ? p`<skf-loader class="btn__loader" invert size="sm"></skf-loader>` : ""}
84
80
  <div class="btn__body" id="body">
85
81
  ${this.icon && this.iconPosition === "left" ? this._renderIcon() : b}
86
- ${this.iconOnly ? b : y`<slot class="btn__label"></slot>`}
82
+ ${this.iconOnly ? b : p`<slot class="btn__label"></slot>`}
87
83
  ${this.icon && this.iconPosition === "right" ? this._renderIcon() : b}
88
84
  </div>
89
85
  </button>
90
86
  `;
91
87
  }
92
88
  };
93
- l = new WeakMap(), c.styles = [w, C], c.formAssociated = !0, c.shadowRootOptions = { ...z.shadowRootOptions, delegatesFocus: !0 };
94
- let o = c;
89
+ l = new WeakMap(), d.styles = [V, L], d.formAssociated = !0, d.shadowRootOptions = { ...w.shadowRootOptions, delegatesFocus: !0 };
90
+ let o = d;
95
91
  s([
96
92
  r({ type: Boolean })
97
93
  ], o.prototype, "destructive", 2);
@@ -123,7 +119,7 @@ s([
123
119
  r({ reflect: !0 })
124
120
  ], o.prototype, "variant", 2);
125
121
  s([
126
- P()
122
+ z()
127
123
  ], o.prototype, "_loaderVisible", 2);
128
124
  s([
129
125
  m("skf-loader")
@@ -135,7 +131,7 @@ s([
135
131
  m("button")
136
132
  ], o.prototype, "$button", 2);
137
133
  s([
138
- V("loading", { afterUpdate: !0 })
134
+ O("loading", { afterUpdate: !0 })
139
135
  ], o.prototype, "_handleLoadingChange", 1);
140
136
  export {
141
137
  o as SkfButton
@@ -86,9 +86,9 @@ const r = o`
86
86
  --_skf-button-bg-color: var(--skf-interactive-bg-color-secondary);
87
87
  --_skf-button-bg-color-active: var(--skf-interactive-bg-color-secondary-active);
88
88
  --_skf-button-bg-color-hover: var(--skf-interactive-bg-color-secondary-hover);
89
- --_skf-button-border-color: var(--skf-border-color-emphasised);
89
+ --_skf-button-border-color: var(--skf-border-color-emphasized);
90
90
  --_skf-button-border-color-disabled: var(--skf-interactive-border-color-disabled);
91
- --_skf-button-color: var(--skf-text-color-emphasised);
91
+ --_skf-button-color: var(--skf-text-color-emphasized);
92
92
  --_skf-button-color-disabled: var(--skf-interactive-text-color-disabled);
93
93
  }
94
94
 
@@ -97,7 +97,7 @@ const r = o`
97
97
  --_skf-button-bg-color-active: var(--skf-interactive-bg-color-secondary-active);
98
98
  --_skf-button-bg-color-hover: var(--skf-interactive-bg-color-secondary-hover);
99
99
  --_skf-button-border-color: transparent;
100
- --_skf-button-color: var(--skf-text-color-emphasised);
100
+ --_skf-button-color: var(--skf-text-color-emphasized);
101
101
  --_skf-button-color-disabled: var(--skf-interactive-text-color-disabled);
102
102
  }
103
103
 
@@ -2,6 +2,7 @@ import '../icon/icon.js';
2
2
  import { FormBase } from '../../internal/components/formBase.js';
3
3
  import type { FormFieldSeverity } from '../../internal/types.js';
4
4
  import type { FormFieldBaseProps } from '../../internal/types/formField.js';
5
+ import { type Language } from '../../utilities/localize.js';
5
6
  import { type CSSResultGroup } from 'lit';
6
7
  /**
7
8
  * The `<skf-checkbox>` component is used to create a checkbox input
@@ -18,6 +19,7 @@ import { type CSSResultGroup } from 'lit';
18
19
  * @tagname skf-checkbox
19
20
  */
20
21
  export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps {
22
+ #private;
21
23
  static styles: CSSResultGroup;
22
24
  /**
23
25
  * @internal
@@ -27,18 +29,17 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
27
29
  /** If defined, outputs helping hints in console */
28
30
  debug: boolean;
29
31
  /** If true, outputs helping hints in console */
30
- get checked(): boolean;
31
- set checked(value: boolean);
32
+ checked: boolean;
32
33
  /** If true, forces component to invalid state until removed */
33
34
  customInvalid: boolean;
34
35
  /** If true and the checkbox is unchecked, the checkbox will appear indeterminate */
35
36
  indeterminate: boolean;
36
37
  /** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
37
38
  label?: string;
39
+ /** Sets the internal language of the component */
40
+ lang: Language;
38
41
  /** If defined, adds name to the input-element */
39
42
  name?: string;
40
- /** If defined, renders an alternative A11y text for the asterisk */
41
- requiredLabel?: string;
42
43
  /** If defined, styles checkbox using provided severity */
43
44
  severity?: FormFieldSeverity;
44
45
  /** If true, displays valid state after interaction */
@@ -53,7 +54,7 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
53
54
  /** @internal */
54
55
  private $input?;
55
56
  /** @internal */
56
- handleCheckedChange(): void;
57
+ _handleCheckedChange(): void;
57
58
  /** @internal */
58
59
  handleInvalidChange(): void;
59
60
  /** @internal */
@@ -1,34 +1,35 @@
1
- import "../icon/icon.js";
2
- import { FormBase as p } from "../../internal/components/formBase.js";
3
- import { watch as h } from "../../internal/helpers/watch.js";
4
- import { Asterisk as v } from "../../internal/templates/asterisk.js";
5
- import { componentStyles as m } from "../../styles/component.styles.js";
6
- import { html as c, nothing as f } from "lit";
7
- import { property as r, state as y, query as g } from "lit/decorators.js";
8
- import { ifDefined as _ } from "lit/directives/if-defined.js";
9
- import { styles as b } from "./checkbox.styles.js";
10
- var k = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, i = (u, t, s, a) => {
11
- for (var l = a > 1 ? void 0 : a ? $(t, s) : t, n = u.length - 1, o; n >= 0; n--)
12
- (o = u[n]) && (l = (a ? o(t, s, l) : o(l)) || l);
13
- return a && l && k(t, s, l), l;
1
+ var c = (i) => {
2
+ throw TypeError(i);
14
3
  };
15
- const d = class d extends p {
4
+ var v = (i, s, t) => s.has(i) || c("Cannot " + t);
5
+ var m = (i, s, t) => (v(i, s, "read from private field"), t ? t.call(i) : s.get(i)), f = (i, s, t) => s.has(i) ? c("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(i) : s.set(i, t), y = (i, s, t, l) => (v(i, s, "write to private field"), l ? l.call(i, t) : s.set(i, t), t);
6
+ import "../icon/icon.js";
7
+ import { FormBase as _ } from "../../internal/components/formBase.js";
8
+ import { watch as n } 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 $ } from "../../utilities/localize.js";
12
+ import { html as g, nothing as I } from "lit";
13
+ import { property as r, state as V, query as C } from "lit/decorators.js";
14
+ import { ifDefined as E } from "lit/directives/if-defined.js";
15
+ import { styles as w } from "./checkbox.styles.js";
16
+ var A = Object.defineProperty, D = Object.getOwnPropertyDescriptor, a = (i, s, t, l) => {
17
+ for (var h = l > 1 ? void 0 : l ? D(s, t) : s, d = i.length - 1, u; d >= 0; d--)
18
+ (u = i[d]) && (h = (l ? u(s, t, h) : u(h)) || h);
19
+ return l && h && A(s, t, h), h;
20
+ }, o;
21
+ const p = class p extends _ {
16
22
  constructor() {
17
- super(...arguments), this._initiallyChecked = !1, this.debug = !1, this.customInvalid = !1, this.indeterminate = !1, this.showValid = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (t) => {
23
+ super(...arguments);
24
+ f(this, o);
25
+ this._initiallyChecked = !1, y(this, o, new $(this)), this.debug = !1, this.checked = !1, this.customInvalid = !1, this.indeterminate = !1, this.lang = "en", this.showValid = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (t) => {
18
26
  t.stopPropagation(), this.checked = this._initiallyChecked, this.$input && (this.$input.checked = !!this._initiallyChecked), this.setFormValue(this.checked ? this.value : null);
19
- }, this._renderIcon = (t) => c`
27
+ }, this._renderIcon = (t) => g`
20
28
  <skf-icon color="inverse" name=${t} size=${this.size === "sm" ? "sm" : "md"}></skf-icon>
21
29
  `;
22
30
  }
23
- get checked() {
24
- var t;
25
- return ((t = this.$input) == null ? void 0 : t.checked) ?? !1;
26
- }
27
- set checked(t) {
28
- this.setAttribute("checked", String(!!t)), this.$input && (this.$input.checked = !!t);
29
- }
30
- handleCheckedChange() {
31
- this.setFormValue(this.checked ? this.value : null), this._validateInput();
31
+ _handleCheckedChange() {
32
+ this.setFormValue(this.checked ? this.value : null), this._validateInput(), this.$input && (this.$input.checked = !!this.checked);
32
33
  }
33
34
  handleInvalidChange() {
34
35
  this._invalid ? (this.setAttribute("invalid", ""), this.showValid && this.removeAttribute("valid"), this.checkValidity()) : (this.removeAttribute("invalid"), !this.pristine && this.showValid && this.setAttribute("valid", "true"));
@@ -38,40 +39,37 @@ const d = class d extends p {
38
39
  }
39
40
  handleCustomInvalidChange() {
40
41
  if (this.customInvalid) {
41
- const s = (
42
+ const l = (
42
43
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
43
44
  this.getAttribute("data-customerror") || "Set a custom error message using the data-customerror attribute"
44
45
  );
45
- this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, s), this.checkValidity();
46
+ this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, l), this.checkValidity();
46
47
  } else
47
48
  this.setValidity({}), this._validateInput();
48
49
  }
49
50
  firstUpdated() {
50
- var t;
51
- (t = this.$input) == null || t.addEventListener("change", (s) => {
52
- var a;
53
- s.stopPropagation(), this.pristine = !1, this.checked = ((a = this.$input) == null ? void 0 : a.checked) ?? !1, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.emitEvent("change");
54
- }), this.addEventListener("invalid", (s) => {
55
- this.pristine = !1, this._invalid = !0, this.customErrorDisplay && s.preventDefault();
51
+ this.$input?.addEventListener("change", (t) => {
52
+ t.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.emitEvent("change");
53
+ }), this.addEventListener("invalid", (t) => {
54
+ this.pristine = !1, this._invalid = !0, this.customErrorDisplay && t.preventDefault();
56
55
  }), this._initiallyChecked = this.checked, this.addEventListener("reset", this._resetValue), this._validateInput();
57
56
  }
58
57
  /** @internal */
59
58
  _validateInput() {
60
- var t;
61
59
  if (this._invalid = !1, this.customInvalid)
62
60
  this.setValidity({ customError: !0 }, "Custom error"), this._invalid = !0;
63
61
  else if (this.required && !this.checked) {
64
62
  this.pristine || (this._invalid = !0);
65
- const s = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
63
+ const t = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
66
64
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
67
- ((t = this.$input) == null ? void 0 : t.validationMessage) || "Please check this box if you want to proceed"
65
+ this.$input?.validationMessage || "Please check this box if you want to proceed"
68
66
  );
69
- this.setValidity({ valueMissing: !0 }, String(s));
67
+ this.setValidity({ valueMissing: !0 }, String(t));
70
68
  } else
71
69
  this.setValidity({});
72
70
  }
73
71
  render() {
74
- return c`
72
+ return g`
75
73
  <label id="root">
76
74
  <input
77
75
  ?checked=${this.checked}
@@ -79,71 +77,71 @@ const d = class d extends p {
79
77
  ?required=${this.required}
80
78
  .indeterminate=${this.indeterminate}
81
79
  aria-invalid=${!!this._invalid}
82
- name=${_(this.name)}
80
+ name=${E(this.name)}
83
81
  type="checkbox"
84
82
  value=${this.value}
85
83
  />
86
84
  ${this._renderIcon("check")} ${this._renderIcon("removeMinus")}
87
85
  <div id="label">
88
86
  <slot>${this.label}</slot>
89
- ${this.required ? v(this.requiredLabel) : f}
87
+ ${this.required ? b(m(this, o).term("required")) : I}
90
88
  </div>
91
89
  </label>
92
90
  `;
93
91
  }
94
92
  };
95
- d.styles = [m, b];
96
- let e = d;
97
- i([
93
+ o = new WeakMap(), p.styles = [k, w];
94
+ let e = p;
95
+ a([
98
96
  r({ type: Boolean })
99
97
  ], e.prototype, "debug", 2);
100
- i([
98
+ a([
101
99
  r({ type: Boolean, reflect: !0 })
102
- ], e.prototype, "checked", 1);
103
- i([
100
+ ], e.prototype, "checked", 2);
101
+ a([
104
102
  r({ type: Boolean, attribute: "custom-invalid", reflect: !0 })
105
103
  ], e.prototype, "customInvalid", 2);
106
- i([
104
+ a([
107
105
  r({ type: Boolean, reflect: !0 })
108
106
  ], e.prototype, "indeterminate", 2);
109
- i([
107
+ a([
110
108
  r()
111
109
  ], e.prototype, "label", 2);
112
- i([
110
+ a([
111
+ r({ type: String })
112
+ ], e.prototype, "lang", 2);
113
+ a([
113
114
  r()
114
115
  ], e.prototype, "name", 2);
115
- i([
116
- r({ attribute: "required-label" })
117
- ], e.prototype, "requiredLabel", 2);
118
- i([
116
+ a([
119
117
  r({ reflect: !0 })
120
118
  ], e.prototype, "severity", 2);
121
- i([
119
+ a([
122
120
  r({ type: Boolean, attribute: "show-valid" })
123
121
  ], e.prototype, "showValid", 2);
124
- i([
122
+ a([
125
123
  r({ reflect: !0 })
126
124
  ], e.prototype, "size", 2);
127
- i([
125
+ a([
128
126
  r()
129
127
  ], e.prototype, "value", 2);
130
- i([
131
- y()
128
+ a([
129
+ V()
132
130
  ], e.prototype, "_invalid", 2);
133
- i([
134
- g("input")
131
+ a([
132
+ C("input")
135
133
  ], e.prototype, "$input", 2);
136
- i([
137
- h("checked", { afterUpdate: !0 })
138
- ], e.prototype, "handleCheckedChange", 1);
139
- i([
140
- h("_invalid")
134
+ a([
135
+ n("checked")
136
+ ], e.prototype, "_handleCheckedChange", 1);
137
+ a([
138
+ n("_invalid")
141
139
  ], e.prototype, "handleInvalidChange", 1);
142
- i([
143
- h("_invalid", { afterUpdate: !0 })
140
+ a([
141
+ n("_invalid", { afterUpdate: !0 })
144
142
  ], e.prototype, "handleDebugInvalid", 1);
145
- i([
146
- h("customInvalid")
143
+ a([
144
+ n("customInvalid")
147
145
  ], e.prototype, "handleCustomInvalidChange", 1);
148
146
  export {
149
147
  e as SkfCheckbox
@@ -43,7 +43,7 @@ const i = [
43
43
  }
44
44
 
45
45
  &:is(:checked:not(:disabled), :indeterminate:not(:disabled)) {
46
- --_skf-checkbox-bg-color: var(--skf-bg-color-emphasised);
46
+ --_skf-checkbox-bg-color: var(--skf-bg-color-emphasized);
47
47
  --_skf-checkbox-border-color: transparent;
48
48
  }
49
49
 
@@ -10,6 +10,7 @@ interface DateParts {
10
10
  * @tagname skf-datepicker-calendar
11
11
  */
12
12
  export declare class SkfDatepickerCalendar extends SkfElement {
13
+ #private;
13
14
  static styles: CSSResultGroup;
14
15
  /** @internal */
15
16
  _secondCalendarOffset: number;