UNPKG

@pdf-viewer/react

Version:

A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.

34 lines (33 loc) 2.22 kB
import { jsx as e, Fragment as f, jsxs as r } from "react/jsx-runtime"; import { G as s } from "../../../index-951f0f1f.js"; import { MenuSeparator as h } from "./MenuSeparator.js"; import { MenuItem as i } from "./MenuItem.js"; import { DualPageIcon as P } from "../../icons/SinglePageIcon.js"; import { SinglePageIcon as g } from "../../icons/DualPageIcon.js"; import { useViewModeContext as C } from "../../../contexts/ViewModeContext.js"; import { ScrollMode as I, ViewMode as m } from "../../../utils/types.js"; import { CheckIcon as l } from "../../icons/CheckIcon.js"; import { useToolbarComponentContext as N } from "../../../contexts/ToolbarComponentContext.js"; import { useScrollModeContext as L } from "../../../contexts/ScrollModeContext.js"; import { useMemo as S } from "react"; import { useLocalizationContext as x } from "../../../contexts/LocalizationContext.js"; import c from "../../ui/RPTooltip.js"; const T = () => /* @__PURE__ */ e(g, {}), G = () => /* @__PURE__ */ e(P, {}), F = () => { const { viewMode: t, setDualPage: u, setSinglePage: p } = C(), { viewModeTool: d } = N(), { scrollMode: n } = L(), { localeMessages: o } = x(), a = S(() => [I.HORIZONTAL_SCROLLING].includes(n), [n]); return d ? /* @__PURE__ */ e(f, { children: /* @__PURE__ */ r(s, { children: [ /* @__PURE__ */ e(i, { onClick: p, children: /* @__PURE__ */ r(c, { className: "rp-menu-item", content: o == null ? void 0 : o.singlePageTooltip, children: [ /* @__PURE__ */ e("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ e(T, {}) }), o == null ? void 0 : o.singlePageLabel, t === m.SINGLE_PAGE ? /* @__PURE__ */ e(l, { className: "rp-menu-item-right" }) : null ] }) }), /* @__PURE__ */ e(i, { disabled: a, onClick: u, children: /* @__PURE__ */ r(c, { className: "rp-menu-item", content: o == null ? void 0 : o.dualPageTooltip, children: [ /* @__PURE__ */ e("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ e(G, {}) }), o == null ? void 0 : o.dualPageLabel, t === m.DUAL_PAGE ? /* @__PURE__ */ e(l, { className: "rp-menu-item-right" }) : null ] }) }), /* @__PURE__ */ e(h, {}) ] }) }) : null; }; export { F as ViewModeTool };