import { clsx } from 'clsx'; import { forwardRef, HTMLAttributes } from 'react'; import { Typography, BodyTypes } from '../common/propsValues/typography'; const DEFAULT_TYPE = Typography.BODY_DEFAULT; const bodyTypes = new Set([ Typography.BODY_DEFAULT, Typography.BODY_DEFAULT_BOLD, Typography.BODY_LARGE, Typography.BODY_LARGE_BOLD, ]); type Props = HTMLAttributes & { /** @default 'body-default' */ type?: BodyTypes; /** @default 'div' */ as?: 'span' | 'p' | 'div'; /** * When true, preserves newline characters in the text * @default false */ preserveNewlines?: boolean; }; const Body = forwardRef(function Body( { as: Element = 'div', type = DEFAULT_TYPE, className, preserveNewlines, ...props }: Props, reference: React.ForwardedRef< | { [key in typeof Element]: React.ElementRef; }[typeof Element] | null >, ) { const isTypeSupported = bodyTypes.has(type); return ( ); }); export default Body;