@constructive-io/ui 0.12.0 → 0.13.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 (493) hide show
  1. package/README.md +1 -1
  2. package/dist/{ai-CiaH2sfF.js → ai-B7XNnqYL.js} +1674 -228
  3. package/dist/ai-B7XNnqYL.js.map +1 -0
  4. package/dist/{ai-lAkichk8.cjs → ai-DJ-YPj8c.cjs} +1768 -226
  5. package/dist/ai-DJ-YPj8c.cjs.map +1 -0
  6. package/dist/{alert-BXuP0ayz.d.ts → alert-CJ4Qyk6W.d.cts} +4 -2
  7. package/dist/{alert-BXuP0ayz.d.cts → alert-CJ4Qyk6W.d.ts} +4 -2
  8. package/dist/components/accordion.cjs +60 -0
  9. package/dist/components/accordion.cjs.map +1 -0
  10. package/dist/components/accordion.d.cts +14 -0
  11. package/dist/components/accordion.d.ts +14 -0
  12. package/dist/components/accordion.js +54 -0
  13. package/dist/components/accordion.js.map +1 -0
  14. package/dist/components/ai/index.cjs +17 -1
  15. package/dist/components/ai/index.d.cts +2 -2
  16. package/dist/components/ai/index.d.ts +2 -2
  17. package/dist/components/ai/index.js +2 -2
  18. package/dist/components/alert-dialog.cjs +17 -8
  19. package/dist/components/alert-dialog.cjs.map +1 -1
  20. package/dist/components/alert-dialog.d.cts +1 -1
  21. package/dist/components/alert-dialog.d.ts +1 -1
  22. package/dist/components/alert-dialog.js +17 -8
  23. package/dist/components/alert-dialog.js.map +1 -1
  24. package/dist/components/alert.cjs +18 -8
  25. package/dist/components/alert.cjs.map +1 -1
  26. package/dist/components/alert.d.cts +2 -2
  27. package/dist/components/alert.d.ts +2 -2
  28. package/dist/components/alert.js +18 -9
  29. package/dist/components/alert.js.map +1 -1
  30. package/dist/components/autocomplete.cjs +9 -5
  31. package/dist/components/autocomplete.cjs.map +1 -1
  32. package/dist/components/autocomplete.js +9 -5
  33. package/dist/components/autocomplete.js.map +1 -1
  34. package/dist/components/avatar.cjs +9 -3
  35. package/dist/components/avatar.cjs.map +1 -1
  36. package/dist/components/avatar.d.cts +6 -0
  37. package/dist/components/avatar.d.ts +6 -0
  38. package/dist/components/avatar.js +9 -3
  39. package/dist/components/avatar.js.map +1 -1
  40. package/dist/components/badge.cjs +25 -18
  41. package/dist/components/badge.cjs.map +1 -1
  42. package/dist/components/badge.d.cts +2 -2
  43. package/dist/components/badge.d.ts +2 -2
  44. package/dist/components/badge.js +25 -18
  45. package/dist/components/badge.js.map +1 -1
  46. package/dist/components/breadcrumb.cjs +9 -6
  47. package/dist/components/breadcrumb.cjs.map +1 -1
  48. package/dist/components/breadcrumb.js +9 -6
  49. package/dist/components/breadcrumb.js.map +1 -1
  50. package/dist/components/button-group.cjs +57 -0
  51. package/dist/components/button-group.cjs.map +1 -0
  52. package/dist/components/button-group.d.cts +16 -0
  53. package/dist/components/button-group.d.ts +16 -0
  54. package/dist/components/button-group.js +51 -0
  55. package/dist/components/button-group.js.map +1 -0
  56. package/dist/components/button.cjs +59 -15
  57. package/dist/components/button.cjs.map +1 -1
  58. package/dist/components/button.d.cts +32 -2
  59. package/dist/components/button.d.ts +32 -2
  60. package/dist/components/button.js +59 -15
  61. package/dist/components/button.js.map +1 -1
  62. package/dist/components/calendar-rac.cjs +14 -8
  63. package/dist/components/calendar-rac.cjs.map +1 -1
  64. package/dist/components/calendar-rac.js +14 -8
  65. package/dist/components/calendar-rac.js.map +1 -1
  66. package/dist/components/card.cjs +35 -23
  67. package/dist/components/card.cjs.map +1 -1
  68. package/dist/components/card.d.cts +2 -1
  69. package/dist/components/card.d.ts +2 -1
  70. package/dist/components/card.js +35 -23
  71. package/dist/components/card.js.map +1 -1
  72. package/dist/components/checkbox.cjs +5 -5
  73. package/dist/components/checkbox.cjs.map +1 -1
  74. package/dist/components/checkbox.js +5 -5
  75. package/dist/components/checkbox.js.map +1 -1
  76. package/dist/components/collapsible.cjs +3 -3
  77. package/dist/components/collapsible.cjs.map +1 -1
  78. package/dist/components/collapsible.js +3 -3
  79. package/dist/components/collapsible.js.map +1 -1
  80. package/dist/components/combobox.cjs +24 -12
  81. package/dist/components/combobox.cjs.map +1 -1
  82. package/dist/components/combobox.d.cts +2 -1
  83. package/dist/components/combobox.d.ts +2 -1
  84. package/dist/components/combobox.js +24 -12
  85. package/dist/components/combobox.js.map +1 -1
  86. package/dist/components/command.cjs +25 -14
  87. package/dist/components/command.cjs.map +1 -1
  88. package/dist/components/command.d.cts +6 -2
  89. package/dist/components/command.d.ts +6 -2
  90. package/dist/components/command.js +25 -14
  91. package/dist/components/command.js.map +1 -1
  92. package/dist/components/dialog.cjs +22 -12
  93. package/dist/components/dialog.cjs.map +1 -1
  94. package/dist/components/dialog.d.cts +5 -2
  95. package/dist/components/dialog.d.ts +5 -2
  96. package/dist/components/dialog.js +22 -12
  97. package/dist/components/dialog.js.map +1 -1
  98. package/dist/components/dock.cjs +50 -27
  99. package/dist/components/dock.cjs.map +1 -1
  100. package/dist/components/dock.d.cts +1 -1
  101. package/dist/components/dock.d.ts +1 -1
  102. package/dist/components/dock.js +51 -28
  103. package/dist/components/dock.js.map +1 -1
  104. package/dist/components/drawer.cjs +22 -14
  105. package/dist/components/drawer.cjs.map +1 -1
  106. package/dist/components/drawer.js +22 -14
  107. package/dist/components/drawer.js.map +1 -1
  108. package/dist/components/dropdown-menu.cjs +34 -28
  109. package/dist/components/dropdown-menu.cjs.map +1 -1
  110. package/dist/components/dropdown-menu.d.cts +2 -2
  111. package/dist/components/dropdown-menu.d.ts +2 -2
  112. package/dist/components/dropdown-menu.js +52 -46
  113. package/dist/components/dropdown-menu.js.map +1 -1
  114. package/dist/components/empty.cjs +4 -4
  115. package/dist/components/empty.cjs.map +1 -1
  116. package/dist/components/empty.js +4 -4
  117. package/dist/components/empty.js.map +1 -1
  118. package/dist/components/field.cjs +33 -33
  119. package/dist/components/field.cjs.map +1 -1
  120. package/dist/components/field.d.cts +1 -1
  121. package/dist/components/field.d.ts +1 -1
  122. package/dist/components/field.js +34 -34
  123. package/dist/components/field.js.map +1 -1
  124. package/dist/components/flickering-grid.cjs +1 -1
  125. package/dist/components/flickering-grid.cjs.map +1 -1
  126. package/dist/components/flickering-grid.js +1 -1
  127. package/dist/components/flickering-grid.js.map +1 -1
  128. package/dist/components/flow-zoom-panel.cjs +10 -5
  129. package/dist/components/flow-zoom-panel.cjs.map +1 -1
  130. package/dist/components/flow-zoom-panel.d.cts +8 -1
  131. package/dist/components/flow-zoom-panel.d.ts +8 -1
  132. package/dist/components/flow-zoom-panel.js +10 -5
  133. package/dist/components/flow-zoom-panel.js.map +1 -1
  134. package/dist/components/form-control.cjs +12 -8
  135. package/dist/components/form-control.cjs.map +1 -1
  136. package/dist/components/form-control.js +12 -8
  137. package/dist/components/form-control.js.map +1 -1
  138. package/dist/components/form.cjs +5 -5
  139. package/dist/components/form.cjs.map +1 -1
  140. package/dist/components/form.js +5 -5
  141. package/dist/components/form.js.map +1 -1
  142. package/dist/components/input-group.cjs +13 -7
  143. package/dist/components/input-group.cjs.map +1 -1
  144. package/dist/components/input-group.d.cts +2 -2
  145. package/dist/components/input-group.d.ts +2 -2
  146. package/dist/components/input-group.js +11 -7
  147. package/dist/components/input-group.js.map +1 -1
  148. package/dist/components/input-otp.cjs +252 -0
  149. package/dist/components/input-otp.cjs.map +1 -0
  150. package/dist/components/input-otp.d.cts +44 -0
  151. package/dist/components/input-otp.d.ts +44 -0
  152. package/dist/components/input-otp.js +251 -0
  153. package/dist/components/input-otp.js.map +1 -0
  154. package/dist/components/input.cjs +10 -4
  155. package/dist/components/input.cjs.map +1 -1
  156. package/dist/components/input.d.cts +11 -2
  157. package/dist/components/input.d.ts +11 -2
  158. package/dist/components/input.js +10 -4
  159. package/dist/components/input.js.map +1 -1
  160. package/dist/components/item.cjs +151 -0
  161. package/dist/components/item.cjs.map +1 -0
  162. package/dist/components/item.d.cts +37 -0
  163. package/dist/components/item.d.ts +37 -0
  164. package/dist/components/item.js +137 -0
  165. package/dist/components/item.js.map +1 -0
  166. package/dist/components/json-input.cjs +4 -143
  167. package/dist/components/json-input.d.cts +6 -4
  168. package/dist/components/json-input.d.ts +6 -4
  169. package/dist/components/json-input.js +2 -140
  170. package/dist/components/kbd.cjs +35 -0
  171. package/dist/components/kbd.cjs.map +1 -0
  172. package/dist/components/kbd.d.cts +16 -0
  173. package/dist/components/kbd.d.ts +16 -0
  174. package/dist/components/kbd.js +31 -0
  175. package/dist/components/kbd.js.map +1 -0
  176. package/dist/components/label.cjs +3 -3
  177. package/dist/components/label.cjs.map +1 -1
  178. package/dist/components/label.js +3 -3
  179. package/dist/components/label.js.map +1 -1
  180. package/dist/components/motion-grid.cjs +20 -8
  181. package/dist/components/motion-grid.cjs.map +1 -1
  182. package/dist/components/motion-grid.js +20 -8
  183. package/dist/components/motion-grid.js.map +1 -1
  184. package/dist/components/multi-select.cjs +77 -67
  185. package/dist/components/multi-select.cjs.map +1 -1
  186. package/dist/components/multi-select.js +77 -67
  187. package/dist/components/multi-select.js.map +1 -1
  188. package/dist/components/page-header.cjs +12 -9
  189. package/dist/components/page-header.cjs.map +1 -1
  190. package/dist/components/page-header.js +12 -9
  191. package/dist/components/page-header.js.map +1 -1
  192. package/dist/components/pagination.cjs +10 -4
  193. package/dist/components/pagination.cjs.map +1 -1
  194. package/dist/components/pagination.d.cts +1 -1
  195. package/dist/components/pagination.d.ts +1 -1
  196. package/dist/components/pagination.js +10 -4
  197. package/dist/components/pagination.js.map +1 -1
  198. package/dist/components/phone-input.cjs +228 -0
  199. package/dist/components/phone-input.cjs.map +1 -0
  200. package/dist/components/phone-input.d.cts +42 -0
  201. package/dist/components/phone-input.d.ts +42 -0
  202. package/dist/components/phone-input.js +220 -0
  203. package/dist/components/phone-input.js.map +1 -0
  204. package/dist/components/popover.cjs +5 -4
  205. package/dist/components/popover.cjs.map +1 -1
  206. package/dist/components/popover.js +5 -4
  207. package/dist/components/popover.js.map +1 -1
  208. package/dist/components/progress.cjs +20 -3
  209. package/dist/components/progress.cjs.map +1 -1
  210. package/dist/components/progress.d.cts +1 -1
  211. package/dist/components/progress.d.ts +1 -1
  212. package/dist/components/progress.js +20 -3
  213. package/dist/components/progress.js.map +1 -1
  214. package/dist/components/progressive-blur-scroll-container.cjs +2 -2
  215. package/dist/components/progressive-blur-scroll-container.cjs.map +1 -1
  216. package/dist/components/progressive-blur-scroll-container.d.cts +1 -1
  217. package/dist/components/progressive-blur-scroll-container.d.ts +1 -1
  218. package/dist/components/progressive-blur-scroll-container.js +2 -2
  219. package/dist/components/progressive-blur-scroll-container.js.map +1 -1
  220. package/dist/components/progressive-blur.cjs +3 -2
  221. package/dist/components/progressive-blur.cjs.map +1 -1
  222. package/dist/components/progressive-blur.js +3 -2
  223. package/dist/components/progressive-blur.js.map +1 -1
  224. package/dist/components/radio-group.cjs +2 -2
  225. package/dist/components/radio-group.cjs.map +1 -1
  226. package/dist/components/radio-group.js +2 -2
  227. package/dist/components/radio-group.js.map +1 -1
  228. package/dist/components/record-picker.cjs +1 -1
  229. package/dist/components/record-picker.js +1 -1
  230. package/dist/components/resizable.cjs +2 -2
  231. package/dist/components/resizable.cjs.map +1 -1
  232. package/dist/components/resizable.js +2 -2
  233. package/dist/components/resizable.js.map +1 -1
  234. package/dist/components/responsive-diagram.cjs +43 -21
  235. package/dist/components/responsive-diagram.cjs.map +1 -1
  236. package/dist/components/responsive-diagram.d.cts +7 -1
  237. package/dist/components/responsive-diagram.d.ts +7 -1
  238. package/dist/components/responsive-diagram.js +43 -21
  239. package/dist/components/responsive-diagram.js.map +1 -1
  240. package/dist/components/scroll-area.cjs +2 -2
  241. package/dist/components/scroll-area.cjs.map +1 -1
  242. package/dist/components/scroll-area.js +2 -2
  243. package/dist/components/scroll-area.js.map +1 -1
  244. package/dist/components/select.cjs +84 -20
  245. package/dist/components/select.cjs.map +1 -1
  246. package/dist/components/select.d.cts +12 -7
  247. package/dist/components/select.d.ts +12 -7
  248. package/dist/components/select.js +84 -20
  249. package/dist/components/select.js.map +1 -1
  250. package/dist/components/separator.cjs +1 -1
  251. package/dist/components/separator.cjs.map +1 -1
  252. package/dist/components/separator.d.cts +11 -2
  253. package/dist/components/separator.d.ts +11 -2
  254. package/dist/components/separator.js +1 -1
  255. package/dist/components/separator.js.map +1 -1
  256. package/dist/components/sheet.cjs +1 -1
  257. package/dist/components/sheet.d.cts +11 -5
  258. package/dist/components/sheet.d.ts +12 -6
  259. package/dist/components/sheet.js +1 -1
  260. package/dist/components/sidebar.cjs +2 -1
  261. package/dist/components/sidebar.d.cts +7 -6
  262. package/dist/components/sidebar.d.ts +7 -6
  263. package/dist/components/sidebar.js +2 -1
  264. package/dist/components/slider.cjs +47 -0
  265. package/dist/components/slider.cjs.map +1 -0
  266. package/dist/components/slider.d.cts +8 -0
  267. package/dist/components/slider.d.ts +8 -0
  268. package/dist/components/slider.js +44 -0
  269. package/dist/components/slider.js.map +1 -0
  270. package/dist/components/sonner.cjs +15 -4
  271. package/dist/components/sonner.cjs.map +1 -1
  272. package/dist/components/sonner.d.cts +10 -1
  273. package/dist/components/sonner.d.ts +10 -1
  274. package/dist/components/sonner.js +16 -5
  275. package/dist/components/sonner.js.map +1 -1
  276. package/dist/components/spinner.cjs +25 -0
  277. package/dist/components/spinner.cjs.map +1 -0
  278. package/dist/components/spinner.d.cts +16 -0
  279. package/dist/components/spinner.d.ts +16 -0
  280. package/dist/components/spinner.js +22 -0
  281. package/dist/components/spinner.js.map +1 -0
  282. package/dist/components/stack/index.cjs +1 -1
  283. package/dist/components/stack/index.d.cts +1 -1
  284. package/dist/components/stack/index.d.ts +1 -1
  285. package/dist/components/stack/index.js +1 -1
  286. package/dist/components/stepper.cjs +23 -17
  287. package/dist/components/stepper.cjs.map +1 -1
  288. package/dist/components/stepper.d.cts +2 -2
  289. package/dist/components/stepper.d.ts +2 -2
  290. package/dist/components/stepper.js +23 -17
  291. package/dist/components/stepper.js.map +1 -1
  292. package/dist/components/switch.cjs +5 -5
  293. package/dist/components/switch.cjs.map +1 -1
  294. package/dist/components/switch.js +5 -5
  295. package/dist/components/switch.js.map +1 -1
  296. package/dist/components/table.cjs +26 -7
  297. package/dist/components/table.cjs.map +1 -1
  298. package/dist/components/table.d.cts +20 -2
  299. package/dist/components/table.d.ts +20 -2
  300. package/dist/components/table.js +26 -8
  301. package/dist/components/table.js.map +1 -1
  302. package/dist/components/tabs.cjs +61 -8
  303. package/dist/components/tabs.cjs.map +1 -1
  304. package/dist/components/tabs.d.cts +13 -2
  305. package/dist/components/tabs.d.ts +13 -2
  306. package/dist/components/tabs.js +63 -11
  307. package/dist/components/tabs.js.map +1 -1
  308. package/dist/components/tags.cjs +10 -5
  309. package/dist/components/tags.cjs.map +1 -1
  310. package/dist/components/tags.d.cts +1 -1
  311. package/dist/components/tags.d.ts +1 -1
  312. package/dist/components/tags.js +10 -5
  313. package/dist/components/tags.js.map +1 -1
  314. package/dist/components/textarea.cjs +5 -4
  315. package/dist/components/textarea.cjs.map +1 -1
  316. package/dist/components/textarea.js +5 -4
  317. package/dist/components/textarea.js.map +1 -1
  318. package/dist/components/toast/index.cjs +1 -1
  319. package/dist/components/toast/index.d.cts +2 -2
  320. package/dist/components/toast/index.d.ts +2 -2
  321. package/dist/components/toast/index.js +1 -1
  322. package/dist/components/toggle-group.cjs +69 -0
  323. package/dist/components/toggle-group.cjs.map +1 -0
  324. package/dist/components/toggle-group.d.cts +27 -0
  325. package/dist/components/toggle-group.d.ts +27 -0
  326. package/dist/components/toggle-group.js +65 -0
  327. package/dist/components/toggle-group.js.map +1 -0
  328. package/dist/components/toggle.cjs +54 -0
  329. package/dist/components/toggle.cjs.map +1 -0
  330. package/dist/components/toggle.d.cts +13 -0
  331. package/dist/components/toggle.d.ts +13 -0
  332. package/dist/components/toggle.js +50 -0
  333. package/dist/components/toggle.js.map +1 -0
  334. package/dist/components/tooltip.cjs +18 -6
  335. package/dist/components/tooltip.cjs.map +1 -1
  336. package/dist/components/tooltip.d.cts +1 -1
  337. package/dist/components/tooltip.d.ts +1 -1
  338. package/dist/components/tooltip.js +18 -6
  339. package/dist/components/tooltip.js.map +1 -1
  340. package/dist/components/unlink-button.cjs +2 -2
  341. package/dist/components/unlink-button.cjs.map +1 -1
  342. package/dist/components/unlink-button.d.cts +1 -0
  343. package/dist/components/unlink-button.d.ts +1 -0
  344. package/dist/components/unlink-button.js +2 -2
  345. package/dist/components/unlink-button.js.map +1 -1
  346. package/dist/components/workspace-kit/index.cjs +1477 -0
  347. package/dist/components/workspace-kit/index.cjs.map +1 -0
  348. package/dist/components/workspace-kit/index.d.cts +716 -0
  349. package/dist/components/workspace-kit/index.d.ts +716 -0
  350. package/dist/components/workspace-kit/index.js +1410 -0
  351. package/dist/components/workspace-kit/index.js.map +1 -0
  352. package/dist/compose-refs-Mbma1O3M.js +47 -0
  353. package/dist/compose-refs-Mbma1O3M.js.map +1 -0
  354. package/dist/compose-refs-uPrvNoiU.cjs +52 -0
  355. package/dist/compose-refs-uPrvNoiU.cjs.map +1 -0
  356. package/dist/fluid-highlight-AW-OITqJ.cjs +124 -0
  357. package/dist/fluid-highlight-AW-OITqJ.cjs.map +1 -0
  358. package/dist/fluid-highlight-DxWeZ7iu.js +119 -0
  359. package/dist/fluid-highlight-DxWeZ7iu.js.map +1 -0
  360. package/dist/{index-BzLmDsId.d.cts → index-B7cT7gZU.d.cts} +3 -3
  361. package/dist/{index-BzLmDsId.d.ts → index-B7cT7gZU.d.ts} +3 -3
  362. package/dist/{index-UnM04j0t.d.ts → index-BQZxmMpw.d.cts} +11 -31
  363. package/dist/{index-UnM04j0t.d.cts → index-BQZxmMpw.d.ts} +11 -31
  364. package/dist/{index-B0wXxIAb.d.ts → index-CiO-3M_X.d.cts} +334 -18
  365. package/dist/{index-CyaFaZe2.d.cts → index-z3LqQ5L5.d.ts} +334 -18
  366. package/dist/index.cjs +107 -17
  367. package/dist/index.d.cts +64 -14
  368. package/dist/index.d.ts +64 -14
  369. package/dist/index.js +27 -14
  370. package/dist/initial-focus-B8RLtyOZ.cjs +67 -0
  371. package/dist/initial-focus-B8RLtyOZ.cjs.map +1 -0
  372. package/dist/initial-focus-j2E0EnIx.js +61 -0
  373. package/dist/initial-focus-j2E0EnIx.js.map +1 -0
  374. package/dist/initials-DSkWTOb0.cjs +127 -0
  375. package/dist/initials-DSkWTOb0.cjs.map +1 -0
  376. package/dist/initials-kCcHgrSy.js +97 -0
  377. package/dist/initials-kCcHgrSy.js.map +1 -0
  378. package/dist/json-input-CH5aEmoA.js +293 -0
  379. package/dist/json-input-CH5aEmoA.js.map +1 -0
  380. package/dist/json-input-D8yM578l.cjs +311 -0
  381. package/dist/json-input-D8yM578l.cjs.map +1 -0
  382. package/dist/{motion-config-COCFHq1L.cjs → motion-config-DZ7w5Uhq.cjs} +32 -2
  383. package/dist/motion-config-DZ7w5Uhq.cjs.map +1 -0
  384. package/dist/{motion-config-COsZ6azM.js → motion-config-DoFp4I8f.js} +21 -3
  385. package/dist/motion-config-DoFp4I8f.js.map +1 -0
  386. package/dist/{record-picker-Bz4FApxD.cjs → record-picker-BQ1-Vx0g.cjs} +23 -8
  387. package/dist/record-picker-BQ1-Vx0g.cjs.map +1 -0
  388. package/dist/{record-picker-BbxngCeV.js → record-picker-DSRo4RXV.js} +23 -8
  389. package/dist/record-picker-DSRo4RXV.js.map +1 -0
  390. package/dist/{sheet-BdA0rfIz.cjs → sheet-OxWlnT_G.cjs} +25 -32
  391. package/dist/sheet-OxWlnT_G.cjs.map +1 -0
  392. package/dist/{sheet-BLHnhLRH.js → sheet-wPF_l9Cn.js} +25 -32
  393. package/dist/sheet-wPF_l9Cn.js.map +1 -0
  394. package/dist/{sidebar-BavjjJp0.cjs → sidebar-BEEWmJwC.cjs} +74 -57
  395. package/dist/sidebar-BEEWmJwC.cjs.map +1 -0
  396. package/dist/{sidebar-DeoL2ttp.js → sidebar-DWl1Azyv.js} +74 -57
  397. package/dist/sidebar-DWl1Azyv.js.map +1 -0
  398. package/dist/{stack-ci2lkfkr.cjs → stack-CEvmUSwF.cjs} +12 -10
  399. package/dist/stack-CEvmUSwF.cjs.map +1 -0
  400. package/dist/{stack-C9GROTGA.js → stack-Kqu7YaR0.js} +12 -10
  401. package/dist/stack-Kqu7YaR0.js.map +1 -0
  402. package/dist/text-runs-CdmlS5C7.cjs +52 -0
  403. package/dist/text-runs-CdmlS5C7.cjs.map +1 -0
  404. package/dist/text-runs-DqcEO8L_.js +45 -0
  405. package/dist/text-runs-DqcEO8L_.js.map +1 -0
  406. package/dist/theme-DTTTlylA.d.cts +520 -0
  407. package/dist/theme-DTTTlylA.d.ts +520 -0
  408. package/dist/theme-dials-config.cjs +273 -0
  409. package/dist/theme-dials-config.cjs.map +1 -0
  410. package/dist/theme-dials-config.d.cts +95 -0
  411. package/dist/theme-dials-config.d.ts +95 -0
  412. package/dist/theme-dials-config.js +269 -0
  413. package/dist/theme-dials-config.js.map +1 -0
  414. package/dist/theme-presets.cjs +922 -0
  415. package/dist/theme-presets.cjs.map +1 -0
  416. package/dist/theme-presets.d.cts +89 -0
  417. package/dist/theme-presets.d.ts +89 -0
  418. package/dist/theme-presets.js +912 -0
  419. package/dist/theme-presets.js.map +1 -0
  420. package/dist/theme-tuning-DjgDvV8V.d.ts +158 -0
  421. package/dist/theme-tuning-TJ76tnxZ.d.cts +158 -0
  422. package/dist/theme-tuning.cjs +349 -0
  423. package/dist/theme-tuning.cjs.map +1 -0
  424. package/dist/theme-tuning.d.cts +2 -0
  425. package/dist/theme-tuning.d.ts +2 -0
  426. package/dist/theme-tuning.js +333 -0
  427. package/dist/theme-tuning.js.map +1 -0
  428. package/dist/theme.cjs +432 -0
  429. package/dist/theme.cjs.map +1 -0
  430. package/dist/theme.d.cts +2 -0
  431. package/dist/theme.d.ts +2 -0
  432. package/dist/theme.js +430 -0
  433. package/dist/theme.js.map +1 -0
  434. package/dist/toast-08jF1DBQ.cjs +193 -0
  435. package/dist/toast-08jF1DBQ.cjs.map +1 -0
  436. package/dist/toast-CVW5XY4u.js +164 -0
  437. package/dist/toast-CVW5XY4u.js.map +1 -0
  438. package/dist/toast-details-BdxxSLlN.cjs +209 -0
  439. package/dist/toast-details-BdxxSLlN.cjs.map +1 -0
  440. package/dist/toast-details-CfsB1Vxb.js +198 -0
  441. package/dist/toast-details-CfsB1Vxb.js.map +1 -0
  442. package/dist/{tooltip-CTRQoN1A.d.ts → tooltip-Fqb4JK-g.d.cts} +2 -2
  443. package/dist/{tooltip-CTRQoN1A.d.cts → tooltip-Fqb4JK-g.d.ts} +2 -2
  444. package/dist/tuning-BKVFsxLr.js +48 -0
  445. package/dist/tuning-BKVFsxLr.js.map +1 -0
  446. package/dist/tuning-BRPG7U1U.cjs +71 -0
  447. package/dist/tuning-BRPG7U1U.cjs.map +1 -0
  448. package/dist/use-document-theme-BSEuNsEE.cjs +43 -0
  449. package/dist/use-document-theme-BSEuNsEE.cjs.map +1 -0
  450. package/dist/use-document-theme-Ch_PqxZz.js +38 -0
  451. package/dist/use-document-theme-Ch_PqxZz.js.map +1 -0
  452. package/dist/use-scroll-fade-CaHp52u4.cjs +79 -0
  453. package/dist/use-scroll-fade-CaHp52u4.cjs.map +1 -0
  454. package/dist/use-scroll-fade-ilq-o00-.js +72 -0
  455. package/dist/use-scroll-fade-ilq-o00-.js.map +1 -0
  456. package/package.json +163 -27
  457. package/src/styles/globals.css +176 -97
  458. package/dist/ai-CiaH2sfF.js.map +0 -1
  459. package/dist/ai-lAkichk8.cjs.map +0 -1
  460. package/dist/button-Bvh83YGs.d.cts +0 -20
  461. package/dist/button-Bvh83YGs.d.ts +0 -20
  462. package/dist/components/app-bar.cjs +0 -81
  463. package/dist/components/app-bar.cjs.map +0 -1
  464. package/dist/components/app-bar.d.cts +0 -27
  465. package/dist/components/app-bar.d.ts +0 -27
  466. package/dist/components/app-bar.js +0 -77
  467. package/dist/components/app-bar.js.map +0 -1
  468. package/dist/components/app-shell.cjs +0 -267
  469. package/dist/components/app-shell.cjs.map +0 -1
  470. package/dist/components/app-shell.d.cts +0 -98
  471. package/dist/components/app-shell.d.ts +0 -98
  472. package/dist/components/app-shell.js +0 -264
  473. package/dist/components/app-shell.js.map +0 -1
  474. package/dist/components/json-input.cjs.map +0 -1
  475. package/dist/components/json-input.js.map +0 -1
  476. package/dist/input-CBrCuMH8.d.cts +0 -11
  477. package/dist/input-CBrCuMH8.d.ts +0 -11
  478. package/dist/motion-config-COCFHq1L.cjs.map +0 -1
  479. package/dist/motion-config-COsZ6azM.js.map +0 -1
  480. package/dist/record-picker-BbxngCeV.js.map +0 -1
  481. package/dist/record-picker-Bz4FApxD.cjs.map +0 -1
  482. package/dist/separator-BQEsr0Rc.d.cts +0 -11
  483. package/dist/separator-BQEsr0Rc.d.ts +0 -11
  484. package/dist/sheet-BLHnhLRH.js.map +0 -1
  485. package/dist/sheet-BdA0rfIz.cjs.map +0 -1
  486. package/dist/sidebar-BavjjJp0.cjs.map +0 -1
  487. package/dist/sidebar-DeoL2ttp.js.map +0 -1
  488. package/dist/stack-C9GROTGA.js.map +0 -1
  489. package/dist/stack-ci2lkfkr.cjs.map +0 -1
  490. package/dist/toast-D6MqijT2.cjs +0 -316
  491. package/dist/toast-D6MqijT2.cjs.map +0 -1
  492. package/dist/toast-D_BOLzm3.js +0 -287
  493. package/dist/toast-D_BOLzm3.js.map +0 -1
