@hybridcore/ui 1.5.41 → 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,48 +1,48 @@
1
- import { jsxs as i, jsx as o, Fragment as h } from "react/jsx-runtime";
2
- import { Box as n, AppBar as d, Toolbar as l } from "@mui/material";
3
- import { ActionButtons as c } from "./components/action-buttons/index.js";
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
+ 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
- import { SidePanelToggleButton as s, SidePanel as f } from "./styled.js";
7
- import { DoubleArrow as u } from "@mui/icons-material";
8
- const S = (r) => {
9
- const { refs: a, state: e, action: t } = g(r);
10
- return /* @__PURE__ */ i(n, { bgcolor: "#ededed", children: [
11
- /* @__PURE__ */ o(d, { color: "inherit", children: /* @__PURE__ */ i(l, { sx: { justifyContent: "space-between" }, children: [
12
- /* @__PURE__ */ o(n, { children: r.logo }),
13
- /* @__PURE__ */ o(n, {}),
14
- /* @__PURE__ */ o(n, { children: /* @__PURE__ */ o(
15
- c,
6
+ import { SidePanelToggleButton as s, SidePanel as u } from "./styled.js";
7
+ import { DoubleArrow as f } from "@mui/icons-material";
8
+ const S = (e) => {
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
+ /* @__PURE__ */ o(t, { children: e.logo }),
13
+ /* @__PURE__ */ o(t, {}),
14
+ /* @__PURE__ */ o(t, { children: /* @__PURE__ */ o(
15
+ d,
16
16
  {
17
- onBookmark: r.onBookmark,
18
- onDownload: t.onDownload,
19
- onFullScreen: t.onFullScreen,
20
- onPrint: t.onPrint
17
+ onBookmark: e.onBookmark,
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__ */ o(n, { mr: `${e.rightPanelWidth}px`, sx: { transition: "all .3s" }, children: e.blob ? /* @__PURE__ */ o(m, { ref: a.viewer, data: e.blob }) : null }),
26
- r.rightPanel ? /* @__PURE__ */ i(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: [
27
27
  /* @__PURE__ */ o(
28
28
  s,
29
29
  {
30
- sx: { right: e.rightPanelWidth },
31
- onClick: t.toggleRightPanel,
30
+ sx: { right: n.rightPanelWidth },
31
+ onClick: r.toggleRightPanel,
32
32
  children: /* @__PURE__ */ o(
33
- u,
33
+ f,
34
34
  {
35
35
  sx: {
36
36
  fontSize: 14,
37
- transform: `rotate(${e.rightPanelWidth ? 0 : 180}deg)`
37
+ transform: `rotate(${n.rightPanelWidth ? 0 : 180}deg)`
38
38
  }
39
39
  }
40
40
  )
41
41
  }
42
42
  ),
43
- /* @__PURE__ */ i(f, { width: e.rightPanelWidth, right: 0, children: [
43
+ /* @__PURE__ */ i(u, { width: n.rightPanelWidth, right: 0, children: [
44
44
  /* @__PURE__ */ o(l, {}),
45
- r.rightPanel
45
+ e.rightPanel
46
46
  ] })
47
47
  ] }) : null
48
48
  ] });
@@ -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,7 +215,8 @@ 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
222
  rightPanel?: default_2.ReactNode;
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.41",
4
+ "version": "1.5.43",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",