@tulip-systems/core 0.6.0 → 0.7.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 (567) hide show
  1. package/LICENSE +662 -0
  2. package/dist/commands/client.d.mts +2 -1
  3. package/dist/commands/client.mjs +2 -1
  4. package/dist/components/client.d.mts +19 -3
  5. package/dist/components/client.mjs +18 -2
  6. package/dist/components/editor/components/menu-nodes.client.mjs +3 -3
  7. package/dist/components/editor/components/menu-nodes.client.mjs.map +1 -1
  8. package/dist/components/editor/components/menu.client.mjs +3 -3
  9. package/dist/components/editor/components/menu.client.mjs.map +1 -1
  10. package/dist/components/emails/forget-password-email.mjs +6 -6
  11. package/dist/components/emails/forget-password-email.mjs.map +1 -1
  12. package/dist/components/header/back-button.client.mjs +2 -2
  13. package/dist/components/header/back-button.client.mjs.map +1 -1
  14. package/dist/components/header/bottom-bar.client.mjs +2 -2
  15. package/dist/components/header/bottom-bar.client.mjs.map +1 -1
  16. package/dist/components/header/breadcrumbs.client.mjs +1 -1
  17. package/dist/components/header/breadcrumbs.client.mjs.map +1 -1
  18. package/dist/components/header/header.client.mjs +1 -1
  19. package/dist/components/header/header.client.mjs.map +1 -1
  20. package/dist/components/layouts/empty-page.mjs +2 -2
  21. package/dist/components/layouts/empty-page.mjs.map +1 -1
  22. package/dist/components/layouts/error-page.mjs +3 -3
  23. package/dist/components/layouts/error-page.mjs.map +1 -1
  24. package/dist/components/layouts/providers.client.d.mts.map +1 -1
  25. package/dist/components/layouts/providers.client.mjs +3 -2
  26. package/dist/components/layouts/providers.client.mjs.map +1 -1
  27. package/dist/components/layouts/root-loading.mjs +2 -2
  28. package/dist/components/layouts/root-loading.mjs.map +1 -1
  29. package/dist/components/layouts/tab-layout.mjs +1 -1
  30. package/dist/components/layouts/tab-layout.mjs.map +1 -1
  31. package/dist/components/lists/data-list.mjs +1 -1
  32. package/dist/components/lists/data-list.mjs.map +1 -1
  33. package/dist/components/lists/data-stack.mjs +1 -1
  34. package/dist/components/lists/data-stack.mjs.map +1 -1
  35. package/dist/components/navigation/admin-sidebar-header.client.mjs +3 -3
  36. package/dist/components/navigation/admin-sidebar-header.client.mjs.map +1 -1
  37. package/dist/components/navigation/admin-sidebar-skeleton.mjs +1 -1
  38. package/dist/components/navigation/admin-sidebar-skeleton.mjs.map +1 -1
  39. package/dist/components/ui/accordion.client.d.mts +26 -0
  40. package/dist/components/ui/accordion.client.d.mts.map +1 -0
  41. package/dist/components/ui/accordion.client.mjs +58 -0
  42. package/dist/components/ui/accordion.client.mjs.map +1 -0
  43. package/dist/components/ui/alert-dialog.client.d.mts +61 -0
  44. package/dist/components/ui/alert-dialog.client.d.mts.map +1 -0
  45. package/dist/components/ui/alert-dialog.client.mjs +104 -0
  46. package/dist/components/ui/alert-dialog.client.mjs.map +1 -0
  47. package/dist/components/ui/alert.d.mts +5 -1
  48. package/dist/components/ui/alert.d.mts.map +1 -1
  49. package/dist/components/ui/alert.mjs +13 -6
  50. package/dist/components/ui/alert.mjs.map +1 -1
  51. package/dist/components/ui/aspect-ratio.client.d.mts +10 -0
  52. package/dist/components/ui/aspect-ratio.client.d.mts.map +1 -0
  53. package/dist/components/ui/aspect-ratio.client.mjs +16 -0
  54. package/dist/components/ui/aspect-ratio.client.mjs.map +1 -0
  55. package/dist/components/ui/avatar.client.d.mts +21 -6
  56. package/dist/components/ui/avatar.client.d.mts.map +1 -1
  57. package/dist/components/ui/avatar.client.mjs +31 -9
  58. package/dist/components/ui/avatar.client.mjs.map +1 -1
  59. package/dist/components/ui/badge.d.mts +1 -1
  60. package/dist/components/ui/badge.d.mts.map +1 -1
  61. package/dist/components/ui/badge.mjs +11 -8
  62. package/dist/components/ui/badge.mjs.map +1 -1
  63. package/dist/components/ui/breadcrumb.d.mts +3 -1
  64. package/dist/components/ui/breadcrumb.d.mts.map +1 -1
  65. package/dist/components/ui/breadcrumb.mjs +7 -7
  66. package/dist/components/ui/breadcrumb.mjs.map +1 -1
  67. package/dist/components/ui/button-group.d.mts +29 -0
  68. package/dist/components/ui/button-group.d.mts.map +1 -0
  69. package/dist/components/ui/button-group.mjs +41 -0
  70. package/dist/components/ui/button-group.mjs.map +1 -0
  71. package/dist/components/ui/button.d.mts +1 -1
  72. package/dist/components/ui/button.d.mts.map +1 -1
  73. package/dist/components/ui/button.mjs +19 -13
  74. package/dist/components/ui/button.mjs.map +1 -1
  75. package/dist/components/ui/{calendar.d.mts → calendar.client.d.mts} +7 -4
  76. package/dist/components/ui/calendar.client.d.mts.map +1 -0
  77. package/dist/components/ui/{calendar.mjs → calendar.client.mjs} +22 -19
  78. package/dist/components/ui/calendar.client.mjs.map +1 -0
  79. package/dist/components/ui/card.d.mts +9 -2
  80. package/dist/components/ui/card.d.mts.map +1 -1
  81. package/dist/components/ui/card.mjs +15 -7
  82. package/dist/components/ui/card.mjs.map +1 -1
  83. package/dist/components/ui/{carousel.d.mts → carousel.client.d.mts} +12 -3
  84. package/dist/components/ui/carousel.client.d.mts.map +1 -0
  85. package/dist/components/ui/{carousel.mjs → carousel.client.mjs} +10 -10
  86. package/dist/components/ui/carousel.client.mjs.map +1 -0
  87. package/dist/components/ui/chart.client.d.mts.map +1 -1
  88. package/dist/components/ui/chart.client.mjs +11 -11
  89. package/dist/components/ui/chart.client.mjs.map +1 -1
  90. package/dist/components/ui/checkbox.client.d.mts +12 -0
  91. package/dist/components/ui/checkbox.client.d.mts.map +1 -0
  92. package/dist/components/ui/checkbox.client.mjs +24 -0
  93. package/dist/components/ui/checkbox.client.mjs.map +1 -0
  94. package/dist/components/ui/collapsible.client.d.mts +6 -6
  95. package/dist/components/ui/collapsible.client.d.mts.map +1 -1
  96. package/dist/components/ui/collapsible.client.mjs +6 -6
  97. package/dist/components/ui/collapsible.client.mjs.map +1 -1
  98. package/dist/components/ui/combobox-dropdown.client.d.mts +1 -1
  99. package/dist/components/ui/combobox-dropdown.client.mjs +2 -2
  100. package/dist/components/ui/combobox-dropdown.client.mjs.map +1 -1
  101. package/dist/components/ui/combobox.client.mjs +4 -4
  102. package/dist/components/ui/combobox.client.mjs.map +1 -1
  103. package/dist/components/ui/{command.d.mts → command.client.d.mts} +8 -2
  104. package/dist/components/ui/command.client.d.mts.map +1 -0
  105. package/dist/components/ui/command.client.mjs +91 -0
  106. package/dist/components/ui/command.client.mjs.map +1 -0
  107. package/dist/components/ui/context-menu.client.d.mts +86 -0
  108. package/dist/components/ui/context-menu.client.d.mts.map +1 -0
  109. package/dist/components/ui/context-menu.client.mjs +128 -0
  110. package/dist/components/ui/context-menu.client.mjs.map +1 -0
  111. package/dist/components/ui/date-picker.client.mjs +2 -2
  112. package/dist/components/ui/date-picker.client.mjs.map +1 -1
  113. package/dist/components/ui/dialog.client.d.mts +19 -12
  114. package/dist/components/ui/dialog.client.d.mts.map +1 -1
  115. package/dist/components/ui/dialog.client.mjs +40 -29
  116. package/dist/components/ui/dialog.client.mjs.map +1 -1
  117. package/dist/components/ui/drawer.client.d.mts.map +1 -1
  118. package/dist/components/ui/drawer.client.mjs +5 -5
  119. package/dist/components/ui/drawer.client.mjs.map +1 -1
  120. package/dist/components/ui/dropdown-menu.client.d.mts +85 -0
  121. package/dist/components/ui/dropdown-menu.client.d.mts.map +1 -0
  122. package/dist/components/ui/dropdown-menu.client.mjs +131 -0
  123. package/dist/components/ui/dropdown-menu.client.mjs.map +1 -0
  124. package/dist/components/ui/empty.d.mts +36 -0
  125. package/dist/components/ui/empty.d.mts.map +1 -0
  126. package/dist/components/ui/empty.mjs +62 -0
  127. package/dist/components/ui/empty.mjs.map +1 -0
  128. package/dist/components/ui/field.client.d.mts +65 -0
  129. package/dist/components/ui/field.client.d.mts.map +1 -0
  130. package/dist/components/ui/field.client.mjs +114 -0
  131. package/dist/components/ui/field.client.mjs.map +1 -0
  132. package/dist/components/ui/form.client.d.mts +3 -4
  133. package/dist/components/ui/form.client.d.mts.map +1 -1
  134. package/dist/components/ui/form.client.mjs +4 -4
  135. package/dist/components/ui/form.client.mjs.map +1 -1
  136. package/dist/components/ui/hover-card.client.d.mts +6 -6
  137. package/dist/components/ui/hover-card.client.d.mts.map +1 -1
  138. package/dist/components/ui/hover-card.client.mjs +14 -11
  139. package/dist/components/ui/hover-card.client.mjs.map +1 -1
  140. package/dist/components/ui/{input-date-time.d.mts → input-date-time.client.d.mts} +7 -7
  141. package/dist/components/ui/input-date-time.client.d.mts.map +1 -0
  142. package/dist/components/ui/{input-date-time.mjs → input-date-time.client.mjs} +8 -8
  143. package/dist/components/ui/input-date-time.client.mjs.map +1 -0
  144. package/dist/components/ui/input-date.d.mts +1 -1
  145. package/dist/components/ui/input-date.d.mts.map +1 -1
  146. package/dist/components/ui/input-date.mjs.map +1 -1
  147. package/dist/components/ui/input-group.client.d.mts +59 -0
  148. package/dist/components/ui/input-group.client.d.mts.map +1 -0
  149. package/dist/components/ui/input-group.client.mjs +106 -0
  150. package/dist/components/ui/input-group.client.mjs.map +1 -0
  151. package/dist/components/ui/input-recipient.mjs +11 -11
  152. package/dist/components/ui/input-recipient.mjs.map +1 -1
  153. package/dist/components/ui/input-time.d.mts +1 -1
  154. package/dist/components/ui/input-time.d.mts.map +1 -1
  155. package/dist/components/ui/input-time.mjs.map +1 -1
  156. package/dist/components/ui/input.d.mts.map +1 -1
  157. package/dist/components/ui/input.mjs +1 -1
  158. package/dist/components/ui/input.mjs.map +1 -1
  159. package/dist/components/ui/item.d.mts +63 -0
  160. package/dist/components/ui/item.d.mts.map +1 -0
  161. package/dist/components/ui/item.mjs +119 -0
  162. package/dist/components/ui/item.mjs.map +1 -0
  163. package/dist/components/ui/kbd.d.mts +14 -0
  164. package/dist/components/ui/kbd.d.mts.map +1 -0
  165. package/dist/components/ui/kbd.mjs +22 -0
  166. package/dist/components/ui/kbd.mjs.map +1 -0
  167. package/dist/components/ui/label.d.mts +4 -4
  168. package/dist/components/ui/label.d.mts.map +1 -1
  169. package/dist/components/ui/label.mjs +5 -5
  170. package/dist/components/ui/label.mjs.map +1 -1
  171. package/dist/components/ui/loader.d.mts +7 -0
  172. package/dist/components/ui/loader.d.mts.map +1 -0
  173. package/dist/components/ui/loader.mjs +63 -0
  174. package/dist/components/ui/loader.mjs.map +1 -0
  175. package/dist/components/ui/navigation-menu.d.mts +11 -11
  176. package/dist/components/ui/navigation-menu.d.mts.map +1 -1
  177. package/dist/components/ui/navigation-menu.mjs +18 -20
  178. package/dist/components/ui/navigation-menu.mjs.map +1 -1
  179. package/dist/components/ui/pagination.d.mts +8 -2
  180. package/dist/components/ui/pagination.d.mts.map +1 -1
  181. package/dist/components/ui/pagination.mjs +29 -21
  182. package/dist/components/ui/pagination.mjs.map +1 -1
  183. package/dist/components/ui/popover.client.d.mts +35 -0
  184. package/dist/components/ui/popover.client.d.mts.map +1 -0
  185. package/dist/components/ui/popover.client.mjs +59 -0
  186. package/dist/components/ui/popover.client.mjs.map +1 -0
  187. package/dist/components/ui/progress.client.d.mts +4 -4
  188. package/dist/components/ui/progress.client.d.mts.map +1 -1
  189. package/dist/components/ui/progress.client.mjs +7 -7
  190. package/dist/components/ui/progress.client.mjs.map +1 -1
  191. package/dist/components/ui/radio-group.d.mts +5 -5
  192. package/dist/components/ui/radio-group.d.mts.map +1 -1
  193. package/dist/components/ui/radio-group.mjs +10 -11
  194. package/dist/components/ui/radio-group.mjs.map +1 -1
  195. package/dist/components/ui/resizable.client.d.mts +3 -4
  196. package/dist/components/ui/resizable.client.d.mts.map +1 -1
  197. package/dist/components/ui/resizable.client.mjs +5 -9
  198. package/dist/components/ui/resizable.client.mjs.map +1 -1
  199. package/dist/components/ui/scroll-area.d.mts +5 -5
  200. package/dist/components/ui/scroll-area.d.mts.map +1 -1
  201. package/dist/components/ui/scroll-area.mjs +12 -11
  202. package/dist/components/ui/scroll-area.mjs.map +1 -1
  203. package/dist/components/ui/select.client.d.mts +18 -13
  204. package/dist/components/ui/select.client.d.mts.map +1 -1
  205. package/dist/components/ui/select.client.mjs +37 -32
  206. package/dist/components/ui/select.client.mjs.map +1 -1
  207. package/dist/components/ui/separator.d.mts +4 -4
  208. package/dist/components/ui/separator.d.mts.map +1 -1
  209. package/dist/components/ui/separator.mjs +6 -6
  210. package/dist/components/ui/separator.mjs.map +1 -1
  211. package/dist/components/ui/sheet.client.d.mts +9 -7
  212. package/dist/components/ui/sheet.client.d.mts.map +1 -1
  213. package/dist/components/ui/sheet.client.mjs +30 -20
  214. package/dist/components/ui/sheet.client.mjs.map +1 -1
  215. package/dist/components/ui/sidebar.client.mjs +28 -28
  216. package/dist/components/ui/sidebar.client.mjs.map +1 -1
  217. package/dist/components/ui/skeleton.mjs +1 -1
  218. package/dist/components/ui/skeleton.mjs.map +1 -1
  219. package/dist/components/ui/slider.d.mts +4 -4
  220. package/dist/components/ui/slider.d.mts.map +1 -1
  221. package/dist/components/ui/slider.mjs +11 -11
  222. package/dist/components/ui/slider.mjs.map +1 -1
  223. package/dist/components/ui/spinner.d.mts +10 -0
  224. package/dist/components/ui/spinner.d.mts.map +1 -0
  225. package/dist/components/ui/spinner.mjs +9 -55
  226. package/dist/components/ui/spinner.mjs.map +1 -1
  227. package/dist/components/ui/switch.client.d.mts +15 -0
  228. package/dist/components/ui/switch.client.d.mts.map +1 -0
  229. package/dist/components/ui/switch.client.mjs +23 -0
  230. package/dist/components/ui/switch.client.mjs.map +1 -0
  231. package/dist/components/ui/tabs.client.d.mts +31 -0
  232. package/dist/components/ui/tabs.client.d.mts.map +1 -0
  233. package/dist/components/ui/tabs.client.mjs +49 -0
  234. package/dist/components/ui/tabs.client.mjs.map +1 -0
  235. package/dist/components/ui/textarea.d.mts.map +1 -1
  236. package/dist/components/ui/textarea.mjs +1 -1
  237. package/dist/components/ui/textarea.mjs.map +1 -1
  238. package/dist/components/ui/toggle-group.client.d.mts +11 -6
  239. package/dist/components/ui/toggle-group.client.d.mts.map +1 -1
  240. package/dist/components/ui/toggle-group.client.mjs +20 -12
  241. package/dist/components/ui/toggle-group.client.mjs.map +1 -1
  242. package/dist/components/ui/{toggle.d.mts → toggle.client.d.mts} +6 -6
  243. package/dist/components/ui/toggle.client.d.mts.map +1 -0
  244. package/dist/components/ui/toggle.client.mjs +40 -0
  245. package/dist/components/ui/toggle.client.mjs.map +1 -0
  246. package/dist/components/ui/tooltip.client.d.mts +7 -7
  247. package/dist/components/ui/tooltip.client.d.mts.map +1 -1
  248. package/dist/components/ui/tooltip.client.mjs +10 -10
  249. package/dist/components/ui/tooltip.client.mjs.map +1 -1
  250. package/dist/components.d.mts +12 -20
  251. package/dist/components.mjs +12 -20
  252. package/dist/inline-edit/client.d.mts +3 -3
  253. package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
  254. package/dist/lib/hooks/use-indicator.mjs +11 -8
  255. package/dist/lib/hooks/use-indicator.mjs.map +1 -1
  256. package/dist/modules/auth/components/auth-layout.server.mjs +3 -3
  257. package/dist/modules/auth/components/auth-layout.server.mjs.map +1 -1
  258. package/dist/modules/auth/components/create-first-user-page.client.mjs +3 -3
  259. package/dist/modules/auth/components/create-first-user-page.client.mjs.map +1 -1
  260. package/dist/modules/auth/components/forget-password-page.client.mjs +1 -1
  261. package/dist/modules/auth/components/forget-password-page.client.mjs.map +1 -1
  262. package/dist/modules/auth/components/login-page.client.mjs +5 -5
  263. package/dist/modules/auth/components/login-page.client.mjs.map +1 -1
  264. package/dist/modules/auth/components/reset-password-page.client.mjs +5 -5
  265. package/dist/modules/auth/components/reset-password-page.client.mjs.map +1 -1
  266. package/dist/modules/commands/components/alert-dialog-command.client.d.mts +9 -9
  267. package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
  268. package/dist/modules/commands/components/alert-dialog-command.client.mjs +3 -3
  269. package/dist/modules/commands/components/alert-dialog-command.client.mjs.map +1 -1
  270. package/dist/modules/commands/components/click-command.client.mjs +2 -2
  271. package/dist/modules/commands/components/click-command.client.mjs.map +1 -1
  272. package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
  273. package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
  274. package/dist/modules/commands/components/dialog-command.client.mjs +2 -2
  275. package/dist/modules/commands/components/dialog-command.client.mjs.map +1 -1
  276. package/dist/modules/commands/components/dropdown-command.client.mjs +2 -2
  277. package/dist/modules/commands/components/dropdown-command.client.mjs.map +1 -1
  278. package/dist/modules/commands/components/empty-command.client.mjs +2 -2
  279. package/dist/modules/commands/components/empty-command.client.mjs.map +1 -1
  280. package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -9
  281. package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
  282. package/dist/modules/commands/components/form-dialog-command.client.mjs +8 -6
  283. package/dist/modules/commands/components/form-dialog-command.client.mjs.map +1 -1
  284. package/dist/modules/commands/hooks/use-command-menu.client.d.mts +8 -1
  285. package/dist/modules/commands/hooks/use-command-menu.client.d.mts.map +1 -1
  286. package/dist/modules/commands/hooks/use-command-menu.client.mjs.map +1 -1
  287. package/dist/modules/commands/menus/context-menu.client.d.mts +3 -3
  288. package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
  289. package/dist/modules/commands/menus/context-menu.client.mjs +1 -1
  290. package/dist/modules/commands/menus/context-menu.client.mjs.map +1 -1
  291. package/dist/modules/commands/menus/dropdown-menu.client.mjs +2 -2
  292. package/dist/modules/commands/menus/dropdown-menu.client.mjs.map +1 -1
  293. package/dist/modules/commands/menus/floating-menu.client.d.mts +19 -0
  294. package/dist/modules/commands/menus/floating-menu.client.d.mts.map +1 -0
  295. package/dist/modules/commands/menus/{data-table-menu.client.mjs → floating-menu.client.mjs} +11 -11
  296. package/dist/modules/commands/menus/floating-menu.client.mjs.map +1 -0
  297. package/dist/modules/commands/utils/archive-command.client.mjs +1 -1
  298. package/dist/modules/commands/utils/archive-command.client.mjs.map +1 -1
  299. package/dist/modules/commands/utils/delete-command.client.mjs +1 -1
  300. package/dist/modules/commands/utils/delete-command.client.mjs.map +1 -1
  301. package/dist/modules/data-tables/components/cell/select.client.mjs +1 -1
  302. package/dist/modules/data-tables/components/cell/select.client.mjs.map +1 -1
  303. package/dist/modules/data-tables/components/column-header.mjs +5 -5
  304. package/dist/modules/data-tables/components/column-header.mjs.map +1 -1
  305. package/dist/modules/data-tables/components/filters/combobox.client.mjs +6 -6
  306. package/dist/modules/data-tables/components/filters/combobox.client.mjs.map +1 -1
  307. package/dist/modules/data-tables/components/filters/slider.client.mjs +2 -2
  308. package/dist/modules/data-tables/components/filters/slider.client.mjs.map +1 -1
  309. package/dist/modules/data-tables/components/header.mjs +1 -1
  310. package/dist/modules/data-tables/components/header.mjs.map +1 -1
  311. package/dist/modules/data-tables/components/skeleton.mjs +2 -2
  312. package/dist/modules/data-tables/components/skeleton.mjs.map +1 -1
  313. package/dist/modules/data-tables/components/table.mjs +3 -3
  314. package/dist/modules/data-tables/components/table.mjs.map +1 -1
  315. package/dist/modules/data-tables/components/toolbar.mjs +1 -1
  316. package/dist/modules/data-tables/components/toolbar.mjs.map +1 -1
  317. package/dist/modules/data-tables/strategies/pagination/components.mjs +3 -3
  318. package/dist/modules/data-tables/strategies/pagination/components.mjs.map +1 -1
  319. package/dist/modules/data-tables/tables/data-table/components/table.mjs +8 -2
  320. package/dist/modules/data-tables/tables/data-table/components/table.mjs.map +1 -1
  321. package/dist/modules/data-tables/tables/inline-table/components/cells/common.mjs +1 -1
  322. package/dist/modules/data-tables/tables/inline-table/components/cells/common.mjs.map +1 -1
  323. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.mjs +1 -1
  324. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.mjs.map +1 -1
  325. package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.mjs +1 -1
  326. package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.mjs.map +1 -1
  327. package/dist/modules/data-tables/tables/inline-table/components/table.mjs +8 -2
  328. package/dist/modules/data-tables/tables/inline-table/components/table.mjs.map +1 -1
  329. package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs +5 -1
  330. package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs.map +1 -1
  331. package/dist/modules/inline-edit/components/combobox.client.mjs +5 -1
  332. package/dist/modules/inline-edit/components/combobox.client.mjs.map +1 -1
  333. package/dist/modules/inline-edit/components/date-input.client.mjs +8 -4
  334. package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
  335. package/dist/modules/inline-edit/components/date-picker.client.mjs +7 -3
  336. package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
  337. package/dist/modules/inline-edit/components/date-time.client.d.mts +1 -1
  338. package/dist/modules/inline-edit/components/date-time.client.d.mts.map +1 -1
  339. package/dist/modules/inline-edit/components/date-time.client.mjs +7 -2
  340. package/dist/modules/inline-edit/components/date-time.client.mjs.map +1 -1
  341. package/dist/modules/inline-edit/components/editor.client.mjs +5 -1
  342. package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
  343. package/dist/modules/inline-edit/components/input-recipient.client.mjs +5 -1
  344. package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
  345. package/dist/modules/inline-edit/components/input-toggle.client.mjs +7 -3
  346. package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
  347. package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
  348. package/dist/modules/inline-edit/components/input.client.mjs +18 -6
  349. package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
  350. package/dist/modules/inline-edit/components/select.client.d.mts +8 -11
  351. package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
  352. package/dist/modules/inline-edit/components/select.client.mjs +5 -1
  353. package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
  354. package/dist/modules/inline-edit/components/switch.client.d.mts +3 -2
  355. package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
  356. package/dist/modules/inline-edit/components/switch.client.mjs +6 -2
  357. package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
  358. package/dist/modules/inline-edit/components/toggle.client.mjs +6 -2
  359. package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
  360. package/dist/modules/inline-edit/hooks/use-inline.client.d.mts +20 -5
  361. package/dist/modules/inline-edit/hooks/use-inline.client.d.mts.map +1 -1
  362. package/dist/modules/inline-edit/hooks/use-inline.client.mjs +11 -8
  363. package/dist/modules/inline-edit/hooks/use-inline.client.mjs.map +1 -1
  364. package/dist/modules/inline-edit/lib/variants.mjs +1 -1
  365. package/dist/modules/inline-edit/lib/variants.mjs.map +1 -1
  366. package/dist/modules/storage/components/dropzone.client.d.mts +2 -2
  367. package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
  368. package/dist/modules/storage/components/dropzone.client.mjs +8 -8
  369. package/dist/modules/storage/components/dropzone.client.mjs.map +1 -1
  370. package/dist/modules/storage/components/image-grid.client.mjs +5 -5
  371. package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
  372. package/dist/modules/storage/components/upload-zone-context.client.d.mts +1 -0
  373. package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
  374. package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
  375. package/dist/modules/storage/components/upload-zone.client.d.mts +2 -1
  376. package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
  377. package/dist/modules/storage/components/upload-zone.client.mjs +6 -4
  378. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  379. package/package.json +6 -31
  380. package/src/components/editor/components/menu-nodes.client.tsx +3 -3
  381. package/src/components/editor/components/menu.client.tsx +3 -3
  382. package/src/components/emails/forget-password-email.tsx +6 -6
  383. package/src/components/entry.client.ts +16 -0
  384. package/src/components/entry.ts +6 -14
  385. package/src/components/header/back-button.client.tsx +2 -2
  386. package/src/components/header/bottom-bar.client.tsx +2 -2
  387. package/src/components/header/breadcrumbs.client.tsx +1 -1
  388. package/src/components/header/header.client.tsx +1 -1
  389. package/src/components/layouts/empty-page.tsx +2 -2
  390. package/src/components/layouts/error-page.tsx +3 -3
  391. package/src/components/layouts/providers.client.tsx +8 -5
  392. package/src/components/layouts/root-loading.tsx +2 -2
  393. package/src/components/layouts/tab-layout.tsx +1 -1
  394. package/src/components/lists/data-list.tsx +1 -1
  395. package/src/components/lists/data-stack.tsx +1 -1
  396. package/src/components/navigation/admin-sidebar-header.client.tsx +3 -3
  397. package/src/components/navigation/admin-sidebar-skeleton.tsx +1 -1
  398. package/src/components/navigation/admin-sidebar.client.tsx +1 -0
  399. package/src/components/ui/accordion.client.tsx +83 -0
  400. package/src/components/ui/alert-dialog.client.tsx +181 -0
  401. package/src/components/ui/alert.tsx +15 -7
  402. package/src/components/ui/aspect-ratio.client.tsx +9 -0
  403. package/src/components/ui/avatar.client.tsx +61 -6
  404. package/src/components/ui/badge.tsx +17 -11
  405. package/src/components/ui/breadcrumb.tsx +9 -10
  406. package/src/components/ui/button-group.tsx +78 -0
  407. package/src/components/ui/button.tsx +26 -16
  408. package/src/components/ui/{calendar.tsx → calendar.client.tsx} +27 -20
  409. package/src/components/ui/card.tsx +41 -8
  410. package/src/components/ui/{carousel.tsx → carousel.client.tsx} +12 -12
  411. package/src/components/ui/chart.client.tsx +105 -103
  412. package/src/components/ui/checkbox.client.tsx +28 -0
  413. package/src/components/ui/collapsible.client.tsx +2 -2
  414. package/src/components/ui/combobox-dropdown.client.tsx +2 -2
  415. package/src/components/ui/combobox.client.tsx +6 -6
  416. package/src/components/ui/command.client.tsx +179 -0
  417. package/src/components/ui/{context-menu.tsx → context-menu.client.tsx} +86 -64
  418. package/src/components/ui/date-picker.client.tsx +2 -2
  419. package/src/components/ui/dialog.client.tsx +43 -20
  420. package/src/components/ui/drawer.client.tsx +13 -15
  421. package/src/components/ui/{dropdown-menu.tsx → dropdown-menu.client.tsx} +45 -24
  422. package/src/components/ui/empty.tsx +93 -0
  423. package/src/components/ui/field.client.tsx +224 -0
  424. package/src/components/ui/form.client.tsx +4 -4
  425. package/src/components/ui/hover-card.client.tsx +14 -13
  426. package/src/components/ui/{input-date-time.tsx → input-date-time.client.tsx} +18 -11
  427. package/src/components/ui/input-date.tsx +1 -1
  428. package/src/components/ui/input-group.client.tsx +191 -0
  429. package/src/components/ui/input-recipient.tsx +12 -12
  430. package/src/components/ui/input-time.tsx +1 -1
  431. package/src/components/ui/input.tsx +2 -4
  432. package/src/components/ui/item.tsx +182 -0
  433. package/src/components/ui/kbd.tsx +26 -0
  434. package/src/components/ui/label.tsx +2 -3
  435. package/src/components/ui/loader.tsx +51 -0
  436. package/src/components/ui/navigation-menu.tsx +14 -17
  437. package/src/components/ui/pagination.tsx +31 -26
  438. package/src/components/ui/popover.client.tsx +73 -0
  439. package/src/components/ui/progress.client.tsx +6 -4
  440. package/src/components/ui/radio-group.tsx +5 -7
  441. package/src/components/ui/resizable.client.tsx +9 -19
  442. package/src/components/ui/scroll-area.tsx +5 -7
  443. package/src/components/ui/select.client.tsx +40 -22
  444. package/src/components/ui/separator.tsx +3 -4
  445. package/src/components/ui/sheet.client.tsx +19 -18
  446. package/src/components/ui/sidebar.client.tsx +27 -27
  447. package/src/components/ui/skeleton.tsx +1 -1
  448. package/src/components/ui/slider.tsx +5 -10
  449. package/src/components/ui/spinner.tsx +12 -48
  450. package/src/components/ui/switch.client.tsx +32 -0
  451. package/src/components/ui/tabs.client.tsx +79 -0
  452. package/src/components/ui/textarea.tsx +1 -2
  453. package/src/components/ui/toggle-group.client.tsx +26 -10
  454. package/src/components/ui/toggle.client.tsx +44 -0
  455. package/src/components/ui/tooltip.client.tsx +4 -9
  456. package/src/lib/hooks/use-indicator.tsx +14 -8
  457. package/src/modules/auth/components/auth-layout.server.tsx +3 -3
  458. package/src/modules/auth/components/create-first-user-page.client.tsx +4 -4
  459. package/src/modules/auth/components/forget-password-page.client.tsx +1 -1
  460. package/src/modules/auth/components/login-page.client.tsx +6 -6
  461. package/src/modules/auth/components/reset-password-page.client.tsx +7 -7
  462. package/src/modules/commands/components/alert-dialog-command.client.tsx +20 -16
  463. package/src/modules/commands/components/click-command.client.tsx +2 -2
  464. package/src/modules/commands/components/dialog-command.client.tsx +11 -10
  465. package/src/modules/commands/components/dropdown-command.client.tsx +2 -2
  466. package/src/modules/commands/components/empty-command.client.tsx +2 -2
  467. package/src/modules/commands/components/form-dialog-command.client.tsx +29 -13
  468. package/src/modules/commands/entry.client.ts +16 -0
  469. package/src/modules/commands/hooks/use-command-menu.client.tsx +2 -0
  470. package/src/modules/commands/menus/context-menu.client.tsx +3 -4
  471. package/src/modules/commands/menus/dropdown-menu.client.tsx +2 -2
  472. package/src/modules/commands/menus/floating-menu.client.tsx +54 -0
  473. package/src/modules/commands/utils/archive-command.client.tsx +1 -1
  474. package/src/modules/commands/utils/delete-command.client.tsx +1 -1
  475. package/src/modules/data-tables/components/cell/select.client.tsx +1 -1
  476. package/src/modules/data-tables/components/column-header.tsx +5 -5
  477. package/src/modules/data-tables/components/filters/combobox.client.tsx +6 -6
  478. package/src/modules/data-tables/components/filters/slider.client.tsx +2 -2
  479. package/src/modules/data-tables/components/header.tsx +1 -1
  480. package/src/modules/data-tables/components/skeleton.tsx +2 -2
  481. package/src/modules/data-tables/components/table.tsx +3 -3
  482. package/src/modules/data-tables/components/toolbar.tsx +1 -1
  483. package/src/modules/data-tables/strategies/pagination/components.tsx +3 -3
  484. package/src/modules/data-tables/tables/data-table/components/table.tsx +11 -2
  485. package/src/modules/data-tables/tables/inline-table/components/cells/common.tsx +1 -1
  486. package/src/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.tsx +1 -1
  487. package/src/modules/data-tables/tables/inline-table/components/cells/read-only.tsx +1 -1
  488. package/src/modules/data-tables/tables/inline-table/components/table.tsx +11 -2
  489. package/src/modules/inline-edit/components/combobox-dropdown.client.tsx +4 -0
  490. package/src/modules/inline-edit/components/combobox.client.tsx +4 -0
  491. package/src/modules/inline-edit/components/date-input.client.tsx +7 -3
  492. package/src/modules/inline-edit/components/date-picker.client.tsx +6 -2
  493. package/src/modules/inline-edit/components/date-time.client.tsx +16 -2
  494. package/src/modules/inline-edit/components/editor.client.tsx +4 -0
  495. package/src/modules/inline-edit/components/input-recipient.client.tsx +4 -0
  496. package/src/modules/inline-edit/components/input-toggle.client.tsx +6 -2
  497. package/src/modules/inline-edit/components/input.client.tsx +15 -3
  498. package/src/modules/inline-edit/components/select.client.tsx +10 -20
  499. package/src/modules/inline-edit/components/switch.client.tsx +7 -3
  500. package/src/modules/inline-edit/components/toggle.client.tsx +5 -1
  501. package/src/modules/inline-edit/hooks/use-inline.client.tsx +37 -13
  502. package/src/modules/inline-edit/lib/parsers.ts +9 -0
  503. package/src/modules/inline-edit/lib/variants.ts +1 -1
  504. package/src/modules/storage/components/dropzone.client.tsx +8 -8
  505. package/src/modules/storage/components/image-grid.client.tsx +5 -5
  506. package/src/modules/storage/components/upload-zone-context.client.tsx +1 -0
  507. package/src/modules/storage/components/upload-zone.client.tsx +9 -3
  508. package/src/styles.css +1 -3
  509. package/dist/components/ui/accordion.d.mts +0 -25
  510. package/dist/components/ui/accordion.d.mts.map +0 -1
  511. package/dist/components/ui/accordion.mjs +0 -46
  512. package/dist/components/ui/accordion.mjs.map +0 -1
  513. package/dist/components/ui/alert-dialog.d.mts +0 -43
  514. package/dist/components/ui/alert-dialog.d.mts.map +0 -1
  515. package/dist/components/ui/alert-dialog.mjs +0 -84
  516. package/dist/components/ui/alert-dialog.mjs.map +0 -1
  517. package/dist/components/ui/aspect-ratio.d.mts +0 -8
  518. package/dist/components/ui/aspect-ratio.d.mts.map +0 -1
  519. package/dist/components/ui/aspect-ratio.mjs +0 -16
  520. package/dist/components/ui/aspect-ratio.mjs.map +0 -1
  521. package/dist/components/ui/calendar.d.mts.map +0 -1
  522. package/dist/components/ui/calendar.mjs.map +0 -1
  523. package/dist/components/ui/carousel.d.mts.map +0 -1
  524. package/dist/components/ui/carousel.mjs.map +0 -1
  525. package/dist/components/ui/checkbox.d.mts +0 -12
  526. package/dist/components/ui/checkbox.d.mts.map +0 -1
  527. package/dist/components/ui/checkbox.mjs +0 -24
  528. package/dist/components/ui/checkbox.mjs.map +0 -1
  529. package/dist/components/ui/command.d.mts.map +0 -1
  530. package/dist/components/ui/command.mjs +0 -88
  531. package/dist/components/ui/command.mjs.map +0 -1
  532. package/dist/components/ui/context-menu.d.mts +0 -77
  533. package/dist/components/ui/context-menu.d.mts.map +0 -1
  534. package/dist/components/ui/context-menu.mjs +0 -125
  535. package/dist/components/ui/context-menu.mjs.map +0 -1
  536. package/dist/components/ui/dropdown-menu.d.mts +0 -78
  537. package/dist/components/ui/dropdown-menu.d.mts.map +0 -1
  538. package/dist/components/ui/dropdown-menu.mjs +0 -126
  539. package/dist/components/ui/dropdown-menu.mjs.map +0 -1
  540. package/dist/components/ui/input-date-time.d.mts.map +0 -1
  541. package/dist/components/ui/input-date-time.mjs.map +0 -1
  542. package/dist/components/ui/popover.d.mts +0 -23
  543. package/dist/components/ui/popover.d.mts.map +0 -1
  544. package/dist/components/ui/popover.mjs +0 -38
  545. package/dist/components/ui/popover.mjs.map +0 -1
  546. package/dist/components/ui/switch.d.mts +0 -12
  547. package/dist/components/ui/switch.d.mts.map +0 -1
  548. package/dist/components/ui/switch.mjs +0 -22
  549. package/dist/components/ui/switch.mjs.map +0 -1
  550. package/dist/components/ui/tabs.d.mts +0 -24
  551. package/dist/components/ui/tabs.d.mts.map +0 -1
  552. package/dist/components/ui/tabs.mjs +0 -39
  553. package/dist/components/ui/tabs.mjs.map +0 -1
  554. package/dist/components/ui/toggle.d.mts.map +0 -1
  555. package/dist/components/ui/toggle.mjs +0 -40
  556. package/dist/components/ui/toggle.mjs.map +0 -1
  557. package/dist/modules/commands/menus/data-table-menu.client.mjs.map +0 -1
  558. package/src/components/ui/accordion.tsx +0 -63
  559. package/src/components/ui/alert-dialog.tsx +0 -133
  560. package/src/components/ui/aspect-ratio.tsx +0 -9
  561. package/src/components/ui/checkbox.tsx +0 -29
  562. package/src/components/ui/command.tsx +0 -154
  563. package/src/components/ui/popover.tsx +0 -42
  564. package/src/components/ui/switch.tsx +0 -28
  565. package/src/components/ui/tabs.tsx +0 -54
  566. package/src/components/ui/toggle.tsx +0 -46
  567. package/src/modules/commands/menus/data-table-menu.client.tsx +0 -46
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dialog-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/alert-dialog-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n AlertDialogCancelProps,\n AlertDialogContentProps,\n AlertDialogProps,\n} from \"@radix-ui/react-alert-dialog\";\nimport type { DefaultError, MutationOptions } from \"@tanstack/react-query\";\nimport React from \"react\";\nimport { type Keys, useHotkeys } from \"react-hotkeys-hook\";\nimport { Icons } from \"@/components/common/icons\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"@/components/ui/alert-dialog\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { useCommandMutation } from \"../hooks/use-command-mutation.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\n/**\n * CommandAlertDialogContext\n */\ntype CommandAlertDialogContextValue = {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nconst CommandAlertDialogContext = React.createContext({} as CommandAlertDialogContextValue);\n\n/**\n * CommandAlertDialog\n */\nexport function CommandAlertDialog({ children, ...props }: AlertDialogProps) {\n const [open, setOpen] = React.useState(false);\n\n return (\n <AlertDialog {...props} open={open} onOpenChange={setOpen}>\n <CommandAlertDialogContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandAlertDialogContext.Provider>\n </AlertDialog>\n );\n}\n\n/**\n * CommandAlertDialogTrigger\n */\ntype CommandAlertDialogTriggerProps = {\n children: React.ReactNode;\n className?: string;\n label?: string;\n hotkey?: Keys;\n disabled?: boolean;\n};\n\nexport function CommandAlertDialogTrigger({\n label,\n hotkey,\n children,\n disabled,\n ...props\n}: CommandAlertDialogTriggerProps) {\n const { menu, status } = useCommand();\n const { setOpen } = React.useContext(CommandAlertDialogContext);\n\n const isDisabled = disabled || status === \"pending\";\n\n useHotkeys(hotkey ?? \"\", () => setOpen(true), { enabled: !isDisabled && hotkey !== undefined });\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <AlertDialogTrigger\n {...props}\n disabled={isDisabled}\n className={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), props.className)}\n >\n {children}\n </AlertDialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <AlertDialogTrigger asChild>\n <DropdownMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n setOpen(true);\n }}\n >\n {children}\n </DropdownMenuItem>\n </AlertDialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <AlertDialogTrigger asChild>\n <ContextMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n setOpen(true);\n }}\n >\n {children}\n </ContextMenuItem>\n </AlertDialogTrigger>\n </CommandTrigger>\n );\n }\n}\n\n/**\n * CommandAlertDialogContent\n */\nexport function CommandAlertDialogContent({ children, ...props }: AlertDialogContentProps) {\n return <AlertDialogContent {...props}>{children}</AlertDialogContent>;\n}\n\n/**\n * CommandAlertDialogHeader\n */\nexport function CommandAlertDialogHeader({\n children,\n ...props\n}: React.HTMLAttributes<HTMLElement>) {\n return <AlertDialogHeader {...props}>{children}</AlertDialogHeader>;\n}\n\n/**\n * CommandAlertDialogTitle\n */\nexport function CommandAlertDialogTitle({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n return <AlertDialogTitle {...props}>{children}</AlertDialogTitle>;\n}\n\n/**\n * CommandAlertDialogDescription\n */\nexport function CommandAlertDialogDescription({\n children,\n ...props\n}: React.HTMLAttributes<HTMLElement>) {\n return <AlertDialogDescription {...props}>{children}</AlertDialogDescription>;\n}\n\n/**\n * CommandAlertDialogFooter\n */\nexport function CommandAlertDialogFooter({\n children,\n ...props\n}: React.HTMLAttributes<HTMLElement>) {\n return <AlertDialogFooter {...props}>{children}</AlertDialogFooter>;\n}\n\n/**\n * CommandAlertDialogCancel\n */\nexport function CommandAlertDialogCancel({ children, ...props }: AlertDialogCancelProps) {\n return <AlertDialogCancel {...props}>{children}</AlertDialogCancel>;\n}\n\n/**\n * CommandAlertDialogAction\n */\ntype CommandAlertDialogActionProps<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n> = {\n variables: TVariables;\n mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n};\n\nexport function CommandAlertDialogAction<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n>({\n variables,\n mutation,\n children,\n disabled,\n ...props\n}: CommandAlertDialogActionProps<TData, TError, TVariables, TOnMutateResult>) {\n const { setOpen } = React.useContext(CommandAlertDialogContext);\n const { status } = useCommand();\n\n const { mutateAsync } = useCommandMutation({\n ...mutation,\n onSuccess: async (...params) => {\n setOpen(false);\n\n return await mutation?.onSuccess?.(...params);\n },\n });\n\n const isDisabled = disabled || status === \"pending\";\n\n return (\n <AlertDialogAction {...props} disabled={isDisabled} onClick={() => mutateAsync(variables)}>\n {status === \"pending\" && <Icons.spinner className=\"mr-2 h-4 w-4 animate-spin\" />}\n {children}\n </AlertDialogAction>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsCA,MAAM,4BAA4B,MAAM,cAAc,EAAE,CAAmC;;;;AAK3F,SAAgB,mBAAmB,EAAE,UAAU,GAAG,SAA2B;CAC3E,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;AAE7C,QACE,oBAAC;EAAY,GAAI;EAAa;EAAM,cAAc;YAChD,oBAAC,0BAA0B;GA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AQ;GAAkC;;;;;AAM/E,SAAgB,yBAAyB,EACvC,UACA,GAAG,SACiC;AACpC,QAAO,oBAAC;EAAkB,GAAI;EAAQ;GAA6B;;;;;AAMrE,SAAgB,yBAAyB,EAAE,UAAU,GAAG,SAAiC;AACvF,QAAO,oBAAC;EAAkB,GAAI;EAAQ;GAA6B;;AAmBrE,SAAgB,yBAKd,EACA,WACA,UACA,UACA,UACA,GAAG,SACyE;CAC5E,MAAM,EAAE,YAAY,MAAM,WAAW,0BAA0B;CAC/D,MAAM,EAAE,WAAW,YAAY;CAE/B,MAAM,EAAE,gBAAgB,mBAAmB;EACzC,GAAG;EACH,WAAW,OAAO,GAAG,WAAW;AAC9B,WAAQ,MAAM;AAEd,UAAO,MAAM,UAAU,YAAY,GAAG,OAAO;;EAEhD,CAAC;CAEF,MAAM,aAAa,YAAY,WAAW;AAE1C,QACE,qBAAC;EAAkB,GAAI;EAAO,UAAU;EAAY,eAAe,YAAY,UAAU;aACtF,WAAW,aAAa,oBAAC,MAAM,WAAQ,WAAU,8BAA8B,EAC/E;GACiB"}
1
+ {"version":3,"file":"alert-dialog-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/alert-dialog-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DefaultError, MutationOptions } from \"@tanstack/react-query\";\nimport React, { type ComponentProps } from \"react\";\nimport { type Keys, useHotkeys } from \"react-hotkeys-hook\";\nimport { Icons } from \"@/components/common/icons\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"@/components/ui/alert-dialog.client\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu.client\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { useCommandMutation } from \"../hooks/use-command-mutation.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\n/**\n * CommandAlertDialogContext\n */\ntype CommandAlertDialogContextValue = {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nconst CommandAlertDialogContext = React.createContext({} as CommandAlertDialogContextValue);\n\n/**\n * CommandAlertDialog\n */\nexport function CommandAlertDialog({ children, ...props }: ComponentProps<typeof AlertDialog>) {\n const [open, setOpen] = React.useState(false);\n\n return (\n <AlertDialog {...props} open={open} onOpenChange={setOpen}>\n <CommandAlertDialogContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandAlertDialogContext.Provider>\n </AlertDialog>\n );\n}\n\n/**\n * CommandAlertDialogTrigger\n */\ntype CommandAlertDialogTriggerProps = {\n children: React.ReactNode;\n className?: string;\n label?: string;\n hotkey?: Keys;\n disabled?: boolean;\n};\n\nexport function CommandAlertDialogTrigger({\n label,\n hotkey,\n children,\n disabled,\n ...props\n}: CommandAlertDialogTriggerProps) {\n const { menu, status } = useCommand();\n const { setOpen } = React.useContext(CommandAlertDialogContext);\n\n const isDisabled = disabled || status === \"pending\";\n\n useHotkeys(hotkey ?? \"\", () => setOpen(true), { enabled: !isDisabled && hotkey !== undefined });\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <AlertDialogTrigger\n {...props}\n disabled={isDisabled}\n className={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), props.className)}\n >\n {children}\n </AlertDialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <AlertDialogTrigger asChild>\n <DropdownMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n setOpen(true);\n }}\n >\n {children}\n </DropdownMenuItem>\n </AlertDialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <AlertDialogTrigger asChild>\n <ContextMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n setOpen(true);\n }}\n >\n {children}\n </ContextMenuItem>\n </AlertDialogTrigger>\n </CommandTrigger>\n );\n }\n}\n\n/**\n * CommandAlertDialogContent\n */\nexport function CommandAlertDialogContent({\n children,\n ...props\n}: ComponentProps<typeof AlertDialogContent>) {\n return <AlertDialogContent {...props}>{children}</AlertDialogContent>;\n}\n\n/**\n * CommandAlertDialogHeader\n */\nexport function CommandAlertDialogHeader({\n children,\n ...props\n}: ComponentProps<typeof AlertDialogHeader>) {\n return <AlertDialogHeader {...props}>{children}</AlertDialogHeader>;\n}\n\n/**\n * CommandAlertDialogTitle\n */\nexport function CommandAlertDialogTitle({\n children,\n ...props\n}: ComponentProps<typeof AlertDialogTitle>) {\n return <AlertDialogTitle {...props}>{children}</AlertDialogTitle>;\n}\n\n/**\n * CommandAlertDialogDescription\n */\nexport function CommandAlertDialogDescription({\n children,\n ...props\n}: ComponentProps<typeof AlertDialogDescription>) {\n return <AlertDialogDescription {...props}>{children}</AlertDialogDescription>;\n}\n\n/**\n * CommandAlertDialogFooter\n */\nexport function CommandAlertDialogFooter({\n children,\n ...props\n}: ComponentProps<typeof AlertDialogFooter>) {\n return <AlertDialogFooter {...props}>{children}</AlertDialogFooter>;\n}\n\n/**\n * CommandAlertDialogCancel\n */\nexport function CommandAlertDialogCancel({\n children,\n ...props\n}: ComponentProps<typeof AlertDialogCancel>) {\n return <AlertDialogCancel {...props}>{children}</AlertDialogCancel>;\n}\n\n/**\n * CommandAlertDialogAction\n */\ntype CommandAlertDialogActionProps<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n> = {\n variables: TVariables;\n mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n};\n\nexport function CommandAlertDialogAction<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n>({\n variables,\n mutation,\n children,\n disabled,\n ...props\n}: CommandAlertDialogActionProps<TData, TError, TVariables, TOnMutateResult>) {\n const { setOpen } = React.useContext(CommandAlertDialogContext);\n const { status } = useCommand();\n\n const { mutateAsync } = useCommandMutation({\n ...mutation,\n onSuccess: async (...params) => {\n setOpen(false);\n\n return await mutation?.onSuccess?.(...params);\n },\n });\n\n const isDisabled = disabled || status === \"pending\";\n\n return (\n <AlertDialogAction {...props} disabled={isDisabled} onClick={() => mutateAsync(variables)}>\n {status === \"pending\" && <Icons.spinner className=\"mr-2 h-4 w-4 animate-spin\" />}\n {children}\n </AlertDialogAction>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAM,4BAA4B,MAAM,cAAc,EAAE,CAAmC;;;;AAK3F,SAAgB,mBAAmB,EAAE,UAAU,GAAG,SAA6C;CAC7F,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;AAE7C,QACE,oBAAC;EAAY,GAAI;EAAa;EAAM,cAAc;YAChD,oBAAC,0BAA0B;GAAS,OAAO;IAAE;IAAM;IAAS;GACzD;IACkC;GACzB;;AAelB,SAAgB,0BAA0B,EACxC,OACA,QACA,UACA,UACA,GAAG,SAC8B;CACjC,MAAM,EAAE,MAAM,WAAW,YAAY;CACrC,MAAM,EAAE,YAAY,MAAM,WAAW,0BAA0B;CAE/D,MAAM,aAAa,YAAY,WAAW;AAE1C,YAAW,UAAU,UAAU,QAAQ,KAAK,EAAE,EAAE,SAAS,CAAC,cAAc,WAAW,QAAW,CAAC;AAE/F,KAAI,SAAS,YAAY,SAAS,QAChC,QACE,oBAAC;EAAsB;YACrB,oBAAC;GACC,GAAI;GACJ,UAAU;GACV,WAAW,GAAG,eAAe;IAAE,SAAS;IAAW,MAAM;IAAM,CAAC,EAAE,MAAM,UAAU;GAEjF;IACkB;GACN;AAIrB,KAAI,SAAS,WACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAmB;aAClB,oBAAC;IACC,GAAI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,eAAe,YAAY,UAAU;aACtF,WAAW,aAAa,oBAAC,MAAM,WAAQ,WAAU,8BAA8B,EAC/E;GACiB"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
3
  import { Button } from "../../../components/ui/button.mjs";
4
- import { ContextMenuItem } from "../../../components/ui/context-menu.mjs";
5
- import { DropdownMenuItem } from "../../../components/ui/dropdown-menu.mjs";
4
+ import { ContextMenuItem } from "../../../components/ui/context-menu.client.mjs";
5
+ import { DropdownMenuItem } from "../../../components/ui/dropdown-menu.client.mjs";
6
6
  import { useCommand } from "../hooks/context.client.mjs";
7
7
  import { useCommandMutation } from "../hooks/use-command-mutation.client.mjs";
8
8
  import { CommandTrigger } from "./command-trigger.client.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"click-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/click-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DefaultError, MutationOptions } from \"@tanstack/react-query\";\nimport type React from \"react\";\nimport { type Keys, useHotkeys } from \"react-hotkeys-hook\";\nimport { Button } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { useCommandMutation } from \"../hooks/use-command-mutation.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\nexport type CommandClickProps<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n> = {\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n variables: TVariables;\n mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;\n label?: string;\n hotkey?: Keys;\n};\n\nexport function CommandClick<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n>({\n children,\n variables,\n mutation,\n label,\n hotkey,\n disabled,\n ...props\n}: CommandClickProps<TData, TError, TVariables, TOnMutateResult>) {\n const { menu, status } = useCommand();\n const { mutate } = useCommandMutation(mutation);\n\n const isDisabled = disabled || status === \"pending\";\n\n const handleClick = () => mutate(variables);\n\n useHotkeys(hotkey ?? \"\", () => handleClick(), { enabled: !isDisabled && hotkey !== undefined });\n\n if (menu === \"inline\") {\n return (\n <CommandTrigger label={label}>\n <Button {...props} variant=\"outline\" size=\"sm\" disabled={isDisabled} onClick={handleClick}>\n {children}\n </Button>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DropdownMenuItem {...props} disabled={isDisabled} onClick={handleClick}>\n {children}\n </DropdownMenuItem>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <ContextMenuItem {...props} disabled={isDisabled} onClick={handleClick}>\n {children}\n </ContextMenuItem>\n </CommandTrigger>\n );\n }\n\n if (menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <Button {...props} variant=\"outline\" size=\"sm\" disabled={isDisabled} onClick={handleClick}>\n {children}\n </Button>\n </CommandTrigger>\n );\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,aAKd,EACA,UACA,WACA,UACA,OACA,QACA,UACA,GAAG,SAC6D;CAChE,MAAM,EAAE,MAAM,WAAW,YAAY;CACrC,MAAM,EAAE,WAAW,mBAAmB,SAAS;CAE/C,MAAM,aAAa,YAAY,WAAW;CAE1C,MAAM,oBAAoB,OAAO,UAAU;AAE3C,YAAW,UAAU,UAAU,aAAa,EAAE,EAAE,SAAS,CAAC,cAAc,WAAW,QAAW,CAAC;AAE/F,KAAI,SAAS,SACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAO,GAAI;GAAO,SAAQ;GAAU,MAAK;GAAK,UAAU;GAAY,SAAS;GAC3E;IACM;GACM;AAIrB,KAAI,SAAS,WACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAiB,GAAI;GAAO,UAAU;GAAY,SAAS;GACzD;IACgB;GACJ;AAIrB,KAAI,SAAS,UACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAgB,GAAI;GAAO,UAAU;GAAY,SAAS;GACxD;IACe;GACH;AAIrB,KAAI,SAAS,QACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAO,GAAI;GAAO,SAAQ;GAAU,MAAK;GAAK,UAAU;GAAY,SAAS;GAC3E;IACM;GACM;AAIrB,QAAO"}
