@constructive-io/ui 0.6.0 → 0.6.1

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 (414) hide show
  1. package/dist/button-D4vqTxhp.d.cts +20 -0
  2. package/dist/button-D4vqTxhp.d.ts +20 -0
  3. package/dist/components/alert-dialog.cjs +98 -302
  4. package/dist/components/alert-dialog.cjs.map +1 -1
  5. package/dist/components/alert-dialog.d.cts +22 -21
  6. package/dist/components/alert-dialog.d.ts +22 -21
  7. package/dist/components/alert-dialog.js +96 -281
  8. package/dist/components/alert-dialog.js.map +1 -1
  9. package/dist/components/alert.cjs +51 -108
  10. package/dist/components/alert.cjs.map +1 -1
  11. package/dist/components/alert.d.cts +13 -13
  12. package/dist/components/alert.d.ts +13 -13
  13. package/dist/components/alert.js +49 -87
  14. package/dist/components/alert.js.map +1 -1
  15. package/dist/components/app-bar.cjs +73 -359
  16. package/dist/components/app-bar.cjs.map +1 -1
  17. package/dist/components/app-bar.d.cts +21 -20
  18. package/dist/components/app-bar.d.ts +21 -20
  19. package/dist/components/app-bar.js +71 -338
  20. package/dist/components/app-bar.js.map +1 -1
  21. package/dist/components/app-shell.cjs +252 -1777
  22. package/dist/components/app-shell.cjs.map +1 -1
  23. package/dist/components/app-shell.d.cts +77 -85
  24. package/dist/components/app-shell.d.ts +77 -85
  25. package/dist/components/app-shell.js +249 -1756
  26. package/dist/components/app-shell.js.map +1 -1
  27. package/dist/components/autocomplete.cjs +146 -397
  28. package/dist/components/autocomplete.cjs.map +1 -1
  29. package/dist/components/autocomplete.d.cts +24 -24
  30. package/dist/components/autocomplete.d.ts +24 -24
  31. package/dist/components/autocomplete.js +146 -376
  32. package/dist/components/autocomplete.js.map +1 -1
  33. package/dist/components/avatar.cjs +26 -38
  34. package/dist/components/avatar.cjs.map +1 -1
  35. package/dist/components/avatar.d.cts +11 -10
  36. package/dist/components/avatar.d.ts +11 -10
  37. package/dist/components/avatar.js +24 -37
  38. package/dist/components/avatar.js.map +1 -1
  39. package/dist/components/badge.cjs +42 -60
  40. package/dist/components/badge.cjs.map +1 -1
  41. package/dist/components/badge.d.cts +13 -13
  42. package/dist/components/badge.d.ts +13 -13
  43. package/dist/components/badge.js +39 -38
  44. package/dist/components/badge.js.map +1 -1
  45. package/dist/components/breadcrumb.cjs +65 -94
  46. package/dist/components/breadcrumb.cjs.map +1 -1
  47. package/dist/components/breadcrumb.d.cts +14 -13
  48. package/dist/components/breadcrumb.d.ts +14 -13
  49. package/dist/components/breadcrumb.js +63 -73
  50. package/dist/components/breadcrumb.js.map +1 -1
  51. package/dist/components/button.cjs +68 -162
  52. package/dist/components/button.cjs.map +1 -1
  53. package/dist/components/button.d.cts +2 -20
  54. package/dist/components/button.d.ts +2 -20
  55. package/dist/components/button.js +65 -140
  56. package/dist/components/button.js.map +1 -1
  57. package/dist/components/calendar-rac.cjs +49 -62
  58. package/dist/components/calendar-rac.cjs.map +1 -1
  59. package/dist/components/calendar-rac.d.cts +8 -8
  60. package/dist/components/calendar-rac.d.ts +8 -8
  61. package/dist/components/calendar-rac.js +49 -61
  62. package/dist/components/calendar-rac.js.map +1 -1
  63. package/dist/components/card.cjs +61 -74
  64. package/dist/components/card.cjs.map +1 -1
  65. package/dist/components/card.d.cts +15 -16
  66. package/dist/components/card.d.ts +15 -16
  67. package/dist/components/card.js +58 -72
  68. package/dist/components/card.js.map +1 -1
  69. package/dist/components/checkbox-group.cjs +12 -11
  70. package/dist/components/checkbox-group.cjs.map +1 -1
  71. package/dist/components/checkbox-group.d.cts +5 -5
  72. package/dist/components/checkbox-group.d.ts +5 -5
  73. package/dist/components/checkbox-group.js +12 -10
  74. package/dist/components/checkbox-group.js.map +1 -1
  75. package/dist/components/checkbox.cjs +60 -114
  76. package/dist/components/checkbox.cjs.map +1 -1
  77. package/dist/components/checkbox.d.cts +6 -6
  78. package/dist/components/checkbox.d.ts +6 -6
  79. package/dist/components/checkbox.js +58 -93
  80. package/dist/components/checkbox.js.map +1 -1
  81. package/dist/components/collapsible.cjs +76 -113
  82. package/dist/components/collapsible.cjs.map +1 -1
  83. package/dist/components/collapsible.d.cts +16 -15
  84. package/dist/components/collapsible.d.ts +16 -15
  85. package/dist/components/collapsible.js +74 -92
  86. package/dist/components/collapsible.js.map +1 -1
  87. package/dist/components/combobox.cjs +213 -507
  88. package/dist/components/combobox.cjs.map +1 -1
  89. package/dist/components/combobox.d.cts +36 -35
  90. package/dist/components/combobox.d.ts +36 -35
  91. package/dist/components/combobox.js +229 -504
  92. package/dist/components/combobox.js.map +1 -1
  93. package/dist/components/command.cjs +102 -199
  94. package/dist/components/command.cjs.map +1 -1
  95. package/dist/components/command.d.cts +22 -21
  96. package/dist/components/command.d.ts +22 -21
  97. package/dist/components/command.js +100 -198
  98. package/dist/components/command.js.map +1 -1
  99. package/dist/components/dialog.cjs +110 -402
  100. package/dist/components/dialog.cjs.map +1 -1
  101. package/dist/components/dialog.d.cts +27 -26
  102. package/dist/components/dialog.d.ts +27 -26
  103. package/dist/components/dialog.js +107 -380
  104. package/dist/components/dialog.js.map +1 -1
  105. package/dist/components/dock.cjs +80 -111
  106. package/dist/components/dock.cjs.map +1 -1
  107. package/dist/components/dock.d.cts +25 -25
  108. package/dist/components/dock.d.ts +25 -25
  109. package/dist/components/dock.js +78 -106
  110. package/dist/components/dock.js.map +1 -1
  111. package/dist/components/drawer.cjs +77 -111
  112. package/dist/components/drawer.cjs.map +1 -1
  113. package/dist/components/drawer.d.cts +15 -14
  114. package/dist/components/drawer.d.ts +15 -14
  115. package/dist/components/drawer.js +75 -90
  116. package/dist/components/drawer.js.map +1 -1
  117. package/dist/components/dropdown-menu.cjs +163 -238
  118. package/dist/components/dropdown-menu.cjs.map +1 -1
  119. package/dist/components/dropdown-menu.d.cts +44 -43
  120. package/dist/components/dropdown-menu.d.ts +44 -43
  121. package/dist/components/dropdown-menu.js +161 -217
  122. package/dist/components/dropdown-menu.js.map +1 -1
  123. package/dist/components/empty.cjs +51 -85
  124. package/dist/components/empty.cjs.map +1 -1
  125. package/dist/components/empty.d.cts +13 -13
  126. package/dist/components/empty.d.ts +13 -13
  127. package/dist/components/empty.js +48 -83
  128. package/dist/components/empty.js.map +1 -1
  129. package/dist/components/field.cjs +150 -259
  130. package/dist/components/field.cjs.map +1 -1
  131. package/dist/components/field.d.cts +39 -39
  132. package/dist/components/field.d.ts +39 -39
  133. package/dist/components/field.js +148 -238
  134. package/dist/components/field.js.map +1 -1
  135. package/dist/components/flickering-grid.cjs +143 -166
  136. package/dist/components/flickering-grid.cjs.map +1 -1
  137. package/dist/components/flickering-grid.d.cts +14 -13
  138. package/dist/components/flickering-grid.d.ts +14 -13
  139. package/dist/components/flickering-grid.js +141 -161
  140. package/dist/components/flickering-grid.js.map +1 -1
  141. package/dist/components/flow-zoom-panel.cjs +56 -188
  142. package/dist/components/flow-zoom-panel.cjs.map +1 -1
  143. package/dist/components/flow-zoom-panel.d.cts +9 -9
  144. package/dist/components/flow-zoom-panel.d.ts +9 -9
  145. package/dist/components/flow-zoom-panel.js +56 -168
  146. package/dist/components/flow-zoom-panel.js.map +1 -1
  147. package/dist/components/form-control.cjs +58 -186
  148. package/dist/components/form-control.cjs.map +1 -1
  149. package/dist/components/form-control.d.cts +11 -10
  150. package/dist/components/form-control.d.ts +11 -10
  151. package/dist/components/form-control.js +56 -165
  152. package/dist/components/form-control.js.map +1 -1
  153. package/dist/components/form.cjs +78 -184
  154. package/dist/components/form.cjs.map +1 -1
  155. package/dist/components/form.d.cts +2 -36
  156. package/dist/components/form.d.ts +2 -36
  157. package/dist/components/form.js +76 -163
  158. package/dist/components/form.js.map +1 -1
  159. package/dist/components/input-group.cjs +51 -165
  160. package/dist/components/input-group.cjs.map +1 -1
  161. package/dist/components/input-group.d.cts +14 -15
  162. package/dist/components/input-group.d.ts +14 -15
  163. package/dist/components/input-group.js +51 -164
  164. package/dist/components/input-group.js.map +1 -1
  165. package/dist/components/input.cjs +30 -55
  166. package/dist/components/input.cjs.map +1 -1
  167. package/dist/components/input.d.cts +2 -10
  168. package/dist/components/input.d.ts +2 -10
  169. package/dist/components/input.js +30 -54
  170. package/dist/components/input.js.map +1 -1
  171. package/dist/components/json-input.cjs +133 -337
  172. package/dist/components/json-input.cjs.map +1 -1
  173. package/dist/components/json-input.d.cts +20 -19
  174. package/dist/components/json-input.d.ts +20 -19
  175. package/dist/components/json-input.js +132 -317
  176. package/dist/components/json-input.js.map +1 -1
  177. package/dist/components/label.cjs +19 -21
  178. package/dist/components/label.cjs.map +1 -1
  179. package/dist/components/label.d.cts +6 -5
  180. package/dist/components/label.d.ts +6 -5
  181. package/dist/components/label.js +17 -20
  182. package/dist/components/label.js.map +1 -1
  183. package/dist/components/motion-grid.cjs +61 -101
  184. package/dist/components/motion-grid.cjs.map +1 -1
  185. package/dist/components/motion-grid.d.cts +15 -14
  186. package/dist/components/motion-grid.d.ts +15 -14
  187. package/dist/components/motion-grid.js +59 -80
  188. package/dist/components/motion-grid.js.map +1 -1
  189. package/dist/components/multi-select.cjs +563 -786
  190. package/dist/components/multi-select.cjs.map +1 -1
  191. package/dist/components/multi-select.d.cts +173 -173
  192. package/dist/components/multi-select.d.ts +173 -173
  193. package/dist/components/multi-select.js +561 -765
  194. package/dist/components/multi-select.js.map +1 -1
  195. package/dist/components/page-header.cjs +24 -13
  196. package/dist/components/page-header.cjs.map +1 -1
  197. package/dist/components/page-header.d.cts +11 -11
  198. package/dist/components/page-header.d.ts +11 -11
  199. package/dist/components/page-header.js +23 -11
  200. package/dist/components/page-header.js.map +1 -1
  201. package/dist/components/pagination.cjs +72 -272
  202. package/dist/components/pagination.cjs.map +1 -1
  203. package/dist/components/pagination.d.cts +15 -16
  204. package/dist/components/pagination.d.ts +15 -16
  205. package/dist/components/pagination.js +69 -250
  206. package/dist/components/pagination.js.map +1 -1
  207. package/dist/components/popover.cjs +68 -111
  208. package/dist/components/popover.cjs.map +1 -1
  209. package/dist/components/popover.d.cts +31 -30
  210. package/dist/components/popover.d.ts +31 -30
  211. package/dist/components/popover.js +66 -90
  212. package/dist/components/popover.js.map +1 -1
  213. package/dist/components/portal.cjs +128 -81
  214. package/dist/components/portal.cjs.map +1 -1
  215. package/dist/components/portal.d.cts +24 -23
  216. package/dist/components/portal.d.ts +24 -23
  217. package/dist/components/portal.js +126 -60
  218. package/dist/components/portal.js.map +1 -1
  219. package/dist/components/progress.cjs +23 -24
  220. package/dist/components/progress.cjs.map +1 -1
  221. package/dist/components/progress.d.cts +8 -7
  222. package/dist/components/progress.d.ts +8 -7
  223. package/dist/components/progress.js +21 -23
  224. package/dist/components/progress.js.map +1 -1
  225. package/dist/components/progressive-blur-scroll-container.cjs +70 -138
  226. package/dist/components/progressive-blur-scroll-container.cjs.map +1 -1
  227. package/dist/components/progressive-blur-scroll-container.d.cts +19 -19
  228. package/dist/components/progressive-blur-scroll-container.d.ts +19 -19
  229. package/dist/components/progressive-blur-scroll-container.js +70 -137
  230. package/dist/components/progressive-blur-scroll-container.js.map +1 -1
  231. package/dist/components/progressive-blur.cjs +40 -64
  232. package/dist/components/progressive-blur.cjs.map +1 -1
  233. package/dist/components/progressive-blur.d.cts +15 -14
  234. package/dist/components/progressive-blur.d.ts +15 -14
  235. package/dist/components/progressive-blur.js +38 -63
  236. package/dist/components/progressive-blur.js.map +1 -1
  237. package/dist/components/radio-group.cjs +28 -42
  238. package/dist/components/radio-group.cjs.map +1 -1
  239. package/dist/components/radio-group.d.cts +8 -8
  240. package/dist/components/radio-group.d.ts +8 -8
  241. package/dist/components/radio-group.js +28 -41
  242. package/dist/components/radio-group.js.map +1 -1
  243. package/dist/components/record-picker.cjs +6 -418
  244. package/dist/components/record-picker.d.cts +13 -13
  245. package/dist/components/record-picker.d.ts +13 -13
  246. package/dist/components/record-picker.js +5 -397
  247. package/dist/components/resizable.cjs +32 -58
  248. package/dist/components/resizable.cjs.map +1 -1
  249. package/dist/components/resizable.d.cts +10 -9
  250. package/dist/components/resizable.d.ts +10 -9
  251. package/dist/components/resizable.js +29 -37
  252. package/dist/components/resizable.js.map +1 -1
  253. package/dist/components/responsive-diagram.cjs +50 -61
  254. package/dist/components/responsive-diagram.cjs.map +1 -1
  255. package/dist/components/responsive-diagram.d.cts +7 -7
  256. package/dist/components/responsive-diagram.d.ts +7 -7
  257. package/dist/components/responsive-diagram.js +50 -60
  258. package/dist/components/responsive-diagram.js.map +1 -1
  259. package/dist/components/scroll-area.cjs +37 -83
  260. package/dist/components/scroll-area.cjs.map +1 -1
  261. package/dist/components/scroll-area.d.cts +9 -8
  262. package/dist/components/scroll-area.d.ts +9 -8
  263. package/dist/components/scroll-area.js +35 -62
  264. package/dist/components/scroll-area.js.map +1 -1
  265. package/dist/components/select.cjs +175 -300
  266. package/dist/components/select.cjs.map +1 -1
  267. package/dist/components/select.d.cts +36 -35
  268. package/dist/components/select.d.ts +36 -35
  269. package/dist/components/select.js +172 -278
  270. package/dist/components/select.js.map +1 -1
  271. package/dist/components/separator.cjs +16 -19
  272. package/dist/components/separator.cjs.map +1 -1
  273. package/dist/components/separator.d.cts +2 -10
  274. package/dist/components/separator.d.ts +2 -10
  275. package/dist/components/separator.js +14 -18
  276. package/dist/components/separator.js.map +1 -1
  277. package/dist/components/sheet.cjs +17 -487
  278. package/dist/components/sheet.d.cts +85 -85
  279. package/dist/components/sheet.d.ts +85 -85
  280. package/dist/components/sheet.js +3 -453
  281. package/dist/components/sidebar.cjs +27 -1298
  282. package/dist/components/sidebar.d.cts +62 -65
  283. package/dist/components/sidebar.d.ts +62 -65
  284. package/dist/components/sidebar.js +3 -1254
  285. package/dist/components/skeleton.cjs +18 -30
  286. package/dist/components/skeleton.cjs.map +1 -1
  287. package/dist/components/skeleton.d.cts +6 -5
  288. package/dist/components/skeleton.d.ts +6 -5
  289. package/dist/components/skeleton.js +15 -28
  290. package/dist/components/skeleton.js.map +1 -1
  291. package/dist/components/sonner.cjs +17 -19
  292. package/dist/components/sonner.cjs.map +1 -1
  293. package/dist/components/sonner.d.cts +7 -7
  294. package/dist/components/sonner.d.ts +7 -7
  295. package/dist/components/sonner.js +17 -18
  296. package/dist/components/sonner.js.map +1 -1
  297. package/dist/components/stack/index.cjs +43 -1515
  298. package/dist/components/stack/index.d.cts +2 -672
  299. package/dist/components/stack/index.d.ts +2 -672
  300. package/dist/components/stack/index.js +3 -1455
  301. package/dist/components/stepper.cjs +131 -285
  302. package/dist/components/stepper.cjs.map +1 -1
  303. package/dist/components/stepper.d.cts +27 -26
  304. package/dist/components/stepper.d.ts +27 -26
  305. package/dist/components/stepper.js +130 -265
  306. package/dist/components/stepper.js.map +1 -1
  307. package/dist/components/switch.cjs +21 -32
  308. package/dist/components/switch.cjs.map +1 -1
  309. package/dist/components/switch.d.cts +7 -6
  310. package/dist/components/switch.d.ts +7 -6
  311. package/dist/components/switch.js +19 -31
  312. package/dist/components/switch.js.map +1 -1
  313. package/dist/components/table.cjs +58 -106
  314. package/dist/components/table.cjs.map +1 -1
  315. package/dist/components/table.d.cts +17 -16
  316. package/dist/components/table.d.ts +17 -16
  317. package/dist/components/table.js +55 -104
  318. package/dist/components/table.js.map +1 -1
  319. package/dist/components/tabs.cjs +31 -35
  320. package/dist/components/tabs.cjs.map +1 -1
  321. package/dist/components/tabs.d.cts +9 -8
  322. package/dist/components/tabs.d.ts +9 -8
  323. package/dist/components/tabs.js +29 -34
  324. package/dist/components/tabs.js.map +1 -1
  325. package/dist/components/tags.cjs +114 -433
  326. package/dist/components/tags.cjs.map +1 -1
  327. package/dist/components/tags.d.cts +24 -28
  328. package/dist/components/tags.d.ts +24 -28
  329. package/dist/components/tags.js +114 -413
  330. package/dist/components/tags.js.map +1 -1
  331. package/dist/components/textarea.cjs +27 -49
  332. package/dist/components/textarea.cjs.map +1 -1
  333. package/dist/components/textarea.d.cts +8 -7
  334. package/dist/components/textarea.d.ts +8 -7
  335. package/dist/components/textarea.js +27 -48
  336. package/dist/components/textarea.js.map +1 -1
  337. package/dist/components/toast/index.cjs +9 -612
  338. package/dist/components/toast/index.d.cts +2 -52
  339. package/dist/components/toast/index.d.ts +2 -52
  340. package/dist/components/toast/index.js +3 -586
  341. package/dist/components/tooltip.cjs +47 -72
  342. package/dist/components/tooltip.cjs.map +1 -1
  343. package/dist/components/tooltip.d.cts +2 -28
  344. package/dist/components/tooltip.d.ts +2 -28
  345. package/dist/components/tooltip.js +45 -51
  346. package/dist/components/tooltip.js.map +1 -1
  347. package/dist/components/unlink-button.cjs +19 -192
  348. package/dist/components/unlink-button.cjs.map +1 -1
  349. package/dist/components/unlink-button.d.cts +11 -11
  350. package/dist/components/unlink-button.d.ts +11 -11
  351. package/dist/components/unlink-button.js +18 -170
  352. package/dist/components/unlink-button.js.map +1 -1
  353. package/dist/form-DgRTv7O7.d.ts +54 -0
  354. package/dist/form-DoZEWSzb.d.cts +54 -0
  355. package/dist/index-CjA4CENl.d.cts +684 -0
  356. package/dist/index-CjA4CENl.d.ts +684 -0
  357. package/dist/index-UnM04j0t.d.cts +58 -0
  358. package/dist/index-UnM04j0t.d.ts +58 -0
  359. package/dist/index.cjs +408 -8697
  360. package/dist/index.d.cts +224 -2136
  361. package/dist/index.d.ts +224 -2136
  362. package/dist/index.js +65 -8350
  363. package/dist/input-CBrCuMH8.d.cts +11 -0
  364. package/dist/input-CBrCuMH8.d.ts +11 -0
  365. package/dist/motion-config-COCFHq1L.cjs +271 -0
  366. package/dist/motion-config-COCFHq1L.cjs.map +1 -0
  367. package/dist/motion-config-COsZ6azM.js +241 -0
  368. package/dist/motion-config-COsZ6azM.js.map +1 -0
  369. package/dist/record-picker-BbxngCeV.js +162 -0
  370. package/dist/record-picker-BbxngCeV.js.map +1 -0
  371. package/dist/record-picker-Bz4FApxD.cjs +167 -0
  372. package/dist/record-picker-Bz4FApxD.cjs.map +1 -0
  373. package/dist/rolldown-runtime-D_qnwXdH.cjs +35 -0
  374. package/dist/separator-BQEsr0Rc.d.cts +11 -0
  375. package/dist/separator-BQEsr0Rc.d.ts +11 -0
  376. package/dist/sheet-BLHnhLRH.js +425 -0
  377. package/dist/sheet-BLHnhLRH.js.map +1 -0
  378. package/dist/sheet-BdA0rfIz.cjs +515 -0
  379. package/dist/sheet-BdA0rfIz.cjs.map +1 -0
  380. package/dist/sidebar-CPy_fibW.cjs +608 -0
  381. package/dist/sidebar-CPy_fibW.cjs.map +1 -0
  382. package/dist/sidebar-Cfax0g0_.js +463 -0
  383. package/dist/sidebar-Cfax0g0_.js.map +1 -0
  384. package/dist/slot-C-jEfihz.cjs +122 -0
  385. package/dist/slot-C-jEfihz.cjs.map +1 -0
  386. package/dist/slot-EL8zfLG0.js +97 -0
  387. package/dist/slot-EL8zfLG0.js.map +1 -0
  388. package/dist/stack-DKdvlOM6.cjs +1771 -0
  389. package/dist/stack-DKdvlOM6.cjs.map +1 -0
  390. package/dist/stack-jMdxDrex.js +1531 -0
  391. package/dist/stack-jMdxDrex.js.map +1 -0
  392. package/dist/toast-D6MqijT2.cjs +316 -0
  393. package/dist/toast-D6MqijT2.cjs.map +1 -0
  394. package/dist/toast-D_BOLzm3.js +287 -0
  395. package/dist/toast-D_BOLzm3.js.map +1 -0
  396. package/dist/tooltip-CTRQoN1A.d.cts +29 -0
  397. package/dist/tooltip-CTRQoN1A.d.ts +29 -0
  398. package/dist/utils-BkMLyah9.js +12 -0
  399. package/dist/utils-BkMLyah9.js.map +1 -0
  400. package/dist/utils-CzTQ3-VI.cjs +17 -0
  401. package/dist/utils-CzTQ3-VI.cjs.map +1 -0
  402. package/package.json +5 -5
  403. package/dist/components/record-picker.cjs.map +0 -1
  404. package/dist/components/record-picker.js.map +0 -1
  405. package/dist/components/sheet.cjs.map +0 -1
  406. package/dist/components/sheet.js.map +0 -1
  407. package/dist/components/sidebar.cjs.map +0 -1
  408. package/dist/components/sidebar.js.map +0 -1
  409. package/dist/components/stack/index.cjs.map +0 -1
  410. package/dist/components/stack/index.js.map +0 -1
  411. package/dist/components/toast/index.cjs.map +0 -1
  412. package/dist/components/toast/index.js.map +0 -1
  413. package/dist/index.cjs.map +0 -1
  414. package/dist/index.js.map +0 -1