@@ -0,0 +1,311 @@
1
+ 'use client';
2
+ const require_rolldown_runtime = require('./rolldown-runtime-D_qnwXdH.cjs');
3
+ const require_utils = require('./utils-CzTQ3-VI.cjs');
4
+ const require_components_button = require('./components/button.cjs');
5
+ const require_components_tooltip = require('./components/tooltip.cjs');
6
+ const require_use_document_theme = require('./use-document-theme-BSEuNsEE.cjs');
7
+ let react = require("react");
8
+ react = require_rolldown_runtime.__toESM(react, 1);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ let lucide_react = require("lucide-react");
11
+
12
+ //#region src/lib/json-error-position.ts
13
+ /**
14
+ * Where a JSON text first stops being valid, for an error message a person can act on. Engines word syntax errors
15
+ * differently and often leave out the position (Safari always does), which makes a mistake on line 4,500 hard to find,
16
+ * so the position is found by a small scan of the grammar instead of being read from the engine's message.
17
+ */
18
+ const JSON_NUMBER = /-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/y;
19
+ const JSON_HEX_ESCAPE = /[0-9a-fA-F]{4}/y;
20
+ /** Where `text` first stops being valid JSON, as a 0-based character offset (null when it parses). */
21
+ const findJsonErrorOffset = (text) => {
22
+ let i = 0;
23
+ const fail = (at = i) => {
24
+ throw new JsonOffsetError(at);
25
+ };
26
+ const whitespace = () => {
27
+ while (i < text.length && " \n\r ".includes(text[i])) i += 1;
28
+ };
29
+ const string = () => {
30
+ i += 1;
31
+ while (i < text.length) {
32
+ const char = text[i];
33
+ if (char === "\"") {
34
+ i += 1;
35
+ return;
36
+ }
37
+ if (char === "\\") {
38
+ const escape = text[i + 1];
39
+ if (escape === "u") {
40
+ JSON_HEX_ESCAPE.lastIndex = i + 2;
41
+ if (!JSON_HEX_ESCAPE.test(text)) fail(i);
42
+ i += 6;
43
+ } else if (escape !== void 0 && "\"\\/bfnrt".includes(escape)) i += 2;
44
+ else fail(i + 1);
45
+ } else if (char < " ") fail(i);
46
+ else i += 1;
47
+ }
48
+ fail(text.length);
49
+ };
50
+ const value = () => {
51
+ whitespace();
52
+ const char = text[i];
53
+ if (char === "{") {
54
+ i += 1;
55
+ whitespace();
56
+ if (text[i] === "}") {
57
+ i += 1;
58
+ return;
59
+ }
60
+ for (;;) {
61
+ whitespace();
62
+ if (text[i] !== "\"") fail();
63
+ string();
64
+ whitespace();
65
+ if (text[i] !== ":") fail();
66
+ i += 1;
67
+ value();
68
+ whitespace();
69
+ if (text[i] === ",") {
70
+ i += 1;
71
+ continue;
72
+ }
73
+ if (text[i] === "}") {
74
+ i += 1;
75
+ return;
76
+ }
77
+ fail();
78
+ }
79
+ } else if (char === "[") {
80
+ i += 1;
81
+ whitespace();
82
+ if (text[i] === "]") {
83
+ i += 1;
84
+ return;
85
+ }
86
+ for (;;) {
87
+ value();
88
+ whitespace();
89
+ if (text[i] === ",") {
90
+ i += 1;
91
+ continue;
92
+ }
93
+ if (text[i] === "]") {
94
+ i += 1;
95
+ return;
96
+ }
97
+ fail();
98
+ }
99
+ } else if (char === "\"") string();
100
+ else if (char === "-" || char >= "0" && char <= "9") {
101
+ JSON_NUMBER.lastIndex = i;
102
+ const number = JSON_NUMBER.exec(text);
103
+ if (!number) fail();
104
+ i += number[0].length;
105
+ } else if (text.startsWith("true", i)) i += 4;
106
+ else if (text.startsWith("false", i)) i += 5;
107
+ else if (text.startsWith("null", i)) i += 4;
108
+ else fail();
109
+ };
110
+ try {
111
+ value();
112
+ whitespace();
113
+ if (i < text.length) fail();
114
+ return null;
115
+ } catch (error) {
116
+ return error instanceof JsonOffsetError ? error.offset : null;
117
+ }
118
+ };
119
+ var JsonOffsetError = class extends Error {
120
+ offset;
121
+ constructor(offset) {
122
+ super("Invalid JSON");
123
+ this.offset = offset;
124
+ }
125
+ };
126
+ /** The engine's message plus the line and column of the first error ("... (line 4,500, column 3)"). */
127
+ const describeJsonError = (text, message) => {
128
+ const offset = findJsonErrorOffset(text);
129
+ if (offset === null) return message;
130
+ const before = text.slice(0, offset);
131
+ const line = before.split("\n").length;
132
+ const column = offset - before.lastIndexOf("\n");
133
+ return `${message} (line ${line.toLocaleString("en-US")}, column ${column})`;
134
+ };
135
+
136
+ //#endregion
137
+ //#region src/components/json-input.tsx
138
+ const AceEditor = react.lazy(async () => {
139
+ const ace = await import("react-ace");
140
+ await import("ace-builds/src-noconflict/mode-json");
141
+ await import("ace-builds/src-noconflict/theme-textmate");
142
+ await import("ace-builds/src-noconflict/theme-cloud9_night");
143
+ return ace;
144
+ });
145
+ const EditorLoading = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
146
+ className: "flex h-32 items-center justify-center",
147
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "h-6 w-6 animate-spin" })
148
+ });
149
+ const displayJsonState = (jsonState) => {
150
+ return {
151
+ loading: {
152
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "text-muted-foreground size-[18px] animate-spin" }),
153
+ text: "Checking JSON Format...",
154
+ className: "text-muted-foreground"
155
+ },
156
+ success: {
157
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckCircle2, { className: "size-[18px] text-green-600" }),
158
+ text: "Valid JSON Format",
159
+ className: "text-foreground"
160
+ },
161
+ error: {
162
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleAlert, { className: "text-destructive size-[18px]" }),
163
+ text: jsonState.errMsg || "Invalid JSON Format",
164
+ className: "text-destructive"
165
+ },
166
+ empty: {}
167
+ }[jsonState.state];
168
+ };
169
+ const LINE_HEIGHT = 19;
170
+ const viewportListeners = /* @__PURE__ */ new Set();
171
+ const notifyViewport = () => viewportListeners.forEach((notify) => notify());
172
+ /** One resize listener serves every editor on the page; it is added with the first and removed with the last. */
173
+ function subscribeToViewport(listener) {
174
+ viewportListeners.add(listener);
175
+ if (viewportListeners.size === 1) window.addEventListener("resize", notifyViewport);
176
+ return () => {
177
+ viewportListeners.delete(listener);
178
+ if (viewportListeners.size === 0) window.removeEventListener("resize", notifyViewport);
179
+ };
180
+ }
181
+ /** The number of editor lines that fit in 40% of the viewport (client-side; a fixed fallback during SSR). */
182
+ function useViewportLines() {
183
+ return (0, react.useSyncExternalStore)(subscribeToViewport, () => Math.max(1, Math.floor(window.innerHeight * .4 / LINE_HEIGHT)), () => 24);
184
+ }
185
+ const JsonInput = ({ value = "", setValue, minLines = 16, maxLines, className, theme: themeProp }) => {
186
+ const [jsonState, setJsonState] = (0, react.useState)({ state: "empty" });
187
+ const viewportLines = useViewportLines();
188
+ const pageTheme = require_use_document_theme.useDocumentTheme(themeProp === void 0);
189
+ const theme = themeProp ?? pageTheme;
190
+ const handleChange = (val) => {
191
+ setJsonState({ state: "loading" });
192
+ setValue(val);
193
+ };
194
+ (0, react.useEffect)(() => {
195
+ const timeoutId = setTimeout(() => {
196
+ const error = validateJson(value);
197
+ if (value.trim().length === 0) setJsonState({ state: "empty" });
198
+ else if (error) setJsonState({
199
+ state: "error",
200
+ errMsg: describeJsonError(value, error)
201
+ });
202
+ else setJsonState({ state: "success" });
203
+ }, 400);
204
+ return () => clearTimeout(timeoutId);
205
+ }, [value]);
206
+ const { icon, text, className: textClassName } = displayJsonState(jsonState);
207
+ const isValidJson = validateJson(value) === null;
208
+ const cap = Math.max(minLines, maxLines ?? viewportLines);
209
+ const lines = (0, react.useMemo)(() => {
210
+ return Math.min(Math.max(countJsonLines(value), minLines), cap);
211
+ }, [
212
+ value,
213
+ minLines,
214
+ cap
215
+ ]);
216
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
217
+ className: require_utils.cn("border-border relative overflow-y-auto rounded-md border p-2.5 pr-12", className),
218
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(JsonEditor, {
219
+ value,
220
+ setValue: handleChange,
221
+ lines,
222
+ theme
223
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_tooltip.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipTrigger, {
224
+ asChild: true,
225
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
226
+ className: "absolute top-2 right-2 size-8 rounded-md",
227
+ size: "icon",
228
+ variant: "outline",
229
+ type: "button",
230
+ disabled: !isValidJson,
231
+ onClick: () => setValue(prettifyJson(value)),
232
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.WandSparkles, { className: "text-muted-foreground size-4" })
233
+ })
234
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipContent, { children: "Format JSON" })] }) })]
235
+ }), jsonState.state !== "empty" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
236
+ className: "mt-2 flex items-center gap-2",
237
+ children: [icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
238
+ className: require_utils.cn("text-sm", textClassName),
239
+ children: text
240
+ })]
241
+ })] });
242
+ };
243
+ const JsonEditor = ({ value, setValue, lines, readOnly = false, isValid = true, enableFolding = false, theme: themeProp }) => {
244
+ const pageTheme = require_use_document_theme.useDocumentTheme(themeProp === void 0);
245
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
246
+ fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorLoading, {}),
247
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AceEditor, {
248
+ mode: "json",
249
+ theme: (themeProp ?? pageTheme) === "light" ? "textmate" : "cloud9_night",
250
+ fontSize: "14px",
251
+ readOnly,
252
+ style: {
253
+ width: "100%",
254
+ background: "transparent",
255
+ offset: 0
256
+ },
257
+ setOptions: {
258
+ useWorker: false,
259
+ printMargin: false,
260
+ showFoldWidgets: enableFolding,
261
+ foldStyle: "markbegin"
262
+ },
263
+ tabSize: 2,
264
+ wrapEnabled: readOnly && !isValid,
265
+ showGutter: enableFolding,
266
+ minLines: lines,
267
+ maxLines: lines,
268
+ highlightActiveLine: !readOnly,
269
+ value,
270
+ onChange: setValue
271
+ })
272
+ });
273
+ };
274
+ const validateJson = (text) => {
275
+ try {
276
+ if (text.trim().length === 0) throw new SyntaxError(`Can't use empty string`);
277
+ JSON.parse(text);
278
+ return null;
279
+ } catch (error) {
280
+ return error.message;
281
+ }
282
+ };
283
+ const prettifyJson = (text) => {
284
+ try {
285
+ return JSON.stringify(JSON.parse(text), null, 2);
286
+ } catch {
287
+ return text;
288
+ }
289
+ };
290
+ const countJsonLines = (text) => text.split(/\n/).length;
291
+
292
+ //#endregion
293
+ Object.defineProperty(exports, 'JsonEditor', {
294
+ enumerable: true,
295
+ get: function () {
296
+ return JsonEditor;
297
+ }
298
+ });
299
+ Object.defineProperty(exports, 'JsonInput', {
300
+ enumerable: true,
301
+ get: function () {
302
+ return JsonInput;
303
+ }
304
+ });
305
+ Object.defineProperty(exports, 'validateJson', {
306
+ enumerable: true,
307
+ get: function () {
308
+ return validateJson;
309
+ }
310
+ });
311
+ //# sourceMappingURL=json-input-D8yM578l.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-input-D8yM578l.cjs","names":["React","Loader2","CheckCircle2","CircleAlert","useDocumentTheme","cn","TooltipProvider","Tooltip","TooltipTrigger","Button","WandSparkles","TooltipContent","Suspense"],"sources":["../src/lib/json-error-position.ts","../src/components/json-input.tsx"],"sourcesContent":["/**\n * Where a JSON text first stops being valid, for an error message a person can act on. Engines word syntax errors\n * differently and often leave out the position (Safari always does), which makes a mistake on line 4,500 hard to find,\n * so the position is found by a small scan of the grammar instead of being read from the engine's message.\n */\n\n// Sticky, so they match at `lastIndex` itself: a number of any length is read whole and nothing is sliced out of the text.\nconst JSON_NUMBER = /-?(0|[1-9]\\d*)(\\.\\d+)?([eE][+-]?\\d+)?/y;\nconst JSON_HEX_ESCAPE = /[0-9a-fA-F]{4}/y;\n\n/** Where `text` first stops being valid JSON, as a 0-based character offset (null when it parses). */\nexport const findJsonErrorOffset = (text: string): number | null => {\n\tlet i = 0;\n\tconst fail = (at = i): never => {\n\t\tthrow new JsonOffsetError(at);\n\t};\n\tconst whitespace = () => {\n\t\twhile (i < text.length && ' \\n\\r\\t'.includes(text[i])) i += 1;\n\t};\n\tconst string = () => {\n\t\ti += 1;\n\t\twhile (i < text.length) {\n\t\t\tconst char = text[i];\n\t\t\tif (char === '\"') {\n\t\t\t\ti += 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (char === '\\\\') {\n\t\t\t\tconst escape = text[i + 1];\n\t\t\t\tif (escape === 'u') {\n\t\t\t\t\tJSON_HEX_ESCAPE.lastIndex = i + 2;\n\t\t\t\t\tif (!JSON_HEX_ESCAPE.test(text)) fail(i);\n\t\t\t\t\ti += 6;\n\t\t\t\t} else if (escape !== undefined && '\"\\\\/bfnrt'.includes(escape)) i += 2;\n\t\t\t\telse fail(i + 1);\n\t\t\t} else if (char < ' ') fail(i);\n\t\t\telse i += 1;\n\t\t}\n\t\tfail(text.length);\n\t};\n\tconst value = (): void => {\n\t\twhitespace();\n\t\tconst char = text[i];\n\t\tif (char === '{') {\n\t\t\ti += 1;\n\t\t\twhitespace();\n\t\t\tif (text[i] === '}') {\n\t\t\t\ti += 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (;;) {\n\t\t\t\twhitespace();\n\t\t\t\tif (text[i] !== '\"') fail();\n\t\t\t\tstring();\n\t\t\t\twhitespace();\n\t\t\t\tif (text[i] !== ':') fail();\n\t\t\t\ti += 1;\n\t\t\t\tvalue();\n\t\t\t\twhitespace();\n\t\t\t\tif (text[i] === ',') {\n\t\t\t\t\ti += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (text[i] === '}') {\n\t\t\t\t\ti += 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfail();\n\t\t\t}\n\t\t} else if (char === '[') {\n\t\t\ti += 1;\n\t\t\twhitespace();\n\t\t\tif (text[i] === ']') {\n\t\t\t\ti += 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (;;) {\n\t\t\t\tvalue();\n\t\t\t\twhitespace();\n\t\t\t\tif (text[i] === ',') {\n\t\t\t\t\ti += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (text[i] === ']') {\n\t\t\t\t\ti += 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfail();\n\t\t\t}\n\t\t} else if (char === '\"') string();\n\t\telse if (char === '-' || (char >= '0' && char <= '9')) {\n\t\t\tJSON_NUMBER.lastIndex = i;\n\t\t\tconst number = JSON_NUMBER.exec(text);\n\t\t\tif (!number) fail();\n\t\t\ti += number![0].length;\n\t\t} else if (text.startsWith('true', i)) i += 4;\n\t\telse if (text.startsWith('false', i)) i += 5;\n\t\telse if (text.startsWith('null', i)) i += 4;\n\t\telse fail();\n\t};\n\n\ttry {\n\t\tvalue();\n\t\twhitespace();\n\t\tif (i < text.length) fail();\n\t\treturn null;\n\t} catch (error) {\n\t\treturn error instanceof JsonOffsetError ? error.offset : null;\n\t}\n};\n\nclass JsonOffsetError extends Error {\n\tconstructor(readonly offset: number) {\n\t\tsuper('Invalid JSON');\n\t}\n}\n\n/** The engine's message plus the line and column of the first error (\"... (line 4,500, column 3)\"). */\nexport const describeJsonError = (text: string, message: string) => {\n\tconst offset = findJsonErrorOffset(text);\n\tif (offset === null) return message;\n\tconst before = text.slice(0, offset);\n\tconst line = before.split('\\n').length;\n\tconst column = offset - before.lastIndexOf('\\n');\n\treturn `${message} (line ${line.toLocaleString('en-US')}, column ${column})`;\n};\n","'use client';\n\nimport * as React from 'react';\nimport { useEffect, useMemo, useState, useSyncExternalStore, Suspense } from 'react';\nimport { CheckCircle2, CircleAlert, Loader2, WandSparkles } from 'lucide-react';\nimport type { IAceEditorProps } from 'react-ace';\n\nimport { describeJsonError } from '../lib/json-error-position';\nimport { useDocumentTheme } from '../lib/use-document-theme';\nimport { cn } from '../lib/utils';\n\nimport { Button } from './button';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip';\n\n// Lazy load AceEditor\nconst AceEditor = React.lazy(async () => {\n\tconst ace = await import('react-ace');\n\tawait import('ace-builds/src-noconflict/mode-json');\n\tawait import('ace-builds/src-noconflict/theme-textmate');\n\tawait import('ace-builds/src-noconflict/theme-cloud9_night');\n\treturn ace;\n});\n\nconst EditorLoading = () => (\n\t<div className=\"flex h-32 items-center justify-center\">\n\t\t<Loader2 className=\"h-6 w-6 animate-spin\" />\n\t</div>\n);\n\ntype JsonDisplay = {\n\ticon?: React.ReactNode;\n\ttext?: string;\n\tclassName?: string;\n};\n\ninterface JsonState {\n\tstate: 'empty' | 'loading' | 'success' | 'error';\n\terrMsg?: string;\n}\n\nconst displayJsonState = (jsonState: JsonState) => {\n\tconst jsonStateMap: Record<JsonState['state'], JsonDisplay> = {\n\t\tloading: {\n\t\t\ticon: <Loader2 className=\"text-muted-foreground size-[18px] animate-spin\" />,\n\t\t\ttext: 'Checking JSON Format...',\n\t\t\tclassName: 'text-muted-foreground',\n\t\t},\n\n\t\tsuccess: {\n\t\t\ticon: <CheckCircle2 className=\"size-[18px] text-green-600\" />,\n\t\t\ttext: 'Valid JSON Format',\n\t\t\tclassName: 'text-foreground',\n\t\t},\n\n\t\terror: {\n\t\t\ticon: <CircleAlert className=\"text-destructive size-[18px]\" />,\n\t\t\ttext: jsonState.errMsg || 'Invalid JSON Format',\n\t\t\tclassName: 'text-destructive',\n\t\t},\n\n\t\tempty: {},\n\t};\n\n\treturn jsonStateMap[jsonState.state];\n};\n\ntype JsonInputProps = {\n\tvalue: string;\n\tsetValue: (value: string) => void;\n\tminLines?: number;\n\t/** Tallest the editor grows, in lines; longer documents scroll inside it. Defaults to what fits in 40% of the viewport. */\n\tmaxLines?: number;\n\tclassName?: string;\n\t/** Theme for the editor: 'light' or 'dark'. Defaults to the document's theme (the `dark` class on `<html>`). */\n\ttheme?: 'light' | 'dark';\n};\n\n// Ace draws a 14px line about 19px tall.\nconst LINE_HEIGHT = 19;\n\nconst viewportListeners = new Set<() => void>();\nconst notifyViewport = () => viewportListeners.forEach((notify) => notify());\n\n/** One resize listener serves every editor on the page; it is added with the first and removed with the last. */\nfunction subscribeToViewport(listener: () => void) {\n\tviewportListeners.add(listener);\n\tif (viewportListeners.size === 1) window.addEventListener('resize', notifyViewport);\n\treturn () => {\n\t\tviewportListeners.delete(listener);\n\t\tif (viewportListeners.size === 0) window.removeEventListener('resize', notifyViewport);\n\t};\n}\n\n/** The number of editor lines that fit in 40% of the viewport (client-side; a fixed fallback during SSR). */\nfunction useViewportLines() {\n\treturn useSyncExternalStore(\n\t\tsubscribeToViewport,\n\t\t() => Math.max(1, Math.floor((window.innerHeight * 0.4) / LINE_HEIGHT)),\n\t\t() => 24,\n\t);\n}\n\nexport const JsonInput = ({ value = '', setValue, minLines = 16, maxLines, className, theme: themeProp }: JsonInputProps) => {\n\tconst [jsonState, setJsonState] = useState<JsonState>({ state: 'empty' });\n\tconst viewportLines = useViewportLines();\n\tconst pageTheme = useDocumentTheme(themeProp === undefined);\n\tconst theme = themeProp ?? pageTheme;\n\n\tconst handleChange = (val: string) => {\n\t\tsetJsonState({ state: 'loading' });\n\t\tsetValue(val);\n\t};\n\n\tuseEffect(() => {\n\t\tconst timeoutId = setTimeout(() => {\n\t\t\tconst error = validateJson(value);\n\n\t\t\tif (value.trim().length === 0) setJsonState({ state: 'empty' });\n\t\t\telse if (error) setJsonState({ state: 'error', errMsg: describeJsonError(value, error) });\n\t\t\telse setJsonState({ state: 'success' });\n\t\t}, 400);\n\n\t\treturn () => clearTimeout(timeoutId);\n\t}, [value]);\n\n\tconst { icon, text, className: textClassName } = displayJsonState(jsonState);\n\tconst isValidJson = validateJson(value) === null;\n\n\tconst cap = Math.max(minLines, maxLines ?? viewportLines);\n\tconst lines = useMemo(() => {\n\t\treturn Math.min(Math.max(countJsonLines(value), minLines), cap);\n\t}, [value, minLines, cap]);\n\n\treturn (\n\t\t<div>\n\t\t\t{/* The code is always left to right, so the format button stays on the right and the editor leaves it room. */}\n\t\t\t<div className={cn('border-border relative overflow-y-auto rounded-md border p-2.5 pr-12', className)}>\n\t\t\t\t<JsonEditor value={value} setValue={handleChange} lines={lines} theme={theme} />\n\t\t\t\t<TooltipProvider>\n\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"absolute top-2 right-2 size-8 rounded-md\"\n\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tdisabled={!isValidJson}\n\t\t\t\t\t\t\t\tonClick={() => setValue(prettifyJson(value))}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<WandSparkles className=\"text-muted-foreground size-4\" />\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t<TooltipContent>Format JSON</TooltipContent>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t</TooltipProvider>\n\t\t\t</div>\n\t\t\t{jsonState.state !== 'empty' && (\n\t\t\t\t<div className=\"mt-2 flex items-center gap-2\">\n\t\t\t\t\t{icon}\n\t\t\t\t\t<span className={cn('text-sm', textClassName)}>{text}</span>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\ntype JsonEditorProps = {\n\tvalue: string;\n\tlines: number;\n\tsetValue?: (value: string) => void;\n\treadOnly?: boolean;\n\tisValid?: boolean;\n\tenableFolding?: boolean;\n\t/** Theme for the editor: 'light' or 'dark'. Defaults to the document's theme (the `dark` class on `<html>`). */\n\ttheme?: 'light' | 'dark';\n};\n\nexport const JsonEditor = ({\n\tvalue,\n\tsetValue,\n\tlines,\n\treadOnly = false,\n\tisValid = true,\n\tenableFolding = false,\n\ttheme: themeProp,\n}: JsonEditorProps) => {\n\tconst pageTheme = useDocumentTheme(themeProp === undefined);\n\tconst theme = themeProp ?? pageTheme;\n\tconst editorProps: IAceEditorProps = {\n\t\tmode: 'json',\n\t\ttheme: theme === 'light' ? 'textmate' : 'cloud9_night',\n\t\tfontSize: '14px',\n\t\treadOnly,\n\t\tstyle: {\n\t\t\twidth: '100%',\n\t\t\tbackground: 'transparent',\n\t\t\toffset: 0,\n\t\t},\n\t\tsetOptions: {\n\t\t\tuseWorker: false,\n\t\t\tprintMargin: false,\n\t\t\tshowFoldWidgets: enableFolding,\n\t\t\tfoldStyle: 'markbegin',\n\t\t},\n\t\ttabSize: 2,\n\t\twrapEnabled: readOnly && !isValid,\n\t\tshowGutter: enableFolding,\n\t\tminLines: lines,\n\t\tmaxLines: lines,\n\t\thighlightActiveLine: !readOnly,\n\t\tvalue,\n\t\tonChange: setValue,\n\t};\n\n\treturn (\n\t\t<Suspense fallback={<EditorLoading />}>\n\t\t\t<AceEditor {...editorProps} />\n\t\t</Suspense>\n\t);\n};\n\nexport const validateJson = (text: string) => {\n\ttry {\n\t\tif (text.trim().length === 0) throw new SyntaxError(`Can't use empty string`);\n\t\tJSON.parse(text);\n\t\treturn null;\n\t} catch (error) {\n\t\treturn (error as SyntaxError).message;\n\t}\n};\n\nconst prettifyJson = (text: string) => {\n\ttry {\n\t\treturn JSON.stringify(JSON.parse(text), null, 2);\n\t} catch {\n\t\treturn text;\n\t}\n};\n\nconst countJsonLines = (text: string) => text.split(/\\n/).length;\n"],"mappings":";;;;;;;;;;;;;;;;;AAOA,MAAM,cAAc;AACpB,MAAM,kBAAkB;;AAGxB,MAAa,uBAAuB,SAAgC;CACnE,IAAI,IAAI;CACR,MAAM,QAAQ,KAAK,MAAa;EAC/B,MAAM,IAAI,gBAAgB,EAAE;CAC7B;CACA,MAAM,mBAAmB;EACxB,OAAO,IAAI,KAAK,UAAU,SAAU,SAAS,KAAK,EAAE,GAAG,KAAK;CAC7D;CACA,MAAM,eAAe;EACpB,KAAK;EACL,OAAO,IAAI,KAAK,QAAQ;GACvB,MAAM,OAAO,KAAK;GAClB,IAAI,SAAS,MAAK;IACjB,KAAK;IACL;GACD;GACA,IAAI,SAAS,MAAM;IAClB,MAAM,SAAS,KAAK,IAAI;IACxB,IAAI,WAAW,KAAK;KACnB,gBAAgB,YAAY,IAAI;KAChC,IAAI,CAAC,gBAAgB,KAAK,IAAI,GAAG,KAAK,CAAC;KACvC,KAAK;IACN,OAAO,IAAI,WAAW,UAAa,aAAY,SAAS,MAAM,GAAG,KAAK;SACjE,KAAK,IAAI,CAAC;GAChB,OAAO,IAAI,OAAO,KAAK,KAAK,CAAC;QACxB,KAAK;EACX;EACA,KAAK,KAAK,MAAM;CACjB;CACA,MAAM,cAAoB;EACzB,WAAW;EACX,MAAM,OA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AAC;CAChD,QAAQ;EACP,OAAO;CACR;AACD;AAEA,MAAM,kBAAkB,SAAiB,KAAK,MAAM,IAAI,CAAC,CAAC"}
@@ -11,7 +11,24 @@
11
11
  * 3. Use custom easing curves for more impactful animations
