<commit_before>/* @jsx jsx */
import { InputHTMLAttributes, forwardRef } from 'react';
import { jsx } from '@keystone-ui/core';

import { useInputStyles, useInputTokens } from './hooks/inputs';
import type { SizeType, WidthType } from './types';

type InputProps = InputHTMLAttributes<HTMLTextAreaElement>;

export type TextAreaProps = {
  invalid?: boolean;
  size?: SizeType;
  width?: WidthType;
  onChange?: NonNullable<InputProps['onChange']>;
  value?: NonNullable<InputProps['value']>;
} & Omit<InputProps, 'onChange' | 'size' | 'value'>;

export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
  ({ invalid = false, size = 'medium' as const, width = 'medium' as const, ...props }, ref) => {
    const tokens = useInputTokens({ size, width, shape: 'square', fixHeight: false });
    const styles = useInputStyles({ invalid, tokens });

    return <textarea ref={ref} css={styles} {...props} />;
  }
);<commit_msg>Fix the default textarea width (#4210)<commit_after>/* @jsx jsx */
import { InputHTMLAttributes, forwardRef } from 'react';
import { jsx } from '@keystone-ui/core';

import { useInputStyles, useInputTokens } from './hooks/inputs';
import type { SizeType, WidthType } from './types';

type InputProps = InputHTMLAttributes<HTMLTextAreaElement>;

export type TextAreaProps = {
  invalid?: boolean;
  size?: SizeType;
  width?: WidthType;
  onChange?: NonNullable<InputProps['onChange']>;
  value?: NonNullable<InputProps['value']>;
} & Omit<InputProps, 'onChange' | 'size' | 'value'>;

export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
  ({ invalid = false, size = 'medium' as const, width = 'large' as const, ...props }, ref) => {
    const tokens = useInputTokens({ size, width, shape: 'square', fixHeight: false });
    const styles = useInputStyles({ invalid, tokens });

    return <textarea ref={ref} css={styles} {...props} />;
  }
);
{'fraction_non_alphanumeric': 0.1596417281348788, 'fraction_numerical': 0.002107481559536354, 'mean_word_length': 4.971698113207547, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4255419', 'n_tokens_mistral': 579, 'n_tokens_neox': 576, 'n_words': 163}