feat(ui): refresh theme tokens + add Popover/StatusDot/EmptyState/Kbd

Visual overhaul to give @snowluma/ui a coherent, accessible identity.

Tokens (styles/theme.css)
- Deeper dark-mode surface ramp with more contrast between background /
  card / popover so dropdowns and dialogs read clearly in dark mode
- New radius scale (xs → 3xl) anchored at 0.625rem for tighter feel
- Layered shadow tokens (xs/sm/md/lg/xl) that adapt to mode
- Semantic success / warning / info / destructive colour + foreground
  pairs replacing ad-hoc lookups
- `--chrome-height` (52px) for consistent top-bar / sidebar header height
- Utilities: `hover-lift`, `surface-glass`, `surface-gloss`; consumer-
  scoped scrollbar styling so native scrollbars match
- Note: consumers must also `@import "tw-animate-css";`

Components
- Select: solid bg-popover + ring-1 ring-foreground/5; rotating chevron
  on open state; rounded-xl menu with shadow-xl (fixes the transparent
  dropdown bug)
- Dialog / AlertDialog: bg-popover + ring; backdrop-blur on overlay;
  slide-in motion
- Tooltip: ring + zoom-in motion, max-w-xs for long labels
- Button: explicit transition list with active:translate-y-px; success /
  warning variants; icon-xs size
- Input: hover border + focus ring + aria-invalid handling
- Card: tighter line-height + typography
- Badge: variants for success / warning / info / soft, size scale
- ScrollArea: hover-only mode by default, slightly thicker thumb

New components
- Popover (radix wrapper) — for menus / inline overlays
- StatusDot — semantic colored dot (replaces ad-hoc 🟢/🟡/🔴 emoji)
- EmptyState — uniform placeholder for "nothing here yet" surfaces
- Kbd — inline keyboard-key label
This commit is contained in:
DrSmoothl committed 2026-05-17 13:56:11 +08:00
1 parent af1c50f4e7
commit 3e943e8f0d
16 files changed
+431 -107

No files matched your search

