@inbeat/ui 0.7.0

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 (56) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/package.json +100 -0
  3. package/src/components/alert-dialog.tsx +246 -0
  4. package/src/components/alert.tsx +66 -0
  5. package/src/components/app-nav.tsx +55 -0
  6. package/src/components/app-shell.tsx +95 -0
  7. package/src/components/avatar.tsx +73 -0
  8. package/src/components/badge.tsx +42 -0
  9. package/src/components/breadcrumb.tsx +109 -0
  10. package/src/components/button.tsx +75 -0
  11. package/src/components/calendar.tsx +220 -0
  12. package/src/components/carousel.tsx +83 -0
  13. package/src/components/checkbox.tsx +29 -0
  14. package/src/components/collapsible-section.tsx +88 -0
  15. package/src/components/combobox.tsx +351 -0
  16. package/src/components/data-table-shell.tsx +6 -0
  17. package/src/components/data-table-sortable-header.tsx +29 -0
  18. package/src/components/data-table.tsx +141 -0
  19. package/src/components/destructive-action-dialog.tsx +108 -0
  20. package/src/components/dialog.tsx +187 -0
  21. package/src/components/dropdown-menu.tsx +228 -0
  22. package/src/components/empty-state.tsx +55 -0
  23. package/src/components/field.tsx +248 -0
  24. package/src/components/icon-button.tsx +51 -0
  25. package/src/components/input-group.tsx +170 -0
  26. package/src/components/input.tsx +22 -0
  27. package/src/components/label.tsx +24 -0
  28. package/src/components/labeled-field.tsx +18 -0
  29. package/src/components/load-more-sentinel.tsx +12 -0
  30. package/src/components/member-avatar-stack.tsx +44 -0
  31. package/src/components/multi-select-popover.tsx +202 -0
  32. package/src/components/nav-user.tsx +71 -0
  33. package/src/components/number-dot.tsx +13 -0
  34. package/src/components/person-identity.tsx +52 -0
  35. package/src/components/platform-disclaimer.tsx +70 -0
  36. package/src/components/popover.tsx +92 -0
  37. package/src/components/portal-container.tsx +21 -0
  38. package/src/components/progress.tsx +23 -0
  39. package/src/components/search-input.tsx +57 -0
  40. package/src/components/select.tsx +232 -0
  41. package/src/components/separator.tsx +28 -0
  42. package/src/components/sheet.tsx +147 -0
  43. package/src/components/sidebar.tsx +471 -0
  44. package/src/components/skeleton.tsx +13 -0
  45. package/src/components/sonner.tsx +46 -0
  46. package/src/components/spinner.tsx +21 -0
  47. package/src/components/table.tsx +92 -0
  48. package/src/components/tabs.tsx +62 -0
  49. package/src/components/textarea.tsx +18 -0
  50. package/src/components/toggle-pills.tsx +32 -0
  51. package/src/components/tooltip.tsx +67 -0
  52. package/src/hooks/use-mobile.ts +21 -0
  53. package/src/lib/easing.ts +5 -0
  54. package/src/lib/initials.ts +12 -0
  55. package/src/lib/utils.ts +6 -0
  56. package/theme.css +141 -0
