@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.
Files changed (185) hide show
  1. package/Alert/Alert.stories.tsx +121 -0
  2. package/Alert/Alert.tsx +71 -0
  3. package/AlertDialog/AlertDialog.stories.tsx +665 -0
  4. package/AlertDialog/AlertDialog.tsx +241 -0
  5. package/Avatar/Avatar.stories.tsx +128 -0
  6. package/Avatar/Avatar.tsx +71 -0
  7. package/Badge/Badge.stories.tsx +76 -0
  8. package/Badge/Badge.tsx +39 -0
  9. package/Breadcrumb/Breadcrumb.stories.tsx +231 -0
  10. package/Breadcrumb/Breadcrumb.tsx +114 -0
  11. package/Button/Button.stories.tsx +684 -0
  12. package/Button/Button.tsx +107 -0
  13. package/Calendar/Calendar.stories.tsx +291 -0
  14. package/Calendar/Calendar.tsx +246 -0
  15. package/Card/Card.stories.tsx +136 -0
  16. package/Card/Card.tsx +96 -0
  17. package/Carousel/Carousel.stories.tsx +256 -0
  18. package/Carousel/Carousel.tsx +301 -0
  19. package/ChatBubble/ChatBubble.stories.tsx +339 -0
  20. package/ChatBubble/ChatBubble.tsx +179 -0
  21. package/Checkbox/Checkbox.stories.tsx +137 -0
  22. package/Checkbox/Checkbox.tsx +53 -0
  23. package/DataTable/DataTable.stories.tsx +400 -0
  24. package/DataTable/DataTable.tsx +207 -0
  25. package/Drawer/Drawer.stories.tsx +721 -0
  26. package/Drawer/Drawer.tsx +201 -0
  27. package/DropdownMenu/DropdownMenu.stories.tsx +251 -0
  28. package/DropdownMenu/DropdownMenu.tsx +199 -0
  29. package/ErrorMessage/ErrorMessage.stories.tsx +159 -0
  30. package/ErrorMessage/ErrorMessage.tsx +55 -0
  31. package/Flex/Flex.stories.tsx +390 -0
  32. package/Flex/Flex.tsx +102 -0
  33. package/IconButton/IconButton.stories.tsx +566 -0
  34. package/IconButton/IconButton.tsx +95 -0
  35. package/Input/Input.stories.tsx +566 -0
  36. package/Input/Input.tsx +168 -0
  37. package/InputOTP/InputOTP.stories.tsx +246 -0
  38. package/InputOTP/InputOTP.tsx +127 -0
  39. package/Label/Label.stories.tsx +110 -0
  40. package/Label/Label.tsx +44 -0
  41. package/Loader/Loader.stories.tsx +170 -0
  42. package/Loader/Loader.tsx +62 -0
  43. package/Menubar/Menubar.stories.tsx +382 -0
  44. package/Menubar/Menubar.tsx +274 -0
  45. package/Menubar/index.ts +18 -0
  46. package/Pagination/Pagination.stories.tsx +196 -0
  47. package/Pagination/Pagination.tsx +122 -0
  48. package/Popover/Popover.stories.tsx +133 -0
  49. package/Popover/Popover.tsx +31 -0
  50. package/Progress/Progress.stories.tsx +146 -0
  51. package/Progress/Progress.tsx +67 -0
  52. package/RadioGroup/RadioGroup.stories.tsx +159 -0
  53. package/RadioGroup/RadioGroup.tsx +68 -0
  54. package/ScrollArea/ScrollArea.stories.tsx +136 -0
  55. package/ScrollArea/ScrollArea.tsx +46 -0
  56. package/Select/Select.stories.tsx +378 -0
  57. package/Select/Select.tsx +230 -0
  58. package/Separator/Separator.stories.tsx +110 -0
  59. package/Separator/Separator.tsx +29 -0
  60. package/Sidebar/Sidebar.stories.tsx +340 -0
  61. package/Sidebar/Sidebar.tsx +414 -0
  62. package/Sidebar/index.ts +28 -0
  63. package/Skeleton/Skeleton.stories.tsx +117 -0
  64. package/Skeleton/Skeleton.tsx +16 -0
  65. package/Slider/Slider.stories.tsx +216 -0
  66. package/Slider/Slider.tsx +29 -0
  67. package/Spinner/Spinner.stories.tsx +210 -0
  68. package/Spinner/Spinner.tsx +78 -0
  69. package/Switch/Switch.stories.tsx +146 -0
  70. package/Switch/Switch.tsx +59 -0
  71. package/Table/Table.stories.tsx +510 -0
  72. package/Table/Table.tsx +114 -0
  73. package/Tabs/Tabs.stories.tsx +197 -0
  74. package/Tabs/Tabs.tsx +74 -0
  75. package/Textarea/Textarea.stories.tsx +187 -0
  76. package/Textarea/Textarea.tsx +73 -0
  77. package/Toast/Toast.stories.tsx +285 -0
  78. package/Toast/Toast.tsx +59 -0
  79. package/Tooltip/Tooltip.stories.tsx +463 -0
  80. package/Tooltip/Tooltip.tsx +96 -0
  81. package/Typography/Typography.stories.tsx +425 -0
  82. package/Typography/Typography.tsx +106 -0
  83. package/helpers.ts +5 -0
  84. package/{icons.js → icons.ts} +1 -1
  85. package/index.ts +217 -0
  86. package/lib/typography-types.ts +223 -0
  87. package/lib/utils.ts +15 -0
  88. package/package.json +36 -33
  89. package/tsconfig.json +22 -0
  90. package/Alert/Alert.d.ts +0 -13
  91. package/Alert/Alert.js +0 -25
  92. package/AlertDialog/AlertDialog.d.ts +0 -43
  93. package/AlertDialog/AlertDialog.js +0 -71
  94. package/Avatar/Avatar.d.ts +0 -14
  95. package/Avatar/Avatar.js +0 -25
  96. package/Badge/Badge.d.ts +0 -11
  97. package/Badge/Badge.js +0 -23
  98. package/Breadcrumb/Breadcrumb.d.ts +0 -19
  99. package/Breadcrumb/Breadcrumb.js +0 -23
  100. package/Button/Button.d.ts +0 -23
  101. package/Button/Button.js +0 -52
  102. package/Calendar/Calendar.d.ts +0 -20
  103. package/Calendar/Calendar.js +0 -78
  104. package/Card/Card.d.ts +0 -16
  105. package/Card/Card.js +0 -28
  106. package/Carousel/Carousel.d.ts +0 -37
  107. package/Carousel/Carousel.js +0 -132
  108. package/ChatBubble/ChatBubble.d.ts +0 -33
  109. package/ChatBubble/ChatBubble.js +0 -107
  110. package/Checkbox/Checkbox.d.ts +0 -12
  111. package/Checkbox/Checkbox.js +0 -20
  112. package/DataTable/DataTable.d.ts +0 -35
  113. package/DataTable/DataTable.js +0 -51
  114. package/Dialog/Dialog.d.ts +0 -35
  115. package/Dialog/Dialog.js +0 -130
  116. package/Drawer/Drawer.d.ts +0 -33
  117. package/Drawer/Drawer.js +0 -55
  118. package/DropdownMenu/DropdownMenu.d.ts +0 -27
  119. package/DropdownMenu/DropdownMenu.js +0 -35
  120. package/ErrorMessage/ErrorMessage.d.ts +0 -27
  121. package/ErrorMessage/ErrorMessage.js +0 -14
  122. package/Flex/Flex.d.ts +0 -31
  123. package/Flex/Flex.js +0 -64
  124. package/IconButton/IconButton.d.ts +0 -23
  125. package/IconButton/IconButton.js +0 -48
  126. package/Input/Input.d.ts +0 -27
  127. package/Input/Input.js +0 -42
  128. package/InputOTP/InputOTP.d.ts +0 -20
  129. package/InputOTP/InputOTP.js +0 -44
  130. package/Label/Label.d.ts +0 -13
  131. package/Label/Label.js +0 -19
  132. package/Loader/Loader.d.ts +0 -21
  133. package/Loader/Loader.js +0 -30
  134. package/Menubar/Menubar.d.ts +0 -26
  135. package/Menubar/Menubar.js +0 -54
  136. package/Menubar/index.d.ts +0 -1
  137. package/Menubar/index.js +0 -1
  138. package/Pagination/Pagination.d.ts +0 -35
  139. package/Pagination/Pagination.js +0 -37
  140. package/Popover/Popover.d.ts +0 -7
  141. package/Popover/Popover.js +0 -10
  142. package/Progress/Progress.d.ts +0 -17
  143. package/Progress/Progress.js +0 -33
  144. package/RadioGroup/RadioGroup.d.ts +0 -13
  145. package/RadioGroup/RadioGroup.js +0 -26
  146. package/ScrollArea/ScrollArea.d.ts +0 -5
  147. package/ScrollArea/ScrollArea.js +0 -11
  148. package/Select/Select.d.ts +0 -29
  149. package/Select/Select.js +0 -50
  150. package/Separator/Separator.d.ts +0 -4
  151. package/Separator/Separator.js +0 -7
  152. package/Sidebar/Sidebar.d.ts +0 -48
  153. package/Sidebar/Sidebar.js +0 -116
  154. package/Sidebar/index.d.ts +0 -2
  155. package/Sidebar/index.js +0 -1
  156. package/Skeleton/Skeleton.d.ts +0 -4
  157. package/Skeleton/Skeleton.js +0 -7
  158. package/Slider/Slider.d.ts +0 -6
  159. package/Slider/Slider.js +0 -7
  160. package/Spinner/Spinner.d.ts +0 -19
  161. package/Spinner/Spinner.js +0 -31
  162. package/Switch/Switch.d.ts +0 -12
  163. package/Switch/Switch.js +0 -30
  164. package/Table/Table.d.ts +0 -10
  165. package/Table/Table.js +0 -20
  166. package/Tabs/Tabs.d.ts +0 -15
  167. package/Tabs/Tabs.js +0 -24
  168. package/Textarea/Textarea.d.ts +0 -19
  169. package/Textarea/Textarea.js +0 -31
  170. package/Toast/Toast.d.ts +0 -12
  171. package/Toast/Toast.js +0 -25
  172. package/Tooltip/Tooltip.d.ts +0 -17
  173. package/Tooltip/Tooltip.js +0 -29
  174. package/Typography/Typography.d.ts +0 -20
  175. package/Typography/Typography.js +0 -43
  176. package/helpers.d.ts +0 -4
  177. package/helpers.js +0 -5
  178. package/icons.d.ts +0 -1
  179. package/index.d.ts +0 -42
  180. package/index.js +0 -45
  181. package/lib/typography-types.d.ts +0 -4
  182. package/lib/typography-types.js +0 -90
  183. package/lib/utils.d.ts +0 -3
  184. package/lib/utils.js +0 -14
  185. package/tmpclaude-2407-cwd +0 -1
