"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.VSpacer = exports.HSpacer = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _core = require("../../core");
var _accessibility = require("../../utils/accessibility");
var _jsxRuntime = require("react/jsx-runtime");
const DEFAULT_SIZE = 16;

/* Debug Mode */
const debugMode = false;
const debugBg = (0, _core.hexToRgba)(_core.IOColors["error-600"], 0.2);

/**
Native `Spacer` component
@param  {string} orientation
@param {IOSpacer} size
 */
const Spacer = ({
  allowScaleSpacing,
  orientation,
  size
}) => {
  const {
    dynamicFontScale,
    spacingScaleMultiplier
  } = (0, _accessibility.useIOFontDynamicScale)();
  const style = (0, _react.useMemo)(() => ({
    ...(orientation === "vertical" && {
      height: allowScaleSpacing ? size * dynamicFontScale * spacingScaleMultiplier : size
    }),
    ...(orientation === "horizontal" && {
      width: allowScaleSpacing ? size * dynamicFontScale * spacingScaleMultiplier : size
    }),
    ...(debugMode && {
      backgroundColor: debugBg
    })
  }), [allowScaleSpacing, dynamicFontScale, orientation, size, spacingScaleMultiplier]);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
    style: style
  });
};

/**
Horizontal spacer component
@param {IOSpacer} size
 */
const HSpacer = ({
  size = DEFAULT_SIZE
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Spacer, {
  orientation: "horizontal",
  size: size
});
/**
Vertical spacer component
@param {IOSpacer} size
 */
exports.HSpacer = HSpacer;
const VSpacer = ({
  size = DEFAULT_SIZE
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Spacer, {
  orientation: "vertical",
  size: size
});
exports.VSpacer = VSpacer;
//# sourceMappingURL=Spacer.js.map