"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.Spacing = void 0;

var _style = _interopRequireDefault(require("styled-jsx/style"));

var _react = _interopRequireWildcard(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _useTheme = _interopRequireDefault(require("../../hooks/useTheme"));

var _Flex = require("../Flex/Flex.functions");

var _jsxRuntime = require("react/jsx-runtime");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Generated with util/create-component.js
const Spacing = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
  const theme = (0, _useTheme.default)();
  const {
    height,
    width,
    className = null,
    ...otherProps
  } = props;

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

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