@arch-cadre/ui 0.0.44 → 0.0.47

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 (262) hide show
  1. package/dist/components/accordion.js +18 -0
  2. package/dist/components/alert-dialog.js +39 -0
  3. package/dist/components/alert.js +24 -0
  4. package/dist/components/aspect-ratio.js +7 -0
  5. package/dist/components/avatar.js +14 -0
  6. package/dist/components/badge.js +22 -0
  7. package/dist/components/breadcrumb.js +30 -0
  8. package/dist/components/button-group.js +28 -0
  9. package/dist/components/button.js +33 -0
  10. package/dist/components/calendar.js +76 -0
  11. package/dist/components/card.js +24 -0
  12. package/dist/components/checkbox.js +9 -0
  13. package/dist/components/collapsible.js +13 -0
  14. package/dist/components/command.js +34 -0
  15. package/dist/components/context-menu.js +51 -0
  16. package/dist/components/dialog.js +36 -0
  17. package/dist/components/drawer.js +35 -0
  18. package/dist/components/dropdown-menu.js +51 -0
  19. package/dist/components/empty.js +33 -0
  20. package/dist/components/field.js +78 -0
  21. package/dist/components/form.js +59 -0
  22. package/dist/components/hover-card.js +14 -0
  23. package/dist/components/input-group.js +63 -0
  24. package/dist/components/input-otp.js +21 -0
  25. package/dist/components/input.js +6 -0
  26. package/dist/components/item.js +66 -0
  27. package/dist/components/kbd.js +9 -0
  28. package/dist/components/label.js +8 -0
  29. package/dist/components/language-switcher.js +20 -0
  30. package/dist/components/menubar.js +54 -0
  31. package/dist/components/navigation-menu.js +31 -0
  32. package/dist/components/pagination.js +31 -0
  33. package/dist/components/popover.js +17 -0
  34. package/dist/components/progress.js +8 -0
  35. package/dist/components/radio-group.js +12 -0
  36. package/dist/components/scroll-area.js +13 -0
  37. package/dist/components/select.js +38 -0
  38. package/dist/components/separator.js +8 -0
  39. package/dist/components/sheet.js +40 -0
  40. package/dist/components/sidebar.js +213 -0
  41. package/dist/components/skeleton.js +6 -0
  42. package/dist/components/slider.js +14 -0
  43. package/dist/components/sonner.js +21 -0
  44. package/dist/components/spinner.js +7 -0
  45. package/dist/components/switch.js +8 -0
  46. package/dist/components/table.js +28 -0
  47. package/dist/components/tabs.js +17 -0
  48. package/dist/components/textarea.js +6 -0
  49. package/dist/components/toggle-group.js +22 -0
  50. package/dist/components/toggle.js +26 -0
  51. package/dist/components/tooltip.js +17 -0
  52. package/dist/hooks/use-mobile.js +15 -0
  53. package/dist/hooks/use-user.js +25 -0
  54. package/dist/lib/{utils.mjs → utils.js} +1 -1
  55. package/dist/logo.js +28 -0
  56. package/dist/postcss.config.mjs +1 -2
  57. package/dist/providers/auth-provider.js +27 -0
  58. package/dist/providers/index.js +23 -0
  59. package/dist/shared/access-denied.js +6 -0
  60. package/dist/shared/loader.js +41 -0
  61. package/dist/shared/page-loader.js +6 -0
  62. package/dist/shared/scroll-fade-effect.js +5 -0
  63. package/package.json +17 -20
  64. package/build.config.ts +0 -23
  65. package/components.json +0 -20
  66. package/dist/components/.gitkeep +0 -0
  67. package/dist/components/accordion.d.ts +0 -7
  68. package/dist/components/accordion.mjs +0 -58
  69. package/dist/components/alert-dialog.d.ts +0 -14
  70. package/dist/components/alert-dialog.mjs +0 -144
  71. package/dist/components/alert.d.ts +0 -9
  72. package/dist/components/alert.mjs +0 -62
  73. package/dist/components/aspect-ratio.d.ts +0 -4
  74. package/dist/components/aspect-ratio.mjs +0 -9
  75. package/dist/components/avatar.d.ts +0 -6
  76. package/dist/components/avatar.mjs +0 -50
  77. package/dist/components/badge.d.ts +0 -9
  78. package/dist/components/badge.mjs +0 -37
  79. package/dist/components/breadcrumb.d.ts +0 -11
  80. package/dist/components/breadcrumb.mjs +0 -105
  81. package/dist/components/button-group.d.ts +0 -13
  82. package/dist/components/button-group.mjs +0 -76
  83. package/dist/components/button.d.ts +0 -10
  84. package/dist/components/button.mjs +0 -51
  85. package/dist/components/calendar.d.ts +0 -8
  86. package/dist/components/calendar.mjs +0 -191
  87. package/dist/components/card.d.ts +0 -9
  88. package/dist/components/card.mjs +0 -90
  89. package/dist/components/checkbox.d.ts +0 -4
  90. package/dist/components/checkbox.mjs +0 -30
  91. package/dist/components/collapsible.d.ts +0 -6
  92. package/dist/components/collapsible.mjs +0 -31
  93. package/dist/components/command.d.ts +0 -18
  94. package/dist/components/command.mjs +0 -169
  95. package/dist/components/context-menu.d.ts +0 -25
  96. package/dist/components/context-menu.mjs +0 -218
  97. package/dist/components/dialog.d.ts +0 -15
  98. package/dist/components/dialog.mjs +0 -130
  99. package/dist/components/drawer.d.ts +0 -13
  100. package/dist/components/drawer.mjs +0 -124
  101. package/dist/components/dropdown-menu.d.ts +0 -25
  102. package/dist/components/dropdown-menu.mjs +0 -226
  103. package/dist/components/empty.d.ts +0 -12
  104. package/dist/components/empty.mjs +0 -102
  105. package/dist/components/field.d.ts +0 -25
  106. package/dist/components/field.mjs +0 -228
  107. package/dist/components/form.d.ts +0 -23
  108. package/dist/components/form.mjs +0 -123
  109. package/dist/components/hover-card.d.ts +0 -6
  110. package/dist/components/hover-card.mjs +0 -35
  111. package/dist/components/input-group.d.ts +0 -16
  112. package/dist/components/input-group.mjs +0 -155
  113. package/dist/components/input-otp.d.ts +0 -11
  114. package/dist/components/input-otp.mjs +0 -59
  115. package/dist/components/input.d.ts +0 -3
  116. package/dist/components/input.mjs +0 -19
  117. package/dist/components/item.d.ts +0 -23
  118. package/dist/components/item.mjs +0 -187
  119. package/dist/components/kbd.d.ts +0 -4
  120. package/dist/components/kbd.mjs +0 -28
  121. package/dist/components/label.d.ts +0 -4
  122. package/dist/components/label.mjs +0 -21
  123. package/dist/components/language-switcher.d.ts +0 -2
  124. package/dist/components/language-switcher.mjs +0 -30
  125. package/dist/components/menubar.d.ts +0 -26
  126. package/dist/components/menubar.mjs +0 -246
  127. package/dist/components/navigation-menu.d.ts +0 -14
  128. package/dist/components/navigation-menu.mjs +0 -166
  129. package/dist/components/pagination.d.ts +0 -15
  130. package/dist/components/pagination.mjs +0 -116
  131. package/dist/components/popover.d.ts +0 -7
  132. package/dist/components/popover.mjs +0 -40
  133. package/dist/components/progress.d.ts +0 -4
  134. package/dist/components/progress.mjs +0 -30
  135. package/dist/components/radio-group.d.ts +0 -5
  136. package/dist/components/radio-group.mjs +0 -43
  137. package/dist/components/scroll-area.d.ts +0 -7
  138. package/dist/components/scroll-area.mjs +0 -59
  139. package/dist/components/select.d.ts +0 -15
  140. package/dist/components/select.mjs +0 -173
  141. package/dist/components/separator.d.ts +0 -4
  142. package/dist/components/separator.mjs +0 -25
  143. package/dist/components/sheet.d.ts +0 -13
  144. package/dist/components/sheet.mjs +0 -119
  145. package/dist/components/sidebar.d.ts +0 -69
  146. package/dist/components/sidebar.mjs +0 -635
  147. package/dist/components/skeleton.d.ts +0 -3
  148. package/dist/components/skeleton.mjs +0 -13
  149. package/dist/components/slider.d.ts +0 -4
  150. package/dist/components/slider.mjs +0 -59
  151. package/dist/components/sonner.d.ts +0 -4
  152. package/dist/components/sonner.mjs +0 -36
  153. package/dist/components/spinner.d.ts +0 -3
  154. package/dist/components/spinner.mjs +0 -15
  155. package/dist/components/switch.d.ts +0 -4
  156. package/dist/components/switch.mjs +0 -30
  157. package/dist/components/table.d.ts +0 -10
  158. package/dist/components/table.mjs +0 -115
  159. package/dist/components/tabs.d.ts +0 -7
  160. package/dist/components/tabs.mjs +0 -63
  161. package/dist/components/textarea.d.ts +0 -3
  162. package/dist/components/textarea.mjs +0 -16
  163. package/dist/components/toggle-group.d.ts +0 -9
  164. package/dist/components/toggle-group.mjs +0 -65
  165. package/dist/components/toggle.d.ts +0 -9
  166. package/dist/components/toggle.mjs +0 -41
  167. package/dist/components/tooltip.d.ts +0 -7
  168. package/dist/components/tooltip.mjs +0 -49
  169. package/dist/hooks/.gitkeep +0 -0
  170. package/dist/hooks/use-mobile.d.ts +0 -1
  171. package/dist/hooks/use-mobile.mjs +0 -17
  172. package/dist/hooks/use-user.d.ts +0 -12
  173. package/dist/hooks/use-user.mjs +0 -12
  174. package/dist/index.mjs +0 -15
  175. package/dist/lib/utils.d.ts +0 -2
  176. package/dist/logo.d.ts +0 -15
  177. package/dist/logo.mjs +0 -32
  178. package/dist/postcss.config.d.mts +0 -3
  179. package/dist/providers/auth-provider.d.ts +0 -15
  180. package/dist/providers/auth-provider.mjs +0 -37
  181. package/dist/providers/index.d.ts +0 -7
  182. package/dist/providers/index.mjs +0 -33
  183. package/dist/shared/access-denied.d.ts +0 -2
  184. package/dist/shared/access-denied.mjs +0 -12
  185. package/dist/shared/loader.d.ts +0 -11
  186. package/dist/shared/loader.mjs +0 -98
  187. package/dist/shared/page-loader.d.ts +0 -7
  188. package/dist/shared/page-loader.mjs +0 -6
  189. package/dist/shared/scroll-fade-effect.d.ts +0 -4
  190. package/dist/shared/scroll-fade-effect.mjs +0 -20
  191. package/dist/styles/globals.css +0 -1
  192. package/postcss.config.mjs +0 -6
  193. package/scripts/switchToDist.js +0 -55
  194. package/scripts/switchToSrc.js +0 -52
  195. package/src/components/.gitkeep +0 -0
  196. package/src/components/accordion.tsx +0 -66
  197. package/src/components/alert-dialog.tsx +0 -157
  198. package/src/components/alert.tsx +0 -66
  199. package/src/components/aspect-ratio.tsx +0 -12
  200. package/src/components/avatar.tsx +0 -53
  201. package/src/components/badge.tsx +0 -46
  202. package/src/components/breadcrumb.tsx +0 -111
  203. package/src/components/button-group.tsx +0 -86
  204. package/src/components/button.tsx +0 -62
  205. package/src/components/calendar.tsx +0 -220
  206. package/src/components/card.tsx +0 -92
  207. package/src/components/checkbox.tsx +0 -32
  208. package/src/components/collapsible.tsx +0 -34
  209. package/src/components/command.tsx +0 -184
  210. package/src/components/context-menu.tsx +0 -252
  211. package/src/components/dialog.tsx +0 -143
  212. package/src/components/drawer.tsx +0 -135
  213. package/src/components/dropdown-menu.tsx +0 -257
  214. package/src/components/empty.tsx +0 -105
  215. package/src/components/field.tsx +0 -251
  216. package/src/components/form.tsx +0 -170
  217. package/src/components/hover-card.tsx +0 -44
  218. package/src/components/input-group.tsx +0 -170
  219. package/src/components/input-otp.tsx +0 -77
  220. package/src/components/input.tsx +0 -21
  221. package/src/components/item.tsx +0 -193
  222. package/src/components/kbd.tsx +0 -29
  223. package/src/components/label.tsx +0 -24
  224. package/src/components/language-switcher.tsx +0 -49
  225. package/src/components/menubar.tsx +0 -276
  226. package/src/components/navigation-menu.tsx +0 -168
  227. package/src/components/pagination.tsx +0 -130
  228. package/src/components/popover.tsx +0 -48
  229. package/src/components/progress.tsx +0 -31
  230. package/src/components/radio-group.tsx +0 -45
  231. package/src/components/scroll-area.tsx +0 -67
  232. package/src/components/select.tsx +0 -190
  233. package/src/components/separator.tsx +0 -28
  234. package/src/components/sheet.tsx +0 -139
  235. package/src/components/sidebar.tsx +0 -726
  236. package/src/components/skeleton.tsx +0 -14
  237. package/src/components/slider.tsx +0 -63
  238. package/src/components/sonner.tsx +0 -41
  239. package/src/components/spinner.tsx +0 -17
  240. package/src/components/switch.tsx +0 -31
  241. package/src/components/table.tsx +0 -116
  242. package/src/components/tabs.tsx +0 -66
  243. package/src/components/textarea.tsx +0 -18
  244. package/src/components/toggle-group.tsx +0 -83
  245. package/src/components/toggle.tsx +0 -47
  246. package/src/components/tooltip.tsx +0 -61
  247. package/src/hooks/.gitkeep +0 -0
  248. package/src/hooks/use-mobile.ts +0 -21
  249. package/src/hooks/use-user.ts +0 -27
  250. package/src/index.ts +0 -15
  251. package/src/lib/utils.ts +0 -6
  252. package/src/logo.tsx +0 -49
  253. package/src/postcss.config.mjs +0 -6
  254. package/src/providers/auth-provider.tsx +0 -66
  255. package/src/providers/index.tsx +0 -50
  256. package/src/shared/access-denied.tsx +0 -31
  257. package/src/shared/loader.tsx +0 -109
  258. package/src/shared/page-loader.tsx +0 -24
  259. package/src/shared/scroll-fade-effect.tsx +0 -23
  260. package/src/styles/globals.css +0 -314
  261. package/tsconfig.json +0 -24
  262. /package/dist/{index.d.ts → index.js} +0 -0
