44 * See License.AGPL.txt in the project root for license information.
55 */
66
7+ import classNames from "classnames" ;
78import { FC , useCallback } from "react" ;
89import { useId } from "../../hooks/useId" ;
10+ import { InputFieldHint } from "./InputFieldHint" ;
911
1012type Props = {
1113 id ?: string ;
1214 value : string ;
1315 checked : boolean ;
16+ disabled ?: boolean ;
1417 label : string ;
18+ hint ?: string ;
1519 onChange : ( checked : boolean ) => void ;
1620} ;
17- export const CheckboxInput : FC < Props > = ( { id, value, label, checked, onChange } ) => {
21+ export const CheckboxInput : FC < Props > = ( { id, value, label, hint , checked, disabled = false , onChange } ) => {
1822 const maybeId = useId ( ) ;
1923 const elementId = id || maybeId ;
2024
@@ -26,16 +30,33 @@ export const CheckboxInput: FC<Props> = ({ id, value, label, checked, onChange }
2630 ) ;
2731
2832 return (
29- < label className = "flex space-x-2 justify-start items-center " htmlFor = { elementId } >
33+ < label className = "flex space-x-2 justify-start items-start " htmlFor = { elementId } >
3034 < input
3135 type = "checkbox"
32- className = "rounded"
36+ // className="rounded border-2 mt-0.5 text-gray-600"
37+ className = { classNames (
38+ "h-4 w-4 focus:ring-0 mt-0.5 rounded cursor-pointer bg-transparent border-2 dark:filter-invert border-gray-600 dark:border-gray-900 focus:border-gray-900 dark:focus:border-gray-800" ,
39+ { "bg-gray-600 dark:bg-gray-900" : checked } ,
40+ ) }
3341 value = { value }
3442 id = { elementId }
3543 checked = { checked }
44+ disabled = { disabled }
3645 onChange = { handleChange }
3746 />
38- < span className = "text-sm dark:text-gray-400 text-gray-600" > { label } </ span >
47+ < div className = "flex flex-col" >
48+ < span
49+ // className="text-gray-600 dark:text-gray-400 text-sm"
50+ className = { classNames (
51+ "text-md font-semibold cursor-pointer tracking-wide" ,
52+ disabled ? "text-gray-400 dark:text-gray-400" : "text-gray-600 dark:text-gray-100" ,
53+ ) }
54+ >
55+ { label }
56+ </ span >
57+
58+ { hint && < InputFieldHint > { hint } </ InputFieldHint > }
59+ </ div >
3960 </ label >
4061 ) ;
4162} ;
0 commit comments