asterui 0.12.70 → 0.12.71

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