@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
66 lines (65 loc) • 3.83 kB
JavaScript
import { jsx as r, Fragment as L, jsxs as i } from "react/jsx-runtime";
import { G as f } from "../../../index-3bf64864.js";
import { MenuItem as p } from "./MenuItem.js";
import { useToolbarComponentContext as h } from "../../../contexts/ToolbarComponentContext.js";
import { PageScrollingIcon as T } from "../../icons/PageScrollingIcon.js";
import { VerticalScrollingIcon as s } from "../../icons/VerticalScrollingIcon.js";
import { HorizontalScrollingIcon as N } from "../../icons/HorizontalScrollingIcon.js";
import { useScrollModeContext as G } from "../../../contexts/ScrollModeContext.js";
import { ViewMode as a, ScrollMode as l } from "../../../utils/types.js";
import { CheckIcon as u } from "../../icons/CheckIcon.js";
import { useViewModeContext as O } from "../../../contexts/ViewModeContext.js";
import { useMemo as R } from "react";
import { useIconContext as I } from "../../../contexts/IconContext.js";
import d from "../../ui/RPTooltip.js";
import { useLocalizationContext as x } from "../../../contexts/LocalizationContext.js";
import { useIconToolContext as S } from "../../../contexts/IconToolContext.js";
import { useToolComponentContext as A } from "../../../contexts/ToolComponentContext.js";
import "../../../index-c9a2990a.js";
import "react-dom";
import "../../../floating-ui.react-dom-d22a10b4.js";
import "../../../clsx-0c6e471a.js";
import "../../../utils/appConsole.js";
import "../../../contexts/InitialStateContext.js";
import "../../../de_DE-a553b162.js";
import "../../../utils/withRef.js";
import "../../../utils/hooks/useLocalization.js";
const _ = () => {
const { pageScrollIcon: t } = I(), { pageScrollIcon: n } = S();
return t || n || /* @__PURE__ */ r(T, {});
}, v = () => {
const { verticalScrollIcon: t } = I(), { verticalScrollIcon: n } = S();
return t || n || /* @__PURE__ */ r(s, {});
}, z = () => {
const { horizontalScrollIcon: t } = I(), { horizontalScrollIcon: n } = S();
return t || n || /* @__PURE__ */ r(N, {});
}, to = () => {
const { scrollModeTool: t = !0 } = h(), { scrollModeTool: n = !0 } = A(), { viewMode: c } = O(), { scrollMode: e, setScrollMode: m } = G(), { localeMessages: o } = x(), C = R(() => c === a.DUAL_PAGE || c === a.DUAL_PAGE_WITH_COVER, [c]);
return !t || !n ? null : /* @__PURE__ */ r(L, { children: /* @__PURE__ */ i(f, { children: [
/* @__PURE__ */ r(p, { onClick: () => m(l.PAGE_SCROLLING), children: /* @__PURE__ */ i(d, { className: "rp-menu-item", content: o == null ? void 0 : o.pageScrollingTooltip, children: [
/* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ r(_, {}) }),
o == null ? void 0 : o.pageScrollingLabel,
e === l.PAGE_SCROLLING ? /* @__PURE__ */ r(u, { className: "rp-menu-item-right" }) : null
] }) }),
/* @__PURE__ */ r(p, { onClick: () => m(l.VERTICAL_SCROLLING), children: /* @__PURE__ */ i(d, { className: "rp-menu-item", content: o == null ? void 0 : o.verticalScrollingTooltip, children: [
/* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ r(v, {}) }),
o == null ? void 0 : o.verticalScrollingLabel,
e === l.VERTICAL_SCROLLING ? /* @__PURE__ */ r(u, { className: "rp-menu-item-right" }) : null
] }) }),
/* @__PURE__ */ r(
p,
{
disabled: C,
onClick: () => m(l.HORIZONTAL_SCROLLING),
children: /* @__PURE__ */ i(d, { className: "rp-menu-item", content: o == null ? void 0 : o.horizontalTooltip, children: [
/* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ r(z, {}) }),
o == null ? void 0 : o.horizontalLabel,
e === l.HORIZONTAL_SCROLLING ? /* @__PURE__ */ r(u, { className: "rp-menu-item-right" }) : null
] })
}
)
] }) });
};
export {
to as ScrollModeTool
};