@pdf-viewer/react 1.9.0-beta.1 → 1.9.0-beta.2

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 (93) hide show
  1. package/dist/{Popover-48c8394c.js → Popover-1faa77f6.js} +2 -2
  2. package/dist/RPLayout-81cd4970.js +3393 -0
  3. package/dist/{component-2aa6e53b.js → component-1da194e8.js} +1 -1
  4. package/dist/components/RPConfig.js +673 -691
  5. package/dist/components/RPController.js +1 -1
  6. package/dist/components/RPDropFileZone.js +27 -26
  7. package/dist/components/RPPages.js +9 -3
  8. package/dist/components/layout/LayoutContainer.js +9 -3
  9. package/dist/components/layout/RPDefaultLayout.js +1 -1
  10. package/dist/components/layout/RPLayout.js +9 -4
  11. package/dist/components/layout/WrapperLayout.js +8 -7
  12. package/dist/components/layout/sidebar/RPSidebar.js +3 -2
  13. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  14. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  15. package/dist/components/layout/toolbar/DarkModeTool.js +20 -18
  16. package/dist/components/layout/toolbar/DocumentDialog.js +7 -4
  17. package/dist/components/layout/toolbar/DocumentProperties.js +19 -17
  18. package/dist/components/layout/toolbar/FileDownloadTool.js +4 -2
  19. package/dist/components/layout/toolbar/FileUploadTool.js +21 -19
  20. package/dist/components/layout/toolbar/FullScreenTool.js +45 -36
  21. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  22. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  23. package/dist/components/layout/toolbar/MostPageTool.js +10 -4
  24. package/dist/components/layout/toolbar/OtherTool.js +4 -3
  25. package/dist/components/layout/toolbar/Paginate.js +4 -2
  26. package/dist/components/layout/toolbar/PrintTool.js +4 -2
  27. package/dist/components/layout/toolbar/RPToolbar.js +3 -2
  28. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  29. package/dist/components/layout/toolbar/RotateTool.js +27 -25
  30. package/dist/components/layout/toolbar/ScrollModeTool.js +43 -41
  31. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  32. package/dist/components/layout/toolbar/SearchTool.js +10 -4
  33. package/dist/components/layout/toolbar/SelectionModeTool.js +32 -30
  34. package/dist/components/layout/toolbar/ThumbnailTool.js +17 -0
  35. package/dist/components/layout/toolbar/ToolbarCustom.js +9 -3
  36. package/dist/components/layout/toolbar/ViewModeTool.js +33 -24
  37. package/dist/components/layout/toolbar/ZoomTool.js +5 -3
  38. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +9 -13
  39. package/dist/components/layout/toolbar/tools/FileUploadTool.js +10 -14
  40. package/dist/components/layout/toolbar/tools/FullScreenTool.js +13 -17
  41. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  42. package/dist/components/layout/toolbar/tools/NextPageTool.js +10 -4
  43. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  44. package/dist/components/layout/toolbar/tools/PrintTool.js +8 -12
  45. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  46. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +55 -56
  47. package/dist/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.js +16 -0
  48. package/dist/components/layout/toolbar/tools/defaults/TopbarDefaultTools.js +59 -0
  49. package/dist/components/page/AnnotationLayer.js +9 -3
  50. package/dist/components/page/CanvasLayer.js +9 -3
  51. package/dist/components/page/DualPage.js +1 -1
  52. package/dist/components/page/RPPage.js +9 -3
  53. package/dist/components/page/SinglePage.js +1 -1
  54. package/dist/components/page/TextHighlightLayer.js +9 -3
  55. package/dist/components/page/TextLayer.js +9 -3
  56. package/dist/components/ui/Checkbox.js +116 -228
  57. package/dist/components/ui/DropDown.js +1 -1
  58. package/dist/components/ui/LoadingIndicator.js +1 -1
  59. package/dist/components/ui/Popover.js +1 -1
  60. package/dist/components/ui/RPTooltip.js +207 -207
  61. package/dist/contexts/DropFileZoneContext.js +28 -29
  62. package/dist/contexts/IconToolContext.js +13 -0
  63. package/dist/contexts/PaginationContext.js +3 -3
  64. package/dist/contexts/PrintContext.js +1 -1
  65. package/dist/contexts/SearchContext.js +1 -1
  66. package/dist/contexts/ThumbnailsContext.js +1 -1
  67. package/dist/contexts/ToolComponentContext.js +52 -0
  68. package/dist/contexts/ToolbarComponentContext.js +6 -3
  69. package/dist/{floating-ui.react-dom-4b1e2e46.js → floating-ui.react-dom-15b9b819.js} +380 -394
  70. package/dist/index-1cb41342.js +307 -0
  71. package/dist/{index-951f0f1f.js → index-7279fb4e.js} +456 -464
  72. package/dist/index-aa2d3884.js +140 -0
  73. package/dist/main.js +23 -19
  74. package/dist/types/components/layout/toolbar/ThumbnailTool.d.ts +2 -0
  75. package/dist/types/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.d.ts +3 -0
  76. package/dist/types/components/layout/toolbar/tools/defaults/TopbarDefaultTools.d.ts +3 -0
  77. package/dist/types/contexts/IconToolContext.d.ts +9 -0
  78. package/dist/types/contexts/ToolComponentContext.d.ts +12 -0
  79. package/dist/types/main.d.ts +3 -1
  80. package/dist/types/utils/types.d.ts +60 -42
  81. package/dist/utils/hooks/useFileDownload.js +9 -3
  82. package/dist/utils/hooks/useLicense.js +1 -1
  83. package/dist/utils/hooks/usePaginate.js +9 -3
  84. package/dist/utils/hooks/usePresentPage.js +9 -3
  85. package/dist/utils/hooks/usePrint.js +9 -3
  86. package/dist/utils/hooks/useScrollToPage.js +9 -3
  87. package/dist/utils/hooks/useSearch.js +9 -3
  88. package/dist/utils/hooks/useThumbnail.js +9 -3
  89. package/dist/utils/hooks/useVirtualReactWindow.js +9 -3
  90. package/package.json +1 -1
  91. package/dist/RPLayout-3042ec91.js +0 -3349
  92. package/dist/index-6e0e48fa.js +0 -332
  93. package/dist/index-e3a67935.js +0 -150
