require("./ContextualHelp.css");
var $6e265ff388155b91$exports = require("./ActionButton.cjs");
var $6367bc87eb7d24ad$exports = require("./Content.cjs");
var $0f4636c7093b9233$exports = require("./Dialog.cjs");
var $1ed1734de3fc1075$exports = require("./DialogTrigger.cjs");
var $4a13db583e3ec6e0$exports = require("../icons/HelpCircle.cjs");
var $0ed6e07b499b9797$exports = require("../icons/InfoCircle.cjs");
var $4526404114e78c80$exports = require("./intlStrings.cjs");
var $308b180f49d82d28$exports = require("../icons/runtime.cjs");
var $493371ef39bf7a55$exports = require("./Popover.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $44GE8$reactjsxruntime = require("react/jsx-runtime");
var $44GE8$reactariacomponents = require("react-aria-components");
var $44GE8$react = require("react");
var $44GE8$reactariautils = require("@react-aria/utils");
var $44GE8$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, "ContextualHelpPopover", () => $bab829476f85a155$export$218201d297fb4e0d);
$parcel$export(module.exports, "ContextualHelpContext", () => $bab829476f85a155$export$41b9afaaba473494);
$parcel$export(module.exports, "ContextualHelp", () => $bab829476f85a155$export$7d3cdb256c2ba320);















const $bab829476f85a155$var$wrappingDiv = " NOBje7c11 ZOBje7c11 Th11 Qh11 Sh11 Rh11 _oa11 Fb11";
const $bab829476f85a155$var$headingStyles = " uk11 ucJ9TBTb11 ud3Euai11 uea11 ugb11 uhd11 uje11 u2NhKxcl11 uic11 -_6BNtrc-e11 vx11 xe11 _xa11 xX0cczbd11 _xX0cczba11 xfe11 _xfa11 xfX0cczbd11 _xfX0cczba11 _Fd11 _FnuYUweb11 po11 Jy11 Gv11 Iy11 Hy11";
function $bab829476f85a155$export$218201d297fb4e0d(props) {
    let { children: children, ...popoverProps } = props;
    let titleId = (0, $44GE8$reactariautils.useId)();
    return /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsx)((0, $493371ef39bf7a55$exports.Popover), {
        padding: "none",
        hideArrow: true,
        "aria-labelledby": titleId,
        ...popoverProps,
        children: /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsx)("div", {
            className: $bab829476f85a155$var$wrappingDiv,
            children: /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsx)("div", {
                className: (0, $308b180f49d82d28$exports.mergeStyles)((0, $0f4636c7093b9233$exports.dialogInner), " od11 nd11 kd11 jd11 Jnqb3Ob11 Gnqb3Ob11 Inqb3Ob11 Hnqb3Ob11 TjCFGYc11 Qh11 Sh11 Rh11 -T_-Th11"),
                children: /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsx)((0, $44GE8$reactariacomponents.Provider), {
                    values: [
                        [
                            (0, $44GE8$reactariacomponents.TextContext),
                            {
                                slots: {
                                    [(0, $44GE8$reactariacomponents.DEFAULT_SLOT)]: {}
                                }
                            }
                        ],
                        // Make sure to clear context from above Menu
                        [
                            (0, $6367bc87eb7d24ad$exports.TextContext),
                            null
                        ],
                        [
                            (0, $6367bc87eb7d24ad$exports.HeadingContext),
                            {
                                styles: $bab829476f85a155$var$headingStyles,
                                slots: {
                                    // needed so combobox/picker does not need to provide slot="title" to their provided
                                    // ContextualHelp (they get the aria-labelled by from the button)
                                    // otherwise, use the heading if available aka unavaiable menu item
                                    [(0, $44GE8$reactariacomponents.DEFAULT_SLOT)]: {
                                        styles: $bab829476f85a155$var$headingStyles
                                    },
                                    title: {
                                        id: titleId,
                                        styles: $bab829476f85a155$var$headingStyles,
                                        level: 2
                                    }
                                }
                            }
                        ],
                        [
                            (0, $6367bc87eb7d24ad$exports.ContentContext),
                            {
                                styles: " uk11 ucJ9TBTb11 ud3Euai11 uea11 ugb11 uhd11 uje11 u2NhKxcl11 uic11 -_6BNtrc-c11 vx11 xb11 _xa11 _Fb11 _FnuYUwec11 pt11"
                            }
                        ],
                        [
                            (0, $6367bc87eb7d24ad$exports.FooterContext),
                            {
                                styles: " uk11 ucJ9TBTb11 ud3Euai11 uea11 ugb11 uhd11 uje11 u2NhKxcl11 uic11 -_6BNtrc-c11 vx11 xb11 _xa11 _Fb11 _FnuYUwec11 pt11 JC11"
                            }
                        ]
                    ],
                    children: children
                })
            })
        })
    });
}
const $bab829476f85a155$export$41b9afaaba473494 = /*#__PURE__*/ (0, $44GE8$react.createContext)(null);
const $bab829476f85a155$export$7d3cdb256c2ba320 = /*#__PURE__*/ (0, $44GE8$react.forwardRef)(function ContextualHelp(props, ref) {
    let stringFormatter = (0, $44GE8$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $bab829476f85a155$export$41b9afaaba473494);
    let { children: children, defaultOpen: defaultOpen, containerPadding: containerPadding = 8, size: size = 'XS', crossOffset: crossOffset, isOpen: isOpen, onOpenChange: onOpenChange, placement: placement = 'bottom start', shouldFlip: shouldFlip, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style, styles: styles, variant: variant = 'help' } = props;
    // In a FieldLabel we're getting the context's aria-labeledby, so we need to
    // manually set the aria-label after useLabels() to keep the order of label
    // then ContextualHelp variant
    let labelProps = (0, $44GE8$reactariautils.useLabels)(props);
    let label = stringFormatter.format(`contextualhelp.${variant}`);
    labelProps['aria-label'] = labelProps['aria-label'] ? labelProps['aria-label'] + ' ' + label : label;
    let buttonProps = (0, $44GE8$reactariautils.filterDOMProps)(props, {
        labelable: true
    });
    return /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsxs)((0, $1ed1734de3fc1075$exports.DialogTrigger), {
        isOpen: isOpen,
        defaultOpen: defaultOpen,
        onOpenChange: onOpenChange,
        children: [
            /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsx)((0, $6e265ff388155b91$exports.ActionButton), {
                slot: null,
                ref: ref,
                size: size,
                ...(0, $44GE8$reactariautils.mergeProps)(buttonProps, labelProps),
                UNSAFE_style: UNSAFE_style,
                UNSAFE_className: UNSAFE_className,
                styles: styles,
                isQuiet: true,
                children: variant === 'info' ? /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsx)((0, $0ed6e07b499b9797$exports.default), {}) : /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsx)((0, $4a13db583e3ec6e0$exports.default), {})
            }),
            /*#__PURE__*/ (0, $44GE8$reactjsxruntime.jsx)($bab829476f85a155$export$218201d297fb4e0d, {
                placement: placement,
                shouldFlip: shouldFlip,
                containerPadding: containerPadding,
                offset: 8,
                crossOffset: crossOffset,
                children: children
            })
        ]
    });
});


//# sourceMappingURL=ContextualHelp.cjs.map
