@starasia/date 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/date.es.js CHANGED
@@ -1,647 +1,6 @@
1
- import Ke, { useState as B, useRef as Q, useEffect as I, forwardRef as be } from "react";
2
- var ve = { exports: {} }, X = {};
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.min.js
6
- *
7
- * Copyright (c) Facebook, Inc. and its affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var Ue;
13
- function Sr() {
14
- if (Ue)
15
- return X;
16
- Ue = 1;
17
- var t = Ke, n = Symbol.for("react.element"), l = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, u = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, m = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function b(j, f, a) {
19
- var E, w = {}, _ = null, S = null;
20
- a !== void 0 && (_ = "" + a), f.key !== void 0 && (_ = "" + f.key), f.ref !== void 0 && (S = f.ref);
21
- for (E in f)
22
- i.call(f, E) && !m.hasOwnProperty(E) && (w[E] = f[E]);
23
- if (j && j.defaultProps)
24
- for (E in f = j.defaultProps, f)
25
- w[E] === void 0 && (w[E] = f[E]);
26
- return { $$typeof: n, type: j, key: _, ref: S, props: w, _owner: u.current };
27
- }
28
- return X.Fragment = l, X.jsx = b, X.jsxs = b, X;
29
- }
30
- var Z = {};
31
- /**
32
- * @license React
33
- * react-jsx-runtime.development.js
34
- *
35
- * Copyright (c) Facebook, Inc. and its affiliates.
36
- *
37
- * This source code is licensed under the MIT license found in the
38
- * LICENSE file in the root directory of this source tree.
39
- */
40
- var ze;
41
- function Mr() {
42
- return ze || (ze = 1, process.env.NODE_ENV !== "production" && function() {
43
- var t = Ke, n = Symbol.for("react.element"), l = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), b = Symbol.for("react.provider"), j = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), a = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), v = Symbol.iterator, c = "@@iterator";
44
- function g(e) {
45
- if (e === null || typeof e != "object")
46
- return null;
47
- var r = v && e[v] || e[c];
48
- return typeof r == "function" ? r : null;
49
- }
50
- var d = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
- function p(e) {
52
- {
53
- for (var r = arguments.length, s = new Array(r > 1 ? r - 1 : 0), y = 1; y < r; y++)
54
- s[y - 1] = arguments[y];
55
- h("error", e, s);
56
- }
57
- }
58
- function h(e, r, s) {
59
- {
60
- var y = d.ReactDebugCurrentFrame, T = y.getStackAddendum();
61
- T !== "" && (r += "%s", s = s.concat([T]));
62
- var D = s.map(function(R) {
63
- return String(R);
64
- });
65
- D.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, D);
66
- }
67
- }
68
- var x = !1, Y = !1, $ = !1, C = !1, P = !1, we;
69
- we = Symbol.for("react.module.reference");
70
- function rr(e) {
71
- return !!(typeof e == "string" || typeof e == "function" || e === i || e === m || P || e === u || e === a || e === E || C || e === S || x || Y || $ || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === w || e.$$typeof === b || e.$$typeof === j || e.$$typeof === f || // This needs to include all possible module reference object
72
- // types supported by any Flight configuration anywhere since
73
- // we don't know which Flight build this will end up being used
74
- // with.
75
- e.$$typeof === we || e.getModuleId !== void 0));
76
- }
77
- function ar(e, r, s) {
78
- var y = e.displayName;
79
- if (y)
80
- return y;
81
- var T = r.displayName || r.name || "";
82
- return T !== "" ? s + "(" + T + ")" : s;
83
- }
84
- function xe(e) {
85
- return e.displayName || "Context";
86
- }
87
- function A(e) {
88
- if (e == null)
89
- return null;
90
- if (typeof e.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
91
- return e.displayName || e.name || null;
92
- if (typeof e == "string")
93
- return e;
94
- switch (e) {
95
- case i:
96
- return "Fragment";
97
- case l:
98
- return "Portal";
99
- case m:
100
- return "Profiler";
101
- case u:
102
- return "StrictMode";
103
- case a:
104
- return "Suspense";
105
- case E:
106
- return "SuspenseList";
107
- }
108
- if (typeof e == "object")
109
- switch (e.$$typeof) {
110
- case j:
111
- var r = e;
112
- return xe(r) + ".Consumer";
113
- case b:
114
- var s = e;
115
- return xe(s._context) + ".Provider";
116
- case f:
117
- return ar(e, e.render, "ForwardRef");
118
- case w:
119
- var y = e.displayName || null;
120
- return y !== null ? y : A(e.type) || "Memo";
121
- case _: {
122
- var T = e, D = T._payload, R = T._init;
123
- try {
124
- return A(R(D));
125
- } catch {
126
- return null;
127
- }
128
- }
129
- }
130
- return null;
131
- }
132
- var W = Object.assign, H = 0, Ee, je, Ce, ke, Re, _e, Te;
133
- function De() {
134
- }
135
- De.__reactDisabledLog = !0;
136
- function nr() {
137
- {
138
- if (H === 0) {
139
- Ee = console.log, je = console.info, Ce = console.warn, ke = console.error, Re = console.group, _e = console.groupCollapsed, Te = console.groupEnd;
140
- var e = {
141
- configurable: !0,
142
- enumerable: !0,
143
- value: De,
144
- writable: !0
145
- };
146
- Object.defineProperties(console, {
147
- info: e,
148
- log: e,
149
- warn: e,
150
- error: e,
151
- group: e,
152
- groupCollapsed: e,
153
- groupEnd: e
154
- });
155
- }
156
- H++;
157
- }
158
- }
159
- function tr() {
160
- {
161
- if (H--, H === 0) {
162
- var e = {
163
- configurable: !0,
164
- enumerable: !0,
165
- writable: !0
166
- };
167
- Object.defineProperties(console, {
168
- log: W({}, e, {
169
- value: Ee
170
- }),
171
- info: W({}, e, {
172
- value: je
173
- }),
174
- warn: W({}, e, {
175
- value: Ce
176
- }),
177
- error: W({}, e, {
178
- value: ke
179
- }),
180
- group: W({}, e, {
181
- value: Re
182
- }),
183
- groupCollapsed: W({}, e, {
184
- value: _e
185
- }),
186
- groupEnd: W({}, e, {
187
- value: Te
188
- })
189
- });
190
- }
191
- H < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
- }
193
- }
194
- var oe = d.ReactCurrentDispatcher, le;
195
- function ee(e, r, s) {
196
- {
197
- if (le === void 0)
198
- try {
199
- throw Error();
200
- } catch (T) {
201
- var y = T.stack.trim().match(/\n( *(at )?)/);
202
- le = y && y[1] || "";
203
- }
204
- return `
205
- ` + le + e;
206
- }
207
- }
208
- var ce = !1, re;
209
- {
210
- var sr = typeof WeakMap == "function" ? WeakMap : Map;
211
- re = new sr();
212
- }
213
- function Se(e, r) {
214
- if (!e || ce)
215
- return "";
216
- {
217
- var s = re.get(e);
218
- if (s !== void 0)
219
- return s;
220
- }
221
- var y;
222
- ce = !0;
223
- var T = Error.prepareStackTrace;
224
- Error.prepareStackTrace = void 0;
225
- var D;
226
- D = oe.current, oe.current = null, nr();
227
- try {
228
- if (r) {
229
- var R = function() {
230
- throw Error();
231
- };
232
- if (Object.defineProperty(R.prototype, "props", {
233
- set: function() {
234
- throw Error();
235
- }
236
- }), typeof Reflect == "object" && Reflect.construct) {
237
- try {
238
- Reflect.construct(R, []);
239
- } catch (N) {
240
- y = N;
241
- }
242
- Reflect.construct(e, [], R);
243
- } else {
244
- try {
245
- R.call();
246
- } catch (N) {
247
- y = N;
248
- }
249
- e.call(R.prototype);
250
- }
251
- } else {
252
- try {
253
- throw Error();
254
- } catch (N) {
255
- y = N;
256
- }
257
- e();
258
- }
259
- } catch (N) {
260
- if (N && y && typeof N.stack == "string") {
261
- for (var k = N.stack.split(`
262
- `), O = y.stack.split(`
263
- `), M = k.length - 1, F = O.length - 1; M >= 1 && F >= 0 && k[M] !== O[F]; )
264
- F--;
265
- for (; M >= 1 && F >= 0; M--, F--)
266
- if (k[M] !== O[F]) {
267
- if (M !== 1 || F !== 1)
268
- do
269
- if (M--, F--, F < 0 || k[M] !== O[F]) {
270
- var L = `
271
- ` + k[M].replace(" at new ", " at ");
272
- return e.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, L), L;
273
- }
274
- while (M >= 1 && F >= 0);
275
- break;
276
- }
277
- }
278
- } finally {
279
- ce = !1, oe.current = D, tr(), Error.prepareStackTrace = T;
280
- }
281
- var J = e ? e.displayName || e.name : "", V = J ? ee(J) : "";
282
- return typeof e == "function" && re.set(e, V), V;
283
- }
284
- function ir(e, r, s) {
285
- return Se(e, !1);
286
- }
287
- function or(e) {
288
- var r = e.prototype;
289
- return !!(r && r.isReactComponent);
290
- }
291
- function ae(e, r, s) {
292
- if (e == null)
293
- return "";
294
- if (typeof e == "function")
295
- return Se(e, or(e));
296
- if (typeof e == "string")
297
- return ee(e);
298
- switch (e) {
299
- case a:
300
- return ee("Suspense");
301
- case E:
302
- return ee("SuspenseList");
303
- }
304
- if (typeof e == "object")
305
- switch (e.$$typeof) {
306
- case f:
307
- return ir(e.render);
308
- case w:
309
- return ae(e.type, r, s);
310
- case _: {
311
- var y = e, T = y._payload, D = y._init;
312
- try {
313
- return ae(D(T), r, s);
314
- } catch {
315
- }
316
- }
317
- }
318
- return "";
319
- }
320
- var G = Object.prototype.hasOwnProperty, Me = {}, Fe = d.ReactDebugCurrentFrame;
321
- function ne(e) {
322
- if (e) {
323
- var r = e._owner, s = ae(e.type, e._source, r ? r.type : null);
324
- Fe.setExtraStackFrame(s);
325
- } else
326
- Fe.setExtraStackFrame(null);
327
- }
328
- function lr(e, r, s, y, T) {
329
- {
330
- var D = Function.call.bind(G);
331
- for (var R in e)
332
- if (D(e, R)) {
333
- var k = void 0;
334
- try {
335
- if (typeof e[R] != "function") {
336
- var O = Error((y || "React class") + ": " + s + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
- throw O.name = "Invariant Violation", O;
338
- }
339
- k = e[R](r, R, y, s, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
- } catch (M) {
341
- k = M;
342
- }
343
- k && !(k instanceof Error) && (ne(T), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", y || "React class", s, R, typeof k), ne(null)), k instanceof Error && !(k.message in Me) && (Me[k.message] = !0, ne(T), p("Failed %s type: %s", s, k.message), ne(null));
344
- }
345
- }
346
- }
347
- var cr = Array.isArray;
348
- function ue(e) {
349
- return cr(e);
350
- }
351
- function ur(e) {
352
- {
353
- var r = typeof Symbol == "function" && Symbol.toStringTag, s = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
- return s;
355
- }
356
- }
357
- function dr(e) {
358
- try {
359
- return $e(e), !1;
360
- } catch {
361
- return !0;
362
- }
363
- }
364
- function $e(e) {
365
- return "" + e;
366
- }
367
- function Ye(e) {
368
- if (dr(e))
369
- return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ur(e)), $e(e);
370
- }
371
- var K = d.ReactCurrentOwner, fr = {
372
- key: !0,
373
- ref: !0,
374
- __self: !0,
375
- __source: !0
376
- }, Oe, Pe, de;
377
- de = {};
378
- function hr(e) {
379
- if (G.call(e, "ref")) {
380
- var r = Object.getOwnPropertyDescriptor(e, "ref").get;
381
- if (r && r.isReactWarning)
382
- return !1;
383
- }
384
- return e.ref !== void 0;
385
- }
386
- function gr(e) {
387
- if (G.call(e, "key")) {
388
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
389
- if (r && r.isReactWarning)
390
- return !1;
391
- }
392
- return e.key !== void 0;
393
- }
394
- function pr(e, r) {
395
- if (typeof e.ref == "string" && K.current && r && K.current.stateNode !== r) {
396
- var s = A(K.current.type);
397
- de[s] || (p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', A(K.current.type), e.ref), de[s] = !0);
398
- }
399
- }
400
- function vr(e, r) {
401
- {
402
- var s = function() {
403
- Oe || (Oe = !0, p("%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://reactjs.org/link/special-props)", r));
404
- };
405
- s.isReactWarning = !0, Object.defineProperty(e, "key", {
406
- get: s,
407
- configurable: !0
408
- });
409
- }
410
- }
411
- function yr(e, r) {
412
- {
413
- var s = function() {
414
- Pe || (Pe = !0, p("%s: `ref` 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://reactjs.org/link/special-props)", r));
415
- };
416
- s.isReactWarning = !0, Object.defineProperty(e, "ref", {
417
- get: s,
418
- configurable: !0
419
- });
420
- }
421
- }
422
- var mr = function(e, r, s, y, T, D, R) {
423
- var k = {
424
- // This tag allows us to uniquely identify this as a React Element
425
- $$typeof: n,
426
- // Built-in properties that belong on the element
427
- type: e,
428
- key: r,
429
- ref: s,
430
- props: R,
431
- // Record the component responsible for creating this element.
432
- _owner: D
433
- };
434
- return k._store = {}, Object.defineProperty(k._store, "validated", {
435
- configurable: !1,
436
- enumerable: !1,
437
- writable: !0,
438
- value: !1
439
- }), Object.defineProperty(k, "_self", {
440
- configurable: !1,
441
- enumerable: !1,
442
- writable: !1,
443
- value: y
444
- }), Object.defineProperty(k, "_source", {
445
- configurable: !1,
446
- enumerable: !1,
447
- writable: !1,
448
- value: T
449
- }), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
450
- };
451
- function br(e, r, s, y, T) {
452
- {
453
- var D, R = {}, k = null, O = null;
454
- s !== void 0 && (Ye(s), k = "" + s), gr(r) && (Ye(r.key), k = "" + r.key), hr(r) && (O = r.ref, pr(r, T));
455
- for (D in r)
456
- G.call(r, D) && !fr.hasOwnProperty(D) && (R[D] = r[D]);
457
- if (e && e.defaultProps) {
458
- var M = e.defaultProps;
459
- for (D in M)
460
- R[D] === void 0 && (R[D] = M[D]);
461
- }
462
- if (k || O) {
463
- var F = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
- k && vr(R, F), O && yr(R, F);
465
- }
466
- return mr(e, k, O, T, y, K.current, R);
467
- }
468
- }
469
- var fe = d.ReactCurrentOwner, Ne = d.ReactDebugCurrentFrame;
470
- function z(e) {
471
- if (e) {
472
- var r = e._owner, s = ae(e.type, e._source, r ? r.type : null);
473
- Ne.setExtraStackFrame(s);
474
- } else
475
- Ne.setExtraStackFrame(null);
476
- }
477
- var he;
478
- he = !1;
479
- function ge(e) {
480
- return typeof e == "object" && e !== null && e.$$typeof === n;
481
- }
482
- function Ie() {
483
- {
484
- if (fe.current) {
485
- var e = A(fe.current.type);
486
- if (e)
487
- return `
488
-
489
- Check the render method of \`` + e + "`.";
490
- }
491
- return "";
492
- }
493
- }
494
- function wr(e) {
495
- {
496
- if (e !== void 0) {
497
- var r = e.fileName.replace(/^.*[\\\/]/, ""), s = e.lineNumber;
498
- return `
499
-
500
- Check your code at ` + r + ":" + s + ".";
501
- }
502
- return "";
503
- }
504
- }
505
- var Le = {};
506
- function xr(e) {
507
- {
508
- var r = Ie();
509
- if (!r) {
510
- var s = typeof e == "string" ? e : e.displayName || e.name;
511
- s && (r = `
512
-
513
- Check the top-level render call using <` + s + ">.");
514
- }
515
- return r;
516
- }
517
- }
518
- function Ae(e, r) {
519
- {
520
- if (!e._store || e._store.validated || e.key != null)
521
- return;
522
- e._store.validated = !0;
523
- var s = xr(r);
524
- if (Le[s])
525
- return;
526
- Le[s] = !0;
527
- var y = "";
528
- e && e._owner && e._owner !== fe.current && (y = " It was passed a child from " + A(e._owner.type) + "."), z(e), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', s, y), z(null);
529
- }
530
- }
531
- function We(e, r) {
532
- {
533
- if (typeof e != "object")
534
- return;
535
- if (ue(e))
536
- for (var s = 0; s < e.length; s++) {
537
- var y = e[s];
538
- ge(y) && Ae(y, r);
539
- }
540
- else if (ge(e))
541
- e._store && (e._store.validated = !0);
542
- else if (e) {
543
- var T = g(e);
544
- if (typeof T == "function" && T !== e.entries)
545
- for (var D = T.call(e), R; !(R = D.next()).done; )
546
- ge(R.value) && Ae(R.value, r);
547
- }
548
- }
549
- }
550
- function Er(e) {
551
- {
552
- var r = e.type;
553
- if (r == null || typeof r == "string")
554
- return;
555
- var s;
556
- if (typeof r == "function")
557
- s = r.propTypes;
558
- else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here.
559
- // Inner props are checked in the reconciler.
560
- r.$$typeof === w))
561
- s = r.propTypes;
562
- else
563
- return;
564
- if (s) {
565
- var y = A(r);
566
- lr(s, e.props, "prop", y, e);
567
- } else if (r.PropTypes !== void 0 && !he) {
568
- he = !0;
569
- var T = A(r);
570
- p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", T || "Unknown");
571
- }
572
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
573
- }
574
- }
575
- function jr(e) {
576
- {
577
- for (var r = Object.keys(e.props), s = 0; s < r.length; s++) {
578
- var y = r[s];
579
- if (y !== "children" && y !== "key") {
580
- z(e), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", y), z(null);
581
- break;
582
- }
583
- }
584
- e.ref !== null && (z(e), p("Invalid attribute `ref` supplied to `React.Fragment`."), z(null));
585
- }
586
- }
587
- var Ve = {};
588
- function Be(e, r, s, y, T, D) {
589
- {
590
- var R = rr(e);
591
- if (!R) {
592
- var k = "";
593
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (k += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
594
- var O = wr(T);
595
- O ? k += O : k += Ie();
596
- var M;
597
- e === null ? M = "null" : ue(e) ? M = "array" : e !== void 0 && e.$$typeof === n ? (M = "<" + (A(e.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : M = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", M, k);
598
- }
599
- var F = br(e, r, s, T, D);
600
- if (F == null)
601
- return F;
602
- if (R) {
603
- var L = r.children;
604
- if (L !== void 0)
605
- if (y)
606
- if (ue(L)) {
607
- for (var J = 0; J < L.length; J++)
608
- We(L[J], e);
609
- Object.freeze && Object.freeze(L);
610
- } else
611
- p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
612
- else
613
- We(L, e);
614
- }
615
- if (G.call(r, "key")) {
616
- var V = A(e), N = Object.keys(r).filter(function(Dr) {
617
- return Dr !== "key";
618
- }), pe = N.length > 0 ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}";
619
- if (!Ve[V + pe]) {
620
- var Tr = N.length > 0 ? "{" + N.join(": ..., ") + ": ...}" : "{}";
621
- p(`A props object containing a "key" prop is being spread into JSX:
622
- let props = %s;
623
- <%s {...props} />
624
- React keys must be passed directly to JSX without using spread:
625
- let props = %s;
626
- <%s key={someKey} {...props} />`, pe, V, Tr, V), Ve[V + pe] = !0;
627
- }
628
- }
629
- return e === i ? jr(F) : Er(F), F;
630
- }
631
- }
632
- function Cr(e, r, s) {
633
- return Be(e, r, s, !0);
634
- }
635
- function kr(e, r, s) {
636
- return Be(e, r, s, !1);
637
- }
638
- var Rr = kr, _r = Cr;
639
- Z.Fragment = i, Z.jsx = Rr, Z.jsxs = _r;
640
- }()), Z;
641
- }
642
- process.env.NODE_ENV === "production" ? ve.exports = Sr() : ve.exports = Mr();
643
- var o = ve.exports;
644
- const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
1
+ import { jsxs as $, jsx as l, Fragment as R } from "react/jsx-runtime";
2
+ import { useState as F, useRef as E, useEffect as D, forwardRef as W } from "react";
3
+ const I = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
645
4
 
646
5
  * {
647
6
  margin: 0;
@@ -689,23 +48,11 @@ const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
689
48
  #f9fafb
690
49
  );
691
50
 
692
- /* gray / blue */
693
- --starasia-ui-date-color-primary-blue: var(
694
- --starasia-ui-color-blue-500,
695
- #3b82f6
696
- );
697
- --starasia-ui-date-color-secondary-blue: var(
698
- --starasia-ui-color-blue-500,
699
- #3b82f6
700
- );
701
- --starasia-ui-date-color-tertiary-blue: var(
702
- --starasia-ui-color-blue-300,
703
- #93c5fd
704
- );
705
- --starasia-ui-date-color-quaternary-blue: var(
706
- --starasia-ui-color-blue-50,
707
- #eff6ff
708
- );
51
+ /* brand */
52
+ --starasia-ui-date-color-primary-blue: var(--starasia-ui-brand-primary-default);
53
+ --starasia-ui-date-color-secondary-blue: var(--starasia-ui-brand-primary-default);
54
+ --starasia-ui-date-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary);
55
+ --starasia-ui-date-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary);
709
56
 
