@hybridcore/ui 1.5.42 → 1.5.43

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,37 +1,34 @@
1
- import { jsxs as r, jsx as o, Fragment as h } from "react/jsx-runtime";
2
- import { Box as t, AppBar as c, Toolbar as l } from "@mui/material";
1
+ import { jsxs as i, jsx as o, Fragment as c } from "react/jsx-runtime";
2
+ import { Box as t, AppBar as h, Toolbar as l } from "@mui/material";
3
3
  import { ActionButtons as d } from "./components/action-buttons/index.js";
4
4
  import m from "./components/viewer/index.js";
5
5
  import { useDocumentViewerLogic as g } from "./logic.js";
6
6
  import { SidePanelToggleButton as s, SidePanel as u } from "./styled.js";
7
7
  import { DoubleArrow as f } from "@mui/icons-material";
8
8
  const S = (e) => {
9
- const { refs: a, state: n, action: i } = g(e);
10
- return /* @__PURE__ */ r(t, { bgcolor: "#ededed", children: [
11
- /* @__PURE__ */ o(c, { color: "inherit", children: /* @__PURE__ */ r(l, { sx: { justifyContent: "space-between" }, children: [
9
+ const { refs: a, state: n, action: r } = g(e);
10
+ return /* @__PURE__ */ i(t, { bgcolor: "#ededed", children: [
11
+ /* @__PURE__ */ o(h, { color: "inherit", children: /* @__PURE__ */ i(l, { sx: { justifyContent: "space-between" }, children: [
12
12
  /* @__PURE__ */ o(t, { children: e.logo }),
13
13
  /* @__PURE__ */ o(t, {}),
14
14
  /* @__PURE__ */ o(t, { children: /* @__PURE__ */ o(
15
15
  d,
16
16
  {
17
17
  onBookmark: e.onBookmark,
18
- onDownload: i.onDownload,
19
- onFullScreen: i.onFullScreen,
20
- onPrint: i.onPrint
18
+ onDownload: r.onDownload,
19
+ onFullScreen: r.onFullScreen,
20
+ onPrint: r.onPrint
21
21
  }
22
22
  ) })
23
23
  ] }) }),
24
24
  /* @__PURE__ */ o(l, {}),
25
- /* @__PURE__ */ r(t, { mr: `${n.rightPanelWidth}px`, sx: { transition: "all .3s" }, children: [
26
- n.blob ? /* @__PURE__ */ o(m, { ref: a.viewer, data: n.blob }) : null,
27
- e.customContent
28
- ] }),
29
- e.rightPanel ? /* @__PURE__ */ r(h, { children: [
25
+ /* @__PURE__ */ o(t, { mr: `${n.rightPanelWidth}px`, sx: { transition: "all .3s" }, children: e.customContent ? e.customContent : n.blob ? /* @__PURE__ */ o(m, { ref: a.viewer, data: n.blob }) : null }),
26
+ e.rightPanel ? /* @__PURE__ */ i(c, { children: [
30
27
  /* @__PURE__ */ o(
31
28
  s,
32
29
  {
33
30
  sx: { right: n.rightPanelWidth },
34
- onClick: i.toggleRightPanel,
31
+ onClick: r.toggleRightPanel,
35
32
  children: /* @__PURE__ */ o(
36
33
  f,
37
34
  {
@@ -43,7 +40,7 @@ const S = (e) => {
43
40
  )
44
41
  }
45
42
  ),
46
- /* @__PURE__ */ r(u, { width: n.rightPanelWidth, right: 0, children: [
43
+ /* @__PURE__ */ i(u, { width: n.rightPanelWidth, right: 0, children: [
47
44
  /* @__PURE__ */ o(l, {}),
48
45
  e.rightPanel
49
46
  ] })
@@ -1,23 +1,25 @@
1
- import { useRef as f, useState as i, useEffect as b } from "react";
1
+ import { useRef as a, useState as l, useEffect as b } from "react";
2
2
  import { b64toBlob as g, printBlob as p, downloadBlob as w } from "./utils.js";
3
3
  const D = ({
4
- data: t,
4
+ data: o,
5
5
  title: s,
6
6
  rightPanel: c,
7
- rightPanelWidth: n = 450
7
+ rightPanelWidth: t = 450
8
8
  }) => {
9
- const o = f(null), [e, u] = i();
9
+ const n = a(null), [e, u] = l();
10
10
  b(() => ((async () => {
11
- const a = await g(t, "application/pdf");
12
- u(a);
11
+ if (o) {
12
+ const f = await g(o, "application/pdf");
13
+ u(f);
14
+ }
13
15
  })(), () => {
14
- }), [t]);
15
- const [r, l] = i(
16
- c ? n : 0
16
+ }), [o]);
17
+ const [r, i] = l(
18
+ c ? t : 0
17
19
  );
18
20
  return {
19
21
  refs: {
20
- viewer: o
22
+ viewer: n
21
23
  },
22
24
  state: {
23
25
  blob: e,
@@ -28,13 +30,13 @@ const D = ({
28
30
  e && p(e);
29
31
  },
30
32
  onFullScreen: () => {
31
- o.current && o.current.requestFullscreen();
33
+ n.current && n.current.requestFullscreen();
32
34
  },
33
35
  onDownload: () => {
34
36
  e && w(e, s);
35
37
  },
36
38
  toggleRightPanel: () => {
37
- l(r ? 0 : n);
39
+ i(r ? 0 : t);
38
40
  }
39
41
  }
40
42
  };
package/dist/main.d.ts CHANGED
@@ -215,10 +215,10 @@ declare interface DisseminationListProps {
215
215
  export declare const DocumentViewer: FC<DocumentViewerProps>;
216
216
 
217
217
  declare interface DocumentViewerProps {
218
- data: string; // Base64
218
+ data?: string; // Base64
219
+ customContent?: default_2.ReactNode;
219
220
  logo: default_2.ReactNode;
220
221
  title: string;
221
- customContent?: default_2.ReactNode;
222
222
  rightPanel?: default_2.ReactNode;
223
223
  rightPanelWidth?: number;
224
224
  onBookmark(): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.5.42",
4
+ "version": "1.5.43",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",