@kb-labs/studio-app 0.6.0 → 2.8.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 (175) hide show
  1. package/dist/index.html +1 -0
  2. package/dist/main.1d68e922.js +522 -0
  3. package/dist/main.1d68e922.js.map +1 -0
  4. package/dist/main.80b70197.css +2 -0
  5. package/dist/main.80b70197.css.map +1 -0
  6. package/dist/mf-manifest.json +241 -0
  7. package/dist/mf-stats.json +271 -0
  8. package/package.json +56 -39
  9. package/server.js +68 -0
  10. package/.env.example +0 -10
  11. package/UI-KIT-COMPONENTS.md +0 -783
  12. package/UI-KIT-PLAN.md +0 -326
  13. package/eslint-rules/no-direct-antd-import.js +0 -151
  14. package/eslint.config.ts +0 -27
  15. package/index.html +0 -17
  16. package/postcss.config.js +0 -7
  17. package/public/favicon.ico +0 -0
  18. package/rspack.config.mjs +0 -118
  19. package/src/App.tsx +0 -46
  20. package/src/components/devtools/devtools-log-feed.module.css +0 -165
  21. package/src/components/devtools/devtools-log-feed.tsx +0 -300
  22. package/src/components/devtools/devtools-panel.module.css +0 -121
  23. package/src/components/devtools/devtools-panel.tsx +0 -115
  24. package/src/components/empty-state.tsx +0 -28
  25. package/src/components/error-boundary.tsx +0 -210
  26. package/src/components/health-banner.module.css +0 -103
  27. package/src/components/health-banner.tsx +0 -134
  28. package/src/components/health-indicator.tsx +0 -12
  29. package/src/components/page-header.tsx +0 -49
  30. package/src/components/page-transition.tsx +0 -24
  31. package/src/components/role-switcher.tsx +0 -148
  32. package/src/components/run-badge.tsx +0 -13
  33. package/src/components/ui/icons.tsx +0 -509
  34. package/src/components/ui/index.ts +0 -25
  35. package/src/components/ui/kb-config-provider.tsx +0 -130
  36. package/src/components/ui/kb-header.module.css +0 -51
  37. package/src/components/ui/kb-header.tsx +0 -112
  38. package/src/components/ui/kb-notification-bell.module.css +0 -103
  39. package/src/components/ui/kb-notification-bell.tsx +0 -199
  40. package/src/components/ui/kb-page-layout.tsx +0 -66
  41. package/src/components/ui/kb-quick-search.module.css +0 -86
  42. package/src/components/ui/kb-quick-search.tsx +0 -196
  43. package/src/components/ui/kb-sidebar.module.css +0 -47
  44. package/src/components/ui/kb-sidebar.tsx +0 -196
  45. package/src/components/ui/kb-stat-card.module.css +0 -21
  46. package/src/components/ui/kb-stat-card.tsx +0 -22
  47. package/src/components/ui/kb-stat-grid.tsx +0 -22
  48. package/src/components/ui/kb-status-bar.module.css +0 -49
  49. package/src/components/ui/kb-status-bar.tsx +0 -145
  50. package/src/components/ui/kb-system-health-indicator.tsx +0 -229
  51. package/src/components/ui/kb-theme-toggle.tsx +0 -42
  52. package/src/components/ui/theme-adapter.ts +0 -812
  53. package/src/components/ui/theme-transition-overlay.tsx +0 -70
  54. package/src/components/ui/utils.ts +0 -6
  55. package/src/components/widget-error-boundary.tsx +0 -172
  56. package/src/config/env.ts +0 -5
  57. package/src/config/feature-flags.ts +0 -482
  58. package/src/config/studio.config.schema.ts +0 -88
  59. package/src/config/studio.config.ts +0 -84
  60. package/src/env.d.ts +0 -23
  61. package/src/hooks/use-command-palette.ts +0 -6
  62. package/src/hooks/use-devtools-store.ts +0 -25
  63. package/src/hooks/use-feature-flags.ts +0 -101
  64. package/src/index.css +0 -10
  65. package/src/layouts/dashboard-grid.tsx +0 -122
  66. package/src/layouts/index.ts +0 -12
  67. package/src/layouts/two-pane.tsx +0 -134
  68. package/src/main.tsx +0 -15
  69. package/src/modules/analytics/components/analytics-daily-stats-chart.tsx +0 -257
  70. package/src/modules/analytics/components/analytics-date-range-picker.tsx +0 -121
  71. package/src/modules/analytics/pages/analytics-cache-page.tsx +0 -285
  72. package/src/modules/analytics/pages/analytics-embeddings-page.tsx +0 -274
  73. package/src/modules/analytics/pages/analytics-events-page.tsx +0 -425
  74. package/src/modules/analytics/pages/analytics-llm-page.tsx +0 -434
  75. package/src/modules/analytics/pages/analytics-overview-page.tsx +0 -336
  76. package/src/modules/analytics/pages/analytics-page.tsx +0 -20
  77. package/src/modules/analytics/pages/analytics-storage-page.tsx +0 -344
  78. package/src/modules/analytics/pages/analytics-vectorstore-page.tsx +0 -279
  79. package/src/modules/analytics/routes/index.tsx +0 -133
  80. package/src/modules/analytics/utils/formatters.test.ts +0 -148
  81. package/src/modules/analytics/utils/formatters.ts +0 -100
  82. package/src/modules/auth/pages/login-page.module.css +0 -113
  83. package/src/modules/auth/pages/login-page.tsx +0 -80
  84. package/src/modules/auth/routes/index.tsx +0 -24
  85. package/src/modules/dashboard/components/ActivityTimelineWidget.tsx +0 -199
  86. package/src/modules/dashboard/components/AiInsightsWidget.tsx +0 -358
  87. package/src/modules/dashboard/components/AnimatedMetricCard.css +0 -88
  88. package/src/modules/dashboard/components/AnimatedMetricCard.tsx +0 -125
  89. package/src/modules/dashboard/components/HeroMetricCard.css +0 -114
  90. package/src/modules/dashboard/components/HeroMetricCard.tsx +0 -152
  91. package/src/modules/dashboard/components/HeroMetricsWidget.tsx +0 -146
  92. package/src/modules/dashboard/components/SystemResourcesWidget.tsx +0 -197
  93. package/src/modules/dashboard/components/dashboard-empty.tsx +0 -22
  94. package/src/modules/dashboard/components/dashboard-kpis-widget.tsx +0 -59
  95. package/src/modules/dashboard/components/dashboard-kpis.tsx +0 -13
  96. package/src/modules/dashboard/components/dashboard-latency-percentiles-widget.tsx +0 -85
  97. package/src/modules/dashboard/components/dashboard-metrics-widget.tsx +0 -78
  98. package/src/modules/dashboard/components/dashboard-plugins-widget.tsx +0 -67
  99. package/src/modules/dashboard/components/dashboard-requests-widget.tsx +0 -62
  100. package/src/modules/dashboard/layouts/dashboard-layout.tsx +0 -16
  101. package/src/modules/dashboard/pages/ai-insights-page.tsx +0 -563
  102. package/src/modules/dashboard/pages/dashboard-animations.css +0 -317
  103. package/src/modules/dashboard/pages/dashboard-page.tsx +0 -13
  104. package/src/modules/dashboard/routes/index.tsx +0 -70
  105. package/src/modules/observability/pages/devkit-page.tsx +0 -263
  106. package/src/modules/observability/pages/incident-detail-page.tsx +0 -571
  107. package/src/modules/observability/pages/incidents-page.tsx +0 -370
  108. package/src/modules/observability/pages/log-detail-page.tsx +0 -508
  109. package/src/modules/observability/pages/logs-page.tsx +0 -1129
  110. package/src/modules/observability/pages/prometheus-metrics-page.tsx +0 -486
  111. package/src/modules/observability/pages/state-broker-page.tsx +0 -229
  112. package/src/modules/observability/pages/system-events-page.tsx +0 -255
  113. package/src/modules/observability/routes/index.tsx +0 -133
  114. package/src/modules/plugins/components/marketplace-card.tsx +0 -153
  115. package/src/modules/plugins/components/plugin-ai-assistant-modal.tsx +0 -374
  116. package/src/modules/plugins/components/plugin-card.tsx +0 -136
  117. package/src/modules/plugins/components/plugin-detail/capabilities-summary.tsx +0 -101
  118. package/src/modules/plugins/components/plugin-detail/cli-commands-table.tsx +0 -101
  119. package/src/modules/plugins/components/plugin-detail/index.ts +0 -7
  120. package/src/modules/plugins/components/plugin-detail/jobs-table.tsx +0 -64
  121. package/src/modules/plugins/components/plugin-detail/permissions/env-permissions.tsx +0 -30
  122. package/src/modules/plugins/components/plugin-detail/permissions/filesystem-permissions.tsx +0 -68
  123. package/src/modules/plugins/components/plugin-detail/permissions/index.ts +0 -6
  124. package/src/modules/plugins/components/plugin-detail/permissions/network-permissions.tsx +0 -43
  125. package/src/modules/plugins/components/plugin-detail/permissions/platform-services.tsx +0 -242
  126. package/src/modules/plugins/components/plugin-detail/permissions/resource-quotas.tsx +0 -96
  127. package/src/modules/plugins/components/plugin-detail/permissions/shell-permissions.tsx +0 -55
  128. package/src/modules/plugins/components/plugin-detail/permissions-view.tsx +0 -47
  129. package/src/modules/plugins/components/plugin-detail/plugin-header.tsx +0 -169
  130. package/src/modules/plugins/components/plugin-detail/rest-routes-table.tsx +0 -159
  131. package/src/modules/plugins/components/plugin-detail/workflows-table.tsx +0 -40
  132. package/src/modules/plugins/components/plugin-grid.tsx +0 -20
  133. package/src/modules/plugins/components/plugin-table.tsx +0 -178
  134. package/src/modules/plugins/pages/marketplace-page.tsx +0 -200
  135. package/src/modules/plugins/pages/plugin-detail-page.tsx +0 -1145
  136. package/src/modules/plugins/routes/index.tsx +0 -48
  137. package/src/modules/plugins/utils/index.ts +0 -1
  138. package/src/modules/plugins/utils/schema-helpers.ts +0 -21
  139. package/src/modules/settings/components/api-routes-viewer.tsx +0 -415
  140. package/src/modules/settings/components/appearance-settings.tsx +0 -200
  141. package/src/modules/settings/components/configuration-settings.tsx +0 -321
  142. package/src/modules/settings/components/data-privacy-settings.tsx +0 -111
  143. package/src/modules/settings/components/experimental-settings.tsx +0 -243
  144. package/src/modules/settings/components/navigation-settings.tsx +0 -198
  145. package/src/modules/settings/components/notifications-settings.tsx +0 -40
  146. package/src/modules/settings/pages/settings-page.tsx +0 -298
  147. package/src/modules/settings/routes/index.tsx +0 -47
  148. package/src/pages/README-assistant.md +0 -91
  149. package/src/pages/login-page.tsx +0 -177
  150. package/src/pages/not-found-page.tsx +0 -85
  151. package/src/providers/auth-provider.tsx +0 -40
  152. package/src/providers/command-palette-provider.tsx +0 -193
  153. package/src/providers/data-sources-provider.tsx +0 -27
  154. package/src/providers/devtools-provider.tsx +0 -72
  155. package/src/providers/navigation-items-provider.tsx +0 -38
  156. package/src/providers/registry-v2-provider.tsx +0 -93
  157. package/src/providers/settings-provider.tsx +0 -158
  158. package/src/router.tsx +0 -302
  159. package/src/routes/helpers.tsx +0 -25
  160. package/src/routes/plugin-page-v2.tsx +0 -52
  161. package/src/routes/types.ts +0 -18
  162. package/src/styles/antd-overrides.css +0 -211
  163. package/src/styles/base.css +0 -190
  164. package/src/styles/settings.css +0 -75
  165. package/src/styles/variables.css +0 -94
  166. package/src/utils/analytics.ts +0 -183
  167. package/src/utils/apply-navigation-categories.ts +0 -83
  168. package/src/utils/commands.ts +0 -252
  169. package/src/utils/export.ts +0 -174
  170. package/src/utils/format-date.ts +0 -166
  171. package/src/utils/logger.ts +0 -110
  172. package/tailwind.config.ts +0 -13
  173. package/tsconfig.json +0 -13
  174. package/vitest-setup.ts +0 -1
  175. /package/{public → dist}/favicon.svg +0 -0
