@constructive-io/ui 0.3.1 → 0.6.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 (343) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -22
  3. package/dist/components/alert-dialog.cjs +333 -0
  4. package/dist/components/alert-dialog.cjs.map +1 -0
  5. package/dist/components/alert-dialog.d.cts +32 -0
  6. package/dist/components/alert-dialog.d.ts +16 -15
  7. package/dist/components/alert-dialog.js +89 -102
  8. package/dist/components/alert-dialog.js.map +1 -1
  9. package/dist/components/alert.cjs +119 -0
  10. package/dist/components/alert.cjs.map +1 -0
  11. package/dist/components/alert.d.cts +19 -0
  12. package/dist/components/alert.d.ts +10 -5
  13. package/dist/components/alert.js +62 -6
  14. package/dist/components/alert.js.map +1 -1
  15. package/dist/components/app-bar.cjs +367 -0
  16. package/dist/components/app-bar.cjs.map +1 -0
  17. package/dist/components/app-bar.d.cts +26 -0
  18. package/dist/components/app-bar.d.ts +26 -0
  19. package/dist/components/app-bar.js +344 -0
  20. package/dist/components/app-bar.js.map +1 -0
  21. package/dist/components/app-shell.cjs +1792 -0
  22. package/dist/components/app-shell.cjs.map +1 -0
  23. package/dist/components/app-shell.d.cts +106 -0
  24. package/dist/components/app-shell.d.ts +106 -0
  25. package/dist/components/app-shell.js +1771 -0
  26. package/dist/components/app-shell.js.map +1 -0
  27. package/dist/components/autocomplete.cjs +418 -0
  28. package/dist/components/autocomplete.cjs.map +1 -0
  29. package/dist/components/autocomplete.d.cts +28 -0
  30. package/dist/components/autocomplete.d.ts +15 -15
  31. package/dist/components/autocomplete.js +9 -30
  32. package/dist/components/autocomplete.js.map +1 -1
  33. package/dist/components/avatar.cjs +51 -0
  34. package/dist/components/avatar.cjs.map +1 -0
  35. package/dist/components/avatar.d.cts +12 -0
  36. package/dist/components/avatar.d.ts +3 -4
  37. package/dist/components/avatar.js +11 -1
  38. package/dist/components/avatar.js.map +1 -1
  39. package/dist/components/badge.cjs +66 -0
  40. package/dist/components/badge.cjs.map +1 -0
  41. package/dist/components/badge.d.cts +15 -0
  42. package/dist/components/badge.js +1 -1
  43. package/dist/components/badge.js.map +1 -1
  44. package/dist/components/breadcrumb.cjs +118 -0
  45. package/dist/components/breadcrumb.cjs.map +1 -0
  46. package/dist/components/breadcrumb.d.cts +14 -0
  47. package/dist/components/breadcrumb.d.ts +9 -9
  48. package/dist/components/breadcrumb.js +19 -83
  49. package/dist/components/breadcrumb.js.map +1 -1
  50. package/dist/components/button.cjs +169 -0
  51. package/dist/components/button.cjs.map +1 -0
  52. package/dist/components/button.d.cts +20 -0
  53. package/dist/components/button.d.ts +3 -0
  54. package/dist/components/button.js +105 -21
  55. package/dist/components/button.js.map +1 -1
  56. package/dist/components/calendar-rac.cjs +85 -0
  57. package/dist/components/calendar-rac.cjs.map +1 -0
  58. package/dist/components/calendar-rac.d.cts +13 -0
  59. package/dist/components/calendar-rac.d.ts +3 -3
  60. package/dist/components/card.cjs +99 -0
  61. package/dist/components/card.cjs.map +1 -0
  62. package/dist/components/card.d.cts +18 -0
  63. package/dist/components/card.d.ts +7 -8
  64. package/dist/components/card.js +23 -8
  65. package/dist/components/card.js.map +1 -1
  66. package/dist/components/checkbox-group.cjs +18 -0
  67. package/dist/components/checkbox-group.cjs.map +1 -0
  68. package/dist/components/checkbox-group.d.cts +7 -0
  69. package/dist/components/checkbox-group.d.ts +2 -2
  70. package/dist/components/checkbox.cjs +121 -0
  71. package/dist/components/checkbox.cjs.map +1 -0
  72. package/dist/components/checkbox.d.cts +8 -0
  73. package/dist/components/checkbox.d.ts +3 -3
  74. package/dist/components/checkbox.js +73 -41
  75. package/dist/components/checkbox.js.map +1 -1
  76. package/dist/components/collapsible.cjs +127 -0
  77. package/dist/components/collapsible.cjs.map +1 -0
  78. package/dist/components/collapsible.d.cts +44 -0
  79. package/dist/components/collapsible.d.ts +8 -18
  80. package/dist/components/collapsible.js +7 -27
  81. package/dist/components/collapsible.js.map +1 -1
  82. package/dist/components/combobox.cjs +551 -0
  83. package/dist/components/combobox.cjs.map +1 -0
  84. package/dist/components/combobox.d.cts +43 -0
  85. package/dist/components/combobox.d.ts +17 -18
  86. package/dist/components/combobox.js +37 -48
  87. package/dist/components/combobox.js.map +1 -1
  88. package/dist/components/command.cjs +236 -0
  89. package/dist/components/command.cjs.map +1 -0
  90. package/dist/components/command.d.cts +23 -0
  91. package/dist/components/command.d.ts +14 -15
  92. package/dist/components/command.js +5 -38
  93. package/dist/components/command.js.map +1 -1
  94. package/dist/components/dialog.cjs +431 -0
  95. package/dist/components/dialog.cjs.map +1 -0
  96. package/dist/components/dialog.d.cts +30 -0
  97. package/dist/components/dialog.d.ts +13 -18
  98. package/dist/components/dialog.js +75 -119
  99. package/dist/components/dialog.js.map +1 -1
  100. package/dist/components/dock.cjs +121 -0
  101. package/dist/components/dock.cjs.map +1 -0
  102. package/dist/components/dock.d.cts +30 -0
  103. package/dist/components/dock.d.ts +1 -2
  104. package/dist/components/dock.js +7 -5
  105. package/dist/components/dock.js.map +1 -1
  106. package/dist/components/drawer.cjs +149 -0
  107. package/dist/components/drawer.cjs.map +1 -0
  108. package/dist/components/drawer.d.cts +15 -0
  109. package/dist/components/drawer.d.ts +10 -11
  110. package/dist/components/drawer.js +11 -40
  111. package/dist/components/drawer.js.map +1 -1
  112. package/dist/components/dropdown-menu.cjs +292 -0
  113. package/dist/components/dropdown-menu.cjs.map +1 -0
  114. package/dist/components/dropdown-menu.d.cts +52 -0
  115. package/dist/components/dropdown-menu.d.ts +23 -21
  116. package/dist/components/dropdown-menu.js +67 -191
  117. package/dist/components/dropdown-menu.js.map +1 -1
  118. package/dist/components/empty.cjs +106 -0
  119. package/dist/components/empty.cjs.map +1 -0
  120. package/dist/components/empty.d.cts +15 -0
  121. package/dist/components/empty.d.ts +15 -0
  122. package/dist/components/empty.js +99 -0
  123. package/dist/components/empty.js.map +1 -0
  124. package/dist/components/field.cjs +295 -0
  125. package/dist/components/field.cjs.map +1 -0
  126. package/dist/components/field.d.cts +46 -0
  127. package/dist/components/field.d.ts +34 -39
  128. package/dist/components/field.js +220 -72
  129. package/dist/components/field.js.map +1 -1
  130. package/dist/components/flickering-grid.cjs +176 -0
  131. package/dist/components/flickering-grid.cjs.map +1 -0
  132. package/dist/components/flickering-grid.d.cts +15 -0
  133. package/dist/components/flickering-grid.js +25 -2
  134. package/dist/components/flickering-grid.js.map +1 -1
  135. package/dist/components/flow-zoom-panel.cjs +194 -0
  136. package/dist/components/flow-zoom-panel.cjs.map +1 -0
  137. package/dist/components/flow-zoom-panel.d.cts +12 -0
  138. package/dist/components/flow-zoom-panel.d.ts +12 -0
  139. package/dist/components/flow-zoom-panel.js +173 -0
  140. package/dist/components/flow-zoom-panel.js.map +1 -0
  141. package/dist/components/form-control.cjs +193 -0
  142. package/dist/components/form-control.cjs.map +1 -0
  143. package/dist/components/form-control.d.cts +14 -0
  144. package/dist/components/form-control.d.ts +1 -2
  145. package/dist/components/form-control.js +2 -4
  146. package/dist/components/form-control.js.map +1 -1
  147. package/dist/components/form.cjs +208 -0
  148. package/dist/components/form.cjs.map +1 -0
  149. package/dist/components/form.d.cts +36 -0
  150. package/dist/components/form.d.ts +7 -8
  151. package/dist/components/input-group.cjs +184 -0
  152. package/dist/components/input-group.cjs.map +1 -0
  153. package/dist/components/input-group.d.cts +17 -0
  154. package/dist/components/input-group.d.ts +6 -7
  155. package/dist/components/input-group.js +3 -2
  156. package/dist/components/input-group.js.map +1 -1
  157. package/dist/components/input.cjs +62 -0
  158. package/dist/components/input.cjs.map +1 -0
  159. package/dist/components/input.d.cts +10 -0
  160. package/dist/components/input.d.ts +1 -2
  161. package/dist/components/input.js +1 -1
  162. package/dist/components/input.js.map +1 -1
  163. package/dist/components/json-input.cjs +351 -0
  164. package/dist/components/json-input.cjs.map +1 -0
  165. package/dist/components/json-input.d.cts +25 -0
  166. package/dist/components/json-input.d.ts +3 -3
  167. package/dist/components/json-input.js +89 -112
  168. package/dist/components/json-input.js.map +1 -1
  169. package/dist/components/label.cjs +29 -0
  170. package/dist/components/label.cjs.map +1 -0
  171. package/dist/components/label.d.cts +10 -0
  172. package/dist/components/label.d.ts +1 -2
  173. package/dist/components/motion-grid.cjs +108 -0
  174. package/dist/components/motion-grid.cjs.map +1 -0
  175. package/dist/components/motion-grid.d.cts +19 -0
  176. package/dist/components/motion-grid.d.ts +1 -2
  177. package/dist/components/motion-grid.js +9 -4
  178. package/dist/components/motion-grid.js.map +1 -1
  179. package/dist/components/multi-select.cjs +796 -0
  180. package/dist/components/multi-select.cjs.map +1 -0
  181. package/dist/components/multi-select.d.cts +198 -0
  182. package/dist/components/multi-select.js +54 -162
  183. package/dist/components/multi-select.js.map +1 -1
  184. package/dist/components/page-header.cjs +19 -0
  185. package/dist/components/page-header.cjs.map +1 -0
  186. package/dist/components/page-header.d.cts +17 -0
  187. package/dist/components/page-header.d.ts +2 -2
  188. package/dist/components/pagination.cjs +295 -0
  189. package/dist/components/pagination.cjs.map +1 -0
  190. package/dist/components/pagination.d.cts +18 -0
  191. package/dist/components/pagination.d.ts +7 -8
  192. package/dist/components/pagination.js +152 -29
  193. package/dist/components/pagination.js.map +1 -1
  194. package/dist/components/popover.cjs +140 -0
  195. package/dist/components/popover.cjs.map +1 -0
  196. package/dist/components/popover.d.cts +39 -0
  197. package/dist/components/popover.d.ts +13 -9
  198. package/dist/components/popover.js +56 -132
  199. package/dist/components/popover.js.map +1 -1
  200. package/dist/components/portal.cjs +109 -0
  201. package/dist/components/portal.cjs.map +1 -0
  202. package/dist/components/portal.d.cts +117 -0
  203. package/dist/components/portal.d.ts +16 -7
  204. package/dist/components/portal.js +13 -8
  205. package/dist/components/portal.js.map +1 -1
  206. package/dist/components/progress.cjs +31 -0
  207. package/dist/components/progress.cjs.map +1 -0
  208. package/dist/components/progress.d.cts +9 -0
  209. package/dist/components/progress.d.ts +1 -2
  210. package/dist/components/progress.js +1 -2
  211. package/dist/components/progress.js.map +1 -1
  212. package/dist/components/progressive-blur-scroll-container.cjs +144 -0
  213. package/dist/components/progressive-blur-scroll-container.cjs.map +1 -0
  214. package/dist/components/progressive-blur-scroll-container.d.cts +25 -0
  215. package/dist/components/progressive-blur-scroll-container.d.ts +2 -2
  216. package/dist/components/progressive-blur.cjs +70 -0
  217. package/dist/components/progressive-blur.cjs.map +1 -0
  218. package/dist/components/progressive-blur.d.cts +16 -0
  219. package/dist/components/progressive-blur.d.ts +2 -2
  220. package/dist/components/radio-group.cjs +52 -0
  221. package/dist/components/radio-group.cjs.map +1 -0
  222. package/dist/components/radio-group.d.cts +10 -0
  223. package/dist/components/radio-group.d.ts +3 -3
  224. package/dist/components/radio-group.js +21 -10
  225. package/dist/components/radio-group.js.map +1 -1
  226. package/dist/components/record-picker.cjs +420 -0
  227. package/dist/components/record-picker.cjs.map +1 -0
  228. package/dist/components/record-picker.d.cts +16 -0
  229. package/dist/components/record-picker.d.ts +2 -2
  230. package/dist/components/record-picker.js +76 -43
  231. package/dist/components/record-picker.js.map +1 -1
  232. package/dist/components/resizable.cjs +76 -0
  233. package/dist/components/resizable.cjs.map +1 -0
  234. package/dist/components/resizable.d.cts +10 -0
  235. package/dist/components/resizable.d.ts +3 -4
  236. package/dist/components/responsive-diagram.cjs +67 -0
  237. package/dist/components/responsive-diagram.cjs.map +1 -0
  238. package/dist/components/responsive-diagram.d.cts +10 -0
  239. package/dist/components/responsive-diagram.d.ts +2 -2
  240. package/dist/components/scroll-area.cjs +92 -0
  241. package/dist/components/scroll-area.cjs.map +1 -0
  242. package/dist/components/scroll-area.d.cts +11 -0
  243. package/dist/components/scroll-area.d.ts +5 -6
  244. package/dist/components/select.cjs +329 -0
  245. package/dist/components/select.cjs.map +1 -0
  246. package/dist/components/select.d.cts +46 -0
  247. package/dist/components/select.d.ts +13 -14
  248. package/dist/components/select.js +76 -67
  249. package/dist/components/select.js.map +1 -1
  250. package/dist/components/separator.cjs +26 -0
  251. package/dist/components/separator.cjs.map +1 -0
  252. package/dist/components/separator.d.cts +10 -0
  253. package/dist/components/separator.d.ts +1 -2
  254. package/dist/components/sheet.cjs +489 -0
  255. package/dist/components/sheet.cjs.map +1 -0
  256. package/dist/components/sheet.d.cts +107 -0
  257. package/dist/components/sheet.d.ts +14 -19
  258. package/dist/components/sheet.js +119 -264
  259. package/dist/components/sheet.js.map +1 -1
  260. package/dist/components/sidebar.cjs +1300 -0
  261. package/dist/components/sidebar.cjs.map +1 -0
  262. package/dist/components/sidebar.d.cts +70 -0
  263. package/dist/components/sidebar.d.ts +32 -39
  264. package/dist/components/sidebar.js +401 -362
  265. package/dist/components/sidebar.js.map +1 -1
  266. package/dist/components/skeleton.cjs +36 -0
  267. package/dist/components/skeleton.cjs.map +1 -0
  268. package/dist/components/skeleton.d.cts +10 -0
  269. package/dist/components/skeleton.d.ts +5 -2
  270. package/dist/components/skeleton.js +19 -1
  271. package/dist/components/skeleton.js.map +1 -1
  272. package/dist/components/sonner.cjs +25 -0
  273. package/dist/components/sonner.cjs.map +1 -0
  274. package/dist/components/sonner.d.cts +10 -0
  275. package/dist/components/sonner.d.ts +2 -2
  276. package/dist/components/stack/index.cjs +1516 -0
  277. package/dist/components/stack/index.cjs.map +1 -0
  278. package/dist/components/stack/index.d.cts +672 -0
  279. package/dist/components/stack/index.d.ts +36 -38
  280. package/dist/components/stack/index.js +42 -31
  281. package/dist/components/stack/index.js.map +1 -1
  282. package/dist/components/stepper.cjs +314 -0
  283. package/dist/components/stepper.cjs.map +1 -0
  284. package/dist/components/stepper.d.cts +31 -0
  285. package/dist/components/stepper.d.ts +9 -8
  286. package/dist/components/stepper.js +22 -15
  287. package/dist/components/stepper.js.map +1 -1
  288. package/dist/components/switch.cjs +46 -0
  289. package/dist/components/switch.cjs.map +1 -0
  290. package/dist/components/switch.d.cts +7 -0
  291. package/dist/components/switch.d.ts +1 -2
  292. package/dist/components/switch.js +9 -5
  293. package/dist/components/switch.js.map +1 -1
  294. package/dist/components/table.cjs +133 -0
  295. package/dist/components/table.cjs.map +1 -0
  296. package/dist/components/table.d.cts +22 -0
  297. package/dist/components/table.d.ts +19 -12
  298. package/dist/components/table.js +72 -13
  299. package/dist/components/table.js.map +1 -1
  300. package/dist/components/tabs.cjs +53 -0
  301. package/dist/components/tabs.cjs.map +1 -0
  302. package/dist/components/tabs.d.cts +9 -0
  303. package/dist/components/tabs.d.ts +4 -5
  304. package/dist/components/tabs.js +2 -2
  305. package/dist/components/tabs.js.map +1 -1
  306. package/dist/components/tags.cjs +451 -0
  307. package/dist/components/tags.cjs.map +1 -0
  308. package/dist/components/tags.d.cts +40 -0
  309. package/dist/components/tags.d.ts +10 -10
  310. package/dist/components/tags.js +129 -154
  311. package/dist/components/tags.js.map +1 -1
  312. package/dist/components/textarea.cjs +56 -0
  313. package/dist/components/textarea.cjs.map +1 -0
  314. package/dist/components/textarea.d.cts +9 -0
  315. package/dist/components/textarea.d.ts +1 -2
  316. package/dist/components/toast/index.cjs +612 -0
  317. package/dist/components/toast/index.cjs.map +1 -0
  318. package/dist/components/toast/index.d.cts +52 -0
  319. package/dist/components/toast/index.js +90 -127
  320. package/dist/components/toast/index.js.map +1 -1
  321. package/dist/components/tooltip.cjs +92 -0
  322. package/dist/components/tooltip.cjs.map +1 -0
  323. package/dist/components/tooltip.d.cts +28 -0
  324. package/dist/components/tooltip.d.ts +5 -6
  325. package/dist/components/tooltip.js +23 -130
  326. package/dist/components/tooltip.js.map +1 -1
  327. package/dist/components/unlink-button.cjs +197 -0
  328. package/dist/components/unlink-button.cjs.map +1 -0
  329. package/dist/components/unlink-button.d.cts +14 -0
  330. package/dist/components/unlink-button.d.ts +2 -2
  331. package/dist/components/unlink-button.js +105 -21
  332. package/dist/components/unlink-button.js.map +1 -1
  333. package/dist/index.cjs +2040 -1577
  334. package/dist/index.cjs.map +1 -1
  335. package/dist/index.d.cts +492 -509
  336. package/dist/index.d.ts +492 -509
  337. package/dist/index.js +1862 -1443
  338. package/dist/index.js.map +1 -1
  339. package/package.json +286 -45
  340. package/src/styles/globals.css +155 -203
  341. package/dist/components/org-chart/index.d.ts +0 -54
  342. package/dist/components/org-chart/index.js +0 -861
  343. package/dist/components/org-chart/index.js.map +0 -1
