@pdf-viewer/react 1.4.2 → 1.4.3

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 (64) hide show
  1. package/dist/Popover-b7402893.js +1445 -0
  2. package/dist/{RPDefaultLayout-e27ef121.js → RPDefaultLayout-f9017f0e.js} +606 -601
  3. package/dist/component-1da194e8.js +337 -0
  4. package/dist/components/RPConfig.js +270 -259
  5. package/dist/components/RPController.js +1 -1
  6. package/dist/components/RPPages.js +2 -2
  7. package/dist/components/RPProvider.js +12 -11
  8. package/dist/components/layout/LayoutContainer.js +3 -2
  9. package/dist/components/layout/RPDefaultLayout.js +1 -1
  10. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  11. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  12. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  13. package/dist/components/layout/toolbar/DocumentDialog.js +3 -2
  14. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  15. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  16. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  17. package/dist/components/layout/toolbar/MostPageTool.js +4 -3
  18. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  19. package/dist/components/layout/toolbar/Paginate.js +1 -1
  20. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  21. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  22. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  23. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  24. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  25. package/dist/components/layout/toolbar/SearchTool.js +4 -3
  26. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  28. package/dist/components/layout/toolbar/ZoomTool.js +4 -3
  29. package/dist/components/page/AnnotationLayer.js +3 -2
  30. package/dist/components/page/CanvasLayer.js +3 -2
  31. package/dist/components/page/DualPage.js +1 -1
  32. package/dist/components/page/RPPage.js +3 -2
  33. package/dist/components/page/SinglePage.js +1 -1
  34. package/dist/components/page/TextHighlightLayer.js +3 -2
  35. package/dist/components/page/TextLayer.js +3 -2
  36. package/dist/components/ui/Checkbox.js +111 -94
  37. package/dist/components/ui/DropDown.js +1 -1
  38. package/dist/components/ui/LoadingIndicator.js +1 -1
  39. package/dist/components/ui/Popover.js +1 -1
  40. package/dist/components/ui/RPTooltip.js +206 -205
  41. package/dist/contexts/PaginationContext.js +1 -1
  42. package/dist/contexts/PrintContext.js +1 -1
  43. package/dist/contexts/SearchContext.js +1 -1
  44. package/dist/contexts/ThumbnailsContext.js +1 -1
  45. package/dist/floating-ui.react-dom-15b9b819.js +1310 -0
  46. package/dist/index-0f08882b.js +1561 -0
  47. package/dist/index-10ac1200.js +150 -0
  48. package/dist/index-271658fe.js +331 -0
  49. package/dist/main.js +1 -1
  50. package/dist/types/utils/hooks/useWatermark.d.ts +1 -1
  51. package/dist/utils/hooks/useFileDownload.js +3 -2
  52. package/dist/utils/hooks/useLicense.js +1 -1
  53. package/dist/utils/hooks/usePaginate.js +3 -2
  54. package/dist/utils/hooks/usePrint.js +3 -2
  55. package/dist/utils/hooks/useScrollToPage.js +3 -2
  56. package/dist/utils/hooks/useSearch.js +3 -2
  57. package/dist/utils/hooks/useThumbnail.js +3 -2
  58. package/dist/utils/hooks/useVirtualReactWindow.js +3 -2
  59. package/dist/utils/hooks/useWatermark.js +59 -28
  60. package/package.json +2 -2
  61. package/dist/Popover-d11ec15c.js +0 -3061
  62. package/dist/floating-ui.react-dom-88a86594.js +0 -1447
  63. package/dist/index-48ca3f30.js +0 -307
  64. package/dist/index-4ba3ab9a.js +0 -1877
