@mngh/jalali-datepicker 1.1.0 → 1.1.2

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
@@ -426,7 +426,7 @@ var F = [
426
426
  "۷",
427
427
  "۸",
428
428
  "۹"
429
- ], ee = {
429
+ ], I = {
430
430
  "۰": "0",
431
431
  "۱": "1",
432
432
  "۲": "2",
@@ -448,22 +448,22 @@ var F = [
448
448
  "٨": "8",
449
449
  "٩": "9"
450
450
  };
451
- function I(e) {
451
+ function L(e) {
452
452
  return String(e).replace(/[0-9]/g, (e) => F[+e]);
453
453
  }
454
- function L(e) {
455
- return e.replace(/[۰-۹٠-٩]/g, (e) => ee[e] ?? e);
454
+ function R(e) {
455
+ return e.replace(/[۰-۹٠-٩]/g, (e) => I[e] ?? e);
456
456
  }
457
457
  //#endregion
458
458
  //#region src/formatters/jalali-formatter.ts
459
- function R(e, t = "YYYY/MM/DD", n = {}) {
459
+ function z(e, t = "YYYY/MM/DD", n = {}) {
460
460
  if (!e) return "";
461
461
  let { digitType: r = "persian" } = n, i = (_(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 = u[e.month], d = e.day < 10 ? `0${e.day}` : String(e.day), f = p[i], m = 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, d).replace(/\bD\b/g, String(e.day));
462
- return r === "persian" && (m = m.replace(/\d+/g, (e) => I(e))), m;
462
+ return r === "persian" && (m = m.replace(/\d+/g, (e) => L(e))), m;
463
463
  }
464
464
  //#endregion
465
465
  //#region src/theme/tokens.ts
466
- var z = {
466
+ var B = {
467
467
  mode: "light",
468
468
  colors: {
469
469
  primary: "#4f46e5",
@@ -492,7 +492,7 @@ var z = {
492
492
  md: "0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04)",
493
493
  lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05)"
494
494
  }
495
- }, te = {
495
+ }, V = {
496
496
  mode: "dark",
497
497
  colors: {
498
498
  primary: "#6366f1",
@@ -521,14 +521,14 @@ var z = {
521
521
  md: "0 4px 6px -1px rgba(0, 0, 0, 0.4)",
522
522
  lg: "0 10px 15px -3px rgba(0, 0, 0, 0.5)"
523
523
  }
524
- }, B = e({
525
- theme: z,
524
+ }, H = e({
525
+ theme: B,
526
526
  mode: "light"
527
- }), V = () => n(B) || {
528
- theme: z,
527
+ }), U = () => n(H) || {
528
+ theme: B,
529
529
  mode: "light"
530
- }, ne = ({ children: e, mode: t = "light", customTheme: n }) => {
531
- let r = t === "dark" ? te : z, a = i(() => n ? {
530
+ }, W = ({ children: e, mode: t = "light", customTheme: n }) => {
531
+ let r = t === "dark" ? V : B, a = i(() => n ? {
532
532
  mode: t,
533
533
  theme: {
534
534
  ...r,
@@ -555,12 +555,12 @@ var z = {
555
555
  n,
556
556
  t
557
557
  ]);
558
- return /* @__PURE__ */ c(B.Provider, {
558
+ return /* @__PURE__ */ c(H.Provider, {
559
559
  value: a,
560
560
  children: e
561
561
  });
562
- }, re = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick: i, isPickerOpen: a = !1, digitType: s = "persian", direction: u = "rtl", classNames: d, styles: f }) => {
563
- let { theme: p } = V(), [m, h] = o(null), g = s === "persian" ? I(e) : String(e), _ = (e) => ({
562
+ }, ee = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick: i, isPickerOpen: a = !1, digitType: s = "persian", direction: u = "rtl", classNames: d, styles: f }) => {
563
+ let { theme: p } = U(), [m, h] = o(null), g = s === "persian" ? L(e) : String(e), _ = (e) => ({
564
564
  width: "32px",
565
565
  height: "32px",
566
566
  padding: 0,
@@ -682,8 +682,8 @@ var z = {
682
682
  })
683
683
  ]
684
684
  });
685
- }, ie = ({ firstDayOfWeek: e = 0, direction: t = "rtl", classNames: n, styles: r }) => {
686
- let { theme: i } = V(), a = (Math.trunc(e) % 7 + 7) % 7, o = Array.from({ length: 7 }, (e, t) => {
685
+ }, te = ({ firstDayOfWeek: e = 0, direction: t = "rtl", classNames: n, styles: r }) => {
686
+ let { theme: i } = U(), a = (Math.trunc(e) % 7 + 7) % 7, o = Array.from({ length: 7 }, (e, t) => {
687
687
  let n = (a + t) % 7;
688
688
  return {
689
689
  dayIndex: n,
@@ -721,248 +721,323 @@ var z = {
721
721
  children: t
722
722
  }, e))
723
723
  });
724
- };
725
- //#endregion
726
- //#region src/theme/style-utils.ts
727
- function ae(...e) {
728
- return e.filter(Boolean).join(" ") || void 0;
729
- }
730
- //#endregion
731
- //#region src/components/DayCell.tsx
732
- var oe = (e) => {
733
- let { theme: t } = V(), [n, r] = o(!1), i = e.cell, a = i?.jalali ?? {
734
- year: 1403,
735
- month: 0,
736
- day: e.day ?? 1
737
- }, s = i?.isCurrentMonth ?? e.isCurrentMonth ?? !0, d = i?.isSelected ?? e.isSelected ?? !1, f = i?.isToday ?? e.isToday ?? !1, p = e.isHoliday ?? !1, m = i?.isInRange ?? e.isInRange ?? !1, h = i?.isRangeStart ?? e.isRangeStart ?? !1, g = i?.isRangeEnd ?? e.isRangeEnd ?? !1, _ = i?.isDisabled ?? e.disabled ?? !1, v = _ || !s, y = d || h || g, b = e.digitType === "latin" ? String(a.day) : I(a.day), x = e.digitType === "latin" ? String(a.year) : I(a.year), S = "transparent", C = s ? t.colors.textPrimary : t.colors.textDisabled;
738
- m && s && (S = t.colors.rangeBackground, C = t.colors.textPrimary), p && s && (C = t.colors.holiday), n && !y && !v && (S = p ? t.colors.holidayBackground : t.colors.backgroundHover), y && (S = t.colors.primary, C = t.colors.primaryText);
739
- let w = [
740
- `${b} ${u[a.month]} ${x}`,
741
- e.holidayTitle,
742
- ...e.events?.map((e) => e.title) ?? []
743
- ].filter(Boolean);
744
- return /* @__PURE__ */ l("button", {
745
- type: "button",
746
- role: "gridcell",
747
- "aria-label": w.join("، "),
748
- "aria-selected": y,
749
- tabIndex: e.tabIndex ?? 0,
750
- disabled: v,
751
- title: w.slice(1).join(" — ") || void 0,
752
- onClick: () => {
753
- v || (e.onClick?.(), e.onSelect?.(a));
754
- },
755
- onFocus: () => e.onFocus?.(a),
756
- className: ae(e.classNames?.dayCell, !s && e.classNames?.outsideMonthCell, f && e.classNames?.todayCell, d && e.classNames?.selectedCell, m && e.classNames?.rangeBetweenCell, h && e.classNames?.rangeStartCell, g && e.classNames?.rangeEndCell, _ && e.classNames?.disabledCell, p && e.classNames?.holidayCell),
724
+ }, ne = ({ cell: e, digitType: t = "persian", isHoliday: n = !1, holidayTitle: r, events: i = [], tabIndex: a = -1, classNames: s, styles: u, onSelect: d, onHover: f, onFocus: p }) => {
725
+ let [m, h] = o(!1), { jalali: g, dayNumber: _, isCurrentMonth: v, isToday: y, isSelected: b, isDisabled: x, isInRange: S, isRangeStart: C, isRangeEnd: w } = e, T = t === "persian" ? L(_) : R(_.toString()), E = (e) => {
726
+ e.stopPropagation(), !x && v && d(g);
727
+ }, D = () => {
728
+ h(!0), !x && v && f && f(g);
729
+ }, O = () => {
730
+ h(!1), f && f(null);
731
+ }, k = () => {
732
+ !x && v && p && p(g);
733
+ }, A = "transparent", j = v ? "var(--pdp-text-primary, #0f172a)" : "var(--pdp-text-disabled, #cbd5e1)";
734
+ return b || C || w ? (A = "var(--pdp-primary, #4f46e5)", j = "#ffffff") : S && (A = "var(--pdp-range-between-bg, rgba(79, 70, 229, 0.12))"), n && v && !b && !C && !w && (j = "var(--pdp-holiday-color, #e11d48)"), /* @__PURE__ */ l("div", {
757
735
  style: {
758
736
  position: "relative",
759
- width: "var(--pdp-cell-size, 36px)",
760
- height: "var(--pdp-cell-size, 36px)",
761
- padding: 0,
762
- border: f && !y ? `1.5px solid ${t.colors.todayBorder}` : "1px solid transparent",
763
- borderRadius: t.radii.md,
764
- backgroundColor: S,
765
- color: C,
766
- cursor: v ? "default" : "pointer",
767
- display: "inline-flex",
737
+ display: "flex",
768
738
  alignItems: "center",
769
739
  justifyContent: "center",
770
- fontSize: "0.85rem",
771
- fontWeight: y || f ? 700 : 500,
772
- lineHeight: 1,
773
- opacity: s ? _ ? .5 : 1 : .42,
774
- transform: n && !y && !v ? "scale(1.04)" : "scale(1)",
775
- transition: "background-color 0.15s ease, color 0.15s ease, transform 0.15s ease",
776
- ...e.styles?.dayCell,
777
- ...s ? void 0 : e.styles?.outsideMonthCell,
778
- ...f ? e.styles?.todayCell : void 0,
779
- ...m ? e.styles?.rangeBetweenCell : void 0,
780
- ...d ? e.styles?.selectedCell : void 0,
781
- ...h ? e.styles?.rangeStartCell : void 0,
782
- ...g ? e.styles?.rangeEndCell : void 0,
783
- ..._ ? e.styles?.disabledCell : void 0,
784
- ...p ? e.styles?.holidayCell : void 0
740
+ width: "var(--pdp-cell-size, 34px)",
741
+ height: "var(--pdp-cell-size, 34px)"
785
742
  },
786
- onMouseEnter: () => {
787
- r(!0), e.onHover?.(a);
788
- },
789
- onMouseLeave: () => {
790
- r(!1), e.onHover?.(null);
791
- },
792
- children: [/* @__PURE__ */ c("span", {
793
- "aria-hidden": "true",
794
- children: b
795
- }), !!e.events?.length && /* @__PURE__ */ c("span", {
796
- "aria-hidden": "true",
797
- className: e.classNames?.eventBadges,
743
+ onMouseEnter: D,
744
+ onMouseLeave: O,
745
+ children: [/* @__PURE__ */ l("button", {
746
+ type: "button",
747
+ role: "gridcell",
748
+ tabIndex: a,
749
+ disabled: x || !v,
750
+ "aria-selected": b,
751
+ "aria-label": `${g.year}/${g.month + 1}/${g.day}${r ? ` - ${r}` : ""}`,
752
+ onClick: E,
753
+ onFocus: k,
754
+ className: s?.dayCell,
798
755
  style: {
799
- position: "absolute",
800
- insetInline: "3px",
801
- bottom: "2px",
756
+ width: "100%",
757
+ height: "100%",
802
758
  display: "flex",
759
+ flexDirection: "column",
760
+ alignItems: "center",
803
761
  justifyContent: "center",
804
- gap: "2px",
805
- ...e.styles?.eventBadges
762
+ borderRadius: C ? "0 8px 8px 0" : w ? "8px 0 0 8px" : S ? "0" : "8px",
763
+ border: y && !b ? "1px solid var(--pdp-primary, #4f46e5)" : "none",
764
+ backgroundColor: A,
765
+ color: j,
766
+ cursor: x || !v ? "default" : "pointer",
767
+ fontSize: "13px",
768
+ fontWeight: b || y ? 700 : 500,
769
+ outline: "none",
770
+ transition: "all 0.12s ease",
771
+ position: "relative",
772
+ padding: 0,
773
+ ...u?.dayCell
806
774
  },
807
- children: e.events?.slice(0, 3).map((n) => /* @__PURE__ */ c("span", {
808
- className: e.classNames?.eventBadge,
775
+ children: [/* @__PURE__ */ c("span", { children: T }), i.length > 0 && /* @__PURE__ */ c("div", {
809
776
  style: {
810
- width: "4px",
811
- height: "4px",
777
+ position: "absolute",
778
+ bottom: "3px",
779
+ display: "flex",
780
+ gap: "2px",
781
+ alignItems: "center"
782
+ },
783
+ children: i.slice(0, 3).map((e) => /* @__PURE__ */ c("span", { style: {
784
+ width: "3.5px",
785
+ height: "3.5px",
812
786
  borderRadius: "50%",
813
- backgroundColor: n.color ?? t.colors.primary,
814
- ...e.styles?.eventBadge
815
- }
816
- }, n.id))
787
+ backgroundColor: b ? "#ffffff" : e.color || "var(--pdp-primary, #4f46e5)"
788
+ } }, e.id))
789
+ })]
790
+ }), m && v && (n || i.length > 0) && /* @__PURE__ */ l("div", {
791
+ role: "tooltip",
792
+ style: {
793
+ position: "absolute",
794
+ bottom: "calc(100% + 6px)",
795
+ left: "50%",
796
+ transform: "translateX(-50%)",
797
+ zIndex: 1050,
798
+ pointerEvents: "none",
799
+ whiteSpace: "nowrap",
800
+ backgroundColor: "var(--pdp-tooltip-bg, #0f172a)",
801
+ color: "var(--pdp-tooltip-text, #ffffff)",
802
+ padding: "5px 9px",
803
+ borderRadius: "6px",
804
+ fontSize: "11.5px",
805
+ fontWeight: 600,
806
+ lineHeight: 1.3,
807
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.25)",
808
+ display: "flex",
809
+ flexDirection: "column",
810
+ gap: "2px",
811
+ textAlign: "center"
812
+ },
813
+ children: [
814
+ n && r && /* @__PURE__ */ c("span", {
815
+ style: { color: "#fda4af" },
816
+ children: r
817
+ }),
818
+ i.map((e) => /* @__PURE__ */ l("span", {
819
+ style: { color: "#e2e8f0" },
820
+ children: ["• ", e.title]
821
+ }, e.id)),
822
+ /* @__PURE__ */ c("div", { style: {
823
+ position: "absolute",
824
+ top: "100%",
825
+ left: "50%",
826
+ transform: "translateX(-50%)",
827
+ borderWidth: "4px",
828
+ borderStyle: "solid",
829
+ borderColor: "var(--pdp-tooltip-bg, #0f172a) transparent transparent transparent"
830
+ } })
831
+ ]
817
832
  })]
818
833
  });
819
- }, se = ({ currentYear: e, currentMonth: t, yearRangeCount: n = 100, onSelectMonth: r, onSelectYear: i, classNames: a, styles: s }) => {
820
- let [d, f] = o("months"), [p, m] = o(() => Math.floor(e / 12) * 12), h = e - Math.floor(n / 2), g = e + Math.floor(n / 2), _ = (e) => {
821
- e.stopPropagation(), m((e) => Math.max(h, e - 12));
822
- }, v = (e) => {
823
- e.stopPropagation(), m((e) => Math.min(g - 12, e + 12));
824
- }, y = Array.from({ length: 12 }, (e, t) => p + t);
834
+ }, re = ({ currentYear: e, currentMonth: t, onSelectMonth: n, onSelectYear: r, classNames: i, styles: a }) => {
835
+ let [s, d] = o("months"), [f, p] = o(() => Math.floor(e / 10) * 10), [m, h] = o(e), g = Array.from({ length: 12 }, (e, t) => f - 1 + t), _ = () => {
836
+ if (s === "months") {
837
+ let e = m - 1;
838
+ h(e), r(e);
839
+ } else p((e) => e - 10);
840
+ }, v = () => {
841
+ if (s === "months") {
842
+ let e = m + 1;
843
+ h(e), r(e);
844
+ } else p((e) => e + 10);
845
+ }, y = {
846
+ background: "transparent",
847
+ border: "none",
848
+ cursor: "pointer",
849
+ padding: "6px",
850
+ borderRadius: "8px",
851
+ display: "flex",
852
+ alignItems: "center",
853
+ justifyContent: "center",
854
+ color: "var(--pdp-text-primary, #0f172a)",
855
+ transition: "all 0.15s ease"
856
+ }, b = {
857
+ height: "46px",
858
+ borderRadius: "10px",
859
+ border: "none",
860
+ cursor: "pointer",
861
+ fontSize: "13.5px",
862
+ fontWeight: 600,
863
+ display: "flex",
864
+ alignItems: "center",
865
+ justifyContent: "center",
866
+ transition: "all 0.15s ease",
867
+ background: "transparent",
868
+ color: "var(--pdp-text-primary, #0f172a)",
869
+ userSelect: "none"
870
+ };
825
871
  return /* @__PURE__ */ l("div", {
826
- className: a?.calendar,
872
+ className: i?.calendar,
827
873
  style: {
828
874
  display: "flex",
829
875
  flexDirection: "column",
830
- gap: "6px",
831
- padding: "8px",
876
+ gap: "10px",
832
877
  width: "100%",
833
- height: "245px",
878
+ minWidth: "260px",
879
+ height: "260px",
880
+ padding: "6px",
834
881
  boxSizing: "border-box",
835
882
  justifyContent: "space-between",
836
- ...s?.calendar
883
+ userSelect: "none",
884
+ ...a?.calendar
837
885
  },
838
886
  children: [/* @__PURE__ */ l("div", {
839
887
  style: {
840
888
  display: "flex",
841
889
  alignItems: "center",
842
890
  justifyContent: "space-between",
843
- padding: "2px 4px",
844
- borderBottom: "1px solid var(--pdp-surface-border, #e2e8f0)",
845
- minHeight: "32px"
891
+ padding: "0 4px",
892
+ height: "38px"
846
893
  },
847
894
  children: [
848
895
  /* @__PURE__ */ c("button", {
849
896
  type: "button",
850
897
  onClick: _,
851
- style: {
852
- background: "transparent",
853
- border: "none",
854
- cursor: "pointer",
855
- padding: "4px 8px",
856
- borderRadius: "6px",
857
- color: "var(--pdp-text-primary, #0f172a)",
858
- fontSize: "14px",
859
- fontWeight: 700
898
+ "aria-label": "Previous",
899
+ style: y,
900
+ onMouseEnter: (e) => {
901
+ e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)";
902
+ },
903
+ onMouseLeave: (e) => {
904
+ e.currentTarget.style.backgroundColor = "transparent";
860
905
  },
861
- "aria-label": "Previous Years",
862
- children: "❯"
906
+ children: /* @__PURE__ */ c("svg", {
907
+ width: "18",
908
+ height: "18",
909
+ viewBox: "0 0 24 24",
910
+ fill: "none",
911
+ stroke: "currentColor",
912
+ strokeWidth: "2.5",
913
+ strokeLinecap: "round",
914
+ strokeLinejoin: "round",
915
+ children: /* @__PURE__ */ c("polyline", { points: "9 18 15 12 9 6" })
916
+ })
863
917
  }),
864
918
  /* @__PURE__ */ l("button", {
865
919
  type: "button",
866
- onClick: () => f((e) => e === "months" ? "years" : "months"),
920
+ onClick: () => {
921
+ s === "months" && (p(Math.floor(m / 10) * 10), d("years"));
922
+ },
867
923
  style: {
868
- background: "var(--pdp-surface-subtle, #f1f5f9)",
869
- border: "1px solid var(--pdp-surface-border, #e2e8f0)",
870
- borderRadius: "6px",
871
- padding: "4px 10px",
872
- cursor: "pointer",
873
- fontSize: "0.8rem",
924
+ background: s === "months" ? "var(--pdp-surface-subtle, #f1f5f9)" : "transparent",
925
+ border: s === "months" ? "1px solid var(--pdp-surface-border, #e2e8f0)" : "none",
926
+ cursor: s === "months" ? "pointer" : "default",
927
+ fontSize: "13.5px",
874
928
  fontWeight: 700,
875
929
  color: "var(--pdp-text-primary, #0f172a)",
930
+ padding: "5px 12px",
931
+ borderRadius: "8px",
876
932
  display: "flex",
877
933
  alignItems: "center",
878
- gap: "4px"
934
+ gap: "6px",
935
+ transition: "all 0.15s ease"
879
936
  },
880
- children: [/* @__PURE__ */ c("span", { children: d === "months" ? I(e) : `${I(p)} - ${I(p + 12 - 1)}` }), /* @__PURE__ */ c("span", {
881
- style: {
882
- fontSize: "10px",
883
- opacity: .6
884
- },
885
- children: d === "months" ? "▼" : "▲"
937
+ onMouseEnter: (e) => {
938
+ s === "months" && (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #e2e8f0)", e.currentTarget.style.borderColor = "var(--pdp-primary, #4f46e5)");
939
+ },
940
+ onMouseLeave: (e) => {
941
+ s === "months" && (e.currentTarget.style.backgroundColor = "var(--pdp-surface-subtle, #f1f5f9)", e.currentTarget.style.borderColor = "var(--pdp-surface-border, #e2e8f0)");
942
+ },
943
+ children: [/* @__PURE__ */ c("span", { children: s === "months" ? L(m) : `${L(f)} - ${L(f + 9)}` }), s === "months" && /* @__PURE__ */ c("svg", {
944
+ width: "13",
945
+ height: "13",
946
+ viewBox: "0 0 24 24",
947
+ fill: "none",
948
+ stroke: "currentColor",
949
+ strokeWidth: "2.5",
950
+ strokeLinecap: "round",
951
+ strokeLinejoin: "round",
952
+ style: { opacity: .7 },
953
+ children: /* @__PURE__ */ c("polyline", { points: "6 9 12 15 18 9" })
886
954
  })]
887
955
  }),
888
956
  /* @__PURE__ */ c("button", {
889
957
  type: "button",
890
958
  onClick: v,
891
- style: {
892
- background: "transparent",
893
- border: "none",
894
- cursor: "pointer",
895
- padding: "4px 8px",
896
- borderRadius: "6px",
897
- color: "var(--pdp-text-primary, #0f172a)",
898
- fontSize: "14px",
899
- fontWeight: 700
959
+ "aria-label": "Next",
960
+ style: y,
961
+ onMouseEnter: (e) => {
962
+ e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)";
963
+ },
964
+ onMouseLeave: (e) => {
965
+ e.currentTarget.style.backgroundColor = "transparent";
900
966
  },
901
- "aria-label": "Next Years",
902
- children: "❮"
967
+ children: /* @__PURE__ */ c("svg", {
968
+ width: "18",
969
+ height: "18",
970
+ viewBox: "0 0 24 24",
971
+ fill: "none",
972
+ stroke: "currentColor",
973
+ strokeWidth: "2.5",
974
+ strokeLinecap: "round",
975
+ strokeLinejoin: "round",
976
+ children: /* @__PURE__ */ c("polyline", { points: "15 18 9 12 15 6" })
977
+ })
903
978
  })
904
979
  ]
905
980
  }), /* @__PURE__ */ c("div", {
906
981
  style: {
907
982
  display: "grid",
908
- gridTemplateColumns: "repeat(3, 1fr)",
909
- gridTemplateRows: "repeat(4, 1fr)",
910
- gap: "6px",
911
- flex: 1
983
+ gridTemplateColumns: "repeat(4, 1fr)",
984
+ gridTemplateRows: "repeat(3, 1fr)",
985
+ gap: "8px 6px",
986
+ flex: 1,
987
+ alignItems: "center"
912
988
  },
913
- children: d === "months" ? u.map((e, n) => {
914
- let i = n === t;
989
+ children: s === "months" ? u.map((r, i) => {
990
+ let a = i === t && m === e;
915
991
  return /* @__PURE__ */ c("button", {
916
992
  type: "button",
917
- onClick: () => r(n),
993
+ onClick: () => n(i),
918
994
  style: {
919
- borderRadius: "8px",
920
- border: "none",
921
- background: i ? "var(--pdp-primary, #4f46e5)" : "var(--pdp-surface-subtle, #f1f5f9)",
922
- color: i ? "#ffffff" : "var(--pdp-text-primary, #0f172a)",
923
- cursor: "pointer",
924
- fontWeight: i ? 700 : 500,
925
- fontSize: "12px",
926
- display: "flex",
927
- alignItems: "center",
928
- justifyContent: "center",
929
- transition: "all 0.15s ease"
995
+ ...b,
996
+ background: a ? "var(--pdp-primary, #4f46e5)" : "transparent",
997
+ color: a ? "#ffffff" : "var(--pdp-text-primary, #0f172a)",
998
+ fontWeight: a ? 700 : 500
930
999
  },
931
- children: e
932
- }, e);
933
- }) : y.map((t) => {
934
- let n = t === e;
1000
+ onMouseEnter: (e) => {
1001
+ a || (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)");
1002
+ },
1003
+ onMouseLeave: (e) => {
1004
+ a || (e.currentTarget.style.backgroundColor = "transparent");
1005
+ },
1006
+ children: r
1007
+ }, r);
1008
+ }) : g.map((e, t) => {
1009
+ let n = t === 0 || t === 11, i = e === m;
935
1010
  return /* @__PURE__ */ c("button", {
936
1011
  type: "button",
937
1012
  onClick: () => {
938
- i(t), f("months");
1013
+ h(e), r(e), d("months");
939
1014
  },
940
1015
  style: {
941
- borderRadius: "8px",
942
- border: "none",
943
- background: n ? "var(--pdp-primary, #4f46e5)" : "var(--pdp-surface-subtle, #f1f5f9)",
944
- color: n ? "#ffffff" : "var(--pdp-text-primary, #0f172a)",
945
- cursor: "pointer",
946
- fontWeight: n ? 700 : 500,
947
- fontSize: "12px",
948
- display: "flex",
949
- alignItems: "center",
950
- justifyContent: "center",
951
- transition: "all 0.15s ease"
1016
+ ...b,
1017
+ background: i ? "var(--pdp-primary, #4f46e5)" : "transparent",
1018
+ color: i ? "#ffffff" : n ? "var(--pdp-text-disabled, #94a3b8)" : "var(--pdp-text-primary, #0f172a)",
1019
+ fontWeight: i ? 700 : 500,
1020
+ opacity: n ? .4 : 1
952
1021
  },
953
- children: I(t)
954
- }, t);
1022
+ onMouseEnter: (e) => {
1023
+ i || (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)");
1024
+ },
1025
+ onMouseLeave: (e) => {
1026
+ i || (e.currentTarget.style.backgroundColor = "transparent");
1027
+ },
1028
+ children: L(e)
1029
+ }, e);
955
1030
  })
956
1031
  })]
957
1032
  });
958
1033
  };
959
1034
  //#endregion
960
1035
  //#region src/plugins/time-picker/time-utils.ts
961
- function H(e, t = "persian") {
1036
+ function G(e, t = "persian") {
962
1037
  let n = e < 10 ? `0${e}` : `${e}`;
963
- return t === "persian" ? I(n) : n;
1038
+ return t === "persian" ? L(n) : n;
964
1039
  }
965
- function ce() {
1040
+ function ie() {
966
1041
  let e = /* @__PURE__ */ new Date();
967
1042
  return {
968
1043
  hour: e.getHours(),
@@ -970,34 +1045,34 @@ function ce() {
970
1045
  second: e.getSeconds()
971
1046
  };
972
1047
  }
973
- function le(e) {
1048
+ function ae(e) {
974
1049
  return {
975
1050
  hour: Math.max(0, Math.min(23, e.hour)),
976
1051
  minute: Math.max(0, Math.min(59, e.minute)),
977
1052
  second: e.second === void 0 ? void 0 : Math.max(0, Math.min(59, e.second))
978
1053
  };
979
1054
  }
980
- function ue(e, t = !1, n = "persian") {
1055
+ function oe(e, t = !1, n = "persian") {
981
1056
  if (!e) return "";
982
- let r = H(e.hour, n), i = H(e.minute, n);
983
- return t && e.second !== void 0 ? `${r}:${i}:${H(e.second, n)}` : `${r}:${i}`;
1057
+ let r = G(e.hour, n), i = G(e.minute, n);
1058
+ return t && e.second !== void 0 ? `${r}:${i}:${G(e.second, n)}` : `${r}:${i}`;
984
1059
  }
985
1060
  //#endregion
986
1061
  //#region src/components/footer/CalendarFooter.tsx
987
- var de = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r, showSeconds: i = !1, mode: a = "single", digitType: o = "persian", showStatusText: s = !0, showActions: u = !0, onToday: d, onClear: f, onConfirm: p, direction: m = "rtl", classNames: h, styles: g }) => {
988
- let { theme: _ } = V(), v = (() => {
1062
+ var se = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r, showSeconds: i = !1, mode: a = "single", digitType: o = "persian", showStatusText: s = !0, showActions: u = !0, onToday: d, onClear: f, onConfirm: p, direction: m = "rtl", classNames: h, styles: g }) => {
1063
+ let { theme: _ } = U(), v = (() => {
989
1064
  if (a === "single") {
990
1065
  if (!e) return "تاریخی انتخاب نشده";
991
- let t = R(e, "YYYY/MM/DD", { digitType: o }), n = r ? ue(r, i, o) : "";
1066
+ let t = z(e, "YYYY/MM/DD", { digitType: o }), n = r ? oe(r, i, o) : "";
992
1067
  return n ? `${t}، ${n}` : t;
993
1068
  }
994
1069
  if (a === "range") {
995
1070
  let [e, n] = t ?? [null, null];
996
1071
  if (!e) return "بازه‌ای انتخاب نشده";
997
- let r = R(e, "YYYY/MM/DD", { digitType: o });
998
- return n ? `${r} تا ${R(n, "YYYY/MM/DD", { digitType: o })}` : `${r} تا …`;
1072
+ let r = z(e, "YYYY/MM/DD", { digitType: o });
1073
+ return n ? `${r} تا ${z(n, "YYYY/MM/DD", { digitType: o })}` : `${r} تا …`;
999
1074
  }
1000
- let s = n?.length ?? 0, c = o === "persian" ? I(s) : String(s);
1075
+ let s = n?.length ?? 0, c = o === "persian" ? L(s) : String(s);
1001
1076
  return s ? `${c} تاریخ انتخاب شده` : "تاریخی انتخاب نشده";
1002
1077
  })(), y = {
1003
1078
  minHeight: "34px",
@@ -1081,114 +1156,154 @@ var de = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
1081
1156
  ]
1082
1157
  })]
1083
1158
  });
1084
- }, fe = ({ value: e, hours: t, minutes: n, seconds: r, minuteStep: i = 1, hourStep: a = 1, showSeconds: o = !1, classNames: u, styles: d, onChange: f }) => {
1085
- let p = e?.hour ?? t ?? 0, m = e?.minute ?? n ?? 0, h = e?.second ?? r ?? 0, g = (e) => {
1086
- f({
1087
- hour: parseInt(e.target.value, 10),
1088
- minute: m,
1089
- second: h
1090
- });
1091
- }, _ = (e) => {
1092
- f({
1093
- hour: p,
1094
- minute: parseInt(e.target.value, 10),
1095
- second: h
1096
- });
1097
- }, v = (e) => {
1098
- f({
1099
- hour: p,
1100
- minute: m,
1101
- second: parseInt(e.target.value, 10)
1159
+ }, ce = ({ value: e, onChange: t, minuteStep: n = 1, hourStep: i = 1, showSeconds: u = !1, digitType: d = "persian", classNames: f, styles: p }) => {
1160
+ let [m, h] = o(null), g = a(null), _ = Array.from({ length: Math.ceil(24 / i) }, (e, t) => t * i), v = Array.from({ length: Math.ceil(60 / n) }, (e, t) => t * n), y = Array.from({ length: 60 }, (e, t) => t);
1161
+ r(() => {
1162
+ let e = (e) => {
1163
+ g.current && !g.current.contains(e.target) && h(null);
1164
+ };
1165
+ return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e), () => {
1166
+ document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
1167
+ };
1168
+ }, []);
1169
+ let b = (e) => {
1170
+ let t = String(e).padStart(2, "0");
1171
+ return d === "persian" ? L(t) : t;
1172
+ }, x = (e, t, n, r) => {
1173
+ let i = m === e;
1174
+ return /* @__PURE__ */ l("div", {
1175
+ style: { position: "relative" },
1176
+ children: [/* @__PURE__ */ c("button", {
1177
+ type: "button",
1178
+ onClick: () => h(i ? null : e),
1179
+ style: {
1180
+ minWidth: "40px",
1181
+ height: "30px",
1182
+ padding: "0 6px",
1183
+ display: "flex",
1184
+ alignItems: "center",
1185
+ justifyContent: "center",
1186
+ borderRadius: "6px",
1187
+ backgroundColor: i ? "var(--pdp-primary, #4f46e5)" : "var(--pdp-surface-bg, #ffffff)",
1188
+ color: i ? "#ffffff" : "var(--pdp-text-primary, #0f172a)",
1189
+ border: `1px solid ${i ? "var(--pdp-primary, #4f46e5)" : "var(--pdp-surface-border, #e2e8f0)"}`,
1190
+ fontSize: "13px",
1191
+ fontWeight: 700,
1192
+ cursor: "pointer",
1193
+ transition: "all 0.15s ease",
1194
+ boxShadow: i ? "0 0 0 2px rgba(79, 70, 229, 0.2)" : "none"
1195
+ },
1196
+ onMouseEnter: (e) => {
1197
+ i || (e.currentTarget.style.borderColor = "var(--pdp-primary, #4f46e5)", e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)");
1198
+ },
1199
+ onMouseLeave: (e) => {
1200
+ i || (e.currentTarget.style.borderColor = "var(--pdp-surface-border, #e2e8f0)", e.currentTarget.style.backgroundColor = "var(--pdp-surface-bg, #ffffff)");
1201
+ },
1202
+ children: b(t)
1203
+ }), i && /* @__PURE__ */ c("div", {
1204
+ style: {
1205
+ position: "absolute",
1206
+ bottom: "calc(100% + 4px)",
1207
+ left: "50%",
1208
+ transform: "translateX(-50%)",
1209
+ maxHeight: "140px",
1210
+ width: "52px",
1211
+ overflowY: "auto",
1212
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1213
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1214
+ borderRadius: "8px",
1215
+ boxShadow: "var(--pdp-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.15))",
1216
+ zIndex: 1050,
1217
+ padding: "4px 2px",
1218
+ display: "flex",
1219
+ flexDirection: "column",
1220
+ gap: "2px"
1221
+ },
1222
+ children: n.map((e) => {
1223
+ let n = e === t;
1224
+ return /* @__PURE__ */ c("button", {
1225
+ type: "button",
1226
+ onClick: () => {
1227
+ r(e), h(null);
1228
+ },
1229
+ style: {
1230
+ padding: "4px 0",
1231
+ border: "none",
1232
+ borderRadius: "4px",
1233
+ background: n ? "var(--pdp-primary, #4f46e5)" : "transparent",
1234
+ color: n ? "#ffffff" : "var(--pdp-text-primary, #0f172a)",
1235
+ fontSize: "12px",
1236
+ fontWeight: n ? 700 : 500,
1237
+ cursor: "pointer",
1238
+ transition: "background 0.12s ease"
1239
+ },
1240
+ onMouseEnter: (e) => {
1241
+ n || (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)");
1242
+ },
1243
+ onMouseLeave: (e) => {
1244
+ n || (e.currentTarget.style.backgroundColor = "transparent");
1245
+ },
1246
+ children: b(e)
1247
+ }, e);
1248
+ })
1249
+ })]
1102
1250
  });
1103
- }, y = {
1104
- background: "var(--pdp-surface-subtle, #f8fafc)",
1105
- color: "var(--pdp-text-primary, #0f172a)",
1106
- border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1107
- borderRadius: "6px",
1108
- padding: "4px 6px",
1109
- fontSize: "12px",
1110
- fontWeight: 600,
1111
- outline: "none",
1112
- cursor: "pointer",
1113
- direction: "ltr"
1114
1251
  };
1115
1252
  return /* @__PURE__ */ l("div", {
1116
- className: u?.timePicker,
1253
+ ref: g,
1254
+ className: f?.timePicker,
1117
1255
  style: {
1118
1256
  display: "flex",
1119
1257
  alignItems: "center",
1120
1258
  justifyContent: "center",
1121
1259
  gap: "6px",
1122
- padding: "8px 12px",
1260
+ padding: "6px 12px",
1123
1261
  borderTop: "1px solid var(--pdp-surface-border, #e2e8f0)",
1262
+ backgroundColor: "var(--pdp-surface-subtle, #f8fafc)",
1263
+ borderRadius: "0 0 var(--pdp-border-radius, 10px) var(--pdp-border-radius, 10px)",
1124
1264
  direction: "ltr",
1125
- color: "var(--pdp-text-primary, #0f172a)",
1126
- ...d?.timePicker
1265
+ userSelect: "none",
1266
+ ...p?.timePicker
1127
1267
  },
1128
1268
  children: [
1269
+ x("hour", e.hour, _, (n) => t({
1270
+ ...e,
1271
+ hour: n
1272
+ })),
1129
1273
  /* @__PURE__ */ c("span", {
1130
1274
  style: {
1131
- fontSize: "12px",
1132
- color: "var(--pdp-text-muted, #64748b)",
1133
- marginRight: "4px",
1134
- fontWeight: 500
1135
- },
1136
- children: "Time:"
1137
- }),
1138
- /* @__PURE__ */ c("select", {
1139
- value: p,
1140
- onChange: g,
1141
- style: y,
1142
- "aria-label": "Select Hour",
1143
- children: Array.from({ length: Math.ceil(24 / a) }, (e, t) => t * a).map((e) => /* @__PURE__ */ c("option", {
1144
- value: e,
1145
- children: String(e).padStart(2, "0")
1146
- }, e))
1147
- }),
1148
- /* @__PURE__ */ c("span", {
1149
- style: {
1150
- color: "var(--pdp-text-muted, #64748b)",
1151
- fontWeight: 700
1275
+ fontWeight: 800,
1276
+ color: "var(--pdp-text-muted, #94a3b8)",
1277
+ fontSize: "14px"
1152
1278
  },
1153
1279
  children: ":"
1154
1280
  }),
1155
- /* @__PURE__ */ c("select", {
1156
- value: m,
1157
- onChange: _,
1158
- style: y,
1159
- "aria-label": "Select Minute",
1160
- children: Array.from({ length: Math.ceil(60 / i) }, (e, t) => t * i).map((e) => /* @__PURE__ */ c("option", {
1161
- value: e,
1162
- children: String(e).padStart(2, "0")
1163
- }, e))
1164
- }),
1165
- o && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("span", {
1281
+ x("minute", e.minute, v, (n) => t({
1282
+ ...e,
1283
+ minute: n
1284
+ })),
1285
+ u && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("span", {
1166
1286
  style: {
1167
- color: "var(--pdp-text-muted, #64748b)",
1168
- fontWeight: 700
1287
+ fontWeight: 800,
1288
+ color: "var(--pdp-text-muted, #94a3b8)",
1289
+ fontSize: "14px"
1169
1290
  },
1170
1291
  children: ":"
1171
- }), /* @__PURE__ */ c("select", {
1172
- value: h,
1173
- onChange: v,
1174
- style: y,
1175
- "aria-label": "Select Second",
1176
- children: Array.from({ length: 60 }, (e, t) => /* @__PURE__ */ c("option", {
1177
- value: t,
1178
- children: String(t).padStart(2, "0")
1179
- }, t))
1180
- })] })
1292
+ }), x("second", e.second ?? 0, y, (n) => t({
1293
+ ...e,
1294
+ second: n
1295
+ }))] })
1181
1296
  ]
1182
1297
  });
1183
1298
  };
1184
1299
  //#endregion
1185
1300
  //#region src/components/masked-input/mask-utils.ts
1186
- function U(e, t = "persian") {
1187
- let n = L(e).replace(/\D/g, "").slice(0, 8), r = "";
1188
- 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" ? I(r) : r;
1301
+ function le(e, t = "persian") {
1302
+ let n = R(e).replace(/\D/g, "").slice(0, 8), r = "";
1303
+ 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;
1189
1304
  }
1190
- function W(e, t, n, r) {
1191
- let i = L(e).trim();
1305
+ function K(e, t, n, r) {
1306
+ let i = R(e).trim();
1192
1307
  if (!i) return {
1193
1308
  isValid: !0,
1194
1309
  date: null
@@ -1235,15 +1350,15 @@ function W(e, t, n, r) {
1235
1350
  }
1236
1351
  //#endregion
1237
1352
  //#region src/components/masked-input/MaskedDateInput.tsx
1238
- var pe = ({ value: e, defaultValue: n = null, onChange: i, onValidationError: s, digitType: u = "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 }) => {
1239
- let { theme: w } = V(), [T, E] = o(n), D = e === void 0 ? T : e, [O, k] = o(() => D ? R(D, "YYYY/MM/DD", { digitType: u }) : ""), [A, j] = o(!1), M = a(null);
1353
+ var ue = ({ value: e, defaultValue: n = null, onChange: i, onValidationError: s, digitType: u = "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 }) => {
1354
+ let { theme: w } = U(), [T, E] = o(n), D = e === void 0 ? T : e, [O, k] = o(() => D ? z(D, "YYYY/MM/DD", { digitType: u }) : ""), [A, j] = o(!1), M = a(null);
1240
1355
  r(() => {
1241
- e !== void 0 && (k(e ? R(e, "YYYY/MM/DD", { digitType: u }) : ""), j(!1));
1356
+ e !== void 0 && (k(e ? z(e, "YYYY/MM/DD", { digitType: u }) : ""), j(!1));
1242
1357
  }, [e, u]);
1243
1358
  let N = (t) => {
1244
- let n = t.target.value, r = U(n, u);
1359
+ let n = t.target.value, r = le(n, u);
1245
1360
  if (k(r), r.length === 10 || r.length === 0) {
1246
- let t = W(r, d, f, p);
1361
+ let t = K(r, d, f, p);
1247
1362
  t.isValid ? (j(!1), s?.(null), e === void 0 && E(t.date), i?.(t.date)) : (j(!0), s?.(t.error));
1248
1363
  } else j(!1), s?.(null);
1249
1364
  }, P = t(() => {
@@ -1313,12 +1428,12 @@ var pe = ({ value: e, defaultValue: n = null, onChange: i, onValidationError: s,
1313
1428
  };
1314
1429
  //#endregion
1315
1430
  //#region src/events/event-utils.ts
1316
- function me(e, t) {
1431
+ function de(e, t) {
1317
1432
  return !t || t.length === 0 ? [] : t.filter((t) => y(t.date, e));
1318
1433
  }
1319
1434
  //#endregion
1320
1435
  //#region src/holidays/iran-holidays.ts
1321
- var he = {
1436
+ var q = {
1322
1437
  "0-1": "جشن نوروز / سال نو",
1323
1438
  "0-2": "عید نوروز",
1324
1439
  "0-3": "عید نوروز",
@@ -1330,10 +1445,10 @@ var he = {
1330
1445
  "10-22": "پیروزی انقلاب اسلامی",
1331
1446
  "11-29": "روز ملی شدن صنعت نفت"
1332
1447
  };
1333
- function ge(e) {
1448
+ function fe(e) {
1334
1449
  return _(e.year, e.month, e.day).getDay() === 5;
1335
1450
  }
1336
- function _e(e, t) {
1451
+ function pe(e, t) {
1337
1452
  if (t && t.length > 0) {
1338
1453
  let n = t.find((t) => t.date.year === e.year && t.date.month === e.month && t.date.day === e.day);
1339
1454
  if (n) return {
@@ -1343,11 +1458,11 @@ function _e(e, t) {
1343
1458
  };
1344
1459
  }
1345
1460
  let n = `${e.month}-${e.day}`;
1346
- return he[n] ? {
1347
- title: he[n],
1461
+ return q[n] ? {
1462
+ title: q[n],
1348
1463
  type: "solar",
1349
1464
  isOff: !0
1350
- } : ge(e) ? {
1465
+ } : fe(e) ? {
1351
1466
  title: "جمعه (تعطیل پایان هفته)",
1352
1467
  type: "solar",
1353
1468
  isOff: !0
@@ -1355,27 +1470,30 @@ function _e(e, t) {
1355
1470
  }
1356
1471
  //#endregion
1357
1472
  //#region src/components/JalaliDatePicker.tsx
1358
- function ve(e) {
1359
- if (e instanceof Date && !Number.isNaN(e.getTime())) return e;
1360
- if (Array.isArray(e)) {
1361
- for (let t of e) if (t instanceof Date && !Number.isNaN(t.getTime())) return t;
1362
- }
1363
- }
1364
- function ye(e) {
1365
- if (!(!e || Number.isNaN(e.getTime()))) return {
1366
- hour: e.getHours(),
1367
- minute: e.getMinutes(),
1368
- second: e.getSeconds()
1369
- };
1370
- }
1371
- function be({ mode: e = "single", value: n, defaultValue: d, onChange: f, minDate: p, maxDate: m, isDateDisabled: h, firstDayOfWeek: g = 0, initialViewDate: _, direction: v = "rtl", variant: b = "inline", placeholder: w = "انتخاب تاریخ...", digitType: T = "persian", className: E, style: D, classNames: k, styles: A, showFooter: M = !1, showStatusText: N = !0, showActions: F = !0, onConfirm: ee, enableTime: L = !1, timeValue: z, defaultTimeValue: te, onTimeChange: B, minuteStep: ne = 1, hourStep: H = 1, secondStep: le = 1, showSeconds: U = !1, numberOfMonths: W = 1, useMaskedInput: he = !1, events: ge, showHolidays: be = !1, customHolidays: xe, closeOnOutsideClick: Se = !0, closeOnEscape: Ce = !0, onOpenChange: we }) {
1372
- let { theme: G } = V(), [K, Te] = o(b === "inline"), Ee = a(b === "inline"), [De, Oe] = o(!1), ke = a(null), Ae = a(we), q = b === "modal";
1473
+ function me({ mode: e = "single", value: n, defaultValue: d, onChange: f, minDate: p, maxDate: m, isDateDisabled: h, firstDayOfWeek: g = 0, variant: _ = "popover", placeholder: v = "YYYY/MM/DD", digitType: b = "persian", className: w, style: T, classNames: E, styles: D, showFooter: k = !0, showStatusText: A = !0, allowClear: M = !0, enableTime: N = !1, timeValue: F, defaultTimeValue: I, onTimeChange: R, minuteStep: B = 1, hourStep: V = 1, showSeconds: H = !1, numberOfMonths: U = 1, useMaskedInput: W = !1, events: G, showHolidays: ae = !1, customHolidays: le }) {
1474
+ let [K, q] = o(_ === "inline"), [fe, me] = o(!1), he = a(null), J = _ === "modal", ge = i(() => I || (n instanceof Date ? {
1475
+ hour: n.getHours(),
1476
+ minute: n.getMinutes(),
1477
+ second: n.getSeconds()
1478
+ } : d instanceof Date ? {
1479
+ hour: d.getHours(),
1480
+ minute: d.getMinutes(),
1481
+ second: d.getSeconds()
1482
+ } : ie()), [
1483
+ I,
1484
+ n,
1485
+ d
1486
+ ]), [_e, ve] = o(ge), Y = F === void 0 ? _e : F ?? ie();
1373
1487
  r(() => {
1374
- Ae.current = we;
1375
- }, [we]);
1376
- let J = t((e) => {
1377
- Ee.current !== e && (Ee.current = e, Te(e), Ae.current?.(e));
1378
- }, []), je = i(() => {
1488
+ if (_ === "inline" || !K) return;
1489
+ let e = (e) => {
1490
+ he.current && !he.current.contains(e.target) && (q(!1), me(!1));
1491
+ };
1492
+ return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e), () => {
1493
+ document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
1494
+ };
1495
+ }, [_, K]);
1496
+ let ye = i(() => {
1379
1497
  if (n !== void 0) {
1380
1498
  if (!n) return null;
1381
1499
  if (n instanceof Date) return S(n);
@@ -1388,7 +1506,7 @@ function be({ mode: e = "single", value: n, defaultValue: d, onChange: f, minDat
1388
1506
  }
1389
1507
  return null;
1390
1508
  }
1391
- }, [n, e]), Me = i(() => {
1509
+ }, [n, e]), be = i(() => {
1392
1510
  if (d !== void 0) {
1393
1511
  if (!d) return null;
1394
1512
  if (d instanceof Date) return S(d);
@@ -1401,108 +1519,79 @@ function be({ mode: e = "single", value: n, defaultValue: d, onChange: f, minDat
1401
1519
  }
1402
1520
  return null;
1403
1521
  }
1404
- }, [d, e]), Ne = i(() => p ? S(p) : void 0, [p]), Pe = i(() => m ? S(m) : void 0, [m]), Fe = i(() => {
1405
- if (_) return _ instanceof Date ? S(_) : _;
1406
- let e = ve(n) ?? ve(d);
1407
- return e ? S(e) : void 0;
1408
- }, [
1409
- d,
1410
- _,
1411
- n
1412
- ]), Ie = i(() => ye(ve(n)), [n]), [Le, Re] = o(() => te ?? ye(ve(d)) ?? ce()), Y = z === null ? {
1413
- hour: 0,
1414
- minute: 0,
1415
- second: 0
1416
- } : z ?? Ie ?? Le, ze = t((e) => h ? h(C(e)) : !1, [h]), Be = t((t, n = Y) => {
1522
+ }, [d, e]), xe = i(() => p ? S(p) : void 0, [p]), Se = i(() => m ? S(m) : void 0, [m]), Ce = t((t, n) => {
1417
1523
  if (!t) return null;
1418
- let r = L ? n.hour : 0, i = L ? n.minute : 0, a = L && U ? n.second ?? 0 : 0;
1419
- if (e === "single" && !Array.isArray(t)) return C(t, r, i, a);
1524
+ let r = n ?? Y, i = N ? r.hour : 0, a = N ? r.minute : 0, o = N && H ? r.second ?? 0 : 0;
1525
+ if (e === "single" && !Array.isArray(t)) return C(t, i, a, o);
1420
1526
  if (e === "range" && Array.isArray(t)) {
1421
1527
  let [e, n] = t;
1422
- return [e ? C(e, r, i, a) : null, n ? C(n, L ? r : 23, L ? i : 59, L ? a : 59) : null];
1528
+ return [e ? C(e, 0, 0, 0) : null, n ? C(n, 23, 59, 59) : null];
1423
1529
  }
1424
- return e === "multiple" && Array.isArray(t) ? t.map((e) => C(e, r, i, a)) : null;
1530
+ return e === "multiple" && Array.isArray(t) ? t.map((e) => C(e, i, a, o)) : null;
1425
1531
  }, [
1426
1532
  e,
1427
- L,
1533
+ N,
1428
1534
  Y,
1429
- U
1430
- ]), { selected: X, viewYear: Z, viewMonth: Q, grid: Ve, goToPrevMonth: He, goToNextMonth: Ue, setView: We, goToToday: Ge, selectDate: Ke, setHoverDate: qe, hoverDate: Je, clear: Ye } = j({
1535
+ H
1536
+ ]), { selected: X, viewYear: Z, viewMonth: Q, grid: we, goToPrevMonth: Te, goToNextMonth: Ee, setView: De, goToToday: Oe, selectDate: ke, setHoverDate: Ae, hoverDate: je, clear: Me } = j({
1431
1537
  mode: e,
1432
- value: je,
1433
- defaultValue: Me,
1434
- initialViewDate: Fe,
1435
- minDate: Ne,
1436
- maxDate: Pe,
1538
+ value: ye,
1539
+ defaultValue: be,
1540
+ minDate: xe,
1541
+ maxDate: Se,
1437
1542
  firstDayOfWeek: g,
1438
- isDateDisabled: h ? ze : void 0,
1543
+ isDateDisabled: h ? (e) => h(C(e)) : void 0,
1439
1544
  onChange: (e) => {
1440
- f?.(Be(e));
1545
+ f?.(Ce(e));
1441
1546
  }
1442
- }), Xe = t((e) => {
1443
- z === void 0 && Re(e), B?.(e), (Array.isArray(X) ? X.some(Boolean) : X) && f?.(Be(X, e));
1547
+ }), Ne = t((e) => {
1548
+ F === void 0 && ve(e), R?.(e), X && f && f(Ce(X, e));
1444
1549
  }, [
1445
- z,
1446
- B,
1550
+ F,
1551
+ R,
1447
1552
  X,
1448
1553
  f,
1449
- Be
1450
- ]), Ze = e === "single" ? X : null, Qe = (t) => {
1451
- Ke(t), b === "popover" && e === "single" && !L && J(!1);
1452
- }, { handleKeyDown: $e, getCellTabIndex: et, setFocusedDate: tt } = P({
1554
+ Ce
1555
+ ]), Pe = e === "single" ? X : null, Fe = (t) => {
1556
+ ke(t), _ === "popover" && e === "single" && !N && q(!1);
1557
+ }, Ie = (e) => {
1558
+ e.stopPropagation(), Me();
1559
+ }, { handleKeyDown: Le, getCellTabIndex: Re, setFocusedDate: ze } = P({
1453
1560
  viewYear: Z,
1454
1561
  viewMonth: Q,
1455
- selectedDate: Ze,
1456
- onSelectDate: Qe,
1457
- onViewChange: We,
1458
- isRtl: v === "rtl"
1562
+ selectedDate: Pe,
1563
+ onSelectDate: Fe,
1564
+ onViewChange: De,
1565
+ isRtl: !0
1459
1566
  });
1460
1567
  r(() => {
1461
- J(b === "inline");
1462
- }, [b, J]), r(() => {
1463
- if (!K || b === "inline") return;
1464
- let e = (e) => {
1465
- if (!Se || q) return;
1466
- let t = e.target;
1467
- t instanceof Node && !ke.current?.contains(t) && J(!1);
1468
- }, t = (e) => {
1469
- !Ce || e.key !== "Escape" || (J(!1), ke.current?.querySelector("input")?.focus());
1470
- };
1471
- return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
1472
- document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
1473
- };
1474
- }, [
1475
- Ce,
1476
- Se,
1477
- q,
1478
- K,
1479
- J,
1480
- b
1481
- ]), r(() => {
1482
- if (!q || !K) return;
1568
+ if (!J || !K) return;
1483
1569
  let e = document.body.style.overflow;
1484
- return document.body.style.overflow = "hidden", () => {
1485
- document.body.style.overflow = e;
1570
+ document.body.style.overflow = "hidden";
1571
+ let t = (e) => {
1572
+ e.key === "Escape" && q(!1);
1573
+ };
1574
+ return window.addEventListener("keydown", t), () => {
1575
+ document.body.style.overflow = e, window.removeEventListener("keydown", t);
1486
1576
  };
1487
- }, [q, K]);
1577
+ }, [J, K]);
1488
1578
  let $ = i(() => Q === 11 ? {
1489
1579
  year: Z + 1,
1490
1580
  month: 0
1491
1581
  } : {
1492
1582
  year: Z,
1493
1583
  month: Q + 1
1494
- }, [Z, Q]), nt = i(() => {
1495
- if (W !== 2) return [];
1584
+ }, [Z, Q]), Be = i(() => {
1585
+ if (U !== 2) return [];
1496
1586
  let t = x({
1497
1587
  year: $.year,
1498
1588
  month: $.month,
1499
1589
  firstDayOfWeek: g,
1500
- minDate: Ne,
1501
- maxDate: Pe,
1502
- isDateDisabled: h ? ze : void 0
1590
+ minDate: xe,
1591
+ maxDate: Se
1503
1592
  });
1504
1593
  if (e !== "range") return t;
1505
- let [n, r] = X || [null, null], i = r ?? (n && Je ? Je : null);
1594
+ let [n, r] = X || [null, null], i = r ?? (n && je ? je : null);
1506
1595
  return t.map((e) => {
1507
1596
  let t = n ? y(e.jalali, n) : !1, r = i ? y(e.jalali, i) : !1, a = !1;
1508
1597
  return n && i && (a = O(e.jalali, n, i)), {
@@ -1514,308 +1603,272 @@ function be({ mode: e = "single", value: n, defaultValue: d, onChange: f, minDat
1514
1603
  };
1515
1604
  });
1516
1605
  }, [
1517
- W,
1606
+ U,
1518
1607
  $,
1519
1608
  g,
1520
- Ne,
1521
- Pe,
1522
- ze,
1523
- h,
1609
+ xe,
1610
+ Se,
1524
1611
  e,
1525
1612
  X,
1526
- Je
1527
- ]), rt = i(() => {
1613
+ je
1614
+ ]), Ve = i(() => {
1528
1615
  if (!X) return "";
1529
1616
  if (e === "single") {
1530
- let e = R(X, "YYYY/MM/DD", { digitType: T });
1531
- return L && Y ? `${e} ${ue(Y, U, T)}` : e;
1617
+ let e = z(X, "YYYY/MM/DD", { digitType: b });
1618
+ return N && Y ? `${e} ${oe(Y, H, b)}` : e;
1532
1619
  }
1533
1620
  if (e === "range") {
1534
- let [e, t] = X || [null, null], n = L ? ` ${ue(Y, U, T)}` : "";
1535
- if (e && t) return `${R(e, "YYYY/MM/DD", { digitType: T })}${n} - ${R(t, "YYYY/MM/DD", { digitType: T })}${n}`;
1536
- if (e) return `${R(e, "YYYY/MM/DD", { digitType: T })}${n}`;
1537
- }
1538
- if (e === "multiple") {
1539
- let e = X.length;
1540
- if (e > 0) return `${T === "persian" ? I(e) : String(e)} تاریخ انتخاب شده`;
1621
+ let [e, t] = X || [null, null];
1622
+ if (e && t) return `${z(e, "YYYY/MM/DD", { digitType: b })} - ${z(t, "YYYY/MM/DD", { digitType: b })}`;
1623
+ if (e) return `${z(e, "YYYY/MM/DD", { digitType: b })} - ...`;
1541
1624
  }
1542
- return "";
1625
+ return e === "multiple" && Array.isArray(X) ? `${L(X.length)} تاریخ انتخاب شده` : "";
1543
1626
  }, [
1544
1627
  X,
1545
1628
  e,
1546
- T,
1547
- L,
1629
+ b,
1630
+ N,
1548
1631
  Y,
1549
- U
1550
- ]), it = (e, t, n, r = !0, i = !0) => /* @__PURE__ */ l("div", {
1551
- dir: v,
1552
- className: k?.calendarPane,
1632
+ H
1633
+ ]), He = !!(e === "single" ? X : e === "range" ? X?.[0] : X?.length), Ue = (e, t, n, r = !0, i = !0) => /* @__PURE__ */ l("div", {
1553
1634
  style: {
1554
- width: "var(--pdp-calendar-pane-width, 276px)",
1555
- minWidth: "var(--pdp-calendar-pane-width, 276px)",
1556
- ...A?.calendarPane
1635
+ width: "260px",
1636
+ flexShrink: 0
1557
1637
  },
1558
1638
  children: [
1559
- /* @__PURE__ */ c(re, {
1639
+ /* @__PURE__ */ c(ee, {
1560
1640
  year: e,
1561
1641
  monthName: u[t],
1562
- onPrevMonth: r ? He : () => {},
1563
- onNextMonth: i ? Ue : () => {},
1564
- onTitleClick: () => Oe((e) => !e),
1565
- isPickerOpen: De,
1566
- digitType: T,
1567
- direction: v,
1568
- classNames: k,
1569
- styles: A
1642
+ onPrevMonth: r ? Te : () => {},
1643
+ onNextMonth: i ? Ee : () => {},
1644
+ onTitleClick: () => me((e) => !e),
1645
+ isPickerOpen: fe,
1646
+ classNames: E,
1647
+ styles: D
1570
1648
  }),
1571
- /* @__PURE__ */ c(ie, {
1649
+ /* @__PURE__ */ c(te, {
1572
1650
  firstDayOfWeek: g,
1573
- direction: v,
1574
- classNames: k,
1575
- styles: A
1651
+ classNames: E,
1652
+ styles: D
1576
1653
  }),
1577
1654
  /* @__PURE__ */ c("div", {
1578
1655
  role: "grid",
1579
- "aria-label": `${u[t]} ${T === "persian" ? I(e) : e}`,
1580
- dir: v,
1581
- className: k?.grid,
1656
+ "aria-label": `${u[t]} ${L(e)}`,
1657
+ className: E?.grid,
1582
1658
  style: {
1583
1659
  display: "grid",
1584
- width: "var(--pdp-calendar-pane-width, 276px)",
1585
- gridTemplateColumns: "repeat(7, var(--pdp-cell-size, 36px))",
1586
- gap: "var(--pdp-cell-gap, 4px)",
1587
- ...A?.grid
1660
+ gridTemplateColumns: "repeat(7, var(--pdp-cell-size, 34px))",
1661
+ gap: "4px",
1662
+ justifyContent: "center",
1663
+ alignItems: "center",
1664
+ ...D?.grid
1588
1665
  },
1589
- children: n.map((e) => {
1590
- let t = be ? _e(e.jalali, xe) : null, n = me(e.jalali, ge);
1591
- return /* @__PURE__ */ c(oe, {
1666
+ children: n.map((e, t) => {
1667
+ let n = ae ? pe(e.jalali, le) : null, r = de(e.jalali, G);
1668
+ return /* @__PURE__ */ c(ne, {
1592
1669
  cell: e,
1593
- digitType: T,
1594
- isHoliday: !!t,
1595
- holidayTitle: t?.title,
1596
- events: n,
1597
- classNames: k,
1598
- styles: A,
1599
- tabIndex: et(e.jalali),
1600
- onSelect: Qe,
1601
- onHover: qe,
1602
- onFocus: tt
1603
- }, `${e.jalali.year}-${e.jalali.month}-${e.jalali.day}`);
1670
+ digitType: b,
1671
+ isHoliday: !!n,
1672
+ holidayTitle: n?.title,
1673
+ events: r,
1674
+ classNames: E,
1675
+ styles: D,
1676
+ tabIndex: Re(e.jalali),
1677
+ onSelect: Fe,
1678
+ onHover: Ae,
1679
+ onFocus: ze
1680
+ }, t);
1604
1681
  })
1605
1682
  })
1606
1683
  ]
1607
- }), at = /* @__PURE__ */ l("div", {
1608
- role: b === "inline" ? "region" : "dialog",
1609
- "aria-modal": q ? !0 : void 0,
1684
+ }), We = /* @__PURE__ */ c("div", {
1685
+ role: J ? "dialog" : "region",
1686
+ "aria-modal": J ? !0 : void 0,
1610
1687
  "aria-label": "تقویم شمسی",
1611
- dir: v,
1612
- onKeyDown: $e,
1613
- onClick: (e) => q && e.stopPropagation(),
1614
- className: k?.calendar,
1688
+ onKeyDown: Le,
1689
+ onClick: (e) => J && e.stopPropagation(),
1690
+ className: E?.calendar,
1615
1691
  style: {
1616
- position: b === "popover" ? "absolute" : q ? "relative" : "static",
1617
- top: b === "popover" ? "calc(100% + 4px)" : void 0,
1618
- right: b === "popover" && v === "rtl" ? 0 : void 0,
1619
- left: b === "popover" && v === "ltr" ? 0 : void 0,
1620
- zIndex: q ? 1001 : 50,
1621
- padding: "16px",
1622
- backgroundColor: G.colors.background,
1623
- color: G.colors.textPrimary,
1624
- borderRadius: G.radii.lg,
1625
- border: `1px solid ${G.colors.border}`,
1626
- boxShadow: q ? "0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3)" : G.shadows.lg,
1627
- width: "fit-content",
1628
- maxWidth: "calc(100vw - 16px)",
1629
- boxSizing: "border-box",
1630
- overflowX: "auto",
1692
+ position: _ === "popover" ? "absolute" : J ? "relative" : "static",
1693
+ top: _ === "popover" ? "calc(100% + 4px)" : void 0,
1694
+ left: _ === "popover" ? 0 : void 0,
1695
+ zIndex: J ? 1001 : 1e3,
1696
+ padding: "12px",
1697
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1698
+ borderRadius: "var(--pdp-border-radius, 12px)",
1699
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1700
+ 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))",
1701
+ width: U === 2 ? "fit-content" : "auto",
1702
+ minWidth: U === 2 ? "560px" : "284px",
1703
+ maxWidth: "95vw",
1631
1704
  userSelect: "none",
1632
1705
  display: "flex",
1633
1706
  flexDirection: "column",
1634
- gap: "12px",
1635
- ...A?.calendar
1707
+ gap: "8px",
1708
+ direction: "rtl",
1709
+ boxSizing: "border-box",
1710
+ ...D?.calendar
1636
1711
  },
1637
- children: [q && /* @__PURE__ */ c("button", {
1638
- type: "button",
1639
- "aria-label": "بستن",
1640
- onClick: () => J(!1),
1641
- className: k?.closeButton,
1642
- style: {
1643
- position: "absolute",
1644
- top: "10px",
1645
- insetInlineEnd: "10px",
1646
- background: "none",
1647
- border: "none",
1648
- cursor: "pointer",
1649
- fontSize: "16px",
1650
- color: G.colors.textSecondary,
1651
- lineHeight: 1,
1652
- zIndex: 10,
1653
- ...A?.closeButton
1712
+ children: fe ? /* @__PURE__ */ c(re, {
1713
+ currentYear: Z,
1714
+ currentMonth: Q,
1715
+ onSelectMonth: (e) => {
1716
+ De(Z, e), me(!1);
1654
1717
  },
1655
- children: "✕"
1656
- }), /* @__PURE__ */ c("div", {
1657
- className: k?.calendarBody,
1658
- style: {
1659
- display: "flex",
1660
- flexDirection: "column",
1661
- gap: "10px",
1662
- ...A?.calendarBody
1663
- },
1664
- children: De ? /* @__PURE__ */ c(se, {
1665
- currentYear: Z,
1666
- currentMonth: Q,
1667
- onSelectMonth: (e) => {
1668
- We(Z, e), Oe(!1);
1718
+ onSelectYear: (e) => De(e, Q),
1719
+ classNames: E,
1720
+ styles: D
1721
+ }) : /* @__PURE__ */ l(s, { children: [
1722
+ /* @__PURE__ */ l("div", {
1723
+ style: {
1724
+ display: "flex",
1725
+ flexWrap: "wrap",
1726
+ gap: "16px",
1727
+ alignItems: "flex-start",
1728
+ justifyContent: "center"
1669
1729
  },
1670
- onSelectYear: (e) => We(e, Q),
1671
- digitType: T,
1672
- direction: v,
1673
- classNames: k,
1674
- styles: A
1675
- }) : /* @__PURE__ */ l(s, { children: [
1676
- /* @__PURE__ */ l("div", {
1677
- dir: v,
1678
- className: k?.calendarPanes,
1679
- style: {
1680
- display: "flex",
1681
- gap: "16px",
1682
- alignItems: "flex-start",
1683
- flexWrap: "wrap",
1684
- ...A?.calendarPanes
1685
- },
1686
- children: [it(Z, Q, Ve, !0, W === 1), W === 2 && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
1687
- className: k?.paneDivider,
1688
- style: {
1689
- width: "1px",
1690
- backgroundColor: G.colors.border,
1691
- alignSelf: "stretch",
1692
- ...A?.paneDivider
1693
- }
1694
- }), it($.year, $.month, nt, !1, !0)] })]
1695
- }),
1696
- L && /* @__PURE__ */ c(fe, {
1697
- value: Y,
1698
- onChange: Xe,
1699
- minuteStep: ne,
1700
- hourStep: H,
1701
- secondStep: le,
1702
- showSeconds: U,
1703
- digitType: T,
1704
- direction: v,
1705
- classNames: k,
1706
- styles: A
1707
- }),
1708
- M && /* @__PURE__ */ c(de, {
1709
- mode: e,
1710
- digitType: T,
1711
- showStatusText: N,
1712
- showActions: F,
1713
- selectedDate: e === "single" ? X : null,
1714
- selectedRange: e === "range" ? X : void 0,
1715
- selectedDates: e === "multiple" ? X : void 0,
1716
- selectedTime: L ? Y : void 0,
1717
- showSeconds: U,
1718
- onToday: Ge,
1719
- onClear: Ye,
1720
- onConfirm: () => {
1721
- b !== "inline" && J(!1), ee?.(Be(X));
1722
- },
1723
- direction: v,
1724
- classNames: k,
1725
- styles: A
1726
- })
1727
- ] })
1728
- })]
1730
+ children: [Ue(Z, Q, we, !0, U === 1), U === 2 && /* @__PURE__ */ c(s, { children: Ue($.year, $.month, Be, !1, !0) })]
1731
+ }),
1732
+ N && /* @__PURE__ */ c(ce, {
1733
+ value: Y,
1734
+ onChange: Ne,
1735
+ minuteStep: B,
1736
+ hourStep: V,
1737
+ showSeconds: H,
1738
+ digitType: b,
1739
+ classNames: E,
1740
+ styles: D
1741
+ }),
1742
+ k && /* @__PURE__ */ c(se, {
1743
+ mode: e,
1744
+ digitType: b,
1745
+ showStatusText: A,
1746
+ selectedDate: e === "single" ? X : null,
1747
+ selectedRange: e === "range" ? X : void 0,
1748
+ selectedDates: e === "multiple" ? X : void 0,
1749
+ selectedTime: N ? Y : void 0,
1750
+ onToday: Oe,
1751
+ classNames: E,
1752
+ styles: D
1753
+ })
1754
+ ] })
1729
1755
  });
1730
1756
  return /* @__PURE__ */ l("div", {
1731
- ref: ke,
1732
- dir: v,
1733
- className: ae(E, k?.root),
1757
+ ref: he,
1758
+ className: w ?? E?.root,
1734
1759
  style: {
1735
- "--pdp-cell-size": "36px",
1736
- "--pdp-cell-gap": "4px",
1737
- "--pdp-calendar-pane-width": "276px",
1738
1760
  position: "relative",
1739
1761
  display: "inline-block",
1740
- color: G.colors.textPrimary,
1741
- fontFamily: "inherit",
1742
- ...D,
1743
- ...A?.root
1762
+ ...T,
1763
+ ...D?.root
1744
1764
  },
1745
- children: [b !== "inline" && (he && e === "single" && b === "popover" ? /* @__PURE__ */ c(pe, {
1746
- value: Ze,
1747
- digitType: T,
1748
- placeholder: w,
1765
+ children: [_ !== "inline" && (W && e === "single" && _ === "popover" ? /* @__PURE__ */ c(ue, {
1766
+ value: Pe,
1767
+ digitType: b,
1768
+ placeholder: v,
1749
1769
  onChange: (e) => {
1750
- e ? (Ke(e), We(e.year, e.month)) : Ye();
1770
+ e ? (ke(e), De(e.year, e.month)) : Me();
1751
1771
  },
1752
- onClick: () => J(!0),
1753
- direction: v,
1754
- minDate: Ne,
1755
- maxDate: Pe,
1756
- isDateDisabled: h ? ze : void 0,
1757
- wrapperClassName: k?.inputWrapper,
1758
- wrapperStyle: A?.inputWrapper,
1759
- clearButtonClassName: k?.inputClearButton,
1760
- clearButtonStyle: A?.inputClearButton,
1761
- className: k?.input,
1762
- style: A?.input
1763
- }) : /* @__PURE__ */ c("input", {
1764
- type: "text",
1765
- readOnly: !0,
1766
- "aria-haspopup": "dialog",
1767
- "aria-expanded": K,
1768
- placeholder: w,
1769
- value: rt,
1770
- onClick: () => J(!0),
1771
- className: k?.input,
1772
+ onClick: () => q(!0),
1773
+ className: E?.input,
1772
1774
  style: {
1773
- width: L ? "230px" : W === 2 ? "260px" : "190px",
1774
- minHeight: "40px",
1775
- boxSizing: "border-box",
1776
- padding: "8px 12px",
1777
- borderRadius: G.radii.sm,
1778
- border: `1px solid ${G.colors.border}`,
1779
- outlineColor: G.colors.primary,
1780
- backgroundColor: G.colors.background,
1781
- color: G.colors.textPrimary,
1782
- cursor: "pointer",
1783
- textAlign: v === "rtl" ? "right" : "left",
1784
- direction: v,
1785
- fontFamily: "inherit",
1786
- fontSize: "14px",
1787
- ...A?.input
1775
+ direction: "ltr",
1776
+ textAlign: "left",
1777
+ ...D?.input
1788
1778
  }
1789
- })), K && (q ? /* @__PURE__ */ c("div", {
1790
- role: "presentation",
1791
- onClick: () => {
1792
- Se && J(!1);
1779
+ }) : /* @__PURE__ */ l("div", {
1780
+ onClick: () => q((e) => !e),
1781
+ style: {
1782
+ position: "relative",
1783
+ display: "inline-flex",
1784
+ alignItems: "center",
1785
+ cursor: "pointer",
1786
+ direction: "ltr",
1787
+ width: "100%"
1793
1788
  },
1794
- className: k?.modalBackdrop,
1789
+ children: [/* @__PURE__ */ c("input", {
1790
+ type: "text",
1791
+ readOnly: !0,
1792
+ placeholder: v,
1793
+ value: Ve,
1794
+ className: E?.input,
1795
+ style: {
1796
+ direction: "ltr",
1797
+ textAlign: "left",
1798
+ padding: "8px 30px 8px 12px",
1799
+ borderRadius: "var(--pdp-border-radius, 8px)",
1800
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1801
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1802
+ color: "var(--pdp-text-primary, #0f172a)",
1803
+ cursor: "pointer",
1804
+ fontSize: "13.5px",
1805
+ minWidth: N ? "190px" : "150px",
1806
+ width: "100%",
1807
+ boxSizing: "border-box",
1808
+ ...D?.input
1809
+ }
1810
+ }), M && He && /* @__PURE__ */ c("button", {
1811
+ type: "button",
1812
+ onClick: Ie,
1813
+ "aria-label": "Clear value",
1814
+ style: {
1815
+ position: "absolute",
1816
+ right: "8px",
1817
+ background: "transparent",
1818
+ border: "none",
1819
+ cursor: "pointer",
1820
+ color: "var(--pdp-text-muted, #94a3b8)",
1821
+ padding: "2px",
1822
+ display: "flex",
1823
+ alignItems: "center",
1824
+ justifyContent: "center",
1825
+ fontSize: "14px",
1826
+ fontWeight: 700,
1827
+ lineHeight: 1,
1828
+ borderRadius: "50%",
1829
+ transition: "all 0.15s ease"
1830
+ },
1831
+ onMouseEnter: (e) => {
1832
+ e.currentTarget.style.color = "var(--pdp-holiday-color, #e11d48)";
1833
+ },
1834
+ onMouseLeave: (e) => {
1835
+ e.currentTarget.style.color = "var(--pdp-text-muted, #94a3b8)";
1836
+ },
1837
+ children: "✕"
1838
+ })]
1839
+ })), K && (J ? /* @__PURE__ */ c("div", {
1840
+ role: "presentation",
1841
+ onClick: () => q(!1),
1842
+ className: E?.modalBackdrop,
1795
1843
  style: {
1796
1844
  position: "fixed",
1797
1845
  top: 0,
1798
1846
  left: 0,
1799
1847
  right: 0,
1800
1848
  bottom: 0,
1801
- backgroundColor: "rgba(15, 23, 42, 0.64)",
1849
+ backgroundColor: "rgba(15, 23, 42, 0.6)",
1802
1850
  backdropFilter: "blur(4px)",
1803
1851
  zIndex: 1e3,
1804
1852
  display: "flex",
1805
1853
  alignItems: "center",
1806
1854
  justifyContent: "center",
1807
1855
  padding: "16px",
1808
- direction: v,
1809
- ...A?.modalBackdrop
1856
+ direction: "rtl",
1857
+ ...D?.modalBackdrop
1810
1858
  },
1811
- children: at
1812
- }) : at)]
1859
+ children: We
1860
+ }) : We)]
1813
1861
  });
1814
1862
  }
1815
1863
  //#endregion
1864
+ //#region src/theme/style-utils.ts
1865
+ function he(...e) {
1866
+ return e.filter(Boolean).join(" ") || void 0;
1867
+ }
1868
+ //#endregion
1816
1869
  //#region src/components/dual-calendar/DualMonthCalendar.tsx
1817
- var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDate: a, firstDayOfWeek: s = 0, digitType: d = "persian", minDate: f, maxDate: p, isDateDisabled: m, direction: h = "rtl", className: g, style: _, classNames: b, styles: S }) => {
1818
- let { theme: C } = V(), [w, T] = o(n), E = e === void 0 ? w : e, [k, A] = o(null), j = (e) => d === "persian" ? I(e) : String(e), M = i(() => v(), []), [N, P] = o(() => a || (E[0] ? {
1870
+ var J = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDate: a, firstDayOfWeek: s = 0, digitType: d = "persian", minDate: f, maxDate: p, isDateDisabled: m, direction: h = "rtl", className: g, style: _, classNames: b, styles: S }) => {
1871
+ let { theme: C } = U(), [w, T] = o(n), E = e === void 0 ? w : e, [k, A] = o(null), j = (e) => d === "persian" ? L(e) : String(e), M = i(() => v(), []), [N, P] = o(() => a || (E[0] ? {
1819
1872
  year: E[0].year,
1820
1873
  month: E[0].month
1821
1874
  } : {
@@ -1827,7 +1880,7 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1827
1880
  } : {
1828
1881
  year: N.year,
1829
1882
  month: N.month + 1
1830
- }, [N]), ee = () => {
1883
+ }, [N]), I = () => {
1831
1884
  P((e) => e.month === 0 ? {
1832
1885
  year: e.year - 1,
1833
1886
  month: 11
@@ -1835,7 +1888,7 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1835
1888
  year: e.year,
1836
1889
  month: e.month - 1
1837
1890
  });
1838
- }, L = () => {
1891
+ }, R = () => {
1839
1892
  P((e) => e.month === 11 ? {
1840
1893
  year: e.year + 1,
1841
1894
  month: 0
@@ -1843,14 +1896,14 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1843
1896
  year: e.year,
1844
1897
  month: e.month + 1
1845
1898
  });
1846
- }, R = t((t) => {
1899
+ }, z = t((t) => {
1847
1900
  let [n, i] = E, a;
1848
1901
  !n || n && i ? a = [t, null] : (a = D(t, n) < 0 ? [t, n] : [n, t], A(null)), e === void 0 && T(a), r?.(a);
1849
1902
  }, [
1850
1903
  E,
1851
1904
  e,
1852
1905
  r
1853
- ]), z = t((e, t) => {
1906
+ ]), B = t((e, t) => {
1854
1907
  let n = x({
1855
1908
  year: e,
1856
1909
  month: t,
@@ -1876,15 +1929,15 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1876
1929
  m,
1877
1930
  E,
1878
1931
  k
1879
- ]), te = i(() => z(N.year, N.month), [
1880
- z,
1932
+ ]), V = i(() => B(N.year, N.month), [
1933
+ B,
1881
1934
  N.year,
1882
1935
  N.month
1883
- ]), B = i(() => z(F.year, F.month), [
1884
- z,
1936
+ ]), H = i(() => B(F.year, F.month), [
1937
+ B,
1885
1938
  F.year,
1886
1939
  F.month
1887
- ]), ne = (e, t, n, r) => /* @__PURE__ */ l("div", {
1940
+ ]), W = (e, t, n, r) => /* @__PURE__ */ l("div", {
1888
1941
  dir: h,
1889
1942
  className: b?.calendarPane,
1890
1943
  style: {
@@ -1910,7 +1963,7 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1910
1963
  r ? /* @__PURE__ */ c("button", {
1911
1964
  type: "button",
1912
1965
  "aria-label": "ماه قبل",
1913
- onClick: ee,
1966
+ onClick: I,
1914
1967
  className: b?.navButton,
1915
1968
  style: {
1916
1969
  width: "28px",
@@ -1939,7 +1992,7 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1939
1992
  r ? /* @__PURE__ */ c("div", { style: { width: "28px" } }) : /* @__PURE__ */ c("button", {
1940
1993
  type: "button",
1941
1994
  "aria-label": "ماه بعد",
1942
- onClick: L,
1995
+ onClick: R,
1943
1996
  className: b?.navButton,
1944
1997
  style: {
1945
1998
  width: "28px",
@@ -1955,7 +2008,7 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1955
2008
  })
1956
2009
  ]
1957
2010
  }),
1958
- /* @__PURE__ */ c(ie, {
2011
+ /* @__PURE__ */ c(te, {
1959
2012
  firstDayOfWeek: s,
1960
2013
  direction: h,
1961
2014
  classNames: b,
@@ -1973,13 +2026,13 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1973
2026
  gap: "var(--pdp-cell-gap, 4px)",
1974
2027
  ...S?.grid
1975
2028
  },
1976
- children: n.map((e) => /* @__PURE__ */ c(oe, {
2029
+ children: n.map((e) => /* @__PURE__ */ c(ne, {
1977
2030
  cell: e,
1978
2031
  digitType: d,
1979
2032
  classNames: b,
1980
2033
  styles: S,
1981
2034
  tabIndex: 0,
1982
- onSelect: R,
2035
+ onSelect: z,
1983
2036
  onHover: A
1984
2037
  }, `${e.jalali.year}-${e.jalali.month}-${e.jalali.day}`))
1985
2038
  })
@@ -1989,7 +2042,7 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
1989
2042
  role: "region",
1990
2043
  "aria-label": "تقویم دوقلو شمسی",
1991
2044
  dir: h,
1992
- className: ae(g, b?.calendar),
2045
+ className: he(g, b?.calendar),
1993
2046
  style: {
1994
2047
  "--pdp-cell-size": "36px",
1995
2048
  "--pdp-cell-gap": "4px",
@@ -2008,7 +2061,7 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
2008
2061
  ...S?.calendar
2009
2062
  },
2010
2063
  children: [
2011
- ne(N.year, N.month, te, !0),
2064
+ W(N.year, N.month, V, !0),
2012
2065
  /* @__PURE__ */ c("div", {
2013
2066
  className: b?.paneDivider,
2014
2067
  style: {
@@ -2017,11 +2070,11 @@ var xe = ({ value: e, defaultValue: n = [null, null], onChange: r, initialViewDa
2017
2070
  ...S?.paneDivider
2018
2071
  }
2019
2072
  }),
2020
- ne(F.year, F.month, B, !1)
2073
+ W(F.year, F.month, H, !1)
2021
2074
  ]
2022
2075
  });
2023
2076
  };
2024
2077
  //#endregion
2025
- export { ne as DatePickerThemeProvider, oe as DayCell, xe as DualMonthCalendar, re as Header, d as JALALI_MONTH_NAMES_EN, be as JalaliDatePicker, pe as MaskedDateInput, se as MonthYearPicker, u as PERSIAN_MONTH_NAMES, p as PERSIAN_WEEK_DAYS_LONG, f as PERSIAN_WEEK_DAYS_SHORT, fe as TimePicker, ie as Weekdays, T as addDaysToJalali, E as addJalaliDays, U as applyDateMask, M as calculateNextFocusedDate, le as clampTime, D as compareJalaliDates, te as darkTheme, R as formatJalaliDate, H as formatTimeSegment, ue as formatTimeString, x as generateJalaliCalendarGrid, N as getAriaDayLabel, ce as getCurrentTime, h as getDaysInJalaliMonth, me as getEventsForDate, w as getJalaliDayOfWeek, A as getJalaliMonthRange, k as getJalaliWeekRange, v as getTodayJalali, g as gregorianToJalali, O as isJalaliDateBetween, m as isJalaliLeapYear, y as isSameJalaliDay, _ as jalaliToGregorian, C as jalaliToJsDate, S as jsDateToJalali, z as lightTheme, W as parseAndValidateJalaliString, b as toJalaliDate, L as toLatinDigits, I as toPersianDigits, P as useCalendarKeyboard, j as useJalaliDatePicker, V as useTheme };
2078
+ export { W as DatePickerThemeProvider, ne as DayCell, J as DualMonthCalendar, ee as Header, d as JALALI_MONTH_NAMES_EN, me as JalaliDatePicker, ue as MaskedDateInput, re as MonthYearPicker, u as PERSIAN_MONTH_NAMES, p as PERSIAN_WEEK_DAYS_LONG, f as PERSIAN_WEEK_DAYS_SHORT, ce as TimePicker, te as Weekdays, T as addDaysToJalali, E as addJalaliDays, le as applyDateMask, M as calculateNextFocusedDate, ae as clampTime, D as compareJalaliDates, V as darkTheme, z as formatJalaliDate, G as formatTimeSegment, oe as formatTimeString, x as generateJalaliCalendarGrid, N as getAriaDayLabel, ie as getCurrentTime, h as getDaysInJalaliMonth, de as getEventsForDate, w as getJalaliDayOfWeek, A as getJalaliMonthRange, k as getJalaliWeekRange, pe as getOfficialHoliday, v as getTodayJalali, g as gregorianToJalali, O as isJalaliDateBetween, fe as isJalaliFriday, m as isJalaliLeapYear, y as isSameJalaliDay, _ as jalaliToGregorian, C as jalaliToJsDate, S as jsDateToJalali, B as lightTheme, K as parseAndValidateJalaliString, b as toJalaliDate, R as toLatinDigits, L as toPersianDigits, P as useCalendarKeyboard, j as useJalaliDatePicker, U as useTheme };
2026
2079
 
2027
2080
  //# sourceMappingURL=index.mjs.map