arxatec-ui 0.1.66 → 0.1.68

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 (101) hide show
  1. package/dist/components/file_view/components/audio_player/components/file_audio_player_content/index.d.ts +1 -1
  2. package/dist/components/file_view/components/audio_player/components/file_audio_player_content/index.js +88 -85
  3. package/dist/components/file_view/components/audio_player/components/file_audio_player_content/index.js.map +1 -1
  4. package/dist/components/file_view/components/audio_player/types/index.d.ts +2 -0
  5. package/dist/components/file_view/components/docx_preview_viewer/components/file_docx_preview_viewer_content/index.d.ts +1 -1
  6. package/dist/components/file_view/components/docx_preview_viewer/components/file_docx_preview_viewer_content/index.js +34 -36
  7. package/dist/components/file_view/components/docx_preview_viewer/components/file_docx_preview_viewer_content/index.js.map +1 -1
  8. package/dist/components/file_view/components/docx_preview_viewer/index.d.ts +1 -1
  9. package/dist/components/file_view/components/docx_preview_viewer/index.js +4 -1
  10. package/dist/components/file_view/components/docx_preview_viewer/index.js.map +1 -1
  11. package/dist/components/file_view/components/docx_preview_viewer/types/index.d.ts +2 -0
  12. package/dist/components/file_view/components/edit_viewer/index.d.ts +3 -1
  13. package/dist/components/file_view/components/edit_viewer/index.js +13 -18
  14. package/dist/components/file_view/components/edit_viewer/index.js.map +1 -1
  15. package/dist/components/file_view/components/file_simple_preview_render/index.d.ts +3 -1
  16. package/dist/components/file_view/components/file_simple_preview_render/index.js +26 -13
  17. package/dist/components/file_view/components/file_simple_preview_render/index.js.map +1 -1
  18. package/dist/components/file_view/components/file_simple_preview_sheet/index.d.ts +5 -1
  19. package/dist/components/file_view/components/file_simple_preview_sheet/index.js +12 -8
  20. package/dist/components/file_view/components/file_simple_preview_sheet/index.js.map +1 -1
  21. package/dist/components/file_view/components/file_source_file_viewer/components/file_source_file_viewer_content/index.d.ts +1 -1
  22. package/dist/components/file_view/components/file_source_file_viewer/components/file_source_file_viewer_content/index.js +8 -7
  23. package/dist/components/file_view/components/file_source_file_viewer/components/file_source_file_viewer_content/index.js.map +1 -1
  24. package/dist/components/file_view/components/file_source_file_viewer/index.d.ts +1 -1
  25. package/dist/components/file_view/components/file_source_file_viewer/index.js +4 -1
  26. package/dist/components/file_view/components/file_source_file_viewer/index.js.map +1 -1
  27. package/dist/components/file_view/components/file_source_file_viewer/types/index.d.ts +2 -0
  28. package/dist/components/file_view/components/file_url_preview_render/index.d.ts +3 -1
  29. package/dist/components/file_view/components/file_url_preview_render/index.js +12 -9
  30. package/dist/components/file_view/components/file_url_preview_render/index.js.map +1 -1
  31. package/dist/components/file_view/components/file_url_preview_sheet/index.d.ts +5 -1
  32. package/dist/components/file_view/components/file_url_preview_sheet/index.js +27 -24
  33. package/dist/components/file_view/components/file_url_preview_sheet/index.js.map +1 -1
  34. package/dist/components/file_view/components/file_view_sheet/components/file_view_sheet_panel_content/index.d.ts +1 -1
  35. package/dist/components/file_view/components/file_view_sheet/components/file_view_sheet_panel_content/index.js +49 -47
  36. package/dist/components/file_view/components/file_view_sheet/components/file_view_sheet_panel_content/index.js.map +1 -1
  37. package/dist/components/file_view/components/file_view_sheet/types/index.d.ts +2 -0
  38. package/dist/components/file_view/components/image_viewer/components/file_image_viewer_content/index.js +36 -37
  39. package/dist/components/file_view/components/image_viewer/components/file_image_viewer_content/index.js.map +1 -1
  40. package/dist/components/file_view/components/image_viewer/hooks/use_file_image_viewer/index.d.ts +3 -1
  41. package/dist/components/file_view/components/image_viewer/hooks/use_file_image_viewer/index.js +53 -50
  42. package/dist/components/file_view/components/image_viewer/hooks/use_file_image_viewer/index.js.map +1 -1
  43. package/dist/components/file_view/components/image_viewer/types/index.d.ts +2 -0
  44. package/dist/components/file_view/components/office_viewer/components/file_office_viewer_content/index.d.ts +1 -1
  45. package/dist/components/file_view/components/office_viewer/components/file_office_viewer_content/index.js +39 -53
  46. package/dist/components/file_view/components/office_viewer/components/file_office_viewer_content/index.js.map +1 -1
  47. package/dist/components/file_view/components/office_viewer/hooks/use_office_embed_overlay/index.js +15 -13
  48. package/dist/components/file_view/components/office_viewer/hooks/use_office_embed_overlay/index.js.map +1 -1
  49. package/dist/components/file_view/components/office_viewer/index.d.ts +1 -1
  50. package/dist/components/file_view/components/office_viewer/index.js +15 -13
  51. package/dist/components/file_view/components/office_viewer/index.js.map +1 -1
  52. package/dist/components/file_view/components/office_viewer/types/index.d.ts +2 -0
  53. package/dist/components/file_view/components/pdf_viewer/components/content/index.js +43 -44
  54. package/dist/components/file_view/components/pdf_viewer/components/content/index.js.map +1 -1
  55. package/dist/components/file_view/components/pdf_viewer/components/file_pdf_viewer_content/index.d.ts +1 -1
  56. package/dist/components/file_view/components/pdf_viewer/components/file_pdf_viewer_content/index.js +28 -27
  57. package/dist/components/file_view/components/pdf_viewer/components/file_pdf_viewer_content/index.js.map +1 -1
  58. package/dist/components/file_view/components/pdf_viewer/types/index.d.ts +2 -0
  59. package/dist/components/file_view/components/source_viewer/index.d.ts +3 -1
  60. package/dist/components/file_view/components/source_viewer/index.js +5 -5
  61. package/dist/components/file_view/components/source_viewer/index.js.map +1 -1
  62. package/dist/components/file_view/components/summary_viewer/index.d.ts +3 -1
  63. package/dist/components/file_view/components/summary_viewer/index.js +12 -18
  64. package/dist/components/file_view/components/summary_viewer/index.js.map +1 -1
  65. package/dist/components/file_view/components/template_viewer/components/file_template_viewer_inner/index.js +225 -226
  66. package/dist/components/file_view/components/template_viewer/components/file_template_viewer_inner/index.js.map +1 -1
  67. package/dist/components/file_view/components/template_viewer/components/pdf_template_page_row/index.js +54 -55
  68. package/dist/components/file_view/components/template_viewer/components/pdf_template_page_row/index.js.map +1 -1
  69. package/dist/components/file_view/components/template_viewer/components/pdf_template_viewer/components/pdf_template_viewer_content/index.d.ts +1 -1
  70. package/dist/components/file_view/components/template_viewer/components/pdf_template_viewer/components/pdf_template_viewer_content/index.js +17 -15
  71. package/dist/components/file_view/components/template_viewer/components/pdf_template_viewer/components/pdf_template_viewer_content/index.js.map +1 -1
  72. package/dist/components/file_view/components/template_viewer/components/pdf_template_viewer/types/index.d.ts +2 -0
  73. package/dist/components/file_view/components/template_viewer/types/index.d.ts +2 -0
  74. package/dist/components/file_view/components/transcription_viewer/index.d.ts +3 -1
  75. package/dist/components/file_view/components/transcription_viewer/index.js +15 -22
  76. package/dist/components/file_view/components/transcription_viewer/index.js.map +1 -1
  77. package/dist/components/file_view/components/unknown_viewer/index.d.ts +3 -1
  78. package/dist/components/file_view/components/unknown_viewer/index.js +3 -3
  79. package/dist/components/file_view/components/unknown_viewer/index.js.map +1 -1
  80. package/dist/components/file_view/components/video_player/components/file_video_player_content/index.d.ts +1 -1
  81. package/dist/components/file_view/components/video_player/components/file_video_player_content/index.js +37 -36
  82. package/dist/components/file_view/components/video_player/components/file_video_player_content/index.js.map +1 -1
  83. package/dist/components/file_view/components/video_player/types/index.d.ts +2 -0
  84. package/dist/components/file_view/components/xlsx_preview_viewer/components/file_xlsx_preview_viewer_content/index.d.ts +1 -1
  85. package/dist/components/file_view/components/xlsx_preview_viewer/components/file_xlsx_preview_viewer_content/index.js +23 -23
  86. package/dist/components/file_view/components/xlsx_preview_viewer/components/file_xlsx_preview_viewer_content/index.js.map +1 -1
  87. package/dist/components/file_view/components/xlsx_preview_viewer/index.d.ts +1 -1
  88. package/dist/components/file_view/components/xlsx_preview_viewer/index.js +4 -1
  89. package/dist/components/file_view/components/xlsx_preview_viewer/index.js.map +1 -1
  90. package/dist/components/file_view/components/xlsx_preview_viewer/types/index.d.ts +2 -0
  91. package/dist/components/file_view/hooks/index.d.ts +1 -0
  92. package/dist/components/file_view/hooks/use_file_view_loading_change.d.ts +2 -0
  93. package/dist/components/file_view/hooks/use_file_view_loading_change.js +13 -0
  94. package/dist/components/file_view/hooks/use_file_view_loading_change.js.map +1 -0
  95. package/dist/components/file_view/index.d.ts +1 -0
  96. package/dist/components/file_view/types/index.d.ts +1 -0
  97. package/dist/components/sonner/index.js +15 -13
  98. package/dist/components/sonner/index.js.map +1 -1
  99. package/package.json +1 -1
  100. package/dist/components/file_view/components/video_player/components/video_loading_overlay/index.js +0 -17
  101. package/dist/components/file_view/components/video_player/components/video_loading_overlay/index.js.map +0 -1
