pdf-tsx 0.8.0 → 0.10.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 (103) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/components/PDFSidebar.cjs +1 -1
  3. package/dist/cjs/components/PDFSidebar.module.cjs +1 -1
  4. package/dist/cjs/components/PDFViewer.cjs +1 -1
  5. package/dist/cjs/components/PDFViewer.module.cjs +1 -1
  6. package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
  7. package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
  8. package/dist/cjs/components/features/PDFAttachments.cjs +1 -1
  9. package/dist/cjs/components/features/PDFAttachments.module.cjs +1 -1
  10. package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
  11. package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
  12. package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
  13. package/dist/cjs/components/features/PDFNavigation.module.cjs +1 -1
  14. package/dist/cjs/components/features/PDFOutline.cjs +1 -1
  15. package/dist/cjs/components/features/PDFOutline.module.cjs +1 -1
  16. package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
  17. package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
  18. package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
  19. package/dist/cjs/components/features/PDFSearch.cjs +1 -1
  20. package/dist/cjs/components/features/PDFSearch.module.cjs +1 -1
  21. package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -1
  22. package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
  23. package/dist/cjs/components/features/PDFSignatures.module.cjs +1 -1
  24. package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
  25. package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
  26. package/dist/cjs/components/features/PDFThumbnails.module.cjs +1 -1
  27. package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
  28. package/dist/cjs/components/features/PDFZoomControls.module.cjs +1 -1
  29. package/dist/cjs/components/ui/PDFToolbar.cjs +1 -1
  30. package/dist/cjs/components/ui/PDFToolbarDropdownContext.cjs +1 -0
  31. package/dist/cjs/components/ui/PDFToolbarItem.cjs +1 -1
  32. package/dist/cjs/components/ui/ToolbarButton.cjs +1 -1
  33. package/dist/cjs/components/ui/ToolbarButton.module.cjs +1 -1
  34. package/dist/cjs/components/ui/icons.cjs +1 -1
  35. package/dist/cjs/context/ThemeContext.cjs +1 -1
  36. package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
  37. package/dist/cjs/hooks/useKeyboardShortcuts.cjs +1 -1
  38. package/dist/cjs/hooks/useOutline.cjs +1 -1
  39. package/dist/cjs/hooks/useOverlayRects.cjs +1 -1
  40. package/dist/cjs/hooks/usePDFLoader.cjs +1 -1
  41. package/dist/cjs/hooks/useScrollTracking.cjs +1 -1
  42. package/dist/cjs/hooks/useTextLayer.cjs +1 -1
  43. package/dist/cjs/hooks/useTextSearch.cjs +1 -1
  44. package/dist/cjs/hooks/useThumbnails.cjs +1 -1
  45. package/dist/cjs/pdf-tsx.css +1 -1
  46. package/dist/components/features/PDFSearch.d.ts +1 -1
  47. package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
  48. package/dist/components/features/PDFZoomControls.d.ts +1 -1
  49. package/dist/components/ui/PDFToolbar.d.ts +2 -2
  50. package/dist/components/ui/PDFToolbarDropdownContext.d.ts +1 -0
  51. package/dist/context/ThemeContext.d.ts +1 -1
  52. package/dist/es/components/PDFSidebar.js +25 -39
  53. package/dist/es/components/PDFSidebar.module.js +9 -9
  54. package/dist/es/components/PDFViewer.js +210 -234
  55. package/dist/es/components/PDFViewer.module.js +15 -15
  56. package/dist/es/components/features/PDFAnnotations.js +54 -62
  57. package/dist/es/components/features/PDFAnnotations.module.js +12 -12
  58. package/dist/es/components/features/PDFAttachments.js +52 -70
  59. package/dist/es/components/features/PDFAttachments.module.js +8 -8
  60. package/dist/es/components/features/PDFChangeFile.js +13 -24
  61. package/dist/es/components/features/PDFDownloadButton.js +10 -13
  62. package/dist/es/components/features/PDFNavigation.js +38 -59
  63. package/dist/es/components/features/PDFNavigation.module.js +3 -3
  64. package/dist/es/components/features/PDFOutline.js +66 -83
  65. package/dist/es/components/features/PDFOutline.module.js +5 -5
  66. package/dist/es/components/features/PDFPageFit.js +18 -23
  67. package/dist/es/components/features/PDFPrintButton.js +14 -17
  68. package/dist/es/components/features/PDFRotationControl.js +7 -13
  69. package/dist/es/components/features/PDFSearch.js +60 -69
  70. package/dist/es/components/features/PDFSearch.module.js +5 -5
  71. package/dist/es/components/features/PDFSidebarToggle.js +8 -13
  72. package/dist/es/components/features/PDFSignatures.js +116 -139
  73. package/dist/es/components/features/PDFSignatures.module.js +16 -16
  74. package/dist/es/components/features/PDFThemeToggle.js +10 -11
  75. package/dist/es/components/features/PDFThumbnails.js +25 -34
  76. package/dist/es/components/features/PDFThumbnails.module.js +9 -9
  77. package/dist/es/components/features/PDFZoomControls.js +21 -36
  78. package/dist/es/components/features/PDFZoomControls.module.js +1 -1
  79. package/dist/es/components/ui/PDFToolbar.js +33 -32
  80. package/dist/es/components/ui/PDFToolbarDropdownContext.js +5 -0
  81. package/dist/es/components/ui/PDFToolbarItem.js +11 -20
  82. package/dist/es/components/ui/ToolbarButton.js +8 -11
  83. package/dist/es/components/ui/ToolbarButton.module.js +2 -2
  84. package/dist/es/components/ui/icons.js +5 -16
  85. package/dist/es/context/ThemeContext.js +28 -38
  86. package/dist/es/hooks/useAnnotationLayer.js +33 -42
  87. package/dist/es/hooks/useKeyboardShortcuts.js +25 -34
  88. package/dist/es/hooks/useOutline.js +18 -23
  89. package/dist/es/hooks/useOverlayRects.js +42 -51
  90. package/dist/es/hooks/usePDFLoader.js +13 -16
  91. package/dist/es/hooks/useScrollTracking.js +24 -25
  92. package/dist/es/hooks/useTextLayer.js +34 -29
  93. package/dist/es/hooks/useTextSearch.js +31 -38
  94. package/dist/es/hooks/useThumbnails.js +33 -44
  95. package/dist/es/pdf-tsx.css +1 -1
  96. package/dist/hooks/useAttachments.d.ts +1 -1
  97. package/dist/hooks/useOutline.d.ts +1 -1
  98. package/dist/hooks/useOverlayRects.d.ts +1 -1
  99. package/dist/hooks/usePDFRenderer.d.ts +1 -1
  100. package/dist/hooks/useSignatures.d.ts +1 -1
  101. package/dist/hooks/useThumbnails.d.ts +1 -1
  102. package/dist/index.d.ts +3 -3
  103. package/package.json +3 -3
