@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.
Files changed (156) hide show
  1. package/README-MCP.md +3 -3
  2. package/README.md +229 -0
  3. package/assets/ai-icons.tsx +207 -0
  4. package/assets/crypto.tsx +33 -0
  5. package/assets/file-type-icon.tsx +66 -0
  6. package/assets/file.tsx +45 -0
  7. package/assets/general.tsx +2318 -0
  8. package/assets/hanzo-logo.svg +9 -0
  9. package/assets/hanzo-logo.tsx +15 -0
  10. package/assets/index.ts +8 -0
  11. package/assets/index.tsx +4 -0
  12. package/assets/llm-provider.tsx +1094 -0
  13. package/bin/create-registry.js +1 -1
  14. package/bin/test-mcp.sh +1 -1
  15. package/bin/update-registry.js +2 -2
  16. package/blocks/components/content.tsx +1 -1
  17. package/blocks/components/grid-block/index.tsx +1 -1
  18. package/blocks/components/screenful-block/content.tsx +1 -1
  19. package/blocks/components/screenful-block/poster-background.tsx +1 -1
  20. package/components/index.ts +56 -0
  21. package/dist/button.d.ts +1 -0
  22. package/dist/button.js +1 -0
  23. package/dist/hooks/index.d.ts +7 -0
  24. package/dist/hooks/index.js +7 -0
  25. package/dist/hooks/use-click-away.d.ts +2 -0
  26. package/dist/hooks/use-click-away.js +23 -0
  27. package/dist/hooks/use-combined-refs.d.ts +3 -0
  28. package/dist/hooks/use-combined-refs.js +18 -0
  29. package/dist/hooks/use-copy-clipboard.d.ts +9 -0
  30. package/dist/hooks/use-copy-clipboard.js +21 -0
  31. package/dist/hooks/use-debounce.d.ts +1 -0
  32. package/dist/hooks/use-debounce.js +13 -0
  33. package/dist/hooks/use-fill-ids.d.ts +8 -0
  34. package/dist/hooks/use-fill-ids.js +20 -0
  35. package/dist/hooks/use-map.d.ts +1 -0
  36. package/dist/hooks/use-map.js +20 -0
  37. package/dist/hooks/use-measure.d.ts +8 -0
  38. package/dist/hooks/use-measure.js +25 -0
  39. package/dist/hooks/use-reverse-video-playback.d.ts +1 -0
  40. package/dist/hooks/use-reverse-video-playback.js +41 -0
  41. package/dist/hooks/use-scroll-restoration.d.ts +8 -0
  42. package/dist/hooks/use-scroll-restoration.js +36 -0
  43. package/dist/mcp/enhanced-server.js +2 -2
  44. package/dist/registry/api.d.ts +1 -1
  45. package/dist/registry/api.js +3 -3
  46. package/dist/registry/index.d.ts +48 -48
  47. package/dist/registry/index.js +3 -3
  48. package/dist/utils.d.ts +1 -0
  49. package/dist/utils.js +1 -0
  50. package/helpers/file.ts +33 -0
  51. package/helpers/memoization.ts +40 -0
  52. package/package.json +27 -6
  53. package/primitives/accordion.tsx +53 -45
  54. package/primitives/alert-dialog.tsx +185 -0
  55. package/primitives/alert.tsx +74 -0
  56. package/primitives/apply-typography.tsx +1 -1
  57. package/primitives/avatar.tsx +37 -29
  58. package/primitives/background-beams.tsx +142 -0
  59. package/primitives/badge.tsx +27 -19
  60. package/primitives/breadcrumb.tsx +77 -62
  61. package/primitives/button.tsx +69 -72
  62. package/primitives/card.tsx +73 -59
  63. package/primitives/chat/chat-input-area.tsx +87 -0
  64. package/primitives/chat/chat-input.tsx +71 -0
  65. package/primitives/chat/files-preview.tsx +330 -0
  66. package/primitives/chat/index.ts +6 -0
  67. package/primitives/chat/json-form.tsx +8 -0
  68. package/primitives/chat/message-list.tsx +307 -0
  69. package/primitives/chat/message.tsx +569 -0
  70. package/primitives/chat/sqlite-preview.tsx +215 -0
  71. package/primitives/checkbox.tsx +18 -19
  72. package/primitives/collapsible.tsx +9 -0
  73. package/primitives/command.tsx +75 -83
  74. package/primitives/context-menu.tsx +115 -109
  75. package/primitives/copy-to-clipboard-icon.tsx +60 -0
  76. package/primitives/dialog-video-controller.tsx +1 -1
  77. package/primitives/dialog.tsx +111 -145
  78. package/primitives/dot-pattern.tsx +57 -0
  79. package/primitives/dots-loader.tsx +13 -0
  80. package/primitives/drawer.tsx +59 -87
  81. package/primitives/dropdown-menu.tsx +199 -0
  82. package/primitives/error-message.tsx +19 -0
  83. package/primitives/file-uploader.tsx +200 -0
  84. package/primitives/form.tsx +92 -87
  85. package/primitives/hover-card.tsx +28 -0
  86. package/primitives/icons/github.tsx +1 -1
  87. package/primitives/icons/youtube-logo.tsx +1 -1
  88. package/primitives/index-common.ts +121 -42
  89. package/primitives/index-next.ts +3 -1
  90. package/primitives/input.tsx +115 -20
  91. package/primitives/label.tsx +15 -23
  92. package/primitives/loading-spinner.tsx +1 -1
  93. package/primitives/markdown-preview.tsx +609 -0
  94. package/primitives/mermaid.tsx +196 -0
  95. package/primitives/next/link-element.tsx +1 -1
  96. package/primitives/next/mdx-link.tsx +1 -1
  97. package/primitives/pagination.tsx +117 -0
  98. package/primitives/popover.tsx +20 -25
  99. package/primitives/pretty-json-print.tsx +28 -0
  100. package/primitives/progress.tsx +14 -15
  101. package/primitives/prompt-textarea.tsx +72 -0
  102. package/primitives/qr-code.tsx +112 -0
  103. package/primitives/radio-group.tsx +25 -39
  104. package/primitives/resizable.tsx +47 -0
  105. package/primitives/scroll-area.tsx +35 -25
  106. package/primitives/search-input.tsx +66 -0
  107. package/primitives/select.tsx +62 -109
  108. package/primitives/separator.tsx +22 -26
  109. package/primitives/sheet.tsx +78 -117
  110. package/primitives/skeleton.tsx +13 -16
  111. package/primitives/slider.tsx +50 -60
  112. package/primitives/stepper.tsx +272 -0
  113. package/primitives/switch.tsx +14 -23
  114. package/primitives/table.tsx +65 -77
  115. package/primitives/tabs.tsx +29 -39
  116. package/primitives/text-link.tsx +25 -0
  117. package/primitives/textarea.tsx +61 -0
  118. package/primitives/textfield.tsx +75 -0
  119. package/primitives/toast.tsx +30 -0
  120. package/primitives/toggle-group.tsx +33 -33
  121. package/primitives/toggle.tsx +22 -51
  122. package/primitives/tooltip.tsx +37 -38
  123. package/registry.json +1 -1
  124. package/src/button.ts +1 -0
  125. package/src/hooks/index.ts +7 -0
  126. package/src/hooks/use-click-away.ts +31 -0
  127. package/src/hooks/use-combined-refs.ts +22 -0
  128. package/src/hooks/use-copy-clipboard.ts +30 -0
  129. package/src/hooks/use-debounce.ts +17 -0
  130. package/src/hooks/use-fill-ids.ts +25 -0
  131. package/src/hooks/use-map.ts +26 -0
  132. package/src/hooks/use-measure.ts +42 -0
  133. package/src/hooks/use-reverse-video-playback.ts +43 -0
  134. package/src/hooks/use-scroll-restoration.ts +50 -0
  135. package/src/mcp/README.md +1 -1
  136. package/src/mcp/enhanced-server.ts +2 -2
  137. package/src/registry/api.ts +3 -3
  138. package/src/registry/index.ts +3 -3
  139. package/src/utils.ts +1 -0
  140. package/style/theme-provider.tsx +1 -1
  141. package/test-imports.mjs +19 -0
  142. package/types/animation-def.ts +1 -1
  143. package/types/button-def.ts +1 -1
  144. package/types/index.ts +1 -1
  145. package/util/blob.ts +28 -0
  146. package/util/copy-to-clipboard.ts +17 -0
  147. package/util/create-shadow-root.ts +22 -0
  148. package/util/date.ts +83 -0
  149. package/util/debounce.ts +11 -0
  150. package/util/file.ts +15 -0
  151. package/util/format-and-abbreviate-as-currency.ts +1 -1
  152. package/util/format-text.ts +33 -0
  153. package/util/index.ts +9 -78
  154. package/util/timing.ts +3 -0
  155. package/util/toasts.tsx +17 -0
  156. package/utils.ts +9 -0