+1
View File
@@ -64,6 +64,7 @@
"@radix-ui/react-checkbox": "^1.1.5",
"@radix-ui/react-dialog": "^1.1.7",
"@radix-ui/react-label": "^2.1.3",
"@radix-ui/react-popover": "^1.1.7",
"@radix-ui/react-scroll-area": "^1.2.4",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-separator": "^1.1.3",
+7 -6
View File
@@ -14,8 +14,9 @@ const AlertDialogOverlay = React.forwardRef<
<AlertDialogPrimitive.Overlay
ref={ref}
className={cn(
'fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
'fixed inset-0 z-50 bg-background/60 backdrop-blur-sm',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className,
)}
{...props}
/>
@@ -31,10 +32,10 @@ const AlertDialogContent = React.forwardRef<
<AlertDialogPrimitive.Content
ref={ref}
className={cn(
'fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border bg-card p-6 shadow-lg outline-none',
'fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-5 rounded-2xl border border-border bg-popover p-6 text-popover-foreground shadow-xl ring-1 ring-foreground/5',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
className
className,
)}
{...props}
/>
@@ -54,7 +55,7 @@ const AlertDialogTitle = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Title ref={ref} className={cn('text-lg font-semibold', className)} {...props} />
<AlertDialogPrimitive.Title ref={ref} className={cn('text-base font-semibold leading-tight tracking-tight', className)} {...props} />
));
AlertDialogTitle.displayName = 'AlertDialogTitle';
@@ -62,7 +63,7 @@ const AlertDialogDescription = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
<AlertDialogPrimitive.Description ref={ref} className={cn('text-sm leading-relaxed text-muted-foreground', className)} {...props} />
));
AlertDialogDescription.displayName = 'AlertDialogDescription';
+16 -7
View File
@@ -3,7 +3,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '../lib/cn';
export const badgeVariants = cva(
'inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium transition-colors',
'inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium leading-none transition-colors',
{
variants: {
variant: {
@@ -12,15 +12,24 @@ export const badgeVariants = cva(
destructive: 'border-transparent bg-destructive/15 text-destructive',
success: 'border-transparent bg-success/15 text-success',
warning: 'border-transparent bg-warning/15 text-warning',
outline: 'border-border text-foreground',
info: 'border-transparent bg-info/15 text-info',
outline: 'border-border bg-card text-foreground',
soft: 'border-transparent bg-muted text-muted-foreground',
},
size: {
default: 'px-2 py-0.5 text-[11px]',
sm: 'px-1.5 py-px text-[10px]',
lg: 'px-2.5 py-1 text-xs',
},
},
defaultVariants: { variant: 'default' },
}
defaultVariants: { variant: 'default', size: 'default' },
},
);
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {}
export interface BadgeProps
extends React.HTMLAttributes<HTMLSpanElement>,
VariantProps<typeof badgeVariants> {}
export function Badge({ className, variant, ...props }: BadgeProps) {
return <span className={cn(badgeVariants({ variant }), className)} {...props} />;
export function Badge({ className, variant, size, ...props }: BadgeProps) {
return <span className={cn(badgeVariants({ variant, size }), className)} {...props} />;
}
+10 -10
View File
@@ -5,45 +5,45 @@ const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElemen
({ className, ...props }, ref) => (
<div
ref={ref}
className={cn('rounded-xl border bg-card text-card-foreground shadow-sm', className)}
className={cn('rounded-xl border border-border bg-card text-card-foreground shadow-sm', className)}
{...props}
/>
)
),
);
Card.displayName = 'Card';
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
<div ref={ref} className={cn('flex flex-col gap-1.5 p-5', className)} {...props} />
)
),
);
CardHeader.displayName = 'CardHeader';
const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
<div ref={ref} className={cn('font-semibold tracking-tight text-base', className)} {...props} />
)
<div ref={ref} className={cn('text-base font-semibold leading-tight tracking-tight', className)} {...props} />
),
);
CardTitle.displayName = 'CardTitle';
const CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
<div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
)
<div ref={ref} className={cn('text-sm leading-relaxed text-muted-foreground', className)} {...props} />
),
);
CardDescription.displayName = 'CardDescription';
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
<div ref={ref} className={cn('p-5 pt-0', className)} {...props} />
)
),
);
CardContent.displayName = 'CardContent';
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
<div ref={ref} className={cn('flex items-center p-5 pt-0', className)} {...props} />
)
<div ref={ref} className={cn('flex items-center gap-2 p-5 pt-0', className)} {...props} />
),
);
CardFooter.displayName = 'CardFooter';
+18 -8
View File
@@ -15,8 +15,9 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay
ref={ref}
className={cn(
'fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
'fixed inset-0 z-50 bg-background/60 backdrop-blur-sm',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className,
)}
{...props}
/>
@@ -32,16 +33,17 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
className={cn(
'fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border bg-card p-6 shadow-lg outline-none',
'fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-5 rounded-2xl border border-border bg-popover p-6 text-popover-foreground shadow-xl ring-1 ring-foreground/5',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
className
'data-[state=open]:slide-in-from-top-2',
className,
)}
{...props}
>
{children}
{showClose && (
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring cursor-pointer">
<DialogPrimitive.Close className="absolute right-4 top-4 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-80 transition hover:bg-muted hover:opacity-100 focus:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40">
<X className="size-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
@@ -56,14 +58,18 @@ const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivEleme
);
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end gap-2', className)} {...props} />
<div className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)} {...props} />
);
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title ref={ref} className={cn('text-lg font-semibold leading-none tracking-tight', className)} {...props} />
<DialogPrimitive.Title
ref={ref}
className={cn('text-base font-semibold leading-tight tracking-tight', className)}
{...props}
/>
));
DialogTitle.displayName = 'DialogTitle';
@@ -71,7 +77,11 @@ const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
<DialogPrimitive.Description
ref={ref}
className={cn('text-sm leading-relaxed text-muted-foreground', className)}
{...props}
/>
));
DialogDescription.displayName = 'DialogDescription';
@@ -0,0 +1,36 @@
import * as React from 'react';
import { cn } from '../lib/cn';
interface EmptyStateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
icon?: React.ReactNode;
title: React.ReactNode;
description?: React.ReactNode;
action?: React.ReactNode;
}
/**
* Generic "nothing here yet" placeholder. Used by Bot list, search-with-no-
* results, log filters that filtered everything out, etc.
*/
export function EmptyState({ icon, title, description, action, className, ...props }: EmptyStateProps) {
return (
<div
className={cn(
'flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/40 px-6 py-12 text-center',
className,
)}
{...props}
>
{icon && (
<div className="flex size-12 items-center justify-center rounded-full bg-muted text-muted-foreground">
{icon}
</div>
)}
<div className="space-y-1">
<h3 className="text-sm font-medium text-foreground">{title}</h3>
{description && <p className="text-xs leading-relaxed text-muted-foreground">{description}</p>}
</div>
{action && <div className="pt-1">{action}</div>}
</div>
);
}
+4 -3
View File
@@ -7,17 +7,18 @@ const Input = React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLI
type={type}
ref={ref}
className={cn(
'flex h-9 w-full min-w-0 rounded-md border border-border bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none',
'flex h-9 w-full min-w-0 rounded-lg border border-border bg-card px-3 py-1 text-sm text-foreground shadow-xs transition-[color,box-shadow,border-color,background-color] outline-none',
'file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium',
'placeholder:text-muted-foreground',
'hover:border-border/80',
'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/40',
'disabled:cursor-not-allowed disabled:opacity-50',
'aria-invalid:border-destructive aria-invalid:ring-destructive/20',
className
className,
)}
{...props}
/>
)
),
);
Input.displayName = 'Input';
+17
View File
@@ -0,0 +1,17 @@
import * as React from 'react';
import { cn } from '../lib/cn';
/** Small inline keyboard-key label, e.g. `<Kbd>⌘K</Kbd>`. */
export const Kbd = React.forwardRef<HTMLElement, React.HTMLAttributes<HTMLElement>>(
({ className, ...props }, ref) => (
<kbd
ref={ref}
className={cn(
'inline-flex h-5 min-w-[1.25rem] items-center justify-center rounded border border-border bg-muted px-1 font-mono text-[10px] font-medium text-muted-foreground',
className,
)}
{...props}
/>
),
);
Kbd.displayName = 'Kbd';
+31
View File
@@ -0,0 +1,31 @@
import * as React from 'react';
import * as PopoverPrimitive from '@radix-ui/react-popover';
import { cn } from '../lib/cn';
const Popover = PopoverPrimitive.Root;
const PopoverTrigger = PopoverPrimitive.Trigger;
const PopoverAnchor = PopoverPrimitive.Anchor;
const PopoverContent = React.forwardRef<
React.ElementRef<typeof PopoverPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
>(({ className, align = 'center', sideOffset = 6, ...props }, ref) => (
<PopoverPrimitive.Portal>
<PopoverPrimitive.Content
ref={ref}
align={align}
sideOffset={sideOffset}
className={cn(
'z-50 w-72 rounded-xl border border-border bg-popover p-4 text-popover-foreground shadow-xl ring-1 ring-foreground/5 outline-none',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className,
)}
{...props}
/>
</PopoverPrimitive.Portal>
));
PopoverContent.displayName = 'PopoverContent';
export { Popover, PopoverTrigger, PopoverAnchor, PopoverContent };
+7 -6
View File
@@ -7,9 +7,10 @@ interface ScrollAreaProps extends React.ComponentPropsWithoutRef<typeof ScrollAr
}
const ScrollArea = React.forwardRef<React.ElementRef<typeof ScrollAreaPrimitive.Root>, ScrollAreaProps>(
({ className, children, viewportClassName, ...props }, ref) => (
({ className, children, viewportClassName, type = 'hover', ...props }, ref) => (
<ScrollAreaPrimitive.Root
ref={ref}
type={type}
className={cn('relative overflow-hidden', className)}
{...props}
>
@@ -22,7 +23,7 @@ const ScrollArea = React.forwardRef<React.ElementRef<typeof ScrollAreaPrimitive.
<ScrollBar orientation="horizontal" />
<ScrollAreaPrimitive.Corner />
</ScrollAreaPrimitive.Root>
)
),
);
ScrollArea.displayName = 'ScrollArea';
@@ -35,13 +36,13 @@ const ScrollBar = React.forwardRef<
orientation={orientation}
className={cn(
'flex touch-none select-none p-0.5 transition-colors',
orientation === 'vertical' && 'h-full w-2 border-l border-l-transparent',
orientation === 'horizontal' && 'h-2 w-full flex-col border-t border-t-transparent',
className
orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent',
orientation === 'horizontal' && 'h-2.5 w-full flex-col border-t border-t-transparent',
className,
)}
{...props}
>
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border hover:bg-muted-foreground/40 transition-colors" />
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border transition-colors hover:bg-muted-foreground/50" />
</ScrollAreaPrimitive.ScrollAreaScrollbar>
));
ScrollBar.displayName = 'ScrollBar';
+29 -14
View File
@@ -14,18 +14,20 @@ const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger
ref={ref}
className={cn(
'flex h-9 w-full items-center justify-between gap-2 rounded-md border border-border bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-[color,box-shadow]',
'group flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-card px-3 py-1 text-sm shadow-xs outline-none transition-[color,box-shadow,background-color,border-color]',
'hover:border-border/80 hover:bg-card/70',
'placeholder:text-muted-foreground',
'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/40',
'data-[state=open]:border-ring data-[state=open]:ring-[3px] data-[state=open]:ring-ring/40',
'disabled:cursor-not-allowed disabled:opacity-50',
'data-[placeholder]:text-muted-foreground',
className
className,
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDown className="size-4 opacity-50" />
<ChevronDown className="size-4 opacity-60 transition-transform group-data-[state=open]:rotate-180" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
));
@@ -37,7 +39,7 @@ const SelectScrollUpButton = React.forwardRef<
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollUpButton
ref={ref}
className={cn('flex cursor-default items-center justify-center py-1', className)}
className={cn('flex cursor-default items-center justify-center py-1 text-muted-foreground', className)}
{...props}
>
<ChevronUp className="size-4" />
@@ -51,7 +53,7 @@ const SelectScrollDownButton = React.forwardRef<
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollDownButton
ref={ref}
className={cn('flex cursor-default items-center justify-center py-1', className)}
className={cn('flex cursor-default items-center justify-center py-1 text-muted-foreground', className)}
{...props}
>
<ChevronDown className="size-4" />
@@ -67,17 +69,25 @@ const SelectContent = React.forwardRef<
<SelectPrimitive.Content
ref={ref}
position={position}
sideOffset={4}
className={cn(
'relative z-50 max-h-(--radix-select-content-available-height) min-w-(--radix-select-trigger-width) overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md',
// Solid popover surface — explicit bg + ring for visibility against any background.
'relative z-50 max-h-(--radix-select-content-available-height) min-w-(--radix-select-trigger-width) overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl ring-1 ring-foreground/5',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
position === 'popper' && 'data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1',
className
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
position === 'popper' &&
'data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1',
className,
)}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn('p-1', position === 'popper' && 'h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)')}
className={cn(
'p-1',
position === 'popper' &&
'h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)',
)}
>
{children}
</SelectPrimitive.Viewport>
@@ -91,7 +101,11 @@ const SelectLabel = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Label ref={ref} className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)} {...props} />
<SelectPrimitive.Label
ref={ref}
className={cn('px-2 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground', className)}
{...props}
/>
));
SelectLabel.displayName = 'SelectLabel';
@@ -102,14 +116,15 @@ const SelectItem = React.forwardRef<
<SelectPrimitive.Item
ref={ref}
className={cn(
'relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none',
'relative flex w-full cursor-default select-none items-center gap-2 rounded-md py-1.5 pl-2 pr-8 text-sm outline-none transition-colors',
'focus:bg-accent focus:text-accent-foreground',
'data-[state=checked]:font-medium',
'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className
className,
)}
{...props}
>
<span className="absolute right-2 flex size-3.5 items-center justify-center">
<span className="absolute right-2 flex size-3.5 items-center justify-center text-primary">
<SelectPrimitive.ItemIndicator>
<Check className="size-4" />
</SelectPrimitive.ItemIndicator>
@@ -123,7 +138,7 @@ const SelectSeparator = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Separator ref={ref} className={cn('-mx-1 my-1 h-px bg-muted', className)} {...props} />
<SelectPrimitive.Separator ref={ref} className={cn('-mx-1 my-1 h-px bg-border', className)} {...props} />
));
SelectSeparator.displayName = 'SelectSeparator';
+49
View File
@@ -0,0 +1,49 @@
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '../lib/cn';
/**
* A semantic colored status dot — drop-in replacement for ad-hoc emoji
* (🟢 / 🟡 / 🔴) so we keep visual rhythm with the rest of the Lucide
* iconography. `pulse` adds a soft halo for the "active" state.
*/
const dotVariants = cva('inline-block shrink-0 rounded-full', {
variants: {
tone: {
success: 'bg-success',
warning: 'bg-warning',
destructive: 'bg-destructive',
info: 'bg-info',
muted: 'bg-muted-foreground/50',
primary: 'bg-primary',
},
size: {
xs: 'size-1.5',
sm: 'size-2',
md: 'size-2.5',
lg: 'size-3',
},
},
defaultVariants: { tone: 'muted', size: 'sm' },
});
export interface StatusDotProps
extends React.HTMLAttributes<HTMLSpanElement>,
VariantProps<typeof dotVariants> {
pulse?: boolean;
}
export function StatusDot({ className, tone, size, pulse, ...props }: StatusDotProps) {
return (
<span
className={cn(
'relative inline-flex items-center justify-center',
pulse && 'before:absolute before:inset-0 before:rounded-full before:bg-current before:opacity-30 before:animate-ping',
className,
)}
{...props}
>
<span className={cn(dotVariants({ tone, size }), 'relative')} aria-hidden />
</span>
);
}
+3 -2
View File
@@ -15,9 +15,10 @@ const TooltipContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
'z-50 overflow-hidden rounded-md border bg-popover px-2.5 py-1.5 text-xs text-popover-foreground shadow-md',
'z-50 max-w-xs overflow-hidden rounded-md border border-border bg-popover px-2.5 py-1.5 text-xs text-popover-foreground shadow-lg ring-1 ring-foreground/5',
'data-[state=delayed-open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=delayed-open]:fade-in-0',
className
'data-[state=delayed-open]:zoom-in-95 data-[state=closed]:zoom-out-95',
className,
)}
{...props}
/>
+4
View File
@@ -66,3 +66,7 @@ export { Switch } from './components/switch';
export { Tabs, TabsList, TabsTrigger, TabsContent } from './components/tabs';
export { Toaster, toast, type ToasterProps } from './components/toaster';
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/tooltip';
export { Popover, PopoverTrigger, PopoverAnchor, PopoverContent } from './components/popover';
export { Kbd } from './components/kbd';
export { StatusDot, type StatusDotProps } from './components/status-dot';
export { EmptyState } from './components/empty-state';
+160 -51
View File
@@ -1,19 +1,18 @@
/**
* @snowluma/ui — Tailwind 4 theme tokens
* @snowluma/ui — Tailwind 4 theme tokens.
*
* Usage in consumers (webui, SnowLumaDesktop):
* Consumer setup:
* @import "tailwindcss";
* @import "tw-animate-css";
* @import "@snowluma/ui/styles/theme.css";
*
* Tailwind 4 will inline these via `@theme` and pick up classes used in
* `@snowluma/ui` components if the consumer adds:
* @source "../node_modules/@snowluma/ui/dist/**\/*.js";
*/
@custom-variant dark (&:where(.dark, .dark *));
:root {
--radius: 0.75rem;
/* Surface ramp — light mode: near-white surfaces over a faint blue base. */
--radius: 0.625rem;
--background: oklch(99% 0.004 240);
--foreground: oklch(20% 0.03 250);
@@ -24,79 +23,107 @@
--popover: oklch(100% 0 0);
--popover-foreground: oklch(20% 0.03 250);
/* sky-500 */
--primary: oklch(68.5% 0.155 230);
/* sky accent ramp */
--primary: oklch(64% 0.16 230);
--primary-foreground: oklch(99% 0.005 240);
--secondary: oklch(96% 0.012 240);
--secondary-foreground: oklch(25% 0.03 250);
--secondary: oklch(96.5% 0.012 240);
--secondary-foreground: oklch(22% 0.03 250);
--muted: oklch(96% 0.012 240);
--muted-foreground: oklch(50% 0.02 250);
--muted: oklch(96.5% 0.012 240);
--muted-foreground: oklch(48% 0.02 250);
--accent: oklch(94% 0.03 230);
--accent-foreground: oklch(35% 0.07 230);
--accent: oklch(94% 0.04 230);
--accent-foreground: oklch(28% 0.08 230);
--destructive: oklch(60% 0.22 27);
--destructive: oklch(58% 0.22 27);
--destructive-foreground: oklch(99% 0.005 240);
--success: oklch(70% 0.15 160);
--warning: oklch(78% 0.16 80);
--success: oklch(64% 0.16 155);
--success-foreground: oklch(99% 0.005 240);
--border: oklch(92% 0.01 240);
--warning: oklch(76% 0.16 75);
--warning-foreground: oklch(20% 0.05 75);
--info: oklch(64% 0.16 230);
--info-foreground: oklch(99% 0.005 240);
--border: oklch(91% 0.012 240);
--input: oklch(94% 0.012 240);
--ring: oklch(68.5% 0.155 230);
--ring: oklch(64% 0.16 230);
--sidebar: oklch(98% 0.006 240);
--sidebar-foreground: oklch(25% 0.03 250);
--sidebar-primary: oklch(68.5% 0.155 230);
--sidebar-primary: oklch(64% 0.16 230);
--sidebar-primary-foreground: oklch(99% 0.005 240);
--sidebar-accent: oklch(94% 0.025 230);
--sidebar-accent-foreground: oklch(35% 0.08 230);
--sidebar-border: oklch(92% 0.01 240);
--sidebar-ring: oklch(68.5% 0.155 230);
--sidebar-accent: oklch(94% 0.03 230);
--sidebar-accent-foreground: oklch(28% 0.08 230);
--sidebar-border: oklch(91% 0.012 240);
--sidebar-ring: oklch(64% 0.16 230);
--chrome-height: 3.25rem; /* 52px — uniform top-bar height */
--shadow-color: 240 6% 10%;
--shadow-xs: 0 1px 2px 0 hsl(var(--shadow-color) / 0.05);
--shadow-sm: 0 1px 3px 0 hsl(var(--shadow-color) / 0.08), 0 1px 2px -1px hsl(var(--shadow-color) / 0.06);
--shadow-md: 0 4px 6px -1px hsl(var(--shadow-color) / 0.08), 0 2px 4px -2px hsl(var(--shadow-color) / 0.04);
--shadow-lg: 0 10px 16px -3px hsl(var(--shadow-color) / 0.10), 0 4px 6px -4px hsl(var(--shadow-color) / 0.05);
--shadow-xl: 0 20px 28px -8px hsl(var(--shadow-color) / 0.14);
}
.dark {
--background: oklch(16% 0.02 250);
--foreground: oklch(96% 0.01 240);
--background: oklch(13% 0.02 250);
--foreground: oklch(96% 0.012 240);
--card: oklch(20% 0.025 250);
--card-foreground: oklch(96% 0.01 240);
--card: oklch(17% 0.022 250);
--card-foreground: oklch(96% 0.012 240);
--popover: oklch(20% 0.025 250);
--popover-foreground: oklch(96% 0.01 240);
--popover-foreground: oklch(96% 0.012 240);
--primary: oklch(75% 0.14 230);
--primary-foreground: oklch(15% 0.02 250);
--primary: oklch(72% 0.16 230);
--primary-foreground: oklch(12% 0.025 250);
--secondary: oklch(25% 0.025 250);
--secondary-foreground: oklch(96% 0.01 240);
--secondary: oklch(22% 0.025 250);
--secondary-foreground: oklch(94% 0.012 240);
--muted: oklch(24% 0.02 250);
--muted-foreground: oklch(68% 0.02 240);
--muted: oklch(20% 0.022 250);
--muted-foreground: oklch(72% 0.02 240);
--accent: oklch(28% 0.05 230);
--accent-foreground: oklch(85% 0.1 230);
--accent: oklch(30% 0.06 230);
--accent-foreground: oklch(88% 0.12 230);
--destructive: oklch(62% 0.2 27);
--destructive: oklch(66% 0.22 27);
--destructive-foreground: oklch(98% 0.005 240);
--success: oklch(72% 0.15 160);
--warning: oklch(80% 0.16 80);
--success: oklch(70% 0.16 155);
--success-foreground: oklch(12% 0.025 250);
--border: oklch(28% 0.02 250);
--input: oklch(26% 0.02 250);
--ring: oklch(75% 0.14 230);
--warning: oklch(80% 0.16 75);
--warning-foreground: oklch(20% 0.05 75);
--sidebar: oklch(18% 0.022 250);
--sidebar-foreground: oklch(92% 0.01 240);
--sidebar-primary: oklch(75% 0.14 230);
--sidebar-primary-foreground: oklch(15% 0.02 250);
--sidebar-accent: oklch(28% 0.05 230);
--sidebar-accent-foreground: oklch(85% 0.1 230);
--sidebar-border: oklch(26% 0.02 250);
--sidebar-ring: oklch(75% 0.14 230);
--info: oklch(72% 0.16 230);
--info-foreground: oklch(12% 0.025 250);
--border: oklch(28% 0.025 250);
--input: oklch(26% 0.025 250);
--ring: oklch(72% 0.16 230);
--sidebar: oklch(15% 0.022 250);
--sidebar-foreground: oklch(92% 0.012 240);
--sidebar-primary: oklch(72% 0.16 230);
--sidebar-primary-foreground: oklch(12% 0.025 250);
--sidebar-accent: oklch(28% 0.06 230);
--sidebar-accent-foreground: oklch(88% 0.12 230);
--sidebar-border: oklch(24% 0.025 250);
--sidebar-ring: oklch(72% 0.16 230);
--shadow-color: 240 14% 4%;
--shadow-xs: 0 1px 2px 0 hsl(var(--shadow-color) / 0.30);
--shadow-sm: 0 1px 3px 0 hsl(var(--shadow-color) / 0.36), 0 1px 2px -1px hsl(var(--shadow-color) / 0.28);
--shadow-md: 0 4px 6px -1px hsl(var(--shadow-color) / 0.40), 0 2px 4px -2px hsl(var(--shadow-color) / 0.28);
--shadow-lg: 0 10px 16px -3px hsl(var(--shadow-color) / 0.50), 0 4px 6px -4px hsl(var(--shadow-color) / 0.32);
--shadow-xl: 0 20px 28px -8px hsl(var(--shadow-color) / 0.55);
}
@theme inline {
@@ -117,7 +144,11 @@
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-success: var(--success);
--color-success-foreground: var(--success-foreground);
--color-warning: var(--warning);
--color-warning-foreground: var(--warning-foreground);
--color-info: var(--info);
--color-info-foreground: var(--info-foreground);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
@@ -130,11 +161,89 @@
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
--radius-xs: calc(var(--radius) - 6px);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--radius-2xl: calc(var(--radius) + 8px);
--radius-3xl: calc(var(--radius) + 16px);
--shadow-xs: var(--shadow-xs);
--shadow-sm: var(--shadow-sm);
--shadow-md: var(--shadow-md);
--shadow-lg: var(--shadow-lg);
--shadow-xl: var(--shadow-xl);
--font-sans: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
--font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}
@layer base {
* {
border-color: var(--border);
}
html, body, #root {
height: 100%;
}
body {
margin: 0;
background-color: var(--background);
color: var(--foreground);
font-family: var(--font-sans);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
line-height: 1.5;
overflow: hidden; /* desktop chrome: no body scroll, panels manage their own */
}
::selection {
background-color: color-mix(in oklab, var(--primary) 28%, transparent);
color: var(--foreground);
}
*::-webkit-scrollbar {
width: 10px;
height: 10px;
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background-color: color-mix(in oklab, var(--muted-foreground) 35%, transparent);
border-radius: 9999px;
border: 2px solid transparent;
background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
background-color: color-mix(in oklab, var(--muted-foreground) 55%, transparent);
background-clip: content-box;
}
html[data-density="compact"] body {
font-size: 13.5px;
line-height: 1.45;
}
}
@layer utilities {
.hover-lift {
transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.hover-lift:hover {
transform: translateY(-1px);
box-shadow: var(--shadow-md);
}
.surface-gloss {
background-image: linear-gradient(
180deg,
color-mix(in oklab, var(--foreground) 3%, transparent) 0%,
transparent 80%
);
}
.surface-glass {
background-color: color-mix(in oklab, var(--popover) 92%, transparent);
backdrop-filter: saturate(180%) blur(12px);
-webkit-backdrop-filter: saturate(180%) blur(12px);
}
}
+39
View File
@@ -92,6 +92,9 @@ importers:
'@radix-ui/react-label':
specifier: ^2.1.3
version: 2.1.8(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-popover':
specifier: ^1.1.7
version: 1.1.15(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-scroll-area':
specifier: ^1.2.4
version: 1.2.10(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
@@ -832,6 +835,19 @@ packages:
'@types/react-dom':
optional: true
'@radix-ui/[email protected]':
resolution: {integrity: sha512-kr0X2+6Yy/vJzLYJUPCZEc8SfQcf+1COFoAqauJm74umQhta9M7lNJHP7QQS3vkvcGLQUbWpMzwrXYwrYztHKA==}
peerDependencies:
'@types/react': '*'
'@types/react-dom': '*'
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
peerDependenciesMeta:
'@types/react':
optional: true
'@types/react-dom':
optional: true
'@radix-ui/[email protected]':
resolution: {integrity: sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw==}
peerDependencies:
@@ -3144,6 +3160,29 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':
dependencies:
'@radix-ui/primitive': 1.1.3
'@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
'@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
'@radix-ui/react-dismissable-layer': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-focus-guards': 1.1.3(@types/[email protected])([email protected])
'@radix-ui/react-focus-scope': 1.1.7(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])
'@radix-ui/react-popper': 1.2.8(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-portal': 1.1.9(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-presence': 1.1.5(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-primitive': 2.1.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@radix-ui/react-slot': 1.2.3(@types/[email protected])([email protected])
'@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
aria-hidden: 1.2.6
react: 19.2.5
react-dom: 19.2.5([email protected])
react-remove-scroll: 2.7.2(@types/[email protected])([email protected])
optionalDependencies:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':
dependencies:
'@floating-ui/react-dom': 2.1.8([email protected]([email protected]))([email protected])