@sauravluitel/date-time-picker-custom 1.0.0 → 1.0.1
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.
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { X as
|
|
3
|
-
import { format as X,
|
|
4
|
-
import { AnimatePresence as
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
for (var v in
|
|
16
|
-
v !== "key" && (
|
|
17
|
-
} else
|
|
18
|
-
return
|
|
19
|
-
$$typeof:
|
|
20
|
-
type:
|
|
21
|
-
key:
|
|
22
|
-
ref:
|
|
23
|
-
props:
|
|
1
|
+
import Me, { useState as z, useEffect as B, useRef as V } from "react";
|
|
2
|
+
import { X as Te, Calendar as Ne, ChevronLeft as fe, ChevronRight as me, Clock as ke, Check as Re } from "lucide-react";
|
|
3
|
+
import { format as X, isValid as ne, parse as ue, startOfMonth as _e, endOfMonth as we, eachDayOfInterval as Ee, getDay as Ae, subMonths as pe, addMonths as he, isSameDay as ge } from "date-fns";
|
|
4
|
+
import { AnimatePresence as ve, motion as le } from "framer-motion";
|
|
5
|
+
var ae = { exports: {} }, se = {};
|
|
6
|
+
var ye;
|
|
7
|
+
function De() {
|
|
8
|
+
if (ye) return se;
|
|
9
|
+
ye = 1;
|
|
10
|
+
var g = /* @__PURE__ */ Symbol.for("react.transitional.element"), C = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
11
|
+
function W(m, d, D) {
|
|
12
|
+
var M = null;
|
|
13
|
+
if (D !== void 0 && (M = "" + D), d.key !== void 0 && (M = "" + d.key), "key" in d) {
|
|
14
|
+
D = {};
|
|
15
|
+
for (var v in d)
|
|
16
|
+
v !== "key" && (D[v] = d[v]);
|
|
17
|
+
} else D = d;
|
|
18
|
+
return d = D.ref, {
|
|
19
|
+
$$typeof: g,
|
|
20
|
+
type: m,
|
|
21
|
+
key: M,
|
|
22
|
+
ref: d !== void 0 ? d : null,
|
|
23
|
+
props: D
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
return
|
|
26
|
+
return se.Fragment = C, se.jsx = W, se.jsxs = W, se;
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
function
|
|
31
|
-
return
|
|
32
|
-
function
|
|
28
|
+
var oe = {};
|
|
29
|
+
var xe;
|
|
30
|
+
function Ce() {
|
|
31
|
+
return xe || (xe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
32
|
+
function g(e) {
|
|
33
33
|
if (e == null) return null;
|
|
34
34
|
if (typeof e == "function")
|
|
35
|
-
return e.$$typeof ===
|
|
35
|
+
return e.$$typeof === A ? null : e.displayName || e.name || null;
|
|
36
36
|
if (typeof e == "string") return e;
|
|
37
37
|
switch (e) {
|
|
38
|
-
case
|
|
38
|
+
case y:
|
|
39
39
|
return "Fragment";
|
|
40
|
-
case
|
|
40
|
+
case J:
|
|
41
41
|
return "Profiler";
|
|
42
|
-
case
|
|
42
|
+
case T:
|
|
43
43
|
return "StrictMode";
|
|
44
|
-
case
|
|
44
|
+
case I:
|
|
45
45
|
return "Suspense";
|
|
46
|
-
case
|
|
46
|
+
case l:
|
|
47
47
|
return "SuspenseList";
|
|
48
|
-
case
|
|
48
|
+
case b:
|
|
49
49
|
return "Activity";
|
|
50
50
|
}
|
|
51
51
|
if (typeof e == "object")
|
|
52
52
|
switch (typeof e.tag == "number" && console.error(
|
|
53
53
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
54
54
|
), e.$$typeof) {
|
|
55
|
-
case
|
|
55
|
+
case E:
|
|
56
56
|
return "Portal";
|
|
57
|
-
case
|
|
57
|
+
case Y:
|
|
58
58
|
return e.displayName || "Context";
|
|
59
|
-
case
|
|
59
|
+
case U:
|
|
60
60
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
61
|
-
case
|
|
62
|
-
var
|
|
63
|
-
return e = e.displayName, e || (e =
|
|
64
|
-
case
|
|
65
|
-
return
|
|
61
|
+
case F:
|
|
62
|
+
var s = e.render;
|
|
63
|
+
return e = e.displayName, e || (e = s.displayName || s.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
64
|
+
case f:
|
|
65
|
+
return s = e.displayName || null, s !== null ? s : g(e.type) || "Memo";
|
|
66
66
|
case x:
|
|
67
|
-
|
|
67
|
+
s = e._payload, e = e._init;
|
|
68
68
|
try {
|
|
69
|
-
return
|
|
69
|
+
return g(e(s));
|
|
70
70
|
} catch {
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function C(e) {
|
|
76
76
|
return "" + e;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function W(e) {
|
|
79
79
|
try {
|
|
80
|
-
|
|
81
|
-
var
|
|
80
|
+
C(e);
|
|
81
|
+
var s = !1;
|
|
82
82
|
} catch {
|
|
83
|
-
|
|
83
|
+
s = !0;
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
var
|
|
88
|
-
return
|
|
89
|
-
|
|
85
|
+
if (s) {
|
|
86
|
+
s = console;
|
|
87
|
+
var i = s.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
88
|
+
return i.call(
|
|
89
|
+
s,
|
|
90
90
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
-
|
|
92
|
-
),
|
|
91
|
+
a
|
|
92
|
+
), C(e);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
if (e ===
|
|
95
|
+
function m(e) {
|
|
96
|
+
if (e === y) return "<>";
|
|
97
97
|
if (typeof e == "object" && e !== null && e.$$typeof === x)
|
|
98
98
|
return "<...>";
|
|
99
99
|
try {
|
|
100
|
-
var
|
|
101
|
-
return
|
|
100
|
+
var s = g(e);
|
|
101
|
+
return s ? "<" + s + ">" : "<...>";
|
|
102
102
|
} catch {
|
|
103
103
|
return "<...>";
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
var e =
|
|
106
|
+
function d() {
|
|
107
|
+
var e = j.A;
|
|
108
108
|
return e === null ? null : e.getOwner();
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function D() {
|
|
111
111
|
return Error("react-stack-top-frame");
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
if (
|
|
115
|
-
var
|
|
116
|
-
if (
|
|
113
|
+
function M(e) {
|
|
114
|
+
if (S.call(e, "key")) {
|
|
115
|
+
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
116
|
+
if (s && s.isReactWarning) return !1;
|
|
117
117
|
}
|
|
118
118
|
return e.key !== void 0;
|
|
119
119
|
}
|
|
120
|
-
function v(e,
|
|
121
|
-
function
|
|
122
|
-
|
|
120
|
+
function v(e, s) {
|
|
121
|
+
function i() {
|
|
122
|
+
H || (H = !0, console.error(
|
|
123
123
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
124
|
-
|
|
124
|
+
s
|
|
125
125
|
));
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
get:
|
|
127
|
+
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
128
|
+
get: i,
|
|
129
129
|
configurable: !0
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
var e =
|
|
134
|
-
return
|
|
132
|
+
function k() {
|
|
133
|
+
var e = g(this.type);
|
|
134
|
+
return K[e] || (K[e] = !0, console.error(
|
|
135
135
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
136
136
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
var
|
|
138
|
+
function P(e, s, i, a, n, c) {
|
|
139
|
+
var t = i.ref;
|
|
140
140
|
return e = {
|
|
141
|
-
$$typeof:
|
|
141
|
+
$$typeof: p,
|
|
142
142
|
type: e,
|
|
143
|
-
key:
|
|
144
|
-
props:
|
|
145
|
-
_owner:
|
|
146
|
-
}, (
|
|
143
|
+
key: s,
|
|
144
|
+
props: i,
|
|
145
|
+
_owner: a
|
|
146
|
+
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
|
|
147
147
|
enumerable: !1,
|
|
148
|
-
get:
|
|
148
|
+
get: k
|
|
149
149
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
150
150
|
configurable: !1,
|
|
151
151
|
enumerable: !1,
|
|
@@ -160,69 +160,69 @@ function Re() {
|
|
|
160
160
|
configurable: !1,
|
|
161
161
|
enumerable: !1,
|
|
162
162
|
writable: !0,
|
|
163
|
-
value:
|
|
163
|
+
value: n
|
|
164
164
|
}), Object.defineProperty(e, "_debugTask", {
|
|
165
165
|
configurable: !1,
|
|
166
166
|
enumerable: !1,
|
|
167
167
|
writable: !0,
|
|
168
|
-
value:
|
|
168
|
+
value: c
|
|
169
169
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
var
|
|
173
|
-
if (
|
|
174
|
-
if (
|
|
175
|
-
if (
|
|
176
|
-
for (
|
|
177
|
-
|
|
178
|
-
Object.freeze && Object.freeze(
|
|
171
|
+
function R(e, s, i, a, n, c) {
|
|
172
|
+
var t = s.children;
|
|
173
|
+
if (t !== void 0)
|
|
174
|
+
if (a)
|
|
175
|
+
if (_(t)) {
|
|
176
|
+
for (a = 0; a < t.length; a++)
|
|
177
|
+
L(t[a]);
|
|
178
|
+
Object.freeze && Object.freeze(t);
|
|
179
179
|
} else
|
|
180
180
|
console.error(
|
|
181
181
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
182
182
|
);
|
|
183
|
-
else
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
var
|
|
187
|
-
return
|
|
183
|
+
else L(t);
|
|
184
|
+
if (S.call(s, "key")) {
|
|
185
|
+
t = g(e);
|
|
186
|
+
var u = Object.keys(s).filter(function(h) {
|
|
187
|
+
return h !== "key";
|
|
188
188
|
});
|
|
189
|
-
|
|
189
|
+
a = 0 < u.length ? "{key: someKey, " + u.join(": ..., ") + ": ...}" : "{key: someKey}", te[t + a] || (u = 0 < u.length ? "{" + u.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
190
|
`A props object containing a "key" prop is being spread into JSX:
|
|
191
191
|
let props = %s;
|
|
192
192
|
<%s {...props} />
|
|
193
193
|
React keys must be passed directly to JSX without using spread:
|
|
194
194
|
let props = %s;
|
|
195
195
|
<%s key={someKey} {...props} />`,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
),
|
|
196
|
+
a,
|
|
197
|
+
t,
|
|
198
|
+
u,
|
|
199
|
+
t
|
|
200
|
+
), te[t + a] = !0);
|
|
201
201
|
}
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
for (var
|
|
205
|
-
|
|
206
|
-
} else
|
|
207
|
-
return
|
|
208
|
-
|
|
202
|
+
if (t = null, i !== void 0 && (W(i), t = "" + i), M(s) && (W(s.key), t = "" + s.key), "key" in s) {
|
|
203
|
+
i = {};
|
|
204
|
+
for (var o in s)
|
|
205
|
+
o !== "key" && (i[o] = s[o]);
|
|
206
|
+
} else i = s;
|
|
207
|
+
return t && v(
|
|
208
|
+
i,
|
|
209
209
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
210
|
-
),
|
|
210
|
+
), P(
|
|
211
211
|
e,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
t,
|
|
213
|
+
i,
|
|
214
|
+
d(),
|
|
215
|
+
n,
|
|
216
|
+
c
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
|
|
219
|
+
function L(e) {
|
|
220
|
+
$(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === x && (e._payload.status === "fulfilled" ? $(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
222
|
+
function $(e) {
|
|
223
|
+
return typeof e == "object" && e !== null && e.$$typeof === p;
|
|
224
224
|
}
|
|
225
|
-
var w =
|
|
225
|
+
var w = Me, p = /* @__PURE__ */ Symbol.for("react.transitional.element"), E = /* @__PURE__ */ Symbol.for("react.portal"), y = /* @__PURE__ */ Symbol.for("react.fragment"), T = /* @__PURE__ */ Symbol.for("react.strict_mode"), J = /* @__PURE__ */ Symbol.for("react.profiler"), U = /* @__PURE__ */ Symbol.for("react.consumer"), Y = /* @__PURE__ */ Symbol.for("react.context"), F = /* @__PURE__ */ Symbol.for("react.forward_ref"), I = /* @__PURE__ */ Symbol.for("react.suspense"), l = /* @__PURE__ */ Symbol.for("react.suspense_list"), f = /* @__PURE__ */ Symbol.for("react.memo"), x = /* @__PURE__ */ Symbol.for("react.lazy"), b = /* @__PURE__ */ Symbol.for("react.activity"), A = /* @__PURE__ */ Symbol.for("react.client.reference"), j = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, S = Object.prototype.hasOwnProperty, _ = Array.isArray, O = console.createTask ? console.createTask : function() {
|
|
226
226
|
return null;
|
|
227
227
|
};
|
|
228
228
|
w = {
|
|
@@ -230,471 +230,563 @@ React keys must be passed directly to JSX without using spread:
|
|
|
230
230
|
return e();
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
var
|
|
233
|
+
var H, K = {}, Q = w.react_stack_bottom_frame.bind(
|
|
234
234
|
w,
|
|
235
|
-
|
|
236
|
-
)(),
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
return
|
|
235
|
+
D
|
|
236
|
+
)(), ee = O(m(D)), te = {};
|
|
237
|
+
oe.Fragment = y, oe.jsx = function(e, s, i) {
|
|
238
|
+
var a = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
239
|
+
return R(
|
|
240
240
|
e,
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
s,
|
|
242
|
+
i,
|
|
243
243
|
!1,
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
a ? Error("react-stack-top-frame") : Q,
|
|
245
|
+
a ? O(m(e)) : ee
|
|
246
246
|
);
|
|
247
|
-
},
|
|
248
|
-
var
|
|
249
|
-
return
|
|
247
|
+
}, oe.jsxs = function(e, s, i) {
|
|
248
|
+
var a = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
249
|
+
return R(
|
|
250
250
|
e,
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
s,
|
|
252
|
+
i,
|
|
253
253
|
!0,
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
a ? Error("react-stack-top-frame") : Q,
|
|
255
|
+
a ? O(m(e)) : ee
|
|
256
256
|
);
|
|
257
257
|
};
|
|
258
|
-
})()),
|
|
258
|
+
})()), oe;
|
|
259
259
|
}
|
|
260
|
-
var
|
|
261
|
-
function
|
|
262
|
-
return
|
|
260
|
+
var be;
|
|
261
|
+
function Pe() {
|
|
262
|
+
return be || (be = 1, process.env.NODE_ENV === "production" ? ae.exports = De() : ae.exports = Ce()), ae.exports;
|
|
263
263
|
}
|
|
264
|
-
var
|
|
265
|
-
const
|
|
266
|
-
const [
|
|
264
|
+
var r = Pe();
|
|
265
|
+
const Se = (g) => {
|
|
266
|
+
const [C, W] = z(!1);
|
|
267
267
|
return B(() => {
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
return
|
|
272
|
-
}, [
|
|
273
|
-
},
|
|
274
|
-
icon:
|
|
275
|
-
value:
|
|
276
|
-
onChange:
|
|
277
|
-
onToggle:
|
|
278
|
-
placeholder:
|
|
279
|
-
error:
|
|
280
|
-
onClear:
|
|
268
|
+
const m = window.matchMedia(g);
|
|
269
|
+
m.matches !== C && W(m.matches);
|
|
270
|
+
const d = () => W(m.matches);
|
|
271
|
+
return m.addEventListener("change", d), () => m.removeEventListener("change", d);
|
|
272
|
+
}, [C, g]), C;
|
|
273
|
+
}, de = () => Se("(max-width: 768px)"), je = ({
|
|
274
|
+
icon: g,
|
|
275
|
+
value: C,
|
|
276
|
+
onChange: W,
|
|
277
|
+
onToggle: m,
|
|
278
|
+
placeholder: d,
|
|
279
|
+
error: D,
|
|
280
|
+
onClear: M,
|
|
281
281
|
mask: v,
|
|
282
|
-
onFocus:
|
|
283
|
-
onBlur:
|
|
282
|
+
onFocus: k,
|
|
283
|
+
onBlur: P,
|
|
284
|
+
disabled: R = !1
|
|
284
285
|
}) => {
|
|
285
|
-
const
|
|
286
|
-
if (
|
|
287
|
-
const l =
|
|
288
|
-
|
|
286
|
+
const L = de(), [$, w] = z(!1), [p, E] = z("down"), y = V(null), T = V(null), J = () => {
|
|
287
|
+
if (T.current) {
|
|
288
|
+
const l = T.current.getBoundingClientRect(), f = window.innerHeight - l.bottom, x = l.top;
|
|
289
|
+
f < 350 && x > f ? E("up") : E("down");
|
|
289
290
|
}
|
|
290
|
-
}, C = (l) => {
|
|
291
|
-
l && l.stopPropagation(), A(), i();
|
|
292
|
-
}, M = (l, u) => {
|
|
293
|
-
const g = parseInt(l, 10);
|
|
294
|
-
return isNaN(g) ? l : u === "month" ? Math.min(Math.max(g, 1), 12).toString().padStart(2, "0") : u === "day" ? Math.min(Math.max(g, 1), 31).toString().padStart(2, "0") : u === "hour" ? Math.min(Math.max(g, 0), 23).toString().padStart(2, "0") : u === "hour12" ? Math.min(Math.max(g, 1), 12).toString().padStart(2, "0") : u === "minsec" ? Math.min(Math.max(g, 0), 59).toString().padStart(2, "0") : l;
|
|
295
291
|
}, U = (l) => {
|
|
292
|
+
R || (l && l.stopPropagation(), J(), m());
|
|
293
|
+
}, Y = (l, f) => {
|
|
294
|
+
const x = parseInt(l, 10);
|
|
295
|
+
return isNaN(x) ? l : f === "month" ? Math.min(Math.max(x, 1), 12).toString().padStart(2, "0") : f === "day" ? Math.min(Math.max(x, 1), 31).toString().padStart(2, "0") : f === "hour" ? Math.min(Math.max(x, 0), 23).toString().padStart(2, "0") : f === "hour12" ? Math.min(Math.max(x, 1), 12).toString().padStart(2, "0") : f === "minsec" ? Math.min(Math.max(x, 0), 59).toString().padStart(2, "0") : l;
|
|
296
|
+
}, F = (l) => {
|
|
296
297
|
if (!v) return l;
|
|
297
298
|
if (v === "date") {
|
|
298
|
-
const
|
|
299
|
-
let
|
|
300
|
-
return
|
|
299
|
+
const f = l.replace(/[^0-9]/g, "");
|
|
300
|
+
let x = f.substring(0, 4), b = f.substring(4, 6), A = f.substring(6, 8), j = x;
|
|
301
|
+
return f.length > 4 ? (b.length === 2 && (b = Y(b, "month")), j += "/" + b) : f.length === 4 && l.length === 4 && (j += "/"), f.length > 6 ? (A.length === 2 && (A = Y(A, "day")), j += "/" + A) : f.length === 6 && l.length === 7 && (j += "/"), j;
|
|
301
302
|
}
|
|
302
303
|
if (v.includes("time")) {
|
|
303
|
-
const
|
|
304
|
-
let
|
|
305
|
-
|
|
306
|
-
let
|
|
307
|
-
|
|
308
|
-
let _ =
|
|
309
|
-
if (
|
|
310
|
-
let
|
|
311
|
-
if (
|
|
312
|
-
if (
|
|
313
|
-
if (_ += ":",
|
|
314
|
-
let
|
|
315
|
-
|
|
304
|
+
const f = v.endsWith("-ampm"), x = v.includes("seconds"), b = l.replace(/[^0-9]/g, ""), A = l.toLowerCase().match(/[ap]/);
|
|
305
|
+
let j = "";
|
|
306
|
+
f && A && (j = A[0] === "a" ? "AM" : "PM");
|
|
307
|
+
let S = b.substring(0, 2);
|
|
308
|
+
b.substring(2, 4), b.substring(4, 6);
|
|
309
|
+
let _ = S;
|
|
310
|
+
if (b.length >= 2 && (S.length === 2 && (S = Y(S, f ? "hour12" : "hour")), _ = S + ":", b.length > 2)) {
|
|
311
|
+
let O = b.substring(2, 4);
|
|
312
|
+
if (O.length === 2 && (O = Y(O, "minsec")), _ += O, b.length >= 4)
|
|
313
|
+
if (x) {
|
|
314
|
+
if (_ += ":", b.length > 4) {
|
|
315
|
+
let H = b.substring(4, 6);
|
|
316
|
+
H.length === 2 && (H = Y(H, "minsec")), _ += H, b.length >= 6 && f && (_ += " " + (j || ""));
|
|
316
317
|
}
|
|
317
|
-
} else
|
|
318
|
+
} else f && (_ += " " + (j || ""));
|
|
318
319
|
}
|
|
319
|
-
return
|
|
320
|
+
return f && j && !_.includes(j) && (_.includes(" ") || (_ += " "), _ += j), _.trimEnd();
|
|
320
321
|
}
|
|
321
322
|
return l;
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
}, I = (l) => {
|
|
324
|
+
if (R) return;
|
|
325
|
+
const f = l.target.value, x = F(f);
|
|
326
|
+
W(x);
|
|
325
327
|
};
|
|
326
|
-
return /* @__PURE__ */
|
|
328
|
+
return /* @__PURE__ */ r.jsxs(
|
|
327
329
|
"div",
|
|
328
330
|
{
|
|
329
|
-
ref:
|
|
330
|
-
className: `input-container glass-card ${
|
|
331
|
-
onClick:
|
|
331
|
+
ref: T,
|
|
332
|
+
className: `input-container glass-card ${$ ? "focused" : ""} ${D ? "error" : ""} ${R ? "disabled" : ""} drop-${p}`,
|
|
333
|
+
onClick: U,
|
|
332
334
|
children: [
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ r.jsx("div", { className: "input-icon-wrapper", children: /* @__PURE__ */ r.jsx(g, { size: 18, className: "input-icon" }) }),
|
|
336
|
+
/* @__PURE__ */ r.jsx(
|
|
335
337
|
"input",
|
|
336
338
|
{
|
|
337
|
-
ref:
|
|
339
|
+
ref: y,
|
|
338
340
|
type: "text",
|
|
339
|
-
placeholder:
|
|
341
|
+
placeholder: d,
|
|
340
342
|
className: "shared-input",
|
|
341
|
-
value:
|
|
342
|
-
onChange:
|
|
343
|
-
readOnly:
|
|
343
|
+
value: C,
|
|
344
|
+
onChange: I,
|
|
345
|
+
readOnly: L || R,
|
|
344
346
|
onFocus: (l) => {
|
|
345
|
-
|
|
347
|
+
R || (w(!0), J(), k && k(l));
|
|
346
348
|
},
|
|
347
349
|
onBlur: (l) => {
|
|
348
|
-
|
|
350
|
+
w(!1), P && P(l);
|
|
349
351
|
},
|
|
350
352
|
onClick: (l) => {
|
|
351
|
-
|
|
353
|
+
if (R) {
|
|
354
|
+
l.stopPropagation();
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
L ? U(l) : l.stopPropagation();
|
|
352
358
|
}
|
|
353
359
|
}
|
|
354
360
|
),
|
|
355
|
-
|
|
356
|
-
l.stopPropagation(),
|
|
357
|
-
}, children: /* @__PURE__ */
|
|
361
|
+
!R && C && M && /* @__PURE__ */ r.jsx("button", { type: "button", className: "clear-btn", onClick: (l) => {
|
|
362
|
+
l.stopPropagation(), M();
|
|
363
|
+
}, children: /* @__PURE__ */ r.jsx(Te, { size: 14 }) })
|
|
358
364
|
]
|
|
359
365
|
}
|
|
360
366
|
);
|
|
361
|
-
},
|
|
362
|
-
|
|
367
|
+
}, Ie = ({
|
|
368
|
+
value: g,
|
|
369
|
+
onChange: C,
|
|
370
|
+
placeholder: W = "YYYY/MM/DD",
|
|
371
|
+
name: m,
|
|
372
|
+
onBlur: d,
|
|
373
|
+
disabled: D = !1
|
|
374
|
+
}) => {
|
|
375
|
+
const M = de(), [v, k] = z(!1), [P, R] = z("calendar"), L = (n) => {
|
|
376
|
+
if (!n) return null;
|
|
377
|
+
if (n instanceof Date) return ne(n) ? n : null;
|
|
378
|
+
if (typeof n == "string") {
|
|
379
|
+
const t = n.replace(/\//g, "-"), u = ue(t, "yyyy-MM-dd", /* @__PURE__ */ new Date());
|
|
380
|
+
if (ne(u)) return u;
|
|
381
|
+
const o = ue(t, "yyyy/MM/dd", /* @__PURE__ */ new Date());
|
|
382
|
+
if (ne(o)) return o;
|
|
383
|
+
}
|
|
384
|
+
const c = new Date(n);
|
|
385
|
+
return ne(c) ? c : null;
|
|
386
|
+
}, [$, w] = z(() => {
|
|
387
|
+
const n = L(g);
|
|
388
|
+
return n ? X(n, "yyyy/MM/dd") : "";
|
|
389
|
+
}), [p, E] = z(() => L(g) || /* @__PURE__ */ new Date()), [y, T] = z(() => L(g) || /* @__PURE__ */ new Date()), [J, U] = z(!1), Y = V(null), F = V(null), I = V(null), l = V(null), f = V(null), x = V(0), b = Array.from({ length: 151 }, (n, c) => (/* @__PURE__ */ new Date()).getFullYear() - 100 + c), A = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], j = new Date(p.getFullYear(), p.getMonth() + 1, 0).getDate(), S = Array.from({ length: j }, (n, c) => c + 1);
|
|
363
390
|
B(() => {
|
|
364
|
-
if (!
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
391
|
+
if (!J && !v) {
|
|
392
|
+
const n = L(g);
|
|
393
|
+
if (n) {
|
|
394
|
+
const c = X(n, "yyyy/MM/dd");
|
|
395
|
+
w(c), T(n), E(n);
|
|
368
396
|
} else
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
397
|
+
w(""), E(/* @__PURE__ */ new Date());
|
|
398
|
+
}
|
|
399
|
+
}, [g, J, v]), B(() => {
|
|
400
|
+
if (v && M) {
|
|
401
|
+
const n = () => {
|
|
402
|
+
const u = b.indexOf(p.getFullYear());
|
|
403
|
+
F.current && u !== -1 && (F.current.scrollTop = u * 32), I.current && (I.current.scrollTop = p.getMonth() * 32), l.current && (l.current.scrollTop = (p.getDate() - 1) * 32);
|
|
375
404
|
};
|
|
376
|
-
|
|
377
|
-
const
|
|
405
|
+
n();
|
|
406
|
+
const c = setTimeout(n, 50), t = setTimeout(n, 300);
|
|
378
407
|
return () => {
|
|
379
|
-
clearTimeout(
|
|
408
|
+
clearTimeout(c), clearTimeout(t);
|
|
380
409
|
};
|
|
381
410
|
}
|
|
382
|
-
}, [
|
|
383
|
-
const
|
|
384
|
-
if (!
|
|
385
|
-
|
|
386
|
-
|
|
411
|
+
}, [v, M]);
|
|
412
|
+
const _ = () => {
|
|
413
|
+
if (!D) {
|
|
414
|
+
if (!v) {
|
|
415
|
+
const n = L(g) || /* @__PURE__ */ new Date();
|
|
416
|
+
E(n), T(n), R("calendar"), x.current = Date.now();
|
|
417
|
+
}
|
|
418
|
+
k(!v);
|
|
387
419
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
420
|
+
}, O = (n) => {
|
|
421
|
+
const c = n ? X(n, "yyyy-MM-dd") : "";
|
|
422
|
+
C && C({
|
|
423
|
+
target: {
|
|
424
|
+
name: m,
|
|
425
|
+
value: c
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
}, H = () => {
|
|
429
|
+
O(p), w(X(p, "yyyy/MM/dd")), k(!1);
|
|
430
|
+
}, K = (n) => {
|
|
431
|
+
if (w(n), n === "") {
|
|
432
|
+
O(null), E(/* @__PURE__ */ new Date());
|
|
394
433
|
return;
|
|
395
434
|
}
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
},
|
|
399
|
-
|
|
400
|
-
},
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
},
|
|
404
|
-
const
|
|
405
|
-
|
|
435
|
+
const c = ue(n, "yyyy/MM/dd", /* @__PURE__ */ new Date());
|
|
436
|
+
ne(c) && (O(c), T(c), E(c));
|
|
437
|
+
}, Q = (n) => {
|
|
438
|
+
M ? E(n) : (O(n), w(X(n, "yyyy/MM/dd")), k(!1));
|
|
439
|
+
}, ee = (n) => {
|
|
440
|
+
const c = new Date(y);
|
|
441
|
+
c.setFullYear(n), T(c), R("calendar");
|
|
442
|
+
}, te = (n) => {
|
|
443
|
+
const c = new Date(y);
|
|
444
|
+
c.setMonth(n), T(c), R("calendar");
|
|
406
445
|
};
|
|
407
446
|
B(() => {
|
|
408
|
-
const
|
|
409
|
-
|
|
447
|
+
const n = (c) => {
|
|
448
|
+
Y.current && !Y.current.contains(c.target) && k(!1);
|
|
410
449
|
};
|
|
411
|
-
return document.addEventListener("mousedown",
|
|
412
|
-
}, []), B(() => (
|
|
450
|
+
return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
451
|
+
}, []), B(() => (M && v ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
413
452
|
document.body.style.overflow = "";
|
|
414
|
-
}), [
|
|
415
|
-
const
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
453
|
+
}), [v, M]);
|
|
454
|
+
const e = () => /* @__PURE__ */ r.jsxs("div", { className: "selector-view", children: [
|
|
455
|
+
/* @__PURE__ */ r.jsx("div", { className: "calendar-header", children: /* @__PURE__ */ r.jsx("span", { children: "Select Month" }) }),
|
|
456
|
+
/* @__PURE__ */ r.jsx("div", { className: "grid-selector column-3", children: A.map((n, c) => /* @__PURE__ */ r.jsx(
|
|
418
457
|
"button",
|
|
419
458
|
{
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
459
|
+
type: "button",
|
|
460
|
+
className: `select-cell ${y.getMonth() === c ? "active" : ""}`,
|
|
461
|
+
onClick: () => te(c),
|
|
462
|
+
children: n
|
|
423
463
|
},
|
|
424
|
-
|
|
464
|
+
n
|
|
425
465
|
)) })
|
|
426
|
-
] }),
|
|
427
|
-
const
|
|
428
|
-
return /* @__PURE__ */
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
/* @__PURE__ */
|
|
466
|
+
] }), s = () => {
|
|
467
|
+
const n = Math.floor(y.getFullYear() / 12) * 12, c = Array.from({ length: 12 }, (t, u) => n + u);
|
|
468
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "selector-view", children: [
|
|
469
|
+
/* @__PURE__ */ r.jsxs("div", { className: "calendar-header", children: [
|
|
470
|
+
/* @__PURE__ */ r.jsx("button", { type: "button", onClick: () => T(pe(y, 144)), children: /* @__PURE__ */ r.jsx(fe, { size: 16 }) }),
|
|
471
|
+
/* @__PURE__ */ r.jsx("span", { children: "Select Year" }),
|
|
472
|
+
/* @__PURE__ */ r.jsx("button", { type: "button", onClick: () => T(he(y, 144)), children: /* @__PURE__ */ r.jsx(me, { size: 16 }) })
|
|
433
473
|
] }),
|
|
434
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ r.jsx("div", { className: "grid-selector column-3", children: c.map((t) => /* @__PURE__ */ r.jsx(
|
|
435
475
|
"button",
|
|
436
476
|
{
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
477
|
+
type: "button",
|
|
478
|
+
className: `select-cell ${y.getFullYear() === t ? "active" : ""}`,
|
|
479
|
+
onClick: () => ee(t),
|
|
480
|
+
children: t
|
|
440
481
|
},
|
|
441
|
-
|
|
482
|
+
t
|
|
442
483
|
)) })
|
|
443
484
|
] });
|
|
444
|
-
},
|
|
445
|
-
const
|
|
446
|
-
return
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
/* @__PURE__ */
|
|
485
|
+
}, i = () => {
|
|
486
|
+
const n = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], c = _e(y), t = we(y), u = Ee({ start: c, end: t }), o = Array(Ae(c)).fill(null);
|
|
487
|
+
return P === "year" ? s() : P === "month" ? e() : /* @__PURE__ */ r.jsxs("div", { className: "desktop-calendar", children: [
|
|
488
|
+
/* @__PURE__ */ r.jsxs("div", { className: "calendar-header", children: [
|
|
489
|
+
/* @__PURE__ */ r.jsx("button", { type: "button", onClick: () => T(pe(y, 1)), children: /* @__PURE__ */ r.jsx(fe, { size: 18 }) }),
|
|
490
|
+
/* @__PURE__ */ r.jsxs("div", { className: "header-nav", children: [
|
|
491
|
+
/* @__PURE__ */ r.jsx("span", { className: "nav-btn", onClick: () => R("month"), children: X(y, "MMMM") }),
|
|
492
|
+
/* @__PURE__ */ r.jsx("span", { className: "nav-btn", onClick: () => R("year"), children: X(y, "yyyy") })
|
|
452
493
|
] }),
|
|
453
|
-
/* @__PURE__ */
|
|
494
|
+
/* @__PURE__ */ r.jsx("button", { type: "button", onClick: () => T(he(y, 1)), children: /* @__PURE__ */ r.jsx(me, { size: 18 }) })
|
|
454
495
|
] }),
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
|
|
457
|
-
o.map((
|
|
458
|
-
|
|
496
|
+
/* @__PURE__ */ r.jsxs("div", { className: "calendar-grid", children: [
|
|
497
|
+
n.map((h) => /* @__PURE__ */ r.jsx("div", { className: "calendar-day-header", children: h }, h)),
|
|
498
|
+
o.map((h, N) => /* @__PURE__ */ r.jsx("div", {}, `empty-${N}`)),
|
|
499
|
+
u.map((h) => /* @__PURE__ */ r.jsx(
|
|
459
500
|
"button",
|
|
460
501
|
{
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
502
|
+
type: "button",
|
|
503
|
+
className: `calendar-day-cell ${g && ge(h, L(g) || /* @__PURE__ */ new Date(0)) ? "active" : ""} ${ge(h, /* @__PURE__ */ new Date()) ? "today" : ""}`,
|
|
504
|
+
onClick: () => Q(h),
|
|
505
|
+
children: X(h, "d")
|
|
464
506
|
},
|
|
465
|
-
|
|
507
|
+
h.toString()
|
|
466
508
|
))
|
|
467
509
|
] })
|
|
468
510
|
] });
|
|
469
|
-
},
|
|
470
|
-
const
|
|
471
|
-
const o = new Date(
|
|
472
|
-
let
|
|
473
|
-
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
},
|
|
477
|
-
if (Date.now() -
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
let
|
|
483
|
-
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
|
|
511
|
+
}, a = () => {
|
|
512
|
+
const n = (t, u) => {
|
|
513
|
+
const o = new Date(p);
|
|
514
|
+
let h = o.getDate();
|
|
515
|
+
t === "year" && o.setFullYear(u), t === "month" && o.setMonth(u), t === "day" && (o.setDate(u), h = u);
|
|
516
|
+
const N = new Date(o.getFullYear(), o.getMonth() + 1, 0).getDate();
|
|
517
|
+
h > N && o.setDate(N), E(o), t === "year" && F.current && F.current.scrollTo({ top: b.indexOf(u) * 32, behavior: "smooth" }), t === "month" && I.current && I.current.scrollTo({ top: u * 32, behavior: "smooth" }), t === "day" && l.current && l.current.scrollTo({ top: (u - 1) * 32, behavior: "smooth" }), t !== "day" && h > N && l.current && l.current.scrollTo({ top: (N - 1) * 32, behavior: "smooth" });
|
|
518
|
+
}, c = (t, u, o) => {
|
|
519
|
+
if (Date.now() - x.current < 500) return;
|
|
520
|
+
const h = t.target.scrollTop, N = Math.round(h / 32);
|
|
521
|
+
if (N >= 0 && N < o.length) {
|
|
522
|
+
const G = o[N];
|
|
523
|
+
f.current && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
524
|
+
let re = p.getFullYear(), Z = p.getMonth(), q = p.getDate();
|
|
525
|
+
u === "year" && (re = G), u === "month" && (Z = G), u === "day" && (q = G);
|
|
526
|
+
const ce = new Date(re, Z + 1, 0).getDate();
|
|
527
|
+
q > ce && (q = ce);
|
|
528
|
+
const ie = new Date(re, Z, q);
|
|
529
|
+
ie.setHours(p.getHours(), p.getMinutes(), p.getSeconds(), p.getMilliseconds()), p.getTime() !== ie.getTime() && E(ie), u !== "day" && p.getDate() > ce && l.current && l.current.scrollTo({ top: (ce - 1) * 32, behavior: "smooth" });
|
|
488
530
|
}, 150);
|
|
489
531
|
}
|
|
490
532
|
};
|
|
491
|
-
return /* @__PURE__ */
|
|
492
|
-
/* @__PURE__ */
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
/* @__PURE__ */
|
|
533
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "mobile-scroll-picker", children: [
|
|
534
|
+
/* @__PURE__ */ r.jsxs("div", { className: "mobile-header", children: [
|
|
535
|
+
/* @__PURE__ */ r.jsx("h3", { children: "Select Date" }),
|
|
536
|
+
/* @__PURE__ */ r.jsx("span", { className: "selected-preview", children: X(p, "dd MMM yyyy") })
|
|
495
537
|
] }),
|
|
496
|
-
/* @__PURE__ */
|
|
497
|
-
/* @__PURE__ */
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ r.jsxs("div", { className: "scroll-columns", style: { touchAction: "pan-y" }, children: [
|
|
539
|
+
/* @__PURE__ */ r.jsx("div", { className: "scroll-col year-col", ref: F, onScroll: (t) => c(t, "year", b), children: b.map((t) => /* @__PURE__ */ r.jsx("div", { className: `scroll-item ${p.getFullYear() === t ? "selected" : ""}`, onClick: () => n("year", t), children: t }, t)) }),
|
|
540
|
+
/* @__PURE__ */ r.jsx("div", { className: "scroll-col month-col", ref: I, onScroll: (t) => c(t, "month", A.map((u, o) => o)), children: A.map((t, u) => /* @__PURE__ */ r.jsx("div", { className: `scroll-item ${p.getMonth() === u ? "selected" : ""}`, onClick: () => n("month", u), children: t }, t)) }),
|
|
541
|
+
/* @__PURE__ */ r.jsx("div", { className: "scroll-col day-col", ref: l, onScroll: (t) => c(t, "day", S), children: S.map((t) => /* @__PURE__ */ r.jsx("div", { className: `scroll-item ${p.getDate() === t ? "selected" : ""}`, onClick: () => n("day", t), children: t }, t)) })
|
|
500
542
|
] }),
|
|
501
|
-
/* @__PURE__ */
|
|
543
|
+
/* @__PURE__ */ r.jsx("button", { type: "button", className: "confirm-btn", onClick: H, children: "Confirm" })
|
|
502
544
|
] });
|
|
503
545
|
};
|
|
504
|
-
return /* @__PURE__ */
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
-
|
|
546
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "datepicker-wrapper", ref: Y, children: [
|
|
547
|
+
/* @__PURE__ */ r.jsx(
|
|
548
|
+
je,
|
|
507
549
|
{
|
|
508
|
-
icon:
|
|
509
|
-
value:
|
|
510
|
-
onChange:
|
|
511
|
-
onToggle:
|
|
512
|
-
placeholder:
|
|
550
|
+
icon: Ne,
|
|
551
|
+
value: $,
|
|
552
|
+
onChange: K,
|
|
553
|
+
onToggle: _,
|
|
554
|
+
placeholder: W,
|
|
513
555
|
mask: "date",
|
|
514
|
-
onFocus: () =>
|
|
515
|
-
|
|
556
|
+
onFocus: () => {
|
|
557
|
+
U(!0);
|
|
558
|
+
},
|
|
559
|
+
onBlur: (n) => {
|
|
560
|
+
U(!1), d && d({ target: { name: m, value: $ } });
|
|
561
|
+
},
|
|
516
562
|
onClear: () => {
|
|
517
|
-
|
|
518
|
-
}
|
|
563
|
+
w(""), O(null);
|
|
564
|
+
},
|
|
565
|
+
disabled: D
|
|
519
566
|
}
|
|
520
567
|
),
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
|
|
523
|
-
|
|
568
|
+
/* @__PURE__ */ r.jsx(ve, { children: v && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
569
|
+
M && /* @__PURE__ */ r.jsx(
|
|
570
|
+
le.div,
|
|
524
571
|
{
|
|
525
572
|
className: "mobile-backdrop",
|
|
526
573
|
initial: { opacity: 0 },
|
|
527
574
|
animate: { opacity: 1 },
|
|
528
575
|
exit: { opacity: 0 },
|
|
529
|
-
onClick: () =>
|
|
576
|
+
onClick: () => k(!1)
|
|
530
577
|
}
|
|
531
578
|
),
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
|
|
579
|
+
/* @__PURE__ */ r.jsx(
|
|
580
|
+
le.div,
|
|
534
581
|
{
|
|
535
|
-
initial: { y:
|
|
582
|
+
initial: { y: M ? "100%" : 20, opacity: 0 },
|
|
536
583
|
animate: { y: 0, opacity: 1 },
|
|
537
|
-
exit: { y:
|
|
584
|
+
exit: { y: M ? "100%" : 20, opacity: 0 },
|
|
538
585
|
transition: { type: "spring", damping: 25, stiffness: 200 },
|
|
539
|
-
className: `picker-dropdown glass-card ${
|
|
540
|
-
children:
|
|
586
|
+
className: `picker-dropdown glass-card ${M ? "mobile" : "desktop"}`,
|
|
587
|
+
children: M ? a() : i()
|
|
541
588
|
}
|
|
542
589
|
)
|
|
543
590
|
] }) })
|
|
544
591
|
] });
|
|
545
|
-
},
|
|
546
|
-
|
|
592
|
+
}, Ve = ({
|
|
593
|
+
value: g,
|
|
594
|
+
onChange: C,
|
|
595
|
+
placeholder: W = "HH/MM AM/PM",
|
|
596
|
+
showSeconds: m = !1,
|
|
597
|
+
use12h: d = !0,
|
|
598
|
+
name: D,
|
|
599
|
+
onBlur: M,
|
|
600
|
+
disabled: v = !1
|
|
601
|
+
}) => {
|
|
602
|
+
const k = de(), [P, R] = z(!1), L = (e) => {
|
|
603
|
+
if (!e) return "";
|
|
604
|
+
const s = e.split(" ");
|
|
605
|
+
if (s.length < 2 && d || !d) return e;
|
|
606
|
+
const i = s[0].split(":");
|
|
607
|
+
let a = parseInt(i[0], 10);
|
|
608
|
+
const n = i[1] || "00", c = i[2] || "00", t = s[1] || "AM";
|
|
609
|
+
t === "PM" && a < 12 && (a += 12), t === "AM" && a === 12 && (a = 0);
|
|
610
|
+
let u = `${a.toString().padStart(2, "0")}:${n}`;
|
|
611
|
+
return m && (u += `:${c}`), u;
|
|
612
|
+
}, $ = (e) => {
|
|
613
|
+
if (!e) return "";
|
|
614
|
+
if (d && (e.includes("AM") || e.includes("PM")) || !d) return e;
|
|
615
|
+
const s = e.split(":");
|
|
616
|
+
if (s.length < 2) return e;
|
|
617
|
+
let i = parseInt(s[0], 10);
|
|
618
|
+
const a = s[1] || "00", n = s[2] || "00", c = i >= 12 ? "PM" : "AM";
|
|
619
|
+
i = i % 12 || 12;
|
|
620
|
+
let t = `${i.toString().padStart(2, "0")}:${a}`;
|
|
621
|
+
return m && (t += `:${n}`), t += ` ${c}`, t;
|
|
622
|
+
}, w = (e) => {
|
|
623
|
+
const s = L(e);
|
|
624
|
+
C && C({
|
|
625
|
+
target: {
|
|
626
|
+
name: D,
|
|
627
|
+
value: s
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
}, [p, E] = z($(g) || ""), [y, T] = z($(g) || ""), [J, U] = z(!1), Y = V(null), F = V(null), I = V(null), l = V(null), f = V(null), x = V(null), b = V(0), A = d ? Array.from({ length: 12 }, (e, s) => (s + 1).toString().padStart(2, "0")) : Array.from({ length: 24 }, (e, s) => s.toString().padStart(2, "0")), j = Array.from({ length: 60 }, (e, s) => s.toString().padStart(2, "0")), S = Array.from({ length: 60 }, (e, s) => s.toString().padStart(2, "0")), _ = ["AM", "PM"];
|
|
547
631
|
B(() => {
|
|
548
|
-
!
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
632
|
+
if (!J && !P) {
|
|
633
|
+
const e = $(g);
|
|
634
|
+
E(e || ""), T(e || "");
|
|
635
|
+
}
|
|
636
|
+
}, [g, J, P]), B(() => {
|
|
637
|
+
if (P && k) {
|
|
638
|
+
let e = "01:00";
|
|
639
|
+
m && (e += ":00"), d && (e += " AM");
|
|
640
|
+
const i = ($(y) || e).split(" "), a = i[0].split(":"), n = i[1] || "AM", c = () => {
|
|
641
|
+
const o = A.indexOf(a[0]);
|
|
642
|
+
F.current && o !== -1 && (F.current.scrollTop = o * 32), I.current && (I.current.scrollTop = parseInt(a[1] || 0) * 32), l.current && m && (l.current.scrollTop = parseInt(a[2] || 0) * 32), f.current && d && (f.current.scrollTop = _.indexOf(n) * 32);
|
|
556
643
|
};
|
|
557
|
-
|
|
558
|
-
const
|
|
644
|
+
c();
|
|
645
|
+
const t = setTimeout(c, 50), u = setTimeout(c, 300);
|
|
559
646
|
return () => {
|
|
560
|
-
clearTimeout(
|
|
647
|
+
clearTimeout(t), clearTimeout(u);
|
|
561
648
|
};
|
|
562
649
|
}
|
|
563
|
-
}, [
|
|
564
|
-
const
|
|
565
|
-
if (!
|
|
566
|
-
|
|
567
|
-
|
|
650
|
+
}, [P, k]);
|
|
651
|
+
const O = () => {
|
|
652
|
+
if (!v) {
|
|
653
|
+
if (!P) {
|
|
654
|
+
let e = "01:00";
|
|
655
|
+
m && (e += ":00"), d && (e += " AM"), T($(p) || e), b.current = Date.now();
|
|
656
|
+
}
|
|
657
|
+
R(!P);
|
|
568
658
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
N(c), h || D(c);
|
|
659
|
+
}, H = () => {
|
|
660
|
+
E(y), w(y), R(!1);
|
|
661
|
+
}, K = (e) => {
|
|
662
|
+
E(e);
|
|
663
|
+
const s = e.split(" "), i = s[0].split(":");
|
|
664
|
+
i.length >= 2 ? i.every((n) => n.length === 2) && (!d || d && s[1] && (s[1] === "AM" || s[1] === "PM")) && (w(e), T(e)) : e === "" && (w(""), T(""));
|
|
665
|
+
}, Q = (e) => {
|
|
666
|
+
T(e), k || E(e);
|
|
578
667
|
};
|
|
579
668
|
B(() => {
|
|
580
|
-
const
|
|
581
|
-
|
|
669
|
+
const e = (s) => {
|
|
670
|
+
Y.current && !Y.current.contains(s.target) && R(!1);
|
|
582
671
|
};
|
|
583
|
-
return document.addEventListener("mousedown",
|
|
584
|
-
}, []), B(() => (
|
|
672
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
673
|
+
}, []), B(() => (k && P ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
585
674
|
document.body.style.overflow = "";
|
|
586
|
-
}), [
|
|
587
|
-
const
|
|
588
|
-
let
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
let
|
|
592
|
-
|
|
675
|
+
}), [P, k]);
|
|
676
|
+
const ee = () => {
|
|
677
|
+
let e = "01:00";
|
|
678
|
+
m && (e += ":00"), d && (e += " AM");
|
|
679
|
+
const i = ($(y) || e).split(" "), a = i[0].split(":"), n = i[1] || "AM", c = (t = a[0] || "12", u = a[1] || "00", o = a[2] || "00", h = n) => {
|
|
680
|
+
let N = `${t}:${u}`;
|
|
681
|
+
m && (N += `:${o}`), d && (N += ` ${h}`), Q(N);
|
|
593
682
|
};
|
|
594
|
-
return /* @__PURE__ */
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
/* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `desktop-time-picker ${m ? "with-seconds" : ""}`, children: [
|
|
684
|
+
/* @__PURE__ */ r.jsxs("div", { className: "time-select-grid", children: [
|
|
685
|
+
/* @__PURE__ */ r.jsxs("div", { className: "time-col", children: [
|
|
686
|
+
/* @__PURE__ */ r.jsx("span", { className: "col-label", children: "Hrs" }),
|
|
687
|
+
/* @__PURE__ */ r.jsx("div", { className: "time-scroll", children: A.map((t) => /* @__PURE__ */ r.jsx("button", { type: "button", className: `time-btn ${a[0] === t ? "active" : ""}`, onClick: () => c(t), children: t }, t)) })
|
|
599
688
|
] }),
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
/* @__PURE__ */
|
|
602
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ r.jsxs("div", { className: "time-col", children: [
|
|
690
|
+
/* @__PURE__ */ r.jsx("span", { className: "col-label", children: "Min" }),
|
|
691
|
+
/* @__PURE__ */ r.jsx("div", { className: "time-scroll", children: j.map((t) => /* @__PURE__ */ r.jsx("button", { type: "button", className: `time-btn ${a[1] === t ? "active" : ""}`, onClick: () => c(void 0, t), children: t }, t)) })
|
|
603
692
|
] }),
|
|
604
|
-
|
|
605
|
-
/* @__PURE__ */
|
|
606
|
-
/* @__PURE__ */
|
|
693
|
+
m && /* @__PURE__ */ r.jsxs("div", { className: "time-col", children: [
|
|
694
|
+
/* @__PURE__ */ r.jsx("span", { className: "col-label", children: "Sec" }),
|
|
695
|
+
/* @__PURE__ */ r.jsx("div", { className: "time-scroll", children: S.map((t) => /* @__PURE__ */ r.jsx("button", { type: "button", className: `time-btn ${a[2] === t ? "active" : ""}`, onClick: () => c(void 0, void 0, t), children: t }, t)) })
|
|
607
696
|
] }),
|
|
608
|
-
|
|
609
|
-
/* @__PURE__ */
|
|
610
|
-
/* @__PURE__ */
|
|
697
|
+
d && /* @__PURE__ */ r.jsxs("div", { className: "time-col", children: [
|
|
698
|
+
/* @__PURE__ */ r.jsx("span", { className: "col-label", children: "Mode" }),
|
|
699
|
+
/* @__PURE__ */ r.jsx("div", { className: "time-scroll", children: _.map((t) => /* @__PURE__ */ r.jsx("button", { type: "button", className: `time-btn ${n === t ? "active" : ""}`, onClick: () => c(void 0, void 0, void 0, t), children: t }, t)) })
|
|
611
700
|
] })
|
|
612
701
|
] }),
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
702
|
+
/* @__PURE__ */ r.jsx("div", { className: "desktop-footer", children: /* @__PURE__ */ r.jsxs("button", { type: "button", className: "confirm-btn small", onClick: H, children: [
|
|
703
|
+
/* @__PURE__ */ r.jsx(Re, { size: 16, style: { marginRight: "6px" } }),
|
|
615
704
|
" Done"
|
|
616
705
|
] }) })
|
|
617
706
|
] });
|
|
618
|
-
},
|
|
619
|
-
let
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
const
|
|
623
|
-
for (;
|
|
624
|
-
|
|
625
|
-
let
|
|
626
|
-
|
|
627
|
-
},
|
|
628
|
-
let
|
|
629
|
-
|
|
630
|
-
},
|
|
631
|
-
if (Date.now() -
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
707
|
+
}, te = () => {
|
|
708
|
+
let e = "01:00";
|
|
709
|
+
m && (e += ":00"), d && (e += " AM");
|
|
710
|
+
const i = ($(y) || e).split(" "), a = i[0].split(":"), n = i[1] || "AM", c = (o, h) => {
|
|
711
|
+
const N = [...a];
|
|
712
|
+
for (; N.length < (m ? 3 : 2); ) N.push("00");
|
|
713
|
+
N[o] = h;
|
|
714
|
+
let G = N.slice(0, m ? 3 : 2).join(":");
|
|
715
|
+
d && (G += ` ${n}`), Q(G), o === 0 && F.current && F.current.scrollTo({ top: A.indexOf(h) * 32, behavior: "smooth" }), o === 1 && I.current && I.current.scrollTo({ top: j.indexOf(h) * 32, behavior: "smooth" }), o === 2 && l.current && l.current.scrollTo({ top: S.indexOf(h) * 32, behavior: "smooth" });
|
|
716
|
+
}, t = (o) => {
|
|
717
|
+
let h = a.slice(0, m ? 3 : 2).join(":");
|
|
718
|
+
d && (h += ` ${o}`), Q(h), f.current && f.current.scrollTo({ top: _.indexOf(o) * 32, behavior: "smooth" });
|
|
719
|
+
}, u = (o, h, N, G) => {
|
|
720
|
+
if (Date.now() - b.current < 500) return;
|
|
721
|
+
const re = o.target.scrollTop, Z = Math.round(re / 32);
|
|
722
|
+
if (Z >= 0 && Z < G.length) {
|
|
723
|
+
const q = G[Z];
|
|
724
|
+
x.current && clearTimeout(x.current), x.current = setTimeout(() => {
|
|
725
|
+
h === "part" ? a[N] !== q && c(N, q) : h === "ampm" && n !== q && t(q);
|
|
637
726
|
}, 150);
|
|
638
727
|
}
|
|
639
728
|
};
|
|
640
|
-
return /* @__PURE__ */
|
|
641
|
-
/* @__PURE__ */
|
|
642
|
-
/* @__PURE__ */
|
|
643
|
-
/* @__PURE__ */
|
|
729
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "mobile-scroll-picker", children: [
|
|
730
|
+
/* @__PURE__ */ r.jsxs("div", { className: "mobile-header", children: [
|
|
731
|
+
/* @__PURE__ */ r.jsx("h3", { children: "Select Time" }),
|
|
732
|
+
/* @__PURE__ */ r.jsx("span", { className: "selected-preview", children: y || "--:--" })
|
|
644
733
|
] }),
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
648
|
-
|
|
649
|
-
|
|
734
|
+
/* @__PURE__ */ r.jsxs("div", { className: "scroll-columns", style: { touchAction: "pan-y" }, children: [
|
|
735
|
+
/* @__PURE__ */ r.jsx("div", { className: "scroll-col hour-col", ref: F, onScroll: (o) => u(o, "part", 0, A), children: A.map((o) => /* @__PURE__ */ r.jsx("div", { className: `scroll-item ${a[0] === o ? "selected" : ""}`, onClick: () => c(0, o), children: o }, o)) }),
|
|
736
|
+
/* @__PURE__ */ r.jsx("div", { className: "scroll-col min-col", ref: I, onScroll: (o) => u(o, "part", 1, j), children: j.map((o) => /* @__PURE__ */ r.jsx("div", { className: `scroll-item ${a[1] === o ? "selected" : ""}`, onClick: () => c(1, o), children: o }, o)) }),
|
|
737
|
+
m && /* @__PURE__ */ r.jsx("div", { className: "scroll-col sec-col", ref: l, onScroll: (o) => u(o, "part", 2, S), children: S.map((o) => /* @__PURE__ */ r.jsx("div", { className: `scroll-item ${a[2] === o ? "selected" : ""}`, onClick: () => c(2, o), children: o }, o)) }),
|
|
738
|
+
d && /* @__PURE__ */ r.jsx("div", { className: "scroll-col ampm-col", ref: f, onScroll: (o) => u(o, "ampm", null, _), children: _.map((o) => /* @__PURE__ */ r.jsx("div", { className: `scroll-item ${n === o ? "selected" : ""}`, onClick: () => t(o), children: o }, o)) })
|
|
650
739
|
] }),
|
|
651
|
-
/* @__PURE__ */
|
|
740
|
+
/* @__PURE__ */ r.jsx("button", { type: "button", className: "confirm-btn", onClick: H, children: "Confirm" })
|
|
652
741
|
] });
|
|
653
742
|
};
|
|
654
|
-
return /* @__PURE__ */
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
|
|
743
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "timepicker-wrapper", ref: Y, children: [
|
|
744
|
+
/* @__PURE__ */ r.jsx(
|
|
745
|
+
je,
|
|
657
746
|
{
|
|
658
|
-
icon:
|
|
659
|
-
value:
|
|
660
|
-
onChange:
|
|
661
|
-
onToggle:
|
|
662
|
-
placeholder:
|
|
663
|
-
mask:
|
|
664
|
-
onFocus: () =>
|
|
665
|
-
onBlur: () =>
|
|
747
|
+
icon: ke,
|
|
748
|
+
value: p,
|
|
749
|
+
onChange: K,
|
|
750
|
+
onToggle: O,
|
|
751
|
+
placeholder: m ? "HH:MM:SS AM/PM" : "HH:MM AM/PM",
|
|
752
|
+
mask: m ? d ? "time-seconds-ampm" : "time-seconds" : d ? "time-ampm" : "time",
|
|
753
|
+
onFocus: () => U(!0),
|
|
754
|
+
onBlur: (e) => {
|
|
755
|
+
U(!1), M && M({ target: { name: D, value: p } });
|
|
756
|
+
},
|
|
666
757
|
onClear: () => {
|
|
667
|
-
|
|
668
|
-
}
|
|
758
|
+
E(""), T(""), w("");
|
|
759
|
+
},
|
|
760
|
+
disabled: v
|
|
669
761
|
}
|
|
670
762
|
),
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
|
|
673
|
-
|
|
763
|
+
/* @__PURE__ */ r.jsx(ve, { children: P && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
764
|
+
k && /* @__PURE__ */ r.jsx(
|
|
765
|
+
le.div,
|
|
674
766
|
{
|
|
675
767
|
className: "mobile-backdrop",
|
|
676
768
|
initial: { opacity: 0 },
|
|
677
769
|
animate: { opacity: 1 },
|
|
678
770
|
exit: { opacity: 0 },
|
|
679
|
-
onClick: () =>
|
|
771
|
+
onClick: () => R(!1)
|
|
680
772
|
}
|
|
681
773
|
),
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
|
|
774
|
+
/* @__PURE__ */ r.jsx(
|
|
775
|
+
le.div,
|
|
684
776
|
{
|
|
685
|
-
initial: { y:
|
|
777
|
+
initial: { y: k ? "100%" : 20, opacity: 0 },
|
|
686
778
|
animate: { y: 0, opacity: 1 },
|
|
687
|
-
exit: { y:
|
|
779
|
+
exit: { y: k ? "100%" : 20, opacity: 0 },
|
|
688
780
|
transition: { type: "spring", damping: 25, stiffness: 200 },
|
|
689
|
-
className: `picker-dropdown glass-card ${
|
|
690
|
-
children:
|
|
781
|
+
className: `picker-dropdown glass-card ${k ? "mobile" : "desktop"}`,
|
|
782
|
+
children: k ? te() : ee()
|
|
691
783
|
}
|
|
692
784
|
)
|
|
693
785
|
] }) })
|
|
694
786
|
] });
|
|
695
787
|
};
|
|
696
788
|
export {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
789
|
+
Ie as DatePicker,
|
|
790
|
+
je as SharedInput,
|
|
791
|
+
Ve as TimePicker
|
|
700
792
|
};
|