@xk2800/nextjs-template 0.7.1-beta.11 → 0.7.1-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ui/input.tsx +10 -1
- package/package.json +1 -1
package/components/ui/input.tsx
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import * as React from "react"
|
|
2
4
|
|
|
3
5
|
import { cn } from "../../lib/utils"
|
|
4
6
|
|
|
5
|
-
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
7
|
+
function Input({ className, type, onKeyDown, ...props }: React.ComponentProps<"input">) {
|
|
6
8
|
return (
|
|
7
9
|
<input
|
|
8
10
|
type={type}
|
|
9
11
|
data-slot="input"
|
|
12
|
+
onKeyDown={(e) => {
|
|
13
|
+
// number inputs don't step with the arrow keys
|
|
14
|
+
if (type === "number" && (e.key === "ArrowUp" || e.key === "ArrowDown")) e.preventDefault()
|
|
15
|
+
onKeyDown?.(e)
|
|
16
|
+
}}
|
|
10
17
|
className={cn(
|
|
11
18
|
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
12
19
|
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
13
20
|
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
21
|
+
// hide the browser's number spinners
|
|
22
|
+
"[&[type=number]]:[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
14
23
|
className
|
|
15
24
|
)}
|
|
16
25
|
{...props}
|