2024-06-07 20:17:03 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2025-03-12 11:54:32 +03:00
|
|
|
import { Checkbox, type CheckboxProps } from '../input1';
|
2024-06-07 20:17:03 +03:00
|
|
|
|
2024-10-30 21:35:43 +03:00
|
|
|
/** Animated {@link Checkbox} inside a {@link Dropdown} item. */
|
2025-02-07 10:53:49 +03:00
|
|
|
export function DropdownCheckbox({ onChange: setValue, disabled, ...restProps }: CheckboxProps) {
|
2024-06-07 20:17:03 +03:00
|
|
|
return (
|
2024-12-12 13:17:24 +03:00
|
|
|
<div
|
2024-06-07 20:17:03 +03:00
|
|
|
className={clsx(
|
|
|
|
'px-3 py-1',
|
2025-02-20 20:22:05 +03:00
|
|
|
'text-left text-ellipsis whitespace-nowrap',
|
2024-12-17 11:37:42 +03:00
|
|
|
'disabled:clr-text-controls cc-animate-color',
|
2024-06-07 20:17:03 +03:00
|
|
|
!!setValue && !disabled && 'clr-hover'
|
|
|
|
)}
|
|
|
|
>
|
2025-02-04 20:35:18 +03:00
|
|
|
<Checkbox tabIndex={-1} disabled={disabled} onChange={setValue} {...restProps} />
|
2024-12-12 13:17:24 +03:00
|
|
|
</div>
|
2024-06-07 20:17:03 +03:00
|
|
|
);
|
|
|
|
}
|