@nocoo/basalt 2.1.0 → 2.1.7

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 (80) hide show
  1. package/ai/COMPATIBILITY.md +1 -1
  2. package/ai/INTEGRATION.md +17 -1
  3. package/ai/USAGE.md +1 -1
  4. package/ai/registry.json +80 -80
  5. package/dist/assets/brand-mark.d.ts +1 -1
  6. package/dist/assets/brand-mark.js +1 -1
  7. package/dist/assets/brand-mark.js.map +1 -1
  8. package/dist/charts/charts.d.ts +1 -1
  9. package/dist/charts/charts.js +3 -16
  10. package/dist/charts/charts.js.map +1 -1
  11. package/dist/charts/custom-chart.d.ts +1 -1
  12. package/dist/charts/custom-chart.js +3 -16
  13. package/dist/charts/custom-chart.js.map +1 -1
  14. package/dist/charts/grouped-bar.d.ts +1 -1
  15. package/dist/charts/grouped-bar.js +11 -48
  16. package/dist/charts/grouped-bar.js.map +1 -1
  17. package/dist/charts/heatmap-calendar.js +80 -136
  18. package/dist/charts/heatmap-calendar.js.map +1 -1
  19. package/dist/charts/slot-bar.js +2 -12
  20. package/dist/charts/slot-bar.js.map +1 -1
  21. package/dist/charts/stat-card.js +2 -7
  22. package/dist/charts/stat-card.js.map +1 -1
  23. package/dist/charts/timeseries.d.ts +1 -1
  24. package/dist/charts/timeseries.js +3 -16
  25. package/dist/charts/timeseries.js.map +1 -1
  26. package/dist/charts/tooltip.js +13 -51
  27. package/dist/charts/tooltip.js.map +1 -1
  28. package/dist/components/app-shell.js +2 -2
  29. package/dist/components/app-shell.js.map +1 -1
  30. package/dist/components/autocomplete.d.ts +1 -1
  31. package/dist/components/autocomplete.js +3 -16
  32. package/dist/components/autocomplete.js.map +1 -1
  33. package/dist/components/badge.js +6 -6
  34. package/dist/components/badge.js.map +1 -1
  35. package/dist/components/banner.js +28 -28
  36. package/dist/components/banner.js.map +1 -1
  37. package/dist/components/button.js +6 -7
  38. package/dist/components/button.js.map +1 -1
  39. package/dist/components/chat-composer.js +1 -2
  40. package/dist/components/chat-composer.js.map +1 -1
  41. package/dist/components/checkbox.js +50 -82
  42. package/dist/components/checkbox.js.map +1 -1
  43. package/dist/components/code.js +1 -1
  44. package/dist/components/code.js.map +1 -1
  45. package/dist/components/combobox.d.ts +1 -1
  46. package/dist/components/combobox.js +3 -16
  47. package/dist/components/combobox.js.map +1 -1
  48. package/dist/components/context-menu.d.ts +1 -67
  49. package/dist/components/context-menu.js.map +1 -1
  50. package/dist/components/data-table.js +111 -123
  51. package/dist/components/data-table.js.map +1 -1
  52. package/dist/components/date-picker.js +236 -245
  53. package/dist/components/date-picker.js.map +1 -1
  54. package/dist/components/dock.js +15 -16
  55. package/dist/components/dock.js.map +1 -1
  56. package/dist/components/field.js +20 -23
  57. package/dist/components/field.js.map +1 -1
  58. package/dist/components/layer-card.d.ts +1 -1
  59. package/dist/components/layer-card.js +44 -51
  60. package/dist/components/layer-card.js.map +1 -1
  61. package/dist/components/sidebar.js +3 -3
  62. package/dist/components/sidebar.js.map +1 -1
  63. package/dist/components/skeleton-line.d.ts +2 -2
  64. package/dist/components/skeleton-line.js +1 -1
  65. package/dist/components/skeleton-line.js.map +1 -1
  66. package/dist/components/switch.js +46 -78
  67. package/dist/components/switch.js.map +1 -1
  68. package/dist/providers/accent.js +89 -198
  69. package/dist/providers/accent.js.map +1 -1
  70. package/dist/providers/theme.js +46 -144
  71. package/dist/providers/theme.js.map +1 -1
  72. package/dist/styles/standalone.css +12 -24
  73. package/dist/styles/tokens.css +6 -6
  74. package/dist/utils/preference-store.d.ts +16 -0
  75. package/dist/utils/preference-store.js +106 -0
  76. package/dist/utils/preference-store.js.map +1 -0
  77. package/dist/utils/use-checkable-group.d.ts +19 -0
  78. package/dist/utils/use-checkable-group.js +61 -0
  79. package/dist/utils/use-checkable-group.js.map +1 -0
  80. package/package.json +1 -2
@@ -48,13 +48,13 @@ function te(e) {
48
48
  m: r,
49
49
  d: 1
50
50
  };
51
- return w(i) ? i : null;
51
+ return C(i) ? i : null;
52
52
  }
