UNPKG

@pdf-viewer/react

Version:

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

39 lines (38 loc) 1.71 kB
import { jsxs as t, Fragment as p, jsx as o } from "react/jsx-runtime"; import { useCallback as m } from "react"; import { c as f } from "../clsx-0c6e471a.js"; import { useDropFileZoneContext as D } from "../contexts/DropFileZoneContext.js"; import { LightPdfIcon as u } from "./icons/LightPdfIcon.js"; import { DarkPdfIcon as g } from "./icons/DarkPdfIcon.js"; import { useDarkModeContext as h } from "../contexts/DarkModeContext.js"; import { useToolbarComponentContext as v } from "../contexts/ToolbarComponentContext.js"; import { useLocalizationContext as x } from "../contexts/LocalizationContext.js"; import '../assets/RPDropFileZone.css';const a = { "rp-drop-zone": "_rp-drop-zone_1sc50_1", "rp-drop-zone-transparent": "_rp-drop-zone-transparent_1sc50_15" }, z = {}, y = () => { const { dragging: s, handleDragLeave: i, handleDrop: d } = D(), { darkMode: n } = h(), { dropFileZone: r } = v(), { localeMessages: e } = x(); if (typeof r == "boolean" && !r) return; const c = m((l) => { l.preventDefault(); }, []); return s ? /* @__PURE__ */ t(p, { children: [ /* @__PURE__ */ o("div", { className: f(a["rp-drop-zone"], n ? z["rp-dark-mode"] : ""), children: r && typeof r == "function" ? /* @__PURE__ */ o(r, {}) : /* @__PURE__ */ t(p, { children: [ /* @__PURE__ */ o("div", { children: n ? /* @__PURE__ */ o(g, {}) : /* @__PURE__ */ o(u, {}) }), /* @__PURE__ */ o("p", { children: e == null ? void 0 : e.dragDropFileMessage }) ] }) }), /* @__PURE__ */ o( "div", { className: a["rp-drop-zone-transparent"], onDragOver: c, onDragLeave: i, onDrop: d } ) ] }) : null; }; export { y as RPDropFileZone };