@vavt/react-ui 1.3.0 → 1.4.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.
Files changed (108) hide show
  1. package/dist/{Col-CZjR94ac.js → Col-BZdKuXbj.js} +1 -1
  2. package/dist/{Col-qcq7T83y.cjs → Col-CvoVGKUn.cjs} +1 -1
  3. package/dist/{Cron-C3S1XI-J.js → Cron-HRBggBRO.js} +352 -344
  4. package/dist/Cron-vQ7RSsws.cjs +1 -0
  5. package/dist/{DatePicker-DhRxFPCj.js → DatePicker-B0f4Nh8h.js} +1 -1
  6. package/dist/{DatePicker-B5uYQlzy.cjs → DatePicker-DFTqHT8i.cjs} +1 -1
  7. package/dist/{DateTimePicker-BjDD15Av.js → DateTimePicker-BzkWgjkq.js} +1 -1
  8. package/dist/{DateTimePicker-Bve5qoeh.cjs → DateTimePicker-McwH-cWl.cjs} +1 -1
  9. package/dist/Dropdown-Chx8SZPS.cjs +1 -0
  10. package/dist/Dropdown-CyVxoFAH.js +330 -0
  11. package/dist/Form-CyCbST4e.cjs +1 -0
  12. package/dist/Form-Fe4b1pS1.js +446 -0
  13. package/dist/Input-BbJ4Q_xu.cjs +1 -0
  14. package/dist/Input-DpoSxIdb.js +113 -0
  15. package/dist/{Pagination-DTRhw83o.js → Pagination-BrG1pKYw.js} +1 -1
  16. package/dist/{Pagination-BRxRbWlU.cjs → Pagination-D3ok8N9k.cjs} +1 -1
  17. package/dist/Row-BGzLSkCy.js +24 -0
  18. package/dist/Row-CRQKzpiH.cjs +1 -0
  19. package/dist/Select-GleCzXQB.js +497 -0
  20. package/dist/Select-Rx6AHue2.cjs +1 -0
  21. package/dist/Sidebar-2KVVRUEM.cjs +1 -0
  22. package/dist/Sidebar-ByLinOVm.js +77 -0
  23. package/dist/{Table-DdWKhZAZ.js → Table-ClWg25Wn.js} +10 -7
  24. package/dist/{Table-B1BEfBJC.cjs → Table-Dv2qxs8q.cjs} +1 -1
  25. package/dist/TimePicker-BCU7D6uD.cjs +1 -0
  26. package/dist/{TimePicker-77L1Vyxn.js → TimePicker-BVZbkBvJ.js} +89 -81
  27. package/dist/Tooltip-BbbIT5nt.js +198 -0
  28. package/dist/Tooltip-z6u7ChKj.cjs +1 -0
  29. package/dist/base.css +1 -1
  30. package/dist/cjs/Col.cjs +1 -1
  31. package/dist/cjs/Cron.cjs +1 -1
  32. package/dist/cjs/DatePicker.cjs +1 -1
  33. package/dist/cjs/DateTimePicker.cjs +1 -1
  34. package/dist/cjs/Dropdown.cjs +1 -1
  35. package/dist/cjs/Form.cjs +1 -1
  36. package/dist/cjs/Input.cjs +1 -1
  37. package/dist/cjs/Pagination.cjs +1 -1
  38. package/dist/cjs/Row.cjs +1 -1
  39. package/dist/cjs/Select.cjs +1 -1
  40. package/dist/cjs/Sidebar.cjs +1 -1
  41. package/dist/cjs/Table.cjs +1 -1
  42. package/dist/cjs/TimePicker.cjs +1 -1
  43. package/dist/cjs/Tooltip.cjs +1 -1
  44. package/dist/cjs/global.cjs +1 -1
  45. package/dist/cjs/index.cjs +1 -1
  46. package/dist/cjs/register.cjs +1 -1
  47. package/dist/css/Button.css +1 -1
  48. package/dist/css/Checkbox.css +1 -1
  49. package/dist/css/Input.css +1 -1
  50. package/dist/css/Radio.css +1 -1
  51. package/dist/css/Sidebar.css +1 -1
  52. package/dist/css/Switch.css +1 -1
  53. package/dist/date-picker-BKXFZDN2.js +639 -0
  54. package/dist/date-picker-Dp0BXURF.cjs +1 -0
  55. package/dist/es/Col.mjs +1 -1
  56. package/dist/es/Cron.mjs +1 -1
  57. package/dist/es/DatePicker.mjs +1 -1
  58. package/dist/es/DateTimePicker.mjs +1 -1
  59. package/dist/es/Dropdown.mjs +1 -1
  60. package/dist/es/Form.mjs +1 -1
  61. package/dist/es/Input.mjs +1 -1
  62. package/dist/es/Pagination.mjs +1 -1
  63. package/dist/es/Row.mjs +1 -1
  64. package/dist/es/Select.mjs +1 -1
  65. package/dist/es/Sidebar.mjs +1 -1
  66. package/dist/es/Table.mjs +1 -1
  67. package/dist/es/TimePicker.mjs +1 -1
  68. package/dist/es/Tooltip.mjs +1 -1
  69. package/dist/es/global.mjs +1 -1
  70. package/dist/es/index.mjs +14 -14
  71. package/dist/es/register.mjs +1 -1
  72. package/dist/floating-BpTI3sWS.cjs +1 -0
  73. package/dist/{floating-CqdcJWk2.js → floating-BqCWEj83.js} +27 -15
  74. package/dist/index.css +1 -1
  75. package/dist/{registry-DbMCy1-n.js → registry-BXGVMimF.js} +13 -13
  76. package/dist/{registry-Chcx2tDO.cjs → registry-C-Mo3vuy.cjs} +1 -1
  77. package/dist/style/Sidebar.cjs +1 -0
  78. package/dist/style/Sidebar.mjs +1 -0
  79. package/dist/types/Form/type.d.cts +2 -0
  80. package/dist/types/Form/type.d.ts +2 -0
  81. package/dist/types/Input/type.d.cts +4 -2
  82. package/dist/types/Input/type.d.ts +4 -2
  83. package/dist/types/Select/SelectList.d.cts +20 -0
  84. package/dist/types/Select/SelectList.d.ts +20 -0
  85. package/dist/types/_shared/date-calendar.d.cts +20 -0
  86. package/dist/types/_shared/date-calendar.d.ts +20 -0
  87. package/dist/types/_shared/floating.d.cts +13 -1
  88. package/dist/types/_shared/floating.d.ts +13 -1
  89. package/package.json +1 -1
  90. package/dist/Cron-CIZ9GKm0.cjs +0 -1
  91. package/dist/Dropdown-BcT4uaQT.js +0 -319
  92. package/dist/Dropdown-CPW-aSTx.cjs +0 -1
  93. package/dist/Form-LuUPwJc2.cjs +0 -1
  94. package/dist/Form-rXq9r3N-.js +0 -442
  95. package/dist/Input-BRy5Xuwy.js +0 -104
  96. package/dist/Input-C9ESmbJ7.cjs +0 -1
  97. package/dist/Row-BJZtEKxG.cjs +0 -1
  98. package/dist/Row-DpEse7PJ.js +0 -24
  99. package/dist/Select-B9umyfKd.cjs +0 -1
  100. package/dist/Select-DDsgKaDL.js +0 -466
  101. package/dist/Sidebar-BPXVnP7y.cjs +0 -1
  102. package/dist/Sidebar-u980T-QB.js +0 -76
  103. package/dist/TimePicker-CsaiM5CQ.cjs +0 -1
  104. package/dist/Tooltip-DH3oc4Wa.js +0 -205
  105. package/dist/Tooltip-DP2yxQpo.cjs +0 -1
  106. package/dist/date-picker-CIAVlMqv.cjs +0 -1
  107. package/dist/date-picker-Co0ySn01.js +0 -612
  108. package/dist/floating-5PRFyI8D.cjs +0 -1
