@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
30 lines (29 loc) • 1.59 kB
JavaScript
import { jsx as e } from "react/jsx-runtime";
import { useMemo as i, useCallback as S } from "react";
import { UIButton as u } from "../../../ui/Button.js";
import x from "../../../ui/RPTooltip.js";
import { useLocalizationContext as a } from "../../../../contexts/LocalizationContext.js";
import { useSelectionModeContext as h } from "../../../../contexts/SelectionModeContext.js";
import { SelectionMode as n } from "../../../../utils/types.js";
import { TextSelectionDefaultIcon as s } from "../../../icons/TextSelectionDefaultIcon.js";
import { HandModeDefaultIcon as M } from "../../../icons/HandModeDefaultIcon.js";
import "../../../../clsx-0c6e471a.js";
import "../../../../utils/withRef.js";
import "../../../../index-35c7f4a2.js";
import "react-dom";
import "../../../../floating-ui.react-dom-6b2fe0df.js";
import "../../../../utils/appConsole.js";
import "../../../../utils/hooks/useLocalization.js";
import "../../../../th_TH-d627cd51.js";
const U = ({ icons: d }) => {
const { textSelectionIcon: r, handModeIcon: c } = d ?? {}, { selectionMode: m, setSelectionMode: l } = h(), { localeMessages: o } = a(), t = i(() => m === n.TEXT, [m]), p = i(
() => t ? o == null ? void 0 : o.handToolTooltip : o == null ? void 0 : o.textSelectionTooltip,
[t, o]
), f = S(() => {
l(t ? n.HAND : n.TEXT);
}, [t, l]), T = i(() => t ? c ?? /* @__PURE__ */ e(M, {}) : r ?? /* @__PURE__ */ e(s, {}), [t, r, c]);
return /* @__PURE__ */ e(x, { content: p, children: /* @__PURE__ */ e(u, { onClick: f, "aria-label": p, children: T }) });
};
export {
U as SelectionModeSwitcherTool
};