- Remove browser spinner buttons from number inputs - Reset datetime field wrapper padding for date/time/datetime-local - Style calendar picker indicator consistently - Add file input resets
24 lines
1.2 KiB
JavaScript
24 lines
1.2 KiB
JavaScript
import { cn } from '@/lib/utils';
|
|
|
|
function Input({ className, type, ...props }) {
|
|
return (
|
|
<input
|
|
type={type}
|
|
data-slot="input"
|
|
className={cn(
|
|
"flex h-9 w-full rounded-[30px] border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
/* number input resets */
|
|
type === 'number' && "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
/* date/time/datetime input resets */
|
|
(type === 'date' || type === 'time' || type === 'datetime-local') && "[&::-webkit-datetime-edit-fields-wrapper]:px-0 [&::-webkit-calendar-picker-indicator]:ml-1 [&::-webkit-calendar-picker-indicator]:opacity-50 [&::-webkit-calendar-picker-indicator]:cursor-pointer",
|
|
/* file input resets */
|
|
type === 'file' && "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export { Input };
|