@hanzo/ui 4.6.0 → 4.7.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 (290) hide show
  1. package/dist/index.d.mts +16 -0
  2. package/dist/index.d.ts +16 -0
  3. package/dist/index.js +9458 -0
  4. package/dist/index.mjs +9449 -0
  5. package/dist/lib/utils.d.mts +2 -0
  6. package/dist/lib/utils.d.ts +2 -0
  7. package/dist/lib/utils.js +47 -0
  8. package/dist/lib/utils.mjs +28 -0
  9. package/dist/src/utils.d.mts +7 -0
  10. package/dist/src/utils.d.ts +7 -0
  11. package/dist/src/utils.js +47 -0
  12. package/dist/src/utils.mjs +28 -0
  13. package/dist/tailwind/index.d.mts +2 -0
  14. package/dist/tailwind/index.d.ts +2 -0
  15. package/dist/tailwind/index.js +2048 -0
  16. package/dist/tailwind/index.mjs +2017 -0
  17. package/dist/types/index.d.mts +12 -0
  18. package/dist/types/index.d.ts +12 -0
  19. package/dist/types/index.js +79 -0
  20. package/dist/types/index.mjs +56 -0
  21. package/package.json +151 -25
  22. package/MCP-INSTRUCTIONS.md +0 -73
  23. package/README-MCP.md +0 -175
  24. package/assets/ai-icons.tsx +0 -207
  25. package/assets/crypto.tsx +0 -33
  26. package/assets/file-type-icon.tsx +0 -66
  27. package/assets/file.tsx +0 -45
  28. package/assets/general.tsx +0 -2318
  29. package/assets/hanzo-logo.svg +0 -9
  30. package/assets/hanzo-logo.tsx +0 -15
  31. package/assets/index.ts +0 -8
  32. package/assets/index.tsx +0 -4
  33. package/assets/llm-provider.tsx +0 -1094
  34. package/blocks/components/accordian-block.tsx +0 -48
  35. package/blocks/components/block-component-props.ts +0 -11
  36. package/blocks/components/bullet-cards-block.tsx +0 -46
  37. package/blocks/components/card-block/index.tsx +0 -171
  38. package/blocks/components/card-block/link-out-button.tsx +0 -20
  39. package/blocks/components/card-block/util.ts +0 -28
  40. package/blocks/components/carte-blanche-block/index.tsx +0 -127
  41. package/blocks/components/carte-blanche-block/variant-content-left.tsx +0 -49
  42. package/blocks/components/content.tsx +0 -70
  43. package/blocks/components/cta-block.tsx +0 -115
  44. package/blocks/components/enh-heading-block.tsx +0 -204
  45. package/blocks/components/grid-block/grid-block-mutator.ts +0 -12
  46. package/blocks/components/grid-block/index.tsx +0 -83
  47. package/blocks/components/grid-block/mutator-registry.ts +0 -10
  48. package/blocks/components/grid-block/table-borders.mutator.ts +0 -47
  49. package/blocks/components/group-block.tsx +0 -83
  50. package/blocks/components/heading-block.tsx +0 -88
  51. package/blocks/components/image-block.tsx +0 -111
  52. package/blocks/components/index.ts +0 -30
  53. package/blocks/components/screenful-block/content.tsx +0 -123
  54. package/blocks/components/screenful-block/index.tsx +0 -107
  55. package/blocks/components/screenful-block/poster-background.tsx +0 -34
  56. package/blocks/components/screenful-block/video-background.tsx +0 -45
  57. package/blocks/components/space-block.tsx +0 -66
  58. package/blocks/components/video-block.tsx +0 -138
  59. package/blocks/def/accordian-block.ts +0 -14
  60. package/blocks/def/block.ts +0 -7
  61. package/blocks/def/bullet-cards-block.ts +0 -22
  62. package/blocks/def/card-block.ts +0 -22
  63. package/blocks/def/carte-blanche-block.ts +0 -21
  64. package/blocks/def/cta-block.ts +0 -19
  65. package/blocks/def/element-block.ts +0 -11
  66. package/blocks/def/enh-heading-block.ts +0 -44
  67. package/blocks/def/grid-block.ts +0 -16
  68. package/blocks/def/group-block.ts +0 -11
  69. package/blocks/def/heading-block.ts +0 -15
  70. package/blocks/def/image-block.ts +0 -31
  71. package/blocks/def/index.ts +0 -35
  72. package/blocks/def/screenful-block.ts +0 -54
  73. package/blocks/def/space-block.ts +0 -64
  74. package/blocks/def/video-block.ts +0 -9
  75. package/blocks/index.ts +0 -2
  76. package/components/index.ts +0 -56
  77. package/dist/button.d.ts +0 -1
  78. package/dist/button.js +0 -1
  79. package/dist/hooks/index.d.ts +0 -7
  80. package/dist/hooks/index.js +0 -7
  81. package/dist/hooks/use-click-away.d.ts +0 -2
  82. package/dist/hooks/use-click-away.js +0 -23
  83. package/dist/hooks/use-combined-refs.d.ts +0 -3
  84. package/dist/hooks/use-combined-refs.js +0 -18
  85. package/dist/hooks/use-copy-clipboard.d.ts +0 -9
  86. package/dist/hooks/use-copy-clipboard.js +0 -21
  87. package/dist/hooks/use-debounce.d.ts +0 -1
  88. package/dist/hooks/use-debounce.js +0 -13
  89. package/dist/hooks/use-fill-ids.d.ts +0 -8
  90. package/dist/hooks/use-fill-ids.js +0 -20
  91. package/dist/hooks/use-map.d.ts +0 -1
  92. package/dist/hooks/use-map.js +0 -20
  93. package/dist/hooks/use-measure.d.ts +0 -8
  94. package/dist/hooks/use-measure.js +0 -25
  95. package/dist/hooks/use-reverse-video-playback.d.ts +0 -1
  96. package/dist/hooks/use-reverse-video-playback.js +0 -41
  97. package/dist/hooks/use-scroll-restoration.d.ts +0 -8
  98. package/dist/hooks/use-scroll-restoration.js +0 -36
  99. package/dist/mcp/enhanced-server.d.ts +0 -29
  100. package/dist/mcp/enhanced-server.js +0 -1128
  101. package/dist/mcp/index.d.ts +0 -28
  102. package/dist/mcp/index.js +0 -436
  103. package/dist/registry/api.d.ts +0 -37
  104. package/dist/registry/api.js +0 -129
  105. package/dist/registry/index.d.ts +0 -353
  106. package/dist/registry/index.js +0 -45
  107. package/dist/utils.d.ts +0 -1
  108. package/dist/utils.js +0 -1
  109. package/environment.d.ts +0 -6
  110. package/helpers/file.ts +0 -33
  111. package/helpers/memoization.ts +0 -40
  112. package/primitives/accordion.tsx +0 -74
  113. package/primitives/action-button.tsx +0 -42
  114. package/primitives/alert-dialog.tsx +0 -185
  115. package/primitives/alert.tsx +0 -74
  116. package/primitives/apply-typography.tsx +0 -55
  117. package/primitives/aspect-ratio.tsx +0 -5
  118. package/primitives/avatar.tsx +0 -57
  119. package/primitives/background-beams.tsx +0 -142
  120. package/primitives/badge.tsx +0 -44
  121. package/primitives/breadcrumb.tsx +0 -130
  122. package/primitives/breakpoint-indicator.tsx +0 -19
  123. package/primitives/button.tsx +0 -82
  124. package/primitives/calendar.tsx +0 -72
  125. package/primitives/card.tsx +0 -97
  126. package/primitives/carousel.tsx +0 -237
  127. package/primitives/chat/chat-input-area.tsx +0 -87
  128. package/primitives/chat/chat-input.tsx +0 -71
  129. package/primitives/chat/files-preview.tsx +0 -330
  130. package/primitives/chat/index.ts +0 -6
  131. package/primitives/chat/json-form.tsx +0 -8
  132. package/primitives/chat/message-list.tsx +0 -307
  133. package/primitives/chat/message.tsx +0 -569
  134. package/primitives/chat/sqlite-preview.tsx +0 -215
  135. package/primitives/checkbox.tsx +0 -31
  136. package/primitives/collapsible.tsx +0 -9
  137. package/primitives/combobox.tsx +0 -239
  138. package/primitives/command.tsx +0 -149
  139. package/primitives/context-menu.tsx +0 -206
  140. package/primitives/copy-to-clipboard-icon.tsx +0 -60
  141. package/primitives/dialog-video-controller.tsx +0 -38
  142. package/primitives/dialog.tsx +0 -123
  143. package/primitives/dot-pattern.tsx +0 -57
  144. package/primitives/dots-loader.tsx +0 -13
  145. package/primitives/drawer.tsx +0 -110
  146. package/primitives/dropdown-menu.tsx +0 -199
  147. package/primitives/error-message.tsx +0 -19
  148. package/primitives/file-uploader.tsx +0 -200
  149. package/primitives/form.tsx +0 -183
  150. package/primitives/hover-card.tsx +0 -28
  151. package/primitives/icons/github.tsx +0 -14
  152. package/primitives/icons/index.ts +0 -18
  153. package/primitives/icons/youtube-logo.tsx +0 -59
  154. package/primitives/index-common.ts +0 -303
  155. package/primitives/index-next.ts +0 -4
  156. package/primitives/input-otp.tsx +0 -65
  157. package/primitives/input.tsx +0 -125
  158. package/primitives/label.tsx +0 -20
  159. package/primitives/list-adaptor.ts +0 -12
  160. package/primitives/list-box.tsx +0 -74
  161. package/primitives/loading-spinner.tsx +0 -33
  162. package/primitives/markdown-preview.tsx +0 -609
  163. package/primitives/mermaid.tsx +0 -196
  164. package/primitives/navigation-menu.tsx +0 -147
  165. package/primitives/next/image.tsx +0 -90
  166. package/primitives/next/index.ts +0 -7
  167. package/primitives/next/inline-icon.tsx +0 -36
  168. package/primitives/next/link-element.tsx +0 -109
  169. package/primitives/next/mdx-link.tsx +0 -22
  170. package/primitives/next/media-stack.tsx +0 -69
  171. package/primitives/next/nav-items.tsx +0 -45
  172. package/primitives/next/youtube-embed.tsx +0 -83
  173. package/primitives/pagination.tsx +0 -117
  174. package/primitives/popover.tsx +0 -32
  175. package/primitives/pretty-json-print.tsx +0 -28
  176. package/primitives/progress.tsx +0 -26
  177. package/primitives/prompt-textarea.tsx +0 -72
  178. package/primitives/qr-code.tsx +0 -112
  179. package/primitives/radio-group.tsx +0 -42
  180. package/primitives/resizable.tsx +0 -47
  181. package/primitives/scroll-area.tsx +0 -57
  182. package/primitives/search-input.tsx +0 -66
  183. package/primitives/select.tsx +0 -122
  184. package/primitives/separator.tsx +0 -25
  185. package/primitives/sheet.tsx +0 -139
  186. package/primitives/skeleton.tsx +0 -17
  187. package/primitives/slider.tsx +0 -62
  188. package/primitives/sonner.tsx +0 -35
  189. package/primitives/step-indicator.tsx +0 -69
  190. package/primitives/stepper.tsx +0 -272
  191. package/primitives/switch.tsx +0 -26
  192. package/primitives/table.tsx +0 -105
  193. package/primitives/tabs.tsx +0 -50
  194. package/primitives/text-area.tsx +0 -26
  195. package/primitives/text-link.tsx +0 -25
  196. package/primitives/textarea.tsx +0 -61
  197. package/primitives/textfield.tsx +0 -75
  198. package/primitives/toast.tsx +0 -30
  199. package/primitives/toggle-group.tsx +0 -63
  200. package/primitives/toggle.tsx +0 -44
  201. package/primitives/tooltip.tsx +0 -47
  202. package/primitives/video-player.tsx +0 -23
  203. package/public/r/accordion.json +0 -11
  204. package/public/r/alert.json +0 -11
  205. package/public/r/avatar.json +0 -11
  206. package/public/r/badge.json +0 -11
  207. package/public/r/button.json +0 -11
  208. package/public/r/card.json +0 -11
  209. package/public/r/checkbox.json +0 -11
  210. package/public/r/default.json +0 -6
  211. package/public/r/dialog.json +0 -11
  212. package/public/r/input.json +0 -11
  213. package/public/r/label.json +0 -11
  214. package/public/r/new-york.json +0 -6
  215. package/public/r/popover.json +0 -11
  216. package/public/r/select.json +0 -11
  217. package/public/r/table.json +0 -11
  218. package/public/r/tabs.json +0 -11
  219. package/public/r/toast.json +0 -11
  220. package/registry.json +0 -184
  221. package/src/button.ts +0 -1
  222. package/src/hooks/index.ts +0 -7
  223. package/src/hooks/use-click-away.ts +0 -31
  224. package/src/hooks/use-combined-refs.ts +0 -22
  225. package/src/hooks/use-copy-clipboard.ts +0 -30
  226. package/src/hooks/use-debounce.ts +0 -17
  227. package/src/hooks/use-fill-ids.ts +0 -25
  228. package/src/hooks/use-map.ts +0 -26
  229. package/src/hooks/use-measure.ts +0 -42
  230. package/src/hooks/use-reverse-video-playback.ts +0 -43
  231. package/src/hooks/use-scroll-restoration.ts +0 -50
  232. package/src/mcp/README.md +0 -141
  233. package/src/mcp/enhanced-server.ts +0 -1208
  234. package/src/mcp/index.ts +0 -518
  235. package/src/mcp/package.json +0 -10
  236. package/src/registry/api.ts +0 -164
  237. package/src/registry/index.ts +0 -60
  238. package/src/registry/package.json +0 -10
  239. package/src/utils.ts +0 -1
  240. package/tailwind/colors.tailwind.js +0 -53
  241. package/tailwind/fontFamily.tailwind.ts +0 -7
  242. package/tailwind/fontSize.tailwind.ts +0 -13
  243. package/tailwind/index.ts +0 -7
  244. package/tailwind/safelist.tailwind.js +0 -26
  245. package/tailwind/screens.tailwind.js +0 -8
  246. package/tailwind/spacing.tailwind.js +0 -65
  247. package/tailwind/tailwind.config.hanzo-preset.d.ts +0 -5
  248. package/tailwind/tailwind.config.hanzo-preset.js +0 -915
  249. package/tailwind/tw-font-desc.ts +0 -15
  250. package/tailwind/typo-plugin/get-plugin-styles.js +0 -679
  251. package/tailwind/typo-plugin/index.d.ts +0 -9
  252. package/tailwind/typo-plugin/index.js +0 -141
  253. package/tailwind/typo-plugin/utils.js +0 -60
  254. package/tailwind/typography-test.mdx +0 -35
  255. package/tailwind/z-index.tailwind.js +0 -71
  256. package/test/test-registry.js +0 -73
  257. package/test-imports.mjs +0 -19
  258. package/tsconfig.json +0 -22
  259. package/types/animation-def.ts +0 -3
  260. package/types/breakpoints.ts +0 -11
  261. package/types/bullet-item.ts +0 -10
  262. package/types/button-def.ts +0 -39
  263. package/types/dimensions.ts +0 -8
  264. package/types/grid-def.ts +0 -56
  265. package/types/image-def.ts +0 -32
  266. package/types/index.ts +0 -29
  267. package/types/link-def.ts +0 -56
  268. package/types/media-stack-def.ts +0 -31
  269. package/types/t-shirt-size.ts +0 -5
  270. package/types/tshirt-dimensions.ts +0 -20
  271. package/types/video-def.ts +0 -25
  272. package/util/blob.ts +0 -28
  273. package/util/copy-to-clipboard.ts +0 -17
  274. package/util/create-shadow-root.ts +0 -22
  275. package/util/date.ts +0 -83
  276. package/util/debounce.ts +0 -11
  277. package/util/file.ts +0 -15
  278. package/util/format-and-abbreviate-as-currency.ts +0 -125
  279. package/util/format-text.ts +0 -33
  280. package/util/format-to-max-char.ts +0 -68
  281. package/util/index-client.ts +0 -3
  282. package/util/index.ts +0 -9
  283. package/util/number-abbreviate.ts +0 -49
  284. package/util/specifier.ts +0 -43
  285. package/util/spread-to-transform.ts +0 -24
  286. package/util/step-animation.ts +0 -90
  287. package/util/timing.ts +0 -3
  288. package/util/toasts.tsx +0 -17
  289. package/util/two-way-map.ts +0 -19
  290. package/utils.ts +0 -9
