require("./Checkbox.css");
var $e991cbcdf82ced71$exports = require("./CenterBaseline.cjs");
var $dba2b18fc5727f9b$exports = require("./Checkmark.cjs");
var $84c37b7bd5c1374e$exports = require("./Dash.cjs");
var $bfa4962d90c8af48$exports = require("./Form.cjs");
var $2061c83559b50a66$exports = require("./pressScale.cjs");
var $150382364eecc4bc$exports = require("./useDOMRef.cjs");
var $ac757a4c2bd72aee$exports = require("../../icons/useSpectrumContextProps.cjs");
var $gg2RS$reactjsxruntime = require("react/jsx-runtime");
var $gg2RS$reactariacomponentsCheckbox = require("react-aria-components/Checkbox");
var $gg2RS$reactariacomponentsCheckboxGroup = require("react-aria-components/CheckboxGroup");
var $gg2RS$reactariacomponentsslots = require("react-aria-components/slots");
var $gg2RS$react = require("react");


function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "CheckboxContext", () => $af04e099a53d3e85$export$b085522c77523c51);
$parcel$export(module.exports, "box", () => $af04e099a53d3e85$export$827f4ee28efc37);
$parcel$export(module.exports, "iconStyles", () => $af04e099a53d3e85$export$2c99b98b77550cb4);
$parcel$export(module.exports, "Checkbox", () => $af04e099a53d3e85$export$48513f6b9f8ce62d);
/*
 * Copyright 2024 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 











const $af04e099a53d3e85$export$b085522c77523c51 = /*#__PURE__*/ (0, $gg2RS$react.createContext)(null);
const $af04e099a53d3e85$var$wrapper = function anonymous(props, overrides) {
    let rules = " ";
    let position = false;
    let width = false;
    let gridColumnStart = false;
    let matches = String(overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "_P") position = true;
        if (p[1] === "Z") width = true;
        if (p[1] === "z") gridColumnStart = true;
        rules += p[0];
    }
    rules += ' sd12';
    if (!position) rules += ' _Pc12';
    rules += ' qf12';
    rules += ' ea12';
    if (!width) rules += ' ZJ12';
    if (props.size === "XL") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "L") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "S") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "XS") {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else {
        rules += ' uk12';
        rules += ' ucJ9TBTb12';
        rules += ' ud3Euai12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    } else if (props.size === "XS") {
        rules += ' -_6BNtrc-a12';
        rules += ' vx12';
    } else {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    }
    if (props.size === "XL") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "L") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "S") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "XS") {
        rules += ' xb12';
        rules += ' _xa12';
    } else {
        rules += ' xb12';
        rules += ' _xa12';
    }
    if (props.size === "XL") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "L") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "S") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "XS") {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    } else {
        rules += ' _Fd12';
        rules += ' _FnuYUweb12';
    }
    if (props.isDisabled) {
        rules += ' pp12';
        rules += ' plc12';
    } else {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    }
    rules += ' Yc12';
    rules += ' Xb12';
    rules += ' _2b12';
    if (props.isInForm) {
        if (!gridColumnStart) rules += ' zhJUGr12';
    }
    rules += ' __ca12';
    return rules;
};
const $af04e099a53d3e85$export$827f4ee28efc37 = function anonymous(props) {
    let rules = " ";
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' Olc12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec12';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn12';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b12';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd12';
    else rules += ' -SFnbic-_Jb12';
    rules += ' -Bu7z1c-oa12';
    rules += ' oj12';
    rules += ' nj12';
    rules += ' kj12';
    rules += ' jj12';
    if (props.size === "XL") rules += ' Zm12';
    else if (props.size === "L") rules += ' Zl12';
    else if (props.size === "S") rules += ' Zk12';
    else rules += ' Zu12';
    if (props.size === "XL") rules += ' Fn12';
    else if (props.size === "L") rules += ' Fm12';
    else if (props.size === "S") rules += ' Fl12';
    else rules += ' Ft12';
    rules += ' _va12';
    rules += ' sd12';
    rules += ' eb12';
    rules += ' _Ca12';
    rules += ' _k7m7Gv12';
    rules += ' h7m7Gv12';
    rules += ' m7m7Gv12';
    rules += ' l7m7Gv12';
    rules += ' _oa12';
    rules += ' _jf12';
    rules += ' Yd12';
    rules += ' Xb12';
    rules += ' _2b12';
    rules += ' _yb12';
    if (props.isSelected) {
        if (props.isDisabled) {
            rules += ' gw12';
            rules += ' gld12';
        } else if (props.isInvalid) {
            if (props.isPressed) rules += ' gt12';
            else if (props.isFocusVisible) rules += ' gt12';
            else if (props.isHovered) rules += ' gt12';
            else rules += ' g_d12';
            rules += ' gl_b12';
        } else {
            if (props.isEmphasized) {
                if (props.isPressed) rules += ' gY12';
                else if (props.isFocusVisible) rules += ' gY12';
                else if (props.isHovered) rules += ' gY12';
                else rules += ' g312';
            } else {
                if (props.isPressed) rules += ' gu12';
                else if (props.isFocusVisible) rules += ' gu12';
                else if (props.isHovered) rules += ' gu12';
                else rules += ' g012';
            }
            rules += ' gle12';
        }
    } else {
        rules += ' gX12';
        rules += ' gla12';
    }
    if (props.isSelected) rules += ' iA12';
    else if (props.isDisabled) {
        rules += ' io12';
        rules += ' ilc12';
    } else if (props.isInvalid) {
        if (props.isPressed) rules += ' im12';
        else if (props.isFocusVisible) rules += ' im12';
        else if (props.isHovered) rules += ' im12';
        else rules += ' ip12';
        rules += ' ile12';
    } else {
        if (props.isPressed) rules += ' in12';
        else if (props.isFocusVisible) rules += ' in12';
        else if (props.isHovered) rules += ' in12';
        else rules += ' iv12';
        rules += ' ila12';
    }
    return rules;
};
const $af04e099a53d3e85$export$2c99b98b77550cb4 = " _Ob12 -_8sjo0b-txpP0Sb12 -_8sjo0b-lt8pvGJ12";
const $af04e099a53d3e85$var$iconSize = {
    S: 'XS',
    M: 'S',
    L: 'M',
    XL: 'L'
};
const $af04e099a53d3e85$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $gg2RS$react.forwardRef)(function Checkbox({ children: children, ...props }, ref) {
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $af04e099a53d3e85$export$b085522c77523c51);
    let boxRef = (0, $gg2RS$react.useRef)(null);
    let inputRef = (0, $gg2RS$react.useRef)(null);
    let domRef = (0, $150382364eecc4bc$exports.useFocusableRef)(ref, inputRef);
    let isInForm = !!(0, $gg2RS$react.useContext)((0, $bfa4962d90c8af48$exports.FormContext));
    props = (0, $bfa4962d90c8af48$exports.useFormProps)(props);
    let isInCheckboxGroup = !!(0, $gg2RS$react.useContext)((0, $gg2RS$reactariacomponentsCheckboxGroup.CheckboxGroupStateContext));
    let ctx = (0, $gg2RS$reactariacomponentsslots.useSlottedContext)($af04e099a53d3e85$export$b085522c77523c51, props.slot);
    return /*#__PURE__*/ (0, $gg2RS$reactjsxruntime.jsx)((0, $gg2RS$reactariacomponentsCheckbox.Checkbox), {
        ...props,
        ref: domRef,
        inputRef: inputRef,
        style: props.UNSAFE_style,
        className: (renderProps)=>(props.UNSAFE_className || '') + $af04e099a53d3e85$var$wrapper({
                ...renderProps,
                isInForm: isInForm,
                size: props.size || 'M'
            }, props.styles),
        children: (renderProps)=>{
            let checkbox = /*#__PURE__*/ (0, $gg2RS$reactjsxruntime.jsxs)("div", {
                ref: boxRef,
                style: (0, $2061c83559b50a66$exports.pressScale)(boxRef)(renderProps),
                className: $af04e099a53d3e85$export$827f4ee28efc37({
                    ...renderProps,
                    isSelected: renderProps.isSelected || renderProps.isIndeterminate,
                    size: props.size || 'M',
                    isEmphasized: isInCheckboxGroup ? ctx?.isEmphasized : props.isEmphasized
                }),
                children: [
                    renderProps.isIndeterminate && /*#__PURE__*/ (0, $gg2RS$reactjsxruntime.jsx)((0, $84c37b7bd5c1374e$exports.default), {
                        size: $af04e099a53d3e85$var$iconSize[props.size || 'M'],
                        className: $af04e099a53d3e85$export$2c99b98b77550cb4
                    }),
                    renderProps.isSelected && !renderProps.isIndeterminate && /*#__PURE__*/ (0, $gg2RS$reactjsxruntime.jsx)((0, $dba2b18fc5727f9b$exports.default), {
                        size: $af04e099a53d3e85$var$iconSize[props.size || 'M'],
                        className: $af04e099a53d3e85$export$2c99b98b77550cb4
                    })
                ]
            });
            // Only render checkbox without center baseline if no label.
            // This avoids expanding the checkbox height to the font's line height.
            if (!children) return checkbox;
            return /*#__PURE__*/ (0, $gg2RS$reactjsxruntime.jsxs)((0, $gg2RS$reactjsxruntime.Fragment), {
                children: [
                    /*#__PURE__*/ (0, $gg2RS$reactjsxruntime.jsx)((0, $e991cbcdf82ced71$exports.CenterBaseline), {
                        children: checkbox
                    }),
                    children
                ]
            });
        }
    });
});


//# sourceMappingURL=Checkbox.cjs.map
