@rtkelly-labs/design-system 0.18.0 → 0.20.0
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.
- package/CHANGELOG.md +50 -0
- package/README.md +1 -1
- package/dist/components/BracketText.js +3 -2
- package/dist/components/BracketText.js.map +1 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +2 -1
- package/dist/components/Card.js.map +1 -1
- package/dist/components/DataTable.js +135 -52
- package/dist/components/DataTable.js.map +1 -1
- package/dist/components/Divider.js +21 -14
- package/dist/components/Divider.js.map +1 -1
- package/dist/components/InlineAction.js +58 -0
- package/dist/components/InlineAction.js.map +1 -0
- package/dist/components/PageTitle.js +5 -1
- package/dist/components/PageTitle.js.map +1 -1
- package/dist/components/ResourceState.js +55 -0
- package/dist/components/ResourceState.js.map +1 -0
- package/dist/components/SocialIcon.js.map +1 -1
- package/dist/components/StatCard.js +2 -2
- package/dist/components/StatCard.js.map +1 -1
- package/dist/components/StatusPage.js.map +1 -1
- package/dist/components/docs/figures/ActivityGrid.js.map +1 -1
- package/dist/components/docs/figures/ChangeSummary.js +68 -25
- package/dist/components/docs/figures/ChangeSummary.js.map +1 -1
- package/dist/components/docs/figures/DrawingSheet.js +4 -1
- package/dist/components/docs/figures/DrawingSheet.js.map +1 -1
- package/dist/components/docs/figures/FigureFrame.js.map +1 -1
- package/dist/components/docs/figures/FigureSurfaceContext.js +9 -0
- package/dist/components/docs/figures/FigureSurfaceContext.js.map +1 -0
- package/dist/components/docs/figures/IndexedSection.js +8 -2
- package/dist/components/docs/figures/IndexedSection.js.map +1 -1
- package/dist/components/docs/figures/index.js.map +1 -1
- package/dist/components/experiments/ExperimentsView.js.map +1 -1
- package/dist/components/marketing/FeatureGrid.js.map +1 -1
- package/dist/components/marketing/Hero.js +2 -2
- package/dist/components/marketing/Hero.js.map +1 -1
- package/dist/components/marketing/PricingGrid.js.map +1 -1
- package/dist/components/review/ChangeBar.js +29 -0
- package/dist/components/review/ChangeBar.js.map +1 -0
- package/dist/components/review/ChangeCount.js +27 -0
- package/dist/components/review/ChangeCount.js.map +1 -0
- package/dist/components/review/ChangeIndex.js +50 -0
- package/dist/components/review/ChangeIndex.js.map +1 -0
- package/dist/components/review/DeltaValue.js +87 -0
- package/dist/components/review/DeltaValue.js.map +1 -0
- package/dist/components/review/DiffView.js +115 -0
- package/dist/components/review/DiffView.js.map +1 -0
- package/dist/components/review/KeyedDiff.js +43 -0
- package/dist/components/review/KeyedDiff.js.map +1 -0
- package/dist/components/review/ProvenanceStrip.js +17 -0
- package/dist/components/review/ProvenanceStrip.js.map +1 -0
- package/dist/components/review/PullRequestPage.js +223 -0
- package/dist/components/review/PullRequestPage.js.map +1 -0
- package/dist/components/review/ReviewReportPage.js +111 -0
- package/dist/components/review/ReviewReportPage.js.map +1 -0
- package/dist/components/review/StatusMark.js +32 -0
- package/dist/components/review/StatusMark.js.map +1 -0
- package/dist/components/review/VerdictBand.js +45 -0
- package/dist/components/review/VerdictBand.js.map +1 -0
- package/dist/components/review/diff.js +53 -0
- package/dist/components/review/diff.js.map +1 -0
- package/dist/components/review/index.js +16 -0
- package/dist/components/review/index.js.map +1 -0
- package/dist/components/review/samples.js +235 -0
- package/dist/components/review/samples.js.map +1 -0
- package/dist/components/review/vocabulary.js +51 -0
- package/dist/components/review/vocabulary.js.map +1 -0
- package/dist/components/saas/SaasLandingPage.js +10 -2
- package/dist/components/saas/SaasLandingPage.js.map +1 -1
- package/dist/hooks/usePolledResource.js +98 -0
- package/dist/hooks/usePolledResource.js.map +1 -0
- package/dist/index.d.ts +908 -26
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/units.js +25 -0
- package/dist/lib/units.js.map +1 -0
- package/package.json +9 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/DataTable.tsx"],"sourcesContent":["'use client';\n\nimport {\n flexRender,\n getCoreRowModel,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n type ColumnDef,\n type SortingState,\n type Table as TanStackTable,\n} from '@tanstack/react-table';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport {\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { cn } from '../lib/recipe';\nimport { NerdIcon } from './NerdIcon';\nimport { Pagination } from './Pagination';\nimport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n type TableAppearance,\n type TableDensity,\n} from './Table';\n\n// Legacy column interface for backwards-compatibility\nexport interface Column<T> {\n header: string;\n accessor: keyof T | ((row: T) => ReactNode);\n className?: string;\n enableSorting?: boolean;\n sortValue?: (row: T) => any;\n /**\n * The column that names each row — a hostname, a branch. Its body cells\n * render as `<th scope=\"row\">`, so a screen reader announces the row by it\n * while moving across. On a TanStack `ColumnDef`, set `meta.rowHeader`.\n */\n rowHeader?: boolean;\n}\n\ninterface DataTableColumnMeta {\n className?: string;\n rowHeader?: boolean;\n}\n\n// What a press on a sort button does, keyed by the column's next order so the\n// description cannot disagree with the click.\nconst SORT_HINT = { asc: 'Sort ascending', desc: 'Sort descending' } as const;\n\n/** Virtualization geometry is runtime arithmetic; hoisted objects (the\n * `ATTACHED_STYLE` convention from CodeBlock) keep it off the inline-style\n * sites the contract counts. */\nconst SPACER_STYLE_BASE = { padding: 0, border: 0 } as const;\nfunction spacerStyle(height: number) {\n return { height, ...SPACER_STYLE_BASE };\n}\nfunction scrollBoxStyle(height: number) {\n return { height };\n}\n\n/**\n * Row virtualization is planned against a fixed row height rather than measured\n * rows: deterministic rendering is a contract here (docs/deterministic-rendering.md),\n * and a measured engine would make the snapshot of a 10k-row table depend on font\n * loading. Multi-line cell content is therefore clipped to `rowHeight`.\n */\nexport interface DataTableVirtualization {\n /**\n * Viewport height, in px, of the scroll box the table builds for itself.\n * Ignored when `scrollElementRef` is provided. Defaults to 480.\n */\n height?: number;\n /** Fixed row height, in px, the virtualizer plans against. Defaults to 44. */\n rowHeight?: number;\n /** Rows rendered beyond each edge of the viewport. Defaults to 8. */\n overscan?: number;\n /**\n * Scroll inside an existing scrollable element instead of building one. When\n * provided, no wrapper is rendered and this element owns both axes — and it\n * must be keyboard-reachable itself (`tabIndex={0}`), or the window cannot be\n * scrolled without a mouse.\n */\n scrollElementRef?: RefObject<HTMLElement | null>;\n}\n\ntype DataTableSharedProps<T> = {\n /**\n * `grid` keeps the framed default, `quiet` removes the full cell grid, and\n * `index` adds a keyline to row headers for catalog-style scanning.\n */\n appearance?: TableAppearance;\n /**\n * `comfortable` preserves the existing cell spacing. `compact` reduces it\n * for reference tables with many rows.\n */\n density?: TableDensity;\n /**\n * `index` is the row's position in `data`, not on screen, so a key built\n * from it follows its row through a sort rather than staying with the slot.\n */\n keyExtractor?: (row: T, index: number) => string | number;\n /**\n * What the table is a table of. Rendered as the `<caption>`, which is the\n * table's accessible name; a string caption also names the scroll regions.\n */\n caption?: ReactNode;\n emptyText?: string;\n className?: string;\n containerClassName?: string;\n /**\n * Window the body to the visible rows so a dataset of thousands renders as\n * many rows as fit, not as many as exist. `true` uses the defaults;\n * mutually exclusive with `pageSize`, which wins nothing — pagination is\n * simply not attached while virtualizing. The table still reports the whole\n * dataset to assistive tech, through `aria-rowcount` and `aria-rowindex`.\n */\n virtualize?: boolean | DataTableVirtualization;\n};\n\nexport type DataTableProps<T> = DataTableSharedProps<T> &\n (\n | {\n /** Pre-configured TanStack table instance */\n table: TanStackTable<T>;\n columns?: never;\n data?: never;\n }\n | {\n table?: never;\n /** Column definitions (either simple Column<T>[] or TanStack ColumnDef<T>[]) */\n columns: Column<T>[] | ColumnDef<T, any>[];\n data: T[];\n /** `false` turns sorting off for every column. Defaults to `true`. */\n enableSorting?: boolean;\n pageSize?: number;\n }\n );\n\n/**\n * A data table on `@tanstack/react-table`, with the semantics TanStack does not\n * supply written here: `scope` on every header, `aria-sort` on the sorted\n * column, a real sort button per sortable header, an optional `caption`, and a\n * true row count when the body is windowed.\n */\nexport function DataTable<T>({\n table: providedTable,\n columns,\n data,\n keyExtractor,\n caption,\n appearance = 'grid',\n density = 'comfortable',\n emptyText = 'No items found.',\n className = '',\n containerClassName = '',\n virtualize,\n ...rest\n}: DataTableProps<T>) {\n const [sorting, setSorting] = useState<SortingState>([]);\n const uid = useId();\n // Memoized (the exhaustive-deps rule's own suggestion): a caller passing a\n // fresh `virtualize={{ ... }}` literal must not churn the measure effect.\n const virtualization = useMemo(\n () => (virtualize ? (typeof virtualize === 'object' ? virtualize : {}) : undefined),\n [virtualize],\n );\n const {\n height = 480,\n rowHeight = density === 'compact' ? 36 : 44,\n overscan = 8,\n scrollElementRef,\n } = virtualization ?? {};\n const [globalFilter, setGlobalFilter] = useState('');\n\n // Normalize columns if legacy format is provided\n const tanstackColumns = useMemo<ColumnDef<T, any>[]>(() => {\n if (!columns) return [];\n\n return columns.map((col: any) => {\n // Check if it's already a TanStack ColumnDef\n if ('accessorKey' in col || 'accessorFn' in col || 'id' in col) {\n return col as ColumnDef<T, any>;\n }\n\n // Convert legacy Column<T> to ColumnDef<T>\n const legacy = col as Column<T>;\n return {\n id: typeof legacy.accessor === 'string' ? legacy.accessor : legacy.header,\n header: legacy.header,\n enableSorting: legacy.enableSorting ?? true,\n accessorFn: (row: T) => {\n if (legacy.sortValue) {\n return legacy.sortValue(row);\n }\n if (typeof legacy.accessor === 'function') {\n const res = legacy.accessor(row);\n if (res && typeof res === 'object' && 'props' in (res as any)) {\n const children = (res as any).props?.children;\n if (typeof children === 'string' || typeof children === 'number') {\n return children;\n }\n }\n return typeof res === 'string' || typeof res === 'number' ? res : '';\n }\n return row[legacy.accessor];\n },\n cell: (info: any) => {\n if (typeof legacy.accessor === 'function') {\n return legacy.accessor(info.row.original);\n }\n return info.getValue() as ReactNode;\n },\n meta: {\n className: legacy.className,\n rowHeader: legacy.rowHeader,\n },\n } as ColumnDef<T, any>;\n });\n }, [columns]);\n\n // `pageSize` used to switch the pagination model on and nothing else, so\n // TanStack's default of 10 applied whatever was asked for (#276). It is read\n // from the prop on every render, not handed to `initialState` once, so a\n // later change is honoured; only the page index is state. A new size starts\n // again at page one rather than stranding the reader past the last page.\n const paginated = !virtualization && 'pageSize' in rest && Boolean(rest.pageSize);\n const requestedPageSize = paginated ? (rest as { pageSize: number }).pageSize : 10;\n const [pageIndexState, setPageIndexState] = useState(0);\n const [pageSizeSeen, setPageSizeSeen] = useState(requestedPageSize);\n if (pageSizeSeen !== requestedPageSize) {\n setPageSizeSeen(requestedPageSize);\n setPageIndexState(0);\n }\n const pagination = { pageIndex: pageIndexState, pageSize: requestedPageSize };\n const defaultTable = useReactTable<T>({\n data: data || [],\n columns: tanstackColumns,\n state: {\n sorting,\n globalFilter,\n ...(paginated ? { pagination } : {}),\n },\n onPaginationChange: (updater) => {\n const next = typeof updater === 'function' ? updater(pagination) : updater;\n setPageIndexState(next.pageIndex);\n },\n enableSorting: 'enableSorting' in rest ? rest.enableSorting !== false : true,\n onSortingChange: setSorting,\n onGlobalFilterChange: setGlobalFilter,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getPaginationRowModel: paginated ? getPaginationRowModel() : undefined,\n });\n\n const activeTable = providedTable || defaultTable;\n const rows = activeTable.getRowModel().rows;\n const headerGroups = activeTable.getHeaderGroups();\n\n // A windowed body — virtualized, or one page of a paginated model — holds\n // fewer rows than the data, and a screen reader counts what it is given. So\n // the table states the real count and each row its real position, all from\n // one total. aria-rowcount counts every row, header rows included.\n const totalRows = activeTable.getRowCount();\n const windowed = Boolean(virtualization) || rows.length < totalRows;\n const { pageIndex, pageSize } = activeTable.getState().pagination;\n const pageOffset = virtualization\n ? 0\n : Math.min(pageIndex * pageSize, Math.max(0, totalRows - rows.length));\n\n const scrollRef = useRef<HTMLDivElement>(null);\n // The virtualizer measures from the top of the scroll element, which on a\n // table is the header's top-left — but rows begin below it. Measuring the\n // body's offset once (the header's height is static by recipe) removes the\n // scrollMargin error that would otherwise offset every window by ~46px.\n const [scrollMargin, setScrollMargin] = useState(0);\n useLayoutEffect(() => {\n if (!virtualization) return;\n const scrollEl = scrollElementRef?.current ?? scrollRef.current;\n const body = scrollEl?.querySelector('[data-slot=\"table-body\"]');\n if (!scrollEl || !body) return;\n setScrollMargin(\n body.getBoundingClientRect().top -\n scrollEl.getBoundingClientRect().top +\n scrollEl.scrollTop,\n );\n }, [virtualization, scrollElementRef, rows.length]);\n\n const virtualizer = useVirtualizer({\n count: virtualization ? rows.length : 0,\n estimateSize: () => rowHeight,\n overscan,\n getScrollElement: () => scrollElementRef?.current ?? scrollRef.current,\n scrollMargin,\n });\n\n const renderRow = (row: (typeof rows)[number], position: number) => {\n // `row.index`, not `position`: a key built from the on-screen position\n // would stay with the slot while the rows move through it on a sort.\n const rowKey = keyExtractor ? keyExtractor(row.original, row.index) : row.id;\n\n return (\n <TableRow\n key={rowKey}\n aria-rowindex={windowed ? headerGroups.length + pageOffset + position + 1 : undefined}\n data-state={row.getIsSelected() && 'selected'}\n >\n {row.getVisibleCells().map((cell) => {\n const meta = cell.column.columnDef.meta as DataTableColumnMeta | undefined;\n const content = flexRender(cell.column.columnDef.cell, cell.getContext());\n return meta?.rowHeader ? (\n <TableHead key={cell.id} scope=\"row\" className={meta.className}>\n {content}\n </TableHead>\n ) : (\n <TableCell key={cell.id} className={meta?.className}>\n {content}\n </TableCell>\n );\n })}\n </TableRow>\n );\n };\n\n const colSpan = activeTable.getAllLeafColumns().length || 1;\n\n const virtualItems = virtualization ? virtualizer.getVirtualItems() : [];\n // `getVirtualItems` positions are relative to the scroll element and already\n // include `scrollMargin`; the gaps are what remains of the total column\n // above the first rendered row and below the last.\n const firstItem = virtualItems[0];\n const lastItem = virtualItems[virtualItems.length - 1];\n const topGap = virtualization && firstItem ? firstItem.start - scrollMargin : 0;\n const bottomGap =\n virtualization && lastItem\n ? virtualizer.getTotalSize() - lastItem.end\n : 0;\n\n const regionLabel = typeof caption === 'string' ? caption : undefined;\n\n const table = (\n <Table\n className={className}\n label={regionLabel}\n appearance={appearance}\n density={density}\n aria-rowcount={windowed ? headerGroups.length + totalRows : undefined}\n containerClassName={\n virtualization && !scrollElementRef\n ? cn(containerClassName, 'border-0 overflow-x-visible')\n : containerClassName\n }\n >\n {caption != null && <TableCaption>{caption}</TableCaption>}\n <TableHeader>\n {headerGroups.map((headerGroup, groupIdx) => (\n <TableRow key={headerGroup.id} aria-rowindex={windowed ? groupIdx + 1 : undefined}>\n {headerGroup.headers.map((header, headerIdx) => {\n const canSort = !header.isPlaceholder && header.column.getCanSort();\n const isSorted = !header.isPlaceholder && header.column.getIsSorted();\n const meta = header.column.columnDef.meta as DataTableColumnMeta | undefined;\n // One header carries aria-sort at a time (ARIA 1.2); under a\n // multi-column sort it is the primary key's.\n const ariaSort =\n isSorted && header.column.getSortIndex() === 0\n ? isSorted === 'asc'\n ? 'ascending'\n : 'descending'\n : undefined;\n const next = canSort ? header.column.getNextSortingOrder() : false;\n const hintId = `${uid}-sort-${groupIdx}-${headerIdx}`;\n // The icon is decorative: the state it draws is aria-sort's.\n const label = header.isPlaceholder ? null : (\n <>\n <span aria-hidden=\"true\">[</span>\n <span>{flexRender(header.column.columnDef.header, header.getContext())}</span>\n {canSort && (\n <span aria-hidden=\"true\" className=\"inline-flex items-center\">\n <NerdIcon\n name={isSorted === 'asc' ? 'sort-asc' : isSorted === 'desc' ? 'sort-desc' : 'sort'}\n size=\"sm\"\n accent={isSorted ? 'primary' : 'muted'}\n />\n </span>\n )}\n <span aria-hidden=\"true\">]</span>\n </>\n );\n\n // A sortable header holds a native button, so sorting is\n // reachable by Tab and fired by Enter or Space. Its name is the\n // column's; what a press does is its description, which keeps\n // \"sort ascending\" out of the header name read before every\n // cell. `::after` stretches the hit area over the cell, as the\n // old whole-cell click had it.\n return (\n <TableHead\n key={header.id}\n colSpan={header.colSpan > 1 ? header.colSpan : undefined}\n // A group heading spanning several columns heads all of them;\n // `col`, the default, would tie it to the first one only.\n scope={header.colSpan > 1 && !header.isPlaceholder ? 'colgroup' : undefined}\n aria-sort={ariaSort}\n className={cn(\n canSort && 'relative cursor-pointer select-none hover:bg-surface-base transition-colors',\n meta?.className,\n )}\n >\n {canSort ? (\n <button\n type=\"button\"\n aria-describedby={hintId}\n onClick={header.column.getToggleSortingHandler()}\n className=\"inline-flex cursor-pointer items-center gap-1.5 uppercase after:absolute after:inset-0\"\n >\n {label}\n <span id={hintId} hidden>\n {next ? SORT_HINT[next] : 'Remove sort'}\n </span>\n </button>\n ) : (\n label && <span className=\"inline-flex items-center gap-1.5\">{label}</span>\n )}\n </TableHead>\n );\n })}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody>\n {rows.length === 0 ? (\n <TableRow>\n <TableCell\n colSpan={colSpan}\n className={cn(\n density === 'compact' ? 'px-3 py-4' : 'px-4 py-8',\n 'text-center text-content-muted font-mono',\n )}\n >\n > {emptyText}\n </TableCell>\n </TableRow>\n ) : virtualization ? (\n <>\n {topGap > 0 && <SpacerRow height={topGap} colSpan={colSpan} />}\n {virtualItems.map((item) => renderRow(rows[item.index], item.index))}\n {bottomGap > 0 && <SpacerRow height={bottomGap} colSpan={colSpan} />}\n </>\n ) : (\n rows.map((row, position) => renderRow(row, position))\n )}\n </TableBody>\n </Table>\n );\n\n // A paginated body needs a way to the other pages, or every row past the\n // first page is unreachable. It is the system's own `Pagination`, in its\n // callback mode, rather than a second pager written here. Only for the\n // table this component builds: a caller passing `table` owns its state.\n const pageCount = activeTable.getPageCount();\n if (paginated && !providedTable && pageCount > 1) {\n return (\n <div data-slot=\"datatable-paginated\" className=\"flex flex-col gap-4\">\n {table}\n <Pagination\n totalPages={pageCount}\n currentPage={pageIndex + 1}\n onPageChange={(page) => activeTable.setPageIndex(page - 1)}\n />\n </div>\n );\n }\n\n if (!virtualization || scrollElementRef) return table;\n\n return (\n <div\n ref={scrollRef}\n data-slot=\"table-virtual-scroll\"\n tabIndex={0}\n role=\"region\"\n aria-label={regionLabel ?? 'Table contents'}\n className=\"relative w-full overflow-y-auto\"\n style={scrollBoxStyle(height)}\n >\n {table}\n </div>\n );\n}\n\n/**\n * Splits the difference between a windowed tbody and the table's own grid:\n * the row contributes height, contributes nothing to column sizing, and is\n * hidden from assistive tech because the rows it stands in for are absent.\n */\nfunction SpacerRow({ height, colSpan }: { height: number; colSpan: number }) {\n return (\n <tr aria-hidden=\"true\">\n <td aria-hidden=\"true\" colSpan={colSpan} style={spacerStyle(height)} />\n </tr>\n );\n}\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAgSK,SA8DI,UA9DJ,KA8DI,YA9DJ;AAxQZ,IAAM,YAAY,EAAE,KAAK,kBAAkB,MAAM,kBAAkB;AAKnE,IAAM,oBAAoB,EAAE,SAAS,GAAG,QAAQ,EAAE;AAClD,SAAS,YAAY,QAAgB;AACnC,SAAO,EAAE,QAAQ,GAAG,kBAAkB;AACxC;AACA,SAAS,eAAe,QAAgB;AACtC,SAAO,EAAE,OAAO;AAClB;AAsFO,SAAS,UAAa;AAAA,EAC3B,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,qBAAqB;AAAA,EACrB;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,CAAC,SAAS,UAAU,IAAI,SAAuB,CAAC,CAAC;AACvD,QAAM,MAAM,MAAM;AAGlB,Q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AAK,KAAK,KAAK,GAAG,KAAK,KAAK,CAAC;AAAA,UAClE,YAAY,KAAK,oBAAC,aAAU,QAAQ,WAAW,SAAkB;AAAA,WACpE,IAEA,KAAK,IAAI,CAAC,KAAK,aAAa,UAAU,KAAK,QAAQ,CAAC,GAExD;AAAA;AAAA;AAAA,EACF;AAOF,QAAM,YAAY,YAAY,aAAa;AAC3C,MAAI,aAAa,CAAC,iBAAiB,YAAY,GAAG;AAChD,WACE,qBAAC,SAAI,aAAU,uBAAsB,WAAU,uBAC5C;AAAA;AAAA,MACD;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,aAAa,YAAY;AAAA,UACzB,cAAc,CAAC,SAAS,YAAY,aAAa,OAAO,CAAC;AAAA;AAAA,MAC3D;AAAA,OACF;AAAA,EAEJ;AAEA,MAAI,CAAC,kBAAkB,iBAAkB,QAAO;AAEhD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,aAAU;AAAA,MACV,UAAU;AAAA,MACV,MAAK;AAAA,MACL,cAAY,eAAe;AAAA,MAC3B,WAAU;AAAA,MACV,OAAO,eAAe,MAAM;AAAA,MAE3B;AAAA;AAAA,EACH;AAEJ;AAOA,SAAS,UAAU,EAAE,QAAQ,QAAQ,GAAwC;AAC3E,SACE,oBAAC,QAAG,eAAY,QACd,8BAAC,QAAG,eAAY,QAAO,SAAkB,OAAO,YAAY,MAAM,GAAG,GACvE;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/DataTable.tsx"],"sourcesContent":["'use client';\n\nimport {\n flexRender,\n getCoreRowModel,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n type ColumnDef,\n type SortingState,\n type Table as TanStackTable,\n} from '@tanstack/react-table';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport {\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { cn } from '../lib/recipe';\nimport { Checkbox } from './Checkbox';\nimport { NerdIcon } from './NerdIcon';\nimport { Pagination } from './Pagination';\nimport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n type TableAppearance,\n type TableDensity,\n} from './Table';\nimport { Tooltip } from './Tooltip';\n\n// Legacy column interface for backwards-compatibility\nexport interface Column<T> {\n header: string;\n accessor: keyof T | ((row: T) => ReactNode);\n className?: string;\n enableSorting?: boolean;\n sortValue?: (row: T) => any;\n /**\n * The column that names each row — a hostname, a branch. Its body cells\n * render as `<th scope=\"row\">`, so a screen reader announces the row by it\n * while moving across. On a TanStack `ColumnDef`, set `meta.rowHeader`.\n */\n rowHeader?: boolean;\n}\n\ninterface DataTableColumnMeta {\n className?: string;\n rowHeader?: boolean;\n}\n\n// What a press on a sort button does, keyed by the column's next order so the\n// description cannot disagree with the click.\nconst SORT_HINT = { asc: 'Sort ascending', desc: 'Sort descending' } as const;\n\n// A stable default, so an unselected table does not build a new Set per render.\nconst EMPTY_KEYS: ReadonlySet<string> = new Set();\n\n/** Virtualization geometry is runtime arithmetic; hoisted objects (the\n * `ATTACHED_STYLE` convention from CodeBlock) keep it off the inline-style\n * sites the contract counts. */\nconst SPACER_STYLE_BASE = { padding: 0, border: 0 } as const;\nfunction spacerStyle(height: number) {\n return { height, ...SPACER_STYLE_BASE };\n}\nfunction scrollBoxStyle(height: number) {\n return { height };\n}\n\n/**\n * Row virtualization is planned against a fixed row height rather than measured\n * rows: deterministic rendering is a contract here (docs/deterministic-rendering.md),\n * and a measured engine would make the snapshot of a 10k-row table depend on font\n * loading. Multi-line cell content is therefore clipped to `rowHeight`.\n */\nexport interface DataTableVirtualization {\n /**\n * Viewport height, in px, of the scroll box the table builds for itself.\n * Ignored when `scrollElementRef` is provided. Defaults to 480.\n */\n height?: number;\n /** Fixed row height, in px, the virtualizer plans against. Defaults to 44. */\n rowHeight?: number;\n /** Rows rendered beyond each edge of the viewport. Defaults to 8. */\n overscan?: number;\n /**\n * Scroll inside an existing scrollable element instead of building one. When\n * provided, no wrapper is rendered and this element owns both axes — and it\n * must be keyboard-reachable itself (`tabIndex={0}`), or the window cannot be\n * scrolled without a mouse.\n */\n scrollElementRef?: RefObject<HTMLElement | null>;\n}\n\nexport type DataTableSharedProps<T> = {\n /**\n * `grid` keeps the framed default, `quiet` removes the full cell grid, and\n * `index` adds a keyline to row headers for catalog-style scanning.\n */\n appearance?: TableAppearance;\n /**\n * `comfortable` preserves the existing cell spacing. `compact` reduces it\n * for reference tables with many rows.\n */\n density?: TableDensity;\n /**\n * `index` is the row's position in `data`, not on screen, so a key built\n * from it follows its row through a sort rather than staying with the slot.\n */\n keyExtractor?: (row: T, index: number) => string | number;\n /**\n * What the table is a table of. Rendered as the `<caption>`, which is the\n * table's accessible name; a string caption also names the scroll regions.\n */\n caption?: ReactNode;\n emptyText?: string;\n className?: string;\n containerClassName?: string;\n /**\n * Window the body to the visible rows so a dataset of thousands renders as\n * many rows as fit, not as many as exist. `true` uses the defaults;\n * mutually exclusive with `pageSize`, which wins nothing — pagination is\n * simply not attached while virtualizing. The table still reports the whole\n * dataset to assistive tech, through `aria-rowcount` and `aria-rowindex`.\n */\n virtualize?: boolean | DataTableVirtualization;\n /**\n * The keys of the selected rows, as `keyExtractor` produces them (numbers\n * are compared as strings). Controlled: the table never changes it, it\n * reports the next set through `onSelectionChange`. Because selection is\n * keyed rather than positional it survives a sort, a page change and a\n * windowed scroll. Without a `keyExtractor` the key is TanStack's row id,\n * which is the row's index in `data` and does not follow a row when\n * `data` changes — pass one.\n */\n selectedKeys?: ReadonlySet<string>;\n /**\n * Turns selection on: a leading column of checkboxes, one per row, and one\n * in the header. Called with the whole next selection on every toggle.\n * The set it reports holds only keys of rows that are still in the data\n * and still selectable, so a key whose row has gone, or has become\n * unselectable, drops out on the next change rather than lingering.\n */\n onSelectionChange?: (keys: Set<string>) => void;\n /**\n * Whether a row may be selected. `false` disables its checkbox; a string\n * disables it *and* says why, as the checkbox's accessible description and\n * as a tooltip on hover. Every row is selectable when omitted.\n */\n isRowSelectable?: (row: T) => boolean | string;\n /**\n * The accessible name of a row's checkbox. Defaults to \"Select\" followed by\n * the row-header column's value (`rowHeader` / `meta.rowHeader`), or by\n * the row's key when there is no row header — so mark a row header, or\n * pass this, or every checkbox is named by an id.\n */\n selectionLabel?: (row: T) => string;\n};\n\nexport type DataTableProps<T> = DataTableSharedProps<T> &\n (\n | {\n /** Pre-configured TanStack table instance */\n table: TanStackTable<T>;\n columns?: never;\n data?: never;\n }\n | {\n table?: never;\n /** Column definitions (either simple Column<T>[] or TanStack ColumnDef<T>[]) */\n columns: Column<T>[] | ColumnDef<T, any>[];\n data: T[];\n /** `false` turns sorting off for every column. Defaults to `true`. */\n enableSorting?: boolean;\n pageSize?: number;\n }\n );\n\n/**\n * A data table on `@tanstack/react-table`, with the semantics TanStack does not\n * supply written here: `scope` on every header, `aria-sort` on the sorted\n * column, a real sort button per sortable header, an optional `caption`, and a\n * true row count when the body is windowed.\n */\nexport function DataTable<T>({\n table: providedTable,\n columns,\n data,\n keyExtractor,\n caption,\n appearance = 'grid',\n density = 'comfortable',\n emptyText = 'No items found.',\n className = '',\n containerClassName = '',\n virtualize,\n selectedKeys = EMPTY_KEYS,\n onSelectionChange,\n isRowSelectable,\n selectionLabel,\n ...rest\n}: DataTableProps<T>) {\n const [sorting, setSorting] = useState<SortingState>([]);\n const uid = useId();\n // Memoized (the exhaustive-deps rule's own suggestion): a caller passing a\n // fresh `virtualize={{ ... }}` literal must not churn the measure effect.\n const virtualization = useMemo(\n () => (virtualize ? (typeof virtualize === 'object' ? virtualize : {}) : undefined),\n [virtualize],\n );\n const {\n height = 480,\n rowHeight = density === 'compact' ? 36 : 44,\n overscan = 8,\n scrollElementRef,\n } = virtualization ?? {};\n const [globalFilter, setGlobalFilter] = useState('');\n\n // Normalize columns if legacy format is provided\n const tanstackColumns = useMemo<ColumnDef<T, any>[]>(() => {\n if (!columns) return [];\n\n return columns.map((col: any) => {\n // Check if it's already a TanStack ColumnDef\n if ('accessorKey' in col || 'accessorFn' in col || 'id' in col) {\n return col as ColumnDef<T, any>;\n }\n\n // Convert legacy Column<T> to ColumnDef<T>\n const legacy = col as Column<T>;\n return {\n id: typeof legacy.accessor === 'string' ? legacy.accessor : legacy.header,\n header: legacy.header,\n enableSorting: legacy.enableSorting ?? true,\n accessorFn: (row: T) => {\n if (legacy.sortValue) {\n return legacy.sortValue(row);\n }\n if (typeof legacy.accessor === 'function') {\n const res = legacy.accessor(row);\n if (res && typeof res === 'object' && 'props' in (res as any)) {\n const children = (res as any).props?.children;\n if (typeof children === 'string' || typeof children === 'number') {\n return children;\n }\n }\n return typeof res === 'string' || typeof res === 'number' ? res : '';\n }\n return row[legacy.accessor];\n },\n cell: (info: any) => {\n if (typeof legacy.accessor === 'function') {\n return legacy.accessor(info.row.original);\n }\n return info.getValue() as ReactNode;\n },\n meta: {\n className: legacy.className,\n rowHeader: legacy.rowHeader,\n },\n } as ColumnDef<T, any>;\n });\n }, [columns]);\n\n // `pageSize` used to switch the pagination model on and nothing else, so\n // TanStack's default of 10 applied whatever was asked for (#276). It is read\n // from the prop on every render, not handed to `initialState` once, so a\n // later change is honoured; only the page index is state. A new size starts\n // again at page one rather than stranding the reader past the last page.\n const paginated = !virtualization && 'pageSize' in rest && Boolean(rest.pageSize);\n const requestedPageSize = paginated ? (rest as { pageSize: number }).pageSize : 10;\n const [pageIndexState, setPageIndexState] = useState(0);\n const [pageSizeSeen, setPageSizeSeen] = useState(requestedPageSize);\n if (pageSizeSeen !== requestedPageSize) {\n setPageSizeSeen(requestedPageSize);\n setPageIndexState(0);\n }\n const pagination = { pageIndex: pageIndexState, pageSize: requestedPageSize };\n const defaultTable = useReactTable<T>({\n data: data || [],\n columns: tanstackColumns,\n state: {\n sorting,\n globalFilter,\n ...(paginated ? { pagination } : {}),\n },\n onPaginationChange: (updater) => {\n const next = typeof updater === 'function' ? updater(pagination) : updater;\n setPageIndexState(next.pageIndex);\n },\n enableSorting: 'enableSorting' in rest ? rest.enableSorting !== false : true,\n onSortingChange: setSorting,\n onGlobalFilterChange: setGlobalFilter,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getPaginationRowModel: paginated ? getPaginationRowModel() : undefined,\n });\n\n const activeTable = providedTable || defaultTable;\n const rows = activeTable.getRowModel().rows;\n const headerGroups = activeTable.getHeaderGroups();\n\n // A windowed body — virtualized, or one page of a paginated model — holds\n // fewer rows than the data, and a screen reader counts what it is given. So\n // the table states the real count and each row its real position, all from\n // one total. aria-rowcount counts every row, header rows included.\n const totalRows = activeTable.getRowCount();\n const windowed = Boolean(virtualization) || rows.length < totalRows;\n const { pageIndex, pageSize } = activeTable.getState().pagination;\n const pageOffset = virtualization\n ? 0\n : Math.min(pageIndex * pageSize, Math.max(0, totalRows - rows.length));\n\n const scrollRef = useRef<HTMLDivElement>(null);\n // The virtualizer measures from the top of the scroll element, which on a\n // table is the header's top-left — but rows begin below it. Measuring the\n // body's offset once (the header's height is static by recipe) removes the\n // scrollMargin error that would otherwise offset every window by ~46px.\n const [scrollMargin, setScrollMargin] = useState(0);\n useLayoutEffect(() => {\n if (!virtualization) return;\n const scrollEl = scrollElementRef?.current ?? scrollRef.current;\n const body = scrollEl?.querySelector('[data-slot=\"table-body\"]');\n if (!scrollEl || !body) return;\n setScrollMargin(\n body.getBoundingClientRect().top -\n scrollEl.getBoundingClientRect().top +\n scrollEl.scrollTop,\n );\n }, [virtualization, scrollElementRef, rows.length]);\n\n const virtualizer = useVirtualizer({\n count: virtualization ? rows.length : 0,\n estimateSize: () => rowHeight,\n overscan,\n getScrollElement: () => scrollElementRef?.current ?? scrollRef.current,\n scrollMargin,\n });\n\n // `row.index`, not the on-screen position: a key built from the position\n // would stay with the slot while the rows move through it on a sort.\n const keyOf = (row: (typeof rows)[number]) =>\n String(keyExtractor ? keyExtractor(row.original, row.index) : row.id);\n\n // Selection is drawn outside TanStack's column model, so a caller's columns,\n // header groups and `table` instance are untouched by it.\n const selectable = Boolean(onSelectionChange);\n const rowSelectability = (row: (typeof rows)[number]) => {\n const verdict = isRowSelectable ? isRowSelectable(row.original) : true;\n return verdict === true\n ? { ok: true as const, reason: undefined }\n : { ok: false as const, reason: typeof verdict === 'string' && verdict ? verdict : undefined };\n };\n // Every report is pruned against the data as it is now — the core model,\n // so a row hidden by a filter keeps its selection, and its flat rows, so a\n // sub-row from `getSubRows` is as selectable as its parent.\n const report = (next: Set<string>) => {\n if (!onSelectionChange) return;\n const valid = new Set(\n activeTable\n .getCoreRowModel()\n .flatRows.filter((row) => rowSelectability(row).ok)\n .map(keyOf),\n );\n onSelectionChange(new Set([...next].filter((key) => valid.has(key))));\n };\n const rowHeaderColumn = activeTable\n .getAllLeafColumns()\n .find((column) => (column.columnDef.meta as DataTableColumnMeta | undefined)?.rowHeader);\n const labelOf = (row: (typeof rows)[number], key: string) => {\n if (selectionLabel) return selectionLabel(row.original);\n const name = rowHeaderColumn ? row.getValue(rowHeaderColumn.id) : undefined;\n return `Select ${typeof name === 'string' || typeof name === 'number' ? name : key}`;\n };\n\n // The header box acts on the rows the body holds: one page when paginated,\n // every row otherwise (a virtualized body holds all of them, windowed).\n // Selecting rows on pages the reader cannot see is how a bulk delete takes\n // more than was meant, so it is never done implicitly.\n const pageKeys = selectable ? rows.filter((row) => rowSelectability(row).ok).map(keyOf) : [];\n const pageSelected = pageKeys.filter((key) => selectedKeys.has(key)).length;\n const allLabel = rows.length < totalRows && !virtualization ? 'Select all rows on this page' : 'Select all rows';\n\n // A refused row's checkbox is disabled, and a disabled control takes no\n // focus — so the reason cannot live only in the tooltip. It is also the\n // checkbox's description, read wherever the checkbox is.\n const renderSelectCell = (row: (typeof rows)[number], rowKey: string, isSelected: boolean) => {\n const verdict = rowSelectability(row);\n const reasonId = `${uid}-why-${rowKey}`;\n const box = (\n <Checkbox\n aria-label={labelOf(row, rowKey)}\n aria-describedby={verdict.reason ? reasonId : undefined}\n checked={isSelected}\n disabled={!verdict.ok}\n onCheckedChange={(checked) => {\n const next = new Set(selectedKeys);\n if (checked) next.add(rowKey);\n else next.delete(rowKey);\n report(next);\n }}\n />\n );\n return (\n <TableCell data-slot=\"datatable-select\" className=\"w-0\">\n {verdict.reason ? (\n <>\n <Tooltip content={verdict.reason}>{box}</Tooltip>\n <span id={reasonId} hidden>\n {verdict.reason}\n </span>\n </>\n ) : (\n box\n )}\n </TableCell>\n );\n };\n\n const renderRow = (row: (typeof rows)[number], position: number) => {\n const rowKey = keyOf(row);\n const isSelected = selectable ? selectedKeys.has(rowKey) : row.getIsSelected();\n\n return (\n <TableRow\n key={rowKey}\n aria-rowindex={windowed ? headerGroups.length + pageOffset + position + 1 : undefined}\n data-state={isSelected ? 'selected' : undefined}\n >\n {selectable && renderSelectCell(row, rowKey, isSelected)}\n {row.getVisibleCells().map((cell) => {\n const meta = cell.column.columnDef.meta as DataTableColumnMeta | undefined;\n const content = flexRender(cell.column.columnDef.cell, cell.getContext());\n return meta?.rowHeader ? (\n <TableHead key={cell.id} scope=\"row\" className={meta.className}>\n {content}\n </TableHead>\n ) : (\n <TableCell key={cell.id} className={meta?.className}>\n {content}\n </TableCell>\n );\n })}\n </TableRow>\n );\n };\n\n const colSpan = activeTable.getAllLeafColumns().length + (selectable ? 1 : 0) || 1;\n\n const virtualItems = virtualization ? virtualizer.getVirtualItems() : [];\n // `getVirtualItems` positions are relative to the scroll element and already\n // include `scrollMargin`; the gaps are what remains of the total column\n // above the first rendered row and below the last.\n const firstItem = virtualItems[0];\n const lastItem = virtualItems[virtualItems.length - 1];\n const topGap = virtualization && firstItem ? firstItem.start - scrollMargin : 0;\n const bottomGap =\n virtualization && lastItem\n ? virtualizer.getTotalSize() - lastItem.end\n : 0;\n\n const regionLabel = typeof caption === 'string' ? caption : undefined;\n\n const table = (\n <Table\n className={className}\n label={regionLabel}\n appearance={appearance}\n density={density}\n aria-rowcount={windowed ? headerGroups.length + totalRows : undefined}\n containerClassName={\n virtualization && !scrollElementRef\n ? cn(containerClassName, 'border-0 overflow-x-visible')\n : containerClassName\n }\n >\n {caption != null && <TableCaption>{caption}</TableCaption>}\n <TableHeader>\n {headerGroups.map((headerGroup, groupIdx) => (\n <TableRow key={headerGroup.id} aria-rowindex={windowed ? groupIdx + 1 : undefined}>\n {selectable && groupIdx === 0 && (\n <TableHead\n data-slot=\"datatable-select-all\"\n rowSpan={headerGroups.length > 1 ? headerGroups.length : undefined}\n className=\"w-0\"\n >\n <Checkbox\n aria-label={allLabel}\n checked={pageKeys.length > 0 && pageSelected === pageKeys.length}\n indeterminate={pageSelected > 0 && pageSelected < pageKeys.length}\n disabled={pageKeys.length === 0}\n onCheckedChange={(checked) => {\n const next = new Set(selectedKeys);\n for (const key of pageKeys) {\n if (checked) next.add(key);\n else next.delete(key);\n }\n report(next);\n }}\n />\n </TableHead>\n )}\n {headerGroup.headers.map((header, headerIdx) => {\n const canSort = !header.isPlaceholder && header.column.getCanSort();\n const isSorted = !header.isPlaceholder && header.column.getIsSorted();\n const meta = header.column.columnDef.meta as DataTableColumnMeta | undefined;\n // One header carries aria-sort at a time (ARIA 1.2); under a\n // multi-column sort it is the primary key's.\n const ariaSort =\n isSorted && header.column.getSortIndex() === 0\n ? isSorted === 'asc'\n ? 'ascending'\n : 'descending'\n : undefined;\n const next = canSort ? header.column.getNextSortingOrder() : false;\n const hintId = `${uid}-sort-${groupIdx}-${headerIdx}`;\n // The icon is decorative: the state it draws is aria-sort's.\n const label = header.isPlaceholder ? null : (\n <>\n <span aria-hidden=\"true\">[</span>\n <span>{flexRender(header.column.columnDef.header, header.getContext())}</span>\n {canSort && (\n <span aria-hidden=\"true\" className=\"inline-flex items-center\">\n <NerdIcon\n name={isSorted === 'asc' ? 'sort-asc' : isSorted === 'desc' ? 'sort-desc' : 'sort'}\n size=\"sm\"\n accent={isSorted ? 'primary' : 'muted'}\n />\n </span>\n )}\n <span aria-hidden=\"true\">]</span>\n </>\n );\n\n // A sortable header holds a native button, so sorting is\n // reachable by Tab and fired by Enter or Space. Its name is the\n // column's; what a press does is its description, which keeps\n // \"sort ascending\" out of the header name read before every\n // cell. `::after` stretches the hit area over the cell, as the\n // old whole-cell click had it.\n return (\n <TableHead\n key={header.id}\n colSpan={header.colSpan > 1 ? header.colSpan : undefined}\n // A group heading spanning several columns heads all of them;\n // `col`, the default, would tie it to the first one only.\n scope={header.colSpan > 1 && !header.isPlaceholder ? 'colgroup' : undefined}\n aria-sort={ariaSort}\n className={cn(\n canSort && 'relative cursor-pointer select-none hover:bg-surface-base transition-colors',\n meta?.className,\n )}\n >\n {canSort ? (\n <button\n type=\"button\"\n aria-describedby={hintId}\n onClick={header.column.getToggleSortingHandler()}\n className=\"inline-flex cursor-pointer items-center gap-1.5 uppercase after:absolute after:inset-0\"\n >\n {label}\n <span id={hintId} hidden>\n {next ? SORT_HINT[next] : 'Remove sort'}\n </span>\n </button>\n ) : (\n label && <span className=\"inline-flex items-center gap-1.5\">{label}</span>\n )}\n </TableHead>\n );\n })}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody>\n {rows.length === 0 ? (\n <TableRow>\n <TableCell\n colSpan={colSpan}\n className={cn(\n density === 'compact' ? 'px-3 py-4' : 'px-4 py-8',\n 'text-center text-content-muted font-mono',\n )}\n >\n > {emptyText}\n </TableCell>\n </TableRow>\n ) : virtualization ? (\n <>\n {topGap > 0 && <SpacerRow height={topGap} colSpan={colSpan} />}\n {virtualItems.map((item) => renderRow(rows[item.index], item.index))}\n {bottomGap > 0 && <SpacerRow height={bottomGap} colSpan={colSpan} />}\n </>\n ) : (\n rows.map((row, position) => renderRow(row, position))\n )}\n </TableBody>\n </Table>\n );\n\n // A paginated body needs a way to the other pages, or every row past the\n // first page is unreachable. It is the system's own `Pagination`, in its\n // callback mode, rather than a second pager written here. Only for the\n // table this component builds: a caller passing `table` owns its state.\n const pageCount = activeTable.getPageCount();\n if (paginated && !providedTable && pageCount > 1) {\n return (\n <div data-slot=\"datatable-paginated\" className=\"flex flex-col gap-4\">\n {table}\n <Pagination\n totalPages={pageCount}\n currentPage={pageIndex + 1}\n onPageChange={(page) => activeTable.setPageIndex(page - 1)}\n />\n </div>\n );\n }\n\n if (!virtualization || scrollElementRef) return table;\n\n return (\n <div\n ref={scrollRef}\n data-slot=\"table-virtual-scroll\"\n tabIndex={0}\n role=\"region\"\n aria-label={regionLabel ?? 'Table contents'}\n className=\"relative w-full overflow-y-auto\"\n style={scrollBoxStyle(height)}\n >\n {table}\n </div>\n );\n}\n\n/**\n * Splits the difference between a windowed tbody and the table's own grid:\n * the row contributes height, contributes nothing to column sizing, and is\n * hidden from assistive tech because the rows it stands in for are absent.\n */\nfunction SpacerRow({ height, colSpan }: { height: number; colSpan: number }) {\n return (\n <tr aria-hidden=\"true\">\n <td aria-hidden=\"true\" colSpan={colSpan} style={spacerStyle(height)} />\n </tr>\n );\n}\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,eAAe;AA0WlB,SAgBI,UAhBJ,KAgBI,YAhBJ;AAlVN,IAAM,YAAY,EAAE,KAAK,kBAAkB,MAAM,kBAAkB;AAGnE,IAAM,aAAkC,oBAAI,IAAI;AAKhD,IAAM,oBAAoB,EAAE,SAAS,GAAG,QAAQ,EAAE;AAClD,SAAS,YAAY,QAAgB;AACnC,SAAO,EAAE,QAAQ,GAAG,kBAAkB;AACxC;AACA,SAAS,eAAe,QAAgB;AACtC,SAAO,EAAE,OAAO;AAClB;AAq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GAAwC;AAC3E,SACE,oBAAC,QAAG,eAAY,QACd,8BAAC,QAAG,eAAY,QAAO,SAAkB,OAAO,YAAY,MAAM,GAAG,GACvE;AAEJ;","names":[]}
|
|
@@ -4,11 +4,20 @@
|
|
|
4
4
|
import { LEVELS, DEFAULT_LEVEL } from "../theme/levels.js";
|
|
5
5
|
import { useOptionalTheme } from "./ThemeProvider.js";
|
|
6
6
|
import { cn } from "../lib/recipe.js";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
var DIVIDER_PATTERNS = {
|
|
9
9
|
dark: "//====================================================//",
|
|
10
10
|
light: "\xB7 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \u2500 \xB7"
|
|
11
11
|
};
|
|
12
|
+
var DIVIDER_MARKS = {
|
|
13
|
+
dark: { start: "//", fill: "=", end: "//" },
|
|
14
|
+
light: { start: "\xB7", fill: " \u2500", end: " \xB7" }
|
|
15
|
+
};
|
|
16
|
+
var FILL_WIDTH = {
|
|
17
|
+
dark: "[width:round(down,calc(100%_-_4*(1ch_+_0.2em)),calc(1ch_+_0.2em))]",
|
|
18
|
+
light: "[width:round(down,calc(100%_-_3*(1ch_+_0.2em)),calc(2*(1ch_+_0.2em)))]"
|
|
19
|
+
};
|
|
20
|
+
var FILL_REPEAT = 400;
|
|
12
21
|
var VARIANT_POLARITY = {
|
|
13
22
|
terminal: "dark",
|
|
14
23
|
pencil: "light"
|
|
@@ -21,21 +30,19 @@ var Divider = ({
|
|
|
21
30
|
}) => {
|
|
22
31
|
const theme = useOptionalTheme();
|
|
23
32
|
const polarity = variant === "auto" ? theme?.polarity ?? LEVELS[DEFAULT_LEVEL].polarity : VARIANT_POLARITY[variant];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
children: pattern ?? DIVIDER_PATTERNS[polarity]
|
|
35
|
-
}
|
|
36
|
-
);
|
|
33
|
+
const base = "font-mono text-accent-primary tracking-[0.2em] select-none my-6 overflow-hidden whitespace-nowrap";
|
|
34
|
+
if (pattern != null) {
|
|
35
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "divider", className: cn(base, className), "aria-hidden": "true", ...props, children: pattern });
|
|
36
|
+
}
|
|
37
|
+
const mark = DIVIDER_MARKS[polarity];
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "divider", className: cn(base, "flex", className), "aria-hidden": "true", ...props, children: [
|
|
39
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0", children: mark.start }),
|
|
40
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "divider-fill", className: cn("min-w-0 overflow-hidden", FILL_WIDTH[polarity]), children: mark.fill.repeat(FILL_REPEAT) }),
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0", children: mark.end })
|
|
42
|
+
] });
|
|
37
43
|
};
|
|
38
44
|
export {
|
|
45
|
+
DIVIDER_MARKS,
|
|
39
46
|
DIVIDER_PATTERNS,
|
|
40
47
|
Divider
|
|
41
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Divider.tsx"],"sourcesContent":["'use client';\n\nimport type React from 'react';\nimport { LEVELS, DEFAULT_LEVEL } from '../theme/levels';\nimport type { Polarity } from '../theme/levels';\nimport { useOptionalTheme } from './ThemeProvider';\nimport { cn } from '../lib/recipe';\n\n/**\n * A rule drawn in characters rather than pixels.\n *\n * The glyph is part of the design, and it is not the same glyph on every level.\n * The dark end of the ladder leans on terminal devices — scanlines, `>`\n * prompts, `//====//` rules. The light end is paper, where the equivalent\n * device is a hand-ruled pencil dash. Same component, same role, different\n * mark.\n *\n * ## Why this exists as its own component\n *\n * That behaviour used to live in the *consumer's* stylesheet, as\n * `.sketch .ascii-divider::after { content: \"· ─ ─ ·\" }` in the blog, overriding\n * a `::after` in the design system. Three things were wrong with that:\n *\n * - The design intent — \"this rule is drawn differently on paper\" — was\n * stated in a downstream repo, so the system did not actually own its own\n * divider.\n * - It keyed off `.sketch`, a level name that no longer exists. Anything\n * built that way silently stops matching when the ladder changes, because\n * a selector that matches nothing fails quietly.\n * - It forced the design system to keep a bare `.ascii-divider` class as a\n * styling hook purely so a pseudo-element had something to attach to,\n * which was the last hole in the styling-lives-in-TSX rule.\n *\n * Encoding it here closes all three: the mapping is a `Record<Polarity, …>`, so\n * it is exhaustive by type, and the glyph is real text rather than generated\n * content — which means it is selectable, searchable, and readable by a screen\n * reader if it ever needed to be (it is `aria-hidden`, being decoration).\n */\n\n/** Which mark to draw. `auto` follows the current level's polarity. */\nexport type DividerVariant = 'auto' | 'terminal' | 'pencil';\n\n/**\n * The mark each polarity draws.\n *\n * A `Record<Polarity, …>` rather than a conditional, for the same reason the\n * rest of the ladder is: a third polarity would be a compile error here rather\n * than a silent fallthrough.\n */\nexport const DIVIDER_PATTERNS: Readonly<Record<Polarity, string>> = {\n dark: '//====================================================//',\n light: '· ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ·',\n};\n\nconst VARIANT_POLARITY: Readonly<Record<Exclude<DividerVariant, 'auto'>, Polarity>> = {\n terminal: 'dark',\n pencil: 'light',\n};\n\nexport interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Which mark to draw. Defaults to `auto`, which follows the level's declared\n * polarity — terminal on `midnight`/`dim`, pencil on `bright`/`white`.\n */\n variant?: DividerVariant;\n /** An explicit mark, overriding both the variant and the level. */\n pattern?: string;\n}\n\nexport const Divider: React.FC<DividerProps> = ({\n variant = 'auto',\n pattern,\n className = '',\n ...props\n}) => {\n // Optional on purpose: a divider must still draw something sensible in a\n // story with no decorator, or under a consumer that sets `data-theme` on the\n // document and never mounts a provider.\n const theme = useOptionalTheme();\n const polarity =\n variant === 'auto'\n ? (theme?.polarity ?? LEVELS[DEFAULT_LEVEL].polarity)\n : VARIANT_POLARITY[variant];\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/Divider.tsx"],"sourcesContent":["'use client';\n\nimport type React from 'react';\nimport { LEVELS, DEFAULT_LEVEL } from '../theme/levels';\nimport type { Polarity } from '../theme/levels';\nimport { useOptionalTheme } from './ThemeProvider';\nimport { cn } from '../lib/recipe';\n\n/**\n * A rule drawn in characters rather than pixels.\n *\n * The glyph is part of the design, and it is not the same glyph on every level.\n * The dark end of the ladder leans on terminal devices — scanlines, `>`\n * prompts, `//====//` rules. The light end is paper, where the equivalent\n * device is a hand-ruled pencil dash. Same component, same role, different\n * mark.\n *\n * ## Why this exists as its own component\n *\n * That behaviour used to live in the *consumer's* stylesheet, as\n * `.sketch .ascii-divider::after { content: \"· ─ ─ ·\" }` in the blog, overriding\n * a `::after` in the design system. Three things were wrong with that:\n *\n * - The design intent — \"this rule is drawn differently on paper\" — was\n * stated in a downstream repo, so the system did not actually own its own\n * divider.\n * - It keyed off `.sketch`, a level name that no longer exists. Anything\n * built that way silently stops matching when the ladder changes, because\n * a selector that matches nothing fails quietly.\n * - It forced the design system to keep a bare `.ascii-divider` class as a\n * styling hook purely so a pseudo-element had something to attach to,\n * which was the last hole in the styling-lives-in-TSX rule.\n *\n * Encoding it here closes all three: the mapping is a `Record<Polarity, …>`, so\n * it is exhaustive by type, and the glyph is real text rather than generated\n * content — which means it is selectable, searchable, and readable by a screen\n * reader if it ever needed to be (it is `aria-hidden`, being decoration).\n */\n\n/** Which mark to draw. `auto` follows the current level's polarity. */\nexport type DividerVariant = 'auto' | 'terminal' | 'pencil';\n\n/**\n * The mark each polarity draws.\n *\n * A `Record<Polarity, …>` rather than a conditional, for the same reason the\n * rest of the ladder is: a third polarity would be a compile error here rather\n * than a silent fallthrough.\n */\nexport const DIVIDER_PATTERNS: Readonly<Record<Polarity, string>> = {\n dark: '//====================================================//',\n light: '· ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ·',\n};\n\n/**\n * The same marks, as a start cap, a repeating fill and an end cap, so a rule can run the full\n * width of its container instead of stopping where a fixed string happens to end.\n *\n * `step` is the fill unit's length in characters and `caps` the two caps' total; both feed the\n * width calculation below, so a mark changed here must change its numbers with it.\n */\nexport const DIVIDER_MARKS: Readonly<Record<Polarity, { start: string; fill: string; end: string }>> = {\n dark: { start: '//', fill: '=', end: '//' },\n light: { start: '·', fill: ' ─', end: ' ·' },\n};\n\n/**\n * The fill's width: the container less the caps, rounded **down to a whole fill unit**, so the\n * last glyph is never cut in half and the end cap sits flush against the fill. One character's\n * advance is `1ch` plus the `0.2em` tracking. CSS `round()` does the arithmetic with no script, so\n * the rule also fills a static `ds-report` page; a browser without `round()` drops the width and\n * the fill is simply clipped, which is how every divider behaved before.\n *\n * Written out per polarity, not built from the numbers: Tailwind reads class names from source\n * text, and a template literal emits no CSS.\n */\nconst FILL_WIDTH: Readonly<Record<Polarity, string>> = {\n dark: '[width:round(down,calc(100%_-_4*(1ch_+_0.2em)),calc(1ch_+_0.2em))]',\n light: '[width:round(down,calc(100%_-_3*(1ch_+_0.2em)),calc(2*(1ch_+_0.2em)))]',\n};\n\n/** Enough fill for a 4K-wide container; the width above trims it to the container. */\nconst FILL_REPEAT = 400;\n\nconst VARIANT_POLARITY: Readonly<Record<Exclude<DividerVariant, 'auto'>, Polarity>> = {\n terminal: 'dark',\n pencil: 'light',\n};\n\nexport interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Which mark to draw. Defaults to `auto`, which follows the level's declared\n * polarity — terminal on `midnight`/`dim`, pencil on `bright`/`white`.\n */\n variant?: DividerVariant;\n /** An explicit mark, overriding both the variant and the level. */\n pattern?: string;\n}\n\nexport const Divider: React.FC<DividerProps> = ({\n variant = 'auto',\n pattern,\n className = '',\n ...props\n}) => {\n // Optional on purpose: a divider must still draw something sensible in a\n // story with no decorator, or under a consumer that sets `data-theme` on the\n // document and never mounts a provider.\n const theme = useOptionalTheme();\n const polarity =\n variant === 'auto'\n ? (theme?.polarity ?? LEVELS[DEFAULT_LEVEL].polarity)\n : VARIANT_POLARITY[variant];\n\n const base = 'font-mono text-accent-primary tracking-[0.2em] select-none my-6 overflow-hidden whitespace-nowrap';\n\n // An explicit pattern is drawn as given and clipped, as it always was.\n if (pattern != null) {\n return (\n <div data-slot=\"divider\" className={cn(base, className)} aria-hidden=\"true\" {...props}>\n {pattern}\n </div>\n );\n }\n\n // Clipped, not truncated: an ellipsis on a rule reads as a broken string. The mark is\n // decoration, so `aria-hidden` keeps it out of the accessibility tree.\n const mark = DIVIDER_MARKS[polarity];\n return (\n <div data-slot=\"divider\" className={cn(base, 'flex', className)} aria-hidden=\"true\" {...props}>\n <span className=\"shrink-0\">{mark.start}</span>\n <span data-slot=\"divider-fill\" className={cn('min-w-0 overflow-hidden', FILL_WIDTH[polarity])}>\n {mark.fill.repeat(FILL_REPEAT)}\n </span>\n <span className=\"shrink-0\">{mark.end}</span>\n </div>\n );\n};\n"],"mappings":";;;AAGA,SAAS,QAAQ,qBAAqB;AAEtC,SAAS,wBAAwB;AACjC,SAAS,UAAU;AAiHb,cAUF,YAVE;AAtEC,IAAM,mBAAuD;AAAA,EAClE,MAAM;AAAA,EACN,OAAO;AACT;AASO,IAAM,gBAA0F;AAAA,EACrG,MAAM,EAAE,OAAO,MAAM,MAAM,KAAK,KAAK,KAAK;AAAA,EAC1C,OAAO,EAAE,OAAO,QAAK,MAAM,WAAM,KAAK,QAAK;AAC7C;AAYA,IAAM,aAAiD;AAAA,EACrD,MAAM;AAAA,EACN,OAAO;AACT;AAGA,IAAM,cAAc;AAEpB,IAAM,mBAAgF;AAAA,EACpF,UAAU;AAAA,EACV,QAAQ;AACV;AAYO,IAAM,UAAkC,CAAC;AAAA,EAC9C,UAAU;AAAA,EACV;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,MAAM;AAIJ,QAAM,QAAQ,iBAAiB;AAC/B,QAAM,WACJ,YAAY,SACP,OAAO,YAAY,OAAO,aAAa,EAAE,WAC1C,iBAAiB,OAAO;AAE9B,QAAM,OAAO;AAGb,MAAI,WAAW,MAAM;AACnB,WACE,oBAAC,SAAI,aAAU,WAAU,WAAW,GAAG,MAAM,SAAS,GAAG,eAAY,QAAQ,GAAG,OAC7E,mBACH;AAAA,EAEJ;AAIA,QAAM,OAAO,cAAc,QAAQ;AACnC,SACE,qBAAC,SAAI,aAAU,WAAU,WAAW,GAAG,MAAM,QAAQ,SAAS,GAAG,eAAY,QAAQ,GAAG,OACtF;AAAA,wBAAC,UAAK,WAAU,YAAY,eAAK,OAAM;AAAA,IACvC,oBAAC,UAAK,aAAU,gBAAe,WAAW,GAAG,2BAA2B,WAAW,QAAQ,CAAC,GACzF,eAAK,KAAK,OAAO,WAAW,GAC/B;AAAA,IACA,oBAAC,UAAK,WAAU,YAAY,eAAK,KAAI;AAAA,KACvC;AAEJ;","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/components/InlineAction.tsx
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { recipe } from "../lib/recipe.js";
|
|
4
|
+
import { SiteLink } from "./LinkProvider.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var inlineAction = recipe({
|
|
7
|
+
base: "cursor-pointer text-left underline underline-offset-2 disabled:cursor-not-allowed disabled:text-content-muted disabled:no-underline",
|
|
8
|
+
variants: {
|
|
9
|
+
tone: {
|
|
10
|
+
accent: "text-accent-primary decoration-1 not-disabled:hover:decoration-2",
|
|
11
|
+
quiet: "text-content-secondary decoration-dotted not-disabled:hover:text-content-primary not-disabled:hover:decoration-solid"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
tone: "accent"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var InlineAction = forwardRef(
|
|
19
|
+
function InlineAction2(props, ref) {
|
|
20
|
+
const { children, tone = "accent", className, ...rest } = props;
|
|
21
|
+
const classes = inlineAction({ tone, class: className });
|
|
22
|
+
if (typeof props.href === "string") {
|
|
23
|
+
const {
|
|
24
|
+
href,
|
|
25
|
+
disabled: _disabled,
|
|
26
|
+
...anchorProps
|
|
27
|
+
} = rest;
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
SiteLink,
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
href,
|
|
33
|
+
"data-slot": "inline-action",
|
|
34
|
+
...anchorProps,
|
|
35
|
+
className: classes,
|
|
36
|
+
children
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
const buttonProps = rest;
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
"data-slot": "inline-action",
|
|
46
|
+
ref,
|
|
47
|
+
...buttonProps,
|
|
48
|
+
className: classes,
|
|
49
|
+
children
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
InlineAction.displayName = "InlineAction";
|
|
55
|
+
export {
|
|
56
|
+
InlineAction
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=InlineAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/InlineAction.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type {\n AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n DetailedHTMLProps,\n ReactNode,\n Ref,\n} from 'react';\nimport { recipe } from '../lib/recipe';\nimport { SiteLink } from './LinkProvider';\n\nexport interface InlineActionOwnProps {\n /**\n * The words, in the case the surrounding text is written in. Unlike\n * `Button`'s label this is read as part of a sentence or a cell, so it is\n * not written in caps — `view output`, `retry`, `all alerts →`.\n */\n children: ReactNode;\n /**\n * How loudly it reads against the text around it. `accent` is the primary\n * accent ink with a solid underline — the one to reach for, and what a link\n * in a row of data looks like. `quiet` is secondary ink with a dotted\n * underline, for a housekeeping action beside the content it acts on —\n * `clear`, `reset`, `show all` — that should not compete with it.\n * Omitted, the tone is `accent`.\n */\n tone?: InlineActionTone;\n /**\n * Merged into the recipe's own classes. Reach for it to set the typeface or\n * size where the surrounding text does not — `font-mono` in a table of ids —\n * rather than to recolour it.\n */\n className?: string;\n}\n\n/** The inks an `InlineAction` may take. Named for emphasis, not for a hue. */\nexport type InlineActionTone = 'accent' | 'quiet';\n\n/**\n * The `<button>` form: an action on the current page. `href?: never` is what\n * lets the union below discriminate, exactly as it does on `Button`.\n */\nexport type InlineActionButtonProps = InlineActionOwnProps &\n Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, 'children'> & {\n href?: never;\n };\n\n/**\n * The `<a>` form: the same ink on something that navigates. Rendered through\n * `LinkProvider`, so an app's router handles an internal href.\n */\nexport type InlineActionLinkProps = InlineActionOwnProps &\n Omit<DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, 'children'> & {\n /**\n * Where it navigates — and the discriminant. Supplying it renders a link\n * through the `LinkProvider`'s component; omit it for anything that acts\n * on the current page.\n */\n href: string;\n /**\n * Not offered on the anchor form. `disabled` does nothing on an `<a>`, and\n * a link that cannot be followed is text, not a link.\n */\n disabled?: never;\n };\n\nexport type InlineActionProps = InlineActionButtonProps | InlineActionLinkProps;\n\n/**\n * No box, no padding, no case or weight of its own: the type is the\n * surrounding text's, so it sits in a sentence or a table cell without\n * changing the line. Preflight already gives a `<button>` the inherited font\n * and a transparent ground; this adds the underline that says it can be used.\n *\n * Hover is gated on `not-disabled:` so a disabled action does not respond to\n * the pointer; `not-disabled` rather than `enabled`, because `:enabled` matches\n * form elements only and the anchor form would lose its hover. The change is\n * instant, not animated: a colour change this small does not need easing, and\n * every animated property is one more thing `docs/deterministic-rendering.md`\n * has to switch off.\n *\n * Focus is the global `:focus-visible` outline, untouched — see\n * `src/focus-ring.test.ts`.\n */\nconst inlineAction = recipe({\n base:\n 'cursor-pointer text-left underline underline-offset-2 ' +\n 'disabled:cursor-not-allowed disabled:text-content-muted disabled:no-underline',\n variants: {\n tone: {\n accent: 'text-accent-primary decoration-1 not-disabled:hover:decoration-2',\n quiet:\n 'text-content-secondary decoration-dotted not-disabled:hover:text-content-primary ' +\n 'not-disabled:hover:decoration-solid',\n },\n },\n defaultVariants: {\n tone: 'accent',\n },\n});\n\n/**\n * An action that reads as a link: underlined text inside a sentence or a table\n * cell, with no box, padding or press of its own.\n *\n * `Button` is the control a screen is built around — bordered, filled, caps,\n * a 44px hit area. In a table row that is too much: one per row is a column of\n * buttons, and the row's data is lost behind them. This is the same decision\n * in the weight of the text around it, and like `Button` the element follows\n * the job rather than the look: without `href` it is a `<button type=\"button\">`\n * that runs `onClick`; with `href` it is a link, through `LinkProvider`.\n *\n * It takes the surrounding font and size, so it is mono in a mono cell and\n * prose in a paragraph; there is no `size`. An inline target is exempt from\n * the WCAG 2.5.8 target-size minimum because its size is set by the line it\n * sits in — which is also why it belongs inline, not standing on its own as a\n * page's action.\n *\n * ```tsx\n * <InlineAction onClick={() => openRun(run.id)}>view output</InlineAction>\n * <InlineAction href={`/runs/${run.id}`}>open run</InlineAction>\n * <InlineAction tone=\"quiet\" onClick={clear}>clear</InlineAction>\n * ```\n */\nexport const InlineAction = forwardRef<HTMLButtonElement | HTMLAnchorElement, InlineActionProps>(\n function InlineAction(props, ref) {\n const { children, tone = 'accent', className, ...rest } = props;\n const classes = inlineAction({ tone, class: className });\n\n if (typeof props.href === 'string') {\n const {\n href,\n disabled: _disabled,\n ...anchorProps\n } = rest as Omit<InlineActionLinkProps, keyof InlineActionOwnProps>;\n return (\n <SiteLink\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n data-slot=\"inline-action\"\n {...anchorProps}\n className={classes}\n >\n {children}\n </SiteLink>\n );\n }\n\n const buttonProps = rest as Omit<InlineActionButtonProps, keyof InlineActionOwnProps>;\n return (\n <button\n // A bare `<button>` inside a form is a submit button. This one acts on\n // its row, so it says so unless the caller asks for a submit.\n type=\"button\"\n data-slot=\"inline-action\"\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonProps}\n className={classes}\n >\n {children}\n </button>\n );\n },\n);\n\nInlineAction.displayName = 'InlineAction';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAQ3B,SAAS,cAAc;AACvB,SAAS,gBAAgB;AA+HjB;AApDR,IAAM,eAAe,OAAO;AAAA,EAC1B,MACE;AAAA,EAEF,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,QAAQ;AAAA,MACR,OACE;AAAA,IAEJ;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;AAyBM,IAAM,eAAe;AAAA,EAC1B,SAASA,cAAa,OAAO,KAAK;AAChC,UAAM,EAAE,UAAU,OAAO,UAAU,WAAW,GAAG,KAAK,IAAI;AAC1D,UAAM,UAAU,aAAa,EAAE,MAAM,OAAO,UAAU,CAAC;AAEvD,QAAI,OAAO,MAAM,SAAS,UAAU;AAClC,YAAM;AAAA,QACJ;AAAA,QACA,UAAU;AAAA,QACV,GAAG;AAAA,MACL,IAAI;AACJ,aACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,aAAU;AAAA,UACT,GAAG;AAAA,UACJ,WAAW;AAAA,UAEV;AAAA;AAAA,MACH;AAAA,IAEJ;AAEA,UAAM,cAAc;AACpB,WACE;AAAA,MAAC;AAAA;AAAA,QAGC,MAAK;AAAA,QACL,aAAU;AAAA,QACV;AAAA,QACC,GAAG;AAAA,QACJ,WAAW;AAAA,QAEV;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;","names":["InlineAction"]}
|
|
@@ -6,10 +6,14 @@ function PageTitle({
|
|
|
6
6
|
children,
|
|
7
7
|
subtitle,
|
|
8
8
|
bracketed = true,
|
|
9
|
+
framed = true,
|
|
9
10
|
className = "",
|
|
10
11
|
...props
|
|
11
12
|
}) {
|
|
12
|
-
const baseClasses =
|
|
13
|
+
const baseClasses = cn(
|
|
14
|
+
"text-3xl font-display font-bold leading-tight tracking-tight text-[var(--ds-text-primary)] uppercase text-balance sm:text-4xl md:text-5xl inline-block",
|
|
15
|
+
framed ? "border-4 border-double border-[var(--ds-border-strong)] px-6 py-4" : "py-2"
|
|
16
|
+
);
|
|
13
17
|
return /* @__PURE__ */ jsxs("div", { "data-slot": "page-title", className: "mb-8", children: [
|
|
14
18
|
/* @__PURE__ */ jsx("h1", { className: cn(baseClasses, className), ...props, children: bracketed ? /* @__PURE__ */ jsx(BracketText, { children }) : children }),
|
|
15
19
|
subtitle && /* @__PURE__ */ jsx("p", { className: "mt-2 font-mono text-sm text-accent-primary", children: subtitle })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/PageTitle.tsx"],"sourcesContent":["import type { ReactNode, HTMLAttributes } from 'react';\nimport { BracketText } from './BracketText';\nimport { cn } from '../lib/recipe';\n\nexport interface PageTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n children: ReactNode;\n subtitle?: string;\n bracketed?: boolean;\n className?: string;\n}\n\nexport function PageTitle({\n children,\n subtitle,\n bracketed = true,\n className = '',\n ...props\n}: PageTitleProps) {\n const baseClasses
|
|
1
|
+
{"version":3,"sources":["../../src/components/PageTitle.tsx"],"sourcesContent":["import type { ReactNode, HTMLAttributes } from 'react';\nimport { BracketText } from './BracketText';\nimport { cn } from '../lib/recipe';\n\nexport interface PageTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n children: ReactNode;\n subtitle?: string;\n bracketed?: boolean;\n /**\n * Draw the title in its double-ruled box. `true` by default. Set `false` where something else\n * on the page is the heavy object — a hero whose demo leads, for instance — so the title does\n * not compete with it. See `docs/edge-hierarchy.md`.\n */\n framed?: boolean;\n className?: string;\n}\n\nexport function PageTitle({\n children,\n subtitle,\n bracketed = true,\n framed = true,\n className = '',\n ...props\n}: PageTitleProps) {\n const baseClasses = cn(\n 'text-3xl font-display font-bold leading-tight tracking-tight text-[var(--ds-text-primary)] uppercase text-balance sm:text-4xl md:text-5xl inline-block',\n framed ? 'border-4 border-double border-[var(--ds-border-strong)] px-6 py-4' : 'py-2',\n );\n\n return (\n <div data-slot=\"page-title\" className=\"mb-8\">\n <h1 className={cn(baseClasses, className)} {...props}>\n {bracketed ? <BracketText>{children}</BracketText> : children}\n </h1>\n {subtitle && (\n <p className=\"mt-2 font-mono text-sm text-accent-primary\">\n {subtitle}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AA6Bf,SAEiB,KAFjB;AAdG,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,GAAG;AACL,GAAmB;AACjB,QAAM,cAAc;AAAA,IAClB;AAAA,IACA,SAAS,sEAAsE;AAAA,EACjF;AAEA,SACE,qBAAC,SAAI,aAAU,cAAa,WAAU,QACpC;AAAA,wBAAC,QAAG,WAAW,GAAG,aAAa,SAAS,GAAI,GAAG,OAC5C,sBAAY,oBAAC,eAAa,UAAS,IAAiB,UACvD;AAAA,IACC,YACC,oBAAC,OAAE,WAAU,8CACV,oBACH;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/components/ResourceState.tsx
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { recipe } from "../lib/recipe.js";
|
|
4
|
+
import { NoteBlock } from "./NoteBlock.js";
|
|
5
|
+
import { Skeleton } from "./Skeleton.js";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
function resourceStatus({ data, error }) {
|
|
8
|
+
if (data === void 0) return error !== void 0 ? "failed" : "loading";
|
|
9
|
+
return error !== void 0 ? "stale" : "ready";
|
|
10
|
+
}
|
|
11
|
+
var resourceState = recipe({
|
|
12
|
+
slots: {
|
|
13
|
+
root: "block"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
function ResourceStateInner({
|
|
17
|
+
state,
|
|
18
|
+
children,
|
|
19
|
+
loading,
|
|
20
|
+
errorTitle = "Could not load",
|
|
21
|
+
staleTitle = "Showing the last good data",
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}, ref) {
|
|
25
|
+
const status = resourceStatus(state);
|
|
26
|
+
const busy = state.loading ?? status === "loading";
|
|
27
|
+
const styles = resourceState();
|
|
28
|
+
let body;
|
|
29
|
+
if (state.data === void 0) {
|
|
30
|
+
body = state.error !== void 0 ? /* @__PURE__ */ jsx(NoteBlock, { type: "warning", title: errorTitle, children: state.error }) : loading ?? /* @__PURE__ */ jsx(Skeleton, { shape: "block" });
|
|
31
|
+
} else {
|
|
32
|
+
body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
state.error !== void 0 ? /* @__PURE__ */ jsx(NoteBlock, { type: "important", title: staleTitle, children: state.error }) : null,
|
|
34
|
+
children(state.data)
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
"data-slot": "resource-state",
|
|
42
|
+
"data-state": status,
|
|
43
|
+
"aria-busy": busy,
|
|
44
|
+
...props,
|
|
45
|
+
className: styles.root({ class: className }),
|
|
46
|
+
children: body
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
var ResourceState = forwardRef(ResourceStateInner);
|
|
51
|
+
ResourceState.displayName = "ResourceState";
|
|
52
|
+
export {
|
|
53
|
+
ResourceState
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=ResourceState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ResourceState.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { ForwardedRef, HTMLAttributes, ReactElement, ReactNode, RefAttributes } from 'react';\nimport { recipe } from '../lib/recipe';\nimport { NoteBlock } from './NoteBlock';\nimport { Skeleton } from './Skeleton';\n\n/** Which of the four states a `ResourceState` is showing. */\nexport type ResourceStatus = 'loading' | 'failed' | 'stale' | 'ready';\n\n/**\n * What `ResourceState` reads. `usePolledResource`'s result fits as it is; so\n * does any `{ data, error }` from another loader.\n */\nexport interface ResourceStateValue<T> {\n /** The last good answer, or `undefined` before there is one. */\n data: T | undefined;\n /** Why the latest load failed, or `undefined` when it did not. */\n error: string | undefined;\n /** A load is in flight. Sets `aria-busy` on the region; absent reads as loading while there is no data. */\n loading?: boolean;\n}\n\nexport interface ResourceStateProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The resource to render — `usePolledResource`'s result, or any structurally compatible `{ data, error }`. */\n state: ResourceStateValue<T>;\n /** Renders the data once there is some. Called with the data, never with `undefined`. */\n children: (data: T) => ReactNode;\n /** Shown while there is no data and no error. Default one block `Skeleton`; pass the shape of the real content to keep the page still when it lands. */\n loading?: ReactNode;\n /** The warning title when the load failed and there is nothing to show. Default `Could not load`. */\n errorTitle?: string;\n /** The warning title above data kept from an earlier load after a later one failed. Default `Showing the last good data`. */\n staleTitle?: string;\n}\n\n/** Which state the region is in, from data first: data on screen is never hidden by a failure. */\nfunction resourceStatus({ data, error }: Pick<ResourceStateValue<unknown>, 'data' | 'error'>): ResourceStatus {\n if (data === undefined) return error !== undefined ? 'failed' : 'loading';\n return error !== undefined ? 'stale' : 'ready';\n}\n\nconst resourceState = recipe({\n slots: {\n root: 'block',\n },\n});\n\nfunction ResourceStateInner<T>(\n {\n state,\n children,\n loading,\n errorTitle = 'Could not load',\n staleTitle = 'Showing the last good data',\n className,\n ...props\n }: ResourceStateProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const status = resourceStatus(state);\n const busy = state.loading ?? status === 'loading';\n const styles = resourceState();\n let body: ReactNode;\n if (state.data === undefined) {\n body = state.error !== undefined ? (\n <NoteBlock type=\"warning\" title={errorTitle}>\n {state.error}\n </NoteBlock>\n ) : (\n (loading ?? <Skeleton shape=\"block\" />)\n );\n } else {\n body = (\n <>\n {state.error !== undefined ? (\n <NoteBlock type=\"important\" title={staleTitle}>\n {state.error}\n </NoteBlock>\n ) : null}\n {children(state.data)}\n </>\n );\n }\n return (\n <div\n ref={ref}\n data-slot=\"resource-state\"\n data-state={status}\n aria-busy={busy}\n {...props}\n className={styles.root({ class: className })}\n >\n {body}\n </div>\n );\n}\n\n/** `forwardRef` erases a generic; this restores it, so `children` is typed by `state`. */\nexport type ResourceStateComponent = (<T>(props: ResourceStateProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null) & {\n displayName?: string;\n};\n\n/**\n * The loading, failed and stale states around a view of loaded data, so every\n * panel says them the same way.\n *\n * - **Loading** — no data yet and no error: the `loading` slot, a `Skeleton`\n * unless overridden.\n * - **Failed** — no data and an error: a `NoteBlock` warning, in the danger\n * role, carrying the error message under `errorTitle`.\n * - **Stale** — data from an earlier load, and a later load failed: a\n * `NoteBlock` in the warning role, under `staleTitle`, then the data. The data\n * stays because an older answer is more use than none, and the note stays\n * because an older answer shown as current is a lie.\n * - **Ready** — data and no error: `children(data)`.\n *\n * The region carries `aria-busy` while a load is in flight and `data-state`\n * naming the state. Pair it with `usePolledResource`, and put a\n * `FreshnessIndicator` fed its `updatedAt` near the view, to say how old the\n * data on screen is as well as whether it is.\n */\nexport const ResourceState = forwardRef(ResourceStateInner) as ResourceStateComponent;\n\nResourceState.displayName = 'ResourceState';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AA6DnB,SAQA,UARA,KAQA,YARA;AA7BN,SAAS,eAAe,EAAE,MAAM,MAAM,GAAwE;AAC5G,MAAI,SAAS,OAAW,QAAO,UAAU,SAAY,WAAW;AAChE,SAAO,UAAU,SAAY,UAAU;AACzC;AAEA,IAAM,gBAAgB,OAAO;AAAA,EAC3B,OAAO;AAAA,IACL,MAAM;AAAA,EACR;AACF,CAAC;AAED,SAAS,mBACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,aAAa;AAAA,EACb;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,SAAS,eAAe,KAAK;AACnC,QAAM,OAAO,MAAM,WAAW,WAAW;AACzC,QAAM,SAAS,cAAc;AAC7B,MAAI;AACJ,MAAI,MAAM,SAAS,QAAW;AAC5B,WAAO,MAAM,UAAU,SACrB,oBAAC,aAAU,MAAK,WAAU,OAAO,YAC9B,gBAAM,OACT,IAEC,WAAW,oBAAC,YAAS,OAAM,SAAQ;AAAA,EAExC,OAAO;AACL,WACE,iCACG;AAAA,YAAM,UAAU,SACf,oBAAC,aAAU,MAAK,aAAY,OAAO,YAChC,gBAAM,OACT,IACE;AAAA,MACH,SAAS,MAAM,IAAI;AAAA,OACtB;AAAA,EAEJ;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,cAAY;AAAA,MACZ,aAAW;AAAA,MACV,GAAG;AAAA,MACJ,WAAW,OAAO,KAAK,EAAE,OAAO,UAAU,CAAC;AAAA,MAE1C;AAAA;AAAA,EACH;AAEJ;AA0BO,IAAM,gBAAgB,WAAW,kBAAkB;AAE1D,cAAc,cAAc;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/SocialIcon.tsx"],"sourcesContent":["import { forwardRef, type AnchorHTMLAttributes, type Ref, type SVGProps } from 'react';\nimport type { AccentToken } from '../lib/theme';\nimport { accentTextClass } from '../lib/accentClasses';\nimport { cn } from '../lib/recipe';\n\n/** Brand names supported by {@link SocialIcon}. */\nexport type SocialIconName = 'github' | 'linkedin' | 'bluesky' | 'x' | 'mail';\n\nconst LABELS: Record<SocialIconName, string> = {\n github: 'GitHub',\n linkedin: 'LinkedIn',\n bluesky: 'Bluesky',\n x: 'X',\n mail: 'Email',\n};\n\n/**\n * Paths are kept here rather than pulled from a second icon package. Social\n * marks are rendering primitives, and the design system owns their accessible\n * name, current-colour treatment, and link behaviour.\n */\nconst PATHS: Record<SocialIconName, string> = {\n github:\n 'M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.167 6.839 9.49.5.092.682-.217.682-.482 0-.237-.009-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.091-.647.35-1.087.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.682-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0 1 12 6.844a9.58 9.58 0 0 1 2.504.337c1.909-1.294 2.748-1.025 2.748-1.025.546 1.377.202 2.394.1 2.647.64.698 1.028 1.591 1.028 2.682 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.744 0 .267.18.578.688.48A10.003 10.003 0 0 0 22 12c0-5.523-4.477-10-10-10Z',\n linkedin:\n 'M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.35V8.999h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.602 0 4.267 2.37 4.267 5.455v6.287ZM5.337 7.433a2.062 2.062 0 1 1 0-4.124 2.062 2.062 0 0 1 0 4.124ZM7.119 20.452H3.555V8.999h3.564v11.453ZM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0Z',\n bluesky:\n 'M12 10.8C10.5 7.9 6.42 2.5 2.62 2.5 1.1 2.5.5 3.4.5 4.6c0 1.1.6 6.4 1 7.4.7 1.7 3.1 2.3 5.8 1.9-4.4.7-8.1 2.4-5.6 5.3 2.6 3 6.9-.7 10.3-3.6 3.4 2.9 7.7 6.6 10.3 3.6 2.5-2.9-1.2-4.6-5.6-5.3 2.7.4 5.1-.2 5.8-1.9.4-1 1-6.3 1-7.4 0-1.2-.6-2.1-2.12-2.1-3.8 0-7.88 5.4-9.38 8.3Z',\n x: 'M18.244 2.25h3.308l-7.227 8.26 8.502 11.24h-6.657l-5.214-6.817-5.965 6.817H1.681l7.73-8.835L1.255 2.25h6.826l4.713 6.231 5.45-6.231Zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77Z',\n mail: 'M2.5 4.5h19a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-19a1 1 0 0 1-1-1v-13a1 1 0 0 1 1-1Zm0 1.8v.35l9.5 6.1 9.5-6.1V6.3L12.54 12.4a1 1 0 0 1-1.08 0L2.5 6.3Zm19 11.4V8.8l-8.54 5.48a1.8 1.8 0 0 1-1.92 0L2.5 8.8v8.9h19Z',\n};\n\nexport interface SocialIconProps extends Omit<SVGProps<SVGSVGElement>, 'color'> {\n /** Brand mark to render. */\n name: SocialIconName;\n /** Semantic role used for the current-colour mark. */\n accent?: AccentToken;\n /** Accessible name. Defaults to the brand name. */\n label?: string;\n /** Optional destination. When set, the icon is wrapped in an anchor. */\n href?: string;\n /** Link target. `_blank` automatically receives a safe `rel` value. */\n target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];\n /** Explicit link relationship, overriding the `_blank` default. */\n rel?: string;\n}\n\n/**\n * Accessible brand SVG for estate social and contact links.\n *\n * Without `href` this is a labelled image. With `href` it becomes a labelled\n * link and the SVG is hidden from assistive technology to avoid two names.\n * All marks use semantic accent roles and `currentColor`, so both theme levels\n * resolve through the design-system token ladder.\n */\nexport const SocialIcon = forwardRef<SVGSVGElement | HTMLAnchorElement, SocialIconProps>(\n function SocialIcon(\n { name, accent = 'primary', label, href, target, rel, className, ...svgProps },\n ref,\n ) {\n const accessibleName = label ?? svgProps['aria-label'] ?? LABELS[name];\n const svg = (\n <svg\n {...svgProps}\n // The ref follows the rendered root only: inside an anchor the SVG is\n // decoration, and a callback ref fired on both would run element\n // setup/cleanup logic against the nested mark first.\n ref={href ? undefined : (ref as Ref<SVGSVGElement>)}\n data-slot=\"social-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden={href ? true : undefined}\n aria-label={href ? undefined : accessibleName}\n role={href ? undefined : 'img'}\n className={cn('inline-block size-5 shrink-0', accentTextClass(accent), className)}\n >\n <path d={PATHS[name]} />\n </svg>\n );\n\n if (!href) return svg;\n\n return (\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n aria-label={accessibleName}\n className=\"inline-flex items-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary\"\n >\n {svg}\n </a>\n );\n },\n);\n\nSocialIcon.displayName = 'SocialIcon';\n\
|
|
1
|
+
{"version":3,"sources":["../../src/components/SocialIcon.tsx"],"sourcesContent":["import { forwardRef, type AnchorHTMLAttributes, type Ref, type SVGProps } from 'react';\nimport type { AccentToken } from '../lib/theme';\nimport { accentTextClass } from '../lib/accentClasses';\nimport { cn } from '../lib/recipe';\n\n/** Brand names supported by {@link SocialIcon}. */\nexport type SocialIconName = 'github' | 'linkedin' | 'bluesky' | 'x' | 'mail';\n\nconst LABELS: Record<SocialIconName, string> = {\n github: 'GitHub',\n linkedin: 'LinkedIn',\n bluesky: 'Bluesky',\n x: 'X',\n mail: 'Email',\n};\n\n/**\n * Paths are kept here rather than pulled from a second icon package. Social\n * marks are rendering primitives, and the design system owns their accessible\n * name, current-colour treatment, and link behaviour.\n */\nconst PATHS: Record<SocialIconName, string> = {\n github:\n 'M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.167 6.839 9.49.5.092.682-.217.682-.482 0-.237-.009-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.091-.647.35-1.087.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.682-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0 1 12 6.844a9.58 9.58 0 0 1 2.504.337c1.909-1.294 2.748-1.025 2.748-1.025.546 1.377.202 2.394.1 2.647.64.698 1.028 1.591 1.028 2.682 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.744 0 .267.18.578.688.48A10.003 10.003 0 0 0 22 12c0-5.523-4.477-10-10-10Z',\n linkedin:\n 'M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.35V8.999h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.602 0 4.267 2.37 4.267 5.455v6.287ZM5.337 7.433a2.062 2.062 0 1 1 0-4.124 2.062 2.062 0 0 1 0 4.124ZM7.119 20.452H3.555V8.999h3.564v11.453ZM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0Z',\n bluesky:\n 'M12 10.8C10.5 7.9 6.42 2.5 2.62 2.5 1.1 2.5.5 3.4.5 4.6c0 1.1.6 6.4 1 7.4.7 1.7 3.1 2.3 5.8 1.9-4.4.7-8.1 2.4-5.6 5.3 2.6 3 6.9-.7 10.3-3.6 3.4 2.9 7.7 6.6 10.3 3.6 2.5-2.9-1.2-4.6-5.6-5.3 2.7.4 5.1-.2 5.8-1.9.4-1 1-6.3 1-7.4 0-1.2-.6-2.1-2.12-2.1-3.8 0-7.88 5.4-9.38 8.3Z',\n x: 'M18.244 2.25h3.308l-7.227 8.26 8.502 11.24h-6.657l-5.214-6.817-5.965 6.817H1.681l7.73-8.835L1.255 2.25h6.826l4.713 6.231 5.45-6.231Zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77Z',\n mail: 'M2.5 4.5h19a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-19a1 1 0 0 1-1-1v-13a1 1 0 0 1 1-1Zm0 1.8v.35l9.5 6.1 9.5-6.1V6.3L12.54 12.4a1 1 0 0 1-1.08 0L2.5 6.3Zm19 11.4V8.8l-8.54 5.48a1.8 1.8 0 0 1-1.92 0L2.5 8.8v8.9h19Z',\n};\n\nexport interface SocialIconProps extends Omit<SVGProps<SVGSVGElement>, 'color'> {\n /** Brand mark to render. */\n name: SocialIconName;\n /** Semantic role used for the current-colour mark. */\n accent?: AccentToken;\n /** Accessible name. Defaults to the brand name. */\n label?: string;\n /** Optional destination. When set, the icon is wrapped in an anchor. */\n href?: string;\n /** Link target. `_blank` automatically receives a safe `rel` value. */\n target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];\n /** Explicit link relationship, overriding the `_blank` default. */\n rel?: string;\n}\n\n/**\n * Accessible brand SVG for estate social and contact links.\n *\n * Without `href` this is a labelled image. With `href` it becomes a labelled\n * link and the SVG is hidden from assistive technology to avoid two names.\n * All marks use semantic accent roles and `currentColor`, so both theme levels\n * resolve through the design-system token ladder.\n */\nexport const SocialIcon = forwardRef<SVGSVGElement | HTMLAnchorElement, SocialIconProps>(\n function SocialIcon(\n { name, accent = 'primary', label, href, target, rel, className, ...svgProps },\n ref,\n ) {\n const accessibleName = label ?? svgProps['aria-label'] ?? LABELS[name];\n const svg = (\n <svg\n {...svgProps}\n // The ref follows the rendered root only: inside an anchor the SVG is\n // decoration, and a callback ref fired on both would run element\n // setup/cleanup logic against the nested mark first.\n ref={href ? undefined : (ref as Ref<SVGSVGElement>)}\n data-slot=\"social-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden={href ? true : undefined}\n aria-label={href ? undefined : accessibleName}\n role={href ? undefined : 'img'}\n className={cn('inline-block size-5 shrink-0', accentTextClass(accent), className)}\n >\n <path d={PATHS[name]} />\n </svg>\n );\n\n if (!href) return svg;\n\n return (\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n aria-label={accessibleName}\n className=\"inline-flex items-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary\"\n >\n {svg}\n </a>\n );\n },\n);\n\nSocialIcon.displayName = 'SocialIcon';\n\nexport type NamedSocialIconProps = Omit<SocialIconProps, 'name'>;\n\n/** GitHub brand mark. */\nexport function GitHubIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"github\" {...props} />;\n}\n\n/** LinkedIn brand mark. */\nexport function LinkedInIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"linkedin\" {...props} />;\n}\n\n/** Bluesky brand mark. */\nexport function BlueskyIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"bluesky\" {...props} />;\n}\n\n/** X brand mark. */\nexport function XIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"x\" {...props} />;\n}\n\n/** Email envelope mark. */\nexport function MailIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"mail\" {...props} />;\n}\n"],"mappings":";AAAA,SAAS,kBAAsE;AAE/E,SAAS,uBAAuB;AAChC,SAAS,UAAU;AAyEX;AApER,IAAM,SAAyC;AAAA,EAC7C,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,GAAG;AAAA,EACH,MAAM;AACR;AAOA,IAAM,QAAwC;AAAA,EAC5C,QACE;AAAA,EACF,UACE;AAAA,EACF,SACE;AAAA,EACF,GAAG;AAAA,EACH,MAAM;AACR;AAyBO,IAAM,aAAa;AAAA,EACx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
icon: Icon,
|
|
17
17
|
accent = "primary",
|
|
18
|
+
appearance = "boxed",
|
|
18
19
|
className
|
|
19
20
|
}) {
|
|
20
21
|
return /* @__PURE__ */ jsxs(
|
|
@@ -22,8 +23,7 @@ function StatCard({
|
|
|
22
23
|
{
|
|
23
24
|
"data-slot": "stat-card",
|
|
24
25
|
className: cn(
|
|
25
|
-
"bg-surface-raised border-2 border-edge-strong p-6 transition-all duration-200",
|
|
26
|
-
accentHoverEdgeClass(accent),
|
|
26
|
+
appearance === "boxed" ? ["bg-surface-raised border-2 border-edge-strong p-6 transition-all duration-200", accentHoverEdgeClass(accent)] : "border-l border-dashed border-edge-subtle px-6 py-4 first:border-l-0 first:pl-0",
|
|
27
27
|
className
|
|
28
28
|
),
|
|
29
29
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/StatCard.tsx"],"sourcesContent":["import type { ElementType } from 'react';\nimport { accentHoverEdgeClass, accentTextClass } from '../lib/accentClasses';\nimport { cn } from '../lib/recipe';\nimport type { AccentToken } from '../lib/theme';\n\n/**\n * Accepted accents. Widened from the four palette names to the full role set;\n * the old names still resolve to the same roles, so existing call sites keep\n * rendering identically.\n */\nexport type StatCardAccent = AccentToken;\n\nexport interface StatCardProps {\n title: string;\n value: string | number;\n change?: string;\n changeType?: 'positive' | 'negative' | 'neutral';\n subtitle?: string;\n icon?: ElementType<{ className?: string }>;\n accent?: StatCardAccent;\n className?: string;\n}\n\n/**\n * A change is meaning, not decoration, so it reads from the intent roles rather\n * than the card's accent — a card accented `danger` still shows a rise in the\n * success colour.\n */\nconst CHANGE_CLASS: Record<NonNullable<StatCardProps['changeType']>, string> = {\n positive: 'text-intent-success',\n negative: 'text-intent-danger',\n neutral: 'text-content-muted',\n};\n\nexport function StatCard({\n title,\n value,\n change,\n changeType = 'positive',\n subtitle,\n icon: Icon,\n accent = 'primary',\n className,\n}: StatCardProps) {\n return (\n <div data-slot=\"stat-card\"\n className={cn(\n 'bg-surface-raised border-2 border-edge-strong p-6 transition-all duration-200'
|
|
1
|
+
{"version":3,"sources":["../../src/components/StatCard.tsx"],"sourcesContent":["import type { ElementType } from 'react';\nimport { accentHoverEdgeClass, accentTextClass } from '../lib/accentClasses';\nimport { cn } from '../lib/recipe';\nimport type { AccentToken } from '../lib/theme';\n\n/**\n * Accepted accents. Widened from the four palette names to the full role set;\n * the old names still resolve to the same roles, so existing call sites keep\n * rendering identically.\n */\nexport type StatCardAccent = AccentToken;\n\n/**\n * `boxed` is the brand's 2px panel, for a figure that stands alone. `quiet` drops the box: a\n * figure in a row of figures, separated from its neighbour by a dashed hairline, so the row reads\n * as one strip rather than as one heavy object per number — see `docs/edge-hierarchy.md`.\n */\nexport type StatCardAppearance = 'boxed' | 'quiet';\n\nexport interface StatCardProps {\n title: string;\n value: string | number;\n change?: string;\n changeType?: 'positive' | 'negative' | 'neutral';\n subtitle?: string;\n icon?: ElementType<{ className?: string }>;\n accent?: StatCardAccent;\n /** `boxed` by default. `quiet` for a card in a row of cards. */\n appearance?: StatCardAppearance;\n className?: string;\n}\n\n/**\n * A change is meaning, not decoration, so it reads from the intent roles rather\n * than the card's accent — a card accented `danger` still shows a rise in the\n * success colour.\n */\nconst CHANGE_CLASS: Record<NonNullable<StatCardProps['changeType']>, string> = {\n positive: 'text-intent-success',\n negative: 'text-intent-danger',\n neutral: 'text-content-muted',\n};\n\nexport function StatCard({\n title,\n value,\n change,\n changeType = 'positive',\n subtitle,\n icon: Icon,\n accent = 'primary',\n appearance = 'boxed',\n className,\n}: StatCardProps) {\n return (\n <div data-slot=\"stat-card\"\n className={cn(\n appearance === 'boxed'\n ? ['bg-surface-raised border-2 border-edge-strong p-6 transition-all duration-200', accentHoverEdgeClass(accent)]\n : 'border-l border-dashed border-edge-subtle px-6 py-4 first:border-l-0 first:pl-0',\n className,\n )}\n >\n <div data-slot=\"statcard-header\" className=\"flex justify-between items-start mb-2\">\n <span data-slot=\"statcard-label\" className=\"font-mono text-xs font-bold uppercase tracking-wider text-content-muted\">\n [ {title} ]\n </span>\n {Icon && <Icon className={cn('h-6 w-6', accentTextClass(accent))} />}\n </div>\n <div data-slot=\"statcard-value-row\" className=\"flex items-baseline gap-3 my-1\">\n <span data-slot=\"statcard-value\" className=\"font-display text-4xl font-extrabold text-content-primary tracking-tight\">\n {value}\n </span>\n {change && (\n <span data-slot=\"statcard-change\" className={cn('font-mono text-xs font-bold', CHANGE_CLASS[changeType])}>\n {change}\n </span>\n )}\n </div>\n {subtitle && (\n <p data-slot=\"statcard-detail\" className=\"font-mono text-xs text-content-muted mt-2\">\n > {subtitle}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";AACA,SAAS,sBAAsB,uBAAuB;AACtD,SAAS,UAAU;AA8DX,SAGS,KAHT;AA3BR,IAAM,eAAyE;AAAA,EAC7E,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AACX;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb;AACF,GAAkB;AAChB,SACE;AAAA,IAAC;AAAA;AAAA,MAAI,aAAU;AAAA,MACb,WAAW;AAAA,QACT,eAAe,UACX,CAAC,iFAAiF,qBAAqB,MAAM,CAAC,IAC9G;AAAA,QACJ;AAAA,MACF;AAAA,MAEA;AAAA,6BAAC,SAAI,aAAU,mBAAkB,WAAU,yCACzC;AAAA,+BAAC,UAAK,aAAU,kBAAiB,WAAU,2EAA0E;AAAA;AAAA,YAChH;AAAA,YAAM;AAAA,aACX;AAAA,UACC,QAAQ,oBAAC,QAAK,WAAW,GAAG,WAAW,gBAAgB,MAAM,CAAC,GAAG;AAAA,WACpE;AAAA,QACA,qBAAC,SAAI,aAAU,sBAAqB,WAAU,kCAC5C;AAAA,8BAAC,UAAK,aAAU,kBAAiB,WAAU,4EACxC,iBACH;AAAA,UACC,UACC,oBAAC,UAAK,aAAU,mBAAkB,WAAW,GAAG,+BAA+B,aAAa,UAAU,CAAC,GACpG,kBACH;AAAA,WAEJ;AAAA,QACC,YACC,qBAAC,OAAE,aAAU,mBAAkB,WAAU,6CAA4C;AAAA;AAAA,UAC7E;AAAA,WACR;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/StatusPage.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode, Ref } from 'react';\nimport { recipe } from '../lib/recipe';\nimport { Button } from './Button';\nimport { EmptyState } from './EmptyState';\n\n/**\n * The page frame around an `EmptyState`, and nothing more.\n *\n * `standalone` is the one real variant: inside the site chrome the page is a\n * region of the consumer's `<main>`; outside it — a 500 served because the\n * shell itself failed, a maintenance page from the edge — it has to be the\n * `<main>` and fill the viewport on its own ground.\n *\n * The title is resized through its `data-slot` rather than a second recipe,\n * because it is `EmptyState`'s title: one element, sized for a page here.\n */\nconst statusPage = recipe({\n slots: {\n root: 'flex w-full justify-center px-4 py-16 md:py-24',\n state:\n 'w-full max-w-2xl '\n + '[&_[data-slot=empty-state-title]]:text-2xl md:[&_[data-slot=empty-state-title]]:text-3xl',\n /**\n * The status code: large, and in the muted role like `EmptyState`'s own\n * glyph, because the title carries the status in words and this only\n * repeats it. Large text is gated at 3:1, which muted clears on every Level.\n */\n code: 'font-display text-6xl font-black leading-none tracking-tight md:text-8xl',\n },\n variants: {\n standalone: {\n true: { root: 'min-h-dvh items-center bg-surface-base text-content-primary' },\n false: {},\n },\n },\n defaultVariants: { standalone: false },\n});\n\nexport interface StatusPageProps\n extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children' | 'className'> {\n /**\n * The page's `<h1>` — the status, in words: \"Page not found\", \"Down for\n * maintenance\". This is what a screen reader and a search result read, so it\n * must say the state on its own, without the `code` beside it.\n */\n title: string;\n /**\n * A short code shown large above the title — `404`, `503`. Rendered as text,\n * so it is read out before the heading. A decorative glyph can go here too;\n * give that node `aria-hidden` so it is not read as a word.\n */\n code?: ReactNode;\n /** What happened, and whether it is the reader's to fix. */\n description?: ReactNode;\n /**\n * The route back to somewhere useful — normally a `Button` with an `href`.\n * Links rather than handlers, so the way out works when the page is served\n * without its JavaScript.\n */\n action?: ReactNode;\n /** Anything else: a reference id to quote to support, a status-page link. */\n children?: ReactNode;\n /**\n * Render as the page's `<main>`, filling the viewport on `bg-surface-base`,\n * for a page served without the site chrome. Off by default, when the page is\n * placed inside the consumer's own `<main>` between `SiteHeader` and\n * `SiteFooter` and renders a plain `<div>`.\n */\n standalone?: boolean;\n /** Merged into the root's classes. */\n className?: string;\n}\n\n/**\n * A whole-page system state — not found, server error, maintenance, offline,\n * unauthorized — composed from `EmptyState`.\n *\n * It adds three things to the empty state and no more: the title becomes the\n * page's single `<h1>`, an optional status `code` sits above it, and the frame\n * either sits inside the site chrome or, with `standalone`, stands in for it.\n * `NotFoundPage` and `ServerErrorPage` are this with their copy filled in;\n * maintenance, offline and unauthorized pages are written with it directly,\n * because their copy is different on every product.\n *\n * @example\n * ```tsx\n * <StatusPage\n * standalone\n * code=\"503\"\n * title=\"Down for maintenance\"\n * description=\"Back by 09:00 UTC.\"\n * action={<Button href=\"https://status.example.com\">STATUS PAGE</Button>}\n * />\n * ```\n */\nexport const StatusPage = forwardRef<HTMLElement, StatusPageProps>(function StatusPage(\n { title, code, description, action, children, standalone = false, className, ...props },\n ref,\n) {\n const styles = statusPage({ standalone });\n const rootProps = {\n 'data-slot': 'status-page',\n ...props,\n className: styles.root({ class: className }),\n };\n const state = (\n <EmptyState\n className={styles.state()}\n headingLevel={1}\n icon={\n code ? (\n <p data-slot=\"status-page-code\" className={styles.code()}>\n {code}\n </p>\n ) : undefined\n }\n title={title}\n description={description}\n action={action}\n >\n {children}\n </EmptyState>\n );\n\n // Two elements, not an `as` prop: a `<main>` is a landmark with rules (one\n // per page), and the choice is the one thing `standalone` means.\n return standalone ? (\n <main ref={ref} {...rootProps}>\n {state}\n </main>\n ) : (\n <div ref={ref as Ref<HTMLDivElement>} {...rootProps}>\n {state}\n </div>\n );\n});\n\n/** Shared by the two presets: every `StatusPage` prop, with the copy optional. */\ninterface StatusPagePresetProps extends Omit<StatusPageProps, 'title'> {\n /** Where the default action goes. The site root, `/`, by default. */\n homeHref?: string;\n /** The default action's label. `GO HOME` by default. */\n homeLabel?: string;\n}\n\nfunction homeAction(homeHref: string, homeLabel: string) {\n return (\n <Button href={homeHref} variant=\"primary\" bracketed>\n {homeLabel}\n </Button>\n );\n}\n\nexport interface NotFoundPageProps extends StatusPagePresetProps {\n /** The page's `<h1>`. \"Page not found\" by default; `code` is `404`. */\n title?: string;\n}\n\n/**\n * The 404 page: `StatusPage` with the copy every site writes identically.\n *\n * Code `404`, the title \"Page not found\", a sentence that does not blame the\n * reader, and a link home. Every one of them is a prop, so a site that wants\n * search in the page or a different way out passes `action` or `children`\n * rather than rebuilding the page.\n *\n * @example\n * ```tsx\n * <main id=\"main-content\"><NotFoundPage /></main>\n * ```\n */\nexport const NotFoundPage = forwardRef<HTMLElement, NotFoundPageProps>(function NotFoundPage(\n {\n title = 'Page not found',\n code = '404',\n description = 'Nothing lives at this address. It may have moved, or the link that brought you here may be wrong.',\n homeHref = '/',\n homeLabel = 'GO HOME',\n action,\n ...props\n },\n ref,\n) {\n return (\n <StatusPage\n ref={ref}\n title={title}\n code={code}\n description={description}\n action={action ?? homeAction(homeHref, homeLabel)}\n {...props}\n />\n );\n});\n\nexport interface ServerErrorPageProps extends StatusPagePresetProps {\n /** The page's `<h1>`. \"Something went wrong\" by default; `code` is `500`. */\n title?: string;\n /**\n * `true` by default, unlike `StatusPage` and `NotFoundPage`. A 500 is usually\n * served because the application failed, and the shell that would frame it\n * may be what failed. Pass `standalone={false}` for an error the shell\n * survived, inside the consumer's own `<main>`.\n */\n standalone?: boolean;\n}\n\n/**\n * The 500 page: `StatusPage` with the copy every site writes identically.\n *\n * Code `500`, the title \"Something went wrong\", a sentence saying it is not\n * the reader's fault, and a link home. It is standalone by default, since the\n * page is usually served because the application failed and the shell that\n * would have framed it is what may not render. Pass `standalone={false}` to\n * place it inside the site chrome. A request or incident id to quote to\n * support belongs in `children`.\n *\n * @example\n * ```tsx\n * <ServerErrorPage>\n * <p>Reference: {requestId}</p>\n * </ServerErrorPage>\n * ```\n */\nexport const ServerErrorPage = forwardRef<HTMLElement, ServerErrorPageProps>(function ServerErrorPage(\n {\n title = 'Something went wrong',\n code = '500',\n description = 'The server hit an error it could not recover from. It is not something you did — try again in a moment.',\n homeHref = '/',\n homeLabel = 'GO HOME',\n action,\n standalone = true,\n ...props\n },\n ref,\n) {\n return (\n <StatusPage\n ref={ref}\n title={title}\n code={code}\n description={description}\n action={action ?? homeAction(homeHref, homeLabel)}\n standalone={standalone}\n {...props}\n />\n );\n});\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AA4GjB;AA/FV,IAAM,aAAa,OAAO;AAAA,EACxB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOF,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,YAAY;AAAA,MACV,MAAM,EAAE,MAAM,8DAA8D;AAAA,MAC5E,OAAO,CAAC;AAAA,IACV;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,YAAY,MAAM;AACvC,CAAC;AA2DM,IAAM,aAAa,WAAyC,SAASA,YAC1E,EAAE,OAAO,MAAM,aAAa,QAAQ,UAAU,aAAa,OAAO,WAAW,GAAG,MAAM,GACtF,KACA;AACA,QAAM,SAAS,WAAW,EAAE,WAAW,CAAC;AACxC,QAAM,YAAY;AAAA,IAChB,aAAa;AAAA,IACb,GAAG;AAAA,IACH,WAAW,OAAO,KAAK,EAAE,OAAO,UAAU,CAAC;AAAA,EAC7C;AACA,QAAM,QACJ;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,OAAO,MAAM;AAAA,MACxB,cAAc;AAAA,MACd,MACE,OACE,oBAAC,OAAE,aAAU,oBAAmB,WAAW,OAAO,KAAK,GACpD,gBACH,IACE;AAAA,MAEN;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAKF,SAAO,aACL,oBAAC,UAAK,KAAW,GAAG,WACjB,iBACH,IAEA,oBAAC,SAAI,KAAkC,GAAG,WACvC,iBACH;AAEJ,CAAC;AAUD,SAAS,WAAW,UAAkB,WAAmB;AACvD,SACE,oBAAC,UAAO,MAAM,UAAU,SAAQ,WAAU,WAAS,MAChD,qBACH;AAEJ;AAoBO,IAAM,eAAe,WAA2C,SAASC,cAC9E;AAAA,EACE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,UAAU,WAAW,UAAU,SAAS;AAAA,MAC/C,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AA+BM,IAAM,kBAAkB,WAA8C,SAASC,iBACpF;AAAA,EACE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AAAA,EACA,aAAa;AAAA,EACb,GAAG;AACL,GACA,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,UAAU,WAAW,UAAU,SAAS;AAAA,MAChD;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;","names":["StatusPage","NotFoundPage","ServerErrorPage"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/StatusPage.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode, Ref } from 'react';\nimport { recipe } from '../lib/recipe';\nimport { Button } from './Button';\nimport { EmptyState } from './EmptyState';\n\n/**\n * The page frame around an `EmptyState`, and nothing more.\n *\n * `standalone` is the one real variant: inside the site chrome the page is a\n * region of the consumer's `<main>`; outside it — a 500 served because the\n * shell itself failed, a maintenance page from the edge — it has to be the\n * `<main>` and fill the viewport on its own ground.\n *\n * The title is resized through its `data-slot` rather than a second recipe,\n * because it is `EmptyState`'s title: one element, sized for a page here.\n */\nconst statusPage = recipe({\n slots: {\n root: 'flex w-full justify-center px-4 py-16 md:py-24',\n state:\n 'w-full max-w-2xl '\n + '[&_[data-slot=empty-state-title]]:text-2xl md:[&_[data-slot=empty-state-title]]:text-3xl',\n /**\n * The status code: large, and in the muted role like `EmptyState`'s own\n * glyph, because the title carries the status in words and this only\n * repeats it. Large text is gated at 3:1, which muted clears on every Level.\n */\n code: 'font-display text-6xl font-black leading-none tracking-tight md:text-8xl',\n },\n variants: {\n standalone: {\n true: { root: 'min-h-dvh items-center bg-surface-base text-content-primary' },\n false: {},\n },\n },\n defaultVariants: { standalone: false },\n});\n\nexport interface StatusPageProps\n extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children' | 'className'> {\n /**\n * The page's `<h1>` — the status, in words: \"Page not found\", \"Down for\n * maintenance\". This is what a screen reader and a search result read, so it\n * must say the state on its own, without the `code` beside it.\n */\n title: string;\n /**\n * A short code shown large above the title — `404`, `503`. Rendered as text,\n * so it is read out before the heading. A decorative glyph can go here too;\n * give that node `aria-hidden` so it is not read as a word.\n */\n code?: ReactNode;\n /** What happened, and whether it is the reader's to fix. */\n description?: ReactNode;\n /**\n * The route back to somewhere useful — normally a `Button` with an `href`.\n * Links rather than handlers, so the way out works when the page is served\n * without its JavaScript.\n */\n action?: ReactNode;\n /** Anything else: a reference id to quote to support, a status-page link. */\n children?: ReactNode;\n /**\n * Render as the page's `<main>`, filling the viewport on `bg-surface-base`,\n * for a page served without the site chrome. Off by default, when the page is\n * placed inside the consumer's own `<main>` between `SiteHeader` and\n * `SiteFooter` and renders a plain `<div>`.\n */\n standalone?: boolean;\n /** Merged into the root's classes. */\n className?: string;\n}\n\n/**\n * A whole-page system state — not found, server error, maintenance, offline,\n * unauthorized — composed from `EmptyState`.\n *\n * It adds three things to the empty state and no more: the title becomes the\n * page's single `<h1>`, an optional status `code` sits above it, and the frame\n * either sits inside the site chrome or, with `standalone`, stands in for it.\n * `NotFoundPage` and `ServerErrorPage` are this with their copy filled in;\n * maintenance, offline and unauthorized pages are written with it directly,\n * because their copy is different on every product.\n *\n * @example\n * ```tsx\n * <StatusPage\n * standalone\n * code=\"503\"\n * title=\"Down for maintenance\"\n * description=\"Back by 09:00 UTC.\"\n * action={<Button href=\"https://status.example.com\">STATUS PAGE</Button>}\n * />\n * ```\n */\nexport const StatusPage = forwardRef<HTMLElement, StatusPageProps>(function StatusPage(\n { title, code, description, action, children, standalone = false, className, ...props },\n ref,\n) {\n const styles = statusPage({ standalone });\n const rootProps = {\n 'data-slot': 'status-page',\n ...props,\n className: styles.root({ class: className }),\n };\n const state = (\n <EmptyState\n className={styles.state()}\n headingLevel={1}\n icon={\n code ? (\n <p data-slot=\"status-page-code\" className={styles.code()}>\n {code}\n </p>\n ) : undefined\n }\n title={title}\n description={description}\n action={action}\n >\n {children}\n </EmptyState>\n );\n\n // Two elements, not an `as` prop: a `<main>` is a landmark with rules (one\n // per page), and the choice is the one thing `standalone` means.\n return standalone ? (\n <main ref={ref} {...rootProps}>\n {state}\n </main>\n ) : (\n <div ref={ref as Ref<HTMLDivElement>} {...rootProps}>\n {state}\n </div>\n );\n});\n\n/** Shared by the two presets: every `StatusPage` prop, with the copy optional. */\nexport interface StatusPagePresetProps extends Omit<StatusPageProps, 'title'> {\n /** Where the default action goes. The site root, `/`, by default. */\n homeHref?: string;\n /** The default action's label. `GO HOME` by default. */\n homeLabel?: string;\n}\n\nfunction homeAction(homeHref: string, homeLabel: string) {\n return (\n <Button href={homeHref} variant=\"primary\" bracketed>\n {homeLabel}\n </Button>\n );\n}\n\nexport interface NotFoundPageProps extends StatusPagePresetProps {\n /** The page's `<h1>`. \"Page not found\" by default; `code` is `404`. */\n title?: string;\n}\n\n/**\n * The 404 page: `StatusPage` with the copy every site writes identically.\n *\n * Code `404`, the title \"Page not found\", a sentence that does not blame the\n * reader, and a link home. Every one of them is a prop, so a site that wants\n * search in the page or a different way out passes `action` or `children`\n * rather than rebuilding the page.\n *\n * @example\n * ```tsx\n * <main id=\"main-content\"><NotFoundPage /></main>\n * ```\n */\nexport const NotFoundPage = forwardRef<HTMLElement, NotFoundPageProps>(function NotFoundPage(\n {\n title = 'Page not found',\n code = '404',\n description = 'Nothing lives at this address. It may have moved, or the link that brought you here may be wrong.',\n homeHref = '/',\n homeLabel = 'GO HOME',\n action,\n ...props\n },\n ref,\n) {\n return (\n <StatusPage\n ref={ref}\n title={title}\n code={code}\n description={description}\n action={action ?? homeAction(homeHref, homeLabel)}\n {...props}\n />\n );\n});\n\nexport interface ServerErrorPageProps extends StatusPagePresetProps {\n /** The page's `<h1>`. \"Something went wrong\" by default; `code` is `500`. */\n title?: string;\n /**\n * `true` by default, unlike `StatusPage` and `NotFoundPage`. A 500 is usually\n * served because the application failed, and the shell that would frame it\n * may be what failed. Pass `standalone={false}` for an error the shell\n * survived, inside the consumer's own `<main>`.\n */\n standalone?: boolean;\n}\n\n/**\n * The 500 page: `StatusPage` with the copy every site writes identically.\n *\n * Code `500`, the title \"Something went wrong\", a sentence saying it is not\n * the reader's fault, and a link home. It is standalone by default, since the\n * page is usually served because the application failed and the shell that\n * would have framed it is what may not render. Pass `standalone={false}` to\n * place it inside the site chrome. A request or incident id to quote to\n * support belongs in `children`.\n *\n * @example\n * ```tsx\n * <ServerErrorPage>\n * <p>Reference: {requestId}</p>\n * </ServerErrorPage>\n * ```\n */\nexport const ServerErrorPage = forwardRef<HTMLElement, ServerErrorPageProps>(function ServerErrorPage(\n {\n title = 'Something went wrong',\n code = '500',\n description = 'The server hit an error it could not recover from. It is not something you did — try again in a moment.',\n homeHref = '/',\n homeLabel = 'GO HOME',\n action,\n standalone = true,\n ...props\n },\n ref,\n) {\n return (\n <StatusPage\n ref={ref}\n title={title}\n code={code}\n description={description}\n action={action ?? homeAction(homeHref, homeLabel)}\n standalone={standalone}\n {...props}\n />\n );\n});\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AA4GjB;AA/FV,IAAM,aAAa,OAAO;AAAA,EACxB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOF,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,YAAY;AAAA,MACV,MAAM,EAAE,MAAM,8DAA8D;AAAA,MAC5E,OAAO,CAAC;AAAA,IACV;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,YAAY,MAAM;AACvC,CAAC;AA2DM,IAAM,aAAa,WAAyC,SAASA,YAC1E,EAAE,OAAO,MAAM,aAAa,QAAQ,UAAU,aAAa,OAAO,WAAW,GAAG,MAAM,GACtF,KACA;AACA,QAAM,SAAS,WAAW,EAAE,WAAW,CAAC;AACxC,QAAM,YAAY;AAAA,IAChB,aAAa;AAAA,IACb,GAAG;AAAA,IACH,WAAW,OAAO,KAAK,EAAE,OAAO,UAAU,CAAC;AAAA,EAC7C;AACA,QAAM,QACJ;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,OAAO,MAAM;AAAA,MACxB,cAAc;AAAA,MACd,MACE,OACE,oBAAC,OAAE,aAAU,oBAAmB,WAAW,OAAO,KAAK,GACpD,gBACH,IACE;AAAA,MAEN;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAKF,SAAO,aACL,oBAAC,UAAK,KAAW,GAAG,WACjB,iBACH,IAEA,oBAAC,SAAI,KAAkC,GAAG,WACvC,iBACH;AAEJ,CAAC;AAUD,SAAS,WAAW,UAAkB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