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

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 (186) hide show
  1. package/README.md +1 -18
  2. package/dist/components/accordion/accordion.component.d.ts +4 -4
  3. package/dist/components/accordion/accordion.component.js +8 -8
  4. package/dist/components/alert/alert.component.d.ts +8 -9
  5. package/dist/components/alert/alert.component.js +7 -7
  6. package/dist/components/breadcrumb/breadcrumb.component.d.ts +1 -1
  7. package/dist/components/card/card.component.js +18 -30
  8. package/dist/components/card/card.styles.js +25 -28
  9. package/dist/components/checkbox/checkbox.component.d.ts +8 -8
  10. package/dist/components/checkbox/checkbox.component.js +3 -3
  11. package/dist/components/collapse/collapse.component.js +1 -1
  12. package/dist/components/date-picker/datepicker.calendar.component.d.ts +5 -0
  13. package/dist/components/date-picker/datepicker.calendar.component.js +128 -95
  14. package/dist/components/date-picker/datepicker.calendar.styles.js +35 -25
  15. package/dist/components/date-picker/datepicker.component.d.ts +5 -0
  16. package/dist/components/date-picker/datepicker.component.js +117 -97
  17. package/dist/components/date-picker/datepicker.helpers.d.ts +3 -2
  18. package/dist/components/date-picker/datepicker.helpers.js +46 -39
  19. package/dist/components/date-picker/datepicker.styles.js +14 -26
  20. package/dist/components/date-picker-input/datepicker-input.component.d.ts +13 -5
  21. package/dist/components/date-picker-input/datepicker-input.component.js +263 -219
  22. package/dist/components/date-picker-input/datepicker-input.helpers.d.ts +36 -2
  23. package/dist/components/date-picker-input/datepicker-input.helpers.js +25 -23
  24. package/dist/components/date-picker-input/datepicker-input.styles.js +6 -10
  25. package/dist/components/dialog/dialog.component.d.ts +18 -28
  26. package/dist/components/dialog/dialog.component.js +89 -79
  27. package/dist/components/divider/divider.component.d.ts +4 -8
  28. package/dist/components/divider/divider.component.js +24 -46
  29. package/dist/components/divider/divider.styles.js +34 -30
  30. package/dist/components/drawer/drawer.component.d.ts +57 -0
  31. package/dist/components/drawer/drawer.component.js +124 -0
  32. package/dist/components/drawer/drawer.d.ts +8 -0
  33. package/dist/components/drawer/drawer.js +6 -0
  34. package/dist/components/drawer/drawer.styles.d.ts +1 -0
  35. package/dist/components/drawer/drawer.styles.js +71 -0
  36. package/dist/components/header/header.component.d.ts +45 -0
  37. package/dist/components/header/header.component.js +110 -0
  38. package/dist/components/header/header.d.ts +8 -0
  39. package/dist/components/header/header.js +6 -0
  40. package/dist/components/header/header.styles.d.ts +1 -0
  41. package/dist/components/header/header.styles.js +68 -0
  42. package/dist/components/heading/heading.component.d.ts +6 -12
  43. package/dist/components/heading/heading.component.js +11 -11
  44. package/dist/components/heading/heading.styles.d.ts +1 -2
  45. package/dist/components/heading/heading.styles.js +1 -1
  46. package/dist/components/icon/icon.component.d.ts +1 -1
  47. package/dist/components/input/input.component.d.ts +2 -2
  48. package/dist/components/input/input.component.js +3 -3
  49. package/dist/components/input/input.controllers.d.ts +20 -6
  50. package/dist/components/input/input.controllers.js +14 -10
  51. package/dist/components/link/link.component.js +1 -0
  52. package/dist/components/link/link.styles.js +24 -20
  53. package/dist/components/menu/menu.component.d.ts +4 -5
  54. package/dist/components/menu/menu.component.js +1 -1
  55. package/dist/components/nav/nav.component.d.ts +17 -0
  56. package/dist/components/nav/nav.component.js +34 -0
  57. package/dist/components/nav/nav.d.ts +8 -0
  58. package/dist/components/nav/nav.js +6 -0
  59. package/dist/components/nav/nav.styles.d.ts +1 -0
  60. package/dist/components/nav/nav.styles.js +17 -0
  61. package/dist/components/nav-item/nav-item.component.d.ts +20 -0
  62. package/dist/components/nav-item/nav-item.component.js +38 -0
  63. package/dist/components/nav-item/nav-item.d.ts +8 -0
  64. package/dist/components/nav-item/nav-item.js +6 -0
  65. package/dist/components/nav-item/nav-item.styles.d.ts +1 -0
  66. package/dist/components/nav-item/nav-item.styles.js +39 -0
  67. package/dist/components/popover/popover.component.d.ts +5 -6
  68. package/dist/components/popover/popover.component.js +19 -19
  69. package/dist/components/radio/radio.component.d.ts +10 -6
  70. package/dist/components/radio/radio.component.js +10 -10
  71. package/dist/components/radio/radio.styles.d.ts +1 -2
  72. package/dist/components/radio/radio.styles.js +1 -1
  73. package/dist/components/segmented-button/segmented-button.component.d.ts +32 -0
  74. package/dist/components/segmented-button/segmented-button.d.ts +8 -0
  75. package/dist/components/segmented-button/segmented-button.styles.d.ts +1 -0
  76. package/dist/components/segmented-button-item/segmented-button-item.component.d.ts +36 -0
  77. package/dist/components/segmented-button-item/segmented-button-item.d.ts +8 -0
  78. package/dist/components/segmented-button-item/segmented-button-item.styles.d.ts +1 -0
  79. package/dist/components/select/select.component.js +2 -2
  80. package/dist/components/select/select.controllers.d.ts +20 -9
  81. package/dist/components/select/select.controllers.js +27 -22
  82. package/dist/components/select-option/select-option.controllers.d.ts +11 -5
  83. package/dist/components/stepper/stepper.component.d.ts +2 -1
  84. package/dist/components/stepper-item/stepper-item.component.js +2 -2
  85. package/dist/components/switch/switch.component.d.ts +7 -6
  86. package/dist/components/switch/switch.component.js +7 -7
  87. package/dist/components/tag/tag.component.d.ts +4 -2
  88. package/dist/components/tag/tag.component.js +6 -6
  89. package/dist/components/textarea/textarea.component.js +7 -7
  90. package/dist/components/toast/toast.component.d.ts +1 -1
  91. package/dist/components/tooltip/tooltip.component.d.ts +5 -6
  92. package/dist/components/tooltip/tooltip.component.js +11 -11
  93. package/dist/custom-elements.json +2477 -1745
  94. package/dist/index.d.ts +4 -0
  95. package/dist/index.js +82 -70
  96. package/dist/internal/base-classes/popover/popover.base.d.ts +17 -7
  97. package/dist/internal/base-classes/popover/popover.base.js +119 -75
  98. package/dist/internal/base-classes/popover/popover.styles.js +14 -1
  99. package/dist/internal/controllers/elementOverflowController.d.ts +13 -0
  100. package/dist/internal/controllers/popover.controller.d.ts +12 -7
  101. package/dist/internal/controllers/popover.controller.js +9 -14
  102. package/dist/internal/helpers/utilityTypes.d.ts +1 -1
  103. package/dist/internal/helpers/uuid.d.ts +15 -0
  104. package/dist/internal/helpers/uuid.js +14 -0
  105. package/dist/internal/storybook/styles.d.ts +1 -0
  106. package/dist/styles/form-field.styles.js +11 -6
  107. package/dist/styles/global.css +1 -1
  108. package/dist/types/jsx/custom-element-jsx.d.ts +642 -1261
  109. package/dist/types/vue/index.d.ts +422 -267
  110. package/dist/vscode.html-custom-data.json +805 -525
  111. package/dist/web-types.json +928 -653
  112. package/package.json +41 -51
  113. package/dist/react/index.d.ts +0 -36
  114. package/dist/react/index.js +0 -36
  115. package/dist/react/skf-accordion/index.d.ts +0 -3
  116. package/dist/react/skf-accordion/index.js +0 -13
  117. package/dist/react/skf-alert/index.d.ts +0 -9
  118. package/dist/react/skf-alert/index.js +0 -17
  119. package/dist/react/skf-breadcrumb/index.d.ts +0 -9
  120. package/dist/react/skf-breadcrumb/index.js +0 -17
  121. package/dist/react/skf-breadcrumb-item/index.d.ts +0 -3
  122. package/dist/react/skf-breadcrumb-item/index.js +0 -13
  123. package/dist/react/skf-button/index.d.ts +0 -9
  124. package/dist/react/skf-button/index.js +0 -17
  125. package/dist/react/skf-card/index.d.ts +0 -3
  126. package/dist/react/skf-card/index.js +0 -13
  127. package/dist/react/skf-checkbox/index.d.ts +0 -9
  128. package/dist/react/skf-checkbox/index.js +0 -17
  129. package/dist/react/skf-collapse/index.d.ts +0 -9
  130. package/dist/react/skf-collapse/index.js +0 -17
  131. package/dist/react/skf-datepicker/index.d.ts +0 -12
  132. package/dist/react/skf-datepicker/index.js +0 -18
  133. package/dist/react/skf-dialog/index.d.ts +0 -15
  134. package/dist/react/skf-dialog/index.js +0 -19
  135. package/dist/react/skf-divider/index.d.ts +0 -3
  136. package/dist/react/skf-divider/index.js +0 -13
  137. package/dist/react/skf-heading/index.d.ts +0 -3
  138. package/dist/react/skf-heading/index.js +0 -13
  139. package/dist/react/skf-icon/index.d.ts +0 -3
  140. package/dist/react/skf-icon/index.js +0 -13
  141. package/dist/react/skf-input/index.d.ts +0 -12
  142. package/dist/react/skf-input/index.js +0 -18
  143. package/dist/react/skf-link/index.d.ts +0 -3
  144. package/dist/react/skf-link/index.js +0 -13
  145. package/dist/react/skf-loader/index.d.ts +0 -3
  146. package/dist/react/skf-loader/index.js +0 -13
  147. package/dist/react/skf-logo/index.d.ts +0 -3
  148. package/dist/react/skf-logo/index.js +0 -13
  149. package/dist/react/skf-menu/index.d.ts +0 -12
  150. package/dist/react/skf-menu/index.js +0 -18
  151. package/dist/react/skf-menu-item/index.d.ts +0 -27
  152. package/dist/react/skf-menu-item/index.js +0 -23
  153. package/dist/react/skf-popover/index.d.ts +0 -12
  154. package/dist/react/skf-popover/index.js +0 -18
  155. package/dist/react/skf-progress/index.d.ts +0 -3
  156. package/dist/react/skf-progress/index.js +0 -13
  157. package/dist/react/skf-radio/index.d.ts +0 -9
  158. package/dist/react/skf-radio/index.js +0 -17
  159. package/dist/react/skf-select/index.d.ts +0 -21
  160. package/dist/react/skf-select/index.js +0 -21
  161. package/dist/react/skf-select-option/index.d.ts +0 -9
  162. package/dist/react/skf-select-option/index.js +0 -17
  163. package/dist/react/skf-select-option-group/index.d.ts +0 -3
  164. package/dist/react/skf-select-option-group/index.js +0 -13
  165. package/dist/react/skf-stepper/index.d.ts +0 -9
  166. package/dist/react/skf-stepper/index.js +0 -17
  167. package/dist/react/skf-stepper-item/index.d.ts +0 -9
  168. package/dist/react/skf-stepper-item/index.js +0 -17
  169. package/dist/react/skf-switch/index.d.ts +0 -3
  170. package/dist/react/skf-switch/index.js +0 -13
  171. package/dist/react/skf-tab/index.d.ts +0 -12
  172. package/dist/react/skf-tab/index.js +0 -18
  173. package/dist/react/skf-tab-group/index.d.ts +0 -3
  174. package/dist/react/skf-tab-group/index.js +0 -13
  175. package/dist/react/skf-tab-panel/index.d.ts +0 -3
  176. package/dist/react/skf-tab-panel/index.js +0 -13
  177. package/dist/react/skf-tag/index.d.ts +0 -3
  178. package/dist/react/skf-tag/index.js +0 -13
  179. package/dist/react/skf-textarea/index.d.ts +0 -12
  180. package/dist/react/skf-textarea/index.js +0 -18
  181. package/dist/react/skf-toast/index.d.ts +0 -3
  182. package/dist/react/skf-toast/index.js +0 -13
  183. package/dist/react/skf-toast-wrapper/index.d.ts +0 -3
  184. package/dist/react/skf-toast-wrapper/index.js +0 -13
  185. package/dist/react/skf-tooltip/index.d.ts +0 -12
  186. package/dist/react/skf-tooltip/index.js +0 -18
