react-pdf-levelup 3.1.16 → 3.1.18
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.
- package/dist/index.cjs +59 -7
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +56 -5
- package/package.json +18 -10
package/dist/index.cjs
CHANGED
|
@@ -48,7 +48,7 @@ __export(index_exports, {
|
|
|
48
48
|
Col9: () => Col9,
|
|
49
49
|
Container: () => Container,
|
|
50
50
|
Em: () => Em,
|
|
51
|
-
Font: () =>
|
|
51
|
+
Font: () => import_renderer11.Font,
|
|
52
52
|
H1: () => H1,
|
|
53
53
|
H2: () => H2,
|
|
54
54
|
H3: () => H3,
|
|
@@ -57,6 +57,7 @@ __export(index_exports, {
|
|
|
57
57
|
H6: () => H6,
|
|
58
58
|
Header: () => Header,
|
|
59
59
|
Img: () => Img_default,
|
|
60
|
+
ImgBg: () => ImgBg_default,
|
|
60
61
|
LI: () => LI,
|
|
61
62
|
LayoutPDF: () => LayoutPDF_default,
|
|
62
63
|
Left: () => Left,
|
|
@@ -69,17 +70,17 @@ __export(index_exports, {
|
|
|
69
70
|
Small: () => Small,
|
|
70
71
|
Span: () => Span,
|
|
71
72
|
Strong: () => Strong,
|
|
72
|
-
StyleSheet: () =>
|
|
73
|
+
StyleSheet: () => import_renderer11.StyleSheet,
|
|
73
74
|
Table: () => Table,
|
|
74
75
|
Tbody: () => Tbody,
|
|
75
76
|
Td: () => Td,
|
|
76
|
-
Text: () =>
|
|
77
|
+
Text: () => import_renderer11.Text,
|
|
77
78
|
Th: () => Th,
|
|
78
79
|
Thead: () => Thead,
|
|
79
80
|
Tr: () => Tr,
|
|
80
81
|
U: () => U,
|
|
81
82
|
UL: () => UL,
|
|
82
|
-
View: () =>
|
|
83
|
+
View: () => import_renderer11.View,
|
|
83
84
|
decodeBase64Pdf: () => decodeBase64Pdf_default,
|
|
84
85
|
generatePDF: () => generatePDF_default
|
|
85
86
|
});
|
|
@@ -110,6 +111,7 @@ var LayoutPDF = ({
|
|
|
110
111
|
padding = 30,
|
|
111
112
|
margen = "normal",
|
|
112
113
|
style = {},
|
|
114
|
+
pagination = true,
|
|
113
115
|
footer,
|
|
114
116
|
lines = footer ? 2 : 1
|
|
115
117
|
}) => {
|
|
@@ -192,8 +194,12 @@ var LayoutPDF = ({
|
|
|
192
194
|
const transformOrientation = (orientation2) => {
|
|
193
195
|
switch (orientation2) {
|
|
194
196
|
case "vertical":
|
|
197
|
+
case "portrait":
|
|
198
|
+
case "v":
|
|
195
199
|
return "portrait";
|
|
196
200
|
case "horizontal":
|
|
201
|
+
case "landscape":
|
|
202
|
+
case "h":
|
|
197
203
|
return "landscape";
|
|
198
204
|
default:
|
|
199
205
|
console.warn(`Unrecognized orientation: ${orientation2}. Using portrait as default.`);
|
|
@@ -246,7 +252,7 @@ var LayoutPDF = ({
|
|
|
246
252
|
fontSize: 10,
|
|
247
253
|
color: "grey"
|
|
248
254
|
};
|
|
249
|
-
return /* @__PURE__ */ import_react.default.createElement(import_renderer.Document, null, /* @__PURE__ */ import_react.default.createElement(import_renderer.Page, { size: safeSize, orientation: pdfOrientation, style: pageStyle, wrap: true }, /* @__PURE__ */ import_react.default.createElement(import_renderer.View, { style: { paddingBottom: footerHeight } }, children), /* @__PURE__ */ import_react.default.createElement(import_renderer.View, { style: footerStyle, fixed: true }, footer, /* @__PURE__ */ import_react.default.createElement(import_renderer.Text, { style: { fontSize: footerStyle.fontSize }, render: ({ pageNumber, totalPages }) => `${pageNumber} / ${totalPages}` }))));
|
|
255
|
+
return /* @__PURE__ */ import_react.default.createElement(import_renderer.Document, null, /* @__PURE__ */ import_react.default.createElement(import_renderer.Page, { size: safeSize, orientation: pdfOrientation, style: pageStyle, wrap: true }, /* @__PURE__ */ import_react.default.createElement(import_renderer.View, { style: { paddingBottom: footerHeight } }, children), pagination ? /* @__PURE__ */ import_react.default.createElement(import_renderer.View, { style: footerStyle, fixed: true }, footer, /* @__PURE__ */ import_react.default.createElement(import_renderer.Text, { style: { fontSize: footerStyle.fontSize }, render: ({ pageNumber, totalPages }) => `${pageNumber} / ${totalPages}` })) : null));
|
|
250
256
|
};
|
|
251
257
|
var LayoutPDF_default = LayoutPDF;
|
|
252
258
|
|
|
@@ -749,7 +755,7 @@ var QR = ({
|
|
|
749
755
|
logo = "",
|
|
750
756
|
logoWidth = 30,
|
|
751
757
|
logoHeight = 30,
|
|
752
|
-
errorCorrectionLevel = "M"
|
|
758
|
+
errorCorrectionLevel = logo ? "H" : "M"
|
|
753
759
|
}) => {
|
|
754
760
|
const [qrDataUrl, setQrDataUrl] = (0, import_react8.useState)("");
|
|
755
761
|
(0, import_react8.useEffect)(() => {
|
|
@@ -889,7 +895,7 @@ var LI = ({ children, style, bulletType = "disc", isOrdered = false, index = 1,
|
|
|
889
895
|
};
|
|
890
896
|
|
|
891
897
|
// src/components/core/index.tsx
|
|
892
|
-
var
|
|
898
|
+
var import_renderer11 = require("@react-pdf/renderer");
|
|
893
899
|
|
|
894
900
|
// src/functions/decodeBase64Pdf.ts
|
|
895
901
|
var decodeBase64Pdf = (base64, fileName) => {
|
|
@@ -940,6 +946,51 @@ var generatePDF = async ({ template: Template, data }) => {
|
|
|
940
946
|
}
|
|
941
947
|
};
|
|
942
948
|
var generatePDF_default = generatePDF;
|
|
949
|
+
|
|
950
|
+
// src/components/core/ImgBg.tsx
|
|
951
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
952
|
+
var import_renderer10 = require("@react-pdf/renderer");
|
|
953
|
+
var styles9 = import_renderer10.StyleSheet.create({
|
|
954
|
+
container: {
|
|
955
|
+
position: "relative",
|
|
956
|
+
width: "100%",
|
|
957
|
+
height: "100%"
|
|
958
|
+
},
|
|
959
|
+
background: {
|
|
960
|
+
position: "absolute",
|
|
961
|
+
top: 0,
|
|
962
|
+
left: 0,
|
|
963
|
+
right: 0,
|
|
964
|
+
bottom: 0
|
|
965
|
+
},
|
|
966
|
+
content: {
|
|
967
|
+
position: "relative"
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
var ImgBg = ({
|
|
971
|
+
src,
|
|
972
|
+
width = "100%",
|
|
973
|
+
height = "100%",
|
|
974
|
+
opacity = 0.2,
|
|
975
|
+
children,
|
|
976
|
+
style,
|
|
977
|
+
fixed = false,
|
|
978
|
+
objectFit = "cover",
|
|
979
|
+
objectPosition = "center"
|
|
980
|
+
}) => {
|
|
981
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_renderer10.View, { style: [styles9.container, style] }, /* @__PURE__ */ import_react11.default.createElement(
|
|
982
|
+
import_renderer10.Image,
|
|
983
|
+
{
|
|
984
|
+
src,
|
|
985
|
+
style: [
|
|
986
|
+
styles9.background,
|
|
987
|
+
{ width, height, opacity, objectFit, objectPosition }
|
|
988
|
+
],
|
|
989
|
+
fixed
|
|
990
|
+
}
|
|
991
|
+
), /* @__PURE__ */ import_react11.default.createElement(import_renderer10.View, { style: styles9.content }, children));
|
|
992
|
+
};
|
|
993
|
+
var ImgBg_default = ImgBg;
|
|
943
994
|
// Annotate the CommonJS export names for ESM import in node:
|
|
944
995
|
0 && (module.exports = {
|
|
945
996
|
A,
|
|
@@ -969,6 +1020,7 @@ var generatePDF_default = generatePDF;
|
|
|
969
1020
|
H6,
|
|
970
1021
|
Header,
|
|
971
1022
|
Img,
|
|
1023
|
+
ImgBg,
|
|
972
1024
|
LI,
|
|
973
1025
|
LayoutPDF,
|
|
974
1026
|
Left,
|
package/dist/index.d.cts
CHANGED
|
@@ -4,11 +4,12 @@ export { Font, StyleSheet, Text, View } from '@react-pdf/renderer';
|
|
|
4
4
|
interface LayoutPDFProps {
|
|
5
5
|
children: React$1.ReactNode;
|
|
6
6
|
size?: string;
|
|
7
|
-
orientation?: "vertical" | "horizontal";
|
|
7
|
+
orientation?: "vertical" | "horizontal" | "h" | "v" | "portrait" | "landscape";
|
|
8
8
|
backgroundColor?: string;
|
|
9
9
|
padding?: number;
|
|
10
10
|
margen?: "apa" | "normal" | "estrecho" | "ancho";
|
|
11
11
|
style?: any;
|
|
12
|
+
pagination: true;
|
|
12
13
|
footer?: React$1.ReactNode;
|
|
13
14
|
lines?: number;
|
|
14
15
|
}
|
|
@@ -158,4 +159,17 @@ interface PDFData {
|
|
|
158
159
|
}
|
|
159
160
|
declare const generatePDF: ({ template: Template, data }: PDFData) => Promise<string>;
|
|
160
161
|
|
|
161
|
-
|
|
162
|
+
interface ImgBgProps {
|
|
163
|
+
src: string;
|
|
164
|
+
width?: number | string;
|
|
165
|
+
height?: number | string;
|
|
166
|
+
opacity?: number;
|
|
167
|
+
children?: React$1.ReactNode;
|
|
168
|
+
style?: any;
|
|
169
|
+
fixed?: boolean;
|
|
170
|
+
objectFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
171
|
+
objectPosition?: string;
|
|
172
|
+
}
|
|
173
|
+
declare const ImgBg: React$1.FC<ImgBgProps>;
|
|
174
|
+
|
|
175
|
+
export { A, BR, Blockquote, Center, Col1, Col10, Col11, Col12, Col2, Col3, Col4, Col5, Col6, Col7, Col8, Col9, Container, Em, H1, H2, H3, H4, H5, H6, Header, Img, ImgBg, LI, LayoutPDF, Left, Mark, OL, P, QR, Right, Row, Small, Span, Strong, Table, Tbody, Td, Th, Thead, Tr, U, UL, decodeBase64Pdf, generatePDF };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,12 @@ export { Font, StyleSheet, Text, View } from '@react-pdf/renderer';
|
|
|
4
4
|
interface LayoutPDFProps {
|
|
5
5
|
children: React$1.ReactNode;
|
|
6
6
|
size?: string;
|
|
7
|
-
orientation?: "vertical" | "horizontal";
|
|
7
|
+
orientation?: "vertical" | "horizontal" | "h" | "v" | "portrait" | "landscape";
|
|
8
8
|
backgroundColor?: string;
|
|
9
9
|
padding?: number;
|
|
10
10
|
margen?: "apa" | "normal" | "estrecho" | "ancho";
|
|
11
11
|
style?: any;
|
|
12
|
+
pagination: true;
|
|
12
13
|
footer?: React$1.ReactNode;
|
|
13
14
|
lines?: number;
|
|
14
15
|
}
|
|
@@ -158,4 +159,17 @@ interface PDFData {
|
|
|
158
159
|
}
|
|
159
160
|
declare const generatePDF: ({ template: Template, data }: PDFData) => Promise<string>;
|
|
160
161
|
|
|
161
|
-
|
|
162
|
+
interface ImgBgProps {
|
|
163
|
+
src: string;
|
|
164
|
+
width?: number | string;
|
|
165
|
+
height?: number | string;
|
|
166
|
+
opacity?: number;
|
|
167
|
+
children?: React$1.ReactNode;
|
|
168
|
+
style?: any;
|
|
169
|
+
fixed?: boolean;
|
|
170
|
+
objectFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
171
|
+
objectPosition?: string;
|
|
172
|
+
}
|
|
173
|
+
declare const ImgBg: React$1.FC<ImgBgProps>;
|
|
174
|
+
|
|
175
|
+
export { A, BR, Blockquote, Center, Col1, Col10, Col11, Col12, Col2, Col3, Col4, Col5, Col6, Col7, Col8, Col9, Container, Em, H1, H2, H3, H4, H5, H6, Header, Img, ImgBg, LI, LayoutPDF, Left, Mark, OL, P, QR, Right, Row, Small, Span, Strong, Table, Tbody, Td, Th, Thead, Tr, U, UL, decodeBase64Pdf, generatePDF };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var LayoutPDF = ({
|
|
|
23
23
|
padding = 30,
|
|
24
24
|
margen = "normal",
|
|
25
25
|
style = {},
|
|
26
|
+
pagination = true,
|
|
26
27
|
footer,
|
|
27
28
|
lines = footer ? 2 : 1
|
|
28
29
|
}) => {
|
|
@@ -105,8 +106,12 @@ var LayoutPDF = ({
|
|
|
105
106
|
const transformOrientation = (orientation2) => {
|
|
106
107
|
switch (orientation2) {
|
|
107
108
|
case "vertical":
|
|
109
|
+
case "portrait":
|
|
110
|
+
case "v":
|
|
108
111
|
return "portrait";
|
|
109
112
|
case "horizontal":
|
|
113
|
+
case "landscape":
|
|
114
|
+
case "h":
|
|
110
115
|
return "landscape";
|
|
111
116
|
default:
|
|
112
117
|
console.warn(`Unrecognized orientation: ${orientation2}. Using portrait as default.`);
|
|
@@ -159,7 +164,7 @@ var LayoutPDF = ({
|
|
|
159
164
|
fontSize: 10,
|
|
160
165
|
color: "grey"
|
|
161
166
|
};
|
|
162
|
-
return /* @__PURE__ */ React.createElement(Document, null, /* @__PURE__ */ React.createElement(Page, { size: safeSize, orientation: pdfOrientation, style: pageStyle, wrap: true }, /* @__PURE__ */ React.createElement(View, { style: { paddingBottom: footerHeight } }, children), /* @__PURE__ */ React.createElement(View, { style: footerStyle, fixed: true }, footer, /* @__PURE__ */ React.createElement(Text, { style: { fontSize: footerStyle.fontSize }, render: ({ pageNumber, totalPages }) => `${pageNumber} / ${totalPages}` }))));
|
|
167
|
+
return /* @__PURE__ */ React.createElement(Document, null, /* @__PURE__ */ React.createElement(Page, { size: safeSize, orientation: pdfOrientation, style: pageStyle, wrap: true }, /* @__PURE__ */ React.createElement(View, { style: { paddingBottom: footerHeight } }, children), pagination ? /* @__PURE__ */ React.createElement(View, { style: footerStyle, fixed: true }, footer, /* @__PURE__ */ React.createElement(Text, { style: { fontSize: footerStyle.fontSize }, render: ({ pageNumber, totalPages }) => `${pageNumber} / ${totalPages}` })) : null));
|
|
163
168
|
};
|
|
164
169
|
var LayoutPDF_default = LayoutPDF;
|
|
165
170
|
|
|
@@ -662,7 +667,7 @@ var QR = ({
|
|
|
662
667
|
logo = "",
|
|
663
668
|
logoWidth = 30,
|
|
664
669
|
logoHeight = 30,
|
|
665
|
-
errorCorrectionLevel = "M"
|
|
670
|
+
errorCorrectionLevel = logo ? "H" : "M"
|
|
666
671
|
}) => {
|
|
667
672
|
const [qrDataUrl, setQrDataUrl] = useState("");
|
|
668
673
|
useEffect(() => {
|
|
@@ -802,7 +807,7 @@ var LI = ({ children, style, bulletType = "disc", isOrdered = false, index = 1,
|
|
|
802
807
|
};
|
|
803
808
|
|
|
804
809
|
// src/components/core/index.tsx
|
|
805
|
-
import { View as
|
|
810
|
+
import { View as View9, Text as Text5, StyleSheet as StyleSheet10, Font } from "@react-pdf/renderer";
|
|
806
811
|
|
|
807
812
|
// src/functions/decodeBase64Pdf.ts
|
|
808
813
|
var decodeBase64Pdf = (base64, fileName) => {
|
|
@@ -853,6 +858,51 @@ var generatePDF = async ({ template: Template, data }) => {
|
|
|
853
858
|
}
|
|
854
859
|
};
|
|
855
860
|
var generatePDF_default = generatePDF;
|
|
861
|
+
|
|
862
|
+
// src/components/core/ImgBg.tsx
|
|
863
|
+
import React9 from "react";
|
|
864
|
+
import { Image as Image4, StyleSheet as StyleSheet9, View as View8 } from "@react-pdf/renderer";
|
|
865
|
+
var styles9 = StyleSheet9.create({
|
|
866
|
+
container: {
|
|
867
|
+
position: "relative",
|
|
868
|
+
width: "100%",
|
|
869
|
+
height: "100%"
|
|
870
|
+
},
|
|
871
|
+
background: {
|
|
872
|
+
position: "absolute",
|
|
873
|
+
top: 0,
|
|
874
|
+
left: 0,
|
|
875
|
+
right: 0,
|
|
876
|
+
bottom: 0
|
|
877
|
+
},
|
|
878
|
+
content: {
|
|
879
|
+
position: "relative"
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
var ImgBg = ({
|
|
883
|
+
src,
|
|
884
|
+
width = "100%",
|
|
885
|
+
height = "100%",
|
|
886
|
+
opacity = 0.2,
|
|
887
|
+
children,
|
|
888
|
+
style,
|
|
889
|
+
fixed = false,
|
|
890
|
+
objectFit = "cover",
|
|
891
|
+
objectPosition = "center"
|
|
892
|
+
}) => {
|
|
893
|
+
return /* @__PURE__ */ React9.createElement(View8, { style: [styles9.container, style] }, /* @__PURE__ */ React9.createElement(
|
|
894
|
+
Image4,
|
|
895
|
+
{
|
|
896
|
+
src,
|
|
897
|
+
style: [
|
|
898
|
+
styles9.background,
|
|
899
|
+
{ width, height, opacity, objectFit, objectPosition }
|
|
900
|
+
],
|
|
901
|
+
fixed
|
|
902
|
+
}
|
|
903
|
+
), /* @__PURE__ */ React9.createElement(View8, { style: styles9.content }, children));
|
|
904
|
+
};
|
|
905
|
+
var ImgBg_default = ImgBg;
|
|
856
906
|
export {
|
|
857
907
|
A,
|
|
858
908
|
BR,
|
|
@@ -881,6 +931,7 @@ export {
|
|
|
881
931
|
H6,
|
|
882
932
|
Header,
|
|
883
933
|
Img_default as Img,
|
|
934
|
+
ImgBg_default as ImgBg,
|
|
884
935
|
LI,
|
|
885
936
|
LayoutPDF_default as LayoutPDF,
|
|
886
937
|
Left,
|
|
@@ -893,7 +944,7 @@ export {
|
|
|
893
944
|
Small,
|
|
894
945
|
Span,
|
|
895
946
|
Strong,
|
|
896
|
-
|
|
947
|
+
StyleSheet10 as StyleSheet,
|
|
897
948
|
Table,
|
|
898
949
|
Tbody,
|
|
899
950
|
Td,
|
|
@@ -903,7 +954,7 @@ export {
|
|
|
903
954
|
Tr,
|
|
904
955
|
U,
|
|
905
956
|
UL,
|
|
906
|
-
|
|
957
|
+
View9 as View,
|
|
907
958
|
decodeBase64Pdf_default as decodeBase64Pdf,
|
|
908
959
|
generatePDF_default as generatePDF
|
|
909
960
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-pdf-levelup",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.18",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -20,31 +20,39 @@
|
|
|
20
20
|
"demo": "tsx ./src/useExample/index.ts"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@react-pdf/renderer": "^4.3.0",
|
|
24
|
-
"qrcode": "^1.5.4",
|
|
25
|
-
"react": "^18",
|
|
26
|
-
"react-dom": "^18"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
23
|
"@babel/standalone": "^7.23.10",
|
|
30
24
|
"@monaco-editor/react": "^4.7.0",
|
|
25
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
26
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
27
|
+
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
28
|
+
"@radix-ui/react-tabs": "^1.1.13",
|
|
29
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
30
|
+
"autoprefixer": "^10.4.21",
|
|
31
31
|
"canvas": "^3.1.2",
|
|
32
|
+
"class-variance-authority": "^0.7.1",
|
|
32
33
|
"i": "^0.3.7",
|
|
33
34
|
"jsdom": "^26.1.0",
|
|
34
35
|
"lucide-react": "^0.485.0",
|
|
35
|
-
"npm": "^11.3.0",
|
|
36
36
|
"qr-code-styling": "^1.9.2",
|
|
37
37
|
"react-router-dom": "^7.4.1",
|
|
38
38
|
"rimraf": "^6.0.1",
|
|
39
|
+
"tailwind-merge": "^3.3.1",
|
|
40
|
+
"tailwindcss": "^4.1.12",
|
|
39
41
|
"ts-node": "^10.9.2"
|
|
40
42
|
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@react-pdf/renderer": "^4.3.0",
|
|
45
|
+
"qrcode": "^1.5.4",
|
|
46
|
+
"react": "^18",
|
|
47
|
+
"react-dom": "^18"
|
|
48
|
+
},
|
|
41
49
|
"devDependencies": {
|
|
42
50
|
"@eslint/js": "^9.21.0",
|
|
43
51
|
"@react-pdf/types": "^2.9.0",
|
|
44
52
|
"@types/jsdom": "^21.1.7",
|
|
45
53
|
"@types/qrcode": "^1.5.5",
|
|
46
|
-
"@types/react": "^
|
|
47
|
-
"@types/react-dom": "^
|
|
54
|
+
"@types/react": "^19",
|
|
55
|
+
"@types/react-dom": "^19",
|
|
48
56
|
"@vitejs/plugin-react": "^4.3.4",
|
|
49
57
|
"eslint": "^9.21.0",
|
|
50
58
|
"eslint-plugin-react-hooks": "^5.1.0",
|