@mngh/jalali-datepicker 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/JalaliDatePicker.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +467 -422
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
2
|
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { createPortal as d } from "react-dom";
|
|
3
4
|
//#region src/core/constants.ts
|
|
4
|
-
var
|
|
5
|
+
var f = [
|
|
5
6
|
"فروردین",
|
|
6
7
|
"اردیبهشت",
|
|
7
8
|
"خرداد",
|
|
@@ -14,7 +15,7 @@ var d = [
|
|
|
14
15
|
"دی",
|
|
15
16
|
"بهمن",
|
|
16
17
|
"اسفند"
|
|
17
|
-
],
|
|
18
|
+
], p = [
|
|
18
19
|
"Farvardin",
|
|
19
20
|
"Ordibehesht",
|
|
20
21
|
"Khordad",
|
|
@@ -27,7 +28,7 @@ var d = [
|
|
|
27
28
|
"Dey",
|
|
28
29
|
"Bahman",
|
|
29
30
|
"Esfand"
|
|
30
|
-
],
|
|
31
|
+
], m = [
|
|
31
32
|
"ش",
|
|
32
33
|
"ی",
|
|
33
34
|
"د",
|
|
@@ -35,7 +36,7 @@ var d = [
|
|
|
35
36
|
"چ",
|
|
36
37
|
"پ",
|
|
37
38
|
"ج"
|
|
38
|
-
],
|
|
39
|
+
], h = [
|
|
39
40
|
"شنبه",
|
|
40
41
|
"یکشنبه",
|
|
41
42
|
"دوشنبه",
|
|
@@ -46,7 +47,7 @@ var d = [
|
|
|
46
47
|
];
|
|
47
48
|
//#endregion
|
|
48
49
|
//#region src/core/jalali-math.ts
|
|
49
|
-
function
|
|
50
|
+
function g(e) {
|
|
50
51
|
let t = [
|
|
51
52
|
-61,
|
|
52
53
|
9,
|
|
@@ -80,11 +81,11 @@ function h(e) {
|
|
|
80
81
|
let a = (i + 1) % 33 - 1;
|
|
81
82
|
return a === -1 && (a = 4), a % 4 == 0;
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
+
function _(e, t) {
|
|
84
85
|
if (t < 0 || t > 11) throw RangeError("Month index must be between 0 (Farvardin) and 11 (Esfand).");
|
|
85
|
-
return t <= 5 ? 31 : t <= 10 ||
|
|
86
|
+
return t <= 5 ? 31 : t <= 10 || g(e) ? 30 : 29;
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function v(e, t, n) {
|
|
88
89
|
let r = [
|
|
89
90
|
0,
|
|
90
91
|
31,
|
|
@@ -107,7 +108,7 @@ function _(e, t, n) {
|
|
|
107
108
|
day: o
|
|
108
109
|
};
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
+
function y(e, t, n) {
|
|
111
112
|
let r, i, a, o = e + 1595, s = -355668 + 365 * o + Math.floor(o / 33) * 8 + Math.floor((o % 33 + 3) / 4) + n + (t < 6 ? t * 31 : (t - 6) * 30 + 186);
|
|
112
113
|
r = 400 * Math.floor(s / 146097), s %= 146097, s > 36524 && (r += 100 * Math.floor(--s / 36524), s %= 36524, s >= 365 && s++), r += 4 * Math.floor(s / 1461), s %= 1461, s > 365 && (r += Math.floor((s - 1) / 365), s = (s - 1) % 365), a = s + 1;
|
|
113
114
|
let c = [
|
|
@@ -129,30 +130,30 @@ function v(e, t, n) {
|
|
|
129
130
|
let l = new Date(r, i - 1, a);
|
|
130
131
|
return l.setHours(0, 0, 0, 0), l;
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function b() {
|
|
133
134
|
let e = /* @__PURE__ */ new Date();
|
|
134
|
-
return
|
|
135
|
+
return v(e.getFullYear(), e.getMonth() + 1, e.getDate());
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
+
function x(e, t) {
|
|
137
138
|
return !e || !t ? !1 : e.year === t.year && e.month === t.month && e.day === t.day;
|
|
138
139
|
}
|
|
139
140
|
//#endregion
|
|
140
141
|
//#region src/core/calendar-grid.ts
|
|
141
|
-
function x(e) {
|
|
142
|
-
return e instanceof Date ? _(e.getFullYear(), e.getMonth() + 1, e.getDate()) : e;
|
|
143
|
-
}
|
|
144
142
|
function S(e) {
|
|
145
|
-
|
|
143
|
+
return e instanceof Date ? v(e.getFullYear(), e.getMonth() + 1, e.getDate()) : e;
|
|
144
|
+
}
|
|
145
|
+
function C(e) {
|
|
146
|
+
let { year: t, month: n, firstDayOfWeek: r = 0, selectedDate: i, minDate: a, maxDate: o, isDateDisabled: s } = e, c = [], l = b(), u = i ? S(i) : null, d = a ? S(a) : null, f = o ? S(o) : null, p = ((y(t, n, 1).getDay() + 1) % 7 - r + 7) % 7, m = n === 0 ? 11 : n - 1, h = n === 0 ? t - 1 : t, g = _(h, m);
|
|
146
147
|
for (let e = p - 1; e >= 0; e--) {
|
|
147
148
|
let t = {
|
|
148
149
|
year: h,
|
|
149
150
|
month: m,
|
|
150
|
-
day:
|
|
151
|
+
day: g - e
|
|
151
152
|
};
|
|
152
153
|
c.push(E(t, !1));
|
|
153
154
|
}
|
|
154
|
-
let
|
|
155
|
-
for (let e = 1; e <=
|
|
155
|
+
let v = _(t, n);
|
|
156
|
+
for (let e = 1; e <= v; e++) {
|
|
156
157
|
let r = {
|
|
157
158
|
year: t,
|
|
158
159
|
month: n,
|
|
@@ -170,13 +171,13 @@ function S(e) {
|
|
|
170
171
|
c.push(E(t, !1));
|
|
171
172
|
}
|
|
172
173
|
function E(e, t) {
|
|
173
|
-
let n =
|
|
174
|
+
let n = y(e.year, e.month, e.day), r = x(e, l), i = u ? x(e, u) : !1, a = !1;
|
|
174
175
|
if (d) {
|
|
175
|
-
let e =
|
|
176
|
+
let e = y(d.year, d.month, d.day);
|
|
176
177
|
n.getTime() < e.getTime() && (a = !0);
|
|
177
178
|
}
|
|
178
179
|
if (f) {
|
|
179
|
-
let e =
|
|
180
|
+
let e = y(f.year, f.month, f.day);
|
|
180
181
|
n.getTime() > e.getTime() && (a = !0);
|
|
181
182
|
}
|
|
182
183
|
return s && s(e, n) && (a = !0), {
|
|
@@ -193,34 +194,34 @@ function S(e) {
|
|
|
193
194
|
}
|
|
194
195
|
//#endregion
|
|
195
196
|
//#region src/core/jalali-helpers.ts
|
|
196
|
-
function
|
|
197
|
-
return
|
|
197
|
+
function w(e) {
|
|
198
|
+
return v(e.getFullYear(), e.getMonth() + 1, e.getDate());
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
-
let i =
|
|
200
|
+
function T(e, t = 0, n = 0, r = 0) {
|
|
201
|
+
let i = y(e.year, e.month, e.day);
|
|
201
202
|
return i.setHours(t, n, r, 0), i;
|
|
202
203
|
}
|
|
203
|
-
function
|
|
204
|
-
return (
|
|
204
|
+
function E(e, t, n) {
|
|
205
|
+
return (y(e, t, n).getDay() + 1) % 7;
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
-
let n =
|
|
208
|
-
return n.setDate(n.getDate() + t),
|
|
207
|
+
function D(e, t) {
|
|
208
|
+
let n = y(e.year, e.month, e.day);
|
|
209
|
+
return n.setDate(n.getDate() + t), v(n.getFullYear(), n.getMonth() + 1, n.getDate());
|
|
209
210
|
}
|
|
210
|
-
var
|
|
211
|
-
function
|
|
211
|
+
var O = D;
|
|
212
|
+
function k(e, t) {
|
|
212
213
|
return e.year === t.year ? e.month === t.month ? e.day === t.day ? 0 : e.day < t.day ? -1 : 1 : e.month < t.month ? -1 : 1 : e.year < t.year ? -1 : 1;
|
|
213
214
|
}
|
|
214
|
-
function
|
|
215
|
-
let i =
|
|
215
|
+
function ee(e, t, n, r = !0) {
|
|
216
|
+
let i = k(t, n) <= 0 ? t : n, a = k(t, n) <= 0 ? n : t, o = k(e, i), s = k(e, a);
|
|
216
217
|
return r ? o >= 0 && s <= 0 : o > 0 && s < 0;
|
|
217
218
|
}
|
|
218
219
|
function A(e) {
|
|
219
|
-
let t =
|
|
220
|
-
return [t,
|
|
220
|
+
let t = D(e, -E(e.year, e.month, e.day));
|
|
221
|
+
return [t, D(t, 6)];
|
|
221
222
|
}
|
|
222
223
|
function j(e) {
|
|
223
|
-
let t =
|
|
224
|
+
let t = _(e.year, e.month);
|
|
224
225
|
return [{
|
|
225
226
|
year: e.year,
|
|
226
227
|
month: e.month,
|
|
@@ -235,7 +236,7 @@ function j(e) {
|
|
|
235
236
|
//#region src/core/date-availability.ts
|
|
236
237
|
function M(e, t = {}) {
|
|
237
238
|
let { minDate: n, maxDate: r, isDateDisabled: i } = t;
|
|
238
|
-
return n &&
|
|
239
|
+
return n && k(e, n) < 0 || r && k(e, r) > 0 ? !1 : !i?.(e);
|
|
239
240
|
}
|
|
240
241
|
function N(e, t, n = {}) {
|
|
241
242
|
let r = {
|
|
@@ -245,9 +246,9 @@ function N(e, t, n = {}) {
|
|
|
245
246
|
}, i = {
|
|
246
247
|
year: e,
|
|
247
248
|
month: t,
|
|
248
|
-
day:
|
|
249
|
+
day: _(e, t)
|
|
249
250
|
};
|
|
250
|
-
if (n.minDate &&
|
|
251
|
+
if (n.minDate && k(i, n.minDate) < 0 || n.maxDate && k(r, n.maxDate) > 0) return !1;
|
|
251
252
|
if (!n.isDateDisabled) return !0;
|
|
252
253
|
for (let r = 1; r <= i.day; r += 1) if (M({
|
|
253
254
|
year: e,
|
|
@@ -262,8 +263,8 @@ function P(e, t = {}) {
|
|
|
262
263
|
}
|
|
263
264
|
//#endregion
|
|
264
265
|
//#region src/hooks/useJalaliDatePicker.ts
|
|
265
|
-
function
|
|
266
|
-
let { mode: t = "single", value: r, defaultValue: i, initialViewDate: o, onChange: c, minDate: l, maxDate: u, isDateDisabled: d, firstDayOfWeek: f = 0 } = e, p = a(() =>
|
|
266
|
+
function te(e = {}) {
|
|
267
|
+
let { mode: t = "single", value: r, defaultValue: i, initialViewDate: o, onChange: c, minDate: l, maxDate: u, isDateDisabled: d, firstDayOfWeek: f = 0 } = e, p = a(() => b(), []), [m, h] = s(() => i === void 0 ? t === "single" ? null : t === "range" ? [null, null] : [] : i), g = r === void 0 ? m : r, [_, v] = s(() => o ? o.year : i && !Array.isArray(i) ? i.year : p.year), [y, S] = s(() => o ? o.month : i && !Array.isArray(i) ? i.month : p.month), [w, T] = s(null), E = n((e) => M(e, {
|
|
267
268
|
minDate: l,
|
|
268
269
|
maxDate: u,
|
|
269
270
|
isDateDisabled: d
|
|
@@ -272,15 +273,15 @@ function F(e = {}) {
|
|
|
272
273
|
u,
|
|
273
274
|
d
|
|
274
275
|
]), D = n((e, t) => {
|
|
275
|
-
v(e),
|
|
276
|
+
v(e), S(t);
|
|
276
277
|
}, []), O = n(() => {
|
|
277
|
-
|
|
278
|
-
}, [
|
|
279
|
-
|
|
280
|
-
}, [
|
|
281
|
-
let e =
|
|
282
|
-
v(e.year),
|
|
283
|
-
}, []),
|
|
278
|
+
y === 0 ? (v((e) => e - 1), S(11)) : S((e) => e - 1);
|
|
279
|
+
}, [y]), k = n(() => {
|
|
280
|
+
y === 11 ? (v((e) => e + 1), S(0)) : S((e) => e + 1);
|
|
281
|
+
}, [y]), A = n(() => {
|
|
282
|
+
let e = b();
|
|
283
|
+
v(e.year), S(e.month);
|
|
284
|
+
}, []), j = n((e) => {
|
|
284
285
|
if (!E(e)) return;
|
|
285
286
|
let n;
|
|
286
287
|
if (t === "single") n = e;
|
|
@@ -289,7 +290,7 @@ function F(e = {}) {
|
|
|
289
290
|
n = !t || t && r ? [e, null] : e.year < t.year || e.year === t.year && e.month < t.month || e.year === t.year && e.month === t.month && e.day < t.day ? [e, t] : [t, e];
|
|
290
291
|
} else {
|
|
291
292
|
let t = g || [];
|
|
292
|
-
n = t.some((t) =>
|
|
293
|
+
n = t.some((t) => x(t, e)) ? t.filter((t) => !x(t, e)) : [...t, e];
|
|
293
294
|
}
|
|
294
295
|
r === void 0 && h(n), c?.(n);
|
|
295
296
|
}, [
|
|
@@ -298,14 +299,14 @@ function F(e = {}) {
|
|
|
298
299
|
r,
|
|
299
300
|
c,
|
|
300
301
|
E
|
|
301
|
-
]),
|
|
302
|
-
if (t === "single") return
|
|
302
|
+
]), N = n((e) => {
|
|
303
|
+
if (t === "single") return x(g, e);
|
|
303
304
|
if (t === "range") {
|
|
304
305
|
let [t, n] = g || [null, null];
|
|
305
|
-
return !!(t &&
|
|
306
|
+
return !!(t && x(t, e) || n && x(n, e));
|
|
306
307
|
}
|
|
307
|
-
return (g || []).some((t) =>
|
|
308
|
-
}, [t, g]),
|
|
308
|
+
return (g || []).some((t) => x(t, e));
|
|
309
|
+
}, [t, g]), P = n(() => {
|
|
309
310
|
let e = t === "single" ? null : t === "range" ? [null, null] : [];
|
|
310
311
|
r === void 0 && h(e), c?.(e);
|
|
311
312
|
}, [
|
|
@@ -316,11 +317,11 @@ function F(e = {}) {
|
|
|
316
317
|
return {
|
|
317
318
|
selected: g,
|
|
318
319
|
viewYear: _,
|
|
319
|
-
viewMonth:
|
|
320
|
+
viewMonth: y,
|
|
320
321
|
grid: a(() => {
|
|
321
|
-
let e =
|
|
322
|
+
let e = C({
|
|
322
323
|
year: _,
|
|
323
|
-
month:
|
|
324
|
+
month: y,
|
|
324
325
|
firstDayOfWeek: f,
|
|
325
326
|
minDate: l,
|
|
326
327
|
maxDate: u,
|
|
@@ -330,14 +331,14 @@ function F(e = {}) {
|
|
|
330
331
|
let t = g;
|
|
331
332
|
return e.map((e) => ({
|
|
332
333
|
...e,
|
|
333
|
-
isSelected: t ?
|
|
334
|
+
isSelected: t ? x(e.jalali, t) : !1
|
|
334
335
|
}));
|
|
335
336
|
}
|
|
336
337
|
if (t === "range") {
|
|
337
338
|
let [t, n] = g || [null, null], r = n ?? (t && w ? w : null);
|
|
338
339
|
return e.map((e) => {
|
|
339
|
-
let n = t ?
|
|
340
|
-
return t && r && (a =
|
|
340
|
+
let n = t ? x(e.jalali, t) : !1, i = r ? x(e.jalali, r) : !1, a = !1;
|
|
341
|
+
return t && r && (a = ee(e.jalali, t, r)), {
|
|
341
342
|
...e,
|
|
342
343
|
isSelected: n || i,
|
|
343
344
|
isInRange: a,
|
|
@@ -350,13 +351,13 @@ function F(e = {}) {
|
|
|
350
351
|
let t = g || [];
|
|
351
352
|
return e.map((e) => ({
|
|
352
353
|
...e,
|
|
353
|
-
isSelected: t.some((t) =>
|
|
354
|
+
isSelected: t.some((t) => x(t, e.jalali))
|
|
354
355
|
}));
|
|
355
356
|
}
|
|
356
357
|
return e;
|
|
357
358
|
}, [
|
|
358
359
|
_,
|
|
359
|
-
|
|
360
|
+
y,
|
|
360
361
|
f,
|
|
361
362
|
l,
|
|
362
363
|
u,
|
|
@@ -366,19 +367,19 @@ function F(e = {}) {
|
|
|
366
367
|
w
|
|
367
368
|
]),
|
|
368
369
|
goToPrevMonth: O,
|
|
369
|
-
goToNextMonth:
|
|
370
|
-
goToToday:
|
|
370
|
+
goToNextMonth: k,
|
|
371
|
+
goToToday: A,
|
|
371
372
|
setView: D,
|
|
372
|
-
selectDate:
|
|
373
|
-
isDateSelected:
|
|
373
|
+
selectDate: j,
|
|
374
|
+
isDateSelected: N,
|
|
374
375
|
setHoverDate: T,
|
|
375
376
|
hoverDate: w,
|
|
376
|
-
clear:
|
|
377
|
+
clear: P
|
|
377
378
|
};
|
|
378
379
|
}
|
|
379
380
|
//#endregion
|
|
380
381
|
//#region src/a11y/keyboard-navigation.ts
|
|
381
|
-
function
|
|
382
|
+
function F(e) {
|
|
382
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;
|
|
383
384
|
switch (n) {
|
|
384
385
|
case "ArrowRight":
|
|
@@ -397,7 +398,7 @@ function I(e) {
|
|
|
397
398
|
o = 1;
|
|
398
399
|
break;
|
|
399
400
|
case "End":
|
|
400
|
-
o =
|
|
401
|
+
o = _(i, a);
|
|
401
402
|
break;
|
|
402
403
|
case "PageUp":
|
|
403
404
|
a === 0 ? (--i, a = 11) : --a, s = !0;
|
|
@@ -411,8 +412,8 @@ function I(e) {
|
|
|
411
412
|
handled: !1
|
|
412
413
|
};
|
|
413
414
|
}
|
|
414
|
-
for (; o < 1;) a === 0 ? (--i, a = 11) : --a, o +=
|
|
415
|
-
for (; o >
|
|
415
|
+
for (; o < 1;) a === 0 ? (--i, a = 11) : --a, o += _(i, a), s = !0;
|
|
416
|
+
for (; o > _(i, a);) o -= _(i, a), a === 11 ? (i += 1, a = 0) : a += 1, s = !0;
|
|
416
417
|
return {
|
|
417
418
|
nextDate: {
|
|
418
419
|
year: i,
|
|
@@ -425,13 +426,13 @@ function I(e) {
|
|
|
425
426
|
}
|
|
426
427
|
//#endregion
|
|
427
428
|
//#region src/a11y/aria-helpers.ts
|
|
428
|
-
function
|
|
429
|
-
let t =
|
|
429
|
+
function I(e) {
|
|
430
|
+
let t = h[(y(e.year, e.month, e.day).getDay() + 1) % 7], n = f[e.month];
|
|
430
431
|
return `${t}، ${e.day} ${n} ${e.year}`;
|
|
431
432
|
}
|
|
432
433
|
//#endregion
|
|
433
434
|
//#region src/a11y/useCalendarKeyboard.ts
|
|
434
|
-
function
|
|
435
|
+
function ne(e) {
|
|
435
436
|
let { viewYear: t, viewMonth: r, selectedDate: i, onSelectDate: a, onViewChange: o, isRtl: c = !0 } = e, [l, u] = s(() => i ?? {
|
|
436
437
|
year: t,
|
|
437
438
|
month: r,
|
|
@@ -445,7 +446,7 @@ function R(e) {
|
|
|
445
446
|
e.preventDefault(), a(l);
|
|
446
447
|
return;
|
|
447
448
|
}
|
|
448
|
-
let t =
|
|
449
|
+
let t = F({
|
|
449
450
|
currentFocused: l,
|
|
450
451
|
key: e.key,
|
|
451
452
|
isRtl: c
|
|
@@ -457,12 +458,12 @@ function R(e) {
|
|
|
457
458
|
a,
|
|
458
459
|
o
|
|
459
460
|
]),
|
|
460
|
-
getCellTabIndex: n((e) =>
|
|
461
|
+
getCellTabIndex: n((e) => x(e, l) ? 0 : -1, [l])
|
|
461
462
|
};
|
|
462
463
|
}
|
|
463
464
|
//#endregion
|
|
464
465
|
//#region src/formatters/persian-digits.ts
|
|
465
|
-
var
|
|
466
|
+
var re = [
|
|
466
467
|
"۰",
|
|
467
468
|
"۱",
|
|
468
469
|
"۲",
|
|
@@ -473,7 +474,7 @@ var ee = [
|
|
|
473
474
|
"۷",
|
|
474
475
|
"۸",
|
|
475
476
|
"۹"
|
|
476
|
-
],
|
|
477
|
+
], L = {
|
|
477
478
|
"۰": "0",
|
|
478
479
|
"۱": "1",
|
|
479
480
|
"۲": "2",
|
|
@@ -495,22 +496,22 @@ var ee = [
|
|
|
495
496
|
"٨": "8",
|
|
496
497
|
"٩": "9"
|
|
497
498
|
};
|
|
498
|
-
function
|
|
499
|
-
return String(e).replace(/[0-9]/g, (e) =>
|
|
499
|
+
function R(e) {
|
|
500
|
+
return String(e).replace(/[0-9]/g, (e) => re[+e]);
|
|
500
501
|
}
|
|
501
|
-
function
|
|
502
|
-
return e.replace(/[۰-۹٠-٩]/g, (e) =>
|
|
502
|
+
function z(e) {
|
|
503
|
+
return e.replace(/[۰-۹٠-٩]/g, (e) => L[e] ?? e);
|
|
503
504
|
}
|
|
504
505
|
//#endregion
|
|
505
506
|
//#region src/formatters/jalali-formatter.ts
|
|
506
|
-
function
|
|
507
|
+
function B(e, t = "YYYY/MM/DD", n = {}) {
|
|
507
508
|
if (!e) return "";
|
|
508
|
-
let { digitType: r = "persian" } = n, i = (
|
|
509
|
-
return r === "persian" && (p = p.replace(/\d+/g, (e) =>
|
|
509
|
+
let { digitType: r = "persian" } = n, i = (y(e.year, e.month, e.day).getDay() + 1) % 7, a = String(e.year), o = a.slice(-2), s = e.month + 1, c = s < 10 ? `0${s}` : String(s), l = f[e.month], u = e.day < 10 ? `0${e.day}` : String(e.day), d = h[i], p = t.replace(/\bYYYY\b/g, a).replace(/\bYY\b/g, o).replace(/\bMMMM\b/g, l).replace(/\bMM\b/g, c).replace(/\bM\b/g, String(s)).replace(/\bdddd\b/g, d).replace(/\bDD\b/g, u).replace(/\bD\b/g, String(e.day));
|
|
510
|
+
return r === "persian" && (p = p.replace(/\d+/g, (e) => R(e))), p;
|
|
510
511
|
}
|
|
511
512
|
//#endregion
|
|
512
513
|
//#region src/theme/tokens.ts
|
|
513
|
-
var
|
|
514
|
+
var V = {
|
|
514
515
|
mode: "light",
|
|
515
516
|
colors: {
|
|
516
517
|
primary: "#4f46e5",
|
|
@@ -539,7 +540,7 @@ var H = {
|
|
|
539
540
|
md: "0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04)",
|
|
540
541
|
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05)"
|
|
541
542
|
}
|
|
542
|
-
},
|
|
543
|
+
}, ie = {
|
|
543
544
|
mode: "dark",
|
|
544
545
|
colors: {
|
|
545
546
|
primary: "#6366f1",
|
|
@@ -568,14 +569,14 @@ var H = {
|
|
|
568
569
|
md: "0 4px 6px -1px rgba(0, 0, 0, 0.4)",
|
|
569
570
|
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.5)"
|
|
570
571
|
}
|
|
571
|
-
},
|
|
572
|
-
theme:
|
|
572
|
+
}, ae = t({
|
|
573
|
+
theme: V,
|
|
573
574
|
mode: "light"
|
|
574
|
-
}),
|
|
575
|
-
theme:
|
|
575
|
+
}), H = () => r(ae) || {
|
|
576
|
+
theme: V,
|
|
576
577
|
mode: "light"
|
|
577
|
-
},
|
|
578
|
-
let r = t === "dark" ?
|
|
578
|
+
}, oe = ({ children: e, mode: t = "light", customTheme: n }) => {
|
|
579
|
+
let r = t === "dark" ? ie : V, i = a(() => n ? {
|
|
579
580
|
mode: t,
|
|
580
581
|
theme: {
|
|
581
582
|
...r,
|
|
@@ -602,20 +603,20 @@ var H = {
|
|
|
602
603
|
n,
|
|
603
604
|
t
|
|
604
605
|
]);
|
|
605
|
-
return /* @__PURE__ */ l(
|
|
606
|
+
return /* @__PURE__ */ l(ae.Provider, {
|
|
606
607
|
value: i,
|
|
607
608
|
children: e
|
|
608
609
|
});
|
|
609
610
|
};
|
|
610
611
|
//#endregion
|
|
611
612
|
//#region src/theme/style-utils.ts
|
|
612
|
-
function
|
|
613
|
+
function U(...e) {
|
|
613
614
|
return e.filter(Boolean).join(" ") || void 0;
|
|
614
615
|
}
|
|
615
616
|
//#endregion
|
|
616
617
|
//#region src/components/Header.tsx
|
|
617
|
-
var
|
|
618
|
-
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 } = H(), [g, _] = s(null), v = o === "persian" ? R(e) : String(e), y = (e, t) => ({
|
|
619
620
|
width: "32px",
|
|
620
621
|
height: "32px",
|
|
621
622
|
padding: 0,
|
|
@@ -653,7 +654,7 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
653
654
|
disabled: d,
|
|
654
655
|
"aria-disabled": d,
|
|
655
656
|
"aria-label": "ماه قبل",
|
|
656
|
-
className:
|
|
657
|
+
className: U(p?.navButton, d && p?.disabledNavButton),
|
|
657
658
|
style: y("prev", d),
|
|
658
659
|
onMouseEnter: () => _("prev"),
|
|
659
660
|
onMouseLeave: () => _(null),
|
|
@@ -723,7 +724,7 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
723
724
|
disabled: f,
|
|
724
725
|
"aria-disabled": f,
|
|
725
726
|
"aria-label": "ماه بعد",
|
|
726
|
-
className:
|
|
727
|
+
className: U(p?.navButton, f && p?.disabledNavButton),
|
|
727
728
|
style: y("next", f),
|
|
728
729
|
onMouseEnter: () => _("next"),
|
|
729
730
|
onMouseLeave: () => _(null),
|
|
@@ -743,9 +744,9 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
743
744
|
})
|
|
744
745
|
]
|
|
745
746
|
});
|
|
746
|
-
},
|
|
747
|
+
}, ce = ({ firstDayOfWeek: t = 0, classNames: n, styles: r }) => {
|
|
747
748
|
let i = e.useMemo(() => {
|
|
748
|
-
let e = [...
|
|
749
|
+
let e = [...m];
|
|
749
750
|
return [...e.slice(t), ...e.slice(0, t)];
|
|
750
751
|
}, [t]);
|
|
751
752
|
return /* @__PURE__ */ l("div", {
|
|
@@ -784,18 +785,18 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
784
785
|
}, e);
|
|
785
786
|
})
|
|
786
787
|
});
|
|
787
|
-
},
|
|
788
|
-
let [m, h] = s(!1), [g, _] = s(!1), { jalali: v, dayNumber: y, isCurrentMonth: b, isToday: x, isSelected: S, isDisabled: C, isInRange: w, isRangeStart: T, isRangeEnd: E } = e, D = t === "persian" ?
|
|
788
|
+
}, le = ({ cell: e, digitType: t = "persian", isHoliday: n = !1, holidayTitle: r, events: i = [], tabIndex: a = -1, classNames: o, styles: c, onSelect: d, onHover: f, onFocus: p }) => {
|
|
789
|
+
let [m, h] = s(!1), [g, _] = s(!1), { jalali: v, dayNumber: y, isCurrentMonth: b, isToday: x, isSelected: S, isDisabled: C, isInRange: w, isRangeStart: T, isRangeEnd: E } = e, D = t === "persian" ? R(y) : z(y.toString()), O = !C && b, k = (e) => {
|
|
789
790
|
e.stopPropagation(), O && d(v);
|
|
790
|
-
},
|
|
791
|
+
}, ee = () => {
|
|
791
792
|
h(!0), O && f && f(v);
|
|
792
|
-
},
|
|
793
|
+
}, A = () => {
|
|
793
794
|
h(!1), _(!1), f && f(null);
|
|
794
|
-
},
|
|
795
|
+
}, j = () => {
|
|
795
796
|
O && p && p(v);
|
|
796
|
-
},
|
|
797
|
-
S ||
|
|
798
|
-
let
|
|
797
|
+
}, M = "transparent", N = b ? "var(--pdp-text-primary, #0f172a)" : "var(--pdp-text-disabled, #cbd5e1)", P = T || E;
|
|
798
|
+
S || P ? (M = "var(--pdp-primary, #4f46e5)", N = "#ffffff") : w ? M = "var(--pdp-range-between-bg, rgba(79, 70, 229, 0.12))" : m && O && (M = "var(--pdp-hover-bg, #f1f5f9)"), n && b && !C && !S && !P && (N = "var(--pdp-holiday-color, #e11d48)"), C && (M = "var(--pdp-disabled-bg, #f1f5f9)", N = "var(--pdp-text-disabled, #94a3b8)");
|
|
799
|
+
let te = U(o?.dayCell, x && o?.todayCell, S && o?.selectedCell, w && o?.rangeBetweenCell, T && o?.rangeStartCell, E && o?.rangeEndCell, C && o?.disabledCell, !b && o?.outsideMonthCell, n && o?.holidayCell), F = {
|
|
799
800
|
...x ? c?.todayCell : void 0,
|
|
800
801
|
...S ? c?.selectedCell : void 0,
|
|
801
802
|
...w ? c?.rangeBetweenCell : void 0,
|
|
@@ -804,8 +805,8 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
804
805
|
...b ? void 0 : c?.outsideMonthCell,
|
|
805
806
|
...n ? c?.holidayCell : void 0,
|
|
806
807
|
...C ? c?.disabledCell : void 0
|
|
807
|
-
},
|
|
808
|
-
return O && (g ?
|
|
808
|
+
}, I = "scale(1)";
|
|
809
|
+
return O && (g ? I = "scale(0.92)" : m && !w && (I = "scale(1.08)")), /* @__PURE__ */ u("div", {
|
|
809
810
|
style: {
|
|
810
811
|
position: "relative",
|
|
811
812
|
display: "flex",
|
|
@@ -818,8 +819,8 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
818
819
|
padding: 0,
|
|
819
820
|
boxSizing: "border-box"
|
|
820
821
|
},
|
|
821
|
-
onMouseEnter:
|
|
822
|
-
onMouseLeave:
|
|
822
|
+
onMouseEnter: ee,
|
|
823
|
+
onMouseLeave: A,
|
|
823
824
|
children: [/* @__PURE__ */ u("button", {
|
|
824
825
|
type: "button",
|
|
825
826
|
role: "gridcell",
|
|
@@ -829,10 +830,10 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
829
830
|
"aria-selected": S,
|
|
830
831
|
"aria-label": `${v.year}/${v.month + 1}/${v.day}${r ? ` - ${r}` : ""}`,
|
|
831
832
|
onClick: k,
|
|
832
|
-
onFocus:
|
|
833
|
+
onFocus: j,
|
|
833
834
|
onMouseDown: () => O && _(!0),
|
|
834
835
|
onMouseUp: () => O && _(!1),
|
|
835
|
-
className:
|
|
836
|
+
className: te,
|
|
836
837
|
style: {
|
|
837
838
|
width: "100%",
|
|
838
839
|
height: "100%",
|
|
@@ -842,8 +843,8 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
842
843
|
justifyContent: "center",
|
|
843
844
|
borderRadius: T ? "0 8px 8px 0" : E ? "8px 0 0 8px" : w ? "0" : "8px",
|
|
844
845
|
border: x && !S ? "1px solid var(--pdp-primary, #4f46e5)" : "none",
|
|
845
|
-
backgroundColor:
|
|
846
|
-
color:
|
|
846
|
+
backgroundColor: M,
|
|
847
|
+
color: N,
|
|
847
848
|
cursor: C ? "not-allowed" : O ? "pointer" : "default",
|
|
848
849
|
fontSize: "13px",
|
|
849
850
|
fontWeight: S || x ? 700 : 500,
|
|
@@ -852,14 +853,14 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
852
853
|
padding: 0,
|
|
853
854
|
margin: 0,
|
|
854
855
|
boxSizing: "border-box",
|
|
855
|
-
transform:
|
|
856
|
+
transform: I,
|
|
856
857
|
boxShadow: m && O && !w && !S ? "0 2px 6px rgba(0, 0, 0, 0.08)" : "none",
|
|
857
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",
|
|
858
859
|
zIndex: m && O ? 2 : 1,
|
|
859
860
|
opacity: C ? .42 : b ? 1 : .55,
|
|
860
861
|
filter: C ? "grayscale(0.65)" : void 0,
|
|
861
862
|
...c?.dayCell,
|
|
862
|
-
...
|
|
863
|
+
...F
|
|
863
864
|
},
|
|
864
865
|
children: [/* @__PURE__ */ l("span", { children: D }), i.length > 0 && /* @__PURE__ */ l("div", {
|
|
865
866
|
style: {
|
|
@@ -925,7 +926,7 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
925
926
|
]
|
|
926
927
|
})]
|
|
927
928
|
});
|
|
928
|
-
},
|
|
929
|
+
}, ue = ({ currentYear: e, currentMonth: t, onSelectMonth: n, onSelectYear: r, minDate: i, maxDate: a, isDateDisabled: o, classNames: c, styles: d }) => {
|
|
929
930
|
let [p, m] = s("months"), [h, g] = s(() => Math.floor(e / 10) * 10), [_, v] = s(e), y = Array.from({ length: 12 }, (e, t) => h - 1 + t), b = {
|
|
930
931
|
minDate: i,
|
|
931
932
|
maxDate: a,
|
|
@@ -984,7 +985,7 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
984
985
|
boxSizing: "border-box",
|
|
985
986
|
justifyContent: "space-between",
|
|
986
987
|
userSelect: "none",
|
|
987
|
-
...
|
|
988
|
+
...d?.calendar
|
|
988
989
|
},
|
|
989
990
|
children: [/* @__PURE__ */ u("div", {
|
|
990
991
|
style: {
|
|
@@ -1001,12 +1002,12 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1001
1002
|
disabled: C,
|
|
1002
1003
|
"aria-disabled": C,
|
|
1003
1004
|
"aria-label": "Previous",
|
|
1004
|
-
className:
|
|
1005
|
+
className: U(c?.navButton, C && c?.disabledNavButton),
|
|
1005
1006
|
style: {
|
|
1006
1007
|
...D,
|
|
1007
1008
|
cursor: C ? "not-allowed" : "pointer",
|
|
1008
1009
|
opacity: C ? .38 : 1,
|
|
1009
|
-
...C ?
|
|
1010
|
+
...C ? d?.disabledNavButton : void 0
|
|
1010
1011
|
},
|
|
1011
1012
|
onMouseEnter: (e) => {
|
|
1012
1013
|
e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)";
|
|
@@ -1051,7 +1052,7 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1051
1052
|
onMouseLeave: (e) => {
|
|
1052
1053
|
p === "months" && (e.currentTarget.style.backgroundColor = "var(--pdp-surface-subtle, #f1f5f9)", e.currentTarget.style.borderColor = "var(--pdp-surface-border, #e2e8f0)");
|
|
1053
1054
|
},
|
|
1054
|
-
children: [/* @__PURE__ */ l("span", { children: p === "months" ?
|
|
1055
|
+
children: [/* @__PURE__ */ l("span", { children: p === "months" ? R(_) : `${R(h)} - ${R(h + 9)}` }), p === "months" && /* @__PURE__ */ l("svg", {
|
|
1055
1056
|
width: "13",
|
|
1056
1057
|
height: "13",
|
|
1057
1058
|
viewBox: "0 0 24 24",
|
|
@@ -1070,12 +1071,12 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1070
1071
|
disabled: w,
|
|
1071
1072
|
"aria-disabled": w,
|
|
1072
1073
|
"aria-label": "Next",
|
|
1073
|
-
className:
|
|
1074
|
+
className: U(c?.navButton, w && c?.disabledNavButton),
|
|
1074
1075
|
style: {
|
|
1075
1076
|
...D,
|
|
1076
1077
|
cursor: w ? "not-allowed" : "pointer",
|
|
1077
1078
|
opacity: w ? .38 : 1,
|
|
1078
|
-
...w ?
|
|
1079
|
+
...w ? d?.disabledNavButton : void 0
|
|
1079
1080
|
},
|
|
1080
1081
|
onMouseEnter: (e) => {
|
|
1081
1082
|
e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)";
|
|
@@ -1105,14 +1106,14 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1105
1106
|
flex: 1,
|
|
1106
1107
|
alignItems: "center"
|
|
1107
1108
|
},
|
|
1108
|
-
children: p === "months" ?
|
|
1109
|
+
children: p === "months" ? f.map((r, i) => {
|
|
1109
1110
|
let a = i === t && _ === e, o = !S(_, i);
|
|
1110
1111
|
return /* @__PURE__ */ l("button", {
|
|
1111
1112
|
type: "button",
|
|
1112
1113
|
disabled: o,
|
|
1113
1114
|
"aria-disabled": o,
|
|
1114
1115
|
onClick: () => n(i),
|
|
1115
|
-
className:
|
|
1116
|
+
className: U(c?.monthButton, a && c?.selectedMonthButton, o && c?.disabledMonthButton),
|
|
1116
1117
|
style: {
|
|
1117
1118
|
...O,
|
|
1118
1119
|
background: a ? "var(--pdp-primary, #4f46e5)" : "transparent",
|
|
@@ -1120,9 +1121,9 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1120
1121
|
fontWeight: a ? 700 : 500,
|
|
1121
1122
|
cursor: o ? "not-allowed" : "pointer",
|
|
1122
1123
|
opacity: o ? .35 : 1,
|
|
1123
|
-
...
|
|
1124
|
-
...a ?
|
|
1125
|
-
...o ?
|
|
1124
|
+
...d?.monthButton ?? {},
|
|
1125
|
+
...a ? d?.selectedMonthButton : void 0,
|
|
1126
|
+
...o ? d?.disabledMonthButton : void 0
|
|
1126
1127
|
},
|
|
1127
1128
|
onMouseEnter: (e) => {
|
|
1128
1129
|
a || (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)");
|
|
@@ -1138,7 +1139,7 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1138
1139
|
type: "button",
|
|
1139
1140
|
disabled: a,
|
|
1140
1141
|
"aria-disabled": a,
|
|
1141
|
-
className:
|
|
1142
|
+
className: U(c?.yearButton, i && c?.selectedYearButton, a && c?.disabledYearButton),
|
|
1142
1143
|
onClick: () => {
|
|
1143
1144
|
v(e), r(e), m("months");
|
|
1144
1145
|
},
|
|
@@ -1149,9 +1150,9 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1149
1150
|
fontWeight: i ? 700 : 500,
|
|
1150
1151
|
cursor: a ? "not-allowed" : "pointer",
|
|
1151
1152
|
opacity: a ? .3 : n ? .4 : 1,
|
|
1152
|
-
...
|
|
1153
|
-
...i ?
|
|
1154
|
-
...a ?
|
|
1153
|
+
...d?.yearButton ?? {},
|
|
1154
|
+
...i ? d?.selectedYearButton : void 0,
|
|
1155
|
+
...a ? d?.disabledYearButton : void 0
|
|
1155
1156
|
},
|
|
1156
1157
|
onMouseEnter: (e) => {
|
|
1157
1158
|
i || (e.currentTarget.style.backgroundColor = "var(--pdp-hover-bg, #f1f5f9)");
|
|
@@ -1159,7 +1160,7 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1159
1160
|
onMouseLeave: (e) => {
|
|
1160
1161
|
i || (e.currentTarget.style.backgroundColor = "transparent");
|
|
1161
1162
|
},
|
|
1162
|
-
children:
|
|
1163
|
+
children: R(e)
|
|
1163
1164
|
}, e);
|
|
1164
1165
|
})
|
|
1165
1166
|
})]
|
|
@@ -1167,11 +1168,11 @@ var G = ({ year: e, monthName: t, onPrevMonth: n, onNextMonth: r, onTitleClick:
|
|
|
1167
1168
|
};
|
|
1168
1169
|
//#endregion
|
|
1169
1170
|
//#region src/plugins/time-picker/time-utils.ts
|
|
1170
|
-
function
|
|
1171
|
+
function W(e, t = "persian") {
|
|
1171
1172
|
let n = e < 10 ? `0${e}` : `${e}`;
|
|
1172
|
-
return t === "persian" ?
|
|
1173
|
+
return t === "persian" ? R(n) : n;
|
|
1173
1174
|
}
|
|
1174
|
-
function
|
|
1175
|
+
function de() {
|
|
1175
1176
|
let e = /* @__PURE__ */ new Date();
|
|
1176
1177
|
return {
|
|
1177
1178
|
hour: e.getHours(),
|
|
@@ -1179,34 +1180,34 @@ function ce() {
|
|
|
1179
1180
|
second: e.getSeconds()
|
|
1180
1181
|
};
|
|
1181
1182
|
}
|
|
1182
|
-
function
|
|
1183
|
+
function G(e) {
|
|
1183
1184
|
return {
|
|
1184
1185
|
hour: Math.max(0, Math.min(23, e.hour)),
|
|
1185
1186
|
minute: Math.max(0, Math.min(59, e.minute)),
|
|
1186
1187
|
second: e.second === void 0 ? void 0 : Math.max(0, Math.min(59, e.second))
|
|
1187
1188
|
};
|
|
1188
1189
|
}
|
|
1189
|
-
function
|
|
1190
|
+
function fe(e, t = !1, n = "persian") {
|
|
1190
1191
|
if (!e) return "";
|
|
1191
|
-
let r =
|
|
1192
|
-
return t && e.second !== void 0 ? `${r}:${i}:${
|
|
1192
|
+
let r = W(e.hour, n), i = W(e.minute, n);
|
|
1193
|
+
return t && e.second !== void 0 ? `${r}:${i}:${W(e.second, n)}` : `${r}:${i}`;
|
|
1193
1194
|
}
|
|
1194
1195
|
//#endregion
|
|
1195
1196
|
//#region src/components/footer/CalendarFooter.tsx
|
|
1196
|
-
var
|
|
1197
|
-
let { theme: _ } =
|
|
1197
|
+
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: _ } = H(), v = (() => {
|
|
1198
1199
|
if (a === "single") {
|
|
1199
1200
|
if (!e) return "تاریخی انتخاب نشده";
|
|
1200
|
-
let t =
|
|
1201
|
+
let t = B(e, "YYYY/MM/DD", { digitType: o }), n = r ? fe(r, i, o) : "";
|
|
1201
1202
|
return n ? `${t}، ${n}` : t;
|
|
1202
1203
|
}
|
|
1203
1204
|
if (a === "range") {
|
|
1204
1205
|
let [e, n] = t ?? [null, null];
|
|
1205
1206
|
if (!e) return "بازهای انتخاب نشده";
|
|
1206
|
-
let r =
|
|
1207
|
-
return n ? `${r} تا ${
|
|
1207
|
+
let r = B(e, "YYYY/MM/DD", { digitType: o });
|
|
1208
|
+
return n ? `${r} تا ${B(n, "YYYY/MM/DD", { digitType: o })}` : `${r} تا …`;
|
|
1208
1209
|
}
|
|
1209
|
-
let s = n?.length ?? 0, c = o === "persian" ?
|
|
1210
|
+
let s = n?.length ?? 0, c = o === "persian" ? R(s) : String(s);
|
|
1210
1211
|
return s ? `${c} تاریخ انتخاب شده` : "تاریخی انتخاب نشده";
|
|
1211
1212
|
})(), y = {
|
|
1212
1213
|
minHeight: "34px",
|
|
@@ -1295,7 +1296,7 @@ var ue = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
|
|
|
1295
1296
|
]
|
|
1296
1297
|
})]
|
|
1297
1298
|
});
|
|
1298
|
-
},
|
|
1299
|
+
}, me = ({ value: e, onChange: t, minuteStep: n = 1, hourStep: r = 1, showSeconds: a = !1, digitType: d = "persian", classNames: f, styles: p }) => {
|
|
1299
1300
|
let [m, h] = s(null), g = o(null), _ = Array.from({ length: Math.ceil(24 / r) }, (e, t) => t * r), v = Array.from({ length: Math.ceil(60 / n) }, (e, t) => t * n), y = Array.from({ length: 60 }, (e, t) => t);
|
|
1300
1301
|
i(() => {
|
|
1301
1302
|
let e = (e) => {
|
|
@@ -1307,7 +1308,7 @@ var ue = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
|
|
|
1307
1308
|
}, []);
|
|
1308
1309
|
let b = (e) => {
|
|
1309
1310
|
let t = String(e).padStart(2, "0");
|
|
1310
|
-
return d === "persian" ?
|
|
1311
|
+
return d === "persian" ? R(t) : t;
|
|
1311
1312
|
}, x = (e, t, n, r) => {
|
|
1312
1313
|
let i = m === e;
|
|
1313
1314
|
return /* @__PURE__ */ u("div", {
|
|
@@ -1441,12 +1442,12 @@ var ue = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r
|
|
|
1441
1442
|
};
|
|
1442
1443
|
//#endregion
|
|
1443
1444
|
//#region src/components/masked-input/mask-utils.ts
|
|
1444
|
-
function
|
|
1445
|
-
let n =
|
|
1446
|
-
return n.length > 0 && (r = n.slice(0, 4)), n.length >= 5 && (r += `/${n.slice(4, 6)}`), n.length >= 7 && (r += `/${n.slice(6, 8)}`), t === "persian" ?
|
|
1445
|
+
function he(e, t = "persian") {
|
|
1446
|
+
let n = z(e).replace(/\D/g, "").slice(0, 8), r = "";
|
|
1447
|
+
return n.length > 0 && (r = n.slice(0, 4)), n.length >= 5 && (r += `/${n.slice(4, 6)}`), n.length >= 7 && (r += `/${n.slice(6, 8)}`), t === "persian" ? R(r) : r;
|
|
1447
1448
|
}
|
|
1448
|
-
function
|
|
1449
|
-
let i =
|
|
1449
|
+
function K(e, t, n, r) {
|
|
1450
|
+
let i = z(e).trim();
|
|
1450
1451
|
if (!i) return {
|
|
1451
1452
|
isValid: !0,
|
|
1452
1453
|
date: null
|
|
@@ -1463,7 +1464,7 @@ function pe(e, t, n, r) {
|
|
|
1463
1464
|
date: null,
|
|
1464
1465
|
error: "INVALID_MONTH"
|
|
1465
1466
|
};
|
|
1466
|
-
let l = s - 1, u =
|
|
1467
|
+
let l = s - 1, u = _(o, l);
|
|
1467
1468
|
if (c < 1 || c > u) return {
|
|
1468
1469
|
isValid: !1,
|
|
1469
1470
|
date: null,
|
|
@@ -1474,11 +1475,11 @@ function pe(e, t, n, r) {
|
|
|
1474
1475
|
month: l,
|
|
1475
1476
|
day: c
|
|
1476
1477
|
};
|
|
1477
|
-
return t &&
|
|
1478
|
+
return t && k(d, t) < 0 ? {
|
|
1478
1479
|
isValid: !1,
|
|
1479
1480
|
date: d,
|
|
1480
1481
|
error: "OUT_OF_MIN_BOUNDS"
|
|
1481
|
-
} : n &&
|
|
1482
|
+
} : n && k(d, n) > 0 ? {
|
|
1482
1483
|
isValid: !1,
|
|
1483
1484
|
date: d,
|
|
1484
1485
|
error: "OUT_OF_MAX_BOUNDS"
|
|
@@ -1493,19 +1494,19 @@ function pe(e, t, n, r) {
|
|
|
1493
1494
|
}
|
|
1494
1495
|
//#endregion
|
|
1495
1496
|
//#region src/components/masked-input/MaskedDateInput.tsx
|
|
1496
|
-
var
|
|
1497
|
-
let { theme: w } =
|
|
1497
|
+
var ge = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a, digitType: c = "persian", minDate: d, maxDate: f, isDateDisabled: p, clearable: m = !0, placeholder: h = "۱۴۰۵/۰۱/۱۵", disabled: g = !1, direction: _ = "rtl", wrapperClassName: v, wrapperStyle: y, clearButtonClassName: b, clearButtonStyle: x, style: S, ...C }) => {
|
|
1498
|
+
let { theme: w } = H(), [T, E] = s(t), D = e === void 0 ? T : e, [O, k] = s(() => D ? B(D, "YYYY/MM/DD", { digitType: c }) : ""), [ee, A] = s(!1), j = o(null);
|
|
1498
1499
|
i(() => {
|
|
1499
|
-
e !== void 0 && (k(e ?
|
|
1500
|
+
e !== void 0 && (k(e ? B(e, "YYYY/MM/DD", { digitType: c }) : ""), A(!1));
|
|
1500
1501
|
}, [e, c]);
|
|
1501
|
-
let
|
|
1502
|
-
let n = t.target.value, i =
|
|
1502
|
+
let M = (t) => {
|
|
1503
|
+
let n = t.target.value, i = he(n, c);
|
|
1503
1504
|
if (k(i), i.length === 10 || i.length === 0) {
|
|
1504
|
-
let t =
|
|
1505
|
-
t.isValid ? (
|
|
1506
|
-
} else
|
|
1507
|
-
},
|
|
1508
|
-
k(""),
|
|
1505
|
+
let t = K(i, d, f, p);
|
|
1506
|
+
t.isValid ? (A(!1), a?.(null), e === void 0 && E(t.date), r?.(t.date)) : (A(!0), a?.(t.error));
|
|
1507
|
+
} else A(!1), a?.(null);
|
|
1508
|
+
}, N = n(() => {
|
|
1509
|
+
k(""), A(!1), a?.(null), e === void 0 && E(null), r?.(null), j.current?.focus();
|
|
1509
1510
|
}, [
|
|
1510
1511
|
e,
|
|
1511
1512
|
r,
|
|
@@ -1523,13 +1524,13 @@ var me = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
|
|
|
1523
1524
|
...y
|
|
1524
1525
|
},
|
|
1525
1526
|
children: [/* @__PURE__ */ l("input", {
|
|
1526
|
-
ref:
|
|
1527
|
+
ref: j,
|
|
1527
1528
|
type: "text",
|
|
1528
1529
|
inputMode: "numeric",
|
|
1529
1530
|
disabled: g,
|
|
1530
1531
|
placeholder: c === "persian" ? h : "1405/01/15",
|
|
1531
1532
|
value: O,
|
|
1532
|
-
onChange:
|
|
1533
|
+
onChange: M,
|
|
1533
1534
|
style: {
|
|
1534
1535
|
width: "180px",
|
|
1535
1536
|
maxWidth: "100%",
|
|
@@ -1538,7 +1539,7 @@ var me = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
|
|
|
1538
1539
|
padding: "8px 12px",
|
|
1539
1540
|
paddingInlineEnd: m && O ? "32px" : "12px",
|
|
1540
1541
|
borderRadius: w.radii.sm,
|
|
1541
|
-
border: `1px solid ${
|
|
1542
|
+
border: `1px solid ${ee ? w.colors.holiday : w.colors.border}`,
|
|
1542
1543
|
backgroundColor: w.colors.background,
|
|
1543
1544
|
color: w.colors.textPrimary,
|
|
1544
1545
|
fontSize: "14px",
|
|
@@ -1553,7 +1554,7 @@ var me = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
|
|
|
1553
1554
|
}), m && O && !g && /* @__PURE__ */ l("button", {
|
|
1554
1555
|
type: "button",
|
|
1555
1556
|
"aria-label": "پاک کردن",
|
|
1556
|
-
onClick:
|
|
1557
|
+
onClick: N,
|
|
1557
1558
|
className: b,
|
|
1558
1559
|
style: {
|
|
1559
1560
|
position: "absolute",
|
|
@@ -1576,12 +1577,12 @@ var me = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a,
|
|
|
1576
1577
|
};
|
|
1577
1578
|
//#endregion
|
|
1578
1579
|
//#region src/events/event-utils.ts
|
|
1579
|
-
function
|
|
1580
|
-
return !t || t.length === 0 ? [] : t.filter((t) =>
|
|
1580
|
+
function _e(e, t) {
|
|
1581
|
+
return !t || t.length === 0 ? [] : t.filter((t) => x(t.date, e));
|
|
1581
1582
|
}
|
|
1582
1583
|
//#endregion
|
|
1583
1584
|
//#region src/holidays/iran-holidays.ts
|
|
1584
|
-
var
|
|
1585
|
+
var q = {
|
|
1585
1586
|
"0-1": "جشن نوروز / سال نو",
|
|
1586
1587
|
"0-2": "عید نوروز",
|
|
1587
1588
|
"0-3": "عید نوروز",
|
|
@@ -1593,10 +1594,10 @@ var ge = {
|
|
|
1593
1594
|
"10-22": "پیروزی انقلاب اسلامی",
|
|
1594
1595
|
"11-29": "روز ملی شدن صنعت نفت"
|
|
1595
1596
|
};
|
|
1596
|
-
function
|
|
1597
|
-
return
|
|
1597
|
+
function ve(e) {
|
|
1598
|
+
return y(e.year, e.month, e.day).getDay() === 5;
|
|
1598
1599
|
}
|
|
1599
|
-
function
|
|
1600
|
+
function ye(e, t) {
|
|
1600
1601
|
if (t && t.length > 0) {
|
|
1601
1602
|
let n = t.find((t) => t.date.year === e.year && t.date.month === e.month && t.date.day === e.day);
|
|
1602
1603
|
if (n) return {
|
|
@@ -1606,11 +1607,11 @@ function _e(e, t) {
|
|
|
1606
1607
|
};
|
|
1607
1608
|
}
|
|
1608
1609
|
let n = `${e.month}-${e.day}`;
|
|
1609
|
-
return
|
|
1610
|
-
title:
|
|
1610
|
+
return q[n] ? {
|
|
1611
|
+
title: q[n],
|
|
1611
1612
|
type: "solar",
|
|
1612
1613
|
isOff: !0
|
|
1613
|
-
} :
|
|
1614
|
+
} : ve(e) ? {
|
|
1614
1615
|
title: "جمعه (تعطیل پایان هفته)",
|
|
1615
1616
|
type: "solar",
|
|
1616
1617
|
isOff: !0
|
|
@@ -1618,12 +1619,32 @@ function _e(e, t) {
|
|
|
1618
1619
|
}
|
|
1619
1620
|
//#endregion
|
|
1620
1621
|
//#region src/components/JalaliDatePicker.tsx
|
|
1621
|
-
function
|
|
1622
|
-
let [K, q] = s(
|
|
1622
|
+
function be({ mode: e = "single", value: t, defaultValue: r, onChange: p, minDate: m, maxDate: h, isDateDisabled: g, firstDayOfWeek: _ = 0, variant: v = "popover", placeholder: y = "YYYY/MM/DD", digitType: b = "persian", className: S, style: E, classNames: D, styles: O, showFooter: k = !0, showStatusText: A = !0, allowClear: j = !0, enableTime: M = !1, timeValue: P, defaultTimeValue: F, onTimeChange: I, minuteStep: re = 1, hourStep: L = 1, showSeconds: z = !1, numberOfMonths: V = 1, useMaskedInput: ie = !1, events: ae, showHolidays: oe = !1, customHolidays: U, zIndex: W = 9999 }) {
|
|
1623
|
+
let { theme: G, mode: he } = H(), [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
|
+
"--pdp-primary": G.colors.primary,
|
|
1625
|
+
"--pdp-primary-hover": G.colors.primaryHover,
|
|
1626
|
+
"--pdp-primary-text": G.colors.primaryText,
|
|
1627
|
+
"--pdp-surface-bg": G.colors.background,
|
|
1628
|
+
"--pdp-surface-subtle": G.colors.surface,
|
|
1629
|
+
"--pdp-surface-border": G.colors.border,
|
|
1630
|
+
"--pdp-hover-bg": G.colors.backgroundHover,
|
|
1631
|
+
"--pdp-text-primary": G.colors.textPrimary,
|
|
1632
|
+
"--pdp-text-secondary": G.colors.textSecondary,
|
|
1633
|
+
"--pdp-text-muted": G.colors.textSecondary,
|
|
1634
|
+
"--pdp-text-disabled": G.colors.textDisabled,
|
|
1635
|
+
"--pdp-disabled-bg": G.colors.surface,
|
|
1636
|
+
"--pdp-holiday-color": G.colors.holiday,
|
|
1637
|
+
"--pdp-holiday-bg": G.colors.holidayBackground,
|
|
1638
|
+
"--pdp-range-between-bg": G.colors.rangeBackground,
|
|
1639
|
+
"--pdp-today-border": G.colors.todayBorder,
|
|
1640
|
+
"--pdp-border-radius": G.radii.lg,
|
|
1641
|
+
"--pdp-shadow": G.shadows.lg,
|
|
1642
|
+
colorScheme: he
|
|
1643
|
+
}), [G, he]);
|
|
1623
1644
|
i(() => {
|
|
1624
|
-
|
|
1625
|
-
}, [
|
|
1626
|
-
let
|
|
1645
|
+
v === "inline" && q(!0);
|
|
1646
|
+
}, [v]);
|
|
1647
|
+
let Ee = a(() => F || (t instanceof Date ? {
|
|
1627
1648
|
hour: t.getHours(),
|
|
1628
1649
|
minute: t.getMinutes(),
|
|
1629
1650
|
second: t.getSeconds()
|
|
@@ -1631,89 +1652,109 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
1631
1652
|
hour: r.getHours(),
|
|
1632
1653
|
minute: r.getMinutes(),
|
|
1633
1654
|
second: r.getSeconds()
|
|
1634
|
-
} :
|
|
1635
|
-
|
|
1655
|
+
} : de()), [
|
|
1656
|
+
F,
|
|
1636
1657
|
t,
|
|
1637
1658
|
r
|
|
1638
|
-
]), [
|
|
1659
|
+
]), [De, Oe] = s(Ee), Y = P === void 0 ? De : P ?? de();
|
|
1639
1660
|
i(() => {
|
|
1640
|
-
if (
|
|
1661
|
+
if (v === "inline" || !K) return;
|
|
1641
1662
|
let e = (e) => {
|
|
1642
|
-
|
|
1663
|
+
xe.current && !xe.current.contains(e.target) && !Se.current?.contains(e.target) && (q(!1), be(!1));
|
|
1643
1664
|
};
|
|
1644
1665
|
return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), () => {
|
|
1645
1666
|
document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
|
|
1646
1667
|
};
|
|
1647
|
-
}, [
|
|
1648
|
-
|
|
1668
|
+
}, [v, K]), i(() => {
|
|
1669
|
+
if (v !== "popover" || !K) {
|
|
1670
|
+
we(null);
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
let e = () => {
|
|
1674
|
+
let e = xe.current, t = Se.current;
|
|
1675
|
+
if (!e || !t) return;
|
|
1676
|
+
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);
|
|
1677
|
+
we((e) => e?.top === l && e.left === d && e.maxHeight === s ? e : {
|
|
1678
|
+
top: l,
|
|
1679
|
+
left: d,
|
|
1680
|
+
maxHeight: s
|
|
1681
|
+
});
|
|
1682
|
+
};
|
|
1683
|
+
e();
|
|
1684
|
+
let t = typeof ResizeObserver > "u" ? null : new ResizeObserver(e);
|
|
1685
|
+
return Se.current && t?.observe(Se.current), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
1686
|
+
t?.disconnect(), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
1687
|
+
};
|
|
1688
|
+
}, [v, K]);
|
|
1689
|
+
let ke = a(() => {
|
|
1649
1690
|
if (t !== void 0) {
|
|
1650
1691
|
if (!t) return null;
|
|
1651
|
-
if (t instanceof Date) return
|
|
1692
|
+
if (t instanceof Date) return w(t);
|
|
1652
1693
|
if (Array.isArray(t)) {
|
|
1653
1694
|
if (e === "range") {
|
|
1654
1695
|
let [e, n] = t;
|
|
1655
|
-
return [e ?
|
|
1696
|
+
return [e ? w(e) : null, n ? w(n) : null];
|
|
1656
1697
|
}
|
|
1657
|
-
if (e === "multiple") return t.map((e) =>
|
|
1698
|
+
if (e === "multiple") return t.map((e) => w(e));
|
|
1658
1699
|
}
|
|
1659
1700
|
return null;
|
|
1660
1701
|
}
|
|
1661
|
-
}, [t, e]),
|
|
1702
|
+
}, [t, e]), Ae = a(() => {
|
|
1662
1703
|
if (r !== void 0) {
|
|
1663
1704
|
if (!r) return null;
|
|
1664
|
-
if (r instanceof Date) return
|
|
1705
|
+
if (r instanceof Date) return w(r);
|
|
1665
1706
|
if (Array.isArray(r)) {
|
|
1666
1707
|
if (e === "range") {
|
|
1667
1708
|
let [e, t] = r;
|
|
1668
|
-
return [e ?
|
|
1709
|
+
return [e ? w(e) : null, t ? w(t) : null];
|
|
1669
1710
|
}
|
|
1670
|
-
if (e === "multiple") return r.map((e) =>
|
|
1711
|
+
if (e === "multiple") return r.map((e) => w(e));
|
|
1671
1712
|
}
|
|
1672
1713
|
return null;
|
|
1673
1714
|
}
|
|
1674
|
-
}, [r, e]),
|
|
1715
|
+
}, [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) => {
|
|
1675
1716
|
if (!t) return null;
|
|
1676
|
-
let r = n ?? Y, i = M ? r.hour : 0, a = M ? r.minute : 0, o = M &&
|
|
1677
|
-
if (e === "single" && !Array.isArray(t)) return
|
|
1717
|
+
let r = n ?? Y, i = M ? r.hour : 0, a = M ? r.minute : 0, o = M && z ? r.second ?? 0 : 0;
|
|
1718
|
+
if (e === "single" && !Array.isArray(t)) return T(t, i, a, o);
|
|
1678
1719
|
if (e === "range" && Array.isArray(t)) {
|
|
1679
1720
|
let [e, n] = t;
|
|
1680
|
-
return [e ?
|
|
1721
|
+
return [e ? T(e, 0, 0, 0) : null, n ? T(n, 23, 59, 59) : null];
|
|
1681
1722
|
}
|
|
1682
|
-
return e === "multiple" && Array.isArray(t) ? t.map((e) =>
|
|
1723
|
+
return e === "multiple" && Array.isArray(t) ? t.map((e) => T(e, i, a, o)) : null;
|
|
1683
1724
|
}, [
|
|
1684
1725
|
e,
|
|
1685
1726
|
M,
|
|
1686
1727
|
Y,
|
|
1687
|
-
|
|
1688
|
-
]), { selected: X, viewYear: Z, viewMonth: Q, grid:
|
|
1728
|
+
z
|
|
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 } = te({
|
|
1689
1730
|
mode: e,
|
|
1690
|
-
value:
|
|
1691
|
-
defaultValue:
|
|
1692
|
-
minDate:
|
|
1693
|
-
maxDate:
|
|
1694
|
-
firstDayOfWeek:
|
|
1695
|
-
isDateDisabled:
|
|
1731
|
+
value: ke,
|
|
1732
|
+
defaultValue: Ae,
|
|
1733
|
+
minDate: je,
|
|
1734
|
+
maxDate: Me,
|
|
1735
|
+
firstDayOfWeek: _,
|
|
1736
|
+
isDateDisabled: g ? Ne : void 0,
|
|
1696
1737
|
onChange: (e) => {
|
|
1697
|
-
|
|
1738
|
+
p?.(Pe(e));
|
|
1698
1739
|
}
|
|
1699
|
-
}),
|
|
1700
|
-
P === void 0 &&
|
|
1740
|
+
}), We = n((e) => {
|
|
1741
|
+
P === void 0 && Oe(e), I?.(e), X && p && p(Pe(X, e));
|
|
1701
1742
|
}, [
|
|
1702
1743
|
P,
|
|
1703
|
-
|
|
1744
|
+
I,
|
|
1704
1745
|
X,
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
]),
|
|
1708
|
-
|
|
1709
|
-
},
|
|
1710
|
-
e.stopPropagation(),
|
|
1711
|
-
}, { handleKeyDown:
|
|
1746
|
+
p,
|
|
1747
|
+
Pe
|
|
1748
|
+
]), Ge = e === "single" ? X : null, Ke = (t) => {
|
|
1749
|
+
Be(t), v === "popover" && e === "single" && !M && q(!1);
|
|
1750
|
+
}, qe = (e) => {
|
|
1751
|
+
e.stopPropagation(), Ue();
|
|
1752
|
+
}, { handleKeyDown: Je, getCellTabIndex: Ye, setFocusedDate: Xe } = ne({
|
|
1712
1753
|
viewYear: Z,
|
|
1713
1754
|
viewMonth: Q,
|
|
1714
|
-
selectedDate:
|
|
1715
|
-
onSelectDate:
|
|
1716
|
-
onViewChange:
|
|
1755
|
+
selectedDate: Ge,
|
|
1756
|
+
onSelectDate: Ke,
|
|
1757
|
+
onViewChange: Re,
|
|
1717
1758
|
isRtl: !0
|
|
1718
1759
|
});
|
|
1719
1760
|
i(() => {
|
|
@@ -1733,38 +1774,38 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
1733
1774
|
} : {
|
|
1734
1775
|
year: Z,
|
|
1735
1776
|
month: Q + 1
|
|
1736
|
-
}, [Z, Q]),
|
|
1777
|
+
}, [Z, Q]), Ze = a(() => Q === 0 ? {
|
|
1737
1778
|
year: Z - 1,
|
|
1738
1779
|
month: 11
|
|
1739
1780
|
} : {
|
|
1740
1781
|
year: Z,
|
|
1741
1782
|
month: Q - 1
|
|
1742
|
-
}, [Z, Q]),
|
|
1743
|
-
minDate:
|
|
1744
|
-
maxDate:
|
|
1745
|
-
}),
|
|
1783
|
+
}, [Z, Q]), Qe = !N(Ze.year, Ze.month, {
|
|
1784
|
+
minDate: je,
|
|
1785
|
+
maxDate: Me
|
|
1786
|
+
}), $e = V === 2 ? $.month === 11 ? {
|
|
1746
1787
|
year: $.year + 1,
|
|
1747
1788
|
month: 0
|
|
1748
1789
|
} : {
|
|
1749
1790
|
year: $.year,
|
|
1750
1791
|
month: $.month + 1
|
|
1751
|
-
} : $,
|
|
1752
|
-
minDate:
|
|
1753
|
-
maxDate:
|
|
1754
|
-
}),
|
|
1755
|
-
if (
|
|
1756
|
-
let t =
|
|
1792
|
+
} : $, et = !N($e.year, $e.month, {
|
|
1793
|
+
minDate: je,
|
|
1794
|
+
maxDate: Me
|
|
1795
|
+
}), tt = a(() => {
|
|
1796
|
+
if (V !== 2) return [];
|
|
1797
|
+
let t = C({
|
|
1757
1798
|
year: $.year,
|
|
1758
1799
|
month: $.month,
|
|
1759
|
-
firstDayOfWeek:
|
|
1760
|
-
minDate:
|
|
1761
|
-
maxDate:
|
|
1800
|
+
firstDayOfWeek: _,
|
|
1801
|
+
minDate: je,
|
|
1802
|
+
maxDate: Me
|
|
1762
1803
|
});
|
|
1763
1804
|
if (e !== "range") return t;
|
|
1764
|
-
let [n, r] = X || [null, null], i = r ?? (n &&
|
|
1805
|
+
let [n, r] = X || [null, null], i = r ?? (n && He ? He : null);
|
|
1765
1806
|
return t.map((e) => {
|
|
1766
|
-
let t = n ?
|
|
1767
|
-
return n && i && (a =
|
|
1807
|
+
let t = n ? x(e.jalali, n) : !1, r = i ? x(e.jalali, i) : !1, a = !1;
|
|
1808
|
+
return n && i && (a = ee(e.jalali, n, i)), {
|
|
1768
1809
|
...e,
|
|
1769
1810
|
isSelected: t || r,
|
|
1770
1811
|
isInRange: a,
|
|
@@ -1773,101 +1814,104 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
1773
1814
|
};
|
|
1774
1815
|
});
|
|
1775
1816
|
}, [
|
|
1776
|
-
|
|
1817
|
+
V,
|
|
1777
1818
|
$,
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1819
|
+
_,
|
|
1820
|
+
je,
|
|
1821
|
+
Me,
|
|
1781
1822
|
e,
|
|
1782
1823
|
X,
|
|
1783
|
-
|
|
1784
|
-
]),
|
|
1824
|
+
He
|
|
1825
|
+
]), nt = a(() => {
|
|
1785
1826
|
if (!X) return "";
|
|
1786
1827
|
if (e === "single") {
|
|
1787
|
-
let e =
|
|
1788
|
-
return M && Y ? `${e} ${
|
|
1828
|
+
let e = B(X, "YYYY/MM/DD", { digitType: b });
|
|
1829
|
+
return M && Y ? `${e} ${fe(Y, z, b)}` : e;
|
|
1789
1830
|
}
|
|
1790
1831
|
if (e === "range") {
|
|
1791
1832
|
let [e, t] = X || [null, null];
|
|
1792
|
-
if (e && t) return `${
|
|
1793
|
-
if (e) return `${
|
|
1833
|
+
if (e && t) return `${B(e, "YYYY/MM/DD", { digitType: b })} - ${B(t, "YYYY/MM/DD", { digitType: b })}`;
|
|
1834
|
+
if (e) return `${B(e, "YYYY/MM/DD", { digitType: b })} - ...`;
|
|
1794
1835
|
}
|
|
1795
|
-
return e === "multiple" && Array.isArray(X) ? `${
|
|
1836
|
+
return e === "multiple" && Array.isArray(X) ? `${R(X.length)} تاریخ انتخاب شده` : "";
|
|
1796
1837
|
}, [
|
|
1797
1838
|
X,
|
|
1798
1839
|
e,
|
|
1799
|
-
|
|
1840
|
+
b,
|
|
1800
1841
|
M,
|
|
1801
1842
|
Y,
|
|
1802
|
-
|
|
1803
|
-
]),
|
|
1804
|
-
className:
|
|
1843
|
+
z
|
|
1844
|
+
]), rt = !!(e === "single" ? X : e === "range" ? X?.[0] : X?.length), it = (e, t, n, r = !0, i = !0) => /* @__PURE__ */ u("div", {
|
|
1845
|
+
className: D?.calendarPane,
|
|
1805
1846
|
style: {
|
|
1806
1847
|
width: "calc(7 * var(--pdp-cell-size, 34px) + 6 * 4px)",
|
|
1807
1848
|
maxWidth: "100%",
|
|
1808
1849
|
minWidth: 0,
|
|
1809
1850
|
flex: "1 1 calc(7 * var(--pdp-cell-size, 34px) + 6 * 4px)",
|
|
1810
|
-
...
|
|
1851
|
+
...O?.calendarPane
|
|
1811
1852
|
},
|
|
1812
1853
|
children: [
|
|
1813
|
-
/* @__PURE__ */ l(
|
|
1854
|
+
/* @__PURE__ */ l(se, {
|
|
1814
1855
|
year: e,
|
|
1815
|
-
monthName:
|
|
1816
|
-
onPrevMonth: r ?
|
|
1817
|
-
onNextMonth: i ?
|
|
1818
|
-
onTitleClick: () =>
|
|
1819
|
-
isPickerOpen:
|
|
1820
|
-
isPrevDisabled: !r ||
|
|
1821
|
-
isNextDisabled: !i ||
|
|
1822
|
-
classNames:
|
|
1823
|
-
styles:
|
|
1856
|
+
monthName: f[t],
|
|
1857
|
+
onPrevMonth: r ? Ie : () => {},
|
|
1858
|
+
onNextMonth: i ? Le : () => {},
|
|
1859
|
+
onTitleClick: () => be((e) => !e),
|
|
1860
|
+
isPickerOpen: ve,
|
|
1861
|
+
isPrevDisabled: !r || Qe,
|
|
1862
|
+
isNextDisabled: !i || et,
|
|
1863
|
+
classNames: D,
|
|
1864
|
+
styles: O
|
|
1824
1865
|
}),
|
|
1825
|
-
/* @__PURE__ */ l(
|
|
1826
|
-
firstDayOfWeek:
|
|
1827
|
-
classNames:
|
|
1828
|
-
styles:
|
|
1866
|
+
/* @__PURE__ */ l(ce, {
|
|
1867
|
+
firstDayOfWeek: _,
|
|
1868
|
+
classNames: D,
|
|
1869
|
+
styles: O
|
|
1829
1870
|
}),
|
|
1830
1871
|
/* @__PURE__ */ l("div", {
|
|
1831
1872
|
role: "grid",
|
|
1832
|
-
"aria-label": `${
|
|
1833
|
-
className:
|
|
1873
|
+
"aria-label": `${f[t]} ${R(e)}`,
|
|
1874
|
+
className: D?.grid,
|
|
1834
1875
|
style: {
|
|
1835
1876
|
display: "grid",
|
|
1836
1877
|
gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
|
|
1837
1878
|
gap: "4px",
|
|
1838
1879
|
justifyContent: "center",
|
|
1839
1880
|
alignItems: "center",
|
|
1840
|
-
...
|
|
1881
|
+
...O?.grid
|
|
1841
1882
|
},
|
|
1842
1883
|
children: n.map((e, t) => {
|
|
1843
|
-
let n =
|
|
1844
|
-
return /* @__PURE__ */ l(
|
|
1884
|
+
let n = oe ? ye(e.jalali, U) : null, r = _e(e.jalali, ae);
|
|
1885
|
+
return /* @__PURE__ */ l(le, {
|
|
1845
1886
|
cell: e,
|
|
1846
|
-
digitType:
|
|
1887
|
+
digitType: b,
|
|
1847
1888
|
isHoliday: !!n,
|
|
1848
1889
|
holidayTitle: n?.title,
|
|
1849
1890
|
events: r,
|
|
1850
|
-
classNames:
|
|
1851
|
-
styles:
|
|
1852
|
-
tabIndex:
|
|
1853
|
-
onSelect:
|
|
1854
|
-
onHover:
|
|
1855
|
-
onFocus:
|
|
1891
|
+
classNames: D,
|
|
1892
|
+
styles: O,
|
|
1893
|
+
tabIndex: Ye(e.jalali),
|
|
1894
|
+
onSelect: Ke,
|
|
1895
|
+
onHover: Ve,
|
|
1896
|
+
onFocus: Xe
|
|
1856
1897
|
}, t);
|
|
1857
1898
|
})
|
|
1858
1899
|
})
|
|
1859
1900
|
]
|
|
1860
|
-
}),
|
|
1901
|
+
}), at = /* @__PURE__ */ l("div", {
|
|
1902
|
+
ref: Se,
|
|
1861
1903
|
role: J ? "dialog" : "region",
|
|
1862
1904
|
"aria-modal": J ? !0 : void 0,
|
|
1863
1905
|
"aria-label": "تقویم شمسی",
|
|
1864
|
-
onKeyDown:
|
|
1906
|
+
onKeyDown: Je,
|
|
1865
1907
|
onClick: (e) => e.stopPropagation(),
|
|
1866
|
-
className:
|
|
1908
|
+
className: D?.calendar,
|
|
1867
1909
|
style: {
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1910
|
+
...Te,
|
|
1911
|
+
position: v === "popover" ? "fixed" : J ? "relative" : "static",
|
|
1912
|
+
top: v === "popover" ? Ce?.top ?? 0 : void 0,
|
|
1913
|
+
left: v === "popover" ? Ce?.left ?? 0 : void 0,
|
|
1914
|
+
visibility: v === "popover" && !Ce ? "hidden" : "visible",
|
|
1871
1915
|
zIndex: J ? W + 1 : W,
|
|
1872
1916
|
padding: "12px",
|
|
1873
1917
|
backgroundColor: "var(--pdp-surface-bg, #ffffff)",
|
|
@@ -1875,9 +1919,9 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
1875
1919
|
border: "1px solid var(--pdp-surface-border, #e2e8f0)",
|
|
1876
1920
|
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)",
|
|
1877
1921
|
width: "max-content",
|
|
1878
|
-
maxWidth:
|
|
1879
|
-
maxHeight: J ? "calc(100dvh - 32px)" : void 0,
|
|
1880
|
-
overflowY: J ? "auto" : void 0,
|
|
1922
|
+
maxWidth: v === "inline" ? "100%" : "calc(100vw - 24px)",
|
|
1923
|
+
maxHeight: J ? "calc(100dvh - 32px)" : v === "popover" ? Ce?.maxHeight : void 0,
|
|
1924
|
+
overflowY: J || v === "popover" ? "auto" : void 0,
|
|
1881
1925
|
overflowX: "hidden",
|
|
1882
1926
|
userSelect: "none",
|
|
1883
1927
|
display: "flex",
|
|
@@ -1885,23 +1929,23 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
1885
1929
|
gap: "8px",
|
|
1886
1930
|
direction: "rtl",
|
|
1887
1931
|
boxSizing: "border-box",
|
|
1888
|
-
...
|
|
1932
|
+
...O?.calendar
|
|
1889
1933
|
},
|
|
1890
|
-
children:
|
|
1934
|
+
children: ve ? /* @__PURE__ */ l(ue, {
|
|
1891
1935
|
currentYear: Z,
|
|
1892
1936
|
currentMonth: Q,
|
|
1893
1937
|
onSelectMonth: (e) => {
|
|
1894
|
-
|
|
1938
|
+
Re(Z, e), be(!1);
|
|
1895
1939
|
},
|
|
1896
|
-
onSelectYear: (e) =>
|
|
1897
|
-
minDate:
|
|
1898
|
-
maxDate:
|
|
1899
|
-
isDateDisabled:
|
|
1900
|
-
classNames:
|
|
1901
|
-
styles:
|
|
1940
|
+
onSelectYear: (e) => Re(e, Q),
|
|
1941
|
+
minDate: je,
|
|
1942
|
+
maxDate: Me,
|
|
1943
|
+
isDateDisabled: g ? Ne : void 0,
|
|
1944
|
+
classNames: D,
|
|
1945
|
+
styles: O
|
|
1902
1946
|
}) : /* @__PURE__ */ u(c, { children: [
|
|
1903
1947
|
/* @__PURE__ */ u("div", {
|
|
1904
|
-
className:
|
|
1948
|
+
className: D?.calendarPanes,
|
|
1905
1949
|
style: {
|
|
1906
1950
|
display: "flex",
|
|
1907
1951
|
flexDirection: "row",
|
|
@@ -1912,59 +1956,60 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
1912
1956
|
width: "100%",
|
|
1913
1957
|
minWidth: 0,
|
|
1914
1958
|
boxSizing: "border-box",
|
|
1915
|
-
...
|
|
1959
|
+
...O?.calendarPanes
|
|
1916
1960
|
},
|
|
1917
|
-
children: [
|
|
1961
|
+
children: [it(Z, Q, Fe, !0, V === 1), V === 2 && /* @__PURE__ */ l(c, { children: it($.year, $.month, tt, !1, !0) })]
|
|
1918
1962
|
}),
|
|
1919
|
-
M && /* @__PURE__ */ l(
|
|
1963
|
+
M && /* @__PURE__ */ l(me, {
|
|
1920
1964
|
value: Y,
|
|
1921
|
-
onChange:
|
|
1922
|
-
minuteStep:
|
|
1923
|
-
hourStep:
|
|
1924
|
-
showSeconds:
|
|
1925
|
-
digitType:
|
|
1926
|
-
classNames:
|
|
1927
|
-
styles:
|
|
1965
|
+
onChange: We,
|
|
1966
|
+
minuteStep: re,
|
|
1967
|
+
hourStep: L,
|
|
1968
|
+
showSeconds: z,
|
|
1969
|
+
digitType: b,
|
|
1970
|
+
classNames: D,
|
|
1971
|
+
styles: O
|
|
1928
1972
|
}),
|
|
1929
|
-
|
|
1973
|
+
k && /* @__PURE__ */ l(pe, {
|
|
1930
1974
|
mode: e,
|
|
1931
|
-
digitType:
|
|
1975
|
+
digitType: b,
|
|
1932
1976
|
showStatusText: A,
|
|
1933
1977
|
selectedDate: e === "single" ? X : null,
|
|
1934
1978
|
selectedRange: e === "range" ? X : void 0,
|
|
1935
1979
|
selectedDates: e === "multiple" ? X : void 0,
|
|
1936
1980
|
selectedTime: M ? Y : void 0,
|
|
1937
|
-
onToday:
|
|
1938
|
-
classNames:
|
|
1939
|
-
styles:
|
|
1981
|
+
onToday: ze,
|
|
1982
|
+
classNames: D,
|
|
1983
|
+
styles: O
|
|
1940
1984
|
})
|
|
1941
1985
|
] })
|
|
1942
1986
|
});
|
|
1943
1987
|
return /* @__PURE__ */ u("div", {
|
|
1944
|
-
ref:
|
|
1945
|
-
className:
|
|
1988
|
+
ref: xe,
|
|
1989
|
+
className: S ?? D?.root,
|
|
1946
1990
|
style: {
|
|
1991
|
+
...Te,
|
|
1947
1992
|
position: "relative",
|
|
1948
1993
|
display: "inline-block",
|
|
1949
1994
|
maxWidth: "100%",
|
|
1950
1995
|
verticalAlign: "top",
|
|
1951
|
-
zIndex: K &&
|
|
1952
|
-
...
|
|
1953
|
-
...
|
|
1996
|
+
zIndex: K && v === "popover" ? W : 1,
|
|
1997
|
+
...E,
|
|
1998
|
+
...O?.root
|
|
1954
1999
|
},
|
|
1955
|
-
children: [
|
|
1956
|
-
value:
|
|
1957
|
-
digitType:
|
|
1958
|
-
placeholder:
|
|
2000
|
+
children: [v !== "inline" && (ie && e === "single" && v === "popover" ? /* @__PURE__ */ l(ge, {
|
|
2001
|
+
value: Ge,
|
|
2002
|
+
digitType: b,
|
|
2003
|
+
placeholder: y,
|
|
1959
2004
|
onChange: (e) => {
|
|
1960
|
-
e ? (
|
|
2005
|
+
e ? (Be(e), Re(e.year, e.month)) : Ue();
|
|
1961
2006
|
},
|
|
1962
2007
|
onClick: () => q(!0),
|
|
1963
|
-
className:
|
|
2008
|
+
className: D?.input,
|
|
1964
2009
|
style: {
|
|
1965
2010
|
direction: "ltr",
|
|
1966
2011
|
textAlign: "left",
|
|
1967
|
-
...
|
|
2012
|
+
...O?.input
|
|
1968
2013
|
}
|
|
1969
2014
|
}) : /* @__PURE__ */ u("div", {
|
|
1970
2015
|
onClick: (e) => {
|
|
@@ -1982,9 +2027,9 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
1982
2027
|
children: [/* @__PURE__ */ l("input", {
|
|
1983
2028
|
type: "text",
|
|
1984
2029
|
readOnly: !0,
|
|
1985
|
-
placeholder:
|
|
1986
|
-
value:
|
|
1987
|
-
className:
|
|
2030
|
+
placeholder: y,
|
|
2031
|
+
value: nt,
|
|
2032
|
+
className: D?.input,
|
|
1988
2033
|
style: {
|
|
1989
2034
|
direction: "ltr",
|
|
1990
2035
|
textAlign: "left",
|
|
@@ -1999,11 +2044,11 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
1999
2044
|
width: "100%",
|
|
2000
2045
|
maxWidth: "100%",
|
|
2001
2046
|
boxSizing: "border-box",
|
|
2002
|
-
...
|
|
2047
|
+
...O?.input
|
|
2003
2048
|
}
|
|
2004
|
-
}), j &&
|
|
2049
|
+
}), j && rt && /* @__PURE__ */ l("button", {
|
|
2005
2050
|
type: "button",
|
|
2006
|
-
onClick:
|
|
2051
|
+
onClick: qe,
|
|
2007
2052
|
"aria-label": "Clear value",
|
|
2008
2053
|
style: {
|
|
2009
2054
|
position: "absolute",
|
|
@@ -2030,10 +2075,10 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
2030
2075
|
},
|
|
2031
2076
|
children: "✕"
|
|
2032
2077
|
})]
|
|
2033
|
-
})), K && (J ? /* @__PURE__ */ l("div", {
|
|
2078
|
+
})), K && (v === "inline" ? at : typeof document < "u" ? d(J ? /* @__PURE__ */ l("div", {
|
|
2034
2079
|
role: "presentation",
|
|
2035
2080
|
onClick: () => q(!1),
|
|
2036
|
-
className:
|
|
2081
|
+
className: D?.modalBackdrop,
|
|
2037
2082
|
style: {
|
|
2038
2083
|
position: "fixed",
|
|
2039
2084
|
top: 0,
|
|
@@ -2050,80 +2095,80 @@ function ve({ mode: e = "single", value: t, defaultValue: r, onChange: f, minDat
|
|
|
2050
2095
|
boxSizing: "border-box",
|
|
2051
2096
|
overflowY: "auto",
|
|
2052
2097
|
direction: "rtl",
|
|
2053
|
-
...
|
|
2098
|
+
...O?.modalBackdrop
|
|
2054
2099
|
},
|
|
2055
|
-
children:
|
|
2056
|
-
}) :
|
|
2100
|
+
children: at
|
|
2101
|
+
}) : at, document.body) : null)]
|
|
2057
2102
|
});
|
|
2058
2103
|
}
|
|
2059
2104
|
//#endregion
|
|
2060
2105
|
//#region src/components/dual-calendar/DualMonthCalendar.tsx
|
|
2061
|
-
var
|
|
2062
|
-
let { theme: w } =
|
|
2106
|
+
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 } = H(), [T, E] = s(t), D = e === void 0 ? T : e, [O, A] = s(null), j = (e) => c === "persian" ? R(e) : String(e), M = a(() => b(), []), [P, te] = s(() => i || (D[0] ? {
|
|
2063
2108
|
year: D[0].year,
|
|
2064
2109
|
month: D[0].month
|
|
2065
2110
|
} : {
|
|
2066
|
-
year:
|
|
2067
|
-
month:
|
|
2068
|
-
})),
|
|
2069
|
-
year:
|
|
2111
|
+
year: M.year,
|
|
2112
|
+
month: M.month
|
|
2113
|
+
})), F = a(() => P.month === 11 ? {
|
|
2114
|
+
year: P.year + 1,
|
|
2070
2115
|
month: 0
|
|
2071
2116
|
} : {
|
|
2072
|
-
year:
|
|
2073
|
-
month:
|
|
2074
|
-
}, [
|
|
2075
|
-
year:
|
|
2117
|
+
year: P.year,
|
|
2118
|
+
month: P.month + 1
|
|
2119
|
+
}, [P]), I = a(() => P.month === 0 ? {
|
|
2120
|
+
year: P.year - 1,
|
|
2076
2121
|
month: 11
|
|
2077
2122
|
} : {
|
|
2078
|
-
year:
|
|
2079
|
-
month:
|
|
2080
|
-
}, [
|
|
2081
|
-
minDate:
|
|
2082
|
-
maxDate:
|
|
2083
|
-
}),
|
|
2084
|
-
year:
|
|
2123
|
+
year: P.year,
|
|
2124
|
+
month: P.month - 1
|
|
2125
|
+
}, [P]), ne = a(() => d ? S(d) : void 0, [d]), re = a(() => p ? S(p) : void 0, [p]), L = !N(I.year, I.month, {
|
|
2126
|
+
minDate: ne,
|
|
2127
|
+
maxDate: re
|
|
2128
|
+
}), z = F.month === 11 ? {
|
|
2129
|
+
year: F.year + 1,
|
|
2085
2130
|
month: 0
|
|
2086
2131
|
} : {
|
|
2087
|
-
year:
|
|
2088
|
-
month:
|
|
2089
|
-
},
|
|
2090
|
-
minDate:
|
|
2091
|
-
maxDate:
|
|
2092
|
-
}),
|
|
2093
|
-
|
|
2132
|
+
year: F.year,
|
|
2133
|
+
month: F.month + 1
|
|
2134
|
+
}, B = !N(z.year, z.month, {
|
|
2135
|
+
minDate: ne,
|
|
2136
|
+
maxDate: re
|
|
2137
|
+
}), V = () => {
|
|
2138
|
+
L || te((e) => e.month === 0 ? {
|
|
2094
2139
|
year: e.year - 1,
|
|
2095
2140
|
month: 11
|
|
2096
2141
|
} : {
|
|
2097
2142
|
year: e.year,
|
|
2098
2143
|
month: e.month - 1
|
|
2099
2144
|
});
|
|
2100
|
-
},
|
|
2101
|
-
|
|
2145
|
+
}, ie = () => {
|
|
2146
|
+
B || te((e) => e.month === 11 ? {
|
|
2102
2147
|
year: e.year + 1,
|
|
2103
2148
|
month: 0
|
|
2104
2149
|
} : {
|
|
2105
2150
|
year: e.year,
|
|
2106
2151
|
month: e.month + 1
|
|
2107
2152
|
});
|
|
2108
|
-
},
|
|
2153
|
+
}, ae = n((t) => {
|
|
2109
2154
|
let [n, i] = D, a;
|
|
2110
|
-
!n || n && i ? a = [t, null] : (a =
|
|
2155
|
+
!n || n && i ? a = [t, null] : (a = k(t, n) < 0 ? [t, n] : [n, t], A(null)), e === void 0 && E(a), r?.(a);
|
|
2111
2156
|
}, [
|
|
2112
2157
|
D,
|
|
2113
2158
|
e,
|
|
2114
2159
|
r
|
|
2115
|
-
]),
|
|
2116
|
-
let n =
|
|
2160
|
+
]), oe = n((e, t) => {
|
|
2161
|
+
let n = C({
|
|
2117
2162
|
year: e,
|
|
2118
2163
|
month: t,
|
|
2119
2164
|
firstDayOfWeek: o,
|
|
2120
|
-
minDate:
|
|
2165
|
+
minDate: d,
|
|
2121
2166
|
maxDate: p,
|
|
2122
2167
|
isDateDisabled: m
|
|
2123
|
-
}), [r, i] = D, a = i ?? (r &&
|
|
2168
|
+
}), [r, i] = D, a = i ?? (r && O ? O : null);
|
|
2124
2169
|
return n.map((e) => {
|
|
2125
|
-
let t = r ?
|
|
2126
|
-
return r && a && (i =
|
|
2170
|
+
let t = r ? x(e.jalali, r) : !1, n = a ? x(e.jalali, a) : !1, i = !1;
|
|
2171
|
+
return r && a && (i = ee(e.jalali, r, a)), {
|
|
2127
2172
|
...e,
|
|
2128
2173
|
isSelected: t || n,
|
|
2129
2174
|
isInRange: i,
|
|
@@ -2133,20 +2178,20 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2133
2178
|
});
|
|
2134
2179
|
}, [
|
|
2135
2180
|
o,
|
|
2136
|
-
|
|
2181
|
+
d,
|
|
2137
2182
|
p,
|
|
2138
2183
|
m,
|
|
2139
2184
|
D,
|
|
2140
|
-
|
|
2141
|
-
]), se = a(() =>
|
|
2142
|
-
|
|
2185
|
+
O
|
|
2186
|
+
]), se = a(() => oe(P.year, P.month), [
|
|
2187
|
+
oe,
|
|
2188
|
+
P.year,
|
|
2189
|
+
P.month
|
|
2190
|
+
]), ue = a(() => oe(F.year, F.month), [
|
|
2191
|
+
oe,
|
|
2143
2192
|
F.year,
|
|
2144
2193
|
F.month
|
|
2145
|
-
]),
|
|
2146
|
-
G,
|
|
2147
|
-
L.year,
|
|
2148
|
-
L.month
|
|
2149
|
-
]), ce = (e, t, n, r) => /* @__PURE__ */ u("div", {
|
|
2194
|
+
]), W = (e, t, n, r) => /* @__PURE__ */ u("div", {
|
|
2150
2195
|
dir: h,
|
|
2151
2196
|
className: v?.calendarPane,
|
|
2152
2197
|
style: {
|
|
@@ -2157,7 +2202,7 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2157
2202
|
maxWidth: "100%",
|
|
2158
2203
|
minWidth: 0,
|
|
2159
2204
|
flex: "1 1 var(--pdp-calendar-pane-width, 276px)",
|
|
2160
|
-
...
|
|
2205
|
+
...y?.calendarPane
|
|
2161
2206
|
},
|
|
2162
2207
|
children: [
|
|
2163
2208
|
/* @__PURE__ */ u("div", {
|
|
@@ -2168,16 +2213,16 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2168
2213
|
justifyContent: "space-between",
|
|
2169
2214
|
padding: "0 4px",
|
|
2170
2215
|
height: "32px",
|
|
2171
|
-
...
|
|
2216
|
+
...y?.header
|
|
2172
2217
|
},
|
|
2173
2218
|
children: [
|
|
2174
2219
|
r ? /* @__PURE__ */ l("button", {
|
|
2175
2220
|
type: "button",
|
|
2176
2221
|
"aria-label": "ماه قبل",
|
|
2177
|
-
onClick:
|
|
2178
|
-
disabled:
|
|
2179
|
-
"aria-disabled":
|
|
2180
|
-
className:
|
|
2222
|
+
onClick: V,
|
|
2223
|
+
disabled: L,
|
|
2224
|
+
"aria-disabled": L,
|
|
2225
|
+
className: U(v?.navButton, L && v?.disabledNavButton),
|
|
2181
2226
|
style: {
|
|
2182
2227
|
width: "28px",
|
|
2183
2228
|
height: "28px",
|
|
@@ -2185,10 +2230,10 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2185
2230
|
border: `1px solid ${w.colors.border}`,
|
|
2186
2231
|
backgroundColor: w.colors.background,
|
|
2187
2232
|
color: w.colors.textPrimary,
|
|
2188
|
-
cursor:
|
|
2189
|
-
opacity:
|
|
2190
|
-
...
|
|
2191
|
-
...
|
|
2233
|
+
cursor: L ? "not-allowed" : "pointer",
|
|
2234
|
+
opacity: L ? .38 : 1,
|
|
2235
|
+
...y?.navButton,
|
|
2236
|
+
...L ? y?.disabledNavButton : void 0
|
|
2192
2237
|
},
|
|
2193
2238
|
children: h === "rtl" ? "›" : "‹"
|
|
2194
2239
|
}) : /* @__PURE__ */ l("div", { style: { width: "28px" } }),
|
|
@@ -2199,18 +2244,18 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2199
2244
|
color: w.colors.textPrimary
|
|
2200
2245
|
},
|
|
2201
2246
|
children: [
|
|
2202
|
-
|
|
2247
|
+
f[t],
|
|
2203
2248
|
" ",
|
|
2204
|
-
|
|
2249
|
+
j(e)
|
|
2205
2250
|
]
|
|
2206
2251
|
}),
|
|
2207
2252
|
r ? /* @__PURE__ */ l("div", { style: { width: "28px" } }) : /* @__PURE__ */ l("button", {
|
|
2208
2253
|
type: "button",
|
|
2209
2254
|
"aria-label": "ماه بعد",
|
|
2210
|
-
onClick:
|
|
2211
|
-
disabled:
|
|
2212
|
-
"aria-disabled":
|
|
2213
|
-
className:
|
|
2255
|
+
onClick: ie,
|
|
2256
|
+
disabled: B,
|
|
2257
|
+
"aria-disabled": B,
|
|
2258
|
+
className: U(v?.navButton, B && v?.disabledNavButton),
|
|
2214
2259
|
style: {
|
|
2215
2260
|
width: "28px",
|
|
2216
2261
|
height: "28px",
|
|
@@ -2218,23 +2263,23 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2218
2263
|
border: `1px solid ${w.colors.border}`,
|
|
2219
2264
|
backgroundColor: w.colors.background,
|
|
2220
2265
|
color: w.colors.textPrimary,
|
|
2221
|
-
cursor:
|
|
2222
|
-
opacity:
|
|
2223
|
-
...
|
|
2224
|
-
...
|
|
2266
|
+
cursor: B ? "not-allowed" : "pointer",
|
|
2267
|
+
opacity: B ? .38 : 1,
|
|
2268
|
+
...y?.navButton,
|
|
2269
|
+
...B ? y?.disabledNavButton : void 0
|
|
2225
2270
|
},
|
|
2226
2271
|
children: h === "rtl" ? "‹" : "›"
|
|
2227
2272
|
})
|
|
2228
2273
|
]
|
|
2229
2274
|
}),
|
|
2230
|
-
/* @__PURE__ */ l(
|
|
2275
|
+
/* @__PURE__ */ l(ce, {
|
|
2231
2276
|
firstDayOfWeek: o,
|
|
2232
2277
|
classNames: v,
|
|
2233
|
-
styles:
|
|
2278
|
+
styles: y
|
|
2234
2279
|
}),
|
|
2235
2280
|
/* @__PURE__ */ l("div", {
|
|
2236
2281
|
role: "grid",
|
|
2237
|
-
"aria-label": `${
|
|
2282
|
+
"aria-label": `${f[t]} ${j(e)}`,
|
|
2238
2283
|
dir: h,
|
|
2239
2284
|
className: v?.grid,
|
|
2240
2285
|
style: {
|
|
@@ -2243,16 +2288,16 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2243
2288
|
minWidth: 0,
|
|
2244
2289
|
gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
|
|
2245
2290
|
gap: "var(--pdp-cell-gap, 4px)",
|
|
2246
|
-
...
|
|
2291
|
+
...y?.grid
|
|
2247
2292
|
},
|
|
2248
|
-
children: n.map((e) => /* @__PURE__ */ l(
|
|
2293
|
+
children: n.map((e) => /* @__PURE__ */ l(le, {
|
|
2249
2294
|
cell: e,
|
|
2250
2295
|
digitType: c,
|
|
2251
2296
|
classNames: v,
|
|
2252
|
-
styles:
|
|
2297
|
+
styles: y,
|
|
2253
2298
|
tabIndex: 0,
|
|
2254
|
-
onSelect:
|
|
2255
|
-
onHover:
|
|
2299
|
+
onSelect: ae,
|
|
2300
|
+
onHover: A
|
|
2256
2301
|
}, `${e.jalali.year}-${e.jalali.month}-${e.jalali.day}`))
|
|
2257
2302
|
})
|
|
2258
2303
|
]
|
|
@@ -2261,7 +2306,7 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2261
2306
|
role: "region",
|
|
2262
2307
|
"aria-label": "تقویم دوقلو شمسی",
|
|
2263
2308
|
dir: h,
|
|
2264
|
-
className:
|
|
2309
|
+
className: U(g, v?.calendar),
|
|
2265
2310
|
style: {
|
|
2266
2311
|
"--pdp-cell-size": "36px",
|
|
2267
2312
|
"--pdp-cell-gap": "4px",
|
|
@@ -2279,12 +2324,12 @@ var ye = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDa
|
|
|
2279
2324
|
width: "calc(var(--pdp-calendar-pane-width, 276px) + var(--pdp-calendar-pane-width, 276px) + 56px)",
|
|
2280
2325
|
maxWidth: "100%",
|
|
2281
2326
|
..._,
|
|
2282
|
-
...
|
|
2327
|
+
...y?.calendar
|
|
2283
2328
|
},
|
|
2284
|
-
children: [
|
|
2329
|
+
children: [W(P.year, P.month, se, !0), W(F.year, F.month, ue, !1)]
|
|
2285
2330
|
});
|
|
2286
2331
|
};
|
|
2287
2332
|
//#endregion
|
|
2288
|
-
export {
|
|
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, F as calculateNextFocusedDate, G as clampTime, k as compareJalaliDates, ie as darkTheme, B as formatJalaliDate, W as formatTimeSegment, fe as formatTimeString, C as generateJalaliCalendarGrid, I as getAriaDayLabel, de as getCurrentTime, _ as getDaysInJalaliMonth, _e as getEventsForDate, E as getJalaliDayOfWeek, j as getJalaliMonthRange, A as getJalaliWeekRange, ye as getOfficialHoliday, b as getTodayJalali, v as gregorianToJalali, ee as isJalaliDateBetween, M as isJalaliDateSelectable, ve as isJalaliFriday, g as isJalaliLeapYear, N as isJalaliMonthSelectable, P as isJalaliYearSelectable, x as isSameJalaliDay, y as jalaliToGregorian, T as jalaliToJsDate, w as jsDateToJalali, V as lightTheme, K as parseAndValidateJalaliString, S as toJalaliDate, z as toLatinDigits, R as toPersianDigits, ne as useCalendarKeyboard, te as useJalaliDatePicker, H as useTheme };
|
|
2289
2334
|
|
|
2290
2335
|
//# sourceMappingURL=index.mjs.map
|