import * as React from 'react'; import { cn } from '@/lib/utils'; /** * SwitchProps - Propriétés du composant Switch * * @interface SwitchProps * @extends Omit, 'size'> */ export interface SwitchProps extends Omit, 'size'> { /** * État checked du switch * * @example * ```tsx * * ``` */ checked?: boolean; /** * Fonction appelée lorsque l'état checked change * * @param {boolean} checked - Nouvel état checked * * @example * ```tsx * console.log('Switch:', checked)} /> * ``` */ onCheckedChange?: (checked: boolean) => void; } /** * Switch - Composant d'interrupteur avec design system Kodo * * Composant d'interrupteur (toggle) pour activer/désactiver une option. * Utilise le design system Kodo avec une animation de transition fluide. * * @example * ```tsx * // Switch simple * * * // Switch contrôlé * * * // Switch désactivé * * ``` * * @component * @param {SwitchProps} props - Propriétés du composant * @returns {JSX.Element} Élément label contenant un switch stylisé */ const Switch = React.forwardRef( ({ className, checked, onCheckedChange, disabled, ...props }, ref) => { const handleChange = (e: React.ChangeEvent) => { if (onCheckedChange) { onCheckedChange(e.target.checked); } }; return ( ); }, ); Switch.displayName = 'Switch'; export { Switch };