ono-react-element 0.0.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/dist/es/AutoSliderList-DqaQhmce.js +106 -0
- package/dist/es/AvatarCrop-DzGw2FVQ.js +225 -0
- package/dist/es/Button-CdxyXFF4.js +72 -0
- package/dist/es/Card3D-sf3zmiHk.js +41 -0
- package/dist/es/Checkbox-BN7rT73n.js +62 -0
- package/dist/es/InjunctiveBox-CmZg4sIq.js +39 -0
- package/dist/es/Input-wORRaL9-.js +301 -0
- package/dist/es/List-B9mP7VjN.js +35 -0
- package/dist/es/MenuButton-CuOdVlg0.js +62 -0
- package/dist/es/Message-BMimz-k2.js +219 -0
- package/dist/es/Modal-BAJOEXRd.js +154 -0
- package/dist/es/Pagination-BtmtUkVw.js +110 -0
- package/dist/es/PortalRenderer-8Iur-eZp.js +38 -0
- package/dist/es/Radio-BmSpqdK8.js +113 -0
- package/dist/es/SvgImg-Bcmzdjzl.js +38 -0
- package/dist/es/Switch-hGQGZVO2.js +110 -0
- package/dist/es/TemplateDialog-DuURiDPX.js +75 -0
- package/dist/es/Toast-CkC8zQdq.js +174 -0
- package/dist/es/Tooltip-C_gPojr9.js +94 -0
- package/dist/es/VirtualList-D8M5JJ-W.js +160 -0
- package/dist/es/Waterfall-BXE2_5Sj.js +131 -0
- package/dist/es/dependencies-DWmdjl5u.js +25491 -0
- package/dist/es/hooks-Bj-aT2k8.js +159 -0
- package/dist/es/index.js +227 -0
- package/dist/es/utils-ziqvBIOU.js +567 -0
- package/dist/index.css +1 -0
- package/dist/types/components/AutoSliderList/AutoSliderList.d.ts +2 -0
- package/dist/types/components/AutoSliderList/index.d.ts +2 -0
- package/dist/types/components/AutoSliderList/types.d.ts +23 -0
- package/dist/types/components/AvatarCrop/AvatarCanvas.d.ts +2 -0
- package/dist/types/components/AvatarCrop/AvatarCrop.d.ts +13 -0
- package/dist/types/components/AvatarCrop/index.d.ts +1 -0
- package/dist/types/components/AvatarCrop/types.d.ts +42 -0
- package/dist/types/components/Button/Button.d.ts +2 -0
- package/dist/types/components/Button/index.d.ts +2 -0
- package/dist/types/components/Button/types.d.ts +20 -0
- package/dist/types/components/Card3D/Card3D.d.ts +12 -0
- package/dist/types/components/Card3D/index.d.ts +1 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/types/components/Checkbox/index.d.ts +2 -0
- package/dist/types/components/Checkbox/types.d.ts +12 -0
- package/dist/types/components/InjunctiveBox/InjunctiveBox.d.ts +18 -0
- package/dist/types/components/InjunctiveBox/index.d.ts +1 -0
- package/dist/types/components/Input/Input.d.ts +2 -0
- package/dist/types/components/Input/Textarea.d.ts +2 -0
- package/dist/types/components/Input/index.d.ts +2 -0
- package/dist/types/components/Input/types.d.ts +46 -0
- package/dist/types/components/List/AwaitList.d.ts +3 -0
- package/dist/types/components/List/List.d.ts +3 -0
- package/dist/types/components/List/index.d.ts +2 -0
- package/dist/types/components/List/types.d.ts +11 -0
- package/dist/types/components/MenuButton/MenuButton.d.ts +2 -0
- package/dist/types/components/MenuButton/index.d.ts +1 -0
- package/dist/types/components/MenuButton/types.d.ts +8 -0
- package/dist/types/components/Message/Message.d.ts +8 -0
- package/dist/types/components/Message/index.d.ts +1 -0
- package/dist/types/components/Message/types.d.ts +20 -0
- package/dist/types/components/Message/utils.d.ts +23 -0
- package/dist/types/components/Modal/Modal.d.ts +2 -0
- package/dist/types/components/Modal/index.d.ts +1 -0
- package/dist/types/components/Modal/types.d.ts +27 -0
- package/dist/types/components/Pagination/Pagination.d.ts +2 -0
- package/dist/types/components/Pagination/index.d.ts +1 -0
- package/dist/types/components/Pagination/types.d.ts +20 -0
- package/dist/types/components/PortalRenderer/PortalRenderer.d.ts +2 -0
- package/dist/types/components/PortalRenderer/index.d.ts +1 -0
- package/dist/types/components/Radio/Radio.d.ts +2 -0
- package/dist/types/components/Radio/RadioGroup.d.ts +2 -0
- package/dist/types/components/Radio/index.d.ts +2 -0
- package/dist/types/components/Radio/types.d.ts +26 -0
- package/dist/types/components/Select/Option.d.ts +2 -0
- package/dist/types/components/Select/Select.d.ts +2 -0
- package/dist/types/components/Select/index.d.ts +1 -0
- package/dist/types/components/Select/types.d.ts +30 -0
- package/dist/types/components/SvgImg/SvgImg.d.ts +10 -0
- package/dist/types/components/SvgImg/index.d.ts +1 -0
- package/dist/types/components/Switch/Switch.d.ts +2 -0
- package/dist/types/components/Switch/index.d.ts +1 -0
- package/dist/types/components/Switch/types.d.ts +18 -0
- package/dist/types/components/TemplateDialog/TemplateDialog.d.ts +2 -0
- package/dist/types/components/TemplateDialog/index.d.ts +1 -0
- package/dist/types/components/TemplateDialog/types.d.ts +19 -0
- package/dist/types/components/Toast/Toast.d.ts +7 -0
- package/dist/types/components/Toast/index.d.ts +1 -0
- package/dist/types/components/Toast/types.d.ts +19 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/types/components/Tooltip/index.d.ts +1 -0
- package/dist/types/components/Tooltip/types.d.ts +15 -0
- package/dist/types/components/VirtualList/EstimatedVirtualList.d.ts +2 -0
- package/dist/types/components/VirtualList/index.d.ts +2 -0
- package/dist/types/components/VirtualList/types.d.ts +35 -0
- package/dist/types/components/Waterfall/Waterfall.d.ts +2 -0
- package/dist/types/components/Waterfall/index.d.ts +2 -0
- package/dist/types/components/Waterfall/types.d.ts +23 -0
- package/dist/types/components/index.d.ts +21 -0
- package/dist/types/hooks/index.d.ts +7 -0
- package/dist/types/hooks/useClickOutSide.d.ts +9 -0
- package/dist/types/hooks/useCountdown.d.ts +1 -0
- package/dist/types/hooks/useEventListener.d.ts +8 -0
- package/dist/types/hooks/useGetElementSize.d.ts +5 -0
- package/dist/types/hooks/useKeyPress.d.ts +12 -0
- package/dist/types/hooks/useTheme.d.ts +8 -0
- package/dist/types/hooks/useThemePro.d.ts +11 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/utils/colorUtils.d.ts +33 -0
- package/dist/types/utils/common.d.ts +96 -0
- package/dist/types/utils/fileFormatConversion.d.ts +10 -0
- package/dist/types/utils/formatTimeUtils.d.ts +6 -0
- package/dist/types/utils/viewTransitionUtils.d.ts +9 -0
- package/dist/umd/index.css +1 -0
- package/dist/umd/index.umd.cjs +298 -0
- package/package.json +49 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { j as y } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { p as z } from "./utils-ziqvBIOU.js";
|
|
3
|
+
import { useState as a, useRef as H, useMemo as j, useEffect as g, cloneElement as V } from "react";
|
|
4
|
+
import { u as W } from "./hooks-Bj-aT2k8.js";
|
|
5
|
+
var x = /* @__PURE__ */ ((s) => (s.Horizontal = "Horizontal", s.Vertical = "Vertical", s))(x || {});
|
|
6
|
+
const q = ({
|
|
7
|
+
list: s,
|
|
8
|
+
style: C,
|
|
9
|
+
disable: n,
|
|
10
|
+
children: m,
|
|
11
|
+
sliderBox: v,
|
|
12
|
+
className: A,
|
|
13
|
+
sliderStyle: E,
|
|
14
|
+
duration: c = 300,
|
|
15
|
+
sliderClassName: $,
|
|
16
|
+
currentIndex: d = 0,
|
|
17
|
+
direction: i = x.Horizontal,
|
|
18
|
+
sliderTransitionTimingFunction: h = "ease-in-out"
|
|
19
|
+
}) => {
|
|
20
|
+
const [I, L] = a(!1), [t, S] = a(0), [f, R] = a({
|
|
21
|
+
t: 0,
|
|
22
|
+
l: 0
|
|
23
|
+
}), [u, k] = a({
|
|
24
|
+
w: 0,
|
|
25
|
+
h: 0
|
|
26
|
+
}), l = H(null), w = H(null), B = j(
|
|
27
|
+
() => ["width", "height", "transform"].map(
|
|
28
|
+
(e) => `${e} ${c / 1e3}s ${h}`
|
|
29
|
+
).join(","),
|
|
30
|
+
[i, c, h]
|
|
31
|
+
), N = j(
|
|
32
|
+
() => ({
|
|
33
|
+
width: u.w,
|
|
34
|
+
height: u.h,
|
|
35
|
+
transition: I ? B : "initial",
|
|
36
|
+
transform: `translate(${f.l}px, ${f.t}px)`
|
|
37
|
+
}),
|
|
38
|
+
[u, f]
|
|
39
|
+
), M = () => {
|
|
40
|
+
if (typeof t != "number" || !l.current || !w.current) return;
|
|
41
|
+
const e = Array.from(l.current.children).slice(
|
|
42
|
+
1
|
|
43
|
+
);
|
|
44
|
+
e.forEach((r) => {
|
|
45
|
+
r.style.position = "relative", r.style.cursor = n ? "not-allowed" : "pointer", r.style.zIndex = "1";
|
|
46
|
+
});
|
|
47
|
+
const o = window.getComputedStyle(l.current), p = {
|
|
48
|
+
t: i === "Horizontal" ? z(o.paddingTop) : e[t].offsetTop,
|
|
49
|
+
l: i === "Horizontal" ? e[t].offsetLeft : z(o.paddingLeft)
|
|
50
|
+
};
|
|
51
|
+
R(p), k({
|
|
52
|
+
w: e[t].offsetWidth,
|
|
53
|
+
h: e[t].offsetHeight
|
|
54
|
+
}), setTimeout(() => L(!0), c);
|
|
55
|
+
}, { w: P, h: T } = W();
|
|
56
|
+
return g(() => {
|
|
57
|
+
S(d);
|
|
58
|
+
}, [d]), g(() => {
|
|
59
|
+
M();
|
|
60
|
+
}, [t, P, T, n]), /* @__PURE__ */ y.jsxs(
|
|
61
|
+
"ul",
|
|
62
|
+
{
|
|
63
|
+
ref: l,
|
|
64
|
+
className: [
|
|
65
|
+
"ono-auto-slider-list-container",
|
|
66
|
+
A,
|
|
67
|
+
n ? "ono-auto-slider-list-is-disable" : ""
|
|
68
|
+
].filter(Boolean).join(" "),
|
|
69
|
+
style: {
|
|
70
|
+
flexDirection: i === "Horizontal" ? "row" : "column",
|
|
71
|
+
...C
|
|
72
|
+
},
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ y.jsx(
|
|
75
|
+
"li",
|
|
76
|
+
{
|
|
77
|
+
ref: w,
|
|
78
|
+
className: ["ono-auto-slider-list-slider", $].filter(Boolean).join(" "),
|
|
79
|
+
style: { ...E, ...N },
|
|
80
|
+
children: v
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
s.map(
|
|
84
|
+
(e, o) => V(
|
|
85
|
+
m({ item: e, index: o, isActive: o === t }),
|
|
86
|
+
{
|
|
87
|
+
onClick: (p) => {
|
|
88
|
+
if (n) return;
|
|
89
|
+
const r = m({
|
|
90
|
+
item: e,
|
|
91
|
+
index: o,
|
|
92
|
+
isActive: o === t
|
|
93
|
+
}).props.onClick;
|
|
94
|
+
r && r(p), S(o);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
q as A,
|
|
105
|
+
x as D
|
|
106
|
+
};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { j as p } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { useState as h, useRef as T, useEffect as q } from "react";
|
|
3
|
+
const K = ({
|
|
4
|
+
imageFile: v,
|
|
5
|
+
cvsW: $ = 520,
|
|
6
|
+
maskBG: B = "rgba(0, 0, 0, 0.5)",
|
|
7
|
+
border: y = "4px solid #fff",
|
|
8
|
+
wheelScale: j = 0.1,
|
|
9
|
+
setCtx: g,
|
|
10
|
+
maskInfo: e,
|
|
11
|
+
setMaskInfo: d,
|
|
12
|
+
imageStartState: D,
|
|
13
|
+
setImageStartState: R,
|
|
14
|
+
imageState: n,
|
|
15
|
+
setImageState: a
|
|
16
|
+
}) => {
|
|
17
|
+
const [x, E] = h(), [z, U] = h({ w: 0, h: 0 }), [c, X] = h({ w: 0, h: 0 }), [L, u] = h({ x: 0, y: 0 }), [C, b] = h(!1), f = T(null), i = T(null), s = (t, r) => {
|
|
18
|
+
r((l) => ({
|
|
19
|
+
...l,
|
|
20
|
+
...t
|
|
21
|
+
}));
|
|
22
|
+
}, O = () => {
|
|
23
|
+
if (!f.current) return;
|
|
24
|
+
const { width: t } = f.current.getBoundingClientRect();
|
|
25
|
+
G(t), U({ w: t, h: t });
|
|
26
|
+
}, N = () => {
|
|
27
|
+
const t = y.split(" ");
|
|
28
|
+
let r = 0;
|
|
29
|
+
return t.forEach((l) => {
|
|
30
|
+
l.includes("px") && (r = Number(l.split("px")[0]));
|
|
31
|
+
}), r;
|
|
32
|
+
}, G = (t) => {
|
|
33
|
+
const r = new Image();
|
|
34
|
+
typeof v == "string" ? r.src = v : r.src = URL.createObjectURL(v), r.onload = () => {
|
|
35
|
+
var P;
|
|
36
|
+
let l = 1, o = r.width, w = r.height;
|
|
37
|
+
o > w ? (l = o / t, o = t, w = w / l, s({ w }, d)) : (l = w / t, w = t, o = o / l, s({ w: o }, d));
|
|
38
|
+
const M = (t - o) / 2, Y = (t - w) / 2;
|
|
39
|
+
s({ w: r.width, h: r.height }, X), E(r), s(
|
|
40
|
+
{
|
|
41
|
+
w: o,
|
|
42
|
+
h: w,
|
|
43
|
+
t: Y,
|
|
44
|
+
l: M
|
|
45
|
+
},
|
|
46
|
+
a
|
|
47
|
+
), R({ w: o, h: w, t: Y, l: M }), M > Y ? s({ l: M }, d) : s({ l: Y }, d), g((P = i.current) == null ? void 0 : P.getContext("2d"));
|
|
48
|
+
};
|
|
49
|
+
}, A = () => {
|
|
50
|
+
b(!1), n.l > e.l && s({ l: e.l }, a), n.t > e.l && s({ t: e.l }, a), -n.l > n.w - e.l - e.w && s(
|
|
51
|
+
{ l: -(n.w - e.l - e.w) },
|
|
52
|
+
a
|
|
53
|
+
), -n.t > n.h - e.l - e.w && s(
|
|
54
|
+
{ t: -(n.h - e.l - e.w) },
|
|
55
|
+
a
|
|
56
|
+
);
|
|
57
|
+
}, H = (t, r) => {
|
|
58
|
+
const l = r === "in" ? t * j : -t * j;
|
|
59
|
+
let o = t + l;
|
|
60
|
+
return o > c.w && (o = c.w), o < D.w && (o = D.w), o;
|
|
61
|
+
}, J = (t) => {
|
|
62
|
+
t.preventDefault(), t.stopPropagation();
|
|
63
|
+
const r = t.deltaY < 0 ? "in" : "out", l = H(n.w, r), o = l / c.w;
|
|
64
|
+
s(
|
|
65
|
+
{
|
|
66
|
+
w: l,
|
|
67
|
+
h: c.h * o
|
|
68
|
+
},
|
|
69
|
+
a
|
|
70
|
+
), A();
|
|
71
|
+
};
|
|
72
|
+
return q(() => {
|
|
73
|
+
O();
|
|
74
|
+
}, [f]), q(() => {
|
|
75
|
+
if (!i.current || !x) return;
|
|
76
|
+
const t = i.current.getContext("2d");
|
|
77
|
+
t && (t.clearRect(
|
|
78
|
+
0,
|
|
79
|
+
0,
|
|
80
|
+
i.current.width,
|
|
81
|
+
i.current.height
|
|
82
|
+
), t.drawImage(
|
|
83
|
+
x,
|
|
84
|
+
n.l,
|
|
85
|
+
n.t,
|
|
86
|
+
n.w,
|
|
87
|
+
n.h
|
|
88
|
+
));
|
|
89
|
+
}, [i, x, n]), /* @__PURE__ */ p.jsxs(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
ref: f,
|
|
93
|
+
className: "ono-avatar-canvas",
|
|
94
|
+
style: {
|
|
95
|
+
width: $,
|
|
96
|
+
cursor: C ? "grabbing" : "grab"
|
|
97
|
+
},
|
|
98
|
+
onWheel: J,
|
|
99
|
+
onMouseUp: A,
|
|
100
|
+
onMouseLeave: A,
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ p.jsx(
|
|
103
|
+
"canvas",
|
|
104
|
+
{
|
|
105
|
+
width: z.w,
|
|
106
|
+
height: z.h,
|
|
107
|
+
ref: i,
|
|
108
|
+
onMouseDown: (t) => {
|
|
109
|
+
s({ x: t.clientX, y: t.clientY }, u), b(!0);
|
|
110
|
+
},
|
|
111
|
+
onMouseMove: (t) => {
|
|
112
|
+
if (C) {
|
|
113
|
+
const r = t.clientX - L.x, l = t.clientY - L.y;
|
|
114
|
+
(Math.abs(r) > 10 || Math.abs(l) > 10) && (s(
|
|
115
|
+
{
|
|
116
|
+
t: n.t + l,
|
|
117
|
+
l: n.l + r
|
|
118
|
+
},
|
|
119
|
+
a
|
|
120
|
+
), s({ x: t.clientX, y: t.clientY }, u));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
x && /* @__PURE__ */ p.jsx("div", { className: "ono-avatar-mask", children: /* @__PURE__ */ p.jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
style: {
|
|
129
|
+
border: y,
|
|
130
|
+
boxShadow: `${B} 0 0 0 10000px`,
|
|
131
|
+
width: `${e.w + N() * 2}px`,
|
|
132
|
+
height: `${e.w + N() * 2}px`
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
) })
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}, Z = ({
|
|
140
|
+
imageFile: v,
|
|
141
|
+
cvsW: $ = 520,
|
|
142
|
+
maskBG: B = "rgba(0, 0, 0, 0.5)",
|
|
143
|
+
border: y = "4px solid #fff",
|
|
144
|
+
wheelScale: j = 0.1,
|
|
145
|
+
children: g
|
|
146
|
+
}) => {
|
|
147
|
+
const [e, d] = h({
|
|
148
|
+
w: 0,
|
|
149
|
+
// 图片初始宽度
|
|
150
|
+
h: 0,
|
|
151
|
+
// 图片初始高度
|
|
152
|
+
t: 0,
|
|
153
|
+
// 图片初始离顶部距离
|
|
154
|
+
l: 0
|
|
155
|
+
// 图片初始离左侧距离
|
|
156
|
+
}), [D, R] = h({
|
|
157
|
+
w: 0,
|
|
158
|
+
// 当前图片宽度
|
|
159
|
+
h: 0,
|
|
160
|
+
// 当前图片高度
|
|
161
|
+
t: 0,
|
|
162
|
+
// 圖片當前離頂部距離
|
|
163
|
+
l: 0
|
|
164
|
+
// 圖片當前離左邊距離
|
|
165
|
+
}), [n, a] = h({
|
|
166
|
+
w: 0,
|
|
167
|
+
// 蒙版寬度
|
|
168
|
+
l: 0
|
|
169
|
+
// 蒙版初始离左侧距离
|
|
170
|
+
}), [x, E] = h(), z = (c) => {
|
|
171
|
+
R({
|
|
172
|
+
w: e.w,
|
|
173
|
+
h: e.h,
|
|
174
|
+
t: e.t,
|
|
175
|
+
l: e.l
|
|
176
|
+
}), c == null || c();
|
|
177
|
+
}, U = (c, X) => {
|
|
178
|
+
if (!x) return;
|
|
179
|
+
const L = x.getImageData(
|
|
180
|
+
n.l,
|
|
181
|
+
n.l,
|
|
182
|
+
n.w,
|
|
183
|
+
n.w
|
|
184
|
+
), u = document.createElement("canvas"), C = u.getContext("2d");
|
|
185
|
+
if (u.width = n.w, u.height = n.w, !C) return;
|
|
186
|
+
const {
|
|
187
|
+
imageSaveType: b = "png",
|
|
188
|
+
dataSaveType: f = "base64",
|
|
189
|
+
quality: i = 100
|
|
190
|
+
} = X || {};
|
|
191
|
+
C.putImageData(L, 0, 0, 0, 0, n.w, n.w), f === "base64" ? c(u.toDataURL(`image/${b}`, i / 100)) : f === "blob" && u.toBlob(
|
|
192
|
+
(s) => {
|
|
193
|
+
if (s) return c(s);
|
|
194
|
+
},
|
|
195
|
+
`image/${b}`,
|
|
196
|
+
i / 100
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
200
|
+
/* @__PURE__ */ p.jsx(
|
|
201
|
+
K,
|
|
202
|
+
{
|
|
203
|
+
imageFile: v,
|
|
204
|
+
cvsW: $,
|
|
205
|
+
maskBG: B,
|
|
206
|
+
border: y,
|
|
207
|
+
wheelScale: j,
|
|
208
|
+
maskInfo: n,
|
|
209
|
+
setMaskInfo: a,
|
|
210
|
+
setCtx: E,
|
|
211
|
+
imageStartState: e,
|
|
212
|
+
setImageStartState: d,
|
|
213
|
+
imageState: D,
|
|
214
|
+
setImageState: R
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
g == null ? void 0 : g({
|
|
218
|
+
handleConfirm: U,
|
|
219
|
+
handleReduction: z
|
|
220
|
+
})
|
|
221
|
+
] });
|
|
222
|
+
};
|
|
223
|
+
export {
|
|
224
|
+
Z as A
|
|
225
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { j as n } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { useState as R, useRef as u, useEffect as f } from "react";
|
|
3
|
+
const N = ({
|
|
4
|
+
onClick: d,
|
|
5
|
+
children: m,
|
|
6
|
+
disabled: s,
|
|
7
|
+
loading: e,
|
|
8
|
+
plain: p,
|
|
9
|
+
shape: c = "default",
|
|
10
|
+
htmlType: h = "button",
|
|
11
|
+
type: x = "primary",
|
|
12
|
+
className: j,
|
|
13
|
+
style: g,
|
|
14
|
+
icon: i
|
|
15
|
+
}) => {
|
|
16
|
+
const [a, l] = R(!1), o = u(null), r = u(null), b = () => {
|
|
17
|
+
if (!o.current) return;
|
|
18
|
+
const t = o.current, C = t.getBoundingClientRect();
|
|
19
|
+
t.style.setProperty("--btn-height", C.height + "px");
|
|
20
|
+
}, L = () => {
|
|
21
|
+
if (!r.current) return;
|
|
22
|
+
const t = r.current;
|
|
23
|
+
e ? (l(!0), t.classList.add("ono-loading-start")) : (setTimeout(() => {
|
|
24
|
+
l(!1);
|
|
25
|
+
}, 300), t.classList.remove("ono-loading-start"), t.classList.add("ono-loading-end"));
|
|
26
|
+
}, y = () => [
|
|
27
|
+
`ono-btn-${x}`,
|
|
28
|
+
e || a ? "is-loading" : "",
|
|
29
|
+
e || i ? "is-icon" : "",
|
|
30
|
+
s ? "is-disabled" : "",
|
|
31
|
+
c === "round" ? "is-round" : c === "circle" ? "is-circle" : "",
|
|
32
|
+
p ? "is-plain" : "",
|
|
33
|
+
j ?? ""
|
|
34
|
+
].filter(Boolean).join(" "), B = () => {
|
|
35
|
+
const t = /* @__PURE__ */ n.jsx("span", { ref: r, className: "ono-btn-icon", children: /* @__PURE__ */ n.jsx("span", { children: typeof e == "object" ? e.icon : /* @__PURE__ */ n.jsx(
|
|
36
|
+
"svg",
|
|
37
|
+
{
|
|
38
|
+
viewBox: "0 0 1024 1024",
|
|
39
|
+
focusable: "false",
|
|
40
|
+
"data-icon": "loading",
|
|
41
|
+
width: "1em",
|
|
42
|
+
height: "1em",
|
|
43
|
+
fill: "currentColor",
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
children: /* @__PURE__ */ n.jsx("path", { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" })
|
|
46
|
+
}
|
|
47
|
+
) }) });
|
|
48
|
+
return e || a ? t : i ? /* @__PURE__ */ n.jsx("span", { children: i }) : /* @__PURE__ */ n.jsx(n.Fragment, {});
|
|
49
|
+
};
|
|
50
|
+
return f(() => {
|
|
51
|
+
L();
|
|
52
|
+
}, [e, r]), f(() => {
|
|
53
|
+
b();
|
|
54
|
+
}, [o]), /* @__PURE__ */ n.jsxs(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
ref: o,
|
|
58
|
+
className: y(),
|
|
59
|
+
type: h,
|
|
60
|
+
disabled: (typeof s == "function" ? s() : s) || !!e,
|
|
61
|
+
style: g,
|
|
62
|
+
onClick: d,
|
|
63
|
+
children: [
|
|
64
|
+
B(),
|
|
65
|
+
m
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
N as B
|
|
72
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { j as a } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { useState as j, useRef as R, useEffect as l } from "react";
|
|
3
|
+
const $ = ({
|
|
4
|
+
src: r,
|
|
5
|
+
children: s,
|
|
6
|
+
enlarge: y = !1,
|
|
7
|
+
scale: i = 1.1,
|
|
8
|
+
shadow: c,
|
|
9
|
+
xRange: d = [-10, 10],
|
|
10
|
+
yRange: p = [-10, 10],
|
|
11
|
+
borderRadius: v = 20
|
|
12
|
+
}) => {
|
|
13
|
+
const [x, f] = j(!1), e = R(null), u = (t, o, n) => o / n * (t[1] - t[0]) + t[0], m = (t) => {
|
|
14
|
+
const { offsetX: o, offsetY: n } = t.nativeEvent, { offsetWidth: g, offsetHeight: M } = e.current, E = u(d, n, M), P = -u(p, o, g);
|
|
15
|
+
e.current.style.setProperty("--rx", `${E}deg`), e.current.style.setProperty("--ry", `${P}deg`);
|
|
16
|
+
};
|
|
17
|
+
return l(() => {
|
|
18
|
+
e.current && c && e.current.style.setProperty("--sd", c);
|
|
19
|
+
}, [e.current]), l(() => {
|
|
20
|
+
if (!s && !r) throw new Error("请传入children或者src属性");
|
|
21
|
+
}, [s, r]), /* @__PURE__ */ a.jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
ref: e,
|
|
25
|
+
className: "ono-card",
|
|
26
|
+
style: {
|
|
27
|
+
borderRadius: v,
|
|
28
|
+
transform: `perspective(500px) scale(${x && y ? i : 1}) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg))`
|
|
29
|
+
},
|
|
30
|
+
onMouseEnter: () => f(!0),
|
|
31
|
+
onMouseMove: m,
|
|
32
|
+
onMouseLeave: () => {
|
|
33
|
+
f(!1), e.current.style.setProperty("--rx", "0deg"), e.current.style.setProperty("--ry", "0deg");
|
|
34
|
+
},
|
|
35
|
+
children: s ?? /* @__PURE__ */ a.jsx("img", { src: r, alt: "图片" })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
$ as C
|
|
41
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { j as C } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { useState as d, useRef as k, useEffect as j } from "react";
|
|
3
|
+
const w = ({
|
|
4
|
+
id: u,
|
|
5
|
+
style: c,
|
|
6
|
+
checked: s,
|
|
7
|
+
onChange: p,
|
|
8
|
+
className: l,
|
|
9
|
+
indeterminate: n = !1,
|
|
10
|
+
checkedColor: i = "#0077cc",
|
|
11
|
+
indeterminateStyle: y = "line",
|
|
12
|
+
indeterminateColor: a = "#0077cc"
|
|
13
|
+
}) => {
|
|
14
|
+
const [f, h] = d(""), e = k(null), x = [
|
|
15
|
+
{
|
|
16
|
+
value: i,
|
|
17
|
+
name: "checkedColor"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: a,
|
|
21
|
+
name: "indeterminateColor"
|
|
22
|
+
}
|
|
23
|
+
], b = (t, r, o) => {
|
|
24
|
+
typeof t == "string" ? o.style.setProperty(`--${r}`, t) : o.style.setProperty(`--${r}`, `${t}px`);
|
|
25
|
+
}, m = () => {
|
|
26
|
+
if (!e.current) return;
|
|
27
|
+
const t = getComputedStyle(e.current);
|
|
28
|
+
f || h(t.borderColor), e.current.style.height = t.width, [
|
|
29
|
+
{
|
|
30
|
+
value: t.width,
|
|
31
|
+
name: "w"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: s || n ? i : f,
|
|
35
|
+
name: "border-color"
|
|
36
|
+
},
|
|
37
|
+
...x
|
|
38
|
+
].forEach(({ value: r, name: o }) => {
|
|
39
|
+
r && b(r, o, e.current);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return j(() => {
|
|
43
|
+
m(), e.current && (e.current.indeterminate = n);
|
|
44
|
+
}, [e, l, c, n]), /* @__PURE__ */ C.jsx(
|
|
45
|
+
"input",
|
|
46
|
+
{
|
|
47
|
+
id: u,
|
|
48
|
+
type: "checkbox",
|
|
49
|
+
ref: e,
|
|
50
|
+
checked: s,
|
|
51
|
+
onChange: p,
|
|
52
|
+
className: [
|
|
53
|
+
l,
|
|
54
|
+
y === "line" ? "ono-checkbox-line" : "ono-checkbox-border"
|
|
55
|
+
].filter(Boolean).join(" "),
|
|
56
|
+
style: c
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
w as C
|
|
62
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { j as i, R as j } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { a as p } from "./hooks-Bj-aT2k8.js";
|
|
3
|
+
let e = null, t;
|
|
4
|
+
const B = ({
|
|
5
|
+
className: n,
|
|
6
|
+
content: r,
|
|
7
|
+
style: u,
|
|
8
|
+
onClick: c,
|
|
9
|
+
onDoubleClick: l,
|
|
10
|
+
onContextMenu: s,
|
|
11
|
+
onMouseDown: m,
|
|
12
|
+
onMouseUp: d,
|
|
13
|
+
onMouseEnter: a,
|
|
14
|
+
onMouseLeave: x,
|
|
15
|
+
onMouseMove: f,
|
|
16
|
+
isClickBoxToClose: v
|
|
17
|
+
}) => (p("click", () => {
|
|
18
|
+
v && e && (e.remove(), e = null);
|
|
19
|
+
}), /* @__PURE__ */ i.jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: n,
|
|
23
|
+
style: u,
|
|
24
|
+
onClick: c,
|
|
25
|
+
onDoubleClick: l,
|
|
26
|
+
onContextMenu: s,
|
|
27
|
+
onMouseDown: m,
|
|
28
|
+
onMouseUp: d,
|
|
29
|
+
onMouseEnter: a,
|
|
30
|
+
onMouseLeave: x,
|
|
31
|
+
onMouseMove: f,
|
|
32
|
+
children: typeof r == "function" ? r((o) => {
|
|
33
|
+
e && (e.remove(), e = null, o && o());
|
|
34
|
+
}) : r
|
|
35
|
+
}
|
|
36
|
+
)), b = (n) => (R(n.isSingle || !1).render(/* @__PURE__ */ i.jsx(B, { ...n })), e), R = (n) => (n && e && t || (e = document.createElement("div"), document.body.appendChild(e), t = j.createRoot(e)), t);
|
|
37
|
+
export {
|
|
38
|
+
b as i
|
|
39
|
+
};
|