"use client" import * as React from "react" import { FolderGridView, ListPageBoardCard, ListPageSplitHubChrome, type HubTableRendererArgs, type HubTableRenderers, } from "@/components/data-views" import { ListPageTreeColumnHeader } from "@/components/data-views/list-page-tree-column-header" import { LIST_PAGE_SPLIT_MILLER_COLUMN_PANEL_CLASS, LIST_PAGE_SPLIT_MILLER_DETAIL_PANEL_CLASS, LIST_PAGE_SPLIT_RESIZABLE_HANDLE_CLASS, } from "@/components/data-views/list-page-split-hub-tokens" import { KeyMetrics, type MetricInsight, type MetricItem } from "@/components/key-metrics" import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable" import { cn } from "@/lib/utils" import { categoryPreview, type TokenRecord } from "@/components/tokens-themes-section" export interface TokenHubRow extends Record { id: string name: string namespace: string category: string value: string deprecated: boolean record: TokenRecord } export function TokensDashboardBody({ metrics, insight, }: { metrics: MetricItem[] insight: MetricInsight }) { return (
) } export function TokensFolderBody({ rows }: { rows: TokenHubRow[] }) { return ( r.id} ariaLabel="Design tokens" constrainWidth renderTile={row => ( )} emptyContent={

No tokens match your filters.

} /> ) } function TokenDetailPanel({ row }: { row: TokenHubRow }) { return (
{categoryPreview(row.name, row.record)}

{row.name}

{row.namespace}

Value

{row.value}

Category

{String(row.category)}

) } export function TokensPanelBody({ rows }: { rows: TokenHubRow[] }) { const namespaces = React.useMemo( () => [...new Set(rows.map(r => r.namespace))].toSorted((a, b) => a.localeCompare(b)), [rows], ) const [pickedNamespace, setPickedNamespace] = React.useState(null) const [pickedId, setPickedId] = React.useState(null) const activeNamespace = pickedNamespace && namespaces.includes(pickedNamespace) ? pickedNamespace : (namespaces[0] ?? null) const inNamespace = React.useMemo( () => (activeNamespace ? rows.filter(r => r.namespace === activeNamespace) : []), [rows, activeNamespace], ) const activeId = pickedId && inNamespace.some(r => r.id === pickedId) ? pickedId : (inNamespace[0]?.id ?? null) const activeRow = inNamespace.find(r => r.id === activeId) ?? null return (
{namespaces.map(ns => ( ))}
{inNamespace.map(row => ( ))}
{activeRow ? :

Select a token.

}
) } export function TokensTreePanelBody({ rows }: { rows: TokenHubRow[] }) { const byNamespace = React.useMemo(() => { const map = new Map() for (const row of rows) { const list = map.get(row.namespace) ?? [] list.push(row) map.set(row.namespace, list) } return [...map.entries()].toSorted(([a], [b]) => a.localeCompare(b)) }, [rows]) const [openNs, setOpenNs] = React.useState>(() => new Set(byNamespace.map(([ns]) => ns))) const [activeId, setActiveId] = React.useState(rows[0]?.id ?? null) const activeRow = rows.find(r => r.id === activeId) ?? null return (
{byNamespace.map(([ns, items]) => { const open = openNs.has(ns) return (