36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import * as React from "react";
|
|||
|
|
import { cn } from "@/lib/utils";
|
||
|
|
|
||
|
|
const fieldCls =
|
||
|
|
"flex h-9 w-full rounded-[var(--radius)] border bg-[var(--color-surface)] px-3 text-sm shadow-sm transition-colors placeholder:text-[var(--color-muted-foreground)] focus-visible:outline-none focus-visible:border-[var(--color-primary)] focus-visible:ring-2 focus-visible:ring-[var(--color-ring)] disabled:cursor-not-allowed disabled:opacity-50";
|
||
|
|
|
||
|
|
export const Input = React.forwardRef<
|
||
|
|
HTMLInputElement,
|
||
|
|
React.InputHTMLAttributes<HTMLInputElement>
|
||
|
|
>(({ className, ...props }, ref) => (
|
||
|
|
<input ref={ref} className={cn(fieldCls, className)} {...props} />
|
||
|
|
));
|
||
|
|
Input.displayName = "Input";
|
||
|
|
|
||
|
|
export const Textarea = React.forwardRef<
|
||
|
|
HTMLTextAreaElement,
|
||
|
|
React.TextareaHTMLAttributes<HTMLTextAreaElement>
|
||
|
|
>(({ className, ...props }, ref) => (
|
||
|
|
<textarea
|
||
|
|
ref={ref}
|
||
|
|
className={cn(fieldCls, "h-auto min-h-[76px] py-2 leading-relaxed", className)}
|
||
|
|
{...props}
|
||
|
|
/>
|
||
|
|
));
|
||
|
|
Textarea.displayName = "Textarea";
|
||
|
|
|
||
|
|
export const Select = React.forwardRef<
|
||
|
|
HTMLSelectElement,
|
||
|
|
React.SelectHTMLAttributes<HTMLSelectElement>
|
||
|
|
>(({ className, children, ...props }, ref) => (
|
||
|
|
<select ref={ref} className={cn(fieldCls, "pr-8", className)} {...props}>
|
||
|
|
{children}
|
||
|
|
</select>
|
||
|
|
));
|
||
|
|
Select.displayName = "Select";
|