/** * Copyright (c) TonTech. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { useState } from 'react'; import type { ButtonHTMLAttributes, FC, MouseEventHandler } from 'react'; import clsx from 'clsx'; import styles from './switch.module.css'; export interface SwitchProps extends Omit, 'type' | 'onChange'> { /** Controlled checked state. Omit to use uncontrolled mode with `defaultChecked`. */ checked?: boolean; /** Initial checked state for uncontrolled mode. */ defaultChecked?: boolean; /** Fires whenever the checked state changes (both controlled and uncontrolled). */ onCheckedChange?: (checked: boolean) => void; /** Visual size. `default` is 32×20 with a 16px thumb; `sm` is 24×16 with a 12px thumb. */ size?: 'sm' | 'default'; } /** * Custom Switch primitive — independently controllable, no radix dependency. * Renders as a native ` ); };