12
12
  * 4. Make animations origin-aware when possible
13
13
  * 5. Use blur to smooth transitions when needed
14
+ * 6. Exits run one tier faster than enters — dismissal should feel instant
14
15
  */
16
+ /** duration+bounce tier → a motion spring transition. Reads the tuning store so Storybook dials retune live. */
17
+ function tierSpring(tier) {
18
+ return {
19
+ type: "spring",
20
+ visualDuration: tier.duration,
21
+ bounce: tier.bounce
22
+ };
23
+ }
24
+ /** Crisp exit tween for the same tier — always faster than the enter spring. */
25
+ function tierExit(tier) {
26
+ return {
27
+ type: "tween",
28
+ duration: tier.exitDuration,
29
+ ease: easings.physicalExit
30
+ };
31
+ }
15
32
  /**
16
33
  * Standard easing curves for UI animations.
17
34
  * Reference: https://easings.co/
@@ -85,7 +102,8 @@ const durations = {
85
102
  };
86
103
  /**
87
104
  * Spring configurations for physics-based animations.
88
- * These create more natural, organic motion.
105
+ * Prefer `tierSpring`/`tierExit` for new code — these stiffness/damping presets remain for
106
+ * consumers that need mass/spring-physics control (e.g. dock magnification).
89
107
  */
