'use strict';
import { jsx } from 'react/jsx-runtime';
import { Link } from '../link/Link.js';
import { buttonVariants } from '../button/Button.js';
import { Icon, iconSizes, iconNames } from '../icon/Icon.js';
import { Tooltip } from '../tooltip/Tooltip.js';
import { cn } from '../../../fd-toolbox/lib/utils.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function BackButton({
  id,
  variant,
  size,
  className,
  href,
  onClick
}) {
  return /* @__PURE__ */jsx(Tooltip, {
    content: "Go Back",
    side: "top",
    className: "mb-1",
    children: /* @__PURE__ */jsx(Link, {
      href: href ?? "view?resource=Contact",
      id,
      className: cn(buttonVariants({
        variant: variant ?? "ghost",
        size: size ?? "icon"
      }), className ?? "size-5"),
      onClick: e => onBackButtonClick(e, onClick),
      children: /* @__PURE__ */jsx(Icon, {
        name: iconNames.arrowLeft,
        size: iconSizes.small
      })
    })
  });
}
__name(BackButton, "BackButton");
function onBackButtonClick(event, onClick) {
  if (onClick) {
    event.preventDefault();
    event.stopPropagation();
    onClick();
  }
}
__name(onBackButtonClick, "onBackButtonClick");

export { BackButton };
