require("./CloseButton.css");
var $89dd175101ffc43a$exports = require("./Cross.cjs");
var $4526404114e78c80$exports = require("./intlStrings.cjs");
var $2061c83559b50a66$exports = require("./pressScale.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $bMS5K$reactjsxruntime = require("react/jsx-runtime");
var $bMS5K$reactariacomponents = require("react-aria-components");
var $bMS5K$react = require("react");
var $bMS5K$reactspectrumutils = require("@react-spectrum/utils");
var $bMS5K$reactariai18n = require("@react-aria/i18n");


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}

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

$parcel$export(module.exports, "CloseButton", () => $2f907cb84c6e9e75$export$de65de8213222d10);
/*
 * 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 $2f907cb84c6e9e75$var$hoverBackground = {
    default: 'gray-200',
    isStaticColor: 'transparent-overlay-200'
};
const $2f907cb84c6e9e75$var$styles = function anonymous(props, overrides) {
    let rules = " ";
    let width = false;
    let flexShrink = 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] === "Z") width = true;
        if (p[1] === "_v") flexShrink = true;
        rules += p[0];
    }
    if (props.isFocusVisible) rules += ' _Lf11';
    else rules += ' _Le11';
    if (props.isStaticColor) rules += ' Oe11';
    else rules += ' Oh11';
    rules += ' Olc11';
    rules += ' _Mc11';
    rules += ' _Kd11';
    if (props.staticColor === "white") rules += ' -Ovbhqd-gcwrnr11';
    else if (props.staticColor === "black") rules += ' -Ovbhqd-g4hn3s11';
    rules += ' sd11';
    rules += ' eb11';
    rules += ' _Ca11';
    if (props.size === "XL") {
        if (!width) rules += ' ZF11';
    } else if (props.size === "L") {
        if (!width) rules += ' Zw11';
    } else if (props.size === "S") {
        if (!width) rules += ' Zo11';
    } else if (props.size === "XS") {
        if (!width) rules += ' Zm11';
    } else if (!width) rules += ' ZC11';
    if (props.size === "XL") rules += ' Fz11';
    else if (props.size === "L") rules += ' Fv11';
    else if (props.size === "S") rules += ' Fp11';
    else if (props.size === "XS") rules += ' Fn11';
    else rules += ' Fx11';
    if (!flexShrink) rules += ' _va11';
    rules += ' og11';
    rules += ' ng11';
    rules += ' kg11';
    rules += ' jg11';
    rules += ' Td11';
    rules += ' Qd11';
    rules += ' Sd11';
    rules += ' Rd11';
    rules += ' _je11';
    rules += ' Yd11';
    rules += ' Xb11';
    rules += ' _2b11';
    if (props.isPressed) {
        if (props.isStaticColor) rules += ' gg11';
        else rules += ' gF11';
    } else if (props.isFocusVisible) {
        if (props.isStaticColor) rules += ' gg11';
        else rules += ' gF11';
    } else if (props.isHovered) {
        if (props.isStaticColor) rules += ' gg11';
        else rules += ' gF11';
    } else rules += ' g911';
    if (props.isStaticColor) {
        if (props.isDisabled) rules += ' -_8sjo0b-pi11';
        else {
            if (props.isPressed) rules += ' -_8sjo0b-pk11';
            else if (props.isFocusVisible) rules += ' -_8sjo0b-pk11';
            else if (props.isHovered) rules += ' -_8sjo0b-pk11';
            else rules += ' -_8sjo0b-pj11';
        }
    } else if (props.isDisabled) rules += ' -_8sjo0b-pp11';
    else {
        if (props.isPressed) rules += ' -_8sjo0b-po11';
        else if (props.isFocusVisible) rules += ' -_8sjo0b-po11';
        else if (props.isHovered) rules += ' -_8sjo0b-po11';
        else rules += ' -_8sjo0b-pt11';
    }
    if (props.isDisabled) rules += ' -_8sjo0b-lpc11';
    else rules += ' -_8sjo0b-lpb11';
    rules += ' __ca11';
    return rules;
};
const $2f907cb84c6e9e75$export$c796eec99a15b55d = /*#__PURE__*/ (0, $bMS5K$react.createContext)(null);
const $2f907cb84c6e9e75$export$de65de8213222d10 = /*#__PURE__*/ (0, $bMS5K$react.forwardRef)(function CloseButton(props, ref) {
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $2f907cb84c6e9e75$export$c796eec99a15b55d);
    let { UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
    let domRef = (0, $bMS5K$reactspectrumutils.useFocusableRef)(ref);
    let stringFormatter = (0, $bMS5K$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    return /*#__PURE__*/ (0, $bMS5K$reactjsxruntime.jsx)((0, $bMS5K$reactariacomponents.Button), {
        ...props,
        ref: domRef,
        slot: "close",
        "aria-label": props['aria-label'] || stringFormatter.format('dialog.dismiss'),
        style: (0, $2061c83559b50a66$exports.pressScale)(domRef, UNSAFE_style),
        className: (renderProps)=>UNSAFE_className + $2f907cb84c6e9e75$var$styles({
                ...renderProps,
                staticColor: props.staticColor,
                isStaticColor: !!props.staticColor
            }, props.styles),
        children: /*#__PURE__*/ (0, $bMS5K$reactjsxruntime.jsx)((0, $89dd175101ffc43a$exports.default), {
            size: {
                S: 'L',
                M: 'XL',
                L: 'XXL',
                XL: 'XXXL'
            }[props.size || 'M']
        })
    });
});


//# sourceMappingURL=CloseButton.cjs.map
