UNPKG

@pdf-viewer/react

Version:

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

41 lines (40 loc) 2.53 kB
import { jsx as t, Fragment as f, jsxs as i } from "react/jsx-runtime"; import { G as a } from "../../../index-f4a9ae4d.js"; import { TextSelectionDefaultIcon as h } from "../../icons/TextSelectionDefaultIcon.js"; import { HandModeDefaultIcon as s } from "../../icons/HandModeDefaultIcon.js"; import { CheckIcon as l } from "../../icons/CheckIcon.js"; import { MenuItem as d } from "./MenuItem.js"; import { SelectionMode as r } from "../../../utils/types.js"; import { MenuSeparator as x } from "./MenuSeparator.js"; import { useIconContext as u } from "../../../contexts/IconContext.js"; import { useSelectionModeContext as I } from "../../../contexts/SelectionModeContext.js"; import { useToolbarComponentContext as S } from "../../../contexts/ToolbarComponentContext.js"; import p from "../../ui/RPTooltip.js"; import { useLocalizationContext as C } from "../../../contexts/LocalizationContext.js"; import { useIconToolContext as T } from "../../../contexts/IconToolContext.js"; import { useToolComponentContext as M } from "../../../contexts/ToolComponentContext.js"; const N = () => { const { textSelectionIcon: e } = u(), { textSelectionIcon: n } = T(); return e || n || /* @__PURE__ */ t(h, {}); }, D = () => { const { handModeIcon: e } = u(), { handModeIcon: n } = T(); return e || n || /* @__PURE__ */ t(s, {}); }, q = () => { const { selectionModeTool: e = !0 } = S(), { selectionModeTool: n = !0 } = M(), { selectionMode: c, setSelectionMode: m } = I(), { localeMessages: o } = C(); return !e || !n ? null : /* @__PURE__ */ t(f, { children: /* @__PURE__ */ i(a, { children: [ /* @__PURE__ */ t(d, { onClick: () => m(r.TEXT), children: /* @__PURE__ */ i(p, { className: "rp-menu-item", content: o == null ? void 0 : o.textSelectionTooltip, children: [ /* @__PURE__ */ t("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ t(N, {}) }), o == null ? void 0 : o.textSelectionLabel, c === r.TEXT ? /* @__PURE__ */ t(l, { className: "rp-menu-item-right" }) : null ] }) }), /* @__PURE__ */ t(d, { onClick: () => m(r.HAND), children: /* @__PURE__ */ i(p, { className: "rp-menu-item", content: o == null ? void 0 : o.handToolTooltip, children: [ /* @__PURE__ */ t("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ t(D, {}) }), o == null ? void 0 : o.handToolLabel, c === r.HAND ? /* @__PURE__ */ t(l, { className: "rp-menu-item-right" }) : null ] }) }), /* @__PURE__ */ t(x, {}) ] }) }); }; export { q as SelectionModeTool };