@mngh/jalali-datepicker 1.1.8 → 1.2.1

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.
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
2
2
  import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import { createPortal as d } from "react-dom";
3
4
  //#region src/core/constants.ts
4
- var d = [
5
+ var f = [
5
6
  "فروردین",
6
7
  "اردیبهشت",
7
8
  "خرداد",
@@ -14,7 +15,7 @@ var d = [
14
15
  "دی",
15
16
  "بهمن",
16
17
  "اسفند"
17
- ], f = [
18
+ ], p = [
18
19
  "Farvardin",
19
20
  "Ordibehesht",
20
21
  "Khordad",
@@ -27,7 +28,7 @@ var d = [
27
28
  "Dey",
28
29
  "Bahman",
29
30
  "Esfand"
30
- ], p = [
31
+ ], m = [
31
32
  "ش",
32
33
  "ی",
33
34
  "د",
@@ -35,7 +36,7 @@ var d = [
35
36
  "چ",
36
37
  "پ",
37
38
  "ج"
38
- ], m = [
39
+ ], h = [
39
40
  "شنبه",
40
41
  "یکشنبه",
41
42
  "دوشنبه",
@@ -46,7 +47,7 @@ var d = [
46
47
  ];
47
48
  //#endregion
48
49
  //#region src/core/jalali-math.ts
49
- function h(e) {
50
+ function g(e) {
50
51
  let t = [
51
52
  -61,
52
53
  9,
@@ -80,11 +81,11 @@ function h(e) {
80
81
  let a = (i + 1) % 33 - 1;
81
82
  return a === -1 && (a = 4), a % 4 == 0;
82
83
  }
83
- function g(e, t) {
84
+ function _(e, t) {
84
85
  if (t < 0 || t > 11) throw RangeError("Month index must be between 0 (Farvardin) and 11 (Esfand).");
85
- return t <= 5 ? 31 : t <= 10 || h(e) ? 30 : 29;
86
+ return t <= 5 ? 31 : t <= 10 || g(e) ? 30 : 29;
86
87
  }
87
- function _(e, t, n) {
88
+ function v(e, t, n) {
88
89
  let r = [
89
90
  0,
90
91
  31,
@@ -107,7 +108,7 @@ function _(e, t, n) {
107
108
  day: o
108
109
  };
109
110
  }
110
- function v(e, t, n) {
111
+ function y(e, t, n) {
111
112
  let r, i, a, o = e + 1595, s = -355668 + 365 * o + Math.floor(o / 33) * 8 + Math.floor((o % 33 + 3) / 4) + n + (t < 6 ? t * 31 : (t - 6) * 30 + 186);
112
113
  r = 400 * Math.floor(s / 146097), s %= 146097, s > 36524 && (r += 100 * Math.floor(--s / 36524), s %= 36524, s >= 365 && s++), r += 4 * Math.floor(s / 1461), s %= 1461, s > 365 && (r += Math.floor((s - 1) / 365), s = (s - 1) % 365), a = s + 1;
113
114
  let c = [
@@ -129,30 +130,30 @@ function v(e, t, n) {
129
130
  let l = new Date(r, i - 1, a);
130
131
  return l.setHours(0, 0, 0, 0), l;
131
132
  }
132
- function y() {
133
+ function b() {
133
134
  let e = /* @__PURE__ */ new Date();
134
- return _(e.getFullYear(), e.getMonth() + 1, e.getDate());
135
+ return v(e.getFullYear(), e.getMonth() + 1, e.getDate());
135
136
  }
136
- function b(e, t) {
137
+ function x(e, t) {
137
138
  return !e || !t ? !1 : e.year === t.year && e.month === t.month && e.day === t.day;
138
139
  }
139
140
  //#endregion
140
141
  //#region src/core/calendar-grid.ts
141
- function x(e) {
142
- return e instanceof Date ? _(e.getFullYear(), e.getMonth() + 1, e.getDate()) : e;
143
- }
144
142
  function S(e) {
145
- let { year: t, month: n, firstDayOfWeek: r = 0, selectedDate: i, minDate: a, maxDate: o, isDateDisabled: s } = e, c = [], l = y(), u = i ? x(i) : null, d = a ? x(a) : null, f = o ? x(o) : null, p = ((v(t, n, 1).getDay() + 1) % 7 - r + 7) % 7, m = n === 0 ? 11 : n - 1, h = n === 0 ? t - 1 : t, _ = g(h, m);
143
+ return e instanceof Date ? v(e.getFullYear(), e.getMonth() + 1, e.getDate()) : e;
144
+ }
145
+ function C(e) {
146
+ let { year: t, month: n, firstDayOfWeek: r = 0, selectedDate: i, minDate: a, maxDate: o, isDateDisabled: s } = e, c = [], l = b(), u = i ? S(i) : null, d = a ? S(a) : null, f = o ? S(o) : null, p = ((y(t, n, 1).getDay() + 1) % 7 - r + 7) % 7, m = n === 0 ? 11 : n - 1, h = n === 0 ? t - 1 : t, g = _(h, m);
146
147
  for (let e = p - 1; e >= 0; e--) {
147
148
  let t = {
148
149
  year: h,
149
150
  month: m,
150
- day: _ - e
151
+ day: g - e
151
152
  };
152
153
  c.push(E(t, !1));
153
154
  }
154
- let S = g(t, n);
155
- for (let e = 1; e <= S; e++) {
155
+ let v = _(t, n);
156
+ for (let e = 1; e <= v; e++) {
156
157
  let r = {
157
158
  year: t,
158
159
  month: n,
@@ -170,13 +171,13 @@ function S(e) {
170
171
  c.push(E(t, !1));
171
172
  }
172
173
  function E(e, t) {
173
- let n = v(e.year, e.month, e.day), r = b(e, l), i = u ? b(e, u) : !1, a = !1;
174
+ let n = y(e.year, e.month, e.day), r = x(e, l), i = u ? x(e, u) : !1, a = !1;
174
175
  if (d) {
175
- let e = v(d.year, d.month, d.day);
176
+ let e = y(d.year, d.month, d.day);
176
177
  n.getTime() < e.getTime() && (a = !0);
177
178
  }
178
179
  if (f) {
179
- let e = v(f.year, f.month, f.day);
180
+ let e = y(f.year, f.month, f.day);
180
181
  n.getTime() > e.getTime() && (a = !0);
181
182
  }
182
183
  return s && s(e, n) && (a = !0), {
@@ -193,34 +194,34 @@ function S(e) {
193
194
  }
194
195
  //#endregion
195
196
  //#region src/core/jalali-helpers.ts
196
- function C(e) {
197
- return _(e.getFullYear(), e.getMonth() + 1, e.getDate());
197
+ function w(e) {
198
+ return v(e.getFullYear(), e.getMonth() + 1, e.getDate());
198
199
  }
199
- function w(e, t = 0, n = 0, r = 0) {
200
- let i = v(e.year, e.month, e.day);
200
+ function T(e, t = 0, n = 0, r = 0) {
201
+ let i = y(e.year, e.month, e.day);
201
202
  return i.setHours(t, n, r, 0), i;
202
203
  }
203
- function T(e, t, n) {
204
- return (v(e, t, n).getDay() + 1) % 7;
204
+ function E(e, t, n) {
205
+ return (y(e, t, n).getDay() + 1) % 7;
205
206
  }
206
- function E(e, t) {
207
- let n = v(e.year, e.month, e.day);
208
- return n.setDate(n.getDate() + t), _(n.getFullYear(), n.getMonth() + 1, n.getDate());
207
+ function D(e, t) {
208
+ let n = y(e.year, e.month, e.day);
209
+ return n.setDate(n.getDate() + t), v(n.getFullYear(), n.getMonth() + 1, n.getDate());
209
210
  }
210
- var D = E;
211
- function O(e, t) {
211
+ var O = D;
212
+ function k(e, t) {
212
213
  return e.year === t.year ? e.month === t.month ? e.day === t.day ? 0 : e.day < t.day ? -1 : 1 : e.month < t.month ? -1 : 1 : e.year < t.year ? -1 : 1;
213
214
  }
214
- function k(e, t, n, r = !0) {
215
- let i = O(t, n) <= 0 ? t : n, a = O(t, n) <= 0 ? n : t, o = O(e, i), s = O(e, a);
215
+ function ee(e, t, n, r = !0) {
216
+ let i = k(t, n) <= 0 ? t : n, a = k(t, n) <= 0 ? n : t, o = k(e, i), s = k(e, a);
216
217
  return r ? o >= 0 && s <= 0 : o > 0 && s < 0;
217
218
  }
218
219
  function A(e) {
219
- let t = E(e, -T(e.year, e.month, e.day));
220
- return [t, E(t, 6)];
220
+ let t = D(e, -E(e.year, e.month, e.day));
221
+ return [t, D(t, 6)];
221
222
  }
222
223
  function j(e) {
223
- let t = g(e.year, e.month);
224
+ let t = _(e.year, e.month);
224
225
  return [{
225
226
  year: e.year,
226
227
  month: e.month,
@@ -232,18 +233,56 @@ function j(e) {
232
233
  }];
233
234
  }
234
235
  //#endregion
236
+ //#region src/core/date-availability.ts
237
+ function M(e, t = {}) {
238
+ let { minDate: n, maxDate: r, isDateDisabled: i } = t;
239
+ return n && k(e, n) < 0 || r && k(e, r) > 0 ? !1 : !i?.(e);
240
+ }
241
+ function N(e, t, n = {}) {
242
+ let r = {
243
+ year: e,
244
+ month: t,
245
+ day: 1
246
+ }, i = {
247
+ year: e,
248
+ month: t,
249
+ day: _(e, t)
250
+ };
251
+ if (n.minDate && k(i, n.minDate) < 0 || n.maxDate && k(r, n.maxDate) > 0) return !1;
252
+ if (!n.isDateDisabled) return !0;
253
+ for (let r = 1; r <= i.day; r += 1) if (M({
254
+ year: e,
255
+ month: t,
256
+ day: r
257
+ }, n)) return !0;
258
+ return !1;
259
+ }
260
+ function P(e, t = {}) {
261
+ for (let n = 0; n < 12; n += 1) if (N(e, n, t)) return !0;
262
+ return !1;
263
+ }
264
+ //#endregion
235
265
  //#region src/hooks/useJalaliDatePicker.ts
236
- function M(e = {}) {
237
- let { mode: t = "single", value: r, defaultValue: i, initialViewDate: o, onChange: c, minDate: l, maxDate: u, isDateDisabled: d, firstDayOfWeek: f = 0 } = e, p = a(() => y(), []), [m, h] = s(() => i === void 0 ? t === "single" ? null : t === "range" ? [null, null] : [] : i), g = r === void 0 ? m : r, [_, v] = s(() => o ? o.year : i && !Array.isArray(i) ? i.year : p.year), [x, C] = s(() => o ? o.month : i && !Array.isArray(i) ? i.month : p.month), [w, T] = s(null), E = n((e, t) => {
238
- v(e), C(t);
239
- }, []), D = n(() => {
240
- x === 0 ? (v((e) => e - 1), C(11)) : C((e) => e - 1);
241
- }, [x]), O = n(() => {
242
- x === 11 ? (v((e) => e + 1), C(0)) : C((e) => e + 1);
243
- }, [x]), A = n(() => {
244
- let e = y();
245
- v(e.year), C(e.month);
266
+ function te(e = {}) {
267
+ let { mode: t = "single", value: r, defaultValue: i, initialViewDate: o, onChange: c, minDate: l, maxDate: u, isDateDisabled: d, firstDayOfWeek: f = 0 } = e, p = a(() => b(), []), [m, h] = s(() => i === void 0 ? t === "single" ? null : t === "range" ? [null, null] : [] : i), g = r === void 0 ? m : r, [_, v] = s(() => o ? o.year : i && !Array.isArray(i) ? i.year : p.year), [y, S] = s(() => o ? o.month : i && !Array.isArray(i) ? i.month : p.month), [w, T] = s(null), E = n((e) => M(e, {
268
+ minDate: l,
269
+ maxDate: u,
270
+ isDateDisabled: d
271
+ }), [
272
+ l,
273
+ u,
274
+ d
275
+ ]), D = n((e, t) => {
276
+ v(e), S(t);
277
+ }, []), O = n(() => {
278
+ y === 0 ? (v((e) => e - 1), S(11)) : S((e) => e - 1);
279
+ }, [y]), k = n(() => {
280
+ y === 11 ? (v((e) => e + 1), S(0)) : S((e) => e + 1);
281
+ }, [y]), A = n(() => {
282
+ let e = b();
283
+ v(e.year), S(e.month);
246
284
  }, []), j = n((e) => {
285
+ if (!E(e)) return;
247
286
  let n;
248
287
  if (t === "single") n = e;
249
288
  else if (t === "range") {
@@ -251,15 +290,23 @@ function M(e = {}) {
251
290
  n = !t || t && r ? [e, null] : e.year < t.year || e.year === t.year && e.month < t.month || e.year === t.year && e.month === t.month && e.day < t.day ? [e, t] : [t, e];
252
291
  } else {
253
292
  let t = g || [];
254
- n = t.some((t) => b(t, e)) ? t.filter((t) => !b(t, e)) : [...t, e];
293
+ n = t.some((t) => x(t, e)) ? t.filter((t) => !x(t, e)) : [...t, e];
255
294
  }
256
295
  r === void 0 && h(n), c?.(n);
257
296
  }, [
258
297
  t,
259
298
  g,
260
299
  r,
261
- c
262
- ]), M = n(() => {
300
+ c,
301
+ E
302
+ ]), N = n((e) => {
303
+ if (t === "single") return x(g, e);
304
+ if (t === "range") {
305
+ let [t, n] = g || [null, null];
306
+ return !!(t && x(t, e) || n && x(n, e));
307
+ }
308
+ return (g || []).some((t) => x(t, e));
309
+ }, [t, g]), P = n(() => {
263
310
  let e = t === "single" ? null : t === "range" ? [null, null] : [];
264
311
  r === void 0 && h(e), c?.(e);
265
312
  }, [
@@ -270,11 +317,11 @@ function M(e = {}) {
270
317
  return {
271
318
  selected: g,
272
319
  viewYear: _,
273
- viewMonth: x,
320
+ viewMonth: y,
274
321
  grid: a(() => {
275
- let e = S({
322
+ let e = C({
276
323
  year: _,
277
- month: x,
324
+ month: y,
278
325
  firstDayOfWeek: f,
279
326
  minDate: l,
280
327
  maxDate: u,
@@ -284,14 +331,14 @@ function M(e = {}) {
284
331
  let t = g;
285
332
  return e.map((e) => ({
286
333
  ...e,
287
- isSelected: t ? b(e.jalali, t) : !1
334
+ isSelected: t ? x(e.jalali, t) : !1
288
335
  }));
289
336
  }
290
337
  if (t === "range") {
291
338
  let [t, n] = g || [null, null], r = n ?? (t && w ? w : null);
292
339
  return e.map((e) => {
293
- let n = t ? b(e.jalali, t) : !1, i = r ? b(e.jalali, r) : !1, a = !1;
294
- return t && r && (a = k(e.jalali, t, r)), {
340
+ let n = t ? x(e.jalali, t) : !1, i = r ? x(e.jalali, r) : !1, a = !1;
341
+ return t && r && (a = ee(e.jalali, t, r)), {
295
342
  ...e,
296
343
  isSelected: n || i,
297
344
  isInRange: a,
@@ -304,13 +351,13 @@ function M(e = {}) {
304
351
  let t = g || [];
305
352
  return e.map((e) => ({
306
353
  ...e,
307
- isSelected: t.some((t) => b(t, e.jalali))
354
+ isSelected: t.some((t) => x(t, e.jalali))
308
355
  }));
309
356
  }
310
357
  return e;
311
358
  }, [
312
359
  _,
313
- x,
360
+ y,
314
361
  f,
315
362
  l,
316
363
  u,
@@ -319,19 +366,20 @@ function M(e = {}) {
319
366
  g,
320
367
  w
321
368
  ]),
322
- goToPrevMonth: D,
323
- goToNextMonth: O,
369
+ goToPrevMonth: O,
370
+ goToNextMonth: k,
324
371
  goToToday: A,
325
- setView: E,
372
+ setView: D,
326
373
  selectDate: j,
374
+ isDateSelected: N,
327
375
  setHoverDate: T,
328
376
  hoverDate: w,
329
- clear: M
377
+ clear: P
330
378
  };
331
379
  }
332
380
  //#endregion
333
381
  //#region src/a11y/keyboard-navigation.ts
334
- function N(e) {
382
+ function F(e) {
335
383
  let { currentFocused: t, key: n, isRtl: r = !0 } = e, { year: i, month: a, day: o } = t, s = !1, c = !0, l = r ? 1 : -1, u = r ? -1 : 1;
336
384
  switch (n) {
337
385
  case "ArrowRight":
@@ -350,7 +398,7 @@ function N(e) {
350
398
  o = 1;
351
399
  break;
352
400
  case "End":
353
- o = g(i, a);
401
+ o = _(i, a);
354
402
  break;
355
403
  case "PageUp":
356
404
  a === 0 ? (--i, a = 11) : --a, s = !0;
@@ -364,8 +412,8 @@ function N(e) {
364
412
  handled: !1
365
413
  };
366
414
  }
367
- for (; o < 1;) a === 0 ? (--i, a = 11) : --a, o += g(i, a), s = !0;
368
- for (; o > g(i, a);) o -= g(i, a), a === 11 ? (i += 1, a = 0) : a += 1, s = !0;
415
+ for (; o < 1;) a === 0 ? (--i, a = 11) : --a, o += _(i, a), s = !0;
416
+ for (; o > _(i, a);) o -= _(i, a), a === 11 ? (i += 1, a = 0) : a += 1, s = !0;
369
417
  return {
370
418
  nextDate: {
371
419
  year: i,
@@ -378,13 +426,13 @@ function N(e) {
378
426
  }
379
427
  //#endregion
380
428
  //#region src/a11y/aria-helpers.ts
381
- function P(e) {
382
- let t = m[(v(e.year, e.month, e.day).getDay() + 1) % 7], n = d[e.month];
429
+ function I(e) {
430
+ let t = h[(y(e.year, e.month, e.day).getDay() + 1) % 7], n = f[e.month];
383
431
  return `${t}، ${e.day} ${n} ${e.year}`;
384
432
  }
385
433
  //#endregion
386
434
  //#region src/a11y/useCalendarKeyboard.ts
387
- function F(e) {
435
+ function ne(e) {
388
436
  let { viewYear: t, viewMonth: r, selectedDate: i, onSelectDate: a, onViewChange: o, isRtl: c = !0 } = e, [l, u] = s(() => i ?? {
389
437
  year: t,
390
438
  month: r,
@@ -398,7 +446,7 @@ function F(e) {
398
446
  e.preventDefault(), a(l);
399
447
  return;
400
448
  }
401
- let t = N({
449
+ let t = F({
402
450
  currentFocused: l,
403
451
  key: e.key,
404
452
  isRtl: c
@@ -410,12 +458,12 @@ function F(e) {
410
458
  a,
411
459
  o
412
460
  ]),
413
- getCellTabIndex: n((e) => b(e, l) ? 0 : -1, [l])
461
+ getCellTabIndex: n((e) => x(e, l) ? 0 : -1, [l])
414
462
  };
415
463
  }
416
464
  //#endregion
417
465
  //#region src/formatters/persian-digits.ts
418
- var I = [
466
+ var re = [
419
467
  "۰",
420
468
  "۱",
421
469
  "۲",
@@ -426,7 +474,7 @@ var I = [
426
474
  "۷",
427
475
  "۸",
428
476
  "۹"
429
- ], ee = {
477
+ ], L = {
430
478
  "۰": "0",
431
479
  "۱": "1",
432
480
  "۲": "2",
@@ -448,22 +496,22 @@ var I = [
448
496
  "٨": "8",
449
497
  "٩": "9"
450
498
  };
451
- function L(e) {
452
- return String(e).replace(/[0-9]/g, (e) => I[+e]);
453
- }
454
499
  function R(e) {
455
- return e.replace(/[۰-۹٠-٩]/g, (e) => ee[e] ?? e);
500
+ return String(e).replace(/[0-9]/g, (e) => re[+e]);
501
+ }
502
+ function z(e) {
503
+ return e.replace(/[۰-۹٠-٩]/g, (e) => L[e] ?? e);
456
504
  }
457
505
  //#endregion
458
506
  //#region src/formatters/jalali-formatter.ts
459
- function z(e, t = "YYYY/MM/DD", n = {}) {
507
+ function B(e, t = "YYYY/MM/DD", n = {}) {
460
508
  if (!e) return "";
461
- let { digitType: r = "persian" } = n, i = (v(e.year, e.month, e.day).getDay() + 1) % 7, a = String(e.year), o = a.slice(-2), s = e.month + 1, c = s < 10 ? `0${s}` : String(s), l = d[e.month], u = e.day < 10 ? `0${e.day}` : String(e.day), f = m[i], p = t.replace(/\bYYYY\b/g, a).replace(/\bYY\b/g, o).replace(/\bMMMM\b/g, l).replace(/\bMM\b/g, c).replace(/\bM\b/g, String(s)).replace(/\bdddd\b/g, f).replace(/\bDD\b/g, u).replace(/\bD\b/g, String(e.day));
462
- return r === "persian" && (p = p.replace(/\d+/g, (e) => L(e))), p;
509
+ let { digitType: r = "persian" } = n, i = (y(e.year, e.month, e.day).getDay() + 1) % 7, a = String(e.year), o = a.slice(-2), s = e.month + 1, c = s < 10 ? `0${s}` : String(s), l = f[e.month], u = e.day < 10 ? `0${e.day}` : String(e.day), d = h[i], p = t.replace(/\bYYYY\b/g, a).replace(/\bYY\b/g, o).replace(/\bMMMM\b/g, l).replace(/\bMM\b/g, c).replace(/\bM\b/g, String(s)).replace(/\bdddd\b/g, d).replace(/\bDD\b/g, u).replace(/\bD\b/g, String(e.day));
510
+ return r === "persian" && (p = p.replace(/\d+/g, (e) => R(e))), p;
463
511
  }
464
512
  //#endregion
465
513
  //#region src/theme/tokens.ts
466
- var B = {
514
+ var V = {
467
515
  mode: "light",
468
516
  colors: {
469
517
  primary: "#4f46e5",
@@ -492,7 +540,7 @@ var B = {
492
540
  md: "0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04)",
493
541
  lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05)"
494
542
  }
495
- }, V = {
543
+ }, ie = {
496
544
  mode: "dark",
497
545
  colors: {
498
546
  primary: "#6366f1",
@@ -521,14 +569,14 @@ var B = {
521
569
  md: "0 4px 6px -1px rgba(0, 0, 0, 0.4)",
522
570
  lg: "0 10px 15px -3px rgba(0, 0, 0, 0.5)"
523
571
  }
524
- }, H = t({
525
- theme: B,
572
+ }, ae = t({
573
+ theme: V,
526
574
  mode: "light"
527
- }), U = () => r(H) || {
528
- theme: B,
575
+ }), H = () => r(ae) || {
576
+ theme: V,
529
577
  mode: "light"
530
- }, te = ({ children: e, mode: t = "light", customTheme: n }) => {
531
- let r = t === "dark" ? V : B, i = a(() => n ? {
578
+ }, U = ({ children: e, mode: t = "light", customTheme: n }) => {
579
+ let r = t === "dark" ? ie : V, i = a(() => n ? {
532
580
  mode: t,
533
581
  theme: {
534
582
  ...r,
@@ -555,29 +603,39 @@ var B = {
555
603
  n,
556
604
  t
557
605
  ]);
558
- return /* @__PURE__ */ l(H.Provider, {
606
+ return /* @__PURE__ */ l(ae.Provider, {
559
607
  value: i,
560
608
  children: e
561
609
  });
562
- }, ne = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick: i, isPickerOpen: a = !1, digitType: o = "persian", direction: c = "rtl", classNames: d, styles: f }) => {
563
- let { theme: p } = U(), [m, h] = s(null), g = o === "persian" ? L(e) : String(e), _ = (e) => ({
610
+ };
611
+ //#endregion
612
+ //#region src/theme/style-utils.ts
613
+ function W(...e) {
614
+ return e.filter(Boolean).join(" ") || void 0;
615
+ }
616
+ //#endregion
617
+ //#region src/components/Header.tsx
618
+ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick: i, isPickerOpen: a = !1, digitType: o = "persian", direction: c = "rtl", isPrevDisabled: d = !1, isNextDisabled: f = !1, classNames: p, styles: m }) => {
619
+ let { theme: h } = H(), [g, _] = s(null), v = o === "persian" ? R(e) : String(e), y = (e, t) => ({
564
620
  width: "32px",
565
621
  height: "32px",
566
622
  padding: 0,
567
- borderRadius: p.radii.md,
623
+ borderRadius: h.radii.md,
568
624
  border: "none",
569
- backgroundColor: m === e ? p.colors.backgroundHover : "transparent",
570
- color: p.colors.textPrimary,
571
- cursor: "pointer",
625
+ backgroundColor: g === e ? h.colors.backgroundHover : "transparent",
626
+ color: h.colors.textPrimary,
627
+ cursor: t ? "not-allowed" : "pointer",
628
+ opacity: t ? .38 : 1,
572
629
  display: "inline-flex",
573
630
  alignItems: "center",
574
631
  justifyContent: "center",
575
632
  transition: "background-color 0.15s ease, color 0.15s ease",
576
- ...f?.navButton
633
+ ...m?.navButton,
634
+ ...t ? m?.disabledNavButton : void 0
577
635
  });
578
636
  return /* @__PURE__ */ u("div", {
579
637
  dir: c,
580
- className: d?.header,
638
+ className: p?.header,
581
639
  style: {
582
640
  display: "flex",
583
641
  minHeight: "40px",
@@ -585,19 +643,21 @@ var B = {
585
643
  justifyContent: "space-between",
586
644
  gap: "8px",
587
645
  padding: "4px 0 10px",
588
- borderBottom: `1px solid ${p.colors.border}`,
646
+ borderBottom: `1px solid ${h.colors.border}`,
589
647
  userSelect: "none",
590
- ...f?.header
648
+ ...m?.header
591
649
  },
592
650
  children: [
593
651
  /* @__PURE__ */ l("button", {
594
652
  type: "button",
595
653
  onClick: n,
654
+ disabled: d,
655
+ "aria-disabled": d,
596
656
  "aria-label": "ماه قبل",
597
- className: d?.navButton,
598
- style: _("prev"),
599
- onMouseEnter: () => h("prev"),
600
- onMouseLeave: () => h(null),
657
+ className: W(p?.navButton, d && p?.disabledNavButton),
658
+ style: y("prev", d),
659
+ onMouseEnter: () => _("prev"),
660
+ onMouseLeave: () => _(null),
601
661
  children: /* @__PURE__ */ l("svg", {
602
662
  width: "18",
603
663
  height: "18",
@@ -616,14 +676,14 @@ var B = {
616
676
  type: "button",
617
677
  onClick: i,
618
678
  "aria-expanded": a,
619
- className: d?.headerTitle,
679
+ className: p?.headerTitle,
620
680
  style: {
621
681
  minHeight: "32px",
622
682
  padding: "6px 12px",
623
- borderRadius: p.radii.md,
683
+ borderRadius: h.radii.md,
624
684
  border: "none",
625
- backgroundColor: a || m === "title" ? p.colors.backgroundHover : "transparent",
626
- color: p.colors.textPrimary,
685
+ backgroundColor: a || g === "title" ? h.colors.backgroundHover : "transparent",
686
+ color: h.colors.textPrimary,
627
687
  cursor: i ? "pointer" : "default",
628
688
  display: "inline-flex",
629
689
  alignItems: "center",
@@ -633,14 +693,14 @@ var B = {
633
693
  fontWeight: 700,
634
694
  whiteSpace: "nowrap",
635
695
  transition: "background-color 0.15s ease",
636
- ...f?.headerTitle
696
+ ...m?.headerTitle
637
697
  },
638
- onMouseEnter: () => h("title"),
639
- onMouseLeave: () => h(null),
698
+ onMouseEnter: () => _("title"),
699
+ onMouseLeave: () => _(null),
640
700
  children: [/* @__PURE__ */ u("span", { children: [
641
701
  t,
642
702
  " ",
643
- g
703
+ v
644
704
  ] }), /* @__PURE__ */ l("svg", {
645
705
  width: "14",
646
706
  height: "14",
@@ -661,11 +721,13 @@ var B = {
661
721
  /* @__PURE__ */ l("button", {
662
722
  type: "button",
663
723
  onClick: r,
724
+ disabled: f,
725
+ "aria-disabled": f,
664
726
  "aria-label": "ماه بعد",
665
- className: d?.navButton,
666
- style: _("next"),
667
- onMouseEnter: () => h("next"),
668
- onMouseLeave: () => h(null),
727
+ className: W(p?.navButton, f && p?.disabledNavButton),
728
+ style: y("next", f),
729
+ onMouseEnter: () => _("next"),
730
+ onMouseLeave: () => _(null),
669
731
  children: /* @__PURE__ */ l("svg", {
670
732
  width: "18",
671
733
  height: "18",
@@ -682,9 +744,9 @@ var B = {
682
744
  })
683
745
  ]
684
746
  });
685
- }, re = ({ firstDayOfWeek: t = 0, classNames: n, styles: r }) => {
747
+ }, se = ({ firstDayOfWeek: t = 0, classNames: n, styles: r }) => {
686
748
  let i = e.useMemo(() => {
687
- let e = [...p];
749
+ let e = [...m];
688
750
  return [...e.slice(t), ...e.slice(0, t)];
689
751
  }, [t]);
690
752
  return /* @__PURE__ */ l("div", {
@@ -692,7 +754,7 @@ var B = {
692
754
  className: n?.weekdays,
693
755
  style: {
694
756
  display: "grid",
695
- gridTemplateColumns: "repeat(7, var(--pdp-cell-size, 34px))",
757
+ gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
696
758
  gap: "4px",
697
759
  justifyContent: "center",
698
760
  alignItems: "center",
@@ -707,7 +769,8 @@ var B = {
707
769
  "aria-label": e,
708
770
  className: n?.weekdayCell,
709
771
  style: {
710
- width: "var(--pdp-cell-size, 34px)",
772
+ width: "100%",
773
+ minWidth: 0,
711
774
  height: "24px",
712
775
  display: "flex",
713
776
  alignItems: "center",
@@ -722,44 +785,55 @@ var B = {
722
785
  }, e);
723
786
  })
724
787
  });
725
- }, ie = ({ cell: e, digitType: t = "persian", isHoliday: n = !1, holidayTitle: r, events: i = [], tabIndex: a = -1, classNames: o, styles: c, onSelect: d, onHover: f, onFocus: p }) => {
726
- let [m, h] = s(!1), [g, _] = s(!1), { jalali: v, dayNumber: y, isCurrentMonth: b, isToday: x, isSelected: S, isDisabled: C, isInRange: w, isRangeStart: T, isRangeEnd: E } = e, D = t === "persian" ? L(y) : R(y.toString()), O = !C && b, k = (e) => {
788
+ }, ce = ({ cell: e, digitType: t = "persian", isHoliday: n = !1, holidayTitle: r, events: i = [], tabIndex: a = -1, classNames: o, styles: c, onSelect: d, onHover: f, onFocus: p }) => {
789
+ let [m, h] = s(!1), [g, _] = s(!1), { jalali: v, dayNumber: y, isCurrentMonth: b, isToday: x, isSelected: S, isDisabled: C, isInRange: w, isRangeStart: T, isRangeEnd: E } = e, D = t === "persian" ? R(y) : z(y.toString()), O = !C && b, k = (e) => {
727
790
  e.stopPropagation(), O && d(v);
728
- }, A = () => {
791
+ }, ee = () => {
729
792
  h(!0), O && f && f(v);
730
- }, j = () => {
793
+ }, A = () => {
731
794
  h(!1), _(!1), f && f(null);
732
- }, M = () => {
795
+ }, j = () => {
733
796
  O && p && p(v);
734
- }, N = "transparent", P = b ? "var(--pdp-text-primary, #0f172a)" : "var(--pdp-text-disabled, #cbd5e1)", F = T || E;
735
- S || F ? (N = "var(--pdp-primary, #4f46e5)", P = "#ffffff") : w ? N = "var(--pdp-range-between-bg, rgba(79, 70, 229, 0.12))" : m && O && (N = "var(--pdp-hover-bg, #f1f5f9)"), n && b && !S && !F && (P = "var(--pdp-holiday-color, #e11d48)");
736
- let I = "scale(1)";
797
+ }, M = "transparent", N = b ? "var(--pdp-text-primary, #0f172a)" : "var(--pdp-text-disabled, #cbd5e1)", P = T || E;
798
+ S || P ? (M = "var(--pdp-primary, #4f46e5)", N = "#ffffff") : w ? M = "var(--pdp-range-between-bg, rgba(79, 70, 229, 0.12))" : m && O && (M = "var(--pdp-hover-bg, #f1f5f9)"), n && b && !C && !S && !P && (N = "var(--pdp-holiday-color, #e11d48)"), C && (M = "var(--pdp-disabled-bg, #f1f5f9)", N = "var(--pdp-text-disabled, #94a3b8)");
799
+ let te = W(o?.dayCell, x && o?.todayCell, S && o?.selectedCell, w && o?.rangeBetweenCell, T && o?.rangeStartCell, E && o?.rangeEndCell, C && o?.disabledCell, !b && o?.outsideMonthCell, n && o?.holidayCell), F = {
800
+ ...x ? c?.todayCell : void 0,
801
+ ...S ? c?.selectedCell : void 0,
802
+ ...w ? c?.rangeBetweenCell : void 0,
803
+ ...T ? c?.rangeStartCell : void 0,
804
+ ...E ? c?.rangeEndCell : void 0,
805
+ ...b ? void 0 : c?.outsideMonthCell,
806
+ ...n ? c?.holidayCell : void 0,
807
+ ...C ? c?.disabledCell : void 0
808
+ }, I = "scale(1)";
737
809
  return O && (g ? I = "scale(0.92)" : m && !w && (I = "scale(1.08)")), /* @__PURE__ */ u("div", {
738
810
  style: {
739
811
  position: "relative",
740
812
  display: "flex",
741
813
  alignItems: "center",
742
814
  justifyContent: "center",
743
- width: "var(--pdp-cell-size, 34px)",
744
- height: "var(--pdp-cell-size, 34px)",
815
+ width: "100%",
816
+ minWidth: 0,
817
+ aspectRatio: "1 / 1",
745
818
  margin: 0,
746
819
  padding: 0,
747
820
  boxSizing: "border-box"
748
821
  },
749
- onMouseEnter: A,
750
- onMouseLeave: j,
822
+ onMouseEnter: ee,
823
+ onMouseLeave: A,
751
824
  children: [/* @__PURE__ */ u("button", {
752
825
  type: "button",
753
826
  role: "gridcell",
754
827
  tabIndex: a,
755
828
  disabled: C || !b,
829
+ "aria-disabled": C || !b,
756
830
  "aria-selected": S,
757
831
  "aria-label": `${v.year}/${v.month + 1}/${v.day}${r ? ` - ${r}` : ""}`,
758
832
  onClick: k,
759
- onFocus: M,
833
+ onFocus: j,
760
834
  onMouseDown: () => O && _(!0),
761
835
  onMouseUp: () => O && _(!1),
762
- className: o?.dayCell,
836
+ className: te,
763
837
  style: {
764
838
  width: "100%",
765
839
  height: "100%",
@@ -769,9 +843,9 @@ var B = {
769
843
  justifyContent: "center",
770
844
  borderRadius: T ? "0 8px 8px 0" : E ? "8px 0 0 8px" : w ? "0" : "8px",
771
845
  border: x && !S ? "1px solid var(--pdp-primary, #4f46e5)" : "none",
772
- backgroundColor: N,
773
- color: P,
774
- cursor: O ? "pointer" : "default",
846
+ backgroundColor: M,
847
+ color: N,
848
+ cursor: C ? "not-allowed" : O ? "pointer" : "default",
775
849
  fontSize: "13px",
776
850
  fontWeight: S || x ? 700 : 500,
777
851
  outline: "none",
@@ -783,7 +857,10 @@ var B = {
783
857
  boxShadow: m && O && !w && !S ? "0 2px 6px rgba(0, 0, 0, 0.08)" : "none",
784
858
  transition: "transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.14s ease, color 0.14s ease, box-shadow 0.16s ease",
785
859
  zIndex: m && O ? 2 : 1,
786
- ...c?.dayCell
860
+ opacity: C ? .42 : b ? 1 : .55,
861
+ filter: C ? "grayscale(0.65)" : void 0,
862
+ ...c?.dayCell,
863
+ ...F
787
864
  },
788
865
  children: [/* @__PURE__ */ l("span", { children: D }), i.length > 0 && /* @__PURE__ */ l("div", {
789
866
  style: {
@@ -849,18 +926,26 @@ var B = {
849
926
  ]
850
927
  })]
851
928
  });
852
- }, ae = ({ currentYear: e, currentMonth: t, onSelectMonth: n, onSelectYear: r, classNames: i, styles: a }) => {
853
- let [o, c] = s("months"), [f, p] = s(() => Math.floor(e / 10) * 10), [m, h] = s(e), g = Array.from({ length: 12 }, (e, t) => f - 1 + t), _ = () => {
854
- if (o === "months") {
855
- let e = m - 1;
856
- h(e), r(e);
857
- } else p((e) => e - 10);
858
- }, v = () => {
859
- if (o === "months") {
860
- let e = m + 1;
861
- h(e), r(e);
862
- } else p((e) => e + 10);
863
- }, y = {
929
+ }, le = ({ currentYear: e, currentMonth: t, onSelectMonth: n, onSelectYear: r, minDate: i, maxDate: a, isDateDisabled: o, classNames: c, styles: d }) => {
930
+ let [p, m] = s("months"), [h, g] = s(() => Math.floor(e / 10) * 10), [_, v] = s(e), y = Array.from({ length: 12 }, (e, t) => h - 1 + t), b = {
931
+ minDate: i,
932
+ maxDate: a,
933
+ isDateDisabled: o
934
+ }, x = (e) => P(e, b), S = (e, t) => N(e, t, b), C = p === "months" ? !x(_ - 1) : !Array.from({ length: 10 }, (e, t) => h - 10 + t).some(x), w = p === "months" ? !x(_ + 1) : !Array.from({ length: 10 }, (e, t) => h + 10 + t).some(x), T = () => {
935
+ if (!C) {
936
+ if (p === "months") {
937
+ let e = _ - 1;
938
+ v(e), r(e);
939
+ } else g((e) => e - 10);
940
+ }
941
+ }, E = () => {
942
+ if (!w) {
943
+ if (p === "months") {
944
+ let e = _ + 1;
945
+ v(e), r(e);
946
+ } else g((e) => e + 10);
947
+ }
948
+ }, D = {
864
949
  background: "transparent",
865
950
  border: "none",
866
951
  cursor: "pointer",
@@ -871,7 +956,7 @@ var B = {
871
956
  justifyContent: "center",
872
957
  color: "var(--pdp-text-primary, #0f172a)",
873
958
  transition: "all 0.15s ease"
874
- }, b = {
959
+ }, O = {
875
960
  height: "46px",
876
961
  borderRadius: "10px",
877
962
  border: "none",
@@ -887,19 +972,20 @@ var B = {
887
972
  userSelect: "none"
888
973
  };
889
974
  return /* @__PURE__ */ u("div", {
890
- className: i?.calendar,
975
+ className: c?.calendar,
891
976
  style: {
892
977
  display: "flex",
893
978
  flexDirection: "column",
894
979
  gap: "10px",
895
980
  width: "100%",
896
- minWidth: "260px",
981
+ minWidth: 0,
982
+ maxWidth: "100%",
897
983
  height: "260px",
898
984
  padding: "6px",
899
985
  boxSizing: "border-box",
900
986
  justifyContent: "space-between",
901
987
  userSelect: "none",
902
- ...a?.calendar
988
+ ...d?.calendar
903
989
  },
904
990
  children: [/* @__PURE__ */ u("div", {
905
991
  style: {
@@ -912,9 +998,17 @@ var B = {
912
998
  children: [
913
999
  /* @__PURE__ */ l("button", {
914
1000
  type: "button",
915
- onClick: _,
1001
+ onClick: T,
1002
+ disabled: C,
1003
+ "aria-disabled": C,
916
1004
  "aria-label": "Previous",
917
- style: y,
1005
+ className: W(c?.navButton, C && c?.disabledNavButton),
1006
+ style: {
1007
+ ...D,
1008
+ cursor: C ? "not-allowed" : "pointer",
1009
+ opacity: C ? .38 : 1,
1010
+ ...C ? d?.disabledNavButton : void 0
1011
+ },
918
1012
  onMouseEnter: (e) => {
919
1013
  e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)";
920
1014
  },
@@ -936,12 +1030,12 @@ var B = {
936
1030
  /* @__PURE__ */ u("button", {
937
1031
  type: "button",
938
1032
  onClick: () => {
939
- o === "months" && (p(Math.floor(m / 10) * 10), c("years"));
1033
+ p === "months" && (g(Math.floor(_ / 10) * 10), m("years"));
940
1034
  },
941
1035
  style: {
942
- background: o === "months" ? "var(--pdp-surface-subtle, #f1f5f9)" : "transparent",
943
- border: o === "months" ? "1px solid var(--pdp-surface-border, #e2e8f0)" : "none",
944
- cursor: o === "months" ? "pointer" : "default",
1036
+ background: p === "months" ? "var(--pdp-surface-subtle, #f1f5f9)" : "transparent",
1037
+ border: p === "months" ? "1px solid var(--pdp-surface-border, #e2e8f0)" : "none",
1038
+ cursor: p === "months" ? "pointer" : "default",
945
1039
  fontSize: "13.5px",
946
1040
  fontWeight: 700,
947
1041
  color: "var(--pdp-text-primary, #0f172a)",
@@ -953,12 +1047,12 @@ var B = {
953
1047
  transition: "all 0.15s ease"
954
1048
  },
955
1049
  onMouseEnter: (e) => {
956
- o === "months" && (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #e2e8f0)", e.currentTarget.style.borderColor = "var(--pdp-primary, #4f46e5)");
1050
+ p === "months" && (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #e2e8f0)", e.currentTarget.style.borderColor = "var(--pdp-primary, #4f46e5)");
957
1051
  },
958
1052
  onMouseLeave: (e) => {
959
- o === "months" && (e.currentTarget.style.backgroundColor = "var(--pdp-surface-subtle, #f1f5f9)", e.currentTarget.style.borderColor = "var(--pdp-surface-border, #e2e8f0)");
1053
+ p === "months" && (e.currentTarget.style.backgroundColor = "var(--pdp-surface-subtle, #f1f5f9)", e.currentTarget.style.borderColor = "var(--pdp-surface-border, #e2e8f0)");
960
1054
  },
961
- children: [/* @__PURE__ */ l("span", { children: o === "months" ? L(m) : `${L(f)} - ${L(f + 9)}` }), o === "months" && /* @__PURE__ */ l("svg", {
1055
+ children: [/* @__PURE__ */ l("span", { children: p === "months" ? R(_) : `${R(h)} - ${R(h + 9)}` }), p === "months" && /* @__PURE__ */ l("svg", {
962
1056
  width: "13",
963
1057
  height: "13",
964
1058
  viewBox: "0 0 24 24",
@@ -973,9 +1067,17 @@ var B = {
973
1067
  }),
974
1068
  /* @__PURE__ */ l("button", {
975
1069
  type: "button",
976
- onClick: v,
1070
+ onClick: E,
1071
+ disabled: w,
1072
+ "aria-disabled": w,
977
1073
  "aria-label": "Next",
978
- style: y,
1074
+ className: W(c?.navButton, w && c?.disabledNavButton),
1075
+ style: {
1076
+ ...D,
1077
+ cursor: w ? "not-allowed" : "pointer",
1078
+ opacity: w ? .38 : 1,
1079
+ ...w ? d?.disabledNavButton : void 0
1080
+ },
979
1081
  onMouseEnter: (e) => {
980
1082
  e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)";
981
1083
  },
@@ -1004,16 +1106,24 @@ var B = {
1004
1106
  flex: 1,
1005
1107
  alignItems: "center"
1006
1108
  },
1007
- children: o === "months" ? d.map((r, i) => {
1008
- let a = i === t && m === e;
1109
+ children: p === "months" ? f.map((r, i) => {
1110
+ let a = i === t && _ === e, o = !S(_, i);
1009
1111
  return /* @__PURE__ */ l("button", {
1010
1112
  type: "button",
1113
+ disabled: o,
1114
+ "aria-disabled": o,
1011
1115
  onClick: () => n(i),
1116
+ className: W(c?.monthButton, a && c?.selectedMonthButton, o && c?.disabledMonthButton),
1012
1117
  style: {
1013
- ...b,
1118
+ ...O,
1014
1119
  background: a ? "var(--pdp-primary, #4f46e5)" : "transparent",
1015
1120
  color: a ? "#ffffff" : "var(--pdp-text-primary, #0f172a)",
1016
- fontWeight: a ? 700 : 500
1121
+ fontWeight: a ? 700 : 500,
1122
+ cursor: o ? "not-allowed" : "pointer",
1123
+ opacity: o ? .35 : 1,
1124
+ ...d?.monthButton ?? {},
1125
+ ...a ? d?.selectedMonthButton : void 0,
1126
+ ...o ? d?.disabledMonthButton : void 0
1017
1127
  },
1018
1128
  onMouseEnter: (e) => {
1019
1129
  a || (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)");
@@ -1023,19 +1133,26 @@ var B = {
1023
1133
  },
1024
1134
  children: r
1025
1135
  }, r);
1026
- }) : g.map((e, t) => {
1027
- let n = t === 0 || t === 11, i = e === m;
1136
+ }) : y.map((e, t) => {
1137
+ let n = t === 0 || t === 11, i = e === _, a = !x(e);
1028
1138
  return /* @__PURE__ */ l("button", {
1029
1139
  type: "button",
1140
+ disabled: a,
1141
+ "aria-disabled": a,
1142
+ className: W(c?.yearButton, i && c?.selectedYearButton, a && c?.disabledYearButton),
1030
1143
  onClick: () => {
1031
- h(e), r(e), c("months");
1144
+ v(e), r(e), m("months");
1032
1145
  },
1033
1146
  style: {
1034
- ...b,
1147
+ ...O,
1035
1148
  background: i ? "var(--pdp-primary, #4f46e5)" : "transparent",
1036
1149
  color: i ? "#ffffff" : n ? "var(--pdp-text-disabled, #94a3b8)" : "var(--pdp-text-primary, #0f172a)",
1037
1150
  fontWeight: i ? 700 : 500,
1038
- opacity: n ? .4 : 1
1151
+ cursor: a ? "not-allowed" : "pointer",
1152
+ opacity: a ? .3 : n ? .4 : 1,
1153
+ ...d?.yearButton ?? {},
1154
+ ...i ? d?.selectedYearButton : void 0,
1155
+ ...a ? d?.disabledYearButton : void 0
1039
1156
  },
1040
1157
  onMouseEnter: (e) => {
1041
1158
  i || (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)");
@@ -1043,7 +1160,7 @@ var B = {
1043
1160
  onMouseLeave: (e) => {
1044
1161
  i || (e.currentTarget.style.backgroundColor = "transparent");
1045
1162
  },
1046
- children: L(e)
1163
+ children: R(e)
1047
1164
  }, e);
1048
1165
  })
1049
1166
  })]
@@ -1051,11 +1168,11 @@ var B = {
1051
1168
  };
1052
1169
  //#endregion
1053
1170
  //#region src/plugins/time-picker/time-utils.ts
1054
- function W(e, t = "persian") {
1171
+ function G(e, t = "persian") {
1055
1172
  let n = e < 10 ? `0${e}` : `${e}`;
1056
- return t === "persian" ? L(n) : n;
1173
+ return t === "persian" ? R(n) : n;
1057
1174
  }
1058
- function oe() {
1175
+ function ue() {
1059
1176
  let e = /* @__PURE__ */ new Date();
1060
1177
  return {
1061
1178
  hour: e.getHours(),
@@ -1063,34 +1180,34 @@ function oe() {
1063
1180
  second: e.getSeconds()
1064
1181
  };
1065
1182
  }
1066
- function se(e) {
1183
+ function K(e) {
1067
1184
  return {
1068
1185
  hour: Math.max(0, Math.min(23, e.hour)),
1069
1186
  minute: Math.max(0, Math.min(59, e.minute)),
1070
1187
  second: e.second === void 0 ? void 0 : Math.max(0, Math.min(59, e.second))
1071
1188
  };
1072
1189
  }
1073
- function ce(e, t = !1, n = "persian") {
1190
+ function de(e, t = !1, n = "persian") {
1074
1191
  if (!e) return "";
1075
- let r = W(e.hour, n), i = W(e.minute, n);
1076
- return t && e.second !== void 0 ? `${r}:${i}:${W(e.second, n)}` : `${r}:${i}`;
1192
+ let r = G(e.hour, n), i = G(e.minute, n);
1193
+ return t && e.second !== void 0 ? `${r}:${i}:${G(e.second, n)}` : `${r}:${i}`;
1077
1194
  }
1078
1195
  //#endregion
1079
1196
  //#region src/components/footer/CalendarFooter.tsx
1080
- var le = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r, showSeconds: i = !1, mode: a = "single", digitType: o = "persian", showStatusText: s = !0, showActions: c = !0, onToday: d, onClear: f, onConfirm: p, direction: m = "rtl", classNames: h, styles: g }) => {
1081
- let { theme: _ } = U(), v = (() => {
1197
+ var fe = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r, showSeconds: i = !1, mode: a = "single", digitType: o = "persian", showStatusText: s = !0, showActions: c = !0, onToday: d, onClear: f, onConfirm: p, direction: m = "rtl", classNames: h, styles: g }) => {
1198
+ let { theme: _ } = H(), v = (() => {
1082
1199
  if (a === "single") {
1083
1200
  if (!e) return "تاریخی انتخاب نشده";
1084
- let t = z(e, "YYYY/MM/DD", { digitType: o }), n = r ? ce(r, i, o) : "";
1201
+ let t = B(e, "YYYY/MM/DD", { digitType: o }), n = r ? de(r, i, o) : "";
1085
1202
  return n ? `${t}، ${n}` : t;
1086
1203
  }
1087
1204
  if (a === "range") {
1088
1205
  let [e, n] = t ?? [null, null];
1089
1206
  if (!e) return "بازه‌ای انتخاب نشده";
1090
- let r = z(e, "YYYY/MM/DD", { digitType: o });
1091
- return n ? `${r} تا ${z(n, "YYYY/MM/DD", { digitType: o })}` : `${r} تا …`;
1207
+ let r = B(e, "YYYY/MM/DD", { digitType: o });
1208
+ return n ? `${r} تا ${B(n, "YYYY/MM/DD", { digitType: o })}` : `${r} تا …`;
1092
1209
  }
1093
- let s = n?.length ?? 0, c = o === "persian" ? L(s) : String(s);
1210
+ let s = n?.length ?? 0, c = o === "persian" ? R(s) : String(s);
1094
1211
  return s ? `${c} تاریخ انتخاب شده` : "تاریخی انتخاب نشده";
1095
1212
  })(), y = {
1096
1213
  minHeight: "34px",
@@ -1113,6 +1230,9 @@ var le = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
1113
1230
  justifyContent: s ? "space-between" : "flex-end",
1114
1231
  flexWrap: "wrap",
1115
1232
  gap: "8px",
1233
+ width: "100%",
1234
+ minWidth: 0,
1235
+ boxSizing: "border-box",
1116
1236
  padding: "10px 0 0",
1117
1237
  borderTop: `1px solid ${_.colors.border}`,
1118
1238
  color: _.colors.textPrimary,
@@ -1124,6 +1244,8 @@ var le = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
1124
1244
  color: _.colors.textSecondary,
1125
1245
  fontSize: "0.78rem",
1126
1246
  lineHeight: 1.5,
1247
+ minWidth: 0,
1248
+ overflowWrap: "anywhere",
1127
1249
  ...g?.footerStatus
1128
1250
  },
1129
1251
  children: v
@@ -1174,7 +1296,7 @@ var le = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
1174
1296
  ]
1175
1297
  })]
1176
1298
  });
1177
- }, ue = ({ value: e, onChange: t, minuteStep: n = 1, hourStep: r = 1, showSeconds: a = !1, digitType: d = "persian", classNames: f, styles: p }) => {
1299
+ }, pe = ({ value: e, onChange: t, minuteStep: n = 1, hourStep: r = 1, showSeconds: a = !1, digitType: d = "persian", classNames: f, styles: p }) => {
1178
1300
  let [m, h] = s(null), g = o(null), _ = Array.from({ length: Math.ceil(24 / r) }, (e, t) => t * r), v = Array.from({ length: Math.ceil(60 / n) }, (e, t) => t * n), y = Array.from({ length: 60 }, (e, t) => t);
1179
1301
  i(() => {
1180
1302
  let e = (e) => {
@@ -1186,7 +1308,7 @@ var le = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
1186
1308
  }, []);
1187
1309
  let b = (e) => {
1188
1310
  let t = String(e).padStart(2, "0");
1189
- return d === "persian" ? L(t) : t;
1311
+ return d === "persian" ? R(t) : t;
1190
1312
  }, x = (e, t, n, r) => {
1191
1313
  let i = m === e;
1192
1314
  return /* @__PURE__ */ u("div", {
@@ -1274,6 +1396,7 @@ var le = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
1274
1396
  display: "flex",
1275
1397
  alignItems: "center",
1276
1398
  justifyContent: "center",
1399
+ flexWrap: "wrap",
1277
1400
  gap: "6px",
1278
1401
  padding: "6px 12px",
1279
1402
  borderTop: "1px solid var(--pdp-surface-border, #e2e8f0)",
@@ -1281,6 +1404,9 @@ var le = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
1281
1404
  borderRadius: "0 0 var(--pdp-border-radius, 10px) var(--pdp-border-radius, 10px)",
1282
1405
  direction: "ltr",
1283
1406
  userSelect: "none",
1407
+ width: "100%",
1408
+ maxWidth: "100%",
1409
+ boxSizing: "border-box",
1284
1410
  ...p?.timePicker
1285
1411
  },
1286
1412
  children: [
@@ -1316,12 +1442,12 @@ var le = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
1316
1442
  };
1317
1443
  //#endregion
1318
1444
  //#region src/components/masked-input/mask-utils.ts
1319
- function G(e, t = "persian") {
1320
- let n = R(e).replace(/\D/g, "").slice(0, 8), r = "";
1321
- return n.length > 0 && (r = n.slice(0, 4)), n.length >= 5 && (r += `/${n.slice(4, 6)}`), n.length >= 7 && (r += `/${n.slice(6, 8)}`), t === "persian" ? L(r) : r;
1445
+ function me(e, t = "persian") {
1446
+ let n = z(e).replace(/\D/g, "").slice(0, 8), r = "";
1447
+ return n.length > 0 && (r = n.slice(0, 4)), n.length >= 5 && (r += `/${n.slice(4, 6)}`), n.length >= 7 && (r += `/${n.slice(6, 8)}`), t === "persian" ? R(r) : r;
1322
1448
  }
1323
- function K(e, t, n, r) {
1324
- let i = R(e).trim();
1449
+ function he(e, t, n, r) {
1450
+ let i = z(e).trim();
1325
1451
  if (!i) return {
1326
1452
  isValid: !0,
1327
1453
  date: null
@@ -1338,7 +1464,7 @@ function K(e, t, n, r) {
1338
1464
  date: null,
1339
1465
  error: "INVALID_MONTH"
1340
1466
  };
1341
- let l = s - 1, u = g(o, l);
1467
+ let l = s - 1, u = _(o, l);
1342
1468
  if (c < 1 || c > u) return {
1343
1469
  isValid: !1,
1344
1470
  date: null,
@@ -1349,11 +1475,11 @@ function K(e, t, n, r) {
1349
1475
  month: l,
1350
1476
  day: c
1351
1477
  };
1352
- return t && O(d, t) < 0 ? {
1478
+ return t && k(d, t) < 0 ? {
1353
1479
  isValid: !1,
1354
1480
  date: d,
1355
1481
  error: "OUT_OF_MIN_BOUNDS"
1356
- } : n && O(d, n) > 0 ? {
1482
+ } : n && k(d, n) > 0 ? {
1357
1483
  isValid: !1,
1358
1484
  date: d,
1359
1485
  error: "OUT_OF_MAX_BOUNDS"
@@ -1368,19 +1494,19 @@ function K(e, t, n, r) {
1368
1494
  }
1369
1495
  //#endregion
1370
1496
  //#region src/components/masked-input/MaskedDateInput.tsx
1371
- var de = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a, digitType: c = "persian", minDate: d, maxDate: f, isDateDisabled: p, clearable: m = !0, placeholder: h = "۱۴۰۵/۰۱/۱۵", disabled: g = !1, direction: _ = "rtl", wrapperClassName: v, wrapperStyle: y, clearButtonClassName: b, clearButtonStyle: x, style: S, ...C }) => {
1372
- let { theme: w } = U(), [T, E] = s(t), D = e === void 0 ? T : e, [O, k] = s(() => D ? z(D, "YYYY/MM/DD", { digitType: c }) : ""), [A, j] = s(!1), M = o(null);
1497
+ var ge = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a, digitType: c = "persian", minDate: d, maxDate: f, isDateDisabled: p, clearable: m = !0, placeholder: h = "۱۴۰۵/۰۱/۱۵", disabled: g = !1, direction: _ = "rtl", wrapperClassName: v, wrapperStyle: y, clearButtonClassName: b, clearButtonStyle: x, style: S, ...C }) => {
1498
+ let { theme: w } = H(), [T, E] = s(t), D = e === void 0 ? T : e, [O, k] = s(() => D ? B(D, "YYYY/MM/DD", { digitType: c }) : ""), [ee, A] = s(!1), j = o(null);
1373
1499
  i(() => {
1374
- e !== void 0 && (k(e ? z(e, "YYYY/MM/DD", { digitType: c }) : ""), j(!1));
1500
+ e !== void 0 && (k(e ? B(e, "YYYY/MM/DD", { digitType: c }) : ""), A(!1));
1375
1501
  }, [e, c]);
1376
- let N = (t) => {
1377
- let n = t.target.value, i = G(n, c);
1502
+ let M = (t) => {
1503
+ let n = t.target.value, i = me(n, c);
1378
1504
  if (k(i), i.length === 10 || i.length === 0) {
1379
- let t = K(i, d, f, p);
1380
- t.isValid ? (j(!1), a?.(null), e === void 0 && E(t.date), r?.(t.date)) : (j(!0), a?.(t.error));
1381
- } else j(!1), a?.(null);
1382
- }, P = n(() => {
1383
- k(""), j(!1), a?.(null), e === void 0 && E(null), r?.(null), M.current?.focus();
1505
+ let t = he(i, d, f, p);
1506
+ t.isValid ? (A(!1), a?.(null), e === void 0 && E(t.date), r?.(t.date)) : (A(!0), a?.(t.error));
1507
+ } else A(!1), a?.(null);
1508
+ }, N = n(() => {
1509
+ k(""), A(!1), a?.(null), e === void 0 && E(null), r?.(null), j.current?.focus();
1384
1510
  }, [
1385
1511
  e,
1386
1512
  r,
@@ -1393,22 +1519,27 @@ var de = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
1393
1519
  position: "relative",
1394
1520
  display: "inline-flex",
1395
1521
  alignItems: "center",
1522
+ width: "100%",
1523
+ maxWidth: "180px",
1396
1524
  ...y
1397
1525
  },
1398
1526
  children: [/* @__PURE__ */ l("input", {
1399
- ref: M,
1527
+ ref: j,
1400
1528
  type: "text",
1401
1529
  inputMode: "numeric",
1402
1530
  disabled: g,
1403
1531
  placeholder: c === "persian" ? h : "1405/01/15",
1404
1532
  value: O,
1405
- onChange: N,
1533
+ onChange: M,
1406
1534
  style: {
1407
1535
  width: "180px",
1536
+ maxWidth: "100%",
1537
+ minWidth: 0,
1538
+ boxSizing: "border-box",
1408
1539
  padding: "8px 12px",
1409
1540
  paddingInlineEnd: m && O ? "32px" : "12px",
1410
1541
  borderRadius: w.radii.sm,
1411
- border: `1px solid ${A ? w.colors.holiday : w.colors.border}`,
1542
+ border: `1px solid ${ee ? w.colors.holiday : w.colors.border}`,
1412
1543
  backgroundColor: w.colors.background,
1413
1544
  color: w.colors.textPrimary,
1414
1545
  fontSize: "14px",
@@ -1423,7 +1554,7 @@ var de = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
1423
1554
  }), m && O && !g && /* @__PURE__ */ l("button", {
1424
1555
  type: "button",
1425
1556
  "aria-label": "پاک کردن",
1426
- onClick: P,
1557
+ onClick: N,
1427
1558
  className: b,
1428
1559
  style: {
1429
1560
  position: "absolute",
@@ -1446,12 +1577,12 @@ var de = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
1446
1577
  };
1447
1578
  //#endregion
1448
1579
  //#region src/events/event-utils.ts
1449
- function fe(e, t) {
1450
- return !t || t.length === 0 ? [] : t.filter((t) => b(t.date, e));
1580
+ function _e(e, t) {
1581
+ return !t || t.length === 0 ? [] : t.filter((t) => x(t.date, e));
1451
1582
  }
1452
1583
  //#endregion
1453
1584
  //#region src/holidays/iran-holidays.ts
1454
- var pe = {
1585
+ var ve = {
1455
1586
  "0-1": "جشن نوروز / سال نو",
1456
1587
  "0-2": "عید نوروز",
1457
1588
  "0-3": "عید نوروز",
@@ -1464,9 +1595,9 @@ var pe = {
1464
1595
  "11-29": "روز ملی شدن صنعت نفت"
1465
1596
  };
1466
1597
  function q(e) {
1467
- return v(e.year, e.month, e.day).getDay() === 5;
1598
+ return y(e.year, e.month, e.day).getDay() === 5;
1468
1599
  }
1469
- function me(e, t) {
1600
+ function ye(e, t) {
1470
1601
  if (t && t.length > 0) {
1471
1602
  let n = t.find((t) => t.date.year === e.year && t.date.month === e.month && t.date.day === e.day);
1472
1603
  if (n) return {
@@ -1476,8 +1607,8 @@ function me(e, t) {
1476
1607
  };
1477
1608
  }
1478
1609
  let n = `${e.month}-${e.day}`;
1479
- return pe[n] ? {
1480
- title: pe[n],
1610
+ return ve[n] ? {
1611
+ title: ve[n],
1481
1612
  type: "solar",
1482
1613
  isOff: !0
1483
1614
  } : q(e) ? {
@@ -1488,8 +1619,12 @@ function me(e, t) {
1488
1619
  }
1489
1620
  //#endregion
1490
1621
  //#region src/components/JalaliDatePicker.tsx
1491
- function he({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDate: p, maxDate: m, isDateDisabled: h, firstDayOfWeek: g = 0, variant: _ = "popover", placeholder: v = "YYYY/MM/DD", digitType: y = "persian", className: x, style: T, classNames: E, styles: D, showFooter: O = !0, showStatusText: A = !0, allowClear: j = !0, enableTime: N = !1, timeValue: P, defaultTimeValue: I, onTimeChange: ee, minuteStep: R = 1, hourStep: B = 1, showSeconds: V = !1, numberOfMonths: H = 1, useMaskedInput: U = !1, events: te, showHolidays: W = !1, customHolidays: se }) {
1492
- let [G, K] = s(_ === "inline"), [pe, q] = s(!1), he = o(null), J = _ === "modal", ge = a(() => I || (t instanceof Date ? {
1622
+ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDate: m, maxDate: h, isDateDisabled: g, firstDayOfWeek: _ = 0, variant: v = "popover", placeholder: y = "YYYY/MM/DD", digitType: b = "persian", className: S, style: E, classNames: D, styles: O, showFooter: k = !0, showStatusText: A = !0, allowClear: j = !0, enableTime: M = !1, timeValue: P, defaultTimeValue: F, onTimeChange: I, minuteStep: re = 1, hourStep: L = 1, showSeconds: z = !1, numberOfMonths: V = 1, useMaskedInput: ie = !1, events: ae, showHolidays: H = !1, customHolidays: U, zIndex: W = 9999 }) {
1623
+ let [G, K] = s(v === "inline"), [me, he] = s(!1), ve = o(null), q = o(null), [be, xe] = s(null), J = v === "modal";
1624
+ i(() => {
1625
+ v === "inline" && K(!0);
1626
+ }, [v]);
1627
+ let Se = a(() => F || (t instanceof Date ? {
1493
1628
  hour: t.getHours(),
1494
1629
  minute: t.getMinutes(),
1495
1630
  second: t.getSeconds()
@@ -1497,89 +1632,109 @@ function he({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
1497
1632
  hour: r.getHours(),
1498
1633
  minute: r.getMinutes(),
1499
1634
  second: r.getSeconds()
1500
- } : oe()), [
1501
- I,
1635
+ } : ue()), [
1636
+ F,
1502
1637
  t,
1503
1638
  r
1504
- ]), [_e, ve] = s(ge), Y = P === void 0 ? _e : P ?? oe();
1639
+ ]), [Ce, we] = s(Se), Y = P === void 0 ? Ce : P ?? ue();
1505
1640
  i(() => {
1506
- if (_ === "inline" || !G) return;
1641
+ if (v === "inline" || !G) return;
1507
1642
  let e = (e) => {
1508
- he.current && !he.current.contains(e.target) && (K(!1), q(!1));
1643
+ ve.current && !ve.current.contains(e.target) && !q.current?.contains(e.target) && (K(!1), he(!1));
1509
1644
  };
1510
- return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e), () => {
1645
+ return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), () => {
1511
1646
  document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
1512
1647
  };
1513
- }, [_, G]);
1514
- let ye = a(() => {
1648
+ }, [v, G]), i(() => {
1649
+ if (v !== "popover" || !G) {
1650
+ xe(null);
1651
+ return;
1652
+ }
1653
+ let e = () => {
1654
+ let e = ve.current, t = q.current;
1655
+ if (!e || !t) return;
1656
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = Math.max(0, window.innerHeight - n.bottom - 6 - 12), a = Math.max(0, n.top - 6 - 12), o = r.height > i && a > i, s = Math.max(120, o ? a : i), c = Math.min(r.height, s), l = o ? Math.max(12, n.top - 6 - c) : n.bottom + 6, u = Math.max(12, window.innerWidth - r.width - 12), d = Math.min(Math.max(12, n.left), u);
1657
+ xe((e) => e?.top === l && e.left === d && e.maxHeight === s ? e : {
1658
+ top: l,
1659
+ left: d,
1660
+ maxHeight: s
1661
+ });
1662
+ };
1663
+ e();
1664
+ let t = typeof ResizeObserver > "u" ? null : new ResizeObserver(e);
1665
+ return q.current && t?.observe(q.current), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
1666
+ t?.disconnect(), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
1667
+ };
1668
+ }, [v, G]);
1669
+ let Te = a(() => {
1515
1670
  if (t !== void 0) {
1516
1671
  if (!t) return null;
1517
- if (t instanceof Date) return C(t);
1672
+ if (t instanceof Date) return w(t);
1518
1673
  if (Array.isArray(t)) {
1519
1674
  if (e === "range") {
1520
1675
  let [e, n] = t;
1521
- return [e ? C(e) : null, n ? C(n) : null];
1676
+ return [e ? w(e) : null, n ? w(n) : null];
1522
1677
  }
1523
- if (e === "multiple") return t.map((e) => C(e));
1678
+ if (e === "multiple") return t.map((e) => w(e));
1524
1679
  }
1525
1680
  return null;
1526
1681
  }
1527
- }, [t, e]), be = a(() => {
1682
+ }, [t, e]), Ee = a(() => {
1528
1683
  if (r !== void 0) {
1529
1684
  if (!r) return null;
1530
- if (r instanceof Date) return C(r);
1685
+ if (r instanceof Date) return w(r);
1531
1686
  if (Array.isArray(r)) {
1532
1687
  if (e === "range") {
1533
1688
  let [e, t] = r;
1534
- return [e ? C(e) : null, t ? C(t) : null];
1689
+ return [e ? w(e) : null, t ? w(t) : null];
1535
1690
  }
1536
- if (e === "multiple") return r.map((e) => C(e));
1691
+ if (e === "multiple") return r.map((e) => w(e));
1537
1692
  }
1538
1693
  return null;
1539
1694
  }
1540
- }, [r, e]), xe = a(() => p ? C(p) : void 0, [p]), Se = a(() => m ? C(m) : void 0, [m]), Ce = n((t, n) => {
1695
+ }, [r, e]), De = a(() => m ? w(m) : void 0, [m]), Oe = a(() => h ? w(h) : void 0, [h]), ke = n((e) => g ? g(T(e)) : !1, [g]), Ae = n((t, n) => {
1541
1696
  if (!t) return null;
1542
- let r = n ?? Y, i = N ? r.hour : 0, a = N ? r.minute : 0, o = N && V ? r.second ?? 0 : 0;
1543
- if (e === "single" && !Array.isArray(t)) return w(t, i, a, o);
1697
+ let r = n ?? Y, i = M ? r.hour : 0, a = M ? r.minute : 0, o = M && z ? r.second ?? 0 : 0;
1698
+ if (e === "single" && !Array.isArray(t)) return T(t, i, a, o);
1544
1699
  if (e === "range" && Array.isArray(t)) {
1545
1700
  let [e, n] = t;
1546
- return [e ? w(e, 0, 0, 0) : null, n ? w(n, 23, 59, 59) : null];
1701
+ return [e ? T(e, 0, 0, 0) : null, n ? T(n, 23, 59, 59) : null];
1547
1702
  }
1548
- return e === "multiple" && Array.isArray(t) ? t.map((e) => w(e, i, a, o)) : null;
1703
+ return e === "multiple" && Array.isArray(t) ? t.map((e) => T(e, i, a, o)) : null;
1549
1704
  }, [
1550
1705
  e,
1551
- N,
1706
+ M,
1552
1707
  Y,
1553
- V
1554
- ]), { selected: X, viewYear: Z, viewMonth: Q, grid: we, goToPrevMonth: Te, goToNextMonth: Ee, setView: De, goToToday: Oe, selectDate: ke, setHoverDate: Ae, hoverDate: je, clear: Me } = M({
1708
+ z
1709
+ ]), { selected: X, viewYear: Z, viewMonth: Q, grid: je, goToPrevMonth: Me, goToNextMonth: Ne, setView: Pe, goToToday: Fe, selectDate: Ie, setHoverDate: Le, hoverDate: Re, clear: ze } = te({
1555
1710
  mode: e,
1556
- value: ye,
1557
- defaultValue: be,
1558
- minDate: xe,
1559
- maxDate: Se,
1560
- firstDayOfWeek: g,
1561
- isDateDisabled: h ? (e) => h(w(e)) : void 0,
1711
+ value: Te,
1712
+ defaultValue: Ee,
1713
+ minDate: De,
1714
+ maxDate: Oe,
1715
+ firstDayOfWeek: _,
1716
+ isDateDisabled: g ? ke : void 0,
1562
1717
  onChange: (e) => {
1563
- f?.(Ce(e));
1718
+ p?.(Ae(e));
1564
1719
  }
1565
- }), Ne = n((e) => {
1566
- P === void 0 && ve(e), ee?.(e), X && f && f(Ce(X, e));
1720
+ }), Be = n((e) => {
1721
+ P === void 0 && we(e), I?.(e), X && p && p(Ae(X, e));
1567
1722
  }, [
1568
1723
  P,
1569
- ee,
1724
+ I,
1570
1725
  X,
1571
- f,
1572
- Ce
1573
- ]), Pe = e === "single" ? X : null, Fe = (t) => {
1574
- ke(t), _ === "popover" && e === "single" && !N && K(!1);
1575
- }, Ie = (e) => {
1576
- e.stopPropagation(), Me();
1577
- }, { handleKeyDown: Le, getCellTabIndex: Re, setFocusedDate: ze } = F({
1726
+ p,
1727
+ Ae
1728
+ ]), Ve = e === "single" ? X : null, He = (t) => {
1729
+ Ie(t), v === "popover" && e === "single" && !M && K(!1);
1730
+ }, Ue = (e) => {
1731
+ e.stopPropagation(), ze();
1732
+ }, { handleKeyDown: We, getCellTabIndex: Ge, setFocusedDate: Ke } = ne({
1578
1733
  viewYear: Z,
1579
1734
  viewMonth: Q,
1580
- selectedDate: Pe,
1581
- onSelectDate: Fe,
1582
- onViewChange: De,
1735
+ selectedDate: Ve,
1736
+ onSelectDate: He,
1737
+ onViewChange: Pe,
1583
1738
  isRtl: !0
1584
1739
  });
1585
1740
  i(() => {
@@ -1599,20 +1754,38 @@ function he({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
1599
1754
  } : {
1600
1755
  year: Z,
1601
1756
  month: Q + 1
1602
- }, [Z, Q]), Be = a(() => {
1603
- if (H !== 2) return [];
1604
- let t = S({
1757
+ }, [Z, Q]), qe = a(() => Q === 0 ? {
1758
+ year: Z - 1,
1759
+ month: 11
1760
+ } : {
1761
+ year: Z,
1762
+ month: Q - 1
1763
+ }, [Z, Q]), Je = !N(qe.year, qe.month, {
1764
+ minDate: De,
1765
+ maxDate: Oe
1766
+ }), Ye = V === 2 ? $.month === 11 ? {
1767
+ year: $.year + 1,
1768
+ month: 0
1769
+ } : {
1770
+ year: $.year,
1771
+ month: $.month + 1
1772
+ } : $, Xe = !N(Ye.year, Ye.month, {
1773
+ minDate: De,
1774
+ maxDate: Oe
1775
+ }), Ze = a(() => {
1776
+ if (V !== 2) return [];
1777
+ let t = C({
1605
1778
  year: $.year,
1606
1779
  month: $.month,
1607
- firstDayOfWeek: g,
1608
- minDate: xe,
1609
- maxDate: Se
1780
+ firstDayOfWeek: _,
1781
+ minDate: De,
1782
+ maxDate: Oe
1610
1783
  });
1611
1784
  if (e !== "range") return t;
1612
- let [n, r] = X || [null, null], i = r ?? (n && je ? je : null);
1785
+ let [n, r] = X || [null, null], i = r ?? (n && Re ? Re : null);
1613
1786
  return t.map((e) => {
1614
- let t = n ? b(e.jalali, n) : !1, r = i ? b(e.jalali, i) : !1, a = !1;
1615
- return n && i && (a = k(e.jalali, n, i)), {
1787
+ let t = n ? x(e.jalali, n) : !1, r = i ? x(e.jalali, i) : !1, a = !1;
1788
+ return n && i && (a = ee(e.jalali, n, i)), {
1616
1789
  ...e,
1617
1790
  isSelected: t || r,
1618
1791
  isInRange: a,
@@ -1621,199 +1794,220 @@ function he({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
1621
1794
  };
1622
1795
  });
1623
1796
  }, [
1624
- H,
1797
+ V,
1625
1798
  $,
1626
- g,
1627
- xe,
1628
- Se,
1799
+ _,
1800
+ De,
1801
+ Oe,
1629
1802
  e,
1630
1803
  X,
1631
- je
1632
- ]), Ve = a(() => {
1804
+ Re
1805
+ ]), Qe = a(() => {
1633
1806
  if (!X) return "";
1634
1807
  if (e === "single") {
1635
- let e = z(X, "YYYY/MM/DD", { digitType: y });
1636
- return N && Y ? `${e} ${ce(Y, V, y)}` : e;
1808
+ let e = B(X, "YYYY/MM/DD", { digitType: b });
1809
+ return M && Y ? `${e} ${de(Y, z, b)}` : e;
1637
1810
  }
1638
1811
  if (e === "range") {
1639
1812
  let [e, t] = X || [null, null];
1640
- if (e && t) return `${z(e, "YYYY/MM/DD", { digitType: y })} - ${z(t, "YYYY/MM/DD", { digitType: y })}`;
1641
- if (e) return `${z(e, "YYYY/MM/DD", { digitType: y })} - ...`;
1813
+ if (e && t) return `${B(e, "YYYY/MM/DD", { digitType: b })} - ${B(t, "YYYY/MM/DD", { digitType: b })}`;
1814
+ if (e) return `${B(e, "YYYY/MM/DD", { digitType: b })} - ...`;
1642
1815
  }
1643
- return e === "multiple" && Array.isArray(X) ? `${L(X.length)} تاریخ انتخاب شده` : "";
1816
+ return e === "multiple" && Array.isArray(X) ? `${R(X.length)} تاریخ انتخاب شده` : "";
1644
1817
  }, [
1645
1818
  X,
1646
1819
  e,
1647
- y,
1648
- N,
1820
+ b,
1821
+ M,
1649
1822
  Y,
1650
- V
1651
- ]), He = !!(e === "single" ? X : e === "range" ? X?.[0] : X?.length), Ue = (e, t, n, r = !0, i = !0) => /* @__PURE__ */ u("div", {
1823
+ z
1824
+ ]), $e = !!(e === "single" ? X : e === "range" ? X?.[0] : X?.length), et = (e, t, n, r = !0, i = !0) => /* @__PURE__ */ u("div", {
1825
+ className: D?.calendarPane,
1652
1826
  style: {
1653
1827
  width: "calc(7 * var(--pdp-cell-size, 34px) + 6 * 4px)",
1654
- flexShrink: 0
1828
+ maxWidth: "100%",
1829
+ minWidth: 0,
1830
+ flex: "1 1 calc(7 * var(--pdp-cell-size, 34px) + 6 * 4px)",
1831
+ ...O?.calendarPane
1655
1832
  },
1656
1833
  children: [
1657
- /* @__PURE__ */ l(ne, {
1834
+ /* @__PURE__ */ l(oe, {
1658
1835
  year: e,
1659
- monthName: d[t],
1660
- onPrevMonth: r ? Te : () => {},
1661
- onNextMonth: i ? Ee : () => {},
1662
- onTitleClick: () => q((e) => !e),
1663
- isPickerOpen: pe,
1664
- classNames: E,
1665
- styles: D
1836
+ monthName: f[t],
1837
+ onPrevMonth: r ? Me : () => {},
1838
+ onNextMonth: i ? Ne : () => {},
1839
+ onTitleClick: () => he((e) => !e),
1840
+ isPickerOpen: me,
1841
+ isPrevDisabled: !r || Je,
1842
+ isNextDisabled: !i || Xe,
1843
+ classNames: D,
1844
+ styles: O
1666
1845
  }),
1667
- /* @__PURE__ */ l(re, {
1668
- firstDayOfWeek: g,
1669
- classNames: E,
1670
- styles: D
1846
+ /* @__PURE__ */ l(se, {
1847
+ firstDayOfWeek: _,
1848
+ classNames: D,
1849
+ styles: O
1671
1850
  }),
1672
1851
  /* @__PURE__ */ l("div", {
1673
1852
  role: "grid",
1674
- "aria-label": `${d[t]} ${L(e)}`,
1675
- className: E?.grid,
1853
+ "aria-label": `${f[t]} ${R(e)}`,
1854
+ className: D?.grid,
1676
1855
  style: {
1677
1856
  display: "grid",
1678
- gridTemplateColumns: "repeat(7, var(--pdp-cell-size, 34px))",
1857
+ gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
1679
1858
  gap: "4px",
1680
1859
  justifyContent: "center",
1681
1860
  alignItems: "center",
1682
- ...D?.grid
1861
+ ...O?.grid
1683
1862
  },
1684
1863
  children: n.map((e, t) => {
1685
- let n = W ? me(e.jalali, se) : null, r = fe(e.jalali, te);
1686
- return /* @__PURE__ */ l(ie, {
1864
+ let n = H ? ye(e.jalali, U) : null, r = _e(e.jalali, ae);
1865
+ return /* @__PURE__ */ l(ce, {
1687
1866
  cell: e,
1688
- digitType: y,
1867
+ digitType: b,
1689
1868
  isHoliday: !!n,
1690
1869
  holidayTitle: n?.title,
1691
1870
  events: r,
1692
- classNames: E,
1693
- styles: D,
1694
- tabIndex: Re(e.jalali),
1695
- onSelect: Fe,
1696
- onHover: Ae,
1697
- onFocus: ze
1871
+ classNames: D,
1872
+ styles: O,
1873
+ tabIndex: Ge(e.jalali),
1874
+ onSelect: He,
1875
+ onHover: Le,
1876
+ onFocus: Ke
1698
1877
  }, t);
1699
1878
  })
1700
1879
  })
1701
1880
  ]
1702
- }), We = /* @__PURE__ */ l("div", {
1881
+ }), tt = /* @__PURE__ */ l("div", {
1882
+ ref: q,
1703
1883
  role: J ? "dialog" : "region",
1704
1884
  "aria-modal": J ? !0 : void 0,
1705
1885
  "aria-label": "تقویم شمسی",
1706
- onKeyDown: Le,
1707
- onClick: (e) => J && e.stopPropagation(),
1708
- className: E?.calendar,
1886
+ onKeyDown: We,
1887
+ onClick: (e) => e.stopPropagation(),
1888
+ className: D?.calendar,
1709
1889
  style: {
1710
- position: _ === "popover" ? "absolute" : J ? "relative" : "static",
1711
- top: _ === "popover" ? "calc(100% + 4px)" : void 0,
1712
- left: _ === "popover" ? 0 : void 0,
1713
- zIndex: J ? 1001 : 1e3,
1890
+ position: v === "popover" ? "fixed" : J ? "relative" : "static",
1891
+ top: v === "popover" ? be?.top ?? 0 : void 0,
1892
+ left: v === "popover" ? be?.left ?? 0 : void 0,
1893
+ visibility: v === "popover" && !be ? "hidden" : "visible",
1894
+ zIndex: J ? W + 1 : W,
1714
1895
  padding: "12px",
1715
1896
  backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1716
1897
  borderRadius: "var(--pdp-border-radius, 12px)",
1717
1898
  border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1718
- boxShadow: J ? "0 20px 25px -5px rgb(0 0 0 / 0.3)" : "var(--pdp-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1))",
1899
+ boxShadow: J ? "0 20px 25px -5px rgb(0 0 0 / 0.3)" : "0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",
1719
1900
  width: "max-content",
1901
+ maxWidth: v === "inline" ? "100%" : "calc(100vw - 24px)",
1902
+ maxHeight: J ? "calc(100dvh - 32px)" : v === "popover" ? be?.maxHeight : void 0,
1903
+ overflowY: J || v === "popover" ? "auto" : void 0,
1904
+ overflowX: "hidden",
1720
1905
  userSelect: "none",
1721
1906
  display: "flex",
1722
1907
  flexDirection: "column",
1723
1908
  gap: "8px",
1724
1909
  direction: "rtl",
1725
1910
  boxSizing: "border-box",
1726
- ...D?.calendar
1911
+ ...O?.calendar
1727
1912
  },
1728
- children: pe ? /* @__PURE__ */ l(ae, {
1913
+ children: me ? /* @__PURE__ */ l(le, {
1729
1914
  currentYear: Z,
1730
1915
  currentMonth: Q,
1731
1916
  onSelectMonth: (e) => {
1732
- De(Z, e), q(!1);
1917
+ Pe(Z, e), he(!1);
1733
1918
  },
1734
- onSelectYear: (e) => De(e, Q),
1735
- classNames: E,
1736
- styles: D
1919
+ onSelectYear: (e) => Pe(e, Q),
1920
+ minDate: De,
1921
+ maxDate: Oe,
1922
+ isDateDisabled: g ? ke : void 0,
1923
+ classNames: D,
1924
+ styles: O
1737
1925
  }) : /* @__PURE__ */ u(c, { children: [
1738
1926
  /* @__PURE__ */ u("div", {
1927
+ className: D?.calendarPanes,
1739
1928
  style: {
1740
1929
  display: "flex",
1741
1930
  flexDirection: "row",
1742
- flexWrap: "nowrap",
1931
+ flexWrap: "wrap",
1743
1932
  gap: "20px",
1744
1933
  alignItems: "flex-start",
1745
- justifyContent: "center"
1934
+ justifyContent: "center",
1935
+ width: "100%",
1936
+ minWidth: 0,
1937
+ boxSizing: "border-box",
1938
+ ...O?.calendarPanes
1746
1939
  },
1747
- children: [Ue(Z, Q, we, !0, H === 1), H === 2 && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", { style: {
1748
- width: "1px",
1749
- alignSelf: "stretch",
1750
- backgroundColor: "var(--pdp-surface-border, #e2e8f0)",
1751
- margin: "0 2px"
1752
- } }), Ue($.year, $.month, Be, !1, !0)] })]
1940
+ children: [et(Z, Q, je, !0, V === 1), V === 2 && /* @__PURE__ */ l(c, { children: et($.year, $.month, Ze, !1, !0) })]
1753
1941
  }),
1754
- N && /* @__PURE__ */ l(ue, {
1942
+ M && /* @__PURE__ */ l(pe, {
1755
1943
  value: Y,
1756
- onChange: Ne,
1757
- minuteStep: R,
1758
- hourStep: B,
1759
- showSeconds: V,
1760
- digitType: y,
1761
- classNames: E,
1762
- styles: D
1944
+ onChange: Be,
1945
+ minuteStep: re,
1946
+ hourStep: L,
1947
+ showSeconds: z,
1948
+ digitType: b,
1949
+ classNames: D,
1950
+ styles: O
1763
1951
  }),
1764
- O && /* @__PURE__ */ l(le, {
1952
+ k && /* @__PURE__ */ l(fe, {
1765
1953
  mode: e,
1766
- digitType: y,
1954
+ digitType: b,
1767
1955
  showStatusText: A,
1768
1956
  selectedDate: e === "single" ? X : null,
1769
1957
  selectedRange: e === "range" ? X : void 0,
1770
1958
  selectedDates: e === "multiple" ? X : void 0,
1771
- selectedTime: N ? Y : void 0,
1772
- onToday: Oe,
1773
- classNames: E,
1774
- styles: D
1959
+ selectedTime: M ? Y : void 0,
1960
+ onToday: Fe,
1961
+ classNames: D,
1962
+ styles: O
1775
1963
  })
1776
1964
  ] })
1777
1965
  });
1778
1966
  return /* @__PURE__ */ u("div", {
1779
- ref: he,
1780
- className: x ?? E?.root,
1967
+ ref: ve,
1968
+ className: S ?? D?.root,
1781
1969
  style: {
1782
1970
  position: "relative",
1783
1971
  display: "inline-block",
1784
- ...T,
1785
- ...D?.root
1972
+ maxWidth: "100%",
1973
+ verticalAlign: "top",
1974
+ zIndex: G && v === "popover" ? W : 1,
1975
+ ...E,
1976
+ ...O?.root
1786
1977
  },
1787
- children: [_ !== "inline" && (U && e === "single" && _ === "popover" ? /* @__PURE__ */ l(de, {
1788
- value: Pe,
1789
- digitType: y,
1790
- placeholder: v,
1978
+ children: [v !== "inline" && (ie && e === "single" && v === "popover" ? /* @__PURE__ */ l(ge, {
1979
+ value: Ve,
1980
+ digitType: b,
1981
+ placeholder: y,
1791
1982
  onChange: (e) => {
1792
- e ? (ke(e), De(e.year, e.month)) : Me();
1983
+ e ? (Ie(e), Pe(e.year, e.month)) : ze();
1793
1984
  },
1794
1985
  onClick: () => K(!0),
1795
- className: E?.input,
1986
+ className: D?.input,
1796
1987
  style: {
1797
1988
  direction: "ltr",
1798
1989
  textAlign: "left",
1799
- ...D?.input
1990
+ ...O?.input
1800
1991
  }
1801
1992
  }) : /* @__PURE__ */ u("div", {
1802
- onClick: () => K((e) => !e),
1993
+ onClick: (e) => {
1994
+ e.stopPropagation(), K((e) => !e);
1995
+ },
1803
1996
  style: {
1804
1997
  position: "relative",
1805
1998
  display: "inline-flex",
1806
1999
  alignItems: "center",
1807
2000
  cursor: "pointer",
1808
2001
  direction: "ltr",
1809
- width: "100%"
2002
+ width: "100%",
2003
+ maxWidth: "100%"
1810
2004
  },
1811
2005
  children: [/* @__PURE__ */ l("input", {
1812
2006
  type: "text",
1813
2007
  readOnly: !0,
1814
- placeholder: v,
1815
- value: Ve,
1816
- className: E?.input,
2008
+ placeholder: y,
2009
+ value: Qe,
2010
+ className: D?.input,
1817
2011
  style: {
1818
2012
  direction: "ltr",
1819
2013
  textAlign: "left",
@@ -1824,14 +2018,15 @@ function he({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
1824
2018
  color: "var(--pdp-text-primary, #0f172a)",
1825
2019
  cursor: "pointer",
1826
2020
  fontSize: "13.5px",
1827
- minWidth: N ? "190px" : "150px",
2021
+ minWidth: M ? "190px" : "150px",
1828
2022
  width: "100%",
2023
+ maxWidth: "100%",
1829
2024
  boxSizing: "border-box",
1830
- ...D?.input
2025
+ ...O?.input
1831
2026
  }
1832
- }), j && He && /* @__PURE__ */ l("button", {
2027
+ }), j && $e && /* @__PURE__ */ l("button", {
1833
2028
  type: "button",
1834
- onClick: Ie,
2029
+ onClick: Ue,
1835
2030
  "aria-label": "Clear value",
1836
2031
  style: {
1837
2032
  position: "absolute",
@@ -1858,10 +2053,10 @@ function he({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
1858
2053
  },
1859
2054
  children: "✕"
1860
2055
  })]
1861
- })), G && (J ? /* @__PURE__ */ l("div", {
2056
+ })), G && (v === "inline" ? tt : typeof document < "u" ? d(J ? /* @__PURE__ */ l("div", {
1862
2057
  role: "presentation",
1863
2058
  onClick: () => K(!1),
1864
- className: E?.modalBackdrop,
2059
+ className: D?.modalBackdrop,
1865
2060
  style: {
1866
2061
  position: "fixed",
1867
2062
  top: 0,
@@ -1870,73 +2065,88 @@ function he({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
1870
2065
  bottom: 0,
1871
2066
  backgroundColor: "rgba(15, 23, 42, 0.6)",
1872
2067
  backdropFilter: "blur(4px)",
1873
- zIndex: 1e3,
2068
+ zIndex: W,
1874
2069
  display: "flex",
1875
2070
  alignItems: "center",
1876
2071
  justifyContent: "center",
1877
2072
  padding: "16px",
2073
+ boxSizing: "border-box",
2074
+ overflowY: "auto",
1878
2075
  direction: "rtl",
1879
- ...D?.modalBackdrop
2076
+ ...O?.modalBackdrop
1880
2077
  },
1881
- children: We
1882
- }) : We)]
2078
+ children: tt
2079
+ }) : tt, document.body) : null)]
1883
2080
  });
1884
2081
  }
1885
2082
  //#endregion
1886
- //#region src/theme/style-utils.ts
1887
- function J(...e) {
1888
- return e.filter(Boolean).join(" ") || void 0;
1889
- }
1890
- //#endregion
1891
2083
  //#region src/components/dual-calendar/DualMonthCalendar.tsx
1892
- var ge = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDate: i, firstDayOfWeek: o = 0, digitType: c = "persian", minDate: f, maxDate: p, isDateDisabled: m, direction: h = "rtl", className: g, style: _, classNames: v, styles: x }) => {
1893
- let { theme: C } = U(), [w, T] = s(t), E = e === void 0 ? w : e, [D, A] = s(null), j = (e) => c === "persian" ? L(e) : String(e), M = a(() => y(), []), [N, P] = s(() => i || (E[0] ? {
1894
- year: E[0].year,
1895
- month: E[0].month
2084
+ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDate: i, firstDayOfWeek: o = 0, digitType: c = "persian", minDate: d, maxDate: p, isDateDisabled: m, direction: h = "rtl", className: g, style: _, classNames: v, styles: y }) => {
2085
+ let { theme: w } = H(), [T, E] = s(t), D = e === void 0 ? T : e, [O, A] = s(null), j = (e) => c === "persian" ? R(e) : String(e), M = a(() => b(), []), [P, te] = s(() => i || (D[0] ? {
2086
+ year: D[0].year,
2087
+ month: D[0].month
1896
2088
  } : {
1897
2089
  year: M.year,
1898
2090
  month: M.month
1899
- })), F = a(() => N.month === 11 ? {
1900
- year: N.year + 1,
2091
+ })), F = a(() => P.month === 11 ? {
2092
+ year: P.year + 1,
2093
+ month: 0
2094
+ } : {
2095
+ year: P.year,
2096
+ month: P.month + 1
2097
+ }, [P]), I = a(() => P.month === 0 ? {
2098
+ year: P.year - 1,
2099
+ month: 11
2100
+ } : {
2101
+ year: P.year,
2102
+ month: P.month - 1
2103
+ }, [P]), ne = a(() => d ? S(d) : void 0, [d]), re = a(() => p ? S(p) : void 0, [p]), L = !N(I.year, I.month, {
2104
+ minDate: ne,
2105
+ maxDate: re
2106
+ }), z = F.month === 11 ? {
2107
+ year: F.year + 1,
1901
2108
  month: 0
1902
2109
  } : {
1903
- year: N.year,
1904
- month: N.month + 1
1905
- }, [N]), I = () => {
1906
- P((e) => e.month === 0 ? {
2110
+ year: F.year,
2111
+ month: F.month + 1
2112
+ }, B = !N(z.year, z.month, {
2113
+ minDate: ne,
2114
+ maxDate: re
2115
+ }), V = () => {
2116
+ L || te((e) => e.month === 0 ? {
1907
2117
  year: e.year - 1,
1908
2118
  month: 11
1909
2119
  } : {
1910
2120
  year: e.year,
1911
2121
  month: e.month - 1
1912
2122
  });
1913
- }, ee = () => {
1914
- P((e) => e.month === 11 ? {
2123
+ }, ie = () => {
2124
+ B || te((e) => e.month === 11 ? {
1915
2125
  year: e.year + 1,
1916
2126
  month: 0
1917
2127
  } : {
1918
2128
  year: e.year,
1919
2129
  month: e.month + 1
1920
2130
  });
1921
- }, R = n((t) => {
1922
- let [n, i] = E, a;
1923
- !n || n && i ? a = [t, null] : (a = O(t, n) < 0 ? [t, n] : [n, t], A(null)), e === void 0 && T(a), r?.(a);
2131
+ }, ae = n((t) => {
2132
+ let [n, i] = D, a;
2133
+ !n || n && i ? a = [t, null] : (a = k(t, n) < 0 ? [t, n] : [n, t], A(null)), e === void 0 && E(a), r?.(a);
1924
2134
  }, [
1925
- E,
2135
+ D,
1926
2136
  e,
1927
2137
  r
1928
- ]), z = n((e, t) => {
1929
- let n = S({
2138
+ ]), U = n((e, t) => {
2139
+ let n = C({
1930
2140
  year: e,
1931
2141
  month: t,
1932
2142
  firstDayOfWeek: o,
1933
- minDate: f,
2143
+ minDate: d,
1934
2144
  maxDate: p,
1935
2145
  isDateDisabled: m
1936
- }), [r, i] = E, a = i ?? (r && D ? D : null);
2146
+ }), [r, i] = D, a = i ?? (r && O ? O : null);
1937
2147
  return n.map((e) => {
1938
- let t = r ? b(e.jalali, r) : !1, n = a ? b(e.jalali, a) : !1, i = !1;
1939
- return r && a && (i = k(e.jalali, r, a)), {
2148
+ let t = r ? x(e.jalali, r) : !1, n = a ? x(e.jalali, a) : !1, i = !1;
2149
+ return r && a && (i = ee(e.jalali, r, a)), {
1940
2150
  ...e,
1941
2151
  isSelected: t || n,
1942
2152
  isInRange: i,
@@ -1946,20 +2156,20 @@ var ge = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
1946
2156
  });
1947
2157
  }, [
1948
2158
  o,
1949
- f,
2159
+ d,
1950
2160
  p,
1951
2161
  m,
1952
- E,
1953
- D
1954
- ]), B = a(() => z(N.year, N.month), [
1955
- z,
1956
- N.year,
1957
- N.month
1958
- ]), V = a(() => z(F.year, F.month), [
1959
- z,
2162
+ D,
2163
+ O
2164
+ ]), oe = a(() => U(P.year, P.month), [
2165
+ U,
2166
+ P.year,
2167
+ P.month
2168
+ ]), le = a(() => U(F.year, F.month), [
2169
+ U,
1960
2170
  F.year,
1961
2171
  F.month
1962
- ]), H = (e, t, n, r) => /* @__PURE__ */ u("div", {
2172
+ ]), G = (e, t, n, r) => /* @__PURE__ */ u("div", {
1963
2173
  dir: h,
1964
2174
  className: v?.calendarPane,
1965
2175
  style: {
@@ -1967,8 +2177,10 @@ var ge = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
1967
2177
  flexDirection: "column",
1968
2178
  gap: "8px",
1969
2179
  width: "var(--pdp-calendar-pane-width, 276px)",
1970
- minWidth: "var(--pdp-calendar-pane-width, 276px)",
1971
- ...x?.calendarPane
2180
+ maxWidth: "100%",
2181
+ minWidth: 0,
2182
+ flex: "1 1 var(--pdp-calendar-pane-width, 276px)",
2183
+ ...y?.calendarPane
1972
2184
  },
1973
2185
  children: [
1974
2186
  /* @__PURE__ */ u("div", {
@@ -1979,23 +2191,27 @@ var ge = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
1979
2191
  justifyContent: "space-between",
1980
2192
  padding: "0 4px",
1981
2193
  height: "32px",
1982
- ...x?.header
2194
+ ...y?.header
1983
2195
  },
1984
2196
  children: [
1985
2197
  r ? /* @__PURE__ */ l("button", {
1986
2198
  type: "button",
1987
2199
  "aria-label": "ماه قبل",
1988
- onClick: I,
1989
- className: v?.navButton,
2200
+ onClick: V,
2201
+ disabled: L,
2202
+ "aria-disabled": L,
2203
+ className: W(v?.navButton, L && v?.disabledNavButton),
1990
2204
  style: {
1991
2205
  width: "28px",
1992
2206
  height: "28px",
1993
2207
  borderRadius: "6px",
1994
- border: `1px solid ${C.colors.border}`,
1995
- backgroundColor: C.colors.background,
1996
- color: C.colors.textPrimary,
1997
- cursor: "pointer",
1998
- ...x?.navButton
2208
+ border: `1px solid ${w.colors.border}`,
2209
+ backgroundColor: w.colors.background,
2210
+ color: w.colors.textPrimary,
2211
+ cursor: L ? "not-allowed" : "pointer",
2212
+ opacity: L ? .38 : 1,
2213
+ ...y?.navButton,
2214
+ ...L ? y?.disabledNavButton : void 0
1999
2215
  },
2000
2216
  children: h === "rtl" ? "›" : "‹"
2001
2217
  }) : /* @__PURE__ */ l("div", { style: { width: "28px" } }),
@@ -2003,10 +2219,10 @@ var ge = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
2003
2219
  style: {
2004
2220
  fontWeight: 600,
2005
2221
  fontSize: "14px",
2006
- color: C.colors.textPrimary
2222
+ color: w.colors.textPrimary
2007
2223
  },
2008
2224
  children: [
2009
- d[t],
2225
+ f[t],
2010
2226
  " ",
2011
2227
  j(e)
2012
2228
  ]
@@ -2014,46 +2230,51 @@ var ge = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
2014
2230
  r ? /* @__PURE__ */ l("div", { style: { width: "28px" } }) : /* @__PURE__ */ l("button", {
2015
2231
  type: "button",
2016
2232
  "aria-label": "ماه بعد",
2017
- onClick: ee,
2018
- className: v?.navButton,
2233
+ onClick: ie,
2234
+ disabled: B,
2235
+ "aria-disabled": B,
2236
+ className: W(v?.navButton, B && v?.disabledNavButton),
2019
2237
  style: {
2020
2238
  width: "28px",
2021
2239
  height: "28px",
2022
2240
  borderRadius: "6px",
2023
- border: `1px solid ${C.colors.border}`,
2024
- backgroundColor: C.colors.background,
2025
- color: C.colors.textPrimary,
2026
- cursor: "pointer",
2027
- ...x?.navButton
2241
+ border: `1px solid ${w.colors.border}`,
2242
+ backgroundColor: w.colors.background,
2243
+ color: w.colors.textPrimary,
2244
+ cursor: B ? "not-allowed" : "pointer",
2245
+ opacity: B ? .38 : 1,
2246
+ ...y?.navButton,
2247
+ ...B ? y?.disabledNavButton : void 0
2028
2248
  },
2029
2249
  children: h === "rtl" ? "‹" : "›"
2030
2250
  })
2031
2251
  ]
2032
2252
  }),
2033
- /* @__PURE__ */ l(re, {
2253
+ /* @__PURE__ */ l(se, {
2034
2254
  firstDayOfWeek: o,
2035
2255
  classNames: v,
2036
- styles: x
2256
+ styles: y
2037
2257
  }),
2038
2258
  /* @__PURE__ */ l("div", {
2039
2259
  role: "grid",
2040
- "aria-label": `${d[t]} ${j(e)}`,
2260
+ "aria-label": `${f[t]} ${j(e)}`,
2041
2261
  dir: h,
2042
2262
  className: v?.grid,
2043
2263
  style: {
2044
2264
  display: "grid",
2045
- width: "var(--pdp-calendar-pane-width, 276px)",
2046
- gridTemplateColumns: "repeat(7, var(--pdp-cell-size, 36px))",
2265
+ width: "100%",
2266
+ minWidth: 0,
2267
+ gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
2047
2268
  gap: "var(--pdp-cell-gap, 4px)",
2048
- ...x?.grid
2269
+ ...y?.grid
2049
2270
  },
2050
- children: n.map((e) => /* @__PURE__ */ l(ie, {
2271
+ children: n.map((e) => /* @__PURE__ */ l(ce, {
2051
2272
  cell: e,
2052
2273
  digitType: c,
2053
2274
  classNames: v,
2054
- styles: x,
2275
+ styles: y,
2055
2276
  tabIndex: 0,
2056
- onSelect: R,
2277
+ onSelect: ae,
2057
2278
  onHover: A
2058
2279
  }, `${e.jalali.year}-${e.jalali.month}-${e.jalali.day}`))
2059
2280
  })
@@ -2063,7 +2284,7 @@ var ge = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
2063
2284
  role: "region",
2064
2285
  "aria-label": "تقویم دوقلو شمسی",
2065
2286
  dir: h,
2066
- className: J(g, v?.calendar),
2287
+ className: W(g, v?.calendar),
2067
2288
  style: {
2068
2289
  "--pdp-cell-size": "36px",
2069
2290
  "--pdp-cell-gap": "4px",
@@ -2072,30 +2293,21 @@ var ge = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
2072
2293
  flexWrap: "wrap",
2073
2294
  gap: "24px",
2074
2295
  padding: "16px",
2075
- backgroundColor: C.colors.background,
2076
- color: C.colors.textPrimary,
2077
- borderRadius: C.radii.lg,
2078
- border: `1px solid ${C.colors.border}`,
2079
- boxShadow: C.shadows.lg,
2080
- width: "fit-content",
2296
+ boxSizing: "border-box",
2297
+ backgroundColor: w.colors.background,
2298
+ color: w.colors.textPrimary,
2299
+ borderRadius: w.radii.lg,
2300
+ border: `1px solid ${w.colors.border}`,
2301
+ boxShadow: w.shadows.lg,
2302
+ width: "calc(var(--pdp-calendar-pane-width, 276px) + var(--pdp-calendar-pane-width, 276px) + 56px)",
2303
+ maxWidth: "100%",
2081
2304
  ..._,
2082
- ...x?.calendar
2305
+ ...y?.calendar
2083
2306
  },
2084
- children: [
2085
- H(N.year, N.month, B, !0),
2086
- /* @__PURE__ */ l("div", {
2087
- className: v?.paneDivider,
2088
- style: {
2089
- width: "1px",
2090
- backgroundColor: C.colors.border,
2091
- ...x?.paneDivider
2092
- }
2093
- }),
2094
- H(F.year, F.month, V, !1)
2095
- ]
2307
+ children: [G(P.year, P.month, oe, !0), G(F.year, F.month, le, !1)]
2096
2308
  });
2097
2309
  };
2098
2310
  //#endregion
2099
- export { te as DatePickerThemeProvider, ie as DayCell, ge as DualMonthCalendar, ne as Header, f as JALALI_MONTH_NAMES_EN, he as JalaliDatePicker, de as MaskedDateInput, ae as MonthYearPicker, d as PERSIAN_MONTH_NAMES, m as PERSIAN_WEEK_DAYS_LONG, p as PERSIAN_WEEK_DAYS_SHORT, ue as TimePicker, re as Weekdays, E as addDaysToJalali, D as addJalaliDays, G as applyDateMask, N as calculateNextFocusedDate, se as clampTime, O as compareJalaliDates, V as darkTheme, z as formatJalaliDate, W as formatTimeSegment, ce as formatTimeString, S as generateJalaliCalendarGrid, P as getAriaDayLabel, oe as getCurrentTime, g as getDaysInJalaliMonth, fe as getEventsForDate, T as getJalaliDayOfWeek, j as getJalaliMonthRange, A as getJalaliWeekRange, me as getOfficialHoliday, y as getTodayJalali, _ as gregorianToJalali, k as isJalaliDateBetween, q as isJalaliFriday, h as isJalaliLeapYear, b as isSameJalaliDay, v as jalaliToGregorian, w as jalaliToJsDate, C as jsDateToJalali, B as lightTheme, K as parseAndValidateJalaliString, x as toJalaliDate, R as toLatinDigits, L as toPersianDigits, F as useCalendarKeyboard, M as useJalaliDatePicker, U as useTheme };
2311
+ export { U as DatePickerThemeProvider, ce as DayCell, xe as DualMonthCalendar, oe as Header, p as JALALI_MONTH_NAMES_EN, be as JalaliDatePicker, ge as MaskedDateInput, le as MonthYearPicker, f as PERSIAN_MONTH_NAMES, h as PERSIAN_WEEK_DAYS_LONG, m as PERSIAN_WEEK_DAYS_SHORT, pe as TimePicker, se as Weekdays, D as addDaysToJalali, O as addJalaliDays, me as applyDateMask, F as calculateNextFocusedDate, K as clampTime, k as compareJalaliDates, ie as darkTheme, B as formatJalaliDate, G as formatTimeSegment, de as formatTimeString, C as generateJalaliCalendarGrid, I as getAriaDayLabel, ue as getCurrentTime, _ as getDaysInJalaliMonth, _e as getEventsForDate, E as getJalaliDayOfWeek, j as getJalaliMonthRange, A as getJalaliWeekRange, ye as getOfficialHoliday, b as getTodayJalali, v as gregorianToJalali, ee as isJalaliDateBetween, M as isJalaliDateSelectable, q as isJalaliFriday, g as isJalaliLeapYear, N as isJalaliMonthSelectable, P as isJalaliYearSelectable, x as isSameJalaliDay, y as jalaliToGregorian, T as jalaliToJsDate, w as jsDateToJalali, V as lightTheme, he as parseAndValidateJalaliString, S as toJalaliDate, z as toLatinDigits, R as toPersianDigits, ne as useCalendarKeyboard, te as useJalaliDatePicker, H as useTheme };
2100
2312
 
2101
2313
  //# sourceMappingURL=index.mjs.map