@aspprev/versi-ds 0.5.0 → 0.5.4

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.
@@ -213,7 +213,7 @@ function FileDropzone({
213
213
  }
214
214
  )
215
215
  ] }),
216
- message && /* @__PURE__ */ jsx2("span", { id: messageId, role: hasError ? "alert" : void 0, className: classNames("mt-1 text-sm", hasError ? "text-field-assistive-error" : "text-content-secondary"), children: message }),
216
+ message && /* @__PURE__ */ jsx2("span", { id: messageId, role: hasError ? "alert" : void 0, className: classNames("mt-1 text-sm", hasError ? "font-semibold text-field-assistive-error" : "text-content-secondary"), children: message }),
217
217
  actions && /* @__PURE__ */ jsx2("div", { className: "mt-3 flex flex-wrap justify-center gap-2", children: actions })
218
218
  ]
219
219
  }
@@ -293,7 +293,7 @@ function FileList({ files, accessibleName = "Arquivos selecionados", onRemove, o
293
293
  statusDescription(status)
294
294
  ] }),
295
295
  (status === "uploading" || status === "success" || status === "error") && /* @__PURE__ */ jsx4(FileUploadProgress_default, { value: item.progress, status: progressStatus, label: `Progresso de ${item.file.name}` }),
296
- item.error && /* @__PURE__ */ jsx4("p", { role: "alert", className: "mt-1 text-sm text-field-assistive-error", children: item.error })
296
+ item.error && /* @__PURE__ */ jsx4("p", { role: "alert", className: "mt-1 text-sm font-semibold text-field-assistive-error", children: item.error })
297
297
  ] }),