@@ -5,13 +5,13 @@ export declare const fileSchema: z.ZodObject<{
5
5
  type: z.ZodString;
6
6
  target: z.ZodOptional<z.ZodString>;
7
7
  }, "strip", z.ZodTypeAny, {
8
- path: string;
9
8
  type: string;
9
+ path: string;
10
10
  content?: string | undefined;
11
11
  target?: string | undefined;
12
12
  }, {
13
- path: string;
14
13
  type: string;
14
+ path: string;
15
15
  content?: string | undefined;
16
16
  target?: string | undefined;
17
17
  }>;
@@ -29,13 +29,13 @@ export declare const registryItemSchema: z.ZodObject<{
29
29
  type: z.ZodString;
30
30
  target: z.ZodOptional<z.ZodString>;
31
31
  }, "strip", z.ZodTypeAny, {
32
- path: string;
33
32
  type: string;
33
+ path: string;
34
34
  content?: string | undefined;
35
35
  target?: string | undefined;
36
36
  }, {
37
- path: string;
38
37
  type: string;
38
+ path: string;
39
39
  content?: string | undefined;
40
40
  target?: string | undefined;
41
41
  }>, "many">>;
@@ -46,41 +46,41 @@ export declare const registryItemSchema: z.ZodObject<{
46
46
  category: z.ZodOptional<z.ZodString>;
47
47
  subcategory: z.ZodOptional<z.ZodString>;
48
48
  }, "strip", z.ZodTypeAny, {
49
- type: string;
50
49
  name: string;
50
+ type: string;
51
+ title?: string | undefined;
51
52
  description?: string | undefined;
52
53
  author?: string | undefined;
53
54
  dependencies?: string[] | undefined;
54
55
  devDependencies?: string[] | undefined;
55
56
  registryDependencies?: string[] | undefined;
56
57
  files?: {
57
- path: string;
58
58
  type: string;
59
+ path: string;
59
60
  content?: string | undefined;
60
61
  target?: string | undefined;
61
62
  }[] | undefined;
62
63
  meta?: Record<string, any> | undefined;
63
- title?: string | undefined;
64
64
  cssVars?: Record<string, any> | undefined;
65
65
  tailwind?: Record<string, any> | undefined;
66
66
  category?: string | undefined;
67
67
  subcategory?: string | undefined;
68
68
  }, {
69
- type: string;
70
69
  name: string;
70
+ type: string;
71
+ title?: string | undefined;
71
72
  description?: string | undefined;
72
73
  author?: string | undefined;
73
74
  dependencies?: string[] | undefined;
74
75
  devDependencies?: string[] | undefined;
75
76
  registryDependencies?: string[] | undefined;
76
77
  files?: {
77
- path: string;
78
78
  type: string;
79
+ path: string;
79
80
  content?: string | undefined;
80
81
  target?: string | undefined;
81
82
  }[] | undefined;
82
83
  meta?: Record<string, any> | undefined;
83
- title?: string | undefined;
84
84
  cssVars?: Record<string, any> | undefined;
85
85
  tailwind?: Record<string, any> | undefined;
86
86
  category?: string | undefined;
@@ -105,13 +105,13 @@ export declare const registrySchema: z.ZodObject<{
105
105
  type: z.ZodString;
106
106
  target: z.ZodOptional<z.ZodString>;
107
107
  }, "strip", z.ZodTypeAny, {
108
- path: string;
109
108
  type: string;
109
+ path: string;
110
110
  content?: string | undefined;
111
111
  target?: string | undefined;
112
112
  }, {
113
- path: string;
114
113
  type: string;
114
+ path: string;
115
115
  content?: string | undefined;
116
116
  target?: string | undefined;
117
117
  }>, "many">>;
@@ -122,41 +122,41 @@ export declare const registrySchema: z.ZodObject<{
122
122
  category: z.ZodOptional<z.ZodString>;
123
123
  subcategory: z.ZodOptional<z.ZodString>;
124
124
  }, "strip", z.ZodTypeAny, {
125
- type: string;
126
125
  name: string;
126
+ type: string;
127
+ title?: string | undefined;
127
128
  description?: string | undefined;
128
129
  author?: string | undefined;
129
130
  dependencies?: string[] | undefined;
130
131
  devDependencies?: string[] | undefined;
131
132
  registryDependencies?: string[] | undefined;
132
133
  files?: {
133
- path: string;
134
134
  type: string;
135
+ path: string;
135
136
  content?: string | undefined;
136
137
  target?: string | undefined;
137
138
  }[] | undefined;
138
139
  meta?: Record<string, any> | undefined;
139
- title?: string | undefined;
140
140
  cssVars?: Record<string, any> | undefined;
141
141
  tailwind?: Record<string, any> | undefined;
142
142
  category?: string | undefined;
143
143
  subcategory?: string | undefined;
144
144
  }, {
145
- type: string;
146
145
  name: string;
146
+ type: string;
147
+ title?: string | undefined;
147
148
  description?: string | undefined;
148
149
  author?: string | undefined;
149
150
  dependencies?: string[] | undefined;
150
151
  devDependencies?: string[] | undefined;
151
152
  registryDependencies?: string[] | undefined;
152
153
  files?: {
153
- path: string;
154
154
  type: string;
155
+ path: string;
155
156
  content?: string | undefined;
156
157
  target?: string | undefined;
157
158
  }[] | undefined;
158
159
  meta?: Record<string, any> | undefined;
159
- title?: string | undefined;
160
160
  cssVars?: Record<string, any> | undefined;
161
161
  tailwind?: Record<string, any> | undefined;
162
162
  category?: string | undefined;
@@ -165,55 +165,55 @@ export declare const registrySchema: z.ZodObject<{
165
165
  }, "strip", z.ZodTypeAny, {
166
166
  name: string;
167
167
  items: {
168
- type: string;
169
168
  name: string;
169
+ type: string;
170
+ title?: string | undefined;
170
171
  description?: string | undefined;
171
172
  author?: string | undefined;
172
173
  dependencies?: string[] | undefined;
173
174
  devDependencies?: string[] | undefined;
174
175
  registryDependencies?: string[] | undefined;
175
176
  files?: {
176
- path: string;
177
177
  type: string;
178
+ path: string;
178
179
  content?: string | undefined;
179
180
  target?: string | undefined;
180
181
  }[] | undefined;
181
182
  meta?: Record<string, any> | undefined;
182
- title?: string | undefined;
183
183
  cssVars?: Record<string, any> | undefined;
184
184
  tailwind?: Record<string, any> | undefined;
185
185
  category?: string | undefined;
186
186
  subcategory?: string | undefined;
187
187
  }[];
188
+ style?: string | undefined;
188
189
  $schema?: string | undefined;
189
190
  homepage?: string | undefined;
190
- style?: string | undefined;
191
191
  }, {
192
192
  name: string;
193
193
  items: {
194
- type: string;
195
194
  name: string;
195
+ type: string;
196
+ title?: string | undefined;
196
197
  description?: string | undefined;
197
198
  author?: string | undefined;
198
199
  dependencies?: string[] | undefined;
199
200
  devDependencies?: string[] | undefined;
200
201
  registryDependencies?: string[] | undefined;
201
202
  files?: {
202
- path: string;
203
203
  type: string;
204
+ path: string;
204
205
  content?: string | undefined;
205
206
  target?: string | undefined;
206
207
  }[] | undefined;
207
208
  meta?: Record<string, any> | undefined;
208
- title?: string | undefined;
209
209
  cssVars?: Record<string, any> | undefined;
210
210
  tailwind?: Record<string, any> | undefined;
211
211
  category?: string | undefined;
212
212
  subcategory?: string | undefined;
213
213
  }[];
214
+ style?: string | undefined;
214
215
  $schema?: string | undefined;
215
216
  homepage?: string | undefined;
216
- style?: string | undefined;
217
217
  }>;
218
218
  export declare const registryWithContentSchema: z.ZodObject<{
219
219
  $schema: z.ZodOptional<z.ZodString>;
@@ -243,52 +243,52 @@ export declare const registryWithContentSchema: z.ZodObject<{
243
243
  } & {
244
244
  content: z.ZodString;
245
245
  }, "strip", z.ZodTypeAny, {
246
- path: string;
247
- content: string;
248
246
  type: string;
247
+ content: string;
248
+ path: string;
249
249
  target?: string | undefined;
250
250
  }, {
251
- path: string;
252
- content: string;
253
251
  type: string;
252
+ content: string;
253
+ path: string;
254
254
  target?: string | undefined;
255
255
  }>, "many">;
256
256
  }, "strip", z.ZodTypeAny, {
257
- type: string;
258
257
  name: string;
258
+ type: string;
259
259
  files: {
260
- path: string;
261
- content: string;
262
260
  type: string;
261
+ content: string;
262
+ path: string;
263
263
  target?: string | undefined;
264
264
  }[];
265
+ title?: string | undefined;
265
266
  description?: string | undefined;
266
267
  author?: string | undefined;
267
268
  dependencies?: string[] | undefined;
268
269
  devDependencies?: string[] | undefined;
269
270
  registryDependencies?: string[] | undefined;
270
271
  meta?: Record<string, any> | undefined;
271
- title?: string | undefined;
272
272
  cssVars?: Record<string, any> | undefined;
273
273
  tailwind?: Record<string, any> | undefined;
274
274
  category?: string | undefined;
275
275
  subcategory?: string | undefined;
276
276
  }, {
277
- type: string;
278
277
  name: string;
278
+ type: string;
279
279
  files: {
280
- path: string;
281
- content: string;
282
280
  type: string;
281
+ content: string;
282
+ path: string;
283
283
  target?: string | undefined;
284
284
  }[];
285
+ title?: string | undefined;
285
286
  description?: string | undefined;
286
287
  author?: string | undefined;
287
288
  dependencies?: string[] | undefined;
288
289
  devDependencies?: string[] | undefined;
289
290
  registryDependencies?: string[] | undefined;
290
291
  meta?: Record<string, any> | undefined;
291
- title?: string | undefined;
292
292
  cssVars?: Record<string, any> | undefined;
293
293
  tailwind?: Record<string, any> | undefined;
294
294
  category?: string | undefined;
@@ -297,55 +297,55 @@ export declare const registryWithContentSchema: z.ZodObject<{
297
297
  }, "strip", z.ZodTypeAny, {
298
298
  name: string;
299
299
  items: {
300
- type: string;
301
300
  name: string;
301
+ type: string;
302
302
  files: {
303
- path: string;
304
- content: string;
305
303
  type: string;
304
+ content: string;
305
+ path: string;
306
306
  target?: string | undefined;
307
307
  }[];
308
+ title?: string | undefined;
308
309
  description?: string | undefined;
309
310
  author?: string | undefined;
310
311
  dependencies?: string[] | undefined;
311
312
  devDependencies?: string[] | undefined;
312
313
  registryDependencies?: string[] | undefined;
313
314
  meta?: Record<string, any> | undefined;
314
- title?: string | undefined;
315
315
  cssVars?: Record<string, any> | undefined;
316
316
  tailwind?: Record<string, any> | undefined;
317
317
  category?: string | undefined;
318
318
  subcategory?: string | undefined;
319
319
  }[];
320
+ style?: string | undefined;
320
321
  $schema?: string | undefined;
321
322
  homepage?: string | undefined;
322
- style?: string | undefined;
323
323
  }, {
324
324
  name: string;
325
325
  items: {
326
- type: string;
327
326
  name: string;
327
+ type: string;
328
328
  files: {
329
- path: string;
330
- content: string;
331
329
  type: string;
330
+ content: string;
331
+ path: string;
332
332
  target?: string | undefined;
333
333
  }[];
334
+ title?: string | undefined;
334
335
  description?: string | undefined;
335
336
  author?: string | undefined;
336
337
  dependencies?: string[] | undefined;
337
338
  devDependencies?: string[] | undefined;
338
339
  registryDependencies?: string[] | undefined;
339
340
  meta?: Record<string, any> | undefined;
340
- title?: string | undefined;
341
341
  cssVars?: Record<string, any> | undefined;
342
342
  tailwind?: Record<string, any> | undefined;
343
343
  category?: string | undefined;
344
344
  subcategory?: string | undefined;
345
345
  }[];
346
+ style?: string | undefined;
346
347
  $schema?: string | undefined;
347
348
  homepage?: string | undefined;
348
- style?: string | undefined;
349
349
  }>;
350
350
  export type RegistryItem = z.infer<typeof registryItemSchema>;
351
351
  export type Registry = z.infer<typeof registrySchema>;
@@ -1,12 +1,12 @@
1
1
  import { z } from "zod";
2
- // Define the file schema to match shadcn/ui's format
2
+ // Define the file schema to match hanzo/ui's format
3
3
  export const fileSchema = z.object({
4
4
  path: z.string(),
5
5
  content: z.string().optional(),
6
6
  type: z.string(),
7
7
  target: z.string().optional(),
8
8
  });
9
- // Registry item schema aligned with shadcn/ui format
9
+ // Registry item schema aligned with hanzo/ui format
10
10
  export const registryItemSchema = z.object({
11
11
  name: z.string(),
12
12
  type: z.string(),
@@ -23,7 +23,7 @@ export const registryItemSchema = z.object({
23
23
  category: z.string().optional(),
24
24
  subcategory: z.string().optional(),
25
25
  });
26
- // Registry schema aligned with shadcn/ui format
26
+ // Registry schema aligned with hanzo/ui format
27
27
  export const registrySchema = z.object({
28
28
  $schema: z.string().optional(),
29
29
  name: z.string(),
@@ -0,0 +1 @@
1
+ export * from '../../../app/lib/utils';
package/dist/utils.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../../../app/lib/utils';
@@ -0,0 +1,33 @@
1
+ export const getFileExt = (fileName: string): string => {
2
+ if (!fileName) return '';
3
+ const parts = fileName.split('.');
4
+ return parts.length > 1 ? parts[parts.length - 1].toLowerCase() : '';
5
+ };
6
+
7
+ export const formatFileSize = (bytes: number): string => {
8
+ if (bytes === 0) return '0 Bytes';
9
+ const k = 1024;
10
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
11
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
12
+ return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];
13
+ };
14
+
15
+ export const isImageFile = (fileName: string): boolean => {
16
+ const ext = getFileExt(fileName);
17
+ return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp'].includes(ext);
18
+ };
19
+
20
+ export const isPdfFile = (fileName: string): boolean => {
21
+ const ext = getFileExt(fileName);
22
+ return ext === 'pdf';
23
+ };
24
+
25
+ export const isVideoFile = (fileName: string): boolean => {
26
+ const ext = getFileExt(fileName);
27
+ return ['mp4', 'avi', 'mov', 'wmv', 'flv', 'mkv', 'webm'].includes(ext);
28
+ };
29
+
30
+ export const isAudioFile = (fileName: string): boolean => {
31
+ const ext = getFileExt(fileName);
32
+ return ['mp3', 'wav', 'ogg', 'aac', 'flac', 'wma'].includes(ext);
33
+ };
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+
3
+ // Memoization helpers for markdown components
4
+ export const memoCompareNodes = (
5
+ prevProps: { children?: React.ReactNode },
6
+ nextProps: { children?: React.ReactNode }
7
+ ): boolean => {
8
+ return prevProps.children === nextProps.children;
9
+ };
10
+
11
+ export const memoizeMarkdownComponents = <T extends Record<string, React.ComponentType<any>>>(
12
+ components: T
13
+ ): T => {
14
+ const memoized: any = {};
15
+
16
+ for (const key in components) {
17
+ if (components.hasOwnProperty(key)) {
18
+ memoized[key] = React.memo(components[key]);
19
+ }
20
+ }
21
+
22
+ return memoized as T;
23
+ };
24
+
25
+ // Helper to check if props are equal for memoization
26
+ export const arePropsEqual = <T extends Record<string, any>>(
27
+ prevProps: T,
28
+ nextProps: T,
29
+ keys?: string[]
30
+ ): boolean => {
31
+ const keysToCheck = keys || Object.keys(prevProps);
32
+
33
+ for (const key of keysToCheck) {
34
+ if (prevProps[key] !== nextProps[key]) {
35
+ return false;
36
+ }
37
+ }
38
+
39
+ return true;
40
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "4.5.4",
3
+ "version": "4.6.0",
4
4
  "description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -42,18 +42,27 @@
42
42
  "hanzo-ui": "./bin/cli.js"
43
43
  },
44
44
  "exports": {
45
+ ".": {
46
+ "import": "./primitives/index-next.ts",
47
+ "require": "./primitives/index-common.ts",
48
+ "default": "./primitives/index-next.ts"
49
+ },
50
+ "./assets": "./assets/index.ts",
45
51
  "./blocks": "./blocks/index.ts",
52
+ "./components": "./components/index.ts",
46
53
  "./primitives": "./primitives/index-next.ts",
47
54
  "./primitives-common": "./primitives/index-common.ts",
48
55
  "./registry": {
49
56
  "types": "./dist/registry/index.d.ts",
50
57
  "default": "./dist/registry/index.js"
51
58
  },
52
- "./style/": "./style/*",
59
+ "./style/*": "./style/*",
53
60
  "./tailwind": "./tailwind/index.ts",
54
61
  "./types": "./types/index.ts",
55
62
  "./util": "./util/index.ts",
56
63
  "./util-client": "./util/index-client.ts",
64
+ "./utils": "./src/utils.ts",
65
+ "./lib/utils": "./src/utils.ts",
57
66
  "./mcp": {
58
67
  "types": "./dist/mcp/index.d.ts",
59
68
  "default": "./dist/mcp/index.js"
@@ -64,11 +73,15 @@
64
73
  "@modelcontextprotocol/sdk": "^1.10.2",
65
74
  "@next/third-parties": "^15.0.1",
66
75
  "@radix-ui/react-accordion": "^1.1.2",
76
+ "@radix-ui/react-alert-dialog": "^1.1.15",
67
77
  "@radix-ui/react-aspect-ratio": "^1.0.3",
68
78
  "@radix-ui/react-avatar": "^1.0.3",
69
79
  "@radix-ui/react-checkbox": "^1.0.4",
80
+ "@radix-ui/react-collapsible": "^1.1.12",
70
81
  "@radix-ui/react-context-menu": "^2.2.2",
71
82
  "@radix-ui/react-dialog": "^1.0.5",
83
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
84
+ "@radix-ui/react-hover-card": "^1.1.15",
72
85
  "@radix-ui/react-icons": "^1.3.0",
73
86
  "@radix-ui/react-label": "^2.0.2",
74
87
  "@radix-ui/react-navigation-menu": "^1.1.3",
@@ -86,26 +99,34 @@
86
99
  "@radix-ui/react-toggle": "^1.0.3",
87
100
  "@radix-ui/react-toggle-group": "^1.0.4",
88
101
  "@radix-ui/react-tooltip": "^1.0.6",
102
+ "@radix-ui/react-use-callback-ref": "^1.1.1",
89
103
  "@splinetool/react-spline": "^4.0.0",
90
104
  "@splinetool/runtime": "^1.9.35",
91
105
  "@tailwindcss/container-queries": "^0.1.1",
92
- "class-variance-authority": "^0.7.0",
93
- "clsx": "^2.1.0",
106
+ "class-variance-authority": "^0.7.1",
107
+ "clsx": "^2.1.1",
94
108
  "cmdk": "^0.2.0",
95
109
  "commander": "^12.1.0",
110
+ "date-fns": "^4.1.0",
96
111
  "embla-carousel-react": "8.5.1",
97
112
  "input-otp": "^1.0.1",
98
113
  "lodash.castarray": "^4.4.0",
99
114
  "lodash.isplainobject": "^4.0.6",
100
115
  "lodash.merge": "^4.6.2",
101
- "markdown-to-jsx": "^7.4.7",
116
+ "markdown-to-jsx": "^7.7.13",
117
+ "mermaid": "^11.12.0",
102
118
  "postcss-selector-parser": "^6.0.16",
119
+ "qrcode.react": "^4.2.0",
103
120
  "react-day-picker": "^8.10.1",
104
121
  "react-intersection-observer": "^9.8.2",
122
+ "react-resizable-panels": "^3.0.6",
105
123
  "sonner": "^1.4.41",
106
- "tailwind-merge": "^2.3.0",
124
+ "sql.js": "^1.13.0",
125
+ "svg-pan-zoom": "^3.6.2",
126
+ "tailwind-merge": "^2.6.0",
107
127
  "tailwindcss-animate": "^1.0.7",
108
128
  "tailwindcss-interaction-media": "^0.1.0",
129
+ "vaul": "^1.1.2",
109
130
  "zod": "^3.23.8",
110
131
  "zod-to-json-schema": "^3.23.2"
111
132
  },
@@ -1,66 +1,74 @@
1
- // @ts-nocheck
2
- "use client"
1
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
2
+ import { ChevronDown } from 'lucide-react';
3
+ import * as React from 'react';
3
4
 
4
- import * as React from "react"
5
- import * as AccordionPrimitive from "@radix-ui/react-accordion"
6
- import { ChevronDown } from "lucide-react"
5
+ import { cn } from '../src/utils';
7
6
 
8
- import { cn } from "../util"
7
+ const Accordion = AccordionPrimitive.Root;
9
8
 
10
- const Accordion = AccordionPrimitive.Root
9
+ type AccordionItemProps = React.ComponentPropsWithoutRef<
10
+ typeof AccordionPrimitive.Item
11
+ > & {
12
+ ref?: React.RefObject<React.ComponentRef<typeof AccordionPrimitive.Item>>;
13
+ };
11
14
 
12
- const AccordionItem = React.forwardRef<
13
- React.ElementRef<typeof AccordionPrimitive.Item>,
14
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
15
- >(({ className, ...props }, ref) => (
16
- <AccordionPrimitive.Item
17
- ref={ref}
18
- className={cn("border-b", className)}
19
- {...props}
20
- />
21
- ))
22
- AccordionItem.displayName = "AccordionItem"
15
+ const AccordionItem = ({ className, ref, ...props }: AccordionItemProps) => (
16
+ <AccordionPrimitive.Item className={cn('', className)} ref={ref} {...props} />
17
+ );
18
+ AccordionItem.displayName = 'AccordionItem';
23
19
 
24
- type AccordionTriggerProps = React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> & {
25
- showChevron?: boolean
26
- headerClx?: string
27
- }
20
+ type AccordionTriggerProps = React.ComponentPropsWithoutRef<
21
+ typeof AccordionPrimitive.Trigger
22
+ > & {
23
+ hideArrow?: boolean;
24
+ ref?: React.RefObject<React.ComponentRef<typeof AccordionPrimitive.Trigger>>;
25
+ };
28
26
 
29
- const AccordionTrigger = React.forwardRef<
30
- React.ElementRef<typeof AccordionPrimitive.Trigger>,
31
- AccordionTriggerProps
32
- >(({ showChevron = true, headerClx, className, children, ...props }, ref) => (
33
- <AccordionPrimitive.Header className={cn('flex', headerClx)}>
27
+ const AccordionTrigger = ({
28
+ className,
29
+ children,
30
+ hideArrow = false,
31
+ ref,
32
+ ...props
33
+ }: AccordionTriggerProps) => (
34
+ <AccordionPrimitive.Header className="flex">
34
35
  <AccordionPrimitive.Trigger
35
- ref={ref}
36
36
  className={cn(
37
- "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
38
- className
37
+ 'flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
38
+ className,
39
39
  )}
40
+ ref={ref}
40
41
  {...props}
41
42
  >
42
43
  {children}
43
- {showChevron && <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />}
44
+ {hideArrow ? null : (
45
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
46
+ )}
44
47
  </AccordionPrimitive.Trigger>
45
48
  </AccordionPrimitive.Header>
46
- ))
47
- AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
49
+ );
50
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
51
+
52
+ type AccordionContentProps = React.ComponentPropsWithoutRef<
53
+ typeof AccordionPrimitive.Content
54
+ > & {
55
+ ref?: React.RefObject<React.ComponentRef<typeof AccordionPrimitive.Content>>;
56
+ };
48
57
 
49
- const AccordionContent = React.forwardRef<
50
- React.ElementRef<typeof AccordionPrimitive.Content>,
51
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
52
- >(({ className, children, ...props }, ref) => (
58
+ const AccordionContent = ({
59
+ className,
60
+ children,
61
+ ref,
62
+ ...props
63
+ }: AccordionContentProps) => (
53
64
  <AccordionPrimitive.Content
65
+ className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down w-full overflow-hidden text-sm transition-all"
54
66
  ref={ref}
55
- className={cn(
56
- "overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
57
- className
58
- )}
59
67
  {...props}
60
68
  >
61
- <div className="pb-4 pt-0">{children}</div>
69
+ <div className={cn('pt-0 pb-4', className)}>{children}</div>
62
70
  </AccordionPrimitive.Content>
63
- ))
64
- AccordionContent.displayName = AccordionPrimitive.Content.displayName
71
+ );
72
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
65
73
 
66
- export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
74
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };