@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
@@ -0,0 +1,272 @@
1
+ var v = (s) => {
2
+ throw TypeError(s);
3
+ };
4
+ var R = (s, i, e) => i.has(s) || v("Cannot " + e);
5
+ var b = (s, i, e) => (R(s, i, "read from private field"), e ? e.call(s) : i.get(s)), S = (s, i, e) => i.has(s) ? v("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, e), $ = (s, i, e, a) => (R(s, i, "write to private field"), a ? a.call(s, e) : i.set(s, e), e);
6
+ import "../button/button.js";
7
+ import { SkfElement as E } from "../../internal/components/skf-element.js";
8
+ import { watch as y } from "../../internal/helpers/watch.js";
9
+ import { componentStyles as F } from "../../styles/component.styles.js";
10
+ import { LocalizeController as M } from "../../utilities/localize.js";
11
+ import { html as m } from "lit";
12
+ import { property as o, state as u } from "lit/decorators.js";
13
+ import "./datepicker-calendar.js";
14
+ import { getDateParts as f, assertISODate as O, earliestDate as V, latestDate as P, compareDates as g, doAnimate as C } from "./datepicker-popup.helpers.js";
15
+ import { styles as L } from "./datepicker-popup.styles.js";
16
+ import { dateFormatter as d, is as Y } from "./datepicker.helpers.js";
17
+ var x = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (s, i, e, a) => {
18
+ for (var t = a > 1 ? void 0 : a ? A(i, e) : i, r = s.length - 1, h; r >= 0; r--)
19
+ (h = s[r]) && (t = (a ? h(i, e, t) : h(t)) || t);
20
+ return a && t && x(i, e, t), t;
21
+ }, D;
22
+ const _ = class _ extends E {
23
+ constructor() {
24
+ super(...arguments);
25
+ S(this, D);
26
+ $(this, D, new M(this)), this.locale = "en-CA", this.date = (/* @__PURE__ */ new Date()).toLocaleDateString(this.locale), this.id = "", this.lang = "en", this.range = !1, this.selectedDate = void 0, this.selectedDateRange = {
27
+ start: null,
28
+ end: null
29
+ }, this._datePlusOneMonth = new Date(
30
+ new Date(this.date).getFullYear(),
31
+ new Date(this.date).getMonth() + 1,
32
+ 1
33
+ ), this._handleCalendarView = (e) => {
34
+ this._handleChangeCalendarView(e.detail);
35
+ }, this._handleSelectedDate = (e) => {
36
+ if (this.selectedDate = e.detail.date, console.log("selectedDate", this.selectedDate), this.range) {
37
+ const a = this.shadowRoot?.querySelectorAll("skf-datepicker-calendar"), t = this.selectedDateRange, r = t.start && this.selectedDate < t.start;
38
+ if (!!(t.start && t.end) || r)
39
+ this.selectedDateRange = {
40
+ start: this.selectedDate,
41
+ end: null
42
+ };
43
+ else {
44
+ const p = !!t.start ? { end: e.detail.date } : { start: e.detail.date };
45
+ this.selectedDateRange = {
46
+ ...t,
47
+ ...p
48
+ };
49
+ }
50
+ this._onRangeCompleteEmitEvent(), a?.length && [...a].forEach((c) => {
51
+ c.selectedDateRange = this.selectedDateRange;
52
+ });
53
+ }
54
+ this.emit("skf-datepicker-selected", {
55
+ detail: { date: this.range ? this.selectedDateRange : this.selectedDate }
56
+ }), this.requestUpdate();
57
+ }, this._handleTodayClick = () => {
58
+ const { month: e, year: a } = f(), { month: t, year: r } = f(this.date);
59
+ if (t === e && r === a && (this.selectedDateRange.start || this.selectedDate)) {
60
+ this.date = d(this.selectedDateRange.start ?? this.selectedDate), this.emit("skf-update-calendar-view", {
61
+ detail: this.date
62
+ });
63
+ return;
64
+ }
65
+ if (this.range) {
66
+ this.emit("skf-update-calendar-view", {
67
+ detail: d(/* @__PURE__ */ new Date())
68
+ });
69
+ return;
70
+ }
71
+ this.date = d(/* @__PURE__ */ new Date());
72
+ };
73
+ }
74
+ connectedCallback() {
75
+ super.connectedCallback(), this.addEventListener("skf-update-calendar-view", this._handleCalendarView), this.addEventListener("selected-date-changed", this._handleSelectedDate);
76
+ }
77
+ firstUpdated() {
78
+ (this.selectedDateRange.start ?? this.selectedDate) && this._onRangeCompleteEmitEvent();
79
+ const a = this.selectedDate ?? this.selectedDateRange.start;
80
+ a instanceof Date && this.gotoDate(a);
81
+ }
82
+ clearSelection() {
83
+ this.selectedDateRange = {
84
+ start: null,
85
+ end: null
86
+ }, this.selectedDate = void 0;
87
+ }
88
+ /** @internal */
89
+ _onRangeCompleteEmitEvent() {
90
+ if (!this.selectedDateRange.start || !this.selectedDateRange.end) return;
91
+ const e = Math.abs(
92
+ this.selectedDateRange.end.getTime() - this.selectedDateRange.start.getTime()
93
+ ), a = Math.ceil(e / (1e3 * 60 * 60 * 24)) + 1;
94
+ this.emit("selected-date-range-changed", {
95
+ detail: {
96
+ ...this.selectedDateRange,
97
+ days: a,
98
+ id: this.id
99
+ }
100
+ });
101
+ }
102
+ _handleRangeChange() {
103
+ this.style.setProperty("--max-width", this.range ? "43em" : "21em");
104
+ }
105
+ _handleDateChange() {
106
+ console.log("%cdate changed", "color:red", this.date), this.date = this.date && O(this.date) ? this.date : d(/* @__PURE__ */ new Date()), this.date = V(
107
+ P(this.date, this.selectableFrom ?? this.date),
108
+ this.selectableTo ?? this.date
109
+ ), this._date = new Date(this.date), this._datePlusOneMonth = new Date(this._date.getFullYear(), this._date.getMonth() + 1, 1);
110
+ }
111
+ _handleSelectedDateRangeChange() {
112
+ }
113
+ _handleSelectedDateChange() {
114
+ console.log("selected date changed", this.selectedDate);
115
+ }
116
+ /**
117
+ * Navigates to the given date.
118
+ * @param date - The date to navigate to, either a Date object or a string in the format 'yyyy-mm-dd'
119
+ */
120
+ gotoDate(e) {
121
+ if (e instanceof Date)
122
+ this.date = d(e);
123
+ else if (Y(e).dateISO())
124
+ this.date = e;
125
+ else
126
+ throw new Error("Invalid date format");
127
+ this.emit("skf-update-calendar-view", {
128
+ detail: e
129
+ });
130
+ }
131
+ render() {
132
+ return m`
133
+ <div class="calendar-container">
134
+ <skf-datepicker-calendar
135
+ .date=${this._date ?? /* @__PURE__ */ new Date()}
136
+ .eventid="${this.id}"
137
+ .range=${this.range}
138
+ .selectedDate=${this.selectedDate}
139
+ .selectedDateRange=${this.selectedDateRange}
140
+ .selectableFrom=${this.selectableFrom}
141
+ .selectableTo=${this.selectableTo}
142
+ .invalidDates=${this.invalidDates}
143
+ class="start"
144
+ id=${this.id}
145
+ lang="${this.lang}"
146
+ locale="${this.locale}"
147
+ ></skf-datepicker-calendar>
148
+ <skf-datepicker-calendar
149
+ ?hidden=${!this.range}
150
+ .date=${this._datePlusOneMonth}
151
+ .eventid="${this.id}"
152
+ .range=${!0}
153
+ .selectedDate="${this.selectedDate}"
154
+ .selectedDateRange=${this.selectedDateRange}
155
+ .selectableFrom=${this.selectableFrom}
156
+ .selectableTo=${this.selectableTo}
157
+ .invalidDates=${this.invalidDates}
158
+ class="end"
159
+ id=${`${this.id}-range-end`}
160
+ locale="${this.locale}"
161
+ ></skf-datepicker-calendar>
162
+ </div>
163
+ ${this._renderTodayBtn()}
164
+ <slot></slot>
165
+ <div class="triangle"></div>
166
+ `;
167
+ }
168
+ /** @internal */
169
+ _renderTodayBtn() {
170
+ let e = !1;
171
+ if (this.selectableTo && g(this.selectableTo, d(/* @__PURE__ */ new Date())) === -1)
172
+ return m``;
173
+ if (this.selectableFrom && g(this.selectableFrom, d(/* @__PURE__ */ new Date())) === 1)
174
+ return m``;
175
+ const { month: a, year: t } = f(), { month: r, year: h } = f(this.date), c = this.selectedDate ?? this.selectedDateRange.start, p = a === r && t === h, T = c && g(d(/* @__PURE__ */ new Date()), d(c), "months") === 0;
176
+ return (p && !c || T && p) && (e = !0), m`
177
+ <div class="today">
178
+ <skf-button
179
+ @click=${this._handleTodayClick}
180
+ ?disabled=${e}
181
+ variant="tertiary"
182
+ size="sm"
183
+ >
184
+ ${k(this.date) && (this.selectedDate || this.selectedDateRange.start) && !e ? b(this, D).term("selectedDay") : b(this, D).term("today")}
185
+ </skf-button>
186
+ </div>
187
+ `;
188
+ function k(w) {
189
+ return g(w, d(/* @__PURE__ */ new Date()), "months") === 0;
190
+ }
191
+ }
192
+ /** @internal */
193
+ _handleChangeCalendarView(e) {
194
+ const a = g(this.date, e);
195
+ this._animateView(a, () => {
196
+ this.date = e;
197
+ }).then(() => {
198
+ }).catch((t) => {
199
+ console.error(t);
200
+ });
201
+ }
202
+ /** @internal */
203
+ async _animateView(e, a) {
204
+ if (!this.shadowRoot) return;
205
+ const t = [...this.shadowRoot.querySelectorAll("skf-datepicker-calendar")];
206
+ return t.length ? (await C(
207
+ t,
208
+ [{ opacity: 0, transform: `translateX(calc(16px * ${e.toString()}))` }],
209
+ { duration: 100, easing: "ease-in", fill: "backwards" }
210
+ ), a(), await C(
211
+ t,
212
+ [
213
+ { opacity: 0, transform: `translateX(${(-16 * e).toString()}px)` },
214
+ { opacity: 1, transform: "translateX(0)" }
215
+ ],
216
+ { duration: 100, easing: "ease-out", fill: "backwards" }
217
+ )) : Promise.resolve();
218
+ }
219
+ };
220
+ D = new WeakMap(), _.styles = [F, L];
221
+ let n = _;
222
+ l([
223
+ o({ reflect: !0 })
224
+ ], n.prototype, "locale", 2);
225
+ l([
226
+ o({ type: String, reflect: !0 })
227
+ ], n.prototype, "date", 2);
228
+ l([
229
+ o({ type: String })
230
+ ], n.prototype, "id", 2);
231
+ l([
232
+ o({ attribute: "invalid-dates" })
233
+ ], n.prototype, "invalidDates", 2);
234
+ l([
235
+ o({ type: String })
236
+ ], n.prototype, "lang", 2);
237
+ l([
238
+ o({ type: Boolean })
239
+ ], n.prototype, "range", 2);
240
+ l([
241
+ u()
242
+ ], n.prototype, "selectedDate", 2);
243
+ l([
244
+ o({ attribute: "selectable-from" })
245
+ ], n.prototype, "selectableFrom", 2);
246
+ l([
247
+ o({ attribute: "selectable-to" })
248
+ ], n.prototype, "selectableTo", 2);
249
+ l([
250
+ u()
251
+ ], n.prototype, "selectedDateRange", 2);
252
+ l([
253
+ u()
254
+ ], n.prototype, "_date", 2);
255
+ l([
256
+ u()
257
+ ], n.prototype, "_datePlusOneMonth", 2);
258
+ l([
259
+ y("range")
260
+ ], n.prototype, "_handleRangeChange", 1);
261
+ l([
262
+ y("date")
263
+ ], n.prototype, "_handleDateChange", 1);
264
+ l([
265
+ y("selectedDateRange")
266
+ ], n.prototype, "_handleSelectedDateRangeChange", 1);
267
+ l([
268
+ y("selectedDate")
269
+ ], n.prototype, "_handleSelectedDateChange", 1);
270
+ export {
271
+ n as SkfDatepickerPopup
272
+ };
@@ -0,0 +1,8 @@
1
+ import { SkfDatepickerPopup } from './datepicker-popup.component.js';
2
+ export * from './datepicker-popup.component.js';
3
+ export default SkfDatepickerPopup;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'skf-datepicker-popup': SkfDatepickerPopup;
7
+ }
8
+ }
@@ -22,12 +22,12 @@ export declare function getDateParts(date?: undefined | string | Date | Temporal
22
22
  */
23
23
  export declare function compareDates(dateOne: Temporal.PlainDate | string, dateTwo: Temporal.PlainDate | string, granularity?: 'days' | 'months' | 'years'): 0 | 1 | -1;
24
24
  /**
25
- * @param dateOne - first date to compare as string
26
- * @param dateTwo - second date to compare as string
25
+ * @param dateOne - first date to compare as string (accepts Date and Temporal.PlainDate too)
26
+ * @param dateTwo - second date to compare as string (accepts Date and Temporal.PlainDate too)
27
27
  * @param unit - the unit to compare the dates by [days, months, years]
28
28
  * @returns the difference between the two dates in the specified unit
29
29
  */
30
- export declare function timeBetween(dateOne: Temporal.PlainDate | string, dateTwo: Temporal.PlainDate | string, unit?: 'days' | 'months' | 'years'): number;
30
+ export declare function timeBetween(dateOne: Temporal.PlainDate | Date | string, dateTwo: Temporal.PlainDate | Date | string, unit?: 'days' | 'months' | 'years'): number;
31
31
  /**
32
32
  * @param dates - a list of dates to compare
33
33
  * @returns - the earliest date of the list
@@ -0,0 +1,83 @@
1
+ import { Temporal as a } from "@js-temporal/polyfill";
2
+ import { is as c } from "./datepicker.helpers.js";
3
+ function I(t, n, i) {
4
+ const s = (o) => Array.isArray(o) ? o : [o], r = s(t);
5
+ n = s(n);
6
+ const l = [];
7
+ for (const o of r) {
8
+ const { promise: e, resolve: m, reject: p } = Promise.withResolvers(), f = o.animate(n, {
9
+ fill: "forwards",
10
+ duration: 300,
11
+ iterations: 1,
12
+ ...i
13
+ });
14
+ f.onfinish = () => m("finished"), f.oncancel = () => p("canceled"), l.push(e);
15
+ }
16
+ return Promise.allSettled(l);
17
+ }
18
+ function P(t = a.Now.plainDateISO()) {
19
+ return t ??= a.Now.plainDateISO(), t instanceof Date && (t = a.PlainDate.from(t.toISOString())), typeof t == "string" && (t = a.PlainDate.from(g(t, !0))), {
20
+ year: t.year,
21
+ month: t.month - 1,
22
+ // new Date is 0 based
23
+ day: t.day
24
+ };
25
+ }
26
+ function v(t, n, i = "days") {
27
+ console.assert(c(t, n).plainISO(), "Invalid dates passed to compareDates()"), typeof t == "string" && (t = a.PlainDate.from(t)), typeof n == "string" && (n = a.PlainDate.from(n)), console.assert(
28
+ c(t, n).plain(),
29
+ `Invalid date was sent to helper function compareDates(). Got ${JSON.stringify(t)} and ${JSON.stringify(n)} passed in`
30
+ );
31
+ const s = u(t, n, i);
32
+ return r(s);
33
+ function r(l) {
34
+ return Math.max(-1, Math.min(l, 1));
35
+ }
36
+ }
37
+ function u(t, n, i = "days") {
38
+ if (t = s(t), n = s(n), console.assert(
39
+ t instanceof a.PlainDate && n instanceof a.PlainDate,
40
+ `Invalid date was sent to helper function timeBetween(). Got ${JSON.stringify(t)} and ${JSON.stringify(n)} passed in`
41
+ ), i === "months")
42
+ return n.until(t, { largestUnit: "months" }).months;
43
+ if (i === "years")
44
+ return n.until(t, { largestUnit: "years" }).years;
45
+ return n.until(t, { largestUnit: "days" }).days;
46
+ function s(r) {
47
+ return r instanceof Date ? a.PlainDate.from(r.toISOString().split("T")[0]) : typeof r == "string" ? a.PlainDate.from(r.includes("T") ? r.split("T")[0] : r) : r;
48
+ }
49
+ }
50
+ function D(...t) {
51
+ if (t.length === 0)
52
+ throw new Error("At least one date must be provided");
53
+ const n = (e) => e instanceof Date, i = t.map((e) => n(e) ? e : new Date(e));
54
+ if (i.length === 1)
55
+ return i[0].toISOString().split("T")[0];
56
+ const [s, ...r] = i, l = D(...r), o = new Date(l);
57
+ return s < o ? s.toISOString().split("T")[0] : o.toISOString().split("T")[0];
58
+ }
59
+ function S(...t) {
60
+ if (t.length === 0)
61
+ throw new Error("At least one date must be provided");
62
+ const n = (e) => e instanceof Date, i = t.map((e) => n(e) ? e : new Date(e));
63
+ if (i.length === 1)
64
+ return i[0].toISOString().split("T")[0];
65
+ const [s, ...r] = i, l = S(...r), o = new Date(l);
66
+ return s > o ? s.toISOString().split("T")[0] : o.toISOString().split("T")[0];
67
+ }
68
+ function g(t, n = !1) {
69
+ t instanceof Date && (t = a.PlainDate.from(t.toISOString().split("T")[0])), typeof t != "string" && (t = t.toString());
70
+ const i = /^\d{4}-\d{2}-\d{2}$/;
71
+ if (!i.test(t) && n)
72
+ throw new Error(`Invalid date format. Got ${t} passed in.`);
73
+ return i.test(t) ? t : "";
74
+ }
75
+ export {
76
+ g as assertISODate,
77
+ v as compareDates,
78
+ I as doAnimate,
79
+ D as earliestDate,
80
+ P as getDateParts,
81
+ S as latestDate,
82
+ u as timeBetween
83
+ };
@@ -0,0 +1,6 @@
1
+ import { SkfDatepickerPopup as p } from "./datepicker-popup.component.js";
2
+ p.define("skf-datepicker-popup");
3
+ export {
4
+ p as SkfDatepickerPopup,
5
+ p as default
6
+ };
@@ -1,5 +1,5 @@
1
1
  import { css as r } from "lit";
2
- const a = r`
2
+ const e = r`
3
3
  @layer components {
4
4
  :host {
5
5
  --max-width: 21em;
@@ -8,7 +8,7 @@ const a = r`
8
8
  background-color: var(--skf-bg-color-neutral-1);
9
9
  border: solid 1px var(--skf-border-color-primary);
10
10
  border-radius: 3px;
11
- box-shadow: 0 0 10px rgba(0 0 0 / 30%);
11
+ box-shadow: 0 0 10px rgb(0 0 0 / 30%);
12
12
  box-sizing: border-box;
13
13
  display: block;
14
14
  font-family: Helvetica, sans-serif;
@@ -83,5 +83,5 @@ const a = r`
83
83
  }
84
84
  `;
85
85
  export {
86
- a as styles
86
+ e as styles
87
87
  };
@@ -3,10 +3,15 @@ import { FormBase } from '../../internal/components/formBase.js';
3
3
  import '../../internal/components/hint/hint.js';
4
4
  import { PopoverController } from '../../internal/controllers/popover.controller.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
- import '../date-picker/datepicker.js';
8
- import type { SkfDatePicker, SkfDatePickerDateRange } from '../date-picker/datepicker.js';
9
- export declare class SkfDatePickerInput extends FormBase {
8
+ import type { SkfDatepickerPopup, SkfDatepickerPopupDateRange } from './datepicker-popup.component.js';
9
+ import './datepicker-popup.js';
10
+ /**
11
+ * @tagname skf-datepicker
12
+ */
13
+ export declare class SkfDatepicker extends FormBase {
14
+ #private;
10
15
  /** @internal */
11
16
  static styles: CSSResultGroup;
12
17
  /** @inernal */
@@ -21,6 +26,8 @@ export declare class SkfDatePickerInput extends FormBase {
21
26
  id: string;
22
27
  /** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
23
28
  label?: string;
29
+ /** Sets the internal language of the component */
30
+ lang: Language;
24
31
  /** If true, hides the label visually */
25
32
  hideLabel?: boolean;
26
33
  /** If defined, displays informational text below the field */
@@ -35,8 +42,6 @@ export declare class SkfDatePickerInput extends FormBase {
35
42
  range: boolean;
36
43
  /** If true, makes the element not mutable, meaning the user can not edit the control */
37
44
  readonly?: boolean;
38
- /** If defined, renders an alternative A11y text for the asterisk */
39
- requiredLabel?: string;
40
45
  /**
41
46
  * Earliest selectable date. (yyyy-mm-dd format)
42
47
  */
@@ -61,7 +66,7 @@ export declare class SkfDatePickerInput extends FormBase {
61
66
  /** true if the internal state is invalid */
62
67
  invalid: boolean;
63
68
  /** @internal */
64
- selectedRangeDates: SkfDatePickerDateRange;
69
+ selectedRangeDates: SkfDatepickerPopupDateRange;
65
70
  /** @internal */
66
71
  private showClearbutton;
67
72
  /** @internal */
@@ -73,35 +78,37 @@ export declare class SkfDatePickerInput extends FormBase {
73
78
  /** @internal */
74
79
  $input_range_end: HTMLInputElement;
75
80
  /** @internal */
76
- $datepicker: SkfDatePicker;
81
+ $datepickerPopup: SkfDatepickerPopup;
77
82
  /** @internal */
78
83
  _defaultSlot: Node[];
79
- abortController: AbortController;
80
- abortSignal: AbortSignal;
84
+ /** @internal */
85
+ private abortController;
86
+ /** @internal */
87
+ private abortSignal;
81
88
  constructor();
82
89
  connectedCallback(): void;
83
90
  disconnectedCallback(): void;
84
- _handleSelectedDate: () => void;
91
+ private _handleSelectedDate;
85
92
  protected firstUpdated(): void;
86
93
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
94
+ _handleValueChange(): void;
87
95
  private _handleDateSelected;
88
96
  /** @internal */
89
97
  _handleKeyboardEvents: (e: KeyboardEvent) => void;
90
98
  /** @internal */
91
99
  private _handleFocus;
92
- showPopover: () => void;
93
- hidePopover: () => void;
100
+ showPopover(): void;
101
+ hidePopover(): void;
94
102
  /** @internal */
95
103
  _handleBlur: (event: FocusEvent) => void;
96
104
  /** @internal */
97
105
  private _handleClose;
98
106
  /** @internal */
99
107
  private clearInput;
100
- _handleValueChange(): void;
101
108
  /**
102
109
  * Clears the input field
103
110
  */
104
- clear: () => void;
111
+ clear(): void;
105
112
  /** @internal although called on input its only triggered once value is valid date */
106
113
  _handleInput: (event: Event) => void;
107
114
  /** @internal */