@srcroot/ui 0.0.24 → 0.0.26
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/dist/index.js +13 -4
- package/package.json +63 -57
- package/registry/combobox.tsx +4 -4
- package/registry/command.tsx +2 -2
- package/registry/file-upload.tsx +12 -12
- package/registry/sidebar.tsx +2 -2
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ Install every available component at once.
|
|
|
46
46
|
npx @srcroot/ui add --all
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
This will copy the component files to your `components/ui` directory and install any necessary peer dependencies (like `
|
|
49
|
+
This will copy the component files to your `components/ui` directory and install any necessary peer dependencies (like `react-icons` or `clsx`).
|
|
50
50
|
|
|
51
51
|
### 3. Usage
|
|
52
52
|
|
package/dist/index.js
CHANGED
|
@@ -586,7 +586,7 @@ async function init(options) {
|
|
|
586
586
|
"clsx",
|
|
587
587
|
"tailwind-merge",
|
|
588
588
|
"class-variance-authority",
|
|
589
|
-
"
|
|
589
|
+
"react-icons"
|
|
590
590
|
];
|
|
591
591
|
if (!isTailwind4) {
|
|
592
592
|
requiredDeps.push("tailwindcss-animate");
|
|
@@ -1031,10 +1031,19 @@ async function add(components, options) {
|
|
|
1031
1031
|
const comp = REGISTRY[name];
|
|
1032
1032
|
const targetPath = path2.join(componentsDir, comp.file);
|
|
1033
1033
|
if (fs2.existsSync(targetPath) && !options.overwrite) {
|
|
1034
|
-
|
|
1035
|
-
|
|
1034
|
+
spinner.stop();
|
|
1035
|
+
const { overwrite } = await prompts2({
|
|
1036
|
+
type: "confirm",
|
|
1037
|
+
name: "overwrite",
|
|
1038
|
+
message: `${chalk2.cyan(comp.file)} already exists. Overwrite?`,
|
|
1039
|
+
initial: false
|
|
1040
|
+
});
|
|
1041
|
+
if (!overwrite) {
|
|
1042
|
+
spinner.info(`Skipped ${chalk2.cyan(comp.file)}`);
|
|
1043
|
+
spinner.start("Adding components...");
|
|
1044
|
+
continue;
|
|
1036
1045
|
}
|
|
1037
|
-
|
|
1046
|
+
spinner.start("Adding components...");
|
|
1038
1047
|
}
|
|
1039
1048
|
const registryPath = path2.resolve(__dirname3, "..", "registry", comp.file);
|
|
1040
1049
|
if (!fs2.existsSync(registryPath)) {
|
package/package.json
CHANGED
|
@@ -1,58 +1,64 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@srcroot/ui",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "A shadcn-style CLI UI library with polymorphic, accessible React components",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"srcroot-ui": "./dist/index.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsup",
|
|
11
|
-
"dev": "tsup --watch"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"dist",
|
|
15
|
-
"registry"
|
|
16
|
-
],
|
|
17
|
-
"keywords": [
|
|
18
|
-
"react",
|
|
19
|
-
"ui",
|
|
20
|
-
"components",
|
|
21
|
-
"tailwind",
|
|
22
|
-
"polymorphic",
|
|
23
|
-
"accessible"
|
|
24
|
-
],
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"chalk": "^5.3.0",
|
|
27
|
-
"commander": "^12.1.0",
|
|
28
|
-
"fs-extra": "^11.2.0",
|
|
29
|
-
"ora": "^8.1.1",
|
|
30
|
-
"prompts": "^2.4.2"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"@types/
|
|
35
|
-
"@types/
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"react-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@srcroot/ui",
|
|
3
|
+
"version": "0.0.26",
|
|
4
|
+
"description": "A shadcn-style CLI UI library with polymorphic, accessible React components",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"srcroot-ui": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsup",
|
|
11
|
+
"dev": "tsup --watch"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"registry"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"react",
|
|
19
|
+
"ui",
|
|
20
|
+
"components",
|
|
21
|
+
"tailwind",
|
|
22
|
+
"polymorphic",
|
|
23
|
+
"accessible"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"chalk": "^5.3.0",
|
|
27
|
+
"commander": "^12.1.0",
|
|
28
|
+
"fs-extra": "^11.2.0",
|
|
29
|
+
"ora": "^8.1.1",
|
|
30
|
+
"prompts": "^2.4.2"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/fs-extra": "^11.0.4",
|
|
34
|
+
"@types/node": "^22.10.1",
|
|
35
|
+
"@types/prompts": "^2.4.9",
|
|
36
|
+
"tsup": "^8.3.5",
|
|
37
|
+
"typescript": "^5.7.2",
|
|
38
|
+
"tailwindcss-animate": "^1.0.7",
|
|
39
|
+
"class-variance-authority": "^0.7.1",
|
|
40
|
+
"clsx": "^2.1.1",
|
|
41
|
+
"cmdk": "^1.0.0",
|
|
42
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
43
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
44
|
+
"tailwind-merge": "^3.4.0",
|
|
45
|
+
"tailwindcss": "^3.0.0 || ^4.0.0",
|
|
46
|
+
"react-icons": "^5.5.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"class-variance-authority": "^0.7.1",
|
|
50
|
+
"clsx": "^2.1.1",
|
|
51
|
+
"cmdk": "^1.0.0",
|
|
52
|
+
"react-icons": "^5.5.0",
|
|
53
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
54
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
55
|
+
"tailwind-merge": "^3.4.0",
|
|
56
|
+
"tailwindcss-animate": "^1.0.7",
|
|
57
|
+
"tailwindcss": "^3.0.0 || ^4.0.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"cmdk": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
}
|
|
58
64
|
}
|
package/registry/combobox.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import {
|
|
4
|
+
import { LuCheck, LuChevronsUpDown, LuX } from "react-icons/lu"
|
|
5
5
|
|
|
6
6
|
import { cn } from "@/lib/utils"
|
|
7
7
|
import { Button } from "@/components/ui/button"
|
|
@@ -113,7 +113,7 @@ export function Combobox({
|
|
|
113
113
|
>
|
|
114
114
|
{Icon && <Icon className="h-3 w-3" />}
|
|
115
115
|
{opt.label}
|
|
116
|
-
<
|
|
116
|
+
<LuX className="h-3 w-3 text-muted-foreground hover:text-foreground ml-0.5" />
|
|
117
117
|
</Badge>
|
|
118
118
|
)
|
|
119
119
|
})
|
|
@@ -131,7 +131,7 @@ export function Combobox({
|
|
|
131
131
|
<span className="text-muted-foreground">{placeholder}</span>
|
|
132
132
|
)}
|
|
133
133
|
</div>
|
|
134
|
-
<
|
|
134
|
+
<LuChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
|
135
135
|
</Button>
|
|
136
136
|
</PopoverTrigger>
|
|
137
137
|
<PopoverContent className="w-full min-w-[200px] p-0">
|
|
@@ -146,7 +146,7 @@ export function Combobox({
|
|
|
146
146
|
value={option.label}
|
|
147
147
|
onSelect={() => handleSelect(option.value)}
|
|
148
148
|
>
|
|
149
|
-
<
|
|
149
|
+
<LuCheck
|
|
150
150
|
className={cn(
|
|
151
151
|
"mr-2 h-4 w-4",
|
|
152
152
|
multiple
|
package/registry/command.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import {
|
|
4
|
+
import { LuSearch } from "react-icons/lu"
|
|
5
5
|
import { cn } from "@/lib/utils"
|
|
6
6
|
import { Dialog, DialogContent } from "@/components/ui/dialog"
|
|
7
7
|
|
|
@@ -117,7 +117,7 @@ const CommandInput = React.forwardRef<HTMLInputElement, CommandInputProps>(
|
|
|
117
117
|
|
|
118
118
|
return (
|
|
119
119
|
<div className="flex items-center border-b px-3">
|
|
120
|
-
<
|
|
120
|
+
<LuSearch className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
121
121
|
<input
|
|
122
122
|
ref={ref}
|
|
123
123
|
value={search}
|
package/registry/file-upload.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import {
|
|
4
|
+
import { LuUpload, LuX, LuFile, LuImage, LuFileText, LuFilm, LuMusic } from "react-icons/lu"
|
|
5
5
|
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: LuFile[]) => void
|
|
10
10
|
accept?: string
|
|
11
11
|
multiple?: boolean
|
|
12
12
|
maxSize?: number // in bytes
|
|
@@ -16,16 +16,16 @@ interface FileUploadProps {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface UploadedFile {
|
|
19
|
-
file:
|
|
19
|
+
file: LuFile
|
|
20
20
|
preview?: string
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const getFileIcon = (type: string) => {
|
|
24
|
-
if (type.startsWith("image/")) return
|
|
25
|
-
if (type.startsWith("video/")) return
|
|
26
|
-
if (type.startsWith("audio/")) return
|
|
27
|
-
if (type.includes("pdf") || type.includes("document")) return
|
|
28
|
-
return
|
|
24
|
+
if (type.startsWith("image/")) return LuImage
|
|
25
|
+
if (type.startsWith("video/")) return LuFilm
|
|
26
|
+
if (type.startsWith("audio/")) return LuMusic
|
|
27
|
+
if (type.includes("pdf") || type.includes("document")) return LuFileText
|
|
28
|
+
return LuFile
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const formatFileSize = (bytes: number): string => {
|
|
@@ -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(`LuFile(s) exceed maximum size of ${formatFileSize(maxSize)}`)
|
|
75
75
|
return
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -163,7 +163,7 @@ export function FileUpload({
|
|
|
163
163
|
"flex h-14 w-14 items-center justify-center rounded-full bg-muted transition-colors",
|
|
164
164
|
isDragging && "bg-primary/10"
|
|
165
165
|
)}>
|
|
166
|
-
<
|
|
166
|
+
<LuUpload className={cn(
|
|
167
167
|
"h-6 w-6 text-muted-foreground",
|
|
168
168
|
isDragging && "text-primary"
|
|
169
169
|
)} />
|
|
@@ -188,7 +188,7 @@ export function FileUpload({
|
|
|
188
188
|
<p className="text-sm text-destructive">{error}</p>
|
|
189
189
|
)}
|
|
190
190
|
|
|
191
|
-
{/*
|
|
191
|
+
{/* LuFile List */}
|
|
192
192
|
{files.length > 0 && (
|
|
193
193
|
<div className="space-y-2">
|
|
194
194
|
{files.map((uploadedFile, index) => {
|
|
@@ -228,7 +228,7 @@ export function FileUpload({
|
|
|
228
228
|
removeFile(index)
|
|
229
229
|
}}
|
|
230
230
|
>
|
|
231
|
-
<
|
|
231
|
+
<LuX className="h-4 w-4" />
|
|
232
232
|
</Button>
|
|
233
233
|
</div>
|
|
234
234
|
)
|
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 { LuPanelLeft } from "react-icons/lu"
|
|
5
5
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
6
|
|
|
7
7
|
import { cn } from "@/lib/utils"
|
|
@@ -233,7 +233,7 @@ const SidebarTrigger = React.forwardRef<
|
|
|
233
233
|
}}
|
|
234
234
|
{...props}
|
|
235
235
|
>
|
|
236
|
-
<
|
|
236
|
+
<LuPanelLeft />
|
|
237
237
|
<span className="sr-only">Toggle Sidebar</span>
|
|
238
238
|
</Button>
|
|
239
239
|
)
|