persian-date-kit 0.0.3 → 0.0.4
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/LICENSE +21 -0
- package/dist/PersianDatePicker-Bcz6VNVe.cjs +1 -0
- package/dist/PersianDatePicker-DFMNtlIF.js +1171 -0
- package/dist/components/PersianDatePicker.d.ts +3 -57
- package/dist/components/PersianDatePicker.d.ts.map +1 -1
- package/dist/components/PersianDateRangePicker.d.ts +4 -45
- package/dist/components/PersianDateRangePicker.d.ts.map +1 -1
- package/dist/components/_CalendarHeader.d.ts +17 -0
- package/dist/components/_CalendarHeader.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +373 -261
- package/dist/react-hook-form.cjs +1 -1
- package/dist/react-hook-form.d.ts +4 -1
- package/dist/react-hook-form.d.ts.map +1 -1
- package/dist/react-hook-form.mjs +1 -1
- package/dist/styles.css +5 -0
- package/dist/types/shared.d.ts +120 -0
- package/dist/types/shared.d.ts.map +1 -0
- package/dist/utils/usePopoverPosition.d.ts +29 -0
- package/dist/utils/usePopoverPosition.d.ts.map +1 -0
- package/package.json +31 -2
- package/dist/PersianDatePicker-BicyzfQH.js +0 -1028
- package/dist/PersianDatePicker-CCakBpBo.cjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,113 +1,150 @@
|
|
|
1
|
-
import { t as b, b as
|
|
2
|
-
import { P as
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import * as
|
|
5
|
-
|
|
1
|
+
import { t as b, u as Ke, b as ze, i as O, a as We, p as qe, c as Y, d as S, f as C, e as he, g as D } from "./PersianDatePicker-DFMNtlIF.js";
|
|
2
|
+
import { P as it, k as lt, h as ut, l as ct, j as pt } from "./PersianDatePicker-DFMNtlIF.js";
|
|
3
|
+
import { jsxs as L, jsx as d, Fragment as Qe } from "react/jsx-runtime";
|
|
4
|
+
import * as o from "react";
|
|
5
|
+
import { createPortal as Xe } from "react-dom";
|
|
6
|
+
function s(...u) {
|
|
6
7
|
return u.filter(Boolean).join(" ");
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
9
|
+
function Ze(u) {
|
|
10
|
+
return We(u).formatted;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
12
|
+
function et(u) {
|
|
13
|
+
return qe(u, { allowLooseSeparators: !0 });
|
|
13
14
|
}
|
|
14
15
|
function k() {
|
|
15
16
|
const u = /* @__PURE__ */ new Date();
|
|
16
17
|
return u.setHours(0, 0, 0, 0), u;
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function U(u) {
|
|
19
20
|
const { start: a, end: c } = u;
|
|
20
21
|
return a && c && D(a, c) > 0 ? { start: c, end: a } : u;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
return D(u,
|
|
23
|
+
function tt(u, a, c) {
|
|
24
|
+
const v = D(a, c) <= 0 ? a : c, y = D(a, c) <= 0 ? c : a;
|
|
25
|
+
return D(u, v) >= 0 && D(u, y) <= 0;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function ot(u) {
|
|
27
28
|
const {
|
|
28
29
|
value: a,
|
|
29
30
|
onChange: c,
|
|
30
|
-
minDate:
|
|
31
|
+
minDate: v,
|
|
31
32
|
maxDate: y,
|
|
32
|
-
disabled:
|
|
33
|
-
inputVariant:
|
|
34
|
-
placeholder:
|
|
35
|
-
rangeSeparator:
|
|
36
|
-
placeholderStart:
|
|
37
|
-
placeholderEnd:
|
|
38
|
-
open:
|
|
39
|
-
onOpenChange:
|
|
40
|
-
mode:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
disabled: R,
|
|
34
|
+
inputVariant: G = "two",
|
|
35
|
+
placeholder: xe,
|
|
36
|
+
rangeSeparator: P = " - ",
|
|
37
|
+
placeholderStart: _e,
|
|
38
|
+
placeholderEnd: be,
|
|
39
|
+
open: H,
|
|
40
|
+
onOpenChange: ne,
|
|
41
|
+
mode: m = "popover",
|
|
42
|
+
popover: ke,
|
|
43
|
+
formatValue: g = Ze,
|
|
44
|
+
parseValue: K = et,
|
|
45
|
+
weekdays: T,
|
|
44
46
|
monthLabels: h,
|
|
45
|
-
renderMonthLabel:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
renderMonthLabel: z,
|
|
48
|
+
prevIcon: De,
|
|
49
|
+
nextIcon: Re,
|
|
50
|
+
className: we,
|
|
51
|
+
classes: i
|
|
52
|
+
} = u, ae = o.useRef(null), A = o.useRef(null), W = o.useRef(null), q = o.useRef(null), Q = o.useRef(null), re = o.useRef(null), [Ne, Se] = o.useState(!1), [Ce, Pe] = o.useState(!1), f = m === "inline" ? !0 : H ?? Ce, J = o.useCallback(
|
|
53
|
+
(e) => {
|
|
54
|
+
ne?.(e), m !== "inline" && H === void 0 && Pe(e);
|
|
55
|
+
},
|
|
56
|
+
[m, ne, H]
|
|
57
|
+
);
|
|
58
|
+
o.useEffect(() => {
|
|
59
|
+
Se(!0);
|
|
60
|
+
}, []);
|
|
61
|
+
const [X, oe] = o.useState(
|
|
62
|
+
"start"
|
|
63
|
+
), [x, w] = o.useState("days"), [Me, M] = o.useState(() => {
|
|
53
64
|
const e = a.start ?? a.end ?? k(), t = b(e).jy;
|
|
54
65
|
return t - t % 12;
|
|
55
|
-
}), [
|
|
66
|
+
}), [F, B] = o.useState(() => {
|
|
56
67
|
const e = a.start ?? a.end ?? k();
|
|
57
68
|
return b(e).jy;
|
|
58
|
-
}), [
|
|
69
|
+
}), [l, E] = o.useState(() => {
|
|
59
70
|
const e = a.start ?? a.end ?? k(), t = b(e);
|
|
60
71
|
return { jy: t.jy, jm: t.jm };
|
|
61
|
-
}), [
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
}), [$, j] = o.useState(
|
|
73
|
+
() => a.start ?? a.end ?? k()
|
|
74
|
+
), [se, de] = o.useState(null), [ie, le] = o.useState(
|
|
75
|
+
() => a.start ? g(a.start) : ""
|
|
76
|
+
), [ue, ce] = o.useState(
|
|
77
|
+
() => a.end ? g(a.end) : ""
|
|
78
|
+
), [pe, V] = o.useState(() => {
|
|
79
|
+
const e = a.start ? g(a.start) : "", t = a.end ? g(a.end) : "";
|
|
80
|
+
return !e && !t ? "" : e && !t ? `${e}${P}` : `${e}${P}${t}`;
|
|
64
81
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const e = a.start ?
|
|
68
|
-
|
|
82
|
+
o.useEffect(() => {
|
|
83
|
+
le(a.start ? g(a.start) : ""), ce(a.end ? g(a.end) : "");
|
|
84
|
+
const e = a.start ? g(a.start) : "", t = a.end ? g(a.end) : "";
|
|
85
|
+
V(!e && !t ? "" : e && !t ? `${e}${P}` : `${e}${P}${t}`);
|
|
69
86
|
const n = a.start ?? a.end ?? k(), r = b(n);
|
|
70
|
-
|
|
71
|
-
}, [
|
|
72
|
-
if (
|
|
87
|
+
E({ jy: r.jy, jm: r.jm }), j(n), B(r.jy), M(r.jy - r.jy % 12);
|
|
88
|
+
}, [g, P, a.end, a.start]), o.useEffect(() => {
|
|
89
|
+
if (m !== "popover" || !f) return;
|
|
73
90
|
const e = (t) => {
|
|
74
|
-
const n =
|
|
75
|
-
|
|
91
|
+
const n = ae.current;
|
|
92
|
+
if (!n) return;
|
|
93
|
+
const r = A.current;
|
|
94
|
+
t.target instanceof Node && !n.contains(t.target) && !(r && r.contains(t.target)) && J(!1);
|
|
76
95
|
};
|
|
77
96
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
78
|
-
}, [
|
|
79
|
-
f &&
|
|
80
|
-
}, [f])
|
|
97
|
+
}, [m, f, J]), o.useEffect(() => {
|
|
98
|
+
f && re.current?.focus();
|
|
99
|
+
}, [f]);
|
|
100
|
+
const N = ke ?? {}, fe = N.portal ?? !0, Ee = G === "single" ? W : X === "start" ? q : Q, { style: $e } = Ke(
|
|
101
|
+
m === "popover" && f && fe,
|
|
102
|
+
Ee,
|
|
103
|
+
A,
|
|
104
|
+
{
|
|
105
|
+
gutter: N.gutter,
|
|
106
|
+
padding: N.padding,
|
|
107
|
+
strategy: N.strategy,
|
|
108
|
+
placements: N.placements,
|
|
109
|
+
align: N.align ?? "end"
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
o.useEffect(() => {
|
|
81
113
|
if (!f) return;
|
|
82
|
-
const e = b(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
114
|
+
const e = b($);
|
|
115
|
+
E(
|
|
116
|
+
(t) => t.jy === e.jy && t.jm === e.jm ? t : { jy: e.jy, jm: e.jm }
|
|
117
|
+
);
|
|
118
|
+
}, [$, f]);
|
|
119
|
+
const Le = o.useMemo(() => z ? z(l.jy, l.jm) : h && h.length === 12 ? `${h[l.jm - 1] ?? String(l.jm)} ${l.jy}` : `${l.jy} / ${l.jm}`, [h, z, l.jm, l.jy]), Te = o.useMemo(() => T && T.length === 7 ? T : ["1", "2", "3", "4", "5", "6", "7"], [T]), Ae = o.useMemo(
|
|
120
|
+
() => ze({ jy: l.jy, jm: l.jm }),
|
|
121
|
+
[l.jm, l.jy]
|
|
122
|
+
);
|
|
123
|
+
function Z(e) {
|
|
124
|
+
if (R) return;
|
|
125
|
+
oe(e), J(!0);
|
|
89
126
|
const t = (e === "start" ? a.start : a.end) ?? a.start ?? a.end ?? k(), n = b(t);
|
|
90
|
-
|
|
127
|
+
E({ jy: n.jy, jm: n.jm }), j(t), w("days"), B(n.jy), M(n.jy - n.jy % 12);
|
|
91
128
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
129
|
+
function me() {
|
|
130
|
+
J(!1), w("days"), m === "popover" && (G === "single" ? W.current?.focus() : (X === "start" ? q : Q).current?.focus());
|
|
94
131
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
132
|
+
function ve(e) {
|
|
133
|
+
return R ? !0 : !S(e.gregorian, v, y);
|
|
97
134
|
}
|
|
98
|
-
function
|
|
135
|
+
function ye(e, t) {
|
|
99
136
|
const n = t.trim();
|
|
100
137
|
if (!n) {
|
|
101
|
-
const _ =
|
|
138
|
+
const _ = U({ ...a, [e]: null });
|
|
102
139
|
c(_);
|
|
103
140
|
return;
|
|
104
141
|
}
|
|
105
|
-
const r =
|
|
106
|
-
if (!r || !
|
|
107
|
-
const p =
|
|
142
|
+
const r = K(n);
|
|
143
|
+
if (!r || !S(r, v, y)) return;
|
|
144
|
+
const p = U({ ...a, [e]: r });
|
|
108
145
|
c(p);
|
|
109
146
|
}
|
|
110
|
-
function
|
|
147
|
+
function Je(e) {
|
|
111
148
|
const t = e.trim();
|
|
112
149
|
if (!t) {
|
|
113
150
|
c({ start: null, end: null });
|
|
@@ -115,250 +152,325 @@ function He(u) {
|
|
|
115
152
|
}
|
|
116
153
|
const n = t.match(/\d{4}[^\d]\d{1,2}[^\d]\d{1,2}/g) ?? [], r = n[0], p = n[1];
|
|
117
154
|
if (!r) return;
|
|
118
|
-
const _ =
|
|
119
|
-
_ &&
|
|
155
|
+
const _ = K(r), te = p ? K(p) : null;
|
|
156
|
+
_ && S(_, v, y) && (te && !S(te, v, y) || c(U({ start: _, end: te })));
|
|
120
157
|
}
|
|
121
|
-
function
|
|
122
|
-
if (f && !
|
|
158
|
+
function Fe(e) {
|
|
159
|
+
if (f && !R) {
|
|
123
160
|
if (e.key === "Escape") {
|
|
124
|
-
e.preventDefault(),
|
|
161
|
+
e.preventDefault(), me();
|
|
125
162
|
return;
|
|
126
163
|
}
|
|
127
164
|
if (x === "days") {
|
|
128
165
|
if (e.key === "ArrowLeft") {
|
|
129
|
-
e.preventDefault(),
|
|
166
|
+
e.preventDefault(), j((t) => Y(t, -1));
|
|
130
167
|
return;
|
|
131
168
|
}
|
|
132
169
|
if (e.key === "ArrowRight") {
|
|
133
|
-
e.preventDefault(),
|
|
170
|
+
e.preventDefault(), j((t) => Y(t, 1));
|
|
134
171
|
return;
|
|
135
172
|
}
|
|
136
173
|
if (e.key === "ArrowUp") {
|
|
137
|
-
e.preventDefault(),
|
|
174
|
+
e.preventDefault(), j((t) => Y(t, -7));
|
|
138
175
|
return;
|
|
139
176
|
}
|
|
140
177
|
if (e.key === "ArrowDown") {
|
|
141
|
-
e.preventDefault(),
|
|
178
|
+
e.preventDefault(), j((t) => Y(t, 7));
|
|
142
179
|
return;
|
|
143
180
|
}
|
|
144
181
|
if (e.key === "PageUp") {
|
|
145
|
-
e.preventDefault(),
|
|
182
|
+
e.preventDefault(), I(-1);
|
|
146
183
|
return;
|
|
147
184
|
}
|
|
148
185
|
if (e.key === "PageDown") {
|
|
149
|
-
e.preventDefault(),
|
|
186
|
+
e.preventDefault(), I(1);
|
|
150
187
|
return;
|
|
151
188
|
}
|
|
152
189
|
if (e.key === "Enter") {
|
|
153
|
-
if (e.preventDefault(), !
|
|
154
|
-
|
|
190
|
+
if (e.preventDefault(), !S($, v, y)) return;
|
|
191
|
+
je($);
|
|
155
192
|
}
|
|
156
193
|
}
|
|
157
194
|
}
|
|
158
195
|
}
|
|
159
|
-
function
|
|
160
|
-
const t = C({
|
|
161
|
-
|
|
196
|
+
function I(e) {
|
|
197
|
+
const t = C({
|
|
198
|
+
jy: l.jy,
|
|
199
|
+
jm: l.jm,
|
|
200
|
+
jd: 1
|
|
201
|
+
}), n = he(t, e), r = b(n);
|
|
202
|
+
E({ jy: r.jy, jm: r.jm }), j((p) => he(p, e));
|
|
162
203
|
}
|
|
163
|
-
function
|
|
204
|
+
function Be(e) {
|
|
164
205
|
const t = C({ jy: e, jm: 1, jd: 1 }), n = C({ jy: e + 1, jm: 1, jd: 1 });
|
|
165
206
|
return { start: t, endExclusive: n };
|
|
166
207
|
}
|
|
167
|
-
function
|
|
208
|
+
function Ve(e, t) {
|
|
168
209
|
const n = C({ jy: e, jm: t, jd: 1 }), r = t === 12 ? { jy: e + 1, jm: 1 } : { jy: e, jm: t + 1 }, p = C({ jy: r.jy, jm: r.jm, jd: 1 });
|
|
169
210
|
return { start: n, endExclusive: p };
|
|
170
211
|
}
|
|
171
|
-
function
|
|
172
|
-
return !(
|
|
212
|
+
function ge(e) {
|
|
213
|
+
return !(v && D(e.endExclusive, v) <= 0 || y && D(e.start, y) > 0);
|
|
173
214
|
}
|
|
174
|
-
function
|
|
215
|
+
function Ie() {
|
|
175
216
|
if (x === "days") {
|
|
176
|
-
|
|
177
|
-
const e =
|
|
178
|
-
|
|
217
|
+
w("years");
|
|
218
|
+
const e = l.jy;
|
|
219
|
+
B(e), M(e - e % 12);
|
|
179
220
|
} else
|
|
180
|
-
|
|
221
|
+
w("days");
|
|
181
222
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
223
|
+
function Oe(e) {
|
|
224
|
+
B(e), w("months");
|
|
184
225
|
}
|
|
185
|
-
function
|
|
186
|
-
const t = { jy:
|
|
187
|
-
|
|
226
|
+
function Ye(e) {
|
|
227
|
+
const t = { jy: F, jm: e };
|
|
228
|
+
E(t), j(
|
|
229
|
+
() => C({ jy: t.jy, jm: t.jm, jd: 1 })
|
|
230
|
+
), w("days");
|
|
188
231
|
}
|
|
189
|
-
function
|
|
190
|
-
if (!
|
|
232
|
+
function je(e) {
|
|
233
|
+
if (!S(e, v, y)) return;
|
|
191
234
|
const t = a.start, n = a.end;
|
|
192
235
|
if (!t || t && n) {
|
|
193
|
-
c({ start: e, end: null }),
|
|
236
|
+
c({ start: e, end: null }), oe("end");
|
|
194
237
|
return;
|
|
195
238
|
}
|
|
196
|
-
const r =
|
|
197
|
-
c(r),
|
|
239
|
+
const r = U({ start: t, end: e });
|
|
240
|
+
c(r), m === "popover" && me();
|
|
198
241
|
}
|
|
199
|
-
const
|
|
200
|
-
function
|
|
201
|
-
const t =
|
|
242
|
+
const Ue = a.end ?? se, Ge = !!(a.start && !a.end && se);
|
|
243
|
+
function He(e) {
|
|
244
|
+
const t = s(
|
|
202
245
|
"dvx-pdp__day",
|
|
203
|
-
|
|
204
|
-
!e.inCurrentMonth &&
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
), n = a.start, r = n ?
|
|
208
|
-
return n &&
|
|
246
|
+
i?.day,
|
|
247
|
+
!e.inCurrentMonth && s("dvx-pdp__day--outside", i?.dayOutside),
|
|
248
|
+
ve(e) && s("dvx-pdp__day--disabled", i?.dayDisabled),
|
|
249
|
+
O(e.gregorian, k()) && s("dvx-pdp__day--today", i?.dayToday)
|
|
250
|
+
), n = a.start, r = n ? Ue : null;
|
|
251
|
+
return n && O(e.gregorian, n) ? s(t, "dvx-pdp__day--rangeStart", i?.dayRangeStart) : r && a.end && O(e.gregorian, a.end) ? s(t, "dvx-pdp__day--rangeEnd", i?.dayRangeEnd) : n && r && (a.end || Ge) && tt(e.gregorian, n, r) ? s(t, "dvx-pdp__day--inRange", i?.dayInRange) : t;
|
|
209
252
|
}
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
253
|
+
const ee = /* @__PURE__ */ L(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
ref: re,
|
|
257
|
+
tabIndex: -1,
|
|
258
|
+
className: "dvx-pdp__calendar",
|
|
259
|
+
onKeyDown: Fe,
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ L("div", { className: s("dvx-pdp__header", i?.header), children: [
|
|
262
|
+
/* @__PURE__ */ d(
|
|
263
|
+
"button",
|
|
264
|
+
{
|
|
265
|
+
type: "button",
|
|
266
|
+
className: s("dvx-pdp__nav", i?.navButton),
|
|
267
|
+
onClick: x === "days" ? () => I(-1) : () => M((e) => e - 12),
|
|
268
|
+
"aria-label": "Previous month",
|
|
269
|
+
children: De ?? "‹"
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
/* @__PURE__ */ d(
|
|
273
|
+
"button",
|
|
274
|
+
{
|
|
275
|
+
type: "button",
|
|
276
|
+
className: s("dvx-pdp__monthLabel", i?.monthLabel),
|
|
277
|
+
onClick: Ie,
|
|
278
|
+
"aria-label": "Choose month and year",
|
|
279
|
+
children: x === "days" ? Le : F
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
/* @__PURE__ */ d(
|
|
283
|
+
"button",
|
|
284
|
+
{
|
|
285
|
+
type: "button",
|
|
286
|
+
className: s("dvx-pdp__nav", i?.navButton),
|
|
287
|
+
onClick: x === "days" ? () => I(1) : () => M((e) => e + 12),
|
|
288
|
+
"aria-label": "Next month",
|
|
289
|
+
children: Re ?? "›"
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] }),
|
|
293
|
+
x === "days" ? /* @__PURE__ */ L("div", { className: s("dvx-pdp__grid", i?.grid), children: [
|
|
294
|
+
/* @__PURE__ */ d("div", { className: "dvx-pdp__weekdays", "aria-hidden": "true", children: Te.map((e, t) => /* @__PURE__ */ d(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
className: s("dvx-pdp__weekday", i?.weekday),
|
|
298
|
+
children: e
|
|
256
299
|
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
{
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
300
|
+
t
|
|
301
|
+
)) }),
|
|
302
|
+
/* @__PURE__ */ d("div", { className: "dvx-pdp__days", children: Ae.map((e, t) => /* @__PURE__ */ d("div", { className: "dvx-pdp__row", children: e.map((n) => {
|
|
303
|
+
const r = ve(n), p = O(n.gregorian, $);
|
|
304
|
+
return /* @__PURE__ */ d(
|
|
305
|
+
"button",
|
|
306
|
+
{
|
|
307
|
+
type: "button",
|
|
308
|
+
className: s(
|
|
309
|
+
He(n),
|
|
310
|
+
p && "dvx-pdp__day--focused"
|
|
311
|
+
),
|
|
312
|
+
disabled: r,
|
|
313
|
+
onClick: () => je(n.gregorian),
|
|
314
|
+
onMouseEnter: () => {
|
|
315
|
+
n.inCurrentMonth && (j(n.gregorian), a.start && !a.end && de(n.gregorian));
|
|
316
|
+
},
|
|
317
|
+
onMouseLeave: () => de(null),
|
|
318
|
+
children: n.jalali.jd
|
|
319
|
+
},
|
|
320
|
+
`${n.jalali.jy}-${n.jalali.jm}-${n.jalali.jd}`
|
|
321
|
+
);
|
|
322
|
+
}) }, t)) })
|
|
323
|
+
] }) : x === "years" ? /* @__PURE__ */ d("div", { className: "dvx-pdp__panel", children: /* @__PURE__ */ d("div", { className: "dvx-pdp__panelGrid", children: Array.from({ length: 12 }).map((e, t) => {
|
|
324
|
+
const n = Me + t, r = ge(
|
|
325
|
+
Be(n)
|
|
326
|
+
), p = n === l.jy;
|
|
327
|
+
return /* @__PURE__ */ d(
|
|
328
|
+
"button",
|
|
329
|
+
{
|
|
330
|
+
type: "button",
|
|
331
|
+
className: s(
|
|
332
|
+
"dvx-pdp__cell",
|
|
333
|
+
p && "dvx-pdp__cell--active"
|
|
334
|
+
),
|
|
335
|
+
disabled: !r,
|
|
336
|
+
onClick: () => Oe(n),
|
|
337
|
+
children: n
|
|
338
|
+
},
|
|
339
|
+
n
|
|
340
|
+
);
|
|
341
|
+
}) }) }) : /* @__PURE__ */ d("div", { className: "dvx-pdp__panel", children: /* @__PURE__ */ d("div", { className: "dvx-pdp__panelGrid", children: Array.from({ length: 12 }).map((e, t) => {
|
|
342
|
+
const n = t + 1, r = ge(
|
|
343
|
+
Ve(F, n)
|
|
344
|
+
), p = F === l.jy && n === l.jm, _ = h && h.length === 12 ? h[n - 1] ?? String(n) : String(n);
|
|
345
|
+
return /* @__PURE__ */ d(
|
|
346
|
+
"button",
|
|
347
|
+
{
|
|
348
|
+
type: "button",
|
|
349
|
+
className: s(
|
|
350
|
+
"dvx-pdp__cell",
|
|
351
|
+
p && "dvx-pdp__cell--active"
|
|
352
|
+
),
|
|
353
|
+
disabled: !r,
|
|
354
|
+
onClick: () => Ye(n),
|
|
355
|
+
children: _
|
|
356
|
+
},
|
|
357
|
+
n
|
|
358
|
+
);
|
|
359
|
+
}) }) })
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
return /* @__PURE__ */ L(
|
|
364
|
+
"div",
|
|
365
|
+
{
|
|
366
|
+
ref: ae,
|
|
367
|
+
className: s(
|
|
368
|
+
"dvx-pdp",
|
|
369
|
+
m === "inline" && "dvx-pdp--inline",
|
|
370
|
+
we,
|
|
371
|
+
i?.root
|
|
325
372
|
),
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
{
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
373
|
+
dir: "rtl",
|
|
374
|
+
children: [
|
|
375
|
+
m === "inline" ? null : /* @__PURE__ */ d("div", { className: "dvx-pdp__control", children: G === "single" ? /* @__PURE__ */ d(
|
|
376
|
+
"input",
|
|
377
|
+
{
|
|
378
|
+
ref: W,
|
|
379
|
+
className: s("dvx-pdp__input", i?.input),
|
|
380
|
+
disabled: R,
|
|
381
|
+
placeholder: xe,
|
|
382
|
+
inputMode: "numeric",
|
|
383
|
+
autoComplete: "off",
|
|
384
|
+
value: pe,
|
|
385
|
+
onChange: (e) => V(e.target.value),
|
|
386
|
+
onClick: () => Z(X),
|
|
387
|
+
onBlur: () => Je(pe),
|
|
388
|
+
"aria-haspopup": "dialog",
|
|
389
|
+
"aria-expanded": f
|
|
390
|
+
}
|
|
391
|
+
) : /* @__PURE__ */ L(Qe, { children: [
|
|
392
|
+
/* @__PURE__ */ d(
|
|
393
|
+
"input",
|
|
394
|
+
{
|
|
395
|
+
ref: q,
|
|
396
|
+
className: s("dvx-pdp__input", i?.input),
|
|
397
|
+
disabled: R,
|
|
398
|
+
placeholder: _e,
|
|
399
|
+
inputMode: "numeric",
|
|
400
|
+
autoComplete: "off",
|
|
401
|
+
value: ie,
|
|
402
|
+
onChange: (e) => le(e.target.value),
|
|
403
|
+
onClick: () => Z("start"),
|
|
404
|
+
onBlur: () => ye("start", ie),
|
|
405
|
+
"aria-haspopup": "dialog",
|
|
406
|
+
"aria-expanded": f
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
/* @__PURE__ */ d(
|
|
410
|
+
"input",
|
|
411
|
+
{
|
|
412
|
+
ref: Q,
|
|
413
|
+
className: s("dvx-pdp__input", i?.input),
|
|
414
|
+
disabled: R,
|
|
415
|
+
placeholder: be,
|
|
416
|
+
inputMode: "numeric",
|
|
417
|
+
autoComplete: "off",
|
|
418
|
+
value: ue,
|
|
419
|
+
onChange: (e) => ce(e.target.value),
|
|
420
|
+
onClick: () => Z("end"),
|
|
421
|
+
onBlur: () => ye("end", ue),
|
|
422
|
+
"aria-haspopup": "dialog",
|
|
423
|
+
"aria-expanded": f
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
] }) }),
|
|
427
|
+
m === "inline" ? ee : f ? fe && Ne ? Xe(
|
|
428
|
+
/* @__PURE__ */ d(
|
|
429
|
+
"div",
|
|
430
|
+
{
|
|
431
|
+
ref: A,
|
|
432
|
+
className: s(
|
|
433
|
+
"dvx-pdp__popover",
|
|
434
|
+
"dvx-pdp__popover--portal",
|
|
435
|
+
i?.popover
|
|
436
|
+
),
|
|
437
|
+
dir: "rtl",
|
|
438
|
+
style: { ...$e, right: "auto", bottom: "auto" },
|
|
439
|
+
role: "dialog",
|
|
440
|
+
"aria-modal": "false",
|
|
441
|
+
children: ee
|
|
442
|
+
}
|
|
443
|
+
),
|
|
444
|
+
document.body
|
|
445
|
+
) : /* @__PURE__ */ d(
|
|
446
|
+
"div",
|
|
447
|
+
{
|
|
448
|
+
ref: A,
|
|
449
|
+
className: s("dvx-pdp__popover", i?.popover),
|
|
450
|
+
role: "dialog",
|
|
451
|
+
"aria-modal": "false",
|
|
452
|
+
children: ee
|
|
453
|
+
}
|
|
454
|
+
) : null
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
);
|
|
346
458
|
}
|
|
347
459
|
export {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
460
|
+
it as PersianDatePicker,
|
|
461
|
+
ot as PersianDateRangePicker,
|
|
462
|
+
Y as addDays,
|
|
463
|
+
he as addJalaliMonths,
|
|
464
|
+
ze as buildJalaliMonthGrid,
|
|
465
|
+
lt as clampToRange,
|
|
354
466
|
D as compareDays,
|
|
355
|
-
|
|
467
|
+
ut as formatJalali,
|
|
356
468
|
C as fromJalaliParts,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
469
|
+
ct as getJalaliMonthLength,
|
|
470
|
+
O as isSameDay,
|
|
471
|
+
S as isWithinRange,
|
|
472
|
+
qe as parseJalaliText,
|
|
473
|
+
pt as toGregorian,
|
|
474
|
+
We as toJalali,
|
|
363
475
|
b as toJalaliParts
|
|
364
476
|
};
|