@elizaos/ui 2.0.0-alpha.73 → 2.0.0-alpha.76

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 (171) hide show
  1. package/components/ui/badge.d.ts +10 -0
  2. package/components/ui/badge.d.ts.map +1 -0
  3. package/components/ui/badge.js +20 -0
  4. package/components/ui/banner.d.ts +18 -0
  5. package/components/ui/banner.d.ts.map +1 -0
  6. package/components/ui/banner.js +27 -0
  7. package/components/ui/button.d.ts +12 -0
  8. package/components/ui/button.d.ts.map +1 -0
  9. package/components/ui/button.js +37 -0
  10. package/components/ui/card.d.ts +9 -0
  11. package/components/ui/card.d.ts.map +1 -0
  12. package/components/ui/card.js +16 -0
  13. package/components/ui/chat-atoms.d.ts +26 -0
  14. package/components/ui/chat-atoms.d.ts.map +1 -0
  15. package/components/ui/chat-atoms.js +17 -0
  16. package/components/ui/checkbox.d.ts +5 -0
  17. package/components/ui/checkbox.d.ts.map +1 -0
  18. package/components/ui/checkbox.js +8 -0
  19. package/components/ui/confirm-delete.d.ts +12 -0
  20. package/components/ui/confirm-delete.d.ts.map +1 -0
  21. package/components/ui/confirm-delete.js +13 -0
  22. package/components/ui/confirm-dialog.d.ts +24 -0
  23. package/components/ui/confirm-dialog.d.ts.map +1 -0
  24. package/components/ui/confirm-dialog.js +55 -0
  25. package/components/ui/connection-status.d.ts +9 -0
  26. package/components/ui/connection-status.d.ts.map +1 -0
  27. package/components/ui/connection-status.js +25 -0
  28. package/components/ui/copy-button.d.ts +13 -0
  29. package/components/ui/copy-button.d.ts.map +1 -0
  30. package/components/ui/copy-button.js +14 -0
  31. package/components/ui/dialog.d.ts +20 -0
  32. package/components/ui/dialog.d.ts.map +1 -0
  33. package/components/ui/dialog.js +22 -0
  34. package/components/ui/dropdown-menu.d.ts +28 -0
  35. package/components/ui/dropdown-menu.d.ts.map +1 -0
  36. package/components/ui/dropdown-menu.js +35 -0
  37. package/components/ui/empty-state.d.ts +13 -0
  38. package/components/ui/empty-state.d.ts.map +1 -0
  39. package/components/ui/empty-state.js +5 -0
  40. package/components/ui/error-boundary.d.ts +18 -0
  41. package/components/ui/error-boundary.d.ts.map +1 -0
  42. package/components/ui/error-boundary.js +27 -0
  43. package/components/ui/grid.d.ts +11 -0
  44. package/components/ui/grid.d.ts.map +1 -0
  45. package/components/ui/grid.js +30 -0
  46. package/components/ui/input.d.ts +6 -0
  47. package/components/ui/input.d.ts.map +1 -0
  48. package/components/ui/input.js +8 -0
  49. package/components/ui/label.d.ts +6 -0
  50. package/components/ui/label.d.ts.map +1 -0
  51. package/components/ui/label.js +9 -0
  52. package/components/ui/popover.d.ts +7 -0
  53. package/components/ui/popover.d.ts.map +1 -0
  54. package/components/ui/popover.js +9 -0
  55. package/components/ui/save-footer.d.ts +13 -0
  56. package/components/ui/save-footer.d.ts.map +1 -0
  57. package/components/ui/save-footer.js +9 -0
  58. package/components/ui/search-bar.d.ts +17 -0
  59. package/components/ui/search-bar.d.ts.map +1 -0
  60. package/components/ui/search-bar.js +19 -0
  61. package/components/ui/search-input.d.ts +11 -0
  62. package/components/ui/search-input.d.ts.map +1 -0
  63. package/components/ui/search-input.js +9 -0
  64. package/components/ui/section-card.d.ts +15 -0
  65. package/components/ui/section-card.d.ts.map +1 -0
  66. package/components/ui/section-card.js +9 -0
  67. package/components/ui/select.d.ts +14 -0
  68. package/components/ui/select.d.ts.map +1 -0
  69. package/components/ui/select.js +26 -0
  70. package/components/ui/separator.d.ts +5 -0
  71. package/components/ui/separator.d.ts.map +1 -0
  72. package/components/ui/separator.js +7 -0
  73. package/components/ui/skeleton.d.ts +17 -0
  74. package/components/ui/skeleton.d.ts.map +1 -0
  75. package/components/ui/skeleton.js +25 -0
  76. package/components/ui/slider.d.ts +5 -0
  77. package/components/ui/slider.d.ts.map +1 -0
  78. package/components/ui/slider.js +7 -0
  79. package/components/ui/sonner.d.ts +5 -0
  80. package/components/ui/sonner.d.ts.map +1 -0
  81. package/components/ui/sonner.js +15 -0
  82. package/components/ui/spinner.d.ts +6 -0
  83. package/components/ui/spinner.d.ts.map +1 -0
  84. package/components/ui/spinner.js +8 -0
  85. package/components/ui/stack.d.ts +13 -0
  86. package/components/ui/stack.d.ts.map +1 -0
  87. package/components/ui/stack.js +39 -0
  88. package/components/ui/status-badge.d.ts +20 -0
  89. package/components/ui/status-badge.d.ts.map +1 -0
  90. package/components/ui/status-badge.js +41 -0
  91. package/components/ui/switch.d.ts +5 -0
  92. package/components/ui/switch.d.ts.map +1 -0
  93. package/components/ui/switch.js +7 -0
  94. package/components/ui/tabs.d.ts +8 -0
  95. package/components/ui/tabs.d.ts.map +1 -0
  96. package/components/ui/tabs.js +12 -0
  97. package/components/ui/tag-editor.d.ts +24 -0
  98. package/components/ui/tag-editor.d.ts.map +1 -0
  99. package/components/ui/tag-editor.js +32 -0
  100. package/components/ui/tag-input.d.ts +19 -0
  101. package/components/ui/tag-input.d.ts.map +1 -0
  102. package/components/ui/tag-input.js +28 -0
  103. package/components/ui/textarea.d.ts +6 -0
  104. package/components/ui/textarea.d.ts.map +1 -0
  105. package/components/ui/textarea.js +8 -0
  106. package/components/ui/themed-select.d.ts +27 -0
  107. package/components/ui/themed-select.d.ts.map +1 -0
  108. package/components/ui/themed-select.js +57 -0
  109. package/components/ui/tooltip-extended.d.ts +76 -0
  110. package/components/ui/tooltip-extended.d.ts.map +1 -0
  111. package/components/ui/tooltip-extended.js +128 -0
  112. package/components/ui/tooltip.d.ts +8 -0
  113. package/components/ui/tooltip.d.ts.map +1 -0
  114. package/components/ui/tooltip.js +10 -0
  115. package/components/ui/typography.d.ts +17 -0
  116. package/components/ui/typography.d.ts.map +1 -0
  117. package/components/ui/typography.js +44 -0
  118. package/index.d.ts +42 -0
  119. package/index.d.ts.map +1 -0
  120. package/{src/index.ts → index.js} +0 -1
  121. package/lib/button-styles.d.ts +12 -0
  122. package/lib/button-styles.d.ts.map +1 -0
  123. package/lib/button-styles.js +11 -0
  124. package/lib/utils.d.ts +6 -0
  125. package/lib/utils.d.ts.map +1 -0
  126. package/{src/lib/utils.ts → lib/utils.js} +3 -4
  127. package/package.json +16 -18
  128. package/README.md +0 -6
  129. package/src/components/ui/badge.tsx +0 -35
  130. package/src/components/ui/banner.tsx +0 -81
  131. package/src/components/ui/button.tsx +0 -56
  132. package/src/components/ui/card.tsx +0 -79
  133. package/src/components/ui/chat-atoms.tsx +0 -129
  134. package/src/components/ui/checkbox.tsx +0 -28
  135. package/src/components/ui/confirm-delete.tsx +0 -67
  136. package/src/components/ui/confirm-dialog.tsx +0 -142
  137. package/src/components/ui/connection-status.tsx +0 -54
  138. package/src/components/ui/copy-button.tsx +0 -60
  139. package/src/components/ui/dialog.tsx +0 -120
  140. package/src/components/ui/dropdown-menu.tsx +0 -198
  141. package/src/components/ui/empty-state.tsx +0 -42
  142. package/src/components/ui/error-boundary.tsx +0 -63
  143. package/src/components/ui/grid.tsx +0 -43
  144. package/src/components/ui/input.tsx +0 -25
  145. package/src/components/ui/label.tsx +0 -24
  146. package/src/components/ui/popover.tsx +0 -29
  147. package/src/components/ui/save-footer.tsx +0 -58
  148. package/src/components/ui/search-bar.tsx +0 -61
  149. package/src/components/ui/search-input.tsx +0 -56
  150. package/src/components/ui/section-card.tsx +0 -85
  151. package/src/components/ui/select.tsx +0 -158
  152. package/src/components/ui/separator.tsx +0 -29
  153. package/src/components/ui/skeleton.tsx +0 -115
  154. package/src/components/ui/slider.tsx +0 -26
  155. package/src/components/ui/sonner.tsx +0 -28
  156. package/src/components/ui/spinner.tsx +0 -21
  157. package/src/components/ui/stack.tsx +0 -55
  158. package/src/components/ui/status-badge.tsx +0 -128
  159. package/src/components/ui/switch.tsx +0 -27
  160. package/src/components/ui/tabs.tsx +0 -53
  161. package/src/components/ui/tag-editor.tsx +0 -111
  162. package/src/components/ui/tag-input.tsx +0 -108
  163. package/src/components/ui/textarea.tsx +0 -24
  164. package/src/components/ui/themed-select.tsx +0 -141
  165. package/src/components/ui/tooltip-extended.tsx +0 -340
  166. package/src/components/ui/tooltip.tsx +0 -28
  167. package/src/components/ui/typography.tsx +0 -74
  168. package/src/lib/button-styles.ts +0 -19
  169. package/tsconfig.build.json +0 -18
  170. package/tsconfig.json +0 -32
  171. /package/{src/styles → styles}/theme.css +0 -0
