Skip to content

Commit

Permalink
fix(TMC-25993): fix DS textarea row property and static css height (#…
Browse files Browse the repository at this point in the history
…5424)

* fix(TMC-25993): fix DS textarea row property and static css height

* fix tests
  • Loading branch information
Gbacc authored Oct 11, 2024
1 parent 4eacbe7 commit 293760b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-dancers-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/design-system': patch
---

fix: allow form Textarea to changes number of rows and remove fixed css min-height
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { forwardRef, Ref, TextareaHTMLAttributes } from 'react';

import classnames from 'classnames';

import styles from './Textarea.module.scss';

export type TextareaPrimitiveProps = TextareaHTMLAttributes<any> & { hasError?: boolean };

const Textarea = forwardRef((props: TextareaPrimitiveProps, ref: Ref<HTMLTextAreaElement>) => {
const { className, readOnly = false, disabled = false, hasError = false, ...rest } = props;
const defaultRowsNumber = 3;
return (
<textarea
rows={defaultRowsNumber}
{...rest}
ref={ref}
disabled={disabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ exports[`Form should render a11y html 1`] = `
class="theme-textarea"
id="field--mocked-uuid-8"
name="textarea"
rows="3"
/>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export const Textarea = () => (
hasError
description="There is an error here"
/>
<Form.Textarea
rows={2}
placeholder="Placeholder"
name="time"
label="Textarea with custom number of rows"
/>
</StackVertical>
);

Expand Down

0 comments on commit 293760b

Please sign in to comment.