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,87 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { ToggleGroup, ToggleGroupItem } from "./ToggleGroup"
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Primitives/ToggleGroup",
|
|
7
|
+
component: ToggleGroup,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
} satisfies Meta<typeof ToggleGroup>
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
export const Default: Story = {
|
|
18
|
+
render: () => (
|
|
19
|
+
<ToggleGroup type="single">
|
|
20
|
+
<ToggleGroupItem value="left">Left</ToggleGroupItem>
|
|
21
|
+
<ToggleGroupItem value="center">Center</ToggleGroupItem>
|
|
22
|
+
<ToggleGroupItem value="right">Right</ToggleGroupItem>
|
|
23
|
+
</ToggleGroup>
|
|
24
|
+
),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Multiple: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<ToggleGroup type="multiple">
|
|
30
|
+
<ToggleGroupItem value="bold">B</ToggleGroupItem>
|
|
31
|
+
<ToggleGroupItem value="italic">I</ToggleGroupItem>
|
|
32
|
+
<ToggleGroupItem value="underline">U</ToggleGroupItem>
|
|
33
|
+
</ToggleGroup>
|
|
34
|
+
),
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Outline: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<ToggleGroup type="single" variant="outline">
|
|
40
|
+
<ToggleGroupItem value="left">Left</ToggleGroupItem>
|
|
41
|
+
<ToggleGroupItem value="center">Center</ToggleGroupItem>
|
|
42
|
+
<ToggleGroupItem value="right">Right</ToggleGroupItem>
|
|
43
|
+
</ToggleGroup>
|
|
44
|
+
),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const WithSpacing: Story = {
|
|
48
|
+
render: () => (
|
|
49
|
+
<ToggleGroup type="single" variant="outline" spacing={4}>
|
|
50
|
+
<ToggleGroupItem value="left">Left</ToggleGroupItem>
|
|
51
|
+
<ToggleGroupItem value="center">Center</ToggleGroupItem>
|
|
52
|
+
<ToggleGroupItem value="right">Right</ToggleGroupItem>
|
|
53
|
+
</ToggleGroup>
|
|
54
|
+
),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const Controlled: Story = {
|
|
58
|
+
render: () => {
|
|
59
|
+
const [value, setValue] = React.useState("center")
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className="flex flex-col gap-4">
|
|
63
|
+
<ToggleGroup type="single" value={value} onValueChange={setValue}>
|
|
64
|
+
<ToggleGroupItem value="left">Left</ToggleGroupItem>
|
|
65
|
+
<ToggleGroupItem value="center">Center</ToggleGroupItem>
|
|
66
|
+
<ToggleGroupItem value="right">Right</ToggleGroupItem>
|
|
67
|
+
</ToggleGroup>
|
|
68
|
+
<p className="text-sm text-muted-foreground">Selected: {value}</p>
|
|
69
|
+
</div>
|
|
70
|
+
)
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const DarkMode: Story = {
|
|
75
|
+
parameters: {
|
|
76
|
+
backgrounds: { default: "dark" },
|
|
77
|
+
},
|
|
78
|
+
render: () => (
|
|
79
|
+
<div className="dark">
|
|
80
|
+
<ToggleGroup type="single">
|
|
81
|
+
<ToggleGroupItem value="left">Left</ToggleGroupItem>
|
|
82
|
+
<ToggleGroupItem value="center">Center</ToggleGroupItem>
|
|
83
|
+
<ToggleGroupItem value="right">Right</ToggleGroupItem>
|
|
84
|
+
</ToggleGroup>
|
|
85
|
+
</div>
|
|
86
|
+
),
|
|
87
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
ToggleGroup as ShadcnToggleGroup,
|
|
4
|
+
ToggleGroupItem,
|
|
5
|
+
} from "../../ui/toggle-group"
|
|
6
|
+
import { toggleVariants } from "../../ui/toggle"
|
|
7
|
+
import type { VariantProps } from "class-variance-authority"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ToggleGroup Primitive
|
|
11
|
+
*
|
|
12
|
+
* A set of two-state toggle buttons that can work independently or as radio group.
|
|
13
|
+
* Built on Radix UI ToggleGroup primitive with WCAG 2.1 Level AA compliance.
|
|
14
|
+
*
|
|
15
|
+
* @see https://ui.shadcn.com/docs/components/toggle-group
|
|
16
|
+
* @see https://www.radix-ui.com/primitives/docs/components/toggle-group
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export type ToggleGroupProps = React.ComponentProps<typeof ShadcnToggleGroup> &
|
|
20
|
+
VariantProps<typeof toggleVariants> & {
|
|
21
|
+
spacing?: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type ToggleGroupItemProps = React.ComponentProps<typeof ToggleGroupItem> &
|
|
25
|
+
VariantProps<typeof toggleVariants>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* ToggleGroup component
|
|
29
|
+
*
|
|
30
|
+
* A set of two-state toggle buttons that can work independently or as a radio group.
|
|
31
|
+
* Built on Radix UI ToggleGroup primitive with full accessibility support.
|
|
32
|
+
*
|
|
33
|
+
* Features:
|
|
34
|
+
* - Single or multiple selection modes
|
|
35
|
+
* - Keyboard navigation
|
|
36
|
+
* - ARIA attributes
|
|
37
|
+
* - Multiple visual variants
|
|
38
|
+
* - Dark mode support
|
|
39
|
+
*/
|
|
40
|
+
export const ToggleGroup = React.forwardRef<
|
|
41
|
+
React.ElementRef<typeof ShadcnToggleGroup>,
|
|
42
|
+
ToggleGroupProps
|
|
43
|
+
>((props, ref) => {
|
|
44
|
+
return <ShadcnToggleGroup {...props} />
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
ToggleGroup.displayName = "ToggleGroup"
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Re-export ToggleGroupItem for composition
|
|
51
|
+
*/
|
|
52
|
+
export { ToggleGroupItem }
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./Tooltip";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Tooltip component displays contextual information when hovering or focusing on an element.
|
|
7
|
+
*
|
|
8
|
+
* ## Features
|
|
9
|
+
* - Keyboard accessible (focus trigger)
|
|
10
|
+
* - Customizable positioning (top, right, bottom, left)
|
|
11
|
+
* - Configurable delay
|
|
12
|
+
* - Arrow indicator
|
|
13
|
+
* - Portal rendering
|
|
14
|
+
* - WCAG 2.1 Level AA compliant
|
|
15
|
+
*
|
|
16
|
+
* ## Usage
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Tooltip>
|
|
19
|
+
* <TooltipTrigger>Hover me</TooltipTrigger>
|
|
20
|
+
* <TooltipContent>Helpful information</TooltipContent>
|
|
21
|
+
* </Tooltip>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ## Accessibility
|
|
25
|
+
* - Triggered by both hover and keyboard focus
|
|
26
|
+
* - Dismissed with Escape key
|
|
27
|
+
* - Screen reader compatible
|
|
28
|
+
* - Proper ARIA attributes
|
|
29
|
+
*/
|
|
30
|
+
const meta: Meta<typeof Tooltip> = {
|
|
31
|
+
title: "Primitives/Tooltip",
|
|
32
|
+
component: Tooltip,
|
|
33
|
+
parameters: {
|
|
34
|
+
layout: "centered",
|
|
35
|
+
docs: {
|
|
36
|
+
description: {
|
|
37
|
+
component:
|
|
38
|
+
"A popup that displays information when hovering or focusing on an element.",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
tags: ["autodocs"],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default meta;
|
|
46
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Default tooltip on top
|
|
50
|
+
*/
|
|
51
|
+
export const Default: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<Tooltip>
|
|
54
|
+
<TooltipTrigger asChild>
|
|
55
|
+
<Button variant="outline">Hover me</Button>
|
|
56
|
+
</TooltipTrigger>
|
|
57
|
+
<TooltipContent>
|
|
58
|
+
<p>This is a helpful tooltip</p>
|
|
59
|
+
</TooltipContent>
|
|
60
|
+
</Tooltip>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Tooltip positioned on different sides
|
|
66
|
+
*/
|
|
67
|
+
export const Positions: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<div className="flex gap-4 flex-wrap items-center justify-center">
|
|
70
|
+
<Tooltip>
|
|
71
|
+
<TooltipTrigger asChild>
|
|
72
|
+
<Button variant="outline">Top</Button>
|
|
73
|
+
</TooltipTrigger>
|
|
74
|
+
<TooltipContent side="top">
|
|
75
|
+
<p>Tooltip on top</p>
|
|
76
|
+
</TooltipContent>
|
|
77
|
+
</Tooltip>
|
|
78
|
+
|
|
79
|
+
<Tooltip>
|
|
80
|
+
<TooltipTrigger asChild>
|
|
81
|
+
<Button variant="outline">Right</Button>
|
|
82
|
+
</TooltipTrigger>
|
|
83
|
+
<TooltipContent side="right">
|
|
84
|
+
<p>Tooltip on right</p>
|
|
85
|
+
</TooltipContent>
|
|
86
|
+
</Tooltip>
|
|
87
|
+
|
|
88
|
+
<Tooltip>
|
|
89
|
+
<TooltipTrigger asChild>
|
|
90
|
+
<Button variant="outline">Bottom</Button>
|
|
91
|
+
</TooltipTrigger>
|
|
92
|
+
<TooltipContent side="bottom">
|
|
93
|
+
<p>Tooltip on bottom</p>
|
|
94
|
+
</TooltipContent>
|
|
95
|
+
</Tooltip>
|
|
96
|
+
|
|
97
|
+
<Tooltip>
|
|
98
|
+
<TooltipTrigger asChild>
|
|
99
|
+
<Button variant="outline">Left</Button>
|
|
100
|
+
</TooltipTrigger>
|
|
101
|
+
<TooltipContent side="left">
|
|
102
|
+
<p>Tooltip on left</p>
|
|
103
|
+
</TooltipContent>
|
|
104
|
+
</Tooltip>
|
|
105
|
+
</div>
|
|
106
|
+
),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Tooltip with custom delay duration
|
|
111
|
+
*/
|
|
112
|
+
export const WithDelay: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<div className="flex gap-4">
|
|
115
|
+
<Tooltip delayDuration={0}>
|
|
116
|
+
<TooltipTrigger asChild>
|
|
117
|
+
<Button variant="outline">Instant</Button>
|
|
118
|
+
</TooltipTrigger>
|
|
119
|
+
<TooltipContent>
|
|
120
|
+
<p>No delay (0ms)</p>
|
|
121
|
+
</TooltipContent>
|
|
122
|
+
</Tooltip>
|
|
123
|
+
|
|
124
|
+
<Tooltip delayDuration={500}>
|
|
125
|
+
<TooltipTrigger asChild>
|
|
126
|
+
<Button variant="outline">Delayed</Button>
|
|
127
|
+
</TooltipTrigger>
|
|
128
|
+
<TooltipContent>
|
|
129
|
+
<p>500ms delay</p>
|
|
130
|
+
</TooltipContent>
|
|
131
|
+
</Tooltip>
|
|
132
|
+
|
|
133
|
+
<Tooltip delayDuration={1000}>
|
|
134
|
+
<TooltipTrigger asChild>
|
|
135
|
+
<Button variant="outline">Very Delayed</Button>
|
|
136
|
+
</TooltipTrigger>
|
|
137
|
+
<TooltipContent>
|
|
138
|
+
<p>1000ms delay</p>
|
|
139
|
+
</TooltipContent>
|
|
140
|
+
</Tooltip>
|
|
141
|
+
</div>
|
|
142
|
+
),
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Tooltip on icon button
|
|
147
|
+
*/
|
|
148
|
+
export const OnIconButton: Story = {
|
|
149
|
+
render: () => (
|
|
150
|
+
<div className="flex gap-4">
|
|
151
|
+
<Tooltip>
|
|
152
|
+
<TooltipTrigger asChild>
|
|
153
|
+
<Button variant="ghost" size="icon">
|
|
154
|
+
<span className="sr-only">Settings</span>
|
|
155
|
+
<svg
|
|
156
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
157
|
+
width="20"
|
|
158
|
+
height="20"
|
|
159
|
+
viewBox="0 0 24 24"
|
|
160
|
+
fill="none"
|
|
161
|
+
stroke="currentColor"
|
|
162
|
+
strokeWidth="2"
|
|
163
|
+
strokeLinecap="round"
|
|
164
|
+
strokeLinejoin="round"
|
|
165
|
+
>
|
|
166
|
+
<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
|
|
167
|
+
<circle cx="12" cy="12" r="3" />
|
|
168
|
+
</svg>
|
|
169
|
+
</Button>
|
|
170
|
+
</TooltipTrigger>
|
|
171
|
+
<TooltipContent>
|
|
172
|
+
<p>Settings</p>
|
|
173
|
+
</TooltipContent>
|
|
174
|
+
</Tooltip>
|
|
175
|
+
|
|
176
|
+
<Tooltip>
|
|
177
|
+
<TooltipTrigger asChild>
|
|
178
|
+
<Button variant="ghost" size="icon">
|
|
179
|
+
<span className="sr-only">Help</span>
|
|
180
|
+
<svg
|
|
181
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
182
|
+
width="20"
|
|
183
|
+
height="20"
|
|
184
|
+
viewBox="0 0 24 24"
|
|
185
|
+
fill="none"
|
|
186
|
+
stroke="currentColor"
|
|
187
|
+
strokeWidth="2"
|
|
188
|
+
strokeLinecap="round"
|
|
189
|
+
strokeLinejoin="round"
|
|
190
|
+
>
|
|
191
|
+
<circle cx="12" cy="12" r="10" />
|
|
192
|
+
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
|
|
193
|
+
<path d="M12 17h.01" />
|
|
194
|
+
</svg>
|
|
195
|
+
</Button>
|
|
196
|
+
</TooltipTrigger>
|
|
197
|
+
<TooltipContent>
|
|
198
|
+
<p>Help & Documentation</p>
|
|
199
|
+
</TooltipContent>
|
|
200
|
+
</Tooltip>
|
|
201
|
+
</div>
|
|
202
|
+
),
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Tooltip with rich content
|
|
207
|
+
*/
|
|
208
|
+
export const RichContent: Story = {
|
|
209
|
+
render: () => (
|
|
210
|
+
<Tooltip>
|
|
211
|
+
<TooltipTrigger asChild>
|
|
212
|
+
<Button variant="outline">View Details</Button>
|
|
213
|
+
</TooltipTrigger>
|
|
214
|
+
<TooltipContent className="max-w-xs">
|
|
215
|
+
<div className="space-y-1">
|
|
216
|
+
<p className="font-semibold">User Information</p>
|
|
217
|
+
<p className="text-xs opacity-90">John Doe</p>
|
|
218
|
+
<p className="text-xs opacity-90">john.doe@example.com</p>
|
|
219
|
+
</div>
|
|
220
|
+
</TooltipContent>
|
|
221
|
+
</Tooltip>
|
|
222
|
+
),
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Disabled element with tooltip
|
|
227
|
+
*/
|
|
228
|
+
export const OnDisabledElement: Story = {
|
|
229
|
+
render: () => (
|
|
230
|
+
<Tooltip>
|
|
231
|
+
<TooltipTrigger asChild>
|
|
232
|
+
<span className="inline-block">
|
|
233
|
+
<Button variant="outline" disabled className="pointer-events-none">
|
|
234
|
+
Disabled Button
|
|
235
|
+
</Button>
|
|
236
|
+
</span>
|
|
237
|
+
</TooltipTrigger>
|
|
238
|
+
<TooltipContent>
|
|
239
|
+
<p>This action is currently unavailable</p>
|
|
240
|
+
</TooltipContent>
|
|
241
|
+
</Tooltip>
|
|
242
|
+
),
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Multiple tooltips
|
|
247
|
+
*/
|
|
248
|
+
export const MultipleTooltips: Story = {
|
|
249
|
+
render: () => (
|
|
250
|
+
<div className="flex gap-4 flex-wrap">
|
|
251
|
+
<Tooltip>
|
|
252
|
+
<TooltipTrigger asChild>
|
|
253
|
+
<Button variant="outline">Save</Button>
|
|
254
|
+
</TooltipTrigger>
|
|
255
|
+
<TooltipContent>
|
|
256
|
+
<p>Save changes (Ctrl+S)</p>
|
|
257
|
+
</TooltipContent>
|
|
258
|
+
</Tooltip>
|
|
259
|
+
|
|
260
|
+
<Tooltip>
|
|
261
|
+
<TooltipTrigger asChild>
|
|
262
|
+
<Button variant="outline">Copy</Button>
|
|
263
|
+
</TooltipTrigger>
|
|
264
|
+
<TooltipContent>
|
|
265
|
+
<p>Copy to clipboard (Ctrl+C)</p>
|
|
266
|
+
</TooltipContent>
|
|
267
|
+
</Tooltip>
|
|
268
|
+
|
|
269
|
+
<Tooltip>
|
|
270
|
+
<TooltipTrigger asChild>
|
|
271
|
+
<Button variant="outline">Paste</Button>
|
|
272
|
+
</TooltipTrigger>
|
|
273
|
+
<TooltipContent>
|
|
274
|
+
<p>Paste from clipboard (Ctrl+V)</p>
|
|
275
|
+
</TooltipContent>
|
|
276
|
+
</Tooltip>
|
|
277
|
+
|
|
278
|
+
<Tooltip>
|
|
279
|
+
<TooltipTrigger asChild>
|
|
280
|
+
<Button variant="outline">Undo</Button>
|
|
281
|
+
</TooltipTrigger>
|
|
282
|
+
<TooltipContent>
|
|
283
|
+
<p>Undo last action (Ctrl+Z)</p>
|
|
284
|
+
</TooltipContent>
|
|
285
|
+
</Tooltip>
|
|
286
|
+
</div>
|
|
287
|
+
),
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Dark mode support
|
|
292
|
+
*/
|
|
293
|
+
export const DarkMode: Story = {
|
|
294
|
+
parameters: {
|
|
295
|
+
backgrounds: { default: "dark" },
|
|
296
|
+
},
|
|
297
|
+
render: () => (
|
|
298
|
+
<div className="dark">
|
|
299
|
+
<Tooltip>
|
|
300
|
+
<TooltipTrigger asChild>
|
|
301
|
+
<Button variant="outline">Dark Mode Tooltip</Button>
|
|
302
|
+
</TooltipTrigger>
|
|
303
|
+
<TooltipContent>
|
|
304
|
+
<p>Tooltip in dark mode</p>
|
|
305
|
+
</TooltipContent>
|
|
306
|
+
</Tooltip>
|
|
307
|
+
</div>
|
|
308
|
+
),
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* With custom side offset
|
|
313
|
+
*/
|
|
314
|
+
export const WithSideOffset: Story = {
|
|
315
|
+
render: () => (
|
|
316
|
+
<div className="flex gap-4">
|
|
317
|
+
<Tooltip>
|
|
318
|
+
<TooltipTrigger asChild>
|
|
319
|
+
<Button variant="outline">Default Offset</Button>
|
|
320
|
+
</TooltipTrigger>
|
|
321
|
+
<TooltipContent>
|
|
322
|
+
<p>Default offset (0px)</p>
|
|
323
|
+
</TooltipContent>
|
|
324
|
+
</Tooltip>
|
|
325
|
+
|
|
326
|
+
<Tooltip>
|
|
327
|
+
<TooltipTrigger asChild>
|
|
328
|
+
<Button variant="outline">Large Offset</Button>
|
|
329
|
+
</TooltipTrigger>
|
|
330
|
+
<TooltipContent sideOffset={20}>
|
|
331
|
+
<p>Large offset (20px)</p>
|
|
332
|
+
</TooltipContent>
|
|
333
|
+
</Tooltip>
|
|
334
|
+
</div>
|
|
335
|
+
),
|
|
336
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
Tooltip as ShadcnTooltip,
|
|
6
|
+
TooltipContent as ShadcnTooltipContent,
|
|
7
|
+
TooltipTrigger as ShadcnTooltipTrigger,
|
|
8
|
+
TooltipProvider as ShadcnTooltipProvider,
|
|
9
|
+
} from "@/components/ui/tooltip";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Tooltip Primitive
|
|
13
|
+
*
|
|
14
|
+
* A popup that displays information related to an element when the element
|
|
15
|
+
* receives keyboard focus or the mouse hovers over it.
|
|
16
|
+
*
|
|
17
|
+
* Features:
|
|
18
|
+
* - Keyboard focus support
|
|
19
|
+
* - Customizable delay duration
|
|
20
|
+
* - Arrow indicator
|
|
21
|
+
* - Side positioning (top, right, bottom, left)
|
|
22
|
+
* - Portal rendering for proper z-index
|
|
23
|
+
* - WCAG 2.1 Level AA compliant
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export type TooltipProps = React.ComponentProps<typeof ShadcnTooltip>;
|
|
27
|
+
export type TooltipTriggerProps = React.ComponentProps<typeof ShadcnTooltipTrigger>;
|
|
28
|
+
export type TooltipContentProps = React.ComponentProps<typeof ShadcnTooltipContent>;
|
|
29
|
+
export type TooltipProviderProps = React.ComponentProps<typeof ShadcnTooltipProvider>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* TooltipProvider - Wraps your app to provide tooltip context
|
|
33
|
+
* Usually placed at the root of your app
|
|
34
|
+
*/
|
|
35
|
+
export const TooltipProvider = React.memo<TooltipProviderProps>(
|
|
36
|
+
React.forwardRef<React.ElementRef<typeof ShadcnTooltipProvider>, TooltipProviderProps>(
|
|
37
|
+
(props, ref) => {
|
|
38
|
+
return <ShadcnTooltipProvider {...props} />;
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
);
|
|
42
|
+
TooltipProvider.displayName = "TooltipProvider";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Tooltip - Root component that manages tooltip state
|
|
46
|
+
*/
|
|
47
|
+
export const Tooltip = React.memo<TooltipProps>(
|
|
48
|
+
React.forwardRef<React.ElementRef<typeof ShadcnTooltip>, TooltipProps>(
|
|
49
|
+
(props, ref) => {
|
|
50
|
+
return <ShadcnTooltip {...props} />;
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
Tooltip.displayName = "Tooltip";
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* TooltipTrigger - The element that triggers the tooltip
|
|
58
|
+
*/
|
|
59
|
+
export const TooltipTrigger = React.memo<TooltipTriggerProps>(
|
|
60
|
+
React.forwardRef<React.ElementRef<typeof ShadcnTooltipTrigger>, TooltipTriggerProps>(
|
|
61
|
+
(props, ref) => {
|
|
62
|
+
return <ShadcnTooltipTrigger ref={ref} {...props} />;
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
TooltipTrigger.displayName = "TooltipTrigger";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* TooltipContent - The popup content that appears
|
|
70
|
+
*/
|
|
71
|
+
export const TooltipContent = React.memo<TooltipContentProps>(
|
|
72
|
+
React.forwardRef<React.ElementRef<typeof ShadcnTooltipContent>, TooltipContentProps>(
|
|
73
|
+
(props, ref) => {
|
|
74
|
+
return <ShadcnTooltipContent ref={ref} {...props} />;
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
TooltipContent.displayName = "TooltipContent";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Primitives - Design System Foundation Components
|
|
2
|
+
// These are the atomic building blocks of the UI library
|
|
3
|
+
|
|
4
|
+
export * from "./Accordion"
|
|
5
|
+
export * from "./Alert"
|
|
6
|
+
export * from "./AlertDialog"
|
|
7
|
+
export * from "./Avatar"
|
|
8
|
+
export * from "./Badge"
|
|
9
|
+
export * from "./Button"
|
|
10
|
+
export * from "./Card"
|
|
11
|
+
export * from "./Carousel"
|
|
12
|
+
export * from "./Chart"
|
|
13
|
+
export * from "./Checkbox"
|
|
14
|
+
export * from "./Collapsible"
|
|
15
|
+
export * from "./Command"
|
|
16
|
+
export * from "./Dialog"
|
|
17
|
+
export * from "./Drawer"
|
|
18
|
+
export * from "./DropdownMenu"
|
|
19
|
+
export * from "./HoverCard"
|
|
20
|
+
export * from "./Icon"
|
|
21
|
+
export * from "./Input"
|
|
22
|
+
export * from "./InputGroup"
|
|
23
|
+
export * from "./Label"
|
|
24
|
+
export * from "./Popover"
|
|
25
|
+
export * from "./Progress"
|
|
26
|
+
export * from "./ScrollArea"
|
|
27
|
+
export * from "./Select"
|
|
28
|
+
export * from "./Separator"
|
|
29
|
+
export * from "./Sidebar"
|
|
30
|
+
export * from "./Table"
|
|
31
|
+
export * from "./Tabs"
|
|
32
|
+
export * from "./Textarea"
|
|
33
|
+
export * from "./ToggleGroup"
|
|
34
|
+
export * from "./Tooltip"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
5
|
+
import { ChevronDownIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
|
|
9
|
+
function Accordion({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
12
|
+
return <AccordionPrimitive.Root data-slot="accordion" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AccordionItem({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
19
|
+
return (
|
|
20
|
+
<AccordionPrimitive.Item
|
|
21
|
+
data-slot="accordion-item"
|
|
22
|
+
className={cn("border-b last:border-b-0", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function AccordionTrigger({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
33
|
+
return (
|
|
34
|
+
<AccordionPrimitive.Header className="flex">
|
|
35
|
+
<AccordionPrimitive.Trigger
|
|
36
|
+
data-slot="accordion-trigger"
|
|
37
|
+
className={cn(
|
|
38
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
45
|
+
</AccordionPrimitive.Trigger>
|
|
46
|
+
</AccordionPrimitive.Header>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function AccordionContent({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
55
|
+
return (
|
|
56
|
+
<AccordionPrimitive.Content
|
|
57
|
+
data-slot="accordion-content"
|
|
58
|
+
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
|
62
|
+
</AccordionPrimitive.Content>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|