@kb-labs/studio-app 0.6.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 (168) hide show
  1. package/.env.example +10 -0
  2. package/README.md +74 -0
  3. package/UI-KIT-COMPONENTS.md +783 -0
  4. package/UI-KIT-PLAN.md +326 -0
  5. package/eslint-rules/no-direct-antd-import.js +151 -0
  6. package/eslint.config.ts +27 -0
  7. package/index.html +17 -0
  8. package/package.json +72 -0
  9. package/postcss.config.js +7 -0
  10. package/public/favicon.ico +0 -0
  11. package/public/favicon.svg +7 -0
  12. package/rspack.config.mjs +118 -0
  13. package/src/App.tsx +46 -0
  14. package/src/components/devtools/devtools-log-feed.module.css +165 -0
  15. package/src/components/devtools/devtools-log-feed.tsx +300 -0
  16. package/src/components/devtools/devtools-panel.module.css +121 -0
  17. package/src/components/devtools/devtools-panel.tsx +115 -0
  18. package/src/components/empty-state.tsx +28 -0
  19. package/src/components/error-boundary.tsx +210 -0
  20. package/src/components/health-banner.module.css +103 -0
  21. package/src/components/health-banner.tsx +134 -0
  22. package/src/components/health-indicator.tsx +12 -0
  23. package/src/components/page-header.tsx +49 -0
  24. package/src/components/page-transition.tsx +24 -0
  25. package/src/components/role-switcher.tsx +148 -0
  26. package/src/components/run-badge.tsx +13 -0
  27. package/src/components/ui/icons.tsx +509 -0
  28. package/src/components/ui/index.ts +25 -0
  29. package/src/components/ui/kb-config-provider.tsx +130 -0
  30. package/src/components/ui/kb-header.module.css +51 -0
  31. package/src/components/ui/kb-header.tsx +112 -0
  32. package/src/components/ui/kb-notification-bell.module.css +103 -0
  33. package/src/components/ui/kb-notification-bell.tsx +199 -0
  34. package/src/components/ui/kb-page-layout.tsx +66 -0
  35. package/src/components/ui/kb-quick-search.module.css +86 -0
  36. package/src/components/ui/kb-quick-search.tsx +196 -0
  37. package/src/components/ui/kb-sidebar.module.css +47 -0
  38. package/src/components/ui/kb-sidebar.tsx +196 -0
  39. package/src/components/ui/kb-stat-card.module.css +21 -0
  40. package/src/components/ui/kb-stat-card.tsx +22 -0
  41. package/src/components/ui/kb-stat-grid.tsx +22 -0
  42. package/src/components/ui/kb-status-bar.module.css +49 -0
  43. package/src/components/ui/kb-status-bar.tsx +145 -0
  44. package/src/components/ui/kb-system-health-indicator.tsx +229 -0
  45. package/src/components/ui/kb-theme-toggle.tsx +42 -0
  46. package/src/components/ui/theme-adapter.ts +812 -0
  47. package/src/components/ui/theme-transition-overlay.tsx +70 -0
  48. package/src/components/ui/utils.ts +6 -0
  49. package/src/components/widget-error-boundary.tsx +172 -0
  50. package/src/config/env.ts +5 -0
  51. package/src/config/feature-flags.ts +482 -0
  52. package/src/config/studio.config.schema.ts +88 -0
  53. package/src/config/studio.config.ts +84 -0
  54. package/src/env.d.ts +23 -0
  55. package/src/hooks/use-command-palette.ts +6 -0
  56. package/src/hooks/use-devtools-store.ts +25 -0
  57. package/src/hooks/use-feature-flags.ts +101 -0
  58. package/src/index.css +10 -0
  59. package/src/layouts/dashboard-grid.tsx +122 -0
  60. package/src/layouts/index.ts +12 -0
  61. package/src/layouts/two-pane.tsx +134 -0
  62. package/src/main.tsx +15 -0
  63. package/src/modules/analytics/components/analytics-daily-stats-chart.tsx +257 -0
  64. package/src/modules/analytics/components/analytics-date-range-picker.tsx +121 -0
  65. package/src/modules/analytics/pages/analytics-cache-page.tsx +285 -0
  66. package/src/modules/analytics/pages/analytics-embeddings-page.tsx +274 -0
  67. package/src/modules/analytics/pages/analytics-events-page.tsx +425 -0
  68. package/src/modules/analytics/pages/analytics-llm-page.tsx +434 -0
  69. package/src/modules/analytics/pages/analytics-overview-page.tsx +336 -0
  70. package/src/modules/analytics/pages/analytics-page.tsx +20 -0
  71. package/src/modules/analytics/pages/analytics-storage-page.tsx +344 -0
  72. package/src/modules/analytics/pages/analytics-vectorstore-page.tsx +279 -0
  73. package/src/modules/analytics/routes/index.tsx +133 -0
  74. package/src/modules/analytics/utils/formatters.test.ts +148 -0
  75. package/src/modules/analytics/utils/formatters.ts +100 -0
  76. package/src/modules/auth/pages/login-page.module.css +113 -0
  77. package/src/modules/auth/pages/login-page.tsx +80 -0
  78. package/src/modules/auth/routes/index.tsx +24 -0
  79. package/src/modules/dashboard/components/ActivityTimelineWidget.tsx +199 -0
  80. package/src/modules/dashboard/components/AiInsightsWidget.tsx +358 -0
  81. package/src/modules/dashboard/components/AnimatedMetricCard.css +88 -0
  82. package/src/modules/dashboard/components/AnimatedMetricCard.tsx +125 -0
  83. package/src/modules/dashboard/components/HeroMetricCard.css +114 -0
  84. package/src/modules/dashboard/components/HeroMetricCard.tsx +152 -0
  85. package/src/modules/dashboard/components/HeroMetricsWidget.tsx +146 -0
  86. package/src/modules/dashboard/components/SystemResourcesWidget.tsx +197 -0
  87. package/src/modules/dashboard/components/dashboard-empty.tsx +22 -0
  88. package/src/modules/dashboard/components/dashboard-kpis-widget.tsx +59 -0
  89. package/src/modules/dashboard/components/dashboard-kpis.tsx +13 -0
  90. package/src/modules/dashboard/components/dashboard-latency-percentiles-widget.tsx +85 -0
  91. package/src/modules/dashboard/components/dashboard-metrics-widget.tsx +78 -0
  92. package/src/modules/dashboard/components/dashboard-plugins-widget.tsx +67 -0
  93. package/src/modules/dashboard/components/dashboard-requests-widget.tsx +62 -0
  94. package/src/modules/dashboard/layouts/dashboard-layout.tsx +16 -0
  95. package/src/modules/dashboard/pages/ai-insights-page.tsx +563 -0
  96. package/src/modules/dashboard/pages/dashboard-animations.css +317 -0
  97. package/src/modules/dashboard/pages/dashboard-page.tsx +13 -0
  98. package/src/modules/dashboard/routes/index.tsx +70 -0
  99. package/src/modules/observability/pages/devkit-page.tsx +263 -0
  100. package/src/modules/observability/pages/incident-detail-page.tsx +571 -0
  101. package/src/modules/observability/pages/incidents-page.tsx +370 -0
  102. package/src/modules/observability/pages/log-detail-page.tsx +508 -0
  103. package/src/modules/observability/pages/logs-page.tsx +1129 -0
  104. package/src/modules/observability/pages/prometheus-metrics-page.tsx +486 -0
  105. package/src/modules/observability/pages/state-broker-page.tsx +229 -0
  106. package/src/modules/observability/pages/system-events-page.tsx +255 -0
  107. package/src/modules/observability/routes/index.tsx +133 -0
  108. package/src/modules/plugins/components/marketplace-card.tsx +153 -0
  109. package/src/modules/plugins/components/plugin-ai-assistant-modal.tsx +374 -0
  110. package/src/modules/plugins/components/plugin-card.tsx +136 -0
  111. package/src/modules/plugins/components/plugin-detail/capabilities-summary.tsx +101 -0
  112. package/src/modules/plugins/components/plugin-detail/cli-commands-table.tsx +101 -0
  113. package/src/modules/plugins/components/plugin-detail/index.ts +7 -0
  114. package/src/modules/plugins/components/plugin-detail/jobs-table.tsx +64 -0
  115. package/src/modules/plugins/components/plugin-detail/permissions/env-permissions.tsx +30 -0
  116. package/src/modules/plugins/components/plugin-detail/permissions/filesystem-permissions.tsx +68 -0
  117. package/src/modules/plugins/components/plugin-detail/permissions/index.ts +6 -0
  118. package/src/modules/plugins/components/plugin-detail/permissions/network-permissions.tsx +43 -0
  119. package/src/modules/plugins/components/plugin-detail/permissions/platform-services.tsx +242 -0
  120. package/src/modules/plugins/components/plugin-detail/permissions/resource-quotas.tsx +96 -0
  121. package/src/modules/plugins/components/plugin-detail/permissions/shell-permissions.tsx +55 -0
  122. package/src/modules/plugins/components/plugin-detail/permissions-view.tsx +47 -0
  123. package/src/modules/plugins/components/plugin-detail/plugin-header.tsx +169 -0
  124. package/src/modules/plugins/components/plugin-detail/rest-routes-table.tsx +159 -0
  125. package/src/modules/plugins/components/plugin-detail/workflows-table.tsx +40 -0
  126. package/src/modules/plugins/components/plugin-grid.tsx +20 -0
  127. package/src/modules/plugins/components/plugin-table.tsx +178 -0
  128. package/src/modules/plugins/pages/marketplace-page.tsx +200 -0
  129. package/src/modules/plugins/pages/plugin-detail-page.tsx +1145 -0
  130. package/src/modules/plugins/routes/index.tsx +48 -0
  131. package/src/modules/plugins/utils/index.ts +1 -0
  132. package/src/modules/plugins/utils/schema-helpers.ts +21 -0
  133. package/src/modules/settings/components/api-routes-viewer.tsx +415 -0
  134. package/src/modules/settings/components/appearance-settings.tsx +200 -0
  135. package/src/modules/settings/components/configuration-settings.tsx +321 -0
  136. package/src/modules/settings/components/data-privacy-settings.tsx +111 -0
  137. package/src/modules/settings/components/experimental-settings.tsx +243 -0
  138. package/src/modules/settings/components/navigation-settings.tsx +198 -0
  139. package/src/modules/settings/components/notifications-settings.tsx +40 -0
  140. package/src/modules/settings/pages/settings-page.tsx +298 -0
  141. package/src/modules/settings/routes/index.tsx +47 -0
  142. package/src/pages/README-assistant.md +91 -0
  143. package/src/pages/login-page.tsx +177 -0
  144. package/src/pages/not-found-page.tsx +85 -0
  145. package/src/providers/auth-provider.tsx +40 -0
  146. package/src/providers/command-palette-provider.tsx +193 -0
  147. package/src/providers/data-sources-provider.tsx +27 -0
  148. package/src/providers/devtools-provider.tsx +72 -0
  149. package/src/providers/navigation-items-provider.tsx +38 -0
  150. package/src/providers/registry-v2-provider.tsx +93 -0
  151. package/src/providers/settings-provider.tsx +158 -0
  152. package/src/router.tsx +302 -0
  153. package/src/routes/helpers.tsx +25 -0
  154. package/src/routes/plugin-page-v2.tsx +52 -0
  155. package/src/routes/types.ts +18 -0
  156. package/src/styles/antd-overrides.css +211 -0
  157. package/src/styles/base.css +190 -0
  158. package/src/styles/settings.css +75 -0
  159. package/src/styles/variables.css +94 -0
  160. package/src/utils/analytics.ts +183 -0
  161. package/src/utils/apply-navigation-categories.ts +83 -0
  162. package/src/utils/commands.ts +252 -0
  163. package/src/utils/export.ts +174 -0
  164. package/src/utils/format-date.ts +166 -0
  165. package/src/utils/logger.ts +110 -0
  166. package/tailwind.config.ts +13 -0
  167. package/tsconfig.json +13 -0
  168. package/vitest-setup.ts +1 -0
