@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
@@ -1,14 +1,14 @@
1
1
  import { j as t } from "./jsx-runtime-B4hRZ52C.js";
2
2
  import { PanelLeft as Xe, ZoomOut as Ye, ZoomIn as Je, RotateCw as Qe, ScrollText as He, FileText as Ue, Minimize2 as et, Maximize2 as tt, ChevronLeft as de, ChevronRight as fe } from "lucide-react";
3
- import { useState as u, useEffect as y, useRef as $, useMemo as st, useCallback as m } from "react";
4
- import { P as nt } from "./PDFSidebar-BBtucLK6.js";
3
+ import { useState as u, useEffect as T, useRef as R, useMemo as st, useCallback as m } from "react";
4
+ import { P as nt } from "./PDFSidebar-ClnrF4Br.js";
5
5
  function rt(x, v) {
6
- const T = $(
6
+ const N = R(
7
7
  void 0
8
8
  );
9
9
  return m(
10
- (...S) => {
11
- T.current && clearTimeout(T.current), T.current = setTimeout(() => x(...S), v);
10
+ (...L) => {
11
+ N.current && clearTimeout(N.current), N.current = setTimeout(() => x(...L), v);
12
12
  },
13
13
  [x, v]
14
14
  );
@@ -16,63 +16,63 @@ function rt(x, v) {
16
16
  function ot({
17
17
  url: x,
18
18
  initialPage: v = 1,
19
- initialScale: T = 1,
20
- initialRotation: S = 0,
21
- currentPage: H,
19
+ initialScale: N = 1,
20
+ initialRotation: L = 0,
21
+ currentPage: U,
22
22
  onPageChange: P,
23
- scale: R,
23
+ scale: G,
24
24
  onScaleChange: C,
25
- rotation: L,
25
+ rotation: K,
26
26
  onRotationChange: F,
27
- minScale: G = 0.5,
28
- maxScale: K = 2.5,
27
+ minScale: _ = 0.5,
28
+ maxScale: B = 2.5,
29
29
  showToolbar: me = !0,
30
- showSidebar: j = !0,
30
+ showSidebar: b = !0,
31
31
  showRotation: xe = !0,
32
32
  showModeToggle: he = !0,
33
33
  showFullscreen: pe = !0,
34
- enableHotkeys: U = !0,
34
+ enableHotkeys: ee = !0,
35
35
  enableMobileNav: ve = !0,
36
- displayMode: je = "single",
37
- className: be,
36
+ displayMode: be = "single",
37
+ className: je,
38
38
  toolbarClassName: ge,
39
39
  contentClassName: ye,
40
40
  contentHeight: Te = "80vh",
41
- pageClassName: ee,
42
- workerUrl: _,
43
- cMapUrl: N,
44
- standardFontDataUrl: k,
45
- components: a,
41
+ pageClassName: te,
42
+ workerUrl: V,
43
+ cMapUrl: k,
44
+ standardFontDataUrl: w,
45
+ components: c,
46
46
  onLoadSuccess: z,
47
47
  onLoadError: h,
48
- onPageRender: b,
48
+ onPageRender: j,
49
49
  loadingText: Ne = "正在加载PDF文档...",
50
- errorText: te = "PDF加载失败"
50
+ errorText: se = "PDF加载失败"
51
51
  }) {
52
- const [se, B] = u(null), [ke, V] = u(v), [we, De] = u(T), [Me, Pe] = u(S), [Ce, A] = u(!1), [w, I] = u(null), [d, Z] = u(0), [ne, q] = u(!1), [D, re] = u(
53
- je === "scroll"
54
- ), [X, ie] = u(j);
55
- y(() => {
56
- ie(j);
57
- }, [j]);
58
- const [le, Fe] = u(void 0), [ce, ze] = u(null), ae = $(null), E = $(null), Y = $(/* @__PURE__ */ new Map()), r = H ?? ke, p = R ?? we, O = L ?? Me, g = H !== void 0, c = D, { Card: Ae, CardContent: Ie, Button: f, Input: Ee, Skeleton: Oe } = a || {};
59
- y(() => {
60
- B(null), Z(0), I(null), A(!1), g || V(Math.max(1, v));
61
- }, [x, v, g]);
52
+ const [ne, Z] = u(null), [ke, q] = u(v), [we, De] = u(N), [Me, Pe] = u(L), [Ce, A] = u(!1), [D, I] = u(null), [d, X] = u(0), [E, Y] = u(!1), [g, re] = u(
53
+ be === "scroll"
54
+ ), [O, ie] = u(b);
55
+ T(() => {
56
+ ie(b);
57
+ }, [b]);
58
+ const [le, Fe] = u(void 0), [ae, ze] = u(null), ce = R(null), W = R(null), J = R(/* @__PURE__ */ new Map()), r = U ?? ke, p = G ?? we, $ = K ?? Me, y = U !== void 0, a = g, { Card: Ae, CardContent: Ie, Button: f, Input: Ee, Skeleton: Oe } = c || {};
59
+ T(() => {
60
+ Z(null), X(0), I(null), A(!1), y || q(Math.max(1, v));
61
+ }, [x, v, y]);
62
62
  const We = st(() => {
63
63
  const e = {
64
64
  withCredentials: !1
65
65
  };
66
- return N && (e.cMapUrl = N, e.cMapPacked = !0), k && (e.standardFontDataUrl = k), e;
67
- }, [N, k]);
68
- y(() => {
66
+ return k && (e.cMapUrl = k, e.cMapPacked = !0), w && (e.standardFontDataUrl = w), e;
67
+ }, [k, w]);
68
+ T(() => {
69
69
  let e = !0;
70
70
  return (async () => {
71
71
  try {
72
- const i = await import("./index-BypbGNpR.js");
72
+ const i = await import("react-pdf");
73
73
  if (typeof window < "u") {
74
74
  const n = i.pdfjs, l = n == null ? void 0 : n.version;
75
- n != null && n.GlobalWorkerOptions && l && (_ ? n.GlobalWorkerOptions.workerSrc = _ : n.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${l}/build/pdf.worker.min.mjs`, !N && n.GlobalWorkerOptions && (n.GlobalWorkerOptions.cMapUrl = `https://unpkg.com/pdfjs-dist@${l}/cmaps/`), !k && n.GlobalWorkerOptions && (n.GlobalWorkerOptions.standardFontDataUrl = `https://unpkg.com/pdfjs-dist@${l}/standard_fonts/`));
75
+ n != null && n.GlobalWorkerOptions && l && (V ? n.GlobalWorkerOptions.workerSrc = V : n.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${l}/build/pdf.worker.min.mjs`, !k && n.GlobalWorkerOptions && (n.GlobalWorkerOptions.cMapUrl = `https://unpkg.com/pdfjs-dist@${l}/cmaps/`), !w && n.GlobalWorkerOptions && (n.GlobalWorkerOptions.standardFontDataUrl = `https://unpkg.com/pdfjs-dist@${l}/standard_fonts/`));
76
76
  }
77
77
  e && ze(i);
78
78
  } catch (i) {
@@ -84,59 +84,59 @@ function ot({
84
84
  })(), () => {
85
85
  e = !1;
86
86
  };
87
- }, [_, N, k, h]);
87
+ }, [V, k, w, h]);
88
88
  const $e = m(
89
89
  (e) => {
90
- console.error("PDF加载失败:", e), console.error("PDF URL:", x), B(null), Z(0), I(
91
- new Error(`${te}: ${e.message || "请检查文件路径或网络连接"}`)
90
+ console.error("PDF加载失败:", e), console.error("PDF URL:", x), Z(null), X(0), I(
91
+ new Error(`${se}: ${e.message || "请检查文件路径或网络连接"}`)
92
92
  ), A(!1), h == null || h(e);
93
93
  },
94
- [x, te, h]
94
+ [x, se, h]
95
95
  ), Se = m(
96
96
  (e) => {
97
- B(e), Z(e.numPages), I(null), A(!1), g || V(
97
+ Z(e), X(e.numPages), I(null), A(!1), y || q(
98
98
  (s) => Math.max(1, Math.min(s, Math.max(e.numPages, 1)))
99
99
  ), z == null || z(e);
100
100
  },
101
- [g, z]
101
+ [y, z]
102
102
  ), o = m(
103
103
  (e) => {
104
104
  if (!Number.isFinite(e)) return;
105
105
  const s = d > 0 ? Math.max(1, Math.min(Math.trunc(e), d)) : Math.max(1, Math.trunc(e));
106
- g || V(s), s !== r && (P == null || P(s));
106
+ y || q(s), s !== r && (P == null || P(s));
107
107
  },
108
- [d, g, r, P]
108
+ [d, y, r, P]
109
109
  ), Re = m(
110
110
  (e, s) => {
111
- s ? Y.current.set(e, s) : Y.current.delete(e);
111
+ s ? J.current.set(e, s) : J.current.delete(e);
112
112
  },
113
113
  []
114
114
  ), Le = m(() => {
115
- const e = E.current;
116
- if (!e || !c || d <= 0) return;
115
+ const e = W.current;
116
+ if (!e || !a || d <= 0) return;
117
117
  const s = e.getBoundingClientRect().top;
118
118
  let i = r, n = Number.POSITIVE_INFINITY;
119
- Y.current.forEach((l, W) => {
119
+ J.current.forEach((l, S) => {
120
120
  const ue = Math.abs(
121
121
  l.getBoundingClientRect().top - s
122
122
  );
123
- ue < n && (n = ue, i = W);
123
+ ue < n && (n = ue, i = S);
124
124
  }), i !== r && o(i);
125
- }, [r, o, c, d]), M = m(
125
+ }, [r, o, a, d]), M = m(
126
126
  (e) => {
127
- const s = Math.max(G, Math.min(K, p + e));
128
- R === void 0 && De(s), C == null || C(s);
127
+ const s = Math.max(_, Math.min(B, p + e));
128
+ G === void 0 && De(s), C == null || C(s);
129
129
  },
130
- [p, G, K, R, C]
130
+ [p, _, B, G, C]
131
131
  ), Ge = m(() => {
132
- const e = (O + 90) % 360;
133
- L === void 0 && Pe(e), F == null || F(e);
134
- }, [O, L, F]), oe = rt((e) => {
132
+ const e = ($ + 90) % 360;
133
+ K === void 0 && Pe(e), F == null || F(e);
134
+ }, [$, K, F]), oe = rt((e) => {
135
135
  Fe(e);
136
136
  }, 100);
137
- y(() => {
138
- if (!E.current) return;
139
- const e = E.current, s = () => {
137
+ T(() => {
138
+ if (!W.current) return;
139
+ const e = W.current, s = () => {
140
140
  oe(e.clientWidth);
141
141
  };
142
142
  s();
@@ -146,32 +146,32 @@ function ot({
146
146
  return i.observe(e), () => {
147
147
  i.disconnect();
148
148
  };
149
- }, [oe]), y(() => {
150
- if (!U) return;
149
+ }, [oe]), T(() => {
150
+ if (!ee) return;
151
151
  const e = (s) => {
152
- const i = s.target, n = typeof document < "u" ? document.activeElement : null, l = i || n, W = l == null ? void 0 : l.getAttribute("role");
153
- l && (l.tagName === "INPUT" || l.tagName === "TEXTAREA" || l.tagName === "SELECT" || l.isContentEditable || W === "textbox" || W === "spinbutton") || ((s.ctrlKey || s.metaKey) && (s.key === "=" || s.key === "+") ? (s.preventDefault(), M(0.1)) : (s.ctrlKey || s.metaKey) && s.key === "-" ? (s.preventDefault(), M(-0.1)) : !c && s.key === "ArrowLeft" ? (s.preventDefault(), o(r - 1)) : !c && s.key === "ArrowRight" && (s.preventDefault(), o(r + 1)));
152
+ const i = s.target, n = typeof document < "u" ? document.activeElement : null, l = i || n, S = l == null ? void 0 : l.getAttribute("role");
153
+ l && (l.tagName === "INPUT" || l.tagName === "TEXTAREA" || l.tagName === "SELECT" || l.isContentEditable || S === "textbox" || S === "spinbutton") || ((s.ctrlKey || s.metaKey) && (s.key === "=" || s.key === "+") ? (s.preventDefault(), M(0.1)) : (s.ctrlKey || s.metaKey) && s.key === "-" ? (s.preventDefault(), M(-0.1)) : !a && s.key === "ArrowLeft" ? (s.preventDefault(), o(r - 1)) : !a && s.key === "ArrowRight" && (s.preventDefault(), o(r + 1)));
154
154
  };
155
155
  return document.addEventListener("keydown", e), () => {
156
156
  document.removeEventListener("keydown", e);
157
157
  };
158
- }, [U, r, o, c, M]);
158
+ }, [ee, r, o, a, M]);
159
159
  const Ke = m(async () => {
160
160
  var e, s;
161
161
  if (!(typeof document > "u"))
162
162
  if (document.fullscreenElement)
163
- document.exitFullscreen && (await document.exitFullscreen(), q(!1));
163
+ document.exitFullscreen && (await document.exitFullscreen(), Y(!1));
164
164
  else
165
165
  try {
166
- await ((s = (e = ae.current) == null ? void 0 : e.requestFullscreen) == null ? void 0 : s.call(e)), q(!0);
166
+ await ((s = (e = ce.current) == null ? void 0 : e.requestFullscreen) == null ? void 0 : s.call(e)), Y(!0);
167
167
  } catch (i) {
168
168
  console.error("Error attempting to enable fullscreen:", i);
169
169
  }
170
170
  }, []);
171
- y(() => {
171
+ T(() => {
172
172
  if (typeof document > "u") return;
173
173
  const e = () => {
174
- q(!!document.fullscreenElement);
174
+ Y(!!document.fullscreenElement);
175
175
  };
176
176
  return document.addEventListener("fullscreenchange", e), () => {
177
177
  document.removeEventListener("fullscreenchange", e);
@@ -188,13 +188,14 @@ function ot({
188
188
  className: `flex items-center justify-between gap-4 border-b px-4 py-2 ${ge || ""}`,
189
189
  children: [
190
190
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
191
- j && /* @__PURE__ */ t.jsx(
191
+ b && /* @__PURE__ */ t.jsx(
192
192
  f,
193
193
  {
194
194
  variant: "outline",
195
195
  size: "icon",
196
- onClick: () => ie(!X),
197
- title: X ? "隐藏侧边栏" : "显示侧边栏",
196
+ onClick: () => ie(!O),
197
+ "aria-label": O ? "隐藏侧边栏" : "显示侧边栏",
198
+ title: O ? "隐藏侧边栏" : "显示侧边栏",
198
199
  children: /* @__PURE__ */ t.jsx(Xe, {})
199
200
  }
200
201
  ),
@@ -204,7 +205,9 @@ function ot({
204
205
  variant: "outline",
205
206
  size: "icon",
206
207
  onClick: () => M(-0.1),
207
- disabled: p <= G,
208
+ disabled: p <= _,
209
+ "aria-label": "缩小",
210
+ title: "缩小",
208
211
  children: /* @__PURE__ */ t.jsx(Ye, {})
209
212
  }
210
213
  ),
@@ -218,31 +221,56 @@ function ot({
218
221
  variant: "outline",
219
222
  size: "icon",
220
223
  onClick: () => M(0.1),
221
- disabled: p >= K,
224
+ disabled: p >= B,
225
+ "aria-label": "放大",
226
+ title: "放大",
222
227
  children: /* @__PURE__ */ t.jsx(Je, {})
223
228
  }
224
229
  ),
225
- xe && /* @__PURE__ */ t.jsx(f, { variant: "outline", size: "icon", onClick: Ge, children: /* @__PURE__ */ t.jsx(Qe, {}) }),
230
+ xe && /* @__PURE__ */ t.jsx(
231
+ f,
232
+ {
233
+ variant: "outline",
234
+ size: "icon",
235
+ onClick: Ge,
236
+ "aria-label": "顺时针旋转",
237
+ title: "顺时针旋转",
238
+ children: /* @__PURE__ */ t.jsx(Qe, {})
239
+ }
240
+ ),
226
241
  he && /* @__PURE__ */ t.jsx(
227
242
  f,
228
243
  {
229
244
  variant: "outline",
230
245
  size: "icon",
231
- onClick: () => re(!D),
232
- title: D ? "单页模式" : "滚动模式",
233
- children: D ? /* @__PURE__ */ t.jsx(He, {}) : /* @__PURE__ */ t.jsx(Ue, {})
246
+ onClick: () => re(!g),
247
+ "aria-label": g ? "切换到单页模式" : "切换到滚动模式",
248
+ title: g ? "单页模式" : "滚动模式",
249
+ children: g ? /* @__PURE__ */ t.jsx(He, {}) : /* @__PURE__ */ t.jsx(Ue, {})
234
250
  }
235
251
  ),
236
- pe && /* @__PURE__ */ t.jsx(f, { variant: "outline", size: "icon", onClick: Ke, children: ne ? /* @__PURE__ */ t.jsx(et, {}) : /* @__PURE__ */ t.jsx(tt, {}) })
252
+ pe && /* @__PURE__ */ t.jsx(
253
+ f,
254
+ {
255
+ variant: "outline",
256
+ size: "icon",
257
+ onClick: Ke,
258
+ "aria-label": E ? "退出全屏" : "进入全屏",
259
+ title: E ? "退出全屏" : "进入全屏",
260
+ children: E ? /* @__PURE__ */ t.jsx(et, {}) : /* @__PURE__ */ t.jsx(tt, {})
261
+ }
262
+ )
237
263
  ] }),
238
264
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
239
- !c && /* @__PURE__ */ t.jsx(
265
+ !a && /* @__PURE__ */ t.jsx(
240
266
  f,
241
267
  {
242
268
  variant: "outline",
243
269
  size: "icon",
244
270
  onClick: () => o(r - 1),
245
271
  disabled: r <= 1,
272
+ "aria-label": "上一页",
273
+ title: "上一页",
246
274
  children: /* @__PURE__ */ t.jsx(de, {})
247
275
  }
248
276
  ),
@@ -250,13 +278,17 @@ function ot({
250
278
  Ee,
251
279
  {
252
280
  type: "number",
281
+ name: "pdf-page",
253
282
  min: 1,
254
283
  max: d,
255
284
  value: r,
256
285
  onChange: (e) => o(parseInt(e.target.value) || 1),
257
- disabled: c,
258
- readOnly: c,
259
- title: c ? "滚动模式下页码仅显示当前位置" : void 0,
286
+ disabled: a,
287
+ readOnly: a,
288
+ "aria-label": "当前页码",
289
+ inputMode: "numeric",
290
+ autoComplete: "off",
291
+ title: a ? "滚动模式下页码仅显示当前位置" : void 0,
260
292
  className: "w-16 text-center"
261
293
  }
262
294
  ),
@@ -264,30 +296,47 @@ function ot({
264
296
  "/ ",
265
297
  d
266
298
  ] }),
267
- !c && /* @__PURE__ */ t.jsx(
299
+ !a && /* @__PURE__ */ t.jsx(
268
300
  f,
269
301
  {
270
302
  variant: "outline",
271
303
  size: "icon",
272
304
  onClick: () => o(r + 1),
273
305
  disabled: d > 0 && r >= d,
306
+ "aria-label": "下一页",
307
+ title: "下一页",
274
308
  children: /* @__PURE__ */ t.jsx(fe, {})
275
309
  }
276
310
  )
277
311
  ] })
278
312
  ]
279
313
  }
280
- ) : null, J = () => /* @__PURE__ */ t.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ t.jsx("p", { className: "text-muted-foreground", children: Ne }) }), Q = () => /* @__PURE__ */ t.jsx("div", { className: "flex h-full min-h-[400px] items-center justify-center px-4 text-center text-destructive", children: /* @__PURE__ */ t.jsxs("div", { className: "max-w-md", children: [
281
- /* @__PURE__ */ t.jsx("p", { className: "mb-2 text-lg font-medium", children: "文件加载失败" }),
282
- /* @__PURE__ */ t.jsx("p", { className: "text-sm opacity-80", children: w == null ? void 0 : w.message })
283
- ] }) }), Ve = () => {
284
- if (!ce) return J();
285
- const { Document: e, Page: s } = ce;
314
+ ) : null, Q = () => /* @__PURE__ */ t.jsx(
315
+ "div",
316
+ {
317
+ className: "flex h-full items-center justify-center",
318
+ role: "status",
319
+ "aria-live": "polite",
320
+ children: /* @__PURE__ */ t.jsx("p", { className: "text-muted-foreground", children: Ne })
321
+ }
322
+ ), H = () => /* @__PURE__ */ t.jsx(
323
+ "div",
324
+ {
325
+ className: "flex h-full min-h-[400px] items-center justify-center px-4 text-center text-destructive",
326
+ role: "alert",
327
+ children: /* @__PURE__ */ t.jsxs("div", { className: "max-w-md", children: [
328
+ /* @__PURE__ */ t.jsx("p", { className: "mb-2 text-lg font-medium", children: "文件加载失败" }),
329
+ /* @__PURE__ */ t.jsx("p", { className: "text-sm opacity-80", children: D == null ? void 0 : D.message })
330
+ ] })
331
+ }
332
+ ), Ve = () => {
333
+ if (!ae) return Q();
334
+ const { Document: e, Page: s } = ae;
286
335
  return /* @__PURE__ */ t.jsx(
287
336
  "div",
288
337
  {
289
- ref: E,
290
- onScroll: c ? Le : void 0,
338
+ ref: W,
339
+ onScroll: a ? Le : void 0,
291
340
  className: `pdf-container flex-1 overflow-y-auto ${ye || ""}`,
292
341
  children: /* @__PURE__ */ t.jsx("div", { className: "flex min-h-full justify-center px-4", children: /* @__PURE__ */ t.jsx(
293
342
  e,
@@ -295,17 +344,17 @@ function ot({
295
344
  file: x,
296
345
  onLoadError: $e,
297
346
  options: We,
298
- loading: J(),
299
- error: Q(),
347
+ loading: Q(),
348
+ error: H(),
300
349
  onLoadSuccess: Se,
301
- children: w ? Q() : D ? (
350
+ children: D ? H() : g ? (
302
351
  // 显示所有页面模式
303
352
  Array.from(new Array(d), (i, n) => /* @__PURE__ */ t.jsx(
304
353
  "div",
305
354
  {
306
355
  ref: (l) => Re(n + 1, l),
307
356
  "data-page-number": n + 1,
308
- className: `mb-4 ${ee || ""}`,
357
+ className: `mb-4 ${te || ""}`,
309
358
  children: /* @__PURE__ */ t.jsx(
310
359
  s,
311
360
  {
@@ -314,8 +363,8 @@ function ot({
314
363
  renderAnnotationLayer: !1,
315
364
  width: le,
316
365
  scale: p,
317
- rotate: O,
318
- onRenderSuccess: () => b == null ? void 0 : b(n + 1)
366
+ rotate: $,
367
+ onRenderSuccess: () => j == null ? void 0 : j(n + 1)
319
368
  }
320
369
  )
321
370
  },
@@ -323,7 +372,7 @@ function ot({
323
372
  ))
324
373
  ) : (
325
374
  // 单页模式
326
- /* @__PURE__ */ t.jsx("div", { className: ee || "", children: /* @__PURE__ */ t.jsx(
375
+ /* @__PURE__ */ t.jsx("div", { className: te || "", children: /* @__PURE__ */ t.jsx(
327
376
  s,
328
377
  {
329
378
  pageNumber: r,
@@ -331,8 +380,8 @@ function ot({
331
380
  renderAnnotationLayer: !1,
332
381
  width: le,
333
382
  scale: p,
334
- rotate: O,
335
- onRenderSuccess: () => b == null ? void 0 : b(r)
383
+ rotate: $,
384
+ onRenderSuccess: () => j == null ? void 0 : j(r)
336
385
  }
337
386
  ) })
338
387
  )
@@ -342,33 +391,33 @@ function ot({
342
391
  }
343
392
  );
344
393
  }, Ze = () => {
345
- if (!j || !X || !se) return null;
394
+ if (!b || !O || !ne) return null;
346
395
  const e = nt;
347
396
  return /* @__PURE__ */ t.jsx(
348
397
  e,
349
398
  {
350
- pdfDocument: se,
399
+ pdfDocument: ne,
351
400
  currentPage: r,
352
401
  onPageClick: _e,
353
402
  components: {
354
- Tabs: a.Tabs,
355
- TabsList: a.TabsList,
356
- TabsTrigger: a.TabsTrigger,
357
- TabsContent: a.TabsContent,
358
- ScrollArea: a.ScrollArea,
403
+ Tabs: c.Tabs,
404
+ TabsList: c.TabsList,
405
+ TabsTrigger: c.TabsTrigger,
406
+ TabsContent: c.TabsContent,
407
+ ScrollArea: c.ScrollArea,
359
408
  Skeleton: Oe
360
409
  }
361
410
  }
362
411
  );
363
- }, qe = () => !ve || c ? null : /* @__PURE__ */ t.jsxs("div", { className: "fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 gap-2 md:hidden", children: [
412
+ }, qe = () => !ve || a ? null : /* @__PURE__ */ t.jsxs("div", { className: "fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 gap-2 md:hidden", children: [
364
413
  /* @__PURE__ */ t.jsxs(
365
414
  f,
366
415
  {
367
416
  variant: "secondary",
368
417
  size: "sm",
369
418
  onClick: () => o(r - 1),
370
- disabled: c || r <= 1,
371
- title: c ? "滚动模式下通过滚动定位页面" : void 0,
419
+ disabled: a || r <= 1,
420
+ title: a ? "滚动模式下通过滚动定位页面" : void 0,
372
421
  children: [
373
422
  /* @__PURE__ */ t.jsx(de, {}),
374
423
  /* @__PURE__ */ t.jsx("span", { className: "ml-1", children: "上一页" })
@@ -381,8 +430,8 @@ function ot({
381
430
  variant: "secondary",
382
431
  size: "sm",
383
432
  onClick: () => o(r + 1),
384
- disabled: c || r >= d,
385
- title: c ? "滚动模式下通过滚动定位页面" : void 0,
433
+ disabled: a || r >= d,
434
+ title: a ? "滚动模式下通过滚动定位页面" : void 0,
386
435
  children: [
387
436
  /* @__PURE__ */ t.jsx("span", { className: "mr-1", children: "下一页" }),
388
437
  /* @__PURE__ */ t.jsx(fe, {})
@@ -390,11 +439,11 @@ function ot({
390
439
  }
391
440
  )
392
441
  ] });
393
- if (!a)
442
+ if (!c)
394
443
  return /* @__PURE__ */ t.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
395
- if (j) {
444
+ if (b) {
396
445
  const e = [];
397
- if (a.Tabs || e.push("Tabs"), a.TabsList || e.push("TabsList"), a.TabsTrigger || e.push("TabsTrigger"), a.TabsContent || e.push("TabsContent"), a.ScrollArea || e.push("ScrollArea"), e.length > 0) {
446
+ if (c.Tabs || e.push("Tabs"), c.TabsList || e.push("TabsList"), c.TabsTrigger || e.push("TabsTrigger"), c.TabsContent || e.push("TabsContent"), c.ScrollArea || e.push("ScrollArea"), e.length > 0) {
398
447
  const s = e.length === 1 ? e[0] : `${e.slice(0, -1).join("、")} 和 ${e[e.length - 1]}`;
399
448
  return /* @__PURE__ */ t.jsxs("div", { className: "p-4 text-center text-destructive", children: [
400
449
  "错误:侧边栏功能需要注入 ",
@@ -403,17 +452,17 @@ function ot({
403
452
  ] });
404
453
  }
405
454
  }
406
- return /* @__PURE__ */ t.jsxs("div", { ref: ae, children: [
407
- /* @__PURE__ */ t.jsxs(Ae, { className: be, children: [
455
+ return /* @__PURE__ */ t.jsxs("div", { ref: ce, children: [
456
+ /* @__PURE__ */ t.jsxs(Ae, { className: je, children: [
408
457
  Be(),
409
458
  /* @__PURE__ */ t.jsx(
410
459
  Ie,
411
460
  {
412
461
  className: "p-0",
413
- style: { height: ne ? "100vh" : Te },
462
+ style: { height: E ? "100vh" : Te },
414
463
  children: /* @__PURE__ */ t.jsx("div", { className: "flex h-full flex-col", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-1 overflow-hidden", children: [
415
464
  Ze(),
416
- Ce ? J() : w ? Q() : Ve()
465
+ Ce ? Q() : D ? H() : Ve()
417
466
  ] }) })
418
467
  }
419
468
  )