1
+ {"version":3,"file":"click-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/click-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DefaultError, MutationOptions } from \"@tanstack/react-query\";\nimport type React from \"react\";\nimport { type Keys, useHotkeys } from \"react-hotkeys-hook\";\nimport { Button } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu.client\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu.client\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { useCommandMutation } from \"../hooks/use-command-mutation.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\nexport type CommandClickProps<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n> = {\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n variables: TVariables;\n mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;\n label?: string;\n hotkey?: Keys;\n};\n\nexport function CommandClick<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n>({\n children,\n variables,\n mutation,\n label,\n hotkey,\n disabled,\n ...props\n}: CommandClickProps<TData, TError, TVariables, TOnMutateResult>) {\n const { menu, status } = useCommand();\n const { mutate } = useCommandMutation(mutation);\n\n const isDisabled = disabled || status === \"pending\";\n\n const handleClick = () => mutate(variables);\n\n useHotkeys(hotkey ?? \"\", () => handleClick(), { enabled: !isDisabled && hotkey !== undefined });\n\n if (menu === \"inline\") {\n return (\n <CommandTrigger label={label}>\n <Button {...props} variant=\"outline\" size=\"sm\" disabled={isDisabled} onClick={handleClick}>\n {children}\n </Button>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DropdownMenuItem {...props} disabled={isDisabled} onClick={handleClick}>\n {children}\n </DropdownMenuItem>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <ContextMenuItem {...props} disabled={isDisabled} onClick={handleClick}>\n {children}\n </ContextMenuItem>\n </CommandTrigger>\n );\n }\n\n if (menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <Button {...props} variant=\"outline\" size=\"sm\" disabled={isDisabled} onClick={handleClick}>\n {children}\n </Button>\n </CommandTrigger>\n );\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,aAKd,EACA,UACA,WACA,UACA,OACA,QACA,UACA,GAAG,SAC6D;CAChE,MAAM,EAAE,MAAM,WAAW,YAAY;CACrC,MAAM,EAAE,WAAW,mBAAmB,SAAS;CAE/C,MAAM,aAAa,YAAY,WAAW;CAE1C,MAAM,oBAAoB,OAAO,UAAU;AAE3C,YAAW,UAAU,UAAU,aAAa,EAAE,EAAE,SAAS,CAAC,cAAc,WAAW,QAAW,CAAC;AAE/F,KAAI,SAAS,SACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAO,GAAI;GAAO,SAAQ;GAAU,MAAK;GAAK,UAAU;GAAY,SAAS;GAC3E;IACM;GACM;AAIrB,KAAI,SAAS,WACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAiB,GAAI;GAAO,UAAU;GAAY,SAAS;GACzD;IACgB;GACJ;AAIrB,KAAI,SAAS,UACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAgB,GAAI;GAAO,UAAU;GAAY,SAAS;GACxD;IACe;GACH;AAIrB,KAAI,SAAS,QACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAO,GAAI;GAAO,SAAQ;GAAU,MAAK;GAAK,UAAU;GAAY,SAAS;GAC3E;IACM;GACM;AAIrB,QAAO"}
@@ -1,6 +1,6 @@
1
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../../../components/ui/dialog.client.mjs";
1
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
2
- import React from "react";
3
- import { DialogContentProps, DialogProps } from "@radix-ui/react-dialog";
3
+ import React, { ComponentProps } from "react";
4
4
  import { Keys } from "react-hotkeys-hook";
