@vvedantb/ui 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +124 -4
  3. package/src/ai-elements/artifact.tsx +99 -0
  4. package/src/ai-elements/attachments.tsx +366 -0
  5. package/src/ai-elements/chain-of-thought.tsx +212 -0
  6. package/src/ai-elements/code-block.tsx +478 -0
  7. package/src/ai-elements/conversation.tsx +157 -0
  8. package/src/ai-elements/image.tsx +25 -0
  9. package/src/ai-elements/inline-citation.tsx +252 -0
  10. package/src/ai-elements/message.tsx +269 -0
  11. package/src/ai-elements/model-selector.tsx +211 -0
  12. package/src/ai-elements/prompt-input.tsx +1018 -0
  13. package/src/ai-elements/queue.tsx +251 -0
  14. package/src/ai-elements/reasoning.tsx +178 -0
  15. package/src/ai-elements/shimmer.tsx +56 -0
  16. package/src/ai-elements/sources.tsx +77 -0
  17. package/src/ai-elements/speech-input.tsx +290 -0
  18. package/src/ai-elements/suggestion.tsx +191 -0
  19. package/src/css.d.ts +2 -0
  20. package/src/index.ts +96 -0
  21. package/src/motion/presets.ts +35 -0
  22. package/src/motion/presets.vibot.ts +105 -0
  23. package/src/ui/_menu-classes.ts +30 -0
  24. package/src/ui/_menu-classes.vibot.ts +33 -0
  25. package/src/ui/accordion.tsx +81 -0
  26. package/src/ui/accordion.verve.tsx +56 -0
  27. package/src/ui/badge.tsx +34 -0
  28. package/src/ui/breadcrumb.tsx +83 -0
  29. package/src/ui/button-group.tsx +84 -0
  30. package/src/ui/button.tsx +57 -0
  31. package/src/ui/card.tsx +27 -0
  32. package/src/ui/carousel.tsx +211 -0
  33. package/src/ui/checkbox.tsx +27 -0
  34. package/src/ui/clear-input.tsx +170 -0
  35. package/src/ui/clear-input.vibot.tsx +76 -0
  36. package/src/ui/clearInputDissolve.ts +214 -0
  37. package/src/ui/collapsible.tsx +7 -0
  38. package/src/ui/command.tsx +148 -0
  39. package/src/ui/context-menu.tsx +173 -0
  40. package/src/ui/dialog.tsx +149 -0
  41. package/src/ui/dropdown-menu.tsx +178 -0
  42. package/src/ui/hover-card.tsx +31 -0
  43. package/src/ui/input-group.tsx +162 -0
  44. package/src/ui/input-group.verve.tsx +150 -0
  45. package/src/ui/input.tsx +21 -0
  46. package/src/ui/kbd.tsx +18 -0
  47. package/src/ui/label.tsx +20 -0
  48. package/src/ui/labeled-switch-row.tsx +53 -0
  49. package/src/ui/modalTransition.ts +85 -0
  50. package/src/ui/pagination.tsx +47 -0
  51. package/src/ui/popover.tsx +33 -0
  52. package/src/ui/progress.tsx +25 -0
  53. package/src/ui/radix-select.tsx +202 -0
  54. package/src/ui/scroll-area.tsx +55 -0
  55. package/src/ui/scroll-area.verve.tsx +43 -0
  56. package/src/ui/search-input.tsx +29 -0
  57. package/src/ui/select.tsx +163 -0
  58. package/src/ui/separator.tsx +28 -0
  59. package/src/ui/sheet.tsx +87 -0
  60. package/src/ui/skeleton.tsx +18 -0
  61. package/src/ui/sonner.css +16 -0
  62. package/src/ui/sonner.tsx +47 -0
  63. package/src/ui/spinner.tsx +27 -0
  64. package/src/ui/surface-classes.ts +55 -0
  65. package/src/ui/switch.tsx +26 -0
  66. package/src/ui/table.tsx +123 -0
  67. package/src/ui/tabs.tsx +140 -0
  68. package/src/ui/tabsSliding.ts +56 -0
  69. package/src/ui/textarea.tsx +21 -0
  70. package/src/ui/time-picker.tsx +170 -0
  71. package/src/ui/tooltip.tsx +25 -0
  72. package/src/ui/visually-hidden.tsx +3 -0
  73. package/src/utils/cn.ts +16 -0
  74. package/src/utils/ref.ts +10 -0
  75. package/README.md +0 -3
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
3
+ import { cn } from "../utils/cn";
4
+ import {
5
+ floatingSurfaceAnimateClass,
6
+ floatingSurfaceClass,
7
+ } from "./_menu-classes";
8
+
9
+ const HoverCard = HoverCardPrimitive.Root;
10
+ const HoverCardTrigger = HoverCardPrimitive.Trigger;
11
+
12
+ const HoverCardContent = React.forwardRef<
13
+ React.ComponentRef<typeof HoverCardPrimitive.Content>,
14
+ React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
15
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
16
+ <HoverCardPrimitive.Content
17
+ ref={ref}
18
+ align={align}
19
+ sideOffset={sideOffset}
20
+ className={cn(
21
+ "z-50 w-72 max-sm:max-w-[calc(100vw-2rem)] max-sm:max-h-[85dvh] max-sm:overflow-y-auto p-4 outline-none",
22
+ floatingSurfaceClass,
23
+ floatingSurfaceAnimateClass,
24
+ className,
25
+ )}
26
+ {...props}
27
+ />
28
+ ));
29
+ HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
30
+
31
+ export { HoverCard, HoverCardTrigger, HoverCardContent };