import clsx from 'clsx'; import React from 'react'; const spaces = { 0: 'space-y-0', [0.5]: 'space-y-0.5', 1: 'space-y-1', [1.5]: 'space-y-1.5', 2: 'space-y-2', 3: 'space-y-3', 4: 'space-y-4', 5: 'space-y-5', 6: 'space-y-6', 10: 'space-y-10', }; const justifyContentOptions = { center: 'justify-center', end: 'justify-end', }; const alignItemsOptions = { top: 'items-start', bottom: 'items-end', center: 'items-center', start: 'items-start', end: 'items-end', }; interface IStack extends React.HTMLAttributes { /** Horizontal alignment of children. */ alignItems?: keyof typeof alignItemsOptions /** Extra class names on the element. */ className?: string /** Vertical alignment of children. */ justifyContent?: keyof typeof justifyContentOptions /** Size of the gap between elements. */ space?: keyof typeof spaces /** Whether to let the flexbox grow. */ grow?: boolean /** HTML element to use for container. */ element?: keyof JSX.IntrinsicElements } /** Vertical stack of child elements. */ const Stack = React.forwardRef((props, ref: React.LegacyRef | undefined) => { const { space, alignItems, justifyContent, className, grow, element = 'div', ...filteredProps } = props; const Elem = element as 'div'; return ( ); }); export default Stack;