feat(design): add IMS Admin primitives (Button, StatusTag, Checkbox, FilterChip, Segmented, Avatar, Drawer) and restyle Field, Card, Modal

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 09:28:34 +08:00
co-authored by Claude Haiku 4.5
parent 01343d732e
commit 2a5b9332c7
15 changed files with 417 additions and 248 deletions
+49
View File
@@ -0,0 +1,49 @@
import { ChevronDown, X } from 'lucide-react'
import { cx } from './cx'
export function FilterChip({
label,
value,
options,
onChange,
}: {
label: string
value: string
options: Array<{ value: string; label: string }>
onChange: (value: string) => void
}) {
const selected = options.find(o => o.value === value)
const set = Boolean(value && selected)
return (
<label
className={cx(
'relative inline-flex items-center gap-1 h-7 px-2.5 rounded-md text-[12.5px] whitespace-nowrap cursor-pointer',
set ? 'bg-accent-tint-2 text-accent-700 shadow-chip-set' : 'bg-surface text-ink-2 shadow-chip',
)}
>
<span>{set ? `${label}: ${selected!.label}` : label}</span>
{!set && <ChevronDown size={12} strokeWidth={2.5} aria-hidden />}
<select
aria-label={label}
value={value}
onChange={e => onChange(e.target.value)}
className="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
>
<option value="">{label}</option>
{options.map(o => (
<option key={o.value} value={o.value}>{o.label}</option>
))}
</select>
{set && (
<button
type="button"
aria-label={`Clear ${label}`}
onClick={() => onChange('')}
className="relative z-10 inline-grid place-items-center w-4 h-4 cursor-pointer"
>
<X size={12} strokeWidth={2.5} aria-hidden />
</button>
)}
</label>
)
}