298
298
  /* @__PURE__ */ jsxs4("div", { className: "flex shrink-0 items-center gap-1", children: [
299
299
  actions?.(item, index),
@@ -595,4 +595,4 @@ export {
595
595
  FileViewer_default,
596
596
  QRCode_default
597
597
  };
598
- //# sourceMappingURL=chunk-CVTBM4I6.js.map
598
+ //# sourceMappingURL=chunk-PMU4AIIJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/barcode/barcode.tsx","../src/components/file-upload/validation.ts","../src/components/file-upload/FileDropzone.tsx","../src/components/file-upload/FileUploadProgress.tsx","../src/components/file-upload/FileList.tsx","../src/components/file-upload/FileViewer.tsx","../src/components/qr-code/QRCode.tsx"],"sourcesContent":["\"use client\";\n\nimport JsBarcode from \"jsbarcode\";\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\n\nconst linhaDigitavelParaCodigoBarras = (linha: string): string => {\n const d = linha.replace(/\\D/g, \"\");\n\n const banco = d.substring(0, 3);\n const moeda = d.substring(3, 4);\n const campo1 = d.substring(4, 9);\n const campo2 = d.substring(10, 20);\n const campo3 = d.substring(21, 31);\n const digitoGeral = d.substring(32, 33);\n const vencimento = d.substring(33, 37);\n const valor = d.substring(37, 47);\n\n return banco + moeda + digitoGeral + vencimento + valor + campo1 + campo2 + campo3;\n};\n\nexport interface BoletoBarCodeProps {\n linhaDigitavel: string;\n /** Bar width passed to JsBarcode. */\n width?: number;\n /** Bar height in pixels. */\n height?: number;\n /** Quiet zone/margin in pixels. */\n quietZone?: number;\n error?: ReactNode;\n onError?: (error: Error) => void;\n}\n\nexport function BoletoBarCode({\n linhaDigitavel,\n width = 2,\n height = 80,\n quietZone = 0,\n error,\n onError,\n}: BoletoBarCodeProps) {\n const svgRef = useRef<SVGSVGElement>(null);\n const [generationError, setGenerationError] = useState<Error | null>(null);\n\n useEffect(() => {\n if (!svgRef.current) return;\n setGenerationError(null);\n\n try {\n const codigoBarras = linhaDigitavelParaCodigoBarras(linhaDigitavel);\n\n JsBarcode(svgRef.current, codigoBarras, {\n format: \"ITF\",\n lineColor: \"#000000\",\n background: \"#FFFFFF\",\n displayValue: false,\n width,\n height,\n margin: quietZone,\n });\n } catch (cause: unknown) {\n const nextError = cause instanceof Error\n ? cause\n : new Error(\"Não foi possível gerar o código de barras.\");\n setGenerationError(nextError);\n onError?.(nextError);\n }\n }, [height, linhaDigitavel, onError, quietZone, width]);\n\n const displayError = error ?? generationError?.message;\n\n return (\n <div className=\"w-full space-y-3 bg-surface-card\">\n {displayError ? (\n <p role=\"alert\" className=\"text-sm text-field-assistive-error\">\n {displayError}\n </p>\n ) : (\n <svg ref={svgRef} className=\"w-full\" />\n )}\n <p className=\"text-center font-mono text-sm tracking-widest text-content-primary\">\n {linhaDigitavel}\n </p>\n </div>\n );\n}\n","export type FileValidationReason =\n | \"type\"\n | \"size\"\n | \"count\"\n | \"empty\"\n | \"invalid\";\n\nexport interface FileRejectionContext {\n code: FileValidationReason;\n fileName: string;\n extension: string;\n size: number;\n maxSize?: number;\n}\n\nexport type FileValidationMessage =\n | string\n | ((context: FileRejectionContext) => string);\n\nexport interface FileRejection {\n file: File;\n code: FileValidationReason;\n reason: FileValidationReason;\n fileName: string;\n extension: string;\n size: number;\n maxSize?: number;\n message: string;\n}\n\nexport interface FileValidationOptions {\n accept?: string;\n multiple?: boolean;\n maxFiles?: number;\n maxSize?: number;\n messages?: Partial<Record<FileValidationReason, FileValidationMessage>>;\n}\n\nexport interface FileValidationResult {\n accepted: File[];\n rejected: FileRejection[];\n}\n\nfunction acceptsFile(file: File, accept?: string) {\n if (!accept?.trim()) return true;\n\n return accept\n .split(\",\")\n .map((item) => item.trim().toLowerCase())\n .some((rule) => {\n if (rule.endsWith(\"/*\")) {\n return file.type.toLowerCase().startsWith(rule.slice(0, -1));\n }\n if (rule.startsWith(\".\")) {\n return file.name.toLowerCase().endsWith(rule);\n }\n return file.type.toLowerCase() === rule;\n });\n}\n\nfunction getExtension(fileName: string) {\n const extension = fileName.split(\".\").pop()?.trim().toLowerCase();\n return extension && extension !== fileName.toLowerCase() ? extension : \"\";\n}\n\nfunction rejectionMessage(\n reason: FileValidationReason,\n context: FileRejectionContext,\n messages?: FileValidationOptions[\"messages\"],\n) {\n const customMessage = messages?.[reason];\n if (typeof customMessage === \"function\") return customMessage(context);\n if (typeof customMessage === \"string\") return customMessage;\n if (reason === \"type\") return \"Tipo de arquivo não permitido.\";\n if (reason === \"size\") return \"O arquivo excede o tamanho máximo permitido.\";\n if (reason === \"empty\") return \"O arquivo está vazio.\";\n if (reason === \"invalid\") return \"O arquivo não é válido.\";\n return \"Quantidade máxima de arquivos excedida.\";\n}\n\nfunction normalizeMaxFiles(options: FileValidationOptions) {\n if (options.multiple === false) return 1;\n if (options.maxFiles === undefined || !Number.isFinite(options.maxFiles)) {\n return Number.POSITIVE_INFINITY;\n }\n return Math.max(1, Math.floor(options.maxFiles));\n}\n\nfunction normalizeMaxSize(maxSize?: number) {\n if (maxSize === undefined || !Number.isFinite(maxSize)) return undefined;\n return Math.max(0, maxSize);\n}\n\nexport function validateFiles(\n files: readonly File[] | FileList,\n options: FileValidationOptions = {},\n): FileValidationResult {\n const selected = Array.from(files);\n const maxFiles = normalizeMaxFiles(options);\n const maxSize = normalizeMaxSize(options.maxSize);\n const accepted: File[] = [];\n const rejected: FileRejection[] = [];\n\n selected.forEach((file, index) => {\n const isInvalid =\n !file ||\n typeof file.name !== \"string\" ||\n !file.name.trim() ||\n typeof file.size !== \"number\" ||\n !Number.isFinite(file.size) ||\n file.size < 0;\n const reason: FileValidationReason | undefined = isInvalid\n ? \"invalid\"\n : file.size === 0\n ? \"empty\"\n : !acceptsFile(file, options.accept)\n ? \"type\"\n : maxSize !== undefined && file.size > maxSize\n ? \"size\"\n : index >= maxFiles\n ? \"count\"\n : undefined;\n\n if (reason) {\n const fileName = typeof file?.name === \"string\" ? file.name : \"\";\n const size = typeof file?.size === \"number\" && Number.isFinite(file.size)\n ? file.size\n : 0;\n const context: FileRejectionContext = {\n code: reason,\n fileName,\n extension: getExtension(fileName),\n size,\n maxSize,\n };\n rejected.push({\n file,\n ...context,\n reason,\n message: rejectionMessage(reason, context, options.messages),\n });\n } else {\n accepted.push(file);\n }\n });\n\n return { accepted, rejected };\n}\n","\"use client\";\n\nimport classNames from \"classnames\";\nimport { useId, useRef, useState, type ChangeEvent, type DragEvent, type ReactNode } from \"react\";\nimport { validateFiles, type FileRejection, type FileValidationMessage } from \"./validation\";\n\nexport type { FileRejection } from \"./validation\";\n\nexport interface FileDropzoneProps {\n accept?: string;\n multiple?: boolean;\n maxFiles?: number;\n maxSize?: number;\n disabled?: boolean;\n id?: string;\n name?: string;\n required?: boolean;\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n messages?: Partial<Record<\"type\" | \"size\" | \"count\" | \"empty\" | \"invalid\", FileValidationMessage>>;\n actions?: ReactNode;\n className?: string;\n onFilesAccepted?: (files: File[]) => void;\n onFilesRejected?: (rejections: FileRejection[]) => void;\n}\n\nexport function FileDropzone({\n accept,\n multiple = false,\n maxFiles = multiple ? Number.POSITIVE_INFINITY : 1,\n maxSize,\n disabled = false,\n id,\n name,\n required = false,\n label = \"Selecionar arquivos\",\n hint = \"Arraste e solte os arquivos aqui ou use o teclado para selecionar.\",\n error,\n messages,\n actions,\n className,\n onFilesAccepted,\n onFilesRejected,\n}: FileDropzoneProps) {\n const generatedInputId = useId();\n const inputId = id ?? generatedInputId;\n const messageId = `${inputId}-message`;\n const inputRef = useRef<HTMLInputElement>(null);\n const [isDragging, setIsDragging] = useState(false);\n const [rejectionMessage, setRejectionMessage] = useState<string>();\n\n const processFiles = (fileList: FileList | File[]) => {\n if (disabled) return;\n const { accepted, rejected } = validateFiles(fileList, {\n accept,\n maxFiles,\n maxSize,\n multiple,\n messages,\n });\n setRejectionMessage(rejected.length ? rejected.map((item) => item.message).join(\" \") : undefined);\n if (accepted.length) onFilesAccepted?.(accepted);\n if (rejected.length) onFilesRejected?.(rejected);\n };\n\n const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (event.target.files) processFiles(event.target.files);\n event.target.value = \"\";\n };\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n setIsDragging(false);\n processFiles(event.dataTransfer.files);\n };\n const hasError = Boolean(error || rejectionMessage);\n const message = error || rejectionMessage || hint;\n\n return (\n <div\n onDragEnter={(event) => { event.preventDefault(); if (!disabled) setIsDragging(true); }}\n onDragOver={(event) => event.preventDefault()}\n onDragLeave={(event) => { if (event.currentTarget === event.target) setIsDragging(false); }}\n onDrop={handleDrop}\n className={classNames(\n \"flex min-h-32 w-full cursor-pointer flex-col items-center justify-center rounded-sm border-2 border-dashed p-6 text-center transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring\",\n isDragging ? \"border-action-primary bg-primary-1/10\" : \"border-border-default bg-surface-card hover:border-border-strong\",\n disabled && \"cursor-not-allowed opacity-60\",\n hasError && \"border-field-border-error\",\n className,\n )}\n >\n <label htmlFor={inputId} className=\"flex cursor-pointer flex-col items-center focus-within:outline focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-focus-ring\">\n <span className=\"font-semibold text-content-primary\">{label}</span>\n <input\n ref={inputRef}\n id={inputId}\n type=\"file\"\n name={name}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n required={required}\n onChange={handleInputChange}\n aria-describedby={message ? messageId : undefined}\n aria-invalid={hasError ? true : undefined}\n className=\"sr-only\"\n />\n </label>\n {message && <span id={messageId} role={hasError ? \"alert\" : undefined} className={classNames(\"mt-1 text-sm\", hasError ? \"font-semibold text-field-assistive-error\" : \"text-content-secondary\")}>{message}</span>}\n {actions && <div className=\"mt-3 flex flex-wrap justify-center gap-2\">{actions}</div>}\n </div>\n );\n}\n\nexport default FileDropzone;\n","\"use client\";\n\nimport classNames from \"classnames\";\n\nexport type FileUploadProgressStatus = \"idle\" | \"uploading\" | \"success\" | \"error\";\n\nexport interface FileUploadProgressProps {\n value?: number | null;\n label?: string;\n status?: FileUploadProgressStatus;\n showValue?: boolean;\n className?: string;\n}\n\nexport function FileUploadProgress({\n value,\n label = \"Progresso do upload\",\n status = \"uploading\",\n showValue = true,\n className,\n}: FileUploadProgressProps) {\n const resolvedValue = typeof value === \"number\"\n ? Math.min(100, Math.max(0, value))\n : undefined;\n const statusText = status === \"success\"\n ? \"Concluído\"\n : status === \"error\"\n ? \"Erro\"\n : resolvedValue === undefined\n ? \"Em andamento\"\n : `${Math.round(resolvedValue)}%`;\n\n return (\n <div className={classNames(\"w-full\", className)}>\n <div className=\"mb-1 flex items-center justify-between gap-2 text-xs text-content-secondary\">\n <span>{label}</span>\n {showValue && <span aria-hidden=\"true\">{statusText}</span>}\n </div>\n <div\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={resolvedValue === undefined ? undefined : 0}\n aria-valuemax={resolvedValue === undefined ? undefined : 100}\n aria-valuenow={resolvedValue}\n aria-valuetext={statusText}\n className=\"h-2 w-full overflow-hidden rounded-full bg-surface-muted\"\n >\n <div\n className={classNames(\n \"h-full rounded-full transition-[width] duration-200\",\n status === \"error\" ? \"bg-feedback-danger-strong\" : \"bg-action-primary\",\n resolvedValue === undefined ? \"w-1/2 animate-pulse\" : undefined,\n )}\n style={resolvedValue === undefined ? undefined : { width: `${resolvedValue}%` }}\n />\n </div>\n <span className=\"sr-only\" role=\"status\" aria-live=\"polite\">{statusText}</span>\n </div>\n );\n}\n\nexport default FileUploadProgress;\n","\"use client\";\n\nimport classNames from \"classnames\";\nimport { MdClose, MdRefresh } from \"react-icons/md\";\nimport type { ReactNode } from \"react\";\nimport FileUploadProgress, { type FileUploadProgressStatus } from \"./FileUploadProgress\";\n\nexport type FileUploadItemStatus = FileUploadProgressStatus | \"pending\";\n\nexport interface FileUploadItem {\n id?: string;\n file: File;\n progress?: number | null;\n status?: FileUploadItemStatus;\n error?: string;\n}\n\nexport interface FileListProps {\n files: FileUploadItem[];\n accessibleName?: string;\n onRemove?: (item: FileUploadItem, index: number) => void;\n onRetry?: (item: FileUploadItem, index: number) => void;\n actions?: (item: FileUploadItem, index: number) => ReactNode;\n className?: string;\n}\n\nconst fileId = (item: FileUploadItem, index: number) => item.id ?? `${item.file.name}-${item.file.size}-${item.file.lastModified}-${index}`;\n\nconst statusDescription = (status: FileUploadItemStatus) => {\n if (status === \"uploading\") return \"Enviando\";\n if (status === \"success\") return \"Enviado\";\n if (status === \"error\") return \"Erro no envio\";\n return \"Aguardando envio\";\n};\n\nexport function FileList({ files, accessibleName = \"Arquivos selecionados\", onRemove, onRetry, actions, className }: FileListProps) {\n return (\n <ul aria-label={accessibleName} className={classNames(\"w-full space-y-2\", className)}>\n {files.map((item, index) => {\n const status = item.status ?? \"pending\";\n const progressStatus: FileUploadProgressStatus = status === \"pending\" ? \"idle\" : status;\n return (\n <li key={fileId(item, index)} aria-busy={status === \"uploading\" || undefined} className=\"flex min-w-0 flex-wrap items-center gap-3 rounded-sm border border-border-default bg-surface-card p-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate font-semibold text-content-primary\" title={item.file.name}>{item.file.name}</p>\n <p className=\"text-xs text-content-secondary\">{Math.ceil(item.file.size / 1024)} KB</p>\n <span className=\"sr-only\">Status: {statusDescription(status)}</span>\n {(status === \"uploading\" || status === \"success\" || status === \"error\") && (\n <FileUploadProgress value={item.progress} status={progressStatus} label={`Progresso de ${item.file.name}`} />\n )}\n {item.error && <p role=\"alert\" className=\"mt-1 text-sm font-semibold text-field-assistive-error\">{item.error}</p>}\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n {actions?.(item, index)}\n {status === \"error\" && onRetry && <button type=\"button\" onClick={() => onRetry(item, index)} aria-label={`Tentar novamente ${item.file.name}`} className=\"flex h-11 w-11 items-center justify-center rounded-sm text-content-secondary hover:bg-surface-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring\"><MdRefresh aria-hidden=\"true\" className=\"h-5 w-5\" /></button>}\n {onRemove && <button type=\"button\" onClick={() => onRemove(item, index)} aria-label={`Remover ${item.file.name}`} className=\"flex h-11 w-11 items-center justify-center rounded-sm text-content-secondary hover:bg-surface-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring\"><MdClose aria-hidden=\"true\" className=\"h-5 w-5\" /></button>}\n </div>\n </li>\n );\n })}\n </ul>\n );\n}\n\nexport default FileList;\n","\"use client\";\n\nimport classNames from \"classnames\";\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\n\nexport type FileViewerSource = string | Blob | {\n url?: string;\n blob?: Blob;\n contentType?: string;\n fileName?: string;\n};\n\nexport type FileViewerSourceInput =\n | FileViewerSource\n | Promise<FileViewerSource | null | undefined>;\n\nexport interface FileViewerProps {\n source?: FileViewerSourceInput;\n fileName?: string;\n contentType?: string;\n loading?: boolean;\n error?: ReactNode;\n onLoad?: () => void;\n onError?: (error: Error) => void;\n onDownload?: () => void;\n /** Consumer-owned actions such as retry, share or remove. */\n actions?: ReactNode;\n fallback?: ReactNode;\n title?: string;\n className?: string;\n}\n\nconst extensionType = (fileName?: string) => {\n const extension = fileName?.split(\".\").pop()?.toLowerCase();\n if (extension === \"pdf\") return \"application/pdf\";\n if ([\"png\", \"jpg\", \"jpeg\", \"gif\", \"webp\", \"svg\"].includes(extension ?? \"\")) {\n return `image/${extension === \"jpg\" ? \"jpeg\" : extension}`;\n }\n if ([\"txt\", \"csv\", \"json\", \"xml\", \"md\"].includes(extension ?? \"\")) return \"text/plain\";\n return \"application/octet-stream\";\n};\n\nconst normalizeContentType = (contentType: string) => contentType.split(\";\", 1)[0].trim().toLowerCase();\n\nconst toError = (cause: unknown) => (\n cause instanceof Error ? cause : new Error(\"Não foi possível ler o arquivo.\")\n);\n\nexport function FileViewer({\n source,\n fileName,\n contentType,\n loading = false,\n error,\n onLoad,\n onError,\n onDownload,\n actions,\n fallback,\n title = fileName ?? \"Visualização do arquivo\",\n className,\n}: FileViewerProps) {\n const [objectUrl, setObjectUrl] = useState<string>();\n const [textContent, setTextContent] = useState<string>();\n const [readError, setReadError] = useState<Error | null>(null);\n const [asyncSource, setAsyncSource] = useState<FileViewerSource>();\n const [sourceLoading, setSourceLoading] = useState(false);\n const onLoadRef = useRef(onLoad);\n const onErrorRef = useRef(onError);\n const isAsyncSource = Boolean(\n source &&\n typeof source === \"object\" &&\n \"then\" in source &&\n typeof source.then === \"function\",\n );\n\n useEffect(() => {\n if (!isAsyncSource) {\n setAsyncSource(undefined);\n setSourceLoading(false);\n return;\n }\n\n let active = true;\n setSourceLoading(true);\n setReadError(null);\n\n Promise.resolve(source as Promise<FileViewerSource | null | undefined>)\n .then((nextSource) => {\n if (!active) return;\n setAsyncSource(nextSource ?? undefined);\n setSourceLoading(false);\n })\n .catch((cause: unknown) => {\n if (!active) return;\n const nextError = toError(cause);\n setReadError(nextError);\n setSourceLoading(false);\n onErrorRef.current?.(nextError);\n });\n\n return () => {\n active = false;\n };\n }, [isAsyncSource, source]);\n\n const resolvedSource: FileViewerSource | undefined = isAsyncSource\n ? asyncSource\n : (source as FileViewerSource | undefined);\n const resolved = typeof resolvedSource === \"object\" && resolvedSource !== null && !(resolvedSource instanceof Blob) ? resolvedSource : undefined;\n const blob = resolvedSource instanceof Blob ? resolvedSource : resolved?.blob;\n const url = typeof resolvedSource === \"string\" ? resolvedSource : resolved?.url;\n const resolvedName = fileName ?? resolved?.fileName;\n const rawType = contentType?.trim() || resolved?.contentType || blob?.type || extensionType(resolvedName);\n const resolvedType = normalizeContentType(rawType);\n const isText = resolvedType.startsWith(\"text/\") || resolvedType === \"application/json\";\n const displayError = error ?? readError?.message;\n\n useEffect(() => {\n onLoadRef.current = onLoad;\n }, [onLoad]);\n\n useEffect(() => {\n onErrorRef.current = onError;\n }, [onError]);\n\n useEffect(() => {\n let active = true;\n setReadError(null);\n setTextContent(undefined);\n\n if (!blob) {\n setObjectUrl(undefined);\n return () => { active = false; };\n }\n\n let nextUrl: string;\n try {\n nextUrl = URL.createObjectURL(blob);\n setObjectUrl(nextUrl);\n } catch (cause) {\n const nextError = toError(cause);\n setReadError(nextError);\n onErrorRef.current?.(nextError);\n return () => { active = false; };\n }\n\n if (isText) {\n blob.text()\n .then((text: string) => {\n if (!active) return;\n setTextContent(text);\n onLoadRef.current?.();\n })\n .catch((cause: unknown) => {\n if (!active) return;\n const nextError = toError(cause);\n setReadError(nextError);\n onErrorRef.current?.(nextError);\n });\n }\n\n return () => {\n active = false;\n URL.revokeObjectURL(nextUrl);\n };\n }, [blob, isText]);\n\n const handleMediaError = () => {\n const nextError = new Error(\"Não foi possível carregar a visualização do arquivo.\");\n setReadError(nextError);\n onErrorRef.current?.(nextError);\n };\n const handleLoad = () => onLoadRef.current?.();\n\n if (loading || sourceLoading) {\n return (\n <div\n className={classNames(\"flex min-h-32 items-center justify-center rounded-sm border border-border-default bg-surface-card p-6 text-content-secondary\", className)}\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n >\n Carregando arquivo…\n </div>\n );\n }\n\n if (displayError) {\n return (\n <div className={classNames(\"rounded-sm border border-field-border-error bg-surface-card p-4 text-field-assistive-error\", className)} role=\"alert\">\n {displayError}\n </div>\n );\n }\n\n const displayUrl = objectUrl ?? url;\n if (!displayUrl && !textContent) {\n return (\n <div\n className={classNames(\"rounded-sm border border-border-default bg-surface-card p-4 text-content-secondary\", className)}\n role=\"region\"\n aria-label={title}\n >\n {fallback ?? \"Arquivo indisponível.\"}\n </div>\n );\n }\n\n const download = onDownload\n ? <button type=\"button\" onClick={onDownload} className=\"min-h-11 rounded-sm border border-border-default px-3 text-sm font-semibold text-content-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring\">Baixar arquivo</button>\n : displayUrl\n ? <a href={displayUrl} download={resolvedName} className=\"inline-flex min-h-11 items-center rounded-sm border border-border-default px-3 text-sm font-semibold text-content-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring\">Baixar arquivo</a>\n : null;\n\n return (\n <div\n className={classNames(\"flex min-w-0 flex-col gap-3 rounded-sm border border-border-default bg-surface-card p-3\", className)}\n role=\"region\"\n aria-label={title}\n >\n {resolvedType.startsWith(\"image/\") && displayUrl && (\n <img src={displayUrl} alt={title} onLoad={handleLoad} onError={handleMediaError} className=\"max-h-[70vh] max-w-full object-contain\" />\n )}\n {resolvedType === \"application/pdf\" && displayUrl && (\n <iframe src={displayUrl} title={title} onLoad={handleLoad} onError={handleMediaError} sandbox=\"\" className=\"min-h-[32rem] w-full border-0\" />\n )}\n {isText && (textContent !== undefined\n ? <pre className=\"max-h-[70vh] overflow-auto whitespace-pre-wrap break-words text-sm text-content-primary\">{textContent}</pre>\n : displayUrl && <iframe src={displayUrl} title={title} onLoad={handleLoad} onError={handleMediaError} sandbox=\"\" className=\"min-h-64 w-full border-0\" />)}\n {!resolvedType.startsWith(\"image/\") && resolvedType !== \"application/pdf\" && !isText && (\n fallback ?? <p className=\"text-content-secondary\">Este tipo de arquivo não possui visualização disponível.</p>\n )}\n {(download || actions) && (\n <div className=\"flex flex-wrap justify-end gap-2\">\n {actions}\n {download}\n </div>\n )}\n </div>\n );\n}\n\nexport default FileViewer;\n","\"use client\";\n\nimport QRCodeGenerator from \"qrcode\";\nimport { useEffect, useId, useMemo, useRef, useState, type HTMLAttributes, type ReactNode } from \"react\";\nimport classNames from \"classnames\";\n\nexport type QRCodeErrorCorrectionLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\nexport interface QRCodeProps extends Omit<HTMLAttributes<HTMLDivElement>, \"color\" | \"onError\"> {\n value: string;\n size?: number;\n level?: QRCodeErrorCorrectionLevel;\n includeMargin?: boolean;\n fgColor?: string;\n bgColor?: string;\n ariaLabel?: string;\n description?: string;\n loading?: boolean;\n error?: ReactNode;\n onError?: (error: Error) => void;\n}\n\nfunction getRelativeLuminance(color: string) {\n const match = color.trim().match(/^#([\\da-f]{6})$/i);\n if (!match) return null;\n\n const channels = [0, 2, 4].map((offset) => Number.parseInt(match[1].slice(offset, offset + 2), 16) / 255);\n const linear = channels.map((channel) => (\n channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4\n ));\n\n return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2];\n}\n\nfunction resolveAccessibleColors(fgColor: string, bgColor: string) {\n const foregroundLuminance = getRelativeLuminance(fgColor);\n const backgroundLuminance = getRelativeLuminance(bgColor);\n\n if (foregroundLuminance === null || backgroundLuminance === null) {\n return { dark: fgColor, light: bgColor };\n }\n\n const lighter = Math.max(foregroundLuminance, backgroundLuminance);\n const darker = Math.min(foregroundLuminance, backgroundLuminance);\n const contrastRatio = (lighter + 0.05) / (darker + 0.05);\n\n return contrastRatio >= 3\n ? { dark: fgColor, light: bgColor }\n : { dark: \"#000000\", light: \"#FFFFFF\" };\n}\n\nexport function QRCode({\n value,\n size = 192,\n level = \"M\",\n includeMargin = true,\n fgColor = \"#000000\",\n bgColor = \"#FFFFFF\",\n ariaLabel = \"Código QR\",\n description,\n loading = false,\n error,\n onError,\n className,\n ...rest\n}: QRCodeProps) {\n const [dataUrl, setDataUrl] = useState<string | null>(null);\n const [generationError, setGenerationError] = useState<Error | null>(null);\n const onErrorRef = useRef(onError);\n const generatedId = useId();\n const resolvedSize = Math.max(1, Number.isFinite(size) ? Math.floor(size) : 192);\n const descriptionId = description\n ? `${rest.id ?? generatedId}-description`\n : undefined;\n const colors = useMemo(\n () => resolveAccessibleColors(fgColor, bgColor),\n [bgColor, fgColor],\n );\n const describedBy = [rest[\"aria-describedby\"], descriptionId].filter(Boolean).join(\" \") || undefined;\n const displayError = error ?? generationError?.message;\n const isLoading = loading || (!dataUrl && !displayError);\n\n useEffect(() => {\n onErrorRef.current = onError;\n }, [onError]);\n\n useEffect(() => {\n let active = true;\n if (error) {\n setDataUrl(null);\n setGenerationError(null);\n return () => { active = false; };\n }\n setDataUrl(null);\n setGenerationError(null);\n QRCodeGenerator.toDataURL(value, {\n width: resolvedSize,\n margin: includeMargin ? 4 : 0,\n errorCorrectionLevel: level,\n color: colors,\n })\n .then((url) => { if (active) setDataUrl(url); })\n .catch((cause: unknown) => {\n if (!active) return;\n const nextError = cause instanceof Error\n ? cause\n : new Error(\"Não foi possível gerar o código QR.\");\n setDataUrl(null);\n setGenerationError(nextError);\n onErrorRef.current?.(nextError);\n });\n return () => { active = false; };\n }, [colors, error, includeMargin, level, resolvedSize, value]);\n\n return (\n <div\n {...rest}\n role=\"img\"\n aria-label={ariaLabel}\n aria-describedby={describedBy}\n aria-busy={isLoading || undefined}\n aria-invalid={displayError ? true : undefined}\n className={classNames(\"inline-flex max-w-full flex-col items-center gap-2\", className)}\n >\n {displayError ? (\n <span role=\"alert\" className=\"rounded-sm border border-field-border-error p-3 text-sm text-field-assistive-error\">\n {displayError}\n </span>\n ) : dataUrl ? (\n <img src={dataUrl} alt=\"\" width={resolvedSize} height={resolvedSize} className=\"h-auto max-w-full\" />\n ) : (\n <span\n aria-hidden=\"true\"\n className=\"inline-block animate-pulse rounded-sm bg-surface-muted\"\n style={{ width: resolvedSize, height: resolvedSize, maxWidth: \"100%\" }}\n />\n )}\n {description && <span id={descriptionId} className=\"sr-only\">{description}</span>}\n </div>\n );\n}\n\nexport default QRCode;\n"],"mappings":";AAEA,OAAO,eAAe;AACtB,SAAS,WAAW,QAAQ,gBAAgC;AAoExD,SAEI,KAFJ;AAlEJ,IAAM,iCAAiC,CAAC,UAA0B;AAChE,QAAM,IAAI,MAAM,QAAQ,OAAO,EAAE;AAEjC,QAAM,QAAQ,EAAE,UAAU,GAAG,CAAC;AAC9B,QAAM,QAAQ,EAAE,UAAU,GAAG,CAAC;AAC9B,QAAM,SAAS,EAAE,UAAU,GAAG,CAAC;AAC/B,QAAM,SAAS,EAAE,UAAU,IAAI,EAAE;AACjC,QAAM,SAAS,EAAE,UAAU,IAAI,EAAE;AACjC,QAAM,cAAc,EAAE,UAAU,IAAI,EAAE;AACtC,QAAM,aAAa,EAAE,UAAU,IAAI,EAAE;AACrC,QAAM,QAAQ,EAAE,UAAU,IAAI,EAAE;AAEhC,SAAO,QAAQ,QAAQ,cAAc,aAAa,QAAQ,SAAS,SAAS;AAC9E;AAcO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY;AAAA,EACZ;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,SAAS,OAAsB,IAAI;AACzC,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAuB,IAAI;AAEzE,YAAU,MAAM;AACd,QAAI,CAAC,OAAO,QAAS;AACrB,uBAAmB,IAAI;AAEvB,QAAI;AACF,YAAM,eAAe,+BAA+B,cAAc;AAElE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,cAAc,QAAQ,cAAc,WAAU,qBAAoB,IAEnG,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAU;AAAA,YACV,OAAO,EAAE,OAAO,cAAc,QAAQ,cAAc,UAAU,OAAO;AAAA;AAAA,QACvE;AAAA,QAED,eAAe,gBAAAA,KAAC,UAAK,IAAI,eAAe,WAAU,WAAW,uBAAY;AAAA;AAAA;AAAA,EAC5E;AAEJ;AAEA,IAAO,iBAAQ;","names":["useRef","useState","jsx","jsxs","useRef","useState","rejectionMessage","classNames","jsx","jsxs","classNames","jsx","jsxs","classNames","classNames","useEffect","useRef","useState","jsx","jsxs","useEffect","useId","useRef","useState","classNames","jsx","jsxs"]}
@@ -7,7 +7,7 @@ import {
7
7
  COUNTRY_OPTIONS,
8
8
  PHONE_COUNTRY_OPTIONS,
9
9
  filterCountryOptions
10
- } from "./chunk-7IY43S3Y.js";
10
+ } from "./chunk-IS7ACRMB.js";
11
11
 
12
12
  // src/components/input/Input.tsx
13
13
  import React, { useRef, useCallback, useId, useState } from "react";
@@ -23,12 +23,12 @@ import { forwardRef } from "react";
23
23
  // src/components/field/field-styles.ts
24
24
  var FIELD_ROOT_CLASS = "field-layout flex w-full min-w-0 flex-col leading-6";
25
25
  var FIELD_LABEL_CLASS = "field-label-slot px-0.5 text-md tracking-wide text-field-content";
26
- var FIELD_CONTROL_CLASS = "field-control-slot field-keyboard-focus-ring relative mt-4xs mb-[4px] flex min-h-control-md w-full min-w-0 items-center gap-3 rounded-sm border border-field-border-default bg-field-surface px-3 text-field-icon transition-colors focus-within:border-field-border-active focus-within:text-field-content data-[has-value=true]:text-field-content";
27
- var FIELD_DISABLED_CLASS = "cursor-not-allowed border-field-border-default bg-field-surface-disabled text-field-content-disabled focus-within:border-field-border-default";
28
- var FIELD_ERROR_CLASS = "border-field-border-error text-field-assistive-error focus-within:border-field-border-error";
29
- var FIELD_MESSAGE_CLASS = "field-message-slot text-xs tracking-wide text-field-assistive-error";
26
+ var FIELD_CONTROL_CLASS = "field-control-slot field-keyboard-focus-ring relative mt-4xs mb-[4px] flex min-h-control-md w-full min-w-0 items-center gap-3 rounded-sm border border-field-border-default bg-field-surface px-[var(--field-padding-x,var(--spacing-xs))] [&.border-2]:px-[calc(var(--field-padding-x,var(--spacing-xs))-1px)] text-field-icon transition-colors focus-within:border-field-border-active focus-within:text-field-content data-[has-value=true]:text-field-content";
27
+ var FIELD_DISABLED_CLASS = "cursor-not-allowed border-field-border-default bg-field-surface-disabled text-field-placeholder-disabled data-[has-value=true]:text-field-content-disabled focus-within:border-field-border-default";
28
+ var FIELD_ERROR_CLASS = "border-2 border-field-border-error text-field-assistive-error focus-within:border-field-border-error";
29
+ var FIELD_MESSAGE_CLASS = "field-message-slot min-w-0 whitespace-normal break-words text-xs font-semibold tracking-wide text-field-assistive-error";
30
30
  var FIELD_DESCRIPTION_CLASS = "field-message-slot text-xs tracking-wide text-field-assistive";
31
- var FIELD_INPUT_CLASS = "w-full border-none bg-transparent text-field-content outline-none placeholder:text-field-placeholder focus:outline-none disabled:text-field-content-disabled disabled:placeholder:text-field-content-disabled";
31
+ var FIELD_INPUT_CLASS = "field-value w-full border-none bg-transparent text-field-content outline-none placeholder:text-field-placeholder focus:outline-none disabled:text-field-content-disabled disabled:placeholder:text-field-placeholder-disabled";
32
32
 
33
33
  // src/components/field/FieldFrame.tsx
34
34
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1071,6 +1071,8 @@ var InputSelect = ({
1071
1071
  onChange,
1072
1072
  ...rest
1073
1073
  }) => {
1074
+ void suffix;
1075
+ void error;
1074
1076
  const isSearchable = searchable ?? options.length > 10;
1075
1077
  const normalizeSearchText2 = (value) => value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
1076
1078
  const [field, meta, helpers] = useField2(name);
@@ -1279,7 +1281,9 @@ var InputSelect = ({
1279
1281
  "span",
1280
1282
  {
1281
1283
  className: classNames3("block w-full truncate overflow-hidden", {
1282
- "text-field-placeholder": !selectedOption && placeholder
1284
+ "text-field-placeholder": !disabled && !selectedOption && placeholder,
1285
+ "text-field-content-disabled": disabled && Boolean(selectedOption),
1286
+ "text-field-placeholder-disabled": disabled && !selectedOption
1283
1287
  }),
1284
1288
  children: selectedOption ? selectedOption.label : placeholder
1285
1289
  }
@@ -1444,7 +1448,7 @@ var InputSelect = ({
1444
1448
  closeDropdown();
1445
1449
  }
1446
1450
  },
1447
- className: classNames3(`${FIELD_CONTROL_CLASS} px-2`, {
1451
+ className: classNames3(`${FIELD_CONTROL_CLASS} [--field-padding-x:var(--spacing-2xs)]`, {
1448
1452
  [FIELD_DISABLED_CLASS]: disabled,
1449
1453
  [FIELD_ERROR_CLASS]: hasError,
1450
1454
  "cursor-pointer": !disabled
@@ -1457,7 +1461,8 @@ var InputSelect = ({
1457
1461
  className: classNames3(`h-5 w-5`, {
1458
1462
  "text-field-assistive-error": hasError,
1459
1463
  "text-field-content": !hasError && (open || selectedOption),
1460
- "text-field-content-disabled": disabled,
1464
+ "text-field-content-disabled": disabled && Boolean(selectedOption),
1465
+ "text-field-placeholder-disabled": disabled && !selectedOption,
1461
1466
  "cursor-not-allowed": disabled,
1462
1467
  "cursor-pointer": !disabled
1463
1468
  })
@@ -1468,10 +1473,12 @@ var InputSelect = ({
1468
1473
  "span",
1469
1474
  {
1470
1475
  className: classNames3(
1471
- "flex-1 min-w-0 flex items-center justify-between leading-5",
1472
- "bg-transparent text-field-content text-left",
1476
+ "field-value flex-1 min-w-0 flex items-center justify-between leading-5",
1477
+ "bg-transparent text-left",
1473
1478
  {
1474
- "text-field-content-disabled": disabled,
1479
+ "text-field-content": !disabled,
1480
+ "text-field-content-disabled": disabled && Boolean(selectedOption),
1481
+ "text-field-placeholder-disabled": disabled && !selectedOption,
1475
1482
  "cursor-not-allowed": disabled,
1476
1483
  "cursor-pointer": !disabled
1477
1484
  }
@@ -1486,7 +1493,8 @@ var InputSelect = ({
1486
1493
  className: classNames3(`h-5 w-5`, {
1487
1494
  "text-field-assistive-error": hasError,
1488
1495
  "text-field-content": !hasError && (open || selectedOption),
1489
- "text-field-content-disabled": disabled,
1496
+ "text-field-content-disabled": disabled && Boolean(selectedOption),
1497
+ "text-field-placeholder-disabled": disabled && !selectedOption,
1490
1498
  "cursor-not-allowed": disabled,
1491
1499
  "cursor-pointer": !disabled
1492
1500
  })
@@ -1495,11 +1503,13 @@ var InputSelect = ({
1495
1503
  "span",
1496
1504
  {
1497
1505
  className: classNames3(
1498
- "flex items-center justify-center text-field-icon",
1506
+ "flex items-center justify-center",
1499
1507
  {
1508
+ "text-field-icon": !hasError && !open && !selectedOption && !disabled,
1500
1509
  "text-field-assistive-error": hasError,
1501
1510
  "text-field-content": !hasError && (open || selectedOption),
1502
- "text-field-content-disabled": disabled,
1511
+ "text-field-content-disabled": disabled && Boolean(selectedOption),
1512
+ "text-field-placeholder-disabled": disabled && !selectedOption,
1503
1513
  "cursor-not-allowed": disabled,
1504
1514
  "cursor-pointer": !disabled
1505
1515
  }
@@ -1582,7 +1592,8 @@ var TextArea = ({
1582
1592
  {
1583
1593
  "data-has-value": String(field.value ?? "").length > 0,
1584
1594
  className: classNames4(
1585
- `${FIELD_CONTROL_CLASS} py-1`,
1595
+ FIELD_CONTROL_CLASS,
1596
+ hasError ? "py-[calc(var(--spacing-4xs)-1px)]" : "py-1",
1586
1597
  {
1587
1598
  [FIELD_DISABLED_CLASS]: disabled,
1588
1599
  [FIELD_ERROR_CLASS]: hasError
@@ -1999,7 +2010,7 @@ function InputPhone({
1999
2010
  field.value,
2000
2011
  availableCountries
2001
2012
  );
2002
- helpers.setValue(parsed);
2013
+ helpers.setValue(parsed, false);
2003
2014
  initializedRef.current = true;
2004
2015
  }, [availableCountries, field.value, helpers]);
2005
2016
  useEffect3(() => {
@@ -2077,11 +2088,16 @@ function InputPhone({
2077
2088
  },
2078
2089
  onBlur: () => helpers.setTouched(true),
2079
2090
  className: classNames5(
2080
- "flex h-full items-center gap-1.5 pl-2 pr-1 text-left",
2081
- "border-r border-field-border-default bg-transparent text-field-content focus:outline-none",
2091
+ "flex shrink-0 self-stretch items-center gap-0.5 pl-1 pr-0.5 text-left",
2092
+ "border-r bg-transparent focus:outline-none",
2082
2093
  {
2094
+ "pl-[calc(var(--spacing-4xs)-1px)]": hasError,
2095
+ "border-field-border-error text-field-assistive-error": hasError && !disabled,
2096
+ "border-field-border-default text-field-content": !hasError && !disabled,
2083
2097
  "cursor-pointer": !disabled,
2084
- "cursor-not-allowed text-content-disabled": disabled
2098
+ "cursor-not-allowed border-field-border-default": disabled,
2099
+ "text-field-content-disabled": disabled && phoneDigits.length > 0,
2100
+ "text-field-placeholder-disabled": disabled && phoneDigits.length === 0
2085
2101
  }
2086
2102
  ),
2087
2103
  children: [
@@ -2091,24 +2107,28 @@ function InputPhone({
2091
2107
  MdOutlineKeyboardArrowUp2,
2092
2108
  {
2093
2109
  className: classNames5("h-4 w-4 shrink-0", {
2094
- "text-field-assistive-error": hasError,
2095
- "text-field-content": !hasError
2110
+ "text-field-assistive-error": hasError && !disabled,
2111
+ "text-field-content": !hasError && !disabled,
2112
+ "text-field-content-disabled": disabled && phoneDigits.length > 0,
2113
+ "text-field-placeholder-disabled": disabled && phoneDigits.length === 0
2096
2114
  })
2097
2115
  }
2098
2116
  ) : /* @__PURE__ */ jsx6(
2099
2117
  MdOutlineKeyboardArrowDown2,
2100
2118
  {
2101
2119
  className: classNames5("h-4 w-4 shrink-0", {
2102
- "text-field-assistive-error": hasError,
2103
- "text-field-content": !hasError && phoneDigits.length > 0,
2104
- "text-field-icon": !hasError && phoneDigits.length === 0
2120
+ "text-field-assistive-error": hasError && !disabled,
2121
+ "text-field-content": !hasError && !disabled && phoneDigits.length > 0,
2122
+ "text-field-icon": !hasError && !disabled && phoneDigits.length === 0,
2123
+ "text-field-content-disabled": disabled && phoneDigits.length > 0,
2124
+ "text-field-placeholder-disabled": disabled && phoneDigits.length === 0
2105
2125
  })
2106
2126
  }
2107
2127
  )
2108
2128
  ]
2109
2129
  }
2110
2130
  ),
2111
- /* @__PURE__ */ jsx6("div", { className: "min-w-0 flex-1 pl-1 pr-3", children: phoneMask ? /* @__PURE__ */ jsx6(
2131
+ /* @__PURE__ */ jsx6("div", { className: classNames5("min-w-0 flex-1 pl-1", hasError ? "pr-[calc(var(--spacing-xs)-1px)]" : "pr-3"), children: phoneMask ? /* @__PURE__ */ jsx6(
2112
2132
  PatternFormat2,
2113
2133
  {
2114
2134
  id: name,
@@ -2222,7 +2242,7 @@ function InputPhone({
2222
2242
  },
2223
2243
  className: "flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-surface-muted focus-visible:bg-surface-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring",
2224
2244
  children: [
2225
- renderFlag(country, showFlags),
2245
+ renderFlag(country, true),
2226
2246
  /* @__PURE__ */ jsx6("span", { className: "min-w-0 flex-1 truncate text-field-content", children: country.label }),
2227
2247
  /* @__PURE__ */ jsx6("span", { className: "shrink-0 text-content-muted", children: country.idd.display })
2228
2248
  ]
@@ -2810,13 +2830,16 @@ var UnifiedDatePicker = ({
2810
2830
  type: "button",
2811
2831
  disabled: isFieldDisabled,
2812
2832
  onClick: openCalendar,
2813
- className: "flex items-center justify-center disabled:cursor-not-allowed",
2833
+ className: classNames6(
2834
+ "flex items-center justify-center disabled:cursor-not-allowed",
2835
+ draftValue ? "disabled:text-field-content-disabled" : "disabled:text-field-placeholder-disabled"
2836
+ ),
2814
2837
  "aria-label": "Abrir calendario",
2815
2838
  children: /* @__PURE__ */ jsx7(
2816
2839
  MdCalendarMonth,
2817
2840
  {
2818
2841
  className: classNames6("h-5 w-5", {
2819
- "text-field-assistive-error": hasError
2842
+ "text-field-assistive-error": hasError && !isFieldDisabled
2820
2843
  })
2821
2844
  }
2822
2845
  )
@@ -3192,6 +3215,7 @@ function SelectMultiView(props) {
3192
3215
  {
3193
3216
  type: "button",
3194
3217
  id: triggerId,
3218
+ "data-has-value": selectedCount > 0,
3195
3219
  ref: triggerRef,
3196
3220
  "aria-controls": groupId,
3197
3221
  "aria-expanded": isOpened,
@@ -3213,7 +3237,7 @@ function SelectMultiView(props) {
3213
3237
  },
3214
3238
  className: cs(
3215
3239
  "flex h-control-md w-full cursor-pointer items-center justify-between rounded-sm border border-field-border-default bg-field-surface px-3 text-field-icon focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring",
3216
- error && "border-field-border-error text-field-assistive-error",
3240
+ error && "border-2 px-[calc(var(--spacing-xs)-1px)] border-field-border-error text-field-assistive-error",
3217
3241
  !error && isOpened && "border-field-border-active text-field-content",
3218
3242
  !error && selectedCount > 0 && "text-field-content",
3219
3243
  disabled && "cursor-not-allowed border-field-border-default bg-field-surface-disabled text-field-content-disabled"
@@ -3223,10 +3247,12 @@ function SelectMultiView(props) {
3223
3247
  "span",
3224
3248
  {
3225
3249
  className: cs(
3226
- "min-w-0 flex-1 truncate text-left text-base font-normal text-field-placeholder",
3250
+ "min-w-0 flex-1 truncate text-left text-base font-normal",
3227
3251
  {
3252
+ "text-field-placeholder": !disabled && selectedCount === 0,
3228
3253
  "pr-12 text-field-content": !disabled && selectedCount > 0,
3229
- "text-field-content-disabled": disabled
3254
+ "text-field-content-disabled": disabled && selectedCount > 0,
3255
+ "text-field-placeholder-disabled": disabled && selectedCount === 0
3230
3256
  }
3231
3257
  ),
3232
3258
  children: "Selecione"
@@ -3237,12 +3263,14 @@ function SelectMultiView(props) {
3237
3263
  {
3238
3264
  "aria-hidden": "true",
3239
3265
  className: cs(
3240
- "shrink-0 text-base text-field-icon transition-transform",
3266
+ "shrink-0 text-base transition-transform",
3241
3267
  {
3268
+ "text-field-icon": !error && !isOpened && selectedCount === 0 && !disabled,
3242
3269
  "rotate-180": isOpened,
3243
3270
  "text-field-assistive-error": error,
3244
3271
  "text-field-content": !error && (isOpened || selectedCount > 0),
3245
- "text-field-content-disabled": disabled
3272
+ "text-field-content-disabled": disabled && selectedCount > 0,
3273
+ "text-field-placeholder-disabled": disabled && !(selectedCount > 0)
3246
3274
  }
3247
3275
  )
3248
3276
  }
@@ -3308,9 +3336,9 @@ function SelectMultiView(props) {
3308
3336
  "aria-label": `Limpar sele\xE7\xE3o de ${label ?? "op\xE7\xF5es"}`,
3309
3337
  disabled,
3310
3338
  onClick: onClear,
3311
- className: "absolute right-9 top-1/2 flex min-h-6 min-w-6 -translate-y-1/2 touch-manipulation items-center justify-center gap-1 rounded-full bg-action-primary px-2 text-xs text-action-primary-content focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring disabled:cursor-not-allowed",
3339
+ className: "absolute right-9 top-1/2 flex min-h-6 min-w-6 -translate-y-1/2 touch-manipulation items-center justify-center gap-1 rounded-full bg-action-primary px-2 text-xs text-action-primary-content focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring disabled:cursor-not-allowed disabled:bg-field-surface-disabled disabled:text-field-content-disabled",
3312
3340
  children: [
3313
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: selectedCount }),
3341
+ /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", className: "field-value", "data-has-value": "true", children: selectedCount }),
3314
3342
  /* @__PURE__ */ jsx8(MdClose, { "aria-hidden": "true", size: 10 })
3315
3343
  ]
3316
3344
  }
@@ -3394,7 +3422,7 @@ function SelectCountry({
3394
3422
  searchable,
3395
3423
  searchPlaceholder,
3396
3424
  noOptionsText,
3397
- renderOption: (option) => renderCountryContent(option, void 0, showFlags),
3425
+ renderOption: (option) => renderCountryContent(option),
3398
3426
  renderValue: (option, placeholder) => renderCountryContent(
3399
3427
  option,
3400
3428
  placeholder,
@@ -3431,7 +3459,7 @@ function RadioGroup({
3431
3459
  /* @__PURE__ */ jsx11("div", { className: "field-control-slot mt-4xs mb-[4px] flex min-h-control-md flex-wrap items-center gap-x-6 gap-y-2", children: options.map((option) => /* @__PURE__ */ jsxs9(
3432
3460
  "label",
3433
3461
  {
3434
- className: "flex min-h-7 cursor-pointer items-center gap-2",
3462
+ className: `flex min-h-7 items-center gap-2 ${rest.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
3435
3463
  children: [
3436
3464
  /* @__PURE__ */ jsx11(
3437
3465
  "input",
@@ -3446,7 +3474,7 @@ function RadioGroup({
3446
3474
  className: "radio-control"
3447
3475
  }
3448
3476
  ),
3449
- /* @__PURE__ */ jsx11("span", { className: "text-content-secondary", children: option.label })
3477
+ /* @__PURE__ */ jsx11("span", { className: rest.disabled ? "text-field-content-disabled" : "text-content-secondary", children: option.label })
3450
3478
  ]
3451
3479
  },
3452
3480
  option.value
@@ -3539,9 +3567,10 @@ function RadioCardGroup({
3539
3567
  htmlFor: optionId,
3540
3568
  className: classNames7(
3541
3569
  "block rounded-md border p-4 transition-colors",
3542
- checked ? "border-primary-1 bg-primary-5" : "border-transparent bg-bg-light",
3543
- hasError && !checked ? "outline outline-1 outline-feedback-danger-border" : "outline outline-1 outline-transparent",
3544
- optionDisabled ? "cursor-not-allowed opacity-60" : "cursor-pointer",
3570
+ optionDisabled ? "bg-field-surface-disabled" : checked ? "bg-primary-5" : "bg-bg-light",
3571
+ !hasError && (checked ? "border-primary-1" : "border-transparent"),
3572
+ hasError ? "border-2 border-field-border-error p-[calc(var(--spacing-sm)-1px)]" : "outline outline-1 outline-transparent",
3573
+ optionDisabled ? "cursor-not-allowed" : "cursor-pointer",
3545
3574
  optionClassName
3546
3575
  ),
3547
3576
  children: /* @__PURE__ */ jsxs10("div", { className: "flex items-start gap-3", children: [
@@ -3565,8 +3594,8 @@ function RadioCardGroup({
3565
3594
  }
3566
3595
  ),
3567
3596
  /* @__PURE__ */ jsxs10("div", { className: "min-w-0 flex-1", children: [
3568
- /* @__PURE__ */ jsx12("div", { className: "font-bold text-content-primary", children: option.title }),
3569
- option.description && /* @__PURE__ */ jsx12("div", { className: "mt-1 text-content-primary", children: option.description })
3597
+ /* @__PURE__ */ jsx12("div", { className: classNames7("font-bold", optionDisabled ? "text-field-content-disabled" : "text-content-primary"), children: option.title }),
3598
+ option.description && /* @__PURE__ */ jsx12("div", { className: classNames7("mt-1", optionDisabled ? "text-field-content-disabled" : "text-content-primary"), children: option.description })
3570
3599
  ] })
3571
3600
  ] })
3572
3601
  },
@@ -3579,7 +3608,7 @@ function RadioCardGroup({
3579
3608
  id: errorId,
3580
3609
  role: "alert",
3581
3610
  "aria-live": "assertive",
3582
- className: "mt-1 text-xs tracking-wide text-feedback-danger-content",
3611
+ className: "mt-1 text-xs font-semibold tracking-wide text-feedback-danger-content",
3583
3612
  children: helperText
3584
3613
  }
3585
3614
  )
@@ -3757,6 +3786,7 @@ var OtpCodeInput = forwardRef2(
3757
3786
  autoComplete: index === 0 ? "one-time-code" : "off",
3758
3787
  maxLength: 1,
3759
3788
  value: currentValues[index],
3789
+ "data-has-value": Boolean(currentValues[index]),
3760
3790
  disabled,
3761
3791
  "aria-label": `${label}, d\xEDgito ${index + 1} de ${safeLength}`,
3762
3792
  "aria-invalid": hasError || void 0,
@@ -3777,8 +3807,8 @@ var OtpCodeInput = forwardRef2(
3777
3807
  if (!event.defaultPrevented) event.currentTarget.select();
3778
3808
  },
3779
3809
  className: classNames8(
3780
- "h-11 w-11 rounded-sm border bg-field-surface text-center text-lg font-bold text-field-content outline-none transition-colors focus-visible:border-field-border-active focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring disabled:cursor-not-allowed disabled:bg-field-surface-disabled",
3781
- hasError ? "border-field-border-error" : "border-field-border-default"
3810
+ "field-value h-11 w-11 rounded-sm border bg-field-surface text-center text-lg font-bold text-field-content outline-none transition-colors focus-visible:border-field-border-active focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring disabled:cursor-not-allowed disabled:bg-field-surface-disabled disabled:text-field-content-disabled",
3811
+ hasError ? "border-2 border-field-border-error focus-visible:border-field-border-error" : "border-field-border-default"
3782
3812
  )
3783
3813
  }
3784
3814
  ))
@@ -3810,4 +3840,4 @@ export {
3810
3840
  RadioCardGroup,
3811
3841
  OtpCodeInput_default
3812
3842
  };
3813
- //# sourceMappingURL=chunk-47GMEVB5.js.map
3843
+ //# sourceMappingURL=chunk-YT6ZM6WC.js.map