5
5
 
6
6
  //#region src/modules/commands/components/dialog-command.client.d.ts
@@ -18,7 +18,7 @@ declare function CommandDialog({
18
18
  children,
19
19
  openState,
20
20
  ...props
21
- }: Omit<DialogProps, "open" | "onOpenChange"> & {
21
+ }: Omit<ComponentProps<typeof Dialog>, "open" | "onOpenChange"> & {
22
22
  openState?: CommandDialogOpenState;
23
23
  }): react_jsx_runtime0.JSX.Element;
24
24
  /**
@@ -44,35 +44,35 @@ declare function CommandDialogTrigger({
44
44
  declare function CommandDialogContent({
45
45
  children,
46
46
  ...props
47
- }: DialogContentProps): react_jsx_runtime0.JSX.Element;
47
+ }: ComponentProps<typeof DialogContent>): react_jsx_runtime0.JSX.Element;
48
48
  /**
49
49
  * CommandDialogHeader
50
50
  */
51
51
  declare function CommandDialogHeader({
52
52
  children,
53
53
  ...props
54
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
54
+ }: ComponentProps<typeof DialogHeader>): react_jsx_runtime0.JSX.Element;
55
55
  /**
56
56
  * CommandDialogTitle
57
57
  */
58
58
  declare function CommandDialogTitle({
59
59
  children,
60
60
  ...props
61
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
61
+ }: ComponentProps<typeof DialogTitle>): react_jsx_runtime0.JSX.Element;
62
62
  /**
63
63
  * CommandDialogDescription
64
64
  */
