UNPKG

@pdf-viewer/react

Version:

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

50 lines (49 loc) 2.86 kB
import { jsx as t, Fragment as f, jsxs as i } from "react/jsx-runtime"; import { G as a } from "../../../index-f563c6f0.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 p } 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 d 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"; import "react"; import "../../../index-35c7f4a2.js"; import "react-dom"; import "../../../floating-ui.react-dom-6b2fe0df.js"; import "../../../clsx-0c6e471a.js"; import "../../../th_TH-d627cd51.js"; import "../../../utils/appConsole.js"; import "../../../utils/withRef.js"; import "../../../utils/hooks/useLocalization.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, {}); }, W = () => { const { selectionModeTool: e = !0 } = S(), { selectionModeTool: n = !0 } = M(), { selectionMode: m, setSelectionMode: c } = I(), { localeMessages: o } = C(); return !e || !n ? null : /* @__PURE__ */ t(f, { children: /* @__PURE__ */ i(a, { children: [ /* @__PURE__ */ t(p, { onClick: () => c(r.TEXT), children: /* @__PURE__ */ i(d, { 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, m === r.TEXT ? /* @__PURE__ */ t(l, { className: "rp-menu-item-right" }) : null ] }) }), /* @__PURE__ */ t(p, { onClick: () => c(r.HAND), children: /* @__PURE__ */ i(d, { 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, m === r.HAND ? /* @__PURE__ */ t(l, { className: "rp-menu-item-right" }) : null ] }) }), /* @__PURE__ */ t(x, {}) ] }) }); }; export { W as SelectionModeTool };