@hexclave/ui 1.0.3 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/simple-tooltip.js +2 -2
- package/dist/components/simple-tooltip.js.map +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/form.d.ts +1 -1
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +1 -1
- package/dist/esm/components/copy-button.d.ts +1 -1
- package/dist/esm/components/simple-tooltip.js +3 -3
- package/dist/esm/components/simple-tooltip.js.map +1 -1
- package/dist/esm/components/ui/button.d.ts +2 -2
- package/dist/esm/components/ui/form.d.ts +1 -1
- package/dist/esm/components/ui/form.d.ts.map +1 -1
- package/dist/esm/components/ui/resizable.d.ts +1 -1
- package/dist/esm/components/ui/resizable.d.ts.map +1 -1
- package/dist/esm/components/ui/typography.d.ts +1 -1
- package/package.json +3 -2
- package/src/components/action-dialog.tsx +135 -0
- package/src/components/brand-icons.tsx +276 -0
- package/src/components/browser-frame/LICENSE +3 -0
- package/src/components/browser-frame/index.tsx +51 -0
- package/src/components/copy-button.tsx +36 -0
- package/src/components/copy-field.tsx +52 -0
- package/src/components/data-table/cells.tsx +133 -0
- package/src/components/data-table/column-header.tsx +52 -0
- package/src/components/data-table/data-table.tsx +318 -0
- package/src/components/data-table/faceted-filter.tsx +138 -0
- package/src/components/data-table/index.tsx +9 -0
- package/src/components/data-table/pagination.tsx +76 -0
- package/src/components/data-table/toolbar-items.tsx +13 -0
- package/src/components/data-table/toolbar.tsx +100 -0
- package/src/components/data-table/utils.tsx +7 -0
- package/src/components/data-table/view-options.tsx +64 -0
- package/src/components/simple-tooltip.tsx +48 -0
- package/src/components/ui/accordion.tsx +58 -0
- package/src/components/ui/alert.tsx +60 -0
- package/src/components/ui/aspect-ratio.tsx +7 -0
- package/src/components/ui/avatar.tsx +51 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/breadcrumb.tsx +116 -0
- package/src/components/ui/button.tsx +95 -0
- package/src/components/ui/calendar.tsx +77 -0
- package/src/components/ui/card.tsx +88 -0
- package/src/components/ui/checkbox.tsx +31 -0
- package/src/components/ui/collapsible.tsx +11 -0
- package/src/components/ui/command.tsx +159 -0
- package/src/components/ui/context-menu.tsx +205 -0
- package/src/components/ui/dialog.tsx +135 -0
- package/src/components/ui/dropdown-menu.tsx +245 -0
- package/src/components/ui/form.tsx +173 -0
- package/src/components/ui/hover-card.tsx +30 -0
- package/src/components/ui/inline-code.tsx +40 -0
- package/src/components/ui/input-otp.tsx +73 -0
- package/src/components/ui/input.tsx +68 -0
- package/src/components/ui/label.tsx +40 -0
- package/src/components/ui/menubar.tsx +241 -0
- package/src/components/ui/navigation-menu.tsx +131 -0
- package/src/components/ui/password-input.tsx +50 -0
- package/src/components/ui/popover.tsx +34 -0
- package/src/components/ui/progress.tsx +29 -0
- package/src/components/ui/radio-group.tsx +45 -0
- package/src/components/ui/resizable.tsx +45 -0
- package/src/components/ui/scroll-area.tsx +49 -0
- package/src/components/ui/select.tsx +162 -0
- package/src/components/ui/separator.tsx +32 -0
- package/src/components/ui/sheet.tsx +139 -0
- package/src/components/ui/skeleton.tsx +23 -0
- package/src/components/ui/slider.tsx +29 -0
- package/src/components/ui/spinner.tsx +18 -0
- package/src/components/ui/switch.tsx +75 -0
- package/src/components/ui/table.tsx +117 -0
- package/src/components/ui/tabs.tsx +56 -0
- package/src/components/ui/textarea.tsx +24 -0
- package/src/components/ui/toast.tsx +135 -0
- package/src/components/ui/toaster.tsx +35 -0
- package/src/components/ui/toggle-group.tsx +62 -0
- package/src/components/ui/toggle.tsx +46 -0
- package/src/components/ui/tooltip.tsx +40 -0
- package/src/components/ui/typography.tsx +47 -0
- package/src/components/ui/use-toast.tsx +195 -0
- package/src/index.ts +54 -0
- package/src/lib/utils.tsx +6 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
5
|
+
const Card = forwardRefIfNeeded<
|
|
6
|
+
HTMLDivElement,
|
|
7
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<div
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn(
|
|
12
|
+
"rounded-xl border bg-card text-card-foreground shadow-sm",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
));
|
|
18
|
+
Card.displayName = "Card";
|
|
19
|
+
|
|
20
|
+
const CardHeader = forwardRefIfNeeded<
|
|
21
|
+
HTMLDivElement,
|
|
22
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<div
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn("flex flex-col space-y-1.5 p-6 pb-0", className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
));
|
|
30
|
+
CardHeader.displayName = "CardHeader";
|
|
31
|
+
|
|
32
|
+
const CardTitle = forwardRefIfNeeded<
|
|
33
|
+
HTMLParagraphElement,
|
|
34
|
+
React.HTMLAttributes<HTMLHeadingElement>
|
|
35
|
+
>(({ className, ...props }, ref) => (
|
|
36
|
+
<h3
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn("font-semibold leading-none tracking-tight capitalize", className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
));
|
|
42
|
+
CardTitle.displayName = "CardTitle";
|
|
43
|
+
|
|
44
|
+
const CardDescription = forwardRefIfNeeded<
|
|
45
|
+
HTMLParagraphElement,
|
|
46
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
47
|
+
>(({ className, ...props }, ref) => (
|
|
48
|
+
<p
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
));
|
|
54
|
+
CardDescription.displayName = "CardDescription";
|
|
55
|
+
|
|
56
|
+
const CardContent = forwardRefIfNeeded<
|
|
57
|
+
HTMLDivElement,
|
|
58
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
59
|
+
>(({ className, ...props }, ref) => (
|
|
60
|
+
<div ref={ref} className={cn("p-6", className)} {...props} />
|
|
61
|
+
));
|
|
62
|
+
CardContent.displayName = "CardContent";
|
|
63
|
+
|
|
64
|
+
const CardSubtitle = forwardRefIfNeeded<
|
|
65
|
+
HTMLParagraphElement,
|
|
66
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
67
|
+
>(({ className, ...props }, ref) => (
|
|
68
|
+
<h4
|
|
69
|
+
ref={ref}
|
|
70
|
+
className={cn("text-sm text-muted-foreground font-bold", className)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
));
|
|
74
|
+
|
|
75
|
+
const CardFooter = forwardRefIfNeeded<
|
|
76
|
+
HTMLDivElement,
|
|
77
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
78
|
+
>(({ className, ...props }, ref) => (
|
|
79
|
+
<div
|
|
80
|
+
ref={ref}
|
|
81
|
+
className={cn("flex items-center p-6 pt-0", className)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
));
|
|
85
|
+
CardFooter.displayName = "CardFooter";
|
|
86
|
+
|
|
87
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardSubtitle, CardTitle };
|
|
88
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
5
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
6
|
+
import { CheckIcon } from "@radix-ui/react-icons";
|
|
7
|
+
|
|
8
|
+
import { cn } from "../../lib/utils";
|
|
9
|
+
|
|
10
|
+
const Checkbox = forwardRefIfNeeded<
|
|
11
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
13
|
+
>(({ className, ...props }, ref) => (
|
|
14
|
+
<CheckboxPrimitive.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
className={cn(
|
|
17
|
+
"stack-scope 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",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<CheckboxPrimitive.Indicator
|
|
23
|
+
className={cn("flex items-center justify-center text-current")}
|
|
24
|
+
>
|
|
25
|
+
<CheckIcon className="h-4 w-4" />
|
|
26
|
+
</CheckboxPrimitive.Indicator>
|
|
27
|
+
</CheckboxPrimitive.Root>
|
|
28
|
+
));
|
|
29
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
30
|
+
|
|
31
|
+
export { Checkbox };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
+
|
|
5
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
6
|
+
|
|
7
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
8
|
+
|
|
9
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
10
|
+
|
|
11
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { type DialogProps } from "@radix-ui/react-dialog";
|
|
4
|
+
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
|
|
5
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
6
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
7
|
+
import React from "react";
|
|
8
|
+
|
|
9
|
+
import { cn } from "../../lib/utils";
|
|
10
|
+
import { Dialog, DialogBody, DialogContent } from "./dialog";
|
|
11
|
+
|
|
12
|
+
const Command: React.FC<React.ComponentPropsWithoutRef<typeof CommandPrimitive>> = forwardRefIfNeeded<
|
|
13
|
+
React.ElementRef<typeof CommandPrimitive>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
15
|
+
>(({ className, ...props }, ref) => (
|
|
16
|
+
<CommandPrimitive
|
|
17
|
+
ref={ref}
|
|
18
|
+
className={cn(
|
|
19
|
+
"stack-scope flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
));
|
|
25
|
+
Command.displayName = CommandPrimitive.displayName;
|
|
26
|
+
|
|
27
|
+
type CommandDialogProps = {} & DialogProps
|
|
28
|
+
|
|
29
|
+
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
|
|
30
|
+
return (
|
|
31
|
+
<Dialog {...props}>
|
|
32
|
+
<DialogContent className="overflow-hidden p-0">
|
|
33
|
+
<DialogBody>
|
|
34
|
+
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[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">
|
|
35
|
+
{children}
|
|
36
|
+
</Command>
|
|
37
|
+
</DialogBody>
|
|
38
|
+
</DialogContent>
|
|
39
|
+
</Dialog>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const CommandInput: React.FC<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>> = forwardRefIfNeeded<
|
|
44
|
+
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
45
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
46
|
+
>(({ className, ...props }, ref) => (
|
|
47
|
+
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
|
48
|
+
<MagnifyingGlassIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
49
|
+
<CommandPrimitive.Input
|
|
50
|
+
ref={ref}
|
|
51
|
+
className={cn(
|
|
52
|
+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
));
|
|
59
|
+
|
|
60
|
+
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
61
|
+
|
|
62
|
+
const CommandList: React.FC<React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>> = forwardRefIfNeeded<
|
|
63
|
+
React.ElementRef<typeof CommandPrimitive.List>,
|
|
64
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
65
|
+
>(({ className, ...props }, ref) => (
|
|
66
|
+
<CommandPrimitive.List
|
|
67
|
+
ref={ref}
|
|
68
|
+
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
));
|
|
72
|
+
|
|
73
|
+
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
74
|
+
|
|
75
|
+
const CommandEmpty: React.FC<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>> = forwardRefIfNeeded<
|
|
76
|
+
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
77
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
78
|
+
>((props, ref) => (
|
|
79
|
+
<CommandPrimitive.Empty
|
|
80
|
+
ref={ref}
|
|
81
|
+
className="py-6 text-center text-sm"
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
));
|
|
85
|
+
|
|
86
|
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
87
|
+
|
|
88
|
+
const CommandGroup: React.FC<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>> = forwardRefIfNeeded<
|
|
89
|
+
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
91
|
+
>(({ className, ...props }, ref) => (
|
|
92
|
+
<CommandPrimitive.Group
|
|
93
|
+
ref={ref}
|
|
94
|
+
className={cn(
|
|
95
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
96
|
+
className
|
|
97
|
+
)}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
));
|
|
101
|
+
|
|
102
|
+
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
103
|
+
|
|
104
|
+
const CommandSeparator: React.FC<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>> = forwardRefIfNeeded<
|
|
105
|
+
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
106
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
107
|
+
>(({ className, ...props }, ref) => (
|
|
108
|
+
<CommandPrimitive.Separator
|
|
109
|
+
ref={ref}
|
|
110
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
));
|
|
114
|
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
115
|
+
|
|
116
|
+
const CommandItem: React.FC<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>> = forwardRefIfNeeded<
|
|
117
|
+
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
118
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
119
|
+
>(({ className, ...props }, ref) => (
|
|
120
|
+
<CommandPrimitive.Item
|
|
121
|
+
ref={ref}
|
|
122
|
+
className={cn(
|
|
123
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
{...props}
|
|
127
|
+
/>
|
|
128
|
+
));
|
|
129
|
+
|
|
130
|
+
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
131
|
+
|
|
132
|
+
const CommandShortcut = ({
|
|
133
|
+
className,
|
|
134
|
+
...props
|
|
135
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
136
|
+
return (
|
|
137
|
+
<span
|
|
138
|
+
className={cn(
|
|
139
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
140
|
+
className
|
|
141
|
+
)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
147
|
+
|
|
148
|
+
export {
|
|
149
|
+
Command,
|
|
150
|
+
CommandDialog,
|
|
151
|
+
CommandEmpty,
|
|
152
|
+
CommandGroup,
|
|
153
|
+
CommandInput,
|
|
154
|
+
CommandItem,
|
|
155
|
+
CommandList,
|
|
156
|
+
CommandSeparator,
|
|
157
|
+
CommandShortcut,
|
|
158
|
+
};
|
|
159
|
+
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
5
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
6
|
+
import {
|
|
7
|
+
CheckIcon,
|
|
8
|
+
ChevronRightIcon,
|
|
9
|
+
DotFilledIcon,
|
|
10
|
+
} from "@radix-ui/react-icons";
|
|
11
|
+
|
|
12
|
+
import { cn } from "../../lib/utils";
|
|
13
|
+
|
|
14
|
+
const ContextMenu = ContextMenuPrimitive.Root;
|
|
15
|
+
|
|
16
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
17
|
+
|
|
18
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
19
|
+
|
|
20
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
21
|
+
|
|
22
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
23
|
+
|
|
24
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
25
|
+
|
|
26
|
+
const ContextMenuSubTrigger = forwardRefIfNeeded<
|
|
27
|
+
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
29
|
+
inset?: boolean,
|
|
30
|
+
}
|
|
31
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
32
|
+
<ContextMenuPrimitive.SubTrigger
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={cn(
|
|
35
|
+
"stack-scope flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
36
|
+
inset && "pl-8",
|
|
37
|
+
className
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
<ChevronRightIcon className="ml-auto h-4 w-4" />
|
|
43
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
44
|
+
));
|
|
45
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
46
|
+
|
|
47
|
+
const ContextMenuSubContent = forwardRefIfNeeded<
|
|
48
|
+
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
|
49
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
|
50
|
+
>(({ className, ...props }, ref) => (
|
|
51
|
+
<ContextMenuPrimitive.SubContent
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cn(
|
|
54
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",
|
|
55
|
+
className
|
|
56
|
+
)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
));
|
|
60
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
61
|
+
|
|
62
|
+
const ContextMenuContent = forwardRefIfNeeded<
|
|
63
|
+
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
|
64
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
|
65
|
+
>(({ className, ...props }, ref) => (
|
|
66
|
+
<ContextMenuPrimitive.Portal>
|
|
67
|
+
<ContextMenuPrimitive.Content
|
|
68
|
+
ref={ref}
|
|
69
|
+
className={cn(
|
|
70
|
+
"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",
|
|
71
|
+
className
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
</ContextMenuPrimitive.Portal>
|
|
76
|
+
));
|
|
77
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
78
|
+
|
|
79
|
+
const ContextMenuItem = forwardRefIfNeeded<
|
|
80
|
+
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
|
81
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
|
82
|
+
inset?: boolean,
|
|
83
|
+
}
|
|
84
|
+
>(({ className, inset, ...props }, ref) => (
|
|
85
|
+
<ContextMenuPrimitive.Item
|
|
86
|
+
ref={ref}
|
|
87
|
+
className={cn(
|
|
88
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
89
|
+
inset && "pl-8",
|
|
90
|
+
className
|
|
91
|
+
)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
));
|
|
95
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
96
|
+
|
|
97
|
+
const ContextMenuCheckboxItem = forwardRefIfNeeded<
|
|
98
|
+
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
99
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
|
100
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
101
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
102
|
+
ref={ref}
|
|
103
|
+
className={cn(
|
|
104
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
105
|
+
className
|
|
106
|
+
)}
|
|
107
|
+
checked={checked}
|
|
108
|
+
{...props}
|
|
109
|
+
>
|
|
110
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
111
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
112
|
+
<CheckIcon className="h-4 w-4" />
|
|
113
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
114
|
+
</span>
|
|
115
|
+
{children}
|
|
116
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
117
|
+
));
|
|
118
|
+
ContextMenuCheckboxItem.displayName =
|
|
119
|
+
ContextMenuPrimitive.CheckboxItem.displayName;
|
|
120
|
+
|
|
121
|
+
const ContextMenuRadioItem = forwardRefIfNeeded<
|
|
122
|
+
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
123
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
|
124
|
+
>(({ className, children, ...props }, ref) => (
|
|
125
|
+
<ContextMenuPrimitive.RadioItem
|
|
126
|
+
ref={ref}
|
|
127
|
+
className={cn(
|
|
128
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
{...props}
|
|
132
|
+
>
|
|
133
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
134
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
135
|
+
<DotFilledIcon className="h-4 w-4 fill-current" />
|
|
136
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
137
|
+
</span>
|
|
138
|
+
{children}
|
|
139
|
+
</ContextMenuPrimitive.RadioItem>
|
|
140
|
+
));
|
|
141
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
142
|
+
|
|
143
|
+
const ContextMenuLabel = forwardRefIfNeeded<
|
|
144
|
+
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
|
145
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
|
146
|
+
inset?: boolean,
|
|
147
|
+
}
|
|
148
|
+
>(({ className, inset, ...props }, ref) => (
|
|
149
|
+
<ContextMenuPrimitive.Label
|
|
150
|
+
ref={ref}
|
|
151
|
+
className={cn(
|
|
152
|
+
"px-2 py-1.5 text-sm font-semibold text-foreground",
|
|
153
|
+
inset && "pl-8",
|
|
154
|
+
className
|
|
155
|
+
)}
|
|
156
|
+
{...props}
|
|
157
|
+
/>
|
|
158
|
+
));
|
|
159
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
160
|
+
|
|
161
|
+
const ContextMenuSeparator = forwardRefIfNeeded<
|
|
162
|
+
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
|
163
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
|
164
|
+
>(({ className, ...props }, ref) => (
|
|
165
|
+
<ContextMenuPrimitive.Separator
|
|
166
|
+
ref={ref}
|
|
167
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
168
|
+
{...props}
|
|
169
|
+
/>
|
|
170
|
+
));
|
|
171
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
172
|
+
|
|
173
|
+
const ContextMenuShortcut = ({
|
|
174
|
+
className,
|
|
175
|
+
...props
|
|
176
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
177
|
+
return (
|
|
178
|
+
<span
|
|
179
|
+
className={cn(
|
|
180
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
181
|
+
className
|
|
182
|
+
)}
|
|
183
|
+
{...props}
|
|
184
|
+
/>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
ContextMenu,
|
|
191
|
+
ContextMenuTrigger,
|
|
192
|
+
ContextMenuContent,
|
|
193
|
+
ContextMenuItem,
|
|
194
|
+
ContextMenuCheckboxItem,
|
|
195
|
+
ContextMenuRadioItem,
|
|
196
|
+
ContextMenuLabel,
|
|
197
|
+
ContextMenuSeparator,
|
|
198
|
+
ContextMenuShortcut,
|
|
199
|
+
ContextMenuGroup,
|
|
200
|
+
ContextMenuPortal,
|
|
201
|
+
ContextMenuSub,
|
|
202
|
+
ContextMenuSubContent,
|
|
203
|
+
ContextMenuSubTrigger,
|
|
204
|
+
ContextMenuRadioGroup,
|
|
205
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { Cross2Icon } from "@radix-ui/react-icons";
|
|
5
|
+
import { forwardRefIfNeeded } from "@hexclave/shared/dist/utils/react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
|
|
8
|
+
import { cn } from "../../lib/utils";
|
|
9
|
+
|
|
10
|
+
const Dialog = DialogPrimitive.Root;
|
|
11
|
+
|
|
12
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
13
|
+
|
|
14
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
15
|
+
|
|
16
|
+
const DialogClose = DialogPrimitive.Close;
|
|
17
|
+
|
|
18
|
+
const DialogOverlay = forwardRefIfNeeded<
|
|
19
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
20
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<DialogPrimitive.Overlay
|
|
23
|
+
ref={ref}
|
|
24
|
+
className={cn(
|
|
25
|
+
"stack-scope fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
));
|
|
31
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
32
|
+
|
|
33
|
+
const DialogContent = forwardRefIfNeeded<
|
|
34
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
35
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
|
|
36
|
+
overlayProps?: React.ComponentPropsWithoutRef<typeof DialogOverlay>,
|
|
37
|
+
noCloseButton?: boolean,
|
|
38
|
+
}
|
|
39
|
+
>(({ className, children, overlayProps, noCloseButton, ...props }, ref) => (
|
|
40
|
+
<DialogPortal>
|
|
41
|
+
<DialogOverlay {...overlayProps} />
|
|
42
|
+
<DialogPrimitive.Content
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
"stack-scope fixed left-[50%] top-[50%] max-h-screen z-50 flex flex-col w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background p-6 shadow-lg duration-100 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",
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
{!noCloseButton && <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">
|
|
52
|
+
<Cross2Icon className="h-4 w-4" />
|
|
53
|
+
<span className="sr-only">Close</span>
|
|
54
|
+
</DialogPrimitive.Close>}
|
|
55
|
+
</DialogPrimitive.Content>
|
|
56
|
+
</DialogPortal>
|
|
57
|
+
));
|
|
58
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
59
|
+
|
|
60
|
+
const DialogBody = ({
|
|
61
|
+
className,
|
|
62
|
+
...props
|
|
63
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
64
|
+
<div className={cn("stack-scope overflow-y-auto flex flex-col gap-4 w-[calc(100%+3rem)] -mx-6 px-6 my-2 py-2", className)} {...props} />
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const DialogHeader = ({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
71
|
+
<div
|
|
72
|
+
className={cn(
|
|
73
|
+
"stack-scope flex flex-col space-y-1.5 text-center sm:text-left",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
DialogHeader.displayName = "DialogHeader";
|
|
80
|
+
|
|
81
|
+
const DialogFooter = ({
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
85
|
+
<div
|
|
86
|
+
className={cn(
|
|
87
|
+
"stack-scope flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
DialogFooter.displayName = "DialogFooter";
|
|
94
|
+
|
|
95
|
+
const DialogTitle = forwardRefIfNeeded<
|
|
96
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
97
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
98
|
+
>(({ className, ...props }, ref) => (
|
|
99
|
+
<DialogPrimitive.Title
|
|
100
|
+
ref={ref}
|
|
101
|
+
className={cn(
|
|
102
|
+
"stack-scope text-lg font-semibold leading-none tracking-tight",
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
));
|
|
108
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
109
|
+
|
|
110
|
+
const DialogDescription = forwardRefIfNeeded<
|
|
111
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
112
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
113
|
+
>(({ className, ...props }, ref) => (
|
|
114
|
+
<DialogPrimitive.Description
|
|
115
|
+
ref={ref}
|
|
116
|
+
className={cn("stack-scope text-sm text-muted-foreground", className)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
));
|
|
120
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
Dialog,
|
|
124
|
+
DialogBody,
|
|
125
|
+
DialogClose,
|
|
126
|
+
DialogContent,
|
|
127
|
+
DialogDescription,
|
|
128
|
+
DialogFooter,
|
|
129
|
+
DialogHeader,
|
|
130
|
+
DialogOverlay,
|
|
131
|
+
DialogPortal,
|
|
132
|
+
DialogTitle,
|
|
133
|
+
DialogTrigger
|
|
134
|
+
};
|
|
135
|
+
|