@mngh/jalali-datepicker 1.1.8 → 1.2.0

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