@object-ui/components 3.3.0 → 3.3.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 (321) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +21 -1
  3. package/dist/index.css +6339 -2
  4. package/dist/index.js +17600 -17481
  5. package/dist/index.umd.cjs +36 -36
  6. package/dist/packages/components/src/custom/empty.d.ts +12 -1
  7. package/dist/packages/components/src/renderers/action/action-bar.d.ts +12 -1
  8. package/dist/packages/components/src/ui/chart.d.ts +10 -29
  9. package/package.json +65 -44
  10. package/.turbo/turbo-build.log +0 -84
  11. package/README_SHADCN_SYNC.md +0 -281
  12. package/TESTING.md +0 -335
  13. package/docs/FilterBuilder.md +0 -268
  14. package/metadata/Chart.component.yml +0 -30
  15. package/metadata/FilterBuilder.component.yml +0 -39
  16. package/metadata/GridLayout.component.yml +0 -27
  17. package/metadata/Menu.component.yml +0 -31
  18. package/metadata/ObjectForm.component.yml +0 -34
  19. package/metadata/ObjectGrid.component.yml +0 -72
  20. package/metadata/Page.component.yml +0 -24
  21. package/postcss.config.js +0 -14
  22. package/shadcn-components.json +0 -440
  23. package/src/SchemaRenderer.tsx +0 -28
  24. package/src/__tests__/PageRendererRegions.test.tsx +0 -668
  25. package/src/__tests__/README.md +0 -124
  26. package/src/__tests__/__snapshots__/snapshot-critical.test.tsx.snap +0 -811
  27. package/src/__tests__/__snapshots__/snapshot.test.tsx.snap +0 -327
  28. package/src/__tests__/accessibility.test.tsx +0 -137
  29. package/src/__tests__/action-bar.test.tsx +0 -206
  30. package/src/__tests__/api-consistency.test.tsx +0 -596
  31. package/src/__tests__/basic-renderers.test.tsx +0 -255
  32. package/src/__tests__/color-contrast.test.tsx +0 -212
  33. package/src/__tests__/complex-disclosure-renderers.test.tsx +0 -302
  34. package/src/__tests__/compliance.test.tsx +0 -72
  35. package/src/__tests__/config-field-renderer.test.tsx +0 -307
  36. package/src/__tests__/config-panel-renderer.test.tsx +0 -580
  37. package/src/__tests__/config-primitives.test.tsx +0 -106
  38. package/src/__tests__/edge-cases.test.tsx +0 -285
  39. package/src/__tests__/feedback-overlay-renderers.test.tsx +0 -349
  40. package/src/__tests__/filter-builder.test.tsx +0 -409
  41. package/src/__tests__/form-renderers.test.tsx +0 -364
  42. package/src/__tests__/layout-data-renderers.test.tsx +0 -340
  43. package/src/__tests__/mobile-accessibility.test.tsx +0 -120
  44. package/src/__tests__/navigation-overlay.test.tsx +0 -370
  45. package/src/__tests__/snapshot-critical.test.tsx +0 -317
  46. package/src/__tests__/snapshot.test.tsx +0 -205
  47. package/src/__tests__/test-utils.tsx +0 -190
  48. package/src/__tests__/use-config-draft.test.tsx +0 -295
  49. package/src/__tests__/view-compliance.test.tsx +0 -153
  50. package/src/__tests__/wcag-audit.test.tsx +0 -493
  51. package/src/custom/action-param-dialog.tsx +0 -264
  52. package/src/custom/button-group.tsx +0 -91
  53. package/src/custom/combobox.tsx +0 -104
  54. package/src/custom/config-field-renderer.tsx +0 -276
  55. package/src/custom/config-panel-renderer.tsx +0 -306
  56. package/src/custom/config-row.tsx +0 -50
  57. package/src/custom/date-picker.tsx +0 -61
  58. package/src/custom/empty.tsx +0 -112
  59. package/src/custom/field.tsx +0 -81
  60. package/src/custom/filter-builder.tsx +0 -418
  61. package/src/custom/index.ts +0 -21
  62. package/src/custom/input-group.tsx +0 -53
  63. package/src/custom/item.tsx +0 -201
  64. package/src/custom/kbd.tsx +0 -36
  65. package/src/custom/mobile-dialog-content.tsx +0 -67
  66. package/src/custom/native-select.tsx +0 -33
  67. package/src/custom/navigation-overlay.tsx +0 -334
  68. package/src/custom/section-header.tsx +0 -68
  69. package/src/custom/sort-builder.tsx +0 -129
  70. package/src/custom/spinner.tsx +0 -26
  71. package/src/custom/view-skeleton.tsx +0 -243
  72. package/src/custom/view-states.tsx +0 -153
  73. package/src/debug/DebugPanel.tsx +0 -313
  74. package/src/debug/__tests__/DebugPanel.test.tsx +0 -134
  75. package/src/debug/index.ts +0 -10
  76. package/src/hooks/use-config-draft.ts +0 -127
  77. package/src/hooks/use-mobile.tsx +0 -27
  78. package/src/index.css +0 -245
  79. package/src/index.ts +0 -47
  80. package/src/lib/use-sync-external-store-shim.ts +0 -10
  81. package/src/lib/use-sync-external-store-with-selector-shim.ts +0 -90
  82. package/src/lib/utils.tsx +0 -35
  83. package/src/new-components.test.ts +0 -73
  84. package/src/renderers/action/action-bar.tsx +0 -221
  85. package/src/renderers/action/action-button.tsx +0 -158
  86. package/src/renderers/action/action-group.tsx +0 -270
  87. package/src/renderers/action/action-icon.tsx +0 -150
  88. package/src/renderers/action/action-menu.tsx +0 -203
  89. package/src/renderers/action/index.ts +0 -19
  90. package/src/renderers/action/resolve-icon.ts +0 -35
  91. package/src/renderers/basic/button-group.tsx +0 -79
  92. package/src/renderers/basic/div.tsx +0 -60
  93. package/src/renderers/basic/html.tsx +0 -43
  94. package/src/renderers/basic/icon.tsx +0 -89
  95. package/src/renderers/basic/image.tsx +0 -49
  96. package/src/renderers/basic/index.ts +0 -18
  97. package/src/renderers/basic/navigation-menu.tsx +0 -81
  98. package/src/renderers/basic/pagination.tsx +0 -109
  99. package/src/renderers/basic/separator.tsx +0 -57
  100. package/src/renderers/basic/span.tsx +0 -63
  101. package/src/renderers/basic/text.tsx +0 -52
  102. package/src/renderers/complex/README-KANBAN.md +0 -208
  103. package/src/renderers/complex/TIMELINE.md +0 -353
  104. package/src/renderers/complex/__tests__/data-table-airtable-ux.test.tsx +0 -239
  105. package/src/renderers/complex/__tests__/data-table-batch-editing.test.tsx +0 -275
  106. package/src/renderers/complex/__tests__/data-table-cell-renderer.test.tsx +0 -120
  107. package/src/renderers/complex/__tests__/data-table-editing.test.tsx +0 -221
  108. package/src/renderers/complex/__tests__/data-table.test.ts +0 -76
  109. package/src/renderers/complex/carousel.tsx +0 -69
  110. package/src/renderers/complex/data-table.tsx +0 -1243
  111. package/src/renderers/complex/filter-builder.tsx +0 -77
  112. package/src/renderers/complex/index.ts +0 -16
  113. package/src/renderers/complex/resizable.tsx +0 -66
  114. package/src/renderers/complex/scroll-area.tsx +0 -58
  115. package/src/renderers/complex/table.tsx +0 -95
  116. package/src/renderers/data-display/alert.tsx +0 -46
  117. package/src/renderers/data-display/avatar.tsx +0 -38
  118. package/src/renderers/data-display/badge.tsx +0 -55
  119. package/src/renderers/data-display/breadcrumb.tsx +0 -61
  120. package/src/renderers/data-display/index.ts +0 -18
  121. package/src/renderers/data-display/kbd.tsx +0 -50
  122. package/src/renderers/data-display/list.tsx +0 -75
  123. package/src/renderers/data-display/statistic.tsx +0 -95
  124. package/src/renderers/data-display/table.tsx +0 -78
  125. package/src/renderers/data-display/tree-view.tsx +0 -176
  126. package/src/renderers/disclosure/accordion.tsx +0 -69
  127. package/src/renderers/disclosure/collapsible.tsx +0 -53
  128. package/src/renderers/disclosure/index.ts +0 -11
  129. package/src/renderers/disclosure/toggle-group.tsx +0 -79
  130. package/src/renderers/feedback/empty.tsx +0 -49
  131. package/src/renderers/feedback/index.ts +0 -16
  132. package/src/renderers/feedback/loading.tsx +0 -78
  133. package/src/renderers/feedback/progress.tsx +0 -29
  134. package/src/renderers/feedback/skeleton.tsx +0 -31
  135. package/src/renderers/feedback/sonner.tsx +0 -56
  136. package/src/renderers/feedback/spinner.tsx +0 -55
  137. package/src/renderers/feedback/toast.tsx +0 -59
  138. package/src/renderers/feedback/toaster.tsx +0 -23
  139. package/src/renderers/form/button.tsx +0 -103
  140. package/src/renderers/form/calendar.tsx +0 -34
  141. package/src/renderers/form/checkbox.tsx +0 -71
  142. package/src/renderers/form/combobox.tsx +0 -48
  143. package/src/renderers/form/command.tsx +0 -58
  144. package/src/renderers/form/date-picker.tsx +0 -84
  145. package/src/renderers/form/file-upload.tsx +0 -184
  146. package/src/renderers/form/form.tsx +0 -540
  147. package/src/renderers/form/index.ts +0 -26
  148. package/src/renderers/form/input-otp.tsx +0 -51
  149. package/src/renderers/form/input.tsx +0 -121
  150. package/src/renderers/form/label.tsx +0 -45
  151. package/src/renderers/form/radio-group.tsx +0 -63
  152. package/src/renderers/form/select.tsx +0 -94
  153. package/src/renderers/form/slider.tsx +0 -61
  154. package/src/renderers/form/switch.tsx +0 -48
  155. package/src/renderers/form/textarea.tsx +0 -76
  156. package/src/renderers/form/toggle.tsx +0 -42
  157. package/src/renderers/index.ts +0 -18
  158. package/src/renderers/layout/aspect-ratio.tsx +0 -51
  159. package/src/renderers/layout/card.tsx +0 -85
  160. package/src/renderers/layout/container.tsx +0 -122
  161. package/src/renderers/layout/flex.tsx +0 -132
  162. package/src/renderers/layout/grid.tsx +0 -178
  163. package/src/renderers/layout/index.ts +0 -19
  164. package/src/renderers/layout/page.tsx +0 -466
  165. package/src/renderers/layout/semantic.tsx +0 -48
  166. package/src/renderers/layout/stack.tsx +0 -132
  167. package/src/renderers/layout/tabs.tsx +0 -97
  168. package/src/renderers/navigation/header-bar.tsx +0 -118
  169. package/src/renderers/navigation/index.ts +0 -10
  170. package/src/renderers/navigation/sidebar.tsx +0 -208
  171. package/src/renderers/overlay/alert-dialog.tsx +0 -72
  172. package/src/renderers/overlay/context-menu.tsx +0 -100
  173. package/src/renderers/overlay/dialog.tsx +0 -77
  174. package/src/renderers/overlay/drawer.tsx +0 -77
  175. package/src/renderers/overlay/dropdown-menu.tsx +0 -99
  176. package/src/renderers/overlay/hover-card.tsx +0 -55
  177. package/src/renderers/overlay/index.ts +0 -18
  178. package/src/renderers/overlay/menubar.tsx +0 -76
  179. package/src/renderers/overlay/popover.tsx +0 -56
  180. package/src/renderers/overlay/sheet.tsx +0 -77
  181. package/src/renderers/overlay/tooltip.tsx +0 -67
  182. package/src/renderers/placeholders.tsx +0 -107
  183. package/src/stories/CRMApp.stories.tsx +0 -706
  184. package/src/stories/ConfigPanel.stories.tsx +0 -232
  185. package/src/stories/Guide.mdx +0 -55
  186. package/src/stories/MockedData.stories.tsx +0 -121
  187. package/src/stories/assets/accessibility.png +0 -0
  188. package/src/stories/assets/accessibility.svg +0 -1
  189. package/src/stories/assets/addon-library.png +0 -0
  190. package/src/stories/assets/assets.png +0 -0
  191. package/src/stories/assets/avif-test-image.avif +0 -0
  192. package/src/stories/assets/context.png +0 -0
  193. package/src/stories/assets/discord.svg +0 -1
  194. package/src/stories/assets/docs.png +0 -0
  195. package/src/stories/assets/figma-plugin.png +0 -0
  196. package/src/stories/assets/github.svg +0 -1
  197. package/src/stories/assets/share.png +0 -0
  198. package/src/stories/assets/styling.png +0 -0
  199. package/src/stories/assets/testing.png +0 -0
  200. package/src/stories/assets/theming.png +0 -0
  201. package/src/stories/assets/tutorials.svg +0 -1
  202. package/src/stories/assets/youtube.svg +0 -1
  203. package/src/stories/button.css +0 -30
  204. package/src/stories/header.css +0 -32
  205. package/src/stories/page.css +0 -68
  206. package/src/stories-json/Accessibility.mdx +0 -297
  207. package/src/stories-json/EdgeCases.stories.tsx +0 -160
  208. package/src/stories-json/GettingStarted.mdx +0 -89
  209. package/src/stories-json/Introduction.mdx +0 -127
  210. package/src/stories-json/accordion.stories.tsx +0 -43
  211. package/src/stories-json/aggrid.stories.tsx +0 -103
  212. package/src/stories-json/alert.stories.tsx +0 -39
  213. package/src/stories-json/aspect-ratio.stories.tsx +0 -34
  214. package/src/stories-json/avatar.stories.tsx +0 -38
  215. package/src/stories-json/badge.stories.tsx +0 -53
  216. package/src/stories-json/breadcrumb.stories.tsx +0 -30
  217. package/src/stories-json/button-group.stories.tsx +0 -43
  218. package/src/stories-json/button.stories.tsx +0 -73
  219. package/src/stories-json/calendar.stories.tsx +0 -85
  220. package/src/stories-json/card.stories.tsx +0 -48
  221. package/src/stories-json/carousel.stories.tsx +0 -33
  222. package/src/stories-json/charts.stories.tsx +0 -195
  223. package/src/stories-json/chatbot.stories.tsx +0 -349
  224. package/src/stories-json/code-editor.stories.tsx +0 -92
  225. package/src/stories-json/collapsible.stories.tsx +0 -40
  226. package/src/stories-json/controls.stories.tsx +0 -36
  227. package/src/stories-json/crm-live-data.stories.tsx +0 -154
  228. package/src/stories-json/dashboard.stories.tsx +0 -318
  229. package/src/stories-json/data-table.stories.tsx +0 -136
  230. package/src/stories-json/data_display_extras.stories.tsx +0 -102
  231. package/src/stories-json/date-picker.stories.tsx +0 -28
  232. package/src/stories-json/detail-view.stories.tsx +0 -258
  233. package/src/stories-json/dialog.stories.tsx +0 -43
  234. package/src/stories-json/feedback_extras.stories.tsx +0 -40
  235. package/src/stories-json/feedback_others.stories.tsx +0 -46
  236. package/src/stories-json/form-variants.stories.tsx +0 -210
  237. package/src/stories-json/form_advanced.stories.tsx +0 -117
  238. package/src/stories-json/form_extras.stories.tsx +0 -123
  239. package/src/stories-json/grid.stories.tsx +0 -56
  240. package/src/stories-json/icon.stories.tsx +0 -36
  241. package/src/stories-json/input.stories.tsx +0 -52
  242. package/src/stories-json/kanban.stories.tsx +0 -295
  243. package/src/stories-json/layout_extended.stories.tsx +0 -76
  244. package/src/stories-json/layout_flex.stories.tsx +0 -107
  245. package/src/stories-json/list-view.stories.tsx +0 -97
  246. package/src/stories-json/markdown.stories.tsx +0 -129
  247. package/src/stories-json/menus.stories.tsx +0 -63
  248. package/src/stories-json/metric-card.stories.tsx +0 -143
  249. package/src/stories-json/navigation-menu.stories.tsx +0 -37
  250. package/src/stories-json/object-aggrid-advanced.stories.tsx +0 -389
  251. package/src/stories-json/object-aggrid.stories.tsx +0 -252
  252. package/src/stories-json/object-form.stories.tsx +0 -130
  253. package/src/stories-json/object-gantt.stories.tsx +0 -114
  254. package/src/stories-json/object-grid.stories.tsx +0 -315
  255. package/src/stories-json/object-map.stories.tsx +0 -116
  256. package/src/stories-json/object-view.stories.tsx +0 -118
  257. package/src/stories-json/overlay_extras.stories.tsx +0 -113
  258. package/src/stories-json/overlay_others.stories.tsx +0 -76
  259. package/src/stories-json/page.stories.tsx +0 -55
  260. package/src/stories-json/reports.stories.tsx +0 -163
  261. package/src/stories-json/resizable.stories.tsx +0 -44
  262. package/src/stories-json/select.stories.tsx +0 -34
  263. package/src/stories-json/separator.stories.tsx +0 -41
  264. package/src/stories-json/sidebar.stories.tsx +0 -147
  265. package/src/stories-json/statistic.stories.tsx +0 -44
  266. package/src/stories-json/tabs.stories.tsx +0 -51
  267. package/src/stories-json/timeline.stories.tsx +0 -188
  268. package/src/stories-json/typography.stories.tsx +0 -45
  269. package/src/types/config-panel.ts +0 -101
  270. package/src/ui/accordion.tsx +0 -66
  271. package/src/ui/alert-dialog.tsx +0 -149
  272. package/src/ui/alert.tsx +0 -67
  273. package/src/ui/aspect-ratio.tsx +0 -15
  274. package/src/ui/avatar.tsx +0 -58
  275. package/src/ui/badge.tsx +0 -44
  276. package/src/ui/breadcrumb.tsx +0 -123
  277. package/src/ui/button.tsx +0 -64
  278. package/src/ui/calendar.tsx +0 -221
  279. package/src/ui/card.tsx +0 -87
  280. package/src/ui/carousel.tsx +0 -270
  281. package/src/ui/chart.tsx +0 -377
  282. package/src/ui/checkbox.tsx +0 -38
  283. package/src/ui/collapsible.tsx +0 -19
  284. package/src/ui/command.tsx +0 -161
  285. package/src/ui/context-menu.tsx +0 -208
  286. package/src/ui/dialog.tsx +0 -130
  287. package/src/ui/drawer.tsx +0 -126
  288. package/src/ui/dropdown-menu.tsx +0 -208
  289. package/src/ui/form.tsx +0 -186
  290. package/src/ui/hover-card.tsx +0 -37
  291. package/src/ui/index.ts +0 -56
  292. package/src/ui/input-otp.tsx +0 -79
  293. package/src/ui/input.tsx +0 -30
  294. package/src/ui/label.tsx +0 -34
  295. package/src/ui/menubar.tsx +0 -264
  296. package/src/ui/navigation-menu.tsx +0 -136
  297. package/src/ui/pagination.tsx +0 -125
  298. package/src/ui/popover.tsx +0 -39
  299. package/src/ui/progress.tsx +0 -36
  300. package/src/ui/radio-group.tsx +0 -52
  301. package/src/ui/resizable.tsx +0 -53
  302. package/src/ui/scroll-area.tsx +0 -56
  303. package/src/ui/select.tsx +0 -168
  304. package/src/ui/separator.tsx +0 -39
  305. package/src/ui/sheet.tsx +0 -150
  306. package/src/ui/sidebar.tsx +0 -781
  307. package/src/ui/skeleton.tsx +0 -23
  308. package/src/ui/slider.tsx +0 -39
  309. package/src/ui/sonner.tsx +0 -53
  310. package/src/ui/switch.tsx +0 -37
  311. package/src/ui/table.tsx +0 -125
  312. package/src/ui/tabs.tsx +0 -63
  313. package/src/ui/textarea.tsx +0 -30
  314. package/src/ui/toast.tsx +0 -137
  315. package/src/ui/toggle-group.tsx +0 -69
  316. package/src/ui/toggle.tsx +0 -53
  317. package/src/ui/tooltip.tsx +0 -38
  318. package/src/ui/typography.tsx +0 -85
  319. package/tsconfig.json +0 -19
  320. package/vite.config.ts +0 -71
  321. package/vitest.config.ts +0 -5
