@react-pdf-levelup/qr 1.1.3 → 1.1.5
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/README.md +21 -16
- package/package.json +2 -9
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://genarogg.github.io/media/react-pdf-levelup/logo-de-react-pdf-levelup.png" alt="react-pdf-levelup logo" width="160" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
1
|
# `@react-pdf-levelup/qr`
|
|
6
2
|
|
|
7
3
|
> Paquete de componentes y utilidades para generar códigos QR estilizados dentro de plantillas PDF (React + `@react-pdf/renderer`) y en el frontend.
|
|
8
4
|
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://genarogg.github.io/media/react-pdf-levelup/logo-de-react-pdf-levelup.png" alt="react-pdf-levelup logo" width="160" />
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
9
|
## Instalación
|
|
10
10
|
|
|
11
11
|
```bash
|
|
@@ -20,9 +20,9 @@ npm install @react-pdf-levelup/qr
|
|
|
20
20
|
## Uso en plantillas PDF (ejemplo mínimo)
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
|
-
import React from
|
|
24
|
-
import { Document, Page } from
|
|
25
|
-
import { QR } from
|
|
23
|
+
import React from "react";
|
|
24
|
+
import { Document, Page } from "@react-pdf/renderer";
|
|
25
|
+
import { QR } from "@react-pdf-levelup/qr";
|
|
26
26
|
|
|
27
27
|
const MyPdfTemplate = ({ data }) => (
|
|
28
28
|
<Document>
|
|
@@ -37,6 +37,7 @@ export default MyPdfTemplate;
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Props comunes de `QR` (ejemplos):
|
|
40
|
+
|
|
40
41
|
- `value` (string): contenido del QR (URL, texto).
|
|
41
42
|
- `size` (number): tamaño en px.
|
|
42
43
|
- `style` (object): estilo generado por `QRStyle` o un objeto inline con colores y forma.
|
|
@@ -44,15 +45,15 @@ Props comunes de `QR` (ejemplos):
|
|
|
44
45
|
## Personalizar apariencia con `QRStyle` (ejemplos)
|
|
45
46
|
|
|
46
47
|
```ts
|
|
47
|
-
import { QRStyle } from
|
|
48
|
+
import { QRStyle } from "@react-pdf-levelup/qr";
|
|
48
49
|
|
|
49
50
|
// Genera un objeto estilo reutilizable
|
|
50
51
|
const style = QRStyle({
|
|
51
|
-
dotColor:
|
|
52
|
-
backgroundColor:
|
|
53
|
-
eyeColor:
|
|
52
|
+
dotColor: "#0b74de",
|
|
53
|
+
backgroundColor: "#ffffff",
|
|
54
|
+
eyeColor: "#0b74de",
|
|
54
55
|
eyeRadius: 4,
|
|
55
|
-
dotShape:
|
|
56
|
+
dotShape: "rounded",
|
|
56
57
|
});
|
|
57
58
|
|
|
58
59
|
// Usarlo en el componente QR
|
|
@@ -64,12 +65,15 @@ const style = QRStyle({
|
|
|
64
65
|
Frontend (vista previa y generación):
|
|
65
66
|
|
|
66
67
|
```tsx
|
|
67
|
-
import React from
|
|
68
|
-
import { QRGenerator, QRstyleGenerator } from
|
|
68
|
+
import React from "react";
|
|
69
|
+
import { QRGenerator, QRstyleGenerator } from "@react-pdf-levelup/qr";
|
|
69
70
|
|
|
70
71
|
function Preview() {
|
|
71
|
-
const qrValue =
|
|
72
|
-
const previewStyle = QRstyleGenerator({
|
|
72
|
+
const qrValue = "https://react-pdf-levelup.nimbux.cloud";
|
|
73
|
+
const previewStyle = QRstyleGenerator({
|
|
74
|
+
dotColor: "#222",
|
|
75
|
+
eyeColor: "#ff6b6b",
|
|
76
|
+
});
|
|
73
77
|
|
|
74
78
|
return (
|
|
75
79
|
<div>
|
|
@@ -83,6 +87,7 @@ export default Preview;
|
|
|
83
87
|
```
|
|
84
88
|
|
|
85
89
|
## Notes
|
|
90
|
+
|
|
86
91
|
- Asegúrate de compilar el paquete (`dist/`) antes de publicar.
|
|
87
92
|
- `QRStyle`/`QRGenerator` APIs pueden variar según la versión; revisa los archivos fuente `frontend/src/components/core/qr` si necesitas adaptar propiedades concretas.
|
|
88
93
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-pdf-levelup/qr",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -13,14 +13,7 @@
|
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
|
-
"
|
|
17
|
-
"build:lib": "tsup --config tsup.config.ts",
|
|
18
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
|
-
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"@react-pdf/renderer": "^4.3.2",
|
|
22
|
-
"react": ">=18 <=19",
|
|
23
|
-
"react-dom": ">=18 <=19"
|
|
16
|
+
"build:lib": "tsup --config tsup.config.ts"
|
|
24
17
|
},
|
|
25
18
|
"dependencies": {
|
|
26
19
|
"jsdom": "^27.4.0",
|