@vvedantb/ui 0.1.0 → 0.1.2
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 -21
- package/package.json +3 -2
- package/src/ai-elements/artifact.tsx +99 -99
- package/src/ai-elements/attachments.tsx +366 -366
- package/src/ai-elements/chain-of-thought.tsx +212 -212
- package/src/ai-elements/code-block.tsx +478 -478
- package/src/ai-elements/conversation.tsx +157 -157
- package/src/ai-elements/image.tsx +25 -25
- package/src/ai-elements/inline-citation.tsx +252 -252
- package/src/ai-elements/message.tsx +269 -269
- package/src/ai-elements/model-selector.tsx +211 -211
- package/src/ai-elements/prompt-input.tsx +1018 -1018
- package/src/ai-elements/queue.tsx +251 -251
- package/src/ai-elements/reasoning.tsx +178 -178
- package/src/ai-elements/shimmer.tsx +56 -56
- package/src/ai-elements/sources.tsx +77 -77
- package/src/ai-elements/speech-input.tsx +290 -290
- package/src/ai-elements/suggestion.tsx +191 -191
- package/src/css.d.ts +2 -2
- package/src/index.ts +96 -96
- package/src/motion/presets.ts +35 -35
- package/src/motion/presets.vibot.ts +105 -105
- package/src/ui/_menu-classes.ts +30 -30
- package/src/ui/_menu-classes.vibot.ts +33 -33
- package/src/ui/accordion.tsx +81 -81
- package/src/ui/accordion.verve.tsx +56 -56
- package/src/ui/badge.tsx +34 -34
- package/src/ui/breadcrumb.tsx +83 -83
- package/src/ui/button-group.tsx +84 -84
- package/src/ui/button.tsx +57 -57
- package/src/ui/card.tsx +27 -27
- package/src/ui/carousel.tsx +211 -211
- package/src/ui/checkbox.tsx +27 -27
- package/src/ui/clear-input.tsx +170 -170
- package/src/ui/clear-input.vibot.tsx +76 -76
- package/src/ui/clearInputDissolve.ts +214 -214
- package/src/ui/collapsible.tsx +7 -7
- package/src/ui/command.tsx +148 -148
- package/src/ui/context-menu.tsx +173 -173
- package/src/ui/dialog.tsx +149 -149
- package/src/ui/dropdown-menu.tsx +178 -178
- package/src/ui/hover-card.tsx +31 -31
- package/src/ui/input-group.tsx +162 -162
- package/src/ui/input-group.verve.tsx +150 -150
- package/src/ui/input.tsx +21 -21
- package/src/ui/kbd.tsx +18 -18
- package/src/ui/label.tsx +20 -20
- package/src/ui/labeled-switch-row.tsx +53 -53
- package/src/ui/modalTransition.ts +85 -85
- package/src/ui/pagination.tsx +47 -47
- package/src/ui/popover.tsx +33 -33
- package/src/ui/progress.tsx +25 -25
- package/src/ui/radix-select.tsx +202 -202
- package/src/ui/scroll-area.tsx +55 -55
- package/src/ui/scroll-area.verve.tsx +43 -43
- package/src/ui/search-input.tsx +29 -29
- package/src/ui/select.tsx +163 -163
- package/src/ui/separator.tsx +28 -28
- package/src/ui/sheet.tsx +87 -87
- package/src/ui/skeleton.tsx +18 -18
- package/src/ui/sonner.css +16 -16
- package/src/ui/sonner.tsx +47 -47
- package/src/ui/spinner.tsx +27 -27
- package/src/ui/surface-classes.ts +55 -55
- package/src/ui/switch.tsx +26 -26
- package/src/ui/table.tsx +123 -123
- package/src/ui/tabs.tsx +140 -140
- package/src/ui/tabsSliding.ts +56 -56
- package/src/ui/textarea.tsx +21 -21
- package/src/ui/time-picker.tsx +170 -170
- package/src/ui/tooltip.tsx +25 -25
- package/src/ui/visually-hidden.tsx +3 -3
- package/src/utils/cn.ts +16 -16
- package/src/utils/ref.ts +10 -10
package/src/ui/command.tsx
CHANGED
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Command as CommandPrimitive } from "cmdk";
|
|
3
|
-
import { IconSearch } from "@tabler/icons-react";
|
|
4
|
-
import { Dialog, DialogContent } from "./dialog";
|
|
5
|
-
import { cn } from "../utils/cn";
|
|
6
|
-
|
|
7
|
-
const Command = React.forwardRef<
|
|
8
|
-
React.ComponentRef<typeof CommandPrimitive>,
|
|
9
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
10
|
-
>(({ className, ...props }, ref) => (
|
|
11
|
-
<CommandPrimitive
|
|
12
|
-
ref={ref}
|
|
13
|
-
className={cn(
|
|
14
|
-
"flex h-full w-full flex-col overflow-hidden rounded-lg bg-overlay text-overlay-foreground",
|
|
15
|
-
className,
|
|
16
|
-
)}
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
));
|
|
20
|
-
Command.displayName = CommandPrimitive.displayName;
|
|
21
|
-
|
|
22
|
-
function CommandDialog({
|
|
23
|
-
children,
|
|
24
|
-
...props
|
|
25
|
-
}: React.ComponentProps<typeof Dialog>) {
|
|
26
|
-
return (
|
|
27
|
-
<Dialog {...props}>
|
|
28
|
-
<DialogContent className="overflow-hidden p-0 sm:max-w-xl">
|
|
29
|
-
{/* The list is pinned rather than `max-h`: a palette that resizes on
|
|
30
|
-
every keystroke shifts the whole dialog under the cursor. */}
|
|
31
|
-
<Command className="[&_[cmdk-list]]:h-80 [&_[cmdk-list]]:max-h-[60dvh] [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-widest [&_[cmdk-group-heading]]:text-muted [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-1.5 [&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-input]]:h-11 [&_[cmdk-item]]:rounded-md [&_[cmdk-item]]:px-2.5 [&_[cmdk-item]]:py-2 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4">
|
|
32
|
-
{children}
|
|
33
|
-
</Command>
|
|
34
|
-
</DialogContent>
|
|
35
|
-
</Dialog>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const CommandInput = React.forwardRef<
|
|
40
|
-
React.ComponentRef<typeof CommandPrimitive.Input>,
|
|
41
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
42
|
-
>(({ className, ...props }, ref) => (
|
|
43
|
-
<div
|
|
44
|
-
className="flex items-center border-b border-separator px-3.5"
|
|
45
|
-
cmdk-input-wrapper=""
|
|
46
|
-
>
|
|
47
|
-
<IconSearch className="mr-2 h-4 w-4 shrink-0 opacity-50" stroke={1.5} />
|
|
48
|
-
<CommandPrimitive.Input
|
|
49
|
-
ref={ref}
|
|
50
|
-
className={cn(
|
|
51
|
-
"flex h-11 w-full max-sm:min-w-0 bg-transparent text-base sm:text-sm outline-none placeholder:text-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
52
|
-
className,
|
|
53
|
-
)}
|
|
54
|
-
{...props}
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
));
|
|
58
|
-
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
59
|
-
|
|
60
|
-
const CommandList = React.forwardRef<
|
|
61
|
-
React.ComponentRef<typeof CommandPrimitive.List>,
|
|
62
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
63
|
-
>(({ className, ...props }, ref) => (
|
|
64
|
-
<CommandPrimitive.List
|
|
65
|
-
ref={ref}
|
|
66
|
-
className={cn("max-h-80 overflow-y-auto overflow-x-hidden pb-2", className)}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
69
|
-
));
|
|
70
|
-
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
71
|
-
|
|
72
|
-
const CommandEmpty = React.forwardRef<
|
|
73
|
-
React.ComponentRef<typeof CommandPrimitive.Empty>,
|
|
74
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
75
|
-
>((props, ref) => (
|
|
76
|
-
<CommandPrimitive.Empty
|
|
77
|
-
ref={ref}
|
|
78
|
-
className="py-8 text-center text-sm text-muted"
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
));
|
|
82
|
-
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
83
|
-
|
|
84
|
-
const CommandGroup = React.forwardRef<
|
|
85
|
-
React.ComponentRef<typeof CommandPrimitive.Group>,
|
|
86
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
87
|
-
>(({ className, ...props }, ref) => (
|
|
88
|
-
<CommandPrimitive.Group
|
|
89
|
-
ref={ref}
|
|
90
|
-
className={cn(
|
|
91
|
-
"overflow-hidden p-1.5 text-foreground [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-widest [&_[cmdk-group-heading]]:text-muted",
|
|
92
|
-
className,
|
|
93
|
-
)}
|
|
94
|
-
{...props}
|
|
95
|
-
/>
|
|
96
|
-
));
|
|
97
|
-
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
98
|
-
|
|
99
|
-
const CommandSeparator = React.forwardRef<
|
|
100
|
-
React.ComponentRef<typeof CommandPrimitive.Separator>,
|
|
101
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
102
|
-
>(({ className, ...props }, ref) => (
|
|
103
|
-
<CommandPrimitive.Separator
|
|
104
|
-
ref={ref}
|
|
105
|
-
className={cn("-mx-1.5 h-px bg-separator", className)}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
));
|
|
109
|
-
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
110
|
-
|
|
111
|
-
const CommandItem = React.forwardRef<
|
|
112
|
-
React.ComponentRef<typeof CommandPrimitive.Item>,
|
|
113
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
114
|
-
>(({ className, ...props }, ref) => (
|
|
115
|
-
<CommandPrimitive.Item
|
|
116
|
-
ref={ref}
|
|
117
|
-
className={cn(
|
|
118
|
-
"relative flex cursor-default gap-2 select-none items-center rounded-md px-2.5 py-2 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[selected=true]:bg-surface-tertiary/80 data-[selected=true]:text-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
119
|
-
className,
|
|
120
|
-
)}
|
|
121
|
-
{...props}
|
|
122
|
-
/>
|
|
123
|
-
));
|
|
124
|
-
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
125
|
-
|
|
126
|
-
function CommandShortcut({
|
|
127
|
-
className,
|
|
128
|
-
...props
|
|
129
|
-
}: React.HTMLAttributes<HTMLSpanElement>) {
|
|
130
|
-
return (
|
|
131
|
-
<span
|
|
132
|
-
className={cn("ml-auto text-xs tracking-wide text-muted/90", className)}
|
|
133
|
-
{...props}
|
|
134
|
-
/>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export {
|
|
139
|
-
Command,
|
|
140
|
-
CommandDialog,
|
|
141
|
-
CommandInput,
|
|
142
|
-
CommandList,
|
|
143
|
-
CommandEmpty,
|
|
144
|
-
CommandGroup,
|
|
145
|
-
CommandItem,
|
|
146
|
-
CommandShortcut,
|
|
147
|
-
CommandSeparator,
|
|
148
|
-
};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
3
|
+
import { IconSearch } from "@tabler/icons-react";
|
|
4
|
+
import { Dialog, DialogContent } from "./dialog";
|
|
5
|
+
import { cn } from "../utils/cn";
|
|
6
|
+
|
|
7
|
+
const Command = React.forwardRef<
|
|
8
|
+
React.ComponentRef<typeof CommandPrimitive>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<CommandPrimitive
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn(
|
|
14
|
+
"flex h-full w-full flex-col overflow-hidden rounded-lg bg-overlay text-overlay-foreground",
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
));
|
|
20
|
+
Command.displayName = CommandPrimitive.displayName;
|
|
21
|
+
|
|
22
|
+
function CommandDialog({
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof Dialog>) {
|
|
26
|
+
return (
|
|
27
|
+
<Dialog {...props}>
|
|
28
|
+
<DialogContent className="overflow-hidden p-0 sm:max-w-xl">
|
|
29
|
+
{/* The list is pinned rather than `max-h`: a palette that resizes on
|
|
30
|
+
every keystroke shifts the whole dialog under the cursor. */}
|
|
31
|
+
<Command className="[&_[cmdk-list]]:h-80 [&_[cmdk-list]]:max-h-[60dvh] [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-widest [&_[cmdk-group-heading]]:text-muted [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-1.5 [&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-input]]:h-11 [&_[cmdk-item]]:rounded-md [&_[cmdk-item]]:px-2.5 [&_[cmdk-item]]:py-2 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4">
|
|
32
|
+
{children}
|
|
33
|
+
</Command>
|
|
34
|
+
</DialogContent>
|
|
35
|
+
</Dialog>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const CommandInput = React.forwardRef<
|
|
40
|
+
React.ComponentRef<typeof CommandPrimitive.Input>,
|
|
41
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
42
|
+
>(({ className, ...props }, ref) => (
|
|
43
|
+
<div
|
|
44
|
+
className="flex items-center border-b border-separator px-3.5"
|
|
45
|
+
cmdk-input-wrapper=""
|
|
46
|
+
>
|
|
47
|
+
<IconSearch className="mr-2 h-4 w-4 shrink-0 opacity-50" stroke={1.5} />
|
|
48
|
+
<CommandPrimitive.Input
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(
|
|
51
|
+
"flex h-11 w-full max-sm:min-w-0 bg-transparent text-base sm:text-sm outline-none placeholder:text-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
));
|
|
58
|
+
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
59
|
+
|
|
60
|
+
const CommandList = React.forwardRef<
|
|
61
|
+
React.ComponentRef<typeof CommandPrimitive.List>,
|
|
62
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
63
|
+
>(({ className, ...props }, ref) => (
|
|
64
|
+
<CommandPrimitive.List
|
|
65
|
+
ref={ref}
|
|
66
|
+
className={cn("max-h-80 overflow-y-auto overflow-x-hidden pb-2", className)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
));
|
|
70
|
+
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
71
|
+
|
|
72
|
+
const CommandEmpty = React.forwardRef<
|
|
73
|
+
React.ComponentRef<typeof CommandPrimitive.Empty>,
|
|
74
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
75
|
+
>((props, ref) => (
|
|
76
|
+
<CommandPrimitive.Empty
|
|
77
|
+
ref={ref}
|
|
78
|
+
className="py-8 text-center text-sm text-muted"
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
));
|
|
82
|
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
83
|
+
|
|
84
|
+
const CommandGroup = React.forwardRef<
|
|
85
|
+
React.ComponentRef<typeof CommandPrimitive.Group>,
|
|
86
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
87
|
+
>(({ className, ...props }, ref) => (
|
|
88
|
+
<CommandPrimitive.Group
|
|
89
|
+
ref={ref}
|
|
90
|
+
className={cn(
|
|
91
|
+
"overflow-hidden p-1.5 text-foreground [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-widest [&_[cmdk-group-heading]]:text-muted",
|
|
92
|
+
className,
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
));
|
|
97
|
+
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
98
|
+
|
|
99
|
+
const CommandSeparator = React.forwardRef<
|
|
100
|
+
React.ComponentRef<typeof CommandPrimitive.Separator>,
|
|
101
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
102
|
+
>(({ className, ...props }, ref) => (
|
|
103
|
+
<CommandPrimitive.Separator
|
|
104
|
+
ref={ref}
|
|
105
|
+
className={cn("-mx-1.5 h-px bg-separator", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
));
|
|
109
|
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
110
|
+
|
|
111
|
+
const CommandItem = React.forwardRef<
|
|
112
|
+
React.ComponentRef<typeof CommandPrimitive.Item>,
|
|
113
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
114
|
+
>(({ className, ...props }, ref) => (
|
|
115
|
+
<CommandPrimitive.Item
|
|
116
|
+
ref={ref}
|
|
117
|
+
className={cn(
|
|
118
|
+
"relative flex cursor-default gap-2 select-none items-center rounded-md px-2.5 py-2 text-sm outline-none transition-colors data-[disabled=true]:pointer-events-none data-[selected=true]:bg-surface-tertiary/80 data-[selected=true]:text-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
119
|
+
className,
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
));
|
|
124
|
+
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
125
|
+
|
|
126
|
+
function CommandShortcut({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}: React.HTMLAttributes<HTMLSpanElement>) {
|
|
130
|
+
return (
|
|
131
|
+
<span
|
|
132
|
+
className={cn("ml-auto text-xs tracking-wide text-muted/90", className)}
|
|
133
|
+
{...props}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export {
|
|
139
|
+
Command,
|
|
140
|
+
CommandDialog,
|
|
141
|
+
CommandInput,
|
|
142
|
+
CommandList,
|
|
143
|
+
CommandEmpty,
|
|
144
|
+
CommandGroup,
|
|
145
|
+
CommandItem,
|
|
146
|
+
CommandShortcut,
|
|
147
|
+
CommandSeparator,
|
|
148
|
+
};
|
package/src/ui/context-menu.tsx
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
3
|
-
import {
|
|
4
|
-
IconCheck,
|
|
5
|
-
IconChevronRight,
|
|
6
|
-
IconCircleFilled,
|
|
7
|
-
} from "@tabler/icons-react";
|
|
8
|
-
import { cn } from "../utils/cn";
|
|
9
|
-
import {
|
|
10
|
-
menuCheckboxRadioItemClass,
|
|
11
|
-
menuContentClass,
|
|
12
|
-
menuItemClass,
|
|
13
|
-
menuLabelClass,
|
|
14
|
-
menuSeparatorClass,
|
|
15
|
-
menuShortcutClass,
|
|
16
|
-
menuSubTriggerClass,
|
|
17
|
-
} from "./_menu-classes";
|
|
18
|
-
|
|
19
|
-
const ContextMenu = ContextMenuPrimitive.Root;
|
|
20
|
-
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
21
|
-
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
22
|
-
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
23
|
-
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
24
|
-
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
25
|
-
|
|
26
|
-
const ContextMenuSubTrigger = React.forwardRef<
|
|
27
|
-
React.ComponentRef<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(menuSubTriggerClass, inset && "pl-8", className)}
|
|
35
|
-
{...props}
|
|
36
|
-
>
|
|
37
|
-
{children}
|
|
38
|
-
<IconChevronRight className="ml-auto" />
|
|
39
|
-
</ContextMenuPrimitive.SubTrigger>
|
|
40
|
-
));
|
|
41
|
-
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
42
|
-
|
|
43
|
-
const ContextMenuSubContent = React.forwardRef<
|
|
44
|
-
React.ComponentRef<typeof ContextMenuPrimitive.SubContent>,
|
|
45
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
|
46
|
-
>(({ className, ...props }, ref) => (
|
|
47
|
-
<ContextMenuPrimitive.SubContent
|
|
48
|
-
ref={ref}
|
|
49
|
-
className={cn(menuContentClass, "w-40", className)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
));
|
|
53
|
-
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
54
|
-
|
|
55
|
-
const ContextMenuContent = React.forwardRef<
|
|
56
|
-
React.ComponentRef<typeof ContextMenuPrimitive.Content>,
|
|
57
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
|
58
|
-
>(({ className, ...props }, ref) => (
|
|
59
|
-
<ContextMenuPrimitive.Portal>
|
|
60
|
-
<ContextMenuPrimitive.Content
|
|
61
|
-
ref={ref}
|
|
62
|
-
className={cn(menuContentClass, "w-40", className)}
|
|
63
|
-
{...props}
|
|
64
|
-
/>
|
|
65
|
-
</ContextMenuPrimitive.Portal>
|
|
66
|
-
));
|
|
67
|
-
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
68
|
-
|
|
69
|
-
const ContextMenuItem = React.forwardRef<
|
|
70
|
-
React.ComponentRef<typeof ContextMenuPrimitive.Item>,
|
|
71
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
|
72
|
-
inset?: boolean;
|
|
73
|
-
}
|
|
74
|
-
>(({ className, inset, ...props }, ref) => (
|
|
75
|
-
<ContextMenuPrimitive.Item
|
|
76
|
-
ref={ref}
|
|
77
|
-
className={cn(menuItemClass, inset && "pl-8", className)}
|
|
78
|
-
{...props}
|
|
79
|
-
/>
|
|
80
|
-
));
|
|
81
|
-
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
82
|
-
|
|
83
|
-
const ContextMenuCheckboxItem = React.forwardRef<
|
|
84
|
-
React.ComponentRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
85
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
|
86
|
-
>(({ className, children, checked, ...props }, ref) => (
|
|
87
|
-
<ContextMenuPrimitive.CheckboxItem
|
|
88
|
-
ref={ref}
|
|
89
|
-
className={cn(menuCheckboxRadioItemClass, className)}
|
|
90
|
-
checked={checked}
|
|
91
|
-
{...props}
|
|
92
|
-
>
|
|
93
|
-
<span className="absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center">
|
|
94
|
-
<ContextMenuPrimitive.ItemIndicator>
|
|
95
|
-
<IconCheck className="h-4 w-4" />
|
|
96
|
-
</ContextMenuPrimitive.ItemIndicator>
|
|
97
|
-
</span>
|
|
98
|
-
{children}
|
|
99
|
-
</ContextMenuPrimitive.CheckboxItem>
|
|
100
|
-
));
|
|
101
|
-
ContextMenuCheckboxItem.displayName =
|
|
102
|
-
ContextMenuPrimitive.CheckboxItem.displayName;
|
|
103
|
-
|
|
104
|
-
const ContextMenuRadioItem = React.forwardRef<
|
|
105
|
-
React.ComponentRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
106
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
|
107
|
-
>(({ className, children, ...props }, ref) => (
|
|
108
|
-
<ContextMenuPrimitive.RadioItem
|
|
109
|
-
ref={ref}
|
|
110
|
-
className={cn(menuCheckboxRadioItemClass, className)}
|
|
111
|
-
{...props}
|
|
112
|
-
>
|
|
113
|
-
<span className="absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center">
|
|
114
|
-
<ContextMenuPrimitive.ItemIndicator>
|
|
115
|
-
<IconCircleFilled className="h-2 w-2 fill-current" />
|
|
116
|
-
</ContextMenuPrimitive.ItemIndicator>
|
|
117
|
-
</span>
|
|
118
|
-
{children}
|
|
119
|
-
</ContextMenuPrimitive.RadioItem>
|
|
120
|
-
));
|
|
121
|
-
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
122
|
-
|
|
123
|
-
const ContextMenuLabel = React.forwardRef<
|
|
124
|
-
React.ComponentRef<typeof ContextMenuPrimitive.Label>,
|
|
125
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
|
126
|
-
inset?: boolean;
|
|
127
|
-
}
|
|
128
|
-
>(({ className, inset, ...props }, ref) => (
|
|
129
|
-
<ContextMenuPrimitive.Label
|
|
130
|
-
ref={ref}
|
|
131
|
-
className={cn(menuLabelClass, inset && "pl-8", className)}
|
|
132
|
-
{...props}
|
|
133
|
-
/>
|
|
134
|
-
));
|
|
135
|
-
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
136
|
-
|
|
137
|
-
const ContextMenuSeparator = React.forwardRef<
|
|
138
|
-
React.ComponentRef<typeof ContextMenuPrimitive.Separator>,
|
|
139
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
|
140
|
-
>(({ className, ...props }, ref) => (
|
|
141
|
-
<ContextMenuPrimitive.Separator
|
|
142
|
-
ref={ref}
|
|
143
|
-
className={cn(menuSeparatorClass, className)}
|
|
144
|
-
{...props}
|
|
145
|
-
/>
|
|
146
|
-
));
|
|
147
|
-
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
148
|
-
|
|
149
|
-
const ContextMenuShortcut = ({
|
|
150
|
-
className,
|
|
151
|
-
...props
|
|
152
|
-
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
153
|
-
return <span className={cn(menuShortcutClass, className)} {...props} />;
|
|
154
|
-
};
|
|
155
|
-
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
156
|
-
|
|
157
|
-
export {
|
|
158
|
-
ContextMenu,
|
|
159
|
-
ContextMenuTrigger,
|
|
160
|
-
ContextMenuContent,
|
|
161
|
-
ContextMenuItem,
|
|
162
|
-
ContextMenuCheckboxItem,
|
|
163
|
-
ContextMenuRadioItem,
|
|
164
|
-
ContextMenuLabel,
|
|
165
|
-
ContextMenuSeparator,
|
|
166
|
-
ContextMenuShortcut,
|
|
167
|
-
ContextMenuGroup,
|
|
168
|
-
ContextMenuPortal,
|
|
169
|
-
ContextMenuSub,
|
|
170
|
-
ContextMenuSubContent,
|
|
171
|
-
ContextMenuSubTrigger,
|
|
172
|
-
ContextMenuRadioGroup,
|
|
173
|
-
};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
3
|
+
import {
|
|
4
|
+
IconCheck,
|
|
5
|
+
IconChevronRight,
|
|
6
|
+
IconCircleFilled,
|
|
7
|
+
} from "@tabler/icons-react";
|
|
8
|
+
import { cn } from "../utils/cn";
|
|
9
|
+
import {
|
|
10
|
+
menuCheckboxRadioItemClass,
|
|
11
|
+
menuContentClass,
|
|
12
|
+
menuItemClass,
|
|
13
|
+
menuLabelClass,
|
|
14
|
+
menuSeparatorClass,
|
|
15
|
+
menuShortcutClass,
|
|
16
|
+
menuSubTriggerClass,
|
|
17
|
+
} from "./_menu-classes";
|
|
18
|
+
|
|
19
|
+
const ContextMenu = ContextMenuPrimitive.Root;
|
|
20
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
21
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
22
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
23
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
24
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
25
|
+
|
|
26
|
+
const ContextMenuSubTrigger = React.forwardRef<
|
|
27
|
+
React.ComponentRef<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(menuSubTriggerClass, inset && "pl-8", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
<IconChevronRight className="ml-auto" />
|
|
39
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
40
|
+
));
|
|
41
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
42
|
+
|
|
43
|
+
const ContextMenuSubContent = React.forwardRef<
|
|
44
|
+
React.ComponentRef<typeof ContextMenuPrimitive.SubContent>,
|
|
45
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
|
46
|
+
>(({ className, ...props }, ref) => (
|
|
47
|
+
<ContextMenuPrimitive.SubContent
|
|
48
|
+
ref={ref}
|
|
49
|
+
className={cn(menuContentClass, "w-40", className)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
));
|
|
53
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
54
|
+
|
|
55
|
+
const ContextMenuContent = React.forwardRef<
|
|
56
|
+
React.ComponentRef<typeof ContextMenuPrimitive.Content>,
|
|
57
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
|
58
|
+
>(({ className, ...props }, ref) => (
|
|
59
|
+
<ContextMenuPrimitive.Portal>
|
|
60
|
+
<ContextMenuPrimitive.Content
|
|
61
|
+
ref={ref}
|
|
62
|
+
className={cn(menuContentClass, "w-40", className)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
</ContextMenuPrimitive.Portal>
|
|
66
|
+
));
|
|
67
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
68
|
+
|
|
69
|
+
const ContextMenuItem = React.forwardRef<
|
|
70
|
+
React.ComponentRef<typeof ContextMenuPrimitive.Item>,
|
|
71
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
|
72
|
+
inset?: boolean;
|
|
73
|
+
}
|
|
74
|
+
>(({ className, inset, ...props }, ref) => (
|
|
75
|
+
<ContextMenuPrimitive.Item
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn(menuItemClass, inset && "pl-8", className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
));
|
|
81
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
82
|
+
|
|
83
|
+
const ContextMenuCheckboxItem = React.forwardRef<
|
|
84
|
+
React.ComponentRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
85
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
|
86
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
87
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={cn(menuCheckboxRadioItemClass, className)}
|
|
90
|
+
checked={checked}
|
|
91
|
+
{...props}
|
|
92
|
+
>
|
|
93
|
+
<span className="absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center">
|
|
94
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
95
|
+
<IconCheck className="h-4 w-4" />
|
|
96
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
97
|
+
</span>
|
|
98
|
+
{children}
|
|
99
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
100
|
+
));
|
|
101
|
+
ContextMenuCheckboxItem.displayName =
|
|
102
|
+
ContextMenuPrimitive.CheckboxItem.displayName;
|
|
103
|
+
|
|
104
|
+
const ContextMenuRadioItem = React.forwardRef<
|
|
105
|
+
React.ComponentRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
106
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
|
107
|
+
>(({ className, children, ...props }, ref) => (
|
|
108
|
+
<ContextMenuPrimitive.RadioItem
|
|
109
|
+
ref={ref}
|
|
110
|
+
className={cn(menuCheckboxRadioItemClass, className)}
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
<span className="absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center">
|
|
114
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
115
|
+
<IconCircleFilled className="h-2 w-2 fill-current" />
|
|
116
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
117
|
+
</span>
|
|
118
|
+
{children}
|
|
119
|
+
</ContextMenuPrimitive.RadioItem>
|
|
120
|
+
));
|
|
121
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
122
|
+
|
|
123
|
+
const ContextMenuLabel = React.forwardRef<
|
|
124
|
+
React.ComponentRef<typeof ContextMenuPrimitive.Label>,
|
|
125
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
|
126
|
+
inset?: boolean;
|
|
127
|
+
}
|
|
128
|
+
>(({ className, inset, ...props }, ref) => (
|
|
129
|
+
<ContextMenuPrimitive.Label
|
|
130
|
+
ref={ref}
|
|
131
|
+
className={cn(menuLabelClass, inset && "pl-8", className)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
));
|
|
135
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
136
|
+
|
|
137
|
+
const ContextMenuSeparator = React.forwardRef<
|
|
138
|
+
React.ComponentRef<typeof ContextMenuPrimitive.Separator>,
|
|
139
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
|
140
|
+
>(({ className, ...props }, ref) => (
|
|
141
|
+
<ContextMenuPrimitive.Separator
|
|
142
|
+
ref={ref}
|
|
143
|
+
className={cn(menuSeparatorClass, className)}
|
|
144
|
+
{...props}
|
|
145
|
+
/>
|
|
146
|
+
));
|
|
147
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
148
|
+
|
|
149
|
+
const ContextMenuShortcut = ({
|
|
150
|
+
className,
|
|
151
|
+
...props
|
|
152
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
153
|
+
return <span className={cn(menuShortcutClass, className)} {...props} />;
|
|
154
|
+
};
|
|
155
|
+
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
156
|
+
|
|
157
|
+
export {
|
|
158
|
+
ContextMenu,
|
|
159
|
+
ContextMenuTrigger,
|
|
160
|
+
ContextMenuContent,
|
|
161
|
+
ContextMenuItem,
|
|
162
|
+
ContextMenuCheckboxItem,
|
|
163
|
+
ContextMenuRadioItem,
|
|
164
|
+
ContextMenuLabel,
|
|
165
|
+
ContextMenuSeparator,
|
|
166
|
+
ContextMenuShortcut,
|
|
167
|
+
ContextMenuGroup,
|
|
168
|
+
ContextMenuPortal,
|
|
169
|
+
ContextMenuSub,
|
|
170
|
+
ContextMenuSubContent,
|
|
171
|
+
ContextMenuSubTrigger,
|
|
172
|
+
ContextMenuRadioGroup,
|
|
173
|
+
};
|