metabinaries 1.0.0
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/LICENSE +21 -0
- package/README.md +43 -0
- package/index.js +164 -0
- package/package.json +32 -0
- package/src/constants.js +62 -0
- package/src/templates/app.js +527 -0
- package/src/templates/configs.js +303 -0
- package/src/templates/core.js +328 -0
- package/src/templates/folder-structure.js +21 -0
- package/src/templates/layout.js +279 -0
- package/src/templates/misc.js +277 -0
- package/src/templates/packages.js +42 -0
- package/src/templates/ui-2.js +585 -0
- package/src/templates/ui-3.js +606 -0
- package/src/templates/ui-4.js +615 -0
- package/src/templates/ui.js +777 -0
- package/src/utils.js +38 -0
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
// UI Components Part 4 - Checkbox, Collapsible, Command, Dialog, Drawer, DropdownMenu, Popover, ScrollArea, Select, Separator, Sheet
|
|
2
|
+
|
|
3
|
+
export const uiTemplates4 = {
|
|
4
|
+
'components/ui/checkbox.tsx': `'use client';
|
|
5
|
+
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { Check } from 'lucide-react';
|
|
8
|
+
|
|
9
|
+
import { cn } from '@/lib/utils';
|
|
10
|
+
|
|
11
|
+
export interface CheckboxProps extends Omit<
|
|
12
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
13
|
+
'onChange'
|
|
14
|
+
> {
|
|
15
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
|
|
19
|
+
({ className, checked, onCheckedChange, ...props }, ref) => {
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
type='button'
|
|
23
|
+
role='checkbox'
|
|
24
|
+
aria-checked={checked}
|
|
25
|
+
onClick={() => onCheckedChange?.(!checked)}
|
|
26
|
+
className={cn(
|
|
27
|
+
'h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background',
|
|
28
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
29
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
30
|
+
'flex items-center justify-center transition-colors',
|
|
31
|
+
checked && 'bg-primary text-primary-foreground',
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...(props as React.ButtonHTMLAttributes<HTMLButtonElement>)}
|
|
35
|
+
>
|
|
36
|
+
{checked && <Check className='h-3 w-3' />}
|
|
37
|
+
</button>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
Checkbox.displayName = 'Checkbox';
|
|
42
|
+
|
|
43
|
+
export { Checkbox };`,
|
|
44
|
+
|
|
45
|
+
'components/ui/collapsible.tsx': `'use client';
|
|
46
|
+
|
|
47
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
48
|
+
|
|
49
|
+
function Collapsible({
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
52
|
+
return <CollapsiblePrimitive.Root data-slot='collapsible' {...props} />;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function CollapsibleTrigger({
|
|
56
|
+
...props
|
|
57
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
58
|
+
return (
|
|
59
|
+
<CollapsiblePrimitive.CollapsibleTrigger
|
|
60
|
+
data-slot='collapsible-trigger'
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function CollapsibleContent({
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
69
|
+
return (
|
|
70
|
+
<CollapsiblePrimitive.CollapsibleContent
|
|
71
|
+
data-slot='collapsible-content'
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };`,
|
|
78
|
+
|
|
79
|
+
'components/ui/popover.tsx': `'use client';
|
|
80
|
+
|
|
81
|
+
import * as React from 'react';
|
|
82
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
83
|
+
|
|
84
|
+
import { cn } from '@/lib/utils';
|
|
85
|
+
|
|
86
|
+
function Popover({
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
89
|
+
return <PopoverPrimitive.Root data-slot='popover' {...props} />;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function PopoverTrigger({
|
|
93
|
+
...props
|
|
94
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
95
|
+
return <PopoverPrimitive.Trigger data-slot='popover-trigger' {...props} />;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function PopoverContent({
|
|
99
|
+
className,
|
|
100
|
+
align = 'center',
|
|
101
|
+
sideOffset = 4,
|
|
102
|
+
...props
|
|
103
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
104
|
+
return (
|
|
105
|
+
<PopoverPrimitive.Portal>
|
|
106
|
+
<PopoverPrimitive.Content
|
|
107
|
+
data-slot='popover-content'
|
|
108
|
+
align={align}
|
|
109
|
+
sideOffset={sideOffset}
|
|
110
|
+
className={cn(
|
|
111
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]: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 z-50 w-72 rounded-md border p-4 shadow-md outline-hidden',
|
|
112
|
+
className
|
|
113
|
+
)}
|
|
114
|
+
{...props}
|
|
115
|
+
/>
|
|
116
|
+
</PopoverPrimitive.Portal>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function PopoverAnchor({
|
|
121
|
+
...props
|
|
122
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
123
|
+
return <PopoverPrimitive.Anchor data-slot='popover-anchor' {...props} />;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };`,
|
|
127
|
+
|
|
128
|
+
'components/ui/scroll-area.tsx': `'use client';
|
|
129
|
+
|
|
130
|
+
import * as React from 'react';
|
|
131
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
132
|
+
|
|
133
|
+
import { cn } from '@/lib/utils';
|
|
134
|
+
|
|
135
|
+
function ScrollArea({
|
|
136
|
+
className,
|
|
137
|
+
children,
|
|
138
|
+
...props
|
|
139
|
+
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
|
140
|
+
return (
|
|
141
|
+
<ScrollAreaPrimitive.Root
|
|
142
|
+
data-slot='scroll-area'
|
|
143
|
+
className={cn('relative overflow-hidden', className)}
|
|
144
|
+
{...props}
|
|
145
|
+
>
|
|
146
|
+
<ScrollAreaPrimitive.Viewport
|
|
147
|
+
data-slot='scroll-area-viewport'
|
|
148
|
+
className='h-full w-full rounded-[inherit]'
|
|
149
|
+
>
|
|
150
|
+
{children}
|
|
151
|
+
</ScrollAreaPrimitive.Viewport>
|
|
152
|
+
<ScrollBar />
|
|
153
|
+
<ScrollAreaPrimitive.Corner />
|
|
154
|
+
</ScrollAreaPrimitive.Root>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function ScrollBar({
|
|
159
|
+
className,
|
|
160
|
+
orientation = 'vertical',
|
|
161
|
+
...props
|
|
162
|
+
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
|
163
|
+
return (
|
|
164
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
165
|
+
data-slot='scroll-area-scrollbar'
|
|
166
|
+
orientation={orientation}
|
|
167
|
+
className={cn(
|
|
168
|
+
'flex touch-none transition-colors select-none',
|
|
169
|
+
orientation === 'vertical' &&
|
|
170
|
+
'h-full w-2.5 border-l border-l-transparent p-[1px]',
|
|
171
|
+
orientation === 'horizontal' &&
|
|
172
|
+
'h-2.5 flex-col border-t border-t-transparent p-[1px]',
|
|
173
|
+
className
|
|
174
|
+
)}
|
|
175
|
+
{...props}
|
|
176
|
+
>
|
|
177
|
+
<ScrollAreaPrimitive.ScrollAreaThumb
|
|
178
|
+
data-slot='scroll-area-thumb'
|
|
179
|
+
className='bg-border relative flex-1 rounded-full'
|
|
180
|
+
/>
|
|
181
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { ScrollArea, ScrollBar };`,
|
|
186
|
+
|
|
187
|
+
'components/ui/separator.tsx': `'use client';
|
|
188
|
+
|
|
189
|
+
import * as React from 'react';
|
|
190
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
191
|
+
|
|
192
|
+
import { cn } from '@/lib/utils';
|
|
193
|
+
|
|
194
|
+
function Separator({
|
|
195
|
+
className,
|
|
196
|
+
orientation = 'horizontal',
|
|
197
|
+
decorative = true,
|
|
198
|
+
...props
|
|
199
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
200
|
+
return (
|
|
201
|
+
<SeparatorPrimitive.Root
|
|
202
|
+
data-slot='separator-root'
|
|
203
|
+
decorative={decorative}
|
|
204
|
+
orientation={orientation}
|
|
205
|
+
className={cn(
|
|
206
|
+
'bg-border shrink-0',
|
|
207
|
+
orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',
|
|
208
|
+
className
|
|
209
|
+
)}
|
|
210
|
+
{...props}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { Separator };`,
|
|
216
|
+
|
|
217
|
+
'components/ui/dialog.tsx': `'use client';
|
|
218
|
+
|
|
219
|
+
import * as React from 'react';
|
|
220
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
221
|
+
import { XIcon } from 'lucide-react';
|
|
222
|
+
|
|
223
|
+
import { cn } from '@/lib/utils';
|
|
224
|
+
|
|
225
|
+
function Dialog({
|
|
226
|
+
...props
|
|
227
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
228
|
+
return <DialogPrimitive.Root data-slot='dialog' {...props} />;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function DialogTrigger({
|
|
232
|
+
...props
|
|
233
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
234
|
+
return <DialogPrimitive.Trigger data-slot='dialog-trigger' {...props} />;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function DialogPortal({
|
|
238
|
+
...props
|
|
239
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
240
|
+
return <DialogPrimitive.Portal data-slot='dialog-portal' {...props} />;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function DialogClose({
|
|
244
|
+
...props
|
|
245
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
246
|
+
return <DialogPrimitive.Close data-slot='dialog-close' {...props} />;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function DialogOverlay({
|
|
250
|
+
className,
|
|
251
|
+
...props
|
|
252
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
253
|
+
return (
|
|
254
|
+
<DialogPrimitive.Overlay
|
|
255
|
+
data-slot='dialog-overlay'
|
|
256
|
+
className={cn(
|
|
257
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80',
|
|
258
|
+
className
|
|
259
|
+
)}
|
|
260
|
+
{...props}
|
|
261
|
+
/>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function DialogContent({
|
|
266
|
+
className,
|
|
267
|
+
children,
|
|
268
|
+
...props
|
|
269
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content>) {
|
|
270
|
+
return (
|
|
271
|
+
<DialogPortal>
|
|
272
|
+
<DialogOverlay />
|
|
273
|
+
<DialogPrimitive.Content
|
|
274
|
+
data-slot='dialog-content'
|
|
275
|
+
className={cn(
|
|
276
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
|
277
|
+
className
|
|
278
|
+
)}
|
|
279
|
+
{...props}
|
|
280
|
+
>
|
|
281
|
+
{children}
|
|
282
|
+
<DialogPrimitive.Close className='ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none [&_svg]:size-4'>
|
|
283
|
+
<XIcon />
|
|
284
|
+
<span className='sr-only'>Close</span>
|
|
285
|
+
</DialogPrimitive.Close>
|
|
286
|
+
</DialogPrimitive.Content>
|
|
287
|
+
</DialogPortal>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
292
|
+
return (
|
|
293
|
+
<div
|
|
294
|
+
data-slot='dialog-header'
|
|
295
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
296
|
+
{...props}
|
|
297
|
+
/>
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
302
|
+
return (
|
|
303
|
+
<div
|
|
304
|
+
data-slot='dialog-footer'
|
|
305
|
+
className={cn(
|
|
306
|
+
'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
|
|
307
|
+
className
|
|
308
|
+
)}
|
|
309
|
+
{...props}
|
|
310
|
+
/>
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function DialogTitle({
|
|
315
|
+
className,
|
|
316
|
+
...props
|
|
317
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
318
|
+
return (
|
|
319
|
+
<DialogPrimitive.Title
|
|
320
|
+
data-slot='dialog-title'
|
|
321
|
+
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
|
|
322
|
+
{...props}
|
|
323
|
+
/>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function DialogDescription({
|
|
328
|
+
className,
|
|
329
|
+
...props
|
|
330
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
331
|
+
return (
|
|
332
|
+
<DialogPrimitive.Description
|
|
333
|
+
data-slot='dialog-description'
|
|
334
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
335
|
+
{...props}
|
|
336
|
+
/>
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export {
|
|
341
|
+
Dialog,
|
|
342
|
+
DialogPortal,
|
|
343
|
+
DialogOverlay,
|
|
344
|
+
DialogTrigger,
|
|
345
|
+
DialogClose,
|
|
346
|
+
DialogContent,
|
|
347
|
+
DialogHeader,
|
|
348
|
+
DialogFooter,
|
|
349
|
+
DialogTitle,
|
|
350
|
+
DialogDescription,
|
|
351
|
+
};`,
|
|
352
|
+
|
|
353
|
+
'components/ui/dropdown-menu.tsx': `'use client';
|
|
354
|
+
|
|
355
|
+
import * as React from 'react';
|
|
356
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
357
|
+
import {
|
|
358
|
+
CheckIcon,
|
|
359
|
+
ChevronRightIcon,
|
|
360
|
+
CircleIcon,
|
|
361
|
+
} from 'lucide-react';
|
|
362
|
+
|
|
363
|
+
import { cn } from '@/lib/utils';
|
|
364
|
+
|
|
365
|
+
function DropdownMenu({
|
|
366
|
+
...props
|
|
367
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
368
|
+
return <DropdownMenuPrimitive.Root data-slot='dropdown-menu' {...props} />;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function DropdownMenuPortal({
|
|
372
|
+
...props
|
|
373
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
374
|
+
return (
|
|
375
|
+
<DropdownMenuPrimitive.Portal data-slot='dropdown-menu-portal' {...props} />
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function DropdownMenuTrigger({
|
|
380
|
+
...props
|
|
381
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
|
382
|
+
return (
|
|
383
|
+
<DropdownMenuPrimitive.Trigger
|
|
384
|
+
data-slot='dropdown-menu-trigger'
|
|
385
|
+
{...props}
|
|
386
|
+
/>
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function DropdownMenuContent({
|
|
391
|
+
className,
|
|
392
|
+
sideOffset = 4,
|
|
393
|
+
...props
|
|
394
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
|
395
|
+
return (
|
|
396
|
+
<DropdownMenuPrimitive.Portal>
|
|
397
|
+
<DropdownMenuPrimitive.Content
|
|
398
|
+
data-slot='dropdown-menu-content'
|
|
399
|
+
sideOffset={sideOffset}
|
|
400
|
+
className={cn(
|
|
401
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]: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 z-50 min-w-32 rounded-md border p-1 shadow-md',
|
|
402
|
+
className
|
|
403
|
+
)}
|
|
404
|
+
{...props}
|
|
405
|
+
/>
|
|
406
|
+
</DropdownMenuPrimitive.Portal>
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function DropdownMenuItem({
|
|
411
|
+
className,
|
|
412
|
+
inset,
|
|
413
|
+
variant = 'default',
|
|
414
|
+
...props
|
|
415
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
416
|
+
inset?: boolean;
|
|
417
|
+
variant?: 'default' | 'destructive';
|
|
418
|
+
}) {
|
|
419
|
+
return (
|
|
420
|
+
<DropdownMenuPrimitive.Item
|
|
421
|
+
data-slot='dropdown-menu-item'
|
|
422
|
+
data-inset={inset}
|
|
423
|
+
data-variant={variant}
|
|
424
|
+
className={cn(
|
|
425
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset=true]:pl-8",
|
|
426
|
+
className
|
|
427
|
+
)}
|
|
428
|
+
{...props}
|
|
429
|
+
/>
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function DropdownMenuCheckboxItem({
|
|
434
|
+
className,
|
|
435
|
+
children,
|
|
436
|
+
checked,
|
|
437
|
+
...props
|
|
438
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
439
|
+
return (
|
|
440
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
441
|
+
data-slot='dropdown-menu-checkbox-item'
|
|
442
|
+
className={cn(
|
|
443
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4",
|
|
444
|
+
className
|
|
445
|
+
)}
|
|
446
|
+
checked={checked}
|
|
447
|
+
{...props}
|
|
448
|
+
>
|
|
449
|
+
<span className='absolute left-2 flex size-3.5 items-center justify-center'>
|
|
450
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
451
|
+
<CheckIcon className='size-4' />
|
|
452
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
453
|
+
</span>
|
|
454
|
+
{children}
|
|
455
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function DropdownMenuRadioGroup({
|
|
460
|
+
...props
|
|
461
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
462
|
+
return (
|
|
463
|
+
<DropdownMenuPrimitive.RadioGroup
|
|
464
|
+
data-slot='dropdown-menu-radio-group'
|
|
465
|
+
{...props}
|
|
466
|
+
/>
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function DropdownMenuRadioItem({
|
|
471
|
+
className,
|
|
472
|
+
children,
|
|
473
|
+
...props
|
|
474
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
475
|
+
return (
|
|
476
|
+
<DropdownMenuPrimitive.RadioItem
|
|
477
|
+
data-slot='dropdown-menu-radio-item'
|
|
478
|
+
className={cn(
|
|
479
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4",
|
|
480
|
+
className
|
|
481
|
+
)}
|
|
482
|
+
{...props}
|
|
483
|
+
>
|
|
484
|
+
<span className='absolute left-2 flex size-3.5 items-center justify-center'>
|
|
485
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
486
|
+
<CircleIcon className='fill-current size-2' />
|
|
487
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
488
|
+
</span>
|
|
489
|
+
{children}
|
|
490
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function DropdownMenuLabel({
|
|
495
|
+
className,
|
|
496
|
+
inset,
|
|
497
|
+
...props
|
|
498
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
499
|
+
inset?: boolean;
|
|
500
|
+
}) {
|
|
501
|
+
return (
|
|
502
|
+
<DropdownMenuPrimitive.Label
|
|
503
|
+
data-slot='dropdown-menu-label'
|
|
504
|
+
data-inset={inset}
|
|
505
|
+
className={cn(
|
|
506
|
+
'px-2 py-1.5 text-sm font-semibold data-[inset=true]:pl-8',
|
|
507
|
+
className
|
|
508
|
+
)}
|
|
509
|
+
{...props}
|
|
510
|
+
/>
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function DropdownMenuSeparator({
|
|
515
|
+
className,
|
|
516
|
+
...props
|
|
517
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
518
|
+
return (
|
|
519
|
+
<DropdownMenuPrimitive.Separator
|
|
520
|
+
data-slot='dropdown-menu-separator'
|
|
521
|
+
className={cn('bg-border -mx-1 my-1 h-px', className)}
|
|
522
|
+
{...props}
|
|
523
|
+
/>
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function DropdownMenuShortcut({
|
|
528
|
+
className,
|
|
529
|
+
...props
|
|
530
|
+
}: React.ComponentProps<'span'>) {
|
|
531
|
+
return (
|
|
532
|
+
<span
|
|
533
|
+
data-slot='dropdown-menu-shortcut'
|
|
534
|
+
className={cn(
|
|
535
|
+
'text-muted-foreground ml-auto text-xs tracking-widest opacity-60',
|
|
536
|
+
className
|
|
537
|
+
)}
|
|
538
|
+
{...props}
|
|
539
|
+
/>
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function DropdownMenuSub({
|
|
544
|
+
...props
|
|
545
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
546
|
+
return <DropdownMenuPrimitive.Sub data-slot='dropdown-menu-sub' {...props} />;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function DropdownMenuSubTrigger({
|
|
550
|
+
className,
|
|
551
|
+
inset,
|
|
552
|
+
children,
|
|
553
|
+
...props
|
|
554
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
555
|
+
inset?: boolean;
|
|
556
|
+
}) {
|
|
557
|
+
return (
|
|
558
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
559
|
+
data-slot='dropdown-menu-sub-trigger'
|
|
560
|
+
data-inset={inset}
|
|
561
|
+
className={cn(
|
|
562
|
+
'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset=true]:pl-8',
|
|
563
|
+
className
|
|
564
|
+
)}
|
|
565
|
+
{...props}
|
|
566
|
+
>
|
|
567
|
+
{children}
|
|
568
|
+
<ChevronRightIcon className='ml-auto size-4' />
|
|
569
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function DropdownMenuSubContent({
|
|
574
|
+
className,
|
|
575
|
+
...props
|
|
576
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
577
|
+
return (
|
|
578
|
+
<DropdownMenuPrimitive.SubContent
|
|
579
|
+
data-slot='dropdown-menu-sub-content'
|
|
580
|
+
className={cn(
|
|
581
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]: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 z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-lg',
|
|
582
|
+
className
|
|
583
|
+
)}
|
|
584
|
+
{...props}
|
|
585
|
+
/>
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function DropdownMenuGroup({
|
|
590
|
+
...props
|
|
591
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
|
592
|
+
return (
|
|
593
|
+
<DropdownMenuPrimitive.Group data-slot='dropdown-menu-group' {...props} />
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export {
|
|
598
|
+
DropdownMenu,
|
|
599
|
+
DropdownMenuPortal,
|
|
600
|
+
DropdownMenuTrigger,
|
|
601
|
+
DropdownMenuContent,
|
|
602
|
+
DropdownMenuGroup,
|
|
603
|
+
DropdownMenuItem,
|
|
604
|
+
DropdownMenuCheckboxItem,
|
|
605
|
+
DropdownMenuRadioGroup,
|
|
606
|
+
DropdownMenuRadioItem,
|
|
607
|
+
DropdownMenuLabel,
|
|
608
|
+
DropdownMenuSeparator,
|
|
609
|
+
DropdownMenuShortcut,
|
|
610
|
+
DropdownMenuSub,
|
|
611
|
+
DropdownMenuSubTrigger,
|
|
612
|
+
DropdownMenuSubContent,
|
|
613
|
+
};`,
|
|
614
|
+
|
|
615
|
+
};
|