UNPKG

@pdf-viewer/react

Version:

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

51 lines (50 loc) 2.06 kB
import { jsx as n, jsxs as m } from "react/jsx-runtime"; import { useFullScreenContext as f } from "../../../contexts/FullScreenContext.js"; import { UIButton as p } from "../../ui/Button.js"; import { FullScreenIcon as i } from "../../icons/FullScreenIcon.js"; import { useToolbarComponentContext as S } from "../../../contexts/ToolbarComponentContext.js"; import { useIconContext as d } from "../../../contexts/IconContext.js"; import { useViewportContext as C } from "../../../contexts/ViewportContext.js"; import { MenuItem as F } from "./MenuItem.js"; import T from "../../ui/RPTooltip.js"; import { useLocalizationContext as x } from "../../../contexts/LocalizationContext.js"; const s = () => { const { fullScreenIcon: r } = d(); return r || /* @__PURE__ */ n(i, {}); }, c = ({ children: r, className: t, localeMessages: o }) => /* @__PURE__ */ n(T, { className: t, content: o == null ? void 0 : o.fullScreenTooltip, children: r }), I = ({ toggleFullScreen: r, isSupported: t, localeMessages: o }) => /* @__PURE__ */ n(F, { onClick: r, disabled: !t, children: /* @__PURE__ */ m(c, { className: "rp-menu-item", localeMessages: o, children: [ /* @__PURE__ */ n("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ n(i, {}) }), o == null ? void 0 : o.fullScreenTooltip ] }) }), L = () => { const { isFullScreen: r, toggleFullScreen: t, isSupported: o } = f(), { fullscreenTool: e } = S(), { isSmallScreen: u } = C(), { localeMessages: l } = x(); return e ? u ? /* @__PURE__ */ n( I, { isFullScreen: r, toggleFullScreen: t, isSupported: o, localeMessages: l } ) : typeof e == "function" ? /* @__PURE__ */ n( e, { isFullScreen: r, toggleFullScreen: t, isSupported: o } ) : /* @__PURE__ */ n(c, { localeMessages: l, children: /* @__PURE__ */ n( p, { disabled: !o, onClick: t, "aria-label": r ? "Exit full screen" : "Enter full screen", children: /* @__PURE__ */ n(s, {}) } ) }) : null; }; export { L as FullScreenTool };