@@ -1,251 +0,0 @@
1
- /** biome-ignore-all lint/a11y/useSemanticElements: <explanation> */
2
- /** biome-ignore-all lint/suspicious/noArrayIndexKey: <explanation> */
3
- "use client";
4
-
5
- import { cva, type VariantProps } from "class-variance-authority";
6
- import * as React from "react";
7
- import { useMemo } from "react";
8
-
9
- import { cn } from "../lib/utils";
10
- import { Label } from "./label";
11
- import { Separator } from "./separator";
12
-
13
- function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
14
- return (
15
- <fieldset
16
- data-slot="field-set"
17
- className={cn(
18
- "flex flex-col gap-6",
19
- "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
20
- className,
21
- )}
22
- {...props}
23
- />
24
- );
25
- }
26
-
27
- function FieldLegend({
28
- className,
29
- variant = "legend",
30
- ...props
31
- }: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
32
- return (
33
- <legend
34
- data-slot="field-legend"
35
- data-variant={variant}
36
- className={cn(
37
- "mb-3 font-medium",
38
- "data-[variant=legend]:text-base",
39
- "data-[variant=label]:text-sm",
40
- className,
41
- )}
42
- {...props}
43
- />
44
- );
45
- }
46
-
47
- function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
48
- return (
49
- <div
50
- data-slot="field-group"
51
- className={cn(
52
- "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
53
- className,
54
- )}
55
- {...props}
56
- />
57
- );
58
- }
59
-
60
- const fieldVariants = cva(
61
- "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
62
- {
63
- variants: {
64
- orientation: {
65
- vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
66
- horizontal: [
67
- "flex-row items-center",
68
- "[&>[data-slot=field-label]]:flex-auto",
69
- "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
70
- ],
71
- responsive: [
72
- "flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
73
- "@md/field-group:[&>[data-slot=field-label]]:flex-auto",
74
- "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
75
- ],
76
- },
77
- },
78
- defaultVariants: {
79
- orientation: "vertical",
80
- },
81
- },
82
- );
83
-
84
- function Field({
85
- className,
86
- orientation = "vertical",
87
- ...props
88
- }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
89
- return (
90
- <div
91
- role="group"
92
- data-slot="field"
93
- data-orientation={orientation}
94
- className={cn(fieldVariants({ orientation }), className)}
95
- {...props}
96
- />
97
- );
98
- }
99
-
100
- function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
101
- return (
102
- <div
103
- data-slot="field-content"
104
- className={cn(
105
- "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
106
- className,
107
- )}
108
- {...props}
109
- />
110
- );
111
- }
112
-
113
- function FieldLabel({
114
- className,
115
- ...props
116
- }: React.ComponentProps<typeof Label>) {
117
- return (
118
- <Label
119
- data-slot="field-label"
120
- className={cn(
121
- "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
122
- "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4",
123
- "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
124
- className,
125
- )}
126
- {...props}
127
- />
128
- );
129
- }
130
-
131
- function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
132
- return (
133
- <div
134
- data-slot="field-label"
135
- className={cn(
136
- "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
137
- className,
138
- )}
139
- {...props}
140
- />
141
- );
142
- }
143
-
144
- function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
145
- return (
146
- <p
147
- data-slot="field-description"
148
- className={cn(
149
- "text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
150
- "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
151
- "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
152
- className,
153
- )}
154
- {...props}
155
- />
156
- );
157
- }
158
-
159
- function FieldSeparator({
160
- children,
161
- className,
162
- ...props
163
- }: React.ComponentProps<"div"> & {
164
- children?: React.ReactNode;
165
- }) {
166
- return (
167
- <div
168
- data-slot="field-separator"
169
- data-content={!!children}
170
- className={cn(
171
- "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
172
- className,
173
- )}
174
- {...props}
175
- >
176
- <Separator className="absolute inset-0 top-1/2" />
177
- {children && (
178
- <span
179
- className="bg-background text-muted-foreground relative mx-auto block w-fit px-2"
180
- data-slot="field-separator-content"
181
- >
182
- {children}
183
- </span>
184
- )}
185
- </div>
186
- );
187
- }
188
-
189
- function FieldError({
190
- className,
191
- children,
192
- errors,
193
- ...props
194
- }: React.ComponentProps<"div"> & {
195
- errors?: Array<{ message?: string } | undefined>;
196
- }) {
197
- const content = useMemo(() => {
198
- if (children) {
199
- return children;
200
- }
201
-
202
- if (!errors?.length) {
203
- return null;
204
- }
205
-
206
- const uniqueErrors = [
207
- ...new Map(errors.map((error) => [error?.message, error])).values(),
208
- ];
209
-
210
- if (uniqueErrors?.length === 1) {
211
- return uniqueErrors[0]?.message;
212
- }
213
-
214
- return (
215
- <ul className="ml-4 flex list-disc flex-col gap-1">
216
- {uniqueErrors.map(
217
- (error, index) =>
218
- error?.message && <li key={index}>{error.message}</li>,
219
- )}
220
- </ul>
221
- );
222
- }, [children, errors]);
223
-
224
- if (!content) {
225
- return null;
226
- }
227
-
228
- return (
229
- <div
230
- role="alert"
231
- data-slot="field-error"
232
- className={cn("text-destructive text-sm font-normal", className)}
233
- {...props}
234
- >
235
- {content}
236
- </div>
237
- );
238
- }
239
-
240
- export {
241
- Field,
242
- FieldLabel,
243
- FieldDescription,
244
- FieldError,
245
- FieldGroup,
246
- FieldLegend,
247
- FieldSeparator,
248
- FieldSet,
249
- FieldContent,
250
- FieldTitle,
251
- };
@@ -1,170 +0,0 @@
1
- "use client";
2
-
3
- import { type Label as LabelPrimitive, Slot as SlotPrimitive } from "radix-ui";
4
-
5
- import * as React from "react";
6
- import {
7
- Controller,
8
- type ControllerProps,
9
- type FieldPath,
10
- type FieldValues,
11
- FormProvider,
12
- useFormContext,
13
- useFormState,
14
- } from "react-hook-form";
15
-
16
- import { cn } from "../lib/utils";
17
- import { Label } from "./label";
18
-
19
- const Form = FormProvider;
20
-
21
- type FormFieldContextValue<
22
- TFieldValues extends FieldValues = FieldValues,
23
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
24
- > = {
25
- name: TName;
26
- };
27
-
28
- const FormFieldContext = React.createContext<FormFieldContextValue>(
29
- {} as FormFieldContextValue,
30
- );
31
-
32
- const FormField = <
33
- TFieldValues extends FieldValues = FieldValues,
34
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
35
- >({
36
- ...props
37
- }: ControllerProps<TFieldValues, TName>) => {
38
- return (
39
- <FormFieldContext.Provider value={{ name: props.name }}>
40
- <Controller {...props} />
41
- </FormFieldContext.Provider>
42
- );
43
- };
44
-
45
- const useFormField = () => {
46
- const fieldContext = React.useContext(FormFieldContext);
47
- const itemContext = React.useContext(FormItemContext);
48
- const { getFieldState } = useFormContext();
49
- const formState = useFormState({ name: fieldContext.name });
50
- const fieldState = getFieldState(fieldContext.name, formState);
51
-
52
- if (!fieldContext) {
53
- throw new Error("useFormField should be used within <FormField>");
54
- }
55
-
56
- const { id } = itemContext;
57
-
58
- return {
59
- id,
60
- name: fieldContext.name,
61
- formItemId: `${id}-form-item`,
62
- formDescriptionId: `${id}-form-item-description`,
63
- formMessageId: `${id}-form-item-message`,
64
- ...fieldState,
65
- };
66
- };
67
-
68
- type FormItemContextValue = {
69
- id: string;
70
- };
71
-
72
- const FormItemContext = React.createContext<FormItemContextValue>(
73
- {} as FormItemContextValue,
74
- );
75
-
76
- function FormItem({ className, ...props }: React.ComponentProps<"div">) {
77
- const id = React.useId();
78
-
79
- return (
80
- <FormItemContext.Provider value={{ id }}>
81
- <div
82
- data-slot="form-item"
83
- className={cn("grid gap-2", className)}
84
- {...props}
85
- />
86
- </FormItemContext.Provider>
87
- );
88
- }
89
-
90
- function FormLabel({
91
- className,
92
- ...props
93
- }: React.ComponentProps<typeof LabelPrimitive.Root>) {
94
- const { error, formItemId } = useFormField();
95
-
96
- return (
97
- <Label
98
- data-slot="form-label"
99
- data-error={!!error}
100
- className={cn("data-[error=true]:text-destructive", className)}
101
- htmlFor={formItemId}
102
- {...props}
103
- />
104
- );
105
- }
106
-
107
- function FormControl({
108
- ...props
109
- }: React.ComponentProps<typeof SlotPrimitive.Slot>) {
110
- const { error, formItemId, formDescriptionId, formMessageId } =
111
- useFormField();
112
-
113
- return (
114
- <SlotPrimitive.Slot
115
- data-slot="form-control"
116
- id={formItemId}
117
- aria-describedby={
118
- !error
119
- ? `${formDescriptionId}`
120
- : `${formDescriptionId} ${formMessageId}`
121
- }
122
- aria-invalid={!!error}
123
- {...props}
124
- />
125
- );
126
- }
127
-
128
- function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
129
- const { formDescriptionId } = useFormField();
130
-
131
- return (
132
- <p
133
- data-slot="form-description"
134
- id={formDescriptionId}
135
- className={cn("text-muted-foreground text-sm", className)}
136
- {...props}
137
- />
138
- );
139
- }
140
-
141
- function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
142
- const { error, formMessageId } = useFormField();
143
- const body = error ? String(error?.message ?? "") : props.children;
144
-
145
- if (!body) {
146
- return null;
147
- }
148
-
149
- return (
150
- <p
151
- data-slot="form-message"
152
- id={formMessageId}
153
- className={cn("text-destructive text-sm", className)}
154
- {...props}
155
- >
156
- {body}
157
- </p>
158
- );
159
- }
160
-
161
- export {
162
- useFormField,
163
- Form,
164
- FormItem,
165
- FormLabel,
166
- FormControl,
167
- FormDescription,
168
- FormMessage,
169
- FormField,
170
- };
@@ -1,44 +0,0 @@
1
- "use client";
2
-
3
- import { HoverCard as HoverCardPrimitive } from "radix-ui";
4
- import * as React from "react";
5
-
6
- import { cn } from "../lib/utils";
7
-
8
- function HoverCard({
9
- ...props
10
- }: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
11
- return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
12
- }
13
-
14
- function HoverCardTrigger({
15
- ...props
16
- }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
17
- return (
18
- <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
19
- );
20
- }
21
-
22
- function HoverCardContent({
23
- className,
24
- align = "center",
25
- sideOffset = 4,
26
- ...props
27
- }: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
28
- return (
29
- <HoverCardPrimitive.Portal data-slot="hover-card-portal">
30
- <HoverCardPrimitive.Content
31
- data-slot="hover-card-content"
32
- align={align}
33
- sideOffset={sideOffset}
34
- className={cn(
35
- "bg-popover text-popover-foreground 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 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
36
- className,
37
- )}
38
- {...props}
39
- />
40
- </HoverCardPrimitive.Portal>
41
- );
42
- }
43
-
44
- export { HoverCard, HoverCardTrigger, HoverCardContent };
@@ -1,170 +0,0 @@
1
- "use client";
2
-
3
- import { cva, type VariantProps } from "class-variance-authority";
4
- import * as React from "react";
5
-
6
- import { cn } from "../lib/utils";
7
- import { Button } from "./button";
8
- import { Input } from "./input";
9
- import { Textarea } from "./textarea";
10
-
11
- function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
12
- return (
13
- <div
14
- data-slot="input-group"
15
- role="group"
16
- className={cn(
17
- "group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
18
- "h-9 min-w-0 has-[>textarea]:h-auto",
19
-
20
- // Variants based on alignment.
21
- "has-[>[data-align=inline-start]]:[&>input]:pl-2",
22
- "has-[>[data-align=inline-end]]:[&>input]:pr-2",
23
- "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
24
- "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
25
-
26
- // Focus state.
27
- "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
28
-
29
- // Error state.
30
- "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
31
-
32
- className,
33
- )}
34
- {...props}
35
- />
36
- );
37
- }
38
-
39
- const inputGroupAddonVariants = cva(
40
- "text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
41
- {
42
- variants: {
43
- align: {
44
- "inline-start":
45
- "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
46
- "inline-end":
47
- "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
48
- "block-start":
49
- "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
50
- "block-end":
51
- "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5",
52
- },
53
- },
54
- defaultVariants: {
55
- align: "inline-start",
56
- },
57
- },
58
- );
59
-
60
- function InputGroupAddon({
61
- className,
62
- align = "inline-start",
63
- ...props
64
- }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
65
- return (
66
- <div
67
- role="group"
68
- data-slot="input-group-addon"
69
- data-align={align}
70
- className={cn(inputGroupAddonVariants({ align }), className)}
71
- onClick={(e) => {
72
- if ((e.target as HTMLElement).closest("button")) {
73
- return;
74
- }
75
- e.currentTarget.parentElement?.querySelector("input")?.focus();
76
- }}
77
- {...props}
78
- />
79
- );
80
- }
81
-
82
- const inputGroupButtonVariants = cva(
83
- "text-sm shadow-none flex gap-2 items-center",
84
- {
85
- variants: {
86
- size: {
87
- xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
88
- sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
89
- "icon-xs":
90
- "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
91
- "icon-sm": "size-8 p-0 has-[>svg]:p-0",
92
- },
93
- },
94
- defaultVariants: {
95
- size: "xs",
96
- },
97
- },
98
- );
99
-
100
- function InputGroupButton({
101
- className,
102
- type = "button",
103
- variant = "ghost",
104
- size = "xs",
105
- ...props
106
- }: Omit<React.ComponentProps<typeof Button>, "size"> &
107
- VariantProps<typeof inputGroupButtonVariants>) {
108
- return (
109
- <Button
110
- type={type}
111
- data-size={size}
112
- variant={variant}
113
- className={cn(inputGroupButtonVariants({ size }), className)}
114
- {...props}
115
- />
116
- );
117
- }
118
-
119
- function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
120
- return (
121
- <span
122
- className={cn(
123
- "text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
124
- className,
125
- )}
126
- {...props}
127
- />
128
- );
129
- }
130
-
131
- function InputGroupInput({
132
- className,
133
- ...props
134
- }: React.ComponentProps<"input">) {
135
- return (
136
- <Input
137
- data-slot="input-group-control"
138
- className={cn(
139
- "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
140
- className,
141
- )}
142
- {...props}
143
- />
144
- );
145
- }
146
-
147
- function InputGroupTextarea({
148
- className,
149
- ...props
150
- }: React.ComponentProps<"textarea">) {
151
- return (
152
- <Textarea
153
- data-slot="input-group-control"
154
- className={cn(
155
- "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
156
- className,
157
- )}
158
- {...props}
159
- />
160
- );
161
- }
162
-
163
- export {
164
- InputGroup,
165
- InputGroupAddon,
166
- InputGroupButton,
167
- InputGroupText,
168
- InputGroupInput,
169
- InputGroupTextarea,
170
- };
@@ -1,77 +0,0 @@
1
- "use client";
2
-
3
- import { OTPInput, OTPInputContext } from "input-otp";
4
- import { MinusIcon } from "lucide-react";
5
- import * as React from "react";
6
-
7
- import { cn } from "../lib/utils";
8
-
9
- function InputOTP({
10
- className,
11
- containerClassName,
12
- ...props
13
- }: React.ComponentProps<typeof OTPInput> & {
14
- containerClassName?: string;
15
- }) {
16
- return (
17
- <OTPInput
18
- data-slot="input-otp"
19
- containerClassName={cn(
20
- "flex items-center gap-2 has-disabled:opacity-50",
21
- containerClassName,
22
- )}
23
- className={cn("disabled:cursor-not-allowed", className)}
24
- {...props}
25
- />
26
- );
27
- }
28
-
29
- function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
30
- return (
31
- <div
32
- data-slot="input-otp-group"
33
- className={cn("flex items-center", className)}
34
- {...props}
35
- />
36
- );
37
- }
38
-
39
- function InputOTPSlot({
40
- index,
41
- className,
42
- ...props
43
- }: React.ComponentProps<"div"> & {
44
- index: number;
45
- }) {
46
- const inputOTPContext = React.useContext(OTPInputContext);
47
- const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
48
-
49
- return (
50
- <div
51
- data-slot="input-otp-slot"
52
- data-active={isActive}
53
- className={cn(
54
- "data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
55
- className,
56
- )}
57
- {...props}
58
- >
59
- {char}
60
- {hasFakeCaret && (
61
- <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
62
- <div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
63
- </div>
64
- )}
65
- </div>
66
- );
67
- }
68
-
69
- function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
70
- return (
71
- <div data-slot="input-otp-separator" role="separator" {...props}>
72
- <MinusIcon />
73
- </div>
74
- );
75
- }
76
-
77
- export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };