22 lines
839 B
TypeScript
22 lines
839 B
TypeScript
import { cn } from './utils';
|
|
import type { VariantProps } from 'class-variance-authority';
|
|
import { cva } from 'class-variance-authority';
|
|
import { forwardRef } from 'react';
|
|
|
|
const variants = cva(
|
|
'hover:border-primary-500 focus:border-primary-500 block w-full rounded-sm border disabled:hover:border-gray-300 border-gray-300 h-9 p-2 px-3 text-sm text-gray-900 outline-none transition-all ease-linear hover:transition-all focus:transition-all disabled:cursor-not-allowed disabled:text-opacity-30'
|
|
);
|
|
|
|
export type InputProps = React.InputHTMLAttributes<HTMLInputElement> &
|
|
VariantProps<typeof variants>;
|
|
|
|
export const Input = forwardRef<HTMLInputElement, InputProps>(({ className, ...props }, ref) => (
|
|
<input
|
|
ref={ref}
|
|
type={props.type}
|
|
id={props.id}
|
|
className={cn(variants({ className }))}
|
|
{...props}
|
|
/>
|
|
));
|