@@ -0,0 +1,193 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var clsx = require('clsx');
7
+ var tailwindMerge = require('tailwind-merge');
8
+
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
+ }
120
+ 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
+ ] });
189
+ }
190
+
191
+ exports.FormControl = FormControl;
192
+ //# sourceMappingURL=form-control.cjs.map
193
+ //# sourceMappingURL=form-control.cjs.map
@@ -0,0 +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,GAAA,CAAI,IAAI,CAAA;AAAA,MACT,CAAA,MAAA,IAAW,OAAO,IAAA,EAAM;AACvB,QAAC,IAAyC,OAAA,GAAU,IAAA;AAAA,MACrD;AAAA,IACD,CAAC,CAAA;AAAA,EACF,CAAA;AACD;AAMA,SAAS,UAAA,CACR,WACA,UAAA,EAC0B;AAC1B,EAAA,MAAM,aAAA,GAAyC,EAAE,GAAG,UAAA,EAAW;AAE/D,EAAA,KAAA,MAAW,YAAY,UAA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I,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"]}
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+
3
+ type FormControlLayout = 'stacked' | 'floating';
4
+ interface FormControlProps {
5
+ children: React.ReactElement;
6
+ label: string;
7
+ id?: string;
8
+ layout?: FormControlLayout;
9
+ error?: string;
10
+ className?: string;
11
+ }
12
+ declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): React.JSX.Element;
13
+
14
+ export { FormControl, type FormControlLayout };
@@ -1,4 +1,3 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as React from 'react';
3
2
 
