import * as React from 'react'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/accordion'; import { Alert, AlertDescription, AlertTitle } from '@/components/alert'; import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount } from '@/components/avatar'; import { Badge } from '@/components/badge'; import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from '@/components/breadcrumb'; import { Button } from '@/components/button'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/card'; import { Checkbox } from '@/components/checkbox'; import { Combobox } from '@/components/combobox'; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '@/components/command'; import { DataTable, type DataTableColumn } from '@/components/data-table'; import { DatePicker } from '@/components/date-picker'; import { Field, FieldDescription, FieldLabel } from '@/components/field'; import { Input } from '@/components/input'; import { InputNumber } from '@/components/input-number'; import { Label } from '@/components/label'; import { Pagination, PaginationContent, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from '@/components/pagination'; import { Progress, ProgressCircle } from '@/components/progress'; import { RadioGroup, RadioGroupItem } from '@/components/radio-group'; import { RangeSlider } from '@/components/range-slider'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/select'; import { Separator } from '@/components/separator'; import { Skeleton } from '@/components/skeleton'; import { Spinner } from '@/components/spinner'; import { Switch } from '@/components/switch'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/tabs'; import { Textarea } from '@/components/textarea'; import { Tree } from '@/components/tree'; import { TreeSelect } from '@/components/tree-select'; import { Upload, UploadDropzone } from '@/components/upload'; import { VirtualList } from '@/components/virtual-list'; /** * The shared composition table. * * Two suites walk exactly this list, and they fail in different directions: * * • `a11y.test.tsx` renders each case in jsdom and audits it with axe. * • `ssr.test.tsx` renders each case in a **node** environment, where there * is no `document` at all, to prove the kit survives server rendering. * * They share the table so a component cannot be added to one gate and quietly * miss the other — which is what happened before the SSR gate existed: every * component had an axe case and none had ever been rendered on a server. * * Every case is composed the way the docs show it — a control with its label, a * table with its header. Rendering a bare control instead would pass both audits * while proving nothing, because the failures these components can cause * (missing name, orphaned label, broken aria wiring) only appear in composition. */ type Row = { id: number; name: string; email: string }; const rows: Row[] = [ { id: 1, name: 'Ada Lovelace', email: 'ada@example.com' }, { id: 2, name: 'Grace Hopper', email: 'grace@example.com' }, ]; const columns: DataTableColumn[] = [ { key: 'name', title: 'Name', dataIndex: 'name', sortable: true }, { key: 'email', title: 'Email', dataIndex: 'email' }, ]; const treeData = [ { key: 'src', title: 'src', children: [{ key: 'button', title: 'button.tsx' }] }, { key: 'docs', title: 'docs' }, ]; /* TreeSelect keys its nodes by `value` — the option's identity, which is what the control reports — while Tree keys them by `key`. */ const treeSelectData = [ { value: 'src', title: 'src', children: [{ value: 'button', title: 'button.tsx' }] }, { value: 'docs', title: 'docs' }, ]; export const cases: Array<[string, React.ReactElement]> = [ ['accordion', ( Shipping Ships in two days. )], ['alert', ( Heads up Your trial ends soon. )], ['avatar', ( AL )], ['badge', New], ['breadcrumb', ( Home Settings )], ['button', (
)], ['card', ( Usage Last 30 days 1,204 requests )], ['checkbox', (
)], ['combobox', ( )], ['data-table', ], ['date-picker', ], ['field', ( Email We only use it for receipts. )], ['input-number', (
)], ['pagination', ( 1 2 )], ['progress', ], ['progress-circle', ], ['radio-group', (
)], ['range-slider', ], ['select', (
)], ['separator', (
Above Below
)], ['skeleton', ], ['spinner', ], ['switch', (
)], ['tabs', ( Account Billing Account settings Billing settings )], ['textarea', (