@vavt/react-ui 1.0.0 → 1.0.2
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 +50 -2
- package/dist/Card-BkZhLXQ5.cjs +1 -0
- package/dist/{Card-DlztNV-6.js → Card-DCLfLn1x.js} +13 -12
- package/dist/Cron-3D9GmlYf.cjs +1 -0
- package/dist/{Cron-Di7k2FTL.js → Cron-Go4yIqrd.js} +361 -353
- package/dist/{DatePicker-M-MwejjV.js → DatePicker-B-F5q_s_.js} +1 -1
- package/dist/{DatePicker-DAxv2h-d.cjs → DatePicker-CoHW85qm.cjs} +1 -1
- package/dist/{DateTimePicker-BcT3FtN-.js → DateTimePicker-BSBZZ7xV.js} +1 -1
- package/dist/{DateTimePicker-B3C3v99L.cjs → DateTimePicker-CAkdoY--.cjs} +1 -1
- package/dist/Divider-BXNZyvHY.js +48 -0
- package/dist/Divider-BnmUNmy2.cjs +1 -0
- package/dist/Drawer-C0toQ-fQ.js +112 -0
- package/dist/Drawer-D45miZ27.cjs +1 -0
- package/dist/Dropdown-BsXYVdt6.cjs +1 -0
- package/dist/Dropdown-DljKFnvO.js +319 -0
- package/dist/Empty-Dny96c3p.cjs +1 -0
- package/dist/Empty-MmxZitR8.js +40 -0
- package/dist/{MessageBox-CrIifoig.js → MessageBox-B4Qo1vs2.js} +1 -1
- package/dist/{MessageBox-Ddn-R2MS.cjs → MessageBox-CTJfdU29.cjs} +1 -1
- package/dist/Modal-i_Do8GsG.cjs +1 -0
- package/dist/Modal-otJ_9ldu.js +210 -0
- package/dist/{Pagination-B7a9v6BU.js → Pagination-CSI5IzQB.js} +32 -33
- package/dist/Pagination-ODU-i3gn.cjs +1 -0
- package/dist/Select-BRKxpX-_.cjs +1 -0
- package/dist/Select-QedbJ4pD.js +468 -0
- package/dist/{Table-C8cSyts5.js → Table-B9NTkptC.js} +1 -1
- package/dist/{Table-JoJ9vpu-.cjs → Table-Bqjey5fw.cjs} +1 -1
- package/dist/TimePicker-CHZsr_jj.js +207 -0
- package/dist/TimePicker-Cpmvn8tx.cjs +1 -0
- package/dist/Tooltip-Buk5F9f_.js +205 -0
- package/dist/Tooltip-CP8rpNYG.cjs +1 -0
- package/dist/Upload-DZC_bt6G.js +183 -0
- package/dist/Upload-bxJz2avf.cjs +1 -0
- package/dist/base.css +1 -1
- package/dist/cjs/Card.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/Divider.cjs +1 -1
- package/dist/cjs/Drawer.cjs +1 -1
- package/dist/cjs/Dropdown.cjs +1 -1
- package/dist/cjs/Empty.cjs +1 -0
- package/dist/cjs/MessageBox.cjs +1 -1
- package/dist/cjs/Modal.cjs +1 -1
- package/dist/cjs/Pagination.cjs +1 -1
- package/dist/cjs/Select.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/Upload.cjs +1 -0
- package/dist/cjs/global.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/register.cjs +1 -1
- package/dist/content-DCGQZQp8.cjs +1 -0
- package/dist/content-Dllrr-7G.js +11 -0
- package/dist/css/Button.css +1 -1
- package/dist/css/DateTimePicker.css +1 -1
- package/dist/css/Empty.css +1 -0
- package/dist/css/Pagination.css +1 -1
- package/dist/css/Upload.css +1 -0
- package/dist/date-picker-BsiNrLZC.js +592 -0
- package/dist/date-picker-DNN0BiRA.cjs +1 -0
- package/dist/es/Card.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/Divider.mjs +1 -1
- package/dist/es/Drawer.mjs +1 -1
- package/dist/es/Dropdown.mjs +1 -1
- package/dist/es/Empty.mjs +3 -0
- package/dist/es/MessageBox.mjs +1 -1
- package/dist/es/Modal.mjs +1 -1
- package/dist/es/Pagination.mjs +1 -1
- package/dist/es/Select.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/Upload.mjs +3 -0
- package/dist/es/global.mjs +1 -1
- package/dist/es/index.mjs +31 -29
- package/dist/es/register.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/layer-BgiUZy_t.cjs +1 -0
- package/dist/layer-DDm97-sb.js +53 -0
- package/dist/registry-BGNWNSiC.cjs +1 -0
- package/dist/registry-q6UdMOyj.js +83 -0
- package/dist/style/Empty.cjs +7 -0
- package/dist/style/Empty.mjs +7 -0
- package/dist/style/Pagination.cjs +1 -0
- package/dist/style/Pagination.mjs +1 -0
- package/dist/style/Upload.cjs +7 -0
- package/dist/style/Upload.mjs +7 -0
- package/dist/types/Cron/type.d.cts +2 -0
- package/dist/types/Cron/type.d.ts +2 -0
- package/dist/types/DatePicker/type.d.cts +2 -0
- package/dist/types/DatePicker/type.d.ts +2 -0
- package/dist/types/Dropdown/type.d.cts +2 -0
- package/dist/types/Dropdown/type.d.ts +2 -0
- package/dist/types/Empty/Empty.d.cts +3 -0
- package/dist/types/Empty/Empty.d.ts +3 -0
- package/dist/types/Empty/index.d.cts +5 -0
- package/dist/types/Empty/index.d.ts +5 -0
- package/dist/types/Empty/type.d.cts +24 -0
- package/dist/types/Empty/type.d.ts +24 -0
- package/dist/types/Select/type.d.cts +2 -0
- package/dist/types/Select/type.d.ts +2 -0
- package/dist/types/TimePicker/type.d.cts +2 -0
- package/dist/types/TimePicker/type.d.ts +2 -0
- package/dist/types/Tooltip/type.d.cts +2 -0
- package/dist/types/Tooltip/type.d.ts +2 -0
- package/dist/types/Upload/Upload.d.cts +3 -0
- package/dist/types/Upload/Upload.d.ts +3 -0
- package/dist/types/Upload/index.d.cts +5 -0
- package/dist/types/Upload/index.d.ts +5 -0
- package/dist/types/Upload/type.d.cts +62 -0
- package/dist/types/Upload/type.d.ts +62 -0
- package/dist/types/_shared/content.d.cts +13 -0
- package/dist/types/_shared/content.d.ts +13 -0
- package/dist/types/_shared/layer.d.cts +63 -0
- package/dist/types/_shared/layer.d.ts +63 -0
- package/dist/types/global.d.cts +4 -0
- package/dist/types/global.d.ts +4 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/registry.d.cts +2 -0
- package/dist/types/registry.d.ts +2 -0
- package/package.json +2 -4
- package/dist/Card-nILlh9c_.cjs +0 -1
- package/dist/Cron-CoO2Vnnm.cjs +0 -1
- package/dist/Divider-BfvQ6BVP.cjs +0 -1
- package/dist/Divider-vyftxh3F.js +0 -47
- package/dist/Drawer-D28QbyA3.js +0 -103
- package/dist/Drawer-OmMfdgKN.cjs +0 -1
- package/dist/Dropdown-CYx6RxVv.js +0 -311
- package/dist/Dropdown-swfND4yK.cjs +0 -1
- package/dist/Modal-B_VqN16m.js +0 -201
- package/dist/Modal-Dm48HmGu.cjs +0 -1
- package/dist/Pagination-mj-pO6ql.cjs +0 -1
- package/dist/Select-DQLup8Y-.cjs +0 -1
- package/dist/Select-DccM9YpB.js +0 -458
- package/dist/TimePicker-ClQCHa6M.js +0 -199
- package/dist/TimePicker-DNBo2Rn5.cjs +0 -1
- package/dist/Tooltip-CbPYYr6R.cjs +0 -1
- package/dist/Tooltip-Ds4Odm7K.js +0 -197
- package/dist/date-picker-DkRwNu2m.js +0 -584
- package/dist/date-picker-DyGLrw5H.cjs +0 -1
- package/dist/registry-CkiH1x-J.js +0 -79
- package/dist/registry-YCz7D-2R.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./date-picker-
|
|
1
|
+
const e=require("./date-picker-DNN0BiRA.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)((t,r)=>(0,n.jsx)(e.t,{...t,ref:r,componentName:`date-picker`}));r.displayName=`VlDatePicker`;var i=r,a=r;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./date-picker-
|
|
1
|
+
const e=require("./date-picker-DNN0BiRA.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)((t,r)=>(0,n.jsx)(e.t,{...t,ref:r,componentName:`date-time-picker`,withTime:!0}));r.displayName=`VlDateTimePicker`;var i=r,a=r;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { t as e } from "./content-Dllrr-7G.js";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
//#region components/Divider/Divider.tsx
|
|
5
|
+
var a = t((t, a) => {
|
|
6
|
+
let { direction: o = "horizontal", contentPosition: s = "center", dashed: c = !1, inset: l = !1, className: u, children: d, ...f } = t, p = e(d), m = [
|
|
7
|
+
"vl-divider",
|
|
8
|
+
`is-${o}`,
|
|
9
|
+
c ? "is-dashed" : "",
|
|
10
|
+
l ? "is-inset" : "",
|
|
11
|
+
p && o === "horizontal" ? `content-${s}` : "",
|
|
12
|
+
p ? "" : "is-empty",
|
|
13
|
+
u || ""
|
|
14
|
+
].filter(Boolean).join(" ");
|
|
15
|
+
return /* @__PURE__ */ r("div", {
|
|
16
|
+
ref: a,
|
|
17
|
+
className: m,
|
|
18
|
+
role: "separator",
|
|
19
|
+
"aria-orientation": o === "vertical" ? "vertical" : "horizontal",
|
|
20
|
+
...f,
|
|
21
|
+
children: o === "horizontal" ? /* @__PURE__ */ i(n, { children: [
|
|
22
|
+
/* @__PURE__ */ r("span", {
|
|
23
|
+
className: "vl-divider__line",
|
|
24
|
+
"aria-hidden": "true"
|
|
25
|
+
}),
|
|
26
|
+
p ? /* @__PURE__ */ r("span", {
|
|
27
|
+
className: "vl-divider__content",
|
|
28
|
+
children: d
|
|
29
|
+
}) : null,
|
|
30
|
+
/* @__PURE__ */ r("span", {
|
|
31
|
+
className: "vl-divider__line",
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
})
|
|
34
|
+
] }) : /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("span", {
|
|
35
|
+
className: "vl-divider__vertical",
|
|
36
|
+
"aria-hidden": "true"
|
|
37
|
+
}), p ? /* @__PURE__ */ r("span", {
|
|
38
|
+
className: "vl-divider__content",
|
|
39
|
+
children: d
|
|
40
|
+
}) : null] })
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
a.displayName = "VlDivider";
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region components/Divider/index.ts
|
|
46
|
+
var o = a, s = a;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { o as n, s as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./content-DCGQZQp8.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)((t,r)=>{let{direction:i=`horizontal`,contentPosition:a=`center`,dashed:o=!1,inset:s=!1,className:c,children:l,...u}=t,d=e.t(l),f=[`vl-divider`,`is-${i}`,o?`is-dashed`:``,s?`is-inset`:``,d&&i===`horizontal`?`content-${a}`:``,d?``:`is-empty`,c||``].filter(Boolean).join(` `);return(0,n.jsx)(`div`,{ref:r,className:f,role:`separator`,"aria-orientation":i===`vertical`?`vertical`:`horizontal`,...u,children:i===`horizontal`?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`span`,{className:`vl-divider__line`,"aria-hidden":`true`}),d?(0,n.jsx)(`span`,{className:`vl-divider__content`,children:l}):null,(0,n.jsx)(`span`,{className:`vl-divider__line`,"aria-hidden":`true`})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`span`,{className:`vl-divider__vertical`,"aria-hidden":`true`}),d?(0,n.jsx)(`span`,{className:`vl-divider__content`,children:l}):null]})})});r.displayName=`VlDivider`;var i=r,a=r;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { n as e, t } from "./state-oH-YwB7_.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 "./content-Dllrr-7G.js";
|
|
5
|
+
import { n as a } from "./number-BN2jHM6Z.js";
|
|
6
|
+
import { t as o } from "./id-CHixuHb7.js";
|
|
7
|
+
import { n as s, r as c, t as l } from "./layer-DDm97-sb.js";
|
|
8
|
+
import { r as u, t as ee } from "./dialog-shell-DehX3PNh.js";
|
|
9
|
+
import { X as te } from "lucide-react";
|
|
10
|
+
import { forwardRef as d, useCallback as f, useEffect as p, useMemo as ne, useRef as m } from "react";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
//#region components/Drawer/Drawer.tsx
|
|
13
|
+
var _ = d((d, _) => {
|
|
14
|
+
let { open: v, defaultOpen: y = !1, title: b, header: x, footer: S, placement: C = "right", width: w = 360, height: re = 320, mask: ie = !0, closeOnClickOverlay: ae = !0, closeOnPressEscape: oe = !0, showClose: T = !0, lockScroll: E = !0, destroyOnClose: D = !1, zIndex: O, className: k, style: A, children: j, onClick: M, onChange: N, onOpen: P, onClose: F, "aria-label": I, "aria-labelledby": L, "aria-describedby": R, ...z } = d, B = n(), V = typeof A?.zIndex == "number" ? A.zIndex : void 0, H = c({
|
|
15
|
+
defaultZIndex: s.modal,
|
|
16
|
+
zIndex: O ?? V,
|
|
17
|
+
withMask: !0
|
|
18
|
+
}), U = m(null), W = ne(() => r(U, _), [_]), G = m(!1), K = t(d, "open"), [q, J] = e({
|
|
19
|
+
value: !!v,
|
|
20
|
+
defaultValue: y,
|
|
21
|
+
controlled: K,
|
|
22
|
+
onChange: N
|
|
23
|
+
}), Y = f(() => J(!1), [J]), { isTopLayer: se } = u({
|
|
24
|
+
active: B && q,
|
|
25
|
+
containerRef: U,
|
|
26
|
+
closeOnPressEscape: oe,
|
|
27
|
+
lockScroll: E,
|
|
28
|
+
onRequestClose: Y
|
|
29
|
+
}), X = o("vl-drawer-title");
|
|
30
|
+
p(() => {
|
|
31
|
+
let e = G.current;
|
|
32
|
+
q && !e ? P?.() : !q && e && F?.(), G.current = q;
|
|
33
|
+
}, [
|
|
34
|
+
q,
|
|
35
|
+
P,
|
|
36
|
+
F
|
|
37
|
+
]);
|
|
38
|
+
let ce = () => {
|
|
39
|
+
ae && se() && Y();
|
|
40
|
+
}, le = (e) => {
|
|
41
|
+
e.stopPropagation(), M?.(e);
|
|
42
|
+
}, ue = [
|
|
43
|
+
"vl-drawer",
|
|
44
|
+
`is-${C}`,
|
|
45
|
+
k || ""
|
|
46
|
+
].filter(Boolean).join(" "), Z = { ...A };
|
|
47
|
+
H.zIndex !== void 0 && (Z.zIndex = H.zIndex), C === "left" || C === "right" ? (Z.width = a(w) ?? "360px", Z.height = "100vh") : (Z.height = a(re) ?? "320px", Z.width = "100vw");
|
|
48
|
+
let Q = x ?? (b ? /* @__PURE__ */ h("div", {
|
|
49
|
+
id: X,
|
|
50
|
+
className: "vl-drawer__title",
|
|
51
|
+
children: b
|
|
52
|
+
}) : null), $ = L ?? (!x && b ? X : void 0), de = I ?? ($ ? void 0 : typeof b == "string" ? b : "抽屉");
|
|
53
|
+
return /* @__PURE__ */ h(l, {
|
|
54
|
+
layer: H.layer,
|
|
55
|
+
children: /* @__PURE__ */ g(ee, {
|
|
56
|
+
clientReady: B,
|
|
57
|
+
open: q,
|
|
58
|
+
mask: ie,
|
|
59
|
+
destroyOnClose: D,
|
|
60
|
+
maskUnmountOnExit: D,
|
|
61
|
+
maskTransitionName: "vl-drawer-mask",
|
|
62
|
+
transitionName: `vl-drawer-${C}`,
|
|
63
|
+
maskClassName: "vl-drawer__mask",
|
|
64
|
+
panelClassName: ue,
|
|
65
|
+
panelStyle: Z,
|
|
66
|
+
maskStyle: H.maskZIndex === void 0 ? void 0 : { zIndex: H.maskZIndex },
|
|
67
|
+
panelRef: W,
|
|
68
|
+
role: "dialog",
|
|
69
|
+
ariaLabel: de,
|
|
70
|
+
ariaLabelledBy: $,
|
|
71
|
+
ariaDescribedBy: R,
|
|
72
|
+
onMaskClick: ce,
|
|
73
|
+
onPanelClick: le,
|
|
74
|
+
panelProps: z,
|
|
75
|
+
children: [
|
|
76
|
+
i(Q) || T ? /* @__PURE__ */ h("div", {
|
|
77
|
+
className: "vl-drawer__header",
|
|
78
|
+
children: /* @__PURE__ */ g("div", {
|
|
79
|
+
className: "vl-drawer__headerInner",
|
|
80
|
+
children: [/* @__PURE__ */ h("div", {
|
|
81
|
+
className: "vl-drawer__headerMain",
|
|
82
|
+
children: Q
|
|
83
|
+
}), T ? /* @__PURE__ */ h("button", {
|
|
84
|
+
type: "button",
|
|
85
|
+
className: "vl-drawer__close",
|
|
86
|
+
"aria-label": "关闭抽屉",
|
|
87
|
+
onClick: Y,
|
|
88
|
+
children: /* @__PURE__ */ h(te, {
|
|
89
|
+
size: 20,
|
|
90
|
+
"aria-hidden": "true"
|
|
91
|
+
})
|
|
92
|
+
}) : null]
|
|
93
|
+
})
|
|
94
|
+
}) : null,
|
|
95
|
+
/* @__PURE__ */ h("div", {
|
|
96
|
+
className: "vl-drawer__body",
|
|
97
|
+
children: j
|
|
98
|
+
}),
|
|
99
|
+
i(S) ? /* @__PURE__ */ h("div", {
|
|
100
|
+
className: "vl-drawer__footer",
|
|
101
|
+
children: S
|
|
102
|
+
}) : null
|
|
103
|
+
]
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
_.displayName = "VlDrawer";
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region components/Drawer/index.ts
|
|
110
|
+
var v = _, y = _;
|
|
111
|
+
//#endregion
|
|
112
|
+
export { v as n, y as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./state-ZBA75xZ_.cjs"),t=require("./client-BkoqeUs3.cjs"),n=require("./refs-DCqd87V8.cjs"),r=require("./content-DCGQZQp8.cjs"),i=require("./number-B7qJF_ZY.cjs"),ee=require("./id-CF0zOP1G.cjs"),a=require("./layer-BgiUZy_t.cjs"),o=require("./dialog-shell-DT1EoKQG.cjs");let s=require("lucide-react"),c=require("react"),l=require("react/jsx-runtime");var u=(0,c.forwardRef)((u,d)=>{let{open:f,defaultOpen:p=!1,title:m,header:h,footer:g,placement:_=`right`,width:v=360,height:y=320,mask:b=!0,closeOnClickOverlay:x=!0,closeOnPressEscape:S=!0,showClose:C=!0,lockScroll:w=!0,destroyOnClose:T=!1,zIndex:E,className:D,style:O,children:te,onClick:ne,onChange:k,onOpen:A,onClose:j,"aria-label":M,"aria-labelledby":N,"aria-describedby":P,...F}=u,I=t.t(),L=typeof O?.zIndex==`number`?O.zIndex:void 0,R=a.r({defaultZIndex:a.n.modal,zIndex:E??L,withMask:!0}),z=(0,c.useRef)(null),B=(0,c.useMemo)(()=>n.n(z,d),[d]),V=(0,c.useRef)(!1),H=e.t(u,`open`),[U,W]=e.n({value:!!f,defaultValue:p,controlled:H,onChange:k}),G=(0,c.useCallback)(()=>W(!1),[W]),{isTopLayer:K}=o.r({active:I&&U,containerRef:z,closeOnPressEscape:S,lockScroll:w,onRequestClose:G}),q=ee.t(`vl-drawer-title`);(0,c.useEffect)(()=>{let e=V.current;U&&!e?A?.():!U&&e&&j?.(),V.current=U},[U,A,j]);let J=()=>{x&&K()&&G()},Y=e=>{e.stopPropagation(),ne?.(e)},X=[`vl-drawer`,`is-${_}`,D||``].filter(Boolean).join(` `),Z={...O};R.zIndex!==void 0&&(Z.zIndex=R.zIndex),_===`left`||_===`right`?(Z.width=i.n(v)??`360px`,Z.height=`100vh`):(Z.height=i.n(y)??`320px`,Z.width=`100vw`);let Q=h??(m?(0,l.jsx)(`div`,{id:q,className:`vl-drawer__title`,children:m}):null),$=N??(!h&&m?q:void 0),re=M??($?void 0:typeof m==`string`?m:`抽屉`);return(0,l.jsx)(a.t,{layer:R.layer,children:(0,l.jsxs)(o.t,{clientReady:I,open:U,mask:b,destroyOnClose:T,maskUnmountOnExit:T,maskTransitionName:`vl-drawer-mask`,transitionName:`vl-drawer-${_}`,maskClassName:`vl-drawer__mask`,panelClassName:X,panelStyle:Z,maskStyle:R.maskZIndex===void 0?void 0:{zIndex:R.maskZIndex},panelRef:B,role:`dialog`,ariaLabel:re,ariaLabelledBy:$,ariaDescribedBy:P,onMaskClick:J,onPanelClick:Y,panelProps:F,children:[r.t(Q)||C?(0,l.jsx)(`div`,{className:`vl-drawer__header`,children:(0,l.jsxs)(`div`,{className:`vl-drawer__headerInner`,children:[(0,l.jsx)(`div`,{className:`vl-drawer__headerMain`,children:Q}),C?(0,l.jsx)(`button`,{type:`button`,className:`vl-drawer__close`,"aria-label":`关闭抽屉`,onClick:G,children:(0,l.jsx)(s.X,{size:20,"aria-hidden":`true`})}):null]})}):null,(0,l.jsx)(`div`,{className:`vl-drawer__body`,children:te}),r.t(g)?(0,l.jsx)(`div`,{className:`vl-drawer__footer`,children:g}):null]})})});u.displayName=`VlDrawer`;var d=u,f=u;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./icon-DRLyKu8p.cjs"),t=require("./effect-BpNxm_06.cjs"),n=require("./state-ZBA75xZ_.cjs"),r=require("./client-BkoqeUs3.cjs"),ee=require("./refs-DCqd87V8.cjs"),i=require("./floating-DXRnx48N.cjs"),te=require("./id-CF0zOP1G.cjs"),a=require("./layer-BgiUZy_t.cjs"),ne=require("./Transition-X_89ga-e.cjs"),re=require("./focus-D-h8CbGr.cjs");let o=require("react"),s=require("react/jsx-runtime"),ie=require("react-dom");var ae=[],c=e=>!!(e&&!e.disabled&&!e.divider),l=(0,o.forwardRef)((l,u)=>{let{open:oe,defaultOpen:se=!1,disabled:d=!1,placement:f=`bottom-start`,offset:p=8,zIndex:ce,closeOnContentClick:m=!0,trigger:h=`hover`,options:g=ae,closeOnOutsideClick:le=!0,triggerContent:_,menuLabel:ue=`菜单`,className:v,style:y,children:de,onChange:fe,onOpen:b,onClose:pe,onSelect:me,onCommand:he,"aria-label":ge,"aria-labelledby":_e,...ve}=l,ye=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)([]),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(null),D=(0,o.useRef)(null),be=(0,o.useMemo)(()=>ee.n(ye,u),[u]),O=r.t(),k=a.r({defaultZIndex:a.n.dropdown,zIndex:ce}),xe=n.t(l,`open`),[A,j]=n.n({value:!!oe,defaultValue:se,controlled:xe,onChange:fe}),M=A&&!d,[N,P]=(0,o.useState)(-1),[Se,F]=(0,o.useState)({}),[Ce,I]=(0,o.useState)(f),[L,R]=(0,o.useState)(!1),[z,B]=(0,o.useState)(M),[we,V]=(0,o.useState)(!1),H=te.t(`vl-dropdown-menu`),Te=(0,o.useCallback)(e=>`${H}-option-${e}`,[H]),U=(0,o.useMemo)(()=>g.flatMap((e,t)=>c(e)?[t]:[]),[g]),Ee=U.length>0,De=g.some(e=>!e.divider),W=U.includes(N)?N:U[0]??-1,Oe=(0,o.useMemo)(()=>[`vl-dropdown`,M?`is-open`:``,d?`is-disabled`:``,v||``].filter(Boolean).join(` `),[M,d,v]),ke=(0,o.useMemo)(()=>({"--vl-dropdown-offset":`${p}px`,...y}),[p,y]),G=(0,o.useCallback)(()=>{let e=w.current;if(e&&e.isConnected){e.focus();return}(x.current?.querySelector(re.i))?.focus()},[]),K=(0,o.useCallback)(()=>{let e=document.activeElement;if(e&&x.current?.contains(e)){w.current=e;return}w.current=x.current?.querySelector(`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`)??null},[]),q=(0,o.useCallback)((e,t=!1)=>{if(!(e&&d)){if(A===e){t&&G();return}e&&(K(),R(!1),F({}),I(f)),j(e),e?b?.():(pe?.(),t&&window.requestAnimationFrame(G))}},[d,A,f,G,K,j,b,pe]),J=(0,o.useCallback)(()=>{E.current!==null&&(window.clearTimeout(E.current),E.current=null)},[]),Y=(0,o.useCallback)(()=>{J(),E.current=window.setTimeout(()=>{let e=document.activeElement;e&&(x.current?.contains(e)||S.current?.contains(e))||q(!1)},160)},[J,q]),X=(0,o.useCallback)(e=>{c(g[e])&&(P(e),C.current[e]?.focus())},[g]),Z=(0,o.useCallback)(()=>{let e=U[0];e!==void 0&&X(e)},[U,X]),Q=(0,o.useCallback)(()=>{let e=U.at(-1);e!==void 0&&X(e)},[U,X]),Ae=(0,o.useCallback)(e=>{if(!U.length)return;let t=U.indexOf(N),n=t<0?e>0?0:U.length-1:(t+e+U.length)%U.length;X(U[n])},[U,N,X]),$=(0,o.useCallback)(()=>{if(!M)return;let e=S.current;if(!e)return;let t=T.current,n=t?{left:t.x,right:t.x,top:t.y,bottom:t.y,width:0,height:0}:x.current?.getBoundingClientRect();if(!n)return;let r=i.t({anchorRect:n,floatingRect:e.getBoundingClientRect(),placement:f,offset:p});I(r.placement),F({left:`${Math.round(r.x)}px`,top:`${Math.round(r.y)}px`}),R(!0)},[M,f,p]),je=e=>{d||h!==`click`||(e.stopPropagation(),T.current=null,q(!M))},Me=()=>{d||h!==`hover`||(T.current=null,J(),q(!0))},Ne=()=>{d||h!==`hover`||Y()},Pe=()=>{d||h!==`hover`||(T.current=null,J(),q(!0))},Fe=e=>{e.currentTarget.contains(e.relatedTarget)||h===`hover`&&Y()},Ie=e=>{d||h!==`context-menu`||(e.preventDefault(),e.stopPropagation(),T.current={x:e.clientX,y:e.clientY},q(!0))},Le=()=>{h===`hover`&&J()},Re=()=>{h===`hover`&&Y()},ze=()=>J(),Be=e=>{c(e)&&(e.onClick?.(e),me?.(e),he?.(e.value,e),m&&q(!1,!0))},Ve=()=>{g.length||!m||q(!1,!0)},He=e=>{if(!d){if(T.current=null,e.key===`Escape`&&M){e.preventDefault(),q(!1,!0);return}e.key===`ArrowDown`||e.key===`Enter`||e.key===` `?(e.preventDefault(),K(),M?Z():(D.current=`first`,q(!0))):e.key===`ArrowUp`&&(e.preventDefault(),K(),M?Q():(D.current=`last`,q(!0)))}},Ue=e=>{if(M){if(e.key===`Escape`){e.preventDefault(),q(!1,!0);return}if(e.key===`Tab`){q(!1);return}if(Ee){if(e.key===`ArrowDown`)e.preventDefault(),Ae(1);else if(e.key===`ArrowUp`)e.preventDefault(),Ae(-1);else if(e.key===`Home`)e.preventDefault(),Z();else if(e.key===`End`)e.preventDefault(),Q();else if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=g[N];t&&Be(t)}}}};(0,o.useEffect)(()=>{d&&A&&q(!1)},[d,A,q]),t.t(()=>{if(!O)return;if(!M){V(!1);return}if(!z){B(!0);return}$(),V(!0);let e=D.current;D.current=null;let t=window.requestAnimationFrame(()=>{$(),e===`first`?Z():e===`last`&&Q()});return()=>window.cancelAnimationFrame(t)},[M,O,z,Z,Q,$]);let We=(0,o.useCallback)(()=>{R(!1),F({}),I(f)},[f]),Ge=(0,o.useCallback)(()=>{M||(B(!1),We())},[M,We]),Ke=(0,o.useCallback)(()=>q(!1),[q]),qe=(0,o.useCallback)(()=>q(!1,!0),[q]);i.r({active:M&&O,rootRef:ye,floatingRef:S,closeOnOutsideClick:le&&h!==`hover`,ignoreEscapeInsideFloating:!0,onOutsideClick:Ke,onEscape:qe,onViewportChange:$}),(0,o.useEffect)(()=>()=>J(),[J]);let Je={"aria-haspopup":`menu`,"aria-expanded":M,"aria-controls":H,"aria-disabled":d||void 0,...ge?{"aria-label":ge}:{},..._e?{"aria-labelledby":_e}:{},tabIndex:d?-1:void 0},Ye=(0,o.isValidElement)(_)&&_.type!==o.Fragment?(0,o.cloneElement)(_,Je):(0,s.jsx)(`button`,{type:`button`,className:`vl-dropdown__defaultTrigger`,disabled:d,...Je,children:_??`Menu`}),Xe=[`vl-dropdown__panel`,`is-${Ce}`,L?`is-positioned`:``].filter(Boolean).join(` `),Ze=(0,s.jsx)(ne.t,{show:O?we:M,name:`vl-dropdown`,forceMount:O,deferEffects:!O,onAfterLeave:Ge,children:(0,s.jsx)(`div`,{ref:S,id:H,className:Xe,style:{...Se,zIndex:k.zIndex,visibility:O&&!L?`hidden`:`visible`},role:`menu`,"aria-label":ue,"aria-hidden":!M||void 0,onClick:Ve,onMouseEnter:Le,onMouseLeave:Re,onFocus:ze,onKeyDown:Ue,children:(0,s.jsx)(`div`,{className:`vl-dropdown__content`,children:De?g.map((t,n)=>t.divider?(0,s.jsx)(`div`,{className:`vl-dropdown__divider`,role:`separator`},`divider-${n}`):(0,s.jsxs)(`div`,{ref:e=>{C.current[n]=e},id:Te(n),className:[`vl-dropdown__option`,t.status?`is-${t.status}`:``,t.disabled?`is-disabled`:``,W===n?`is-active`:``].filter(Boolean).join(` `),role:`menuitem`,tabIndex:W===n&&!t.disabled?0:-1,"aria-disabled":t.disabled||void 0,onPointerDown:e=>e.preventDefault(),onMouseEnter:()=>{c(t)&&P(n)},onClick:e=>{e.stopPropagation(),Be(t)},children:[t.icon?e.t(t.icon,`vl-dropdown__option-icon`):null,(0,s.jsx)(`span`,{className:`vl-dropdown__option-label`,children:t.label??``})]},t.value??n)):de})})});return(0,s.jsx)(a.t,{layer:k.layer,children:(0,s.jsxs)(`div`,{ref:be,className:Oe,style:ke,...ve,onMouseEnter:Me,onMouseLeave:Ne,onFocus:Pe,onBlur:Fe,children:[(0,s.jsx)(`div`,{ref:x,className:`vl-dropdown__trigger`,onClick:je,onContextMenu:Ie,onKeyDown:He,children:Ye}),z?O?(0,ie.createPortal)(Ze,document.body):Ze:null]})})});l.displayName=`VlDropdown`;var u=l,oe=l;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return oe}});
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { t as e } from "./icon-Cbvuv4yF.js";
|
|
2
|
+
import { t } from "./effect-nifYL_rH.js";
|
|
3
|
+
import { n, t as r } from "./state-oH-YwB7_.js";
|
|
4
|
+
import { t as ee } from "./client-pj_wzx28.js";
|
|
5
|
+
import { n as te } from "./refs-D5IYOBaf.js";
|
|
6
|
+
import { r as ne, t as re } from "./floating-DBAmeQIq.js";
|
|
7
|
+
import { t as ie } from "./id-CHixuHb7.js";
|
|
8
|
+
import { n as ae, r as oe, t as se } from "./layer-DDm97-sb.js";
|
|
9
|
+
import { t as ce } from "./Transition-DiO4GsP3.js";
|
|
10
|
+
import { i as le } from "./focus-BDDJyKk3.js";
|
|
11
|
+
import { Fragment as ue, cloneElement as de, forwardRef as i, isValidElement as fe, useCallback as a, useEffect as pe, useMemo as o, useRef as s, useState as c } from "react";
|
|
12
|
+
import { jsx as l, jsxs as me } from "react/jsx-runtime";
|
|
13
|
+
import { createPortal as he } from "react-dom";
|
|
14
|
+
//#region components/Dropdown/Dropdown.tsx
|
|
15
|
+
var ge = [], u = (e) => !!(e && !e.disabled && !e.divider), d = i((i, d) => {
|
|
16
|
+
let { open: _e, defaultOpen: ve = !1, disabled: f = !1, placement: p = "bottom-start", offset: m = 8, zIndex: ye, closeOnContentClick: be = !0, trigger: h = "hover", options: g = ge, closeOnOutsideClick: xe = !0, triggerContent: _, menuLabel: Se = "菜单", className: v, style: y, children: Ce, onChange: we, onOpen: b, onClose: x, onSelect: Te, onCommand: Ee, "aria-label": S, "aria-labelledby": De, ...Oe } = i, ke = s(null), C = s(null), w = s(null), T = s([]), E = s(null), D = s(null), O = s(null), k = s(null), Ae = o(() => te(ke, d), [d]), A = ee(), je = oe({
|
|
17
|
+
defaultZIndex: ae.dropdown,
|
|
18
|
+
zIndex: ye
|
|
19
|
+
}), Me = r(i, "open"), [j, Ne] = n({
|
|
20
|
+
value: !!_e,
|
|
21
|
+
defaultValue: ve,
|
|
22
|
+
controlled: Me,
|
|
23
|
+
onChange: we
|
|
24
|
+
}), M = j && !f, [N, Pe] = c(-1), [Fe, P] = c({}), [Ie, F] = c(p), [I, L] = c(!1), [R, z] = c(M), [Le, B] = c(!1), V = ie("vl-dropdown-menu"), Re = a((e) => `${V}-option-${e}`, [V]), H = o(() => g.flatMap((e, t) => u(e) ? [t] : []), [g]), ze = H.length > 0, Be = g.some((e) => !e.divider), U = H.includes(N) ? N : H[0] ?? -1, Ve = o(() => [
|
|
25
|
+
"vl-dropdown",
|
|
26
|
+
M ? "is-open" : "",
|
|
27
|
+
f ? "is-disabled" : "",
|
|
28
|
+
v || ""
|
|
29
|
+
].filter(Boolean).join(" "), [
|
|
30
|
+
M,
|
|
31
|
+
f,
|
|
32
|
+
v
|
|
33
|
+
]), He = o(() => ({
|
|
34
|
+
"--vl-dropdown-offset": `${m}px`,
|
|
35
|
+
...y
|
|
36
|
+
}), [m, y]), W = a(() => {
|
|
37
|
+
let e = E.current;
|
|
38
|
+
if (e && e.isConnected) {
|
|
39
|
+
e.focus();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
(C.current?.querySelector(le))?.focus();
|
|
43
|
+
}, []), G = a(() => {
|
|
44
|
+
let e = document.activeElement;
|
|
45
|
+
if (e && C.current?.contains(e)) {
|
|
46
|
+
E.current = e;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
E.current = C.current?.querySelector("button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])") ?? null;
|
|
50
|
+
}, []), K = a((e, t = !1) => {
|
|
51
|
+
if (!(e && f)) {
|
|
52
|
+
if (j === e) {
|
|
53
|
+
t && W();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
e && (G(), L(!1), P({}), F(p)), Ne(e), e ? b?.() : (x?.(), t && window.requestAnimationFrame(W));
|
|
57
|
+
}
|
|
58
|
+
}, [
|
|
59
|
+
f,
|
|
60
|
+
j,
|
|
61
|
+
p,
|
|
62
|
+
W,
|
|
63
|
+
G,
|
|
64
|
+
Ne,
|
|
65
|
+
b,
|
|
66
|
+
x
|
|
67
|
+
]), q = a(() => {
|
|
68
|
+
O.current !== null && (window.clearTimeout(O.current), O.current = null);
|
|
69
|
+
}, []), J = a(() => {
|
|
70
|
+
q(), O.current = window.setTimeout(() => {
|
|
71
|
+
let e = document.activeElement;
|
|
72
|
+
e && (C.current?.contains(e) || w.current?.contains(e)) || K(!1);
|
|
73
|
+
}, 160);
|
|
74
|
+
}, [q, K]), Y = a((e) => {
|
|
75
|
+
u(g[e]) && (Pe(e), T.current[e]?.focus());
|
|
76
|
+
}, [g]), X = a(() => {
|
|
77
|
+
let e = H[0];
|
|
78
|
+
e !== void 0 && Y(e);
|
|
79
|
+
}, [H, Y]), Z = a(() => {
|
|
80
|
+
let e = H.at(-1);
|
|
81
|
+
e !== void 0 && Y(e);
|
|
82
|
+
}, [H, Y]), Q = a((e) => {
|
|
83
|
+
if (!H.length) return;
|
|
84
|
+
let t = H.indexOf(N), n = t < 0 ? e > 0 ? 0 : H.length - 1 : (t + e + H.length) % H.length;
|
|
85
|
+
Y(H[n]);
|
|
86
|
+
}, [
|
|
87
|
+
H,
|
|
88
|
+
N,
|
|
89
|
+
Y
|
|
90
|
+
]), $ = a(() => {
|
|
91
|
+
if (!M) return;
|
|
92
|
+
let e = w.current;
|
|
93
|
+
if (!e) return;
|
|
94
|
+
let t = D.current, n = t ? {
|
|
95
|
+
left: t.x,
|
|
96
|
+
right: t.x,
|
|
97
|
+
top: t.y,
|
|
98
|
+
bottom: t.y,
|
|
99
|
+
width: 0,
|
|
100
|
+
height: 0
|
|
101
|
+
} : C.current?.getBoundingClientRect();
|
|
102
|
+
if (!n) return;
|
|
103
|
+
let r = re({
|
|
104
|
+
anchorRect: n,
|
|
105
|
+
floatingRect: e.getBoundingClientRect(),
|
|
106
|
+
placement: p,
|
|
107
|
+
offset: m
|
|
108
|
+
});
|
|
109
|
+
F(r.placement), P({
|
|
110
|
+
left: `${Math.round(r.x)}px`,
|
|
111
|
+
top: `${Math.round(r.y)}px`
|
|
112
|
+
}), L(!0);
|
|
113
|
+
}, [
|
|
114
|
+
M,
|
|
115
|
+
p,
|
|
116
|
+
m
|
|
117
|
+
]), Ue = (e) => {
|
|
118
|
+
f || h !== "click" || (e.stopPropagation(), D.current = null, K(!M));
|
|
119
|
+
}, We = () => {
|
|
120
|
+
f || h !== "hover" || (D.current = null, q(), K(!0));
|
|
121
|
+
}, Ge = () => {
|
|
122
|
+
f || h !== "hover" || J();
|
|
123
|
+
}, Ke = () => {
|
|
124
|
+
f || h !== "hover" || (D.current = null, q(), K(!0));
|
|
125
|
+
}, qe = (e) => {
|
|
126
|
+
e.currentTarget.contains(e.relatedTarget) || h === "hover" && J();
|
|
127
|
+
}, Je = (e) => {
|
|
128
|
+
f || h !== "context-menu" || (e.preventDefault(), e.stopPropagation(), D.current = {
|
|
129
|
+
x: e.clientX,
|
|
130
|
+
y: e.clientY
|
|
131
|
+
}, K(!0));
|
|
132
|
+
}, Ye = () => {
|
|
133
|
+
h === "hover" && q();
|
|
134
|
+
}, Xe = () => {
|
|
135
|
+
h === "hover" && J();
|
|
136
|
+
}, Ze = () => q(), Qe = (e) => {
|
|
137
|
+
u(e) && (e.onClick?.(e), Te?.(e), Ee?.(e.value, e), be && K(!1, !0));
|
|
138
|
+
}, $e = () => {
|
|
139
|
+
g.length || !be || K(!1, !0);
|
|
140
|
+
}, et = (e) => {
|
|
141
|
+
if (!f) {
|
|
142
|
+
if (D.current = null, e.key === "Escape" && M) {
|
|
143
|
+
e.preventDefault(), K(!1, !0);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
e.key === "ArrowDown" || e.key === "Enter" || e.key === " " ? (e.preventDefault(), G(), M ? X() : (k.current = "first", K(!0))) : e.key === "ArrowUp" && (e.preventDefault(), G(), M ? Z() : (k.current = "last", K(!0)));
|
|
147
|
+
}
|
|
148
|
+
}, tt = (e) => {
|
|
149
|
+
if (M) {
|
|
150
|
+
if (e.key === "Escape") {
|
|
151
|
+
e.preventDefault(), K(!1, !0);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (e.key === "Tab") {
|
|
155
|
+
K(!1);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (ze) {
|
|
159
|
+
if (e.key === "ArrowDown") e.preventDefault(), Q(1);
|
|
160
|
+
else if (e.key === "ArrowUp") e.preventDefault(), Q(-1);
|
|
161
|
+
else if (e.key === "Home") e.preventDefault(), X();
|
|
162
|
+
else if (e.key === "End") e.preventDefault(), Z();
|
|
163
|
+
else if (e.key === "Enter" || e.key === " ") {
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
let t = g[N];
|
|
166
|
+
t && Qe(t);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
pe(() => {
|
|
172
|
+
f && j && K(!1);
|
|
173
|
+
}, [
|
|
174
|
+
f,
|
|
175
|
+
j,
|
|
176
|
+
K
|
|
177
|
+
]), t(() => {
|
|
178
|
+
if (!A) return;
|
|
179
|
+
if (!M) {
|
|
180
|
+
B(!1);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (!R) {
|
|
184
|
+
z(!0);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
$(), B(!0);
|
|
188
|
+
let e = k.current;
|
|
189
|
+
k.current = null;
|
|
190
|
+
let t = window.requestAnimationFrame(() => {
|
|
191
|
+
$(), e === "first" ? X() : e === "last" && Z();
|
|
192
|
+
});
|
|
193
|
+
return () => window.cancelAnimationFrame(t);
|
|
194
|
+
}, [
|
|
195
|
+
M,
|
|
196
|
+
A,
|
|
197
|
+
R,
|
|
198
|
+
X,
|
|
199
|
+
Z,
|
|
200
|
+
$
|
|
201
|
+
]);
|
|
202
|
+
let nt = a(() => {
|
|
203
|
+
L(!1), P({}), F(p);
|
|
204
|
+
}, [p]), rt = a(() => {
|
|
205
|
+
M || (z(!1), nt());
|
|
206
|
+
}, [M, nt]), it = a(() => K(!1), [K]), at = a(() => K(!1, !0), [K]);
|
|
207
|
+
ne({
|
|
208
|
+
active: M && A,
|
|
209
|
+
rootRef: ke,
|
|
210
|
+
floatingRef: w,
|
|
211
|
+
closeOnOutsideClick: xe && h !== "hover",
|
|
212
|
+
ignoreEscapeInsideFloating: !0,
|
|
213
|
+
onOutsideClick: it,
|
|
214
|
+
onEscape: at,
|
|
215
|
+
onViewportChange: $
|
|
216
|
+
}), pe(() => () => q(), [q]);
|
|
217
|
+
let ot = {
|
|
218
|
+
"aria-haspopup": "menu",
|
|
219
|
+
"aria-expanded": M,
|
|
220
|
+
"aria-controls": V,
|
|
221
|
+
"aria-disabled": f || void 0,
|
|
222
|
+
...S ? { "aria-label": S } : {},
|
|
223
|
+
...De ? { "aria-labelledby": De } : {},
|
|
224
|
+
tabIndex: f ? -1 : void 0
|
|
225
|
+
}, st = fe(_) && _.type !== ue ? de(_, ot) : /* @__PURE__ */ l("button", {
|
|
226
|
+
type: "button",
|
|
227
|
+
className: "vl-dropdown__defaultTrigger",
|
|
228
|
+
disabled: f,
|
|
229
|
+
...ot,
|
|
230
|
+
children: _ ?? "Menu"
|
|
231
|
+
}), ct = [
|
|
232
|
+
"vl-dropdown__panel",
|
|
233
|
+
`is-${Ie}`,
|
|
234
|
+
I ? "is-positioned" : ""
|
|
235
|
+
].filter(Boolean).join(" "), lt = /* @__PURE__ */ l(ce, {
|
|
236
|
+
show: A ? Le : M,
|
|
237
|
+
name: "vl-dropdown",
|
|
238
|
+
forceMount: A,
|
|
239
|
+
deferEffects: !A,
|
|
240
|
+
onAfterLeave: rt,
|
|
241
|
+
children: /* @__PURE__ */ l("div", {
|
|
242
|
+
ref: w,
|
|
243
|
+
id: V,
|
|
244
|
+
className: ct,
|
|
245
|
+
style: {
|
|
246
|
+
...Fe,
|
|
247
|
+
zIndex: je.zIndex,
|
|
248
|
+
visibility: A && !I ? "hidden" : "visible"
|
|
249
|
+
},
|
|
250
|
+
role: "menu",
|
|
251
|
+
"aria-label": Se,
|
|
252
|
+
"aria-hidden": !M || void 0,
|
|
253
|
+
onClick: $e,
|
|
254
|
+
onMouseEnter: Ye,
|
|
255
|
+
onMouseLeave: Xe,
|
|
256
|
+
onFocus: Ze,
|
|
257
|
+
onKeyDown: tt,
|
|
258
|
+
children: /* @__PURE__ */ l("div", {
|
|
259
|
+
className: "vl-dropdown__content",
|
|
260
|
+
children: Be ? g.map((t, n) => t.divider ? /* @__PURE__ */ l("div", {
|
|
261
|
+
className: "vl-dropdown__divider",
|
|
262
|
+
role: "separator"
|
|
263
|
+
}, `divider-${n}`) : /* @__PURE__ */ me("div", {
|
|
264
|
+
ref: (e) => {
|
|
265
|
+
T.current[n] = e;
|
|
266
|
+
},
|
|
267
|
+
id: Re(n),
|
|
268
|
+
className: [
|
|
269
|
+
"vl-dropdown__option",
|
|
270
|
+
t.status ? `is-${t.status}` : "",
|
|
271
|
+
t.disabled ? "is-disabled" : "",
|
|
272
|
+
U === n ? "is-active" : ""
|
|
273
|
+
].filter(Boolean).join(" "),
|
|
274
|
+
role: "menuitem",
|
|
275
|
+
tabIndex: U === n && !t.disabled ? 0 : -1,
|
|
276
|
+
"aria-disabled": t.disabled || void 0,
|
|
277
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
278
|
+
onMouseEnter: () => {
|
|
279
|
+
u(t) && Pe(n);
|
|
280
|
+
},
|
|
281
|
+
onClick: (e) => {
|
|
282
|
+
e.stopPropagation(), Qe(t);
|
|
283
|
+
},
|
|
284
|
+
children: [t.icon ? e(t.icon, "vl-dropdown__option-icon") : null, /* @__PURE__ */ l("span", {
|
|
285
|
+
className: "vl-dropdown__option-label",
|
|
286
|
+
children: t.label ?? ""
|
|
287
|
+
})]
|
|
288
|
+
}, t.value ?? n)) : Ce
|
|
289
|
+
})
|
|
290
|
+
})
|
|
291
|
+
});
|
|
292
|
+
return /* @__PURE__ */ l(se, {
|
|
293
|
+
layer: je.layer,
|
|
294
|
+
children: /* @__PURE__ */ me("div", {
|
|
295
|
+
ref: Ae,
|
|
296
|
+
className: Ve,
|
|
297
|
+
style: He,
|
|
298
|
+
...Oe,
|
|
299
|
+
onMouseEnter: We,
|
|
300
|
+
onMouseLeave: Ge,
|
|
301
|
+
onFocus: Ke,
|
|
302
|
+
onBlur: qe,
|
|
303
|
+
children: [/* @__PURE__ */ l("div", {
|
|
304
|
+
ref: C,
|
|
305
|
+
className: "vl-dropdown__trigger",
|
|
306
|
+
onClick: Ue,
|
|
307
|
+
onContextMenu: Je,
|
|
308
|
+
onKeyDown: et,
|
|
309
|
+
children: st
|
|
310
|
+
}), R ? A ? he(lt, document.body) : lt : null]
|
|
311
|
+
})
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
d.displayName = "VlDropdown";
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region components/Dropdown/index.ts
|
|
317
|
+
var _e = d, ve = d;
|
|
318
|
+
//#endregion
|
|
319
|
+
export { _e as n, ve as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./icon-DRLyKu8p.cjs"),t=require("./content-DCGQZQp8.cjs");let n=require("lucide-react"),r=require("react"),i=require("react/jsx-runtime");var a=(0,r.forwardRef)((r,a)=>{let{image:o,title:s=`暂无数据`,description:c,size:l=`md`,className:u,children:d,role:f=`status`,...p}=r,m=[`vl-empty`,`size-${l}`,u||``].filter(Boolean).join(` `),h=o===void 0?n.Inbox:o;return(0,i.jsxs)(`div`,{ref:a,className:m,role:f,...p,children:[e.t(h,`vl-empty__image`),t.t(s)?(0,i.jsx)(`div`,{className:`vl-empty__title`,children:s}):null,t.t(c)?(0,i.jsx)(`div`,{className:`vl-empty__description`,children:c}):null,t.t(d)?(0,i.jsx)(`div`,{className:`vl-empty__actions`,children:d}):null]})});a.displayName=`VlEmpty`;var o=a,s=a;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as e } from "./icon-Cbvuv4yF.js";
|
|
2
|
+
import { t } from "./content-Dllrr-7G.js";
|
|
3
|
+
import { Inbox as n } from "lucide-react";
|
|
4
|
+
import { forwardRef as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region components/Empty/Empty.tsx
|
|
7
|
+
var o = r((r, o) => {
|
|
8
|
+
let { image: s, title: c = "暂无数据", description: l, size: u = "md", className: d, children: f, role: p = "status", ...m } = r, h = [
|
|
9
|
+
"vl-empty",
|
|
10
|
+
`size-${u}`,
|
|
11
|
+
d || ""
|
|
12
|
+
].filter(Boolean).join(" "), g = s === void 0 ? n : s;
|
|
13
|
+
return /* @__PURE__ */ a("div", {
|
|
14
|
+
ref: o,
|
|
15
|
+
className: h,
|
|
16
|
+
role: p,
|
|
17
|
+
...m,
|
|
18
|
+
children: [
|
|
19
|
+
e(g, "vl-empty__image"),
|
|
20
|
+
t(c) ? /* @__PURE__ */ i("div", {
|
|
21
|
+
className: "vl-empty__title",
|
|
22
|
+
children: c
|
|
23
|
+
}) : null,
|
|
24
|
+
t(l) ? /* @__PURE__ */ i("div", {
|
|
25
|
+
className: "vl-empty__description",
|
|
26
|
+
children: l
|
|
27
|
+
}) : null,
|
|
28
|
+
t(f) ? /* @__PURE__ */ i("div", {
|
|
29
|
+
className: "vl-empty__actions",
|
|
30
|
+
children: f
|
|
31
|
+
}) : null
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
o.displayName = "VlEmpty";
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region components/Empty/index.ts
|
|
38
|
+
var s = o, c = o;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { s as n, c as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as e, t } from "./state-oH-YwB7_.js";
|
|
2
2
|
import { t as n } from "./Button-CwkWSWau.js";
|
|
3
3
|
import { t as r } from "./focus-BDDJyKk3.js";
|
|
4
|
-
import { t as i } from "./Modal-
|
|
4
|
+
import { t as i } from "./Modal-otJ_9ldu.js";
|
|
5
5
|
import { CircleAlert as a, CircleCheck as o, CircleX as s, Info as c, X as l } from "lucide-react";
|
|
6
6
|
import { forwardRef as u, useRef as d, useState as f } from "react";
|
|
7
7
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./state-ZBA75xZ_.cjs"),t=require("./Button-qURrKHQ0.cjs"),n=require("./focus-D-h8CbGr.cjs"),r=require("./Modal-
|
|
1
|
+
const e=require("./state-ZBA75xZ_.cjs"),t=require("./Button-qURrKHQ0.cjs"),n=require("./focus-D-h8CbGr.cjs"),r=require("./Modal-i_Do8GsG.cjs");let i=require("lucide-react"),a=require("react"),o=require("react/jsx-runtime"),s=require("react-dom/client");var c={info:i.Info,success:i.CircleCheck,warning:i.CircleAlert,error:i.CircleX},l={info:`primary`,success:`success`,warning:`warning`,error:`error`},u={[n.t]:!0},d=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,f=(0,a.forwardRef)((n,s)=>{let{open:f,defaultOpen:p=!1,title:m=`提示`,type:h=`info`,showCancelButton:g=!1,confirmButtonText:_=`确定`,confirmButtonLoadingText:v,cancelButtonText:y=`取消`,width:b=420,closeOnClickOverlay:x=!1,closeOnPressEscape:S=!0,showClose:C=!0,draggable:w=!1,className:T,children:E,onChange:D,onConfirm:O,onCancel:k,onClose:A,onConfirmError:j,...M}=n,N=e.t(n,`open`),[P,F]=e.n({value:!!f,defaultValue:p,controlled:N,onChange:D}),[I,L]=(0,a.useState)(!1),R=(0,a.useRef)(!1),z=e=>{R.current||(e===`cancel`?k?.():A?.(),F(!1))},B=async()=>{if(!R.current)try{let e=O?.();d(e)&&(R.current=!0,L(!0),await e),F(!1)}catch(e){j?.(e)}finally{R.current=!1,L(!1)}},V=c[h],H=[`vl-message-box`,`is-${h}`,T||``].filter(Boolean).join(` `);return(0,o.jsx)(r.t,{...M,ref:s,open:P,title:m,width:b,draggable:w,closeOnClickOverlay:!I&&x,closeOnPressEscape:!I&&S,showClose:!1,className:H,header:(0,o.jsxs)(`div`,{className:`vl-message-box__header`,children:[(0,o.jsx)(`div`,{className:`vl-message-box__title`,children:m}),C?(0,o.jsx)(`button`,{type:`button`,className:`vl-modal__close`,"aria-label":`关闭消息框`,disabled:I,onClick:()=>z(`close`),children:(0,o.jsx)(i.X,{size:20,"aria-hidden":`true`})}):null]}),footer:(0,o.jsxs)(`div`,{className:`vl-message-box__actions`,children:[g?(0,o.jsx)(t.t,{disabled:I,onClick:()=>z(`cancel`),children:y}):null,(0,o.jsx)(t.t,{...u,status:l[h],variant:`solid`,loading:I,loadingText:v,onClick:B,children:_})]}),onChange:e=>{e||z(`close`)},children:(0,o.jsxs)(`div`,{className:`vl-message-box__content`,children:[(0,o.jsx)(V,{className:`vl-message-box__icon`,"aria-hidden":`true`}),(0,o.jsx)(`div`,{className:`vl-message-box__message`,children:E})]})})});f.displayName=`VlMessageBox`;var p=(e,t={},n)=>typeof document>`u`?Promise.reject(Error(`VlMessageBox imperative APIs are only available in a browser environment.`)):new Promise((r,i)=>{let c=document.createElement(`div`);c.className=`vl-message-box-container`,document.body.appendChild(c);let l=(0,s.createRoot)(c);l.render((0,o.jsx)(()=>{let[s,u]=(0,a.useState)(!0);return(0,o.jsx)(f,{...t,open:s,showCancelButton:n,onChange:u,onConfirm:async()=>{await t.onConfirm?.(),r(`confirm`)},onCancel:()=>{t.onCancel?.(),i(`cancel`)},onClose:()=>{t.onClose?.(),i(`close`)},onAfterClose:()=>{try{t.onAfterClose?.()}finally{queueMicrotask(()=>{l.unmount(),c.remove()})}},children:e})},{}))}),m=Object.assign(f,{alert:(e,t)=>p(e,t,!1),confirm:(e,t)=>p(e,t,!0)});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return m}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./effect-BpNxm_06.cjs"),t=require("./state-ZBA75xZ_.cjs"),n=require("./client-BkoqeUs3.cjs"),r=require("./refs-DCqd87V8.cjs"),i=require("./content-DCGQZQp8.cjs"),a=require("./number-B7qJF_ZY.cjs"),o=require("./id-CF0zOP1G.cjs"),s=require("./layer-BgiUZy_t.cjs"),c=require("./dialog-shell-DT1EoKQG.cjs");let ee=require("lucide-react"),l=require("react"),u=require("react/jsx-runtime");var te=-24,d=(0,l.forwardRef)((d,f)=>{let{open:p,defaultOpen:ne=!1,title:m,width:re=520,offsetY:h=te,center:ie=!1,mask:ae=!0,closeOnClickOverlay:oe=!0,closeOnPressEscape:se=!0,showClose:g=!0,lockScroll:ce=!0,destroyOnClose:_=!1,draggable:v=!0,fullscreen:y=!1,zIndex:le,header:b,footer:x,className:ue,style:S,children:de,onClick:fe,onChange:pe,onOpen:C,onClose:w,onAfterClose:me,"aria-label":he,"aria-labelledby":ge,"aria-describedby":_e,...ve}=d,T=n.t(),ye=typeof S?.zIndex==`number`?S.zIndex:void 0,E=s.r({defaultZIndex:s.n.modal,zIndex:le??ye,withMask:!0}),D=(0,l.useRef)(null),be=(0,l.useMemo)(()=>r.n(D,f),[f]),xe=t.t(d,`open`),[O,k]=t.n({value:!!p,defaultValue:ne,controlled:xe,onChange:pe}),[Se,A]=(0,l.useState)(!1),j=(0,l.useRef)({x:0,y:0}),M=(0,l.useRef)(!1),N=(0,l.useRef)(!1),P=(0,l.useRef)({x:0,y:0}),F=(0,l.useRef)(null),I=(0,l.useRef)(!1),L=o.t(`vl-modal-title`),R=(0,l.useCallback)(()=>k(!1),[k]),{isTopLayer:z}=c.r({active:T&&O,containerRef:D,closeOnPressEscape:se,lockScroll:ce,onRequestClose:R}),B=(0,l.useCallback)(e=>{D.current&&(D.current.style.visibility=e?`visible`:`hidden`)},[]),V=(0,l.useCallback)((e,t)=>{j.current={x:e,y:t},D.current&&(D.current.style.left=`${e}px`,D.current.style.top=`${t}px`)},[]),H=(0,l.useCallback)((e,t)=>{let n=e.getBoundingClientRect();return{rect:n,maxX:Math.max(t,window.innerWidth-n.width-t),maxY:Math.max(t,window.innerHeight-n.height-t)}},[]),U=(0,l.useCallback)(()=>{let e=D.current;if(!e)return;if(y){V(0,0);return}let{rect:t,maxX:n,maxY:r}=H(e,16),i=(window.innerHeight-t.height)/2+h;V(Math.round(a.t((window.innerWidth-t.width)/2,16,n)),Math.round(a.t(i,16,r)))},[y,H,h,V]),W=(0,l.useCallback)(()=>{let e=D.current;if(!e)return;let{maxX:t,maxY:n}=H(e,8);V(Math.round(a.t(j.current.x,8,t)),Math.round(a.t(j.current.y,8,n)))},[H,V]),G=(0,l.useCallback)((e,t)=>{let n=D.current;if(!n||y)return;let{maxX:r,maxY:i}=H(n,8),o=a.t(e-P.current.x,8,r),s=a.t(t-P.current.y,8,i);V(Math.round(o),Math.round(s)),M.current=!0},[y,H,V]),K=(0,l.useRef)(G);e.t(()=>{K.current=G},[G]);let q=(0,l.useCallback)(e=>{N.current&&K.current(e.clientX,e.clientY)},[]),J=(0,l.useCallback)(()=>{window.removeEventListener(`pointermove`,q),F.current?.(),F.current=null},[q]),Y=(0,l.useCallback)(()=>{N.current&&(N.current=!1,A(!1),J())},[J]),Ce=e=>{if(!v||y||!O||!z()||e.button!==0||e.target.closest(`.vl-modal__close`))return;let t=D.current;if(!t)return;let n=t.getBoundingClientRect();P.current={x:e.clientX-n.left,y:e.clientY-n.top},N.current=!0,A(!0),F.current=c.n(),window.addEventListener(`pointermove`,q),window.addEventListener(`pointerup`,Y,{once:!0})};(0,l.useEffect)(()=>{let e=I.current;O&&!e?C?.():!O&&e&&w?.(),I.current=O},[O,C,w]),e.t(()=>{!O||!T||(B(!1),y?V(0,0):!_&&M.current?W():U(),B(!0))},[O,T,y,_,U,W,V,B]),(0,l.useEffect)(()=>{O||Y()},[O,Y]),(0,l.useEffect)(()=>{if(!O)return;let e=()=>{N.current||(M.current?W():U())};return window.addEventListener(`resize`,e,{passive:!0}),()=>window.removeEventListener(`resize`,e)},[O,U,W]),(0,l.useEffect)(()=>()=>{window.removeEventListener(`pointerup`,Y),J()},[Y,J]);let we=()=>{oe&&z()&&R()},Te=e=>{e.stopPropagation(),fe?.(e)},Ee=[`vl-modal`,Se?`is-dragging`:``,ie?`is-center`:``,y?`is-fullscreen`:``,ue||``].filter(Boolean).join(` `),De=[`vl-modal__header`,v&&!y?`is-draggable`:``].filter(Boolean).join(` `),X={...S};E.zIndex!==void 0&&(X.zIndex=E.zIndex),y?(X.width=`100vw`,X.height=`100vh`):X.width=a.n(re)??`520px`;let Z=b??(m?(0,u.jsx)(`div`,{id:L,className:`vl-modal__title`,children:m}):null),Q=ge??(!b&&m?L:void 0),$=he??(Q?void 0:typeof m==`string`?m:`对话框`);return(0,u.jsx)(s.t,{layer:E.layer,children:(0,u.jsxs)(c.t,{clientReady:T,open:O,mask:ae,destroyOnClose:_,maskTransitionName:`vl-modal-mask`,transitionName:`vl-modal`,maskClassName:`vl-modal__mask`,panelClassName:Ee,panelStyle:X,maskStyle:E.maskZIndex===void 0?void 0:{zIndex:E.maskZIndex},panelRef:be,role:`dialog`,ariaLabel:$,ariaLabelledBy:Q,ariaDescribedBy:_e,onMaskClick:we,onPanelClick:Te,onAfterLeave:()=>{Y(),_&&(M.current=!1),me?.()},panelProps:ve,children:[i.t(Z)||g?(0,u.jsx)(`div`,{className:De,onPointerDown:Ce,children:(0,u.jsxs)(`div`,{className:`vl-modal__headerInner`,children:[(0,u.jsx)(`div`,{className:`vl-modal__headerMain`,children:Z}),g?(0,u.jsx)(`button`,{type:`button`,className:`vl-modal__close`,"aria-label":`关闭对话框`,onClick:R,children:(0,u.jsx)(ee.X,{size:20,"aria-hidden":`true`})}):null]})}):null,(0,u.jsx)(`div`,{className:`vl-modal__body`,children:de}),i.t(x)?(0,u.jsx)(`div`,{className:`vl-modal__footer`,children:x}):null]})})});d.displayName=`VlModal`;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}});
|