import assert from "assert";
import clsx from "clsx";
import { useContext } from "react";
import { atoms } from "../../css/atoms/atoms.mjs";
import { HeadingContext } from "../Heading/Heading.mjs";
import { TextContext } from "../Accordion/AccordionItem.mjs";
import { size, inlineCrop, inline, alignY } from "../../hooks/useIcon/icon.css.mjs";
const iconInlineSize = ({
  alignY: alignY$1 = "uppercase",
  verticalCorrection = "none"
} = {}) => clsx(
  atoms({
    display: "inlineBlock",
    position: "relative"
  }),
  size,
  inlineCrop,
  inline,
  alignY[alignY$1][verticalCorrection]
);
const IconRenderer = ({ children }) => {
  const textContext = useContext(TextContext);
  const headingContext = useContext(HeadingContext);
  assert(
    Boolean(textContext || headingContext),
    `IconRenderer must be inside either a \`Text\` or \`Heading\` component.`
  );
  return children({ className: iconInlineSize() });
};
export {
  IconRenderer,
  iconInlineSize
};
