input.tsx 1016 B

12345678910111213141516171819202122232425262728293031
  1. import * as React from 'react'
  2. // @ts-ignore
  3. import { cn } from '@/lib/utils'
  4. export interface InputProps
  5. extends React.InputHTMLAttributes<HTMLInputElement> {}
  6. const Input = React.forwardRef<HTMLInputElement, InputProps & any>(
  7. ({ className, type, small, ...props }, ref) => {
  8. return (
  9. <input
  10. type={type}
  11. className={cn(
  12. 'ui__input',
  13. (small ? 'h-8 py-1 px-2' : 'h-10 px-3 py-2'),
  14. 'flex w-full rounded-md border border-input bg-background text-sm ring-offset-background ' +
  15. 'file:border-0 file:bg-transparent file:text-sm file:font-medium focus:border-input ' +
  16. 'placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ' +
  17. 'focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50',
  18. className
  19. )}
  20. ref={ref}
  21. {...props}
  22. />
  23. )
  24. }
  25. )
  26. Input.displayName = 'Input'
  27. export { Input }