UNPKG

@pdf-viewer/react

Version:

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

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