65
65
  declare function CommandDialogDescription({
66
66
  children,
67
67
  ...props
68
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
68
+ }: ComponentProps<typeof DialogDescription>): react_jsx_runtime0.JSX.Element;
69
69
  /**
70
70
  * CommandDialogFooter
71
71
  */
72
72
  declare function CommandDialogFooter({
73
73
  children,
74
74
  ...props
75
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
75
+ }: ComponentProps<typeof DialogFooter>): react_jsx_runtime0.JSX.Element;
76
76
  //#endregion
77
77
  export { CommandDialog, CommandDialogContent, CommandDialogDescription, CommandDialogFooter, CommandDialogHeader, CommandDialogTitle, CommandDialogTrigger };
78
78
  //# sourceMappingURL=dialog-command.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-command.client.d.mts","names":[],"sources":["../../../../src/modules/commands/components/dialog-command.client.tsx"],"mappings":";;;;;;;;;KAwBK,sBAAA;EACH,IAAA;EACA,OAAA,EAAS,KAAA,CAAM,QAAA,CAAS,KAAA,CAAM,cAAA;AAAA;;;;iBAYhB,aAAA,CAAA;EACd,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,IAAA,CAAK,WAAA;EAA0C,SAAA,GAAY,sBAAA;AAAA,IAAwB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;AAJtF;KAqBK,yBAAA;EACH,QAAA,EAAU,KAAA,CAAM,SAAA;EAChB,SAAA;EACA,KAAA;EACA,MAAA,GAAS,IAAA;EACT,QAAA;AAAA;AAAA,iBAGc,oBAAA,CAAA;EACd,KAAA;EACA,MAAA;EACA,QAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAkEZ,oBAAA,CAAA;EAAuB,QAAA;EAAA,GAAa;AAAA,GAAS,kBAAA,GAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAO/D,mBAAA,CAAA;EAAsB,QAAA;EAAA,GAAa;AAAA,GAAS,KAAA,CAAM,cAAA,CAAe,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAO7E,kBAAA,CAAA;EAAqB,QAAA;EAAA,GAAa;AAAA,GAAS,KAAA,CAAM,cAAA,CAAe,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAO5E,wBAAA,CAAA;EACd,QAAA;EAAA,GACG;AAAA,GACF,KAAA,CAAM,cAAA,CAAe,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAOpB,mBAAA,CAAA;EAAsB,QAAA;EAAA,GAAa;AAAA,GAAS,KAAA,CAAM,cAAA,CAAe,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"dialog-command.client.d.mts","names":[],"sources":["../../../../src/modules/commands/components/dialog-command.client.tsx"],"mappings":";;;;;;;;;KAuBK,sBAAA;EACH,IAAA;EACA,OAAA,EAAS,KAAA,CAAM,QAAA,CAAS,KAAA,CAAM,cAAA;AAAA;;;;iBAYhB,aAAA,CAAA;EACd,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,IAAA,CAAK,cAAA,QAAsB,MAAA;EAC5B,SAAA,GAAY,sBAAA;AAAA,IACb,kBAAA,CAAA,GAAA,CAAA,OAAA;;;AAND;KAuBK,yBAAA;EACH,QAAA,EAAU,KAAA,CAAM,SAAA;EAChB,SAAA;EACA,KAAA;EACA,MAAA,GAAS,IAAA;EACT,QAAA;AAAA;AAAA,iBAGc,oBAAA,CAAA;EACd,KAAA;EACA,MAAA;EACA,QAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAkEZ,oBAAA,CAAA;EAAuB,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAsB,aAAA,IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAOjF,mBAAA,CAAA;EAAsB,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAsB,YAAA,IAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAO/E,kBAAA,CAAA;EAAqB,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAsB,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAO7E,wBAAA,CAAA;EACd,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,iBAAA,IAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA;;AA7G1C;;iBAoHe,mBAAA,CAAA;EAAsB,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAsB,YAAA,IAAa,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { cn } from "../../../lib/utils/cn.mjs";
4
4
  import { buttonVariants } from "../../../components/ui/button.mjs";
5
- import { ContextMenuItem } from "../../../components/ui/context-menu.mjs";
6
- import { DropdownMenuItem } from "../../../components/ui/dropdown-menu.mjs";
5
+ import { ContextMenuItem } from "../../../components/ui/context-menu.client.mjs";
6
+ import { DropdownMenuItem } from "../../../components/ui/dropdown-menu.client.mjs";
7
7
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "../../../components/ui/dialog.client.mjs";
8
8
  import { useCommand } from "../hooks/context.client.mjs";
