@docyrus/ui-pro-ai-assistant 0.0.1

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 (308) hide show
  1. package/dist/index.js +26161 -0
  2. package/dist/index.js.map +1 -0
  3. package/package.json +155 -0
  4. package/src/components/assistant-animations.tsx +29 -0
  5. package/src/components/assistant-dialogs.tsx +235 -0
  6. package/src/components/code-view.tsx +278 -0
  7. package/src/components/create-agent-task.tsx +104 -0
  8. package/src/components/create-new-work-version.tsx +30 -0
  9. package/src/components/extract-web.tsx +160 -0
  10. package/src/components/forward-to-agent.tsx +90 -0
  11. package/src/components/generate-chart.tsx +101 -0
  12. package/src/components/generative-action-button.tsx +122 -0
  13. package/src/components/generative-tool.tsx +685 -0
  14. package/src/components/generative-ui-object.tsx +210 -0
  15. package/src/components/input-area.tsx +1209 -0
  16. package/src/components/json-schema-layout.tsx +326 -0
  17. package/src/components/list-item-card.tsx +92 -0
  18. package/src/components/mermaid-diagram.tsx +192 -0
  19. package/src/components/preview-image.tsx +47 -0
  20. package/src/components/request-approval.tsx +48 -0
  21. package/src/components/request-user-input.tsx +270 -0
  22. package/src/components/search-web.tsx +319 -0
  23. package/src/components/sheet-command.tsx +88 -0
  24. package/src/components/shell-canvas.tsx +122 -0
  25. package/src/components/show-advanced-data-table.tsx +352 -0
  26. package/src/components/show-generated-content-options.tsx +93 -0
  27. package/src/components/show-people-cards.tsx +180 -0
  28. package/src/components/subagent-tool.tsx +180 -0
  29. package/src/components/text-editor-tool.tsx +328 -0
  30. package/src/components/work-canvas.tsx +88 -0
  31. package/src/components/work-card.tsx +42 -0
  32. package/src/declarations.d.ts +1 -0
  33. package/src/docy-assistant.tsx +1962 -0
  34. package/src/hooks/index.ts +7 -0
  35. package/src/hooks/use-assistant-api.ts +507 -0
  36. package/src/hooks/use-deployment-data.ts +162 -0
  37. package/src/hooks/use-project-state.ts +347 -0
  38. package/src/hooks/use-session-state.ts +207 -0
  39. package/src/hooks/use-speech-recognition.ts +137 -0
  40. package/src/hooks/use-ui-state.ts +185 -0
  41. package/src/hooks/use-works-state.ts +146 -0
  42. package/src/i18n/context.tsx +253 -0
  43. package/src/i18n/index.ts +19 -0
  44. package/src/i18n/locales/de.json +198 -0
  45. package/src/i18n/locales/el.json +198 -0
  46. package/src/i18n/locales/en.json +226 -0
  47. package/src/i18n/locales/es.json +198 -0
  48. package/src/i18n/locales/fr.json +198 -0
  49. package/src/i18n/locales/it.json +198 -0
  50. package/src/i18n/locales/pt.json +198 -0
  51. package/src/i18n/locales/sl.json +198 -0
  52. package/src/i18n/locales/tr.json +211 -0
  53. package/src/i18n/types.ts +23 -0
  54. package/src/i18n/use-translation.ts +17 -0
  55. package/src/index.ts +18 -0
  56. package/src/internal/plate-editor/editor/auth-context.ts +11 -0
  57. package/src/internal/plate-editor/editor/editor-base-kit.tsx +39 -0
  58. package/src/internal/plate-editor/editor/editor-kit.tsx +89 -0
  59. package/src/internal/plate-editor/editor/plate-editor.tsx +75 -0
  60. package/src/internal/plate-editor/editor/plate-types.ts +126 -0
  61. package/src/internal/plate-editor/editor/plugins/ai-kit.tsx +172 -0
  62. package/src/internal/plate-editor/editor/plugins/autoformat-kit.tsx +211 -0
  63. package/src/internal/plate-editor/editor/plugins/basic-blocks-base-kit.tsx +26 -0
  64. package/src/internal/plate-editor/editor/plugins/basic-blocks-kit.tsx +51 -0
  65. package/src/internal/plate-editor/editor/plugins/basic-marks-base-kit.tsx +24 -0
  66. package/src/internal/plate-editor/editor/plugins/basic-marks-kit.tsx +38 -0
  67. package/src/internal/plate-editor/editor/plugins/basic-nodes-kit.tsx +6 -0
  68. package/src/internal/plate-editor/editor/plugins/block-menu-kit.tsx +14 -0
  69. package/src/internal/plate-editor/editor/plugins/block-placeholder-kit.tsx +17 -0
  70. package/src/internal/plate-editor/editor/plugins/block-selection-kit.tsx +31 -0
  71. package/src/internal/plate-editor/editor/plugins/callout-base-kit.tsx +5 -0
  72. package/src/internal/plate-editor/editor/plugins/callout-kit.tsx +7 -0
  73. package/src/internal/plate-editor/editor/plugins/code-block-base-kit.tsx +23 -0
  74. package/src/internal/plate-editor/editor/plugins/code-block-kit.tsx +26 -0
  75. package/src/internal/plate-editor/editor/plugins/column-base-kit.tsx +8 -0
  76. package/src/internal/plate-editor/editor/plugins/column-kit.tsx +7 -0
  77. package/src/internal/plate-editor/editor/plugins/comment-base-kit.tsx +5 -0
  78. package/src/internal/plate-editor/editor/plugins/comment-kit.tsx +174 -0
  79. package/src/internal/plate-editor/editor/plugins/copilot-kit.tsx +68 -0
  80. package/src/internal/plate-editor/editor/plugins/cursor-overlay-kit.tsx +13 -0
  81. package/src/internal/plate-editor/editor/plugins/date-base-kit.tsx +5 -0
  82. package/src/internal/plate-editor/editor/plugins/date-kit.tsx +7 -0
  83. package/src/internal/plate-editor/editor/plugins/discussion-kit.tsx +36 -0
  84. package/src/internal/plate-editor/editor/plugins/dnd-kit.tsx +27 -0
  85. package/src/internal/plate-editor/editor/plugins/docx-export-kit.tsx +43 -0
  86. package/src/internal/plate-editor/editor/plugins/docx-kit.tsx +6 -0
  87. package/src/internal/plate-editor/editor/plugins/emoji-kit.tsx +15 -0
  88. package/src/internal/plate-editor/editor/plugins/exit-break-kit.tsx +12 -0
  89. package/src/internal/plate-editor/editor/plugins/floating-toolbar-kit.tsx +19 -0
  90. package/src/internal/plate-editor/editor/plugins/font-base-kit.tsx +36 -0
  91. package/src/internal/plate-editor/editor/plugins/font-kit.tsx +47 -0
  92. package/src/internal/plate-editor/editor/plugins/indent-base-kit.tsx +19 -0
  93. package/src/internal/plate-editor/editor/plugins/indent-kit.tsx +22 -0
  94. package/src/internal/plate-editor/editor/plugins/link-base-kit.tsx +5 -0
  95. package/src/internal/plate-editor/editor/plugins/link-kit.tsx +35 -0
  96. package/src/internal/plate-editor/editor/plugins/list-base-kit.tsx +24 -0
  97. package/src/internal/plate-editor/editor/plugins/list-kit.tsx +27 -0
  98. package/src/internal/plate-editor/editor/plugins/markdown-kit.tsx +18 -0
  99. package/src/internal/plate-editor/editor/plugins/math-base-kit.tsx +8 -0
  100. package/src/internal/plate-editor/editor/plugins/math-kit.tsx +10 -0
  101. package/src/internal/plate-editor/editor/plugins/media-base-kit.tsx +37 -0
  102. package/src/internal/plate-editor/editor/plugins/media-kit.tsx +53 -0
  103. package/src/internal/plate-editor/editor/plugins/mention-base-kit.tsx +5 -0
  104. package/src/internal/plate-editor/editor/plugins/mention-kit.tsx +36 -0
  105. package/src/internal/plate-editor/editor/plugins/slash-kit.tsx +17 -0
  106. package/src/internal/plate-editor/editor/plugins/suggestion-base-kit.tsx +5 -0
  107. package/src/internal/plate-editor/editor/plugins/suggestion-kit.tsx +95 -0
  108. package/src/internal/plate-editor/editor/plugins/table-base-kit.tsx +20 -0
  109. package/src/internal/plate-editor/editor/plugins/table-kit.tsx +22 -0
  110. package/src/internal/plate-editor/editor/plugins/toc-base-kit.tsx +5 -0
  111. package/src/internal/plate-editor/editor/plugins/toc-kit.tsx +14 -0
  112. package/src/internal/plate-editor/editor/plugins/toggle-base-kit.tsx +5 -0
  113. package/src/internal/plate-editor/editor/plugins/toggle-kit.tsx +9 -0
  114. package/src/internal/plate-editor/editor/transforms.ts +165 -0
  115. package/src/internal/plate-editor/editor/use-chat.ts +152 -0
  116. package/src/internal/plate-editor/hooks/index.ts +3 -0
  117. package/src/internal/plate-editor/hooks/use-copy-to-clipboard.ts +31 -0
  118. package/src/internal/plate-editor/hooks/use-is-touch-device.ts +26 -0
  119. package/src/internal/plate-editor/hooks/use-lock-scroll.ts +21 -0
  120. package/src/internal/plate-editor/hooks/use-media-query.ts +44 -0
  121. package/src/internal/plate-editor/hooks/use-mounted.ts +18 -0
  122. package/src/internal/plate-editor/hooks/use-on-click-outside.ts +114 -0
  123. package/src/internal/plate-editor/hooks/use-upload-file.ts +81 -0
  124. package/src/internal/plate-editor/i18n/context.tsx +58 -0
  125. package/src/internal/plate-editor/i18n/index.ts +3 -0
  126. package/src/internal/plate-editor/i18n/locales/de.json +57 -0
  127. package/src/internal/plate-editor/i18n/locales/el.json +57 -0
  128. package/src/internal/plate-editor/i18n/locales/en.json +57 -0
  129. package/src/internal/plate-editor/i18n/locales/es.json +57 -0
  130. package/src/internal/plate-editor/i18n/locales/fr.json +57 -0
  131. package/src/internal/plate-editor/i18n/locales/it.json +57 -0
  132. package/src/internal/plate-editor/i18n/locales/pt.json +57 -0
  133. package/src/internal/plate-editor/i18n/locales/sl.json +57 -0
  134. package/src/internal/plate-editor/i18n/locales/tr.json +57 -0
  135. package/src/internal/plate-editor/i18n/types.ts +59 -0
  136. package/src/internal/plate-editor/i18n/use-translation.ts +22 -0
  137. package/src/internal/plate-editor/index.ts +39 -0
  138. package/src/internal/plate-editor/lib/ai-output-converter.ts +153 -0
  139. package/src/internal/plate-editor/lib/download-file.ts +17 -0
  140. package/src/internal/plate-editor/plate-ui/ai-chat-editor.tsx +26 -0
  141. package/src/internal/plate-editor/plate-ui/ai-menu.tsx +828 -0
  142. package/src/internal/plate-editor/plate-ui/ai-node.tsx +41 -0
  143. package/src/internal/plate-editor/plate-ui/ai-toolbar-button.tsx +27 -0
  144. package/src/internal/plate-editor/plate-ui/alert-dialog.tsx +147 -0
  145. package/src/internal/plate-editor/plate-ui/align-toolbar-button.tsx +90 -0
  146. package/src/internal/plate-editor/plate-ui/avatar.tsx +3 -0
  147. package/src/internal/plate-editor/plate-ui/block-context-menu.tsx +106 -0
  148. package/src/internal/plate-editor/plate-ui/block-discussion.tsx +364 -0
  149. package/src/internal/plate-editor/plate-ui/block-draggable.tsx +556 -0
  150. package/src/internal/plate-editor/plate-ui/block-list-static.tsx +78 -0
  151. package/src/internal/plate-editor/plate-ui/block-list.tsx +85 -0
  152. package/src/internal/plate-editor/plate-ui/block-menu.tsx +557 -0
  153. package/src/internal/plate-editor/plate-ui/block-selection.tsx +47 -0
  154. package/src/internal/plate-editor/plate-ui/block-suggestion.tsx +469 -0
  155. package/src/internal/plate-editor/plate-ui/blockquote-node-static.tsx +10 -0
  156. package/src/internal/plate-editor/plate-ui/blockquote-node.tsx +11 -0
  157. package/src/internal/plate-editor/plate-ui/button.tsx +190 -0
  158. package/src/internal/plate-editor/plate-ui/calendar.tsx +3 -0
  159. package/src/internal/plate-editor/plate-ui/callout-node-static.tsx +76 -0
  160. package/src/internal/plate-editor/plate-ui/callout-node.tsx +54 -0
  161. package/src/internal/plate-editor/plate-ui/caption.tsx +48 -0
  162. package/src/internal/plate-editor/plate-ui/checkbox.tsx +3 -0
  163. package/src/internal/plate-editor/plate-ui/code-block-node-static.tsx +172 -0
  164. package/src/internal/plate-editor/plate-ui/code-block-node.tsx +228 -0
  165. package/src/internal/plate-editor/plate-ui/code-node-static.tsx +11 -0
  166. package/src/internal/plate-editor/plate-ui/code-node.tsx +12 -0
  167. package/src/internal/plate-editor/plate-ui/column-node-static.tsx +65 -0
  168. package/src/internal/plate-editor/plate-ui/column-node.tsx +24 -0
  169. package/src/internal/plate-editor/plate-ui/command.tsx +204 -0
  170. package/src/internal/plate-editor/plate-ui/comment-node-static.tsx +12 -0
  171. package/src/internal/plate-editor/plate-ui/comment-node.tsx +45 -0
  172. package/src/internal/plate-editor/plate-ui/comment-toolbar-button.tsx +24 -0
  173. package/src/internal/plate-editor/plate-ui/comment.tsx +619 -0
  174. package/src/internal/plate-editor/plate-ui/cursor-overlay.tsx +85 -0
  175. package/src/internal/plate-editor/plate-ui/date-node-static.tsx +43 -0
  176. package/src/internal/plate-editor/plate-ui/date-node.tsx +56 -0
  177. package/src/internal/plate-editor/plate-ui/dialog.tsx +426 -0
  178. package/src/internal/plate-editor/plate-ui/dropdown-menu.tsx +266 -0
  179. package/src/internal/plate-editor/plate-ui/editor-static.tsx +40 -0
  180. package/src/internal/plate-editor/plate-ui/editor.tsx +148 -0
  181. package/src/internal/plate-editor/plate-ui/emoji-node.tsx +48 -0
  182. package/src/internal/plate-editor/plate-ui/emoji-toolbar-button.tsx +626 -0
  183. package/src/internal/plate-editor/plate-ui/equation-node-static.tsx +155 -0
  184. package/src/internal/plate-editor/plate-ui/equation-node.tsx +226 -0
  185. package/src/internal/plate-editor/plate-ui/equation-toolbar-button.tsx +26 -0
  186. package/src/internal/plate-editor/plate-ui/export-toolbar-button.tsx +208 -0
  187. package/src/internal/plate-editor/plate-ui/fixed-toolbar-buttons.tsx +157 -0
  188. package/src/internal/plate-editor/plate-ui/fixed-toolbar.tsx +27 -0
  189. package/src/internal/plate-editor/plate-ui/floating-discussion.tsx +1129 -0
  190. package/src/internal/plate-editor/plate-ui/floating-toolbar-buttons.tsx +129 -0
  191. package/src/internal/plate-editor/plate-ui/floating-toolbar.tsx +99 -0
  192. package/src/internal/plate-editor/plate-ui/font-color-toolbar-button.tsx +211 -0
  193. package/src/internal/plate-editor/plate-ui/font-size-toolbar-button.tsx +154 -0
  194. package/src/internal/plate-editor/plate-ui/ghost-text.tsx +20 -0
  195. package/src/internal/plate-editor/plate-ui/heading-node-static.tsx +52 -0
  196. package/src/internal/plate-editor/plate-ui/heading-node.tsx +56 -0
  197. package/src/internal/plate-editor/plate-ui/highlight-node-static.tsx +9 -0
  198. package/src/internal/plate-editor/plate-ui/highlight-node.tsx +11 -0
  199. package/src/internal/plate-editor/plate-ui/history-toolbar-button.tsx +52 -0
  200. package/src/internal/plate-editor/plate-ui/hover-card.tsx +7 -0
  201. package/src/internal/plate-editor/plate-ui/hr-node-static.tsx +18 -0
  202. package/src/internal/plate-editor/plate-ui/hr-node.tsx +28 -0
  203. package/src/internal/plate-editor/plate-ui/import-toolbar-button.tsx +124 -0
  204. package/src/internal/plate-editor/plate-ui/indent-toolbar-button.tsx +34 -0
  205. package/src/internal/plate-editor/plate-ui/inline-combobox.tsx +409 -0
  206. package/src/internal/plate-editor/plate-ui/input.tsx +39 -0
  207. package/src/internal/plate-editor/plate-ui/insert-toolbar-button.tsx +260 -0
  208. package/src/internal/plate-editor/plate-ui/label.tsx +1 -0
  209. package/src/internal/plate-editor/plate-ui/line-height-toolbar-button.tsx +71 -0
  210. package/src/internal/plate-editor/plate-ui/link-node-static.tsx +15 -0
  211. package/src/internal/plate-editor/plate-ui/link-node.tsx +33 -0
  212. package/src/internal/plate-editor/plate-ui/link-toolbar-button.tsx +30 -0
  213. package/src/internal/plate-editor/plate-ui/link-toolbar.tsx +149 -0
  214. package/src/internal/plate-editor/plate-ui/list-toolbar-button.tsx +179 -0
  215. package/src/internal/plate-editor/plate-ui/mark-toolbar-button.tsx +36 -0
  216. package/src/internal/plate-editor/plate-ui/media-audio-node-static.tsx +21 -0
  217. package/src/internal/plate-editor/plate-ui/media-audio-node.tsx +32 -0
  218. package/src/internal/plate-editor/plate-ui/media-embed-node.tsx +103 -0
  219. package/src/internal/plate-editor/plate-ui/media-file-node-static.tsx +30 -0
  220. package/src/internal/plate-editor/plate-ui/media-file-node.tsx +52 -0
  221. package/src/internal/plate-editor/plate-ui/media-image-node-static.tsx +37 -0
  222. package/src/internal/plate-editor/plate-ui/media-image-node.tsx +183 -0
  223. package/src/internal/plate-editor/plate-ui/media-placeholder-node.tsx +441 -0
  224. package/src/internal/plate-editor/plate-ui/media-preview-dialog.tsx +127 -0
  225. package/src/internal/plate-editor/plate-ui/media-toolbar-button.tsx +229 -0
  226. package/src/internal/plate-editor/plate-ui/media-toolbar.tsx +216 -0
  227. package/src/internal/plate-editor/plate-ui/media-upload-toast.tsx +73 -0
  228. package/src/internal/plate-editor/plate-ui/media-video-node-static.tsx +35 -0
  229. package/src/internal/plate-editor/plate-ui/media-video-node.tsx +119 -0
  230. package/src/internal/plate-editor/plate-ui/mention-node-static.tsx +46 -0
  231. package/src/internal/plate-editor/plate-ui/mention-node.tsx +79 -0
  232. package/src/internal/plate-editor/plate-ui/menu.tsx +532 -0
  233. package/src/internal/plate-editor/plate-ui/mode-toolbar-button.tsx +126 -0
  234. package/src/internal/plate-editor/plate-ui/more-toolbar-button.tsx +34 -0
  235. package/src/internal/plate-editor/plate-ui/paragraph-node-static.tsx +15 -0
  236. package/src/internal/plate-editor/plate-ui/paragraph-node.tsx +16 -0
  237. package/src/internal/plate-editor/plate-ui/popover.tsx +77 -0
  238. package/src/internal/plate-editor/plate-ui/progress.tsx +1 -0
  239. package/src/internal/plate-editor/plate-ui/remote-cursor-overlay.tsx +81 -0
  240. package/src/internal/plate-editor/plate-ui/resize-handle.tsx +88 -0
  241. package/src/internal/plate-editor/plate-ui/separator.tsx +43 -0
  242. package/src/internal/plate-editor/plate-ui/slash-node.tsx +435 -0
  243. package/src/internal/plate-editor/plate-ui/spinner.tsx +1 -0
  244. package/src/internal/plate-editor/plate-ui/suggestion-node-static.tsx +35 -0
  245. package/src/internal/plate-editor/plate-ui/suggestion-node.tsx +168 -0
  246. package/src/internal/plate-editor/plate-ui/suggestion-toolbar-button.tsx +24 -0
  247. package/src/internal/plate-editor/plate-ui/table-node-static.tsx +85 -0
  248. package/src/internal/plate-editor/plate-ui/table-node.tsx +285 -0
  249. package/src/internal/plate-editor/plate-ui/table-toolbar-button.tsx +254 -0
  250. package/src/internal/plate-editor/plate-ui/tabs.tsx +3 -0
  251. package/src/internal/plate-editor/plate-ui/textarea.tsx +58 -0
  252. package/src/internal/plate-editor/plate-ui/toc-node-static.tsx +142 -0
  253. package/src/internal/plate-editor/plate-ui/toc-node.tsx +57 -0
  254. package/src/internal/plate-editor/plate-ui/toc-sidebar.tsx +50 -0
  255. package/src/internal/plate-editor/plate-ui/toggle-node-static.tsx +18 -0
  256. package/src/internal/plate-editor/plate-ui/toggle-node.tsx +33 -0
  257. package/src/internal/plate-editor/plate-ui/toggle-toolbar-button.tsx +26 -0
  258. package/src/internal/plate-editor/plate-ui/toggle.tsx +3 -0
  259. package/src/internal/plate-editor/plate-ui/toolbar.tsx +380 -0
  260. package/src/internal/plate-editor/plate-ui/tooltip.tsx +149 -0
  261. package/src/internal/plate-editor/plate-ui/turn-into-toolbar-button.tsx +177 -0
  262. package/src/internal/plate-editor/types/index.ts +22 -0
  263. package/src/internal/plate-editor/vite.ts +284 -0
  264. package/src/internal/sheets/components/univer-sheets.tsx +1104 -0
  265. package/src/internal/sheets/i18n/context.tsx +183 -0
  266. package/src/internal/sheets/i18n/index.ts +19 -0
  267. package/src/internal/sheets/i18n/locales/de.json +21 -0
  268. package/src/internal/sheets/i18n/locales/el.json +21 -0
  269. package/src/internal/sheets/i18n/locales/en.json +21 -0
  270. package/src/internal/sheets/i18n/locales/es.json +21 -0
  271. package/src/internal/sheets/i18n/locales/fr.json +21 -0
  272. package/src/internal/sheets/i18n/locales/it.json +21 -0
  273. package/src/internal/sheets/i18n/locales/pt.json +21 -0
  274. package/src/internal/sheets/i18n/locales/sl.json +21 -0
  275. package/src/internal/sheets/i18n/locales/tr.json +21 -0
  276. package/src/internal/sheets/i18n/types.ts +23 -0
  277. package/src/internal/sheets/i18n/use-translation.ts +17 -0
  278. package/src/internal/sheets/index.ts +14 -0
  279. package/src/internal/sheets/types/css.d.ts +11 -0
  280. package/src/internal/sheets/types/index.ts +260 -0
  281. package/src/internal/sheets/xlsx.ts +1169 -0
  282. package/src/lib/api-client.ts +77 -0
  283. package/src/lib/assistant-api-actions.ts +549 -0
  284. package/src/lib/assistant-config.tsx +71 -0
  285. package/src/lib/class-utils.ts +40 -0
  286. package/src/lib/index.ts +7 -0
  287. package/src/lib/message-utils.ts +131 -0
  288. package/src/tools/tools-schema.json +512 -0
  289. package/src/types/index.ts +235 -0
  290. package/src/views/assistant-view.tsx +1137 -0
  291. package/src/views/canvas-app.tsx +839 -0
  292. package/src/views/canvas-code.tsx +93 -0
  293. package/src/views/canvas-deep-research.tsx +44 -0
  294. package/src/views/canvas-image.tsx +25 -0
  295. package/src/views/canvas-record-view.tsx +285 -0
  296. package/src/views/canvas-spreadsheet.tsx +125 -0
  297. package/src/views/canvas-text.tsx +52 -0
  298. package/src/views/canvas.tsx +274 -0
  299. package/src/views/chat-panel.tsx +149 -0
  300. package/src/views/index.ts +20 -0
  301. package/src/views/memories-panel.tsx +365 -0
  302. package/src/views/message-list.tsx +370 -0
  303. package/src/views/project-detail.tsx +257 -0
  304. package/src/views/projects-panel.tsx +131 -0
  305. package/src/views/sessions-list.tsx +98 -0
  306. package/src/views/sidebar-content.tsx +256 -0
  307. package/src/views/work-detail.tsx +98 -0
  308. package/src/vite.ts +284 -0