@@ -1,193 +1,65 @@
1
- "use client";
2
- 'use strict';
1
+ 'use client';
3
2
 
4
- var React = require('react');
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var clsx = require('clsx');
7
- var tailwindMerge = require('tailwind-merge');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
5
+ const require_utils = require('../utils-CzTQ3-VI.cjs');
6
+ const require_slot = require('../slot-C-jEfihz.cjs');
7
+ const require_components_label = require('./label.cjs');
8
+ let react = require("react");
9
+ react = require_rolldown_runtime.__toESM(react, 1);
10
+ let react_jsx_runtime = require("react/jsx-runtime");
8
11
 
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
-
29
- function composeRefs(...refs) {
30
- return (node) => {
31
- refs.forEach((ref) => {
32
- if (typeof ref === "function") {
33
- ref(node);
34
- } else if (ref != null) {
35
- ref.current = node;
36
- }
37
- });
38
- };
39
- }
40
- function mergeProps(slotProps, childProps) {
41
- const overrideProps = { ...childProps };
42
- for (const propName in childProps) {
43
- if (propName === "ref") continue;
44
- const slotPropValue = slotProps[propName];
45
- const childPropValue = childProps[propName];
46
- if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
47
- overrideProps[propName] = (...args) => {
48
- childPropValue(...args);
49
- slotPropValue(...args);
50
- };
51
- } else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
52
- overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
53
- } else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
54
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
55
- }
56
- }
57
- return { ...slotProps, ...overrideProps };
58
- }
59
- function isSlottable(child) {
60
- return React__namespace.isValidElement(child);
61
- }
62
- var Slot = React__namespace.forwardRef((props, forwardedRef) => {
63
- const { children, ...slotProps } = props;
64
- if (isSlottable(children)) {
65
- const childProps = children.props;
66
- const childRef = childProps.ref;
67
- return React__namespace.cloneElement(children, {
68
- ...mergeProps(slotProps, childProps),
69
- ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
70
- });
71
- }
72
- if (React__namespace.Children.count(children) > 1) {
73
- const childrenArray = React__namespace.Children.toArray(children);
74
- const slottableChild = childrenArray.find(
75
- (child) => React__namespace.isValidElement(child) && child.type === Slottable
76
- );
77
- if (slottableChild) {
78
- const newElement = slottableChild.props.children;
79
- if (isSlottable(newElement)) {
80
- const newElementProps = newElement.props;
81
- const newChildren = childrenArray.map((child) => {
82
- if (child === slottableChild) {
83
- return React__namespace.Children.count(newElementProps.children) > 1 ? React__namespace.Children.only(null) : newElementProps.children;
84
- }
85
- return child;
86
- });
87
- const childRef = newElementProps.ref;
88
- return React__namespace.cloneElement(newElement, {
89
- ...mergeProps(slotProps, newElementProps),
90
- ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
91
- children: newChildren
92
- });
93
- }
94
- }
95
- }
96
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
97
- });
98
- Slot.displayName = "Slot";
99
- function Slottable({ children }) {
100
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
101
- }
102
- function cn(...inputs) {
103
- return tailwindMerge.twMerge(clsx.clsx(inputs));
104
- }
105
- function Label({ className, ...props }) {
106
- return /* @__PURE__ */ jsxRuntime.jsx(
107
- "label",
108
- {
109
- "data-slot": "label",
110
- className: cn(
111
- `text-foreground text-sm leading-4 font-medium select-none group-data-[disabled=true]:pointer-events-none
112
- group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50
113
- data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,
114
- className
115
- ),
116
- ...props
117
- }
118
- );
119
- }
12
+ //#region src/components/form-control.tsx
120
13
  function FormControl({ children, label, id, layout = "stacked", error, className }) {
121
- const generatedId = React__namespace.useId();
122
- const inputId = id || generatedId;
123
- const errorId = error ? `${inputId}-error` : void 0;
124
- const childProps = {
125
- id: inputId,
126
- "aria-invalid": error ? true : void 0,
127
- "aria-describedby": errorId
128
- };
129
- if (layout === "floating") {
130
- childProps.placeholder = " ";
131
- }
132
- const childWithProps = React__namespace.cloneElement(children, childProps);
133
- if (layout === "floating") {
134
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
135
- /* @__PURE__ */ jsxRuntime.jsxs(
136
- "div",
137
- {
138
- className: cn(
139
- "relative",
140
- // Float label when focused
141
- "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0",
142
- "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]",
143
- "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80",
144
- // Float label when there's a value
145
- "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0",
146
- "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]",
147
- // Error
148
- error && "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive"
149
- ),
150
- children: [
151
- /* @__PURE__ */ jsxRuntime.jsx(
152
- Slot,
153
- {
154
- className: cn(
155
- error && "border-destructive focus-visible:ring-destructive/20"
156
- ),
157
- children: childWithProps
158
- }
159
- ),
160
- /* @__PURE__ */ jsxRuntime.jsx(
161
- Label,
162
- {
163
- htmlFor: inputId,
164
- "data-slot": "form-control-label",
165
- className: cn(
166
- // Base: centered when empty
167
- "pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]",
168
- // Small, subtle typography
169
- "origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none",
170
- // Snappy transition
171
- "transition-[transform,color] duration-200 ease-out motion-reduce:transition-none",
172
- // Error state
173
- error && "text-destructive"
174
- ),
175
- children: label
176
- }
177
- )
178
- ]
179
- }
180
- ),
181
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { id: errorId, className: "text-destructive text-xs", role: "alert", children: error })
182
- ] });
183
- }
184
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("grid gap-2", className), children: [
185
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: inputId, className: cn(error && "text-destructive"), children: label }),
186
- childWithProps,
187
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { id: errorId, className: "text-destructive text-sm", role: "alert", children: error })
188
- ] });
14
+ const generatedId = react.useId();
15
+ const inputId = id || generatedId;
16
+ const errorId = error ? `${inputId}-error` : void 0;
17
+ const childProps = {
18
+ id: inputId,
19
+ "aria-invalid": error ? true : void 0,
20
+ "aria-describedby": errorId
21
+ };
22
+ if (layout === "floating") childProps.placeholder = " ";
23
+ const childWithProps = react.cloneElement(children, childProps);
24
+ if (layout === "floating") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
25
+ className: require_utils.cn("space-y-1", className),
26
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
27
+ className: require_utils.cn("relative", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80", "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0", "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]", error && "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive"),
28
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_slot.Slot, {
29
+ className: require_utils.cn(error && "border-destructive focus-visible:ring-destructive/20"),
30
+ children: childWithProps
31
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_label.Label, {
32
+ htmlFor: inputId,
33
+ "data-slot": "form-control-label",
34
+ className: require_utils.cn("pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]", "origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none", "transition-[transform,color] duration-200 ease-out motion-reduce:transition-none", error && "text-destructive"),
35
+ children: label
36
+ })]
37
+ }), error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
38
+ id: errorId,
39
+ className: "text-destructive text-xs",
40
+ role: "alert",
41
+ children: error
42
+ })]
43
+ });
44
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
45
+ className: require_utils.cn("grid gap-2", className),
46
+ children: [
47
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_label.Label, {
48
+ htmlFor: inputId,
49
+ className: require_utils.cn(error && "text-destructive"),
50
+ children: label
51
+ }),
52
+ childWithProps,
53
+ error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
54
+ id: errorId,
55
+ className: "text-destructive text-sm",
56
+ role: "alert",
57
+ children: error
58
+ })
59
+ ]
60
+ });
189
61
  }
190
62
 
63
+ //#endregion
191
64
  exports.FormControl = FormControl;
192
- //# sourceMappingURL=form-control.cjs.map
193
65
  //# sourceMappingURL=form-control.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/slot.tsx","../../src/lib/utils.ts","../../src/components/label.tsx","../../src/components/form-control.tsx"],"names":["React","twMerge","clsx","jsx","React2","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA,KAAQ;AACrB,MAAA,IAAI,OAAO,QAAQ,UAAA,EAAY;AAC9B,QAAA,GAA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AS;AAAA,iBACX;AAAA,gBAEC,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAAA,OACF;AAAA,MACC,KAAA,oBACCA,cAAAA,CAAC,GAAA,EAAA,EAAE,EAAA,EAAI,SAAS,SAAA,EAAU,0BAAA,EAA2B,IAAA,EAAK,OAAA,EACvD,QAAA,EAAA,KAAA,EACH;AAAA,KAAA,EAEJ,CAAA;AAAA,EAEJ;AAEA,EAAA,uCACG,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,YAAA,EAAc,SAAS,CAAA,EACxC,QAAA,EAAA;AAAA,oBAAAA,cAAAA,CAAC,SAAM,OAAA,EAAS,OAAA,EAAS,WAAW,EAAA,CAAG,KAAA,IAAS,kBAAkB,CAAA,EAC/D,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,IACC,cAAA;AAAA,IACA,KAAA,oBACCA,cAAAA,CAAC,GAAA,EAAA,EAAE,EAAA,EAAI,SAAS,SAAA,EAAU,0BAAA,EAA2B,IAAA,EAAK,OAAA,EACvD,QAAA,EAAA,KAAA,EACH;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"form-control.cjs","sourcesContent":["'use client';\n\nimport * as React from 'react';\n\n/**\n * Merges refs into a single callback ref.\n * React 19 compatible - handles refs as regular props.\n */\nfunction composeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n\treturn (node) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(node);\n\t\t\t} else if (ref != null) {\n\t\t\t\t(ref as React.MutableRefObject<T | null>).current = node;\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Merges props, handling special cases for className, style, and event handlers.\n * Excludes 'ref' from merging as it's handled separately.\n */\nfunction mergeProps(\n\tslotProps: Record<string, unknown>,\n\tchildProps: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst overrideProps: Record<string, unknown> = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\t// Skip ref - handled separately for composition\n\t\tif (propName === 'ref') continue;\n\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\t// Compose event handlers\n\t\tif (/^on[A-Z]/.test(propName) && typeof slotPropValue === 'function' && typeof childPropValue === 'function') {\n\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\tchildPropValue(...args);\n\t\t\t\tslotPropValue(...args);\n\t\t\t};\n\t\t}\n\t\t// Merge className\n\t\telse if (propName === 'className' && typeof slotPropValue === 'string' && typeof childPropValue === 'string') {\n\t\t\toverrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();\n\t\t}\n\t\t// Merge style\n\t\telse if (propName === 'style' && typeof slotPropValue === 'object' && typeof childPropValue === 'object') {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\n/**\n * Merges props from a parent component with a child element's props,\n * including proper ref composition. Use this in render prop patterns\n * where the parent needs to merge its props with the child's.\n *\n * @param parentProps - Props from the parent component (e.g., triggerProps from Base UI)\n * @param childElement - The child React element whose props will be merged\n * @returns Merged props object ready to pass to React.cloneElement\n */\nfunction mergePropsWithRef<T = HTMLElement>(\n\tparentProps: Record<string, unknown>,\n\tchildElement: React.ReactElement,\n): Record<string, unknown> {\n\tconst childProps = childElement.props as Record<string, unknown>;\n\tconst parentRef = parentProps.ref as React.Ref<T> | undefined;\n\tconst childRef = childProps.ref as React.Ref<T> | undefined;\n\n\tconst mergedProps = mergeProps(parentProps, childProps);\n\n\t// Compose refs if either exists\n\tif (parentRef || childRef) {\n\t\tmergedProps.ref = composeRefs(parentRef, childRef);\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Check if a value is a valid slottable child (single React element).\n */\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n\treturn React.isValidElement(child);\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Slot component - renders its child element with merged props.\n * Used for the `asChild` pattern where parent props are passed to child.\n * React 19 compatible - accesses ref from props instead of element.ref.\n */\nconst Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\t// Handle single child\n\tif (isSlottable(children)) {\n\t\tconst childProps = children.props as Record<string, unknown>;\n\t\t// React 19: ref is now a regular prop, not element.ref\n\t\tconst childRef = childProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\treturn React.cloneElement(children, {\n\t\t\t...mergeProps(slotProps, childProps),\n\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t} as React.Attributes);\n\t}\n\n\t// Handle multiple children - wrap Slottable content\n\tif (React.Children.count(children) > 1) {\n\t\tconst childrenArray = React.Children.toArray(children);\n\t\tconst slottableChild = childrenArray.find(\n\t\t\t(child) => React.isValidElement(child) && child.type === Slottable,\n\t\t) as React.ReactElement<{ children: React.ReactNode }> | undefined;\n\n\t\tif (slottableChild) {\n\t\t\tconst newElement = slottableChild.props.children;\n\t\t\tif (isSlottable(newElement)) {\n\t\t\t\tconst newElementProps = newElement.props as Record<string, unknown> & { children?: React.ReactNode };\n\t\t\t\tconst newChildren = childrenArray.map((child) => {\n\t\t\t\t\tif (child === slottableChild) {\n\t\t\t\t\t\treturn React.Children.count(newElementProps.children) > 1\n\t\t\t\t\t\t\t? React.Children.only(null)\n\t\t\t\t\t\t\t: newElementProps.children;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t});\n\n\t\t\t\t// React 19: ref is now a regular prop\n\t\t\t\tconst childRef = newElementProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\t\t\treturn React.cloneElement(newElement, {\n\t\t\t\t\t...mergeProps(slotProps, newElementProps),\n\t\t\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t\t\t\tchildren: newChildren,\n\t\t\t\t} as React.Attributes);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fallback: render children as-is (shouldn't normally happen with proper usage)\n\treturn <>{children}</>;\n});\n\nSlot.displayName = 'Slot';\n\n/**\n * Slottable component - marks content that should receive slot props.\n * Used when Slot has multiple children and you want to specify which one receives props.\n */\nfunction Slottable({ children }: { children: React.ReactNode }) {\n\treturn <>{children}</>;\n}\n\nexport { Slot, Slottable, composeRefs, mergeProps, mergePropsWithRef };\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\ntype LabelProps = React.ComponentProps<'label'>;\n\n/**\n * Label component for form controls.\n * Uses a standard HTML label element for maximum compatibility.\n */\nfunction Label({ className, ...props }: LabelProps) {\n\treturn (\n\t\t<label\n\t\t\tdata-slot=\"label\"\n\t\t\tclassName={cn(\n\t\t\t\t`text-foreground text-sm leading-4 font-medium select-none group-data-[disabled=true]:pointer-events-none\n\t\t\t\tgroup-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-50`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Label };\nexport type { LabelProps };\n","'use client';\n\nimport * as React from 'react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\ntype FormControlLayout = 'stacked' | 'floating';\n\ninterface FormControlProps {\n children: React.ReactElement;\n label: string;\n id?: string;\n layout?: FormControlLayout;\n error?: string;\n className?: string;\n}\n\nfunction FormControl({ children, label, id, layout = 'stacked', error, className }: FormControlProps) {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const errorId = error ? `${inputId}-error` : undefined;\n\n const childProps: Record<string, unknown> = {\n id: inputId,\n 'aria-invalid': error ? true : undefined,\n 'aria-describedby': errorId,\n };\n\n if (layout === 'floating') {\n childProps.placeholder = ' ';\n }\n\n const childWithProps = React.cloneElement(children, childProps);\n\n if (layout === 'floating') {\n return (\n <div className={cn('space-y-1', className)}>\n <div\n className={cn(\n 'relative',\n // Float label when focused\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80',\n // Float label when there's a value\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n // Error\n error && 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive',\n )}\n >\n <Slot\n className={cn(\n error && 'border-destructive focus-visible:ring-destructive/20',\n )}\n >\n {childWithProps}\n </Slot>\n <Label\n htmlFor={inputId}\n data-slot=\"form-control-label\"\n className={cn(\n // Base: centered when empty\n 'pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]',\n // Small, subtle typography\n 'origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none',\n // Snappy transition\n 'transition-[transform,color] duration-200 ease-out motion-reduce:transition-none',\n // Error state\n error && 'text-destructive',\n )}\n >\n {label}\n </Label>\n </div>\n {error && (\n <p id={errorId} className='text-destructive text-xs' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n }\n\n return (\n <div className={cn('grid gap-2', className)}>\n <Label htmlFor={inputId} className={cn(error && 'text-destructive')}>\n {label}\n </Label>\n {childWithProps}\n {error && (\n <p id={errorId} className='text-destructive text-sm' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n}\n\nexport { FormControl, type FormControlLayout };\n"]}
1
+ {"version":3,"file":"form-control.cjs","names":["React","cn","Slot","Label"],"sources":["../../src/components/form-control.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\ntype FormControlLayout = 'stacked' | 'floating';\n\ninterface FormControlProps {\n children: React.ReactElement;\n label: string;\n id?: string;\n layout?: FormControlLayout;\n error?: string;\n className?: string;\n}\n\nfunction FormControl({ children, label, id, layout = 'stacked', error, className }: FormControlProps) {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const errorId = error ? `${inputId}-error` : undefined;\n\n const childProps: Record<string, unknown> = {\n id: inputId,\n 'aria-invalid': error ? true : undefined,\n 'aria-describedby': errorId,\n };\n\n if (layout === 'floating') {\n childProps.placeholder = ' ';\n }\n\n const childWithProps = React.cloneElement(children, childProps);\n\n if (layout === 'floating') {\n return (\n <div className={cn('space-y-1', className)}>\n <div\n className={cn(\n 'relative',\n // Float label when focused\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80',\n // Float label when there's a value\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n // Error\n error && 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive',\n )}\n >\n <Slot\n className={cn(\n error && 'border-destructive focus-visible:ring-destructive/20',\n )}\n >\n {childWithProps}\n </Slot>\n <Label\n htmlFor={inputId}\n data-slot=\"form-control-label\"\n className={cn(\n // Base: centered when empty\n 'pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]',\n // Small, subtle typography\n 'origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none',\n // Snappy transition\n 'transition-[transform,color] duration-200 ease-out motion-reduce:transition-none',\n // Error state\n error && 'text-destructive',\n )}\n >\n {label}\n </Label>\n </div>\n {error && (\n <p id={errorId} className='text-destructive text-xs' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n }\n\n return (\n <div className={cn('grid gap-2', className)}>\n <Label htmlFor={inputId} className={cn(error && 'text-destructive')}>\n {label}\n </Label>\n {childWithProps}\n {error && (\n <p id={errorId} className='text-destructive text-sm' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n}\n\nexport { FormControl, type FormControlLayout };\n"],"mappings":";;;;;;;;;;;;AAmBA,SAAS,YAAY,EAAE,UAAU,OAAO,IAAI,SAAS,WAAW,OAAO,aAA+B;CACpG,MAAM,cAAcA,MAAM,MAAM;CAChC,MAAM,UAAU,MAAM;CACtB,MAAM,UAAU,QAAQ,GAAG,QAAQ,UAAU;CAE7C,MAAM,aAAsC;EAC1C,IAAI;EACJ,gBAAgB,QAAQ,OAAO;EAC/B,oBAAoB;CACtB;CAEA,IAAI,WAAW,YACb,WAAW,cAAc;CAG3B,MAAM,iBAAiBA,MAAM,aAAa,UAAU,UAAU;CAE9D,IAAI,WAAW,YACb,OACE,4CAAC,OAAD;EAAK,WAAWC,iBAAG,aAAa,SAAS;YAAzC,CACE,4CAAC,OAAD;GACE,WAAWA,iBACT,YAEA,8EACA,4EACA,gFAEA,wFACA,sFAEA,SAAS,+EACX;aAZF,CAcE,2CAACC,mBAAD;IACE,WAAWD,iBACT,SAAS,sDACX;cAEC;GACG,IACN,2CAACE,gCAAD;IACE,SAAS;IACT,aAAU;IACV,WAAWF,iBAET,oEAEA,yFAEA,oFAEA,SAAS,kBACX;cAEC;GACI,EACJ;MACJ,SACC,2CAAC,KAAD;GAAG,IAAI;GAAS,WAAU;GAA2B,MAAK;aACvD;EACA,EAEF;;CAIT,OACE,4CAAC,OAAD;EAAK,WAAWA,iBAAG,cAAc,SAAS;YAA1C;GACE,2CAACE,gCAAD;IAAO,SAAS;IAAS,WAAWF,iBAAG,SAAS,kBAAkB;cAC/D;GACI;GACN;GACA,SACC,2CAAC,KAAD;IAAG,IAAI;IAAS,WAAU;IAA2B,MAAK;cACvD;GACA;EAEF;;AAET"}
@@ -1,14 +1,15 @@
1
- import * as React from 'react';
2
-
1
+ import * as React$1 from "react";
2
+ //#region src/components/form-control.d.ts
3
3
  type FormControlLayout = 'stacked' | 'floating';
4
4
  interface FormControlProps {
5
- children: React.ReactElement;
6
- label: string;
7
- id?: string;
8
- layout?: FormControlLayout;
9
- error?: string;
10
- className?: string;
5
+ children: React$1.ReactElement;
6
+ label: string;
7
+ id?: string;
8
+ layout?: FormControlLayout;
9
+ error?: string;
10
+ className?: string;
11
11
  }
12
- declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): React.JSX.Element;
13
-
12
+ declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): React$1.JSX.Element;
13
+ //#endregion
14
14
  export { FormControl, type FormControlLayout };
15
+ //# sourceMappingURL=form-control.d.cts.map
@@ -1,14 +1,15 @@
1
- import * as React from 'react';
2
-
1
+ import * as React$1 from "react";
2
+ //#region src/components/form-control.d.ts
3
3
  type FormControlLayout = 'stacked' | 'floating';
4
4
  interface FormControlProps {
5
- children: React.ReactElement;
6
- label: string;
7
- id?: string;
8
- layout?: FormControlLayout;
9
- error?: string;
10
- className?: string;
5
+ children: React$1.ReactElement;
6
+ label: string;
7
+ id?: string;
8
+ layout?: FormControlLayout;
9
+ error?: string;
10
+ className?: string;
11
11
  }
12
- declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): React.JSX.Element;
13
-
12
+ declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): React$1.JSX.Element;
13
+ //#endregion
14
14
  export { FormControl, type FormControlLayout };
15
+ //# sourceMappingURL=form-control.d.ts.map
@@ -1,171 +1,62 @@
1
- "use client";
2
- import * as React from 'react';
3
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
- import { clsx } from 'clsx';
5
- import { twMerge } from 'tailwind-merge';
1
+ 'use client';
6
2
 
7
- function composeRefs(...refs) {
8
- return (node) => {
9
- refs.forEach((ref) => {
10
- if (typeof ref === "function") {
11
- ref(node);
12
- } else if (ref != null) {
13
- ref.current = node;
14
- }
15
- });
16
- };
17
- }
18
- function mergeProps(slotProps, childProps) {
19
- const overrideProps = { ...childProps };
20
- for (const propName in childProps) {
21
- if (propName === "ref") continue;
22
- const slotPropValue = slotProps[propName];
23
- const childPropValue = childProps[propName];
24
- if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
25
- overrideProps[propName] = (...args) => {
26
- childPropValue(...args);
27
- slotPropValue(...args);
28
- };
29
- } else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
30
- overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
31
- } else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
32
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
33
- }
34
- }
35
- return { ...slotProps, ...overrideProps };
36
- }
37
- function isSlottable(child) {
38
- return React.isValidElement(child);
39
- }
40
- var Slot = React.forwardRef((props, forwardedRef) => {
41
- const { children, ...slotProps } = props;
42
- if (isSlottable(children)) {
43
- const childProps = children.props;
44
- const childRef = childProps.ref;
45
- return React.cloneElement(children, {
46
- ...mergeProps(slotProps, childProps),
47
- ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
48
- });
49
- }
50
- if (React.Children.count(children) > 1) {
51
- const childrenArray = React.Children.toArray(children);
52
- const slottableChild = childrenArray.find(
53
- (child) => React.isValidElement(child) && child.type === Slottable
54
- );
55
- if (slottableChild) {
56
- const newElement = slottableChild.props.children;
57
- if (isSlottable(newElement)) {
58
- const newElementProps = newElement.props;
59
- const newChildren = childrenArray.map((child) => {
60
- if (child === slottableChild) {
61
- return React.Children.count(newElementProps.children) > 1 ? React.Children.only(null) : newElementProps.children;
62
- }
63
- return child;
64
- });
65
- const childRef = newElementProps.ref;
66
- return React.cloneElement(newElement, {
67
- ...mergeProps(slotProps, newElementProps),
68
- ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
69
- children: newChildren
70
- });
71
- }
72
- }
73
- }
74
- return /* @__PURE__ */ jsx(Fragment, { children });
75
- });
76
- Slot.displayName = "Slot";
77
- function Slottable({ children }) {
78
- return /* @__PURE__ */ jsx(Fragment, { children });
79
- }
80
- function cn(...inputs) {
81
- return twMerge(clsx(inputs));
82
- }
83
- function Label({ className, ...props }) {
84
- return /* @__PURE__ */ jsx(
85
- "label",
86
- {
87
- "data-slot": "label",
88
- className: cn(
89
- `text-foreground text-sm leading-4 font-medium select-none group-data-[disabled=true]:pointer-events-none
90
- group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50
91
- data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,
92
- className
93
- ),
94
- ...props
95
- }
96
- );
97
- }
3
+ import { t as cn } from "../utils-BkMLyah9.js";
4
+ import { t as Slot } from "../slot-EL8zfLG0.js";
5
+ import { Label } from "./label.js";
6
+ import * as React$1 from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+
9
+ //#region src/components/form-control.tsx
98
10
  function FormControl({ children, label, id, layout = "stacked", error, className }) {
99
- const generatedId = React.useId();
100
- const inputId = id || generatedId;
101
- const errorId = error ? `${inputId}-error` : void 0;
102
- const childProps = {
103
- id: inputId,
104
- "aria-invalid": error ? true : void 0,
105
- "aria-describedby": errorId
106
- };
107
- if (layout === "floating") {
108
- childProps.placeholder = " ";
109
- }
110
- const childWithProps = React.cloneElement(children, childProps);
111
- if (layout === "floating") {
112
- return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1", className), children: [
113
- /* @__PURE__ */ jsxs(
114
- "div",
115
- {
116
- className: cn(
117
- "relative",
118
- // Float label when focused
119
- "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0",
120
- "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]",
121
- "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80",
122
- // Float label when there's a value
123
- "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0",
124
- "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]",
125
- // Error
126
- error && "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive"
127
- ),
128
- children: [
129
- /* @__PURE__ */ jsx(
130
- Slot,
131
- {
132
- className: cn(
133
- error && "border-destructive focus-visible:ring-destructive/20"
134
- ),
135
- children: childWithProps
136
- }
137
- ),
138
- /* @__PURE__ */ jsx(
139
- Label,
140
- {
141
- htmlFor: inputId,
142
- "data-slot": "form-control-label",
143
- className: cn(
144
- // Base: centered when empty
145
- "pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]",
146
- // Small, subtle typography
147
- "origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none",
148
- // Snappy transition
149
- "transition-[transform,color] duration-200 ease-out motion-reduce:transition-none",
150
- // Error state
151
- error && "text-destructive"
152
- ),
153
- children: label
154
- }
155
- )
156
- ]
157
- }
158
- ),
159
- error && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-destructive text-xs", role: "alert", children: error })
160
- ] });
161
- }
162
- return /* @__PURE__ */ jsxs("div", { className: cn("grid gap-2", className), children: [
163
- /* @__PURE__ */ jsx(Label, { htmlFor: inputId, className: cn(error && "text-destructive"), children: label }),
164
- childWithProps,
165
- error && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-destructive text-sm", role: "alert", children: error })
166
- ] });
11
+ const generatedId = React$1.useId();
12
+ const inputId = id || generatedId;
13
+ const errorId = error ? `${inputId}-error` : void 0;
14
+ const childProps = {
15
+ id: inputId,
16
+ "aria-invalid": error ? true : void 0,
17
+ "aria-describedby": errorId
18
+ };
19
+ if (layout === "floating") childProps.placeholder = " ";
20
+ const childWithProps = React$1.cloneElement(children, childProps);
21
+ if (layout === "floating") return /* @__PURE__ */ jsxs("div", {
22
+ className: cn("space-y-1", className),
23
+ children: [/* @__PURE__ */ jsxs("div", {
24
+ className: cn("relative", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]", "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80", "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0", "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]", error && "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive"),
25
+ children: [/* @__PURE__ */ jsx(Slot, {
26
+ className: cn(error && "border-destructive focus-visible:ring-destructive/20"),
27
+ children: childWithProps
28
+ }), /* @__PURE__ */ jsx(Label, {
29
+ htmlFor: inputId,
30
+ "data-slot": "form-control-label",
31
+ className: cn("pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]", "origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none", "transition-[transform,color] duration-200 ease-out motion-reduce:transition-none", error && "text-destructive"),
32
+ children: label
33
+ })]
34
+ }), error && /* @__PURE__ */ jsx("p", {
35
+ id: errorId,
36
+ className: "text-destructive text-xs",
37
+ role: "alert",
38
+ children: error
39
+ })]
40
+ });
41
+ return /* @__PURE__ */ jsxs("div", {
42
+ className: cn("grid gap-2", className),
43
+ children: [
44
+ /* @__PURE__ */ jsx(Label, {
45
+ htmlFor: inputId,
46
+ className: cn(error && "text-destructive"),
47
+ children: label
48
+ }),
49
+ childWithProps,
50
+ error && /* @__PURE__ */ jsx("p", {
51
+ id: errorId,
52
+ className: "text-destructive text-sm",
53
+ role: "alert",
54
+ children: error
55
+ })
56
+ ]
57
+ });
167
58
  }
