react-pdf-levelup 2.0.33 → 3.1.3

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.js CHANGED
@@ -1,71 +1,165 @@
1
1
  // src/components/core/LayoutPDF.tsx
2
2
  import React from "react";
3
- import { Page, Document, StyleSheet, Text } from "@react-pdf/renderer";
3
+ import { Page, Document, StyleSheet, Text, View } from "@react-pdf/renderer";
4
4
  var styles = StyleSheet.create({
5
5
  page: {
6
6
  backgroundColor: "white",
7
7
  padding: 30,
8
8
  fontFamily: "Helvetica",
9
- fontSize: 12,
10
- lineHeight: 1.5
9
+ fontSize: 14
11
10
  },
12
- pageNumber: {
11
+ footer: {
13
12
  position: "absolute",
14
- fontSize: 10,
15
- top: 792 - 14,
16
13
  left: 0,
17
14
  right: 0,
18
- textAlign: "center",
19
- color: "grey"
15
+ textAlign: "center"
20
16
  }
21
17
  });
22
18
  var LayoutPDF = ({
23
19
  children,
24
20
  size = "A4",
25
- orientation = "portrait",
21
+ orientation = "vertical",
26
22
  backgroundColor = "white",
27
- showPageNumbers = true,
28
23
  padding = 30,
29
- style = {}
24
+ margen = "normal",
25
+ style = {},
26
+ footer,
27
+ lines = footer ? 2 : 1
30
28
  }) => {
29
+ const LINE_HEIGHT = 20;
30
+ const FOOTER_PADDING = 10;
31
+ const footerHeight = lines * LINE_HEIGHT + FOOTER_PADDING;
32
+ const getMargins = (margen2, pageSize) => {
33
+ const normalizedSize = pageSize.toUpperCase();
34
+ switch (margen2) {
35
+ case "apa":
36
+ if (normalizedSize === "LETTER" || normalizedSize === "LEGAL") {
37
+ return {
38
+ paddingTop: 72,
39
+ paddingRight: 72,
40
+ paddingBottom: 72,
41
+ paddingLeft: 72
42
+ };
43
+ }
44
+ return {
45
+ paddingTop: 72,
46
+ paddingRight: 72,
47
+ paddingBottom: 72,
48
+ paddingLeft: 72
49
+ };
50
+ case "estrecho":
51
+ return {
52
+ paddingTop: 36,
53
+ paddingRight: 36,
54
+ paddingBottom: 36,
55
+ paddingLeft: 36
56
+ };
57
+ case "ancho":
58
+ return {
59
+ paddingTop: 108,
60
+ paddingRight: 108,
61
+ paddingBottom: 108,
62
+ paddingLeft: 108
63
+ };
64
+ case "normal":
65
+ default:
66
+ return {
67
+ paddingTop: padding,
68
+ paddingRight: padding,
69
+ paddingBottom: padding,
70
+ paddingLeft: padding
71
+ };
72
+ }
73
+ };
31
74
  let safeSize = size;
32
75
  let safeOrientation = orientation;
33
76
  let safeBackgroundColor = backgroundColor;
34
- let safeShowPageNumbers = showPageNumbers;
77
+ let safeLines = Math.max(1, Math.min(lines, 10));
78
+ let safeMargen = margen;
35
79
  try {
36
- const validSizes = ["A4", "A3", "A5", "LETTER", "LEGAL", "TABLOID"];
80
+ const validSizes = ["A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "LETTER", "LEGAL", "TABLOID"];
37
81
  if (typeof size === "string" && !validSizes.includes(size.toUpperCase())) {
38
- console.warn(`Tama\xF1o de p\xE1gina inv\xE1lido: ${size}. Usando A4 como valor predeterminado.`);
82
+ console.warn(`Invalid page size: ${size}. Using A4 as default.`);
39
83
  safeSize = "A4";
40
84
  }
41
- if (orientation !== "portrait" && orientation !== "landscape") {
42
- console.warn(`Orientaci\xF3n inv\xE1lida: ${orientation}. Usando portrait como valor predeterminado.`);
43
- safeOrientation = "portrait";
85
+ if (orientation !== "vertical" && orientation !== "horizontal") {
86
+ console.warn(`Invalid orientation: ${orientation}. Using vertical as default.`);
87
+ safeOrientation = "vertical";
44
88
  }
45
89
  if (typeof backgroundColor !== "string") {
46
- console.warn(`Color de fondo inv\xE1lido: ${backgroundColor}. Usando white como valor predeterminado.`);
90
+ console.warn(`Invalid background color: ${backgroundColor}. Using white as default.`);
47
91
  safeBackgroundColor = "white";
48
92
  }
49
- if (typeof showPageNumbers !== "boolean") {
50
- safeShowPageNumbers = Boolean(showPageNumbers);
93
+ const validMargins = ["apa", "normal", "estrecho", "ancho"];
94
+ if (!validMargins.includes(margen)) {
95
+ console.warn(`Invalid margin type: ${margen}. Using normal as default.`);
96
+ safeMargen = "normal";
97
+ }
98
+ if (typeof lines !== "number" || lines < 1) {
99
+ console.warn(`Invalid lines value: ${lines}. Using 1 as default.`);
100
+ safeLines = 1;
51
101
  }
52
102
  } catch (e) {
53
- console.warn("Error procesando props en LayoutPDF:", e);
103
+ console.warn("Error processing props in LayoutPDF:", e);
54
104
  }
105
+ const transformOrientation = (orientation2) => {
106
+ switch (orientation2) {
107
+ case "vertical":
108
+ return "portrait";
109
+ case "horizontal":
110
+ return "landscape";
111
+ default:
112
+ console.warn(`Unrecognized orientation: ${orientation2}. Using portrait as default.`);
113
+ return "portrait";
114
+ }
115
+ };
116
+ const getFooterPosition = (pageSize, orientation2, footerHeight2) => {
117
+ const pageDimensions = {
118
+ A0: { width: 841, height: 1189 },
119
+ A1: { width: 594, height: 841 },
120
+ A2: { width: 420, height: 594 },
121
+ A3: { width: 297, height: 420 },
122
+ A4: { width: 210, height: 297 },
123
+ A5: { width: 148, height: 210 },
124
+ A6: { width: 105, height: 148 },
125
+ A7: { width: 74, height: 105 },
126
+ A8: { width: 52, height: 74 },
127
+ A9: { width: 37, height: 52 },
128
+ LETTER: { width: 216, height: 279 },
129
+ LEGAL: { width: 216, height: 356 },
130
+ TABLOID: { width: 279, height: 432 }
131
+ };
132
+ const mmToPoints = 2.834645669;
133
+ const dimensions = pageDimensions[pageSize.toUpperCase()];
134
+ if (!dimensions) {
135
+ return orientation2 === "landscape" ? 595 - footerHeight2 - 10 : 842 - footerHeight2 - 10;
136
+ }
137
+ const heightInPoints = dimensions.height * mmToPoints;
138
+ const widthInPoints = dimensions.width * mmToPoints;
139
+ return orientation2 === "landscape" ? widthInPoints - footerHeight2 - 10 : heightInPoints - footerHeight2 - 10;
140
+ };
141
+ const pdfOrientation = transformOrientation(safeOrientation);
142
+ const margins = getMargins(safeMargen, safeSize);
143
+ const footerTop = getFooterPosition(safeSize, pdfOrientation, footerHeight);
55
144
  const pageStyle = {
56
145
  ...styles.page,
57
146
  backgroundColor: safeBackgroundColor,
58
- padding,
147
+ ...margins,
148
+ paddingBottom: margins.paddingBottom + footerHeight,
59
149
  ...style
60
150
  };
61
- return /* @__PURE__ */ React.createElement(Document, null, /* @__PURE__ */ React.createElement(Page, { size: safeSize, orientation: safeOrientation, style: pageStyle }, children, safeShowPageNumbers && /* @__PURE__ */ React.createElement(
62
- Text,
63
- {
64
- style: styles.pageNumber,
65
- render: ({ pageNumber, totalPages }) => `${pageNumber} / ${totalPages}`,
66
- fixed: true
67
- }
68
- )));
151
+ const footerStyle = {
152
+ ...styles.footer,
153
+ top: footerTop,
154
+ height: footerHeight,
155
+ display: "flex",
156
+ flexDirection: "column",
157
+ justifyContent: "center",
158
+ alignItems: "center",
159
+ fontSize: 10,
160
+ color: "grey"
161
+ };
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}` }))));
69
163
  };
70
164
  var LayoutPDF_default = LayoutPDF;
71
165
 
@@ -86,7 +180,7 @@ var Img_default = Img;
86
180
 
87
181
  // src/components/core/Position.tsx
88
182
  import React3 from "react";
89
- import { View, StyleSheet as StyleSheet3 } from "@react-pdf/renderer";
183
+ import { View as View2, StyleSheet as StyleSheet3 } from "@react-pdf/renderer";
90
184
  var styles3 = StyleSheet3.create({
91
185
  left: {
92
186
  textAlign: "left"
@@ -99,23 +193,23 @@ var styles3 = StyleSheet3.create({
99
193
  }
100
194
  });
101
195
  var Left = ({ children, style }) => {
102
- return /* @__PURE__ */ React3.createElement(View, { style: [styles3.left, style] }, children);
196
+ return /* @__PURE__ */ React3.createElement(View2, { style: [styles3.left, style] }, children);
103
197
  };
104
198
  var Right = ({ children, style }) => {
105
- return /* @__PURE__ */ React3.createElement(View, { style: [styles3.right, style] }, children);
199
+ return /* @__PURE__ */ React3.createElement(View2, { style: [styles3.right, style] }, children);
106
200
  };
107
201
  var Center = ({ children, style }) => {
108
- return /* @__PURE__ */ React3.createElement(View, { style: [styles3.center, style] }, children);
202
+ return /* @__PURE__ */ React3.createElement(View2, { style: [styles3.center, style] }, children);
109
203
  };
110
204
 
111
205
  // src/components/core/Etiquetas.tsx
112
206
  import React4 from "react";
113
- import { Text as Text2, StyleSheet as StyleSheet4, Link } from "@react-pdf/renderer";
207
+ import { Text as Text2, StyleSheet as StyleSheet4, Link, View as View3 } from "@react-pdf/renderer";
114
208
  var styles4 = StyleSheet4.create({
115
209
  p: {
116
210
  fontSize: 12,
117
- marginBottom: 14,
118
- lineHeight: 1.5
211
+ marginBottom: 5,
212
+ lineHeight: 1.2
119
213
  },
120
214
  h1: {
121
215
  fontSize: 24,
@@ -178,6 +272,16 @@ var styles4 = StyleSheet4.create({
178
272
  height: 1,
179
273
  marginTop: 7,
180
274
  marginBottom: 7
275
+ },
276
+ header: {
277
+ position: "absolute",
278
+ top: 20,
279
+ left: 0,
280
+ right: 0,
281
+ textAlign: "center",
282
+ fontSize: 10,
283
+ color: "#666",
284
+ paddingHorizontal: 40
181
285
  }
182
286
  });
183
287
  var P = ({ children, style }) => {
@@ -228,10 +332,13 @@ var BR = ({ style }) => {
228
332
  var Span = ({ children, style }) => {
229
333
  return /* @__PURE__ */ React4.createElement(Text2, { style: [style] }, children);
230
334
  };
335
+ var Header = ({ children, style, fixed = false }) => {
336
+ return /* @__PURE__ */ React4.createElement(View3, { style: [styles4.header, style], fixed }, typeof children === "string" ? /* @__PURE__ */ React4.createElement(Text2, null, children) : children);
337
+ };
231
338
 
232
339
  // src/components/core/Tablet.tsx
233
340
  import React5 from "react";
234
- import { View as View2, Text as Text3, StyleSheet as StyleSheet5 } from "@react-pdf/renderer";
341
+ import { View as View4, Text as Text3, StyleSheet as StyleSheet5 } from "@react-pdf/renderer";
235
342
  var styles5 = StyleSheet5.create({
236
343
  table: {
237
344
  width: "100%",
@@ -255,7 +362,7 @@ var styles5 = StyleSheet5.create({
255
362
  text: {
256
363
  fontSize: 10,
257
364
  fontFamily: "Helvetica",
258
- paddingTop: 4,
365
+ paddingTop: 8,
259
366
  paddingLeft: 8,
260
367
  paddingRight: 8
261
368
  },
@@ -263,8 +370,8 @@ var styles5 = StyleSheet5.create({
263
370
  backgroundColor: "#eeeeee"
264
371
  }
265
372
  });
266
- var Table = ({ children, style }) => /* @__PURE__ */ React5.createElement(View2, { style: [styles5.table, style] }, children);
267
- var Thead = ({ children, style }) => /* @__PURE__ */ React5.createElement(View2, { style: [styles5.thead, style] }, children);
373
+ var Table = ({ children, style }) => /* @__PURE__ */ React5.createElement(View4, { style: [styles5.table, style] }, children);
374
+ var Thead = ({ children, style }) => /* @__PURE__ */ React5.createElement(View4, { style: [styles5.thead, style] }, children);
268
375
  var Tbody = ({ children, style }) => {
269
376
  const rows = React5.Children.toArray(children);
270
377
  const count = rows.length;
@@ -283,7 +390,7 @@ var Tr = ({
283
390
  }) => {
284
391
  const elements = React5.Children.toArray(children);
285
392
  const count = elements.length;
286
- return /* @__PURE__ */ React5.createElement(View2, { style: [styles5.tr, style] }, elements.map((child, idx) => {
393
+ return /* @__PURE__ */ React5.createElement(View4, { style: [styles5.tr, style] }, elements.map((child, idx) => {
287
394
  const isLast = idx === count - 1;
288
395
  const width = `${(100 / count).toFixed(2)}%`;
289
396
  return React5.cloneElement(child, { width, isLast, isLastRow, isOdd });
@@ -305,7 +412,7 @@ var Th = ({
305
412
  borderColor: "#000",
306
413
  ...height !== void 0 && { height }
307
414
  };
308
- return /* @__PURE__ */ React5.createElement(View2, { style: [styles5.textBold, { width: baseWidth }, borders, style] }, /* @__PURE__ */ React5.createElement(Text3, null, children));
415
+ return /* @__PURE__ */ React5.createElement(View4, { style: [styles5.textBold, { width: baseWidth }, borders, style] }, /* @__PURE__ */ React5.createElement(Text3, null, children));
309
416
  };
310
417
  var Td = ({
311
418
  children,
@@ -324,7 +431,7 @@ var Td = ({
324
431
  borderColor: "#000",
325
432
  ...height !== void 0 && { height }
326
433
  };
327
- return /* @__PURE__ */ React5.createElement(View2, { style: [
434
+ return /* @__PURE__ */ React5.createElement(View4, { style: [
328
435
  styles5.text,
329
436
  isOdd && styles5.zebraOdd,
330
437
  { width: baseWidth },
@@ -335,7 +442,7 @@ var Td = ({
335
442
 
336
443
  // src/components/core/Grid.tsx
337
444
  import React6 from "react";
338
- import { View as View3, StyleSheet as StyleSheet6 } from "@react-pdf/renderer";
445
+ import { View as View5, StyleSheet as StyleSheet6 } from "@react-pdf/renderer";
339
446
  var styles6 = StyleSheet6.create({
340
447
  container: {
341
448
  width: "100%",
@@ -363,83 +470,51 @@ var styles6 = StyleSheet6.create({
363
470
  col12: { width: "100%" }
364
471
  });
365
472
  var Container = ({ children, style }) => {
366
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.container, style] }, children);
473
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.container, style] }, children);
367
474
  };
368
475
  var Row = ({ children, style }) => {
369
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.row, style] }, children);
476
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.row, style] }, children);
370
477
  };
371
478
  var Col1 = ({ children, style }) => {
372
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col1, style] }, children);
479
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col1, style] }, children);
373
480
  };
374
481
  var Col2 = ({ children, style }) => {
375
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col2, style] }, children);
482
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col2, style] }, children);
376
483
  };
377
484
  var Col3 = ({ children, style }) => {
378
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col3, style] }, children);
485
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col3, style] }, children);
379
486
  };
380
487
  var Col4 = ({ children, style }) => {
381
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col4, style] }, children);
488
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col4, style] }, children);
382
489
  };
383
490
  var Col5 = ({ children, style }) => {
384
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col5, style] }, children);
491
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col5, style] }, children);
385
492
  };
386
493
  var Col6 = ({ children, style }) => {
387
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col6, style] }, children);
494
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col6, style] }, children);
388
495
  };
389
496
  var Col7 = ({ children, style }) => {
390
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col7, style] }, children);
497
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col7, style] }, children);
391
498
  };
392
499
  var Col8 = ({ children, style }) => {
393
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col8, style] }, children);
500
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col8, style] }, children);
394
501
  };
395
502
  var Col9 = ({ children, style }) => {
396
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col9, style] }, children);
503
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col9, style] }, children);
397
504
  };
398
505
  var Col10 = ({ children, style }) => {
399
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col10, style] }, children);
506
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col10, style] }, children);
400
507
  };
401
508
  var Col11 = ({ children, style }) => {
402
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col11, style] }, children);
509
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col11, style] }, children);
403
510
  };
404
511
  var Col12 = ({ children, style }) => {
405
- return /* @__PURE__ */ React6.createElement(View3, { style: [styles6.col, styles6.col12, style] }, children);
406
- };
407
-
408
- // src/components/core/PageElements.tsx
409
- import React7 from "react";
410
- import { Text as Text4, View as View4, StyleSheet as StyleSheet7 } from "@react-pdf/renderer";
411
- var styles7 = StyleSheet7.create({
412
- header: {
413
- position: "absolute",
414
- top: 20,
415
- left: 0,
416
- right: 0,
417
- textAlign: "center",
418
- fontSize: 10,
419
- color: "#666",
420
- paddingHorizontal: 40
421
- },
422
- footer: {
423
- position: "absolute",
424
- bottom: 20,
425
- left: 0,
426
- right: 0,
427
- textAlign: "center",
428
- fontSize: 10,
429
- color: "#666",
430
- paddingHorizontal: 40
431
- }
432
- });
433
- var Header = ({ children, style, fixed = false }) => {
434
- return /* @__PURE__ */ React7.createElement(View4, { style: [styles7.header, style], fixed }, typeof children === "string" ? /* @__PURE__ */ React7.createElement(Text4, null, children) : children);
435
- };
436
- var Footer = ({ children, style, fixed = false }) => {
437
- return /* @__PURE__ */ React7.createElement(View4, { style: [styles7.footer, style], fixed }, typeof children === "string" ? /* @__PURE__ */ React7.createElement(Text4, null, children) : children);
512
+ return /* @__PURE__ */ React6.createElement(View5, { style: [styles6.col, styles6.col12, style] }, children);
438
513
  };
439
514
 
440
515
  // src/components/core/QR.tsx
441
- import React8 from "react";
442
- import { Image as Image3, StyleSheet as StyleSheet8, View as View5 } from "@react-pdf/renderer";
516
+ import React7 from "react";
517
+ import { Image as Image3, StyleSheet as StyleSheet7, View as View6 } from "@react-pdf/renderer";
443
518
  import { useEffect, useState } from "react";
444
519
 
445
520
  // src/components/core/QRGenerator.tsx
@@ -520,7 +595,7 @@ var addLogoToQR = async (qrDataUrl, logoUrl, logoWidth, logoHeight) => {
520
595
  };
521
596
 
522
597
  // src/components/core/QR.tsx
523
- var styles8 = StyleSheet8.create({
598
+ var styles7 = StyleSheet7.create({
524
599
  qrContainer: {
525
600
  display: "flex",
526
601
  alignItems: "center",
@@ -579,14 +654,14 @@ var QR = ({
579
654
  const fallbackUrl = `https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(
580
655
  value
581
656
  )}&size=${size}x${size}`;
582
- return /* @__PURE__ */ React8.createElement(View5, { style: [styles8.qrContainer, style] }, /* @__PURE__ */ React8.createElement(Image3, { src: qrDataUrl || fallbackUrl, style: { width: size, height: size } }));
657
+ return /* @__PURE__ */ React7.createElement(View6, { style: [styles7.qrContainer, style] }, /* @__PURE__ */ React7.createElement(Image3, { src: qrDataUrl || fallbackUrl, style: { width: size, height: size } }));
583
658
  };
584
659
  var QR_default = QR;
585
660
 
586
661
  // src/components/core/Lista.tsx
587
- import React9 from "react";
588
- import { View as View6, Text as Text5, StyleSheet as StyleSheet9 } from "@react-pdf/renderer";
589
- var styles9 = StyleSheet9.create({
662
+ import React8 from "react";
663
+ import { View as View7, Text as Text4, StyleSheet as StyleSheet8 } from "@react-pdf/renderer";
664
+ var styles8 = StyleSheet8.create({
590
665
  ul: {
591
666
  marginBottom: 10,
592
667
  paddingLeft: 15
@@ -646,9 +721,9 @@ var toRoman = (num) => {
646
721
  return romanNumerals[3][Math.floor(num / 1e3)] + romanNumerals[2][Math.floor(num % 1e3 / 100)] + romanNumerals[1][Math.floor(num % 100 / 10)] + romanNumerals[0][num % 10];
647
722
  };
648
723
  var UL = ({ children, style, type = "disc" }) => {
649
- const childrenWithBullets = React9.Children.map(children, (child, index) => {
650
- if (React9.isValidElement(child)) {
651
- return React9.cloneElement(child, {
724
+ const childrenWithBullets = React8.Children.map(children, (child, index) => {
725
+ if (React8.isValidElement(child)) {
726
+ return React8.cloneElement(child, {
652
727
  bulletType: type,
653
728
  isOrdered: false,
654
729
  index: index + 1
@@ -656,12 +731,12 @@ var UL = ({ children, style, type = "disc" }) => {
656
731
  }
657
732
  return child;
658
733
  });
659
- return /* @__PURE__ */ React9.createElement(View6, { style: [styles9.ul, style] }, childrenWithBullets);
734
+ return /* @__PURE__ */ React8.createElement(View7, { style: [styles8.ul, style] }, childrenWithBullets);
660
735
  };
661
736
  var OL = ({ children, style, type = "decimal", start = 1 }) => {
662
- const childrenWithNumbers = React9.Children.map(children, (child, index) => {
663
- if (React9.isValidElement(child)) {
664
- return React9.cloneElement(child, {
737
+ const childrenWithNumbers = React8.Children.map(children, (child, index) => {
738
+ if (React8.isValidElement(child)) {
739
+ return React8.cloneElement(child, {
665
740
  bulletType: type,
666
741
  isOrdered: true,
667
742
  index: index + 1,
@@ -670,7 +745,7 @@ var OL = ({ children, style, type = "decimal", start = 1 }) => {
670
745
  }
671
746
  return child;
672
747
  });
673
- return /* @__PURE__ */ React9.createElement(View6, { style: [styles9.ol, style] }, childrenWithNumbers);
748
+ return /* @__PURE__ */ React8.createElement(View7, { style: [styles8.ol, style] }, childrenWithNumbers);
674
749
  };
675
750
  var LI = ({ children, style, bulletType = "disc", isOrdered = false, index = 1, start = 1, value }) => {
676
751
  let marker;
@@ -680,11 +755,11 @@ var LI = ({ children, style, bulletType = "disc", isOrdered = false, index = 1,
680
755
  } else {
681
756
  marker = getBulletPoint(bulletType);
682
757
  }
683
- return /* @__PURE__ */ React9.createElement(View6, { style: [styles9.li, style] }, /* @__PURE__ */ React9.createElement(Text5, { style: styles9.bulletPoint }, marker), /* @__PURE__ */ React9.createElement(View6, { style: styles9.itemContent }, typeof children === "string" ? /* @__PURE__ */ React9.createElement(Text5, null, children) : children));
758
+ return /* @__PURE__ */ React8.createElement(View7, { style: [styles8.li, style] }, /* @__PURE__ */ React8.createElement(Text4, { style: styles8.bulletPoint }, marker), /* @__PURE__ */ React8.createElement(View7, { style: styles8.itemContent }, typeof children === "string" ? /* @__PURE__ */ React8.createElement(Text4, null, children) : children));
684
759
  };
685
760
 
686
761
  // src/components/core/index.tsx
687
- import { View as View7, Text as Text6, StyleSheet as StyleSheet10, Font } from "@react-pdf/renderer";
762
+ import { View as View8, Text as Text5, StyleSheet as StyleSheet9, Font } from "@react-pdf/renderer";
688
763
 
689
764
  // src/functions/decodeBase64Pdf.ts
690
765
  var decodeBase64Pdf = (base64, fileName) => {
@@ -755,7 +830,6 @@ export {
755
830
  Container,
756
831
  Em,
757
832
  Font,
758
- Footer,
759
833
  H1,
760
834
  H2,
761
835
  H3,
@@ -776,17 +850,17 @@ export {
776
850
  Small,
777
851
  Span,
778
852
  Strong,
779
- StyleSheet10 as StyleSheet,
853
+ StyleSheet9 as StyleSheet,
780
854
  Table,
781
855
  Tbody,
782
856
  Td,
783
- Text6 as Text,
857
+ Text5 as Text,
784
858
  Th,
785
859
  Thead,
786
860
  Tr,
787
861
  U,
788
862
  UL,
789
- View7 as View,
863
+ View8 as View,
790
864
  decodeBase64Pdf_default as decodeBase64Pdf,
791
865
  generatePDF_default as generatePDF
792
866
  };
package/license ADDED
@@ -0,0 +1,17 @@
1
+ MIT License
2
+ Copyright (c) 2025 react-pdf-levelup
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+ The above copyright notice and this permission notice shall be included in all
10
+ copies or substantial portions of the Software.
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-pdf-levelup",
3
- "version": "2.0.33",
3
+ "version": "3.1.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -17,7 +17,7 @@
17
17
  "clean-dist": "rimraf dist",
18
18
  "build-lib": "npm run clean-dist && tsup",
19
19
  "publicar": "npm run upVersion && npm run update-jsx && npm run build-lib && npm publish",
20
- "demo": "ts-node ./src/useExample/index.ts"
20
+ "demo": "tsx ./src/useExample/index.ts"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@react-pdf/renderer": "^4.3.0",
@@ -28,9 +28,12 @@
28
28
  "dependencies": {
29
29
  "@babel/standalone": "^7.23.10",
30
30
  "@monaco-editor/react": "^4.7.0",
31
+ "canvas": "^3.1.2",
31
32
  "i": "^0.3.7",
33
+ "jsdom": "^26.1.0",
32
34
  "lucide-react": "^0.485.0",
33
35
  "npm": "^11.3.0",
36
+ "qr-code-styling": "^1.9.2",
34
37
  "react-router-dom": "^7.4.1",
35
38
  "rimraf": "^6.0.1",
36
39
  "ts-node": "^10.9.2"
@@ -38,6 +41,7 @@
38
41
  "devDependencies": {
39
42
  "@eslint/js": "^9.21.0",
40
43
  "@react-pdf/types": "^2.9.0",
44
+ "@types/jsdom": "^21.1.7",
41
45
  "@types/qrcode": "^1.5.5",
42
46
  "@types/react": "^18.2.56",
43
47
  "@types/react-dom": "^18.2.19",
@@ -49,6 +53,7 @@
49
53
  "json": "^11.0.0",
50
54
  "react-pdf-levelup": "^2.0.18",
51
55
  "tsup": "^8.4.0",
56
+ "tsx": "^4.20.3",
52
57
  "typescript": "~5.7.2",
53
58
  "typescript-eslint": "^8.24.1",
54
59
  "vite": "^6.2.0"