"use client"; import { RiEyeFill, RiEyeOffFill, RiSearchLine } from "@remixicon/react"; import React from "react"; import { tv, type VariantProps } from "tailwind-variants"; import { cx, focusInput, focusRing, hasErrorInput } from "../lib/utils"; const inputStyles = tv({ base: [ "relative block w-full appearance-none rounded-md border px-2.5 py-2 shadow-sm outline-none transition sm:text-sm", "border-border", "text-foreground", "placeholder-muted-foreground", "bg-background", "disabled:border-border disabled:bg-muted disabled:text-muted-foreground", "[&::--webkit-search-cancel-button]:hidden [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden", focusInput, ], variants: { hasError: { true: hasErrorInput, }, enableStepper: { false: "[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", }, }, }); interface OnboardingInputProps extends React.InputHTMLAttributes, VariantProps { inputClassName?: string; } const OnboardingInput = React.forwardRef< HTMLInputElement, OnboardingInputProps >( ( { className, inputClassName, hasError, enableStepper = true, type, ...props }, forwardedRef, ) => { const [typeState, setTypeState] = React.useState(type); const isPassword = type === "password"; const isSearch = type === "search"; return (
{isSearch && (
)} {isPassword && (
)}
); }, ); OnboardingInput.displayName = "OnboardingInput"; export { OnboardingInput, inputStyles, type OnboardingInputProps };