@a2v2ai/uikit 0.0.37 → 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 +5 -2
- 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/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
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { ErrorMessage } from "./ErrorMessage"
|
|
4
|
+
import { Input } from "../Input/Input"
|
|
5
|
+
import { Label } from "../Label/Label"
|
|
6
|
+
import { Flex } from "../Flex/Flex"
|
|
7
|
+
import { Typography } from "../Typography/Typography"
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof ErrorMessage> = {
|
|
10
|
+
title: "Components/ErrorMessage",
|
|
11
|
+
component: ErrorMessage,
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: "centered",
|
|
14
|
+
},
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
argTypes: {
|
|
17
|
+
name: {
|
|
18
|
+
control: "text",
|
|
19
|
+
description: "The field name to check for errors",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof ErrorMessage>
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<div className="w-72">
|
|
30
|
+
<Label htmlFor="email">Email</Label>
|
|
31
|
+
<Input id="email" placeholder="Enter email" className="border-error-500" />
|
|
32
|
+
<ErrorMessage
|
|
33
|
+
name="email"
|
|
34
|
+
errors={{ email: "Please enter a valid email address" }}
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const WithTouched: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<Flex gap={4} className="w-72">
|
|
43
|
+
<div>
|
|
44
|
+
<Label htmlFor="username">Username (touched)</Label>
|
|
45
|
+
<Input id="username" placeholder="Enter username" className="border-error-500" />
|
|
46
|
+
<ErrorMessage
|
|
47
|
+
name="username"
|
|
48
|
+
errors={{ username: "Username is required" }}
|
|
49
|
+
touched={{ username: true }}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
<div>
|
|
53
|
+
<Label htmlFor="password">Password (not touched - no error shown)</Label>
|
|
54
|
+
<Input id="password" type="password" placeholder="Enter password" />
|
|
55
|
+
<ErrorMessage
|
|
56
|
+
name="password"
|
|
57
|
+
errors={{ password: "Password is required" }}
|
|
58
|
+
touched={{ password: false }}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</Flex>
|
|
62
|
+
),
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const NoError: Story = {
|
|
66
|
+
render: () => (
|
|
67
|
+
<div className="w-72">
|
|
68
|
+
<Label htmlFor="name">Name</Label>
|
|
69
|
+
<Input id="name" placeholder="Enter name" />
|
|
70
|
+
<ErrorMessage
|
|
71
|
+
name="name"
|
|
72
|
+
errors={{}}
|
|
73
|
+
/>
|
|
74
|
+
<Typography variant="caption" color="grey-500" className="mt-2">
|
|
75
|
+
No error message shown when field has no errors
|
|
76
|
+
</Typography>
|
|
77
|
+
</div>
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const FormExample: Story = {
|
|
82
|
+
render: () => {
|
|
83
|
+
const [errors] = React.useState({
|
|
84
|
+
email: "Please enter a valid email address",
|
|
85
|
+
password: "Password must be at least 8 characters",
|
|
86
|
+
})
|
|
87
|
+
const [touched] = React.useState({
|
|
88
|
+
email: true,
|
|
89
|
+
password: true,
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Flex gap={4} className="w-80">
|
|
94
|
+
<Typography variant="h4">Sign Up Form</Typography>
|
|
95
|
+
<div>
|
|
96
|
+
<Label htmlFor="form-email">Email</Label>
|
|
97
|
+
<Input
|
|
98
|
+
id="form-email"
|
|
99
|
+
type="email"
|
|
100
|
+
placeholder="you@example.com"
|
|
101
|
+
className={touched.email && errors.email ? "border-error-500 focus-visible:ring-error-500" : ""}
|
|
102
|
+
/>
|
|
103
|
+
<ErrorMessage name="email" errors={errors} touched={touched} />
|
|
104
|
+
</div>
|
|
105
|
+
<div>
|
|
106
|
+
<Label htmlFor="form-password">Password</Label>
|
|
107
|
+
<Input
|
|
108
|
+
id="form-password"
|
|
109
|
+
type="password"
|
|
110
|
+
placeholder="••••••••"
|
|
111
|
+
className={touched.password && errors.password ? "border-error-500 focus-visible:ring-error-500" : ""}
|
|
112
|
+
/>
|
|
113
|
+
<ErrorMessage name="password" errors={errors} touched={touched} />
|
|
114
|
+
</div>
|
|
115
|
+
</Flex>
|
|
116
|
+
)
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const AllVariants: Story = {
|
|
121
|
+
render: () => (
|
|
122
|
+
<Flex gap={6} className="w-80">
|
|
123
|
+
<div>
|
|
124
|
+
<Typography variant="h4" className="mb-4">Error Message Examples</Typography>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div>
|
|
128
|
+
<Typography variant="body2" color="grey-600" className="mb-2">Basic Error</Typography>
|
|
129
|
+
<Label htmlFor="v1">Field with error</Label>
|
|
130
|
+
<Input id="v1" className="border-error-500" />
|
|
131
|
+
<ErrorMessage name="field" errors={{ field: "This field is required" }} />
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<div>
|
|
135
|
+
<Typography variant="body2" color="grey-600" className="mb-2">Long Error Message</Typography>
|
|
136
|
+
<Label htmlFor="v2">Email</Label>
|
|
137
|
+
<Input id="v2" className="border-error-500" />
|
|
138
|
+
<ErrorMessage
|
|
139
|
+
name="email"
|
|
140
|
+
errors={{ email: "The email address you entered is not valid. Please check the format and try again." }}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div>
|
|
145
|
+
<Typography variant="body2" color="grey-600" className="mb-2">With Custom Class</Typography>
|
|
146
|
+
<Label htmlFor="v3">Username</Label>
|
|
147
|
+
<Input id="v3" className="border-error-500" />
|
|
148
|
+
<ErrorMessage
|
|
149
|
+
name="username"
|
|
150
|
+
errors={{ username: "Username already taken" }}
|
|
151
|
+
className="font-medium"
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
</Flex>
|
|
155
|
+
),
|
|
156
|
+
parameters: {
|
|
157
|
+
layout: "padded",
|
|
158
|
+
},
|
|
159
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Typography, type TypographyColor } from "../Typography/Typography"
|
|
3
|
+
import { cn } from "../lib/utils"
|
|
4
|
+
|
|
5
|
+
export interface ErrorMessageProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "color"> {
|
|
6
|
+
/**
|
|
7
|
+
* The field name to check for errors
|
|
8
|
+
*/
|
|
9
|
+
name: string
|
|
10
|
+
/**
|
|
11
|
+
* Object containing error messages keyed by field name
|
|
12
|
+
*/
|
|
13
|
+
errors: Record<string, string | undefined>
|
|
14
|
+
/**
|
|
15
|
+
* Optional object containing touched state keyed by field name
|
|
16
|
+
* If provided, error is only shown when field is touched
|
|
17
|
+
*/
|
|
18
|
+
touched?: Record<string, boolean | undefined>
|
|
19
|
+
/**
|
|
20
|
+
* Color variant for the error message
|
|
21
|
+
* @default "error-600"
|
|
22
|
+
*/
|
|
23
|
+
color?: TypographyColor
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ErrorMessage({
|
|
27
|
+
name,
|
|
28
|
+
errors,
|
|
29
|
+
touched,
|
|
30
|
+
className,
|
|
31
|
+
color = "error-600",
|
|
32
|
+
...props
|
|
33
|
+
}: ErrorMessageProps) {
|
|
34
|
+
const hasError = errors && typeof errors[name] === "string"
|
|
35
|
+
const shouldShow = touched ? hasError && touched[name] : hasError
|
|
36
|
+
|
|
37
|
+
if (!shouldShow) {
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Typography
|
|
43
|
+
variant="caption"
|
|
44
|
+
color={color}
|
|
45
|
+
className={cn("mt-1", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
{errors[name]}
|
|
49
|
+
</Typography>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ErrorMessage.displayName = "ErrorMessage"
|
|
54
|
+
|
|
55
|
+
export { ErrorMessage }
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { Typography } from "../Typography/Typography"
|
|
3
|
+
import { Flex } from "./Flex"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Flex> = {
|
|
6
|
+
title: "Layout/Flex",
|
|
7
|
+
component: Flex,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
argTypes: {
|
|
13
|
+
direction: {
|
|
14
|
+
control: "select",
|
|
15
|
+
options: ["row", "column", "row-reverse", "column-reverse"],
|
|
16
|
+
description: "The flex direction",
|
|
17
|
+
},
|
|
18
|
+
align: {
|
|
19
|
+
control: "select",
|
|
20
|
+
options: ["start", "center", "end", "stretch", "baseline"],
|
|
21
|
+
description: "Align items (cross axis)",
|
|
22
|
+
},
|
|
23
|
+
justify: {
|
|
24
|
+
control: "select",
|
|
25
|
+
options: ["start", "center", "end", "between", "around", "evenly"],
|
|
26
|
+
description: "Justify content (main axis)",
|
|
27
|
+
},
|
|
28
|
+
wrap: {
|
|
29
|
+
control: "select",
|
|
30
|
+
options: ["nowrap", "wrap", "wrap-reverse"],
|
|
31
|
+
description: "Flex wrap behavior",
|
|
32
|
+
},
|
|
33
|
+
gap: {
|
|
34
|
+
control: "select",
|
|
35
|
+
options: [0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48],
|
|
36
|
+
description: "Gap between items",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default meta
|
|
42
|
+
type Story = StoryObj<typeof Flex>
|
|
43
|
+
|
|
44
|
+
const Box = ({ children, className = "" }: { children?: React.ReactNode; className?: string }) => (
|
|
45
|
+
<div className={`bg-accent-100 border border-accent-300 rounded-md p-4 text-accent-700 font-medium ${className}`}>
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
export const Default: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
direction: "column",
|
|
53
|
+
align: "stretch",
|
|
54
|
+
justify: "start",
|
|
55
|
+
gap: 4,
|
|
56
|
+
},
|
|
57
|
+
render: (args) => (
|
|
58
|
+
<Flex {...args} className="w-64">
|
|
59
|
+
<Box>Item 1</Box>
|
|
60
|
+
<Box>Item 2</Box>
|
|
61
|
+
<Box>Item 3</Box>
|
|
62
|
+
</Flex>
|
|
63
|
+
),
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Row: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<Flex direction="row" gap={4}>
|
|
69
|
+
<Box>Item 1</Box>
|
|
70
|
+
<Box>Item 2</Box>
|
|
71
|
+
<Box>Item 3</Box>
|
|
72
|
+
</Flex>
|
|
73
|
+
),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const Column: Story = {
|
|
77
|
+
render: () => (
|
|
78
|
+
<Flex direction="column" gap={4}>
|
|
79
|
+
<Box>Item 1</Box>
|
|
80
|
+
<Box>Item 2</Box>
|
|
81
|
+
<Box>Item 3</Box>
|
|
82
|
+
</Flex>
|
|
83
|
+
),
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const RowReverse: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<Flex direction="row-reverse" gap={4}>
|
|
89
|
+
<Box>Item 1</Box>
|
|
90
|
+
<Box>Item 2</Box>
|
|
91
|
+
<Box>Item 3</Box>
|
|
92
|
+
</Flex>
|
|
93
|
+
),
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const ColumnReverse: Story = {
|
|
97
|
+
render: () => (
|
|
98
|
+
<Flex direction="column-reverse" gap={4}>
|
|
99
|
+
<Box>Item 1</Box>
|
|
100
|
+
<Box>Item 2</Box>
|
|
101
|
+
<Box>Item 3</Box>
|
|
102
|
+
</Flex>
|
|
103
|
+
),
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const AlignStart: Story = {
|
|
107
|
+
render: () => (
|
|
108
|
+
<Flex direction="row" align="start" gap={4} className="h-32 bg-main-50 p-4 rounded-lg">
|
|
109
|
+
<Box>Short</Box>
|
|
110
|
+
<Box className="h-full">Tall</Box>
|
|
111
|
+
<Box>Short</Box>
|
|
112
|
+
</Flex>
|
|
113
|
+
),
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const AlignCenter: Story = {
|
|
117
|
+
render: () => (
|
|
118
|
+
<Flex direction="row" align="center" gap={4} className="h-32 bg-main-50 p-4 rounded-lg">
|
|
119
|
+
<Box>Short</Box>
|
|
120
|
+
<Box className="h-full">Tall</Box>
|
|
121
|
+
<Box>Short</Box>
|
|
122
|
+
</Flex>
|
|
123
|
+
),
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const AlignEnd: Story = {
|
|
127
|
+
render: () => (
|
|
128
|
+
<Flex direction="row" align="end" gap={4} className="h-32 bg-main-50 p-4 rounded-lg">
|
|
129
|
+
<Box>Short</Box>
|
|
130
|
+
<Box className="h-full">Tall</Box>
|
|
131
|
+
<Box>Short</Box>
|
|
132
|
+
</Flex>
|
|
133
|
+
),
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const AlignStretch: Story = {
|
|
137
|
+
render: () => (
|
|
138
|
+
<Flex direction="row" align="stretch" gap={4} className="h-32 bg-main-50 p-4 rounded-lg">
|
|
139
|
+
<Box>Item 1</Box>
|
|
140
|
+
<Box>Item 2</Box>
|
|
141
|
+
<Box>Item 3</Box>
|
|
142
|
+
</Flex>
|
|
143
|
+
),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const JustifyStart: Story = {
|
|
147
|
+
render: () => (
|
|
148
|
+
<Flex direction="row" justify="start" gap={4} className="w-96 bg-main-50 p-4 rounded-lg">
|
|
149
|
+
<Box>1</Box>
|
|
150
|
+
<Box>2</Box>
|
|
151
|
+
<Box>3</Box>
|
|
152
|
+
</Flex>
|
|
153
|
+
),
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export const JustifyCenter: Story = {
|
|
157
|
+
render: () => (
|
|
158
|
+
<Flex direction="row" justify="center" gap={4} className="w-96 bg-main-50 p-4 rounded-lg">
|
|
159
|
+
<Box>1</Box>
|
|
160
|
+
<Box>2</Box>
|
|
161
|
+
<Box>3</Box>
|
|
162
|
+
</Flex>
|
|
163
|
+
),
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const JustifyEnd: Story = {
|
|
167
|
+
render: () => (
|
|
168
|
+
<Flex direction="row" justify="end" gap={4} className="w-96 bg-main-50 p-4 rounded-lg">
|
|
169
|
+
<Box>1</Box>
|
|
170
|
+
<Box>2</Box>
|
|
171
|
+
<Box>3</Box>
|
|
172
|
+
</Flex>
|
|
173
|
+
),
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export const JustifyBetween: Story = {
|
|
177
|
+
render: () => (
|
|
178
|
+
<Flex direction="row" justify="between" className="w-96 bg-main-50 p-4 rounded-lg">
|
|
179
|
+
<Box>1</Box>
|
|
180
|
+
<Box>2</Box>
|
|
181
|
+
<Box>3</Box>
|
|
182
|
+
</Flex>
|
|
183
|
+
),
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const JustifyAround: Story = {
|
|
187
|
+
render: () => (
|
|
188
|
+
<Flex direction="row" justify="around" className="w-96 bg-main-50 p-4 rounded-lg">
|
|
189
|
+
<Box>1</Box>
|
|
190
|
+
<Box>2</Box>
|
|
191
|
+
<Box>3</Box>
|
|
192
|
+
</Flex>
|
|
193
|
+
),
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export const JustifyEvenly: Story = {
|
|
197
|
+
render: () => (
|
|
198
|
+
<Flex direction="row" justify="evenly" className="w-96 bg-main-50 p-4 rounded-lg">
|
|
199
|
+
<Box>1</Box>
|
|
200
|
+
<Box>2</Box>
|
|
201
|
+
<Box>3</Box>
|
|
202
|
+
</Flex>
|
|
203
|
+
),
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export const WrapEnabled: Story = {
|
|
207
|
+
render: () => (
|
|
208
|
+
<Flex direction="row" wrap="wrap" gap={4} className="w-64 bg-main-50 p-4 rounded-lg">
|
|
209
|
+
<Box>Item 1</Box>
|
|
210
|
+
<Box>Item 2</Box>
|
|
211
|
+
<Box>Item 3</Box>
|
|
212
|
+
<Box>Item 4</Box>
|
|
213
|
+
<Box>Item 5</Box>
|
|
214
|
+
<Box>Item 6</Box>
|
|
215
|
+
</Flex>
|
|
216
|
+
),
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export const GapSizes: Story = {
|
|
220
|
+
render: () => (
|
|
221
|
+
<Flex gap={8}>
|
|
222
|
+
<Typography variant="subtitle1" color="main-700">Gap Sizes</Typography>
|
|
223
|
+
|
|
224
|
+
<Flex gap={4}>
|
|
225
|
+
<Typography variant="body2" color="main-500">gap={0}</Typography>
|
|
226
|
+
<Flex direction="row" gap={0} className="bg-main-50 p-2 rounded-lg">
|
|
227
|
+
<Box>1</Box>
|
|
228
|
+
<Box>2</Box>
|
|
229
|
+
<Box>3</Box>
|
|
230
|
+
</Flex>
|
|
231
|
+
</Flex>
|
|
232
|
+
|
|
233
|
+
<Flex gap={4}>
|
|
234
|
+
<Typography variant="body2" color="main-500">gap={2}</Typography>
|
|
235
|
+
<Flex direction="row" gap={2} className="bg-main-50 p-2 rounded-lg">
|
|
236
|
+
<Box>1</Box>
|
|
237
|
+
<Box>2</Box>
|
|
238
|
+
<Box>3</Box>
|
|
239
|
+
</Flex>
|
|
240
|
+
</Flex>
|
|
241
|
+
|
|
242
|
+
<Flex gap={4}>
|
|
243
|
+
<Typography variant="body2" color="main-500">gap={4}</Typography>
|
|
244
|
+
<Flex direction="row" gap={4} className="bg-main-50 p-2 rounded-lg">
|
|
245
|
+
<Box>1</Box>
|
|
246
|
+
<Box>2</Box>
|
|
247
|
+
<Box>3</Box>
|
|
248
|
+
</Flex>
|
|
249
|
+
</Flex>
|
|
250
|
+
|
|
251
|
+
<Flex gap={4}>
|
|
252
|
+
<Typography variant="body2" color="main-500">gap={8}</Typography>
|
|
253
|
+
<Flex direction="row" gap={8} className="bg-main-50 p-2 rounded-lg">
|
|
254
|
+
<Box>1</Box>
|
|
255
|
+
<Box>2</Box>
|
|
256
|
+
<Box>3</Box>
|
|
257
|
+
</Flex>
|
|
258
|
+
</Flex>
|
|
259
|
+
</Flex>
|
|
260
|
+
),
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export const CenteredContent: Story = {
|
|
264
|
+
render: () => (
|
|
265
|
+
<Flex
|
|
266
|
+
direction="row"
|
|
267
|
+
align="center"
|
|
268
|
+
justify="center"
|
|
269
|
+
className="w-96 h-48 bg-main-50 rounded-lg border-2 border-dashed border-main-300"
|
|
270
|
+
>
|
|
271
|
+
<Box>Centered Content</Box>
|
|
272
|
+
</Flex>
|
|
273
|
+
),
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export const Navbar: Story = {
|
|
277
|
+
render: () => (
|
|
278
|
+
<Flex
|
|
279
|
+
direction="row"
|
|
280
|
+
align="center"
|
|
281
|
+
justify="between"
|
|
282
|
+
className="w-full max-w-2xl bg-main-900 text-white px-6 py-3 rounded-lg"
|
|
283
|
+
>
|
|
284
|
+
<Typography variant="h6" className="text-white">Logo</Typography>
|
|
285
|
+
<Flex direction="row" gap={6}>
|
|
286
|
+
<Typography variant="body2" className="text-main-300 hover:text-white cursor-pointer">Home</Typography>
|
|
287
|
+
<Typography variant="body2" className="text-main-300 hover:text-white cursor-pointer">About</Typography>
|
|
288
|
+
<Typography variant="body2" className="text-main-300 hover:text-white cursor-pointer">Contact</Typography>
|
|
289
|
+
</Flex>
|
|
290
|
+
<Box className="bg-accent-500 border-accent-600 text-white text-sm py-2">Sign In</Box>
|
|
291
|
+
</Flex>
|
|
292
|
+
),
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export const CardLayout: Story = {
|
|
296
|
+
render: () => (
|
|
297
|
+
<Flex direction="row" wrap="wrap" gap={4} className="max-w-xl">
|
|
298
|
+
{[1, 2, 3, 4, 5, 6].map((i) => (
|
|
299
|
+
<Flex
|
|
300
|
+
key={i}
|
|
301
|
+
gap={2}
|
|
302
|
+
className="w-40 bg-white border border-main-200 rounded-lg p-4 shadow-sm"
|
|
303
|
+
>
|
|
304
|
+
<div className="w-full h-20 bg-main-100 rounded-md" />
|
|
305
|
+
<Typography variant="subtitle2">Card {i}</Typography>
|
|
306
|
+
<Typography variant="body3" color="main-500">Description text</Typography>
|
|
307
|
+
</Flex>
|
|
308
|
+
))}
|
|
309
|
+
</Flex>
|
|
310
|
+
),
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export const AllVariants: Story = {
|
|
314
|
+
render: () => (
|
|
315
|
+
<Flex gap={12}>
|
|
316
|
+
{/* Direction */}
|
|
317
|
+
<Flex gap={4}>
|
|
318
|
+
<Typography variant="subtitle1" color="main-700">Direction</Typography>
|
|
319
|
+
<Flex direction="row" gap={8} wrap="wrap">
|
|
320
|
+
<Flex gap={2}>
|
|
321
|
+
<Typography variant="body3" color="main-500">row</Typography>
|
|
322
|
+
<Flex direction="row" gap={2} className="bg-main-50 p-3 rounded-lg">
|
|
323
|
+
<Box className="text-xs py-2 px-3">1</Box>
|
|
324
|
+
<Box className="text-xs py-2 px-3">2</Box>
|
|
325
|
+
<Box className="text-xs py-2 px-3">3</Box>
|
|
326
|
+
</Flex>
|
|
327
|
+
</Flex>
|
|
328
|
+
<Flex gap={2}>
|
|
329
|
+
<Typography variant="body3" color="main-500">column</Typography>
|
|
330
|
+
<Flex direction="column" gap={2} className="bg-main-50 p-3 rounded-lg">
|
|
331
|
+
<Box className="text-xs py-2 px-3">1</Box>
|
|
332
|
+
<Box className="text-xs py-2 px-3">2</Box>
|
|
333
|
+
<Box className="text-xs py-2 px-3">3</Box>
|
|
334
|
+
</Flex>
|
|
335
|
+
</Flex>
|
|
336
|
+
<Flex gap={2}>
|
|
337
|
+
<Typography variant="body3" color="main-500">row-reverse</Typography>
|
|
338
|
+
<Flex direction="row-reverse" gap={2} className="bg-main-50 p-3 rounded-lg">
|
|
339
|
+
<Box className="text-xs py-2 px-3">1</Box>
|
|
340
|
+
<Box className="text-xs py-2 px-3">2</Box>
|
|
341
|
+
<Box className="text-xs py-2 px-3">3</Box>
|
|
342
|
+
</Flex>
|
|
343
|
+
</Flex>
|
|
344
|
+
<Flex gap={2}>
|
|
345
|
+
<Typography variant="body3" color="main-500">column-reverse</Typography>
|
|
346
|
+
<Flex direction="column-reverse" gap={2} className="bg-main-50 p-3 rounded-lg">
|
|
347
|
+
<Box className="text-xs py-2 px-3">1</Box>
|
|
348
|
+
<Box className="text-xs py-2 px-3">2</Box>
|
|
349
|
+
<Box className="text-xs py-2 px-3">3</Box>
|
|
350
|
+
</Flex>
|
|
351
|
+
</Flex>
|
|
352
|
+
</Flex>
|
|
353
|
+
</Flex>
|
|
354
|
+
|
|
355
|
+
{/* Alignment */}
|
|
356
|
+
<Flex gap={4}>
|
|
357
|
+
<Typography variant="subtitle1" color="main-700">Align Items</Typography>
|
|
358
|
+
<Flex direction="row" gap={8} wrap="wrap">
|
|
359
|
+
{(["start", "center", "end", "stretch"] as const).map((alignment) => (
|
|
360
|
+
<Flex key={alignment} gap={2}>
|
|
361
|
+
<Typography variant="body3" color="main-500">{alignment}</Typography>
|
|
362
|
+
<Flex direction="row" align={alignment} gap={2} className="h-24 bg-main-50 p-3 rounded-lg">
|
|
363
|
+
<Box className="text-xs py-2 px-3">A</Box>
|
|
364
|
+
<Box className="text-xs py-4 px-3">B</Box>
|
|
365
|
+
<Box className="text-xs py-2 px-3">C</Box>
|
|
366
|
+
</Flex>
|
|
367
|
+
</Flex>
|
|
368
|
+
))}
|
|
369
|
+
</Flex>
|
|
370
|
+
</Flex>
|
|
371
|
+
|
|
372
|
+
{/* Justify */}
|
|
373
|
+
<Flex gap={4}>
|
|
374
|
+
<Typography variant="subtitle1" color="main-700">Justify Content</Typography>
|
|
375
|
+
<Flex gap={4}>
|
|
376
|
+
{(["start", "center", "end", "between", "around", "evenly"] as const).map((justification) => (
|
|
377
|
+
<Flex key={justification} gap={2}>
|
|
378
|
+
<Typography variant="body3" color="main-500">{justification}</Typography>
|
|
379
|
+
<Flex direction="row" justify={justification} className="w-80 bg-main-50 p-3 rounded-lg">
|
|
380
|
+
<Box className="text-xs py-2 px-3">1</Box>
|
|
381
|
+
<Box className="text-xs py-2 px-3">2</Box>
|
|
382
|
+
<Box className="text-xs py-2 px-3">3</Box>
|
|
383
|
+
</Flex>
|
|
384
|
+
</Flex>
|
|
385
|
+
))}
|
|
386
|
+
</Flex>
|
|
387
|
+
</Flex>
|
|
388
|
+
</Flex>
|
|
389
|
+
),
|
|
390
|
+
}
|