import React from 'react'; import classNames from 'classnames'; import type { SafeOmit } from '@shoptet/utils'; import type { SafeExtract, Size } from '../../../types'; import type { CommonInputProps } from '../types'; /** @inheritdoc */ export interface SwitchProps extends CommonInputProps { size?: SafeExtract; } export const Switch = React.forwardRef(function Switch( { size = 'md', error, warning, label, onChange, onFocus, onBlur, ...props }: SwitchProps, ref ) { props satisfies SafeOmit; return ( onChange?.(event.target.checked, event)} onFocus={event => onFocus?.(event.target.checked, event)} onBlur={event => onBlur?.(event.target.checked, event)} {...props} /> ); });