@garantiabr/ui-kit 0.5.13 → 0.5.15

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 CHANGED
@@ -253,6 +253,7 @@ minor; a 1.0.0 é decisão humana: mude a `version` do `package.json` para `1.0.
253
253
  | `01-theme-reads-variables` | paleta em `@theme inline`: as classes gravam o valor fixo e o escuro não muda as cores do SpotDS | escuro funciona; claro idêntico |
254
254
  | `03-lucide-canonical-names` | ícone por texto com nome antigo some no `lucide-react` 1.x | nome canônico, mesmo desenho |
255
255
  | `04-table-app-extensions` | Table sem o que os apps usam: célula rica pela tabela, seleção controlada, `data-testid` | `renderCell`, `selectedRowIds`/`onSelectedRowIdsChange`, `testId`/`rowTestId`; tudo opcional, sem elas é o Table do Storybook |
256
+ | `07-fileupload-envio-real` | FileUpload só simula o envio (o percentual sobe num temporizador, como no protótipo) | `onUpload(item, informarProgresso)` liga cada arquivo ao envio real: percentual de verdade, enviado ao resolver, erro com a mensagem ao rejeitar e "Tentar novamente" chamando de novo; opcional, sem ela é o FileUpload do Storybook |
256
257
 
257
258
  Cada patch é uma sugestão para o design corrigir na fonte; quando corrigir, o patch falha de propósito e sai daqui.
258
259
 
@@ -74,5 +74,7 @@ export interface FileUploadProps extends Omit<InputHTMLAttributes<HTMLInputEleme
74
74
  selecionavel?: boolean;
75
75
  onFilesChange?: (files: File[]) => void;
76
76
  onItemsChange?: (items: UploadItem[]) => void;
77
+ /** Envio real: chamada por arquivo aceito no lugar da simulação; informe o percentual e resolva ao terminar (rejeite com Error para o erro do item). */
78
+ onUpload?: (item: UploadItem, informarProgresso: (percentual: number) => void) => Promise<void>;
77
79
  }
78
- export declare const FileUpload: ({ id, className, variant, maxFiles, directory, maxSizeMb, onRejectedFiles, hideRemainingHint, remainingHintText, initialItems, debugErrorMode, debugErrorKeyword, debugErrorMessage, confirmRemove, renderFileTrigger, uploadedItemClassName, selecionavel, onFilesChange, onItemsChange, disabled, ...inputProps }: FileUploadProps) => import("react/jsx-runtime").JSX.Element;
80
+ export declare const FileUpload: ({ id, className, variant, maxFiles, directory, maxSizeMb, onRejectedFiles, hideRemainingHint, remainingHintText, initialItems, debugErrorMode, debugErrorKeyword, debugErrorMessage, confirmRemove, renderFileTrigger, uploadedItemClassName, selecionavel, onFilesChange, onItemsChange, onUpload, disabled, ...inputProps }: FileUploadProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,62 +1,62 @@
1
1
  "use client";
2
- import { jsxs as n, jsx as t, Fragment as y } from "react/jsx-runtime";
3
- import { useRef as Z, useState as A, useEffect as Y } from "react";
4
- import { File as $e, Download as Xe, Sparkles as We, Trash as Ae, Upload as Je, TriangleAlert as Ze } from "lucide-react";
5
- import { alertBanner as Q } from "./alertBanner.js";
2
+ import { jsxs as r, jsx as t, Fragment as y } from "react/jsx-runtime";
3
+ import { useRef as Y, useState as A, useEffect as Q } from "react";
4
+ import { File as Se, Download as Je, Sparkles as Ze, Trash as Re, Upload as Ye, TriangleAlert as Qe } from "lucide-react";
5
+ import { alertBanner as ee } from "./alertBanner.js";
6
6
  import { Button as z } from "./button.js";
7
- import { Checkbox as De } from "./checkbox.js";
8
- import { Dialog as Ye } from "./dialog.js";
9
- import { Tooltip as M } from "./tooltip.js";
10
- import { Progress as Qe } from "../ui/progress.js";
11
- import { cn as te } from "../../lib/utils.js";
12
- const C = 1024, et = 280, tt = [".pdf", ".jpg", ".jpeg", ".png", ".tiff", ".tif", ".bmp"], ot = {
7
+ import { Checkbox as $e } from "./checkbox.js";
8
+ import { Dialog as et } from "./dialog.js";
9
+ import { Tooltip as _ } from "./tooltip.js";
10
+ import { Progress as tt } from "../ui/progress.js";
11
+ import { cn as oe } from "../../lib/utils.js";
12
+ const C = 1024, ot = 280, rt = [".pdf", ".jpg", ".jpeg", ".png", ".tiff", ".tif", ".bmp"], st = {
13
13
  ".heic": "foto do iPhone (.heic) não é aceita. Exporte a foto como JPG e envie de novo.",
14
14
  ".heif": "foto do iPhone (.heif) não é aceita. Exporte a foto como JPG e envie de novo."
15
- }, ee = "PDF, JPG, PNG, TIFF ou BMP", nt = { ".pdf": "pdf", ".jpg": "jpg", ".jpeg": "jpg", ".png": "png", ".tiff": "tiff", ".tif": "tiff", ".bmp": "bmp" };
16
- async function rt(s) {
17
- const x = new Uint8Array(await s.slice(0, 8).arrayBuffer()), i = (...c) => c.every((m, l) => x[l] === m);
15
+ }, te = "PDF, JPG, PNG, TIFF ou BMP", nt = { ".pdf": "pdf", ".jpg": "jpg", ".jpeg": "jpg", ".png": "png", ".tiff": "tiff", ".tif": "tiff", ".bmp": "bmp" };
16
+ async function at(a) {
17
+ const v = new Uint8Array(await a.slice(0, 8).arrayBuffer()), i = (...d) => d.every((p, c) => v[c] === p);
18
18
  return i(37, 80, 68, 70) ? "pdf" : i(255, 216, 255) ? "jpg" : i(137, 80, 78, 71) ? "png" : i(73, 73, 42, 0) || i(77, 77, 0, 42) ? "tiff" : i(66, 77) ? "bmp" : null;
19
19
  }
20
- const st = tt.join(","), at = 45, it = "erro", Ee = "Erro ao enviar o documento", Se = "transition-colors hover:bg-surface-hover active:bg-surface-pressed", lt = 40;
21
- function _(s, x = lt) {
22
- if (s.length <= x) return s;
23
- const i = s.lastIndexOf("."), c = i > 0 ? s.slice(i) : "", m = i > 0 ? s.slice(0, i) : s, l = "(...)", w = Math.max(1, x - c.length - l.length);
24
- return `${m.slice(0, w)}${l}${c}`;
20
+ const it = rt.join(","), lt = 45, ct = "erro", Ae = "Erro ao enviar o documento", qe = "transition-colors hover:bg-surface-hover active:bg-surface-pressed", dt = 40;
21
+ function M(a, v = dt) {
22
+ if (a.length <= v) return a;
23
+ const i = a.lastIndexOf("."), d = i > 0 ? a.slice(i) : "", p = i > 0 ? a.slice(0, i) : a, c = "(...)", w = Math.max(1, v - d.length - c.length);
24
+ return `${p.slice(0, w)}${c}${d}`;
25
25
  }
26
- const oe = /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "27", height: "27", viewBox: "0 0 20 20", fill: "none", children: [
26
+ const re = /* @__PURE__ */ r("svg", { xmlns: "http://www.w3.org/2000/svg", width: "27", height: "27", viewBox: "0 0 20 20", fill: "none", children: [
27
27
  /* @__PURE__ */ t("path", { d: "M13.3919 2.66528C13.4399 2.49344 13.8061 2.49341 13.8541 2.66528C14.0178 3.25148 14.2794 3.93708 14.672 4.34497C15.0645 4.75276 15.7241 5.02448 16.2882 5.19458C16.4534 5.24459 16.4533 5.62455 16.2882 5.67472C15.724 5.84485 15.0645 6.11725 14.672 6.52515C14.2794 6.93306 14.0178 7.61861 13.8541 8.20484C13.8059 8.37638 13.4403 8.37627 13.3919 8.20484C13.2282 7.61875 12.9664 6.9331 12.574 6.52515C12.1814 6.11723 11.5211 5.84485 10.957 5.67472C10.7921 5.62436 10.792 5.24478 10.957 5.19458C11.5211 5.02445 12.1814 4.75289 12.574 4.34497C12.9665 3.93704 13.2281 3.25146 13.3919 2.66528Z", fill: "black" }),
28
28
  /* @__PURE__ */ t("path", { d: "M15.8683 6.60409C15.8827 6.55252 15.993 6.55252 16.0074 6.60409C16.0565 6.77987 16.1347 6.98548 16.2524 7.10783C16.3701 7.23017 16.5682 7.31151 16.7374 7.36255C16.787 7.37751 16.787 7.49159 16.7374 7.50659C16.5681 7.55763 16.3701 7.63975 16.2524 7.76213C16.1347 7.88453 16.0565 8.09011 16.0074 8.26587C15.993 8.31739 15.8827 8.3174 15.8683 8.26587C15.8192 8.09009 15.741 7.88452 15.6233 7.76213C15.5055 7.63975 15.3075 7.55763 15.1383 7.50659C15.0887 7.49153 15.0887 7.37751 15.1383 7.36255C15.3075 7.31151 15.5056 7.23018 15.6233 7.10783C15.741 6.98548 15.8191 6.77988 15.8683 6.60409Z", fill: "black" }),
29
29
  /* @__PURE__ */ t("path", { d: "M15.9895 1.73104C16.0136 1.64529 16.1964 1.64534 16.2206 1.73104C16.3025 2.02415 16.4337 2.36693 16.63 2.57088C16.8263 2.77481 17.156 2.91063 17.4381 2.99569C17.5206 3.02071 17.5205 3.2105 17.4381 3.23576C17.156 3.32082 16.8262 3.45742 16.63 3.66138C16.4337 3.86534 16.3025 4.20813 16.2206 4.50122C16.1962 4.58669 16.0138 4.58674 15.9895 4.50122C15.9077 4.20825 15.7771 3.86537 15.581 3.66138C15.3847 3.45747 15.0549 3.32083 14.7729 3.23576C14.6902 3.21082 14.6902 3.02063 14.7729 2.99569C15.0549 2.91062 15.3848 2.77475 15.581 2.57088C15.7772 2.3669 15.9077 2.02406 15.9895 1.73104Z", fill: "black" }),
30
30
  /* @__PURE__ */ t("path", { d: "M8.33325 2.91675H7.7211C7.58023 2.91675 7.4459 2.97617 7.35113 3.08041L3.33325 7.50008V17.0001C3.33325 17.2762 3.55711 17.5001 3.83325 17.5001H14.4999C14.7761 17.5001 14.9999 17.2762 14.9999 17.0001V10.0001M3.33325 7.50008H7.83325C8.10939 7.50008 8.33325 7.27622 8.33325 7.00008V2.91675M10.8333 2.91675H8.33325", stroke: "black", strokeWidth: "2", strokeLinecap: "round" })
31
31
  ] });
32
- function Nt({ name: s, sizeLabel: x, onDownload: i, onAnaliseIa: c, analiseIaVariante: m = "icone", analiseIaProgresso: l, analiseIaIndicador: w, detalhe: U, onRemove: D, onClick: v, nomeMax: F, className: L }) {
32
+ function yt({ name: a, sizeLabel: v, onDownload: i, onAnaliseIa: d, analiseIaVariante: p = "icone", analiseIaProgresso: c, analiseIaIndicador: w, detalhe: F, onRemove: D, onClick: x, nomeMax: I, className: L }) {
33
33
  return /* @__PURE__ */ t(
34
34
  "div",
35
35
  {
36
- className: te("px-xl py-md", v && te(Se, "cursor-pointer"), L),
37
- onClick: v,
38
- onKeyDown: (d) => {
39
- v && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), v());
36
+ className: oe("px-xl py-md", x && oe(qe, "cursor-pointer"), L),
37
+ onClick: x,
38
+ onKeyDown: (u) => {
39
+ x && (u.key === "Enter" || u.key === " ") && (u.preventDefault(), x());
40
40
  },
41
- role: v ? "button" : void 0,
42
- tabIndex: v ? 0 : void 0,
43
- children: /* @__PURE__ */ n("div", { className: "flex min-h-7.5 w-full items-center justify-between gap-md", children: [
44
- /* @__PURE__ */ n("div", { className: "flex min-w-0 items-center gap-md", children: [
45
- /* @__PURE__ */ t($e, { className: "size-[24px] shrink-0 text-fg-muted", "aria-hidden": "true" }),
46
- /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-col gap-3xs", children: [
47
- /* @__PURE__ */ n("div", { className: "flex min-w-0 items-center gap-5xs", children: [
48
- /* @__PURE__ */ t("span", { className: "text-sm font-semibold text-fg-secondary", title: s, children: _(s, F) }),
49
- x ? /* @__PURE__ */ n(y, { children: [
41
+ role: x ? "button" : void 0,
42
+ tabIndex: x ? 0 : void 0,
43
+ children: /* @__PURE__ */ r("div", { className: "flex min-h-7.5 w-full items-center justify-between gap-md", children: [
44
+ /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-md", children: [
45
+ /* @__PURE__ */ t(Se, { className: "size-[24px] shrink-0 text-fg-muted", "aria-hidden": "true" }),
46
+ /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-col gap-3xs", children: [
47
+ /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-5xs", children: [
48
+ /* @__PURE__ */ t("span", { className: "text-sm font-semibold text-fg-secondary", title: a, children: M(a, I) }),
49
+ v ? /* @__PURE__ */ r(y, { children: [
50
50
  /* @__PURE__ */ t("span", { className: "text-xs font-bold text-fg-muted", children: "•" }),
51
- /* @__PURE__ */ t("span", { className: "shrink-0 whitespace-nowrap text-xs text-fg-muted", children: x })
51
+ /* @__PURE__ */ t("span", { className: "shrink-0 whitespace-nowrap text-xs text-fg-muted", children: v })
52
52
  ] }) : null
53
53
  ] }),
54
- U
54
+ F
55
55
  ] })
56
56
  ] }),
57
- i || c || D ? /* @__PURE__ */ n("div", { className: "flex items-center gap-sm", children: [
57
+ i || d || D ? /* @__PURE__ */ r("div", { className: "flex items-center gap-sm", children: [
58
58
  i ? /* @__PURE__ */ t(
59
- M,
59
+ _,
60
60
  {
61
61
  content: "Baixar arquivo",
62
62
  trigger: /* @__PURE__ */ t(
@@ -64,32 +64,32 @@ function Nt({ name: s, sizeLabel: x, onDownload: i, onAnaliseIa: c, analiseIaVar
64
64
  {
65
65
  type: "button",
66
66
  className: "inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong",
67
- onClick: (d) => {
68
- d.stopPropagation(), i();
67
+ onClick: (u) => {
68
+ u.stopPropagation(), i();
69
69
  },
70
- "aria-label": `Baixar ${s}`,
71
- children: /* @__PURE__ */ t(Xe, { className: "size-[20px]", "aria-hidden": !0 })
70
+ "aria-label": `Baixar ${a}`,
71
+ children: /* @__PURE__ */ t(Je, { className: "size-[20px]", "aria-hidden": !0 })
72
72
  }
73
73
  )
74
74
  }
75
75
  ) : null,
76
- c && m === "botao" ? /* @__PURE__ */ n(
76
+ d && p === "botao" ? /* @__PURE__ */ r(
77
77
  "button",
78
78
  {
79
79
  type: "button",
80
80
  className: "inline-flex h-[36px] items-center justify-center gap-3xs whitespace-nowrap rounded-full bg-surface-muted px-md text-sm text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong",
81
- "aria-label": `Análise IA de ${s}`,
82
- onClick: (d) => {
83
- d.stopPropagation(), c();
81
+ "aria-label": `Análise IA de ${a}`,
82
+ onClick: (u) => {
83
+ u.stopPropagation(), d();
84
84
  },
85
85
  children: [
86
- l !== void 0 && w ? w : /* @__PURE__ */ t(We, { className: "size-[16px]", "aria-hidden": "true" }),
87
- /* @__PURE__ */ t("span", { className: "leading-sm", children: l !== void 0 ? `${Math.round(l)}%` : "Análise IA" })
86
+ c !== void 0 && w ? w : /* @__PURE__ */ t(Ze, { className: "size-[16px]", "aria-hidden": "true" }),
87
+ /* @__PURE__ */ t("span", { className: "leading-sm", children: c !== void 0 ? `${Math.round(c)}%` : "Análise IA" })
88
88
  ]
89
89
  }
90
90
  ) : null,
91
- c && m === "icone" ? /* @__PURE__ */ t(
92
- M,
91
+ d && p === "icone" ? /* @__PURE__ */ t(
92
+ _,
93
93
  {
94
94
  content: "Análise IA",
95
95
  trigger: /* @__PURE__ */ t(
@@ -97,17 +97,17 @@ function Nt({ name: s, sizeLabel: x, onDownload: i, onAnaliseIa: c, analiseIaVar
97
97
  {
98
98
  type: "button",
99
99
  className: "inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong",
100
- onClick: (d) => {
101
- d.stopPropagation(), c();
100
+ onClick: (u) => {
101
+ u.stopPropagation(), d();
102
102
  },
103
- "aria-label": `Análise IA de ${s}`,
104
- children: /* @__PURE__ */ t("span", { className: "inline-flex [&>svg]:size-[22px]", children: oe })
103
+ "aria-label": `Análise IA de ${a}`,
104
+ children: /* @__PURE__ */ t("span", { className: "inline-flex [&>svg]:size-[22px]", children: re })
105
105
  }
106
106
  )
107
107
  }
108
108
  ) : null,
109
109
  D ? /* @__PURE__ */ t(
110
- M,
110
+ _,
111
111
  {
112
112
  content: "Remover arquivo",
113
113
  trigger: /* @__PURE__ */ t(
@@ -115,11 +115,11 @@ function Nt({ name: s, sizeLabel: x, onDownload: i, onAnaliseIa: c, analiseIaVar
115
115
  {
116
116
  type: "button",
117
117
  className: "inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-red-50 hover:text-red-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500",
118
- onClick: (d) => {
119
- d.stopPropagation(), D();
118
+ onClick: (u) => {
119
+ u.stopPropagation(), D();
120
120
  },
121
- "aria-label": `Remover ${s}`,
122
- children: /* @__PURE__ */ t(Ae, { className: "size-[20px]", "aria-hidden": !0 })
121
+ "aria-label": `Remover ${a}`,
122
+ children: /* @__PURE__ */ t(Re, { className: "size-[20px]", "aria-hidden": !0 })
123
123
  }
124
124
  )
125
125
  }
@@ -129,217 +129,233 @@ function Nt({ name: s, sizeLabel: x, onDownload: i, onAnaliseIa: c, analiseIaVar
129
129
  }
130
130
  );
131
131
  }
132
- const ct = () => `${Date.now()}-${Math.random().toString(16).slice(2, 10)}`, Ct = ({
133
- id: s,
134
- className: x = "",
132
+ const ut = () => `${Date.now()}-${Math.random().toString(16).slice(2, 10)}`, wt = ({
133
+ id: a,
134
+ className: v = "",
135
135
  variant: i = "line",
136
- maxFiles: c = 3,
137
- directory: m = !1,
138
- maxSizeMb: l,
136
+ maxFiles: d = 3,
137
+ directory: p = !1,
138
+ maxSizeMb: c,
139
139
  onRejectedFiles: w,
140
- hideRemainingHint: U = !1,
140
+ hideRemainingHint: F = !1,
141
141
  remainingHintText: D,
142
- initialItems: v = [],
143
- debugErrorMode: F = !1,
144
- debugErrorKeyword: L = it,
145
- debugErrorMessage: d = Ee,
146
- confirmRemove: ne = !1,
147
- renderFileTrigger: re,
148
- uploadedItemClassName: Re,
149
- selecionavel: I = !1,
150
- onFilesChange: qe,
151
- onItemsChange: se,
152
- disabled: u,
153
- ...Oe
142
+ initialItems: x = [],
143
+ debugErrorMode: I = !1,
144
+ debugErrorKeyword: L = ct,
145
+ debugErrorMessage: u = Ae,
146
+ confirmRemove: se = !1,
147
+ renderFileTrigger: ne,
148
+ uploadedItemClassName: Oe,
149
+ selecionavel: G = !1,
150
+ onFilesChange: Te,
151
+ onItemsChange: ae,
152
+ onUpload: V,
153
+ disabled: f,
154
+ ...ke
154
155
  }) => {
155
- const G = Z(null), S = Z(0), R = Z(/* @__PURE__ */ new Map()), [p, V] = A(() => [...v]), [ae, K] = A(!1), [q, P] = A(null), [j, ie] = A(null), [E, Te] = A([]), [le, H] = A(/* @__PURE__ */ new Set()), X = p.filter((e) => e.status === "uploaded").length, O = Math.max(0, c - p.length), h = !!(u || O === 0), ce = st, de = ce.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), ke = de.map((e) => e.toUpperCase()).join(", ").replace(/, ([^,]*)$/, " e $1"), ue = (e) => {
156
+ const K = Y(null), S = Y(0), R = Y(/* @__PURE__ */ new Map()), [m, P] = A(() => [...x]), [ie, H] = A(!1), [q, j] = A(null), [B, le] = A(null), [E, ze] = A([]), [ce, X] = A(/* @__PURE__ */ new Set()), W = m.filter((e) => e.status === "uploaded").length, O = Math.max(0, d - m.length), h = !!(f || O === 0), de = it, ue = de.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), Me = ue.map((e) => e.toUpperCase()).join(", ").replace(/, ([^,]*)$/, " e $1"), fe = (e) => {
156
157
  const o = e / C;
157
158
  return o >= C ? `${(o / C).toFixed(1)} MB` : `${o.toFixed(1)} KB`;
158
- }, ze = (e) => !l || e.size <= l * C * C, N = (e) => {
159
+ }, _e = (e) => !c || e.size <= c * C * C, N = (e) => {
159
160
  const o = R.current.get(e);
160
161
  o !== void 0 && (window.clearInterval(o), R.current.delete(e));
161
- }, _e = () => {
162
+ }, Le = () => {
162
163
  R.current.forEach((e) => {
163
164
  window.clearInterval(e);
164
165
  }), R.current.clear();
165
166
  };
166
- Y(() => () => {
167
- _e();
168
- }, []), Y(() => {
169
- se?.(p);
170
- }, [p, se]), Y(() => {
171
- const e = G.current;
172
- e && (m ? (e.setAttribute("webkitdirectory", "true"), e.setAttribute("directory", "true")) : (e.removeAttribute("webkitdirectory"), e.removeAttribute("directory")));
173
- }, [m]);
174
- const Me = (e, o) => {
175
- if (!F || o < at)
167
+ Q(() => () => {
168
+ Le();
169
+ }, []), Q(() => {
170
+ ae?.(m);
171
+ }, [m, ae]), Q(() => {
172
+ const e = K.current;
173
+ e && (p ? (e.setAttribute("webkitdirectory", "true"), e.setAttribute("directory", "true")) : (e.removeAttribute("webkitdirectory"), e.removeAttribute("directory")));
174
+ }, [p]);
175
+ const Pe = (e, o) => {
176
+ if (!I || o < lt)
176
177
  return !1;
177
- const r = L.trim().toLowerCase();
178
- return r ? e.name.toLowerCase().includes(r) : !1;
179
- }, fe = (e) => {
178
+ const s = L.trim().toLowerCase();
179
+ return s ? e.name.toLowerCase().includes(s) : !1;
180
+ }, me = (e) => {
180
181
  const o = window.setInterval(() => {
181
- V((r) => {
182
- const a = r.find((g) => g.id === e);
183
- if (!a || a.status === "uploaded" || a.status === "error")
184
- return N(e), r;
185
- const f = Math.min(100, a.progress + Math.floor(Math.random() * 20) + 10);
186
- if (Me(a, f))
187
- return N(e), r.map(
182
+ P((s) => {
183
+ const n = s.find((g) => g.id === e);
184
+ if (!n || n.status === "uploaded" || n.status === "error")
185
+ return N(e), s;
186
+ const l = Math.min(100, n.progress + Math.floor(Math.random() * 20) + 10);
187
+ if (Pe(n, l))
188
+ return N(e), s.map(
188
189
  (g) => g.id === e ? {
189
190
  ...g,
190
191
  progress: 0,
191
192
  status: "error",
192
- error: d
193
+ error: u
193
194
  } : g
194
195
  );
195
- const $ = f === 100 ? "uploaded" : "uploading";
196
- return $ === "uploaded" && N(e), r.map(
196
+ const $ = l === 100 ? "uploaded" : "uploading";
197
+ return $ === "uploaded" && N(e), s.map(
197
198
  (g) => g.id === e ? {
198
199
  ...g,
199
- progress: f,
200
+ progress: l,
200
201
  status: $,
201
202
  error: void 0
202
203
  } : g
203
204
  );
204
205
  });
205
- }, et);
206
+ }, ot);
206
207
  R.current.set(e, o);
207
- }, W = (e) => {
208
- V(e), qe?.(e.map((o) => o.file));
209
- }, Le = async (e) => {
210
- const o = e.name.toLowerCase(), r = o.lastIndexOf("."), a = r > 0 ? o.slice(r) : "";
208
+ }, pe = (e) => {
209
+ if (!V) {
210
+ me(e.id);
211
+ return;
212
+ }
213
+ const o = (s) => P((n) => n.map((l) => l.id === e.id ? { ...l, ...s } : l));
214
+ V(e, (s) => o({ progress: Math.max(0, Math.min(100, Math.round(s))) })).then(() => o({ progress: 100, status: "uploaded", error: void 0 })).catch(
215
+ (s) => o({ progress: 0, status: "error", error: s instanceof Error && s.message ? s.message : void 0 })
216
+ );
217
+ }, J = (e) => {
218
+ P(e), Te?.(e.map((o) => o.file));
219
+ }, je = async (e) => {
220
+ const o = e.name.toLowerCase(), s = o.lastIndexOf("."), n = s > 0 ? o.slice(s) : "";
211
221
  if (e.size === 0) return "o arquivo está vazio.";
212
- if (a && !de.includes(a))
213
- return ot[a] ?? `o formato ${a} não é aceito. Envie em ${ee}.`;
214
- const f = await rt(e);
215
- return f ? a && nt[a] !== f ? `o arquivo tem extensão ${a}, mas o conteúdo é ${f.toUpperCase()}. Salve de novo no formato certo e envie.` : l && !ze(e) ? `tem ${(Math.ceil(e.size / (C * C) * 100) / 100).toLocaleString("pt-BR", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} MB, acima do limite de ${l} MB por arquivo. Reduza o arquivo ou divida o documento.` : null : a ? `o arquivo tem extensão ${a}, mas o conteúdo não é desse formato. Abra o arquivo, salve de novo como ${ee} e envie.` : `não foi possível reconhecer o formato do arquivo. Envie em ${ee}.`;
216
- }, me = async (e) => {
222
+ if (n && !ue.includes(n))
223
+ return st[n] ?? `o formato ${n} não é aceito. Envie em ${te}.`;
224
+ const l = await at(e);
225
+ return l ? n && nt[n] !== l ? `o arquivo tem extensão ${n}, mas o conteúdo é ${l.toUpperCase()}. Salve de novo no formato certo e envie.` : c && !_e(e) ? `tem ${(Math.ceil(e.size / (C * C) * 100) / 100).toLocaleString("pt-BR", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} MB, acima do limite de ${c} MB por arquivo. Reduza o arquivo ou divida o documento.` : null : n ? `o arquivo tem extensão ${n}, mas o conteúdo não é desse formato. Abra o arquivo, salve de novo como ${te} e envie.` : `não foi possível reconhecer o formato do arquivo. Envie em ${te}.`;
226
+ }, ge = async (e) => {
217
227
  if (h || e.length === 0)
218
228
  return;
219
- const o = await Promise.all(e.map(Le)), r = e.flatMap((b, B) => o[B] ? [{ nome: b.name, motivo: o[B] }] : []), a = e.filter((b, B) => !o[B]);
220
- Te(r), w?.(r);
221
- const f = a.slice(0, O);
222
- if (a.length > f.length ? ie(`${f.length} de ${a.length} arquivos foram adicionados: o limite de ${c} arquivos foi atingido.`) : ie(null), f.length === 0)
229
+ const o = await Promise.all(e.map(je)), s = e.flatMap((b, U) => o[U] ? [{ nome: b.name, motivo: o[U] }] : []), n = e.filter((b, U) => !o[U]);
230
+ ze(s), w?.(s);
231
+ const l = n.slice(0, O);
232
+ if (n.length > l.length ? le(`${l.length} de ${n.length} arquivos foram adicionados: o limite de ${d} arquivos foi atingido.`) : le(null), l.length === 0)
223
233
  return;
224
- const $ = f.map((b) => ({
225
- id: ct(),
234
+ const $ = l.map((b) => ({
235
+ id: ut(),
226
236
  file: b,
227
237
  name: b.name,
228
238
  size: b.size,
229
239
  progress: 0,
230
240
  status: "uploading"
231
- })), g = [...p, ...$];
232
- W(g), $.forEach((b) => fe(b.id));
233
- }, pe = () => E.length === 0 ? null : /* @__PURE__ */ t("div", { role: "alert", className: "flex w-full flex-col gap-4xs rounded-lg border border-orange-500 bg-orange-50 px-md py-sm text-left text-sm text-orange-600", children: E.length === 1 ? /* @__PURE__ */ n("p", { children: [
234
- /* @__PURE__ */ n("span", { className: "font-medium", children: [
241
+ })), g = [...m, ...$];
242
+ J(g), $.forEach((b) => pe(b));
243
+ }, ve = () => E.length === 0 ? null : /* @__PURE__ */ t("div", { role: "alert", className: "flex w-full flex-col gap-4xs rounded-lg border border-orange-500 bg-orange-50 px-md py-sm text-left text-sm text-orange-600", children: E.length === 1 ? /* @__PURE__ */ r("p", { children: [
244
+ /* @__PURE__ */ r("span", { className: "font-medium", children: [
235
245
  '"',
236
- _(E[0].nome),
246
+ M(E[0].nome),
237
247
  '" não foi adicionado:'
238
248
  ] }),
239
249
  " ",
240
250
  E[0].motivo
241
- ] }) : /* @__PURE__ */ n(y, { children: [
242
- /* @__PURE__ */ n("p", { className: "font-medium", children: [
251
+ ] }) : /* @__PURE__ */ r(y, { children: [
252
+ /* @__PURE__ */ r("p", { className: "font-medium", children: [
243
253
  E.length,
244
254
  " arquivos não foram adicionados:"
245
255
  ] }),
246
- /* @__PURE__ */ t("ul", { className: "flex list-disc flex-col gap-5xs pl-md", children: E.map((e) => /* @__PURE__ */ n("li", { children: [
247
- /* @__PURE__ */ n("span", { className: "font-medium", children: [
248
- _(e.nome),
256
+ /* @__PURE__ */ t("ul", { className: "flex list-disc flex-col gap-5xs pl-md", children: E.map((e) => /* @__PURE__ */ r("li", { children: [
257
+ /* @__PURE__ */ r("span", { className: "font-medium", children: [
258
+ M(e.nome),
249
259
  ":"
250
260
  ] }),
251
261
  " ",
252
262
  e.motivo
253
263
  ] }, e.nome)) })
254
- ] }) }), Pe = (e) => {
264
+ ] }) }), Be = (e) => {
255
265
  const o = Array.from(e.target.files ?? []);
256
- me(o), e.target.value = "";
257
- }, ge = () => {
258
- S.current = 0, K(!1);
259
- }, xe = (e) => {
260
- e.preventDefault(), e.stopPropagation(), !u && (S.current += 1, K(!0));
261
- }, ve = (e) => {
262
- e.preventDefault(), e.stopPropagation(), !u && (S.current = Math.max(0, S.current - 1), S.current === 0 && K(!1));
266
+ ge(o), e.target.value = "";
267
+ }, xe = () => {
268
+ S.current = 0, H(!1);
263
269
  }, he = (e) => {
264
- e.preventDefault(), !u && (e.dataTransfer.dropEffect = "copy");
270
+ e.preventDefault(), e.stopPropagation(), !f && (S.current += 1, H(!0));
265
271
  }, be = (e) => {
272
+ e.preventDefault(), e.stopPropagation(), !f && (S.current = Math.max(0, S.current - 1), S.current === 0 && H(!1));
273
+ }, Ne = (e) => {
274
+ e.preventDefault(), !f && (e.dataTransfer.dropEffect = "copy");
275
+ }, Ce = (e) => {
266
276
  e.preventDefault(), e.stopPropagation();
267
277
  const o = Array.from(e.dataTransfer.files ?? []);
268
- if (u) {
269
- ge();
278
+ if (f) {
279
+ xe();
270
280
  return;
271
281
  }
272
- me(o), ge();
273
- }, Ne = (e) => {
274
- N(e), W(p.filter((o) => o.id !== e));
275
- }, T = p.filter((e) => e.status === "uploaded"), k = T.filter((e) => le.has(e.id)), je = T.length > 0 && k.length === T.length, Be = (e) => H((o) => {
276
- const r = new Set(o);
277
- return r.has(e) ? r.delete(e) : r.add(e), r;
278
- }), Ue = () => {
282
+ ge(o), xe();
283
+ }, ye = (e) => {
284
+ N(e), J(m.filter((o) => o.id !== e));
285
+ }, T = m.filter((e) => e.status === "uploaded"), k = T.filter((e) => ce.has(e.id)), Ue = T.length > 0 && k.length === T.length, Fe = (e) => X((o) => {
286
+ const s = new Set(o);
287
+ return s.has(e) ? s.delete(e) : s.add(e), s;
288
+ }), Ie = () => {
279
289
  const e = new Set(k.map((o) => o.id));
280
- e.forEach((o) => N(o)), W(p.filter((o) => !e.has(o.id))), H(/* @__PURE__ */ new Set()), Q.show({
290
+ e.forEach((o) => N(o)), J(m.filter((o) => !e.has(o.id))), X(/* @__PURE__ */ new Set()), ee.show({
281
291
  type: "success",
282
292
  title: e.size === 1 ? "Arquivo removido com sucesso" : `${e.size} arquivos removidos com sucesso`,
283
293
  description: "Você pode anexar novos arquivos utilizando o campo de upload."
284
294
  });
285
- }, Fe = (e) => {
286
- if (ne) {
287
- P(e);
295
+ }, Ge = (e) => {
296
+ if (se) {
297
+ j(e);
288
298
  return;
289
299
  }
290
- Ne(e.id);
291
- }, Ie = () => {
300
+ ye(e.id);
301
+ }, Ve = () => {
292
302
  if (!q) return;
293
303
  const e = q.name.toLowerCase().includes(L.trim().toLowerCase()), o = q;
294
- if (P(null), e) {
295
- Q.show({
304
+ if (j(null), e) {
305
+ ee.show({
296
306
  type: "error",
297
307
  title: "Não foi possível remover o arquivo",
298
308
  description: "Ocorreu um erro ao tentar remover o arquivo. Tente novamente ou entre em contato com o suporte."
299
309
  });
300
310
  return;
301
311
  }
302
- Ne(o.id), Q.show({
312
+ ye(o.id), ee.show({
303
313
  type: "success",
304
314
  title: "Arquivo removido com sucesso",
305
315
  description: "O arquivo foi removido. Você pode anexar um novo utilizando o campo de upload."
306
316
  });
307
- }, Ce = (e) => {
308
- N(e), V(
309
- (o) => o.map(
310
- (r) => r.id === e ? {
311
- ...r,
317
+ }, we = (e) => {
318
+ N(e), P(
319
+ (s) => s.map(
320
+ (n) => n.id === e ? {
321
+ ...n,
312
322
  progress: 0,
313
323
  status: "uploading",
314
324
  error: void 0
315
- } : r
325
+ } : n
316
326
  )
317
- ), fe(e);
318
- }, J = () => {
319
- h || G.current?.click();
320
- }, ye = ae && !u ? "border-primary-500 bg-primary-500/5 ring-1 ring-primary-500/30" : "border-line bg-surface", we = D ?? (O === 0 ? "Limite de arquivos atingido." : `Você ainda precisa enviar ${O} arquivo${O > 1 ? "s" : ""}.`), Ge = () => /* @__PURE__ */ t(
327
+ );
328
+ const o = V ? m.find((s) => s.id === e) : void 0;
329
+ if (o) {
330
+ pe(o);
331
+ return;
332
+ }
333
+ me(e);
334
+ }, Z = () => {
335
+ h || K.current?.click();
336
+ }, De = ie && !f ? "border-primary-500 bg-primary-500/5 ring-1 ring-primary-500/30" : "border-line bg-surface", Ee = D ?? (O === 0 ? "Limite de arquivos atingido." : `Você ainda precisa enviar ${O} arquivo${O > 1 ? "s" : ""}.`), Ke = () => /* @__PURE__ */ t(
321
337
  "input",
322
338
  {
323
- id: s,
324
- ref: G,
339
+ id: a,
340
+ ref: K,
325
341
  className: "sr-only",
326
342
  type: "file",
327
- multiple: c > 1,
328
- onChange: Pe,
343
+ multiple: d > 1,
344
+ onChange: Be,
329
345
  disabled: h,
330
- ...Oe,
331
- accept: ce
346
+ ...ke,
347
+ accept: de
332
348
  }
333
- ), Ve = () => /* @__PURE__ */ n(
349
+ ), He = () => /* @__PURE__ */ r(
334
350
  "div",
335
351
  {
336
- className: `flex flex-col gap-sm rounded-xl border p-xl transition-colors ${ye} ${x}`,
337
- onDragEnter: xe,
338
- onDragLeave: ve,
339
- onDragOver: he,
340
- onDrop: be,
352
+ className: `flex flex-col gap-sm rounded-xl border p-xl transition-colors ${De} ${v}`,
353
+ onDragEnter: he,
354
+ onDragLeave: be,
355
+ onDragOver: Ne,
356
+ onDrop: Ce,
341
357
  children: [
342
- /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center justify-between gap-sm", children: [
358
+ /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center justify-between gap-sm", children: [
343
359
  /* @__PURE__ */ t("p", { className: "text-sm text-fg", children: "Arraste documentos para iniciar o upload" }),
344
360
  /* @__PURE__ */ t("span", { className: "text-sm text-fg/40", children: "OU" }),
345
361
  /* @__PURE__ */ t(
@@ -347,71 +363,71 @@ const ct = () => `${Date.now()}-${Math.random().toString(16).slice(2, 10)}`, Ct
347
363
  {
348
364
  type: "button",
349
365
  size: "sm",
350
- onClick: J,
366
+ onClick: Z,
351
367
  disabled: h,
352
368
  label: "Selecionar arquivo"
353
369
  }
354
370
  )
355
371
  ] }),
356
- pe(),
357
- j ? /* @__PURE__ */ t("p", { className: "text-sm text-orange-600", children: j }) : null
372
+ ve(),
373
+ B ? /* @__PURE__ */ t("p", { className: "text-sm text-orange-600", children: B }) : null
358
374
  ]
359
375
  }
360
- ), Ke = () => /* @__PURE__ */ n(
376
+ ), Xe = () => /* @__PURE__ */ r(
361
377
  "div",
362
378
  {
363
379
  role: "button",
364
380
  tabIndex: h ? -1 : 0,
365
381
  "aria-disabled": h || void 0,
366
- onClick: J,
382
+ onClick: Z,
367
383
  onKeyDown: (e) => {
368
- e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), J());
384
+ e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Z());
369
385
  },
370
- className: `flex flex-col gap-sm rounded-xl border p-xl text-center transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-brand-focus ${h ? "cursor-not-allowed" : `cursor-pointer ${ae ? "" : "hover:bg-surface-hover active:bg-surface-pressed"}`} ${ye} ${x}`,
371
- onDragEnter: xe,
372
- onDragLeave: ve,
373
- onDragOver: he,
374
- onDrop: be,
386
+ className: `flex flex-col gap-sm rounded-xl border p-xl text-center transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-brand-focus ${h ? "cursor-not-allowed" : `cursor-pointer ${ie ? "" : "hover:bg-surface-hover active:bg-surface-pressed"}`} ${De} ${v}`,
387
+ onDragEnter: he,
388
+ onDragLeave: be,
389
+ onDragOver: Ne,
390
+ onDrop: Ce,
375
391
  children: [
376
- /* @__PURE__ */ t(Je, { className: "mx-auto size-[24px] text-fg-secondary" }),
377
- /* @__PURE__ */ n("p", { className: "text-base leading-base text-fg", children: [
392
+ /* @__PURE__ */ t(Ye, { className: "mx-auto size-[24px] text-fg-secondary" }),
393
+ /* @__PURE__ */ r("p", { className: "text-base leading-base text-fg", children: [
378
394
  "Arraste aqui ou ",
379
395
  /* @__PURE__ */ t("span", { className: h ? "text-fg-disabled" : "text-blue-600 hover:underline", children: "selecione" }),
380
- m ? " uma pasta em seu dispositivo" : " arquivos em seu dispositivo"
396
+ p ? " uma pasta em seu dispositivo" : " arquivos em seu dispositivo"
381
397
  ] }),
382
- /* @__PURE__ */ n("p", { className: "text-sm text-fg-muted", children: [
383
- m ? "Todos os arquivos dentro da pasta serão enviados." : `Apenas arquivos ${ke} são suportados.`,
384
- l ? ` O tamanho máximo é de ${l} MB por arquivo.` : "",
385
- U ? null : D ? /* @__PURE__ */ n(y, { children: [
398
+ /* @__PURE__ */ r("p", { className: "text-sm text-fg-muted", children: [
399
+ p ? "Todos os arquivos dentro da pasta serão enviados." : `Apenas arquivos ${Me} são suportados.`,
400
+ c ? ` O tamanho máximo é de ${c} MB por arquivo.` : "",
401
+ F ? null : D ? /* @__PURE__ */ r(y, { children: [
386
402
  /* @__PURE__ */ t("br", {}),
387
- we
388
- ] }) : ` ${we}`
403
+ Ee
404
+ ] }) : ` ${Ee}`
389
405
  ] }),
390
- pe(),
391
- j ? /* @__PURE__ */ t("p", { className: "text-sm text-orange-600", children: j }) : null
406
+ ve(),
407
+ B ? /* @__PURE__ */ t("p", { className: "text-sm text-orange-600", children: B }) : null
392
408
  ]
393
409
  }
394
- ), He = (e) => /* @__PURE__ */ t("div", { className: te("px-xl py-md", e.status === "uploaded" && (Re ?? Se)), children: /* @__PURE__ */ t("div", { className: "flex min-h-7.5 w-full items-center justify-between gap-md", children: e.status === "uploading" ? /* @__PURE__ */ n(y, { children: [
395
- oe,
396
- /* @__PURE__ */ n("div", { className: "flex w-full flex-col", children: [
397
- /* @__PURE__ */ n("div", { className: "flex items-center gap-5xs", children: [
398
- /* @__PURE__ */ t("span", { className: "text-sm leading-sm font-semibold text-fg-secondary", title: e.name, children: _(e.name) }),
410
+ ), We = (e) => /* @__PURE__ */ t("div", { className: oe("px-xl py-md", e.status === "uploaded" && (Oe ?? qe)), children: /* @__PURE__ */ t("div", { className: "flex min-h-7.5 w-full items-center justify-between gap-md", children: e.status === "uploading" ? /* @__PURE__ */ r(y, { children: [
411
+ re,
412
+ /* @__PURE__ */ r("div", { className: "flex w-full flex-col", children: [
413
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-5xs", children: [
414
+ /* @__PURE__ */ t("span", { className: "text-sm leading-sm font-semibold text-fg-secondary", title: e.name, children: M(e.name) }),
399
415
  /* @__PURE__ */ t("span", { className: "text-xs font-bold text-fg-muted", children: "•" }),
400
- /* @__PURE__ */ t("span", { className: "text-xs leading-xs font-normal text-fg-muted", children: ue(e.size) })
416
+ /* @__PURE__ */ t("span", { className: "text-xs leading-xs font-normal text-fg-muted", children: fe(e.size) })
401
417
  ] }),
402
- /* @__PURE__ */ n("div", { className: "flex flex-row items-center gap-sm", children: [
403
- /* @__PURE__ */ t(Qe, { value: e.progress, className: "text-blue-800 **:data-[slot=progress-indicator]:bg-blue-800 **:data-[slot=progress-indicator]:rounded-full bg-surface-neutral" }),
404
- /* @__PURE__ */ n("span", { className: "text-xs font-normal leading-xs text-fg-secondary", children: [
418
+ /* @__PURE__ */ r("div", { className: "flex flex-row items-center gap-sm", children: [
419
+ /* @__PURE__ */ t(tt, { value: e.progress, className: "text-blue-800 **:data-[slot=progress-indicator]:bg-blue-800 **:data-[slot=progress-indicator]:rounded-full bg-surface-neutral" }),
420
+ /* @__PURE__ */ r("span", { className: "text-xs font-normal leading-xs text-fg-secondary", children: [
405
421
  e.progress,
406
422
  "%"
407
423
  ] })
408
424
  ] }),
409
425
  /* @__PURE__ */ t("span", { className: "text-xs leading-xs text-fg-muted", children: "Status de processamento" })
410
426
  ] })
411
- ] }) : e.status === "error" ? /* @__PURE__ */ n(y, { children: [
412
- /* @__PURE__ */ n("div", { className: "flex items-center gap-md", children: [
413
- /* @__PURE__ */ t(Ze, { className: "size-[24px] text-red-600" }),
414
- /* @__PURE__ */ t("span", { className: "text-sm leading-sm font-normal text-red-600", children: e.error ?? Ee })
427
+ ] }) : e.status === "error" ? /* @__PURE__ */ r(y, { children: [
428
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-md", children: [
429
+ /* @__PURE__ */ t(Qe, { className: "size-[24px] text-red-600" }),
430
+ /* @__PURE__ */ t("span", { className: "text-sm leading-sm font-normal text-red-600", children: e.error ?? Ae })
415
431
  ] }),
416
432
  /* @__PURE__ */ t(
417
433
  z,
@@ -419,37 +435,37 @@ const ct = () => `${Date.now()}-${Math.random().toString(16).slice(2, 10)}`, Ct
419
435
  label: "Tentar novamente",
420
436
  size: "sm",
421
437
  variant: "secondary",
422
- onClick: () => Ce(e.id),
423
- disabled: u
438
+ onClick: () => we(e.id),
439
+ disabled: f
424
440
  }
425
441
  )
426
- ] }) : /* @__PURE__ */ n(y, { children: [
427
- /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 items-center gap-md", children: [
428
- I ? /* @__PURE__ */ t(
429
- De,
442
+ ] }) : /* @__PURE__ */ r(y, { children: [
443
+ /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 items-center gap-md", children: [
444
+ G ? /* @__PURE__ */ t(
445
+ $e,
430
446
  {
431
- id: `${s}-sel-${e.id}`,
447
+ id: `${a}-sel-${e.id}`,
432
448
  "aria-label": `Selecionar ${e.name}`,
433
- checked: le.has(e.id),
434
- onCheckedChange: () => Be(e.id),
435
- disabled: u
449
+ checked: ce.has(e.id),
450
+ onCheckedChange: () => Fe(e.id),
451
+ disabled: f
436
452
  }
437
453
  ) : null,
438
454
  (() => {
439
- const o = /* @__PURE__ */ n("div", { className: "flex items-center gap-md", children: [
440
- /* @__PURE__ */ t($e, { className: "size-[24px] text-fg-muted" }),
441
- /* @__PURE__ */ n("div", { className: "flex items-center gap-5xs", children: [
442
- /* @__PURE__ */ t("span", { className: "text-sm font-semibold text-fg-secondary", title: e.name, children: _(e.name) }),
455
+ const o = /* @__PURE__ */ r("div", { className: "flex items-center gap-md", children: [
456
+ /* @__PURE__ */ t(Se, { className: "size-[24px] text-fg-muted" }),
457
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-5xs", children: [
458
+ /* @__PURE__ */ t("span", { className: "text-sm font-semibold text-fg-secondary", title: e.name, children: M(e.name) }),
443
459
  /* @__PURE__ */ t("span", { className: "text-xs font-bold text-fg-muted", children: "•" }),
444
- /* @__PURE__ */ t("span", { className: "text-xs text-fg-muted", children: ue(e.size) })
460
+ /* @__PURE__ */ t("span", { className: "text-xs text-fg-muted", children: fe(e.size) })
445
461
  ] })
446
462
  ] });
447
- return re ? re(e, o) : o;
463
+ return ne ? ne(e, o) : o;
448
464
  })()
449
465
  ] }),
450
- /* @__PURE__ */ n("div", { className: "flex items-center gap-sm", children: [
466
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-sm", children: [
451
467
  /* @__PURE__ */ t(
452
- M,
468
+ _,
453
469
  {
454
470
  content: "Análise IA",
455
471
  trigger: /* @__PURE__ */ t(
@@ -457,16 +473,16 @@ const ct = () => `${Date.now()}-${Math.random().toString(16).slice(2, 10)}`, Ct
457
473
  {
458
474
  type: "button",
459
475
  className: "ml-auto inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong disabled:opacity-60",
460
- onClick: () => Ce(e.id),
461
- disabled: u,
476
+ onClick: () => we(e.id),
477
+ disabled: f,
462
478
  "aria-label": `Reenviar ${e.name}`,
463
- children: /* @__PURE__ */ t("span", { className: "inline-flex [&>svg]:size-[22px]", children: oe })
479
+ children: /* @__PURE__ */ t("span", { className: "inline-flex [&>svg]:size-[22px]", children: re })
464
480
  }
465
481
  )
466
482
  }
467
483
  ),
468
484
  /* @__PURE__ */ t(
469
- M,
485
+ _,
470
486
  {
471
487
  content: "Remover arquivo",
472
488
  trigger: /* @__PURE__ */ t(
@@ -474,79 +490,79 @@ const ct = () => `${Date.now()}-${Math.random().toString(16).slice(2, 10)}`, Ct
474
490
  {
475
491
  type: "button",
476
492
  className: "ml-auto inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-red-50 hover:text-red-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500 disabled:opacity-60",
477
- onClick: () => Fe(e),
478
- disabled: u,
493
+ onClick: () => Ge(e),
494
+ disabled: f,
479
495
  "aria-label": `Remover ${e.name}`,
480
- children: /* @__PURE__ */ t(Ae, { className: "size-[20px]", "aria-hidden": !0 })
496
+ children: /* @__PURE__ */ t(Re, { className: "size-[20px]", "aria-hidden": !0 })
481
497
  }
482
498
  )
483
499
  }
484
500
  )
485
501
  ] })
486
502
  ] }) }) });
487
- return /* @__PURE__ */ n("div", { className: "flex flex-col gap-md", children: [
488
- ne && /* @__PURE__ */ t(
489
- Ye,
503
+ return /* @__PURE__ */ r("div", { className: "flex flex-col gap-md", children: [
504
+ se && /* @__PURE__ */ t(
505
+ et,
490
506
  {
491
507
  open: q !== null,
492
- onOpenChange: (e) => !e && P(null),
508
+ onOpenChange: (e) => !e && j(null),
493
509
  title: "Remover arquivo",
494
- body: /* @__PURE__ */ n("p", { className: "text-base leading-[1.4] text-fg-muted", children: [
510
+ body: /* @__PURE__ */ r("p", { className: "text-base leading-[1.4] text-fg-muted", children: [
495
511
  "O arquivo ",
496
512
  q?.name,
497
513
  " será removido desta solicitação. Você poderá anexar um novo arquivo. Deseja continuar?"
498
514
  ] }),
499
- secondaryAction: /* @__PURE__ */ t(z, { variant: "secondary", size: "md", label: "Cancelar", onClick: () => P(null) }),
500
- primaryAction: /* @__PURE__ */ t(z, { variant: "destructive", size: "md", label: "Confirmar", onClick: Ie })
515
+ secondaryAction: /* @__PURE__ */ t(z, { variant: "secondary", size: "md", label: "Cancelar", onClick: () => j(null) }),
516
+ primaryAction: /* @__PURE__ */ t(z, { variant: "destructive", size: "md", label: "Confirmar", onClick: Ve })
501
517
  }
502
518
  ),
503
- Ge(),
504
- i === "box" ? Ke() : Ve(),
505
- p.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-col gap-md rounded-xl bg-surface-muted p-md", children: [
506
- /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center justify-between gap-x-md gap-y-sm p-sm", children: [
507
- I && T.length > 0 ? /* @__PURE__ */ t(
508
- De,
519
+ Ke(),
520
+ i === "box" ? Xe() : He(),
521
+ m.length > 0 && /* @__PURE__ */ r("div", { className: "flex flex-col gap-md rounded-xl bg-surface-muted p-md", children: [
522
+ /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center justify-between gap-x-md gap-y-sm p-sm", children: [
523
+ G && T.length > 0 ? /* @__PURE__ */ t(
524
+ $e,
509
525
  {
510
- id: `${s}-selecionar-todos`,
526
+ id: `${a}-selecionar-todos`,
511
527
  label: "Selecionar todos",
512
- checked: je ? !0 : k.length > 0 ? "indeterminate" : !1,
513
- onCheckedChange: (e) => H(e ? new Set(T.map((o) => o.id)) : /* @__PURE__ */ new Set()),
514
- disabled: u
528
+ checked: Ue ? !0 : k.length > 0 ? "indeterminate" : !1,
529
+ onCheckedChange: (e) => X(e ? new Set(T.map((o) => o.id)) : /* @__PURE__ */ new Set()),
530
+ disabled: f
515
531
  }
516
532
  ) : null,
517
- /* @__PURE__ */ n("div", { className: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-md", children: [
518
- /* @__PURE__ */ t("p", { className: "min-w-0 truncate text-right text-sm text-fg-muted", children: !p.some((e) => e.status === "uploading") && X > 0 ? /* @__PURE__ */ n(y, { children: [
533
+ /* @__PURE__ */ r("div", { className: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-md", children: [
534
+ /* @__PURE__ */ t("p", { className: "min-w-0 truncate text-right text-sm text-fg-muted", children: !m.some((e) => e.status === "uploading") && W > 0 ? /* @__PURE__ */ r(y, { children: [
519
535
  "Você subiu",
520
536
  " ",
521
- /* @__PURE__ */ n("span", { className: "font-medium text-fg", children: [
522
- X,
537
+ /* @__PURE__ */ r("span", { className: "font-medium text-fg", children: [
538
+ W,
523
539
  " ",
524
- X === 1 ? "arquivo" : "arquivos"
540
+ W === 1 ? "arquivo" : "arquivos"
525
541
  ] })
526
542
  ] }) : "Enviando arquivos…" }),
527
- I && k.length > 0 ? /* @__PURE__ */ t(
543
+ G && k.length > 0 ? /* @__PURE__ */ t(
528
544
  z,
529
545
  {
530
546
  label: `Remover selecionados (${k.length})`,
531
547
  leftIcon: "Trash",
532
548
  variant: "destructive",
533
549
  size: "sm",
534
- onClick: Ue,
535
- disabled: u
550
+ onClick: Ie,
551
+ disabled: f
536
552
  }
537
553
  ) : null
538
554
  ] })
539
555
  ] }),
540
- /* @__PURE__ */ t("ul", { className: "flex flex-col overflow-hidden rounded-2xl border border-line bg-surface", children: p.map((e, o) => /* @__PURE__ */ n("li", { children: [
556
+ /* @__PURE__ */ t("ul", { className: "flex flex-col overflow-hidden rounded-2xl border border-line bg-surface", children: m.map((e, o) => /* @__PURE__ */ r("li", { children: [
541
557
  o > 0 && /* @__PURE__ */ t("div", { className: "mx-xl border-t border-line-subtle" }),
542
- He(e)
558
+ We(e)
543
559
  ] }, e.id)) })
544
560
  ] })
545
561
  ] });
546
562
  };
547
563
  export {
548
- Ct as FileUpload,
549
- Nt as FileUploaded,
550
- oe as iaIcon
564
+ wt as FileUpload,
565
+ yt as FileUploaded,
566
+ re as iaIcon
551
567
  };
552
568
  //# sourceMappingURL=fileUpload.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileUpload.js","sources":["../../../src/components/ui-garantiabr/fileUpload.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useEffect,\n useRef,\n useState,\n type ChangeEvent,\n type DragEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { Download, File, Sparkles, Trash, TriangleAlert, Upload } from 'lucide-react';\nimport { alertBanner } from './alertBanner';\nimport { Button } from './button';\nimport { Checkbox } from './checkbox';\nimport { Dialog as ConfirmDialog } from './dialog';\nimport { Tooltip } from './tooltip';\nimport { Progress } from '@/components/ui/progress';\nimport { cn } from '@/lib/utils';\n\nconst BYTES_IN_KB = 1024;\nconst UPLOAD_TICK_MS = 280;\n/** Formatos aceitos em todo upload da plataforma (lista fechada da v0, Decisões DP1, DP1-a e DP1-c: DOC, DOCX, XLS, XLSX e CSV ficam fora; WEBP é recusado). O `accept` recebido por props é ignorado de propósito, para\n * nenhuma tela divergir da lista oficial. */\nconst ALLOWED_DOCUMENT_EXTENSIONS = ['.pdf', '.jpg', '.jpeg', '.png', '.tiff', '.tif', '.bmp'] as const;\n/** HEIC/HEIF (fotos do iPhone) e WEBP saem da lista porque a leitura (OCR) não os aceita (PD-1259): ganham um motivo próprio na recusa. */\nconst FORMATOS_COM_DICA: Record<string, string> = {\n '.heic': 'foto do iPhone (.heic) não é aceita. Exporte a foto como JPG e envie de novo.',\n '.heif': 'foto do iPhone (.heif) não é aceita. Exporte a foto como JPG e envie de novo.',\n};\nconst FORMATOS_ACEITOS_TEXTO = 'PDF, JPG, PNG, TIFF ou BMP';\n\ntype TipoReal = 'pdf' | 'jpg' | 'png' | 'tiff' | 'bmp';\nconst TIPO_POR_EXTENSAO: Record<string, TipoReal> = { '.pdf': 'pdf', '.jpg': 'jpg', '.jpeg': 'jpg', '.png': 'png', '.tiff': 'tiff', '.tif': 'tiff', '.bmp': 'bmp' };\n\n/** Tipo real do arquivo pelos primeiros bytes (assinatura), e não pela extensão do nome (PD-1259, CA02). */\nasync function detectarTipoReal(file: File): Promise<TipoReal | null> {\n const b = new Uint8Array(await file.slice(0, 8).arrayBuffer());\n const comeca = (...bytes: number[]) => bytes.every((byte, i) => b[i] === byte);\n if (comeca(0x25, 0x50, 0x44, 0x46)) return 'pdf';\n if (comeca(0xff, 0xd8, 0xff)) return 'jpg';\n if (comeca(0x89, 0x50, 0x4e, 0x47)) return 'png';\n if (comeca(0x49, 0x49, 0x2a, 0x00) || comeca(0x4d, 0x4d, 0x00, 0x2a)) return 'tiff';\n if (comeca(0x42, 0x4d)) return 'bmp';\n return null;\n}\n\n/** Arquivo recusado na seleção e o motivo, em linguagem de quem envia (textos da PD-1259, P-1259-02). */\nexport interface ArquivoRecusado {\n nome: string;\n motivo: string;\n}\nconst DEFAULT_ACCEPT = ALLOWED_DOCUMENT_EXTENSIONS.join(',');\nconst DEBUG_ERROR_PROGRESS_THRESHOLD = 45;\nconst DEFAULT_DEBUG_ERROR_KEYWORD = 'erro';\nconst DEFAULT_DEBUG_ERROR_MESSAGE = 'Erro ao enviar o documento';\n/** Linha de arquivo já enviado: hover e pressed no padrão da plataforma (substitua com `uploadedItemClassName`). */\nconst UPLOADED_ITEM_CLASS = 'transition-colors hover:bg-surface-hover active:bg-surface-pressed';\nconst MAX_NOME_ARQUIVO_EXIBIDO = 40;\n\n/** Abrevia o nome do arquivo para exibição, preservando a extensão: no máximo 40 caracteres no total,\n * contando o \"(...)\" e a extensão (ex.: \"asdsadasdasdasdasdasdasdasdasdasda(...).pdf\"). Assim o nome não\n * empurra o botão de remover para fora da linha. O nome completo continua no `title`. */\nfunction abreviarNomeArquivo(nome: string, max = MAX_NOME_ARQUIVO_EXIBIDO): string {\n if (nome.length <= max) return nome;\n const ponto = nome.lastIndexOf('.');\n const extensao = ponto > 0 ? nome.slice(ponto) : '';\n const base = ponto > 0 ? nome.slice(0, ponto) : nome;\n const reticencias = '(...)';\n const disponivel = Math.max(1, max - extensao.length - reticencias.length);\n return `${base.slice(0, disponivel)}${reticencias}${extensao}`;\n}\n\nexport const iaIcon = (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"27\" height=\"27\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path d=\"M13.3919 2.66528C13.4399 2.49344 13.8061 2.49341 13.8541 2.66528C14.0178 3.25148 14.2794 3.93708 14.672 4.34497C15.0645 4.75276 15.7241 5.02448 16.2882 5.19458C16.4534 5.24459 16.4533 5.62455 16.2882 5.67472C15.724 5.84485 15.0645 6.11725 14.672 6.52515C14.2794 6.93306 14.0178 7.61861 13.8541 8.20484C13.8059 8.37638 13.4403 8.37627 13.3919 8.20484C13.2282 7.61875 12.9664 6.9331 12.574 6.52515C12.1814 6.11723 11.5211 5.84485 10.957 5.67472C10.7921 5.62436 10.792 5.24478 10.957 5.19458C11.5211 5.02445 12.1814 4.75289 12.574 4.34497C12.9665 3.93704 13.2281 3.25146 13.3919 2.66528Z\" fill=\"black\" />\n <path d=\"M15.8683 6.60409C15.8827 6.55252 15.993 6.55252 16.0074 6.60409C16.0565 6.77987 16.1347 6.98548 16.2524 7.10783C16.3701 7.23017 16.5682 7.31151 16.7374 7.36255C16.787 7.37751 16.787 7.49159 16.7374 7.50659C16.5681 7.55763 16.3701 7.63975 16.2524 7.76213C16.1347 7.88453 16.0565 8.09011 16.0074 8.26587C15.993 8.31739 15.8827 8.3174 15.8683 8.26587C15.8192 8.09009 15.741 7.88452 15.6233 7.76213C15.5055 7.63975 15.3075 7.55763 15.1383 7.50659C15.0887 7.49153 15.0887 7.37751 15.1383 7.36255C15.3075 7.31151 15.5056 7.23018 15.6233 7.10783C15.741 6.98548 15.8191 6.77988 15.8683 6.60409Z\" fill=\"black\" />\n <path d=\"M15.9895 1.73104C16.0136 1.64529 16.1964 1.64534 16.2206 1.73104C16.3025 2.02415 16.4337 2.36693 16.63 2.57088C16.8263 2.77481 17.156 2.91063 17.4381 2.99569C17.5206 3.02071 17.5205 3.2105 17.4381 3.23576C17.156 3.32082 16.8262 3.45742 16.63 3.66138C16.4337 3.86534 16.3025 4.20813 16.2206 4.50122C16.1962 4.58669 16.0138 4.58674 15.9895 4.50122C15.9077 4.20825 15.7771 3.86537 15.581 3.66138C15.3847 3.45747 15.0549 3.32083 14.7729 3.23576C14.6902 3.21082 14.6902 3.02063 14.7729 2.99569C15.0549 2.91062 15.3848 2.77475 15.581 2.57088C15.7772 2.3669 15.9077 2.02406 15.9895 1.73104Z\" fill=\"black\" />\n <path d=\"M8.33325 2.91675H7.7211C7.58023 2.91675 7.4459 2.97617 7.35113 3.08041L3.33325 7.50008V17.0001C3.33325 17.2762 3.55711 17.5001 3.83325 17.5001H14.4999C14.7761 17.5001 14.9999 17.2762 14.9999 17.0001V10.0001M3.33325 7.50008H7.83325C8.10939 7.50008 8.33325 7.27622 8.33325 7.00008V2.91675M10.8333 2.91675H8.33325\" stroke=\"black\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n </svg>\n);\n\nexport type FileUploadVariant = 'line' | 'box';\nexport type UploadStatus = 'uploading' | 'uploaded' | 'error';\n\nexport type UploadItem = {\n id: string;\n file: File;\n name: string;\n size: number;\n progress: number;\n status: UploadStatus;\n error?: string;\n};\n\nexport interface FileUploadedProps {\n /** Nome do arquivo; nomes longos são abreviados preservando a extensão (o completo fica no `title`). */\n name: string;\n /** Tamanho já formatado (ex.: \"518.6 KB\"). */\n sizeLabel?: string;\n /** Mostra o botão de baixar, para arquivos que já estão na plataforma. */\n onDownload?: () => void;\n /** Mostra o botão de análise por IA (o mesmo ícone do FileUpload). */\n onAnaliseIa?: () => void;\n /** `botao`: o botão \"Análise IA\" com texto, no estilo do botão de baixar (fundo cinza e hover verde); vira o percentual durante a análise. Padrão: só o ícone. */\n analiseIaVariante?: 'icone' | 'botao';\n /** Percentual (0–100) de uma análise em curso: no botão, o texto vira \"NN%\". */\n analiseIaProgresso?: number;\n /** Indicador de progresso no lugar do ícone enquanto a análise roda (ex.: o anel de progresso). */\n analiseIaIndicador?: ReactNode;\n /** Mostra o botão de remover. */\n onRemove?: () => void;\n /** Linha extra embaixo do nome, alinhada a ele (ex.: a origem do arquivo e a solicitação). */\n detalhe?: ReactNode;\n /** Clicar na linha (ex.: abrir uma prévia). Dá à linha o hover e o pressed do arquivo enviado. */\n onClick?: () => void;\n /** Quantos caracteres do nome aparecem antes de abreviar; reduza em contêineres estreitos. */\n nomeMax?: number;\n className?: string;\n}\n\n/** A linha de um arquivo já enviado, a mesma que o FileUpload mostra na lista, para usar fora dele (ex.: os anexos de uma avaliação).\n * Ícone de arquivo, nome, tamanho e as ações; com `onClick` a linha ganha hover e pressed. Empilhe várias dentro de um contêiner\n * com borda e `divide-y` para formar a lista. */\nexport function FileUploaded({ name, sizeLabel, onDownload, onAnaliseIa, analiseIaVariante = 'icone', analiseIaProgresso, analiseIaIndicador, detalhe, onRemove, onClick, nomeMax, className }: Readonly<FileUploadedProps>) {\n return (\n <div\n className={cn('px-xl py-md', onClick && cn(UPLOADED_ITEM_CLASS, 'cursor-pointer'), className)}\n onClick={onClick}\n onKeyDown={(event) => {\n if (onClick && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n onClick();\n }\n }}\n role={onClick ? 'button' : undefined}\n tabIndex={onClick ? 0 : undefined}\n >\n <div className=\"flex min-h-7.5 w-full items-center justify-between gap-md\">\n <div className=\"flex min-w-0 items-center gap-md\">\n <File className=\"size-[24px] shrink-0 text-fg-muted\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-col gap-3xs\">\n <div className=\"flex min-w-0 items-center gap-5xs\">\n <span className=\"text-sm font-semibold text-fg-secondary\" title={name}>\n {abreviarNomeArquivo(name, nomeMax)}\n </span>\n {sizeLabel ? (\n <>\n <span className=\"text-xs font-bold text-fg-muted\">•</span>\n <span className=\"shrink-0 whitespace-nowrap text-xs text-fg-muted\">{sizeLabel}</span>\n </>\n ) : null}\n </div>\n {detalhe}\n </div>\n </div>\n {onDownload || onAnaliseIa || onRemove ? (\n <div className=\"flex items-center gap-sm\">\n {onDownload ? (\n <Tooltip\n content=\"Baixar arquivo\"\n trigger={\n <button\n type=\"button\"\n className=\"inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong\"\n onClick={(event) => {\n event.stopPropagation();\n onDownload();\n }}\n aria-label={`Baixar ${name}`}\n >\n <Download className=\"size-[20px]\" aria-hidden />\n </button>\n }\n />\n ) : null}\n {onAnaliseIa && analiseIaVariante === 'botao' ? (\n <button\n type=\"button\"\n className=\"inline-flex h-[36px] items-center justify-center gap-3xs whitespace-nowrap rounded-full bg-surface-muted px-md text-sm text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong\"\n aria-label={`Análise IA de ${name}`}\n onClick={(event) => {\n event.stopPropagation();\n onAnaliseIa();\n }}\n >\n {analiseIaProgresso !== undefined && analiseIaIndicador ? analiseIaIndicador : <Sparkles className=\"size-[16px]\" aria-hidden=\"true\" />}\n <span className=\"leading-sm\">{analiseIaProgresso !== undefined ? `${Math.round(analiseIaProgresso)}%` : 'Análise IA'}</span>\n </button>\n ) : null}\n {onAnaliseIa && analiseIaVariante === 'icone' ? (\n <Tooltip\n content=\"Análise IA\"\n trigger={\n <button\n type=\"button\"\n className=\"inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong\"\n onClick={(event) => {\n event.stopPropagation();\n onAnaliseIa();\n }}\n aria-label={`Análise IA de ${name}`}\n >\n <span className=\"inline-flex [&>svg]:size-[22px]\">{iaIcon}</span>\n </button>\n }\n />\n ) : null}\n {onRemove ? (\n <Tooltip\n content=\"Remover arquivo\"\n trigger={\n <button\n type=\"button\"\n className=\"inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-red-50 hover:text-red-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500\"\n onClick={(event) => {\n event.stopPropagation();\n onRemove();\n }}\n aria-label={`Remover ${name}`}\n >\n <Trash className=\"size-[20px]\" aria-hidden />\n </button>\n }\n />\n ) : null}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nexport interface FileUploadProps\n extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'type' | 'multiple' | 'onChange' | 'value' | 'defaultValue' | 'className'\n > {\n id: string;\n variant?: FileUploadVariant;\n className?: string;\n maxFiles?: number;\n /** Faz o seletor nativo abrir em modo \"escolher pasta\" — todos os arquivos dentro da pasta escolhida entram na lista. */\n directory?: boolean;\n /** Tamanho máximo por arquivo, em MB — arquivos maiores são rejeitados e refletidos no aviso e na legenda da dropzone. */\n maxSizeMb?: number;\n /** Chamada a cada seleção com os arquivos recusados (vazio, formato, tipo real diferente da extensão ou acima do tamanho) e o motivo de cada um. */\n onRejectedFiles?: (recusados: ArquivoRecusado[]) => void;\n /** Oculta o \"Você ainda precisa enviar N arquivos\" da legenda da dropzone (Figma 322:50994 não usa esse texto). */\n hideRemainingHint?: boolean;\n /** Texto próprio no lugar do \"Você ainda precisa enviar N arquivos\" (ex.: quais documentos faltam, quando há uma lista de obrigatórios). */\n remainingHintText?: string;\n initialItems?: UploadItem[];\n debugErrorMode?: boolean;\n debugErrorKeyword?: string;\n debugErrorMessage?: string;\n /** Exibe um dialog de confirmação antes de remover um arquivo (Figma 15:26216) — a remoção só ocorre após \"Confirmar\", e mostra um alerta de sucesso/erro (mock: falha se o nome do arquivo contiver `debugErrorKeyword`). */\n confirmRemove?: boolean;\n /** Envolve o nome/ícone do arquivo já enviado com um trigger próprio do consumidor (ex.: `PdfViewerDialog`) — por padrão o nome não é clicável. */\n renderFileTrigger?: (item: UploadItem, content: ReactNode) => ReactNode;\n /** Classe extra aplicada à linha de cada arquivo já enviado (ex.: hover/pressed por item). */\n uploadedItemClassName?: string;\n /** Mostra um checkbox em cada arquivo enviado, \"Selecionar todos\" e \"Remover selecionados\", como na revisão de registros da Nova solicitação. */\n selecionavel?: boolean;\n onFilesChange?: (files: File[]) => void;\n onItemsChange?: (items: UploadItem[]) => void;\n}\n\nconst createUploadId = () => `${Date.now()}-${Math.random().toString(16).slice(2, 10)}`;\n\nexport const FileUpload = ({\n id,\n className = '',\n variant = 'line',\n maxFiles = 3,\n directory = false,\n maxSizeMb,\n onRejectedFiles,\n hideRemainingHint = false,\n remainingHintText,\n initialItems = [],\n debugErrorMode = false,\n debugErrorKeyword = DEFAULT_DEBUG_ERROR_KEYWORD,\n debugErrorMessage = DEFAULT_DEBUG_ERROR_MESSAGE,\n confirmRemove = false,\n renderFileTrigger,\n uploadedItemClassName,\n selecionavel = false,\n onFilesChange,\n onItemsChange,\n disabled,\n ...inputProps\n}: FileUploadProps) => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const dragCounterRef = useRef(0);\n const uploadTimersRef = useRef<Map<string, number>>(new Map());\n\n const [items, setItems] = useState<UploadItem[]>(() => [...initialItems]);\n const [isDragging, setIsDragging] = useState(false);\n const [itemPendenteRemocao, setItemPendenteRemocao] = useState<UploadItem | null>(null);\n const [avisoSelecao, setAvisoSelecao] = useState<string | null>(null);\n const [recusados, setRecusados] = useState<ArquivoRecusado[]>([]);\n const [selecionados, setSelecionados] = useState<Set<string>>(new Set());\n\n const enviadosCount = items.filter((item) => item.status === 'uploaded').length;\n const remainingSlots = Math.max(0, maxFiles - items.length);\n const isSelectionDisabled = Boolean(disabled || remainingSlots === 0);\n const inputAccept = DEFAULT_ACCEPT;\n const allowedExtensions = inputAccept\n .split(',')\n .map((extension) => extension.trim().toLowerCase())\n .filter(Boolean);\n const acceptedFormatsLabel = allowedExtensions\n .map((extension) => extension.toUpperCase())\n .join(', ')\n .replace(/, ([^,]*)$/, ' e $1');\n\n const formatSize = (sizeInBytes: number) => {\n const sizeInKb = sizeInBytes / BYTES_IN_KB;\n\n if (sizeInKb >= BYTES_IN_KB) {\n return `${(sizeInKb / BYTES_IN_KB).toFixed(1)} MB`;\n }\n\n return `${sizeInKb.toFixed(1)} KB`;\n };\n\n const isWithinSizeLimit = (file: File) => !maxSizeMb || file.size <= maxSizeMb * BYTES_IN_KB * BYTES_IN_KB;\n\n const clearUploadTimer = (itemId: string) => {\n const timerId = uploadTimersRef.current.get(itemId);\n\n if (timerId === undefined) {\n return;\n }\n\n window.clearInterval(timerId);\n uploadTimersRef.current.delete(itemId);\n };\n\n const clearAllUploadTimers = () => {\n uploadTimersRef.current.forEach((timerId) => {\n window.clearInterval(timerId);\n });\n uploadTimersRef.current.clear();\n };\n\n useEffect(() => {\n return () => {\n clearAllUploadTimers();\n };\n }, []);\n\n useEffect(() => {\n onItemsChange?.(items);\n }, [items, onItemsChange]);\n\n useEffect(() => {\n const inputEl = inputRef.current;\n if (!inputEl) return;\n if (directory) {\n inputEl.setAttribute('webkitdirectory', 'true');\n inputEl.setAttribute('directory', 'true');\n } else {\n inputEl.removeAttribute('webkitdirectory');\n inputEl.removeAttribute('directory');\n }\n }, [directory]);\n\n const shouldSetDebugError = (item: UploadItem, nextProgress: number) => {\n if (!debugErrorMode || nextProgress < DEBUG_ERROR_PROGRESS_THRESHOLD) {\n return false;\n }\n\n const normalizedKeyword = debugErrorKeyword.trim().toLowerCase();\n\n if (!normalizedKeyword) {\n return false;\n }\n\n return item.name.toLowerCase().includes(normalizedKeyword);\n };\n\n const startUploadSimulation = (itemId: string) => {\n const timerId = window.setInterval(() => {\n setItems((currentItems) => {\n const targetItem = currentItems.find((item) => item.id === itemId);\n\n if (!targetItem) {\n clearUploadTimer(itemId);\n return currentItems;\n }\n\n if (targetItem.status === 'uploaded' || targetItem.status === 'error') {\n clearUploadTimer(itemId);\n return currentItems;\n }\n\n const nextProgress = Math.min(100, targetItem.progress + Math.floor(Math.random() * 20) + 10);\n\n if (shouldSetDebugError(targetItem, nextProgress)) {\n clearUploadTimer(itemId);\n\n return currentItems.map((item) =>\n item.id === itemId\n ? {\n ...item,\n progress: 0,\n status: 'error',\n error: debugErrorMessage,\n }\n : item,\n );\n }\n\n const nextStatus: UploadStatus = nextProgress === 100 ? 'uploaded' : 'uploading';\n\n if (nextStatus === 'uploaded') {\n clearUploadTimer(itemId);\n }\n\n return currentItems.map((item) =>\n item.id === itemId\n ? {\n ...item,\n progress: nextProgress,\n status: nextStatus,\n error: undefined,\n }\n : item,\n );\n });\n }, UPLOAD_TICK_MS);\n\n uploadTimersRef.current.set(itemId, timerId);\n };\n\n const updateItems = (nextItems: UploadItem[]) => {\n setItems(nextItems);\n onFilesChange?.(nextItems.map((item) => item.file));\n };\n\n /** Motivo da recusa de um arquivo, ou null quando ele pode seguir. Ordem: vazio, formato, tipo real, tamanho. */\n const motivoDaRecusa = async (file: File): Promise<string | null> => {\n const nome = file.name.toLowerCase();\n const ponto = nome.lastIndexOf('.');\n const extensao = ponto > 0 ? nome.slice(ponto) : '';\n if (file.size === 0) return 'o arquivo está vazio.';\n if (extensao && !allowedExtensions.includes(extensao)) {\n return FORMATOS_COM_DICA[extensao] ?? `o formato ${extensao} não é aceito. Envie em ${FORMATOS_ACEITOS_TEXTO}.`;\n }\n const tipoReal = await detectarTipoReal(file);\n if (!tipoReal) {\n return extensao\n ? `o arquivo tem extensão ${extensao}, mas o conteúdo não é desse formato. Abra o arquivo, salve de novo como ${FORMATOS_ACEITOS_TEXTO} e envie.`\n : `não foi possível reconhecer o formato do arquivo. Envie em ${FORMATOS_ACEITOS_TEXTO}.`;\n }\n if (extensao && TIPO_POR_EXTENSAO[extensao] !== tipoReal) {\n return `o arquivo tem extensão ${extensao}, mas o conteúdo é ${tipoReal.toUpperCase()}. Salve de novo no formato certo e envie.`;\n }\n if (maxSizeMb && !isWithinSizeLimit(file)) {\n // Arredonda para cima: 1 byte acima do teto não pode aparecer como \"25,00 MB\" (PD-1259, CT-1259-04).\n const mb = (Math.ceil((file.size / (BYTES_IN_KB * BYTES_IN_KB)) * 100) / 100).toLocaleString('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 });\n return `tem ${mb} MB, acima do limite de ${maxSizeMb} MB por arquivo. Reduza o arquivo ou divida o documento.`;\n }\n return null;\n };\n\n const handleFilesSelected = async (selectedFiles: File[]) => {\n if (isSelectionDisabled || selectedFiles.length === 0) {\n return;\n }\n\n // Só o arquivo inválido é recusado; os demais seguem (PD-1259, CT-1259-10).\n const motivos = await Promise.all(selectedFiles.map(motivoDaRecusa));\n const novosRecusados = selectedFiles.flatMap((file, i) => (motivos[i] ? [{ nome: file.name, motivo: motivos[i] as string }] : []));\n const validos = selectedFiles.filter((_, i) => !motivos[i]);\n setRecusados(novosRecusados);\n onRejectedFiles?.(novosRecusados);\n\n const acceptedFiles = validos.slice(0, remainingSlots);\n\n if (validos.length > acceptedFiles.length) {\n setAvisoSelecao(`${acceptedFiles.length} de ${validos.length} arquivos foram adicionados: o limite de ${maxFiles} arquivos foi atingido.`);\n } else {\n setAvisoSelecao(null);\n }\n\n if (acceptedFiles.length === 0) {\n return;\n }\n\n const newItems = acceptedFiles.map((file) => ({\n id: createUploadId(),\n file,\n name: file.name,\n size: file.size,\n progress: 0,\n status: 'uploading' as const,\n }));\n\n const nextItems = [...items, ...newItems];\n\n updateItems(nextItems);\n newItems.forEach((item) => startUploadSimulation(item.id));\n };\n\n /** Lista dos arquivos recusados na última seleção, com o motivo de cada um; anunciada a leitores de tela. */\n const renderRecusados = () =>\n recusados.length === 0 ? null : (\n <div role=\"alert\" className=\"flex w-full flex-col gap-4xs rounded-lg border border-orange-500 bg-orange-50 px-md py-sm text-left text-sm text-orange-600\">\n {recusados.length === 1 ? (\n <p>\n <span className=\"font-medium\">\"{abreviarNomeArquivo(recusados[0].nome)}\" não foi adicionado:</span> {recusados[0].motivo}\n </p>\n ) : (\n <>\n <p className=\"font-medium\">{recusados.length} arquivos não foram adicionados:</p>\n <ul className=\"flex list-disc flex-col gap-5xs pl-md\">\n {recusados.map((recusado) => (\n <li key={recusado.nome}>\n <span className=\"font-medium\">{abreviarNomeArquivo(recusado.nome)}:</span> {recusado.motivo}\n </li>\n ))}\n </ul>\n </>\n )}\n </div>\n );\n\n const handleSelectFiles = (event: ChangeEvent<HTMLInputElement>) => {\n const selectedFiles = Array.from(event.target.files ?? []);\n\n void handleFilesSelected(selectedFiles);\n event.target.value = '';\n };\n\n const resetDragState = () => {\n dragCounterRef.current = 0;\n setIsDragging(false);\n };\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (disabled) {\n return;\n }\n\n dragCounterRef.current += 1;\n setIsDragging(true);\n };\n\n const handleDragLeave = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (disabled) {\n return;\n }\n\n dragCounterRef.current = Math.max(0, dragCounterRef.current - 1);\n\n if (dragCounterRef.current === 0) {\n setIsDragging(false);\n }\n };\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n\n if (disabled) {\n return;\n }\n\n event.dataTransfer.dropEffect = 'copy';\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n const droppedFiles = Array.from(event.dataTransfer.files ?? []);\n\n if (disabled) {\n resetDragState();\n return;\n }\n\n void handleFilesSelected(droppedFiles);\n resetDragState();\n };\n\n const handleRemoveItem = (itemId: string) => {\n clearUploadTimer(itemId);\n updateItems(items.filter((item) => item.id !== itemId));\n };\n\n const itensSelecionaveis = items.filter((item) => item.status === 'uploaded');\n const selecionadosValidos = itensSelecionaveis.filter((item) => selecionados.has(item.id));\n const todosSelecionados = itensSelecionaveis.length > 0 && selecionadosValidos.length === itensSelecionaveis.length;\n\n const alternarSelecionado = (itemId: string) =>\n setSelecionados((atual) => {\n const proximo = new Set(atual);\n if (proximo.has(itemId)) proximo.delete(itemId);\n else proximo.add(itemId);\n return proximo;\n });\n\n const removerSelecionados = () => {\n const ids = new Set(selecionadosValidos.map((item) => item.id));\n ids.forEach((id) => clearUploadTimer(id));\n updateItems(items.filter((item) => !ids.has(item.id)));\n setSelecionados(new Set());\n alertBanner.show({\n type: 'success',\n title: ids.size === 1 ? 'Arquivo removido com sucesso' : `${ids.size} arquivos removidos com sucesso`,\n description: 'Você pode anexar novos arquivos utilizando o campo de upload.',\n });\n };\n\n const requestRemoveItem = (item: UploadItem) => {\n if (confirmRemove) {\n setItemPendenteRemocao(item);\n return;\n }\n\n handleRemoveItem(item.id);\n };\n\n const confirmarRemocao = () => {\n if (!itemPendenteRemocao) return;\n\n const falhou = itemPendenteRemocao.name.toLowerCase().includes(debugErrorKeyword.trim().toLowerCase());\n const itemAlvo = itemPendenteRemocao;\n\n setItemPendenteRemocao(null);\n\n if (falhou) {\n alertBanner.show({\n type: 'error',\n title: 'Não foi possível remover o arquivo',\n description: 'Ocorreu um erro ao tentar remover o arquivo. Tente novamente ou entre em contato com o suporte.',\n });\n return;\n }\n\n handleRemoveItem(itemAlvo.id);\n alertBanner.show({\n type: 'success',\n title: 'Arquivo removido com sucesso',\n description: 'O arquivo foi removido. Você pode anexar um novo utilizando o campo de upload.',\n });\n };\n\n const handleRetryItem = (itemId: string) => {\n clearUploadTimer(itemId);\n setItems((currentItems) =>\n currentItems.map((item) =>\n item.id === itemId\n ? {\n ...item,\n progress: 0,\n status: 'uploading',\n error: undefined,\n }\n : item,\n ),\n );\n startUploadSimulation(itemId);\n };\n\n const openFileDialog = () => {\n if (isSelectionDisabled) {\n return;\n }\n\n inputRef.current?.click();\n };\n\n const dragStateClass = isDragging && !disabled\n ? 'border-primary-500 bg-primary-500/5 ring-1 ring-primary-500/30'\n : 'border-line bg-surface';\n\n const helperText = remainingHintText ?? (remainingSlots === 0\n ? 'Limite de arquivos atingido.'\n : `Você ainda precisa enviar ${remainingSlots} arquivo${remainingSlots > 1 ? 's' : ''}.`);\n\n const renderHiddenFileInput = () => (\n <input\n id={id}\n ref={inputRef}\n className=\"sr-only\"\n type=\"file\"\n multiple={maxFiles > 1}\n onChange={handleSelectFiles}\n disabled={isSelectionDisabled}\n {...inputProps}\n accept={inputAccept}\n />\n );\n\n const renderLineDropzone = () => (\n <div\n className={`flex flex-col gap-sm rounded-xl border p-xl transition-colors ${dragStateClass} ${className}`}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <div className=\"flex flex-wrap items-center justify-between gap-sm\">\n <p className=\"text-sm text-fg\">Arraste documentos para iniciar o upload</p>\n <span className=\"text-sm text-fg/40\">OU</span>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={openFileDialog}\n disabled={isSelectionDisabled}\n label=\"Selecionar arquivo\"\n />\n </div>\n {renderRecusados()}\n {avisoSelecao ? <p className=\"text-sm text-orange-600\">{avisoSelecao}</p> : null}\n </div>\n );\n\n const renderBoxDropzone = () => (\n <div\n role=\"button\"\n tabIndex={isSelectionDisabled ? -1 : 0}\n aria-disabled={isSelectionDisabled || undefined}\n onClick={openFileDialog}\n onKeyDown={(event) => {\n if (event.target === event.currentTarget && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n openFileDialog();\n }\n }}\n className={`flex flex-col gap-sm rounded-xl border p-xl text-center transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-brand-focus ${\n isSelectionDisabled ? 'cursor-not-allowed' : `cursor-pointer ${isDragging ? '' : 'hover:bg-surface-hover active:bg-surface-pressed'}`\n } ${dragStateClass} ${className}`}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <Upload className=\"mx-auto size-[24px] text-fg-secondary\" />\n <p className=\"text-base leading-base text-fg\">\n {'Arraste aqui ou '}\n <span className={isSelectionDisabled ? 'text-fg-disabled' : 'text-blue-600 hover:underline'}>selecione</span>\n {directory ? ' uma pasta em seu dispositivo' : ' arquivos em seu dispositivo'}\n </p>\n <p className=\"text-sm text-fg-muted\">\n {directory ? 'Todos os arquivos dentro da pasta serão enviados.' : `Apenas arquivos ${acceptedFormatsLabel} são suportados.`}\n {maxSizeMb ? ` O tamanho máximo é de ${maxSizeMb} MB por arquivo.` : ''}\n {hideRemainingHint ? null : remainingHintText ? (\n <>\n <br />\n {helperText}\n </>\n ) : (\n ` ${helperText}`\n )}\n </p>\n {renderRecusados()}\n {avisoSelecao ? <p className=\"text-sm text-orange-600\">{avisoSelecao}</p> : null}\n </div>\n );\n\n const renderUploadItem = (item: UploadItem) => (\n <div className={cn('px-xl py-md', item.status === 'uploaded' && (uploadedItemClassName ?? UPLOADED_ITEM_CLASS))}>\n <div className=\"flex min-h-7.5 w-full items-center justify-between gap-md\">\n {item.status === 'uploading' ? (\n <>\n {iaIcon}\n <div className=\"flex w-full flex-col\">\n <div className=\"flex items-center gap-5xs\">\n <span className=\"text-sm leading-sm font-semibold text-fg-secondary\" title={item.name}>\n {abreviarNomeArquivo(item.name)}\n </span>\n <span className=\"text-xs font-bold text-fg-muted\">•</span>\n <span className=\"text-xs leading-xs font-normal text-fg-muted\">{formatSize(item.size)}</span>\n </div>\n <div className=\"flex flex-row items-center gap-sm\">\n <Progress value={item.progress} className=\"text-blue-800 **:data-[slot=progress-indicator]:bg-blue-800 **:data-[slot=progress-indicator]:rounded-full bg-surface-neutral\" />\n <span className=\"text-xs font-normal leading-xs text-fg-secondary\">{item.progress}%</span>\n </div>\n <span className=\"text-xs leading-xs text-fg-muted\">Status de processamento</span>\n </div>\n </>\n ) : item.status === 'error' ? (\n <>\n <div className=\"flex items-center gap-md\">\n <TriangleAlert className=\"size-[24px] text-red-600\" />\n <span className=\"text-sm leading-sm font-normal text-red-600\">\n {item.error ?? DEFAULT_DEBUG_ERROR_MESSAGE}\n </span>\n </div>\n <Button\n label=\"Tentar novamente\"\n size=\"sm\"\n variant=\"secondary\"\n onClick={() => handleRetryItem(item.id)}\n disabled={disabled}\n />\n </>\n ) : (\n <>\n <div className=\"flex min-w-0 flex-1 items-center gap-md\">\n {selecionavel ? (\n <Checkbox\n id={`${id}-sel-${item.id}`}\n aria-label={`Selecionar ${item.name}`}\n checked={selecionados.has(item.id)}\n onCheckedChange={() => alternarSelecionado(item.id)}\n disabled={disabled}\n />\n ) : null}\n {(() => {\n const fileInfo = (\n <div className=\"flex items-center gap-md\">\n <File className=\"size-[24px] text-fg-muted\" />\n <div className=\"flex items-center gap-5xs\">\n <span className=\"text-sm font-semibold text-fg-secondary\" title={item.name}>\n {abreviarNomeArquivo(item.name)}\n </span>\n <span className=\"text-xs font-bold text-fg-muted\">•</span>\n <span className=\"text-xs text-fg-muted\">{formatSize(item.size)}</span>\n </div>\n </div>\n );\n\n return renderFileTrigger ? renderFileTrigger(item, fileInfo) : fileInfo;\n })()}\n </div>\n\n <div className=\"flex items-center gap-sm\">\n <Tooltip\n content=\"Análise IA\"\n trigger={\n <button\n type=\"button\"\n className=\"ml-auto inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong disabled:opacity-60\"\n onClick={() => handleRetryItem(item.id)}\n disabled={disabled}\n aria-label={`Reenviar ${item.name}`}\n >\n <span className=\"inline-flex [&>svg]:size-[22px]\">{iaIcon}</span>\n </button>\n }\n />\n <Tooltip\n content=\"Remover arquivo\"\n trigger={\n <button\n type=\"button\"\n className=\"ml-auto inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-red-50 hover:text-red-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500 disabled:opacity-60\"\n onClick={() => requestRemoveItem(item)}\n disabled={disabled}\n aria-label={`Remover ${item.name}`}\n >\n <Trash className=\"size-[20px]\" aria-hidden />\n </button>\n }\n />\n </div>\n </>\n )}\n </div>\n </div>\n );\n\n return (\n <div className=\"flex flex-col gap-md\">\n {confirmRemove && (\n <ConfirmDialog\n open={itemPendenteRemocao !== null}\n onOpenChange={(open) => !open && setItemPendenteRemocao(null)}\n title=\"Remover arquivo\"\n body={\n <p className=\"text-base leading-[1.4] text-fg-muted\">\n O arquivo {itemPendenteRemocao?.name} será removido desta solicitação. Você poderá anexar um novo\n arquivo. Deseja continuar?\n </p>\n }\n secondaryAction={\n <Button variant=\"secondary\" size=\"md\" label=\"Cancelar\" onClick={() => setItemPendenteRemocao(null)} />\n }\n primaryAction={<Button variant=\"destructive\" size=\"md\" label=\"Confirmar\" onClick={confirmarRemocao} />}\n />\n )}\n\n {renderHiddenFileInput()}\n {variant === 'box' ? renderBoxDropzone() : renderLineDropzone()}\n\n {items.length > 0 && (\n <div className=\"flex flex-col gap-md rounded-xl bg-surface-muted p-md\">\n <div className=\"flex flex-wrap items-center justify-between gap-x-md gap-y-sm p-sm\">\n {selecionavel && itensSelecionaveis.length > 0 ? (\n <Checkbox\n id={`${id}-selecionar-todos`}\n label=\"Selecionar todos\"\n checked={todosSelecionados ? true : selecionadosValidos.length > 0 ? 'indeterminate' : false}\n onCheckedChange={(marcado) =>\n setSelecionados(marcado ? new Set(itensSelecionaveis.map((item) => item.id)) : new Set())\n }\n disabled={disabled}\n />\n ) : null}\n <div className=\"ml-auto flex min-w-0 flex-wrap items-center justify-end gap-md\">\n <p className=\"min-w-0 truncate text-right text-sm text-fg-muted\">\n {!items.some((item) => item.status === 'uploading') && enviadosCount > 0 ? (\n <>\n Você subiu{' '}\n <span className=\"font-medium text-fg\">\n {enviadosCount} {enviadosCount === 1 ? 'arquivo' : 'arquivos'}\n </span>\n </>\n ) : (\n 'Enviando arquivos…'\n )}\n </p>\n {selecionavel && selecionadosValidos.length > 0 ? (\n <Button\n label={`Remover selecionados (${selecionadosValidos.length})`}\n leftIcon=\"Trash\"\n variant=\"destructive\"\n size=\"sm\"\n onClick={removerSelecionados}\n disabled={disabled}\n />\n ) : null}\n </div>\n </div>\n <ul className=\"flex flex-col overflow-hidden rounded-2xl border border-line bg-surface\">\n {items.map((item, index) => (\n <li key={item.id}>\n {index > 0 && <div className=\"mx-xl border-t border-line-subtle\" />}\n {renderUploadItem(item)}\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n};\n"],"names":["BYTES_IN_KB","UPLOAD_TICK_MS","ALLOWED_DOCUMENT_EXTENSIONS","FORMATOS_COM_DICA","FORMATOS_ACEITOS_TEXTO","TIPO_POR_EXTENSAO","detectarTipoReal","file","b","comeca","bytes","byte","i","DEFAULT_ACCEPT","DEBUG_ERROR_PROGRESS_THRESHOLD","DEFAULT_DEBUG_ERROR_KEYWORD","DEFAULT_DEBUG_ERROR_MESSAGE","UPLOADED_ITEM_CLASS","MAX_NOME_ARQUIVO_EXIBIDO","abreviarNomeArquivo","nome","max","ponto","extensao","base","reticencias","disponivel","iaIcon","jsxs","jsx","FileUploaded","name","sizeLabel","onDownload","onAnaliseIa","analiseIaVariante","analiseIaProgresso","analiseIaIndicador","detalhe","onRemove","onClick","nomeMax","className","cn","event","File","Fragment","Tooltip","Download","Sparkles","Trash","createUploadId","FileUpload","id","variant","maxFiles","directory","maxSizeMb","onRejectedFiles","hideRemainingHint","remainingHintText","initialItems","debugErrorMode","debugErrorKeyword","debugErrorMessage","confirmRemove","renderFileTrigger","uploadedItemClassName","selecionavel","onFilesChange","onItemsChange","disabled","inputProps","inputRef","useRef","dragCounterRef","uploadTimersRef","items","setItems","useState","isDragging","setIsDragging","itemPendenteRemocao","setItemPendenteRemocao","avisoSelecao","setAvisoSelecao","recusados","setRecusados","selecionados","setSelecionados","enviadosCount","item","remainingSlots","isSelectionDisabled","inputAccept","allowedExtensions","extension","acceptedFormatsLabel","formatSize","sizeInBytes","sizeInKb","isWithinSizeLimit","clearUploadTimer","itemId","timerId","clearAllUploadTimers","useEffect","inputEl","shouldSetDebugError","nextProgress","normalizedKeyword","startUploadSimulation","currentItems","targetItem","nextStatus","updateItems","nextItems","motivoDaRecusa","tipoReal","handleFilesSelected","selectedFiles","motivos","novosRecusados","validos","_","acceptedFiles","newItems","renderRecusados","recusado","handleSelectFiles","resetDragState","handleDragEnter","handleDragLeave","handleDragOver","handleDrop","droppedFiles","handleRemoveItem","itensSelecionaveis","selecionadosValidos","todosSelecionados","alternarSelecionado","atual","proximo","removerSelecionados","ids","alertBanner","requestRemoveItem","confirmarRemocao","falhou","itemAlvo","handleRetryItem","openFileDialog","dragStateClass","helperText","renderHiddenFileInput","renderLineDropzone","Button","renderBoxDropzone","Upload","renderUploadItem","Progress","TriangleAlert","Checkbox","fileInfo","ConfirmDialog","open","marcado","index"],"mappings":";;;;;;;;;;;AAoBA,MAAMA,IAAc,MACdC,KAAiB,KAGjBC,KAA8B,CAAC,QAAQ,QAAQ,SAAS,QAAQ,SAAS,QAAQ,MAAM,GAEvFC,KAA4C;AAAA,EAChD,SAAS;AAAA,EACT,SAAS;AACX,GACMC,KAAyB,8BAGzBC,KAA8C,EAAE,QAAQ,OAAO,QAAQ,OAAO,SAAS,OAAO,QAAQ,OAAO,SAAS,QAAQ,QAAQ,QAAQ,QAAQ,MAAA;AAG5J,eAAeC,GAAiBC,GAAsC;AACpE,QAAMC,IAAI,IAAI,WAAW,MAAMD,EAAK,MAAM,GAAG,CAAC,EAAE,aAAa,GACvDE,IAAS,IAAIC,MAAoBA,EAAM,MAAM,CAACC,GAAMC,MAAMJ,EAAEI,CAAC,MAAMD,CAAI;AAC7E,SAAIF,EAAO,IAAM,IAAM,IAAM,EAAI,IAAU,QACvCA,EAAO,KAAM,KAAM,GAAI,IAAU,QACjCA,EAAO,KAAM,IAAM,IAAM,E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gBAAA3I,EAAC,MAAA,EACE,UAAA;AAAA,QAAA2I,IAAQ,KAAK,gBAAA1I,EAAC,OAAA,EAAI,WAAU,qCAAoC;AAAA,QAChEkI,GAAiBpE,CAAI;AAAA,MAAA,KAFfA,EAAK,EAGd,CACD,EAAA,CACH;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"fileUpload.js","sources":["../../../src/components/ui-garantiabr/fileUpload.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useEffect,\n useRef,\n useState,\n type ChangeEvent,\n type DragEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { Download, File, Sparkles, Trash, TriangleAlert, Upload } from 'lucide-react';\nimport { alertBanner } from './alertBanner';\nimport { Button } from './button';\nimport { Checkbox } from './checkbox';\nimport { Dialog as ConfirmDialog } from './dialog';\nimport { Tooltip } from './tooltip';\nimport { Progress } from '@/components/ui/progress';\nimport { cn } from '@/lib/utils';\n\nconst BYTES_IN_KB = 1024;\nconst UPLOAD_TICK_MS = 280;\n/** Formatos aceitos em todo upload da plataforma (lista fechada da v0, Decisões DP1, DP1-a e DP1-c: DOC, DOCX, XLS, XLSX e CSV ficam fora; WEBP é recusado). O `accept` recebido por props é ignorado de propósito, para\n * nenhuma tela divergir da lista oficial. */\nconst ALLOWED_DOCUMENT_EXTENSIONS = ['.pdf', '.jpg', '.jpeg', '.png', '.tiff', '.tif', '.bmp'] as const;\n/** HEIC/HEIF (fotos do iPhone) e WEBP saem da lista porque a leitura (OCR) não os aceita (PD-1259): ganham um motivo próprio na recusa. */\nconst FORMATOS_COM_DICA: Record<string, string> = {\n '.heic': 'foto do iPhone (.heic) não é aceita. Exporte a foto como JPG e envie de novo.',\n '.heif': 'foto do iPhone (.heif) não é aceita. Exporte a foto como JPG e envie de novo.',\n};\nconst FORMATOS_ACEITOS_TEXTO = 'PDF, JPG, PNG, TIFF ou BMP';\n\ntype TipoReal = 'pdf' | 'jpg' | 'png' | 'tiff' | 'bmp';\nconst TIPO_POR_EXTENSAO: Record<string, TipoReal> = { '.pdf': 'pdf', '.jpg': 'jpg', '.jpeg': 'jpg', '.png': 'png', '.tiff': 'tiff', '.tif': 'tiff', '.bmp': 'bmp' };\n\n/** Tipo real do arquivo pelos primeiros bytes (assinatura), e não pela extensão do nome (PD-1259, CA02). */\nasync function detectarTipoReal(file: File): Promise<TipoReal | null> {\n const b = new Uint8Array(await file.slice(0, 8).arrayBuffer());\n const comeca = (...bytes: number[]) => bytes.every((byte, i) => b[i] === byte);\n if (comeca(0x25, 0x50, 0x44, 0x46)) return 'pdf';\n if (comeca(0xff, 0xd8, 0xff)) return 'jpg';\n if (comeca(0x89, 0x50, 0x4e, 0x47)) return 'png';\n if (comeca(0x49, 0x49, 0x2a, 0x00) || comeca(0x4d, 0x4d, 0x00, 0x2a)) return 'tiff';\n if (comeca(0x42, 0x4d)) return 'bmp';\n return null;\n}\n\n/** Arquivo recusado na seleção e o motivo, em linguagem de quem envia (textos da PD-1259, P-1259-02). */\nexport interface ArquivoRecusado {\n nome: string;\n motivo: string;\n}\nconst DEFAULT_ACCEPT = ALLOWED_DOCUMENT_EXTENSIONS.join(',');\nconst DEBUG_ERROR_PROGRESS_THRESHOLD = 45;\nconst DEFAULT_DEBUG_ERROR_KEYWORD = 'erro';\nconst DEFAULT_DEBUG_ERROR_MESSAGE = 'Erro ao enviar o documento';\n/** Linha de arquivo já enviado: hover e pressed no padrão da plataforma (substitua com `uploadedItemClassName`). */\nconst UPLOADED_ITEM_CLASS = 'transition-colors hover:bg-surface-hover active:bg-surface-pressed';\nconst MAX_NOME_ARQUIVO_EXIBIDO = 40;\n\n/** Abrevia o nome do arquivo para exibição, preservando a extensão: no máximo 40 caracteres no total,\n * contando o \"(...)\" e a extensão (ex.: \"asdsadasdasdasdasdasdasdasdasdasda(...).pdf\"). Assim o nome não\n * empurra o botão de remover para fora da linha. O nome completo continua no `title`. */\nfunction abreviarNomeArquivo(nome: string, max = MAX_NOME_ARQUIVO_EXIBIDO): string {\n if (nome.length <= max) return nome;\n const ponto = nome.lastIndexOf('.');\n const extensao = ponto > 0 ? nome.slice(ponto) : '';\n const base = ponto > 0 ? nome.slice(0, ponto) : nome;\n const reticencias = '(...)';\n const disponivel = Math.max(1, max - extensao.length - reticencias.length);\n return `${base.slice(0, disponivel)}${reticencias}${extensao}`;\n}\n\nexport const iaIcon = (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"27\" height=\"27\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path d=\"M13.3919 2.66528C13.4399 2.49344 13.8061 2.49341 13.8541 2.66528C14.0178 3.25148 14.2794 3.93708 14.672 4.34497C15.0645 4.75276 15.7241 5.02448 16.2882 5.19458C16.4534 5.24459 16.4533 5.62455 16.2882 5.67472C15.724 5.84485 15.0645 6.11725 14.672 6.52515C14.2794 6.93306 14.0178 7.61861 13.8541 8.20484C13.8059 8.37638 13.4403 8.37627 13.3919 8.20484C13.2282 7.61875 12.9664 6.9331 12.574 6.52515C12.1814 6.11723 11.5211 5.84485 10.957 5.67472C10.7921 5.62436 10.792 5.24478 10.957 5.19458C11.5211 5.02445 12.1814 4.75289 12.574 4.34497C12.9665 3.93704 13.2281 3.25146 13.3919 2.66528Z\" fill=\"black\" />\n <path d=\"M15.8683 6.60409C15.8827 6.55252 15.993 6.55252 16.0074 6.60409C16.0565 6.77987 16.1347 6.98548 16.2524 7.10783C16.3701 7.23017 16.5682 7.31151 16.7374 7.36255C16.787 7.37751 16.787 7.49159 16.7374 7.50659C16.5681 7.55763 16.3701 7.63975 16.2524 7.76213C16.1347 7.88453 16.0565 8.09011 16.0074 8.26587C15.993 8.31739 15.8827 8.3174 15.8683 8.26587C15.8192 8.09009 15.741 7.88452 15.6233 7.76213C15.5055 7.63975 15.3075 7.55763 15.1383 7.50659C15.0887 7.49153 15.0887 7.37751 15.1383 7.36255C15.3075 7.31151 15.5056 7.23018 15.6233 7.10783C15.741 6.98548 15.8191 6.77988 15.8683 6.60409Z\" fill=\"black\" />\n <path d=\"M15.9895 1.73104C16.0136 1.64529 16.1964 1.64534 16.2206 1.73104C16.3025 2.02415 16.4337 2.36693 16.63 2.57088C16.8263 2.77481 17.156 2.91063 17.4381 2.99569C17.5206 3.02071 17.5205 3.2105 17.4381 3.23576C17.156 3.32082 16.8262 3.45742 16.63 3.66138C16.4337 3.86534 16.3025 4.20813 16.2206 4.50122C16.1962 4.58669 16.0138 4.58674 15.9895 4.50122C15.9077 4.20825 15.7771 3.86537 15.581 3.66138C15.3847 3.45747 15.0549 3.32083 14.7729 3.23576C14.6902 3.21082 14.6902 3.02063 14.7729 2.99569C15.0549 2.91062 15.3848 2.77475 15.581 2.57088C15.7772 2.3669 15.9077 2.02406 15.9895 1.73104Z\" fill=\"black\" />\n <path d=\"M8.33325 2.91675H7.7211C7.58023 2.91675 7.4459 2.97617 7.35113 3.08041L3.33325 7.50008V17.0001C3.33325 17.2762 3.55711 17.5001 3.83325 17.5001H14.4999C14.7761 17.5001 14.9999 17.2762 14.9999 17.0001V10.0001M3.33325 7.50008H7.83325C8.10939 7.50008 8.33325 7.27622 8.33325 7.00008V2.91675M10.8333 2.91675H8.33325\" stroke=\"black\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n </svg>\n);\n\nexport type FileUploadVariant = 'line' | 'box';\nexport type UploadStatus = 'uploading' | 'uploaded' | 'error';\n\nexport type UploadItem = {\n id: string;\n file: File;\n name: string;\n size: number;\n progress: number;\n status: UploadStatus;\n error?: string;\n};\n\nexport interface FileUploadedProps {\n /** Nome do arquivo; nomes longos são abreviados preservando a extensão (o completo fica no `title`). */\n name: string;\n /** Tamanho já formatado (ex.: \"518.6 KB\"). */\n sizeLabel?: string;\n /** Mostra o botão de baixar, para arquivos que já estão na plataforma. */\n onDownload?: () => void;\n /** Mostra o botão de análise por IA (o mesmo ícone do FileUpload). */\n onAnaliseIa?: () => void;\n /** `botao`: o botão \"Análise IA\" com texto, no estilo do botão de baixar (fundo cinza e hover verde); vira o percentual durante a análise. Padrão: só o ícone. */\n analiseIaVariante?: 'icone' | 'botao';\n /** Percentual (0–100) de uma análise em curso: no botão, o texto vira \"NN%\". */\n analiseIaProgresso?: number;\n /** Indicador de progresso no lugar do ícone enquanto a análise roda (ex.: o anel de progresso). */\n analiseIaIndicador?: ReactNode;\n /** Mostra o botão de remover. */\n onRemove?: () => void;\n /** Linha extra embaixo do nome, alinhada a ele (ex.: a origem do arquivo e a solicitação). */\n detalhe?: ReactNode;\n /** Clicar na linha (ex.: abrir uma prévia). Dá à linha o hover e o pressed do arquivo enviado. */\n onClick?: () => void;\n /** Quantos caracteres do nome aparecem antes de abreviar; reduza em contêineres estreitos. */\n nomeMax?: number;\n className?: string;\n}\n\n/** A linha de um arquivo já enviado, a mesma que o FileUpload mostra na lista, para usar fora dele (ex.: os anexos de uma avaliação).\n * Ícone de arquivo, nome, tamanho e as ações; com `onClick` a linha ganha hover e pressed. Empilhe várias dentro de um contêiner\n * com borda e `divide-y` para formar a lista. */\nexport function FileUploaded({ name, sizeLabel, onDownload, onAnaliseIa, analiseIaVariante = 'icone', analiseIaProgresso, analiseIaIndicador, detalhe, onRemove, onClick, nomeMax, className }: Readonly<FileUploadedProps>) {\n return (\n <div\n className={cn('px-xl py-md', onClick && cn(UPLOADED_ITEM_CLASS, 'cursor-pointer'), className)}\n onClick={onClick}\n onKeyDown={(event) => {\n if (onClick && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n onClick();\n }\n }}\n role={onClick ? 'button' : undefined}\n tabIndex={onClick ? 0 : undefined}\n >\n <div className=\"flex min-h-7.5 w-full items-center justify-between gap-md\">\n <div className=\"flex min-w-0 items-center gap-md\">\n <File className=\"size-[24px] shrink-0 text-fg-muted\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-col gap-3xs\">\n <div className=\"flex min-w-0 items-center gap-5xs\">\n <span className=\"text-sm font-semibold text-fg-secondary\" title={name}>\n {abreviarNomeArquivo(name, nomeMax)}\n </span>\n {sizeLabel ? (\n <>\n <span className=\"text-xs font-bold text-fg-muted\">•</span>\n <span className=\"shrink-0 whitespace-nowrap text-xs text-fg-muted\">{sizeLabel}</span>\n </>\n ) : null}\n </div>\n {detalhe}\n </div>\n </div>\n {onDownload || onAnaliseIa || onRemove ? (\n <div className=\"flex items-center gap-sm\">\n {onDownload ? (\n <Tooltip\n content=\"Baixar arquivo\"\n trigger={\n <button\n type=\"button\"\n className=\"inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong\"\n onClick={(event) => {\n event.stopPropagation();\n onDownload();\n }}\n aria-label={`Baixar ${name}`}\n >\n <Download className=\"size-[20px]\" aria-hidden />\n </button>\n }\n />\n ) : null}\n {onAnaliseIa && analiseIaVariante === 'botao' ? (\n <button\n type=\"button\"\n className=\"inline-flex h-[36px] items-center justify-center gap-3xs whitespace-nowrap rounded-full bg-surface-muted px-md text-sm text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong\"\n aria-label={`Análise IA de ${name}`}\n onClick={(event) => {\n event.stopPropagation();\n onAnaliseIa();\n }}\n >\n {analiseIaProgresso !== undefined && analiseIaIndicador ? analiseIaIndicador : <Sparkles className=\"size-[16px]\" aria-hidden=\"true\" />}\n <span className=\"leading-sm\">{analiseIaProgresso !== undefined ? `${Math.round(analiseIaProgresso)}%` : 'Análise IA'}</span>\n </button>\n ) : null}\n {onAnaliseIa && analiseIaVariante === 'icone' ? (\n <Tooltip\n content=\"Análise IA\"\n trigger={\n <button\n type=\"button\"\n className=\"inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong\"\n onClick={(event) => {\n event.stopPropagation();\n onAnaliseIa();\n }}\n aria-label={`Análise IA de ${name}`}\n >\n <span className=\"inline-flex [&>svg]:size-[22px]\">{iaIcon}</span>\n </button>\n }\n />\n ) : null}\n {onRemove ? (\n <Tooltip\n content=\"Remover arquivo\"\n trigger={\n <button\n type=\"button\"\n className=\"inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-red-50 hover:text-red-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500\"\n onClick={(event) => {\n event.stopPropagation();\n onRemove();\n }}\n aria-label={`Remover ${name}`}\n >\n <Trash className=\"size-[20px]\" aria-hidden />\n </button>\n }\n />\n ) : null}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nexport interface FileUploadProps\n extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'type' | 'multiple' | 'onChange' | 'value' | 'defaultValue' | 'className'\n > {\n id: string;\n variant?: FileUploadVariant;\n className?: string;\n maxFiles?: number;\n /** Faz o seletor nativo abrir em modo \"escolher pasta\" — todos os arquivos dentro da pasta escolhida entram na lista. */\n directory?: boolean;\n /** Tamanho máximo por arquivo, em MB — arquivos maiores são rejeitados e refletidos no aviso e na legenda da dropzone. */\n maxSizeMb?: number;\n /** Chamada a cada seleção com os arquivos recusados (vazio, formato, tipo real diferente da extensão ou acima do tamanho) e o motivo de cada um. */\n onRejectedFiles?: (recusados: ArquivoRecusado[]) => void;\n /** Oculta o \"Você ainda precisa enviar N arquivos\" da legenda da dropzone (Figma 322:50994 não usa esse texto). */\n hideRemainingHint?: boolean;\n /** Texto próprio no lugar do \"Você ainda precisa enviar N arquivos\" (ex.: quais documentos faltam, quando há uma lista de obrigatórios). */\n remainingHintText?: string;\n initialItems?: UploadItem[];\n debugErrorMode?: boolean;\n debugErrorKeyword?: string;\n debugErrorMessage?: string;\n /** Exibe um dialog de confirmação antes de remover um arquivo (Figma 15:26216) — a remoção só ocorre após \"Confirmar\", e mostra um alerta de sucesso/erro (mock: falha se o nome do arquivo contiver `debugErrorKeyword`). */\n confirmRemove?: boolean;\n /** Envolve o nome/ícone do arquivo já enviado com um trigger próprio do consumidor (ex.: `PdfViewerDialog`) — por padrão o nome não é clicável. */\n renderFileTrigger?: (item: UploadItem, content: ReactNode) => ReactNode;\n /** Classe extra aplicada à linha de cada arquivo já enviado (ex.: hover/pressed por item). */\n uploadedItemClassName?: string;\n /** Mostra um checkbox em cada arquivo enviado, \"Selecionar todos\" e \"Remover selecionados\", como na revisão de registros da Nova solicitação. */\n selecionavel?: boolean;\n onFilesChange?: (files: File[]) => void;\n onItemsChange?: (items: UploadItem[]) => void;\n /** Envio real: chamada por arquivo aceito no lugar da simulação; informe o percentual e resolva ao terminar (rejeite com Error para o erro do item). */\n onUpload?: (item: UploadItem, informarProgresso: (percentual: number) => void) => Promise<void>;\n}\n\nconst createUploadId = () => `${Date.now()}-${Math.random().toString(16).slice(2, 10)}`;\n\nexport const FileUpload = ({\n id,\n className = '',\n variant = 'line',\n maxFiles = 3,\n directory = false,\n maxSizeMb,\n onRejectedFiles,\n hideRemainingHint = false,\n remainingHintText,\n initialItems = [],\n debugErrorMode = false,\n debugErrorKeyword = DEFAULT_DEBUG_ERROR_KEYWORD,\n debugErrorMessage = DEFAULT_DEBUG_ERROR_MESSAGE,\n confirmRemove = false,\n renderFileTrigger,\n uploadedItemClassName,\n selecionavel = false,\n onFilesChange,\n onItemsChange,\n onUpload,\n disabled,\n ...inputProps\n}: FileUploadProps) => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const dragCounterRef = useRef(0);\n const uploadTimersRef = useRef<Map<string, number>>(new Map());\n\n const [items, setItems] = useState<UploadItem[]>(() => [...initialItems]);\n const [isDragging, setIsDragging] = useState(false);\n const [itemPendenteRemocao, setItemPendenteRemocao] = useState<UploadItem | null>(null);\n const [avisoSelecao, setAvisoSelecao] = useState<string | null>(null);\n const [recusados, setRecusados] = useState<ArquivoRecusado[]>([]);\n const [selecionados, setSelecionados] = useState<Set<string>>(new Set());\n\n const enviadosCount = items.filter((item) => item.status === 'uploaded').length;\n const remainingSlots = Math.max(0, maxFiles - items.length);\n const isSelectionDisabled = Boolean(disabled || remainingSlots === 0);\n const inputAccept = DEFAULT_ACCEPT;\n const allowedExtensions = inputAccept\n .split(',')\n .map((extension) => extension.trim().toLowerCase())\n .filter(Boolean);\n const acceptedFormatsLabel = allowedExtensions\n .map((extension) => extension.toUpperCase())\n .join(', ')\n .replace(/, ([^,]*)$/, ' e $1');\n\n const formatSize = (sizeInBytes: number) => {\n const sizeInKb = sizeInBytes / BYTES_IN_KB;\n\n if (sizeInKb >= BYTES_IN_KB) {\n return `${(sizeInKb / BYTES_IN_KB).toFixed(1)} MB`;\n }\n\n return `${sizeInKb.toFixed(1)} KB`;\n };\n\n const isWithinSizeLimit = (file: File) => !maxSizeMb || file.size <= maxSizeMb * BYTES_IN_KB * BYTES_IN_KB;\n\n const clearUploadTimer = (itemId: string) => {\n const timerId = uploadTimersRef.current.get(itemId);\n\n if (timerId === undefined) {\n return;\n }\n\n window.clearInterval(timerId);\n uploadTimersRef.current.delete(itemId);\n };\n\n const clearAllUploadTimers = () => {\n uploadTimersRef.current.forEach((timerId) => {\n window.clearInterval(timerId);\n });\n uploadTimersRef.current.clear();\n };\n\n useEffect(() => {\n return () => {\n clearAllUploadTimers();\n };\n }, []);\n\n useEffect(() => {\n onItemsChange?.(items);\n }, [items, onItemsChange]);\n\n useEffect(() => {\n const inputEl = inputRef.current;\n if (!inputEl) return;\n if (directory) {\n inputEl.setAttribute('webkitdirectory', 'true');\n inputEl.setAttribute('directory', 'true');\n } else {\n inputEl.removeAttribute('webkitdirectory');\n inputEl.removeAttribute('directory');\n }\n }, [directory]);\n\n const shouldSetDebugError = (item: UploadItem, nextProgress: number) => {\n if (!debugErrorMode || nextProgress < DEBUG_ERROR_PROGRESS_THRESHOLD) {\n return false;\n }\n\n const normalizedKeyword = debugErrorKeyword.trim().toLowerCase();\n\n if (!normalizedKeyword) {\n return false;\n }\n\n return item.name.toLowerCase().includes(normalizedKeyword);\n };\n\n const startUploadSimulation = (itemId: string) => {\n const timerId = window.setInterval(() => {\n setItems((currentItems) => {\n const targetItem = currentItems.find((item) => item.id === itemId);\n\n if (!targetItem) {\n clearUploadTimer(itemId);\n return currentItems;\n }\n\n if (targetItem.status === 'uploaded' || targetItem.status === 'error') {\n clearUploadTimer(itemId);\n return currentItems;\n }\n\n const nextProgress = Math.min(100, targetItem.progress + Math.floor(Math.random() * 20) + 10);\n\n if (shouldSetDebugError(targetItem, nextProgress)) {\n clearUploadTimer(itemId);\n\n return currentItems.map((item) =>\n item.id === itemId\n ? {\n ...item,\n progress: 0,\n status: 'error',\n error: debugErrorMessage,\n }\n : item,\n );\n }\n\n const nextStatus: UploadStatus = nextProgress === 100 ? 'uploaded' : 'uploading';\n\n if (nextStatus === 'uploaded') {\n clearUploadTimer(itemId);\n }\n\n return currentItems.map((item) =>\n item.id === itemId\n ? {\n ...item,\n progress: nextProgress,\n status: nextStatus,\n error: undefined,\n }\n : item,\n );\n });\n }, UPLOAD_TICK_MS);\n\n uploadTimersRef.current.set(itemId, timerId);\n };\n\n const iniciarEnvio = (item: UploadItem) => {\n if (!onUpload) {\n startUploadSimulation(item.id);\n return;\n }\n const atualizar = (parcial: Partial<UploadItem>) =>\n setItems((atuais) => atuais.map((atual) => (atual.id === item.id ? { ...atual, ...parcial } : atual)));\n onUpload(item, (percentual) => atualizar({ progress: Math.max(0, Math.min(100, Math.round(percentual))) }))\n .then(() => atualizar({ progress: 100, status: 'uploaded', error: undefined }))\n .catch((erro: unknown) =>\n atualizar({ progress: 0, status: 'error', error: erro instanceof Error && erro.message ? erro.message : undefined }),\n );\n };\n\n const updateItems = (nextItems: UploadItem[]) => {\n setItems(nextItems);\n onFilesChange?.(nextItems.map((item) => item.file));\n };\n\n /** Motivo da recusa de um arquivo, ou null quando ele pode seguir. Ordem: vazio, formato, tipo real, tamanho. */\n const motivoDaRecusa = async (file: File): Promise<string | null> => {\n const nome = file.name.toLowerCase();\n const ponto = nome.lastIndexOf('.');\n const extensao = ponto > 0 ? nome.slice(ponto) : '';\n if (file.size === 0) return 'o arquivo está vazio.';\n if (extensao && !allowedExtensions.includes(extensao)) {\n return FORMATOS_COM_DICA[extensao] ?? `o formato ${extensao} não é aceito. Envie em ${FORMATOS_ACEITOS_TEXTO}.`;\n }\n const tipoReal = await detectarTipoReal(file);\n if (!tipoReal) {\n return extensao\n ? `o arquivo tem extensão ${extensao}, mas o conteúdo não é desse formato. Abra o arquivo, salve de novo como ${FORMATOS_ACEITOS_TEXTO} e envie.`\n : `não foi possível reconhecer o formato do arquivo. Envie em ${FORMATOS_ACEITOS_TEXTO}.`;\n }\n if (extensao && TIPO_POR_EXTENSAO[extensao] !== tipoReal) {\n return `o arquivo tem extensão ${extensao}, mas o conteúdo é ${tipoReal.toUpperCase()}. Salve de novo no formato certo e envie.`;\n }\n if (maxSizeMb && !isWithinSizeLimit(file)) {\n // Arredonda para cima: 1 byte acima do teto não pode aparecer como \"25,00 MB\" (PD-1259, CT-1259-04).\n const mb = (Math.ceil((file.size / (BYTES_IN_KB * BYTES_IN_KB)) * 100) / 100).toLocaleString('pt-BR', { minimumFractionDigits: 2, maximumFractionDigits: 2 });\n return `tem ${mb} MB, acima do limite de ${maxSizeMb} MB por arquivo. Reduza o arquivo ou divida o documento.`;\n }\n return null;\n };\n\n const handleFilesSelected = async (selectedFiles: File[]) => {\n if (isSelectionDisabled || selectedFiles.length === 0) {\n return;\n }\n\n // Só o arquivo inválido é recusado; os demais seguem (PD-1259, CT-1259-10).\n const motivos = await Promise.all(selectedFiles.map(motivoDaRecusa));\n const novosRecusados = selectedFiles.flatMap((file, i) => (motivos[i] ? [{ nome: file.name, motivo: motivos[i] as string }] : []));\n const validos = selectedFiles.filter((_, i) => !motivos[i]);\n setRecusados(novosRecusados);\n onRejectedFiles?.(novosRecusados);\n\n const acceptedFiles = validos.slice(0, remainingSlots);\n\n if (validos.length > acceptedFiles.length) {\n setAvisoSelecao(`${acceptedFiles.length} de ${validos.length} arquivos foram adicionados: o limite de ${maxFiles} arquivos foi atingido.`);\n } else {\n setAvisoSelecao(null);\n }\n\n if (acceptedFiles.length === 0) {\n return;\n }\n\n const newItems = acceptedFiles.map((file) => ({\n id: createUploadId(),\n file,\n name: file.name,\n size: file.size,\n progress: 0,\n status: 'uploading' as const,\n }));\n\n const nextItems = [...items, ...newItems];\n\n updateItems(nextItems);\n newItems.forEach((item) => iniciarEnvio(item));\n };\n\n /** Lista dos arquivos recusados na última seleção, com o motivo de cada um; anunciada a leitores de tela. */\n const renderRecusados = () =>\n recusados.length === 0 ? null : (\n <div role=\"alert\" className=\"flex w-full flex-col gap-4xs rounded-lg border border-orange-500 bg-orange-50 px-md py-sm text-left text-sm text-orange-600\">\n {recusados.length === 1 ? (\n <p>\n <span className=\"font-medium\">\"{abreviarNomeArquivo(recusados[0].nome)}\" não foi adicionado:</span> {recusados[0].motivo}\n </p>\n ) : (\n <>\n <p className=\"font-medium\">{recusados.length} arquivos não foram adicionados:</p>\n <ul className=\"flex list-disc flex-col gap-5xs pl-md\">\n {recusados.map((recusado) => (\n <li key={recusado.nome}>\n <span className=\"font-medium\">{abreviarNomeArquivo(recusado.nome)}:</span> {recusado.motivo}\n </li>\n ))}\n </ul>\n </>\n )}\n </div>\n );\n\n const handleSelectFiles = (event: ChangeEvent<HTMLInputElement>) => {\n const selectedFiles = Array.from(event.target.files ?? []);\n\n void handleFilesSelected(selectedFiles);\n event.target.value = '';\n };\n\n const resetDragState = () => {\n dragCounterRef.current = 0;\n setIsDragging(false);\n };\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (disabled) {\n return;\n }\n\n dragCounterRef.current += 1;\n setIsDragging(true);\n };\n\n const handleDragLeave = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (disabled) {\n return;\n }\n\n dragCounterRef.current = Math.max(0, dragCounterRef.current - 1);\n\n if (dragCounterRef.current === 0) {\n setIsDragging(false);\n }\n };\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n\n if (disabled) {\n return;\n }\n\n event.dataTransfer.dropEffect = 'copy';\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n const droppedFiles = Array.from(event.dataTransfer.files ?? []);\n\n if (disabled) {\n resetDragState();\n return;\n }\n\n void handleFilesSelected(droppedFiles);\n resetDragState();\n };\n\n const handleRemoveItem = (itemId: string) => {\n clearUploadTimer(itemId);\n updateItems(items.filter((item) => item.id !== itemId));\n };\n\n const itensSelecionaveis = items.filter((item) => item.status === 'uploaded');\n const selecionadosValidos = itensSelecionaveis.filter((item) => selecionados.has(item.id));\n const todosSelecionados = itensSelecionaveis.length > 0 && selecionadosValidos.length === itensSelecionaveis.length;\n\n const alternarSelecionado = (itemId: string) =>\n setSelecionados((atual) => {\n const proximo = new Set(atual);\n if (proximo.has(itemId)) proximo.delete(itemId);\n else proximo.add(itemId);\n return proximo;\n });\n\n const removerSelecionados = () => {\n const ids = new Set(selecionadosValidos.map((item) => item.id));\n ids.forEach((id) => clearUploadTimer(id));\n updateItems(items.filter((item) => !ids.has(item.id)));\n setSelecionados(new Set());\n alertBanner.show({\n type: 'success',\n title: ids.size === 1 ? 'Arquivo removido com sucesso' : `${ids.size} arquivos removidos com sucesso`,\n description: 'Você pode anexar novos arquivos utilizando o campo de upload.',\n });\n };\n\n const requestRemoveItem = (item: UploadItem) => {\n if (confirmRemove) {\n setItemPendenteRemocao(item);\n return;\n }\n\n handleRemoveItem(item.id);\n };\n\n const confirmarRemocao = () => {\n if (!itemPendenteRemocao) return;\n\n const falhou = itemPendenteRemocao.name.toLowerCase().includes(debugErrorKeyword.trim().toLowerCase());\n const itemAlvo = itemPendenteRemocao;\n\n setItemPendenteRemocao(null);\n\n if (falhou) {\n alertBanner.show({\n type: 'error',\n title: 'Não foi possível remover o arquivo',\n description: 'Ocorreu um erro ao tentar remover o arquivo. Tente novamente ou entre em contato com o suporte.',\n });\n return;\n }\n\n handleRemoveItem(itemAlvo.id);\n alertBanner.show({\n type: 'success',\n title: 'Arquivo removido com sucesso',\n description: 'O arquivo foi removido. Você pode anexar um novo utilizando o campo de upload.',\n });\n };\n\n const handleRetryItem = (itemId: string) => {\n clearUploadTimer(itemId);\n setItems((currentItems) =>\n currentItems.map((item) =>\n item.id === itemId\n ? {\n ...item,\n progress: 0,\n status: 'uploading',\n error: undefined,\n }\n : item,\n ),\n );\n const alvo = onUpload ? items.find((item) => item.id === itemId) : undefined;\n if (alvo) {\n iniciarEnvio(alvo);\n return;\n }\n startUploadSimulation(itemId);\n };\n\n const openFileDialog = () => {\n if (isSelectionDisabled) {\n return;\n }\n\n inputRef.current?.click();\n };\n\n const dragStateClass = isDragging && !disabled\n ? 'border-primary-500 bg-primary-500/5 ring-1 ring-primary-500/30'\n : 'border-line bg-surface';\n\n const helperText = remainingHintText ?? (remainingSlots === 0\n ? 'Limite de arquivos atingido.'\n : `Você ainda precisa enviar ${remainingSlots} arquivo${remainingSlots > 1 ? 's' : ''}.`);\n\n const renderHiddenFileInput = () => (\n <input\n id={id}\n ref={inputRef}\n className=\"sr-only\"\n type=\"file\"\n multiple={maxFiles > 1}\n onChange={handleSelectFiles}\n disabled={isSelectionDisabled}\n {...inputProps}\n accept={inputAccept}\n />\n );\n\n const renderLineDropzone = () => (\n <div\n className={`flex flex-col gap-sm rounded-xl border p-xl transition-colors ${dragStateClass} ${className}`}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <div className=\"flex flex-wrap items-center justify-between gap-sm\">\n <p className=\"text-sm text-fg\">Arraste documentos para iniciar o upload</p>\n <span className=\"text-sm text-fg/40\">OU</span>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={openFileDialog}\n disabled={isSelectionDisabled}\n label=\"Selecionar arquivo\"\n />\n </div>\n {renderRecusados()}\n {avisoSelecao ? <p className=\"text-sm text-orange-600\">{avisoSelecao}</p> : null}\n </div>\n );\n\n const renderBoxDropzone = () => (\n <div\n role=\"button\"\n tabIndex={isSelectionDisabled ? -1 : 0}\n aria-disabled={isSelectionDisabled || undefined}\n onClick={openFileDialog}\n onKeyDown={(event) => {\n if (event.target === event.currentTarget && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n openFileDialog();\n }\n }}\n className={`flex flex-col gap-sm rounded-xl border p-xl text-center transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-brand-focus ${\n isSelectionDisabled ? 'cursor-not-allowed' : `cursor-pointer ${isDragging ? '' : 'hover:bg-surface-hover active:bg-surface-pressed'}`\n } ${dragStateClass} ${className}`}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <Upload className=\"mx-auto size-[24px] text-fg-secondary\" />\n <p className=\"text-base leading-base text-fg\">\n {'Arraste aqui ou '}\n <span className={isSelectionDisabled ? 'text-fg-disabled' : 'text-blue-600 hover:underline'}>selecione</span>\n {directory ? ' uma pasta em seu dispositivo' : ' arquivos em seu dispositivo'}\n </p>\n <p className=\"text-sm text-fg-muted\">\n {directory ? 'Todos os arquivos dentro da pasta serão enviados.' : `Apenas arquivos ${acceptedFormatsLabel} são suportados.`}\n {maxSizeMb ? ` O tamanho máximo é de ${maxSizeMb} MB por arquivo.` : ''}\n {hideRemainingHint ? null : remainingHintText ? (\n <>\n <br />\n {helperText}\n </>\n ) : (\n ` ${helperText}`\n )}\n </p>\n {renderRecusados()}\n {avisoSelecao ? <p className=\"text-sm text-orange-600\">{avisoSelecao}</p> : null}\n </div>\n );\n\n const renderUploadItem = (item: UploadItem) => (\n <div className={cn('px-xl py-md', item.status === 'uploaded' && (uploadedItemClassName ?? UPLOADED_ITEM_CLASS))}>\n <div className=\"flex min-h-7.5 w-full items-center justify-between gap-md\">\n {item.status === 'uploading' ? (\n <>\n {iaIcon}\n <div className=\"flex w-full flex-col\">\n <div className=\"flex items-center gap-5xs\">\n <span className=\"text-sm leading-sm font-semibold text-fg-secondary\" title={item.name}>\n {abreviarNomeArquivo(item.name)}\n </span>\n <span className=\"text-xs font-bold text-fg-muted\">•</span>\n <span className=\"text-xs leading-xs font-normal text-fg-muted\">{formatSize(item.size)}</span>\n </div>\n <div className=\"flex flex-row items-center gap-sm\">\n <Progress value={item.progress} className=\"text-blue-800 **:data-[slot=progress-indicator]:bg-blue-800 **:data-[slot=progress-indicator]:rounded-full bg-surface-neutral\" />\n <span className=\"text-xs font-normal leading-xs text-fg-secondary\">{item.progress}%</span>\n </div>\n <span className=\"text-xs leading-xs text-fg-muted\">Status de processamento</span>\n </div>\n </>\n ) : item.status === 'error' ? (\n <>\n <div className=\"flex items-center gap-md\">\n <TriangleAlert className=\"size-[24px] text-red-600\" />\n <span className=\"text-sm leading-sm font-normal text-red-600\">\n {item.error ?? DEFAULT_DEBUG_ERROR_MESSAGE}\n </span>\n </div>\n <Button\n label=\"Tentar novamente\"\n size=\"sm\"\n variant=\"secondary\"\n onClick={() => handleRetryItem(item.id)}\n disabled={disabled}\n />\n </>\n ) : (\n <>\n <div className=\"flex min-w-0 flex-1 items-center gap-md\">\n {selecionavel ? (\n <Checkbox\n id={`${id}-sel-${item.id}`}\n aria-label={`Selecionar ${item.name}`}\n checked={selecionados.has(item.id)}\n onCheckedChange={() => alternarSelecionado(item.id)}\n disabled={disabled}\n />\n ) : null}\n {(() => {\n const fileInfo = (\n <div className=\"flex items-center gap-md\">\n <File className=\"size-[24px] text-fg-muted\" />\n <div className=\"flex items-center gap-5xs\">\n <span className=\"text-sm font-semibold text-fg-secondary\" title={item.name}>\n {abreviarNomeArquivo(item.name)}\n </span>\n <span className=\"text-xs font-bold text-fg-muted\">•</span>\n <span className=\"text-xs text-fg-muted\">{formatSize(item.size)}</span>\n </div>\n </div>\n );\n\n return renderFileTrigger ? renderFileTrigger(item, fileInfo) : fileInfo;\n })()}\n </div>\n\n <div className=\"flex items-center gap-sm\">\n <Tooltip\n content=\"Análise IA\"\n trigger={\n <button\n type=\"button\"\n className=\"ml-auto inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-primary-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 active:bg-primary-200 active:text-brand-fg-strong disabled:opacity-60\"\n onClick={() => handleRetryItem(item.id)}\n disabled={disabled}\n aria-label={`Reenviar ${item.name}`}\n >\n <span className=\"inline-flex [&>svg]:size-[22px]\">{iaIcon}</span>\n </button>\n }\n />\n <Tooltip\n content=\"Remover arquivo\"\n trigger={\n <button\n type=\"button\"\n className=\"ml-auto inline-flex h-[36px] w-[36px] items-center justify-center rounded-full bg-surface-muted text-fg transition hover:bg-red-50 hover:text-red-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-500 disabled:opacity-60\"\n onClick={() => requestRemoveItem(item)}\n disabled={disabled}\n aria-label={`Remover ${item.name}`}\n >\n <Trash className=\"size-[20px]\" aria-hidden />\n </button>\n }\n />\n </div>\n </>\n )}\n </div>\n </div>\n );\n\n return (\n <div className=\"flex flex-col gap-md\">\n {confirmRemove && (\n <ConfirmDialog\n open={itemPendenteRemocao !== null}\n onOpenChange={(open) => !open && setItemPendenteRemocao(null)}\n title=\"Remover arquivo\"\n body={\n <p className=\"text-base leading-[1.4] text-fg-muted\">\n O arquivo {itemPendenteRemocao?.name} será removido desta solicitação. Você poderá anexar um novo\n arquivo. Deseja continuar?\n </p>\n }\n secondaryAction={\n <Button variant=\"secondary\" size=\"md\" label=\"Cancelar\" onClick={() => setItemPendenteRemocao(null)} />\n }\n primaryAction={<Button variant=\"destructive\" size=\"md\" label=\"Confirmar\" onClick={confirmarRemocao} />}\n />\n )}\n\n {renderHiddenFileInput()}\n {variant === 'box' ? renderBoxDropzone() : renderLineDropzone()}\n\n {items.length > 0 && (\n <div className=\"flex flex-col gap-md rounded-xl bg-surface-muted p-md\">\n <div className=\"flex flex-wrap items-center justify-between gap-x-md gap-y-sm p-sm\">\n {selecionavel && itensSelecionaveis.length > 0 ? (\n <Checkbox\n id={`${id}-selecionar-todos`}\n label=\"Selecionar todos\"\n checked={todosSelecionados ? true : selecionadosValidos.length > 0 ? 'indeterminate' : false}\n onCheckedChange={(marcado) =>\n setSelecionados(marcado ? new Set(itensSelecionaveis.map((item) => item.id)) : new Set())\n }\n disabled={disabled}\n />\n ) : null}\n <div className=\"ml-auto flex min-w-0 flex-wrap items-center justify-end gap-md\">\n <p className=\"min-w-0 truncate text-right text-sm text-fg-muted\">\n {!items.some((item) => item.status === 'uploading') && enviadosCount > 0 ? (\n <>\n Você subiu{' '}\n <span className=\"font-medium text-fg\">\n {enviadosCount} {enviadosCount === 1 ? 'arquivo' : 'arquivos'}\n </span>\n </>\n ) : (\n 'Enviando arquivos…'\n )}\n </p>\n {selecionavel && selecionadosValidos.length > 0 ? (\n <Button\n label={`Remover selecionados (${selecionadosValidos.length})`}\n leftIcon=\"Trash\"\n variant=\"destructive\"\n size=\"sm\"\n onClick={removerSelecionados}\n disabled={disabled}\n />\n ) : null}\n </div>\n </div>\n <ul className=\"flex flex-col overflow-hidden rounded-2xl border border-line bg-surface\">\n {items.map((item, index) => (\n <li key={item.id}>\n {index > 0 && <div className=\"mx-xl border-t border-line-subtle\" />}\n {renderUploadItem(item)}\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n};\n"],"names":["BYTES_IN_KB","UPLOAD_TICK_MS","ALLOWED_DOCUMENT_EXTENSIONS","FORMATOS_COM_DICA","FORMATOS_ACEITOS_TEXTO","TIPO_POR_EXTENSAO","detectarTipoReal","file","b","comeca","bytes","byte","i","DEFAULT_ACCEPT","DEBUG_ERROR_PROGRESS_THRESHOLD","DEFAULT_DEBUG_ERROR_KEYWORD","DEFAULT_DEBUG_ERROR_MESSAGE","UPLOADED_ITEM_CLASS","MAX_NOME_ARQUIVO_EXIBIDO","abreviarNomeArquivo","nome","max","ponto","extensao","base","reticencias","disponivel","iaIcon","jsxs","jsx","FileUploaded","name","sizeLabel","onDownload","onAnaliseIa","analiseIaVariante","analiseIaProgresso","analiseIaIndicador","detalhe","onRemove","onClick","nomeMax","className","cn","event","File","Fragment","Tooltip","Download","Sparkles","Trash","createUploadId","FileUpload","id","variant","maxFiles","directory","maxSizeMb","onRejectedFiles","hideRemainingHint","remainingHintText","initialItems","debugErrorMode","debugErrorKeyword","debugErrorMessage","confirmRemove","renderFileTrigger","uploadedItemClassName","selecionavel","onFilesChange","onItemsChange","onUpload","disabled","inputProps","inputRef","useRef","dragCounterRef","uploadTimersRef","items","setItems","useState","isDragging","setIsDragging","itemPendenteRemocao","setItemPendenteRemocao","avisoSelecao","setAvisoSelecao","recusados","setRecusados","selecionados","setSelecionados","enviadosCount","item","remainingSlots","isSelectionDisabled","inputAccept","allowedExtensions","extension","acceptedFormatsLabel","formatSize","sizeInBytes","sizeInKb","isWithinSizeLimit","clearUploadTimer","itemId","timerId","clearAllUploadTimers","useEffect","inputEl","shouldSetDebugError","nextProgress","normalizedKeyword","startUploadSimulation","currentItems","targetItem","nextStatus","iniciarEnvio","atualizar","parcial","atuais","atual","percentual","erro","updateItems","nextItems","motivoDaRecusa","tipoReal","handleFilesSelected","selectedFiles","motivos","novosRecusados","validos","_","acceptedFiles","newItems","renderRecusados","recusado","handleSelectFiles","resetDragState","handleDragEnter","handleDragLeave","handleDragOver","handleDrop","droppedFiles","handleRemoveItem","itensSelecionaveis","selecionadosValidos","todosSelecionados","alternarSelecionado","proximo","removerSelecionados","ids","alertBanner","requestRemoveItem","confirmarRemocao","falhou","itemAlvo","handleRetryItem","alvo","openFileDialog","dragStateClass","helperText","renderHiddenFileInput","renderLineDropzone","Button","renderBoxDropzone","Upload","renderUploadItem","Progress","TriangleAlert","Checkbox","fileInfo","ConfirmDialog","open","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,MAAK;AAAA,cACL,SAASI;AAAA,cACT,UAAA9E;AAAA,YAAA;AAAA,UAAA,IAEA;AAAA,QAAA,EAAA,CACN;AAAA,MAAA,GACF;AAAA,MACA,gBAAA3C,EAAC,MAAA,EAAG,WAAU,2EACX,UAAAiD,EAAM,IAAI,CAACc,GAAMmF,MAChB,gBAAAnJ,EAAC,MAAA,EACE,UAAA;AAAA,QAAAmJ,IAAQ,KAAK,gBAAAlJ,EAAC,OAAA,EAAI,WAAU,qCAAoC;AAAA,QAChE0I,GAAiB3E,CAAI;AAAA,MAAA,KAFfA,EAAK,EAGd,CACD,EAAA,CACH;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GAEJ;AAEJ;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@garantiabr/ui-kit",
3
- "version": "0.5.13",
3
+ "version": "0.5.15",
4
4
  "description": "Design system SpotDS da GarantiaBR (registry do Storybook) empacotado para os apps: componentes React + tema Tailwind v4",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",