@@ -2,10 +2,10 @@ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { computeFit as t } from "../../utils/pdfFit.js";
3
3
  import { useAnnotations as n } from "../../hooks/useAnnotations.js";
4
4
  import r from "./PDFAnnotations.module.js";
5
- import { c as i } from "react/compiler-runtime";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ import { memo as i, useCallback as a, useMemo as o } from "react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
7
  //#region src/components/features/PDFAnnotations.tsx
8
- var s = {
8
+ var l = {
9
9
  Text: "Nota",
10
10
  Highlight: "Evidenziazione",
11
11
  Underline: "Sottolineatura",
@@ -17,85 +17,77 @@ var s = {
17
17
  Line: "Linea",
18
18
  Stamp: "Timbro",
19
19
  FileAttachment: "Allegato"
20
- };
21
- function c(e) {
22
- let t = i(17), { ann: n, onClick: c } = e, l = s[n.subtype] ?? n.subtype, u = `${r.card} ${n.rect ? r.cardClickable : ""}`, d;
23
- t[0] === l ? d = t[1] : (d = /* @__PURE__ */ a("span", {
24
- className: r.cardLabel,
25
- children: l
26
- }), t[0] = l, t[1] = d);
27
- let f;
28
- t[2] === n.page ? f = t[3] : (f = /* @__PURE__ */ o("span", {
29
- className: r.cardPage,
30
- children: ["p.", n.page]
31
- }), t[2] = n.page, t[3] = f);
32
- let p;
33
- t[4] !== d || t[5] !== f ? (p = /* @__PURE__ */ o("div", {
34
- className: r.cardHeader,
35
- children: [d, f]
36
- }), t[4] = d, t[5] = f, t[6] = p) : p = t[6];
37
- let m;
38
- t[7] === n.title ? m = t[8] : (m = n.title && /* @__PURE__ */ a("div", {
39
- className: r.cardAuthor,
40
- children: n.title
41
- }), t[7] = n.title, t[8] = m);
42
- let h;
43
- t[9] === n.contents ? h = t[10] : (h = n.contents && /* @__PURE__ */ a("div", {
44
- className: r.cardContent,
45
- children: n.contents
46
- }), t[9] = n.contents, t[10] = h);
47
- let g;
48
- return t[11] !== c || t[12] !== u || t[13] !== p || t[14] !== m || t[15] !== h ? (g = /* @__PURE__ */ o("div", {
49
- className: u,
50
- onClick: c,
20
+ }, u = i(function({ ann: e, onNavigate: t }) {
21
+ let n = l[e.subtype] ?? e.subtype, i = a(() => t(e), [t, e]);
22
+ return /* @__PURE__ */ c("div", {
23
+ className: `${r.card} ${e.rect ? r.cardClickable : ""}`,
24
+ onClick: i,
51
25
  children: [
52
- p,
53
- m,
54
- h
26
+ /* @__PURE__ */ c("div", {
27
+ className: r.cardHeader,
28
+ children: [/* @__PURE__ */ s("span", {
29
+ className: r.cardLabel,
30
+ children: n
31
+ }), /* @__PURE__ */ c("span", {
32
+ className: r.cardPage,
33
+ children: ["p.", e.page]
34
+ })]
35
+ }),
36
+ e.title && /* @__PURE__ */ s("div", {
37
+ className: r.cardAuthor,
38
+ children: e.title
39
+ }),
40
+ e.contents && /* @__PURE__ */ s("div", {
41
+ className: r.cardContent,
42
+ children: e.contents
43
+ })
55
44
  ]
56
- }), t[11] = c, t[12] = u, t[13] = p, t[14] = m, t[15] = h, t[16] = g) : g = t[16], g;
57
- }
58
- function l(t) {
59
- let s = i(8), { icon: c } = t, { pdf: l } = e(), u;
60
- s[0] === l ? u = s[1] : (u = { pdf: l }, s[0] = l, s[1] = u);
61
- let { annotations: d, loading: f } = n(u), p = d.length, m;
62
- s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ a("span", {
63
- className: r.badge,
64
- children: p > 99 ? "99+" : p
65
- }), s[2] = p, s[3] = f, s[4] = m) : m = s[4];
66
- let h;
67
- return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ o("span", {
45
+ });
46
+ });
47
+ function d({ icon: t }) {
48
+ let { pdf: i } = e(), { annotations: a, loading: o } = n({ pdf: i }), l = a.length;
49
+ return /* @__PURE__ */ c("span", {
68
50
  className: r.iconWrapper,
69
- children: [c, m]
70
- }), s[5] = c, s[6] = m, s[7] = h) : h = s[7], h;
51
+ children: [t, !o && l > 0 && /* @__PURE__ */ s("span", {
52
+ className: r.badge,
53
+ children: l > 99 ? "99+" : l
54
+ })]
55
+ });
71
56
  }
