import _JSXStyle from "styled-jsx/style";
// Generated with util/create-component.js
import React, { forwardRef } from "react";
import classnames from "classnames";
import useTheme from "../../hooks/useTheme";
import { getBreakpoints } from "../Flex/Flex.functions";
import { jsx as _jsx } from "react/jsx-runtime";
export const Spacing = /*#__PURE__*/forwardRef((props, ref) => {
  const theme = useTheme();
  const {
    height,
    width,
    className = null,
    ...otherProps
  } = props;

  function handleValue(value) {
    return value ? typeof value === "number" ? `${value * theme.layout.spacingUnit}px` : value : "0px";
  }

  return /*#__PURE__*/_jsx("div", {
    "data-testid": "Wps-Spacing",
    ref: ref,
    ...otherProps,
    className: _JSXStyle.dynamic([["2706545261", [width ? getBreakpoints(width, "xs", handleValue) : "100%", height ? getBreakpoints(height, "xs", handleValue) : "100%", theme.breakpoints.sm.min, width ? getBreakpoints(width, "sm", handleValue) : "100%", height ? getBreakpoints(height, "sm", handleValue) : "100%", theme.breakpoints.md.min, width ? getBreakpoints(width, "md", handleValue) : "100%", height ? getBreakpoints(height, "md", handleValue) : "100%", theme.breakpoints.lg.min, width ? getBreakpoints(width, "lg", handleValue) : "100%", height ? getBreakpoints(height, "lg", handleValue) : "100%", theme.breakpoints.xl.min, width ? getBreakpoints(width, "xl", handleValue) : "100%", height ? getBreakpoints(height, "xl", handleValue) : "100%"]]]) + " " + (otherProps && otherProps.className != null && otherProps.className || classnames("Wps-Spacing", className) || ""),
    children: /*#__PURE__*/_jsx(_JSXStyle, {
      id: "2706545261",
      dynamic: [width ? getBreakpoints(width, "xs", handleValue) : "100%", height ? getBreakpoints(height, "xs", handleValue) : "100%", theme.breakpoints.sm.min, width ? getBreakpoints(width, "sm", handleValue) : "100%", height ? getBreakpoints(height, "sm", handleValue) : "100%", theme.breakpoints.md.min, width ? getBreakpoints(width, "md", handleValue) : "100%", height ? getBreakpoints(height, "md", handleValue) : "100%", theme.breakpoints.lg.min, width ? getBreakpoints(width, "lg", handleValue) : "100%", height ? getBreakpoints(height, "lg", handleValue) : "100%", theme.breakpoints.xl.min, width ? getBreakpoints(width, "xl", handleValue) : "100%", height ? getBreakpoints(height, "xl", handleValue) : "100%"],
      children: `.Wps-Spacing.__jsx-style-dynamic-selector{width:${width ? getBreakpoints(width, "xs", handleValue) : "100%"};height:${height ? getBreakpoints(height, "xs", handleValue) : "100%"};}@media only screen and (min-width:${theme.breakpoints.sm.min}){.Wps-Spacing.__jsx-style-dynamic-selector{width:${width ? getBreakpoints(width, "sm", handleValue) : "100%"};height:${height ? getBreakpoints(height, "sm", handleValue) : "100%"};}}@media only screen and (min-width:${theme.breakpoints.md.min}){.Wps-Spacing.__jsx-style-dynamic-selector{width:${width ? getBreakpoints(width, "md", handleValue) : "100%"};height:${height ? getBreakpoints(height, "md", handleValue) : "100%"};}}@media only screen and (min-width:${theme.breakpoints.lg.min}){.Wps-Spacing.__jsx-style-dynamic-selector{width:${width ? getBreakpoints(width, "lg", handleValue) : "100%"};height:${height ? getBreakpoints(height, "lg", handleValue) : "100%"};}}@media only screen and (min-width:${theme.breakpoints.xl.min}){.Wps-Spacing.__jsx-style-dynamic-selector{width:${width ? getBreakpoints(width, "xl", handleValue) : "100%"};height:${height ? getBreakpoints(height, "xl", handleValue) : "100%"};}}`
    })
  });
});