@hanzo/ui 4.5.4 → 4.6.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.
- package/README-MCP.md +3 -3
- package/README.md +229 -0
- package/assets/ai-icons.tsx +207 -0
- package/assets/crypto.tsx +33 -0
- package/assets/file-type-icon.tsx +66 -0
- package/assets/file.tsx +45 -0
- package/assets/general.tsx +2318 -0
- package/assets/hanzo-logo.svg +9 -0
- package/assets/hanzo-logo.tsx +15 -0
- package/assets/index.ts +8 -0
- package/assets/index.tsx +4 -0
- package/assets/llm-provider.tsx +1094 -0
- package/bin/create-registry.js +1 -1
- package/bin/test-mcp.sh +1 -1
- package/bin/update-registry.js +2 -2
- package/blocks/components/content.tsx +1 -1
- package/blocks/components/grid-block/index.tsx +1 -1
- package/blocks/components/screenful-block/content.tsx +1 -1
- package/blocks/components/screenful-block/poster-background.tsx +1 -1
- package/components/index.ts +56 -0
- package/dist/button.d.ts +1 -0
- package/dist/button.js +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/use-click-away.d.ts +2 -0
- package/dist/hooks/use-click-away.js +23 -0
- package/dist/hooks/use-combined-refs.d.ts +3 -0
- package/dist/hooks/use-combined-refs.js +18 -0
- package/dist/hooks/use-copy-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-clipboard.js +21 -0
- package/dist/hooks/use-debounce.d.ts +1 -0
- package/dist/hooks/use-debounce.js +13 -0
- package/dist/hooks/use-fill-ids.d.ts +8 -0
- package/dist/hooks/use-fill-ids.js +20 -0
- package/dist/hooks/use-map.d.ts +1 -0
- package/dist/hooks/use-map.js +20 -0
- package/dist/hooks/use-measure.d.ts +8 -0
- package/dist/hooks/use-measure.js +25 -0
- package/dist/hooks/use-reverse-video-playback.d.ts +1 -0
- package/dist/hooks/use-reverse-video-playback.js +41 -0
- package/dist/hooks/use-scroll-restoration.d.ts +8 -0
- package/dist/hooks/use-scroll-restoration.js +36 -0
- package/dist/mcp/enhanced-server.js +2 -2
- package/dist/registry/api.d.ts +1 -1
- package/dist/registry/api.js +3 -3
- package/dist/registry/index.d.ts +48 -48
- package/dist/registry/index.js +3 -3
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/helpers/file.ts +33 -0
- package/helpers/memoization.ts +40 -0
- package/package.json +27 -6
- package/primitives/accordion.tsx +53 -45
- package/primitives/alert-dialog.tsx +185 -0
- package/primitives/alert.tsx +74 -0
- package/primitives/apply-typography.tsx +1 -1
- package/primitives/avatar.tsx +37 -29
- package/primitives/background-beams.tsx +142 -0
- package/primitives/badge.tsx +27 -19
- package/primitives/breadcrumb.tsx +77 -62
- package/primitives/button.tsx +69 -72
- package/primitives/card.tsx +73 -59
- package/primitives/chat/chat-input-area.tsx +87 -0
- package/primitives/chat/chat-input.tsx +71 -0
- package/primitives/chat/files-preview.tsx +330 -0
- package/primitives/chat/index.ts +6 -0
- package/primitives/chat/json-form.tsx +8 -0
- package/primitives/chat/message-list.tsx +307 -0
- package/primitives/chat/message.tsx +569 -0
- package/primitives/chat/sqlite-preview.tsx +215 -0
- package/primitives/checkbox.tsx +18 -19
- package/primitives/collapsible.tsx +9 -0
- package/primitives/command.tsx +75 -83
- package/primitives/context-menu.tsx +115 -109
- package/primitives/copy-to-clipboard-icon.tsx +60 -0
- package/primitives/dialog-video-controller.tsx +1 -1
- package/primitives/dialog.tsx +111 -145
- package/primitives/dot-pattern.tsx +57 -0
- package/primitives/dots-loader.tsx +13 -0
- package/primitives/drawer.tsx +59 -87
- package/primitives/dropdown-menu.tsx +199 -0
- package/primitives/error-message.tsx +19 -0
- package/primitives/file-uploader.tsx +200 -0
- package/primitives/form.tsx +92 -87
- package/primitives/hover-card.tsx +28 -0
- package/primitives/icons/github.tsx +1 -1
- package/primitives/icons/youtube-logo.tsx +1 -1
- package/primitives/index-common.ts +121 -42
- package/primitives/index-next.ts +3 -1
- package/primitives/input.tsx +115 -20
- package/primitives/label.tsx +15 -23
- package/primitives/loading-spinner.tsx +1 -1
- package/primitives/markdown-preview.tsx +609 -0
- package/primitives/mermaid.tsx +196 -0
- package/primitives/next/link-element.tsx +1 -1
- package/primitives/next/mdx-link.tsx +1 -1
- package/primitives/pagination.tsx +117 -0
- package/primitives/popover.tsx +20 -25
- package/primitives/pretty-json-print.tsx +28 -0
- package/primitives/progress.tsx +14 -15
- package/primitives/prompt-textarea.tsx +72 -0
- package/primitives/qr-code.tsx +112 -0
- package/primitives/radio-group.tsx +25 -39
- package/primitives/resizable.tsx +47 -0
- package/primitives/scroll-area.tsx +35 -25
- package/primitives/search-input.tsx +66 -0
- package/primitives/select.tsx +62 -109
- package/primitives/separator.tsx +22 -26
- package/primitives/sheet.tsx +78 -117
- package/primitives/skeleton.tsx +13 -16
- package/primitives/slider.tsx +50 -60
- package/primitives/stepper.tsx +272 -0
- package/primitives/switch.tsx +14 -23
- package/primitives/table.tsx +65 -77
- package/primitives/tabs.tsx +29 -39
- package/primitives/text-link.tsx +25 -0
- package/primitives/textarea.tsx +61 -0
- package/primitives/textfield.tsx +75 -0
- package/primitives/toast.tsx +30 -0
- package/primitives/toggle-group.tsx +33 -33
- package/primitives/toggle.tsx +22 -51
- package/primitives/tooltip.tsx +37 -38
- package/registry.json +1 -1
- package/src/button.ts +1 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/use-click-away.ts +31 -0
- package/src/hooks/use-combined-refs.ts +22 -0
- package/src/hooks/use-copy-clipboard.ts +30 -0
- package/src/hooks/use-debounce.ts +17 -0
- package/src/hooks/use-fill-ids.ts +25 -0
- package/src/hooks/use-map.ts +26 -0
- package/src/hooks/use-measure.ts +42 -0
- package/src/hooks/use-reverse-video-playback.ts +43 -0
- package/src/hooks/use-scroll-restoration.ts +50 -0
- package/src/mcp/README.md +1 -1
- package/src/mcp/enhanced-server.ts +2 -2
- package/src/registry/api.ts +3 -3
- package/src/registry/index.ts +3 -3
- package/src/utils.ts +1 -0
- package/style/theme-provider.tsx +1 -1
- package/test-imports.mjs +19 -0
- package/types/animation-def.ts +1 -1
- package/types/button-def.ts +1 -1
- package/types/index.ts +1 -1
- package/util/blob.ts +28 -0
- package/util/copy-to-clipboard.ts +17 -0
- package/util/create-shadow-root.ts +22 -0
- package/util/date.ts +83 -0
- package/util/debounce.ts +11 -0
- package/util/file.ts +15 -0
- package/util/format-and-abbreviate-as-currency.ts +1 -1
- package/util/format-text.ts +33 -0
- package/util/index.ts +9 -78
- package/util/timing.ts +3 -0
- package/util/toasts.tsx +17 -0
- package/utils.ts +9 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { debug } from '@tauri-apps/plugin-log';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import * as sqljs from 'sql.js';
|
|
4
|
+
|
|
5
|
+
import { Button } from '../button';
|
|
6
|
+
import { Skeleton } from '../skeleton';
|
|
7
|
+
|
|
8
|
+
interface SqlitePreviewProps {
|
|
9
|
+
url: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const loadTableData = async (
|
|
13
|
+
db: sqljs.Database,
|
|
14
|
+
tableName: string,
|
|
15
|
+
): Promise<{ values: sqljs.SqlValue[][] }> => {
|
|
16
|
+
void debug(`loading table data for ${tableName}`);
|
|
17
|
+
const dataResult = db.exec(`SELECT * FROM ${tableName}`);
|
|
18
|
+
void debug(`found ${dataResult[0].values.length} rows for ${tableName}`);
|
|
19
|
+
return { values: dataResult[0].values };
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const loadDatabase = async (
|
|
23
|
+
url: string,
|
|
24
|
+
): Promise<{
|
|
25
|
+
db: sqljs.Database;
|
|
26
|
+
tables: { name: string; columns: sqljs.SqlValue[]; count: number }[];
|
|
27
|
+
}> => {
|
|
28
|
+
void debug(`loading database from ${url}`);
|
|
29
|
+
const SQL = await sqljs.default({
|
|
30
|
+
locateFile: (file: string) => '/sqljs/sql-wasm.wasm',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const response = await fetch(url);
|
|
34
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
35
|
+
const db = new SQL.Database(new Uint8Array(arrayBuffer));
|
|
36
|
+
|
|
37
|
+
// Get list of tables
|
|
38
|
+
const tablesResult = db.exec(
|
|
39
|
+
"SELECT name FROM sqlite_master WHERE type='table'",
|
|
40
|
+
);
|
|
41
|
+
const tableNames = tablesResult[0].values.map((v) => v[0] as string);
|
|
42
|
+
void debug(`found ${tableNames.length} tables`);
|
|
43
|
+
void debug(`tables: ${tableNames.join(', ')}`);
|
|
44
|
+
const tables = tableNames.map((table) => {
|
|
45
|
+
const columnsResult = db.exec(`PRAGMA table_info(${table})`);
|
|
46
|
+
const columnNames = columnsResult[0].values.map((v) => v[1]);
|
|
47
|
+
const countResult = db.exec(`SELECT COUNT(*) FROM ${table}`);
|
|
48
|
+
const count = countResult[0].values[0][0] as number;
|
|
49
|
+
void debug(
|
|
50
|
+
`found columns ${columnNames.join(', ')} and ${count} rows for ${table}`,
|
|
51
|
+
);
|
|
52
|
+
return {
|
|
53
|
+
name: table,
|
|
54
|
+
columns: columnNames,
|
|
55
|
+
count,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return { db, tables };
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const SqlitePreview: React.FC<SqlitePreviewProps> = ({ url }) => {
|
|
63
|
+
const [selectedTable, setSelectedTable] = useState<string>();
|
|
64
|
+
const [error, setError] = useState<string>();
|
|
65
|
+
const [loading, setLoading] = useState(true);
|
|
66
|
+
const [loadingData, setLoadingData] = useState(false);
|
|
67
|
+
|
|
68
|
+
const [db, setDb] = useState<sqljs.Database | null>(null);
|
|
69
|
+
const [tables, setTables] = useState<
|
|
70
|
+
{ name: string; columns: sqljs.SqlValue[]; count: number }[]
|
|
71
|
+
>([]);
|
|
72
|
+
const [tableData, setTableData] = useState<{
|
|
73
|
+
columns: sqljs.SqlValue[];
|
|
74
|
+
rows: sqljs.SqlValue[][];
|
|
75
|
+
} | null>(null);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const init = async () => {
|
|
79
|
+
setLoading(true);
|
|
80
|
+
try {
|
|
81
|
+
const { db, tables } = await loadDatabase(url);
|
|
82
|
+
setDb(db);
|
|
83
|
+
setTables(tables);
|
|
84
|
+
if (tables.length > 0) {
|
|
85
|
+
setSelectedTable(tables[0].name);
|
|
86
|
+
}
|
|
87
|
+
} catch (error) {
|
|
88
|
+
setError(
|
|
89
|
+
error instanceof Error ? error.message : 'Failed to load database',
|
|
90
|
+
);
|
|
91
|
+
} finally {
|
|
92
|
+
setLoading(false);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
void init();
|
|
96
|
+
}, [url]);
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (db && selectedTable) {
|
|
100
|
+
setLoadingData(true);
|
|
101
|
+
loadTableData(db, selectedTable)
|
|
102
|
+
.then(({ values }) => {
|
|
103
|
+
const columns = tables.find(
|
|
104
|
+
(table) => table.name === selectedTable,
|
|
105
|
+
)?.columns;
|
|
106
|
+
if (!columns) {
|
|
107
|
+
setError('Table not found');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
setTableData({
|
|
111
|
+
columns,
|
|
112
|
+
rows: values,
|
|
113
|
+
});
|
|
114
|
+
})
|
|
115
|
+
.catch((error) => {
|
|
116
|
+
setError(
|
|
117
|
+
error instanceof Error
|
|
118
|
+
? error.message
|
|
119
|
+
: 'Failed to load table data',
|
|
120
|
+
);
|
|
121
|
+
})
|
|
122
|
+
.finally(() => {
|
|
123
|
+
setLoadingData(false);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}, [db, selectedTable, tables]);
|
|
127
|
+
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
return () => {
|
|
130
|
+
if (db) {
|
|
131
|
+
void debug('closing database connection');
|
|
132
|
+
db.close();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}, [db]);
|
|
136
|
+
|
|
137
|
+
if (error) {
|
|
138
|
+
return (
|
|
139
|
+
<div className="p-4 text-red-500">Error loading database: {error}</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (loading) {
|
|
144
|
+
return (
|
|
145
|
+
<div className="flex flex-col gap-4 rounded-lg bg-gray-600 p-4">
|
|
146
|
+
<div className="flex gap-2">
|
|
147
|
+
<Skeleton className="h-8 w-24" />
|
|
148
|
+
<Skeleton className="h-8 w-24" />
|
|
149
|
+
</div>
|
|
150
|
+
<div className="space-y-2">
|
|
151
|
+
<Skeleton className="h-8 w-full" />
|
|
152
|
+
<Skeleton className="h-8 w-full" />
|
|
153
|
+
<Skeleton className="h-8 w-full" />
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<div className="flex flex-col gap-4 overflow-y-hidden rounded-lg bg-gray-600 p-4">
|
|
161
|
+
<div className="flex flex-wrap gap-2">
|
|
162
|
+
{tables.map((table) => (
|
|
163
|
+
<Button
|
|
164
|
+
key={table.name}
|
|
165
|
+
onClick={() => setSelectedTable(table.name)}
|
|
166
|
+
size="sm"
|
|
167
|
+
variant={selectedTable === table.name ? 'default' : 'outline'}
|
|
168
|
+
>
|
|
169
|
+
{table.name} ({table.count})
|
|
170
|
+
</Button>
|
|
171
|
+
))}
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
{selectedTable && (
|
|
175
|
+
<div className="max-h-full min-h-fit overflow-y-auto">
|
|
176
|
+
<div className="overflow-x-auto">
|
|
177
|
+
{loadingData ? (
|
|
178
|
+
<div className="space-y-2">
|
|
179
|
+
<Skeleton className="h-8 w-full" />
|
|
180
|
+
<Skeleton className="h-8 w-full" />
|
|
181
|
+
<Skeleton className="h-8 w-full" />
|
|
182
|
+
</div>
|
|
183
|
+
) : (
|
|
184
|
+
<table className="w-full text-left text-sm">
|
|
185
|
+
<thead className="sticky top-0 bg-gray-600">
|
|
186
|
+
<tr className="border-b border-gray-500">
|
|
187
|
+
{tableData?.columns.map((column) => (
|
|
188
|
+
<th
|
|
189
|
+
className="p-2 font-medium text-gray-300"
|
|
190
|
+
key={String(column)}
|
|
191
|
+
>
|
|
192
|
+
{String(column)}
|
|
193
|
+
</th>
|
|
194
|
+
))}
|
|
195
|
+
</tr>
|
|
196
|
+
</thead>
|
|
197
|
+
<tbody>
|
|
198
|
+
{tableData?.rows.map((row, i) => (
|
|
199
|
+
<tr className="border-b border-gray-700" key={i}>
|
|
200
|
+
{row.map((cell, j) => (
|
|
201
|
+
<td className="text-text-secondary p-2" key={j}>
|
|
202
|
+
{String(cell)}
|
|
203
|
+
</td>
|
|
204
|
+
))}
|
|
205
|
+
</tr>
|
|
206
|
+
))}
|
|
207
|
+
</tbody>
|
|
208
|
+
</table>
|
|
209
|
+
)}
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
)}
|
|
213
|
+
</div>
|
|
214
|
+
);
|
|
215
|
+
};
|
package/primitives/checkbox.tsx
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import { Check } from 'lucide-react'
|
|
1
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
|
+
import { CheckIcon } from '@radix-ui/react-icons';
|
|
3
|
+
import * as React from 'react';
|
|
5
4
|
|
|
6
|
-
import { cn } from '../
|
|
5
|
+
import { cn } from '../src/utils';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
type CheckboxProps = React.ComponentPropsWithoutRef<
|
|
8
|
+
typeof CheckboxPrimitive.Root
|
|
9
|
+
> & {
|
|
10
|
+
ref?: React.RefObject<React.ComponentRef<typeof CheckboxPrimitive.Root>>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Checkbox = ({ className, ref, ...props }: CheckboxProps) => (
|
|
12
14
|
<CheckboxPrimitive.Root
|
|
13
|
-
ref={ref}
|
|
14
15
|
className={cn(
|
|
15
|
-
'peer h-4 w-4 shrink-0 rounded-
|
|
16
|
-
|
|
17
|
-
'focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ' +
|
|
18
|
-
'data-[state=checked]:bg-primary data-[state=checked]:text-primary-fg',
|
|
19
|
-
className
|
|
16
|
+
'focus-visible:ring-ring data-[state=checked]:bg-brand data-[state=checked]:border-brand peer h-4 w-4 shrink-0 rounded-xs border border-gray-400 shadow-sm focus-visible:ring-1 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:text-black',
|
|
17
|
+
className,
|
|
20
18
|
)}
|
|
19
|
+
ref={ref}
|
|
21
20
|
{...props}
|
|
22
21
|
>
|
|
23
22
|
<CheckboxPrimitive.Indicator
|
|
24
23
|
className={cn('flex items-center justify-center text-current')}
|
|
25
24
|
>
|
|
26
|
-
<
|
|
25
|
+
<CheckIcon className="h-3.5 w-3.5" />
|
|
27
26
|
</CheckboxPrimitive.Indicator>
|
|
28
27
|
</CheckboxPrimitive.Root>
|
|
29
|
-
)
|
|
30
|
-
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
|
28
|
+
);
|
|
29
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
31
30
|
|
|
32
|
-
export
|
|
31
|
+
export { Checkbox };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
2
|
+
|
|
3
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
4
|
+
|
|
5
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
6
|
+
|
|
7
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
8
|
+
|
|
9
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
package/primitives/command.tsx
CHANGED
|
@@ -1,132 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import { DialogProps } from '@radix-ui/react-dialog';
|
|
2
|
+
import { Command as CommandPrimitive } from 'cmdk';
|
|
3
|
+
import { Search } from 'lucide-react';
|
|
4
|
+
import * as React from 'react';
|
|
3
5
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Search } from "lucide-react"
|
|
6
|
+
import { cn } from '../src/utils';
|
|
7
|
+
import { Dialog, DialogContent } from './dialog';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
React.ElementRef<typeof CommandPrimitive>,
|
|
13
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
14
|
-
>(({ className, ...props }, ref) => (
|
|
9
|
+
const Command = ({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof CommandPrimitive>) => (
|
|
15
13
|
<CommandPrimitive
|
|
16
|
-
ref={ref}
|
|
17
14
|
className={cn(
|
|
18
|
-
|
|
19
|
-
className
|
|
15
|
+
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md [&_[cmdk-list]]:scroll-pt-0 [&_[cmdk-list]]:scroll-auto',
|
|
16
|
+
className,
|
|
20
17
|
)}
|
|
18
|
+
loop={true}
|
|
21
19
|
{...props}
|
|
22
20
|
/>
|
|
23
|
-
)
|
|
24
|
-
Command.displayName = CommandPrimitive.displayName
|
|
21
|
+
);
|
|
22
|
+
Command.displayName = CommandPrimitive.displayName;
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
type CommandDialogProps = DialogProps;
|
|
27
25
|
|
|
28
26
|
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
|
|
29
27
|
return (
|
|
30
28
|
<Dialog {...props}>
|
|
31
29
|
<DialogContent className="overflow-hidden p-0 shadow-lg">
|
|
32
|
-
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group
|
|
30
|
+
<Command className="[&_[cmdk-group-heading]]:text-text-secondary [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[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">
|
|
33
31
|
{children}
|
|
34
32
|
</Command>
|
|
35
33
|
</DialogContent>
|
|
36
34
|
</Dialog>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
39
37
|
|
|
40
|
-
const CommandInput =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const CommandInput = ({
|
|
39
|
+
className,
|
|
40
|
+
ref,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) => (
|
|
44
43
|
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
|
45
44
|
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
46
45
|
<CommandPrimitive.Input
|
|
47
|
-
ref={ref}
|
|
48
46
|
className={cn(
|
|
49
|
-
|
|
50
|
-
className
|
|
47
|
+
'placeholder:!text-text-placeholder flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
|
|
48
|
+
className,
|
|
51
49
|
)}
|
|
50
|
+
ref={ref}
|
|
52
51
|
{...props}
|
|
53
52
|
/>
|
|
54
53
|
</div>
|
|
55
|
-
)
|
|
54
|
+
);
|
|
56
55
|
|
|
57
|
-
CommandInput.displayName = CommandPrimitive.Input.displayName
|
|
56
|
+
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
58
57
|
|
|
59
|
-
const CommandList =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
const CommandList = ({
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) => (
|
|
63
62
|
<CommandPrimitive.List
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
className={cn(
|
|
64
|
+
'max-h-[300px] scroll-pt-0 overflow-x-hidden overflow-y-auto scroll-auto',
|
|
65
|
+
className,
|
|
66
|
+
)}
|
|
66
67
|
{...props}
|
|
67
68
|
/>
|
|
68
|
-
)
|
|
69
|
+
);
|
|
69
70
|
|
|
70
|
-
CommandList.displayName = CommandPrimitive.List.displayName
|
|
71
|
+
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
71
72
|
|
|
72
|
-
const CommandEmpty =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
>
|
|
76
|
-
<CommandPrimitive.Empty
|
|
77
|
-
|
|
78
|
-
className="py-6 text-center text-sm"
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
))
|
|
73
|
+
const CommandEmpty = ({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) => (
|
|
77
|
+
<CommandPrimitive.Empty className="py-6 text-center text-sm" {...props} />
|
|
78
|
+
);
|
|
82
79
|
|
|
83
|
-
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
|
80
|
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
84
81
|
|
|
85
|
-
const CommandGroup =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
const CommandGroup = ({
|
|
83
|
+
className,
|
|
84
|
+
...props
|
|
85
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) => (
|
|
89
86
|
<CommandPrimitive.Group
|
|
90
|
-
ref={ref}
|
|
91
87
|
className={cn(
|
|
92
|
-
|
|
93
|
-
className
|
|
88
|
+
'text-text-default [&_[cmdk-group-heading]]:text-text-default overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',
|
|
89
|
+
className,
|
|
94
90
|
)}
|
|
95
91
|
{...props}
|
|
96
92
|
/>
|
|
97
|
-
)
|
|
93
|
+
);
|
|
98
94
|
|
|
99
|
-
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
|
95
|
+
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
100
96
|
|
|
101
|
-
const CommandSeparator =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
const CommandSeparator = ({
|
|
98
|
+
className,
|
|
99
|
+
...props
|
|
100
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) => (
|
|
105
101
|
<CommandPrimitive.Separator
|
|
106
|
-
|
|
107
|
-
className={cn("-mx-1 h-px bg-border", className)}
|
|
102
|
+
className={cn('bg-divider -mx-1 h-px', className)}
|
|
108
103
|
{...props}
|
|
109
104
|
/>
|
|
110
|
-
)
|
|
111
|
-
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
|
105
|
+
);
|
|
106
|
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
112
107
|
|
|
113
|
-
const CommandItem =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
const CommandItem = ({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) => (
|
|
117
112
|
<CommandPrimitive.Item
|
|
118
|
-
ref={ref}
|
|
119
113
|
className={cn(
|
|
120
|
-
'relative flex cursor-default
|
|
121
|
-
|
|
122
|
-
'data-[disabled]:pointer-events-none data-[disabled]:opacity-35',
|
|
123
|
-
className
|
|
114
|
+
"hover:bg-bg-secondary data-[selected=true]:text-text-default data-[selected='true']:bg-bg-secondary relative flex cursor-default items-center rounded-xs px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
115
|
+
className,
|
|
124
116
|
)}
|
|
125
117
|
{...props}
|
|
126
118
|
/>
|
|
127
|
-
)
|
|
119
|
+
);
|
|
128
120
|
|
|
129
|
-
CommandItem.displayName = CommandPrimitive.Item.displayName
|
|
121
|
+
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
130
122
|
|
|
131
123
|
const CommandShortcut = ({
|
|
132
124
|
className,
|
|
@@ -135,14 +127,14 @@ const CommandShortcut = ({
|
|
|
135
127
|
return (
|
|
136
128
|
<span
|
|
137
129
|
className={cn(
|
|
138
|
-
|
|
139
|
-
className
|
|
130
|
+
'text-text-secondary ml-auto text-xs tracking-widest',
|
|
131
|
+
className,
|
|
140
132
|
)}
|
|
141
133
|
{...props}
|
|
142
134
|
/>
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
CommandShortcut.displayName =
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
CommandShortcut.displayName = 'CommandShortcut';
|
|
146
138
|
|
|
147
139
|
export {
|
|
148
140
|
Command,
|
|
@@ -154,4 +146,4 @@ export {
|
|
|
154
146
|
CommandItem,
|
|
155
147
|
CommandShortcut,
|
|
156
148
|
CommandSeparator,
|
|
157
|
-
}
|
|
149
|
+
};
|