'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import * as Switch from '@radix-ui/react-switch';
import { cv } from '../../lib/cv.js';
const toggleTrack = cv('relative inline-block shrink-0 cursor-pointer rounded-[var(--r-pill)] border-0 p-0 transition-colors duration-[var(--motion-base)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50', {
    variants: {
        variant: {
            /** Design system default — accent when on. */
            accent: 'bg-[var(--bdr)] data-[state=checked]:bg-[var(--acc)]',
            /** Semantic enable/disable — success green when on (tables, script tags). */
            enabled: 'bg-[var(--bdr)] data-[state=checked]:bg-[var(--suc)]',
        },
        size: {
            /** Matches `.tog-track` in the design system handoff (38×21). */
            md: 'h-[21px] w-[38px]',
        },
    },
    defaultVariants: {
        variant: 'accent',
        size: 'md',
    },
});
const toggleThumb = cv('pointer-events-none absolute top-[2.5px] left-[2.5px] block rounded-full bg-[var(--toggle-thumb)] shadow-[0_1px_3px_rgba(0,0,0,0.2)] transition-[left] duration-[var(--motion-base)] data-[state=checked]:left-[19.5px]', {
    variants: {
        size: {
            /** Matches `.tog-thumb` in the design system handoff (16×16). */
            md: 'h-4 w-4',
        },
    },
    defaultVariants: {
        size: 'md',
    },
});
/**
 * Design-system toggle (`.tog-track` / `.tog-thumb`). Use `variant="enabled"`
 * for on/off tables where green communicates active state.
 */
export function Toggle({ checked, onCheckedChange, disabled, variant, size, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, }) {
    return (_jsx(Switch.Root, { id: id, checked: checked, onCheckedChange: onCheckedChange, disabled: disabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, className: toggleTrack({ variant, size }), children: _jsx(Switch.Thumb, { className: toggleThumb({ size }) }) }));
}
export { toggleTrack as toggleTrackVariants, toggleThumb as toggleThumbVariants };
//# sourceMappingURL=Toggle.js.map