import React, { type Ref } from 'react'; import classNames from 'classnames'; import { Textarea as CoreTextarea } from '@shoptet/ui-core-web'; import type { SafeOmit } from '@shoptet/utils'; import type { Complete, Exact, Size } from '../../../types'; import type { HTMLTextareaProps, PlaceholderProps, TextareaOwnProps as TextareaBaseProps } from '../types'; export interface TextareaCommonProps extends SafeOmit, PlaceholderProps {} export interface TextareaOwnProps { cols?: HTMLTextareaProps['cols']; defaultValue?: string | number; label?: string; ref?: Ref; rows?: HTMLTextareaProps['rows']; value?: string | number; width?: Size; } /** @inheritdoc */ export interface TextareaProps extends TextareaOwnProps, TextareaCommonProps {} type GetTextareaClassName = Complete>; export const getTextareaClassName = ({ width, error, warning }: GetTextareaClassName) => classNames('textarea', width, { 'error-field': error, 'warning-field': warning && !error, }); export const Textarea = function Textarea({ cols, defaultValue, error, label, ref, rows = 4, value, warning, width = 'lg', ...rest }: TextareaProps) { rest satisfies Exact & PlaceholderProps, typeof rest>; return ( ); };