diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 1b64dc3..d0d28d1 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -1,8 +1,19 @@ import { ComponentProps } from "react"; import clsx from "clsx"; -export function Input({ className, ...props }: ComponentProps<"input">) { +type InputProps = ComponentProps<"input"> & { + inputRef?: React.Ref; +}; + +export function Input({ className, inputRef, ...props }: InputProps) { return ( - + ); } diff --git a/components/input/inputfield.tsx b/components/input/inputfield.tsx index d06ebb8..2de2e7d 100644 --- a/components/input/inputfield.tsx +++ b/components/input/inputfield.tsx @@ -1,29 +1,44 @@ -import { ReactNode } from "react"; -import { Input } from "./Input"; +import { useId, ReactNode } from "react"; import clsx from "clsx"; +import { Input } from "./Input"; -interface InputFieldProps { +interface InputFieldProps extends React.ComponentProps { label?: string; error?: string; helperText?: string; - inputProps?: React.ComponentProps; children?: ReactNode; - className?: string; } export function InputField({ label, error, helperText, - inputProps, children, className, + ...props }: InputFieldProps) { + const id = useId(); + return ( -
- {label && } +
+ {label && ( + + )} - {children ?? } + {children ?? ( + + )} {error ? (

{error}

diff --git a/components/input/passwordinput.tsx b/components/input/passwordinput.tsx index 6ba0bd2..efe9266 100644 --- a/components/input/passwordinput.tsx +++ b/components/input/passwordinput.tsx @@ -4,30 +4,31 @@ import { useState } from "react"; import Image from "next/image"; import { Input } from "./Input"; import type { ComponentProps } from "react"; +import clsx from "clsx"; -interface PasswordInputProps extends Omit, "type"> { - className?: string; -} +type PasswordInputProps = ComponentProps; export function PasswordInput({ className, ...props }: PasswordInputProps) { const [visible, setVisible] = useState(false); return ( -
+