@object-ui/components 0.3.1 → 2.0.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 (326) hide show
  1. package/.turbo/turbo-build.log +34 -0
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +13 -0
  4. package/dist/index.css +1 -1
  5. package/dist/index.js +36430 -25529
  6. package/dist/index.umd.cjs +53 -32
  7. package/dist/src/SchemaRenderer.d.ts +3 -0
  8. package/dist/src/custom/action-param-dialog.d.ts +21 -0
  9. package/dist/src/{ui → custom}/button-group.d.ts +1 -1
  10. package/dist/src/custom/field.d.ts +19 -0
  11. package/dist/src/custom/index.d.ts +14 -0
  12. package/dist/src/custom/input-group.d.ts +14 -0
  13. package/dist/src/{ui → custom}/item.d.ts +1 -1
  14. package/dist/src/custom/native-select.d.ts +12 -0
  15. package/dist/src/custom/navigation-overlay.d.ts +50 -0
  16. package/dist/src/custom/sort-builder.d.ts +22 -0
  17. package/dist/src/index.d.ts +2 -0
  18. package/dist/src/renderers/action/action-button.d.ts +11 -0
  19. package/dist/src/renderers/action/action-group.d.ts +25 -0
  20. package/dist/src/renderers/action/action-icon.d.ts +10 -0
  21. package/dist/src/renderers/action/action-menu.d.ts +19 -0
  22. package/dist/src/renderers/action/index.d.ts +0 -0
  23. package/dist/src/renderers/action/resolve-icon.d.ts +6 -0
  24. package/dist/src/renderers/data-display/table.d.ts +1 -1
  25. package/dist/src/renderers/layout/page.d.ts +1 -1
  26. package/dist/src/renderers/placeholders.d.ts +1 -1
  27. package/dist/src/ui/accordion.d.ts +4 -4
  28. package/dist/src/ui/alert-dialog.d.ts +17 -11
  29. package/dist/src/ui/alert.d.ts +4 -5
  30. package/dist/src/ui/aspect-ratio.d.ts +1 -1
  31. package/dist/src/ui/avatar.d.ts +3 -3
  32. package/dist/src/ui/badge.d.ts +3 -3
  33. package/dist/src/ui/breadcrumb.d.ts +16 -8
  34. package/dist/src/ui/calendar.d.ts +7 -7
  35. package/dist/src/ui/card.d.ts +7 -8
  36. package/dist/src/ui/carousel.d.ts +5 -6
  37. package/dist/src/ui/chart.d.ts +62 -0
  38. package/dist/src/ui/checkbox.d.ts +1 -1
  39. package/dist/src/ui/collapsible.d.ts +3 -3
  40. package/dist/src/ui/command.d.ts +78 -16
  41. package/dist/src/ui/context-menu.d.ts +14 -12
  42. package/dist/src/ui/dialog.d.ts +17 -13
  43. package/dist/src/ui/drawer.d.ts +19 -10
  44. package/dist/src/ui/dropdown-menu.d.ts +20 -18
  45. package/dist/src/ui/form.d.ts +6 -7
  46. package/dist/src/ui/hover-card.d.ts +3 -3
  47. package/dist/src/ui/index.d.ts +2 -8
  48. package/dist/src/ui/input-otp.d.ts +30 -7
  49. package/dist/src/ui/label.d.ts +2 -1
  50. package/dist/src/ui/menubar.d.ts +19 -17
  51. package/dist/src/ui/navigation-menu.d.ts +9 -11
  52. package/dist/src/ui/pagination.d.ts +25 -10
  53. package/dist/src/ui/popover.d.ts +4 -5
  54. package/dist/src/ui/progress.d.ts +1 -1
  55. package/dist/src/ui/radio-group.d.ts +2 -2
  56. package/dist/src/ui/resizable.d.ts +5 -8
  57. package/dist/src/ui/scroll-area.d.ts +2 -2
  58. package/dist/src/ui/select.d.ts +11 -13
  59. package/dist/src/ui/sheet.d.ts +23 -11
  60. package/dist/src/ui/sidebar.d.ts +27 -29
  61. package/dist/src/ui/skeleton.d.ts +1 -1
  62. package/dist/src/ui/slider.d.ts +1 -1
  63. package/dist/src/ui/sonner.d.ts +2 -1
  64. package/dist/src/ui/switch.d.ts +2 -2
  65. package/dist/src/ui/tabs.d.ts +1 -1
  66. package/dist/src/ui/textarea.d.ts +1 -1
  67. package/dist/src/ui/toast.d.ts +22 -0
  68. package/dist/src/ui/toggle-group.d.ts +8 -3
  69. package/dist/src/ui/toggle.d.ts +4 -1
  70. package/dist/src/ui/tooltip.d.ts +4 -4
  71. package/dist/src/ui/typography.d.ts +21 -0
  72. package/package.json +20 -9
  73. package/shadcn-components.json +52 -47
  74. package/src/SchemaRenderer.tsx +28 -0
  75. package/src/__tests__/PageRendererRegions.test.tsx +668 -0
  76. package/src/__tests__/Registry.test.ts +21 -0
  77. package/src/__tests__/basic-renderers.test.tsx +1 -1
  78. package/src/__tests__/complex-disclosure-renderers.test.tsx +3 -2
  79. package/src/__tests__/compliance.test.tsx +72 -0
  80. package/src/__tests__/feedback-overlay-renderers.test.tsx +1 -1
  81. package/src/__tests__/form-renderers.test.tsx +1 -1
  82. package/src/__tests__/layout-data-renderers.test.tsx +1 -1
  83. package/src/__tests__/navigation-overlay.test.tsx +273 -0
  84. package/src/__tests__/view-compliance.test.tsx +153 -0
  85. package/src/custom/action-param-dialog.tsx +264 -0
  86. package/src/{ui → custom}/button-group.tsx +1 -1
  87. package/src/{ui → custom}/combobox.tsx +3 -3
  88. package/src/{ui → custom}/date-picker.tsx +3 -3
  89. package/src/custom/field.tsx +81 -0
  90. package/src/{ui → custom}/filter-builder.tsx +3 -3
  91. package/src/custom/index.ts +14 -0
  92. package/src/custom/input-group.tsx +53 -0
  93. package/src/{ui → custom}/item.tsx +1 -1
  94. package/src/custom/native-select.tsx +33 -0
  95. package/src/custom/navigation-overlay.tsx +296 -0
  96. package/src/custom/sort-builder.tsx +129 -0
  97. package/src/index.css +20 -1
  98. package/src/index.ts +2 -0
  99. package/src/renderers/action/action-button.tsx +147 -0
  100. package/src/renderers/action/action-group.tsx +270 -0
  101. package/src/renderers/action/action-icon.tsx +150 -0
  102. package/src/renderers/action/action-menu.tsx +203 -0
  103. package/src/renderers/action/index.ts +18 -0
  104. package/src/renderers/action/resolve-icon.ts +35 -0
  105. package/src/renderers/basic/button-group.tsx +1 -0
  106. package/src/renderers/basic/div.tsx +12 -1
  107. package/src/renderers/basic/html.tsx +1 -0
  108. package/src/renderers/basic/icon.tsx +1 -0
  109. package/src/renderers/basic/image.tsx +1 -0
  110. package/src/renderers/basic/navigation-menu.tsx +1 -0
  111. package/src/renderers/basic/pagination.tsx +31 -4
  112. package/src/renderers/basic/separator.tsx +1 -0
  113. package/src/renderers/basic/span.tsx +12 -1
  114. package/src/renderers/basic/text.tsx +4 -2
  115. package/src/renderers/complex/__tests__/data-table-batch-editing.test.tsx +275 -0
  116. package/src/renderers/complex/__tests__/data-table-cell-renderer.test.tsx +120 -0
  117. package/src/renderers/complex/__tests__/data-table-editing.test.tsx +221 -0
  118. package/src/renderers/complex/carousel.tsx +1 -0
  119. package/src/renderers/complex/data-table.tsx +355 -95
  120. package/src/renderers/complex/filter-builder.tsx +2 -1
  121. package/src/renderers/complex/resizable.tsx +2 -1
  122. package/src/renderers/complex/scroll-area.tsx +25 -7
  123. package/src/renderers/complex/table.tsx +1 -0
  124. package/src/renderers/data-display/alert.tsx +1 -0
  125. package/src/renderers/data-display/avatar.tsx +1 -0
  126. package/src/renderers/data-display/badge.tsx +1 -0
  127. package/src/renderers/data-display/breadcrumb.tsx +1 -0
  128. package/src/renderers/data-display/kbd.tsx +1 -0
  129. package/src/renderers/data-display/list.tsx +21 -49
  130. package/src/renderers/data-display/statistic.tsx +21 -5
  131. package/src/renderers/data-display/table.tsx +21 -11
  132. package/src/renderers/data-display/tree-view.tsx +7 -1
  133. package/src/renderers/disclosure/accordion.tsx +1 -0
  134. package/src/renderers/disclosure/collapsible.tsx +1 -0
  135. package/src/renderers/disclosure/toggle-group.tsx +2 -0
  136. package/src/renderers/feedback/empty.tsx +1 -0
  137. package/src/renderers/feedback/loading.tsx +2 -1
  138. package/src/renderers/feedback/progress.tsx +1 -0
  139. package/src/renderers/feedback/skeleton.tsx +1 -0
  140. package/src/renderers/feedback/sonner.tsx +1 -0
  141. package/src/renderers/feedback/spinner.tsx +1 -0
  142. package/src/renderers/feedback/toast.tsx +1 -0
  143. package/src/renderers/feedback/toaster.tsx +1 -0
  144. package/src/renderers/form/button.tsx +35 -1
  145. package/src/renderers/form/calendar.tsx +1 -0
  146. package/src/renderers/form/checkbox.tsx +38 -16
  147. package/src/renderers/form/combobox.tsx +2 -1
  148. package/src/renderers/form/command.tsx +1 -0
  149. package/src/renderers/form/date-picker.tsx +1 -0
  150. package/src/renderers/form/file-upload.tsx +1 -0
  151. package/src/renderers/form/form.tsx +115 -19
  152. package/src/renderers/form/input-otp.tsx +1 -0
  153. package/src/renderers/form/input.tsx +3 -0
  154. package/src/renderers/form/label.tsx +1 -0
  155. package/src/renderers/form/radio-group.tsx +1 -0
  156. package/src/renderers/form/select.tsx +35 -15
  157. package/src/renderers/form/slider.tsx +1 -0
  158. package/src/renderers/form/switch.tsx +1 -0
  159. package/src/renderers/form/textarea.tsx +50 -27
  160. package/src/renderers/form/toggle.tsx +3 -45
  161. package/src/renderers/index.ts +1 -0
  162. package/src/renderers/layout/aspect-ratio.tsx +2 -1
  163. package/src/renderers/layout/card.tsx +10 -2
  164. package/src/renderers/layout/container.tsx +1 -0
  165. package/src/renderers/layout/flex.tsx +1 -0
  166. package/src/renderers/layout/grid.tsx +23 -8
  167. package/src/renderers/layout/page.tsx +433 -57
  168. package/src/renderers/layout/semantic.tsx +1 -0
  169. package/src/renderers/layout/stack.tsx +2 -1
  170. package/src/renderers/layout/tabs.tsx +43 -17
  171. package/src/renderers/navigation/header-bar.tsx +1 -0
  172. package/src/renderers/navigation/sidebar.tsx +11 -0
  173. package/src/renderers/overlay/alert-dialog.tsx +1 -0
  174. package/src/renderers/overlay/context-menu.tsx +1 -0
  175. package/src/renderers/overlay/dialog.tsx +1 -0
  176. package/src/renderers/overlay/drawer.tsx +1 -0
  177. package/src/renderers/overlay/dropdown-menu.tsx +1 -0
  178. package/src/renderers/overlay/hover-card.tsx +1 -0
  179. package/src/renderers/overlay/menubar.tsx +1 -0
  180. package/src/renderers/overlay/popover.tsx +1 -0
  181. package/src/renderers/overlay/sheet.tsx +1 -0
  182. package/src/renderers/overlay/tooltip.tsx +1 -0
  183. package/src/renderers/placeholders.tsx +4 -4
  184. package/src/stories/CRMApp.stories.tsx +706 -0
  185. package/src/stories/Guide.mdx +55 -0
  186. package/src/stories/Introduction.mdx +61 -0
  187. package/src/stories/MockedData.stories.tsx +121 -0
  188. package/src/stories/assets/accessibility.png +0 -0
  189. package/src/stories/assets/accessibility.svg +1 -0
  190. package/src/stories/assets/addon-library.png +0 -0
  191. package/src/stories/assets/assets.png +0 -0
  192. package/src/stories/assets/avif-test-image.avif +0 -0
  193. package/src/stories/assets/context.png +0 -0
  194. package/src/stories/assets/discord.svg +1 -0
  195. package/src/stories/assets/docs.png +0 -0
  196. package/src/stories/assets/figma-plugin.png +0 -0
  197. package/src/stories/assets/github.svg +1 -0
  198. package/src/stories/assets/share.png +0 -0
  199. package/src/stories/assets/styling.png +0 -0
  200. package/src/stories/assets/testing.png +0 -0
  201. package/src/stories/assets/theming.png +0 -0
  202. package/src/stories/assets/tutorials.svg +1 -0
  203. package/src/stories/assets/youtube.svg +1 -0
  204. package/src/stories/button.css +30 -0
  205. package/src/stories/header.css +32 -0
  206. package/src/stories/page.css +68 -0
  207. package/src/stories-json/accordion.stories.tsx +43 -0
  208. package/src/stories-json/aggrid.stories.tsx +103 -0
  209. package/src/stories-json/alert.stories.tsx +39 -0
  210. package/src/stories-json/aspect-ratio.stories.tsx +34 -0
  211. package/src/stories-json/avatar.stories.tsx +38 -0
  212. package/src/stories-json/badge.stories.tsx +53 -0
  213. package/src/stories-json/breadcrumb.stories.tsx +30 -0
  214. package/src/stories-json/button-group.stories.tsx +43 -0
  215. package/src/stories-json/button.stories.tsx +73 -0
  216. package/src/stories-json/calendar.stories.tsx +85 -0
  217. package/src/stories-json/card.stories.tsx +48 -0
  218. package/src/stories-json/carousel.stories.tsx +33 -0
  219. package/src/stories-json/charts.stories.tsx +195 -0
  220. package/src/stories-json/chatbot.stories.tsx +248 -0
  221. package/src/stories-json/code-editor.stories.tsx +92 -0
  222. package/src/stories-json/collapsible.stories.tsx +40 -0
  223. package/src/stories-json/controls.stories.tsx +36 -0
  224. package/src/stories-json/crm-live-data.stories.tsx +154 -0
  225. package/src/stories-json/dashboard.stories.tsx +318 -0
  226. package/src/stories-json/data-table.stories.tsx +136 -0
  227. package/src/stories-json/data_display_extras.stories.tsx +102 -0
  228. package/src/stories-json/date-picker.stories.tsx +28 -0
  229. package/src/stories-json/detail-view.stories.tsx +258 -0
  230. package/src/stories-json/dialog.stories.tsx +43 -0
  231. package/src/stories-json/feedback_extras.stories.tsx +40 -0
  232. package/src/stories-json/feedback_others.stories.tsx +46 -0
  233. package/src/stories-json/form-variants.stories.tsx +210 -0
  234. package/src/stories-json/form_advanced.stories.tsx +117 -0
  235. package/src/stories-json/form_extras.stories.tsx +123 -0
  236. package/src/stories-json/grid.stories.tsx +56 -0
  237. package/src/stories-json/icon.stories.tsx +36 -0
  238. package/src/stories-json/input.stories.tsx +52 -0
  239. package/src/stories-json/kanban.stories.tsx +295 -0
  240. package/src/stories-json/layout_extended.stories.tsx +76 -0
  241. package/src/stories-json/layout_flex.stories.tsx +107 -0
  242. package/src/stories-json/list-view.stories.tsx +97 -0
  243. package/src/stories-json/markdown.stories.tsx +129 -0
  244. package/src/stories-json/menus.stories.tsx +63 -0
  245. package/src/stories-json/metric-card.stories.tsx +143 -0
  246. package/src/stories-json/navigation-menu.stories.tsx +37 -0
  247. package/src/stories-json/object-aggrid-advanced.stories.tsx +389 -0
  248. package/src/stories-json/object-aggrid.stories.tsx +252 -0
  249. package/src/stories-json/object-form.stories.tsx +130 -0
  250. package/src/stories-json/object-gantt.stories.tsx +114 -0
  251. package/src/stories-json/object-grid.stories.tsx +315 -0
  252. package/src/stories-json/object-map.stories.tsx +116 -0
  253. package/src/stories-json/object-view.stories.tsx +118 -0
  254. package/src/stories-json/overlay_extras.stories.tsx +113 -0
  255. package/src/stories-json/overlay_others.stories.tsx +76 -0
  256. package/src/stories-json/page.stories.tsx +55 -0
  257. package/src/stories-json/reports.stories.tsx +163 -0
  258. package/src/stories-json/resizable.stories.tsx +44 -0
  259. package/src/stories-json/select.stories.tsx +34 -0
  260. package/src/stories-json/separator.stories.tsx +41 -0
  261. package/src/stories-json/sidebar.stories.tsx +147 -0
  262. package/src/stories-json/statistic.stories.tsx +44 -0
  263. package/src/stories-json/tabs.stories.tsx +51 -0
  264. package/src/stories-json/timeline.stories.tsx +188 -0
  265. package/src/stories-json/typography.stories.tsx +45 -0
  266. package/src/ui/accordion.tsx +47 -53
  267. package/src/ui/alert-dialog.tsx +103 -117
  268. package/src/ui/alert.tsx +35 -36
  269. package/src/ui/aspect-ratio.tsx +1 -5
  270. package/src/ui/avatar.tsx +41 -42
  271. package/src/ui/badge.tsx +6 -15
  272. package/src/ui/breadcrumb.tsx +81 -75
  273. package/src/ui/button.tsx +10 -11
  274. package/src/ui/calendar.tsx +178 -51
  275. package/src/ui/card.tsx +51 -110
  276. package/src/ui/carousel.tsx +136 -113
  277. package/src/ui/chart.tsx +367 -0
  278. package/src/ui/checkbox.tsx +20 -22
  279. package/src/ui/collapsible.tsx +5 -25
  280. package/src/ui/command.tsx +106 -135
  281. package/src/ui/context-menu.tsx +69 -116
  282. package/src/ui/dialog.tsx +94 -113
  283. package/src/ui/drawer.tsx +82 -99
  284. package/src/ui/dropdown-menu.tsx +134 -188
  285. package/src/ui/form.tsx +51 -40
  286. package/src/ui/hover-card.tsx +18 -33
  287. package/src/ui/index.ts +2 -8
  288. package/src/ui/input-otp.tsx +42 -52
  289. package/src/ui/input.tsx +13 -15
  290. package/src/ui/label.tsx +17 -15
  291. package/src/ui/menubar.tsx +188 -206
  292. package/src/ui/navigation-menu.tsx +96 -136
  293. package/src/ui/pagination.tsx +86 -96
  294. package/src/ui/popover.tsx +24 -41
  295. package/src/ui/progress.tsx +21 -22
  296. package/src/ui/radio-group.tsx +19 -20
  297. package/src/ui/resizable.tsx +32 -42
  298. package/src/ui/scroll-area.tsx +38 -48
  299. package/src/ui/select.tsx +129 -157
  300. package/src/ui/separator.tsx +2 -2
  301. package/src/ui/sheet.tsx +110 -107
  302. package/src/ui/sidebar.tsx +442 -408
  303. package/src/ui/skeleton.tsx +6 -11
  304. package/src/ui/slider.tsx +19 -54
  305. package/src/ui/sonner.tsx +19 -1
  306. package/src/ui/switch.tsx +19 -21
  307. package/src/ui/tabs.tsx +6 -37
  308. package/src/ui/textarea.tsx +8 -4
  309. package/src/ui/toast.tsx +137 -0
  310. package/src/ui/toggle-group.tsx +28 -37
  311. package/src/ui/toggle.tsx +19 -19
  312. package/src/ui/tooltip.tsx +21 -52
  313. package/src/ui/typography.tsx +85 -0
  314. package/tsconfig.json +1 -1
  315. package/vite.config.ts +9 -1
  316. package/vitest.config.ts +5 -0
  317. package/ISSUES_FOUND.md +0 -128
  318. /package/dist/src/{ui → custom}/combobox.d.ts +0 -0
  319. /package/dist/src/{ui → custom}/date-picker.d.ts +0 -0
  320. /package/dist/src/{ui → custom}/empty.d.ts +0 -0
  321. /package/dist/src/{ui → custom}/filter-builder.d.ts +0 -0
  322. /package/dist/src/{ui → custom}/kbd.d.ts +0 -0
  323. /package/dist/src/{ui → custom}/spinner.d.ts +0 -0
  324. /package/src/{ui → custom}/empty.tsx +0 -0
  325. /package/src/{ui → custom}/kbd.tsx +0 -0
  326. /package/src/{ui → custom}/spinner.tsx +0 -0
