import React from 'react';
import { Textarea as TextareaPrimitive, TextareaProps as TextareaPropsPrimitive } from '@modulz/primitives';

export type TextareaProps = TextareaPropsPrimitive & {
  variant?: 'ghost';
size?: 'large';
}

type ExtractRefType<TypesThatMayContainReactRef> = TypesThatMayContainReactRef extends {ref?: React.Ref<infer T>} ? T : any;
type PrimitiveRefType = ExtractRefType<TextareaPropsPrimitive>  

export const Textarea = React.forwardRef<PrimitiveRefType, TextareaProps>((props, ref) => {
  return (
    <TextareaPrimitive {...props} ref={ref}  styleConfig={{"base":{"textarea":{"normal":{"border":"1px solid","borderColor":"rgba(245, 247, 249, 1)","minHeight":"80px","fontSize":"12px","paddingLeft":"8px","borderBottomLeftRadius":"4px","color":"rgba(0, 0, 0, 1)","borderBottomRightRadius":"4px","fontFamily":"Inter,sans-serif","backgroundColor":"hsl(0, 0%, 100%)","paddingRight":"8px","paddingTop":"8px","borderTopRightRadius":"4px","paddingBottom":"8px","borderTopLeftRadius":"4px"}},"placeholder":{"normal":{"color":"rgba(226, 229, 233, 1)"}}},"variants":{"variant":{"ghost":{"textarea":{"normal":{"backgroundColor":"transparent","border":"none"}}}},"size":{"large":{"textarea":{"normal":{"fontSize":"14px","paddingRight":"16px","height":"40px","paddingLeft":"16px","paddingBottom":"16px","paddingTop":"16px"}}}}}}}/>
  );
});


