diff --git a/packages/ui/src/components/Surface.tsx b/packages/ui/src/components/Surface.tsx new file mode 100644 index 00000000..861de7b4 --- /dev/null +++ b/packages/ui/src/components/Surface.tsx @@ -0,0 +1,100 @@ +import * as React from 'react'; +import { clsx } from 'clsx'; + +export interface SurfaceProps extends React.HTMLAttributes { + as?: 'section' | 'aside' | 'article' | 'div'; + variant?: 'default' | 'muted' | 'elevated' | 'outline' | 'plain'; + padding?: 'none' | 'sm' | 'md' | 'lg'; +} + +const surfaceVariants: Record, string> = { + default: 'border border-[var(--bl-border)] bg-[var(--bl-surface-card)]', + muted: 'border border-[var(--bl-border)] bg-[var(--bl-surface-muted)]', + elevated: 'border border-[var(--bl-border)] bg-[var(--bl-bg-elevated)] shadow-sm', + outline: 'border border-[var(--bl-border)] bg-transparent', + plain: 'border-transparent bg-transparent', +}; + +const surfacePadding: Record, string> = { + none: '', + sm: 'p-3', + md: 'p-4', + lg: 'p-6', +}; + +export function Surface({ + as: Comp = 'section', + variant = 'default', + padding = 'md', + className, + children, + ...props +}: SurfaceProps) { + return ( + + {children} + + ); +} + +export interface SurfaceListProps extends React.HTMLAttributes { + density?: 'compact' | 'normal' | 'spacious'; + divided?: boolean; +} + +const listDensity: Record, string> = { + compact: 'gap-1', + normal: 'gap-2', + spacious: 'gap-3', +}; + +export function SurfaceList({ + density = 'normal', + divided, + className, + children, + ...props +}: SurfaceListProps) { + return ( +
+ {children} +
+ ); +} + +export interface SurfaceListItemProps extends React.HTMLAttributes { + selected?: boolean; +} + +export function SurfaceListItem({ selected, className, children, ...props }: SurfaceListItemProps) { + return ( +
+ {children} +
+ ); +} diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 016dde66..094d9c7b 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -33,6 +33,14 @@ export { type PanelProps, type PanelTitleProps, } from './components/Panel'; +export { + Surface, + SurfaceList, + SurfaceListItem, + type SurfaceListItemProps, + type SurfaceListProps, + type SurfaceProps, +} from './components/Surface'; export { ListItemButton, type ListItemButtonProps } from './components/ListItemButton'; export { Timeline, type TimelineItem, type TimelineProps } from './components/Timeline'; export { DiffCard, type DiffCardProps } from './components/DiffCard';