@react-pdf-kit/viewer 2.7.0-beta.1 → 2.7.0-rc.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.
|
@@ -3,44 +3,46 @@ import { useLayoutContainer as t } from "../../../contexts/LayoutContainerContex
|
|
|
3
3
|
import { useToolbarComponentContext as n } from "../../../contexts/ToolbarComponentContext.js";
|
|
4
4
|
import { useToolComponentContext as r } from "../../../contexts/ToolComponentContext.js";
|
|
5
5
|
import { useSearchContext as i } from "../../../contexts/SearchContext.js";
|
|
6
|
-
import { useLocalizationContext as
|
|
7
|
-
import { t as
|
|
8
|
-
import { useIconToolContext as
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
import { useIconContext as
|
|
12
|
-
import { useViewportContext as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { InfoIcon as
|
|
16
|
-
import { SearchIcon as
|
|
17
|
-
import { t as
|
|
18
|
-
import { t as
|
|
19
|
-
import { ClearIcon as
|
|
20
|
-
import { SearchResultNavigator as
|
|
21
|
-
import { SearchCloseButton as
|
|
22
|
-
import { useCallback as
|
|
23
|
-
import { Fragment as
|
|
6
|
+
import { useLocalizationContext as ee } from "../../../contexts/LocalizationContext.js";
|
|
7
|
+
import { t as te } from "../../../LoaderIcon-D9YjinGf.js";
|
|
8
|
+
import { useIconToolContext as a } from "../../../contexts/IconToolContext.js";
|
|
9
|
+
import { t as o } from "../../../Button-jStpvb3T.js";
|
|
10
|
+
import { t as s } from "../../../Input-Bb_-ljl1.js";
|
|
11
|
+
import { useIconContext as c } from "../../../contexts/IconContext.js";
|
|
12
|
+
import { useViewportContext as ne } from "../../../contexts/ViewportContext.js";
|
|
13
|
+
import { t as l } from "../../../RPTooltip-ZZoFqP7C.js";
|
|
14
|
+
import { t as re } from "../../../DropDown-DikL-krI.js";
|
|
15
|
+
import { InfoIcon as u } from "../../icons/InfoIcon.js";
|
|
16
|
+
import { SearchIcon as d } from "../../icons/SearchIcon.js";
|
|
17
|
+
import { t as f } from "../../../SearchTool.module-DUkVXfOn.js";
|
|
18
|
+
import { t as p } from "../../../Checkbox-Brta-YKG.js";
|
|
19
|
+
import { ClearIcon as m } from "../../icons/ClearIcon.js";
|
|
20
|
+
import { SearchResultNavigator as h } from "./SearchResultNavigator.js";
|
|
21
|
+
import { SearchCloseButton as g } from "./SearchCloseButton.js";
|
|
22
|
+
import { useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
23
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
24
24
|
//#region lib/components/layout/toolbar/SearchTool.tsx
|
|
25
|
-
var
|
|
26
|
-
let { searchIcon: e } =
|
|
27
|
-
return e ?? t ?? /* @__PURE__ */
|
|
28
|
-
},
|
|
29
|
-
let { searchClearIcon: e } =
|
|
30
|
-
return e ?? t ?? /* @__PURE__ */
|
|
31
|
-
},
|
|
32
|
-
let { container:
|
|
33
|
-
|
|
34
|
-
let { pdf:
|
|
35
|
-
|
|
36
|
-
}, [P]),
|
|
37
|
-
P(""), U(""),
|
|
38
|
-
|
|
25
|
+
var ie = () => {
|
|
26
|
+
let { searchIcon: e } = c(), { searchIcon: t } = a();
|
|
27
|
+
return e ?? t ?? /* @__PURE__ */ C(d, {});
|
|
28
|
+
}, ae = () => {
|
|
29
|
+
let { searchClearIcon: e } = c(), { searchClearIcon: t } = a();
|
|
30
|
+
return e ?? t ?? /* @__PURE__ */ C(m, {});
|
|
31
|
+
}, T = ({ icon: a }) => {
|
|
32
|
+
let { container: c } = t(), [m, T] = x(!1), E = b(null), D = b(m);
|
|
33
|
+
D.current = m;
|
|
34
|
+
let { pdf: O } = e(), [k, A] = x(null), { searchOptions: j, setSearchOptions: M, loading: N, setSearch: P, totalMatches: F, currentMatchPosition: I, nextMatch: L, prevMatch: R, search: z } = i(), { searchTool: B = !0 } = n(), { searchTool: V = !0 } = r(), [H, U] = x(z), { localeMessages: W } = ee(), { isSmallScreen: G } = ne(), [K, q] = x(null), [oe, se] = x(!1), ce = _(() => {
|
|
35
|
+
D.current && (P(""), U("")), T((e) => !e);
|
|
36
|
+
}, [P]), J = _(() => {
|
|
37
|
+
P(""), U(""), T(!1), requestAnimationFrame(() => {
|
|
38
|
+
E.current?.focus();
|
|
39
|
+
});
|
|
40
|
+
}, [P]), Y = (e) => {
|
|
39
41
|
let t = e.key === "Enter", n = e.key === " ";
|
|
40
|
-
(t || n) &&
|
|
41
|
-
},
|
|
42
|
-
e.key === "Escape" &&
|
|
43
|
-
}, [
|
|
42
|
+
(t || n) && J();
|
|
43
|
+
}, X = _((e) => {
|
|
44
|
+
e.key === "Escape" && m && J();
|
|
45
|
+
}, [m]), Z = _((e) => {
|
|
44
46
|
e.shiftKey && e.key === "Enter" ? R() : e.key === "Enter" && z !== H ? P(H) : e.key === "Enter" && L();
|
|
45
47
|
}, [
|
|
46
48
|
H,
|
|
@@ -49,38 +51,38 @@ var ne = () => {
|
|
|
49
51
|
P,
|
|
50
52
|
z
|
|
51
53
|
]);
|
|
52
|
-
|
|
54
|
+
v(() => {
|
|
53
55
|
U(z);
|
|
54
|
-
}, [z]),
|
|
55
|
-
z &&
|
|
56
|
-
}, [z,
|
|
56
|
+
}, [z]), v(() => {
|
|
57
|
+
z && O && se(!0);
|
|
58
|
+
}, [z, O]), v(() => {
|
|
57
59
|
z && z.trim() !== "" && (U(z), P(z));
|
|
58
|
-
}, []),
|
|
59
|
-
window.removeEventListener("keydown",
|
|
60
|
-
}), [
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
}, []), v(() => (window.addEventListener("keydown", X), () => {
|
|
61
|
+
window.removeEventListener("keydown", X);
|
|
62
|
+
}), [X]), v(() => {
|
|
63
|
+
k && setTimeout(() => {
|
|
64
|
+
k.focus();
|
|
63
65
|
}, 0);
|
|
64
|
-
}, [
|
|
65
|
-
let
|
|
66
|
+
}, [k]);
|
|
67
|
+
let le = _((e) => {
|
|
66
68
|
U(e.target.value);
|
|
67
|
-
}, []), Q =
|
|
69
|
+
}, []), Q = _(() => {
|
|
68
70
|
U(""), P("");
|
|
69
|
-
}, [P]),
|
|
70
|
-
|
|
71
|
+
}, [P]), ue = y(() => `${I} / ${F}`, [I, F]), { wholeWords: de, matchCase: fe } = y(() => j, [j]), pe = _((e) => {
|
|
72
|
+
M((t) => ({
|
|
71
73
|
...t,
|
|
72
74
|
matchCase: e
|
|
73
75
|
}));
|
|
74
|
-
}, [
|
|
75
|
-
|
|
76
|
+
}, [M]), me = _((e) => {
|
|
77
|
+
M((t) => ({
|
|
76
78
|
...t,
|
|
77
79
|
wholeWords: e
|
|
78
80
|
}));
|
|
79
|
-
}, [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
let $ =
|
|
81
|
+
}, [M]);
|
|
82
|
+
v(() => {
|
|
83
|
+
O && oe && J();
|
|
84
|
+
}, [O, J]);
|
|
85
|
+
let $ = y(() => K?.querySelectorAll("[tabindex]:not([tabindex=\"-1\"])") || [], [K]), he = _((e) => {
|
|
84
86
|
if (e.key === "Tab") {
|
|
85
87
|
let t = document.activeElement, n = -1;
|
|
86
88
|
$.forEach((e, r) => {
|
|
@@ -99,53 +101,54 @@ var ne = () => {
|
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
}, [$]);
|
|
102
|
-
return !B || !V ? null : /* @__PURE__ */
|
|
103
|
-
open:
|
|
104
|
-
container:
|
|
104
|
+
return !B || !V ? null : /* @__PURE__ */ C(S, { children: /* @__PURE__ */ C(re, {
|
|
105
|
+
open: m,
|
|
106
|
+
container: c,
|
|
105
107
|
side: "bottom",
|
|
106
108
|
align: "start",
|
|
107
109
|
tabIndex: 0,
|
|
108
110
|
avoidCollisions: !1,
|
|
109
|
-
triggerComponent: /* @__PURE__ */
|
|
111
|
+
triggerComponent: /* @__PURE__ */ C(l, {
|
|
110
112
|
content: W?.searchButtonTooltip,
|
|
111
|
-
children: /* @__PURE__ */
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
children: /* @__PURE__ */ C(o, {
|
|
114
|
+
ref: E,
|
|
115
|
+
active: m,
|
|
116
|
+
onClick: ce,
|
|
114
117
|
"aria-label": W?.searchButtonTooltip,
|
|
115
|
-
"aria-expanded":
|
|
118
|
+
"aria-expanded": m,
|
|
116
119
|
"aria-haspopup": "dialog",
|
|
117
|
-
children:
|
|
120
|
+
children: a || /* @__PURE__ */ C(ie, {})
|
|
118
121
|
})
|
|
119
122
|
}),
|
|
120
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ w("div", {
|
|
121
124
|
ref: q,
|
|
122
|
-
className:
|
|
125
|
+
className: f["rp-search-tool-content"],
|
|
123
126
|
tabIndex: -1,
|
|
124
|
-
onKeyDown:
|
|
127
|
+
onKeyDown: he,
|
|
125
128
|
role: "dialog",
|
|
126
129
|
"aria-label": W?.searchInputTooltip || "Search dialog",
|
|
127
|
-
children: [/* @__PURE__ */
|
|
128
|
-
className:
|
|
129
|
-
children: [/* @__PURE__ */
|
|
130
|
-
className:
|
|
130
|
+
children: [/* @__PURE__ */ w("div", {
|
|
131
|
+
className: f["rp-search-tool-input-wrapper"],
|
|
132
|
+
children: [/* @__PURE__ */ w("div", {
|
|
133
|
+
className: f["rp-search-tool-input"],
|
|
131
134
|
children: [
|
|
132
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ C(l, {
|
|
133
136
|
content: W?.searchInputTooltip,
|
|
134
|
-
children: /* @__PURE__ */
|
|
137
|
+
children: /* @__PURE__ */ C(s, {
|
|
135
138
|
value: H,
|
|
136
|
-
onKeyDown:
|
|
137
|
-
onChange:
|
|
138
|
-
icon: /* @__PURE__ */
|
|
139
|
+
onKeyDown: Z,
|
|
140
|
+
onChange: le,
|
|
141
|
+
icon: /* @__PURE__ */ C(d, {}),
|
|
139
142
|
placeholder: W?.searchInputPlaceholder,
|
|
140
|
-
className:
|
|
141
|
-
ref:
|
|
143
|
+
className: f["rp-search-input"],
|
|
144
|
+
ref: A,
|
|
142
145
|
id: "search-input",
|
|
143
146
|
name: "search-input",
|
|
144
147
|
tabIndex: 0,
|
|
145
148
|
"aria-label": W?.searchInputTooltip || W?.searchInputPlaceholder,
|
|
146
149
|
"aria-describedby": "search-results-count",
|
|
147
|
-
children: !!H && /* @__PURE__ */
|
|
148
|
-
className:
|
|
150
|
+
children: !!H && /* @__PURE__ */ C("span", {
|
|
151
|
+
className: f["rp-search-tool-input-clear"],
|
|
149
152
|
onClick: Q,
|
|
150
153
|
role: "button",
|
|
151
154
|
tabIndex: 0,
|
|
@@ -153,77 +156,77 @@ var ne = () => {
|
|
|
153
156
|
onKeyDown: (e) => {
|
|
154
157
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), Q());
|
|
155
158
|
},
|
|
156
|
-
children: /* @__PURE__ */
|
|
159
|
+
children: /* @__PURE__ */ C(ae, {})
|
|
157
160
|
})
|
|
158
161
|
})
|
|
159
162
|
}),
|
|
160
|
-
|
|
163
|
+
N ? /* @__PURE__ */ C("span", {
|
|
161
164
|
"aria-live": "polite",
|
|
162
165
|
"aria-label": "Searching",
|
|
163
|
-
children: /* @__PURE__ */
|
|
164
|
-
className:
|
|
166
|
+
children: /* @__PURE__ */ C(te, {
|
|
167
|
+
className: f["rp-search-loader-icon"],
|
|
165
168
|
"aria-hidden": "true"
|
|
166
169
|
})
|
|
167
|
-
}) : /* @__PURE__ */
|
|
170
|
+
}) : /* @__PURE__ */ C("span", {
|
|
168
171
|
id: "search-results-count",
|
|
169
172
|
"aria-live": "polite",
|
|
170
|
-
children:
|
|
173
|
+
children: ue
|
|
171
174
|
}),
|
|
172
|
-
G && /* @__PURE__ */
|
|
173
|
-
className:
|
|
174
|
-
children: /* @__PURE__ */
|
|
175
|
-
onKeyPress:
|
|
176
|
-
handleClose:
|
|
175
|
+
G && /* @__PURE__ */ C("div", {
|
|
176
|
+
className: f["rp-search-tool-controls"],
|
|
177
|
+
children: /* @__PURE__ */ C(g, {
|
|
178
|
+
onKeyPress: Y,
|
|
179
|
+
handleClose: J
|
|
177
180
|
})
|
|
178
181
|
})
|
|
179
182
|
]
|
|
180
|
-
}), /* @__PURE__ */
|
|
181
|
-
className:
|
|
183
|
+
}), /* @__PURE__ */ w("div", {
|
|
184
|
+
className: f["rp-search-tool-input-checkboxes"],
|
|
182
185
|
children: [
|
|
183
|
-
G && /* @__PURE__ */
|
|
184
|
-
/* @__PURE__ */
|
|
186
|
+
G && /* @__PURE__ */ C(h, {}),
|
|
187
|
+
/* @__PURE__ */ C(p, {
|
|
185
188
|
tabIndex: 0,
|
|
186
189
|
name: "matchCase",
|
|
187
|
-
value:
|
|
188
|
-
onChange:
|
|
190
|
+
value: fe,
|
|
191
|
+
onChange: pe,
|
|
189
192
|
"aria-label": W?.searchMatchCaseLabel,
|
|
190
193
|
children: W?.searchMatchCaseLabel
|
|
191
194
|
}),
|
|
192
|
-
!G && /* @__PURE__ */
|
|
195
|
+
!G && /* @__PURE__ */ C(l, {
|
|
193
196
|
content: W?.searchMatchCaseTooltip,
|
|
194
|
-
children: /* @__PURE__ */
|
|
195
|
-
className:
|
|
197
|
+
children: /* @__PURE__ */ C("div", {
|
|
198
|
+
className: f["rp-search-icon-info"],
|
|
196
199
|
tabIndex: 0,
|
|
197
|
-
children: /* @__PURE__ */
|
|
200
|
+
children: /* @__PURE__ */ C(u, {})
|
|
198
201
|
})
|
|
199
202
|
}),
|
|
200
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ C(p, {
|
|
201
204
|
tabIndex: 0,
|
|
202
205
|
name: "wholeWord",
|
|
203
|
-
value:
|
|
204
|
-
onChange:
|
|
206
|
+
value: de,
|
|
207
|
+
onChange: me,
|
|
205
208
|
"aria-label": W?.searchWholeWordsLabel,
|
|
206
209
|
children: W?.searchWholeWordsLabel
|
|
207
210
|
}),
|
|
208
|
-
!G && /* @__PURE__ */
|
|
211
|
+
!G && /* @__PURE__ */ C(l, {
|
|
209
212
|
content: W?.searchWholeWordsTooltip,
|
|
210
|
-
children: /* @__PURE__ */
|
|
213
|
+
children: /* @__PURE__ */ C("div", {
|
|
211
214
|
tabIndex: 0,
|
|
212
|
-
className:
|
|
213
|
-
children: /* @__PURE__ */
|
|
215
|
+
className: f["rp-search-icon-info"],
|
|
216
|
+
children: /* @__PURE__ */ C(u, {})
|
|
214
217
|
})
|
|
215
218
|
})
|
|
216
219
|
]
|
|
217
220
|
})]
|
|
218
|
-
}), !G && /* @__PURE__ */
|
|
219
|
-
className:
|
|
220
|
-
children: [/* @__PURE__ */
|
|
221
|
-
onKeyPress:
|
|
222
|
-
handleClose:
|
|
221
|
+
}), !G && /* @__PURE__ */ w("div", {
|
|
222
|
+
className: f["rp-search-tool-controls"],
|
|
223
|
+
children: [/* @__PURE__ */ C(h, {}), /* @__PURE__ */ C(g, {
|
|
224
|
+
onKeyPress: Y,
|
|
225
|
+
handleClose: J
|
|
223
226
|
})]
|
|
224
227
|
})]
|
|
225
228
|
})
|
|
226
229
|
}) });
|
|
227
230
|
};
|
|
228
231
|
//#endregion
|
|
229
|
-
export {
|
|
232
|
+
export { T as SearchTool };
|
|
@@ -3,7 +3,7 @@ import { LicenseType as t } from "../types.js";
|
|
|
3
3
|
import { appConsole as n } from "../appConsole.js";
|
|
4
4
|
import { useCallback as r, useEffect as i, useState as a } from "react";
|
|
5
5
|
//#region lib/utils/hooks/useLicense.ts
|
|
6
|
-
var o = /* @__PURE__ */ new Date("2026-05-
|
|
6
|
+
var o = /* @__PURE__ */ new Date("2026-05-20T06:51:49.546Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
|
|
7
7
|
invalidLicense: `You are currently using without a valid license. ${c}`,
|
|
8
8
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${c}`,
|
|
9
9
|
expired: `Your license key has expired. ${c}`,
|