UNPKG

@pdf-viewer/react

Version:

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

71 lines (70 loc) 3.87 kB
import { jsx as i, Fragment as C, jsxs as n } from "react/jsx-runtime"; import { useMemo as f } from "react"; import e from "../../../../ui/RPTooltip.js"; import { G as R } from "../../../../../index-3bf64864.js"; import { MenuItem as c } from "../../MenuItem.js"; import { PageScrollingIcon as G } from "../../../../icons/PageScrollingIcon.js"; import { VerticalScrollingIcon as O } from "../../../../icons/VerticalScrollingIcon.js"; import { HorizontalScrollingIcon as T } from "../../../../icons/HorizontalScrollingIcon.js"; import { useScrollModeContext as A } from "../../../../../contexts/ScrollModeContext.js"; import { ViewMode as L, ScrollMode as o } from "../../../../../utils/types.js"; import { CheckIcon as p } from "../../../../icons/CheckIcon.js"; import { useViewModeContext as _ } from "../../../../../contexts/ViewModeContext.js"; import { useLocalizationContext as E } from "../../../../../contexts/LocalizationContext.js"; import "../../../../../index-c9a2990a.js"; import "react-dom"; import "../../../../../floating-ui.react-dom-d22a10b4.js"; import "../../../../../utils/withRef.js"; import "../../../../../clsx-0c6e471a.js"; import "../../../../../utils/appConsole.js"; import "../../../../../contexts/InitialStateContext.js"; import "../../../../../de_DE-a553b162.js"; import "../../../../../utils/hooks/useLocalization.js"; const X = (h) => { const { icons: S, isToolVisible: I = !0 } = h, { pageScrollIcon: d, verticalScrollIcon: a, horizontalScrollIcon: u } = S ?? {}, { viewMode: l } = _(), { scrollMode: t, setScrollMode: m } = A(), { localeMessages: r } = E(), N = f(() => l === L.DUAL_PAGE || l === L.DUAL_PAGE_WITH_COVER, [l]); return I ? /* @__PURE__ */ i(C, { children: /* @__PURE__ */ n(R, { children: [ /* @__PURE__ */ i( c, { onClick: () => m(o.PAGE_SCROLLING), "aria-label": r == null ? void 0 : r.pageScrollingTooltip, "aria-checked": t === o.PAGE_SCROLLING, children: /* @__PURE__ */ n(e, { className: "rp-menu-item", content: r == null ? void 0 : r.pageScrollingTooltip, children: [ /* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: d || /* @__PURE__ */ i(G, { "aria-hidden": "true" }) }), r == null ? void 0 : r.pageScrollingLabel, t === o.PAGE_SCROLLING ? /* @__PURE__ */ i(p, { className: "rp-menu-item-right", "aria-hidden": "true" }) : null ] }) } ), /* @__PURE__ */ i( c, { onClick: () => m(o.VERTICAL_SCROLLING), "aria-label": r == null ? void 0 : r.verticalScrollingTooltip, "aria-checked": t === o.VERTICAL_SCROLLING, children: /* @__PURE__ */ n(e, { className: "rp-menu-item", content: r == null ? void 0 : r.verticalScrollingTooltip, children: [ /* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: a || /* @__PURE__ */ i(O, { "aria-hidden": "true" }) }), r == null ? void 0 : r.verticalScrollingLabel, t === o.VERTICAL_SCROLLING ? /* @__PURE__ */ i(p, { className: "rp-menu-item-right", "aria-hidden": "true" }) : null ] }) } ), /* @__PURE__ */ i( c, { disabled: N, onClick: () => m(o.HORIZONTAL_SCROLLING), "aria-label": r == null ? void 0 : r.horizontalTooltip, "aria-checked": t === o.HORIZONTAL_SCROLLING, children: /* @__PURE__ */ n(e, { className: "rp-menu-item", content: r == null ? void 0 : r.horizontalTooltip, children: [ /* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: u || /* @__PURE__ */ i(T, { "aria-hidden": "true" }) }), r == null ? void 0 : r.horizontalLabel, t === o.HORIZONTAL_SCROLLING ? /* @__PURE__ */ i(p, { className: "rp-menu-item-right", "aria-hidden": "true" }) : null ] }) } ) ] }) }) : null; }; export { X as ScrollModeTool };