import { jsx } from "react/jsx-runtime";
import classNames from "classnames";
import { getHeadingVariantFromSemanticType, getSpacingClasses } from "../utils/utils.mjs";
import '../../styles/components/heading.css';/* empty css              */
const Heading = ({
  children,
  as,
  size,
  variant,
  spacing,
  className,
  ...rest
}) => {
  const HeadingElement = as || "h1";
  const usedVariant = variant ?? getHeadingVariantFromSemanticType(HeadingElement);
  const shouldUseSize = size !== void 0;
  return /* @__PURE__ */ jsx(
    HeadingElement,
    {
      className: classNames(
        "eds-heading",
        // Only apply variant if size is not specified
        { [`eds-heading--${usedVariant}`]: !shouldUseSize },
        // Size takes precedence when specified
        { [`eds-heading--${size}`]: shouldUseSize && size },
        getSpacingClasses(spacing, "eds-heading"),
        className
      ),
      ...rest,
      children
    }
  );
};
export {
  Heading
};
//# sourceMappingURL=Heading.mjs.map
