@elizaos/client 1.5.5-alpha.10

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 (209) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +350 -0
  3. package/dist/assets/empty-module-CLMscLYw.js +1 -0
  4. package/dist/assets/main-BBZ_3lkn.css +5999 -0
  5. package/dist/assets/main-C5zNUkXH.js +7 -0
  6. package/dist/assets/main-Dz64ENQg.js +614 -0
  7. package/dist/assets/react-vendor-DM5m98rr.js +545 -0
  8. package/dist/assets/ui-vendor-BQCqNqg0.js +1 -0
  9. package/dist/elizaos-avatar.png +0 -0
  10. package/dist/elizaos-icon.png +0 -0
  11. package/dist/elizaos-logo-light.png +0 -0
  12. package/dist/elizaos.webp +0 -0
  13. package/dist/favicon.ico +0 -0
  14. package/dist/images/agents/agent1.png +0 -0
  15. package/dist/images/agents/agent2.png +0 -0
  16. package/dist/images/agents/agent3.png +0 -0
  17. package/dist/images/agents/agent4.png +0 -0
  18. package/dist/images/agents/agent5.png +0 -0
  19. package/dist/index.html +14 -0
  20. package/index.html +24 -0
  21. package/package.json +159 -0
  22. package/postcss.config.js +3 -0
  23. package/public/elizaos-avatar.png +0 -0
  24. package/public/elizaos-icon.png +0 -0
  25. package/public/elizaos-logo-light.png +0 -0
  26. package/public/elizaos.webp +0 -0
  27. package/public/favicon.ico +0 -0
  28. package/public/images/agents/agent1.png +0 -0
  29. package/public/images/agents/agent2.png +0 -0
  30. package/public/images/agents/agent3.png +0 -0
  31. package/public/images/agents/agent4.png +0 -0
  32. package/public/images/agents/agent5.png +0 -0
  33. package/src/App.tsx +222 -0
  34. package/src/components/AgentDetailsPanel.tsx +147 -0
  35. package/src/components/ChatInputArea.tsx +196 -0
  36. package/src/components/ChatMessageListComponent.tsx +139 -0
  37. package/src/components/actionTool.tsx +186 -0
  38. package/src/components/add-agent-card.tsx +77 -0
  39. package/src/components/agent-action-viewer.tsx +816 -0
  40. package/src/components/agent-avatar-stack.tsx +121 -0
  41. package/src/components/agent-card.cy.tsx +259 -0
  42. package/src/components/agent-card.tsx +177 -0
  43. package/src/components/agent-creator.tsx +142 -0
  44. package/src/components/agent-log-viewer.tsx +645 -0
  45. package/src/components/agent-memory-edit-overlay.tsx +461 -0
  46. package/src/components/agent-memory-viewer.tsx +504 -0
  47. package/src/components/agent-settings.tsx +270 -0
  48. package/src/components/agent-sidebar.tsx +178 -0
  49. package/src/components/api-key-dialog.tsx +113 -0
  50. package/src/components/app-sidebar.tsx +685 -0
  51. package/src/components/array-input.tsx +116 -0
  52. package/src/components/audio-recorder.tsx +292 -0
  53. package/src/components/avatar-panel.tsx +141 -0
  54. package/src/components/character-form.tsx +1138 -0
  55. package/src/components/chat.tsx +1813 -0
  56. package/src/components/combobox.tsx +187 -0
  57. package/src/components/confirmation-dialog.tsx +59 -0
  58. package/src/components/connection-error-banner.tsx +101 -0
  59. package/src/components/connection-status.cy.tsx +73 -0
  60. package/src/components/connection-status.tsx +155 -0
  61. package/src/components/copy-button.tsx +35 -0
  62. package/src/components/delete-button.tsx +24 -0
  63. package/src/components/env-settings.tsx +261 -0
  64. package/src/components/group-card.tsx +160 -0
  65. package/src/components/group-panel.tsx +543 -0
  66. package/src/components/input-copy.tsx +21 -0
  67. package/src/components/logs-page.tsx +41 -0
  68. package/src/components/media-content.tsx +385 -0
  69. package/src/components/memory-graph.tsx +170 -0
  70. package/src/components/missing-secrets-dialog.tsx +72 -0
  71. package/src/components/onboarding-tour.tsx +247 -0
  72. package/src/components/page-title.tsx +8 -0
  73. package/src/components/plugins-panel.tsx +383 -0
  74. package/src/components/profile-card.tsx +66 -0
  75. package/src/components/profile-overlay.tsx +283 -0
  76. package/src/components/retry-button.tsx +28 -0
  77. package/src/components/secret-panel.tsx +1505 -0
  78. package/src/components/server-management.tsx +264 -0
  79. package/src/components/split-button.tsx +148 -0
  80. package/src/components/stop-agent-button.tsx +99 -0
  81. package/src/components/ui/alert-dialog.cy.tsx +333 -0
  82. package/src/components/ui/alert-dialog.tsx +115 -0
  83. package/src/components/ui/alert.tsx +49 -0
  84. package/src/components/ui/avatar.cy.tsx +180 -0
  85. package/src/components/ui/avatar.tsx +57 -0
  86. package/src/components/ui/badge.cy.tsx +146 -0
  87. package/src/components/ui/badge.tsx +43 -0
  88. package/src/components/ui/button.cy.tsx +177 -0
  89. package/src/components/ui/button.tsx +56 -0
  90. package/src/components/ui/card.cy.tsx +160 -0
  91. package/src/components/ui/card.tsx +73 -0
  92. package/src/components/ui/chat/animated-markdown.tsx +59 -0
  93. package/src/components/ui/chat/chat-bubble.tsx +178 -0
  94. package/src/components/ui/chat/chat-container.tsx +51 -0
  95. package/src/components/ui/chat/chat-input.cy.tsx +169 -0
  96. package/src/components/ui/chat/chat-input.tsx +47 -0
  97. package/src/components/ui/chat/chat-message-list.tsx +61 -0
  98. package/src/components/ui/chat/chat-tts-button.tsx +199 -0
  99. package/src/components/ui/chat/code-block.tsx +79 -0
  100. package/src/components/ui/chat/expandable-chat.tsx +131 -0
  101. package/src/components/ui/chat/hooks/useAutoScroll.ts +86 -0
  102. package/src/components/ui/chat/markdown.tsx +209 -0
  103. package/src/components/ui/chat/message-loading.tsx +48 -0
  104. package/src/components/ui/checkbox.cy.tsx +170 -0
  105. package/src/components/ui/checkbox.tsx +30 -0
  106. package/src/components/ui/collapsible.cy.tsx +283 -0
  107. package/src/components/ui/collapsible.tsx +9 -0
  108. package/src/components/ui/command.cy.tsx +313 -0
  109. package/src/components/ui/command.tsx +143 -0
  110. package/src/components/ui/dialog.cy.tsx +279 -0
  111. package/src/components/ui/dialog.tsx +104 -0
  112. package/src/components/ui/dropdown-menu.cy.tsx +273 -0
  113. package/src/components/ui/dropdown-menu.tsx +281 -0
  114. package/src/components/ui/input.cy.tsx +82 -0
  115. package/src/components/ui/input.tsx +27 -0
  116. package/src/components/ui/label.cy.tsx +157 -0
  117. package/src/components/ui/label.tsx +19 -0
  118. package/src/components/ui/resizable.tsx +42 -0
  119. package/src/components/ui/scroll-area.cy.tsx +242 -0
  120. package/src/components/ui/scroll-area.tsx +46 -0
  121. package/src/components/ui/select.cy.tsx +277 -0
  122. package/src/components/ui/select.tsx +155 -0
  123. package/src/components/ui/separator.cy.tsx +145 -0
  124. package/src/components/ui/separator.tsx +29 -0
  125. package/src/components/ui/sheet.cy.tsx +324 -0
  126. package/src/components/ui/sheet.tsx +119 -0
  127. package/src/components/ui/sidebar.tsx +734 -0
  128. package/src/components/ui/skeleton.cy.tsx +149 -0
  129. package/src/components/ui/skeleton.tsx +17 -0
  130. package/src/components/ui/split-button.cy.tsx +274 -0
  131. package/src/components/ui/split-button.tsx +112 -0
  132. package/src/components/ui/switch.tsx +28 -0
  133. package/src/components/ui/tabs.cy.tsx +271 -0
  134. package/src/components/ui/tabs.tsx +53 -0
  135. package/src/components/ui/textarea.cy.tsx +136 -0
  136. package/src/components/ui/textarea.tsx +26 -0
  137. package/src/components/ui/toast.cy.tsx +209 -0
  138. package/src/components/ui/toast.tsx +126 -0
  139. package/src/components/ui/toaster.tsx +29 -0
  140. package/src/components/ui/tooltip.cy.tsx +244 -0
  141. package/src/components/ui/tooltip.tsx +30 -0
  142. package/src/config/agent-templates.ts +349 -0
  143. package/src/config/voice-models.ts +181 -0
  144. package/src/constants.ts +23 -0
  145. package/src/context/AuthContext.tsx +44 -0
  146. package/src/context/ConnectionContext.tsx +194 -0
  147. package/src/entry.tsx +9 -0
  148. package/src/hooks/__tests__/use-agent-tab-state.test.ts +137 -0
  149. package/src/hooks/__tests__/use-agent-update.test.tsx +250 -0
  150. package/src/hooks/__tests__/use-character-convert.test.ts +102 -0
  151. package/src/hooks/__tests__/use-panel-width-state.test.ts +243 -0
  152. package/src/hooks/__tests__/use-sidebar-state.test.ts +117 -0
  153. package/src/hooks/use-agent-management.ts +130 -0
  154. package/src/hooks/use-agent-tab-state.ts +74 -0
  155. package/src/hooks/use-agent-update.ts +469 -0
  156. package/src/hooks/use-character-convert.ts +138 -0
  157. package/src/hooks/use-confirmation.ts +55 -0
  158. package/src/hooks/use-delete-agent.ts +123 -0
  159. package/src/hooks/use-dm-channels.ts +198 -0
  160. package/src/hooks/use-elevenlabs-voices.ts +83 -0
  161. package/src/hooks/use-file-upload.ts +224 -0
  162. package/src/hooks/use-mobile.tsx +19 -0
  163. package/src/hooks/use-onboarding.tsx +49 -0
  164. package/src/hooks/use-panel-width-state.ts +147 -0
  165. package/src/hooks/use-partial-update.ts +288 -0
  166. package/src/hooks/use-plugin-details.ts +462 -0
  167. package/src/hooks/use-plugins.ts +119 -0
  168. package/src/hooks/use-query-hooks.ts +1263 -0
  169. package/src/hooks/use-server-agents.ts +62 -0
  170. package/src/hooks/use-server-version.tsx +47 -0
  171. package/src/hooks/use-sidebar-state.ts +50 -0
  172. package/src/hooks/use-socket-chat.ts +264 -0
  173. package/src/hooks/use-toast.ts +260 -0
  174. package/src/hooks/use-version.tsx +64 -0
  175. package/src/index.css +146 -0
  176. package/src/lib/api-client-config.ts +53 -0
  177. package/src/lib/api-type-mappers.ts +196 -0
  178. package/src/lib/export-utils.ts +123 -0
  179. package/src/lib/logger.ts +19 -0
  180. package/src/lib/media-utils.ts +170 -0
  181. package/src/lib/pca.test.ts +17 -0
  182. package/src/lib/pca.ts +52 -0
  183. package/src/lib/socketio-manager.ts +664 -0
  184. package/src/lib/utils.ts +168 -0
  185. package/src/main.tsx +16 -0
  186. package/src/mocks/empty-module.ts +12 -0
  187. package/src/mocks/node-module.ts +57 -0
  188. package/src/polyfills.ts +37 -0
  189. package/src/routes/agent-detail.tsx +30 -0
  190. package/src/routes/agent-list.tsx +27 -0
  191. package/src/routes/agent-settings.tsx +48 -0
  192. package/src/routes/character-detail.tsx +52 -0
  193. package/src/routes/character-form.tsx +79 -0
  194. package/src/routes/character-list.tsx +38 -0
  195. package/src/routes/chat.tsx +128 -0
  196. package/src/routes/createAgent.tsx +13 -0
  197. package/src/routes/group-new.tsx +50 -0
  198. package/src/routes/group.tsx +29 -0
  199. package/src/routes/home.tsx +218 -0
  200. package/src/routes/not-found.tsx +71 -0
  201. package/src/test/setup.ts +154 -0
  202. package/src/types/crypto-browserify.d.ts +4 -0
  203. package/src/types/index.ts +13 -0
  204. package/src/types/rooms.ts +8 -0
  205. package/src/types.ts +84 -0
  206. package/src/vite-env.d.ts +40 -0
  207. package/tailwind.config.ts +90 -0
  208. package/tsconfig.json +10 -0
  209. package/vite.config.ts +102 -0
