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