@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/dialog.tsx
CHANGED
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
-
import { IconX } from "@tabler/icons-react";
|
|
4
|
-
import { cn } from "../utils/cn";
|
|
5
|
-
import { assignRef } from "../utils/ref";
|
|
6
|
-
import { connectModalSurface } from "./modalTransition";
|
|
7
|
-
|
|
8
|
-
const Dialog = DialogPrimitive.Root;
|
|
9
|
-
const DialogTrigger = DialogPrimitive.Trigger;
|
|
10
|
-
const DialogPortal = DialogPrimitive.Portal;
|
|
11
|
-
const DialogClose = DialogPrimitive.Close;
|
|
12
|
-
|
|
13
|
-
const DialogOverlay = React.forwardRef<
|
|
14
|
-
React.ComponentRef<typeof DialogPrimitive.Overlay>,
|
|
15
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
16
|
-
>(({ className, ...props }, ref) => (
|
|
17
|
-
<DialogPrimitive.Overlay
|
|
18
|
-
ref={ref}
|
|
19
|
-
className={cn(
|
|
20
|
-
"fixed inset-0 z-50 bg-backdrop backdrop-blur-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
21
|
-
className,
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
));
|
|
26
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
27
|
-
|
|
28
|
-
const DialogContent = React.forwardRef<
|
|
29
|
-
React.ComponentRef<typeof DialogPrimitive.Content>,
|
|
30
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
|
|
31
|
-
hideCloseButton?: boolean;
|
|
32
|
-
}
|
|
33
|
-
>(({ className, children, hideCloseButton, ...props }, ref) => {
|
|
34
|
-
const surfaceCleanupRef = React.useRef<(() => void) | null>(null);
|
|
35
|
-
|
|
36
|
-
const mergedRef = React.useCallback(
|
|
37
|
-
(node: HTMLDivElement | null) => {
|
|
38
|
-
if (surfaceCleanupRef.current) {
|
|
39
|
-
surfaceCleanupRef.current();
|
|
40
|
-
surfaceCleanupRef.current = null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (node) {
|
|
44
|
-
surfaceCleanupRef.current = connectModalSurface(node);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
assignRef(ref, node);
|
|
48
|
-
},
|
|
49
|
-
[ref],
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
React.useLayoutEffect(() => {
|
|
53
|
-
return () => {
|
|
54
|
-
surfaceCleanupRef.current?.();
|
|
55
|
-
surfaceCleanupRef.current = null;
|
|
56
|
-
};
|
|
57
|
-
}, []);
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<DialogPortal>
|
|
61
|
-
<DialogOverlay />
|
|
62
|
-
<DialogPrimitive.Content
|
|
63
|
-
ref={mergedRef}
|
|
64
|
-
className={cn(
|
|
65
|
-
"glass-panel-strong t-modal fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg max-sm:w-[calc(100vw-2rem)] max-h-[90dvh] gap-4 overflow-y-auto rounded-lg p-6 text-overlay-foreground smooth-shadow-ring-xl",
|
|
66
|
-
className,
|
|
67
|
-
)}
|
|
68
|
-
{...props}
|
|
69
|
-
>
|
|
70
|
-
{children}
|
|
71
|
-
{!hideCloseButton && (
|
|
72
|
-
<DialogPrimitive.Close className="absolute right-4 top-4 inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted transition-[background-color,transform] hover:bg-surface-tertiary/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:pointer-events-none before:absolute before:inset-[-4px] before:content-['']">
|
|
73
|
-
<IconX className="h-4 w-4" />
|
|
74
|
-
<span className="sr-only">Close</span>
|
|
75
|
-
</DialogPrimitive.Close>
|
|
76
|
-
)}
|
|
77
|
-
</DialogPrimitive.Content>
|
|
78
|
-
</DialogPortal>
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
82
|
-
|
|
83
|
-
const DialogHeader = ({
|
|
84
|
-
className,
|
|
85
|
-
...props
|
|
86
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
87
|
-
<div
|
|
88
|
-
className={cn("flex flex-col gap-1.5 text-center sm:text-left", className)}
|
|
89
|
-
{...props}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
DialogHeader.displayName = "DialogHeader";
|
|
93
|
-
|
|
94
|
-
const DialogFooter = ({
|
|
95
|
-
className,
|
|
96
|
-
...props
|
|
97
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
98
|
-
<div
|
|
99
|
-
className={cn(
|
|
100
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
101
|
-
className,
|
|
102
|
-
)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
DialogFooter.displayName = "DialogFooter";
|
|
107
|
-
|
|
108
|
-
const DialogTitle = React.forwardRef<
|
|
109
|
-
React.ComponentRef<typeof DialogPrimitive.Title>,
|
|
110
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
111
|
-
>(({ className, ...props }, ref) => (
|
|
112
|
-
<DialogPrimitive.Title
|
|
113
|
-
ref={ref}
|
|
114
|
-
className={cn(
|
|
115
|
-
"text-lg font-semibold tracking-normal text-foreground text-balance",
|
|
116
|
-
className,
|
|
117
|
-
)}
|
|
118
|
-
{...props}
|
|
119
|
-
/>
|
|
120
|
-
));
|
|
121
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
122
|
-
|
|
123
|
-
const DialogDescription = React.forwardRef<
|
|
124
|
-
React.ComponentRef<typeof DialogPrimitive.Description>,
|
|
125
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
126
|
-
>(({ className, ...props }, ref) => (
|
|
127
|
-
<DialogPrimitive.Description
|
|
128
|
-
ref={ref}
|
|
129
|
-
className={cn("text-sm leading-relaxed text-muted", className)}
|
|
130
|
-
{...props}
|
|
131
|
-
/>
|
|
132
|
-
));
|
|
133
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
134
|
-
|
|
135
|
-
const DialogRawContent = DialogPrimitive.Content;
|
|
136
|
-
|
|
137
|
-
export {
|
|
138
|
-
Dialog,
|
|
139
|
-
DialogPortal,
|
|
140
|
-
DialogOverlay,
|
|
141
|
-
DialogTrigger,
|
|
142
|
-
DialogClose,
|
|
143
|
-
DialogContent,
|
|
144
|
-
DialogRawContent,
|
|
145
|
-
DialogHeader,
|
|
146
|
-
DialogFooter,
|
|
147
|
-
DialogTitle,
|
|
148
|
-
DialogDescription,
|
|
149
|
-
};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
import { IconX } from "@tabler/icons-react";
|
|
4
|
+
import { cn } from "../utils/cn";
|
|
5
|
+
import { assignRef } from "../utils/ref";
|
|
6
|
+
import { connectModalSurface } from "./modalTransition";
|
|
7
|
+
|
|
8
|
+
const Dialog = DialogPrimitive.Root;
|
|
9
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
10
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
11
|
+
const DialogClose = DialogPrimitive.Close;
|
|
12
|
+
|
|
13
|
+
const DialogOverlay = React.forwardRef<
|
|
14
|
+
React.ComponentRef<typeof DialogPrimitive.Overlay>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
16
|
+
>(({ className, ...props }, ref) => (
|
|
17
|
+
<DialogPrimitive.Overlay
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"fixed inset-0 z-50 bg-backdrop backdrop-blur-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
));
|
|
26
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
27
|
+
|
|
28
|
+
const DialogContent = React.forwardRef<
|
|
29
|
+
React.ComponentRef<typeof DialogPrimitive.Content>,
|
|
30
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
|
|
31
|
+
hideCloseButton?: boolean;
|
|
32
|
+
}
|
|
33
|
+
>(({ className, children, hideCloseButton, ...props }, ref) => {
|
|
34
|
+
const surfaceCleanupRef = React.useRef<(() => void) | null>(null);
|
|
35
|
+
|
|
36
|
+
const mergedRef = React.useCallback(
|
|
37
|
+
(node: HTMLDivElement | null) => {
|
|
38
|
+
if (surfaceCleanupRef.current) {
|
|
39
|
+
surfaceCleanupRef.current();
|
|
40
|
+
surfaceCleanupRef.current = null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (node) {
|
|
44
|
+
surfaceCleanupRef.current = connectModalSurface(node);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
assignRef(ref, node);
|
|
48
|
+
},
|
|
49
|
+
[ref],
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
React.useLayoutEffect(() => {
|
|
53
|
+
return () => {
|
|
54
|
+
surfaceCleanupRef.current?.();
|
|
55
|
+
surfaceCleanupRef.current = null;
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<DialogPortal>
|
|
61
|
+
<DialogOverlay />
|
|
62
|
+
<DialogPrimitive.Content
|
|
63
|
+
ref={mergedRef}
|
|
64
|
+
className={cn(
|
|
65
|
+
"glass-panel-strong t-modal fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg max-sm:w-[calc(100vw-2rem)] max-h-[90dvh] gap-4 overflow-y-auto rounded-lg p-6 text-overlay-foreground smooth-shadow-ring-xl",
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
{!hideCloseButton && (
|
|
72
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted transition-[background-color,transform] hover:bg-surface-tertiary/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:pointer-events-none before:absolute before:inset-[-4px] before:content-['']">
|
|
73
|
+
<IconX className="h-4 w-4" />
|
|
74
|
+
<span className="sr-only">Close</span>
|
|
75
|
+
</DialogPrimitive.Close>
|
|
76
|
+
)}
|
|
77
|
+
</DialogPrimitive.Content>
|
|
78
|
+
</DialogPortal>
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
82
|
+
|
|
83
|
+
const DialogHeader = ({
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
87
|
+
<div
|
|
88
|
+
className={cn("flex flex-col gap-1.5 text-center sm:text-left", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
DialogHeader.displayName = "DialogHeader";
|
|
93
|
+
|
|
94
|
+
const DialogFooter = ({
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
98
|
+
<div
|
|
99
|
+
className={cn(
|
|
100
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
DialogFooter.displayName = "DialogFooter";
|
|
107
|
+
|
|
108
|
+
const DialogTitle = React.forwardRef<
|
|
109
|
+
React.ComponentRef<typeof DialogPrimitive.Title>,
|
|
110
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
111
|
+
>(({ className, ...props }, ref) => (
|
|
112
|
+
<DialogPrimitive.Title
|
|
113
|
+
ref={ref}
|
|
114
|
+
className={cn(
|
|
115
|
+
"text-lg font-semibold tracking-normal text-foreground text-balance",
|
|
116
|
+
className,
|
|
117
|
+
)}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
));
|
|
121
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
122
|
+
|
|
123
|
+
const DialogDescription = React.forwardRef<
|
|
124
|
+
React.ComponentRef<typeof DialogPrimitive.Description>,
|
|
125
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
126
|
+
>(({ className, ...props }, ref) => (
|
|
127
|
+
<DialogPrimitive.Description
|
|
128
|
+
ref={ref}
|
|
129
|
+
className={cn("text-sm leading-relaxed text-muted", className)}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
));
|
|
133
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
134
|
+
|
|
135
|
+
const DialogRawContent = DialogPrimitive.Content;
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
Dialog,
|
|
139
|
+
DialogPortal,
|
|
140
|
+
DialogOverlay,
|
|
141
|
+
DialogTrigger,
|
|
142
|
+
DialogClose,
|
|
143
|
+
DialogContent,
|
|
144
|
+
DialogRawContent,
|
|
145
|
+
DialogHeader,
|
|
146
|
+
DialogFooter,
|
|
147
|
+
DialogTitle,
|
|
148
|
+
DialogDescription,
|
|
149
|
+
};
|
package/src/ui/dropdown-menu.tsx
CHANGED
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-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 DropdownMenu = DropdownMenuPrimitive.Root;
|
|
20
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
21
|
-
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
22
|
-
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
23
|
-
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
24
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
25
|
-
|
|
26
|
-
const DropdownMenuSubTrigger = React.forwardRef<
|
|
27
|
-
React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
28
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
29
|
-
inset?: boolean;
|
|
30
|
-
}
|
|
31
|
-
>(({ className, inset, children, ...props }, ref) => (
|
|
32
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
33
|
-
ref={ref}
|
|
34
|
-
className={cn(menuSubTriggerClass, inset && "pl-8", className)}
|
|
35
|
-
{...props}
|
|
36
|
-
>
|
|
37
|
-
{children}
|
|
38
|
-
<IconChevronRight className="ml-auto" />
|
|
39
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
40
|
-
));
|
|
41
|
-
DropdownMenuSubTrigger.displayName =
|
|
42
|
-
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
43
|
-
|
|
44
|
-
const DropdownMenuSubContent = React.forwardRef<
|
|
45
|
-
React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
46
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
47
|
-
>(({ className, ...props }, ref) => (
|
|
48
|
-
<DropdownMenuPrimitive.Portal>
|
|
49
|
-
<DropdownMenuPrimitive.SubContent
|
|
50
|
-
ref={ref}
|
|
51
|
-
className={cn(menuContentClass, className)}
|
|
52
|
-
{...props}
|
|
53
|
-
/>
|
|
54
|
-
</DropdownMenuPrimitive.Portal>
|
|
55
|
-
));
|
|
56
|
-
DropdownMenuSubContent.displayName =
|
|
57
|
-
DropdownMenuPrimitive.SubContent.displayName;
|
|
58
|
-
|
|
59
|
-
const DropdownMenuContent = React.forwardRef<
|
|
60
|
-
React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
|
|
61
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
62
|
-
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
63
|
-
<DropdownMenuPrimitive.Portal>
|
|
64
|
-
<DropdownMenuPrimitive.Content
|
|
65
|
-
ref={ref}
|
|
66
|
-
sideOffset={sideOffset}
|
|
67
|
-
className={cn(menuContentClass, className)}
|
|
68
|
-
{...props}
|
|
69
|
-
/>
|
|
70
|
-
</DropdownMenuPrimitive.Portal>
|
|
71
|
-
));
|
|
72
|
-
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
73
|
-
|
|
74
|
-
const DropdownMenuItem = React.forwardRef<
|
|
75
|
-
React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
|
|
76
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
77
|
-
inset?: boolean;
|
|
78
|
-
}
|
|
79
|
-
>(({ className, inset, ...props }, ref) => (
|
|
80
|
-
<DropdownMenuPrimitive.Item
|
|
81
|
-
ref={ref}
|
|
82
|
-
className={cn(menuItemClass, inset && "pl-8", className)}
|
|
83
|
-
{...props}
|
|
84
|
-
/>
|
|
85
|
-
));
|
|
86
|
-
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
87
|
-
|
|
88
|
-
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
89
|
-
React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
90
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
91
|
-
>(({ className, children, checked, ...props }, ref) => (
|
|
92
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
93
|
-
ref={ref}
|
|
94
|
-
className={cn(menuCheckboxRadioItemClass, className)}
|
|
95
|
-
checked={checked}
|
|
96
|
-
{...props}
|
|
97
|
-
>
|
|
98
|
-
<span className="absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center">
|
|
99
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
100
|
-
<IconCheck className="h-4 w-4" />
|
|
101
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
102
|
-
</span>
|
|
103
|
-
{children}
|
|
104
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
105
|
-
));
|
|
106
|
-
DropdownMenuCheckboxItem.displayName =
|
|
107
|
-
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
108
|
-
|
|
109
|
-
const DropdownMenuRadioItem = React.forwardRef<
|
|
110
|
-
React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
111
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
112
|
-
>(({ className, children, ...props }, ref) => (
|
|
113
|
-
<DropdownMenuPrimitive.RadioItem
|
|
114
|
-
ref={ref}
|
|
115
|
-
className={cn(menuCheckboxRadioItemClass, className)}
|
|
116
|
-
{...props}
|
|
117
|
-
>
|
|
118
|
-
<span className="absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center">
|
|
119
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
120
|
-
<IconCircleFilled className="h-2 w-2 fill-current" />
|
|
121
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
122
|
-
</span>
|
|
123
|
-
{children}
|
|
124
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
125
|
-
));
|
|
126
|
-
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
127
|
-
|
|
128
|
-
const DropdownMenuLabel = React.forwardRef<
|
|
129
|
-
React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
|
|
130
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
131
|
-
inset?: boolean;
|
|
132
|
-
}
|
|
133
|
-
>(({ className, inset, ...props }, ref) => (
|
|
134
|
-
<DropdownMenuPrimitive.Label
|
|
135
|
-
ref={ref}
|
|
136
|
-
className={cn(menuLabelClass, inset && "pl-8", className)}
|
|
137
|
-
{...props}
|
|
138
|
-
/>
|
|
139
|
-
));
|
|
140
|
-
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
141
|
-
|
|
142
|
-
const DropdownMenuSeparator = React.forwardRef<
|
|
143
|
-
React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
|
|
144
|
-
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
145
|
-
>(({ className, ...props }, ref) => (
|
|
146
|
-
<DropdownMenuPrimitive.Separator
|
|
147
|
-
ref={ref}
|
|
148
|
-
className={cn(menuSeparatorClass, className)}
|
|
149
|
-
{...props}
|
|
150
|
-
/>
|
|
151
|
-
));
|
|
152
|
-
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
153
|
-
|
|
154
|
-
const DropdownMenuShortcut = ({
|
|
155
|
-
className,
|
|
156
|
-
...props
|
|
157
|
-
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
158
|
-
return <span className={cn(menuShortcutClass, className)} {...props} />;
|
|
159
|
-
};
|
|
160
|
-
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
161
|
-
|
|
162
|
-
export {
|
|
163
|
-
DropdownMenu,
|
|
164
|
-
DropdownMenuTrigger,
|
|
165
|
-
DropdownMenuContent,
|
|
166
|
-
DropdownMenuItem,
|
|
167
|
-
DropdownMenuCheckboxItem,
|
|
168
|
-
DropdownMenuRadioItem,
|
|
169
|
-
DropdownMenuLabel,
|
|
170
|
-
DropdownMenuSeparator,
|
|
171
|
-
DropdownMenuShortcut,
|
|
172
|
-
DropdownMenuGroup,
|
|
173
|
-
DropdownMenuPortal,
|
|
174
|
-
DropdownMenuSub,
|
|
175
|
-
DropdownMenuSubContent,
|
|
176
|
-
DropdownMenuSubTrigger,
|
|
177
|
-
DropdownMenuRadioGroup,
|
|
178
|
-
};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-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 DropdownMenu = DropdownMenuPrimitive.Root;
|
|
20
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
21
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
22
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
23
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
24
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
25
|
+
|
|
26
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
27
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
29
|
+
inset?: boolean;
|
|
30
|
+
}
|
|
31
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
32
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={cn(menuSubTriggerClass, inset && "pl-8", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
<IconChevronRight className="ml-auto" />
|
|
39
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
40
|
+
));
|
|
41
|
+
DropdownMenuSubTrigger.displayName =
|
|
42
|
+
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
43
|
+
|
|
44
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
45
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
46
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
47
|
+
>(({ className, ...props }, ref) => (
|
|
48
|
+
<DropdownMenuPrimitive.Portal>
|
|
49
|
+
<DropdownMenuPrimitive.SubContent
|
|
50
|
+
ref={ref}
|
|
51
|
+
className={cn(menuContentClass, className)}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
</DropdownMenuPrimitive.Portal>
|
|
55
|
+
));
|
|
56
|
+
DropdownMenuSubContent.displayName =
|
|
57
|
+
DropdownMenuPrimitive.SubContent.displayName;
|
|
58
|
+
|
|
59
|
+
const DropdownMenuContent = React.forwardRef<
|
|
60
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
|
|
61
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
62
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
63
|
+
<DropdownMenuPrimitive.Portal>
|
|
64
|
+
<DropdownMenuPrimitive.Content
|
|
65
|
+
ref={ref}
|
|
66
|
+
sideOffset={sideOffset}
|
|
67
|
+
className={cn(menuContentClass, className)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
</DropdownMenuPrimitive.Portal>
|
|
71
|
+
));
|
|
72
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
73
|
+
|
|
74
|
+
const DropdownMenuItem = React.forwardRef<
|
|
75
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
|
|
76
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
77
|
+
inset?: boolean;
|
|
78
|
+
}
|
|
79
|
+
>(({ className, inset, ...props }, ref) => (
|
|
80
|
+
<DropdownMenuPrimitive.Item
|
|
81
|
+
ref={ref}
|
|
82
|
+
className={cn(menuItemClass, inset && "pl-8", className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
));
|
|
86
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
87
|
+
|
|
88
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
89
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
91
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
92
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
93
|
+
ref={ref}
|
|
94
|
+
className={cn(menuCheckboxRadioItemClass, className)}
|
|
95
|
+
checked={checked}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
<span className="absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center">
|
|
99
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
100
|
+
<IconCheck className="h-4 w-4" />
|
|
101
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
102
|
+
</span>
|
|
103
|
+
{children}
|
|
104
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
105
|
+
));
|
|
106
|
+
DropdownMenuCheckboxItem.displayName =
|
|
107
|
+
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
108
|
+
|
|
109
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
110
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
111
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
112
|
+
>(({ className, children, ...props }, ref) => (
|
|
113
|
+
<DropdownMenuPrimitive.RadioItem
|
|
114
|
+
ref={ref}
|
|
115
|
+
className={cn(menuCheckboxRadioItemClass, className)}
|
|
116
|
+
{...props}
|
|
117
|
+
>
|
|
118
|
+
<span className="absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center">
|
|
119
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
120
|
+
<IconCircleFilled className="h-2 w-2 fill-current" />
|
|
121
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
122
|
+
</span>
|
|
123
|
+
{children}
|
|
124
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
125
|
+
));
|
|
126
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
127
|
+
|
|
128
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
129
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
|
|
130
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
131
|
+
inset?: boolean;
|
|
132
|
+
}
|
|
133
|
+
>(({ className, inset, ...props }, ref) => (
|
|
134
|
+
<DropdownMenuPrimitive.Label
|
|
135
|
+
ref={ref}
|
|
136
|
+
className={cn(menuLabelClass, inset && "pl-8", className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
));
|
|
140
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
141
|
+
|
|
142
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
143
|
+
React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
|
|
144
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
145
|
+
>(({ className, ...props }, ref) => (
|
|
146
|
+
<DropdownMenuPrimitive.Separator
|
|
147
|
+
ref={ref}
|
|
148
|
+
className={cn(menuSeparatorClass, className)}
|
|
149
|
+
{...props}
|
|
150
|
+
/>
|
|
151
|
+
));
|
|
152
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
153
|
+
|
|
154
|
+
const DropdownMenuShortcut = ({
|
|
155
|
+
className,
|
|
156
|
+
...props
|
|
157
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
158
|
+
return <span className={cn(menuShortcutClass, className)} {...props} />;
|
|
159
|
+
};
|
|
160
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
161
|
+
|
|
162
|
+
export {
|
|
163
|
+
DropdownMenu,
|
|
164
|
+
DropdownMenuTrigger,
|
|
165
|
+
DropdownMenuContent,
|
|
166
|
+
DropdownMenuItem,
|
|
167
|
+
DropdownMenuCheckboxItem,
|
|
168
|
+
DropdownMenuRadioItem,
|
|
169
|
+
DropdownMenuLabel,
|
|
170
|
+
DropdownMenuSeparator,
|
|
171
|
+
DropdownMenuShortcut,
|
|
172
|
+
DropdownMenuGroup,
|
|
173
|
+
DropdownMenuPortal,
|
|
174
|
+
DropdownMenuSub,
|
|
175
|
+
DropdownMenuSubContent,
|
|
176
|
+
DropdownMenuSubTrigger,
|
|
177
|
+
DropdownMenuRadioGroup,
|
|
178
|
+
};
|