@voidable/ui 0.11.0 → 0.12.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 (151) hide show
  1. package/dist/angular/index.d.ts +2 -2
  2. package/dist/angular/index.js +2 -1
  3. package/dist/chunks/activation-B8aBarKd.js +4 -0
  4. package/dist/chunks/carousel-C9u0bg5l.js +10 -0
  5. package/dist/chunks/choice-BTrsi7OW.js +16 -0
  6. package/dist/chunks/data-Baycjoo4.js +96 -0
  7. package/dist/chunks/fields-MEqz-olE.js +21 -0
  8. package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
  9. package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
  10. package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
  11. package/dist/chunks/menu-CxRRgkJI.js +21 -0
  12. package/dist/chunks/{modal-DWGkNdNG.js → modal-Cz2-Ov76.js} +23 -15
  13. package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
  14. package/dist/chunks/{overlay-CH7L4N-h.js → overlay-BuV-4Yvt.js} +75 -68
  15. package/dist/chunks/overlay-K1ilWC1p.js +4 -0
  16. package/dist/chunks/pickers-CjlFgNke.js +36 -0
  17. package/dist/chunks/table-BBpqwWEi.js +4 -0
  18. package/dist/chunks/tabs-Buf3EBWq.js +10 -0
  19. package/dist/components/accordion.d.ts +7 -0
  20. package/dist/components/accordion.js +22 -14
  21. package/dist/components/action-input.d.ts +2 -1
  22. package/dist/components/action-input.js +59 -55
  23. package/dist/components/bar-chart.js +41 -40
  24. package/dist/components/breadcrumbs.d.ts +2 -0
  25. package/dist/components/breadcrumbs.js +15 -11
  26. package/dist/components/button.d.ts +7 -0
  27. package/dist/components/button.js +23 -16
  28. package/dist/components/calendar.d.ts +45 -10
  29. package/dist/components/calendar.js +183 -129
  30. package/dist/components/carousel.d.ts +22 -0
  31. package/dist/components/carousel.js +64 -35
  32. package/dist/components/charts/data.d.ts +2 -2
  33. package/dist/components/checkbox-group.js +22 -21
  34. package/dist/components/checkbox.d.ts +7 -0
  35. package/dist/components/checkbox.js +29 -24
  36. package/dist/components/collapsible.d.ts +7 -0
  37. package/dist/components/collapsible.js +19 -11
  38. package/dist/components/color-picker.js +28 -27
  39. package/dist/components/combobox.d.ts +13 -1
  40. package/dist/components/combobox.js +54 -41
  41. package/dist/components/compose-input.d.ts +9 -1
  42. package/dist/components/compose-input.js +28 -16
  43. package/dist/components/dialog.js +1 -1
  44. package/dist/components/donut-chart.js +57 -56
  45. package/dist/components/drawer.js +1 -1
  46. package/dist/components/dropdown-menu.d.ts +22 -0
  47. package/dist/components/dropdown-menu.js +54 -39
  48. package/dist/components/editable.d.ts +11 -1
  49. package/dist/components/editable.js +35 -22
  50. package/dist/components/error-fallback.d.ts +4 -2
  51. package/dist/components/error-fallback.js +34 -28
  52. package/dist/components/file-upload.d.ts +9 -0
  53. package/dist/components/file-upload.js +54 -28
  54. package/dist/components/gauge.js +108 -107
  55. package/dist/components/hamburger.d.ts +7 -0
  56. package/dist/components/hamburger.js +28 -19
  57. package/dist/components/hover-card.d.ts +7 -0
  58. package/dist/components/hover-card.js +22 -14
  59. package/dist/components/indicator.js +15 -14
  60. package/dist/components/input.js +1 -1
  61. package/dist/components/line-chart.js +43 -42
  62. package/dist/components/menu.d.ts +25 -0
  63. package/dist/components/menu.js +55 -33
  64. package/dist/components/multiselect.d.ts +17 -1
  65. package/dist/components/multiselect.js +96 -74
  66. package/dist/components/nav-menu.d.ts +9 -0
  67. package/dist/components/nav-menu.js +30 -23
  68. package/dist/components/number-input.d.ts +15 -1
  69. package/dist/components/number-input.js +71 -37
  70. package/dist/components/pagination.js +25 -24
  71. package/dist/components/pin-input.d.ts +11 -0
  72. package/dist/components/pin-input.js +46 -32
  73. package/dist/components/popover.d.ts +7 -0
  74. package/dist/components/popover.js +21 -13
  75. package/dist/components/radio-group.js +1 -1
  76. package/dist/components/radio.d.ts +10 -1
  77. package/dist/components/radio.js +37 -32
  78. package/dist/components/segmented-control.d.ts +14 -0
  79. package/dist/components/segmented-control.js +40 -28
  80. package/dist/components/sidebar.d.ts +1 -0
  81. package/dist/components/sidebar.js +14 -10
  82. package/dist/components/slider.js +1 -1
  83. package/dist/components/spinner.d.ts +5 -3
  84. package/dist/components/spinner.js +21 -14
  85. package/dist/components/stat.js +1 -1
  86. package/dist/components/status-dot.d.ts +2 -2
  87. package/dist/components/status-dot.js +12 -14
  88. package/dist/components/stepper.d.ts +2 -0
  89. package/dist/components/stepper.js +20 -13
  90. package/dist/components/switch.d.ts +7 -0
  91. package/dist/components/switch.js +24 -16
  92. package/dist/components/table.d.ts +77 -1
  93. package/dist/components/table.js +562 -73
  94. package/dist/components/tabs.d.ts +11 -0
  95. package/dist/components/tabs.js +42 -33
  96. package/dist/components/tag.js +12 -11
  97. package/dist/components/tags-input.d.ts +10 -1
  98. package/dist/components/tags-input.js +42 -30
  99. package/dist/components/textarea.js +1 -1
  100. package/dist/components/toast.d.ts +2 -0
  101. package/dist/components/toast.js +35 -28
  102. package/dist/components/toggle-group.d.ts +8 -0
  103. package/dist/components/toggle-group.js +24 -17
  104. package/dist/components/toggle.d.ts +7 -0
  105. package/dist/components/toggle.js +23 -15
  106. package/dist/components/tooltip.d.ts +7 -0
  107. package/dist/components/tooltip.js +20 -12
  108. package/dist/components.json +96 -74
  109. package/dist/custom-elements.json +4213 -131
  110. package/dist/dev/rules.d.ts +0 -1
  111. package/dist/dev/types.d.ts +3 -1
  112. package/dist/dev.js +244 -113
  113. package/dist/index.d.ts +4 -0
  114. package/dist/index.js +68 -66
  115. package/dist/keyboard-activation.d.ts +9 -9
  116. package/dist/keyboard.d.ts +2 -10
  117. package/dist/keymaps/activation.d.ts +8 -0
  118. package/dist/keymaps/carousel.d.ts +9 -0
  119. package/dist/keymaps/choice.d.ts +21 -0
  120. package/dist/keymaps/fields.d.ts +31 -0
  121. package/dist/keymaps/index.d.ts +2 -0
  122. package/dist/keymaps/menu.d.ts +36 -0
  123. package/dist/keymaps/nav-menu.d.ts +11 -0
  124. package/dist/keymaps/overlay.d.ts +4 -0
  125. package/dist/keymaps/pickers.d.ts +36 -0
  126. package/dist/keymaps/table.d.ts +8 -0
  127. package/dist/keymaps/tabs.d.ts +7 -0
  128. package/dist/keymaps.js +51 -0
  129. package/dist/keys.d.ts +46 -0
  130. package/dist/keys.js +57 -0
  131. package/dist/llms.txt +11 -3
  132. package/dist/messages/ar.d.ts +1 -0
  133. package/dist/messages/ar.js +130 -0
  134. package/dist/messages/fr.d.ts +1 -0
  135. package/dist/messages/fr.js +109 -0
  136. package/dist/messages.d.ts +213 -0
  137. package/dist/messages.js +190 -0
  138. package/dist/modal.d.ts +7 -0
  139. package/dist/reference.md +817 -17
  140. package/dist/testing/index.d.ts +46 -0
  141. package/dist/testing.js +79 -0
  142. package/dist/types/elements.d.ts +89 -73
  143. package/dist/types/react.d.ts +5 -1
  144. package/dist/types/solid.d.ts +5 -1
  145. package/dist/types/solid2.d.ts +4 -0
  146. package/dist/types/svelte.d.ts +5 -1
  147. package/dist/types/vue.d.ts +5 -1
  148. package/dist/vscode.html-custom-data.json +384 -18
  149. package/dist/web-types.json +830 -69
  150. package/package.json +22 -2
  151. package/dist/chunks/data-BpiiNapL.js +0 -95
