import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import Styles from "./Switch.module.scss";
/**
 * A toggle switch component that lets users turn something on or off.
 * It displays a clickable switch that changes state when clicked,
 * and can be enabled or disabled based on user interaction.
 */
export default function Switch({ enabled, onToggle, size, disabled, ...props }) {
    return (_jsx(_Fragment, { children: _jsxs("div", { style: { fontSize: `${size}px` }, className: `${Styles.root} ${enabled ? Styles.on : ""} ${disabled ? Styles.disabled : ""}`, onClick: ({ target, currentTarget }) => {
                if (target !== currentTarget || disabled)
                    return;
                onToggle(!enabled);
            }, ...props, children: [_jsx("div", { className: Styles.toggler }), _jsx("input", { checked: enabled, type: "checkbox" })] }) }));
}
//# sourceMappingURL=Switch.js.map