From 293760b0d9a7bdba4b290aba07a9340c87bd2c7a Mon Sep 17 00:00:00 2001 From: Gbacc Date: Fri, 11 Oct 2024 08:58:40 +0200 Subject: [PATCH] fix(TMC-25993): fix DS textarea row property and static css height (#5424) * fix(TMC-25993): fix DS textarea row property and static css height * fix tests --- .changeset/fuzzy-dancers-move.md | 5 +++++ .../Form/Primitives/Textarea/Textarea.module.scss | 1 - .../src/components/Form/Primitives/Textarea/Textarea.tsx | 4 ++++ .../src/components/Form/__snapshots__/Form.test.tsx.snap | 1 + .../stories/form/Field/Textarea/Input.Textarea.stories.tsx | 6 ++++++ 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .changeset/fuzzy-dancers-move.md diff --git a/.changeset/fuzzy-dancers-move.md b/.changeset/fuzzy-dancers-move.md new file mode 100644 index 00000000000..16e6cddd5c4 --- /dev/null +++ b/.changeset/fuzzy-dancers-move.md @@ -0,0 +1,5 @@ +--- +'@talend/design-system': patch +--- + +fix: allow form Textarea to changes number of rows and remove fixed css min-height diff --git a/packages/design-system/src/components/Form/Primitives/Textarea/Textarea.module.scss b/packages/design-system/src/components/Form/Primitives/Textarea/Textarea.module.scss index d5162abb077..645430f0a90 100644 --- a/packages/design-system/src/components/Form/Primitives/Textarea/Textarea.module.scss +++ b/packages/design-system/src/components/Form/Primitives/Textarea/Textarea.module.scss @@ -4,7 +4,6 @@ .textarea { @include Form.base-input(); @include Form.border-styles(); - min-height: calc(#{tokens.$coral-sizing-l} * 2); max-height: tokens.$coral-sizing-xxxl; resize: vertical; line-height: 140%; diff --git a/packages/design-system/src/components/Form/Primitives/Textarea/Textarea.tsx b/packages/design-system/src/components/Form/Primitives/Textarea/Textarea.tsx index 43f1962389c..fdccc55f350 100644 --- a/packages/design-system/src/components/Form/Primitives/Textarea/Textarea.tsx +++ b/packages/design-system/src/components/Form/Primitives/Textarea/Textarea.tsx @@ -1,13 +1,17 @@ import { forwardRef, Ref, TextareaHTMLAttributes } from 'react'; + import classnames from 'classnames'; + import styles from './Textarea.module.scss'; export type TextareaPrimitiveProps = TextareaHTMLAttributes & { hasError?: boolean }; const Textarea = forwardRef((props: TextareaPrimitiveProps, ref: Ref) => { const { className, readOnly = false, disabled = false, hasError = false, ...rest } = props; + const defaultRowsNumber = 3; return (