@a2v2ai/uikit 0.0.3 → 0.0.5

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 (148) hide show
  1. package/Alert/Alert.d.ts +13 -0
  2. package/Alert/Alert.js +64 -0
  3. package/AlertDialog/AlertDialog.d.ts +43 -0
  4. package/AlertDialog/AlertDialog.js +121 -0
  5. package/Avatar/Avatar.d.ts +14 -0
  6. package/Avatar/Avatar.js +64 -0
  7. package/Badge/Badge.d.ts +11 -0
  8. package/Badge/Badge.js +26 -0
  9. package/Breadcrumb/Breadcrumb.d.ts +19 -0
  10. package/Breadcrumb/Breadcrumb.js +65 -0
  11. package/Button/Button.d.ts +20 -0
  12. package/Button/Button.js +75 -0
  13. package/Calendar/Calendar.d.ts +16 -0
  14. package/Calendar/Calendar.js +113 -0
  15. package/Card/Card.d.ts +16 -0
  16. package/Card/Card.js +70 -0
  17. package/ChatBubble/ChatBubble.d.ts +33 -0
  18. package/ChatBubble/ChatBubble.js +133 -0
  19. package/Checkbox/Checkbox.d.ts +12 -0
  20. package/Checkbox/Checkbox.js +57 -0
  21. package/Dialog/Dialog.d.ts +35 -0
  22. package/Dialog/Dialog.js +130 -0
  23. package/Drawer/Drawer.d.ts +33 -0
  24. package/Drawer/Drawer.js +69 -0
  25. package/DropdownMenu/DropdownMenu.d.ts +27 -0
  26. package/DropdownMenu/DropdownMenu.js +85 -0
  27. package/ErrorMessage/ErrorMessage.d.ts +27 -0
  28. package/ErrorMessage/ErrorMessage.js +15 -0
  29. package/Flex/Flex.d.ts +31 -0
  30. package/Flex/Flex.js +101 -0
  31. package/IconButton/IconButton.d.ts +23 -0
  32. package/IconButton/IconButton.js +85 -0
  33. package/Input/Input.d.ts +22 -0
  34. package/Input/Input.js +75 -0
  35. package/InputOTP/InputOTP.d.ts +20 -0
  36. package/InputOTP/InputOTP.js +85 -0
  37. package/Label/Label.d.ts +12 -0
  38. package/Label/Label.js +57 -0
  39. package/Loader/Loader.d.ts +21 -0
  40. package/Loader/Loader.js +67 -0
  41. package/Popover/Popover.d.ts +7 -0
  42. package/Popover/Popover.js +49 -0
  43. package/Progress/Progress.d.ts +17 -0
  44. package/Progress/Progress.js +71 -0
  45. package/RadioGroup/RadioGroup.d.ts +13 -0
  46. package/RadioGroup/RadioGroup.js +64 -0
  47. package/ScrollArea/ScrollArea.d.ts +5 -0
  48. package/ScrollArea/ScrollArea.js +48 -0
  49. package/Select/Select.d.ts +21 -0
  50. package/Select/Select.js +85 -0
  51. package/Separator/Separator.d.ts +4 -0
  52. package/Separator/Separator.js +43 -0
  53. package/Skeleton/Skeleton.d.ts +4 -0
  54. package/Skeleton/Skeleton.js +8 -0
  55. package/Spinner/Spinner.d.ts +19 -0
  56. package/Spinner/Spinner.js +68 -0
  57. package/Switch/Switch.d.ts +12 -0
  58. package/Switch/Switch.js +67 -0
  59. package/Tabs/Tabs.d.ts +15 -0
  60. package/Tabs/Tabs.js +64 -0
  61. package/Textarea/Textarea.d.ts +14 -0
  62. package/Textarea/Textarea.js +64 -0
  63. package/Toast/Toast.d.ts +12 -0
  64. package/Toast/Toast.js +29 -0
  65. package/Tooltip/Tooltip.d.ts +17 -0
  66. package/Tooltip/Tooltip.js +68 -0
  67. package/Typography/Typography.d.ts +19 -0
  68. package/Typography/Typography.js +131 -0
  69. package/helpers.d.ts +4 -0
  70. package/helpers.js +13 -0
  71. package/icons.d.ts +1 -0
  72. package/icons.js +18 -0
  73. package/index.css +21 -0
  74. package/index.d.ts +35 -0
  75. package/index.js +183 -0
  76. package/lib/utils.d.ts +3 -0
  77. package/lib/utils.js +18 -0
  78. package/package.json +1 -1
  79. package/Alert/Alert.stories.tsx +0 -121
  80. package/Alert/Alert.tsx +0 -71
  81. package/AlertDialog/AlertDialog.stories.tsx +0 -665
  82. package/AlertDialog/AlertDialog.tsx +0 -241
  83. package/Avatar/Avatar.stories.tsx +0 -128
  84. package/Avatar/Avatar.tsx +0 -71
  85. package/Badge/Badge.stories.tsx +0 -76
  86. package/Badge/Badge.tsx +0 -39
  87. package/Breadcrumb/Breadcrumb.stories.tsx +0 -231
  88. package/Breadcrumb/Breadcrumb.tsx +0 -114
  89. package/Button/Button.stories.tsx +0 -684
  90. package/Button/Button.tsx +0 -90
  91. package/Calendar/Calendar.stories.tsx +0 -207
  92. package/Calendar/Calendar.tsx +0 -232
  93. package/Card/Card.stories.tsx +0 -136
  94. package/Card/Card.tsx +0 -96
  95. package/ChatBubble/ChatBubble.stories.tsx +0 -307
  96. package/ChatBubble/ChatBubble.tsx +0 -167
  97. package/Checkbox/Checkbox.stories.tsx +0 -137
  98. package/Checkbox/Checkbox.tsx +0 -53
  99. package/Drawer/Drawer.stories.tsx +0 -721
  100. package/Drawer/Drawer.tsx +0 -201
  101. package/DropdownMenu/DropdownMenu.stories.tsx +0 -251
  102. package/DropdownMenu/DropdownMenu.tsx +0 -199
  103. package/ErrorMessage/ErrorMessage.stories.tsx +0 -159
  104. package/ErrorMessage/ErrorMessage.tsx +0 -55
  105. package/Flex/Flex.tsx +0 -102
  106. package/IconButton/IconButton.stories.tsx +0 -566
  107. package/IconButton/IconButton.tsx +0 -95
  108. package/Input/Input.stories.tsx +0 -456
  109. package/Input/Input.tsx +0 -129
  110. package/InputOTP/InputOTP.stories.tsx +0 -246
  111. package/InputOTP/InputOTP.tsx +0 -127
  112. package/Label/Label.stories.tsx +0 -105
  113. package/Label/Label.tsx +0 -43
  114. package/Loader/Loader.stories.tsx +0 -170
  115. package/Loader/Loader.tsx +0 -62
  116. package/Popover/Popover.stories.tsx +0 -133
  117. package/Popover/Popover.tsx +0 -31
  118. package/Progress/Progress.stories.tsx +0 -146
  119. package/Progress/Progress.tsx +0 -67
  120. package/RadioGroup/RadioGroup.stories.tsx +0 -159
  121. package/RadioGroup/RadioGroup.tsx +0 -68
  122. package/ScrollArea/ScrollArea.stories.tsx +0 -136
  123. package/ScrollArea/ScrollArea.tsx +0 -46
  124. package/Select/Select.stories.tsx +0 -242
  125. package/Select/Select.tsx +0 -180
  126. package/Separator/Separator.stories.tsx +0 -110
  127. package/Separator/Separator.tsx +0 -29
  128. package/Skeleton/Skeleton.stories.tsx +0 -117
  129. package/Skeleton/Skeleton.tsx +0 -16
  130. package/Spinner/Spinner.stories.tsx +0 -210
  131. package/Spinner/Spinner.tsx +0 -78
  132. package/Switch/Switch.stories.tsx +0 -146
  133. package/Switch/Switch.tsx +0 -59
  134. package/Tabs/Tabs.stories.tsx +0 -197
  135. package/Tabs/Tabs.tsx +0 -74
  136. package/Textarea/Textarea.stories.tsx +0 -170
  137. package/Textarea/Textarea.tsx +0 -51
  138. package/Toast/Toast.stories.tsx +0 -285
  139. package/Toast/Toast.tsx +0 -59
  140. package/Tooltip/Tooltip.stories.tsx +0 -463
  141. package/Tooltip/Tooltip.tsx +0 -96
  142. package/Typography/Typography.stories.tsx +0 -235
  143. package/Typography/Typography.tsx +0 -171
  144. package/helpers.ts +0 -5
  145. package/icons.ts +0 -2
  146. package/index.ts +0 -136
  147. package/lib/utils.ts +0 -15
  148. package/tsconfig.json +0 -24
