@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
66 lines (65 loc) • 3.8 kB
JavaScript
import { jsx as r, Fragment as f, jsxs as i } from "react/jsx-runtime";
import { G as C } from "../../../index-f563c6f0.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";
import "../../../index-35c7f4a2.js";
import "react-dom";
import "../../../floating-ui.react-dom-6b2fe0df.js";
import "../../../clsx-0c6e471a.js";
import "../../../utils/appConsole.js";
import "../../../contexts/InitialStateContext.js";
import "../../../th_TH-d627cd51.js";
import "../../../utils/withRef.js";
import "../../../utils/hooks/useLocalization.js";
const z = () => {
const { pageScrollIcon: t } = d(), { pageScrollIcon: n } = I();
return t || n || /* @__PURE__ */ r(h, {});
}, A = () => {
const { verticalScrollIcon: t } = d(), { verticalScrollIcon: n } = I();
return t || n || /* @__PURE__ */ r(T, {});
}, g = () => {
const { horizontalScrollIcon: t } = d(), { horizontalScrollIcon: n } = I();
return t || n || /* @__PURE__ */ r(s, {});
}, to = () => {
const { scrollModeTool: t = !0 } = L(), { scrollModeTool: n = !0 } = v(), { viewMode: S } = O(), { scrollMode: c, setScrollMode: e } = N(), { localeMessages: o } = x(), a = R(() => S === G.DUAL_PAGE, [S]);
return !t || !n ? null : /* @__PURE__ */ r(f, { children: /* @__PURE__ */ i(C, { children: [
/* @__PURE__ */ r(m, { onClick: () => e(l.PAGE_SCROLLING), children: /* @__PURE__ */ i(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,
c === l.PAGE_SCROLLING ? /* @__PURE__ */ r(p, { className: "rp-menu-item-right" }) : null
] }) }),
/* @__PURE__ */ r(m, { onClick: () => e(l.VERTICAL_SCROLLING), children: /* @__PURE__ */ i(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,
c === l.VERTICAL_SCROLLING ? /* @__PURE__ */ r(p, { className: "rp-menu-item-right" }) : null
] }) }),
/* @__PURE__ */ r(
m,
{
disabled: a,
onClick: () => e(l.HORIZONTAL_SCROLLING),
children: /* @__PURE__ */ i(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,
c === l.HORIZONTAL_SCROLLING ? /* @__PURE__ */ r(p, { className: "rp-menu-item-right" }) : null
] })
}
)
] }) });
};
export {
to as ScrollModeTool
};