Skip to content

Commit

Permalink
chore(textarea): multiple rows prop renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgarciadev committed Nov 8, 2023
1 parent f9f9a56 commit 669cb00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/components/input/src/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ const Textarea = forwardRef<"textarea", TextAreaProps>(
getErrorMessageProps,
} = useInput<HTMLTextAreaElement>({...otherProps, ref, isMultiline: true});

const [isTwoRows, setIsTwoRows] = useState(minRows > 1);
const [hasMultipleRows, setIsHasMultipleRows] = useState(minRows > 1);
const [isLimitReached, setIsLimitReached] = useState(false);
const labelContent = <label {...getLabelProps()}>{label}</label>;
const inputProps = getInputProps();

const handleHeightChange = (height: number, meta: TextareaHeightChangeMeta) => {
if (minRows === 1) {
setIsTwoRows(height >= meta.rowHeight * 2);
setIsHasMultipleRows(height >= meta.rowHeight * 2);
}
if (maxRows > minRows) {
const limitReached = height >= maxRows * meta.rowHeight;
Expand Down Expand Up @@ -139,7 +139,7 @@ const Textarea = forwardRef<"textarea", TextAreaProps>(
return (
<Component {...getBaseProps()}>
{shouldLabelBeOutside ? labelContent : null}
<div {...getInputWrapperProps()} data-two-rows={dataAttr(isTwoRows)}>
<div {...getInputWrapperProps()} data-has-multiple-rows={dataAttr(hasMultipleRows)}>
{shouldLabelBeInside ? labelContent : null}
{innerWrapper}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/theme/src/components/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ const input = tv({
isMultiline: true,
radius: "full",
class: {
inputWrapper: "data-[two-rows=true]:rounded-large",
inputWrapper: "data-[has-multiple-rows=true]:rounded-large",
},
},
],
Expand Down

0 comments on commit 669cb00

Please sign in to comment.