{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tw-file-uploader",
  "type": "registry:ui",
  "title": "react-tw/file-uploader.tsx",
  "description": "Carbon `FileUploader` / `FileUploaderDropContainer` / `FileUploaderItem` as React + Tailwind Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [
    "@purpurabog/ui@^2.3.0"
  ],
  "registryDependencies": [
    "@kanok-ui/core-file-uploader",
    "@kanok-ui/core-i18n",
    "@kanok-ui/tw-button",
    "@kanok-ui/tw-field",
    "@kanok-ui/tw-i18n",
    "@kanok-ui/tw-progress-bar",
    "@kanok-ui/tw-theme",
    "@kanok-ui/tw-utils"
  ],
  "files": [
    {
      "path": "src/react-tw/file-uploader.tsx",
      "type": "registry:ui",
      "target": "components/ui/react-tw/file-uploader.tsx",
      "content": "import { useId, type ReactNode, type ComponentProps } from 'react';\nimport { formatFileSize, formatPercent, itemErrorSubject, pickedFilesLabel, rejectionMessage, type FileStatus } from '../core/file-uploader.ts';\nimport { FileUploader as FilePrimitive } from '@purpurabog/ui/headless';\nimport { Button, type ButtonKind } from './button.tsx';\nimport { ProgressBar } from './progress-bar.tsx';\nimport type { FileUploaderMessages } from '../core/i18n.ts';\nimport { useLanguage, useTranslation } from './lib/i18n.ts';\nimport { cn } from './lib/utils.ts';\nimport { useFieldDisabled } from './field.tsx';\n\n/**\n * Carbon `FileUploader` / `FileUploaderDropContainer` / `FileUploaderItem` as React + Tailwind\n * components, the look and rules of `<ui-file-uploader>` (core/file-uploader): a title, a\n * description and an \"Add file\" button — or a dashed drop zone (`drop`) — that opens the file\n * dialog; the chosen files are listed as items. `accept` and `maxFileSize` mark refused files\n * invalid (they stay listed with their error, and aren't submitted). Items start in `status`;\n * update `files` as uploads progress. In a form every valid file is submitted under `name`, and\n * `required` blocks the submit until there is one. Beyond Carbon, as `<ui-file-uploader>`:\n * `maxFiles` / `maxTotalSize` limits (files past them are invalid rows), a file's `progress`\n * (bar and percentage), `retryable` failed uploads (`onRetry`) and `showSize`. The behaviour is the headless\n * FileUploader.\n */\nexport type { FileStatus } from '../core/file-uploader.ts';\nexport type FileUploaderSize = 'sm' | 'md' | 'lg';\n\n/** One file in the list. */\nexport type FileItem = FilePrimitive.FileItem;\n\nexport type FileChange = FilePrimitive.FileChange;\n\nconst closeIcon = (\n    <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n        <path d=\"M12 4.7 11.3 4 8 7.3 4.7 4 4 4.7 7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\" />\n    </svg>\n);\nconst checkIcon = (\n    <svg viewBox=\"0 0 16 16\" className=\"inline h-4 w-6 align-baseline fill-interactive\">\n        <path d=\"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm-1 10.2L4 8.2l.8-.8L7 9.6l4.2-4.2.8.8z\" />\n    </svg>\n);\n// Carbon Renew (32px glyph drawn at 16px)\nconst renewIcon = (\n    <svg viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n        <path d=\"M12 10H6.78A11 11 0 0 1 27 16h2A13 13 0 0 0 6 7.68V4H4v8h8Z\" />\n        <path d=\"M20 22h5.22A11 11 0 0 1 5 16H3a13 13 0 0 0 23 8.32V28h2v-8h-8Z\" />\n    </svg>\n);\nconst warningIcon = (\n    <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\" className=\"me-2 size-4 fill-error\">\n        <path d=\"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm-.5 3h1v5h-1zM8 12.2a.8.8 0 1 1 0-1.6.8.8 0 0 1 0 1.6Z\" />\n    </svg>\n);\n\n/** The remove and retry buttons: a 24px icon button with Carbon's inset focus ring (a design can round it and ring it outside). */\nconst ICON_BUTTON = cn(\n    'm-0 flex size-6 cursor-pointer items-center justify-center rounded-[var(--ui-icon-control-radius,0px)] border-0 bg-transparent p-0 text-icon-primary [&_svg]:size-4 [&_svg]:fill-current',\n    'outline-none focus-visible:outline-[length:var(--ui-focus-width,2px)] focus-visible:outline-solid focus-visible:[outline-offset:var(--ui-focus-offset,-2px)] focus-visible:outline-focus',\n    'disabled:cursor-not-allowed disabled:text-icon-disabled',\n);\n\nconst ROW = {\n    sm: { row: 'min-h-8 gap-y-1', invalid: 'py-1', error: 'pt-[7px]' },\n    md: { row: 'min-h-10 gap-y-2', invalid: 'py-2', error: 'pt-[11px]' },\n    lg: { row: 'min-h-12 gap-y-3', invalid: 'py-3', error: 'pt-4' },\n} as const;\n\n/** The size and the upload percentage between the name and the state (the bar carries the percentage for screen readers). */\nfunction ItemMeta({ size, percent, language, disabled }: Readonly<{ size?: number; percent?: number; language: string; disabled: boolean }>) {\n    const sizeText = typeof size === 'number' && Number.isFinite(size) ? formatFileSize(size, language) : '';\n    if (!sizeText && percent === undefined) return null;\n    return (\n        <span className={cn('flex gap-2 px-2 whitespace-nowrap text-ink-muted tabular-nums type-caption leading-4!', disabled && 'text-ink-disabled')}>\n            {sizeText ? <span data-file-size=\"\">{sizeText}</span> : null}\n            {percent === undefined ? null : (\n                <span data-file-percent=\"\" aria-hidden=\"true\">\n                    {formatPercent(percent, language)}\n                </span>\n            )}\n        </span>\n    );\n}\n\ninterface ItemStateProps {\n    /** The state's text: `iconLabel` or \"Remove file\" / \"Uploading\" / \"Uploaded\". */\n    label: string;\n    describedBy?: string;\n    t: FileUploaderMessages;\n}\n\n/** The row's end: the spinner, the check mark, or (edit, or uploading with a progress) the warning icon, retry and remove buttons. */\nfunction ItemState({ label, describedBy, t }: Readonly<ItemStateProps>) {\n    const { status, percent, name, invalid } = FilePrimitive.useItemContext();\n    // the icon is drawn, its meaning is text\n    if (status === 'uploading' && percent === undefined) {\n        return (\n            <>\n                <span data-file-state=\"\" aria-hidden=\"true\" className=\"m-1 box-border size-4 animate-spin rounded-[50%] border-2 border-solid border-layer-accent border-t-interactive [animation-duration:690ms] motion-reduce:[animation-duration:2s]\" />\n                <span className=\"sr-only\">{label}</span>\n            </>\n        );\n    }\n    if (status === 'complete') {\n        return (\n            <>\n                <span data-file-state=\"\" aria-hidden=\"true\">\n                    {checkIcon}\n                </span>\n                <span className=\"sr-only\">{label}</span>\n            </>\n        );\n    }\n    // with a progress the remove button cancels the upload\n    const closeLabel = percent === undefined ? label : t.cancelUpload;\n    return (\n        <>\n            {invalid ? warningIcon : null}\n            <FilePrimitive.Retry aria-label={`${t.retry} - ${name}`} aria-describedby={describedBy} className={ICON_BUTTON}>\n                {renewIcon}\n            </FilePrimitive.Retry>\n            <FilePrimitive.Remove aria-label={`${closeLabel} - ${name}`} aria-describedby={describedBy} className={ICON_BUTTON}>\n                {closeIcon}\n            </FilePrimitive.Remove>\n        </>\n    );\n}\n\nexport interface FileUploaderItemProps extends Omit<ComponentProps<'div'>, 'name' | 'uuid' | 'status' | 'invalid' | 'errorSubject' | 'errorBody' | 'size' | 'disabled' | 'iconLabel' | 'progress' | 'retryable' | 'fileSize' | 'onDelete' | 'onRetry' | 'lang' | 'className'> {\n    name: string;\n    /** Identifies the file in `onDelete`; defaults to `name`. */\n    uuid?: string;\n    status?: FileStatus;\n    invalid?: boolean;\n    errorSubject?: string;\n    errorBody?: string;\n    size?: FileUploaderSize;\n    disabled?: boolean;\n    /** Describes the state icon / remove button (default: \"Remove file\", \"Uploading\", \"Uploaded\"); with `progress`, the bar. */\n    iconLabel?: string;\n    /** Upload progress 0–100, shown while `status` is uploading (percentage, bar, cancel button) instead of the spinner. */\n    progress?: number;\n    /** On an invalid row: a retry button (`onRetry`) for a failed upload. */\n    retryable?: boolean;\n    /** Bytes; shows the size in the row (\"1.2 MB\"). */\n    fileSize?: number;\n    onDelete?: (uuid: string) => void;\n    onRetry?: (uuid: string) => void;\n    lang?: string;\n    className?: string;\n}\n\n/**\n * Carbon `FileUploaderItem`: one file. `edit` shows a remove button, `uploading` a spinner,\n * `complete` a check mark (announced when an upload finishes). `invalid` outlines the row in red\n * with `errorSubject` / `errorBody` as an alert. Beyond Carbon, as `<ui-file-uploader-item>`:\n * `progress` while uploading (percentage, a small bar under the row, a cancel button),\n * `retryable` invalid rows (a retry button, \"Upload failed\" without `errorSubject`), `fileSize`.\n * The behaviour is the headless `FileUploader.Item`.\n */\nexport function FileUploaderItem({ name, uuid, status = 'edit', invalid = false, errorSubject = '', errorBody = '', size = 'md', disabled = false, iconLabel, progress, retryable = false, fileSize, onDelete, onRetry, lang, className, ...rest }: Readonly<FileUploaderItemProps>) {\n    return (\n        <FilePrimitive.Item {...rest} name={name} uuid={uuid} status={status} invalid={invalid} retryable={retryable} disabled={disabled} progress={progress} onDelete={onDelete} onRetry={onRetry} className={cn('mb-2 block max-w-[var(--ui-file-uploader-max-width,320px)] font-sans last:mb-0', className)}>\n            <ItemBody errorSubject={errorSubject} errorBody={errorBody} size={size} iconLabel={iconLabel} fileSize={fileSize} lang={lang} />\n        </FilePrimitive.Item>\n    );\n}\n\n/** The row (name, size, percentage, state, error, announcement) and the progress bar, inside the item primitive. */\nfunction ItemBody({ errorSubject, errorBody, size, iconLabel, fileSize, lang }: Readonly<{ errorSubject: string; errorBody: string; size: FileUploaderSize; iconLabel?: string; fileSize?: number; lang?: string }>) {\n    const language = useLanguage(lang);\n    const t = useTranslation(lang).fileUploader;\n    const ids = useId();\n    const errorId = `${ids}error`;\n    const { name, status, invalid, retryable, disabled, percent } = FilePrimitive.useItemContext();\n    const defaultLabel = { uploading: t.uploading, complete: t.uploaded, edit: t.removeFile }[status];\n    const label = iconLabel || defaultLabel;\n    const look = ROW[size];\n    const errorText = itemErrorSubject({ invalid, retryable, errorSubject }, t);\n    const showError = !!errorText;\n\n    return (\n        <>\n            <FilePrimitive.ItemRow\n                className={cn(\n                    // Carbon: a square layer-coloured row; a design can round and outline it (--ui-file-item-radius / -edge)\n                    'grid grid-cols-[1fr_auto_auto] auto-rows-auto items-center gap-x-0 rounded-[var(--ui-file-item-radius,0px)] bg-surface-1 shadow-[var(--ui-file-item-edge,none)] [overflow-wrap:break-word]',\n                    'focus:outline-[length:var(--ui-focus-width,2px)] focus:outline-solid focus:-outline-offset-2 focus:outline-focus focus:not-focus-visible:outline-[color:var(--ui-pointer-focus,var(--ui-focus))]',\n                    look.row,\n                    invalid && cn('outline-2 outline-solid -outline-offset-2 outline-error', look.invalid),\n                    'forced-colors:outline-1 forced-colors:outline-solid forced-colors:outline-[CanvasText]',\n                )}\n            >\n                <p title={name} className={cn('m-0 ms-4 overflow-hidden text-ellipsis whitespace-nowrap text-ink type-body-sm leading-[18px]!', disabled && 'text-ink-disabled')}>\n                    {name}\n                </p>\n                <ItemMeta size={fileSize} percent={percent} language={language} disabled={disabled} />\n                <span className=\"flex min-w-6 items-center justify-center pe-3\">\n                    <ItemState label={label} describedBy={showError ? errorId : undefined} t={t} />\n                </span>\n                {showError ? (\n                    <div role=\"alert\" id={errorId} className={cn('col-span-full m-0 border-0 border-t border-solid border-hairline pb-0', look.error)}>\n                        <div className=\"m-0 px-4 text-error-text type-caption leading-4!\">{errorText}</div>\n                        {errorBody ? <p className=\"m-0 px-4 text-ink type-caption leading-4!\">{errorBody}</p> : null}\n                    </div>\n                ) : null}\n                <FilePrimitive.ItemStatus className=\"sr-only\">{`${t.uploaded}: ${name}`}</FilePrimitive.ItemStatus>\n            </FilePrimitive.ItemRow>\n            {percent === undefined ? null : <ProgressBar size=\"sm\" hideLabel label={`${iconLabel || t.uploading} - ${name}`} value={percent} lang={lang} />}\n        </>\n    );\n}\n\nexport interface FileUploaderProps extends Omit<ComponentProps<'div'>, 'labelTitle' | 'labelDescription' | 'buttonLabel' | 'buttonKind' | 'size' | 'drop' | 'dropLabel' | 'accept' | 'multiple' | 'maxFileSize' | 'maxFiles' | 'maxTotalSize' | 'showSize' | 'name' | 'disabled' | 'status' | 'iconLabel' | 'keepLabel' | 'required' | 'requiredText' | 'invalidTypeText' | 'tooLargeText' | 'tooManyText' | 'totalTooLargeText' | 'invalidBodyText' | 'files' | 'defaultFiles' | 'onAdd' | 'onChange' | 'onDelete' | 'onRetry' | 'children' | 'lang' | 'className'> {\n    labelTitle?: ReactNode;\n    labelDescription?: ReactNode;\n    /** Button text; replaced by the file name / \"N files\" after a pick unless `keepLabel`. */\n    buttonLabel?: string;\n    buttonKind?: ButtonKind;\n    /** Button and item sizes (Carbon default md). */\n    size?: FileUploaderSize;\n    /** The dashed drop zone instead of the button (Carbon `FileUploaderDropContainer`). */\n    drop?: boolean;\n    dropLabel?: string;\n    /** Comma-separated extensions / MIME types, e.g. \".pdf,.jpg,image/png\". */\n    accept?: string;\n    multiple?: boolean;\n    /** Bytes; larger files are added as invalid. */\n    maxFileSize?: number;\n    /** Most valid files in the list; the ones past it are added as invalid (0 = no limit). */\n    maxFiles?: number;\n    /** Bytes the valid files may add up to; a file that would go over is added as invalid (0 = no limit). */\n    maxTotalSize?: number;\n    /** Show each file's size in its row (\"1.2 MB\", in the page language). */\n    showSize?: boolean;\n    name?: string;\n    disabled?: boolean;\n    /** Status new items start in (Carbon `filenameStatus`). */\n    status?: FileStatus;\n    iconLabel?: string;\n    keepLabel?: boolean;\n    /** At least one valid file before the form submits. */\n    required?: boolean;\n    requiredText?: string;\n    invalidTypeText?: string;\n    tooLargeText?: string;\n    tooManyText?: string;\n    totalTooLargeText?: string;\n    invalidBodyText?: string;\n    /** The list (controlled); replace it to update statuses or errors. */\n    files?: FileItem[];\n    defaultFiles?: FileItem[];\n    /** Right after the user picked or dropped files (refused ones included). */\n    onAdd?: (addedFiles: FileItem[]) => void;\n    onChange?: (change: FileChange) => void;\n    onDelete?: (deleted: { deletedFile: FileItem; remainingFiles: FileItem[] }) => void;\n    /** The user retried a failed upload (a `retryable` invalid file): start it again and update `files`. */\n    onRetry?: (retriedFile: FileItem) => void;\n    /** Extra items (e.g. files already on the server) after the picked ones. */\n    children?: ReactNode;\n    lang?: string;\n    className?: string;\n}\n\nexport function FileUploader({\n    buttonKind = 'primary',\n    size = 'md',\n    drop = false,\n    accept = '',\n    multiple = false,\n    maxFileSize = 0,\n    maxFiles = 0,\n    maxTotalSize = 0,\n    name,\n    disabled: ownDisabled,\n    status = 'edit',\n    keepLabel = false,\n    required = false,\n    requiredText,\n    invalidTypeText,\n    tooLargeText,\n    tooManyText,\n    totalTooLargeText,\n    invalidBodyText,\n    files,\n    defaultFiles = [],\n    onAdd,\n    onChange,\n    onDelete,\n    onRetry,\n    lang,\n    ...rest\n}: Readonly<FileUploaderProps>) {\n    const disabled = useFieldDisabled(ownDisabled);\n    const language = useLanguage(lang);\n    const t = useTranslation(lang).fileUploader;\n    /** A refused file's error, in the page language. */\n    const describeRejection = (rejection: FilePrimitive.Rejection) => rejectionMessage(rejection, t, { invalidTypeText, tooLargeText, tooManyText, totalTooLargeText, invalidBodyText }, { maxFiles, maxTotalSize, locale: language });\n    return (\n        <FilePrimitive.Root\n            accept={accept}\n            multiple={multiple}\n            maxFileSize={maxFileSize}\n            maxFiles={maxFiles}\n            maxTotalSize={maxTotalSize}\n            describeRejection={describeRejection}\n            name={name}\n            disabled={disabled}\n            status={status}\n            required={required}\n            requiredText={requiredText || t.required}\n            files={files}\n            defaultFiles={defaultFiles}\n            onAdd={onAdd}\n            onChange={onChange}\n            onDelete={onDelete}\n            onRetry={onRetry}\n        >\n            <FileUploaderBody {...rest} buttonKind={buttonKind} size={size} drop={drop} keepLabel={keepLabel} status={status} lang={lang} />\n        </FilePrimitive.Root>\n    );\n}\n\ntype FileUploaderBodyProps = Omit<FileUploaderProps, 'accept' | 'multiple' | 'maxFileSize' | 'maxFiles' | 'maxTotalSize' | 'name' | 'disabled' | 'required' | 'requiredText' | 'invalidTypeText' | 'tooLargeText' | 'tooManyText' | 'totalTooLargeText' | 'invalidBodyText' | 'files' | 'defaultFiles' | 'onAdd' | 'onChange' | 'onDelete' | 'onRetry'> &\n    Required<Pick<FileUploaderProps, 'buttonKind' | 'size' | 'drop' | 'keepLabel' | 'status'>>;\n\n/** The title, description, trigger, hidden inputs and the list, inside the primitive (they follow its files and state). */\nfunction FileUploaderBody({ labelTitle, labelDescription, buttonLabel, buttonKind, size, drop, dropLabel, showSize = false, status, iconLabel, keepLabel, children, lang, className, ...rest }: Readonly<FileUploaderBodyProps>) {\n    const t = useTranslation(lang).fileUploader;\n    const { files, picked, disabled, dragOver, titleId, remove, retry } = FilePrimitive.useFileUploaderContext();\n    const pickedLabel = keepLabel || !picked.length ? '' : pickedFilesLabel(picked, t.filesChosen);\n\n    const triggerElement = drop ? (\n        <FilePrimitive.Trigger\n            openOnKeyDown\n            className={cn(\n                // Carbon's drop container, laid out by --ui-file-drop-* as <ui-file-uploader>'s (Kanok: a filled, centred tile with an icon);\n                // the corners: the field setting (--ui-field-radius; Carbon: square)\n                'm-0 box-border flex h-[var(--ui-file-drop-height,96px)] min-h-[var(--ui-file-drop-min-height,auto)] w-full max-w-[var(--ui-file-uploader-max-width,320px)] cursor-pointer overflow-hidden',\n                '[flex-direction:var(--ui-file-drop-direction,row)] [align-items:var(--ui-file-drop-align,flex-start)] [justify-content:var(--ui-file-drop-justify,space-between)] gap-[var(--ui-file-drop-gap,0px)]',\n                'rounded-[var(--ui-file-drop-radius,var(--ui-field-radius,0px))] border border-dashed border-hairline-strong bg-[color:var(--ui-file-drop-background,transparent)] p-[var(--ui-file-drop-padding,16px)]',\n                '[text-align:var(--ui-file-drop-text-align,start)] text-link type-body-sm leading-[18px]!',\n                // Carbon file-browse-btn: everything at fast-02 (the outline, and the text colour while pressed)\n                'outline-[length:var(--ui-focus-width,2px)] outline-solid -outline-offset-2 outline-transparent transition-[outline-color,color] duration-(--ui-duration-moderate) ease-carbon',\n                // hovered or dragged over: Carbon's focus outline; a design's line and fill (Kanok: a line on the highlight, no outline)\n                'hover:outline-[color:var(--ui-file-drop-hover-outline,var(--ui-focus))] hover:border-[color:var(--ui-file-drop-hover-border-color,var(--ui-hairline-strong))] hover:bg-[color:var(--ui-file-drop-hover-background,var(--ui-file-drop-background,transparent))]',\n                'hover:[text-decoration:var(--ui-file-drop-hover-decoration,underline)] focus-visible:underline focus-visible:outline-focus active:text-ink',\n                dragOver && 'outline-[color:var(--ui-file-drop-hover-outline,var(--ui-focus))] border-[color:var(--ui-file-drop-hover-border-color,var(--ui-hairline-strong))] bg-[color:var(--ui-file-drop-hover-background,var(--ui-file-drop-background,transparent))]',\n                'disabled:cursor-no-drop disabled:border-button-disabled disabled:bg-[color:var(--ui-file-drop-background,transparent)] disabled:text-ink-disabled disabled:no-underline disabled:outline-none',\n            )}\n        >\n            <span aria-hidden=\"true\" className=\"size-10 flex-none place-items-center rounded-full bg-[color:var(--ui-file-drop-icon-background,transparent)] [display:var(--ui-file-drop-icon-display,none)] [fill:var(--ui-file-drop-icon-color,currentColor)] in-disabled:[fill:var(--ui-ink-disabled)]\">\n                <svg viewBox=\"0 0 32 32\" className=\"size-5\">\n                    <path d=\"M6 18 7.41 19.41 15 11.83 15 30 17 30 17 11.83 24.59 19.41 26 18 16 8 6 18z\" />\n                    <path d=\"M6 8V4h20v4h2V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4z\" />\n                </svg>\n            </span>\n            <span>{dropLabel || t.dropHint}</span>\n        </FilePrimitive.Trigger>\n    ) : (\n        <FilePrimitive.Trigger\n            render={(props) => (\n                <Button {...props} kind={buttonKind} size={size}>\n                    {pickedLabel || buttonLabel || t.addFile}\n                </Button>\n            )}\n        />\n    );\n\n    return (\n        <div {...rest} className={cn('block w-full font-sans', className)}>\n            <FilePrimitive.Group aria-labelledby={labelTitle ? titleId : undefined}>\n                {labelTitle ? <FilePrimitive.Title className={cn('m-0 mb-2 text-ink type-body-emphasis leading-[18px]!', disabled && 'text-ink-disabled')}>{labelTitle}</FilePrimitive.Title> : null}\n                {labelDescription ? <p className={cn('m-0 mb-4 text-ink-muted type-body-sm leading-[18px]!', disabled && 'text-ink-disabled')}>{labelDescription}</p> : null}\n                <FilePrimitive.DropZone>\n                    {triggerElement}\n                    <FilePrimitive.Label className=\"sr-only\">{typeof labelTitle === 'string' && labelTitle ? labelTitle : buttonLabel || t.addFile}</FilePrimitive.Label>\n                    <FilePrimitive.Input className=\"sr-only\" />\n                    <FilePrimitive.FormValue />\n                </FilePrimitive.DropZone>\n            </FilePrimitive.Group>\n            {/* never hidden when empty, as <ui-file-uploader>'s (its slot keeps :empty from matching): the same margin below */}\n            <FilePrimitive.List className={drop ? 'mt-2' : 'mt-4'}>\n                {files.map((f) => (\n                    <FileUploaderItem\n                        key={f.uuid}\n                        uuid={f.uuid}\n                        name={f.name}\n                        status={f.status ?? status}\n                        size={size}\n                        invalid={!!f.invalid}\n                        errorSubject={f.errorSubject}\n                        errorBody={f.errorBody}\n                        iconLabel={iconLabel}\n                        disabled={disabled}\n                        progress={f.progress}\n                        retryable={!!f.retryable}\n                        fileSize={showSize ? f.file.size : undefined}\n                        lang={lang}\n                        onDelete={remove}\n                        onRetry={retry}\n                    />\n                ))}\n                {children}\n            </FilePrimitive.List>\n        </div>\n    );\n}\n\n/** Carbon `FileUploaderSkeleton`: a 100×24 title bar, a 225×16 description bar and a 150×48 button bar, 8px apart. Hidden from assistive tech. */\nexport function FileUploaderSkeleton({ className, ...rest }: Readonly<ComponentProps<'div'>>) {\n    return (\n        <div {...rest} aria-hidden=\"true\" className={cn('flex flex-col items-start gap-2', className)}>\n            <span className=\"skeleton block h-6 w-[100px]\" />\n            <span className=\"skeleton block h-4 w-[225px]\" />\n            <span className=\"skeleton block h-field-lg w-[150px]\" />\n        </div>\n    );\n}\n"
    }
  ]
}
