@react-pdf-kit/viewer 2.0.0-rc.1 → 2.0.1-beta.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/dist/components/RPController.js +73 -74
- package/dist/components/RPPages.js +544 -545
- package/dist/components/layout/toolbar/SearchTool.js +96 -93
- package/dist/contexts/InitialStateContext.js +6 -8
- package/dist/types/utils/hooks/useWatermark.d.ts +1 -1
- package/dist/types/utils/types.d.ts +1 -1
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useWatermark.js +39 -57
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as o, Fragment as
|
|
2
|
-
import { UIButton as
|
|
1
|
+
import { jsx as o, Fragment as pt, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { UIButton as mt } from "../../ui/Button.js";
|
|
3
3
|
import { SearchIcon as A } from "../../icons/SearchIcon.js";
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useLayoutContainer as
|
|
4
|
+
import { useState as S, useCallback as i, useEffect as h, useMemo as W } from "react";
|
|
5
|
+
import { useLayoutContainer as st } from "../../../contexts/LayoutContainerContext.js";
|
|
6
6
|
import { c as n } from "../../../SearchTool.module-99f60dc7.js";
|
|
7
|
-
import { UIInput as
|
|
7
|
+
import { UIInput as lt } from "../../ui/Input.js";
|
|
8
8
|
import { UICheckbox as $ } from "../../ui/Checkbox.js";
|
|
9
9
|
import { ClearIcon as ht } from "../../icons/ClearIcon.js";
|
|
10
|
-
import { LoaderIcon as
|
|
11
|
-
import { useSearchContext as
|
|
12
|
-
import { useIconContext as
|
|
13
|
-
import { useDocumentContext as
|
|
14
|
-
import
|
|
15
|
-
import { useToolbarComponentContext as
|
|
16
|
-
import { useLocalizationContext as
|
|
10
|
+
import { LoaderIcon as dt } from "../../icons/LoaderIcon.js";
|
|
11
|
+
import { useSearchContext as ut } from "../../../contexts/SearchContext.js";
|
|
12
|
+
import { useIconContext as F } from "../../../contexts/IconContext.js";
|
|
13
|
+
import { useDocumentContext as ft } from "../../../contexts/RPDocumentContext.js";
|
|
14
|
+
import v from "../../ui/RPTooltip.js";
|
|
15
|
+
import { useToolbarComponentContext as It } from "../../../contexts/ToolbarComponentContext.js";
|
|
16
|
+
import { useLocalizationContext as Ct } from "../../../contexts/LocalizationContext.js";
|
|
17
17
|
import { InfoIcon as j } from "../../icons/InfoIcon.js";
|
|
18
|
-
import { useViewportContext as
|
|
18
|
+
import { useViewportContext as bt } from "../../../contexts/ViewportContext.js";
|
|
19
19
|
import { SearchResultNavigator as q } from "./SearchResultNavigator.js";
|
|
20
20
|
import { SearchCloseButton as z } from "./SearchCloseButton.js";
|
|
21
|
-
import { UIDropDown as
|
|
22
|
-
import { useIconToolContext as
|
|
21
|
+
import { UIDropDown as xt } from "../../ui/DropDown.js";
|
|
22
|
+
import { useIconToolContext as H } from "../../../contexts/IconToolContext.js";
|
|
23
23
|
import { useToolComponentContext as St } from "../../../contexts/ToolComponentContext.js";
|
|
24
24
|
import "../../../clsx-0c6e471a.js";
|
|
25
25
|
import "../../../utils/withRef.js";
|
|
@@ -69,78 +69,81 @@ import "../../icons/CloseIcon.js";
|
|
|
69
69
|
import "../../../index-61f59539.js";
|
|
70
70
|
import "../../../Combination-136ff99c.js";
|
|
71
71
|
const yt = () => {
|
|
72
|
-
const { searchIcon:
|
|
73
|
-
return
|
|
74
|
-
},
|
|
75
|
-
const {
|
|
72
|
+
const { searchIcon: s } = F(), { searchIcon: d } = H();
|
|
73
|
+
return s ?? d ?? /* @__PURE__ */ o(A, {});
|
|
74
|
+
}, Tt = () => {
|
|
75
|
+
const { searchClearIcon: s } = F(), { searchClearIcon: d } = H();
|
|
76
|
+
return s ?? d ?? /* @__PURE__ */ o(ht, {});
|
|
77
|
+
}, qo = ({ icon: s }) => {
|
|
78
|
+
const { container: d } = st(), [u, L] = S(!1), { pdf: y } = ft(), [k, G] = S(null), {
|
|
76
79
|
searchOptions: D,
|
|
77
|
-
setSearchOptions:
|
|
78
|
-
loading:
|
|
80
|
+
setSearchOptions: T,
|
|
81
|
+
loading: J,
|
|
79
82
|
setSearch: c,
|
|
80
83
|
totalMatches: K,
|
|
81
84
|
currentMatchPosition: B,
|
|
82
85
|
nextMatch: O,
|
|
83
86
|
prevMatch: P,
|
|
84
87
|
search: e
|
|
85
|
-
} =
|
|
88
|
+
} = ut(), { searchTool: Q = !0 } = It(), { searchTool: X = !0 } = St(), [f, I] = S(e), { localeMessages: t } = Ct(), { isSmallScreen: C } = bt(), [E, Y] = S(null), [Z, _] = S(!1), g = i(() => {
|
|
86
89
|
L(!0);
|
|
87
|
-
}, []),
|
|
88
|
-
c(""),
|
|
90
|
+
}, []), l = i(() => {
|
|
91
|
+
c(""), I(""), L(!1);
|
|
89
92
|
}, [c]), R = (r) => {
|
|
90
|
-
const a = r.key === "Enter",
|
|
91
|
-
(a ||
|
|
93
|
+
const a = r.key === "Enter", b = r.key === " ";
|
|
94
|
+
(a || b) && l();
|
|
92
95
|
}, w = i(
|
|
93
96
|
(r) => {
|
|
94
|
-
r.key === "Escape" &&
|
|
97
|
+
r.key === "Escape" && u && l();
|
|
95
98
|
},
|
|
96
|
-
[
|
|
97
|
-
),
|
|
99
|
+
[u]
|
|
100
|
+
), M = i(
|
|
98
101
|
(r) => {
|
|
99
|
-
r.shiftKey && r.key === "Enter" ? P() : r.key === "Enter" && e !==
|
|
102
|
+
r.shiftKey && r.key === "Enter" ? P() : r.key === "Enter" && e !== f ? c(f) : r.key === "Enter" && O();
|
|
100
103
|
},
|
|
101
|
-
[
|
|
104
|
+
[f, P, O, c, e]
|
|
102
105
|
);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}, [e]),
|
|
106
|
-
e &&
|
|
107
|
-
}, [e,
|
|
108
|
-
e && e.trim() !== "" && (
|
|
109
|
-
}, []),
|
|
106
|
+
h(() => {
|
|
107
|
+
I(e);
|
|
108
|
+
}, [e]), h(() => {
|
|
109
|
+
e && y && _(!0);
|
|
110
|
+
}, [e, y]), h(() => {
|
|
111
|
+
e && e.trim() !== "" && (I(e), c(e));
|
|
112
|
+
}, []), h(() => (window.addEventListener("keydown", w), () => {
|
|
110
113
|
window.removeEventListener("keydown", w);
|
|
111
|
-
}), [w]),
|
|
114
|
+
}), [w]), h(() => {
|
|
112
115
|
k && setTimeout(() => {
|
|
113
116
|
k.focus();
|
|
114
117
|
}, 0);
|
|
115
118
|
}, [k]);
|
|
116
|
-
const
|
|
117
|
-
|
|
119
|
+
const tt = i((r) => {
|
|
120
|
+
I(r.target.value);
|
|
118
121
|
}, []), U = i(() => {
|
|
119
|
-
|
|
120
|
-
}, [c]),
|
|
122
|
+
I(""), c("");
|
|
123
|
+
}, [c]), ot = W(() => `${B} / ${K}`, [B, K]), { wholeWords: rt, matchCase: et } = W(() => D, [D]), nt = i(
|
|
121
124
|
(r) => {
|
|
122
|
-
|
|
125
|
+
T((a) => ({ ...a, matchCase: r }));
|
|
123
126
|
},
|
|
124
|
-
[
|
|
125
|
-
),
|
|
127
|
+
[T]
|
|
128
|
+
), it = i(
|
|
126
129
|
(r) => {
|
|
127
|
-
|
|
130
|
+
T((a) => ({ ...a, wholeWords: r }));
|
|
128
131
|
},
|
|
129
|
-
[
|
|
132
|
+
[T]
|
|
130
133
|
);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, [
|
|
134
|
-
const p = W(() => (
|
|
134
|
+
h(() => {
|
|
135
|
+
y && Z && l();
|
|
136
|
+
}, [y, l]);
|
|
137
|
+
const p = W(() => (E == null ? void 0 : E.querySelectorAll('[tabindex]:not([tabindex="-1"])')) || [], [E]), at = i(
|
|
135
138
|
(r) => {
|
|
136
139
|
if (r.key === "Tab") {
|
|
137
140
|
const a = document.activeElement;
|
|
138
|
-
let
|
|
139
|
-
p.forEach((m,
|
|
140
|
-
m === a && (
|
|
141
|
+
let b = 0;
|
|
142
|
+
p.forEach((m, ct) => {
|
|
143
|
+
m === a && (b = ct);
|
|
141
144
|
});
|
|
142
|
-
let N =
|
|
143
|
-
r.shiftKey && (N =
|
|
145
|
+
let N = b + 1;
|
|
146
|
+
r.shiftKey && (N = b - 1);
|
|
144
147
|
const V = p[N];
|
|
145
148
|
if (V)
|
|
146
149
|
V.focus();
|
|
@@ -155,54 +158,54 @@ const yt = () => {
|
|
|
155
158
|
},
|
|
156
159
|
[p]
|
|
157
160
|
);
|
|
158
|
-
return !
|
|
159
|
-
|
|
161
|
+
return !Q || !X ? null : /* @__PURE__ */ o(pt, { children: /* @__PURE__ */ o(
|
|
162
|
+
xt,
|
|
160
163
|
{
|
|
161
|
-
open:
|
|
162
|
-
container:
|
|
164
|
+
open: u,
|
|
165
|
+
container: d,
|
|
163
166
|
side: "bottom",
|
|
164
167
|
align: "start",
|
|
165
168
|
tabIndex: 0,
|
|
166
169
|
avoidCollisions: !1,
|
|
167
|
-
triggerComponent: /* @__PURE__ */ o(
|
|
168
|
-
|
|
170
|
+
triggerComponent: /* @__PURE__ */ o(v, { content: t == null ? void 0 : t.searchButtonTooltip, children: /* @__PURE__ */ o(
|
|
171
|
+
mt,
|
|
169
172
|
{
|
|
170
|
-
active:
|
|
171
|
-
onClick:
|
|
173
|
+
active: u,
|
|
174
|
+
onClick: g,
|
|
172
175
|
"aria-label": t == null ? void 0 : t.searchButtonTooltip,
|
|
173
|
-
"aria-expanded":
|
|
176
|
+
"aria-expanded": u,
|
|
174
177
|
"aria-haspopup": "dialog",
|
|
175
|
-
children:
|
|
178
|
+
children: s || /* @__PURE__ */ o(yt, {})
|
|
176
179
|
}
|
|
177
180
|
) }),
|
|
178
|
-
children: /* @__PURE__ */
|
|
181
|
+
children: /* @__PURE__ */ x(
|
|
179
182
|
"div",
|
|
180
183
|
{
|
|
181
|
-
ref:
|
|
184
|
+
ref: Y,
|
|
182
185
|
className: n["rp-search-tool-content"],
|
|
183
186
|
tabIndex: 0,
|
|
184
|
-
onKeyDown:
|
|
187
|
+
onKeyDown: at,
|
|
185
188
|
role: "dialog",
|
|
186
189
|
"aria-label": (t == null ? void 0 : t.searchInputTooltip) || "Search dialog",
|
|
187
190
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */ o(
|
|
191
|
-
|
|
191
|
+
/* @__PURE__ */ x("div", { className: n["rp-search-tool-input-wrapper"], children: [
|
|
192
|
+
/* @__PURE__ */ x("div", { className: n["rp-search-tool-input"], children: [
|
|
193
|
+
/* @__PURE__ */ o(v, { content: t == null ? void 0 : t.searchInputTooltip, children: /* @__PURE__ */ o(
|
|
194
|
+
lt,
|
|
192
195
|
{
|
|
193
|
-
value:
|
|
194
|
-
onKeyDown:
|
|
195
|
-
onChange:
|
|
196
|
+
value: f,
|
|
197
|
+
onKeyDown: M,
|
|
198
|
+
onChange: tt,
|
|
196
199
|
icon: /* @__PURE__ */ o(A, {}),
|
|
197
200
|
placeholder: t == null ? void 0 : t.searchInputPlaceholder,
|
|
198
201
|
className: n["rp-search-input"],
|
|
199
|
-
ref:
|
|
202
|
+
ref: G,
|
|
200
203
|
id: "search-input",
|
|
201
204
|
name: "search-input",
|
|
202
205
|
tabIndex: 0,
|
|
203
206
|
"aria-label": (t == null ? void 0 : t.searchInputTooltip) || (t == null ? void 0 : t.searchInputPlaceholder),
|
|
204
207
|
"aria-describedby": "search-results-count",
|
|
205
|
-
children: !!
|
|
208
|
+
children: !!f && /* @__PURE__ */ o(
|
|
206
209
|
"span",
|
|
207
210
|
{
|
|
208
211
|
className: n["rp-search-tool-input-clear"],
|
|
@@ -213,45 +216,45 @@ const yt = () => {
|
|
|
213
216
|
onKeyDown: (r) => {
|
|
214
217
|
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), U());
|
|
215
218
|
},
|
|
216
|
-
children: /* @__PURE__ */ o(
|
|
219
|
+
children: /* @__PURE__ */ o(Tt, {})
|
|
217
220
|
}
|
|
218
221
|
)
|
|
219
222
|
}
|
|
220
223
|
) }),
|
|
221
|
-
|
|
222
|
-
|
|
224
|
+
J ? /* @__PURE__ */ o("span", { "aria-live": "polite", "aria-label": "Searching", children: /* @__PURE__ */ o(dt, { className: n["rp-search-loader-icon"], "aria-hidden": "true" }) }) : /* @__PURE__ */ o("span", { id: "search-results-count", "aria-live": "polite", children: ot }),
|
|
225
|
+
C && /* @__PURE__ */ o("div", { className: n["rp-search-tool-controls"], children: /* @__PURE__ */ o(z, { onKeyPress: R, handleClose: l }) })
|
|
223
226
|
] }),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
|
|
227
|
+
/* @__PURE__ */ x("div", { className: n["rp-search-tool-input-checkboxes"], children: [
|
|
228
|
+
C && /* @__PURE__ */ o(q, {}),
|
|
226
229
|
/* @__PURE__ */ o(
|
|
227
230
|
$,
|
|
228
231
|
{
|
|
229
232
|
tabIndex: 0,
|
|
230
233
|
name: "matchCase",
|
|
231
|
-
value:
|
|
232
|
-
onChange:
|
|
234
|
+
value: et,
|
|
235
|
+
onChange: nt,
|
|
233
236
|
"aria-label": t == null ? void 0 : t.searchMatchCaseLabel,
|
|
234
237
|
children: t == null ? void 0 : t.searchMatchCaseLabel
|
|
235
238
|
}
|
|
236
239
|
),
|
|
237
|
-
!
|
|
240
|
+
!C && /* @__PURE__ */ o(v, { content: t == null ? void 0 : t.searchMatchCaseTooltip, children: /* @__PURE__ */ o("div", { className: n["rp-search-icon-info"], tabIndex: 0, children: /* @__PURE__ */ o(j, {}) }) }),
|
|
238
241
|
/* @__PURE__ */ o(
|
|
239
242
|
$,
|
|
240
243
|
{
|
|
241
244
|
tabIndex: 0,
|
|
242
245
|
name: "wholeWord",
|
|
243
|
-
value:
|
|
244
|
-
onChange:
|
|
246
|
+
value: rt,
|
|
247
|
+
onChange: it,
|
|
245
248
|
"aria-label": t == null ? void 0 : t.searchWholeWordsLabel,
|
|
246
249
|
children: t == null ? void 0 : t.searchWholeWordsLabel
|
|
247
250
|
}
|
|
248
251
|
),
|
|
249
|
-
!
|
|
252
|
+
!C && /* @__PURE__ */ o(v, { content: t == null ? void 0 : t.searchWholeWordsTooltip, children: /* @__PURE__ */ o("div", { tabIndex: 0, className: n["rp-search-icon-info"], children: /* @__PURE__ */ o(j, {}) }) })
|
|
250
253
|
] })
|
|
251
254
|
] }),
|
|
252
|
-
!
|
|
255
|
+
!C && /* @__PURE__ */ x("div", { className: n["rp-search-tool-controls"], children: [
|
|
253
256
|
/* @__PURE__ */ o(q, {}),
|
|
254
|
-
/* @__PURE__ */ o(z, { onKeyPress: R, handleClose:
|
|
257
|
+
/* @__PURE__ */ o(z, { onKeyPress: R, handleClose: l })
|
|
255
258
|
] })
|
|
256
259
|
]
|
|
257
260
|
}
|
|
@@ -260,5 +263,5 @@ const yt = () => {
|
|
|
260
263
|
) });
|
|
261
264
|
};
|
|
262
265
|
export {
|
|
263
|
-
|
|
266
|
+
qo as SearchTool
|
|
264
267
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const t =
|
|
4
|
-
instanceId: ""
|
|
5
|
-
}), x = ({
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as n, useContext as i } from "react";
|
|
3
|
+
const t = n({}), x = ({
|
|
6
4
|
children: e,
|
|
7
|
-
...
|
|
8
|
-
}) => /* @__PURE__ */
|
|
5
|
+
...o
|
|
6
|
+
}) => /* @__PURE__ */ r(t.Provider, { value: o, children: e }), u = () => i(t);
|
|
9
7
|
export {
|
|
10
8
|
t as InitialStateContext,
|
|
11
9
|
x as InitialStateProvider,
|
|
12
|
-
|
|
10
|
+
u as useInitialStateContext
|
|
13
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useWatermark: (
|
|
1
|
+
export declare const useWatermark: (container: HTMLDivElement | null) => void;
|
|
@@ -540,7 +540,6 @@ export interface ZoomContextType {
|
|
|
540
540
|
}
|
|
541
541
|
export type ZoomProps = Omit<ZoomContextType, 'currentZoom'>;
|
|
542
542
|
export type InitialStateContextType = {
|
|
543
|
-
instanceId: string;
|
|
544
543
|
interactiveForm?: boolean;
|
|
545
544
|
} & ZoomProviderProps & PageProviderProps & ViewModeInitialProps & ScrollModeInitialProps & RotateProviderProps;
|
|
546
545
|
export interface ZoomProviderProps {
|
|
@@ -820,6 +819,7 @@ export interface RPHorizontalBarIcons {
|
|
|
820
819
|
documentPropertiesIcon?: React.ReactNode;
|
|
821
820
|
printIcon?: React.ReactNode;
|
|
822
821
|
searchIcon?: React.ReactNode;
|
|
822
|
+
searchClearIcon?: React.ReactNode;
|
|
823
823
|
textSelectionIcon?: React.ReactNode;
|
|
824
824
|
handModeIcon?: React.ReactNode;
|
|
825
825
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState as E, useCallback as h, useEffect as A } from "react";
|
|
2
2
|
import { appConsole as l } from "../appConsole.js";
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2026-02-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2026-02-25T08:16:21.019Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
|
|
4
4
|
invalidLicense: `You are currently using without a valid license. ${d}`,
|
|
5
5
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
|
|
6
6
|
expired: `Your license key has expired. ${d}`,
|