@pdf-viewer/react 1.4.2 → 1.4.3-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.
Files changed (64) hide show
  1. package/dist/Popover-b7402893.js +1445 -0
  2. package/dist/{RPDefaultLayout-e27ef121.js → RPDefaultLayout-b9f5eccb.js} +228 -228
  3. package/dist/component-1da194e8.js +337 -0
  4. package/dist/components/RPController.js +1 -1
  5. package/dist/components/RPPages.js +2 -2
  6. package/dist/components/RPProvider.js +12 -11
  7. package/dist/components/layout/LayoutContainer.js +3 -2
  8. package/dist/components/layout/RPDefaultLayout.js +1 -1
  9. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  11. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  12. package/dist/components/layout/toolbar/DocumentDialog.js +3 -2
  13. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  14. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  15. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  16. package/dist/components/layout/toolbar/MostPageTool.js +4 -3
  17. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  18. package/dist/components/layout/toolbar/Paginate.js +1 -1
  19. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  20. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  21. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  22. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  23. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  24. package/dist/components/layout/toolbar/SearchTool.js +4 -3
  25. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  26. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/ZoomTool.js +4 -3
  28. package/dist/components/page/AnnotationLayer.js +3 -2
  29. package/dist/components/page/CanvasLayer.js +3 -2
  30. package/dist/components/page/DualPage.js +1 -1
  31. package/dist/components/page/RPPage.js +3 -2
  32. package/dist/components/page/SinglePage.js +1 -1
  33. package/dist/components/page/TextHighlightLayer.js +3 -2
  34. package/dist/components/page/TextLayer.js +3 -2
  35. package/dist/components/ui/Checkbox.js +7 -6
  36. package/dist/components/ui/DropDown.js +1 -1
  37. package/dist/components/ui/LoadingIndicator.js +1 -1
  38. package/dist/components/ui/Popover.js +1 -1
  39. package/dist/components/ui/RPTooltip.js +687 -328
  40. package/dist/contexts/PaginationContext.js +1 -1
  41. package/dist/contexts/PrintContext.js +1 -1
  42. package/dist/contexts/SearchContext.js +1 -1
  43. package/dist/contexts/ThumbnailsContext.js +1 -1
  44. package/dist/floating-ui.react-dom-15b9b819.js +1310 -0
  45. package/dist/index-2e540713.js +23 -0
  46. package/dist/index-353ec0a6.js +172 -0
  47. package/dist/index-5ff5dbd0.js +1675 -0
  48. package/dist/index-71898eb9.js +139 -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 +1 -1
  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,23 @@
