import type { AsTag } from 'reka-ui'; /** * Reason emitted with the `'error'` event when an uploaded file fails internal * validation against the `accept` extension list or `maxSizeBytes` size cap. * * - `'bad-format'`: the file's extension is not in the `accept` list. * - `'too-large'`: the file's size exceeds `maxSizeBytes`. */ export type TFileUploadErrorReason = 'bad-format' | 'too-large'; /** * Props for the `TFileUpload` component. * * `TFileUpload` is a single-file upload control with three visual states * (empty / loading / loaded) and built-in validation against an allow-list of * extensions and an optional maximum size in bytes. The selected `File` (or * `null`) is exposed via `v-model`; validation failures emit `'error'` * **instead of** updating the model. * * All user-facing strings are passed in as props so the consumer owns i18n; * the component does not import a translation function. */ export interface TFileUploadProps { /** * Label shown above the upload box (e.g. `"Adjuntar archivo"`). * When omitted, the label slot/element is not rendered. */ label?: string; /** * Call-to-action text rendered inside the box while no file is attached * (e.g. `"Subir archivo"`). * @defaultValue 'Subir archivo' */ ctaText?: string; /** * Text rendered inside the box while `loading` is `true` * (e.g. `"Cargando archivo"`). * @defaultValue 'Cargando archivo' */ loadingText?: string; /** * Accessible label for the remove button shown in the loaded state. * @defaultValue 'Quitar archivo' */ removeLabel?: string; /** * Hint displayed beneath the box (bottom-left) listing accepted formats. * Hidden in the loaded state. */ formatsHint?: string; /** * Hint displayed beneath the box (bottom-right) describing the size limit. * Hidden in the loaded state. */ maxSizeHint?: string; /** * Accepted file extensions without the leading dot (e.g. `['csv', 'pdf']`). * Used to build the native `accept` attribute and to validate the selected * file. When omitted, no extension validation runs. */ accept?: string[]; /** * Maximum file size in bytes. Files larger than this emit * `'error'` with reason `'too-large'` and the model is not updated. * When omitted, no size validation runs. */ maxSizeBytes?: number; /** * Controlled loading flag. When `true` the box renders the loading visual * and the underlying `` is disabled so the user cannot * pick another file mid-upload. * @defaultValue false */ loading?: boolean; /** * Optional id forwarded to the underlying ``. When * omitted a stable auto-generated id is used. */ id?: string; /** * Form field name forwarded to the underlying ``. * Required for native form submission (the file is sent under this key). */ name?: string; /** * Marks the input as required for native HTML5 form validation. * @defaultValue false */ required?: boolean; /** * Disables the picker. The native `` is disabled and the box * renders in a non-interactive visual state. * @defaultValue false */ disabled?: boolean; /** * `id` of the `