@aspprev/versi-ds 0.1.1 → 0.2.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.
- package/README.md +117 -395
- package/dist/{chunk-CSQXTG32.js → chunk-ET2BGHTO.js} +2 -1
- package/dist/{chunk-5VJ6H62W.js → chunk-FR5W52XU.js} +278 -18
- package/dist/chunk-FR5W52XU.js.map +1 -0
- package/dist/chunk-H4BBKKRZ.js +380 -0
- package/dist/chunk-H4BBKKRZ.js.map +1 -0
- package/dist/{chunk-L5UMGEXV.js → chunk-PIXRKI25.js} +77 -9
- package/dist/chunk-PIXRKI25.js.map +1 -0
- package/dist/core.d.ts +24 -5
- package/dist/core.js +11 -5
- package/dist/documents.d.ts +81 -1
- package/dist/documents.js +13 -3
- package/dist/forms.d.ts +26 -2
- package/dist/forms.js +4 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +26 -8
- package/dist/manifest.json +5 -5
- package/dist/styles.css +1 -1
- package/package.json +19 -17
- package/dist/chunk-5VJ6H62W.js.map +0 -1
- package/dist/chunk-L5UMGEXV.js.map +0 -1
- package/dist/chunk-TESAXMCF.js +0 -45
- package/dist/chunk-TESAXMCF.js.map +0 -1
- /package/dist/{chunk-CSQXTG32.js.map → chunk-ET2BGHTO.js.map} +0 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-2NMEKWO5.js";
|
|
6
|
+
|
|
7
|
+
// src/components/barcode/barcode.tsx
|
|
8
|
+
import JsBarcode from "jsbarcode";
|
|
9
|
+
import { useEffect, useRef } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var linhaDigitavelParaCodigoBarras = (linha) => {
|
|
12
|
+
const d = linha.replace(/\D/g, "");
|
|
13
|
+
const banco = d.substring(0, 3);
|
|
14
|
+
const moeda = d.substring(3, 4);
|
|
15
|
+
const campo1 = d.substring(4, 9);
|
|
16
|
+
const campo2 = d.substring(10, 20);
|
|
17
|
+
const campo3 = d.substring(21, 31);
|
|
18
|
+
const digitoGeral = d.substring(32, 33);
|
|
19
|
+
const vencimento = d.substring(33, 37);
|
|
20
|
+
const valor = d.substring(37, 47);
|
|
21
|
+
return banco + moeda + digitoGeral + vencimento + valor + campo1 + campo2 + campo3;
|
|
22
|
+
};
|
|
23
|
+
function BoletoBarCode({ linhaDigitavel }) {
|
|
24
|
+
const svgRef = useRef(null);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!svgRef.current) return;
|
|
27
|
+
try {
|
|
28
|
+
const codigoBarras = linhaDigitavelParaCodigoBarras(linhaDigitavel);
|
|
29
|
+
JsBarcode(svgRef.current, codigoBarras, {
|
|
30
|
+
format: "ITF",
|
|
31
|
+
lineColor: "#000000",
|
|
32
|
+
background: "#FFFFFF",
|
|
33
|
+
displayValue: false,
|
|
34
|
+
width: 2,
|
|
35
|
+
height: 80,
|
|
36
|
+
margin: 0
|
|
37
|
+
});
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error("Erro ao gerar c\xF3digo de barras:", error);
|
|
40
|
+
}
|
|
41
|
+
}, [linhaDigitavel]);
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full space-y-3 bg-surface-card", children: [
|
|
43
|
+
/* @__PURE__ */ jsx("svg", { ref: svgRef, className: "w-full" }),
|
|
44
|
+
/* @__PURE__ */ jsx("p", { className: "text-center font-mono text-sm tracking-widest text-content-primary", children: linhaDigitavel })
|
|
45
|
+
] });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/components/file-upload/FileDropzone.tsx
|
|
49
|
+
import classNames from "classnames";
|
|
50
|
+
import { useId, useRef as useRef2, useState } from "react";
|
|
51
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
52
|
+
var acceptsFile = (file, accept) => {
|
|
53
|
+
if (!(accept == null ? void 0 : accept.trim())) return true;
|
|
54
|
+
return accept.split(",").map((item) => item.trim().toLowerCase()).some((rule) => {
|
|
55
|
+
if (rule.endsWith("/*")) return file.type.toLowerCase().startsWith(rule.slice(0, -1));
|
|
56
|
+
if (rule.startsWith(".")) return file.name.toLowerCase().endsWith(rule);
|
|
57
|
+
return file.type.toLowerCase() === rule;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
function FileDropzone({
|
|
61
|
+
accept,
|
|
62
|
+
multiple = false,
|
|
63
|
+
maxFiles = multiple ? Number.POSITIVE_INFINITY : 1,
|
|
64
|
+
maxSize,
|
|
65
|
+
disabled = false,
|
|
66
|
+
label = "Selecionar arquivos",
|
|
67
|
+
hint = "Arraste e solte os arquivos aqui ou use o teclado para selecionar.",
|
|
68
|
+
error,
|
|
69
|
+
className,
|
|
70
|
+
onFilesAccepted,
|
|
71
|
+
onFilesRejected
|
|
72
|
+
}) {
|
|
73
|
+
const inputId = useId();
|
|
74
|
+
const messageId = `${inputId}-message`;
|
|
75
|
+
const inputRef = useRef2(null);
|
|
76
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
77
|
+
const processFiles = (fileList) => {
|
|
78
|
+
if (disabled) return;
|
|
79
|
+
const selected = Array.from(fileList);
|
|
80
|
+
const accepted = [];
|
|
81
|
+
const rejected = [];
|
|
82
|
+
selected.forEach((file, index) => {
|
|
83
|
+
const reason = !acceptsFile(file, accept) ? "type" : maxSize !== void 0 && file.size > maxSize ? "size" : index >= maxFiles ? "count" : void 0;
|
|
84
|
+
if (!reason) accepted.push(file);
|
|
85
|
+
else {
|
|
86
|
+
const message2 = reason === "type" ? "Tipo de arquivo n\xE3o permitido." : reason === "size" ? "O arquivo excede o tamanho m\xE1ximo permitido." : "Quantidade m\xE1xima de arquivos excedida.";
|
|
87
|
+
rejected.push({ file, reason, message: message2 });
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (!multiple && accepted.length > 1) accepted.splice(1);
|
|
91
|
+
if (accepted.length) onFilesAccepted == null ? void 0 : onFilesAccepted(accepted);
|
|
92
|
+
if (rejected.length) onFilesRejected == null ? void 0 : onFilesRejected(rejected);
|
|
93
|
+
};
|
|
94
|
+
const handleInputChange = (event) => {
|
|
95
|
+
if (event.target.files) processFiles(event.target.files);
|
|
96
|
+
event.target.value = "";
|
|
97
|
+
};
|
|
98
|
+
const handleDrop = (event) => {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
setIsDragging(false);
|
|
101
|
+
processFiles(event.dataTransfer.files);
|
|
102
|
+
};
|
|
103
|
+
const message = error || hint;
|
|
104
|
+
return /* @__PURE__ */ jsxs2(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
onDragEnter: (event) => {
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
if (!disabled) setIsDragging(true);
|
|
110
|
+
},
|
|
111
|
+
onDragOver: (event) => event.preventDefault(),
|
|
112
|
+
onDragLeave: (event) => {
|
|
113
|
+
if (event.currentTarget === event.target) setIsDragging(false);
|
|
114
|
+
},
|
|
115
|
+
onDrop: handleDrop,
|
|
116
|
+
className: classNames(
|
|
117
|
+
"flex min-h-32 w-full cursor-pointer flex-col items-center justify-center rounded-sm border-2 border-dashed p-6 text-center transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring",
|
|
118
|
+
isDragging ? "border-action-primary bg-primary-1/10" : "border-border-default bg-surface-card hover:border-border-strong",
|
|
119
|
+
disabled && "cursor-not-allowed opacity-60",
|
|
120
|
+
Boolean(error) && "border-field-border-error",
|
|
121
|
+
className
|
|
122
|
+
),
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsxs2("label", { htmlFor: inputId, className: "flex cursor-pointer flex-col items-center focus-within:outline focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-focus-ring", children: [
|
|
125
|
+
/* @__PURE__ */ jsx2("span", { className: "font-semibold text-content-primary", children: label }),
|
|
126
|
+
/* @__PURE__ */ jsx2(
|
|
127
|
+
"input",
|
|
128
|
+
{
|
|
129
|
+
ref: inputRef,
|
|
130
|
+
id: inputId,
|
|
131
|
+
type: "file",
|
|
132
|
+
accept,
|
|
133
|
+
multiple,
|
|
134
|
+
disabled,
|
|
135
|
+
onChange: handleInputChange,
|
|
136
|
+
"aria-describedby": message ? messageId : void 0,
|
|
137
|
+
className: "sr-only"
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
message && /* @__PURE__ */ jsx2("span", { id: messageId, className: classNames("mt-1 text-sm", error ? "text-field-assistive-error" : "text-content-secondary"), children: message })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
var FileDropzone_default = FileDropzone;
|
|
147
|
+
|
|
148
|
+
// src/components/file-upload/FileUploadProgress.tsx
|
|
149
|
+
import classNames2 from "classnames";
|
|
150
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
151
|
+
function FileUploadProgress({
|
|
152
|
+
value,
|
|
153
|
+
label = "Progresso do upload",
|
|
154
|
+
status = "uploading",
|
|
155
|
+
showValue = true,
|
|
156
|
+
className
|
|
157
|
+
}) {
|
|
158
|
+
const resolvedValue = typeof value === "number" ? Math.min(100, Math.max(0, value)) : void 0;
|
|
159
|
+
const statusText = status === "success" ? "Conclu\xEDdo" : status === "error" ? "Erro" : resolvedValue === void 0 ? "Em andamento" : `${Math.round(resolvedValue)}%`;
|
|
160
|
+
return /* @__PURE__ */ jsxs3("div", { className: classNames2("w-full", className), children: [
|
|
161
|
+
/* @__PURE__ */ jsxs3("div", { className: "mb-1 flex items-center justify-between gap-2 text-xs text-content-secondary", children: [
|
|
162
|
+
/* @__PURE__ */ jsx3("span", { children: label }),
|
|
163
|
+
showValue && /* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: statusText })
|
|
164
|
+
] }),
|
|
165
|
+
/* @__PURE__ */ jsx3(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
role: "progressbar",
|
|
169
|
+
"aria-label": label,
|
|
170
|
+
"aria-valuemin": resolvedValue === void 0 ? void 0 : 0,
|
|
171
|
+
"aria-valuemax": resolvedValue === void 0 ? void 0 : 100,
|
|
172
|
+
"aria-valuenow": resolvedValue,
|
|
173
|
+
"aria-valuetext": statusText,
|
|
174
|
+
className: "h-2 w-full overflow-hidden rounded-full bg-surface-muted",
|
|
175
|
+
children: /* @__PURE__ */ jsx3(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
className: classNames2(
|
|
179
|
+
"h-full rounded-full transition-[width] duration-200",
|
|
180
|
+
status === "error" ? "bg-feedback-danger-strong" : "bg-action-primary",
|
|
181
|
+
resolvedValue === void 0 ? "w-1/2 animate-pulse" : void 0
|
|
182
|
+
),
|
|
183
|
+
style: resolvedValue === void 0 ? void 0 : { width: `${resolvedValue}%` }
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
/* @__PURE__ */ jsx3("span", { className: "sr-only", role: "status", "aria-live": "polite", children: statusText })
|
|
189
|
+
] });
|
|
190
|
+
}
|
|
191
|
+
var FileUploadProgress_default = FileUploadProgress;
|
|
192
|
+
|
|
193
|
+
// src/components/file-upload/FileList.tsx
|
|
194
|
+
import classNames3 from "classnames";
|
|
195
|
+
import { MdClose, MdRefresh } from "react-icons/md";
|
|
196
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
197
|
+
var fileId = (item, index) => {
|
|
198
|
+
var _a;
|
|
199
|
+
return (_a = item.id) != null ? _a : `${item.file.name}-${item.file.size}-${item.file.lastModified}-${index}`;
|
|
200
|
+
};
|
|
201
|
+
function FileList({ files, accessibleName = "Arquivos selecionados", onRemove, onRetry, className }) {
|
|
202
|
+
return /* @__PURE__ */ jsx4("ul", { "aria-label": accessibleName, className: classNames3("w-full space-y-2", className), children: files.map((item, index) => {
|
|
203
|
+
var _a;
|
|
204
|
+
const status = (_a = item.status) != null ? _a : "pending";
|
|
205
|
+
const progressStatus = status === "pending" ? "idle" : status;
|
|
206
|
+
return /* @__PURE__ */ jsxs4("li", { className: "flex min-w-0 flex-wrap items-center gap-3 rounded-sm border border-border-default bg-surface-card p-3", children: [
|
|
207
|
+
/* @__PURE__ */ jsxs4("div", { className: "min-w-0 flex-1", children: [
|
|
208
|
+
/* @__PURE__ */ jsx4("p", { className: "truncate font-semibold text-content-primary", title: item.file.name, children: item.file.name }),
|
|
209
|
+
/* @__PURE__ */ jsxs4("p", { className: "text-xs text-content-secondary", children: [
|
|
210
|
+
Math.ceil(item.file.size / 1024),
|
|
211
|
+
" KB"
|
|
212
|
+
] }),
|
|
213
|
+
(status === "uploading" || status === "success" || status === "error") && /* @__PURE__ */ jsx4(FileUploadProgress_default, { value: item.progress, status: progressStatus, label: `Progresso de ${item.file.name}` }),
|
|
214
|
+
item.error && /* @__PURE__ */ jsx4("p", { role: "alert", className: "mt-1 text-sm text-field-assistive-error", children: item.error })
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
217
|
+
status === "error" && onRetry && /* @__PURE__ */ jsx4("button", { type: "button", onClick: () => onRetry(item, index), "aria-label": `Tentar novamente ${item.file.name}`, className: "flex h-11 w-11 items-center justify-center rounded-sm text-content-secondary hover:bg-surface-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring", children: /* @__PURE__ */ jsx4(MdRefresh, { "aria-hidden": "true", className: "h-5 w-5" }) }),
|
|
218
|
+
onRemove && /* @__PURE__ */ jsx4("button", { type: "button", onClick: () => onRemove(item, index), "aria-label": `Remover ${item.file.name}`, className: "flex h-11 w-11 items-center justify-center rounded-sm text-content-secondary hover:bg-surface-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring", children: /* @__PURE__ */ jsx4(MdClose, { "aria-hidden": "true", className: "h-5 w-5" }) })
|
|
219
|
+
] })
|
|
220
|
+
] }, fileId(item, index));
|
|
221
|
+
}) });
|
|
222
|
+
}
|
|
223
|
+
var FileList_default = FileList;
|
|
224
|
+
|
|
225
|
+
// src/components/file-upload/FileViewer.tsx
|
|
226
|
+
import classNames4 from "classnames";
|
|
227
|
+
import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
|
|
228
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
229
|
+
var extensionType = (fileName) => {
|
|
230
|
+
var _a;
|
|
231
|
+
const extension = (_a = fileName == null ? void 0 : fileName.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
232
|
+
if (extension === "pdf") return "application/pdf";
|
|
233
|
+
if (["png", "jpg", "jpeg", "gif", "webp", "svg"].includes(extension != null ? extension : "")) return `image/${extension === "jpg" ? "jpeg" : extension}`;
|
|
234
|
+
if (["txt", "csv", "json", "xml", "md"].includes(extension != null ? extension : "")) return "text/plain";
|
|
235
|
+
return "application/octet-stream";
|
|
236
|
+
};
|
|
237
|
+
function FileViewer({ source, fileName, contentType, loading = false, error, onDownload, fallback, title = fileName != null ? fileName : "Visualiza\xE7\xE3o do arquivo", className }) {
|
|
238
|
+
var _a, _b;
|
|
239
|
+
const [objectUrl, setObjectUrl] = useState2();
|
|
240
|
+
const [textContent, setTextContent] = useState2();
|
|
241
|
+
const resolved = typeof source === "object" && source !== null && !(source instanceof Blob) ? source : void 0;
|
|
242
|
+
const blob = source instanceof Blob ? source : resolved == null ? void 0 : resolved.blob;
|
|
243
|
+
const url = typeof source === "string" ? source : resolved == null ? void 0 : resolved.url;
|
|
244
|
+
const resolvedName = fileName != null ? fileName : resolved == null ? void 0 : resolved.fileName;
|
|
245
|
+
const resolvedType = (_b = (_a = contentType != null ? contentType : resolved == null ? void 0 : resolved.contentType) != null ? _a : blob == null ? void 0 : blob.type) != null ? _b : extensionType(resolvedName);
|
|
246
|
+
useEffect2(() => {
|
|
247
|
+
if (!blob) {
|
|
248
|
+
setObjectUrl(void 0);
|
|
249
|
+
setTextContent(void 0);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const nextUrl = URL.createObjectURL(blob);
|
|
253
|
+
setObjectUrl(nextUrl);
|
|
254
|
+
let active = true;
|
|
255
|
+
if (resolvedType.startsWith("text/") || resolvedType === "application/json") {
|
|
256
|
+
blob.text().then((text) => {
|
|
257
|
+
if (active) setTextContent(text);
|
|
258
|
+
});
|
|
259
|
+
} else {
|
|
260
|
+
setTextContent(void 0);
|
|
261
|
+
}
|
|
262
|
+
return () => {
|
|
263
|
+
active = false;
|
|
264
|
+
URL.revokeObjectURL(nextUrl);
|
|
265
|
+
};
|
|
266
|
+
}, [blob, resolvedType]);
|
|
267
|
+
const displayUrl = objectUrl != null ? objectUrl : url;
|
|
268
|
+
const downloadUrl = useMemo(() => displayUrl, [displayUrl]);
|
|
269
|
+
if (loading) return /* @__PURE__ */ jsx5("div", { className: classNames4("flex min-h-32 items-center justify-center rounded-sm border border-border-default bg-surface-card p-6 text-content-secondary", className), role: "status", "aria-live": "polite", children: "Carregando arquivo\u2026" });
|
|
270
|
+
if (error) return /* @__PURE__ */ jsx5("div", { className: classNames4("rounded-sm border border-field-border-error bg-surface-card p-4 text-field-assistive-error", className), role: "alert", children: error });
|
|
271
|
+
if (!displayUrl && !textContent) return /* @__PURE__ */ jsx5("div", { className: classNames4("rounded-sm border border-border-default bg-surface-card p-4 text-content-secondary", className), children: fallback != null ? fallback : "Arquivo indispon\xEDvel." });
|
|
272
|
+
const download = onDownload ? /* @__PURE__ */ jsx5("button", { type: "button", onClick: onDownload, className: "min-h-11 rounded-sm border border-border-default px-3 text-sm font-semibold text-content-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring", children: "Baixar arquivo" }) : downloadUrl ? /* @__PURE__ */ jsx5("a", { href: downloadUrl, download: resolvedName, className: "inline-flex min-h-11 items-center rounded-sm border border-border-default px-3 text-sm font-semibold text-content-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring", children: "Baixar arquivo" }) : null;
|
|
273
|
+
return /* @__PURE__ */ jsxs5("div", { className: classNames4("flex min-w-0 flex-col gap-3 rounded-sm border border-border-default bg-surface-card p-3", className), children: [
|
|
274
|
+
resolvedType.startsWith("image/") && displayUrl && /* @__PURE__ */ jsx5("img", { src: displayUrl, alt: title, className: "max-h-[70vh] max-w-full object-contain" }),
|
|
275
|
+
resolvedType === "application/pdf" && displayUrl && /* @__PURE__ */ jsx5("iframe", { src: displayUrl, title, className: "min-h-[32rem] w-full border-0" }),
|
|
276
|
+
(resolvedType.startsWith("text/") || resolvedType === "application/json") && (textContent !== void 0 ? /* @__PURE__ */ jsx5("pre", { className: "max-h-[70vh] overflow-auto whitespace-pre-wrap break-words text-sm text-content-primary", children: textContent }) : displayUrl && /* @__PURE__ */ jsx5("iframe", { src: displayUrl, title, sandbox: "", className: "min-h-64 w-full border-0" })),
|
|
277
|
+
!resolvedType.startsWith("image/") && resolvedType !== "application/pdf" && !resolvedType.startsWith("text/") && resolvedType !== "application/json" && (fallback != null ? fallback : /* @__PURE__ */ jsx5("p", { className: "text-content-secondary", children: "Este tipo de arquivo n\xE3o possui visualiza\xE7\xE3o dispon\xEDvel." })),
|
|
278
|
+
download && /* @__PURE__ */ jsx5("div", { className: "flex justify-end", children: download })
|
|
279
|
+
] });
|
|
280
|
+
}
|
|
281
|
+
var FileViewer_default = FileViewer;
|
|
282
|
+
|
|
283
|
+
// src/components/qr-code/QRCode.tsx
|
|
284
|
+
import QRCodeGenerator from "qrcode";
|
|
285
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
286
|
+
import classNames5 from "classnames";
|
|
287
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
288
|
+
function getRelativeLuminance(color) {
|
|
289
|
+
const match = color.trim().match(/^#([\da-f]{6})$/i);
|
|
290
|
+
if (!match) return null;
|
|
291
|
+
const channels = [0, 2, 4].map((offset) => Number.parseInt(match[1].slice(offset, offset + 2), 16) / 255);
|
|
292
|
+
const linear = channels.map((channel) => channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4);
|
|
293
|
+
return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2];
|
|
294
|
+
}
|
|
295
|
+
function resolveAccessibleColors(fgColor, bgColor) {
|
|
296
|
+
const foregroundLuminance = getRelativeLuminance(fgColor);
|
|
297
|
+
const backgroundLuminance = getRelativeLuminance(bgColor);
|
|
298
|
+
if (foregroundLuminance === null || backgroundLuminance === null) {
|
|
299
|
+
return { dark: fgColor, light: bgColor };
|
|
300
|
+
}
|
|
301
|
+
const lighter = Math.max(foregroundLuminance, backgroundLuminance);
|
|
302
|
+
const darker = Math.min(foregroundLuminance, backgroundLuminance);
|
|
303
|
+
const contrastRatio = (lighter + 0.05) / (darker + 0.05);
|
|
304
|
+
return contrastRatio >= 3 ? { dark: fgColor, light: bgColor } : { dark: "#000000", light: "#FFFFFF" };
|
|
305
|
+
}
|
|
306
|
+
function QRCode(_a) {
|
|
307
|
+
var _b = _a, {
|
|
308
|
+
value,
|
|
309
|
+
size = 192,
|
|
310
|
+
level = "M",
|
|
311
|
+
includeMargin = true,
|
|
312
|
+
fgColor = "#000000",
|
|
313
|
+
bgColor = "#FFFFFF",
|
|
314
|
+
ariaLabel = "C\xF3digo QR",
|
|
315
|
+
description,
|
|
316
|
+
className
|
|
317
|
+
} = _b, rest = __objRest(_b, [
|
|
318
|
+
"value",
|
|
319
|
+
"size",
|
|
320
|
+
"level",
|
|
321
|
+
"includeMargin",
|
|
322
|
+
"fgColor",
|
|
323
|
+
"bgColor",
|
|
324
|
+
"ariaLabel",
|
|
325
|
+
"description",
|
|
326
|
+
"className"
|
|
327
|
+
]);
|
|
328
|
+
var _a2;
|
|
329
|
+
const [dataUrl, setDataUrl] = useState3(null);
|
|
330
|
+
const descriptionId = description ? `${(_a2 = rest.id) != null ? _a2 : "qr-code"}-description` : void 0;
|
|
331
|
+
const colors = resolveAccessibleColors(fgColor, bgColor);
|
|
332
|
+
useEffect3(() => {
|
|
333
|
+
let active = true;
|
|
334
|
+
setDataUrl(null);
|
|
335
|
+
QRCodeGenerator.toDataURL(value, {
|
|
336
|
+
width: size,
|
|
337
|
+
margin: includeMargin ? 4 : 0,
|
|
338
|
+
errorCorrectionLevel: level,
|
|
339
|
+
color: colors
|
|
340
|
+
}).then((url) => {
|
|
341
|
+
if (active) setDataUrl(url);
|
|
342
|
+
}).catch(() => {
|
|
343
|
+
if (active) setDataUrl(null);
|
|
344
|
+
});
|
|
345
|
+
return () => {
|
|
346
|
+
active = false;
|
|
347
|
+
};
|
|
348
|
+
}, [bgColor, fgColor, includeMargin, level, size, value]);
|
|
349
|
+
return /* @__PURE__ */ jsxs6(
|
|
350
|
+
"div",
|
|
351
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
352
|
+
role: "img",
|
|
353
|
+
"aria-label": ariaLabel,
|
|
354
|
+
"aria-describedby": descriptionId,
|
|
355
|
+
className: classNames5("inline-flex max-w-full flex-col items-center gap-2", className),
|
|
356
|
+
children: [
|
|
357
|
+
dataUrl ? /* @__PURE__ */ jsx6("img", { src: dataUrl, alt: "", width: size, height: size, className: "h-auto max-w-full" }) : /* @__PURE__ */ jsx6(
|
|
358
|
+
"span",
|
|
359
|
+
{
|
|
360
|
+
"aria-hidden": "true",
|
|
361
|
+
className: "inline-block animate-pulse rounded-sm bg-surface-muted",
|
|
362
|
+
style: { width: size, height: size, maxWidth: "100%" }
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
description && /* @__PURE__ */ jsx6("span", { id: descriptionId, className: "sr-only", children: description })
|
|
366
|
+
]
|
|
367
|
+
})
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
var QRCode_default = QRCode;
|
|
371
|
+
|
|
372
|
+
export {
|
|
373
|
+
BoletoBarCode,
|
|
374
|
+
FileDropzone_default,
|
|
375
|
+
FileUploadProgress_default,
|
|
376
|
+
FileList_default,
|
|
377
|
+
FileViewer_default,
|
|
378
|
+
QRCode_default
|
|
379
|
+
};
|
|
380
|
+
//# sourceMappingURL=chunk-H4BBKKRZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/barcode/barcode.tsx","../src/components/file-upload/FileDropzone.tsx","../src/components/file-upload/FileUploadProgress.tsx","../src/components/file-upload/FileList.tsx","../src/components/file-upload/FileViewer.tsx","../src/components/qr-code/QRCode.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","\"use client\";\n\nimport classNames from \"classnames\";\nimport { useId, useRef, useState, type ChangeEvent, type DragEvent, type ReactNode } from \"react\";\n\nexport interface FileRejection {\n file: File;\n reason: \"type\" | \"size\" | \"count\";\n message: string;\n}\n\nexport interface FileDropzoneProps {\n accept?: string;\n multiple?: boolean;\n maxFiles?: number;\n maxSize?: number;\n disabled?: boolean;\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n className?: string;\n onFilesAccepted?: (files: File[]) => void;\n onFilesRejected?: (rejections: FileRejection[]) => void;\n}\n\nconst acceptsFile = (file: File, accept?: string) => {\n if (!accept?.trim()) return true;\n return accept.split(\",\").map((item) => item.trim().toLowerCase()).some((rule) => {\n if (rule.endsWith(\"/*\")) return file.type.toLowerCase().startsWith(rule.slice(0, -1));\n if (rule.startsWith(\".\")) return file.name.toLowerCase().endsWith(rule);\n return file.type.toLowerCase() === rule;\n });\n};\n\nexport function FileDropzone({\n accept,\n multiple = false,\n maxFiles = multiple ? Number.POSITIVE_INFINITY : 1,\n maxSize,\n disabled = false,\n label = \"Selecionar arquivos\",\n hint = \"Arraste e solte os arquivos aqui ou use o teclado para selecionar.\",\n error,\n className,\n onFilesAccepted,\n onFilesRejected,\n}: FileDropzoneProps) {\n const inputId = useId();\n const messageId = `${inputId}-message`;\n const inputRef = useRef<HTMLInputElement>(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const processFiles = (fileList: FileList | File[]) => {\n if (disabled) return;\n const selected = Array.from(fileList);\n const accepted: File[] = [];\n const rejected: FileRejection[] = [];\n selected.forEach((file, index) => {\n const reason = !acceptsFile(file, accept)\n ? \"type\"\n : maxSize !== undefined && file.size > maxSize\n ? \"size\"\n : index >= maxFiles\n ? \"count\"\n : undefined;\n if (!reason) accepted.push(file);\n else {\n const message = reason === \"type\"\n ? \"Tipo de arquivo não permitido.\"\n : reason === \"size\"\n ? \"O arquivo excede o tamanho máximo permitido.\"\n : \"Quantidade máxima de arquivos excedida.\";\n rejected.push({ file, reason, message });\n }\n });\n if (!multiple && accepted.length > 1) accepted.splice(1);\n if (accepted.length) onFilesAccepted?.(accepted);\n if (rejected.length) onFilesRejected?.(rejected);\n };\n\n const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (event.target.files) processFiles(event.target.files);\n event.target.value = \"\";\n };\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n setIsDragging(false);\n processFiles(event.dataTransfer.files);\n };\n const message = error || hint;\n\n return (\n <div\n onDragEnter={(event) => { event.preventDefault(); if (!disabled) setIsDragging(true); }}\n onDragOver={(event) => event.preventDefault()}\n onDragLeave={(event) => { if (event.currentTarget === event.target) setIsDragging(false); }}\n onDrop={handleDrop}\n className={classNames(\n \"flex min-h-32 w-full cursor-pointer flex-col items-center justify-center rounded-sm border-2 border-dashed p-6 text-center transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring\",\n isDragging ? \"border-action-primary bg-primary-1/10\" : \"border-border-default bg-surface-card hover:border-border-strong\",\n disabled && \"cursor-not-allowed opacity-60\",\n Boolean(error) && \"border-field-border-error\",\n className,\n )}\n >\n <label htmlFor={inputId} className=\"flex cursor-pointer flex-col items-center focus-within:outline focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-focus-ring\">\n <span className=\"font-semibold text-content-primary\">{label}</span>\n <input\n ref={inputRef}\n id={inputId}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={handleInputChange}\n aria-describedby={message ? messageId : undefined}\n className=\"sr-only\"\n />\n </label>\n {message && <span id={messageId} className={classNames(\"mt-1 text-sm\", error ? \"text-field-assistive-error\" : \"text-content-secondary\")}>{message}</span>}\n </div>\n );\n}\n\nexport default FileDropzone;\n","\"use client\";\n\nimport classNames from \"classnames\";\n\nexport type FileUploadProgressStatus = \"idle\" | \"uploading\" | \"success\" | \"error\";\n\nexport interface FileUploadProgressProps {\n value?: number | null;\n label?: string;\n status?: FileUploadProgressStatus;\n showValue?: boolean;\n className?: string;\n}\n\nexport function FileUploadProgress({\n value,\n label = \"Progresso do upload\",\n status = \"uploading\",\n showValue = true,\n className,\n}: FileUploadProgressProps) {\n const resolvedValue = typeof value === \"number\"\n ? Math.min(100, Math.max(0, value))\n : undefined;\n const statusText = status === \"success\"\n ? \"Concluído\"\n : status === \"error\"\n ? \"Erro\"\n : resolvedValue === undefined\n ? \"Em andamento\"\n : `${Math.round(resolvedValue)}%`;\n\n return (\n <div className={classNames(\"w-full\", className)}>\n <div className=\"mb-1 flex items-center justify-between gap-2 text-xs text-content-secondary\">\n <span>{label}</span>\n {showValue && <span aria-hidden=\"true\">{statusText}</span>}\n </div>\n <div\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={resolvedValue === undefined ? undefined : 0}\n aria-valuemax={resolvedValue === undefined ? undefined : 100}\n aria-valuenow={resolvedValue}\n aria-valuetext={statusText}\n className=\"h-2 w-full overflow-hidden rounded-full bg-surface-muted\"\n >\n <div\n className={classNames(\n \"h-full rounded-full transition-[width] duration-200\",\n status === \"error\" ? \"bg-feedback-danger-strong\" : \"bg-action-primary\",\n resolvedValue === undefined ? \"w-1/2 animate-pulse\" : undefined,\n )}\n style={resolvedValue === undefined ? undefined : { width: `${resolvedValue}%` }}\n />\n </div>\n <span className=\"sr-only\" role=\"status\" aria-live=\"polite\">{statusText}</span>\n </div>\n );\n}\n\nexport default FileUploadProgress;\n","\"use client\";\n\nimport classNames from \"classnames\";\nimport { MdClose, MdRefresh } from \"react-icons/md\";\nimport FileUploadProgress, { type FileUploadProgressStatus } from \"./FileUploadProgress\";\n\nexport type FileUploadItemStatus = FileUploadProgressStatus | \"pending\";\n\nexport interface FileUploadItem {\n id?: string;\n file: File;\n progress?: number | null;\n status?: FileUploadItemStatus;\n error?: string;\n}\n\nexport interface FileListProps {\n files: FileUploadItem[];\n accessibleName?: string;\n onRemove?: (item: FileUploadItem, index: number) => void;\n onRetry?: (item: FileUploadItem, index: number) => void;\n className?: string;\n}\n\nconst fileId = (item: FileUploadItem, index: number) => item.id ?? `${item.file.name}-${item.file.size}-${item.file.lastModified}-${index}`;\n\nexport function FileList({ files, accessibleName = \"Arquivos selecionados\", onRemove, onRetry, className }: FileListProps) {\n return (\n <ul aria-label={accessibleName} className={classNames(\"w-full space-y-2\", className)}>\n {files.map((item, index) => {\n const status = item.status ?? \"pending\";\n const progressStatus: FileUploadProgressStatus = status === \"pending\" ? \"idle\" : status;\n return (\n <li key={fileId(item, index)} className=\"flex min-w-0 flex-wrap items-center gap-3 rounded-sm border border-border-default bg-surface-card p-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate font-semibold text-content-primary\" title={item.file.name}>{item.file.name}</p>\n <p className=\"text-xs text-content-secondary\">{Math.ceil(item.file.size / 1024)} KB</p>\n {(status === \"uploading\" || status === \"success\" || status === \"error\") && (\n <FileUploadProgress value={item.progress} status={progressStatus} label={`Progresso de ${item.file.name}`} />\n )}\n {item.error && <p role=\"alert\" className=\"mt-1 text-sm text-field-assistive-error\">{item.error}</p>}\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n {status === \"error\" && onRetry && <button type=\"button\" onClick={() => onRetry(item, index)} aria-label={`Tentar novamente ${item.file.name}`} className=\"flex h-11 w-11 items-center justify-center rounded-sm text-content-secondary hover:bg-surface-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring\"><MdRefresh aria-hidden=\"true\" className=\"h-5 w-5\" /></button>}\n {onRemove && <button type=\"button\" onClick={() => onRemove(item, index)} aria-label={`Remover ${item.file.name}`} className=\"flex h-11 w-11 items-center justify-center rounded-sm text-content-secondary hover:bg-surface-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring\"><MdClose aria-hidden=\"true\" className=\"h-5 w-5\" /></button>}\n </div>\n </li>\n );\n })}\n </ul>\n );\n}\n\nexport default FileList;\n","\"use client\";\n\nimport classNames from \"classnames\";\nimport { useEffect, useMemo, useState, type ReactNode } from \"react\";\n\nexport type FileViewerSource = string | Blob | {\n url?: string;\n blob?: Blob;\n contentType?: string;\n fileName?: string;\n};\n\nexport interface FileViewerProps {\n source?: FileViewerSource;\n fileName?: string;\n contentType?: string;\n loading?: boolean;\n error?: ReactNode;\n onDownload?: () => void;\n fallback?: ReactNode;\n title?: string;\n className?: string;\n}\n\nconst extensionType = (fileName?: string) => {\n const extension = fileName?.split(\".\").pop()?.toLowerCase();\n if (extension === \"pdf\") return \"application/pdf\";\n if ([\"png\", \"jpg\", \"jpeg\", \"gif\", \"webp\", \"svg\"].includes(extension ?? \"\")) return `image/${extension === \"jpg\" ? \"jpeg\" : extension}`;\n if ([\"txt\", \"csv\", \"json\", \"xml\", \"md\"].includes(extension ?? \"\")) return \"text/plain\";\n return \"application/octet-stream\";\n};\n\nexport function FileViewer({ source, fileName, contentType, loading = false, error, onDownload, fallback, title = fileName ?? \"Visualização do arquivo\", className }: FileViewerProps) {\n const [objectUrl, setObjectUrl] = useState<string>();\n const [textContent, setTextContent] = useState<string>();\n const resolved = typeof source === \"object\" && source !== null && !(source instanceof Blob) ? source : undefined;\n const blob = source instanceof Blob ? source : resolved?.blob;\n const url = typeof source === \"string\" ? source : resolved?.url;\n const resolvedName = fileName ?? resolved?.fileName;\n const resolvedType = contentType ?? resolved?.contentType ?? blob?.type ?? extensionType(resolvedName);\n\n useEffect(() => {\n if (!blob) {\n setObjectUrl(undefined);\n setTextContent(undefined);\n return;\n }\n const nextUrl = URL.createObjectURL(blob);\n setObjectUrl(nextUrl);\n let active = true;\n if (resolvedType.startsWith(\"text/\") || resolvedType === \"application/json\") {\n blob.text().then((text) => { if (active) setTextContent(text); });\n } else {\n setTextContent(undefined);\n }\n return () => { active = false; URL.revokeObjectURL(nextUrl); };\n }, [blob, resolvedType]);\n\n const displayUrl = objectUrl ?? url;\n const downloadUrl = useMemo(() => displayUrl, [displayUrl]);\n if (loading) return <div className={classNames(\"flex min-h-32 items-center justify-center rounded-sm border border-border-default bg-surface-card p-6 text-content-secondary\", className)} role=\"status\" aria-live=\"polite\">Carregando arquivo…</div>;\n if (error) return <div className={classNames(\"rounded-sm border border-field-border-error bg-surface-card p-4 text-field-assistive-error\", className)} role=\"alert\">{error}</div>;\n if (!displayUrl && !textContent) return <div className={classNames(\"rounded-sm border border-border-default bg-surface-card p-4 text-content-secondary\", className)}>{fallback ?? \"Arquivo indisponível.\"}</div>;\n\n const download = onDownload ? <button type=\"button\" onClick={onDownload} className=\"min-h-11 rounded-sm border border-border-default px-3 text-sm font-semibold text-content-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring\">Baixar arquivo</button> : downloadUrl ? <a href={downloadUrl} download={resolvedName} className=\"inline-flex min-h-11 items-center rounded-sm border border-border-default px-3 text-sm font-semibold text-content-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring\">Baixar arquivo</a> : null;\n\n return (\n <div className={classNames(\"flex min-w-0 flex-col gap-3 rounded-sm border border-border-default bg-surface-card p-3\", className)}>\n {resolvedType.startsWith(\"image/\") && displayUrl && <img src={displayUrl} alt={title} className=\"max-h-[70vh] max-w-full object-contain\" />}\n {resolvedType === \"application/pdf\" && displayUrl && <iframe src={displayUrl} title={title} className=\"min-h-[32rem] w-full border-0\" />}\n {(resolvedType.startsWith(\"text/\") || resolvedType === \"application/json\") && (textContent !== undefined ? <pre className=\"max-h-[70vh] overflow-auto whitespace-pre-wrap break-words text-sm text-content-primary\">{textContent}</pre> : displayUrl && <iframe src={displayUrl} title={title} sandbox=\"\" className=\"min-h-64 w-full border-0\" />)}\n {!resolvedType.startsWith(\"image/\") && resolvedType !== \"application/pdf\" && !resolvedType.startsWith(\"text/\") && resolvedType !== \"application/json\" && (fallback ?? <p className=\"text-content-secondary\">Este tipo de arquivo não possui visualização disponível.</p>)}\n {download && <div className=\"flex justify-end\">{download}</div>}\n </div>\n );\n}\n\nexport default FileViewer;\n","\"use client\";\n\nimport QRCodeGenerator from \"qrcode\";\nimport { useEffect, useState, type HTMLAttributes } from \"react\";\nimport classNames from \"classnames\";\n\nexport type QRCodeErrorCorrectionLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\nexport interface QRCodeProps extends Omit<HTMLAttributes<HTMLDivElement>, \"color\"> {\n value: string;\n size?: number;\n level?: QRCodeErrorCorrectionLevel;\n includeMargin?: boolean;\n fgColor?: string;\n bgColor?: string;\n ariaLabel?: string;\n description?: string;\n}\n\nfunction getRelativeLuminance(color: string) {\n const match = color.trim().match(/^#([\\da-f]{6})$/i);\n if (!match) return null;\n\n const channels = [0, 2, 4].map((offset) => Number.parseInt(match[1].slice(offset, offset + 2), 16) / 255);\n const linear = channels.map((channel) => (\n channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4\n ));\n\n return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2];\n}\n\nfunction resolveAccessibleColors(fgColor: string, bgColor: string) {\n const foregroundLuminance = getRelativeLuminance(fgColor);\n const backgroundLuminance = getRelativeLuminance(bgColor);\n\n if (foregroundLuminance === null || backgroundLuminance === null) {\n return { dark: fgColor, light: bgColor };\n }\n\n const lighter = Math.max(foregroundLuminance, backgroundLuminance);\n const darker = Math.min(foregroundLuminance, backgroundLuminance);\n const contrastRatio = (lighter + 0.05) / (darker + 0.05);\n\n return contrastRatio >= 3\n ? { dark: fgColor, light: bgColor }\n : { dark: \"#000000\", light: \"#FFFFFF\" };\n}\n\nexport function QRCode({\n value,\n size = 192,\n level = \"M\",\n includeMargin = true,\n fgColor = \"#000000\",\n bgColor = \"#FFFFFF\",\n ariaLabel = \"Código QR\",\n description,\n className,\n ...rest\n}: QRCodeProps) {\n const [dataUrl, setDataUrl] = useState<string | null>(null);\n const descriptionId = description ? `${rest.id ?? \"qr-code\"}-description` : undefined;\n const colors = resolveAccessibleColors(fgColor, bgColor);\n\n useEffect(() => {\n let active = true;\n setDataUrl(null);\n QRCodeGenerator.toDataURL(value, {\n width: size,\n margin: includeMargin ? 4 : 0,\n errorCorrectionLevel: level,\n color: colors,\n })\n .then((url) => { if (active) setDataUrl(url); })\n .catch(() => { if (active) setDataUrl(null); });\n return () => { active = false; };\n }, [bgColor, fgColor, includeMargin, level, size, value]);\n\n return (\n <div\n {...rest}\n role=\"img\"\n aria-label={ariaLabel}\n aria-describedby={descriptionId}\n className={classNames(\"inline-flex max-w-full flex-col items-center gap-2\", className)}\n >\n {dataUrl ? (\n <img src={dataUrl} alt=\"\" width={size} height={size} className=\"h-auto max-w-full\" />\n ) : (\n <span\n aria-hidden=\"true\"\n className=\"inline-block animate-pulse rounded-sm bg-surface-muted\"\n style={{ width: size, height: size, maxWidth: \"100%\" }}\n />\n )}\n {description && <span id={descriptionId} className=\"sr-only\">{description}</span>}\n </div>\n );\n}\n\nexport default QRCode;\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;AAA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AAA,KAAK,OAAL,OAAAA,MAAW,SAAS,iBAAiB;AAC5E,QAAM,SAAS,wBAAwB,SAAS,OAAO;AAEvD,EAAAE,WAAU,MAAM;AACd,QAAI,SAAS;AACb,eAAW,IAAI;AACf,oBAAgB,UAAU,OAAO;AAAA,MAC/B,OAAO;AAAA,MACP,QAAQ,gBAAgB,IAAI;AAAA,MAC5B,sBAAsB;AAAA,MACrB,OAAO;AAAA,IACV,CAAC,EACE,KAAK,CAAC,QAAQ;AAAE,UAAI,OAAQ,YAAW,GAAG;AAAA,IAAG,CAAC,EAC9C,MAAM,MAAM;AAAE,UAAI,OAAQ,YAAW,IAAI;AAAA,IAAG,CAAC;AAChD,WAAO,MAAM;AAAE,eAAS;AAAA,IAAO;AAAA,EACjC,GAAG,CAAC,SAAS,SAAS,eAAe,OAAO,MAAM,KAAK,CAAC;AAExD,SACE,gBAAAH;AAAA,IAAC;AAAA,qCACK,OADL;AAAA,MAEC,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,oBAAkB;AAAA,MAClB,WAAWI,YAAW,sDAAsD,SAAS;AAAA,MAEpF;AAAA,kBACC,gBAAAL,KAAC,SAAI,KAAK,SAAS,KAAI,IAAG,OAAO,MAAM,QAAQ,MAAM,WAAU,qBAAoB,IAEnF,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAU;AAAA,YACV,OAAO,EAAE,OAAO,MAAM,QAAQ,MAAM,UAAU,OAAO;AAAA;AAAA,QACvD;AAAA,QAED,eAAe,gBAAAA,KAAC,UAAK,IAAI,eAAe,WAAU,WAAW,uBAAY;AAAA;AAAA;AAAA,EAC5E;AAEJ;AAEA,IAAO,iBAAQ;","names":["useRef","jsx","jsxs","message","classNames","jsx","jsxs","classNames","jsx","jsxs","classNames","classNames","useEffect","useState","jsx","jsxs","useEffect","useState","classNames","jsx","jsxs","_a","useState","useEffect","classNames"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useBreakpoint
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ET2BGHTO.js";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -1848,6 +1848,7 @@ function StatusBadge(_a) {
|
|
|
1848
1848
|
appearance = "outline",
|
|
1849
1849
|
size = "md",
|
|
1850
1850
|
overflow = "wrap",
|
|
1851
|
+
statusLabel,
|
|
1851
1852
|
className,
|
|
1852
1853
|
title
|
|
1853
1854
|
} = _b, rest = __objRest(_b, [
|
|
@@ -1856,6 +1857,7 @@ function StatusBadge(_a) {
|
|
|
1856
1857
|
"appearance",
|
|
1857
1858
|
"size",
|
|
1858
1859
|
"overflow",
|
|
1860
|
+
"statusLabel",
|
|
1859
1861
|
"className",
|
|
1860
1862
|
"title"
|
|
1861
1863
|
]);
|
|
@@ -1869,7 +1871,8 @@ function StatusBadge(_a) {
|
|
|
1869
1871
|
overflow === "truncate" ? "overflow-hidden text-ellipsis whitespace-nowrap" : "whitespace-normal break-words",
|
|
1870
1872
|
className
|
|
1871
1873
|
),
|
|
1872
|
-
title: title != null ? title : typeof children === "string" ? children : void 0
|
|
1874
|
+
title: title != null ? title : typeof children === "string" ? children : void 0,
|
|
1875
|
+
"aria-label": statusLabel
|
|
1873
1876
|
}, rest), {
|
|
1874
1877
|
children
|
|
1875
1878
|
})
|
|
@@ -1960,6 +1963,31 @@ var resolveStatusAppearance = (status, domain = "generic") => {
|
|
|
1960
1963
|
if (domain === "participation") {
|
|
1961
1964
|
return { tone: "neutral", appearance: "solid" };
|
|
1962
1965
|
}
|
|
1966
|
+
if (domain === "payment") {
|
|
1967
|
+
if (["PAGO", "QUITADO", "LIBERADO"].includes(normalized)) {
|
|
1968
|
+
return { tone: "success", appearance: "solid" };
|
|
1969
|
+
}
|
|
1970
|
+
if (["EM PAGAMENTO", "AGUARDANDO PAGAMENTO"].includes(normalized)) {
|
|
1971
|
+
return { tone: "info", appearance: "outline" };
|
|
1972
|
+
}
|
|
1973
|
+
if (["VENCIDO", "ESTORNADO", "FALHOU"].includes(normalized)) {
|
|
1974
|
+
return { tone: "danger", appearance: "solid" };
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
if (domain === "claim" || domain === "request" || domain === "protocol") {
|
|
1978
|
+
if (["RECEBIDO", "PROTOCOLADO", "EMITIDO"].includes(normalized)) {
|
|
1979
|
+
return { tone: "info", appearance: "outline" };
|
|
1980
|
+
}
|
|
1981
|
+
if (["EM ANALISE", "AGUARDANDO DOCUMENTACAO", "AGUARDANDO ANALISE"].includes(normalized)) {
|
|
1982
|
+
return { tone: "warning", appearance: "soft" };
|
|
1983
|
+
}
|
|
1984
|
+
if (["APROVADO", "CONCEDIDO", "ATENDIDO"].includes(normalized)) {
|
|
1985
|
+
return { tone: "success", appearance: "solid" };
|
|
1986
|
+
}
|
|
1987
|
+
if (["NEGADO", "ARQUIVADO", "RECUSADO"].includes(normalized)) {
|
|
1988
|
+
return { tone: "danger", appearance: "solid" };
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1963
1991
|
return resolveGenericStatus(normalized);
|
|
1964
1992
|
};
|
|
1965
1993
|
|
|
@@ -2488,7 +2516,8 @@ function TableView({
|
|
|
2488
2516
|
}
|
|
2489
2517
|
return `${widthUnits / resolvedTotalWidthUnits * 100}%`;
|
|
2490
2518
|
};
|
|
2491
|
-
const
|
|
2519
|
+
const isNarrowContainer = tableWidth !== void 0 && tableWidth < 640;
|
|
2520
|
+
const paginationVariant = isMobile || isNarrowContainer ? "arrows" : (_a = pagination == null ? void 0 : pagination.variant) != null ? _a : "default";
|
|
2492
2521
|
const isAdaptiveCompact = overflowMode === "adaptive" && tableWidth !== void 0 && tableWidth < adaptiveBreakpoint;
|
|
2493
2522
|
const overflowClass = overflowMode === "scroll" ? "overflow-x-auto" : "overflow-x-hidden";
|
|
2494
2523
|
const resolvedScrollAreaMaxHeight = stickyHeader ? scrollAreaMaxHeight != null ? scrollAreaMaxHeight : "calc(100dvh - 240px)" : scrollAreaMaxHeight;
|
|
@@ -2537,7 +2566,7 @@ function TableView({
|
|
|
2537
2566
|
type: "button",
|
|
2538
2567
|
"aria-expanded": openFilter === index,
|
|
2539
2568
|
"aria-label": `Filtrar ou ordenar por ${item.title}`,
|
|
2540
|
-
className: `flex w-full items-center gap-1.5 rounded-sm text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${headerFocusClass} ${((_b2 = item.className) == null ? void 0 : _b2.includes("text-right")) ? "justify-end" : ""}`,
|
|
2569
|
+
className: `flex min-h-11 w-full items-center gap-1.5 rounded-sm text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${headerFocusClass} ${((_b2 = item.className) == null ? void 0 : _b2.includes("text-right")) ? "justify-end" : ""}`,
|
|
2541
2570
|
onClick: () => handleHeaderAction(item, index),
|
|
2542
2571
|
children: [
|
|
2543
2572
|
/* @__PURE__ */ jsx33("span", { className: "min-w-0 truncate", children: item.title }),
|
|
@@ -2600,7 +2629,7 @@ function TableView({
|
|
|
2600
2629
|
onClick: pagination.onPrevious,
|
|
2601
2630
|
disabled: pagination.currentPage === 1,
|
|
2602
2631
|
"aria-label": "Ir para a p\xE1gina anterior",
|
|
2603
|
-
className: `inline-flex h-
|
|
2632
|
+
className: `inline-flex min-h-11 min-w-11 items-center justify-center gap-1 rounded border border-border-default px-2 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50 ${paginationVariant === "arrows" ? "min-w-6 tablet:min-w-7" : ""}`,
|
|
2604
2633
|
children: [
|
|
2605
2634
|
/* @__PURE__ */ jsx33(MdKeyboardArrowLeft, { className: "h-3 w-3 text-content-muted" }),
|
|
2606
2635
|
paginationVariant !== "arrows" && "Anterior"
|
|
@@ -2623,7 +2652,7 @@ function TableView({
|
|
|
2623
2652
|
onClick: pagination.onNext,
|
|
2624
2653
|
disabled: pagination.currentPage === pagination.totalPages,
|
|
2625
2654
|
"aria-label": "Ir para a pr\xF3xima p\xE1gina",
|
|
2626
|
-
className: `inline-flex h-
|
|
2655
|
+
className: `inline-flex min-h-11 min-w-11 items-center justify-center gap-1 rounded border border-border-default px-2 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50 ${paginationVariant === "arrows" ? "min-w-6 tablet:min-w-7" : ""}`,
|
|
2627
2656
|
children: [
|
|
2628
2657
|
paginationVariant !== "arrows" && "Pr\xF3xima",
|
|
2629
2658
|
/* @__PURE__ */ jsx33(MdKeyboardArrowRight, { className: "h-3 w-3 text-content-muted" })
|
|
@@ -2654,6 +2683,7 @@ function Table(props) {
|
|
|
2654
2683
|
data,
|
|
2655
2684
|
itemsPerPage = 10,
|
|
2656
2685
|
emptyMessage = "Nenhum item encontrado",
|
|
2686
|
+
errorMessage,
|
|
2657
2687
|
totalWidthUnits,
|
|
2658
2688
|
showRowDivider = false,
|
|
2659
2689
|
enableRowHover = false,
|
|
@@ -2899,7 +2929,7 @@ function Table(props) {
|
|
|
2899
2929
|
{
|
|
2900
2930
|
colSpan: normalizedHeader.length,
|
|
2901
2931
|
className: emptyCellClassName,
|
|
2902
|
-
children: emptyMessage
|
|
2932
|
+
children: errorMessage ? /* @__PURE__ */ jsx34("span", { role: "alert", children: errorMessage }) : /* @__PURE__ */ jsx34("span", { role: "status", children: emptyMessage })
|
|
2903
2933
|
}
|
|
2904
2934
|
) })
|
|
2905
2935
|
] });
|
|
@@ -2907,6 +2937,7 @@ function Table(props) {
|
|
|
2907
2937
|
children,
|
|
2908
2938
|
data,
|
|
2909
2939
|
emptyMessage,
|
|
2940
|
+
errorMessage,
|
|
2910
2941
|
emptyCellClassName,
|
|
2911
2942
|
enableRowHover,
|
|
2912
2943
|
expandable,
|
|
@@ -3119,6 +3150,7 @@ function MobileCardTable({
|
|
|
3119
3150
|
})()) }) : /* @__PURE__ */ jsx35(
|
|
3120
3151
|
"div",
|
|
3121
3152
|
{
|
|
3153
|
+
role: "status",
|
|
3122
3154
|
className: `px-3 py-4 text-center text-md text-content-secondary ${emptyClassName}`.trim(),
|
|
3123
3155
|
children: emptyMessage
|
|
3124
3156
|
}
|
|
@@ -3192,6 +3224,41 @@ function MobileCardTable({
|
|
|
3192
3224
|
}
|
|
3193
3225
|
var MobileCardTable_default = MobileCardTable;
|
|
3194
3226
|
|
|
3227
|
+
// src/hooks/useContainerBreakpoint.ts
|
|
3228
|
+
import { useEffect as useEffect10, useState as useState6 } from "react";
|
|
3229
|
+
var defaultContainerBreakpoints = {
|
|
3230
|
+
mobile: 0,
|
|
3231
|
+
tablet: 640,
|
|
3232
|
+
desktop: 1024,
|
|
3233
|
+
wide: 1440
|
|
3234
|
+
};
|
|
3235
|
+
function useContainerBreakpoint(ref, options = {}) {
|
|
3236
|
+
var _a;
|
|
3237
|
+
const thresholds = (_a = options.breakpoints) != null ? _a : defaultContainerBreakpoints;
|
|
3238
|
+
const [current, setCurrent] = useState6();
|
|
3239
|
+
useEffect10(() => {
|
|
3240
|
+
const element = ref.current;
|
|
3241
|
+
if (!element) return;
|
|
3242
|
+
const resolve = (width) => {
|
|
3243
|
+
const entries = Object.entries(thresholds).sort(([, a], [, b]) => a - b);
|
|
3244
|
+
return entries.reduce(
|
|
3245
|
+
(result, [name, threshold]) => width >= threshold ? name : result,
|
|
3246
|
+
void 0
|
|
3247
|
+
);
|
|
3248
|
+
};
|
|
3249
|
+
const update = () => setCurrent(resolve(element.getBoundingClientRect().width));
|
|
3250
|
+
if (typeof ResizeObserver === "undefined") {
|
|
3251
|
+
update();
|
|
3252
|
+
return void 0;
|
|
3253
|
+
}
|
|
3254
|
+
const observer = new ResizeObserver(update);
|
|
3255
|
+
observer.observe(element);
|
|
3256
|
+
update();
|
|
3257
|
+
return () => observer.disconnect();
|
|
3258
|
+
}, [ref, thresholds]);
|
|
3259
|
+
return current;
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3195
3262
|
export {
|
|
3196
3263
|
LoadingDotsView_default,
|
|
3197
3264
|
Button_default,
|
|
@@ -3227,6 +3294,7 @@ export {
|
|
|
3227
3294
|
findFirstInvalidField,
|
|
3228
3295
|
FormErrorNavigation,
|
|
3229
3296
|
Table_default,
|
|
3230
|
-
MobileCardTable_default
|
|
3297
|
+
MobileCardTable_default,
|
|
3298
|
+
useContainerBreakpoint
|
|
3231
3299
|
};
|
|
3232
|
-
//# sourceMappingURL=chunk-
|
|
3300
|
+
//# sourceMappingURL=chunk-PIXRKI25.js.map
|