UNPKG

@pdf-viewer/react

Version:

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

57 lines (56 loc) 3.44 kB
import { jsx as r, Fragment as f, jsxs as c } from "react/jsx-runtime"; import { G as C } from "../../../index-f4a9ae4d.js"; import { MenuItem as m } from "./MenuItem.js"; import { useToolbarComponentContext as L } from "../../../contexts/ToolbarComponentContext.js"; import { PageScrollingIcon as h } from "../../icons/PageScrollingIcon.js"; import { VerticalScrollingIcon as T } from "../../icons/VerticalScrollingIcon.js"; import { HorizontalScrollingIcon as s } from "../../icons/HorizontalScrollingIcon.js"; import { useScrollModeContext as N } from "../../../contexts/ScrollModeContext.js"; import { ViewMode as G, ScrollMode as l } from "../../../utils/types.js"; import { CheckIcon as p } from "../../icons/CheckIcon.js"; import { useViewModeContext as O } from "../../../contexts/ViewModeContext.js"; import { useMemo as R } from "react"; import { useIconContext as d } from "../../../contexts/IconContext.js"; import u from "../../ui/RPTooltip.js"; import { useLocalizationContext as x } from "../../../contexts/LocalizationContext.js"; import { useIconToolContext as I } from "../../../contexts/IconToolContext.js"; import { useToolComponentContext as v } from "../../../contexts/ToolComponentContext.js"; const z = () => { const { pageScrollIcon: n } = d(), { pageScrollIcon: t } = I(); return n || t || /* @__PURE__ */ r(h, {}); }, A = () => { const { verticalScrollIcon: n } = d(), { verticalScrollIcon: t } = I(); return n || t || /* @__PURE__ */ r(T, {}); }, g = () => { const { horizontalScrollIcon: n } = d(), { horizontalScrollIcon: t } = I(); return n || t || /* @__PURE__ */ r(s, {}); }, J = () => { const { scrollModeTool: n = !0 } = L(), { scrollModeTool: t = !0 } = v(), { viewMode: S } = O(), { scrollMode: i, setScrollMode: e } = N(), { localeMessages: o } = x(), a = R(() => S === G.DUAL_PAGE, [S]); return !n || !t ? null : /* @__PURE__ */ r(f, { children: /* @__PURE__ */ c(C, { children: [ /* @__PURE__ */ r(m, { onClick: () => e(l.PAGE_SCROLLING), children: /* @__PURE__ */ c(u, { className: "rp-menu-item", content: o == null ? void 0 : o.pageScrollingTooltip, children: [ /* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ r(z, {}) }), o == null ? void 0 : o.pageScrollingLabel, i === l.PAGE_SCROLLING ? /* @__PURE__ */ r(p, { className: "rp-menu-item-right" }) : null ] }) }), /* @__PURE__ */ r(m, { onClick: () => e(l.VERTICAL_SCROLLING), children: /* @__PURE__ */ c(u, { className: "rp-menu-item", content: o == null ? void 0 : o.verticalScrollingTooltip, children: [ /* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ r(A, {}) }), o == null ? void 0 : o.verticalScrollingLabel, i === l.VERTICAL_SCROLLING ? /* @__PURE__ */ r(p, { className: "rp-menu-item-right" }) : null ] }) }), /* @__PURE__ */ r( m, { disabled: a, onClick: () => e(l.HORIZONTAL_SCROLLING), children: /* @__PURE__ */ c(u, { className: "rp-menu-item", content: o == null ? void 0 : o.horizontalTooltip, children: [ /* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ r(g, {}) }), o == null ? void 0 : o.horizontalLabel, i === l.HORIZONTAL_SCROLLING ? /* @__PURE__ */ r(p, { className: "rp-menu-item-right" }) : null ] }) } ) ] }) }); }; export { J as ScrollModeTool };