// Adapted from jalcoui (MIT) — github.com/jal-co/ui // // API reference / props table with per-token type colorization, // expand-on-click description rows, and an optional `Default` column. // // Port notes: // - Type-token colors map to semantic tokens (CONTRACT §2, AUDIT §6): // string→success, number→warning, boolean→info, function→destructive, // reactnode→info, enum→categorical (chart-3 var), nullish→muted-fg, // primary→primary. // - Required marker switched from a trailing `?` (optional indicator // in the source) to a leading `*` in `text-destructive` for required // rows; optionals keep the muted `?`. // - Default-value chip is monospace on `bg-muted/40 border-border`. // - No nested providers (CONTRACT §5); no motion (CONTRACT §4). 'use client'; import * as React from 'react'; import { cn } from '@djangocfg/ui-core/lib'; import type { ApiRefTableProps } from './types'; import { Row } from './components/Row'; export function ApiRefTable({ title, props: rows, nameLabel = 'Prop', showDefaults, emptyMessage = 'No parameters.', className, ...rest }: ApiRefTableProps) { const showDefault = showDefaults ?? rows.some((r) => r.defaultValue != null); return (