@pdf-viewer/react 1.6.0-beta.4 → 1.6.0-beta.5

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 (70) hide show
  1. package/dist/{RPDefaultLayout-cdc3cad8.js → RPDefaultLayout-eb8d9898.js} +698 -694
  2. package/dist/assets/PasswordModal.css +1 -0
  3. package/dist/assets/RPDefaultLayout.css +1 -1
  4. package/dist/components/RPController.js +1 -1
  5. package/dist/components/RPPages.js +4 -2
  6. package/dist/components/RPProvider.js +13 -12
  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/SearchResultNavigator.js +1 -1
  25. package/dist/components/layout/toolbar/SearchTool.js +3 -2
  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 +2 -2
  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 +13 -14
  37. package/dist/components/ui/DropDown.js +1 -1
  38. package/dist/components/ui/LoadingIndicator.js +1 -1
  39. package/dist/components/ui/PasswordModal.js +58 -0
  40. package/dist/components/ui/RPTooltip.js +331 -689
  41. package/dist/contexts/DocumentPasswordContext.js +40 -0
  42. package/dist/contexts/PaginationContext.js +1 -1
  43. package/dist/contexts/PrintContext.js +1 -1
  44. package/dist/contexts/RPDocumentContext.js +11 -8
  45. package/dist/contexts/SearchContext.js +1 -1
  46. package/dist/contexts/ThumbnailsContext.js +1 -1
  47. package/dist/index-1cb41342.js +307 -0
  48. package/dist/index-7279fb4e.js +1557 -0
  49. package/dist/index-aa2d3884.js +140 -0
  50. package/dist/main.js +1 -1
  51. package/dist/types/components/ui/PasswordModal.d.ts +3 -0
  52. package/dist/types/contexts/DocumentPasswordContext.d.ts +14 -0
  53. package/dist/types/utils/hooks/useLoadPdf.d.ts +2 -0
  54. package/dist/types/utils/types.d.ts +8 -0
  55. package/dist/utils/hooks/useFileDownload.js +3 -2
  56. package/dist/utils/hooks/useLicense.js +1 -1
  57. package/dist/utils/hooks/useLoadPdf.js +52 -40
  58. package/dist/utils/hooks/usePaginate.js +3 -2
  59. package/dist/utils/hooks/usePresentPage.js +3 -2
  60. package/dist/utils/hooks/usePrint.js +3 -2
  61. package/dist/utils/hooks/useScrollToPage.js +3 -2
  62. package/dist/utils/hooks/useSearch.js +3 -2
  63. package/dist/utils/hooks/useThumbnail.js +3 -2
  64. package/dist/utils/hooks/useVirtualReactWindow.js +3 -2
  65. package/dist/utils/types.js +7 -7
  66. package/package.json +1 -1
  67. package/dist/index-2e540713.js +0 -23
  68. package/dist/index-353ec0a6.js +0 -172
  69. package/dist/index-5ff5dbd0.js +0 -1675
  70. package/dist/index-71898eb9.js +0 -139
@@ -1,13 +1,12 @@
1
1
  import { jsxs as g, jsx as s } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import { u as j, P as S, c as _, a as A } from "../../index-353ec0a6.js";
4
- import { c as B, b as H, d as K } from "../../index-71898eb9.js";
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";
5
4
  import { CheckIcon as L } from "../icons/CheckIcon.js";
6
5
  import '../../assets/Checkbox.css';function q(e) {
7
6
  const r = c.useRef({ value: e, previous: e });
8
7
  return c.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
9
8
  }