@@ -1,142 +0,0 @@
1
- import * as React from "react";
2
- import { cn } from "../../lib/utils";
3
-
4
- /* ── ConfirmDialog ───────────────────────────────────────────────────── */
5
-
6
- export type ConfirmTone = "danger" | "warn" | "default";
7
-
8
- export interface ConfirmDialogProps {
9
- open: boolean;
10
- title?: string;
11
- message: string;
12
- confirmLabel?: string;
13
- cancelLabel?: string;
14
- tone?: ConfirmTone;
15
- onConfirm: () => void;
16
- onCancel: () => void;
17
- }
18
-
19
- const TONE_STYLES: Record<ConfirmTone, string> = {
20
- danger: "bg-destructive text-destructive-fg hover:opacity-90",
21
- warn: "bg-warn text-white hover:opacity-90",
22
- default: "bg-primary text-primary-fg hover:opacity-90",
23
- };
24
-
25
- export function ConfirmDialog({
26
- open,
27
- title = "Confirm",
28
- message,
29
- confirmLabel = "Confirm",
30
- cancelLabel = "Cancel",
31
- tone = "default",
32
- onConfirm,
33
- onCancel,
34
- }: ConfirmDialogProps) {
35
- const confirmRef = React.useRef<HTMLButtonElement>(null);
36
-
37
- React.useEffect(() => {
38
- if (open) {
39
- const t = setTimeout(() => confirmRef.current?.focus(), 50);
40
- return () => clearTimeout(t);
41
- }
42
- }, [open]);
43
-
44
- const handleKeyDown = React.useCallback(
45
- (e: React.KeyboardEvent) => {
46
- if (e.key === "Escape") {
47
- e.preventDefault();
48
- onCancel();
49
- }
50
- },
51
- [onCancel],
52
- );
53
-
54
- if (!open) return null;
55
-
56
- return (
57
- <div
58
- className="fixed inset-0 flex items-center justify-center bg-black/40"
59
- style={{ zIndex: 10001 }}
60
- onClick={(e) => {
61
- if (e.target === e.currentTarget) onCancel();
62
- }}
63
- onKeyDown={handleKeyDown}
64
- role="dialog"
65
- aria-modal="true"
66
- aria-label={title}
67
- tabIndex={-1}
68
- >
69
- <div className="mx-4 w-full max-w-md rounded-lg border border-border bg-bg p-6 shadow-2xl">
70
- <h2 className="mb-3 text-base font-bold">{title}</h2>
71
- <p className="mb-6 whitespace-pre-line text-sm text-muted">{message}</p>
72
- <div className="flex items-center justify-end gap-3">
73
- <button
74
- type="button"
75
- onClick={onCancel}
76
- className="rounded-md border border-border px-4 py-2 text-sm transition-colors hover:bg-bg-hover"
77
- >
78
- {cancelLabel}
79
- </button>
80
- <button
81
- ref={confirmRef}
82
- type="button"
83
- onClick={onConfirm}
84
- className={cn(
85
- "rounded-md px-4 py-2 text-sm font-medium transition-opacity",
86
- TONE_STYLES[tone],
87
- )}
88
- >
89
- {confirmLabel}
90
- </button>
91
- </div>
92
- </div>
93
- </div>
94
- );
95
- }
96
-
97
- /* ── useConfirm hook ─────────────────────────────────────────────────── */
98
-
99
- export interface ConfirmOptions {
100
- title?: string;
101
- message: string;
102
- confirmLabel?: string;
103
- cancelLabel?: string;
104
- tone?: ConfirmTone;
105
- }
106
-
107
- export function useConfirm() {
108
- const [state, setState] = React.useState<{
109
- opts: ConfirmOptions;
110
- resolve: (v: boolean) => void;
111
- } | null>(null);
112
-
113
- const confirm = React.useCallback(
114
- (opts: ConfirmOptions): Promise<boolean> =>
115
- new Promise((resolve) => {
116
- setState({ opts, resolve });
117
- }),
118
- [],
119
- );
120
-
121
- const modalProps: ConfirmDialogProps = state
122
- ? {
123
- open: true,
124
- ...state.opts,
125
- onConfirm: () => {
126
- state.resolve(true);
127
- setState(null);
128
- },
129
- onCancel: () => {
130
- state.resolve(false);
131
- setState(null);
132
- },
133
- }
134
- : {
135
- open: false,
136
- message: "",
137
- onConfirm: () => {},
138
- onCancel: () => {},
139
- };
140
-
141
- return { confirm, modalProps };
142
- }
@@ -1,54 +0,0 @@
1
- import * as React from "react";
2
- import { cn } from "../../lib/utils";
3
-
4
- export type ConnectionState = "connected" | "disconnected" | "error";
5
-
6
- const STATE_STYLES: Record<
7
- ConnectionState,
8
- { dot: string; text: string; label: string }
9
- > = {
10
- connected: {
11
- dot: "bg-ok",
12
- text: "text-txt",
13
- label: "Connected",
14
- },
15
- disconnected: {
16
- dot: "bg-muted",
17
- text: "text-muted",
18
- label: "Disconnected",
19
- },
20
- error: {
21
- dot: "bg-destructive",
22
- text: "text-destructive",
23
- label: "Error",
24
- },
25
- };
26
-
27
- export interface ConnectionStatusProps
28
- extends React.HTMLAttributes<HTMLDivElement> {
29
- state: ConnectionState;
30
- /** Custom label — overrides the default state label */
31
- label?: string;
32
- }
33
-
34
- export const ConnectionStatus = React.forwardRef<
35
- HTMLDivElement,
36
- ConnectionStatusProps
37
- >(({ state, label, className, ...props }, ref) => {
38
- const styles = STATE_STYLES[state];
39
- return (
40
- <div
41
- ref={ref}
42
- className={cn(
43
- "inline-flex items-center gap-2 rounded-md border border-border bg-bg-accent px-3 py-1.5 text-xs",
44
- styles.text,
45
- className,
46
- )}
47
- {...props}
48
- >
49
- <span className={cn("h-2 w-2 rounded-full", styles.dot)} />
50
- {label ?? styles.label}
51
- </div>
52
- );
53
- });
54
- ConnectionStatus.displayName = "ConnectionStatus";
@@ -1,60 +0,0 @@
1
- import { Check, Copy } from "lucide-react";
2
- import * as React from "react";
3
- import { cn } from "../../lib/utils";
4
-
5
- export interface CopyButtonProps
6
- extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onClick"> {
7
- /** Text to copy to clipboard */
8
- value: string;
9
- /** Duration of the "copied" feedback in ms */
10
- feedbackDuration?: number;
11
- /** Aria-label for default state */
12
- copyLabel?: string;
13
- /** Aria-label for copied state */
14
- copiedLabel?: string;
15
- }
16
-
17
- export const CopyButton = React.forwardRef<HTMLButtonElement, CopyButtonProps>(
18
- (
19
- {
20
- value,
21
- feedbackDuration = 2000,
22
- copyLabel = "Copy",
23
- copiedLabel = "Copied",
24
- className,
25
- children,
26
- ...props
27
- },
28
- ref,
29
- ) => {
30
- const [copied, setCopied] = React.useState(false);
31
-
32
- const handleCopy = React.useCallback(() => {
33
- void navigator.clipboard.writeText(value);
34
- setCopied(true);
35
- setTimeout(() => setCopied(false), feedbackDuration);
36
- }, [value, feedbackDuration]);
37
-
38
- return (
39
- <button
40
- ref={ref}
41
- type="button"
42
- onClick={handleCopy}
43
- className={cn(
44
- "inline-flex items-center gap-1 rounded-md p-1.5 text-muted transition-colors hover:bg-bg-hover hover:text-txt",
45
- className,
46
- )}
47
- aria-label={copied ? copiedLabel : copyLabel}
48
- {...props}
49
- >
50
- {copied ? (
51
- <Check className="h-3.5 w-3.5 text-ok" />
52
- ) : (
53
- <Copy className="h-3.5 w-3.5" />
54
- )}
55
- {children}
56
- </button>
57
- );
58
- },
59
- );
60
- CopyButton.displayName = "CopyButton";
@@ -1,120 +0,0 @@
1
- import * as DialogPrimitive from "@radix-ui/react-dialog";
2
- import { X } from "lucide-react";
3
- import * as React from "react";
4
-
5
- import { cn } from "../../lib/utils";
6
-
7
- const Dialog = DialogPrimitive.Root;
8
-
9
- const DialogTrigger = DialogPrimitive.Trigger;
10
-
11
- const DialogPortal = DialogPrimitive.Portal;
12
-
13
- const DialogClose = DialogPrimitive.Close;
14
-
15
- const DialogOverlay = React.forwardRef<
16
- React.ElementRef<typeof DialogPrimitive.Overlay>,
17
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
18
- >(({ className, ...props }, ref) => (
19
- <DialogPrimitive.Overlay
20
- ref={ref}
21
- className={cn(
22
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
23
- className,
24
- )}
25
- {...props}
26
- />
27
- ));
28
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
29
-
30
- const DialogContent = React.forwardRef<
31
- React.ElementRef<typeof DialogPrimitive.Content>,
32
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
33
- >(({ className, children, ...props }, ref) => (
34
- <DialogPortal>
35
- <DialogOverlay />
36
- <DialogPrimitive.Content
37
- ref={ref}
38
- className={cn(
39
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-bg p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
40
- className,
41
- )}
42
- {...props}
43
- >
44
- {children}
45
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-bg transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted">
46
- <X className="h-4 w-4" />
47
- <span className="sr-only">Close</span>
48
- </DialogPrimitive.Close>
49
- </DialogPrimitive.Content>
50
- </DialogPortal>
51
- ));
52
- DialogContent.displayName = DialogPrimitive.Content.displayName;
53
-
54
- const DialogHeader = ({
55
- className,
56
- ...props
57
- }: React.HTMLAttributes<HTMLDivElement>) => (
58
- <div
59
- className={cn(
60
- "flex flex-col space-y-1.5 text-center sm:text-left",
61
- className,
62
- )}
63
- {...props}
64
- />
65
- );
66
- DialogHeader.displayName = "DialogHeader";
67
-
68
- const DialogFooter = ({
69
- className,
70
- ...props
71
- }: React.HTMLAttributes<HTMLDivElement>) => (
72
- <div
73
- className={cn(
74
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
75
- className,
76
- )}
77
- {...props}
78
- />
79
- );
80
- DialogFooter.displayName = "DialogFooter";
81
-
82
- const DialogTitle = React.forwardRef<
83
- React.ElementRef<typeof DialogPrimitive.Title>,
84
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
85
- >(({ className, ...props }, ref) => (
86
- <DialogPrimitive.Title
87
- ref={ref}
88
- className={cn(
89
- "text-lg font-semibold leading-none tracking-tight",
90
- className,
91
- )}
92
- {...props}
93
- />
94
- ));
95
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
96
-
97
- const DialogDescription = React.forwardRef<
98
- React.ElementRef<typeof DialogPrimitive.Description>,
99
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
100
- >(({ className, ...props }, ref) => (
101
- <DialogPrimitive.Description
102
- ref={ref}
103
- className={cn("text-sm text-muted", className)}
104
- {...props}
105
- />
106
- ));
107
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
108
-
109
- export {
110
- Dialog,
111
- DialogClose,
112
- DialogContent,
113
- DialogDescription,
114
- DialogFooter,
115
- DialogHeader,
116
- DialogOverlay,
117
- DialogPortal,
118
- DialogTitle,
119
- DialogTrigger,
120
- };
@@ -1,198 +0,0 @@
1
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2
- import { Check, ChevronRight, Circle } from "lucide-react";
3
- import * as React from "react";
4
-
5
- import { cn } from "../../lib/utils";
6
-
7
- const DropdownMenu = DropdownMenuPrimitive.Root;
8
-
9
- const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
10
-
11
- const DropdownMenuGroup = DropdownMenuPrimitive.Group;
12
-
13
- const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
14
-
15
- const DropdownMenuSub = DropdownMenuPrimitive.Sub;
16
-
17
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
18
-
19
- const DropdownMenuSubTrigger = React.forwardRef<
20
- React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
21
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
22
- inset?: boolean;
23
- }
24
- >(({ className, inset, children, ...props }, ref) => (
25
- <DropdownMenuPrimitive.SubTrigger
26
- ref={ref}
27
- className={cn(
28
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
29
- inset && "pl-8",
30
- className,
31
- )}
32
- {...props}
33
- >
34
- {children}
35
- <ChevronRight className="ml-auto h-4 w-4" />
36
- </DropdownMenuPrimitive.SubTrigger>
37
- ));
38
- DropdownMenuSubTrigger.displayName =
39
- DropdownMenuPrimitive.SubTrigger.displayName;
40
-
41
- const DropdownMenuSubContent = React.forwardRef<
42
- React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
43
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
44
- >(({ className, ...props }, ref) => (
45
- <DropdownMenuPrimitive.SubContent
46
- ref={ref}
47
- className={cn(
48
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-card p-1 text-txt shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
49
- className,
50
- )}
51
- {...props}
52
- />
53
- ));
54
- DropdownMenuSubContent.displayName =
55
- DropdownMenuPrimitive.SubContent.displayName;
56
-
57
- const DropdownMenuContent = React.forwardRef<
58
- React.ElementRef<typeof DropdownMenuPrimitive.Content>,
59
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
60
- >(({ className, sideOffset = 4, ...props }, ref) => (
61
- <DropdownMenuPrimitive.Portal>
62
- <DropdownMenuPrimitive.Content
63
- ref={ref}
64
- sideOffset={sideOffset}
65
- className={cn(
66
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-card p-1 text-txt shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
67
- className,
68
- )}
69
- {...props}
70
- />
71
- </DropdownMenuPrimitive.Portal>
72
- ));
73
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
74
-
75
- const DropdownMenuItem = React.forwardRef<
76
- React.ElementRef<typeof DropdownMenuPrimitive.Item>,
77
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
78
- inset?: boolean;
79
- }
80
- >(({ className, inset, ...props }, ref) => (
81
- <DropdownMenuPrimitive.Item
82
- ref={ref}
83
- className={cn(
84
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-fg data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
85
- inset && "pl-8",
86
- className,
87
- )}
88
- {...props}
89
- />
90
- ));
91
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
92
-
93
- const DropdownMenuCheckboxItem = React.forwardRef<
94
- React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
95
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
96
- >(({ className, children, checked, ...props }, ref) => (
97
- <DropdownMenuPrimitive.CheckboxItem
98
- ref={ref}
99
- className={cn(
100
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-fg data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
101
- className,
102
- )}
103
- checked={checked}
104
- {...props}
105
- >
106
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
107
- <DropdownMenuPrimitive.ItemIndicator>
108
- <Check className="h-4 w-4" />
109
- </DropdownMenuPrimitive.ItemIndicator>
110
- </span>
111
- {children}
112
- </DropdownMenuPrimitive.CheckboxItem>
113
- ));
114
- DropdownMenuCheckboxItem.displayName =
115
- DropdownMenuPrimitive.CheckboxItem.displayName;
116
-
117
- const DropdownMenuRadioItem = React.forwardRef<
118
- React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
119
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
120
- >(({ className, children, ...props }, ref) => (
121
- <DropdownMenuPrimitive.RadioItem
122
- ref={ref}
123
- className={cn(
124
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-fg data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
125
- className,
126
- )}
127
- {...props}
128
- >
129
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
130
- <DropdownMenuPrimitive.ItemIndicator>
131
- <Circle className="h-2 w-2 fill-current" />
132
- </DropdownMenuPrimitive.ItemIndicator>
133
- </span>
134
- {children}
135
- </DropdownMenuPrimitive.RadioItem>
136
- ));
137
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
138
-
139
- const DropdownMenuLabel = React.forwardRef<
140
- React.ElementRef<typeof DropdownMenuPrimitive.Label>,
141
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
142
- inset?: boolean;
143
- }
144
- >(({ className, inset, ...props }, ref) => (
145
- <DropdownMenuPrimitive.Label
146
- ref={ref}
147
- className={cn(
148
- "px-2 py-1.5 text-sm font-semibold",
149
- inset && "pl-8",
150
- className,
151
- )}
152
- {...props}
153
- />
154
- ));
155
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
156
-
157
- const DropdownMenuSeparator = React.forwardRef<
158
- React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
159
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
160
- >(({ className, ...props }, ref) => (
161
- <DropdownMenuPrimitive.Separator
162
- ref={ref}
163
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
164
- {...props}
165
- />
166
- ));
167
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
168
-
169
- const DropdownMenuShortcut = ({
170
- className,
171
- ...props
172
- }: React.HTMLAttributes<HTMLSpanElement>) => {
173
- return (
174
- <span
175
- className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
176
- {...props}
177
- />
178
- );
179
- };
180
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
181
-
182
- export {
183
- DropdownMenu,
184
- DropdownMenuCheckboxItem,
185
- DropdownMenuContent,
186
- DropdownMenuGroup,
187
- DropdownMenuItem,
188
- DropdownMenuLabel,
189
- DropdownMenuPortal,
190
- DropdownMenuRadioGroup,
191
- DropdownMenuRadioItem,
192
- DropdownMenuSeparator,
193
- DropdownMenuShortcut,
194
- DropdownMenuSub,
195
- DropdownMenuSubContent,
196
- DropdownMenuSubTrigger,
197
- DropdownMenuTrigger,
198
- };
@@ -1,42 +0,0 @@
1
- import * as React from "react";
2
- import { cn } from "../../lib/utils";
3
-
4
- export interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
5
- /** Icon element rendered above the title */
6
- icon?: React.ReactNode;
7
- /** Main heading */
8
- title: string;
9
- /** Supporting description text */
10
- description?: string;
11
- /** Primary action button or element */
12
- action?: React.ReactNode;
13
- }
14
-
15
- export const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
16
- (
17
- { icon, title, description, action, className, children, ...props },
18
- ref,
19
- ) => (
20
- <div
21
- ref={ref}
22
- className={cn(
23
- "flex flex-1 flex-col items-center justify-center p-6 text-center",
24
- className,
25
- )}
26
- {...props}
27
- >
28
- {icon && (
29
- <div className="mb-4 flex h-16 w-16 items-center justify-center rounded-2xl bg-accent/10 text-accent">
30
- {icon}
31
- </div>
32
- )}
33
- <h3 className="mb-2 text-lg font-semibold">{title}</h3>
34
- {description && (
35
- <p className="mb-6 max-w-sm text-sm text-muted">{description}</p>
36
- )}
37
- {action}
38
- {children}
39
- </div>
40
- ),
41
- );
42
- EmptyState.displayName = "EmptyState";
@@ -1,63 +0,0 @@
1
- import * as React from "react";
2
- import { Button } from "./button";
3
-
4
- export interface ErrorBoundaryProps {
5
- children: React.ReactNode;
6
- /** Custom fallback UI — receives the error and a reset callback */
7
- fallback?: (error: Error, resetErrorBoundary: () => void) => React.ReactNode;
8
- }
9
-
10
- interface ErrorBoundaryState {
11
- error: Error | null;
12
- }
13
-
14
- export class ErrorBoundary extends React.Component<
15
- ErrorBoundaryProps,
16
- ErrorBoundaryState
17
- > {
18
- constructor(props: ErrorBoundaryProps) {
19
- super(props);
20
- this.state = { error: null };
21
- }
22
-
23
- static getDerivedStateFromError(error: Error): ErrorBoundaryState {
24
- return { error };
25
- }
26
-
27
- componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
28
- console.error("[ErrorBoundary]", error, errorInfo);
29
- }
30
-
31
- resetErrorBoundary = () => {
32
- this.setState({ error: null });
33
- };
34
-
35
- render() {
36
- if (this.state.error) {
37
- if (this.props.fallback) {
38
- return this.props.fallback(this.state.error, this.resetErrorBoundary);
39
- }
40
- return (
41
- <div className="flex flex-col items-center justify-center gap-3 p-6 text-center border border-destructive/30 bg-destructive/5 rounded-md">
42
- <p className="text-sm font-semibold text-destructive">
43
- Something went wrong
44
- </p>
45
- <p className="text-xs text-muted max-w-sm">
46
- {this.state.error.message}
47
- </p>
48
- <Button
49
- type="button"
50
- variant="outline"
51
- size="sm"
52
- className="rounded-md text-xs"
53
- onClick={this.resetErrorBoundary}
54
- >
55
- Try Again
56
- </Button>
57
- </div>
58
- );
59
- }
60
-
61
- return this.props.children;
62
- }
63
- }