@constructive-io/ui 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. package/dist/button-D4vqTxhp.d.cts +20 -0
  2. package/dist/button-D4vqTxhp.d.ts +20 -0
  3. package/dist/components/alert-dialog.cjs +98 -302
  4. package/dist/components/alert-dialog.cjs.map +1 -1
  5. package/dist/components/alert-dialog.d.cts +22 -21
  6. package/dist/components/alert-dialog.d.ts +22 -21
  7. package/dist/components/alert-dialog.js +96 -281
  8. package/dist/components/alert-dialog.js.map +1 -1
  9. package/dist/components/alert.cjs +51 -108
  10. package/dist/components/alert.cjs.map +1 -1
  11. package/dist/components/alert.d.cts +13 -13
  12. package/dist/components/alert.d.ts +13 -13
  13. package/dist/components/alert.js +49 -87
  14. package/dist/components/alert.js.map +1 -1
  15. package/dist/components/app-bar.cjs +73 -359
  16. package/dist/components/app-bar.cjs.map +1 -1
  17. package/dist/components/app-bar.d.cts +21 -20
  18. package/dist/components/app-bar.d.ts +21 -20
  19. package/dist/components/app-bar.js +71 -338
  20. package/dist/components/app-bar.js.map +1 -1
  21. package/dist/components/app-shell.cjs +252 -1777
  22. package/dist/components/app-shell.cjs.map +1 -1
  23. package/dist/components/app-shell.d.cts +77 -85
  24. package/dist/components/app-shell.d.ts +77 -85
  25. package/dist/components/app-shell.js +249 -1756
  26. package/dist/components/app-shell.js.map +1 -1
  27. package/dist/components/autocomplete.cjs +146 -397
  28. package/dist/components/autocomplete.cjs.map +1 -1
  29. package/dist/components/autocomplete.d.cts +24 -24
  30. package/dist/components/autocomplete.d.ts +24 -24
  31. package/dist/components/autocomplete.js +146 -376
  32. package/dist/components/autocomplete.js.map +1 -1
  33. package/dist/components/avatar.cjs +26 -38
  34. package/dist/components/avatar.cjs.map +1 -1
  35. package/dist/components/avatar.d.cts +11 -10
  36. package/dist/components/avatar.d.ts +11 -10
  37. package/dist/components/avatar.js +24 -37
  38. package/dist/components/avatar.js.map +1 -1
  39. package/dist/components/badge.cjs +42 -60
  40. package/dist/components/badge.cjs.map +1 -1
  41. package/dist/components/badge.d.cts +13 -13
  42. package/dist/components/badge.d.ts +13 -13
  43. package/dist/components/badge.js +39 -38
  44. package/dist/components/badge.js.map +1 -1
  45. package/dist/components/breadcrumb.cjs +65 -94
  46. package/dist/components/breadcrumb.cjs.map +1 -1
  47. package/dist/components/breadcrumb.d.cts +14 -13
  48. package/dist/components/breadcrumb.d.ts +14 -13
  49. package/dist/components/breadcrumb.js +63 -73
  50. package/dist/components/breadcrumb.js.map +1 -1
  51. package/dist/components/button.cjs +68 -162
  52. package/dist/components/button.cjs.map +1 -1
  53. package/dist/components/button.d.cts +2 -20
  54. package/dist/components/button.d.ts +2 -20
  55. package/dist/components/button.js +65 -140
  56. package/dist/components/button.js.map +1 -1
  57. package/dist/components/calendar-rac.cjs +49 -62
  58. package/dist/components/calendar-rac.cjs.map +1 -1
  59. package/dist/components/calendar-rac.d.cts +8 -8
  60. package/dist/components/calendar-rac.d.ts +8 -8
  61. package/dist/components/calendar-rac.js +49 -61
  62. package/dist/components/calendar-rac.js.map +1 -1
  63. package/dist/components/card.cjs +61 -74
  64. package/dist/components/card.cjs.map +1 -1
  65. package/dist/components/card.d.cts +15 -16
  66. package/dist/components/card.d.ts +15 -16
  67. package/dist/components/card.js +58 -72
  68. package/dist/components/card.js.map +1 -1
  69. package/dist/components/checkbox-group.cjs +12 -11
  70. package/dist/components/checkbox-group.cjs.map +1 -1
  71. package/dist/components/checkbox-group.d.cts +5 -5
  72. package/dist/components/checkbox-group.d.ts +5 -5
  73. package/dist/components/checkbox-group.js +12 -10
  74. package/dist/components/checkbox-group.js.map +1 -1
  75. package/dist/components/checkbox.cjs +60 -114
  76. package/dist/components/checkbox.cjs.map +1 -1
  77. package/dist/components/checkbox.d.cts +6 -6
  78. package/dist/components/checkbox.d.ts +6 -6
  79. package/dist/components/checkbox.js +58 -93
  80. package/dist/components/checkbox.js.map +1 -1
  81. package/dist/components/collapsible.cjs +76 -113
  82. package/dist/components/collapsible.cjs.map +1 -1
  83. package/dist/components/collapsible.d.cts +16 -15
  84. package/dist/components/collapsible.d.ts +16 -15
  85. package/dist/components/collapsible.js +74 -92
  86. package/dist/components/collapsible.js.map +1 -1
  87. package/dist/components/combobox.cjs +213 -507
  88. package/dist/components/combobox.cjs.map +1 -1
  89. package/dist/components/combobox.d.cts +36 -35
  90. package/dist/components/combobox.d.ts +36 -35
  91. package/dist/components/combobox.js +229 -504
  92. package/dist/components/combobox.js.map +1 -1
  93. package/dist/components/command.cjs +102 -199
  94. package/dist/components/command.cjs.map +1 -1
  95. package/dist/components/command.d.cts +22 -21
  96. package/dist/components/command.d.ts +22 -21
  97. package/dist/components/command.js +100 -198
  98. package/dist/components/command.js.map +1 -1
  99. package/dist/components/dialog.cjs +110 -402
  100. package/dist/components/dialog.cjs.map +1 -1
  101. package/dist/components/dialog.d.cts +27 -26
  102. package/dist/components/dialog.d.ts +27 -26
  103. package/dist/components/dialog.js +107 -380
  104. package/dist/components/dialog.js.map +1 -1
  105. package/dist/components/dock.cjs +80 -111
  106. package/dist/components/dock.cjs.map +1 -1
  107. package/dist/components/dock.d.cts +25 -25
  108. package/dist/components/dock.d.ts +25 -25
  109. package/dist/components/dock.js +78 -106
  110. package/dist/components/dock.js.map +1 -1
  111. package/dist/components/drawer.cjs +77 -111
  112. package/dist/components/drawer.cjs.map +1 -1
  113. package/dist/components/drawer.d.cts +15 -14
  114. package/dist/components/drawer.d.ts +15 -14
  115. package/dist/components/drawer.js +75 -90
  116. package/dist/components/drawer.js.map +1 -1
  117. package/dist/components/dropdown-menu.cjs +163 -238
  118. package/dist/components/dropdown-menu.cjs.map +1 -1
  119. package/dist/components/dropdown-menu.d.cts +44 -43
  120. package/dist/components/dropdown-menu.d.ts +44 -43
  121. package/dist/components/dropdown-menu.js +161 -217
  122. package/dist/components/dropdown-menu.js.map +1 -1
  123. package/dist/components/empty.cjs +51 -85
  124. package/dist/components/empty.cjs.map +1 -1
  125. package/dist/components/empty.d.cts +13 -13
  126. package/dist/components/empty.d.ts +13 -13
  127. package/dist/components/empty.js +48 -83
  128. package/dist/components/empty.js.map +1 -1
  129. package/dist/components/field.cjs +150 -259
  130. package/dist/components/field.cjs.map +1 -1
  131. package/dist/components/field.d.cts +39 -39
  132. package/dist/components/field.d.ts +39 -39
  133. package/dist/components/field.js +148 -238
  134. package/dist/components/field.js.map +1 -1
  135. package/dist/components/flickering-grid.cjs +143 -166
  136. package/dist/components/flickering-grid.cjs.map +1 -1
  137. package/dist/components/flickering-grid.d.cts +14 -13
  138. package/dist/components/flickering-grid.d.ts +14 -13
  139. package/dist/components/flickering-grid.js +141 -161
  140. package/dist/components/flickering-grid.js.map +1 -1
  141. package/dist/components/flow-zoom-panel.cjs +56 -188
  142. package/dist/components/flow-zoom-panel.cjs.map +1 -1
  143. package/dist/components/flow-zoom-panel.d.cts +9 -9
  144. package/dist/components/flow-zoom-panel.d.ts +9 -9
  145. package/dist/components/flow-zoom-panel.js +56 -168
  146. package/dist/components/flow-zoom-panel.js.map +1 -1
  147. package/dist/components/form-control.cjs +58 -186
  148. package/dist/components/form-control.cjs.map +1 -1
  149. package/dist/components/form-control.d.cts +11 -10
  150. package/dist/components/form-control.d.ts +11 -10
  151. package/dist/components/form-control.js +56 -165
  152. package/dist/components/form-control.js.map +1 -1
  153. package/dist/components/form.cjs +78 -184
  154. package/dist/components/form.cjs.map +1 -1
  155. package/dist/components/form.d.cts +2 -36
  156. package/dist/components/form.d.ts +2 -36
  157. package/dist/components/form.js +76 -163
  158. package/dist/components/form.js.map +1 -1
  159. package/dist/components/input-group.cjs +51 -165
  160. package/dist/components/input-group.cjs.map +1 -1
  161. package/dist/components/input-group.d.cts +14 -15
  162. package/dist/components/input-group.d.ts +14 -15
  163. package/dist/components/input-group.js +51 -164
  164. package/dist/components/input-group.js.map +1 -1
  165. package/dist/components/input.cjs +30 -55
  166. package/dist/components/input.cjs.map +1 -1
  167. package/dist/components/input.d.cts +2 -10
  168. package/dist/components/input.d.ts +2 -10
  169. package/dist/components/input.js +30 -54
  170. package/dist/components/input.js.map +1 -1
  171. package/dist/components/json-input.cjs +133 -337
  172. package/dist/components/json-input.cjs.map +1 -1
  173. package/dist/components/json-input.d.cts +20 -19
  174. package/dist/components/json-input.d.ts +20 -19
  175. package/dist/components/json-input.js +132 -317
  176. package/dist/components/json-input.js.map +1 -1
  177. package/dist/components/label.cjs +19 -21
  178. package/dist/components/label.cjs.map +1 -1
  179. package/dist/components/label.d.cts +6 -5
  180. package/dist/components/label.d.ts +6 -5
  181. package/dist/components/label.js +17 -20
  182. package/dist/components/label.js.map +1 -1
  183. package/dist/components/motion-grid.cjs +61 -101
  184. package/dist/components/motion-grid.cjs.map +1 -1
  185. package/dist/components/motion-grid.d.cts +15 -14
  186. package/dist/components/motion-grid.d.ts +15 -14
  187. package/dist/components/motion-grid.js +59 -80
  188. package/dist/components/motion-grid.js.map +1 -1
  189. package/dist/components/multi-select.cjs +563 -786
  190. package/dist/components/multi-select.cjs.map +1 -1
  191. package/dist/components/multi-select.d.cts +173 -173
  192. package/dist/components/multi-select.d.ts +173 -173
  193. package/dist/components/multi-select.js +561 -765
  194. package/dist/components/multi-select.js.map +1 -1
  195. package/dist/components/page-header.cjs +24 -13
  196. package/dist/components/page-header.cjs.map +1 -1
  197. package/dist/components/page-header.d.cts +11 -11
  198. package/dist/components/page-header.d.ts +11 -11
  199. package/dist/components/page-header.js +23 -11
  200. package/dist/components/page-header.js.map +1 -1
  201. package/dist/components/pagination.cjs +72 -272
  202. package/dist/components/pagination.cjs.map +1 -1
  203. package/dist/components/pagination.d.cts +15 -16
  204. package/dist/components/pagination.d.ts +15 -16
  205. package/dist/components/pagination.js +69 -250
  206. package/dist/components/pagination.js.map +1 -1
  207. package/dist/components/popover.cjs +68 -111
  208. package/dist/components/popover.cjs.map +1 -1
  209. package/dist/components/popover.d.cts +31 -30
  210. package/dist/components/popover.d.ts +31 -30
  211. package/dist/components/popover.js +66 -90
  212. package/dist/components/popover.js.map +1 -1
  213. package/dist/components/portal.cjs +128 -81
  214. package/dist/components/portal.cjs.map +1 -1
  215. package/dist/components/portal.d.cts +24 -23
  216. package/dist/components/portal.d.ts +24 -23
  217. package/dist/components/portal.js +126 -60
  218. package/dist/components/portal.js.map +1 -1
  219. package/dist/components/progress.cjs +23 -24
  220. package/dist/components/progress.cjs.map +1 -1
  221. package/dist/components/progress.d.cts +8 -7
  222. package/dist/components/progress.d.ts +8 -7
  223. package/dist/components/progress.js +21 -23
  224. package/dist/components/progress.js.map +1 -1
  225. package/dist/components/progressive-blur-scroll-container.cjs +70 -138
  226. package/dist/components/progressive-blur-scroll-container.cjs.map +1 -1
  227. package/dist/components/progressive-blur-scroll-container.d.cts +19 -19
  228. package/dist/components/progressive-blur-scroll-container.d.ts +19 -19
  229. package/dist/components/progressive-blur-scroll-container.js +70 -137
  230. package/dist/components/progressive-blur-scroll-container.js.map +1 -1
  231. package/dist/components/progressive-blur.cjs +40 -64
  232. package/dist/components/progressive-blur.cjs.map +1 -1
  233. package/dist/components/progressive-blur.d.cts +15 -14
  234. package/dist/components/progressive-blur.d.ts +15 -14
  235. package/dist/components/progressive-blur.js +38 -63
  236. package/dist/components/progressive-blur.js.map +1 -1
  237. package/dist/components/radio-group.cjs +28 -42
  238. package/dist/components/radio-group.cjs.map +1 -1
  239. package/dist/components/radio-group.d.cts +8 -8
  240. package/dist/components/radio-group.d.ts +8 -8
  241. package/dist/components/radio-group.js +28 -41
  242. package/dist/components/radio-group.js.map +1 -1
  243. package/dist/components/record-picker.cjs +6 -418
  244. package/dist/components/record-picker.d.cts +13 -13
  245. package/dist/components/record-picker.d.ts +13 -13
  246. package/dist/components/record-picker.js +5 -397
  247. package/dist/components/resizable.cjs +32 -58
  248. package/dist/components/resizable.cjs.map +1 -1
  249. package/dist/components/resizable.d.cts +10 -9
  250. package/dist/components/resizable.d.ts +10 -9
  251. package/dist/components/resizable.js +29 -37
  252. package/dist/components/resizable.js.map +1 -1
  253. package/dist/components/responsive-diagram.cjs +50 -61
  254. package/dist/components/responsive-diagram.cjs.map +1 -1
  255. package/dist/components/responsive-diagram.d.cts +7 -7
  256. package/dist/components/responsive-diagram.d.ts +7 -7
  257. package/dist/components/responsive-diagram.js +50 -60
  258. package/dist/components/responsive-diagram.js.map +1 -1
  259. package/dist/components/scroll-area.cjs +37 -83
  260. package/dist/components/scroll-area.cjs.map +1 -1
  261. package/dist/components/scroll-area.d.cts +9 -8
  262. package/dist/components/scroll-area.d.ts +9 -8
  263. package/dist/components/scroll-area.js +35 -62
  264. package/dist/components/scroll-area.js.map +1 -1
  265. package/dist/components/select.cjs +175 -300
  266. package/dist/components/select.cjs.map +1 -1
  267. package/dist/components/select.d.cts +36 -35
  268. package/dist/components/select.d.ts +36 -35
  269. package/dist/components/select.js +172 -278
  270. package/dist/components/select.js.map +1 -1
  271. package/dist/components/separator.cjs +16 -19
  272. package/dist/components/separator.cjs.map +1 -1
  273. package/dist/components/separator.d.cts +2 -10
  274. package/dist/components/separator.d.ts +2 -10
  275. package/dist/components/separator.js +14 -18
  276. package/dist/components/separator.js.map +1 -1
  277. package/dist/components/sheet.cjs +17 -487
  278. package/dist/components/sheet.d.cts +85 -85
  279. package/dist/components/sheet.d.ts +85 -85
  280. package/dist/components/sheet.js +3 -453
  281. package/dist/components/sidebar.cjs +27 -1298
  282. package/dist/components/sidebar.d.cts +62 -65
  283. package/dist/components/sidebar.d.ts +62 -65
  284. package/dist/components/sidebar.js +3 -1254
  285. package/dist/components/skeleton.cjs +18 -30
  286. package/dist/components/skeleton.cjs.map +1 -1
  287. package/dist/components/skeleton.d.cts +6 -5
  288. package/dist/components/skeleton.d.ts +6 -5
  289. package/dist/components/skeleton.js +15 -28
  290. package/dist/components/skeleton.js.map +1 -1
  291. package/dist/components/sonner.cjs +17 -19
  292. package/dist/components/sonner.cjs.map +1 -1
  293. package/dist/components/sonner.d.cts +7 -7
  294. package/dist/components/sonner.d.ts +7 -7
  295. package/dist/components/sonner.js +17 -18
  296. package/dist/components/sonner.js.map +1 -1
  297. package/dist/components/stack/index.cjs +43 -1515
  298. package/dist/components/stack/index.d.cts +2 -672
  299. package/dist/components/stack/index.d.ts +2 -672
  300. package/dist/components/stack/index.js +3 -1455
  301. package/dist/components/stepper.cjs +131 -285
  302. package/dist/components/stepper.cjs.map +1 -1
  303. package/dist/components/stepper.d.cts +27 -26
  304. package/dist/components/stepper.d.ts +27 -26
  305. package/dist/components/stepper.js +130 -265
  306. package/dist/components/stepper.js.map +1 -1
  307. package/dist/components/switch.cjs +21 -32
  308. package/dist/components/switch.cjs.map +1 -1
  309. package/dist/components/switch.d.cts +7 -6
  310. package/dist/components/switch.d.ts +7 -6
  311. package/dist/components/switch.js +19 -31
  312. package/dist/components/switch.js.map +1 -1
  313. package/dist/components/table.cjs +58 -106
  314. package/dist/components/table.cjs.map +1 -1
  315. package/dist/components/table.d.cts +17 -16
  316. package/dist/components/table.d.ts +17 -16
  317. package/dist/components/table.js +55 -104
  318. package/dist/components/table.js.map +1 -1
  319. package/dist/components/tabs.cjs +31 -35
  320. package/dist/components/tabs.cjs.map +1 -1
  321. package/dist/components/tabs.d.cts +9 -8
  322. package/dist/components/tabs.d.ts +9 -8
  323. package/dist/components/tabs.js +29 -34
  324. package/dist/components/tabs.js.map +1 -1
  325. package/dist/components/tags.cjs +114 -433
  326. package/dist/components/tags.cjs.map +1 -1
  327. package/dist/components/tags.d.cts +24 -28
  328. package/dist/components/tags.d.ts +24 -28
  329. package/dist/components/tags.js +114 -413
  330. package/dist/components/tags.js.map +1 -1
  331. package/dist/components/textarea.cjs +27 -49
  332. package/dist/components/textarea.cjs.map +1 -1
  333. package/dist/components/textarea.d.cts +8 -7
  334. package/dist/components/textarea.d.ts +8 -7
  335. package/dist/components/textarea.js +27 -48
  336. package/dist/components/textarea.js.map +1 -1
  337. package/dist/components/toast/index.cjs +9 -612
  338. package/dist/components/toast/index.d.cts +2 -52
  339. package/dist/components/toast/index.d.ts +2 -52
  340. package/dist/components/toast/index.js +3 -586
  341. package/dist/components/tooltip.cjs +47 -72
  342. package/dist/components/tooltip.cjs.map +1 -1
  343. package/dist/components/tooltip.d.cts +2 -28
  344. package/dist/components/tooltip.d.ts +2 -28
  345. package/dist/components/tooltip.js +45 -51
  346. package/dist/components/tooltip.js.map +1 -1
  347. package/dist/components/unlink-button.cjs +19 -192
  348. package/dist/components/unlink-button.cjs.map +1 -1
  349. package/dist/components/unlink-button.d.cts +11 -11
  350. package/dist/components/unlink-button.d.ts +11 -11
  351. package/dist/components/unlink-button.js +18 -170
  352. package/dist/components/unlink-button.js.map +1 -1
  353. package/dist/form-DgRTv7O7.d.ts +54 -0
  354. package/dist/form-DoZEWSzb.d.cts +54 -0
  355. package/dist/index-CjA4CENl.d.cts +684 -0
  356. package/dist/index-CjA4CENl.d.ts +684 -0
  357. package/dist/index-UnM04j0t.d.cts +58 -0
  358. package/dist/index-UnM04j0t.d.ts +58 -0
  359. package/dist/index.cjs +408 -8697
  360. package/dist/index.d.cts +224 -2136
  361. package/dist/index.d.ts +224 -2136
  362. package/dist/index.js +65 -8350
  363. package/dist/input-CBrCuMH8.d.cts +11 -0
  364. package/dist/input-CBrCuMH8.d.ts +11 -0
  365. package/dist/motion-config-COCFHq1L.cjs +271 -0
  366. package/dist/motion-config-COCFHq1L.cjs.map +1 -0
  367. package/dist/motion-config-COsZ6azM.js +241 -0
  368. package/dist/motion-config-COsZ6azM.js.map +1 -0
  369. package/dist/record-picker-BbxngCeV.js +162 -0
  370. package/dist/record-picker-BbxngCeV.js.map +1 -0
  371. package/dist/record-picker-Bz4FApxD.cjs +167 -0
  372. package/dist/record-picker-Bz4FApxD.cjs.map +1 -0
  373. package/dist/rolldown-runtime-D_qnwXdH.cjs +35 -0
  374. package/dist/separator-BQEsr0Rc.d.cts +11 -0
  375. package/dist/separator-BQEsr0Rc.d.ts +11 -0
  376. package/dist/sheet-BLHnhLRH.js +425 -0
  377. package/dist/sheet-BLHnhLRH.js.map +1 -0
  378. package/dist/sheet-BdA0rfIz.cjs +515 -0
  379. package/dist/sheet-BdA0rfIz.cjs.map +1 -0
  380. package/dist/sidebar-CPy_fibW.cjs +608 -0
  381. package/dist/sidebar-CPy_fibW.cjs.map +1 -0
  382. package/dist/sidebar-Cfax0g0_.js +463 -0
  383. package/dist/sidebar-Cfax0g0_.js.map +1 -0
  384. package/dist/slot-C-jEfihz.cjs +122 -0
  385. package/dist/slot-C-jEfihz.cjs.map +1 -0
  386. package/dist/slot-EL8zfLG0.js +97 -0
  387. package/dist/slot-EL8zfLG0.js.map +1 -0
  388. package/dist/stack-DKdvlOM6.cjs +1771 -0
  389. package/dist/stack-DKdvlOM6.cjs.map +1 -0
  390. package/dist/stack-jMdxDrex.js +1531 -0
  391. package/dist/stack-jMdxDrex.js.map +1 -0
  392. package/dist/toast-D6MqijT2.cjs +316 -0
  393. package/dist/toast-D6MqijT2.cjs.map +1 -0
  394. package/dist/toast-D_BOLzm3.js +287 -0
  395. package/dist/toast-D_BOLzm3.js.map +1 -0
  396. package/dist/tooltip-CTRQoN1A.d.cts +29 -0
  397. package/dist/tooltip-CTRQoN1A.d.ts +29 -0
  398. package/dist/utils-BkMLyah9.js +12 -0
  399. package/dist/utils-BkMLyah9.js.map +1 -0
  400. package/dist/utils-CzTQ3-VI.cjs +17 -0
  401. package/dist/utils-CzTQ3-VI.cjs.map +1 -0
  402. package/package.json +5 -5
  403. package/dist/components/record-picker.cjs.map +0 -1
  404. package/dist/components/record-picker.js.map +0 -1
  405. package/dist/components/sheet.cjs.map +0 -1
  406. package/dist/components/sheet.js.map +0 -1
  407. package/dist/components/sidebar.cjs.map +0 -1
  408. package/dist/components/sidebar.js.map +0 -1
  409. package/dist/components/stack/index.cjs.map +0 -1
  410. package/dist/components/stack/index.js.map +0 -1
  411. package/dist/components/toast/index.cjs.map +0 -1
  412. package/dist/components/toast/index.js.map +0 -1
  413. package/dist/index.cjs.map +0 -1
  414. package/dist/index.js.map +0 -1
