UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

232 lines (229 loc) • 4.72 kB
import { c } from 'react-compiler-runtime'; import { forwardRef } from 'react'; import { getResponsiveAttributes } from '../internal/utils/getResponsiveAttributes.js'; import classes from './Stack.module.css.js'; import { clsx } from 'clsx'; import { BoxWithFallback } from '../internal/components/BoxWithFallback.js'; import { jsx } from 'react/jsx-runtime'; const Stack = /*#__PURE__*/forwardRef((t0, forwardedRef) => { const $ = c(37); let as; let children; let className; let gap; let rest; let t1; let t2; let t3; let t4; let t5; if ($[0] !== t0) { ({ as, children, align: t1, direction: t2, gap, justify: t3, padding: t4, wrap: t5, className, ...rest } = t0); $[0] = t0; $[1] = as; $[2] = children; $[3] = className; $[4] = gap; $[5] = rest; $[6] = t1; $[7] = t2; $[8] = t3; $[9] = t4; $[10] = t5; } else { as = $[1]; children = $[2]; className = $[3]; gap = $[4]; rest = $[5]; t1 = $[6]; t2 = $[7]; t3 = $[8]; t4 = $[9]; t5 = $[10]; } const align = t1 === undefined ? "stretch" : t1; const direction = t2 === undefined ? "vertical" : t2; const justify = t3 === undefined ? "start" : t3; const padding = t4 === undefined ? "none" : t4; const wrap = t5 === undefined ? "nowrap" : t5; let t6; if ($[11] !== className) { t6 = clsx(className, classes.Stack); $[11] = className; $[12] = t6; } else { t6 = $[12]; } let t7; if ($[13] !== gap) { t7 = getResponsiveAttributes("gap", gap); $[13] = gap; $[14] = t7; } else { t7 = $[14]; } let t8; if ($[15] !== direction) { t8 = getResponsiveAttributes("direction", direction); $[15] = direction; $[16] = t8; } else { t8 = $[16]; } let t9; if ($[17] !== align) { t9 = getResponsiveAttributes("align", align); $[17] = align; $[18] = t9; } else { t9 = $[18]; } let t10; if ($[19] !== wrap) { t10 = getResponsiveAttributes("wrap", wrap); $[19] = wrap; $[20] = t10; } else { t10 = $[20]; } let t11; if ($[21] !== justify) { t11 = getResponsiveAttributes("justify", justify); $[21] = justify; $[22] = t11; } else { t11 = $[22]; } let t12; if ($[23] !== padding) { t12 = getResponsiveAttributes("padding", padding); $[23] = padding; $[24] = t12; } else { t12 = $[24]; } let t13; if ($[25] !== as || $[26] !== children || $[27] !== forwardedRef || $[28] !== rest || $[29] !== t10 || $[30] !== t11 || $[31] !== t12 || $[32] !== t6 || $[33] !== t7 || $[34] !== t8 || $[35] !== t9) { t13 = /*#__PURE__*/jsx(BoxWithFallback, { as: as, ref: forwardedRef, ...rest, className: t6, ...t7, ...t8, ...t9, ...t10, ...t11, ...t12, children: children }); $[25] = as; $[26] = children; $[27] = forwardedRef; $[28] = rest; $[29] = t10; $[30] = t11; $[31] = t12; $[32] = t6; $[33] = t7; $[34] = t8; $[35] = t9; $[36] = t13; } else { t13 = $[36]; } return t13; }); const StackItem = /*#__PURE__*/forwardRef((t0, forwardedRef) => { const $ = c(21); let as; let children; let className; let grow; let rest; let shrink; if ($[0] !== t0) { ({ as, children, grow, shrink, className, ...rest } = t0); $[0] = t0; $[1] = as; $[2] = children; $[3] = className; $[4] = grow; $[5] = rest; $[6] = shrink; } else { as = $[1]; children = $[2]; className = $[3]; grow = $[4]; rest = $[5]; shrink = $[6]; } let t1; if ($[7] !== className) { t1 = clsx(className, classes.StackItem); $[7] = className; $[8] = t1; } else { t1 = $[8]; } let t2; if ($[9] !== grow) { t2 = getResponsiveAttributes("grow", grow); $[9] = grow; $[10] = t2; } else { t2 = $[10]; } let t3; if ($[11] !== shrink) { t3 = getResponsiveAttributes("shrink", shrink); $[11] = shrink; $[12] = t3; } else { t3 = $[12]; } let t4; if ($[13] !== as || $[14] !== children || $[15] !== forwardedRef || $[16] !== rest || $[17] !== t1 || $[18] !== t2 || $[19] !== t3) { t4 = /*#__PURE__*/jsx(BoxWithFallback, { as: as, ref: forwardedRef, ...rest, className: t1, ...t2, ...t3, children: children }); $[13] = as; $[14] = children; $[15] = forwardedRef; $[16] = rest; $[17] = t1; $[18] = t2; $[19] = t3; $[20] = t4; } else { t4 = $[20]; } return t4; }); export { Stack, StackItem };