168
59
 
60
+ //#endregion
169
61
  export { FormControl };
170
- //# sourceMappingURL=form-control.js.map
171
62
  //# sourceMappingURL=form-control.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/slot.tsx","../../src/lib/utils.ts","../../src/components/label.tsx","../../src/components/form-control.tsx"],"names":["jsx","React2"],"mappings":";;;;;AAQA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA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A,kBAEA,kFAAA;AAAA;AAAA,kBAEA,KAAA,IAAS;AAAA,iBACX;AAAA,gBAEC,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAAA,OACF;AAAA,MACC,KAAA,oBACCA,GAAAA,CAAC,GAAA,EAAA,EAAE,EAAA,EAAI,SAAS,SAAA,EAAU,0BAAA,EAA2B,IAAA,EAAK,OAAA,EACvD,QAAA,EAAA,KAAA,EACH;AAAA,KAAA,EAEJ,CAAA;AAAA,EAEJ;AAEA,EAAA,4BACG,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,YAAA,EAAc,SAAS,CAAA,EACxC,QAAA,EAAA;AAAA,oBAAAA,GAAAA,CAAC,SAAM,OAAA,EAAS,OAAA,EAAS,WAAW,EAAA,CAAG,KAAA,IAAS,kBAAkB,CAAA,EAC/D,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,IACC,cAAA;AAAA,IACA,KAAA,oBACCA,GAAAA,CAAC,GAAA,EAAA,EAAE,EAAA,EAAI,SAAS,SAAA,EAAU,0BAAA,EAA2B,IAAA,EAAK,OAAA,EACvD,QAAA,EAAA,KAAA,EACH;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"form-control.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\n\n/**\n * Merges refs into a single callback ref.\n * React 19 compatible - handles refs as regular props.\n */\nfunction composeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n\treturn (node) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(node);\n\t\t\t} else if (ref != null) {\n\t\t\t\t(ref as React.MutableRefObject<T | null>).current = node;\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Merges props, handling special cases for className, style, and event handlers.\n * Excludes 'ref' from merging as it's handled separately.\n */\nfunction mergeProps(\n\tslotProps: Record<string, unknown>,\n\tchildProps: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst overrideProps: Record<string, unknown> = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\t// Skip ref - handled separately for composition\n\t\tif (propName === 'ref') continue;\n\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\t// Compose event handlers\n\t\tif (/^on[A-Z]/.test(propName) && typeof slotPropValue === 'function' && typeof childPropValue === 'function') {\n\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\tchildPropValue(...args);\n\t\t\t\tslotPropValue(...args);\n\t\t\t};\n\t\t}\n\t\t// Merge className\n\t\telse if (propName === 'className' && typeof slotPropValue === 'string' && typeof childPropValue === 'string') {\n\t\t\toverrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();\n\t\t}\n\t\t// Merge style\n\t\telse if (propName === 'style' && typeof slotPropValue === 'object' && typeof childPropValue === 'object') {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\n/**\n * Merges props from a parent component with a child element's props,\n * including proper ref composition. Use this in render prop patterns\n * where the parent needs to merge its props with the child's.\n *\n * @param parentProps - Props from the parent component (e.g., triggerProps from Base UI)\n * @param childElement - The child React element whose props will be merged\n * @returns Merged props object ready to pass to React.cloneElement\n */\nfunction mergePropsWithRef<T = HTMLElement>(\n\tparentProps: Record<string, unknown>,\n\tchildElement: React.ReactElement,\n): Record<string, unknown> {\n\tconst childProps = childElement.props as Record<string, unknown>;\n\tconst parentRef = parentProps.ref as React.Ref<T> | undefined;\n\tconst childRef = childProps.ref as React.Ref<T> | undefined;\n\n\tconst mergedProps = mergeProps(parentProps, childProps);\n\n\t// Compose refs if either exists\n\tif (parentRef || childRef) {\n\t\tmergedProps.ref = composeRefs(parentRef, childRef);\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Check if a value is a valid slottable child (single React element).\n */\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n\treturn React.isValidElement(child);\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Slot component - renders its child element with merged props.\n * Used for the `asChild` pattern where parent props are passed to child.\n * React 19 compatible - accesses ref from props instead of element.ref.\n */\nconst Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\t// Handle single child\n\tif (isSlottable(children)) {\n\t\tconst childProps = children.props as Record<string, unknown>;\n\t\t// React 19: ref is now a regular prop, not element.ref\n\t\tconst childRef = childProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\treturn React.cloneElement(children, {\n\t\t\t...mergeProps(slotProps, childProps),\n\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t} as React.Attributes);\n\t}\n\n\t// Handle multiple children - wrap Slottable content\n\tif (React.Children.count(children) > 1) {\n\t\tconst childrenArray = React.Children.toArray(children);\n\t\tconst slottableChild = childrenArray.find(\n\t\t\t(child) => React.isValidElement(child) && child.type === Slottable,\n\t\t) as React.ReactElement<{ children: React.ReactNode }> | undefined;\n\n\t\tif (slottableChild) {\n\t\t\tconst newElement = slottableChild.props.children;\n\t\t\tif (isSlottable(newElement)) {\n\t\t\t\tconst newElementProps = newElement.props as Record<string, unknown> & { children?: React.ReactNode };\n\t\t\t\tconst newChildren = childrenArray.map((child) => {\n\t\t\t\t\tif (child === slottableChild) {\n\t\t\t\t\t\treturn React.Children.count(newElementProps.children) > 1\n\t\t\t\t\t\t\t? React.Children.only(null)\n\t\t\t\t\t\t\t: newElementProps.children;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t});\n\n\t\t\t\t// React 19: ref is now a regular prop\n\t\t\t\tconst childRef = newElementProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\t\t\treturn React.cloneElement(newElement, {\n\t\t\t\t\t...mergeProps(slotProps, newElementProps),\n\t\t\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t\t\t\tchildren: newChildren,\n\t\t\t\t} as React.Attributes);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fallback: render children as-is (shouldn't normally happen with proper usage)\n\treturn <>{children}</>;\n});\n\nSlot.displayName = 'Slot';\n\n/**\n * Slottable component - marks content that should receive slot props.\n * Used when Slot has multiple children and you want to specify which one receives props.\n */\nfunction Slottable({ children }: { children: React.ReactNode }) {\n\treturn <>{children}</>;\n}\n\nexport { Slot, Slottable, composeRefs, mergeProps, mergePropsWithRef };\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\ntype LabelProps = React.ComponentProps<'label'>;\n\n/**\n * Label component for form controls.\n * Uses a standard HTML label element for maximum compatibility.\n */\nfunction Label({ className, ...props }: LabelProps) {\n\treturn (\n\t\t<label\n\t\t\tdata-slot=\"label\"\n\t\t\tclassName={cn(\n\t\t\t\t`text-foreground text-sm leading-4 font-medium select-none group-data-[disabled=true]:pointer-events-none\n\t\t\t\tgroup-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-50`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Label };\nexport type { LabelProps };\n","'use client';\n\nimport * as React from 'react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\ntype FormControlLayout = 'stacked' | 'floating';\n\ninterface FormControlProps {\n children: React.ReactElement;\n label: string;\n id?: string;\n layout?: FormControlLayout;\n error?: string;\n className?: string;\n}\n\nfunction FormControl({ children, label, id, layout = 'stacked', error, className }: FormControlProps) {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const errorId = error ? `${inputId}-error` : undefined;\n\n const childProps: Record<string, unknown> = {\n id: inputId,\n 'aria-invalid': error ? true : undefined,\n 'aria-describedby': errorId,\n };\n\n if (layout === 'floating') {\n childProps.placeholder = ' ';\n }\n\n const childWithProps = React.cloneElement(children, childProps);\n\n if (layout === 'floating') {\n return (\n <div className={cn('space-y-1', className)}>\n <div\n className={cn(\n 'relative',\n // Float label when focused\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80',\n // Float label when there's a value\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n // Error\n error && 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive',\n )}\n >\n <Slot\n className={cn(\n error && 'border-destructive focus-visible:ring-destructive/20',\n )}\n >\n {childWithProps}\n </Slot>\n <Label\n htmlFor={inputId}\n data-slot=\"form-control-label\"\n className={cn(\n // Base: centered when empty\n 'pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]',\n // Small, subtle typography\n 'origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none',\n // Snappy transition\n 'transition-[transform,color] duration-200 ease-out motion-reduce:transition-none',\n // Error state\n error && 'text-destructive',\n )}\n >\n {label}\n </Label>\n </div>\n {error && (\n <p id={errorId} className='text-destructive text-xs' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n }\n\n return (\n <div className={cn('grid gap-2', className)}>\n <Label htmlFor={inputId} className={cn(error && 'text-destructive')}>\n {label}\n </Label>\n {childWithProps}\n {error && (\n <p id={errorId} className='text-destructive text-sm' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n}\n\nexport { FormControl, type FormControlLayout };\n"]}
