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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +18 -0
  2. package/dist/components/alert/alert.component.d.ts +3 -2
  3. package/dist/components/alert/alert.component.js +39 -33
  4. package/dist/components/breadcrumb/breadcrumb-item.component.js +11 -12
  5. package/dist/components/button/button.component.js +32 -36
  6. package/dist/components/button/button.styles.js +3 -3
  7. package/dist/components/checkbox/checkbox.component.d.ts +6 -5
  8. package/dist/components/checkbox/checkbox.component.js +67 -69
  9. package/dist/components/checkbox/checkbox.styles.js +1 -1
  10. package/dist/components/datepicker/datepicker-calendar.component.d.ts +1 -0
  11. package/dist/components/datepicker/datepicker-calendar.component.js +107 -116
  12. package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
  13. package/dist/components/datepicker/datepicker-popup.component.js +112 -100
  14. package/dist/components/datepicker/datepicker-popup.helpers.js +1 -1
  15. package/dist/components/datepicker/datepicker.component.d.ts +4 -2
  16. package/dist/components/datepicker/datepicker.component.js +159 -160
  17. package/dist/components/dialog/dialog.component.d.ts +3 -2
  18. package/dist/components/dialog/dialog.component.js +48 -48
  19. package/dist/components/divider/divider.component.d.ts +3 -0
  20. package/dist/components/divider/divider.component.js +43 -22
  21. package/dist/components/divider/divider.styles.js +9 -9
  22. package/dist/components/drawer/drawer.component.d.ts +12 -4
  23. package/dist/components/drawer/drawer.component.js +84 -61
  24. package/dist/components/drawer/drawer.styles.js +47 -40
  25. package/dist/components/header/header.component.d.ts +4 -2
  26. package/dist/components/header/header.component.js +64 -57
  27. package/dist/components/header/header.styles.js +2 -2
  28. package/dist/components/icon/icon.component.js +26 -16
  29. package/dist/components/icon/icon.styles.js +4 -4
  30. package/dist/components/input/input.component.d.ts +11 -10
  31. package/dist/components/input/input.component.js +115 -111
  32. package/dist/components/input/input.controllers.d.ts +0 -1
  33. package/dist/components/input/input.controllers.js +14 -19
  34. package/dist/components/link/link.component.d.ts +1 -0
  35. package/dist/components/link/link.component.js +86 -74
  36. package/dist/components/link/link.styles.js +7 -3
  37. package/dist/components/loader/loader.component.d.ts +0 -2
  38. package/dist/components/loader/loader.component.js +27 -30
  39. package/dist/components/loader/loader.styles.js +1 -1
  40. package/dist/components/menu/menu-item.styles.js +8 -7
  41. package/dist/components/menu/menu.component.d.ts +5 -2
  42. package/dist/components/menu/menu.component.js +8 -8
  43. package/dist/components/nav/nav.component.d.ts +3 -0
  44. package/dist/components/nav/nav.component.js +38 -33
  45. package/dist/components/popover/popover.component.d.ts +6 -7
  46. package/dist/components/popover/popover.component.js +23 -31
  47. package/dist/components/progress/progress.styles.js +3 -3
  48. package/dist/components/radio/radio.component.d.ts +4 -2
  49. package/dist/components/radio/radio.component.js +96 -91
  50. package/dist/components/radio/radio.styles.js +1 -1
  51. package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
  52. package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
  53. package/dist/components/segmented-button/segmented-button.component.js +22 -24
  54. package/dist/components/select/select-option.component.d.ts +2 -1
  55. package/dist/components/select/select-option.component.js +31 -36
  56. package/dist/components/select/select.component.d.ts +20 -10
  57. package/dist/components/select/select.component.js +139 -104
  58. package/dist/components/select/select.controllers.js +22 -20
  59. package/dist/components/select/select.styles.js +8 -2
  60. package/dist/components/stepper/stepper-item.component.d.ts +1 -1
  61. package/dist/components/stepper/stepper-item.component.js +26 -23
  62. package/dist/components/stepper/stepper-item.styles.js +4 -4
  63. package/dist/components/stepper/stepper.component.js +2 -3
  64. package/dist/components/stepper/stepper.helpers.js +6 -7
  65. package/dist/components/switch/switch.component.d.ts +4 -2
  66. package/dist/components/switch/switch.component.js +64 -58
  67. package/dist/components/switch/switch.styles.js +1 -1
  68. package/dist/components/tabs/tab-panel.component.d.ts +1 -1
  69. package/dist/components/tabs/tab-panel.component.js +19 -16
  70. package/dist/components/tabs/tab.component.d.ts +1 -1
  71. package/dist/components/tabs/tab.component.js +17 -14
  72. package/dist/components/tabs/tab.styles.js +2 -2
  73. package/dist/components/tabs/tabs.component.js +6 -6
  74. package/dist/components/tag/tag.component.d.ts +9 -6
  75. package/dist/components/tag/tag.component.js +78 -72
  76. package/dist/components/tag/tag.styles.js +5 -0
  77. package/dist/components/textarea/textarea.component.d.ts +4 -2
  78. package/dist/components/textarea/textarea.component.js +101 -95
  79. package/dist/components/toast/toast-item.styles.js +13 -10
  80. package/dist/components/toast/toast.singleton.js +6 -7
  81. package/dist/components/tooltip/tooltip.component.d.ts +7 -4
  82. package/dist/components/tooltip/tooltip.component.js +22 -14
  83. package/dist/custom-elements.json +835 -422
  84. package/dist/index.d.ts +2 -2
  85. package/dist/index.js +20 -20
  86. package/dist/internal/base-classes/popover/popover.base.d.ts +29 -9
  87. package/dist/internal/base-classes/popover/popover.base.js +79 -76
  88. package/dist/internal/components/formBase.d.ts +1 -0
  89. package/dist/internal/components/formBase.js +11 -19
  90. package/dist/internal/controllers/popover.controller.d.ts +2 -0
  91. package/dist/internal/controllers/popover.controller.js +11 -14
  92. package/dist/internal/helpers/stateMap.js +3 -3
  93. package/dist/internal/helpers/uuid.d.ts +8 -10
  94. package/dist/internal/helpers/uuid.js +4 -11
  95. package/dist/internal/helpers/watch.d.ts +1 -1
  96. package/dist/internal/templates/asterisk.d.ts +1 -1
  97. package/dist/internal/templates/asterisk.js +4 -4
  98. package/dist/internal/types.d.ts +4 -0
  99. package/dist/styles/global-alt.css +1 -1
  100. package/dist/styles/global.css +1 -1
  101. package/dist/translations/en.d.ts +3 -0
  102. package/dist/translations/en.js +27 -0
  103. package/dist/translations/es.d.ts +3 -0
  104. package/dist/translations/es.js +27 -0
  105. package/dist/translations/index.d.ts +4 -0
  106. package/dist/translations/pt.d.ts +3 -0
  107. package/dist/translations/pt.js +27 -0
  108. package/dist/translations/sv.d.ts +3 -0
  109. package/dist/translations/sv.js +27 -0
  110. package/dist/types/jsx/custom-element-jsx.d.ts +1840 -858
  111. package/dist/types/vue/index.d.ts +69 -64
  112. package/dist/utilities/localize.d.ts +28 -0
  113. package/dist/utilities/localize.js +13 -0
  114. package/dist/vscode.html-custom-data.json +75 -83
  115. package/dist/web-types.json +229 -190
  116. package/package.json +29 -35
  117. package/custom-elements.json +0 -25490