@@ -0,0 +1,248 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { SchemaRenderer } from '../SchemaRenderer';
3
+ import type { BaseSchema } from '@object-ui/types';
4
+
5
+ const meta = {
6
+ title: 'Plugins/Rich Content/Chatbot',
7
+ component: SchemaRenderer,
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
11
+ tags: ['autodocs'],
12
+ argTypes: {
13
+ schema: { table: { disable: true } },
14
+ },
15
+ } satisfies Meta<any>;
16
+
17
+ export default meta;
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
21
+
22
+ export const Default: Story = {
23
+ render: renderStory,
24
+ args: {
25
+ type: 'chatbot',
26
+ messages: [
27
+ {
28
+ id: 'welcome',
29
+ role: 'assistant',
30
+ content: 'Hello! How can I help you today?',
31
+ }
32
+ ],
33
+ placeholder: 'Type your message...',
34
+ showTimestamp: false,
35
+ disabled: false,
36
+ userAvatarFallback: 'You',
37
+ assistantAvatarFallback: 'AI',
38
+ maxHeight: '500px',
39
+ autoResponse: true,
40
+ autoResponseText: 'Thank you for your message! This is an automated response.',
41
+ autoResponseDelay: 1000,
42
+ className: 'w-full max-w-2xl'
43
+ } as any,
44
+ };
45
+
46
+ export const WithTimestamps: Story = {
47
+ render: renderStory,
48
+ args: {
49
+ type: 'chatbot',
50
+ messages: [
51
+ {
52
+ id: '1',
53
+ role: 'assistant',
54
+ content: 'Hello! I\'m here to assist you.',
55
+ timestamp: '10:00 AM'
56
+ },
57
+ {
58
+ id: '2',
59
+ role: 'user',
60
+ content: 'Hi! I need help with my account.',
61
+ timestamp: '10:01 AM'
62
+ },
63
+ {
64
+ id: '3',
65
+ role: 'assistant',
66
+ content: 'I\'d be happy to help! What specific issue are you experiencing?',
67
+ timestamp: '10:01 AM'
68
+ }
69
+ ],
70
+ placeholder: 'Type your message...',
71
+ showTimestamp: true,
72
+ autoResponse: true,
73
+ autoResponseText: 'I understand your concern. Let me help you with that.',
74
+ className: 'w-full max-w-2xl'
75
+ } as any,
76
+ };
77
+
78
+ export const CustomerSupport: Story = {
79
+ render: renderStory,
80
+ args: {
81
+ type: 'chatbot',
82
+ messages: [
83
+ {
84
+ id: '1',
85
+ role: 'system',
86
+ content: 'Support session started'
87
+ },
88
+ {
89
+ id: '2',
90
+ role: 'assistant',
91
+ content: 'Welcome to customer support! How may I assist you today?',
92
+ },
93
+ {
94
+ id: '3',
95
+ role: 'user',
96
+ content: 'I\'m having trouble accessing my dashboard.',
97
+ },
98
+ {
99
+ id: '4',
100
+ role: 'assistant',
101
+ content: 'I\'m sorry to hear that. Let me help you troubleshoot. First, can you tell me what error message you\'re seeing?',
102
+ }
103
+ ],
104
+ placeholder: 'Describe your issue...',
105
+ assistantAvatarFallback: 'CS',
106
+ autoResponse: true,
107
+ autoResponseText: 'Thank you for that information. Let me check our system.',
108
+ autoResponseDelay: 1500,
109
+ className: 'w-full max-w-2xl'
110
+ } as any,
111
+ };
112
+
113
+ export const WithMarkdown: Story = {
114
+ render: renderStory,
115
+ args: {
116
+ type: 'chatbot',
117
+ messages: [
118
+ {
119
+ id: '1',
120
+ role: 'user',
121
+ content: 'Can you show me how to use markdown?',
122
+ },
123
+ {
124
+ id: '2',
125
+ role: 'assistant',
126
+ content: `Sure! Here are some markdown examples:
127
+
128
+ **Bold text** and *italic text*
129
+
130
+ # Heading 1
131
+ ## Heading 2
132
+
133
+ - List item 1
134
+ - List item 2
135
+ - List item 3
136
+
137
+ \`inline code\` and code blocks:
138
+
139
+ \`\`\`javascript
140
+ const greeting = "Hello, World!";
141
+ console.log(greeting);
142
+ \`\`\`
143
+
144
+ > This is a blockquote
145
+ `,
146
+ }
147
+ ],
148
+ placeholder: 'Type your message...',
149
+ enableMarkdown: true,
150
+ showTimestamp: false,
151
+ autoResponse: true,
152
+ autoResponseText: 'Markdown is great for formatting!',
153
+ className: 'w-full max-w-2xl'
154
+ } as any,
155
+ };
156
+
157
+ export const WithCodeHighlighting: Story = {
158
+ render: renderStory,
159
+ args: {
160
+ type: 'chatbot',
161
+ messages: [
162
+ {
163
+ id: '1',
164
+ role: 'user',
165
+ content: 'Can you help me with a React component?',
166
+ },
167
+ {
168
+ id: '2',
169
+ role: 'assistant',
170
+ content: `Of course! Here's a simple React component example:
171
+
172
+ \`\`\`tsx
173
+ import React from 'react';
174
+
175
+ interface ButtonProps {
176
+ label: string;
177
+ onClick: () => void;
178
+ }
179
+
180
+ export const Button: React.FC<ButtonProps> = ({ label, onClick }) => {
181
+ return (
182
+ <button
183
+ onClick={onClick}
184
+ className="px-4 py-2 bg-blue-500 text-white rounded"
185
+ >
186
+ {label}
187
+ </button>
188
+ );
189
+ };
190
+ \`\`\`
191
+
192
+ This component accepts a \`label\` and \`onClick\` handler as props.`,
193
+ }
194
+ ],
195
+ placeholder: 'Ask me anything...',
196
+ enableMarkdown: true,
197
+ showTimestamp: false,
198
+ autoResponse: true,
199
+ autoResponseText: 'I can help with code examples!',
200
+ className: 'w-full max-w-2xl'
201
+ } as any,
202
+ };
203
+
204
+ export const WithFileUpload: Story = {
205
+ render: renderStory,
206
+ args: {
207
+ type: 'chatbot',
208
+ messages: [
209
+ {
210
+ id: '1',
211
+ role: 'assistant',
212
+ content: 'You can upload files by clicking the attachment button below.',
213
+ }
214
+ ],
215
+ placeholder: 'Type your message or upload a file...',
216
+ enableFileUpload: true,
217
+ acceptedFileTypes: 'image/*,.pdf,.doc,.docx',
218
+ maxFileSize: 5242880, // 5MB
219
+ showTimestamp: false,
220
+ autoResponse: true,
221
+ autoResponseText: 'File received! Processing...',
222
+ className: 'w-full max-w-2xl'
223
+ } as any,
224
+ };
225
+
226
+ export const StreamingResponse: Story = {
227
+ render: renderStory,
228
+ args: {
229
+ type: 'chatbot',
230
+ messages: [
231
+ {
232
+ id: '1',
233
+ role: 'user',
234
+ content: 'Tell me a story',
235
+ },
236
+ {
237
+ id: '2',
238
+ role: 'assistant',
239
+ content: 'Once upon a time in a digital world...',
240
+ streaming: true,
241
+ }
242
+ ],
243
+ placeholder: 'Type your message...',
244
+ enableMarkdown: true,
245
+ showTimestamp: false,
246
+ className: 'w-full max-w-2xl'
247
+ } as any,
248
+ };
@@ -0,0 +1,92 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { SchemaRenderer } from '../SchemaRenderer';
3
+ import type { BaseSchema } from '@object-ui/types';
4
+
5
+ const meta = {
6
+ title: 'Plugins/Rich Content/Code Editor',
7
+ component: SchemaRenderer,
8
+ parameters: {
9
+ layout: 'padded',
10
+ },
11
+ tags: ['autodocs'],
12
+ argTypes: {
13
+ schema: { table: { disable: true } },
14
+ },
15
+ } satisfies Meta<any>;
16
+
17
+ export default meta;
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
21
+
22
+ export const JavaScript: Story = {
23
+ render: renderStory,
24
+ args: {
25
+ type: 'code-editor',
26
+ value: '// Write your code here\nconsole.log("Hello, World!");',
27
+ language: 'javascript',
28
+ theme: 'vs-dark',
29
+ height: '400px',
30
+ readOnly: false
31
+ } as any,
32
+ };
33
+
34
+ export const TypeScript: Story = {
35
+ render: renderStory,
36
+ args: {
37
+ type: 'code-editor',
38
+ value: 'interface User {\n id: number;\n name: string;\n email: string;\n}\n\nconst user: User = {\n id: 1,\n name: "John Doe",\n email: "john@example.com"\n};',
39
+ language: 'typescript',
40
+ theme: 'vs-dark',
41
+ height: '400px',
42
+ readOnly: false
43
+ } as any,
44
+ };
45
+
46
+ export const Python: Story = {
47
+ render: renderStory,
48
+ args: {
49
+ type: 'code-editor',
50
+ value: 'def greet(name):\n """Greet a person by name."""\n return f"Hello, {name}!"\n\nif __name__ == "__main__":\n print(greet("World"))',
51
+ language: 'python',
52
+ theme: 'vs-dark',
53
+ height: '400px',
54
+ readOnly: false
55
+ } as any,
56
+ };
57
+
58
+ export const JSON: Story = {
59
+ render: renderStory,
60
+ args: {
61
+ type: 'code-editor',
62
+ value: '{\n "name": "ObjectUI",\n "version": "1.0.0",\n "description": "Server-Driven UI Engine",\n "features": [\n "JSON-based components",\n "React integration",\n "Tailwind styling"\n ]\n}',
63
+ language: 'json',
64
+ theme: 'vs-dark',
65
+ height: '400px',
66
+ readOnly: false
67
+ } as any,
68
+ };
69
+
70
+ export const ReadOnly: Story = {
71
+ render: renderStory,
72
+ args: {
73
+ type: 'code-editor',
74
+ value: '// This editor is read-only\nconst message = "You cannot edit this code";\nconsole.log(message);',
75
+ language: 'javascript',
76
+ theme: 'vs-dark',
77
+ height: '300px',
78
+ readOnly: true
79
+ } as any,
80
+ };
81
+
82
+ export const LightTheme: Story = {
83
+ render: renderStory,
84
+ args: {
85
+ type: 'code-editor',
86
+ value: 'function fibonacci(n) {\n if (n <= 1) return n;\n return fibonacci(n - 1) + fibonacci(n - 2);\n}\n\nconsole.log(fibonacci(10));',
87
+ language: 'javascript',
88
+ theme: 'light',
89
+ height: '400px',
90
+ readOnly: false
91
+ } as any,
92
+ };
@@ -0,0 +1,40 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { SchemaRenderer } from '../SchemaRenderer';
3
+ import type { BaseSchema } from '@object-ui/types';
4
+
5
+ const meta = {
6
+ title: 'Primitives/Data Display/Collapsible',
7
+ component: SchemaRenderer,
8
+ parameters: { layout: 'centered' },
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ schema: { table: { disable: true } }
12
+ }
13
+ } satisfies Meta<typeof SchemaRenderer>;
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof meta>;
17
+
18
+ const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
19
+
20
+ export const Collapsible: Story = {
21
+ render: renderStory,
22
+ args: {
23
+ type: 'collapsible',
24
+ className: 'w-[350px] space-y-2',
25
+ trigger: [
26
+ {
27
+ type: 'div',
28
+ className: 'flex items-center justify-between space-x-4 px-4 py-2 hover:bg-muted/50 rounded-md cursor-pointer',
29
+ children: [
30
+ { type: 'text', content: '@peduarte starred 3 repositories' },
31
+ { type: 'icon', name: 'chevrons-up-down', className: 'h-4 w-4' }
32
+ ]
33
+ }
34
+ ],
35
+ content: [
36
+ { type: 'div', className: 'rounded-md border p-2 mb-2', children: [{type:'text', content: '@radix-ui/primitives'}] },
37
+ { type: 'div', className: 'rounded-md border p-2', children: [{type:'text', content: '@radix-ui/react'}] }
38
+ ]
39
+ } as any,
40
+ };
@@ -0,0 +1,36 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { SchemaRenderer } from '../SchemaRenderer';
3
+ import type { BaseSchema } from '@object-ui/types';
4
+
5
+ const meta = {
6
+ title: 'Primitives/Data Entry/Controls',
7
+ component: SchemaRenderer,
8
+ parameters: { layout: 'centered' },
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ schema: { table: { disable: true } }
12
+ }
13
+ } satisfies Meta<typeof SchemaRenderer>;
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof meta>;
17
+
18
+ const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
19
+
20
+ export const Checkbox: Story = {
21
+ render: renderStory,
22
+ args: {
23
+ type: 'checkbox',
24
+ label: 'Accept terms and conditions',
25
+ id: 'terms1'
26
+ } as any,
27
+ };
28
+
29
+ export const Switch: Story = {
30
+ render: renderStory,
31
+ args: {
32
+ type: 'switch',
33
+ label: 'Airplane Mode',
34
+ id: 'airplane-mode'
35
+ } as any,
36
+ };
@@ -0,0 +1,154 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import React, { useEffect, useState, useCallback } from 'react';
3
+ import { SchemaRenderer, SchemaRendererProvider } from '@object-ui/react';
4
+ import type { BaseSchema } from '@object-ui/types';
5
+ import { createStorybookDataSource } from '@storybook-config/datasource';
6
+
7
+ const meta: Meta = {
8
+ title: 'Plugins/Data Views/CRM Live Data',
9
+ parameters: {
10
+ layout: 'padded',
11
+ },
12
+ };
13
+
14
+ export default meta;
15
+
16
+ const dataSource = createStorybookDataSource();
17
+
18
+ // ==========================================
19
+ // Helper: Fetches data from MSW and renders a schema
20
+ // ==========================================
21
+ const LiveDataView = ({
22
+ objectName,
23
+ schema,
24
+ title
25
+ }: {
26
+ objectName: string;
27
+ schema: (data: any[]) => BaseSchema;
28
+ title: string;
29
+ }) => {
30
+ const [data, setData] = useState<any[]>([]);
31
+ const [loading, setLoading] = useState(true);
32
+ const [error, setError] = useState<string | null>(null);
33
+
34
+ const fetchData = useCallback(async () => {
35
+ setLoading(true);
36
+ setError(null);
37
+ try {
38
+ const result = await dataSource.find(objectName, { $top: 50 });
39
+ setData(result.data as any[]);
40
+ } catch (err: any) {
41
+ console.error(`[CRM Live] Failed to fetch ${objectName}:`, err);
42
+ setError(err?.message || `Failed to fetch ${objectName}`);
43
+ } finally {
44
+ setLoading(false);
45
+ }
46
+ }, [objectName]);
47
+
48
+ useEffect(() => {
49
+ fetchData();
50
+ }, [fetchData]);
51
+
52
+ if (loading) return <div className="p-8 text-muted-foreground">Loading {title} from MSW API...</div>;
53
+ if (error) return (
54
+ <div className="p-8 space-y-2">
55
+ <div className="text-destructive font-medium">API Error: {error}</div>
56
+ <div className="text-sm text-muted-foreground">
57
+ Ensure the ObjectStack MSW runtime is running. Check browser console for logs.
58
+ </div>
59
+ </div>
60
+ );
61
+
62
+ return (
63
+ <SchemaRendererProvider dataSource={dataSource}>
64
+ <div className="space-y-4">
65
+ <h2 className="text-lg font-semibold">{title} ({data.length} records)</h2>
66
+ <SchemaRenderer schema={schema(data)} />
67
+ </div>
68
+ </SchemaRendererProvider>
69
+ );
70
+ };
71
+
72
+ // ==========================================
73
+ // Contact Grid from MSW
74
+ // ==========================================
75
+ export const ContactGrid: StoryObj = {
76
+ name: 'Contact Grid (Live)',
77
+ render: () => (
78
+ <LiveDataView
79
+ objectName="contact"
80
+ title="Contacts"
81
+ schema={(data) => ({
82
+ type: 'object-grid',
83
+ objectName: 'contact',
84
+ columns: [
85
+ { field: 'name', header: 'Name', sortable: true, filterable: true },
86
+ { field: 'email', header: 'Email', sortable: true },
87
+ { field: 'title', header: 'Title' },
88
+ { field: 'department', header: 'Department' },
89
+ { field: 'status', header: 'Status', sortable: true },
90
+ ],
91
+ data,
92
+ pagination: true,
93
+ pageSize: 10,
94
+ className: 'w-full',
95
+ } as any)}
96
+ />
97
+ ),
98
+ };
99
+
100
+ // ==========================================
101
+ // Account Grid from MSW
102
+ // ==========================================
103
+ export const AccountGrid: StoryObj = {
104
+ name: 'Account Grid (Live)',
105
+ render: () => (
106
+ <LiveDataView
107
+ objectName="account"
108
+ title="Accounts"
109
+ schema={(data) => ({
110
+ type: 'object-grid',
111
+ objectName: 'account',
112
+ columns: [
113
+ { field: 'name', header: 'Company', sortable: true, filterable: true },
114
+ { field: 'industry', header: 'Industry', sortable: true },
115
+ { field: 'type', header: 'Type' },
116
+ { field: 'employees', header: 'Employees', type: 'number' },
117
+ { field: 'phone', header: 'Phone' },
118
+ ],
119
+ data,
120
+ pagination: true,
121
+ pageSize: 10,
122
+ className: 'w-full',
123
+ } as any)}
124
+ />
125
+ ),
126
+ };
127
+
128
+ // ==========================================
129
+ // Opportunity Grid from MSW
130
+ // ==========================================
131
+ export const OpportunityGrid: StoryObj = {
132
+ name: 'Opportunity Grid (Live)',
133
+ render: () => (
134
+ <LiveDataView
135
+ objectName="opportunity"
136
+ title="Opportunities"
137
+ schema={(data) => ({
138
+ type: 'object-grid',
139
+ objectName: 'opportunity',
140
+ columns: [
141
+ { field: 'name', header: 'Opportunity', sortable: true },
142
+ { field: 'amount', header: 'Amount', type: 'currency', sortable: true },
143
+ { field: 'stage', header: 'Stage', sortable: true },
144
+ { field: 'probability', header: 'Probability' },
145
+ { field: 'close_date', header: 'Close Date', type: 'date' },
146
+ ],
147
+ data,
148
+ pagination: true,
149
+ pageSize: 10,
150
+ className: 'w-full',
151
+ } as any)}
152
+ />
153
+ ),
154
+ };