"use strict";

import { useMemo } from "react";
import { View } from "react-native";
import { hexToRgba, IOColors } from "../../core";
import { useIOFontDynamicScale } from "../../utils/accessibility";
import { jsx as _jsx } from "react/jsx-runtime";
const DEFAULT_SIZE = 16;

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

/**
Native `Spacer` component
@param  {string} orientation
@param {IOSpacer} size
 */
const Spacer = ({
  allowScaleSpacing,
  orientation,
  size
}) => {
  const {
    dynamicFontScale,
    spacingScaleMultiplier
  } = useIOFontDynamicScale();
  const style = 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__*/_jsx(View, {
    style: style
  });
};

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