@turinhub/atomix-common-ui 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +20 -2
  2. package/dist/AuthPanel-CTKx618F.cjs +2 -0
  3. package/dist/AuthPanel-CTKx618F.cjs.map +1 -0
  4. package/dist/AuthPanel-Cn_WwmjX.js +703 -0
  5. package/dist/AuthPanel-Cn_WwmjX.js.map +1 -0
  6. package/dist/PDFSidebar-4DtXqqzN.cjs +2 -0
  7. package/dist/PDFSidebar-4DtXqqzN.cjs.map +1 -0
  8. package/dist/PDFSidebar-ClnrF4Br.js +239 -0
  9. package/dist/PDFSidebar-ClnrF4Br.js.map +1 -0
  10. package/dist/auth.cjs +2 -0
  11. package/dist/auth.cjs.map +1 -0
  12. package/dist/auth.d.ts +11 -0
  13. package/dist/auth.d.ts.map +1 -0
  14. package/dist/auth.js +9 -0
  15. package/dist/auth.js.map +1 -0
  16. package/dist/components/AuthLoginPanel.d.ts +55 -0
  17. package/dist/components/AuthLoginPanel.d.ts.map +1 -0
  18. package/dist/components/AuthPageShell.d.ts +11 -0
  19. package/dist/components/AuthPageShell.d.ts.map +1 -0
  20. package/dist/components/AuthPanel.d.ts +20 -0
  21. package/dist/components/AuthPanel.d.ts.map +1 -0
  22. package/dist/components/AuthRegisterPanel.d.ts +34 -0
  23. package/dist/components/AuthRegisterPanel.d.ts.map +1 -0
  24. package/dist/components/AuthVisualCarousel.d.ts +22 -0
  25. package/dist/components/AuthVisualCarousel.d.ts.map +1 -0
  26. package/dist/components/DataTable.d.ts +2 -2
  27. package/dist/components/DataTable.d.ts.map +1 -1
  28. package/dist/components/ImageReader.d.ts +44 -0
  29. package/dist/components/ImageReader.d.ts.map +1 -0
  30. package/dist/components/MarkdownReader.d.ts.map +1 -1
  31. package/dist/components/PDFReader.d.ts.map +1 -1
  32. package/dist/components/PDFSidebar.d.ts.map +1 -1
  33. package/dist/components/SimplePDFReader.d.ts.map +1 -1
  34. package/dist/components/TableHeader.d.ts.map +1 -1
  35. package/dist/components/TablePagination.d.ts +2 -1
  36. package/dist/components/TablePagination.d.ts.map +1 -1
  37. package/dist/components/VideoReader.d.ts +39 -0
  38. package/dist/components/VideoReader.d.ts.map +1 -0
  39. package/dist/components/media-utils.d.ts +9 -0
  40. package/dist/components/media-utils.d.ts.map +1 -0
  41. package/dist/components/ui/switch.d.ts +5 -0
  42. package/dist/components/ui/switch.d.ts.map +1 -0
  43. package/dist/data-table.cjs +1 -1
  44. package/dist/data-table.cjs.map +1 -1
  45. package/dist/data-table.js +83 -73
  46. package/dist/data-table.js.map +1 -1
  47. package/dist/file-upload.cjs +1 -1
  48. package/dist/file-upload.cjs.map +1 -1
  49. package/dist/file-upload.js +36 -36
  50. package/dist/file-upload.js.map +1 -1
  51. package/dist/image-reader.cjs +2 -0
  52. package/dist/image-reader.cjs.map +1 -0
  53. package/dist/image-reader.d.ts +3 -0
  54. package/dist/image-reader.d.ts.map +1 -0
  55. package/dist/image-reader.js +215 -0
  56. package/dist/image-reader.js.map +1 -0
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.d.ts +10 -0
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +8 -2
  61. package/dist/index.js.map +1 -1
  62. package/dist/markdown-reader.cjs +1 -1
  63. package/dist/markdown-reader.cjs.map +1 -1
  64. package/dist/markdown-reader.js +28 -24
  65. package/dist/markdown-reader.js.map +1 -1
  66. package/dist/media-utils-5UPuocc1.js +23 -0
  67. package/dist/media-utils-5UPuocc1.js.map +1 -0
  68. package/dist/media-utils-X1dDYP9W.cjs +2 -0
  69. package/dist/media-utils-X1dDYP9W.cjs.map +1 -0
  70. package/dist/pdf-reader.cjs +1 -1
  71. package/dist/pdf-reader.cjs.map +1 -1
  72. package/dist/pdf-reader.js +170 -121
  73. package/dist/pdf-reader.js.map +1 -1
  74. package/dist/pdf-sidebar.cjs +1 -1
  75. package/dist/pdf-sidebar.js +1 -1
  76. package/dist/simple-pdf-reader.cjs +1 -1
  77. package/dist/simple-pdf-reader.cjs.map +1 -1
  78. package/dist/simple-pdf-reader.js +138 -105
  79. package/dist/simple-pdf-reader.js.map +1 -1
  80. package/dist/table-header.cjs +1 -1
  81. package/dist/table-header.cjs.map +1 -1
  82. package/dist/table-header.js +42 -34
  83. package/dist/table-header.js.map +1 -1
  84. package/dist/table-pagination.cjs +1 -1
  85. package/dist/table-pagination.cjs.map +1 -1
  86. package/dist/table-pagination.js +49 -43
  87. package/dist/table-pagination.js.map +1 -1
  88. package/dist/types/component-types.d.ts +2 -0
  89. package/dist/types/component-types.d.ts.map +1 -1
  90. package/dist/video-reader.cjs +2 -0
  91. package/dist/video-reader.cjs.map +1 -0
  92. package/dist/video-reader.d.ts +3 -0
  93. package/dist/video-reader.d.ts.map +1 -0
  94. package/dist/video-reader.js +158 -0
  95. package/dist/video-reader.js.map +1 -0
  96. package/package.json +32 -1
  97. package/dist/PDFSidebar-BBtucLK6.js +0 -232
  98. package/dist/PDFSidebar-BBtucLK6.js.map +0 -1
  99. package/dist/PDFSidebar-Di0D-yPS.cjs +0 -2
  100. package/dist/PDFSidebar-Di0D-yPS.cjs.map +0 -1
  101. package/dist/index-BiA_tnaq.cjs +0 -13
  102. package/dist/index-BiA_tnaq.cjs.map +0 -1
  103. package/dist/index-BypbGNpR.js +0 -18821
  104. package/dist/index-BypbGNpR.js.map +0 -1