10
- var E = "Checkbox", [z, Y] = B(E), [F, T] = z(E), w = c.forwardRef(
9
+ var E = "Checkbox", [z, W] = j(E), [F, T] = z(E), w = c.forwardRef(
11
10
  (e, r) => {
12
11
  const {
13
12
  __scopeCheckbox: t,
@@ -17,13 +16,13 @@ var E = "Checkbox", [z, Y] = B(E), [F, T] = z(E), w = c.forwardRef(
17
16
  required: h,
18
17
  disabled: u,
19
18
  value: b = "on",
20
- onCheckedChange: C,
19
+ onCheckedChange: m,
21
20
  form: l,
22
21
  ...x
23
- } = e, [i, m] = c.useState(null), v = j(r, (o) => m(o)), y = c.useRef(!1), I = i ? l || !!i.closest("form") : !0, [f = !1, P] = H({
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({
24
23
  prop: p,
25
24
  defaultProp: n,
26
- onChange: C
25
+ onChange: m
27
26
  }), O = c.useRef(f);
28
27
  return c.useEffect(() => {
29
28
  const o = i == null ? void 0 : i.form;
@@ -75,7 +74,7 @@ w.displayName = E;
75
74
  var N = "CheckboxIndicator", D = c.forwardRef(
76
75
  (e, r) => {
77
76
  const { __scopeCheckbox: t, forceMount: a, ...p } = e, n = T(N, t);
78
- return /* @__PURE__ */ s(A, { present: a || d(n.state) || n.state === !0, children: /* @__PURE__ */ s(
77
+ return /* @__PURE__ */ s(H, { present: a || d(n.state) || n.state === !0, children: /* @__PURE__ */ s(
79
78
  S.span,
80
79
  {
81
80
  "data-state": M(n.state),
@@ -91,19 +90,19 @@ D.displayName = N;
91
90
  var X = (e) => {
92
91
  const { control: r, checked: t, bubbles: a = !0, defaultChecked: p, ...n } = e, h = c.useRef(null), u = q(t), b = K(r);
93
92
  c.useEffect(() => {
94
- const l = h.current, x = window.HTMLInputElement.prototype, m = Object.getOwnPropertyDescriptor(x, "checked").set;
95
- if (u !== t && m) {
93
+ const l = h.current, x = window.HTMLInputElement.prototype, C = Object.getOwnPropertyDescriptor(x, "checked").set;
94
+ if (u !== t && C) {
96
95
  const v = new Event("click", { bubbles: a });
97
- l.indeterminate = d(t), m.call(l, d(t) ? !1 : t), l.dispatchEvent(v);
96
+ l.indeterminate = d(t), C.call(l, d(t) ? !1 : t), l.dispatchEvent(v);
98
97
  }
99
98
  }, [u, t, a]);
100
- const C = c.useRef(d(t) ? !1 : t);
99
+ const m = c.useRef(d(t) ? !1 : t);
101
100
  return /* @__PURE__ */ s(
102
101
  "input",
103
102
  {
104
103
  type: "checkbox",
105
104
  "aria-hidden": !0,
106
- defaultChecked: p ?? C.current,
105
+ defaultChecked: p ?? m.current,
107
106
  ...n,
108
107
  tabIndex: -1,
109
108
  ref: h,
@@ -128,7 +127,7 @@ var U = w, G = D;
128
127
  const R = {
129
128
  "rp-checkbox": "_rp-checkbox_3f10x_1",
130
129
  "rp-checkbox-indicator": "_rp-checkbox-indicator_3f10x_21"
131
- }, Z = ({
130
+ }, Y = ({
132
131
  children: e,
133
132
  value: r,
134
133
  name: t,
@@ -138,5 +137,5 @@ const R = {
138
137
  /* @__PURE__ */ s("label", { className: R["rp-checkbox-label"], htmlFor: t, children: e })
139
138
  ] });
140
139
  export {
141
- Z as UICheckbox
140
+ Y as UICheckbox
142
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-5ff5dbd0.js";
2
+ import { R as l, T as c, P as p, C as _ } from "../../index-7279fb4e.js";
3
3
  import { c as m } from "../../clsx-0c6e471a.js";
4
4
  import '../../assets/DropDown.css';const A = "_slideDownAndFade_d12em_1", F = "_slideLeftAndFade_d12em_1", w = "_slideUpAndFade_d12em_1", f = "_slideRightAndFade_d12em_1", g = {
5
5
  "rp-dropdown-content": "_rp-dropdown-content_d12em_1",
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { L as i } from "../../RPDefaultLayout-cdc3cad8.js";
2
+ import { L as i } from "../../RPDefaultLayout-eb8d9898.js";
3
3
  import "../../clsx-0c6e471a.js";
4
4
  import "../../contexts/LocalizationContext.js";
5
5
  export {
@@ -0,0 +1,58 @@
1
+ import { jsx as p, jsxs as t } from "react/jsx-runtime";
2
+ import { useState as c } from "react";
3
+ import { c as o } from "../../clsx-0c6e471a.js";
4
+ import { useLocalizationContext as u } from "../../contexts/LocalizationContext.js";
5
+ import { useDocumentPasswordContext as _ } from "../../contexts/DocumentPasswordContext.js";
6
+ import '../../assets/PasswordModal.css';const r = {
7
+ "rp-password-overlay": "_rp-password-overlay_pmc5s_1",
8
+ "rp-password-modal": "_rp-password-modal_pmc5s_14",
9
+ "rp-password-title": "_rp-password-title_pmc5s_27",
10
+ "rp-password-content": "_rp-password-content_pmc5s_35",
11
+ "rp-password-form": "_rp-password-form_pmc5s_41",
12
+ "rp-password-input": "_rp-password-input_pmc5s_45",
13
+ "rp-password-input-invalid": "_rp-password-input-invalid_pmc5s_62",
14
+ "rp-password-message-invalid": "_rp-password-message-invalid_pmc5s_66",
15
+ "rp-password-submit-button": "_rp-password-submit-button_pmc5s_71"
16
+ }, C = () => {
17
+ const [a, e] = c(""), { localeMessages: s } = u(), { setPassword: m, invalidPassword: i } = _(), l = (d) => {
18
+ e(d.target.value);
19
+ }, n = (d) => {
20
+ d.preventDefault(), a && a.trim() && m(a);
21
+ }, w = !a.trim();
22
+ return /* @__PURE__ */ p("div", { className: o(r["rp-password-overlay"]), children: /* @__PURE__ */ t("div", { className: o(r["rp-password-modal"]), children: [
23
+ /* @__PURE__ */ p("div", { className: o(r["rp-password-title"]), children: s == null ? void 0 : s.passwordModalTitle }),
24
+ /* @__PURE__ */ p("div", { className: o(r["rp-password-content"]), children: s == null ? void 0 : s.passwordModalMessage }),
25
+ /* @__PURE__ */ t("form", { onSubmit: n, children: [
26
+ /* @__PURE__ */ t("div", { className: o(r["rp-password-form"]), children: [
27
+ /* @__PURE__ */ p(
28
+ "input",
29
+ {
30
+ type: "password",
31
+ value: a,
32
+ onChange: l,
33
+ className: o(
34
+ r["rp-password-input"],
35
+ i && r["rp-password-input-invalid"]
36
+ ),
37
+ placeholder: "Enter password",
38
+ autoComplete: "off"
39
+ }
40
+ ),
41
+ i && /* @__PURE__ */ p("div", { className: o(r["rp-password-message-invalid"]), children: "Incorrect password" })
42
+ ] }),
43
+ /* @__PURE__ */ p(
44
+ "button",
45
+ {
46
+ type: "submit",
47
+ disabled: w,
48
+ className: o(r["rp-password-submit-button"]),
49
+ onClick: n,
50
+ children: s == null ? void 0 : s.passwordConfirmLabel
51
+ }
52
+ )
53
+ ] })
54
+ ] }) });
55
+ };
56
+ export {
57
+ C as default
58
+ };