'use strict';

var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
var index$1 = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
var React = require('react');
var checkbox_module = require('./checkbox.module.css.cjs');
var index = require('../../node_modules/.pnpm/@radix-ui_react-checkbox@1.3.2_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-checkbox/dist/index.cjs');

const CheckMarkIcon = () => (jsxRuntime.jsxRuntimeExports.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', className: checkbox_module.default.icon, children: jsxRuntime.jsxRuntimeExports.jsx("path", { fillRule: 'evenodd', clipRule: 'evenodd', d: 'M11.9005 4.9671C12.0894 4.6782 12.0083 4.29086 11.7194 4.10197C11.4305 3.91307 11.0432 3.99414 10.8543 4.28304L7.15577 9.93961L5.04542 8.02112C4.79001 7.78893 4.39473 7.80775 4.16254 8.06316C3.93035 8.31857 3.94917 8.71385 4.20458 8.94605L6.85731 11.3576C6.99274 11.4807 7.17532 11.5383 7.35686 11.5151C7.53841 11.492 7.70068 11.3904 7.80084 11.2372L11.9005 4.9671Z', fill: 'currentColor' }) }));
const IndeterminateIcon = () => (jsxRuntime.jsxRuntimeExports.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none', className: checkbox_module.default.icon, children: jsxRuntime.jsxRuntimeExports.jsx("path", { fillRule: 'evenodd', clipRule: 'evenodd', d: 'M11.5 8.5H4.5C4.22386 8.5 4 8.27614 4 8C4 7.72386 4.22386 7.5 4.5 7.5H11.5C11.7761 7.5 12 7.72386 12 8C12 8.27614 11.7761 8.5 11.5 8.5Z', fill: 'currentColor' }) }));
const checkbox = index$1.cva(checkbox_module.default.checkbox);
const Checkbox = React.forwardRef(({ className, disabled, checked, defaultChecked, onCheckedChange, ...props }, forwardedRef) => {
    const isIndeterminate = checked === 'indeterminate' || defaultChecked === 'indeterminate';
    return (jsxRuntime.jsxRuntimeExports.jsx(index.Checkbox, { className: checkbox({
            className: index$1.cx(className, {
                [checkbox_module.default['checkbox-disabled']]: disabled,
                [checkbox_module.default['checkbox-indeterminate']]: isIndeterminate
            })
        }), checked: isIndeterminate || checked === true, defaultChecked: defaultChecked === true, onCheckedChange: value => {
            if (onCheckedChange) {
                // If it's currently indeterminate, next state will be unchecked
                if (checked === 'indeterminate') {
                    onCheckedChange(false);
                }
                else {
                    onCheckedChange(value);
                }
            }
        }, disabled: disabled, ref: forwardedRef, ...props, children: jsxRuntime.jsxRuntimeExports.jsx(index.CheckboxIndicator, { className: checkbox_module.default.indicator, children: isIndeterminate ? jsxRuntime.jsxRuntimeExports.jsx(IndeterminateIcon, {}) : jsxRuntime.jsxRuntimeExports.jsx(CheckMarkIcon, {}) }) }));
});
Checkbox.displayName = 'Checkbox';

exports.Checkbox = Checkbox;
//# sourceMappingURL=checkbox.cjs.map