@@ -0,0 +1,136 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+
3
+ import { Separator } from "../Separator/Separator"
4
+ import { Flex } from "../Flex/Flex"
5
+ import { Typography } from "../Typography/Typography"
6
+ import { ScrollArea, ScrollBar } from "./ScrollArea"
7
+
8
+ const meta: Meta<typeof ScrollArea> = {
9
+ title: "Components/ScrollArea",
10
+ component: ScrollArea,
11
+ parameters: {
12
+ layout: "centered",
13
+ },
14
+ tags: ["autodocs"],
15
+ }
16
+
17
+ export default meta
18
+ type Story = StoryObj<typeof meta>
19
+
20
+ const tags = Array.from({ length: 50 }).map(
21
+ (_, i, a) => `v1.2.0-beta.${a.length - i}`
22
+ )
23
+
24
+ export const Default: Story = {
25
+ render: () => (
26
+ <ScrollArea className="h-72 w-48 rounded-md border border-grey-200 bg-white">
27
+ <div className="p-4">
28
+ <h4 className="mb-4 text-sm font-medium leading-none">Tags</h4>
29
+ {tags.map((tag) => (
30
+ <div key={tag}>
31
+ <div className="text-sm">{tag}</div>
32
+ <Separator className="my-2" />
33
+ </div>
34
+ ))}
35
+ </div>
36
+ </ScrollArea>
37
+ ),
38
+ }
39
+
40
+ const artworks = [
41
+ { artist: "Ornella Binni", art: "Reflected" },
42
+ { artist: "Tom Byrom", art: "Mountain Mist" },
43
+ { artist: "Vladimir Malyavko", art: "Spring Bloom" },
44
+ { artist: "Joshua Newton", art: "River Flow" },
45
+ { artist: "Pete Nowicki", art: "Sunset Valley" },
46
+ { artist: "Laura Chouette", art: "Autumn Leaves" },
47
+ { artist: "Nick Nice", art: "Ocean Waves" },
48
+ { artist: "Daniel Olah", art: "City Lights" },
49
+ { artist: "Igor Rodrigues", art: "Forest Path" },
50
+ { artist: "Vadim Sherbakov", art: "Winter Snow" },
51
+ ]
52
+
53
+ export const Horizontal: Story = {
54
+ render: () => (
55
+ <ScrollArea className="w-96 whitespace-nowrap rounded-md border border-grey-200 bg-white">
56
+ <div className="flex w-max space-x-4 p-4">
57
+ {artworks.map((artwork) => (
58
+ <figure key={artwork.artist} className="shrink-0">
59
+ <div className="overflow-hidden rounded-md">
60
+ <div className="h-[150px] w-[200px] bg-grey-100 flex items-center justify-center">
61
+ <span className="text-grey-400 text-sm">{artwork.art}</span>
62
+ </div>
63
+ </div>
64
+ <figcaption className="pt-2 text-xs text-grey-500">
65
+ Photo by{" "}
66
+ <span className="font-semibold text-main-950">
67
+ {artwork.artist}
68
+ </span>
69
+ </figcaption>
70
+ </figure>
71
+ ))}
72
+ </div>
73
+ <ScrollBar orientation="horizontal" />
74
+ </ScrollArea>
75
+ ),
76
+ }
77
+
78
+ export const Both: Story = {
79
+ render: () => (
80
+ <ScrollArea className="h-[200px] w-[350px] rounded-md border border-grey-200 bg-white p-4">
81
+ <div className="w-[600px]">
82
+ <h4 className="mb-4 text-sm font-medium">Both Scrollbars</h4>
83
+ <p className="text-sm text-grey-500">
84
+ This content is wider and taller than the container, so it requires both horizontal and vertical scrolling.
85
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
86
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
87
+ </p>
88
+ <div className="mt-4 grid grid-cols-3 gap-4">
89
+ {Array.from({ length: 12 }).map((_, i) => (
90
+ <div key={i} className="h-20 w-40 bg-grey-100 rounded-md flex items-center justify-center">
91
+ <span className="text-grey-400 text-sm">Item {i + 1}</span>
92
+ </div>
93
+ ))}
94
+ </div>
95
+ </div>
96
+ <ScrollBar orientation="horizontal" />
97
+ </ScrollArea>
98
+ ),
99
+ }
100
+
101
+ export const AllVariants: Story = {
102
+ render: () => (
103
+ <Flex gap={6}>
104
+ <Typography variant="h4" className="text-white">ScrollArea Examples</Typography>
105
+
106
+ <Flex direction="row" gap={6}>
107
+ <Flex gap={2}>
108
+ <Typography variant="caption" className="text-grey-400">Vertical</Typography>
109
+ <ScrollArea className="h-48 w-48 rounded-md border border-grey-200 bg-white">
110
+ <div className="p-4">
111
+ {Array.from({ length: 20 }).map((_, i) => (
112
+ <div key={i} className="py-2 text-sm">
113
+ Item {i + 1}
114
+ </div>
115
+ ))}
116
+ </div>
117
+ </ScrollArea>
118
+ </Flex>
119
+
120
+ <Flex gap={2}>
121
+ <Typography variant="caption" className="text-grey-400">Horizontal</Typography>
122
+ <ScrollArea className="w-64 whitespace-nowrap rounded-md border border-grey-200 bg-white">
123
+ <div className="flex w-max space-x-4 p-4">
124
+ {Array.from({ length: 10 }).map((_, i) => (
125
+ <div key={i} className="shrink-0 h-20 w-20 bg-grey-100 rounded-md flex items-center justify-center">
126
+ <span className="text-grey-400 text-xs">{i + 1}</span>
127
+ </div>
128
+ ))}
129
+ </div>
130
+ <ScrollBar orientation="horizontal" />
131
+ </ScrollArea>
132
+ </Flex>
133
+ </Flex>
134
+ </Flex>
135
+ ),
136
+ }
@@ -0,0 +1,46 @@
1
+ import * as React from "react"
2
+ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
3
+
4
+ import { cn } from "../lib/utils"
5
+
6
+ const ScrollArea = React.forwardRef<
7
+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,
8
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
9
+ >(({ className, children, ...props }, ref) => (
10
+ <ScrollAreaPrimitive.Root
11
+ ref={ref}
12
+ className={cn("relative overflow-hidden", className)}
13
+ {...props}
14
+ >
15
+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
16
+ {children}
17
+ </ScrollAreaPrimitive.Viewport>
18
+ <ScrollBar />
19
+ <ScrollAreaPrimitive.Corner />
20
+ </ScrollAreaPrimitive.Root>
21
+ ))
22
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
23
+
24
+ const ScrollBar = React.forwardRef<
25
+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
26
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
27
+ >(({ className, orientation = "vertical", ...props }, ref) => (
28
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
29
+ ref={ref}
30
+ orientation={orientation}
31
+ className={cn(
32
+ "flex touch-none select-none transition-colors",
33
+ orientation === "vertical" &&
34
+ "h-full w-2.5 border-l border-l-transparent p-[1px]",
35
+ orientation === "horizontal" &&
36
+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",
37
+ className
38
+ )}
39
+ {...props}
40
+ >
41
+ <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-grey-300" />
42
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
43
+ ))
44
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
45
+
46
+ export { ScrollArea, ScrollBar }
@@ -0,0 +1,378 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import { useState } from "react"
3
+
4
+ import { Label } from "../Label/Label"
5
+ import { Flex } from "../Flex/Flex"
6
+ import { Typography } from "../Typography/Typography"
7
+ import { Button } from "../Button/Button"
8
+ import {
9
+ Select,
10
+ SelectContent,
11
+ SelectGroup,
12
+ SelectItem,
13
+ SelectLabel,
14
+ SelectTrigger,
15
+ SelectValue,
16
+ SelectSeparator,
17
+ } from "./Select"
18
+
19
+ const meta: Meta<typeof Select> = {
20
+ title: "Components/Select",
21
+ component: Select,
22
+ parameters: {
23
+ layout: "centered",
24
+ },
25
+ tags: ["autodocs"],
26
+ }
27
+
28
+ export default meta
29
+ type Story = StoryObj<typeof meta>
30
+
31
+ export const Default: Story = {
32
+ render: () => (
33
+ <Select>
34
+ <SelectTrigger className="w-[180px]">
35
+ <SelectValue placeholder="Select a fruit" />
36
+ </SelectTrigger>
37
+ <SelectContent>
38
+ <SelectGroup>
39
+ <SelectLabel>Fruits</SelectLabel>
40
+ <SelectItem value="apple">Apple</SelectItem>
41
+ <SelectItem value="banana">Banana</SelectItem>
42
+ <SelectItem value="blueberry">Blueberry</SelectItem>
43
+ <SelectItem value="grapes">Grapes</SelectItem>
44
+ <SelectItem value="pineapple">Pineapple</SelectItem>
45
+ </SelectGroup>
46
+ </SelectContent>
47
+ </Select>
48
+ ),
49
+ }
50
+
51
+ export const WithBuiltInLabel: Story = {
52
+ render: () => (
53
+ <Flex gap={4}>
54
+ <Select>
55
+ <SelectTrigger
56
+ id="framework"
57
+ label="Framework"
58
+ labelVariant="body2"
59
+ labelColor="main-800"
60
+ className="w-[180px]"
61
+ >
62
+ <SelectValue placeholder="Select a framework" />
63
+ </SelectTrigger>
64
+ <SelectContent>
65
+ <SelectItem value="next">Next.js</SelectItem>
66
+ <SelectItem value="sveltekit">SvelteKit</SelectItem>
67
+ <SelectItem value="astro">Astro</SelectItem>
68
+ <SelectItem value="nuxt">Nuxt.js</SelectItem>
69
+ </SelectContent>
70
+ </Select>
71
+ <Select>
72
+ <SelectTrigger
73
+ id="country"
74
+ label="Country"
75
+ labelVariant="body2"
76
+ labelColor="main-800"
77
+ className="w-[180px]"
78
+ >
79
+ <SelectValue placeholder="Select a country" />
80
+ </SelectTrigger>
81
+ <SelectContent>
82
+ <SelectItem value="us">United States</SelectItem>
83
+ <SelectItem value="uk">United Kingdom</SelectItem>
84
+ <SelectItem value="ca">Canada</SelectItem>
85
+ </SelectContent>
86
+ </Select>
87
+ </Flex>
88
+ ),
89
+ }
90
+
91
+ export const WithLabel: Story = {
92
+ render: () => (
93
+ <Flex gap={2}>
94
+ <Label htmlFor="framework">Framework</Label>
95
+ <Select>
96
+ <SelectTrigger id="framework" className="w-[180px]">
97
+ <SelectValue placeholder="Select a framework" />
98
+ </SelectTrigger>
99
+ <SelectContent>
100
+ <SelectItem value="next">Next.js</SelectItem>
101
+ <SelectItem value="sveltekit">SvelteKit</SelectItem>
102
+ <SelectItem value="astro">Astro</SelectItem>
103
+ <SelectItem value="nuxt">Nuxt.js</SelectItem>
104
+ </SelectContent>
105
+ </Select>
106
+ </Flex>
107
+ ),
108
+ }
109
+
110
+ export const WithGroups: Story = {
111
+ render: () => (
112
+ <Select>
113
+ <SelectTrigger className="w-[280px]">
114
+ <SelectValue placeholder="Select a timezone" />
115
+ </SelectTrigger>
116
+ <SelectContent>
117
+ <SelectGroup>
118
+ <SelectLabel>North America</SelectLabel>
119
+ <SelectItem value="est">Eastern Standard Time (EST)</SelectItem>
120
+ <SelectItem value="cst">Central Standard Time (CST)</SelectItem>
121
+ <SelectItem value="mst">Mountain Standard Time (MST)</SelectItem>
122
+ <SelectItem value="pst">Pacific Standard Time (PST)</SelectItem>
123
+ </SelectGroup>
124
+ <SelectSeparator />
125
+ <SelectGroup>
126
+ <SelectLabel>Europe & Africa</SelectLabel>
127
+ <SelectItem value="gmt">Greenwich Mean Time (GMT)</SelectItem>
128
+ <SelectItem value="cet">Central European Time (CET)</SelectItem>
129
+ <SelectItem value="eet">Eastern European Time (EET)</SelectItem>
130
+ </SelectGroup>
131
+ <SelectSeparator />
132
+ <SelectGroup>
133
+ <SelectLabel>Asia</SelectLabel>
134
+ <SelectItem value="ist">India Standard Time (IST)</SelectItem>
135
+ <SelectItem value="cst_china">China Standard Time (CST)</SelectItem>
136
+ <SelectItem value="jst">Japan Standard Time (JST)</SelectItem>
137
+ </SelectGroup>
138
+ </SelectContent>
139
+ </Select>
140
+ ),
141
+ }
142
+
143
+ export const Disabled: Story = {
144
+ render: () => (
145
+ <Select disabled>
146
+ <SelectTrigger className="w-[180px]">
147
+ <SelectValue placeholder="Select option" />
148
+ </SelectTrigger>
149
+ <SelectContent>
150
+ <SelectItem value="option1">Option 1</SelectItem>
151
+ <SelectItem value="option2">Option 2</SelectItem>
152
+ </SelectContent>
153
+ </Select>
154
+ ),
155
+ }
156
+
157
+ export const Error: Story = {
158
+ render: () => (
159
+ <Select>
160
+ <SelectTrigger
161
+ label="Fruit"
162
+ className="w-[180px]"
163
+ error="Please select a fruit"
164
+ >
165
+ <SelectValue placeholder="Select a fruit" />
166
+ </SelectTrigger>
167
+ <SelectContent>
168
+ <SelectItem value="apple">Apple</SelectItem>
169
+ <SelectItem value="banana">Banana</SelectItem>
170
+ <SelectItem value="orange">Orange</SelectItem>
171
+ </SelectContent>
172
+ </Select>
173
+ ),
174
+ }
175
+
176
+ export const ErrorWithMessage: Story = {
177
+ render: () => (
178
+ <Flex gap={2}>
179
+ <Label htmlFor="required-field">Required Field</Label>
180
+ <Select>
181
+ <SelectTrigger id="required-field" className="w-[180px]" error="Please select an option">
182
+ <SelectValue placeholder="Select option" />
183
+ </SelectTrigger>
184
+ <SelectContent>
185
+ <SelectItem value="option1">Option 1</SelectItem>
186
+ <SelectItem value="option2">Option 2</SelectItem>
187
+ <SelectItem value="option3">Option 3</SelectItem>
188
+ </SelectContent>
189
+ </Select>
190
+ </Flex>
191
+ ),
192
+ }
193
+
194
+ export const FormikTouchedUntouched: Story = {
195
+ render: function FormikExample() {
196
+ const [value, setValue] = useState("")
197
+ const [touched, setTouched] = useState(false)
198
+ const error = "Please select a country"
199
+
200
+ return (
201
+ <Flex gap={6} style={{ width: "280px" }}>
202
+ <Typography variant="subtitle2" color="main-700">
203
+ Formik-style touched/untouched validation
204
+ </Typography>
205
+ <Typography variant="caption" color="grey-500">
206
+ Error message only shows after field is touched (opened and closed without selection)
207
+ </Typography>
208
+
209
+ <Flex gap={1}>
210
+ <Label>Country</Label>
211
+ <Select
212
+ value={value}
213
+ onValueChange={setValue}
214
+ onOpenChange={(open) => {
215
+ if (!open) setTouched(true)
216
+ }}
217
+ >
218
+ <SelectTrigger
219
+ className="w-full"
220
+ error={touched && !value ? error : undefined}
221
+ >
222
+ <SelectValue placeholder="Select a country" />
223
+ </SelectTrigger>
224
+ <SelectContent>
225
+ <SelectItem value="us">United States</SelectItem>
226
+ <SelectItem value="uk">United Kingdom</SelectItem>
227
+ <SelectItem value="ca">Canada</SelectItem>
228
+ <SelectItem value="au">Australia</SelectItem>
229
+ </SelectContent>
230
+ </Select>
231
+ <Typography variant="caption" color="grey-400">
232
+ {touched ? "Touched" : "Untouched"} | Value: {value || "none"}
233
+ </Typography>
234
+ </Flex>
235
+
236
+ <Button
237
+ variant="secondary"
238
+ size="small"
239
+ onClick={() => {
240
+ setTouched(false)
241
+ setValue("")
242
+ }}
243
+ >
244
+ Reset
245
+ </Button>
246
+ </Flex>
247
+ )
248
+ },
249
+ }
250
+
251
+ export const Small: Story = {
252
+ render: () => (
253
+ <Select>
254
+ <SelectTrigger size="small" className="w-[180px]">
255
+ <SelectValue placeholder="Select size" />
256
+ </SelectTrigger>
257
+ <SelectContent>
258
+ <SelectItem value="xs">Extra Small</SelectItem>
259
+ <SelectItem value="sm">Small</SelectItem>
260
+ <SelectItem value="md">Medium</SelectItem>
261
+ <SelectItem value="lg">Large</SelectItem>
262
+ <SelectItem value="xl">Extra Large</SelectItem>
263
+ </SelectContent>
264
+ </Select>
265
+ ),
266
+ }
267
+
268
+ export const Large: Story = {
269
+ render: () => (
270
+ <Select>
271
+ <SelectTrigger size="large" className="w-[180px]">
272
+ <SelectValue placeholder="Select size" />
273
+ </SelectTrigger>
274
+ <SelectContent>
275
+ <SelectItem value="xs">Extra Small</SelectItem>
276
+ <SelectItem value="sm">Small</SelectItem>
277
+ <SelectItem value="md">Medium</SelectItem>
278
+ <SelectItem value="lg">Large</SelectItem>
279
+ <SelectItem value="xl">Extra Large</SelectItem>
280
+ </SelectContent>
281
+ </Select>
282
+ ),
283
+ }
284
+
285
+ export const AllVariants: Story = {
286
+ render: () => (
287
+ <Flex gap={6}>
288
+ <Typography variant="h4" className="text-white">Select Sizes</Typography>
289
+
290
+ <Flex direction="row" gap={4} align="end">
291
+ <Flex gap={2}>
292
+ <Typography variant="caption" className="text-grey-400">Small</Typography>
293
+ <Select defaultValue="option1">
294
+ <SelectTrigger size="small" className="w-[150px]">
295
+ <SelectValue />
296
+ </SelectTrigger>
297
+ <SelectContent>
298
+ <SelectItem value="option1">Option 1</SelectItem>
299
+ <SelectItem value="option2">Option 2</SelectItem>
300
+ </SelectContent>
301
+ </Select>
302
+ </Flex>
303
+
304
+ <Flex gap={2}>
305
+ <Typography variant="caption" className="text-grey-400">Regular</Typography>
306
+ <Select defaultValue="option1">
307
+ <SelectTrigger size="regular" className="w-[150px]">
308
+ <SelectValue />
309
+ </SelectTrigger>
310
+ <SelectContent>
311
+ <SelectItem value="option1">Option 1</SelectItem>
312
+ <SelectItem value="option2">Option 2</SelectItem>
313
+ </SelectContent>
314
+ </Select>
315
+ </Flex>
316
+
317
+ <Flex gap={2}>
318
+ <Typography variant="caption" className="text-grey-400">Large</Typography>
319
+ <Select defaultValue="option1">
320
+ <SelectTrigger size="large" className="w-[150px]">
321
+ <SelectValue />
322
+ </SelectTrigger>
323
+ <SelectContent>
324
+ <SelectItem value="option1">Option 1</SelectItem>
325
+ <SelectItem value="option2">Option 2</SelectItem>
326
+ </SelectContent>
327
+ </Select>
328
+ </Flex>
329
+ </Flex>
330
+
331
+ <Typography variant="h4" className="text-white mt-4">With Form Label</Typography>
332
+
333
+ <Flex gap={2} className="w-[250px]">
334
+ <Label htmlFor="country">Country</Label>
335
+ <Select defaultValue="us">
336
+ <SelectTrigger id="country">
337
+ <SelectValue />
338
+ </SelectTrigger>
339
+ <SelectContent>
340
+ <SelectItem value="us">United States</SelectItem>
341
+ <SelectItem value="uk">United Kingdom</SelectItem>
342
+ <SelectItem value="ca">Canada</SelectItem>
343
+ <SelectItem value="au">Australia</SelectItem>
344
+ </SelectContent>
345
+ </Select>
346
+ </Flex>
347
+
348
+ <Typography variant="h4" className="text-white mt-4">States</Typography>
349
+
350
+ <Flex direction="row" gap={4}>
351
+ <Flex gap={2}>
352
+ <Typography variant="caption" className="text-grey-400">Default</Typography>
353
+ <Select>
354
+ <SelectTrigger className="w-[150px]">
355
+ <SelectValue placeholder="Select..." />
356
+ </SelectTrigger>
357
+ <SelectContent>
358
+ <SelectItem value="1">Option 1</SelectItem>
359
+ <SelectItem value="2">Option 2</SelectItem>
360
+ </SelectContent>
361
+ </Select>
362
+ </Flex>
363
+
364
+ <Flex gap={2}>
365
+ <Typography variant="caption" className="text-grey-400">Disabled</Typography>
366
+ <Select disabled>
367
+ <SelectTrigger className="w-[150px]">
368
+ <SelectValue placeholder="Select..." />
369
+ </SelectTrigger>
370
+ <SelectContent>
371
+ <SelectItem value="1">Option 1</SelectItem>
372
+ </SelectContent>
373
+ </Select>
374
+ </Flex>
375
+ </Flex>
376
+ </Flex>
377
+ ),
378
+ }