@mostra/kit 0.0.0-placeholder → 0.19.0

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 (298) hide show
  1. package/README.md +42 -1
  2. package/css/kit.css +59 -0
  3. package/css/shadcn.css +638 -0
  4. package/dist/index.d.ts +16 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +18 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/layout.d.ts +60 -0
  9. package/dist/layout.d.ts.map +1 -0
  10. package/dist/layout.js +112 -0
  11. package/dist/layout.js.map +1 -0
  12. package/dist/questionnaire.d.ts +100 -0
  13. package/dist/questionnaire.d.ts.map +1 -0
  14. package/dist/questionnaire.js +632 -0
  15. package/dist/questionnaire.js.map +1 -0
  16. package/package.json +120 -4
  17. package/registry/LICENSE.md +21 -0
  18. package/registry/base/accordion.json +19 -0
  19. package/registry/base/alert-dialog.json +21 -0
  20. package/registry/base/alert.json +18 -0
  21. package/registry/base/aspect-ratio.json +17 -0
  22. package/registry/base/attachment.json +22 -0
  23. package/registry/base/avatar.json +18 -0
  24. package/registry/base/badge.json +19 -0
  25. package/registry/base/breadcrumb.json +19 -0
  26. package/registry/base/bubble.json +19 -0
  27. package/registry/base/button-group.json +22 -0
  28. package/registry/base/button.json +19 -0
  29. package/registry/base/calendar.json +22 -0
  30. package/registry/base/card.json +17 -0
  31. package/registry/base/carousel.json +22 -0
  32. package/registry/base/chart.json +21 -0
  33. package/registry/base/checkbox.json +19 -0
  34. package/registry/base/code-block.json +23 -0
  35. package/registry/base/collapsible.json +17 -0
  36. package/registry/base/combobox.json +23 -0
  37. package/registry/base/command.json +23 -0
  38. package/registry/base/components/mostra/layout.tsx +221 -0
  39. package/registry/base/components/mostra/questionnaire.tsx +1005 -0
  40. package/registry/base/components/ui/accordion.tsx +71 -0
  41. package/registry/base/components/ui/alert-dialog.tsx +187 -0
  42. package/registry/base/components/ui/alert.tsx +75 -0
  43. package/registry/base/components/ui/aspect-ratio.tsx +22 -0
  44. package/registry/base/components/ui/attachment.tsx +207 -0
  45. package/registry/base/components/ui/avatar.tsx +108 -0
  46. package/registry/base/components/ui/badge.tsx +54 -0
  47. package/registry/base/components/ui/breadcrumb.tsx +124 -0
  48. package/registry/base/components/ui/bubble.tsx +127 -0
  49. package/registry/base/components/ui/button-group.tsx +87 -0
  50. package/registry/base/components/ui/button.tsx +57 -0
  51. package/registry/base/components/ui/calendar.tsx +221 -0
  52. package/registry/base/components/ui/card.tsx +102 -0
  53. package/registry/base/components/ui/carousel.tsx +242 -0
  54. package/registry/base/components/ui/chart.tsx +372 -0
  55. package/registry/base/components/ui/checkbox.tsx +28 -0
  56. package/registry/base/components/ui/code-block.tsx +249 -0
  57. package/registry/base/components/ui/collapsible.tsx +21 -0
  58. package/registry/base/components/ui/combobox.tsx +297 -0
  59. package/registry/base/components/ui/command.tsx +196 -0
  60. package/registry/base/components/ui/context-menu.tsx +270 -0
  61. package/registry/base/components/ui/dialog.tsx +160 -0
  62. package/registry/base/components/ui/direction.tsx +6 -0
  63. package/registry/base/components/ui/drawer.tsx +227 -0
  64. package/registry/base/components/ui/dropdown-menu.tsx +267 -0
  65. package/registry/base/components/ui/empty.tsx +103 -0
  66. package/registry/base/components/ui/field.tsx +238 -0
  67. package/registry/base/components/ui/hover-card.tsx +50 -0
  68. package/registry/base/components/ui/input-group.tsx +158 -0
  69. package/registry/base/components/ui/input-otp.tsx +86 -0
  70. package/registry/base/components/ui/input.tsx +19 -0
  71. package/registry/base/components/ui/item.tsx +201 -0
  72. package/registry/base/components/ui/kbd.tsx +26 -0
  73. package/registry/base/components/ui/label.tsx +19 -0
  74. package/registry/base/components/ui/marker.tsx +70 -0
  75. package/registry/base/components/ui/menubar.tsx +280 -0
  76. package/registry/base/components/ui/message-scroller.tsx +131 -0
  77. package/registry/base/components/ui/message.tsx +91 -0
  78. package/registry/base/components/ui/native-select.tsx +60 -0
  79. package/registry/base/components/ui/navigation-menu.tsx +167 -0
  80. package/registry/base/components/ui/pagination.tsx +130 -0
  81. package/registry/base/components/ui/popover.tsx +89 -0
  82. package/registry/base/components/ui/progress.tsx +82 -0
  83. package/registry/base/components/ui/questionnaire.tsx +324 -0
  84. package/registry/base/components/ui/radio-group.tsx +37 -0
  85. package/registry/base/components/ui/resizable.tsx +49 -0
  86. package/registry/base/components/ui/scroll-area.tsx +53 -0
  87. package/registry/base/components/ui/select.tsx +200 -0
  88. package/registry/base/components/ui/separator.tsx +24 -0
  89. package/registry/base/components/ui/sheet.tsx +138 -0
  90. package/registry/base/components/ui/sidebar.tsx +723 -0
  91. package/registry/base/components/ui/skeleton.tsx +13 -0
  92. package/registry/base/components/ui/slider.tsx +51 -0
  93. package/registry/base/components/ui/sonner.tsx +65 -0
  94. package/registry/base/components/ui/spinner.tsx +10 -0
  95. package/registry/base/components/ui/switch.tsx +31 -0
  96. package/registry/base/components/ui/table.tsx +116 -0
  97. package/registry/base/components/ui/tabs.tsx +85 -0
  98. package/registry/base/components/ui/textarea.tsx +17 -0
  99. package/registry/base/components/ui/toast.tsx +234 -0
  100. package/registry/base/components/ui/toggle-group.tsx +89 -0
  101. package/registry/base/components/ui/toggle.tsx +44 -0
  102. package/registry/base/components/ui/tooltip.tsx +65 -0
  103. package/registry/base/components/ui/trace.tsx +162 -0
  104. package/registry/base/context-menu.json +19 -0
  105. package/registry/base/dialog.json +22 -0
  106. package/registry/base/direction.json +17 -0
  107. package/registry/base/drawer.json +18 -0
  108. package/registry/base/dropdown-menu.json +19 -0
  109. package/registry/base/empty.json +18 -0
  110. package/registry/base/field.json +22 -0
  111. package/registry/base/hooks/use-highlighted-code.ts +75 -0
  112. package/registry/base/hooks/use-mobile.ts +19 -0
  113. package/registry/base/hover-card.json +18 -0
  114. package/registry/base/input-group.json +23 -0
  115. package/registry/base/input-otp.json +19 -0
  116. package/registry/base/input.json +18 -0
  117. package/registry/base/item.json +22 -0
  118. package/registry/base/kbd.json +17 -0
  119. package/registry/base/label.json +17 -0
  120. package/registry/base/lib/highlighter.tsx +124 -0
  121. package/registry/base/lib/utils.ts +1 -0
  122. package/registry/base/marker.json +19 -0
  123. package/registry/base/menubar.json +22 -0
  124. package/registry/base/message-scroller.json +22 -0
  125. package/registry/base/message.json +17 -0
  126. package/registry/base/mostra-layout.json +20 -0
  127. package/registry/base/mostra-questionnaire.json +22 -0
  128. package/registry/base/native-select.json +18 -0
  129. package/registry/base/navigation-menu.json +20 -0
  130. package/registry/base/pagination.json +21 -0
  131. package/registry/base/popover.json +18 -0
  132. package/registry/base/progress.json +18 -0
  133. package/registry/base/questionnaire.json +22 -0
  134. package/registry/base/radio-group.json +18 -0
  135. package/registry/base/registry.json +287 -0
  136. package/registry/base/resizable.json +18 -0
  137. package/registry/base/scroll-area.json +18 -0
  138. package/registry/base/select.json +19 -0
  139. package/registry/base/separator.json +18 -0
  140. package/registry/base/sheet.json +22 -0
  141. package/registry/base/sidebar.json +29 -0
  142. package/registry/base/skeleton.json +17 -0
  143. package/registry/base/slider.json +18 -0
  144. package/registry/base/sonner.json +18 -0
  145. package/registry/base/spinner.json +18 -0
  146. package/registry/base/switch.json +18 -0
  147. package/registry/base/table.json +17 -0
  148. package/registry/base/tabs.json +19 -0
  149. package/registry/base/textarea.json +17 -0
  150. package/registry/base/toast.json +22 -0
  151. package/registry/base/toggle-group.json +22 -0
  152. package/registry/base/toggle.json +19 -0
  153. package/registry/base/tooltip.json +18 -0
  154. package/registry/base/trace.json +21 -0
  155. package/registry/base/use-highlighted-code.json +21 -0
  156. package/registry/base/use-mobile.json +14 -0
  157. package/registry/base/utils.json +17 -0
  158. package/registry/radix/accordion.json +19 -0
  159. package/registry/radix/alert-dialog.json +21 -0
  160. package/registry/radix/alert.json +18 -0
  161. package/registry/radix/aspect-ratio.json +17 -0
  162. package/registry/radix/attachment.json +22 -0
  163. package/registry/radix/avatar.json +18 -0
  164. package/registry/radix/badge.json +19 -0
  165. package/registry/radix/breadcrumb.json +19 -0
  166. package/registry/radix/bubble.json +19 -0
  167. package/registry/radix/button-group.json +22 -0
  168. package/registry/radix/button.json +19 -0
  169. package/registry/radix/calendar.json +22 -0
  170. package/registry/radix/card.json +17 -0
  171. package/registry/radix/carousel.json +22 -0
  172. package/registry/radix/chart.json +18 -0
  173. package/registry/radix/checkbox.json +19 -0
  174. package/registry/radix/code-block.json +23 -0
  175. package/registry/radix/collapsible.json +17 -0
  176. package/registry/radix/combobox.json +23 -0
  177. package/registry/radix/command.json +23 -0
  178. package/registry/radix/components/mostra/layout.tsx +221 -0
  179. package/registry/radix/components/mostra/questionnaire.tsx +1005 -0
  180. package/registry/radix/components/ui/accordion.tsx +80 -0
  181. package/registry/radix/components/ui/alert-dialog.tsx +199 -0
  182. package/registry/radix/components/ui/alert.tsx +75 -0
  183. package/registry/radix/components/ui/aspect-ratio.tsx +11 -0
  184. package/registry/radix/components/ui/attachment.tsx +204 -0
  185. package/registry/radix/components/ui/avatar.tsx +111 -0
  186. package/registry/radix/components/ui/badge.tsx +51 -0
  187. package/registry/radix/components/ui/breadcrumb.tsx +121 -0
  188. package/registry/radix/components/ui/bubble.tsx +124 -0
  189. package/registry/radix/components/ui/button-group.tsx +83 -0
  190. package/registry/radix/components/ui/button.tsx +66 -0
  191. package/registry/radix/components/ui/calendar.tsx +222 -0
  192. package/registry/radix/components/ui/card.tsx +102 -0
  193. package/registry/radix/components/ui/carousel.tsx +242 -0
  194. package/registry/radix/components/ui/chart.tsx +372 -0
  195. package/registry/radix/components/ui/checkbox.tsx +32 -0
  196. package/registry/radix/components/ui/code-block.tsx +249 -0
  197. package/registry/radix/components/ui/collapsible.tsx +33 -0
  198. package/registry/radix/components/ui/combobox.tsx +299 -0
  199. package/registry/radix/components/ui/command.tsx +195 -0
  200. package/registry/radix/components/ui/context-menu.tsx +262 -0
  201. package/registry/radix/components/ui/dialog.tsx +168 -0
  202. package/registry/radix/components/ui/direction.tsx +22 -0
  203. package/registry/radix/components/ui/drawer.tsx +133 -0
  204. package/registry/radix/components/ui/dropdown-menu.tsx +268 -0
  205. package/registry/radix/components/ui/empty.tsx +103 -0
  206. package/registry/radix/components/ui/field.tsx +238 -0
  207. package/registry/radix/components/ui/hover-card.tsx +43 -0
  208. package/registry/radix/components/ui/input-group.tsx +156 -0
  209. package/registry/radix/components/ui/input-otp.tsx +86 -0
  210. package/registry/radix/components/ui/input.tsx +18 -0
  211. package/registry/radix/components/ui/item.tsx +196 -0
  212. package/registry/radix/components/ui/kbd.tsx +26 -0
  213. package/registry/radix/components/ui/label.tsx +23 -0
  214. package/registry/radix/components/ui/marker.tsx +68 -0
  215. package/registry/radix/components/ui/menubar.tsx +279 -0
  216. package/registry/radix/components/ui/message-scroller.tsx +131 -0
  217. package/registry/radix/components/ui/message.tsx +91 -0
  218. package/registry/radix/components/ui/native-select.tsx +60 -0
  219. package/registry/radix/components/ui/navigation-menu.tsx +163 -0
  220. package/registry/radix/components/ui/pagination.tsx +129 -0
  221. package/registry/radix/components/ui/popover.tsx +88 -0
  222. package/registry/radix/components/ui/progress.tsx +30 -0
  223. package/registry/radix/components/ui/questionnaire.tsx +324 -0
  224. package/registry/radix/components/ui/radio-group.tsx +43 -0
  225. package/registry/radix/components/ui/resizable.tsx +49 -0
  226. package/registry/radix/components/ui/scroll-area.tsx +54 -0
  227. package/registry/radix/components/ui/select.tsx +191 -0
  228. package/registry/radix/components/ui/separator.tsx +27 -0
  229. package/registry/radix/components/ui/sheet.tsx +147 -0
  230. package/registry/radix/components/ui/sidebar.tsx +702 -0
  231. package/registry/radix/components/ui/skeleton.tsx +13 -0
  232. package/registry/radix/components/ui/slider.tsx +62 -0
  233. package/registry/radix/components/ui/sonner.tsx +65 -0
  234. package/registry/radix/components/ui/spinner.tsx +10 -0
  235. package/registry/radix/components/ui/switch.tsx +32 -0
  236. package/registry/radix/components/ui/table.tsx +116 -0
  237. package/registry/radix/components/ui/tabs.tsx +129 -0
  238. package/registry/radix/components/ui/textarea.tsx +17 -0
  239. package/registry/radix/components/ui/toggle-group.tsx +89 -0
  240. package/registry/radix/components/ui/toggle.tsx +46 -0
  241. package/registry/radix/components/ui/tooltip.tsx +56 -0
  242. package/registry/radix/components/ui/trace.tsx +162 -0
  243. package/registry/radix/context-menu.json +19 -0
  244. package/registry/radix/dialog.json +22 -0
  245. package/registry/radix/direction.json +17 -0
  246. package/registry/radix/drawer.json +18 -0
  247. package/registry/radix/dropdown-menu.json +19 -0
  248. package/registry/radix/empty.json +18 -0
  249. package/registry/radix/field.json +22 -0
  250. package/registry/radix/hooks/use-highlighted-code.ts +75 -0
  251. package/registry/radix/hooks/use-mobile.ts +19 -0
  252. package/registry/radix/hover-card.json +18 -0
  253. package/registry/radix/input-group.json +23 -0
  254. package/registry/radix/input-otp.json +19 -0
  255. package/registry/radix/input.json +17 -0
  256. package/registry/radix/item.json +22 -0
  257. package/registry/radix/kbd.json +17 -0
  258. package/registry/radix/label.json +18 -0
  259. package/registry/radix/lib/highlighter.tsx +124 -0
  260. package/registry/radix/lib/utils.ts +1 -0
  261. package/registry/radix/marker.json +19 -0
  262. package/registry/radix/menubar.json +19 -0
  263. package/registry/radix/message-scroller.json +22 -0
  264. package/registry/radix/message.json +17 -0
  265. package/registry/radix/mostra-layout.json +20 -0
  266. package/registry/radix/mostra-questionnaire.json +22 -0
  267. package/registry/radix/native-select.json +18 -0
  268. package/registry/radix/navigation-menu.json +20 -0
  269. package/registry/radix/pagination.json +21 -0
  270. package/registry/radix/popover.json +18 -0
  271. package/registry/radix/progress.json +18 -0
  272. package/registry/radix/questionnaire.json +22 -0
  273. package/registry/radix/radio-group.json +18 -0
  274. package/registry/radix/registry.json +283 -0
  275. package/registry/radix/resizable.json +18 -0
  276. package/registry/radix/scroll-area.json +18 -0
  277. package/registry/radix/select.json +19 -0
  278. package/registry/radix/separator.json +18 -0
  279. package/registry/radix/sheet.json +22 -0
  280. package/registry/radix/sidebar.json +29 -0
  281. package/registry/radix/skeleton.json +17 -0
  282. package/registry/radix/slider.json +18 -0
  283. package/registry/radix/sonner.json +18 -0
  284. package/registry/radix/spinner.json +18 -0
  285. package/registry/radix/switch.json +18 -0
  286. package/registry/radix/table.json +17 -0
  287. package/registry/radix/tabs.json +19 -0
  288. package/registry/radix/textarea.json +17 -0
  289. package/registry/radix/toggle-group.json +22 -0
  290. package/registry/radix/toggle.json +19 -0
  291. package/registry/radix/tooltip.json +18 -0
  292. package/registry/radix/trace.json +21 -0
  293. package/registry/radix/use-highlighted-code.json +21 -0
  294. package/registry/radix/use-mobile.json +14 -0
  295. package/registry/radix/utils.json +17 -0
  296. package/src/index.ts +15 -0
  297. package/src/layout.tsx +221 -0
  298. package/src/questionnaire.tsx +1005 -0
