diff --git a/.changeset/perfect-jeans-lick.md b/.changeset/perfect-jeans-lick.md new file mode 100644 index 0000000000..d82ad11341 --- /dev/null +++ b/.changeset/perfect-jeans-lick.md @@ -0,0 +1,5 @@ +--- +'@sumup/circuit-ui': minor +--- + +Added an auto expand behavior to the `TextArea` component. diff --git a/packages/circuit-ui/components/Input/Input.tsx b/packages/circuit-ui/components/Input/Input.tsx index 22eec1e138..2d7b2a1279 100644 --- a/packages/circuit-ui/components/Input/Input.tsx +++ b/packages/circuit-ui/components/Input/Input.tsx @@ -13,7 +13,14 @@ * limitations under the License. */ -import { forwardRef, Ref, FC, InputHTMLAttributes, ReactNode } from 'react'; +import { + forwardRef, + Ref, + FC, + InputHTMLAttributes, + TextareaHTMLAttributes, + ReactNode, +} from 'react'; import { css, Interpolation } from '@emotion/react'; import { Theme } from '@sumup/design-tokens'; @@ -29,7 +36,10 @@ import ValidationHint from '../ValidationHint'; import { ReturnType } from '../../types/return-type'; import { deprecate } from '../../util/logger'; -export interface InputProps extends InputHTMLAttributes { +export type HTMLCircuitInputElement = HTMLInputElement & HTMLTextAreaElement; +type CircuitInputHTMLAttributes = InputHTMLAttributes & + TextareaHTMLAttributes; +export interface InputProps extends CircuitInputHTMLAttributes { /** * A clear and concise description of the input purpose. */ @@ -105,7 +115,7 @@ export interface InputProps extends InputHTMLAttributes { /** * The ref to the HTML DOM element */ - ref?: Ref; + ref?: Ref; } const containerStyles = () => css` diff --git a/packages/circuit-ui/components/TextArea/TextArea.spec.tsx b/packages/circuit-ui/components/TextArea/TextArea.spec.tsx index c81ebdd614..043e54f85b 100644 --- a/packages/circuit-ui/components/TextArea/TextArea.spec.tsx +++ b/packages/circuit-ui/components/TextArea/TextArea.spec.tsx @@ -100,6 +100,20 @@ describe('TextArea', () => { expect(actual).toMatchSnapshot(); }); + it('should render rows props when passed', () => { + const actual = create(