@@ -1,15 +1,18 @@
1
1
  import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { t as n } from "../chunks/form-control-C0vH6gii.js";
4
- import { r } from "../chunks/projection-oPe6ipjL.js";
5
- import { o as i, r as a } from "../chunks/keyboard-CEhMSkws.js";
6
- import { t as o } from "../chunks/overlay-CH7L4N-h.js";
7
- import { html as s, nothing as c } from "lit";
8
- import { property as l } from "lit/decorators.js";
9
- import { live as u } from "lit/directives/live.js";
3
+ import { actionFor as n, keysConverter as r } from "../keys.js";
4
+ import { localeOf as i, msg as a, nameHost as o } from "../messages.js";
5
+ import { t as s } from "../chunks/form-control-fL-Hhy91.js";
6
+ import { r as c } from "../chunks/projection-oPe6ipjL.js";
7
+ import { i as l } from "../chunks/keyboard-ChtDvhB_.js";
8
+ import { r as u, t as d } from "../chunks/pickers-CjlFgNke.js";
9
+ import { t as f } from "../chunks/overlay-BuV-4Yvt.js";
10
+ import { html as p, nothing as m } from "lit";
11
+ import { property as h } from "lit/decorators.js";
12
+ import { live as g } from "lit/directives/live.js";
10
13
  //#region src/components/calendar.ts