@@ -0,0 +1,783 @@
1
+ # KB Labs Studio UI Kit - Component List
2
+
3
+ ## 🎯 Required Components (User-Specified)
4
+
5
+ ### Core Components
6
+
7
+ 1. **UICard** - Card container with header/footer
8
+ 2. **UITitle** - Page/section titles with hierarchy
9
+ 3. **UIPage** - Page layout wrapper with consistent structure
10
+ 4. **UIBadge** - Status indicators and labels
11
+ 5. **UITable** - Data table with sorting/filtering
12
+ 6. **UIButton** - Action buttons with variants
13
+ 7. **UITabs** - Tab navigation
14
+ 8. **UIMarkdownViewer** - Markdown content renderer
15
+ 9. **UIModal** - Modal dialogs
16
+ 10. **UIHeader** - Page header (title + description + breadcrumbs)
17
+ 11. **UIText** - Typography component
18
+
19
+ ### Form Components
20
+
21
+ 12. **UIInput** - Text input
22
+ 13. **UISelect** - Dropdown select
23
+ 14. **UICheckbox** - Checkbox input
24
+ 15. **UICheckboxGroup** - Checkbox group
25
+ 16. **UISwitch** - Toggle switch
26
+ 17. **UIDatePicker** - Date/time picker
27
+ 18. **UIForm** - Form wrapper with validation
28
+
29
+ ## 📊 Additional Components (Based on Current Usage)
30
+
31
+ ### Layout & Structure
32
+
33
+ 19. **UIStack** - Vertical/horizontal spacing layout
34
+ 20. **UIFlex** - Flexbox layout primitive
35
+ 21. **UIBox** - Box model primitive with spacing
36
+ 22. **UIGrid** - Grid layout (Row/Col wrapper)
37
+ 23. **UISpacer** - Spacing component
38
+ 24. **UIDivider** - Section divider
39
+
40
+ ### Display & Feedback
41
+
42
+ 25. **UIMetricCard** - Metric display with trend ✅ (exists)
43
+ 26. **UIAlert** - Alert/notification messages
44
+ 27. **UIEmptyState** - Empty state placeholder
45
+ 28. **UIErrorState** - Error display
46
+ 29. **UISkeleton** - Loading skeleton
47
+ 30. **UITag** - Label/category tag
48
+ 31. **UITooltip** - Tooltip overlay
49
+
50
+ ### Navigation
51
+
52
+ 32. **UIBreadcrumb** - Breadcrumb navigation
53
+ 33. **UIMenu** - Navigation menu
54
+ 34. **UIStepper** - Step indicator
55
+
56
+ ### Data Display
57
+
58
+ 35. **UITimeline** - Timeline component
59
+ 36. **UIList** - List component
60
+ 37. **UICollapse** - Collapsible sections
61
+ 38. **UITree** - Tree view
62
+
63
+ ## 🏗️ Component Implementation Plan
64
+
65
+ ### Phase 1: Primitives & Utilities ✅ (Complete)
66
+ - ✅ UIBox (Box.tsx) - spacing primitive
67
+ - ✅ UIFlex (Flex.tsx) - flexbox primitive
68
+ - ✅ UIText (Text.tsx) - typography primitive
69
+
70
+ ### Phase 2: Core UI Components (Priority 1)
71
+
72
+ #### 2.1 UICard
73
+ ```typescript
74
+ // apps/studio/src/ui/UICard.tsx
75
+ export interface UICardProps {
76
+ title?: string;
77
+ subtitle?: string;
78
+ extra?: React.ReactNode;
79
+ footer?: React.ReactNode;
80
+ bordered?: boolean;
81
+ hoverable?: boolean;
82
+ loading?: boolean;
83
+ size?: 'small' | 'default';
84
+ children: React.ReactNode;
85
+ }
86
+
87
+ export function UICard({ title, subtitle, extra, footer, bordered, hoverable, loading, size, children }: UICardProps) {
88
+ const { token } = useToken();
89
+
90
+ return (
91
+ <Card size={size} bordered={bordered} hoverable={hoverable} loading={loading}>
92
+ {(title || extra) && (
93
+ <Box mb={3}>
94
+ <Flex justify="between" align="center">
95
+ {title && (
96
+ <Box>
97
+ <Text size="lg" weight="semibold" as="div">{title}</Text>
98
+ {subtitle && <Text size="sm" color="secondary">{subtitle}</Text>}
99
+ </Box>
100
+ )}
101
+ {extra}
102
+ </Flex>
103
+ </Box>
104
+ )}
105
+ <Box>{children}</Box>
106
+ {footer && (
107
+ <Box mt={3} pt={3} style={{ borderTop: `1px solid ${token.colorBorder}` }}>
108
+ {footer}
109
+ </Box>
110
+ )}
111
+ </Card>
112
+ );
113
+ }
114
+ ```
115
+
116
+ #### 2.2 UITitle
117
+ ```typescript
118
+ // apps/studio/src/ui/UITitle.tsx
119
+ export type UITitleLevel = 1 | 2 | 3 | 4 | 5;
120
+
121
+ export interface UITitleProps {
122
+ level?: UITitleLevel;
123
+ children: React.ReactNode;
124
+ subtitle?: string;
125
+ className?: string;
126
+ }
127
+
128
+ export function UITitle({ level = 1, children, subtitle, className }: UITitleProps) {
129
+ return (
130
+ <Box mb={subtitle ? 2 : 3}>
131
+ <AntTitle level={level} className={className} style={{ margin: 0 }}>
132
+ {children}
133
+ </AntTitle>
134
+ {subtitle && (
135
+ <Text size="base" color="secondary" as="div" style={{ marginTop: spacing[1] }}>
136
+ {subtitle}
137
+ </Text>
138
+ )}
139
+ </Box>
140
+ );
141
+ }
142
+ ```
143
+
144
+ #### 2.3 UIPage
145
+ ```typescript
146
+ // apps/studio/src/ui/UIPage.tsx
147
+ export interface UIPageProps {
148
+ title?: string;
149
+ description?: string;
150
+ breadcrumbs?: { label: string; href?: string }[];
151
+ extra?: React.ReactNode;
152
+ children: React.ReactNode;
153
+ maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
154
+ }
155
+
156
+ export function UIPage({ title, description, breadcrumbs, extra, children, maxWidth = 'xl' }: UIPageProps) {
157
+ const maxWidthMap = {
158
+ sm: '640px',
159
+ md: '768px',
160
+ lg: '1024px',
161
+ xl: '1280px',
162
+ full: '100%',
163
+ };
164
+
165
+ return (
166
+ <Box p={6} style={{ maxWidth: maxWidthMap[maxWidth], margin: '0 auto' }}>
167
+ {breadcrumbs && <UIBreadcrumb items={breadcrumbs} />}
168
+ {(title || description || extra) && (
169
+ <UIHeader title={title} description={description} extra={extra} />
170
+ )}
171
+ <Box mt={6}>{children}</Box>
172
+ </Box>
173
+ );
174
+ }
175
+ ```
176
+
177
+ #### 2.4 UIHeader
178
+ ```typescript
179
+ // apps/studio/src/ui/UIHeader.tsx
180
+ export interface UIHeaderProps {
181
+ title?: string;
182
+ description?: string;
183
+ extra?: React.ReactNode;
184
+ }
185
+
186
+ export function UIHeader({ title, description, extra }: UIHeaderProps) {
187
+ return (
188
+ <Box mb={6}>
189
+ <Flex justify="between" align="start" gap={4}>
190
+ <Box>
191
+ {title && <UITitle level={1}>{title}</UITitle>}
192
+ {description && (
193
+ <Text size="base" color="secondary" as="div" style={{ marginTop: spacing[2] }}>
194
+ {description}
195
+ </Text>
196
+ )}
197
+ </Box>
198
+ {extra && <Box>{extra}</Box>}
199
+ </Flex>
200
+ </Box>
201
+ );
202
+ }
203
+ ```
204
+
205
+ #### 2.5 UIBadge
206
+ ```typescript
207
+ // apps/studio/src/ui/UIBadge.tsx (already exists, enhance)
208
+ export type UIBadgeVariant = 'success' | 'warning' | 'error' | 'info' | 'default';
209
+
210
+ export interface UIBadgeProps {
211
+ variant?: UIBadgeVariant;
212
+ children?: React.ReactNode;
213
+ count?: number;
214
+ dot?: boolean;
215
+ }
216
+
217
+ export function UIBadge({ variant = 'default', children, count, dot }: UIBadgeProps) {
218
+ const { token } = useToken();
219
+
220
+ const colorMap: Record<UIBadgeVariant, string> = {
221
+ success: token.colorSuccess,
222
+ warning: token.colorWarning,
223
+ error: token.colorError,
224
+ info: token.colorInfo,
225
+ default: token.colorTextSecondary,
226
+ };
227
+
228
+ if (count !== undefined || dot) {
229
+ return <AntBadge count={count} dot={dot} color={colorMap[variant]}>{children}</AntBadge>;
230
+ }
231
+
232
+ if (children) {
233
+ return <AntBadge color={colorMap[variant]} text={children} />;
234
+ }
235
+
236
+ return <AntBadge status={statusMap[variant]} />;
237
+ }
238
+ ```
239
+
240
+ #### 2.6 UIButton
241
+ ```typescript
242
+ // apps/studio/src/ui/UIButton.tsx
243
+ export type UIButtonVariant = 'primary' | 'default' | 'dashed' | 'text' | 'link';
244
+ export type UIButtonSize = 'small' | 'middle' | 'large';
245
+ export type UIButtonType = 'default' | 'danger';
246
+
247
+ export interface UIButtonProps {
248
+ variant?: UIButtonVariant;
249
+ size?: UIButtonSize;
250
+ danger?: boolean;
251
+ icon?: React.ReactNode;
252
+ loading?: boolean;
253
+ disabled?: boolean;
254
+ block?: boolean;
255
+ onClick?: () => void;
256
+ children?: React.ReactNode;
257
+ }
258
+
259
+ export function UIButton({ variant = 'default', size = 'middle', danger, icon, loading, disabled, block, onClick, children }: UIButtonProps) {
260
+ return (
261
+ <AntButton
262
+ type={variant}
263
+ size={size}
264
+ danger={danger}
265
+ icon={icon}
266
+ loading={loading}
267
+ disabled={disabled}
268
+ block={block}
269
+ onClick={onClick}
270
+ >
271
+ {children}
272
+ </AntButton>
273
+ );
274
+ }
275
+ ```
276
+
277
+ ### Phase 3: Data & Navigation Components (Priority 2)
278
+
279
+ #### 3.1 UITable
280
+ ```typescript
281
+ // apps/studio/src/ui/UITable.tsx
282
+ export interface UITableColumn<T> {
283
+ key: string;
284
+ title: string;
285
+ dataIndex?: keyof T;
286
+ render?: (value: any, record: T, index: number) => React.ReactNode;
287
+ sorter?: boolean;
288
+ width?: number | string;
289
+ }
290
+
291
+ export interface UITableProps<T> {
292
+ columns: UITableColumn<T>[];
293
+ data: T[];
294
+ loading?: boolean;
295
+ pagination?: boolean | PaginationProps;
296
+ rowKey?: string | ((record: T) => string);
297
+ onRow?: (record: T) => void;
298
+ }
299
+
300
+ export function UITable<T extends Record<string, any>>({ columns, data, loading, pagination, rowKey, onRow }: UITableProps<T>) {
301
+ return (
302
+ <AntTable
303
+ columns={columns}
304
+ dataSource={data}
305
+ loading={loading}
306
+ pagination={pagination}
307
+ rowKey={rowKey}
308
+ onRow={onRow ? (record) => ({ onClick: () => onRow(record) }) : undefined}
309
+ />
310
+ );
311
+ }
312
+ ```
313
+
314
+ #### 3.2 UITabs
315
+ ```typescript
316
+ // apps/studio/src/ui/UITabs.tsx
317
+ export interface UITabItem {
318
+ key: string;
319
+ label: string;
320
+ icon?: React.ReactNode;
321
+ children: React.ReactNode;
322
+ disabled?: boolean;
323
+ }
324
+
325
+ export interface UITabsProps {
326
+ items: UITabItem[];
327
+ defaultActiveKey?: string;
328
+ activeKey?: string;
329
+ onChange?: (key: string) => void;
330
+ type?: 'line' | 'card';
331
+ }
332
+
333
+ export function UITabs({ items, defaultActiveKey, activeKey, onChange, type = 'line' }: UITabsProps) {
334
+ return (
335
+ <AntTabs
336
+ type={type}
337
+ defaultActiveKey={defaultActiveKey}
338
+ activeKey={activeKey}
339
+ onChange={onChange}
340
+ items={items.map(item => ({
341
+ key: item.key,
342
+ label: (
343
+ <Flex align="center" gap={2}>
344
+ {item.icon}
345
+ <span>{item.label}</span>
346
+ </Flex>
347
+ ),
348
+ children: item.children,
349
+ disabled: item.disabled,
350
+ }))}
351
+ />
352
+ );
353
+ }
354
+ ```
355
+
356
+ #### 3.3 UIBreadcrumb
357
+ ```typescript
358
+ // apps/studio/src/ui/UIBreadcrumb.tsx
359
+ export interface UIBreadcrumbItem {
360
+ label: string;
361
+ href?: string;
362
+ icon?: React.ReactNode;
363
+ }
364
+
365
+ export interface UIBreadcrumbProps {
366
+ items: UIBreadcrumbItem[];
367
+ }
368
+
369
+ export function UIBreadcrumb({ items }: UIBreadcrumbProps) {
370
+ return (
371
+ <AntBreadcrumb
372
+ items={items.map(item => ({
373
+ title: (
374
+ <Flex align="center" gap={1}>
375
+ {item.icon}
376
+ <span>{item.label}</span>
377
+ </Flex>
378
+ ),
379
+ href: item.href,
380
+ }))}
381
+ />
382
+ );
383
+ }
384
+ ```
385
+
386
+ #### 3.4 UIModal
387
+ ```typescript
388
+ // apps/studio/src/ui/UIModal.tsx
389
+ export interface UIModalProps {
390
+ open: boolean;
391
+ title?: string;
392
+ onOk?: () => void;
393
+ onCancel?: () => void;
394
+ okText?: string;
395
+ cancelText?: string;
396
+ width?: number | string;
397
+ footer?: React.ReactNode | null;
398
+ children: React.ReactNode;
399
+ }
400
+
401
+ export function UIModal({ open, title, onOk, onCancel, okText, cancelText, width, footer, children }: UIModalProps) {
402
+ return (
403
+ <AntModal
404
+ open={open}
405
+ title={title}
406
+ onOk={onOk}
407
+ onCancel={onCancel}
408
+ okText={okText}
409
+ cancelText={cancelText}
410
+ width={width}
411
+ footer={footer}
412
+ >
413
+ {children}
414
+ </AntModal>
415
+ );
416
+ }
417
+ ```
418
+
419
+ ### Phase 4: Form Components (Priority 3)
420
+
421
+ #### 4.1 UIForm
422
+ ```typescript
423
+ // apps/studio/src/ui/UIForm.tsx
424
+ export interface UIFormProps {
425
+ layout?: 'horizontal' | 'vertical' | 'inline';
426
+ onFinish?: (values: any) => void;
427
+ onFinishFailed?: (errorInfo: any) => void;
428
+ initialValues?: Record<string, any>;
429
+ children: React.ReactNode;
430
+ }
431
+
432
+ export function UIForm({ layout = 'vertical', onFinish, onFinishFailed, initialValues, children }: UIFormProps) {
433
+ return (
434
+ <AntForm
435
+ layout={layout}
436
+ onFinish={onFinish}
437
+ onFinishFailed={onFinishFailed}
438
+ initialValues={initialValues}
439
+ >
440
+ {children}
441
+ </AntForm>
442
+ );
443
+ }
444
+
445
+ // Export Form.Item as UIFormItem
446
+ export const UIFormItem = AntForm.Item;
447
+ ```
448
+
449
+ #### 4.2 UIInput
450
+ ```typescript
451
+ // apps/studio/src/ui/UIInput.tsx
452
+ export interface UIInputProps {
453
+ value?: string;
454
+ defaultValue?: string;
455
+ placeholder?: string;
456
+ disabled?: boolean;
457
+ prefix?: React.ReactNode;
458
+ suffix?: React.ReactNode;
459
+ onChange?: (value: string) => void;
460
+ onPressEnter?: () => void;
461
+ }
462
+
463
+ export function UIInput({ value, defaultValue, placeholder, disabled, prefix, suffix, onChange, onPressEnter }: UIInputProps) {
464
+ return (
465
+ <AntInput
466
+ value={value}
467
+ defaultValue={defaultValue}
468
+ placeholder={placeholder}
469
+ disabled={disabled}
470
+ prefix={prefix}
471
+ suffix={suffix}
472
+ onChange={(e) => onChange?.(e.target.value)}
473
+ onPressEnter={onPressEnter}
474
+ />
475
+ );
476
+ }
477
+
478
+ // Export variants
479
+ export const UIInputPassword = AntInput.Password;
480
+ export const UIInputTextArea = AntInput.TextArea;
481
+ export const UIInputSearch = AntInput.Search;
482
+ ```
483
+
484
+ #### 4.3 UISelect
485
+ ```typescript
486
+ // apps/studio/src/ui/UISelect.tsx
487
+ export interface UISelectOption {
488
+ label: string;
489
+ value: string | number;
490
+ icon?: React.ReactNode;
491
+ disabled?: boolean;
492
+ }
493
+
494
+ export interface UISelectProps {
495
+ options: UISelectOption[];
496
+ value?: string | number;
497
+ defaultValue?: string | number;
498
+ placeholder?: string;
499
+ disabled?: boolean;
500
+ loading?: boolean;
501
+ allowClear?: boolean;
502
+ showSearch?: boolean;
503
+ onChange?: (value: string | number) => void;
504
+ }
505
+
506
+ export function UISelect({ options, value, defaultValue, placeholder, disabled, loading, allowClear, showSearch, onChange }: UISelectProps) {
507
+ return (
508
+ <AntSelect
509
+ value={value}
510
+ defaultValue={defaultValue}
511
+ placeholder={placeholder}
512
+ disabled={disabled}
513
+ loading={loading}
514
+ allowClear={allowClear}
515
+ showSearch={showSearch}
516
+ onChange={onChange}
517
+ options={options.map(opt => ({
518
+ label: opt.icon ? (
519
+ <Flex align="center" gap={2}>
520
+ {opt.icon}
521
+ <span>{opt.label}</span>
522
+ </Flex>
523
+ ) : opt.label,
524
+ value: opt.value,
525
+ disabled: opt.disabled,
526
+ }))}
527
+ />
528
+ );
529
+ }
530
+ ```
531
+
532
+ #### 4.4-4.6 Other Form Components
533
+ ```typescript
534
+ // UICheckbox, UISwitch, UIDatePicker - similar wrappers around Ant Design components
535
+ ```
536
+
537
+ ### Phase 5: Display & Feedback Components (Priority 4)
538
+
539
+ #### 5.1 UIMarkdownViewer
540
+ ```typescript
541
+ // apps/studio/src/ui/UIMarkdownViewer.tsx
542
+ import ReactMarkdown from 'react-markdown';
543
+ import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
544
+ import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
545
+
546
+ export interface UIMarkdownViewerProps {
547
+ content: string;
548
+ className?: string;
549
+ }
550
+
551
+ export function UIMarkdownViewer({ content, className }: UIMarkdownViewerProps) {
552
+ const { token } = useToken();
553
+
554
+ return (
555
+ <Box className={className}>
556
+ <ReactMarkdown
557
+ components={{
558
+ code({ node, inline, className, children, ...props }) {
559
+ const match = /language-(\w+)/.exec(className || '');
560
+ return !inline && match ? (
561
+ <SyntaxHighlighter
562
+ style={vscDarkPlus}
563
+ language={match[1]}
564
+ PreTag="div"
565
+ {...props}
566
+ >
567
+ {String(children).replace(/\n$/, '')}
568
+ </SyntaxHighlighter>
569
+ ) : (
570
+ <code className={className} {...props}>
571
+ {children}
572
+ </code>
573
+ );
574
+ },
575
+ }}
576
+ >
577
+ {content}
578
+ </ReactMarkdown>
579
+ </Box>
580
+ );
581
+ }
582
+ ```
583
+
584
+ #### 5.2 UIAlert
585
+ ```typescript
586
+ // apps/studio/src/ui/UIAlert.tsx
587
+ export type UIAlertType = 'success' | 'info' | 'warning' | 'error';
588
+
589
+ export interface UIAlertProps {
590
+ type?: UIAlertType;
591
+ message: string;
592
+ description?: string;
593
+ closable?: boolean;
594
+ onClose?: () => void;
595
+ showIcon?: boolean;
596
+ }
597
+
598
+ export function UIAlert({ type = 'info', message, description, closable, onClose, showIcon }: UIAlertProps) {
599
+ return (
600
+ <AntAlert
601
+ type={type}
602
+ message={message}
603
+ description={description}
604
+ closable={closable}
605
+ onClose={onClose}
606
+ showIcon={showIcon}
607
+ />
608
+ );
609
+ }
610
+ ```
611
+
612
+ #### 5.3 UIEmptyState
613
+ ```typescript
614
+ // apps/studio/src/ui/UIEmptyState.tsx
615
+ export interface UIEmptyStateProps {
616
+ title?: string;
617
+ description?: string;
618
+ icon?: React.ReactNode;
619
+ action?: React.ReactNode;
620
+ }
621
+
622
+ export function UIEmptyState({ title, description, icon, action }: UIEmptyStateProps) {
623
+ return (
624
+ <Box p={8} style={{ textAlign: 'center' }}>
625
+ {icon && <Box mb={3}>{icon}</Box>}
626
+ {title && <Text size="lg" weight="semibold" as="div">{title}</Text>}
627
+ {description && <Text size="sm" color="secondary" as="div" style={{ marginTop: spacing[2] }}>{description}</Text>}
628
+ {action && <Box mt={4}>{action}</Box>}
629
+ </Box>
630
+ );
631
+ }
632
+ ```
633
+
634
+ ### Phase 6: Layout & Utility Components (Priority 5)
635
+
636
+ #### 6.1 UIStack
637
+ ```typescript
638
+ // apps/studio/src/ui/UIStack.tsx
639
+ export type UIStackDirection = 'vertical' | 'horizontal';
640
+ export type UIStackSpacing = SpacingValue;
641
+
642
+ export interface UIStackProps {
643
+ direction?: UIStackDirection;
644
+ spacing?: UIStackSpacing;
645
+ align?: 'start' | 'end' | 'center' | 'stretch';
646
+ children: React.ReactNode;
647
+ }
648
+
649
+ export function UIStack({ direction = 'vertical', spacing = 2, align, children }: UIStackProps) {
650
+ return (
651
+ <Flex
652
+ direction={direction === 'vertical' ? 'column' : 'row'}
653
+ gap={spacing}
654
+ align={align}
655
+ >
656
+ {children}
657
+ </Flex>
658
+ );
659
+ }
660
+ ```
661
+
662
+ #### 6.2 UITag
663
+ ```typescript
664
+ // apps/studio/src/ui/UITag.tsx
665
+ export type UITagVariant = 'success' | 'warning' | 'error' | 'info' | 'default' | 'neutral';
666
+
667
+ export interface UITagProps {
668
+ variant?: UITagVariant;
669
+ children: React.ReactNode;
670
+ closable?: boolean;
671
+ onClose?: () => void;
672
+ }
673
+
674
+ export function UITag({ variant = 'default', children, closable, onClose }: UITagProps) {
675
+ const { token } = useToken();
676
+
677
+ const colorMap: Record<UITagVariant, string> = {
678
+ success: token.colorSuccess,
679
+ warning: token.colorWarning,
680
+ error: token.colorError,
681
+ info: token.colorInfo,
682
+ default: token.colorPrimary,
683
+ neutral: token.colorTextSecondary,
684
+ };
685
+
686
+ return <AntTag color={colorMap[variant]} closable={closable} onClose={onClose}>{children}</AntTag>;
687
+ }
688
+ ```
689
+
690
+ ## 📦 Export Structure
691
+
692
+ ```typescript
693
+ // apps/studio/src/ui/index.ts
694
+ // Primitives
695
+ export * from './Text'; // UIText
696
+ export * from './Box'; // UIBox
697
+ export * from './Flex'; // UIFlex
698
+
699
+ // Core Components
700
+ export * from './UICard';
701
+ export * from './UITitle';
702
+ export * from './UIPage';
703
+ export * from './UIHeader';
704
+ export * from './UIBadge';
705
+ export * from './UIButton';
706
+
707
+ // Data & Navigation
708
+ export * from './UITable';
709
+ export * from './UITabs';
710
+ export * from './UIBreadcrumb';
711
+ export * from './UIModal';
712
+
713
+ // Form Components
714
+ export * from './UIForm';
715
+ export * from './UIInput';
716
+ export * from './UISelect';
717
+ export * from './UICheckbox';
718
+ export * from './UISwitch';
719
+ export * from './UIDatePicker';
720
+
721
+ // Display & Feedback
722
+ export * from './UIMarkdownViewer';
723
+ export * from './UIAlert';
724
+ export * from './UIEmptyState';
725
+ export * from './UIErrorState';
726
+ export * from './UISkeleton';
727
+ export * from './UITag';
728
+
729
+ // Layout & Utility
730
+ export * from './UIStack';
731
+ export * from './UIDivider';
732
+ export * from './UIGrid';
733
+
734
+ // Complex Components
735
+ export * from './MetricCard'; // UIMetricCard
736
+ ```
737
+
738
+ ## ✅ Implementation Checklist
739
+
740
+ ### Phase 1: Primitives ✅
741
+ - [x] UIText (Text.tsx)
742
+ - [x] UIBox (Box.tsx)
743
+ - [x] UIFlex (Flex.tsx)
744
+
745
+ ### Phase 2: Core UI (Next)
746
+ - [ ] UICard
747
+ - [ ] UITitle
748
+ - [ ] UIPage
749
+ - [ ] UIHeader
750
+ - [ ] UIBadge (enhance existing Badge.tsx)
751
+ - [ ] UIButton
752
+
753
+ ### Phase 3: Data & Navigation
754
+ - [ ] UITable
755
+ - [ ] UITabs
756
+ - [ ] UIBreadcrumb
757
+ - [ ] UIModal
758
+
759
+ ### Phase 4: Form Components
760
+ - [ ] UIForm + UIFormItem
761
+ - [ ] UIInput (+ variants)
762
+ - [ ] UISelect
763
+ - [ ] UICheckbox
764
+ - [ ] UISwitch
765
+ - [ ] UIDatePicker
766
+
767
+ ### Phase 5: Display & Feedback
768
+ - [ ] UIMarkdownViewer
769
+ - [ ] UIAlert
770
+ - [ ] UIEmptyState
771
+ - [ ] UIErrorState
772
+ - [ ] UISkeleton
773
+ - [ ] UITag
774
+
775
+ ### Phase 6: Layout & Utility
776
+ - [ ] UIStack
777
+ - [ ] UIDivider
778
+ - [ ] UIGrid
779
+
780
+ ---
781
+
782
+ **Created**: 2026-01-27
783
+ **Next**: Implement Phase 2 - Core UI Components