@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,337 @@
1
+ import * as l from "react";
2
+ import { useState as N } from "react";
3
+ var P = function(e) {
4
+ if (typeof document > "u")
5
+ return null;
6
+ var n = Array.isArray(e) ? e[0] : e;
7
+ return n.ownerDocument.body;
8
+ }, d = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), y = {}, w = 0, R = function(e) {
9
+ return e && (e.host || R(e.parentNode));
10
+ }, T = function(e, n) {
11
+ return n.map(function(t) {
12
+ if (e.contains(t))
13
+ return t;
14
+ var r = R(t);
15
+ return r && e.contains(r) ? r : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
16
+ }).filter(function(t) {
17
+ return !!t;
18
+ });
19
+ }, z = function(e, n, t, r) {
20
+ var a = T(n, Array.isArray(e) ? e : [e]);
21
+ y[t] || (y[t] = /* @__PURE__ */ new WeakMap());
22
+ var o = y[t], c = [], i = /* @__PURE__ */ new Set(), b = new Set(a), p = function(u) {
23
+ !u || i.has(u) || (i.add(u), p(u.parentNode));
24
+ };
25
+ a.forEach(p);
26
+ var s = function(u) {
27
+ !u || b.has(u) || Array.prototype.forEach.call(u.children, function(f) {
28
+ if (i.has(f))
29
+ s(f);
30
+ else
31
+ try {
32
+ var h = f.getAttribute(r), x = h !== null && h !== "false", k = (d.get(f) || 0) + 1, O = (o.get(f) || 0) + 1;
33
+ d.set(f, k), o.set(f, O), c.push(f), k === 1 && x && g.set(f, !0), O === 1 && f.setAttribute(t, "true"), x || f.setAttribute(r, "true");
34
+ } catch (I) {
35
+ console.error("aria-hidden: cannot operate on ", f, I);
36
+ }
37
+ });
38
+ };
39
+ return s(n), i.clear(), w++, function() {
40
+ c.forEach(function(u) {
41
+ var f = d.get(u) - 1, h = o.get(u) - 1;
42
+ d.set(u, f), o.set(u, h), f || (g.has(u) || u.removeAttribute(r), g.delete(u)), h || u.removeAttribute(t);
43
+ }), w--, w || (d = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), y = {});
44
+ };
45
+ }, oe = function(e, n, t) {
46
+ t === void 0 && (t = "data-aria-hidden");
47
+ var r = Array.from(Array.isArray(e) ? e : [e]), a = n || P(e);
48
+ return a ? (r.push.apply(r, Array.from(a.querySelectorAll("[aria-live]"))), z(r, a, t, "aria-hidden")) : function() {
49
+ return null;
50
+ };
51
+ }, m = function() {
52
+ return m = Object.assign || function(n) {
53
+ for (var t, r = 1, a = arguments.length; r < a; r++) {
54
+ t = arguments[r];
55
+ for (var o in t)
56
+ Object.prototype.hasOwnProperty.call(t, o) && (n[o] = t[o]);
57
+ }
58
+ return n;
59
+ }, m.apply(this, arguments);
60
+ };
61
+ function B(e, n) {
62
+ var t = {};
63
+ for (var r in e)
64
+ Object.prototype.hasOwnProperty.call(e, r) && n.indexOf(r) < 0 && (t[r] = e[r]);
65
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
66
+ for (var a = 0, r = Object.getOwnPropertySymbols(e); a < r.length; a++)
67
+ n.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (t[r[a]] = e[r[a]]);
68
+ return t;
69
+ }
70
+ function ie(e, n, t) {
71
+ if (t || arguments.length === 2)
72
+ for (var r = 0, a = n.length, o; r < a; r++)
73
+ (o || !(r in n)) && (o || (o = Array.prototype.slice.call(n, 0, r)), o[r] = n[r]);
74
+ return e.concat(o || Array.prototype.slice.call(n));
75
+ }
76
+ var S = "right-scroll-bar-position", E = "width-before-scroll-bar", L = "with-scroll-bars-hidden", D = "--removed-body-scroll-bar-size";
77
+ function A(e, n) {
78
+ return typeof e == "function" ? e(n) : e && (e.current = n), e;
79
+ }
80
+ function V(e, n) {
81
+ var t = N(function() {
82
+ return {
83
+ // value
84
+ value: e,
85
+ // last callback
86
+ callback: n,
87
+ // "memoized" public interface
88
+ facade: {
89
+ get current() {
90
+ return t.value;
91
+ },
92
+ set current(r) {
93
+ var a = t.value;
94
+ a !== r && (t.value = r, t.callback(r, a));
95
+ }
96
+ }
97
+ };
98
+ })[0];
99
+ return t.callback = n, t.facade;
100
+ }
101
+ var G = typeof window < "u" ? l.useLayoutEffect : l.useEffect, M = /* @__PURE__ */ new WeakMap();
102
+ function ce(e, n) {
103
+ var t = V(n || null, function(r) {
104
+ return e.forEach(function(a) {
105
+ return A(a, r);
106
+ });
107
+ });
108
+ return G(function() {
109
+ var r = M.get(t);
110
+ if (r) {
111
+ var a = new Set(r), o = new Set(e), c = t.current;
112
+ a.forEach(function(i) {
113
+ o.has(i) || A(i, null);
114
+ }), o.forEach(function(i) {
115
+ a.has(i) || A(i, c);
116
+ });
117
+ }
118
+ M.set(t, e);
119
+ }, [e]), t;
120
+ }
121
+ function Q(e) {
122
+ return e;
123
+ }
124
+ function q(e, n) {
125
+ n === void 0 && (n = Q);
126
+ var t = [], r = !1, a = {
127
+ read: function() {
128
+ if (r)
129
+ throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
130
+ return t.length ? t[t.length - 1] : e;
131
+ },
132
+ useMedium: function(o) {
133
+ var c = n(o, r);
134
+ return t.push(c), function() {
135
+ t = t.filter(function(i) {
136
+ return i !== c;
137
+ });
138
+ };
139
+ },
140
+ assignSyncMedium: function(o) {
141
+ for (r = !0; t.length; ) {
142
+ var c = t;
143
+ t = [], c.forEach(o);
144
+ }
145
+ t = {
146
+ push: function(i) {
147
+ return o(i);
148
+ },
149
+ filter: function() {
150
+ return t;
151
+ }
152
+ };
153
+ },
154
+ assignMedium: function(o) {
155
+ r = !0;
156
+ var c = [];
157
+ if (t.length) {
158
+ var i = t;
159
+ t = [], i.forEach(o), c = t;
160
+ }
161
+ var b = function() {
162
+ var s = c;
163
+ c = [], s.forEach(o);
164
+ }, p = function() {
165
+ return Promise.resolve().then(b);
166
+ };
167
+ p(), t = {
168
+ push: function(s) {
169
+ c.push(s), p();
170
+ },
171
+ filter: function(s) {
172
+ return c = c.filter(s), t;
173
+ }
174
+ };
175
+ }
176
+ };
177
+ return a;
178
+ }
179
+ function ue(e) {
180
+ e === void 0 && (e = {});
181
+ var n = q(null);
182
+ return n.options = m({ async: !0, ssr: !1 }, e), n;
183
+ }
184
+ var j = function(e) {
185
+ var n = e.sideCar, t = B(e, ["sideCar"]);
186
+ if (!n)
187
+ throw new Error("Sidecar: please provide `sideCar` property to import the right car");
188
+ var r = n.read();
189
+ if (!r)
190
+ throw new Error("Sidecar medium not found");
191
+ return l.createElement(r, m({}, t));
192
+ };
193
+ j.isSideCarExport = !0;
194
+ function fe(e, n) {
195
+ return e.useMedium(n), j;
196
+ }
197
+ var W, F = function() {
198
+ if (W)
199
+ return W;
200
+ if (typeof __webpack_nonce__ < "u")
201
+ return __webpack_nonce__;
202
+ };
203
+ function H() {
204
+ if (!document)
205
+ return null;
206
+ var e = document.createElement("style");
207
+ e.type = "text/css";
208
+ var n = F();
209
+ return n && e.setAttribute("nonce", n), e;
210
+ }
211
+ function K(e, n) {
212
+ e.styleSheet ? e.styleSheet.cssText = n : e.appendChild(document.createTextNode(n));
213
+ }
214
+ function U(e) {
215
+ var n = document.head || document.getElementsByTagName("head")[0];
216
+ n.appendChild(e);
217
+ }
218
+ var J = function() {
219
+ var e = 0, n = null;
220
+ return {
221
+ add: function(t) {
222
+ e == 0 && (n = H()) && (K(n, t), U(n)), e++;
223
+ },
224
+ remove: function() {
225
+ e--, !e && n && (n.parentNode && n.parentNode.removeChild(n), n = null);
226
+ }
227
+ };
228
+ }, X = function() {
229
+ var e = J();
230
+ return function(n, t) {
231
+ l.useEffect(function() {
232
+ return e.add(n), function() {
233
+ e.remove();
234
+ };
235
+ }, [n && t]);
236
+ };
237
+ }, Y = function() {
238
+ var e = X(), n = function(t) {
239
+ var r = t.styles, a = t.dynamic;
240
+ return e(r, a), null;
241
+ };
242
+ return n;
243
+ }, Z = {
244
+ left: 0,
245
+ top: 0,
246
+ right: 0,
247
+ gap: 0
248
+ }, C = function(e) {
249
+ return parseInt(e || "", 10) || 0;
250
+ }, $ = function(e) {
251
+ var n = window.getComputedStyle(document.body), t = n[e === "padding" ? "paddingLeft" : "marginLeft"], r = n[e === "padding" ? "paddingTop" : "marginTop"], a = n[e === "padding" ? "paddingRight" : "marginRight"];
252
+ return [C(t), C(r), C(a)];
253
+ }, ee = function(e) {
254
+ if (e === void 0 && (e = "margin"), typeof window > "u")
255
+ return Z;
256
+ var n = $(e), t = document.documentElement.clientWidth, r = window.innerWidth;
257
+ return {
258
+ left: n[0],
259
+ top: n[1],
260
+ right: n[2],
261
+ gap: Math.max(0, r - t + n[2] - n[0])
262
+ };
263
+ }, te = Y(), v = "data-scroll-locked", ne = function(e, n, t, r) {
264
+ var a = e.left, o = e.top, c = e.right, i = e.gap;
265
+ return t === void 0 && (t = "margin"), `
266
+ .`.concat(L, ` {
267
+ overflow: hidden `).concat(r, `;
268
+ padding-right: `).concat(i, "px ").concat(r, `;
269
+ }
270
+ body[`).concat(v, `] {
271
+ overflow: hidden `).concat(r, `;
272
+ overscroll-behavior: contain;
273
+ `).concat([
274
+ n && "position: relative ".concat(r, ";"),
275
+ t === "margin" && `
276
+ padding-left: `.concat(a, `px;
277
+ padding-top: `).concat(o, `px;
278
+ padding-right: `).concat(c, `px;
279
+ margin-left:0;
280
+ margin-top:0;
281
+ margin-right: `).concat(i, "px ").concat(r, `;
282
+ `),
283
+ t === "padding" && "padding-right: ".concat(i, "px ").concat(r, ";")
284
+ ].filter(Boolean).join(""), `
285
+ }
286
+
287
+ .`).concat(S, ` {
288
+ right: `).concat(i, "px ").concat(r, `;
289
+ }
290
+
291
+ .`).concat(E, ` {
292
+ margin-right: `).concat(i, "px ").concat(r, `;
293
+ }
294
+
295
+ .`).concat(S, " .").concat(S, ` {
296
+ right: 0 `).concat(r, `;
297
+ }
298
+
299
+ .`).concat(E, " .").concat(E, ` {
300
+ margin-right: 0 `).concat(r, `;
301
+ }
302
+
303
+ body[`).concat(v, `] {
304
+ `).concat(D, ": ").concat(i, `px;
305
+ }
306
+ `);
307
+ }, _ = function() {
308
+ var e = parseInt(document.body.getAttribute(v) || "0", 10);
309
+ return isFinite(e) ? e : 0;
310
+ }, re = function() {
311
+ l.useEffect(function() {
312
+ return document.body.setAttribute(v, (_() + 1).toString()), function() {
313
+ var e = _() - 1;
314
+ e <= 0 ? document.body.removeAttribute(v) : document.body.setAttribute(v, e.toString());
315
+ };
316
+ }, []);
317
+ }, se = function(e) {
318
+ var n = e.noRelative, t = e.noImportant, r = e.gapMode, a = r === void 0 ? "margin" : r;
319
+ re();
320
+ var o = l.useMemo(function() {
321
+ return ee(a);
322
+ }, [a]);
323
+ return l.createElement(te, { styles: ne(o, !n, a, t ? "" : "!important") });
324
+ };
325
+ export {
326
+ se as R,
327
+ B as _,
328
+ m as a,
329
+ ie as b,
330
+ ue as c,
331
+ fe as e,
332
+ E as f,
333
+ oe as h,
334
+ Y as s,
335
+ ce as u,
336
+ S as z
337
+ };