@@ -0,0 +1,703 @@
1
+ import { j as e } from "./jsx-runtime-B4hRZ52C.js";
2
+ import { c as y } from "./utils-B6yFEsav.js";
3
+ import { useState as l, useMemo as ge, useEffect as re } from "react";
4
+ import { Layers3 as ce, MessageCircle as oe, Loader2 as Q, ArrowRight as te, UserRound as de, LockKeyhole as ae } from "lucide-react";
5
+ const fe = (s) => /^1[3-9]\d{9}$/.test(s) ? void 0 : "请输入正确的手机号", se = (s, i) => s instanceof Error && s.message ? s.message : typeof s == "string" && s ? s : i, be = (s) => s.replace(/\D/g, "").slice(0, 11), je = (s) => s.length <= 3 ? s : s.length <= 7 ? `${s.slice(0, 3)} ${s.slice(3)}` : `${s.slice(0, 3)} ${s.slice(3, 7)} ${s.slice(7)}`;
6
+ function we({
7
+ components: s,
8
+ title: i = "欢迎登录",
9
+ description: p = "使用账号密码或手机号验证码进入系统",
10
+ brandIcon: g,
11
+ defaultMethod: u = "password",
12
+ enabledMethods: m = ["password", "sms"],
13
+ error: A,
14
+ extraActions: k,
15
+ footer: c,
16
+ socialProviders: f,
17
+ className: j,
18
+ smsCountdownSeconds: w = 60,
19
+ validatePhone: x = fe,
20
+ validatePassword: h,
21
+ onPasswordLogin: v,
22
+ onSendSmsCode: C,
23
+ onSmsLogin: F
24
+ }) {
25
+ const [z, t] = l(
26
+ m.includes(u) ? u : m[0]
27
+ ), [r, W] = l(""), [X, Y] = l(), [Z, B] = l(), [R, b] = l(), [$, K] = l(!1), [U, V] = l(!1), [H, E] = l(!1), [D, O] = l(0), I = ge(
28
+ () => m.filter(
29
+ (a, d, T) => T.indexOf(a) === d
30
+ ),
31
+ [m]
32
+ ), _ = I.length > 1, S = R || A;
33
+ if (re(() => {
34
+ if (D <= 0) return;
35
+ const a = setTimeout(() => O((d) => d - 1), 1e3);
36
+ return () => clearTimeout(a);
37
+ }, [D]), !s)
38
+ return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
39
+ const { Button: q, Input: M, Label: L, Tabs: n, TabsList: o, TabsTrigger: N, TabsContent: G } = s, P = async (a) => {
40
+ a.preventDefault();
41
+ const d = new FormData(a.currentTarget), T = {
42
+ username: String(d.get("username") || "").trim(),
43
+ password: String(d.get("password") || "")
44
+ }, J = !T.username || !T.password ? "请输入账号和密码" : h == null ? void 0 : h(T);
45
+ if (J) {
46
+ b(J);
47
+ return;
48
+ }
49
+ try {
50
+ K(!0), b(void 0), await (v == null ? void 0 : v(T));
51
+ } catch (ee) {
52
+ b(se(ee, "登录失败,请稍后重试"));
53
+ } finally {
54
+ K(!1);
55
+ }
56
+ }, ue = async () => {
57
+ const a = x(r);
58
+ if (a) {
59
+ b(a);
60
+ return;
61
+ }
62
+ try {
63
+ E(!0), b(void 0);
64
+ const d = await (C == null ? void 0 : C(r));
65
+ Y(d == null ? void 0 : d.smsId), B(d == null ? void 0 : d.smsType), O(w);
66
+ } catch (d) {
67
+ b(se(d, "发送验证码失败,请稍后重试"));
68
+ } finally {
69
+ E(!1);
70
+ }
71
+ }, me = async (a) => {
72
+ a.preventDefault();
73
+ const d = new FormData(a.currentTarget), T = String(d.get("code") || "").trim(), J = x(r);
74
+ if (J) {
75
+ b(J);
76
+ return;
77
+ }
78
+ if (!T) {
79
+ b("请输入验证码");
80
+ return;
81
+ }
82
+ try {
83
+ V(!0), b(void 0), await (F == null ? void 0 : F({ phone: r, code: T, smsId: X, smsType: Z }));
84
+ } catch (ee) {
85
+ b(se(ee, "验证码错误或已过期"));
86
+ } finally {
87
+ V(!1);
88
+ }
89
+ }, he = () => /* @__PURE__ */ e.jsxs("div", { className: "mb-7", children: [
90
+ /* @__PURE__ */ e.jsx("div", { className: "mb-4 flex h-11 w-11 items-center justify-center rounded-lg bg-primary text-primary-foreground shadow-sm ring-1 ring-primary/10", children: g || /* @__PURE__ */ e.jsx(ce, { className: "h-5 w-5" }) }),
91
+ /* @__PURE__ */ e.jsx("h1", { className: "text-balance text-2xl font-semibold leading-tight", children: i }),
92
+ p && /* @__PURE__ */ e.jsx("p", { className: "mt-2 text-pretty text-sm leading-6 text-muted-foreground", children: p })
93
+ ] }), xe = () => f != null && f.length ? /* @__PURE__ */ e.jsx("div", { className: "mb-6 grid gap-2", children: f.map((a) => /* @__PURE__ */ e.jsxs(
94
+ q,
95
+ {
96
+ type: "button",
97
+ variant: "outline",
98
+ className: "h-10 w-full",
99
+ disabled: a.disabled,
100
+ onClick: a.onClick,
101
+ children: [
102
+ a.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex h-4 w-4 items-center justify-center", children: a.icon }),
103
+ a.label
104
+ ]
105
+ },
106
+ a.id
107
+ )) }) : null, ne = () => /* @__PURE__ */ e.jsx("form", { className: "flex flex-col", onSubmit: P, children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
108
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
109
+ /* @__PURE__ */ e.jsx(L, { htmlFor: "auth-username", children: "用户名" }),
110
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
111
+ /* @__PURE__ */ e.jsx(de, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
112
+ /* @__PURE__ */ e.jsx(
113
+ M,
114
+ {
115
+ id: "auth-username",
116
+ name: "username",
117
+ className: "bg-background/80 pl-9 backdrop-blur",
118
+ placeholder: "请输入用户名",
119
+ autoComplete: "username",
120
+ spellCheck: !1,
121
+ required: !0
122
+ }
123
+ )
124
+ ] })
125
+ ] }),
126
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
127
+ /* @__PURE__ */ e.jsx(L, { htmlFor: "auth-password", children: "密码" }),
128
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
129
+ /* @__PURE__ */ e.jsx(ae, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
130
+ /* @__PURE__ */ e.jsx(
131
+ M,
132
+ {
133
+ id: "auth-password",
134
+ name: "password",
135
+ className: "bg-background/80 pl-9 backdrop-blur",
136
+ type: "password",
137
+ placeholder: "请输入密码",
138
+ autoComplete: "current-password",
139
+ required: !0
140
+ }
141
+ )
142
+ ] })
143
+ ] }),
144
+ /* @__PURE__ */ e.jsx(
145
+ q,
146
+ {
147
+ type: "submit",
148
+ className: "mt-4 h-11 w-full",
149
+ disabled: $,
150
+ children: $ ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
151
+ /* @__PURE__ */ e.jsx(Q, { className: "mr-2 h-4 w-4 animate-spin" }),
152
+ "登录中..."
153
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
154
+ "登录",
155
+ /* @__PURE__ */ e.jsx(te, { className: "ml-2 h-4 w-4" })
156
+ ] })
157
+ }
158
+ )
159
+ ] }) }), le = () => /* @__PURE__ */ e.jsx("form", { className: "flex flex-col", onSubmit: me, children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
160
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
161
+ /* @__PURE__ */ e.jsx(L, { htmlFor: "auth-phone", children: "手机号" }),
162
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
163
+ /* @__PURE__ */ e.jsxs("div", { className: "relative w-full", children: [
164
+ /* @__PURE__ */ e.jsx(oe, { className: "pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
165
+ /* @__PURE__ */ e.jsx(
166
+ M,
167
+ {
168
+ id: "auth-phone",
169
+ name: "phone",
170
+ className: "bg-background/80 pl-9 backdrop-blur",
171
+ placeholder: "请输入手机号",
172
+ value: je(r),
173
+ onChange: (a) => W(be(a.target.value)),
174
+ required: !0,
175
+ maxLength: 13,
176
+ inputMode: "numeric",
177
+ autoComplete: "tel",
178
+ spellCheck: !1
179
+ }
180
+ )
181
+ ] }),
182
+ /* @__PURE__ */ e.jsx(
183
+ q,
184
+ {
185
+ type: "button",
186
+ variant: "outline",
187
+ className: "h-10 w-28 shrink-0 bg-background/70 backdrop-blur hover:bg-background/90",
188
+ onClick: ue,
189
+ disabled: !r || H || D > 0,
190
+ children: H ? /* @__PURE__ */ e.jsx(Q, { className: "h-4 w-4 animate-spin" }) : D > 0 ? `${D}秒` : "发送验证码"
191
+ }
192
+ )
193
+ ] })
194
+ ] }),
195
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
196
+ /* @__PURE__ */ e.jsx(L, { htmlFor: "auth-code", children: "验证码" }),
197
+ /* @__PURE__ */ e.jsx(
198
+ M,
199
+ {
200
+ id: "auth-code",
201
+ name: "code",
202
+ className: "bg-background/80 backdrop-blur",
203
+ placeholder: "请输入验证码",
204
+ inputMode: "numeric",
205
+ autoComplete: "one-time-code",
206
+ required: !0
207
+ }
208
+ )
209
+ ] }),
210
+ /* @__PURE__ */ e.jsx(
211
+ q,
212
+ {
213
+ type: "submit",
214
+ className: "mt-4 h-11 w-full",
215
+ disabled: U,
216
+ children: U ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
217
+ /* @__PURE__ */ e.jsx(Q, { className: "mr-2 h-4 w-4 animate-spin" }),
218
+ "验证中..."
219
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
220
+ "验证并登录",
221
+ /* @__PURE__ */ e.jsx(te, { className: "ml-2 h-4 w-4" })
222
+ ] })
223
+ }
224
+ )
225
+ ] }) }), pe = () => _ ? /* @__PURE__ */ e.jsxs(
226
+ n,
227
+ {
228
+ value: z,
229
+ onValueChange: (a) => t(a),
230
+ className: "w-full",
231
+ children: [
232
+ /* @__PURE__ */ e.jsxs(o, { className: "mb-6 grid h-11 w-full grid-cols-2 bg-background/60 backdrop-blur", children: [
233
+ I.includes("password") && /* @__PURE__ */ e.jsx(N, { value: "password", children: "账号密码登录" }),
234
+ I.includes("sms") && /* @__PURE__ */ e.jsx(N, { value: "sms", children: "手机号登录" })
235
+ ] }),
236
+ /* @__PURE__ */ e.jsx(G, { value: "password", children: ne() }),
237
+ /* @__PURE__ */ e.jsx(G, { value: "sms", children: le() })
238
+ ]
239
+ }
240
+ ) : I[0] === "sms" ? le() : ne();
241
+ return /* @__PURE__ */ e.jsxs(
242
+ "div",
243
+ {
244
+ className: y(
245
+ "w-full max-w-[calc(100vw-2rem)] rounded-lg border border-white/45 bg-background/70 p-5 shadow-2xl shadow-slate-950/25 backdrop-blur-md supports-[backdrop-filter]:bg-background/55 md:p-8",
246
+ j
247
+ ),
248
+ children: [
249
+ he(),
250
+ xe(),
251
+ pe(),
252
+ k && /* @__PURE__ */ e.jsx("div", { className: "mt-5", children: k }),
253
+ S && /* @__PURE__ */ e.jsx(
254
+ "div",
255
+ {
256
+ className: "mt-4 border-l-2 border-destructive bg-destructive/5 px-4 py-3 text-sm text-destructive",
257
+ "aria-live": "polite",
258
+ children: S
259
+ }
260
+ ),
261
+ c && /* @__PURE__ */ e.jsx("div", { className: "mt-6 text-sm text-muted-foreground", children: c })
262
+ ]
263
+ }
264
+ );
265
+ }
266
+ const ve = (s) => /^1[3-9]\d{9}$/.test(s) ? void 0 : "请输入正确的手机号", ie = (s, i) => s instanceof Error && s.message ? s.message : typeof s == "string" && s ? s : i, Ne = (s) => s.replace(/\D/g, "").slice(0, 11), ye = (s) => s.length <= 3 ? s : s.length <= 7 ? `${s.slice(0, 3)} ${s.slice(3)}` : `${s.slice(0, 3)} ${s.slice(3, 7)} ${s.slice(7)}`;
267
+ function ke({
268
+ components: s,
269
+ title: i = "创建账号",
270
+ description: p = "填写账号信息并完成手机号验证",
271
+ brandIcon: g,
272
+ requirePhoneVerification: u = !0,
273
+ requireTermsAccepted: m = !1,
274
+ termsLabel: A = "我已阅读并同意服务条款",
275
+ error: k,
276
+ extraActions: c,
277
+ footer: f,
278
+ socialProviders: j,
279
+ className: w,
280
+ smsCountdownSeconds: x = 60,
281
+ validatePhone: h = ve,
282
+ validatePassword: v,
283
+ validateRegister: C,
284
+ onSendSmsCode: F,
285
+ onRegister: z
286
+ }) {
287
+ const [t, r] = l(""), [W, X] = l(), [Y, Z] = l(), [B, R] = l(!1), [b, $] = l(), [K, U] = l(!1), [V, H] = l(!1), [E, D] = l(0), O = b || k;
288
+ if (re(() => {
289
+ if (E <= 0) return;
290
+ const n = setTimeout(() => D((o) => o - 1), 1e3);
291
+ return () => clearTimeout(n);
292
+ }, [E]), !s)
293
+ return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
294
+ const { Button: I, Input: _, Label: S } = s, q = async () => {
295
+ const n = h(t);
296
+ if (n) {
297
+ $(n);
298
+ return;
299
+ }
300
+ try {
301
+ H(!0), $(void 0);
302
+ const o = await (F == null ? void 0 : F(t));
303
+ X(o == null ? void 0 : o.smsId), Z(o == null ? void 0 : o.smsType), D(x);
304
+ } catch (o) {
305
+ $(ie(o, "发送验证码失败,请稍后重试"));
306
+ } finally {
307
+ H(!1);
308
+ }
309
+ }, M = async (n) => {
310
+ n.preventDefault();
311
+ const o = new FormData(n.currentTarget), N = {
312
+ username: String(o.get("username") || "").trim(),
313
+ password: String(o.get("password") || ""),
314
+ confirmPassword: String(o.get("confirmPassword") || ""),
315
+ phone: t,
316
+ code: String(o.get("code") || "").trim(),
317
+ smsId: W,
318
+ smsType: Y,
319
+ termsAccepted: B
320
+ }, G = !N.username && "请输入用户名" || !N.password && "请输入密码" || N.password !== N.confirmPassword && "两次输入的密码不一致" || u && h(t) || u && !N.code && "请输入验证码" || m && !B && "请先同意服务条款" || (v == null ? void 0 : v(N)) || (C == null ? void 0 : C(N));
321
+ if (G) {
322
+ $(G);
323
+ return;
324
+ }
325
+ try {
326
+ U(!0), $(void 0), await (z == null ? void 0 : z(N));
327
+ } catch (P) {
328
+ $(ie(P, "注册失败,请稍后重试"));
329
+ } finally {
330
+ U(!1);
331
+ }
332
+ }, L = () => j != null && j.length ? /* @__PURE__ */ e.jsx("div", { className: "mb-6 grid gap-2", children: j.map((n) => /* @__PURE__ */ e.jsxs(
333
+ I,
334
+ {
335
+ type: "button",
336
+ variant: "outline",
337
+ className: "h-10 w-full",
338
+ disabled: n.disabled,
339
+ onClick: n.onClick,
340
+ children: [
341
+ n.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex h-4 w-4 items-center justify-center", children: n.icon }),
342
+ n.label
343
+ ]
344
+ },
345
+ n.id
346
+ )) }) : null;
347
+ return /* @__PURE__ */ e.jsxs(
348
+ "div",
349
+ {
350
+ className: y(
351
+ "w-full max-w-[calc(100vw-2rem)] rounded-lg border border-white/45 bg-background/70 p-5 shadow-2xl shadow-slate-950/25 backdrop-blur-md supports-[backdrop-filter]:bg-background/55 md:p-8",
352
+ w
353
+ ),
354
+ children: [
355
+ /* @__PURE__ */ e.jsxs("div", { className: "mb-7", children: [
356
+ /* @__PURE__ */ e.jsx("div", { className: "mb-4 flex h-11 w-11 items-center justify-center rounded-lg bg-primary text-primary-foreground shadow-sm ring-1 ring-primary/10", children: g || /* @__PURE__ */ e.jsx(ce, { className: "h-5 w-5" }) }),
357
+ /* @__PURE__ */ e.jsx("h1", { className: "text-balance text-2xl font-semibold leading-tight", children: i }),
358
+ p && /* @__PURE__ */ e.jsx("p", { className: "mt-2 text-pretty text-sm leading-6 text-muted-foreground", children: p })
359
+ ] }),
360
+ L(),
361
+ /* @__PURE__ */ e.jsx("form", { className: "flex flex-col", onSubmit: M, children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
362
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
363
+ /* @__PURE__ */ e.jsx(S, { htmlFor: "auth-register-username", children: "用户名" }),
364
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
365
+ /* @__PURE__ */ e.jsx(de, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
366
+ /* @__PURE__ */ e.jsx(
367
+ _,
368
+ {
369
+ id: "auth-register-username",
370
+ name: "username",
371
+ className: "bg-background/80 pl-9 backdrop-blur",
372
+ placeholder: "请输入用户名",
373
+ autoComplete: "username",
374
+ spellCheck: !1,
375
+ required: !0
376
+ }
377
+ )
378
+ ] })
379
+ ] }),
380
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
381
+ /* @__PURE__ */ e.jsx(S, { htmlFor: "auth-register-password", children: "密码" }),
382
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
383
+ /* @__PURE__ */ e.jsx(ae, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
384
+ /* @__PURE__ */ e.jsx(
385
+ _,
386
+ {
387
+ id: "auth-register-password",
388
+ name: "password",
389
+ className: "bg-background/80 pl-9 backdrop-blur",
390
+ type: "password",
391
+ placeholder: "请输入密码",
392
+ autoComplete: "new-password",
393
+ required: !0
394
+ }
395
+ )
396
+ ] })
397
+ ] }),
398
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
399
+ /* @__PURE__ */ e.jsx(S, { htmlFor: "auth-register-confirm-password", children: "确认密码" }),
400
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
401
+ /* @__PURE__ */ e.jsx(ae, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
402
+ /* @__PURE__ */ e.jsx(
403
+ _,
404
+ {
405
+ id: "auth-register-confirm-password",
406
+ name: "confirmPassword",
407
+ className: "bg-background/80 pl-9 backdrop-blur",
408
+ type: "password",
409
+ placeholder: "请再次输入密码",
410
+ autoComplete: "new-password",
411
+ required: !0
412
+ }
413
+ )
414
+ ] })
415
+ ] }),
416
+ u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
417
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
418
+ /* @__PURE__ */ e.jsx(S, { htmlFor: "auth-register-phone", children: "手机号" }),
419
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
420
+ /* @__PURE__ */ e.jsxs("div", { className: "relative w-full", children: [
421
+ /* @__PURE__ */ e.jsx(oe, { className: "pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
422
+ /* @__PURE__ */ e.jsx(
423
+ _,
424
+ {
425
+ id: "auth-register-phone",
426
+ name: "phone",
427
+ className: "bg-background/80 pl-9 backdrop-blur",
428
+ placeholder: "请输入手机号",
429
+ value: ye(t),
430
+ onChange: (n) => r(Ne(n.target.value)),
431
+ required: !0,
432
+ maxLength: 13,
433
+ inputMode: "numeric",
434
+ autoComplete: "tel",
435
+ spellCheck: !1
436
+ }
437
+ )
438
+ ] }),
439
+ /* @__PURE__ */ e.jsx(
440
+ I,
441
+ {
442
+ type: "button",
443
+ variant: "outline",
444
+ className: "h-10 w-28 shrink-0 bg-background/70 backdrop-blur hover:bg-background/90",
445
+ onClick: q,
446
+ disabled: !t || V || E > 0,
447
+ children: V ? /* @__PURE__ */ e.jsx(Q, { className: "h-4 w-4 animate-spin" }) : E > 0 ? `${E}秒` : "发送验证码"
448
+ }
449
+ )
450
+ ] })
451
+ ] }),
452
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
453
+ /* @__PURE__ */ e.jsx(S, { htmlFor: "auth-register-code", children: "验证码" }),
454
+ /* @__PURE__ */ e.jsx(
455
+ _,
456
+ {
457
+ id: "auth-register-code",
458
+ name: "code",
459
+ className: "bg-background/80 backdrop-blur",
460
+ placeholder: "请输入验证码",
461
+ inputMode: "numeric",
462
+ autoComplete: "one-time-code",
463
+ required: !0
464
+ }
465
+ )
466
+ ] })
467
+ ] }),
468
+ m && /* @__PURE__ */ e.jsxs("label", { className: "flex items-start gap-2 text-sm text-muted-foreground", children: [
469
+ /* @__PURE__ */ e.jsx(
470
+ "input",
471
+ {
472
+ type: "checkbox",
473
+ className: "mt-0.5 h-4 w-4 rounded border-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
474
+ checked: B,
475
+ onChange: (n) => R(n.target.checked)
476
+ }
477
+ ),
478
+ /* @__PURE__ */ e.jsx("span", { children: A })
479
+ ] }),
480
+ /* @__PURE__ */ e.jsx(
481
+ I,
482
+ {
483
+ type: "submit",
484
+ className: "mt-4 h-11 w-full",
485
+ disabled: K,
486
+ children: K ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
487
+ /* @__PURE__ */ e.jsx(Q, { className: "mr-2 h-4 w-4 animate-spin" }),
488
+ "注册中..."
489
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
490
+ "创建账号",
491
+ /* @__PURE__ */ e.jsx(te, { className: "ml-2 h-4 w-4" })
492
+ ] })
493
+ }
494
+ )
495
+ ] }) }),
496
+ c && /* @__PURE__ */ e.jsx("div", { className: "mt-5", children: c }),
497
+ O && /* @__PURE__ */ e.jsx(
498
+ "div",
499
+ {
500
+ className: "mt-4 border-l-2 border-destructive bg-destructive/5 px-4 py-3 text-sm text-destructive",
501
+ "aria-live": "polite",
502
+ children: O
503
+ }
504
+ ),
505
+ f && /* @__PURE__ */ e.jsx("div", { className: "mt-6 text-sm text-muted-foreground", children: f })
506
+ ]
507
+ }
508
+ );
509
+ }
510
+ function Ee({
511
+ children: s,
512
+ visual: i,
513
+ overlay: p,
514
+ className: g,
515
+ contentClassName: u,
516
+ panelClassName: m
517
+ }) {
518
+ return /* @__PURE__ */ e.jsx("div", { className: y("min-h-screen", g), children: /* @__PURE__ */ e.jsxs("main", { className: "relative flex min-h-screen w-full overflow-hidden", children: [
519
+ i && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0", children: i }),
520
+ p ?? /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 z-10 bg-black/35" }),
521
+ /* @__PURE__ */ e.jsx(
522
+ "div",
523
+ {
524
+ className: y(
525
+ "relative z-20 flex min-h-screen w-full items-center justify-center px-4 py-6 sm:px-6 lg:p-12 xl:p-16",
526
+ u
527
+ ),
528
+ children: /* @__PURE__ */ e.jsx("div", { className: y("w-full min-w-0 max-w-[420px]", m), children: s })
529
+ }
530
+ )
531
+ ] }) });
532
+ }
533
+ function De({
534
+ items: s,
535
+ intervalMs: i = 5e3,
536
+ showIndicators: p = !0,
537
+ showText: g = !0,
538
+ className: u,
539
+ imageClassName: m,
540
+ contentClassName: A,
541
+ ariaLabel: k = "认证页视觉轮播"
542
+ }) {
543
+ const [c, f] = l(0), [j, w] = l(!1), x = s.length > 0, h = x ? s[c] : void 0, v = (t) => {
544
+ x && f((t + s.length) % s.length);
545
+ }, C = () => v(c + 1), F = () => v(c - 1);
546
+ re(() => {
547
+ if (!x || j || i <= 0 || s.length < 2) return;
548
+ const t = setTimeout(() => {
549
+ f((r) => (r + 1) % s.length);
550
+ }, i);
551
+ return () => clearTimeout(t);
552
+ }, [x, i, j, s.length, c]);
553
+ const z = (t) => {
554
+ t.key === "ArrowLeft" && (t.preventDefault(), F()), t.key === "ArrowRight" && (t.preventDefault(), C());
555
+ };
556
+ return x ? /* @__PURE__ */ e.jsxs(
557
+ "div",
558
+ {
559
+ className: y(
560
+ "relative h-full min-h-[360px] w-full overflow-hidden bg-slate-950 outline-none focus-visible:ring-2 focus-visible:ring-white/80 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-950",
561
+ u
562
+ ),
563
+ tabIndex: 0,
564
+ "aria-label": k,
565
+ role: "region",
566
+ onKeyDown: z,
567
+ onMouseEnter: () => w(!0),
568
+ onMouseLeave: () => w(!1),
569
+ onFocus: () => w(!0),
570
+ onBlur: () => w(!1),
571
+ children: [
572
+ s.map((t, r) => /* @__PURE__ */ e.jsx(
573
+ "img",
574
+ {
575
+ src: t.image,
576
+ alt: t.alt,
577
+ width: t.width ?? 1600,
578
+ height: t.height ?? 900,
579
+ fetchPriority: r === c ? "high" : "auto",
580
+ loading: r === 0 ? "eager" : "lazy",
581
+ decoding: "async",
582
+ className: y(
583
+ "absolute inset-0 h-full w-full object-cover transition-opacity duration-700 ease-out motion-reduce:transition-none",
584
+ r === c ? "opacity-100" : "opacity-0",
585
+ m
586
+ ),
587
+ "aria-hidden": r !== c
588
+ },
589
+ `${t.image}-${r}`
590
+ )),
591
+ /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 bg-gradient-to-r from-slate-950/80 via-slate-950/30 to-slate-950/10" }),
592
+ /* @__PURE__ */ e.jsx("div", { className: "absolute inset-x-0 bottom-0 bg-gradient-to-t from-slate-950/80 via-slate-950/30 to-transparent pb-16 pt-24" }),
593
+ /* @__PURE__ */ e.jsx(
594
+ "div",
595
+ {
596
+ className: "pointer-events-none absolute inset-0 opacity-[0.18] [background-image:linear-gradient(to_right,rgba(255,255,255,0.32)_1px,transparent_1px),linear-gradient(to_bottom,rgba(255,255,255,0.26)_1px,transparent_1px)] [background-size:44px_44px]",
597
+ "aria-hidden": "true"
598
+ }
599
+ ),
600
+ /* @__PURE__ */ e.jsx(
601
+ "div",
602
+ {
603
+ className: "pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/60 to-transparent",
604
+ "aria-hidden": "true"
605
+ }
606
+ ),
607
+ (g || p) && /* @__PURE__ */ e.jsxs(
608
+ "div",
609
+ {
610
+ className: y(
611
+ "absolute inset-x-5 bottom-6 text-white sm:inset-x-8 sm:bottom-8 lg:inset-x-12 lg:bottom-10",
612
+ A
613
+ ),
614
+ children: [
615
+ g && h && /* @__PURE__ */ e.jsxs("div", { className: "max-w-[min(28rem,calc(100vw-2.5rem))]", children: [
616
+ h.eyebrow && /* @__PURE__ */ e.jsx("p", { className: "mb-2 text-[0.68rem] font-medium uppercase tracking-normal text-cyan-100/80 sm:text-xs", children: h.eyebrow }),
617
+ h.title && /* @__PURE__ */ e.jsx("h2", { className: "text-balance text-xl font-semibold leading-tight sm:text-2xl lg:text-3xl", children: h.title }),
618
+ h.description && /* @__PURE__ */ e.jsx("p", { className: "mt-2 line-clamp-3 text-sm leading-6 text-slate-100/80 sm:text-base", children: h.description })
619
+ ] }),
620
+ p && s.length > 1 && /* @__PURE__ */ e.jsx("div", { className: "mt-5 flex items-center gap-2", children: s.map((t, r) => /* @__PURE__ */ e.jsx(
621
+ "button",
622
+ {
623
+ type: "button",
624
+ className: y(
625
+ "h-1.5 rounded-full transition-[background-color,width] duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2 focus-visible:ring-offset-slate-950 motion-reduce:transition-none",
626
+ r === c ? "w-8 bg-white" : "w-3 bg-white/40 hover:bg-white/70"
627
+ ),
628
+ "aria-label": `切换到第 ${r + 1} 张轮播图`,
629
+ "aria-current": r === c,
630
+ onClick: () => v(r)
631
+ },
632
+ `${t.image}-indicator-${r}`
633
+ )) })
634
+ ]
635
+ }
636
+ )
637
+ ]
638
+ }
639
+ ) : /* @__PURE__ */ e.jsx(
640
+ "div",
641
+ {
642
+ className: y(
643
+ "relative h-full min-h-[360px] w-full overflow-hidden bg-slate-950",
644
+ u
645
+ ),
646
+ "aria-label": k,
647
+ role: "region"
648
+ }
649
+ );
650
+ }
651
+ function Ie({
652
+ components: s,
653
+ mode: i,
654
+ defaultMode: p = "login",
655
+ onModeChange: g,
656
+ loginProps: u,
657
+ registerProps: m,
658
+ loginLabel: A = "已有账号?登录",
659
+ registerLabel: k = "没有账号?注册"
660
+ }) {
661
+ const [c, f] = l(p), j = i ?? c, w = (x) => {
662
+ i || f(x), g == null || g(x);
663
+ };
664
+ return j === "register" ? /* @__PURE__ */ e.jsx(
665
+ ke,
666
+ {
667
+ ...m,
668
+ components: s,
669
+ footer: (m == null ? void 0 : m.footer) ?? /* @__PURE__ */ e.jsx(
670
+ "button",
671
+ {
672
+ type: "button",
673
+ className: "text-primary underline-offset-4 hover:underline",
674
+ onClick: () => w("login"),
675
+ children: A
676
+ }
677
+ )
678
+ }
679
+ ) : /* @__PURE__ */ e.jsx(
680
+ we,
681
+ {
682
+ ...u,
683
+ components: s,
684
+ footer: (u == null ? void 0 : u.footer) ?? /* @__PURE__ */ e.jsx(
685
+ "button",
686
+ {
687
+ type: "button",
688
+ className: "text-primary underline-offset-4 hover:underline",
689
+ onClick: () => w("register"),
690
+ children: k
691
+ }
692
+ )
693
+ }
694
+ );
695
+ }
696
+ export {
697
+ we as A,
698
+ Ee as a,
699
+ Ie as b,
700
+ ke as c,
701
+ De as d
702
+ };
703
+ //# sourceMappingURL=AuthPanel-Cn_WwmjX.js.map