@pdf-viewer/react 1.9.0-beta.1 → 1.9.0-beta.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 (97) hide show
  1. package/dist/{Popover-48c8394c.js → Popover-1faa77f6.js} +2 -2
  2. package/dist/RPLayout-897cb09d.js +3393 -0
  3. package/dist/assets/RPLayout.css +1 -1
  4. package/dist/{component-2aa6e53b.js → component-1da194e8.js} +1 -1
  5. package/dist/components/RPConfig.js +673 -691
  6. package/dist/components/RPController.js +1 -1
  7. package/dist/components/RPDropFileZone.js +27 -26
  8. package/dist/components/RPPages.js +9 -3
  9. package/dist/components/layout/LayoutContainer.js +9 -3
  10. package/dist/components/layout/RPDefaultLayout.js +1 -1
  11. package/dist/components/layout/RPLayout.js +9 -4
  12. package/dist/components/layout/WrapperLayout.js +8 -7
  13. package/dist/components/layout/sidebar/RPSidebar.js +3 -2
  14. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  15. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  16. package/dist/components/layout/toolbar/DarkModeTool.js +20 -18
  17. package/dist/components/layout/toolbar/DocumentDialog.js +7 -4
  18. package/dist/components/layout/toolbar/DocumentProperties.js +19 -17
  19. package/dist/components/layout/toolbar/FileDownloadTool.js +4 -2
  20. package/dist/components/layout/toolbar/FileUploadTool.js +21 -19
  21. package/dist/components/layout/toolbar/FullScreenTool.js +45 -36
  22. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  23. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  24. package/dist/components/layout/toolbar/MostPageTool.js +10 -4
  25. package/dist/components/layout/toolbar/OtherTool.js +4 -3
  26. package/dist/components/layout/toolbar/Paginate.js +4 -2
  27. package/dist/components/layout/toolbar/PrintTool.js +4 -2
  28. package/dist/components/layout/toolbar/RPToolbar.js +3 -2
  29. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  30. package/dist/components/layout/toolbar/RotateTool.js +27 -25
  31. package/dist/components/layout/toolbar/ScrollModeTool.js +43 -41
  32. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  33. package/dist/components/layout/toolbar/SearchTool.js +10 -4
  34. package/dist/components/layout/toolbar/SelectionModeTool.js +32 -30
  35. package/dist/components/layout/toolbar/ThumbnailTool.js +17 -0
  36. package/dist/components/layout/toolbar/ToolbarCustom.js +9 -3
  37. package/dist/components/layout/toolbar/ViewModeTool.js +33 -24
  38. package/dist/components/layout/toolbar/ZoomTool.js +5 -3
  39. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +9 -13
  40. package/dist/components/layout/toolbar/tools/FileUploadTool.js +10 -14
  41. package/dist/components/layout/toolbar/tools/FullScreenTool.js +13 -17
  42. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  43. package/dist/components/layout/toolbar/tools/NextPageTool.js +10 -4
  44. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  45. package/dist/components/layout/toolbar/tools/PrintTool.js +8 -12
  46. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  47. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +55 -56
  48. package/dist/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.js +16 -0
  49. package/dist/components/layout/toolbar/tools/defaults/TopbarDefaultTools.js +59 -0
  50. package/dist/components/page/AnnotationLayer.js +9 -3
  51. package/dist/components/page/CanvasLayer.js +9 -3
  52. package/dist/components/page/DualPage.js +1 -1
  53. package/dist/components/page/RPPage.js +9 -3
  54. package/dist/components/page/SinglePage.js +1 -1
  55. package/dist/components/page/TextHighlightLayer.js +9 -3
  56. package/dist/components/page/TextLayer.js +9 -3
  57. package/dist/components/ui/Checkbox.js +116 -228
  58. package/dist/components/ui/DropDown.js +1 -1
  59. package/dist/components/ui/LoadingIndicator.js +1 -1
  60. package/dist/components/ui/Popover.js +1 -1
  61. package/dist/components/ui/RPTooltip.js +207 -207
  62. package/dist/contexts/DropFileZoneContext.js +28 -29
  63. package/dist/contexts/ElementPageContext.js +54 -43
  64. package/dist/contexts/IconToolContext.js +13 -0
  65. package/dist/contexts/PaginationContext.js +3 -3
  66. package/dist/contexts/PrintContext.js +1 -1
  67. package/dist/contexts/SearchContext.js +1 -1
  68. package/dist/contexts/ThumbnailsContext.js +1 -1
  69. package/dist/contexts/ToolComponentContext.js +52 -0
  70. package/dist/contexts/ToolbarComponentContext.js +6 -3
  71. package/dist/{floating-ui.react-dom-4b1e2e46.js → floating-ui.react-dom-15b9b819.js} +380 -394
  72. package/dist/index-1cb41342.js +307 -0
  73. package/dist/{index-951f0f1f.js → index-7279fb4e.js} +456 -464
  74. package/dist/index-aa2d3884.js +140 -0
  75. package/dist/main.js +23 -19
  76. package/dist/types/components/layout/toolbar/ThumbnailTool.d.ts +2 -0
  77. package/dist/types/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.d.ts +3 -0
  78. package/dist/types/components/layout/toolbar/tools/defaults/TopbarDefaultTools.d.ts +3 -0
  79. package/dist/types/contexts/IconToolContext.d.ts +9 -0
  80. package/dist/types/contexts/ToolComponentContext.d.ts +12 -0
  81. package/dist/types/main.d.ts +3 -1
  82. package/dist/types/utils/types.d.ts +63 -43
  83. package/dist/utils/hooks/useFileDownload.js +9 -3
  84. package/dist/utils/hooks/useLicense.js +26 -24
  85. package/dist/utils/hooks/usePageRotateContext.js +19 -20
  86. package/dist/utils/hooks/usePaginate.js +9 -3
  87. package/dist/utils/hooks/usePresentPage.js +9 -3
  88. package/dist/utils/hooks/usePrint.js +9 -3
  89. package/dist/utils/hooks/useScrollToPage.js +9 -3
  90. package/dist/utils/hooks/useSearch.js +9 -3
  91. package/dist/utils/hooks/useThumbnail.js +9 -3
  92. package/dist/utils/hooks/useVirtualReactWindow.js +9 -3
  93. package/dist/utils/types.js +6 -6
  94. package/package.json +1 -1
  95. package/dist/RPLayout-3042ec91.js +0 -3349
  96. package/dist/index-6e0e48fa.js +0 -332
  97. package/dist/index-e3a67935.js +0 -150