4
3
  type FormControlLayout = 'stacked' | 'floating';
@@ -10,6 +9,6 @@ interface FormControlProps {
10
9
  error?: string;
11
10
  className?: string;
12
11
  }
13
- declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): react_jsx_runtime.JSX.Element;
12
+ declare function FormControl({ children, label, id, layout, error, className }: FormControlProps): React.JSX.Element;
14
13
 
15
14
  export { FormControl, type FormControlLayout };
@@ -116,12 +116,10 @@ function FormControl({ children, label, id, layout = "stacked", error, className
116
116
  className: cn(
117
117
  "relative",
118
118
  // Float label when focused
119
- "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:top-2",
120
119
  "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:translate-y-0",
121
120
  "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:scale-[0.7]",
122
121
  "has-[input:focus-visible]:[&_[data-slot=form-control-label]]:text-primary/80",
123
122
  // Float label when there's a value
124
- "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:top-2",
125
123
  "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:translate-y-0",
126
124
  "has-[input:not(:placeholder-shown)]:[&_[data-slot=form-control-label]]:scale-[0.7]",
127
125
  // Error
@@ -144,11 +142,11 @@ function FormControl({ children, label, id, layout = "stacked", error, className
144
142
  "data-slot": "form-control-label",
145
143
  className: cn(
146
144
  // Base: centered when empty
147
- "pointer-events-none absolute start-3 top-1/2 -translate-y-1/2",
145
+ "pointer-events-none absolute start-3 top-2 translate-y-[0.45rem]",
148
146
  // Small, subtle typography
149
147
  "origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none",
150
148
  // Snappy transition
151
- "transition-[top,transform,color] duration-200 ease-out",
149
+ "transition-[transform,color] duration-200 ease-out motion-reduce:transition-none",
152
150
  // Error state
153
151
  error && "text-destructive"
154
152
  ),
@@ -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;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BACV,SAAA,EAAW,EAAA;AAAA;AAAA,kBAET,+DAAA;AAAA;AAAA,kBAEA,uFAAA;AAAA;AAAA,kBAEA,wDAAA;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]]:top-2',\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]]:top-2',\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-1/2 -translate-y-1/2',\n // Small, subtle typography\n 'origin-left text-[13px] leading-none font-normal text-muted-foreground/60 select-none',\n // Snappy transition\n 'transition-[top,transform,color] duration-200 ease-out',\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,"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,KAAQ;AACrB,MAAA,IAAI,OAAO,QAAQ,UAAA,EAAY;AAC9B,QAAA,GAAA,CAAI,IAAI,CAAA;AAAA,MACT,CAAA,MAAA,IAAW,OAAO,IAAA,EAAM;AACvB,QAAC,IAAyC,OAAA,GAAU,IAAA;AAAA,MACrD;AAAA,IACD,CAAC,CAAA;AAAA,EACF,CAAA;AACD;AAMA,SAAS,UAAA,CACR,WACA,UAAA,EAC0B;AAC1B,EAAA,MAAM,aAAA,GAAyC,EAAE,GAAG,UAAA,EAAW;AAE/D,EAAA,KAAA,MAAW,YAAY,UAAA,EAAY;AAElC,IAAA,IAAI,aAAa,KAAA,EAAO;AAExB,IAAA,MAAM,aAAA,GAAgB,UAAU,QAAQ,CAAA;AACxC,IAAA,MAAM,cAAA,GAAiB,WAAW,QAAQ,CAAA;AAG1C,IAAA,IAAI,UAAA,CAAW,KAAK,QAAQ,CAAA,IAAK,OAAO,aAAA,KAAkB,UAAA,IAAc,OAAO,cAAA,KAAmB,UAAA,EAAY;AAC7G,MAAA,aAAA,CAAc,QAAQ,CAAA,GAAI,CAAA,GAAI,IAAA,KAAoB;AACjD,QAAA,cAAA,CAAe,GAAG,IAAI,CAAA;AACtB,QAAA,aAAA,CAAc,GAAG,IAAI,CAAA;AAAA,MACtB,CAAA;AAAA,IACD,CAAA,MAAA,IAES,aAAa,WAAA,IAAe,OAAO,kBAAkB,QAAA,IAAY,OAAO,mBAAmB,QAAA,EAAU;AAC7G,MAAA,aAAA,CAAc,QAAQ,CAA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AAA,EAAW,EAAA;AAAA,kBACT,KAAA,IAAS;AAAA,iBACX;AAAA,gBAEC,QAAA,EAAA;AAAA;AAAA,aACH;AAAA,4BACAA,GAAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,OAAA;AAAA,gBACT,WAAA,EAAU,oBAAA;AAAA,gBACV,SAAA,EAAW,EAAA;AAAA;AAAA,kBAET,kEAAA;AAAA;AAAA,kBAEA,uFAAA;AAAA;AAAA,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"]}
@@ -0,0 +1,208 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var reactHookForm = require('react-hook-form');
7
+ var clsx = require('clsx');
8
+ var tailwindMerge = require('tailwind-merge');
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
+
30
+ function composeRefs(...refs) {
31
+ return (node) => {
32
+ refs.forEach((ref) => {
33
+ if (typeof ref === "function") {
34
+ ref(node);
35
+ } else if (ref != null) {
36
+ ref.current = node;
37
+ }
38
+ });
39
+ };
40
+ }
41
+ function mergeProps(slotProps, childProps) {
42
+ const overrideProps = { ...childProps };
43
+ for (const propName in childProps) {
44
+ if (propName === "ref") continue;
45
+ const slotPropValue = slotProps[propName];
46
+ const childPropValue = childProps[propName];
47
+ if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
48
+ overrideProps[propName] = (...args) => {
49
+ childPropValue(...args);
50
+ slotPropValue(...args);
51
+ };
52
+ } else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
53
+ overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
54
+ } else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
55
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
56
+ }
57
+ }
58
+ return { ...slotProps, ...overrideProps };
59
+ }
60
+ function isSlottable(child) {
61
+ return React__namespace.isValidElement(child);
62
+ }
63
+ var Slot = React__namespace.forwardRef((props, forwardedRef) => {
64
+ const { children, ...slotProps } = props;
65
+ if (isSlottable(children)) {
66
+ const childProps = children.props;
67
+ const childRef = childProps.ref;
68
+ return React__namespace.cloneElement(children, {
69
+ ...mergeProps(slotProps, childProps),
70
+ ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
71
+ });
72
+ }
73
+ if (React__namespace.Children.count(children) > 1) {
74
+ const childrenArray = React__namespace.Children.toArray(children);
75
+ const slottableChild = childrenArray.find(
76
+ (child) => React__namespace.isValidElement(child) && child.type === Slottable
77
+ );
78
+ if (slottableChild) {
79
+ const newElement = slottableChild.props.children;
80
+ if (isSlottable(newElement)) {
81
+ const newElementProps = newElement.props;
82
+ const newChildren = childrenArray.map((child) => {
83
+ if (child === slottableChild) {
84
+ return React__namespace.Children.count(newElementProps.children) > 1 ? React__namespace.Children.only(null) : newElementProps.children;
85
+ }
86
+ return child;
87
+ });
88
+ const childRef = newElementProps.ref;
89
+ return React__namespace.cloneElement(newElement, {
90
+ ...mergeProps(slotProps, newElementProps),
91
+ ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
92
+ children: newChildren
93
+ });
94
+ }
95
+ }
96
+ }
97
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
98
+ });
99
+ Slot.displayName = "Slot";
100
+ function Slottable({ children }) {
101
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
102
+ }
103
+ function cn(...inputs) {
104
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
105
+ }
106
+ function Label({ className, ...props }) {
107
+ return /* @__PURE__ */ jsxRuntime.jsx(
108
+ "label",
109
+ {
110
+ "data-slot": "label",
111
+ className: cn(
112
+ `text-foreground text-sm leading-4 font-medium select-none group-data-[disabled=true]:pointer-events-none
113
+ group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50
114
+ data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,
115
+ className
116
+ ),
117
+ ...props
118
+ }
119
+ );
120
+ }
121
+ var Form = reactHookForm.FormProvider;
122
+ var FormFieldContext = React__namespace.createContext({});
123
+ var FormField = ({
124
+ ...props
125
+ }) => {
126
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
127
+ };
128
+ var useFormField = () => {
129
+ const fieldContext = React__namespace.useContext(FormFieldContext);
130
+ const itemContext = React__namespace.useContext(FormItemContext);
131
+ const { getFieldState } = reactHookForm.useFormContext();
132
+ const formState = reactHookForm.useFormState({ name: fieldContext.name });
133
+ const fieldState = getFieldState(fieldContext.name, formState);
134
+ if (!fieldContext) {
135
+ throw new Error("useFormField should be used within <FormField>");
136
+ }
137
+ const { id } = itemContext;
138
+ return {
139
+ id,
140
+ name: fieldContext.name,
141
+ formItemId: `${id}-form-item`,
142
+ formDescriptionId: `${id}-form-item-description`,
143
+ formMessageId: `${id}-form-item-message`,
144
+ ...fieldState
145
+ };
146
+ };
147
+ var FormItemContext = React__namespace.createContext({});
148
+ function FormItem({ className, ...props }) {
149
+ const id = React__namespace.useId();
150
+ return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
151
+ }
152
+ function FormLabel({ className, ...props }) {
153
+ const { error, formItemId } = useFormField();
154
+ return /* @__PURE__ */ jsxRuntime.jsx(
155
+ Label,
156
+ {
157
+ "data-slot": "form-label",
158
+ "data-error": !!error,
159
+ className: cn("data-[error=true]:text-destructive", className),
160
+ htmlFor: formItemId,
161
+ ...props
162
+ }
163
+ );
164
+ }
165
+ function FormControl({ ...props }) {
166
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
167
+ return /* @__PURE__ */ jsxRuntime.jsx(
168
+ Slot,
169
+ {
170
+ "data-slot": "form-control",
171
+ id: formItemId,
172
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
173
+ "aria-invalid": !!error,
174
+ ...props
175
+ }
176
+ );
177
+ }
178
+ function FormDescription({ className, ...props }) {
179
+ const { formDescriptionId } = useFormField();
180
+ return /* @__PURE__ */ jsxRuntime.jsx(
181
+ "p",
182
+ {
183
+ "data-slot": "form-description",
184
+ id: formDescriptionId,
185
+ className: cn("text-muted-foreground text-sm", className),
186
+ ...props
187
+ }
188
+ );
189
+ }
190
+ function FormMessage({ className, ...props }) {
191
+ const { error, formMessageId } = useFormField();
192
+ const body = error ? String(error?.message ?? "") : props.children;
193
+ if (!body) {
194
+ return null;
195
+ }
196
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "form-message", id: formMessageId, className: cn("text-destructive text-sm", className), ...props, children: body });
197
+ }
198
+
199
+ exports.Form = Form;
200
+ exports.FormControl = FormControl;
201
+ exports.FormDescription = FormDescription;
202
+ exports.FormField = FormField;
203
+ exports.FormItem = FormItem;
204
+ exports.FormLabel = FormLabel;
205
+ exports.FormMessage = FormMessage;
206
+ exports.useFormField = useFormField;
207
+ //# sourceMappingURL=form.cjs.map
208
+ //# sourceMappingURL=form.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/slot.tsx","../../src/lib/utils.ts","../../src/components/label.tsx","../../src/components/form.tsx"],"names":["React","twMerge","clsx","jsx","FormProvider","React2","Controller","useFormContext","useFormState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAA,CA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AAA,MACA,WAAA,EAAU,kBAAA;AAAA,MACV,EAAA,EAAI,iBAAA;AAAA,MACJ,SAAA,EAAW,EAAA,CAAG,+BAAA,EAAiC,SAAS,CAAA;AAAA,MACvD,GAAG;AAAA;AAAA,GACL;AAEF;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAA8B;AACxE,EAAA,MAAM,EAAE,KAAA,EAAO,aAAA,EAAc,GAAI,YAAA,EAAa;AAC9C,EAAA,MAAM,OAAO,KAAA,GAAQ,MAAA,CAAO,OAAO,OAAA,IAAW,EAAE,IAAI,KAAA,CAAM,QAAA;AAE1D,EAAA,IAAI,CAAC,IAAA,EAAM;AACV,IAAA,OAAO,IAAA;AAAA,EACR;AAEA,EAAA,uBACCA,cAAAA,CAAC,GAAA,EAAA,EAAE,WAAA,EAAU,gBAAe,EAAA,EAAI,aAAA,EAAe,SAAA,EAAW,EAAA,CAAG,0BAAA,EAA4B,SAAS,CAAA,EAAI,GAAG,OACvG,QAAA,EAAA,IAAA,EACF,CAAA;AAEF","file":"form.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';\nimport {\n\tController,\n\tFormProvider,\n\tuseFormContext,\n\tuseFormState,\n\ttype ControllerProps,\n\ttype FieldPath,\n\ttype FieldValues,\n} from 'react-hook-form';\n\nimport { cn } from '../lib/utils';\nimport { Label } from './label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n\tTFieldValues extends FieldValues = FieldValues,\n\tTName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n\tname: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <\n\tTFieldValues extends FieldValues = FieldValues,\n\tTName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n\t...props\n}: ControllerProps<TFieldValues, TName>) => {\n\treturn (\n\t\t<FormFieldContext.Provider value={{ name: props.name }}>\n\t\t\t<Controller {...props} />\n\t\t</FormFieldContext.Provider>\n\t);\n};\n\nconst useFormField = () => {\n\tconst fieldContext = React.useContext(FormFieldContext);\n\tconst itemContext = React.useContext(FormItemContext);\n\tconst { getFieldState } = useFormContext();\n\tconst formState = useFormState({ name: fieldContext.name });\n\tconst fieldState = getFieldState(fieldContext.name, formState);\n\n\tif (!fieldContext) {\n\t\tthrow new Error('useFormField should be used within <FormField>');\n\t}\n\n\tconst { id } = itemContext;\n\n\treturn {\n\t\tid,\n\t\tname: fieldContext.name,\n\t\tformItemId: `${id}-form-item`,\n\t\tformDescriptionId: `${id}-form-item-description`,\n\t\tformMessageId: `${id}-form-item-message`,\n\t\t...fieldState,\n\t};\n};\n\ntype FormItemContextValue = {\n\tid: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n\tconst id = React.useId();\n\n\treturn (\n\t\t<FormItemContext.Provider value={{ id }}>\n\t\t\t<div data-slot=\"form-item\" className={cn('grid gap-2', className)} {...props} />\n\t\t</FormItemContext.Provider>\n\t);\n}\n\nfunction FormLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n\tconst { error, formItemId } = useFormField();\n\n\treturn (\n\t\t<Label\n\t\t\tdata-slot=\"form-label\"\n\t\t\tdata-error={!!error}\n\t\t\tclassName={cn('data-[error=true]:text-destructive', className)}\n\t\t\thtmlFor={formItemId}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof Slot>) {\n\tconst { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n\treturn (\n\t\t<Slot\n\t\t\tdata-slot=\"form-control\"\n\t\t\tid={formItemId}\n\t\t\taria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n\t\t\taria-invalid={!!error}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n\tconst { formDescriptionId } = useFormField();\n\n\treturn (\n\t\t<p\n\t\t\tdata-slot=\"form-description\"\n\t\t\tid={formDescriptionId}\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n\tconst { error, formMessageId } = useFormField();\n\tconst body = error ? String(error?.message ?? '') : props.children;\n\n\tif (!body) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<p data-slot=\"form-message\" id={formMessageId} className={cn('text-destructive text-sm', className)} {...props}>\n\t\t\t{body}\n\t\t</p>\n\t);\n}\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"]}