| 14 | }; |
| 15 | |
| 16 | function Input({ |
| 17 | className, |
| 18 | size = "default", |
| 19 | unstyled = false, |
| 20 | ...props |
| 21 | }: InputProps) { |
| 22 | return ( |
| 23 | <span |
| 24 | className={ |
| 25 | cn( |
| 26 | !unstyled && |
| 27 | "relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)]", |
| 28 | className, |
| 29 | ) || undefined |
| 30 | } |
| 31 | data-size={size} |
| 32 | data-slot="input-control" |
| 33 | > |
| 34 | <InputPrimitive |
| 35 | className={cn( |
| 36 | "h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5", |
| 37 | size === "sm" && |
| 38 | "h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5", |
| 39 | size === "lg" && "h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5", |
| 40 | props.type === "search" && |
| 41 | "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none", |
| 42 | props.type === "file" && |
| 43 | "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm", |
| 44 | )} |
| 45 | data-slot="input" |
| 46 | size={typeof size === "number" ? size : undefined} |
| 47 | {...props} |
| 48 | /> |
| 49 | </span> |
| 50 | ); |
| 51 | } |
| 52 | |
| 53 | export { Input, type InputProps }; |