@@ -1,199 +0,0 @@
1
- import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
- import { Check, ChevronRight } from 'lucide-react';
3
- import * as React from 'react';
4
-
5
- import { cn } from '../src/utils';
6
-
7
- const DropdownMenu = DropdownMenuPrimitive.Root;
8
-
9
- const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
10
-
11
- const DropdownMenuGroup = DropdownMenuPrimitive.Group;
12
-
13
- const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
14
-
15
- const DropdownMenuSub = DropdownMenuPrimitive.Sub;
16
-
17
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
18
-
19
- const DropdownMenuSubTrigger = ({
20
- className,
21
- inset,
22
- children,
23
- ...props
24
- }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
25
- inset?: boolean;
26
- }) => (
27
- <DropdownMenuPrimitive.SubTrigger
28
- className={cn(
29
- 'focus:bg-accent data-[state=open]:bg-accent flex cursor-default items-center rounded-xs px-2 py-1.5 text-sm outline-hidden select-none',
30
- inset && 'pl-8',
31
- className,
32
- )}
33
- {...props}
34
- >
35
- {children}
36
- <ChevronRight className="ml-auto h-4 w-4" />
37
- </DropdownMenuPrimitive.SubTrigger>
38
- );
39
- DropdownMenuSubTrigger.displayName =
40
- DropdownMenuPrimitive.SubTrigger.displayName;
41
-
42
- const DropdownMenuSubContent = ({
43
- className,
44
- ...props
45
- }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) => (
46
- <DropdownMenuPrimitive.SubContent
47
- className={cn(
48
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[2000000000] min-w-[8rem] space-y-3 overflow-hidden rounded-md bg-gray-300 text-white shadow-lg',
49
- className,
50
- )}
51
- {...props}
52
- />
53
- );
54
- DropdownMenuSubContent.displayName =
55
- DropdownMenuPrimitive.SubContent.displayName;
56
-
57
- const DropdownMenuContent = ({
58
- className,
59
- sideOffset = 4,
60
- ...props
61
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) => (
62
- <DropdownMenuPrimitive.Portal>
63
- <DropdownMenuPrimitive.Content
64
- className={cn(
65
- 'font-inter border-divider data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-bg-dark z-[2000000000] min-w-[8rem] overflow-hidden rounded-lg border px-4 py-6 text-white shadow-md',
66
- className,
67
- )}
68
- sideOffset={sideOffset}
69
- {...props}
70
- />
71
- </DropdownMenuPrimitive.Portal>
72
- );
73
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
74
-
75
- const DropdownMenuItem = ({
76
- className,
77
- inset,
78
- ...props
79
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
80
- inset?: boolean;
81
- }) => (
82
- <DropdownMenuPrimitive.Item
83
- className={cn(
84
- 'focus:bg-bg-secondary relative flex cursor-default items-center rounded-lg px-2 py-2 text-sm outline-hidden transition-colors select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
85
- inset && 'pl-8',
86
- className,
87
- )}
88
- {...props}
89
- />
90
- );
91
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
92
-
93
- const DropdownMenuCheckboxItem = ({
94
- className,
95
- children,
96
- checked,
97
- ...props
98
- }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) => (
99
- <DropdownMenuPrimitive.CheckboxItem
100
- checked={checked}
101
- className={cn(
102
- 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
103
- className,
104
- )}
105
- {...props}
106
- >
107
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center rounded-xs bg-gray-300">
108
- <DropdownMenuPrimitive.ItemIndicator>
109
- <Check className="h-3 w-3" />
110
- </DropdownMenuPrimitive.ItemIndicator>
111
- </span>
112
- {children}
113
- </DropdownMenuPrimitive.CheckboxItem>
114
- );
115
- DropdownMenuCheckboxItem.displayName =
116
- DropdownMenuPrimitive.CheckboxItem.displayName;
117
-
118
- const DropdownMenuRadioItem = ({
119
- className,
120
- children,
121
- ...props
122
- }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) => (
123
- <DropdownMenuPrimitive.RadioItem
124
- className={cn(
125
- 'focus:bg-bg-secondary relative flex cursor-default items-center rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:text-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
126
- 'hover:bg-bg-secondary data-[state=checked]:bg-bg-secondary',
127
- className,
128
- )}
129
- {...props}
130
- >
131
- {/*<span className="absolute left-2 flex items-center justify-center">*/}
132
- {/* <DropdownMenuPrimitive.ItemIndicator>*/}
133
- {/* <Check className="h-4 w-4 text-inherit" />*/}
134
- {/* </DropdownMenuPrimitive.ItemIndicator>*/}
135
- {/*</span>*/}
136
- {children}
137
- </DropdownMenuPrimitive.RadioItem>
138
- );
139
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
140
-
141
- const DropdownMenuLabel = ({
142
- className,
143
- inset,
144
- ...props
145
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
146
- inset?: boolean;
147
- }) => (
148
- <DropdownMenuPrimitive.Label
149
- className={cn(
150
- 'text-text-secondary text-xs tracking-[2px] uppercase',
151
- inset && 'pl-8',
152
- className,
153
- )}
154
- {...props}
155
- />
156
- );
157
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
158
-
159
- const DropdownMenuSeparator = ({
160
- className,
161
- ...props
162
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) => (
163
- <DropdownMenuPrimitive.Separator
164
- className={cn('bg-divider -mx-1 my-1 h-px', className)}
165
- {...props}
166
- />
167
- );
168
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
169
-
170
- const DropdownMenuShortcut = ({
171
- className,
172
- ...props
173
- }: React.HTMLAttributes<HTMLSpanElement>) => {
174
- return (
175
- <span
176
- className={cn('ml-auto text-xs tracking-widest opacity-60', className)}
177
- {...props}
178
- />
179
- );
180
- };
181
- DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
182
-
183
- export {
184
- DropdownMenu,
185
- DropdownMenuTrigger,
186
- DropdownMenuContent,
187
- DropdownMenuItem,
188
- DropdownMenuCheckboxItem,
189
- DropdownMenuRadioItem,
190
- DropdownMenuLabel,
191
- DropdownMenuSeparator,
192
- DropdownMenuShortcut,
193
- DropdownMenuGroup,
194
- DropdownMenuPortal,
195
- DropdownMenuSub,
196
- DropdownMenuSubContent,
197
- DropdownMenuSubTrigger,
198
- DropdownMenuRadioGroup,
199
- };
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
-
3
- interface ErrorMessageProps extends React.HTMLAttributes<HTMLDivElement> {
4
- message: string;
5
- }
6
-
7
- const ErrorMessage = ({ message, ...props }: ErrorMessageProps) => {
8
- return (
9
- <div
10
- className="rounded-sm bg-red-500/10 px-4 py-2 text-sm text-red-700"
11
- {...props}
12
- >
13
- <strong className="font-bold">Error: </strong>
14
- <span className="block sm:inline"> {message} </span>
15
- </div>
16
- );
17
- };
18
-
19
- export { ErrorMessage };
@@ -1,200 +0,0 @@
1
- import { useTranslation } from '@hanzo_network/hanzo-i18n';
2
- import { partial } from 'filesize';
3
- import { Loader2, Trash, Upload } from 'lucide-react';
4
- import React, { useEffect, useState } from 'react';
5
- import { useDropzone } from 'react-dropzone';
6
-
7
- import { fileIconMap, FileTypeIcon, PaperClipIcon } from '../assets';
8
- import { getFileExt } from '../helpers/file';
9
- import { cn } from '../src/utils';
10
- import { Button } from './button';
11
- import { ScrollArea } from './scroll-area';
12
-
13
- const openFile = (file: File): void => {
14
- const fileURL = window.URL.createObjectURL(file);
15
- window.open(fileURL, '_blank');
16
- URL.revokeObjectURL(fileURL);
17
- };
18
-
19
- export const FileItem = ({
20
- file,
21
- actions,
22
- }: {
23
- file: File;
24
- actions?: {
25
- label: string;
26
- icon: React.ReactNode;
27
- onClick: (file: File) => void;
28
- }[];
29
- }) => {
30
- const size = partial({ standard: 'jedec' });
31
- const hasPreviewImage = file?.type?.includes('image/');
32
-
33
- return (
34
- <div className="bg-bg-quaternary relative flex items-center gap-2 rounded-xl px-3 py-1.5 pr-2">
35
- <span className="flex w-[30px] items-center justify-center">
36
- {hasPreviewImage ? (
37
- <FileImagePreview
38
- className="h-full rounded-md object-cover"
39
- file={file}
40
- />
41
- ) : fileIconMap[getFileExt(file.name)] ? (
42
- <FileTypeIcon
43
- className="text-text-secondary"
44
- type={getFileExt(file.name)}
45
- />
46
- ) : (
47
- <PaperClipIcon className="text-text-secondary h-4 w-4" />
48
- )}
49
- </span>
50
- <div className="line-clamp-1 flex flex-1 flex-col gap-1">
51
- <button
52
- className="text-left hover:underline"
53
- onClick={() => openFile(file)}
54
- type="button"
55
- >
56
- <span className="text-text-default line-clamp-1 text-sm">
57
- {decodeURIComponent(file.name)}
58
- </span>
59
- </button>
60
- {file.size && (
61
- <span className="text-text-tertiary shrink-0 text-xs">
62
- {size(file.size)}
63
- </span>
64
- )}
65
- </div>
66
- {!!actions?.length && (
67
- <div className="shrink-0">
68
- {actions?.map((action) => (
69
- <Button
70
- className="h-8 w-8 border-0 bg-transparent"
71
- key={action.label}
72
- onClick={() => action.onClick(file)}
73
- size="icon"
74
- type="button"
75
- variant="outline"
76
- >
77
- <span className="sr-only">{action.label}</span>
78
- {action.icon}
79
- </Button>
80
- ))}
81
- </div>
82
- )}
83
- </div>
84
- );
85
- };
86
-
87
- export const FileUploader = ({
88
- value,
89
- onChange,
90
- maxFiles,
91
- accept,
92
- allowMultiple,
93
- disabled,
94
- descriptionText,
95
- shouldDisableScrolling,
96
- }: {
97
- value: File[];
98
- onChange: (files: File[]) => void;
99
- maxFiles?: number;
100
- accept?: string;
101
- allowMultiple?: boolean;
102
- disabled?: boolean;
103
- descriptionText?: string;
104
- shouldDisableScrolling?: boolean;
105
- }) => {
106
- const { t } = useTranslation();
107
- const { getRootProps: getRootFileProps, getInputProps: getInputFileProps } =
108
- useDropzone({
109
- multiple: allowMultiple,
110
- maxFiles: maxFiles,
111
- onDrop: (acceptedFiles) => {
112
- onChange(acceptedFiles);
113
- },
114
- disabled: disabled,
115
- });
116
-
117
- return (
118
- <div className="flex w-full flex-col gap-2.5">
119
- <div
120
- {...getRootFileProps({
121
- className:
122
- 'dropzone py-4 bg-bg-secondary group relative mt-3 flex cursor-pointer items-center justify-center overflow-hidden rounded-lg border border-dashed border-divider transition-colors hover:border-border-input-focus',
123
- })}
124
- >
125
- <div className="flex flex-col items-center justify-center space-y-1 px-2">
126
- <div className="bg-bg-tertiary rounded-full p-2 shadow-xs">
127
- <Upload className="h-4 w-4" />
128
- </div>
129
- <p className="text-sm text-white">{t('common.clickToUpload')}</p>
130
- {descriptionText && (
131
- <p className="text-text-tertiary line-clamp-1 text-xs">
132
- {descriptionText}
133
- </p>
134
- )}
135
- </div>
136
-
137
- <input
138
- {...getInputFileProps({
139
- accept: accept,
140
- })}
141
- />
142
- </div>
143
-
144
- {!!value?.length && (
145
- <ScrollArea
146
- className={cn(
147
- 'max-h-[40vh] flex-1 grow overflow-y-scroll pr-1 [&>div>div]:!block',
148
- shouldDisableScrolling && 'max-h-full overflow-y-auto pr-0',
149
- )}
150
- >
151
- <div className="flex flex-col gap-2">
152
- {value?.map((file, idx) => (
153
- <FileItem
154
- actions={[
155
- {
156
- label: 'Delete',
157
- icon: <Trash className="text-text-tertiary h-4 w-4" />,
158
- onClick: (file) => {
159
- const newFiles = [...value];
160
- newFiles.splice(newFiles.indexOf(file), 1);
161
- onChange(newFiles);
162
- },
163
- },
164
- ]}
165
- file={file}
166
- key={file.name + idx}
167
- />
168
- ))}
169
- </div>
170
- </ScrollArea>
171
- )}
172
- </div>
173
- );
174
- };
175
-
176
- interface FileImagePreview extends React.HTMLAttributes<HTMLDivElement> {
177
- file: File;
178
- }
179
-
180
- const FileImagePreview = ({ file, ...props }: FileImagePreview) => {
181
- const [imageSrc, setImageSrc] = useState('');
182
- useEffect(() => {
183
- const reader = new FileReader();
184
- reader.addEventListener(
185
- 'load',
186
- function () {
187
- setImageSrc(reader.result as string);
188
- },
189
- false,
190
- );
191
- if (file) {
192
- reader.readAsDataURL(file);
193
- }
194
- }, [file]);
195
- return imageSrc ? (
196
- <img alt="preview" src={imageSrc} {...props} />
197
- ) : (
198
- <Loader2 />
199
- );
200
- };
@@ -1,183 +0,0 @@
1
- import type * as LabelPrimitive from '@radix-ui/react-label';
2
- import { Slot } from '@radix-ui/react-slot';
3
- import * as React from 'react';
4
- import {
5
- Controller,
6
- type ControllerProps,
7
- type FieldPath,
8
- type FieldValues,
9
- FormProvider,
10
- useFormContext,
11
- } from 'react-hook-form';
12
-
13
- import { cn } from '../src/utils';
14
- import { Label } from './label';
15
-
16
- const Form = FormProvider;
17
-
18
- type FormFieldContextValue<
19
- TFieldValues extends FieldValues = FieldValues,
20
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
21
- > = {
22
- name: TName;
23
- };
24
-
25
- const FormFieldContext = React.createContext<FormFieldContextValue>(
26
- {} as FormFieldContextValue,
27
- );
28
-
29
- const FormField = <
30
- TFieldValues extends FieldValues = FieldValues,
31
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
32
- >({
33
- ...props
34
- }: ControllerProps<TFieldValues, TName>) => {
35
- return (
36
- <FormFieldContext.Provider value={{ name: props.name }}>
37
- <Controller {...props} />
38
- </FormFieldContext.Provider>
39
- );
40
- };
41
-
42
- const useFormField = () => {
43
- const fieldContext = React.useContext(FormFieldContext);
44
- const itemContext = React.useContext(FormItemContext);
45
- const { getFieldState, formState } = useFormContext();
46
-
47
- const fieldState = getFieldState(fieldContext.name, formState);
48
-
49
- if (!fieldContext) {
50
- throw new Error('useFormField should be used within <FormField>');
51
- }
52
-
53
- const { id } = itemContext;
54
-
55
- return {
56
- id,
57
- name: fieldContext.name,
58
- formItemId: `${id}-form-item`,
59
- formDescriptionId: `${id}-form-item-description`,
60
- formMessageId: `${id}-form-item-message`,
61
- ...fieldState,
62
- };
63
- };
64
-
65
- type FormItemContextValue = {
66
- id: string;
67
- };
68
-
69
- const FormItemContext = React.createContext<FormItemContextValue>(
70
- {} as FormItemContextValue,
71
- );
72
-
73
- const FormItem = ({
74
- className,
75
- ...props
76
- }: React.HTMLAttributes<HTMLDivElement>) => {
77
- const id = React.useId();
78
-
79
- return (
80
- <FormItemContext.Provider value={{ id }}>
81
- <div className={cn('relative', className)} {...props} />
82
- </FormItemContext.Provider>
83
- );
84
- };
85
- FormItem.displayName = 'FormItem';
86
-
87
- const FormLabel = ({
88
- className,
89
- ...props
90
- }: React.ComponentProps<typeof LabelPrimitive.Root>) => {
91
- const { error, formItemId } = useFormField();
92
-
93
- return (
94
- <Label
95
- className={cn(
96
- 'text-text-secondary pointer-events-none absolute top-3 left-4 flex text-xs leading-tight font-medium transition-all select-none',
97
- // input
98
- 'peer-placeholder-shown:text-text-tertiary z-[1] peer-placeholder-shown:text-base peer-placeholder-shown:leading-[2.3]',
99
- 'peer-focus:text-text-secondary peer-disabled:peer-placeholder-shown:text-text-tertiary peer-disabled:text-text-tertiary peer-focus:text-xs peer-focus:leading-tight',
100
- // select
101
- 'peer-data-[placeholder]/select:top-5 peer-data-[placeholder]/select:text-base',
102
- // adornment
103
- 'peer-[.adornment]/adornment:text-xs',
104
- error && 'text-red-500',
105
- className,
106
- )}
107
- htmlFor={formItemId}
108
- {...props}
109
- />
110
- );
111
- };
112
- FormLabel.displayName = 'FormLabel';
113
-
114
- const FormControl = ({ ...props }: React.ComponentProps<typeof Slot>) => {
115
- const { error, formItemId, formDescriptionId, formMessageId } =
116
- useFormField();
117
-
118
- return (
119
- <Slot
120
- aria-describedby={
121
- error ? `${formDescriptionId} ${formMessageId}` : `${formDescriptionId}`
122
- }
123
- aria-invalid={!!error}
124
- id={formItemId}
125
- {...props}
126
- />
127
- );
128
- };
129
- FormControl.displayName = 'FormControl';
130
-
131
- const FormDescription = ({
132
- className,
133
- ...props
134
- }: React.HTMLAttributes<HTMLParagraphElement>) => {
135
- const { formDescriptionId } = useFormField();
136
-
137
- return (
138
- <p
139
- className={cn('text-text-secondary py-1 text-[0.75rem]', className)}
140
- id={formDescriptionId}
141
- {...props}
142
- />
143
- );
144
- };
145
- FormDescription.displayName = 'FormDescription';
146
-
147
- const FormMessage = ({
148
- className,
149
- children,
150
- ...props
151
- }: React.HTMLAttributes<HTMLParagraphElement>) => {
152
- const { error, formMessageId } = useFormField();
153
- const body = error ? String(error?.message) : children;
154
-
155
- if (!body) {
156
- return null;
157
- }
158
-
159
- return (
160
- <p
161
- className={cn(
162
- 'text-red text-[0.75rem] font-medium dark:text-red-900',
163
- className,
164
- )}
165
- id={formMessageId}
166
- {...props}
167
- >
168
- {body}
169
- </p>
170
- );
171
- };
172
- FormMessage.displayName = 'FormMessage';
173
-
174
- export {
175
- useFormField,
176
- Form,
177
- FormItem,
178
- FormLabel,
179
- FormControl,
180
- FormDescription,
181
- FormMessage,
182
- FormField,
183
- };
@@ -1,28 +0,0 @@
1
- import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
2
- import * as React from 'react';
3
-
4
- import { cn } from '../src/utils';
5
-
6
- const HoverCard = HoverCardPrimitive.Root;
7
-
8
- const HoverCardTrigger = HoverCardPrimitive.Trigger;
9
-
10
- const HoverCardContent = ({
11
- className,
12
- align = 'center',
13
- sideOffset = 4,
14
- ...props
15
- }: React.ComponentProps<typeof HoverCardPrimitive.Content>) => (
16
- <HoverCardPrimitive.Content
17
- align={align}
18
- className={cn(
19
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-bg-dark border-divider z-[1500000000] flex flex-col gap-3 rounded-md border pt-1 shadow-none outline-hidden data-[side=top]:flex-col-reverse',
20
- className,
21
- )}
22
- sideOffset={sideOffset}
23
- {...props}
24
- />
25
- );
26
- HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
27
-
28
- export { HoverCard, HoverCardTrigger, HoverCardContent };
@@ -1,14 +0,0 @@
1
- import React from 'react'
2
- import type { LucideProps } from 'lucide-react'
3
-
4
-
5
- const GitHub: React.FC<LucideProps> = (props: LucideProps) => (
6
- <svg viewBox="0 0 438.549 438.549" {...props}>
7
- <path
8
- fill="currentColor"
9
- d="M409.132 114.573c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.063-29.408-39.781 0-76.472 9.804-110.063 29.408-33.596 19.605-60.192 46.204-79.8 79.8C9.803 148.168 0 184.854 0 224.63c0 47.78 13.94 90.745 41.827 128.906 27.884 38.164 63.906 64.572 108.063 79.227 5.14.954 8.945.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-.571-.049-5.708-.144-15.417a2549.81 2549.81 0 01-.144-25.406l-6.567 1.136c-4.187.767-9.469 1.092-15.846 1-6.374-.089-12.991-.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-.572-1.335-.098-2.43 1.427-3.289 1.525-.859 4.281-1.276 8.28-1.276l5.708.853c3.807.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136 6.28 0 11.704-.476 16.274-1.423 4.565-.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.068-79.226 27.88-38.161 41.825-81.126 41.825-128.906-.01-39.771-9.818-76.454-29.414-110.049z"
10
- ></path>
11
- </svg>
12
- )
13
-
14
- export default GitHub
@@ -1,18 +0,0 @@
1
- import {
2
- Moon as moon,
3
- SunMedium as sun,
4
- Menu as burger,
5
- ArrowUpRight as linkOut,
6
- } from 'lucide-react'
7
-
8
- import youtube from './youtube-logo'
9
- import gitHub from './github'
10
-
11
- export {
12
- sun,
13
- moon,
14
- burger,
15
- gitHub,
16
- linkOut,
17
- youtube,
18
- }