asterui 0.12.63 → 0.12.65

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.
@@ -1,8 +1,8 @@
1
- import { jsxs as f, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as J, useState as m, useRef as P, useEffect as Y } from "react";
3
- import { Input as V } from "./Input.js";
4
- import { useConfig as G } from "../providers/ConfigProvider.js";
5
- const M = "btn", y = "btn-ghost", S = "btn-sm", F = "btn-square", H = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], W = [
1
+ import { jsxs as F, jsx as l } from "react/jsx-runtime";
2
+ import we, { forwardRef as be, useState as Y, useRef as ee, useEffect as O } from "react";
3
+ import { Input as ve } from "./Input.js";
4
+ import { useConfig as ye } from "../providers/ConfigProvider.js";
5
+ const z = "btn", L = "btn-ghost", I = "btn-sm", te = "btn-square", Me = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], $e = [
6
6
  "January",
7
7
  "February",
8
8
  "March",
@@ -16,175 +16,497 @@ const M = "btn", y = "btn-ghost", S = "btn-sm", F = "btn-square", H = ["Su", "Mo
16
16
  "November",
17
17
  "December"
18
18
  ];
19
- function K(o, n = "MM/DD/YYYY") {
19
+ function Z(o, a = "MM/DD/YYYY") {
20
20
  if (!o) return "";
21
- const h = o.getFullYear(), d = String(o.getMonth() + 1).padStart(2, "0"), g = String(o.getDate()).padStart(2, "0");
22
- return n.replace("YYYY", String(h)).replace("MM", d).replace("DD", g);
21
+ const h = o.getFullYear(), x = String(o.getMonth() + 1).padStart(2, "0"), B = String(o.getDate()).padStart(2, "0");
22
+ return a.replace("YYYY", String(h)).replace("MM", x).replace("DD", B);
23
23
  }
24
- function Q(o, n) {
25
- return new Date(o, n + 1, 0).getDate();
24
+ function ne(o, a) {
25
+ return new Date(o, a + 1, 0).getDate();
26
26
  }
27
- function U(o, n) {
28
- return new Date(o, n, 1).getDay();
27
+ function xe(o, a) {
28
+ return new Date(o, a, 1).getDay();
29
29
  }
30
- const te = J(function({
31
- value: n,
30
+ function re(o) {
31
+ return new Date(o.getFullYear(), o.getMonth(), o.getDate());
32
+ }
33
+ function _(o, a) {
34
+ return o.getFullYear() === a.getFullYear() && o.getMonth() === a.getMonth() && o.getDate() === a.getDate();
35
+ }
36
+ function De(o, a) {
37
+ return re(o).getTime() < re(a).getTime();
38
+ }
39
+ function Ye(o, a) {
40
+ return re(o).getTime() > re(a).getTime();
41
+ }
42
+ function ae(o, a) {
43
+ const h = new Date(o);
44
+ return h.setDate(h.getDate() + a), h;
45
+ }
46
+ function Se(o, a = "MM/DD/YYYY") {
47
+ const [h, x] = o;
48
+ return h && x ? `${Z(h, a)} - ${Z(x, a)}` : h ? `${Z(h, a)} - ` : "";
49
+ }
50
+ const ke = be(function({
51
+ value: a,
32
52
  defaultValue: h,
33
- onChange: d,
34
- format: g,
35
- placeholder: k = "Select date",
36
- disabled: x = !1,
37
- size: C,
38
- "data-testid": p,
39
- className: O = "",
40
- ...R
41
- }, z) {
42
- const { componentSize: B } = G(), T = C ?? B ?? "md", N = (e) => p ? `${p}-${e}` : void 0, [a, b] = m(
43
- n || h || null
44
- ), [c, u] = m(!1), [r, i] = m(
45
- a ? a.getMonth() : (/* @__PURE__ */ new Date()).getMonth()
46
- ), [l, v] = m(
47
- a ? a.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear()
48
- ), w = P(null);
49
- Y(() => {
50
- n !== void 0 && b(n);
51
- }, [n]), Y(() => {
52
- function e(s) {
53
- w.current && !w.current.contains(s.target) && u(!1);
53
+ onChange: x,
54
+ format: B,
55
+ placeholder: R,
56
+ disabledDate: d,
57
+ disabled: v = !1,
58
+ size: oe,
59
+ "data-testid": T,
60
+ className: se = "",
61
+ ...le
62
+ }, ce) {
63
+ const { componentSize: ie, locale: j } = ye(), ue = oe ?? ie ?? "md", U = R ?? j?.DatePicker?.placeholder ?? "Select date", G = j?.DatePicker?.today ?? "Today", q = /* @__PURE__ */ new Date(), de = v || d?.(q), W = (e) => T ? `${T}-${e}` : void 0, [p, K] = Y(
64
+ a || h || null
65
+ ), [y, m] = Y(!1), [i, M] = Y(null), [u, c] = Y(
66
+ p ? p.getMonth() : (/* @__PURE__ */ new Date()).getMonth()
67
+ ), [D, P] = Y(
68
+ p ? p.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear()
69
+ ), f = ee(null), k = ee(null), w = we.useId();
70
+ O(() => {
71
+ a !== void 0 && K(a);
72
+ }, [a]), O(() => {
73
+ function e(n) {
74
+ f.current && !f.current.contains(n.target) && m(!1);
75
+ }
76
+ if (y)
77
+ return document.addEventListener("mousedown", e), M(p ?? q), () => document.removeEventListener("mousedown", e);
78
+ }, [y]), O(() => {
79
+ if (!y || !k.current) return;
80
+ k.current.querySelector('[data-calendar-focus="true"]')?.focus();
81
+ }, [y, u, D, i]);
82
+ const A = (e) => {
83
+ const n = new Date(D, u, e);
84
+ v || d?.(n) || (K(n), x?.(n), m(!1));
85
+ }, N = (e, n) => {
86
+ let $ = ae(e, n);
87
+ for (let b = 0; b < 31; b++) {
88
+ if (!d?.($)) return $;
89
+ $ = ae($, n);
54
90
  }
55
- if (c)
56
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
57
- }, [c]);
58
- const j = (e) => {
59
- const s = new Date(l, r, e);
60
- b(s), d?.(s), u(!1);
61
- }, L = () => {
62
- r === 0 ? (i(11), v(l - 1)) : i(r - 1);
63
- }, q = () => {
64
- r === 11 ? (i(0), v(l + 1)) : i(r + 1);
65
- }, A = Q(l, r), E = U(l, r), D = [];
66
- for (let e = 0; e < E; e++)
67
- D.push(null);
68
- for (let e = 1; e <= A; e++)
69
- D.push(e);
70
- const $ = (e) => !e || !a ? !1 : a.getDate() === e && a.getMonth() === r && a.getFullYear() === l, I = (e) => {
91
+ return e;
92
+ }, V = (e) => {
93
+ if (!i) return;
94
+ let n = i;
95
+ switch (e.key) {
96
+ case "ArrowRight":
97
+ e.preventDefault(), n = N(i, 1);
98
+ break;
99
+ case "ArrowLeft":
100
+ e.preventDefault(), n = N(i, -1);
101
+ break;
102
+ case "ArrowDown":
103
+ e.preventDefault(), n = N(i, 7);
104
+ break;
105
+ case "ArrowUp":
106
+ e.preventDefault(), n = N(i, -7);
107
+ break;
108
+ case "Home":
109
+ e.preventDefault(), n = new Date(i.getFullYear(), i.getMonth(), 1), d?.(n) && (n = N(n, 1));
110
+ break;
111
+ case "End":
112
+ e.preventDefault(), n = new Date(i.getFullYear(), i.getMonth(), ne(i.getFullYear(), i.getMonth())), d?.(n) && (n = N(n, -1));
113
+ break;
114
+ case "Enter":
115
+ case " ":
116
+ e.preventDefault(), A(i.getDate());
117
+ return;
118
+ case "Escape":
119
+ e.preventDefault(), m(!1);
120
+ return;
121
+ default:
122
+ return;
123
+ }
124
+ M(n), c(n.getMonth()), P(n.getFullYear());
125
+ }, Q = () => {
126
+ u === 0 ? (c(11), P(D - 1)) : c(u - 1);
127
+ }, X = () => {
128
+ u === 11 ? (c(0), P(D + 1)) : c(u + 1);
129
+ }, S = ne(D, u), fe = xe(D, u), H = [];
130
+ for (let e = 0; e < fe; e++)
131
+ H.push(null);
132
+ for (let e = 1; e <= S; e++)
133
+ H.push(e);
134
+ const J = (e) => !e || !p ? !1 : p.getDate() === e && p.getMonth() === u && p.getFullYear() === D, ge = (e) => {
71
135
  if (!e) return !1;
72
- const s = /* @__PURE__ */ new Date();
73
- return s.getDate() === e && s.getMonth() === r && s.getFullYear() === l;
136
+ const n = /* @__PURE__ */ new Date();
137
+ return n.getDate() === e && n.getMonth() === u && n.getFullYear() === D;
74
138
  };
75
- return /* @__PURE__ */ f("div", { ref: z || w, className: `relative ${O}`, "data-state": c ? "open" : "closed", "data-testid": p, ...R, children: [
76
- /* @__PURE__ */ t(
77
- V,
139
+ return /* @__PURE__ */ F("div", { ref: ce || f, className: `relative ${se}`, "data-state": y ? "open" : "closed", "data-testid": T, ...le, children: [
140
+ /* @__PURE__ */ l(
141
+ ve,
78
142
  {
79
- value: K(a, g),
80
- placeholder: k,
81
- disabled: x,
82
- size: T,
143
+ value: Z(p, B),
144
+ placeholder: U,
145
+ disabled: v,
146
+ size: ue,
83
147
  readOnly: !0,
84
- onClick: () => !x && u(!c),
148
+ onClick: () => !v && m(!y),
149
+ "aria-haspopup": "dialog",
150
+ "aria-expanded": y,
151
+ "aria-controls": w,
85
152
  className: "cursor-pointer",
86
- "data-testid": N("input")
153
+ "data-testid": W("input")
87
154
  }
88
155
  ),
89
- c && /* @__PURE__ */ f("div", { className: "absolute top-full left-0 mt-2 bg-base-100 border border-base-300 rounded-lg shadow-lg p-4 z-50 w-80", "data-testid": N("calendar"), children: [
90
- /* @__PURE__ */ f("div", { className: "flex items-center justify-between mb-4", children: [
91
- /* @__PURE__ */ t(
92
- "button",
93
- {
94
- type: "button",
95
- onClick: L,
96
- className: `${M} ${y} ${S} ${F}`,
97
- children: /* @__PURE__ */ t(
98
- "svg",
156
+ y && /* @__PURE__ */ F(
157
+ "div",
158
+ {
159
+ ref: k,
160
+ id: w,
161
+ role: "dialog",
162
+ "aria-label": "Date picker calendar",
163
+ className: "absolute top-full left-0 mt-2 bg-base-100 border border-base-300 rounded-lg shadow-lg p-4 z-50 w-80",
164
+ "data-testid": W("calendar"),
165
+ children: [
166
+ /* @__PURE__ */ F("div", { className: "flex items-center justify-between mb-4", children: [
167
+ /* @__PURE__ */ l(
168
+ "button",
99
169
  {
100
- xmlns: "http://www.w3.org/2000/svg",
101
- className: "h-5 w-5",
102
- viewBox: "0 0 20 20",
103
- fill: "currentColor",
104
- children: /* @__PURE__ */ t(
105
- "path",
170
+ type: "button",
171
+ onClick: Q,
172
+ className: `${z} ${L} ${I} ${te}`,
173
+ children: /* @__PURE__ */ l(
174
+ "svg",
106
175
  {
107
- fillRule: "evenodd",
108
- d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",
109
- clipRule: "evenodd"
176
+ xmlns: "http://www.w3.org/2000/svg",
177
+ className: "h-5 w-5",
178
+ viewBox: "0 0 20 20",
179
+ fill: "currentColor",
180
+ children: /* @__PURE__ */ l(
181
+ "path",
182
+ {
183
+ fillRule: "evenodd",
184
+ d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",
185
+ clipRule: "evenodd"
186
+ }
187
+ )
188
+ }
189
+ )
190
+ }
191
+ ),
192
+ /* @__PURE__ */ F("div", { className: "text-base font-semibold", children: [
193
+ $e[u],
194
+ " ",
195
+ D
196
+ ] }),
197
+ /* @__PURE__ */ l(
198
+ "button",
199
+ {
200
+ type: "button",
201
+ onClick: X,
202
+ className: `${z} ${L} ${I} ${te}`,
203
+ children: /* @__PURE__ */ l(
204
+ "svg",
205
+ {
206
+ xmlns: "http://www.w3.org/2000/svg",
207
+ className: "h-5 w-5",
208
+ viewBox: "0 0 20 20",
209
+ fill: "currentColor",
210
+ children: /* @__PURE__ */ l(
211
+ "path",
212
+ {
213
+ fillRule: "evenodd",
214
+ d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
215
+ clipRule: "evenodd"
216
+ }
217
+ )
110
218
  }
111
219
  )
112
220
  }
113
221
  )
114
- }
115
- ),
116
- /* @__PURE__ */ f("div", { className: "text-base font-semibold", children: [
117
- W[r],
118
- " ",
119
- l
120
- ] }),
121
- /* @__PURE__ */ t(
122
- "button",
123
- {
124
- type: "button",
125
- onClick: q,
126
- className: `${M} ${y} ${S} ${F}`,
127
- children: /* @__PURE__ */ t(
128
- "svg",
222
+ ] }),
223
+ /* @__PURE__ */ l("div", { className: "grid grid-cols-7 gap-1 mb-2", role: "row", children: Me.map((e) => /* @__PURE__ */ l(
224
+ "div",
225
+ {
226
+ className: "text-center text-xs font-semibold text-base-content/60 py-2",
227
+ role: "columnheader",
228
+ children: e
229
+ },
230
+ e
231
+ )) }),
232
+ /* @__PURE__ */ l("div", { className: "grid grid-cols-7 gap-1", role: "grid", onKeyDown: V, children: H.map((e, n) => {
233
+ const $ = e ? new Date(D, u, e) : null, b = v || !!$ && !!d?.($), C = !!$ && !!i && _($, i);
234
+ return /* @__PURE__ */ l(
235
+ "button",
236
+ {
237
+ type: "button",
238
+ disabled: !e || b,
239
+ "aria-disabled": b || void 0,
240
+ "aria-selected": J(e) || void 0,
241
+ role: "gridcell",
242
+ onClick: () => e && A(e),
243
+ tabIndex: C ? 0 : -1,
244
+ "data-calendar-focus": C ? "true" : void 0,
245
+ className: `
246
+ aspect-square flex items-center justify-center text-sm rounded-lg
247
+ ${e ? "" : "invisible"}
248
+ ${e && !b ? "hover:bg-base-200 cursor-pointer" : ""}
249
+ ${J(e) ? "bg-primary text-primary-content hover:bg-primary/90" : ""}
250
+ ${ge(e) && !J(e) ? "border border-primary" : ""}
251
+ ${b ? "text-base-content/30 cursor-not-allowed" : ""}
252
+ `,
253
+ children: e
254
+ },
255
+ n
256
+ );
257
+ }) }),
258
+ /* @__PURE__ */ l("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ l(
259
+ "button",
260
+ {
261
+ type: "button",
262
+ onClick: () => {
263
+ const e = /* @__PURE__ */ new Date();
264
+ d?.(e) || (K(e), c(e.getMonth()), P(e.getFullYear()), x?.(e), m(!1));
265
+ },
266
+ className: `${z} ${L} ${I}`,
267
+ disabled: de,
268
+ children: G
269
+ }
270
+ ) })
271
+ ]
272
+ }
273
+ )
274
+ ] });
275
+ }), Ne = be(function({
276
+ value: a,
277
+ defaultValue: h,
278
+ onChange: x,
279
+ format: B,
280
+ placeholder: R,
281
+ disabledDate: d,
282
+ disabled: v = !1,
283
+ size: oe,
284
+ "data-testid": T,
285
+ className: se = "",
286
+ ...le
287
+ }, ce) {
288
+ const { componentSize: ie, locale: j } = ye(), ue = oe ?? ie ?? "md", U = j?.DatePicker?.rangePlaceholder, [G, q] = Array.isArray(R) ? R : [
289
+ R ?? U?.[0] ?? "Start date",
290
+ U?.[1] ?? "End date"
291
+ ], de = Array.isArray(R) ? `${G} - ${q}` : R ?? `${G} - ${q}`, W = j?.DatePicker?.today ?? "Today", p = /* @__PURE__ */ new Date(), K = v || d?.(p), y = (t) => T ? `${T}-${t}` : void 0, [m, i] = Y(
292
+ a || h || [null, null]
293
+ ), [M, u] = Y(!1), [c, D] = Y(null), P = m[0] ?? m[1] ?? /* @__PURE__ */ new Date(), [f, k] = Y(P.getMonth()), [w, A] = Y(P.getFullYear()), N = ee(null), V = ee(null), Q = we.useId();
294
+ O(() => {
295
+ a !== void 0 && i(a);
296
+ }, [a]), O(() => {
297
+ function t(r) {
298
+ N.current && !N.current.contains(r.target) && u(!1);
299
+ }
300
+ if (M)
301
+ return document.addEventListener("mousedown", t), D(m[0] ?? m[1] ?? p), () => document.removeEventListener("mousedown", t);
302
+ }, [M]), O(() => {
303
+ if (!M || !V.current) return;
304
+ V.current.querySelector('[data-calendar-focus="true"]')?.focus();
305
+ }, [M, f, w, c]);
306
+ const X = (t) => {
307
+ const r = new Date(w, f, t);
308
+ if (v || d?.(r)) return;
309
+ let [s, g] = m;
310
+ !s || s && g ? (s = r, g = null) : s && !g && (De(r, s) ? (g = s, s = r) : g = r);
311
+ const E = [s, g];
312
+ i(E), x?.(E), s && g && u(!1);
313
+ }, S = (t, r) => {
314
+ let s = ae(t, r);
315
+ for (let g = 0; g < 31; g++) {
316
+ if (!d?.(s)) return s;
317
+ s = ae(s, r);
318
+ }
319
+ return t;
320
+ }, fe = (t) => {
321
+ if (!c) return;
322
+ let r = c;
323
+ switch (t.key) {
324
+ case "ArrowRight":
325
+ t.preventDefault(), r = S(c, 1);
326
+ break;
327
+ case "ArrowLeft":
328
+ t.preventDefault(), r = S(c, -1);
329
+ break;
330
+ case "ArrowDown":
331
+ t.preventDefault(), r = S(c, 7);
332
+ break;
333
+ case "ArrowUp":
334
+ t.preventDefault(), r = S(c, -7);
335
+ break;
336
+ case "Home":
337
+ t.preventDefault(), r = new Date(c.getFullYear(), c.getMonth(), 1), d?.(r) && (r = S(r, 1));
338
+ break;
339
+ case "End":
340
+ t.preventDefault(), r = new Date(c.getFullYear(), c.getMonth(), ne(c.getFullYear(), c.getMonth())), d?.(r) && (r = S(r, -1));
341
+ break;
342
+ case "Enter":
343
+ case " ":
344
+ t.preventDefault(), X(c.getDate());
345
+ return;
346
+ case "Escape":
347
+ t.preventDefault(), u(!1);
348
+ return;
349
+ default:
350
+ return;
351
+ }
352
+ D(r), k(r.getMonth()), A(r.getFullYear());
353
+ }, H = () => {
354
+ f === 0 ? (k(11), A(w - 1)) : k(f - 1);
355
+ }, J = () => {
356
+ f === 11 ? (k(0), A(w + 1)) : k(f + 1);
357
+ }, ge = ne(w, f), e = xe(w, f), n = [];
358
+ for (let t = 0; t < e; t++)
359
+ n.push(null);
360
+ for (let t = 1; t <= ge; t++)
361
+ n.push(t);
362
+ const $ = (t) => {
363
+ if (!t) return !1;
364
+ const r = /* @__PURE__ */ new Date();
365
+ return r.getDate() === t && r.getMonth() === f && r.getFullYear() === w;
366
+ }, [b, C] = m;
367
+ return /* @__PURE__ */ F("div", { ref: ce || N, className: `relative ${se}`, "data-state": M ? "open" : "closed", "data-testid": T, ...le, children: [
368
+ /* @__PURE__ */ l(
369
+ ve,
370
+ {
371
+ value: Se(m, B),
372
+ placeholder: de,
373
+ disabled: v,
374
+ size: ue,
375
+ readOnly: !0,
376
+ onClick: () => !v && u(!M),
377
+ "aria-haspopup": "dialog",
378
+ "aria-expanded": M,
379
+ "aria-controls": Q,
380
+ className: "cursor-pointer",
381
+ "data-testid": y("input")
382
+ }
383
+ ),
384
+ M && /* @__PURE__ */ F(
385
+ "div",
386
+ {
387
+ ref: V,
388
+ id: Q,
389
+ role: "dialog",
390
+ "aria-label": "Date range picker calendar",
391
+ className: "absolute top-full left-0 mt-2 bg-base-100 border border-base-300 rounded-lg shadow-lg p-4 z-50 w-80",
392
+ "data-testid": y("calendar"),
393
+ children: [
394
+ /* @__PURE__ */ F("div", { className: "flex items-center justify-between mb-4", children: [
395
+ /* @__PURE__ */ l(
396
+ "button",
397
+ {
398
+ type: "button",
399
+ onClick: H,
400
+ className: `${z} ${L} ${I} ${te}`,
401
+ children: /* @__PURE__ */ l(
402
+ "svg",
403
+ {
404
+ xmlns: "http://www.w3.org/2000/svg",
405
+ className: "h-5 w-5",
406
+ viewBox: "0 0 20 20",
407
+ fill: "currentColor",
408
+ children: /* @__PURE__ */ l(
409
+ "path",
410
+ {
411
+ fillRule: "evenodd",
412
+ d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",
413
+ clipRule: "evenodd"
414
+ }
415
+ )
416
+ }
417
+ )
418
+ }
419
+ ),
420
+ /* @__PURE__ */ F("div", { className: "text-base font-semibold", children: [
421
+ $e[f],
422
+ " ",
423
+ w
424
+ ] }),
425
+ /* @__PURE__ */ l(
426
+ "button",
129
427
  {
130
- xmlns: "http://www.w3.org/2000/svg",
131
- className: "h-5 w-5",
132
- viewBox: "0 0 20 20",
133
- fill: "currentColor",
134
- children: /* @__PURE__ */ t(
135
- "path",
428
+ type: "button",
429
+ onClick: J,
430
+ className: `${z} ${L} ${I} ${te}`,
431
+ children: /* @__PURE__ */ l(
432
+ "svg",
136
433
  {
137
- fillRule: "evenodd",
138
- d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
139
- clipRule: "evenodd"
434
+ xmlns: "http://www.w3.org/2000/svg",
435
+ className: "h-5 w-5",
436
+ viewBox: "0 0 20 20",
437
+ fill: "currentColor",
438
+ children: /* @__PURE__ */ l(
439
+ "path",
440
+ {
441
+ fillRule: "evenodd",
442
+ d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
443
+ clipRule: "evenodd"
444
+ }
445
+ )
140
446
  }
141
447
  )
142
448
  }
143
449
  )
144
- }
145
- )
146
- ] }),
147
- /* @__PURE__ */ t("div", { className: "grid grid-cols-7 gap-1 mb-2", children: H.map((e) => /* @__PURE__ */ t(
148
- "div",
149
- {
150
- className: "text-center text-xs font-semibold text-base-content/60 py-2",
151
- children: e
152
- },
153
- e
154
- )) }),
155
- /* @__PURE__ */ t("div", { className: "grid grid-cols-7 gap-1", children: D.map((e, s) => /* @__PURE__ */ t(
156
- "button",
157
- {
158
- type: "button",
159
- disabled: !e,
160
- onClick: () => e && j(e),
161
- className: `
162
- aspect-square flex items-center justify-center text-sm rounded-lg
163
- ${e ? "hover:bg-base-200" : "invisible"}
164
- ${$(e) ? "bg-primary text-primary-content hover:bg-primary/90" : ""}
165
- ${I(e) && !$(e) ? "border border-primary" : ""}
166
- ${e ? "cursor-pointer" : ""}
167
- `,
168
- children: e
169
- },
170
- s
171
- )) }),
172
- /* @__PURE__ */ t("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ t(
173
- "button",
174
- {
175
- type: "button",
176
- onClick: () => {
177
- const e = /* @__PURE__ */ new Date();
178
- b(e), i(e.getMonth()), v(e.getFullYear()), d?.(e), u(!1);
179
- },
180
- className: `${M} ${y} ${S}`,
181
- children: "Today"
182
- }
183
- ) })
184
- ] })
450
+ ] }),
451
+ /* @__PURE__ */ l("div", { className: "grid grid-cols-7 gap-1 mb-2", role: "row", children: Me.map((t) => /* @__PURE__ */ l(
452
+ "div",
453
+ {
454
+ className: "text-center text-xs font-semibold text-base-content/60 py-2",
455
+ role: "columnheader",
456
+ children: t
457
+ },
458
+ t
459
+ )) }),
460
+ /* @__PURE__ */ l("div", { className: "grid grid-cols-7 gap-1", role: "grid", onKeyDown: fe, children: n.map((t, r) => {
461
+ const s = t ? new Date(w, f, t) : null, g = v || !!s && !!d?.(s), E = !!s && !!b && _(s, b), he = !!s && !!C && _(s, C), pe = !!s && !!b && !!C && Ye(s, b) && De(s, C), me = !!s && !!c && _(s, c);
462
+ return /* @__PURE__ */ l(
463
+ "button",
464
+ {
465
+ type: "button",
466
+ disabled: !t || g,
467
+ "aria-disabled": g || void 0,
468
+ "aria-selected": E || he || pe || void 0,
469
+ role: "gridcell",
470
+ onClick: () => t && X(t),
471
+ tabIndex: me ? 0 : -1,
472
+ "data-calendar-focus": me ? "true" : void 0,
473
+ className: `
474
+ aspect-square flex items-center justify-center text-sm rounded-lg
475
+ ${t ? "" : "invisible"}
476
+ ${t && !g ? "hover:bg-base-200 cursor-pointer" : ""}
477
+ ${pe ? "bg-primary/10" : ""}
478
+ ${E || he ? "bg-primary text-primary-content hover:bg-primary/90" : ""}
479
+ ${$(t) && !E && !he ? "border border-primary" : ""}
480
+ ${g ? "text-base-content/30 cursor-not-allowed" : ""}
481
+ `,
482
+ children: t
483
+ },
484
+ r
485
+ );
486
+ }) }),
487
+ /* @__PURE__ */ l("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ l(
488
+ "button",
489
+ {
490
+ type: "button",
491
+ onClick: () => {
492
+ const t = /* @__PURE__ */ new Date();
493
+ d?.(t) || (i([t, t]), k(t.getMonth()), A(t.getFullYear()), x?.([t, t]), u(!1));
494
+ },
495
+ className: `${z} ${L} ${I}`,
496
+ disabled: K,
497
+ children: W
498
+ }
499
+ ) })
500
+ ]
501
+ }
502
+ )
185
503
  ] });
186
504
  });
505
+ ke.displayName = "DatePicker";
506
+ Ne.displayName = "DatePicker.Range";
507
+ const Fe = ke;
508
+ Fe.Range = Ne;
187
509
  export {
188
- te as DatePicker
510
+ Fe as DatePicker
189
511
  };
190
512
  //# sourceMappingURL=DatePicker.js.map