@@ -1,159 +0,0 @@
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 direction="column" 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 direction="column" 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 direction="column" 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
- }
@@ -1,55 +0,0 @@
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 }
package/Flex/Flex.tsx DELETED
@@ -1,102 +0,0 @@
1
- import * as React from "react"
2
- import { cva } from "class-variance-authority"
3
- import { cn } from "../lib/utils"
4
-
5
- type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse"
6
- type FlexAlign = "start" | "center" | "end" | "stretch" | "baseline"
7
- type FlexJustify = "start" | "center" | "end" | "between" | "around" | "evenly"
8
- type FlexWrap = "nowrap" | "wrap" | "wrap-reverse"
9
- type FlexGap = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48
10
-
11
- const flexVariants = cva("flex", {
12
- variants: {
13
- direction: {
14
- row: "flex-row",
15
- column: "flex-col",
16
- "row-reverse": "flex-row-reverse",
17
- "column-reverse": "flex-col-reverse",
18
- },
19
- align: {
20
- start: "items-start",
21
- center: "items-center",
22
- end: "items-end",
23
- stretch: "items-stretch",
24
- baseline: "items-baseline",
25
- },
26
- justify: {
27
- start: "justify-start",
28
- center: "justify-center",
29
- end: "justify-end",
30
- between: "justify-between",
31
- around: "justify-around",
32
- evenly: "justify-evenly",
33
- },
34
- wrap: {
35
- nowrap: "flex-nowrap",
36
- wrap: "flex-wrap",
37
- "wrap-reverse": "flex-wrap-reverse",
38
- },
39
- gap: {
40
- 0: "gap-0",
41
- 1: "gap-1",
42
- 2: "gap-2",
43
- 3: "gap-3",
44
- 4: "gap-4",
45
- 5: "gap-5",
46
- 6: "gap-6",
47
- 8: "gap-8",
48
- 10: "gap-10",
49
- 12: "gap-12",
50
- 16: "gap-16",
51
- 20: "gap-20",
52
- 24: "gap-24",
53
- 32: "gap-32",
54
- 40: "gap-40",
55
- 48: "gap-48",
56
- },
57
- },
58
- defaultVariants: {
59
- direction: "row",
60
- align: "stretch",
61
- justify: "start",
62
- wrap: "nowrap",
63
- gap: 0,
64
- },
65
- })
66
-
67
- type FlexProps = React.HTMLAttributes<HTMLDivElement> & {
68
- direction?: FlexDirection
69
- align?: FlexAlign
70
- justify?: FlexJustify
71
- wrap?: FlexWrap
72
- gap?: FlexGap
73
- as?: React.ElementType
74
- }
75
-
76
- const Flex = React.forwardRef<HTMLDivElement, FlexProps>(
77
- (
78
- {
79
- className,
80
- direction,
81
- align,
82
- justify,
83
- wrap,
84
- gap,
85
- as: Component = "div",
86
- ...props
87
- },
88
- ref
89
- ) => {
90
- return (
91
- <Component
92
- ref={ref}
93
- className={cn(flexVariants({ direction, align, justify, wrap, gap, className }))}
94
- {...props}
95
- />
96
- )
97
- }
98
- )
99
- Flex.displayName = "Flex"
100
-
101
- export { Flex, flexVariants }
102
- export type { FlexProps, FlexDirection, FlexAlign, FlexJustify, FlexWrap, FlexGap }