UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

66 lines (63 loc) 1.48 kB
import { c } from 'react-compiler-runtime'; import React from 'react'; import { defaultSxProp } from '../../utils/defaultSxProp.js'; import { includesSystemProps } from '../../utils/includeSystemProps.js'; import { jsx } from 'react/jsx-runtime'; import Box from '../../Box/Box.js'; const BoxWithFallback = /*#__PURE__*/React.forwardRef(function BoxWithFallback(t0, ref) { const $ = c(13); let rest; let t1; let t2; if ($[0] !== t0) { ({ as: t1, sx: t2, ...rest } = t0); $[0] = t0; $[1] = rest; $[2] = t1; $[3] = t2; } else { rest = $[1]; t1 = $[2]; t2 = $[3]; } const BaseComponent = t1 === undefined ? "div" : t1; const sx = t2 === undefined ? defaultSxProp : t2; if (sx !== defaultSxProp || includesSystemProps(rest)) { let t3; if ($[4] !== BaseComponent || $[5] !== ref || $[6] !== rest || $[7] !== sx) { t3 = /*#__PURE__*/jsx(Box, { ...rest, ref: ref, as: BaseComponent, sx: sx }); $[4] = BaseComponent; $[5] = ref; $[6] = rest; $[7] = sx; $[8] = t3; } else { t3 = $[8]; } return t3; } let t3; if ($[9] !== BaseComponent || $[10] !== ref || $[11] !== rest) { t3 = /*#__PURE__*/jsx(BaseComponent, { ...rest, ref: ref }); $[9] = BaseComponent; $[10] = ref; $[11] = rest; $[12] = t3; } else { t3 = $[12]; } return t3; }); export { BoxWithFallback };