710
57
  /* spacing */
711
58
  --starasia-ui-date-spacing-xs: var(--starasia-ui-spacing-xs, 4px);
@@ -897,7 +244,7 @@ const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
897
244
 
898
245
  .starasia-calendar-input-container:has(input:focus) {
899
246
  border-color: var(--starasia-ui-date-color-primary-blue);
900
- box-shadow: 0px 0px 0px 2px rgba(100, 181, 246, 0.2);
247
+ box-shadow: 0px 0px 0px 2px rgba(var(--starasia-ui-raw-color-brand-secondary), 0.2);
901
248
  }
902
249
  .starasia-calendar-input-container:has(input:disabled) {
903
250
  /* border-color: var(--starasia-ui-input-color-tertiary-gray); */
@@ -974,7 +321,7 @@ const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
974
321
  .starasia-calendar-input-container-warning {
975
322
  border-color: var(--starasia-ui-input-color-secondary-yellow) !important;
976
323
  }
977
- `, Xe = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], U = [
324
+ `, A = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], N = [
978
325
  "January",
979
326
  "February",
980
327
  "March",
@@ -987,7 +334,7 @@ const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
987
334
  "October",
988
335
  "November",
989
336
  "December"
990
- ], Fr = [
337
+ ], G = [
991
338
  "Jan",
992
339
  "Feb",
993
340
  "Mar",
@@ -1001,47 +348,47 @@ const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
1001
348
  "Nov",
1002
349
  "Dec"
1003
350
  ];
