import { IBoxProps, IInputProps, Box } from '..'; import React from 'react'; import { getAttachedChildren } from '../../../utils'; import Flex from '../Flex'; const addonsDefaultStyle = { p: 3, borderColor: 'gray.3', borderWidth: 1, }; export const InputLeftAddon = (props: IBoxProps & IInputProps) => { return ( {props.children} ); }; export const InputRightAddon = (props: IBoxProps & IInputProps) => { return ( {props.children} ); }; type InputGroupProps = { children: Element | Element[]; variant?: string; size?: string; }; const supplyPropsToChildren = (children: any, props: any) => { return React.Children.map(children, (child: JSX.Element) => { return React.cloneElement(child, props, child.props.children); }); }; export const InputGroup = ({ children, ...props }: InputGroupProps) => { return ( {supplyPropsToChildren(getAttachedChildren(children), props)} ); };