1
+ {"version":3,"file":"form-control.js","names":["React"],"sources":["../../src/components/form-control.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\ntype FormControlLayout = 'stacked' | 'floating';\n\ninterface FormControlProps {\n children: React.ReactElement;\n label: string;\n id?: string;\n layout?: FormControlLayout;\n error?: string;\n className?: string;\n}\n\nfunction FormControl({ children, label, id, layout = 'stacked', error, className }: FormControlProps) {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const errorId = error ? `${inputId}-error` : undefined;\n\n const childProps: Record<string, unknown> = {\n id: inputId,\n 'aria-invalid': error ? true : undefined,\n 'aria-describedby': errorId,\n };\n\n if (layout === 'floating') {\n childProps.placeholder = ' ';\n }\n\n const childWithProps = React.cloneElement(children, childProps);\n\n if (layout === 'floating') {\n return (\n <div className={cn('space-y-1', className)}>\n <div\n className={cn(\n 'relative',\n // Float label when focused\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80',\n // Float label when there's a value\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0',\n 'has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]',\n // Error\n error && 'has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-destructive',\n )}\n >\n <Slot\n className={cn(\n error && 'border-destructive focus-visible:ring-destructive/20',\n )}\n >\n {childWithProps}\n </Slot>\n <Label\n htmlFor={inputId}\n data-slot=\"form-control-label\"\n className={cn(\n // Base: centered when empty\n 'pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]',\n // Small, subtle typography\n 'origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none',\n // Snappy transition\n 'transition-[transform,color] duration-200 ease-out motion-reduce:transition-none',\n // Error state\n error && 'text-destructive',\n )}\n >\n {label}\n </Label>\n </div>\n {error && (\n <p id={errorId} className='text-destructive text-xs' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n }\n\n return (\n <div className={cn('grid gap-2', className)}>\n <Label htmlFor={inputId} className={cn(error && 'text-destructive')}>\n {label}\n </Label>\n {childWithProps}\n {error && (\n <p id={errorId} className='text-destructive text-sm' role='alert'>\n {error}\n </p>\n )}\n </div>\n );\n}\n\nexport { FormControl, type FormControlLayout };\n"],"mappings":";;;;;;;;;AAmBA,SAAS,YAAY,EAAE,UAAU,OAAO,IAAI,SAAS,WAAW,OAAO,aAA+B;CACpG,MAAM,cAAcA,QAAM,MAAM;CAChC,MAAM,UAAU,MAAM;CACtB,MAAM,UAAU,QAAQ,GAAG,QAAQ,UAAU;CAE7C,MAAM,aAAsC;EAC1C,IAAI;EACJ,gBAAgB,QAAQ,OAAO;EAC/B,oBAAoB;CACtB;CAEA,IAAI,WAAW,YACb,WAAW,cAAc;CAG3B,MAAM,iBAAiBA,QAAM,aAAa,UAAU,UAAU;CAE9D,IAAI,WAAW,YACb,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,aAAa,SAAS;YAAzC,CACE,qBAAC,OAAD;GACE,WAAW,GACT,YAEA,8EACA,4EACA,gFAEA,wFACA,sFAEA,SAAS,+EACX;aAZF,CAcE,oBAAC,MAAD;IACE,WAAW,GACT,SAAS,sDACX;cAEC;GACG,IACN,oBAAC,OAAD;IACE,SAAS;IACT,aAAU;IACV,WAAW,GAET,oEAEA,yFAEA,oFAEA,SAAS,kBACX;cAEC;GACI,EACJ;MACJ,SACC,oBAAC,KAAD;GAAG,IAAI;GAAS,WAAU;GAA2B,MAAK;aACvD;EACA,EAEF;;CAIT,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,cAAc,SAAS;YAA1C;GACE,oBAAC,OAAD;IAAO,SAAS;IAAS,WAAW,GAAG,SAAS,kBAAkB;cAC/D;GACI;GACN;GACA,SACC,oBAAC,KAAD;IAAG,IAAI;IAAS,WAAU;IAA2B,MAAK;cACvD;GACA;EAEF;;AAET"}