@@ -1,9 +1,10 @@
1
- import { jsx as D } from "react/jsx-runtime";
2
- import { createContext as x, useContext as C, useState as P, useCallback as r } from "react";
1
+ import { jsx as C } from "react/jsx-runtime";
2
+ import { createContext as x, useContext as P, useState as F, useCallback as r } from "react";
3
3
  import { useDocumentContext as h } from "./RPDocumentContext.js";
4
- import { useToolbarComponentContext as F } from "./ToolbarComponentContext.js";
4
+ import { useToolbarComponentContext as T } from "./ToolbarComponentContext.js";
5
5
  import { useDocumentPasswordContext as v } from "./DocumentPasswordContext.js";
6
- const p = x({
6
+ import { useToolComponentContext as L } from "./ToolComponentContext.js";
7
+ const i = x({
7
8
  dragging: !1,
8
9
  handleDragLeave: () => {
9
10
  },
@@ -11,43 +12,41 @@ const p = x({
11
12
  },
12
13
  handleDrop: () => {
13
14
  }
14
- }), w = () => C(p), E = ({ children: i }) => {
15
- const [c, o] = P(!1), { setFilename: n, setPdfSrc: a } = h(), { openFileTool: s } = F(), {
16
- setPassword: f
17
- } = v(), u = r(
15
+ }), R = () => P(i), S = ({ children: c }) => {
16
+ const [f, t] = F(!1), { setFilename: n, setPdfSrc: a } = h(), { openFileTool: s } = T(), { openFileTool: l } = L(), { setPassword: u } = v(), m = r(
18
17
  (e) => {
19
- var l;
20
- e.preventDefault(), e.stopPropagation(), o(!1);
21
- const t = (l = e.dataTransfer) == null ? void 0 : l.files[0];
22
- if (!t || t.type !== "application/pdf")
18
+ var p;
19
+ e.preventDefault(), e.stopPropagation(), t(!1);
20
+ const o = (p = e.dataTransfer) == null ? void 0 : p.files[0];
21
+ if (!o || o.type !== "application/pdf")
23
22
  return;
24
- const m = URL.createObjectURL(t);
25
- n(t.name), a(m), f("");
23
+ const D = URL.createObjectURL(o);
24
+ n(o.name), a(D), u("");
26
25
  },
27
26
  [n, a]
28
- ), g = r(
27
+ ), d = r(
29
28
  (e) => {
30
- e.preventDefault(), e.stopPropagation(), s && o(!0);
29
+ e.preventDefault(), e.stopPropagation(), !(!s || !l) && t(!0);
31
30
  },
32
- [s]
33
- ), d = r((e) => {
34
- e.preventDefault(), e.stopPropagation(), o(!1);
31
+ [s, l]
32
+ ), g = r((e) => {
33
+ e.preventDefault(), e.stopPropagation(), t(!1);
35
34
  }, []);
36
- return /* @__PURE__ */ D(
37
- p.Provider,
35
+ return /* @__PURE__ */ C(
36
+ i.Provider,
38
37
  {
39
38
  value: {
40
- dragging: c,
41
- handleDragLeave: d,
42
- handleDragEnter: g,
43
- handleDrop: u
39
+ dragging: f,
40
+ handleDragLeave: g,
41
+ handleDragEnter: d,
42
+ handleDrop: m
44
43
  },
45
- children: i
44
+ children: c
46
45
  }
47
46
  );
48
47
  };
49
48
  export {
50
- p as DropFileZoneContext,
51
- E as DropFileZoneProvider,
52
- w as useDropFileZoneContext
49
+ i as DropFileZoneContext,
50
+ S as DropFileZoneProvider,
51
+ R as useDropFileZoneContext
53
52
  };
@@ -0,0 +1,13 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createContext as s, useContext as c, useState as i } from "react";
3
+ const u = () => {
4
+ throw new Error("setIcons is not initialized yet");
5
+ }, o = s({ setIcons: u }), x = () => c(o), a = ({ children: t }) => {
6
+ const [e, n] = i({});
7
+ return /* @__PURE__ */ r(o.Provider, { value: { ...e, setIcons: n }, children: t });
8
+ };
9
+ export {
10
+ o as IconToolContext,
11
+ a as IconToolProvider,
12
+ x as useIconToolContext
13
+ };
@@ -1,10 +1,10 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { m, P as e, u as p } from "../RPLayout-3042ec91.js";
3
+ import { p, P as e, u as m } from "../RPLayout-81cd4970.js";
4
4
  import "./RPDocumentContext.js";
5
5
  import "../utils/appConsole.js";
6
6
  export {
7
- m as PaginationContext,
7
+ p as PaginationContext,
8
8
  e as PaginationProvider,
9
- p as usePaginationContext
9
+ m as usePaginationContext
10
10
  };
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { o as e, g as n, d as s } from "../RPLayout-3042ec91.js";
3
+ import { r as e, g as n, d as s } from "../RPLayout-81cd4970.js";
4
4
  export {
5
5
  e as PrintContext,
6
6
  n as PrintProvider,
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { s as a, f as s, e as c } from "../RPLayout-3042ec91.js";
3
+ import { w as a, f as s, e as c } from "../RPLayout-81cd4970.js";
4
4
  export {
5
5
  a as SearchContext,
6
6
  s as SearchProvider,
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { q as m, T as r, h as e } from "../RPLayout-3042ec91.js";
3
+ import { t as m, T as r, h as e } from "../RPLayout-81cd4970.js";
4
4
  export {
5
5
  m as ThumbnailContext,
6
6
  r as ThumbnailProvider,
@@ -0,0 +1,52 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { createContext as u, useContext as n, useState as s } from "react";
3
+ const i = () => {
4
+ throw new Error("setSlots is not initialized yet");
5
+ }, o = u({
6
+ themeSwitcher: !0,
7
+ documentProperties: !0,
8
+ rotateTool: !0,
9
+ fullscreenTool: !0,
10
+ openFileTool: !0,
11
+ dropFileZone: !0,
12
+ downloadTool: !0,
13
+ viewModeTool: !0,
14
+ scrollModeTool: !0,
15
+ printTool: !0,
16
+ thumbnailTool: !0,
17
+ showPrintProgress: !0,
18
+ selectionModeTool: !0,
19
+ jumpNavigationTool: !0,
20
+ sidebarEnable: !0,
21
+ pageNavigationTool: !0,
22
+ searchTool: !0,
23
+ zoomTool: !0,
24
+ setSlots: i
25
+ }), c = () => n(o), T = {
26
+ themeSwitcher: !0,
27
+ documentProperties: !0,
28
+ rotateTool: !0,
29
+ fullscreenTool: !0,
30
+ openFileTool: !0,
31
+ dropFileZone: !0,
32
+ downloadTool: !0,
33
+ viewModeTool: !0,
34
+ scrollModeTool: !0,
35
+ printTool: !0,
36
+ thumbnailTool: !0,
37
+ showPrintProgress: !0,
38
+ selectionModeTool: !0,
39
+ jumpNavigationTool: !0,
40
+ sidebarEnable: !0,
41
+ pageNavigationTool: !0,
42
+ searchTool: !0,
43
+ zoomTool: !0
44
+ }, p = ({ children: e }) => {
45
+ const [t, r] = s(T);
46
+ return /* @__PURE__ */ l(o.Provider, { value: { ...t, setSlots: r }, children: e });
47
+ };
48
+ export {
49
+ o as ToolComponentContext,
50
+ p as ToolComponentProvider,
51
+ c as useToolComponentContext
52
+ };
@@ -15,7 +15,7 @@ const e = l({
15
15
  selectionModeTool: !0,
16
16
  jumpNavigationTool: !0,
17
17
  sidebarEnable: !0
18
- }), d = () => n(e), s = {
18
+ }), d = () => n(e), T = {
19
19
  themeSwitcher: !0,
20
20
  documentProperties: !0,
21
21
  rotateTool: !0,
@@ -30,10 +30,13 @@ const e = l({
30
30
  showPrintProgress: !0,
31
31
  selectionModeTool: !0,
32
32
  jumpNavigationTool: !0,
33
- sidebarEnable: !0
33
+ sidebarEnable: !0,
34
+ pageNavigationTool: !0,
35
+ searchTool: !0,
36
+ zoomTool: !0
34
37
  }, c = ({ children: r, slots: o }) => {
35
38
  const t = i(() => ({
36
- ...s,
39
+ ...T,
37
40
  ...o
38
41
  }), [o]);
39
42
  return /* @__PURE__ */ u(e.Provider, { value: t, children: r });