@zhin.js/console 1.0.21 → 1.0.22
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/CHANGELOG.md +11 -0
- package/README.md +4 -4
- package/client/components.json +17 -0
- package/client/index.html +1 -1
- package/client/src/components/PluginConfigForm/BasicFieldRenderers.tsx +89 -180
- package/client/src/components/PluginConfigForm/CollectionFieldRenderers.tsx +97 -200
- package/client/src/components/PluginConfigForm/CompositeFieldRenderers.tsx +31 -70
- package/client/src/components/PluginConfigForm/FieldRenderer.tsx +27 -77
- package/client/src/components/PluginConfigForm/NestedFieldRenderer.tsx +33 -53
- package/client/src/components/PluginConfigForm/index.tsx +71 -173
- package/client/src/components/ui/accordion.tsx +54 -0
- package/client/src/components/ui/alert.tsx +62 -0
- package/client/src/components/ui/avatar.tsx +41 -0
- package/client/src/components/ui/badge.tsx +32 -0
- package/client/src/components/ui/button.tsx +50 -0
- package/client/src/components/ui/card.tsx +50 -0
- package/client/src/components/ui/checkbox.tsx +25 -0
- package/client/src/components/ui/dialog.tsx +87 -0
- package/client/src/components/ui/dropdown-menu.tsx +97 -0
- package/client/src/components/ui/input.tsx +21 -0
- package/client/src/components/ui/scroll-area.tsx +43 -0
- package/client/src/components/ui/select.tsx +127 -0
- package/client/src/components/ui/separator.tsx +23 -0
- package/client/src/components/ui/skeleton.tsx +12 -0
- package/client/src/components/ui/switch.tsx +26 -0
- package/client/src/components/ui/tabs.tsx +52 -0
- package/client/src/components/ui/textarea.tsx +20 -0
- package/client/src/components/ui/tooltip.tsx +27 -0
- package/client/src/layouts/dashboard.tsx +91 -221
- package/client/src/main.tsx +38 -42
- package/client/src/pages/dashboard-bots.tsx +91 -137
- package/client/src/pages/dashboard-home.tsx +133 -204
- package/client/src/pages/dashboard-logs.tsx +125 -196
- package/client/src/pages/dashboard-plugin-detail.tsx +261 -329
- package/client/src/pages/dashboard-plugins.tsx +108 -105
- package/client/src/style.css +156 -865
- package/client/src/theme/index.ts +60 -35
- package/client/tailwind.config.js +78 -69
- package/dist/client.js +1 -1
- package/dist/cva.js +47 -0
- package/dist/index.html +1 -1
- package/dist/index.js +6 -6
- package/dist/react-router.js +7121 -5585
- package/dist/react.js +192 -149
- package/dist/style.css +2 -2
- package/lib/bin.js +2 -2
- package/lib/build.js +2 -2
- package/lib/index.d.ts +0 -3
- package/lib/index.js +160 -205
- package/lib/transform.d.ts +26 -0
- package/lib/transform.js +78 -0
- package/lib/websocket.d.ts +0 -1
- package/package.json +8 -7
- package/dist/radix-ui-themes.js +0 -9305
- package/lib/dev.d.ts +0 -18
- package/lib/dev.js +0 -87
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "@zhin.js/client"
|
|
3
|
+
|
|
4
|
+
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
5
|
+
({ className, ...props }, ref) => (
|
|
6
|
+
<div
|
|
7
|
+
ref={ref}
|
|
8
|
+
className={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)}
|
|
9
|
+
{...props}
|
|
10
|
+
/>
|
|
11
|
+
)
|
|
12
|
+
)
|
|
13
|
+
Card.displayName = "Card"
|
|
14
|
+
|
|
15
|
+
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
16
|
+
({ className, ...props }, ref) => (
|
|
17
|
+
<div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
CardHeader.displayName = "CardHeader"
|
|
21
|
+
|
|
22
|
+
const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
23
|
+
({ className, ...props }, ref) => (
|
|
24
|
+
<div ref={ref} className={cn("text-lg font-semibold leading-none tracking-tight", className)} {...props} />
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
CardTitle.displayName = "CardTitle"
|
|
28
|
+
|
|
29
|
+
const CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
30
|
+
({ className, ...props }, ref) => (
|
|
31
|
+
<div ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
CardDescription.displayName = "CardDescription"
|
|
35
|
+
|
|
36
|
+
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
37
|
+
({ className, ...props }, ref) => (
|
|
38
|
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
CardContent.displayName = "CardContent"
|
|
42
|
+
|
|
43
|
+
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
44
|
+
({ className, ...props }, ref) => (
|
|
45
|
+
<div ref={ref} className={cn("flex items-center p-6 pt-0", className)} {...props} />
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
CardFooter.displayName = "CardFooter"
|
|
49
|
+
|
|
50
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Checkbox as CheckboxPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
import { Check } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
const Checkbox = React.forwardRef<
|
|
7
|
+
React.ComponentRef<typeof CheckboxPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<CheckboxPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
|
|
19
|
+
<Check className="h-4 w-4" />
|
|
20
|
+
</CheckboxPrimitive.Indicator>
|
|
21
|
+
</CheckboxPrimitive.Root>
|
|
22
|
+
))
|
|
23
|
+
Checkbox.displayName = "Checkbox"
|
|
24
|
+
|
|
25
|
+
export { Checkbox }
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Dialog as DialogPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
import { X } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
const Dialog = DialogPrimitive.Root
|
|
7
|
+
const DialogTrigger = DialogPrimitive.Trigger
|
|
8
|
+
const DialogPortal = DialogPrimitive.Portal
|
|
9
|
+
const DialogClose = DialogPrimitive.Close
|
|
10
|
+
|
|
11
|
+
const DialogOverlay = React.forwardRef<
|
|
12
|
+
React.ComponentRef<typeof DialogPrimitive.Overlay>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
14
|
+
>(({ className, ...props }, ref) => (
|
|
15
|
+
<DialogPrimitive.Overlay
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn(
|
|
18
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
))
|
|
24
|
+
DialogOverlay.displayName = "DialogOverlay"
|
|
25
|
+
|
|
26
|
+
const DialogContent = React.forwardRef<
|
|
27
|
+
React.ComponentRef<typeof DialogPrimitive.Content>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
29
|
+
>(({ className, children, ...props }, ref) => (
|
|
30
|
+
<DialogPortal>
|
|
31
|
+
<DialogOverlay />
|
|
32
|
+
<DialogPrimitive.Content
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={cn(
|
|
35
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
36
|
+
className
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
42
|
+
<X className="h-4 w-4" />
|
|
43
|
+
<span className="sr-only">Close</span>
|
|
44
|
+
</DialogPrimitive.Close>
|
|
45
|
+
</DialogPrimitive.Content>
|
|
46
|
+
</DialogPortal>
|
|
47
|
+
))
|
|
48
|
+
DialogContent.displayName = "DialogContent"
|
|
49
|
+
|
|
50
|
+
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
51
|
+
<div className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...props} />
|
|
52
|
+
)
|
|
53
|
+
DialogHeader.displayName = "DialogHeader"
|
|
54
|
+
|
|
55
|
+
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
56
|
+
<div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
|
|
57
|
+
)
|
|
58
|
+
DialogFooter.displayName = "DialogFooter"
|
|
59
|
+
|
|
60
|
+
const DialogTitle = React.forwardRef<
|
|
61
|
+
React.ComponentRef<typeof DialogPrimitive.Title>,
|
|
62
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
63
|
+
>(({ className, ...props }, ref) => (
|
|
64
|
+
<DialogPrimitive.Title
|
|
65
|
+
ref={ref}
|
|
66
|
+
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
))
|
|
70
|
+
DialogTitle.displayName = "DialogTitle"
|
|
71
|
+
|
|
72
|
+
const DialogDescription = React.forwardRef<
|
|
73
|
+
React.ComponentRef<typeof DialogPrimitive.Description>,
|
|
74
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
75
|
+
>(({ className, ...props }, ref) => (
|
|
76
|
+
<DialogPrimitive.Description
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
))
|
|
82
|
+
DialogDescription.displayName = "DialogDescription"
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Dialog, DialogPortal, DialogOverlay, DialogTrigger, DialogClose,
|
|
86
|
+
DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription,
|
|
87
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
7
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
8
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
9
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
10
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
11
|
+
|
|
12
|
+
const DropdownMenuContent = React.forwardRef<
|
|
13
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
15
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
16
|
+
<DropdownMenuPrimitive.Portal>
|
|
17
|
+
<DropdownMenuPrimitive.Content
|
|
18
|
+
ref={ref}
|
|
19
|
+
sideOffset={sideOffset}
|
|
20
|
+
className={cn(
|
|
21
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
</DropdownMenuPrimitive.Portal>
|
|
27
|
+
))
|
|
28
|
+
DropdownMenuContent.displayName = "DropdownMenuContent"
|
|
29
|
+
|
|
30
|
+
const DropdownMenuItem = React.forwardRef<
|
|
31
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
|
|
32
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }
|
|
33
|
+
>(({ className, inset, ...props }, ref) => (
|
|
34
|
+
<DropdownMenuPrimitive.Item
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn(
|
|
37
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
38
|
+
inset && "pl-8",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
))
|
|
44
|
+
DropdownMenuItem.displayName = "DropdownMenuItem"
|
|
45
|
+
|
|
46
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
47
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
48
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
49
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
50
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
51
|
+
ref={ref}
|
|
52
|
+
className={cn(
|
|
53
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
54
|
+
className
|
|
55
|
+
)}
|
|
56
|
+
checked={checked}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
60
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
61
|
+
<Check className="h-4 w-4" />
|
|
62
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
63
|
+
</span>
|
|
64
|
+
{children}
|
|
65
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
66
|
+
))
|
|
67
|
+
DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem"
|
|
68
|
+
|
|
69
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
70
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
|
|
71
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }
|
|
72
|
+
>(({ className, inset, ...props }, ref) => (
|
|
73
|
+
<DropdownMenuPrimitive.Label
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
))
|
|
79
|
+
DropdownMenuLabel.displayName = "DropdownMenuLabel"
|
|
80
|
+
|
|
81
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
82
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
|
|
83
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
84
|
+
>(({ className, ...props }, ref) => (
|
|
85
|
+
<DropdownMenuPrimitive.Separator
|
|
86
|
+
ref={ref}
|
|
87
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
))
|
|
91
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator"
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem,
|
|
95
|
+
DropdownMenuCheckboxItem, DropdownMenuLabel, DropdownMenuSeparator,
|
|
96
|
+
DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub,
|
|
97
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "@zhin.js/client"
|
|
3
|
+
|
|
4
|
+
const Input = React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>(
|
|
5
|
+
({ className, type, ...props }, ref) => {
|
|
6
|
+
return (
|
|
7
|
+
<input
|
|
8
|
+
type={type}
|
|
9
|
+
className={cn(
|
|
10
|
+
"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 file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
ref={ref}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
Input.displayName = "Input"
|
|
20
|
+
|
|
21
|
+
export { Input }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
|
|
5
|
+
const ScrollArea = React.forwardRef<
|
|
6
|
+
React.ComponentRef<typeof ScrollAreaPrimitive.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
8
|
+
>(({ className, children, ...props }, ref) => (
|
|
9
|
+
<ScrollAreaPrimitive.Root
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn("relative overflow-hidden", className)}
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
|
|
15
|
+
{children}
|
|
16
|
+
</ScrollAreaPrimitive.Viewport>
|
|
17
|
+
<ScrollBar />
|
|
18
|
+
<ScrollAreaPrimitive.Corner />
|
|
19
|
+
</ScrollAreaPrimitive.Root>
|
|
20
|
+
))
|
|
21
|
+
ScrollArea.displayName = "ScrollArea"
|
|
22
|
+
|
|
23
|
+
const ScrollBar = React.forwardRef<
|
|
24
|
+
React.ComponentRef<typeof ScrollAreaPrimitive.Scrollbar>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>
|
|
26
|
+
>(({ className, orientation = "vertical", ...props }, ref) => (
|
|
27
|
+
<ScrollAreaPrimitive.Scrollbar
|
|
28
|
+
ref={ref}
|
|
29
|
+
orientation={orientation}
|
|
30
|
+
className={cn(
|
|
31
|
+
"flex touch-none select-none transition-colors",
|
|
32
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
33
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
>
|
|
38
|
+
<ScrollAreaPrimitive.Thumb className="relative flex-1 rounded-full bg-border" />
|
|
39
|
+
</ScrollAreaPrimitive.Scrollbar>
|
|
40
|
+
))
|
|
41
|
+
ScrollBar.displayName = "ScrollBar"
|
|
42
|
+
|
|
43
|
+
export { ScrollArea, ScrollBar }
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Select as SelectPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
const Select = SelectPrimitive.Root
|
|
7
|
+
const SelectGroup = SelectPrimitive.Group
|
|
8
|
+
const SelectValue = SelectPrimitive.Value
|
|
9
|
+
|
|
10
|
+
const SelectTrigger = React.forwardRef<
|
|
11
|
+
React.ComponentRef<typeof SelectPrimitive.Trigger>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
13
|
+
>(({ className, children, ...props }, ref) => (
|
|
14
|
+
<SelectPrimitive.Trigger
|
|
15
|
+
ref={ref}
|
|
16
|
+
className={cn(
|
|
17
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
<SelectPrimitive.Icon asChild>
|
|
24
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
25
|
+
</SelectPrimitive.Icon>
|
|
26
|
+
</SelectPrimitive.Trigger>
|
|
27
|
+
))
|
|
28
|
+
SelectTrigger.displayName = "SelectTrigger"
|
|
29
|
+
|
|
30
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
31
|
+
React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
32
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
33
|
+
>(({ className, ...props }, ref) => (
|
|
34
|
+
<SelectPrimitive.ScrollUpButton
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
<ChevronUp className="h-4 w-4" />
|
|
40
|
+
</SelectPrimitive.ScrollUpButton>
|
|
41
|
+
))
|
|
42
|
+
SelectScrollUpButton.displayName = "SelectScrollUpButton"
|
|
43
|
+
|
|
44
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
45
|
+
React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
46
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
47
|
+
>(({ className, ...props }, ref) => (
|
|
48
|
+
<SelectPrimitive.ScrollDownButton
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
<ChevronDown className="h-4 w-4" />
|
|
54
|
+
</SelectPrimitive.ScrollDownButton>
|
|
55
|
+
))
|
|
56
|
+
SelectScrollDownButton.displayName = "SelectScrollDownButton"
|
|
57
|
+
|
|
58
|
+
const SelectContent = React.forwardRef<
|
|
59
|
+
React.ComponentRef<typeof SelectPrimitive.Content>,
|
|
60
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
61
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
62
|
+
<SelectPrimitive.Portal>
|
|
63
|
+
<SelectPrimitive.Content
|
|
64
|
+
ref={ref}
|
|
65
|
+
className={cn(
|
|
66
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",
|
|
67
|
+
position === "popper" &&
|
|
68
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
position={position}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
<SelectScrollUpButton />
|
|
75
|
+
<SelectPrimitive.Viewport
|
|
76
|
+
className={cn(
|
|
77
|
+
"p-1",
|
|
78
|
+
position === "popper" &&
|
|
79
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
{children}
|
|
83
|
+
</SelectPrimitive.Viewport>
|
|
84
|
+
<SelectScrollDownButton />
|
|
85
|
+
</SelectPrimitive.Content>
|
|
86
|
+
</SelectPrimitive.Portal>
|
|
87
|
+
))
|
|
88
|
+
SelectContent.displayName = "SelectContent"
|
|
89
|
+
|
|
90
|
+
const SelectItem = React.forwardRef<
|
|
91
|
+
React.ComponentRef<typeof SelectPrimitive.Item>,
|
|
92
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
93
|
+
>(({ className, children, ...props }, ref) => (
|
|
94
|
+
<SelectPrimitive.Item
|
|
95
|
+
ref={ref}
|
|
96
|
+
className={cn(
|
|
97
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
100
|
+
{...props}
|
|
101
|
+
>
|
|
102
|
+
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
103
|
+
<SelectPrimitive.ItemIndicator>
|
|
104
|
+
<Check className="h-4 w-4" />
|
|
105
|
+
</SelectPrimitive.ItemIndicator>
|
|
106
|
+
</span>
|
|
107
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
108
|
+
</SelectPrimitive.Item>
|
|
109
|
+
))
|
|
110
|
+
SelectItem.displayName = "SelectItem"
|
|
111
|
+
|
|
112
|
+
const SelectSeparator = React.forwardRef<
|
|
113
|
+
React.ComponentRef<typeof SelectPrimitive.Separator>,
|
|
114
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
115
|
+
>(({ className, ...props }, ref) => (
|
|
116
|
+
<SelectPrimitive.Separator
|
|
117
|
+
ref={ref}
|
|
118
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
119
|
+
{...props}
|
|
120
|
+
/>
|
|
121
|
+
))
|
|
122
|
+
SelectSeparator.displayName = "SelectSeparator"
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
Select, SelectGroup, SelectValue, SelectTrigger, SelectContent,
|
|
126
|
+
SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton,
|
|
127
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Separator as SeparatorPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
|
|
5
|
+
const Separator = React.forwardRef<
|
|
6
|
+
React.ComponentRef<typeof SeparatorPrimitive.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
8
|
+
>(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
9
|
+
<SeparatorPrimitive.Root
|
|
10
|
+
ref={ref}
|
|
11
|
+
decorative={decorative}
|
|
12
|
+
orientation={orientation}
|
|
13
|
+
className={cn(
|
|
14
|
+
"shrink-0 bg-border",
|
|
15
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
))
|
|
21
|
+
Separator.displayName = "Separator"
|
|
22
|
+
|
|
23
|
+
export { Separator }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { cn } from "@zhin.js/client"
|
|
2
|
+
|
|
3
|
+
function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
className={cn("animate-pulse rounded-md bg-primary/10", className)}
|
|
7
|
+
{...props}
|
|
8
|
+
/>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { Skeleton }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Switch as SwitchPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
|
|
5
|
+
const Switch = React.forwardRef<
|
|
6
|
+
React.ComponentRef<typeof SwitchPrimitive.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<SwitchPrimitive.Root
|
|
10
|
+
className={cn(
|
|
11
|
+
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
ref={ref}
|
|
16
|
+
>
|
|
17
|
+
<SwitchPrimitive.Thumb
|
|
18
|
+
className={cn(
|
|
19
|
+
"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
20
|
+
)}
|
|
21
|
+
/>
|
|
22
|
+
</SwitchPrimitive.Root>
|
|
23
|
+
))
|
|
24
|
+
Switch.displayName = "Switch"
|
|
25
|
+
|
|
26
|
+
export { Switch }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Tabs as TabsPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
|
|
5
|
+
const Tabs = TabsPrimitive.Root
|
|
6
|
+
|
|
7
|
+
const TabsList = React.forwardRef<
|
|
8
|
+
React.ComponentRef<typeof TabsPrimitive.List>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<TabsPrimitive.List
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn(
|
|
14
|
+
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
))
|
|
20
|
+
TabsList.displayName = "TabsList"
|
|
21
|
+
|
|
22
|
+
const TabsTrigger = React.forwardRef<
|
|
23
|
+
React.ComponentRef<typeof TabsPrimitive.Trigger>,
|
|
24
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
25
|
+
>(({ className, ...props }, ref) => (
|
|
26
|
+
<TabsPrimitive.Trigger
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={cn(
|
|
29
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
))
|
|
35
|
+
TabsTrigger.displayName = "TabsTrigger"
|
|
36
|
+
|
|
37
|
+
const TabsContent = React.forwardRef<
|
|
38
|
+
React.ComponentRef<typeof TabsPrimitive.Content>,
|
|
39
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
40
|
+
>(({ className, ...props }, ref) => (
|
|
41
|
+
<TabsPrimitive.Content
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={cn(
|
|
44
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
))
|
|
50
|
+
TabsContent.displayName = "TabsContent"
|
|
51
|
+
|
|
52
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "@zhin.js/client"
|
|
3
|
+
|
|
4
|
+
const Textarea = React.forwardRef<HTMLTextAreaElement, React.TextareaHTMLAttributes<HTMLTextAreaElement>>(
|
|
5
|
+
({ className, ...props }, ref) => {
|
|
6
|
+
return (
|
|
7
|
+
<textarea
|
|
8
|
+
className={cn(
|
|
9
|
+
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
10
|
+
className
|
|
11
|
+
)}
|
|
12
|
+
ref={ref}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
Textarea.displayName = "Textarea"
|
|
19
|
+
|
|
20
|
+
export { Textarea }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
|
3
|
+
import { cn } from "@zhin.js/client"
|
|
4
|
+
|
|
5
|
+
const TooltipProvider = TooltipPrimitive.Provider
|
|
6
|
+
const Tooltip = TooltipPrimitive.Root
|
|
7
|
+
const TooltipTrigger = TooltipPrimitive.Trigger
|
|
8
|
+
|
|
9
|
+
const TooltipContent = React.forwardRef<
|
|
10
|
+
React.ComponentRef<typeof TooltipPrimitive.Content>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
12
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
13
|
+
<TooltipPrimitive.Portal>
|
|
14
|
+
<TooltipPrimitive.Content
|
|
15
|
+
ref={ref}
|
|
16
|
+
sideOffset={sideOffset}
|
|
17
|
+
className={cn(
|
|
18
|
+
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs 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",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
</TooltipPrimitive.Portal>
|
|
24
|
+
))
|
|
25
|
+
TooltipContent.displayName = "TooltipContent"
|
|
26
|
+
|
|
27
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|