@@ -1,61 +1,63 @@
1
+ var S = (o) => {
2
+ throw TypeError(o);
3
+ };
4
+ var P = (o, l, e) => l.has(o) || S("Cannot " + e);
5
+ var D = (o, l, e) => (P(o, l, "read from private field"), e ? e.call(o) : l.get(o)), E = (o, l, e) => l.has(o) ? S("Cannot add the same private member more than once") : l instanceof WeakSet ? l.add(o) : l.set(o, e), C = (o, l, e, t) => (P(o, l, "write to private field"), t ? t.call(o, e) : l.set(o, e), e);
1
6
  import "../icon/icon.js";
2
- import { computePosition as P, flip as S, offset as E } from "@floating-ui/dom";
3
- import { FormBase as C } from "../../internal/components/formBase.js";
7
+ import { computePosition as T, flip as B, offset as x } from "@floating-ui/dom";
8
+ import { FormBase as R } from "../../internal/components/formBase.js";
4
9
  import "../../internal/components/hint/hint.js";
5
- import { PopoverController as I } from "../../internal/controllers/popover.controller.js";
6
- import { hintSeverity as O } from "../../internal/helpers/hintSeverity.js";
7
- import { watch as M } from "../../internal/helpers/watch.js";
8
- import { Asterisk as T } from "../../internal/templates/asterisk.js";
9
- import { Temporal as w } from "@js-temporal/polyfill";
10
- import { componentStyles as B } from "../../styles/component.styles.js";
11
- import { nothing as g, html as y } from "lit";
12
- import { property as h, state as $, query as b, queryAssignedNodes as x } from "lit/decorators.js";
10
+ import { PopoverController as A } from "../../internal/controllers/popover.controller.js";
11
+ import { hintSeverity as L } from "../../internal/helpers/hintSeverity.js";
12
+ import { watch as j } from "../../internal/helpers/watch.js";
13
+ import { Asterisk as V } from "../../internal/templates/asterisk.js";
14
+ import { Temporal as I } from "@js-temporal/polyfill";
15
+ import { componentStyles as q } from "../../styles/component.styles.js";
16
+ import { LocalizeController as U } from "../../utilities/localize.js";
17
+ import { nothing as f, html as b } from "lit";
18
+ import { property as d, state as k, query as $, queryAssignedNodes as N } from "lit/decorators.js";
13
19
  import { ifDefined as u } from "lit/directives/if-defined.js";
14
- import { live as F } from "lit/directives/live.js";
20
+ import { live as O } from "lit/directives/live.js";
15
21
  import "./datepicker-popup.js";
