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,422 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Alert, AlertDescription, AlertTitle } from "./Alert";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Alert component displays important messages to users.
|
|
6
|
+
*
|
|
7
|
+
* ## Features
|
|
8
|
+
* - Variant support (default, destructive)
|
|
9
|
+
* - Optional icon support
|
|
10
|
+
* - Title and description sections
|
|
11
|
+
* - Semantic HTML with role="alert"
|
|
12
|
+
* - Screen reader accessible
|
|
13
|
+
* - WCAG 2.1 Level AA compliant
|
|
14
|
+
*
|
|
15
|
+
* ## Usage
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Alert>
|
|
18
|
+
* <AlertTitle>Heads up!</AlertTitle>
|
|
19
|
+
* <AlertDescription>
|
|
20
|
+
* You can add components to your app using the cli.
|
|
21
|
+
* </AlertDescription>
|
|
22
|
+
* </Alert>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* ## Accessibility
|
|
26
|
+
* - Uses role="alert" for screen readers
|
|
27
|
+
* - Proper semantic structure
|
|
28
|
+
* - Color is not the only indicator (uses icons and text)
|
|
29
|
+
*/
|
|
30
|
+
const meta: Meta<typeof Alert> = {
|
|
31
|
+
title: "Primitives/Alert",
|
|
32
|
+
component: Alert,
|
|
33
|
+
parameters: {
|
|
34
|
+
layout: "centered",
|
|
35
|
+
docs: {
|
|
36
|
+
description: {
|
|
37
|
+
component: "Displays a callout for user attention.",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
tags: ["autodocs"],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default meta;
|
|
45
|
+
type Story = StoryObj<typeof Alert>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Default alert
|
|
49
|
+
*/
|
|
50
|
+
export const Default: Story = {
|
|
51
|
+
render: () => (
|
|
52
|
+
<Alert className="w-[400px]">
|
|
53
|
+
<AlertTitle>Heads up!</AlertTitle>
|
|
54
|
+
<AlertDescription>
|
|
55
|
+
You can add components to your app using the cli.
|
|
56
|
+
</AlertDescription>
|
|
57
|
+
</Alert>
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Destructive variant for errors
|
|
63
|
+
*/
|
|
64
|
+
export const Destructive: Story = {
|
|
65
|
+
render: () => (
|
|
66
|
+
<Alert variant="destructive" className="w-[400px]">
|
|
67
|
+
<AlertTitle>Error</AlertTitle>
|
|
68
|
+
<AlertDescription>
|
|
69
|
+
Your session has expired. Please log in again.
|
|
70
|
+
</AlertDescription>
|
|
71
|
+
</Alert>
|
|
72
|
+
),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Alert with icon
|
|
77
|
+
*/
|
|
78
|
+
export const WithIcon: Story = {
|
|
79
|
+
render: () => (
|
|
80
|
+
<Alert className="w-[400px]">
|
|
81
|
+
<svg
|
|
82
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
83
|
+
width="16"
|
|
84
|
+
height="16"
|
|
85
|
+
viewBox="0 0 24 24"
|
|
86
|
+
fill="none"
|
|
87
|
+
stroke="currentColor"
|
|
88
|
+
strokeWidth="2"
|
|
89
|
+
strokeLinecap="round"
|
|
90
|
+
strokeLinejoin="round"
|
|
91
|
+
>
|
|
92
|
+
<circle cx="12" cy="12" r="10" />
|
|
93
|
+
<path d="M12 16v-4" />
|
|
94
|
+
<path d="M12 8h.01" />
|
|
95
|
+
</svg>
|
|
96
|
+
<AlertTitle>Information</AlertTitle>
|
|
97
|
+
<AlertDescription>
|
|
98
|
+
Your changes have been saved successfully.
|
|
99
|
+
</AlertDescription>
|
|
100
|
+
</Alert>
|
|
101
|
+
),
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Destructive alert with icon
|
|
106
|
+
*/
|
|
107
|
+
export const DestructiveWithIcon: Story = {
|
|
108
|
+
render: () => (
|
|
109
|
+
<Alert variant="destructive" className="w-[400px]">
|
|
110
|
+
<svg
|
|
111
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
112
|
+
width="16"
|
|
113
|
+
height="16"
|
|
114
|
+
viewBox="0 0 24 24"
|
|
115
|
+
fill="none"
|
|
116
|
+
stroke="currentColor"
|
|
117
|
+
strokeWidth="2"
|
|
118
|
+
strokeLinecap="round"
|
|
119
|
+
strokeLinejoin="round"
|
|
120
|
+
>
|
|
121
|
+
<circle cx="12" cy="12" r="10" />
|
|
122
|
+
<path d="m15 9-6 6" />
|
|
123
|
+
<path d="m9 9 6 6" />
|
|
124
|
+
</svg>
|
|
125
|
+
<AlertTitle>Error</AlertTitle>
|
|
126
|
+
<AlertDescription>
|
|
127
|
+
Failed to upload file. Please check your internet connection and try again.
|
|
128
|
+
</AlertDescription>
|
|
129
|
+
</Alert>
|
|
130
|
+
),
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Title only
|
|
135
|
+
*/
|
|
136
|
+
export const TitleOnly: Story = {
|
|
137
|
+
render: () => (
|
|
138
|
+
<Alert className="w-[400px]">
|
|
139
|
+
<AlertTitle>Update available</AlertTitle>
|
|
140
|
+
</Alert>
|
|
141
|
+
),
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Description only
|
|
146
|
+
*/
|
|
147
|
+
export const DescriptionOnly: Story = {
|
|
148
|
+
render: () => (
|
|
149
|
+
<Alert className="w-[400px]">
|
|
150
|
+
<AlertDescription>
|
|
151
|
+
This is a simple alert without a title.
|
|
152
|
+
</AlertDescription>
|
|
153
|
+
</Alert>
|
|
154
|
+
),
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Different alert types with icons
|
|
159
|
+
*/
|
|
160
|
+
export const AlertTypes: Story = {
|
|
161
|
+
render: () => (
|
|
162
|
+
<div className="space-y-4 w-[500px]">
|
|
163
|
+
{/* Success */}
|
|
164
|
+
<Alert>
|
|
165
|
+
<svg
|
|
166
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
167
|
+
width="16"
|
|
168
|
+
height="16"
|
|
169
|
+
viewBox="0 0 24 24"
|
|
170
|
+
fill="none"
|
|
171
|
+
stroke="currentColor"
|
|
172
|
+
strokeWidth="2"
|
|
173
|
+
strokeLinecap="round"
|
|
174
|
+
strokeLinejoin="round"
|
|
175
|
+
className="text-green-600 dark:text-green-400"
|
|
176
|
+
>
|
|
177
|
+
<circle cx="12" cy="12" r="10" />
|
|
178
|
+
<path d="m9 12 2 2 4-4" />
|
|
179
|
+
</svg>
|
|
180
|
+
<AlertTitle>Success</AlertTitle>
|
|
181
|
+
<AlertDescription>
|
|
182
|
+
Your profile has been updated successfully.
|
|
183
|
+
</AlertDescription>
|
|
184
|
+
</Alert>
|
|
185
|
+
|
|
186
|
+
{/* Info */}
|
|
187
|
+
<Alert>
|
|
188
|
+
<svg
|
|
189
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
190
|
+
width="16"
|
|
191
|
+
height="16"
|
|
192
|
+
viewBox="0 0 24 24"
|
|
193
|
+
fill="none"
|
|
194
|
+
stroke="currentColor"
|
|
195
|
+
strokeWidth="2"
|
|
196
|
+
strokeLinecap="round"
|
|
197
|
+
strokeLinejoin="round"
|
|
198
|
+
className="text-blue-600 dark:text-blue-400"
|
|
199
|
+
>
|
|
200
|
+
<circle cx="12" cy="12" r="10" />
|
|
201
|
+
<path d="M12 16v-4" />
|
|
202
|
+
<path d="M12 8h.01" />
|
|
203
|
+
</svg>
|
|
204
|
+
<AlertTitle>Information</AlertTitle>
|
|
205
|
+
<AlertDescription>
|
|
206
|
+
New features are now available in your dashboard.
|
|
207
|
+
</AlertDescription>
|
|
208
|
+
</Alert>
|
|
209
|
+
|
|
210
|
+
{/* Warning */}
|
|
211
|
+
<Alert>
|
|
212
|
+
<svg
|
|
213
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
214
|
+
width="16"
|
|
215
|
+
height="16"
|
|
216
|
+
viewBox="0 0 24 24"
|
|
217
|
+
fill="none"
|
|
218
|
+
stroke="currentColor"
|
|
219
|
+
strokeWidth="2"
|
|
220
|
+
strokeLinecap="round"
|
|
221
|
+
strokeLinejoin="round"
|
|
222
|
+
className="text-yellow-600 dark:text-yellow-400"
|
|
223
|
+
>
|
|
224
|
+
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" />
|
|
225
|
+
<path d="M12 9v4" />
|
|
226
|
+
<path d="M12 17h.01" />
|
|
227
|
+
</svg>
|
|
228
|
+
<AlertTitle>Warning</AlertTitle>
|
|
229
|
+
<AlertDescription>
|
|
230
|
+
Your storage is almost full. Please upgrade your plan.
|
|
231
|
+
</AlertDescription>
|
|
232
|
+
</Alert>
|
|
233
|
+
|
|
234
|
+
{/* Error */}
|
|
235
|
+
<Alert variant="destructive">
|
|
236
|
+
<svg
|
|
237
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
238
|
+
width="16"
|
|
239
|
+
height="16"
|
|
240
|
+
viewBox="0 0 24 24"
|
|
241
|
+
fill="none"
|
|
242
|
+
stroke="currentColor"
|
|
243
|
+
strokeWidth="2"
|
|
244
|
+
strokeLinecap="round"
|
|
245
|
+
strokeLinejoin="round"
|
|
246
|
+
>
|
|
247
|
+
<circle cx="12" cy="12" r="10" />
|
|
248
|
+
<path d="m15 9-6 6" />
|
|
249
|
+
<path d="m9 9 6 6" />
|
|
250
|
+
</svg>
|
|
251
|
+
<AlertTitle>Error</AlertTitle>
|
|
252
|
+
<AlertDescription>
|
|
253
|
+
Failed to process payment. Please try again.
|
|
254
|
+
</AlertDescription>
|
|
255
|
+
</Alert>
|
|
256
|
+
</div>
|
|
257
|
+
),
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Alert with action button
|
|
262
|
+
*/
|
|
263
|
+
export const WithAction: Story = {
|
|
264
|
+
render: () => (
|
|
265
|
+
<Alert className="w-[500px]">
|
|
266
|
+
<svg
|
|
267
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
268
|
+
width="16"
|
|
269
|
+
height="16"
|
|
270
|
+
viewBox="0 0 24 24"
|
|
271
|
+
fill="none"
|
|
272
|
+
stroke="currentColor"
|
|
273
|
+
strokeWidth="2"
|
|
274
|
+
strokeLinecap="round"
|
|
275
|
+
strokeLinejoin="round"
|
|
276
|
+
>
|
|
277
|
+
<circle cx="12" cy="12" r="10" />
|
|
278
|
+
<path d="M12 16v-4" />
|
|
279
|
+
<path d="M12 8h.01" />
|
|
280
|
+
</svg>
|
|
281
|
+
<AlertTitle>Update Available</AlertTitle>
|
|
282
|
+
<AlertDescription>
|
|
283
|
+
<p>A new version of the app is available.</p>
|
|
284
|
+
<button className="mt-2 underline text-sm font-medium">
|
|
285
|
+
Update Now
|
|
286
|
+
</button>
|
|
287
|
+
</AlertDescription>
|
|
288
|
+
</Alert>
|
|
289
|
+
),
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Alert with links
|
|
294
|
+
*/
|
|
295
|
+
export const WithLinks: Story = {
|
|
296
|
+
render: () => (
|
|
297
|
+
<Alert className="w-[500px]">
|
|
298
|
+
<svg
|
|
299
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
300
|
+
width="16"
|
|
301
|
+
height="16"
|
|
302
|
+
viewBox="0 0 24 24"
|
|
303
|
+
fill="none"
|
|
304
|
+
stroke="currentColor"
|
|
305
|
+
strokeWidth="2"
|
|
306
|
+
strokeLinecap="round"
|
|
307
|
+
strokeLinejoin="round"
|
|
308
|
+
>
|
|
309
|
+
<circle cx="12" cy="12" r="10" />
|
|
310
|
+
<path d="M12 16v-4" />
|
|
311
|
+
<path d="M12 8h.01" />
|
|
312
|
+
</svg>
|
|
313
|
+
<AlertTitle>Privacy Policy Updated</AlertTitle>
|
|
314
|
+
<AlertDescription>
|
|
315
|
+
<p>
|
|
316
|
+
We've updated our privacy policy.{" "}
|
|
317
|
+
<a href="#" className="underline font-medium">
|
|
318
|
+
Read more
|
|
319
|
+
</a>{" "}
|
|
320
|
+
or{" "}
|
|
321
|
+
<a href="#" className="underline font-medium">
|
|
322
|
+
view changes
|
|
323
|
+
</a>
|
|
324
|
+
.
|
|
325
|
+
</p>
|
|
326
|
+
</AlertDescription>
|
|
327
|
+
</Alert>
|
|
328
|
+
),
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Long content
|
|
333
|
+
*/
|
|
334
|
+
export const LongContent: Story = {
|
|
335
|
+
render: () => (
|
|
336
|
+
<Alert className="w-[500px]">
|
|
337
|
+
<svg
|
|
338
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
339
|
+
width="16"
|
|
340
|
+
height="16"
|
|
341
|
+
viewBox="0 0 24 24"
|
|
342
|
+
fill="none"
|
|
343
|
+
stroke="currentColor"
|
|
344
|
+
strokeWidth="2"
|
|
345
|
+
strokeLinecap="round"
|
|
346
|
+
strokeLinejoin="round"
|
|
347
|
+
>
|
|
348
|
+
<circle cx="12" cy="12" r="10" />
|
|
349
|
+
<path d="M12 16v-4" />
|
|
350
|
+
<path d="M12 8h.01" />
|
|
351
|
+
</svg>
|
|
352
|
+
<AlertTitle>Important Notice</AlertTitle>
|
|
353
|
+
<AlertDescription>
|
|
354
|
+
<p>
|
|
355
|
+
We are performing scheduled maintenance on our servers. During this time,
|
|
356
|
+
some features may be unavailable. We apologize for any inconvenience this
|
|
357
|
+
may cause. The maintenance window is expected to last approximately 2 hours.
|
|
358
|
+
</p>
|
|
359
|
+
<p className="mt-2">
|
|
360
|
+
If you experience any issues after the maintenance is complete, please
|
|
361
|
+
contact our support team at support@example.com.
|
|
362
|
+
</p>
|
|
363
|
+
</AlertDescription>
|
|
364
|
+
</Alert>
|
|
365
|
+
),
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Dark mode support
|
|
370
|
+
*/
|
|
371
|
+
export const DarkMode: Story = {
|
|
372
|
+
parameters: {
|
|
373
|
+
backgrounds: { default: "dark" },
|
|
374
|
+
},
|
|
375
|
+
render: () => (
|
|
376
|
+
<div className="dark space-y-4 w-[500px]">
|
|
377
|
+
<Alert>
|
|
378
|
+
<svg
|
|
379
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
380
|
+
width="16"
|
|
381
|
+
height="16"
|
|
382
|
+
viewBox="0 0 24 24"
|
|
383
|
+
fill="none"
|
|
384
|
+
stroke="currentColor"
|
|
385
|
+
strokeWidth="2"
|
|
386
|
+
strokeLinecap="round"
|
|
387
|
+
strokeLinejoin="round"
|
|
388
|
+
>
|
|
389
|
+
<circle cx="12" cy="12" r="10" />
|
|
390
|
+
<path d="M12 16v-4" />
|
|
391
|
+
<path d="M12 8h.01" />
|
|
392
|
+
</svg>
|
|
393
|
+
<AlertTitle>Default Alert</AlertTitle>
|
|
394
|
+
<AlertDescription>
|
|
395
|
+
This is how alerts look in dark mode.
|
|
396
|
+
</AlertDescription>
|
|
397
|
+
</Alert>
|
|
398
|
+
|
|
399
|
+
<Alert variant="destructive">
|
|
400
|
+
<svg
|
|
401
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
402
|
+
width="16"
|
|
403
|
+
height="16"
|
|
404
|
+
viewBox="0 0 24 24"
|
|
405
|
+
fill="none"
|
|
406
|
+
stroke="currentColor"
|
|
407
|
+
strokeWidth="2"
|
|
408
|
+
strokeLinecap="round"
|
|
409
|
+
strokeLinejoin="round"
|
|
410
|
+
>
|
|
411
|
+
<circle cx="12" cy="12" r="10" />
|
|
412
|
+
<path d="m15 9-6 6" />
|
|
413
|
+
<path d="m9 9 6 6" />
|
|
414
|
+
</svg>
|
|
415
|
+
<AlertTitle>Destructive Alert</AlertTitle>
|
|
416
|
+
<AlertDescription>
|
|
417
|
+
Error alerts also support dark mode.
|
|
418
|
+
</AlertDescription>
|
|
419
|
+
</Alert>
|
|
420
|
+
</div>
|
|
421
|
+
),
|
|
422
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
Alert as ShadcnAlert,
|
|
6
|
+
AlertTitle as ShadcnAlertTitle,
|
|
7
|
+
AlertDescription as ShadcnAlertDescription,
|
|
8
|
+
} from "@/components/ui/alert";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Alert Primitive
|
|
12
|
+
*
|
|
13
|
+
* Displays a callout for user attention with variants for different message types.
|
|
14
|
+
*
|
|
15
|
+
* Features:
|
|
16
|
+
* - Variant support (default, destructive)
|
|
17
|
+
* - Icon support
|
|
18
|
+
* - Title and description components
|
|
19
|
+
* - Semantic role="alert" for accessibility
|
|
20
|
+
* - WCAG 2.1 Level AA compliant
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export type AlertProps = React.ComponentProps<typeof ShadcnAlert>;
|
|
24
|
+
export type AlertTitleProps = React.ComponentProps<typeof ShadcnAlertTitle>;
|
|
25
|
+
export type AlertDescriptionProps = React.ComponentProps<typeof ShadcnAlertDescription>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Alert - Root container with role="alert"
|
|
29
|
+
*/
|
|
30
|
+
export const Alert = React.memo<AlertProps>(
|
|
31
|
+
React.forwardRef<React.ElementRef<typeof ShadcnAlert>, AlertProps>(
|
|
32
|
+
(props, ref) => {
|
|
33
|
+
return <ShadcnAlert ref={ref} {...props} />;
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
Alert.displayName = "Alert";
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* AlertTitle - Title/heading for the alert
|
|
41
|
+
*/
|
|
42
|
+
export const AlertTitle = React.memo<AlertTitleProps>(
|
|
43
|
+
React.forwardRef<React.ElementRef<typeof ShadcnAlertTitle>, AlertTitleProps>(
|
|
44
|
+
(props, ref) => {
|
|
45
|
+
return <ShadcnAlertTitle ref={ref} {...props} />;
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
AlertTitle.displayName = "AlertTitle";
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* AlertDescription - Description content for the alert
|
|
53
|
+
*/
|
|
54
|
+
export const AlertDescription = React.memo<AlertDescriptionProps>(
|
|
55
|
+
React.forwardRef<React.ElementRef<typeof ShadcnAlertDescription>, AlertDescriptionProps>(
|
|
56
|
+
(props, ref) => {
|
|
57
|
+
return <ShadcnAlertDescription ref={ref} {...props} />;
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
AlertDescription.displayName = "AlertDescription";
|