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,286 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { SpecialistMessage } from './SpecialistMessage'
|
|
3
|
+
import { FileText, Search, BarChart, CheckCircle } from 'lucide-react'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof SpecialistMessage> = {
|
|
6
|
+
title: 'Composites/SpecialistMessage',
|
|
7
|
+
component: SpecialistMessage,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'padded',
|
|
10
|
+
},
|
|
11
|
+
} satisfies Meta<typeof SpecialistMessage>
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
type Story = StoryObj<typeof meta>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Default state - always expanded, no collapse trigger
|
|
18
|
+
*/
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
message: {
|
|
22
|
+
id: '1',
|
|
23
|
+
name: 'research-agent',
|
|
24
|
+
description: 'Conducting research on the requested topic',
|
|
25
|
+
icon: <Search className="size-4" />,
|
|
26
|
+
content: 'I conducted extensive research on the requested topic. Here are my findings: The analysis shows significant trends in the data, with key patterns emerging across multiple dimensions. I recommend proceeding with the proposed approach based on these insights.',
|
|
27
|
+
status: 'completed',
|
|
28
|
+
},
|
|
29
|
+
collapsible: false,
|
|
30
|
+
isNested: false,
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* With description summary - shows in header
|
|
36
|
+
*/
|
|
37
|
+
export const WithDescription: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
message: {
|
|
40
|
+
id: '2',
|
|
41
|
+
name: 'analysis-agent',
|
|
42
|
+
description: 'Analyzing data and generating insights',
|
|
43
|
+
icon: <BarChart className="size-4" />,
|
|
44
|
+
content: 'I analyzed the data and generated comprehensive insights. Here are the key findings from my research that you should consider for the next steps in the implementation process.',
|
|
45
|
+
status: 'completed',
|
|
46
|
+
},
|
|
47
|
+
collapsible: false,
|
|
48
|
+
isNested: false,
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* With tool calls displayed inline
|
|
54
|
+
*/
|
|
55
|
+
export const WithToolCalls: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
message: {
|
|
58
|
+
id: '3',
|
|
59
|
+
name: 'file-agent',
|
|
60
|
+
description: 'Processing files and generating reports',
|
|
61
|
+
icon: <FileText className="size-4" />,
|
|
62
|
+
content: 'I processed the files and generated a comprehensive report. The analysis includes data from multiple sources and provides actionable recommendations.',
|
|
63
|
+
status: 'completed',
|
|
64
|
+
toolCalls: [
|
|
65
|
+
{
|
|
66
|
+
id: 'tool_1',
|
|
67
|
+
name: 'write_file',
|
|
68
|
+
args: { filename: 'report.md', content: 'Analysis results...' },
|
|
69
|
+
result: 'File created successfully at /workspace/report.md',
|
|
70
|
+
status: 'completed',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'tool_2',
|
|
74
|
+
name: 'read_file',
|
|
75
|
+
args: { filename: 'data.json' },
|
|
76
|
+
result: '{"records": 150, "status": "processed", "timestamp": "2024-01-15T10:30:00Z"}',
|
|
77
|
+
status: 'completed',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'tool_3',
|
|
81
|
+
name: 'analyze_data',
|
|
82
|
+
args: { dataset: 'sales_data.csv' },
|
|
83
|
+
result: 'Analysis complete. Found 5 key trends and 12 anomalies requiring attention.',
|
|
84
|
+
status: 'completed',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
collapsible: false,
|
|
89
|
+
isNested: false,
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Collapsible variant - collapsed by default with trigger
|
|
95
|
+
*/
|
|
96
|
+
export const CollapsibleCollapsed: Story = {
|
|
97
|
+
args: {
|
|
98
|
+
message: {
|
|
99
|
+
id: '4',
|
|
100
|
+
name: 'documentation-agent',
|
|
101
|
+
description: "Comprehensive review of codebase documentation completed",
|
|
102
|
+
icon: <FileText className="size-4" />,
|
|
103
|
+
content: `I've completed a comprehensive review of the codebase documentation.
|
|
104
|
+
|
|
105
|
+
Here's what I found:
|
|
106
|
+
|
|
107
|
+
## Current State
|
|
108
|
+
The documentation covers most of the core features but lacks detailed examples in several key areas. The API reference is well-structured but could benefit from more usage scenarios.
|
|
109
|
+
|
|
110
|
+
## Recommendations
|
|
111
|
+
1. Add interactive code examples for each major feature
|
|
112
|
+
2. Include troubleshooting guides for common issues
|
|
113
|
+
3. Expand the getting started tutorial with real-world use cases
|
|
114
|
+
4. Add architecture diagrams to explain system components
|
|
115
|
+
5. Document best practices and anti-patterns
|
|
116
|
+
|
|
117
|
+
## Implementation Plan
|
|
118
|
+
I suggest prioritizing the API documentation updates first, followed by the tutorial enhancements. This approach will provide immediate value to new users while setting the foundation for more advanced documentation.
|
|
119
|
+
|
|
120
|
+
The estimated effort is 2-3 weeks with a dedicated technical writer, or 4-5 weeks if handled by the engineering team alongside development work.`,
|
|
121
|
+
status: 'completed',
|
|
122
|
+
},
|
|
123
|
+
collapsible: true,
|
|
124
|
+
defaultOpen: false,
|
|
125
|
+
isNested: false,
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Collapsible variant - expanded by default with trigger
|
|
131
|
+
*/
|
|
132
|
+
export const CollapsibleExpanded: Story = {
|
|
133
|
+
args: {
|
|
134
|
+
message: {
|
|
135
|
+
id: '5',
|
|
136
|
+
name: 'planning-agent',
|
|
137
|
+
description: 'Creating detailed implementation plan with timeline',
|
|
138
|
+
icon: <CheckCircle className="size-4" />,
|
|
139
|
+
content: 'I created a detailed implementation plan with timeline and resource allocation. The plan includes 5 phases over 6 months with clear milestones and success criteria for each phase.',
|
|
140
|
+
status: 'completed',
|
|
141
|
+
},
|
|
142
|
+
collapsible: true,
|
|
143
|
+
defaultOpen: true,
|
|
144
|
+
isNested: false,
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Nested under orchestrator - indented with left margin
|
|
150
|
+
*/
|
|
151
|
+
export const Nested: Story = {
|
|
152
|
+
args: {
|
|
153
|
+
message: {
|
|
154
|
+
id: '6',
|
|
155
|
+
name: 'sub-agent',
|
|
156
|
+
description: 'Working on delegated sub-task',
|
|
157
|
+
content: 'This specialist message is nested under an orchestrator. Notice the left indentation indicating the hierarchical relationship.',
|
|
158
|
+
status: 'completed',
|
|
159
|
+
},
|
|
160
|
+
collapsible: false,
|
|
161
|
+
isNested: true,
|
|
162
|
+
},
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Without description - only title in header
|
|
167
|
+
*/
|
|
168
|
+
export const WithoutDescription: Story = {
|
|
169
|
+
args: {
|
|
170
|
+
message: {
|
|
171
|
+
id: '7',
|
|
172
|
+
name: 'quick-agent',
|
|
173
|
+
content: 'Task completed successfully with no additional details needed.',
|
|
174
|
+
status: 'completed',
|
|
175
|
+
},
|
|
176
|
+
collapsible: false,
|
|
177
|
+
isNested: false,
|
|
178
|
+
},
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Multiple specialists - default always-expanded style
|
|
183
|
+
*/
|
|
184
|
+
export const MultipleSpecialistsExpanded: Story = {
|
|
185
|
+
render: () => (
|
|
186
|
+
<div className="space-y-4">
|
|
187
|
+
<SpecialistMessage
|
|
188
|
+
message={{
|
|
189
|
+
id: '1',
|
|
190
|
+
name: 'research-agent',
|
|
191
|
+
description: 'Gathering relevant information from multiple sources',
|
|
192
|
+
icon: <Search className="size-4" />,
|
|
193
|
+
content: 'I researched the topic and gathered relevant information from multiple sources. The findings indicate strong market demand and favorable conditions for implementation.',
|
|
194
|
+
status: 'completed',
|
|
195
|
+
}}
|
|
196
|
+
collapsible={false}
|
|
197
|
+
/>
|
|
198
|
+
<SpecialistMessage
|
|
199
|
+
message={{
|
|
200
|
+
id: '2',
|
|
201
|
+
name: 'analysis-agent',
|
|
202
|
+
description: 'Performing comprehensive analysis on research data',
|
|
203
|
+
icon: <BarChart className="size-4" />,
|
|
204
|
+
content: 'Based on the research data, I performed a comprehensive analysis. The results show three key opportunities and two potential risks that should be addressed in the planning phase.',
|
|
205
|
+
status: 'completed',
|
|
206
|
+
toolCalls: [
|
|
207
|
+
{
|
|
208
|
+
id: 'tool_1',
|
|
209
|
+
name: 'analyze_market_data',
|
|
210
|
+
args: { dataset: 'market_trends.csv' },
|
|
211
|
+
result: 'Analysis complete. Market growth rate: 15% annually.',
|
|
212
|
+
status: 'completed',
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
}}
|
|
216
|
+
collapsible={false}
|
|
217
|
+
/>
|
|
218
|
+
<SpecialistMessage
|
|
219
|
+
message={{
|
|
220
|
+
id: '3',
|
|
221
|
+
name: 'planning-agent',
|
|
222
|
+
description: 'Creating implementation roadmap',
|
|
223
|
+
icon: <CheckCircle className="size-4" />,
|
|
224
|
+
content: 'I created a detailed implementation plan with timeline and resource allocation. The plan includes 5 phases over 6 months with clear milestones and success criteria.',
|
|
225
|
+
status: 'completed',
|
|
226
|
+
}}
|
|
227
|
+
collapsible={false}
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
),
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Multiple specialists - collapsible for space efficiency
|
|
235
|
+
*/
|
|
236
|
+
export const MultipleSpecialistsCollapsible: Story = {
|
|
237
|
+
render: () => (
|
|
238
|
+
<div className="space-y-4">
|
|
239
|
+
<SpecialistMessage
|
|
240
|
+
message={{
|
|
241
|
+
id: '1',
|
|
242
|
+
name: 'research-agent',
|
|
243
|
+
description: 'Gathering relevant information from multiple sources',
|
|
244
|
+
icon: <Search className="size-4" />,
|
|
245
|
+
content: 'I researched the topic and gathered relevant information from multiple sources. The findings indicate strong market demand and favorable conditions for implementation.',
|
|
246
|
+
status: 'completed',
|
|
247
|
+
}}
|
|
248
|
+
collapsible={true}
|
|
249
|
+
defaultOpen={false}
|
|
250
|
+
/>
|
|
251
|
+
<SpecialistMessage
|
|
252
|
+
message={{
|
|
253
|
+
id: '2',
|
|
254
|
+
name: 'analysis-agent',
|
|
255
|
+
description: 'Performing comprehensive analysis on research data',
|
|
256
|
+
icon: <BarChart className="size-4" />,
|
|
257
|
+
content: 'Based on the research data, I performed a comprehensive analysis. The results show three key opportunities and two potential risks that should be addressed in the planning phase.',
|
|
258
|
+
status: 'completed',
|
|
259
|
+
toolCalls: [
|
|
260
|
+
{
|
|
261
|
+
id: 'tool_1',
|
|
262
|
+
name: 'analyze_market_data',
|
|
263
|
+
args: { dataset: 'market_trends.csv' },
|
|
264
|
+
result: 'Analysis complete. Market growth rate: 15% annually.',
|
|
265
|
+
status: 'completed',
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
}}
|
|
269
|
+
collapsible={true}
|
|
270
|
+
defaultOpen={false}
|
|
271
|
+
/>
|
|
272
|
+
<SpecialistMessage
|
|
273
|
+
message={{
|
|
274
|
+
id: '3',
|
|
275
|
+
name: 'planning-agent',
|
|
276
|
+
description: 'Creating implementation roadmap',
|
|
277
|
+
icon: <CheckCircle className="size-4" />,
|
|
278
|
+
content: 'I created a detailed implementation plan with timeline and resource allocation. The plan includes 5 phases over 6 months with clear milestones and success criteria.',
|
|
279
|
+
status: 'completed',
|
|
280
|
+
}}
|
|
281
|
+
collapsible={true}
|
|
282
|
+
defaultOpen={false}
|
|
283
|
+
/>
|
|
284
|
+
</div>
|
|
285
|
+
),
|
|
286
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
Plan,
|
|
4
|
+
PlanHeader,
|
|
5
|
+
PlanTitle,
|
|
6
|
+
PlanDescription,
|
|
7
|
+
PlanTrigger,
|
|
8
|
+
PlanContent,
|
|
9
|
+
} from "@/components/ai-elements/plan"
|
|
10
|
+
import { ToolCallDisplay, type ToolCall } from "@/components/composites/ToolCallDisplay"
|
|
11
|
+
import { cn } from "@/lib/utils"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* SpecialistMessage Block
|
|
15
|
+
*
|
|
16
|
+
* A block component for displaying specialist agent messages with optional collapsible content.
|
|
17
|
+
* Uses Plan AI element for consistent styling and optional space-efficient display.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export interface SpecialistMessageData {
|
|
21
|
+
id: string
|
|
22
|
+
name: string
|
|
23
|
+
description?: string
|
|
24
|
+
icon?: React.ReactNode
|
|
25
|
+
content: string
|
|
26
|
+
toolCalls?: ToolCall[]
|
|
27
|
+
status: "pending" | "active" | "completed" | "error"
|
|
28
|
+
avatarSrc?: string
|
|
29
|
+
avatarName?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SpecialistMessageProps {
|
|
33
|
+
/**
|
|
34
|
+
* Specialist message data to display
|
|
35
|
+
*/
|
|
36
|
+
message: SpecialistMessageData
|
|
37
|
+
/**
|
|
38
|
+
* Whether this message is nested under an orchestrator
|
|
39
|
+
*/
|
|
40
|
+
isNested?: boolean
|
|
41
|
+
/**
|
|
42
|
+
* Whether the specialist message should be open by default
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
defaultOpen?: boolean
|
|
46
|
+
/**
|
|
47
|
+
* Whether to show collapse/expand trigger
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
collapsible?: boolean
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* SpecialistMessage component - displays specialist agent messages with optional collapsible content
|
|
55
|
+
*/
|
|
56
|
+
export const SpecialistMessage = React.memo<SpecialistMessageProps>(
|
|
57
|
+
({ message, isNested = false, defaultOpen = false, collapsible = true }) => {
|
|
58
|
+
const hasContent = React.useMemo(
|
|
59
|
+
() => message.content && message.content.trim() !== "",
|
|
60
|
+
[message.content]
|
|
61
|
+
)
|
|
62
|
+
const hasToolCalls = React.useMemo(
|
|
63
|
+
() => message.toolCalls !== undefined && message.toolCalls.length > 0,
|
|
64
|
+
[message.toolCalls]
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Plan
|
|
69
|
+
defaultOpen={collapsible ? defaultOpen : true}
|
|
70
|
+
className={cn(isNested && "ml-8")}
|
|
71
|
+
>
|
|
72
|
+
<PlanHeader>
|
|
73
|
+
<div>
|
|
74
|
+
<div className="mb-4 flex items-center gap-2">
|
|
75
|
+
{message.icon && message.icon}
|
|
76
|
+
<PlanTitle>{message.name}</PlanTitle>
|
|
77
|
+
</div>
|
|
78
|
+
{message.description && (
|
|
79
|
+
<PlanDescription>{message.description}</PlanDescription>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
{collapsible && <PlanTrigger />}
|
|
83
|
+
</PlanHeader>
|
|
84
|
+
|
|
85
|
+
<PlanContent>
|
|
86
|
+
{/* Message content */}
|
|
87
|
+
{hasContent && (
|
|
88
|
+
<div className="prose prose-sm dark:prose-invert max-w-none">
|
|
89
|
+
{message.content}
|
|
90
|
+
</div>
|
|
91
|
+
)}
|
|
92
|
+
|
|
93
|
+
{/* Tool calls */}
|
|
94
|
+
{hasToolCalls && (
|
|
95
|
+
<div className={cn("space-y-2", hasContent && "mt-4")}>
|
|
96
|
+
{message.toolCalls!.map((toolCall: ToolCall) => (
|
|
97
|
+
<ToolCallDisplay key={toolCall.id} toolCall={toolCall} />
|
|
98
|
+
))}
|
|
99
|
+
</div>
|
|
100
|
+
)}
|
|
101
|
+
</PlanContent>
|
|
102
|
+
</Plan>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
SpecialistMessage.displayName = "SpecialistMessage"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SpecialistMessage Block
|
|
3
|
+
*
|
|
4
|
+
* Central export point for the SpecialistMessage block component and its related types.
|
|
5
|
+
*/
|
|
6
|
+
export { SpecialistMessage } from './SpecialistMessage'
|
|
7
|
+
|
|
8
|
+
export type { SpecialistMessageProps, SpecialistMessageData } from './SpecialistMessage'
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { StatsCard } from './StatsCard'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Composites/StatsCard',
|
|
6
|
+
component: StatsCard,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story) => (
|
|
13
|
+
<div className="w-[300px]">
|
|
14
|
+
<Story />
|
|
15
|
+
</div>
|
|
16
|
+
),
|
|
17
|
+
],
|
|
18
|
+
} satisfies Meta<typeof StatsCard>
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof meta>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
title: 'Total Revenue',
|
|
26
|
+
value: '$1,250.00',
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const WithTrendUp: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
title: 'Total Revenue',
|
|
33
|
+
value: '$1,250.00',
|
|
34
|
+
trend: { direction: 'up', value: '+12.5%' },
|
|
35
|
+
footer: {
|
|
36
|
+
message: 'Trending up this month',
|
|
37
|
+
description: 'Visitors for the last 6 months',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const WithTrendDown: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
title: 'New Customers',
|
|
45
|
+
value: '1,234',
|
|
46
|
+
trend: { direction: 'down', value: '-20%' },
|
|
47
|
+
footer: {
|
|
48
|
+
message: 'Down 20% this period',
|
|
49
|
+
description: 'Acquisition needs attention',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const Complete: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
title: 'Active Accounts',
|
|
57
|
+
value: '45,678',
|
|
58
|
+
trend: { direction: 'up', value: '+12.5%' },
|
|
59
|
+
footer: {
|
|
60
|
+
message: 'Strong user retention',
|
|
61
|
+
description: 'Engagement exceed targets',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const GrowthRate: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
title: 'Growth Rate',
|
|
69
|
+
value: '4.5%',
|
|
70
|
+
trend: { direction: 'up', value: '+4.5%' },
|
|
71
|
+
footer: {
|
|
72
|
+
message: 'Steady performance increase',
|
|
73
|
+
description: 'Meets growth projections',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
Card,
|
|
4
|
+
CardHeader,
|
|
5
|
+
CardTitle,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardAction,
|
|
8
|
+
CardFooter,
|
|
9
|
+
} from "@/components/primitives/Card"
|
|
10
|
+
import { Badge } from "@/components/primitives/Badge"
|
|
11
|
+
import { Icon } from "@/components/primitives/Icon"
|
|
12
|
+
|
|
13
|
+
export interface StatsCardProps {
|
|
14
|
+
/**
|
|
15
|
+
* Card title (e.g., "Total Revenue")
|
|
16
|
+
*/
|
|
17
|
+
title: string
|
|
18
|
+
/**
|
|
19
|
+
* Main value to display (e.g., "$1,250.00")
|
|
20
|
+
*/
|
|
21
|
+
value: string | number
|
|
22
|
+
/**
|
|
23
|
+
* Trend indicator with direction and percentage
|
|
24
|
+
*/
|
|
25
|
+
trend?: {
|
|
26
|
+
direction: "up" | "down"
|
|
27
|
+
value: string
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Footer content with primary message and secondary description
|
|
31
|
+
*/
|
|
32
|
+
footer?: {
|
|
33
|
+
message: string
|
|
34
|
+
description: string
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Additional CSS classes
|
|
38
|
+
*/
|
|
39
|
+
className?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const StatsCard = React.memo<StatsCardProps>(
|
|
43
|
+
({ title, value, trend, footer, className }) => {
|
|
44
|
+
return (
|
|
45
|
+
<Card className={className}>
|
|
46
|
+
<CardHeader>
|
|
47
|
+
<CardDescription>{title}</CardDescription>
|
|
48
|
+
<CardTitle className="text-2xl font-semibold tabular-nums @[250px]/card:text-3xl">
|
|
49
|
+
{value}
|
|
50
|
+
</CardTitle>
|
|
51
|
+
{trend && (
|
|
52
|
+
<CardAction>
|
|
53
|
+
<Badge variant="outline">
|
|
54
|
+
<Icon
|
|
55
|
+
name={trend.direction === "up" ? "trending-up" : "trending-down"}
|
|
56
|
+
/>
|
|
57
|
+
{trend.value}
|
|
58
|
+
</Badge>
|
|
59
|
+
</CardAction>
|
|
60
|
+
)}
|
|
61
|
+
</CardHeader>
|
|
62
|
+
{footer && (
|
|
63
|
+
<CardFooter className="flex-col items-start gap-1.5 text-sm">
|
|
64
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
65
|
+
<span>{footer.message}</span>
|
|
66
|
+
{trend && (
|
|
67
|
+
<Icon
|
|
68
|
+
name={trend.direction === "up" ? "trending-up" : "trending-down"}
|
|
69
|
+
className="size-4"
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
<div className="text-muted-foreground">{footer.description}</div>
|
|
74
|
+
</CardFooter>
|
|
75
|
+
)}
|
|
76
|
+
</Card>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
StatsCard.displayName = "StatsCard"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { TablePagination } from './TablePagination'
|
|
3
|
+
import {
|
|
4
|
+
useReactTable,
|
|
5
|
+
getCoreRowModel,
|
|
6
|
+
getPaginationRowModel,
|
|
7
|
+
getFilteredRowModel,
|
|
8
|
+
} from '@tanstack/react-table'
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
title: 'Composites/TablePagination',
|
|
12
|
+
component: TablePagination,
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'padded',
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof TablePagination>
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof meta>
|
|
21
|
+
|
|
22
|
+
const data = Array.from({ length: 100 }, (_, i) => ({
|
|
23
|
+
id: i + 1,
|
|
24
|
+
name: `Item ${i + 1}`,
|
|
25
|
+
}))
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
render: () => {
|
|
29
|
+
const table = useReactTable({
|
|
30
|
+
data,
|
|
31
|
+
columns: [{ accessorKey: 'name', header: 'Name' }],
|
|
32
|
+
getCoreRowModel: getCoreRowModel(),
|
|
33
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
34
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
35
|
+
})
|
|
36
|
+
return <TablePagination table={table} />
|
|
37
|
+
},
|
|
38
|
+
}
|