@mngh/jalali-datepicker 1.2.1 → 1.2.3
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/components/DayCell.d.ts +2 -0
- package/dist/components/DayCell.d.ts.map +1 -1
- package/dist/components/JalaliDatePicker.d.ts.map +1 -1
- package/dist/components/dual-calendar/DualMonthCalendar.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +361 -332
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -212,15 +212,15 @@ var O = D;
|
|
|
212
212
|
function k(e, t) {
|
|
213
213
|
return e.year === t.year ? e.month === t.month ? e.day === t.day ? 0 : e.day < t.day ? -1 : 1 : e.month < t.month ? -1 : 1 : e.year < t.year ? -1 : 1;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function A(e, t, n, r = !0) {
|
|
216
216
|
let i = k(t, n) <= 0 ? t : n, a = k(t, n) <= 0 ? n : t, o = k(e, i), s = k(e, a);
|
|
217
217
|
return r ? o >= 0 && s <= 0 : o > 0 && s < 0;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function j(e) {
|
|
220
220
|
let t = D(e, -E(e.year, e.month, e.day));
|
|
221
221
|
return [t, D(t, 6)];
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function M(e) {
|
|
224
224
|
let t = _(e.year, e.month);
|
|
225
225
|
return [{
|
|
226
226
|
year: e.year,
|
|
@@ -234,11 +234,11 @@ function j(e) {
|
|
|
234
234
|
}
|
|
235
235
|
//#endregion
|
|
236
236
|
//#region src/core/date-availability.ts
|
|
237
|
-
function
|
|
237
|
+
function N(e, t = {}) {
|
|
238
238
|
let { minDate: n, maxDate: r, isDateDisabled: i } = t;
|
|
239
239
|
return n && k(e, n) < 0 || r && k(e, r) > 0 ? !1 : !i?.(e);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function P(e, t, n = {}) {
|
|
242
242
|
let r = {
|
|
243
243
|
year: e,
|
|
244
244
|
month: t,
|
|
@@ -250,21 +250,21 @@ function N(e, t, n = {}) {
|
|
|
250
250
|
};
|
|
251
251
|
if (n.minDate && k(i, n.minDate) < 0 || n.maxDate && k(r, n.maxDate) > 0) return !1;
|
|
252
252
|
if (!n.isDateDisabled) return !0;
|
|
253
|
-
for (let r = 1; r <= i.day; r += 1) if (
|
|
253
|
+
for (let r = 1; r <= i.day; r += 1) if (N({
|
|
254
254
|
year: e,
|
|
255
255
|
month: t,
|
|
256
256
|
day: r
|
|
257
257
|
}, n)) return !0;
|
|
258
258
|
return !1;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
for (let n = 0; n < 12; n += 1) if (
|
|
260
|
+
function F(e, t = {}) {
|
|
261
|
+
for (let n = 0; n < 12; n += 1) if (P(e, n, t)) return !0;
|
|
262
262
|
return !1;
|
|
263
263
|
}
|
|
264
264
|
//#endregion
|
|
265
265
|
//#region src/hooks/useJalaliDatePicker.ts
|
|
266
|
-
function
|
|
267
|
-
let { mode: t = "single", value: r, defaultValue: i, initialViewDate: o, onChange: c, minDate: l, maxDate: u, isDateDisabled: d, firstDayOfWeek: f = 0 } = e, p = a(() => b(), []), [m, h] = s(() => i === void 0 ? t === "single" ? null : t === "range" ? [null, null] : [] : i), g = r === void 0 ? m : r, [_, v] = s(() => o ? o.year : i && !Array.isArray(i) ? i.year : p.year), [y, S] = s(() => o ? o.month : i && !Array.isArray(i) ? i.month : p.month), [w, T] = s(null), E = n((e) =>
|
|
266
|
+
function I(e = {}) {
|
|
267
|
+
let { mode: t = "single", value: r, defaultValue: i, initialViewDate: o, onChange: c, minDate: l, maxDate: u, isDateDisabled: d, firstDayOfWeek: f = 0 } = e, p = a(() => b(), []), [m, h] = s(() => i === void 0 ? t === "single" ? null : t === "range" ? [null, null] : [] : i), g = r === void 0 ? m : r, [_, v] = s(() => o ? o.year : i && !Array.isArray(i) ? i.year : p.year), [y, S] = s(() => o ? o.month : i && !Array.isArray(i) ? i.month : p.month), [w, T] = s(null), E = n((e) => N(e, {
|
|
268
268
|
minDate: l,
|
|
269
269
|
maxDate: u,
|
|
270
270
|
isDateDisabled: d
|
|
@@ -278,10 +278,10 @@ function te(e = {}) {
|
|
|
278
278
|
y === 0 ? (v((e) => e - 1), S(11)) : S((e) => e - 1);
|
|
279
279
|
}, [y]), k = n(() => {
|
|
280
280
|
y === 11 ? (v((e) => e + 1), S(0)) : S((e) => e + 1);
|
|
281
|
-
}, [y]),
|
|
281
|
+
}, [y]), j = n(() => {
|
|
282
282
|
let e = b();
|
|
283
283
|
v(e.year), S(e.month);
|
|
284
|
-
}, []),
|
|
284
|
+
}, []), M = n((e) => {
|
|
285
285
|
if (!E(e)) return;
|
|
286
286
|
let n;
|
|
287
287
|
if (t === "single") n = e;
|
|
@@ -299,14 +299,14 @@ function te(e = {}) {
|
|
|
299
299
|
r,
|
|
300
300
|
c,
|
|
301
301
|
E
|
|
302
|
-
]),
|
|
302
|
+
]), P = n((e) => {
|
|
303
303
|
if (t === "single") return x(g, e);
|
|
304
304
|
if (t === "range") {
|
|
305
305
|
let [t, n] = g || [null, null];
|
|
306
306
|
return !!(t && x(t, e) || n && x(n, e));
|
|
307
307
|
}
|
|
308
308
|
return (g || []).some((t) => x(t, e));
|
|
309
|
-
}, [t, g]),
|
|
309
|
+
}, [t, g]), F = n(() => {
|
|
310
310
|
let e = t === "single" ? null : t === "range" ? [null, null] : [];
|
|
311
311
|
r === void 0 && h(e), c?.(e);
|
|
312
312
|
}, [
|
|
@@ -338,7 +338,7 @@ function te(e = {}) {
|
|
|
338
338
|
let [t, n] = g || [null, null], r = n ?? (t && w ? w : null);
|
|
339
339
|
return e.map((e) => {
|
|
340
340
|
let n = t ? x(e.jalali, t) : !1, i = r ? x(e.jalali, r) : !1, a = !1;
|
|
341
|
-
return t && r && (a =
|
|
341
|
+
return t && r && (a = A(e.jalali, t, r)), {
|
|
342
342
|
...e,
|
|
343
343
|
isSelected: n || i,
|
|
344
344
|
isInRange: a,
|
|
@@ -368,18 +368,18 @@ function te(e = {}) {
|
|
|
368
368
|
]),
|
|
369
369
|
goToPrevMonth: O,
|
|
370
370
|
goToNextMonth: k,
|
|
371
|
-
goToToday:
|
|
371
|
+
goToToday: j,
|
|
372
372
|
setView: D,
|
|
373
|
-
selectDate:
|
|
374
|
-
isDateSelected:
|
|
373
|
+
selectDate: M,
|
|
374
|
+
isDateSelected: P,
|
|
375
375
|
setHoverDate: T,
|
|
376
376
|
hoverDate: w,
|
|
377
|
-
clear:
|
|
377
|
+
clear: F
|
|
378
378
|
};
|
|
379
379
|
}
|
|
380
380
|
//#endregion
|
|
381
381
|
//#region src/a11y/keyboard-navigation.ts
|
|
382
|
-
function
|
|
382
|
+
function L(e) {
|
|
383
383
|
let { currentFocused: t, key: n, isRtl: r = !0 } = e, { year: i, month: a, day: o } = t, s = !1, c = !0, l = r ? 1 : -1, u = r ? -1 : 1;
|
|
384
384
|
switch (n) {
|
|
385
385
|
case "ArrowRight":
|
|
@@ -426,13 +426,13 @@ function F(e) {
|
|
|
426
426
|
}
|
|
427
427
|
//#endregion
|
|
428
428
|
//#region src/a11y/aria-helpers.ts
|
|
429
|
-
function
|
|
429
|
+
function ee(e) {
|
|
430
430
|
let t = h[(y(e.year, e.month, e.day).getDay() + 1) % 7], n = f[e.month];
|
|
431
431
|
return `${t}، ${e.day} ${n} ${e.year}`;
|
|
432
432
|
}
|
|
433
433
|
//#endregion
|
|
434
434
|
//#region src/a11y/useCalendarKeyboard.ts
|
|
435
|
-
function
|
|
435
|
+
function te(e) {
|
|
436
436
|
let { viewYear: t, viewMonth: r, selectedDate: i, onSelectDate: a, onViewChange: o, isRtl: c = !0 } = e, [l, u] = s(() => i ?? {
|
|
437
437
|
year: t,
|
|
438
438
|
month: r,
|
|
@@ -446,7 +446,7 @@ function ne(e) {
|
|
|
446
446
|
e.preventDefault(), a(l);
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
|
-
let t =
|
|
449
|
+
let t = L({
|
|
450
450
|
currentFocused: l,
|
|
451
451
|
key: e.key,
|
|
452
452
|
isRtl: c
|
|
@@ -463,7 +463,7 @@ function ne(e) {
|
|
|
463
463
|
}
|
|
464
464
|
//#endregion
|
|
465
465
|
//#region src/formatters/persian-digits.ts
|
|
466
|
-
var
|
|
466
|
+
var ne = [
|
|
467
467
|
"۰",
|
|
468
468
|
"۱",
|
|
469
469
|
"۲",
|
|
@@ -474,7 +474,7 @@ var re = [
|
|
|
474
474
|
"۷",
|
|
475
475
|
"۸",
|
|
476
476
|
"۹"
|
|
477
|
-
],
|
|
477
|
+
], R = {
|
|
478
478
|
"۰": "0",
|
|
479
479
|
"۱": "1",
|
|
480
480
|
"۲": "2",
|
|
@@ -496,22 +496,22 @@ var re = [
|
|
|
496
496
|
"٨": "8",
|
|
497
497
|
"٩": "9"
|
|
498
498
|
};
|
|
499
|
-
function R(e) {
|
|
500
|
-
return String(e).replace(/[0-9]/g, (e) => re[+e]);
|
|
501
|
-
}
|
|
502
499
|
function z(e) {
|
|
503
|
-
return e.replace(/[
|
|
500
|
+
return String(e).replace(/[0-9]/g, (e) => ne[+e]);
|
|
501
|
+
}
|
|
502
|
+
function B(e) {
|
|
503
|
+
return e.replace(/[۰-۹٠-٩]/g, (e) => R[e] ?? e);
|
|
504
504
|
}
|
|
505
505
|
//#endregion
|
|
506
506
|
//#region src/formatters/jalali-formatter.ts
|
|
507
|
-
function
|
|
507
|
+
function V(e, t = "YYYY/MM/DD", n = {}) {
|
|
508
508
|
if (!e) return "";
|
|
509
509
|
let { digitType: r = "persian" } = n, i = (y(e.year, e.month, e.day).getDay() + 1) % 7, a = String(e.year), o = a.slice(-2), s = e.month + 1, c = s < 10 ? `0${s}` : String(s), l = f[e.month], u = e.day < 10 ? `0${e.day}` : String(e.day), d = h[i], p = t.replace(/\bYYYY\b/g, a).replace(/\bYY\b/g, o).replace(/\bMMMM\b/g, l).replace(/\bMM\b/g, c).replace(/\bM\b/g, String(s)).replace(/\bdddd\b/g, d).replace(/\bDD\b/g, u).replace(/\bD\b/g, String(e.day));
|
|
510
|
-
return r === "persian" && (p = p.replace(/\d+/g, (e) =>
|
|
510
|
+
return r === "persian" && (p = p.replace(/\d+/g, (e) => z(e))), p;
|
|
511
511
|
}
|
|
512
512
|
//#endregion
|
|
513
513
|
//#region src/theme/tokens.ts
|
|
514
|
-
var
|
|
514
|
+
var H = {
|
|
515
515
|
mode: "light",
|
|
516
516
|
colors: {
|
|
517
517
|
primary: "#4f46e5",
|
|
@@ -540,7 +540,7 @@ var V = {
|
|
|
540
540
|
md: "0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04)",
|
|
541
541
|
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05)"
|
|
542
542
|
}
|
|
543
|
-
},
|
|
543
|
+
}, re = {
|
|
544
544
|
mode: "dark",
|
|
545
545
|
colors: {
|
|
546
546
|
primary: "#6366f1",
|
|
@@ -569,14 +569,14 @@ var V = {
|
|
|
569
569
|
md: "0 4px 6px -1px rgba(0, 0, 0, 0.4)",
|
|
570
570
|
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.5)"
|
|
571
571
|
}
|
|
572
|
-
},
|
|
573
|
-
theme:
|
|
572
|
+
}, ie = t({
|
|
573
|
+
theme: H,
|
|
574
574
|
mode: "light"
|
|
575
|
-
}),
|
|
576
|
-
theme:
|
|
575
|
+
}), ae = () => r(ie) || {
|
|
576
|
+
theme: H,
|
|
577
577
|
mode: "light"
|
|
578
|
-
},
|
|
579
|
-
let r = t === "dark" ?
|
|
578
|
+
}, oe = ({ children: e, mode: t = "light", customTheme: n }) => {
|
|
579
|
+
let r = t === "dark" ? re : H, i = a(() => n ? {
|
|
580
580
|
mode: t,
|
|
581
581
|
theme: {
|
|
582
582
|
...r,
|
|
@@ -603,20 +603,20 @@ var V = {
|
|
|
603
603
|
n,
|
|
604
604
|
t
|
|
605
605
|
]);
|
|
606
|
-
return /* @__PURE__ */ l(
|
|
606
|
+
return /* @__PURE__ */ l(ie.Provider, {
|
|
607
607
|
value: i,
|
|
608
608
|
children: e
|
|
609
609
|
});
|
|
610
610
|
};
|
|
611
611
|
//#endregion
|
|
612
612
|
//#region src/theme/style-utils.ts
|
|
613
|
-
function
|
|
613
|
+
function U(...e) {
|
|
614
614
|
return e.filter(Boolean).join(" ") || void 0;
|
|
615
615
|
}
|
|
616
616
|
//#endregion
|
|
617
617
|
//#region src/components/Header.tsx
|
|
618
|
-
var
|
|
619
|
-
let { theme: h } =
|
|
618
|
+
var se = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick: i, isPickerOpen: a = !1, digitType: o = "persian", direction: c = "rtl", isPrevDisabled: d = !1, isNextDisabled: f = !1, classNames: p, styles: m }) => {
|
|
619
|
+
let { theme: h } = ae(), [g, _] = s(null), v = o === "persian" ? z(e) : String(e), y = (e, t) => ({
|
|
620
620
|
width: "32px",
|
|
621
621
|
height: "32px",
|
|
622
622
|
padding: 0,
|
|
@@ -654,7 +654,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
654
654
|
disabled: d,
|
|
655
655
|
"aria-disabled": d,
|
|
656
656
|
"aria-label": "ماه قبل",
|
|
657
|
-
className:
|
|
657
|
+
className: U(p?.navButton, d && p?.disabledNavButton),
|
|
658
658
|
style: y("prev", d),
|
|
659
659
|
onMouseEnter: () => _("prev"),
|
|
660
660
|
onMouseLeave: () => _(null),
|
|
@@ -724,7 +724,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
724
724
|
disabled: f,
|
|
725
725
|
"aria-disabled": f,
|
|
726
726
|
"aria-label": "ماه بعد",
|
|
727
|
-
className:
|
|
727
|
+
className: U(p?.navButton, f && p?.disabledNavButton),
|
|
728
728
|
style: y("next", f),
|
|
729
729
|
onMouseEnter: () => _("next"),
|
|
730
730
|
onMouseLeave: () => _(null),
|
|
@@ -744,7 +744,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
744
744
|
})
|
|
745
745
|
]
|
|
746
746
|
});
|
|
747
|
-
},
|
|
747
|
+
}, ce = ({ firstDayOfWeek: t = 0, classNames: n, styles: r }) => {
|
|
748
748
|
let i = e.useMemo(() => {
|
|
749
749
|
let e = [...m];
|
|
750
750
|
return [...e.slice(t), ...e.slice(0, t)];
|
|
@@ -785,28 +785,28 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
785
785
|
}, e);
|
|
786
786
|
})
|
|
787
787
|
});
|
|
788
|
-
},
|
|
789
|
-
let [
|
|
790
|
-
e.stopPropagation(),
|
|
791
|
-
},
|
|
792
|
-
|
|
793
|
-
},
|
|
794
|
-
|
|
795
|
-
},
|
|
796
|
-
|
|
797
|
-
},
|
|
798
|
-
|
|
799
|
-
let
|
|
800
|
-
...
|
|
801
|
-
...
|
|
802
|
-
...
|
|
803
|
-
...
|
|
804
|
-
...
|
|
805
|
-
...
|
|
806
|
-
...n ?
|
|
807
|
-
...
|
|
808
|
-
},
|
|
809
|
-
return
|
|
788
|
+
}, le = ({ cell: e, digitType: t = "persian", isHoliday: n = !1, holidayTitle: r, events: i = [], gridColumnIndex: a, tabIndex: o = -1, classNames: c, styles: d, onSelect: f, onHover: p, onFocus: m }) => {
|
|
789
|
+
let [h, g] = s(!1), [_, v] = s(!1), { jalali: y, dayNumber: b, isCurrentMonth: x, isToday: S, isSelected: C, isDisabled: w, isInRange: T, isRangeStart: E, isRangeEnd: D } = e, O = t === "persian" ? z(b) : B(b.toString()), k = !w && x, A = a === 0 ? "start" : a === 6 ? "end" : "center", j = (e) => {
|
|
790
|
+
e.stopPropagation(), k && f(y);
|
|
791
|
+
}, M = () => {
|
|
792
|
+
g(!0), k && p && p(y);
|
|
793
|
+
}, N = () => {
|
|
794
|
+
g(!1), v(!1), p && p(null);
|
|
795
|
+
}, P = () => {
|
|
796
|
+
k && m && m(y);
|
|
797
|
+
}, F = "transparent", I = x ? "var(--pdp-text-primary, #0f172a)" : "var(--pdp-text-disabled, #cbd5e1)", L = E || D;
|
|
798
|
+
C || L ? (F = "var(--pdp-primary, #4f46e5)", I = "#ffffff") : T ? F = "var(--pdp-range-between-bg, rgba(79, 70, 229, 0.12))" : h && k && (F = "var(--pdp-hover-bg, #f1f5f9)"), n && x && !w && !C && !L && (I = "var(--pdp-holiday-color, #e11d48)"), w && (F = "var(--pdp-disabled-bg, #f1f5f9)", I = "var(--pdp-text-disabled, #94a3b8)");
|
|
799
|
+
let ee = U(c?.dayCell, S && c?.todayCell, C && c?.selectedCell, T && c?.rangeBetweenCell, E && c?.rangeStartCell, D && c?.rangeEndCell, w && c?.disabledCell, !x && c?.outsideMonthCell, n && c?.holidayCell), te = {
|
|
800
|
+
...S ? d?.todayCell : void 0,
|
|
801
|
+
...C ? d?.selectedCell : void 0,
|
|
802
|
+
...T ? d?.rangeBetweenCell : void 0,
|
|
803
|
+
...E ? d?.rangeStartCell : void 0,
|
|
804
|
+
...D ? d?.rangeEndCell : void 0,
|
|
805
|
+
...x ? void 0 : d?.outsideMonthCell,
|
|
806
|
+
...n ? d?.holidayCell : void 0,
|
|
807
|
+
...w ? d?.disabledCell : void 0
|
|
808
|
+
}, ne = "scale(1)";
|
|
809
|
+
return k && (_ ? ne = "scale(0.92)" : h && !T && (ne = "scale(1.08)")), /* @__PURE__ */ u("div", {
|
|
810
810
|
style: {
|
|
811
811
|
position: "relative",
|
|
812
812
|
display: "flex",
|
|
@@ -819,21 +819,21 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
819
819
|
padding: 0,
|
|
820
820
|
boxSizing: "border-box"
|
|
821
821
|
},
|
|
822
|
-
onMouseEnter:
|
|
823
|
-
onMouseLeave:
|
|
822
|
+
onMouseEnter: M,
|
|
823
|
+
onMouseLeave: N,
|
|
824
824
|
children: [/* @__PURE__ */ u("button", {
|
|
825
825
|
type: "button",
|
|
826
826
|
role: "gridcell",
|
|
827
|
-
tabIndex:
|
|
828
|
-
disabled:
|
|
829
|
-
"aria-disabled":
|
|
830
|
-
"aria-selected":
|
|
831
|
-
"aria-label": `${
|
|
832
|
-
onClick:
|
|
833
|
-
onFocus:
|
|
834
|
-
onMouseDown: () =>
|
|
835
|
-
onMouseUp: () =>
|
|
836
|
-
className:
|
|
827
|
+
tabIndex: o,
|
|
828
|
+
disabled: w || !x,
|
|
829
|
+
"aria-disabled": w || !x,
|
|
830
|
+
"aria-selected": C,
|
|
831
|
+
"aria-label": `${y.year}/${y.month + 1}/${y.day}${r ? ` - ${r}` : ""}`,
|
|
832
|
+
onClick: j,
|
|
833
|
+
onFocus: P,
|
|
834
|
+
onMouseDown: () => k && v(!0),
|
|
835
|
+
onMouseUp: () => k && v(!1),
|
|
836
|
+
className: ee,
|
|
837
837
|
style: {
|
|
838
838
|
width: "100%",
|
|
839
839
|
height: "100%",
|
|
@@ -841,28 +841,28 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
841
841
|
flexDirection: "column",
|
|
842
842
|
alignItems: "center",
|
|
843
843
|
justifyContent: "center",
|
|
844
|
-
borderRadius:
|
|
845
|
-
border:
|
|
846
|
-
backgroundColor:
|
|
847
|
-
color:
|
|
848
|
-
cursor:
|
|
844
|
+
borderRadius: E ? "0 8px 8px 0" : D ? "8px 0 0 8px" : T ? "0" : "8px",
|
|
845
|
+
border: S && !C ? "1px solid var(--pdp-primary, #4f46e5)" : "none",
|
|
846
|
+
backgroundColor: F,
|
|
847
|
+
color: I,
|
|
848
|
+
cursor: w ? "not-allowed" : k ? "pointer" : "default",
|
|
849
849
|
fontSize: "13px",
|
|
850
|
-
fontWeight:
|
|
850
|
+
fontWeight: C || S ? 700 : 500,
|
|
851
851
|
outline: "none",
|
|
852
852
|
position: "relative",
|
|
853
853
|
padding: 0,
|
|
854
854
|
margin: 0,
|
|
855
855
|
boxSizing: "border-box",
|
|
856
|
-
transform:
|
|
857
|
-
boxShadow:
|
|
856
|
+
transform: ne,
|
|
857
|
+
boxShadow: h && k && !T && !C ? "0 2px 6px rgba(0, 0, 0, 0.08)" : "none",
|
|
858
858
|
transition: "transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.14s ease, color 0.14s ease, box-shadow 0.16s ease",
|
|
859
|
-
zIndex:
|
|
860
|
-
opacity:
|
|
861
|
-
filter:
|
|
862
|
-
...
|
|
863
|
-
...
|
|
859
|
+
zIndex: h && k ? 2 : 1,
|
|
860
|
+
opacity: w ? .42 : x ? 1 : .55,
|
|
861
|
+
filter: w ? "grayscale(0.65)" : void 0,
|
|
862
|
+
...d?.dayCell,
|
|
863
|
+
...te
|
|
864
864
|
},
|
|
865
|
-
children: [/* @__PURE__ */ l("span", { children:
|
|
865
|
+
children: [/* @__PURE__ */ l("span", { children: O }), i.length > 0 && /* @__PURE__ */ l("div", {
|
|
866
866
|
style: {
|
|
867
867
|
position: "absolute",
|
|
868
868
|
bottom: "3px",
|
|
@@ -871,26 +871,30 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
871
871
|
alignItems: "center",
|
|
872
872
|
justifyContent: "center",
|
|
873
873
|
transition: "transform 0.14s ease",
|
|
874
|
-
transform:
|
|
874
|
+
transform: h && k ? "translateY(1px)" : "none"
|
|
875
875
|
},
|
|
876
876
|
children: i.slice(0, 3).map((e) => /* @__PURE__ */ l("span", { style: {
|
|
877
877
|
width: "3.5px",
|
|
878
878
|
height: "3.5px",
|
|
879
879
|
borderRadius: "50%",
|
|
880
|
-
backgroundColor:
|
|
880
|
+
backgroundColor: C ? "#ffffff" : e.color || "var(--pdp-primary, #4f46e5)",
|
|
881
881
|
transition: "background-color 0.14s ease"
|
|
882
882
|
} }, e.id))
|
|
883
883
|
})]
|
|
884
|
-
}),
|
|
884
|
+
}), h && x && (n || i.length > 0) && /* @__PURE__ */ u("div", {
|
|
885
885
|
role: "tooltip",
|
|
886
886
|
style: {
|
|
887
887
|
position: "absolute",
|
|
888
888
|
bottom: "calc(100% + 7px)",
|
|
889
|
-
|
|
890
|
-
|
|
889
|
+
insetInlineStart: A === "start" ? 0 : A === "center" ? "50%" : void 0,
|
|
890
|
+
insetInlineEnd: A === "end" ? 0 : void 0,
|
|
891
|
+
transform: A === "center" ? "translateX(-50%)" : "none",
|
|
891
892
|
zIndex: 1050,
|
|
892
893
|
pointerEvents: "none",
|
|
893
|
-
|
|
894
|
+
width: "max-content",
|
|
895
|
+
maxWidth: "min(240px, calc(100vw - 32px))",
|
|
896
|
+
whiteSpace: "normal",
|
|
897
|
+
overflowWrap: "anywhere",
|
|
894
898
|
backgroundColor: "var(--pdp-tooltip-bg, #0f172a)",
|
|
895
899
|
color: "var(--pdp-tooltip-text, #ffffff)",
|
|
896
900
|
padding: "5px 9px",
|
|
@@ -917,8 +921,9 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
917
921
|
/* @__PURE__ */ l("div", { style: {
|
|
918
922
|
position: "absolute",
|
|
919
923
|
top: "100%",
|
|
920
|
-
|
|
921
|
-
|
|
924
|
+
insetInlineStart: A === "start" ? "calc(var(--pdp-cell-size, 34px) / 2 - 4px)" : A === "center" ? "50%" : void 0,
|
|
925
|
+
insetInlineEnd: A === "end" ? "calc(var(--pdp-cell-size, 34px) / 2 - 4px)" : void 0,
|
|
926
|
+
transform: A === "center" ? "translateX(-50%)" : "none",
|
|
922
927
|
borderWidth: "4px",
|
|
923
928
|
borderStyle: "solid",
|
|
924
929
|
borderColor: "var(--pdp-tooltip-bg, #0f172a) transparent transparent transparent"
|
|
@@ -926,12 +931,12 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
926
931
|
]
|
|
927
932
|
})]
|
|
928
933
|
});
|
|
929
|
-
},
|
|
934
|
+
}, ue = ({ currentYear: e, currentMonth: t, onSelectMonth: n, onSelectYear: r, minDate: i, maxDate: a, isDateDisabled: o, classNames: c, styles: d }) => {
|
|
930
935
|
let [p, m] = s("months"), [h, g] = s(() => Math.floor(e / 10) * 10), [_, v] = s(e), y = Array.from({ length: 12 }, (e, t) => h - 1 + t), b = {
|
|
931
936
|
minDate: i,
|
|
932
937
|
maxDate: a,
|
|
933
938
|
isDateDisabled: o
|
|
934
|
-
}, x = (e) =>
|
|
939
|
+
}, x = (e) => F(e, b), S = (e, t) => P(e, t, b), C = p === "months" ? !x(_ - 1) : !Array.from({ length: 10 }, (e, t) => h - 10 + t).some(x), w = p === "months" ? !x(_ + 1) : !Array.from({ length: 10 }, (e, t) => h + 10 + t).some(x), T = () => {
|
|
935
940
|
if (!C) {
|
|
936
941
|
if (p === "months") {
|
|
937
942
|
let e = _ - 1;
|
|
@@ -1002,7 +1007,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1002
1007
|
disabled: C,
|
|
1003
1008
|
"aria-disabled": C,
|
|
1004
1009
|
"aria-label": "Previous",
|
|
1005
|
-
className:
|
|
1010
|
+
className: U(c?.navButton, C && c?.disabledNavButton),
|
|
1006
1011
|
style: {
|
|
1007
1012
|
...D,
|
|
1008
1013
|
cursor: C ? "not-allowed" : "pointer",
|
|
@@ -1052,7 +1057,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1052
1057
|
onMouseLeave: (e) => {
|
|
1053
1058
|
p === "months" && (e.currentTarget.style.backgroundColor = "var(--pdp-surface-subtle, #f1f5f9)", e.currentTarget.style.borderColor = "var(--pdp-surface-border, #e2e8f0)");
|
|
1054
1059
|
},
|
|
1055
|
-
children: [/* @__PURE__ */ l("span", { children: p === "months" ?
|
|
1060
|
+
children: [/* @__PURE__ */ l("span", { children: p === "months" ? z(_) : `${z(h)} - ${z(h + 9)}` }), p === "months" && /* @__PURE__ */ l("svg", {
|
|
1056
1061
|
width: "13",
|
|
1057
1062
|
height: "13",
|
|
1058
1063
|
viewBox: "0 0 24 24",
|
|
@@ -1071,7 +1076,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1071
1076
|
disabled: w,
|
|
1072
1077
|
"aria-disabled": w,
|
|
1073
1078
|
"aria-label": "Next",
|
|
1074
|
-
className:
|
|
1079
|
+
className: U(c?.navButton, w && c?.disabledNavButton),
|
|
1075
1080
|
style: {
|
|
1076
1081
|
...D,
|
|
1077
1082
|
cursor: w ? "not-allowed" : "pointer",
|
|
@@ -1113,7 +1118,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1113
1118
|
disabled: o,
|
|
1114
1119
|
"aria-disabled": o,
|
|
1115
1120
|
onClick: () => n(i),
|
|
1116
|
-
className:
|
|
1121
|
+
className: U(c?.monthButton, a && c?.selectedMonthButton, o && c?.disabledMonthButton),
|
|
1117
1122
|
style: {
|
|
1118
1123
|
...O,
|
|
1119
1124
|
background: a ? "var(--pdp-primary, #4f46e5)" : "transparent",
|
|
@@ -1139,7 +1144,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1139
1144
|
type: "button",
|
|
1140
1145
|
disabled: a,
|
|
1141
1146
|
"aria-disabled": a,
|
|
1142
|
-
className:
|
|
1147
|
+
className: U(c?.yearButton, i && c?.selectedYearButton, a && c?.disabledYearButton),
|
|
1143
1148
|
onClick: () => {
|
|
1144
1149
|
v(e), r(e), m("months");
|
|
1145
1150
|
},
|
|
@@ -1160,7 +1165,7 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1160
1165
|
onMouseLeave: (e) => {
|
|
1161
1166
|
i || (e.currentTarget.style.backgroundColor = "transparent");
|
|
1162
1167
|
},
|
|
1163
|
-
children:
|
|
1168
|
+
children: z(e)
|
|
1164
1169
|
}, e);
|
|
1165
1170
|
})
|
|
1166
1171
|
})]
|
|
@@ -1168,11 +1173,11 @@ var oe = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1168
1173
|
};
|
|
1169
1174
|
//#endregion
|
|
1170
1175
|
//#region src/plugins/time-picker/time-utils.ts
|
|
1171
|
-
function
|
|
1176
|
+
function W(e, t = "persian") {
|
|
1172
1177
|
let n = e < 10 ? `0${e}` : `${e}`;
|
|
1173
|
-
return t === "persian" ?
|
|
1178
|
+
return t === "persian" ? z(n) : n;
|
|
1174
1179
|
}
|
|
1175
|
-
function
|
|
1180
|
+
function de() {
|
|
1176
1181
|
let e = /* @__PURE__ */ new Date();
|
|
1177
1182
|
return {
|
|
1178
1183
|
hour: e.getHours(),
|
|
@@ -1180,34 +1185,34 @@ function ue() {
|
|
|
1180
1185
|
second: e.getSeconds()
|
|
1181
1186
|
};
|
|
1182
1187
|
}
|
|
1183
|
-
function
|
|
1188
|
+
function G(e) {
|
|
1184
1189
|
return {
|
|
1185
1190
|
hour: Math.max(0, Math.min(23, e.hour)),
|
|
1186
1191
|
minute: Math.max(0, Math.min(59, e.minute)),
|
|
1187
1192
|
second: e.second === void 0 ? void 0 : Math.max(0, Math.min(59, e.second))
|
|
1188
1193
|
};
|
|
1189
1194
|
}
|
|
1190
|
-
function
|
|
1195
|
+
function fe(e, t = !1, n = "persian") {
|
|
1191
1196
|
if (!e) return "";
|
|
1192
|
-
let r =
|
|
1193
|
-
return t && e.second !== void 0 ? `${r}:${i}:${
|
|
1197
|
+
let r = W(e.hour, n), i = W(e.minute, n);
|
|
1198
|
+
return t && e.second !== void 0 ? `${r}:${i}:${W(e.second, n)}` : `${r}:${i}`;
|
|
1194
1199
|
}
|
|
1195
1200
|
//#endregion
|
|
1196
1201
|
//#region src/components/footer/CalendarFooter.tsx
|
|
1197
|
-
var
|
|
1198
|
-
let { theme: _ } =
|
|
1202
|
+
var pe = ({ 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 }) => {
|
|
1203
|
+
let { theme: _ } = ae(), v = (() => {
|
|
1199
1204
|
if (a === "single") {
|
|
1200
1205
|
if (!e) return "تاریخی انتخاب نشده";
|
|
1201
|
-
let t =
|
|
1206
|
+
let t = V(e, "YYYY/MM/DD", { digitType: o }), n = r ? fe(r, i, o) : "";
|
|
1202
1207
|
return n ? `${t}، ${n}` : t;
|
|
1203
1208
|
}
|
|
1204
1209
|
if (a === "range") {
|
|
1205
1210
|
let [e, n] = t ?? [null, null];
|
|
1206
1211
|
if (!e) return "بازهای انتخاب نشده";
|
|
1207
|
-
let r =
|
|
1208
|
-
return n ? `${r} تا ${
|
|
1212
|
+
let r = V(e, "YYYY/MM/DD", { digitType: o });
|
|
1213
|
+
return n ? `${r} تا ${V(n, "YYYY/MM/DD", { digitType: o })}` : `${r} تا …`;
|
|
1209
1214
|
}
|
|
1210
|
-
let s = n?.length ?? 0, c = o === "persian" ?
|
|
1215
|
+
let s = n?.length ?? 0, c = o === "persian" ? z(s) : String(s);
|
|
1211
1216
|
return s ? `${c} تاریخ انتخاب شده` : "تاریخی انتخاب نشده";
|
|
1212
1217
|
})(), y = {
|
|
1213
1218
|
minHeight: "34px",
|
|
@@ -1296,7 +1301,7 @@ var fe = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
|
|
|
1296
1301
|
]
|
|
1297
1302
|
})]
|
|
1298
1303
|
});
|
|
1299
|
-
},
|
|
1304
|
+
}, me = ({ value: e, onChange: t, minuteStep: n = 1, hourStep: r = 1, showSeconds: a = !1, digitType: d = "persian", classNames: f, styles: p }) => {
|
|
1300
1305
|
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);
|
|
1301
1306
|
i(() => {
|
|
1302
1307
|
let e = (e) => {
|
|
@@ -1308,7 +1313,7 @@ var fe = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
|
|
|
1308
1313
|
}, []);
|
|
1309
1314
|
let b = (e) => {
|
|
1310
1315
|
let t = String(e).padStart(2, "0");
|
|
1311
|
-
return d === "persian" ?
|
|
1316
|
+
return d === "persian" ? z(t) : t;
|
|
1312
1317
|
}, x = (e, t, n, r) => {
|
|
1313
1318
|
let i = m === e;
|
|
1314
1319
|
return /* @__PURE__ */ u("div", {
|
|
@@ -1442,12 +1447,12 @@ var fe = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
|
|
|
1442
1447
|
};
|
|
1443
1448
|
//#endregion
|
|
1444
1449
|
//#region src/components/masked-input/mask-utils.ts
|
|
1445
|
-
function
|
|
1446
|
-
let n =
|
|
1447
|
-
return n.length > 0 && (r = n.slice(0, 4)), n.length >= 5 && (r += `/${n.slice(4, 6)}`), n.length >= 7 && (r += `/${n.slice(6, 8)}`), t === "persian" ?
|
|
1450
|
+
function he(e, t = "persian") {
|
|
1451
|
+
let n = B(e).replace(/\D/g, "").slice(0, 8), r = "";
|
|
1452
|
+
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;
|
|
1448
1453
|
}
|
|
1449
|
-
function
|
|
1450
|
-
let i =
|
|
1454
|
+
function K(e, t, n, r) {
|
|
1455
|
+
let i = B(e).trim();
|
|
1451
1456
|
if (!i) return {
|
|
1452
1457
|
isValid: !0,
|
|
1453
1458
|
date: null
|
|
@@ -1495,18 +1500,18 @@ function he(e, t, n, r) {
|
|
|
1495
1500
|
//#endregion
|
|
1496
1501
|
//#region src/components/masked-input/MaskedDateInput.tsx
|
|
1497
1502
|
var ge = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a, digitType: c = "persian", minDate: d, maxDate: f, isDateDisabled: p, clearable: m = !0, placeholder: h = "۱۴۰۵/۰۱/۱۵", disabled: g = !1, direction: _ = "rtl", wrapperClassName: v, wrapperStyle: y, clearButtonClassName: b, clearButtonStyle: x, style: S, ...C }) => {
|
|
1498
|
-
let { theme: w } =
|
|
1503
|
+
let { theme: w } = ae(), [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);
|
|
1499
1504
|
i(() => {
|
|
1500
|
-
e !== void 0 && (k(e ?
|
|
1505
|
+
e !== void 0 && (k(e ? V(e, "YYYY/MM/DD", { digitType: c }) : ""), j(!1));
|
|
1501
1506
|
}, [e, c]);
|
|
1502
|
-
let
|
|
1503
|
-
let n = t.target.value, i =
|
|
1507
|
+
let N = (t) => {
|
|
1508
|
+
let n = t.target.value, i = he(n, c);
|
|
1504
1509
|
if (k(i), i.length === 10 || i.length === 0) {
|
|
1505
|
-
let t =
|
|
1506
|
-
t.isValid ? (
|
|
1507
|
-
} else
|
|
1508
|
-
},
|
|
1509
|
-
k(""),
|
|
1510
|
+
let t = K(i, d, f, p);
|
|
1511
|
+
t.isValid ? (j(!1), a?.(null), e === void 0 && E(t.date), r?.(t.date)) : (j(!0), a?.(t.error));
|
|
1512
|
+
} else j(!1), a?.(null);
|
|
1513
|
+
}, P = n(() => {
|
|
1514
|
+
k(""), j(!1), a?.(null), e === void 0 && E(null), r?.(null), M.current?.focus();
|
|
1510
1515
|
}, [
|
|
1511
1516
|
e,
|
|
1512
1517
|
r,
|
|
@@ -1524,13 +1529,13 @@ var ge = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
|
|
|
1524
1529
|
...y
|
|
1525
1530
|
},
|
|
1526
1531
|
children: [/* @__PURE__ */ l("input", {
|
|
1527
|
-
ref:
|
|
1532
|
+
ref: M,
|
|
1528
1533
|
type: "text",
|
|
1529
1534
|
inputMode: "numeric",
|
|
1530
1535
|
disabled: g,
|
|
1531
1536
|
placeholder: c === "persian" ? h : "1405/01/15",
|
|
1532
1537
|
value: O,
|
|
1533
|
-
onChange:
|
|
1538
|
+
onChange: N,
|
|
1534
1539
|
style: {
|
|
1535
1540
|
width: "180px",
|
|
1536
1541
|
maxWidth: "100%",
|
|
@@ -1539,7 +1544,7 @@ var ge = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
|
|
|
1539
1544
|
padding: "8px 12px",
|
|
1540
1545
|
paddingInlineEnd: m && O ? "32px" : "12px",
|
|
1541
1546
|
borderRadius: w.radii.sm,
|
|
1542
|
-
border: `1px solid ${
|
|
1547
|
+
border: `1px solid ${A ? w.colors.holiday : w.colors.border}`,
|
|
1543
1548
|
backgroundColor: w.colors.background,
|
|
1544
1549
|
color: w.colors.textPrimary,
|
|
1545
1550
|
fontSize: "14px",
|
|
@@ -1554,7 +1559,7 @@ var ge = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
|
|
|
1554
1559
|
}), m && O && !g && /* @__PURE__ */ l("button", {
|
|
1555
1560
|
type: "button",
|
|
1556
1561
|
"aria-label": "پاک کردن",
|
|
1557
|
-
onClick:
|
|
1562
|
+
onClick: P,
|
|
1558
1563
|
className: b,
|
|
1559
1564
|
style: {
|
|
1560
1565
|
position: "absolute",
|
|
@@ -1582,7 +1587,7 @@ function _e(e, t) {
|
|
|
1582
1587
|
}
|
|
1583
1588
|
//#endregion
|
|
1584
1589
|
//#region src/holidays/iran-holidays.ts
|
|
1585
|
-
var
|
|
1590
|
+
var q = {
|
|
1586
1591
|
"0-1": "جشن نوروز / سال نو",
|
|
1587
1592
|
"0-2": "عید نوروز",
|
|
1588
1593
|
"0-3": "عید نوروز",
|
|
@@ -1594,7 +1599,7 @@ var ve = {
|
|
|
1594
1599
|
"10-22": "پیروزی انقلاب اسلامی",
|
|
1595
1600
|
"11-29": "روز ملی شدن صنعت نفت"
|
|
1596
1601
|
};
|
|
1597
|
-
function
|
|
1602
|
+
function ve(e) {
|
|
1598
1603
|
return y(e.year, e.month, e.day).getDay() === 5;
|
|
1599
1604
|
}
|
|
1600
1605
|
function ye(e, t) {
|
|
@@ -1607,11 +1612,11 @@ function ye(e, t) {
|
|
|
1607
1612
|
};
|
|
1608
1613
|
}
|
|
1609
1614
|
let n = `${e.month}-${e.day}`;
|
|
1610
|
-
return
|
|
1611
|
-
title:
|
|
1615
|
+
return q[n] ? {
|
|
1616
|
+
title: q[n],
|
|
1612
1617
|
type: "solar",
|
|
1613
1618
|
isOff: !0
|
|
1614
|
-
} :
|
|
1619
|
+
} : ve(e) ? {
|
|
1615
1620
|
title: "جمعه (تعطیل پایان هفته)",
|
|
1616
1621
|
type: "solar",
|
|
1617
1622
|
isOff: !0
|
|
@@ -1619,12 +1624,32 @@ function ye(e, t) {
|
|
|
1619
1624
|
}
|
|
1620
1625
|
//#endregion
|
|
1621
1626
|
//#region src/components/JalaliDatePicker.tsx
|
|
1622
|
-
function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDate: m, maxDate: h, isDateDisabled: g, firstDayOfWeek: _ = 0, variant: v = "popover", placeholder: y = "YYYY/MM/DD", digitType: b = "persian", className: S, style: E, classNames: D, styles: O, showFooter: k = !0, showStatusText:
|
|
1623
|
-
let
|
|
1627
|
+
function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDate: m, maxDate: h, isDateDisabled: g, firstDayOfWeek: _ = 0, variant: v = "popover", placeholder: y = "YYYY/MM/DD", digitType: b = "persian", className: S, style: E, classNames: D, styles: O, showFooter: k = !0, showStatusText: j = !0, allowClear: M = !0, enableTime: N = !1, timeValue: F, defaultTimeValue: L, onTimeChange: ee, minuteStep: ne = 1, hourStep: R = 1, showSeconds: B = !1, numberOfMonths: H = 1, useMaskedInput: re = !1, events: ie, showHolidays: oe = !1, customHolidays: U, zIndex: W = 9999 }) {
|
|
1628
|
+
let { theme: G, mode: he } = ae(), [K, q] = s(v === "inline"), [ve, be] = s(!1), xe = o(null), Se = o(null), [Ce, we] = s(null), J = v === "modal", Te = a(() => ({
|
|
1629
|
+
"--pdp-primary": G.colors.primary,
|
|
1630
|
+
"--pdp-primary-hover": G.colors.primaryHover,
|
|
1631
|
+
"--pdp-primary-text": G.colors.primaryText,
|
|
1632
|
+
"--pdp-surface-bg": G.colors.background,
|
|
1633
|
+
"--pdp-surface-subtle": G.colors.surface,
|
|
1634
|
+
"--pdp-surface-border": G.colors.border,
|
|
1635
|
+
"--pdp-hover-bg": G.colors.backgroundHover,
|
|
1636
|
+
"--pdp-text-primary": G.colors.textPrimary,
|
|
1637
|
+
"--pdp-text-secondary": G.colors.textSecondary,
|
|
1638
|
+
"--pdp-text-muted": G.colors.textSecondary,
|
|
1639
|
+
"--pdp-text-disabled": G.colors.textDisabled,
|
|
1640
|
+
"--pdp-disabled-bg": G.colors.surface,
|
|
1641
|
+
"--pdp-holiday-color": G.colors.holiday,
|
|
1642
|
+
"--pdp-holiday-bg": G.colors.holidayBackground,
|
|
1643
|
+
"--pdp-range-between-bg": G.colors.rangeBackground,
|
|
1644
|
+
"--pdp-today-border": G.colors.todayBorder,
|
|
1645
|
+
"--pdp-border-radius": G.radii.lg,
|
|
1646
|
+
"--pdp-shadow": G.shadows.lg,
|
|
1647
|
+
colorScheme: he
|
|
1648
|
+
}), [G, he]);
|
|
1624
1649
|
i(() => {
|
|
1625
|
-
v === "inline" &&
|
|
1650
|
+
v === "inline" && q(!0);
|
|
1626
1651
|
}, [v]);
|
|
1627
|
-
let
|
|
1652
|
+
let Ee = a(() => L || (t instanceof Date ? {
|
|
1628
1653
|
hour: t.getHours(),
|
|
1629
1654
|
minute: t.getMinutes(),
|
|
1630
1655
|
second: t.getSeconds()
|
|
@@ -1632,29 +1657,29 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1632
1657
|
hour: r.getHours(),
|
|
1633
1658
|
minute: r.getMinutes(),
|
|
1634
1659
|
second: r.getSeconds()
|
|
1635
|
-
} :
|
|
1636
|
-
|
|
1660
|
+
} : de()), [
|
|
1661
|
+
L,
|
|
1637
1662
|
t,
|
|
1638
1663
|
r
|
|
1639
|
-
]), [
|
|
1664
|
+
]), [De, Oe] = s(Ee), Y = F === void 0 ? De : F ?? de();
|
|
1640
1665
|
i(() => {
|
|
1641
|
-
if (v === "inline" || !
|
|
1666
|
+
if (v === "inline" || !K) return;
|
|
1642
1667
|
let e = (e) => {
|
|
1643
|
-
|
|
1668
|
+
xe.current && !xe.current.contains(e.target) && !Se.current?.contains(e.target) && (q(!1), be(!1));
|
|
1644
1669
|
};
|
|
1645
1670
|
return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), () => {
|
|
1646
1671
|
document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
|
|
1647
1672
|
};
|
|
1648
|
-
}, [v,
|
|
1649
|
-
if (v !== "popover" || !
|
|
1650
|
-
|
|
1673
|
+
}, [v, K]), i(() => {
|
|
1674
|
+
if (v !== "popover" || !K) {
|
|
1675
|
+
we(null);
|
|
1651
1676
|
return;
|
|
1652
1677
|
}
|
|
1653
1678
|
let e = () => {
|
|
1654
|
-
let e =
|
|
1679
|
+
let e = xe.current, t = Se.current;
|
|
1655
1680
|
if (!e || !t) return;
|
|
1656
1681
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = Math.max(0, window.innerHeight - n.bottom - 6 - 12), a = Math.max(0, n.top - 6 - 12), o = r.height > i && a > i, s = Math.max(120, o ? a : i), c = Math.min(r.height, s), l = o ? Math.max(12, n.top - 6 - c) : n.bottom + 6, u = Math.max(12, window.innerWidth - r.width - 12), d = Math.min(Math.max(12, n.left), u);
|
|
1657
|
-
|
|
1682
|
+
we((e) => e?.top === l && e.left === d && e.maxHeight === s ? e : {
|
|
1658
1683
|
top: l,
|
|
1659
1684
|
left: d,
|
|
1660
1685
|
maxHeight: s
|
|
@@ -1662,11 +1687,11 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1662
1687
|
};
|
|
1663
1688
|
e();
|
|
1664
1689
|
let t = typeof ResizeObserver > "u" ? null : new ResizeObserver(e);
|
|
1665
|
-
return
|
|
1690
|
+
return Se.current && t?.observe(Se.current), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
1666
1691
|
t?.disconnect(), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
1667
1692
|
};
|
|
1668
|
-
}, [v,
|
|
1669
|
-
let
|
|
1693
|
+
}, [v, K]);
|
|
1694
|
+
let ke = a(() => {
|
|
1670
1695
|
if (t !== void 0) {
|
|
1671
1696
|
if (!t) return null;
|
|
1672
1697
|
if (t instanceof Date) return w(t);
|
|
@@ -1679,7 +1704,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1679
1704
|
}
|
|
1680
1705
|
return null;
|
|
1681
1706
|
}
|
|
1682
|
-
}, [t, e]),
|
|
1707
|
+
}, [t, e]), Ae = a(() => {
|
|
1683
1708
|
if (r !== void 0) {
|
|
1684
1709
|
if (!r) return null;
|
|
1685
1710
|
if (r instanceof Date) return w(r);
|
|
@@ -1692,9 +1717,9 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1692
1717
|
}
|
|
1693
1718
|
return null;
|
|
1694
1719
|
}
|
|
1695
|
-
}, [r, e]),
|
|
1720
|
+
}, [r, e]), je = a(() => m ? w(m) : void 0, [m]), Me = a(() => h ? w(h) : void 0, [h]), Ne = n((e) => g ? g(T(e)) : !1, [g]), Pe = n((t, n) => {
|
|
1696
1721
|
if (!t) return null;
|
|
1697
|
-
let r = n ?? Y, i =
|
|
1722
|
+
let r = n ?? Y, i = N ? r.hour : 0, a = N ? r.minute : 0, o = N && B ? r.second ?? 0 : 0;
|
|
1698
1723
|
if (e === "single" && !Array.isArray(t)) return T(t, i, a, o);
|
|
1699
1724
|
if (e === "range" && Array.isArray(t)) {
|
|
1700
1725
|
let [e, n] = t;
|
|
@@ -1703,89 +1728,89 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1703
1728
|
return e === "multiple" && Array.isArray(t) ? t.map((e) => T(e, i, a, o)) : null;
|
|
1704
1729
|
}, [
|
|
1705
1730
|
e,
|
|
1706
|
-
|
|
1731
|
+
N,
|
|
1707
1732
|
Y,
|
|
1708
|
-
|
|
1709
|
-
]), { selected: X, viewYear: Z, viewMonth: Q, grid:
|
|
1733
|
+
B
|
|
1734
|
+
]), { selected: X, viewYear: Z, viewMonth: Q, grid: Fe, goToPrevMonth: Ie, goToNextMonth: Le, setView: Re, goToToday: ze, selectDate: Be, setHoverDate: Ve, hoverDate: He, clear: Ue } = I({
|
|
1710
1735
|
mode: e,
|
|
1711
|
-
value:
|
|
1712
|
-
defaultValue:
|
|
1713
|
-
minDate:
|
|
1714
|
-
maxDate:
|
|
1736
|
+
value: ke,
|
|
1737
|
+
defaultValue: Ae,
|
|
1738
|
+
minDate: je,
|
|
1739
|
+
maxDate: Me,
|
|
1715
1740
|
firstDayOfWeek: _,
|
|
1716
|
-
isDateDisabled: g ?
|
|
1741
|
+
isDateDisabled: g ? Ne : void 0,
|
|
1717
1742
|
onChange: (e) => {
|
|
1718
|
-
p?.(
|
|
1743
|
+
p?.(Pe(e));
|
|
1719
1744
|
}
|
|
1720
|
-
}),
|
|
1721
|
-
|
|
1745
|
+
}), We = n((e) => {
|
|
1746
|
+
F === void 0 && Oe(e), ee?.(e), X && p && p(Pe(X, e));
|
|
1722
1747
|
}, [
|
|
1723
|
-
|
|
1724
|
-
|
|
1748
|
+
F,
|
|
1749
|
+
ee,
|
|
1725
1750
|
X,
|
|
1726
1751
|
p,
|
|
1727
|
-
|
|
1728
|
-
]),
|
|
1729
|
-
|
|
1730
|
-
},
|
|
1731
|
-
e.stopPropagation(),
|
|
1732
|
-
}, { handleKeyDown:
|
|
1752
|
+
Pe
|
|
1753
|
+
]), Ge = e === "single" ? X : null, Ke = (t) => {
|
|
1754
|
+
Be(t), v === "popover" && e === "single" && !N && q(!1);
|
|
1755
|
+
}, qe = (e) => {
|
|
1756
|
+
e.stopPropagation(), Ue();
|
|
1757
|
+
}, { handleKeyDown: Je, getCellTabIndex: Ye, setFocusedDate: Xe } = te({
|
|
1733
1758
|
viewYear: Z,
|
|
1734
1759
|
viewMonth: Q,
|
|
1735
|
-
selectedDate:
|
|
1736
|
-
onSelectDate:
|
|
1737
|
-
onViewChange:
|
|
1760
|
+
selectedDate: Ge,
|
|
1761
|
+
onSelectDate: Ke,
|
|
1762
|
+
onViewChange: Re,
|
|
1738
1763
|
isRtl: !0
|
|
1739
1764
|
});
|
|
1740
1765
|
i(() => {
|
|
1741
|
-
if (!J || !
|
|
1766
|
+
if (!J || !K) return;
|
|
1742
1767
|
let e = document.body.style.overflow;
|
|
1743
1768
|
document.body.style.overflow = "hidden";
|
|
1744
1769
|
let t = (e) => {
|
|
1745
|
-
e.key === "Escape" &&
|
|
1770
|
+
e.key === "Escape" && q(!1);
|
|
1746
1771
|
};
|
|
1747
1772
|
return window.addEventListener("keydown", t), () => {
|
|
1748
1773
|
document.body.style.overflow = e, window.removeEventListener("keydown", t);
|
|
1749
1774
|
};
|
|
1750
|
-
}, [J,
|
|
1775
|
+
}, [J, K]);
|
|
1751
1776
|
let $ = a(() => Q === 11 ? {
|
|
1752
1777
|
year: Z + 1,
|
|
1753
1778
|
month: 0
|
|
1754
1779
|
} : {
|
|
1755
1780
|
year: Z,
|
|
1756
1781
|
month: Q + 1
|
|
1757
|
-
}, [Z, Q]),
|
|
1782
|
+
}, [Z, Q]), Ze = a(() => Q === 0 ? {
|
|
1758
1783
|
year: Z - 1,
|
|
1759
1784
|
month: 11
|
|
1760
1785
|
} : {
|
|
1761
1786
|
year: Z,
|
|
1762
1787
|
month: Q - 1
|
|
1763
|
-
}, [Z, Q]),
|
|
1764
|
-
minDate:
|
|
1765
|
-
maxDate:
|
|
1766
|
-
}),
|
|
1788
|
+
}, [Z, Q]), Qe = !P(Ze.year, Ze.month, {
|
|
1789
|
+
minDate: je,
|
|
1790
|
+
maxDate: Me
|
|
1791
|
+
}), $e = H === 2 ? $.month === 11 ? {
|
|
1767
1792
|
year: $.year + 1,
|
|
1768
1793
|
month: 0
|
|
1769
1794
|
} : {
|
|
1770
1795
|
year: $.year,
|
|
1771
1796
|
month: $.month + 1
|
|
1772
|
-
} : $,
|
|
1773
|
-
minDate:
|
|
1774
|
-
maxDate:
|
|
1775
|
-
}),
|
|
1776
|
-
if (
|
|
1797
|
+
} : $, et = !P($e.year, $e.month, {
|
|
1798
|
+
minDate: je,
|
|
1799
|
+
maxDate: Me
|
|
1800
|
+
}), tt = a(() => {
|
|
1801
|
+
if (H !== 2) return [];
|
|
1777
1802
|
let t = C({
|
|
1778
1803
|
year: $.year,
|
|
1779
1804
|
month: $.month,
|
|
1780
1805
|
firstDayOfWeek: _,
|
|
1781
|
-
minDate:
|
|
1782
|
-
maxDate:
|
|
1806
|
+
minDate: je,
|
|
1807
|
+
maxDate: Me
|
|
1783
1808
|
});
|
|
1784
1809
|
if (e !== "range") return t;
|
|
1785
|
-
let [n, r] = X || [null, null], i = r ?? (n &&
|
|
1810
|
+
let [n, r] = X || [null, null], i = r ?? (n && He ? He : null);
|
|
1786
1811
|
return t.map((e) => {
|
|
1787
1812
|
let t = n ? x(e.jalali, n) : !1, r = i ? x(e.jalali, i) : !1, a = !1;
|
|
1788
|
-
return n && i && (a =
|
|
1813
|
+
return n && i && (a = A(e.jalali, n, i)), {
|
|
1789
1814
|
...e,
|
|
1790
1815
|
isSelected: t || r,
|
|
1791
1816
|
isInRange: a,
|
|
@@ -1794,34 +1819,34 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1794
1819
|
};
|
|
1795
1820
|
});
|
|
1796
1821
|
}, [
|
|
1797
|
-
|
|
1822
|
+
H,
|
|
1798
1823
|
$,
|
|
1799
1824
|
_,
|
|
1800
|
-
|
|
1801
|
-
|
|
1825
|
+
je,
|
|
1826
|
+
Me,
|
|
1802
1827
|
e,
|
|
1803
1828
|
X,
|
|
1804
|
-
|
|
1805
|
-
]),
|
|
1829
|
+
He
|
|
1830
|
+
]), nt = a(() => {
|
|
1806
1831
|
if (!X) return "";
|
|
1807
1832
|
if (e === "single") {
|
|
1808
|
-
let e =
|
|
1809
|
-
return
|
|
1833
|
+
let e = V(X, "YYYY/MM/DD", { digitType: b });
|
|
1834
|
+
return N && Y ? `${e} ${fe(Y, B, b)}` : e;
|
|
1810
1835
|
}
|
|
1811
1836
|
if (e === "range") {
|
|
1812
1837
|
let [e, t] = X || [null, null];
|
|
1813
|
-
if (e && t) return `${
|
|
1814
|
-
if (e) return `${
|
|
1838
|
+
if (e && t) return `${V(e, "YYYY/MM/DD", { digitType: b })} - ${V(t, "YYYY/MM/DD", { digitType: b })}`;
|
|
1839
|
+
if (e) return `${V(e, "YYYY/MM/DD", { digitType: b })} - ...`;
|
|
1815
1840
|
}
|
|
1816
|
-
return e === "multiple" && Array.isArray(X) ? `${
|
|
1841
|
+
return e === "multiple" && Array.isArray(X) ? `${z(X.length)} تاریخ انتخاب شده` : "";
|
|
1817
1842
|
}, [
|
|
1818
1843
|
X,
|
|
1819
1844
|
e,
|
|
1820
1845
|
b,
|
|
1821
|
-
|
|
1846
|
+
N,
|
|
1822
1847
|
Y,
|
|
1823
|
-
|
|
1824
|
-
]),
|
|
1848
|
+
B
|
|
1849
|
+
]), rt = !!(e === "single" ? X : e === "range" ? X?.[0] : X?.length), it = (e, t, n, r = !0, i = !0) => /* @__PURE__ */ u("div", {
|
|
1825
1850
|
className: D?.calendarPane,
|
|
1826
1851
|
style: {
|
|
1827
1852
|
width: "calc(7 * var(--pdp-cell-size, 34px) + 6 * 4px)",
|
|
@@ -1831,26 +1856,26 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1831
1856
|
...O?.calendarPane
|
|
1832
1857
|
},
|
|
1833
1858
|
children: [
|
|
1834
|
-
/* @__PURE__ */ l(
|
|
1859
|
+
/* @__PURE__ */ l(se, {
|
|
1835
1860
|
year: e,
|
|
1836
1861
|
monthName: f[t],
|
|
1837
|
-
onPrevMonth: r ?
|
|
1838
|
-
onNextMonth: i ?
|
|
1839
|
-
onTitleClick: () =>
|
|
1840
|
-
isPickerOpen:
|
|
1841
|
-
isPrevDisabled: !r ||
|
|
1842
|
-
isNextDisabled: !i ||
|
|
1862
|
+
onPrevMonth: r ? Ie : () => {},
|
|
1863
|
+
onNextMonth: i ? Le : () => {},
|
|
1864
|
+
onTitleClick: () => be((e) => !e),
|
|
1865
|
+
isPickerOpen: ve,
|
|
1866
|
+
isPrevDisabled: !r || Qe,
|
|
1867
|
+
isNextDisabled: !i || et,
|
|
1843
1868
|
classNames: D,
|
|
1844
1869
|
styles: O
|
|
1845
1870
|
}),
|
|
1846
|
-
/* @__PURE__ */ l(
|
|
1871
|
+
/* @__PURE__ */ l(ce, {
|
|
1847
1872
|
firstDayOfWeek: _,
|
|
1848
1873
|
classNames: D,
|
|
1849
1874
|
styles: O
|
|
1850
1875
|
}),
|
|
1851
1876
|
/* @__PURE__ */ l("div", {
|
|
1852
1877
|
role: "grid",
|
|
1853
|
-
"aria-label": `${f[t]} ${
|
|
1878
|
+
"aria-label": `${f[t]} ${z(e)}`,
|
|
1854
1879
|
className: D?.grid,
|
|
1855
1880
|
style: {
|
|
1856
1881
|
display: "grid",
|
|
@@ -1861,36 +1886,38 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1861
1886
|
...O?.grid
|
|
1862
1887
|
},
|
|
1863
1888
|
children: n.map((e, t) => {
|
|
1864
|
-
let n =
|
|
1865
|
-
return /* @__PURE__ */ l(
|
|
1889
|
+
let n = oe ? ye(e.jalali, U) : null, r = _e(e.jalali, ie);
|
|
1890
|
+
return /* @__PURE__ */ l(le, {
|
|
1866
1891
|
cell: e,
|
|
1867
1892
|
digitType: b,
|
|
1868
1893
|
isHoliday: !!n,
|
|
1869
1894
|
holidayTitle: n?.title,
|
|
1870
1895
|
events: r,
|
|
1896
|
+
gridColumnIndex: t % 7,
|
|
1871
1897
|
classNames: D,
|
|
1872
1898
|
styles: O,
|
|
1873
|
-
tabIndex:
|
|
1874
|
-
onSelect:
|
|
1875
|
-
onHover:
|
|
1876
|
-
onFocus:
|
|
1899
|
+
tabIndex: Ye(e.jalali),
|
|
1900
|
+
onSelect: Ke,
|
|
1901
|
+
onHover: Ve,
|
|
1902
|
+
onFocus: Xe
|
|
1877
1903
|
}, t);
|
|
1878
1904
|
})
|
|
1879
1905
|
})
|
|
1880
1906
|
]
|
|
1881
|
-
}),
|
|
1882
|
-
ref:
|
|
1907
|
+
}), at = /* @__PURE__ */ l("div", {
|
|
1908
|
+
ref: Se,
|
|
1883
1909
|
role: J ? "dialog" : "region",
|
|
1884
1910
|
"aria-modal": J ? !0 : void 0,
|
|
1885
1911
|
"aria-label": "تقویم شمسی",
|
|
1886
|
-
onKeyDown:
|
|
1912
|
+
onKeyDown: Je,
|
|
1887
1913
|
onClick: (e) => e.stopPropagation(),
|
|
1888
1914
|
className: D?.calendar,
|
|
1889
1915
|
style: {
|
|
1916
|
+
...Te,
|
|
1890
1917
|
position: v === "popover" ? "fixed" : J ? "relative" : "static",
|
|
1891
|
-
top: v === "popover" ?
|
|
1892
|
-
left: v === "popover" ?
|
|
1893
|
-
visibility: v === "popover" && !
|
|
1918
|
+
top: v === "popover" ? Ce?.top ?? 0 : void 0,
|
|
1919
|
+
left: v === "popover" ? Ce?.left ?? 0 : void 0,
|
|
1920
|
+
visibility: v === "popover" && !Ce ? "hidden" : "visible",
|
|
1894
1921
|
zIndex: J ? W + 1 : W,
|
|
1895
1922
|
padding: "12px",
|
|
1896
1923
|
backgroundColor: "var(--pdp-surface-bg, #ffffff)",
|
|
@@ -1899,7 +1926,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1899
1926
|
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)",
|
|
1900
1927
|
width: "max-content",
|
|
1901
1928
|
maxWidth: v === "inline" ? "100%" : "calc(100vw - 24px)",
|
|
1902
|
-
maxHeight: J ? "calc(100dvh - 32px)" : v === "popover" ?
|
|
1929
|
+
maxHeight: J ? "calc(100dvh - 32px)" : v === "popover" ? Ce?.maxHeight : void 0,
|
|
1903
1930
|
overflowY: J || v === "popover" ? "auto" : void 0,
|
|
1904
1931
|
overflowX: "hidden",
|
|
1905
1932
|
userSelect: "none",
|
|
@@ -1910,16 +1937,16 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1910
1937
|
boxSizing: "border-box",
|
|
1911
1938
|
...O?.calendar
|
|
1912
1939
|
},
|
|
1913
|
-
children:
|
|
1940
|
+
children: ve ? /* @__PURE__ */ l(ue, {
|
|
1914
1941
|
currentYear: Z,
|
|
1915
1942
|
currentMonth: Q,
|
|
1916
1943
|
onSelectMonth: (e) => {
|
|
1917
|
-
|
|
1944
|
+
Re(Z, e), be(!1);
|
|
1918
1945
|
},
|
|
1919
|
-
onSelectYear: (e) =>
|
|
1920
|
-
minDate:
|
|
1921
|
-
maxDate:
|
|
1922
|
-
isDateDisabled: g ?
|
|
1946
|
+
onSelectYear: (e) => Re(e, Q),
|
|
1947
|
+
minDate: je,
|
|
1948
|
+
maxDate: Me,
|
|
1949
|
+
isDateDisabled: g ? Ne : void 0,
|
|
1923
1950
|
classNames: D,
|
|
1924
1951
|
styles: O
|
|
1925
1952
|
}) : /* @__PURE__ */ u(c, { children: [
|
|
@@ -1937,52 +1964,53 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1937
1964
|
boxSizing: "border-box",
|
|
1938
1965
|
...O?.calendarPanes
|
|
1939
1966
|
},
|
|
1940
|
-
children: [
|
|
1967
|
+
children: [it(Z, Q, Fe, !0, H === 1), H === 2 && /* @__PURE__ */ l(c, { children: it($.year, $.month, tt, !1, !0) })]
|
|
1941
1968
|
}),
|
|
1942
|
-
|
|
1969
|
+
N && /* @__PURE__ */ l(me, {
|
|
1943
1970
|
value: Y,
|
|
1944
|
-
onChange:
|
|
1945
|
-
minuteStep:
|
|
1946
|
-
hourStep:
|
|
1947
|
-
showSeconds:
|
|
1971
|
+
onChange: We,
|
|
1972
|
+
minuteStep: ne,
|
|
1973
|
+
hourStep: R,
|
|
1974
|
+
showSeconds: B,
|
|
1948
1975
|
digitType: b,
|
|
1949
1976
|
classNames: D,
|
|
1950
1977
|
styles: O
|
|
1951
1978
|
}),
|
|
1952
|
-
k && /* @__PURE__ */ l(
|
|
1979
|
+
k && /* @__PURE__ */ l(pe, {
|
|
1953
1980
|
mode: e,
|
|
1954
1981
|
digitType: b,
|
|
1955
|
-
showStatusText:
|
|
1982
|
+
showStatusText: j,
|
|
1956
1983
|
selectedDate: e === "single" ? X : null,
|
|
1957
1984
|
selectedRange: e === "range" ? X : void 0,
|
|
1958
1985
|
selectedDates: e === "multiple" ? X : void 0,
|
|
1959
|
-
selectedTime:
|
|
1960
|
-
onToday:
|
|
1986
|
+
selectedTime: N ? Y : void 0,
|
|
1987
|
+
onToday: ze,
|
|
1961
1988
|
classNames: D,
|
|
1962
1989
|
styles: O
|
|
1963
1990
|
})
|
|
1964
1991
|
] })
|
|
1965
1992
|
});
|
|
1966
1993
|
return /* @__PURE__ */ u("div", {
|
|
1967
|
-
ref:
|
|
1994
|
+
ref: xe,
|
|
1968
1995
|
className: S ?? D?.root,
|
|
1969
1996
|
style: {
|
|
1997
|
+
...Te,
|
|
1970
1998
|
position: "relative",
|
|
1971
1999
|
display: "inline-block",
|
|
1972
2000
|
maxWidth: "100%",
|
|
1973
2001
|
verticalAlign: "top",
|
|
1974
|
-
zIndex:
|
|
2002
|
+
zIndex: K && v === "popover" ? W : 1,
|
|
1975
2003
|
...E,
|
|
1976
2004
|
...O?.root
|
|
1977
2005
|
},
|
|
1978
|
-
children: [v !== "inline" && (
|
|
1979
|
-
value:
|
|
2006
|
+
children: [v !== "inline" && (re && e === "single" && v === "popover" ? /* @__PURE__ */ l(ge, {
|
|
2007
|
+
value: Ge,
|
|
1980
2008
|
digitType: b,
|
|
1981
2009
|
placeholder: y,
|
|
1982
2010
|
onChange: (e) => {
|
|
1983
|
-
e ? (
|
|
2011
|
+
e ? (Be(e), Re(e.year, e.month)) : Ue();
|
|
1984
2012
|
},
|
|
1985
|
-
onClick: () =>
|
|
2013
|
+
onClick: () => q(!0),
|
|
1986
2014
|
className: D?.input,
|
|
1987
2015
|
style: {
|
|
1988
2016
|
direction: "ltr",
|
|
@@ -1991,7 +2019,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1991
2019
|
}
|
|
1992
2020
|
}) : /* @__PURE__ */ u("div", {
|
|
1993
2021
|
onClick: (e) => {
|
|
1994
|
-
e.stopPropagation(),
|
|
2022
|
+
e.stopPropagation(), q((e) => !e);
|
|
1995
2023
|
},
|
|
1996
2024
|
style: {
|
|
1997
2025
|
position: "relative",
|
|
@@ -2006,7 +2034,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
2006
2034
|
type: "text",
|
|
2007
2035
|
readOnly: !0,
|
|
2008
2036
|
placeholder: y,
|
|
2009
|
-
value:
|
|
2037
|
+
value: nt,
|
|
2010
2038
|
className: D?.input,
|
|
2011
2039
|
style: {
|
|
2012
2040
|
direction: "ltr",
|
|
@@ -2018,15 +2046,15 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
2018
2046
|
color: "var(--pdp-text-primary, #0f172a)",
|
|
2019
2047
|
cursor: "pointer",
|
|
2020
2048
|
fontSize: "13.5px",
|
|
2021
|
-
minWidth:
|
|
2049
|
+
minWidth: N ? "190px" : "150px",
|
|
2022
2050
|
width: "100%",
|
|
2023
2051
|
maxWidth: "100%",
|
|
2024
2052
|
boxSizing: "border-box",
|
|
2025
2053
|
...O?.input
|
|
2026
2054
|
}
|
|
2027
|
-
}),
|
|
2055
|
+
}), M && rt && /* @__PURE__ */ l("button", {
|
|
2028
2056
|
type: "button",
|
|
2029
|
-
onClick:
|
|
2057
|
+
onClick: qe,
|
|
2030
2058
|
"aria-label": "Clear value",
|
|
2031
2059
|
style: {
|
|
2032
2060
|
position: "absolute",
|
|
@@ -2053,9 +2081,9 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
2053
2081
|
},
|
|
2054
2082
|
children: "✕"
|
|
2055
2083
|
})]
|
|
2056
|
-
})),
|
|
2084
|
+
})), K && (v === "inline" ? at : typeof document < "u" ? d(J ? /* @__PURE__ */ l("div", {
|
|
2057
2085
|
role: "presentation",
|
|
2058
|
-
onClick: () =>
|
|
2086
|
+
onClick: () => q(!1),
|
|
2059
2087
|
className: D?.modalBackdrop,
|
|
2060
2088
|
style: {
|
|
2061
2089
|
position: "fixed",
|
|
@@ -2075,67 +2103,67 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
2075
2103
|
direction: "rtl",
|
|
2076
2104
|
...O?.modalBackdrop
|
|
2077
2105
|
},
|
|
2078
|
-
children:
|
|
2079
|
-
}) :
|
|
2106
|
+
children: at
|
|
2107
|
+
}) : at, document.body) : null)]
|
|
2080
2108
|
});
|
|
2081
2109
|
}
|
|
2082
2110
|
//#endregion
|
|
2083
2111
|
//#region src/components/dual-calendar/DualMonthCalendar.tsx
|
|
2084
2112
|
var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDate: i, firstDayOfWeek: o = 0, digitType: c = "persian", minDate: d, maxDate: p, isDateDisabled: m, direction: h = "rtl", className: g, style: _, classNames: v, styles: y }) => {
|
|
2085
|
-
let { theme: w } =
|
|
2113
|
+
let { theme: w } = ae(), [T, E] = s(t), D = e === void 0 ? T : e, [O, j] = s(null), M = (e) => c === "persian" ? z(e) : String(e), N = a(() => b(), []), [F, I] = s(() => i || (D[0] ? {
|
|
2086
2114
|
year: D[0].year,
|
|
2087
2115
|
month: D[0].month
|
|
2088
2116
|
} : {
|
|
2089
|
-
year:
|
|
2090
|
-
month:
|
|
2091
|
-
})),
|
|
2092
|
-
year:
|
|
2117
|
+
year: N.year,
|
|
2118
|
+
month: N.month
|
|
2119
|
+
})), L = a(() => F.month === 11 ? {
|
|
2120
|
+
year: F.year + 1,
|
|
2093
2121
|
month: 0
|
|
2094
2122
|
} : {
|
|
2095
|
-
year:
|
|
2096
|
-
month:
|
|
2097
|
-
}, [
|
|
2098
|
-
year:
|
|
2123
|
+
year: F.year,
|
|
2124
|
+
month: F.month + 1
|
|
2125
|
+
}, [F]), ee = a(() => F.month === 0 ? {
|
|
2126
|
+
year: F.year - 1,
|
|
2099
2127
|
month: 11
|
|
2100
2128
|
} : {
|
|
2101
|
-
year:
|
|
2102
|
-
month:
|
|
2103
|
-
}, [
|
|
2104
|
-
minDate:
|
|
2105
|
-
maxDate:
|
|
2106
|
-
}),
|
|
2107
|
-
year:
|
|
2129
|
+
year: F.year,
|
|
2130
|
+
month: F.month - 1
|
|
2131
|
+
}, [F]), te = a(() => d ? S(d) : void 0, [d]), ne = a(() => p ? S(p) : void 0, [p]), R = !P(ee.year, ee.month, {
|
|
2132
|
+
minDate: te,
|
|
2133
|
+
maxDate: ne
|
|
2134
|
+
}), B = L.month === 11 ? {
|
|
2135
|
+
year: L.year + 1,
|
|
2108
2136
|
month: 0
|
|
2109
2137
|
} : {
|
|
2110
|
-
year:
|
|
2111
|
-
month:
|
|
2112
|
-
},
|
|
2113
|
-
minDate:
|
|
2114
|
-
maxDate:
|
|
2115
|
-
}),
|
|
2116
|
-
|
|
2138
|
+
year: L.year,
|
|
2139
|
+
month: L.month + 1
|
|
2140
|
+
}, V = !P(B.year, B.month, {
|
|
2141
|
+
minDate: te,
|
|
2142
|
+
maxDate: ne
|
|
2143
|
+
}), H = () => {
|
|
2144
|
+
R || I((e) => e.month === 0 ? {
|
|
2117
2145
|
year: e.year - 1,
|
|
2118
2146
|
month: 11
|
|
2119
2147
|
} : {
|
|
2120
2148
|
year: e.year,
|
|
2121
2149
|
month: e.month - 1
|
|
2122
2150
|
});
|
|
2123
|
-
},
|
|
2124
|
-
|
|
2151
|
+
}, re = () => {
|
|
2152
|
+
V || I((e) => e.month === 11 ? {
|
|
2125
2153
|
year: e.year + 1,
|
|
2126
2154
|
month: 0
|
|
2127
2155
|
} : {
|
|
2128
2156
|
year: e.year,
|
|
2129
2157
|
month: e.month + 1
|
|
2130
2158
|
});
|
|
2131
|
-
},
|
|
2159
|
+
}, ie = n((t) => {
|
|
2132
2160
|
let [n, i] = D, a;
|
|
2133
|
-
!n || n && i ? a = [t, null] : (a = k(t, n) < 0 ? [t, n] : [n, t],
|
|
2161
|
+
!n || n && i ? a = [t, null] : (a = k(t, n) < 0 ? [t, n] : [n, t], j(null)), e === void 0 && E(a), r?.(a);
|
|
2134
2162
|
}, [
|
|
2135
2163
|
D,
|
|
2136
2164
|
e,
|
|
2137
2165
|
r
|
|
2138
|
-
]),
|
|
2166
|
+
]), oe = n((e, t) => {
|
|
2139
2167
|
let n = C({
|
|
2140
2168
|
year: e,
|
|
2141
2169
|
month: t,
|
|
@@ -2146,7 +2174,7 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2146
2174
|
}), [r, i] = D, a = i ?? (r && O ? O : null);
|
|
2147
2175
|
return n.map((e) => {
|
|
2148
2176
|
let t = r ? x(e.jalali, r) : !1, n = a ? x(e.jalali, a) : !1, i = !1;
|
|
2149
|
-
return r && a && (i =
|
|
2177
|
+
return r && a && (i = A(e.jalali, r, a)), {
|
|
2150
2178
|
...e,
|
|
2151
2179
|
isSelected: t || n,
|
|
2152
2180
|
isInRange: i,
|
|
@@ -2161,15 +2189,15 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2161
2189
|
m,
|
|
2162
2190
|
D,
|
|
2163
2191
|
O
|
|
2164
|
-
]),
|
|
2165
|
-
|
|
2166
|
-
P.year,
|
|
2167
|
-
P.month
|
|
2168
|
-
]), le = a(() => U(F.year, F.month), [
|
|
2169
|
-
U,
|
|
2192
|
+
]), se = a(() => oe(F.year, F.month), [
|
|
2193
|
+
oe,
|
|
2170
2194
|
F.year,
|
|
2171
2195
|
F.month
|
|
2172
|
-
]),
|
|
2196
|
+
]), ue = a(() => oe(L.year, L.month), [
|
|
2197
|
+
oe,
|
|
2198
|
+
L.year,
|
|
2199
|
+
L.month
|
|
2200
|
+
]), W = (e, t, n, r) => /* @__PURE__ */ u("div", {
|
|
2173
2201
|
dir: h,
|
|
2174
2202
|
className: v?.calendarPane,
|
|
2175
2203
|
style: {
|
|
@@ -2197,10 +2225,10 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2197
2225
|
r ? /* @__PURE__ */ l("button", {
|
|
2198
2226
|
type: "button",
|
|
2199
2227
|
"aria-label": "ماه قبل",
|
|
2200
|
-
onClick:
|
|
2201
|
-
disabled:
|
|
2202
|
-
"aria-disabled":
|
|
2203
|
-
className:
|
|
2228
|
+
onClick: H,
|
|
2229
|
+
disabled: R,
|
|
2230
|
+
"aria-disabled": R,
|
|
2231
|
+
className: U(v?.navButton, R && v?.disabledNavButton),
|
|
2204
2232
|
style: {
|
|
2205
2233
|
width: "28px",
|
|
2206
2234
|
height: "28px",
|
|
@@ -2208,10 +2236,10 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2208
2236
|
border: `1px solid ${w.colors.border}`,
|
|
2209
2237
|
backgroundColor: w.colors.background,
|
|
2210
2238
|
color: w.colors.textPrimary,
|
|
2211
|
-
cursor:
|
|
2212
|
-
opacity:
|
|
2239
|
+
cursor: R ? "not-allowed" : "pointer",
|
|
2240
|
+
opacity: R ? .38 : 1,
|
|
2213
2241
|
...y?.navButton,
|
|
2214
|
-
...
|
|
2242
|
+
...R ? y?.disabledNavButton : void 0
|
|
2215
2243
|
},
|
|
2216
2244
|
children: h === "rtl" ? "›" : "‹"
|
|
2217
2245
|
}) : /* @__PURE__ */ l("div", { style: { width: "28px" } }),
|
|
@@ -2224,16 +2252,16 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2224
2252
|
children: [
|
|
2225
2253
|
f[t],
|
|
2226
2254
|
" ",
|
|
2227
|
-
|
|
2255
|
+
M(e)
|
|
2228
2256
|
]
|
|
2229
2257
|
}),
|
|
2230
2258
|
r ? /* @__PURE__ */ l("div", { style: { width: "28px" } }) : /* @__PURE__ */ l("button", {
|
|
2231
2259
|
type: "button",
|
|
2232
2260
|
"aria-label": "ماه بعد",
|
|
2233
|
-
onClick:
|
|
2234
|
-
disabled:
|
|
2235
|
-
"aria-disabled":
|
|
2236
|
-
className:
|
|
2261
|
+
onClick: re,
|
|
2262
|
+
disabled: V,
|
|
2263
|
+
"aria-disabled": V,
|
|
2264
|
+
className: U(v?.navButton, V && v?.disabledNavButton),
|
|
2237
2265
|
style: {
|
|
2238
2266
|
width: "28px",
|
|
2239
2267
|
height: "28px",
|
|
@@ -2241,23 +2269,23 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2241
2269
|
border: `1px solid ${w.colors.border}`,
|
|
2242
2270
|
backgroundColor: w.colors.background,
|
|
2243
2271
|
color: w.colors.textPrimary,
|
|
2244
|
-
cursor:
|
|
2245
|
-
opacity:
|
|
2272
|
+
cursor: V ? "not-allowed" : "pointer",
|
|
2273
|
+
opacity: V ? .38 : 1,
|
|
2246
2274
|
...y?.navButton,
|
|
2247
|
-
...
|
|
2275
|
+
...V ? y?.disabledNavButton : void 0
|
|
2248
2276
|
},
|
|
2249
2277
|
children: h === "rtl" ? "‹" : "›"
|
|
2250
2278
|
})
|
|
2251
2279
|
]
|
|
2252
2280
|
}),
|
|
2253
|
-
/* @__PURE__ */ l(
|
|
2281
|
+
/* @__PURE__ */ l(ce, {
|
|
2254
2282
|
firstDayOfWeek: o,
|
|
2255
2283
|
classNames: v,
|
|
2256
2284
|
styles: y
|
|
2257
2285
|
}),
|
|
2258
2286
|
/* @__PURE__ */ l("div", {
|
|
2259
2287
|
role: "grid",
|
|
2260
|
-
"aria-label": `${f[t]} ${
|
|
2288
|
+
"aria-label": `${f[t]} ${M(e)}`,
|
|
2261
2289
|
dir: h,
|
|
2262
2290
|
className: v?.grid,
|
|
2263
2291
|
style: {
|
|
@@ -2268,14 +2296,15 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2268
2296
|
gap: "var(--pdp-cell-gap, 4px)",
|
|
2269
2297
|
...y?.grid
|
|
2270
2298
|
},
|
|
2271
|
-
children: n.map((e) => /* @__PURE__ */ l(
|
|
2299
|
+
children: n.map((e, t) => /* @__PURE__ */ l(le, {
|
|
2272
2300
|
cell: e,
|
|
2273
2301
|
digitType: c,
|
|
2302
|
+
gridColumnIndex: t % 7,
|
|
2274
2303
|
classNames: v,
|
|
2275
2304
|
styles: y,
|
|
2276
2305
|
tabIndex: 0,
|
|
2277
|
-
onSelect:
|
|
2278
|
-
onHover:
|
|
2306
|
+
onSelect: ie,
|
|
2307
|
+
onHover: j
|
|
2279
2308
|
}, `${e.jalali.year}-${e.jalali.month}-${e.jalali.day}`))
|
|
2280
2309
|
})
|
|
2281
2310
|
]
|
|
@@ -2284,7 +2313,7 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2284
2313
|
role: "region",
|
|
2285
2314
|
"aria-label": "تقویم دوقلو شمسی",
|
|
2286
2315
|
dir: h,
|
|
2287
|
-
className:
|
|
2316
|
+
className: U(g, v?.calendar),
|
|
2288
2317
|
style: {
|
|
2289
2318
|
"--pdp-cell-size": "36px",
|
|
2290
2319
|
"--pdp-cell-gap": "4px",
|
|
@@ -2304,10 +2333,10 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2304
2333
|
..._,
|
|
2305
2334
|
...y?.calendar
|
|
2306
2335
|
},
|
|
2307
|
-
children: [
|
|
2336
|
+
children: [W(F.year, F.month, se, !0), W(L.year, L.month, ue, !1)]
|
|
2308
2337
|
});
|
|
2309
2338
|
};
|
|
2310
2339
|
//#endregion
|
|
2311
|
-
export {
|
|
2340
|
+
export { oe as DatePickerThemeProvider, le as DayCell, xe as DualMonthCalendar, se as Header, p as JALALI_MONTH_NAMES_EN, be as JalaliDatePicker, ge as MaskedDateInput, ue as MonthYearPicker, f as PERSIAN_MONTH_NAMES, h as PERSIAN_WEEK_DAYS_LONG, m as PERSIAN_WEEK_DAYS_SHORT, me as TimePicker, ce as Weekdays, D as addDaysToJalali, O as addJalaliDays, he as applyDateMask, L as calculateNextFocusedDate, G as clampTime, k as compareJalaliDates, re as darkTheme, V as formatJalaliDate, W as formatTimeSegment, fe as formatTimeString, C as generateJalaliCalendarGrid, ee as getAriaDayLabel, de as getCurrentTime, _ as getDaysInJalaliMonth, _e as getEventsForDate, E as getJalaliDayOfWeek, M as getJalaliMonthRange, j as getJalaliWeekRange, ye as getOfficialHoliday, b as getTodayJalali, v as gregorianToJalali, A as isJalaliDateBetween, N as isJalaliDateSelectable, ve as isJalaliFriday, g as isJalaliLeapYear, P as isJalaliMonthSelectable, F as isJalaliYearSelectable, x as isSameJalaliDay, y as jalaliToGregorian, T as jalaliToJsDate, w as jsDateToJalali, H as lightTheme, K as parseAndValidateJalaliString, S as toJalaliDate, B as toLatinDigits, z as toPersianDigits, te as useCalendarKeyboard, I as useJalaliDatePicker, ae as useTheme };
|
|
2312
2341
|
|
|
2313
2342
|
//# sourceMappingURL=index.mjs.map
|