72
- function u() {
73
- let { pdf: i, goToPage: s, setHighlight: l, setZoom: u, rotation: d, containerRef: f } = e(), { annotations: p, loading: m } = n({ pdf: i }), h = async (e) => {
74
- i && f.current && u(await t("page", i, f.current, d)), s(e.page), e.rect && l({
57
+ function f() {
58
+ let { pdf: i, goToPage: l, setHighlight: d, setZoom: f, rotation: p, containerRef: m } = e(), { annotations: h, loading: g } = n({ pdf: i }), _ = a(async (e) => {
59
+ i && m.current && f(await t("page", i, m.current, p)), l(e.page), e.rect && d({
75
60
  page: e.page,
76
61
  pdfRect: e.rect
77
62
  });
78
- }, g = p.reduce((e, t) => ((e[t.page] ??= []).push(t), e), {});
79
- return /* @__PURE__ */ o("div", {
63
+ }, [
64
+ i,
65
+ m,
66
+ p,
67
+ l,
68
+ f,
69
+ d
70
+ ]), v = o(() => h.reduce((e, t) => ((e[t.page] ??= []).push(t), e), {}), [h]);
71
+ return /* @__PURE__ */ c("div", {
80
72
  className: r.list,
81
73
  children: [
82
- m && /* @__PURE__ */ a("div", {
74
+ g && /* @__PURE__ */ s("div", {
83
75
  className: r.emptyState,
84
76
  children: "Caricamento..."
85
77
  }),
86
- !m && p.length === 0 && /* @__PURE__ */ a("div", {
78
+ !g && h.length === 0 && /* @__PURE__ */ s("div", {
87
79
  className: r.emptyState,
88
80
  children: "Nessuna annotazione rilevata."
89
81
  }),
90
- !m && Object.entries(g).map(([e, t]) => /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ o("div", {
82
+ !g && Object.entries(v).map(([e, t]) => /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ c("div", {
91
83
  className: r.pageHeader,
92
84
  children: ["Pagina ", e]
93
- }), t.map((e) => /* @__PURE__ */ a(c, {
85
+ }), t.map((e) => /* @__PURE__ */ s(u, {
94
86
  ann: e,
95
- onClick: () => h(e)
87
+ onNavigate: _
96
88
  }, e.id))] }, e))
97
89
  ]
98
90
  });
99
91
  }
100
92
  //#endregion
101
- export { u as PDFAnnotations, l as PDFAnnotationsIcon };
93
+ export { f as PDFAnnotations, d as PDFAnnotationsIcon };
@@ -1,16 +1,16 @@
1
1
  var e = {
2
- list: "_list_185ig_1",
3
- emptyState: "_emptyState_185ig_11",
4
- pageHeader: "_pageHeader_185ig_23",
5
- card: "_card_185ig_45",
6
- cardClickable: "_cardClickable_185ig_65",
7
- cardHeader: "_cardHeader_185ig_81",
8
- cardLabel: "_cardLabel_185ig_95",
9
- cardPage: "_cardPage_185ig_107",
10
- cardAuthor: "_cardAuthor_185ig_117",
11
- cardContent: "_cardContent_185ig_129",
12
- iconWrapper: "_iconWrapper_185ig_141",
13
- badge: "_badge_185ig_155"
2
+ list: "_list_113xr_1",
3
+ emptyState: "_emptyState_113xr_6",
4
+ pageHeader: "_pageHeader_113xr_12",
5
+ card: "_card_113xr_23",
6
+ cardClickable: "_cardClickable_113xr_33",
7
+ cardHeader: "_cardHeader_113xr_41",
8
+ cardLabel: "_cardLabel_113xr_48",
9
+ cardPage: "_cardPage_113xr_54",
10
+ cardAuthor: "_cardAuthor_113xr_59",
11
+ cardContent: "_cardContent_113xr_65",
12
+ iconWrapper: "_iconWrapper_113xr_71",
13
+ badge: "_badge_113xr_78"
14
14
  };
15
15
  //#endregion
16
16
  export { e as default };
@@ -1,117 +1,99 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { useAttachments as t } from "../../hooks/useAttachments.js";
3
3
  import n from "./PDFAttachments.module.js";
4
- import { c as r } from "react/compiler-runtime";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
5
  //#region src/components/features/PDFAttachments.tsx
7
- function o() {
8
- let e = r(1), t;
9
- return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ a("svg", {
6
+ function a() {
7
+ return /* @__PURE__ */ i("svg", {
10
8
  width: "13",
11
9
  height: "13",
12
10
  viewBox: "0 0 13 13",
13
11
  fill: "none",
14
12
  "aria-hidden": !0,
15
- children: [/* @__PURE__ */ i("path", {
13
+ children: [/* @__PURE__ */ r("path", {
16
14
  d: "M6.5 1.5v7M3.5 6l3 3 3-3",
17
15
  stroke: "currentColor",
18
16
  strokeWidth: "1.5",
19
17
  strokeLinecap: "round",
20
18
  strokeLinejoin: "round"
21
- }), /* @__PURE__ */ i("path", {
19
+ }), /* @__PURE__ */ r("path", {
22
20
  d: "M1.5 10.5h10",
23
21
  stroke: "currentColor",
24
22
  strokeWidth: "1.5",
25
23
  strokeLinecap: "round"
26
24
  })]
27
- }), e[0] = t) : t = e[0], t;
25
+ });
28
26
  }
29
- function s() {
30
- let e = r(1), t;
31
- return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ a("svg", {
27
+ function o() {
28
+ return /* @__PURE__ */ i("svg", {
32
29
  width: "14",
33
30
  height: "14",
34
31
  viewBox: "0 0 14 14",
35
32
  fill: "none",
36
33
  "aria-hidden": !0,
37
- children: [/* @__PURE__ */ i("path", {
34
+ children: [/* @__PURE__ */ r("path", {
38
35
  d: "M3 1.5h5.5L11 4v8.5H3V1.5z",
39
36
  stroke: "currentColor",
40
37
  strokeWidth: "1.2",
41
38
  strokeLinejoin: "round"
42
- }), /* @__PURE__ */ i("path", {
39
+ }), /* @__PURE__ */ r("path", {
43
40
  d: "M8.5 1.5V4H11",
44
41
  stroke: "currentColor",
45
42
  strokeWidth: "1.2",
46
43
  strokeLinejoin: "round"
47
44
  })]
48
- }), e[0] = t) : t = e[0], t;
45
+ });
49
46
  }
50
- function c(e) {
47
+ function s(e) {
51
48
  let t = new Blob([new Uint8Array(e.content)]), n = URL.createObjectURL(t), r = document.createElement("a");
52
49
  r.href = n, r.download = e.filename, r.click(), URL.revokeObjectURL(n);
53
50
  }
54
- function l(o) {
55
- let s = r(8), { icon: c } = o, { pdf: l } = e(), u;
56
- s[0] === l ? u = s[1] : (u = { pdf: l }, s[0] = l, s[1] = u);
57
- let { attachments: d, loading: f } = t(u), p = d.length, m;
58
- s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ i("span", {
59
- className: n.badge,
60
- children: p > 99 ? "99+" : p
61
- }), s[2] = p, s[3] = f, s[4] = m) : m = s[4];
62
- let h;
63
- return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ a("span", {
51
+ function c({ icon: a }) {
52
+ let { pdf: o } = e(), { attachments: s, loading: c } = t({ pdf: o }), l = s.length;
53
+ return /* @__PURE__ */ i("span", {
64
54
  className: n.iconWrapper,
65
- children: [c, m]
66
- }), s[5] = c, s[6] = m, s[7] = h) : h = s[7], h;
55
+ children: [a, !c && l > 0 && /* @__PURE__ */ r("span", {
56
+ className: n.badge,
57
+ children: l > 99 ? "99+" : l
58
+ })]
59
+ });
67
60
  }
68
- function u() {
69
- let o = r(14), { pdf: s } = e(), c;
70
- o[0] === s ? c = o[1] : (c = { pdf: s }, o[0] = s, o[1] = c);
71
- let { attachments: l, loading: u } = t(c), f;
72
- o[2] === u ? f = o[3] : (f = u && /* @__PURE__ */ i("div", {
73
- className: n.emptyState,
74
- children: "Caricamento..."
75
- }), o[2] = u, o[3] = f);
76
- let p;
77
- o[4] !== l || o[5] !== u ? (p = !u && l.length === 0 && /* @__PURE__ */ i("div", {
78
- className: n.emptyState,
79
- children: "Nessun allegato rilevato."
80
- }), o[4] = l, o[5] = u, o[6] = p) : p = o[6];
81
- let m;
82
- o[7] !== l || o[8] !== u ? (m = !u && l.map(d), o[7] = l, o[8] = u, o[9] = m) : m = o[9];
83
- let h;
84
- return o[10] !== f || o[11] !== p || o[12] !== m ? (h = /* @__PURE__ */ a("div", {
61
+ function l() {
62
+ let { pdf: c } = e(), { attachments: l, loading: u } = t({ pdf: c });
63
+ return /* @__PURE__ */ i("div", {
85
64
  className: n.list,
86
65
  children: [
87
- f,
88
- p,
89
- m
90
- ]
91
- }), o[10] = f, o[11] = p, o[12] = m, o[13] = h) : h = o[13], h;
92
- }
93
- function d(e, t) {
94
- return /* @__PURE__ */ a("div", {
95
- className: n.card,
96
- children: [
97
- /* @__PURE__ */ i("span", {
98
- className: n.fileIcon,
99
- children: /* @__PURE__ */ i(s, {})
66
+ u && /* @__PURE__ */ r("div", {
67
+ className: n.emptyState,
68
+ children: "Caricamento..."
100
69
  }),
101
- /* @__PURE__ */ i("span", {
102
- className: n.filename,
103
- title: e.filename,
104
- children: e.filename
70
+ !u && l.length === 0 && /* @__PURE__ */ r("div", {
71
+ className: n.emptyState,
72
+ children: "Nessun allegato rilevato."
105
73
  }),
106
- /* @__PURE__ */ i("button", {
107
- type: "button",
108
- className: n.downloadBtn,
109
- title: `Scarica ${e.filename}`,
110
- onClick: () => c(e),
111
- children: /* @__PURE__ */ i(o, {})
112
- })
74
+ !u && l.map((e, t) => /* @__PURE__ */ i("div", {
75
+ className: n.card,
76
+ children: [
77
+ /* @__PURE__ */ r("span", {
78
+ className: n.fileIcon,
79
+ children: /* @__PURE__ */ r(o, {})
80
+ }),
81
+ /* @__PURE__ */ r("span", {
82
+ className: n.filename,
83
+ title: e.filename,
84
+ children: e.filename
85
+ }),
86
+ /* @__PURE__ */ r("button", {
87
+ type: "button",
88
+ className: n.downloadBtn,
89
+ title: `Scarica ${e.filename}`,
90
+ onClick: () => s(e),
91
+ children: /* @__PURE__ */ r(a, {})
92
+ })
93
+ ]
94
+ }, t))
113
95
  ]
114
- }, t);
96
+ });
115
97
  }
116
98
  //#endregion
117
- export { u as PDFAttachments, l as PDFAttachmentsIcon };
99
+ export { l as PDFAttachments, c as PDFAttachmentsIcon };
@@ -1,12 +1,12 @@
1
1
  var e = {
2
- list: "_list_8oiyp_1",
3
- emptyState: "_emptyState_8oiyp_15",
4
- card: "_card_8oiyp_29",
5
- fileIcon: "_fileIcon_8oiyp_65",
6
- filename: "_filename_8oiyp_79",
7
- downloadBtn: "_downloadBtn_8oiyp_101",
8
- iconWrapper: "_iconWrapper_8oiyp_153",
9
- badge: "_badge_8oiyp_167"
2
+ list: "_list_12ybz_1",
3
+ emptyState: "_emptyState_12ybz_8",
4
+ card: "_card_12ybz_15",
5
+ fileIcon: "_fileIcon_12ybz_33",
6
+ filename: "_filename_12ybz_40",
7
+ downloadBtn: "_downloadBtn_12ybz_51",
8
+ iconWrapper: "_iconWrapper_12ybz_77",
9
+ badge: "_badge_12ybz_84"
10
10
  };
11
11
  //#endregion
12
12
  export { e as default };
@@ -1,35 +1,24 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import { c as n } from "react/compiler-runtime";
4
- import { useRef as r } from "react";
3
+ import { useCallback as n, useRef as r } from "react";
5
4
  import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
6
5
  //#region src/components/features/PDFChangeFile.tsx
7
- function s(s) {
8
- let c = n(11), { icon: l } = s, { onChangeFile: u } = e(), d = r(null), f;
9
- c[0] === u ? f = c[1] : (f = (e) => {
6
+ function s({ icon: s }) {
7
+ let { onChangeFile: c } = e(), l = r(null), u = n((e) => {
10
8
  let t = e.target.files?.[0];
11
- t && u?.(t), e.target.value = "";
12
- }, c[0] = u, c[1] = f);
13
- let p = f, m;
14
- c[2] === Symbol.for("react.memo_cache_sentinel") ? (m = { display: "none" }, c[2] = m) : m = c[2];
15
- let h;
16
- c[3] === p ? h = c[4] : (h = /* @__PURE__ */ a("input", {
17
- ref: d,
9
+ t && c?.(t), e.target.value = "";
10
+ }, [c]), d = n(() => l.current?.click(), []);
11
+ return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("input", {
12
+ ref: l,
18
13
  type: "file",
19
14
  accept: ".pdf",
20
- style: m,
21
- onChange: p
22
- }), c[3] = p, c[4] = h);
23
- let g;
24
- c[5] === Symbol.for("react.memo_cache_sentinel") ? (g = () => d.current?.click(), c[5] = g) : g = c[5];
25
- let _;
26
- c[6] === l ? _ = c[7] : (_ = /* @__PURE__ */ a(t, {
27
- onClick: g,
15
+ style: { display: "none" },
16
+ onChange: u
17
+ }), /* @__PURE__ */ a(t, {
18
+ onClick: d,
28
19
  title: "Apri altro file",
29
- children: l
30
- }), c[6] = l, c[7] = _);
31
- let v;
32
- return c[8] !== h || c[9] !== _ ? (v = /* @__PURE__ */ o(i, { children: [h, _] }), c[8] = h, c[9] = _, c[10] = v) : v = c[10], v;
20
+ children: s
21
+ })] });
33
22
  }
34
23
  s.toolbarLabel = "Apri file";
35
24
  //#endregion
@@ -1,22 +1,19 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import { c as n } from "react/compiler-runtime";
4
- import "react";
3
+ import { useCallback as n } from "react";
5
4
  import { jsxs as r } from "react/jsx-runtime";
6
5
  //#region src/components/features/PDFDownloadButton.tsx
7
- function i(i) {
8
- let a = n(5), { icon: o } = i, { file: s } = e(), c;
9
- a[0] === s ? c = a[1] : (c = () => {
10
- let e = URL.createObjectURL(s), t = document.createElement("a");
11
- t.href = e, t.download = s.name || "documento.pdf", t.click(), setTimeout(() => URL.revokeObjectURL(e), 0);
12
- }, a[0] = s, a[1] = c);
13
- let l = c, u;
14
- return a[2] !== l || a[3] !== o ? (u = /* @__PURE__ */ r(t, {
6
+ function i({ icon: i }) {
7
+ let { file: a } = e();
8
+ return /* @__PURE__ */ r(t, {
15
9
  $primary: !0,
16
- onClick: l,
10
+ onClick: n(() => {
11
+ let e = URL.createObjectURL(a), t = document.createElement("a");
12
+ t.href = e, t.download = a.name || "documento.pdf", t.click(), setTimeout(() => URL.revokeObjectURL(e), 0);
13
+ }, [a]),
17
14
  title: "Scarica PDF",
18
- children: [o, "Scarica"]
19
- }), a[2] = l, a[3] = o, a[4] = u) : u = a[4], u;
15
+ children: [i, "Scarica"]
16
+ });
20
17
  }
21
18
  i.toolbarLabel = "Scarica";
22
19
  //#endregion
@@ -1,70 +1,49 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
3
  import n from "./PDFNavigation.module.js";
4
- import { c as r } from "react/compiler-runtime";
5
- import { useState as i } from "react";
4
+ import { useCallback as r, useState as i } from "react";
6
5
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
6
  //#region src/components/features/PDFNavigation.tsx
8
- function s(s) {
9
- let c = r(34), { prevIcon: l, nextIcon: u } = s, { currentPage: d, numPages: f, goToPage: p } = e(), [m, h] = i(!1), [g, _] = i(""), v;
10
- c[0] !== p || c[1] !== g ? (v = () => {
11
- let e = parseInt(g, 10);
12
- isNaN(e) || p(e), h(!1);
13
- }, c[0] = p, c[1] = g, c[2] = v) : v = c[2];
14
- let y = v, b;
15
- c[3] !== d || c[4] !== p ? (b = () => p(d - 1), c[3] = d, c[4] = p, c[5] = b) : b = c[5];
16
- let x = d === 1, S;
17
- c[6] !== l || c[7] !== b || c[8] !== x ? (S = /* @__PURE__ */ a(t, {
18
- onClick: b,
19
- disabled: x,
20
- title: "Pagina precedente (←)",
21
- children: l
22
- }), c[6] = l, c[7] = b, c[8] = x, c[9] = S) : S = c[9];
23
- let C = m ? g : d, w;
24
- c[10] === d ? w = c[11] : (w = () => {
25
- h(!0), _(String(d));
26
- }, c[10] = d, c[11] = w);
27
- let T;
28
- c[12] === Symbol.for("react.memo_cache_sentinel") ? (T = (e) => _(e.target.value), c[12] = T) : T = c[12];
29
- let E;
30
- c[13] === y ? E = c[14] : (E = (e) => {
31
- e.key === "Enter" && y(), e.key === "Escape" && h(!1);
32
- }, c[13] = y, c[14] = E);
33
- let D;
34
- c[15] !== y || c[16] !== C || c[17] !== w || c[18] !== E ? (D = /* @__PURE__ */ a("input", {
35
- className: n.pageInput,
36
- type: "number",
37
- value: C,
38
- onFocus: w,
39
- onBlur: y,
40
- onChange: T,
41
- onKeyDown: E,
42
- title: "Vai alla pagina"
43
- }), c[15] = y, c[16] = C, c[17] = w, c[18] = E, c[19] = D) : D = c[19];
44
- let O;
45
- c[20] === f ? O = c[21] : (O = /* @__PURE__ */ o("span", {
46
- className: n.pageTotal,
47
- children: ["/ ", f]
48
- }), c[20] = f, c[21] = O);
49
- let k;
50
- c[22] !== d || c[23] !== p ? (k = () => p(d + 1), c[22] = d, c[23] = p, c[24] = k) : k = c[24];
51
- let A = d === f, j;
52
- c[25] !== u || c[26] !== k || c[27] !== A ? (j = /* @__PURE__ */ a(t, {
53
- onClick: k,
54
- disabled: A,
55
- title: "Pagina successiva (→)",
56
- children: u
57
- }), c[25] = u, c[26] = k, c[27] = A, c[28] = j) : j = c[28];
58
- let M;
59
- return c[29] !== O || c[30] !== j || c[31] !== S || c[32] !== D ? (M = /* @__PURE__ */ o("div", {
7
+ function s({ prevIcon: s, nextIcon: c }) {
8
+ let { currentPage: l, numPages: u, goToPage: d } = e(), [f, p] = i(!1), [m, h] = i(""), g = r(() => {
9
+ let e = parseInt(m, 10);
10
+ isNaN(e) || d(e), p(!1);
11
+ }, [m, d]), _ = r(() => {
12
+ p(!0), h(String(l));
13
+ }, [l]), v = r((e) => h(e.target.value), []), y = r((e) => {
14
+ e.key === "Enter" && g(), e.key === "Escape" && p(!1);
15
+ }, [g]), b = r(() => d(l - 1), [d, l]), x = r(() => d(l + 1), [d, l]);
16
+ return /* @__PURE__ */ o("div", {
60
17
  className: n.navWrapper,
61
18
  children: [
62
- S,
63
- D,
64
- O,
65
- j
19
+ /* @__PURE__ */ a(t, {
20
+ onClick: b,
21
+ disabled: l === 1,
22
+ title: "Pagina precedente (←)",
23
+ children: s
24
+ }),
25
+ /* @__PURE__ */ a("input", {
26
+ className: n.pageInput,
27
+ type: "number",
28
+ value: f ? m : l,
29
+ onFocus: _,
30
+ onBlur: g,
31
+ onChange: v,
32
+ onKeyDown: y,
33
+ title: "Vai alla pagina"
34
+ }),
35
+ /* @__PURE__ */ o("span", {
36
+ className: n.pageTotal,
37
+ children: ["/ ", u]
38
+ }),
39
+ /* @__PURE__ */ a(t, {
40
+ onClick: x,
41
+ disabled: l === u,
42
+ title: "Pagina successiva (→)",
43
+ children: c
44
+ })
66
45
  ]
67
- }), c[29] = O, c[30] = j, c[31] = S, c[32] = D, c[33] = M) : M = c[33], M;
46
+ });
68
47
  }
69
48
  s.toolbarLabel = "Pagina";
70
49
  //#endregion
@@ -1,7 +1,7 @@
1
1
  var e = {
2
- navWrapper: "_navWrapper_1s04k_1",
3
- pageInput: "_pageInput_1s04k_13",
4
- pageTotal: "_pageTotal_1s04k_69"
2
+ navWrapper: "_navWrapper_hrnrb_1",
3
+ pageInput: "_pageInput_hrnrb_7",
4
+ pageTotal: "_pageTotal_hrnrb_35"
5
5
  };
6
6
  //#endregion
7
7
  export { e as default };