@tanstack/cta-ui-base 0.15.4
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/components.json +21 -0
- package/dist/app.d.ts +1 -0
- package/dist/app.js +10 -0
- package/dist/components/add-on-info-dialog.d.ts +5 -0
- package/dist/components/add-on-info-dialog.js +5 -0
- package/dist/components/background-animation.d.ts +1 -0
- package/dist/components/background-animation.js +144 -0
- package/dist/components/cta-provider.d.ts +3 -0
- package/dist/components/cta-provider.js +11 -0
- package/dist/components/cta-sidebar.d.ts +1 -0
- package/dist/components/cta-sidebar.js +15 -0
- package/dist/components/custom-add-on-dialog.d.ts +1 -0
- package/dist/components/custom-add-on-dialog.js +38 -0
- package/dist/components/file-navigator.d.ts +2 -0
- package/dist/components/file-navigator.js +86 -0
- package/dist/components/file-tree.d.ts +5 -0
- package/dist/components/file-tree.js +14 -0
- package/dist/components/file-viewer.d.ts +5 -0
- package/dist/components/file-viewer.js +40 -0
- package/dist/components/header.d.ts +1 -0
- package/dist/components/header.js +5 -0
- package/dist/components/icons/tailwind.d.ts +3 -0
- package/dist/components/icons/tailwind.js +5 -0
- package/dist/components/icons/tanstack.d.ts +3 -0
- package/dist/components/icons/tanstack.js +5 -0
- package/dist/components/icons/typescript.d.ts +3 -0
- package/dist/components/icons/typescript.js +5 -0
- package/dist/components/query-provider.d.ts +3 -0
- package/dist/components/query-provider.js +7 -0
- package/dist/components/sidebar-items/add-ons.d.ts +1 -0
- package/dist/components/sidebar-items/add-ons.js +27 -0
- package/dist/components/sidebar-items/mode-selector.d.ts +1 -0
- package/dist/components/sidebar-items/mode-selector.js +19 -0
- package/dist/components/sidebar-items/project-name.d.ts +1 -0
- package/dist/components/sidebar-items/project-name.js +12 -0
- package/dist/components/sidebar-items/run-add-ons.d.ts +1 -0
- package/dist/components/sidebar-items/run-add-ons.js +25 -0
- package/dist/components/sidebar-items/run-create-app.d.ts +1 -0
- package/dist/components/sidebar-items/run-create-app.js +28 -0
- package/dist/components/sidebar-items/sidebar-container.d.ts +3 -0
- package/dist/components/sidebar-items/sidebar-container.js +4 -0
- package/dist/components/sidebar-items/sidebar-group.d.ts +3 -0
- package/dist/components/sidebar-items/sidebar-group.js +4 -0
- package/dist/components/sidebar-items/starter.d.ts +1 -0
- package/dist/components/sidebar-items/starter.js +42 -0
- package/dist/components/sidebar-items/typescript-switch.d.ts +1 -0
- package/dist/components/sidebar-items/typescript-switch.js +18 -0
- package/dist/components/starters-carousel.d.ts +3 -0
- package/dist/components/starters-carousel.js +12 -0
- package/dist/components/startup-dialog.d.ts +1 -0
- package/dist/components/startup-dialog.js +30 -0
- package/dist/components/status-list.d.ts +5 -0
- package/dist/components/status-list.js +4 -0
- package/dist/components/toaster.d.ts +4 -0
- package/dist/components/toaster.js +15 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +32 -0
- package/dist/components/ui/carousel.d.ts +20 -0
- package/dist/components/ui/carousel.js +90 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/dialog.js +36 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/dropdown-menu.js +51 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +8 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.js +17 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +9 -0
- package/dist/components/ui/sheet.d.ts +13 -0
- package/dist/components/ui/sheet.js +40 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/sonner.js +12 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +28 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +17 -0
- package/dist/components/ui/toggle-group.d.ts +7 -0
- package/dist/components/ui/toggle-group.js +20 -0
- package/dist/components/ui/toggle.d.ts +9 -0
- package/dist/components/ui/toggle.js +27 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +18 -0
- package/dist/components/ui/tree-view.d.ts +25 -0
- package/dist/components/ui/tree-view.js +151 -0
- package/dist/file-classes.d.ts +8 -0
- package/dist/file-classes.js +41 -0
- package/dist/hooks/use-mounted.d.ts +1 -0
- package/dist/hooks/use-mounted.js +8 -0
- package/dist/hooks/use-preferred-reduced-motion.d.ts +5 -0
- package/dist/hooks/use-preferred-reduced-motion.js +20 -0
- package/dist/hooks/use-streaming-status.d.ts +6 -0
- package/dist/hooks/use-streaming-status.js +55 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/lib/api.d.ts +14 -0
- package/dist/lib/api.js +74 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/store/add-ons.d.ts +7 -0
- package/dist/store/add-ons.js +59 -0
- package/dist/store/project.d.ts +76 -0
- package/dist/store/project.js +269 -0
- package/package.json +50 -0
- package/src/app.tsx +28 -0
- package/src/components/add-on-info-dialog.tsx +39 -0
- package/src/components/background-animation.tsx +224 -0
- package/src/components/cta-provider.tsx +22 -0
- package/src/components/cta-sidebar.tsx +43 -0
- package/src/components/custom-add-on-dialog.tsx +79 -0
- package/src/components/file-navigator.tsx +207 -0
- package/src/components/file-tree.tsx +35 -0
- package/src/components/file-viewer.tsx +67 -0
- package/src/components/header.tsx +29 -0
- package/src/components/icons/tailwind.tsx +26 -0
- package/src/components/icons/tanstack.tsx +338 -0
- package/src/components/icons/typescript.tsx +23 -0
- package/src/components/query-provider.tsx +10 -0
- package/src/components/sidebar-items/add-ons.tsx +94 -0
- package/src/components/sidebar-items/mode-selector.tsx +56 -0
- package/src/components/sidebar-items/project-name.tsx +32 -0
- package/src/components/sidebar-items/run-add-ons.tsx +71 -0
- package/src/components/sidebar-items/run-create-app.tsx +82 -0
- package/src/components/sidebar-items/sidebar-container.tsx +11 -0
- package/src/components/sidebar-items/sidebar-group.tsx +11 -0
- package/src/components/sidebar-items/starter.tsx +123 -0
- package/src/components/sidebar-items/typescript-switch.tsx +58 -0
- package/src/components/starters-carousel.tsx +41 -0
- package/src/components/startup-dialog.tsx +72 -0
- package/src/components/status-list.tsx +22 -0
- package/src/components/toaster.tsx +29 -0
- package/src/components/ui/button.tsx +61 -0
- package/src/components/ui/carousel.tsx +239 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/dialog.tsx +138 -0
- package/src/components/ui/dropdown-menu.tsx +255 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +22 -0
- package/src/components/ui/popover.tsx +46 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/sheet.tsx +137 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +24 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +114 -0
- package/src/components/ui/tabs.tsx +64 -0
- package/src/components/ui/toggle-group.tsx +72 -0
- package/src/components/ui/toggle.tsx +49 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/components/ui/tree-view.tsx +497 -0
- package/src/file-classes.ts +54 -0
- package/src/hooks/use-mounted.ts +9 -0
- package/src/hooks/use-preferred-reduced-motion.ts +27 -0
- package/src/hooks/use-streaming-status.ts +70 -0
- package/src/index.ts +44 -0
- package/src/lib/api.ts +100 -0
- package/src/lib/utils.ts +8 -0
- package/src/store/add-ons.ts +81 -0
- package/src/store/project.ts +345 -0
- package/src/types.d.ts +109 -0
- package/tests/store/add-ons.test.ts +222 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +6 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover'
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils'
|
|
5
|
+
|
|
6
|
+
function Popover({
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
9
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function PopoverTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
15
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function PopoverContent({
|
|
19
|
+
className,
|
|
20
|
+
align = 'center',
|
|
21
|
+
sideOffset = 4,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
24
|
+
return (
|
|
25
|
+
<PopoverPrimitive.Portal>
|
|
26
|
+
<PopoverPrimitive.Content
|
|
27
|
+
data-slot="popover-content"
|
|
28
|
+
align={align}
|
|
29
|
+
sideOffset={sideOffset}
|
|
30
|
+
className={cn(
|
|
31
|
+
'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 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
</PopoverPrimitive.Portal>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function PopoverAnchor({
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
43
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator'
|
|
5
|
+
|
|
6
|
+
import { cn } from '../../lib/utils'
|
|
7
|
+
|
|
8
|
+
function Separator({
|
|
9
|
+
className,
|
|
10
|
+
orientation = 'horizontal',
|
|
11
|
+
decorative = true,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
14
|
+
return (
|
|
15
|
+
<SeparatorPrimitive.Root
|
|
16
|
+
data-slot="separator-root"
|
|
17
|
+
decorative={decorative}
|
|
18
|
+
orientation={orientation}
|
|
19
|
+
className={cn(
|
|
20
|
+
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Separator }
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog'
|
|
3
|
+
import { XIcon } from 'lucide-react'
|
|
4
|
+
|
|
5
|
+
import { cn } from '../../lib/utils'
|
|
6
|
+
|
|
7
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
8
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function SheetTrigger({
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
14
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function SheetClose({
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
20
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function SheetPortal({
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
26
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function SheetOverlay({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
33
|
+
return (
|
|
34
|
+
<SheetPrimitive.Overlay
|
|
35
|
+
data-slot="sheet-overlay"
|
|
36
|
+
className={cn(
|
|
37
|
+
'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/50',
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function SheetContent({
|
|
46
|
+
className,
|
|
47
|
+
children,
|
|
48
|
+
side = 'right',
|
|
49
|
+
...props
|
|
50
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
51
|
+
side?: 'top' | 'right' | 'bottom' | 'left'
|
|
52
|
+
}) {
|
|
53
|
+
return (
|
|
54
|
+
<SheetPortal>
|
|
55
|
+
<SheetOverlay />
|
|
56
|
+
<SheetPrimitive.Content
|
|
57
|
+
data-slot="sheet-content"
|
|
58
|
+
className={cn(
|
|
59
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
|
60
|
+
side === 'right' &&
|
|
61
|
+
'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',
|
|
62
|
+
side === 'left' &&
|
|
63
|
+
'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',
|
|
64
|
+
side === 'top' &&
|
|
65
|
+
'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
|
|
66
|
+
side === 'bottom' &&
|
|
67
|
+
'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
|
|
68
|
+
className,
|
|
69
|
+
)}
|
|
70
|
+
{...props}
|
|
71
|
+
>
|
|
72
|
+
{children}
|
|
73
|
+
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
|
|
74
|
+
<XIcon className="size-4" />
|
|
75
|
+
<span className="sr-only">Close</span>
|
|
76
|
+
</SheetPrimitive.Close>
|
|
77
|
+
</SheetPrimitive.Content>
|
|
78
|
+
</SheetPortal>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot="sheet-header"
|
|
86
|
+
className={cn('flex flex-col gap-1.5 p-4', className)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
93
|
+
return (
|
|
94
|
+
<div
|
|
95
|
+
data-slot="sheet-footer"
|
|
96
|
+
className={cn('mt-auto flex flex-col gap-2 p-4', className)}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function SheetTitle({
|
|
103
|
+
className,
|
|
104
|
+
...props
|
|
105
|
+
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
106
|
+
return (
|
|
107
|
+
<SheetPrimitive.Title
|
|
108
|
+
data-slot="sheet-title"
|
|
109
|
+
className={cn('text-foreground font-semibold', className)}
|
|
110
|
+
{...props}
|
|
111
|
+
/>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function SheetDescription({
|
|
116
|
+
className,
|
|
117
|
+
...props
|
|
118
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
119
|
+
return (
|
|
120
|
+
<SheetPrimitive.Description
|
|
121
|
+
data-slot="sheet-description"
|
|
122
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
Sheet,
|
|
130
|
+
SheetTrigger,
|
|
131
|
+
SheetClose,
|
|
132
|
+
SheetContent,
|
|
133
|
+
SheetHeader,
|
|
134
|
+
SheetFooter,
|
|
135
|
+
SheetTitle,
|
|
136
|
+
SheetDescription,
|
|
137
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from '../../lib/utils'
|
|
2
|
+
|
|
3
|
+
function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
data-slot="skeleton"
|
|
7
|
+
className={cn('bg-accent animate-pulse rounded-md', className)}
|
|
8
|
+
{...props}
|
|
9
|
+
/>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Skeleton }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useTheme } from 'next-themes'
|
|
2
|
+
import { Toaster as Sonner } from 'sonner'
|
|
3
|
+
import type { ToasterProps } from 'sonner'
|
|
4
|
+
|
|
5
|
+
const Toaster = ({ ...props }: ToasterProps) => {
|
|
6
|
+
const { theme = 'system' } = useTheme()
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<Sonner
|
|
10
|
+
theme={theme as ToasterProps['theme']}
|
|
11
|
+
className="toaster group"
|
|
12
|
+
style={
|
|
13
|
+
{
|
|
14
|
+
'--normal-bg': 'var(--popover)',
|
|
15
|
+
'--normal-text': 'var(--popover-foreground)',
|
|
16
|
+
'--normal-border': 'var(--border)',
|
|
17
|
+
} as React.CSSProperties
|
|
18
|
+
}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Toaster }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch'
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils'
|
|
5
|
+
|
|
6
|
+
function Switch({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof SwitchPrimitive.Root>) {
|
|
10
|
+
return (
|
|
11
|
+
<SwitchPrimitive.Root
|
|
12
|
+
data-slot="switch"
|
|
13
|
+
className={cn(
|
|
14
|
+
'peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 border-1 border-gray-500/30',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
<SwitchPrimitive.Thumb
|
|
20
|
+
data-slot="switch-thumb"
|
|
21
|
+
className={cn(
|
|
22
|
+
'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0',
|
|
23
|
+
)}
|
|
24
|
+
/>
|
|
25
|
+
</SwitchPrimitive.Root>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { Switch }
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
function Table({ className, ...props }: React.ComponentProps<'table'>) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="table-container"
|
|
9
|
+
className="relative w-full overflow-x-auto"
|
|
10
|
+
>
|
|
11
|
+
<table
|
|
12
|
+
data-slot="table"
|
|
13
|
+
className={cn('w-full caption-bottom text-sm', className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
|
|
21
|
+
return (
|
|
22
|
+
<thead
|
|
23
|
+
data-slot="table-header"
|
|
24
|
+
className={cn('[&_tr]:border-b', className)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
|
|
31
|
+
return (
|
|
32
|
+
<tbody
|
|
33
|
+
data-slot="table-body"
|
|
34
|
+
className={cn('[&_tr:last-child]:border-0', className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
|
|
41
|
+
return (
|
|
42
|
+
<tfoot
|
|
43
|
+
data-slot="table-footer"
|
|
44
|
+
className={cn(
|
|
45
|
+
'bg-muted/50 border-t font-medium [&>tr]:last:border-b-0',
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
|
|
54
|
+
return (
|
|
55
|
+
<tr
|
|
56
|
+
data-slot="table-row"
|
|
57
|
+
className={cn(
|
|
58
|
+
'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
|
|
59
|
+
className,
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
|
|
67
|
+
return (
|
|
68
|
+
<th
|
|
69
|
+
data-slot="table-head"
|
|
70
|
+
className={cn(
|
|
71
|
+
'text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
|
72
|
+
className,
|
|
73
|
+
)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
|
|
80
|
+
return (
|
|
81
|
+
<td
|
|
82
|
+
data-slot="table-cell"
|
|
83
|
+
className={cn(
|
|
84
|
+
'p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
|
85
|
+
className,
|
|
86
|
+
)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function TableCaption({
|
|
93
|
+
className,
|
|
94
|
+
...props
|
|
95
|
+
}: React.ComponentProps<'caption'>) {
|
|
96
|
+
return (
|
|
97
|
+
<caption
|
|
98
|
+
data-slot="table-caption"
|
|
99
|
+
className={cn('text-muted-foreground mt-4 text-sm', className)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
Table,
|
|
107
|
+
TableHeader,
|
|
108
|
+
TableBody,
|
|
109
|
+
TableFooter,
|
|
110
|
+
TableHead,
|
|
111
|
+
TableRow,
|
|
112
|
+
TableCell,
|
|
113
|
+
TableCaption,
|
|
114
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs'
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils'
|
|
5
|
+
|
|
6
|
+
function Tabs({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof TabsPrimitive.Root>) {
|
|
10
|
+
return (
|
|
11
|
+
<TabsPrimitive.Root
|
|
12
|
+
data-slot="tabs"
|
|
13
|
+
className={cn('flex flex-col gap-2', className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function TabsList({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof TabsPrimitive.List>) {
|
|
23
|
+
return (
|
|
24
|
+
<TabsPrimitive.List
|
|
25
|
+
data-slot="tabs-list"
|
|
26
|
+
className={cn(
|
|
27
|
+
'bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]',
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function TabsTrigger({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
|
|
39
|
+
return (
|
|
40
|
+
<TabsPrimitive.Trigger
|
|
41
|
+
data-slot="tabs-trigger"
|
|
42
|
+
className={cn(
|
|
43
|
+
"data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
44
|
+
className,
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function TabsContent({
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
|
55
|
+
return (
|
|
56
|
+
<TabsPrimitive.Content
|
|
57
|
+
data-slot="tabs-content"
|
|
58
|
+
className={cn('flex-1 outline-none', className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent }
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils'
|
|
5
|
+
import { toggleVariants } from './toggle'
|
|
6
|
+
|
|
7
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
8
|
+
|
|
9
|
+
const ToggleGroupContext = React.createContext<
|
|
10
|
+
VariantProps<typeof toggleVariants>
|
|
11
|
+
>({
|
|
12
|
+
size: 'default',
|
|
13
|
+
variant: 'default',
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
function ToggleGroup({
|
|
17
|
+
className,
|
|
18
|
+
variant,
|
|
19
|
+
size,
|
|
20
|
+
children,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
|
23
|
+
VariantProps<typeof toggleVariants>) {
|
|
24
|
+
return (
|
|
25
|
+
<ToggleGroupPrimitive.Root
|
|
26
|
+
data-slot="toggle-group"
|
|
27
|
+
data-variant={variant}
|
|
28
|
+
data-size={size}
|
|
29
|
+
className={cn(
|
|
30
|
+
'group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
>
|
|
35
|
+
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
36
|
+
{children}
|
|
37
|
+
</ToggleGroupContext.Provider>
|
|
38
|
+
</ToggleGroupPrimitive.Root>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function ToggleGroupItem({
|
|
43
|
+
className,
|
|
44
|
+
children,
|
|
45
|
+
variant,
|
|
46
|
+
size,
|
|
47
|
+
...props
|
|
48
|
+
}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
|
|
49
|
+
VariantProps<typeof toggleVariants>) {
|
|
50
|
+
const context = React.useContext(ToggleGroupContext)
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<ToggleGroupPrimitive.Item
|
|
54
|
+
data-slot="toggle-group-item"
|
|
55
|
+
data-variant={context.variant || variant}
|
|
56
|
+
data-size={context.size || size}
|
|
57
|
+
className={cn(
|
|
58
|
+
toggleVariants({
|
|
59
|
+
variant: context.variant || variant,
|
|
60
|
+
size: context.size || size,
|
|
61
|
+
}),
|
|
62
|
+
'min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l',
|
|
63
|
+
className,
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
{children}
|
|
68
|
+
</ToggleGroupPrimitive.Item>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { ToggleGroup, ToggleGroupItem }
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as TogglePrimitive from '@radix-ui/react-toggle'
|
|
5
|
+
import { cva } from 'class-variance-authority'
|
|
6
|
+
|
|
7
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
8
|
+
|
|
9
|
+
import { cn } from '../../lib/utils'
|
|
10
|
+
|
|
11
|
+
const toggleVariants = cva(
|
|
12
|
+
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
default: 'bg-transparent',
|
|
17
|
+
outline:
|
|
18
|
+
'border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground',
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: 'h-9 px-2 min-w-9',
|
|
22
|
+
sm: 'h-8 px-1.5 min-w-8',
|
|
23
|
+
lg: 'h-10 px-2.5 min-w-10',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: 'default',
|
|
28
|
+
size: 'default',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
function Toggle({
|
|
34
|
+
className,
|
|
35
|
+
variant,
|
|
36
|
+
size,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof TogglePrimitive.Root> &
|
|
39
|
+
VariantProps<typeof toggleVariants>) {
|
|
40
|
+
return (
|
|
41
|
+
<TogglePrimitive.Root
|
|
42
|
+
data-slot="toggle"
|
|
43
|
+
className={cn(toggleVariants({ variant, size, className }))}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { Toggle, toggleVariants }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip'
|
|
5
|
+
|
|
6
|
+
import { cn } from '../../lib/utils'
|
|
7
|
+
|
|
8
|
+
function TooltipProvider({
|
|
9
|
+
delayDuration = 0,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
12
|
+
return (
|
|
13
|
+
<TooltipPrimitive.Provider
|
|
14
|
+
data-slot="tooltip-provider"
|
|
15
|
+
delayDuration={delayDuration}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Tooltip({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
24
|
+
return (
|
|
25
|
+
<TooltipProvider>
|
|
26
|
+
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
27
|
+
</TooltipProvider>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function TooltipTrigger({
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
34
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function TooltipContent({
|
|
38
|
+
className,
|
|
39
|
+
sideOffset = 0,
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
43
|
+
return (
|
|
44
|
+
<TooltipPrimitive.Portal>
|
|
45
|
+
<TooltipPrimitive.Content
|
|
46
|
+
data-slot="tooltip-content"
|
|
47
|
+
sideOffset={sideOffset}
|
|
48
|
+
className={cn(
|
|
49
|
+
'bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
<TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
|
56
|
+
</TooltipPrimitive.Content>
|
|
57
|
+
</TooltipPrimitive.Portal>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|