-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: updating deprecated ElementRef
#6262
base: main
Are you sure you want to change the base?
Conversation
@dpaulos6 is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
Fixed a conflict on |
Not sure if this is related.... I tried doing this search and replace on my components but found issues when combining the Input component with react-hook-form. The
The code for the Input component import { cn } from "~/lib/utils";
import * as React from "react";
const Input = ({ ref, className, type, ...props }: React.ComponentProps<"input"> & { ref?: React.RefObject<HTMLInputElement | null> }) => {
return (
<input
type={type}
className={cn(
"border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 w-full rounded-md border bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className,
)}
ref={ref}
{...props}
/>
);
};
Input.displayName = "Input";
export { Input }; And the code for the email field: function Login () {
const { register, formState: { errors } } = useForm<{email: string}>({
resolver: zodResolver(z.object({
email: z.string().email("Invalid email address").min(1, "Email is required"),
})),
});
return <Input
{...register("email", { required: true })}
id="email"
type="email"
placeholder="[email protected]"
autoComplete="email"
required
className={cn(errors.email ? "border-red-700" : undefined)}
/>
} |
This commit replaces the deprecated
ElementRef
withComponentRef
across the entire project.ElementRef
toComponentRef
to adhere to the latest API changes.