@srcroot/ui 0.0.26 → 0.0.27
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/package.json +1 -1
- package/registry/button.tsx +1 -1
- package/registry/file-upload.tsx +3 -3
- package/registry/search.tsx +3 -3
package/package.json
CHANGED
package/registry/button.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
3
3
|
import { cn } from "@/lib/utils"
|
|
4
4
|
|
|
5
5
|
const buttonVariants = cva(
|
|
6
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
6
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
package/registry/file-upload.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { cn } from "@/lib/utils"
|
|
|
6
6
|
import { Button } from "@/components/ui/button"
|
|
7
7
|
|
|
8
8
|
interface FileUploadProps {
|
|
9
|
-
onChange?: (files:
|
|
9
|
+
onChange?: (files: File[]) => void
|
|
10
10
|
accept?: string
|
|
11
11
|
multiple?: boolean
|
|
12
12
|
maxSize?: number // in bytes
|
|
@@ -16,7 +16,7 @@ interface FileUploadProps {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface UploadedFile {
|
|
19
|
-
file:
|
|
19
|
+
file: File
|
|
20
20
|
preview?: string
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -71,7 +71,7 @@ export function FileUpload({
|
|
|
71
71
|
// Validate file sizes
|
|
72
72
|
const oversizedFiles = fileArray.filter(f => f.size > maxSize)
|
|
73
73
|
if (oversizedFiles.length > 0) {
|
|
74
|
-
setError(`
|
|
74
|
+
setError(`File(s) exceed maximum size of ${formatFileSize(maxSize)}`)
|
|
75
75
|
return
|
|
76
76
|
}
|
|
77
77
|
|
package/registry/search.tsx
CHANGED
|
@@ -36,14 +36,14 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
36
36
|
ref
|
|
37
37
|
) => {
|
|
38
38
|
const [value, setValue] = React.useState(String(defaultValue))
|
|
39
|
-
const debounceRef = React.useRef<NodeJS.Timeout>()
|
|
39
|
+
const debounceRef = React.useRef<NodeJS.Timeout | null>(null)
|
|
40
40
|
|
|
41
41
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
42
42
|
const newValue = e.target.value
|
|
43
43
|
setValue(newValue)
|
|
44
44
|
|
|
45
45
|
if (debounceMs > 0) {
|
|
46
|
-
clearTimeout(debounceRef.current)
|
|
46
|
+
if (debounceRef.current) clearTimeout(debounceRef.current)
|
|
47
47
|
debounceRef.current = setTimeout(() => {
|
|
48
48
|
onSearch?.(newValue)
|
|
49
49
|
}, debounceMs)
|
|
@@ -65,7 +65,7 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
65
65
|
|
|
66
66
|
React.useEffect(() => {
|
|
67
67
|
return () => {
|
|
68
|
-
clearTimeout(debounceRef.current)
|
|
68
|
+
if (debounceRef.current) clearTimeout(debounceRef.current)
|
|
69
69
|
}
|
|
70
70
|
}, [])
|
|
71
71
|
|