import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { c as cn } from './utils-DdHUxIdC.js';
import { Empty as Empty$1, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from './primitives/Empty.js';
import { B as Button } from './Button-DSvnInaL.js';
import { T as Typography } from './Typography-ClPJbLjP.js';
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './primitives/Tooltip.js';
import { r as renderIcon } from './renderIcon-tlvMyboj.js';

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

export { Empty as E };
//# sourceMappingURL=Empty-zyL2ZsHX.js.map
