@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
53 lines (52 loc) • 3.23 kB
JavaScript
import { jsx as r, Fragment as f, jsxs as t } from "react/jsx-runtime";
import { useMemo as N } from "react";
import l from "../../../../ui/RPTooltip.js";
import { G as C } from "../../../../../index-f563c6f0.js";
import { MenuItem as e } from "../../MenuItem.js";
import { PageScrollingIcon as G } from "../../../../icons/PageScrollingIcon.js";
import { VerticalScrollingIcon as R } from "../../../../icons/VerticalScrollingIcon.js";
import { HorizontalScrollingIcon as O } from "../../../../icons/HorizontalScrollingIcon.js";
import { useScrollModeContext as T } from "../../../../../contexts/ScrollModeContext.js";
import { ViewMode as A, ScrollMode as i } from "../../../../../utils/types.js";
import { CheckIcon as c } from "../../../../icons/CheckIcon.js";
import { useViewModeContext as v } from "../../../../../contexts/ViewModeContext.js";
import { useLocalizationContext as _ } from "../../../../../contexts/LocalizationContext.js";
import "../../../../../index-35c7f4a2.js";
import "react-dom";
import "../../../../../floating-ui.react-dom-6b2fe0df.js";
import "../../../../../utils/withRef.js";
import "../../../../../clsx-0c6e471a.js";
import "../../../../../utils/appConsole.js";
import "../../../../../contexts/InitialStateContext.js";
import "../../../../../th_TH-d627cd51.js";
import "../../../../../utils/hooks/useLocalization.js";
const Q = (S) => {
const { icons: h, isToolVisible: I = !0 } = S, { pageScrollIcon: p, verticalScrollIcon: d, horizontalScrollIcon: u } = h ?? {}, { viewMode: L } = v(), { scrollMode: n, setScrollMode: m } = T(), { localeMessages: o } = _(), a = N(() => L === A.DUAL_PAGE, [L]);
return I ? /* @__PURE__ */ r(f, { children: /* @__PURE__ */ t(C, { children: [
/* @__PURE__ */ r(e, { onClick: () => m(i.PAGE_SCROLLING), children: /* @__PURE__ */ t(l, { className: "rp-menu-item", content: o == null ? void 0 : o.pageScrollingTooltip, children: [
/* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: p || /* @__PURE__ */ r(G, {}) }),
o == null ? void 0 : o.pageScrollingLabel,
n === i.PAGE_SCROLLING ? /* @__PURE__ */ r(c, { className: "rp-menu-item-right" }) : null
] }) }),
/* @__PURE__ */ r(e, { onClick: () => m(i.VERTICAL_SCROLLING), children: /* @__PURE__ */ t(l, { className: "rp-menu-item", content: o == null ? void 0 : o.verticalScrollingTooltip, children: [
/* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: d || /* @__PURE__ */ r(R, {}) }),
o == null ? void 0 : o.verticalScrollingLabel,
n === i.VERTICAL_SCROLLING ? /* @__PURE__ */ r(c, { className: "rp-menu-item-right" }) : null
] }) }),
/* @__PURE__ */ r(
e,
{
disabled: a,
onClick: () => m(i.HORIZONTAL_SCROLLING),
children: /* @__PURE__ */ t(l, { className: "rp-menu-item", content: o == null ? void 0 : o.horizontalTooltip, children: [
/* @__PURE__ */ r("div", { className: "rp-menu-item-left", children: u || /* @__PURE__ */ r(O, {}) }),
o == null ? void 0 : o.horizontalLabel,
n === i.HORIZONTAL_SCROLLING ? /* @__PURE__ */ r(c, { className: "rp-menu-item-right" }) : null
] })
}
)
] }) }) : null;
};
export {
Q as ScrollModeTool
};