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:
@@ -0,0 +1,34 @@
|
||||
import { Check, Minus } from 'lucide-react'
|
||||
import { cx } from './cx'
|
||||
|
||||
export function Checkbox({
|
||||
checked,
|
||||
indeterminate = false,
|
||||
onChange,
|
||||
label,
|
||||
}: {
|
||||
checked: boolean
|
||||
indeterminate?: boolean
|
||||
onChange: (next: boolean) => void
|
||||
label: string
|
||||
}) {
|
||||
const on = checked || indeterminate
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
role="checkbox"
|
||||
aria-checked={indeterminate ? 'mixed' : checked}
|
||||
aria-label={label}
|
||||
onClick={e => {
|
||||
e.stopPropagation()
|
||||
onChange(!checked)
|
||||
}}
|
||||
className={cx(
|
||||
'inline-grid place-items-center w-4 h-4 rounded-[5px] cursor-pointer',
|
||||
on ? 'bg-accent text-white' : 'bg-surface shadow-[inset_0_0_0_1.5px_var(--color-faint)]',
|
||||
)}
|
||||
>
|
||||
{indeterminate ? <Minus size={12} strokeWidth={3} aria-hidden /> : checked ? <Check size={12} strokeWidth={3} aria-hidden /> : null}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user