@vavt/react-ui 1.2.3 → 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.
- package/README.md +1 -1
- package/dist/Announcement-BUvNHscy.cjs +1 -0
- package/dist/Announcement-CznCpx2T.js +174 -0
- package/dist/Badge-BkqoSV-F.cjs +1 -0
- package/dist/Badge-FzXPw1qS.js +72 -0
- package/dist/{Col-CZjR94ac.js → Col-BZdKuXbj.js} +1 -1
- package/dist/{Col-qcq7T83y.cjs → Col-CvoVGKUn.cjs} +1 -1
- package/dist/Cron-B4S_KhO1.cjs +1 -0
- package/dist/{Cron-C3yEuafY.js → Cron-B8cGD7-3.js} +356 -348
- package/dist/{DatePicker-3DRaRPjg.cjs → DatePicker-DwACFSC7.cjs} +1 -1
- package/dist/{DatePicker-IFns1yBl.js → DatePicker-w6jWiNfz.js} +1 -1
- package/dist/{DateTimePicker-Bml1FgyN.cjs → DateTimePicker-B5atDTPW.cjs} +1 -1
- package/dist/{DateTimePicker-DnXBZTg0.js → DateTimePicker-NP2aVE5R.js} +1 -1
- package/dist/Drawer-DNZCj--j.js +113 -0
- package/dist/{Drawer-NyC3NpBR.cjs → Drawer-YWO6-KLG.cjs} +1 -1
- package/dist/Dropdown-Chx8SZPS.cjs +1 -0
- package/dist/Dropdown-CyVxoFAH.js +330 -0
- package/dist/Form-CyCbST4e.cjs +1 -0
- package/dist/Form-Fe4b1pS1.js +446 -0
- package/dist/{Loading-CL0wUgYK.js → Loading-BAKnIASq.js} +4 -4
- package/dist/{Loading-C2pY-4fA.cjs → Loading-BSqhKOle.cjs} +1 -1
- package/dist/{MessageBox-BeEgyiwR.js → MessageBox-C35_ifsL.js} +1 -1
- package/dist/{MessageBox-70-7jPWP.cjs → MessageBox-C6NLihE1.cjs} +1 -1
- package/dist/{Modal-DWKzYEN8.js → Modal-6kNs-9QU.js} +7 -7
- package/dist/{Modal-BYKseLTT.cjs → Modal-BKvRyCXZ.cjs} +1 -1
- package/dist/{Pagination-CXJBTKHs.js → Pagination-BrG1pKYw.js} +1 -1
- package/dist/{Pagination-Bi6z9CZE.cjs → Pagination-D3ok8N9k.cjs} +1 -1
- package/dist/Row-BGzLSkCy.js +24 -0
- package/dist/Row-CRQKzpiH.cjs +1 -0
- package/dist/Select-GleCzXQB.js +497 -0
- package/dist/Select-Rx6AHue2.cjs +1 -0
- package/dist/Sidebar-2KVVRUEM.cjs +1 -0
- package/dist/Sidebar-ByLinOVm.js +77 -0
- package/dist/{Table-8KkwnZom.js → Table-ClWg25Wn.js} +10 -7
- package/dist/{Table-DVb-ByCJ.cjs → Table-Dv2qxs8q.cjs} +1 -1
- package/dist/TimePicker-BCU7D6uD.cjs +1 -0
- package/dist/TimePicker-BVZbkBvJ.js +215 -0
- package/dist/Tooltip-BbbIT5nt.js +198 -0
- package/dist/Tooltip-z6u7ChKj.cjs +1 -0
- package/dist/base.css +1 -1
- package/dist/cjs/Announcement.cjs +1 -1
- package/dist/cjs/Badge.cjs +1 -0
- package/dist/cjs/Col.cjs +1 -1
- package/dist/cjs/Cron.cjs +1 -1
- package/dist/cjs/DatePicker.cjs +1 -1
- package/dist/cjs/DateTimePicker.cjs +1 -1
- package/dist/cjs/Drawer.cjs +1 -1
- package/dist/cjs/Dropdown.cjs +1 -1
- package/dist/cjs/Form.cjs +1 -1
- package/dist/cjs/Loading.cjs +1 -1
- package/dist/cjs/MessageBox.cjs +1 -1
- package/dist/cjs/Modal.cjs +1 -1
- package/dist/cjs/Pagination.cjs +1 -1
- package/dist/cjs/Row.cjs +1 -1
- package/dist/cjs/Select.cjs +1 -1
- package/dist/cjs/Sidebar.cjs +1 -1
- package/dist/cjs/Table.cjs +1 -1
- package/dist/cjs/TimePicker.cjs +1 -1
- package/dist/cjs/Tooltip.cjs +1 -1
- package/dist/cjs/global.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/register.cjs +1 -1
- package/dist/css/Announcement.css +1 -1
- package/dist/css/Badge.css +1 -0
- package/dist/css/Button.css +1 -1
- package/dist/css/Checkbox.css +1 -1
- package/dist/css/Form.css +1 -1
- package/dist/css/Radio.css +1 -1
- package/dist/css/Sidebar.css +1 -1
- package/dist/css/Switch.css +1 -1
- package/dist/date-picker-DVvBQnvF.cjs +1 -0
- package/dist/date-picker-pcnebTrf.js +639 -0
- package/dist/es/Announcement.mjs +1 -1
- package/dist/es/Badge.mjs +3 -0
- package/dist/es/Col.mjs +1 -1
- package/dist/es/Cron.mjs +1 -1
- package/dist/es/DatePicker.mjs +1 -1
- package/dist/es/DateTimePicker.mjs +1 -1
- package/dist/es/Drawer.mjs +1 -1
- package/dist/es/Dropdown.mjs +1 -1
- package/dist/es/Form.mjs +1 -1
- package/dist/es/Loading.mjs +1 -1
- package/dist/es/MessageBox.mjs +1 -1
- package/dist/es/Modal.mjs +1 -1
- package/dist/es/Pagination.mjs +1 -1
- package/dist/es/Row.mjs +1 -1
- package/dist/es/Select.mjs +1 -1
- package/dist/es/Sidebar.mjs +1 -1
- package/dist/es/Table.mjs +1 -1
- package/dist/es/TimePicker.mjs +1 -1
- package/dist/es/Tooltip.mjs +1 -1
- package/dist/es/global.mjs +1 -1
- package/dist/es/index.mjs +41 -40
- package/dist/es/register.mjs +1 -1
- package/dist/floating-BpTI3sWS.cjs +1 -0
- package/dist/{floating-CqdcJWk2.js → floating-BqCWEj83.js} +27 -15
- package/dist/index.css +1 -1
- package/dist/registry-Cddoj83d.js +87 -0
- package/dist/registry-DvXvnY8T.cjs +1 -0
- package/dist/style/Badge.cjs +8 -0
- package/dist/style/Badge.mjs +8 -0
- package/dist/style/Sidebar.cjs +1 -0
- package/dist/style/Sidebar.mjs +1 -0
- package/dist/types/Announcement/type.d.cts +2 -2
- package/dist/types/Announcement/type.d.ts +2 -2
- package/dist/types/Badge/Badge.d.cts +3 -0
- package/dist/types/Badge/Badge.d.ts +3 -0
- package/dist/types/Badge/index.d.cts +5 -0
- package/dist/types/Badge/index.d.ts +5 -0
- package/dist/types/Badge/type.d.cts +31 -0
- package/dist/types/Badge/type.d.ts +31 -0
- package/dist/types/Form/FormItem.d.cts +1 -1
- package/dist/types/Form/FormItem.d.ts +1 -1
- package/dist/types/Form/context.d.cts +4 -2
- package/dist/types/Form/context.d.ts +4 -2
- package/dist/types/Form/index.d.cts +2 -2
- package/dist/types/Form/index.d.ts +2 -2
- package/dist/types/Form/type.d.cts +2 -0
- package/dist/types/Form/type.d.ts +2 -0
- package/dist/types/Select/SelectList.d.cts +20 -0
- package/dist/types/Select/SelectList.d.ts +20 -0
- package/dist/types/_shared/date-calendar.d.cts +20 -0
- package/dist/types/_shared/date-calendar.d.ts +20 -0
- package/dist/types/_shared/floating.d.cts +13 -1
- package/dist/types/_shared/floating.d.ts +13 -1
- package/dist/types/global.d.cts +2 -0
- package/dist/types/global.d.ts +2 -0
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/registry.d.cts +2 -1
- package/dist/types/registry.d.ts +2 -1
- package/package.json +1 -1
- package/dist/Announcement-D0hZE2sM.cjs +0 -1
- package/dist/Announcement-DzzaTvcO.js +0 -212
- package/dist/Cron-DyBHGiUj.cjs +0 -1
- package/dist/Drawer-B4vSd2iq.js +0 -113
- package/dist/Dropdown-CI_C-qdP.js +0 -319
- package/dist/Dropdown-DPY4QNdT.cjs +0 -1
- package/dist/Form-BMXJJ8bX.cjs +0 -1
- package/dist/Form-BvCSJ23z.js +0 -449
- package/dist/Row-BJZtEKxG.cjs +0 -1
- package/dist/Row-DpEse7PJ.js +0 -24
- package/dist/Select-DaIhlOMK.js +0 -466
- package/dist/Select-YUrncvbr.cjs +0 -1
- package/dist/Sidebar-BPXVnP7y.cjs +0 -1
- package/dist/Sidebar-u980T-QB.js +0 -76
- package/dist/TimePicker-CZAlhs_F.cjs +0 -1
- package/dist/TimePicker-TtKzEbBJ.js +0 -207
- package/dist/Tooltip-BtUDTfMB.js +0 -205
- package/dist/Tooltip-C4CuAEie.cjs +0 -1
- package/dist/date-picker-Yq0xV3y8.cjs +0 -1
- package/dist/date-picker-tq5q60JP.js +0 -612
- package/dist/floating-5PRFyI8D.cjs +0 -1
- package/dist/registry-BmoI_ib1.js +0 -85
- package/dist/registry-DtJjJt6v.cjs +0 -1
- package/dist/types/Announcement/host.d.cts +0 -12
- package/dist/types/Announcement/host.d.ts +0 -12
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./state-BSDh-Ob2.js";
|
|
2
|
-
import { t as n } from "./client-pj_wzx28.js";
|
|
3
|
-
import { n as ee } from "./refs-D5IYOBaf.js";
|
|
4
|
-
import { r as te, t as ne } from "./floating-CqdcJWk2.js";
|
|
5
|
-
import { t as r } from "./id-CHixuHb7.js";
|
|
6
|
-
import { a as re, r as ie, t as ae } from "./layer-C1yCY0MO.js";
|
|
7
|
-
import { t as oe } from "./Transition-DiO4GsP3.js";
|
|
8
|
-
import { a as se, d as ce, i as le, n as ue, o as de, t as fe, v as pe, y as i } from "./time-wheel-BtvYZI6H.js";
|
|
9
|
-
import { Clock3 as a, X as me } from "lucide-react";
|
|
10
|
-
import { forwardRef as o, useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
11
|
-
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
12
|
-
import { createPortal as he } from "react-dom";
|
|
13
|
-
//#region components/TimePicker/TimePicker.tsx
|
|
14
|
-
var m = o((o, m) => {
|
|
15
|
-
let { value: h, defaultValue: g = null, format: ge = "HH:mm:ss", shortcuts: _ = [], minTime: v, maxTime: y, disabledTime: b, placeholder: x = "请选择时间", disabled: S = !1, clearable: _e = !1, size: ve = "md", placement: C = "bottom-start", offset: w = 8, zIndex: ye, className: be, style: xe, id: Se, "aria-label": Ce, "aria-labelledby": T, "aria-describedby": we, onChange: Te, onClear: Ee, onOpen: E, onClose: D, ...De } = o, O = u(null), k = u(null), A = u(null), j = n(), M = re({
|
|
16
|
-
defaultZIndex: ie.popover,
|
|
17
|
-
zIndex: ye
|
|
18
|
-
}), Oe = t(o, "value"), [N, ke] = e({
|
|
19
|
-
value: h ?? null,
|
|
20
|
-
defaultValue: g,
|
|
21
|
-
controlled: Oe
|
|
22
|
-
}), [P, Ae] = d(!1), [je, F] = d({}), [I, L] = d(!1), [Me, R] = d(C), Ne = r("vl-time-picker-control", Se), z = r("vl-time-picker-panel"), Pe = l(() => ee(O, m), [m]), B = v ? i(v) : null, V = y ? i(y) : null, H = l(() => ({
|
|
23
|
-
minSeconds: B,
|
|
24
|
-
maxSeconds: V,
|
|
25
|
-
disabledTime: b
|
|
26
|
-
}), [
|
|
27
|
-
b,
|
|
28
|
-
V,
|
|
29
|
-
B
|
|
30
|
-
]), U = N && i(N) !== null ? N : "", W = U ? ce(pe(U), ge) : "", G = i(U) ?? i("00:00:00") ?? 0, K = Math.floor(G / 3600), q = Math.floor(G % 3600 / 60), J = G % 60, Fe = s((e) => le(e, H), [H]), Y = s((e, t, n) => ue(e, t, n, H), [H]), X = s((e) => {
|
|
31
|
-
e && S || e !== P && (Ae(e), e ? (L(!1), R(C), F({}), E?.()) : D?.());
|
|
32
|
-
}, [
|
|
33
|
-
S,
|
|
34
|
-
D,
|
|
35
|
-
E,
|
|
36
|
-
P,
|
|
37
|
-
C
|
|
38
|
-
]), Z = s(() => {
|
|
39
|
-
if (!P || !k.current || !A.current) return;
|
|
40
|
-
let e = ne({
|
|
41
|
-
anchorRect: k.current.getBoundingClientRect(),
|
|
42
|
-
floatingRect: A.current.getBoundingClientRect(),
|
|
43
|
-
placement: C,
|
|
44
|
-
offset: w
|
|
45
|
-
});
|
|
46
|
-
R(e.placement), F({
|
|
47
|
-
left: `${Math.round(e.x)}px`,
|
|
48
|
-
top: `${Math.round(e.y)}px`
|
|
49
|
-
}), L(!0);
|
|
50
|
-
}, [
|
|
51
|
-
w,
|
|
52
|
-
P,
|
|
53
|
-
C
|
|
54
|
-
]);
|
|
55
|
-
c(() => {
|
|
56
|
-
P && j && Z();
|
|
57
|
-
}, [
|
|
58
|
-
j,
|
|
59
|
-
P,
|
|
60
|
-
Z
|
|
61
|
-
]);
|
|
62
|
-
let Ie = s(() => X(!1), [X]), Le = s(() => {
|
|
63
|
-
X(!1), k.current?.focus();
|
|
64
|
-
}, [X]);
|
|
65
|
-
te({
|
|
66
|
-
active: P && j,
|
|
67
|
-
rootRef: O,
|
|
68
|
-
floatingRef: A,
|
|
69
|
-
onOutsideClick: Ie,
|
|
70
|
-
onEscape: Le,
|
|
71
|
-
onViewportChange: Z
|
|
72
|
-
}), c(() => {
|
|
73
|
-
S && P && X(!1);
|
|
74
|
-
}, [
|
|
75
|
-
S,
|
|
76
|
-
P,
|
|
77
|
-
X
|
|
78
|
-
]);
|
|
79
|
-
let Q = (e) => {
|
|
80
|
-
e !== null && Fe(e) || (ke(e), Te?.(e));
|
|
81
|
-
}, Re = (e, t) => {
|
|
82
|
-
let n = de(e, t, {
|
|
83
|
-
hours: K,
|
|
84
|
-
minutes: q,
|
|
85
|
-
seconds: J
|
|
86
|
-
}, Y);
|
|
87
|
-
n !== null && Q(n);
|
|
88
|
-
}, ze = s((e, t) => se(e, t, {
|
|
89
|
-
hours: K,
|
|
90
|
-
minutes: q,
|
|
91
|
-
seconds: J
|
|
92
|
-
}, Y), [
|
|
93
|
-
Y,
|
|
94
|
-
K,
|
|
95
|
-
q,
|
|
96
|
-
J
|
|
97
|
-
]), Be = (e) => {
|
|
98
|
-
let t = e.getValue(/* @__PURE__ */ new Date());
|
|
99
|
-
t && i(t) !== null && Q(t);
|
|
100
|
-
}, Ve = (e) => {
|
|
101
|
-
e?.stopPropagation(), !S && (Q(null), Ee?.());
|
|
102
|
-
}, He = (e) => {
|
|
103
|
-
S || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), X(!P));
|
|
104
|
-
}, Ue = [
|
|
105
|
-
"vl-time-picker",
|
|
106
|
-
`size-${ve}`,
|
|
107
|
-
P ? "is-open" : "",
|
|
108
|
-
S ? "is-disabled" : "",
|
|
109
|
-
be || ""
|
|
110
|
-
].filter(Boolean).join(" "), $ = /* @__PURE__ */ f(oe, {
|
|
111
|
-
show: P,
|
|
112
|
-
name: "vl-time-picker",
|
|
113
|
-
deferEffects: !j,
|
|
114
|
-
children: /* @__PURE__ */ p("div", {
|
|
115
|
-
ref: A,
|
|
116
|
-
id: z,
|
|
117
|
-
className: `vl-time-picker__panel is-${Me}${I ? " is-positioned" : ""}`,
|
|
118
|
-
style: {
|
|
119
|
-
...je,
|
|
120
|
-
zIndex: M.zIndex,
|
|
121
|
-
visibility: I ? "visible" : "hidden"
|
|
122
|
-
},
|
|
123
|
-
role: "dialog",
|
|
124
|
-
"aria-label": "时间选择",
|
|
125
|
-
children: [/* @__PURE__ */ p("div", {
|
|
126
|
-
className: "vl-time-picker__controls",
|
|
127
|
-
children: [/* @__PURE__ */ p("div", {
|
|
128
|
-
className: "vl-time-picker__controls-title",
|
|
129
|
-
children: [/* @__PURE__ */ f(a, {
|
|
130
|
-
size: 16,
|
|
131
|
-
"aria-hidden": "true"
|
|
132
|
-
}), /* @__PURE__ */ f("span", { children: "时间" })]
|
|
133
|
-
}), /* @__PURE__ */ f(fe, {
|
|
134
|
-
value: {
|
|
135
|
-
hours: K,
|
|
136
|
-
minutes: q,
|
|
137
|
-
seconds: J
|
|
138
|
-
},
|
|
139
|
-
isOptionDisabled: ze,
|
|
140
|
-
onChange: Re
|
|
141
|
-
})]
|
|
142
|
-
}), _.length ? /* @__PURE__ */ f("div", {
|
|
143
|
-
className: "vl-time-picker__shortcuts",
|
|
144
|
-
role: "group",
|
|
145
|
-
"aria-label": "快捷选择",
|
|
146
|
-
children: _.map((e) => /* @__PURE__ */ f("button", {
|
|
147
|
-
type: "button",
|
|
148
|
-
onClick: () => Be(e),
|
|
149
|
-
children: e.label
|
|
150
|
-
}, e.label))
|
|
151
|
-
}) : null]
|
|
152
|
-
})
|
|
153
|
-
});
|
|
154
|
-
return /* @__PURE__ */ f(ae, {
|
|
155
|
-
layer: M.layer,
|
|
156
|
-
children: /* @__PURE__ */ p("div", {
|
|
157
|
-
ref: Pe,
|
|
158
|
-
className: "vl-time-picker-wrapper",
|
|
159
|
-
style: xe,
|
|
160
|
-
...De,
|
|
161
|
-
children: [/* @__PURE__ */ p("div", {
|
|
162
|
-
ref: k,
|
|
163
|
-
id: Ne,
|
|
164
|
-
className: Ue,
|
|
165
|
-
role: "combobox",
|
|
166
|
-
"aria-expanded": P,
|
|
167
|
-
"aria-controls": z,
|
|
168
|
-
"aria-haspopup": "dialog",
|
|
169
|
-
"aria-disabled": S || void 0,
|
|
170
|
-
"aria-label": Ce ?? (T ? void 0 : x),
|
|
171
|
-
"aria-labelledby": T,
|
|
172
|
-
"aria-describedby": we,
|
|
173
|
-
tabIndex: S ? -1 : 0,
|
|
174
|
-
onClick: () => X(!P),
|
|
175
|
-
onKeyDown: He,
|
|
176
|
-
children: [
|
|
177
|
-
/* @__PURE__ */ f("span", {
|
|
178
|
-
className: "vl-time-picker__icon",
|
|
179
|
-
"aria-hidden": "true",
|
|
180
|
-
children: /* @__PURE__ */ f(a, { size: 16 })
|
|
181
|
-
}),
|
|
182
|
-
/* @__PURE__ */ f("span", {
|
|
183
|
-
className: `vl-time-picker__value${W ? "" : " is-placeholder"}`,
|
|
184
|
-
children: W || x
|
|
185
|
-
}),
|
|
186
|
-
_e && U && !S ? /* @__PURE__ */ f("button", {
|
|
187
|
-
type: "button",
|
|
188
|
-
className: "vl-time-picker__clear",
|
|
189
|
-
"aria-label": "清除已选",
|
|
190
|
-
onClick: Ve,
|
|
191
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
192
|
-
children: /* @__PURE__ */ f(me, {
|
|
193
|
-
size: 16,
|
|
194
|
-
"aria-hidden": "true"
|
|
195
|
-
})
|
|
196
|
-
}) : null
|
|
197
|
-
]
|
|
198
|
-
}), j ? he($, document.body) : $]
|
|
199
|
-
})
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
m.displayName = "VlTimePicker";
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region components/TimePicker/index.ts
|
|
205
|
-
var h = m, g = m;
|
|
206
|
-
//#endregion
|
|
207
|
-
export { h as n, g as t };
|
package/dist/Tooltip-BtUDTfMB.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./state-BSDh-Ob2.js";
|
|
2
|
-
import { t as n } from "./client-pj_wzx28.js";
|
|
3
|
-
import { n as r } from "./refs-D5IYOBaf.js";
|
|
4
|
-
import { t as i } from "./number-BN2jHM6Z.js";
|
|
5
|
-
import { n as ee, r as a } from "./floating-CqdcJWk2.js";
|
|
6
|
-
import { t as o } from "./id-CHixuHb7.js";
|
|
7
|
-
import { a as s, r as te, t as ne } from "./layer-C1yCY0MO.js";
|
|
8
|
-
import { t as re } from "./Transition-DiO4GsP3.js";
|
|
9
|
-
import { i as ie } from "./focus-BDDJyKk3.js";
|
|
10
|
-
import { Fragment as ae, cloneElement as oe, forwardRef as c, isValidElement as l, useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
11
|
-
import { jsx as h, jsxs as se } from "react/jsx-runtime";
|
|
12
|
-
import { createPortal as ce } from "react-dom";
|
|
13
|
-
//#region components/Tooltip/Tooltip.tsx
|
|
14
|
-
var g = c((c, g) => {
|
|
15
|
-
let { content: _, placement: v = "top", trigger: y = "hover", disabled: b = !1, offset: x = 8, showDelay: S = 100, hideDelay: C = 100, showArrow: le = !0, maxWidth: w = 300, zIndex: ue, open: de, defaultOpen: fe = !1, className: T, children: E, onChange: pe, onShow: D, onHide: O, ...me } = c, k = p(null), A = p(null), j = p(null), M = p(null), N = p(!1), P = p(!1), F = p(!1), I = p(null), L = p(null), he = f(() => r(k, g), [g]), R = n(), z = s({
|
|
16
|
-
defaultZIndex: te.tooltip,
|
|
17
|
-
zIndex: ue
|
|
18
|
-
}), ge = t(c, "open"), [B, V] = e({
|
|
19
|
-
value: !!de,
|
|
20
|
-
defaultValue: fe,
|
|
21
|
-
controlled: ge,
|
|
22
|
-
onChange: pe
|
|
23
|
-
}), H = !b && _ != null, U = H && B, W = o("vl-tooltip-popup"), [_e, ve] = m(v), [ye, be] = m({}), [xe, G] = m({}), Se = f(() => [
|
|
24
|
-
"vl-tooltip",
|
|
25
|
-
b ? "is-disabled" : "",
|
|
26
|
-
T || ""
|
|
27
|
-
].filter(Boolean).join(" "), [b, T]), Ce = `vl-tooltip__popup is-${_e}`, K = u(() => {
|
|
28
|
-
I.current !== null && window.clearTimeout(I.current), L.current !== null && window.clearTimeout(L.current), I.current = null, L.current = null;
|
|
29
|
-
}, []), q = u(() => {
|
|
30
|
-
let e = M.current;
|
|
31
|
-
if (e?.isConnected) {
|
|
32
|
-
e.focus();
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
A.current?.querySelector(ie)?.focus();
|
|
36
|
-
}, []), J = u((e, t = !1) => {
|
|
37
|
-
if (!(e && !H)) {
|
|
38
|
-
if (B === e) {
|
|
39
|
-
t && q();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
V(e), e ? D?.() : (O?.(), t && window.requestAnimationFrame(q));
|
|
43
|
-
}
|
|
44
|
-
}, [
|
|
45
|
-
H,
|
|
46
|
-
B,
|
|
47
|
-
V,
|
|
48
|
-
D,
|
|
49
|
-
O,
|
|
50
|
-
q
|
|
51
|
-
]), Y = u(() => {
|
|
52
|
-
if (K(), H) {
|
|
53
|
-
if (S <= 0) {
|
|
54
|
-
J(!0);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
I.current = window.setTimeout(() => J(!0), S);
|
|
58
|
-
}
|
|
59
|
-
}, [
|
|
60
|
-
K,
|
|
61
|
-
H,
|
|
62
|
-
S,
|
|
63
|
-
J
|
|
64
|
-
]), X = u(() => {
|
|
65
|
-
if (K(), C <= 0) {
|
|
66
|
-
J(!1);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
L.current = window.setTimeout(() => J(!1), C);
|
|
70
|
-
}, [
|
|
71
|
-
K,
|
|
72
|
-
C,
|
|
73
|
-
J
|
|
74
|
-
]), Z = u(() => {
|
|
75
|
-
N.current || P.current || F.current || X();
|
|
76
|
-
}, [X]), Q = u(() => {
|
|
77
|
-
if (!U) return;
|
|
78
|
-
let e = A.current, t = j.current;
|
|
79
|
-
if (!e || !t) return;
|
|
80
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), { placement: a, x: o, y: s } = ee({
|
|
81
|
-
anchorRect: n,
|
|
82
|
-
floatingRect: r,
|
|
83
|
-
placement: v,
|
|
84
|
-
offset: x,
|
|
85
|
-
edgePadding: 8
|
|
86
|
-
});
|
|
87
|
-
if (ve(a), be({
|
|
88
|
-
left: `${Math.round(o)}px`,
|
|
89
|
-
top: `${Math.round(s)}px`
|
|
90
|
-
}), a.startsWith("top") || a.startsWith("bottom")) {
|
|
91
|
-
let e = n.left + n.width / 2 - o;
|
|
92
|
-
G({
|
|
93
|
-
left: `${Math.round(i(e, 10, Math.max(10, r.width - 10)))}px`,
|
|
94
|
-
top: void 0
|
|
95
|
-
});
|
|
96
|
-
} else {
|
|
97
|
-
let e = n.top + n.height / 2 - s;
|
|
98
|
-
G({
|
|
99
|
-
left: void 0,
|
|
100
|
-
top: `${Math.round(i(e, 10, Math.max(10, r.height - 10)))}px`
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}, [
|
|
104
|
-
U,
|
|
105
|
-
v,
|
|
106
|
-
x
|
|
107
|
-
]), we = () => {
|
|
108
|
-
y === "hover" && (N.current = !0, Y());
|
|
109
|
-
}, Te = () => {
|
|
110
|
-
y === "hover" && (N.current = !1, Z());
|
|
111
|
-
}, Ee = () => {
|
|
112
|
-
y === "hover" && (P.current = !0, K());
|
|
113
|
-
}, De = () => {
|
|
114
|
-
y === "hover" && (P.current = !1, Z());
|
|
115
|
-
}, Oe = (e) => {
|
|
116
|
-
if (y !== "click") return;
|
|
117
|
-
let t = e.target;
|
|
118
|
-
t.matches("button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])") && (M.current = t), J(!U);
|
|
119
|
-
}, ke = (e) => {
|
|
120
|
-
let t = e.target;
|
|
121
|
-
t.matches("button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])") && (M.current = t), F.current = !0, (y === "hover" || y === "focus") && Y();
|
|
122
|
-
}, Ae = (e) => {
|
|
123
|
-
e.currentTarget.contains(e.relatedTarget) || (F.current = !1, y === "hover" ? Z() : y === "focus" && X());
|
|
124
|
-
};
|
|
125
|
-
d(() => {
|
|
126
|
-
if (!U || !R) return;
|
|
127
|
-
let e = window.requestAnimationFrame(() => {
|
|
128
|
-
Q(), window.requestAnimationFrame(Q);
|
|
129
|
-
});
|
|
130
|
-
return () => window.cancelAnimationFrame(e);
|
|
131
|
-
}, [
|
|
132
|
-
U,
|
|
133
|
-
R,
|
|
134
|
-
Q
|
|
135
|
-
]), d(() => {
|
|
136
|
-
H || !B || J(!1);
|
|
137
|
-
}, [
|
|
138
|
-
H,
|
|
139
|
-
B,
|
|
140
|
-
J
|
|
141
|
-
]);
|
|
142
|
-
let je = u(() => J(!1), [J]), Me = u(() => J(!1, !0), [J]);
|
|
143
|
-
a({
|
|
144
|
-
active: U && R,
|
|
145
|
-
rootRef: k,
|
|
146
|
-
floatingRef: j,
|
|
147
|
-
closeOnOutsideClick: y === "click",
|
|
148
|
-
onOutsideClick: je,
|
|
149
|
-
onEscape: Me,
|
|
150
|
-
onViewportChange: Q
|
|
151
|
-
}), d(() => () => K(), [K]);
|
|
152
|
-
let Ne = [l(E) ? E.props["aria-describedby"] : void 0, W].filter(Boolean).join(" "), Pe = l(E) && E.type !== ae ? oe(E, { "aria-describedby": Ne }) : E, Fe = {
|
|
153
|
-
...ye,
|
|
154
|
-
zIndex: z.zIndex,
|
|
155
|
-
maxWidth: typeof w == "number" ? `${w}px` : w
|
|
156
|
-
}, $ = /* @__PURE__ */ h(re, {
|
|
157
|
-
show: U,
|
|
158
|
-
name: "vl-tooltip",
|
|
159
|
-
unmountOnExit: !1,
|
|
160
|
-
deferEffects: !R,
|
|
161
|
-
children: /* @__PURE__ */ se("div", {
|
|
162
|
-
ref: j,
|
|
163
|
-
id: W,
|
|
164
|
-
className: Ce,
|
|
165
|
-
style: Fe,
|
|
166
|
-
role: "tooltip",
|
|
167
|
-
"aria-hidden": !U || void 0,
|
|
168
|
-
onMouseEnter: Ee,
|
|
169
|
-
onMouseLeave: De,
|
|
170
|
-
children: [le ? /* @__PURE__ */ h("span", {
|
|
171
|
-
className: "vl-tooltip__arrow",
|
|
172
|
-
style: xe,
|
|
173
|
-
"aria-hidden": "true"
|
|
174
|
-
}) : null, /* @__PURE__ */ h("div", {
|
|
175
|
-
className: "vl-tooltip__content",
|
|
176
|
-
children: _
|
|
177
|
-
})]
|
|
178
|
-
})
|
|
179
|
-
});
|
|
180
|
-
return /* @__PURE__ */ h(ne, {
|
|
181
|
-
layer: z.layer,
|
|
182
|
-
children: /* @__PURE__ */ se("div", {
|
|
183
|
-
ref: he,
|
|
184
|
-
className: Se,
|
|
185
|
-
...me,
|
|
186
|
-
children: [/* @__PURE__ */ h("div", {
|
|
187
|
-
ref: A,
|
|
188
|
-
className: "vl-tooltip__trigger",
|
|
189
|
-
"aria-describedby": l(E) ? void 0 : W,
|
|
190
|
-
onMouseEnter: we,
|
|
191
|
-
onMouseLeave: Te,
|
|
192
|
-
onClick: Oe,
|
|
193
|
-
onFocus: ke,
|
|
194
|
-
onBlur: Ae,
|
|
195
|
-
children: Pe
|
|
196
|
-
}), R ? ce($, document.body) : $]
|
|
197
|
-
})
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
g.displayName = "VlTooltip";
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region components/Tooltip/index.ts
|
|
203
|
-
var _ = g, v = g;
|
|
204
|
-
//#endregion
|
|
205
|
-
export { _ as n, v as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./state-BuUx1onZ.cjs"),t=require("./client-BkoqeUs3.cjs"),n=require("./refs-DCqd87V8.cjs"),r=require("./number-B7qJF_ZY.cjs"),i=require("./floating-5PRFyI8D.cjs"),a=require("./id-CF0zOP1G.cjs"),o=require("./layer-DL1xVbJT.cjs"),s=require("./Transition-X_89ga-e.cjs"),c=require("./focus-D-h8CbGr.cjs");let l=require("react"),u=require("react/jsx-runtime"),ee=require("react-dom");var d=(0,l.forwardRef)((d,f)=>{let{content:p,placement:m=`top`,trigger:h=`hover`,disabled:g=!1,offset:_=8,showDelay:v=100,hideDelay:y=100,showArrow:te=!0,maxWidth:b=300,zIndex:ne,open:re,defaultOpen:ie=!1,className:x,children:S,onChange:ae,onShow:C,onHide:w,...oe}=d,T=(0,l.useRef)(null),E=(0,l.useRef)(null),D=(0,l.useRef)(null),O=(0,l.useRef)(null),k=(0,l.useRef)(!1),A=(0,l.useRef)(!1),j=(0,l.useRef)(!1),M=(0,l.useRef)(null),N=(0,l.useRef)(null),se=(0,l.useMemo)(()=>n.n(T,f),[f]),P=t.t(),F=o.a({defaultZIndex:o.r.tooltip,zIndex:ne}),ce=e.t(d,`open`),[I,L]=e.n({value:!!re,defaultValue:ie,controlled:ce,onChange:ae}),R=!g&&p!=null,z=R&&I,B=a.t(`vl-tooltip-popup`),[le,V]=(0,l.useState)(m),[H,U]=(0,l.useState)({}),[ue,W]=(0,l.useState)({}),de=(0,l.useMemo)(()=>[`vl-tooltip`,g?`is-disabled`:``,x||``].filter(Boolean).join(` `),[g,x]),fe=`vl-tooltip__popup is-${le}`,G=(0,l.useCallback)(()=>{M.current!==null&&window.clearTimeout(M.current),N.current!==null&&window.clearTimeout(N.current),M.current=null,N.current=null},[]),K=(0,l.useCallback)(()=>{let e=O.current;if(e?.isConnected){e.focus();return}E.current?.querySelector(c.i)?.focus()},[]),q=(0,l.useCallback)((e,t=!1)=>{if(!(e&&!R)){if(I===e){t&&K();return}L(e),e?C?.():(w?.(),t&&window.requestAnimationFrame(K))}},[R,I,L,C,w,K]),J=(0,l.useCallback)(()=>{if(G(),R){if(v<=0){q(!0);return}M.current=window.setTimeout(()=>q(!0),v)}},[G,R,v,q]),Y=(0,l.useCallback)(()=>{if(G(),y<=0){q(!1);return}N.current=window.setTimeout(()=>q(!1),y)},[G,y,q]),X=(0,l.useCallback)(()=>{k.current||A.current||j.current||Y()},[Y]),Z=(0,l.useCallback)(()=>{if(!z)return;let e=E.current,t=D.current;if(!e||!t)return;let n=e.getBoundingClientRect(),a=t.getBoundingClientRect(),{placement:o,x:s,y:c}=i.n({anchorRect:n,floatingRect:a,placement:m,offset:_,edgePadding:8});if(V(o),U({left:`${Math.round(s)}px`,top:`${Math.round(c)}px`}),o.startsWith(`top`)||o.startsWith(`bottom`)){let e=n.left+n.width/2-s;W({left:`${Math.round(r.t(e,10,Math.max(10,a.width-10)))}px`,top:void 0})}else{let e=n.top+n.height/2-c;W({left:void 0,top:`${Math.round(r.t(e,10,Math.max(10,a.height-10)))}px`})}},[z,m,_]),pe=()=>{h===`hover`&&(k.current=!0,J())},me=()=>{h===`hover`&&(k.current=!1,X())},Q=()=>{h===`hover`&&(A.current=!0,G())},he=()=>{h===`hover`&&(A.current=!1,X())},ge=e=>{if(h!==`click`)return;let t=e.target;t.matches(`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`)&&(O.current=t),q(!z)},_e=e=>{let t=e.target;t.matches(`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`)&&(O.current=t),j.current=!0,(h===`hover`||h===`focus`)&&J()},ve=e=>{e.currentTarget.contains(e.relatedTarget)||(j.current=!1,h===`hover`?X():h===`focus`&&Y())};(0,l.useEffect)(()=>{if(!z||!P)return;let e=window.requestAnimationFrame(()=>{Z(),window.requestAnimationFrame(Z)});return()=>window.cancelAnimationFrame(e)},[z,P,Z]),(0,l.useEffect)(()=>{R||!I||q(!1)},[R,I,q]);let ye=(0,l.useCallback)(()=>q(!1),[q]),be=(0,l.useCallback)(()=>q(!1,!0),[q]);i.r({active:z&&P,rootRef:T,floatingRef:D,closeOnOutsideClick:h===`click`,onOutsideClick:ye,onEscape:be,onViewportChange:Z}),(0,l.useEffect)(()=>()=>G(),[G]);let xe=[(0,l.isValidElement)(S)?S.props[`aria-describedby`]:void 0,B].filter(Boolean).join(` `),Se=(0,l.isValidElement)(S)&&S.type!==l.Fragment?(0,l.cloneElement)(S,{"aria-describedby":xe}):S,Ce={...H,zIndex:F.zIndex,maxWidth:typeof b==`number`?`${b}px`:b},$=(0,u.jsx)(s.t,{show:z,name:`vl-tooltip`,unmountOnExit:!1,deferEffects:!P,children:(0,u.jsxs)(`div`,{ref:D,id:B,className:fe,style:Ce,role:`tooltip`,"aria-hidden":!z||void 0,onMouseEnter:Q,onMouseLeave:he,children:[te?(0,u.jsx)(`span`,{className:`vl-tooltip__arrow`,style:ue,"aria-hidden":`true`}):null,(0,u.jsx)(`div`,{className:`vl-tooltip__content`,children:p})]})});return(0,u.jsx)(o.t,{layer:F.layer,children:(0,u.jsxs)(`div`,{ref:se,className:de,...oe,children:[(0,u.jsx)(`div`,{ref:E,className:`vl-tooltip__trigger`,"aria-describedby":(0,l.isValidElement)(S)?void 0:B,onMouseEnter:pe,onMouseLeave:me,onClick:ge,onFocus:_e,onBlur:ve,children:Se}),P?(0,ee.createPortal)($,document.body):$]})})});d.displayName=`VlTooltip`;var f=d,p=d;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./effect-BpNxm_06.cjs"),t=require("./state-BuUx1onZ.cjs"),n=require("./client-BkoqeUs3.cjs"),r=require("./refs-DCqd87V8.cjs"),i=require("./floating-5PRFyI8D.cjs"),a=require("./id-CF0zOP1G.cjs"),o=require("./layer-DL1xVbJT.cjs"),s=require("./Transition-X_89ga-e.cjs"),c=require("./Input-C9ESmbJ7.cjs"),l=require("./time-wheel-BaCcA9nk.cjs"),ee=require("./Dropdown-DPY4QNdT.cjs");let u=require("lucide-react"),d=require("react"),f=require("react/jsx-runtime"),te=require("react-dom");var p=`data-vl-date-picker-popup-owner`,ne=[`日`,`一`,`二`,`三`,`四`,`五`,`六`],m=[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],h=e=>Array.isArray(e)&&e.length===2,g=(e,t)=>l.b(e,t),re=(e,t)=>{if(h(e)){let n=g(e[0],t),r=g(e[1],t);return n&&r?`${l.d(n,t)} ~ ${l.d(r,t)}`:``}let n=g(e,t);return n?l.d(n,t):``},ie=e=>[e[0]?l.l(e[0]):null,e[1]?l.l(e[1]):null],ae=e=>`${e.getFullYear()}年 ${m[e.getMonth()]}`,oe=(e,t)=>t?l.l(e):l.g(e),se=(e,t,n)=>{let r=e=>{let t=g(e,n);return t?t.getTime():null};return h(e)||h(t)?!h(e)||!h(t)?!1:r(e[0])===r(t[0])&&r(e[1])===r(t[1]):r(e)===r(t)},_=(0,d.forwardRef)((m,_)=>{let{componentName:v,withTime:y=!1,value:ce,defaultValue:le,valueType:ue=`date`,format:b=y?`YYYY-MM-DD HH:mm:ss`:`YYYY-MM-DD`,range:x=!1,shortcuts:de=[],minDate:fe,maxDate:pe,disabledDate:me,minTime:he,maxTime:ge,disabledTime:_e,placeholder:ve=x?`请选择日期范围`:y?`请选择日期时间`:`请选择日期`,disabled:S=!1,clearable:ye=!1,size:be=`md`,placement:C=`bottom-start`,offset:xe=8,zIndex:Se,className:Ce,style:we,id:Te,"aria-label":Ee,"aria-labelledby":De,"aria-describedby":Oe,onChange:ke,onClear:Ae,onOpen:je,onClose:Me,...Ne}=m,w=ke,Pe=(0,d.useRef)(null),T=(0,d.useRef)(null),E=(0,d.useRef)(null),Fe=(0,d.useRef)(null),D=n.t(),Ie=o.a({defaultZIndex:o.r.popover,zIndex:Se}),Le=t.t(m,`value`),[O,k]=t.n({value:ce??null,defaultValue:le??null,controlled:Le}),[A,Re]=(0,d.useState)(!1),[ze,j]=(0,d.useState)(()=>{let e=h(O)?g(O[0],b):g(O,b);return l._(e??new Date)}),[M,Be]=(0,d.useState)(null),[N,P]=(0,d.useState)([null,null]),[Ve,F]=(0,d.useState)(null),[I,L]=(0,d.useState)(`start`),[He,Ue]=(0,d.useState)(!1),[R,We]=(0,d.useState)(null),[Ge,Ke]=(0,d.useState)({}),[qe,Je]=(0,d.useState)(C),[Ye,Xe]=(0,d.useState)(!1),[Ze,z]=(0,d.useState)(null),Qe=a.t(`vl-${v}-control`,Te),B=a.t(`vl-${v}-panel`),$e=(0,d.useMemo)(()=>r.n(Pe,_),[_]),V=(0,d.useCallback)(()=>{Ue(!1),We(null)},[]),et=(0,d.useMemo)(()=>x?h(O)?[g(O[0],b),g(O[1],b)]:[null,null]:Array.isArray(O)?null:g(O,b),[b,x,O]),H=x?et:null,U=x?null:et,tt=re(O,b),nt=ze,rt=l.c(ze,1),W=g(fe,b),G=g(pe,b),it=he?l.y(he):null,at=ge?l.y(ge):null,K=(0,d.useMemo)(()=>({minSeconds:it,maxSeconds:at,disabledTime:_e}),[_e,at,it]),q=(0,d.useCallback)(e=>{let t=l.g(e);return!!(W&&l.u(t,l.g(W))<0||G&&l.u(t,l.g(G))>0||me?.(t))},[me,G,W]),J=(0,d.useCallback)(e=>l.i(e,K),[K]),ot=(0,d.useCallback)((e,t,n)=>l.n(e,t,n,K),[K]),st=(0,d.useCallback)(e=>y&&J(l.d(e,`HH:mm:ss`)),[J,y]),Y=(0,d.useCallback)(e=>{if(!(e&&(S||A))&&!(!e&&!A)){if(e){let e=(x?H?.[0]:U)??new Date;j(l._(e)),x?P(ie(H??[null,null])):Be(U?l.l(U):null),F(null),L(`start`),Xe(!1),Ke({}),Je(C),z(null),V(),Re(!0),je?.()}else z(null),F(null),V(),Re(!1),Me?.()}},[S,Me,je,A,C,x,V,U,H]),ct=(0,d.useCallback)(()=>{if(!A||!T.current||!E.current)return;let e=T.current.getBoundingClientRect(),t=i.t({anchorRect:e,floatingRect:E.current.getBoundingClientRect(),placement:C,offset:xe});Je(t.placement),Ke({left:`${Math.round(t.x)}px`,top:`${Math.round(t.y)}px`}),Xe(!0)},[xe,A,C]);e.t(()=>{if(!A||!D)return;ct();let e=window.requestAnimationFrame(ct);return()=>window.cancelAnimationFrame(e)},[D,A,ct]),e.t(()=>{if(!A||!Ze)return;let e=E.current?.querySelector(`[data-time="${Ze.getTime()}"]:not(:disabled)`);e&&(e.focus(),z(null))},[ze,Ze,A]);let lt=(0,d.useCallback)(e=>e.some(e=>e instanceof HTMLElement&&(e.getAttribute(p)===B||e.classList.contains(`vl-dropdown__panel`)&&e.querySelector(`[${p}]`)?.getAttribute(p)===B)),[B]),ut=(0,d.useCallback)(()=>Y(!1),[Y]),dt=(0,d.useCallback)(()=>{He||(Y(!1),T.current?.focus())},[Y,He]);i.r({active:A,rootRef:Pe,floatingRef:E,isOwnedPopup:lt,onOutsideClick:ut,onEscape:dt,onViewportChange:ct}),(0,d.useEffect)(()=>{S&&A&&Y(!1)},[S,A,Y]);let X=(0,d.useCallback)(e=>ue===`string`?l.d(e,b):l.l(e),[b,ue]),ft=(0,d.useCallback)(e=>{let t=oe(e,y);if(q(t)||y&&J(l.d(t,`HH:mm:ss`)))return;let n=X(t);se(O,n,b)||(k(n),w?.(n)),Y(!1),T.current?.focus()},[w,b,q,J,X,O,Y,k,y]),pt=(0,d.useCallback)(e=>{if(!e[0]||!e[1])return;let t=l.u(e[0],e[1])<=0?e:[e[1],e[0]],n=oe(t[0],y),r=oe(t[1],y);if(q(n)||q(r)||y&&(J(l.d(n,`HH:mm:ss`))||J(l.d(r,`HH:mm:ss`))))return;let i=[X(n),X(r)];se(O,i,b)||(k(i),w?.(i)),Y(!1),T.current?.focus()},[w,b,q,J,X,O,Y,k,y]),mt=e=>{if(q(e))return;F(null);let t=x?N[I===`start`?0:1]:M,n=l.g(e);if(y){if(t)n=l.h(e,t.getHours(),t.getMinutes(),t.getSeconds());else{let t=ot(0,86399,0);n=t===null?l.l(e):l.h(e,Math.floor(t/3600),Math.floor(t%3600/60),t%60)}}if(!x){Be(n),y||ft(n);return}let[r,i]=N;if(!r||i){P([n,null]),L(`start`);return}l.u(n,r)<0?(P([n,r]),L(`end`)):(P([r,n]),L(`end`))},ht=e=>{if(!x||!e||N[1]||q(e)){F(null);return}F(l.g(e))},Z=(0,d.useCallback)((e,t=!1)=>{if(e&&R){if(x){let e=ie(N);e[I===`start`?0:1]=l.l(R),P(e)}else Be(l.l(R))}V(),t&&window.requestAnimationFrame(()=>Fe.current?.focus())},[I,N,x,V,R]),gt=(e,t)=>{let n=R?l.l(R):new Date,r={hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds()},{start:i,end:a,preferred:o}=l.r(e,t,r),s=ot(i,a,o);if(s===null)return;let c=l.h(n,Math.floor(s/3600),Math.floor(s%3600/60),s%60);We(c)},_t=e=>{let t=e.getValue(new Date);if(t===null)return;if(x){if(!h(t))return;let e=g(t[0],b),n=g(t[1],b);if(!e||!n||q(e)||q(n)||st(e)||st(n))return;P(l.u(e,n)<=0?[e,n]:[n,e]),L(`end`);return}if(h(t))return;let n=g(t,b);!n||q(n)||st(n)||ft(n)},vt=e=>{e?.stopPropagation(),!S&&(k(null),w?.(null),Ae?.(),Be(null),P([null,null]))},Q=(e,t,n=!1)=>{let r=n?l.g(e):l.s(l.g(e),t);for(let e=0;e<3660;e+=1){if(t<0&&W&&l.u(r,l.g(W))<0||t>0&&G&&l.u(r,l.g(G))>0)return null;if(!q(r))return r;r=l.s(r,t)}return null},yt=e=>{if(!S){if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),A)Y(!1);else{let e=(x?H?.[0]:U)??new Date,t=Q(e,1,!0)??Q(e,-1,!0)??null;Y(!0),t&&z(t)}}else e.key===`Escape`&&A&&(e.preventDefault(),Y(!1))}},bt=e=>{!l.m(e,nt)&&!(x&&l.m(e,rt))&&j(l._(e)),z(l.g(e))},xt=(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`?l.s(t,-t.getDay()):l.s(t,6-t.getDay()),i=e.key===`Home`?1:-1;for(let e=0;e<7;e+=1){let t=l.s(r,e*i);if(!q(t)){n=t;break}}}n&&(e.preventDefault(),bt(n))},$=x?N[I===`start`?0:1]:M,St=(0,d.useCallback)(e=>{if(e){if(!$)return;We(l.l($)),Ue(!0);return}Z(!1)},[$,Z]),Ct=R??$??new Date,wt=Ct.getHours(),Tt=Ct.getMinutes(),Et=Ct.getSeconds(),Dt=$?l.d(Ct,`HH:mm:ss`):``,Ot=x?I===`start`?`开始时间`:`结束时间`:`时间`,kt=(0,d.useCallback)((e,t)=>l.a(e,t,{hours:wt,minutes:Tt,seconds:Et},ot),[ot,wt,Tt,Et]),At=x?!!(N[0]&&N[1]&&!q(N[0])&&!q(N[1])&&(!y||!J(l.d(N[0],`HH:mm:ss`))&&!J(l.d(N[1],`HH:mm:ss`)))):!!(M&&!q(M)&&(!y||!J(l.d(M,`HH:mm:ss`)))),jt=!!tt,Mt=[`vl-${v}`,`size-${be}`,A?`is-open`:``,S?`is-disabled`:``,x?`is-range`:``,y?`has-time`:``,Ce||``].filter(Boolean).join(` `),Nt=e=>{let t=l.f(e),n=x?N[0]:null,r=x?N[1]:null,i=x&&n&&!r?Ve:null,a=r??i,o=n&&a&&l.u(n,a)<=0?n:a,s=n&&a&&l.u(n,a)<=0?a:n,c=x?null:M??U,ee=(x?[N[0],N[1]]:[c]).find(t=>t&&l.m(t,e)&&!q(t))??t.find(t=>l.m(t,e)&&!q(t));return(0,f.jsxs)(`section`,{className:`vl-${v}__calendar`,"aria-label":ae(e),children:[x?(0,f.jsx)(`div`,{className:`vl-${v}__month-title`,children:ae(e)}):null,(0,f.jsx)(`div`,{className:`vl-${v}__weekdays`,role:`row`,children:ne.map(e=>(0,f.jsx)(`span`,{role:`columnheader`,children:e},e))}),(0,f.jsx)(`div`,{className:`vl-${v}__grid`,role:`grid`,onMouseLeave:()=>F(null),onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||F(null)},children:t.map(t=>{let a=!l.m(t,e),u=a||q(t),d=!!(n&&r&&l.u(t,l.g(n))>=0&&l.u(t,l.g(r))<=0),te=!!(n&&i&&o&&s&&l.u(t,l.g(o))>=0&&l.u(t,l.g(s))<=0),p=d||te,ne=!!(o&&p&&l.p(t,o)),m=!!(s&&p&&l.p(t,s)),h=!!(i&&l.p(t,i)),g=[`vl-${v}__day`,a?`is-other-month`:``,l.p(t,new Date)?`is-today`:``,x&&n&&l.p(t,n)?`is-range-start is-selected`:``,x&&r&&l.p(t,r)?`is-range-end is-selected`:``,c&&l.p(t,c)?`is-selected`:``,p?`is-in-range`:``,ne?`is-range-edge-start`:``,m?`is-range-edge-end`:``,h?`is-range-preview-end`:``,u?`is-disabled`:``].filter(Boolean).join(` `);return(0,f.jsx)(`button`,{type:`button`,className:g,role:`gridcell`,"data-time":t.getTime(),"aria-label":`${t.getFullYear()}年${t.getMonth()+1}月${t.getDate()}日`,"aria-selected":x?d:!!(c&&l.p(t,c)),"aria-current":l.p(t,new Date)?`date`:void 0,"aria-hidden":a||void 0,"aria-disabled":u||void 0,disabled:u,tabIndex:!u&&ee&&l.p(t,ee)?0:-1,onClick:()=>mt(t),onKeyDown:e=>xt(e,t),onMouseEnter:()=>ht(t),onFocus:()=>ht(t),children:(0,f.jsx)(`span`,{className:`vl-${v}__day-content`,children:t.getDate()})},t.toISOString())})})]})},Pt=(0,f.jsx)(s.t,{show:A,name:`vl-${v}`,deferEffects:!D,children:(0,f.jsxs)(`div`,{ref:E,id:B,className:`vl-${v}__panel is-${qe}${Ye?` is-positioned`:``}`,style:{...Ge,zIndex:Ie.zIndex,visibility:Ye?`visible`:`hidden`},role:`dialog`,"aria-label":x?`日期范围选择`:y?`日期时间选择`:`日期选择`,children:[(0,f.jsxs)(`div`,{className:`vl-${v}__header`,children:[(0,f.jsxs)(`div`,{className:`vl-${v}__header-actions`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":`上一年`,onClick:()=>j(e=>l.c(e,-12)),children:(0,f.jsx)(u.ChevronsLeft,{size:16,"aria-hidden":`true`})}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`上一个月`,onClick:()=>j(e=>l.c(e,-1)),children:(0,f.jsx)(u.ChevronLeft,{size:16,"aria-hidden":`true`})})]}),x?null:(0,f.jsx)(`span`,{children:ae(nt)}),(0,f.jsxs)(`div`,{className:`vl-${v}__header-actions`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":`下一个月`,onClick:()=>j(e=>l.c(e,1)),children:(0,f.jsx)(u.ChevronRight,{size:16,"aria-hidden":`true`})}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`下一年`,onClick:()=>j(e=>l.c(e,12)),children:(0,f.jsx)(u.ChevronsRight,{size:16,"aria-hidden":`true`})})]})]}),(0,f.jsxs)(`div`,{className:`vl-${v}__calendars`,children:[Nt(nt),x?Nt(rt):null]}),y?(0,f.jsx)(`div`,{className:`vl-${v}__time`,children:(0,f.jsxs)(`div`,{className:`vl-${v}__time-toolbar`,children:[(0,f.jsx)(`span`,{className:`vl-${v}__time-title`,children:`时间`}),x?(0,f.jsxs)(`div`,{className:`vl-${v}__time-range`,children:[(0,f.jsx)(`button`,{type:`button`,className:I===`start`?`is-active`:``,"aria-pressed":I===`start`,disabled:!N[0],onClick:()=>{Z(!1),L(`start`)},children:`开始时间`}),(0,f.jsx)(`button`,{type:`button`,className:I===`end`?`is-active`:``,"aria-pressed":I===`end`,disabled:!N[1],onClick:()=>{Z(!1),L(`end`)},children:`结束时间`})]}):null,(0,f.jsx)(ee.t,{className:`vl-${v}__time-dropdown`,open:He,disabled:!$,trigger:`click`,placement:`bottom-end`,offset:4,closeOnContentClick:!1,"aria-label":Ot,menuLabel:`${Ot}选择器`,triggerContent:(0,f.jsx)(c.t,{ref:Fe,className:`vl-${v}__time-input`,value:Dt,placeholder:`请先选择日期`,size:`sm`,suffixIcon:u.Clock3,readOnly:!0,disabled:!$}),onChange:St,children:(0,f.jsxs)(`div`,{className:`vl-${v}__time-popover`,[p]:B,children:[(0,f.jsx)(l.t,{value:{hours:wt,minutes:Tt,seconds:Et},disabled:!$,ariaLabel:Ot,visibleItemCount:3,itemHeight:30,isOptionDisabled:kt,onChange:gt}),(0,f.jsxs)(`div`,{className:`vl-${v}__footer`,children:[(0,f.jsx)(`button`,{type:`button`,className:`is-cancel`,"aria-label":`取消时间`,onClick:()=>Z(!1,!0),children:`取消`}),(0,f.jsx)(`button`,{type:`button`,className:`is-confirm`,"aria-label":`确定时间`,disabled:!R,onClick:()=>Z(!0,!0),children:`确定`})]})]})})]})}):null,de.length?(0,f.jsx)(`div`,{className:`vl-${v}__shortcuts`,role:`group`,"aria-label":`快捷选择`,children:de.map(e=>(0,f.jsx)(`button`,{type:`button`,onClick:()=>_t(e),children:e.label},e.label))}):null,x||y?(0,f.jsxs)(`div`,{className:`vl-${v}__footer`,children:[(0,f.jsx)(`button`,{type:`button`,className:`is-cancel`,onClick:()=>{Y(!1),T.current?.focus()},children:`取消`}),(0,f.jsx)(`button`,{type:`button`,className:`is-confirm`,disabled:!At,onClick:()=>{x?pt(N):M&&ft(M)},children:`确定`})]}):null]})});return(0,f.jsx)(o.t,{layer:Ie.layer,children:(0,f.jsxs)(`div`,{ref:$e,className:`vl-${v}-wrapper`,style:we,...Ne,children:[(0,f.jsxs)(`div`,{ref:T,id:Qe,className:Mt,role:`combobox`,"aria-expanded":A,"aria-controls":B,"aria-haspopup":`dialog`,"aria-disabled":S||void 0,"aria-label":Ee??(De?void 0:ve),"aria-labelledby":De,"aria-describedby":Oe,tabIndex:S?-1:0,onClick:()=>Y(!A),onKeyDown:yt,children:[(0,f.jsx)(`span`,{className:`vl-${v}__icon`,"aria-hidden":`true`,children:(0,f.jsx)(u.CalendarDays,{size:16})}),(0,f.jsx)(`span`,{className:`vl-${v}__value${tt?``:` is-placeholder`}`,children:tt||ve}),ye&&jt&&!S?(0,f.jsx)(`button`,{type:`button`,className:`vl-${v}__clear`,"aria-label":`清除已选`,onClick:vt,onMouseDown:e=>e.preventDefault(),children:(0,f.jsx)(u.X,{size:16,"aria-hidden":`true`})}):null]}),D?(0,te.createPortal)(Pt,document.body):Pt]})})});_.displayName=`VlDatePickerCore`,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
|