11
- r();
12
- function d(e) {
14
+ c();
15
+ function _(e) {
13
16
  let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
14
17
  return t ? [
15
18
  Number(t[1]),
@@ -17,27 +20,27 @@ function d(e) {
17
20
  Number(t[3])
18
21
  ] : null;
19
22
  }
20
- function f(e, t, n) {
23
+ function v(e, t, n) {
21
24
  return `${String(e).padStart(4, "0")}-${String(t + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
22
25
  }
23
- function p() {
26
+ function y() {
24
27
  let e = /* @__PURE__ */ new Date();
25
- return f(e.getFullYear(), e.getMonth(), e.getDate());
28
+ return v(e.getFullYear(), e.getMonth(), e.getDate());
26
29
  }
27
- function m(e, t) {
30
+ function b(e, t) {
28
31
  return new Date(e, t + 1, 0).getDate();
29
32
  }
30
- function h(e, t, n) {
33
+ function x(e, t, n) {
31
34
  return t && e < t ? t : n && e > n ? n : e;
32
35
  }
33
- function g(e, t) {
34
- let n = d(e);
36
+ function S(e, t) {
37
+ let n = _(e);
35
38
  if (!n) return e;
36
39
  let [r, i, a] = n;
37
40
  return t.replace("YYYY", String(r).padStart(4, "0")).replace("MM", String(i + 1).padStart(2, "0")).replace("DD", String(a).padStart(2, "0"));
38
41
  }
39
- function _(e, t) {
40
- let n = e.trim(), r = d(n), i = [], a = "";
42
+ function C(e, t) {
43
+ let n = e.trim(), r = _(n), i = [], a = "";
41
44
  for (let e of t.split(/(YYYY|MM|DD)/)) e === "YYYY" ? (i.push("y"), a += "(\\d{4})") : e === "MM" ? (i.push("m"), a += "(\\d{1,2})") : e === "DD" ? (i.push("d"), a += "(\\d{1,2})") : a += e.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&").replace(/\s+/g, "\\s*");
42
45
  let o, s, c, l = r ? null : RegExp(`^${a}$`).exec(n);
43
46
  if (r) [o, s, c] = [
@@ -53,11 +56,36 @@ function _(e, t) {
53
56
  e("d")
54
57
  ];
55
58
  } else return null;
56
- return s < 1 || s > 12 || c < 1 || c > m(o, s - 1) || o < 100 ? null : f(o, s - 1, c);
59
+ return s < 1 || s > 12 || c < 1 || c > b(o, s - 1) || o < 100 ? null : v(o, s - 1, c);
57
60
  }
58
- var v = class extends n(e) {
61
+ function w(e, t) {
62
+ if (t !== null && Number.isFinite(t)) return (Math.trunc(t) % 7 + 7) % 7;
63
+ try {
64
+ let t = new Intl.Locale(e), n = typeof t.getWeekInfo == "function" ? t.getWeekInfo() : t.weekInfo;
65
+ if (n && Number.isInteger(n.firstDay)) return n.firstDay % 7;
66
+ } catch {}
67
+ return 0;
68
+ }
69
+ function T(e, t) {
70
+ try {
71
+ return new Intl.DateTimeFormat(e, {
72
+ ...t,
73
+ calendar: "gregory"
74
+ });
75
+ } catch {
76
+ return new Intl.DateTimeFormat("en-US", t);
77
+ }
78
+ }
79
+ function E(e) {
80
+ try {
81
+ return new Intl.NumberFormat(e, { useGrouping: !1 });
82
+ } catch {
83
+ return new Intl.NumberFormat("en-US", { useGrouping: !1 });
84
+ }
85
+ }
86
+ var D = class extends s(e) {
59
87
  constructor(...e) {
60
- super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this._viewYear = 0, this._viewMonth = 0, this._view = "days", this._focusDate = "", this._yearsPageStart = 0, this._didInit = !1, this._prevMonth = () => {
88
+ super(...e), this.keys = null, this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "", this.firstDay = null, this._viewYear = 0, this._viewMonth = 0, this._view = "days", this._focusDate = "", this._yearsPageStart = 0, this._didInit = !1, this._prevMonth = () => {
61
89
  this._viewMonth === 0 ? (this._viewMonth = 11, this._viewYear--) : this._viewMonth--, this._syncFocusToView(), this.requestUpdate();
62
90
  }, this._nextMonth = () => {
63
91
  this._viewMonth === 11 ? (this._viewMonth = 0, this._viewYear++) : this._viewMonth++, this._syncFocusToView(), this.requestUpdate();
@@ -77,80 +105,96 @@ var v = class extends n(e) {
77
105
  if (this.disabled) return;
78
106
  let t = e.target.getAttribute("data-date");
79
107
  if (!t) return;
80
- let n = d(t);
81
- if (!n) return;
82
- let [r, i] = n, o = n[2], s = !0, c = null;
83
- switch (e.key) {
84
- case a(this).prev:
108
+ let r = _(t);
109
+ if (!r) return;
110
+ let [i, a] = r, o = r[2], s = !0, c = null, l = n(this, e);
111
+ switch (l) {
112
+ case "previousDay":
85
113
  o--;
86
114
  break;
87
- case a(this).next:
115
+ case "nextDay":
88
116
  o++;
89
117
  break;
90
- case "ArrowUp":
118
+ case "previousWeek":
91
119
  o -= 7;
92
120
  break;
93
- case "ArrowDown":
121
+ case "nextWeek":
94
122
  o += 7;
95
123
  break;
96
- case "Home":
97
- o -= (new Date(r, i, o).getDay() - this.firstDay + 7) % 7;
124
+ case "startOfWeek":
125
+ o -= (new Date(i, a, o).getDay() - this._week + 7) % 7;
98
126
  break;
99
- case "End":
100
- o += 6 - (new Date(r, i, o).getDay() - this.firstDay + 7) % 7;
127
+ case "endOfWeek":
128
+ o += 6 - (new Date(i, a, o).getDay() - this._week + 7) % 7;
101
129
  break;
102
- case "PageUp":
103
- case "PageDown": {
104
- let t = e.key === "PageUp" ? -1 : 1, n = e.shiftKey ? new Date(r + t, i, 1) : new Date(r, i + t, 1);
105
- o = Math.min(o, m(n.getFullYear(), n.getMonth())), c = n;
130
+ case "previousMonth":
131
+ case "nextMonth":
132
+ case "previousYear":
133
+ case "nextYear": {
134
+ let e = l === "previousMonth" || l === "previousYear" ? -1 : 1, t = l.endsWith("Year") ? new Date(i + e, a, 1) : new Date(i, a + e, 1);
135
+ o = Math.min(o, b(t.getFullYear(), t.getMonth())), c = t;
106
136
  break;
107
137
  }
108
- case "Enter":
109
- case " ":
138
+ case "activate":
110
139
  this._selectDate(t), e.preventDefault();
111
140
  return;
112
141
  default: s = !1;
113
142
  }
114
143
  if (!s) return;
115
144
  e.preventDefault();
116
- let l = c ? new Date(c.getFullYear(), c.getMonth(), o) : new Date(r, i, o), u = h(f(l.getFullYear(), l.getMonth(), l.getDate()), this.min || void 0, this.max || void 0);
117
- this._focusDate = u;
118
- let p = d(u);
119
- p && (this._viewYear = p[0], this._viewMonth = p[1]), this.requestUpdate(), this.updateComplete.then(() => {
120
- this.querySelector(`[data-date="${u}"]`)?.focus();
145
+ let u = c ? new Date(c.getFullYear(), c.getMonth(), o) : new Date(i, a, o), d = x(v(u.getFullYear(), u.getMonth(), u.getDate()), this.min || void 0, this.max || void 0);
146
+ this._focusDate = d;
147
+ let f = _(d);
148
+ f && (this._viewYear = f[0], this._viewMonth = f[1]), this.requestUpdate(), this.updateComplete.then(() => {
149
+ this.querySelector(`[data-date="${d}"]`)?.focus();
121
150
  });
122
151
  };
123
152
  }
153
+ static {
154
+ this.keyMap = d;
155
+ }
156
+ get _locale() {
157
+ return i(this, this.locale);
158
+ }
159
+ get _week() {
160
+ return w(this._locale, this.firstDay);
161
+ }
124
162
  connectedCallback() {
125
- super.connectedCallback(), this.setHostAttribute("role", "group"), this.setHostAttribute("aria-label", "Calendar"), this._didInit || (this._didInit = !0, this._initView());
163
+ super.connectedCallback(), this.setHostAttribute("role", "group"), this._name(), this._didInit || (this._didInit = !0, this._initView());
164
+ }
165
+ _name() {
166
+ o(this, a(this, "calendar.label"), (e, t) => this.setHostAttribute(e, t));
126
167
  }
127
168
  updated(e) {
128
- super.updated(e), e.has("value") && this._syncViewToValue();
169
+ this._name(), super.updated(e), e.has("value") && this._syncViewToValue();
129
170
  }
130
171
  _initView() {
131
- let e = d(this.value);
172
+ let e = _(this.value);
132
173
  if (e) this._viewYear = e[0], this._viewMonth = e[1], this._focusDate = this.value;
133
174
  else {
134
175
  let e = /* @__PURE__ */ new Date();
135
- this._viewYear = e.getFullYear(), this._viewMonth = e.getMonth(), this._focusDate = p();
176
+ this._viewYear = e.getFullYear(), this._viewMonth = e.getMonth(), this._focusDate = y();
136
177
  }
137
178
  this._yearsPageStart = this._viewYear - this._viewYear % 12;
138
179
  }
139
180
  _syncViewToValue() {
140
- let e = d(this.value);
181
+ let e = _(this.value);
141
182
  e && (this._viewYear = e[0], this._viewMonth = e[1], this._focusDate = this.value, this._yearsPageStart = this._viewYear - this._viewYear % 12, this.requestUpdate());
142
183
  }
143
184
  render() {
144
185
  return this._view === "years" ? this._renderYears() : this._view === "months" ? this._renderMonths() : this._renderDays();
145
186
  }
146
187
  _renderDays() {
147
- let e = this._getDayNames(), t = this._buildDayCells(), n = Array.from({ length: t.length / 7 }, (e, n) => t.slice(n * 7, n * 7 + 7)), r = this._getMonthName(this._viewMonth);
148
- return s`
188
+ let e = this._getDayNames(), t = this._buildDayCells(), n = Array.from({ length: t.length / 7 }, (e, n) => t.slice(n * 7, n * 7 + 7)), r = E(this._locale), i = T(this._locale, { dateStyle: "full" }), o = T(this._locale, {
189
+ month: "long",
190
+ year: "numeric"
191
+ }).format(new Date(this._viewYear, this._viewMonth, 1));
192
+ return p`
149
193
  <div class="void-calendar-header">
150
194
  <button
151
195
  type="button"
152
196
  class="void-calendar-nav"
153
- aria-label="Previous month"
197
+ aria-label=${a(this, "calendar.previousMonth")}
154
198
  ?disabled=${this.disabled}
155
199
  @click=${this._prevMonth}
156
200
  >
@@ -159,41 +203,41 @@ var v = class extends n(e) {
159
203
  <button
160
204
  type="button"
161
205
  class="void-calendar-title"
162
- aria-label="Switch to month picker"
206
+ aria-label=${a(this, "calendar.chooseMonth")}
163
207
  ?disabled=${this.disabled}
164
208
  @click=${this._showMonths}
165
- >${r} ${this._viewYear}</button>
209
+ >${o}</button>
166
210
  <button
167
211
  type="button"
168
212
  class="void-calendar-nav"
169
- aria-label="Next month"
213
+ aria-label=${a(this, "calendar.nextMonth")}
170
214
  ?disabled=${this.disabled}
171
215
  @click=${this._nextMonth}
172
216
  >
173
217
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>
174
218
  </button>
175
219
  </div>
176
- <div class="void-calendar-grid" role="grid" aria-label="${r} ${this._viewYear}" @keydown=${this._onDayKeydown}>
220
+ <div class="void-calendar-grid" role="grid" aria-label="${o}" @keydown=${this._onDayKeydown}>
177
221
  <div class="void-calendar-weekdays" role="row">
178
- ${e.map((e) => s`<div class="void-calendar-weekday" role="columnheader" aria-label=${e.long}>${e.short}</div>`)}
222
+ ${e.map((e) => p`<div class="void-calendar-weekday" role="columnheader" aria-label=${e.long}>${e.short}</div>`)}
179
223
  </div>
180
224
  <div class="void-calendar-days" role="rowgroup">
181
- ${n.map((e) => s`
225
+ ${n.map((e) => p`
182
226
  <div class="void-calendar-week" role="row">
183
227
  ${e.map((e) => {
184
- let t = e.iso === this.value, n = e.iso === p(), r = this.disabled || e.disabled;
185
- return s`
228
+ let t = e.iso === this.value, n = e.iso === y(), a = this.disabled || e.disabled;
229
+ return p`
186
230
  <div class="void-calendar-cell" role="gridcell" aria-selected=${t ? "true" : "false"}>
187
231
  <button
188
232
  type="button"
189
233
  class="void-calendar-day${t ? " selected" : ""}${n ? " today" : ""}${e.outside ? " outside" : ""}"
190
- ?disabled=${r}
191
- aria-label=${this._formatFullDate(e.iso)}
192
- aria-current=${n ? "date" : c}
234
+ ?disabled=${a}
235
+ aria-label=${this._formatFullDate(e.iso, i)}
236
+ aria-current=${n ? "date" : m}
193
237
  tabindex=${e.iso === this._focusDate ? "0" : "-1"}
194
238
  data-date=${e.iso}
195
239
  @click=${() => this._selectDate(e.iso)}
196
- >${e.day}</button>
240
+ >${r.format(e.day)}</button>
197
241
  </div>
198
242
  `;
199
243
  })}
@@ -203,19 +247,19 @@ var v = class extends n(e) {
203
247
  </div>
204
248
  `;
205
249
  }
206
- _formatFullDate(e) {
207
- let t = d(e);
208
- if (!t) return e;
250
+ _formatFullDate(e, t) {
251
+ let n = _(e);
252
+ if (!n) return e;
209
253
  try {
210
- return new Intl.DateTimeFormat(this.locale, { dateStyle: "full" }).format(new Date(t[0], t[1], t[2]));
254
+ return t.format(new Date(n[0], n[1], n[2]));
211
255
  } catch {
212
256
  return e;
213
257
  }
214
258
  }
215
259
  _getDayNames() {
216
- let e = new Intl.DateTimeFormat(this.locale, { weekday: "short" }), t = new Intl.DateTimeFormat(this.locale, { weekday: "long" }), n = [];
260
+ let e = T(this._locale, { weekday: "short" }), t = T(this._locale, { weekday: "long" }), n = [];
217
261
  for (let r = 0; r < 7; r++) {
218
- let i = new Date(2024, 0, 7 + (this.firstDay + r) % 7);
262
+ let i = new Date(2024, 0, 7 + (this._week + r) % 7);
219
263
  n.push({
220
264
  short: e.format(i),
221
265
  long: t.format(i)
@@ -223,13 +267,10 @@ var v = class extends n(e) {
223
267
  }
224
268
  return n;
225
269
  }
226
- _getMonthName(e) {
227
- return new Intl.DateTimeFormat(this.locale, { month: "long" }).format(new Date(2024, e, 1));
228
- }
229
270
  _buildDayCells() {
230
- let e = this._viewYear, t = this._viewMonth, n = m(e, t), r = (new Date(e, t, 1).getDay() - this.firstDay + 7) % 7, i = [], a = t === 0 ? 11 : t - 1, o = t === 0 ? e - 1 : e, s = m(o, a);
271
+ let e = this._viewYear, t = this._viewMonth, n = b(e, t), r = (new Date(e, t, 1).getDay() - this._week + 7) % 7, i = [], a = t === 0 ? 11 : t - 1, o = t === 0 ? e - 1 : e, s = b(o, a);
231
272
  for (let e = r - 1; e >= 0; e--) {
232
- let t = s - e, n = f(o, a, t);
273
+ let t = s - e, n = v(o, a, t);
233
274
  i.push({
234
275
  day: t,
235
276
  iso: n,
@@ -238,7 +279,7 @@ var v = class extends n(e) {
238
279
  });
239
280
  }
240
281
  for (let r = 1; r <= n; r++) {
241
- let n = f(e, t, r);
282
+ let n = v(e, t, r);
242
283
  i.push({
243
284
  day: r,
244
285
  iso: n,
@@ -248,7 +289,7 @@ var v = class extends n(e) {
248
289
  }
249
290
  let c = t === 11 ? 0 : t + 1, l = t === 11 ? e + 1 : e, u = 42 - i.length;
250
291
  for (let e = 1; e <= u; e++) {
251
- let t = f(l, c, e);
292
+ let t = v(l, c, e);
252
293
  i.push({
253
294
  day: e,
254
295
  iso: t,
@@ -262,16 +303,16 @@ var v = class extends n(e) {
262
303
  return !!(this.min && e < this.min || this.max && e > this.max);
263
304
  }
264
305
  _renderMonths() {
265
- let e = new Intl.DateTimeFormat(this.locale, { month: "short" }), t = Array.from({ length: 12 }, (t, n) => ({
306
+ let e = T(this._locale, { month: "short" }), t = Array.from({ length: 12 }, (t, n) => ({
266
307
  index: n,
267
308
  name: e.format(new Date(2024, n, 1))
268
309
  }));
269
- return s`
310
+ return p`
270
311
  <div class="void-calendar-header">
271
312
  <button
272
313
  type="button"
273
314
  class="void-calendar-nav"
274
- aria-label="Previous year"
315
+ aria-label=${a(this, "calendar.previousYear")}
275
316
  ?disabled=${this.disabled}
276
317
  @click=${this._prevYear}
277
318
  >
@@ -280,14 +321,14 @@ var v = class extends n(e) {
280
321
  <button
281
322
  type="button"
282
323
  class="void-calendar-title"
283
- aria-label="Switch to year picker"
324
+ aria-label=${a(this, "calendar.chooseYear")}
284
325
  ?disabled=${this.disabled}
285
326
  @click=${this._showYears}
286
- >${this._viewYear}</button>
327
+ >${E(this._locale).format(this._viewYear)}</button>
287
328
  <button
288
329
  type="button"
289
330
  class="void-calendar-nav"
290
- aria-label="Next year"
331
+ aria-label=${a(this, "calendar.nextYear")}
291
332
  ?disabled=${this.disabled}
292
333
  @click=${this._nextYear}
293
334
  >
@@ -295,7 +336,7 @@ var v = class extends n(e) {
295
336
  </button>
296
337
  </div>
297
338
  <div class="void-calendar-months">
298
- ${t.map((e) => s`
339
+ ${t.map((e) => p`
299
340
  <button
300
341
  type="button"
301
342
  class="void-calendar-month${e.index === this._viewMonth && this._viewYear === (/* @__PURE__ */ new Date()).getFullYear() ? " current" : ""}"
@@ -308,22 +349,22 @@ var v = class extends n(e) {
308
349
  }
309
350
  _renderYears() {
310
351
  let e = this._yearsPageStart, t = Array.from({ length: 12 }, (t, n) => e + n), n = (/* @__PURE__ */ new Date()).getFullYear();
311
- return s`
352
+ return p`
312
353
  <div class="void-calendar-header">
313
354
  <button
314
355
  type="button"
315
356
  class="void-calendar-nav"
316
- aria-label="Previous years"
357
+ aria-label=${a(this, "calendar.previousYears")}
317
358
  ?disabled=${this.disabled}
318
359
  @click=${this._prevYearsPage}
319
360
  >
320
361
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"></polyline></svg>
321
362
  </button>
322
- <span class="void-calendar-title void-calendar-title--static">${e} – ${e + 11}</span>
363
+ <span class="void-calendar-title void-calendar-title--static">${E(this._locale).format(e)} – ${E(this._locale).format(e + 11)}</span>
323
364
  <button
324
365
  type="button"
325
366
  class="void-calendar-nav"
326
- aria-label="Next years"
367
+ aria-label=${a(this, "calendar.nextYears")}
327
368
  ?disabled=${this.disabled}
328
369
  @click=${this._nextYearsPage}
329
370
  >
@@ -331,13 +372,13 @@ var v = class extends n(e) {
331
372
  </button>
332
373
  </div>
333
374
  <div class="void-calendar-years">
334
- ${t.map((e) => s`
375
+ ${t.map((e) => p`
335
376
  <button
336
377
  type="button"
337
378
  class="void-calendar-year${e === n ? " current" : ""}"
338
379
  ?disabled=${this.disabled}
339
380
  @click=${() => this._pickYear(e)}
340
- >${e}</button>
381
+ >${E(this._locale).format(e)}</button>
341
382
  `)}
342
383
  </div>
343
384
  `;
@@ -346,12 +387,12 @@ var v = class extends n(e) {
346
387
  this._viewMonth = e, this._view = "days", this._syncFocusToView(), this.requestUpdate();
347
388
  }
348
389
  _syncFocusToView() {
349
- let e = d(this._focusDate) ?? [
390
+ let e = _(this._focusDate) ?? [
350
391
  this._viewYear,
351
392
  this._viewMonth,
352
393
  1
353
- ], t = Math.min(e[2], m(this._viewYear, this._viewMonth));
354
- this._focusDate = h(f(this._viewYear, this._viewMonth, t), this.min || void 0, this.max || void 0);
394
+ ], t = Math.min(e[2], b(this._viewYear, this._viewMonth));
395
+ this._focusDate = x(v(this._viewYear, this._viewMonth, t), this.min || void 0, this.max || void 0);
355
396
  }
356
397
  _pickYear(e) {
357
398
  this._viewYear = e, this._yearsPageStart = e - e % 12, this._view = "months", this.requestUpdate();
@@ -359,7 +400,7 @@ var v = class extends n(e) {
359
400
  _selectDate(e) {
360
401
  if (this.disabled || this._isOutOfRange(e)) return;
361
402
  this.value = e, this._focusDate = e;
362
- let t = d(e);
403
+ let t = _(e);
363
404
  this._viewYear = t[0], this._viewMonth = t[1], this._view = "days", this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
364
405
  bubbles: !0,
365
406
  composed: !0,
@@ -370,22 +411,25 @@ var v = class extends n(e) {
370
411
  }));
371
412
  }
372
413
  };
373
- t([l({
414
+ t([h({
415
+ attribute: "keys",
416
+ converter: r
417
+ })], D.prototype, "keys", void 0), t([h({
374
418
  type: String,
375
419
  reflect: !0
376
- })], v.prototype, "value", void 0), t([l({ type: String })], v.prototype, "min", void 0), t([l({ type: String })], v.prototype, "max", void 0), t([l({
420
+ })], D.prototype, "value", void 0), t([h({ type: String })], D.prototype, "min", void 0), t([h({ type: String })], D.prototype, "max", void 0), t([h({
377
421
  type: Boolean,
378
422
  reflect: !0
379
- })], v.prototype, "disabled", void 0), t([l({
423
+ })], D.prototype, "disabled", void 0), t([h({
380
424
  type: String,
381
425
  reflect: !0
382
- })], v.prototype, "size", void 0), t([l({ type: String })], v.prototype, "locale", void 0), t([l({
426
+ })], D.prototype, "size", void 0), t([h({ type: String })], D.prototype, "locale", void 0), t([h({
383
427
  attribute: "first-day",
384
428
  type: Number
385
- })], v.prototype, "firstDay", void 0), customElements.get("void-calendar") || customElements.define("void-calendar", v);
386
- var y = class extends n(e) {
429
+ })], D.prototype, "firstDay", void 0), customElements.get("void-calendar") || customElements.define("void-calendar", D);
430
+ var O = class extends s(e) {
387
431
  constructor(...e) {
388
- super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this.open = !1, this.placeholder = "Select date", this.format = "MM/DD/YYYY", this.color = "default", this.error = "", this._draft = null, this._rejected = null, this._ownError = "", this._errorId = i("void-date-picker-error"), this._dropdownId = i("void-date-picker-dialog"), this._overlay = new o(this, {
432
+ super(...e), this.keys = null, this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "", this.firstDay = null, this.open = !1, this.placeholder = "", this.format = "MM/DD/YYYY", this.color = "default", this.error = "", this._draft = null, this._rejected = null, this._ownError = "", this._errorId = l("void-date-picker-error"), this._dropdownId = l("void-date-picker-dialog"), this._overlay = new f(this, {
389
433
  kind: "dialog",
390
434
  surface: () => this.querySelector(":scope > .void-date-picker-dropdown"),
391
435
  isOpen: () => this.open,
@@ -412,9 +456,9 @@ var y = class extends n(e) {
412
456
  this._draft = null, this._accept(), this._setTyped("");
413
457
  return;
414
458
  }
415
- let t = _(e, this.format), n = t ? this.min && t < this.min ? { rangeUnderflow: !0 } : this.max && t > this.max ? { rangeOverflow: !0 } : null : { badInput: !0 };
459
+ let t = C(e, this.format), n = t ? this.min && t < this.min ? { rangeUnderflow: !0 } : this.max && t > this.max ? { rangeOverflow: !0 } : null : { badInput: !0 };
416
460
  if (n || !t) {
417
- let e = n?.rangeUnderflow ? `Choose ${g(this.min, this.format)} or a later date.` : n?.rangeOverflow ? `Choose ${g(this.max, this.format)} or an earlier date.` : `Enter a date as ${this.format} or YYYY-MM-DD.`;
461
+ let e = n?.rangeUnderflow ? a(this, "datePicker.tooEarly", { date: S(this.min, this.format) }) : n?.rangeOverflow ? a(this, "datePicker.tooLate", { date: S(this.max, this.format) }) : a(this, "datePicker.invalid", { format: this.format });
418
462
  this._rejected = {
419
463
  flags: n ?? { badInput: !0 },
420
464
  message: e
@@ -429,12 +473,19 @@ var y = class extends n(e) {
429
473
  detail: e.detail
430
474
  }));
431
475
  }, this._onInputKeydown = (e) => {
432
- e.key === "Enter" && this._draft !== null && this._draft.trim() !== this._display ? (e.preventDefault(), this._commit(), !this._rejected && this.open && this._overlay.requestClose("select")) : e.key === "Enter" || e.key === " " && this._draft === null ? (e.preventDefault(), this.disabled || this._overlay.toggle("keyboard")) : e.key === "ArrowDown" && !this.disabled && (e.preventDefault(), this.open ? this._focusDay() : this._overlay.requestOpen("keyboard"));
476
+ let t = n(this, e);
477
+ t === "activate" && e.key === "Enter" && this._draft !== null && this._draft.trim() !== this._display ? (e.preventDefault(), this._commit(), !this._rejected && this.open && this._overlay.requestClose("select")) : t === "activate" && (e.key !== " " || this._draft === null) ? (e.preventDefault(), this.disabled || this._overlay.toggle("keyboard")) : t === "open" && !this.disabled && (e.preventDefault(), this.open ? this._focusDay() : this._overlay.requestOpen("keyboard"));
433
478
  };
434
479
  }
480
+ static {
481
+ this.keyMap = u;
482
+ }
435
483
  static {
436
484
  this.labelTarget = ".void-date-picker-input";
437
485
  }
486
+ get _hint() {
487
+ return this.placeholder || a(this, "datePicker.placeholder");
488
+ }
438
489
  static {
439
490
  this.clientState = { _draft: "value" };
440
491
  }
@@ -446,22 +497,22 @@ var y = class extends n(e) {
446
497
  e && (await e.updateComplete, this.open && e.querySelector("[tabindex=\"0\"]")?.focus({ preventScroll: !0 }));
447
498
  }
448
499
  render() {
449
- let e = this.value ? g(this.value, this.format) : "", t = this._rejected && this.error === this._ownError ? this.error : "";
450
- return s`
500
+ let e = this.value ? S(this.value, this.format) : "", t = this._rejected && this.error === this._ownError ? this.error : "";
501
+ return p`
451
502
  <div class="void-date-picker-anchor">
452
503
  <input
453
504
  class="void-date-picker-input"
454
- .value=${u(this._draft ?? e)}
455
- placeholder=${this.placeholder}
505
+ .value=${g(this._draft ?? e)}
506
+ placeholder=${this._hint}
456
507
  ?disabled=${this.disabled}
457
508
  autocomplete="off"
458
509
  role="combobox"
459
- aria-label=${this.placeholder}
510
+ aria-label=${this._hint}
460
511
  aria-haspopup="dialog"
461
512
  aria-expanded=${String(this.open)}
462
513
  aria-controls=${this._dropdownId}
463
- aria-invalid=${this.error ? "true" : c}
464
- aria-describedby=${t ? this._errorId : c}
514
+ aria-invalid=${this.error ? "true" : m}
515
+ aria-describedby=${t ? this._errorId : m}
465
516
  @input=${this._onInput}
466
517
  @blur=${this._commit}
467
518
  @click=${this._onInputClick}
@@ -470,7 +521,7 @@ var y = class extends n(e) {
470
521
  <button
471
522
  type="button"
472
523
  class="void-date-picker-icon"
473
- aria-label="Toggle calendar"
524
+ aria-label=${a(this, "datePicker.toggle")}
474
525
  ?disabled=${this.disabled}
475
526
  tabindex="-1"
476
527
  @click=${this._toggle}
@@ -483,25 +534,25 @@ var y = class extends n(e) {
483
534
  </svg>
484
535
  </button>
485
536
  </div>
486
- ${t ? s`<span class="void-date-picker-error" id=${this._errorId} role="alert">${t}</span>` : c}
487
- ${this.open ? s`
488
- <div class="void-date-picker-dropdown" id=${this._dropdownId} role="dialog" aria-label="Choose date" popover="manual">
537
+ ${t ? p`<span class="void-date-picker-error" id=${this._errorId} role="alert">${t}</span>` : m}
538
+ ${this.open ? p`
539
+ <div class="void-date-picker-dropdown" id=${this._dropdownId} role="dialog" aria-label=${a(this, "datePicker.dialog")} popover="manual">
489
540
  <void-calendar
490
541
  value=${this.value}
491
542
  min=${this.min}
492
543
  max=${this.max}
493
544
  ?disabled=${this.disabled}
494
545
  size=${this.size}
495
- locale=${this.locale}
496
- first-day=${this.firstDay}
546
+ locale=${this.locale || m}
547
+ first-day=${this.firstDay ?? m}
497
548
  @void-change=${this._onCalendarChange}
498
549
  ></void-calendar>
499
550
  </div>
500
- ` : c}
551
+ ` : m}
501
552
  `;
502
553
  }
503
554
  get _display() {
504
- return this.value ? g(this.value, this.format) : "";
555
+ return this.value ? S(this.value, this.format) : "";
505
556
  }
506
557
  _accept(e = !0) {
507
558
  this._rejected = null, this._ownError && this.error === this._ownError && (this.error = ""), this._ownError = "", e && this.requestUpdate();
@@ -509,7 +560,7 @@ var y = class extends n(e) {
509
560
  _setTyped(e) {
510
561
  if (e === this.value) return;
511
562
  this.value = e;
512
- let t = d(e);
563
+ let t = _(e);
513
564
  this.dispatchEvent(new CustomEvent("void-change", {
514
565
  bubbles: !0,
515
566
  composed: !0,
@@ -533,27 +584,30 @@ var y = class extends n(e) {
533
584
  super.willUpdate(e), e.has("value") && (this._draft = null, this._rejected && this._accept(!1));
534
585
  }
535
586
  };
536
- t([l({
587
+ t([h({
588
+ attribute: "keys",
589
+ converter: r
590
+ })], O.prototype, "keys", void 0), t([h({
537
591
  type: String,
538
592
  reflect: !0
539
- })], y.prototype, "value", void 0), t([l({ type: String })], y.prototype, "min", void 0), t([l({ type: String })], y.prototype, "max", void 0), t([l({
593
+ })], O.prototype, "value", void 0), t([h({ type: String })], O.prototype, "min", void 0), t([h({ type: String })], O.prototype, "max", void 0), t([h({
540
594
  type: Boolean,
541
595
  reflect: !0
542
- })], y.prototype, "disabled", void 0), t([l({
596
+ })], O.prototype, "disabled", void 0), t([h({
543
597
  type: String,
544
598
  reflect: !0
545
- })], y.prototype, "size", void 0), t([l({ type: String })], y.prototype, "locale", void 0), t([l({
599
+ })], O.prototype, "size", void 0), t([h({ type: String })], O.prototype, "locale", void 0), t([h({
546
600
  attribute: "first-day",
547
601
  type: Number
548
- })], y.prototype, "firstDay", void 0), t([l({
602
+ })], O.prototype, "firstDay", void 0), t([h({
549
603
  type: Boolean,
550
604
  reflect: !0
551
- })], y.prototype, "open", void 0), t([l({ type: String })], y.prototype, "placeholder", void 0), t([l({ type: String })], y.prototype, "format", void 0), t([l({
605
+ })], O.prototype, "open", void 0), t([h({ type: String })], O.prototype, "placeholder", void 0), t([h({ type: String })], O.prototype, "format", void 0), t([h({
552
606
  type: String,
553
607
  reflect: !0
554
- })], y.prototype, "color", void 0), t([l({
608
+ })], O.prototype, "color", void 0), t([h({
555
609
  type: String,
556
610
  reflect: !0
557
- })], y.prototype, "error", void 0), customElements.get("void-date-picker") || customElements.define("void-date-picker", y);
611
+ })], O.prototype, "error", void 0), customElements.get("void-date-picker") || customElements.define("void-date-picker", O);
558
612
  //#endregion
559
- export { v as VoidCalendar, y as VoidDatePicker };
613
+ export { D as VoidCalendar, O as VoidDatePicker };