'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var utils = require('./utils-CTr7wn5d.js');
var primitives_Empty = require('./primitives/Empty.js');
var Button = require('./Button-BniJ4TT_.js');
var Typography = require('./Typography-DaZ0HTha.js');
var primitives_Tooltip = require('./primitives/Tooltip.js');
var renderIcon = require('./renderIcon-fLF3odqg.js');

function MaybeTooltipButton({ buttonProps, showTooltipWhenDisabled, defaultVariant, }) {
    const button = jsxRuntime.jsx(Button.Button, { variant: defaultVariant, ...buttonProps });
    if (showTooltipWhenDisabled && buttonProps.disabled && buttonProps.label) {
        return (jsxRuntime.jsx(primitives_Tooltip.TooltipProvider, { delayDuration: 0, children: jsxRuntime.jsxs(primitives_Tooltip.Tooltip, { children: [jsxRuntime.jsx(primitives_Tooltip.TooltipTrigger, { asChild: true, children: jsxRuntime.jsx("span", { className: "inline-flex", children: button }) }), jsxRuntime.jsx(primitives_Tooltip.TooltipContent, { children: buttonProps.label })] }) }));
    }
    return button;
}
const Empty = React.forwardRef(({ image, icon, title, description, helpText, primaryButtonProps, secondaryButtonProps, buttonSeparatorText, showTooltipWhenButtonDisabled = false, className, ...otherProps }, ref) => {
    const hasMedia = image || icon;
    const hasButtons = primaryButtonProps || secondaryButtonProps;
    return (jsxRuntime.jsxs(primitives_Empty.Empty, { ref: ref, className: utils.cn(className), ...otherProps, children: [jsxRuntime.jsxs(primitives_Empty.EmptyHeader, { children: [hasMedia && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [image && (jsxRuntime.jsx(primitives_Empty.EmptyMedia, { children: typeof image === "string" ? (jsxRuntime.jsx("img", { src: image, alt: title ?? "" })) : (image) })), !image && icon && (jsxRuntime.jsx(primitives_Empty.EmptyMedia, { variant: "icon", children: renderIcon.renderIcon(icon) }))] })), title && (jsxRuntime.jsx(Typography.Typography, { variant: "h4", asChild: true, children: jsxRuntime.jsx(primitives_Empty.EmptyTitle, { children: title }) })), description && (jsxRuntime.jsx(Typography.Typography, { variant: "body3", color: "muted", asChild: true, children: jsxRuntime.jsx(primitives_Empty.EmptyDescription, { children: description }) })), helpText && (jsxRuntime.jsx(Typography.Typography, { variant: "body3", color: "muted", asChild: true, children: jsxRuntime.jsx("p", { children: helpText }) }))] }), hasButtons && (jsxRuntime.jsx(primitives_Empty.EmptyContent, { children: jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [primaryButtonProps && (jsxRuntime.jsx(MaybeTooltipButton, { buttonProps: primaryButtonProps, showTooltipWhenDisabled: showTooltipWhenButtonDisabled, defaultVariant: "default" })), buttonSeparatorText &&
                            primaryButtonProps &&
                            secondaryButtonProps && (jsxRuntime.jsx(Typography.Typography, { variant: "body3", color: "muted", asChild: true, children: jsxRuntime.jsx("span", { children: buttonSeparatorText }) })), secondaryButtonProps && (jsxRuntime.jsx(MaybeTooltipButton, { buttonProps: secondaryButtonProps, showTooltipWhenDisabled: showTooltipWhenButtonDisabled, defaultVariant: "outline" }))] }) }))] }));
});
Empty.displayName = "Empty";

exports.Empty = Empty;
//# sourceMappingURL=Empty-CfPLWsLK.js.map
