'use client'; import { Input as InputPrimitive } from '@base-ui/react/input'; import * as React from 'react'; import { cn } from '@/lib/utils'; const inputControlHeights = { lg: 'h-10', md: 'h-8', sm: 'h-7', } as const; type InputProps = Omit< InputPrimitive.Props & React.RefAttributes, 'size' > & { nativeInput?: boolean; size?: 'lg' | 'md' | 'sm' | number; unstyled?: boolean; }; function Input({ className, nativeInput = false, size = 'md', style, unstyled = false, ...props }: InputProps) { const resolvedSize = typeof size === 'number' ? 'md' : size; const inputClassName = cn( unstyled ? cn( 'h-8 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-none outline-none [transition:background-color_5000000s_ease-in-out_0s] placeholder:text-muted-foreground/72', resolvedSize === 'sm' && 'h-7 px-[calc(--spacing(2.5)-1px)]', resolvedSize === 'lg' && 'h-10 px-[calc(--spacing(3.5)-1px)]', ) : cn( 'h-full min-h-0 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-none outline-none [transition:background-color_5000000s_ease-in-out_0s] placeholder:text-muted-foreground/72', resolvedSize === 'sm' && 'px-[calc(--spacing(2.5)-1px)]', resolvedSize === 'lg' && 'px-[calc(--spacing(3.5)-1px)]', ), props.type === 'search' && '[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none', props.type === 'file' && 'text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm', ); return ( {nativeInput ? ( ) : ( )} ); } export { Input, InputPrimitive }; export type { InputProps };