@srcroot/ui 0.0.26 → 0.0.28
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/README.md +1 -1
- package/package.json +2 -2
- package/registry/button.tsx +1 -1
- package/registry/carousel.tsx +5 -4
- package/registry/file-upload.tsx +3 -3
- package/registry/search.tsx +3 -3
- package/registry/sidebar.tsx +6 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @srcroot/ui
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A UI library with polymorphic, accessible React components.
|
|
4
4
|
This library provides a collection of re-usable components that you can copy and paste into your apps.
|
|
5
5
|
|
|
6
6
|
## Features
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srcroot/ui",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "0.0.28",
|
|
4
|
+
"description": "A UI library with polymorphic, accessible React components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"srcroot-ui": "./dist/index.js"
|
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/carousel.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
import * as React from "react"
|
|
2
3
|
import { cn } from "@/lib/utils"
|
|
3
4
|
|
|
@@ -80,7 +81,7 @@ const CarouselContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HT
|
|
|
80
81
|
return (
|
|
81
82
|
<div ref={ref} className={cn("overflow-hidden", className)} {...props}>
|
|
82
83
|
<div
|
|
83
|
-
className="flex transition-transform duration-300 ease-in-out"
|
|
84
|
+
className="w-full h-full flex transition-transform duration-300 ease-in-out"
|
|
84
85
|
style={{ transform: `translateX(-${context.currentIndex * 100}%)` }}
|
|
85
86
|
>
|
|
86
87
|
{children}
|
|
@@ -97,7 +98,7 @@ const CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLD
|
|
|
97
98
|
ref={ref}
|
|
98
99
|
role="group"
|
|
99
100
|
aria-roledescription="slide"
|
|
100
|
-
className={cn("min-w-0 shrink-0 grow-0 basis-full", className)}
|
|
101
|
+
className={cn("min-w-0 h-full shrink-0 grow-0 basis-full", className)}
|
|
101
102
|
{...props}
|
|
102
103
|
/>
|
|
103
104
|
)
|
|
@@ -118,7 +119,7 @@ const CarouselPrevious = React.forwardRef<
|
|
|
118
119
|
ref={ref}
|
|
119
120
|
type="button"
|
|
120
121
|
className={cn(
|
|
121
|
-
"absolute left-4 top-1/2 -translate-y-1/2 h-8 w-8 rounded-full border bg-background shadow-md flex items-center justify-center",
|
|
122
|
+
"absolute left-4 top-1/2 -translate-y-1/2 h-8 w-8 rounded-full border bg-background shadow-md flex items-center justify-center cursor-pointer",
|
|
122
123
|
"hover:bg-accent disabled:opacity-50",
|
|
123
124
|
className
|
|
124
125
|
)}
|
|
@@ -149,7 +150,7 @@ const CarouselNext = React.forwardRef<
|
|
|
149
150
|
ref={ref}
|
|
150
151
|
type="button"
|
|
151
152
|
className={cn(
|
|
152
|
-
"absolute right-4 top-1/2 -translate-y-1/2 h-8 w-8 rounded-full border bg-background shadow-md flex items-center justify-center",
|
|
153
|
+
"absolute right-4 top-1/2 -translate-y-1/2 h-8 w-8 rounded-full border bg-background shadow-md flex items-center justify-center cursor-pointer",
|
|
153
154
|
"hover:bg-accent disabled:opacity-50",
|
|
154
155
|
className
|
|
155
156
|
)}
|
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
|
|
package/registry/sidebar.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import {
|
|
4
|
+
import { PanelLeft } from "lucide-react"
|
|
5
5
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
6
|
|
|
7
7
|
import { cn } from "@/lib/utils"
|
|
@@ -168,7 +168,10 @@ const Sidebar = React.forwardRef<
|
|
|
168
168
|
return (
|
|
169
169
|
<div
|
|
170
170
|
ref={ref}
|
|
171
|
-
className=
|
|
171
|
+
className={cn(
|
|
172
|
+
"group peer hidden md:block text-sidebar-foreground",
|
|
173
|
+
className
|
|
174
|
+
)}
|
|
172
175
|
data-state={state}
|
|
173
176
|
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
174
177
|
data-variant={variant}
|
|
@@ -233,7 +236,7 @@ const SidebarTrigger = React.forwardRef<
|
|
|
233
236
|
}}
|
|
234
237
|
{...props}
|
|
235
238
|
>
|
|
236
|
-
<
|
|
239
|
+
<PanelLeft />
|
|
237
240
|
<span className="sr-only">Toggle Sidebar</span>
|
|
238
241
|
</Button>
|
|
239
242
|
)
|