@@ -1,3 +1,3 @@
1
1
  import { FileAudioPlayerProps } from '../../types';
2
- declare const FileAudioPlayerContent: ({ url, fileName, onDownload, }: FileAudioPlayerProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const FileAudioPlayerContent: ({ url, fileName, onDownload, onLoadingChange, }: FileAudioPlayerProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export { FileAudioPlayerContent };
@@ -3,163 +3,166 @@ import { Tooltip as t, TooltipContent as n, TooltipTrigger as r } from "../../..
3
3
  import { Slider as i } from "../../../../../slider/index.js";
4
4
  import { FileViewErrorState as a } from "../../../error_state/index.js";
5
5
  import { downloadFileFromUrl as o } from "../../../../../../utilities/download.js";
6
- import { formatTime as s } from "../../utilities/index.js";
7
- import { useRef as c, useState as l } from "react";
8
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
- import { Download as f, Headphones as p, Pause as m, Play as h, RotateCcw as g, Volume2 as _, VolumeX as v } from "lucide-react";
10
- import { toast as y } from "sonner";
6
+ import { useFileViewLoadingChange as s } from "../../../../hooks/use_file_view_loading_change.js";
7
+ import { formatTime as c } from "../../utilities/index.js";
8
+ import { useRef as l, useState as u } from "react";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
+ import { Download as p, Headphones as m, Pause as h, Play as g, RotateCcw as _, Volume2 as v, VolumeX as y } from "lucide-react";
11
+ import { toast as b } from "sonner";
11
12
  //#region src/components/file_view/components/audio_player/components/file_audio_player_content/index.tsx
12
- var b = ({ url: b, fileName: x, onDownload: S }) => {
13
- let C = c(null), [w, T] = l(!1), [E, D] = l(0), [O, k] = l(0), [A, j] = l(1), [M, N] = l(!1), [P, F] = l(!1), I = async () => {
13
+ var x = ({ url: x, fileName: S, onDownload: C, onLoadingChange: w }) => {
14
+ let T = l(null), [E, D] = u(!1), [O, k] = u(0), [A, j] = u(0), [M, N] = u(1), [P, F] = u(!1), [I, L] = u(!1), [R, z] = u(!1);
15
+ s(!R && !I, w);
16
+ let B = async () => {
14
17
  try {
15
- if (S) {
16
- await S();
18
+ if (C) {
19
+ await C();
17
20
  return;
18
21
  }
19
- await o(b, x);
22
+ await o(x, S);
20
23
  } catch {
21
- y.error("No se pudo descargar el audio");
24
+ b.error("No se pudo descargar el audio");
22
25
  }
23
- }, L = () => {
24
- C.current && k(C.current.duration || 0);
25
- }, R = () => {
26
- C.current && D(C.current.currentTime || 0);
27
- }, z = () => {
28
- C.current && (w ? (C.current.pause(), T(!1)) : C.current.play().then(() => T(!0)).catch((e) => {
29
- console.error(e), F(!0), y.error("No se pudo reproducir el audio");
30
- }));
31
- }, B = (e) => {
32
- if (!C.current) return;
33
- let [t] = e, n = t / 100 * (O || 0);
34
- C.current.currentTime = n, D(n);
35
- }, V = (e) => {
36
- if (!C.current) return;
37
- let [t] = e, n = t / 100;
38
- C.current.volume = n, j(n), N(n === 0);
26
+ }, V = () => {
27
+ T.current && (j(T.current.duration || 0), z(!0));
39
28
  }, H = () => {
40
- C.current && (M ? (C.current.muted = !1, N(!1)) : (C.current.muted = !0, N(!0)));
29
+ T.current && k(T.current.currentTime || 0);
41
30
  }, U = () => {
42
- C.current && (C.current.currentTime = 0, D(0), w || z());
43
- }, W = () => {
44
- T(!1), D(O);
45
- }, G = () => {
46
- F(!0), y.error("Ha ocurrido un error al cargar el audio");
31
+ T.current && (E ? (T.current.pause(), D(!1)) : T.current.play().then(() => D(!0)).catch((e) => {
32
+ console.error(e), L(!0), b.error("No se pudo reproducir el audio");
33
+ }));
34
+ }, W = (e) => {
35
+ if (!T.current) return;
36
+ let [t] = e, n = t / 100 * (A || 0);
37
+ T.current.currentTime = n, k(n);
38
+ }, G = (e) => {
39
+ if (!T.current) return;
40
+ let [t] = e, n = t / 100;
41
+ T.current.volume = n, N(n), F(n === 0);
42
+ }, K = () => {
43
+ T.current && (P ? (T.current.muted = !1, F(!1)) : (T.current.muted = !0, F(!0)));
44
+ }, q = () => {
45
+ T.current && (T.current.currentTime = 0, k(0), E || U());
46
+ }, J = () => {
47
+ D(!1), k(A);
48
+ }, Y = () => {
49
+ L(!0), z(!1), b.error("Ha ocurrido un error al cargar el audio");
47
50
  };
48
- if (P) return /* @__PURE__ */ u(a, {});
49
- let K = O ? E / O * 100 : 0;
50
- return /* @__PURE__ */ d("div", {
51
+ if (I) return /* @__PURE__ */ d(a, {});
52
+ let X = A ? O / A * 100 : 0;
53
+ return /* @__PURE__ */ f("div", {
51
54
  className: "flex flex-col h-full w-full bg-background",
52
55
  children: [
53
- /* @__PURE__ */ d("div", {
56
+ /* @__PURE__ */ f("div", {
54
57
  className: "flex items-center justify-between px-4 py-3 bg-card border-b border-border shadow-sm",
55
- children: [/* @__PURE__ */ u("div", { className: "flex flex-col min-w-0" }), /* @__PURE__ */ d(t, { children: [/* @__PURE__ */ u(r, { children: /* @__PURE__ */ u(e, {
56
- onClick: I,
58
+ children: [/* @__PURE__ */ d("div", { className: "flex flex-col min-w-0" }), /* @__PURE__ */ f(t, { children: [/* @__PURE__ */ d(r, { children: /* @__PURE__ */ d(e, {
59
+ onClick: B,
57
60
  variant: "ghost",
58
61
  size: "icon",
59
62
  "aria-label": "Descargar audio",
60
- children: /* @__PURE__ */ u(f, { className: "size-5" })
61
- }) }), /* @__PURE__ */ u(n, { children: "Descargar audio" })] })]
63
+ children: /* @__PURE__ */ d(p, { className: "size-5" })
64
+ }) }), /* @__PURE__ */ d(n, { children: "Descargar audio" })] })]
62
65
  }),
63
- /* @__PURE__ */ d("div", {
66
+ /* @__PURE__ */ f("div", {
64
67
  className: "flex flex-1 items-center justify-center p-4 flex-col gap-4",
65
- children: [/* @__PURE__ */ u("div", {
68
+ children: [/* @__PURE__ */ d("div", {
66
69
  className: "w-full h-full p-4 rounded-md flex items-center justify-center bg-card",
67
- children: /* @__PURE__ */ u(p, { className: "size-10 text-muted-foreground" })
68
- }), /* @__PURE__ */ d("div", {
70
+ children: /* @__PURE__ */ d(m, { className: "size-10 text-muted-foreground" })
71
+ }), /* @__PURE__ */ f("div", {
69
72
  className: "w-full bg-card border border-border rounded-md p-4 flex flex-col gap-4",
70
- children: [/* @__PURE__ */ d("div", {
73
+ children: [/* @__PURE__ */ f("div", {
71
74
  className: "flex items-center gap-3",
72
75
  children: [
73
- /* @__PURE__ */ u(e, {
76
+ /* @__PURE__ */ d(e, {
74
77
  size: "icon",
75
78
  variant: "outline",
76
79
  className: "rounded-md size-11",
77
- onClick: z,
78
- "aria-label": w ? "Pausar" : "Reproducir",
79
- children: w ? /* @__PURE__ */ u(m, {
80
+ onClick: U,
81
+ "aria-label": E ? "Pausar" : "Reproducir",
82
+ children: E ? /* @__PURE__ */ d(h, {
80
83
  fill: "currentColor",
81
84
  className: "size-5"
82
- }) : /* @__PURE__ */ u(h, {
85
+ }) : /* @__PURE__ */ d(g, {
83
86
  fill: "currentColor",
84
87
  className: "size-5 translate-x-px"
85
88
  })
86
89
  }),
87
- /* @__PURE__ */ d("div", {
90
+ /* @__PURE__ */ f("div", {
88
91
  className: "flex flex-col flex-1 min-w-0",
89
- children: [/* @__PURE__ */ u("span", {
92
+ children: [/* @__PURE__ */ d("span", {
90
93
  className: "text-sm font-medium truncate",
91
- children: x || "Pista de audio"
92
- }), /* @__PURE__ */ d("span", {
94
+ children: S || "Pista de audio"
95
+ }), /* @__PURE__ */ f("span", {
93
96
  className: "text-xs text-muted-foreground truncate",
94
97
  children: [
95
- s(E),
98
+ c(O),
96
99
  " / ",
97
- s(O)
100
+ c(A)
98
101
  ]
99
102
  })]
100
103
  }),
101
- /* @__PURE__ */ d("div", {
104
+ /* @__PURE__ */ f("div", {
102
105
  className: "flex items-center gap-2",
103
- children: [/* @__PURE__ */ d(t, { children: [/* @__PURE__ */ u(r, { children: /* @__PURE__ */ u(e, {
106
+ children: [/* @__PURE__ */ f(t, { children: [/* @__PURE__ */ d(r, { children: /* @__PURE__ */ d(e, {
104
107
  size: "icon",
105
108
  variant: "ghost",
106
109
  className: "rounded-md",
107
- onClick: U,
110
+ onClick: q,
108
111
  "aria-label": "Reiniciar",
109
- children: /* @__PURE__ */ u(g, { className: "size-4" })
110
- }) }), /* @__PURE__ */ u(n, { children: "Reiniciar" })] }), /* @__PURE__ */ d("div", {
112
+ children: /* @__PURE__ */ d(_, { className: "size-4" })
113
+ }) }), /* @__PURE__ */ d(n, { children: "Reiniciar" })] }), /* @__PURE__ */ f("div", {
111
114
  className: "flex items-center gap-2 w-32",
112
- children: [/* @__PURE__ */ u(e, {
115
+ children: [/* @__PURE__ */ d(e, {
113
116
  size: "icon",
114
117
  variant: "ghost",
115
118
  className: "rounded-md",
116
- onClick: H,
117
- "aria-label": M ? "Activar sonido" : "Silenciar",
118
- children: u(M || A === 0 ? v : _, { className: "size-4" })
119
- }), /* @__PURE__ */ u(i, {
120
- value: [M ? 0 : A * 100],
119
+ onClick: K,
120
+ "aria-label": P ? "Activar sonido" : "Silenciar",
121
+ children: d(P || M === 0 ? y : v, { className: "size-4" })
122
+ }), /* @__PURE__ */ d(i, {
123
+ value: [P ? 0 : M * 100],
121
124
  max: 100,
122
125
  step: 1,
123
- onValueChange: V,
126
+ onValueChange: G,
124
127
  "aria-label": "Volumen"
125
128
  })]
126
129
  })]
127
130
  })
128
131
  ]
129
- }), /* @__PURE__ */ d("div", {
132
+ }), /* @__PURE__ */ f("div", {
130
133
  className: "flex items-center gap-3",
131
134
  children: [
132
- /* @__PURE__ */ u("span", {
135
+ /* @__PURE__ */ d("span", {
133
136
  className: "text-xs text-muted-foreground w-10 text-right",
134
- children: s(E)
137
+ children: c(O)
135
138
  }),
136
- /* @__PURE__ */ u(i, {
137
- value: [K],
139
+ /* @__PURE__ */ d(i, {
140
+ value: [X],
138
141
  max: 100,
139
142
  step: .5,
140
- onValueChange: B,
143
+ onValueChange: W,
141
144
  "aria-label": "Progreso"
142
145
  }),
143
- /* @__PURE__ */ u("span", {
146
+ /* @__PURE__ */ d("span", {
144
147
  className: "text-xs text-muted-foreground w-10",
145
- children: s(O)
148
+ children: c(A)
146
149
  })
147
150
  ]
148
151
  })]
149
152
  })]
150
153
  }),
151
- /* @__PURE__ */ u("audio", {
152
- ref: C,
153
- src: b,
154
- onLoadedMetadata: L,
155
- onTimeUpdate: R,
156
- onEnded: W,
157
- onError: G
154
+ /* @__PURE__ */ d("audio", {
155
+ ref: T,
156
+ src: x,
157
+ onLoadedMetadata: V,
158
+ onTimeUpdate: H,
159
+ onEnded: J,
160
+ onError: Y
158
161
  })
159
162
  ]
160
163
  });
161
164
  };
162
165
  //#endregion
163
- export { b as FileAudioPlayerContent };
166
+ export { x as FileAudioPlayerContent };
164
167
 
165
168
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../src/components/file_view/components/audio_player/components/file_audio_player_content/index.tsx"],"sourcesContent":["import { useRef, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport { downloadFileFromUrl } from \"@/utilities/download\";\nimport { FileViewErrorState } from \"../../../error_state\";\nimport { Button } from \"@/components/button\";\nimport { Slider } from \"@/components/slider\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@/components/tooltip\";\nimport {\n Download,\n Pause,\n Play,\n Volume2,\n VolumeX,\n RotateCcw,\n Headphones,\n} from \"lucide-react\";\nimport type { FileAudioPlayerProps } from \"../../types\";\nimport { formatTime } from \"../../utilities\";\n\nconst FileAudioPlayerContent = ({\n url,\n fileName,\n onDownload,\n}: FileAudioPlayerProps) => {\n const audioRef = useRef<HTMLAudioElement | null>(null);\n const [isPlaying, setIsPlaying] = useState(false);\n const [currentTime, setCurrentTime] = useState(0);\n const [duration, setDuration] = useState(0);\n const [volume, setVolume] = useState(1);\n const [isMuted, setIsMuted] = useState(false);\n const [hasError, setHasError] = useState(false);\n\n const handleDownloadFile = async () => {\n try {\n if (onDownload) {\n await onDownload();\n return;\n }\n await downloadFileFromUrl(url, fileName);\n } catch {\n toast.error(\"No se pudo descargar el audio\");\n }\n };\n\n const handleLoadedMetadata = () => {\n if (!audioRef.current) return;\n setDuration(audioRef.current.duration || 0);\n };\n\n const handleTimeUpdate = () => {\n if (!audioRef.current) return;\n setCurrentTime(audioRef.current.currentTime || 0);\n };\n\n const handlePlayPause = () => {\n if (!audioRef.current) return;\n if (isPlaying) {\n audioRef.current.pause();\n setIsPlaying(false);\n } else {\n audioRef.current\n .play()\n .then(() => setIsPlaying(true))\n .catch((error) => {\n console.error(error);\n setHasError(true);\n toast.error(\"No se pudo reproducir el audio\");\n });\n }\n };\n\n const handleSeek = (value: number[]) => {\n if (!audioRef.current) return;\n const [val] = value;\n const newTime = (val / 100) * (duration || 0);\n audioRef.current.currentTime = newTime;\n setCurrentTime(newTime);\n };\n\n const handleVolumeChange = (value: number[]) => {\n if (!audioRef.current) return;\n const [val] = value;\n const newVolume = val / 100;\n audioRef.current.volume = newVolume;\n setVolume(newVolume);\n setIsMuted(newVolume === 0);\n };\n\n const toggleMute = () => {\n if (!audioRef.current) return;\n if (isMuted) {\n audioRef.current.muted = false;\n setIsMuted(false);\n } else {\n audioRef.current.muted = true;\n setIsMuted(true);\n }\n };\n\n const handleRestart = () => {\n if (!audioRef.current) return;\n audioRef.current.currentTime = 0;\n setCurrentTime(0);\n if (!isPlaying) {\n handlePlayPause();\n }\n };\n\n const handleEnded = () => {\n setIsPlaying(false);\n setCurrentTime(duration);\n };\n\n const handleAudioError = () => {\n setHasError(true);\n toast.error(\"Ha ocurrido un error al cargar el audio\");\n };\n\n if (hasError) return <FileViewErrorState />;\n\n const progress = duration ? (currentTime / duration) * 100 : 0;\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background\">\n <div className=\"flex items-center justify-between px-4 py-3 bg-card border-b border-border shadow-sm\">\n <div className=\"flex flex-col min-w-0\" />\n\n <Tooltip>\n <TooltipTrigger>\n <Button\n onClick={handleDownloadFile}\n variant=\"ghost\"\n size=\"icon\"\n aria-label=\"Descargar audio\"\n >\n <Download className=\"size-5\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Descargar audio</TooltipContent>\n </Tooltip>\n </div>\n\n <div className=\"flex flex-1 items-center justify-center p-4 flex-col gap-4\">\n <div className=\"w-full h-full p-4 rounded-md flex items-center justify-center bg-card\">\n <Headphones className=\"size-10 text-muted-foreground\" />\n </div>\n <div className=\"w-full bg-card border border-border rounded-md p-4 flex flex-col gap-4\">\n <div className=\"flex items-center gap-3\">\n <Button\n size=\"icon\"\n variant=\"outline\"\n className=\"rounded-md size-11\"\n onClick={handlePlayPause}\n aria-label={isPlaying ? \"Pausar\" : \"Reproducir\"}\n >\n {isPlaying ? (\n <Pause fill=\"currentColor\" className=\"size-5\" />\n ) : (\n <Play fill=\"currentColor\" className=\"size-5 translate-x-px\" />\n )}\n </Button>\n\n <div className=\"flex flex-col flex-1 min-w-0\">\n <span className=\"text-sm font-medium truncate\">\n {fileName || \"Pista de audio\"}\n </span>\n <span className=\"text-xs text-muted-foreground truncate\">\n {formatTime(currentTime)} / {formatTime(duration)}\n </span>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <Tooltip>\n <TooltipTrigger>\n <Button\n size=\"icon\"\n variant=\"ghost\"\n className=\"rounded-md\"\n onClick={handleRestart}\n aria-label=\"Reiniciar\"\n >\n <RotateCcw className=\"size-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Reiniciar</TooltipContent>\n </Tooltip>\n\n <div className=\"flex items-center gap-2 w-32\">\n <Button\n size=\"icon\"\n variant=\"ghost\"\n className=\"rounded-md\"\n onClick={toggleMute}\n aria-label={isMuted ? \"Activar sonido\" : \"Silenciar\"}\n >\n {isMuted || volume === 0 ? (\n <VolumeX className=\"size-4\" />\n ) : (\n <Volume2 className=\"size-4\" />\n )}\n </Button>\n <Slider\n value={[isMuted ? 0 : volume * 100]}\n max={100}\n step={1}\n onValueChange={handleVolumeChange}\n aria-label=\"Volumen\"\n />\n </div>\n </div>\n </div>\n\n <div className=\"flex items-center gap-3\">\n <span className=\"text-xs text-muted-foreground w-10 text-right\">\n {formatTime(currentTime)}\n </span>\n <Slider\n value={[progress]}\n max={100}\n step={0.5}\n onValueChange={handleSeek}\n aria-label=\"Progreso\"\n />\n <span className=\"text-xs text-muted-foreground w-10\">\n {formatTime(duration)}\n </span>\n </div>\n </div>\n </div>\n\n <audio\n ref={audioRef}\n src={url}\n onLoadedMetadata={handleLoadedMetadata}\n onTimeUpdate={handleTimeUpdate}\n onEnded={handleEnded}\n onError={handleAudioError}\n />\n </div>\n );\n};\n\nexport { FileAudioPlayerContent };\n"],"mappings":";;;;;;;;;;;AAmBA,IAAM,KAA0B,EAC9B,QACA,aACA,oBAC0B;CAC1B,IAAM,IAAW,EAAgC,KAAK,EAChD,CAAC,GAAW,KAAgB,EAAS,GAAM,EAC3C,CAAC,GAAa,KAAkB,EAAS,EAAE,EAC3C,CAAC,GAAU,KAAe,EAAS,EAAE,EACrC,CAAC,GAAQ,KAAa,EAAS,EAAE,EACjC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAU,KAAe,EAAS,GAAM,EAEzC,IAAqB,YAAY;AACrC,MAAI;AACF,OAAI,GAAY;AACd,UAAM,GAAY;AAClB;;AAEF,SAAM,EAAoB,GAAK,EAAS;UAClC;AACN,KAAM,MAAM,gCAAgC;;IAI1C,UAA6B;AAC5B,IAAS,WACd,EAAY,EAAS,QAAQ,YAAY,EAAE;IAGvC,UAAyB;AACxB,IAAS,WACd,EAAe,EAAS,QAAQ,eAAe,EAAE;IAG7C,UAAwB;AACvB,IAAS,YACV,KACF,EAAS,QAAQ,OAAO,EACxB,EAAa,GAAM,IAEnB,EAAS,QACN,MAAM,CACN,WAAW,EAAa,GAAK,CAAC,CAC9B,OAAO,MAAU;AAGhB,GAFA,QAAQ,MAAM,EAAM,EACpB,EAAY,GAAK,EACjB,EAAM,MAAM,iCAAiC;IAC7C;IAIF,KAAc,MAAoB;AACtC,MAAI,CAAC,EAAS,QAAS;EACvB,IAAM,CAAC,KAAO,GACR,IAAW,IAAM,O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F,kBAAC,QAAD;QAAM,WAAU;kBACb,EAAW,EAAS;QAChB,CAAA;OACH;QACF;OACF;;GAEN,kBAAC,SAAD;IACE,KAAK;IACL,KAAK;IACL,kBAAkB;IAClB,cAAc;IACd,SAAS;IACT,SAAS;IACT,CAAA;GACE"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../src/components/file_view/components/audio_player/components/file_audio_player_content/index.tsx"],"sourcesContent":["import { useRef, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport { downloadFileFromUrl } from \"@/utilities/download\";\nimport { FileViewErrorState } from \"../../../error_state\";\nimport { Button } from \"@/components/button\";\nimport { Slider } from \"@/components/slider\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@/components/tooltip\";\nimport {\n Download,\n Pause,\n Play,\n Volume2,\n VolumeX,\n RotateCcw,\n Headphones,\n} from \"lucide-react\";\nimport type { FileAudioPlayerProps } from \"../../types\";\nimport { formatTime } from \"../../utilities\";\nimport { useFileViewLoadingChange } from \"../../../../hooks\";\n\nconst FileAudioPlayerContent = ({\n url,\n fileName,\n onDownload,\n onLoadingChange,\n}: FileAudioPlayerProps) => {\n const audioRef = useRef<HTMLAudioElement | null>(null);\n const [isPlaying, setIsPlaying] = useState(false);\n const [currentTime, setCurrentTime] = useState(0);\n const [duration, setDuration] = useState(0);\n const [volume, setVolume] = useState(1);\n const [isMuted, setIsMuted] = useState(false);\n const [hasError, setHasError] = useState(false);\n const [isReady, setIsReady] = useState(false);\n useFileViewLoadingChange(!isReady && !hasError, onLoadingChange);\n\n const handleDownloadFile = async () => {\n try {\n if (onDownload) {\n await onDownload();\n return;\n }\n await downloadFileFromUrl(url, fileName);\n } catch {\n toast.error(\"No se pudo descargar el audio\");\n }\n };\n\n const handleLoadedMetadata = () => {\n if (!audioRef.current) return;\n setDuration(audioRef.current.duration || 0);\n setIsReady(true);\n };\n\n const handleTimeUpdate = () => {\n if (!audioRef.current) return;\n setCurrentTime(audioRef.current.currentTime || 0);\n };\n\n const handlePlayPause = () => {\n if (!audioRef.current) return;\n if (isPlaying) {\n audioRef.current.pause();\n setIsPlaying(false);\n } else {\n audioRef.current\n .play()\n .then(() => setIsPlaying(true))\n .catch((error) => {\n console.error(error);\n setHasError(true);\n toast.error(\"No se pudo reproducir el audio\");\n });\n }\n };\n\n const handleSeek = (value: number[]) => {\n if (!audioRef.current) return;\n const [val] = value;\n const newTime = (val / 100) * (duration || 0);\n audioRef.current.currentTime = newTime;\n setCurrentTime(newTime);\n };\n\n const handleVolumeChange = (value: number[]) => {\n if (!audioRef.current) return;\n const [val] = value;\n const newVolume = val / 100;\n audioRef.current.volume = newVolume;\n setVolume(newVolume);\n setIsMuted(newVolume === 0);\n };\n\n const toggleMute = () => {\n if (!audioRef.current) return;\n if (isMuted) {\n audioRef.current.muted = false;\n setIsMuted(false);\n } else {\n audioRef.current.muted = true;\n setIsMuted(true);\n }\n };\n\n const handleRestart = () => {\n if (!audioRef.current) return;\n audioRef.current.currentTime = 0;\n setCurrentTime(0);\n if (!isPlaying) {\n handlePlayPause();\n }\n };\n\n const handleEnded = () => {\n setIsPlaying(false);\n setCurrentTime(duration);\n };\n\n const handleAudioError = () => {\n setHasError(true);\n setIsReady(false);\n toast.error(\"Ha ocurrido un error al cargar el audio\");\n };\n\n if (hasError) return <FileViewErrorState />;\n\n const progress = duration ? (currentTime / duration) * 100 : 0;\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background\">\n <div className=\"flex items-center justify-between px-4 py-3 bg-card border-b border-border shadow-sm\">\n <div className=\"flex flex-col min-w-0\" />\n\n <Tooltip>\n <TooltipTrigger>\n <Button\n onClick={handleDownloadFile}\n variant=\"ghost\"\n size=\"icon\"\n aria-label=\"Descargar audio\"\n >\n <Download className=\"size-5\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Descargar audio</TooltipContent>\n </Tooltip>\n </div>\n\n <div className=\"flex flex-1 items-center justify-center p-4 flex-col gap-4\">\n <div className=\"w-full h-full p-4 rounded-md flex items-center justify-center bg-card\">\n <Headphones className=\"size-10 text-muted-foreground\" />\n </div>\n <div className=\"w-full bg-card border border-border rounded-md p-4 flex flex-col gap-4\">\n <div className=\"flex items-center gap-3\">\n <Button\n size=\"icon\"\n variant=\"outline\"\n className=\"rounded-md size-11\"\n onClick={handlePlayPause}\n aria-label={isPlaying ? \"Pausar\" : \"Reproducir\"}\n >\n {isPlaying ? (\n <Pause fill=\"currentColor\" className=\"size-5\" />\n ) : (\n <Play fill=\"currentColor\" className=\"size-5 translate-x-px\" />\n )}\n </Button>\n\n <div className=\"flex flex-col flex-1 min-w-0\">\n <span className=\"text-sm font-medium truncate\">\n {fileName || \"Pista de audio\"}\n </span>\n <span className=\"text-xs text-muted-foreground truncate\">\n {formatTime(currentTime)} / {formatTime(duration)}\n </span>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <Tooltip>\n <TooltipTrigger>\n <Button\n size=\"icon\"\n variant=\"ghost\"\n className=\"rounded-md\"\n onClick={handleRestart}\n aria-label=\"Reiniciar\"\n >\n <RotateCcw className=\"size-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Reiniciar</TooltipContent>\n </Tooltip>\n\n <div className=\"flex items-center gap-2 w-32\">\n <Button\n size=\"icon\"\n variant=\"ghost\"\n className=\"rounded-md\"\n onClick={toggleMute}\n aria-label={isMuted ? \"Activar sonido\" : \"Silenciar\"}\n >\n {isMuted || volume === 0 ? (\n <VolumeX className=\"size-4\" />\n ) : (\n <Volume2 className=\"size-4\" />\n )}\n </Button>\n <Slider\n value={[isMuted ? 0 : volume * 100]}\n max={100}\n step={1}\n onValueChange={handleVolumeChange}\n aria-label=\"Volumen\"\n />\n </div>\n </div>\n </div>\n\n <div className=\"flex items-center gap-3\">\n <span className=\"text-xs text-muted-foreground w-10 text-right\">\n {formatTime(currentTime)}\n </span>\n <Slider\n value={[progress]}\n max={100}\n step={0.5}\n onValueChange={handleSeek}\n aria-label=\"Progreso\"\n />\n <span className=\"text-xs text-muted-foreground w-10\">\n {formatTime(duration)}\n </span>\n </div>\n </div>\n </div>\n\n <audio\n ref={audioRef}\n src={url}\n onLoadedMetadata={handleLoadedMetadata}\n onTimeUpdate={handleTimeUpdate}\n onEnded={handleEnded}\n onError={handleAudioError}\n />\n </div>\n );\n};\n\nexport { FileAudioPlayerContent };\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAM,KAA0B,EAC9B,QACA,aACA,eACA,yBAC0B;CAC1B,IAAM,IAAW,EAAgC,KAAK,EAChD,CAAC,GAAW,KAAgB,EAAS,GAAM,EAC3C,CAAC,GAAa,KAAkB,EAAS,EAAE,EAC3C,CAAC,GAAU,KAAe,EAAS,EAAE,EACrC,CAAC,GAAQ,KAAa,EAAS,EAAE,EACjC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAU,KAAe,EAAS,GAAM,EACzC,CAAC,GAAS,KAAc,EAAS,GAAM;AAC7C,GAAyB,CAAC,KAAW,CAAC,GAAU,EAAgB;CAEhE,IAAM,IAAqB,YAAY;AACrC,MAAI;AACF,OAAI,GAAY;AACd,UAAM,GAAY;AAClB;;AAEF,SAAM,EAAoB,GAAK,EAAS;UAClC;AACN,KAAM,MAAM,gCAAgC;;IAI1C,UAA6B;AAC5B,IAAS,YACd,EAAY,EAAS,QAAQ,YAAY,EAAE,EAC3C,EAAW,GAAK;IAGZ,UAAyB;AACxB,IAAS,WACd,EAAe,EAAS,QAAQ,eAAe,EAAE;IAG7C,UAAwB;AACvB,IAAS,YACV,KACF,EAAS,QAAQ,OAAO,EACxB,EAAa,GAAM,IAEnB,EAAS,QACN,MAAM,CACN,WAAW,EAAa,GAAK,CAAC,CAC9B,OAAO,MAAU;AAGhB,GAFA,QAAQ,MAAM,EAAM,EACpB,EAAY,GAAK,EACjB,EAAM,MAAM,iCAAiC;IAC7C;IAIF,KAAc,MAAoB;AACtC,MAAI,CAAC,EAAS,QAAS;EACvB,IAAM,CAAC,KAAO,GACR,IAAW,IAAM,OAAQ,KAAY;AAE3C,E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,kBAAC,QAAD;QAAM,WAAU;kBACb,EAAW,EAAS;QAChB,CAAA;OACH;QACF;OACF;;GAEN,kBAAC,SAAD;IACE,KAAK;IACL,KAAK;IACL,kBAAkB;IAClB,cAAc;IACd,SAAS;IACT,SAAS;IACT,CAAA;GACE"}
@@ -1,5 +1,7 @@
1
+ import { FileViewLoadingChangeHandler } from '../../../types';
1
2
  export interface FileAudioPlayerProps {
2
3
  url: string;
3
4
  fileName?: string;
4
5
  onDownload?: () => void | Promise<void>;
6
+ onLoadingChange?: FileViewLoadingChangeHandler;
5
7
  }
@@ -1,3 +1,3 @@
1
1
  import { FileDocxPreviewViewerProps } from '../../types';
2
- declare const FileDocxPreviewViewerContent: ({ file, }: FileDocxPreviewViewerProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const FileDocxPreviewViewerContent: ({ file, onLoadingChange, }: FileDocxPreviewViewerProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export { FileDocxPreviewViewerContent };
@@ -1,5 +1,5 @@
1
1
  import { StatusMessage as e } from "../../../../../status_message/index.js";
2
- import { FileViewLoadingState as t } from "../../../loading_state/index.js";
2
+ import { useFileViewLoadingChange as t } from "../../../../hooks/use_file_view_loading_change.js";
3
3
  import { Toolbar as n } from "../toolbar/index.js";
4
4
  import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
5
5
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
@@ -7,8 +7,10 @@ import { FileX as l } from "lucide-react";
7
7
  import { toast as u } from "sonner";
8
8
  import { renderAsync as d } from "docx-preview";
9
9
  //#region src/components/file_view/components/docx_preview_viewer/components/file_docx_preview_viewer_content/index.tsx
10
- var f = ({ file: f }) => {
11
- let p = a(null), [m, h] = o(!0), [g, _] = o(null), [v, y] = o(1), b = r(() => y((e) => Math.min(e + .2, 3)), []), x = r(() => y((e) => Math.max(e - .2, .5)), []), S = r(() => {
10
+ var f = ({ file: f, onLoadingChange: p }) => {
11
+ let m = a(null), [h, g] = o(!0), [_, v] = o(null), [y, b] = o(1);
12
+ t(h && !_, p);
13
+ let x = r(() => b((e) => Math.min(e + .2, 3)), []), S = r(() => b((e) => Math.max(e - .2, .5)), []), C = r(() => {
12
14
  try {
13
15
  let e = window.URL.createObjectURL(f), t = document.createElement("a");
14
16
  t.href = e, t.download = f.name || "documento.docx", document.body.appendChild(t), t.click(), document.body.removeChild(t), window.URL.revokeObjectURL(e);
@@ -17,8 +19,8 @@ var f = ({ file: f }) => {
17
19
  }
18
20
  }, [f]);
19
21
  return i(() => {
20
- if (!p.current) return;
21
- let e = p.current, t = !1;
22
+ if (!m.current) return;
23
+ let e = m.current, t = !1;
22
24
  return e.innerHTML = "", f.arrayBuffer().then((t) => d(t, e, void 0, {
23
25
  className: "docx-preview-container",
24
26
  inWrapper: !0,
@@ -28,9 +30,9 @@ var f = ({ file: f }) => {
28
30
  breakPages: !0,
29
31
  useBase64URL: !0
30
32
  })).then(() => {
31
- t || h(!1);
33
+ t || g(!1);
32
34
  }).catch((e) => {
33
- t || (h(!1), _(e instanceof Error ? e.message : "Error al renderizar el documento"));
35
+ t || (g(!1), v(e instanceof Error ? e.message : "Error al renderizar el documento"));
34
36
  }), () => {
35
37
  t = !0;
36
38
  };
@@ -38,36 +40,32 @@ var f = ({ file: f }) => {
38
40
  className: "relative w-full h-full bg-accent",
39
41
  children: [/* @__PURE__ */ c("div", {
40
42
  className: "w-full h-full overflow-auto",
41
- children: [
42
- m && /* @__PURE__ */ s(t, { className: "absolute inset-0 z-10 bg-background" }),
43
- g && /* @__PURE__ */ s("div", {
44
- className: "absolute inset-0 z-10 flex min-h-0 bg-background p-4",
45
- children: /* @__PURE__ */ s(e, {
46
- title: "Error al renderizar el documento",
47
- description: g,
48
- icon: l,
49
- classNameCard: "h-full w-full flex-col items-center justify-center",
50
- classNameIconCard: "mx-auto",
51
- classNameDescription: "text-center w-full max-w-sm",
52
- classNameTitle: "text-center w-full",
53
- color: "rose"
54
- })
55
- }),
56
- /* @__PURE__ */ s("div", {
57
- ref: p,
58
- className: "w-full min-h-full p-4 transition-transform duration-200",
59
- style: {
60
- transform: `scale(${v})`,
61
- transformOrigin: "top center"
62
- }
43
+ children: [_ && /* @__PURE__ */ s("div", {
44
+ className: "absolute inset-0 z-10 flex min-h-0 bg-background p-4",
45
+ children: /* @__PURE__ */ s(e, {
46
+ title: "Error al renderizar el documento",
47
+ description: _,
48
+ icon: l,
49
+ classNameCard: "h-full w-full flex-col items-center justify-center",
50
+ classNameIconCard: "mx-auto",
51
+ classNameDescription: "text-center w-full max-w-sm",
52
+ classNameTitle: "text-center w-full",
53
+ color: "rose"
63
54
  })
64
- ]
65
- }), !g && /* @__PURE__ */ s(n, {
66
- scale: v,
67
- onZoomIn: b,
68
- onZoomOut: x,
69
- onDownload: S,
70
- disabled: m
55
+ }), /* @__PURE__ */ s("div", {
56
+ ref: m,
57
+ className: "w-full min-h-full p-4 transition-transform duration-200",
58
+ style: {
59
+ transform: `scale(${y})`,
60
+ transformOrigin: "top center"
61
+ }
62
+ })]
63
+ }), !_ && /* @__PURE__ */ s(n, {
64
+ scale: y,
65
+ onZoomIn: x,
66
+ onZoomOut: S,
67
+ onDownload: C,
68
+ disabled: h
71
69
  })]
72
70
  });
73
71
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../src/components/file_view/components/docx_preview_viewer/components/file_docx_preview_viewer_content/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { renderAsync } from \"docx-preview\";\nimport { FileX } from \"lucide-react\";\nimport { toast } from \"sonner\";\nimport { StatusMessage } from \"@/components/status_message\";\nimport { FileViewLoadingState } from \"../../../loading_state\";\nimport { Toolbar } from \"../toolbar\";\nimport type { FileDocxPreviewViewerProps } from \"../../types\";\n\nconst FileDocxPreviewViewerContent = ({\n file,\n}: FileDocxPreviewViewerProps) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [scale, setScale] = useState(1);\n\n const handleZoomIn = useCallback(\n () => setScale((prev) => Math.min(prev + 0.2, 3.0)),\n [],\n );\n\n const handleZoomOut = useCallback(\n () => setScale((prev) => Math.max(prev - 0.2, 0.5)),\n [],\n );\n\n const handleDownload = useCallback(() => {\n try {\n const blobUrl = window.URL.createObjectURL(file);\n const link = document.createElement(\"a\");\n link.href = blobUrl;\n link.download = file.name || \"documento.docx\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n window.URL.revokeObjectURL(blobUrl);\n } catch (downloadError) {\n console.error(downloadError);\n toast.error(\"Error al descargar el documento\");\n }\n }, [file]);\n\n useEffect(() => {\n if (!containerRef.current) return;\n const el = containerRef.current;\n let cancelled = false;\n el.innerHTML = \"\";\n\n file\n .arrayBuffer()\n .then((buffer) =>\n renderAsync(buffer, el, undefined, {\n className: \"docx-preview-container\",\n inWrapper: true,\n ignoreWidth: false,\n ignoreHeight: false,\n ignoreFonts: false,\n breakPages: true,\n useBase64URL: true,\n }),\n )\n .then(() => {\n if (!cancelled) setLoading(false);\n })\n .catch((err) => {\n if (!cancelled) {\n setLoading(false);\n setError(\n err instanceof Error\n ? err.message\n : \"Error al renderizar el documento\",\n );\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [file]);\n\n return (\n <div className=\"relative w-full h-full bg-accent\">\n <div className=\"w-full h-full overflow-auto\">\n {loading && (\n <FileViewLoadingState className=\"absolute inset-0 z-10 bg-background\" />\n )}\n {error && (\n <div className=\"absolute inset-0 z-10 flex min-h-0 bg-background p-4\">\n <StatusMessage\n title=\"Error al renderizar el documento\"\n description={error}\n icon={FileX}\n classNameCard=\"h-full w-full flex-col items-center justify-center\"\n classNameIconCard=\"mx-auto\"\n classNameDescription=\"text-center w-full max-w-sm\"\n classNameTitle=\"text-center w-full\"\n color=\"rose\"\n />\n </div>\n )}\n <div\n ref={containerRef}\n className=\"w-full min-h-full p-4 transition-transform duration-200\"\n style={{\n transform: `scale(${scale})`,\n transformOrigin: \"top center\",\n }}\n />\n </div>\n {!error && (\n <Toolbar\n scale={scale}\n onZoomIn={handleZoomIn}\n onZoomOut={handleZoomOut}\n onDownload={handleDownload}\n disabled={loading}\n />\n )}\n </div>\n );\n};\n\nexport { FileDocxPreviewViewerContent };\n"],"mappings":";;;;;;;;;AASA,IAAM,KAAgC,EACpC,cACgC;CAChC,IAAM,IAAe,EAAuB,KAAK,EAC3C,CAAC,GAAS,KAAc,EAAS,GAAK,EACtC,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAO,KAAY,EAAS,EAAE,EAE/B,IAAe,QACb,GAAU,MAAS,KAAK,IAAI,IAAO,IAAK,EAAI,CAAC,EACnD,EAAE,CACH,EAEK,IAAgB,QACd,GAAU,MAAS,KAAK,IAAI,IAAO,IAAK,GAAI,CAAC,EACnD,EAAE,CACH,EAEK,IAAiB,QAAkB;AACvC,MAAI;GACF,IAAM,IAAU,OAAO,IAAI,gBAAgB,EAAK,EAC1C,IAAO,SAAS,cAAc,IAAI;AAMxC,GALA,EAAK,OAAO,GACZ,EAAK,WAAW,EAAK,QAAQ,kBAC7B,SAAS,KAAK,YAAY,EAAK,EAC/B,EAAK,OAAO,EACZ,SAAS,KAAK,YAAY,EAAK,EAC/B,OAAO,IAAI,gBAAgB,EAAQ;WAC5B,GAAe;AAEtB,GADA,QAAQ,MAAM,EAAc,EAC5B,EAAM,MAAM,kCAAkC;;IAE/C,CAAC,EAAK,CAAC;AAwCV,QAtCA,QAAgB;AACd,MAAI,CAAC,EAAa,QAAS;EAC3B,IAAM,IAAK,EAAa,SACpB,IAAY;AA8BhB,SA7BA,EAAG,YAAY,IAEf,EACG,aAAa,CACb,MAAM,MACL,EAAY,GAAQ,GAAI,KAAA,GAAW;GACjC,WAAW;GACX,WAAW;GACX,aAAa;GACb,cAAc;GACd,aAAa;GACb,YAAY;GACZ,cAAc;GACf,CAAC,CACH,CACA,WAAW;AACV,GAAK,KAAW,EAAW,GAAM;IACjC,CACD,OAAO,MAAQ;AACd,GAAK,MACH,EAAW,GAAM,EACjB,EACE,aAAe,QACX,EAAI,UACJ,mCACL;IAEH,QAES;AACX,OAAY;;IAEb,CAAC,EAAK,CAAC,EAGR,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf;IACG,KACC,kBAAC,GAAD,EAAsB,WAAU,uCAAwC,CAAA;IAEzE,KACC,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD;MACE,OAAM;MACN,aAAa;MACb,MAAM;MACN,eAAc;MACd,mBAAkB;MAClB,sBAAqB;MACrB,gBAAe;MACf,OAAM;MACN,CAAA;KACE,CAAA;IAER,kBAAC,OAAD;KACE,KAAK;KACL,WAAU;KACV,OAAO;MACL,WAAW,SAAS,EAAM;MAC1B,iBAAiB;MAClB;KACD,CAAA;IACE;MACL,CAAC,KACA,kBAAC,GAAD;GACS;GACP,UAAU;GACV,WAAW;GACX,YAAY;GACZ,UAAU;GACV,CAAA,CAEA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../src/components/file_view/components/docx_preview_viewer/components/file_docx_preview_viewer_content/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { renderAsync } from \"docx-preview\";\nimport { FileX } from \"lucide-react\";\nimport { toast } from \"sonner\";\nimport { StatusMessage } from \"@/components/status_message\";\nimport { useFileViewLoadingChange } from \"../../../../hooks\";\nimport { Toolbar } from \"../toolbar\";\nimport type { FileDocxPreviewViewerProps } from \"../../types\";\n\nconst FileDocxPreviewViewerContent = ({\n file,\n onLoadingChange,\n}: FileDocxPreviewViewerProps) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [scale, setScale] = useState(1);\n useFileViewLoadingChange(loading && !error, onLoadingChange);\n\n const handleZoomIn = useCallback(\n () => setScale((prev) => Math.min(prev + 0.2, 3.0)),\n [],\n );\n\n const handleZoomOut = useCallback(\n () => setScale((prev) => Math.max(prev - 0.2, 0.5)),\n [],\n );\n\n const handleDownload = useCallback(() => {\n try {\n const blobUrl = window.URL.createObjectURL(file);\n const link = document.createElement(\"a\");\n link.href = blobUrl;\n link.download = file.name || \"documento.docx\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n window.URL.revokeObjectURL(blobUrl);\n } catch (downloadError) {\n console.error(downloadError);\n toast.error(\"Error al descargar el documento\");\n }\n }, [file]);\n\n useEffect(() => {\n if (!containerRef.current) return;\n const el = containerRef.current;\n let cancelled = false;\n el.innerHTML = \"\";\n\n file\n .arrayBuffer()\n .then((buffer) =>\n renderAsync(buffer, el, undefined, {\n className: \"docx-preview-container\",\n inWrapper: true,\n ignoreWidth: false,\n ignoreHeight: false,\n ignoreFonts: false,\n breakPages: true,\n useBase64URL: true,\n }),\n )\n .then(() => {\n if (!cancelled) setLoading(false);\n })\n .catch((err) => {\n if (!cancelled) {\n setLoading(false);\n setError(\n err instanceof Error\n ? err.message\n : \"Error al renderizar el documento\",\n );\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [file]);\n\n return (\n <div className=\"relative w-full h-full bg-accent\">\n <div className=\"w-full h-full overflow-auto\">\n {error && (\n <div className=\"absolute inset-0 z-10 flex min-h-0 bg-background p-4\">\n <StatusMessage\n title=\"Error al renderizar el documento\"\n description={error}\n icon={FileX}\n classNameCard=\"h-full w-full flex-col items-center justify-center\"\n classNameIconCard=\"mx-auto\"\n classNameDescription=\"text-center w-full max-w-sm\"\n classNameTitle=\"text-center w-full\"\n color=\"rose\"\n />\n </div>\n )}\n <div\n ref={containerRef}\n className=\"w-full min-h-full p-4 transition-transform duration-200\"\n style={{\n transform: `scale(${scale})`,\n transformOrigin: \"top center\",\n }}\n />\n </div>\n {!error && (\n <Toolbar\n scale={scale}\n onZoomIn={handleZoomIn}\n onZoomOut={handleZoomOut}\n onDownload={handleDownload}\n disabled={loading}\n />\n )}\n </div>\n );\n};\n\nexport { FileDocxPreviewVi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,EAAK,CAAC,EAGR,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACG,KACC,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,GAAD;KACE,OAAM;KACN,aAAa;KACb,MAAM;KACN,eAAc;KACd,mBAAkB;KAClB,sBAAqB;KACrB,gBAAe;KACf,OAAM;KACN,CAAA;IACE,CAAA,EAER,kBAAC,OAAD;IACE,KAAK;IACL,WAAU;IACV,OAAO;KACL,WAAW,SAAS,EAAM;KAC1B,iBAAiB;KAClB;IACD,CAAA,CACE;MACL,CAAC,KACA,kBAAC,GAAD;GACS;GACP,UAAU;GACV,WAAW;GACX,YAAY;GACZ,UAAU;GACV,CAAA,CAEA"}
@@ -1,3 +1,3 @@
1
1
  import { FileDocxPreviewViewerProps } from './types';
2
- export declare const FileDocxPreviewViewer: ({ file, }: FileDocxPreviewViewerProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const FileDocxPreviewViewer: ({ file, onLoadingChange, }: FileDocxPreviewViewerProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export type { FileDocxPreviewViewerProps } from './types';
@@ -2,7 +2,10 @@ import { getFilePreviewKey as e } from "../../utilities/file_preview_key.js";
2
2
  import { FileDocxPreviewViewerContent as t } from "./components/file_docx_preview_viewer_content/index.js";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  //#region src/components/file_view/components/docx_preview_viewer/index.tsx
5
- var r = ({ file: r }) => /* @__PURE__ */ n(t, { file: r }, e(r));
5
+ var r = ({ file: r, onLoadingChange: i }) => /* @__PURE__ */ n(t, {
6
+ file: r,
7
+ onLoadingChange: i
8
+ }, e(r));
6
9
  //#endregion
7
10
  export { r as FileDocxPreviewViewer };
8
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/file_view/components/docx_preview_viewer/index.tsx"],"sourcesContent":["import { getFilePreviewKey } from \"../../utilities/file_preview_key\";\nimport { FileDocxPreviewViewerContent } from \"./components/file_docx_preview_viewer_content\";\nimport type { FileDocxPreviewViewerProps } from \"./types\";\n\nexport const FileDocxPreviewViewer = ({\n file,\n}: FileDocxPreviewViewerProps) => (\n <FileDocxPreviewViewerContent key={getFilePreviewKey(file)} file={file} />\n);\n\nexport type { FileDocxPreviewViewerProps } from \"./types\";\n"],"mappings":";;;;AAIA,IAAa,KAAyB,EACpC,cAEA,kBAAC,GAAD,EAAkE,SAAQ,EAAvC,EAAkB,EAAK,CAAgB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/file_view/components/docx_preview_viewer/index.tsx"],"sourcesContent":["import { getFilePreviewKey } from \"../../utilities/file_preview_key\";\nimport { FileDocxPreviewViewerContent } from \"./components/file_docx_preview_viewer_content\";\nimport type { FileDocxPreviewViewerProps } from \"./types\";\n\nexport const FileDocxPreviewViewer = ({\n file,\n onLoadingChange,\n}: FileDocxPreviewViewerProps) => (\n <FileDocxPreviewViewerContent\n key={getFilePreviewKey(file)}\n file={file}\n onLoadingChange={onLoadingChange}\n />\n);\n\nexport type { FileDocxPreviewViewerProps } from \"./types\";\n"],"mappings":";;;;AAIA,IAAa,KAAyB,EACpC,SACA,yBAEA,kBAAC,GAAD;CAEQ;CACW;CACjB,EAHK,EAAkB,EAAK,CAG5B"}
@@ -1,3 +1,5 @@
1
+ import { FileViewLoadingChangeHandler } from '../../../types';
1
2
  export interface FileDocxPreviewViewerProps {
2
3
  file: File;
4
+ onLoadingChange?: FileViewLoadingChangeHandler;
3
5
  }
@@ -1,3 +1,4 @@
1
+ import { FileViewLoadingChangeHandler } from '../../types';
1
2
  export interface FileEditViewerProps {
2
3
  isPending?: boolean;
3
4
  isError?: boolean;
@@ -5,5 +6,6 @@ export interface FileEditViewerProps {
5
6
  isEmpty?: boolean;
6
7
  onRetry?: () => void;
7
8
  children?: React.ReactNode;
9
+ onLoadingChange?: FileViewLoadingChangeHandler;
8
10
  }
9
- export declare const FileEditViewer: ({ isPending, isError, isUnsupported, isEmpty, onRetry, children, }: FileEditViewerProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const FileEditViewer: ({ isPending, isError, isUnsupported, isEmpty, onRetry, children, onLoadingChange, }: FileEditViewerProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,36 +1,31 @@
1
1
  import { Button as e } from "../../../button/index.js";
2
2
  import { StatusMessage as t } from "../../../status_message/index.js";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- import { FileX as i, Loader2 as a, RefreshCw as o } from "lucide-react";
3
+ import { useFileViewLoadingChange as n } from "../../hooks/use_file_view_loading_change.js";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { FileX as a, RefreshCw as o } from "lucide-react";
5
6
  //#region src/components/file_view/components/edit_viewer/index.tsx
6
- var s = ({ isPending: s = !1, isError: c = !1, isUnsupported: l = !1, isEmpty: u = !1, onRetry: d, children: f }) => s ? /* @__PURE__ */ r("div", {
7
- className: "flex h-full min-h-[240px] flex-col items-center justify-center gap-2 text-muted-foreground",
8
- children: [/* @__PURE__ */ n(a, { className: "size-8 animate-spin" }), /* @__PURE__ */ n("p", {
9
- className: "text-sm",
10
- children: "Importando contenido del documento…"
11
- })]
12
- }) : c ? /* @__PURE__ */ r("div", {
7
+ var s = ({ isPending: s = !1, isError: c = !1, isUnsupported: l = !1, isEmpty: u = !1, onRetry: d, children: f, onLoadingChange: p }) => (n(s, p), s ? null : c ? /* @__PURE__ */ i("div", {
13
8
  className: "p-6 flex flex-col items-center gap-4",
14
- children: [/* @__PURE__ */ n(t, {
9
+ children: [/* @__PURE__ */ r(t, {
15
10
  title: "No se pudo importar el documento",
16
11
  description: l ? "Este tipo de archivo aún no está soportado para edición (p. ej. .doc clásico)." : "Vuelve a intentarlo. Si el error persiste, contacta con soporte.",
17
- icon: i
18
- }), d ? /* @__PURE__ */ r(e, {
12
+ icon: a
13
+ }), d ? /* @__PURE__ */ i(e, {
19
14
  variant: "outline",
20
15
  onClick: d,
21
- children: [/* @__PURE__ */ n(o, { className: "size-4 mr-2" }), "Reintentar"]
16
+ children: [/* @__PURE__ */ r(o, { className: "size-4 mr-2" }), "Reintentar"]
22
17
  }) : null]
23
- }) : u ? /* @__PURE__ */ n("div", {
18
+ }) : u ? /* @__PURE__ */ r("div", {
24
19
  className: "p-6",
25
- children: /* @__PURE__ */ n(t, {
20
+ children: /* @__PURE__ */ r(t, {
26
21
  title: "Contenido vacío",
27
22
  description: "No se obtuvo contenido editable a partir del archivo.",
28
- icon: i
23
+ icon: a
29
24
  })
30
- }) : /* @__PURE__ */ n("div", {
25
+ }) : /* @__PURE__ */ r("div", {
31
26
  className: "h-full min-h-[400px] flex flex-col",
32
27
  children: f
33
- });
28
+ }));
34
29
  //#endregion
35
30
  export { s as FileEditViewer };
36
31
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/file_view/components/edit_viewer/index.tsx"],"sourcesContent":["import { Loader2, RefreshCw, FileX } from \"lucide-react\";\nimport { Button } from \"@/components/button\";\nimport { StatusMessage } from \"@/components/status_message\";\n\nexport interface FileEditViewerProps {\n isPending?: boolean;\n isError?: boolean;\n isUnsupported?: boolean;\n isEmpty?: boolean;\n onRetry?: () => void;\n children?: React.ReactNode;\n}\n\nexport const FileEditViewer = ({\n isPending = false,\n isError = false,\n isUnsupported = false,\n isEmpty = false,\n onRetry,\n children,\n}: FileEditViewerProps) => {\n if (isPending) {\n return (\n <div className=\"flex h-full min-h-[240px] flex-col items-center justify-center gap-2 text-muted-foreground\">\n <Loader2 className=\"size-8 animate-spin\" />\n <p className=\"text-sm\">Importando contenido del documento…</p>\n </div>\n );\n }\n\n if (isError) {\n return (\n <div className=\"p-6 flex flex-col items-center gap-4\">\n <StatusMessage\n title=\"No se pudo importar el documento\"\n description={\n isUnsupported\n ? \"Este tipo de archivo aún no está soportado para edición (p. ej. .doc clásico).\"\n : \"Vuelve a intentarlo. Si el error persiste, contacta con soporte.\"\n }\n icon={FileX}\n />\n {onRetry ? (\n <Button variant=\"outline\" onClick={onRetry}>\n <RefreshCw className=\"size-4 mr-2\" />\n Reintentar\n </Button>\n ) : null}\n </div>\n );\n }\n\n if (isEmpty) {\n return (\n <div className=\"p-6\">\n <StatusMessage\n title=\"Contenido vacío\"\n description=\"No se obtuvo contenido editable a partir del archivo.\"\n icon={FileX}\n />\n </div>\n );\n }\n\n return <div className=\"h-full min-h-[400px] flex flex-col\">{children}</div>;\n};\n"],"mappings":";;;;;AAaA,IAAa,KAAkB,EAC7B,eAAY,IACZ,aAAU,IACV,mBAAgB,IAChB,aAAU,IACV,YACA,kBAEI,IAEA,kBAAC,OAAD;CAAK,WAAU;WAAf,CACE,kBAAC,GAAD,EAAS,WAAU,uBAAwB,CAAA,EAC3C,kBAAC,KAAD;EAAG,WAAU;YAAU;EAAuC,CAAA,CAC1D;KAIN,IAEA,kBAAC,OAAD;CAAK,WAAU;WAAf,CACE,kBAAC,GAAD;EACE,OAAM;EACN,aACE,IACI,mFACA;EAEN,MAAM;EACN,CAAA,EACD,IACC,kBAAC,GAAD;EAAQ,SAAQ;EAAU,SAAS;YAAnC,CACE,kBAAC,GAAD,EAAW,WAAU,eAAgB,CAAA,EAAA,aAE9B;MACP,KACA;KAIN,IAEA,kBAAC,OAAD;CAAK,WAAU;WACb,kBAAC,GAAD;EACE,OAAM;EACN,aAAY;EACZ,MAAM;EACN,CAAA;CACE,CAAA,GAIH,kBAAC,OAAD;CAAK,WAAU;CAAsC;CAAe,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/file_view/components/edit_viewer/index.tsx"],"sourcesContent":["import { RefreshCw, FileX } from \"lucide-react\";\nimport { Button } from \"@/components/button\";\nimport { StatusMessage } from \"@/components/status_message\";\nimport { useFileViewLoadingChange } from \"../../hooks\";\nimport type { FileViewLoadingChangeHandler } from \"../../types\";\n\nexport interface FileEditViewerProps {\n isPending?: boolean;\n isError?: boolean;\n isUnsupported?: boolean;\n isEmpty?: boolean;\n onRetry?: () => void;\n children?: React.ReactNode;\n onLoadingChange?: FileViewLoadingChangeHandler;\n}\n\nexport const FileEditViewer = ({\n isPending = false,\n isError = false,\n isUnsupported = false,\n isEmpty = false,\n onRetry,\n children,\n onLoadingChange,\n}: FileEditViewerProps) => {\n useFileViewLoadingChange(isPending, onLoadingChange);\n\n if (isPending) {\n return null;\n }\n\n if (isError) {\n return (\n <div className=\"p-6 flex flex-col items-center gap-4\">\n <StatusMessage\n title=\"No se pudo importar el documento\"\n description={\n isUnsupported\n ? \"Este tipo de archivo aún no está soportado para edición (p. ej. .doc clásico).\"\n : \"Vuelve a intentarlo. Si el error persiste, contacta con soporte.\"\n }\n icon={FileX}\n />\n {onRetry ? (\n <Button variant=\"outline\" onClick={onRetry}>\n <RefreshCw className=\"size-4 mr-2\" />\n Reintentar\n </Button>\n ) : null}\n </div>\n );\n }\n\n if (isEmpty) {\n return (\n <div className=\"p-6\">\n <StatusMessage\n title=\"Contenido vacío\"\n description=\"No se obtuvo contenido editable a partir del archivo.\"\n icon={FileX}\n />\n </div>\n );\n }\n\n return <div className=\"h-full min-h-[400px] flex flex-col\">{children}</div>;\n};\n"],"mappings":";;;;;;AAgBA,IAAa,KAAkB,EAC7B,eAAY,IACZ,aAAU,IACV,mBAAgB,IAChB,aAAU,IACV,YACA,aACA,0BAEA,EAAyB,GAAW,EAAgB,EAEhD,IACK,OAGL,IAEA,kBAAC,OAAD;CAAK,WAAU;WAAf,CACE,kBAAC,GAAD;EACE,OAAM;EACN,aACE,IACI,mFACA;EAEN,MAAM;EACN,CAAA,EACD,IACC,kBAAC,GAAD;EAAQ,SAAQ;EAAU,SAAS;YAAnC,CACE,kBAAC,GAAD,EAAW,WAAU,eAAgB,CAAA,EAAA,aAE9B;MACP,KACA;KAIN,IAEA,kBAAC,OAAD;CAAK,WAAU;WACb,kBAAC,GAAD;EACE,OAAM;EACN,aAAY;EACZ,MAAM;EACN,CAAA;CACE,CAAA,GAIH,kBAAC,OAAD;CAAK,WAAU;CAAsC;CAAe,CAAA"}
@@ -1,5 +1,7 @@
1
+ import { FileViewLoadingChangeHandler } from '../../types';
1
2
  export interface FileSimplePreviewRenderProps {
2
3
  file: File;
3
4
  url: string;
5
+ onLoadingChange?: FileViewLoadingChangeHandler;
4
6
  }
5
- export declare const FileSimplePreviewRender: ({ file, url }: FileSimplePreviewRenderProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const FileSimplePreviewRender: ({ file, url, onLoadingChange, }: FileSimplePreviewRenderProps) => import("react/jsx-runtime").JSX.Element;