@@ -1,253 +1,141 @@
1
- import { jsx as i, jsxs as w, Fragment as U } from "react/jsx-runtime";
1
+ import { jsxs as g, jsx as s } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import { c as z, u as B, P as E, a as S, b as G, d as K, e as X } from "../../index-6e0e48fa.js";
4
- import { CheckIcon as J } from "../icons/CheckIcon.js";
5
- import '../../assets/Checkbox.css';function Q(e) {
3
+ import { e as j, a as A, f as B, P as S, c as _, g as H, h as K } from "../../index-1cb41342.js";
4
+ import { CheckIcon as L } from "../icons/CheckIcon.js";
5
+ import '../../assets/Checkbox.css';function q(e) {
6
6
  const r = c.useRef({ value: e, previous: e });
7
7
  return c.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
8
8
  }
9
- var I = "Checkbox", [V, re] = z(I), [W, P] = V(I);
10
- function Y(e) {
11
- const {
12
- __scopeCheckbox: r,
13
- checked: o,
14
- children: d,
15
- defaultChecked: s,
16
- disabled: t,
17
- form: f,
18
- name: h,
19
- onCheckedChange: u,
20
- required: k,
21
- value: C = "on",
22
- // @ts-expect-error
23
- internal_do_not_use_render: l
24
- } = e, [p, v] = X({
25
- prop: o,
26
- defaultProp: s ?? !1,
27
- onChange: u,
28
- caller: I
29
- }), [m, x] = c.useState(null), [_, n] = c.useState(null), a = c.useRef(!1), R = m ? !!f || !!m.closest("form") : (
30
- // We set this to true by default so that events bubble to forms without JS (SSR)
31
- !0
32
- ), g = {
33
- checked: p,
34
- disabled: t,
35
- setChecked: v,
36
- control: m,
37
- setControl: x,
38
- name: h,
39
- form: f,
40
- value: C,
41
- hasConsumerStoppedPropagationRef: a,
42
- required: k,
43
- defaultChecked: b(s) ? !1 : s,
44
- isFormControl: R,
45
- bubbleInput: _,
46
- setBubbleInput: n
47
- };
48
- return /* @__PURE__ */ i(
49
- W,
50
- {
51
- scope: r,
52
- ...g,
53
- children: Z(l) ? l(g) : d
54
- }
55
- );
56
- }
57
- var M = "CheckboxTrigger", T = c.forwardRef(
58
- ({ __scopeCheckbox: e, onKeyDown: r, onClick: o, ...d }, s) => {
59
- const {
60
- control: t,
61
- value: f,
62
- disabled: h,
63
- checked: u,
64
- required: k,
65
- setControl: C,
66
- setChecked: l,
67
- hasConsumerStoppedPropagationRef: p,
68
- isFormControl: v,
69
- bubbleInput: m
70
- } = P(M, e), x = B(s, C), _ = c.useRef(u);
71
- return c.useEffect(() => {
72
- const n = t == null ? void 0 : t.form;
73
- if (n) {
74
- const a = () => l(_.current);
75
- return n.addEventListener("reset", a), () => n.removeEventListener("reset", a);
76
- }
77
- }, [t, l]), /* @__PURE__ */ i(
78
- E.button,
79
- {
80
- type: "button",
81
- role: "checkbox",
82
- "aria-checked": b(u) ? "mixed" : u,
83
- "aria-required": k,
84
- "data-state": O(u),
85
- "data-disabled": h ? "" : void 0,
86
- disabled: h,
87
- value: f,
88
- ...d,
89
- ref: x,
90
- onKeyDown: S(r, (n) => {
91
- n.key === "Enter" && n.preventDefault();
92
- }),
93
- onClick: S(o, (n) => {
94
- l((a) => b(a) ? !0 : !a), m && v && (p.current = n.isPropagationStopped(), p.current || n.stopPropagation());
95
- })
96
- }
97
- );
98
- }
99
- );
100
- T.displayName = M;
101
- var q = c.forwardRef(
9
+ var E = "Checkbox", [z, W] = j(E), [F, T] = z(E), w = c.forwardRef(
102
10
  (e, r) => {
103
11
  const {
104
- __scopeCheckbox: o,
105
- name: d,
106
- checked: s,
107
- defaultChecked: t,
108
- required: f,
109
- disabled: h,
110
- value: u,
111
- onCheckedChange: k,
112
- form: C,
113
- ...l
114
- } = e;
115
- return /* @__PURE__ */ i(
116
- Y,
117
- {
118
- __scopeCheckbox: o,
119
- checked: s,
120
- defaultChecked: t,
121
- disabled: h,
122
- required: f,
123
- onCheckedChange: k,
124
- name: d,
125
- form: C,
126
- value: u,
127
- internal_do_not_use_render: ({ isFormControl: p }) => /* @__PURE__ */ w(U, { children: [
128
- /* @__PURE__ */ i(
129
- T,
130
- {
131
- ...l,
132
- ref: r,
133
- __scopeCheckbox: o
134
- }
135
- ),
136
- p && /* @__PURE__ */ i(
137
- L,
138
- {
139
- __scopeCheckbox: o
140
- }
141
- )
142
- ] })
12
+ __scopeCheckbox: t,
13
+ name: a,
14
+ checked: p,
15
+ defaultChecked: n,
16
+ required: h,
17
+ disabled: u,
18
+ value: b = "on",
19
+ onCheckedChange: m,
20
+ form: l,
21
+ ...x
22
+ } = e, [i, C] = c.useState(null), v = A(r, (o) => C(o)), y = c.useRef(!1), I = i ? l || !!i.closest("form") : !0, [f = !1, P] = B({
23
+ prop: p,
24
+ defaultProp: n,
25
+ onChange: m
26
+ }), O = c.useRef(f);
27
+ return c.useEffect(() => {
28
+ const o = i == null ? void 0 : i.form;
29
+ if (o) {
30
+ const k = () => P(O.current);
31
+ return o.addEventListener("reset", k), () => o.removeEventListener("reset", k);
143
32
  }
144
- );
33
+ }, [i, P]), /* @__PURE__ */ g(F, { scope: t, state: f, disabled: u, children: [
34
+ /* @__PURE__ */ s(
35
+ S.button,
36
+ {
37
+ type: "button",
38
+ role: "checkbox",
39
+ "aria-checked": d(f) ? "mixed" : f,
40
+ "aria-required": h,
41
+ "data-state": M(f),
42
+ "data-disabled": u ? "" : void 0,
43
+ disabled: u,
44
+ value: b,
45
+ ...x,
46
+ ref: v,
47
+ onKeyDown: _(e.onKeyDown, (o) => {
48
+ o.key === "Enter" && o.preventDefault();
49
+ }),
50
+ onClick: _(e.onClick, (o) => {
51
+ P((k) => d(k) ? !0 : !k), I && (y.current = o.isPropagationStopped(), y.current || o.stopPropagation());
52
+ })
53
+ }
54
+ ),
55
+ I && /* @__PURE__ */ s(
56
+ X,
57
+ {
58
+ control: i,
59
+ bubbles: !y.current,
60
+ name: a,
61
+ value: b,
62
+ checked: f,
63
+ required: h,
64
+ disabled: u,
65
+ form: l,
66
+ style: { transform: "translateX(-100%)" },
67
+ defaultChecked: d(n) ? !1 : n
68
+ }
69
+ )
70
+ ] });
145
71
  }
146
72
  );
147
- q.displayName = I;
148
- var A = "CheckboxIndicator", F = c.forwardRef(
73
+ w.displayName = E;
74
+ var N = "CheckboxIndicator", D = c.forwardRef(
149
75
  (e, r) => {
150
- const { __scopeCheckbox: o, forceMount: d, ...s } = e, t = P(A, o);
151
- return /* @__PURE__ */ i(
152
- G,
76
+ const { __scopeCheckbox: t, forceMount: a, ...p } = e, n = T(N, t);
77
+ return /* @__PURE__ */ s(H, { present: a || d(n.state) || n.state === !0, children: /* @__PURE__ */ s(
78
+ S.span,
153
79
  {
154
- present: d || b(t.checked) || t.checked === !0,
155
- children: /* @__PURE__ */ i(
156
- E.span,
157
- {
158
- "data-state": O(t.checked),
159
- "data-disabled": t.disabled ? "" : void 0,
160
- ...s,
161
- ref: r,
162
- style: { pointerEvents: "none", ...e.style }
163
- }
164
- )
80
+ "data-state": M(n.state),
81
+ "data-disabled": n.disabled ? "" : void 0,
82
+ ...p,
83
+ ref: r,
84
+ style: { pointerEvents: "none", ...e.style }
165
85
  }
166
- );
86
+ ) });
167
87
  }
168
88
  );
169
- F.displayName = A;
170
- var D = "CheckboxBubbleInput", L = c.forwardRef(
171
- ({ __scopeCheckbox: e, ...r }, o) => {
172
- const {
173
- control: d,
174
- hasConsumerStoppedPropagationRef: s,
175
- checked: t,
176
- defaultChecked: f,
177
- required: h,
178
- disabled: u,
179
- name: k,
180
- value: C,
181
- form: l,
182
- bubbleInput: p,
183
- setBubbleInput: v
184
- } = P(D, e), m = B(o, v), x = Q(t), _ = K(d);
185
- c.useEffect(() => {
186
- const a = p;
187
- if (!a)
188
- return;
189
- const R = window.HTMLInputElement.prototype, N = Object.getOwnPropertyDescriptor(
190
- R,
191
- "checked"
192
- ).set, j = !s.current;
193
- if (x !== t && N) {
194
- const H = new Event("click", { bubbles: j });
195
- a.indeterminate = b(t), N.call(a, b(t) ? !1 : t), a.dispatchEvent(H);
196
- }
197
- }, [p, x, t, s]);
198
- const n = c.useRef(b(t) ? !1 : t);
199
- return /* @__PURE__ */ i(
200
- E.input,
201
- {
202
- type: "checkbox",
203
- "aria-hidden": !0,
204
- defaultChecked: f ?? n.current,
205
- required: h,
206
- disabled: u,
207
- name: k,
208
- value: C,
209
- form: l,
210
- ...r,
211
- tabIndex: -1,
212
- ref: m,
213
- style: {
214
- ...r.style,
215
- ..._,
216
- position: "absolute",
217
- pointerEvents: "none",
218
- opacity: 0,
219
- margin: 0,
220
- // We transform because the input is absolutely positioned but we have
221
- // rendered it **after** the button. This pulls it back to sit on top
222
- // of the button.
223
- transform: "translateX(-100%)"
224
- }
89
+ D.displayName = N;
90
+ var X = (e) => {
91
+ const { control: r, checked: t, bubbles: a = !0, defaultChecked: p, ...n } = e, h = c.useRef(null), u = q(t), b = K(r);
92
+ c.useEffect(() => {
93
+ const l = h.current, x = window.HTMLInputElement.prototype, C = Object.getOwnPropertyDescriptor(x, "checked").set;
94
+ if (u !== t && C) {
95
+ const v = new Event("click", { bubbles: a });
96
+ l.indeterminate = d(t), C.call(l, d(t) ? !1 : t), l.dispatchEvent(v);
97
+ }
98
+ }, [u, t, a]);
99
+ const m = c.useRef(d(t) ? !1 : t);
100
+ return /* @__PURE__ */ s(
101
+ "input",
102
+ {
103
+ type: "checkbox",
104
+ "aria-hidden": !0,
105
+ defaultChecked: p ?? m.current,
106
+ ...n,
107
+ tabIndex: -1,
108
+ ref: h,
109
+ style: {
110
+ ...e.style,
111
+ ...b,
112
+ position: "absolute",
113
+ pointerEvents: "none",
114
+ opacity: 0,
115
+ margin: 0
225
116
  }
226
- );
227
- }
228
- );
229
- L.displayName = D;
230
- function Z(e) {
231
- return typeof e == "function";
232
- }
233
- function b(e) {
117
+ }
118
+ );
119
+ };
120
+ function d(e) {
234
121
  return e === "indeterminate";
235
122
  }
236
- function O(e) {
237
- return b(e) ? "indeterminate" : e ? "checked" : "unchecked";
123
+ function M(e) {
124
+ return d(e) ? "indeterminate" : e ? "checked" : "unchecked";
238
125
  }
239
- const y = {
126
+ var U = w, G = D;
127
+ const R = {
240
128
  "rp-checkbox": "_rp-checkbox_3f10x_1",
241
129
  "rp-checkbox-indicator": "_rp-checkbox-indicator_3f10x_21"
242
- }, oe = ({
130
+ }, Y = ({
243
131
  children: e,
244
132
  value: r,
245
- name: o,
246
- onChange: d
247
- }) => /* @__PURE__ */ w("div", { style: { display: "flex", alignItems: "center", position: "relative" }, children: [
248
- /* @__PURE__ */ i(q, { className: y["rp-checkbox"], checked: r, id: o, onCheckedChange: d, children: /* @__PURE__ */ i(F, { className: y["rp-checkbox-indicator"], children: /* @__PURE__ */ i(J, {}) }) }),
249
- /* @__PURE__ */ i("label", { className: y["rp-checkbox-label"], htmlFor: o, children: e })
133
+ name: t,
134
+ onChange: a
135
+ }) => /* @__PURE__ */ g("div", { style: { display: "flex", alignItems: "center", position: "relative" }, children: [
136
+ /* @__PURE__ */ s(U, { className: R["rp-checkbox"], checked: r, id: t, onCheckedChange: a, children: /* @__PURE__ */ s(G, { className: R["rp-checkbox-indicator"], children: /* @__PURE__ */ s(L, {}) }) }),
137
+ /* @__PURE__ */ s("label", { className: R["rp-checkbox-label"], htmlFor: t, children: e })
250
138
  ] });
251
139
  export {
252
- oe as UICheckbox
140
+ Y as UICheckbox
253
141
  };
@@ -1,5 +1,5 @@
1
1
  import { jsxs as i, jsx as d } from "react/jsx-runtime";
2
- import { R as l, T as c, P as p, C as _ } from "../../index-951f0f1f.js";
2
+ import { R as l, T as c, P as p, C as _ } from "../../index-7279fb4e.js";
3
3
  import { c as A } from "../../clsx-0c6e471a.js";
4
4
  import '../../assets/DropDown.css';const F = "_slideDownAndFade_1vzkq_1", w = "_slideLeftAndFade_1vzkq_1", m = "_slideUpAndFade_1vzkq_1", f = "_slideRightAndFade_1vzkq_1", g = {
5
5
  "rp-dropdown-content": "_rp-dropdown-content_1vzkq_1",
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { J as i } from "../../RPLayout-3042ec91.js";
2
+ import { K as i } from "../../RPLayout-897cb09d.js";
3
3
  import "../../clsx-0c6e471a.js";
4
4
  import "../../contexts/LocalizationContext.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { U as t } from "../../Popover-48c8394c.js";
2
+ import { U as t } from "../../Popover-1faa77f6.js";
3
3
  import "../../clsx-0c6e471a.js";
4
4
  export {
5
5
  t as UIPopOver