2023-09-02 01:11:27 +03:00
|
|
|
import Checkbox from './Checkbox';
|
|
|
|
|
|
|
|
interface DropdownCheckboxProps {
|
2023-09-07 16:30:43 +03:00
|
|
|
value: boolean
|
2023-09-02 01:11:27 +03:00
|
|
|
label?: string
|
|
|
|
tooltip?: string
|
|
|
|
disabled?: boolean
|
2023-09-07 16:30:43 +03:00
|
|
|
setValue?: (newValue: boolean) => void
|
2023-09-02 01:11:27 +03:00
|
|
|
}
|
|
|
|
|
2023-11-27 13:50:56 +03:00
|
|
|
function DropdownCheckbox({ tooltip, setValue, disabled, ...restProps }: DropdownCheckboxProps) {
|
2023-11-27 11:33:34 +03:00
|
|
|
const behavior = (setValue && !disabled) ? 'clr-hover' : '';
|
2023-09-02 01:11:27 +03:00
|
|
|
return (
|
2023-12-05 01:22:44 +03:00
|
|
|
<div
|
|
|
|
title={tooltip}
|
|
|
|
className={`px-4 py-1 text-left overflow-ellipsis ${behavior} w-full whitespace-nowrap`}
|
|
|
|
>
|
|
|
|
<Checkbox
|
|
|
|
dimensions='w-full'
|
|
|
|
disabled={disabled}
|
|
|
|
setValue={setValue}
|
|
|
|
{...restProps}
|
|
|
|
/>
|
|
|
|
</div>);
|
2023-09-02 01:11:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export default DropdownCheckbox;
|