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,242 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
Card as ShadcnCard,
|
|
4
|
+
cardVariants,
|
|
5
|
+
CardHeader as ShadcnCardHeader,
|
|
6
|
+
CardTitle as ShadcnCardTitle,
|
|
7
|
+
CardDescription as ShadcnCardDescription,
|
|
8
|
+
CardContent as ShadcnCardContent,
|
|
9
|
+
CardFooter as ShadcnCardFooter,
|
|
10
|
+
CardAction as ShadcnCardAction,
|
|
11
|
+
} from "../../ui/card"
|
|
12
|
+
import type { VariantProps } from "class-variance-authority"
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Card Primitive
|
|
16
|
+
*
|
|
17
|
+
* A foundational card component that wraps shadcn/ui Card with extensibility for
|
|
18
|
+
* design system-specific enhancements. Cards are flexible containers for grouping
|
|
19
|
+
* related content and actions, providing visual separation and hierarchy.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Card>
|
|
24
|
+
* <CardHeader>
|
|
25
|
+
* <CardTitle>Card Title</CardTitle>
|
|
26
|
+
* <CardDescription>Card description goes here</CardDescription>
|
|
27
|
+
* </CardHeader>
|
|
28
|
+
* <CardContent>
|
|
29
|
+
* <p>Card content goes here</p>
|
|
30
|
+
* </CardContent>
|
|
31
|
+
* <CardFooter>
|
|
32
|
+
* <Button>Action</Button>
|
|
33
|
+
* </CardFooter>
|
|
34
|
+
* </Card>
|
|
35
|
+
*
|
|
36
|
+
* <Card elevation="elevated" padding="lg">
|
|
37
|
+
* <CardHeader>
|
|
38
|
+
* <CardTitle>Elevated Card</CardTitle>
|
|
39
|
+
* </CardHeader>
|
|
40
|
+
* <CardContent>
|
|
41
|
+
* <p>Card with elevated shadow and large padding</p>
|
|
42
|
+
* </CardContent>
|
|
43
|
+
* </Card>
|
|
44
|
+
*
|
|
45
|
+
* <Card elevation="outlined" padding="sm">
|
|
46
|
+
* <CardHeader>
|
|
47
|
+
* <CardTitle>Outlined Card</CardTitle>
|
|
48
|
+
* </CardHeader>
|
|
49
|
+
* <CardContent>
|
|
50
|
+
* <p>Card with prominent border and compact padding</p>
|
|
51
|
+
* </CardContent>
|
|
52
|
+
* </Card>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @see https://ui.shadcn.com/docs/components/card - shadcn/ui Card documentation
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Card component props
|
|
60
|
+
* Extends the native div element props with variant options
|
|
61
|
+
*/
|
|
62
|
+
export type CardProps = React.ComponentProps<"div"> &
|
|
63
|
+
VariantProps<typeof cardVariants>
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* CardHeader component props
|
|
67
|
+
* Extends the native div element props
|
|
68
|
+
*/
|
|
69
|
+
export type CardHeaderProps = React.ComponentProps<"div">
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* CardTitle component props
|
|
73
|
+
* Extends the native div element props
|
|
74
|
+
*/
|
|
75
|
+
export type CardTitleProps = React.ComponentProps<"div">
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* CardDescription component props
|
|
79
|
+
* Extends the native div element props
|
|
80
|
+
*/
|
|
81
|
+
export type CardDescriptionProps = React.ComponentProps<"div">
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* CardContent component props
|
|
85
|
+
* Extends the native div element props
|
|
86
|
+
*/
|
|
87
|
+
export type CardContentProps = React.ComponentProps<"div">
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* CardFooter component props
|
|
91
|
+
* Extends the native div element props
|
|
92
|
+
*/
|
|
93
|
+
export type CardFooterProps = React.ComponentProps<"div">
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* CardAction component props
|
|
97
|
+
* Extends the native div element props
|
|
98
|
+
*/
|
|
99
|
+
export type CardActionProps = React.ComponentProps<"div">
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Card component
|
|
103
|
+
*
|
|
104
|
+
* A versatile card container component built on shadcn/ui foundation.
|
|
105
|
+
* Provides visual separation and hierarchy for grouping related content and actions.
|
|
106
|
+
* Optimized with React.memo for performance in high-frequency rendering scenarios.
|
|
107
|
+
*
|
|
108
|
+
* Features:
|
|
109
|
+
* - Flexible composition with header, content, and footer sections
|
|
110
|
+
* - Elevation variants (flat, elevated, outlined) for different visual treatments
|
|
111
|
+
* - Padding variants (sm, default, lg) for different content densities
|
|
112
|
+
* - Title and description components for consistent typography
|
|
113
|
+
* - Action slot for card header controls
|
|
114
|
+
* - Dark mode support
|
|
115
|
+
* - Semantic HTML structure
|
|
116
|
+
*/
|
|
117
|
+
export const Card = React.memo(
|
|
118
|
+
React.forwardRef<HTMLDivElement, CardProps>(
|
|
119
|
+
(props, ref) => {
|
|
120
|
+
return <ShadcnCard ref={ref} {...props} />
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
Card.displayName = "Card"
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Re-export cardVariants for consumers who need direct access to the variant generator.
|
|
129
|
+
* This is useful for creating custom card-like components that need consistent styling.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```tsx
|
|
133
|
+
* import { cardVariants } from './Card'
|
|
134
|
+
*
|
|
135
|
+
* <div className={cardVariants({ elevation: "elevated", padding: "lg" })}>
|
|
136
|
+
* Custom card-like div
|
|
137
|
+
* </div>
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export { cardVariants }
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Re-export VariantProps for type inference in consuming components
|
|
144
|
+
*/
|
|
145
|
+
export type { VariantProps }
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* CardHeader component
|
|
149
|
+
*
|
|
150
|
+
* Used to group the card's title, description, and optional actions.
|
|
151
|
+
* Provides consistent spacing and layout for the card's header section.
|
|
152
|
+
* Optimized with React.memo for performance in high-frequency rendering scenarios.
|
|
153
|
+
*/
|
|
154
|
+
export const CardHeader = React.memo(
|
|
155
|
+
React.forwardRef<HTMLDivElement, CardHeaderProps>(
|
|
156
|
+
(props, ref) => {
|
|
157
|
+
return <ShadcnCardHeader ref={ref} {...props} />
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
CardHeader.displayName = "CardHeader"
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* CardTitle component
|
|
166
|
+
*
|
|
167
|
+
* The main heading for the card. Uses semantic HTML and proper typography hierarchy.
|
|
168
|
+
* Optimized with React.memo for performance in high-frequency rendering scenarios.
|
|
169
|
+
*/
|
|
170
|
+
export const CardTitle = React.memo(
|
|
171
|
+
React.forwardRef<HTMLDivElement, CardTitleProps>(
|
|
172
|
+
(props, ref) => {
|
|
173
|
+
return <ShadcnCardTitle ref={ref} {...props} />
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
CardTitle.displayName = "CardTitle"
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* CardDescription component
|
|
182
|
+
*
|
|
183
|
+
* Supporting text for the card title. Uses muted styling to establish visual hierarchy.
|
|
184
|
+
* Optimized with React.memo for performance in high-frequency rendering scenarios.
|
|
185
|
+
*/
|
|
186
|
+
export const CardDescription = React.memo(
|
|
187
|
+
React.forwardRef<HTMLDivElement, CardDescriptionProps>(
|
|
188
|
+
(props, ref) => {
|
|
189
|
+
return <ShadcnCardDescription ref={ref} {...props} />
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
CardDescription.displayName = "CardDescription"
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* CardContent component
|
|
198
|
+
*
|
|
199
|
+
* Main container for card body content. Provides consistent padding and spacing.
|
|
200
|
+
* Optimized with React.memo for performance in high-frequency rendering scenarios.
|
|
201
|
+
*/
|
|
202
|
+
export const CardContent = React.memo(
|
|
203
|
+
React.forwardRef<HTMLDivElement, CardContentProps>(
|
|
204
|
+
(props, ref) => {
|
|
205
|
+
return <ShadcnCardContent ref={ref} {...props} />
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
CardContent.displayName = "CardContent"
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* CardFooter component
|
|
214
|
+
*
|
|
215
|
+
* Used for actions and supplementary content. Typically contains buttons or links.
|
|
216
|
+
* Optimized with React.memo for performance in high-frequency rendering scenarios.
|
|
217
|
+
*/
|
|
218
|
+
export const CardFooter = React.memo(
|
|
219
|
+
React.forwardRef<HTMLDivElement, CardFooterProps>(
|
|
220
|
+
(props, ref) => {
|
|
221
|
+
return <ShadcnCardFooter ref={ref} {...props} />
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
CardFooter.displayName = "CardFooter"
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* CardAction component
|
|
230
|
+
*
|
|
231
|
+
* Used for action buttons or icons in the card header. Provides consistent positioning.
|
|
232
|
+
* Optimized with React.memo for performance in high-frequency rendering scenarios.
|
|
233
|
+
*/
|
|
234
|
+
export const CardAction = React.memo(
|
|
235
|
+
React.forwardRef<HTMLDivElement, CardActionProps>(
|
|
236
|
+
(props, ref) => {
|
|
237
|
+
return <ShadcnCardAction ref={ref} {...props} />
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
CardAction.displayName = "CardAction"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card Primitive Exports
|
|
3
|
+
*
|
|
4
|
+
* A comprehensive card component system for grouping related content and actions.
|
|
5
|
+
* Provides a flexible container with consistent styling and semantic structure.
|
|
6
|
+
*
|
|
7
|
+
* @module primitives/Card
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
Card,
|
|
12
|
+
cardVariants,
|
|
13
|
+
CardHeader,
|
|
14
|
+
CardTitle,
|
|
15
|
+
CardDescription,
|
|
16
|
+
CardContent,
|
|
17
|
+
CardFooter,
|
|
18
|
+
CardAction,
|
|
19
|
+
} from './Card'
|
|
20
|
+
|
|
21
|
+
export type {
|
|
22
|
+
CardProps,
|
|
23
|
+
CardHeaderProps,
|
|
24
|
+
CardTitleProps,
|
|
25
|
+
CardDescriptionProps,
|
|
26
|
+
CardContentProps,
|
|
27
|
+
CardFooterProps,
|
|
28
|
+
CardActionProps,
|
|
29
|
+
VariantProps,
|
|
30
|
+
} from './Card'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "./Carousel";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Carousel> = {
|
|
5
|
+
title: "Primitives/Carousel",
|
|
6
|
+
component: Carousel,
|
|
7
|
+
parameters: { layout: "centered" },
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof Carousel>;
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<Carousel className="w-full max-w-xs">
|
|
17
|
+
<CarouselContent>
|
|
18
|
+
{Array.from({ length: 5 }).map((_, index) => (
|
|
19
|
+
<CarouselItem key={index}>
|
|
20
|
+
<div className="p-1">
|
|
21
|
+
<div className="flex aspect-square items-center justify-center p-6 border rounded-lg">
|
|
22
|
+
<span className="text-4xl font-semibold">{index + 1}</span>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</CarouselItem>
|
|
26
|
+
))}
|
|
27
|
+
</CarouselContent>
|
|
28
|
+
<CarouselPrevious />
|
|
29
|
+
<CarouselNext />
|
|
30
|
+
</Carousel>
|
|
31
|
+
),
|
|
32
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
Carousel as ShadcnCarousel,
|
|
6
|
+
CarouselContent as ShadcnCarouselContent,
|
|
7
|
+
CarouselItem as ShadcnCarouselItem,
|
|
8
|
+
CarouselNext as ShadcnCarouselNext,
|
|
9
|
+
CarouselPrevious as ShadcnCarouselPrevious,
|
|
10
|
+
type CarouselApi,
|
|
11
|
+
} from "@/components/ui/carousel";
|
|
12
|
+
|
|
13
|
+
export type { CarouselApi };
|
|
14
|
+
export type CarouselProps = React.ComponentProps<typeof ShadcnCarousel>;
|
|
15
|
+
export type CarouselContentProps = React.ComponentProps<typeof ShadcnCarouselContent>;
|
|
16
|
+
export type CarouselItemProps = React.ComponentProps<typeof ShadcnCarouselItem>;
|
|
17
|
+
export type CarouselPreviousProps = React.ComponentProps<typeof ShadcnCarouselPrevious>;
|
|
18
|
+
export type CarouselNextProps = React.ComponentProps<typeof ShadcnCarouselNext>;
|
|
19
|
+
|
|
20
|
+
export const Carousel = React.memo<CarouselProps>(
|
|
21
|
+
React.forwardRef<React.ElementRef<typeof ShadcnCarousel>, CarouselProps>(
|
|
22
|
+
(props, ref) => {
|
|
23
|
+
return <ShadcnCarousel ref={ref} {...props} />;
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
Carousel.displayName = "Carousel";
|
|
28
|
+
|
|
29
|
+
export const CarouselContent = React.memo<CarouselContentProps>(
|
|
30
|
+
React.forwardRef<React.ElementRef<typeof ShadcnCarouselContent>, CarouselContentProps>(
|
|
31
|
+
(props, ref) => {
|
|
32
|
+
return <ShadcnCarouselContent ref={ref} {...props} />;
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
CarouselContent.displayName = "CarouselContent";
|
|
37
|
+
|
|
38
|
+
export const CarouselItem = React.memo<CarouselItemProps>(
|
|
39
|
+
React.forwardRef<React.ElementRef<typeof ShadcnCarouselItem>, CarouselItemProps>(
|
|
40
|
+
(props, ref) => {
|
|
41
|
+
return <ShadcnCarouselItem ref={ref} {...props} />;
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
CarouselItem.displayName = "CarouselItem";
|
|
46
|
+
|
|
47
|
+
export const CarouselPrevious = React.memo<CarouselPreviousProps>(
|
|
48
|
+
React.forwardRef<React.ElementRef<typeof ShadcnCarouselPrevious>, CarouselPreviousProps>(
|
|
49
|
+
(props, ref) => {
|
|
50
|
+
return <ShadcnCarouselPrevious ref={ref} {...props} />;
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
|
55
|
+
|
|
56
|
+
export const CarouselNext = React.memo<CarouselNextProps>(
|
|
57
|
+
React.forwardRef<React.ElementRef<typeof ShadcnCarouselNext>, CarouselNextProps>(
|
|
58
|
+
(props, ref) => {
|
|
59
|
+
return <ShadcnCarouselNext ref={ref} {...props} />;
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
CarouselNext.displayName = "CarouselNext";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Carousel,
|
|
3
|
+
CarouselContent,
|
|
4
|
+
CarouselItem,
|
|
5
|
+
CarouselNext,
|
|
6
|
+
CarouselPrevious,
|
|
7
|
+
type CarouselApi,
|
|
8
|
+
type CarouselProps,
|
|
9
|
+
type CarouselContentProps,
|
|
10
|
+
type CarouselItemProps,
|
|
11
|
+
type CarouselNextProps,
|
|
12
|
+
type CarouselPreviousProps,
|
|
13
|
+
} from "./Carousel";
|