ai-design-system 0.1.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.
- package/README.md +307 -0
- package/components/ai-elements/actions.tsx +65 -0
- package/components/ai-elements/artifact.tsx +147 -0
- package/components/ai-elements/branch.tsx +212 -0
- package/components/ai-elements/canvas.tsx +24 -0
- package/components/ai-elements/chain-of-thought.tsx +228 -0
- package/components/ai-elements/code-block.tsx +179 -0
- package/components/ai-elements/confirmation.tsx +169 -0
- package/components/ai-elements/connection.tsx +28 -0
- package/components/ai-elements/context.tsx +408 -0
- package/components/ai-elements/controls.tsx +18 -0
- package/components/ai-elements/conversation.tsx +97 -0
- package/components/ai-elements/edge.tsx +140 -0
- package/components/ai-elements/image.tsx +24 -0
- package/components/ai-elements/inline-citation.tsx +287 -0
- package/components/ai-elements/loader.tsx +96 -0
- package/components/ai-elements/message.tsx +80 -0
- package/components/ai-elements/node.tsx +71 -0
- package/components/ai-elements/open-in-chat.tsx +363 -0
- package/components/ai-elements/panel.tsx +15 -0
- package/components/ai-elements/plan.tsx +142 -0
- package/components/ai-elements/prompt-input.tsx +1352 -0
- package/components/ai-elements/queue.tsx +274 -0
- package/components/ai-elements/reasoning.tsx +178 -0
- package/components/ai-elements/response.tsx +22 -0
- package/components/ai-elements/shimmer.tsx +64 -0
- package/components/ai-elements/sources.tsx +77 -0
- package/components/ai-elements/suggestion.tsx +56 -0
- package/components/ai-elements/task.tsx +87 -0
- package/components/ai-elements/tool.tsx +179 -0
- package/components/ai-elements/toolbar.tsx +16 -0
- package/components/ai-elements/web-preview.tsx +263 -0
- package/components/blocks/AIConversation/AIConversation.stories.tsx +164 -0
- package/components/blocks/AIConversation/AIConversation.tsx +186 -0
- package/components/blocks/AIConversation/index.ts +8 -0
- package/components/blocks/AppSidebar/AppSidebar.stories.tsx +63 -0
- package/components/blocks/AppSidebar/AppSidebar.tsx +87 -0
- package/components/blocks/AppSidebar/index.ts +2 -0
- package/components/blocks/DocumentEditorWithComments/DocumentEditorWithComments.stories.tsx +341 -0
- package/components/blocks/DocumentEditorWithComments/DocumentEditorWithComments.tsx +255 -0
- package/components/blocks/DocumentEditorWithComments/index.ts +9 -0
- package/components/blocks/FileChangeQueue/FileChangeQueue.stories.tsx +207 -0
- package/components/blocks/FileChangeQueue/FileChangeQueue.tsx +143 -0
- package/components/blocks/FileChangeQueue/index.ts +7 -0
- package/components/blocks/LayoutProvider/LayoutProvider.tsx +34 -0
- package/components/blocks/LayoutProvider/index.ts +1 -0
- package/components/blocks/index.ts +2 -0
- package/components/composites/AgentIndicator/AgentIndicator.stories.tsx +154 -0
- package/components/composites/AgentIndicator/AgentIndicator.tsx +102 -0
- package/components/composites/AgentIndicator/index.ts +8 -0
- package/components/composites/AppHeader/AppHeader.stories.tsx +46 -0
- package/components/composites/AppHeader/AppHeader.tsx +24 -0
- package/components/composites/AppHeader/index.ts +2 -0
- package/components/composites/CommentBox/CommentBox.stories.tsx +192 -0
- package/components/composites/CommentBox/CommentBox.tsx +364 -0
- package/components/composites/CommentBox/index.ts +8 -0
- package/components/composites/Confirmation/Confirmation.stories.tsx +151 -0
- package/components/composites/Confirmation/Confirmation.tsx +93 -0
- package/components/composites/Confirmation/index.ts +7 -0
- package/components/composites/DataTable/DataTable.stories.tsx +35 -0
- package/components/composites/DataTable/DataTable.tsx +95 -0
- package/components/composites/DataTable/index.ts +2 -0
- package/components/composites/DocumentEditor/DocumentEditor.css +106 -0
- package/components/composites/DocumentEditor/DocumentEditor.stories.tsx +927 -0
- package/components/composites/DocumentEditor/DocumentEditor.tsx +279 -0
- package/components/composites/DocumentEditor/index.ts +8 -0
- package/components/composites/FileQueue/FileQueue.stories.tsx +175 -0
- package/components/composites/FileQueue/FileQueue.tsx +161 -0
- package/components/composites/FileQueue/FileStatusBadge.tsx +74 -0
- package/components/composites/FileQueue/index.ts +24 -0
- package/components/composites/InteractiveChart/InteractiveChart.stories.tsx +49 -0
- package/components/composites/InteractiveChart/InteractiveChart.tsx +69 -0
- package/components/composites/InteractiveChart/index.ts +2 -0
- package/components/composites/ModeToggle/ModeToggle.stories.tsx +212 -0
- package/components/composites/ModeToggle/ModeToggle.tsx +100 -0
- package/components/composites/ModeToggle/index.ts +7 -0
- package/components/composites/NavUser/NavUser.stories.tsx +50 -0
- package/components/composites/NavUser/NavUser.tsx +60 -0
- package/components/composites/NavUser/index.ts +2 -0
- package/components/composites/NavigationList/NavigationList.stories.tsx +46 -0
- package/components/composites/NavigationList/NavigationList.tsx +46 -0
- package/components/composites/NavigationList/index.ts +2 -0
- package/components/composites/OrchestratorMessage/OrchestratorMessage.stories.tsx +188 -0
- package/components/composites/OrchestratorMessage/OrchestratorMessage.tsx +72 -0
- package/components/composites/OrchestratorMessage/index.ts +8 -0
- package/components/composites/PageContainer/PageContainer.stories.tsx +41 -0
- package/components/composites/PageContainer/PageContainer.tsx +24 -0
- package/components/composites/PageContainer/index.ts +2 -0
- package/components/composites/PromptInput/PromptInput.stories.tsx +200 -0
- package/components/composites/PromptInput/PromptInput.tsx +129 -0
- package/components/composites/PromptInput/index.ts +8 -0
- package/components/composites/SpecialistMessage/SpecialistMessage.stories.tsx +286 -0
- package/components/composites/SpecialistMessage/SpecialistMessage.tsx +107 -0
- package/components/composites/SpecialistMessage/index.ts +8 -0
- package/components/composites/StatsCard/StatsCard.stories.tsx +76 -0
- package/components/composites/StatsCard/StatsCard.tsx +81 -0
- package/components/composites/StatsCard/index.ts +2 -0
- package/components/composites/TablePagination/TablePagination.stories.tsx +38 -0
- package/components/composites/TablePagination/TablePagination.tsx +119 -0
- package/components/composites/TablePagination/index.ts +2 -0
- package/components/composites/TableToolbar/TableToolbar.stories.tsx +60 -0
- package/components/composites/TableToolbar/TableToolbar.tsx +66 -0
- package/components/composites/TableToolbar/index.ts +2 -0
- package/components/composites/ThemeSelector/ThemeSelector.stories.tsx +48 -0
- package/components/composites/ThemeSelector/ThemeSelector.tsx +79 -0
- package/components/composites/ThemeSelector/index.ts +2 -0
- package/components/composites/ToolCallDisplay/ToolCallDisplay.stories.tsx +49 -0
- package/components/composites/ToolCallDisplay/ToolCallDisplay.tsx +108 -0
- package/components/composites/ToolCallDisplay/index.ts +8 -0
- package/components/composites/UserMessage/UserMessage.stories.tsx +59 -0
- package/components/composites/UserMessage/UserMessage.tsx +52 -0
- package/components/composites/UserMessage/index.ts +8 -0
- package/components/composites/index.ts +90 -0
- package/components/features/AIDocEditor/AIDocEditor.behaviors.stories.tsx +451 -0
- package/components/features/AIDocEditor/AIDocEditor.mocks.ts +96 -0
- package/components/features/AIDocEditor/AIDocEditor.stories.tsx +140 -0
- package/components/features/AIDocEditor/AIDocEditor.tsx +130 -0
- package/components/features/AIDocEditor/index.ts +8 -0
- package/components/features/AIDocEditor/useAIDocEditor.d.ts +97 -0
- package/components/features/AIDocEditor/useAIDocEditor.mock.ts +83 -0
- package/components/features/PageLayout/PageLayout.behaviors.stories.tsx +119 -0
- package/components/features/PageLayout/PageLayout.mocks.ts +27 -0
- package/components/features/PageLayout/PageLayout.stories.tsx +142 -0
- package/components/features/PageLayout/PageLayout.tsx +94 -0
- package/components/features/PageLayout/index.ts +4 -0
- package/components/features/PageLayout/usePageLayout.d.ts +24 -0
- package/components/features/PageLayout/usePageLayout.mock.ts +19 -0
- package/components/features/RefinementPanel/README.md +189 -0
- package/components/features/RefinementPanel/RefinementPanel.behaviors.stories.tsx +475 -0
- package/components/features/RefinementPanel/RefinementPanel.mocks.ts +131 -0
- package/components/features/RefinementPanel/RefinementPanel.stories.tsx +141 -0
- package/components/features/RefinementPanel/RefinementPanel.tsx +160 -0
- package/components/features/RefinementPanel/index.ts +25 -0
- package/components/features/RefinementPanel/useRefinementPanel.d.ts +74 -0
- package/components/features/RefinementPanel/useRefinementPanel.mock.ts +121 -0
- package/components/features/SpecNavigator/SpecNavigator.behaviors.stories.tsx +379 -0
- package/components/features/SpecNavigator/SpecNavigator.mocks.ts +131 -0
- package/components/features/SpecNavigator/SpecNavigator.stories.tsx +122 -0
- package/components/features/SpecNavigator/SpecNavigator.tsx +43 -0
- package/components/features/SpecNavigator/index.ts +2 -0
- package/components/features/SpecNavigator/useSpecNavigator.d.ts +122 -0
- package/components/features/SpecNavigator/useSpecNavigator.mock.ts +93 -0
- package/components/features/index.ts +18 -0
- package/components/index.ts +14 -0
- package/components/primitives/Accordion/Accordion.stories.tsx +87 -0
- package/components/primitives/Accordion/Accordion.tsx +66 -0
- package/components/primitives/Accordion/index.ts +13 -0
- package/components/primitives/Alert/Alert.stories.tsx +422 -0
- package/components/primitives/Alert/Alert.tsx +61 -0
- package/components/primitives/Alert/index.ts +8 -0
- package/components/primitives/AlertDialog/AlertDialog.stories.tsx +367 -0
- package/components/primitives/AlertDialog/AlertDialog.tsx +182 -0
- package/components/primitives/AlertDialog/index.ts +25 -0
- package/components/primitives/Avatar/Avatar.stories.tsx +321 -0
- package/components/primitives/Avatar/Avatar.tsx +63 -0
- package/components/primitives/Avatar/index.ts +8 -0
- package/components/primitives/Badge/Badge.stories.tsx +74 -0
- package/components/primitives/Badge/Badge.tsx +49 -0
- package/components/primitives/Badge/index.ts +2 -0
- package/components/primitives/Button/Button.stories.tsx +445 -0
- package/components/primitives/Button/Button.tsx +89 -0
- package/components/primitives/Button/index.ts +7 -0
- package/components/primitives/Card/Card.stories.tsx +831 -0
- package/components/primitives/Card/Card.tsx +242 -0
- package/components/primitives/Card/index.ts +30 -0
- package/components/primitives/Carousel/Carousel.stories.tsx +32 -0
- package/components/primitives/Carousel/Carousel.tsx +63 -0
- package/components/primitives/Carousel/index.ts +13 -0
- package/components/primitives/Chart/Chart.stories.tsx +346 -0
- package/components/primitives/Chart/Chart.tsx +117 -0
- package/components/primitives/Chart/index.ts +20 -0
- package/components/primitives/Checkbox/Checkbox.stories.tsx +87 -0
- package/components/primitives/Checkbox/Checkbox.tsx +38 -0
- package/components/primitives/Checkbox/index.ts +2 -0
- package/components/primitives/Collapsible/Collapsible.stories.tsx +38 -0
- package/components/primitives/Collapsible/Collapsible.tsx +39 -0
- package/components/primitives/Collapsible/index.ts +8 -0
- package/components/primitives/Command/Command.stories.tsx +150 -0
- package/components/primitives/Command/Command.tsx +147 -0
- package/components/primitives/Command/index.ts +20 -0
- package/components/primitives/Dialog/Dialog.stories.tsx +390 -0
- package/components/primitives/Dialog/Dialog.tsx +140 -0
- package/components/primitives/Dialog/index.ts +22 -0
- package/components/primitives/Drawer/Drawer.stories.tsx +327 -0
- package/components/primitives/Drawer/Drawer.tsx +208 -0
- package/components/primitives/Drawer/index.ts +27 -0
- package/components/primitives/DropdownMenu/DropdownMenu.stories.tsx +150 -0
- package/components/primitives/DropdownMenu/DropdownMenu.tsx +73 -0
- package/components/primitives/DropdownMenu/index.ts +1 -0
- package/components/primitives/HoverCard/HoverCard.stories.tsx +26 -0
- package/components/primitives/HoverCard/HoverCard.tsx +39 -0
- package/components/primitives/HoverCard/index.ts +8 -0
- package/components/primitives/Icon/Icon.stories.tsx +281 -0
- package/components/primitives/Icon/Icon.tsx +87 -0
- package/components/primitives/Icon/index.ts +8 -0
- package/components/primitives/Input/Input.stories.tsx +370 -0
- package/components/primitives/Input/Input.tsx +88 -0
- package/components/primitives/Input/index.ts +7 -0
- package/components/primitives/InputGroup/InputGroup.stories.tsx +40 -0
- package/components/primitives/InputGroup/InputGroup.tsx +72 -0
- package/components/primitives/InputGroup/index.ts +14 -0
- package/components/primitives/Label/Label.stories.tsx +227 -0
- package/components/primitives/Label/Label.tsx +53 -0
- package/components/primitives/Label/index.ts +7 -0
- package/components/primitives/Popover/Popover.stories.tsx +42 -0
- package/components/primitives/Popover/Popover.tsx +107 -0
- package/components/primitives/Popover/index.ts +2 -0
- package/components/primitives/Progress/Progress.stories.tsx +340 -0
- package/components/primitives/Progress/Progress.tsx +31 -0
- package/components/primitives/Progress/index.ts +1 -0
- package/components/primitives/ScrollArea/ScrollArea.stories.tsx +26 -0
- package/components/primitives/ScrollArea/ScrollArea.tsx +28 -0
- package/components/primitives/ScrollArea/index.ts +6 -0
- package/components/primitives/Select/Select.stories.tsx +288 -0
- package/components/primitives/Select/Select.tsx +162 -0
- package/components/primitives/Select/index.ts +22 -0
- package/components/primitives/Separator/Separator.stories.tsx +264 -0
- package/components/primitives/Separator/Separator.tsx +48 -0
- package/components/primitives/Separator/index.ts +7 -0
- package/components/primitives/Sidebar/Sidebar.stories.tsx +358 -0
- package/components/primitives/Sidebar/Sidebar.tsx +317 -0
- package/components/primitives/Sidebar/index.ts +41 -0
- package/components/primitives/Table/Table.stories.tsx +389 -0
- package/components/primitives/Table/Table.tsx +191 -0
- package/components/primitives/Table/index.ts +26 -0
- package/components/primitives/Tabs/Tabs.stories.tsx +129 -0
- package/components/primitives/Tabs/Tabs.tsx +70 -0
- package/components/primitives/Tabs/index.ts +13 -0
- package/components/primitives/Textarea/Textarea.stories.tsx +358 -0
- package/components/primitives/Textarea/Textarea.tsx +91 -0
- package/components/primitives/Textarea/index.ts +7 -0
- package/components/primitives/ToggleGroup/ToggleGroup.stories.tsx +87 -0
- package/components/primitives/ToggleGroup/ToggleGroup.tsx +52 -0
- package/components/primitives/ToggleGroup/index.ts +6 -0
- package/components/primitives/Tooltip/Tooltip.stories.tsx +336 -0
- package/components/primitives/Tooltip/Tooltip.tsx +78 -0
- package/components/primitives/Tooltip/index.ts +10 -0
- package/components/primitives/index.ts +34 -0
- package/components/ui/accordion.tsx +66 -0
- package/components/ui/alert-dialog.tsx +157 -0
- package/components/ui/alert.tsx +66 -0
- package/components/ui/avatar.tsx +53 -0
- package/components/ui/badge.tsx +46 -0
- package/components/ui/button.tsx +60 -0
- package/components/ui/card.tsx +117 -0
- package/components/ui/carousel.tsx +241 -0
- package/components/ui/chart.tsx +334 -0
- package/components/ui/checkbox.tsx +32 -0
- package/components/ui/collapsible.tsx +33 -0
- package/components/ui/command.tsx +184 -0
- package/components/ui/dialog.tsx +143 -0
- package/components/ui/drawer.tsx +118 -0
- package/components/ui/dropdown-menu.tsx +257 -0
- package/components/ui/hover-card.tsx +44 -0
- package/components/ui/input-group.tsx +170 -0
- package/components/ui/input.tsx +48 -0
- package/components/ui/label.tsx +26 -0
- package/components/ui/popover.tsx +33 -0
- package/components/ui/progress.tsx +31 -0
- package/components/ui/scroll-area.tsx +58 -0
- package/components/ui/select.tsx +187 -0
- package/components/ui/separator.tsx +31 -0
- package/components/ui/sidebar.tsx +577 -0
- package/components/ui/table.tsx +120 -0
- package/components/ui/tabs.tsx +66 -0
- package/components/ui/textarea.tsx +46 -0
- package/components/ui/toggle-group.tsx +83 -0
- package/components/ui/toggle.tsx +47 -0
- package/components/ui/tooltip.tsx +61 -0
- package/dist/index.cjs +7389 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +75 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +7160 -0
- package/dist/index.js.map +1 -0
- package/hooks/useAIDocReviewer.d.ts +0 -0
- package/lib/utils.ts +6 -0
- package/package.json +140 -0
- package/tokens/color/base.json +14 -0
- package/tokens/color/dark.json +40 -0
- package/tokens/color/green.json +21 -0
- package/tokens/color/light.json +52 -0
- package/tokens/color/neutral.json +20 -0
- package/tokens/color/violet.json +21 -0
- package/tokens/spacing.json +22 -0
- package/utils/ai-editor/format-date.ts +41 -0
- package/utils/ai-editor/index.ts +22 -0
- package/utils/ai-editor/type-guards.ts +72 -0
- package/utils/ai-editor/validation.ts +130 -0
- package/utils/editor-annotations.ts +122 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { AgentIndicator } from './AgentIndicator'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof AgentIndicator> = {
|
|
5
|
+
title: 'Composites/AgentIndicator',
|
|
6
|
+
component: AgentIndicator,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'padded',
|
|
9
|
+
},
|
|
10
|
+
argTypes: {
|
|
11
|
+
onClick: { action: 'clicked' },
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof AgentIndicator>
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof meta>
|
|
17
|
+
|
|
18
|
+
export const Pending: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
subAgent: {
|
|
21
|
+
id: 'agent_1',
|
|
22
|
+
name: 'task',
|
|
23
|
+
subAgentName: 'content_writer',
|
|
24
|
+
input: 'Generate tutorial narration for React hooks',
|
|
25
|
+
status: 'pending',
|
|
26
|
+
},
|
|
27
|
+
isSelected: false,
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const Active: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
subAgent: {
|
|
34
|
+
id: 'agent_2',
|
|
35
|
+
name: 'task',
|
|
36
|
+
subAgentName: 'video_producer',
|
|
37
|
+
input: 'Compile video segments with transitions',
|
|
38
|
+
status: 'active',
|
|
39
|
+
},
|
|
40
|
+
isSelected: false,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const Completed: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
subAgent: {
|
|
47
|
+
id: 'agent_3',
|
|
48
|
+
name: 'task',
|
|
49
|
+
subAgentName: 'project_analyzer',
|
|
50
|
+
input: 'Analyze codebase structure and dependencies',
|
|
51
|
+
output: 'Analysis complete: 15 components, 8 utilities, 3 services',
|
|
52
|
+
status: 'completed',
|
|
53
|
+
},
|
|
54
|
+
isSelected: false,
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const Error: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
subAgent: {
|
|
61
|
+
id: 'agent_4',
|
|
62
|
+
name: 'task',
|
|
63
|
+
subAgentName: 'asset_generator',
|
|
64
|
+
input: 'Generate audio narration from script',
|
|
65
|
+
output: 'Failed: API key invalid',
|
|
66
|
+
status: 'error',
|
|
67
|
+
},
|
|
68
|
+
isSelected: false,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const Selected: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
subAgent: {
|
|
75
|
+
id: 'agent_5',
|
|
76
|
+
name: 'task',
|
|
77
|
+
subAgentName: 'segmentation',
|
|
78
|
+
input: 'Create video timeline with chapter markers',
|
|
79
|
+
output: 'Created 8 segments with timing metadata',
|
|
80
|
+
status: 'completed',
|
|
81
|
+
},
|
|
82
|
+
isSelected: true,
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const LongInput: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
subAgent: {
|
|
89
|
+
id: 'agent_6',
|
|
90
|
+
name: 'task',
|
|
91
|
+
subAgentName: 'use_case_discoverer',
|
|
92
|
+
input:
|
|
93
|
+
'Identify educational use cases for this codebase by analyzing the project structure, reading key files, identifying learning objectives, and generating comprehensive tutorial content that demonstrates best practices.',
|
|
94
|
+
status: 'active',
|
|
95
|
+
},
|
|
96
|
+
isSelected: false,
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const ObjectInput: Story = {
|
|
101
|
+
args: {
|
|
102
|
+
subAgent: {
|
|
103
|
+
id: 'agent_7',
|
|
104
|
+
name: 'task',
|
|
105
|
+
subAgentName: 'coding_tutorial_generator',
|
|
106
|
+
input: {
|
|
107
|
+
project_path: '/app/examples/react-hooks',
|
|
108
|
+
tutorial_type: 'beginner',
|
|
109
|
+
topics: ['useState', 'useEffect', 'custom hooks'],
|
|
110
|
+
duration: 300,
|
|
111
|
+
},
|
|
112
|
+
status: 'pending',
|
|
113
|
+
},
|
|
114
|
+
isSelected: false,
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const MultipleAgents: Story = {
|
|
119
|
+
render: () => (
|
|
120
|
+
<div className="space-y-2 max-w-md">
|
|
121
|
+
<AgentIndicator
|
|
122
|
+
subAgent={{
|
|
123
|
+
id: 'agent_1',
|
|
124
|
+
name: 'task',
|
|
125
|
+
subAgentName: 'project_analyzer',
|
|
126
|
+
input: 'Analyze codebase structure',
|
|
127
|
+
output: 'Analysis complete',
|
|
128
|
+
status: 'completed',
|
|
129
|
+
}}
|
|
130
|
+
isSelected={false}
|
|
131
|
+
/>
|
|
132
|
+
<AgentIndicator
|
|
133
|
+
subAgent={{
|
|
134
|
+
id: 'agent_2',
|
|
135
|
+
name: 'task',
|
|
136
|
+
subAgentName: 'content_writer',
|
|
137
|
+
input: 'Generate narration script',
|
|
138
|
+
status: 'active',
|
|
139
|
+
}}
|
|
140
|
+
isSelected={true}
|
|
141
|
+
/>
|
|
142
|
+
<AgentIndicator
|
|
143
|
+
subAgent={{
|
|
144
|
+
id: 'agent_3',
|
|
145
|
+
name: 'task',
|
|
146
|
+
subAgentName: 'video_producer',
|
|
147
|
+
input: 'Compile final video',
|
|
148
|
+
status: 'pending',
|
|
149
|
+
}}
|
|
150
|
+
isSelected={false}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
),
|
|
154
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Button } from "@/components/primitives/Button"
|
|
3
|
+
import { Badge } from "@/components/primitives/Badge"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AgentIndicator Block
|
|
8
|
+
*
|
|
9
|
+
* A block component that displays agent working status with visual indicators.
|
|
10
|
+
* Copied logic from reference SubAgentIndicator implementation.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export interface SubAgent {
|
|
14
|
+
id: string
|
|
15
|
+
name: string
|
|
16
|
+
subAgentName: string
|
|
17
|
+
input: string | Record<string, unknown>
|
|
18
|
+
output?: string | Record<string, unknown>
|
|
19
|
+
status: "pending" | "active" | "completed" | "error"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AgentIndicatorProps {
|
|
23
|
+
/**
|
|
24
|
+
* Sub-agent data to display
|
|
25
|
+
*/
|
|
26
|
+
subAgent: SubAgent
|
|
27
|
+
/**
|
|
28
|
+
* Click handler for agent selection
|
|
29
|
+
*/
|
|
30
|
+
onClick: () => void
|
|
31
|
+
/**
|
|
32
|
+
* Whether this agent is currently selected
|
|
33
|
+
*/
|
|
34
|
+
isSelected?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* AgentIndicator component - displays agent working status with visual indicators
|
|
39
|
+
*/
|
|
40
|
+
export const AgentIndicator = React.memo<AgentIndicatorProps>(
|
|
41
|
+
({ subAgent, onClick, isSelected = false }) => {
|
|
42
|
+
const getStatusIcon = React.useCallback(() => {
|
|
43
|
+
switch (subAgent.status) {
|
|
44
|
+
case "completed":
|
|
45
|
+
return "✅"
|
|
46
|
+
case "error":
|
|
47
|
+
return "❌"
|
|
48
|
+
case "active":
|
|
49
|
+
return "⚡"
|
|
50
|
+
case "pending":
|
|
51
|
+
default:
|
|
52
|
+
return "⏳"
|
|
53
|
+
}
|
|
54
|
+
}, [subAgent.status])
|
|
55
|
+
|
|
56
|
+
const getStatusVariant = React.useCallback(() => {
|
|
57
|
+
switch (subAgent.status) {
|
|
58
|
+
case "completed":
|
|
59
|
+
return "default" as const
|
|
60
|
+
case "error":
|
|
61
|
+
return "destructive" as const
|
|
62
|
+
case "active":
|
|
63
|
+
return "secondary" as const
|
|
64
|
+
case "pending":
|
|
65
|
+
default:
|
|
66
|
+
return "outline" as const
|
|
67
|
+
}
|
|
68
|
+
}, [subAgent.status])
|
|
69
|
+
|
|
70
|
+
const inputDisplay = React.useMemo(() => {
|
|
71
|
+
return typeof subAgent.input === "string"
|
|
72
|
+
? subAgent.input
|
|
73
|
+
: JSON.stringify(subAgent.input)
|
|
74
|
+
}, [subAgent.input])
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Button
|
|
78
|
+
variant={isSelected ? "default" : "ghost"}
|
|
79
|
+
onClick={onClick}
|
|
80
|
+
className={cn(
|
|
81
|
+
"h-auto p-3 justify-start text-left",
|
|
82
|
+
isSelected && "ring-2 ring-primary"
|
|
83
|
+
)}
|
|
84
|
+
aria-label={`View ${subAgent.subAgentName} details`}
|
|
85
|
+
>
|
|
86
|
+
<div className="flex flex-col items-start gap-2 w-full">
|
|
87
|
+
<div className="flex items-center gap-2">
|
|
88
|
+
<span className="text-sm">{getStatusIcon()}</span>
|
|
89
|
+
<Badge variant={getStatusVariant()} className="text-xs">
|
|
90
|
+
{subAgent.subAgentName}
|
|
91
|
+
</Badge>
|
|
92
|
+
</div>
|
|
93
|
+
<p className="text-xs text-muted-foreground text-left line-clamp-2">
|
|
94
|
+
{inputDisplay}
|
|
95
|
+
</p>
|
|
96
|
+
</div>
|
|
97
|
+
</Button>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
AgentIndicator.displayName = "AgentIndicator"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { AppHeader } from './AppHeader'
|
|
3
|
+
import { Button } from '@/components/primitives/Button'
|
|
4
|
+
import { SidebarProvider, Sidebar, SidebarInset } from '@/components/primitives/Sidebar'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Composites/AppHeader',
|
|
8
|
+
component: AppHeader,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: { layout: 'fullscreen' },
|
|
11
|
+
} satisfies Meta<typeof AppHeader>
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
type Story = StoryObj<typeof meta>
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<SidebarProvider>
|
|
19
|
+
<Sidebar />
|
|
20
|
+
<SidebarInset>
|
|
21
|
+
<AppHeader title="Dashboard" />
|
|
22
|
+
</SidebarInset>
|
|
23
|
+
</SidebarProvider>
|
|
24
|
+
),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const WithActions: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<SidebarProvider>
|
|
30
|
+
<Sidebar />
|
|
31
|
+
<SidebarInset>
|
|
32
|
+
<AppHeader
|
|
33
|
+
title="Dashboard"
|
|
34
|
+
actions={
|
|
35
|
+
<>
|
|
36
|
+
<Button variant="outline" size="sm">
|
|
37
|
+
Export
|
|
38
|
+
</Button>
|
|
39
|
+
<Button size="sm">New Item</Button>
|
|
40
|
+
</>
|
|
41
|
+
}
|
|
42
|
+
/>
|
|
43
|
+
</SidebarInset>
|
|
44
|
+
</SidebarProvider>
|
|
45
|
+
),
|
|
46
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { SidebarTrigger } from "@/components/primitives/Sidebar"
|
|
3
|
+
import { Separator } from "@/components/primitives/Separator"
|
|
4
|
+
|
|
5
|
+
export interface AppHeaderProps {
|
|
6
|
+
title?: string
|
|
7
|
+
actions?: React.ReactNode
|
|
8
|
+
className?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const AppHeader = React.memo<AppHeaderProps>(({ title, actions, className }) => {
|
|
12
|
+
return (
|
|
13
|
+
<header className={`flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-14 ${className || ""}`}>
|
|
14
|
+
<div className="flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6">
|
|
15
|
+
<SidebarTrigger className="-ml-1" />
|
|
16
|
+
<Separator orientation="vertical" className="mx-2 data-[orientation=vertical]:h-4" />
|
|
17
|
+
{title && <h1 className="text-base font-medium">{title}</h1>}
|
|
18
|
+
<div className="ml-auto flex items-center gap-2">{actions}</div>
|
|
19
|
+
</div>
|
|
20
|
+
</header>
|
|
21
|
+
)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
AppHeader.displayName = "AppHeader"
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommentBox Stories
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates the CommentBox component with various annotation types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
8
|
+
import type { JSONContent } from '@tiptap/core'
|
|
9
|
+
import { CommentBox } from './CommentBox'
|
|
10
|
+
import type { CommentBoxProps, Annotation } from '@/types/ai-editor'
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof CommentBox> = {
|
|
13
|
+
title: 'Composites/CommentBox',
|
|
14
|
+
component: CommentBox,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: 'centered',
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
type Story = StoryObj<typeof CommentBox>
|
|
23
|
+
|
|
24
|
+
// Sample comment annotation
|
|
25
|
+
const commentAnnotation: Annotation = {
|
|
26
|
+
type: 'comment',
|
|
27
|
+
id: 'comment-1',
|
|
28
|
+
range: { from: 0, to: 10 },
|
|
29
|
+
createdAt: Date.now() - 2 * 60 * 60 * 1000, // 2 hours ago
|
|
30
|
+
userId: 'user-1',
|
|
31
|
+
data: {
|
|
32
|
+
thread: [
|
|
33
|
+
{
|
|
34
|
+
id: 'thread-1',
|
|
35
|
+
userId: 'user-1',
|
|
36
|
+
userName: 'John Doe',
|
|
37
|
+
contentRich: {
|
|
38
|
+
type: 'doc',
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: 'paragraph',
|
|
42
|
+
content: [{ type: 'text', text: 'This section needs clarification.' }],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
timestamp: Date.now() - 2 * 60 * 60 * 1000,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'thread-2',
|
|
50
|
+
userId: 'user-2',
|
|
51
|
+
userName: 'Jane Smith',
|
|
52
|
+
contentRich: {
|
|
53
|
+
type: 'doc',
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'paragraph',
|
|
57
|
+
content: [{ type: 'text', text: 'I agree, let me add more details.' }],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
timestamp: Date.now() - 1 * 60 * 60 * 1000,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Sample suggestion annotation
|
|
68
|
+
const suggestionAnnotation: Annotation = {
|
|
69
|
+
type: 'suggestion',
|
|
70
|
+
id: 'suggestion-1',
|
|
71
|
+
range: { from: 0, to: 20 },
|
|
72
|
+
createdAt: Date.now() - 30 * 60 * 1000, // 30 minutes ago
|
|
73
|
+
userId: 'ai-1',
|
|
74
|
+
data: {
|
|
75
|
+
action: 'modify',
|
|
76
|
+
oldText: 'some has suggestions',
|
|
77
|
+
newText: 'others have AI suggestions',
|
|
78
|
+
reason: 'More descriptive wording',
|
|
79
|
+
thread: [
|
|
80
|
+
{
|
|
81
|
+
id: 'thread-3',
|
|
82
|
+
userId: 'user-1',
|
|
83
|
+
userName: 'John Doe',
|
|
84
|
+
contentRich: {
|
|
85
|
+
type: 'doc',
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: 'paragraph',
|
|
89
|
+
content: [{ type: 'text', text: 'Good suggestion!' }],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
timestamp: Date.now() - 15 * 60 * 1000,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Sample block addition annotation
|
|
100
|
+
const blockAdditionAnnotation: Annotation = {
|
|
101
|
+
type: 'block-addition',
|
|
102
|
+
id: 'addition-1',
|
|
103
|
+
range: { from: 0, to: 0 },
|
|
104
|
+
createdAt: Date.now() - 10 * 60 * 1000, // 10 minutes ago
|
|
105
|
+
userId: 'ai-1',
|
|
106
|
+
data: {
|
|
107
|
+
content: {
|
|
108
|
+
type: 'doc',
|
|
109
|
+
content: [
|
|
110
|
+
{
|
|
111
|
+
type: 'paragraph',
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: 'text',
|
|
115
|
+
text: 'This is a new paragraph suggested by AI.',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
reason: 'Adding context for better understanding',
|
|
122
|
+
thread: [],
|
|
123
|
+
},
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* New comment box (no annotation)
|
|
128
|
+
*/
|
|
129
|
+
export const NewComment: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
annotation: undefined,
|
|
132
|
+
position: { x: 100, y: 100 },
|
|
133
|
+
visible: true,
|
|
134
|
+
currentUserId: 'user-1',
|
|
135
|
+
onClose: () => console.log('Close'),
|
|
136
|
+
onCommentAdd: (content) => console.log('Add comment:', content),
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Existing comment with thread
|
|
142
|
+
*/
|
|
143
|
+
export const ExistingComment: Story = {
|
|
144
|
+
args: {
|
|
145
|
+
annotation: commentAnnotation,
|
|
146
|
+
position: { x: 100, y: 100 },
|
|
147
|
+
visible: true,
|
|
148
|
+
currentUserId: 'user-1',
|
|
149
|
+
onClose: () => console.log('Close'),
|
|
150
|
+
onCommentReply: (id, content) => console.log('Reply to:', id, content),
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Suggestion with diff display
|
|
156
|
+
*/
|
|
157
|
+
export const SuggestionWithDiff: Story = {
|
|
158
|
+
args: {
|
|
159
|
+
annotation: suggestionAnnotation,
|
|
160
|
+
position: { x: 100, y: 100 },
|
|
161
|
+
visible: true,
|
|
162
|
+
currentUserId: 'user-1',
|
|
163
|
+
onClose: () => console.log('Close'),
|
|
164
|
+
onCommentReply: (id, content) => console.log('Reply to:', id, content),
|
|
165
|
+
},
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Block addition
|
|
170
|
+
*/
|
|
171
|
+
export const BlockAddition: Story = {
|
|
172
|
+
args: {
|
|
173
|
+
annotation: blockAdditionAnnotation,
|
|
174
|
+
position: { x: 100, y: 100 },
|
|
175
|
+
visible: true,
|
|
176
|
+
currentUserId: 'user-1',
|
|
177
|
+
onClose: () => console.log('Close'),
|
|
178
|
+
onCommentReply: (id, content) => console.log('Reply to:', id, content),
|
|
179
|
+
},
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Hidden state
|
|
184
|
+
*/
|
|
185
|
+
export const Hidden: Story = {
|
|
186
|
+
args: {
|
|
187
|
+
annotation: commentAnnotation,
|
|
188
|
+
position: { x: 100, y: 100 },
|
|
189
|
+
visible: false,
|
|
190
|
+
currentUserId: 'user-1',
|
|
191
|
+
},
|
|
192
|
+
}
|