import { default as React } from 'react'; import { default as ICheckboxProps } from './ICheckboxProps'; /** * Checkbox component with custom styling and functionality * * @param props {@link ICheckboxProps} - The component props * @returns The rendered checkbox component * * @example * ```tsx * // Basic usage * function App() { * const [checked, setChecked] = useState(false); * * return ( * * ); * } * ``` * * @example * ```tsx * // Checkbox with indeterminate state * const App = () => { * type Fruit = 'apple' | 'banana' | 'orange'; * type FruitChecked = { [key in Fruit]: boolean }; * * const [checkedAll, setCheckedAll] = useState(false); * const [checkedIndeterminate, setCheckedIndeterminate] = useState(false); * const [fruits, setFruits] = useState({ * apple: false, * banana: false, * orange: false, * }); * * // Handle click to cycle through states * const handleClickCheckAll = () => { * if (checkedAll) { * setCheckedAll(false); * setCheckedIndeterminate(false); * setFruits({ * apple: false, * banana: false, * orange: false, * }); * } else if (checkedIndeterminate) { * setCheckedAll(true); * setCheckedIndeterminate(false); * setFruits({ * apple: true, * banana: true, * orange: true, * }); * } else { * setCheckedAll(true); * setCheckedIndeterminate(false); * setFruits({ * apple: true, * banana: true, * orange: true, * }); * } * }; * const selectFruits = (fruit: Fruit, checked: boolean) => { * const newFruits = { ...fruits }; * newFruits[fruit] = checked; * setFruits(newFruits); * setCheckedAll(Object.values(newFruits).every(value => value)); * setCheckedIndeterminate(Object.values(newFruits).some(value => value) && !Object.values(newFruits).every(value => value)); * }; * return ( * * List of fruits: * * * selectFruits('apple', checked)} /> * selectFruits('banana', checked)} /> * selectFruits('orange', checked)} /> * * ); * } * ``` */ declare const Checkbox: React.FC; export default Checkbox;