@@ -0,0 +1,150 @@
1
+ import * as r from "react";
2
+ import { u as R, P as w, b as h, f as _, g as U } from "./index-271658fe.js";
3
+ import { jsx as T } from "react/jsx-runtime";
4
+ function b(t) {
5
+ const e = r.useRef(t);
6
+ return r.useEffect(() => {
7
+ e.current = t;
8
+ }), r.useMemo(() => (...n) => {
9
+ var s;
10
+ return (s = e.current) == null ? void 0 : s.call(e, ...n);
11
+ }, []);
12
+ }
13
+ function z(t, e = globalThis == null ? void 0 : globalThis.document) {
14
+ const n = b(t);
15
+ r.useEffect(() => {
16
+ const s = (i) => {
17
+ i.key === "Escape" && n(i);
18
+ };
19
+ return e.addEventListener("keydown", s, { capture: !0 }), () => e.removeEventListener("keydown", s, { capture: !0 });
20
+ }, [n, e]);
21
+ }
22
+ var H = "DismissableLayer", p = "dismissableLayer.update", M = "dismissableLayer.pointerDownOutside", K = "dismissableLayer.focusOutside", g, S = r.createContext({
23
+ layers: /* @__PURE__ */ new Set(),
24
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
25
+ branches: /* @__PURE__ */ new Set()
26
+ }), j = r.forwardRef(
27
+ (t, e) => {
28
+ const {
29
+ disableOutsidePointerEvents: n = !1,
30
+ onEscapeKeyDown: s,
31
+ onPointerDownOutside: i,
32
+ onFocusOutside: a,
33
+ onInteractOutside: l,
34
+ onDismiss: d,
35
+ ...E
36
+ } = t, u = r.useContext(S), [c, B] = r.useState(null), f = (c == null ? void 0 : c.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = r.useState({}), I = R(e, (o) => B(o)), m = Array.from(u.layers), [W] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), A = m.indexOf(W), P = c ? m.indexOf(c) : -1, N = u.layersWithOutsidePointerEventsDisabled.size > 0, D = P >= A, k = $((o) => {
37
+ const v = o.target, C = [...u.branches].some((y) => y.contains(v));
38
+ !D || C || (i == null || i(o), l == null || l(o), o.defaultPrevented || d == null || d());
39
+ }, f), L = q((o) => {
40
+ const v = o.target;
41
+ [...u.branches].some((y) => y.contains(v)) || (a == null || a(o), l == null || l(o), o.defaultPrevented || d == null || d());
42
+ }, f);
43
+ return z((o) => {
44
+ P === u.layers.size - 1 && (s == null || s(o), !o.defaultPrevented && d && (o.preventDefault(), d()));
45
+ }, f), r.useEffect(() => {
46
+ if (c)
47
+ return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (g = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(c)), u.layers.add(c), O(), () => {
48
+ n && u.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = g);
49
+ };
50
+ }, [c, f, n, u]), r.useEffect(() => () => {
51
+ c && (u.layers.delete(c), u.layersWithOutsidePointerEventsDisabled.delete(c), O());
52
+ }, [c, u]), r.useEffect(() => {
53
+ const o = () => F({});
54
+ return document.addEventListener(p, o), () => document.removeEventListener(p, o);
55
+ }, []), /* @__PURE__ */ T(
56
+ w.div,
57
+ {
58
+ ...E,
59
+ ref: I,
60
+ style: {
61
+ pointerEvents: N ? D ? "auto" : "none" : void 0,
62
+ ...t.style
63
+ },
64
+ onFocusCapture: h(t.onFocusCapture, L.onFocusCapture),
65
+ onBlurCapture: h(t.onBlurCapture, L.onBlurCapture),
66
+ onPointerDownCapture: h(
67
+ t.onPointerDownCapture,
68
+ k.onPointerDownCapture
69
+ )
70
+ }
71
+ );
72
+ }
73
+ );
74
+ j.displayName = H;
75
+ var X = "DismissableLayerBranch", Y = r.forwardRef((t, e) => {
76
+ const n = r.useContext(S), s = r.useRef(null), i = R(e, s);
77
+ return r.useEffect(() => {
78
+ const a = s.current;
79
+ if (a)
80
+ return n.branches.add(a), () => {
81
+ n.branches.delete(a);
82
+ };
83
+ }, [n.branches]), /* @__PURE__ */ T(w.div, { ...t, ref: i });
84
+ });
85
+ Y.displayName = X;
86
+ function $(t, e = globalThis == null ? void 0 : globalThis.document) {
87
+ const n = b(t), s = r.useRef(!1), i = r.useRef(() => {
88
+ });
89
+ return r.useEffect(() => {
90
+ const a = (d) => {
91
+ if (d.target && !s.current) {
92
+ let E = function() {
93
+ x(
94
+ M,
95
+ n,
96
+ u,
97
+ { discrete: !0 }
98
+ );
99
+ };
100
+ const u = { originalEvent: d };
101
+ d.pointerType === "touch" ? (e.removeEventListener("click", i.current), i.current = E, e.addEventListener("click", i.current, { once: !0 })) : E();
102
+ } else
103
+ e.removeEventListener("click", i.current);
104
+ s.current = !1;
105
+ }, l = window.setTimeout(() => {
106
+ e.addEventListener("pointerdown", a);
107
+ }, 0);
108
+ return () => {
109
+ window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", i.current);
110
+ };
111
+ }, [e, n]), {
112
+ // ensures we check React component tree (not just DOM tree)
113
+ onPointerDownCapture: () => s.current = !0
114
+ };
115
+ }
116
+ function q(t, e = globalThis == null ? void 0 : globalThis.document) {
117
+ const n = b(t), s = r.useRef(!1);
118
+ return r.useEffect(() => {
119
+ const i = (a) => {
120
+ a.target && !s.current && x(K, n, { originalEvent: a }, {
121
+ discrete: !1
122
+ });
123
+ };
124
+ return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i);
125
+ }, [e, n]), {
126
+ onFocusCapture: () => s.current = !0,
127
+ onBlurCapture: () => s.current = !1
128
+ };
129
+ }
130
+ function O() {
131
+ const t = new CustomEvent(p);
132
+ document.dispatchEvent(t);
133
+ }
134
+ function x(t, e, n, { discrete: s }) {
135
+ const i = n.originalEvent.target, a = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: n });
136
+ e && i.addEventListener(t, e, { once: !0 }), s ? _(i, a) : i.dispatchEvent(a);
137
+ }
138
+ var G = r[" useId ".trim().toString()] || (() => {
139
+ }), J = 0;
140
+ function Z(t) {
141
+ const [e, n] = r.useState(G());
142
+ return U(() => {
143
+ t || n((s) => s ?? String(J++));
144
+ }, [t]), t || (e ? `radix-${e}` : "");
145
+ }
146
+ export {
147
+ j as D,
148
+ Z as a,
149
+ b as u
150
+ };
@@ -0,0 +1,331 @@
1
+ import * as s from "react";
2
+ import { jsx as v, Fragment as A } from "react/jsx-runtime";
3
+ import * as E from "react-dom";
4
+ function k(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
5
+ return function(r) {
6
+ if (e == null || e(r), n === !1 || !r.defaultPrevented)
7
+ return t == null ? void 0 : t(r);
8
+ };
9
+ }
10
+ function C(e, t) {
11
+ if (typeof e == "function")
12
+ return e(t);
13
+ e != null && (e.current = t);
14
+ }
15
+ function P(...e) {
16
+ return (t) => {
17
+ let n = !1;
18
+ const o = e.map((r) => {
19
+ const i = C(r, t);
20
+ return !n && typeof i == "function" && (n = !0), i;
21
+ });
22
+ if (n)
23
+ return () => {
24
+ for (let r = 0; r < o.length; r++) {
25
+ const i = o[r];
26
+ typeof i == "function" ? i() : C(e[r], null);
27
+ }
28
+ };
29
+ };
30
+ }
31
+ function x(...e) {
32
+ return s.useCallback(P(...e), e);
33
+ }
34
+ function B(e, t) {
35
+ const n = s.createContext(t), o = (i) => {
36
+ const { children: u, ...c } = i, a = s.useMemo(() => c, Object.values(c));
37
+ return /* @__PURE__ */ v(n.Provider, { value: a, children: u });
38
+ };
39
+ o.displayName = e + "Provider";
40
+ function r(i) {
41
+ const u = s.useContext(n);
42
+ if (u)
43
+ return u;
44
+ if (t !== void 0)
45
+ return t;
46
+ throw new Error(`\`${i}\` must be used within \`${e}\``);
47
+ }
48
+ return [o, r];
49
+ }
50
+ function Z(e, t = []) {
51
+ let n = [];
52
+ function o(i, u) {
53
+ const c = s.createContext(u), a = n.length;
54
+ n = [...n, u];
55
+ const l = (f) => {
56
+ var g;
57
+ const { scope: m, children: p, ...h } = f, S = ((g = m == null ? void 0 : m[e]) == null ? void 0 : g[a]) || c, b = s.useMemo(() => h, Object.values(h));
58
+ return /* @__PURE__ */ v(S.Provider, { value: b, children: p });
59
+ };
60
+ l.displayName = i + "Provider";
61
+ function d(f, m) {
62
+ var S;
63
+ const p = ((S = m == null ? void 0 : m[e]) == null ? void 0 : S[a]) || c, h = s.useContext(p);
64
+ if (h)
65
+ return h;
66
+ if (u !== void 0)
67
+ return u;
68
+ throw new Error(`\`${f}\` must be used within \`${i}\``);
69
+ }
70
+ return [l, d];
71
+ }
72
+ const r = () => {
73
+ const i = n.map((u) => s.createContext(u));
74
+ return function(c) {
75
+ const a = (c == null ? void 0 : c[e]) || i;
76
+ return s.useMemo(
77
+ () => ({ [`__scope${e}`]: { ...c, [e]: a } }),
78
+ [c, a]
79
+ );
80
+ };
81
+ };
82
+ return r.scopeName = e, [o, R(r, ...t)];
83
+ }
84
+ function R(...e) {
85
+ const t = e[0];
86
+ if (e.length === 1)
87
+ return t;
88
+ const n = () => {
89
+ const o = e.map((r) => ({
90
+ useScope: r(),
91
+ scopeName: r.scopeName
92
+ }));
93
+ return function(i) {
94
+ const u = o.reduce((c, { useScope: a, scopeName: l }) => {
95
+ const f = a(i)[`__scope${l}`];
96
+ return { ...c, ...f };
97
+ }, {});
98
+ return s.useMemo(() => ({ [`__scope${t.scopeName}`]: u }), [u]);
99
+ };
100
+ };
101
+ return n.scopeName = t.scopeName, n;
102
+ }
103
+ // @__NO_SIDE_EFFECTS__
104
+ function O(e) {
105
+ const t = /* @__PURE__ */ M(e), n = s.forwardRef((o, r) => {
106
+ const { children: i, ...u } = o, c = s.Children.toArray(i), a = c.find(I);
107
+ if (a) {
108
+ const l = a.props.children, d = c.map((f) => f === a ? s.Children.count(l) > 1 ? s.Children.only(null) : s.isValidElement(l) ? l.props.children : null : f);
109
+ return /* @__PURE__ */ v(t, { ...u, ref: r, children: s.isValidElement(l) ? s.cloneElement(l, void 0, d) : null });
110
+ }
111
+ return /* @__PURE__ */ v(t, { ...u, ref: r, children: i });
112
+ });
113
+ return n.displayName = `${e}.Slot`, n;
114
+ }
115
+ // @__NO_SIDE_EFFECTS__
116
+ function M(e) {
117
+ const t = s.forwardRef((n, o) => {
118
+ const { children: r, ...i } = n;
119
+ if (s.isValidElement(r)) {
120
+ const u = _(r), c = T(i, r.props);
121
+ return r.type !== s.Fragment && (c.ref = o ? P(o, u) : u), s.cloneElement(r, c);
122
+ }
123
+ return s.Children.count(r) > 1 ? s.Children.only(null) : null;
124
+ });
125
+ return t.displayName = `${e}.SlotClone`, t;
126
+ }
127
+ var w = Symbol("radix.slottable");
128
+ // @__NO_SIDE_EFFECTS__
129
+ function q(e) {
130
+ const t = ({ children: n }) => /* @__PURE__ */ v(A, { children: n });
131
+ return t.displayName = `${e}.Slottable`, t.__radixId = w, t;
132
+ }
133
+ function I(e) {
134
+ return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === w;
135
+ }
136
+ function T(e, t) {
137
+ const n = { ...t };
138
+ for (const o in t) {
139
+ const r = e[o], i = t[o];
140
+ /^on[A-Z]/.test(o) ? r && i ? n[o] = (...c) => {
141
+ i(...c), r(...c);
142
+ } : r && (n[o] = r) : o === "style" ? n[o] = { ...r, ...i } : o === "className" && (n[o] = [r, i].filter(Boolean).join(" "));
143
+ }
144
+ return { ...e, ...n };
145
+ }
146
+ function _(e) {
147
+ var o, r;
148
+ let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
149
+ return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
150
+ }
151
+ var $ = [
152
+ "a",
153
+ "button",
154
+ "div",
155
+ "form",
156
+ "h2",
157
+ "h3",
158
+ "img",
159
+ "input",
160
+ "label",
161
+ "li",
162
+ "nav",
163
+ "ol",
164
+ "p",
165
+ "select",
166
+ "span",
167
+ "svg",
168
+ "ul"
169
+ ], G = $.reduce((e, t) => {
170
+ const n = /* @__PURE__ */ O(`Primitive.${t}`), o = s.forwardRef((r, i) => {
171
+ const { asChild: u, ...c } = r, a = u ? n : t;
172
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ v(a, { ...c, ref: i });
173
+ });
174
+ return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
175
+ }, {});
176
+ function J(e, t) {
177
+ e && E.flushSync(() => e.dispatchEvent(t));
178
+ }
179
+ var N = globalThis != null && globalThis.document ? s.useLayoutEffect : () => {
180
+ };
181
+ function K(e) {
182
+ const [t, n] = s.useState(void 0);
183
+ return N(() => {
184
+ if (e) {
185
+ n({ width: e.offsetWidth, height: e.offsetHeight });
186
+ const o = new ResizeObserver((r) => {
187
+ if (!Array.isArray(r) || !r.length)
188
+ return;
189
+ const i = r[0];
190
+ let u, c;
191
+ if ("borderBoxSize" in i) {
192
+ const a = i.borderBoxSize, l = Array.isArray(a) ? a[0] : a;
193
+ u = l.inlineSize, c = l.blockSize;
194
+ } else
195
+ u = e.offsetWidth, c = e.offsetHeight;
196
+ n({ width: u, height: c });
197
+ });
198
+ return o.observe(e, { box: "border-box" }), () => o.unobserve(e);
199
+ } else
200
+ n(void 0);
201
+ }, [e]), t;
202
+ }
203
+ function D(e, t) {
204
+ return s.useReducer((n, o) => t[n][o] ?? n, e);
205
+ }
206
+ var U = (e) => {
207
+ const { present: t, children: n } = e, o = W(t), r = typeof n == "function" ? n({ present: o.isPresent }) : s.Children.only(n), i = x(o.ref, z(r));
208
+ return typeof n == "function" || o.isPresent ? s.cloneElement(r, { ref: i }) : null;
209
+ };
210
+ U.displayName = "Presence";
211
+ function W(e) {
212
+ const [t, n] = s.useState(), o = s.useRef(null), r = s.useRef(e), i = s.useRef("none"), u = e ? "mounted" : "unmounted", [c, a] = D(u, {
213
+ mounted: {
214
+ UNMOUNT: "unmounted",
215
+ ANIMATION_OUT: "unmountSuspended"
216
+ },
217
+ unmountSuspended: {
218
+ MOUNT: "mounted",
219
+ ANIMATION_END: "unmounted"
220
+ },
221
+ unmounted: {
222
+ MOUNT: "mounted"
223
+ }
224
+ });
225
+ return s.useEffect(() => {
226
+ const l = y(o.current);
227
+ i.current = c === "mounted" ? l : "none";
228
+ }, [c]), N(() => {
229
+ const l = o.current, d = r.current;
230
+ if (d !== e) {
231
+ const m = i.current, p = y(l);
232
+ e ? a("MOUNT") : p === "none" || (l == null ? void 0 : l.display) === "none" ? a("UNMOUNT") : a(d && m !== p ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
233
+ }
234
+ }, [e, a]), N(() => {
235
+ if (t) {
236
+ let l;
237
+ const d = t.ownerDocument.defaultView ?? window, f = (p) => {
238
+ const S = y(o.current).includes(p.animationName);
239
+ if (p.target === t && S && (a("ANIMATION_END"), !r.current)) {
240
+ const b = t.style.animationFillMode;
241
+ t.style.animationFillMode = "forwards", l = d.setTimeout(() => {
242
+ t.style.animationFillMode === "forwards" && (t.style.animationFillMode = b);
243
+ });
244
+ }
245
+ }, m = (p) => {
246
+ p.target === t && (i.current = y(o.current));
247
+ };
248
+ return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
249
+ d.clearTimeout(l), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
250
+ };
251
+ } else
252
+ a("ANIMATION_END");
253
+ }, [t, a]), {
254
+ isPresent: ["mounted", "unmountSuspended"].includes(c),
255
+ ref: s.useCallback((l) => {
256
+ o.current = l ? getComputedStyle(l) : null, n(l);
257
+ }, [])
258
+ };
259
+ }
260
+ function y(e) {
261
+ return (e == null ? void 0 : e.animationName) || "none";
262
+ }
263
+ function z(e) {
264
+ var o, r;
265
+ let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
266
+ return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
267
+ }
268
+ var L = s[" useInsertionEffect ".trim().toString()] || N;
269
+ function Q({
270
+ prop: e,
271
+ defaultProp: t,
272
+ onChange: n = () => {
273
+ },
274
+ caller: o
275
+ }) {
276
+ const [r, i, u] = j({
277
+ defaultProp: t,
278
+ onChange: n
279
+ }), c = e !== void 0, a = c ? e : r;
280
+ {
281
+ const d = s.useRef(e !== void 0);
282
+ s.useEffect(() => {
283
+ const f = d.current;
284
+ f !== c && console.warn(
285
+ `${o} is changing from ${f ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
286
+ ), d.current = c;
287
+ }, [c, o]);
288
+ }
289
+ const l = s.useCallback(
290
+ (d) => {
291
+ var f;
292
+ if (c) {
293
+ const m = F(d) ? d(e) : d;
294
+ m !== e && ((f = u.current) == null || f.call(u, m));
295
+ } else
296
+ i(d);
297
+ },
298
+ [c, e, i, u]
299
+ );
300
+ return [a, l];
301
+ }
302
+ function j({
303
+ defaultProp: e,
304
+ onChange: t
305
+ }) {
306
+ const [n, o] = s.useState(e), r = s.useRef(n), i = s.useRef(t);
307
+ return L(() => {
308
+ i.current = t;
309
+ }, [t]), s.useEffect(() => {
310
+ var u;
311
+ r.current !== n && ((u = i.current) == null || u.call(i, n), r.current = n);
312
+ }, [n, r]), [n, o, i];
313
+ }
314
+ function F(e) {
315
+ return typeof e == "function";
316
+ }
317
+ export {
318
+ G as P,
319
+ Q as a,
320
+ k as b,
321
+ Z as c,
322
+ U as d,
323
+ K as e,
324
+ J as f,
325
+ N as g,
326
+ q as h,
327
+ O as i,
328
+ P as j,
329
+ B as k,
330
+ x as u
331
+ };
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RPProvider as t } from "./components/RPProvider.js";
2
- import { b as x, R as n, c as s, u as m, d as p, e as f } from "./RPDefaultLayout-e27ef121.js";
2
+ import { b as x, R as n, c as s, u as m, d as p, e as f } from "./RPDefaultLayout-f9017f0e.js";
3
3
  import { RPConfig as a } from "./components/RPConfig.js";
4
4
  import { RPController as l } from "./components/RPController.js";
5
5
  import { RPTheme as P } from "./components/RPTheme.js";
@@ -1 +1 @@
1
- export declare const useWatermark: (container: HTMLDivElement | null) => void;
1
+ export declare const useWatermark: () => void;
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../contexts/RPDocumentContext.js";
3
3
  import "react";
4
- import { c as A } from "../../RPDefaultLayout-e27ef121.js";
4
+ import { c as B } from "../../RPDefaultLayout-f9017f0e.js";
5
5
  import "../../contexts/DarkModeContext.js";
6
6
  import "../../contexts/RotationContext.js";
7
7
  import "../../contexts/LayerContext.js";
@@ -21,10 +21,11 @@ import "../../contexts/DimensionPagesContext.js";
21
21
  import "../../contexts/LocalizationContext.js";
22
22
  import "../../contexts/HighlightContext.js";
23
23
  import "../../contexts/LoaderContext.js";
24
+ import "../../contexts/LicenseContext.js";
24
25
  import "../../components/RPConfig.js";
25
26
  import "../../contexts/ThemeContext.js";
26
27
  import "../../components/RPDropFileZone.js";
27
28
  import "../../contexts/ToolbarComponentContext.js";
28
29
  export {
29
- A as useFileDownload
30
+ B as useFileDownload
30
31
  };
@@ -1,6 +1,6 @@
1
1
  import { useState as E, useCallback as h, useEffect as A } from "react";
2
2
  import { appConsole as c } from "../appConsole.js";
3
- const b = /* @__PURE__ */ new Date("2025-04-29T08:04:09.488Z"), l = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", o = {
3
+ const b = /* @__PURE__ */ new Date("2025-05-02T03:46:16.295Z"), l = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", o = {
4
4
  invalidLicense: `You are currently using without a valid license. ${l}`,
5
5
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${l}`,
6
6
  expired: `Your license key has expired. ${l}`,
@@ -1,5 +1,5 @@
1
1
  import "react";
2
- import { g as C } from "../../RPDefaultLayout-e27ef121.js";
2
+ import { g as D } from "../../RPDefaultLayout-f9017f0e.js";
3
3
  import "../../contexts/ScrollStateContext.js";
4
4
  import "react/jsx-runtime";
5
5
  import "../../contexts/RPDocumentContext.js";
@@ -21,11 +21,12 @@ import "../../contexts/DimensionPagesContext.js";
21
21
  import "../../contexts/LocalizationContext.js";
22
22
  import "../../contexts/HighlightContext.js";
23
23
  import "../../contexts/LoaderContext.js";
24
+ import "../../contexts/LicenseContext.js";
24
25
  import "../../components/RPConfig.js";
25
26
  import "../../contexts/ThemeContext.js";
26
27
  import "../../components/RPDropFileZone.js";
27
28
  import "../../contexts/ToolbarComponentContext.js";
28
29
  import "./useDebounce.js";
29
30
  export {
30
- C as usePaginate
31
+ D as usePaginate
31
32
  };
@@ -1,7 +1,7 @@
1
1
  import "react";
2
2
  import "react/jsx-runtime";
3
3
  import "../../contexts/RPDocumentContext.js";
4
- import { i as C } from "../../RPDefaultLayout-e27ef121.js";
4
+ import { i as D } from "../../RPDefaultLayout-f9017f0e.js";
5
5
  import "../../contexts/DarkModeContext.js";
6
6
  import "../../contexts/RotationContext.js";
7
7
  import "../../contexts/LayerContext.js";
@@ -21,11 +21,12 @@ import "../../contexts/DimensionPagesContext.js";
21
21
  import "../../contexts/LocalizationContext.js";
22
22
  import "../../contexts/HighlightContext.js";
23
23
  import "../../contexts/LoaderContext.js";
24
+ import "../../contexts/LicenseContext.js";
24
25
  import "../../components/RPConfig.js";
25
26
  import "../../contexts/ThemeContext.js";
26
27
  import "../../components/RPDropFileZone.js";
27
28
  import "../../contexts/ToolbarComponentContext.js";
28
29
  import "pdfjs-dist";
29
30
  export {
30
- C as usePrint
31
+ D as usePrint
31
32
  };
@@ -2,7 +2,7 @@ import "react";
2
2
  import "../../contexts/ScrollModeContext.js";
3
3
  import "react/jsx-runtime";
4
4
  import "../../contexts/RPDocumentContext.js";
5
- import { f as B } from "../../RPDefaultLayout-e27ef121.js";
5
+ import { f as C } from "../../RPDefaultLayout-f9017f0e.js";
6
6
  import "../../contexts/DarkModeContext.js";
7
7
  import "../types.js";
8
8
  import "../../contexts/RotationContext.js";
@@ -22,11 +22,12 @@ import "../../contexts/DimensionPagesContext.js";
22
22
  import "../../contexts/LocalizationContext.js";
23
23
  import "../../contexts/HighlightContext.js";
24
24
  import "../../contexts/LoaderContext.js";
25
+ import "../../contexts/LicenseContext.js";
25
26
  import "../../components/RPConfig.js";
26
27
  import "../../contexts/ThemeContext.js";
27
28
  import "../../components/RPDropFileZone.js";
28
29
  import "../../contexts/ToolbarComponentContext.js";
29
30
  import "../smoothScrollTo.js";
30
31
  export {
31
- B as useScrollToPage
32
+ C as useScrollToPage
32
33
  };
@@ -7,7 +7,7 @@ import "pdfjs-dist";
7
7
  import "../../contexts/RPDocumentContext.js";
8
8
  import "../../contexts/ZoomContext.js";
9
9
  import "react/jsx-runtime";
10
- import { n as E } from "../../RPDefaultLayout-e27ef121.js";
10
+ import { n as F } from "../../RPDefaultLayout-f9017f0e.js";
11
11
  import "../../contexts/DarkModeContext.js";
12
12
  import "../../contexts/RotationContext.js";
13
13
  import "../../contexts/LayerContext.js";
@@ -24,10 +24,11 @@ import "../../contexts/DimensionPagesContext.js";
24
24
  import "../../contexts/LocalizationContext.js";
25
25
  import "../../contexts/HighlightContext.js";
26
26
  import "../../contexts/LoaderContext.js";
27
+ import "../../contexts/LicenseContext.js";
27
28
  import "../../components/RPConfig.js";
28
29
  import "../../contexts/ThemeContext.js";
29
30
  import "../../components/RPDropFileZone.js";
30
31
  import "../../contexts/ToolbarComponentContext.js";
31
32
  export {
32
- E as useSearch
33
+ F as useSearch
33
34
  };
@@ -2,7 +2,7 @@ import "react";
2
2
  import "../renderPage.js";
3
3
  import "react/jsx-runtime";
4
4
  import "../../contexts/RPDocumentContext.js";
5
- import { k as D } from "../../RPDefaultLayout-e27ef121.js";
5
+ import { k as E } from "../../RPDefaultLayout-f9017f0e.js";
6
6
  import "../../contexts/DarkModeContext.js";
7
7
  import "../../contexts/RotationContext.js";
8
8
  import "../../contexts/LayerContext.js";
@@ -22,11 +22,12 @@ import "../../contexts/DimensionPagesContext.js";
22
22
  import "../../contexts/LocalizationContext.js";
23
23
  import "../../contexts/HighlightContext.js";
24
24
  import "../../contexts/LoaderContext.js";
25
+ import "../../contexts/LicenseContext.js";
25
26
  import "../../components/RPConfig.js";
26
27
  import "../../contexts/ThemeContext.js";
27
28
  import "../../components/RPDropFileZone.js";
28
29
  import "../../contexts/ToolbarComponentContext.js";
29
30
  import "../getThumbnailViewport.js";
30
31
  export {
31
- D as useThumbnail
32
+ E as useThumbnail
32
33
  };
@@ -3,7 +3,7 @@ import "../types.js";
3
3
  import "../../contexts/ScrollModeContext.js";
4
4
  import "react/jsx-runtime";
5
5
  import "../../contexts/RPDocumentContext.js";
6
- import { s as A } from "../../RPDefaultLayout-e27ef121.js";
6
+ import { s as B } from "../../RPDefaultLayout-f9017f0e.js";
7
7
  import "../../contexts/DarkModeContext.js";
8
8
  import "../../contexts/RotationContext.js";
9
9
  import "../../contexts/LayerContext.js";
@@ -22,10 +22,11 @@ import "../../contexts/DimensionPagesContext.js";
22
22
  import "../../contexts/LocalizationContext.js";
23
23
  import "../../contexts/HighlightContext.js";
24
24
  import "../../contexts/LoaderContext.js";
25
+ import "../../contexts/LicenseContext.js";
25
26
  import "../../components/RPConfig.js";
26
27
  import "../../contexts/ThemeContext.js";
27
28
  import "../../components/RPDropFileZone.js";
28
29
  import "../../contexts/ToolbarComponentContext.js";
29
30
  export {
30
- A as useVirtualReactWindow
31
+ B as useVirtualReactWindow
31
32
  };