@@ -1,796 +1,573 @@
1
- "use client";
2
- 'use strict';
1
+ 'use client';
3
2
 
4
- var React3 = require('react');
5
- var classVarianceAuthority = require('class-variance-authority');
6
- var lucideReact = require('lucide-react');
7
- var clsx = require('clsx');
8
- var tailwindMerge = require('tailwind-merge');
9
- var jsxRuntime = require('react/jsx-runtime');
10
- var popover = require('@base-ui/react/popover');
11
- var portal = require('@constructive-io/ui/portal');
12
- var separator = require('@base-ui/react/separator');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
5
+ const require_utils = require('../utils-CzTQ3-VI.cjs');
6
+ const require_components_badge = require('./badge.cjs');
7
+ const require_components_separator = require('./separator.cjs');
8
+ const require_components_popover = require('./popover.cjs');
9
+ let react = require("react");
10
+ react = require_rolldown_runtime.__toESM(react, 1);
11
+ let react_jsx_runtime = require("react/jsx-runtime");
12
+ let class_variance_authority = require("class-variance-authority");
13
+ let lucide_react = require("lucide-react");
13
14
 
14
- function _interopNamespace(e) {
15
- if (e && e.__esModule) return e;
16
- var n = Object.create(null);
17
- if (e) {
18
- Object.keys(e).forEach(function (k) {
19
- if (k !== 'default') {
20
- var d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(n, k, d.get ? d : {
22
- enumerable: true,
23
- get: function () { return e[k]; }
24
- });
25
- }
26
- });
27
- }
28
- n.default = e;
29
- return Object.freeze(n);
30
- }
31
-
32
- var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
33
-
34
- function cn(...inputs) {
35
- return tailwindMerge.twMerge(clsx.clsx(inputs));
36
- }
37
- var badgeVariants = classVarianceAuthority.cva(
38
- "relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button,a&]:cursor-pointer [button,a&]:pointer-coarse:min-h-11 [button,a&]:pointer-coarse:min-w-11",
39
- {
40
- defaultVariants: {
41
- size: "default",
42
- variant: "default"
43
- },
44
- variants: {
45
- size: {
46
- default: "px-[calc(--spacing(1)-1px)] text-xs",
47
- lg: "px-[calc(--spacing(1.5)-1px)] text-sm",
48
- sm: "rounded-[calc(var(--radius-sm)-2px)] px-[calc(--spacing(1)-1px)] text-[.625rem]"
49
- },
50
- variant: {
51
- default: "bg-primary text-primary-foreground [button,a&]:hover:bg-primary/90",
52
- destructive: "bg-destructive text-white [button,a&]:hover:bg-destructive/90",
53
- error: "bg-destructive/8 text-destructive dark:bg-destructive/16",
54
- info: "bg-info/8 text-info-foreground dark:bg-info/16",
55
- outline: "border-border/60 bg-transparent dark:bg-input/32 [button,a&]:hover:bg-accent/50 dark:[button,a&]:hover:bg-input/48",
56
- secondary: "bg-secondary text-secondary-foreground [button,a&]:hover:bg-secondary/90",
57
- success: "bg-success/8 text-success-foreground dark:bg-success/16",
58
- warning: "bg-warning/8 text-warning-foreground dark:bg-warning/16"
59
- }
60
- }
61
- }
62
- );
63
- var Badge = React3__namespace.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("span", { ref, "data-slot": "badge", className: cn(badgeVariants({ variant, size }), className), ...props }));
64
- Badge.displayName = "Badge";
65
- function Popover({ ...props }) {
66
- return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Root, { "data-slot": "popover", ...props });
67
- }
68
- function PopoverTrigger({ asChild, children, render, nativeButton, ...props }) {
69
- const childRender = render === void 0 && asChild && React3__namespace.isValidElement(children) ? children : void 0;
70
- return /* @__PURE__ */ jsxRuntime.jsx(
71
- popover.Popover.Trigger,
72
- {
73
- "data-slot": "popover-trigger",
74
- nativeButton: nativeButton ?? (childRender ? true : void 0),
75
- render: render ?? childRender,
76
- ...props,
77
- children: childRender ? void 0 : children
78
- }
79
- );
80
- }
81
- function PopoverContent({
82
- className,
83
- align = "center",
84
- sideOffset = 4,
85
- showArrow = false,
86
- side = "bottom",
87
- children,
88
- onOpenAutoFocus: _onOpenAutoFocus,
89
- onCloseAutoFocus: _onCloseAutoFocus,
90
- onFocusOutside: _onFocusOutside,
91
- onEscapeKeyDown: _onEscapeKeyDown,
92
- ...props
93
- }) {
94
- const { container, zIndexClass } = portal.useFloatingOverlayPortalProps();
95
- return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
96
- popover.Popover.Positioner,
97
- {
98
- side,
99
- align,
100
- sideOffset,
101
- className: zIndexClass,
102
- children: /* @__PURE__ */ jsxRuntime.jsxs(
103
- popover.Popover.Popup,
104
- {
105
- "data-slot": "popover-content",
106
- className: cn(
107
- `bg-popover text-popover-foreground origin-(--transform-origin) w-72 rounded-md border p-4 shadow-md outline-hidden
108
- transition-[scale,opacity,translate] duration-150 ease-out data-starting-style:scale-95
109
- data-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0
110
- data-[side=bottom]:data-starting-style:-translate-y-2
111
- data-[side=left]:data-starting-style:translate-x-2
112
- data-[side=right]:data-starting-style:-translate-x-2
113
- data-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,
114
- className
115
- ),
116
- ...props,
117
- children: [
118
- children,
119
- showArrow && /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Arrow, { className: "fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]" })
120
- ]
121
- }
122
- )
123
- }
124
- ) });
125
- }
126
- function Separator({ className, orientation = "horizontal", decorative: _decorative, ...props }) {
127
- return /* @__PURE__ */ jsxRuntime.jsx(
128
- separator.Separator,
129
- {
130
- "data-slot": "separator-root",
131
- orientation,
132
- className: cn("bg-border shrink-0", orientation === "horizontal" ? "h-px w-full" : "h-full w-px", className),
133
- ...props
134
- }
135
- );
136
- }
137
- var multiSelectVariants = classVarianceAuthority.cva("m-0.5 inline-flex items-center gap-0.5 rounded-full border px-2 py-1 text-xs", {
138
- variants: {
139
- variant: {
140
- default: "border-foreground/10 text-foreground bg-card",
141
- secondary: "border-foreground/10 bg-secondary text-secondary-foreground",
142
- destructive: "border-transparent bg-destructive text-destructive-foreground",
143
- inverted: "inverted"
144
- }
145
- },
146
- defaultVariants: {
147
- variant: "default"
148
- }
15
+ //#region src/components/multi-select.tsx
16
+ /**
17
+ * Variants for the multi-select component to handle different styles.
18
+ * Uses class-variance-authority (cva) to define different styles based on "variant" prop.
19
+ */
20
+ const multiSelectVariants = (0, class_variance_authority.cva)("m-0.5 inline-flex items-center gap-0.5 rounded-full border px-2 py-1 text-xs", {
21
+ variants: { variant: {
22
+ default: "border-foreground/10 text-foreground bg-card",
23
+ secondary: "border-foreground/10 bg-secondary text-secondary-foreground",
24
+ destructive: "border-transparent bg-destructive text-destructive-foreground",
25
+ inverted: "inverted"
26
+ } },
27
+ defaultVariants: { variant: "default" }
149
28
  });
150
- function OptionItem({
151
- option,
152
- isSelected,
153
- onSelect,
154
- highlightedIndex,
155
- index,
156
- setHighlightedIndex
157
- }) {
158
- const isHighlighted = highlightedIndex === index;
159
- return /* @__PURE__ */ jsxRuntime.jsxs(
160
- "div",
161
- {
162
- role: "option",
163
- "aria-selected": isSelected,
164
- "aria-disabled": option.disabled,
165
- "data-highlighted": isHighlighted,
166
- "data-selected": isSelected,
167
- "data-disabled": option.disabled,
168
- tabIndex: -1,
169
- className: cn(
170
- "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
171
- "data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground",
172
- "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50"
173
- ),
174
- onClick: (e) => {
175
- e.preventDefault();
176
- e.stopPropagation();
177
- if (!option.disabled) {
178
- onSelect();
179
- }
180
- },
181
- onMouseEnter: () => setHighlightedIndex(index),
182
- children: [
183
- /* @__PURE__ */ jsxRuntime.jsx(
184
- "div",
185
- {
186
- className: cn(
187
- "border-primary mr-2 flex h-4 w-4 items-center justify-center rounded-sm border",
188
- isSelected ? "bg-primary text-primary-foreground" : "opacity-60 [&_svg]:invisible"
189
- ),
190
- "aria-hidden": "true",
191
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "h-4 w-4" })
192
- }
193
- ),
194
- option.icon && /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "text-muted-foreground mr-2 h-4 w-4", "aria-hidden": "true" }),
195
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
196
- option.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground ml-2 text-xs", children: option.description })
197
- ]
198
- }
199
- );
29
+ /**
30
+ * Individual option item component
31
+ */
32
+ function OptionItem({ option, isSelected, onSelect, highlightedIndex, index, setHighlightedIndex }) {
33
+ const isHighlighted = highlightedIndex === index;
34
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
35
+ role: "option",
36
+ "aria-selected": isSelected,
37
+ "aria-disabled": option.disabled,
38
+ "data-highlighted": isHighlighted,
39
+ "data-selected": isSelected,
40
+ "data-disabled": option.disabled,
41
+ tabIndex: -1,
42
+ className: require_utils.cn("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none", "data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground", "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50"),
43
+ onClick: (e) => {
44
+ e.preventDefault();
45
+ e.stopPropagation();
46
+ if (!option.disabled) onSelect();
47
+ },
48
+ onMouseEnter: () => setHighlightedIndex(index),
49
+ children: [
50
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
51
+ className: require_utils.cn("border-primary mr-2 flex h-4 w-4 items-center justify-center rounded-sm border", isSelected ? "bg-primary text-primary-foreground" : "opacity-60 [&_svg]:invisible"),
52
+ "aria-hidden": "true",
53
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, { className: "h-4 w-4" })
54
+ }),
55
+ option.icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(option.icon, {
56
+ className: "text-muted-foreground mr-2 h-4 w-4",
57
+ "aria-hidden": "true"
58
+ }),
59
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: option.label }),
60
+ option.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61
+ className: "text-muted-foreground ml-2 text-xs",
62
+ children: option.description
63
+ })
64
+ ]
65
+ });
200
66
  }
201
- var MultiSelect = React3__namespace.forwardRef(
202
- ({
203
- options,
204
- onValueChange,
205
- variant,
206
- defaultValue = [],
207
- placeholder = "Select options",
208
- maxCount = 3,
209
- className,
210
- searchable = true,
211
- emptyIndicator,
212
- autoSize = false,
213
- singleLine = false,
214
- popoverClassName,
215
- disabled = false,
216
- responsive,
217
- minWidth,
218
- maxWidth,
219
- dropdownMaxHeight,
220
- deduplicateOptions = false,
221
- footerContent,
222
- resetOnDefaultValueChange = true,
223
- closeOnSelect = false,
224
- onClick,
225
- ...props
226
- }, ref) => {
227
- const [selectedValues, setSelectedValues] = React3__namespace.useState(defaultValue);
228
- const [isPopoverOpen, setIsPopoverOpen] = React3__namespace.useState(false);
229
- const [searchValue, setSearchValue] = React3__namespace.useState("");
230
- const [highlightedIndex, setHighlightedIndex] = React3__namespace.useState(-1);
231
- const multiSelectId = React3__namespace.useId();
232
- const listboxId = `${multiSelectId}-listbox`;
233
- const triggerDescriptionId = `${multiSelectId}-description`;
234
- const selectedCountId = `${multiSelectId}-count`;
235
- const searchInputId = `${multiSelectId}-search`;
236
- const searchInputRef = React3__namespace.useRef(null);
237
- const listRef = React3__namespace.useRef(null);
238
- const prevDefaultValueRef = React3__namespace.useRef(defaultValue);
239
- const isGroupedOptions = React3__namespace.useCallback(
240
- (opts) => {
241
- return opts.length > 0 && "heading" in opts[0];
242
- },
243
- []
244
- );
245
- const arraysEqual = React3__namespace.useCallback((a, b) => {
246
- if (a.length !== b.length) return false;
247
- const sortedA = [...a].sort();
248
- const sortedB = [...b].sort();
249
- return sortedA.every((val, index) => val === sortedB[index]);
250
- }, []);
251
- const resetToDefault = React3__namespace.useCallback(() => {
252
- setSelectedValues(defaultValue);
253
- setIsPopoverOpen(false);
254
- setSearchValue("");
255
- onValueChange(defaultValue);
256
- }, [defaultValue, onValueChange]);
257
- const buttonRef = React3__namespace.useRef(null);
258
- React3__namespace.useImperativeHandle(
259
- ref,
260
- () => ({
261
- reset: resetToDefault,
262
- getSelectedValues: () => selectedValues,
263
- setSelectedValues: (values) => {
264
- setSelectedValues(values);
265
- onValueChange(values);
266
- },
267
- clear: () => {
268
- setSelectedValues([]);
269
- onValueChange([]);
270
- },
271
- focus: () => {
272
- if (buttonRef.current) {
273
- buttonRef.current.focus();
274
- const originalOutline = buttonRef.current.style.outline;
275
- const originalOutlineOffset = buttonRef.current.style.outlineOffset;
276
- buttonRef.current.style.outline = "2px solid hsl(var(--ring))";
277
- buttonRef.current.style.outlineOffset = "2px";
278
- setTimeout(() => {
279
- if (buttonRef.current) {
280
- buttonRef.current.style.outline = originalOutline;
281
- buttonRef.current.style.outlineOffset = originalOutlineOffset;
282
- }
283
- }, 1e3);
284
- }
285
- }
286
- }),
287
- [resetToDefault, selectedValues, onValueChange]
288
- );
289
- const [screenSize, setScreenSize] = React3__namespace.useState("desktop");
290
- React3__namespace.useEffect(() => {
291
- if (typeof window === "undefined") return;
292
- const handleResize = () => {
293
- const width = window.innerWidth;
294
- if (width < 640) {
295
- setScreenSize("mobile");
296
- } else if (width < 1024) {
297
- setScreenSize("tablet");
298
- } else {
299
- setScreenSize("desktop");
300
- }
301
- };
302
- handleResize();
303
- window.addEventListener("resize", handleResize);
304
- return () => {
305
- if (typeof window !== "undefined") {
306
- window.removeEventListener("resize", handleResize);
307
- }
308
- };
309
- }, []);
310
- const getResponsiveSettings = () => {
311
- if (!responsive) {
312
- return {
313
- maxCount,
314
- hideIcons: false,
315
- compactMode: false
316
- };
317
- }
318
- if (responsive === true) {
319
- const defaultResponsive = {
320
- mobile: { maxCount: 2, hideIcons: false, compactMode: true },
321
- tablet: { maxCount: 4, hideIcons: false, compactMode: false },
322
- desktop: { maxCount: 6, hideIcons: false, compactMode: false }
323
- };
324
- const currentSettings2 = defaultResponsive[screenSize];
325
- return {
326
- maxCount: currentSettings2?.maxCount ?? maxCount,
327
- hideIcons: currentSettings2?.hideIcons ?? false,
328
- compactMode: currentSettings2?.compactMode ?? false
329
- };
330
- }
331
- const currentSettings = responsive[screenSize];
332
- return {
333
- maxCount: currentSettings?.maxCount ?? maxCount,
334
- hideIcons: currentSettings?.hideIcons ?? false,
335
- compactMode: currentSettings?.compactMode ?? false
336
- };
337
- };
338
- const responsiveSettings = getResponsiveSettings();
339
- const getAllOptions = React3__namespace.useCallback(() => {
340
- if (options.length === 0) return [];
341
- let allOptions;
342
- if (isGroupedOptions(options)) {
343
- allOptions = options.flatMap((group) => group.options);
344
- } else {
345
- allOptions = options;
346
- }
347
- const valueSet = /* @__PURE__ */ new Set();
348
- const duplicates = [];
349
- const uniqueOptions = [];
350
- allOptions.forEach((option) => {
351
- if (valueSet.has(option.value)) {
352
- duplicates.push(option.value);
353
- if (!deduplicateOptions) {
354
- uniqueOptions.push(option);
355
- }
356
- } else {
357
- valueSet.add(option.value);
358
- uniqueOptions.push(option);
359
- }
360
- });
361
- if (process.env.NODE_ENV === "development" && duplicates.length > 0) {
362
- const action = deduplicateOptions ? "automatically removed" : "detected";
363
- console.warn(
364
- `MultiSelect: Duplicate option values ${action}: ${duplicates.join(", ")}. ${deduplicateOptions ? "Duplicates have been removed automatically." : "This may cause unexpected behavior. Consider setting 'deduplicateOptions={true}' or ensure all option values are unique."}`
365
- );
366
- }
367
- return deduplicateOptions ? uniqueOptions : allOptions;
368
- }, [options, deduplicateOptions, isGroupedOptions]);
369
- const getOptionByValue = React3__namespace.useCallback(
370
- (value) => {
371
- const option = getAllOptions().find((option2) => option2.value === value);
372
- if (!option && process.env.NODE_ENV === "development") {
373
- console.warn(`MultiSelect: Option with value "${value}" not found in options list`);
374
- }
375
- return option;
376
- },
377
- [getAllOptions]
378
- );
379
- const filteredOptions = React3__namespace.useMemo(() => {
380
- if (!searchable || !searchValue) return options;
381
- if (options.length === 0) return [];
382
- if (isGroupedOptions(options)) {
383
- return options.map((group) => ({
384
- ...group,
385
- options: group.options.filter(
386
- (option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) || option.value.toLowerCase().includes(searchValue.toLowerCase())
387
- )
388
- })).filter((group) => group.options.length > 0);
389
- }
390
- return options.filter(
391
- (option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) || option.value.toLowerCase().includes(searchValue.toLowerCase())
392
- );
393
- }, [options, searchValue, searchable, isGroupedOptions]);
394
- const flatFilteredOptions = React3__namespace.useMemo(() => {
395
- if (isGroupedOptions(filteredOptions)) {
396
- return filteredOptions.flatMap((group) => group.options);
397
- }
398
- return filteredOptions;
399
- }, [filteredOptions, isGroupedOptions]);
400
- const toggleOption = React3__namespace.useCallback(
401
- (optionValue) => {
402
- if (disabled) return;
403
- const option = getOptionByValue(optionValue);
404
- if (option?.disabled) return;
405
- const newSelectedValues = selectedValues.includes(optionValue) ? selectedValues.filter((value) => value !== optionValue) : [...selectedValues, optionValue];
406
- setSelectedValues(newSelectedValues);
407
- onValueChange(newSelectedValues);
408
- if (closeOnSelect) {
409
- setIsPopoverOpen(false);
410
- }
411
- },
412
- [disabled, getOptionByValue, selectedValues, onValueChange, closeOnSelect]
413
- );
414
- const handleClear = () => {
415
- if (disabled) return;
416
- setSelectedValues([]);
417
- onValueChange([]);
418
- };
419
- const handleTogglePopover = () => {
420
- if (disabled) return;
421
- setIsPopoverOpen((prev) => !prev);
422
- };
423
- const clearExtraOptions = () => {
424
- if (disabled) return;
425
- const newSelectedValues = selectedValues.slice(0, responsiveSettings.maxCount);
426
- setSelectedValues(newSelectedValues);
427
- onValueChange(newSelectedValues);
428
- };
429
- const handleKeyDown = React3__namespace.useCallback(
430
- (event) => {
431
- const optionsCount = flatFilteredOptions.length;
432
- if (optionsCount === 0) return;
433
- switch (event.key) {
434
- case "ArrowDown":
435
- event.preventDefault();
436
- setHighlightedIndex((prev) => prev < optionsCount - 1 ? prev + 1 : 0);
437
- break;
438
- case "ArrowUp":
439
- event.preventDefault();
440
- setHighlightedIndex((prev) => prev > 0 ? prev - 1 : optionsCount - 1);
441
- break;
442
- case "Enter":
443
- event.preventDefault();
444
- if (highlightedIndex >= 0 && highlightedIndex < optionsCount) {
445
- const option = flatFilteredOptions[highlightedIndex];
446
- if (option && !option.disabled) {
447
- toggleOption(option.value);
448
- }
449
- }
450
- break;
451
- case "Escape":
452
- event.preventDefault();
453
- setIsPopoverOpen(false);
454
- break;
455
- case "Backspace":
456
- if (!searchValue && selectedValues.length > 0) {
457
- const newSelectedValues = [...selectedValues];
458
- newSelectedValues.pop();
459
- setSelectedValues(newSelectedValues);
460
- onValueChange(newSelectedValues);
461
- }
462
- break;
463
- }
464
- },
465
- [flatFilteredOptions, highlightedIndex, toggleOption, searchValue, selectedValues, onValueChange]
466
- );
467
- React3__namespace.useEffect(() => {
468
- if (!resetOnDefaultValueChange) return;
469
- const prevDefaultValue = prevDefaultValueRef.current;
470
- if (!arraysEqual(prevDefaultValue, defaultValue)) {
471
- if (!arraysEqual(selectedValues, defaultValue)) {
472
- setSelectedValues(defaultValue);
473
- }
474
- prevDefaultValueRef.current = [...defaultValue];
475
- }
476
- }, [defaultValue, selectedValues, arraysEqual, resetOnDefaultValueChange]);
477
- const getWidthConstraints = () => {
478
- const defaultMinWidth = screenSize === "mobile" ? "0px" : "200px";
479
- const effectiveMinWidth = minWidth || defaultMinWidth;
480
- const effectiveMaxWidth = maxWidth || "100%";
481
- return {
482
- minWidth: effectiveMinWidth,
483
- maxWidth: effectiveMaxWidth,
484
- width: autoSize ? "auto" : "100%"
485
- };
486
- };
487
- const widthConstraints = getWidthConstraints();
488
- const effectiveDropdownMaxHeight = React3__namespace.useMemo(() => {
489
- if (dropdownMaxHeight) return dropdownMaxHeight;
490
- return screenSize === "mobile" ? "70vh" : "60vh";
491
- }, [dropdownMaxHeight, screenSize]);
492
- React3__namespace.useEffect(() => {
493
- if (!isPopoverOpen) {
494
- setSearchValue("");
495
- setHighlightedIndex(-1);
496
- }
497
- }, [isPopoverOpen]);
498
- React3__namespace.useEffect(() => {
499
- if (isPopoverOpen && searchable && searchInputRef.current) {
500
- const timer = setTimeout(() => {
501
- searchInputRef.current?.focus();
502
- }, 0);
503
- return () => clearTimeout(timer);
504
- }
505
- }, [isPopoverOpen, searchable]);
506
- React3__namespace.useEffect(() => {
507
- setHighlightedIndex(flatFilteredOptions.length > 0 ? 0 : -1);
508
- }, [searchValue, flatFilteredOptions.length]);
509
- const totalFilteredCount = React3__namespace.useMemo(() => {
510
- if (isGroupedOptions(filteredOptions)) {
511
- return filteredOptions.reduce((acc, group) => acc + group.options.length, 0);
512
- }
513
- return filteredOptions.length;
514
- }, [filteredOptions, isGroupedOptions]);
515
- let optionIndex = 0;
516
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isPopoverOpen, onOpenChange: setIsPopoverOpen, children: [
517
- /* @__PURE__ */ jsxRuntime.jsx("div", { id: triggerDescriptionId, className: "sr-only", children: "Multi-select dropdown. Use arrow keys to navigate, Enter to select, and Escape to close." }),
518
- /* @__PURE__ */ jsxRuntime.jsx("div", { id: selectedCountId, className: "sr-only", "aria-live": "polite", children: selectedValues.length === 0 ? "No options selected" : `${selectedValues.length} option${selectedValues.length === 1 ? "" : "s"} selected: ${selectedValues.map((value) => getOptionByValue(value)?.label).filter(Boolean).join(", ")}` }),
519
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
520
- "button",
521
- {
522
- ref: buttonRef,
523
- type: "button",
524
- ...props,
525
- onClick: (event) => {
526
- if (disabled) return;
527
- onClick?.(event);
528
- handleTogglePopover();
529
- },
530
- disabled,
531
- role: "combobox",
532
- "aria-expanded": isPopoverOpen,
533
- "aria-haspopup": "listbox",
534
- "aria-controls": isPopoverOpen ? listboxId : void 0,
535
- "aria-describedby": `${triggerDescriptionId} ${selectedCountId}`,
536
- "aria-label": `Multi-select: ${selectedValues.length} of ${getAllOptions().length} options selected. ${placeholder}`,
537
- className: cn(
538
- `border-input/70 focus-visible:border-primary/60 focus-visible:ring-primary/20 flex items-center
67
+ const MultiSelect = react.forwardRef(({ options, onValueChange, variant, defaultValue = [], placeholder = "Select options", maxCount = 3, className, searchable = true, emptyIndicator, autoSize = false, singleLine = false, popoverClassName, disabled = false, responsive, minWidth, maxWidth, dropdownMaxHeight, deduplicateOptions = false, footerContent, resetOnDefaultValueChange = true, closeOnSelect = false, onClick, ...props }, ref) => {
68
+ const [selectedValues, setSelectedValues] = react.useState(defaultValue);
69
+ const [isPopoverOpen, setIsPopoverOpen] = react.useState(false);
70
+ const [searchValue, setSearchValue] = react.useState("");
71
+ const [highlightedIndex, setHighlightedIndex] = react.useState(-1);
72
+ const multiSelectId = react.useId();
73
+ const listboxId = `${multiSelectId}-listbox`;
74
+ const triggerDescriptionId = `${multiSelectId}-description`;
75
+ const selectedCountId = `${multiSelectId}-count`;
76
+ const searchInputId = `${multiSelectId}-search`;
77
+ const searchInputRef = react.useRef(null);
78
+ const listRef = react.useRef(null);
79
+ const prevDefaultValueRef = react.useRef(defaultValue);
80
+ const isGroupedOptions = react.useCallback((opts) => {
81
+ return opts.length > 0 && "heading" in opts[0];
82
+ }, []);
83
+ const arraysEqual = react.useCallback((a, b) => {
84
+ if (a.length !== b.length) return false;
85
+ const sortedA = [...a].sort();
86
+ const sortedB = [...b].sort();
87
+ return sortedA.every((val, index) => val === sortedB[index]);
88
+ }, []);
89
+ const resetToDefault = react.useCallback(() => {
90
+ setSelectedValues(defaultValue);
91
+ setIsPopoverOpen(false);
92
+ setSearchValue("");
93
+ onValueChange(defaultValue);
94
+ }, [defaultValue, onValueChange]);
95
+ const buttonRef = react.useRef(null);
96
+ react.useImperativeHandle(ref, () => ({
97
+ reset: resetToDefault,
98
+ getSelectedValues: () => selectedValues,
99
+ setSelectedValues: (values) => {
100
+ setSelectedValues(values);
101
+ onValueChange(values);
102
+ },
103
+ clear: () => {
104
+ setSelectedValues([]);
105
+ onValueChange([]);
106
+ },
107
+ focus: () => {
108
+ if (buttonRef.current) {
109
+ buttonRef.current.focus();
110
+ const originalOutline = buttonRef.current.style.outline;
111
+ const originalOutlineOffset = buttonRef.current.style.outlineOffset;
112
+ buttonRef.current.style.outline = "2px solid hsl(var(--ring))";
113
+ buttonRef.current.style.outlineOffset = "2px";
114
+ setTimeout(() => {
115
+ if (buttonRef.current) {
116
+ buttonRef.current.style.outline = originalOutline;
117
+ buttonRef.current.style.outlineOffset = originalOutlineOffset;
118
+ }
119
+ }, 1e3);
120
+ }
121
+ }
122
+ }), [
123
+ resetToDefault,
124
+ selectedValues,
125
+ onValueChange
126
+ ]);
127
+ const [screenSize, setScreenSize] = react.useState("desktop");
128
+ react.useEffect(() => {
129
+ if (typeof window === "undefined") return;
130
+ const handleResize = () => {
131
+ const width = window.innerWidth;
132
+ if (width < 640) setScreenSize("mobile");
133
+ else if (width < 1024) setScreenSize("tablet");
134
+ else setScreenSize("desktop");
135
+ };
136
+ handleResize();
137
+ window.addEventListener("resize", handleResize);
138
+ return () => {
139
+ if (typeof window !== "undefined") window.removeEventListener("resize", handleResize);
140
+ };
141
+ }, []);
142
+ const getResponsiveSettings = () => {
143
+ if (!responsive) return {
144
+ maxCount,
145
+ hideIcons: false,
146
+ compactMode: false
147
+ };
148
+ if (responsive === true) {
149
+ const currentSettings = {
150
+ mobile: {
151
+ maxCount: 2,
152
+ hideIcons: false,
153
+ compactMode: true
154
+ },
155
+ tablet: {
156
+ maxCount: 4,
157
+ hideIcons: false,
158
+ compactMode: false
159
+ },
160
+ desktop: {
161
+ maxCount: 6,
162
+ hideIcons: false,
163
+ compactMode: false
164
+ }
165
+ }[screenSize];
166
+ return {
167
+ maxCount: currentSettings?.maxCount ?? maxCount,
168
+ hideIcons: currentSettings?.hideIcons ?? false,
169
+ compactMode: currentSettings?.compactMode ?? false
170
+ };
171
+ }
172
+ const currentSettings = responsive[screenSize];
173
+ return {
174
+ maxCount: currentSettings?.maxCount ?? maxCount,
175
+ hideIcons: currentSettings?.hideIcons ?? false,
176
+ compactMode: currentSettings?.compactMode ?? false
177
+ };
178
+ };
179
+ const responsiveSettings = getResponsiveSettings();
180
+ const getAllOptions = react.useCallback(() => {
181
+ if (options.length === 0) return [];
182
+ let allOptions;
183
+ if (isGroupedOptions(options)) allOptions = options.flatMap((group) => group.options);
184
+ else allOptions = options;
185
+ const valueSet = /* @__PURE__ */ new Set();
186
+ const duplicates = [];
187
+ const uniqueOptions = [];
188
+ allOptions.forEach((option) => {
189
+ if (valueSet.has(option.value)) {
190
+ duplicates.push(option.value);
191
+ if (!deduplicateOptions) uniqueOptions.push(option);
192
+ } else {
193
+ valueSet.add(option.value);
194
+ uniqueOptions.push(option);
195
+ }
196
+ });
197
+ if (process.env.NODE_ENV === "development" && duplicates.length > 0) console.warn(`MultiSelect: Duplicate option values ${deduplicateOptions ? "automatically removed" : "detected"}: ${duplicates.join(", ")}. ${deduplicateOptions ? "Duplicates have been removed automatically." : "This may cause unexpected behavior. Consider setting 'deduplicateOptions={true}' or ensure all option values are unique."}`);
198
+ return deduplicateOptions ? uniqueOptions : allOptions;
199
+ }, [
200
+ options,
201
+ deduplicateOptions,
202
+ isGroupedOptions
203
+ ]);
204
+ const getOptionByValue = react.useCallback((value) => {
205
+ const option = getAllOptions().find((option) => option.value === value);
206
+ if (!option && process.env.NODE_ENV === "development") console.warn(`MultiSelect: Option with value "${value}" not found in options list`);
207
+ return option;
208
+ }, [getAllOptions]);
209
+ const filteredOptions = react.useMemo(() => {
210
+ if (!searchable || !searchValue) return options;
211
+ if (options.length === 0) return [];
212
+ if (isGroupedOptions(options)) return options.map((group) => ({
213
+ ...group,
214
+ options: group.options.filter((option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) || option.value.toLowerCase().includes(searchValue.toLowerCase()))
215
+ })).filter((group) => group.options.length > 0);
216
+ return options.filter((option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) || option.value.toLowerCase().includes(searchValue.toLowerCase()));
217
+ }, [
218
+ options,
219
+ searchValue,
220
+ searchable,
221
+ isGroupedOptions
222
+ ]);
223
+ const flatFilteredOptions = react.useMemo(() => {
224
+ if (isGroupedOptions(filteredOptions)) return filteredOptions.flatMap((group) => group.options);
225
+ return filteredOptions;
226
+ }, [filteredOptions, isGroupedOptions]);
227
+ const toggleOption = react.useCallback((optionValue) => {
228
+ if (disabled) return;
229
+ if (getOptionByValue(optionValue)?.disabled) return;
230
+ const newSelectedValues = selectedValues.includes(optionValue) ? selectedValues.filter((value) => value !== optionValue) : [...selectedValues, optionValue];
231
+ setSelectedValues(newSelectedValues);
232
+ onValueChange(newSelectedValues);
233
+ if (closeOnSelect) setIsPopoverOpen(false);
234
+ }, [
235
+ disabled,
236
+ getOptionByValue,
237
+ selectedValues,
238
+ onValueChange,
239
+ closeOnSelect
240
+ ]);
241
+ const handleClear = () => {
242
+ if (disabled) return;
243
+ setSelectedValues([]);
244
+ onValueChange([]);
245
+ };
246
+ const handleTogglePopover = () => {
247
+ if (disabled) return;
248
+ setIsPopoverOpen((prev) => !prev);
249
+ };
250
+ const clearExtraOptions = () => {
251
+ if (disabled) return;
252
+ const newSelectedValues = selectedValues.slice(0, responsiveSettings.maxCount);
253
+ setSelectedValues(newSelectedValues);
254
+ onValueChange(newSelectedValues);
255
+ };
256
+ const handleKeyDown = react.useCallback((event) => {
257
+ const optionsCount = flatFilteredOptions.length;
258
+ if (optionsCount === 0) return;
259
+ switch (event.key) {
260
+ case "ArrowDown":
261
+ event.preventDefault();
262
+ setHighlightedIndex((prev) => prev < optionsCount - 1 ? prev + 1 : 0);
263
+ break;
264
+ case "ArrowUp":
265
+ event.preventDefault();
266
+ setHighlightedIndex((prev) => prev > 0 ? prev - 1 : optionsCount - 1);
267
+ break;
268
+ case "Enter":
269
+ event.preventDefault();
270
+ if (highlightedIndex >= 0 && highlightedIndex < optionsCount) {
271
+ const option = flatFilteredOptions[highlightedIndex];
272
+ if (option && !option.disabled) toggleOption(option.value);
273
+ }
274
+ break;
275
+ case "Escape":
276
+ event.preventDefault();
277
+ setIsPopoverOpen(false);
278
+ break;
279
+ case "Backspace":
280
+ if (!searchValue && selectedValues.length > 0) {
281
+ const newSelectedValues = [...selectedValues];
282
+ newSelectedValues.pop();
283
+ setSelectedValues(newSelectedValues);
284
+ onValueChange(newSelectedValues);
285
+ }
286
+ break;
287
+ }
288
+ }, [
289
+ flatFilteredOptions,
290
+ highlightedIndex,
291
+ toggleOption,
292
+ searchValue,
293
+ selectedValues,
294
+ onValueChange
295
+ ]);
296
+ react.useEffect(() => {
297
+ if (!resetOnDefaultValueChange) return;
298
+ const prevDefaultValue = prevDefaultValueRef.current;
299
+ if (!arraysEqual(prevDefaultValue, defaultValue)) {
300
+ if (!arraysEqual(selectedValues, defaultValue)) setSelectedValues(defaultValue);
301
+ prevDefaultValueRef.current = [...defaultValue];
302
+ }
303
+ }, [
304
+ defaultValue,
305
+ selectedValues,
306
+ arraysEqual,
307
+ resetOnDefaultValueChange
308
+ ]);
309
+ const getWidthConstraints = () => {
310
+ return {
311
+ minWidth: minWidth || (screenSize === "mobile" ? "0px" : "200px"),
312
+ maxWidth: maxWidth || "100%",
313
+ width: autoSize ? "auto" : "100%"
314
+ };
315
+ };
316
+ const widthConstraints = getWidthConstraints();
317
+ const effectiveDropdownMaxHeight = react.useMemo(() => {
318
+ if (dropdownMaxHeight) return dropdownMaxHeight;
319
+ return screenSize === "mobile" ? "70vh" : "60vh";
320
+ }, [dropdownMaxHeight, screenSize]);
321
+ react.useEffect(() => {
322
+ if (!isPopoverOpen) {
323
+ setSearchValue("");
324
+ setHighlightedIndex(-1);
325
+ }
326
+ }, [isPopoverOpen]);
327
+ react.useEffect(() => {
328
+ if (isPopoverOpen && searchable && searchInputRef.current) {
329
+ const timer = setTimeout(() => {
330
+ searchInputRef.current?.focus();
331
+ }, 0);
332
+ return () => clearTimeout(timer);
333
+ }
334
+ }, [isPopoverOpen, searchable]);
335
+ react.useEffect(() => {
336
+ setHighlightedIndex(flatFilteredOptions.length > 0 ? 0 : -1);
337
+ }, [searchValue, flatFilteredOptions.length]);
338
+ const totalFilteredCount = react.useMemo(() => {
339
+ if (isGroupedOptions(filteredOptions)) return filteredOptions.reduce((acc, group) => acc + group.options.length, 0);
340
+ return filteredOptions.length;
341
+ }, [filteredOptions, isGroupedOptions]);
342
+ let optionIndex = 0;
343
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_popover.Popover, {
344
+ open: isPopoverOpen,
345
+ onOpenChange: setIsPopoverOpen,
346
+ children: [
347
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
348
+ id: triggerDescriptionId,
349
+ className: "sr-only",
350
+ children: "Multi-select dropdown. Use arrow keys to navigate, Enter to select, and Escape to close."
351
+ }),
352
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
353
+ id: selectedCountId,
354
+ className: "sr-only",
355
+ "aria-live": "polite",
356
+ children: selectedValues.length === 0 ? "No options selected" : `${selectedValues.length} option${selectedValues.length === 1 ? "" : "s"} selected: ${selectedValues.map((value) => getOptionByValue(value)?.label).filter(Boolean).join(", ")}`
357
+ }),
358
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_popover.PopoverTrigger, {
359
+ asChild: true,
360
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
361
+ ref: buttonRef,
362
+ type: "button",
363
+ ...props,
364
+ onClick: (event) => {
365
+ if (disabled) return;
366
+ onClick?.(event);
367
+ handleTogglePopover();
368
+ },
369
+ disabled,
370
+ role: "combobox",
371
+ "aria-expanded": isPopoverOpen,
372
+ "aria-haspopup": "listbox",
373
+ "aria-controls": isPopoverOpen ? listboxId : void 0,
374
+ "aria-describedby": `${triggerDescriptionId} ${selectedCountId}`,
375
+ "aria-label": `Multi-select: ${selectedValues.length} of ${getAllOptions().length} options selected. ${placeholder}`,
376
+ className: require_utils.cn(`border-input/70 focus-visible:border-primary/60 focus-visible:ring-primary/20 flex items-center
539
377
  justify-between rounded-md border bg-transparent pr-1 pl-2 shadow-xs transition-[color,box-shadow,scale]
540
378
  duration-150 ease-out outline-none focus-visible:ring-[3px] motion-safe:active:not-disabled:scale-[0.96]
541
- motion-reduce:transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50`,
542
- singleLine ? "h-8 min-h-8 py-0.5 text-xs" : "h-auto min-h-10 py-2 text-sm",
543
- autoSize && "w-auto",
544
- !autoSize && "w-full",
545
- responsiveSettings.compactMode && "min-h-9 py-1.5 text-xs",
546
- className
547
- ),
548
- style: {
549
- minWidth: widthConstraints.minWidth,
550
- maxWidth: widthConstraints.maxWidth,
551
- width: widthConstraints.width
552
- },
553
- children: selectedValues.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [
554
- /* @__PURE__ */ jsxRuntime.jsxs(
555
- "div",
556
- {
557
- className: cn(
558
- "flex items-center gap-1",
559
- singleLine ? "multiselect-singleline-scroll overflow-x-auto" : "flex-wrap",
560
- responsiveSettings.compactMode && "gap-0.5"
561
- ),
562
- children: [
563
- selectedValues.slice(0, responsiveSettings.maxCount).map((value) => {
564
- const option = getOptionByValue(value);
565
- const IconComponent = option?.icon;
566
- const customStyle = option?.style;
567
- if (!option) {
568
- return null;
569
- }
570
- const badgeStyle = {
571
- ...customStyle?.badgeColor && {
572
- backgroundColor: customStyle.badgeColor
573
- },
574
- ...customStyle?.gradient && {
575
- background: customStyle.gradient,
576
- color: "white"
577
- }
578
- };
579
- return /* @__PURE__ */ jsxRuntime.jsxs(
580
- Badge,
581
- {
582
- className: cn(
583
- multiSelectVariants({ variant }),
584
- customStyle?.gradient && "border-transparent text-white",
585
- responsiveSettings.compactMode && "px-1.5 py-0.5 text-xs",
586
- singleLine && "py-0.5",
587
- screenSize === "mobile" && "max-w-[120px] truncate",
588
- singleLine && "flex-shrink-0 whitespace-nowrap",
589
- "[&>svg]:pointer-events-auto"
590
- ),
591
- style: badgeStyle,
592
- children: [
593
- IconComponent && !responsiveSettings.hideIcons && /* @__PURE__ */ jsxRuntime.jsx(
594
- IconComponent,
595
- {
596
- className: cn(
597
- "mr-2 h-4 w-4",
598
- responsiveSettings.compactMode && "mr-1 h-3 w-3",
599
- customStyle?.iconColor && "text-current"
600
- ),
601
- ...customStyle?.iconColor && {
602
- style: { color: customStyle.iconColor }
603
- }
604
- }
605
- ),
606
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(screenSize === "mobile" && "truncate"), children: option.label }),
607
- /* @__PURE__ */ jsxRuntime.jsx(
608
- "div",
609
- {
610
- role: "button",
611
- tabIndex: 0,
612
- onClick: (event) => {
613
- event.stopPropagation();
614
- toggleOption(value);
615
- },
616
- onKeyDown: (event) => {
617
- if (event.key === "Enter" || event.key === " ") {
618
- event.preventDefault();
619
- event.stopPropagation();
620
- toggleOption(value);
621
- }
622
- },
623
- "aria-label": `Remove ${option.label} from selection`,
624
- className: "-m-0.5 ml-2 h-4 w-4 cursor-pointer rounded-sm p-0.5 hover:bg-white/20 focus:ring-1 focus:ring-white/50 focus:outline-none",
625
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: cn("h-3 w-3", responsiveSettings.compactMode && "h-2.5 w-2.5") })
626
- }
627
- )
628
- ]
629
- },
630
- value
631
- );
632
- }).filter(Boolean),
633
- selectedValues.length > responsiveSettings.maxCount && /* @__PURE__ */ jsxRuntime.jsxs(
634
- Badge,
635
- {
636
- className: cn(
637
- "text-foreground border-foreground/10 bg-transparent",
638
- multiSelectVariants({ variant }),
639
- responsiveSettings.compactMode && "px-1.5 py-0.5 text-xs",
640
- singleLine && "flex-shrink-0 whitespace-nowrap",
641
- "[&>svg]:pointer-events-auto"
642
- ),
643
- children: [
644
- `+ ${selectedValues.length - responsiveSettings.maxCount} more`,
645
- /* @__PURE__ */ jsxRuntime.jsx(
646
- "div",
647
- {
648
- role: "button",
649
- tabIndex: 0,
650
- onClick: (event) => {
651
- event.stopPropagation();
652
- clearExtraOptions();
653
- },
654
- onKeyDown: (event) => {
655
- if (event.key === "Enter" || event.key === " ") {
656
- event.preventDefault();
657
- event.stopPropagation();
658
- clearExtraOptions();
659
- }
660
- },
661
- "aria-label": "Clear extra selected options",
662
- className: "-m-0.5 ml-2 h-4 w-4 cursor-pointer rounded-sm p-0.5 hover:bg-white/20 focus:ring-1\n focus:ring-white/50 focus:outline-none",
663
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: cn("h-3 w-3", responsiveSettings.compactMode && "h-2.5 w-2.5") })
664
- }
665
- )
666
- ]
667
- }
668
- )
669
- ]
670
- }
671
- ),
672
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
673
- /* @__PURE__ */ jsxRuntime.jsx(
674
- "div",
675
- {
676
- role: "button",
677
- tabIndex: 0,
678
- onClick: (event) => {
679
- event.stopPropagation();
680
- handleClear();
681
- },
682
- onKeyDown: (event) => {
683
- if (event.key === "Enter" || event.key === " ") {
684
- event.preventDefault();
685
- event.stopPropagation();
686
- handleClear();
687
- }
688
- },
689
- "aria-label": `Clear all ${selectedValues.length} selected options`,
690
- className: "text-muted-foreground hover:text-foreground focus:ring-ring mx-2 flex h-4 w-4\n cursor-pointer items-center justify-center rounded-sm focus:ring-2 focus:ring-offset-1\n focus:outline-none",
691
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "h-4 w-4" })
692
- }
693
- ),
694
- /* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "flex h-full min-h-6" }),
695
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "text-muted-foreground mx-1 h-4 cursor-pointer" })
696
- ] })
697
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto flex w-full items-center justify-between", children: [
698
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground mx-1 text-sm", children: placeholder }),
699
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "text-muted-foreground mx-1 h-4 cursor-pointer" })
700
- ] })
701
- }
702
- ) }),
703
- /* @__PURE__ */ jsxRuntime.jsx(
704
- PopoverContent,
705
- {
706
- id: listboxId,
707
- "aria-label": "Available options",
708
- className: cn("w-(--anchor-width) overflow-hidden p-0", popoverClassName),
709
- style: {
710
- minWidth: widthConstraints.minWidth,
711
- maxWidth: widthConstraints.maxWidth,
712
- width: widthConstraints.width === "auto" ? "auto" : void 0,
713
- maxHeight: effectiveDropdownMaxHeight,
714
- touchAction: "manipulation"
715
- },
716
- align: "start",
717
- onEscapeKeyDown: () => setIsPopoverOpen(false),
718
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full max-h-[inherit] flex-col", onKeyDown: handleKeyDown, children: [
719
- searchable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3", children: [
720
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "text-muted-foreground mr-2 h-4 w-4 shrink-0 opacity-50" }),
721
- /* @__PURE__ */ jsxRuntime.jsx(
722
- "input",
723
- {
724
- ref: searchInputRef,
725
- id: searchInputId,
726
- type: "text",
727
- placeholder: "Search options...",
728
- value: searchValue,
729
- onChange: (e) => setSearchValue(e.target.value),
730
- "aria-label": "Search through available options",
731
- className: "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50"
732
- }
733
- )
734
- ] }),
735
- /* @__PURE__ */ jsxRuntime.jsx(
736
- "div",
737
- {
738
- ref: listRef,
739
- role: "listbox",
740
- "aria-multiselectable": "true",
741
- className: "multiselect-scrollbar scrollbar-neutral-thin overscroll-contain min-h-0 flex-1 overflow-y-auto p-1",
742
- children: totalFilteredCount === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground py-6 text-center text-sm", children: emptyIndicator || "No results found." }) : isGroupedOptions(filteredOptions) ? filteredOptions.map((group) => /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "group", "aria-labelledby": `group-${group.heading}`, children: [
743
- /* @__PURE__ */ jsxRuntime.jsx(
744
- "div",
745
- {
746
- id: `group-${group.heading}`,
747
- className: "text-muted-foreground px-2 py-1.5 text-xs font-medium",
748
- children: group.heading
749
- }
750
- ),
751
- group.options.map((option) => {
752
- const currentIndex = optionIndex++;
753
- const isSelected = selectedValues.includes(option.value);
754
- return /* @__PURE__ */ jsxRuntime.jsx(
755
- OptionItem,
756
- {
757
- option,
758
- isSelected,
759
- onSelect: () => toggleOption(option.value),
760
- highlightedIndex,
761
- index: currentIndex,
762
- setHighlightedIndex
763
- },
764
- option.value
765
- );
766
- })
767
- ] }, group.heading)) : filteredOptions.map((option) => {
768
- const currentIndex = optionIndex++;
769
- const isSelected = selectedValues.includes(option.value);
770
- return /* @__PURE__ */ jsxRuntime.jsx(
771
- OptionItem,
772
- {
773
- option,
774
- isSelected,
775
- onSelect: () => toggleOption(option.value),
776
- highlightedIndex,
777
- index: currentIndex,
778
- setHighlightedIndex
779
- },
780
- option.value
781
- );
782
- })
783
- }
784
- ),
785
- footerContent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t p-1", children: footerContent })
786
- ] })
787
- }
788
- )
789
- ] }) });
790
- }
791
- );
379
+ motion-reduce:transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50`, singleLine ? "h-8 min-h-8 py-0.5 text-xs" : "h-auto min-h-10 py-2 text-sm", autoSize && "w-auto", !autoSize && "w-full", responsiveSettings.compactMode && "min-h-9 py-1.5 text-xs", className),
380
+ style: {
381
+ minWidth: widthConstraints.minWidth,
382
+ maxWidth: widthConstraints.maxWidth,
383
+ width: widthConstraints.width
384
+ },
385
+ children: selectedValues.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
386
+ className: "flex w-full items-center justify-between",
387
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
388
+ className: require_utils.cn("flex items-center gap-1", singleLine ? "multiselect-singleline-scroll overflow-x-auto" : "flex-wrap", responsiveSettings.compactMode && "gap-0.5"),
389
+ children: [selectedValues.slice(0, responsiveSettings.maxCount).map((value) => {
390
+ const option = getOptionByValue(value);
391
+ const IconComponent = option?.icon;
392
+ const customStyle = option?.style;
393
+ if (!option) return null;
394
+ const badgeStyle = {
395
+ ...customStyle?.badgeColor && { backgroundColor: customStyle.badgeColor },
396
+ ...customStyle?.gradient && {
397
+ background: customStyle.gradient,
398
+ color: "white"
399
+ }
400
+ };
401
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_badge.Badge, {
402
+ className: require_utils.cn(multiSelectVariants({ variant }), customStyle?.gradient && "border-transparent text-white", responsiveSettings.compactMode && "px-1.5 py-0.5 text-xs", singleLine && "py-0.5", screenSize === "mobile" && "max-w-[120px] truncate", singleLine && "flex-shrink-0 whitespace-nowrap", "[&>svg]:pointer-events-auto"),
403
+ style: badgeStyle,
404
+ children: [
405
+ IconComponent && !responsiveSettings.hideIcons && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconComponent, {
406
+ className: require_utils.cn("mr-2 h-4 w-4", responsiveSettings.compactMode && "mr-1 h-3 w-3", customStyle?.iconColor && "text-current"),
407
+ ...customStyle?.iconColor && { style: { color: customStyle.iconColor } }
408
+ }),
409
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
410
+ className: require_utils.cn(screenSize === "mobile" && "truncate"),
411
+ children: option.label
412
+ }),
413
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
414
+ role: "button",
415
+ tabIndex: 0,
416
+ onClick: (event) => {
417
+ event.stopPropagation();
418
+ toggleOption(value);
419
+ },
420
+ onKeyDown: (event) => {
421
+ if (event.key === "Enter" || event.key === " ") {
422
+ event.preventDefault();
423
+ event.stopPropagation();
424
+ toggleOption(value);
425
+ }
426
+ },
427
+ "aria-label": `Remove ${option.label} from selection`,
428
+ className: "-m-0.5 ml-2 h-4 w-4 cursor-pointer rounded-sm p-0.5 hover:bg-white/20 focus:ring-1 focus:ring-white/50 focus:outline-none",
429
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.XCircle, { className: require_utils.cn("h-3 w-3", responsiveSettings.compactMode && "h-2.5 w-2.5") })
430
+ })
431
+ ]
432
+ }, value);
433
+ }).filter(Boolean), selectedValues.length > responsiveSettings.maxCount && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_badge.Badge, {
434
+ className: require_utils.cn("text-foreground border-foreground/10 bg-transparent", multiSelectVariants({ variant }), responsiveSettings.compactMode && "px-1.5 py-0.5 text-xs", singleLine && "flex-shrink-0 whitespace-nowrap", "[&>svg]:pointer-events-auto"),
435
+ children: [`+ ${selectedValues.length - responsiveSettings.maxCount} more`, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
436
+ role: "button",
437
+ tabIndex: 0,
438
+ onClick: (event) => {
439
+ event.stopPropagation();
440
+ clearExtraOptions();
441
+ },
442
+ onKeyDown: (event) => {
443
+ if (event.key === "Enter" || event.key === " ") {
444
+ event.preventDefault();
445
+ event.stopPropagation();
446
+ clearExtraOptions();
447
+ }
448
+ },
449
+ "aria-label": "Clear extra selected options",
450
+ className: "-m-0.5 ml-2 h-4 w-4 cursor-pointer rounded-sm p-0.5 hover:bg-white/20 focus:ring-1\n focus:ring-white/50 focus:outline-none",
451
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.XCircle, { className: require_utils.cn("h-3 w-3", responsiveSettings.compactMode && "h-2.5 w-2.5") })
452
+ })]
453
+ })]
454
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
455
+ className: "flex items-center justify-between",
456
+ children: [
457
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
458
+ role: "button",
459
+ tabIndex: 0,
460
+ onClick: (event) => {
461
+ event.stopPropagation();
462
+ handleClear();
463
+ },
464
+ onKeyDown: (event) => {
465
+ if (event.key === "Enter" || event.key === " ") {
466
+ event.preventDefault();
467
+ event.stopPropagation();
468
+ handleClear();
469
+ }
470
+ },
471
+ "aria-label": `Clear all ${selectedValues.length} selected options`,
472
+ className: "text-muted-foreground hover:text-foreground focus:ring-ring mx-2 flex h-4 w-4\n cursor-pointer items-center justify-center rounded-sm focus:ring-2 focus:ring-offset-1\n focus:outline-none",
473
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.XIcon, { className: "h-4 w-4" })
474
+ }),
475
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_separator.Separator, {
476
+ orientation: "vertical",
477
+ className: "flex h-full min-h-6"
478
+ }),
479
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "text-muted-foreground mx-1 h-4 cursor-pointer" })
480
+ ]
481
+ })]
482
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
483
+ className: "mx-auto flex w-full items-center justify-between",
484
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
485
+ className: "text-muted-foreground mx-1 text-sm",
486
+ children: placeholder
487
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "text-muted-foreground mx-1 h-4 cursor-pointer" })]
488
+ })
489
+ })
490
+ }),
491
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_popover.PopoverContent, {
492
+ id: listboxId,
493
+ "aria-label": "Available options",
494
+ className: require_utils.cn("w-(--anchor-width) overflow-hidden p-0", popoverClassName),
495
+ style: {
496
+ minWidth: widthConstraints.minWidth,
497
+ maxWidth: widthConstraints.maxWidth,
498
+ width: widthConstraints.width === "auto" ? "auto" : void 0,
499
+ maxHeight: effectiveDropdownMaxHeight,
500
+ touchAction: "manipulation"
501
+ },
502
+ align: "start",
503
+ onEscapeKeyDown: () => setIsPopoverOpen(false),
504
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
505
+ className: "flex h-full max-h-[inherit] flex-col",
506
+ onKeyDown: handleKeyDown,
507
+ children: [
508
+ searchable && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
509
+ className: "flex items-center border-b px-3",
510
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchIcon, { className: "text-muted-foreground mr-2 h-4 w-4 shrink-0 opacity-50" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
511
+ ref: searchInputRef,
512
+ id: searchInputId,
513
+ type: "text",
514
+ placeholder: "Search options...",
515
+ value: searchValue,
516
+ onChange: (e) => setSearchValue(e.target.value),
517
+ "aria-label": "Search through available options",
518
+ className: "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50"
519
+ })]
520
+ }),
521
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
522
+ ref: listRef,
523
+ role: "listbox",
524
+ "aria-multiselectable": "true",
525
+ className: "multiselect-scrollbar scrollbar-neutral-thin overscroll-contain min-h-0 flex-1 overflow-y-auto p-1",
526
+ children: totalFilteredCount === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
527
+ className: "text-muted-foreground py-6 text-center text-sm",
528
+ children: emptyIndicator || "No results found."
529
+ }) : isGroupedOptions(filteredOptions) ? filteredOptions.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
530
+ role: "group",
531
+ "aria-labelledby": `group-${group.heading}`,
532
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
533
+ id: `group-${group.heading}`,
534
+ className: "text-muted-foreground px-2 py-1.5 text-xs font-medium",
535
+ children: group.heading
536
+ }), group.options.map((option) => {
537
+ const currentIndex = optionIndex++;
538
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionItem, {
539
+ option,
540
+ isSelected: selectedValues.includes(option.value),
541
+ onSelect: () => toggleOption(option.value),
542
+ highlightedIndex,
543
+ index: currentIndex,
544
+ setHighlightedIndex
545
+ }, option.value);
546
+ })]
547
+ }, group.heading)) : filteredOptions.map((option) => {
548
+ const currentIndex = optionIndex++;
549
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionItem, {
550
+ option,
551
+ isSelected: selectedValues.includes(option.value),
552
+ onSelect: () => toggleOption(option.value),
553
+ highlightedIndex,
554
+ index: currentIndex,
555
+ setHighlightedIndex
556
+ }, option.value);
557
+ })
558
+ }),
559
+ footerContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
560
+ className: "border-t p-1",
561
+ children: footerContent
562
+ })
563
+ ]
564
+ })
565
+ })
566
+ ]
567
+ }) });
568
+ });
792
569
  MultiSelect.displayName = "MultiSelect";
793
570
 
571
+ //#endregion
794
572
  exports.MultiSelect = MultiSelect;
795
- //# sourceMappingURL=multi-select.cjs.map
796
573
  //# sourceMappingURL=multi-select.cjs.map