pdf-tsx 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +486 -418
- package/dist/cjs/components/PDFViewer.cjs +1 -1
- package/dist/cjs/components/PDFViewer.module.cjs +1 -1
- package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
- package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
- package/dist/cjs/components/features/PDFAttachments.cjs +1 -1
- package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
- package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
- package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
- package/dist/cjs/components/features/PDFOutline.cjs +1 -1
- package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
- package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
- package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
- package/dist/cjs/components/features/PDFSearch.cjs +1 -1
- package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -1
- package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
- package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
- package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
- package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
- package/dist/cjs/components/ui/PDFToolbar.cjs +1 -1
- package/dist/cjs/context/LabelsContext.cjs +1 -0
- package/dist/cjs/context/labelsContextValue.cjs +1 -0
- package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
- package/dist/cjs/hooks/useAnnotations.cjs +1 -1
- package/dist/cjs/hooks/useLabels.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/labels.cjs +1 -0
- package/dist/cjs/pdf-tsx.css +1 -1
- package/dist/components/PDFViewer.d.ts +3 -0
- package/dist/components/features/PDFChangeFile.d.ts +1 -1
- package/dist/components/features/PDFDownloadButton.d.ts +1 -1
- package/dist/components/features/PDFNavigation.d.ts +1 -1
- package/dist/components/features/PDFPageFit.d.ts +1 -1
- package/dist/components/features/PDFPrintButton.d.ts +1 -1
- package/dist/components/features/PDFRotationControl.d.ts +1 -1
- package/dist/components/features/PDFSearch.d.ts +3 -2
- package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
- package/dist/components/features/PDFThemeToggle.d.ts +1 -1
- package/dist/components/features/PDFZoomControls.d.ts +1 -1
- package/dist/context/LabelsContext.d.ts +7 -0
- package/dist/context/PDFViewerContext.d.ts +1 -0
- package/dist/context/labelsContextValue.d.ts +2 -0
- package/dist/es/components/PDFViewer.js +359 -187
- package/dist/es/components/PDFViewer.module.js +23 -16
- package/dist/es/components/features/PDFAnnotations.js +132 -62
- package/dist/es/components/features/PDFAnnotations.module.js +12 -12
- package/dist/es/components/features/PDFAttachments.js +42 -41
- package/dist/es/components/features/PDFChangeFile.js +17 -16
- package/dist/es/components/features/PDFDownloadButton.js +15 -14
- package/dist/es/components/features/PDFNavigation.js +40 -38
- package/dist/es/components/features/PDFOutline.js +46 -45
- package/dist/es/components/features/PDFPageFit.js +19 -18
- package/dist/es/components/features/PDFPrintButton.js +14 -13
- package/dist/es/components/features/PDFRotationControl.js +12 -11
- package/dist/es/components/features/PDFSearch.js +71 -55
- package/dist/es/components/features/PDFSidebarToggle.js +13 -12
- package/dist/es/components/features/PDFSignatures.js +87 -84
- package/dist/es/components/features/PDFThemeToggle.js +12 -11
- package/dist/es/components/features/PDFThumbnails.js +33 -32
- package/dist/es/components/features/PDFZoomControls.js +23 -22
- package/dist/es/components/ui/PDFToolbar.js +56 -55
- package/dist/es/context/LabelsContext.js +14 -0
- package/dist/es/context/labelsContextValue.js +5 -0
- package/dist/es/hooks/useAnnotationLayer.js +37 -20
- package/dist/es/hooks/useAnnotations.js +5 -3
- package/dist/es/hooks/useLabels.js +9 -0
- package/dist/es/index.js +22 -21
- package/dist/es/labels.js +128 -0
- package/dist/es/pdf-tsx.css +1 -1
- package/dist/hooks/useAnnotationLayer.d.ts +15 -1
- package/dist/hooks/useLabels.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/labels.d.ts +53 -0
- package/package.json +2 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import i from "
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import { useOutline as n } from "../../hooks/useOutline.js";
|
|
4
|
+
import { IconChevronDown as r, IconChevronRight as i } from "../ui/icons.js";
|
|
5
|
+
import a from "./PDFOutline.module.js";
|
|
6
|
+
import { memo as o, useCallback as s, useMemo as c, useState as l } from "react";
|
|
7
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/features/PDFOutline.tsx
|
|
8
|
-
async function
|
|
9
|
+
async function p(e, t) {
|
|
9
10
|
if (!e || !t) return null;
|
|
10
11
|
try {
|
|
11
12
|
let n = typeof t == "string" ? await e.getDestination(t) : t;
|
|
@@ -19,78 +20,78 @@ async function f(e, t) {
|
|
|
19
20
|
return null;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
|
-
var
|
|
23
|
-
let [p, m] =
|
|
23
|
+
var m = o(function e({ node: t, depth: n, onNavigate: o }) {
|
|
24
|
+
let [p, m] = l(n === 0), h = t.items.length > 0, g = s((e) => {
|
|
24
25
|
e.stopPropagation(), m((e) => !e);
|
|
25
|
-
}, []), _ =
|
|
26
|
-
paddingLeft: 12 +
|
|
26
|
+
}, []), _ = s(() => o(t.dest), [o, t.dest]), v = c(() => ({
|
|
27
|
+
paddingLeft: 12 + n * 14,
|
|
27
28
|
fontWeight: t.bold ? 600 : 400,
|
|
28
29
|
fontStyle: t.italic ? "italic" : "normal"
|
|
29
30
|
}), [
|
|
30
|
-
|
|
31
|
+
n,
|
|
31
32
|
t.bold,
|
|
32
33
|
t.italic
|
|
33
34
|
]);
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
className:
|
|
35
|
+
return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
|
|
36
|
+
className: a.row,
|
|
36
37
|
style: v,
|
|
37
38
|
onClick: _,
|
|
38
|
-
children: [h ? /* @__PURE__ */
|
|
39
|
-
className:
|
|
39
|
+
children: [h ? /* @__PURE__ */ d("button", {
|
|
40
|
+
className: a.chevronBtn,
|
|
40
41
|
onClick: g,
|
|
41
|
-
children:
|
|
42
|
-
}) : /* @__PURE__ */
|
|
42
|
+
children: d(p ? r : i, { size: 12 })
|
|
43
|
+
}) : /* @__PURE__ */ d("span", { style: {
|
|
43
44
|
width: 16,
|
|
44
45
|
flexShrink: 0
|
|
45
|
-
} }), /* @__PURE__ */
|
|
46
|
-
className:
|
|
46
|
+
} }), /* @__PURE__ */ d("span", {
|
|
47
|
+
className: a.title,
|
|
47
48
|
title: t.title,
|
|
48
49
|
children: t.title
|
|
49
50
|
})]
|
|
50
|
-
}), p && t.items.map((t,
|
|
51
|
+
}), p && t.items.map((t, r) => /* @__PURE__ */ d(e, {
|
|
51
52
|
node: t,
|
|
52
|
-
depth:
|
|
53
|
-
onNavigate:
|
|
54
|
-
},
|
|
53
|
+
depth: n + 1,
|
|
54
|
+
onNavigate: o
|
|
55
|
+
}, r))] });
|
|
55
56
|
});
|
|
56
|
-
function
|
|
57
|
-
let { pdf:
|
|
58
|
-
let t = await
|
|
57
|
+
function h() {
|
|
58
|
+
let { pdf: r, zoom: i, rotation: o, goToPage: c } = e(), l = t(), { outline: u, loading: h } = n({ pdf: r }), g = s(async (e) => {
|
|
59
|
+
let t = await p(r, e);
|
|
59
60
|
if (t) {
|
|
60
61
|
if (t.pdfTop !== null) try {
|
|
61
|
-
let [, e] = (await
|
|
62
|
-
scale:
|
|
63
|
-
rotation:
|
|
62
|
+
let [, e] = (await r.getPage(t.page)).getViewport({
|
|
63
|
+
scale: i,
|
|
64
|
+
rotation: o
|
|
64
65
|
}).convertToViewportPoint(0, t.pdfTop);
|
|
65
|
-
|
|
66
|
+
c(t.page, e);
|
|
66
67
|
return;
|
|
67
68
|
} catch {}
|
|
68
|
-
|
|
69
|
+
c(t.page);
|
|
69
70
|
}
|
|
70
71
|
}, [
|
|
71
|
-
n,
|
|
72
72
|
r,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
i,
|
|
74
|
+
o,
|
|
75
|
+
c
|
|
75
76
|
]);
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
className:
|
|
77
|
+
return /* @__PURE__ */ f("div", {
|
|
78
|
+
className: a.tree,
|
|
78
79
|
children: [
|
|
79
|
-
|
|
80
|
-
className:
|
|
81
|
-
children:
|
|
80
|
+
h && /* @__PURE__ */ d("div", {
|
|
81
|
+
className: a.emptyState,
|
|
82
|
+
children: l.outlineLoading
|
|
82
83
|
}),
|
|
83
|
-
!
|
|
84
|
-
className:
|
|
85
|
-
children:
|
|
84
|
+
!h && u.length === 0 && /* @__PURE__ */ d("div", {
|
|
85
|
+
className: a.emptyState,
|
|
86
|
+
children: l.outlineEmpty
|
|
86
87
|
}),
|
|
87
|
-
!
|
|
88
|
+
!h && u.map((e, t) => /* @__PURE__ */ d(m, {
|
|
88
89
|
node: e,
|
|
89
90
|
depth: 0,
|
|
90
|
-
onNavigate:
|
|
91
|
+
onNavigate: g
|
|
91
92
|
}, t))
|
|
92
93
|
]
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
//#endregion
|
|
96
|
-
export {
|
|
97
|
+
export { h as PDFOutline };
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
2
|
import { computeFit as t } from "../../utils/pdfFit.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useLabels as n } from "../../hooks/useLabels.js";
|
|
4
|
+
import { ToolbarButton as r } from "../ui/ToolbarButton.js";
|
|
5
|
+
import { useCallback as i } from "react";
|
|
6
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/features/PDFPageFit.tsx
|
|
7
|
-
function
|
|
8
|
-
let { pdf:
|
|
9
|
-
!
|
|
8
|
+
function c({ fitWidthIcon: c, fitPageIcon: l }) {
|
|
9
|
+
let { pdf: u, rotation: d, setZoom: f, setFitMode: p, containerRef: m } = e(), h = n(), g = i(async (e) => {
|
|
10
|
+
!u || !m.current || (p(e), f(await t(e, u, m.current, d)));
|
|
10
11
|
}, [
|
|
11
|
-
l,
|
|
12
12
|
u,
|
|
13
13
|
d,
|
|
14
14
|
f,
|
|
15
|
-
p
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}), /* @__PURE__ */ a(n, {
|
|
22
|
-
onClick: g,
|
|
23
|
-
title: "Adatta pagina intera",
|
|
15
|
+
p,
|
|
16
|
+
m
|
|
17
|
+
]), _ = i(() => g("width"), [g]), v = i(() => g("page"), [g]);
|
|
18
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(r, {
|
|
19
|
+
onClick: _,
|
|
20
|
+
title: h.fitWidthTitle,
|
|
24
21
|
children: c
|
|
22
|
+
}), /* @__PURE__ */ o(r, {
|
|
23
|
+
onClick: v,
|
|
24
|
+
title: h.fitPageTitle,
|
|
25
|
+
children: l
|
|
25
26
|
})] });
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
c.toolbarLabelKey = "fitToolbarLabel";
|
|
28
29
|
//#endregion
|
|
29
|
-
export {
|
|
30
|
+
export { c as PDFPageFit };
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import { ToolbarButton as n } from "../ui/ToolbarButton.js";
|
|
4
|
+
import { useCallback as r } from "react";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/features/PDFPrintButton.tsx
|
|
6
|
-
function
|
|
7
|
-
let { file:
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
onClick:
|
|
10
|
-
let e = URL.createObjectURL(
|
|
7
|
+
function a({ icon: a }) {
|
|
8
|
+
let { file: o } = e(), s = t();
|
|
9
|
+
return /* @__PURE__ */ i(n, {
|
|
10
|
+
onClick: r(() => {
|
|
11
|
+
let e = URL.createObjectURL(o), t = document.createElement("iframe");
|
|
11
12
|
t.style.display = "none", t.src = e, document.body.appendChild(t), t.onload = () => {
|
|
12
13
|
let n = !1, r = () => {
|
|
13
14
|
n || (n = !0, t.remove(), URL.revokeObjectURL(e));
|
|
14
15
|
};
|
|
15
16
|
t.contentWindow?.addEventListener("afterprint", r, { once: !0 }), setTimeout(r, 6e4), t.contentWindow?.print();
|
|
16
17
|
};
|
|
17
|
-
}, [
|
|
18
|
-
title:
|
|
19
|
-
children:
|
|
18
|
+
}, [o]),
|
|
19
|
+
title: s.printTitle,
|
|
20
|
+
children: a
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
a.toolbarLabelKey = "printToolbarLabel";
|
|
23
24
|
//#endregion
|
|
24
|
-
export {
|
|
25
|
+
export { a as PDFPrintButton };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import { ToolbarButton as n } from "../ui/ToolbarButton.js";
|
|
4
|
+
import { useCallback as r } from "react";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/features/PDFRotationControl.tsx
|
|
6
|
-
function
|
|
7
|
-
let { setRotation:
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
onClick:
|
|
10
|
-
title:
|
|
11
|
-
children:
|
|
7
|
+
function a({ icon: a }) {
|
|
8
|
+
let { setRotation: o } = e(), s = t();
|
|
9
|
+
return /* @__PURE__ */ i(n, {
|
|
10
|
+
onClick: r(() => o((e) => (e + 90) % 360), [o]),
|
|
11
|
+
title: s.rotateTitle,
|
|
12
|
+
children: a
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
a.toolbarLabelKey = "rotateToolbarLabel";
|
|
15
16
|
//#endregion
|
|
16
|
-
export {
|
|
17
|
+
export { a as PDFRotationControl };
|
|
@@ -1,73 +1,89 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import { useTextSearch as n } from "../../hooks/useTextSearch.js";
|
|
4
|
+
import r from "./PDFSearch.module.js";
|
|
5
|
+
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
6
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/features/PDFSearch.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let { pdf:
|
|
10
|
-
pdf:
|
|
11
|
-
query:
|
|
12
|
-
}),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
var d = [];
|
|
9
|
+
function f({ searchIcon: f, prevIcon: p, nextIcon: m, clearIcon: h, initialSearch: g }) {
|
|
10
|
+
let { pdf: _, goToPage: v, setHighlight: y, setSearchMatches: b } = e(), x = t(), [S, C] = s(g ?? ""), [w, T] = s(0), { matches: E, searching: D } = n({
|
|
11
|
+
pdf: _,
|
|
12
|
+
query: S
|
|
13
|
+
}), O = o(!1), k = E.length;
|
|
14
|
+
a(() => (b(E), () => b(d)), [E, b]), a(() => {
|
|
15
|
+
if (g && !O.current && !D && E.length > 0) {
|
|
16
|
+
O.current = !0;
|
|
17
|
+
let e = E[0];
|
|
18
|
+
v(e.page), y({
|
|
19
|
+
page: e.page,
|
|
20
|
+
pdfRect: e.pdfRect
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}, [
|
|
24
|
+
g,
|
|
25
|
+
D,
|
|
26
|
+
E,
|
|
27
|
+
v,
|
|
28
|
+
y
|
|
29
|
+
]);
|
|
30
|
+
let A = i((e) => {
|
|
31
|
+
let t = (e + k) % k;
|
|
32
|
+
T(t);
|
|
33
|
+
let n = E[t];
|
|
34
|
+
v(n.page), y({
|
|
19
35
|
page: n.page,
|
|
20
36
|
pdfRect: n.pdfRect
|
|
21
37
|
});
|
|
22
38
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
]),
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
className:
|
|
39
|
+
k,
|
|
40
|
+
E,
|
|
41
|
+
v,
|
|
42
|
+
y
|
|
43
|
+
]), j = i((e) => {
|
|
44
|
+
C(e.target.value), T(0), y(null);
|
|
45
|
+
}, [y]), M = i(() => {
|
|
46
|
+
C(""), T(0), y(null);
|
|
47
|
+
}, [y]);
|
|
48
|
+
return /* @__PURE__ */ u("div", {
|
|
49
|
+
className: r.wrapper,
|
|
34
50
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
className:
|
|
37
|
-
children:
|
|
51
|
+
/* @__PURE__ */ l("span", {
|
|
52
|
+
className: r.searchIconWrapper,
|
|
53
|
+
children: f
|
|
38
54
|
}),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
className:
|
|
41
|
-
value:
|
|
42
|
-
onChange:
|
|
43
|
-
placeholder:
|
|
55
|
+
/* @__PURE__ */ l("input", {
|
|
56
|
+
className: r.searchInput,
|
|
57
|
+
value: S,
|
|
58
|
+
onChange: j,
|
|
59
|
+
placeholder: x.searchPlaceholder
|
|
44
60
|
}),
|
|
45
|
-
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
className:
|
|
48
|
-
children:
|
|
61
|
+
S && /* @__PURE__ */ u(c, { children: [
|
|
62
|
+
/* @__PURE__ */ l("span", {
|
|
63
|
+
className: r.counter,
|
|
64
|
+
children: D ? "…" : k === 0 ? "0" : `${w + 1}/${k}`
|
|
49
65
|
}),
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
className:
|
|
52
|
-
onClick: () =>
|
|
53
|
-
disabled:
|
|
54
|
-
children:
|
|
66
|
+
/* @__PURE__ */ l("button", {
|
|
67
|
+
className: r.navButton,
|
|
68
|
+
onClick: () => A(w - 1),
|
|
69
|
+
disabled: k === 0,
|
|
70
|
+
children: p
|
|
55
71
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
className:
|
|
58
|
-
onClick: () =>
|
|
59
|
-
disabled:
|
|
60
|
-
children:
|
|
72
|
+
/* @__PURE__ */ l("button", {
|
|
73
|
+
className: r.navButton,
|
|
74
|
+
onClick: () => A(w + 1),
|
|
75
|
+
disabled: k === 0,
|
|
76
|
+
children: m
|
|
61
77
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
className:
|
|
64
|
-
onClick:
|
|
65
|
-
children:
|
|
78
|
+
/* @__PURE__ */ l("button", {
|
|
79
|
+
className: r.navButton,
|
|
80
|
+
onClick: M,
|
|
81
|
+
children: h
|
|
66
82
|
})
|
|
67
83
|
] })
|
|
68
84
|
]
|
|
69
85
|
});
|
|
70
86
|
}
|
|
71
|
-
|
|
87
|
+
f.toolbarLabelKey = "searchToolbarLabel";
|
|
72
88
|
//#endregion
|
|
73
|
-
export {
|
|
89
|
+
export { f as PDFSearch };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import n from "../ui/ToolbarButton.module.js";
|
|
4
|
+
import { useCallback as r } from "react";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/features/PDFSidebarToggle.tsx
|
|
6
|
-
function
|
|
7
|
-
let { sidebarCollapsed:
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
className:
|
|
10
|
-
onClick:
|
|
11
|
-
title:
|
|
12
|
-
children:
|
|
7
|
+
function a({ collapseIcon: a, expandIcon: o }) {
|
|
8
|
+
let { sidebarCollapsed: s, setSidebarCollapsed: c } = e(), l = t(), u = s ? o ?? a : a, d = s ? l.expandSidebarTitle : l.collapseSidebarTitle, f = r(() => c((e) => !e), [c]);
|
|
9
|
+
return /* @__PURE__ */ i("button", {
|
|
10
|
+
className: n.btn,
|
|
11
|
+
onClick: f,
|
|
12
|
+
title: d,
|
|
13
|
+
children: u
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
a.toolbarLabelKey = "sidebarToolbarLabel";
|
|
16
17
|
//#endregion
|
|
17
|
-
export {
|
|
18
|
+
export { a as PDFSidebarToggle };
|