@@ -1,150 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- /**
10
- * action:icon — Icon-only action button for dense layouts.
11
- *
12
- * Renders a Shadcn Button (size="icon") with tooltip and ActionRunner integration.
13
- */
14
-
15
- import React, { forwardRef, useCallback, useState } from 'react';
16
- import { ComponentRegistry } from '@object-ui/core';
17
- import type { ActionSchema } from '@object-ui/types';
18
- import { useAction } from '@object-ui/react';
19
- import { useCondition } from '@object-ui/react';
20
- import { Button } from '../../ui';
21
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../ui';
22
- import { cn } from '../../lib/utils';
23
- import { Loader2 } from 'lucide-react';
24
- import { resolveIcon } from './resolve-icon';
25
-
26
- export interface ActionIconProps {
27
- schema: ActionSchema & { type: string; className?: string };
28
- className?: string;
29
- context?: Record<string, any>;
30
- [key: string]: any;
31
- }
32
-
33
- const ActionIconRenderer = forwardRef<HTMLButtonElement, ActionIconProps>(
34
- ({ schema, className, context: localContext, ...props }, ref) => {
35
- const {
36
- 'data-obj-id': dataObjId,
37
- 'data-obj-type': dataObjType,
38
- style,
39
- ...rest
40
- } = props;
41
-
42
- const { execute } = useAction();
43
- const [loading, setLoading] = useState(false);
44
-
45
- const isVisible = useCondition(schema.visible ? `\${${schema.visible}}` : undefined);
46
- const isEnabled = useCondition(schema.enabled ? `\${${schema.enabled}}` : undefined);
47
-
48
- const Icon = resolveIcon(schema.icon);
49
- const variant = schema.variant === 'primary' ? 'default' : (schema.variant || 'ghost');
50
- const size = 'icon';
51
-
52
- const handleClick = useCallback(async () => {
53
- if (loading) return;
54
- setLoading(true);
55
- try {
56
- await execute({
57
- type: schema.type,
58
- name: schema.name,
59
- target: schema.target,
60
- execute: schema.execute,
61
- endpoint: schema.endpoint,
62
- method: schema.method,
63
- params: schema.params as Record<string, any> | undefined,
64
- confirmText: schema.confirmText,
65
- successMessage: schema.successMessage,
66
- errorMessage: schema.errorMessage,
67
- refreshAfter: schema.refreshAfter,
68
- toast: schema.toast,
69
- ...localContext,
70
- });
71
- } finally {
72
- setLoading(false);
73
- }
74
- }, [schema, execute, loading, localContext]);
75
-
76
- if (schema.visible && !isVisible) return null;
77
-
78
- const button = (
79
- <Button
80
- ref={ref}
81
- type="button"
82
- variant={variant as any}
83
- size={size}
84
- className={cn('h-8 w-8', schema.className, className)}
85
- disabled={(schema.enabled ? !isEnabled : false) || loading}
86
- onClick={handleClick}
87
- aria-label={schema.label || schema.name}
88
- {...rest}
89
- {...{ 'data-obj-id': dataObjId, 'data-obj-type': dataObjType, style }}
90
- >
91
- {loading ? (
92
- <Loader2 className="h-4 w-4 animate-spin" />
93
- ) : Icon ? (
94
- <Icon className="h-4 w-4" />
95
- ) : (
96
- <span className="text-xs">{schema.label?.charAt(0) || '?'}</span>
97
- )}
98
- </Button>
99
- );
100
-
101
- // Wrap with tooltip if label is provided
102
- if (schema.label || schema.description) {
103
- return (
104
- <TooltipProvider delayDuration={300}>
105
- <Tooltip>
106
- <TooltipTrigger asChild>{button}</TooltipTrigger>
107
- <TooltipContent>
108
- <p>{schema.label || schema.description}</p>
109
- </TooltipContent>
110
- </Tooltip>
111
- </TooltipProvider>
112
- );
113
- }
114
-
115
- return button;
116
- },
117
- );
118
-
119
- ActionIconRenderer.displayName = 'ActionIconRenderer';
120
-
121
- ComponentRegistry.register('action:icon', ActionIconRenderer, {
122
- namespace: 'action',
123
- label: 'Action Icon',
124
- inputs: [
125
- { name: 'name', type: 'string', label: 'Action Name' },
126
- { name: 'label', type: 'string', label: 'Tooltip Label' },
127
- { name: 'icon', type: 'string', label: 'Icon' },
128
- {
129
- name: 'type',
130
- type: 'enum',
131
- label: 'Action Type',
132
- enum: ['script', 'url', 'modal', 'flow', 'api'],
133
- defaultValue: 'script',
134
- },
135
- { name: 'target', type: 'string', label: 'Target' },
136
- {
137
- name: 'variant',
138
- type: 'enum',
139
- label: 'Variant',
140
- enum: ['default', 'secondary', 'destructive', 'outline', 'ghost'],
141
- defaultValue: 'ghost',
142
- },
143
- { name: 'className', type: 'string', label: 'CSS Class', advanced: true },
144
- ],
145
- defaultProps: {
146
- icon: 'play',
147
- type: 'script',
148
- variant: 'ghost',
149
- },
150
- });
@@ -1,203 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- /**
10
- * action:menu — Dropdown menu for overflow actions.
11
- *
12
- * Renders a Shadcn DropdownMenu populated from ActionSchema[].
13
- * Each menu item triggers the corresponding action via ActionRunner.
14
- */
15
-
16
- import React, { forwardRef, useCallback, useMemo, useState } from 'react';
17
- import { ComponentRegistry } from '@object-ui/core';
18
- import type { ActionSchema } from '@object-ui/types';
19
- import { useAction } from '@object-ui/react';
20
- import { useCondition } from '@object-ui/react';
21
- import { Button } from '../../ui';
22
- import {
23
- DropdownMenu,
24
- DropdownMenuContent,
25
- DropdownMenuItem,
26
- DropdownMenuSeparator,
27
- DropdownMenuTrigger,
28
- } from '../../ui';
29
- import { cn } from '../../lib/utils';
30
- import { Loader2, MoreHorizontal } from 'lucide-react';
31
- import { resolveIcon } from './resolve-icon';
32
-
33
- export interface ActionMenuSchema {
34
- type: 'action:menu';
35
- /** Menu trigger label (defaults to icon-only) */
36
- label?: string;
37
- /** Menu trigger icon (defaults to more-horizontal) */
38
- icon?: string;
39
- /** Actions to render as menu items */
40
- actions?: ActionSchema[];
41
- /** Trigger variant */
42
- variant?: string;
43
- /** Trigger size */
44
- size?: string;
45
- /** Visibility condition */
46
- visible?: string;
47
- /** Custom CSS class */
48
- className?: string;
49
- [key: string]: any;
50
- }
51
-
52
- const ActionMenuItem: React.FC<{
53
- action: ActionSchema;
54
- onExecute: (action: ActionSchema) => Promise<void>;
55
- }> = ({ action, onExecute }) => {
56
- const isVisible = useCondition(action.visible ? `\${${action.visible}}` : undefined);
57
- const isEnabled = useCondition(action.enabled ? `\${${action.enabled}}` : undefined);
58
-
59
- const iconElement = useMemo(() => {
60
- const Icon = resolveIcon(action.icon);
61
- // eslint-disable-next-line react-hooks/static-components -- Icon is resolved from a stable icon registry
62
- return Icon ? <Icon className="mr-2 h-4 w-4" /> : null;
63
- }, [action.icon]);
64
-
65
- if (action.visible && !isVisible) return null;
66
-
67
- return (
68
- <DropdownMenuItem
69
- disabled={action.enabled ? !isEnabled : false}
70
- onSelect={(e) => {
71
- e.preventDefault();
72
- onExecute(action);
73
- }}
74
- className={cn(
75
- (action.variant as string) === 'destructive' && 'text-destructive focus:text-destructive',
76
- action.className,
77
- )}
78
- >
79
- {iconElement}
80
- <span>{action.label || action.name}</span>
81
- </DropdownMenuItem>
82
- );
83
- };
84
-
85
- ActionMenuItem.displayName = 'ActionMenuItem';
86
-
87
- const ActionMenuRenderer = forwardRef<HTMLButtonElement, { schema: ActionMenuSchema; [key: string]: any }>(
88
- ({ schema, className, ...props }, ref) => {
89
- const {
90
- 'data-obj-id': dataObjId,
91
- 'data-obj-type': dataObjType,
92
- style,
93
- ...rest
94
- } = props;
95
-
96
- const { execute } = useAction();
97
- const [loading, setLoading] = useState(false);
98
-
99
- const isVisible = useCondition(schema.visible ? `\${${schema.visible}}` : undefined);
100
-
101
- const TriggerIcon = resolveIcon(schema.icon) || MoreHorizontal;
102
- const variant = schema.variant || 'ghost';
103
- const size = schema.size || 'icon';
104
-
105
- const handleExecute = useCallback(
106
- async (action: ActionSchema) => {
107
- setLoading(true);
108
- try {
109
- await execute({
110
- type: action.type,
111
- name: action.name,
112
- target: action.target,
113
- execute: action.execute,
114
- endpoint: action.endpoint,
115
- method: action.method,
116
- params: action.params as Record<string, any> | undefined,
117
- confirmText: action.confirmText,
118
- successMessage: action.successMessage,
119
- errorMessage: action.errorMessage,
120
- refreshAfter: action.refreshAfter,
121
- toast: action.toast,
122
- });
123
- } finally {
124
- setLoading(false);
125
- }
126
- },
127
- [execute],
128
- );
129
-
130
- if (schema.visible && !isVisible) return null;
131
-
132
- const actions = schema.actions || [];
133
- if (actions.length === 0) return null;
134
-
135
- return (
136
- <DropdownMenu>
137
- <DropdownMenuTrigger asChild>
138
- <Button
139
- ref={ref}
140
- type="button"
141
- variant={variant as any}
142
- size={size as any}
143
- className={cn(
144
- size === 'icon' && 'h-8 w-8',
145
- schema.className,
146
- className,
147
- )}
148
- disabled={loading}
149
- aria-label={schema.label || 'More actions'}
150
- {...rest}
151
- {...{ 'data-obj-id': dataObjId, 'data-obj-type': dataObjType, style }}
152
- >
153
- {loading ? (
154
- <Loader2 className="h-4 w-4 animate-spin" />
155
- ) : (
156
- <>
157
- <TriggerIcon className={cn('h-4 w-4', schema.label && 'mr-2')} />
158
- {schema.label && <span>{schema.label}</span>}
159
- </>
160
- )}
161
- </Button>
162
- </DropdownMenuTrigger>
163
-
164
- <DropdownMenuContent align="end">
165
- {actions.map((action, index) => {
166
- // Render separator for actions tagged with 'separator-before'
167
- const showSeparator = action.tags?.includes('separator-before') && index > 0;
168
- return (
169
- <React.Fragment key={action.name || index}>
170
- {showSeparator && <DropdownMenuSeparator />}
171
- <ActionMenuItem action={action} onExecute={handleExecute} />
172
- </React.Fragment>
173
- );
174
- })}
175
- </DropdownMenuContent>
176
- </DropdownMenu>
177
- );
178
- },
179
- );
180
-
181
- ActionMenuRenderer.displayName = 'ActionMenuRenderer';
182
-
183
- ComponentRegistry.register('action:menu', ActionMenuRenderer, {
184
- namespace: 'action',
185
- label: 'Action Menu',
186
- inputs: [
187
- { name: 'label', type: 'string', label: 'Trigger Label' },
188
- { name: 'icon', type: 'string', label: 'Trigger Icon' },
189
- { name: 'actions', type: 'object', label: 'Actions' },
190
- {
191
- name: 'variant',
192
- type: 'enum',
193
- label: 'Trigger Variant',
194
- enum: ['default', 'secondary', 'outline', 'ghost'],
195
- defaultValue: 'ghost',
196
- },
197
- { name: 'className', type: 'string', label: 'CSS Class', advanced: true },
198
- ],
199
- defaultProps: {
200
- variant: 'ghost',
201
- actions: [],
202
- },
203
- });
@@ -1,19 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- /**
10
- * Action renderers — Smart action components driven by ActionSchema.
11
- *
12
- * Registers: action:button, action:icon, action:menu, action:group
13
- */
14
-
15
- import './action-button';
16
- import './action-icon';
17
- import './action-menu';
18
- import './action-group';
19
- import './action-bar';
@@ -1,35 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { icons, type LucideIcon } from 'lucide-react';
10
-
11
- /**
12
- * Convert a kebab-case icon name to PascalCase (e.g., "arrow-right" -> "ArrowRight").
13
- */
14
- function toPascalCase(str: string): string {
15
- return str
16
- .split('-')
17
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
18
- .join('');
19
- }
20
-
21
- /** Map of renamed icons in lucide-react */
22
- const iconNameMap: Record<string, string> = {
23
- Home: 'House',
24
- };
25
-
26
- /**
27
- * Resolve a Lucide icon by its kebab-case name.
28
- * Returns null if not found.
29
- */
30
- export function resolveIcon(name: string | undefined): LucideIcon | null {
31
- if (!name) return null;
32
- const pascalName = toPascalCase(name);
33
- const mapped = iconNameMap[pascalName] || pascalName;
34
- return (icons as Record<string, LucideIcon>)[mapped] ?? null;
35
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { ComponentRegistry } from '@object-ui/core';
10
- import type { ButtonGroupSchema } from '@object-ui/types';
11
- import { Button } from '../../ui';
12
- import { cn } from '../../lib/utils';
13
-
14
- ComponentRegistry.register('button-group',
15
- ({ schema, ...props }: { schema: ButtonGroupSchema; [key: string]: any }) => {
16
- const {
17
- 'data-obj-id': dataObjId,
18
- 'data-obj-type': dataObjType,
19
- style,
20
- ...buttonGroupProps
21
- } = props;
22
-
23
- return (
24
- <div
25
- className={cn('flex flex-wrap sm:inline-flex rounded-md shadow-sm', schema.className)}
26
- role="group"
27
- {...buttonGroupProps}
28
- {...{ 'data-obj-id': dataObjId, 'data-obj-type': dataObjType, style }}
29
- >
30
- {schema.buttons?.map((button, idx) => (
31
- <Button
32
- key={idx}
33
- variant={button.variant || schema.variant}
34
- size={button.size || schema.size}
35
- className={cn(
36
- 'rounded-none',
37
- idx === 0 && 'rounded-l-md',
38
- idx === (schema.buttons?.length || 0) - 1 && 'rounded-r-md',
39
- idx > 0 && '-ml-px',
40
- button.className
41
- )}
42
- >
43
- {button.label}
44
- </Button>
45
- ))}
46
- </div>
47
- );
48
- },
49
- {
50
- namespace: 'ui',
51
- label: 'Button Group',
52
- inputs: [
53
- {
54
- name: 'variant',
55
- type: 'enum',
56
- enum: ['default', 'destructive', 'outline', 'secondary', 'ghost', 'link'],
57
- defaultValue: 'default',
58
- label: 'Variant'
59
- },
60
- {
61
- name: 'size',
62
- type: 'enum',
63
- enum: ['default', 'sm', 'lg', 'icon'],
64
- defaultValue: 'default',
65
- label: 'Size'
66
- },
67
- { name: 'className', type: 'string', label: 'CSS Class' }
68
- ],
69
- defaultProps: {
70
- variant: 'default',
71
- size: 'default',
72
- buttons: [
73
- { label: 'Left' },
74
- { label: 'Middle' },
75
- { label: 'Right' }
76
- ]
77
- }
78
- }
79
- );
@@ -1,60 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { ComponentRegistry } from '@object-ui/core';
10
- import type { DivSchema } from '@object-ui/types';
11
- import { renderChildren } from '../../lib/utils';
12
- import { forwardRef } from 'react';
13
-
14
- const DivRenderer = forwardRef<HTMLDivElement, { schema: DivSchema; className?: string; [key: string]: any }>(
15
- ({ schema, className, ...props }, ref) => {
16
- // Deprecation warning
17
- if (process.env.NODE_ENV !== 'production') {
18
- console.warn(
19
- '[ObjectUI] The "div" component is deprecated. Please use Shadcn components instead:\n' +
20
- ' - For containers: use "card", "flex", or semantic layout components\n' +
21
- ' - For simple wrappers: use layout components like "container", "stack", or "grid"\n' +
22
- 'See documentation at https://www.objectui.org/docs/components for alternatives.'
23
- );
24
- }
25
-
26
- // Extract designer-related props
27
- const {
28
- 'data-obj-id': dataObjId,
29
- 'data-obj-type': dataObjType,
30
- style,
31
- ...divProps
32
- } = props;
33
-
34
- return (
35
- <div
36
- ref={ref}
37
- className={className}
38
- {...divProps}
39
- // Apply designer props
40
- {...{ 'data-obj-id': dataObjId, 'data-obj-type': dataObjType, style }}
41
- >
42
- {renderChildren(schema.children || schema.body)}
43
- </div>
44
- );
45
- }
46
- );
47
-
48
- ComponentRegistry.register('div',
49
- DivRenderer,
50
- {
51
- namespace: 'ui',
52
- label: 'Container (Deprecated)',
53
- inputs: [
54
- { name: 'className', type: 'string', label: 'CSS Class' }
55
- ],
56
- defaultProps: {
57
- className: 'p-2 sm:p-4 border border-dashed border-gray-300 rounded min-h-[100px]'
58
- }
59
- }
60
- );
@@ -1,43 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import React from 'react';
10
- import { ComponentRegistry } from '@object-ui/core';
11
- import type { HtmlSchema } from '@object-ui/types';
12
- import { cn } from '../../lib/utils';
13
-
14
- ComponentRegistry.register('html',
15
- ({ schema, className, ...props }: { schema: HtmlSchema; className?: string; [key: string]: any }) => {
16
- // Extract designer-related props
17
- const {
18
- 'data-obj-id': dataObjId,
19
- 'data-obj-type': dataObjType,
20
- style,
21
- ...htmlProps
22
- } = props;
23
-
24
- return (
25
- <div
26
- className={cn("prose prose-sm max-w-none dark:prose-invert", className)}
27
- dangerouslySetInnerHTML={{ __html: schema.html }}
28
- {...htmlProps}
29
- // Apply designer props
30
- data-obj-id={dataObjId}
31
- data-obj-type={dataObjType}
32
- style={style}
33
- />
34
- );
35
- },
36
- {
37
- namespace: 'ui',
38
- label: 'HTML Content',
39
- inputs: [
40
- { name: 'html', type: 'string', label: 'HTML', description: 'Raw HTML content' }
41
- ]
42
- }
43
- );
@@ -1,89 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { ComponentRegistry } from '@object-ui/core';
10
- import type { IconSchema } from '@object-ui/types';
11
- import { icons } from 'lucide-react';
12
- import React, { forwardRef } from 'react';
13
- import { cn } from '../../lib/utils';
14
-
15
- // Convert kebab-case to PascalCase for Lucide icon names
16
- // e.g., "arrow-right" -> "ArrowRight", "home" -> "Home"
17
- function toPascalCase(str: string): string {
18
- return str
19
- .split('-')
20
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
21
- .join('');
22
- }
23
-
24
- // Map of renamed icons in lucide-react (from old name to new name)
25
- const iconNameMap: Record<string, string> = {
26
- 'Home': 'House', // "Home" was renamed to "House" in lucide-react's icons object
27
- };
28
-
29
- const IconRenderer = forwardRef<SVGSVGElement, { schema: IconSchema; className?: string; [key: string]: any }>(
30
- ({ schema, className, ...props }, ref) => {
31
- // Extract designer-related props
32
- const {
33
- 'data-obj-id': dataObjId,
34
- 'data-obj-type': dataObjType,
35
- style,
36
- ...iconProps
37
- } = props;
38
-
39
- // Convert icon name to PascalCase for Lucide lookup
40
- const iconName = toPascalCase(schema.name);
41
- // Apply icon name mapping for renamed icons
42
- const mappedIconName = iconNameMap[iconName] || iconName;
43
- const Icon = (icons as any)[mappedIconName];
44
-
45
- if (!Icon) {
46
- console.warn(`Icon "${schema.name}" (lookup: "${iconName}"${mappedIconName !== iconName ? ` -> "${mappedIconName}"` : ''}) not found in lucide-react`);
47
- return null;
48
- }
49
-
50
- // Build size style
51
- const sizeStyle = schema.size ? { width: schema.size, height: schema.size } : undefined;
52
-
53
- // Merge classNames: schema color, schema className, prop className
54
- const mergedClassName = cn(
55
- schema.color,
56
- schema.className,
57
- className
58
- );
59
-
60
- return (
61
- <Icon
62
- ref={ref}
63
- className={mergedClassName}
64
- style={{ ...sizeStyle, ...style }}
65
- {...iconProps}
66
- // Apply designer props
67
- {...{ 'data-obj-id': dataObjId, 'data-obj-type': dataObjType }}
68
- />
69
- );
70
- }
71
- );
72
-
73
- IconRenderer.displayName = 'IconRenderer';
74
-
75
- ComponentRegistry.register('icon',
76
- IconRenderer,
77
- {
78
- namespace: 'ui',
79
- label: 'Icon',
80
- icon: 'smile',
81
- category: 'basic',
82
- inputs: [
83
- { name: 'name', type: 'string', label: 'Icon Name', defaultValue: 'smile' },
84
- { name: 'size', type: 'number', label: 'Size (px)' },
85
- { name: 'color', type: 'string', label: 'Color Class' },
86
- { name: 'className', type: 'string', label: 'CSS Class' }
87
- ]
88
- }
89
- );