'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var utils = require('./utils-BhM0B89p.js');
var primitives_Empty = require('./primitives/Empty.js');
var primitives_Tooltip = require('./primitives/Tooltip.js');
var renderIcon = require('./renderIcon-BRrpZu9a.js');
var Typography = require('./Typography-BW6xEk10.js');
var Button = require('./Button-8VH9p9RB.js');

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

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