@hanzo/ui 4.5.0 → 4.5.3

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 (311) hide show
  1. package/MCP-INSTRUCTIONS.md +73 -0
  2. package/README-MCP.md +175 -0
  3. package/bin/cli.js +100 -0
  4. package/bin/create-registry.js +108 -0
  5. package/bin/mcp.js +403 -0
  6. package/bin/npx-registry-mcp.js +15 -0
  7. package/bin/registry-mcp-wrapper.sh +19 -0
  8. package/bin/registry-mcp.js +100 -0
  9. package/bin/start-mcp-server.sh +22 -0
  10. package/bin/test-mcp.sh +52 -0
  11. package/bin/update-registry.js +196 -0
  12. package/blocks/components/screenful-block/index.tsx +2 -0
  13. package/dist/blocks/components/accordian-block.d.ts +4 -0
  14. package/dist/blocks/components/accordian-block.jsx +25 -0
  15. package/dist/blocks/components/block-component-props.d.ts +7 -0
  16. package/dist/blocks/components/block-component-props.js +1 -0
  17. package/dist/blocks/components/bullet-cards-block.d.ts +4 -0
  18. package/dist/blocks/components/bullet-cards-block.jsx +25 -0
  19. package/dist/blocks/components/card-block/index.d.ts +6 -0
  20. package/dist/blocks/components/card-block/index.jsx +87 -0
  21. package/dist/blocks/components/card-block/link-out-button.d.ts +6 -0
  22. package/dist/blocks/components/card-block/link-out-button.jsx +4 -0
  23. package/dist/blocks/components/card-block/util.d.ts +4 -0
  24. package/dist/blocks/components/card-block/util.js +6 -0
  25. package/dist/blocks/components/carte-blanche-block/index.d.ts +4 -0
  26. package/dist/blocks/components/carte-blanche-block/index.jsx +82 -0
  27. package/dist/blocks/components/carte-blanche-block/variant-content-left.d.ts +10 -0
  28. package/dist/blocks/components/carte-blanche-block/variant-content-left.jsx +23 -0
  29. package/dist/blocks/components/content.d.ts +10 -0
  30. package/dist/blocks/components/content.jsx +47 -0
  31. package/dist/blocks/components/cta-block.d.ts +12 -0
  32. package/dist/blocks/components/cta-block.jsx +69 -0
  33. package/dist/blocks/components/enh-heading-block.d.ts +7 -0
  34. package/dist/blocks/components/enh-heading-block.jsx +142 -0
  35. package/dist/blocks/components/grid-block/grid-block-mutator.d.ts +5 -0
  36. package/dist/blocks/components/grid-block/grid-block-mutator.js +1 -0
  37. package/dist/blocks/components/grid-block/index.d.ts +9 -0
  38. package/dist/blocks/components/grid-block/index.jsx +56 -0
  39. package/dist/blocks/components/grid-block/mutator-registry.d.ts +3 -0
  40. package/dist/blocks/components/grid-block/mutator-registry.js +5 -0
  41. package/dist/blocks/components/grid-block/table-borders.mutator.d.ts +3 -0
  42. package/dist/blocks/components/grid-block/table-borders.mutator.js +36 -0
  43. package/dist/blocks/components/group-block.d.ts +7 -0
  44. package/dist/blocks/components/group-block.jsx +61 -0
  45. package/dist/blocks/components/heading-block.d.ts +4 -0
  46. package/dist/blocks/components/heading-block.jsx +99 -0
  47. package/dist/blocks/components/image-block.d.ts +7 -0
  48. package/dist/blocks/components/image-block.jsx +69 -0
  49. package/dist/blocks/components/index.d.ts +14 -0
  50. package/dist/blocks/components/index.js +13 -0
  51. package/dist/blocks/components/screenful-block/content.d.ts +8 -0
  52. package/dist/blocks/components/screenful-block/content.jsx +71 -0
  53. package/dist/blocks/components/screenful-block/index.d.ts +12 -0
  54. package/dist/blocks/components/screenful-block/index.jsx +57 -0
  55. package/dist/blocks/components/screenful-block/poster-background.d.ts +7 -0
  56. package/dist/blocks/components/screenful-block/poster-background.jsx +14 -0
  57. package/dist/blocks/components/screenful-block/video-background.d.ts +8 -0
  58. package/dist/blocks/components/screenful-block/video-background.jsx +20 -0
  59. package/dist/blocks/components/space-block.d.ts +4 -0
  60. package/dist/blocks/components/space-block.jsx +42 -0
  61. package/dist/blocks/components/video-block.d.ts +9 -0
  62. package/dist/blocks/components/video-block.jsx +83 -0
  63. package/dist/blocks/def/accordian-block.d.ts +10 -0
  64. package/dist/blocks/def/accordian-block.js +2 -0
  65. package/dist/blocks/def/block.d.ts +4 -0
  66. package/dist/blocks/def/block.js +1 -0
  67. package/dist/blocks/def/bullet-cards-block.d.ts +17 -0
  68. package/dist/blocks/def/bullet-cards-block.js +1 -0
  69. package/dist/blocks/def/card-block.d.ts +17 -0
  70. package/dist/blocks/def/card-block.js +2 -0
  71. package/dist/blocks/def/carte-blanche-block.d.ts +12 -0
  72. package/dist/blocks/def/carte-blanche-block.js +1 -0
  73. package/dist/blocks/def/cta-block.d.ts +8 -0
  74. package/dist/blocks/def/cta-block.js +1 -0
  75. package/dist/blocks/def/element-block.d.ts +7 -0
  76. package/dist/blocks/def/element-block.js +2 -0
  77. package/dist/blocks/def/enh-heading-block.d.ts +22 -0
  78. package/dist/blocks/def/enh-heading-block.js +1 -0
  79. package/dist/blocks/def/grid-block.d.ts +12 -0
  80. package/dist/blocks/def/grid-block.js +1 -0
  81. package/dist/blocks/def/group-block.d.ts +7 -0
  82. package/dist/blocks/def/group-block.js +1 -0
  83. package/dist/blocks/def/heading-block.d.ts +11 -0
  84. package/dist/blocks/def/heading-block.js +1 -0
  85. package/dist/blocks/def/image-block.d.ts +26 -0
  86. package/dist/blocks/def/image-block.js +1 -0
  87. package/dist/blocks/def/index.d.ts +17 -0
  88. package/dist/blocks/def/index.js +2 -0
  89. package/dist/blocks/def/screenful-block.d.ts +41 -0
  90. package/dist/blocks/def/screenful-block.js +1 -0
  91. package/dist/blocks/def/space-block.d.ts +47 -0
  92. package/dist/blocks/def/space-block.js +8 -0
  93. package/dist/blocks/def/video-block.d.ts +5 -0
  94. package/dist/blocks/def/video-block.js +1 -0
  95. package/dist/blocks/index.d.ts +2 -0
  96. package/dist/blocks/index.js +2 -0
  97. package/dist/mcp/enhanced-server.d.ts +29 -0
  98. package/dist/mcp/enhanced-server.js +1128 -0
  99. package/dist/mcp/index.d.ts +28 -0
  100. package/dist/mcp/index.js +436 -0
  101. package/dist/primitives/accordion.d.ts +10 -0
  102. package/dist/primitives/accordion.jsx +21 -0
  103. package/dist/primitives/action-button.d.ts +9 -0
  104. package/dist/primitives/action-button.jsx +16 -0
  105. package/dist/primitives/apply-typography.d.ts +7 -0
  106. package/dist/primitives/apply-typography.jsx +38 -0
  107. package/dist/primitives/aspect-ratio.d.ts +3 -0
  108. package/dist/primitives/aspect-ratio.jsx +4 -0
  109. package/dist/primitives/avatar.d.ts +6 -0
  110. package/dist/primitives/avatar.jsx +11 -0
  111. package/dist/primitives/badge.d.ts +9 -0
  112. package/dist/primitives/badge.jsx +18 -0
  113. package/dist/primitives/breadcrumb.d.ts +19 -0
  114. package/dist/primitives/breadcrumb.jsx +27 -0
  115. package/dist/primitives/breakpoint-indicator.d.ts +3 -0
  116. package/dist/primitives/breakpoint-indicator.jsx +14 -0
  117. package/dist/primitives/button.d.ts +12 -0
  118. package/dist/primitives/button.jsx +55 -0
  119. package/dist/primitives/calendar.d.ts +8 -0
  120. package/dist/primitives/calendar.jsx +40 -0
  121. package/dist/primitives/card.d.ts +8 -0
  122. package/dist/primitives/card.jsx +18 -0
  123. package/dist/primitives/carousel.d.ts +18 -0
  124. package/dist/primitives/carousel.jsx +106 -0
  125. package/dist/primitives/checkbox.d.ts +4 -0
  126. package/dist/primitives/checkbox.jsx +15 -0
  127. package/dist/primitives/combobox.d.ts +41 -0
  128. package/dist/primitives/combobox.jsx +77 -0
  129. package/dist/primitives/command.d.ts +17 -0
  130. package/dist/primitives/command.jsx +38 -0
  131. package/dist/primitives/context-menu.d.ts +27 -0
  132. package/dist/primitives/context-menu.jsx +57 -0
  133. package/dist/primitives/dialog-video-controller.d.ts +3 -0
  134. package/dist/primitives/dialog-video-controller.jsx +24 -0
  135. package/dist/primitives/dialog.d.ts +28 -0
  136. package/dist/primitives/dialog.jsx +37 -0
  137. package/dist/primitives/drawer.d.ts +29 -0
  138. package/dist/primitives/drawer.jsx +34 -0
  139. package/dist/primitives/form.d.ts +12 -0
  140. package/dist/primitives/form.jsx +69 -0
  141. package/dist/primitives/icons/github.d.ts +4 -0
  142. package/dist/primitives/icons/github.jsx +6 -0
  143. package/dist/primitives/icons/index.d.ts +4 -0
  144. package/dist/primitives/icons/index.js +4 -0
  145. package/dist/primitives/icons/youtube-logo.d.ts +4 -0
  146. package/dist/primitives/icons/youtube-logo.jsx +39 -0
  147. package/dist/primitives/index-common.d.ts +47 -0
  148. package/dist/primitives/index-common.js +46 -0
  149. package/dist/primitives/index-next.d.ts +2 -0
  150. package/dist/primitives/index-next.js +2 -0
  151. package/dist/primitives/input-otp.d.ts +7 -0
  152. package/dist/primitives/input-otp.jsx +24 -0
  153. package/dist/primitives/input.d.ts +5 -0
  154. package/dist/primitives/input.jsx +11 -0
  155. package/dist/primitives/label.d.ts +5 -0
  156. package/dist/primitives/label.jsx +11 -0
  157. package/dist/primitives/list-adaptor.d.ts +9 -0
  158. package/dist/primitives/list-adaptor.js +1 -0
  159. package/dist/primitives/list-box.d.ts +10 -0
  160. package/dist/primitives/list-box.jsx +14 -0
  161. package/dist/primitives/loading-spinner.d.ts +5 -0
  162. package/dist/primitives/loading-spinner.jsx +8 -0
  163. package/dist/primitives/navigation-menu.d.ts +12 -0
  164. package/dist/primitives/navigation-menu.jsx +38 -0
  165. package/dist/primitives/next/image.d.ts +11 -0
  166. package/dist/primitives/next/image.jsx +42 -0
  167. package/dist/primitives/next/index.d.ts +7 -0
  168. package/dist/primitives/next/index.js +7 -0
  169. package/dist/primitives/next/inline-icon.d.ts +13 -0
  170. package/dist/primitives/next/inline-icon.jsx +15 -0
  171. package/dist/primitives/next/link-element.d.ts +23 -0
  172. package/dist/primitives/next/link-element.jsx +56 -0
  173. package/dist/primitives/next/mdx-link.d.ts +3 -0
  174. package/dist/primitives/next/mdx-link.jsx +12 -0
  175. package/dist/primitives/next/media-stack.d.ts +8 -0
  176. package/dist/primitives/next/media-stack.jsx +28 -0
  177. package/dist/primitives/next/nav-items.d.ts +10 -0
  178. package/dist/primitives/next/nav-items.jsx +24 -0
  179. package/dist/primitives/next/youtube-embed.d.ts +11 -0
  180. package/dist/primitives/next/youtube-embed.jsx +23 -0
  181. package/dist/primitives/popover.d.ts +9 -0
  182. package/dist/primitives/popover.jsx +18 -0
  183. package/dist/primitives/progress.d.ts +4 -0
  184. package/dist/primitives/progress.jsx +9 -0
  185. package/dist/primitives/radio-group.d.ts +7 -0
  186. package/dist/primitives/radio-group.jsx +18 -0
  187. package/dist/primitives/scroll-area.d.ts +5 -0
  188. package/dist/primitives/scroll-area.jsx +19 -0
  189. package/dist/primitives/select.d.ts +13 -0
  190. package/dist/primitives/select.jsx +62 -0
  191. package/dist/primitives/separator.d.ts +4 -0
  192. package/dist/primitives/separator.jsx +7 -0
  193. package/dist/primitives/sheet.d.ts +30 -0
  194. package/dist/primitives/sheet.jsx +56 -0
  195. package/dist/primitives/skeleton.d.ts +4 -0
  196. package/dist/primitives/skeleton.jsx +3 -0
  197. package/dist/primitives/slider.d.ts +9 -0
  198. package/dist/primitives/slider.jsx +30 -0
  199. package/dist/primitives/sonner.d.ts +5 -0
  200. package/dist/primitives/sonner.jsx +16 -0
  201. package/dist/primitives/step-indicator.d.ts +9 -0
  202. package/dist/primitives/step-indicator.jsx +23 -0
  203. package/dist/primitives/switch.d.ts +6 -0
  204. package/dist/primitives/switch.jsx +14 -0
  205. package/dist/primitives/table.d.ts +10 -0
  206. package/dist/primitives/table.jsx +21 -0
  207. package/dist/primitives/tabs.d.ts +7 -0
  208. package/dist/primitives/tabs.jsx +18 -0
  209. package/dist/primitives/text-area.d.ts +5 -0
  210. package/dist/primitives/text-area.jsx +9 -0
  211. package/dist/primitives/toggle-group.d.ts +14 -0
  212. package/dist/primitives/toggle-group.jsx +28 -0
  213. package/dist/primitives/toggle.d.ts +14 -0
  214. package/dist/primitives/toggle.jsx +52 -0
  215. package/dist/primitives/tooltip.d.ts +11 -0
  216. package/dist/primitives/tooltip.jsx +18 -0
  217. package/dist/primitives/video-player.d.ts +6 -0
  218. package/dist/primitives/video-player.jsx +8 -0
  219. package/dist/registry/api.d.ts +37 -0
  220. package/dist/registry/api.js +130 -0
  221. package/dist/registry/index.d.ts +9 -0
  222. package/dist/registry/index.js +45 -0
  223. package/dist/style/theme-provider.d.ts +4 -0
  224. package/dist/style/theme-provider.jsx +11 -0
  225. package/dist/tailwind/fontFamily.tailwind.d.ts +8 -0
  226. package/dist/tailwind/fontFamily.tailwind.js +7 -0
  227. package/dist/tailwind/fontSize.tailwind.d.ts +36 -0
  228. package/dist/tailwind/fontSize.tailwind.js +13 -0
  229. package/dist/tailwind/index.d.ts +3 -0
  230. package/dist/tailwind/index.js +2 -0
  231. package/dist/tailwind/screens.tailwind.d.ts +9 -0
  232. package/dist/tailwind/screens.tailwind.js +8 -0
  233. package/dist/tailwind/tw-font-desc.d.ts +6 -0
  234. package/dist/tailwind/tw-font-desc.js +6 -0
  235. package/dist/types/animation-def.d.ts +2 -0
  236. package/dist/types/animation-def.js +1 -0
  237. package/dist/types/breakpoints.d.ts +4 -0
  238. package/dist/types/breakpoints.js +4 -0
  239. package/dist/types/bullet-item.d.ts +6 -0
  240. package/dist/types/bullet-item.js +2 -0
  241. package/dist/types/button-def.d.ts +29 -0
  242. package/dist/types/button-def.js +2 -0
  243. package/dist/types/dimensions.d.ts +5 -0
  244. package/dist/types/dimensions.js +1 -0
  245. package/dist/types/grid-def.d.ts +36 -0
  246. package/dist/types/grid-def.js +33 -0
  247. package/dist/types/image-def.d.ts +27 -0
  248. package/dist/types/image-def.js +1 -0
  249. package/dist/types/index.d.ts +13 -0
  250. package/dist/types/index.js +2 -0
  251. package/dist/types/link-def.d.ts +44 -0
  252. package/dist/types/link-def.js +1 -0
  253. package/dist/types/media-stack-def.d.ts +25 -0
  254. package/dist/types/media-stack-def.js +1 -0
  255. package/dist/types/t-shirt-size.d.ts +2 -0
  256. package/dist/types/t-shirt-size.js +1 -0
  257. package/dist/types/tshirt-dimensions.d.ts +12 -0
  258. package/dist/types/tshirt-dimensions.js +1 -0
  259. package/dist/types/video-def.d.ts +9 -0
  260. package/dist/types/video-def.js +1 -0
  261. package/dist/util/format-and-abbreviate-as-currency.d.ts +11 -0
  262. package/dist/util/format-and-abbreviate-as-currency.js +91 -0
  263. package/dist/util/format-to-max-char.d.ts +5 -0
  264. package/dist/util/format-to-max-char.js +57 -0
  265. package/dist/util/index-client.d.ts +2 -0
  266. package/dist/util/index-client.js +3 -0
  267. package/dist/util/index.d.ts +17 -0
  268. package/dist/util/index.js +41 -0
  269. package/dist/util/number-abbreviate.d.ts +9 -0
  270. package/dist/util/number-abbreviate.js +30 -0
  271. package/dist/util/specifier.d.ts +7 -0
  272. package/dist/util/specifier.js +31 -0
  273. package/dist/util/spread-to-transform.d.ts +7 -0
  274. package/dist/util/spread-to-transform.js +18 -0
  275. package/dist/util/step-animation.d.ts +5 -0
  276. package/dist/util/step-animation.js +60 -0
  277. package/dist/util/two-way-map.d.ts +8 -0
  278. package/dist/util/two-way-map.js +16 -0
  279. package/mcp/README.md +141 -0
  280. package/mcp/enhanced-server.ts +1208 -0
  281. package/mcp/index.ts +518 -0
  282. package/mcp/package.json +10 -0
  283. package/package.json +36 -16
  284. package/primitives/accordion.tsx +5 -5
  285. package/primitives/button.tsx +6 -3
  286. package/primitives/dialog.tsx +12 -7
  287. package/primitives/tabs.tsx +1 -1
  288. package/primitives/tooltip.tsx +1 -1
  289. package/public/r/accordion.json +11 -0
  290. package/public/r/alert.json +11 -0
  291. package/public/r/avatar.json +11 -0
  292. package/public/r/badge.json +11 -0
  293. package/public/r/button.json +11 -0
  294. package/public/r/card.json +11 -0
  295. package/public/r/checkbox.json +11 -0
  296. package/public/r/default.json +6 -0
  297. package/public/r/dialog.json +11 -0
  298. package/public/r/input.json +11 -0
  299. package/public/r/label.json +11 -0
  300. package/public/r/new-york.json +6 -0
  301. package/public/r/popover.json +11 -0
  302. package/public/r/select.json +11 -0
  303. package/public/r/table.json +11 -0
  304. package/public/r/tabs.json +11 -0
  305. package/public/r/toast.json +11 -0
  306. package/registry/api.ts +164 -0
  307. package/registry/index.ts +60 -0
  308. package/registry/package.json +10 -0
  309. package/registry.json +184 -0
  310. package/test/test-registry.js +73 -0
  311. package/tsconfig.json +8 -1