9
9
  import { CommandTrigger } from "./command-trigger.client.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/dialog-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DialogContentProps, DialogProps } from \"@radix-ui/react-dialog\";\nimport React from \"react\";\nimport { type Keys, useHotkeys } from \"react-hotkeys-hook\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"@/components/ui/dialog.client\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\n/**\n * CommandDialogContext\n */\ntype CommandDialogOpenState = {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\ntype CommandDialogContextValue = {\n openState: CommandDialogOpenState;\n};\n\nconst CommandDialogContext = React.createContext({} as CommandDialogContextValue);\n\n/**\n * CommandDialog\n */\nexport function CommandDialog({\n children,\n openState,\n ...props\n}: Omit<DialogProps, \"open\" | \"onOpenChange\"> & { openState?: CommandDialogOpenState }) {\n const state = React.useState(false);\n\n const { open, setOpen } = openState ?? { open: state[0], setOpen: state[1] };\n\n return (\n <Dialog {...props} open={open} onOpenChange={setOpen}>\n <CommandDialogContext.Provider value={{ openState: { open, setOpen } }}>\n {children}\n </CommandDialogContext.Provider>\n </Dialog>\n );\n}\n\n/**\n * CommandDialogTrigger\n */\ntype CommandDialogTriggerProps = {\n children: React.ReactNode;\n className?: string;\n label?: string;\n hotkey?: Keys;\n disabled?: boolean;\n};\n\nexport function CommandDialogTrigger({\n label,\n hotkey,\n children,\n disabled,\n ...props\n}: CommandDialogTriggerProps) {\n const { menu, status } = useCommand();\n const { openState } = React.useContext(CommandDialogContext);\n\n const isDisabled = disabled || status === \"pending\";\n\n useHotkeys(hotkey ?? \"\", () => openState.setOpen(true), {\n enabled: !isDisabled && hotkey !== undefined,\n });\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger\n {...props}\n disabled={isDisabled}\n className={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), props.className)}\n >\n {children}\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger asChild>\n <DropdownMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n openState.setOpen(true);\n }}\n >\n {children}\n </DropdownMenuItem>\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger asChild>\n <ContextMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n openState.setOpen(true);\n }}\n >\n {children}\n </ContextMenuItem>\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n}\n\n/**\n * CommandDialogContent\n */\nexport function CommandDialogContent({ children, ...props }: DialogContentProps) {\n return <DialogContent {...props}>{children}</DialogContent>;\n}\n\n/**\n * CommandDialogHeader\n */\nexport function CommandDialogHeader({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n return <DialogHeader {...props}>{children}</DialogHeader>;\n}\n\n/**\n * CommandDialogTitle\n */\nexport function CommandDialogTitle({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n return <DialogTitle {...props}>{children}</DialogTitle>;\n}\n\n/**\n * CommandDialogDescription\n */\nexport function CommandDialogDescription({\n children,\n ...props\n}: React.HTMLAttributes<HTMLElement>) {\n return <DialogDescription {...props}>{children}</DialogDescription>;\n}\n\n/**\n * CommandDialogFooter\n */\nexport function CommandDialogFooter({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n return <DialogFooter {...props}>{children}</DialogFooter>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAM,uBAAuB,MAAM,cAAc,EAAE,CAA8B;;;;AAKjF,SAAgB,cAAc,EAC5B,UACA,WACA,GAAG,SACmF;CACtF,MAAM,QAAQ,MAAM,SAAS,MAAM;CAEnC,MAAM,EAAE,MAAM,YAAY,aAAa;EAAE,MAAM,MAAM;EAAI,SAAS,MAAM;EAAI;AAE5E,QACE,oBAAC;EAAO,GAAI;EAAa;EAAM,cAAc;YAC3C,oBAAC,qBAAqB;GAAS,OAAO,EAAE,WAAW;IAAE;IAAM;IAAS,EAAE;GACnE;IAC6B;GACzB;;AAeb,SAAgB,qBAAqB,EACnC,OACA,QACA,UACA,UACA,GAAG,SACyB;CAC5B,MAAM,EAAE,MAAM,WAAW,YAAY;CACrC,MA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command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/dialog-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { type ComponentProps } from \"react\";\nimport { type Keys, useHotkeys } from \"react-hotkeys-hook\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu.client\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"@/components/ui/dialog.client\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\n/**\n * CommandDialogContext\n */\ntype CommandDialogOpenState = {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\ntype CommandDialogContextValue = {\n openState: CommandDialogOpenState;\n};\n\nconst CommandDialogContext = React.createContext({} as CommandDialogContextValue);\n\n/**\n * CommandDialog\n */\nexport function CommandDialog({\n children,\n openState,\n ...props\n}: Omit<ComponentProps<typeof Dialog>, \"open\" | \"onOpenChange\"> & {\n openState?: CommandDialogOpenState;\n}) {\n const state = React.useState(false);\n\n const { open, setOpen } = openState ?? { open: state[0], setOpen: state[1] };\n\n return (\n <Dialog {...props} open={open} onOpenChange={setOpen}>\n <CommandDialogContext.Provider value={{ openState: { open, setOpen } }}>\n {children}\n </CommandDialogContext.Provider>\n </Dialog>\n );\n}\n\n/**\n * CommandDialogTrigger\n */\ntype CommandDialogTriggerProps = {\n children: React.ReactNode;\n className?: string;\n label?: string;\n hotkey?: Keys;\n disabled?: boolean;\n};\n\nexport function CommandDialogTrigger({\n label,\n hotkey,\n children,\n disabled,\n ...props\n}: CommandDialogTriggerProps) {\n const { menu, status } = useCommand();\n const { openState } = React.useContext(CommandDialogContext);\n\n const isDisabled = disabled || status === \"pending\";\n\n useHotkeys(hotkey ?? \"\", () => openState.setOpen(true), {\n enabled: !isDisabled && hotkey !== undefined,\n });\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger\n {...props}\n disabled={isDisabled}\n className={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), props.className)}\n >\n {children}\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger asChild>\n <DropdownMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n openState.setOpen(true);\n }}\n >\n {children}\n </DropdownMenuItem>\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger asChild>\n <ContextMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n openState.setOpen(true);\n }}\n >\n {children}\n </ContextMenuItem>\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n}\n\n/**\n * CommandDialogContent\n */\nexport function CommandDialogContent({ children, ...props }: ComponentProps<typeof DialogContent>) {\n return <DialogContent {...props}>{children}</DialogContent>;\n}\n\n/**\n * CommandDialogHeader\n */\nexport function CommandDialogHeader({ children, ...props }: ComponentProps<typeof DialogHeader>) {\n return <DialogHeader {...props}>{children}</DialogHeader>;\n}\n\n/**\n * CommandDialogTitle\n */\nexport function CommandDialogTitle({ children, ...props }: ComponentProps<typeof DialogTitle>) {\n return <DialogTitle {...props}>{children}</DialogTitle>;\n}\n\n/**\n * CommandDialogDescription\n */\nexport function CommandDialogDescription({\n children,\n ...props\n}: ComponentProps<typeof DialogDescription>) {\n return <DialogDescription {...props}>{children}</DialogDescription>;\n}\n\n/**\n * CommandDialogFooter\n */\nexport function CommandDialogFooter({ children, ...props }: ComponentProps<typeof DialogFooter>) {\n return <DialogFooter {...props}>{children}</DialogFooter>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,uBAAuB,MAAM,cAAc,EAAE,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;;;AAM7D,SAAgB,oBAAoB,EAAE,UAAU,GAAG,SAA8C;AAC/F,QAAO,oBAAC;EAAa,GAAI;EAAQ;GAAwB;;;;;AAM3D,SAAgB,mBAAmB,EAAE,UAAU,GAAG,SAA6C;AAC7F,QAAO,oBAAC;EAAY,GAAI;EAAQ;GAAuB;;;;;AAMzD,SAAgB,yBAAyB,EACvC,UACA,GAAG,SACwC;AAC3C,QAAO,oBAAC;EAAkB,GAAI;EAAQ;GAA6B;;;;;AAMrE,SAAgB,oBAAoB,EAAE,UAAU,GAAG,SAA8C;AAC/F,QAAO,oBAAC;EAAa,GAAI;EAAQ;GAAwB"}
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { cn } from "../../../lib/utils/cn.mjs";
4
4
  import { buttonVariants } from "../../../components/ui/button.mjs";
5
- import { ContextMenuItem, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger } from "../../../components/ui/context-menu.mjs";
6
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "../../../components/ui/dropdown-menu.mjs";
5
+ import { ContextMenuItem, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger } from "../../../components/ui/context-menu.client.mjs";
6
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "../../../components/ui/dropdown-menu.client.mjs";
7
7
  import { useCommand } from "../hooks/context.client.mjs";
8
8
  import { useCommandMutation } from "../hooks/use-command-mutation.client.mjs";
9
9
  import { CommandTrigger } from "./command-trigger.client.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/dropdown-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DefaultError, MutationOptions } from \"@tanstack/react-query\";\nimport React from \"react\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport {\n ContextMenuItem,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n} from \"@/components/ui/context-menu\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { useCommandMutation } from \"../hooks/use-command-mutation.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\n/**\n * CommandDropdownContext\n */\ntype CommandDropdownContextValue = {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nconst CommandDropdownContext = React.createContext({} as CommandDropdownContextValue);\n\n/**\n * CommandDropdown\n */\nexport type CommandDropdownProps = {\n children: React.ReactNode;\n className?: string;\n};\n\nexport function CommandDropdown({ children, ...props }: CommandDropdownProps) {\n const [open, setOpen] = React.useState(false);\n const { menu } = useCommand();\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <DropdownMenu {...props} open={open} onOpenChange={setOpen}>\n <CommandDropdownContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandDropdownContext.Provider>\n </DropdownMenu>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <DropdownMenuSub {...props} open={open} onOpenChange={setOpen}>\n <CommandDropdownContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandDropdownContext.Provider>\n </DropdownMenuSub>\n );\n }\n\n if (menu === \"context\") {\n return (\n <ContextMenuSub {...props} open={open} onOpenChange={setOpen}>\n <CommandDropdownContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandDropdownContext.Provider>\n </ContextMenuSub>\n );\n }\n\n return null;\n}\n\n/**\n * CommandDropdownContent\n */\ntype CommandDropdownContentProps = {\n children: React.ReactNode;\n className?: string;\n};\n\nexport function CommandDropdownContent({ children, ...props }: CommandDropdownContentProps) {\n const { menu } = useCommand();\n\n if (menu === \"inline\" || menu === \"table\") {\n return <DropdownMenuContent {...props}>{children}</DropdownMenuContent>;\n }\n\n if (menu === \"dropdown\") {\n return <DropdownMenuSubContent {...props}>{children}</DropdownMenuSubContent>;\n }\n\n if (menu === \"context\") {\n return <ContextMenuSubContent {...props}>{children}</ContextMenuSubContent>;\n }\n\n return null;\n}\n\n/**\n * CommandDropdownTrigger\n */\ntype CommandDropdownTriggerProps = {\n children: React.ReactNode;\n className?: string;\n label?: string;\n disabled?: boolean;\n};\n\nexport function CommandDropdownTrigger({\n label,\n disabled,\n children,\n ...props\n}: CommandDropdownTriggerProps) {\n const { menu, status } = useCommand();\n\n const isDisabled = disabled || status === \"pending\";\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <DropdownMenuTrigger\n {...props}\n disabled={isDisabled}\n className={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), props.className)}\n >\n {children}\n </DropdownMenuTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DropdownMenuSubTrigger {...props} disabled={isDisabled}>\n {children}\n </DropdownMenuSubTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <ContextMenuSubTrigger {...props} disabled={isDisabled}>\n {children}\n </ContextMenuSubTrigger>\n </CommandTrigger>\n );\n }\n\n return null;\n}\n\n/**\n * CommandDropdownItem\n */\ntype CommandDropdownItemProps<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n> = {\n variables: TVariables;\n mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;\n children: React.ReactNode;\n className?: string;\n};\n\nexport function CommandDropdownItem<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n>({\n variables,\n mutation,\n children,\n ...props\n}: CommandDropdownItemProps<TData, TError, TVariables, TOnMutateResult>) {\n const { setOpen } = React.useContext(CommandDropdownContext);\n const { menu, status } = useCommand();\n\n const { mutateAsync } = useCommandMutation({\n ...mutation,\n onSuccess: async (...params) => {\n setOpen(false);\n\n return await mutation?.onSuccess?.(...params);\n },\n });\n\n if (menu === \"inline\" || menu === \"table\" || menu === \"dropdown\") {\n return (\n <DropdownMenuItem\n {...props}\n disabled={status === \"pending\"}\n onClick={() => mutateAsync(variables)}\n >\n {children}\n </DropdownMenuItem>\n );\n }\n\n if (menu === \"context\") {\n return (\n <ContextMenuItem\n {...props}\n disabled={status === \"pending\"}\n onClick={() => mutateAsync(variables)}\n >\n {children}\n </ContextMenuItem>\n );\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,MAAM,yBAAyB,MAAM,cAAc,EAAE,CAAgC;AAUrF,SAAgB,gBAAgB,EAAE,UAAU,GAAG,SAA+B;CAC5E,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;CAC7C,MAAM,EAAE,SAAS,YAAY;AAE7B,KAAI,SAAS,YAAY,SAAS,QAChC,QACE,oBAAC;EAAa,GAAI;EAAa;EAAM,cAAc;YACjD,oBAAC,uBAAuB;GAAS,OAAO;IAAE;IAAM;IAAS;GACtD;IAC+B;GACrB;AAInB,KAAI,SAAS,WACX,QACE,oBAAC;EAAgB,GAAI;EAAa;EAAM,cAAc;YACpD,oBAAC,uBAAuB;GAAS,OAAO;IAAE;IAAM;IAAS;GACtD;IAC+B;GAClB;AAItB,KAAI,SAAS,UACX,QACE,oBAAC;EAAe,GAAI;EAAa;EAAM,cAAc;YACnD,oBAAC,uBAAuB;GAAS,OAAO;IAAE;IAAM;IAAS;GACtD;IAC+B;GACnB;AAIrB,QAAO;;AAWT,SAAgB,uBAAuB,EAAE,UAAU,GAAG,SAAsC;CAC1F,MAAM,EAAE,SAAS,YAAY;AAE7B,KAAI,SAAS,YAAY,SAAS,QAChC,QAAO,oBAAC;EAAoB,GAAI;EAAQ;GAA+B;AAGzE,KAAI,SAAS,WACX,QAAO,oBAAC;EAAuB,GAAI;EAAQ;GAAkC;AAG/E,KAAI,SAAS,UACX,QAAO,oBAAC;EAAsB,GAAI;EAAQ;GAAiC;AAG7E,QAAO;;AAaT,SAAgB,uBAAuB,EACrC,OACA,UACA,UACA,GAAG,SAC2B;CAC9B,MAAM,EAAE,MAAM,WAAW,YAAY;CAErC,MAAM,aAAa,YAAY,WAAW;AAE1C,KAAI,SAAS,YAAY,SAAS,QAChC,QACE,oBAAC;EAAsB;YACrB,oBAAC;GACC,GAAI;GACJ,UAAU;GACV,WAAW,GAAG,eAAe;IAAE,SAAS;IAAW,MAAM;IAAM,CAAC,EAAE,MAAM,UAAU;GAEjF;IACmB;GACP;AAIrB,KAAI,SAAS,WACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAuB,GAAI;GAAO,UAAU;GAC1C;IACsB;GACV;AAIrB,KAAI,SAAS,UACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAsB,GAAI;GAAO,UAAU;GACzC;IACqB;GACT;AAIrB,QAAO;;AAkBT,SAAgB,oBAKd,EACA,WACA,UACA,UACA,GAAG,SACoE;CACvE,MAAM,EAAE,YAAY,MAAM,WAAW,uBAAuB;CAC5D,MAAM,EAAE,MAAM,WAAW,YAAY;CAErC,MAAM,EAAE,gBAAgB,mBAAmB;EACzC,GAAG;EACH,WAAW,OAAO,GAAG,WAAW;AAC9B,WAAQ,MAAM;AAEd,UAAO,MAAM,UAAU,YAAY,GAAG,OAAO;;EAEhD,CAAC;AAEF,KAAI,SAAS,YAAY,SAAS,WAAW,SAAS,WACpD,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,WAAW;EACrB,eAAe,YAAY,UAAU;EAEpC;GACgB;AAIvB,KAAI,SAAS,UACX,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,WAAW;EACrB,eAAe,YAAY,UAAU;EAEpC;GACe;AAItB,QAAO"}
1
+ {"version":3,"file":"dropdown-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/dropdown-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DefaultError, MutationOptions } from \"@tanstack/react-query\";\nimport React from \"react\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport {\n ContextMenuItem,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n} from \"@/components/ui/context-menu.client\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { useCommandMutation } from \"../hooks/use-command-mutation.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\n/**\n * CommandDropdownContext\n */\ntype CommandDropdownContextValue = {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nconst CommandDropdownContext = React.createContext({} as CommandDropdownContextValue);\n\n/**\n * CommandDropdown\n */\nexport type CommandDropdownProps = {\n children: React.ReactNode;\n className?: string;\n};\n\nexport function CommandDropdown({ children, ...props }: CommandDropdownProps) {\n const [open, setOpen] = React.useState(false);\n const { menu } = useCommand();\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <DropdownMenu {...props} open={open} onOpenChange={setOpen}>\n <CommandDropdownContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandDropdownContext.Provider>\n </DropdownMenu>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <DropdownMenuSub {...props} open={open} onOpenChange={setOpen}>\n <CommandDropdownContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandDropdownContext.Provider>\n </DropdownMenuSub>\n );\n }\n\n if (menu === \"context\") {\n return (\n <ContextMenuSub {...props} open={open} onOpenChange={setOpen}>\n <CommandDropdownContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandDropdownContext.Provider>\n </ContextMenuSub>\n );\n }\n\n return null;\n}\n\n/**\n * CommandDropdownContent\n */\ntype CommandDropdownContentProps = {\n children: React.ReactNode;\n className?: string;\n};\n\nexport function CommandDropdownContent({ children, ...props }: CommandDropdownContentProps) {\n const { menu } = useCommand();\n\n if (menu === \"inline\" || menu === \"table\") {\n return <DropdownMenuContent {...props}>{children}</DropdownMenuContent>;\n }\n\n if (menu === \"dropdown\") {\n return <DropdownMenuSubContent {...props}>{children}</DropdownMenuSubContent>;\n }\n\n if (menu === \"context\") {\n return <ContextMenuSubContent {...props}>{children}</ContextMenuSubContent>;\n }\n\n return null;\n}\n\n/**\n * CommandDropdownTrigger\n */\ntype CommandDropdownTriggerProps = {\n children: React.ReactNode;\n className?: string;\n label?: string;\n disabled?: boolean;\n};\n\nexport function CommandDropdownTrigger({\n label,\n disabled,\n children,\n ...props\n}: CommandDropdownTriggerProps) {\n const { menu, status } = useCommand();\n\n const isDisabled = disabled || status === \"pending\";\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <DropdownMenuTrigger\n {...props}\n disabled={isDisabled}\n className={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), props.className)}\n >\n {children}\n </DropdownMenuTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DropdownMenuSubTrigger {...props} disabled={isDisabled}>\n {children}\n </DropdownMenuSubTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <ContextMenuSubTrigger {...props} disabled={isDisabled}>\n {children}\n </ContextMenuSubTrigger>\n </CommandTrigger>\n );\n }\n\n return null;\n}\n\n/**\n * CommandDropdownItem\n */\ntype CommandDropdownItemProps<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n> = {\n variables: TVariables;\n mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;\n children: React.ReactNode;\n className?: string;\n};\n\nexport function CommandDropdownItem<\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n>({\n variables,\n mutation,\n children,\n ...props\n}: CommandDropdownItemProps<TData, TError, TVariables, TOnMutateResult>) {\n const { setOpen } = React.useContext(CommandDropdownContext);\n const { menu, status } = useCommand();\n\n const { mutateAsync } = useCommandMutation({\n ...mutation,\n onSuccess: async (...params) => {\n setOpen(false);\n\n return await mutation?.onSuccess?.(...params);\n },\n });\n\n if (menu === \"inline\" || menu === \"table\" || menu === \"dropdown\") {\n return (\n <DropdownMenuItem\n {...props}\n disabled={status === \"pending\"}\n onClick={() => mutateAsync(variables)}\n >\n {children}\n </DropdownMenuItem>\n );\n }\n\n if (menu === \"context\") {\n return (\n <ContextMenuItem\n {...props}\n disabled={status === \"pending\"}\n onClick={() => mutateAsync(variables)}\n >\n {children}\n </ContextMenuItem>\n );\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,MAAM,yBAAyB,MAAM,cAAc,EAAE,CAAgC;AAUrF,SAAgB,gBAAgB,EAAE,UAAU,GAAG,SAA+B;CAC5E,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;CAC7C,MAAM,EAAE,SAAS,YAAY;AAE7B,KAAI,SAAS,YAAY,SAAS,QAChC,QACE,oBAAC;EAAa,GAAI;EAAa;EAAM,cAAc;YACjD,oBAAC,uBAAuB;GAAS,OAAO;IAAE;IAAM;IAAS;GACtD;IAC+B;GACrB;AAInB,KAAI,SAAS,WACX,QACE,oBAAC;EAAgB,GAAI;EAAa;EAAM,cAAc;YACpD,oBAAC,uBAAuB;GAAS,OAAO;IAAE;IAAM;IAAS;GACtD;IAC+B;GAClB;AAItB,KAAI,SAAS,UACX,QACE,oBAAC;EAAe,GAAI;EAAa;EAAM,cAAc;YACnD,oBAAC,uBAAuB;GAAS,OAAO;IAAE;IAAM;IAAS;GACtD;IAC+B;GACnB;AAIrB,QAAO;;AAWT,SAAgB,uBAAuB,EAAE,UAAU,GAAG,SAAsC;CAC1F,MAAM,EAAE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WAAW;EACrB,eAAe,YAAY,UAAU;EAEpC;GACe;AAItB,QAAO"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
3
  import { Button } from "../../../components/ui/button.mjs";
4
- import { ContextMenuItem } from "../../../components/ui/context-menu.mjs";
5
- import { DropdownMenuItem } from "../../../components/ui/dropdown-menu.mjs";
4
+ import { ContextMenuItem } from "../../../components/ui/context-menu.client.mjs";
5
+ import { DropdownMenuItem } from "../../../components/ui/dropdown-menu.client.mjs";
6
6
  import { useCommand } from "../hooks/context.client.mjs";
7
7
  import { CommandTrigger } from "./command-trigger.client.mjs";
8
8
  import { jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"empty-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/empty-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\nexport type CommandEmptyProps = {\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n label?: string;\n};\n\nexport function CommandEmpty({ label, children, disabled, ...props }: CommandEmptyProps) {\n const { menu, status } = useCommand();\n\n const isDisabled = disabled ?? status === \"pending\";\n\n if (menu === \"inline\") {\n return (\n <CommandTrigger label={label}>\n <Button {...props} variant=\"outline\" size=\"sm\" disabled={isDisabled}>\n {children}\n </Button>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DropdownMenuItem {...props} disabled={isDisabled}>\n {children}\n </DropdownMenuItem>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <ContextMenuItem {...props} disabled={isDisabled}>\n {children}\n </ContextMenuItem>\n </CommandTrigger>\n );\n }\n\n if (menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <Button {...props} variant=\"outline\" size=\"sm\" disabled={isDisabled}>\n {children}\n </Button>\n </CommandTrigger>\n );\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;AAgBA,SAAgB,aAAa,EAAE,OAAO,UAAU,UAAU,GAAG,SAA4B;CACvF,MAAM,EAAE,MAAM,WAAW,YAAY;CAErC,MAAM,aAAa,YAAY,WAAW;AAE1C,KAAI,SAAS,SACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAO,GAAI;GAAO,SAAQ;GAAU,MAAK;GAAK,UAAU;GACtD;IACM;GACM;AAIrB,KAAI,SAAS,WACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAiB,GAAI;GAAO,UAAU;GACpC;IACgB;GACJ;AAIrB,KAAI,SAAS,UACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAgB,GAAI;GAAO,UAAU;GACnC;IACe;GACH;AAIrB,KAAI,SAAS,QACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAO,GAAI;GAAO,SAAQ;GAAU,MAAK;GAAK,UAAU;GACtD;IACM;GACM;AAIrB,QAAO"}
1
+ {"version":3,"file":"empty-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/empty-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu.client\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu.client\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\nexport type CommandEmptyProps = {\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n label?: string;\n};\n\nexport function CommandEmpty({ label, children, disabled, ...props }: CommandEmptyProps) {\n const { menu, status } = useCommand();\n\n const isDisabled = disabled ?? status === \"pending\";\n\n if (menu === \"inline\") {\n return (\n <CommandTrigger label={label}>\n <Button {...props} variant=\"outline\" size=\"sm\" disabled={isDisabled}>\n {children}\n </Button>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DropdownMenuItem {...props} disabled={isDisabled}>\n {children}\n </DropdownMenuItem>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <ContextMenuItem {...props} disabled={isDisabled}>\n {children}\n </ContextMenuItem>\n </CommandTrigger>\n );\n }\n\n if (menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <Button {...props} variant=\"outline\" size=\"sm\" disabled={isDisabled}>\n {children}\n </Button>\n </CommandTrigger>\n );\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;AAgBA,SAAgB,aAAa,EAAE,OAAO,UAAU,UAAU,GAAG,SAA4B;CACvF,MAAM,EAAE,MAAM,WAAW,YAAY;CAErC,MAAM,aAAa,YAAY,WAAW;AAE1C,KAAI,SAAS,SACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAO,GAAI;GAAO,SAAQ;GAAU,MAAK;GAAK,UAAU;GACtD;IACM;GACM;AAIrB,KAAI,SAAS,WACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAiB,GAAI;GAAO,UAAU;GACpC;IACgB;GACJ;AAIrB,KAAI,SAAS,UACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAgB,GAAI;GAAO,UAAU;GACnC;IACe;GACH;AAIrB,KAAI,SAAS,QACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAO,GAAI;GAAO,SAAQ;GAAU,MAAK;GAAK,UAAU;GACtD;IACM;GACM;AAIrB,QAAO"}
@@ -1,7 +1,7 @@
1
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../../../components/ui/dialog.client.mjs";
1
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
2
3
  import React, { ComponentProps } from "react";
3
4
  import { DefaultError, MutationOptions } from "@tanstack/react-query";
4
- import { DialogContentProps, DialogProps } from "@radix-ui/react-dialog";
5
5
  import { FieldValues, Form } from "react-hook-form";
6
6
  import { Keys } from "react-hotkeys-hook";
7
7
 
@@ -12,7 +12,7 @@ import { Keys } from "react-hotkeys-hook";
12
12
  declare function CommandFormDialog({
13
13
  children,
14
14
  ...props
15
- }: DialogProps): react_jsx_runtime0.JSX.Element;
15
+ }: ComponentProps<typeof Dialog>): react_jsx_runtime0.JSX.Element;
16
16
  /**
17
17
  * CommandFormDialogTrigger
18
18
  */
@@ -36,26 +36,26 @@ declare function CommandFormDialogTrigger({
36
36
  declare function CommandFormDialogHeader({
37
37
  children,
38
38
  ...props
39
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
39
+ }: ComponentProps<typeof DialogHeader>): react_jsx_runtime0.JSX.Element;
40
40
  /**
41
41
  * CommandFormDialogTitle
42
42
  */
43
43
  declare function CommandFormDialogTitle({
44
44
  children,
45
45
  ...props
46
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
46
+ }: ComponentProps<typeof DialogTitle>): react_jsx_runtime0.JSX.Element;
47
47
  /**
48
48
  * CommandFormDialogDescription
49
49
  */
50
50
  declare function CommandFormDialogDescription({
51
51
  children,
52
52
  ...props
53
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
53
+ }: ComponentProps<typeof DialogDescription>): react_jsx_runtime0.JSX.Element;
54
54
  declare const CommandFormDialogContentProvider: typeof Form;
55
55
  /**
56
56
  * CommandFormDialogContent
57
57
  */
58
- type CommandFormDialogContentProps<TValues extends FieldValues, TData = unknown, TError = DefaultError, TVariables = undefined, TOnMutateResult = unknown> = DialogContentProps & {
58
+ type CommandFormDialogContentProps<TValues extends FieldValues, TData = unknown, TError = DefaultError, TVariables = undefined, TOnMutateResult = unknown> = ComponentProps<typeof DialogContent> & {
59
59
  variables: (values: TValues) => TVariables;
60
60
  mutation?: MutationOptions<TData, TError, TVariables, TOnMutateResult>;
61
61
  children: React.ReactNode;
@@ -80,21 +80,23 @@ declare function CommandFormDialogFields({
80
80
  declare function CommandFormDialogFooter({
81
81
  children,
82
82
  ...props
83
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
83
+ }: ComponentProps<typeof DialogFooter>): react_jsx_runtime0.JSX.Element;
84
84
  /**
85
85
  * CommandFormDialogCancel
86
86
  */
87
87
  declare function CommandFormDialogCancel({
88
88
  children,
89
+ onClick,
89
90
  ...props
90
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
91
+ }: Omit<ComponentProps<"button">, "type">): react_jsx_runtime0.JSX.Element;
91
92
  /**
92
93
  * CommandFormDialogSubmit
93
94
  */
94
95
  declare function CommandFormDialogSubmit({
95
96
  children,
97
+ disabled,
96
98
  ...props
97
- }: React.HTMLAttributes<HTMLElement>): react_jsx_runtime0.JSX.Element;
99
+ }: Omit<ComponentProps<"button">, "type">): react_jsx_runtime0.JSX.Element;
98
100
  //#endregion
99
101
  export { CommandFormDialog, CommandFormDialogCancel, CommandFormDialogContent, CommandFormDialogContentProps, CommandFormDialogContentProvider, CommandFormDialogDescription, CommandFormDialogFields, CommandFormDialogFooter, CommandFormDialogHeader, CommandFormDialogSubmit, CommandFormDialogTitle, CommandFormDialogTrigger };
100
102
  //# sourceMappingURL=form-dialog-command.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-dialog-command.client.d.mts","names":[],"sources":["../../../../src/modules/commands/components/form-dialog-command.client.tsx"],"mappings":";;;;;;;;;;;iBAsCgB,iBAAA,CAAA;EAAoB,QAAA;EAAA,GAAa;AAAA,GAAS,WAAA,GAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KAehE,6BAAA;EACH,QAAA,EAAU,KAAA,CAAM,SAAA;EAChB,SAAA;EACA,KAAA;EACA,QAAA;EACA,MAAA,GAAS,IAAA;AAAA;AAAA,iBAGK,wBAAA,CAAA;EACd,KAAA;EACA,MAAA;EACA,QAAA;EACA,QAAA;EAAA,GACG;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Aa;AAAA,GAAS,KAAA,CAAM,cAAA,CAAe,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAsBjF,uBAAA,CAAA;EAA0B,QAAA;EAAA,GAAa;AAAA,GAAS,KAAA,CAAM,cAAA,CAAe,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"form-dialog-command.client.d.mts","names":[],"sources":["../../../../src/modules/commands/components/form-dialog-command.client.tsx"],"mappings":";;;;;;;;;;;iBAqCgB,iBAAA,CAAA;EAAoB,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAsB,MAAA,IAAO,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KAelF,6BAAA;EACH,QAAA,EAAU,KAAA,CAAM,SAAA;EAChB,SAAA;EACA,KAAA;EACA,QAAA;EACA,MAAA,GAAS,IAAA;AAAA;AAAA,iBAGK,wBAAA,CAAA;EACd,KAAA;EACA,MAAA;EACA,QAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,6BAAA,GAA6B,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAgEhB,uBAAA,CAAA;EACd,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,YAAA,IAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;AAtFrC;iBA6Fe,sBAAA,CAAA;EAAyB,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAsB,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAOjF,4BAAA,CAAA;EACd,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,iBAAA,IAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAI9B,gCAAA,SAAgC,IAAA;;;;KAKjC,6BAAA,iBACM,WAAA,4BAEP,YAAA,uDAGP,cAAA,QAAsB,aAAA;EACxB,SAAA,GAAY,MAAA,EAAQ,OAAA,KAAY,UAAA;EAChC,QAAA,GAAW,eAAA,CAAgB,KAAA,EAAO,MAAA,EAAQ,UAAA,EAAY,eAAA;EACtD,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA;AAAA,iBASF,wBAAA,iBACE,WAAA,4BAEP,YAAA,oDAAA,CAAA;EAIT,SAAA;EACA,QAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,6BAAA,CAA8B,OAAA,EAAS,KAAA,EAAO,MAAA,EAAQ,UAAA,EAAY,eAAA,IAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAmCrE,uBAAA,CAAA;EAA0B,QAAA;EAAU,SAAA;EAAA,GAAc;AAAA,GAAS,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAWhF,uBAAA,CAAA;EACd,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,YAAA,IAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAOtB,uBAAA,CAAA;EACd,QAAA;EACA,OAAA;EAAA,GACG;AAAA,GACF,IAAA,CAAK,cAAA,sBAAiC,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAuBzB,uBAAA,CAAA;EACd,QAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,IAAA,CAAK,cAAA,sBAAiC,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -3,8 +3,8 @@
3
3
  import { Icons } from "../../../components/common/icons.mjs";
4
4
  import { cn } from "../../../lib/utils/cn.mjs";
5
5
  import { Button, buttonVariants } from "../../../components/ui/button.mjs";
6
- import { ContextMenuItem } from "../../../components/ui/context-menu.mjs";
7
- import { DropdownMenuItem } from "../../../components/ui/dropdown-menu.mjs";
6
+ import { ContextMenuItem } from "../../../components/ui/context-menu.client.mjs";
7
+ import { DropdownMenuItem } from "../../../components/ui/dropdown-menu.client.mjs";
8
8
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "../../../components/ui/dialog.client.mjs";
9
9
  import { useCommand } from "../hooks/context.client.mjs";
10
10
  import { useCommandMutation } from "../hooks/use-command-mutation.client.mjs";
@@ -154,16 +154,17 @@ function CommandFormDialogFooter({ children, ...props }) {
154
154
  /**
155
155
  * CommandFormDialogCancel
156
156
  */
157
- function CommandFormDialogCancel({ children, ...props }) {
157
+ function CommandFormDialogCancel({ children, onClick, ...props }) {
158
158
  const { setOpen } = React.useContext(CommandFormDialogContext);
159
159
  const form = useFormContext();
160
160
  return /* @__PURE__ */ jsx(Button, {
161
161
  ...props,
162
162
  variant: "ghost",
163
163
  type: "button",
164
- onClick: () => {
164
+ onClick: (e) => {
165
165
  form.reset();
166
166
  setOpen(false);
167
+ onClick?.(e);
167
168
  },
168
169
  children
169
170
  });
@@ -171,12 +172,13 @@ function CommandFormDialogCancel({ children, ...props }) {
171
172
  /**
172
173
  * CommandFormDialogSubmit
173
174
  */
174
- function CommandFormDialogSubmit({ children, ...props }) {
175
+ function CommandFormDialogSubmit({ children, disabled, ...props }) {
175
176
  const { status } = useCommand();
177
+ const isDisabled = disabled || status === "pending";
176
178
  return /* @__PURE__ */ jsxs(Button, {
177
179
  ...props,
178
- disabled: status === "pending",
179
180
  type: "submit",
181
+ disabled: isDisabled,
180
182
  children: [status === "pending" && /* @__PURE__ */ jsx(Icons.spinner, { className: "mr-2 h-4 w-4 animate-spin" }), children]
181
183
  });
182
184
  }
@@ -1 +1 @@
1
- {"version":3,"file":"form-dialog-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/form-dialog-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DialogContentProps, DialogProps } from \"@radix-ui/react-dialog\";\nimport type { DefaultError, MutationOptions } from \"@tanstack/react-query\";\nimport React, { type ComponentProps } from \"react\";\nimport { type FieldValues, Form, useFormContext } from \"react-hook-form\";\nimport { type Keys, useHotkeys } from \"react-hotkeys-hook\";\nimport { Icons } from \"@/components/common/icons\";\nimport { Button, buttonVariants } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"@/components/ui/dialog.client\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useCommandMutation } from \"../entry.client\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\n/**\n * CommandFormDialogContext\n */\ntype CommandFormDialogContextValue = {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nconst CommandFormDialogContext = React.createContext({} as CommandFormDialogContextValue);\n\n/**\n * CommandFormDialog\n */\nexport function CommandFormDialog({ children, ...props }: DialogProps) {\n const [open, setOpen] = React.useState(false);\n\n return (\n <Dialog {...props} open={open} onOpenChange={setOpen}>\n <CommandFormDialogContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandFormDialogContext.Provider>\n </Dialog>\n );\n}\n\n/**\n * CommandFormDialogTrigger\n */\ntype CommandFormDialogTriggerProps = {\n children: React.ReactNode;\n className?: string;\n label?: string;\n disabled?: boolean;\n hotkey?: Keys;\n};\n\nexport function CommandFormDialogTrigger({\n label,\n hotkey,\n children,\n disabled,\n ...props\n}: CommandFormDialogTriggerProps) {\n const { menu, status } = useCommand();\n const { setOpen } = React.useContext(CommandFormDialogContext);\n\n const isDisabled = disabled || status === \"pending\";\n\n useHotkeys(hotkey ?? \"\", () => setOpen(true), { enabled: !isDisabled && hotkey !== undefined });\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger\n {...props}\n disabled={isDisabled}\n className={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), props.className)}\n >\n {children}\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger asChild>\n <DropdownMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n setOpen(true);\n }}\n >\n {children}\n </DropdownMenuItem>\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger asChild>\n <ContextMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n setOpen(true);\n }}\n >\n {children}\n </ContextMenuItem>\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n}\n\n/**\n * CommandFormDialogHeader\n */\nexport function CommandFormDialogHeader({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n return <DialogHeader {...props}>{children}</DialogHeader>;\n}\n\n/**\n * CommandFormDialogTitle\n */\nexport function CommandFormDialogTitle({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n return <DialogTitle {...props}>{children}</DialogTitle>;\n}\n\n/**\n * CommandFormDialogDescription\n */\nexport function CommandFormDialogDescription({\n children,\n ...props\n}: React.HTMLAttributes<HTMLElement>) {\n return <DialogDescription {...props}>{children}</DialogDescription>;\n}\n\nexport const CommandFormDialogContentProvider = Form;\n\n/**\n * CommandFormDialogContent\n */\nexport type CommandFormDialogContentProps<\n TValues extends FieldValues,\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n> = DialogContentProps & {\n variables: (values: TValues) => TVariables;\n mutation?: MutationOptions<TData, TError, TVariables, TOnMutateResult>;\n children: React.ReactNode;\n};\n// export type CommandFormDialogContentProps<TSchema extends FieldValues> = DialogContentProps & {\n// action: CommandAction<TSchema>;\n// mutation?: MutationOptions<TSchema>;\n// message?: string;\n// children: React.ReactNode;\n// };\n\nexport function CommandFormDialogContent<\n TValues extends FieldValues,\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n>({\n variables,\n mutation,\n children,\n ...props\n}: CommandFormDialogContentProps<TValues, TData, TError, TVariables, TOnMutateResult>) {\n const { setOpen } = React.useContext(CommandFormDialogContext);\n const form = useFormContext<TValues>();\n\n const { mutateAsync } = useCommandMutation({\n ...mutation,\n onSuccess: async (...params) => {\n form.reset();\n setOpen(false);\n\n return await mutation?.onSuccess?.(...params);\n },\n });\n\n if (Object.keys(form?.formState?.errors || {})?.length > 0) {\n console.error(form.formState.errors);\n }\n\n return (\n <DialogContent {...props}>\n <form\n onSubmit={form.handleSubmit((data) => {\n const params = variables(data);\n mutateAsync(params);\n })}\n >\n {children}\n </form>\n </DialogContent>\n );\n}\n\n/**\n * FormDialogFields\n */\nexport function CommandFormDialogFields({ children, className, ...props }: ComponentProps<\"div\">) {\n return (\n <div {...props} className={cn(\"space-y-5 py-10\", className)}>\n {children}\n </div>\n );\n}\n\n/**\n * CommandFormDialogFooter\n */\nexport function CommandFormDialogFooter({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n return <DialogFooter {...props}>{children}</DialogFooter>;\n}\n\n/**\n * CommandFormDialogCancel\n */\nexport function CommandFormDialogCancel({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n const { setOpen } = React.useContext(CommandFormDialogContext);\n const form = useFormContext();\n\n return (\n <Button\n {...props}\n variant=\"ghost\"\n type=\"button\"\n onClick={() => {\n form.reset();\n setOpen(false);\n }}\n >\n {children}\n </Button>\n );\n}\n\n/**\n * CommandFormDialogSubmit\n */\nexport function CommandFormDialogSubmit({ children, ...props }: React.HTMLAttributes<HTMLElement>) {\n const { status } = useCommand();\n\n return (\n <Button {...props} disabled={status === \"pending\"} type=\"submit\">\n {status === \"pending\" && <Icons.spinner className=\"mr-2 h-4 w-4 animate-spin\" />}\n {children}\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,MAAM,2BAA2B,MAAM,cAAc,EAAE,CAAkC;;;;AAKzF,SAAgB,kBAAkB,EAAE,UAAU,GAAG,SAAsB;CACrE,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;AAE7C,QACE,oBAAC;EAAO,GAAI;EAAa;EAAM,cAAc;YAC3C,oBAAC,yBAAyB;GAAS,OAAO;IAAE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,WAAW,yBAAyB;CAC9D,MAAM,OAAO,gBAAyB;CAEtC,MAAM,EAAE,gBAAgB,mBAAmB;EACzC,GAAG;EACH,WAAW,OAAO,GAAG,WAAW;AAC9B,QAAK,OAAO;AACZ,WAAQ,MAAM;AAEd,UAAO,MAAM,UAAU,YAAY,GAAG,OAAO;;EAEhD,CAAC;AAEF,KAAI,OAAO,KAAK,MAAM,WAAW,UAAU,EAAE,CAAC,EAAE,SAAS,EACvD,SAAQ,MAAM,KAAK,UAAU,OAAO;AAGtC,QACE,oBAAC;EAAc,GAAI;YACjB,oBAAC;GACC,UAAU,KAAK,cAAc,SAAS;AAEpC,gBADe,UAAU,KAAK,CACX;KACnB;GAED;IACI;GACO;;;;;AAOpB,SAAgB,wBAAwB,EAAE,UAAU,WAAW,GAAG,SAAgC;AAChG,QACE,oBAAC;EAAI,GAAI;EAAO,WAAW,GAAG,mBAAmB,UAAU;EACxD;GACG;;;;;AAOV,SAAgB,wBAAwB,EAAE,UAAU,GAAG,SAA4C;AACjG,QAAO,oBAAC;EAAa,GAAI;EAAQ;GAAwB;;;;;AAM3D,SAAgB,wBAAwB,EAAE,UAAU,GAAG,SAA4C;CACjG,MAAM,EAAE,YAAY,MAAM,WAAW,yBAAyB;CAC9D,MAAM,OAAO,gBAAgB;AAE7B,QACE,oBAAC;EACC,GAAI;EACJ,SAAQ;EACR,MAAK;EACL,eAAe;AACb,QAAK,OAAO;AACZ,WAAQ,MAAM;;EAGf;GACM;;;;;AAOb,SAAgB,wBAAwB,EAAE,UAAU,GAAG,SAA4C;CACjG,MAAM,EAAE,WAAW,YAAY;AAE/B,QACE,qBAAC;EAAO,GAAI;EAAO,UAAU,WAAW;EAAW,MAAK;aACrD,WAAW,aAAa,oBAAC,MAAM,WAAQ,WAAU,8BAA8B,EAC/E;GACM"}
1
+ {"version":3,"file":"form-dialog-command.client.mjs","names":[],"sources":["../../../../src/modules/commands/components/form-dialog-command.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { DefaultError, MutationOptions } from \"@tanstack/react-query\";\nimport React, { type ComponentProps } from \"react\";\nimport { type FieldValues, Form, useFormContext } from \"react-hook-form\";\nimport { type Keys, useHotkeys } from \"react-hotkeys-hook\";\nimport { Icons } from \"@/components/common/icons\";\nimport { Button, buttonVariants } from \"@/components/ui/button\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu.client\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"@/components/ui/dialog.client\";\nimport { DropdownMenuItem } from \"@/components/ui/dropdown-menu.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useCommandMutation } from \"../entry.client\";\nimport { useCommand } from \"../hooks/context.client\";\nimport { CommandTrigger } from \"./command-trigger.client\";\n\n/**\n * CommandFormDialogContext\n */\ntype CommandFormDialogContextValue = {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nconst CommandFormDialogContext = React.createContext({} as CommandFormDialogContextValue);\n\n/**\n * CommandFormDialog\n */\nexport function CommandFormDialog({ children, ...props }: ComponentProps<typeof Dialog>) {\n const [open, setOpen] = React.useState(false);\n\n return (\n <Dialog {...props} open={open} onOpenChange={setOpen}>\n <CommandFormDialogContext.Provider value={{ open, setOpen }}>\n {children}\n </CommandFormDialogContext.Provider>\n </Dialog>\n );\n}\n\n/**\n * CommandFormDialogTrigger\n */\ntype CommandFormDialogTriggerProps = {\n children: React.ReactNode;\n className?: string;\n label?: string;\n disabled?: boolean;\n hotkey?: Keys;\n};\n\nexport function CommandFormDialogTrigger({\n label,\n hotkey,\n children,\n disabled,\n ...props\n}: CommandFormDialogTriggerProps) {\n const { menu, status } = useCommand();\n const { setOpen } = React.useContext(CommandFormDialogContext);\n\n const isDisabled = disabled || status === \"pending\";\n\n useHotkeys(hotkey ?? \"\", () => setOpen(true), { enabled: !isDisabled && hotkey !== undefined });\n\n if (menu === \"inline\" || menu === \"table\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger\n {...props}\n disabled={isDisabled}\n className={cn(buttonVariants({ variant: \"outline\", size: \"sm\" }), props.className)}\n >\n {children}\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"dropdown\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger asChild>\n <DropdownMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n setOpen(true);\n }}\n >\n {children}\n </DropdownMenuItem>\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n\n if (menu === \"context\") {\n return (\n <CommandTrigger label={label}>\n <DialogTrigger asChild>\n <ContextMenuItem\n {...props}\n disabled={isDisabled}\n onClick={(e) => {\n e.preventDefault();\n setOpen(true);\n }}\n >\n {children}\n </ContextMenuItem>\n </DialogTrigger>\n </CommandTrigger>\n );\n }\n}\n\n/**\n * CommandFormDialogHeader\n */\nexport function CommandFormDialogHeader({\n children,\n ...props\n}: ComponentProps<typeof DialogHeader>) {\n return <DialogHeader {...props}>{children}</DialogHeader>;\n}\n\n/**\n * CommandFormDialogTitle\n */\nexport function CommandFormDialogTitle({ children, ...props }: ComponentProps<typeof DialogTitle>) {\n return <DialogTitle {...props}>{children}</DialogTitle>;\n}\n\n/**\n * CommandFormDialogDescription\n */\nexport function CommandFormDialogDescription({\n children,\n ...props\n}: ComponentProps<typeof DialogDescription>) {\n return <DialogDescription {...props}>{children}</DialogDescription>;\n}\n\nexport const CommandFormDialogContentProvider = Form;\n\n/**\n * CommandFormDialogContent\n */\nexport type CommandFormDialogContentProps<\n TValues extends FieldValues,\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n> = ComponentProps<typeof DialogContent> & {\n variables: (values: TValues) => TVariables;\n mutation?: MutationOptions<TData, TError, TVariables, TOnMutateResult>;\n children: React.ReactNode;\n};\n// export type CommandFormDialogContentProps<TSchema extends FieldValues> = DialogContentProps & {\n// action: CommandAction<TSchema>;\n// mutation?: MutationOptions<TSchema>;\n// message?: string;\n// children: React.ReactNode;\n// };\n\nexport function CommandFormDialogContent<\n TValues extends FieldValues,\n TData = unknown,\n TError = DefaultError,\n TVariables = undefined,\n TOnMutateResult = unknown,\n>({\n variables,\n mutation,\n children,\n ...props\n}: CommandFormDialogContentProps<TValues, TData, TError, TVariables, TOnMutateResult>) {\n const { setOpen } = React.useContext(CommandFormDialogContext);\n const form = useFormContext<TValues>();\n\n const { mutateAsync } = useCommandMutation({\n ...mutation,\n onSuccess: async (...params) => {\n form.reset();\n setOpen(false);\n\n return await mutation?.onSuccess?.(...params);\n },\n });\n\n if (Object.keys(form?.formState?.errors || {})?.length > 0) {\n console.error(form.formState.errors);\n }\n\n return (\n <DialogContent {...props}>\n <form\n onSubmit={form.handleSubmit((data) => {\n const params = variables(data);\n mutateAsync(params);\n })}\n >\n {children}\n </form>\n </DialogContent>\n );\n}\n\n/**\n * FormDialogFields\n */\nexport function CommandFormDialogFields({ children, className, ...props }: ComponentProps<\"div\">) {\n return (\n <div {...props} className={cn(\"space-y-5 py-10\", className)}>\n {children}\n </div>\n );\n}\n\n/**\n * CommandFormDialogFooter\n */\nexport function CommandFormDialogFooter({\n children,\n ...props\n}: ComponentProps<typeof DialogFooter>) {\n return <DialogFooter {...props}>{children}</DialogFooter>;\n}\n\n/**\n * CommandFormDialogCancel\n */\nexport function CommandFormDialogCancel({\n children,\n onClick,\n ...props\n}: Omit<ComponentProps<\"button\">, \"type\">) {\n const { setOpen } = React.useContext(CommandFormDialogContext);\n const form = useFormContext();\n\n return (\n <Button\n {...props}\n variant=\"ghost\"\n type=\"button\"\n onClick={(e) => {\n form.reset();\n setOpen(false);\n onClick?.(e);\n }}\n >\n {children}\n </Button>\n );\n}\n\n/**\n * CommandFormDialogSubmit\n */\nexport function CommandFormDialogSubmit({\n children,\n disabled,\n ...props\n}: Omit<ComponentProps<\"button\">, \"type\">) {\n const { status } = useCommand();\n\n const isDisabled = disabled || status === \"pending\";\n\n return (\n <Button {...props} type=\"submit\" disabled={isDisabled}>\n {status === \"pending\" && <Icons.spinner className=\"mr-2 h-4 w-4 animate-spin\" />}\n {children}\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,2BAA2B,MAAM,cAAc,EAAE,CAAkC;;;;AAKzF,SAAgB,kBAAkB,EAAE,UAAU,GAAG,SAAwC;CACvF,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;AAE7C,QACE,oBAAC;EAAO,GAAI;EAAa;EAAM,cAAc;YAC3C,oBAAC,yBAAyB;GAAS,OAAO;IAAE;IAAM;IAAS;GACxD;IACiC;GAC7B;;AAeb,SAAgB,yBAAyB,EACvC,OACA,QACA,UACA,UACA,GAAG,SAC6B;CAChC,MAAM,EAAE,MAAM,WAAW,YAAY;CACrC,MAAM,EAAE,YAAY,MAAM,WAAW,yBAAyB;CAE9D,MAAM,aAAa,YAAY,WAAW;AAE1C,YAAW,UAAU,UAAU,QAAQ,KAAK,EAAE,EAAE,SAAS,CAAC,cAAc,WAAW,QAAW,CAAC;AAE/F,KAAI,SAAS,YAAY,SAAS,QAChC,QACE,oBAAC;EAAsB;YACrB,oBAAC;GACC,GAAI;GACJ,UAAU;GACV,WAAW,GAAG,eAAe;IAAE,SAAS;IAAW,MAAM;IAAM,CAAC,EAAE,MAAM,UAAU;GAEjF;IACa;GACD;AAIrB,KAAI,SAAS,WACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAc;aACb,oBAAC;IACC,GAAI;IACJ,UAAU;IACV,UAAU,MAAM;AACd,OAAE,gBAAgB;AAClB,aAAQ,KAAK;;IAGd;KACgB;IACL;GACD;AAIrB,KAAI,SAAS,UACX,QACE,oBAAC;EAAsB;YACrB,oBAAC;GAAc;aACb,oBAAC;IACC,GAAI;IACJ,UAAU;IACV,UAAU,MAAM;AACd,OAAE,gBAAgB;AAClB,aAAQ,KAAK;;IAGd;KACe;IACJ;GACD;;;;;AAQvB,SAAgB,wBAAwB,EACtC,UACA,GAAG,S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K,OAAO;AACZ,WAAQ,MAAM;AACd,aAAU,EAAE;;EAGb;GACM;;;;;AAOb,SAAgB,wBAAwB,EACtC,UACA,UACA,GAAG,SACsC;CACzC,MAAM,EAAE,WAAW,YAAY;CAE/B,MAAM,aAAa,YAAY,WAAW;AAE1C,QACE,qBAAC;EAAO,GAAI;EAAO,MAAK;EAAS,UAAU;aACxC,WAAW,aAAa,oBAAC,MAAM,WAAQ,WAAU,8BAA8B,EAC/E;GACM"}
@@ -11,7 +11,14 @@ type SingleCommandMenuProps<TData, TMeta> = {
11
11
  data: TData;
12
12
  commands: CommandDef<TData, TMeta>[];
13
13
  meta?: TMeta;
14
+ onSuccess?: () => void;
15
+ };
16
+ type BulkCommandMenuProps<TData, TMeta> = {
17
+ data: TData[];
18
+ commands: CommandDef<TData, TMeta>[];
19
+ meta?: TMeta;
20
+ onSuccess?: () => void;
14
21
  };
15
22
  //#endregion
16
- export { SingleCommandMenuProps };
23
+ export { BulkCommandMenuProps, SingleCommandMenuProps };
17
24
  //# sourceMappingURL=use-command-menu.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-command-menu.client.d.mts","names":[],"sources":["../../../../src/modules/commands/hooks/use-command-menu.client.tsx"],"mappings":";;;;;;;;;KAWY,sBAAA;EACV,IAAA,EAAM,KAAA;EACN,QAAA,EAAU,UAAA,CAAW,KAAA,EAAO,KAAA;EAC5B,IAAA,GAAO,KAAA;AAAA"}
1
+ {"version":3,"file":"use-command-menu.client.d.mts","names":[],"sources":["../../../../src/modules/commands/hooks/use-command-menu.client.tsx"],"mappings":";;;;;;;;;KAWY,sBAAA;EACV,IAAA,EAAM,KAAA;EACN,QAAA,EAAU,UAAA,CAAW,KAAA,EAAO,KAAA;EAC5B,IAAA,GAAO,KAAA;EACP,SAAA;AAAA;AAAA,KAGU,oBAAA;EACV,IAAA,EAAM,KAAA;EACN,QAAA,EAAU,UAAA,CAAW,KAAA,EAAO,KAAA;EAC5B,IAAA,GAAO,KAAA;EACP,SAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-command-menu.client.mjs","names":[],"sources":["../../../../src/modules/commands/hooks/use-command-menu.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n BulkCommandDefRenderParams,\n CommandDef,\n SingleCommandDefRenderParams,\n} from \"../lib/definitions\";\n\n/**\n * Command menu props\n */\nexport type SingleCommandMenuProps<TData, TMeta> = {\n data: TData;\n commands: CommandDef<TData, TMeta>[];\n meta?: TMeta;\n};\n\nexport type BulkCommandMenuProps<TData, TMeta> = {\n data: TData[];\n commands: CommandDef<TData, TMeta>[];\n meta?: TMeta;\n};\n\n/**\n * Check if a command has an id field in the data\n */\nfunction dataHasId<TData>(data: TData) {\n return data && typeof data === \"object\" && \"id\" in data && typeof data.id === \"string\";\n}\n\n/**\n * Single command validation\n */\ntype ValidateSingleCommandParams<TData, TMeta> = {\n data: TData;\n command: CommandDef<TData, TMeta> & { mode: \"single\" };\n};\n\nfunction validateSingleCommand<TData, TMeta>({\n data,\n command,\n}: ValidateSingleCommandParams<TData, TMeta>) {\n const valid = command.conditions?.({ data });\n return Array.isArray(valid) ? valid.every(Boolean) : (valid ?? true);\n}\n\n/**\n * Single command rendering\n */\ntype RenderSingleCommandParams<TData, TMeta> = {\n data: TData;\n meta?: TMeta;\n command: CommandDef<TData, TMeta> & { mode: \"single\" };\n};\n\nfunction renderSingleCommand<TData, TMeta>({\n data,\n command,\n meta,\n}: RenderSingleCommandParams<TData, TMeta>) {\n return command.render({\n data,\n meta: meta ?? ({} as TMeta),\n ...(dataHasId(data) ? { id: (data as TData & { id: string }).id } : {}),\n } as SingleCommandDefRenderParams<TData, TMeta>);\n}\n\n/**\n * Bulk command validation\n */\ntype ValidateBulkCommandParams<TData, TMeta> = {\n data: TData[];\n command: CommandDef<TData, TMeta> & { mode: \"bulk\" };\n};\n\nfunction validateBulkCommand<TData, TMeta>({\n data,\n command,\n}: ValidateBulkCommandParams<TData, TMeta>) {\n const valid = command.conditions?.({ data });\n return Array.isArray(valid) ? valid.every(Boolean) : (valid ?? true);\n}\n\n/**\n * Bulk command rendering\n */\ntype RenderBulkCommandParams<TData, TMeta> = {\n data: TData[];\n command: CommandDef<TData, TMeta> & { mode: \"bulk\" };\n meta?: TMeta;\n};\n\nfunction renderBulkCommand<TData, TMeta>({\n data,\n command,\n meta,\n}: RenderBulkCommandParams<TData, TMeta>) {\n const ids = data.filter(dataHasId).map((data) => (data as TData & { id: string }).id);\n\n return command.render({\n data,\n meta: meta ?? ({} as TMeta),\n ...(ids.length > 0 ? { ids } : {}),\n } as BulkCommandDefRenderParams<TData, TMeta>);\n}\n\n/**\n * useSingleCommandMenu\n */\nexport function useSingleCommandMenu<TData, TMeta>({\n data,\n commands,\n meta,\n}: SingleCommandMenuProps<TData, TMeta> & { data: TData }) {\n // filter out commands that don't have valid conditions\n const validCommands = commands.filter((command) =>\n command.mode === \"single\"\n ? validateSingleCommand({ data, command })\n : validateBulkCommand({ data: [data], command }),\n );\n\n function renderCommand(command: (typeof validCommands)[number]) {\n return command.mode === \"single\"\n ? renderSingleCommand({ command, data, meta })\n : renderBulkCommand({ command, data: [data], meta });\n }\n\n return [validCommands, renderCommand] as const;\n}\n\n/**\n * useBulkCommandMenu\n */\nexport function useBulkCommandMenu<TData, TMeta>({\n data,\n commands,\n meta,\n}: BulkCommandMenuProps<TData, TMeta>) {\n /**\n * Filter out commands that don't have valid conditions\n */\n const validCommands = commands\n // filter out commands that have mode \"bulk\"\n .filter((command) => command.mode === \"bulk\")\n // filter out commands that don't have valid conditions\n .filter((command) => command.mode === \"bulk\" && validateBulkCommand({ data, command }));\n\n /**\n * Render command\n */\n function renderCommand(command: (typeof commands)[number]) {\n if (command.mode === \"single\") return null;\n\n return renderBulkCommand({ command, data, meta });\n }\n\n return [validCommands, renderCommand] as const;\n}\n\n// export function useBulkCommandMenu<TData, TMeta>({\n// data,\n// commands,\n// meta,\n// }: BulkCommandMenuProps<TData, TMeta>) {\n// /**\n// * Filter out commands that don't have valid conditions\n// */\n// const validCommands = useSuspenseQueries({\n// queries: commands.flatMap((command) => ({\n// queryKey: [\"command\", command],\n// queryFn: async () => {\n// const { mode, permission } = command;\n\n// // filter out commands that have mode \"bulk\"\n// if (mode !== \"bulk\") return null;\n\n// // filter out commands that don't have valid conditions\n// if (!validateBulkCommand({ data, command })) return null;\n\n// // filter out commands that don't have a permissions defined\n// if (!permission) return command;\n\n// // filter out commands that don't have valid permissions\n// const session = await authClient.getSession();\n// const userId = session.data?.user.id;\n// const hasPermission = await authClient.admin.hasPermission({ permission, userId });\n// if (!hasPermission.data?.success) return null;\n\n// return command;\n// },\n// })),\n// combine: (items) =>\n// items.filter(({ data }) => data).map(({ data }) => data as NonNullable<typeof data>),\n// });\n\n// /**\n// * Render command\n// */\n// const renderCommand = (command: (typeof validCommands)[number]) =>\n// renderBulkCommand({ command, data, meta });\n\n// return [validCommands, renderCommand] as const;\n// }\n\n// */\n// export function useSingleCommandMenu<TData, TMeta>({\n// data,\n// commands,\n// meta,\n// }: SingleCommandMenuProps<TData, TMeta> & { data: TData }) {\n// /**\n// * Filter out commands that don't have valid conditions\n// */\n// const validCommands = useSuspenseQueries({\n// queries: commands.flatMap((command) => ({\n// queryKey: [\"command\", command],\n// queryFn: async () => {\n// const { mode, permission } = command;\n\n// // filter out commands that don't have valid conditions\n// if (mode === \"single\" && !validateSingleCommand({ data, command })) return null;\n// if (mode === \"bulk\" && !validateBulkCommand({ data: [data], command })) return null;\n\n// // filter out commands that don't have a permissions defined\n// if (!permission) return command;\n\n// // filter out commands that don't have valid permissions\n// const session = await authClient.getSession();\n// const userId = session.data?.user.id;\n// const hasPermission = await authClient.admin.hasPermission({ permission, userId });\n// if (!hasPermission.data?.success) return null;\n\n// return command;\n// },\n// })),\n// combine: (items) =>\n// items.filter(({ data }) => data).map(({ data }) => data as NonNullable<typeof data>),\n// });\n\n// /**\n// * Render command\n// */\n// function renderCommand(command: (typeof validCommands)[number]) {\n// return command.mode === \"single\"\n// ? renderSingleCommand({ command, data, meta })\n// : renderBulkCommand({ command, data: [data], meta });\n// }\n\n// return [validCommands, renderCommand] as const;\n// }\n"],"mappings":";;;;;;AA0BA,SAAS,UAAiB,MAAa;AACrC,QAAO,QAAQ,OAAO,SAAS,YAAY,QAAQ,QAAQ,OAAO,KAAK,OAAO;;AAWhF,SAAS,sBAAoC,EAC3C,MACA,WAC4C;CAC5C,MAAM,QAAQ,QAAQ,aAAa,EAAE,MAAM,CAAC;AAC5C,QAAO,MAAM,QAAQ,MAAM,GAAG,MAAM,MAAM,QAAQ,GAAI,SAAS;;AAYjE,SAAS,oBAAkC,EACzC,MACA,SACA,QAC0C;AAC1C,QAAO,QAAQ,OAAO;EACpB;EACA,MAAM,QAAS,EAAE;EACjB,GAAI,UAAU,KAAK,GAAG,EAAE,IAAK,KAAgC,IAAI,GAAG,EAAE;EACvE,CAA+C;;AAWlD,SAAS,oBAAkC,EACzC,MACA,WAC0C;CAC1C,MAAM,QAAQ,QAAQ,aAAa,EAAE,MAAM,CAAC;AAC5C,QAAO,MAAM,QAAQ,MAAM,GAAG,MAAM,MAAM,QAAQ,GAAI,SAAS;;AAYjE,SAAS,kBAAgC,EACvC,MACA,SACA,QACwC;CACxC,MAAM,MAAM,KAAK,OAAO,UAAU,CAAC,KAAK,SAAU,KAAgC,GAAG;AAErF,QAAO,QAAQ,OAAO;EACpB;EACA,MAAM,QAAS,EAAE;EACjB,GAAI,IAAI,SAAS,IAAI,EAAE,KAAK,GAAG,EAAE;EAClC,CAA6C;;;;;AAMhD,SAAgB,qBAAmC,EACjD,MACA,UACA,QACyD;CAEzD,MAAM,gBAAgB,SAAS,QAAQ,YACrC,QAAQ,SAAS,WACb,sBAAsB;EAAE;EAAM;EAAS,CAAC,GACxC,oBAAoB;EAAE,MAAM,CAAC,KAAK;EAAE;EAAS,CAAC,CACnD;CAED,SAAS,cAAc,SAAyC;AAC9D,SAAO,QAAQ,SAAS,WACpB,oBAAoB;GAAE;GAAS;GAAM;GAAM,CAAC,GAC5C,kBAAkB;GAAE;GAAS,MAAM,CAAC,KAAK;GAAE;GAAM,CAAC;;AAGxD,QAAO,CAAC,eAAe,cAAc;;;;;AAMvC,SAAgB,mBAAiC,EAC/C,MACA,UACA,QACqC;;;;CAIrC,MAAM,gBAAgB,SAEnB,QAAQ,YAAY,QAAQ,SAAS,OAAO,CAE5C,QAAQ,YAAY,QAAQ,SAAS,UAAU,oBAAoB;EAAE;EAAM;EAAS,CAAC,CAAC;;;;CAKzF,SAAS,cAAc,SAAoC;AACzD,MAAI,QAAQ,SAAS,SAAU,QAAO;AAEtC,SAAO,kBAAkB;GAAE;GAAS;GAAM;GAAM,CAAC;;AAGnD,QAAO,CAAC,eAAe,cAAc"}
1
+ {"version":3,"file":"use-command-menu.client.mjs","names":[],"sources":["../../../../src/modules/commands/hooks/use-command-menu.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n BulkCommandDefRenderParams,\n CommandDef,\n SingleCommandDefRenderParams,\n} from \"../lib/definitions\";\n\n/**\n * Command menu props\n */\nexport type SingleCommandMenuProps<TData, TMeta> = {\n data: TData;\n commands: CommandDef<TData, TMeta>[];\n meta?: TMeta;\n onSuccess?: () => void;\n};\n\nexport type BulkCommandMenuProps<TData, TMeta> = {\n data: TData[];\n commands: CommandDef<TData, TMeta>[];\n meta?: TMeta;\n onSuccess?: () => void;\n};\n\n/**\n * Check if a command has an id field in the data\n */\nfunction dataHasId<TData>(data: TData) {\n return data && typeof data === \"object\" && \"id\" in data && typeof data.id === \"string\";\n}\n\n/**\n * Single command validation\n */\ntype ValidateSingleCommandParams<TData, TMeta> = {\n data: TData;\n command: CommandDef<TData, TMeta> & { mode: \"single\" };\n};\n\nfunction validateSingleCommand<TData, TMeta>({\n data,\n command,\n}: ValidateSingleCommandParams<TData, TMeta>) {\n const valid = command.conditions?.({ data });\n return Array.isArray(valid) ? valid.every(Boolean) : (valid ?? true);\n}\n\n/**\n * Single command rendering\n */\ntype RenderSingleCommandParams<TData, TMeta> = {\n data: TData;\n meta?: TMeta;\n command: CommandDef<TData, TMeta> & { mode: \"single\" };\n};\n\nfunction renderSingleCommand<TData, TMeta>({\n data,\n command,\n meta,\n}: RenderSingleCommandParams<TData, TMeta>) {\n return command.render({\n data,\n meta: meta ?? ({} as TMeta),\n ...(dataHasId(data) ? { id: (data as TData & { id: string }).id } : {}),\n } as SingleCommandDefRenderParams<TData, TMeta>);\n}\n\n/**\n * Bulk command validation\n */\ntype ValidateBulkCommandParams<TData, TMeta> = {\n data: TData[];\n command: CommandDef<TData, TMeta> & { mode: \"bulk\" };\n};\n\nfunction validateBulkCommand<TData, TMeta>({\n data,\n command,\n}: ValidateBulkCommandParams<TData, TMeta>) {\n const valid = command.conditions?.({ data });\n return Array.isArray(valid) ? valid.every(Boolean) : (valid ?? true);\n}\n\n/**\n * Bulk command rendering\n */\ntype RenderBulkCommandParams<TData, TMeta> = {\n data: TData[];\n command: CommandDef<TData, TMeta> & { mode: \"bulk\" };\n meta?: TMeta;\n};\n\nfunction renderBulkCommand<TData, TMeta>({\n data,\n command,\n meta,\n}: RenderBulkCommandParams<TData, TMeta>) {\n const ids = data.filter(dataHasId).map((data) => (data as TData & { id: string }).id);\n\n return command.render({\n data,\n meta: meta ?? ({} as TMeta),\n ...(ids.length > 0 ? { ids } : {}),\n } as BulkCommandDefRenderParams<TData, TMeta>);\n}\n\n/**\n * useSingleCommandMenu\n */\nexport function useSingleCommandMenu<TData, TMeta>({\n data,\n commands,\n meta,\n}: SingleCommandMenuProps<TData, TMeta> & { data: TData }) {\n // filter out commands that don't have valid conditions\n const validCommands = commands.filter((command) =>\n command.mode === \"single\"\n ? validateSingleCommand({ data, command })\n : validateBulkCommand({ data: [data], command }),\n );\n\n function renderCommand(command: (typeof validCommands)[number]) {\n return command.mode === \"single\"\n ? renderSingleCommand({ command, data, meta })\n : renderBulkCommand({ command, data: [data], meta });\n }\n\n return [validCommands, renderCommand] as const;\n}\n\n/**\n * useBulkCommandMenu\n */\nexport function useBulkCommandMenu<TData, TMeta>({\n data,\n commands,\n meta,\n}: BulkCommandMenuProps<TData, TMeta>) {\n /**\n * Filter out commands that don't have valid conditions\n */\n const validCommands = commands\n // filter out commands that have mode \"bulk\"\n .filter((command) => command.mode === \"bulk\")\n // filter out commands that don't have valid conditions\n .filter((command) => command.mode === \"bulk\" && validateBulkCommand({ data, command }));\n\n /**\n * Render command\n */\n function renderCommand(command: (typeof commands)[number]) {\n if (command.mode === \"single\") return null;\n\n return renderBulkCommand({ command, data, meta });\n }\n\n return [validCommands, renderCommand] as const;\n}\n\n// export function useBulkCommandMenu<TData, TMeta>({\n// data,\n// commands,\n// meta,\n// }: BulkCommandMenuProps<TData, TMeta>) {\n// /**\n// * Filter out commands that don't have valid conditions\n// */\n// const validCommands = useSuspenseQueries({\n// queries: commands.flatMap((command) => ({\n// queryKey: [\"command\", command],\n// queryFn: async () => {\n// const { mode, permission } = command;\n\n// // filter out commands that have mode \"bulk\"\n// if (mode !== \"bulk\") return null;\n\n// // filter out commands that don't have valid conditions\n// if (!validateBulkCommand({ data, command })) return null;\n\n// // filter out commands that don't have a permissions defined\n// if (!permission) return command;\n\n// // filter out commands that don't have valid permissions\n// const session = await authClient.getSession();\n// const userId = session.data?.user.id;\n// const hasPermission = await authClient.admin.hasPermission({ permission, userId });\n// if (!hasPermission.data?.success) return null;\n\n// return command;\n// },\n// })),\n// combine: (items) =>\n// items.filter(({ data }) => data).map(({ data }) => data as NonNullable<typeof data>),\n// });\n\n// /**\n// * Render command\n// */\n// const renderCommand = (command: (typeof validCommands)[number]) =>\n// renderBulkCommand({ command, data, meta });\n\n// return [validCommands, renderCommand] as const;\n// }\n\n// */\n// export function useSingleCommandMenu<TData, TMeta>({\n// data,\n// commands,\n// meta,\n// }: SingleCommandMenuProps<TData, TMeta> & { data: TData }) {\n// /**\n// * Filter out commands that don't have valid conditions\n// */\n// const validCommands = useSuspenseQueries({\n// queries: commands.flatMap((command) => ({\n// queryKey: [\"command\", command],\n// queryFn: async () => {\n// const { mode, permission } = command;\n\n// // filter out commands that don't have valid conditions\n// if (mode === \"single\" && !validateSingleCommand({ data, command })) return null;\n// if (mode === \"bulk\" && !validateBulkCommand({ data: [data], command })) return null;\n\n// // filter out commands that don't have a permissions defined\n// if (!permission) return command;\n\n// // filter out commands that don't have valid permissions\n// const session = await authClient.getSession();\n// const userId = session.data?.user.id;\n// const hasPermission = await authClient.admin.hasPermission({ permission, userId });\n// if (!hasPermission.data?.success) return null;\n\n// return command;\n// },\n// })),\n// combine: (items) =>\n// items.filter(({ data }) => data).map(({ data }) => data as NonNullable<typeof data>),\n// });\n\n// /**\n// * Render command\n// */\n// function renderCommand(command: (typeof validCommands)[number]) {\n// return command.mode === \"single\"\n// ? renderSingleCommand({ command, data, meta })\n// : renderBulkCommand({ command, data: [data], meta });\n// }\n\n// return [validCommands, renderCommand] as const;\n// }\n"],"mappings":";;;;;;AA4BA,SAAS,UAAiB,MAAa;AACrC,QAAO,QAAQ,OAAO,SAAS,YAAY,QAAQ,QAAQ,OAAO,KAAK,OAAO;;AAWhF,SAAS,sBAAoC,EAC3C,MACA,WAC4C;CAC5C,MAAM,QAAQ,QAAQ,aAAa,EAAE,MAAM,CAAC;AAC5C,QAAO,MAAM,QAAQ,MAAM,GAAG,MAAM,MAAM,QAAQ,GAAI,SAAS;;AAYjE,SAAS,oBAAkC,EACzC,MACA,SACA,QAC0C;AAC1C,QAAO,QAAQ,OAAO;EACpB;EACA,MAAM,QAAS,EAAE;EACjB,GAAI,UAAU,KAAK,GAAG,EAAE,IAAK,KAAgC,IAAI,GAAG,EAAE;EACvE,CAA+C;;AAWlD,SAAS,oBAAkC,EACzC,MACA,WAC0C;CAC1C,MAAM,QAAQ,QAAQ,aAAa,EAAE,MAAM,CAAC;AAC5C,QAAO,MAAM,QAAQ,MAAM,GAAG,MAAM,MAAM,QAAQ,GAAI,SAAS;;AAYjE,SAAS,kBAAgC,EACvC,MACA,SACA,QACwC;CACxC,MAAM,MAAM,KAAK,OAAO,UAAU,CAAC,KAAK,SAAU,KAAgC,GAAG;AAErF,QAAO,QAAQ,OAAO;EACpB;EACA,MAAM,QAAS,EAAE;EACjB,GAAI,IAAI,SAAS,IAAI,EAAE,KAAK,GAAG,EAAE;EAClC,CAA6C;;;;;AAMhD,SAAgB,qBAAmC,EACjD,MACA,UACA,QACyD;CAEzD,MAAM,gBAAgB,SAAS,QAAQ,YACrC,QAAQ,SAAS,WACb,sBAAsB;EAAE;EAAM;EAAS,CAAC,GACxC,oBAAoB;EAAE,MAAM,CAAC,KAAK;EAAE;EAAS,CAAC,CACnD;CAED,SAAS,cAAc,SAAyC;AAC9D,SAAO,QAAQ,SAAS,WACpB,oBAAoB;GAAE;GAAS;GAAM;GAAM,CAAC,GAC5C,kBAAkB;GAAE;GAAS,MAAM,CAAC,KAAK;GAAE;GAAM,CAAC;;AAGxD,QAAO,CAAC,eAAe,cAAc;;;;;AAMvC,SAAgB,mBAAiC,EAC/C,MACA,UACA,QACqC;;;;CAIrC,MAAM,gBAAgB,SAEnB,QAAQ,YAAY,QAAQ,SAAS,OAAO,CAE5C,QAAQ,YAAY,QAAQ,SAAS,UAAU,oBAAoB;EAAE;EAAM;EAAS,CAAC,CAAC;;;;CAKzF,SAAS,cAAc,SAAoC;AACzD,MAAI,QAAQ,SAAS,SAAU,QAAO;AAEtC,SAAO,kBAAkB;GAAE;GAAS;GAAM;GAAM,CAAC;;AAGnD,QAAO,CAAC,eAAe,cAAc"}
@@ -1,7 +1,7 @@
1
- import { ContextMenu, ContextMenuTrigger } from "../../../components/ui/context-menu.mjs";
1
+ import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../../components/ui/context-menu.client.mjs";
2
2
  import { SingleCommandMenuProps } from "../hooks/use-command-menu.client.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
- import { ContextMenuContentProps } from "@radix-ui/react-context-menu";
4
+ import { ComponentProps } from "react";
5
5
 
6
6
  //#region src/modules/commands/menus/context-menu.client.d.ts
7
7
  /**
@@ -21,7 +21,7 @@ declare function ContextCommandMenuContent<TData, TMeta>({
21
21
  meta,
22
22
  className,
23
23
  ...props
24
- }: SingleCommandMenuProps<TData, TMeta> & ContextMenuContentProps): react_jsx_runtime0.JSX.Element;
24
+ }: SingleCommandMenuProps<TData, TMeta> & ComponentProps<typeof ContextMenuContent>): react_jsx_runtime0.JSX.Element;
25
25
  //#endregion
26
26
  export { ContextCommandMenu, ContextCommandMenuContent, ContextCommandMenuTrigger };
27
27
  //# sourceMappingURL=context-menu.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.client.d.mts","names":[],"sources":["../../../../src/modules/commands/menus/context-menu.client.tsx"],"mappings":";;;;;;;;;cAqBa,kBAAA,SAAkB,WAAA;;;;cAKlB,yBAAA,SAAyB,kBAAA;AAAtC;;;AAAA,iBAKgB,yBAAA,cAAA,CAAA;EACd,IAAA;EACA,QAAA;EACA,IAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,sBAAA,CAAuB,KAAA,EAAO,KAAA,IAAS,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"context-menu.client.d.mts","names":[],"sources":["../../../../src/modules/commands/menus/context-menu.client.tsx"],"mappings":";;;;;;;;;cAoBa,kBAAA,SAAkB,WAAA;;;;cAKlB,yBAAA,SAAyB,kBAAA;AAAtC;;;AAAA,iBAKgB,yBAAA,cAAA,CAAA;EACd,IAAA;EACA,QAAA;EACA,IAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,sBAAA,CAAuB,KAAA,EAAO,KAAA,IAAS,cAAA,QAAsB,kBAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { cn } from "../../../lib/utils/cn.mjs";
4
- import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "../../../components/ui/context-menu.mjs";
4
+ import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "../../../components/ui/context-menu.client.mjs";
5
5
  import { CommandContextProvider } from "../hooks/context.client.mjs";
6
6
  import { RenderCommand } from "../components/render-command.mjs";
7
7
  import { useSingleCommandMenu } from "../hooks/use-command-menu.client.mjs";