@@ -0,0 +1,108 @@
1
+ "use client";
2
+
3
+ import type { ReactNode } from "react";
4
+ import { useState } from "react";
5
+ import {
6
+ AlertDialog,
7
+ AlertDialogCancel,
8
+ AlertDialogContent,
9
+ AlertDialogDescription,
10
+ AlertDialogFooter,
11
+ AlertDialogHeader,
12
+ AlertDialogTitle,
13
+ } from "./alert-dialog";
14
+ import { Button } from "./button";
15
+ import { Input } from "./input";
16
+ import { Label } from "./label";
17
+
18
+ interface DestructiveActionDialogBaseProps {
19
+ open: boolean;
20
+ onOpenChange: (open: boolean) => void;
21
+ title: string;
22
+ description: ReactNode;
23
+ onConfirm: () => void;
24
+ isPending?: boolean;
25
+ cancelLabel?: string;
26
+ confirmLabel?: string;
27
+ pendingLabel?: string;
28
+ }
29
+
30
+ export type DestructiveActionDialogProps =
31
+ | (DestructiveActionDialogBaseProps & {
32
+ variant?: "simple";
33
+ resourceName?: never;
34
+ })
35
+ | (DestructiveActionDialogBaseProps & {
36
+ variant: "typed";
37
+ resourceName: string;
38
+ });
39
+
40
+ /**
41
+ * The confirm button does not close the dialog: the caller closes it through `onOpenChange`
42
+ * once the action succeeds, so a pending or failed action keeps it open.
43
+ */
44
+ export function DestructiveActionDialog({
45
+ open,
46
+ onOpenChange,
47
+ title,
48
+ description,
49
+ onConfirm,
50
+ isPending = false,
51
+ cancelLabel = "Cancel",
52
+ confirmLabel = "Delete",
53
+ pendingLabel = "Deleting...",
54
+ variant = "simple",
55
+ resourceName,
56
+ }: DestructiveActionDialogProps) {
57
+ const [typed, setTyped] = useState("");
58
+ const requiredPhrase = variant === "typed" ? `DELETE ${resourceName}` : "";
59
+ const canConfirm = !isPending && (variant === "simple" || typed === requiredPhrase);
60
+
61
+ function handleOpenChange(next: boolean) {
62
+ if (!next && isPending) return;
63
+ if (!next) setTyped("");
64
+ onOpenChange(next);
65
+ }
66
+
67
+ return (
68
+ <AlertDialog open={open} onOpenChange={handleOpenChange}>
69
+ <AlertDialogContent>
70
+ <AlertDialogHeader>
71
+ <AlertDialogTitle>{title}</AlertDialogTitle>
72
+ <AlertDialogDescription className="text-muted-foreground text-sm text-balance">
73
+ {description}
74
+ </AlertDialogDescription>
75
+ </AlertDialogHeader>
76
+ {variant === "typed" ? (
77
+ <div className="grid gap-3">
78
+ <div className="space-y-1.5">
79
+ <Label className="text-sm text-muted-foreground">
80
+ Type{" "}
81
+ <span className="font-mono font-semibold tracking-wide text-foreground">
82
+ {requiredPhrase}
83
+ </span>{" "}
84
+ to confirm
85
+ </Label>
86
+ <Input
87
+ autoCapitalize="off"
88
+ value={typed}
89
+ onChange={(e) => setTyped(e.target.value)}
90
+ placeholder={requiredPhrase}
91
+ autoComplete="off"
92
+ spellCheck={false}
93
+ className="text-foreground"
94
+ onPointerDown={(e) => e.stopPropagation()}
95
+ />
96
+ </div>
97
+ </div>
98
+ ) : null}
99
+ <AlertDialogFooter>
100
+ <AlertDialogCancel disabled={isPending}>{cancelLabel}</AlertDialogCancel>
101
+ <Button disabled={!canConfirm} onClick={onConfirm}>
102
+ {isPending ? pendingLabel : confirmLabel}
103
+ </Button>
104
+ </AlertDialogFooter>
105
+ </AlertDialogContent>
106
+ </AlertDialog>
107
+ );
108
+ }
@@ -0,0 +1,187 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { XIcon } from "lucide-react";
5
+ import { Dialog as DialogPrimitive } from "radix-ui";
6
+ import { AnimatePresence, motion } from "motion/react";
7
+
8
+ import { PortalContainerProvider } from "./portal-container";
9
+ import { cn } from "../lib/utils";
10
+ import { EASING_FUNCTION } from "../lib/easing";
11
+
12
+ const DialogOpenContext = React.createContext(false);
13
+
14
+ function Dialog({
15
+ open: controlledOpen,
16
+ defaultOpen,
17
+ onOpenChange,
18
+ ...props
19
+ }: React.ComponentProps<typeof DialogPrimitive.Root>) {
20
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(
21
+ defaultOpen ?? false
22
+ );
23
+ const isOpen = controlledOpen ?? uncontrolledOpen;
24
+
25
+ const handleOpenChange = (next: boolean) => {
26
+ setUncontrolledOpen(next);
27
+ onOpenChange?.(next);
28
+ };
29
+
30
+ return (
31
+ <DialogOpenContext.Provider value={isOpen}>
32
+ <DialogPrimitive.Root
33
+ data-slot="dialog"
34
+ open={isOpen}
35
+ onOpenChange={handleOpenChange}
36
+ {...props}
37
+ />
38
+ </DialogOpenContext.Provider>
39
+ );
40
+ }
41
+
42
+ function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
43
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
44
+ }
45
+
46
+ function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
47
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
48
+ }
49
+
50
+ function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
51
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
52
+ }
53
+
54
+ function DialogContent({
55
+ className,
56
+ children,
57
+ showCloseButton = true,
58
+ ...props
59
+ }: React.ComponentProps<typeof DialogPrimitive.Content> & {
60
+ showCloseButton?: boolean;
61
+ }) {
62
+ const isOpen = React.useContext(DialogOpenContext);
63
+ const [portalContainer, setPortalContainer] = React.useState<HTMLElement | null>(null);
64
+
65
+ return (
66
+ <DialogPortal data-slot="dialog-portal" forceMount>
67
+ {/* Overlay — separate AnimatePresence so it fades independently */}
68
+ <AnimatePresence>
69
+ {isOpen && (
70
+ <DialogPrimitive.Overlay data-slot="dialog-overlay" asChild forceMount>
71
+ <motion.div
72
+ initial={{ opacity: 0 }}
73
+ animate={{ opacity: 1 }}
74
+ exit={{ opacity: 0 }}
75
+ transition={{ duration: 0.15, ease: EASING_FUNCTION.dialog }}
76
+ style={{ willChange: "opacity" }}
77
+ className="fixed inset-0 z-50 bg-black/20 backdrop-blur-sm supports-backdrop-filter:backdrop-blur-sm"
78
+ />
79
+ </DialogPrimitive.Overlay>
80
+ )}
81
+ </AnimatePresence>
82
+
83
+ {/* Center with flex — avoid transform on the portal host (breaks Select/Popover positioning) */}
84
+ <AnimatePresence>
85
+ {isOpen && (
86
+ <DialogPrimitive.Content
87
+ data-slot="dialog-content"
88
+ forceMount
89
+ asChild
90
+ {...props}
91
+ >
92
+ <div className="fixed inset-0 z-50 flex items-center justify-center p-4 outline-none">
93
+ <div
94
+ ref={setPortalContainer}
95
+ className="pointer-events-none fixed inset-0 z-60 *:pointer-events-auto"
96
+ />
97
+ <motion.div
98
+ initial={{ opacity: 0 }}
99
+ animate={{ opacity: 1 }}
100
+ exit={{ opacity: 0 }}
101
+ transition={{ duration: 0.15, ease: EASING_FUNCTION.dialog }}
102
+ style={{ willChange: "opacity" }}
103
+ className={cn(
104
+ "bg-background relative grid w-full max-w-[calc(100%-2rem)] gap-4 overflow-hidden rounded-lg border p-6 shadow-lg sm:max-w-lg",
105
+ className,
106
+ )}
107
+ >
108
+ <PortalContainerProvider container={portalContainer}>
109
+ <div
110
+ data-slot="dialog-body"
111
+ className="flex h-full min-h-0 w-full min-w-0 flex-col gap-4"
112
+ >
113
+ {children}
114
+ </div>
115
+ {showCloseButton && (
116
+ <DialogPrimitive.Close
117
+ data-slot="dialog-close"
118
+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 z-10 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
119
+ >
120
+ <XIcon />
121
+ <span className="sr-only">Close</span>
122
+ </DialogPrimitive.Close>
123
+ )}
124
+ </PortalContainerProvider>
125
+ </motion.div>
126
+ </div>
127
+ </DialogPrimitive.Content>
128
+ )}
129
+ </AnimatePresence>
130
+ </DialogPortal>
131
+ );
132
+ }
133
+
134
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
135
+ return (
136
+ <div
137
+ data-slot="dialog-header"
138
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
139
+ {...props}
140
+ />
141
+ );
142
+ }
143
+
144
+ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
145
+ return (
146
+ <div
147
+ data-slot="dialog-footer"
148
+ className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
149
+ {...props}
150
+ />
151
+ );
152
+ }
153
+
154
+ function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
155
+ return (
156
+ <DialogPrimitive.Title
157
+ data-slot="dialog-title"
158
+ className={cn("text-lg leading-none font-semibold", className)}
159
+ {...props}
160
+ />
161
+ );
162
+ }
163
+
164
+ function DialogDescription({
165
+ className,
166
+ ...props
167
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
168
+ return (
169
+ <DialogPrimitive.Description
170
+ data-slot="dialog-description"
171
+ className={cn("text-muted-foreground text-sm", className)}
172
+ {...props}
173
+ />
174
+ );
175
+ }
176
+
177
+ export {
178
+ Dialog,
179
+ DialogClose,
180
+ DialogContent,
181
+ DialogDescription,
182
+ DialogFooter,
183
+ DialogHeader,
184
+ DialogPortal,
185
+ DialogTitle,
186
+ DialogTrigger,
187
+ };
@@ -0,0 +1,228 @@
1
+ "use client";
2
+
3
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
4
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
5
+ import type * as React from "react";
6
+
7
+ import { cn } from "../lib/utils";
8
+
9
+ function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
10
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
11
+ }
12
+
13
+ function DropdownMenuPortal({
14
+ ...props
15
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
16
+ return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
17
+ }
18
+
19
+ function DropdownMenuTrigger({
20
+ ...props
21
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
22
+ return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
23
+ }
24
+
25
+ function DropdownMenuContent({
26
+ className,
27
+ sideOffset = 4,
28
+ ...props
29
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
30
+ return (
31
+ <DropdownMenuPrimitive.Portal>
32
+ <DropdownMenuPrimitive.Content
33
+ data-slot="dropdown-menu-content"
34
+ sideOffset={sideOffset}
35
+ className={cn(
36
+ "bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
37
+ className,
38
+ )}
39
+ {...props}
40
+ />
41
+ </DropdownMenuPrimitive.Portal>
42
+ );
43
+ }
44
+
45
+ function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
46
+ return <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
47
+ }
48
+
49
+ function DropdownMenuItem({
50
+ className,
51
+ inset,
52
+ variant = "default",
53
+ ...props
54
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
55
+ inset?: boolean;
56
+ variant?: "default" | "destructive";
57
+ }) {
58
+ return (
59
+ <DropdownMenuPrimitive.Item
60
+ data-slot="dropdown-menu-item"
61
+ data-inset={inset}
62
+ data-variant={variant}
63
+ className={cn(
64
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
65
+ className,
66
+ )}
67
+ {...props}
68
+ />
69
+ );
70
+ }
71
+
72
+ function DropdownMenuCheckboxItem({
73
+ className,
74
+ children,
75
+ checked,
76
+ ...props
77
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
78
+ return (
79
+ <DropdownMenuPrimitive.CheckboxItem
80
+ data-slot="dropdown-menu-checkbox-item"
81
+ className={cn(
82
+ "focus:bg-accent focus:text-accent-foreground relative flex items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
83
+ className,
84
+ )}
85
+ checked={checked}
86
+ {...props}
87
+ >
88
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
89
+ <DropdownMenuPrimitive.ItemIndicator>
90
+ <CheckIcon className="size-4" />
91
+ </DropdownMenuPrimitive.ItemIndicator>
92
+ </span>
93
+ {children}
94
+ </DropdownMenuPrimitive.CheckboxItem>
95
+ );
96
+ }
97
+
98
+ function DropdownMenuRadioGroup({
99
+ ...props
100
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
101
+ return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
102
+ }
103
+
104
+ function DropdownMenuRadioItem({
105
+ className,
106
+ children,
107
+ ...props
108
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
109
+ return (
110
+ <DropdownMenuPrimitive.RadioItem
111
+ data-slot="dropdown-menu-radio-item"
112
+ className={cn(
113
+ "focus:bg-accent focus:text-accent-foreground relative flex items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
114
+ className,
115
+ )}
116
+ {...props}
117
+ >
118
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
119
+ <DropdownMenuPrimitive.ItemIndicator>
120
+ <CircleIcon className="size-2 fill-current" />
121
+ </DropdownMenuPrimitive.ItemIndicator>
122
+ </span>
123
+ {children}
124
+ </DropdownMenuPrimitive.RadioItem>
125
+ );
126
+ }
127
+
128
+ function DropdownMenuLabel({
129
+ className,
130
+ inset,
131
+ ...props
132
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
133
+ inset?: boolean;
134
+ }) {
135
+ return (
136
+ <DropdownMenuPrimitive.Label
137
+ data-slot="dropdown-menu-label"
138
+ data-inset={inset}
139
+ className={cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className)}
140
+ {...props}
141
+ />
142
+ );
143
+ }
144
+
145
+ function DropdownMenuSeparator({
146
+ className,
147
+ ...props
148
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
149
+ return (
150
+ <DropdownMenuPrimitive.Separator
151
+ data-slot="dropdown-menu-separator"
152
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
153
+ {...props}
154
+ />
155
+ );
156
+ }
157
+
158
+ function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) {
159
+ return (
160
+ <span
161
+ data-slot="dropdown-menu-shortcut"
162
+ className={cn("text-muted-foreground ml-auto text-xs tracking-widest", className)}
163
+ {...props}
164
+ />
165
+ );
166
+ }
167
+
168
+ function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
169
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
170
+ }
171
+
172
+ function DropdownMenuSubTrigger({
173
+ className,
174
+ inset,
175
+ children,
176
+ ...props
177
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
178
+ inset?: boolean;
179
+ }) {
180
+ return (
181
+ <DropdownMenuPrimitive.SubTrigger
182
+ data-slot="dropdown-menu-sub-trigger"
183
+ data-inset={inset}
184
+ className={cn(
185
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
186
+ className,
187
+ )}
188
+ {...props}
189
+ >
190
+ {children}
191
+ <ChevronRightIcon className="ml-auto size-4" />
192
+ </DropdownMenuPrimitive.SubTrigger>
193
+ );
194
+ }
195
+
196
+ function DropdownMenuSubContent({
197
+ className,
198
+ ...props
199
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
200
+ return (
201
+ <DropdownMenuPrimitive.SubContent
202
+ data-slot="dropdown-menu-sub-content"
203
+ className={cn(
204
+ "bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
205
+ className,
206
+ )}
207
+ {...props}
208
+ />
209
+ );
210
+ }
211
+
212
+ export {
213
+ DropdownMenu,
214
+ DropdownMenuPortal,
215
+ DropdownMenuTrigger,
216
+ DropdownMenuContent,
217
+ DropdownMenuGroup,
218
+ DropdownMenuLabel,
219
+ DropdownMenuItem,
220
+ DropdownMenuCheckboxItem,
221
+ DropdownMenuRadioGroup,
222
+ DropdownMenuRadioItem,
223
+ DropdownMenuSeparator,
224
+ DropdownMenuShortcut,
225
+ DropdownMenuSub,
226
+ DropdownMenuSubTrigger,
227
+ DropdownMenuSubContent,
228
+ };
@@ -0,0 +1,55 @@
1
+ import type { LucideIcon } from "lucide-react";
2
+ import type { ComponentProps } from "react";
3
+ import { cn } from "../lib/utils";
4
+ import { Button } from "./button";
5
+
6
+ export type EmptyStateProps = {
7
+ title: string;
8
+ description?: string;
9
+ icon?: LucideIcon;
10
+ action?: {
11
+ label: string;
12
+ onClick: () => void;
13
+ variant?: ComponentProps<typeof Button>["variant"];
14
+ icon?: LucideIcon;
15
+ disabled?: boolean;
16
+ };
17
+ className?: string;
18
+ };
19
+
20
+ export function EmptyState({ title, description, icon: Icon, action, className }: EmptyStateProps) {
21
+ const ActionIcon = action?.icon;
22
+
23
+ return (
24
+ <div
25
+ data-slot="empty-state"
26
+ className={cn(
27
+ "flex h-full min-h-0 w-full min-w-0 flex-1 flex-col items-center justify-center gap-2.5 rounded-xl border border-border px-6 py-12 text-center text-balance",
28
+ className,
29
+ )}
30
+ >
31
+ <div className="flex max-w-sm flex-col items-center gap-2">
32
+ {Icon ? (
33
+ <div className="mb-2 flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted">
34
+ <Icon className="size-4 text-muted-foreground" />
35
+ </div>
36
+ ) : null}
37
+ <div className="text-sm font-medium tracking-tight">{title}</div>
38
+ {description ? (
39
+ <p className="text-sm/relaxed text-muted-foreground">{description}</p>
40
+ ) : null}
41
+ </div>
42
+ {action ? (
43
+ <Button
44
+ size="sm"
45
+ variant={action.variant ?? "secondary"}
46
+ disabled={action.disabled}
47
+ onClick={action.onClick}
48
+ >
49
+ {ActionIcon ? <ActionIcon className="size-3.5" /> : null}
50
+ {action.label}
51
+ </Button>
52
+ ) : null}
53
+ </div>
54
+ );
55
+ }