@a2v2ai/uikit 0.0.36 → 0.0.38
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/Alert/Alert.stories.tsx +121 -0
- package/Alert/Alert.tsx +71 -0
- package/AlertDialog/AlertDialog.stories.tsx +665 -0
- package/AlertDialog/AlertDialog.tsx +241 -0
- package/Avatar/Avatar.stories.tsx +128 -0
- package/Avatar/Avatar.tsx +71 -0
- package/Badge/Badge.stories.tsx +76 -0
- package/Badge/Badge.tsx +39 -0
- package/Breadcrumb/Breadcrumb.stories.tsx +231 -0
- package/Breadcrumb/Breadcrumb.tsx +114 -0
- package/Button/Button.stories.tsx +684 -0
- package/Button/Button.tsx +107 -0
- package/Calendar/Calendar.stories.tsx +291 -0
- package/Calendar/Calendar.tsx +246 -0
- package/Card/Card.stories.tsx +136 -0
- package/Card/Card.tsx +96 -0
- package/Carousel/Carousel.stories.tsx +256 -0
- package/Carousel/Carousel.tsx +301 -0
- package/ChatBubble/ChatBubble.stories.tsx +339 -0
- package/ChatBubble/ChatBubble.tsx +179 -0
- package/Checkbox/Checkbox.stories.tsx +137 -0
- package/Checkbox/Checkbox.tsx +53 -0
- package/DataTable/DataTable.stories.tsx +400 -0
- package/DataTable/DataTable.tsx +207 -0
- package/Drawer/Drawer.stories.tsx +721 -0
- package/Drawer/Drawer.tsx +201 -0
- package/DropdownMenu/DropdownMenu.stories.tsx +251 -0
- package/DropdownMenu/DropdownMenu.tsx +199 -0
- package/ErrorMessage/ErrorMessage.stories.tsx +159 -0
- package/ErrorMessage/ErrorMessage.tsx +55 -0
- package/Flex/Flex.stories.tsx +390 -0
- package/Flex/Flex.tsx +102 -0
- package/IconButton/IconButton.stories.tsx +566 -0
- package/IconButton/IconButton.tsx +95 -0
- package/Input/Input.stories.tsx +566 -0
- package/Input/Input.tsx +168 -0
- package/InputOTP/InputOTP.stories.tsx +246 -0
- package/InputOTP/InputOTP.tsx +127 -0
- package/Label/Label.stories.tsx +110 -0
- package/Label/Label.tsx +44 -0
- package/Loader/Loader.stories.tsx +170 -0
- package/Loader/Loader.tsx +62 -0
- package/Menubar/Menubar.stories.tsx +382 -0
- package/Menubar/Menubar.tsx +274 -0
- package/Menubar/index.ts +18 -0
- package/Pagination/Pagination.stories.tsx +196 -0
- package/Pagination/Pagination.tsx +122 -0
- package/Popover/Popover.stories.tsx +133 -0
- package/Popover/Popover.tsx +31 -0
- package/Progress/Progress.stories.tsx +146 -0
- package/Progress/Progress.tsx +67 -0
- package/RadioGroup/RadioGroup.stories.tsx +159 -0
- package/RadioGroup/RadioGroup.tsx +68 -0
- package/ScrollArea/ScrollArea.stories.tsx +136 -0
- package/ScrollArea/ScrollArea.tsx +46 -0
- package/Select/Select.stories.tsx +378 -0
- package/Select/Select.tsx +230 -0
- package/Separator/Separator.stories.tsx +110 -0
- package/Separator/Separator.tsx +29 -0
- package/Sidebar/Sidebar.stories.tsx +340 -0
- package/Sidebar/Sidebar.tsx +414 -0
- package/Sidebar/index.ts +28 -0
- package/Skeleton/Skeleton.stories.tsx +117 -0
- package/Skeleton/Skeleton.tsx +16 -0
- package/Slider/Slider.stories.tsx +216 -0
- package/Slider/Slider.tsx +29 -0
- package/Spinner/Spinner.stories.tsx +210 -0
- package/Spinner/Spinner.tsx +78 -0
- package/Switch/Switch.stories.tsx +146 -0
- package/Switch/Switch.tsx +59 -0
- package/Table/Table.stories.tsx +510 -0
- package/Table/Table.tsx +114 -0
- package/Tabs/Tabs.stories.tsx +197 -0
- package/Tabs/Tabs.tsx +74 -0
- package/Textarea/Textarea.stories.tsx +187 -0
- package/Textarea/Textarea.tsx +73 -0
- package/Toast/Toast.stories.tsx +285 -0
- package/Toast/Toast.tsx +59 -0
- package/Tooltip/Tooltip.stories.tsx +463 -0
- package/Tooltip/Tooltip.tsx +96 -0
- package/Typography/Typography.stories.tsx +425 -0
- package/Typography/Typography.tsx +106 -0
- package/helpers.ts +5 -0
- package/{icons.js → icons.ts} +1 -1
- package/index.ts +217 -0
- package/lib/typography-types.ts +223 -0
- package/lib/utils.ts +15 -0
- package/package.json +36 -33
- package/tsconfig.json +22 -0
- package/Alert/Alert.d.ts +0 -13
- package/Alert/Alert.js +0 -25
- package/AlertDialog/AlertDialog.d.ts +0 -43
- package/AlertDialog/AlertDialog.js +0 -71
- package/Avatar/Avatar.d.ts +0 -14
- package/Avatar/Avatar.js +0 -25
- package/Badge/Badge.d.ts +0 -11
- package/Badge/Badge.js +0 -23
- package/Breadcrumb/Breadcrumb.d.ts +0 -19
- package/Breadcrumb/Breadcrumb.js +0 -23
- package/Button/Button.d.ts +0 -23
- package/Button/Button.js +0 -52
- package/Calendar/Calendar.d.ts +0 -20
- package/Calendar/Calendar.js +0 -78
- package/Card/Card.d.ts +0 -16
- package/Card/Card.js +0 -28
- package/Carousel/Carousel.d.ts +0 -37
- package/Carousel/Carousel.js +0 -132
- package/ChatBubble/ChatBubble.d.ts +0 -33
- package/ChatBubble/ChatBubble.js +0 -107
- package/Checkbox/Checkbox.d.ts +0 -12
- package/Checkbox/Checkbox.js +0 -20
- package/DataTable/DataTable.d.ts +0 -35
- package/DataTable/DataTable.js +0 -51
- package/Dialog/Dialog.d.ts +0 -35
- package/Dialog/Dialog.js +0 -130
- package/Drawer/Drawer.d.ts +0 -33
- package/Drawer/Drawer.js +0 -55
- package/DropdownMenu/DropdownMenu.d.ts +0 -27
- package/DropdownMenu/DropdownMenu.js +0 -35
- package/ErrorMessage/ErrorMessage.d.ts +0 -27
- package/ErrorMessage/ErrorMessage.js +0 -14
- package/Flex/Flex.d.ts +0 -31
- package/Flex/Flex.js +0 -64
- package/IconButton/IconButton.d.ts +0 -23
- package/IconButton/IconButton.js +0 -48
- package/Input/Input.d.ts +0 -27
- package/Input/Input.js +0 -42
- package/InputOTP/InputOTP.d.ts +0 -20
- package/InputOTP/InputOTP.js +0 -44
- package/Label/Label.d.ts +0 -13
- package/Label/Label.js +0 -19
- package/Loader/Loader.d.ts +0 -21
- package/Loader/Loader.js +0 -30
- package/Menubar/Menubar.d.ts +0 -26
- package/Menubar/Menubar.js +0 -54
- package/Menubar/index.d.ts +0 -1
- package/Menubar/index.js +0 -1
- package/Pagination/Pagination.d.ts +0 -35
- package/Pagination/Pagination.js +0 -37
- package/Popover/Popover.d.ts +0 -7
- package/Popover/Popover.js +0 -10
- package/Progress/Progress.d.ts +0 -17
- package/Progress/Progress.js +0 -33
- package/RadioGroup/RadioGroup.d.ts +0 -13
- package/RadioGroup/RadioGroup.js +0 -26
- package/ScrollArea/ScrollArea.d.ts +0 -5
- package/ScrollArea/ScrollArea.js +0 -11
- package/Select/Select.d.ts +0 -29
- package/Select/Select.js +0 -50
- package/Separator/Separator.d.ts +0 -4
- package/Separator/Separator.js +0 -7
- package/Sidebar/Sidebar.d.ts +0 -48
- package/Sidebar/Sidebar.js +0 -116
- package/Sidebar/index.d.ts +0 -2
- package/Sidebar/index.js +0 -1
- package/Skeleton/Skeleton.d.ts +0 -4
- package/Skeleton/Skeleton.js +0 -7
- package/Slider/Slider.d.ts +0 -6
- package/Slider/Slider.js +0 -7
- package/Spinner/Spinner.d.ts +0 -19
- package/Spinner/Spinner.js +0 -31
- package/Switch/Switch.d.ts +0 -12
- package/Switch/Switch.js +0 -30
- package/Table/Table.d.ts +0 -10
- package/Table/Table.js +0 -20
- package/Tabs/Tabs.d.ts +0 -15
- package/Tabs/Tabs.js +0 -24
- package/Textarea/Textarea.d.ts +0 -19
- package/Textarea/Textarea.js +0 -31
- package/Toast/Toast.d.ts +0 -12
- package/Toast/Toast.js +0 -25
- package/Tooltip/Tooltip.d.ts +0 -17
- package/Tooltip/Tooltip.js +0 -29
- package/Typography/Typography.d.ts +0 -20
- package/Typography/Typography.js +0 -43
- package/helpers.d.ts +0 -4
- package/helpers.js +0 -5
- package/icons.d.ts +0 -1
- package/index.d.ts +0 -42
- package/index.js +0 -45
- package/lib/typography-types.d.ts +0 -4
- package/lib/typography-types.js +0 -90
- package/lib/utils.d.ts +0 -3
- package/lib/utils.js +0 -14
- package/tmpclaude-2407-cwd +0 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
import { Typography } from "../Typography/Typography";
|
|
8
|
+
import { Label } from "../Label/Label";
|
|
9
|
+
import { type TextVariant, type TextColor } from "../lib/typography-types";
|
|
10
|
+
|
|
11
|
+
type SelectTriggerSize = "small" | "regular" | "large";
|
|
12
|
+
type SelectTriggerVariant = "default" | "error";
|
|
13
|
+
|
|
14
|
+
const Select = SelectPrimitive.Root;
|
|
15
|
+
|
|
16
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
17
|
+
|
|
18
|
+
const SelectValue = SelectPrimitive.Value;
|
|
19
|
+
|
|
20
|
+
const selectTriggerVariants = cva(
|
|
21
|
+
"flex w-full items-center justify-between whitespace-nowrap border bg-white text-main-950 ring-offset-white placeholder:text-grey-400 focus:outline-none focus:ring-2 focus:ring-offset-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
size: {
|
|
25
|
+
small: "h-8 px-3 text-sm rounded-md",
|
|
26
|
+
regular: "h-9 px-3 text-sm rounded-lg",
|
|
27
|
+
large: "h-10 px-3 text-base rounded-lg",
|
|
28
|
+
},
|
|
29
|
+
variant: {
|
|
30
|
+
default: "border-grey-300 focus:ring-main-950",
|
|
31
|
+
error: "border-error-500 focus:ring-error-200",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
size: "regular",
|
|
36
|
+
variant: "default",
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export interface SelectTriggerProps
|
|
42
|
+
extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> {
|
|
43
|
+
size?: SelectTriggerSize;
|
|
44
|
+
variant?: SelectTriggerVariant;
|
|
45
|
+
label?: string;
|
|
46
|
+
labelVariant?: TextVariant;
|
|
47
|
+
labelColor?: TextColor;
|
|
48
|
+
error?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const SelectTrigger = React.forwardRef<
|
|
52
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
53
|
+
SelectTriggerProps
|
|
54
|
+
>(
|
|
55
|
+
(
|
|
56
|
+
{
|
|
57
|
+
className,
|
|
58
|
+
size,
|
|
59
|
+
variant,
|
|
60
|
+
label,
|
|
61
|
+
labelVariant = "body2",
|
|
62
|
+
labelColor = "main-800",
|
|
63
|
+
error,
|
|
64
|
+
children,
|
|
65
|
+
id,
|
|
66
|
+
...props
|
|
67
|
+
},
|
|
68
|
+
ref
|
|
69
|
+
) => {
|
|
70
|
+
const computedVariant = error ? "error" : variant;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div className="flex flex-col gap-2 w-full">
|
|
74
|
+
{label && (
|
|
75
|
+
<Label htmlFor={id} variant={labelVariant} color={labelColor}>
|
|
76
|
+
{label}
|
|
77
|
+
</Label>
|
|
78
|
+
)}
|
|
79
|
+
<SelectPrimitive.Trigger
|
|
80
|
+
ref={ref}
|
|
81
|
+
id={id}
|
|
82
|
+
className={cn(
|
|
83
|
+
selectTriggerVariants({ size, variant: computedVariant }),
|
|
84
|
+
className
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
{children}
|
|
89
|
+
<SelectPrimitive.Icon asChild>
|
|
90
|
+
<ChevronDown className="size-4 opacity-50" />
|
|
91
|
+
</SelectPrimitive.Icon>
|
|
92
|
+
</SelectPrimitive.Trigger>
|
|
93
|
+
{error && (
|
|
94
|
+
<Typography variant="caption" color="error-600" className="mt-1">
|
|
95
|
+
{error}
|
|
96
|
+
</Typography>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
103
|
+
|
|
104
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
105
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
106
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
107
|
+
>(({ className, ...props }, ref) => (
|
|
108
|
+
<SelectPrimitive.ScrollUpButton
|
|
109
|
+
ref={ref}
|
|
110
|
+
className={cn(
|
|
111
|
+
"flex cursor-default items-center justify-center py-1",
|
|
112
|
+
className
|
|
113
|
+
)}
|
|
114
|
+
{...props}
|
|
115
|
+
>
|
|
116
|
+
<ChevronUp className="size-4" />
|
|
117
|
+
</SelectPrimitive.ScrollUpButton>
|
|
118
|
+
));
|
|
119
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
120
|
+
|
|
121
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
122
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
123
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
124
|
+
>(({ className, ...props }, ref) => (
|
|
125
|
+
<SelectPrimitive.ScrollDownButton
|
|
126
|
+
ref={ref}
|
|
127
|
+
className={cn(
|
|
128
|
+
"flex cursor-default items-center justify-center py-1",
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
{...props}
|
|
132
|
+
>
|
|
133
|
+
<ChevronDown className="size-4" />
|
|
134
|
+
</SelectPrimitive.ScrollDownButton>
|
|
135
|
+
));
|
|
136
|
+
SelectScrollDownButton.displayName =
|
|
137
|
+
SelectPrimitive.ScrollDownButton.displayName;
|
|
138
|
+
|
|
139
|
+
const SelectContent = React.forwardRef<
|
|
140
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
141
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
142
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
143
|
+
<SelectPrimitive.Portal>
|
|
144
|
+
<SelectPrimitive.Content
|
|
145
|
+
ref={ref}
|
|
146
|
+
className={cn(
|
|
147
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-grey-200 bg-white text-main-950 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
148
|
+
position === "popper" &&
|
|
149
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
150
|
+
className
|
|
151
|
+
)}
|
|
152
|
+
position={position}
|
|
153
|
+
{...props}
|
|
154
|
+
>
|
|
155
|
+
<SelectScrollUpButton />
|
|
156
|
+
<SelectPrimitive.Viewport
|
|
157
|
+
className={cn(
|
|
158
|
+
"p-1",
|
|
159
|
+
position === "popper" &&
|
|
160
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
161
|
+
)}
|
|
162
|
+
>
|
|
163
|
+
{children}
|
|
164
|
+
</SelectPrimitive.Viewport>
|
|
165
|
+
<SelectScrollDownButton />
|
|
166
|
+
</SelectPrimitive.Content>
|
|
167
|
+
</SelectPrimitive.Portal>
|
|
168
|
+
));
|
|
169
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
170
|
+
|
|
171
|
+
const SelectLabel = React.forwardRef<
|
|
172
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
173
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
174
|
+
>(({ className, ...props }, ref) => (
|
|
175
|
+
<SelectPrimitive.Label
|
|
176
|
+
ref={ref}
|
|
177
|
+
className={cn("px-2 py-1.5 text-sm font-semibold text-grey-500", className)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
));
|
|
181
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
182
|
+
|
|
183
|
+
const SelectItem = React.forwardRef<
|
|
184
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
185
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
186
|
+
>(({ className, children, ...props }, ref) => (
|
|
187
|
+
<SelectPrimitive.Item
|
|
188
|
+
ref={ref}
|
|
189
|
+
className={cn(
|
|
190
|
+
"relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-grey-100 focus:text-main-950 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
191
|
+
className
|
|
192
|
+
)}
|
|
193
|
+
{...props}
|
|
194
|
+
>
|
|
195
|
+
<span className="absolute right-2 flex size-3.5 items-center justify-center">
|
|
196
|
+
<SelectPrimitive.ItemIndicator>
|
|
197
|
+
<Check className="size-4" />
|
|
198
|
+
</SelectPrimitive.ItemIndicator>
|
|
199
|
+
</span>
|
|
200
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
201
|
+
</SelectPrimitive.Item>
|
|
202
|
+
));
|
|
203
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
204
|
+
|
|
205
|
+
const SelectSeparator = React.forwardRef<
|
|
206
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
207
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
208
|
+
>(({ className, ...props }, ref) => (
|
|
209
|
+
<SelectPrimitive.Separator
|
|
210
|
+
ref={ref}
|
|
211
|
+
className={cn("-mx-1 my-1 h-px bg-grey-100", className)}
|
|
212
|
+
{...props}
|
|
213
|
+
/>
|
|
214
|
+
));
|
|
215
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
216
|
+
|
|
217
|
+
export {
|
|
218
|
+
Select,
|
|
219
|
+
SelectGroup,
|
|
220
|
+
SelectValue,
|
|
221
|
+
SelectTrigger,
|
|
222
|
+
SelectContent,
|
|
223
|
+
SelectLabel,
|
|
224
|
+
SelectItem,
|
|
225
|
+
SelectSeparator,
|
|
226
|
+
SelectScrollUpButton,
|
|
227
|
+
SelectScrollDownButton,
|
|
228
|
+
selectTriggerVariants,
|
|
229
|
+
};
|
|
230
|
+
export type { SelectTriggerSize, SelectTriggerVariant };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import { Flex } from "../Flex/Flex"
|
|
4
|
+
import { Typography } from "../Typography/Typography"
|
|
5
|
+
import { Separator } from "./Separator"
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Separator> = {
|
|
8
|
+
title: "Components/Separator",
|
|
9
|
+
component: Separator,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
orientation: {
|
|
15
|
+
control: "select",
|
|
16
|
+
options: ["horizontal", "vertical"],
|
|
17
|
+
description: "The orientation of the separator",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
tags: ["autodocs"],
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof meta>
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
render: () => (
|
|
28
|
+
<div className="w-[300px]">
|
|
29
|
+
<div className="space-y-1">
|
|
30
|
+
<h4 className="text-sm font-medium leading-none text-white">Radix Primitives</h4>
|
|
31
|
+
<p className="text-sm text-grey-400">An open-source UI component library.</p>
|
|
32
|
+
</div>
|
|
33
|
+
<Separator className="my-4" />
|
|
34
|
+
<div className="flex h-5 items-center space-x-4 text-sm text-grey-400">
|
|
35
|
+
<div>Blog</div>
|
|
36
|
+
<Separator orientation="vertical" />
|
|
37
|
+
<div>Docs</div>
|
|
38
|
+
<Separator orientation="vertical" />
|
|
39
|
+
<div>Source</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Horizontal: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<div className="w-[300px]">
|
|
48
|
+
<p className="text-sm text-grey-400">Above separator</p>
|
|
49
|
+
<Separator className="my-4" />
|
|
50
|
+
<p className="text-sm text-grey-400">Below separator</p>
|
|
51
|
+
</div>
|
|
52
|
+
),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const Vertical: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<div className="flex h-5 items-center space-x-4 text-sm text-grey-400">
|
|
58
|
+
<div>First</div>
|
|
59
|
+
<Separator orientation="vertical" />
|
|
60
|
+
<div>Second</div>
|
|
61
|
+
<Separator orientation="vertical" />
|
|
62
|
+
<div>Third</div>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const AllVariants: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<Flex gap={8}>
|
|
70
|
+
<Typography variant="h4" className="text-white">Separator Orientations</Typography>
|
|
71
|
+
|
|
72
|
+
<Flex gap={4}>
|
|
73
|
+
<Typography variant="body2" className="text-grey-400">Horizontal</Typography>
|
|
74
|
+
<div className="w-[300px] bg-white p-4 rounded-lg">
|
|
75
|
+
<p className="text-sm text-main-950">Section 1</p>
|
|
76
|
+
<Separator className="my-3" />
|
|
77
|
+
<p className="text-sm text-main-950">Section 2</p>
|
|
78
|
+
<Separator className="my-3" />
|
|
79
|
+
<p className="text-sm text-main-950">Section 3</p>
|
|
80
|
+
</div>
|
|
81
|
+
</Flex>
|
|
82
|
+
|
|
83
|
+
<Flex gap={4}>
|
|
84
|
+
<Typography variant="body2" className="text-grey-400">Vertical</Typography>
|
|
85
|
+
<div className="bg-white p-4 rounded-lg">
|
|
86
|
+
<div className="flex h-5 items-center space-x-4 text-sm">
|
|
87
|
+
<div>Home</div>
|
|
88
|
+
<Separator orientation="vertical" />
|
|
89
|
+
<div>Products</div>
|
|
90
|
+
<Separator orientation="vertical" />
|
|
91
|
+
<div>About</div>
|
|
92
|
+
<Separator orientation="vertical" />
|
|
93
|
+
<div>Contact</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</Flex>
|
|
97
|
+
|
|
98
|
+
<Flex gap={4}>
|
|
99
|
+
<Typography variant="body2" className="text-grey-400">In List</Typography>
|
|
100
|
+
<div className="w-[200px] bg-white rounded-lg">
|
|
101
|
+
<div className="p-3 text-sm">Item 1</div>
|
|
102
|
+
<Separator />
|
|
103
|
+
<div className="p-3 text-sm">Item 2</div>
|
|
104
|
+
<Separator />
|
|
105
|
+
<div className="p-3 text-sm">Item 3</div>
|
|
106
|
+
</div>
|
|
107
|
+
</Flex>
|
|
108
|
+
</Flex>
|
|
109
|
+
),
|
|
110
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils"
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(
|
|
10
|
+
(
|
|
11
|
+
{ className, orientation = "horizontal", decorative = true, ...props },
|
|
12
|
+
ref
|
|
13
|
+
) => (
|
|
14
|
+
<SeparatorPrimitive.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
decorative={decorative}
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
className={cn(
|
|
19
|
+
"shrink-0 bg-grey-200",
|
|
20
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName
|
|
28
|
+
|
|
29
|
+
export { Separator }
|