import "./CheckboxGroup.css";
import {CheckboxContext as $9b405e0f8095dce0$export$b085522c77523c51} from "./Checkbox.mjs";
import {FieldLabel as $9afd80978c252040$export$1acdcf5a973a8414, HelpText as $9afd80978c252040$export$a67c0bc59081311a} from "./Field.mjs";
import {FormContext as $9b916426527cebe7$export$c24727297075ec6a, useFormProps as $9b916426527cebe7$export$a6b5be5c6b451665} from "./Form.mjs";
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
import {jsx as $2n9bC$jsx, jsxs as $2n9bC$jsxs, Fragment as $2n9bC$Fragment} from "react/jsx-runtime";
import {CheckboxGroup as $2n9bC$CheckboxGroup} from "react-aria-components";
import {createContext as $2n9bC$createContext, forwardRef as $2n9bC$forwardRef, useContext as $2n9bC$useContext} from "react";
import {useDOMRef as $2n9bC$useDOMRef} from "@react-spectrum/utils";

/*
 * 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 $4f43ac2b11e2df05$export$baf37c4be89255b8 = /*#__PURE__*/ (0, $2n9bC$createContext)(null);
const $4f43ac2b11e2df05$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $2n9bC$forwardRef)(function CheckboxGroup(props, ref) {
    [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $4f43ac2b11e2df05$export$baf37c4be89255b8);
    let formContext = (0, $2n9bC$useContext)((0, $9b916426527cebe7$export$c24727297075ec6a));
    props = (0, $9b916426527cebe7$export$a6b5be5c6b451665)(props);
    let { label: label, description: description, errorMessage: errorMessage, children: children, labelPosition: labelPosition = 'top', labelAlign: labelAlign = 'start', necessityIndicator: necessityIndicator = 'icon', size: size = 'M', orientation: orientation = 'vertical', UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, isEmphasized: isEmphasized, ...groupProps } = props;
    let domRef = (0, $2n9bC$useDOMRef)(ref);
    return /*#__PURE__*/ (0, $2n9bC$jsx)((0, $2n9bC$CheckboxGroup), {
        ...groupProps,
        ref: domRef,
        style: UNSAFE_style,
        className: UNSAFE_className + function anonymous(props, overrides) {
            let rules = " ";
            let gridColumnStart = false;
            let gridColumnEnd = false;
            let matches = (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] === "z") gridColumnStart = true;
                if (p[1] === "y") gridColumnEnd = true;
                rules += p[0];
            }
            rules += ' se1';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU1';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG1';
                }
            }
            if (props.isInForm) rules += ' DLwlgod1';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb1';
                else if (props.labelPosition === "top") rules += ' DM8Mfn1';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb1';
            else if (props.labelPosition === "top") rules += ' E4w1sLc1';
            if (props.labelPosition === "side") rules += ' CbRM95c1';
            else if (props.labelPosition === "top") rules += ' Cxaocre1';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e1';
                rules += ' vx1';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d1';
                rules += ' vx1';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b1';
                rules += ' vx1';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a1';
                rules += ' vx1';
            } else {
                rules += ' -_6BNtrc-c1';
                rules += ' vx1';
            }
            rules += ' ea1';
            rules += ' _Fd1';
            rules += ' _FnuYUweb1';
            if (props.size === "XL") rules += ' -BhX7R-Fz1';
            else if (props.size === "L") rules += ' -BhX7R-Fv1';
            else if (props.size === "S") rules += ' -BhX7R-Fp1';
            else if (props.size === "XS") rules += ' -BhX7R-Fn1';
            else rules += ' -BhX7R-Fx1';
            rules += ' -AJjOLd-UVxyPec1';
            rules += ' qg1';
            rules += ' __ca1';
            return rules;
        }({
            size: props.size,
            labelPosition: labelPosition,
            isInForm: !!formContext
        }, props.styles),
        children: ({ isDisabled: isDisabled, isInvalid: isInvalid })=>/*#__PURE__*/ (0, $2n9bC$jsxs)((0, $2n9bC$Fragment), {
                children: [
                    /*#__PURE__*/ (0, $2n9bC$jsx)((0, $9afd80978c252040$export$1acdcf5a973a8414), {
                        includeNecessityIndicatorInAccessibilityName: true,
                        isDisabled: isDisabled,
                        isRequired: props.isRequired,
                        size: size,
                        labelPosition: labelPosition,
                        labelAlign: labelAlign,
                        necessityIndicator: necessityIndicator,
                        contextualHelp: props.contextualHelp,
                        children: label
                    }),
                    /*#__PURE__*/ (0, $2n9bC$jsx)("div", {
                        className: function anonymous(props) {
                            let rules = " ";
                            rules += ' zXcEWr1';
                            rules += ' yXcEWr1';
                            rules += ' BXcEWr1';
                            rules += ' AXcEWr1';
                            rules += ' sd1';
                            if (props.orientation === "horizontal") rules += ' _tc1';
                            else if (props.orientation === "vertical") rules += ' _ta1';
                            rules += ' _Fd1';
                            rules += ' _FnuYUweb1';
                            rules += ' UgOnRt1';
                            rules += ' ql1';
                            rules += ' _wb1';
                            return rules;
                        }({
                            orientation: orientation
                        }),
                        children: /*#__PURE__*/ (0, $2n9bC$jsx)((0, $9b916426527cebe7$export$c24727297075ec6a).Provider, {
                            value: {
                                ...formContext,
                                size: size,
                                isRequired: undefined
                            },
                            children: /*#__PURE__*/ (0, $2n9bC$jsx)((0, $9b405e0f8095dce0$export$b085522c77523c51).Provider, {
                                value: {
                                    isEmphasized: isEmphasized
                                },
                                children: children
                            })
                        })
                    }),
                    /*#__PURE__*/ (0, $2n9bC$jsx)((0, $9afd80978c252040$export$a67c0bc59081311a), {
                        size: size,
                        isDisabled: isDisabled,
                        isInvalid: isInvalid,
                        description: description,
                        showErrorIcon: true,
                        children: errorMessage
                    })
                ]
            })
    });
});


export {$4f43ac2b11e2df05$export$baf37c4be89255b8 as CheckboxGroupContext, $4f43ac2b11e2df05$export$4aa08d5625cb8ead as CheckboxGroup};
//# sourceMappingURL=CheckboxGroup.mjs.map
