Skip to content

Commit

Permalink
fix(TextInput): only spreading HTML input props to the HTML input
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeduhr authored and JLou committed Oct 7, 2024
1 parent f0cf582 commit 572d731
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions look-and-feel/react/src/Form/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,38 @@ import { Svg } from "../../Svg";
import { getComponentClassName } from "../../utilities";
import { InputError } from "../InputError";

type Props = Omit<ComponentPropsWithRef<"input">, "required"> & {
type Props = ComponentPropsWithRef<"input"> & {
classModifier?: string;
helper?: string;
error?: string;
description?: string;
label?: string;
required?: boolean;
buttonLabel?: string;
onButtonClick?: MouseEventHandler<HTMLButtonElement>;
};

const Text = forwardRef<HTMLInputElement, Props>(
({ className, classModifier = "", ...otherProps }, inputRef) => {
const componentClassName = getComponentClassName(
(
{
className,
classModifier,
"af-form__input-text",
);

const {
id,
classModifier = "",
label,
required,
disabled,
description,
helper,
error,
buttonLabel,
onButtonClick,
} = otherProps;
...otherProps
},
inputRef,
) => {
const componentClassName = getComponentClassName(
className,
classModifier,
"af-form__input-text",
);

const { id, required } = otherProps;

return (
<div className="af-form__input-container">
Expand All @@ -61,8 +63,6 @@ const Text = forwardRef<HTMLInputElement, Props>(
className={componentClassName}
type="text"
ref={inputRef}
required={required}
disabled={disabled}
aria-invalid={Boolean(error)}
aria-describedby={error ? `${id}-error` : undefined}
{...otherProps}
Expand Down

0 comments on commit 572d731

Please sign in to comment.