"use strict";
var import_Elevation = require("../../Elevation.css");
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const kit_Theme_UI = require("../Theme/UI.cjs");
require("../Theme/themeUtils.cjs");
require("../Theme/themes.cjs");
const elevationBase = "Elevation_elevationBase_0cfd1";
const hover = "Elevation_hover_0cfd1";
const border = "Elevation_border_0cfd1";
const css = {
  "elevation-0": "Elevation_elevation-0_0cfd1",
  "elevation-1": "Elevation_elevation-1_0cfd1",
  "elevation-2": "Elevation_elevation-2_0cfd1",
  "elevation-3": "Elevation_elevation-3_0cfd1",
  "elevation-4": "Elevation_elevation-4_0cfd1",
  elevationBase,
  hover,
  border
};
const ElevationWrapper = ({
  border: border2 = false,
  children,
  className,
  elevationOverride,
  hover: hover2 = false,
  ...props
}) => {
  const {
    themeSettings: { className: themeClass }
  } = kit_Theme_UI.useTheme();
  const { elevationClass, nextElevation } = useElevation({
    elevationOverride
  });
  const classes = [themeClass, className, css.elevationBase, elevationClass];
  if (hover2)
    classes.push(css.hover);
  if (border2)
    classes.push(css.border);
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.join(" "), ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ElevationContext.Provider, { value: nextElevation, children }) });
};
const ElevationContext = React.createContext(1);
const useElevation = ({ elevationOverride } = {}) => {
  let currentElevation = React.useContext(ElevationContext);
  if (elevationOverride !== void 0)
    currentElevation = elevationOverride;
  return React.useMemo(
    () => ({
      currentElevation,
      elevationClass: css[`elevation-${currentElevation}`],
      nextElevation: Math.min(currentElevation + 1, 4)
    }),
    [currentElevation]
  );
};
exports.ElevationContext = ElevationContext;
exports.ElevationWrapper = ElevationWrapper;
exports.useElevation = useElevation;