@@ -1,19 +1,19 @@
1
1
  import "../button/button.js";
2
- import { dateFormatter as c } from "../date-picker-input/datepicker-input.helpers.js";
3
- import { SkfElement as $ } from "../../internal/components/skf-element.js";
4
- import { watch as g } from "../../internal/helpers/watch.js";
5
- import C from "../../styles/component.styles.js";
6
- import { html as y } from "lit";
7
- import { property as l, state as p } from "lit/decorators.js";
2
+ import { dateFormatter as l, is as v } from "../date-picker-input/datepicker-input.helpers.js";
3
+ import { SkfElement as R } from "../../internal/components/skf-element.js";
4
+ import { watch as p } from "../../internal/helpers/watch.js";
5
+ import S from "../../styles/component.styles.js";
6
+ import { html as D } from "lit";
7
+ import { property as o, state as m } from "lit/decorators.js";
8
8
  import "./datepicker.js";
9
- import { getDateParts as h, earliestDate as S, latestDate as k, compareDates as M, doAnimate as f } from "./datepicker.helpers.js";
10
- import { styles as T } from "./datepicker.styles.js";
11
- var V = Object.defineProperty, F = Object.getOwnPropertyDescriptor, i = (u, e, s, t) => {
12
- for (var a = t > 1 ? void 0 : t ? F(e, s) : e, d = u.length - 1, r; d >= 0; d--)
13
- (r = u[d]) && (a = (t ? r(e, s, a) : r(a)) || a);
14
- return t && a && V(e, s, a), a;
9
+ import { getDateParts as g, assertISODate as $, earliestDate as T, latestDate as C, compareDates as c, doAnimate as b } from "./datepicker.helpers.js";
10
+ import { styles as k } from "./datepicker.styles.js";
11
+ var F = Object.defineProperty, E = Object.getOwnPropertyDescriptor, n = (w, e, t, a) => {
12
+ for (var s = a > 1 ? void 0 : a ? E(e, t) : e, r = w.length - 1, d; r >= 0; r--)
13
+ (d = w[r]) && (s = (a ? d(e, t, s) : d(s)) || s);
14
+ return a && s && F(e, t, s), s;
15
15
  };
16
- const m = class m extends $ {
16
+ const y = class y extends R {
17
17
  constructor() {
18
18
  super(...arguments), this.locale = "en-CA", this.date = (/* @__PURE__ */ new Date()).toLocaleDateString(this.locale), this.id = "", this.range = !1, this.selectedDate = void 0, this.selectedDateRange = {
19
19
  start: null,
@@ -25,43 +25,43 @@ const m = class m extends $ {
25
25
  ), this._handleCalendarView = (e) => {
26
26
  this._handleChangeCalendarView(e.detail);
27
27
  }, this._handleSelectedDate = (e) => {
28
- var s;
28
+ var t;
29
29
  if (this.selectedDate = e.detail.date, console.log("selectedDate", this.selectedDate), this.range) {
30
- const t = (s = this.shadowRoot) == null ? void 0 : s.querySelectorAll("datepicker-calendar"), a = this.selectedDateRange, d = a.start && this.selectedDate < a.start;
31
- if ((a.start && a.end) ?? d)
30
+ const a = (t = this.shadowRoot) == null ? void 0 : t.querySelectorAll("skf-datepicker-calendar"), s = this.selectedDateRange, r = s.start && this.selectedDate < s.start;
31
+ if (!!(s.start && s.end) || r)
32
32
  this.selectedDateRange = {
33
33
  start: this.selectedDate,
34
34
  end: null
35
35
  };
36
36
  else {
37
- const D = !!a.start ? { end: e.detail.date } : { start: e.detail.date };
37
+ const f = !!s.start ? { end: e.detail.date } : { start: e.detail.date };
38
38
  this.selectedDateRange = {
39
- ...a,
40
- ...D
39
+ ...s,
40
+ ...f
41
41
  };
42
42
  }
43
- this._onRangeCompleteEmitEvent(), t != null && t.length && [...t].forEach((o) => {
44
- o.selectedDateRange = this.selectedDateRange;
43
+ this._onRangeCompleteEmitEvent(), a != null && a.length && [...a].forEach((h) => {
44
+ h.selectedDateRange = this.selectedDateRange;
45
45
  });
46
46
  }
47
47
  this.emit("skf-datepicker-selected", {
48
48
  detail: { date: this.range ? this.selectedDateRange : this.selectedDate }
49
49
  }), this.requestUpdate();
50
50
  }, this._handleTodayClick = () => {
51
- const { month: e, year: s } = h(), { month: t, year: a } = h(this.date);
52
- if (t === e && a === s && (this.selectedDateRange.start || this.selectedDate)) {
53
- this.date = c(this.selectedDateRange.start ?? this.selectedDate), this.emit("update-calendar-view", {
51
+ const { month: e, year: t } = g(), { month: a, year: s } = g(this.date);
52
+ if (a === e && s === t && (this.selectedDateRange.start || this.selectedDate)) {
53
+ this.date = l(this.selectedDateRange.start ?? this.selectedDate), this.emit("update-calendar-view", {
54
54
  detail: this.date
55
55
  });
56
56
  return;
57
57
  }
58
58
  if (this.range) {
59
59
  this.emit("update-calendar-view", {
60
- detail: c(/* @__PURE__ */ new Date())
60
+ detail: l(/* @__PURE__ */ new Date())
61
61
  });
62
62
  return;
63
63
  }
64
- this.date = c(/* @__PURE__ */ new Date());
64
+ this.date = l(/* @__PURE__ */ new Date());
65
65
  };
66
66
  }
67
67
  connectedCallback() {
@@ -69,6 +69,8 @@ const m = class m extends $ {
69
69
  }
70
70
  firstUpdated() {
71
71
  (this.selectedDateRange.start ?? this.selectedDate) && this._onRangeCompleteEmitEvent();
72
+ const t = this.selectedDate ?? this.selectedDateRange.start;
73
+ t instanceof Date && this.gotoDate(t);
72
74
  }
73
75
  clearSelection() {
74
76
  this.selectedDateRange = {
@@ -81,11 +83,11 @@ const m = class m extends $ {
81
83
  if (!this.selectedDateRange.start || !this.selectedDateRange.end) return;
82
84
  const e = Math.abs(
83
85
  this.selectedDateRange.end.getTime() - this.selectedDateRange.start.getTime()
84
- ), s = Math.ceil(e / (1e3 * 60 * 60 * 24)) + 1;
86
+ ), t = Math.ceil(e / (1e3 * 60 * 60 * 24)) + 1;
85
87
  this.emit("selected-date-range-changed", {
86
88
  detail: {
87
89
  ...this.selectedDateRange,
88
- days: s,
90
+ days: t,
89
91
  id: this.id
90
92
  }
91
93
  });
@@ -94,8 +96,8 @@ const m = class m extends $ {
94
96
  this.style.setProperty("--max-width", this.range ? "43em" : "21em");
95
97
  }
96
98
  _handleDateChange() {
97
- console.log("%cdate changed", "color:red", this.date), this.date = this.date ? this.date : c(/* @__PURE__ */ new Date()), this.date = S(
98
- k(this.date, this.selectableFrom ?? this.date),
99
+ console.log("%cdate changed", "color:red", this.date), this.date = this.date && $(this.date) ? this.date : l(/* @__PURE__ */ new Date()), this.date = T(
100
+ C(this.date, this.selectableFrom ?? this.date),
99
101
  this.selectableTo ?? this.date
100
102
  ), this._date = new Date(this.date), this._datePlusOneMonth = new Date(this._date.getFullYear(), this._date.getMonth() + 1, 1);
101
103
  }
@@ -104,8 +106,23 @@ const m = class m extends $ {
104
106
  _handleSelectedDateChange() {
105
107
  console.log("selected date changed", this.selectedDate);
106
108
  }
109
+ /**
110
+ * Navigates to the given date.
111
+ * @param date - The date to navigate to, either a Date object or a string in the format 'yyyy-mm-dd'
112
+ */
113
+ gotoDate(e) {
114
+ if (e instanceof Date)
115
+ this.date = l(e);
116
+ else if (v(e).dateISO())
117
+ this.date = e;
118
+ else
119
+ throw new Error("Invalid date format");
120
+ this.emit("update-calendar-view", {
121
+ detail: e
122
+ });
123
+ }
107
124
  render() {
108
- return y`
125
+ return D`
109
126
  <div class="calendar-container">
110
127
  <skf-datepicker-calendar
111
128
  .date=${this._date ?? /* @__PURE__ */ new Date()}
@@ -142,45 +159,48 @@ const m = class m extends $ {
142
159
  }
143
160
  /** @internal */
144
161
  _renderTodayBtn() {
145
- const { month: e, year: s } = h(), { month: t, year: a } = h(this.date), d = this.selectedDate ?? this.selectedDateRange.start, r = e === t && s === a;
146
- let o = !1;
147
- return (r && !d || d && e === d.getMonth() && s === d.getFullYear()) && (o = !0), y`
162
+ let e = !1;
163
+ if (this.selectableTo && c(this.selectableTo, l(/* @__PURE__ */ new Date())) === -1)
164
+ return D``;
165
+ if (this.selectableFrom && c(this.selectableFrom, l(/* @__PURE__ */ new Date())) === 1)
166
+ return D``;
167
+ const { month: t, year: a } = g(), { month: s, year: r } = g(this.date), d = this.selectedDate ?? this.selectedDateRange.start, h = t === s && a === r, f = d && c(l(/* @__PURE__ */ new Date()), l(d), "months") === 0;
168
+ return (h && !d || f && h) && (e = !0), D`
148
169
  <div class="today">
149
170
  <skf-button
150
171
  @click=${this._handleTodayClick}
151
- ?disabled=${o}
172
+ ?disabled=${e}
152
173
  variant="tertiary"
153
174
  size="sm"
154
175
  >
155
- ${D(this.date) && (this.selectedDate || this.selectedDateRange.start) && !o ? "Selected date" : "Today"}
176
+ ${_(this.date) && (this.selectedDate || this.selectedDateRange.start) && !e ? "Selected date" : "Today"}
156
177
  </skf-button>
157
178
  </div>
158
179
  `;
159
- function D(_) {
160
- const { month: w, year: R } = h(), { month: v, year: b } = h(_);
161
- return w === v && R === b;
180
+ function _(u) {
181
+ return c(u, l(/* @__PURE__ */ new Date()), "months") === 0;
162
182
  }
163
183
  }
164
184
  /** @internal */
165
185
  _handleChangeCalendarView(e) {
166
- const s = M(this.date, e);
167
- this._animateView(s, () => {
186
+ const t = c(this.date, e);
187
+ this._animateView(t, () => {
168
188
  this.date = e;
169
189
  }).then(() => {
170
- }).catch((t) => {
171
- console.error(t);
190
+ }).catch((a) => {
191
+ console.error(a);
172
192
  });
173
193
  }
174
194
  /** @internal */
175
- async _animateView(e, s) {
195
+ async _animateView(e, t) {
176
196
  if (!this.shadowRoot) return;
177
- const t = [...this.shadowRoot.querySelectorAll("skf-datepicker-calendar")];
178
- return t.length ? (await f(
179
- t,
197
+ const a = [...this.shadowRoot.querySelectorAll("skf-datepicker-calendar")];
198
+ return a.length ? (await b(
199
+ a,
180
200
  [{ opacity: 0, transform: `translateX(calc(16px * ${e.toString()}))` }],
181
201
  { duration: 100, easing: "ease-in", fill: "backwards" }
182
- ), s(), await f(
183
- t,
202
+ ), t(), await b(
203
+ a,
184
204
  [
185
205
  { opacity: 0, transform: `translateX(${(-16 * e).toString()}px)` },
186
206
  { opacity: 1, transform: "translateX(0)" }
@@ -189,53 +209,53 @@ const m = class m extends $ {
189
209
  )) : Promise.resolve();
190
210
  }
191
211
  };
192
- m.styles = [C, T];
193
- let n = m;
194
- i([
195
- l({ reflect: !0 })
196
- ], n.prototype, "locale", 2);
197
- i([
198
- l({ type: String, reflect: !0 })
199
- ], n.prototype, "date", 2);
200
- i([
201
- l({ type: String })
202
- ], n.prototype, "id", 2);
203
- i([
204
- l({ attribute: "invalid-dates" })
205
- ], n.prototype, "invalidDates", 2);
206
- i([
207
- l({ type: Boolean })
208
- ], n.prototype, "range", 2);
209
- i([
210
- p()
211
- ], n.prototype, "selectedDate", 2);
212
- i([
213
- l({ attribute: "selectable-from" })
214
- ], n.prototype, "selectableFrom", 2);
215
- i([
216
- l({ attribute: "selectable-to" })
217
- ], n.prototype, "selectableTo", 2);
218
- i([
219
- p()
220
- ], n.prototype, "selectedDateRange", 2);
221
- i([
222
- p()
223
- ], n.prototype, "_date", 2);
224
- i([
225
- p()
226
- ], n.prototype, "_datePlusOneMonth", 2);
227
- i([
228
- g("range")
229
- ], n.prototype, "_handleRangeChange", 1);
230
- i([
231
- g("date")
232
- ], n.prototype, "_handleDateChange", 1);
233
- i([
234
- g("selectedDateRange")
235
- ], n.prototype, "_handleSelectedDateRangeChange", 1);
236
- i([
237
- g("selectedDate")
238
- ], n.prototype, "_handleSelectedDateChange", 1);
212
+ y.styles = [S, k];
213
+ let i = y;
214
+ n([
215
+ o({ reflect: !0 })
216
+ ], i.prototype, "locale", 2);
217
+ n([
218
+ o({ type: String, reflect: !0 })
219
+ ], i.prototype, "date", 2);
220
+ n([
221
+ o({ type: String })
222
+ ], i.prototype, "id", 2);
223
+ n([
224
+ o({ attribute: "invalid-dates" })
225
+ ], i.prototype, "invalidDates", 2);
226
+ n([
227
+ o({ type: Boolean })
228
+ ], i.prototype, "range", 2);
229
+ n([
230
+ m()
231
+ ], i.prototype, "selectedDate", 2);
232
+ n([
233
+ o({ attribute: "selectable-from" })
234
+ ], i.prototype, "selectableFrom", 2);
235
+ n([
236
+ o({ attribute: "selectable-to" })
237
+ ], i.prototype, "selectableTo", 2);
238
+ n([
239
+ m()
240
+ ], i.prototype, "selectedDateRange", 2);
241
+ n([
242
+ m()
243
+ ], i.prototype, "_date", 2);
244
+ n([
245
+ m()
246
+ ], i.prototype, "_datePlusOneMonth", 2);
247
+ n([
248
+ p("range")
249
+ ], i.prototype, "_handleRangeChange", 1);
250
+ n([
251
+ p("date")
252
+ ], i.prototype, "_handleDateChange", 1);
253
+ n([
254
+ p("selectedDateRange")
255
+ ], i.prototype, "_handleSelectedDateRangeChange", 1);
256
+ n([
257
+ p("selectedDate")
258
+ ], i.prototype, "_handleSelectedDateChange", 1);
239
259
  export {
240
- n as SkfDatePicker
260
+ i as SkfDatePicker
241
261
  };
@@ -17,9 +17,10 @@ export declare function getDateParts(date?: undefined | string | Date | Temporal
17
17
  /**
18
18
  * @param dateOne - first date to compare as string
19
19
  * @param dateTwo - second date to compare as string
20
+ * @param granularity - the unit to compare the dates by [days, months, years], defaults to days
20
21
  * @returns - 0 if the dates are the same, 1 if dateOne is after dateTwo, -1 if dateOne is before dateTwo
21
22
  */
22
- export declare function compareDates(dateOne: Temporal.PlainDate | string, dateTwo: Temporal.PlainDate | string): 0 | 1 | -1;
23
+ export declare function compareDates(dateOne: Temporal.PlainDate | string, dateTwo: Temporal.PlainDate | string, granularity?: 'days' | 'months' | 'years'): 0 | 1 | -1;
23
24
  /**
24
25
  * @param dateOne - first date to compare as string
25
26
  * @param dateTwo - second date to compare as string
@@ -37,4 +38,4 @@ export declare function earliestDate(...dates: (string | Date)[]): string;
37
38
  * @returns the latest date of the list
38
39
  */
39
40
  export declare function latestDate(...dates: (string | Date)[]): string;
40
- export declare function assertISODate(date: string | Temporal.PlainDate | Date): string;
41
+ export declare function assertISODate(date: string | Temporal.PlainDate | Date, throwErr?: boolean): string;
@@ -1,69 +1,76 @@
1
- import { Temporal as s } from "@js-temporal/polyfill";
2
- function h(t, n, e) {
3
- const o = (r) => Array.isArray(r) ? r : [r], a = o(t);
1
+ import { is as c } from "../date-picker-input/datepicker-input.helpers.js";
2
+ import { Temporal as e } from "@js-temporal/polyfill";
3
+ function I(t, n, s) {
4
+ const o = (r) => Array.isArray(r) ? r : [r], f = o(t);
4
5
  n = o(n);
5
- const f = [];
6
- for (const r of a) {
7
- const { promise: i, resolve: c, reject: D } = Promise.withResolvers(), l = r.animate(n, {
6
+ const a = [];
7
+ for (const r of f) {
8
+ const { promise: i, resolve: m, reject: p } = Promise.withResolvers(), l = r.animate(n, {
8
9
  fill: "forwards",
9
10
  duration: 300,
10
11
  iterations: 1,
11
- ...e
12
+ ...s
12
13
  });
13
- l.onfinish = () => c("finished"), l.oncancel = () => D("canceled"), f.push(i);
14
+ l.onfinish = () => m("finished"), l.oncancel = () => p("canceled"), a.push(i);
14
15
  }
15
- return Promise.allSettled(f);
16
+ return Promise.allSettled(a);
16
17
  }
17
- function w(t = s.Now.plainDateISO()) {
18
- return t ?? (t = s.Now.plainDateISO()), t instanceof Date && (t = s.PlainDate.from(t.toISOString())), typeof t == "string" && (t = s.PlainDate.from(u(t))), {
18
+ function P(t = e.Now.plainDateISO()) {
19
+ return t ?? (t = e.Now.plainDateISO()), t instanceof Date && (t = e.PlainDate.from(t.toISOString())), typeof t == "string" && (t = e.PlainDate.from(S(t, !0))), {
19
20
  year: t.year,
20
21
  month: t.month - 1,
21
22
  // new Date is 0 based
22
23
  day: t.day
23
24
  };
24
25
  }
25
- function y(t, n) {
26
- const e = m(t, n);
27
- return o(e);
28
- function o(a) {
26
+ function v(t, n, s = "days") {
27
+ console.assert(c(t, n).plainISO(), "Invalid dates passed to compareDates()"), typeof t == "string" && (t = e.PlainDate.from(t)), typeof n == "string" && (n = e.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 o = D(t, n, s);
32
+ return f(o);
33
+ function f(a) {
29
34
  return Math.max(-1, Math.min(a, 1));
30
35
  }
31
36
  }
32
- function m(t, n, e = "days") {
33
- return typeof t == "string" && (t = s.PlainDate.from(t)), typeof n == "string" && (n = s.PlainDate.from(n)), console.assert(
34
- t instanceof s.PlainDate && n instanceof s.PlainDate,
37
+ function D(t, n, s = "days") {
38
+ return typeof t == "string" && (t = e.PlainDate.from(t)), typeof n == "string" && (n = e.PlainDate.from(n)), console.assert(
39
+ t instanceof e.PlainDate && n instanceof e.PlainDate,
35
40
  `Invalid date was sent to helper function timeBetween(). Got ${JSON.stringify(t)} and ${JSON.stringify(n)} passed in`
36
- ), t.since(n).total({ unit: e });
41
+ ), s === "months" ? n.until(t, { largestUnit: "months" }).months : s === "years" ? n.until(t, { largestUnit: "years" }).years : n.until(t, { largestUnit: "days" }).days;
37
42
  }
38
- function p(...t) {
43
+ function u(...t) {
39
44
  if (t.length === 0)
40
45
  throw new Error("At least one date must be provided");
41
- const n = (i) => i instanceof Date, e = t.map((i) => n(i) ? i : new Date(i));
42
- if (e.length === 1)
43
- return e[0].toISOString().split("T")[0];
44
- const [o, ...a] = e, f = p(...a), r = new Date(f);
46
+ const n = (i) => i instanceof Date, s = t.map((i) => n(i) ? i : new Date(i));
47
+ if (s.length === 1)
48
+ return s[0].toISOString().split("T")[0];
49
+ const [o, ...f] = s, a = u(...f), r = new Date(a);
45
50
  return o < r ? o.toISOString().split("T")[0] : r.toISOString().split("T")[0];
46
51
  }
47
- function S(...t) {
52
+ function g(...t) {
48
53
  if (t.length === 0)
49
54
  throw new Error("At least one date must be provided");
50
- const n = (i) => i instanceof Date, e = t.map((i) => n(i) ? i : new Date(i));
51
- if (e.length === 1)
52
- return e[0].toISOString().split("T")[0];
53
- const [o, ...a] = e, f = S(...a), r = new Date(f);
55
+ const n = (i) => i instanceof Date, s = t.map((i) => n(i) ? i : new Date(i));
56
+ if (s.length === 1)
57
+ return s[0].toISOString().split("T")[0];
58
+ const [o, ...f] = s, a = g(...f), r = new Date(a);
54
59
  return o > r ? o.toISOString().split("T")[0] : r.toISOString().split("T")[0];
55
60
  }
56
- function u(t) {
57
- if (t instanceof Date && (t = s.PlainDate.from(t.toISOString())), typeof t != "string" && (t = t.toString()), !/^\d{4}-\d{2}-\d{2}$/.test(t))
61
+ function S(t, n = !1) {
62
+ t instanceof Date && (t = e.PlainDate.from(t.toISOString())), typeof t != "string" && (t = t.toString());
63
+ const s = /^\d{4}-\d{2}-\d{2}$/;
64
+ if (!s.test(t) && n)
58
65
  throw new Error(`Invalid date format. Got ${t} passed in.`);
59
- return t;
66
+ return s.test(t) ? t : "";
60
67
  }
61
68
  export {
62
- u as assertISODate,
63
- y as compareDates,
64
- h as doAnimate,
65
- p as earliestDate,
66
- w as getDateParts,
67
- S as latestDate,
68
- m as timeBetween
69
+ S as assertISODate,
70
+ v as compareDates,
71
+ I as doAnimate,
72
+ u as earliestDate,
73
+ P as getDateParts,
74
+ g as latestDate,
75
+ D as timeBetween
69
76
  };
@@ -1,27 +1,12 @@
1
- import { css as o } from "lit";
2
- const e = o`
1
+ import { css as r } from "lit";
2
+ const a = r`
3
3
  @layer components {
4
4
  :host {
5
- --black: #323232;
6
- --call-to-action-color: #007bff;
7
- --selected-bg: var(--call-to-action-color); /* hsl(218deg 87% 45%); */
8
- --selected-fg: #fff;
9
- --in-range-bg: #def;
10
- --today: #eee;
11
- --today-fg: var(--black);
12
- --title-fg: var(--black);
13
- --other-month-fg: #999;
14
- --hover-bg: #def;
15
- --border-color: #ddd;
16
- --button-control-fg: #333;
17
- --button-control-fg-hover: var(--call-to-action-color);
18
- --weekday-fg: var(--black);
19
- --calendar-padding: 16px;
20
5
  --max-width: 21em;
21
6
  --day-outline: transparent;
22
7
 
23
- background-color: #fff;
24
- border: solid 1px gray;
8
+ background-color: var(--skf-bg-color-neutral-1);
9
+ border: solid 1px var(--skf-border-color-primary);
25
10
  border-radius: 3px;
26
11
  box-shadow: 0 0 10px rgba(0 0 0 / 30%);
27
12
  box-sizing: border-box;
@@ -52,16 +37,19 @@ const e = o`
52
37
  .calendar-container {
53
38
  display: flex;
54
39
  flex-direction: row;
55
- gap: var(--calendar-padding);
40
+ gap: var(--skf-text-color-primary);
56
41
  justify-content: space-between;
57
42
  overflow: hidden;
58
- padding: var(--calendar-padding);
43
+ padding: var(--skf-spacing-50);
44
+ }
45
+
46
+ skf-datepicker-calendar {
47
+ margin: var(--skf-spacing-50) var(--skf-spacing-50) 0 var(--skf-spacing-50);
59
48
  }
60
49
 
61
50
  .today {
62
- border-top: 1px solid var(--border-color);
51
+ border-top: 1px solid var(--skf-border-color-primary);
63
52
  margin-bottom: 0.5rem;
64
- margin-top: -1rem;
65
53
  padding-top: 0.5rem;
66
54
  text-align: center;
67
55
 
@@ -78,11 +66,11 @@ const e = o`
78
66
  }
79
67
 
80
68
  &:hover {
81
- background-color: var(--call-to-action-color);
69
+ background-color: var(--skf-interactive-bg-color-primary);
82
70
  }
83
71
 
84
72
  &:active {
85
- background-color: lch(from var(--call-to-action-color) calc(l - 5) c h);
73
+ background-color: lch(from var(--skf-interactive-bg-color-primary) calc(l - 5) c h);
86
74
  }
87
75
 
88
76
  &:focus-visible {
@@ -95,5 +83,5 @@ const e = o`
95
83
  }
96
84
  `;
97
85
  export {
98
- e as styles
86
+ a as styles
99
87
  };
@@ -1,3 +1,4 @@
1
+ import '../icon/icon.js';
1
2
  import { FormBase } from '../../internal/components/formBase.js';
2
3
  import { PopoverController } from '../../internal/controllers/popover.controller.js';
3
4
  import type { FormFieldBaseProps } from '../../internal/types/formField.js';
@@ -8,7 +9,7 @@ export declare class SkfDatePickerInput extends FormBase {
8
9
  /** @internal */
9
10
  static styles: CSSResultGroup;
10
11
  /** @inernal */
11
- focusTomeoutId: ReturnType<typeof setTimeout> | undefined;
12
+ focusTimeoutId: ReturnType<typeof setTimeout> | undefined;
12
13
  /** @internal */
13
14
  private customError;
14
15
  /** @internal */
@@ -48,6 +49,8 @@ export declare class SkfDatePickerInput extends FormBase {
48
49
  * @type { "alert" | "success" | "info" | "warning" }
49
50
  */
50
51
  severity?: FormFieldBaseProps['severity'];
52
+ /** Size of the input */
53
+ size: 'sm' | 'md';
51
54
  /** Sets validation start */
52
55
  validateOn: 'input' | 'change' | 'submit';
53
56
  /** The current value of the input field */
@@ -72,16 +75,21 @@ export declare class SkfDatePickerInput extends FormBase {
72
75
  $datepicker: SkfDatePicker;
73
76
  /** @internal */
74
77
  _defaultSlot: Node[];
78
+ abortController: AbortController;
79
+ abortSignal: AbortSignal;
75
80
  constructor();
76
81
  connectedCallback(): void;
77
- _handleSelectedDate: (e: CustomEvent<{
78
- date: Date;
79
- id: number;
80
- }>) => void;
82
+ disconnectedCallback(): void;
83
+ _handleSelectedDate: () => void;
81
84
  protected firstUpdated(): void;
82
85
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
83
86
  private _handleDateSelected;
87
+ /** @internal */
88
+ _handleKeyboardEvents: (e: KeyboardEvent) => void;
89
+ /** @internal */
84
90
  private _handleFocus;
91
+ showPopover: () => void;
92
+ hidePopover: () => void;
85
93
  /** @internal */
86
94
  _handleBlur: (event: FocusEvent) => void;
87
95
  /** @internal */