UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 2.39 kB
{"version":3,"file":"Textarea.mjs","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { mergeDeep } from \"../../helpers/merge-deep\";\nimport { getTheme } from \"../../theme-store\";\nimport type { DeepPartial } from \"../../types\";\nimport type { FlowbiteBoolean, FlowbiteColors } from \"../Flowbite\";\nimport { HelperText } from \"../HelperText\";\n\nexport interface FlowbiteTextareaTheme {\n base: string;\n colors: TextareaColors;\n withShadow: FlowbiteBoolean;\n}\n\nexport interface TextareaColors extends Pick<FlowbiteColors, \"gray\" | \"info\" | \"failure\" | \"warning\" | \"success\"> {\n [key: string]: string;\n}\n\nexport interface TextareaProps extends Omit<ComponentProps<\"textarea\">, \"color\" | \"ref\"> {\n color?: keyof TextareaColors;\n helperText?: ReactNode;\n shadow?: boolean;\n theme?: DeepPartial<FlowbiteTextareaTheme>;\n}\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, color = \"gray\", helperText, shadow, theme: customTheme = {}, ...props }, ref) => {\n const theme = mergeDeep(getTheme().textarea, customTheme);\n\n return (\n <>\n <textarea\n ref={ref}\n className={twMerge(theme.base, theme.colors[color], theme.withShadow[shadow ? \"on\" : \"off\"], className)}\n {...props}\n />\n {helperText && <HelperText color={color}>{helperText}</HelperText>}\n </>\n );\n },\n);\n\nTextarea.displayName = \"Textarea\";\n"],"names":[],"mappings":";;;;;;;AAOY,MAAC,QAAQ,GAAG,UAAU;AAClC,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AACjG,IAAI,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAC9D,IAAI,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AACtD,sBAAsB,GAAG;AACzB,QAAQ,UAAU;AAClB,QAAQ;AACR,UAAU,GAAG;AACb,UAAU,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC;AACjH,UAAU,GAAG,KAAK;AAClB,SAAS;AACT,OAAO;AACP,MAAM,UAAU,oBAAoB,GAAG,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AACpF,KAAK,EAAE,CAAC,CAAC;AACT,GAAG;AACH,EAAE;AACF,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}