@mngh/jalali-datepicker 1.2.2 → 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 +220 -213
- 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
578
|
}, oe = ({ children: e, mode: t = "light", customTheme: n }) => {
|
|
579
|
-
let r = t === "dark" ?
|
|
579
|
+
let r = t === "dark" ? re : H, i = a(() => n ? {
|
|
580
580
|
mode: t,
|
|
581
581
|
theme: {
|
|
582
582
|
...r,
|
|
@@ -603,7 +603,7 @@ 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
|
});
|
|
@@ -616,7 +616,7 @@ function U(...e) {
|
|
|
616
616
|
//#endregion
|
|
617
617
|
//#region src/components/Header.tsx
|
|
618
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 } =
|
|
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,
|
|
@@ -785,28 +785,28 @@ var se = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
785
785
|
}, e);
|
|
786
786
|
})
|
|
787
787
|
});
|
|
788
|
-
}, le = ({ cell: e, digitType: t = "persian", isHoliday: n = !1, holidayTitle: r, events: i = [],
|
|
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 se = ({ 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 se = ({ 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 se = ({ 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 se = ({ 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"
|
|
@@ -931,7 +936,7 @@ var se = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
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;
|
|
@@ -1052,7 +1057,7 @@ var se = ({ 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",
|
|
@@ -1160,7 +1165,7 @@ var se = ({ 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
|
})]
|
|
@@ -1170,7 +1175,7 @@ var se = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1170
1175
|
//#region src/plugins/time-picker/time-utils.ts
|
|
1171
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
1180
|
function de() {
|
|
1176
1181
|
let e = /* @__PURE__ */ new Date();
|
|
@@ -1195,19 +1200,19 @@ function fe(e, t = !1, n = "persian") {
|
|
|
1195
1200
|
//#endregion
|
|
1196
1201
|
//#region src/components/footer/CalendarFooter.tsx
|
|
1197
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 }) => {
|
|
1198
|
-
let { theme: _ } =
|
|
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",
|
|
@@ -1308,7 +1313,7 @@ var pe = ({ 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", {
|
|
@@ -1443,11 +1448,11 @@ var pe = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
|
|
|
1443
1448
|
//#endregion
|
|
1444
1449
|
//#region src/components/masked-input/mask-utils.ts
|
|
1445
1450
|
function he(e, t = "persian") {
|
|
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" ?
|
|
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
1454
|
function K(e, t, n, r) {
|
|
1450
|
-
let i =
|
|
1455
|
+
let i = B(e).trim();
|
|
1451
1456
|
if (!i) return {
|
|
1452
1457
|
isValid: !0,
|
|
1453
1458
|
date: null
|
|
@@ -1495,18 +1500,18 @@ function K(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
|
|
1507
|
+
let N = (t) => {
|
|
1503
1508
|
let n = t.target.value, i = he(n, c);
|
|
1504
1509
|
if (k(i), i.length === 10 || i.length === 0) {
|
|
1505
1510
|
let t = K(i, d, f, p);
|
|
1506
|
-
t.isValid ? (
|
|
1507
|
-
} else
|
|
1508
|
-
},
|
|
1509
|
-
k(""),
|
|
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",
|
|
@@ -1619,8 +1624,8 @@ 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 { theme: G, mode: he } =
|
|
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(() => ({
|
|
1624
1629
|
"--pdp-primary": G.colors.primary,
|
|
1625
1630
|
"--pdp-primary-hover": G.colors.primaryHover,
|
|
1626
1631
|
"--pdp-primary-text": G.colors.primaryText,
|
|
@@ -1644,7 +1649,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1644
1649
|
i(() => {
|
|
1645
1650
|
v === "inline" && q(!0);
|
|
1646
1651
|
}, [v]);
|
|
1647
|
-
let Ee = a(() =>
|
|
1652
|
+
let Ee = a(() => L || (t instanceof Date ? {
|
|
1648
1653
|
hour: t.getHours(),
|
|
1649
1654
|
minute: t.getMinutes(),
|
|
1650
1655
|
second: t.getSeconds()
|
|
@@ -1653,10 +1658,10 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1653
1658
|
minute: r.getMinutes(),
|
|
1654
1659
|
second: r.getSeconds()
|
|
1655
1660
|
} : de()), [
|
|
1656
|
-
|
|
1661
|
+
L,
|
|
1657
1662
|
t,
|
|
1658
1663
|
r
|
|
1659
|
-
]), [De, Oe] = s(Ee), Y =
|
|
1664
|
+
]), [De, Oe] = s(Ee), Y = F === void 0 ? De : F ?? de();
|
|
1660
1665
|
i(() => {
|
|
1661
1666
|
if (v === "inline" || !K) return;
|
|
1662
1667
|
let e = (e) => {
|
|
@@ -1714,7 +1719,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1714
1719
|
}
|
|
1715
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) => {
|
|
1716
1721
|
if (!t) return null;
|
|
1717
|
-
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;
|
|
1718
1723
|
if (e === "single" && !Array.isArray(t)) return T(t, i, a, o);
|
|
1719
1724
|
if (e === "range" && Array.isArray(t)) {
|
|
1720
1725
|
let [e, n] = t;
|
|
@@ -1723,10 +1728,10 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1723
1728
|
return e === "multiple" && Array.isArray(t) ? t.map((e) => T(e, i, a, o)) : null;
|
|
1724
1729
|
}, [
|
|
1725
1730
|
e,
|
|
1726
|
-
|
|
1731
|
+
N,
|
|
1727
1732
|
Y,
|
|
1728
|
-
|
|
1729
|
-
]), { selected: X, viewYear: Z, viewMonth: Q, grid: Fe, goToPrevMonth: Ie, goToNextMonth: Le, setView: Re, goToToday: ze, selectDate: Be, setHoverDate: Ve, hoverDate: He, clear: Ue } =
|
|
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({
|
|
1730
1735
|
mode: e,
|
|
1731
1736
|
value: ke,
|
|
1732
1737
|
defaultValue: Ae,
|
|
@@ -1738,18 +1743,18 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1738
1743
|
p?.(Pe(e));
|
|
1739
1744
|
}
|
|
1740
1745
|
}), We = n((e) => {
|
|
1741
|
-
|
|
1746
|
+
F === void 0 && Oe(e), ee?.(e), X && p && p(Pe(X, e));
|
|
1742
1747
|
}, [
|
|
1743
|
-
|
|
1744
|
-
|
|
1748
|
+
F,
|
|
1749
|
+
ee,
|
|
1745
1750
|
X,
|
|
1746
1751
|
p,
|
|
1747
1752
|
Pe
|
|
1748
1753
|
]), Ge = e === "single" ? X : null, Ke = (t) => {
|
|
1749
|
-
Be(t), v === "popover" && e === "single" && !
|
|
1754
|
+
Be(t), v === "popover" && e === "single" && !N && q(!1);
|
|
1750
1755
|
}, qe = (e) => {
|
|
1751
1756
|
e.stopPropagation(), Ue();
|
|
1752
|
-
}, { handleKeyDown: Je, getCellTabIndex: Ye, setFocusedDate: Xe } =
|
|
1757
|
+
}, { handleKeyDown: Je, getCellTabIndex: Ye, setFocusedDate: Xe } = te({
|
|
1753
1758
|
viewYear: Z,
|
|
1754
1759
|
viewMonth: Q,
|
|
1755
1760
|
selectedDate: Ge,
|
|
@@ -1780,20 +1785,20 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1780
1785
|
} : {
|
|
1781
1786
|
year: Z,
|
|
1782
1787
|
month: Q - 1
|
|
1783
|
-
}, [Z, Q]), Qe = !
|
|
1788
|
+
}, [Z, Q]), Qe = !P(Ze.year, Ze.month, {
|
|
1784
1789
|
minDate: je,
|
|
1785
1790
|
maxDate: Me
|
|
1786
|
-
}), $e =
|
|
1791
|
+
}), $e = H === 2 ? $.month === 11 ? {
|
|
1787
1792
|
year: $.year + 1,
|
|
1788
1793
|
month: 0
|
|
1789
1794
|
} : {
|
|
1790
1795
|
year: $.year,
|
|
1791
1796
|
month: $.month + 1
|
|
1792
|
-
} : $, et = !
|
|
1797
|
+
} : $, et = !P($e.year, $e.month, {
|
|
1793
1798
|
minDate: je,
|
|
1794
1799
|
maxDate: Me
|
|
1795
1800
|
}), tt = a(() => {
|
|
1796
|
-
if (
|
|
1801
|
+
if (H !== 2) return [];
|
|
1797
1802
|
let t = C({
|
|
1798
1803
|
year: $.year,
|
|
1799
1804
|
month: $.month,
|
|
@@ -1805,7 +1810,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1805
1810
|
let [n, r] = X || [null, null], i = r ?? (n && He ? He : null);
|
|
1806
1811
|
return t.map((e) => {
|
|
1807
1812
|
let t = n ? x(e.jalali, n) : !1, r = i ? x(e.jalali, i) : !1, a = !1;
|
|
1808
|
-
return n && i && (a =
|
|
1813
|
+
return n && i && (a = A(e.jalali, n, i)), {
|
|
1809
1814
|
...e,
|
|
1810
1815
|
isSelected: t || r,
|
|
1811
1816
|
isInRange: a,
|
|
@@ -1814,7 +1819,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1814
1819
|
};
|
|
1815
1820
|
});
|
|
1816
1821
|
}, [
|
|
1817
|
-
|
|
1822
|
+
H,
|
|
1818
1823
|
$,
|
|
1819
1824
|
_,
|
|
1820
1825
|
je,
|
|
@@ -1825,22 +1830,22 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1825
1830
|
]), nt = a(() => {
|
|
1826
1831
|
if (!X) return "";
|
|
1827
1832
|
if (e === "single") {
|
|
1828
|
-
let e =
|
|
1829
|
-
return
|
|
1833
|
+
let e = V(X, "YYYY/MM/DD", { digitType: b });
|
|
1834
|
+
return N && Y ? `${e} ${fe(Y, B, b)}` : e;
|
|
1830
1835
|
}
|
|
1831
1836
|
if (e === "range") {
|
|
1832
1837
|
let [e, t] = X || [null, null];
|
|
1833
|
-
if (e && t) return `${
|
|
1834
|
-
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 })} - ...`;
|
|
1835
1840
|
}
|
|
1836
|
-
return e === "multiple" && Array.isArray(X) ? `${
|
|
1841
|
+
return e === "multiple" && Array.isArray(X) ? `${z(X.length)} تاریخ انتخاب شده` : "";
|
|
1837
1842
|
}, [
|
|
1838
1843
|
X,
|
|
1839
1844
|
e,
|
|
1840
1845
|
b,
|
|
1841
|
-
|
|
1846
|
+
N,
|
|
1842
1847
|
Y,
|
|
1843
|
-
|
|
1848
|
+
B
|
|
1844
1849
|
]), rt = !!(e === "single" ? X : e === "range" ? X?.[0] : X?.length), it = (e, t, n, r = !0, i = !0) => /* @__PURE__ */ u("div", {
|
|
1845
1850
|
className: D?.calendarPane,
|
|
1846
1851
|
style: {
|
|
@@ -1870,7 +1875,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1870
1875
|
}),
|
|
1871
1876
|
/* @__PURE__ */ l("div", {
|
|
1872
1877
|
role: "grid",
|
|
1873
|
-
"aria-label": `${f[t]} ${
|
|
1878
|
+
"aria-label": `${f[t]} ${z(e)}`,
|
|
1874
1879
|
className: D?.grid,
|
|
1875
1880
|
style: {
|
|
1876
1881
|
display: "grid",
|
|
@@ -1881,13 +1886,14 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1881
1886
|
...O?.grid
|
|
1882
1887
|
},
|
|
1883
1888
|
children: n.map((e, t) => {
|
|
1884
|
-
let n = oe ? ye(e.jalali, U) : null, r = _e(e.jalali,
|
|
1889
|
+
let n = oe ? ye(e.jalali, U) : null, r = _e(e.jalali, ie);
|
|
1885
1890
|
return /* @__PURE__ */ l(le, {
|
|
1886
1891
|
cell: e,
|
|
1887
1892
|
digitType: b,
|
|
1888
1893
|
isHoliday: !!n,
|
|
1889
1894
|
holidayTitle: n?.title,
|
|
1890
1895
|
events: r,
|
|
1896
|
+
gridColumnIndex: t % 7,
|
|
1891
1897
|
classNames: D,
|
|
1892
1898
|
styles: O,
|
|
1893
1899
|
tabIndex: Ye(e.jalali),
|
|
@@ -1958,14 +1964,14 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1958
1964
|
boxSizing: "border-box",
|
|
1959
1965
|
...O?.calendarPanes
|
|
1960
1966
|
},
|
|
1961
|
-
children: [it(Z, Q, Fe, !0,
|
|
1967
|
+
children: [it(Z, Q, Fe, !0, H === 1), H === 2 && /* @__PURE__ */ l(c, { children: it($.year, $.month, tt, !1, !0) })]
|
|
1962
1968
|
}),
|
|
1963
|
-
|
|
1969
|
+
N && /* @__PURE__ */ l(me, {
|
|
1964
1970
|
value: Y,
|
|
1965
1971
|
onChange: We,
|
|
1966
|
-
minuteStep:
|
|
1967
|
-
hourStep:
|
|
1968
|
-
showSeconds:
|
|
1972
|
+
minuteStep: ne,
|
|
1973
|
+
hourStep: R,
|
|
1974
|
+
showSeconds: B,
|
|
1969
1975
|
digitType: b,
|
|
1970
1976
|
classNames: D,
|
|
1971
1977
|
styles: O
|
|
@@ -1973,11 +1979,11 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1973
1979
|
k && /* @__PURE__ */ l(pe, {
|
|
1974
1980
|
mode: e,
|
|
1975
1981
|
digitType: b,
|
|
1976
|
-
showStatusText:
|
|
1982
|
+
showStatusText: j,
|
|
1977
1983
|
selectedDate: e === "single" ? X : null,
|
|
1978
1984
|
selectedRange: e === "range" ? X : void 0,
|
|
1979
1985
|
selectedDates: e === "multiple" ? X : void 0,
|
|
1980
|
-
selectedTime:
|
|
1986
|
+
selectedTime: N ? Y : void 0,
|
|
1981
1987
|
onToday: ze,
|
|
1982
1988
|
classNames: D,
|
|
1983
1989
|
styles: O
|
|
@@ -1997,7 +2003,7 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
1997
2003
|
...E,
|
|
1998
2004
|
...O?.root
|
|
1999
2005
|
},
|
|
2000
|
-
children: [v !== "inline" && (
|
|
2006
|
+
children: [v !== "inline" && (re && e === "single" && v === "popover" ? /* @__PURE__ */ l(ge, {
|
|
2001
2007
|
value: Ge,
|
|
2002
2008
|
digitType: b,
|
|
2003
2009
|
placeholder: y,
|
|
@@ -2040,13 +2046,13 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
2040
2046
|
color: "var(--pdp-text-primary, #0f172a)",
|
|
2041
2047
|
cursor: "pointer",
|
|
2042
2048
|
fontSize: "13.5px",
|
|
2043
|
-
minWidth:
|
|
2049
|
+
minWidth: N ? "190px" : "150px",
|
|
2044
2050
|
width: "100%",
|
|
2045
2051
|
maxWidth: "100%",
|
|
2046
2052
|
boxSizing: "border-box",
|
|
2047
2053
|
...O?.input
|
|
2048
2054
|
}
|
|
2049
|
-
}),
|
|
2055
|
+
}), M && rt && /* @__PURE__ */ l("button", {
|
|
2050
2056
|
type: "button",
|
|
2051
2057
|
onClick: qe,
|
|
2052
2058
|
"aria-label": "Clear value",
|
|
@@ -2104,55 +2110,55 @@ function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDat
|
|
|
2104
2110
|
//#endregion
|
|
2105
2111
|
//#region src/components/dual-calendar/DualMonthCalendar.tsx
|
|
2106
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 }) => {
|
|
2107
|
-
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] ? {
|
|
2108
2114
|
year: D[0].year,
|
|
2109
2115
|
month: D[0].month
|
|
2110
2116
|
} : {
|
|
2111
|
-
year:
|
|
2112
|
-
month:
|
|
2113
|
-
})),
|
|
2114
|
-
year:
|
|
2117
|
+
year: N.year,
|
|
2118
|
+
month: N.month
|
|
2119
|
+
})), L = a(() => F.month === 11 ? {
|
|
2120
|
+
year: F.year + 1,
|
|
2115
2121
|
month: 0
|
|
2116
2122
|
} : {
|
|
2117
|
-
year:
|
|
2118
|
-
month:
|
|
2119
|
-
}, [
|
|
2120
|
-
year:
|
|
2123
|
+
year: F.year,
|
|
2124
|
+
month: F.month + 1
|
|
2125
|
+
}, [F]), ee = a(() => F.month === 0 ? {
|
|
2126
|
+
year: F.year - 1,
|
|
2121
2127
|
month: 11
|
|
2122
2128
|
} : {
|
|
2123
|
-
year:
|
|
2124
|
-
month:
|
|
2125
|
-
}, [
|
|
2126
|
-
minDate:
|
|
2127
|
-
maxDate:
|
|
2128
|
-
}),
|
|
2129
|
-
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,
|
|
2130
2136
|
month: 0
|
|
2131
2137
|
} : {
|
|
2132
|
-
year:
|
|
2133
|
-
month:
|
|
2134
|
-
},
|
|
2135
|
-
minDate:
|
|
2136
|
-
maxDate:
|
|
2137
|
-
}),
|
|
2138
|
-
|
|
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 ? {
|
|
2139
2145
|
year: e.year - 1,
|
|
2140
2146
|
month: 11
|
|
2141
2147
|
} : {
|
|
2142
2148
|
year: e.year,
|
|
2143
2149
|
month: e.month - 1
|
|
2144
2150
|
});
|
|
2145
|
-
},
|
|
2146
|
-
|
|
2151
|
+
}, re = () => {
|
|
2152
|
+
V || I((e) => e.month === 11 ? {
|
|
2147
2153
|
year: e.year + 1,
|
|
2148
2154
|
month: 0
|
|
2149
2155
|
} : {
|
|
2150
2156
|
year: e.year,
|
|
2151
2157
|
month: e.month + 1
|
|
2152
2158
|
});
|
|
2153
|
-
},
|
|
2159
|
+
}, ie = n((t) => {
|
|
2154
2160
|
let [n, i] = D, a;
|
|
2155
|
-
!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);
|
|
2156
2162
|
}, [
|
|
2157
2163
|
D,
|
|
2158
2164
|
e,
|
|
@@ -2168,7 +2174,7 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2168
2174
|
}), [r, i] = D, a = i ?? (r && O ? O : null);
|
|
2169
2175
|
return n.map((e) => {
|
|
2170
2176
|
let t = r ? x(e.jalali, r) : !1, n = a ? x(e.jalali, a) : !1, i = !1;
|
|
2171
|
-
return r && a && (i =
|
|
2177
|
+
return r && a && (i = A(e.jalali, r, a)), {
|
|
2172
2178
|
...e,
|
|
2173
2179
|
isSelected: t || n,
|
|
2174
2180
|
isInRange: i,
|
|
@@ -2183,14 +2189,14 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2183
2189
|
m,
|
|
2184
2190
|
D,
|
|
2185
2191
|
O
|
|
2186
|
-
]), se = a(() => oe(
|
|
2187
|
-
oe,
|
|
2188
|
-
P.year,
|
|
2189
|
-
P.month
|
|
2190
|
-
]), ue = a(() => oe(F.year, F.month), [
|
|
2192
|
+
]), se = a(() => oe(F.year, F.month), [
|
|
2191
2193
|
oe,
|
|
2192
2194
|
F.year,
|
|
2193
2195
|
F.month
|
|
2196
|
+
]), ue = a(() => oe(L.year, L.month), [
|
|
2197
|
+
oe,
|
|
2198
|
+
L.year,
|
|
2199
|
+
L.month
|
|
2194
2200
|
]), W = (e, t, n, r) => /* @__PURE__ */ u("div", {
|
|
2195
2201
|
dir: h,
|
|
2196
2202
|
className: v?.calendarPane,
|
|
@@ -2219,10 +2225,10 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2219
2225
|
r ? /* @__PURE__ */ l("button", {
|
|
2220
2226
|
type: "button",
|
|
2221
2227
|
"aria-label": "ماه قبل",
|
|
2222
|
-
onClick:
|
|
2223
|
-
disabled:
|
|
2224
|
-
"aria-disabled":
|
|
2225
|
-
className: U(v?.navButton,
|
|
2228
|
+
onClick: H,
|
|
2229
|
+
disabled: R,
|
|
2230
|
+
"aria-disabled": R,
|
|
2231
|
+
className: U(v?.navButton, R && v?.disabledNavButton),
|
|
2226
2232
|
style: {
|
|
2227
2233
|
width: "28px",
|
|
2228
2234
|
height: "28px",
|
|
@@ -2230,10 +2236,10 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2230
2236
|
border: `1px solid ${w.colors.border}`,
|
|
2231
2237
|
backgroundColor: w.colors.background,
|
|
2232
2238
|
color: w.colors.textPrimary,
|
|
2233
|
-
cursor:
|
|
2234
|
-
opacity:
|
|
2239
|
+
cursor: R ? "not-allowed" : "pointer",
|
|
2240
|
+
opacity: R ? .38 : 1,
|
|
2235
2241
|
...y?.navButton,
|
|
2236
|
-
...
|
|
2242
|
+
...R ? y?.disabledNavButton : void 0
|
|
2237
2243
|
},
|
|
2238
2244
|
children: h === "rtl" ? "›" : "‹"
|
|
2239
2245
|
}) : /* @__PURE__ */ l("div", { style: { width: "28px" } }),
|
|
@@ -2246,16 +2252,16 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2246
2252
|
children: [
|
|
2247
2253
|
f[t],
|
|
2248
2254
|
" ",
|
|
2249
|
-
|
|
2255
|
+
M(e)
|
|
2250
2256
|
]
|
|
2251
2257
|
}),
|
|
2252
2258
|
r ? /* @__PURE__ */ l("div", { style: { width: "28px" } }) : /* @__PURE__ */ l("button", {
|
|
2253
2259
|
type: "button",
|
|
2254
2260
|
"aria-label": "ماه بعد",
|
|
2255
|
-
onClick:
|
|
2256
|
-
disabled:
|
|
2257
|
-
"aria-disabled":
|
|
2258
|
-
className: U(v?.navButton,
|
|
2261
|
+
onClick: re,
|
|
2262
|
+
disabled: V,
|
|
2263
|
+
"aria-disabled": V,
|
|
2264
|
+
className: U(v?.navButton, V && v?.disabledNavButton),
|
|
2259
2265
|
style: {
|
|
2260
2266
|
width: "28px",
|
|
2261
2267
|
height: "28px",
|
|
@@ -2263,10 +2269,10 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2263
2269
|
border: `1px solid ${w.colors.border}`,
|
|
2264
2270
|
backgroundColor: w.colors.background,
|
|
2265
2271
|
color: w.colors.textPrimary,
|
|
2266
|
-
cursor:
|
|
2267
|
-
opacity:
|
|
2272
|
+
cursor: V ? "not-allowed" : "pointer",
|
|
2273
|
+
opacity: V ? .38 : 1,
|
|
2268
2274
|
...y?.navButton,
|
|
2269
|
-
...
|
|
2275
|
+
...V ? y?.disabledNavButton : void 0
|
|
2270
2276
|
},
|
|
2271
2277
|
children: h === "rtl" ? "‹" : "›"
|
|
2272
2278
|
})
|
|
@@ -2279,7 +2285,7 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2279
2285
|
}),
|
|
2280
2286
|
/* @__PURE__ */ l("div", {
|
|
2281
2287
|
role: "grid",
|
|
2282
|
-
"aria-label": `${f[t]} ${
|
|
2288
|
+
"aria-label": `${f[t]} ${M(e)}`,
|
|
2283
2289
|
dir: h,
|
|
2284
2290
|
className: v?.grid,
|
|
2285
2291
|
style: {
|
|
@@ -2290,14 +2296,15 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2290
2296
|
gap: "var(--pdp-cell-gap, 4px)",
|
|
2291
2297
|
...y?.grid
|
|
2292
2298
|
},
|
|
2293
|
-
children: n.map((e) => /* @__PURE__ */ l(le, {
|
|
2299
|
+
children: n.map((e, t) => /* @__PURE__ */ l(le, {
|
|
2294
2300
|
cell: e,
|
|
2295
2301
|
digitType: c,
|
|
2302
|
+
gridColumnIndex: t % 7,
|
|
2296
2303
|
classNames: v,
|
|
2297
2304
|
styles: y,
|
|
2298
2305
|
tabIndex: 0,
|
|
2299
|
-
onSelect:
|
|
2300
|
-
onHover:
|
|
2306
|
+
onSelect: ie,
|
|
2307
|
+
onHover: j
|
|
2301
2308
|
}, `${e.jalali.year}-${e.jalali.month}-${e.jalali.day}`))
|
|
2302
2309
|
})
|
|
2303
2310
|
]
|
|
@@ -2326,10 +2333,10 @@ var xe = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2326
2333
|
..._,
|
|
2327
2334
|
...y?.calendar
|
|
2328
2335
|
},
|
|
2329
|
-
children: [W(
|
|
2336
|
+
children: [W(F.year, F.month, se, !0), W(L.year, L.month, ue, !1)]
|
|
2330
2337
|
});
|
|
2331
2338
|
};
|
|
2332
2339
|
//#endregion
|
|
2333
|
-
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,
|
|
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 };
|
|
2334
2341
|
|
|
2335
2342
|
//# sourceMappingURL=index.mjs.map
|