From d69d7dbc7a0b1bc77e6ea9d612e806bcf878be4d Mon Sep 17 00:00:00 2001
From: VelociRaptor <77036902+HexM7@users.noreply.github.com>
Date: Thu, 8 Sep 2022 10:02:01 +0530
Subject: [PATCH 1/3] Pass `textarea` props from `componentsProps`
Signed-off-by: VelociRaptor <77036902+HexM7@users.noreply.github.com>
---
packages/mui-joy/src/Textarea/Textarea.tsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/mui-joy/src/Textarea/Textarea.tsx b/packages/mui-joy/src/Textarea/Textarea.tsx
index 140d98280bce17..3e0d4b30d4dce3 100644
--- a/packages/mui-joy/src/Textarea/Textarea.tsx
+++ b/packages/mui-joy/src/Textarea/Textarea.tsx
@@ -247,6 +247,7 @@ const Textarea = React.forwardRef(function Textarea(inProps, ref) {
const textareaProps = useSlotProps({
elementType: TextareaInput,
+ externalSlotProps: componentsProps.textarea,
getSlotProps: (otherHandlers: EventHandlers) =>
getInputProps({ ...otherHandlers, ...propsToForward }),
externalSlotProps: {
From 73d45fe83e46df8646a07d1d5f9e62c9c980e6c5 Mon Sep 17 00:00:00 2001
From: VelociRaptor <77036902+HexM7@users.noreply.github.com>
Date: Thu, 8 Sep 2022 10:14:54 +0530
Subject: [PATCH 2/3] Update Textarea.tsx
---
packages/mui-joy/src/Textarea/Textarea.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/mui-joy/src/Textarea/Textarea.tsx b/packages/mui-joy/src/Textarea/Textarea.tsx
index 3e0d4b30d4dce3..aa7626ce98dd09 100644
--- a/packages/mui-joy/src/Textarea/Textarea.tsx
+++ b/packages/mui-joy/src/Textarea/Textarea.tsx
@@ -247,12 +247,12 @@ const Textarea = React.forwardRef(function Textarea(inProps, ref) {
const textareaProps = useSlotProps({
elementType: TextareaInput,
- externalSlotProps: componentsProps.textarea,
getSlotProps: (otherHandlers: EventHandlers) =>
getInputProps({ ...otherHandlers, ...propsToForward }),
externalSlotProps: {
minRows,
maxRows,
+ ...componentsProps.textarea,
},
ownerState,
className: [classes.textarea, inputStateClasses],
From 38363050cdccd5d5b8cff6fa2bf8ec97125bbdd7 Mon Sep 17 00:00:00 2001
From: VelociRaptor <77036902+HexM7@users.noreply.github.com>
Date: Thu, 8 Sep 2022 11:19:01 +0530
Subject: [PATCH 3/3] Update Textarea.test.tsx
---
packages/mui-joy/src/Textarea/Textarea.test.tsx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/packages/mui-joy/src/Textarea/Textarea.test.tsx b/packages/mui-joy/src/Textarea/Textarea.test.tsx
index 73d87913cdf121..391ed9f4b8a583 100644
--- a/packages/mui-joy/src/Textarea/Textarea.test.tsx
+++ b/packages/mui-joy/src/Textarea/Textarea.test.tsx
@@ -35,6 +35,21 @@ describe('Joy ', () => {
expect(screen.getByTestId('end')).toBeVisible();
});
+ it('should pass props to Textarea', () => {
+ const { container } = render(
+ ,
+ );
+
+ const textarea = container.querySelector('textarea')!;
+ expect(textarea).to.have.attr('maxlength', '5');
+ });
+
describe('prop: disabled', () => {
it('should have disabled classes', () => {
const { container } = render();