@@ -0,0 +1,313 @@
1
+ /// <reference types="cypress" />
2
+ /// <reference path="../../../cypress/support/types.d.ts" />
3
+
4
+ import React from 'react';
5
+ import {
6
+ Command,
7
+ CommandDialog,
8
+ CommandEmpty,
9
+ CommandGroup,
10
+ CommandInput,
11
+ CommandItem,
12
+ CommandList,
13
+ CommandSeparator,
14
+ CommandShortcut,
15
+ } from './command';
16
+
17
+ describe('Command Component', () => {
18
+ it('renders basic command palette', () => {
19
+ cy.mount(
20
+ <Command>
21
+ <CommandInput placeholder="Type a command or search..." />
22
+ <CommandList>
23
+ <CommandEmpty>No results found.</CommandEmpty>
24
+ <CommandGroup heading="Suggestions">
25
+ <CommandItem>Calendar</CommandItem>
26
+ <CommandItem>Search Emoji</CommandItem>
27
+ <CommandItem>Calculator</CommandItem>
28
+ </CommandGroup>
29
+ </CommandList>
30
+ </Command>
31
+ );
32
+
33
+ cy.get('input[placeholder="Type a command or search..."]').should('be.visible');
34
+ cy.contains('Suggestions').should('be.visible');
35
+ cy.contains('Calendar').should('be.visible');
36
+ cy.contains('Search Emoji').should('be.visible');
37
+ cy.contains('Calculator').should('be.visible');
38
+ });
39
+
40
+ it('filters items based on search', () => {
41
+ cy.mount(
42
+ <Command>
43
+ <CommandInput placeholder="Search..." />
44
+ <CommandList>
45
+ <CommandEmpty>No results found.</CommandEmpty>
46
+ <CommandGroup>
47
+ <CommandItem>Apple</CommandItem>
48
+ <CommandItem>Banana</CommandItem>
49
+ <CommandItem>Cherry</CommandItem>
50
+ <CommandItem>Date</CommandItem>
51
+ </CommandGroup>
52
+ </CommandList>
53
+ </Command>
54
+ );
55
+
56
+ // Type in search
57
+ cy.get('input[placeholder="Search..."]').type('an');
58
+
59
+ // Should show items containing 'an'
60
+ cy.contains('Banana').should('be.visible');
61
+ cy.contains('Apple').should('not.exist');
62
+ cy.contains('Cherry').should('not.exist');
63
+ });
64
+
65
+ it('shows empty state when no matches', () => {
66
+ cy.mount(
67
+ <Command>
68
+ <CommandInput placeholder="Search..." />
69
+ <CommandList>
70
+ <CommandEmpty>No results found.</CommandEmpty>
71
+ <CommandGroup>
72
+ <CommandItem>Item 1</CommandItem>
73
+ <CommandItem>Item 2</CommandItem>
74
+ </CommandGroup>
75
+ </CommandList>
76
+ </Command>
77
+ );
78
+
79
+ cy.get('input[placeholder="Search..."]').type('xyz');
80
+ cy.contains('No results found.').should('be.visible');
81
+ });
82
+
83
+ it('handles item selection', () => {
84
+ const onSelect = cy.stub();
85
+
86
+ cy.mount(
87
+ <Command>
88
+ <CommandInput placeholder="Search..." />
89
+ <CommandList>
90
+ <CommandGroup>
91
+ <CommandItem onSelect={() => onSelect('calendar')}>Calendar</CommandItem>
92
+ <CommandItem onSelect={() => onSelect('email')}>Email</CommandItem>
93
+ </CommandGroup>
94
+ </CommandList>
95
+ </Command>
96
+ );
97
+
98
+ cy.contains('Calendar').click();
99
+ cy.wrap(onSelect).should('have.been.calledWith', 'calendar');
100
+ });
101
+
102
+ it('renders with multiple groups', () => {
103
+ cy.mount(
104
+ <Command>
105
+ <CommandInput placeholder="Search..." />
106
+ <CommandList>
107
+ <CommandEmpty>No results found.</CommandEmpty>
108
+ <CommandGroup heading="Apps">
109
+ <CommandItem>Calendar</CommandItem>
110
+ <CommandItem>Mail</CommandItem>
111
+ </CommandGroup>
112
+ <CommandSeparator />
113
+ <CommandGroup heading="Settings">
114
+ <CommandItem>Profile</CommandItem>
115
+ <CommandItem>Preferences</CommandItem>
116
+ </CommandGroup>
117
+ </CommandList>
118
+ </Command>
119
+ );
120
+
121
+ cy.contains('Apps').should('be.visible');
122
+ cy.contains('Settings').should('be.visible');
123
+ cy.get('[role="separator"]').should('exist');
124
+ });
125
+
126
+ it('renders with shortcuts', () => {
127
+ cy.mount(
128
+ <Command>
129
+ <CommandInput placeholder="Search..." />
130
+ <CommandList>
131
+ <CommandGroup>
132
+ <CommandItem>
133
+ Copy
134
+ <CommandShortcut>⌘C</CommandShortcut>
135
+ </CommandItem>
136
+ <CommandItem>
137
+ Paste
138
+ <CommandShortcut>⌘V</CommandShortcut>
139
+ </CommandItem>
140
+ <CommandItem>
141
+ Cut
142
+ <CommandShortcut>⌘X</CommandShortcut>
143
+ </CommandItem>
144
+ </CommandGroup>
145
+ </CommandList>
146
+ </Command>
147
+ );
148
+
149
+ cy.contains('⌘C').should('be.visible');
150
+ cy.contains('⌘V').should('be.visible');
151
+ cy.contains('⌘X').should('be.visible');
152
+ });
153
+
154
+ it('supports keyboard navigation', () => {
155
+ cy.mount(
156
+ <Command>
157
+ <CommandInput placeholder="Search..." />
158
+ <CommandList>
159
+ <CommandGroup>
160
+ <CommandItem>First Item</CommandItem>
161
+ <CommandItem>Second Item</CommandItem>
162
+ <CommandItem>Third Item</CommandItem>
163
+ </CommandGroup>
164
+ </CommandList>
165
+ </Command>
166
+ );
167
+
168
+ // Verify all items are present
169
+ cy.contains('First Item').should('exist');
170
+ cy.contains('Second Item').should('exist');
171
+ cy.contains('Third Item').should('exist');
172
+
173
+ // Focus input and verify keyboard interaction works
174
+ cy.get('input').focus();
175
+ cy.get('input').should('have.focus');
176
+
177
+ // Test that arrow keys work (even if selection behavior varies)
178
+ cy.get('input').type('{downarrow}');
179
+ cy.get('input').type('{downarrow}');
180
+
181
+ // Command component should still be interactive
182
+ cy.get('input').should('have.focus');
183
+ });
184
+
185
+ it('renders in dialog mode', () => {
186
+ const TestComponent = () => {
187
+ const [open, setOpen] = React.useState(false);
188
+
189
+ return (
190
+ <>
191
+ <button onClick={() => setOpen(true)}>Open Command</button>
192
+ <CommandDialog open={open} onOpenChange={setOpen}>
193
+ <CommandInput placeholder="Type a command..." />
194
+ <CommandList>
195
+ <CommandEmpty>No results found.</CommandEmpty>
196
+ <CommandGroup heading="Commands">
197
+ <CommandItem>New File</CommandItem>
198
+ <CommandItem>Open File</CommandItem>
199
+ <CommandItem>Save</CommandItem>
200
+ </CommandGroup>
201
+ </CommandList>
202
+ </CommandDialog>
203
+ </>
204
+ );
205
+ };
206
+
207
+ cy.mount(<TestComponent />);
208
+
209
+ cy.contains('New File').should('not.exist');
210
+ cy.contains('Open Command').click();
211
+ cy.contains('New File').should('be.visible');
212
+ cy.contains('Open File').should('be.visible');
213
+ });
214
+
215
+ it('applies custom className', () => {
216
+ cy.mount(
217
+ <Command className="custom-command border-2">
218
+ <CommandInput className="custom-input" placeholder="Search..." />
219
+ <CommandList className="custom-list">
220
+ <CommandGroup className="custom-group">
221
+ <CommandItem className="custom-item">Item</CommandItem>
222
+ </CommandGroup>
223
+ </CommandList>
224
+ </Command>
225
+ );
226
+
227
+ cy.get('.custom-command').should('have.class', 'border-2');
228
+ cy.get('.custom-input').should('exist');
229
+ cy.get('.custom-list').should('exist');
230
+ cy.get('.custom-group').should('exist');
231
+ cy.get('.custom-item').should('exist');
232
+ });
233
+
234
+ it('handles disabled items', () => {
235
+ const onSelect = cy.stub();
236
+
237
+ cy.mount(
238
+ <Command>
239
+ <CommandInput placeholder="Search..." />
240
+ <CommandList>
241
+ <CommandGroup>
242
+ <CommandItem onSelect={onSelect}>Enabled</CommandItem>
243
+ <CommandItem disabled onSelect={onSelect}>
244
+ Disabled
245
+ </CommandItem>
246
+ </CommandGroup>
247
+ </CommandList>
248
+ </Command>
249
+ );
250
+
251
+ cy.contains('Enabled').click();
252
+ cy.wrap(onSelect).should('have.been.calledOnce');
253
+
254
+ cy.contains('Disabled').click({ force: true });
255
+ cy.wrap(onSelect).should('have.been.calledOnce'); // Still only once
256
+ });
257
+
258
+ it('supports icons in items', () => {
259
+ cy.mount(
260
+ <Command>
261
+ <CommandInput placeholder="Search..." />
262
+ <CommandList>
263
+ <CommandGroup>
264
+ <CommandItem>
265
+ <span className="mr-2">📅</span>
266
+ Calendar
267
+ </CommandItem>
268
+ <CommandItem>
269
+ <span className="mr-2">📧</span>
270
+ Mail
271
+ </CommandItem>
272
+ <CommandItem>
273
+ <span className="mr-2">⚙️</span>
274
+ Settings
275
+ </CommandItem>
276
+ </CommandGroup>
277
+ </CommandList>
278
+ </Command>
279
+ );
280
+
281
+ cy.contains('📅').should('be.visible');
282
+ cy.contains('📧').should('be.visible');
283
+ cy.contains('⚙️').should('be.visible');
284
+ });
285
+
286
+ it('handles complex filtering scenarios', () => {
287
+ cy.mount(
288
+ <Command>
289
+ <CommandInput placeholder="Search files..." />
290
+ <CommandList>
291
+ <CommandEmpty>No files found.</CommandEmpty>
292
+ <CommandGroup heading="Recent Files">
293
+ <CommandItem>document.pdf</CommandItem>
294
+ <CommandItem>image.png</CommandItem>
295
+ <CommandItem>video.mp4</CommandItem>
296
+ </CommandGroup>
297
+ <CommandGroup heading="Folders">
298
+ <CommandItem>Documents</CommandItem>
299
+ <CommandItem>Images</CommandItem>
300
+ <CommandItem>Videos</CommandItem>
301
+ </CommandGroup>
302
+ </CommandList>
303
+ </Command>
304
+ );
305
+
306
+ // Search for 'doc'
307
+ cy.get('input').type('doc');
308
+ cy.contains('document.pdf').should('be.visible');
309
+ cy.contains('Documents').should('be.visible');
310
+ cy.contains('image.png').should('not.exist');
311
+ cy.contains('Videos').should('not.exist');
312
+ });
313
+ });
@@ -0,0 +1,143 @@
1
+ 'use client';
2
+
3
+ import type { DialogProps } from '@radix-ui/react-dialog';
4
+ import { Command as CommandPrimitive } from 'cmdk';
5
+ import { Search } from 'lucide-react';
6
+ import * as React from 'react';
7
+
8
+ import { Dialog, DialogContent } from '@/components/ui/dialog';
9
+ import { cn } from '@/lib/utils';
10
+
11
+ const Command = React.forwardRef<
12
+ React.ElementRef<typeof CommandPrimitive>,
13
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14
+ >(({ className, ...props }, ref) => (
15
+ <CommandPrimitive
16
+ ref={ref}
17
+ className={cn(
18
+ 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground',
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ ));
24
+ Command.displayName = CommandPrimitive.displayName;
25
+
26
+ const CommandDialog = ({ children, ...props }: DialogProps) => {
27
+ return (
28
+ <Dialog {...props}>
29
+ <DialogContent className="overflow-hidden p-0">
30
+ <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
31
+ {children}
32
+ </Command>
33
+ </DialogContent>
34
+ </Dialog>
35
+ );
36
+ };
37
+
38
+ const CommandInput = React.forwardRef<
39
+ React.ElementRef<typeof CommandPrimitive.Input>,
40
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
41
+ >(({ className, ...props }, ref) => (
42
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
43
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
44
+ <CommandPrimitive.Input
45
+ ref={ref}
46
+ className={cn(
47
+ 'flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
48
+ className
49
+ )}
50
+ {...props}
51
+ />
52
+ </div>
53
+ ));
54
+
55
+ CommandInput.displayName = CommandPrimitive.Input.displayName;
56
+
57
+ const CommandList = React.forwardRef<
58
+ React.ElementRef<typeof CommandPrimitive.List>,
59
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
60
+ >(({ className, ...props }, ref) => (
61
+ <CommandPrimitive.List
62
+ ref={ref}
63
+ className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)}
64
+ {...props}
65
+ />
66
+ ));
67
+
68
+ CommandList.displayName = CommandPrimitive.List.displayName;
69
+
70
+ const CommandEmpty = React.forwardRef<
71
+ React.ElementRef<typeof CommandPrimitive.Empty>,
72
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
73
+ >((props, ref) => (
74
+ <CommandPrimitive.Empty ref={ref} className="py-6 text-center text-sm" {...props} />
75
+ ));
76
+
77
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
78
+
79
+ const CommandGroup = React.forwardRef<
80
+ React.ElementRef<typeof CommandPrimitive.Group>,
81
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
82
+ >(({ className, ...props }, ref) => (
83
+ <CommandPrimitive.Group
84
+ ref={ref}
85
+ className={cn(
86
+ 'overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground',
87
+ className
88
+ )}
89
+ {...props}
90
+ />
91
+ ));
92
+
93
+ CommandGroup.displayName = CommandPrimitive.Group.displayName;
94
+
95
+ const CommandSeparator = React.forwardRef<
96
+ React.ElementRef<typeof CommandPrimitive.Separator>,
97
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
98
+ >(({ className, ...props }, ref) => (
99
+ <CommandPrimitive.Separator
100
+ ref={ref}
101
+ className={cn('-mx-1 h-px bg-border', className)}
102
+ {...props}
103
+ />
104
+ ));
105
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
106
+
107
+ const CommandItem = React.forwardRef<
108
+ React.ElementRef<typeof CommandPrimitive.Item>,
109
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
110
+ >(({ className, ...props }, ref) => (
111
+ <CommandPrimitive.Item
112
+ ref={ref}
113
+ className={cn(
114
+ 'relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
115
+ className
116
+ )}
117
+ {...props}
118
+ />
119
+ ));
120
+
121
+ CommandItem.displayName = CommandPrimitive.Item.displayName;
122
+
123
+ const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
124
+ return (
125
+ <span
126
+ className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)}
127
+ {...props}
128
+ />
129
+ );
130
+ };
131
+ CommandShortcut.displayName = 'CommandShortcut';
132
+
133
+ export {
134
+ Command,
135
+ CommandDialog,
136
+ CommandInput,
137
+ CommandList,
138
+ CommandEmpty,
139
+ CommandGroup,
140
+ CommandItem,
141
+ CommandShortcut,
142
+ CommandSeparator,
143
+ };