@@ -0,0 +1,639 @@
1
+ import { t as e } from "./effect-nifYL_rH.js";
2
+ import { n as t, t as n } from "./state-BSDh-Ob2.js";
3
+ import { n as r } from "./refs-D5IYOBaf.js";
4
+ import { t as i } from "./Transition-DiO4GsP3.js";
5
+ import { t as a } from "./client-pj_wzx28.js";
6
+ import { i as ee, r as o, t as te } from "./floating-BqCWEj83.js";
7
+ import { t as ne } from "./id-CHixuHb7.js";
8
+ import { a as s, r as re, t as c } from "./layer-C1yCY0MO.js";
9
+ import { t as l } from "./Input-DpoSxIdb.js";
10
+ import { _ as u, a as d, b as f, c as p, d as m, f as ie, g as h, h as g, i as ae, l as _, m as oe, n as se, p as v, r as ce, s as y, t as le, u as b, y as ue } from "./time-wheel-BtvYZI6H.js";
11
+ import { t as de } from "./Dropdown-CyVxoFAH.js";
12
+ import { CalendarDays as fe, ChevronLeft as pe, ChevronRight as me, ChevronsLeft as he, ChevronsRight as ge, Clock3 as _e, X as ve } from "lucide-react";
13
+ import { forwardRef as x, useCallback as S, useEffect as ye, useMemo as C, useRef as be, useState as w } from "react";
14
+ import { jsx as T, jsxs as E } from "react/jsx-runtime";
15
+ import { createPortal as xe } from "react-dom";
16
+ //#region components/_shared/date-calendar.tsx
17
+ var Se = [
18
+ "日",
19
+ "一",
20
+ "二",
21
+ "三",
22
+ "四",
23
+ "五",
24
+ "六"
25
+ ], Ce = ({ classPrefix: e, month: t, monthLabel: n, range: r, rangeValue: i, previewDate: a, selectedDate: ee, isDateDisabled: o, onSelect: te, onKeyDown: ne, onPreview: s }) => {
26
+ let re = C(() => ie(t), [t]), c = r ? i[0] : null, l = r ? i[1] : null, u = r && c && !l ? a : null, d = l ?? u, f = c && d && b(c, d) <= 0 ? c : d, p = c && d && b(c, d) <= 0 ? d : c, m = r ? null : ee, g = (r ? i : [m]).find((e) => e && oe(e, t) && !o(e)) ?? re.find((e) => oe(e, t) && !o(e)), ae = /* @__PURE__ */ new Date(), _ = c ? h(c) : null, se = l ? h(l) : null, ce = f ? h(f) : null, y = p ? h(p) : null;
27
+ return /* @__PURE__ */ E("section", {
28
+ className: `${e}__calendar`,
29
+ "aria-label": n,
30
+ children: [
31
+ r ? /* @__PURE__ */ T("div", {
32
+ className: `${e}__month-title`,
33
+ children: n
34
+ }) : null,
35
+ /* @__PURE__ */ T("div", {
36
+ className: `${e}__weekdays`,
37
+ role: "row",
38
+ children: Se.map((e) => /* @__PURE__ */ T("span", {
39
+ role: "columnheader",
40
+ children: e
41
+ }, e))
42
+ }),
43
+ /* @__PURE__ */ T("div", {
44
+ className: `${e}__grid`,
45
+ role: "grid",
46
+ onMouseLeave: () => s(null),
47
+ onBlur: (e) => {
48
+ let t = e.relatedTarget;
49
+ t instanceof Node && e.currentTarget.contains(t) || s(null);
50
+ },
51
+ children: re.map((n) => {
52
+ let i = !oe(n, t), a = i || o(n), ee = !!(_ && se && b(n, _) >= 0 && b(n, se) <= 0), re = !!(c && u && ce && y && b(n, ce) >= 0 && b(n, y) <= 0), d = ee || re, ie = !!(f && d && v(n, f)), h = !!(p && d && v(n, p)), le = !!(u && v(n, u)), ue = v(n, ae), de = [
53
+ `${e}__day`,
54
+ i ? "is-other-month" : "",
55
+ ue ? "is-today" : "",
56
+ r && c && v(n, c) ? "is-range-start is-selected" : "",
57
+ r && l && v(n, l) ? "is-range-end is-selected" : "",
58
+ m && v(n, m) ? "is-selected" : "",
59
+ d ? "is-in-range" : "",
60
+ ie ? "is-range-edge-start" : "",
61
+ h ? "is-range-edge-end" : "",
62
+ le ? "is-range-preview-end" : "",
63
+ a ? "is-disabled" : ""
64
+ ].filter(Boolean).join(" ");
65
+ return /* @__PURE__ */ T("button", {
66
+ type: "button",
67
+ className: de,
68
+ role: "gridcell",
69
+ "data-time": n.getTime(),
70
+ "aria-label": `${n.getFullYear()}年${n.getMonth() + 1}月${n.getDate()}日`,
71
+ "aria-selected": r ? ee : !!(m && v(n, m)),
72
+ "aria-current": ue ? "date" : void 0,
73
+ "aria-hidden": i || void 0,
74
+ "aria-disabled": a || void 0,
75
+ disabled: a,
76
+ tabIndex: !a && g && v(n, g) ? 0 : -1,
77
+ onClick: () => te(n),
78
+ onKeyDown: (e) => ne(e, n),
79
+ onMouseEnter: () => s(n),
80
+ onFocus: () => s(n),
81
+ children: /* @__PURE__ */ T("span", {
82
+ className: `${e}__day-content`,
83
+ children: n.getDate()
84
+ })
85
+ }, n.toISOString());
86
+ })
87
+ })
88
+ ]
89
+ });
90
+ }, we = "data-vl-date-picker-popup-owner", Te = [
91
+ "一月",
92
+ "二月",
93
+ "三月",
94
+ "四月",
95
+ "五月",
96
+ "六月",
97
+ "七月",
98
+ "八月",
99
+ "九月",
100
+ "十月",
101
+ "十一月",
102
+ "十二月"
103
+ ], D = (e) => Array.isArray(e) && e.length === 2, O = (e, t) => f(e, t), Ee = (e, t) => {
104
+ if (D(e)) {
105
+ let n = O(e[0], t), r = O(e[1], t);
106
+ return n && r ? `${m(n, t)} ~ ${m(r, t)}` : "";
107
+ }
108
+ let n = O(e, t);
109
+ return n ? m(n, t) : "";
110
+ }, De = (e) => [e[0] ? _(e[0]) : null, e[1] ? _(e[1]) : null], Oe = (e) => `${e.getFullYear()}年 ${Te[e.getMonth()]}`, ke = (e, t) => t ? _(e) : h(e), Ae = (e, t, n) => {
111
+ let r = (e) => {
112
+ let t = O(e, n);
113
+ return t ? t.getTime() : null;
114
+ };
115
+ return D(e) || D(t) ? !D(e) || !D(t) ? !1 : r(e[0]) === r(t[0]) && r(e[1]) === r(t[1]) : r(e) === r(t);
116
+ }, je = x((f, ie) => {
117
+ let { componentName: v, withTime: x = !1, value: Se, defaultValue: Te, valueType: je = "date", format: k = x ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD", range: A = !1, shortcuts: Me = [], minDate: Ne, maxDate: Pe, disabledDate: Fe, minTime: Ie, maxTime: Le, disabledTime: Re, placeholder: ze = A ? "请选择日期范围" : x ? "请选择日期时间" : "请选择日期", disabled: j = !1, clearable: Be = !1, size: Ve = "md", placement: M = "bottom-start", offset: He = 8, zIndex: Ue, className: We, style: Ge, id: Ke, "aria-label": qe, "aria-labelledby": Je, "aria-describedby": Ye, onChange: Xe, onClear: Ze, onOpen: Qe, onClose: $e, ...et } = f, N = Xe, tt = be(null), P = be(null), F = be(null), nt = be(null), rt = a(), it = s({
118
+ defaultZIndex: re.popover,
119
+ zIndex: Ue
120
+ }), at = n(f, "value"), [I, L] = t({
121
+ value: Se ?? null,
122
+ defaultValue: Te ?? null,
123
+ controlled: at
124
+ }), [R, ot] = w(!1), [st, z] = w(() => {
125
+ let e = D(I) ? O(I[0], k) : O(I, k);
126
+ return u(e ?? /* @__PURE__ */ new Date());
127
+ }), [B, ct] = w(null), [V, H] = w([null, null]), [lt, ut] = w(null), [U, W] = w("start"), [dt, ft] = w(!1), [G, pt] = w(null), [{ style: mt, placement: ht }, gt] = ee(M), _t = mt.left !== void 0, [vt, yt] = w(null), bt = ne(`vl-${v}-control`, Ke), K = ne(`vl-${v}-panel`), xt = C(() => r(tt, ie), [ie]), St = S(() => {
128
+ ft(!1), pt(null);
129
+ }, []), Ct = C(() => A ? D(I) ? [O(I[0], k), O(I[1], k)] : [null, null] : Array.isArray(I) ? null : O(I, k), [
130
+ k,
131
+ A,
132
+ I
133
+ ]), wt = A ? Ct : null, q = A ? null : Ct, Tt = Ee(I, k), Et = st, Dt = C(() => p(st, 1), [st]), Ot = O(Ne, k), kt = O(Pe, k), At = Ie ? ue(Ie) : null, jt = Le ? ue(Le) : null, Mt = C(() => ({
134
+ minSeconds: At,
135
+ maxSeconds: jt,
136
+ disabledTime: Re
137
+ }), [
138
+ Re,
139
+ jt,
140
+ At
141
+ ]), J = S((e) => {
142
+ let t = h(e);
143
+ return !!(Ot && b(t, h(Ot)) < 0 || kt && b(t, h(kt)) > 0 || Fe?.(t));
144
+ }, [
145
+ Fe,
146
+ kt,
147
+ Ot
148
+ ]), Y = S((e) => ae(e, Mt), [Mt]), Nt = S((e, t, n) => se(e, t, n, Mt), [Mt]), Pt = S((e) => x && Y(m(e, "HH:mm:ss")), [Y, x]), X = S((e) => {
149
+ if (!(e && (j || R)) && !(!e && !R)) {
150
+ if (e) {
151
+ let e = (A ? wt?.[0] : q) ?? /* @__PURE__ */ new Date();
152
+ z(u(e)), A ? H(De(wt ?? [null, null])) : ct(q ? _(q) : null), ut(null), W("start"), gt({
153
+ placement: M,
154
+ style: {}
155
+ }), yt(null), St(), ot(!0), Qe?.();
156
+ } else yt(null), ut(null), St(), ot(!1), $e?.();
157
+ }
158
+ }, [
159
+ j,
160
+ $e,
161
+ Qe,
162
+ R,
163
+ M,
164
+ A,
165
+ St,
166
+ q,
167
+ wt,
168
+ gt
169
+ ]), Ft = S(() => {
170
+ if (!R || !P.current || !F.current) return;
171
+ let e = P.current.getBoundingClientRect(), t = te({
172
+ anchorRect: e,
173
+ floatingRect: F.current.getBoundingClientRect(),
174
+ placement: M,
175
+ offset: He
176
+ });
177
+ gt({
178
+ placement: t.placement,
179
+ style: {
180
+ left: `${Math.round(t.x)}px`,
181
+ top: `${Math.round(t.y)}px`
182
+ }
183
+ });
184
+ }, [
185
+ He,
186
+ R,
187
+ M,
188
+ gt
189
+ ]);
190
+ e(() => {
191
+ if (!R || !rt) return;
192
+ Ft();
193
+ let e = window.requestAnimationFrame(Ft);
194
+ return () => window.cancelAnimationFrame(e);
195
+ }, [
196
+ rt,
197
+ R,
198
+ Ft
199
+ ]), e(() => {
200
+ if (!R || !_t || !vt) return;
201
+ let e = F.current?.querySelector(`[data-time="${vt.getTime()}"]:not(:disabled)`);
202
+ e && (e.focus(), yt(null));
203
+ }, [
204
+ st,
205
+ vt,
206
+ _t,
207
+ R
208
+ ]);
209
+ let It = S((e) => e.some((e) => e instanceof HTMLElement && (e.getAttribute(we) === K || e.classList.contains("vl-dropdown__panel") && e.querySelector(`[${we}]`)?.getAttribute(we) === K)), [K]), Lt = S(() => X(!1), [X]), Rt = S(() => {
210
+ dt || (X(!1), P.current?.focus());
211
+ }, [X, dt]);
212
+ o({
213
+ active: R,
214
+ rootRef: tt,
215
+ floatingRef: F,
216
+ isOwnedPopup: It,
217
+ onOutsideClick: Lt,
218
+ onEscape: Rt,
219
+ onViewportChange: Ft
220
+ }), ye(() => {
221
+ j && R && X(!1);
222
+ }, [
223
+ j,
224
+ R,
225
+ X
226
+ ]);
227
+ let zt = S((e) => je === "string" ? m(e, k) : _(e), [k, je]), Bt = S((e) => {
228
+ let t = ke(e, x);
229
+ if (J(t) || x && Y(m(t, "HH:mm:ss"))) return;
230
+ let n = zt(t);
231
+ Ae(I, n, k) || (L(n), N?.(n)), X(!1), P.current?.focus();
232
+ }, [
233
+ N,
234
+ k,
235
+ J,
236
+ Y,
237
+ zt,
238
+ I,
239
+ X,
240
+ L,
241
+ x
242
+ ]), Vt = S((e) => {
243
+ if (!e[0] || !e[1]) return;
244
+ let t = b(e[0], e[1]) <= 0 ? e : [e[1], e[0]], n = ke(t[0], x), r = ke(t[1], x);
245
+ if (J(n) || J(r) || x && (Y(m(n, "HH:mm:ss")) || Y(m(r, "HH:mm:ss")))) return;
246
+ let i = [zt(n), zt(r)];
247
+ Ae(I, i, k) || (L(i), N?.(i)), X(!1), P.current?.focus();
248
+ }, [
249
+ N,
250
+ k,
251
+ J,
252
+ Y,
253
+ zt,
254
+ I,
255
+ X,
256
+ L,
257
+ x
258
+ ]), Ht = (e) => {
259
+ if (J(e)) return;
260
+ ut(null);
261
+ let t = A ? V[U === "start" ? 0 : 1] : B, n = h(e);
262
+ if (x) {
263
+ if (t) n = g(e, t.getHours(), t.getMinutes(), t.getSeconds());
264
+ else {
265
+ let t = Nt(0, 86399, 0);
266
+ n = t === null ? _(e) : g(e, Math.floor(t / 3600), Math.floor(t % 3600 / 60), t % 60);
267
+ }
268
+ }
269
+ if (!A) {
270
+ ct(n), x || Bt(n);
271
+ return;
272
+ }
273
+ let [r, i] = V;
274
+ if (!r || i) {
275
+ H([n, null]), W("start");
276
+ return;
277
+ }
278
+ b(n, r) < 0 ? (H([n, r]), W("end")) : (H([r, n]), W("end"));
279
+ }, Ut = (e) => {
280
+ if (!A || !e || V[1] || J(e)) {
281
+ ut(null);
282
+ return;
283
+ }
284
+ ut(h(e));
285
+ }, Z = S((e, t = !1) => {
286
+ if (e && G) {
287
+ if (A) {
288
+ let e = De(V);
289
+ e[U === "start" ? 0 : 1] = _(G), H(e);
290
+ } else ct(_(G));
291
+ }
292
+ St(), t && window.requestAnimationFrame(() => nt.current?.focus());
293
+ }, [
294
+ U,
295
+ V,
296
+ A,
297
+ St,
298
+ G
299
+ ]), Wt = (e, t) => {
300
+ let n = G ? _(G) : /* @__PURE__ */ new Date(), r = {
301
+ hours: n.getHours(),
302
+ minutes: n.getMinutes(),
303
+ seconds: n.getSeconds()
304
+ }, { start: i, end: a, preferred: ee } = ce(e, t, r), o = Nt(i, a, ee);
305
+ if (o === null) return;
306
+ let te = g(n, Math.floor(o / 3600), Math.floor(o % 3600 / 60), o % 60);
307
+ pt(te);
308
+ }, Gt = (e) => {
309
+ let t = e.getValue(/* @__PURE__ */ new Date());
310
+ if (t === null) return;
311
+ if (A) {
312
+ if (!D(t)) return;
313
+ let e = O(t[0], k), n = O(t[1], k);
314
+ if (!e || !n || J(e) || J(n) || Pt(e) || Pt(n)) return;
315
+ H(b(e, n) <= 0 ? [e, n] : [n, e]), W("end");
316
+ return;
317
+ }
318
+ if (D(t)) return;
319
+ let n = O(t, k);
320
+ !n || J(n) || Pt(n) || Bt(n);
321
+ }, Kt = (e) => {
322
+ e?.stopPropagation(), !j && (L(null), N?.(null), Ze?.(), ct(null), H([null, null]));
323
+ }, Q = (e, t, n = !1) => {
324
+ let r = n ? h(e) : y(h(e), t);
325
+ for (let e = 0; e < 3660; e += 1) {
326
+ if (t < 0 && Ot && b(r, h(Ot)) < 0 || t > 0 && kt && b(r, h(kt)) > 0) return null;
327
+ if (!J(r)) return r;
328
+ r = y(r, t);
329
+ }
330
+ return null;
331
+ }, qt = (e) => {
332
+ if (!j) {
333
+ if (e.key === "Enter" || e.key === " ") {
334
+ if (e.preventDefault(), R) X(!1);
335
+ else {
336
+ let e = (A ? wt?.[0] : q) ?? /* @__PURE__ */ new Date(), t = Q(e, 1, !0) ?? Q(e, -1, !0) ?? null;
337
+ X(!0), t && yt(t);
338
+ }
339
+ } else e.key === "Escape" && R && (e.preventDefault(), X(!1));
340
+ }
341
+ }, Jt = (e) => {
342
+ !oe(e, Et) && !(A && oe(e, Dt)) && z(u(e)), yt(h(e));
343
+ }, Yt = (e, t) => {
344
+ let n = null;
345
+ if (e.key === "ArrowLeft") n = Q(t, -1);
346
+ else if (e.key === "ArrowRight") n = Q(t, 1);
347
+ else if (e.key === "ArrowUp") n = Q(t, -7);
348
+ else if (e.key === "ArrowDown") n = Q(t, 7);
349
+ else if (e.key === "Home" || e.key === "End") {
350
+ let r = e.key === "Home" ? y(t, -t.getDay()) : y(t, 6 - t.getDay()), i = e.key === "Home" ? 1 : -1;
351
+ for (let e = 0; e < 7; e += 1) {
352
+ let t = y(r, e * i);
353
+ if (!J(t)) {
354
+ n = t;
355
+ break;
356
+ }
357
+ }
358
+ }
359
+ n && (e.preventDefault(), Jt(n));
360
+ }, $ = A ? V[U === "start" ? 0 : 1] : B, Xt = S((e) => {
361
+ if (e) {
362
+ if (!$) return;
363
+ pt(_($)), ft(!0);
364
+ return;
365
+ }
366
+ Z(!1);
367
+ }, [$, Z]), Zt = G ?? $ ?? /* @__PURE__ */ new Date(), Qt = Zt.getHours(), $t = Zt.getMinutes(), en = Zt.getSeconds(), tn = $ ? m(Zt, "HH:mm:ss") : "", nn = A ? U === "start" ? "开始时间" : "结束时间" : "时间", rn = S((e, t) => d(e, t, {
368
+ hours: Qt,
369
+ minutes: $t,
370
+ seconds: en
371
+ }, Nt), [
372
+ Nt,
373
+ Qt,
374
+ $t,
375
+ en
376
+ ]), an = A ? !!(V[0] && V[1] && !J(V[0]) && !J(V[1]) && (!x || !Y(m(V[0], "HH:mm:ss")) && !Y(m(V[1], "HH:mm:ss")))) : !!(B && !J(B) && (!x || !Y(m(B, "HH:mm:ss")))), on = !!Tt, sn = [
377
+ `vl-${v}`,
378
+ `size-${Ve}`,
379
+ R ? "is-open" : "",
380
+ j ? "is-disabled" : "",
381
+ A ? "is-range" : "",
382
+ x ? "has-time" : "",
383
+ We || ""
384
+ ].filter(Boolean).join(" "), cn = {
385
+ classPrefix: `vl-${v}`,
386
+ range: A,
387
+ rangeValue: V,
388
+ previewDate: lt,
389
+ selectedDate: B ?? q,
390
+ isDateDisabled: J,
391
+ onSelect: Ht,
392
+ onKeyDown: Yt,
393
+ onPreview: Ut
394
+ }, ln = /* @__PURE__ */ T(i, {
395
+ show: R,
396
+ name: `vl-${v}`,
397
+ deferEffects: !rt,
398
+ children: /* @__PURE__ */ E("div", {
399
+ ref: F,
400
+ id: K,
401
+ className: `vl-${v}__panel is-${ht}${_t ? " is-positioned" : ""}`,
402
+ style: {
403
+ ...mt,
404
+ zIndex: it.zIndex,
405
+ visibility: _t ? "visible" : "hidden"
406
+ },
407
+ role: "dialog",
408
+ "aria-label": A ? "日期范围选择" : x ? "日期时间选择" : "日期选择",
409
+ children: [
410
+ /* @__PURE__ */ E("div", {
411
+ className: `vl-${v}__header`,
412
+ children: [
413
+ /* @__PURE__ */ E("div", {
414
+ className: `vl-${v}__header-actions`,
415
+ children: [/* @__PURE__ */ T("button", {
416
+ type: "button",
417
+ "aria-label": "上一年",
418
+ onClick: () => z((e) => p(e, -12)),
419
+ children: /* @__PURE__ */ T(he, {
420
+ size: 16,
421
+ "aria-hidden": "true"
422
+ })
423
+ }), /* @__PURE__ */ T("button", {
424
+ type: "button",
425
+ "aria-label": "上一个月",
426
+ onClick: () => z((e) => p(e, -1)),
427
+ children: /* @__PURE__ */ T(pe, {
428
+ size: 16,
429
+ "aria-hidden": "true"
430
+ })
431
+ })]
432
+ }),
433
+ A ? null : /* @__PURE__ */ T("span", { children: Oe(Et) }),
434
+ /* @__PURE__ */ E("div", {
435
+ className: `vl-${v}__header-actions`,
436
+ children: [/* @__PURE__ */ T("button", {
437
+ type: "button",
438
+ "aria-label": "下一个月",
439
+ onClick: () => z((e) => p(e, 1)),
440
+ children: /* @__PURE__ */ T(me, {
441
+ size: 16,
442
+ "aria-hidden": "true"
443
+ })
444
+ }), /* @__PURE__ */ T("button", {
445
+ type: "button",
446
+ "aria-label": "下一年",
447
+ onClick: () => z((e) => p(e, 12)),
448
+ children: /* @__PURE__ */ T(ge, {
449
+ size: 16,
450
+ "aria-hidden": "true"
451
+ })
452
+ })]
453
+ })
454
+ ]
455
+ }),
456
+ /* @__PURE__ */ E("div", {
457
+ className: `vl-${v}__calendars`,
458
+ children: [/* @__PURE__ */ T(Ce, {
459
+ ...cn,
460
+ month: Et,
461
+ monthLabel: Oe(Et)
462
+ }), A ? /* @__PURE__ */ T(Ce, {
463
+ ...cn,
464
+ month: Dt,
465
+ monthLabel: Oe(Dt)
466
+ }) : null]
467
+ }),
468
+ x ? /* @__PURE__ */ T("div", {
469
+ className: `vl-${v}__time`,
470
+ children: /* @__PURE__ */ E("div", {
471
+ className: `vl-${v}__time-toolbar`,
472
+ children: [
473
+ /* @__PURE__ */ T("span", {
474
+ className: `vl-${v}__time-title`,
475
+ children: "时间"
476
+ }),
477
+ A ? /* @__PURE__ */ E("div", {
478
+ className: `vl-${v}__time-range`,
479
+ children: [/* @__PURE__ */ T("button", {
480
+ type: "button",
481
+ className: U === "start" ? "is-active" : "",
482
+ "aria-pressed": U === "start",
483
+ disabled: !V[0],
484
+ onClick: () => {
485
+ Z(!1), W("start");
486
+ },
487
+ children: "开始时间"
488
+ }), /* @__PURE__ */ T("button", {
489
+ type: "button",
490
+ className: U === "end" ? "is-active" : "",
491
+ "aria-pressed": U === "end",
492
+ disabled: !V[1],
493
+ onClick: () => {
494
+ Z(!1), W("end");
495
+ },
496
+ children: "结束时间"
497
+ })]
498
+ }) : null,
499
+ /* @__PURE__ */ T(de, {
500
+ className: `vl-${v}__time-dropdown`,
501
+ open: dt,
502
+ disabled: !$,
503
+ trigger: "click",
504
+ placement: "bottom-end",
505
+ offset: 4,
506
+ closeOnContentClick: !1,
507
+ "aria-label": nn,
508
+ menuLabel: `${nn}选择器`,
509
+ triggerContent: /* @__PURE__ */ T(l, {
510
+ ref: nt,
511
+ className: `vl-${v}__time-input`,
512
+ value: tn,
513
+ placeholder: "请先选择日期",
514
+ size: "sm",
515
+ suffixIcon: _e,
516
+ readOnly: !0,
517
+ disabled: !$
518
+ }),
519
+ onChange: Xt,
520
+ children: /* @__PURE__ */ E("div", {
521
+ className: `vl-${v}__time-popover`,
522
+ [we]: K,
523
+ children: [/* @__PURE__ */ T(le, {
524
+ value: {
525
+ hours: Qt,
526
+ minutes: $t,
527
+ seconds: en
528
+ },
529
+ disabled: !$,
530
+ ariaLabel: nn,
531
+ visibleItemCount: 3,
532
+ itemHeight: 30,
533
+ isOptionDisabled: rn,
534
+ onChange: Wt
535
+ }), /* @__PURE__ */ E("div", {
536
+ className: `vl-${v}__footer`,
537
+ children: [/* @__PURE__ */ T("button", {
538
+ type: "button",
539
+ className: "is-cancel",
540
+ "aria-label": "取消时间",
541
+ onClick: () => Z(!1, !0),
542
+ children: "取消"
543
+ }), /* @__PURE__ */ T("button", {
544
+ type: "button",
545
+ className: "is-confirm",
546
+ "aria-label": "确定时间",
547
+ disabled: !G,
548
+ onClick: () => Z(!0, !0),
549
+ children: "确定"
550
+ })]
551
+ })]
552
+ })
553
+ })
554
+ ]
555
+ })
556
+ }) : null,
557
+ Me.length ? /* @__PURE__ */ T("div", {
558
+ className: `vl-${v}__shortcuts`,
559
+ role: "group",
560
+ "aria-label": "快捷选择",
561
+ children: Me.map((e) => /* @__PURE__ */ T("button", {
562
+ type: "button",
563
+ onClick: () => Gt(e),
564
+ children: e.label
565
+ }, e.label))
566
+ }) : null,
567
+ A || x ? /* @__PURE__ */ E("div", {
568
+ className: `vl-${v}__footer`,
569
+ children: [/* @__PURE__ */ T("button", {
570
+ type: "button",
571
+ className: "is-cancel",
572
+ onClick: () => {
573
+ X(!1), P.current?.focus();
574
+ },
575
+ children: "取消"
576
+ }), /* @__PURE__ */ T("button", {
577
+ type: "button",
578
+ className: "is-confirm",
579
+ disabled: !an,
580
+ onClick: () => {
581
+ A ? Vt(V) : B && Bt(B);
582
+ },
583
+ children: "确定"
584
+ })]
585
+ }) : null
586
+ ]
587
+ })
588
+ });
589
+ return /* @__PURE__ */ T(c, {
590
+ layer: it.layer,
591
+ children: /* @__PURE__ */ E("div", {
592
+ ref: xt,
593
+ className: `vl-${v}-wrapper`,
594
+ style: Ge,
595
+ ...et,
596
+ children: [/* @__PURE__ */ E("div", {
597
+ ref: P,
598
+ id: bt,
599
+ className: sn,
600
+ role: "combobox",
601
+ "aria-expanded": R,
602
+ "aria-controls": K,
603
+ "aria-haspopup": "dialog",
604
+ "aria-disabled": j || void 0,
605
+ "aria-label": qe ?? (Je ? void 0 : ze),
606
+ "aria-labelledby": Je,
607
+ "aria-describedby": Ye,
608
+ tabIndex: j ? -1 : 0,
609
+ onClick: () => X(!R),
610
+ onKeyDown: qt,
611
+ children: [
612
+ /* @__PURE__ */ T("span", {
613
+ className: `vl-${v}__icon`,
614
+ "aria-hidden": "true",
615
+ children: /* @__PURE__ */ T(fe, { size: 16 })
616
+ }),
617
+ /* @__PURE__ */ T("span", {
618
+ className: `vl-${v}__value${Tt ? "" : " is-placeholder"}`,
619
+ children: Tt || ze
620
+ }),
621
+ Be && on && !j ? /* @__PURE__ */ T("button", {
622
+ type: "button",
623
+ className: `vl-${v}__clear`,
624
+ "aria-label": "清除已选",
625
+ onClick: Kt,
626
+ onMouseDown: (e) => e.preventDefault(),
627
+ children: /* @__PURE__ */ T(ve, {
628
+ size: 16,
629
+ "aria-hidden": "true"
630
+ })
631
+ }) : null
632
+ ]
633
+ }), rt ? xe(ln, document.body) : ln]
634
+ })
635
+ });
636
+ });
637
+ je.displayName = "VlDatePickerCore";
638
+ //#endregion
639
+ export { je as t };
@@ -0,0 +1 @@
1
+ const e=require("./effect-BpNxm_06.cjs"),t=require("./state-BuUx1onZ.cjs"),n=require("./refs-DCqd87V8.cjs"),r=require("./Transition-X_89ga-e.cjs"),i=require("./client-BkoqeUs3.cjs"),a=require("./floating-BpTI3sWS.cjs"),o=require("./id-CF0zOP1G.cjs"),s=require("./layer-DL1xVbJT.cjs"),ee=require("./Input-BbJ4Q_xu.cjs"),c=require("./time-wheel-BaCcA9nk.cjs"),te=require("./Dropdown-Chx8SZPS.cjs");let l=require("lucide-react"),u=require("react"),d=require("react/jsx-runtime"),f=require("react-dom");var ne=[`日`,`一`,`二`,`三`,`四`,`五`,`六`],p=({classPrefix:e,month:t,monthLabel:n,range:r,rangeValue:i,previewDate:a,selectedDate:o,isDateDisabled:s,onSelect:ee,onKeyDown:te,onPreview:l})=>{let f=(0,u.useMemo)(()=>c.f(t),[t]),p=r?i[0]:null,m=r?i[1]:null,h=r&&p&&!m?a:null,g=m??h,_=p&&g&&c.u(p,g)<=0?p:g,v=p&&g&&c.u(p,g)<=0?g:p,y=r?null:o,b=(r?i:[y]).find(e=>e&&c.m(e,t)&&!s(e))??f.find(e=>c.m(e,t)&&!s(e)),re=new Date,ie=p?c.g(p):null,x=m?c.g(m):null,S=_?c.g(_):null,ae=v?c.g(v):null;return(0,d.jsxs)(`section`,{className:`${e}__calendar`,"aria-label":n,children:[r?(0,d.jsx)(`div`,{className:`${e}__month-title`,children:n}):null,(0,d.jsx)(`div`,{className:`${e}__weekdays`,role:`row`,children:ne.map(e=>(0,d.jsx)(`span`,{role:`columnheader`,children:e},e))}),(0,d.jsx)(`div`,{className:`${e}__grid`,role:`grid`,onMouseLeave:()=>l(null),onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||l(null)},children:f.map(n=>{let i=!c.m(n,t),a=i||s(n),o=!!(ie&&x&&c.u(n,ie)>=0&&c.u(n,x)<=0),u=!!(p&&h&&S&&ae&&c.u(n,S)>=0&&c.u(n,ae)<=0),f=o||u,ne=!!(_&&f&&c.p(n,_)),g=!!(v&&f&&c.p(n,v)),oe=!!(h&&c.p(n,h)),se=c.p(n,re),C=[`${e}__day`,i?`is-other-month`:``,se?`is-today`:``,r&&p&&c.p(n,p)?`is-range-start is-selected`:``,r&&m&&c.p(n,m)?`is-range-end is-selected`:``,y&&c.p(n,y)?`is-selected`:``,f?`is-in-range`:``,ne?`is-range-edge-start`:``,g?`is-range-edge-end`:``,oe?`is-range-preview-end`:``,a?`is-disabled`:``].filter(Boolean).join(` `);return(0,d.jsx)(`button`,{type:`button`,className:C,role:`gridcell`,"data-time":n.getTime(),"aria-label":`${n.getFullYear()}年${n.getMonth()+1}月${n.getDate()}日`,"aria-selected":r?o:!!(y&&c.p(n,y)),"aria-current":se?`date`:void 0,"aria-hidden":i||void 0,"aria-disabled":a||void 0,disabled:a,tabIndex:!a&&b&&c.p(n,b)?0:-1,onClick:()=>ee(n),onKeyDown:e=>te(e,n),onMouseEnter:()=>l(n),onFocus:()=>l(n),children:(0,d.jsx)(`span`,{className:`${e}__day-content`,children:n.getDate()})},n.toISOString())})})]})},m=`data-vl-date-picker-popup-owner`,h=[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],g=e=>Array.isArray(e)&&e.length===2,_=(e,t)=>c.b(e,t),v=(e,t)=>{if(g(e)){let n=_(e[0],t),r=_(e[1],t);return n&&r?`${c.d(n,t)} ~ ${c.d(r,t)}`:``}let n=_(e,t);return n?c.d(n,t):``},y=e=>[e[0]?c.l(e[0]):null,e[1]?c.l(e[1]):null],b=e=>`${e.getFullYear()}年 ${h[e.getMonth()]}`,re=(e,t)=>t?c.l(e):c.g(e),ie=(e,t,n)=>{let r=e=>{let t=_(e,n);return t?t.getTime():null};return g(e)||g(t)?!g(e)||!g(t)?!1:r(e[0])===r(t[0])&&r(e[1])===r(t[1]):r(e)===r(t)},x=(0,u.forwardRef)((ne,h)=>{let{componentName:x,withTime:S=!1,value:ae,defaultValue:oe,valueType:se=`date`,format:C=S?`YYYY-MM-DD HH:mm:ss`:`YYYY-MM-DD`,range:w=!1,shortcuts:ce=[],minDate:le,maxDate:ue,disabledDate:de,minTime:fe,maxTime:pe,disabledTime:me,placeholder:he=w?`请选择日期范围`:S?`请选择日期时间`:`请选择日期`,disabled:T=!1,clearable:ge=!1,size:_e=`md`,placement:E=`bottom-start`,offset:ve=8,zIndex:ye,className:be,style:xe,id:Se,"aria-label":Ce,"aria-labelledby":we,"aria-describedby":Te,onChange:Ee,onClear:De,onOpen:Oe,onClose:ke,...Ae}=ne,D=Ee,je=(0,u.useRef)(null),O=(0,u.useRef)(null),k=(0,u.useRef)(null),Me=(0,u.useRef)(null),Ne=i.t(),Pe=s.a({defaultZIndex:s.r.popover,zIndex:ye}),Fe=t.t(ne,`value`),[A,j]=t.n({value:ae??null,defaultValue:oe??null,controlled:Fe}),[M,Ie]=(0,u.useState)(!1),[Le,N]=(0,u.useState)(()=>{let e=g(A)?_(A[0],C):_(A,C);return c._(e??new Date)}),[P,Re]=(0,u.useState)(null),[F,I]=(0,u.useState)([null,null]),[ze,L]=(0,u.useState)(null),[R,z]=(0,u.useState)(`start`),[Be,Ve]=(0,u.useState)(!1),[B,He]=(0,u.useState)(null),[{style:Ue,placement:We},Ge]=a.i(E),Ke=Ue.left!==void 0,[qe,V]=(0,u.useState)(null),Je=o.t(`vl-${x}-control`,Se),H=o.t(`vl-${x}-panel`),Ye=(0,u.useMemo)(()=>n.n(je,h),[h]),U=(0,u.useCallback)(()=>{Ve(!1),He(null)},[]),Xe=(0,u.useMemo)(()=>w?g(A)?[_(A[0],C),_(A[1],C)]:[null,null]:Array.isArray(A)?null:_(A,C),[C,w,A]),Ze=w?Xe:null,W=w?null:Xe,Qe=v(A,C),$e=Le,et=(0,u.useMemo)(()=>c.c(Le,1),[Le]),G=_(le,C),K=_(ue,C),tt=fe?c.y(fe):null,nt=pe?c.y(pe):null,rt=(0,u.useMemo)(()=>({minSeconds:tt,maxSeconds:nt,disabledTime:me}),[me,nt,tt]),q=(0,u.useCallback)(e=>{let t=c.g(e);return!!(G&&c.u(t,c.g(G))<0||K&&c.u(t,c.g(K))>0||de?.(t))},[de,K,G]),J=(0,u.useCallback)(e=>c.i(e,rt),[rt]),it=(0,u.useCallback)((e,t,n)=>c.n(e,t,n,rt),[rt]),at=(0,u.useCallback)(e=>S&&J(c.d(e,`HH:mm:ss`)),[J,S]),Y=(0,u.useCallback)(e=>{if(!(e&&(T||M))&&!(!e&&!M)){if(e){let e=(w?Ze?.[0]:W)??new Date;N(c._(e)),w?I(y(Ze??[null,null])):Re(W?c.l(W):null),L(null),z(`start`),Ge({placement:E,style:{}}),V(null),U(),Ie(!0),Oe?.()}else V(null),L(null),U(),Ie(!1),ke?.()}},[T,ke,Oe,M,E,w,U,W,Ze,Ge]),ot=(0,u.useCallback)(()=>{if(!M||!O.current||!k.current)return;let e=O.current.getBoundingClientRect(),t=a.t({anchorRect:e,floatingRect:k.current.getBoundingClientRect(),placement:E,offset:ve});Ge({placement:t.placement,style:{left:`${Math.round(t.x)}px`,top:`${Math.round(t.y)}px`}})},[ve,M,E,Ge]);e.t(()=>{if(!M||!Ne)return;ot();let e=window.requestAnimationFrame(ot);return()=>window.cancelAnimationFrame(e)},[Ne,M,ot]),e.t(()=>{if(!M||!Ke||!qe)return;let e=k.current?.querySelector(`[data-time="${qe.getTime()}"]:not(:disabled)`);e&&(e.focus(),V(null))},[Le,qe,Ke,M]);let st=(0,u.useCallback)(e=>e.some(e=>e instanceof HTMLElement&&(e.getAttribute(m)===H||e.classList.contains(`vl-dropdown__panel`)&&e.querySelector(`[${m}]`)?.getAttribute(m)===H)),[H]),ct=(0,u.useCallback)(()=>Y(!1),[Y]),lt=(0,u.useCallback)(()=>{Be||(Y(!1),O.current?.focus())},[Y,Be]);a.r({active:M,rootRef:je,floatingRef:k,isOwnedPopup:st,onOutsideClick:ct,onEscape:lt,onViewportChange:ot}),(0,u.useEffect)(()=>{T&&M&&Y(!1)},[T,M,Y]);let X=(0,u.useCallback)(e=>se===`string`?c.d(e,C):c.l(e),[C,se]),ut=(0,u.useCallback)(e=>{let t=re(e,S);if(q(t)||S&&J(c.d(t,`HH:mm:ss`)))return;let n=X(t);ie(A,n,C)||(j(n),D?.(n)),Y(!1),O.current?.focus()},[D,C,q,J,X,A,Y,j,S]),dt=(0,u.useCallback)(e=>{if(!e[0]||!e[1])return;let t=c.u(e[0],e[1])<=0?e:[e[1],e[0]],n=re(t[0],S),r=re(t[1],S);if(q(n)||q(r)||S&&(J(c.d(n,`HH:mm:ss`))||J(c.d(r,`HH:mm:ss`))))return;let i=[X(n),X(r)];ie(A,i,C)||(j(i),D?.(i)),Y(!1),O.current?.focus()},[D,C,q,J,X,A,Y,j,S]),ft=e=>{if(q(e))return;L(null);let t=w?F[R===`start`?0:1]:P,n=c.g(e);if(S){if(t)n=c.h(e,t.getHours(),t.getMinutes(),t.getSeconds());else{let t=it(0,86399,0);n=t===null?c.l(e):c.h(e,Math.floor(t/3600),Math.floor(t%3600/60),t%60)}}if(!w){Re(n),S||ut(n);return}let[r,i]=F;if(!r||i){I([n,null]),z(`start`);return}c.u(n,r)<0?(I([n,r]),z(`end`)):(I([r,n]),z(`end`))},pt=e=>{if(!w||!e||F[1]||q(e)){L(null);return}L(c.g(e))},Z=(0,u.useCallback)((e,t=!1)=>{if(e&&B){if(w){let e=y(F);e[R===`start`?0:1]=c.l(B),I(e)}else Re(c.l(B))}U(),t&&window.requestAnimationFrame(()=>Me.current?.focus())},[R,F,w,U,B]),mt=(e,t)=>{let n=B?c.l(B):new Date,r={hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds()},{start:i,end:a,preferred:o}=c.r(e,t,r),s=it(i,a,o);if(s===null)return;let ee=c.h(n,Math.floor(s/3600),Math.floor(s%3600/60),s%60);He(ee)},ht=e=>{let t=e.getValue(new Date);if(t===null)return;if(w){if(!g(t))return;let e=_(t[0],C),n=_(t[1],C);if(!e||!n||q(e)||q(n)||at(e)||at(n))return;I(c.u(e,n)<=0?[e,n]:[n,e]),z(`end`);return}if(g(t))return;let n=_(t,C);!n||q(n)||at(n)||ut(n)},gt=e=>{e?.stopPropagation(),!T&&(j(null),D?.(null),De?.(),Re(null),I([null,null]))},Q=(e,t,n=!1)=>{let r=n?c.g(e):c.s(c.g(e),t);for(let e=0;e<3660;e+=1){if(t<0&&G&&c.u(r,c.g(G))<0||t>0&&K&&c.u(r,c.g(K))>0)return null;if(!q(r))return r;r=c.s(r,t)}return null},_t=e=>{if(!T){if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),M)Y(!1);else{let e=(w?Ze?.[0]:W)??new Date,t=Q(e,1,!0)??Q(e,-1,!0)??null;Y(!0),t&&V(t)}}else e.key===`Escape`&&M&&(e.preventDefault(),Y(!1))}},vt=e=>{!c.m(e,$e)&&!(w&&c.m(e,et))&&N(c._(e)),V(c.g(e))},yt=(e,t)=>{let n=null;if(e.key===`ArrowLeft`)n=Q(t,-1);else if(e.key===`ArrowRight`)n=Q(t,1);else if(e.key===`ArrowUp`)n=Q(t,-7);else if(e.key===`ArrowDown`)n=Q(t,7);else if(e.key===`Home`||e.key===`End`){let r=e.key===`Home`?c.s(t,-t.getDay()):c.s(t,6-t.getDay()),i=e.key===`Home`?1:-1;for(let e=0;e<7;e+=1){let t=c.s(r,e*i);if(!q(t)){n=t;break}}}n&&(e.preventDefault(),vt(n))},$=w?F[R===`start`?0:1]:P,bt=(0,u.useCallback)(e=>{if(e){if(!$)return;He(c.l($)),Ve(!0);return}Z(!1)},[$,Z]),xt=B??$??new Date,St=xt.getHours(),Ct=xt.getMinutes(),wt=xt.getSeconds(),Tt=$?c.d(xt,`HH:mm:ss`):``,Et=w?R===`start`?`开始时间`:`结束时间`:`时间`,Dt=(0,u.useCallback)((e,t)=>c.a(e,t,{hours:St,minutes:Ct,seconds:wt},it),[it,St,Ct,wt]),Ot=w?!!(F[0]&&F[1]&&!q(F[0])&&!q(F[1])&&(!S||!J(c.d(F[0],`HH:mm:ss`))&&!J(c.d(F[1],`HH:mm:ss`)))):!!(P&&!q(P)&&(!S||!J(c.d(P,`HH:mm:ss`)))),kt=!!Qe,At=[`vl-${x}`,`size-${_e}`,M?`is-open`:``,T?`is-disabled`:``,w?`is-range`:``,S?`has-time`:``,be||``].filter(Boolean).join(` `),jt={classPrefix:`vl-${x}`,range:w,rangeValue:F,previewDate:ze,selectedDate:P??W,isDateDisabled:q,onSelect:ft,onKeyDown:yt,onPreview:pt},Mt=(0,d.jsx)(r.t,{show:M,name:`vl-${x}`,deferEffects:!Ne,children:(0,d.jsxs)(`div`,{ref:k,id:H,className:`vl-${x}__panel is-${We}${Ke?` is-positioned`:``}`,style:{...Ue,zIndex:Pe.zIndex,visibility:Ke?`visible`:`hidden`},role:`dialog`,"aria-label":w?`日期范围选择`:S?`日期时间选择`:`日期选择`,children:[(0,d.jsxs)(`div`,{className:`vl-${x}__header`,children:[(0,d.jsxs)(`div`,{className:`vl-${x}__header-actions`,children:[(0,d.jsx)(`button`,{type:`button`,"aria-label":`上一年`,onClick:()=>N(e=>c.c(e,-12)),children:(0,d.jsx)(l.ChevronsLeft,{size:16,"aria-hidden":`true`})}),(0,d.jsx)(`button`,{type:`button`,"aria-label":`上一个月`,onClick:()=>N(e=>c.c(e,-1)),children:(0,d.jsx)(l.ChevronLeft,{size:16,"aria-hidden":`true`})})]}),w?null:(0,d.jsx)(`span`,{children:b($e)}),(0,d.jsxs)(`div`,{className:`vl-${x}__header-actions`,children:[(0,d.jsx)(`button`,{type:`button`,"aria-label":`下一个月`,onClick:()=>N(e=>c.c(e,1)),children:(0,d.jsx)(l.ChevronRight,{size:16,"aria-hidden":`true`})}),(0,d.jsx)(`button`,{type:`button`,"aria-label":`下一年`,onClick:()=>N(e=>c.c(e,12)),children:(0,d.jsx)(l.ChevronsRight,{size:16,"aria-hidden":`true`})})]})]}),(0,d.jsxs)(`div`,{className:`vl-${x}__calendars`,children:[(0,d.jsx)(p,{...jt,month:$e,monthLabel:b($e)}),w?(0,d.jsx)(p,{...jt,month:et,monthLabel:b(et)}):null]}),S?(0,d.jsx)(`div`,{className:`vl-${x}__time`,children:(0,d.jsxs)(`div`,{className:`vl-${x}__time-toolbar`,children:[(0,d.jsx)(`span`,{className:`vl-${x}__time-title`,children:`时间`}),w?(0,d.jsxs)(`div`,{className:`vl-${x}__time-range`,children:[(0,d.jsx)(`button`,{type:`button`,className:R===`start`?`is-active`:``,"aria-pressed":R===`start`,disabled:!F[0],onClick:()=>{Z(!1),z(`start`)},children:`开始时间`}),(0,d.jsx)(`button`,{type:`button`,className:R===`end`?`is-active`:``,"aria-pressed":R===`end`,disabled:!F[1],onClick:()=>{Z(!1),z(`end`)},children:`结束时间`})]}):null,(0,d.jsx)(te.t,{className:`vl-${x}__time-dropdown`,open:Be,disabled:!$,trigger:`click`,placement:`bottom-end`,offset:4,closeOnContentClick:!1,"aria-label":Et,menuLabel:`${Et}选择器`,triggerContent:(0,d.jsx)(ee.t,{ref:Me,className:`vl-${x}__time-input`,value:Tt,placeholder:`请先选择日期`,size:`sm`,suffixIcon:l.Clock3,readOnly:!0,disabled:!$}),onChange:bt,children:(0,d.jsxs)(`div`,{className:`vl-${x}__time-popover`,[m]:H,children:[(0,d.jsx)(c.t,{value:{hours:St,minutes:Ct,seconds:wt},disabled:!$,ariaLabel:Et,visibleItemCount:3,itemHeight:30,isOptionDisabled:Dt,onChange:mt}),(0,d.jsxs)(`div`,{className:`vl-${x}__footer`,children:[(0,d.jsx)(`button`,{type:`button`,className:`is-cancel`,"aria-label":`取消时间`,onClick:()=>Z(!1,!0),children:`取消`}),(0,d.jsx)(`button`,{type:`button`,className:`is-confirm`,"aria-label":`确定时间`,disabled:!B,onClick:()=>Z(!0,!0),children:`确定`})]})]})})]})}):null,ce.length?(0,d.jsx)(`div`,{className:`vl-${x}__shortcuts`,role:`group`,"aria-label":`快捷选择`,children:ce.map(e=>(0,d.jsx)(`button`,{type:`button`,onClick:()=>ht(e),children:e.label},e.label))}):null,w||S?(0,d.jsxs)(`div`,{className:`vl-${x}__footer`,children:[(0,d.jsx)(`button`,{type:`button`,className:`is-cancel`,onClick:()=>{Y(!1),O.current?.focus()},children:`取消`}),(0,d.jsx)(`button`,{type:`button`,className:`is-confirm`,disabled:!Ot,onClick:()=>{w?dt(F):P&&ut(P)},children:`确定`})]}):null]})});return(0,d.jsx)(s.t,{layer:Pe.layer,children:(0,d.jsxs)(`div`,{ref:Ye,className:`vl-${x}-wrapper`,style:xe,...Ae,children:[(0,d.jsxs)(`div`,{ref:O,id:Je,className:At,role:`combobox`,"aria-expanded":M,"aria-controls":H,"aria-haspopup":`dialog`,"aria-disabled":T||void 0,"aria-label":Ce??(we?void 0:he),"aria-labelledby":we,"aria-describedby":Te,tabIndex:T?-1:0,onClick:()=>Y(!M),onKeyDown:_t,children:[(0,d.jsx)(`span`,{className:`vl-${x}__icon`,"aria-hidden":`true`,children:(0,d.jsx)(l.CalendarDays,{size:16})}),(0,d.jsx)(`span`,{className:`vl-${x}__value${Qe?``:` is-placeholder`}`,children:Qe||he}),ge&&kt&&!T?(0,d.jsx)(`button`,{type:`button`,className:`vl-${x}__clear`,"aria-label":`清除已选`,onClick:gt,onMouseDown:e=>e.preventDefault(),children:(0,d.jsx)(l.X,{size:16,"aria-hidden":`true`})}):null]}),Ne?(0,f.createPortal)(Mt,document.body):Mt]})})});x.displayName=`VlDatePickerCore`,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return x}});
package/dist/es/Col.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  'use client';
2
- import { n as e, t } from "../Col-CZjR94ac.js";
2
+ import { n as e, t } from "../Col-BZdKuXbj.js";
3
3
  export { e as VlCol, t as default };
package/dist/es/Cron.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  'use client';
2
- import { n as e, t } from "../Cron-C3S1XI-J.js";
2
+ import { n as e, t } from "../Cron-HRBggBRO.js";
3
3
  export { e as VlCron, t as default };
@@ -1,3 +1,3 @@
1
1
  'use client';
2
- import { n as e, t } from "../DatePicker-DhRxFPCj.js";
2
+ import { n as e, t } from "../DatePicker-B0f4Nh8h.js";
3
3
  export { e as VlDatePicker, t as default };
@@ -1,3 +1,3 @@
1
1
  'use client';
2
- import { n as e, t } from "../DateTimePicker-BjDD15Av.js";
2
+ import { n as e, t } from "../DateTimePicker-BzkWgjkq.js";
3
3
  export { e as VlDateTimePicker, t as default };