@@ -0,0 +1,196 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * This script updates the registry.json file based on components
5
+ * found in the registry directory. It's similar to the approach used by shadcn/ui.
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const glob = require('glob');
11
+
12
+ // Configuration
13
+ const REGISTRY_DIR = path.resolve(__dirname, '../registry');
14
+ const PUBLIC_DIR = path.resolve(__dirname, '../public');
15
+ const OUTPUT_FILE = path.resolve(__dirname, '../registry.json');
16
+ const REGISTRY_STYLES = ['default', 'new-york']; // Add other styles as needed
17
+
18
+ // Schema for registry.json
19
+ const registrySchema = {
20
+ "$schema": "https://ui.shadcn.com/schema/registry.json",
21
+ "name": "hanzo",
22
+ "homepage": "https://ui.hanzo.ai",
23
+ "items": []
24
+ };
25
+
26
+ /**
27
+ * Main function to update the registry
28
+ */
29
+ async function updateRegistry() {
30
+ try {
31
+ console.log('Updating registry.json...');
32
+
33
+ // Find all registry components
34
+ const items = [];
35
+
36
+ // Process each style directory
37
+ for (const style of REGISTRY_STYLES) {
38
+ const styleDir = path.join(REGISTRY_DIR, style);
39
+
40
+ // Skip if style directory doesn't exist
41
+ if (!fs.existsSync(styleDir)) {
42
+ console.log(`Style directory not found: ${style}`);
43
+ continue;
44
+ }
45
+
46
+ // Process UI components
47
+ const uiDir = path.join(styleDir, 'ui');
48
+ if (fs.existsSync(uiDir)) {
49
+ const uiComponents = glob.sync(`${uiDir}/**/!(*.test|*.spec).{ts,tsx,js,jsx}`);
50
+
51
+ for (const filePath of uiComponents) {
52
+ const relativePath = path.relative(REGISTRY_DIR, filePath);
53
+ const dirName = path.basename(path.dirname(filePath));
54
+ const fileName = path.basename(filePath);
55
+
56
+ // Skip index files and non-component files
57
+ if (fileName === 'index.ts' || fileName === 'index.tsx') continue;
58
+
59
+ // Component name is usually the directory name
60
+ const name = dirName;
61
+
62
+ // Check if component already exists in the registry
63
+ if (!items.find(item => item.name === name && item.type === 'registry:component')) {
64
+ const componentMeta = {
65
+ name,
66
+ type: 'registry:component',
67
+ description: `A ${name} component for your UI.`,
68
+ files: [
69
+ {
70
+ path: relativePath,
71
+ type: 'registry:component'
72
+ }
73
+ ],
74
+ registryDependencies: []
75
+ };
76
+
77
+ // Try to parse dependencies from the file content
78
+ try {
79
+ const content = fs.readFileSync(filePath, 'utf8');
80
+
81
+ // Find import statements for other components
82
+ const dependencies = [];
83
+ const importRegex = /import.*from ['"]@\/components\/ui\/([^'"]+)['"]/g;
84
+ let match;
85
+
86
+ while ((match = importRegex.exec(content)) !== null) {
87
+ const dependency = match[1];
88
+ if (!dependencies.includes(dependency)) {
89
+ dependencies.push(dependency);
90
+ }
91
+ }
92
+
93
+ if (dependencies.length > 0) {
94
+ componentMeta.registryDependencies = dependencies;
95
+ }
96
+ } catch (error) {
97
+ console.warn(`Error parsing dependencies for ${name}:`, error.message);
98
+ }
99
+
100
+ items.push(componentMeta);
101
+ }
102
+ }
103
+ }
104
+
105
+ // Process other component types (blocks, etc.)
106
+ const blockDir = path.join(styleDir, 'block');
107
+ if (fs.existsSync(blockDir)) {
108
+ const blocks = glob.sync(`${blockDir}/**/!(*.test|*.spec).{ts,tsx,js,jsx}`);
109
+
110
+ for (const filePath of blocks) {
111
+ const relativePath = path.relative(REGISTRY_DIR, filePath);
112
+ const dirName = path.basename(path.dirname(filePath));
113
+
114
+ // Skip helper files
115
+ if (dirName === 'utils' || dirName === 'helpers') continue;
116
+
117
+ // Block name is usually the directory name
118
+ const name = dirName;
119
+
120
+ // Check if block already exists in the registry
121
+ if (!items.find(item => item.name === name && item.type === 'registry:block')) {
122
+ items.push({
123
+ name,
124
+ type: 'registry:block',
125
+ description: `A ${name} block for your UI.`,
126
+ files: [
127
+ {
128
+ path: relativePath,
129
+ type: 'registry:block'
130
+ }
131
+ ]
132
+ });
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+ // Add style definition
139
+ for (const style of REGISTRY_STYLES) {
140
+ items.push({
141
+ name: style,
142
+ type: 'registry:style',
143
+ description: `The ${style} style for Hanzo UI components.`,
144
+ files: []
145
+ });
146
+ }
147
+
148
+ // Update registry.json
149
+ registrySchema.items = items;
150
+
151
+ // Create output directory if it doesn't exist
152
+ const outputDir = path.dirname(OUTPUT_FILE);
153
+ if (!fs.existsSync(outputDir)) {
154
+ fs.mkdirSync(outputDir, { recursive: true });
155
+ }
156
+
157
+ // Write registry.json
158
+ fs.writeFileSync(OUTPUT_FILE, JSON.stringify(registrySchema, null, 2), 'utf8');
159
+ console.log(`Registry updated with ${items.length} items.`);
160
+
161
+ // Create public/r directory if it doesn't exist
162
+ const publicRDir = path.join(PUBLIC_DIR, 'r');
163
+ if (!fs.existsSync(publicRDir)) {
164
+ fs.mkdirSync(publicRDir, { recursive: true });
165
+ }
166
+
167
+ // Generate individual component JSON files
168
+ console.log('Generating individual component JSON files...');
169
+ for (const item of items) {
170
+ const componentFile = path.join(publicRDir, `${item.name}.json`);
171
+
172
+ // Add content to files if they exist
173
+ if (item.files && item.files.length > 0) {
174
+ for (const file of item.files) {
175
+ const filePath = path.join(REGISTRY_DIR, file.path);
176
+ if (fs.existsSync(filePath)) {
177
+ file.content = fs.readFileSync(filePath, 'utf8');
178
+ }
179
+ }
180
+ }
181
+
182
+ // Write component JSON file
183
+ fs.writeFileSync(componentFile, JSON.stringify(item, null, 2), 'utf8');
184
+ }
185
+
186
+ console.log(`Generated ${items.length} component JSON files.`);
187
+ console.log('Registry update complete!');
188
+
189
+ } catch (error) {
190
+ console.error('Error updating registry:', error);
191
+ process.exit(1);
192
+ }
193
+ }
194
+
195
+ // Run the update
196
+ updateRegistry();
@@ -1,3 +1,5 @@
1
+ 'use client'
2
+
1
3
  import React from 'react'
2
4
  import dynamic from 'next/dynamic'
3
5
 
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type BlockComponentProps from './block-component-props';
3
+ declare const AccordianBlockComponent: React.FC<BlockComponentProps>;
4
+ export default AccordianBlockComponent;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ApplyTypography } from '../../primitives/index-common';
3
+ import { cn } from '../../util';
4
+ const AccordianBlockComponent = ({ block, className = '' }) => {
5
+ if (block.blockType !== 'accordian') {
6
+ return <>accordian block required</>;
7
+ }
8
+ const accordian = block;
9
+ return (<Accordion type="single" collapsible className={cn('w-full border rounded-xl overflow-hidden', className)}>
10
+ {accordian.items.map((item, index) => (<AccordionItem className='border-b last:border-0 overflow-hidden' value={`value-${index}`} key={index}>
11
+ <AccordionTrigger className='px-3 md:px-4 lg:px-6 hover:no-underline hover:bg-level-3'>
12
+ <ApplyTypography>
13
+ {/* styles specific to accordion. From old site */}
14
+ <h6 className='leading-[1.2] text-[1.05rem] font-semibold '>{item.trigger}</h6>
15
+ </ApplyTypography>
16
+ </AccordionTrigger>
17
+ <AccordionContent className='p-4 border-t bg-level-1'>
18
+ <ApplyTypography className='flex flex-col justify-start items-start '>
19
+ {(typeof item.content === 'string') ? (<p>{item.content}</p>) : item.content}
20
+ </ApplyTypography>
21
+ </AccordionContent>
22
+ </AccordionItem>))}
23
+ </Accordion>);
24
+ };
25
+ export default AccordianBlockComponent;
@@ -0,0 +1,7 @@
1
+ import type { Block } from "../def";
2
+ interface BlockComponentProps {
3
+ block: Block;
4
+ className?: string;
5
+ agent?: string;
6
+ }
7
+ export { type BlockComponentProps as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type BlockComponentProps from './block-component-props';
3
+ declare const BulletCardsBlockComponent: React.FC<BlockComponentProps>;
4
+ export default BulletCardsBlockComponent;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { containsToken, cn } from '../../util';
3
+ import InlineIcon from '../../primitives/next/inline-icon';
4
+ import GridBlockComponent from './grid-block';
5
+ const BulletCardsBlockComponent = ({ block, className = '', agent }) => {
6
+ if (block.blockType !== 'bullet-cards') {
7
+ return <>bullet cards block required</>;
8
+ }
9
+ const b = block;
10
+ const specified = (s) => (containsToken(b.specifiers, s));
11
+ const noBorder = specified('no-card-border') ? 'border-0' : 'md:border';
12
+ const mobileTextXs = specified('mobile-small-text') ? 'text-xs' : 'text-sm';
13
+ const borderclx = specified('border-muted-3') ?
14
+ 'md:border-muted-3'
15
+ :
16
+ (specified('border-muted-1') ? 'md:border-muted-1' : 'md:border-muted-2');
17
+ return (<GridBlockComponent block={{ blockType: 'grid', grid: b.grid }} className={className} agent={agent}>
18
+ {b.cards.map((card, index) => (<div key={index} className={cn('px-0 sm:px-4 py-1 md:py-4 rounded-lg ' +
19
+ 'flex flex-row justify-start items-center not-typography text-foreground', noBorder, borderclx)}>
20
+ <InlineIcon icon={card.icon} size={b.iconSize ?? 28} agent={agent} className='shrink-0 mr-2 md:mr-4 '/>
21
+ <p className={cn('m-0 sm:text-base', mobileTextXs)}>{card.text}</p>
22
+ </div>))}
23
+ </GridBlockComponent>);
24
+ };
25
+ export default BulletCardsBlockComponent;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type BlockComponentProps from '../block-component-props';
3
+ declare const CardBlockComponent: React.FC<BlockComponentProps & {
4
+ contentClassName?: string;
5
+ }>;
6
+ export default CardBlockComponent;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { ApplyTypography, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '../../../primitives/index-common';
3
+ import ImageBlockComponent from '../image-block';
4
+ import VideoBlockComponent from '../video-block';
5
+ import CTABlockComponent from '../cta-block';
6
+ import { cn } from '../../../util';
7
+ import { getTypographySize } from './util';
8
+ import LinkOutButton from './link-out-button';
9
+ const CardBlockComponent = ({ block, className = '', contentClassName = '' }) => {
10
+ if (block.blockType !== 'card') {
11
+ return <>card block required</>;
12
+ }
13
+ const card = block;
14
+ const has = (s) => (card.specifiers?.includes(s));
15
+ const ghost = has('ghost'); // no outer padding, no borders, larger title, all left-aligned bg is same (default)
16
+ const contentclx = (has('content-left') ? 'items-start ' : ' items-center ') + (has('content-top') ? '!justify-start' : '') + contentClassName;
17
+ const disabledBorder = (has('appear-disabled') ? ' border-muted-4' : ' border-muted-3');
18
+ const outerBorder = ((has('no-outer-border') || ghost) ? ' border-0' : '');
19
+ const innerBorder = (ghost ? ' border-0' : '');
20
+ const paddingclx = ghost ? ' px-0 py-0' : ' px-6 py-3';
21
+ const mainGap = ghost ? ' gap-2' : '';
22
+ const disabledText = (has('appear-disabled') ? ' text-muted-2' : '');
23
+ const disabledTypoText = (has('appear-disabled') ? ' typography-p:text-muted-2' : '');
24
+ const bgclx = (has('bg-card') ? ' bg-level-1' : '');
25
+ const titleclx = (has('heading-style-title') ? ' font-heading text-base leading-tight' : '') +
26
+ (ghost ? ' text-left md:text-xl' : '');
27
+ const typoSize = (card.specifiers) ? getTypographySize(card.specifiers) : 'responsive';
28
+ const typoclx = (typoSize === 'sm') ? 'typography-sm typography-p:text-sm ' : (typoSize === 'lg') ? 'typography-lg ' : '';
29
+ const contentBefore = has('content-before');
30
+ const iconInline = has('icon-inline');
31
+ const contentOnHover = has('reveal-content-on-hover');
32
+ //const smallIconDim = (contentOnHover && card.specifiers) ? getSmallIconDim(card.specifiers) : undefined
33
+ const Header = ({ inContent = false, className = '' }) => ((card.title || card.byline || card.icon) ? (<CardHeader className={'not-typography' + ' text-accent' + disabledText + paddingclx + innerBorder + className}>
34
+ <div className={(iconInline || inContent) ? 'flex flex-row justify-start items-end my-3' : ''}>
35
+ {(card.icon && !card.iconAfter) && (<div className={iconInline ? 'mr-1' : 'mb-2'}>{card.icon}</div>)}
36
+ {card.title && (<CardTitle className={'text-center text-lg font-medium' + titleclx + (iconInline ? ' md:text-xl/none' : '')}>
37
+ {card.title}
38
+ </CardTitle>)}
39
+ {(card.icon && card.iconAfter) && (<div className={iconInline ? 'ml-1' : 'my-1'}>{card.icon}</div>)}
40
+ </div>
41
+ {card.byline && (<CardDescription>{card.byline}</CardDescription>)}
42
+ </CardHeader>) : null);
43
+ const MediaAndContent = ({ className = '' }) => (has('media-left') ? (
44
+ // media left layout
45
+ <CardContent className={'flex flex-row justify-start items-stretch p-0 grow ' + disabledBorder + bgclx + contentclx + className}>
46
+ {card.media && (<div className={'box-content grow-0 not-typography' + paddingclx} style={{
47
+ // If this layout has been specified, assume media is video, and that the 'sm' dim exists.
48
+ width: card.media.dim.sm.w
49
+ }}>
50
+ <VideoBlockComponent block={card.media} usePoster={has('video-use-poster')} size='sm' className={has('appear-disabled') ? 'opacity-[0.6]' : ''}/>
51
+ </div>)}
52
+ {card.content && (<ApplyTypography className={'grow border-l flex flex-col justify-center ' + disabledTypoText + paddingclx + disabledBorder + contentclx} size={typoSize}>
53
+ {(typeof card.content === 'string') ? (<p>{card.content}</p>) : card.content}
54
+ </ApplyTypography>)}
55
+ </CardContent>) : ( // default layout
56
+ <CardContent className={'grow typography flex flex-col justify-center ' +
57
+ typoclx + disabledTypoText + bgclx + paddingclx + contentclx + (has('full-width') ? ' p-0 ' : ' ') +
58
+ className}>
59
+ {contentOnHover && (<Header inContent/>)}
60
+ {card.content && contentBefore && ((typeof card.content === 'string') ? (<p>{card.content}</p>) : card.content)}
61
+ {card.media && (card.media.blockType === 'image' ? (<ImageBlockComponent block={card.media}/>) : (<VideoBlockComponent block={card.media}/>))}
62
+ {card.content && !contentBefore && ((typeof card.content === 'string') ? (<p>{card.content}</p>) : card.content)}
63
+ </CardContent>));
64
+ const Footer = () => (!card.cta ? null : (has('links-w-arrow') ? (
65
+ // links w arrow
66
+ <CardFooter className={'typography typography-a:text-muted-2 typography-a:hover:text-muted-1 typography-a:text-xs typography-a:no-underline typography-a:hover:underline ' +
67
+ 'flex flex-col justify-start items-stretch ' + paddingclx}>
68
+ <CTABlockComponent block={card.cta} renderLink={(def, key) => (<LinkOutButton def={def} key={key}/>)}/>
69
+ </CardFooter>) : ( // default
70
+ <CardFooter className={'grid grid-cols-1 gap-2 md:flex md:flex-row md:justify-center ' + paddingclx}>
71
+ <CTABlockComponent block={card.cta}/>
72
+ </CardFooter>)));
73
+ return (<Card className={cn('flex flex-col self-stretch ' +
74
+ (contentOnHover ? 'group relative' : '') +
75
+ disabledBorder +
76
+ outerBorder +
77
+ bgclx +
78
+ mainGap, className)}>
79
+ <Header className={(contentOnHover ? ' absolute top-[0px] left-[0px] w-full hidden ' : '')}/>
80
+ <MediaAndContent className={(contentOnHover ?
81
+ ' bg-gradient-to-t from-secondary to-65%' +
82
+ ' items-start justify-start rounded-lg p-4' +
83
+ ' transition-opacity duration-500 ease-out opacity-100 ' : '')}/>
84
+ <Footer />
85
+ </Card>);
86
+ };
87
+ export default CardBlockComponent;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { LinkDef } from '../../../types';
3
+ declare const ArrowLinkElement: React.FC<{
4
+ def: LinkDef;
5
+ }>;
6
+ export default ArrowLinkElement;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { LinkElement, Icons } from '../../../primitives/index-next';
3
+ const ArrowLinkElement = ({ def }) => (<LinkElement def={def} className='justify-between' variant='link' icon={<Icons.linkOut className='w-[18px] h-[18px]'/>} iconAfter/>);
4
+ export default ArrowLinkElement;
@@ -0,0 +1,4 @@
1
+ import type { Dimensions } from '../../../types';
2
+ import type { TypographySize } from '../../../primitives/index-common';
3
+ export declare const getTypographySize: (s: string) => TypographySize;
4
+ export declare const getSmallIconDim: (s: string) => Dimensions | undefined;
@@ -0,0 +1,6 @@
1
+ import { getSpecifierData, getPrimaryStartingWith, getDim, } from '../../../util/specifier';
2
+ export const getTypographySize = (s) => getSpecifierData(s, (s) => (getPrimaryStartingWith(s, 'typography')), (s) => {
3
+ const subTokenArray = s.split('-');
4
+ return subTokenArray[subTokenArray.length - 1];
5
+ }, 'responsive');
6
+ export const getSmallIconDim = (s) => (getSpecifierData(s, (s) => (getPrimaryStartingWith(s, 'small-icon')), getDim));
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type BlockComponentProps from '../block-component-props';
3
+ declare const CarteBlancheBlockComponent: React.FC<BlockComponentProps>;
4
+ export default CarteBlancheBlockComponent;
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+ import { Card, CardContent, CardFooter, CardHeader, } from '../../../primitives/index-common';
3
+ import { cn, containsToken } from '../../../util';
4
+ import { getSpecifierData, getPrimaryStartingWith, getDim, } from '../../../util/specifier';
5
+ import CTABlockComponent from '../cta-block';
6
+ import Content from '../content';
7
+ import { EnhHeadingBlockComponent } from '..';
8
+ import VariantContentLeft from './variant-content-left';
9
+ const _getClx = (specifier, section) => {
10
+ let result = '';
11
+ if (specifier === 'big-padding') {
12
+ switch (section) {
13
+ // defaults: p-4 lg:p-6 xl:p-8
14
+ case 'header':
15
+ {
16
+ result = 'md:p-8 lg:p-12 xl:p-16';
17
+ }
18
+ break;
19
+ }
20
+ }
21
+ if (specifier === 'big-padding-content') {
22
+ switch (section) {
23
+ case 'content':
24
+ {
25
+ result = 'md:p-8 lg:p-12 xl:p-16';
26
+ }
27
+ break;
28
+ }
29
+ }
30
+ else if (specifier === 'no-inner-borders') {
31
+ switch (section) {
32
+ case 'header':
33
+ {
34
+ result = 'border-none';
35
+ }
36
+ break;
37
+ case 'footer':
38
+ {
39
+ result = 'border-t-0';
40
+ }
41
+ break;
42
+ }
43
+ }
44
+ return result;
45
+ };
46
+ const CarteBlancheBlockComponent = ({ block, className = '', agent, }) => {
47
+ if (block.blockType !== 'carte-blanche') {
48
+ return <>carte blanche block required</>;
49
+ }
50
+ const b = block;
51
+ const specified = (s) => (containsToken(b.specifiers, s));
52
+ const getClx = (specifier, section) => ((specified(specifier)) ? _getClx(specifier, section) : '');
53
+ //const bigPadding = specified('big-padding')
54
+ const headingclx = [
55
+ getClx('big-padding', 'header'),
56
+ getClx('no-inner-borders', 'header'),
57
+ ].join(' ');
58
+ const contentclx = [
59
+ getClx('big-padding-content', 'content'),
60
+ ].join(' ');
61
+ const footerclx = [
62
+ getClx('no-inner-borders', 'footer'),
63
+ ].join(' ');
64
+ const noOuterBorders = specified('no-outer-borders');
65
+ const contentLeft = specified('variant-content-left');
66
+ const mobileContentLeft = specified('variant-mobile-content-left');
67
+ return (<Card className={cn('flex flex-col', className, noOuterBorders ? 'border-none' : '')}>
68
+ {contentLeft || (mobileContentLeft && agent === 'phone') ? (<VariantContentLeft block={b} agent={agent} className={className} headingclx={headingclx} contentclx={contentclx} footerclx={footerclx}/>) : (<>
69
+ {(b.heading || b.topContent) && (<CardHeader className={cn('typography-img:m-0', headingclx)}>
70
+ {b.topContent && (<Content blocks={b.topContent} agent={agent} className=''/>)}
71
+ {b.heading && (<EnhHeadingBlockComponent block={b.heading} className='text-accent' agent={agent}/>)}
72
+ </CardHeader>)}
73
+ {b.content && (<CardContent className={cn('typography flex flex-col justify-center', contentclx, className)}>
74
+ <Content blocks={b.content} agent={agent}/>
75
+ </CardContent>)}
76
+ {b.cta && (<CardFooter className={cn('grid grid-cols-1 gap-2 md:flex md:flex-row md:justify-center', footerclx)}>
77
+ <CTABlockComponent block={b.cta} agent={agent}/>
78
+ </CardFooter>)}
79
+ </>)}
80
+ </Card>);
81
+ };
82
+ export default CarteBlancheBlockComponent;
@@ -0,0 +1,10 @@
1
+ import { type CarteBlancheBlock } from '../..';
2
+ declare const VariantContentLeft: React.FC<{
3
+ block: CarteBlancheBlock;
4
+ agent?: string;
5
+ className?: string;
6
+ headingclx?: string;
7
+ contentclx?: string;
8
+ footerclx?: string;
9
+ }>;
10
+ export default VariantContentLeft;
@@ -0,0 +1,23 @@
1
+ import { EnhHeadingBlockComponent, CTABlockComponent } from '../..';
2
+ import { CardContent, CardFooter, CardHeader, } from '../../../primitives/index-common';
3
+ import { cn } from '../../../util';
4
+ import Content from '../content';
5
+ const VariantContentLeft = ({ block, agent, className, headingclx, contentclx, footerclx, }) => {
6
+ return (<>
7
+ <div className='flex gap-2'>
8
+ {block.topContent && <Content blocks={block.topContent} agent={agent} className='self-center ml-6 mt-6'/>}
9
+ <div className='flex flex-col'>
10
+ {block.heading && (<CardHeader className={cn('typography-img:m-0', headingclx)}>
11
+ <EnhHeadingBlockComponent block={block.heading} className='text-accent' agent={agent}/>
12
+ </CardHeader>)}
13
+ {block.content && (<CardContent className={cn('typography flex flex-col justify-start', contentclx, className)}>
14
+ <Content blocks={block.content} agent={agent}/>
15
+ </CardContent>)}
16
+ </div>
17
+ </div>
18
+ {block.cta && (<CardFooter className={cn('grid grid-cols-1 gap-2 md:flex md:flex-row md:justify-center mx-auto', footerclx)}>
19
+ <CTABlockComponent block={block.cta} agent={agent}/>
20
+ </CardFooter>)}
21
+ </>);
22
+ };
23
+ export default VariantContentLeft;
@@ -0,0 +1,10 @@
1
+ import React, { type ComponentType } from 'react';
2
+ import type * as B from '../def';
3
+ import type BlockComponentProps from './block-component-props';
4
+ declare const registerBlockType: (key: string, type: ComponentType<BlockComponentProps>) => void;
5
+ declare const ContentComponent: React.FC<{
6
+ blocks: B.Block | B.Block[] | undefined;
7
+ className?: string;
8
+ agent?: string;
9
+ }>;
10
+ export { ContentComponent as default, registerBlockType };
@@ -0,0 +1,47 @@
1
+ import React, {} from 'react';
2
+ import AccordianBlockComponent from './accordian-block';
3
+ import BulletCardsBlockComponent from './bullet-cards-block';
4
+ import CTABlockComponent from './cta-block';
5
+ import CardBlockComponent from './card-block';
6
+ import CarteBlancheBlockComponent from './carte-blanche-block';
7
+ import EnhHeadingBlockComponent from './enh-heading-block';
8
+ import HeadingBlockComponent from './heading-block';
9
+ import GroupBlockComponent from './group-block';
10
+ import GridBlockComponent from './grid-block';
11
+ import ImageBlockComponent from './image-block';
12
+ import SpaceBlockComponent from './space-block';
13
+ import VideoBlockComponent from './video-block';
14
+ const map = new Map();
15
+ map.set('accordian', AccordianBlockComponent);
16
+ map.set('bullet-cards', BulletCardsBlockComponent);
17
+ map.set('card', CardBlockComponent);
18
+ map.set('carte-blanche', CarteBlancheBlockComponent);
19
+ map.set('cta', CTABlockComponent);
20
+ map.set('heading', HeadingBlockComponent);
21
+ map.set('enh-heading', EnhHeadingBlockComponent);
22
+ map.set('space', SpaceBlockComponent);
23
+ map.set('image', ImageBlockComponent);
24
+ map.set('video', VideoBlockComponent);
25
+ map.set('group', GroupBlockComponent);
26
+ map.set('grid', GridBlockComponent);
27
+ const registerBlockType = (key, type) => {
28
+ map.set(key, type);
29
+ };
30
+ const renderBlock = (block, className, agent, keyStr) => {
31
+ if (block.blockType === 'element') {
32
+ return block.element;
33
+ }
34
+ const CompType = map.get(block.blockType);
35
+ if (!CompType)
36
+ return null;
37
+ return <CompType block={block} className={className} agent={agent} key={keyStr ?? ''}/>;
38
+ };
39
+ const ContentComponent = ({ blocks, className = '', agent }) => {
40
+ if (!blocks)
41
+ return null;
42
+ if (Array.isArray(blocks)) {
43
+ return (blocks.map((block, index) => (renderBlock(block, className, agent, `content-block-${block.blockType}-${index}`))));
44
+ }
45
+ return renderBlock(blocks, className, agent);
46
+ };
47
+ export { ContentComponent as default, registerBlockType };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { LinkDef, ButtonDef } from '../../types';
3
+ import { buttonVariants } from '../../primitives/index-next';
4
+ import { type VariantProps } from '../../util';
5
+ import type BlockComponentProps from './block-component-props';
6
+ declare const CtaBlockComponent: React.FC<BlockComponentProps & {
7
+ itemClasses?: string;
8
+ itemSize?: VariantProps<typeof buttonVariants>['size'];
9
+ renderLink?: (def: LinkDef, key: any) => JSX.Element;
10
+ renderButton?: (def: ButtonDef, key: any) => JSX.Element;
11
+ }>;
12
+ export default CtaBlockComponent;