53
- function y(e) {
53
+ function ne(e) {
54
54
  return `${String(e.y).padStart(4, "0")}-${m(e.m)}`;
55
55
  }
56
- var ne = "appearance-none border-0 bg-transparent p-0 font-inherit text-inherit cursor-pointer";
57
- function b(e) {
56
+ var re = "appearance-none border-0 bg-transparent p-0 font-inherit text-inherit cursor-pointer";
57
+ function y(e) {
58
58
  let t = new Intl.DateTimeFormat("en-CA", {
59
59
  timeZone: e,
60
60
  year: "numeric",
@@ -67,59 +67,59 @@ function b(e) {
67
67
  d: n("day")
68
68
  };
69
69
  }
70
- function re(e, t, n) {
70
+ function ie(e, t, n) {
71
71
  return new Intl.DateTimeFormat(t, {
72
72
  ...n,
73
73
  timeZone: "UTC",
74
74
  calendar: "gregory"
75
75
  }).format(g(e));
76
76
  }
77
- function ie(e) {
77
+ function ae(e) {
78
78
  return e % 4 == 0 && e % 100 != 0 || e % 400 == 0;
79
79
  }
80
- function x(e, t) {
81
- return t === 2 ? ie(e) ? 29 : 28 : t === 4 || t === 6 || t === 9 || t === 11 ? 30 : 31;
80
+ function b(e, t) {
81
+ return t === 2 ? ae(e) ? 29 : 28 : t === 4 || t === 6 || t === 9 || t === 11 ? 30 : 31;
82
82
  }
83
- function ae(e, t) {
83
+ function oe(e, t) {
84
84
  let n = e.y * 12 + (e.m - 1) + t, r = Math.floor(n / 12);
85
85
  if (r < 1) return null;
86
- let i = (n % 12 + 12) % 12 + 1, a = x(r, i), o = {
86
+ let i = (n % 12 + 12) % 12 + 1, a = b(r, i), o = {
87
87
  y: r,
88
88
  m: i,
89
89
  d: Math.min(e.d, a)
90
90
  };
91
- return w(o) ? o : null;
91
+ return C(o) ? o : null;
92
92
  }
93
- function oe({ mode: e, selectedDate: t, rangeFrom: n, rangeTo: r, locale: i, formatDate: a, placeholder: o = "Pick a date" }) {
93
+ function se({ mode: e, selectedDate: t, rangeFrom: n, rangeTo: r, locale: i, formatDate: a, placeholder: o = "Pick a date" }) {
94
94
  function s(e) {
95
95
  let t = v(e);
96
- return t ? a?.(_(t)) ?? re(t, i, { dateStyle: "medium" }) : e;
96
+ return t ? a?.(_(t)) ?? ie(t, i, { dateStyle: "medium" }) : e;
97
97
  }
98
- return e === "range" ? n ? r ? `${s(n)} – ${s(r)}` : `${s(n)} – …` : o : t ? a?.(_(t)) ?? re(t, i, { dateStyle: "medium" }) : o;
98
+ return e === "range" ? n ? r ? `${s(n)} – ${s(r)}` : `${s(n)} – …` : o : t ? a?.(_(t)) ?? ie(t, i, { dateStyle: "medium" }) : o;
99
99
  }
100
- function S(e, t) {
100
+ function x(e, t) {
101
101
  return e.y === t.y ? e.m === t.m ? e.d - t.d : e.m - t.m : e.y - t.y;
102
102
  }
103
- function C(e, t, n) {
103
+ function S(e, t, n) {
104
104
  let r = v(e), i = t ? v(t) : null, a = n ? v(n) : null;
105
- return !(!r || i && S(r, i) < 0 || a && S(r, a) > 0);
105
+ return !(!r || i && x(r, i) < 0 || a && x(r, a) > 0);
106
106
  }
107
- function se(e, t, n, r) {
108
- return C(e, t, n) && !r?.(e);
107
+ function ce(e, t, n, r) {
108
+ return S(e, t, n) && !r?.(e);
109
109
  }
110
- function ce(e, t, n) {
110
+ function le(e, t, n) {
111
111
  let r = t ? v(t) : null, i = n ? v(n) : null;
112
- return r && S(e, r) < 0 ? r : i && S(e, i) > 0 ? i : e;
112
+ return r && x(e, r) < 0 ? r : i && x(e, i) > 0 ? i : e;
113
113
  }
114
- function w(e) {
114
+ function C(e) {
115
115
  if (!Number.isFinite(e.y) || e.m < 1 || e.m > 12 || e.d < 1 || e.d > 31) return !1;
116
116
  let t = g(e);
117
117
  return !Number.isNaN(t.getTime()) && t.getUTCFullYear() === e.y && t.getUTCMonth() + 1 === e.m && t.getUTCDate() === e.d;
118
118
  }
119
- function T(e) {
119
+ function w(e) {
120
120
  return e ? h(e) : "";
121
121
  }
122
- function E(e, t) {
122
+ function T(e, t) {
123
123
  let n = g(e);
124
124
  if (Number.isNaN(n.getTime()) || (n.setUTCDate(n.getUTCDate() + t), Number.isNaN(n.getTime()))) return null;
125
125
  let r = {
@@ -127,96 +127,96 @@ function E(e, t) {
127
127
  m: n.getUTCMonth() + 1,
128
128
  d: n.getUTCDate()
129
129
  };
130
- return w(r) ? r : null;
130
+ return C(r) ? r : null;
131
131
  }
132
- function le(e, t) {
132
+ function ue(e, t) {
133
133
  let n = e.y * 12 + (e.m - 1) + t, r = {
134
134
  y: Math.floor(n / 12),
135
135
  m: n % 12 + 1,
136
136
  d: 1
137
137
  };
138
- return w(r) ? r : null;
138
+ return C(r) ? r : null;
139
139
  }
140
- function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", month: C, defaultMonth: D, onMonthChange: ue, rangeValue: O, defaultRangeValue: de, onRangeChange: fe, isDisabledDate: pe, presets: me, locale: he = "en-US", weekStartsOn: k = 0, timeZone: A, formatDate: ge, name: _e, required: ve, min: j, max: M, disabled: N, className: ye, id: P, "aria-label": F, "aria-describedby": be, "aria-invalid": xe, labels: I, ...Se }) {
141
- let { ref: L, readOnly: R, autoFocus: Ce, onFocus: we, onBlur: Te, onInvalid: Ee, "aria-labelledby": De, ...Oe } = Se, [ke, Ae] = u(_), [je, Me] = u(de ?? {
140
+ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", month: S, defaultMonth: E, onMonthChange: de, rangeValue: D, defaultRangeValue: fe, onRangeChange: pe, isDisabledDate: me, presets: he, locale: ge = "en-US", weekStartsOn: O = 0, timeZone: k, formatDate: _e, name: ve, required: ye, min: A, max: j, disabled: M, className: be, id: N, "aria-label": P, "aria-describedby": xe, "aria-invalid": Se, labels: F, ...Ce }) {
141
+ let { ref: I, readOnly: L, autoFocus: we, onFocus: Te, onBlur: Ee, onInvalid: De, "aria-labelledby": Oe, ...ke } = Ce, [Ae, je] = u(_), [Me, Ne] = u(fe ?? {
142
142
  from: "",
143
143
  to: void 0
144
- }), [z, B] = u(!1), [Ne, Pe] = u(!1), [Fe, Ie] = u(""), [Le, Re] = u(0), V = l([]), H = l(null), U = l(!1), W = l(null), ze = l(null), Be = a.useId(), Ve = P ? `${P}-error` : Be, He = a.useId(), Ue = P ? `${P}-month-live` : He, We = a.useId(), Ge = P ? `${P}-keyboard-instructions` : We, Ke = m ?? ke, qe = O ?? je, G = v(x === "range" ? qe.to || qe.from || "" : Ke), K = G ? h(G) : "";
144
+ }), [R, z] = u(!1), [Pe, Fe] = u(!1), [Ie, Le] = u(""), [Re, ze] = u(0), B = l([]), V = l(null), H = l(!1), U = l(null), Be = l(null), Ve = a.useId(), He = N ? `${N}-error` : Ve, Ue = a.useId(), We = N ? `${N}-month-live` : Ue, Ge = a.useId(), Ke = N ? `${N}-keyboard-instructions` : Ge, qe = m ?? Ae, Je = D ?? Me, W = v(b === "range" ? Je.to || Je.from || "" : qe), G = W ? h(W) : "";
145
145
  o(() => {
146
- K && (Pe(!1), Ie(""));
147
- }, [K]);
148
- let q = x === "range" ? "" : K, Je = c(() => te(C), [C]), Ye = Je !== null, [Xe, Ze] = u(() => {
149
- let e = te(D);
146
+ G && (Fe(!1), Le(""));
147
+ }, [G]);
148
+ let K = b === "range" ? "" : G, Ye = c(() => te(S), [S]), Xe = Ye !== null, [Ze, Qe] = u(() => {
149
+ let e = te(E);
150
150
  if (e) return e;
151
- let t = ce(G ?? b(A), j, M);
151
+ let t = le(W ?? y(k), A, j);
152
152
  return {
153
153
  y: t.y,
154
154
  m: t.m,
155
155
  d: 1
156
156
  };
157
- }), J = Je ?? Xe, Qe = y(J), $e = (e) => {
158
- let t = y(e);
159
- Ye || Ze(e), ue?.(t);
160
- }, et = l(K);
161
- if (z && et.current !== K && (U.current = !0, C === void 0 && D === void 0)) {
162
- let e = G ?? b(A);
163
- (J.y !== e.y || J.m !== e.m) && Ze({
157
+ }), q = Ye ?? Ze, $e = ne(q), et = (e) => {
158
+ let t = ne(e);
159
+ Xe || Qe(e), de?.(t);
160
+ }, tt = l(G);
161
+ if (R && tt.current !== G && (H.current = !0, S === void 0 && E === void 0)) {
162
+ let e = W ?? y(k);
163
+ (q.y !== e.y || q.m !== e.m) && Qe({
164
164
  y: e.y,
165
165
  m: e.m,
166
166
  d: 1
167
167
  });
168
168
  }
169
- et.current = K;
170
- let tt = C !== void 0 || D !== void 0;
169
+ tt.current = G;
170
+ let nt = S !== void 0 || E !== void 0;
171
171
  o(() => {
172
- if (z && !tt) {
173
- let e = ce((K ? v(K) : null) ?? b(A), j, M);
174
- Ze({
172
+ if (R && !nt) {
173
+ let e = le((G ? v(G) : null) ?? y(k), A, j);
174
+ Qe({
175
175
  y: e.y,
176
176
  m: e.m,
177
177
  d: 1
178
- }), K || (U.current = !0);
178
+ }), G || (H.current = !0);
179
179
  }
180
180
  }, [
181
- z,
182
- K,
181
+ R,
182
+ G,
183
+ k,
183
184
  A,
184
185
  j,
185
- M,
186
- tt
186
+ nt
187
187
  ]), o(() => {
188
- N && B(!1);
189
- }, [N]), o(() => {
190
- Ce && ze.current?.focus();
191
- }, [Ce]);
192
- let nt = l({
188
+ M && z(!1);
189
+ }, [M]), o(() => {
190
+ we && Be.current?.focus();
191
+ }, [we]);
192
+ let rt = l({
193
193
  defaultValue: _,
194
- defaultRangeValue: de,
195
- mode: x,
196
- rangeValue: O,
194
+ defaultRangeValue: fe,
195
+ mode: b,
196
+ rangeValue: D,
197
197
  value: m
198
198
  });
199
199
  o(() => {
200
- nt.current = {
200
+ rt.current = {
201
201
  defaultValue: _,
202
- defaultRangeValue: de,
203
- mode: x,
204
- rangeValue: O,
202
+ defaultRangeValue: fe,
203
+ mode: b,
204
+ rangeValue: D,
205
205
  value: m
206
206
  };
207
207
  });
208
- let rt = Oe.form;
208
+ let it = ke.form;
209
209
  o(() => {
210
- let e = W.current?.form;
211
- if (!e || rt && e.id !== rt) return;
210
+ let e = U.current?.form;
211
+ if (!e || it && e.id !== it) return;
212
212
  let t = !1, n = /* @__PURE__ */ new Set(), r = (e) => {
213
213
  let r = setTimeout(() => {
214
214
  if (n.delete(r), t || e.defaultPrevented) return;
215
- let i = nt.current;
216
- (i.mode === "range" ? i.rangeValue === void 0 : i.value === void 0) && (Ae(i.defaultValue), Me(i.defaultRangeValue ?? {
215
+ let i = rt.current;
216
+ (i.mode === "range" ? i.rangeValue === void 0 : i.value === void 0) && (je(i.defaultValue), Ne(i.defaultRangeValue ?? {
217
217
  from: "",
218
218
  to: void 0
219
- })), Pe(!1), Ie(""), B(!1);
219
+ })), Fe(!1), Le(""), z(!1);
220
220
  }, 0);
221
221
  n.add(r);
222
222
  };
@@ -225,82 +225,97 @@ function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", m
225
225
  for (let e of n) clearTimeout(e);
226
226
  n.clear(), e.removeEventListener("reset", r);
227
227
  };
228
- }, [rt]);
229
- let it = c(() => {
230
- let e = new Intl.DateTimeFormat(he, {
228
+ }, [it]);
229
+ let at = c(() => {
230
+ let e = new Intl.DateTimeFormat(ge, {
231
231
  weekday: "short",
232
232
  timeZone: "UTC"
233
233
  });
234
234
  return Array.from({ length: 7 }, (t, n) => {
235
- let r = new Date(Date.UTC(2024, 0, 7 + (n + k) % 7));
235
+ let r = new Date(Date.UTC(2024, 0, 7 + (n + O) % 7));
236
236
  return e.format(r);
237
237
  });
238
- }, [he, k]), Y = c(() => {
238
+ }, [ge, O]), J = c(() => {
239
239
  let e = {
240
- y: J.y,
241
- m: J.m,
240
+ y: q.y,
241
+ m: q.m,
242
242
  d: 1
243
243
  };
244
- if (!w(e)) return Array.from({ length: 42 }, () => null);
245
- let t = (g(e).getUTCDay() - k + 7) % 7, n = E(e, -t);
246
- return n ? Array.from({ length: 42 }, (e, t) => E(n, t)) : Array.from({ length: 42 }, (n, r) => E(e, r - t));
247
- }, [J, k]);
244
+ if (!C(e)) return Array.from({ length: 42 }, () => null);
245
+ let t = (g(e).getUTCDay() - O + 7) % 7, n = T(e, -t);
246
+ return n ? Array.from({ length: 42 }, (e, t) => T(n, t)) : Array.from({ length: 42 }, (n, r) => T(e, r - t));
247
+ }, [q, O]);
248
248
  s(() => {
249
- if (!z) return;
250
- let e = H.current, t = 0;
249
+ if (!R) return;
250
+ let e = V.current, t = 0;
251
251
  if (e) {
252
- if (e.targetMonthKey === Qe) H.current = null, t = Y.findIndex((t) => T(t) === e.iso), t < 0 && (t = 0), U.current = !0;
252
+ if (e.targetMonthKey === $e) V.current = null, t = J.findIndex((t) => w(t) === e.iso), t < 0 && (t = 0), H.current = !0;
253
253
  else {
254
- let e = document.activeElement, n = e instanceof HTMLElement && V.current.some((t) => t === e) ? e.getAttribute("aria-label") : null, r = n ? Y.findIndex((e) => T(e) === n) : -1;
255
- t = r >= 0 ? r : Le;
254
+ let e = document.activeElement, n = e instanceof HTMLElement && B.current.some((t) => t === e) ? e.getAttribute("aria-label") : null, r = n ? J.findIndex((e) => w(e) === n) : -1;
255
+ t = r >= 0 ? r : Re;
256
256
  }
257
257
  } else {
258
- let e = document.activeElement, n = !U.current && e instanceof HTMLElement && V.current.some((t) => t === e) ? e.getAttribute("aria-label") : null, r = n ? Y.findIndex((e) => T(e) === n) : -1;
258
+ let e = document.activeElement, n = !H.current && e instanceof HTMLElement && B.current.some((t) => t === e) ? e.getAttribute("aria-label") : null, r = n ? J.findIndex((e) => w(e) === n) : -1;
259
259
  if (r >= 0) t = r;
260
260
  else {
261
- let e = K || q || h(b(A)), n = Y.findIndex((t) => T(t) === e);
262
- if (n >= 0 && Y[n]?.m === J.m) t = n;
261
+ let e = G || K || h(y(k)), n = J.findIndex((t) => w(t) === e);
262
+ if (n >= 0 && J[n]?.m === q.m) t = n;
263
263
  else {
264
- let e = Y.findIndex((e) => e?.m === J.m);
264
+ let e = J.findIndex((e) => e?.m === q.m);
265
265
  t = e >= 0 ? e : 0;
266
266
  }
267
267
  }
268
268
  }
269
- let n = (e) => !!(e && e.y >= 1 && se(h(e), j, M, pe));
270
- if (!n(Y[t] ?? null)) {
271
- let e = Y.findIndex((e) => e?.m === J.m && n(e)), r = Y.findIndex((e) => n(e));
269
+ let n = (e) => !!(e && e.y >= 1 && ce(h(e), A, j, me));
270
+ if (!n(J[t] ?? null)) {
271
+ let e = J.findIndex((e) => e?.m === q.m && n(e)), r = J.findIndex((e) => n(e));
272
272
  t = e >= 0 ? e : r >= 0 ? r : t;
273
273
  }
274
- Re(t), U.current && (U.current = !1, V.current[t]?.focus());
274
+ ze(t), H.current && (H.current = !1, B.current[t]?.focus());
275
275
  }, [
276
- z,
276
+ R,
277
+ G,
277
278
  K,
278
- q,
279
+ k,
280
+ J,
281
+ q.m,
282
+ $e,
283
+ Re,
279
284
  A,
280
- Y,
281
- J.m,
282
- Qe,
283
- Le,
284
285
  j,
285
- M,
286
- pe
286
+ me
287
287
  ]);
288
- let X = le(J, -1), at = le(J, 1), Z = x === "range" ? qe.from : "", Q = x === "range" ? qe.to : void 0, ot = oe({
289
- mode: x,
290
- selectedDate: G,
291
- rangeFrom: Z,
292
- rangeTo: Q,
293
- locale: he,
294
- formatDate: ge,
295
- placeholder: I?.placeholder
296
- }), st = I?.calendar ?? (F ? `${F} calendar` : "Date calendar"), ct = I?.previousMonth ?? "Prev", lt = I?.nextMonth ?? "Next";
297
- function $(e) {
298
- return se(e, j, M, pe);
288
+ let Y = ue(q, -1), ot = ue(q, 1), X = b === "range" ? Je.from : "", Z = b === "range" ? Je.to : void 0, st = se({
289
+ mode: b,
290
+ selectedDate: W,
291
+ rangeFrom: X,
292
+ rangeTo: Z,
293
+ locale: ge,
294
+ formatDate: _e,
295
+ placeholder: F?.placeholder
296
+ }), ct = F?.calendar ?? (P ? `${P} calendar` : "Date calendar"), lt = F?.previousMonth ?? "Prev", ut = F?.nextMonth ?? "Next";
297
+ function Q(e) {
298
+ return ce(e, A, j, me);
299
+ }
300
+ function dt(e) {
301
+ if (e.y !== q.y || e.m !== q.m) {
302
+ V.current = {
303
+ targetMonthKey: ne(e),
304
+ iso: h(e)
305
+ }, et({
306
+ y: e.y,
307
+ m: e.m,
308
+ d: 1
309
+ });
310
+ return;
311
+ }
312
+ let t = J.findIndex((t) => w(t) === h(e));
313
+ t >= 0 && (ze(t), B.current[t]?.focus());
299
314
  }
300
- function ut(e) {
301
- if (!(N || R || !$(e))) {
302
- if (e && (Pe(!1), Ie("")), x === "range") {
303
- let t = O ?? je, n = !t.from || t.to ? { from: e } : S(v(e) ?? {
315
+ function ft(e) {
316
+ if (!(M || L || !Q(e))) {
317
+ if (e && (Fe(!1), Le("")), b === "range") {
318
+ let t = D ?? Me, n = !t.from || t.to ? { from: e } : x(v(e) ?? {
304
319
  y: 1,
305
320
  m: 1,
306
321
  d: 1
@@ -315,75 +330,75 @@ function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", m
315
330
  from: t.from,
316
331
  to: e
317
332
  };
318
- O === void 0 && Me(n), fe?.(n), n.to && B(!1);
333
+ D === void 0 && Ne(n), pe?.(n), n.to && z(!1);
319
334
  return;
320
335
  }
321
- m === void 0 && Ae(e), B(!1), ie?.(e);
336
+ m === void 0 && je(e), z(!1), ae?.(e);
322
337
  }
323
338
  }
324
- function dt(e) {
325
- if (!(N || R)) {
339
+ function pt(e) {
340
+ if (!(M || L)) {
326
341
  if (typeof e.value == "string") {
327
- if (x === "range") {
328
- if (!$(e.value)) return;
342
+ if (b === "range") {
343
+ if (!Q(e.value)) return;
329
344
  let t = {
330
345
  from: e.value,
331
346
  to: e.value
332
347
  };
333
- O === void 0 && Me(t), fe?.(t), B(!1);
348
+ D === void 0 && Ne(t), pe?.(t), z(!1);
334
349
  return;
335
350
  }
336
- ut(e.value);
351
+ ft(e.value);
337
352
  return;
338
353
  }
339
- if (x === "range") {
340
- if (!$(e.value.from) || !$(e.value.to)) return;
341
- O === void 0 && Me(e.value), fe?.(e.value), B(!1);
354
+ if (b === "range") {
355
+ if (!Q(e.value.from) || !Q(e.value.to)) return;
356
+ D === void 0 && Ne(e.value), pe?.(e.value), z(!1);
342
357
  }
343
358
  }
344
359
  }
345
- let ft = a.useCallback((e) => {
346
- if (W.current = e, L) {
347
- if (typeof L == "function") {
348
- let t = L(e);
360
+ let mt = a.useCallback((e) => {
361
+ if (U.current = e, I) {
362
+ if (typeof I == "function") {
363
+ let t = I(e);
349
364
  return typeof t == "function" ? () => {
350
- W.current = null, t();
365
+ U.current = null, t();
351
366
  } : () => {
352
- W.current = null, L(null);
367
+ U.current = null, I(null);
353
368
  };
354
369
  }
355
- return L.current = e, () => {
356
- W.current = null, L.current = null;
370
+ return I.current = e, () => {
371
+ U.current = null, I.current = null;
357
372
  };
358
373
  }
359
- }, [L]), pt = xe ?? (Ne || void 0), mt = pt === !0 || pt === "true" || pt === "grammar" || pt === "spelling", ht = [be, Ne && Ve ? Ve : void 0].filter(Boolean).join(" ") || void 0;
374
+ }, [I]), $ = Se ?? (Pe || void 0), ht = $ === !0 || $ === "true" || $ === "grammar" || $ === "spelling", gt = [xe, Pe && He ? He : void 0].filter(Boolean).join(" ") || void 0;
360
375
  return /* @__PURE__ */ p(n, {
361
- open: z,
376
+ open: R,
362
377
  onOpenChange: (e) => {
363
- if (!(e && N)) {
378
+ if (!(e && M)) {
364
379
  if (e) {
365
- if (H.current = null, C === void 0 && D === void 0) {
366
- let e = (K ? v(K) : null) ?? b(A);
367
- Ze({
380
+ if (V.current = null, S === void 0 && E === void 0) {
381
+ let e = (G ? v(G) : null) ?? y(k);
382
+ Qe({
368
383
  y: e.y,
369
384
  m: e.m,
370
385
  d: 1
371
386
  });
372
387
  }
373
- U.current = !0;
374
- } else H.current = null;
375
- B(e);
388
+ H.current = !0;
389
+ } else V.current = null;
390
+ z(e);
376
391
  }
377
392
  },
378
393
  children: [
379
394
  /* @__PURE__ */ f("input", {
380
- ref: ft,
381
- type: x === "range" ? "text" : "date",
382
- name: _e,
383
- required: ve,
384
- readOnly: R,
385
- min: x === "range" ? void 0 : j,
386
- max: x === "range" ? void 0 : M,
395
+ ref: mt,
396
+ type: b === "range" ? "text" : "date",
397
+ name: ve,
398
+ required: ye,
399
+ readOnly: L,
400
+ min: b === "range" ? void 0 : A,
401
+ max: b === "range" ? void 0 : j,
387
402
  className: "sr-only mb-2 h-7",
388
403
  style: {
389
404
  position: "absolute",
@@ -392,65 +407,65 @@ function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", m
392
407
  overflow: "hidden",
393
408
  clip: "rect(0, 0, 0, 0)"
394
409
  },
395
- value: x === "range" ? Z && Q ? `${Z}/${Q}` : "" : q,
410
+ value: b === "range" ? X && Z ? `${X}/${Z}` : "" : K,
396
411
  onChange: () => void 0,
397
412
  onInvalid: (e) => {
398
- Ee?.(e), e.defaultPrevented || (e.preventDefault(), Pe(!0), Ie(I?.validationMessage || e.target.validationMessage || "Please fill out this field."), ze.current?.focus());
413
+ De?.(e), e.defaultPrevented || (e.preventDefault(), Fe(!0), Le(F?.validationMessage || e.target.validationMessage || "Please fill out this field."), Be.current?.focus());
399
414
  },
400
- disabled: N,
415
+ disabled: M,
401
416
  "aria-hidden": "true",
402
417
  tabIndex: -1,
403
- ...Oe
418
+ ...ke
404
419
  }),
405
420
  /* @__PURE__ */ f(i, {
406
421
  asChild: !0,
407
422
  children: /* @__PURE__ */ f(t, {
408
423
  type: "button",
409
- ref: ze,
410
- id: P,
424
+ ref: Be,
425
+ id: N,
411
426
  variant: "outline",
412
- disabled: N,
413
- onFocus: we,
414
- onBlur: Te,
415
- "aria-labelledby": De,
416
- "aria-label": F ? ot === "Pick a date" ? F : `${F}: ${ot}` : void 0,
417
- "aria-describedby": ht,
418
- "aria-invalid": pt,
419
- className: e("justify-start font-normal", mt && "border-basalt-destructive text-basalt-destructive", ye),
420
- children: ot
427
+ disabled: M,
428
+ onFocus: Te,
429
+ onBlur: Ee,
430
+ "aria-labelledby": Oe,
431
+ "aria-label": P ? st === "Pick a date" ? P : `${P}: ${st}` : void 0,
432
+ "aria-describedby": gt,
433
+ "aria-invalid": $,
434
+ className: e("justify-start font-normal", ht && "border-basalt-destructive text-basalt-destructive", be),
435
+ children: st
421
436
  })
422
437
  }),
423
- Ne && Fe ? /* @__PURE__ */ f("span", {
424
- id: Ve,
438
+ Pe && Ie ? /* @__PURE__ */ f("span", {
439
+ id: He,
425
440
  role: "alert",
426
441
  className: "mt-1 block text-xs text-basalt-destructive",
427
- children: Fe
442
+ children: Ie
428
443
  }) : null,
429
444
  /* @__PURE__ */ p(r, {
430
445
  arrow: !1,
431
446
  className: "w-64 p-3",
432
- "aria-label": st,
433
- "aria-describedby": Ge,
447
+ "aria-label": ct,
448
+ "aria-describedby": Ke,
434
449
  onOpenAutoFocus: (e) => {
435
450
  e.preventDefault();
436
- let t = K || q || h(b(A)), n = Y.findIndex((e) => T(e) === t), r = (e) => !!(e && e.y >= 1 && se(h(e), j, M, pe)), i = n >= 0 && Y[n]?.m === J.m ? n : Math.max(0, Y.findIndex((e) => e?.m === J.m));
437
- if (!r(Y[i] ?? null)) {
438
- let e = Y.findIndex((e) => e?.m === J.m && r(e)), t = Y.findIndex((e) => r(e));
451
+ let t = G || K || h(y(k)), n = J.findIndex((e) => w(e) === t), r = (e) => !!(e && e.y >= 1 && ce(h(e), A, j, me)), i = n >= 0 && J[n]?.m === q.m ? n : Math.max(0, J.findIndex((e) => e?.m === q.m));
452
+ if (!r(J[i] ?? null)) {
453
+ let e = J.findIndex((e) => e?.m === q.m && r(e)), t = J.findIndex((e) => r(e));
439
454
  i = e >= 0 ? e : t >= 0 ? t : i;
440
455
  }
441
456
  queueMicrotask(() => {
442
- V.current[i]?.focus();
457
+ B.current[i]?.focus();
443
458
  });
444
459
  },
445
460
  children: [
446
- me && me.length > 0 ? /* @__PURE__ */ f("div", {
461
+ he && he.length > 0 ? /* @__PURE__ */ f("div", {
447
462
  className: "mb-2 flex flex-wrap gap-1",
448
- children: me.map((e) => /* @__PURE__ */ f(t, {
463
+ children: he.map((e) => /* @__PURE__ */ f(t, {
449
464
  type: "button",
450
465
  variant: "ghost",
451
466
  className: "h-7 px-2 text-xs",
452
- disabled: N || R,
453
- onClick: () => dt(e),
467
+ disabled: M || L,
468
+ onClick: () => pt(e),
454
469
  children: e.label
455
470
  }, e.label))
456
471
  }) : null,
@@ -462,19 +477,19 @@ function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", m
462
477
  variant: "ghost",
463
478
  size: "icon",
464
479
  icon: /* @__PURE__ */ f(ee, {}),
465
- "aria-label": ct,
480
+ "aria-label": lt,
466
481
  className: "size-8",
467
- disabled: N || !X || X.y < 1,
482
+ disabled: M || !Y || Y.y < 1,
468
483
  onClick: () => {
469
- !X || X.y < 1 || (H.current = null, U.current = !1, $e(X));
484
+ !Y || Y.y < 1 || (V.current = null, H.current = !1, et(Y));
470
485
  }
471
486
  }),
472
487
  /* @__PURE__ */ f("span", {
473
- id: Ue,
488
+ id: We,
474
489
  "aria-live": "polite",
475
490
  "aria-atomic": "true",
476
491
  className: "text-sm font-medium",
477
- children: re(J, he, {
492
+ children: ie(q, ge, {
478
493
  month: "long",
479
494
  year: "numeric"
480
495
  })
@@ -484,83 +499,59 @@ function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", m
484
499
  variant: "ghost",
485
500
  size: "icon",
486
501
  icon: /* @__PURE__ */ f(d, {}),
487
- "aria-label": lt,
502
+ "aria-label": ut,
488
503
  className: "size-8",
489
- disabled: N || !at,
504
+ disabled: M || !ot,
490
505
  onClick: () => {
491
- at && (H.current = null, U.current = !1, $e(at));
506
+ ot && (V.current = null, H.current = !1, et(ot));
492
507
  }
493
508
  })
494
509
  ]
495
510
  }),
496
511
  /* @__PURE__ */ f("p", {
497
- id: Ge,
512
+ id: Ke,
498
513
  className: "sr-only",
499
- children: I?.keyboardInstructions ?? "Use arrow keys to navigate dates, PageUp and PageDown to change months, and Enter or Space to select."
514
+ children: F?.keyboardInstructions ?? "Use arrow keys to navigate dates, PageUp and PageDown to change months, and Enter or Space to select."
500
515
  }),
501
516
  /* @__PURE__ */ p("table", {
502
517
  role: "grid",
503
- "aria-labelledby": Ue,
504
- "aria-multiselectable": x === "range" ? "true" : void 0,
518
+ "aria-labelledby": We,
519
+ "aria-multiselectable": b === "range" ? "true" : void 0,
505
520
  className: "w-full border-collapse text-center",
506
521
  onKeyDown: (e) => {
507
- let t = Y[Le];
522
+ let t = J[Re];
508
523
  if (t) {
509
524
  if (e.key === "ArrowRight" || e.key === "ArrowLeft" || e.key === "ArrowDown" || e.key === "ArrowUp") {
510
525
  e.preventDefault();
511
- let n = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : e.key === "ArrowDown" ? 7 : -7, r = E(t, n);
512
- for (let e = 0; r && r.y >= 1 && !$(h(r)) && e < 42; e += 1) r = E(r, n);
513
- if (!r || r.y < 1 || !$(h(r))) return;
514
- if (r.y !== J.y || r.m !== J.m) {
515
- H.current = {
516
- targetMonthKey: y(r),
517
- iso: h(r)
518
- }, $e({
519
- y: r.y,
520
- m: r.m,
521
- d: 1
522
- });
523
- return;
524
- }
525
- let i = Y.findIndex((e) => T(e) === h(r));
526
- i >= 0 && (Re(i), V.current[i]?.focus());
526
+ let n = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : e.key === "ArrowDown" ? 7 : -7, r = T(t, n);
527
+ for (let e = 0; r && r.y >= 1 && !Q(h(r)) && e < 42; e += 1) r = T(r, n);
528
+ if (!r || r.y < 1 || !Q(h(r))) return;
529
+ dt(r);
527
530
  return;
528
531
  }
529
532
  if (e.key === "Home" || e.key === "End") {
530
533
  e.preventDefault();
531
- let n = (g(t).getUTCDay() - k + 7) % 7, r = E(t, e.key === "Home" ? -n : 6 - n), i = e.key === "Home" ? 1 : -1;
532
- for (let e = 0; r && r.y >= 1 && !$(h(r)) && e < 7; e += 1) r = E(r, i);
533
- if (!r || r.y < 1 || !$(h(r))) return;
534
- if (r.y !== J.y || r.m !== J.m) {
535
- H.current = {
536
- targetMonthKey: y(r),
537
- iso: h(r)
538
- }, $e({
539
- y: r.y,
540
- m: r.m,
541
- d: 1
542
- });
543
- return;
544
- }
545
- let a = Y.findIndex((e) => T(e) === h(r));
546
- a >= 0 && (Re(a), V.current[a]?.focus());
534
+ let n = (g(t).getUTCDay() - O + 7) % 7, r = T(t, e.key === "Home" ? -n : 6 - n), i = e.key === "Home" ? 1 : -1;
535
+ for (let e = 0; r && r.y >= 1 && !Q(h(r)) && e < 7; e += 1) r = T(r, i);
536
+ if (!r || r.y < 1 || !Q(h(r))) return;
537
+ dt(r);
547
538
  return;
548
539
  }
549
540
  if (e.key === "PageDown" || e.key === "PageUp") {
550
541
  e.preventDefault();
551
- let n = ae(t, e.shiftKey ? e.key === "PageDown" ? 12 : -12 : e.key === "PageDown" ? 1 : -1);
542
+ let n = oe(t, e.shiftKey ? e.key === "PageDown" ? 12 : -12 : e.key === "PageDown" ? 1 : -1);
552
543
  if (!n) return;
553
544
  let r = n;
554
- for (let e = 0; r && r.y >= 1 && !$(h(r)) && e < 42; e += 1) r = E(r, 1);
555
- if (!r || r.y < 1 || !$(h(r))) {
545
+ for (let e = 0; r && r.y >= 1 && !Q(h(r)) && e < 42; e += 1) r = T(r, 1);
546
+ if (!r || r.y < 1 || !Q(h(r))) {
556
547
  r = n;
557
- for (let e = 0; r && r.y >= 1 && !$(h(r)) && e < 42; e += 1) r = E(r, -1);
548
+ for (let e = 0; r && r.y >= 1 && !Q(h(r)) && e < 42; e += 1) r = T(r, -1);
558
549
  }
559
- if (!r || r.y < 1 || !$(h(r))) return;
560
- H.current = {
561
- targetMonthKey: y(r),
550
+ if (!r || r.y < 1 || !Q(h(r))) return;
551
+ V.current = {
552
+ targetMonthKey: ne(r),
562
553
  iso: h(r)
563
- }, $e({
554
+ }, et({
564
555
  y: r.y,
565
556
  m: r.m,
566
557
  d: 1
@@ -570,24 +561,24 @@ function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", m
570
561
  if (e.key === "Enter" || e.key === " ") {
571
562
  e.preventDefault();
572
563
  let n = h(t);
573
- t.y >= 1 && $(n) && ut(n);
564
+ t.y >= 1 && Q(n) && ft(n);
574
565
  }
575
566
  }
576
567
  },
577
- children: [/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ f("tr", { children: it.map((e, t) => /* @__PURE__ */ f("th", {
568
+ children: [/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ f("tr", { children: at.map((e, t) => /* @__PURE__ */ f("th", {
578
569
  scope: "col",
579
570
  className: "h-8 text-center text-xs font-medium text-basalt-muted-foreground",
580
571
  children: e
581
- }, `${e}-${t}`)) }) }), /* @__PURE__ */ f("tbody", { children: Array.from({ length: 6 }, (t, n) => /* @__PURE__ */ f("tr", { children: Y.slice(n * 7, n * 7 + 7).map((t, r) => {
572
+ }, `${e}-${t}`)) }) }), /* @__PURE__ */ f("tbody", { children: Array.from({ length: 6 }, (t, n) => /* @__PURE__ */ f("tr", { children: J.slice(n * 7, n * 7 + 7).map((t, r) => {
582
573
  let i = n * 7 + r;
583
574
  if (!t) return /* @__PURE__ */ f("td", {
584
575
  role: "gridcell",
585
576
  className: "h-8 p-0 text-center",
586
577
  ref: () => {
587
- V.current[i] = null;
578
+ B.current[i] = null;
588
579
  }
589
580
  }, `empty-${i}`);
590
- let a = h(t), o = t.m === J.m, s = t.y >= 1 && $(a), c = Z ? v(Z) : null, l = Q ? v(Q) : null, u = v(a), ee = !!(c && l && u && S(u, c) >= 0 && S(u, l) <= 0), d = a === Z || a === Q, p = x === "range" ? ee || d : !!q && a === q;
581
+ let a = h(t), o = t.m === q.m, s = t.y >= 1 && Q(a), c = X ? v(X) : null, l = Z ? v(Z) : null, u = v(a), ee = !!(c && l && u && x(u, c) >= 0 && x(u, l) <= 0), d = a === X || a === Z, p = b === "range" ? ee || d : !!K && a === K;
591
582
  return /* @__PURE__ */ f("td", {
592
583
  role: "gridcell",
593
584
  "aria-selected": p ? "true" : void 0,
@@ -595,15 +586,15 @@ function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", m
595
586
  children: /* @__PURE__ */ f("button", {
596
587
  type: "button",
597
588
  ref: (e) => {
598
- V.current[i] = e;
589
+ B.current[i] = e;
599
590
  },
600
- tabIndex: i === Le ? 0 : -1,
591
+ tabIndex: i === Re ? 0 : -1,
601
592
  "data-date": a,
602
593
  "aria-label": a,
603
- "aria-pressed": x === "range" ? d : p,
604
- disabled: N || R || !s,
605
- className: e(ne, "mx-auto flex h-8 w-8 items-center justify-center rounded-basalt-md text-sm", o ? "text-basalt-foreground" : "text-basalt-muted-foreground", s && "hover:bg-basalt-accent", ee && !d && "bg-basalt-accent", s && (x === "range" ? d : p) && "bg-basalt-primary text-basalt-primary-foreground hover:bg-basalt-primary/90"),
606
- onClick: () => s && ut(a),
594
+ "aria-pressed": b === "range" ? d : p,
595
+ disabled: M || L || !s,
596
+ className: e(re, "mx-auto flex h-8 w-8 items-center justify-center rounded-basalt-md text-sm", o ? "text-basalt-foreground" : "text-basalt-muted-foreground", s && "hover:bg-basalt-accent", ee && !d && "bg-basalt-accent", s && (b === "range" ? d : p) && "bg-basalt-primary text-basalt-primary-foreground hover:bg-basalt-primary/90"),
597
+ onClick: () => s && ft(a),
607
598
  children: t.d
608
599
  })
609
600
  }, a);
@@ -615,6 +606,6 @@ function D({ value: m, defaultValue: _ = "", onChange: ie, mode: x = "single", m
615
606
  });
616
607
  }
617
608
  //#endregion
618
- export { D as DatePicker };
609
+ export { E as DatePicker };
619
610
 
620
611
  //# sourceMappingURL=date-picker.js.map