@aspprev/versi-ds 0.1.1 → 0.3.0

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,45 +0,0 @@
1
- // src/components/barcode/barcode.tsx
2
- import JsBarcode from "jsbarcode";
3
- import { useEffect, useRef } from "react";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- var linhaDigitavelParaCodigoBarras = (linha) => {
6
- const d = linha.replace(/\D/g, "");
7
- const banco = d.substring(0, 3);
8
- const moeda = d.substring(3, 4);
9
- const campo1 = d.substring(4, 9);
10
- const campo2 = d.substring(10, 20);
11
- const campo3 = d.substring(21, 31);
12
- const digitoGeral = d.substring(32, 33);
13
- const vencimento = d.substring(33, 37);
14
- const valor = d.substring(37, 47);
15
- return banco + moeda + digitoGeral + vencimento + valor + campo1 + campo2 + campo3;
16
- };
17
- function BoletoBarCode({ linhaDigitavel }) {
18
- const svgRef = useRef(null);
19
- useEffect(() => {
20
- if (!svgRef.current) return;
21
- try {
22
- const codigoBarras = linhaDigitavelParaCodigoBarras(linhaDigitavel);
23
- JsBarcode(svgRef.current, codigoBarras, {
24
- format: "ITF",
25
- lineColor: "#000000",
26
- background: "#FFFFFF",
27
- displayValue: false,
28
- width: 2,
29
- height: 80,
30
- margin: 0
31
- });
32
- } catch (error) {
33
- console.error("Erro ao gerar c\xF3digo de barras:", error);
34
- }
35
- }, [linhaDigitavel]);
36
- return /* @__PURE__ */ jsxs("div", { className: "w-full space-y-3 bg-surface-card", children: [
37
- /* @__PURE__ */ jsx("svg", { ref: svgRef, className: "w-full" }),
38
- /* @__PURE__ */ jsx("p", { className: "text-center font-mono text-sm tracking-widest text-content-primary", children: linhaDigitavel })
39
- ] });
40
- }
41
-
42
- export {
43
- BoletoBarCode
44
- };
45
- //# sourceMappingURL=chunk-TESAXMCF.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/barcode/barcode.tsx"],"sourcesContent":["\"use client\";\n\nimport JsBarcode from \"jsbarcode\";\nimport { useEffect, useRef } from \"react\";\n\nconst linhaDigitavelParaCodigoBarras = (linha: string): string => {\n const d = linha.replace(/\\D/g, \"\");\n\n const banco = d.substring(0, 3);\n const moeda = d.substring(3, 4);\n const campo1 = d.substring(4, 9);\n const campo2 = d.substring(10, 20);\n const campo3 = d.substring(21, 31);\n const digitoGeral = d.substring(32, 33);\n const vencimento = d.substring(33, 37);\n const valor = d.substring(37, 47);\n\n return (\n banco + moeda + digitoGeral + vencimento + valor + campo1 + campo2 + campo3\n );\n};\n\nexport interface BoletoBarCodeProps {\n linhaDigitavel: string;\n}\n\nexport function BoletoBarCode({ linhaDigitavel }: BoletoBarCodeProps) {\n const svgRef = useRef<SVGSVGElement>(null);\n\n useEffect(() => {\n if (!svgRef.current) return;\n\n try {\n const codigoBarras = linhaDigitavelParaCodigoBarras(linhaDigitavel);\n\n JsBarcode(svgRef.current, codigoBarras, {\n format: \"ITF\",\n lineColor: \"#000000\",\n background: \"#FFFFFF\",\n displayValue: false,\n width: 2,\n height: 80,\n margin: 0,\n });\n } catch (error) {\n console.error(\"Erro ao gerar código de barras:\", error);\n }\n }, [linhaDigitavel]);\n\n return (\n <div className=\"w-full space-y-3 bg-surface-card\">\n <svg ref={svgRef} className=\"w-full\" />\n <p className=\"text-center font-mono text-sm tracking-widest text-content-primary\">\n {linhaDigitavel}\n </p>\n </div>\n );\n}\n\n"],"mappings":";AAEA,OAAO,eAAe;AACtB,SAAS,WAAW,cAAc;AA+C9B,SACE,KADF;AA7CJ,IAAM,iCAAiC,CAAC,UAA0B;AAChE,QAAM,IAAI,MAAM,QAAQ,OAAO,EAAE;AAEjC,QAAM,QAAQ,EAAE,UAAU,GAAG,CAAC;AAC9B,QAAM,QAAQ,EAAE,UAAU,GAAG,CAAC;AAC9B,QAAM,SAAS,EAAE,UAAU,GAAG,CAAC;AAC/B,QAAM,SAAS,EAAE,UAAU,IAAI,EAAE;AACjC,QAAM,SAAS,EAAE,UAAU,IAAI,EAAE;AACjC,QAAM,cAAc,EAAE,UAAU,IAAI,EAAE;AACtC,QAAM,aAAa,EAAE,UAAU,IAAI,EAAE;AACrC,QAAM,QAAQ,EAAE,UAAU,IAAI,EAAE;AAEhC,SACE,QAAQ,QAAQ,cAAc,aAAa,QAAQ,SAAS,SAAS;AAEzE;AAMO,SAAS,cAAc,EAAE,eAAe,GAAuB;AACpE,QAAM,SAAS,OAAsB,IAAI;AAEzC,YAAU,MAAM;AACd,QAAI,CAAC,OAAO,QAAS;AAErB,QAAI;AACF,YAAM,eAAe,+BAA+B,cAAc;AAElE,gBAAU,OAAO,SAAS,cAAc;AAAA,QACtC,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,cAAc;AAAA,QACd,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,QAAQ;AAAA,MACV,CAAC;AAAA,IACH,SAAS,OAAO;AACd,cAAQ,MAAM,sCAAmC,KAAK;AAAA,IACxD;AAAA,EACF,GAAG,CAAC,cAAc,CAAC;AAEnB,SACE,qBAAC,SAAI,WAAU,oCACb;AAAA,wBAAC,SAAI,KAAK,QAAQ,WAAU,UAAS;AAAA,IACrC,oBAAC,OAAE,WAAU,sEACV,0BACH;AAAA,KACF;AAEJ;","names":[]}