@aomi-labs/widget-lib 1.0.0 → 1.1.1
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/dist/accordion.json +18 -0
- package/dist/alert.json +17 -0
- package/dist/aomi-frame.json +24 -0
- package/dist/assistant-thread-list.json +22 -0
- package/dist/assistant-thread.json +27 -0
- package/dist/assistant-threadlist-sidebar.json +20 -0
- package/dist/assistant-tool-fallback.json +20 -0
- package/dist/avatar.json +17 -0
- package/dist/badge.json +17 -0
- package/dist/breadcrumb.json +17 -0
- package/dist/button.json +18 -0
- package/dist/card.json +15 -0
- package/dist/collapsible.json +17 -0
- package/dist/command.json +21 -0
- package/dist/dialog.json +18 -0
- package/dist/drawer.json +17 -0
- package/dist/input.json +15 -0
- package/dist/label.json +15 -0
- package/dist/notification.json +20 -0
- package/dist/popover.json +17 -0
- package/dist/registry.json +429 -0
- package/dist/separator.json +17 -0
- package/dist/sheet.json +18 -0
- package/dist/sidebar.json +18 -0
- package/dist/skeleton.json +15 -0
- package/dist/sonner.json +17 -0
- package/dist/tooltip.json +17 -0
- package/package.json +27 -85
- package/src/components/aomi-frame.tsx +221 -0
- package/src/components/assistant-ui/attachment.tsx +235 -0
- package/src/components/assistant-ui/markdown-text.tsx +228 -0
- package/src/components/assistant-ui/thread-list.tsx +106 -0
- package/src/components/assistant-ui/thread.tsx +476 -0
- package/src/components/assistant-ui/threadlist-sidebar.tsx +66 -0
- package/src/components/assistant-ui/tool-fallback.tsx +48 -0
- package/src/components/assistant-ui/tooltip-icon-button.tsx +42 -0
- package/src/components/control-bar/api-key-input.tsx +122 -0
- package/src/components/control-bar/index.tsx +58 -0
- package/src/components/control-bar/model-select.tsx +120 -0
- package/src/components/control-bar/namespace-select.tsx +117 -0
- package/src/components/control-bar/wallet-connect.tsx +75 -0
- package/src/components/test/ThreadContextTest.tsx +204 -0
- package/src/components/tools/example-tool/ExampleTool.tsx +102 -0
- package/src/components/ui/accordion.tsx +58 -0
- package/src/components/ui/alert.tsx +62 -0
- package/src/components/ui/avatar.tsx +53 -0
- package/src/components/ui/badge.tsx +37 -0
- package/src/components/ui/breadcrumb.tsx +109 -0
- package/src/components/ui/button.tsx +59 -0
- package/src/components/ui/card.tsx +86 -0
- package/src/components/ui/collapsible.tsx +12 -0
- package/src/components/ui/command.tsx +156 -0
- package/src/components/ui/dialog.tsx +143 -0
- package/src/components/ui/drawer.tsx +118 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +20 -0
- package/src/components/ui/notification.tsx +57 -0
- package/src/components/ui/popover.tsx +33 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/sheet.tsx +139 -0
- package/src/components/ui/sidebar.tsx +827 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/sonner.tsx +29 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/index.ts +26 -0
- package/src/registry.ts +218 -0
- package/{dist/styles.css → src/themes/default.css} +21 -3
- package/src/themes/tokens.config.ts +39 -0
- package/README.md +0 -41
- package/dist/index.cjs +0 -3780
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -302
- package/dist/index.d.ts +0 -302
- package/dist/index.js +0 -3696
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry.json",
|
|
3
|
+
"name": "aomi",
|
|
4
|
+
"homepage": "https://r.aomi.dev",
|
|
5
|
+
"items": [
|
|
6
|
+
{
|
|
7
|
+
"name": "aomi-frame",
|
|
8
|
+
"type": "registry:component",
|
|
9
|
+
"description": "Full assistant shell with thread list and runtime wiring.",
|
|
10
|
+
"files": [
|
|
11
|
+
{
|
|
12
|
+
"type": "registry:component",
|
|
13
|
+
"path": "components/aomi-frame.tsx"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"dependencies": [
|
|
17
|
+
"@aomi-labs/react"
|
|
18
|
+
],
|
|
19
|
+
"registryDependencies": [
|
|
20
|
+
"https://widget.aomi.dev/r/assistant-thread.json",
|
|
21
|
+
"https://widget.aomi.dev/r/assistant-threadlist-sidebar.json",
|
|
22
|
+
"https://widget.aomi.dev/r/notification.json",
|
|
23
|
+
"separator",
|
|
24
|
+
"breadcrumb",
|
|
25
|
+
"sidebar"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "assistant-thread",
|
|
30
|
+
"type": "registry:component",
|
|
31
|
+
"description": "Chat surface built on @assistant-ui primitives.",
|
|
32
|
+
"files": [
|
|
33
|
+
{
|
|
34
|
+
"type": "registry:component",
|
|
35
|
+
"path": "components/assistant-ui/thread.tsx"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"dependencies": [
|
|
39
|
+
"@aomi-labs/react",
|
|
40
|
+
"@assistant-ui/react",
|
|
41
|
+
"@assistant-ui/react-markdown",
|
|
42
|
+
"lucide-react",
|
|
43
|
+
"remark-gfm"
|
|
44
|
+
],
|
|
45
|
+
"registryDependencies": [
|
|
46
|
+
"https://r.assistant-ui.com/markdown-text.json",
|
|
47
|
+
"https://r.assistant-ui.com/tooltip-icon-button.json",
|
|
48
|
+
"https://r.assistant-ui.com/attachment.json",
|
|
49
|
+
"https://widget.aomi.dev/r/assistant-tool-fallback.json",
|
|
50
|
+
"button"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "assistant-thread-list",
|
|
55
|
+
"type": "registry:component",
|
|
56
|
+
"description": "Thread list wrapper wired to runtime adapter.",
|
|
57
|
+
"files": [
|
|
58
|
+
{
|
|
59
|
+
"type": "registry:component",
|
|
60
|
+
"path": "components/assistant-ui/thread-list.tsx"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"dependencies": [
|
|
64
|
+
"@assistant-ui/react",
|
|
65
|
+
"lucide-react"
|
|
66
|
+
],
|
|
67
|
+
"registryDependencies": [
|
|
68
|
+
"https://r.assistant-ui.com/tooltip-icon-button.json",
|
|
69
|
+
"button",
|
|
70
|
+
"skeleton"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "assistant-threadlist-sidebar",
|
|
75
|
+
"type": "registry:component",
|
|
76
|
+
"description": "Sidebar shell for thread navigation and wallet footer slot.",
|
|
77
|
+
"files": [
|
|
78
|
+
{
|
|
79
|
+
"type": "registry:component",
|
|
80
|
+
"path": "components/assistant-ui/threadlist-sidebar.tsx"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"dependencies": [
|
|
84
|
+
"lucide-react"
|
|
85
|
+
],
|
|
86
|
+
"registryDependencies": [
|
|
87
|
+
"https://widget.aomi.dev/r/assistant-thread-list.json",
|
|
88
|
+
"sidebar"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "assistant-tool-fallback",
|
|
93
|
+
"type": "registry:component",
|
|
94
|
+
"description": "Fallback renderer for assistant tool calls.",
|
|
95
|
+
"files": [
|
|
96
|
+
{
|
|
97
|
+
"type": "registry:component",
|
|
98
|
+
"path": "components/assistant-ui/tool-fallback.tsx"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"dependencies": [
|
|
102
|
+
"@assistant-ui/react",
|
|
103
|
+
"lucide-react"
|
|
104
|
+
],
|
|
105
|
+
"registryDependencies": [
|
|
106
|
+
"button"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "notification",
|
|
111
|
+
"type": "registry:component",
|
|
112
|
+
"description": "Notification toaster wired to the runtime notification store.",
|
|
113
|
+
"files": [
|
|
114
|
+
{
|
|
115
|
+
"type": "registry:component",
|
|
116
|
+
"path": "components/ui/notification.tsx"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"dependencies": [
|
|
120
|
+
"@aomi-labs/react",
|
|
121
|
+
"sonner"
|
|
122
|
+
],
|
|
123
|
+
"registryDependencies": [
|
|
124
|
+
"https://widget.aomi.dev/r/sonner.json"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "sonner",
|
|
129
|
+
"type": "registry:component",
|
|
130
|
+
"description": "Shadcn wrapper for Sonner toasts.",
|
|
131
|
+
"files": [
|
|
132
|
+
{
|
|
133
|
+
"type": "registry:component",
|
|
134
|
+
"path": "components/ui/sonner.tsx"
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"dependencies": [
|
|
138
|
+
"sonner"
|
|
139
|
+
],
|
|
140
|
+
"registryDependencies": []
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "button",
|
|
144
|
+
"type": "registry:component",
|
|
145
|
+
"description": "Displays a button or a component that looks like a button.",
|
|
146
|
+
"files": [
|
|
147
|
+
{
|
|
148
|
+
"type": "registry:component",
|
|
149
|
+
"path": "components/ui/button.tsx"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"dependencies": [
|
|
153
|
+
"@radix-ui/react-slot",
|
|
154
|
+
"class-variance-authority"
|
|
155
|
+
],
|
|
156
|
+
"registryDependencies": []
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "input",
|
|
160
|
+
"type": "registry:component",
|
|
161
|
+
"description": "Displays a form input field or a component that looks like an input field.",
|
|
162
|
+
"files": [
|
|
163
|
+
{
|
|
164
|
+
"type": "registry:component",
|
|
165
|
+
"path": "components/ui/input.tsx"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"dependencies": [],
|
|
169
|
+
"registryDependencies": []
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "label",
|
|
173
|
+
"type": "registry:component",
|
|
174
|
+
"description": "Renders an accessible label associated with controls.",
|
|
175
|
+
"files": [
|
|
176
|
+
{
|
|
177
|
+
"type": "registry:component",
|
|
178
|
+
"path": "components/ui/label.tsx"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"dependencies": [],
|
|
182
|
+
"registryDependencies": []
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "card",
|
|
186
|
+
"type": "registry:component",
|
|
187
|
+
"description": "Displays a card with header, content, and footer.",
|
|
188
|
+
"files": [
|
|
189
|
+
{
|
|
190
|
+
"type": "registry:component",
|
|
191
|
+
"path": "components/ui/card.tsx"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"dependencies": [],
|
|
195
|
+
"registryDependencies": []
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "badge",
|
|
199
|
+
"type": "registry:component",
|
|
200
|
+
"description": "Displays a badge or a component that looks like a badge.",
|
|
201
|
+
"files": [
|
|
202
|
+
{
|
|
203
|
+
"type": "registry:component",
|
|
204
|
+
"path": "components/ui/badge.tsx"
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"dependencies": [
|
|
208
|
+
"class-variance-authority"
|
|
209
|
+
],
|
|
210
|
+
"registryDependencies": []
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "avatar",
|
|
214
|
+
"type": "registry:component",
|
|
215
|
+
"description": "An image element with a fallback for representing the user.",
|
|
216
|
+
"files": [
|
|
217
|
+
{
|
|
218
|
+
"type": "registry:component",
|
|
219
|
+
"path": "components/ui/avatar.tsx"
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"dependencies": [
|
|
223
|
+
"@radix-ui/react-avatar"
|
|
224
|
+
],
|
|
225
|
+
"registryDependencies": []
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "skeleton",
|
|
229
|
+
"type": "registry:component",
|
|
230
|
+
"description": "Use to show a placeholder while content is loading.",
|
|
231
|
+
"files": [
|
|
232
|
+
{
|
|
233
|
+
"type": "registry:component",
|
|
234
|
+
"path": "components/ui/skeleton.tsx"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"dependencies": [],
|
|
238
|
+
"registryDependencies": []
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"name": "tooltip",
|
|
242
|
+
"type": "registry:component",
|
|
243
|
+
"description": "A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.",
|
|
244
|
+
"files": [
|
|
245
|
+
{
|
|
246
|
+
"type": "registry:component",
|
|
247
|
+
"path": "components/ui/tooltip.tsx"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
"dependencies": [
|
|
251
|
+
"@radix-ui/react-tooltip"
|
|
252
|
+
],
|
|
253
|
+
"registryDependencies": []
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"name": "separator",
|
|
257
|
+
"type": "registry:component",
|
|
258
|
+
"description": "Visually or semantically separates content.",
|
|
259
|
+
"files": [
|
|
260
|
+
{
|
|
261
|
+
"type": "registry:component",
|
|
262
|
+
"path": "components/ui/separator.tsx"
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"dependencies": [
|
|
266
|
+
"@radix-ui/react-separator"
|
|
267
|
+
],
|
|
268
|
+
"registryDependencies": []
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"name": "breadcrumb",
|
|
272
|
+
"type": "registry:component",
|
|
273
|
+
"description": "Displays the path to the current resource using a hierarchy of links.",
|
|
274
|
+
"files": [
|
|
275
|
+
{
|
|
276
|
+
"type": "registry:component",
|
|
277
|
+
"path": "components/ui/breadcrumb.tsx"
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"dependencies": [
|
|
281
|
+
"@radix-ui/react-slot"
|
|
282
|
+
],
|
|
283
|
+
"registryDependencies": []
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "sidebar",
|
|
287
|
+
"type": "registry:component",
|
|
288
|
+
"description": "Displays a sidebar navigation component.",
|
|
289
|
+
"files": [
|
|
290
|
+
{
|
|
291
|
+
"type": "registry:component",
|
|
292
|
+
"path": "components/ui/sidebar.tsx"
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
"dependencies": [
|
|
296
|
+
"@radix-ui/react-slot",
|
|
297
|
+
"class-variance-authority"
|
|
298
|
+
],
|
|
299
|
+
"registryDependencies": []
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"name": "dialog",
|
|
303
|
+
"type": "registry:component",
|
|
304
|
+
"description": "A window overlaid on either the primary window or another dialog window.",
|
|
305
|
+
"files": [
|
|
306
|
+
{
|
|
307
|
+
"type": "registry:component",
|
|
308
|
+
"path": "components/ui/dialog.tsx"
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
"dependencies": [
|
|
312
|
+
"@radix-ui/react-dialog",
|
|
313
|
+
"lucide-react"
|
|
314
|
+
],
|
|
315
|
+
"registryDependencies": []
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"name": "sheet",
|
|
319
|
+
"type": "registry:component",
|
|
320
|
+
"description": "Extends the Dialog component to display content that complements the main content of the screen.",
|
|
321
|
+
"files": [
|
|
322
|
+
{
|
|
323
|
+
"type": "registry:component",
|
|
324
|
+
"path": "components/ui/sheet.tsx"
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
"dependencies": [
|
|
328
|
+
"@radix-ui/react-dialog",
|
|
329
|
+
"lucide-react"
|
|
330
|
+
],
|
|
331
|
+
"registryDependencies": []
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"name": "collapsible",
|
|
335
|
+
"type": "registry:component",
|
|
336
|
+
"description": "An interactive component which expands/collapses a panel.",
|
|
337
|
+
"files": [
|
|
338
|
+
{
|
|
339
|
+
"type": "registry:component",
|
|
340
|
+
"path": "components/ui/collapsible.tsx"
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
"dependencies": [
|
|
344
|
+
"@radix-ui/react-collapsible"
|
|
345
|
+
],
|
|
346
|
+
"registryDependencies": []
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"name": "command",
|
|
350
|
+
"type": "registry:component",
|
|
351
|
+
"description": "Fast, composable, unstyled command menu for React.",
|
|
352
|
+
"files": [
|
|
353
|
+
{
|
|
354
|
+
"type": "registry:component",
|
|
355
|
+
"path": "components/ui/command.tsx"
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
"dependencies": [
|
|
359
|
+
"@radix-ui/react-dialog",
|
|
360
|
+
"cmdk",
|
|
361
|
+
"lucide-react"
|
|
362
|
+
],
|
|
363
|
+
"registryDependencies": [
|
|
364
|
+
"dialog"
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"name": "popover",
|
|
369
|
+
"type": "registry:component",
|
|
370
|
+
"description": "Displays rich content in a portal, triggered by a button.",
|
|
371
|
+
"files": [
|
|
372
|
+
{
|
|
373
|
+
"type": "registry:component",
|
|
374
|
+
"path": "components/ui/popover.tsx"
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
"dependencies": [
|
|
378
|
+
"@radix-ui/react-popover"
|
|
379
|
+
],
|
|
380
|
+
"registryDependencies": []
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"name": "alert",
|
|
384
|
+
"type": "registry:component",
|
|
385
|
+
"description": "Displays a callout for user attention.",
|
|
386
|
+
"files": [
|
|
387
|
+
{
|
|
388
|
+
"type": "registry:component",
|
|
389
|
+
"path": "components/ui/alert.tsx"
|
|
390
|
+
}
|
|
391
|
+
],
|
|
392
|
+
"dependencies": [
|
|
393
|
+
"class-variance-authority"
|
|
394
|
+
],
|
|
395
|
+
"registryDependencies": []
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"name": "accordion",
|
|
399
|
+
"type": "registry:component",
|
|
400
|
+
"description": "A vertically stacked set of interactive headings that each reveal a section of content.",
|
|
401
|
+
"files": [
|
|
402
|
+
{
|
|
403
|
+
"type": "registry:component",
|
|
404
|
+
"path": "components/ui/accordion.tsx"
|
|
405
|
+
}
|
|
406
|
+
],
|
|
407
|
+
"dependencies": [
|
|
408
|
+
"@radix-ui/react-accordion",
|
|
409
|
+
"lucide-react"
|
|
410
|
+
],
|
|
411
|
+
"registryDependencies": []
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"name": "drawer",
|
|
415
|
+
"type": "registry:component",
|
|
416
|
+
"description": "A drawer component for mobile navigation menus and similar interfaces.",
|
|
417
|
+
"files": [
|
|
418
|
+
{
|
|
419
|
+
"type": "registry:component",
|
|
420
|
+
"path": "components/ui/drawer.tsx"
|
|
421
|
+
}
|
|
422
|
+
],
|
|
423
|
+
"dependencies": [
|
|
424
|
+
"vaul"
|
|
425
|
+
],
|
|
426
|
+
"registryDependencies": []
|
|
427
|
+
}
|
|
428
|
+
]
|
|
429
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "separator",
|
|
4
|
+
"type": "registry:component",
|
|
5
|
+
"description": "Visually or semantically separates content.",
|
|
6
|
+
"files": [
|
|
7
|
+
{
|
|
8
|
+
"type": "registry:component",
|
|
9
|
+
"path": "components/ui/separator.tsx",
|
|
10
|
+
"content": "\"use client\";\n\nimport * as React from \"react\";\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\n\nimport { cn } from \"@aomi-labs/react\";\n\nfunction Separator({\n className,\n orientation = \"horizontal\",\n decorative = true,\n ...props\n}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {\n return (\n <SeparatorPrimitive.Root\n data-slot=\"separator\"\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 data-[orientation=horizontal]:h-px data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Separator };\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"dependencies": [
|
|
14
|
+
"@radix-ui/react-separator"
|
|
15
|
+
],
|
|
16
|
+
"registryDependencies": []
|
|
17
|
+
}
|
package/dist/sheet.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "sheet",
|
|
4
|
+
"type": "registry:component",
|
|
5
|
+
"description": "Extends the Dialog component to display content that complements the main content of the screen.",
|
|
6
|
+
"files": [
|
|
7
|
+
{
|
|
8
|
+
"type": "registry:component",
|
|
9
|
+
"path": "components/ui/sheet.tsx",
|
|
10
|
+
"content": "\"use client\";\n\nimport * as React from \"react\";\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { XIcon } from \"lucide-react\";\n\nimport { cn } from \"@aomi-labs/react\";\n\nfunction Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />;\n}\n\nfunction SheetTrigger({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />;\n}\n\nfunction SheetClose({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />;\n}\n\nfunction SheetPortal({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />;\n}\n\nfunction SheetOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {\n return (\n <SheetPrimitive.Overlay\n data-slot=\"sheet-overlay\"\n className={cn(\n \"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SheetContent({\n className,\n children,\n side = \"right\",\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Content> & {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n}) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n data-slot=\"sheet-content\"\n className={cn(\n \"bg-background data-[state=closed]:animate-out data-[state=open]:animate-in fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500\",\n side === \"right\" &&\n \"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm\",\n side === \"left\" &&\n \"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm\",\n side === \"top\" &&\n \"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b\",\n side === \"bottom\" &&\n \"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t\",\n className,\n )}\n {...props}\n >\n {children}\n <SheetPrimitive.Close className=\"rounded-xs ring-offset-background focus:ring-ring focus:outline-hidden data-[state=open]:bg-secondary absolute right-4 top-4 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none\">\n <XIcon className=\"size-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n </SheetPrimitive.Content>\n </SheetPortal>\n );\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn(\"flex flex-col gap-1.5 p-4\", className)}\n {...props}\n />\n );\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\n {...props}\n />\n );\n}\n\nfunction SheetTitle({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn(\"text-foreground font-semibold\", className)}\n {...props}\n />\n );\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n};\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"dependencies": [
|
|
14
|
+
"@radix-ui/react-dialog",
|
|
15
|
+
"lucide-react"
|
|
16
|
+
],
|
|
17
|
+
"registryDependencies": []
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "sidebar",
|
|
4
|
+
"type": "registry:component",
|
|
5
|
+
"description": "Displays a sidebar navigation component.",
|
|
6
|
+
"files": [
|
|
7
|
+
{
|
|
8
|
+
"type": "registry:component",
|
|
9
|
+
"path": "components/ui/sidebar.tsx",
|
|
10
|
+
"content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, VariantProps } from \"class-variance-authority\";\nimport { PanelLeftIcon } from \"lucide-react\";\n\nimport { useIsMobile } from \"@/hooks/use-mobile\";\nimport { cn } from \"@aomi-labs/react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Separator } from \"@/components/ui/separator\";\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n} from \"@/components/ui/sheet\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\n\nconst SIDEBAR_COOKIE_NAME = \"sidebar_state\";\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\nconst SIDEBAR_WIDTH = \"16rem\";\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\";\nconst SIDEBAR_WIDTH_ICON = \"3rem\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\nconst SIDEBAR_MIN_WIDTH = 100; // px\nconst SIDEBAR_MAX_WIDTH = 200; // px\n\ntype SidebarContextProps = {\n state: \"expanded\" | \"collapsed\";\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n sidebarWidth: number;\n setSidebarWidth: (width: number) => void;\n};\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null);\n\nfunction useSidebar() {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider.\");\n }\n\n return context;\n}\n\nfunction SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = React.useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = React.useState(defaultOpen);\n const open = openProp ?? _open;\n\n // Sidebar width state (in pixels)\n const [sidebarWidth, setSidebarWidth] = React.useState(256); // 16rem = 256px\n const setOpen = React.useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === \"function\" ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n\n // This sets the cookie to keep the sidebar state.\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n },\n [setOpenProp, open],\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = React.useCallback(() => {\n return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey)\n ) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => window.removeEventListener(\"keydown\", handleKeyDown);\n }, [toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? \"expanded\" : \"collapsed\";\n\n const contextValue = React.useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n sidebarWidth,\n setSidebarWidth,\n }),\n [\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n sidebarWidth,\n ],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider delayDuration={0}>\n <div\n data-slot=\"sidebar-wrapper\"\n style={\n {\n \"--sidebar-width\": `${sidebarWidth}px`,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n \"group/sidebar-wrapper has-data-[variant=offcanvas]:bg-sidebar flex h-full w-full\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n}\n\nfunction Sidebar({\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"offcanvas\",\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\";\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n collapsible?: \"offcanvas\" | \"icon\" | \"none\";\n}) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === \"none\") {\n return (\n <div\n data-slot=\"sidebar\"\n className={cn(\n \"w-(--sidebar-width) bg-sidebar text-sidebar-foreground flex h-full flex-col\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>\n <SheetContent\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) bg-sidebar text-sidebar-foreground p-0 [&>button]:hidden\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n side={side}\n >\n <SheetHeader className=\"sr-only\">\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n className={cn(\n \"text-sidebar-foreground group peer relative hidden md:block\",\n \"w-[var(--sidebar-width)]\",\n \"data-[collapsible=offcanvas]:w-0\",\n \"transition-[width] duration-200 ease-linear\",\n )}\n data-state={state}\n data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n data-variant={variant}\n data-side={side}\n data-slot=\"sidebar\"\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n data-slot=\"sidebar-gap\"\n className={cn(\n \"w-(--sidebar-width) relative bg-transparent transition-[width] duration-200 ease-linear\",\n \"group-data-[collapsible=offcanvas]:w-0\",\n \"group-data-[side=right]:rotate-180\",\n variant === \"floating\" || variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n )}\n />\n <div\n data-slot=\"sidebar-container\"\n className={cn(\n \"w-(--sidebar-width) fixed inset-y-0 z-10 hidden h-full transition-[left,right,width] duration-200 ease-linear md:flex\",\n side === \"left\"\n ? \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"\n : \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n // Adjust the padding for floating and inset variants.\n variant === \"floating\"\n ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n className,\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar-inner\"\n className=\"\n bg-sidebar\n dark:bg-sidebar \n group-data-[variant=floating]:border-sidebar-border \n flex h-full w-full flex-col \n group-data-[variant=floating]:rounded-lg \n group-data-[variant=floating]:border \n group-data-[variant=floating]:shadow-sm\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\nfunction SidebarTrigger({\n className,\n onClick,\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { toggleSidebar } = useSidebar();\n\n return (\n <Button\n data-sidebar=\"trigger\"\n data-slot=\"sidebar-trigger\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\"size-7\", className)}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n >\n <PanelLeftIcon />\n <span className=\"sr-only\">Toggle Sidebar</span>\n </Button>\n );\n}\n\nfunction SidebarRail({ className, ...props }: React.ComponentProps<\"button\">) {\n const { toggleSidebar, sidebarWidth, setSidebarWidth, setOpen } =\n useSidebar();\n const isDraggingRef = React.useRef(false);\n const startXRef = React.useRef(0);\n const startWidthRef = React.useRef(0);\n const hasDraggedRef = React.useRef(false);\n const rafRef = React.useRef<number | null>(null);\n\n const handleMouseDown = React.useCallback(\n (e: React.MouseEvent) => {\n e.preventDefault();\n isDraggingRef.current = true;\n hasDraggedRef.current = false;\n startXRef.current = e.clientX;\n startWidthRef.current = sidebarWidth;\n document.body.style.cursor = \"ew-resize\";\n document.body.style.userSelect = \"none\";\n },\n [sidebarWidth],\n );\n\n React.useEffect(() => {\n const handleMouseMove = (e: MouseEvent) => {\n if (!isDraggingRef.current) return;\n\n // Cancel any pending RAF\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n }\n\n rafRef.current = requestAnimationFrame(() => {\n const deltaX = e.clientX - startXRef.current;\n if (Math.abs(deltaX) > 5) {\n hasDraggedRef.current = true;\n }\n\n const rawWidth = startWidthRef.current + deltaX;\n\n if (rawWidth < SIDEBAR_MIN_WIDTH) {\n setOpen(false);\n } else {\n setOpen(true);\n setSidebarWidth(Math.min(SIDEBAR_MAX_WIDTH, rawWidth));\n }\n });\n };\n\n const handleMouseUp = () => {\n if (!isDraggingRef.current) return;\n isDraggingRef.current = false;\n document.body.style.cursor = \"\";\n document.body.style.userSelect = \"\";\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n }\n };\n\n document.addEventListener(\"mousemove\", handleMouseMove);\n document.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n document.removeEventListener(\"mousemove\", handleMouseMove);\n document.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [setSidebarWidth, setOpen]);\n\n const handleClick = React.useCallback(() => {\n if (!hasDraggedRef.current) {\n toggleSidebar();\n }\n }, [toggleSidebar]);\n\n return (\n <button\n data-sidebar=\"rail\"\n data-slot=\"sidebar-rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onMouseDown={handleMouseDown}\n onClick={handleClick}\n title=\"Drag to resize, click to toggle\"\n className={cn(\n \"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex\",\n \"cursor-ew-resize\",\n \"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full\",\n \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2\",\n \"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarInset({ className, ...props }: React.ComponentProps<\"main\">) {\n return (\n <main\n data-slot=\"sidebar-inset\"\n className={cn(\n \"bg-background relative flex w-full flex-1 flex-col\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarInput({\n className,\n ...props\n}: React.ComponentProps<typeof Input>) {\n return (\n <Input\n data-slot=\"sidebar-input\"\n data-sidebar=\"input\"\n className={cn(\"bg-background h-8 w-full shadow-none\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-header\"\n data-sidebar=\"header\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-footer\"\n data-sidebar=\"footer\"\n className={cn(\"mr-2 flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"sidebar-separator\"\n data-sidebar=\"separator\"\n className={cn(\"bg-sidebar-border mx-2 w-auto\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-content\"\n data-sidebar=\"content\"\n className={cn(\n \"mr-2 flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group\"\n data-sidebar=\"group\"\n className={cn(\"relative flex w-full min-w-0 flex-col p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupLabel({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> & { asChild?: boolean }) {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n data-slot=\"sidebar-group-label\"\n data-sidebar=\"group-label\"\n className={cn(\n \"text-sidebar-foreground/70 ring-sidebar-ring outline-hidden flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n \"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupAction({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> & { asChild?: boolean }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"sidebar-group-action\"\n data-sidebar=\"group-action\"\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupContent({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group-content\"\n data-sidebar=\"group-content\"\n className={cn(\"w-full text-sm\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenu({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu\"\n data-sidebar=\"menu\"\n className={cn(\"flex w-full min-w-0 list-none flex-col gap-1\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuItem({ className, ...props }: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-item\"\n data-sidebar=\"menu-item\"\n className={cn(\"group/menu-item relative\", className)}\n {...props}\n />\n );\n}\n\nconst sidebarMenuButtonVariants = cva(\n \"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n outline:\n \"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]\",\n },\n size: {\n default: \"h-8 text-sm\",\n sm: \"h-7 text-xs\",\n lg: \"h-12 text-sm group-data-[collapsible=icon]:p-0!\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nfunction SidebarMenuButton({\n asChild = false,\n isActive = false,\n variant = \"default\",\n size = \"default\",\n tooltip,\n className,\n ...props\n}: React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n isActive?: boolean;\n tooltip?: string | React.ComponentProps<typeof TooltipContent>;\n} & VariantProps<typeof sidebarMenuButtonVariants>) {\n const Comp = asChild ? Slot : \"button\";\n const { isMobile, state } = useSidebar();\n\n const button = (\n <Comp\n data-slot=\"sidebar-menu-button\"\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n {...props}\n />\n );\n\n if (!tooltip) {\n return button;\n }\n\n if (typeof tooltip === \"string\") {\n tooltip = {\n children: tooltip,\n };\n }\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent\n side=\"right\"\n align=\"center\"\n hidden={state !== \"collapsed\" || isMobile}\n {...tooltip}\n />\n </Tooltip>\n );\n}\n\nfunction SidebarMenuAction({\n className,\n asChild = false,\n showOnHover = false,\n ...props\n}: React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n showOnHover?: boolean;\n}) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"sidebar-menu-action\"\n data-sidebar=\"menu-action\"\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring outline-hidden peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n showOnHover &&\n \"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuBadge({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-menu-badge\"\n data-sidebar=\"menu-badge\"\n className={cn(\n \"text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums\",\n \"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSkeleton({\n className,\n showIcon = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showIcon?: boolean;\n}) {\n // Random width between 50 to 90%.\n const width = React.useMemo(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`;\n }, []);\n\n return (\n <div\n data-slot=\"sidebar-menu-skeleton\"\n data-sidebar=\"menu-skeleton\"\n className={cn(\"flex h-8 items-center gap-2 rounded-md px-2\", className)}\n {...props}\n >\n {showIcon && (\n <Skeleton\n className=\"size-4 rounded-md\"\n data-sidebar=\"menu-skeleton-icon\"\n />\n )}\n <Skeleton\n className=\"max-w-(--skeleton-width) h-4 flex-1\"\n data-sidebar=\"menu-skeleton-text\"\n style={\n {\n \"--skeleton-width\": width,\n } as React.CSSProperties\n }\n />\n </div>\n );\n}\n\nfunction SidebarMenuSub({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu-sub\"\n data-sidebar=\"menu-sub\"\n className={cn(\n \"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSubItem({\n className,\n ...props\n}: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-sub-item\"\n data-sidebar=\"menu-sub-item\"\n className={cn(\"group/menu-sub-item relative\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSubButton({\n asChild = false,\n size = \"md\",\n isActive = false,\n className,\n ...props\n}: React.ComponentProps<\"a\"> & {\n asChild?: boolean;\n size?: \"sm\" | \"md\";\n isActive?: boolean;\n}) {\n const Comp = asChild ? Slot : \"a\";\n\n return (\n <Comp\n data-slot=\"sidebar-menu-sub-button\"\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n \"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground\",\n size === \"sm\" && \"text-xs\",\n size === \"md\" && \"text-sm\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n useSidebar,\n};\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"dependencies": [
|
|
14
|
+
"@radix-ui/react-slot",
|
|
15
|
+
"class-variance-authority"
|
|
16
|
+
],
|
|
17
|
+
"registryDependencies": []
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "skeleton",
|
|
4
|
+
"type": "registry:component",
|
|
5
|
+
"description": "Use to show a placeholder while content is loading.",
|
|
6
|
+
"files": [
|
|
7
|
+
{
|
|
8
|
+
"type": "registry:component",
|
|
9
|
+
"path": "components/ui/skeleton.tsx",
|
|
10
|
+
"content": "import * as React from \"react\";\n\nimport { cn } from \"@aomi-labs/react\";\n\nfunction Skeleton({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"skeleton\"\n className={cn(\"bg-accent animate-pulse rounded-md\", className)}\n {...props}\n />\n );\n}\n\nexport { Skeleton };\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"dependencies": [],
|
|
14
|
+
"registryDependencies": []
|
|
15
|
+
}
|
package/dist/sonner.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "sonner",
|
|
4
|
+
"type": "registry:component",
|
|
5
|
+
"description": "Shadcn wrapper for Sonner toasts.",
|
|
6
|
+
"files": [
|
|
7
|
+
{
|
|
8
|
+
"type": "registry:component",
|
|
9
|
+
"path": "components/ui/sonner.tsx",
|
|
10
|
+
"content": "\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { Toaster as Sonner } from \"sonner\";\n\nimport { cn } from \"@aomi-labs/react\";\n\ntype ToasterProps = ComponentProps<typeof Sonner>;\n\nexport function Toaster({ className, toastOptions, ...props }: ToasterProps) {\n return (\n <Sonner\n className={cn(\"toaster group\", className)}\n toastOptions={{\n classNames: {\n toast:\n \"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg\",\n description: \"group-[.toast]:text-muted-foreground\",\n actionButton:\n \"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground\",\n cancelButton:\n \"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground\",\n },\n ...toastOptions,\n }}\n {...props}\n />\n );\n}\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"dependencies": [
|
|
14
|
+
"sonner"
|
|
15
|
+
],
|
|
16
|
+
"registryDependencies": []
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "tooltip",
|
|
4
|
+
"type": "registry:component",
|
|
5
|
+
"description": "A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.",
|
|
6
|
+
"files": [
|
|
7
|
+
{
|
|
8
|
+
"type": "registry:component",
|
|
9
|
+
"path": "components/ui/tooltip.tsx",
|
|
10
|
+
"content": "\"use client\";\n\nimport * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"@aomi-labs/react\";\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delayDuration={delayDuration}\n {...props}\n />\n );\n}\n\nfunction Tooltip({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n return (\n <TooltipProvider>\n <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n </TooltipProvider>\n );\n}\n\nfunction TooltipTrigger({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />;\n}\n\nfunction TooltipContent({\n className,\n sideOffset = 0,\n children,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"origin-(--radix-tooltip-content-transform-origin) animate-in bg-primary text-primary-foreground fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs\",\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"dependencies": [
|
|
14
|
+
"@radix-ui/react-tooltip"
|
|
15
|
+
],
|
|
16
|
+
"registryDependencies": []
|
|
17
|
+
}
|