@@ -0,0 +1,238 @@
1
+ "use client"
2
+
3
+ import { useMemo } from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+ import { cn } from "cn"
6
+
7
+ import { Label } from "@/components/ui/label"
8
+ import { Separator } from "@/components/ui/separator"
9
+
10
+ function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
11
+ return (
12
+ <fieldset
13
+ data-slot="field-set"
14
+ className={cn(
15
+ "flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ function FieldLegend({
24
+ className,
25
+ variant = "legend",
26
+ ...props
27
+ }: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
28
+ return (
29
+ <legend
30
+ data-slot="field-legend"
31
+ data-variant={variant}
32
+ className={cn(
33
+ "mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",
34
+ className
35
+ )}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
43
+ <div
44
+ data-slot="field-group"
45
+ className={cn(
46
+ "group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ )
52
+ }
53
+
54
+ const fieldVariants = cva(
55
+ "group/field flex w-full gap-2 data-[invalid=true]:text-destructive",
56
+ {
57
+ variants: {
58
+ orientation: {
59
+ vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
60
+ horizontal:
61
+ "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
62
+ responsive:
63
+ "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
64
+ },
65
+ },
66
+ defaultVariants: {
67
+ orientation: "vertical",
68
+ },
69
+ }
70
+ )
71
+
72
+ function Field({
73
+ className,
74
+ orientation = "vertical",
75
+ ...props
76
+ }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
77
+ return (
78
+ <div
79
+ role="group"
80
+ data-slot="field"
81
+ data-orientation={orientation}
82
+ className={cn(fieldVariants({ orientation }), className)}
83
+ {...props}
84
+ />
85
+ )
86
+ }
87
+
88
+ function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
89
+ return (
90
+ <div
91
+ data-slot="field-content"
92
+ className={cn(
93
+ "group/field-content flex flex-1 flex-col gap-0.5 leading-snug",
94
+ className
95
+ )}
96
+ {...props}
97
+ />
98
+ )
99
+ }
100
+
101
+ function FieldLabel({
102
+ className,
103
+ ...props
104
+ }: React.ComponentProps<typeof Label>) {
105
+ return (
106
+ <Label
107
+ data-slot="field-label"
108
+ className={cn(
109
+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10",
110
+ "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",
111
+ className
112
+ )}
113
+ {...props}
114
+ />
115
+ )
116
+ }
117
+
118
+ function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
119
+ return (
120
+ <div
121
+ data-slot="field-label"
122
+ className={cn(
123
+ "flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",
124
+ className
125
+ )}
126
+ {...props}
127
+ />
128
+ )
129
+ }
130
+
131
+ function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
132
+ return (
133
+ <p
134
+ data-slot="field-description"
135
+ className={cn(
136
+ "text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
137
+ "last:mt-0 nth-last-2:-mt-1",
138
+ "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
139
+ className
140
+ )}
141
+ {...props}
142
+ />
143
+ )
144
+ }
145
+
146
+ function FieldSeparator({
147
+ children,
148
+ className,
149
+ ...props
150
+ }: React.ComponentProps<"div"> & {
151
+ children?: React.ReactNode
152
+ }) {
153
+ return (
154
+ <div
155
+ data-slot="field-separator"
156
+ data-content={!!children}
157
+ className={cn(
158
+ "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
159
+ className
160
+ )}
161
+ {...props}
162
+ >
163
+ <Separator className="absolute inset-0 top-1/2" />
164
+ {children && (
165
+ <span
166
+ className="relative mx-auto block w-fit bg-background px-2 text-muted-foreground"
167
+ data-slot="field-separator-content"
168
+ >
169
+ {children}
170
+ </span>
171
+ )}
172
+ </div>
173
+ )
174
+ }
175
+
176
+ function FieldError({
177
+ className,
178
+ children,
179
+ errors,
180
+ ...props
181
+ }: React.ComponentProps<"div"> & {
182
+ errors?: Array<{ message?: string } | undefined>
183
+ }) {
184
+ const content = useMemo(() => {
185
+ if (children) {
186
+ return children
187
+ }
188
+
189
+ if (!errors?.length) {
190
+ return null
191
+ }
192
+
193
+ const uniqueErrors = [
194
+ ...new Map(errors.map((error) => [error?.message, error])).values(),
195
+ ]
196
+
197
+ if (uniqueErrors?.length == 1) {
198
+ return uniqueErrors[0]?.message
199
+ }
200
+
201
+ return (
202
+ <ul className="ml-4 flex list-disc flex-col gap-1">
203
+ {uniqueErrors.map(
204
+ (error, index) =>
205
+ error?.message && <li key={index}>{error.message}</li>
206
+ )}
207
+ </ul>
208
+ )
209
+ }, [children, errors])
210
+
211
+ if (!content) {
212
+ return null
213
+ }
214
+
215
+ return (
216
+ <div
217
+ role="alert"
218
+ data-slot="field-error"
219
+ className={cn("text-sm font-normal text-destructive", className)}
220
+ {...props}
221
+ >
222
+ {content}
223
+ </div>
224
+ )
225
+ }
226
+
227
+ export {
228
+ Field,
229
+ FieldLabel,
230
+ FieldDescription,
231
+ FieldError,
232
+ FieldGroup,
233
+ FieldLegend,
234
+ FieldSeparator,
235
+ FieldSet,
236
+ FieldContent,
237
+ FieldTitle,
238
+ }
@@ -0,0 +1,50 @@
1
+ "use client"
2
+
3
+ import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card"
4
+ import { cn } from "cn"
5
+
6
+ function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) {
7
+ return <PreviewCardPrimitive.Root data-slot="hover-card" {...props} />
8
+ }
9
+
10
+ function HoverCardTrigger({ ...props }: PreviewCardPrimitive.Trigger.Props) {
11
+ return (
12
+ <PreviewCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
13
+ )
14
+ }
15
+
16
+ function HoverCardContent({
17
+ className,
18
+ side = "bottom",
19
+ sideOffset = 4,
20
+ align = "center",
21
+ alignOffset = 4,
22
+ ...props
23
+ }: PreviewCardPrimitive.Popup.Props &
24
+ Pick<
25
+ PreviewCardPrimitive.Positioner.Props,
26
+ "align" | "alignOffset" | "side" | "sideOffset"
27
+ >) {
28
+ return (
29
+ <PreviewCardPrimitive.Portal data-slot="hover-card-portal">
30
+ <PreviewCardPrimitive.Positioner
31
+ align={align}
32
+ alignOffset={alignOffset}
33
+ side={side}
34
+ sideOffset={sideOffset}
35
+ className="isolate z-50"
36
+ >
37
+ <PreviewCardPrimitive.Popup
38
+ data-slot="hover-card-content"
39
+ className={cn(
40
+ "z-50 w-64 origin-(--transform-origin) rounded-popover bg-popover p-2.5 text-sm text-popover-foreground outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 shadow-popover",
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ </PreviewCardPrimitive.Positioner>
46
+ </PreviewCardPrimitive.Portal>
47
+ )
48
+ }
49
+
50
+ export { HoverCard, HoverCardTrigger, HoverCardContent }
@@ -0,0 +1,158 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+ import { cn } from "cn"
6
+
7
+ import { Button } from "@/components/ui/button"
8
+ import { Input } from "@/components/ui/input"
9
+ import { Textarea } from "@/components/ui/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 relative flex h-(--control-h) w-full min-w-0 items-center rounded-control border border-input transition-[border-color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 shadow-control duration-(--state-ms)",
18
+ className
19
+ )}
20
+ {...props}
21
+ />
22
+ )
23
+ }
24
+
25
+ const inputGroupAddonVariants = cva(
26
+ "flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
27
+ {
28
+ variants: {
29
+ align: {
30
+ "inline-start":
31
+ "order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]",
32
+ "inline-end":
33
+ "order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]",
34
+ "block-start":
35
+ "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
36
+ "block-end":
37
+ "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2",
38
+ },
39
+ },
40
+ defaultVariants: {
41
+ align: "inline-start",
42
+ },
43
+ }
44
+ )
45
+
46
+ function InputGroupAddon({
47
+ className,
48
+ align = "inline-start",
49
+ ...props
50
+ }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
51
+ return (
52
+ <div
53
+ role="group"
54
+ data-slot="input-group-addon"
55
+ data-align={align}
56
+ className={cn(inputGroupAddonVariants({ align }), className)}
57
+ onClick={(e) => {
58
+ if ((e.target as HTMLElement).closest("button")) {
59
+ return
60
+ }
61
+ e.currentTarget.parentElement?.querySelector("input")?.focus()
62
+ }}
63
+ {...props}
64
+ />
65
+ )
66
+ }
67
+
68
+ const inputGroupButtonVariants = cva(
69
+ "flex items-center gap-2 text-sm shadow-none",
70
+ {
71
+ variants: {
72
+ size: {
73
+ xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
74
+ sm: "",
75
+ "icon-xs":
76
+ "size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0",
77
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0",
78
+ },
79
+ },
80
+ defaultVariants: {
81
+ size: "xs",
82
+ },
83
+ }
84
+ )
85
+
86
+ function InputGroupButton({
87
+ className,
88
+ type = "button",
89
+ variant = "ghost",
90
+ size = "xs",
91
+ ...props
92
+ }: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
93
+ VariantProps<typeof inputGroupButtonVariants> & {
94
+ type?: "button" | "submit" | "reset"
95
+ }) {
96
+ return (
97
+ <Button
98
+ type={type}
99
+ data-size={size}
100
+ variant={variant}
101
+ className={cn(inputGroupButtonVariants({ size }), className)}
102
+ {...props}
103
+ />
104
+ )
105
+ }
106
+
107
+ function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
108
+ return (
109
+ <span
110
+ className={cn(
111
+ "flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
112
+ className
113
+ )}
114
+ {...props}
115
+ />
116
+ )
117
+ }
118
+
119
+ function InputGroupInput({
120
+ className,
121
+ ...props
122
+ }: React.ComponentProps<"input">) {
123
+ return (
124
+ <Input
125
+ data-slot="input-group-control"
126
+ className={cn(
127
+ "flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
128
+ className
129
+ )}
130
+ {...props}
131
+ />
132
+ )
133
+ }
134
+
135
+ function InputGroupTextarea({
136
+ className,
137
+ ...props
138
+ }: React.ComponentProps<"textarea">) {
139
+ return (
140
+ <Textarea
141
+ data-slot="input-group-control"
142
+ className={cn(
143
+ "flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
144
+ className
145
+ )}
146
+ {...props}
147
+ />
148
+ )
149
+ }
150
+
151
+ export {
152
+ InputGroup,
153
+ InputGroupAddon,
154
+ InputGroupButton,
155
+ InputGroupText,
156
+ InputGroupInput,
157
+ InputGroupTextarea,
158
+ }
@@ -0,0 +1,86 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "cn"
5
+ import { OTPInput, OTPInputContext } from "input-otp"
6
+ import { MinusIcon } from "lucide-react"
7
+
8
+ function InputOTP({
9
+ className,
10
+ containerClassName,
11
+ ...props
12
+ }: React.ComponentProps<typeof OTPInput> & {
13
+ containerClassName?: string
14
+ }) {
15
+ return (
16
+ <OTPInput
17
+ data-slot="input-otp"
18
+ containerClassName={cn(
19
+ "cn-input-otp flex items-center has-disabled:opacity-50",
20
+ containerClassName
21
+ )}
22
+ spellCheck={false}
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(
34
+ "flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40",
35
+ className
36
+ )}
37
+ {...props}
38
+ />
39
+ )
40
+ }
41
+
42
+ function InputOTPSlot({
43
+ index,
44
+ className,
45
+ ...props
46
+ }: React.ComponentProps<"div"> & {
47
+ index: number
48
+ }) {
49
+ const inputOTPContext = React.useContext(OTPInputContext)
50
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
51
+
52
+ return (
53
+ <div
54
+ data-slot="input-otp-slot"
55
+ data-active={isActive}
56
+ className={cn(
57
+ "relative flex size-8 items-center justify-center border-y border-r border-input text-sm transition-all outline-none first:rounded-l-lg first:border-l last:rounded-r-lg aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",
58
+ className
59
+ )}
60
+ {...props}
61
+ >
62
+ {char}
63
+ {hasFakeCaret && (
64
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
65
+ <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
66
+ </div>
67
+ )}
68
+ </div>
69
+ )
70
+ }
71
+
72
+ function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
73
+ return (
74
+ <div
75
+ data-slot="input-otp-separator"
76
+ className="flex items-center [&_svg:not([class*='size-'])]:size-4"
77
+ role="separator"
78
+ {...props}
79
+ >
80
+ <MinusIcon
81
+ />
82
+ </div>
83
+ )
84
+ }
85
+
86
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
@@ -0,0 +1,19 @@
1
+ import * as React from "react"
2
+ import { Input as InputPrimitive } from "@base-ui/react/input"
3
+ import { cn } from "cn"
4
+
5
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
+ return (
7
+ <InputPrimitive
8
+ type={type}
9
+ data-slot="input"
10
+ className={cn(
11
+ "h-(--control-h) w-full min-w-0 rounded-control border border-input bg-(--field) px-3.5 text-base transition-[border-color,box-shadow] outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 shadow-control duration-(--state-ms)",
12
+ className
13
+ )}
14
+ {...props}
15
+ />
16
+ )
17
+ }
18
+
19
+ export { Input }