@vavt/react-ui 1.3.0 → 1.4.0

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