// packages/components/src/card/card/hook.ts
import deprecated from "@wordpress/deprecated";
import { useMemo } from "@wordpress/element";
import { useContextSystem } from "../../context/index.js";
import { useSurface } from "../../surface/index.js";
import * as styles from "../styles.js";
import { useCx } from "../../utils/hooks/use-cx.js";
function useDeprecatedProps({
  elevation,
  isElevated,
  ...otherProps
}) {
  const propsToReturn = {
    ...otherProps
  };
  let computedElevation = elevation;
  if (isElevated) {
    var _computedElevation;
    deprecated("Card isElevated prop", {
      since: "5.9",
      alternative: "elevation"
    });
    (_computedElevation = computedElevation) !== null && _computedElevation !== void 0 ? _computedElevation : computedElevation = 2;
  }
  if (typeof computedElevation !== "undefined") {
    propsToReturn.elevation = computedElevation;
  }
  return propsToReturn;
}
function useCard(props) {
  const {
    className,
    elevation = 0,
    isBorderless = false,
    isRounded = true,
    size = "medium",
    ...otherProps
  } = useContextSystem(useDeprecatedProps(props), "Card");
  const cx = useCx();
  const classes = useMemo(() => {
    return cx(styles.Card, isBorderless && styles.boxShadowless, isRounded && styles.rounded, className);
  }, [className, cx, isBorderless, isRounded]);
  const surfaceProps = useSurface({
    ...otherProps,
    className: classes
  });
  return {
    ...surfaceProps,
    elevation,
    isBorderless,
    isRounded,
    size
  };
}
export {
  useCard
};
//# sourceMappingURL=hook.js.map