@@ -0,0 +1,326 @@
1
+ 'use client';
2
+
3
+ import { useMemo } from 'react';
4
+
5
+ function getFieldLabel(key: string | number, property: any): string {
6
+ if (property?.title) return property.title;
7
+
8
+ return key
9
+ .toString()
10
+ .replace(/_/g, ' ')
11
+ .replace(/([A-Z])/g, ' $1')
12
+ .split(' ')
13
+ .map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
14
+ .join(' ')
15
+ .trim();
16
+ }
17
+
18
+ function formatLabel(key: string): string {
19
+ return key.replace(/([A-Z])/g, ' $1').replace(/^./, s => s.toUpperCase());
20
+ }
21
+
22
+ function inferType(value: any): string {
23
+ if (value === null || value === undefined) return 'string';
24
+ if (Array.isArray(value)) return 'array';
25
+ if (typeof value === 'object') return 'object';
26
+
27
+ return typeof value;
28
+ }
29
+
30
+ function formatValue(value: any, property: any): string {
31
+ if (value === null || value === undefined) return '—';
32
+
33
+ const type = property?.type;
34
+
35
+ switch (type) {
36
+ case 'boolean':
37
+ return value ? 'Yes' : 'No';
38
+
39
+ case 'number':
40
+
41
+ case 'integer':
42
+ return String(value);
43
+
44
+ case 'string':
45
+ if (property?.format === 'date') return new Date(value).toLocaleDateString();
46
+ if (property?.format === 'date-time') return new Date(value).toLocaleString();
47
+ if (typeof value === 'object') return JSON.stringify(value, null, 2);
48
+
49
+ return String(value);
50
+
51
+ case 'array':
52
+ return Array.isArray(value) ? `${value.length} items` : '—';
53
+
54
+ case 'object':
55
+ return typeof value === 'object' ? JSON.stringify(value, null, 2) : '—';
56
+
57
+ default:
58
+ return String(value);
59
+ }
60
+ }
61
+
62
+ function formatNestedObject(value: any): string {
63
+ if (value === null || value === undefined) return '—';
64
+ if (typeof value !== 'object') return String(value);
65
+
66
+ return Object.entries(value)
67
+ .map(([k, v]) => (typeof v === 'object' && v !== null ? `${k}: ${JSON.stringify(v)}` : `${k}: ${v}`))
68
+ .join('\n');
69
+ }
70
+
71
+ function formatNestedArray(value: any): string {
72
+ if (!Array.isArray(value)) return '—';
73
+ if (value.length === 0) return '(empty)';
74
+ if (value.every((item: any) => typeof item !== 'object' || item === null)) return value.join(', ');
75
+
76
+ return `${value.length} items:\n${JSON.stringify(value[0], null, 2)}${value.length > 1 ? '\n...' : ''}`;
77
+ }
78
+
79
+ function formatPrimitive(value: any): string {
80
+ if (value === null || value === undefined) return '—';
81
+ if (typeof value === 'boolean') return value ? 'Yes' : 'No';
82
+
83
+ return String(value);
84
+ }
85
+
86
+ function getCitationsForField(basis: any[], fieldKey: string | number): any[] {
87
+ if (!Array.isArray(basis) || basis.length === 0) return [];
88
+ const entry = basis.find((item: any) => item.field === fieldKey);
89
+
90
+ return entry?.citations || [];
91
+ }
92
+
93
+ interface JsonSchemaArrayProps {
94
+ schema: any;
95
+ data: any[];
96
+ showHeader?: boolean;
97
+ }
98
+
99
+ function JsonSchemaArray({ schema, data, showHeader = true }: JsonSchemaArrayProps) {
100
+ const isEmpty = !data || data.length === 0;
101
+
102
+ const isArrayOfObjects = !isEmpty
103
+ && (schema?.items?.type === 'object'
104
+ || data.some((item: any) => typeof item === 'object' && item !== null && !Array.isArray(item)));
105
+
106
+ const columns: Record<string, { label: string; property: any }> = useMemo(() => {
107
+ const itemSchema = schema?.items;
108
+
109
+ if (itemSchema?.properties) {
110
+ const cols: Record<string, { label: string; property: any }> = {};
111
+
112
+ Object.keys(itemSchema.properties).forEach((key) => {
113
+ cols[key] = {
114
+ label: itemSchema.properties[key]?.title || formatLabel(key),
115
+ property: itemSchema.properties[key]
116
+ };
117
+ });
118
+
119
+ return cols;
120
+ }
121
+
122
+ if (isArrayOfObjects && data.length > 0) {
123
+ const allKeys = new Set<string>();
124
+
125
+ data.forEach((item: any) => {
126
+ if (typeof item === 'object' && item !== null) Object.keys(item).forEach(k => allKeys.add(k));
127
+ });
128
+
129
+ const cols: Record<string, { label: string; property: any }> = {};
130
+
131
+ allKeys.forEach((key) => {
132
+ cols[key] = {
133
+ label: formatLabel(key),
134
+ property: { type: inferType(data[0]?.[key]) }
135
+ };
136
+ });
137
+
138
+ return cols;
139
+ }
140
+
141
+ return {};
142
+ }, [schema, data, isArrayOfObjects]);
143
+
144
+ return (
145
+ <div className="w-full not-prose">
146
+ {showHeader && schema?.title && (
147
+ <div className="text-lg font-semibold text-slate-700 mb-3">{schema.title}</div>
148
+ )}
149
+ {showHeader && schema?.description && (
150
+ <div className="text-sm text-slate-600 mb-3">{schema.description}</div>
151
+ )}
152
+
153
+ {isEmpty ? (
154
+ <div className="text-sm text-slate-500 italic py-4">No items</div>
155
+ ) : isArrayOfObjects ? (
156
+ <div className="overflow-x-auto overflow-hidden shadow-sm rounded-lg border border-slate-200">
157
+ <table className="min-w-full divide-y divide-slate-200">
158
+ <thead className="bg-slate-50">
159
+ <tr>
160
+ {
161
+ Object.entries(columns).map(([key, col]) => (
162
+ <th
163
+ key={key}
164
+ className="px-4 py-3 text-left text-xs font-medium text-slate-700 uppercase tracking-wider">
165
+ {col.label}
166
+ </th>
167
+ ))
168
+ }
169
+ </tr>
170
+ </thead>
171
+ <tbody className="bg-white divide-y divide-slate-200">
172
+ {data.map((item, index) => (
173
+ <tr key={index} className="hover:bg-slate-50">
174
+ {Object.entries(columns).map(([key, col]) => (
175
+ <td key={key} className="px-4 py-3 text-sm text-slate-700">
176
+ {col.property?.type === 'object' ? (
177
+ <div className="text-xs font-mono bg-slate-100 rounded px-2 py-1 whitespace-pre-wrap break-all max-w-xs">
178
+ {formatNestedObject(item[key])}
179
+ </div>
180
+ ) : col.property?.type === 'array' ? (
181
+ <div className="text-xs font-mono bg-slate-100 rounded px-2 py-1 whitespace-pre-wrap break-all max-w-xs">
182
+ {formatNestedArray(item[key])}
183
+ </div>
184
+ ) : (
185
+ <span className={col.property?.type === 'number' || col.property?.type === 'integer' ? 'font-mono' : ''}>
186
+ {formatValue(item[key], col.property)}
187
+ </span>
188
+ )}
189
+ </td>
190
+ ))}
191
+ </tr>
192
+ ))}
193
+ </tbody>
194
+ </table>
195
+ </div>
196
+ ) : (
197
+ <div className="space-y-2">
198
+ {data.map((item, index) => (
199
+ <div
200
+ key={index}
201
+ className="px-3 py-2 bg-white border border-slate-200 rounded-md text-sm text-slate-700">
202
+ {formatPrimitive(item)}
203
+ </div>
204
+ ))}
205
+ </div>
206
+ )}
207
+ </div>
208
+ );
209
+ }
210
+
211
+ interface JsonSchemaObjectProps {
212
+ schema: any;
213
+ data: any;
214
+ basis?: any[];
215
+ }
216
+
217
+ function JsonSchemaObject({ schema, data, basis = [] }: JsonSchemaObjectProps) {
218
+ const properties: Record<string, any> = schema?.properties || {};
219
+ const required: string[] = schema?.required || [];
220
+
221
+ return (
222
+ <div className="w-full">
223
+ {schema?.title && (
224
+ <div className="text-lg font-semibold text-slate-700 mb-4">{schema.title}</div>
225
+ )}
226
+ {schema?.description && (
227
+ <div className="text-sm text-slate-600 mb-4">{schema.description}</div>
228
+ )}
229
+
230
+ <div className="space-y-4">
231
+ {Object.entries(properties).map(([key, property]: [string, any]) => {
232
+ const isNestedObject = property?.type === 'object' && property?.properties;
233
+ const isArr = property?.type === 'array';
234
+ const citations = getCitationsForField(basis, key);
235
+ const isReq = required.includes(key);
236
+
237
+ if (isNestedObject) {
238
+ return (
239
+ <div key={key} className="border border-slate-200 rounded-lg p-4 bg-slate-50">
240
+ <JsonSchemaObject schema={property} data={data?.[key] || {}} basis={basis} />
241
+ </div>
242
+ );
243
+ }
244
+
245
+ if (isArr) {
246
+ return (
247
+ <div key={key} className="border border-slate-200 rounded-lg p-4 bg-slate-50">
248
+ {property?.title && (
249
+ <div className="text-sm font-medium text-slate-700 mb-2">{property.title}</div>
250
+ )}
251
+ <JsonSchemaArray schema={property} data={data?.[key] || []} showHeader={false} />
252
+ </div>
253
+ );
254
+ }
255
+
256
+ return (
257
+ <div key={key} className="flex flex-col">
258
+ <label className={`text-sm font-medium text-slate-700 mb-1${isReq ? " after:content-['*'] after:ml-0.5 after:text-red-500" : ''}`}>
259
+ {getFieldLabel(key, property)}
260
+ </label>
261
+
262
+ {property?.description && (
263
+ <div className="text-xs text-slate-500 mb-1">{property.description}</div>
264
+ )}
265
+
266
+ <div className={`px-3 py-2 bg-white border border-slate-300 rounded-md text-sm text-slate-700${property?.type === 'number' || property?.type === 'integer' ? ' font-mono' : ''}`}>
267
+ {formatValue(data?.[key], property)}
268
+ </div>
269
+
270
+ {citations.length > 0 && (
271
+ <div className="mt-2 text-xs text-slate-600 bg-slate-50 border border-slate-200 rounded-md p-3">
272
+ <div className="font-medium text-slate-700 mb-2 flex items-center gap-1">
273
+ <svg className="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
274
+ <path
275
+ fillRule="evenodd"
276
+ d="M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z"
277
+ clipRule="evenodd" />
278
+ </svg>
279
+ Sources ({citations.length})
280
+ </div>
281
+ <div className="space-y-2">
282
+ {citations.map((citation: any, idx: number) => (
283
+ <div key={idx} className="flex gap-2 scroll-mt-4">
284
+ <span className="font-mono text-slate-500">[{idx + 1}]</span>
285
+ <div className="flex-1 min-w-0">
286
+ <a
287
+ href={citation.url}
288
+ target="_blank"
289
+ rel="noopener noreferrer"
290
+ className="text-blue-600 hover:text-blue-800 hover:underline break-all truncate block">
291
+ {citation.url}
292
+ </a>
293
+ {citation.excerpts && citation.excerpts.length > 0 && (
294
+ <div className="mt-1 text-slate-600 italic truncate">
295
+ &quot;{citation.excerpts[0]}&quot;
296
+ </div>
297
+ )}
298
+ </div>
299
+ </div>
300
+ ))}
301
+ </div>
302
+ </div>
303
+ )}
304
+ </div>
305
+ );
306
+ })}
307
+ </div>
308
+ </div>
309
+ );
310
+ }
311
+
312
+ export interface JsonSchemaLayoutProps {
313
+ schema: any;
314
+ data: any;
315
+ basis?: any[];
316
+ }
317
+
318
+ export function JsonSchemaLayout({ schema, data, basis = [] }: JsonSchemaLayoutProps) {
319
+ const schemaType = schema?.type || (Array.isArray(data) ? 'array' : 'object');
320
+
321
+ if (schemaType === 'array') {
322
+ return <JsonSchemaArray schema={schema} data={data} />;
323
+ }
324
+
325
+ return <JsonSchemaObject schema={schema} data={data} basis={basis} />;
326
+ }
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+
3
+ import { type ElementType, type FC, type ReactNode } from 'react';
4
+
5
+ import { Button } from '@docyrus/ui-pro-shared/components/button';
6
+ import {
7
+ DropdownMenu,
8
+ DropdownMenuContent,
9
+ DropdownMenuItem,
10
+ DropdownMenuTrigger
11
+ } from '@docyrus/ui-pro-shared/components/dropdown-menu';
12
+ import { cn } from '@docyrus/ui-pro-shared/lib/utils';
13
+ import { Edit, MoreHorizontal, Trash } from 'lucide-react';
14
+
15
+ interface ListItemCardAction {
16
+ label: string;
17
+ icon?: ElementType;
18
+ onClick: () => void;
19
+ variant?: 'default' | 'destructive';
20
+ }
21
+
22
+ interface ListItemCardProps {
23
+ title: string;
24
+ subtitle?: string;
25
+ onClick?: () => void;
26
+ actions?: ListItemCardAction[];
27
+ className?: string;
28
+ children?: ReactNode;
29
+ }
30
+
31
+ export const ListItemCard: FC<ListItemCardProps> = ({
32
+ title,
33
+ subtitle,
34
+ onClick,
35
+ actions,
36
+ className,
37
+ children
38
+ }) => {
39
+ return (
40
+ <div
41
+ onClick={onClick}
42
+ className={cn(
43
+ 'bg-card border border-border rounded-lg p-4 hover:shadow-md transition-shadow',
44
+ onClick && 'cursor-pointer',
45
+ className
46
+ )}>
47
+ <div className="flex items-start justify-between mb-3">
48
+ <h3 className="font-medium text-card-foreground line-clamp-2">{title}</h3>
49
+ {actions && actions.length > 0 && (
50
+ <DropdownMenu>
51
+ <DropdownMenuTrigger asChild>
52
+ <Button
53
+ variant="ghost"
54
+ size="icon"
55
+ className="h-6 w-6 text-muted-foreground hover:text-foreground shrink-0"
56
+ onClick={e => e.stopPropagation()}>
57
+ <MoreHorizontal className="w-4 h-4" />
58
+ </Button>
59
+ </DropdownMenuTrigger>
60
+ <DropdownMenuContent align="end">
61
+ {actions.map((action, index) => {
62
+ const Icon = action.icon || (action.variant === 'destructive' ? Trash : Edit);
63
+
64
+ return (
65
+ <DropdownMenuItem
66
+ key={index}
67
+ onClick={(e) => {
68
+ e.stopPropagation();
69
+ action.onClick();
70
+ }}
71
+ className={cn(
72
+ 'cursor-pointer',
73
+ action.variant === 'destructive' && 'text-destructive focus:text-destructive'
74
+ )}>
75
+ <Icon className="w-4 h-4 mr-2" />
76
+ {action.label}
77
+ </DropdownMenuItem>
78
+ );
79
+ })}
80
+ </DropdownMenuContent>
81
+ </DropdownMenu>
82
+ )}
83
+ </div>
84
+ {subtitle && (
85
+ <p className="text-sm text-muted-foreground line-clamp-2">{subtitle}</p>
86
+ )}
87
+ {children}
88
+ </div>
89
+ );
90
+ };
91
+
92
+ ListItemCard.displayName = 'ListItemCard';
@@ -0,0 +1,192 @@
1
+ 'use client';
2
+
3
+ import {
4
+ useCallback, useEffect, useRef, useState, type MouseEvent, type WheelEvent
5
+ } from 'react';
6
+
7
+ import {
8
+ Maximize2, Minus, Plus, RotateCcw, X
9
+ } from 'lucide-react';
10
+
11
+ import { Button } from '@docyrus/ui-pro-shared/components/button';
12
+ import {
13
+ Dialog, DialogContent, DialogTitle
14
+ } from '@docyrus/ui-pro-shared/components/dialog';
15
+ import { cn } from '@docyrus/ui-pro-shared/lib/utils';
16
+
17
+ interface MermaidRenderProps {
18
+ content: string;
19
+ className?: string;
20
+ }
21
+
22
+ function MermaidRender({ content, className }: MermaidRenderProps) {
23
+ const containerRef = useRef<HTMLDivElement>(null);
24
+ const svgRef = useRef<HTMLDivElement>(null);
25
+ const [svg, setSvg] = useState('');
26
+ const [zoom, setZoom] = useState(1);
27
+ const [pan, setPan] = useState({ x: 0, y: 0 });
28
+ const isDragging = useRef(false);
29
+ const lastPos = useRef({ x: 0, y: 0 });
30
+
31
+ useEffect(() => {
32
+ if (!content) return;
33
+
34
+ let cancelled = false;
35
+
36
+ const render = async () => {
37
+ try {
38
+ const { default: mermaid } = await import('mermaid');
39
+
40
+ mermaid.initialize({ startOnLoad: false, securityLevel: 'loose' });
41
+ const id = `mermaid-${Math.random().toString(36).slice(2)}`;
42
+ const { svg: rendered } = await mermaid.render(id, content);
43
+
44
+ if (!cancelled) setSvg(rendered);
45
+ } catch (err) {
46
+ console.error('Mermaid render error:', err);
47
+ }
48
+ };
49
+
50
+ render();
51
+
52
+ return () => {
53
+ cancelled = true;
54
+ };
55
+ }, [content]);
56
+
57
+ const zoomIn = () => setZoom(z => Math.min(z + 0.15, 4));
58
+ const zoomOut = () => setZoom(z => Math.max(z - 0.15, 0.2));
59
+ const resetView = () => {
60
+ setZoom(1);
61
+ setPan({ x: 0, y: 0 });
62
+ };
63
+
64
+ const onWheel = useCallback((e: WheelEvent) => {
65
+ e.preventDefault();
66
+ const delta = e.deltaY > 0 ? -0.1 : 0.1;
67
+
68
+ setZoom(z => Math.min(Math.max(z + delta, 0.2), 4));
69
+ }, []);
70
+
71
+ const onMouseDown = useCallback((e: MouseEvent) => {
72
+ isDragging.current = true;
73
+ lastPos.current = { x: e.clientX, y: e.clientY };
74
+ }, []);
75
+
76
+ const onMouseMove = useCallback((e: MouseEvent) => {
77
+ if (!isDragging.current) return;
78
+ const dx = e.clientX - lastPos.current.x;
79
+ const dy = e.clientY - lastPos.current.y;
80
+
81
+ lastPos.current = { x: e.clientX, y: e.clientY };
82
+ setPan(p => ({ x: p.x + dx, y: p.y + dy }));
83
+ }, []);
84
+
85
+ const onMouseUp = useCallback(() => {
86
+ isDragging.current = false;
87
+ }, []);
88
+
89
+ return (
90
+ <div
91
+ ref={containerRef}
92
+ className={cn(
93
+ 'relative w-full h-full overflow-hidden cursor-grab active:cursor-grabbing select-none',
94
+ 'bg-[radial-gradient(circle,_#94a3b8_1px,_transparent_1px)] bg-[size:22px_22px] bg-slate-50',
95
+ className
96
+ )}
97
+ onWheel={onWheel}
98
+ onMouseDown={onMouseDown}
99
+ onMouseMove={onMouseMove}
100
+ onMouseUp={onMouseUp}
101
+ onMouseLeave={onMouseUp}>
102
+ <div
103
+ ref={svgRef}
104
+ className="absolute inset-0 flex items-center justify-center"
105
+ style={{ transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, transformOrigin: 'center' }}
106
+ dangerouslySetInnerHTML={{ __html: svg }} />
107
+
108
+ {/* Zoom controls */}
109
+ <div className="absolute bottom-3 left-3 z-10 flex gap-1">
110
+ <Button variant="secondary" size="icon" className="h-7 w-7 bg-white shadow-sm" onClick={zoomOut}>
111
+ <Minus className="size-3" />
112
+ </Button>
113
+ <Button variant="secondary" size="icon" className="h-7 w-7 bg-white shadow-sm" onClick={zoomIn}>
114
+ <Plus className="size-3" />
115
+ </Button>
116
+ <Button variant="secondary" size="icon" className="h-7 w-7 bg-white shadow-sm" onClick={resetView}>
117
+ <RotateCcw className="size-3" />
118
+ </Button>
119
+ </div>
120
+ </div>
121
+ );
122
+ }
123
+
124
+ interface MermaidDiagramProps {
125
+ title?: string;
126
+ description?: string;
127
+ mermaidNotation: string;
128
+ state?: string;
129
+ }
130
+
131
+ export function MermaidDiagram({
132
+ title, description, mermaidNotation, state
133
+ }: MermaidDiagramProps) {
134
+ const [modalOpen, setModalOpen] = useState(false);
135
+
136
+ if (state !== 'output-available') {
137
+ return <div className="w-full h-[400px] rounded-lg border bg-muted/30 animate-pulse" />;
138
+ }
139
+
140
+ return (
141
+ <>
142
+ <div className="w-full min-w-96 max-w-2xl h-[400px] border rounded-lg flex flex-col overflow-hidden">
143
+ {/* Header */}
144
+ <div className="flex items-center justify-between bg-muted/50 px-4 py-2 shrink-0">
145
+ <div className="flex items-center gap-3 min-w-0">
146
+ <div className="min-w-0">
147
+ {title && <div className="text-sm font-medium truncate">{title}</div>}
148
+ {description && <div className="text-xs text-muted-foreground truncate">{description}</div>}
149
+ </div>
150
+ </div>
151
+ <Button
152
+ variant="ghost"
153
+ size="icon"
154
+ className="h-7 w-7 shrink-0"
155
+ onClick={() => setModalOpen(true)}>
156
+ <Maximize2 className="size-4" />
157
+ </Button>
158
+ </div>
159
+
160
+ {/* Diagram */}
161
+ <div className="flex-1 overflow-hidden">
162
+ <MermaidRender content={mermaidNotation} />
163
+ </div>
164
+ </div>
165
+
166
+ {/* Fullscreen modal */}
167
+ <Dialog open={modalOpen} onOpenChange={setModalOpen}>
168
+ <DialogContent
169
+ showCloseButton={false}
170
+ className="max-w-[90vw] sm:max-w-[90vw] w-[90vw] h-[90vh] p-0 flex flex-col gap-0 overflow-hidden">
171
+ <DialogTitle className="sr-only">{title ?? 'Diagram'}</DialogTitle>
172
+ <div className="flex items-center justify-between bg-muted/50 px-4 py-2 shrink-0">
173
+ <div className="min-w-0">
174
+ {title && <div className="text-base font-medium truncate">{title}</div>}
175
+ {description && <div className="text-xs text-muted-foreground truncate">{description}</div>}
176
+ </div>
177
+ <Button
178
+ variant="ghost"
179
+ size="icon"
180
+ className="h-7 w-7 shrink-0"
181
+ onClick={() => setModalOpen(false)}>
182
+ <X className="size-4" />
183
+ </Button>
184
+ </div>
185
+ <div className="flex-1 overflow-hidden">
186
+ <MermaidRender content={mermaidNotation} />
187
+ </div>
188
+ </DialogContent>
189
+ </Dialog>
190
+ </>
191
+ );
192
+ }
@@ -0,0 +1,47 @@
1
+ import { type FC, type HTMLAttributes } from 'react';
2
+
3
+ type ImageItem = {
4
+ url: string;
5
+ base64: string;
6
+ mimeType: string;
7
+ width: number;
8
+ height: number;
9
+ };
10
+
11
+ type Props = {
12
+ id?: string;
13
+ title?: string;
14
+ images?: string | (ImageItem | string)[];
15
+ onOpen?: () => void;
16
+ } & HTMLAttributes<HTMLDivElement>;
17
+
18
+ export const PreviewImage: FC<Props> = ({
19
+ title = '', images = '', onOpen, ...rest
20
+ }) => {
21
+ const handleClick = () => {
22
+ if (onOpen) onOpen();
23
+ };
24
+
25
+ return (
26
+ <div
27
+ className="rounded-lg shadow-sm hover:shadow-md w-fit min-w-80 max-w-96 border bg-card p-4 flex flex-col items-start justify-stretch space-y-2 cursor-pointer"
28
+ onClick={handleClick}
29
+ {...rest}>
30
+ <div className="truncate text-xs w-full font-medium">{title}</div>
31
+
32
+ {Array.isArray(images) ? (
33
+ images.map((image, index) => (
34
+ <img
35
+ key={index}
36
+ src={typeof image === 'string' ? image : image.url}
37
+ className="w-80"
38
+ alt={`image-${index}`} />
39
+ ))
40
+ ) : (
41
+ images && <img src={images} className="w-80" alt="image" />
42
+ )}
43
+ </div>
44
+ );
45
+ };
46
+
47
+ export default PreviewImage;