🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@react-pdf-kit/viewer

Package Overview
Dependencies
Maintainers
3
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf-kit/viewer - npm Package Compare versions

Comparing version
2.7.0-beta.1
to
2.7.0-beta.2
+119
-116
dist/components/layout/toolbar/SearchTool.js

@@ -6,40 +6,42 @@ import { useDocumentContext as e } from "../../../contexts/RPDocumentContext.js";

import { useSearchContext as i } from "../../../contexts/SearchContext.js";
import { useLocalizationContext as a } from "../../../contexts/LocalizationContext.js";
import { t as ee } from "../../../LoaderIcon-D9YjinGf.js";
import { useIconToolContext as o } from "../../../contexts/IconToolContext.js";
import { t as s } from "../../../Button-jStpvb3T.js";
import { t as c } from "../../../Input-Bb_-ljl1.js";
import { useIconContext as l } from "../../../contexts/IconContext.js";
import { useViewportContext as te } from "../../../contexts/ViewportContext.js";
import { t as u } from "../../../RPTooltip-ZZoFqP7C.js";
import { t as d } from "../../../DropDown-DikL-krI.js";
import { InfoIcon as f } from "../../icons/InfoIcon.js";
import { SearchIcon as p } from "../../icons/SearchIcon.js";
import { t as m } from "../../../SearchTool.module-DUkVXfOn.js";
import { t as h } from "../../../Checkbox-Brta-YKG.js";
import { ClearIcon as g } from "../../icons/ClearIcon.js";
import { SearchResultNavigator as _ } from "./SearchResultNavigator.js";
import { SearchCloseButton as v } from "./SearchCloseButton.js";
import { useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
import { useLocalizationContext as ee } from "../../../contexts/LocalizationContext.js";
import { t as te } from "../../../LoaderIcon-D9YjinGf.js";
import { useIconToolContext as a } from "../../../contexts/IconToolContext.js";
import { t as o } from "../../../Button-jStpvb3T.js";
import { t as s } from "../../../Input-Bb_-ljl1.js";
import { useIconContext as c } from "../../../contexts/IconContext.js";
import { useViewportContext as ne } from "../../../contexts/ViewportContext.js";
import { t as l } from "../../../RPTooltip-ZZoFqP7C.js";
import { t as re } from "../../../DropDown-DikL-krI.js";
import { InfoIcon as u } from "../../icons/InfoIcon.js";
import { SearchIcon as d } from "../../icons/SearchIcon.js";
import { t as f } from "../../../SearchTool.module-DUkVXfOn.js";
import { t as p } from "../../../Checkbox-Brta-YKG.js";
import { ClearIcon as m } from "../../icons/ClearIcon.js";
import { SearchResultNavigator as h } from "./SearchResultNavigator.js";
import { SearchCloseButton as g } from "./SearchCloseButton.js";
import { useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
//#region lib/components/layout/toolbar/SearchTool.tsx
var ne = () => {
let { searchIcon: e } = l(), { searchIcon: t } = o();
return e ?? t ?? /* @__PURE__ */ T(p, {});
}, D = () => {
let { searchClearIcon: e } = l(), { searchClearIcon: t } = o();
return e ?? t ?? /* @__PURE__ */ T(g, {});
}, O = ({ icon: o }) => {
let { container: l } = t(), [g, O] = C(!1), k = S(g);
k.current = g;
let { pdf: A } = e(), [j, re] = C(null), { searchOptions: M, setSearchOptions: N, loading: ie, setSearch: P, totalMatches: F, currentMatchPosition: I, nextMatch: L, prevMatch: R, search: z } = i(), { searchTool: B = !0 } = n(), { searchTool: V = !0 } = r(), [H, U] = C(z), { localeMessages: W } = a(), { isSmallScreen: G } = te(), [K, q] = C(null), [J, ae] = C(!1), oe = y(() => {
k.current && (P(""), U("")), O((e) => !e);
}, [P]), Y = y(() => {
P(""), U(""), O(!1);
}, [P]), X = (e) => {
var ie = () => {
let { searchIcon: e } = c(), { searchIcon: t } = a();
return e ?? t ?? /* @__PURE__ */ C(d, {});
}, ae = () => {
let { searchClearIcon: e } = c(), { searchClearIcon: t } = a();
return e ?? t ?? /* @__PURE__ */ C(m, {});
}, T = ({ icon: a }) => {
let { container: c } = t(), [m, T] = x(!1), E = b(null), D = b(m);
D.current = m;
let { pdf: O } = e(), [k, A] = x(null), { searchOptions: j, setSearchOptions: M, loading: N, setSearch: P, totalMatches: F, currentMatchPosition: I, nextMatch: L, prevMatch: R, search: z } = i(), { searchTool: B = !0 } = n(), { searchTool: V = !0 } = r(), [H, U] = x(z), { localeMessages: W } = ee(), { isSmallScreen: G } = ne(), [K, q] = x(null), [oe, se] = x(!1), ce = _(() => {
D.current && (P(""), U("")), T((e) => !e);
}, [P]), J = _(() => {
P(""), U(""), T(!1), requestAnimationFrame(() => {
E.current?.focus();
});
}, [P]), Y = (e) => {
let t = e.key === "Enter", n = e.key === " ";
(t || n) && Y();
}, Z = y((e) => {
e.key === "Escape" && g && Y();
}, [g]), se = y((e) => {
(t || n) && J();
}, X = _((e) => {
e.key === "Escape" && m && J();
}, [m]), Z = _((e) => {
e.shiftKey && e.key === "Enter" ? R() : e.key === "Enter" && z !== H ? P(H) : e.key === "Enter" && L();

@@ -53,34 +55,34 @@ }, [

]);
b(() => {
v(() => {
U(z);
}, [z]), b(() => {
z && A && ae(!0);
}, [z, A]), b(() => {
}, [z]), v(() => {
z && O && se(!0);
}, [z, O]), v(() => {
z && z.trim() !== "" && (U(z), P(z));
}, []), b(() => (window.addEventListener("keydown", Z), () => {
window.removeEventListener("keydown", Z);
}), [Z]), b(() => {
j && setTimeout(() => {
j.focus();
}, []), v(() => (window.addEventListener("keydown", X), () => {
window.removeEventListener("keydown", X);
}), [X]), v(() => {
k && setTimeout(() => {
k.focus();
}, 0);
}, [j]);
let ce = y((e) => {
}, [k]);
let le = _((e) => {
U(e.target.value);
}, []), Q = y(() => {
}, []), Q = _(() => {
U(""), P("");
}, [P]), le = x(() => `${I} / ${F}`, [I, F]), { wholeWords: ue, matchCase: de } = x(() => M, [M]), fe = y((e) => {
N((t) => ({
}, [P]), ue = y(() => `${I} / ${F}`, [I, F]), { wholeWords: de, matchCase: fe } = y(() => j, [j]), pe = _((e) => {
M((t) => ({
...t,
matchCase: e
}));
}, [N]), pe = y((e) => {
N((t) => ({
}, [M]), me = _((e) => {
M((t) => ({
...t,
wholeWords: e
}));
}, [N]);
b(() => {
A && J && Y();
}, [A, Y]);
let $ = x(() => K?.querySelectorAll("[tabindex]:not([tabindex=\"-1\"])") || [], [K]), me = y((e) => {
}, [M]);
v(() => {
O && oe && J();
}, [O, J]);
let $ = y(() => K?.querySelectorAll("[tabindex]:not([tabindex=\"-1\"])") || [], [K]), he = _((e) => {
if (e.key === "Tab") {

@@ -104,5 +106,5 @@ let t = document.activeElement, n = -1;

}, [$]);
return !B || !V ? null : /* @__PURE__ */ T(w, { children: /* @__PURE__ */ T(d, {
open: g,
container: l,
return !B || !V ? null : /* @__PURE__ */ C(S, { children: /* @__PURE__ */ C(re, {
open: m,
container: c,
side: "bottom",

@@ -112,35 +114,36 @@ align: "start",

avoidCollisions: !1,
triggerComponent: /* @__PURE__ */ T(u, {
triggerComponent: /* @__PURE__ */ C(l, {
content: W?.searchButtonTooltip,
children: /* @__PURE__ */ T(s, {
active: g,
onClick: oe,
children: /* @__PURE__ */ C(o, {
ref: E,
active: m,
onClick: ce,
"aria-label": W?.searchButtonTooltip,
"aria-expanded": g,
"aria-expanded": m,
"aria-haspopup": "dialog",
children: o || /* @__PURE__ */ T(ne, {})
children: a || /* @__PURE__ */ C(ie, {})
})
}),
children: /* @__PURE__ */ E("div", {
children: /* @__PURE__ */ w("div", {
ref: q,
className: m["rp-search-tool-content"],
className: f["rp-search-tool-content"],
tabIndex: -1,
onKeyDown: me,
onKeyDown: he,
role: "dialog",
"aria-label": W?.searchInputTooltip || "Search dialog",
children: [/* @__PURE__ */ E("div", {
className: m["rp-search-tool-input-wrapper"],
children: [/* @__PURE__ */ E("div", {
className: m["rp-search-tool-input"],
children: [/* @__PURE__ */ w("div", {
className: f["rp-search-tool-input-wrapper"],
children: [/* @__PURE__ */ w("div", {
className: f["rp-search-tool-input"],
children: [
/* @__PURE__ */ T(u, {
/* @__PURE__ */ C(l, {
content: W?.searchInputTooltip,
children: /* @__PURE__ */ T(c, {
children: /* @__PURE__ */ C(s, {
value: H,
onKeyDown: se,
onChange: ce,
icon: /* @__PURE__ */ T(p, {}),
onKeyDown: Z,
onChange: le,
icon: /* @__PURE__ */ C(d, {}),
placeholder: W?.searchInputPlaceholder,
className: m["rp-search-input"],
ref: re,
className: f["rp-search-input"],
ref: A,
id: "search-input",

@@ -151,4 +154,4 @@ name: "search-input",

"aria-describedby": "search-results-count",
children: !!H && /* @__PURE__ */ T("span", {
className: m["rp-search-tool-input-clear"],
children: !!H && /* @__PURE__ */ C("span", {
className: f["rp-search-tool-input-clear"],
onClick: Q,

@@ -161,60 +164,60 @@ role: "button",

},
children: /* @__PURE__ */ T(D, {})
children: /* @__PURE__ */ C(ae, {})
})
})
}),
ie ? /* @__PURE__ */ T("span", {
N ? /* @__PURE__ */ C("span", {
"aria-live": "polite",
"aria-label": "Searching",
children: /* @__PURE__ */ T(ee, {
className: m["rp-search-loader-icon"],
children: /* @__PURE__ */ C(te, {
className: f["rp-search-loader-icon"],
"aria-hidden": "true"
})
}) : /* @__PURE__ */ T("span", {
}) : /* @__PURE__ */ C("span", {
id: "search-results-count",
"aria-live": "polite",
children: le
children: ue
}),
G && /* @__PURE__ */ T("div", {
className: m["rp-search-tool-controls"],
children: /* @__PURE__ */ T(v, {
onKeyPress: X,
handleClose: Y
G && /* @__PURE__ */ C("div", {
className: f["rp-search-tool-controls"],
children: /* @__PURE__ */ C(g, {
onKeyPress: Y,
handleClose: J
})
})
]
}), /* @__PURE__ */ E("div", {
className: m["rp-search-tool-input-checkboxes"],
}), /* @__PURE__ */ w("div", {
className: f["rp-search-tool-input-checkboxes"],
children: [
G && /* @__PURE__ */ T(_, {}),
/* @__PURE__ */ T(h, {
G && /* @__PURE__ */ C(h, {}),
/* @__PURE__ */ C(p, {
tabIndex: 0,
name: "matchCase",
value: de,
onChange: fe,
value: fe,
onChange: pe,
"aria-label": W?.searchMatchCaseLabel,
children: W?.searchMatchCaseLabel
}),
!G && /* @__PURE__ */ T(u, {
!G && /* @__PURE__ */ C(l, {
content: W?.searchMatchCaseTooltip,
children: /* @__PURE__ */ T("div", {
className: m["rp-search-icon-info"],
children: /* @__PURE__ */ C("div", {
className: f["rp-search-icon-info"],
tabIndex: 0,
children: /* @__PURE__ */ T(f, {})
children: /* @__PURE__ */ C(u, {})
})
}),
/* @__PURE__ */ T(h, {
/* @__PURE__ */ C(p, {
tabIndex: 0,
name: "wholeWord",
value: ue,
onChange: pe,
value: de,
onChange: me,
"aria-label": W?.searchWholeWordsLabel,
children: W?.searchWholeWordsLabel
}),
!G && /* @__PURE__ */ T(u, {
!G && /* @__PURE__ */ C(l, {
content: W?.searchWholeWordsTooltip,
children: /* @__PURE__ */ T("div", {
children: /* @__PURE__ */ C("div", {
tabIndex: 0,
className: m["rp-search-icon-info"],
children: /* @__PURE__ */ T(f, {})
className: f["rp-search-icon-info"],
children: /* @__PURE__ */ C(u, {})
})

@@ -224,7 +227,7 @@ })

})]
}), !G && /* @__PURE__ */ E("div", {
className: m["rp-search-tool-controls"],
children: [/* @__PURE__ */ T(_, {}), /* @__PURE__ */ T(v, {
onKeyPress: X,
handleClose: Y
}), !G && /* @__PURE__ */ w("div", {
className: f["rp-search-tool-controls"],
children: [/* @__PURE__ */ C(h, {}), /* @__PURE__ */ C(g, {
onKeyPress: Y,
handleClose: J
})]

@@ -236,2 +239,2 @@ })]

//#endregion
export { O as SearchTool };
export { T as SearchTool };

@@ -6,3 +6,3 @@ import { n as e } from "../../chunk-C_CI6nMA.js";

//#region lib/utils/hooks/useLicense.ts
var o = /* @__PURE__ */ new Date("2026-05-19T08:23:42.669Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
var o = /* @__PURE__ */ new Date("2026-05-20T03:23:27.973Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
invalidLicense: `You are currently using without a valid license. ${c}`,

@@ -9,0 +9,0 @@ mismatchedDomain: `Your license key is not valid for the current domain / IP. ${c}`,

{
"name": "@react-pdf-kit/viewer",
"version": "2.7.0-beta.1",
"version": "2.7.0-beta.2",
"private": false,

@@ -5,0 +5,0 @@ "description": "A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.",