16
- import { dateFormatter as v, is as f, isPopoverOpen as L, debounce as R } from "./datepicker.helpers.js";
17
- import { styles as A } from "./datepicker.styles.js";
18
- var j = Object.defineProperty, q = Object.getOwnPropertyDescriptor, r = (D, e, t, a) => {
19
- for (var o = a > 1 ? void 0 : a ? q(e, t) : e, n = D.length - 1, d; n >= 0; n--)
20
- (d = D[n]) && (o = (a ? d(e, t, o) : d(o)) || o);
21
- return a && o && j(e, t, o), o;
22
- };
23
- const _ = class _ extends C {
22
+ import { dateFormatter as v, is as m, isPopoverOpen as Y, debounce as z } from "./datepicker.helpers.js";
23
+ import { styles as W } from "./datepicker.styles.js";
24
+ var H = Object.defineProperty, K = Object.getOwnPropertyDescriptor, r = (o, l, e, t) => {
25
+ for (var i = t > 1 ? void 0 : t ? K(l, e) : l, h = o.length - 1, p; h >= 0; h--)
26
+ (p = o[h]) && (i = (t ? p(l, e, i) : p(i)) || i);
27
+ return t && i && H(l, e, i), i;
28
+ }, g;
29
+ const w = class w extends R {
24
30
  constructor() {
25
- super(), this.popoverController = new I(this), this.id = "skf-datepicker-input", this.placeholder = "YYYY-MM-DD", this.range = !1, this.size = "md", this.validateOn = "change", this.invalid = !1, this.selectedRangeDates = { start: null, end: null }, this.showClearbutton = !1, this.abortController = new AbortController(), this.abortSignal = this.abortController.signal, this._handleSelectedDate = () => {
31
+ super();
32
+ E(this, g);
33
+ C(this, g, new U(this)), this.popoverController = new A(this), this.id = "skf-datepicker-input", this.lang = "en", this.placeholder = "YYYY-MM-DD", this.range = !1, this.size = "md", this.validateOn = "change", this.invalid = !1, this.selectedRangeDates = { start: null, end: null }, this.showClearbutton = !1, this.abortController = new AbortController(), this.abortSignal = this.abortController.signal, this._handleSelectedDate = () => {
26
34
  this.pristine = !1, this._internals.setFormValue(this.value ?? ""), this.validateInput();
27
35
  }, this._handleDateSelected = (e) => {
28
36
  if (this.range && "start" in e.detail.date && "end" in e.detail.date) {
29
- const t = e.detail.date.start, a = e.detail.date.end;
30
- this.value = `${v(t)},${v(a)}`, this.selectedRangeDates = { start: t, end: a };
37
+ const t = e.detail.date.start, i = e.detail.date.end;
38
+ this.value = `${v(t)},${v(i)}`, this.selectedRangeDates = { start: t, end: i };
31
39
  } else !this.range && e.detail.date instanceof Date && (this.value = v(e.detail.date), this._animatePopover({ el: this.$popover, show: !1 }).then(() => {
32
40
  this.$popover.hidePopover();
33
41
  }));
34
42
  }, this._handleKeyboardEvents = (e) => {
35
- var a, o;
36
43
  const t = e.target.closest("input");
37
44
  if (t) {
38
45
  if ((t.selectionStart ?? 0) < t.value.length && /[[0-9-]/.test(e.key)) {
39
- const n = t.selectionStart ?? 0, p = t.value.split("").slice(0, n);
46
+ const i = t.selectionStart ?? 0, p = t.value.split("").slice(0, i);
40
47
  t.value = p.join("");
41
48
  }
42
- if (t.name.endsWith("-end") && (e.key === "Backspace" && t.value.length === 0 || t.selectionStart === 0 && e.key === "ArrowLeft") && (e.preventDefault(), this.$input.focus()), e.key === "Tab" && !e.shiftKey && t.name.endsWith("-end")) {
43
- e.preventDefault();
44
- const d = (a = this.$popover.childNodes[1].shadowRoot) == null ? void 0 : a.querySelector("skf-datepicker-calendar"), p = (o = d == null ? void 0 : d.shadowRoot) == null ? void 0 : o.querySelector("button");
45
- p == null || p.focus();
46
- }
47
- if ((t.value.length === 4 || t.value.length === 7) && /[[0-9]/.test(e.key) && (t.value = `${t.value}-${e.key}`, e.preventDefault()), e.key === "Escape")
49
+ if (t.name.endsWith("-end") && (e.key === "Backspace" && t.value.length === 0 || t.selectionStart === 0 && e.key === "ArrowLeft") && (e.preventDefault(), this.$input.focus()), e.key === "Tab" && !e.shiftKey && t.name.endsWith("-end") && (e.preventDefault(), this.$popover.childNodes[1].shadowRoot?.querySelector("skf-datepicker-calendar")?.shadowRoot?.querySelector("button")?.focus()), (t.value.length === 4 || t.value.length === 7) && /[[0-9]/.test(e.key) && (t.value = `${t.value}-${e.key}`, e.preventDefault()), e.key === "Escape")
48
50
  if (t.blur(), this.$popover.hidePopover(), this.range) {
49
- const n = this.$input.value, d = this.$input_range_end.value;
50
- if (!f(n, d).date()) return;
51
+ const i = this.$input.value, h = this.$input_range_end.value;
52
+ if (!m(i, h).date()) return;
51
53
  this.$datepickerPopup.selectedDateRange = {
52
- start: new Date(n),
53
- end: new Date(d)
54
+ start: new Date(i),
55
+ end: new Date(h)
54
56
  }, this.$datepickerPopup.emit("selected-date-changed", {
55
- detail: { date: new Date(n) }
57
+ detail: { date: new Date(i) }
56
58
  });
57
59
  } else {
58
- if (!t.value || !f(t.value).date()) return;
60
+ if (!t.value || !m(t.value).date()) return;
59
61
  this.$datepickerPopup.emit("selected-date-changed", {
60
62
  detail: { date: new Date(t.value) }
61
63
  });
@@ -71,15 +73,15 @@ const _ = class _ extends C {
71
73
  }, this.clearInput = () => {
72
74
  this.value = "", this.$datepickerPopup.clearSelection();
73
75
  }, this._handleInput = (e) => {
74
- const t = e.target, a = String(t.value).replace(/[^0-9-]/g, "");
75
- if (t.value = a, t.setCustomValidity(this.customError ?? ""), !!f(t.value).ISO()) {
76
+ const t = e.target, i = String(t.value).replace(/[^0-9-]/g, "");
77
+ if (t.value = i, t.setCustomValidity(this.customError ?? ""), !!m(t.value).ISO()) {
76
78
  if (this.focusTimeoutId && clearTimeout(this.focusTimeoutId), this.$datepickerPopup.date = t.value, this.range) {
77
79
  this.$datepickerPopup.selectedDateRange = {
78
- start: f(this.$input.value).ISO() ? new Date(this.$input.value) : null,
79
- end: f(this.$input_range_end.value).ISO() ? new Date(this.$input_range_end.value) : null
80
+ start: m(this.$input.value).ISO() ? new Date(this.$input.value) : null,
81
+ end: m(this.$input_range_end.value).ISO() ? new Date(this.$input_range_end.value) : null
80
82
  };
81
- const o = Object.values(this.$datepickerPopup.selectedDateRange).filter(Boolean).map((n) => new Date(n).toLocaleDateString("en-CA")).join();
82
- this.value = o, f(this.$input.value).ISO() && (this.focusTimeoutId = setTimeout(() => {
83
+ const h = Object.values(this.$datepickerPopup.selectedDateRange).filter(Boolean).map((p) => new Date(p).toLocaleDateString("en-CA")).join();
84
+ this.value = h, m(this.$input.value).ISO() && (this.focusTimeoutId = setTimeout(() => {
83
85
  this.$input_range_end.focus();
84
86
  }, 200));
85
87
  } else
@@ -91,9 +93,9 @@ const _ = class _ extends C {
91
93
  }, this._toggleClearButton = (e = !1) => {
92
94
  this.showClearbutton = e;
93
95
  }, this.reposition = async () => {
94
- const { x: e, y: t } = await P(this.$anchor, this.$popover, {
96
+ const { x: e, y: t } = await T(this.$anchor, this.$popover, {
95
97
  placement: "bottom-start",
96
- middleware: [S(), E(0)],
98
+ middleware: [B(), x(0)],
97
99
  strategy: "fixed"
98
100
  });
99
101
  Object.assign(this.$popover.style, {
@@ -111,37 +113,34 @@ const _ = class _ extends C {
111
113
  return this.customError;
112
114
  }
113
115
  connectedCallback() {
114
- var e;
115
- super.connectedCallback(), this._init_date = (e = this.value) == null ? void 0 : e.split(",")[0], this.addEventListener("selected-date-changed", this._handleSelectedDate);
116
+ super.connectedCallback(), this._init_date = this.value?.split(",")[0], this.addEventListener("selected-date-changed", this._handleSelectedDate);
116
117
  }
117
118
  disconnectedCallback() {
118
119
  super.disconnectedCallback(), this.abortController.abort();
119
120
  }
120
121
  firstUpdated() {
121
- var e;
122
- this.$datepickerPopup.date = this._init_date ? w.PlainDate.from(this._init_date).toString() : w.Now.plainDateISO().toString(), this.range ? this.$datepickerPopup.selectedDateRange = {
122
+ this.$datepickerPopup.date = this._init_date ? I.PlainDate.from(this._init_date).toString() : I.Now.plainDateISO().toString(), this.range ? this.$datepickerPopup.selectedDateRange = {
123
123
  start: this._init_date ? new Date(this._init_date) : null,
124
- end: (e = this.value) != null && e.split(",")[1] ? new Date(this.value.split(",")[1]) : null
124
+ end: this.value?.split(",")[1] ? new Date(this.value.split(",")[1]) : null
125
125
  } : this.$datepickerPopup.selectedDate = this._init_date ? new Date(this._init_date) : void 0, this.hint && !this.hasAttribute("hint") && this.setAttribute("hint", this.hint), this.validateInput();
126
126
  }
127
- attributeChangedCallback(e, t, a) {
128
- if (super.attributeChangedCallback(e, t, a), e === "custom-invalid")
129
- if (typeof a == "string") {
130
- const n = this.withFallback(a);
131
- this._pristine = !1, this._internals.setValidity({ customError: !0 }, n), this.invalid = !0, this.hint = n, this.checkValidity();
127
+ attributeChangedCallback(e, t, i) {
128
+ if (super.attributeChangedCallback(e, t, i), e === "custom-invalid")
129
+ if (typeof i == "string") {
130
+ const p = this.withFallback(i);
131
+ this._pristine = !1, this._internals.setValidity({ customError: !0 }, p), this.invalid = !0, this.hint = p, this.checkValidity();
132
132
  } else
133
133
  this._internals.setValidity({}), this.validateInput();
134
134
  }
135
135
  _handleValueChange() {
136
- var e, t, a, o, n, d, p, i;
137
- (e = this.value) != null && e.trim() || this.$datepickerPopup.clearSelection(), this._internals.setFormValue(this.value ?? ""), this.validateInput(), this._pristine = !1, this.$input.value = v((t = this.value) == null ? void 0 : t.split(",")[0]), this.range ? (this.$datepickerPopup.selectedDateRange = {
138
- start: (n = this.value) != null && n.split(",")[0] ? new Date(this.value.split(",")[0]) : null,
139
- end: (d = this.value) != null && d.split(",")[1] ? new Date(this.value.split(",")[1]) : null
140
- }, this.$input_range_end.value = v((p = this.value) == null ? void 0 : p.split(",")[1]), this.$datepickerPopup.date = ((i = this.value) == null ? void 0 : i.split(",")[0]) ?? "") : (this.$datepickerPopup.selectedDate = (a = this.value) != null && a.split(",")[0] ? new Date(this.value.split(",")[0]) : void 0, this.$datepickerPopup.date = ((o = this.value) == null ? void 0 : o.split(",")[0]) ?? ""), this.validateInput();
136
+ this.value?.trim() || this.$datepickerPopup.clearSelection(), this._internals.setFormValue(this.value ?? ""), this.validateInput(), this._pristine = !1, this.$input.value = v(this.value?.split(",")[0]), this.range ? (this.$datepickerPopup.selectedDateRange = {
137
+ start: this.value?.split(",")[0] ? new Date(this.value.split(",")[0]) : null,
138
+ end: this.value?.split(",")[1] ? new Date(this.value.split(",")[1]) : null
139
+ }, this.$input_range_end.value = v(this.value?.split(",")[1]), this.$datepickerPopup.date = this.value?.split(",")[0] ?? "") : (this.$datepickerPopup.selectedDate = this.value?.split(",")[0] ? new Date(this.value.split(",")[0]) : void 0, this.$datepickerPopup.date = this.value?.split(",")[0] ?? ""), this.validateInput();
141
140
  }
142
141
  showPopover() {
143
- if (L(this.$popover)) return;
144
- R(() => {
142
+ if (Y(this.$popover)) return;
143
+ z(() => {
145
144
  this.$popover.showPopover(), this._animatePopover({ show: !0 });
146
145
  }, 200)(), this.addEventListener("focusout", this.hidePopover.bind(this), {
147
146
  once: !0,
@@ -149,8 +148,7 @@ const _ = class _ extends C {
149
148
  });
150
149
  }
151
150
  hidePopover() {
152
- var t;
153
- this.removeEventListener("focusout", this.hidePopover.bind(this)), ((t = document.activeElement) == null ? void 0 : t.closest("skf-datepicker-input")) !== this && this.$popover.hidePopover();
151
+ this.removeEventListener("focusout", this.hidePopover.bind(this)), document.activeElement?.closest("skf-datepicker-input") !== this && this.$popover.hidePopover();
154
152
  }
155
153
  /**
156
154
  * Clears the input field
@@ -160,21 +158,21 @@ const _ = class _ extends C {
160
158
  }
161
159
  /** @internal */
162
160
  async _animatePopover({ el: e = this.$popover, show: t }) {
163
- return t && (e.style.opacity = "0", e.style.transform = "scaleY(0.5)"), new Promise((a) => {
164
- const o = [
161
+ return t && (e.style.opacity = "0", e.style.transform = "scaleY(0.5)"), new Promise((i) => {
162
+ const h = [
165
163
  { opacity: 0, transform: "scaleY(0.5)" },
166
164
  { opacity: 1, transform: "scaleY(1)" }
167
- ], n = t ? o : o.reverse();
165
+ ], p = t ? h : h.reverse();
168
166
  setTimeout(
169
167
  () => {
170
168
  e.style.transformOrigin = "top";
171
- const d = this.$popover.animate(n, {
169
+ const _ = this.$popover.animate(p, {
172
170
  duration: 100,
173
171
  easing: "linear",
174
172
  fill: "both"
175
173
  });
176
- d.onfinish = () => {
177
- a();
174
+ _.onfinish = () => {
175
+ i();
178
176
  };
179
177
  },
180
178
  t ? 0 : 50
@@ -184,33 +182,33 @@ const _ = class _ extends C {
184
182
  /** @internal consider sharing this functionality with input */
185
183
  validateInput() {
186
184
  if (this._internals.validity.customError) return;
187
- let t = JSON.parse(JSON.stringify(this._internals.validity)), a = {};
185
+ let t = JSON.parse(JSON.stringify(this._internals.validity)), i = {};
188
186
  if (this.selectableFrom) {
189
- const { validityFragment: i, errorMessageFragment: l } = o(this);
190
- t = { ...t, ...i }, a = { ...a, ...l };
187
+ const { validityFragment: a, errorMessageFragment: n } = h(this);
188
+ t = { ...t, ...a }, i = { ...i, ...n };
191
189
  }
192
190
  if (this.selectableTo) {
193
- const { validityFragment: i, errorMessageFragment: l } = n(this);
194
- t = { ...t, ...i }, a = { ...a, ...l };
191
+ const { validityFragment: a, errorMessageFragment: n } = p(this);
192
+ t = { ...t, ...a }, i = { ...i, ...n };
195
193
  }
196
194
  if (this.range) {
197
- const { validityFragment: i, errorMessageFragment: l } = d(this);
198
- t = { ...t, ...i }, a = { ...a, ...l };
195
+ const { validityFragment: a, errorMessageFragment: n } = _(this);
196
+ t = { ...t, ...a }, i = { ...i, ...n };
199
197
  }
200
198
  if (this.required) {
201
- const { validityFragment: i, errorMessageFragment: l } = p(this);
202
- t = { ...t, ...i }, a = { ...a, ...l };
199
+ const { validityFragment: a, errorMessageFragment: n } = M(this);
200
+ t = { ...t, ...a }, i = { ...i, ...n };
203
201
  }
204
- if (t.valid = !Object.values(t).some((i) => i), this.invalid = !1, t.valid)
202
+ if (t.valid = !Object.values(t).some((a) => a), this.invalid = !1, t.valid)
205
203
  this._internals.setValidity({ customError: this._internals.validity.customError }), this.hint = this.getAttribute("hint") ?? "";
206
204
  else {
207
205
  this.invalid = !this._pristine && !t.valid;
208
- let i;
209
- for (i in t) {
210
- const l = `data-${i.toString()}`;
211
- if (t[i]) {
212
- this.validationError = i.toString();
213
- const c = this.hasAttribute(l) ? this.getAttribute(l) : a[i];
206
+ let a;
207
+ for (a in t) {
208
+ const n = `data-${a.toString()}`;
209
+ if (t[a]) {
210
+ this.validationError = a.toString();
211
+ const c = this.hasAttribute(n) ? this.getAttribute(n) : i[a];
214
212
  this._internals.setValidity(
215
213
  { [this.validationError]: !0, customError: this._internals.validity.customError },
216
214
  this.withFallback(c)
@@ -218,55 +216,54 @@ const _ = class _ extends C {
218
216
  }
219
217
  }
220
218
  }
221
- function o(i) {
222
- const l = { validityFragment: {}, errorMessageFragment: {} };
223
- if (!i.selectableFrom) return l;
224
- const c = new Date(i.selectableFrom);
225
- if (new Date(i.$input.value) < c) {
226
- const m = i.getAttribute("data-rangeunderflow") ?? `Date is out of range. Earliest selectable date is ${i.selectableFrom}.`;
219
+ function h(a) {
220
+ const n = { validityFragment: {}, errorMessageFragment: {} };
221
+ if (!a.selectableFrom) return n;
222
+ const c = new Date(a.selectableFrom);
223
+ if (new Date(a.$input.value) < c) {
224
+ const y = a.getAttribute("data-rangeunderflow") ?? `Date is out of range. Earliest selectable date is ${a.selectableFrom}.`;
227
225
  return {
228
226
  validityFragment: { rangeUnderflow: !0, valid: !1 },
229
- errorMessageFragment: { rangeUnderflow: m }
227
+ errorMessageFragment: { rangeUnderflow: y }
230
228
  };
231
229
  }
232
- return l;
230
+ return n;
233
231
  }
234
- function n(i) {
235
- const l = { validityFragment: {}, errorMessageFragment: {} };
236
- if (!i.selectableTo) return l;
237
- const c = new Date(i.selectableTo);
238
- if (new Date(i.$input.value) > c) {
239
- const m = i.getAttribute("data-rangeoverflow") ?? `Date is out of range. Latest selectable date is ${i.selectableTo}.`;
232
+ function p(a) {
233
+ const n = { validityFragment: {}, errorMessageFragment: {} };
234
+ if (!a.selectableTo) return n;
235
+ const c = new Date(a.selectableTo);
236
+ if (new Date(a.$input.value) > c) {
237
+ const y = a.getAttribute("data-rangeoverflow") ?? `Date is out of range. Latest selectable date is ${a.selectableTo}.`;
240
238
  return {
241
239
  validityFragment: { rangeOverflow: !0, valid: !1 },
242
- errorMessageFragment: { rangeOverflow: m }
240
+ errorMessageFragment: { rangeOverflow: y }
243
241
  };
244
242
  }
245
- return l;
243
+ return n;
246
244
  }
247
- function d(i) {
248
- const l = { validityFragment: {}, errorMessageFragment: {} }, c = new Date(i.$input.value);
249
- if (new Date(i.$input_range_end.value) < c) {
250
- const m = i.getAttribute("data-rangeunderflow") ?? "End date cannot be before start date";
245
+ function _(a) {
246
+ const n = { validityFragment: {}, errorMessageFragment: {} }, c = new Date(a.$input.value);
247
+ if (new Date(a.$input_range_end.value) < c) {
248
+ const y = a.getAttribute("data-rangeunderflow") ?? "End date cannot be before start date";
251
249
  return {
252
250
  validityFragment: { rangeUnderflow: !0, valid: !1 },
253
- errorMessageFragment: { rangeUnderflow: m }
251
+ errorMessageFragment: { rangeUnderflow: y }
254
252
  };
255
253
  }
256
- return l;
254
+ return n;
257
255
  }
258
- function p(i) {
259
- const l = { validityFragment: {}, errorMessageFragment: {} };
260
- return !i.$input.value || i.range && !i.$input_range_end.value ? {
256
+ function M(a) {
257
+ const n = { validityFragment: {}, errorMessageFragment: {} };
258
+ return !a.$input.value || a.range && !a.$input_range_end.value ? {
261
259
  validityFragment: { valueMissing: !0, valid: !1 },
262
260
  errorMessageFragment: { valueMissing: "This field is required" }
263
- } : l;
261
+ } : n;
264
262
  }
265
263
  }
266
264
  render() {
267
- var t, a, o, n, d, p, i, l;
268
- const e = (this._defaultSlot.length === 0 || !((a = (t = this._defaultSlot[0]) == null ? void 0 : t.textContent) != null && a.trim())) && !this.label;
269
- return y`
265
+ const e = (this._defaultSlot.length === 0 || !this._defaultSlot[0]?.textContent?.trim()) && !this.label;
266
+ return b`
270
267
  <div
271
268
  id="root"
272
269
  @mouseenter=${() => {
@@ -279,22 +276,22 @@ const _ = class _ extends C {
279
276
  <label>
280
277
  <div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${e} id="label">
281
278
  <slot>${this.label}</slot>
282
- ${this.required ? T(this.requiredLabel) : null}
279
+ ${this.required ? V(D(this, g).term("required")) : f}
283
280
  </div>
284
281
  <div id="input">
285
282
  <input
286
283
  ?disabled=${this.disabled}
287
284
  ?readonly=${this.readonly}
288
- .value=${F(
289
- this.range ? v((o = this.value) == null ? void 0 : o.split(",")[0]) : v(this.value)
285
+ .value=${O(
286
+ this.range ? v(this.value?.split(",")[0]) : v(this.value)
290
287
  )}
291
288
  @blur=${this._handleBlur}
292
289
  @click=${this._handleFocus}
293
290
  @focus=${this._handleFocus}
294
291
  @input=${this._handleInput}
295
292
  @keydown=${this._handleKeyboardEvents}
296
- aria-describedby=${u((n = this.hint) != null && n.trim() ? "hint" : g)}
297
- aria-errormessage=${u((d = this.hint) != null && d.trim() ? "hint" : g)}
293
+ aria-describedby=${u(this.hint?.trim() ? "hint" : f)}
294
+ aria-errormessage=${u(this.hint?.trim() ? "hint" : f)}
298
295
  aria-invalid=${!!this.invalid}
299
296
  autocomplete="off"
300
297
  data-testid="field-input"
@@ -304,19 +301,19 @@ const _ = class _ extends C {
304
301
  placeholder=${u(this.placeholder)}
305
302
  type="text"
306
303
  />
307
- ${this.range ? y`
304
+ ${this.range ? b`
308
305
  <skf-icon name="arrowRight"></skf-icon>
309
306
  <input
310
307
  ?disabled=${this.disabled}
311
308
  ?readonly=${this.readonly}
312
- .value=${F(v((p = this.value) == null ? void 0 : p.split(",")[1]))}
309
+ .value=${O(v(this.value?.split(",")[1]))}
313
310
  @blur=${this._handleBlur}
314
311
  @click=${this._handleFocus}
315
312
  @focus=${this._handleFocus}
316
313
  @input=${this._handleInput}
317
314
  @keydown=${this._handleKeyboardEvents}
318
- aria-describedby=${u((i = this.hint) != null && i.trim() ? "hint" : g)}
319
- aria-errormessage=${u((l = this.hint) != null && l.trim() ? "hint" : g)}
315
+ aria-describedby=${u(this.hint?.trim() ? "hint" : f)}
316
+ aria-errormessage=${u(this.hint?.trim() ? "hint" : f)}
320
317
  aria-invalid=${!!this.invalid}
321
318
  autocomplete="off"
322
319
  data-testid="field-input-range-end"
@@ -326,28 +323,29 @@ const _ = class _ extends C {
326
323
  placeholder=${u(this.placeholder)}
327
324
  type="text"
328
325
  />
329
- ` : g}
330
- ${this.showClearbutton ? y`
326
+ ` : f}
327
+ ${this.showClearbutton ? b`
331
328
  <button
329
+ aria-label=${D(this, g).term("close")}
332
330
  class="password skf-icon-host"
333
331
  type="button"
334
332
  @click=${this.clear.bind(this)}
335
333
  >
336
334
  <skf-icon name="close" size="sm"></skf-icon>
337
335
  </button>
338
- ` : y`
336
+ ` : b`
339
337
  <button class="password skf-icon-host" type="button">
340
338
  <skf-icon name="calendarMonth" size="sm"></skf-icon>
341
339
  </button>
342
340
  `}
343
341
  </div>
344
342
  </label>
345
- ${this.hint && y`
343
+ ${this.hint && b`
346
344
  <skf-hint
347
345
  ?disabled=${this.disabled}
348
346
  aria-live=${this.invalid ? "assertive" : "polite"}
349
347
  id="hint"
350
- severity=${u(O(this.invalid, this.severity))}
348
+ severity=${u(L(this.invalid, this.severity))}
351
349
  >${this.customInvalid ?? this.hint}
352
350
  </skf-hint>
353
351
  `}
@@ -358,6 +356,7 @@ const _ = class _ extends C {
358
356
  ?range=${this.range}
359
357
  id=${this.id}
360
358
  invalid-dates=${u(this.invalidDates)}
359
+ lang=${this.lang}
361
360
  selectable-from=${u(this.selectableFrom)}
362
361
  selectable-to=${u(this.selectableTo)}
363
362
  ></skf-datepicker-popup>
@@ -365,91 +364,91 @@ const _ = class _ extends C {
365
364
  `;
366
365
  }
367
366
  };
368
- _.styles = [B, A];
369
- let s = _;
367
+ g = new WeakMap(), w.styles = [q, W];
368
+ let s = w;
370
369
  r([
371
- h({ attribute: "custom-invalid", reflect: !0 })
370
+ d({ attribute: "custom-invalid", reflect: !0 })
372
371
  ], s.prototype, "customInvalid", 1);
373
372
  r([
374
- h({ type: String })
373
+ d({ type: String })
375
374
  ], s.prototype, "id", 2);
376
375
  r([
377
- h()
376
+ d()
378
377
  ], s.prototype, "label", 2);
379
378
  r([
380
- h({ type: Boolean, attribute: "hide-label" })
379
+ d({ type: String })
380
+ ], s.prototype, "lang", 2);
381
+ r([
382
+ d({ type: Boolean, attribute: "hide-label" })
381
383
  ], s.prototype, "hideLabel", 2);
382
384
  r([
383
- h()
385
+ d()
384
386
  ], s.prototype, "hint", 2);
385
387
  r([
386
- h({ attribute: "invalid-dates" })
388
+ d({ attribute: "invalid-dates" })
387
389
  ], s.prototype, "invalidDates", 2);
388
390
  r([
389
- h({ reflect: !0 })
391
+ d({ reflect: !0 })
390
392
  ], s.prototype, "name", 2);
391
393
  r([
392
- h()
394
+ d()
393
395
  ], s.prototype, "placeholder", 2);
394
396
  r([
395
- h({ type: Boolean })
397
+ d({ type: Boolean })
396
398
  ], s.prototype, "range", 2);
397
399
  r([
398
- h({ type: Boolean })
400
+ d({ type: Boolean })
399
401
  ], s.prototype, "readonly", 2);
400
402
  r([
401
- h({ attribute: "required-label" })
402
- ], s.prototype, "requiredLabel", 2);
403
- r([
404
- h({ attribute: "selectable-from" })
403
+ d({ attribute: "selectable-from" })
405
404
  ], s.prototype, "selectableFrom", 2);
406
405
  r([
407
- h({ attribute: "selectable-to" })
406
+ d({ attribute: "selectable-to" })
408
407
  ], s.prototype, "selectableTo", 2);
409
408
  r([
410
- h({ reflect: !0 })
409
+ d({ reflect: !0 })
411
410
  ], s.prototype, "severity", 2);
412
411
  r([
413
- h({ reflect: !0 })
412
+ d({ reflect: !0 })
414
413
  ], s.prototype, "size", 2);
415
414
  r([
416
- h({ type: String, attribute: "validate-on" })
415
+ d({ type: String, attribute: "validate-on" })
417
416
  ], s.prototype, "validateOn", 2);
418
417
  r([
419
- h()
418
+ d()
420
419
  ], s.prototype, "value", 2);
421
420
  r([
422
- $()
421
+ k()
423
422
  ], s.prototype, "_init_date", 2);
424
423
  r([
425
- h({ type: Boolean, reflect: !0 })
424
+ d({ type: Boolean, reflect: !0 })
426
425
  ], s.prototype, "invalid", 2);
427
426
  r([
428
- $()
427
+ k()
429
428
  ], s.prototype, "selectedRangeDates", 2);
430
429
  r([
431
- $()
430
+ k()
432
431
  ], s.prototype, "showClearbutton", 2);
433
432
  r([
434
- b("#popover")
433
+ $("#popover")
435
434
  ], s.prototype, "$popover", 2);
436
435
  r([
437
- b("#input")
436
+ $("#input")
438
437
  ], s.prototype, "$anchor", 2);
439
438
  r([
440
- b('input[data-testid="field-input"]')
439
+ $('input[data-testid="field-input"]')
441
440
  ], s.prototype, "$input", 2);
442
441
  r([
443
- b('input[data-testid="field-input-range-end"]')
442
+ $('input[data-testid="field-input-range-end"]')
444
443
  ], s.prototype, "$input_range_end", 2);
445
444
  r([
446
- b("skf-datepicker-popup")
445
+ $("skf-datepicker-popup")
447
446
  ], s.prototype, "$datepickerPopup", 2);
448
447
  r([
449
- x({ flatten: !0 })
448
+ N({ flatten: !0 })
450
449
  ], s.prototype, "_defaultSlot", 2);
451
450
  r([
452
- M("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
451
+ j("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
453
452
  ], s.prototype, "_handleValueChange", 1);
454
453
  export {
455
454
  s as SkfDatepicker
@@ -2,6 +2,7 @@ import '../button/button.js';
2
2
  import '../heading/heading.js';
3
3
  import '../icon/icon.js';
4
4
  import { SkfElement } from '../../internal/components/skf-element';
5
+ import { type Language } from '../../utilities/localize.js';
5
6
  import { type CSSResultGroup } from 'lit';
6
7
  /**
7
8
  * The `<skf-dialog>` is a component that open up a dialog of type modal with the content provided. (MDN refrains from opening the dialog using the `open` attribute, however skf-dialog does not have that limitation)
@@ -23,12 +24,12 @@ import { type CSSResultGroup } from 'lit';
23
24
  export declare class SkfDialog extends SkfElement {
24
25
  #private;
25
26
  static styles: CSSResultGroup;
26
- /** If defined, sets the aria-label for the close button */
27
- closeButtonAriaLabel?: string;
28
27
  /** Title for the modal/dialog */
29
28
  heading?: string;
30
29
  /** If true, makes the dialog stretch edge to edge on screen */
31
30
  fullscreen: boolean;
31
+ /** Sets the internal language of the component */
32
+ lang: Language;
32
33
  /** If true, removes the close button */
33
34
  noCloseButton?: boolean | undefined;
34
35
  /** If defined, removes the inner padding */