veza/apps/web/src/components/ui/input.tsx

59 lines
2.1 KiB
TypeScript
Raw Normal View History

import * as React from 'react';
2026-01-22 16:23:11 +00:00
import { cn } from '@/lib/utils';
2026-01-22 16:23:11 +00:00
export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {
icon?: React.ReactNode;
label?: string;
2026-01-22 16:23:11 +00:00
}
import { Search, Upload } from 'lucide-react';
import { Label } from './label';
import { FileUpload as BaseFileUpload } from './file-upload';
2026-01-22 16:23:11 +00:00
const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, icon, label, id, ...props }, ref) => {
2026-01-22 16:23:11 +00:00
return (
<div className="space-y-2 w-full">
{label && <Label htmlFor={id} className="text-xs font-mono text-muted-foreground uppercase tracking-widest">{label}</Label>}
<div className="relative group">
{icon && (
<div className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground group-focus-within:text-primary transition-colors pointer-events-none">
{icon}
</div>
2026-01-22 16:23:11 +00:00
)}
<input
id={id}
type={type}
className={cn(
"flex h-11 w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 text-sm text-white placeholder:text-muted-foreground/50 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:cursor-not-allowed disabled:opacity-50",
"backdrop-blur-sm transition-all duration-200",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:border-primary/50",
"hover:bg-white/5 hover:border-white/20",
icon && "pl-10",
className
)}
ref={ref}
{...props}
/>
</div>
2026-01-22 16:23:11 +00:00
</div>
);
}
);
Input.displayName = 'Input';
const SearchInput = React.forwardRef<HTMLInputElement, InputProps>(
(props, ref) => <Input {...props} ref={ref} icon={<Search className="w-4 h-4" />} />
);
SearchInput.displayName = 'SearchInput';
// Shim for legacy FileUpload usage
const FileUpload = (props: any) => (
<div className="space-y-2">
<BaseFileUpload onFileSelect={() => { }} {...props} />
</div>
);
export { Input, SearchInput, FileUpload };