@pdf-viewer/react 1.4.0-beta.1 → 1.4.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,26 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { createContext as a, useContext as d, useState as m, useEffect as c } from "react";
3
- import { appConsole as f } from "../utils/appConsole.js";
4
- import { LoaderIcon as p } from "../components/icons/LoaderIcon.js";
5
- const n = a({
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createContext as d, useContext as i } from "react";
3
+ import { appConsole as m } from "../utils/appConsole.js";
4
+ import { LoaderIcon as s } from "../components/icons/LoaderIcon.js";
5
+ const t = d({
6
6
  LoaderImageComponent: void 0
7
- }), g = () => {
8
- const o = d(n);
9
- return typeof o.LoaderImageComponent > "u" && f.error("Please use this hooks inside children component of RPProvider"), o;
10
- }, l = ({ children: o, loaderImage: r }) => {
11
- const [e, s] = m("");
12
- c(() => {
13
- r && s(r);
14
- }, [r]);
15
- const i = () => e ? (e == null ? void 0 : e.trim().startsWith("<svg")) ? /* @__PURE__ */ t("span", { dangerouslySetInnerHTML: { __html: e } }) : /* @__PURE__ */ t("img", { src: e, alt: "react-pdf-viewer-loader" }) : /* @__PURE__ */ t(p, {});
16
- return /* @__PURE__ */ t(
17
- n.Provider,
7
+ }), u = () => {
8
+ const o = i(t);
9
+ return typeof o.LoaderImageComponent > "u" && m.error("Please use this hooks inside children component of RPProvider"), o;
10
+ }, C = ({ children: o, loaderImage: e }) => {
11
+ const n = () => e || /* @__PURE__ */ r(s, {});
12
+ return /* @__PURE__ */ r(
13
+ t.Provider,
18
14
  {
19
15
  value: {
20
- LoaderImageComponent: i
16
+ LoaderImageComponent: n
21
17
  },
22
18
  children: o
23
19
  }
24
20
  );
25
21
  };
26
22
  export {
27
- n as LoaderContext,
28
- l as LoaderProvider,
29
- g as useLoaderContext
23
+ t as LoaderContext,
24
+ C as LoaderProvider,
25
+ u as useLoaderContext
30
26
  };
@@ -1,8 +1,11 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
- import { LoaderContextType } from '../utils/types';
2
+ import { LoaderImage } from '../utils/types';
3
+ interface LoaderContextType {
4
+ LoaderImageComponent?: () => JSX.Element | undefined;
5
+ }
3
6
  export declare const LoaderContext: import('react').Context<LoaderContextType>;
4
7
  interface Props extends PropsWithChildren {
5
- loaderImage?: string;
8
+ loaderImage?: LoaderImage;
6
9
  }
7
10
  export declare const useLoaderContext: () => LoaderContextType;
8
11
  export declare const LoaderProvider: FC<PropsWithChildren<Props>>;
@@ -582,10 +582,11 @@ export interface SelectionModeContextType {
582
582
  export interface SelectionModeProps {
583
583
  initialSelectionMode?: SelectionMode;
584
584
  }
585
+ export type LoaderImage = JSX.Element;
585
586
  export interface LoadPDFOptions {
586
587
  onLoadError?: (error: any) => void;
587
588
  onLoaded?: (pdfDocument: PDFDocumentProxy) => void;
588
- loaderImage?: string;
589
+ loaderImage?: LoaderImage;
589
590
  }
590
591
  export interface ScrollPosition {
591
592
  left: number;
@@ -1,6 +1,6 @@
1
1
  import { useState as g, useCallback as h, useEffect as E } from "react";
2
2
  import { appConsole as l } from "../appConsole.js";
3
- const A = /* @__PURE__ */ new Date("2025-04-10T06:17:44.612Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
3
+ const A = /* @__PURE__ */ new Date("2025-04-10T10:49:34.429Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
4
4
  invalidLicense: `You are currently using without a valid license. ${d}`,
5
5
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
6
6
  expired: `Your license key has expired. ${d}`,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pdf-viewer/react",
3
3
  "private": false,
4
4
  "description": "The PDF Viewer component for React and Next.js",
5
- "version": "1.4.0-beta.1",
5
+ "version": "1.4.0-beta.2",
6
6
  "keywords": [
7
7
  "component",
8
8
  "frontend",