1
+ import * as o from "react";
2
+ import { u as n, a as r } from "./index-71898eb9.js";
3
+ function i(a, e = globalThis == null ? void 0 : globalThis.document) {
4
+ const t = n(a);
5
+ o.useEffect(() => {
6
+ const s = (u) => {
7
+ u.key === "Escape" && t(u);
8
+ };
9
+ return e.addEventListener("keydown", s, { capture: !0 }), () => e.removeEventListener("keydown", s, { capture: !0 });
10
+ }, [t, e]);
11
+ }
12
+ var c = o["useId".toString()] || (() => {
13
+ }), f = 0;
14
+ function p(a) {
15
+ const [e, t] = o.useState(c());
16
+ return r(() => {
17
+ a || t((s) => s ?? String(f++));
18
+ }, [a]), a || (e ? `radix-${e}` : "");
19
+ }
20
+ export {
21
+ p as a,
22
+ i as u
23
+ };
@@ -0,0 +1,172 @@
1
+ import * as s from "react";
2
+ import * as C from "react-dom";
3
+ import { jsx as h, Fragment as M } from "react/jsx-runtime";
4
+ import { a as g } from "./index-71898eb9.js";
5
+ function x(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
6
+ return function(r) {
7
+ if (e == null || e(r), t === !1 || !r.defaultPrevented)
8
+ return n == null ? void 0 : n(r);
9
+ };
10
+ }
11
+ function A(e, n) {
12
+ if (typeof e == "function")
13
+ return e(n);
14
+ e != null && (e.current = n);
15
+ }
16
+ function R(...e) {
17
+ return (n) => {
18
+ let t = !1;
19
+ const i = e.map((r) => {
20
+ const o = A(r, n);
21
+ return !t && typeof o == "function" && (t = !0), o;
22
+ });
23
+ if (t)
24
+ return () => {
25
+ for (let r = 0; r < i.length; r++) {
26
+ const o = i[r];
27
+ typeof o == "function" ? o() : A(e[r], null);
28
+ }
29
+ };
30
+ };
31
+ }
32
+ function S(...e) {
33
+ return s.useCallback(R(...e), e);
34
+ }
35
+ var O = s.forwardRef((e, n) => {
36
+ const { children: t, ...i } = e, r = s.Children.toArray(t), o = r.find(T);
37
+ if (o) {
38
+ const c = o.props.children, l = r.map((u) => u === o ? s.Children.count(c) > 1 ? s.Children.only(null) : s.isValidElement(c) ? c.props.children : null : u);
39
+ return /* @__PURE__ */ h(y, { ...i, ref: n, children: s.isValidElement(c) ? s.cloneElement(c, void 0, l) : null });
40
+ }
41
+ return /* @__PURE__ */ h(y, { ...i, ref: n, children: t });
42
+ });
43
+ O.displayName = "Slot";
44
+ var y = s.forwardRef((e, n) => {
45
+ const { children: t, ...i } = e;
46
+ if (s.isValidElement(t)) {
47
+ const r = D(t), o = b(i, t.props);
48
+ return t.type !== s.Fragment && (o.ref = n ? R(n, r) : r), s.cloneElement(t, o);
49
+ }
50
+ return s.Children.count(t) > 1 ? s.Children.only(null) : null;
51
+ });
52
+ y.displayName = "SlotClone";
53
+ var E = ({ children: e }) => /* @__PURE__ */ h(M, { children: e });
54
+ function T(e) {
55
+ return s.isValidElement(e) && e.type === E;
56
+ }
57
+ function b(e, n) {
58
+ const t = { ...n };
59
+ for (const i in n) {
60
+ const r = e[i], o = n[i];
61
+ /^on[A-Z]/.test(i) ? r && o ? t[i] = (...l) => {
62
+ o(...l), r(...l);
63
+ } : r && (t[i] = r) : i === "style" ? t[i] = { ...r, ...o } : i === "className" && (t[i] = [r, o].filter(Boolean).join(" "));
64
+ }
65
+ return { ...e, ...t };
66
+ }
67
+ function D(e) {
68
+ var i, r;
69
+ let n = (i = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : i.get, t = n && "isReactWarning" in n && n.isReactWarning;
70
+ return t ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
71
+ }
72
+ var I = [
73
+ "a",
74
+ "button",
75
+ "div",
76
+ "form",
77
+ "h2",
78
+ "h3",
79
+ "img",
80
+ "input",
81
+ "label",
82
+ "li",
83
+ "nav",
84
+ "ol",
85
+ "p",
86
+ "span",
87
+ "svg",
88
+ "ul"
89
+ ], _ = I.reduce((e, n) => {
90
+ const t = s.forwardRef((i, r) => {
91
+ const { asChild: o, ...c } = i, l = o ? O : n;
92
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ h(l, { ...c, ref: r });
93
+ });
94
+ return t.displayName = `Primitive.${n}`, { ...e, [n]: t };
95
+ }, {});
96
+ function k(e, n) {
97
+ e && C.flushSync(() => e.dispatchEvent(n));
98
+ }
99
+ function U(e, n) {
100
+ return s.useReducer((t, i) => n[t][i] ?? t, e);
101
+ }
102
+ var W = (e) => {
103
+ const { present: n, children: t } = e, i = F(n), r = typeof t == "function" ? t({ present: i.isPresent }) : s.Children.only(t), o = S(i.ref, L(r));
104
+ return typeof t == "function" || i.isPresent ? s.cloneElement(r, { ref: o }) : null;
105
+ };
106
+ W.displayName = "Presence";
107
+ function F(e) {
108
+ const [n, t] = s.useState(), i = s.useRef({}), r = s.useRef(e), o = s.useRef("none"), c = e ? "mounted" : "unmounted", [l, u] = U(c, {
109
+ mounted: {
110
+ UNMOUNT: "unmounted",
111
+ ANIMATION_OUT: "unmountSuspended"
112
+ },
113
+ unmountSuspended: {
114
+ MOUNT: "mounted",
115
+ ANIMATION_END: "unmounted"
116
+ },
117
+ unmounted: {
118
+ MOUNT: "mounted"
119
+ }
120
+ });
121
+ return s.useEffect(() => {
122
+ const a = N(i.current);
123
+ o.current = l === "mounted" ? a : "none";
124
+ }, [l]), g(() => {
125
+ const a = i.current, m = r.current;
126
+ if (m !== e) {
127
+ const p = o.current, f = N(a);
128
+ e ? u("MOUNT") : f === "none" || (a == null ? void 0 : a.display) === "none" ? u("UNMOUNT") : u(m && p !== f ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
129
+ }
130
+ }, [e, u]), g(() => {
131
+ if (n) {
132
+ let a;
133
+ const m = n.ownerDocument.defaultView ?? window, d = (f) => {
134
+ const v = N(i.current).includes(f.animationName);
135
+ if (f.target === n && v && (u("ANIMATION_END"), !r.current)) {
136
+ const w = n.style.animationFillMode;
137
+ n.style.animationFillMode = "forwards", a = m.setTimeout(() => {
138
+ n.style.animationFillMode === "forwards" && (n.style.animationFillMode = w);
139
+ });
140
+ }
141
+ }, p = (f) => {
142
+ f.target === n && (o.current = N(i.current));
143
+ };
144
+ return n.addEventListener("animationstart", p), n.addEventListener("animationcancel", d), n.addEventListener("animationend", d), () => {
145
+ m.clearTimeout(a), n.removeEventListener("animationstart", p), n.removeEventListener("animationcancel", d), n.removeEventListener("animationend", d);
146
+ };
147
+ } else
148
+ u("ANIMATION_END");
149
+ }, [n, u]), {
150
+ isPresent: ["mounted", "unmountSuspended"].includes(l),
151
+ ref: s.useCallback((a) => {
152
+ a && (i.current = getComputedStyle(a)), t(a);
153
+ }, [])
154
+ };
155
+ }
156
+ function N(e) {
157
+ return (e == null ? void 0 : e.animationName) || "none";
158
+ }
159
+ function L(e) {
160
+ var i, r;
161
+ let n = (i = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : i.get, t = n && "isReactWarning" in n && n.isReactWarning;
162
+ return t ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
163
+ }
164
+ export {
165
+ _ as P,
166
+ O as S,
167
+ W as a,
168
+ R as b,
169
+ x as c,
170
+ k as d,
171
+ S as u
172
+ };