@@ -1,145 +0,0 @@
1
- import * as React from 'react';
2
- import { Space, Tooltip, Badge } from 'antd';
3
- import {
4
- ApiOutlined,
5
- CloudOutlined,
6
- UserOutlined,
7
- SettingOutlined,
8
- QuestionCircleOutlined,
9
- ThunderboltOutlined,
10
- } from '@ant-design/icons';
11
- import styles from './kb-status-bar.module.css';
12
-
13
- export interface StatusBarItemProps {
14
- icon?: React.ReactNode;
15
- label: string;
16
- tooltip?: string;
17
- status?: 'success' | 'error' | 'warning' | 'processing' | 'default';
18
- onClick?: () => void;
19
- clickable?: boolean;
20
- }
21
-
22
- export function StatusBarItem({
23
- icon,
24
- label,
25
- tooltip,
26
- status,
27
- onClick,
28
- clickable = !!onClick,
29
- }: StatusBarItemProps) {
30
- const content = (
31
- <div
32
- onClick={onClick}
33
- className={`${styles.item} ${clickable ? styles.clickable : ''}`}
34
- >
35
- {status && <Badge status={status} />}
36
- {icon && <span className={styles.itemIcon}>{icon}</span>}
37
- <span>{label}</span>
38
- </div>
39
- );
40
-
41
- if (tooltip) {
42
- return <Tooltip title={tooltip}>{content}</Tooltip>;
43
- }
44
-
45
- return content;
46
- }
47
-
48
- export interface KBStatusBarProps {
49
- leftItems?: React.ReactNode;
50
- rightItems?: React.ReactNode;
51
- children?: React.ReactNode;
52
- }
53
-
54
- export function KBStatusBar({ leftItems, rightItems, children }: KBStatusBarProps) {
55
- return (
56
- <div className={styles.bar}>
57
- {children ? (
58
- children
59
- ) : (
60
- <>
61
- <div className={styles.side}>
62
- <Space size={0}>{leftItems}</Space>
63
- </div>
64
- <div className={styles.side}>
65
- <Space size={0}>{rightItems}</Space>
66
- </div>
67
- </>
68
- )}
69
- </div>
70
- );
71
- }
72
-
73
- export const StatusBarPresets = {
74
- ApiConnection: ({ connected, onClick }: { connected: boolean; onClick?: () => void }) => (
75
- <StatusBarItem
76
- icon={<ApiOutlined />}
77
- label={connected ? 'Connected' : 'Disconnected'}
78
- status={connected ? 'success' : 'error'}
79
- tooltip={connected ? 'API connection active' : 'API connection lost'}
80
- onClick={onClick}
81
- clickable={!!onClick}
82
- />
83
- ),
84
-
85
- CloudStatus: ({ synced, onClick }: { synced: boolean; onClick?: () => void }) => (
86
- <StatusBarItem
87
- icon={<CloudOutlined />}
88
- label={synced ? 'Synced' : 'Syncing...'}
89
- status={synced ? 'success' : 'processing'}
90
- tooltip={synced ? 'All changes synced' : 'Syncing changes...'}
91
- onClick={onClick}
92
- clickable={!!onClick}
93
- />
94
- ),
95
-
96
- User: ({ email, onClick }: { email: string; onClick?: () => void }) => (
97
- <StatusBarItem
98
- icon={<UserOutlined />}
99
- label={email}
100
- tooltip="Current user"
101
- onClick={onClick}
102
- clickable={!!onClick}
103
- />
104
- ),
105
-
106
- Version: ({ version, onClick }: { version: string; onClick?: () => void }) => (
107
- <StatusBarItem
108
- label={`v${version}`}
109
- tooltip={`Platform version ${version}`}
110
- onClick={onClick}
111
- clickable={!!onClick}
112
- />
113
- ),
114
-
115
- Settings: ({ onClick }: { onClick: () => void }) => (
116
- <StatusBarItem
117
- icon={<SettingOutlined />}
118
- label="Settings"
119
- tooltip="Open settings"
120
- onClick={onClick}
121
- clickable
122
- />
123
- ),
124
-
125
- Help: ({ onClick }: { onClick: () => void }) => (
126
- <StatusBarItem
127
- icon={<QuestionCircleOutlined />}
128
- label="Help"
129
- tooltip="Get help"
130
- onClick={onClick}
131
- clickable
132
- />
133
- ),
134
-
135
- BackgroundJobs: ({ count, onClick }: { count: number; onClick?: () => void }) => (
136
- <StatusBarItem
137
- icon={<ThunderboltOutlined />}
138
- label={count === 1 ? '1 job running' : `${count} jobs running`}
139
- status="processing"
140
- tooltip="View background jobs"
141
- onClick={onClick}
142
- clickable={!!onClick}
143
- />
144
- ),
145
- };
@@ -1,229 +0,0 @@
1
- import * as React from 'react';
2
- import { Dropdown, Badge, Divider } from 'antd';
3
- import { Activity, CheckCircle, AlertTriangle, XCircle, Database, Package, Clock } from 'lucide-react';
4
- import { UIButton } from '@kb-labs/studio-ui-kit';
5
-
6
- export interface SystemHealthData {
7
- status: 'healthy' | 'degraded' | 'down' | 'unknown';
8
- ready: boolean;
9
- reason?: string;
10
- pluginsMounted?: number;
11
- pluginsFailed?: number;
12
- registryRev?: number | null;
13
- registryGeneratedAt?: string | null;
14
- registryStale?: boolean;
15
- registryPartial?: boolean;
16
- redisEnabled?: boolean;
17
- redisHealthy?: boolean;
18
- }
19
-
20
- export interface KBSystemHealthIndicatorProps {
21
- health?: SystemHealthData;
22
- loading?: boolean;
23
- onClick?: () => void;
24
- }
25
-
26
- const STATUS_CONFIG = {
27
- healthy: {
28
- color: '#52c41a',
29
- icon: CheckCircle,
30
- label: 'Healthy',
31
- badgeStatus: 'success' as const,
32
- },
33
- degraded: {
34
- color: '#faad14',
35
- icon: AlertTriangle,
36
- label: 'Degraded',
37
- badgeStatus: 'warning' as const,
38
- },
39
- down: {
40
- color: '#ff4d4f',
41
- icon: XCircle,
42
- label: 'Down',
43
- badgeStatus: 'error' as const,
44
- },
45
- unknown: {
46
- color: '#8c8c8c',
47
- icon: Activity,
48
- label: 'Unknown',
49
- badgeStatus: 'default' as const,
50
- },
51
- } as const;
52
-
53
- function formatTimeAgo(isoString: string | null | undefined): string {
54
- if (!isoString) {return 'unknown';}
55
-
56
- const now = Date.now();
57
- const timestamp = new Date(isoString).getTime();
58
- const diffMs = now - timestamp;
59
-
60
- if (diffMs < 60_000) {return 'just now';}
61
- if (diffMs < 3600_000) {return `${Math.floor(diffMs / 60_000)}min ago`;}
62
- if (diffMs < 86400_000) {return `${Math.floor(diffMs / 3600_000)}h ago`;}
63
- return `${Math.floor(diffMs / 86400_000)}d ago`;
64
- }
65
-
66
- export function KBSystemHealthIndicator({
67
- health,
68
- loading = false,
69
- onClick,
70
- }: KBSystemHealthIndicatorProps) {
71
- const status = health?.status ?? 'unknown';
72
- const config = STATUS_CONFIG[status];
73
- const StatusIcon = config.icon;
74
-
75
- // Build dropdown content
76
- const dropdownContent = React.useMemo(() => {
77
- if (!health) {
78
- return (
79
- <div style={{
80
- padding: '12px 16px',
81
- minWidth: 280,
82
- backgroundColor: 'var(--bg-primary)',
83
- borderRadius: 8,
84
- boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
85
- }}>
86
- <div style={{ fontSize: 13, color: 'var(--text-secondary)' }}>
87
- No health data available
88
- </div>
89
- </div>
90
- );
91
- }
92
-
93
- return (
94
- <div style={{
95
- padding: '12px 16px',
96
- minWidth: 280,
97
- backgroundColor: 'var(--bg-primary)',
98
- borderRadius: 8,
99
- boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
100
- }}>
101
- {/* Status */}
102
- <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 }}>
103
- <StatusIcon size={18} color={config.color} />
104
- <strong style={{ fontSize: 14 }}>System Status: {config.label}</strong>
105
- </div>
106
- {!health.ready && health.reason && (
107
- <div style={{ fontSize: 12, color: 'var(--text-secondary)', marginBottom: 12, paddingLeft: 26 }}>
108
- Reason: {health.reason}
109
- </div>
110
- )}
111
-
112
- <Divider style={{ margin: '12px 0' }} />
113
-
114
- {/* Plugins */}
115
- {(health.pluginsMounted !== undefined || health.pluginsFailed !== undefined) && (
116
- <>
117
- <div style={{ display: 'flex', alignItems: 'flex-start', gap: 8, marginBottom: 12 }}>
118
- <Package size={16} style={{ marginTop: 2, flexShrink: 0 }} />
119
- <div style={{ flex: 1 }}>
120
- <div style={{ fontSize: 13 }}>Plugins: {health.pluginsMounted ?? 0} mounted</div>
121
- {(health.pluginsFailed ?? 0) > 0 && (
122
- <div style={{ color: '#ff4d4f', fontSize: 12, marginTop: 2 }}>
123
- {health.pluginsFailed} failed
124
- </div>
125
- )}
126
- </div>
127
- </div>
128
- </>
129
- )}
130
-
131
- {/* Registry */}
132
- {(health.registryRev !== undefined || health.registryGeneratedAt) && (
133
- <>
134
- <div style={{ display: 'flex', alignItems: 'flex-start', gap: 8, marginBottom: 12 }}>
135
- <Database size={16} style={{ marginTop: 2, flexShrink: 0 }} />
136
- <div style={{ flex: 1 }}>
137
- <div style={{ fontSize: 13 }}>
138
- Registry: rev #{health.registryRev ?? 'unknown'}
139
- {(() => {
140
- const badges: string[] = [];
141
- if (health.registryStale) {badges.push('stale');}
142
- if (health.registryPartial) {badges.push('partial');}
143
- return badges.length > 0 ? ` (${badges.join(', ')})` : '';
144
- })()}
145
- </div>
146
- <div style={{ fontSize: 12, color: 'var(--text-secondary)', marginTop: 2 }}>
147
- Updated {formatTimeAgo(health.registryGeneratedAt)}
148
- </div>
149
- </div>
150
- </div>
151
- </>
152
- )}
153
-
154
- {/* Redis */}
155
- {health.redisEnabled !== undefined && (
156
- <>
157
- <div style={{ display: 'flex', alignItems: 'flex-start', gap: 8 }}>
158
- <Database size={16} style={{ marginTop: 2, flexShrink: 0 }} />
159
- <div style={{ flex: 1 }}>
160
- <div style={{ fontSize: 13 }}>
161
- Redis: {health.redisEnabled ? 'enabled' : 'disabled'}
162
- </div>
163
- {health.redisEnabled && (
164
- <div style={{ fontSize: 12, color: health.redisHealthy ? '#52c41a' : '#ff4d4f', marginTop: 2 }}>
165
- {health.redisHealthy ? 'healthy ✓' : 'unhealthy ✗'}
166
- </div>
167
- )}
168
- </div>
169
- </div>
170
- </>
171
- )}
172
- </div>
173
- );
174
- }, [health, config, StatusIcon]);
175
-
176
- if (loading) {
177
- return (
178
- <UIButton
179
- variant="text"
180
- size="small"
181
- icon={<Clock size={16} />}
182
- style={{ display: 'flex', alignItems: 'center', gap: 6 }}
183
- >
184
- Loading...
185
- </UIButton>
186
- );
187
- }
188
-
189
- // Show badge only if there are issues
190
- const showBadge =
191
- status === 'degraded' ||
192
- status === 'down' ||
193
- (health?.pluginsFailed ?? 0) > 0 ||
194
- health?.registryStale ||
195
- health?.registryPartial;
196
-
197
- const buttonElement = (
198
- <UIButton
199
- variant="text"
200
- onClick={onClick}
201
- icon={<StatusIcon size={18} color={config.color} strokeWidth={2} />}
202
- style={{ display: 'flex', alignItems: 'center', gap: 4 }}
203
- >
204
- System
205
- </UIButton>
206
- );
207
-
208
- return (
209
- <Dropdown
210
- dropdownRender={() => dropdownContent}
211
- placement="bottomRight"
212
- trigger={['click']}
213
- >
214
- <span style={{ display: 'inline-flex', alignItems: 'center' }}>
215
- {showBadge ? (
216
- <Badge
217
- dot
218
- status={config.badgeStatus}
219
- offset={[-2, 2]}
220
- >
221
- {buttonElement}
222
- </Badge>
223
- ) : (
224
- buttonElement
225
- )}
226
- </span>
227
- </Dropdown>
228
- );
229
- }
@@ -1,42 +0,0 @@
1
- import * as React from 'react';
2
- import { Dropdown } from 'antd';
3
- import type { MenuProps } from 'antd';
4
- import { Sun, Moon, Monitor } from 'lucide-react';
5
- import { UIButton } from '@kb-labs/studio-ui-kit';
6
- import { useKBTheme, type ThemeMode } from './kb-config-provider';
7
-
8
- const themeOptions: { key: ThemeMode; label: string; icon: React.ReactNode }[] = [
9
- { key: 'light', label: 'Light', icon: <Sun size={16} /> },
10
- { key: 'dark', label: 'Dark', icon: <Moon size={16} /> },
11
- { key: 'auto', label: 'Auto', icon: <Monitor size={16} /> },
12
- ];
13
-
14
- export function KBThemeToggle() {
15
- const { theme, setTheme } = useKBTheme();
16
-
17
- const currentTheme = themeOptions.find((opt) => opt.key === theme) ?? themeOptions[0]!;
18
-
19
- const items: MenuProps['items'] = themeOptions.map((option) => ({
20
- key: option.key,
21
- label: (
22
- <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
23
- {option.icon}
24
- <span>{option.label}</span>
25
- </div>
26
- ),
27
- onClick: () => setTheme(option.key),
28
- }));
29
-
30
- return (
31
- <Dropdown menu={{ items, selectedKeys: [theme] }} placement="bottomRight">
32
- <UIButton
33
- variant="text"
34
- icon={React.cloneElement(currentTheme.icon as React.ReactElement, { size: 16 })}
35
- style={{ height: 32, display: 'flex', alignItems: 'center', gap: 4, fontSize: 13 }}
36
- >
37
- {currentTheme.label}
38
- </UIButton>
39
- </Dropdown>
40
- );
41
- }
42
-