1004
- function Ze(t) {
1005
- const [n, l] = B(t), i = Q(null), u = (m) => {
1006
- i.current && !i.current.contains(m.target) && l(!1);
351
+ function J(r) {
352
+ const [a, t] = F(r), s = E(null), i = (g) => {
353
+ s.current && !s.current.contains(g.target) && t(!1);
1007
354
  };
1008
- return I(() => (document.addEventListener("click", u, !0), () => {
1009
- document.removeEventListener("click", u, !0);
1010
- }), []), { ref: i, isComponentVisible: n, setIsComponentVisible: l };
355
+ return D(() => (document.addEventListener("click", i, !0), () => {
356
+ document.removeEventListener("click", i, !0);
357
+ }), []), { ref: s, isComponentVisible: a, setIsComponentVisible: t };
1011
358
  }
1012
- const Je = "starasia-calendar-input-styles", $r = (t) => {
1013
- if (!document.getElementById(Je)) {
1014
- const n = document.createElement("style");
1015
- n.id = Je, n.textContent = t, document.head.appendChild(n);
359
+ const j = "starasia-calendar-input-styles", U = (r) => {
360
+ if (!document.getElementById(j)) {
361
+ const a = document.createElement("style");
362
+ a.id = j, a.textContent = r, document.head.appendChild(a);
1016
363
  }
1017
364
  };
1018
- $r(ie);
1019
- const te = (t) => {
1020
- if (t === "sm")
365
+ U(I);
366
+ const T = (r) => {
367
+ if (r === "sm")
1021
368
  return 16;
1022
- if (t === "md")
369
+ if (r === "md")
1023
370
  return 16;
1024
- if (t === "lg")
371
+ if (r === "lg")
1025
372
  return 20;
1026
- }, Yr = (t) => {
1027
- const { size: n = "md", status: l = "default", variant: i = "outline", ...u } = t, m = Q(null), b = () => {
1028
- m.current && u.onClick && (m.current.focus(), u.onClick(""));
373
+ }, K = (r) => {
374
+ const { size: a = "md", status: t = "default", variant: s = "outline", ...i } = r, g = E(null), f = () => {
375
+ g.current && i.onClick && (g.current.focus(), i.onClick(""));
1029
376
  };
1030
- return /* @__PURE__ */ o.jsxs(
377
+ return /* @__PURE__ */ $(
1031
378
  "div",
1032
379
  {
1033
- className: `starasia-calendar-input-container starasia-calendar-input-${i} starasia-calendar-input-container-${l} ${n} `,
1034
- onClick: b,
380
+ className: `starasia-calendar-input-container starasia-calendar-input-${s} starasia-calendar-input-container-${t} ${a} `,
381
+ onClick: f,
1035
382
  children: [
1036
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-container-icon-left", children: /* @__PURE__ */ o.jsx(
383
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-container-icon-left", children: /* @__PURE__ */ l(
1037
384
  "svg",
1038
385
  {
1039
386
  xmlns: "http://www.w3.org/2000/svg",
1040
- width: te(n),
1041
- height: te(n),
387
+ width: T(a),
388
+ height: T(a),
1042
389
  viewBox: "0 0 20 20",
1043
390
  fill: "none",
1044
- children: /* @__PURE__ */ o.jsx(
391
+ children: /* @__PURE__ */ l(
1045
392
  "path",
1046
393
  {
1047
394
  d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
@@ -1053,25 +400,25 @@ const te = (t) => {
1053
400
  )
1054
401
  }
1055
402
  ) }),
1056
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-preview-container", children: /* @__PURE__ */ o.jsx(
403
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-preview-container", children: /* @__PURE__ */ l(
1057
404
  "input",
1058
405
  {
1059
406
  className: "starasia-calendar-input",
1060
- ...u,
1061
- disabled: l === "disable" ? !0 : u.disabled,
1062
- value: u.value,
1063
- ref: m
407
+ ...i,
408
+ disabled: t === "disable" ? !0 : i.disabled,
409
+ value: i.value,
410
+ ref: g
1064
411
  }
1065
412
  ) }),
1066
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-container-icon-right", children: /* @__PURE__ */ o.jsx(
413
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-container-icon-right", children: /* @__PURE__ */ l(
1067
414
  "svg",
1068
415
  {
1069
416
  xmlns: "http://www.w3.org/2000/svg",
1070
- width: te(n),
1071
- height: te(n),
417
+ width: T(a),
418
+ height: T(a),
1072
419
  viewBox: "0 0 20 20",
1073
420
  fill: "none",
1074
- children: /* @__PURE__ */ o.jsx(
421
+ children: /* @__PURE__ */ l(
1075
422
  "path",
1076
423
  {
1077
424
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -1086,178 +433,178 @@ const te = (t) => {
1086
433
  ]
1087
434
  }
1088
435
  );
1089
- }, Or = ({
1090
- date: t,
1091
- setDate: n,
1092
- dateRange: l,
1093
- setDateRange: i,
1094
- onChange: u,
1095
- minDate: m,
1096
- maxDate: b,
1097
- input: j
436
+ }, Q = ({
437
+ date: r,
438
+ setDate: a,
439
+ dateRange: t,
440
+ setDateRange: s,
441
+ onChange: i,
442
+ minDate: g,
443
+ maxDate: f,
444
+ input: v
1098
445
  }) => {
1099
- var v, c, g;
1100
- let f = new Date(t.getFullYear(), t.getMonth(), 1), a = f.getDay(), E = [];
1101
- const w = t.getMonth();
446
+ var u, n, c;
447
+ let h = new Date(r.getFullYear(), r.getMonth(), 1), e = h.getDay(), w = [];
448
+ const b = r.getMonth();
1102
449
  for (let d = 0; d < 42; d++) {
1103
- d === 0 && a === 0 ? f.setDate(f.getDate() - 7) : d === 0 ? f.setDate(
1104
- f.getDate() + (d - a)
1105
- ) : f.setDate(f.getDate() + 1);
1106
- let p = {
1107
- currentMonth: f.getMonth() === w,
1108
- date: new Date(f),
1109
- month: f.getMonth(),
1110
- number: f.getDate(),
1111
- selected: f.toDateString() === ((v = l.from) == null ? void 0 : v.toDateString()) || f.toDateString() === (((c = l.to) == null ? void 0 : c.toDateString()) || ((g = l.from) == null ? void 0 : g.toDateString())),
1112
- year: f.getFullYear(),
1113
- isDisabled: m && f < m || b && f > b
450
+ d === 0 && e === 0 ? h.setDate(h.getDate() - 7) : d === 0 ? h.setDate(
451
+ h.getDate() + (d - e)
452
+ ) : h.setDate(h.getDate() + 1);
453
+ let y = {
454
+ currentMonth: h.getMonth() === b,
455
+ date: new Date(h),
456
+ month: h.getMonth(),
457
+ number: h.getDate(),
458
+ selected: h.toDateString() === ((u = t.from) == null ? void 0 : u.toDateString()) || h.toDateString() === (((n = t.to) == null ? void 0 : n.toDateString()) || ((c = t.from) == null ? void 0 : c.toDateString())),
459
+ year: h.getFullYear(),
460
+ isDisabled: g && h < g || f && h > f
1114
461
  };
1115
- E.push(p);
462
+ w.push(y);
1116
463
  }
1117
- const _ = (d) => {
1118
- n(d);
1119
- }, S = (d) => {
1120
- var h;
1121
- let p = { ...l };
1122
- if (p.from && p.to)
1123
- p = { from: d, to: null };
464
+ const k = (d) => {
465
+ a(d);
466
+ }, M = (d) => {
467
+ var o;
468
+ let y = { ...t };
469
+ if (y.from && y.to)
470
+ y = { from: d, to: null };
1124
471
  else {
1125
- const x = ((h = p.from) == null ? void 0 : h.getTime()) || 0;
1126
- d.getTime() > x ? p = { from: p.from, to: d } : p = { from: d, to: p.from };
472
+ const p = ((o = y.from) == null ? void 0 : o.getTime()) || 0;
473
+ d.getTime() > p ? y = { from: y.from, to: d } : y = { from: d, to: y.from };
1127
474
  }
1128
- i(p), u(p);
475
+ s(y), i(y);
1129
476
  };
1130
- return /* @__PURE__ */ o.jsxs("div", { className: "starasia-calendar-days-preivew", children: [
1131
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-days-name-preivew", children: Xe.map((d, p) => /* @__PURE__ */ o.jsx("p", { children: d }, p)) }),
1132
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-days-number-preivew", children: E.map((d, p) => {
1133
- var Y;
1134
- const h = d.date.getTime() > l.from.getTime() && d.date.getTime() < (((Y = l.to) == null ? void 0 : Y.getTime()) || l.from.getTime()), x = d.isDisabled;
1135
- return /* @__PURE__ */ o.jsx(
477
+ return /* @__PURE__ */ $("div", { className: "starasia-calendar-days-preivew", children: [
478
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-days-name-preivew", children: A.map((d, y) => /* @__PURE__ */ l("p", { children: d }, y)) }),
479
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-days-number-preivew", children: w.map((d, y) => {
480
+ var C;
481
+ const o = d.date.getTime() > t.from.getTime() && d.date.getTime() < (((C = t.to) == null ? void 0 : C.getTime()) || t.from.getTime()), p = d.isDisabled;
482
+ return /* @__PURE__ */ l(
1136
483
  "p",
1137
484
  {
1138
485
  className: `${d.currentMonth ? "starasia-calendar-days-current" : "starasia-calendar-days"} ${d.selected ? "starasia-calendar-days-active" : ""}`,
1139
486
  style: {
1140
- backgroundColor: h ? "rgba(100, 181, 246, 0.1)" : "",
1141
- pointerEvents: x ? "none" : void 0,
1142
- cursor: x ? "not-allowed" : "pointer",
1143
- color: x ? "#ccc" : h ? "#b0b0b0" : "",
1144
- ...j ? {} : { width: "100%" }
487
+ backgroundColor: o ? "rgba(100, 181, 246, 0.1)" : "",
488
+ pointerEvents: p ? "none" : void 0,
489
+ cursor: p ? "not-allowed" : "pointer",
490
+ color: p ? "#ccc" : o ? "#b0b0b0" : "",
491
+ ...v ? {} : { width: "100%" }
1145
492
  },
1146
493
  onClick: () => {
1147
- x || (_(d.date), S(d.date));
494
+ p || (k(d.date), M(d.date));
1148
495
  },
1149
496
  children: d.number
1150
497
  },
1151
- p
498
+ y
1152
499
  );
1153
500
  }) })
1154
501
  ] });
1155
- }, Pr = ({
1156
- date: t,
1157
- setDate: n,
1158
- filter: l,
1159
- setViews: i,
1160
- dateRange: u,
1161
- setDateRange: m,
1162
- onChange: b,
1163
- minDate: j,
1164
- maxDate: f,
1165
- input: a
502
+ }, X = ({
503
+ date: r,
504
+ setDate: a,
505
+ filter: t,
506
+ setViews: s,
507
+ dateRange: i,
508
+ setDateRange: g,
509
+ onChange: f,
510
+ minDate: v,
511
+ maxDate: h,
512
+ input: e
1166
513
  }) => {
1167
- const E = u.from.getFullYear(), w = t.getFullYear(), _ = (v) => {
1168
- l ? (S(v), n(v)) : (i("days"), n(v));
1169
- }, S = (v) => {
1170
- var g;
1171
- let c = { ...u };
1172
- if (c.from && c.to)
1173
- c = { from: v, to: null };
514
+ const w = i.from.getFullYear(), b = r.getFullYear(), k = (u) => {
515
+ t ? (M(u), a(u)) : (s("days"), a(u));
516
+ }, M = (u) => {
517
+ var c;
518
+ let n = { ...i };
519
+ if (n.from && n.to)
520
+ n = { from: u, to: null };
1174
521
  else {
1175
- const d = ((g = c.from) == null ? void 0 : g.getTime()) || 0;
1176
- v.getTime() > d ? c = { from: c.from, to: v } : c = { from: v, to: c.from };
522
+ const d = ((c = n.from) == null ? void 0 : c.getTime()) || 0;
523
+ u.getTime() > d ? n = { from: n.from, to: u } : n = { from: u, to: n.from };
1177
524
  }
1178
- m(c), b(c);
525
+ g(n), f(n);
1179
526
  };
1180
- return /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-months-preview", children: U.map((v, c) => {
1181
- var p, h, x;
1182
- const g = new Date(w, c).getTime() > u.from.getTime() && new Date(w, c).getTime() < (((p = u.to) == null ? void 0 : p.getTime()) || u.from.getTime()), d = j && new Date(w, c) < j || f && new Date(w, c) > f;
1183
- return /* @__PURE__ */ o.jsx(
527
+ return /* @__PURE__ */ l("div", { className: "starasia-calendar-months-preview", children: N.map((u, n) => {
528
+ var y, o, p;
529
+ const c = new Date(b, n).getTime() > i.from.getTime() && new Date(b, n).getTime() < (((y = i.to) == null ? void 0 : y.getTime()) || i.from.getTime()), d = v && new Date(b, n) < v || h && new Date(b, n) > h;
530
+ return /* @__PURE__ */ l(
1184
531
  "p",
1185
532
  {
1186
- className: E === w && (c === ((h = u.from) == null ? void 0 : h.getMonth()) || c === ((x = u.to) == null ? void 0 : x.getMonth())) ? "starasia-calendar-months-active" : "",
533
+ className: w === b && (n === ((o = i.from) == null ? void 0 : o.getMonth()) || n === ((p = i.to) == null ? void 0 : p.getMonth())) ? "starasia-calendar-months-active" : "",
1187
534
  style: {
1188
- backgroundColor: g ? "rgba(100, 181, 246, 0.1)" : "",
535
+ backgroundColor: c ? "rgba(100, 181, 246, 0.1)" : "",
1189
536
  pointerEvents: d ? "none" : void 0,
1190
537
  cursor: d ? "not-allowed" : "pointer",
1191
- color: d ? "#ccc" : g ? "#b0b0b0" : "",
1192
- ...a ? {} : { width: "100%" }
538
+ color: d ? "#ccc" : c ? "#b0b0b0" : "",
539
+ ...e ? {} : { width: "100%" }
1193
540
  },
1194
541
  onClick: () => {
1195
- d || _(new Date(w, c));
542
+ d || k(new Date(b, n));
1196
543
  },
1197
- children: v.slice(0, 3)
544
+ children: u.slice(0, 3)
1198
545
  },
1199
- c
546
+ n
1200
547
  );
1201
548
  }) });
1202
- }, ye = (t) => {
1203
- const n = Math.floor(t / 10) * 10, l = n + 10;
1204
- return { start: n, end: l };
1205
- }, Nr = ({
1206
- date: t,
1207
- filter: n,
1208
- setViews: l,
1209
- setDate: i,
1210
- dateRange: u,
1211
- setDateRange: m,
1212
- onChange: b,
1213
- minDate: j,
1214
- maxDate: f,
1215
- input: a
549
+ }, B = (r) => {
550
+ const a = Math.floor(r / 10) * 10, t = a + 10;
551
+ return { start: a, end: t };
552
+ }, Z = ({
553
+ date: r,
554
+ filter: a,
555
+ setViews: t,
556
+ setDate: s,
557
+ dateRange: i,
558
+ setDateRange: g,
559
+ onChange: f,
560
+ minDate: v,
561
+ maxDate: h,
562
+ input: e
1216
563
  }) => {
1217
- var p;
1218
- let E = [];
1219
- const w = t.getFullYear(), { start: _, end: S } = ye(w), v = u.from.getFullYear(), c = (p = u.to) == null ? void 0 : p.getFullYear();
1220
- for (let h = _; h < S; h++) {
1221
- const x = new Date(h, 0), Y = (!j || x >= j) && (!f || x <= f), $ = h === v || h === c, C = x > u.from && x < u.to;
1222
- E.push({
1223
- year: h,
1224
- active: $ && Y,
1225
- highlight: C && Y,
1226
- disabled: !Y
564
+ var y;
565
+ let w = [];
566
+ const b = r.getFullYear(), { start: k, end: M } = B(b), u = i.from.getFullYear(), n = (y = i.to) == null ? void 0 : y.getFullYear();
567
+ for (let o = k; o < M; o++) {
568
+ const p = new Date(o, 0), C = (!v || p >= v) && (!h || p <= h), x = o === u || o === n, m = p > i.from && p < i.to;
569
+ w.push({
570
+ year: o,
571
+ active: x && C,
572
+ highlight: m && C,
573
+ disabled: !C
1227
574
  });
1228
575
  }
1229
- const g = (h) => {
1230
- n ? (d(h), i(h)) : (i(h), l("months"));
1231
- }, d = (h) => {
1232
- var Y;
1233
- let x = { ...u };
1234
- if (x.from && x.to)
1235
- x = { from: h, to: null };
576
+ const c = (o) => {
577
+ a ? (d(o), s(o)) : (s(o), t("months"));
578
+ }, d = (o) => {
579
+ var C;
580
+ let p = { ...i };
581
+ if (p.from && p.to)
582
+ p = { from: o, to: null };
1236
583
  else {
1237
- const $ = ((Y = x.from) == null ? void 0 : Y.getTime()) || 0;
1238
- h.getTime() > $ ? x = { from: x.from, to: h } : x = { from: h, to: x.from };
584
+ const x = ((C = p.from) == null ? void 0 : C.getTime()) || 0;
585
+ o.getTime() > x ? p = { from: p.from, to: o } : p = { from: o, to: p.from };
1239
586
  }
1240
- m(x), b(x);
587
+ g(p), f(p);
1241
588
  };
1242
- return /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-years-preview", children: E.map((h, x) => /* @__PURE__ */ o.jsx(
589
+ return /* @__PURE__ */ l("div", { className: "starasia-calendar-years-preview", children: w.map((o, p) => /* @__PURE__ */ l(
1243
590
  "p",
1244
591
  {
1245
- className: `${h.active ? "starasia-calendar-months-active" : ""} ${h.highlight ? "starasia-calendar-months-highlight" : ""} ${h.disabled ? "starasia-calendar-disabled" : ""}`,
592
+ className: `${o.active ? "starasia-calendar-months-active" : ""} ${o.highlight ? "starasia-calendar-months-highlight" : ""} ${o.disabled ? "starasia-calendar-disabled" : ""}`,
1246
593
  onClick: () => {
1247
- h.disabled || g(new Date(h.year, 0));
594
+ o.disabled || c(new Date(o.year, 0));
1248
595
  },
1249
596
  style: {
1250
- backgroundColor: h.highlight ? "rgba(100, 181, 246, 0.1)" : "",
1251
- color: h.highlight ? "#b0b0b0" : h.active ? "" : h.disabled ? "#ccc" : "",
1252
- cursor: h.disabled ? "not-allowed" : "pointer",
1253
- pointerEvents: h.disbled ? "none" : "all",
1254
- ...a ? {} : { width: "100%" }
597
+ backgroundColor: o.highlight ? "rgba(100, 181, 246, 0.1)" : "",
598
+ color: o.highlight ? "#b0b0b0" : o.active ? "" : o.disabled ? "#ccc" : "",
599
+ cursor: o.disabled ? "not-allowed" : "pointer",
600
+ pointerEvents: o.disbled ? "none" : "all",
601
+ ...e ? {} : { width: "100%" }
1255
602
  },
1256
- children: h.year
603
+ children: o.year
1257
604
  },
1258
- x
605
+ p
1259
606
  )) });
1260
- }, Qe = ({ ...t }) => /* @__PURE__ */ o.jsx(
607
+ }, q = ({ ...r }) => /* @__PURE__ */ l(
1261
608
  "svg",
1262
609
  {
1263
610
  xmlns: "http://www.w3.org/2000/svg",
@@ -1265,8 +612,8 @@ const te = (t) => {
1265
612
  height: "20",
1266
613
  viewBox: "0 0 20 20",
1267
614
  fill: "none",
1268
- ...t,
1269
- children: /* @__PURE__ */ o.jsx(
615
+ ...r,
616
+ children: /* @__PURE__ */ l(
1270
617
  "path",
1271
618
  {
1272
619
  d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
@@ -1277,7 +624,7 @@ const te = (t) => {
1277
624
  }
1278
625
  )
1279
626
  }
1280
- ), er = ({ ...t }) => /* @__PURE__ */ o.jsx(
627
+ ), P = ({ ...r }) => /* @__PURE__ */ l(
1281
628
  "svg",
1282
629
  {
1283
630
  xmlns: "http://www.w3.org/2000/svg",
@@ -1285,8 +632,8 @@ const te = (t) => {
1285
632
  height: "20",
1286
633
  viewBox: "0 0 20 20",
1287
634
  fill: "none",
1288
- ...t,
1289
- children: /* @__PURE__ */ o.jsx(
635
+ ...r,
636
+ children: /* @__PURE__ */ l(
1290
637
  "path",
1291
638
  {
1292
639
  d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
@@ -1297,201 +644,201 @@ const te = (t) => {
1297
644
  }
1298
645
  )
1299
646
  }
1300
- ), Ir = ({
1301
- setViews: t,
1302
- views: n,
1303
- filter: l,
1304
- date: i,
1305
- setDate: u
647
+ ), _ = ({
648
+ setViews: r,
649
+ views: a,
650
+ filter: t,
651
+ date: s,
652
+ setDate: i
1306
653
  }) => {
1307
- const m = () => {
1308
- l || t((a) => a === "days" ? "months" : a === "months" ? "years" : "days");
1309
- }, b = () => {
1310
- if (n === "years") {
1311
- u((a) => new Date(a.getFullYear() + 10, 0));
654
+ const g = () => {
655
+ t || r((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
656
+ }, f = () => {
657
+ if (a === "years") {
658
+ i((e) => new Date(e.getFullYear() + 10, 0));
1312
659
  return;
1313
660
  }
1314
- if (n === "months") {
1315
- u((a) => new Date(a.getFullYear() + 1, a.getMonth()));
661
+ if (a === "months") {
662
+ i((e) => new Date(e.getFullYear() + 1, e.getMonth()));
1316
663
  return;
1317
664
  }
1318
- u((a) => new Date(a.getFullYear(), a.getMonth() + 1));
1319
- }, j = () => {
1320
- if (n === "years") {
1321
- u((a) => new Date(a.getFullYear() - 10, 0));
665
+ i((e) => new Date(e.getFullYear(), e.getMonth() + 1));
666
+ }, v = () => {
667
+ if (a === "years") {
668
+ i((e) => new Date(e.getFullYear() - 10, 0));
1322
669
  return;
1323
670
  }
1324
- if (n === "months") {
1325
- u((a) => new Date(a.getFullYear() - 1, a.getMonth()));
671
+ if (a === "months") {
672
+ i((e) => new Date(e.getFullYear() - 1, e.getMonth()));
1326
673
  return;
1327
674
  }
1328
- u(
1329
- (a) => new Date(
1330
- a.getMonth() === 0 ? a.getFullYear() - 1 : a.getFullYear(),
1331
- a.getMonth() === 0 ? 11 : a.getMonth() - 1
675
+ i(
676
+ (e) => new Date(
677
+ e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
678
+ e.getMonth() === 0 ? 11 : e.getMonth() - 1
1332
679
  )
1333
680
  );
1334
- }, f = () => {
1335
- if (n === "days")
1336
- return `${U[i.getMonth()]} ${i.getFullYear()}`;
1337
- if (n === "months")
1338
- return `${i.getFullYear()}`;
1339
- if (n === "years")
1340
- return `${ye(i.getFullYear()).start} ~ ${ye(i.getFullYear()).end}`;
1341
681
  };
1342
- return /* @__PURE__ */ o.jsxs("div", { className: "starasia-calendar-header", children: [
1343
- /* @__PURE__ */ o.jsx(Qe, { onClick: () => j() }),
1344
- /* @__PURE__ */ o.jsx("div", { style: { cursor: "pointer" }, onClick: m, children: f() }),
1345
- /* @__PURE__ */ o.jsx(er, { onClick: () => b() })
682
+ return /* @__PURE__ */ $("div", { className: "starasia-calendar-header", children: [
683
+ /* @__PURE__ */ l(q, { onClick: () => v() }),
684
+ /* @__PURE__ */ l("div", { style: { cursor: "pointer" }, onClick: g, children: (() => {
685
+ if (a === "days")
686
+ return `${N[s.getMonth()]} ${s.getFullYear()}`;
687
+ if (a === "months")
688
+ return `${s.getFullYear()}`;
689
+ if (a === "years")
690
+ return `${B(s.getFullYear()).start} ~ ${B(s.getFullYear()).end}`;
691
+ })() }),
692
+ /* @__PURE__ */ l(P, { onClick: () => f() })
1346
693
  ] });
1347
694
  };
1348
- function q(t) {
1349
- const n = new Date(t), l = n.getFullYear(), i = n.getMonth();
1350
- return `${n.getDate().toString().padStart(2, "0")} ${Fr[i]} ${l}`;
695
+ function L(r) {
696
+ const a = new Date(r), t = a.getFullYear(), s = a.getMonth();
697
+ return `${a.getDate().toString().padStart(2, "0")} ${G[s]} ${t}`;
1351
698
  }
1352
- const qe = "starasia-calendar-styles", Lr = (t) => {
1353
- if (!document.getElementById(qe)) {
1354
- const n = document.createElement("style");
1355
- n.id = qe, n.textContent = t, document.head.appendChild(n);
699
+ const z = "starasia-calendar-styles", aa = (r) => {
700
+ if (!document.getElementById(z)) {
701
+ const a = document.createElement("style");
702
+ a.id = z, a.textContent = r, document.head.appendChild(a);
1356
703
  }
1357
704
  };
1358
- Lr(ie);
1359
- const Ar = be(
705
+ aa(I);
706
+ const ea = W(
1360
707
  ({
1361
- value: t,
1362
- onChange: n,
1363
- filter: l,
1364
- input: i = !0,
1365
- disabled: u,
1366
- minDate: m,
1367
- maxDate: b,
1368
- placeholder: j,
1369
- size: f,
1370
- status: a
1371
- }, E) => {
1372
- const { ref: w, isComponentVisible: _, setIsComponentVisible: S } = Ze(!1), v = Q(null), [c, g] = B("days"), [d, p] = B(/* @__PURE__ */ new Date()), [h, x] = B({
1373
- from: (t == null ? void 0 : t.from) || /* @__PURE__ */ new Date(),
1374
- to: (t == null ? void 0 : t.to) || /* @__PURE__ */ new Date()
708
+ value: r,
709
+ onChange: a,
710
+ filter: t,
711
+ input: s = !0,
712
+ disabled: i,
713
+ minDate: g,
714
+ maxDate: f,
715
+ placeholder: v,
716
+ size: h,
717
+ status: e
718
+ }, w) => {
719
+ const { ref: b, isComponentVisible: k, setIsComponentVisible: M } = J(!1), u = E(null), [n, c] = F("days"), [d, y] = F(/* @__PURE__ */ new Date()), [o, p] = F({
720
+ from: (r == null ? void 0 : r.from) || /* @__PURE__ */ new Date(),
721
+ to: (r == null ? void 0 : r.to) || /* @__PURE__ */ new Date()
1375
722
  });
1376
- I(() => {
1377
- t ? (p(t.from), x(t)) : (p(/* @__PURE__ */ new Date()), x({
723
+ D(() => {
724
+ r ? (y(r.from), p(r)) : (y(/* @__PURE__ */ new Date()), p({
1378
725
  from: /* @__PURE__ */ new Date(),
1379
726
  to: /* @__PURE__ */ new Date()
1380
727
  }));
1381
- }, [t]), I(() => {
1382
- l && g(l);
1383
- }, [l]), I(() => {
1384
- l || g("days");
1385
- }, [_]), I(() => {
1386
- i || S(!0);
1387
- }, [i]);
1388
- const Y = () => {
1389
- var C, P;
1390
- if (!t)
728
+ }, [r]), D(() => {
729
+ t && c(t);
730
+ }, [t]), D(() => {
731
+ t || c("days");
732
+ }, [k]), D(() => {
733
+ s || M(!0);
734
+ }, [s]);
735
+ const C = () => {
736
+ var m, Y;
737
+ if (!r)
1391
738
  return "";
1392
- if (l) {
1393
- if (c === "days")
1394
- return `${q(h.from)} ~ ${q(h.to || h.from) || "-"}`;
1395
- if (c === "months")
1396
- return `${U[h.from.getMonth()]} ~ ${h.to ? U[h.to.getMonth()] : "-"}`;
1397
- if (c === "years")
1398
- return `${(C = h.from) == null ? void 0 : C.getFullYear()} ~ ${((P = h.to) == null ? void 0 : P.getFullYear()) || "-"}`;
739
+ if (t) {
740
+ if (n === "days")
741
+ return `${L(o.from)} ~ ${L(o.to || o.from) || "-"}`;
742
+ if (n === "months")
743
+ return `${N[o.from.getMonth()]} ~ ${o.to ? N[o.to.getMonth()] : "-"}`;
744
+ if (n === "years")
745
+ return `${(m = o.from) == null ? void 0 : m.getFullYear()} ~ ${((Y = o.to) == null ? void 0 : Y.getFullYear()) || "-"}`;
1399
746
  } else
1400
- return `${q(h.from)} ~ ${q(h.to || h.from) || "-"}`;
1401
- }, $ = () => {
1402
- if (v.current && w.current && i) {
1403
- const C = w.current.getBoundingClientRect(), P = v.current.getBoundingClientRect();
1404
- window.innerWidth < C.left + P.width ? v.current.style.left = `${C.left - P.width + C.width}px` : v.current.style.left = `${C.left}px`, C.top + P.height > window.innerHeight ? v.current.style.top = `${C.y - (C.height + P.height - 28)}px` : v.current.style.top = `${C.y + C.height}px`;
747
+ return `${L(o.from)} ~ ${L(o.to || o.from) || "-"}`;
748
+ }, x = () => {
749
+ if (u.current && b.current && s) {
750
+ const m = b.current.getBoundingClientRect(), Y = u.current.getBoundingClientRect();
751
+ window.innerWidth < m.left + Y.width ? u.current.style.left = `${m.left - Y.width + m.width}px` : u.current.style.left = `${m.left}px`, m.top + Y.height > window.innerHeight ? u.current.style.top = `${m.y - (m.height + Y.height - 28)}px` : u.current.style.top = `${m.y + m.height}px`;
1405
752
  }
1406
753
  };
1407
- return I(() => {
1408
- v.current && w.current && i && $();
1409
- }, [v, w, _]), I(() => {
1410
- const C = E == null ? void 0 : E.current;
1411
- return C && C.addEventListener("scroll", $), window.addEventListener("scroll", $), () => {
1412
- C && C.removeEventListener("scroll", $), window.removeEventListener("scroll", $);
754
+ return D(() => {
755
+ u.current && b.current && s && x();
756
+ }, [u, b, k]), D(() => {
757
+ const m = w == null ? void 0 : w.current;
758
+ return m && m.addEventListener("scroll", x), window.addEventListener("scroll", x), () => {
759
+ m && m.removeEventListener("scroll", x), window.removeEventListener("scroll", x);
1413
760
  };
1414
- }, []), /* @__PURE__ */ o.jsxs(
761
+ }, []), /* @__PURE__ */ $(
1415
762
  "div",
1416
763
  {
1417
764
  className: "starasia-calendar-wrapper",
1418
- style: { height: i ? "auto" : "100%" },
1419
- ref: i ? w : null,
765
+ style: { height: s ? "auto" : "100%" },
766
+ ref: s ? b : null,
1420
767
  children: [
1421
- i ? /* @__PURE__ */ o.jsx(
1422
- Yr,
768
+ s ? /* @__PURE__ */ l(
769
+ K,
1423
770
  {
1424
- value: Y(),
771
+ value: C(),
1425
772
  inputMode: "none",
1426
773
  onClick: () => {
1427
- S(!0);
774
+ M(!0);
1428
775
  },
1429
776
  onChange: () => {
1430
777
  },
1431
- disabled: u,
1432
- placeholder: j,
1433
- size: f,
1434
- status: a
778
+ disabled: i,
779
+ placeholder: v,
780
+ size: h,
781
+ status: e
1435
782
  }
1436
783
  ) : null,
1437
- _ ? /* @__PURE__ */ o.jsxs(
784
+ k ? /* @__PURE__ */ $(
1438
785
  "div",
1439
786
  {
1440
- className: `starasia-calendar ${i ? "" : "starasia-calendar-no-input"}`,
1441
- ref: v,
787
+ className: `starasia-calendar ${s ? "" : "starasia-calendar-no-input"}`,
788
+ ref: u,
1442
789
  children: [
1443
- /* @__PURE__ */ o.jsx(
1444
- Ir,
790
+ /* @__PURE__ */ l(
791
+ _,
1445
792
  {
1446
- setViews: g,
1447
- views: c,
1448
- filter: l,
793
+ setViews: c,
794
+ views: n,
795
+ filter: t,
1449
796
  date: d,
1450
- setDate: p
797
+ setDate: y
1451
798
  }
1452
799
  ),
1453
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-body", children: c === "days" ? /* @__PURE__ */ o.jsx(
1454
- Or,
800
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-body", children: n === "days" ? /* @__PURE__ */ l(
801
+ Q,
1455
802
  {
1456
803
  date: d,
1457
- setDate: p,
1458
- setIsComponentVisible: S,
1459
- dateRange: h,
1460
- setDateRange: x,
1461
- input: i,
1462
- onChange: n,
1463
- minDate: m,
1464
- maxDate: b
804
+ setDate: y,
805
+ setIsComponentVisible: M,
806
+ dateRange: o,
807
+ setDateRange: p,
808
+ input: s,
809
+ onChange: a,
810
+ minDate: g,
811
+ maxDate: f
1465
812
  }
1466
- ) : c === "months" ? /* @__PURE__ */ o.jsx(
1467
- Pr,
813
+ ) : n === "months" ? /* @__PURE__ */ l(
814
+ X,
1468
815
  {
1469
816
  date: d,
1470
- setDate: p,
1471
- filter: l,
1472
- setViews: g,
1473
- dateRange: h,
1474
- setDateRange: x,
1475
- setIsComponentVisible: S,
1476
- input: i,
1477
- onChange: n,
1478
- minDate: m,
1479
- maxDate: b
817
+ setDate: y,
818
+ filter: t,
819
+ setViews: c,
820
+ dateRange: o,
821
+ setDateRange: p,
822
+ setIsComponentVisible: M,
823
+ input: s,
824
+ onChange: a,
825
+ minDate: g,
826
+ maxDate: f
1480
827
  }
1481
- ) : /* @__PURE__ */ o.jsx(
1482
- Nr,
828
+ ) : /* @__PURE__ */ l(
829
+ Z,
1483
830
  {
1484
831
  date: d,
1485
- setDate: p,
1486
- filter: l,
1487
- setViews: g,
1488
- dateRange: h,
1489
- setDateRange: x,
1490
- setIsComponentVisible: S,
1491
- input: i,
1492
- onChange: n,
1493
- minDate: m,
1494
- maxDate: b
832
+ setDate: y,
833
+ filter: t,
834
+ setViews: c,
835
+ dateRange: o,
836
+ setDateRange: p,
837
+ setIsComponentVisible: M,
838
+ input: s,
839
+ onChange: a,
840
+ minDate: g,
841
+ maxDate: f
1495
842
  }
1496
843
  ) })
1497
844
  ]
@@ -1501,39 +848,39 @@ const Ar = be(
1501
848
  }
1502
849
  );
1503
850
  }
1504
- ), He = "starasia-calendar-input-styles", Wr = (t) => {
1505
- if (!document.getElementById(He)) {
1506
- const n = document.createElement("style");
1507
- n.id = He, n.textContent = t, document.head.appendChild(n);
851
+ ), O = "starasia-calendar-input-styles", ra = (r) => {
852
+ if (!document.getElementById(O)) {
853
+ const a = document.createElement("style");
854
+ a.id = O, a.textContent = r, document.head.appendChild(a);
1508
855
  }
1509
856
  };
1510
- Wr(ie);
1511
- const se = (t) => {
1512
- if (t === "sm")
857
+ ra(I);
858
+ const S = (r) => {
859
+ if (r === "sm")
1513
860
  return 16;
1514
- if (t === "md")
861
+ if (r === "md")
1515
862
  return 16;
1516
- if (t === "lg")
863
+ if (r === "lg")
1517
864
  return 20;
1518
- }, Vr = (t) => {
1519
- const { size: n = "md", status: l = "default", variant: i = "outline", ...u } = t, m = Q(null), b = () => {
1520
- m.current && u.onClick && (m.current.focus(), u.onClick(""));
865
+ }, na = (r) => {
866
+ const { size: a = "md", status: t = "default", variant: s = "outline", ...i } = r, g = E(null), f = () => {
867
+ g.current && i.onClick && (g.current.focus(), i.onClick(""));
1521
868
  };
1522
- return /* @__PURE__ */ o.jsxs(
869
+ return /* @__PURE__ */ $(
1523
870
  "div",
1524
871
  {
1525
- className: `starasia-calendar-input-container starasia-calendar-input-${i} starasia-calendar-input-container-${l} ${n} `,
1526
- onClick: b,
872
+ className: `starasia-calendar-input-container starasia-calendar-input-${s} starasia-calendar-input-container-${t} ${a} `,
873
+ onClick: f,
1527
874
  children: [
1528
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-container-icon-left", children: /* @__PURE__ */ o.jsx(
875
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-container-icon-left", children: /* @__PURE__ */ l(
1529
876
  "svg",
1530
877
  {
1531
878
  xmlns: "http://www.w3.org/2000/svg",
1532
- width: se(n),
1533
- height: se(n),
879
+ width: S(a),
880
+ height: S(a),
1534
881
  viewBox: "0 0 20 20",
1535
882
  fill: "none",
1536
- children: /* @__PURE__ */ o.jsx(
883
+ children: /* @__PURE__ */ l(
1537
884
  "path",
1538
885
  {
1539
886
  d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
@@ -1545,25 +892,25 @@ const se = (t) => {
1545
892
  )
1546
893
  }
1547
894
  ) }),
1548
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-preview-container", children: /* @__PURE__ */ o.jsx(
895
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-preview-container", children: /* @__PURE__ */ l(
1549
896
  "input",
1550
897
  {
1551
898
  className: "starasia-calendar-input",
1552
- ...u,
1553
- disabled: l === "disable" ? !0 : u.disabled,
1554
- value: u.value,
1555
- ref: m
899
+ ...i,
900
+ disabled: t === "disable" ? !0 : i.disabled,
901
+ value: i.value,
902
+ ref: g
1556
903
  }
1557
904
  ) }),
1558
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-container-icon-right", children: /* @__PURE__ */ o.jsx(
905
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-container-icon-right", children: /* @__PURE__ */ l(
1559
906
  "svg",
1560
907
  {
1561
908
  xmlns: "http://www.w3.org/2000/svg",
1562
- width: se(n),
1563
- height: se(n),
909
+ width: S(a),
910
+ height: S(a),
1564
911
  viewBox: "0 0 20 20",
1565
912
  fill: "none",
1566
- children: /* @__PURE__ */ o.jsx(
913
+ children: /* @__PURE__ */ l(
1567
914
  "path",
1568
915
  {
1569
916
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -1578,312 +925,312 @@ const se = (t) => {
1578
925
  ]
1579
926
  }
1580
927
  );
1581
- }, Br = ({
1582
- date: t,
1583
- setDate: n,
1584
- previewDate: l,
1585
- setPreviewDate: i,
1586
- setIsComponentVisible: u,
1587
- minDate: m,
1588
- maxDate: b,
1589
- input: j,
1590
- onChange: f
928
+ }, ta = ({
929
+ date: r,
930
+ setDate: a,
931
+ previewDate: t,
932
+ setPreviewDate: s,
933
+ setIsComponentVisible: i,
934
+ minDate: g,
935
+ maxDate: f,
936
+ input: v,
937
+ onChange: h
1591
938
  }) => {
1592
- let a = new Date(
1593
- l.getFullYear(),
1594
- l.getMonth(),
939
+ let e = new Date(
940
+ t.getFullYear(),
941
+ t.getMonth(),
1595
942
  1
1596
- ), E = a.getDay(), w = [];
1597
- const _ = t.toDateString(), S = l.getMonth();
1598
- for (let c = 0; c < 42; c++) {
1599
- c === 0 && E === 0 ? a.setDate(a.getDate() - 7) : c === 0 ? a.setDate(
1600
- a.getDate() + (c - E)
1601
- ) : a.setDate(a.getDate() + 1);
1602
- let g = {
1603
- currentMonth: a.getMonth() === S,
1604
- date: new Date(a),
1605
- month: a.getMonth(),
1606
- number: a.getDate(),
1607
- selected: a.toDateString() === _,
1608
- year: a.getFullYear(),
1609
- isDisabled: m && a < m || b && a > b
943
+ ), w = e.getDay(), b = [];
944
+ const k = r.toDateString(), M = t.getMonth();
945
+ for (let n = 0; n < 42; n++) {
946
+ n === 0 && w === 0 ? e.setDate(e.getDate() - 7) : n === 0 ? e.setDate(
947
+ e.getDate() + (n - w)
948
+ ) : e.setDate(e.getDate() + 1);
949
+ let c = {
950
+ currentMonth: e.getMonth() === M,
951
+ date: new Date(e),
952
+ month: e.getMonth(),
953
+ number: e.getDate(),
954
+ selected: e.toDateString() === k,
955
+ year: e.getFullYear(),
956
+ isDisabled: g && e < g || f && e > f
1610
957
  };
1611
- w.push(g);
958
+ b.push(c);
1612
959
  }
1613
- const v = (c) => {
1614
- (!m || c >= m) && (!b || c <= b) && (n(c), f(c), i(c), j && u(!1));
960
+ const u = (n) => {
961
+ (!g || n >= g) && (!f || n <= f) && (a(n), h(n), s(n), v && i(!1));
1615
962
  };
1616
- return /* @__PURE__ */ o.jsxs("div", { className: "starasia-calendar-days-preivew", children: [
1617
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-days-name-preivew", children: Xe.map((c, g) => /* @__PURE__ */ o.jsx("p", { children: c }, g)) }),
1618
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-days-number-preivew", children: w.map((c, g) => {
1619
- const d = c.isDisabled;
1620
- return /* @__PURE__ */ o.jsx(
963
+ return /* @__PURE__ */ $("div", { className: "starasia-calendar-days-preivew", children: [
964
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-days-name-preivew", children: A.map((n, c) => /* @__PURE__ */ l("p", { children: n }, c)) }),
965
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-days-number-preivew", children: b.map((n, c) => {
966
+ const d = n.isDisabled;
967
+ return /* @__PURE__ */ l(
1621
968
  "p",
1622
969
  {
1623
- className: `${c.currentMonth ? "starasia-calendar-days-current" : "starasia-calendar-days"} ${c.selected ? "starasia-calendar-days-active" : ""}`,
970
+ className: `${n.currentMonth ? "starasia-calendar-days-current" : "starasia-calendar-days"} ${n.selected ? "starasia-calendar-days-active" : ""}`,
1624
971
  style: {
1625
972
  color: d ? "#ccc" : void 0,
1626
973
  pointerEvents: d ? "none" : void 0,
1627
974
  cursor: d ? "not-allowed" : "pointer",
1628
- ...j ? {} : { width: "100%" }
975
+ ...v ? {} : { width: "100%" }
1629
976
  },
1630
977
  onClick: () => {
1631
- d || v(c.date);
978
+ d || u(n.date);
1632
979
  },
1633
- children: c.number
980
+ children: n.number
1634
981
  },
1635
- g
982
+ c
1636
983
  );
1637
984
  }) })
1638
985
  ] });
1639
- }, Ur = ({
1640
- date: t,
1641
- setDate: n,
1642
- filter: l,
1643
- setViews: i,
1644
- onChange: u,
1645
- previewDate: m,
1646
- setPreviewDate: b,
1647
- minDate: j,
1648
- maxDate: f,
1649
- input: a
986
+ }, sa = ({
987
+ date: r,
988
+ setDate: a,
989
+ filter: t,
990
+ setViews: s,
991
+ onChange: i,
992
+ previewDate: g,
993
+ setPreviewDate: f,
994
+ minDate: v,
995
+ maxDate: h,
996
+ input: e
1650
997
  }) => {
1651
- const E = t.getMonth(), w = t.getFullYear(), _ = m.getFullYear(), S = (v) => {
1652
- (!j || v >= j) && (!f || v <= f) && (l ? (u(v), n(v), b(v)) : (i("days"), b(v)));
998
+ const w = r.getMonth(), b = r.getFullYear(), k = g.getFullYear(), M = (u) => {
999
+ (!v || u >= v) && (!h || u <= h) && (t ? (i(u), a(u), f(u)) : (s("days"), f(u)));
1653
1000
  };
1654
- return /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-months-preview", children: U.map((v, c) => {
1655
- const g = j && new Date(_, c, 1) < j || f && new Date(_, c + 1, 0) > f;
1656
- return /* @__PURE__ */ o.jsx(
1001
+ return /* @__PURE__ */ l("div", { className: "starasia-calendar-months-preview", children: N.map((u, n) => {
1002
+ const c = v && new Date(k, n, 1) < v || h && new Date(k, n + 1, 0) > h;
1003
+ return /* @__PURE__ */ l(
1657
1004
  "p",
1658
1005
  {
1659
- className: c === E && _ === w ? "starasia-calendar-months-active" : "",
1006
+ className: n === w && k === b ? "starasia-calendar-months-active" : "",
1660
1007
  style: {
1661
- color: g ? "#ccc" : void 0,
1662
- pointerEvents: g ? "none" : void 0,
1663
- cursor: g ? "not-allowed" : "pointer",
1664
- ...a ? {} : { width: "100%" }
1008
+ color: c ? "#ccc" : void 0,
1009
+ pointerEvents: c ? "none" : void 0,
1010
+ cursor: c ? "not-allowed" : "pointer",
1011
+ ...e ? {} : { width: "100%" }
1665
1012
  },
1666
1013
  onClick: () => {
1667
- g || S(new Date(_, c));
1014
+ c || M(new Date(k, n));
1668
1015
  },
1669
- children: v.slice(0, 3)
1016
+ children: u.slice(0, 3)
1670
1017
  },
1671
- c
1018
+ n
1672
1019
  );
1673
1020
  }) });
1674
- }, me = (t) => {
1675
- const n = Math.floor(t / 10) * 10, l = n + 10;
1676
- return { start: n, end: l };
1677
- }, zr = ({
1678
- date: t,
1679
- filter: n,
1680
- setViews: l,
1681
- setDate: i,
1682
- onChange: u,
1683
- previewDate: m,
1684
- setPreviewDate: b,
1685
- minDate: j,
1686
- maxDate: f,
1687
- input: a
1021
+ }, V = (r) => {
1022
+ const a = Math.floor(r / 10) * 10, t = a + 10;
1023
+ return { start: a, end: t };
1024
+ }, ia = ({
1025
+ date: r,
1026
+ filter: a,
1027
+ setViews: t,
1028
+ setDate: s,
1029
+ onChange: i,
1030
+ previewDate: g,
1031
+ setPreviewDate: f,
1032
+ minDate: v,
1033
+ maxDate: h,
1034
+ input: e
1688
1035
  }) => {
1689
- let E = [];
1690
- const w = m.getFullYear(), { start: _, end: S } = me(w), v = t.getFullYear();
1691
- for (let g = _; g < S; g++) {
1692
- let d = j && new Date(g, 0, 1) < j || f && new Date(g, 11, 31) > f;
1693
- E.push({ year: g, active: g === v, isDisabled: d });
1036
+ let w = [];
1037
+ const b = g.getFullYear(), { start: k, end: M } = V(b), u = r.getFullYear();
1038
+ for (let c = k; c < M; c++) {
1039
+ let d = v && new Date(c, 0, 1) < v || h && new Date(c, 11, 31) > h;
1040
+ w.push({ year: c, active: c === u, isDisabled: d });
1694
1041
  }
1695
- const c = (g) => {
1696
- (!j || g >= j) && (!f || g <= f) && (n ? (u(g), i(g), b(g)) : (l("months"), b(g)));
1042
+ const n = (c) => {
1043
+ (!v || c >= v) && (!h || c <= h) && (a ? (i(c), s(c), f(c)) : (t("months"), f(c)));
1697
1044
  };
1698
- return /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-years-preview", children: E.map((g, d) => /* @__PURE__ */ o.jsx(
1045
+ return /* @__PURE__ */ l("div", { className: "starasia-calendar-years-preview", children: w.map((c, d) => /* @__PURE__ */ l(
1699
1046
  "p",
1700
1047
  {
1701
- className: g.active ? "starasia-calendar-months-active" : "",
1048
+ className: c.active ? "starasia-calendar-months-active" : "",
1702
1049
  style: {
1703
- color: g.isDisabled ? "#ccc" : void 0,
1704
- pointerEvents: g.isDisabled ? "none" : void 0,
1705
- cursor: g.isDisabled ? "not-allowed" : "pointer",
1706
- ...a ? {} : { width: "100%" }
1050
+ color: c.isDisabled ? "#ccc" : void 0,
1051
+ pointerEvents: c.isDisabled ? "none" : void 0,
1052
+ cursor: c.isDisabled ? "not-allowed" : "pointer",
1053
+ ...e ? {} : { width: "100%" }
1707
1054
  },
1708
1055
  onClick: () => {
1709
- g.isDisabled || c(new Date(g.year, 0));
1056
+ c.isDisabled || n(new Date(c.year, 0));
1710
1057
  },
1711
- children: g.year
1058
+ children: c.year
1712
1059
  },
1713
1060
  d
1714
1061
  )) });
1715
- }, Jr = ({
1716
- setViews: t,
1717
- views: n,
1718
- filter: l,
1719
- previewDate: i,
1720
- setPreviewDate: u
1062
+ }, oa = ({
1063
+ setViews: r,
1064
+ views: a,
1065
+ filter: t,
1066
+ previewDate: s,
1067
+ setPreviewDate: i
1721
1068
  }) => {
1722
- const m = () => {
1723
- l || t((a) => a === "days" ? "months" : a === "months" ? "years" : "days");
1724
- }, b = () => {
1725
- if (n === "years") {
1726
- u((a) => new Date(a.getFullYear() + 10, 0));
1069
+ const g = () => {
1070
+ t || r((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
1071
+ }, f = () => {
1072
+ if (a === "years") {
1073
+ i((e) => new Date(e.getFullYear() + 10, 0));
1727
1074
  return;
1728
1075
  }
1729
- if (n === "months") {
1730
- u(
1731
- (a) => new Date(a.getFullYear() + 1, a.getMonth())
1076
+ if (a === "months") {
1077
+ i(
1078
+ (e) => new Date(e.getFullYear() + 1, e.getMonth())
1732
1079
  );
1733
1080
  return;
1734
1081
  }
1735
- u((a) => new Date(a.getFullYear(), a.getMonth() + 1));
1736
- }, j = () => {
1737
- if (n === "years") {
1738
- u((a) => new Date(a.getFullYear() - 10, 0));
1082
+ i((e) => new Date(e.getFullYear(), e.getMonth() + 1));
1083
+ }, v = () => {
1084
+ if (a === "years") {
1085
+ i((e) => new Date(e.getFullYear() - 10, 0));
1739
1086
  return;
1740
1087
  }
1741
- if (n === "months") {
1742
- u(
1743
- (a) => new Date(a.getFullYear() - 1, a.getMonth())
1088
+ if (a === "months") {
1089
+ i(
1090
+ (e) => new Date(e.getFullYear() - 1, e.getMonth())
1744
1091
  );
1745
1092
  return;
1746
1093
  }
1747
- u(
1748
- (a) => new Date(
1749
- a.getMonth() === 0 ? a.getFullYear() - 1 : a.getFullYear(),
1750
- a.getMonth() === 0 ? 11 : a.getMonth() - 1
1094
+ i(
1095
+ (e) => new Date(
1096
+ e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
1097
+ e.getMonth() === 0 ? 11 : e.getMonth() - 1
1751
1098
  )
1752
1099
  );
1753
- }, f = () => {
1754
- if (n === "days")
1755
- return `${U[i.getMonth()]} ${i.getFullYear()}`;
1756
- if (n === "months")
1757
- return `${i.getFullYear()}`;
1758
- if (n === "years")
1759
- return `${me(i.getFullYear()).start} ~ ${me(i.getFullYear()).end}`;
1760
1100
  };
1761
- return /* @__PURE__ */ o.jsxs("div", { className: "starasia-calendar-header", children: [
1762
- /* @__PURE__ */ o.jsx(Qe, { onClick: () => j() }),
1763
- /* @__PURE__ */ o.jsx("div", { style: { cursor: "pointer" }, onClick: m, children: f() }),
1764
- /* @__PURE__ */ o.jsx(er, { onClick: () => b() })
1101
+ return /* @__PURE__ */ $("div", { className: "starasia-calendar-header", children: [
1102
+ /* @__PURE__ */ l(q, { onClick: () => v() }),
1103
+ /* @__PURE__ */ l("div", { style: { cursor: "pointer" }, onClick: g, children: (() => {
1104
+ if (a === "days")
1105
+ return `${N[s.getMonth()]} ${s.getFullYear()}`;
1106
+ if (a === "months")
1107
+ return `${s.getFullYear()}`;
1108
+ if (a === "years")
1109
+ return `${V(s.getFullYear()).start} ~ ${V(s.getFullYear()).end}`;
1110
+ })() }),
1111
+ /* @__PURE__ */ l(P, { onClick: () => f() })
1765
1112
  ] });
1766
- }, Ge = "starasia-calendar-styles", qr = (t) => {
1767
- if (!document.getElementById(Ge)) {
1768
- const n = document.createElement("style");
1769
- n.id = Ge, n.textContent = t, document.head.appendChild(n);
1113
+ }, H = "starasia-calendar-styles", la = (r) => {
1114
+ if (!document.getElementById(H)) {
1115
+ const a = document.createElement("style");
1116
+ a.id = H, a.textContent = r, document.head.appendChild(a);
1770
1117
  }
1771
1118
  };
1772
- qr(ie);
1773
- const Hr = be(
1119
+ la(I);
1120
+ const ca = W(
1774
1121
  ({
1775
- value: t,
1776
- onChange: n,
1777
- filter: l,
1778
- input: i = !0,
1779
- disabled: u,
1780
- minDate: m,
1781
- maxDate: b,
1782
- placeholder: j,
1783
- size: f,
1784
- status: a
1785
- }, E) => {
1786
- const { ref: w, isComponentVisible: _, setIsComponentVisible: S } = Ze(!1), v = Q(null), [c, g] = B("days"), [d, p] = B(/* @__PURE__ */ new Date()), [h, x] = B(/* @__PURE__ */ new Date());
1787
- I(() => {
1788
- t ? (p(t), x(t)) : (p(/* @__PURE__ */ new Date()), x(/* @__PURE__ */ new Date()));
1789
- }, [t]), I(() => {
1790
- l && g(l);
1791
- }, [l]), I(() => {
1792
- l || g("days");
1793
- }, [_]), I(() => {
1794
- i || S(!0);
1795
- }, [i]);
1796
- const Y = () => t ? l === "days" ? q(d) : l === "months" ? `${U[d.getMonth()]} ${d.getFullYear()}` : l === "years" ? d.getFullYear() : q(d) : "", $ = () => {
1797
- if (v.current && w.current && i) {
1798
- const C = w.current.getBoundingClientRect(), P = v.current.getBoundingClientRect();
1799
- window.innerWidth < C.left + P.width ? v.current.style.left = `${C.left - P.width + C.width}px` : v.current.style.left = `${C.left}px`, C.top + P.height > window.innerHeight ? v.current.style.top = `${C.y - (C.height + P.height - 28)}px` : v.current.style.top = `${C.y + C.height}px`;
1122
+ value: r,
1123
+ onChange: a,
1124
+ filter: t,
1125
+ input: s = !0,
1126
+ disabled: i,
1127
+ minDate: g,
1128
+ maxDate: f,
1129
+ placeholder: v,
1130
+ size: h,
1131
+ status: e
1132
+ }, w) => {
1133
+ const { ref: b, isComponentVisible: k, setIsComponentVisible: M } = J(!1), u = E(null), [n, c] = F("days"), [d, y] = F(/* @__PURE__ */ new Date()), [o, p] = F(/* @__PURE__ */ new Date());
1134
+ D(() => {
1135
+ r ? (y(r), p(r)) : (y(/* @__PURE__ */ new Date()), p(/* @__PURE__ */ new Date()));
1136
+ }, [r]), D(() => {
1137
+ t && c(t);
1138
+ }, [t]), D(() => {
1139
+ t || c("days");
1140
+ }, [k]), D(() => {
1141
+ s || M(!0);
1142
+ }, [s]);
1143
+ const C = () => r ? t === "days" ? L(d) : t === "months" ? `${N[d.getMonth()]} ${d.getFullYear()}` : t === "years" ? d.getFullYear() : L(d) : "", x = () => {
1144
+ if (u.current && b.current && s) {
1145
+ const m = b.current.getBoundingClientRect(), Y = u.current.getBoundingClientRect();
1146
+ window.innerWidth < m.left + Y.width ? u.current.style.left = `${m.left - Y.width + m.width}px` : u.current.style.left = `${m.left}px`, m.top + Y.height > window.innerHeight ? u.current.style.top = `${m.y - (m.height + Y.height - 28)}px` : u.current.style.top = `${m.y + m.height}px`;
1800
1147
  }
1801
1148
  };
1802
- return I(() => {
1803
- v.current && w.current && i && $();
1804
- }, [v, w, _]), I(() => {
1805
- const C = E == null ? void 0 : E.current;
1806
- return C && C.addEventListener("scroll", $), window.addEventListener("scroll", $), () => {
1807
- C && C.removeEventListener("scroll", $), window.removeEventListener("scroll", $);
1149
+ return D(() => {
1150
+ u.current && b.current && s && x();
1151
+ }, [u, b, k]), D(() => {
1152
+ const m = w == null ? void 0 : w.current;
1153
+ return m && m.addEventListener("scroll", x), window.addEventListener("scroll", x), () => {
1154
+ m && m.removeEventListener("scroll", x), window.removeEventListener("scroll", x);
1808
1155
  };
1809
- }, []), /* @__PURE__ */ o.jsxs(
1156
+ }, []), /* @__PURE__ */ $(
1810
1157
  "div",
1811
1158
  {
1812
1159
  className: "starasia-calendar-wrapper",
1813
- style: { height: i ? "auto" : "100%" },
1814
- ref: i ? w : null,
1160
+ style: { height: s ? "auto" : "100%" },
1161
+ ref: s ? b : null,
1815
1162
  children: [
1816
- i ? /* @__PURE__ */ o.jsx(
1817
- Vr,
1163
+ s ? /* @__PURE__ */ l(
1164
+ na,
1818
1165
  {
1819
- value: Y(),
1820
- onClick: () => S(!0),
1166
+ value: C(),
1167
+ onClick: () => M(!0),
1821
1168
  onChange: () => {
1822
1169
  },
1823
- placeholder: j,
1824
- disabled: u,
1825
- size: f,
1826
- status: a,
1170
+ placeholder: v,
1171
+ disabled: i,
1172
+ size: h,
1173
+ status: e,
1827
1174
  inputMode: "none"
1828
1175
  }
1829
1176
  ) : null,
1830
- _ ? /* @__PURE__ */ o.jsxs(
1177
+ k ? /* @__PURE__ */ $(
1831
1178
  "div",
1832
1179
  {
1833
- className: `starasia-calendar ${i ? "" : "starasia-calendar-no-input"}`,
1834
- ref: v,
1180
+ className: `starasia-calendar ${s ? "" : "starasia-calendar-no-input"}`,
1181
+ ref: u,
1835
1182
  children: [
1836
- /* @__PURE__ */ o.jsx(
1837
- Jr,
1183
+ /* @__PURE__ */ l(
1184
+ oa,
1838
1185
  {
1839
- setViews: g,
1840
- views: c,
1841
- filter: l,
1842
- previewDate: h,
1843
- setPreviewDate: x,
1844
- isComponentVisible: _
1186
+ setViews: c,
1187
+ views: n,
1188
+ filter: t,
1189
+ previewDate: o,
1190
+ setPreviewDate: p,
1191
+ isComponentVisible: k
1845
1192
  }
1846
1193
  ),
1847
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-body", children: c === "days" ? /* @__PURE__ */ o.jsx(
1848
- Br,
1194
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-body", children: n === "days" ? /* @__PURE__ */ l(
1195
+ ta,
1849
1196
  {
1850
1197
  date: d,
1851
- setDate: p,
1852
- previewDate: h,
1853
- setPreviewDate: x,
1854
- setIsComponentVisible: S,
1855
- input: i,
1856
- minDate: m,
1857
- maxDate: b,
1858
- onChange: n
1198
+ setDate: y,
1199
+ previewDate: o,
1200
+ setPreviewDate: p,
1201
+ setIsComponentVisible: M,
1202
+ input: s,
1203
+ minDate: g,
1204
+ maxDate: f,
1205
+ onChange: a
1859
1206
  }
1860
- ) : c === "months" ? /* @__PURE__ */ o.jsx(
1861
- Ur,
1207
+ ) : n === "months" ? /* @__PURE__ */ l(
1208
+ sa,
1862
1209
  {
1863
1210
  date: d,
1864
- setDate: p,
1865
- previewDate: h,
1866
- setPreviewDate: x,
1867
- filter: l,
1868
- setViews: g,
1869
- onChange: n,
1870
- minDate: m,
1871
- maxDate: b,
1872
- input: i
1211
+ setDate: y,
1212
+ previewDate: o,
1213
+ setPreviewDate: p,
1214
+ filter: t,
1215
+ setViews: c,
1216
+ onChange: a,
1217
+ minDate: g,
1218
+ maxDate: f,
1219
+ input: s
1873
1220
  }
1874
- ) : /* @__PURE__ */ o.jsx(
1875
- zr,
1221
+ ) : /* @__PURE__ */ l(
1222
+ ia,
1876
1223
  {
1877
1224
  date: d,
1878
- setDate: p,
1879
- previewDate: h,
1880
- setPreviewDate: x,
1881
- filter: l,
1882
- setViews: g,
1883
- onChange: n,
1884
- minDate: m,
1885
- maxDate: b,
1886
- input: i
1225
+ setDate: y,
1226
+ previewDate: o,
1227
+ setPreviewDate: p,
1228
+ filter: t,
1229
+ setViews: c,
1230
+ onChange: a,
1231
+ minDate: g,
1232
+ maxDate: f,
1233
+ input: s
1887
1234
  }
1888
1235
  ) })
1889
1236
  ]
@@ -1893,51 +1240,51 @@ const Hr = be(
1893
1240
  }
1894
1241
  );
1895
1242
  }
1896
- ), Kr = be(
1243
+ ), ha = W(
1897
1244
  ({
1898
- value: t,
1899
- onChange: n,
1900
- filter: l,
1901
- input: i = !0,
1902
- rangedDate: u,
1903
- disabled: m,
1904
- minDate: b,
1905
- maxDate: j,
1906
- placeholder: f,
1907
- size: a,
1908
- status: E
1909
- }, w) => /* @__PURE__ */ o.jsx(o.Fragment, { children: u ? /* @__PURE__ */ o.jsx(
1910
- Ar,
1245
+ value: r,
1246
+ onChange: a,
1247
+ filter: t,
1248
+ input: s = !0,
1249
+ rangedDate: i,
1250
+ disabled: g,
1251
+ minDate: f,
1252
+ maxDate: v,
1253
+ placeholder: h,
1254
+ size: e,
1255
+ status: w
1256
+ }, b) => /* @__PURE__ */ l(R, { children: i ? /* @__PURE__ */ l(
1257
+ ea,
1911
1258
  {
1912
- onChange: n,
1913
- value: t,
1914
- input: i,
1915
- filter: l,
1916
- disabled: m,
1917
- ref: w,
1918
- minDate: b,
1919
- maxDate: j,
1920
- placeholder: f,
1921
- size: a,
1922
- status: E
1259
+ onChange: a,
1260
+ value: r,
1261
+ input: s,
1262
+ filter: t,
1263
+ disabled: g,
1264
+ ref: b,
1265
+ minDate: f,
1266
+ maxDate: v,
1267
+ placeholder: h,
1268
+ size: e,
1269
+ status: w
1923
1270
  }
1924
- ) : /* @__PURE__ */ o.jsx(
1925
- Hr,
1271
+ ) : /* @__PURE__ */ l(
1272
+ ca,
1926
1273
  {
1927
- onChange: n,
1928
- value: t,
1929
- input: i,
1930
- filter: l,
1931
- disabled: m,
1932
- ref: w,
1933
- minDate: b,
1934
- maxDate: j,
1935
- placeholder: f,
1936
- size: a,
1937
- status: E
1274
+ onChange: a,
1275
+ value: r,
1276
+ input: s,
1277
+ filter: t,
1278
+ disabled: g,
1279
+ ref: b,
1280
+ minDate: f,
1281
+ maxDate: v,
1282
+ placeholder: h,
1283
+ size: e,
1284
+ status: w
1938
1285
  }
1939
1286
  ) })
1940
1287
  );
1941
1288
  export {
1942
- Kr as StarasiaDate
1289
+ ha as StarasiaDate
1943
1290
  };