meyi-vault-client-dev 1.0.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/README.md +157 -0
- package/package.json +69 -0
- package/src/VaultApp.tsx +82 -0
- package/src/components/datetime-picker.tsx +262 -0
- package/src/components/dialogs.tsx +467 -0
- package/src/components/searchable-multi-select.tsx +275 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/calendar.tsx +210 -0
- package/src/components/ui/command.tsx +181 -0
- package/src/components/ui/dialog.tsx +140 -0
- package/src/components/ui/input.tsx +27 -0
- package/src/components/ui/label.tsx +21 -0
- package/src/components/ui/popover.tsx +45 -0
- package/src/components/ui/scroll-area.tsx +64 -0
- package/src/components/ui/separator.tsx +25 -0
- package/src/components/ui/table.tsx +122 -0
- package/src/components/vault/entries-table.tsx +283 -0
- package/src/components/vault/password-cell.tsx +26 -0
- package/src/context/VaultProvider.tsx +49 -0
- package/src/hooks/useVault.ts +177 -0
- package/src/index.tsx +99 -0
- package/src/lib/utils.ts +6 -0
- package/src/pages/AuditPage.tsx +408 -0
- package/src/pages/EntriesPage.tsx +111 -0
- package/src/pages/VaultPage.tsx +184 -0
- package/src/pages/meyi-connect-password.code-workspace +11 -0
- package/src/services/api.ts +139 -0
- package/src/style.css +5 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Command as CommandPrimitive } from 'cmdk'
|
|
3
|
+
import { SearchIcon } from 'lucide-react'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogContent,
|
|
8
|
+
DialogDescription,
|
|
9
|
+
DialogHeader,
|
|
10
|
+
DialogTitle,
|
|
11
|
+
} from '@/components/ui/dialog'
|
|
12
|
+
|
|
13
|
+
function Command({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
17
|
+
return (
|
|
18
|
+
<CommandPrimitive
|
|
19
|
+
data-slot='command'
|
|
20
|
+
className={cn(
|
|
21
|
+
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function CommandDialog({
|
|
30
|
+
title = 'Command Palette',
|
|
31
|
+
description = 'Search for a command to run...',
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
showCloseButton = true,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
37
|
+
title?: string
|
|
38
|
+
description?: string
|
|
39
|
+
className?: string
|
|
40
|
+
showCloseButton?: boolean
|
|
41
|
+
}) {
|
|
42
|
+
return (
|
|
43
|
+
<Dialog {...props}>
|
|
44
|
+
<DialogHeader className='sr-only'>
|
|
45
|
+
<DialogTitle>{title}</DialogTitle>
|
|
46
|
+
<DialogDescription>{description}</DialogDescription>
|
|
47
|
+
</DialogHeader>
|
|
48
|
+
<DialogContent
|
|
49
|
+
className={cn('overflow-hidden p-0', className)}
|
|
50
|
+
showCloseButton={showCloseButton}
|
|
51
|
+
>
|
|
52
|
+
<Command className='[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5'>
|
|
53
|
+
{children}
|
|
54
|
+
</Command>
|
|
55
|
+
</DialogContent>
|
|
56
|
+
</Dialog>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function CommandInput({
|
|
61
|
+
className,
|
|
62
|
+
...props
|
|
63
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
data-slot='command-input-wrapper'
|
|
67
|
+
className='flex h-9 items-center gap-2 border-b px-3'
|
|
68
|
+
>
|
|
69
|
+
<SearchIcon className='size-4 shrink-0 opacity-50' />
|
|
70
|
+
<CommandPrimitive.Input
|
|
71
|
+
data-slot='command-input'
|
|
72
|
+
className={cn(
|
|
73
|
+
'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function CommandList({
|
|
83
|
+
className,
|
|
84
|
+
...props
|
|
85
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
86
|
+
return (
|
|
87
|
+
<CommandPrimitive.List
|
|
88
|
+
data-slot='command-list'
|
|
89
|
+
className={cn(
|
|
90
|
+
'max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto',
|
|
91
|
+
className
|
|
92
|
+
)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function CommandEmpty({
|
|
99
|
+
...props
|
|
100
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
101
|
+
return (
|
|
102
|
+
<CommandPrimitive.Empty
|
|
103
|
+
data-slot='command-empty'
|
|
104
|
+
className='py-6 text-center text-sm'
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function CommandGroup({
|
|
111
|
+
className,
|
|
112
|
+
...props
|
|
113
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
114
|
+
return (
|
|
115
|
+
<CommandPrimitive.Group
|
|
116
|
+
data-slot='command-group'
|
|
117
|
+
className={cn(
|
|
118
|
+
'text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',
|
|
119
|
+
className
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function CommandSeparator({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
130
|
+
return (
|
|
131
|
+
<CommandPrimitive.Separator
|
|
132
|
+
data-slot='command-separator'
|
|
133
|
+
className={cn('bg-border -mx-1 h-px', className)}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function CommandItem({
|
|
140
|
+
className,
|
|
141
|
+
...props
|
|
142
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
143
|
+
return (
|
|
144
|
+
<CommandPrimitive.Item
|
|
145
|
+
data-slot='command-item'
|
|
146
|
+
className={cn(
|
|
147
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_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=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
148
|
+
className
|
|
149
|
+
)}
|
|
150
|
+
{...props}
|
|
151
|
+
/>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function CommandShortcut({
|
|
156
|
+
className,
|
|
157
|
+
...props
|
|
158
|
+
}: React.ComponentProps<'span'>) {
|
|
159
|
+
return (
|
|
160
|
+
<span
|
|
161
|
+
data-slot='command-shortcut'
|
|
162
|
+
className={cn(
|
|
163
|
+
'text-muted-foreground ms-auto text-xs tracking-widest',
|
|
164
|
+
className
|
|
165
|
+
)}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
Command,
|
|
173
|
+
CommandDialog,
|
|
174
|
+
CommandInput,
|
|
175
|
+
CommandList,
|
|
176
|
+
CommandEmpty,
|
|
177
|
+
CommandGroup,
|
|
178
|
+
CommandItem,
|
|
179
|
+
CommandShortcut,
|
|
180
|
+
CommandSeparator,
|
|
181
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
|
3
|
+
import { XIcon } from 'lucide-react'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
function Dialog({
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
9
|
+
return <DialogPrimitive.Root data-slot='dialog' {...props} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function DialogTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
15
|
+
return <DialogPrimitive.Trigger data-slot='dialog-trigger' {...props} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function DialogPortal({
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
21
|
+
return <DialogPrimitive.Portal data-slot='dialog-portal' {...props} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function DialogClose({
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
27
|
+
return <DialogPrimitive.Close data-slot='dialog-close' {...props} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function DialogOverlay({
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
34
|
+
return (
|
|
35
|
+
<DialogPrimitive.Overlay
|
|
36
|
+
data-slot='dialog-overlay'
|
|
37
|
+
className={cn(
|
|
38
|
+
'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',
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function DialogContent({
|
|
47
|
+
className,
|
|
48
|
+
children,
|
|
49
|
+
showCloseButton = true,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
52
|
+
showCloseButton?: boolean
|
|
53
|
+
}) {
|
|
54
|
+
return (
|
|
55
|
+
<DialogPortal data-slot='dialog-portal'>
|
|
56
|
+
<DialogOverlay />
|
|
57
|
+
<DialogPrimitive.Content
|
|
58
|
+
data-slot='dialog-content'
|
|
59
|
+
className={cn(
|
|
60
|
+
'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',
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
{showCloseButton && (
|
|
67
|
+
<DialogPrimitive.Close
|
|
68
|
+
data-slot='dialog-close'
|
|
69
|
+
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
70
|
+
>
|
|
71
|
+
<XIcon />
|
|
72
|
+
<span className='sr-only'>Close</span>
|
|
73
|
+
</DialogPrimitive.Close>
|
|
74
|
+
)}
|
|
75
|
+
</DialogPrimitive.Content>
|
|
76
|
+
</DialogPortal>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
81
|
+
return (
|
|
82
|
+
<div
|
|
83
|
+
data-slot='dialog-header'
|
|
84
|
+
className={cn('flex flex-col gap-2 text-center sm:text-start', className)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
data-slot='dialog-footer'
|
|
94
|
+
className={cn(
|
|
95
|
+
'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
|
|
96
|
+
className
|
|
97
|
+
)}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function DialogTitle({
|
|
104
|
+
className,
|
|
105
|
+
...props
|
|
106
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
107
|
+
return (
|
|
108
|
+
<DialogPrimitive.Title
|
|
109
|
+
data-slot='dialog-title'
|
|
110
|
+
className={cn('text-lg leading-none font-semibold', className)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function DialogDescription({
|
|
117
|
+
className,
|
|
118
|
+
...props
|
|
119
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
120
|
+
return (
|
|
121
|
+
<DialogPrimitive.Description
|
|
122
|
+
data-slot='dialog-description'
|
|
123
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
Dialog,
|
|
131
|
+
DialogClose,
|
|
132
|
+
DialogContent,
|
|
133
|
+
DialogDescription,
|
|
134
|
+
DialogFooter,
|
|
135
|
+
DialogHeader,
|
|
136
|
+
DialogOverlay,
|
|
137
|
+
DialogPortal,
|
|
138
|
+
DialogTitle,
|
|
139
|
+
DialogTrigger,
|
|
140
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
function cn(...classes: (string | undefined | false)[]) {
|
|
4
|
+
return classes.filter(Boolean).join(' ')
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface InputProps
|
|
8
|
+
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
9
|
+
|
|
10
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
11
|
+
({ className, type, ...props }, ref) => {
|
|
12
|
+
return (
|
|
13
|
+
<input
|
|
14
|
+
type={type}
|
|
15
|
+
className={cn(
|
|
16
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
ref={ref}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
Input.displayName = "Input"
|
|
26
|
+
|
|
27
|
+
export { Input }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as LabelPrimitive from '@radix-ui/react-label'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
function Label({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
9
|
+
return (
|
|
10
|
+
<LabelPrimitive.Root
|
|
11
|
+
data-slot='label'
|
|
12
|
+
className={cn(
|
|
13
|
+
'flex items-center gap-2 text-sm mb-2 leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Label }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
function Popover({
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
8
|
+
return <PopoverPrimitive.Root data-slot='popover' {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function PopoverTrigger({
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
14
|
+
return <PopoverPrimitive.Trigger data-slot='popover-trigger' {...props} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function PopoverContent({
|
|
18
|
+
className,
|
|
19
|
+
align = 'center',
|
|
20
|
+
sideOffset = 4,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
23
|
+
return (
|
|
24
|
+
<PopoverPrimitive.Portal>
|
|
25
|
+
<PopoverPrimitive.Content
|
|
26
|
+
data-slot='popover-content'
|
|
27
|
+
align={align}
|
|
28
|
+
sideOffset={sideOffset}
|
|
29
|
+
className={cn(
|
|
30
|
+
'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',
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
</PopoverPrimitive.Portal>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function PopoverAnchor({
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
42
|
+
return <PopoverPrimitive.Anchor data-slot='popover-anchor' {...props} />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
interface ScrollAreaProps
|
|
6
|
+
extends React.ComponentProps<typeof ScrollAreaPrimitive.Root> {
|
|
7
|
+
orientation?: 'vertical' | 'horizontal'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function ScrollArea({
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
orientation = 'vertical',
|
|
14
|
+
...props
|
|
15
|
+
}: ScrollAreaProps) {
|
|
16
|
+
return (
|
|
17
|
+
<ScrollAreaPrimitive.Root
|
|
18
|
+
data-slot='scroll-area'
|
|
19
|
+
className={cn('relative', className)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<ScrollAreaPrimitive.Viewport
|
|
23
|
+
data-slot='scroll-area-viewport'
|
|
24
|
+
className={cn(
|
|
25
|
+
'focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1',
|
|
26
|
+
orientation === 'horizontal' && 'overflow-x-auto!'
|
|
27
|
+
)}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</ScrollAreaPrimitive.Viewport>
|
|
31
|
+
<ScrollBar orientation={orientation} />
|
|
32
|
+
<ScrollAreaPrimitive.Corner />
|
|
33
|
+
</ScrollAreaPrimitive.Root>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ScrollBar({
|
|
38
|
+
className,
|
|
39
|
+
orientation = 'vertical',
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
|
42
|
+
return (
|
|
43
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
44
|
+
data-slot='scroll-area-scrollbar'
|
|
45
|
+
orientation={orientation}
|
|
46
|
+
className={cn(
|
|
47
|
+
'flex touch-none p-px transition-colors select-none',
|
|
48
|
+
orientation === 'vertical' &&
|
|
49
|
+
'h-full w-2.5 border-l border-l-transparent',
|
|
50
|
+
orientation === 'horizontal' &&
|
|
51
|
+
'h-2.5 flex-col border-t border-t-transparent',
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
<ScrollAreaPrimitive.ScrollAreaThumb
|
|
57
|
+
data-slot='scroll-area-thumb'
|
|
58
|
+
className='bg-border relative flex-1 rounded-full'
|
|
59
|
+
/>
|
|
60
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { ScrollArea, ScrollBar }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
function Separator({
|
|
6
|
+
className,
|
|
7
|
+
orientation = 'horizontal',
|
|
8
|
+
decorative = true,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
11
|
+
return (
|
|
12
|
+
<SeparatorPrimitive.Root
|
|
13
|
+
data-slot='separator'
|
|
14
|
+
decorative={decorative}
|
|
15
|
+
orientation={orientation}
|
|
16
|
+
className={cn(
|
|
17
|
+
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Separator }
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
function cn(...classes: (string | undefined | false)[]) {
|
|
4
|
+
return classes.filter(Boolean).join(' ')
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const Table = React.forwardRef<
|
|
8
|
+
HTMLTableElement,
|
|
9
|
+
React.HTMLAttributes<HTMLTableElement>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<div className="relative w-full overflow-visible">
|
|
12
|
+
<table
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
))
|
|
19
|
+
Table.displayName = "Table"
|
|
20
|
+
|
|
21
|
+
const TableHeader = React.forwardRef<
|
|
22
|
+
HTMLTableSectionElement,
|
|
23
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
24
|
+
>(({ className, ...props }, ref) => (
|
|
25
|
+
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
|
|
26
|
+
))
|
|
27
|
+
TableHeader.displayName = "TableHeader"
|
|
28
|
+
|
|
29
|
+
const TableBody = React.forwardRef<
|
|
30
|
+
HTMLTableSectionElement,
|
|
31
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
32
|
+
>(({ className, ...props }, ref) => (
|
|
33
|
+
<tbody
|
|
34
|
+
ref={ref}
|
|
35
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
))
|
|
39
|
+
TableBody.displayName = "TableBody"
|
|
40
|
+
|
|
41
|
+
const TableFooter = React.forwardRef<
|
|
42
|
+
HTMLTableSectionElement,
|
|
43
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
44
|
+
>(({ className, ...props }, ref) => (
|
|
45
|
+
<tfoot
|
|
46
|
+
ref={ref}
|
|
47
|
+
className={cn(
|
|
48
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
))
|
|
54
|
+
TableFooter.displayName = "TableFooter"
|
|
55
|
+
|
|
56
|
+
const TableRow = React.forwardRef<
|
|
57
|
+
HTMLTableRowElement,
|
|
58
|
+
React.HTMLAttributes<HTMLTableRowElement>
|
|
59
|
+
>(({ className, ...props }, ref) => (
|
|
60
|
+
<tr
|
|
61
|
+
ref={ref}
|
|
62
|
+
className={cn(
|
|
63
|
+
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
64
|
+
className
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
))
|
|
69
|
+
TableRow.displayName = "TableRow"
|
|
70
|
+
|
|
71
|
+
const TableHead = React.forwardRef<
|
|
72
|
+
HTMLTableCellElement,
|
|
73
|
+
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
74
|
+
>(({ className, ...props }, ref) => (
|
|
75
|
+
<th
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn(
|
|
78
|
+
"h-10 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
79
|
+
className
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
))
|
|
84
|
+
TableHead.displayName = "TableHead"
|
|
85
|
+
|
|
86
|
+
const TableCell = React.forwardRef<
|
|
87
|
+
HTMLTableCellElement,
|
|
88
|
+
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
89
|
+
>(({ className, ...props }, ref) => (
|
|
90
|
+
<td
|
|
91
|
+
ref={ref}
|
|
92
|
+
className={cn(
|
|
93
|
+
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
94
|
+
className
|
|
95
|
+
)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
))
|
|
99
|
+
TableCell.displayName = "TableCell"
|
|
100
|
+
|
|
101
|
+
const TableCaption = React.forwardRef<
|
|
102
|
+
HTMLTableCaptionElement,
|
|
103
|
+
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
104
|
+
>(({ className, ...props }, ref) => (
|
|
105
|
+
<caption
|
|
106
|
+
ref={ref}
|
|
107
|
+
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
))
|
|
111
|
+
TableCaption.displayName = "TableCaption"
|
|
112
|
+
|
|
113
|
+
export {
|
|
114
|
+
Table,
|
|
115
|
+
TableHeader,
|
|
116
|
+
TableBody,
|
|
117
|
+
TableFooter,
|
|
118
|
+
TableHead,
|
|
119
|
+
TableRow,
|
|
120
|
+
TableCell,
|
|
121
|
+
TableCaption,
|
|
122
|
+
}
|