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,301 @@
|
|
|
1
|
+
import { j as o } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { useState as x, useRef as T, useEffect as P } from "react";
|
|
3
|
+
import { b as Y } from "./hooks-Bj-aT2k8.js";
|
|
4
|
+
const A = () => /* @__PURE__ */ o.jsx(
|
|
5
|
+
"svg",
|
|
6
|
+
{
|
|
7
|
+
className: "ono-input-icon",
|
|
8
|
+
viewBox: "64 64 896 896",
|
|
9
|
+
focusable: "false",
|
|
10
|
+
"data-icon": "close-circle",
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
children: /* @__PURE__ */ o.jsx("path", { d: "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" })
|
|
14
|
+
}
|
|
15
|
+
), $ = ({ open: e }) => /* @__PURE__ */ o.jsx(
|
|
16
|
+
"svg",
|
|
17
|
+
{
|
|
18
|
+
viewBox: "64 64 896 896",
|
|
19
|
+
focusable: "false",
|
|
20
|
+
"data-icon": e ? "eye" : "eye-invisible",
|
|
21
|
+
fill: "currentColor",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: "ono-input-icon",
|
|
24
|
+
children: e ? /* @__PURE__ */ o.jsx("path", { d: "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" }) : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ o.jsx("path", { d: "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" }),
|
|
26
|
+
/* @__PURE__ */ o.jsx("path", { d: "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" })
|
|
27
|
+
] })
|
|
28
|
+
}
|
|
29
|
+
), _ = ({
|
|
30
|
+
id: e,
|
|
31
|
+
name: l,
|
|
32
|
+
max: a,
|
|
33
|
+
min: c,
|
|
34
|
+
maxLength: s,
|
|
35
|
+
minLength: i,
|
|
36
|
+
type: v = "text",
|
|
37
|
+
className: d,
|
|
38
|
+
defaultValue: I,
|
|
39
|
+
placeholder: S,
|
|
40
|
+
readonly: D,
|
|
41
|
+
autocomplete: F = "off",
|
|
42
|
+
autofocus: L,
|
|
43
|
+
form: j,
|
|
44
|
+
disabled: b,
|
|
45
|
+
clearable: M,
|
|
46
|
+
showPassword: V,
|
|
47
|
+
prepend: f,
|
|
48
|
+
append: u,
|
|
49
|
+
prefix: w,
|
|
50
|
+
suffix: y,
|
|
51
|
+
showCount: O,
|
|
52
|
+
border: R = "1px solid #5644b8",
|
|
53
|
+
boxShadow: N = "0 0 0 2px #7969d11a",
|
|
54
|
+
value: z = "",
|
|
55
|
+
onChange: m,
|
|
56
|
+
onFocus: g,
|
|
57
|
+
onBlur: n,
|
|
58
|
+
onClear: E
|
|
59
|
+
}) => {
|
|
60
|
+
const [C, k] = x(z), [q, t] = x(!1), [r, h] = x(!1), H = T(null), B = M && !b && C, Q = V && !b, W = () => {
|
|
61
|
+
H.current && (H.current.style.setProperty("--ono-input-border", R), H.current.style.setProperty("--ono-input-box-shadow", N));
|
|
62
|
+
};
|
|
63
|
+
return P(() => {
|
|
64
|
+
W();
|
|
65
|
+
}, [H]), P(() => {
|
|
66
|
+
k(z);
|
|
67
|
+
}, [z]), /* @__PURE__ */ o.jsxs(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: [
|
|
71
|
+
"ono-input",
|
|
72
|
+
"ono-input-border",
|
|
73
|
+
b ? "ono-input-is-disabled" : ""
|
|
74
|
+
].filter(Boolean).join(" "),
|
|
75
|
+
children: [
|
|
76
|
+
f && /* @__PURE__ */ o.jsx("div", { className: "ono-prepend", children: f }),
|
|
77
|
+
/* @__PURE__ */ o.jsxs(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
ref: H,
|
|
81
|
+
className: [
|
|
82
|
+
"ono-input-wrapper",
|
|
83
|
+
q ? "ono-input-is-focus" : "",
|
|
84
|
+
d
|
|
85
|
+
].filter(Boolean).join(" "),
|
|
86
|
+
onMouseDown: (p) => {
|
|
87
|
+
p.target.tagName !== "INPUT" && p.preventDefault();
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
w && /* @__PURE__ */ o.jsx("span", { className: "ono-prefix", children: w }),
|
|
91
|
+
/* @__PURE__ */ o.jsx(
|
|
92
|
+
"input",
|
|
93
|
+
{
|
|
94
|
+
id: e,
|
|
95
|
+
max: a,
|
|
96
|
+
min: c,
|
|
97
|
+
name: l,
|
|
98
|
+
maxLength: s,
|
|
99
|
+
minLength: i,
|
|
100
|
+
defaultValue: I,
|
|
101
|
+
className: "ono-input-inner",
|
|
102
|
+
type: V ? r ? "text" : "password" : v,
|
|
103
|
+
placeholder: S,
|
|
104
|
+
readOnly: D,
|
|
105
|
+
autoComplete: F,
|
|
106
|
+
autoFocus: L,
|
|
107
|
+
form: j,
|
|
108
|
+
disabled: b,
|
|
109
|
+
onFocus: (p) => {
|
|
110
|
+
g == null || g(p), t(!0);
|
|
111
|
+
},
|
|
112
|
+
onBlur: (p) => {
|
|
113
|
+
n == null || n(p), t(!1);
|
|
114
|
+
},
|
|
115
|
+
value: C,
|
|
116
|
+
onChange: (p) => {
|
|
117
|
+
m == null || m(p), k(p.target.value);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
(y || B || Q || O) && /* @__PURE__ */ o.jsxs("span", { className: "ono-suffix", children: [
|
|
122
|
+
y,
|
|
123
|
+
B && /* @__PURE__ */ o.jsx(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
className: "ono-clear-icon",
|
|
127
|
+
onClick: () => {
|
|
128
|
+
E == null || E(), k("");
|
|
129
|
+
},
|
|
130
|
+
children: /* @__PURE__ */ o.jsx(A, {})
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
Q && /* @__PURE__ */ o.jsx(
|
|
134
|
+
"button",
|
|
135
|
+
{
|
|
136
|
+
className: "ono-eye-icon",
|
|
137
|
+
onClick: () => h(!r),
|
|
138
|
+
children: /* @__PURE__ */ o.jsx($, { open: r })
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
O && s && /* @__PURE__ */ o.jsxs("p", { className: "ono-count", children: [
|
|
142
|
+
C.length,
|
|
143
|
+
"/",
|
|
144
|
+
s
|
|
145
|
+
] })
|
|
146
|
+
] })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
u && /* @__PURE__ */ o.jsx("div", { className: "ono-append", children: u })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}, K = (e, l, a, c, s) => {
|
|
155
|
+
const i = e.parentNode;
|
|
156
|
+
e.style.resize = l ? "none" : a ? "vertical" : "none", i.style.setProperty("--ono-input-border", c), i.style.setProperty("--ono-input-box-shadow", s), i.style.setProperty("--ono-input-height", "auto");
|
|
157
|
+
}, U = (e, l) => {
|
|
158
|
+
const { minRows: a = 2, maxRows: c } = typeof l == "object" ? l : {}, s = document.createElement("div");
|
|
159
|
+
s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "pre-wrap", s.style.wordWrap = "break-word", s.style.width = `${e.clientWidth}px`, s.style.font = getComputedStyle(e).font, s.style.padding = getComputedStyle(e).padding, s.style.border = getComputedStyle(e).border, s.style.boxSizing = "border-box", document.body.appendChild(s);
|
|
160
|
+
const i = 34, v = a * i;
|
|
161
|
+
let d = v;
|
|
162
|
+
if (e.value) {
|
|
163
|
+
s.textContent = e.value;
|
|
164
|
+
const I = s.offsetHeight;
|
|
165
|
+
d = Math.max(v, I), c && d > c * i ? (d = c * i, e.style.overflowY = "auto") : e.style.overflowY = "hidden";
|
|
166
|
+
} else
|
|
167
|
+
e.style.overflowY = "hidden";
|
|
168
|
+
return e.style.height = `${d}px`, e.style.resize = l ? "none" : "vertical", document.body.removeChild(s), {
|
|
169
|
+
autoRows: Math.floor(d / i),
|
|
170
|
+
padding: 0,
|
|
171
|
+
// 不再需要精确计算这些值
|
|
172
|
+
lineHeight: 0,
|
|
173
|
+
borderWidth: 0
|
|
174
|
+
};
|
|
175
|
+
}, G = (e) => {
|
|
176
|
+
const { value: l, selectionStart: a, selectionEnd: c } = e, s = l.substring(0, a) + l.substring(c);
|
|
177
|
+
return e.value = s, e.setSelectionRange(a, a), s;
|
|
178
|
+
}, ee = ({
|
|
179
|
+
id: e,
|
|
180
|
+
name: l,
|
|
181
|
+
rows: a,
|
|
182
|
+
maxLength: c,
|
|
183
|
+
minLength: s,
|
|
184
|
+
className: i,
|
|
185
|
+
placeholder: v,
|
|
186
|
+
readonly: d,
|
|
187
|
+
resize: I = !0,
|
|
188
|
+
autocomplete: S = "off",
|
|
189
|
+
autofocus: D,
|
|
190
|
+
form: F,
|
|
191
|
+
disabled: L,
|
|
192
|
+
autoSize: j,
|
|
193
|
+
showCount: b,
|
|
194
|
+
border: M = "1px solid #5644b8",
|
|
195
|
+
boxShadow: V = "0 0 0 2px #7969d11a",
|
|
196
|
+
value: f = "",
|
|
197
|
+
onChange: u
|
|
198
|
+
}) => {
|
|
199
|
+
const [w, y] = x(f), [O, R] = x(!1), [N, z] = x([f]), [m, g] = x(0), n = T(null), E = () => {
|
|
200
|
+
if (!n.current) return;
|
|
201
|
+
const t = n.current;
|
|
202
|
+
K(t, j || !1, I, M, V), j && U(t, j);
|
|
203
|
+
}, C = (t) => {
|
|
204
|
+
const r = N.slice(0, m + 1);
|
|
205
|
+
r.push(t), z(r), g(r.length - 1);
|
|
206
|
+
}, k = () => {
|
|
207
|
+
if (m > 0 && n.current) {
|
|
208
|
+
const t = m - 1, r = N[t];
|
|
209
|
+
if (n.current.value = r, y(r), g(t), u) {
|
|
210
|
+
const h = {
|
|
211
|
+
target: n.current
|
|
212
|
+
};
|
|
213
|
+
u(h);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
return [
|
|
218
|
+
{
|
|
219
|
+
key: "CommandOrControl+z",
|
|
220
|
+
handler: (t) => {
|
|
221
|
+
document.activeElement === n.current && (t.preventDefault(), k());
|
|
222
|
+
},
|
|
223
|
+
deps: [N]
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
key: "CommandOrControl+d",
|
|
227
|
+
handler: (t) => {
|
|
228
|
+
if (n.current && document.activeElement === n.current) {
|
|
229
|
+
t.preventDefault();
|
|
230
|
+
const r = G(n.current);
|
|
231
|
+
if (y(r), C(r), u) {
|
|
232
|
+
const h = {
|
|
233
|
+
target: n.current
|
|
234
|
+
};
|
|
235
|
+
u(h);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
deps: [N]
|
|
240
|
+
}
|
|
241
|
+
].forEach(
|
|
242
|
+
({ key: t, handler: r, deps: h }) => Y(t, r, {
|
|
243
|
+
target: n.current,
|
|
244
|
+
deps: h
|
|
245
|
+
})
|
|
246
|
+
), P(() => {
|
|
247
|
+
y(f);
|
|
248
|
+
}, [f]), P(() => {
|
|
249
|
+
E();
|
|
250
|
+
}, [n, j, w]), /* @__PURE__ */ o.jsxs(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
className: ["ono-textarea", L ? "ono-input-is-disabled" : ""].filter(Boolean).join(" "),
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ o.jsx(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
className: [
|
|
259
|
+
"ono-textarea-wrapper",
|
|
260
|
+
O ? M === "none" ? "" : "ono-input-is-focus" : "",
|
|
261
|
+
i
|
|
262
|
+
].filter(Boolean).join(" "),
|
|
263
|
+
onClick: () => {
|
|
264
|
+
var t;
|
|
265
|
+
return (t = n.current) == null ? void 0 : t.focus();
|
|
266
|
+
},
|
|
267
|
+
children: /* @__PURE__ */ o.jsx(
|
|
268
|
+
"textarea",
|
|
269
|
+
{
|
|
270
|
+
ref: n,
|
|
271
|
+
className: "ono-textarea-inner",
|
|
272
|
+
id: e,
|
|
273
|
+
rows: a,
|
|
274
|
+
name: l,
|
|
275
|
+
maxLength: c,
|
|
276
|
+
minLength: s,
|
|
277
|
+
placeholder: v,
|
|
278
|
+
readOnly: d,
|
|
279
|
+
autoComplete: S,
|
|
280
|
+
autoFocus: D,
|
|
281
|
+
form: F,
|
|
282
|
+
disabled: L,
|
|
283
|
+
onFocus: () => R(!0),
|
|
284
|
+
onBlur: () => R(!1),
|
|
285
|
+
value: w,
|
|
286
|
+
onChange: (t) => {
|
|
287
|
+
y(t.target.value), C(t.target.value), u == null || u(t);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
b && c && /* @__PURE__ */ o.jsx("p", { className: "ono-count-bar", onClick: (t) => t.stopPropagation(), children: w.length + "/" + c })
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
export {
|
|
299
|
+
_ as O,
|
|
300
|
+
ee as a
|
|
301
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState as y, useEffect as D } from "react";
|
|
2
|
+
const w = ({
|
|
3
|
+
list: n,
|
|
4
|
+
children: u,
|
|
5
|
+
fallback: i,
|
|
6
|
+
deps: f = [],
|
|
7
|
+
insertBetweenDom: p
|
|
8
|
+
}) => {
|
|
9
|
+
const [a, c] = y([]), t = (e) => e.map(u).filter((s) => s), o = (e, s) => s ? e.reduce((h, L, m) => (h.push(L), m < e.length - 1 && h.push(s(m)), h), []) : e, r = async () => {
|
|
10
|
+
if (!n) return;
|
|
11
|
+
c(i);
|
|
12
|
+
const e = typeof n == "function" ? await n() : n;
|
|
13
|
+
c(
|
|
14
|
+
e.length > 0 ? o(t(e), p) : i
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
return D(() => {
|
|
18
|
+
r();
|
|
19
|
+
}, [...f]), a;
|
|
20
|
+
}, B = ({
|
|
21
|
+
list: n,
|
|
22
|
+
children: u,
|
|
23
|
+
fallback: i,
|
|
24
|
+
insertBetweenDom: f
|
|
25
|
+
}) => {
|
|
26
|
+
const p = (t) => t.map(u).filter(Boolean), a = (t, o) => o ? t.reduce((r, e, s) => (r.push(e), s < t.length - 1 && r.push(o(s)), r), []) : t;
|
|
27
|
+
return (() => {
|
|
28
|
+
const t = typeof n == "function" ? n() : n;
|
|
29
|
+
return t.length > 0 ? a(p(t), f) : i;
|
|
30
|
+
})();
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
w as A,
|
|
34
|
+
B as L
|
|
35
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { j as m } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { useState as b, useEffect as g } from "react";
|
|
3
|
+
const S = ({
|
|
4
|
+
active: l,
|
|
5
|
+
onchange: r,
|
|
6
|
+
w: t = "40px",
|
|
7
|
+
duration: d = 400,
|
|
8
|
+
clr: c = "#f5f5f5",
|
|
9
|
+
bgc: h = "#342A7C"
|
|
10
|
+
}) => {
|
|
11
|
+
const [s, u] = b(!1), e = (a, i) => {
|
|
12
|
+
let f;
|
|
13
|
+
const o = a.split(""), x = o.length;
|
|
14
|
+
return o[x - 1] === "x" && (f = `${Number(o.slice(0, -2).join("")) * i}px`), f;
|
|
15
|
+
}, n = {
|
|
16
|
+
width: e(t, 0.6),
|
|
17
|
+
height: e(t, 0.06),
|
|
18
|
+
left: s ? e(t, 0.11) : e(t, 0.2),
|
|
19
|
+
borderRadius: e(t, 1),
|
|
20
|
+
background: c,
|
|
21
|
+
transition: `all ${d / 1e3}s`
|
|
22
|
+
}, p = [
|
|
23
|
+
{
|
|
24
|
+
...n,
|
|
25
|
+
width: s ? e(t, 0.8) : e(t, 0.5),
|
|
26
|
+
height: s ? e(t, 0.05) : e(t, 0.06),
|
|
27
|
+
transform: s ? "translateY(0) rotate(45deg)" : `translateY(-${e(t, 0.22)})`
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
...n,
|
|
31
|
+
width: s ? e(t, 0.8) : e(t, 0.3),
|
|
32
|
+
height: s ? e(t, 0.05) : e(t, 0.06),
|
|
33
|
+
transform: s ? "translateY(0) rotate(315deg)" : `translateY(${e(t, 0.22)})`
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
...n,
|
|
37
|
+
left: "auto",
|
|
38
|
+
transform: s ? `translateX(${e(t, 1.1)})` : "translateX(0)"
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
return g(() => {
|
|
42
|
+
u(!!l);
|
|
43
|
+
}, [l]), /* @__PURE__ */ m.jsx(
|
|
44
|
+
"button",
|
|
45
|
+
{
|
|
46
|
+
className: "ono-menu-button",
|
|
47
|
+
style: {
|
|
48
|
+
width: t,
|
|
49
|
+
height: t,
|
|
50
|
+
background: h,
|
|
51
|
+
borderRadius: e(t, 0.2)
|
|
52
|
+
},
|
|
53
|
+
onClick: () => requestAnimationFrame(() => {
|
|
54
|
+
r == null || r(!s), u(!s);
|
|
55
|
+
}),
|
|
56
|
+
children: p.map((a, i) => /* @__PURE__ */ m.jsx("span", { style: { ...a } }, i))
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
S as M
|
|
62
|
+
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { j as t } from "./dependencies-DWmdjl5u.js";
|
|
2
|
+
import { useState as m, useRef as v, useMemo as J, useCallback as Q, useEffect as j } from "react";
|
|
3
|
+
import { c, g as U, a as W, b as X, d as B, e as Y } from "./utils-ziqvBIOU.js";
|
|
4
|
+
const Z = {
|
|
5
|
+
info: { light: "#1677ff", dark: "#1677ff" },
|
|
6
|
+
success: { light: "#52c41a", dark: "#49aa19" },
|
|
7
|
+
error: { light: "#ff4d4f", dark: "#a61d24" },
|
|
8
|
+
warning: { light: "#faad14", dark: "#d89614" },
|
|
9
|
+
loading: { light: "#9254de", dark: "#f5f5f5" }
|
|
10
|
+
}, d = (e, a) => Z[e][a], k = (e) => {
|
|
11
|
+
switch (e) {
|
|
12
|
+
case "success":
|
|
13
|
+
return /* @__PURE__ */ t.jsx(
|
|
14
|
+
"svg",
|
|
15
|
+
{
|
|
16
|
+
className: "ono-type-icon",
|
|
17
|
+
viewBox: "0 0 1024 1024",
|
|
18
|
+
focusable: "false",
|
|
19
|
+
"data-icon": "check-circle",
|
|
20
|
+
fill: d(e, "light"),
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: /* @__PURE__ */ t.jsx("path", { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
case "error":
|
|
26
|
+
return /* @__PURE__ */ t.jsx(
|
|
27
|
+
"svg",
|
|
28
|
+
{
|
|
29
|
+
className: "ono-type-icon",
|
|
30
|
+
viewBox: "0 0 1024 1024",
|
|
31
|
+
focusable: "false",
|
|
32
|
+
"data-icon": "close-circle",
|
|
33
|
+
fill: d(e, "light"),
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children: /* @__PURE__ */ t.jsx("path", { d: "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
case "loading":
|
|
39
|
+
return /* @__PURE__ */ t.jsx(
|
|
40
|
+
"svg",
|
|
41
|
+
{
|
|
42
|
+
className: ["ono-info-icon", "ono-loading"].join(" "),
|
|
43
|
+
viewBox: "0 0 1024 1024",
|
|
44
|
+
focusable: "false",
|
|
45
|
+
"data-icon": "loading",
|
|
46
|
+
fill: d(e, "light"),
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
children: /* @__PURE__ */ t.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" })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
default:
|
|
52
|
+
return /* @__PURE__ */ t.jsx(
|
|
53
|
+
"svg",
|
|
54
|
+
{
|
|
55
|
+
className: "ono-info-icon",
|
|
56
|
+
viewBox: "64 64 896 896",
|
|
57
|
+
focusable: "false",
|
|
58
|
+
"data-icon": "exclamation-circle",
|
|
59
|
+
fill: d(e, "light"),
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
children: /* @__PURE__ */ t.jsx("path", { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" })
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}, P = ({ handleDestroy: e }) => /* @__PURE__ */ t.jsx("button", { onClick: e, children: /* @__PURE__ */ t.jsx(
|
|
66
|
+
"svg",
|
|
67
|
+
{
|
|
68
|
+
className: "ono-clear-icon",
|
|
69
|
+
viewBox: "64 64 896 896",
|
|
70
|
+
focusable: "false",
|
|
71
|
+
"data-icon": "close-circle",
|
|
72
|
+
fill: "currentColor",
|
|
73
|
+
"aria-hidden": "true",
|
|
74
|
+
children: /* @__PURE__ */ t.jsx("path", { d: "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" })
|
|
75
|
+
}
|
|
76
|
+
) }), i = ({
|
|
77
|
+
id: e,
|
|
78
|
+
instancesKey: a,
|
|
79
|
+
duration: z = 3e3,
|
|
80
|
+
speed: u = 300,
|
|
81
|
+
offset: M = 20,
|
|
82
|
+
message: T,
|
|
83
|
+
type: b,
|
|
84
|
+
plain: O = !0,
|
|
85
|
+
showClose: S = !1,
|
|
86
|
+
zIndex: I,
|
|
87
|
+
onClose: N = () => {
|
|
88
|
+
},
|
|
89
|
+
destroy: $
|
|
90
|
+
}) => {
|
|
91
|
+
const [, R] = m(!1), [h, E] = m(0), [f, F] = m(U(e)), [s, H] = m({ duration: z, speed: u, message: T, type: b, showClose: S, onClose: N }), K = (n) => H((r) => ({ ...r, ...n })), g = v(null), p = v(null), o = v(null), C = f + h, q = J(
|
|
92
|
+
() => ({
|
|
93
|
+
transform: `translate(-50%, ${f}px)`,
|
|
94
|
+
transition: `transform ${u}ms ease-in-out`,
|
|
95
|
+
zIndex: I
|
|
96
|
+
}),
|
|
97
|
+
[f, u]
|
|
98
|
+
), x = () => {
|
|
99
|
+
o.current && (o.current.classList.remove("ono-message-enter"), o.current.classList.add("ono-message-leave"), o.current.style.transform = `translate(-50%, ${B(e) - h}px)`, Y(e), setTimeout(() => $(s.onClose), u));
|
|
100
|
+
}, y = (n, r, G) => {
|
|
101
|
+
n !== "loading" && (g.current = setTimeout(x, r - G));
|
|
102
|
+
}, A = () => {
|
|
103
|
+
g.current && (clearTimeout(g.current), g.current = null);
|
|
104
|
+
}, D = () => {
|
|
105
|
+
if (!o.current) return;
|
|
106
|
+
const { height: n } = o.current.getBoundingClientRect();
|
|
107
|
+
o.current.style.setProperty(
|
|
108
|
+
"--speed",
|
|
109
|
+
`${s.speed}ms`
|
|
110
|
+
), E(n);
|
|
111
|
+
}, L = () => {
|
|
112
|
+
const n = B(e);
|
|
113
|
+
R((r) => (r && F(n + M), !0)), requestAnimationFrame(L);
|
|
114
|
+
}, V = () => [
|
|
115
|
+
"ono-message",
|
|
116
|
+
`ono-message-${s.type}`,
|
|
117
|
+
"ono-message-enter",
|
|
118
|
+
O ? "" : "ono-message-color"
|
|
119
|
+
].filter(Boolean).join(" "), w = Q(() => {
|
|
120
|
+
if (s.type === "loading") {
|
|
121
|
+
if (p.current) return;
|
|
122
|
+
p.current = setTimeout(() => {
|
|
123
|
+
p.current = null;
|
|
124
|
+
const n = W(
|
|
125
|
+
a || ""
|
|
126
|
+
);
|
|
127
|
+
n && (K({ ...n }), y(
|
|
128
|
+
s.type,
|
|
129
|
+
n.duration || s.duration,
|
|
130
|
+
n.speed || s.speed
|
|
131
|
+
), w());
|
|
132
|
+
}, 100);
|
|
133
|
+
}
|
|
134
|
+
}, [s]);
|
|
135
|
+
return j(() => {
|
|
136
|
+
y(
|
|
137
|
+
s.type,
|
|
138
|
+
s.duration,
|
|
139
|
+
s.speed
|
|
140
|
+
), L(), w();
|
|
141
|
+
}, [s.type, s.duration, s.speed]), j(() => {
|
|
142
|
+
D();
|
|
143
|
+
}, [o]), j(() => {
|
|
144
|
+
X(e, {
|
|
145
|
+
topOffset: f,
|
|
146
|
+
height: h,
|
|
147
|
+
bottomOffset: C
|
|
148
|
+
});
|
|
149
|
+
}, [C]), /* @__PURE__ */ t.jsx(
|
|
150
|
+
"div",
|
|
151
|
+
{
|
|
152
|
+
ref: o,
|
|
153
|
+
className: V(),
|
|
154
|
+
style: q,
|
|
155
|
+
onMouseEnter: A,
|
|
156
|
+
onMouseLeave: () => y(
|
|
157
|
+
s.type,
|
|
158
|
+
s.duration,
|
|
159
|
+
s.speed
|
|
160
|
+
),
|
|
161
|
+
children: typeof s.message == "function" ? s.message(
|
|
162
|
+
k(s.type),
|
|
163
|
+
s.showClose && /* @__PURE__ */ t.jsx(P, { handleDestroy: x })
|
|
164
|
+
) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
165
|
+
k(s.type),
|
|
166
|
+
/* @__PURE__ */ t.jsx("div", { children: s.message }),
|
|
167
|
+
s.showClose && /* @__PURE__ */ t.jsx(P, { handleDestroy: x })
|
|
168
|
+
] })
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}, l = (e) => {
|
|
172
|
+
if (typeof e == "string")
|
|
173
|
+
return {
|
|
174
|
+
message: e
|
|
175
|
+
};
|
|
176
|
+
{
|
|
177
|
+
const a = { ...e, instancesKey: e.key };
|
|
178
|
+
return delete a.key, { ...a };
|
|
179
|
+
}
|
|
180
|
+
}, t0 = {
|
|
181
|
+
info: (e) => {
|
|
182
|
+
c(
|
|
183
|
+
i,
|
|
184
|
+
{ ...l(e), type: "info" },
|
|
185
|
+
"ono-message"
|
|
186
|
+
);
|
|
187
|
+
},
|
|
188
|
+
success: (e) => {
|
|
189
|
+
c(
|
|
190
|
+
i,
|
|
191
|
+
{ ...l(e), type: "success" },
|
|
192
|
+
"ono-message"
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
warning: (e) => {
|
|
196
|
+
c(
|
|
197
|
+
i,
|
|
198
|
+
{ ...l(e), type: "warning" },
|
|
199
|
+
"ono-message"
|
|
200
|
+
);
|
|
201
|
+
},
|
|
202
|
+
error: (e) => {
|
|
203
|
+
c(
|
|
204
|
+
i,
|
|
205
|
+
{ ...l(e), type: "error" },
|
|
206
|
+
"ono-message"
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
loading: (e) => {
|
|
210
|
+
c(
|
|
211
|
+
i,
|
|
212
|
+
{ ...l(e), type: "loading" },
|
|
213
|
+
"ono-message"
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
export {
|
|
218
|
+
t0 as m
|
|
219
|
+
};
|