{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "file-transfer-list",
  "title": "File Transfer List",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/file-transfer-list/FileTransferList.tsx",
      "content": "import { Fragment } from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport { Progress } from '@/components/ui/progress'\nimport { Separator } from '@/components/ui/separator'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport type FileTransferState =\n  | { kind: 'active'; progress?: number }\n  | { kind: 'stopped' }\n  | { kind: 'failed'; reason?: string }\n  | { kind: 'completed' }\n\nexport interface FileTransfer {\n  id: string\n  name: string\n  direction: 'upload' | 'download'\n  detail?: string\n  /** Active progress is a fraction from 0 to 1. Omit it for unknown progress. */\n  state: FileTransferState\n}\n\nconst uploadLabels = { active: 'Uploading', stopped: 'Upload stopped', failed: 'Upload failed', completed: 'Uploaded' }\nconst downloadLabels = {\n  active: 'Downloading',\n  stopped: 'Download stopped',\n  failed: 'Download failed',\n  completed: 'Downloaded',\n}\nconst percent = new Intl.NumberFormat(undefined, { style: 'percent', maximumFractionDigits: 0 })\n\nexport interface FileTransferListProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  title?: string\n  /** Bounded caller-owned transfer rows with unique, nonempty IDs. */\n  transfers?: readonly FileTransfer[]\n  onCancel?: (id: string) => void\n  onRetry?: (id: string) => void\n  labels?: {\n    upload?: Partial<typeof uploadLabels>\n    download?: Partial<typeof downloadLabels>\n    empty?: string\n    cancel?: string\n    retry?: string\n  }\n}\n\nexport function FileTransferList({\n  className,\n  title = 'File transfers',\n  transfers = [],\n  onCancel,\n  onRetry,\n  labels,\n  ...props\n}: FileTransferListProps) {\n  const cancel = labels?.cancel ?? 'Cancel'\n  const retry = labels?.retry ?? 'Retry'\n\n  return (\n    <View {...props} className={cn('gap-[16px]', className)}>\n      <Text size=\"title\" accessibilityRole=\"header\">\n        {title}\n      </Text>\n      {transfers.length ? (\n        <View className=\"overflow-hidden rounded-lg border border-border bg-card\">\n          {transfers.map(({ id, name, direction, detail, state }, index) => {\n            const fallback = direction === 'upload' ? uploadLabels : downloadLabels\n            const status = labels?.[direction]?.[state.kind] ?? fallback[state.kind]\n            const fraction = state.kind === 'active' ? state.progress : undefined\n            const percentage =\n              fraction !== undefined && Number.isFinite(fraction) && fraction >= 0 && fraction <= 1\n                ? fraction === 1\n                  ? 100\n                  : Math.min(99, Math.round(fraction * 100))\n                : undefined\n            const action =\n              state.kind === 'active' && onCancel\n                ? { label: cancel, invoke: onCancel }\n                : (state.kind === 'stopped' || state.kind === 'failed') && onRetry\n                  ? { label: retry, invoke: onRetry }\n                  : undefined\n\n            return (\n              <Fragment key={id}>\n                {index > 0 ? <Separator /> : null}\n                <View className=\"gap-[8px] px-[16px] py-[12px]\">\n                  <View className=\"gap-[4px]\">\n                    <Text className=\"font-semibold text-card-foreground\">{name}</Text>\n                    {detail ? (\n                      <Text size=\"sm\" variant=\"muted\">\n                        {detail}\n                      </Text>\n                    ) : null}\n                    <View className=\"flex-row flex-wrap items-baseline justify-between gap-x-[12px]\">\n                      <Text\n                        size=\"sm\"\n                        variant=\"muted\"\n                        className={cn('shrink', state.kind === 'failed' && 'text-destructive')}\n                      >\n                        {status}\n                      </Text>\n                      {percentage !== undefined ? (\n                        <Text size=\"sm\" aria-hidden style={{ fontVariant: ['tabular-nums'] }}>\n                          {percent.format(percentage / 100)}\n                        </Text>\n                      ) : null}\n                    </View>\n                    {state.kind === 'failed' && state.reason ? (\n                      <Text size=\"sm\" variant=\"muted\">\n                        {state.reason}\n                      </Text>\n                    ) : null}\n                  </View>\n                  {percentage !== undefined ? (\n                    <Progress\n                      accessible\n                      accessibilityState={{ busy: true }}\n                      accessibilityLabel={`${status}, ${name}`}\n                      value={percentage}\n                    />\n                  ) : null}\n                  {action ? (\n                    <View className=\"items-start\">\n                      <Button\n                        size=\"sm\"\n                        variant=\"outline\"\n                        accessibilityLabel={`${action.label}, ${name}`}\n                        onPress={() => action.invoke(id)}\n                      >\n                        {action.label}\n                      </Button>\n                    </View>\n                  ) : null}\n                </View>\n              </Fragment>\n            )\n          })}\n        </View>\n      ) : (\n        <Text variant=\"muted\">{labels?.empty ?? 'No file transfers.'}</Text>\n      )}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/file-transfer-list/FileTransferList.tsx"
    },
    {
      "path": "packages/registry-native/blocks/file-transfer-list/index.ts",
      "content": "export {\n  FileTransferList,\n  type FileTransfer,\n  type FileTransferListProps,\n  type FileTransferState,\n} from './FileTransferList'\n",
      "type": "registry:block",
      "target": "~/components/blocks/file-transfer-list/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/progress.json",
    "https://native.uipkge.dev/r/native/separator.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Upload and download state, caller-provided progress and context-appropriate retry or cancel actions.",
  "categories": [
    "files",
    "operations"
  ]
}