import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { c as cn } from './utils-BJnb9o5c.js';
import { Empty as Empty$1, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from './primitives/Empty.js';
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './primitives/Tooltip.js';
import { r as renderIcon } from './renderIcon-C6twJSqH.js';
import { T as Typography } from './Typography-CmILccNh.js';
import { b as Button } from './Button-DV9xCqlc.js';

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

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