90
108
  const springs = {
91
109
  /** Snappy spring - good for quick interactions */
@@ -256,6 +274,18 @@ Object.defineProperty(exports, 'springs', {
256
274
  return springs;
257
275
  }
258
276
  });
277
+ Object.defineProperty(exports, 'tierExit', {
278
+ enumerable: true,
279
+ get: function () {
280
+ return tierExit;
281
+ }
282
+ });
283
+ Object.defineProperty(exports, 'tierSpring', {
284
+ enumerable: true,
285
+ get: function () {
286
+ return tierSpring;
287
+ }
288
+ });
259
289
  Object.defineProperty(exports, 'transitions', {
260
290
  enumerable: true,
261
291
  get: function () {
@@ -268,4 +298,4 @@ Object.defineProperty(exports, 'variants', {
268
298
  return variants;
269
299
  }
270
300
  });
271
- //# sourceMappingURL=motion-config-COCFHq1L.cjs.map
301
+ //# sourceMappingURL=motion-config-DZ7w5Uhq.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion-config-DZ7w5Uhq.cjs","names":[],"sources":["../src/lib/motion/motion-config.ts"],"sourcesContent":["import type { Transition } from 'motion/react';\n\nimport type { SpringTier } from './tuning';\n\n/**\n * Shared motion configuration for consistent animations across the app.\n * Based on practical animation tips from https://emilkowal.ski/ui/7-practical-animation-tips\n *\n * Key principles:\n * 1. Keep UI animations under 300ms\n * 2. Never animate from scale(0) - use 0.9+ for natural feel\n * 3. Use custom easing curves for more impactful animations\n * 4. Make animations origin-aware when possible\n * 5. Use blur to smooth transitions when needed\n * 6. Exits run one tier faster than enters — dismissal should feel instant\n */\n\n// =============================================================================\n// Spring Tiers (tunable via the DialKit panel in Storybook)\n// =============================================================================\n\n/** duration+bounce tier → a motion spring transition. Reads the tuning store so Storybook dials retune live. */\nexport function tierSpring(tier: SpringTier): Transition {\n\treturn { type: 'spring', visualDuration: tier.duration, bounce: tier.bounce };\n}\n\n/** Crisp exit tween for the same tier — always faster than the enter spring. */\nexport function tierExit(tier: SpringTier): Transition {\n\treturn { type: 'tween', duration: tier.exitDuration, ease: easings.physicalExit };\n}\n\n// =============================================================================\n// Easing Curves\n// =============================================================================\n\n/**\n * Standard easing curves for UI animations.\n * Reference: https://easings.co/\n */\nexport const easings = {\n\t/** Smooth deceleration - good for elements entering the screen */\n\teaseOut: [0.25, 0.1, 0.25, 1] as const,\n\n\t/** Smooth acceleration - good for elements leaving the screen */\n\teaseIn: [0.42, 0, 1, 1] as const,\n\n\t/** Smooth both ways - good for hover states and toggles */\n\teaseInOut: [0.42, 0, 0.58, 1] as const,\n\n\t/** Snappy entrance with soft landing - great for modals/dialogs */\n\tsnappy: [0.2, 0, 0, 1] as const,\n\n\t/** Bouncy feel - use sparingly for playful interactions */\n\tbounce: [0.34, 1.56, 0.64, 1] as const,\n\n\t/** Quick start, gradual stop - good for quick feedback */\n\temphasized: [0.4, 0, 0.2, 1] as const,\n\n\t/** Physical feel for exit animations */\n\tphysicalExit: [0.4, 0, 0.6, 1] as const,\n} as const;\n\n// =============================================================================\n// Duration Presets\n// =============================================================================\n\n/**\n * Duration presets in seconds.\n * Rule: UI animations should be under 300ms (0.3s)\n */\nexport const durations = {\n\t/** Instant feedback (button press, toggle) */\n\tinstant: 0.1,\n\n\t/** Quick transitions (tooltips, small elements) */\n\tfast: 0.15,\n\n\t/** Standard UI transitions (modals, panels) */\n\tnormal: 0.2,\n\n\t/** Deliberate animations (page transitions, complex reveals) */\n\tslow: 0.3,\n\n\t/** Maximum for UI - use rarely */\n\tdeliberate: 0.4,\n} as const;\n\n// =============================================================================\n// Spring Presets (stiffness/damping form)\n// =============================================================================\n\n/**\n * Spring configurations for physics-based animations.\n * Prefer `tierSpring`/`tierExit` for new code — these stiffness/damping presets remain for\n * consumers that need mass/spring-physics control (e.g. dock magnification).\n */\nexport const springs = {\n\t/** Snappy spring - good for quick interactions */\n\tsnappy: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 400,\n\t\tdamping: 30,\n\t\tmass: 0.8,\n\t},\n\n\t/** Bouncy spring - good for playful elements */\n\tbouncy: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 300,\n\t\tdamping: 20,\n\t\tmass: 0.6,\n\t},\n\n\t/** Gentle spring - good for large elements */\n\tgentle: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 150,\n\t\tdamping: 25,\n\t\tmass: 1,\n\t},\n\n\t/** Stiff spring - good for precise movements */\n\tstiff: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 500,\n\t\tdamping: 35,\n\t\tmass: 0.5,\n\t},\n\n\t/** Panel/sheet animations */\n\tpanel: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 150,\n\t\tdamping: 25,\n\t},\n} as const;\n\n// =============================================================================\n// Transition Presets\n// =============================================================================\n\n/**\n * Pre-configured transitions for common animation patterns.\n */\nexport const transitions = {\n\t/** Fast fade for overlays and simple elements */\n\tfade: {\n\t\tduration: durations.fast,\n\t\tease: easings.easeOut,\n\t} satisfies Transition,\n\n\t/** Standard enter/exit for UI elements */\n\tenterExit: {\n\t\tduration: durations.normal,\n\t\tease: easings.easeOut,\n\t} satisfies Transition,\n\n\t/** Snappy transition for interactive elements */\n\tsnappy: {\n\t\tduration: durations.fast,\n\t\tease: easings.snappy,\n\t} satisfies Transition,\n\n\t/** Panel slide transition */\n\tpanel: {\n\t\ttype: 'spring',\n\t\tstiffness: 150,\n\t\tdamping: 25,\n\t} satisfies Transition,\n\n\t/** Exit transition with physical feel */\n\texit: {\n\t\ttype: 'tween',\n\t\tduration: durations.normal,\n\t\tease: easings.physicalExit,\n\t} satisfies Transition,\n\n\t/** Layout animations */\n\tlayout: {\n\t\ttype: 'spring',\n\t\tstiffness: 300,\n\t\tdamping: 30,\n\t} satisfies Transition,\n} as const;\n\n// =============================================================================\n// Animation Variants\n// =============================================================================\n\n/**\n * Common animation variants for AnimatePresence patterns.\n * Follows the rule: never animate from scale(0), use 0.9+ instead.\n */\nexport const variants = {\n\t/** Fade with subtle scale - good for modals, cards */\n\tfadeScale: {\n\t\tinitial: { opacity: 0, scale: 0.95 },\n\t\tanimate: { opacity: 1, scale: 1 },\n\t\texit: { opacity: 0, scale: 0.95 },\n\t},\n\n\t/** Fade with subtle slide up - good for content reveals */\n\tfadeSlideUp: {\n\t\tinitial: { opacity: 0, y: 8 },\n\t\tanimate: { opacity: 1, y: 0 },\n\t\texit: { opacity: 0, y: -8 },\n\t},\n\n\t/** Fade with subtle slide down - good for dropdowns */\n\tfadeSlideDown: {\n\t\tinitial: { opacity: 0, y: -8 },\n\t\tanimate: { opacity: 1, y: 0 },\n\t\texit: { opacity: 0, y: 8 },\n\t},\n\n\t/** Simple fade - for overlays */\n\tfade: {\n\t\tinitial: { opacity: 0 },\n\t\tanimate: { opacity: 1 },\n\t\texit: { opacity: 0 },\n\t},\n\n\t/** Dock/floating element - scales from bottom */\n\tfloatUp: {\n\t\tinitial: { opacity: 0, y: 8, scale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AGA,QAAQ;EACP,UAAU,UAAU;EACpB,MAAM,QAAQ;CACf;;CAGA,OAAO;EACN,MAAM;EACN,WAAW;EACX,SAAS;CACV;;CAGA,MAAM;EACL,MAAM;EACN,UAAU,UAAU;EACpB,MAAM,QAAQ;CACf;;CAGA,QAAQ;EACP,MAAM;EACN,WAAW;EACX,SAAS;CACV;AACD;;;;;AAUA,MAAa,WAAW;;CAEvB,WAAW;EACV,SAAS;GAAE,SAAS;GAAG,OAAO;EAAK;EACnC,SAAS;GAAE,SAAS;GAAG,OAAO;EAAE;EAChC,MAAM;GAAE,SAAS;GAAG,OAAO;EAAK;CACjC;;CAGA,aAAa;EACZ,SAAS;GAAE,SAAS;GAAG,GAAG;EAAE;EAC5B,SAAS;GAAE,SAAS;GAAG,GAAG;EAAE;EAC5B,MAAM;GAAE,SAAS;GAAG,GAAG;EAAG;CAC3B;;CAGA,eAAe;EACd,SAAS;GAAE,SAAS;GAAG,GAAG;EAAG;EAC7B,SAAS;GAAE,SAAS;GAAG,GAAG;EAAE;EAC5B,MAAM;GAAE,SAAS;GAAG,GAAG;EAAE;CAC1B;;CAGA,MAAM;EACL,SAAS,EAAE,SAAS,EAAE;EACtB,SAAS,EAAE,SAAS,EAAE;EACtB,MAAM,EAAE,SAAS,EAAE;CACpB;;CAGA,SAAS;EACR,SAAS;GAAE,SAAS;GAAG,GAAG;GAAG,OAAO;EAAK;EACzC,SAAS;GAAE,SAAS;GAAG,GAAG;GAAG,OAAO;EAAE;EACtC,MAAM;GAAE,SAAS;GAAG,GAAG;GAAG,OAAO;EAAK;CACvC;AACD"}
@@ -10,7 +10,24 @@
10
10
  * 3. Use custom easing curves for more impactful animations
11
11
  * 4. Make animations origin-aware when possible
12
12
  * 5. Use blur to smooth transitions when needed
13
+ * 6. Exits run one tier faster than enters — dismissal should feel instant
13
14
  */
15
+ /** duration+bounce tier → a motion spring transition. Reads the tuning store so Storybook dials retune live. */
16
+ function tierSpring(tier) {
17
+ return {
18
+ type: "spring",
19
+ visualDuration: tier.duration,
20
+ bounce: tier.bounce
21
+ };
22
+ }
23
+ /** Crisp exit tween for the same tier — always faster than the enter spring. */
24
+ function tierExit(tier) {
25
+ return {
26
+ type: "tween",
27
+ duration: tier.exitDuration,
28
+ ease: easings.physicalExit
29
+ };
30
+ }
14
31
  /**
15
32
  * Standard easing curves for UI animations.
16
33
  * Reference: https://easings.co/
@@ -84,7 +101,8 @@ const durations = {
84
101
  };
85
102
  /**
86
103
  * Spring configurations for physics-based animations.
87
- * These create more natural, organic motion.
104
+ * Prefer `tierSpring`/`tierExit` for new code — these stiffness/damping presets remain for
105
+ * consumers that need mass/spring-physics control (e.g. dock magnification).
88
106
  */
89
107
  const springs = {
90
108
  /** Snappy spring - good for quick interactions */
@@ -237,5 +255,5 @@ const variants = {
237
255
  };
238
256
 
239
257
  //#endregion
240
- export { variants as a, transitions as i, easings as n, springs as r, durations as t };
241
- //# sourceMappingURL=motion-config-COsZ6azM.js.map
258
+ export { tierSpring as a, tierExit as i, easings as n, transitions as o, springs as r, variants as s, durations as t };
259
+ //# sourceMappingURL=motion-config-DoFp4I8f.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion-config-DoFp4I8f.js","names":[],"sources":["../src/lib/motion/motion-config.ts"],"sourcesContent":["import type { Transition } from 'motion/react';\n\nimport type { SpringTier } from './tuning';\n\n/**\n * Shared motion configuration for consistent animations across the app.\n * Based on practical animation tips from https://emilkowal.ski/ui/7-practical-animation-tips\n *\n * Key principles:\n * 1. Keep UI animations under 300ms\n * 2. Never animate from scale(0) - use 0.9+ for natural feel\n * 3. Use custom easing curves for more impactful animations\n * 4. Make animations origin-aware when possible\n * 5. Use blur to smooth transitions when needed\n * 6. Exits run one tier faster than enters — dismissal should feel instant\n */\n\n// =============================================================================\n// Spring Tiers (tunable via the DialKit panel in Storybook)\n// =============================================================================\n\n/** duration+bounce tier → a motion spring transition. Reads the tuning store so Storybook dials retune live. */\nexport function tierSpring(tier: SpringTier): Transition {\n\treturn { type: 'spring', visualDuration: tier.duration, bounce: tier.bounce };\n}\n\n/** Crisp exit tween for the same tier — always faster than the enter spring. */\nexport function tierExit(tier: SpringTier): Transition {\n\treturn { type: 'tween', duration: tier.exitDuration, ease: easings.physicalExit };\n}\n\n// =============================================================================\n// Easing Curves\n// =============================================================================\n\n/**\n * Standard easing curves for UI animations.\n * Reference: https://easings.co/\n */\nexport const easings = {\n\t/** Smooth deceleration - good for elements entering the screen */\n\teaseOut: [0.25, 0.1, 0.25, 1] as const,\n\n\t/** Smooth acceleration - good for elements leaving the screen */\n\teaseIn: [0.42, 0, 1, 1] as const,\n\n\t/** Smooth both ways - good for hover states and toggles */\n\teaseInOut: [0.42, 0, 0.58, 1] as const,\n\n\t/** Snappy entrance with soft landing - great for modals/dialogs */\n\tsnappy: [0.2, 0, 0, 1] as const,\n\n\t/** Bouncy feel - use sparingly for playful interactions */\n\tbounce: [0.34, 1.56, 0.64, 1] as const,\n\n\t/** Quick start, gradual stop - good for quick feedback */\n\temphasized: [0.4, 0, 0.2, 1] as const,\n\n\t/** Physical feel for exit animations */\n\tphysicalExit: [0.4, 0, 0.6, 1] as const,\n} as const;\n\n// =============================================================================\n// Duration Presets\n// =============================================================================\n\n/**\n * Duration presets in seconds.\n * Rule: UI animations should be under 300ms (0.3s)\n */\nexport const durations = {\n\t/** Instant feedback (button press, toggle) */\n\tinstant: 0.1,\n\n\t/** Quick transitions (tooltips, small elements) */\n\tfast: 0.15,\n\n\t/** Standard UI transitions (modals, panels) */\n\tnormal: 0.2,\n\n\t/** Deliberate animations (page transitions, complex reveals) */\n\tslow: 0.3,\n\n\t/** Maximum for UI - use rarely */\n\tdeliberate: 0.4,\n} as const;\n\n// =============================================================================\n// Spring Presets (stiffness/damping form)\n// =============================================================================\n\n/**\n * Spring configurations for physics-based animations.\n * Prefer `tierSpring`/`tierExit` for new code — these stiffness/damping presets remain for\n * consumers that need mass/spring-physics control (e.g. dock magnification).\n */\nexport const springs = {\n\t/** Snappy spring - good for quick interactions */\n\tsnappy: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 400,\n\t\tdamping: 30,\n\t\tmass: 0.8,\n\t},\n\n\t/** Bouncy spring - good for playful elements */\n\tbouncy: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 300,\n\t\tdamping: 20,\n\t\tmass: 0.6,\n\t},\n\n\t/** Gentle spring - good for large elements */\n\tgentle: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 150,\n\t\tdamping: 25,\n\t\tmass: 1,\n\t},\n\n\t/** Stiff spring - good for precise movements */\n\tstiff: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 500,\n\t\tdamping: 35,\n\t\tmass: 0.5,\n\t},\n\n\t/** Panel/sheet animations */\n\tpanel: {\n\t\ttype: 'spring' as const,\n\t\tstiffness: 150,\n\t\tdamping: 25,\n\t},\n} as const;\n\n// =============================================================================\n// Transition Presets\n// =============================================================================\n\n/**\n * Pre-configured transitions for common animation patterns.\n */\nexport const transitions = {\n\t/** Fast fade for overlays and simple elements */\n\tfade: {\n\t\tduration: durations.fast,\n\t\tease: easings.easeOut,\n\t} satisfies Transition,\n\n\t/** Standard enter/exit for UI elements */\n\tenterExit: {\n\t\tduration: durations.normal,\n\t\tease: easings.easeOut,\n\t} satisfies Transition,\n\n\t/** Snappy transition for interactive elements */\n\tsnappy: {\n\t\tduration: durations.fast,\n\t\tease: easings.snappy,\n\t} satisfies Transition,\n\n\t/** Panel slide transition */\n\tpanel: {\n\t\ttype: 'spring',\n\t\tstiffness: 150,\n\t\tdamping: 25,\n\t} satisfies Transition,\n\n\t/** Exit transition with physical feel */\n\texit: {\n\t\ttype: 'tween',\n\t\tduration: durations.normal,\n\t\tease: easings.physicalExit,\n\t} satisfies Transition,\n\n\t/** Layout animations */\n\tlayout: {\n\t\ttype: 'spring',\n\t\tstiffness: 300,\n\t\tdamping: 30,\n\t} satisfies Transition,\n} as const;\n\n// =============================================================================\n// Animation Variants\n// =============================================================================\n\n/**\n * Common animation variants for AnimatePresence patterns.\n * Follows the rule: never animate from scale(0), use 0.9+ instead.\n */\nexport const variants = {\n\t/** Fade with subtle scale - good for modals, cards */\n\tfadeScale: {\n\t\tinitial: { opacity: 0, scale: 0.95 },\n\t\tanimate: { opacity: 1, scale: 1 },\n\t\texit: { opacity: 0, scale: 0.95 },\n\t},\n\n\t/** Fade with subtle slide up - good for content reveals */\n\tfadeSlideUp: {\n\t\tinitial: { opacity: 0, y: 8 },\n\t\tanimate: { opacity: 1, y: 0 },\n\t\texit: { opacity: 0, y: -8 },\n\t},\n\n\t/** Fade with subtle slide down - good for dropdowns */\n\tfadeSlideDown: {\n\t\tinitial: { opacity: 0, y: -8 },\n\t\tanimate: { opacity: 1, y: 0 },\n\t\texit: { opacity: 0, y: 8 },\n\t},\n\n\t/** Simple fade - for overlays */\n\tfade: {\n\t\tinitial: { opacity: 0 },\n\t\tanimate: { opacity: 1 },\n\t\texit: { opacity: 0 },\n\t},\n\n\t/** Dock/floating element - scales from bottom */\n\tfloatUp: {\n\t\tinitial: { opacity: 0, y: 8, scale: 0.98 },\n\t\tanimate: { opacity: 1, y: 0, scale: 1 },\n\t\texit: { opacity: 0, y: 8, scale: 0.98 },\n\t},\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,SAAgB,WAAW,MAA8B;CACxD,OAAO;EAAE,MAAM;EAAU,gBAAgB,KAAK;EAAU,QAAQ,KAAK;CAAO;AAC7E;;AAGA,SAAgB,SAAS,MAA8B;CACtD,OAAO;EAAE,MAAM;EAAS,UAAU,KAAK;EAAc,MAAM,QAAQ;CAAa;AACjF;;;;;AAUA,MAAa,UAAU;;CAEtB,SAAS;EAAC;EAAM;EAAK;EAAM;CAAC;;CAG5B,QAAQ;EAAC;EAAM;EAAG;EAAG;CAAC;;CAGtB,WAAW;EAAC;EAAM;EAAG;EAAM;CAAC;;CAG5B,QAAQ;EAAC;EAAK;EAAG;EAAG;CAAC;;CAGrB,QAAQ;EAAC;EAAM;EAAM;EAAM;CAAC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;GAAG,GAAG;EAAG;EAC7B,SAAS;GAAE,SAAS;GAAG,GAAG;EAAE;EAC5B,MAAM;GAAE,SAAS;GAAG,GAAG;EAAE;CAC1B;;CAGA,MAAM;EACL,SAAS,EAAE,SAAS,EAAE;EACtB,SAAS,EAAE,SAAS,EAAE;EACtB,MAAM,EAAE,SAAS,EAAE;CACpB;;CAGA,SAAS;EACR,SAAS;GAAE,SAAS;GAAG,GAAG;GAAG,OAAO;EAAK;EACzC,SAAS;GAAE,SAAS;GAAG,GAAG;GAAG,OAAO;EAAE;EACtC,MAAM;GAAE,SAAS;GAAG,GAAG;GAAG,OAAO;EAAK;CACvC;AACD"}
@@ -29,23 +29,38 @@ function useDebounce(value, delay) {
29
29
 
30
30
  //#endregion
31
31
  //#region src/components/record-picker.tsx
32
- function RecordPicker({ records, linkedRecordIds, onLink, isLinking, getRecordLabel, getRecordId, searchFields = [
32
+ const DEFAULT_SEARCH_FIELDS = [
33
33
  "name",
34
34
  "title",
35
35
  "label"
36
- ], placeholder = "Search records...", maxHeight = "300px" }) {
36
+ ];
37
+ const NO_LABELS = [];
38
+ /** Keeps the same array while its items are unchanged, so a memo keyed on it does not run again for an equal one. */
39
+ function useStableArray(next) {
40
+ const [stable, setStable] = (0, react.useState)(next);
41
+ if (stable === next || stable.length === next.length && stable.every((item, index) => item === next[index])) return stable;
42
+ setStable(next);
43
+ return next;
44
+ }
45
+ function RecordPicker({ records, linkedRecordIds, onLink, isLinking, getRecordLabel, getRecordId, searchFields = DEFAULT_SEARCH_FIELDS, placeholder = "Search records...", maxHeight = "300px" }) {
37
46
  const [searchQuery, setSearchQuery] = (0, react.useState)("");
38
47
  const debouncedSearchQuery = useDebounce(searchQuery, 300);
48
+ const searching = debouncedSearchQuery.trim() !== "";
49
+ const labels = useStableArray(searching ? records.map((record) => String(getRecordLabel(record) ?? "")) : NO_LABELS);
50
+ const fields = useStableArray(searchFields);
39
51
  const filteredRecords = (0, react.useMemo)(() => {
40
- if (!debouncedSearchQuery.trim()) return records;
52
+ if (!searching) return records;
53
+ const labelOf = new Map(records.map((record, index) => [record, labels[index]]));
41
54
  return (0, match_sorter.matchSorter)(records, debouncedSearchQuery, {
42
- keys: searchFields,
55
+ keys: [...fields, (record) => labelOf.get(record) ?? ""],
43
56
  threshold: match_sorter.matchSorter.rankings.CONTAINS
44
57
  });
45
58
  }, [
46
59
  records,
47
60
  debouncedSearchQuery,
48
- searchFields
61
+ searching,
62
+ fields,
63
+ labels
49
64
  ]);
50
65
  const { linkedRecords, unlinkableRecords } = (0, react.useMemo)(() => {
51
66
  const linked = [];
@@ -77,7 +92,7 @@ function RecordPicker({ records, linkedRecordIds, onLink, isLinking, getRecordLa
77
92
  style: { maxHeight },
78
93
  className: "scrollbar-neutral-thin",
79
94
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
80
- className: "space-y-2 pr-2",
95
+ className: "space-y-2 pe-2",
81
96
  children: [
82
97
  unlinkableRecords.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
83
98
  className: "space-y-1",
@@ -92,7 +107,7 @@ function RecordPicker({ records, linkedRecordIds, onLink, isLinking, getRecordLa
92
107
  const recordId = getRecordId(record);
93
108
  const label = getRecordLabel(record);
94
109
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
95
- className: "hover:bg-muted/50 flex items-center space-x-3 rounded-md p-2 transition-colors",
110
+ className: "hover:bg-muted/50 flex items-center space-x-3 rounded-md p-2",
96
111
  children: [
97
112
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_checkbox.Checkbox, {
98
113
  id: `record-${recordId}`,
@@ -164,4 +179,4 @@ Object.defineProperty(exports, 'RecordPicker', {
164
179
  return RecordPicker;
165
180
  }
166
181
  });
167
- //# sourceMappingURL=record-picker-Bz4FApxD.cjs.map
182
+ //# sourceMappingURL=record-picker-BQ1-Vx0g.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-picker-BQ1-Vx0g.cjs","names":["matchSorter","InputGroup","InputGroupAddon","RiSearchLine","InputGroupInput","ScrollArea","Checkbox","RiLoader4Line","RiCheckLine"],"sources":["../src/lib/use-debounce.ts","../src/components/record-picker.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * Custom hook that debounces a value\n * @param value - The value to debounce\n * @param delay - The delay in milliseconds\n * @returns The debounced value\n */\nexport function useDebounce<T>(value: T, delay: number): T {\n\tconst [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n\tuseEffect(() => {\n\t\tconst handler = setTimeout(() => {\n\t\t\tsetDebouncedValue(value);\n\t\t}, delay);\n\n\t\treturn () => {\n\t\t\tclearTimeout(handler);\n\t\t};\n\t}, [value, delay]);\n\n\treturn debouncedValue;\n}\n","'use client';\n\nimport { useCallback, useMemo, useState } from 'react';\nimport { RiCheckLine, RiLoader4Line, RiSearchLine } from '@remixicon/react';\nimport { matchSorter } from 'match-sorter';\n\nimport { useDebounce } from '../lib/use-debounce';\nimport { Checkbox } from './checkbox';\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group';\nimport { ScrollArea } from './scroll-area';\n\n// Module-level so the default keeps one identity and the filter memo below is not recomputed on every render.\nconst DEFAULT_SEARCH_FIELDS = ['name', 'title', 'label'];\nconst NO_LABELS: readonly string[] = [];\n\n/** Keeps the same array while its items are unchanged, so a memo keyed on it does not run again for an equal one. */\nfunction useStableArray<T>(next: readonly T[]): readonly T[] {\n\tconst [stable, setStable] = useState(next);\n\tif (stable === next || (stable.length === next.length && stable.every((item, index) => item === next[index]))) return stable;\n\t// Adjusting state while rendering: React re-renders at once, before anything is committed, and no ref is involved.\n\tsetStable(next);\n\treturn next;\n}\n\ninterface RecordPickerProps {\n\trecords: any[];\n\tlinkedRecordIds: Set<string>;\n\tonLink: (record: any) => void;\n\tisLinking: boolean;\n\tgetRecordLabel: (record: any) => string;\n\tgetRecordId: (record: any) => string;\n\tsearchFields?: string[];\n\tplaceholder?: string;\n\tmaxHeight?: string;\n}\n\nexport function RecordPicker({\n\trecords,\n\tlinkedRecordIds,\n\tonLink,\n\tisLinking,\n\tgetRecordLabel,\n\tgetRecordId,\n\tsearchFields = DEFAULT_SEARCH_FIELDS,\n\tplaceholder = 'Search records...',\n\tmaxHeight = '300px',\n}: RecordPickerProps) {\n\tconst [searchQuery, setSearchQuery] = useState('');\n\tconst debouncedSearchQuery = useDebounce(searchQuery, 300);\n\n\tconst searching = debouncedSearchQuery.trim() !== '';\n\t// The text each row shows, read only while a search runs. Hosts usually pass `getRecordLabel` inline, so it is a new\n\t// function on every render; comparing the labels it returns keeps the much heavier search from running again for nothing.\n\tconst labels = useStableArray(searching ? records.map((record) => String(getRecordLabel(record) ?? '')) : NO_LABELS);\n\tconst fields = useStableArray(searchFields);\n\n\t// Filter records based on search query\n\tconst filteredRecords = useMemo(() => {\n\t\tif (!searching) {\n\t\t\treturn records;\n\t\t}\n\n\t\t// The row's own label is always searchable, so a query can never miss text the user can see.\n\t\tconst labelOf = new Map(records.map((record, index) => [record, labels[index]]));\n\t\treturn matchSorter(records, debouncedSearchQuery, {\n\t\t\tkeys: [...fields, (record: any) => labelOf.get(record) ?? ''],\n\t\t\tthreshold: matchSorter.rankings.CONTAINS,\n\t\t});\n\t}, [records, debouncedSearchQuery, searching, fields, labels]);\n\n\t// Separate linked and unlinked records\n\tconst { linkedRecords, unlinkableRecords } = useMemo(() => {\n\t\tconst linked: any[] = [];\n\t\tconst unlinkable: any[] = [];\n\n\t\tfilteredRecords.forEach((record) => {\n\t\t\tconst recordId = getRecordId(record);\n\t\t\tif (linkedRecordIds.has(recordId)) {\n\t\t\t\tlinked.push(record);\n\t\t\t} else {\n\t\t\t\tunlinkable.push(record);\n\t\t\t}\n\t\t});\n\n\t\treturn { linkedRecords: linked, unlinkableRecords: unlinkable };\n\t}, [filteredRecords, linkedRecordIds, getRecordId]);\n\n\tconst handleLinkRecord = useCallback(\n\t\t(record: any) => {\n\t\t\tonLink(record);\n\t\t},\n\t\t[onLink],\n\t);\n\n\treturn (\n\t\t<div className='space-y-3'>\n\t\t\t{/* Search Input */}\n\t\t\t<InputGroup>\n\t\t\t\t<InputGroupAddon>\n\t\t\t\t\t<RiSearchLine />\n\t\t\t\t</InputGroupAddon>\n\t\t\t\t<InputGroupInput\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tvalue={searchQuery}\n\t\t\t\t\tonChange={(e) => setSearchQuery(e.target.value)}\n\t\t\t\t/>\n\t\t\t</InputGroup>\n\n\t\t\t{/* Records List */}\n\t\t\t<ScrollArea style={{ maxHeight }} className='scrollbar-neutral-thin'>\n\t\t\t\t<div className='space-y-2 pe-2'>\n\t\t\t\t\t{/* Unlinkable Records */}\n\t\t\t\t\t{unlinkableRecords.length > 0 && (\n\t\t\t\t\t\t<div className='space-y-1'>\n\t\t\t\t\t\t\t<h4 className='text-muted-foreground text-xs font-medium tracking-wide uppercase'>\n\t\t\t\t\t\t\t\tAvailable Records ({unlinkableRecords.length})\n\t\t\t\t\t\t\t</h4>\n\t\t\t\t\t\t\t{unlinkableRecords.map((record) => {\n\t\t\t\t\t\t\t\tconst recordId = getRecordId(record);\n\t\t\t\t\t\t\t\tconst label = getRecordLabel(record);\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tkey={recordId}\n\t\t\t\t\t\t\t\t\t\tclassName='hover:bg-muted/50 flex items-center space-x-3 rounded-md p-2'\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\t\t\t\t\tid={`record-${recordId}`}\n\t\t\t\t\t\t\t\t\t\t\tchecked={false}\n\t\t\t\t\t\t\t\t\t\t\tonCheckedChange={() => handleLinkRecord(record)}\n\t\t\t\t\t\t\t\t\t\t\tdisabled={isLinking}\n\t\t\t\t\t\t\t\t\t\t\tclassName='flex-shrink-0'\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\t\t\thtmlFor={`record-${recordId}`}\n\t\t\t\t\t\t\t\t\t\t\tclassName='flex-1 cursor-pointer truncate text-sm'\n\t\t\t\t\t\t\t\t\t\t\ttitle={label}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t{isLinking && (\n\t\t\t\t\t\t\t\t\t\t\t<RiLoader4Line className='text-muted-foreground h-4 w-4 flex-shrink-0 animate-spin' />\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Already Linked Records */}\n\t\t\t\t\t{linkedRecords.length > 0 && (\n\t\t\t\t\t\t<div className='space-y-1'>\n\t\t\t\t\t\t\t<h4 className='text-muted-foreground text-xs font-medium tracking-wide uppercase'>\n\t\t\t\t\t\t\t\tAlready Linked ({linkedRecords.length})\n\t\t\t\t\t\t\t</h4>\n\t\t\t\t\t\t\t{linkedRecords.map((record) => {\n\t\t\t\t\t\t\t\tconst recordId = getRecordId(record);\n\t\t\t\t\t\t\t\tconst label = getRecordLabel(record);\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<div key={recordId} className='bg-muted/30 flex items-center space-x-3 rounded-md p-2'>\n\t\t\t\t\t\t\t\t\t\t<div className='flex h-4 w-4 flex-shrink-0 items-center justify-center'>\n\t\t\t\t\t\t\t\t\t\t\t<RiCheckLine className='h-3 w-3 text-green-600' />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<span className='text-muted-foreground flex-1 truncate text-sm' title={label}>\n\t\t\t\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Empty State */}\n\t\t\t\t\t{filteredRecords.length === 0 && (\n\t\t\t\t\t\t<div className='text-muted-foreground py-8 text-center'>\n\t\t\t\t\t\t\t<RiSearchLine className='mx-auto mb-2 h-8 w-8 opacity-50' />\n\t\t\t\t\t\t\t<p className='text-sm'>{searchQuery ? 'No records match your search' : 'No records available'}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* No Unlinkable Records */}\n\t\t\t\t\t{filteredRecords.length > 0 && unlinkableRecords.length === 0 && (\n\t\t\t\t\t\t<div className='text-muted-foreground py-4 text-center'>\n\t\t\t\t\t\t\t<RiCheckLine className='mx-auto mb-2 h-6 w-6 opacity-50' />\n\t\t\t\t\t\t\t<p className='text-sm'>All matching records are already linked</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</ScrollArea>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,SAAgB,YAAe,OAAU,OAAkB;CAC1D,MAAM,CAAC,gBAAgB,yCAAiC,KAAK;CAE7D,2BAAgB;EACf,MAAM,UAAU,iBAAiB;GAChC,kBAAkB,KAAK;EACxB,GAAG,KAAK;EAER,aAAa;GACZ,aAAa,OAAO;EACrB;CACD,GAAG,CAAC,OAAO,KAAK,CAAC;CAEjB,OAAO;AACR;;;;ACVA,MAAM,wBAAwB;CAAC;CAAQ;CAAS;AAAO;AACvD,MAAM,YAA+B,CAAC;;AAGtC,SAAS,eAAkB,MAAkC;CAC5D,MAAM,CAAC,QAAQ,iCAAsB,IAAI;CACzC,IAAI,WAAW,QAAS,OAAO,WAAW,KAAK,UAAU,OAAO,OAAO,MAAM,UAAU,SAAS,KAAK,MAAM,GAAI,OAAO;CAEtH,UAAU,IAAI;CACd,OAAO;AACR;AAcA,SAAgB,aAA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