@tulip-systems/core 0.5.1 → 0.5.3

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 (381) hide show
  1. package/dist/components/common/icons.d.mts +52 -52
  2. package/dist/components/common/icons.d.mts.map +1 -1
  3. package/dist/components/common/status.d.mts +3 -3
  4. package/dist/components/common/status.d.mts.map +1 -1
  5. package/dist/components/editor/components/content.client.d.mts +2 -2
  6. package/dist/components/editor/components/editor.client.d.mts +4 -4
  7. package/dist/components/editor/components/editor.client.mjs +2 -2
  8. package/dist/components/editor/components/editor.client.mjs.map +1 -1
  9. package/dist/components/editor/components/menu.client.d.mts +3 -3
  10. package/dist/components/editor/components/menu.client.mjs +3 -0
  11. package/dist/components/editor/components/menu.client.mjs.map +1 -1
  12. package/dist/components/editor/extensions/file-handler/extension.d.mts +21 -0
  13. package/dist/components/editor/extensions/file-handler/extension.d.mts.map +1 -0
  14. package/dist/components/editor/extensions/file-handler/extension.mjs +40 -0
  15. package/dist/components/editor/extensions/file-handler/extension.mjs.map +1 -0
  16. package/dist/components/editor/extensions/file-handler/strategy.d.mts +29 -0
  17. package/dist/components/editor/extensions/file-handler/strategy.d.mts.map +1 -0
  18. package/dist/components/editor/extensions/file-handler/strategy.mjs +111 -0
  19. package/dist/components/editor/extensions/file-handler/strategy.mjs.map +1 -0
  20. package/dist/components/editor/extensions/file-handler/utils.mjs +50 -0
  21. package/dist/components/editor/extensions/file-handler/utils.mjs.map +1 -0
  22. package/dist/components/editor/extensions/image/extension.d.mts +8 -0
  23. package/dist/components/editor/extensions/image/extension.d.mts.map +1 -0
  24. package/dist/components/editor/extensions/image/extension.mjs +52 -0
  25. package/dist/components/editor/extensions/image/extension.mjs.map +1 -0
  26. package/dist/components/editor/extensions/skeleton/extension.mjs +41 -0
  27. package/dist/components/editor/extensions/skeleton/extension.mjs.map +1 -0
  28. package/dist/components/editor/extensions/skeleton/renderer.mjs +25 -0
  29. package/dist/components/editor/extensions/skeleton/renderer.mjs.map +1 -0
  30. package/dist/components/editor/lib/constants.d.mts +29 -26
  31. package/dist/components/editor/lib/constants.d.mts.map +1 -1
  32. package/dist/components/editor/lib/constants.mjs +14 -2
  33. package/dist/components/editor/lib/constants.mjs.map +1 -1
  34. package/dist/components/editor/lib/extensions.d.mts +5 -1
  35. package/dist/components/editor/lib/extensions.d.mts.map +1 -1
  36. package/dist/components/editor/lib/extensions.mjs.map +1 -1
  37. package/dist/components/editor/lib/variants.mjs +10 -2
  38. package/dist/components/editor/lib/variants.mjs.map +1 -1
  39. package/dist/components/header/back-button.client.d.mts +2 -2
  40. package/dist/components/header/bottom-bar.client.d.mts +3 -3
  41. package/dist/components/header/breadcrumbs.client.d.mts +7 -7
  42. package/dist/components/header/header.client.d.mts +2 -2
  43. package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
  44. package/dist/components/header/top-bar.client.d.mts +4 -4
  45. package/dist/components/layouts/admin-content.client.d.mts +2 -2
  46. package/dist/components/layouts/admin-layout.d.mts +2 -2
  47. package/dist/components/layouts/admin-loading.d.mts +2 -2
  48. package/dist/components/layouts/admin-loading.d.mts.map +1 -1
  49. package/dist/components/layouts/empty-page.d.mts +4 -4
  50. package/dist/components/layouts/empty-page.d.mts.map +1 -1
  51. package/dist/components/layouts/list-layout.d.mts +2 -2
  52. package/dist/components/layouts/list-layout.d.mts.map +1 -1
  53. package/dist/components/layouts/not-found-page.d.mts +3 -3
  54. package/dist/components/layouts/not-found-page.d.mts.map +1 -1
  55. package/dist/components/layouts/providers.client.d.mts +2 -2
  56. package/dist/components/layouts/root-layout.server.d.mts +2 -2
  57. package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
  58. package/dist/components/layouts/root-loading.d.mts +2 -2
  59. package/dist/components/layouts/root-loading.d.mts.map +1 -1
  60. package/dist/components/layouts/tab-layout.d.mts +2 -2
  61. package/dist/components/layouts/tab-layout.d.mts.map +1 -1
  62. package/dist/components/lists/data-list.d.mts +5 -5
  63. package/dist/components/lists/data-list.d.mts.map +1 -1
  64. package/dist/components/lists/data-stack.d.mts +8 -8
  65. package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
  66. package/dist/components/ui/accordion.d.mts +5 -5
  67. package/dist/components/ui/alert-dialog.d.mts +12 -12
  68. package/dist/components/ui/alert.d.mts +6 -6
  69. package/dist/components/ui/aspect-ratio.d.mts +2 -2
  70. package/dist/components/ui/avatar.client.d.mts +4 -4
  71. package/dist/components/ui/badge.d.mts +4 -4
  72. package/dist/components/ui/breadcrumb.d.mts +8 -8
  73. package/dist/components/ui/breadcrumb.d.mts.map +1 -1
  74. package/dist/components/ui/button.d.mts +5 -5
  75. package/dist/components/ui/button.d.mts.map +1 -1
  76. package/dist/components/ui/calendar.d.mts +3 -3
  77. package/dist/components/ui/calendar.d.mts.map +1 -1
  78. package/dist/components/ui/card.d.mts +7 -7
  79. package/dist/components/ui/card.d.mts.map +1 -1
  80. package/dist/components/ui/carousel.d.mts +6 -6
  81. package/dist/components/ui/carousel.d.mts.map +1 -1
  82. package/dist/components/ui/chart.client.d.mts +5 -5
  83. package/dist/components/ui/checkbox.d.mts +2 -2
  84. package/dist/components/ui/checkbox.d.mts.map +1 -1
  85. package/dist/components/ui/collapsible.client.d.mts +4 -4
  86. package/dist/components/ui/color-picker.client.d.mts +2 -2
  87. package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
  88. package/dist/components/ui/combobox.client.d.mts +2 -2
  89. package/dist/components/ui/command.d.mts +10 -10
  90. package/dist/components/ui/command.d.mts.map +1 -1
  91. package/dist/components/ui/context-menu.d.mts +16 -16
  92. package/dist/components/ui/date-picker.client.d.mts +2 -2
  93. package/dist/components/ui/dialog.client.d.mts +11 -11
  94. package/dist/components/ui/drawer.client.d.mts +11 -11
  95. package/dist/components/ui/dropdown-menu.d.mts +16 -16
  96. package/dist/components/ui/form.client.d.mts +7 -7
  97. package/dist/components/ui/hover-card.client.d.mts +4 -4
  98. package/dist/components/ui/input-recipient.d.mts +2 -2
  99. package/dist/components/ui/input.d.mts +2 -2
  100. package/dist/components/ui/label.d.mts +2 -2
  101. package/dist/components/ui/navigation-menu.d.mts +11 -11
  102. package/dist/components/ui/pagination.d.mts +8 -8
  103. package/dist/components/ui/popover.d.mts +5 -5
  104. package/dist/components/ui/popover.d.mts.map +1 -1
  105. package/dist/components/ui/progress.client.d.mts +2 -2
  106. package/dist/components/ui/radio-group.d.mts +3 -3
  107. package/dist/components/ui/resizable.client.d.mts +4 -4
  108. package/dist/components/ui/scroll-area.d.mts +3 -3
  109. package/dist/components/ui/select.client.d.mts +11 -11
  110. package/dist/components/ui/separator.d.mts +2 -2
  111. package/dist/components/ui/sheet.client.d.mts +9 -9
  112. package/dist/components/ui/sidebar.client.d.mts +24 -24
  113. package/dist/components/ui/skeleton.d.mts +2 -2
  114. package/dist/components/ui/slider.d.mts +2 -2
  115. package/dist/components/ui/sonner.client.d.mts +2 -2
  116. package/dist/components/ui/switch.d.mts +2 -2
  117. package/dist/components/ui/tabs.d.mts +5 -5
  118. package/dist/components/ui/textarea.d.mts +2 -2
  119. package/dist/components/ui/time-input.client.d.mts +2 -2
  120. package/dist/components/ui/toggle-group.client.d.mts +3 -3
  121. package/dist/components/ui/toggle.d.mts +2 -2
  122. package/dist/components/ui/tooltip.client.d.mts +5 -5
  123. package/dist/components.d.mts +2 -1
  124. package/dist/components.mjs +3 -2
  125. package/dist/data-tables.d.mts +2 -2
  126. package/dist/data-tables.mjs +2 -2
  127. package/dist/inline-edit/client.d.mts +2 -3
  128. package/dist/inline-edit/client.mjs +1 -2
  129. package/dist/lib/client.d.mts +2 -2
  130. package/dist/lib/client.mjs +2 -2
  131. package/dist/lib/hooks/use-action.d.mts +2 -2
  132. package/dist/lib/hooks/use-indicator.d.mts +11 -3
  133. package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
  134. package/dist/lib/hooks/use-indicator.mjs +19 -8
  135. package/dist/lib/hooks/use-indicator.mjs.map +1 -1
  136. package/dist/modules/auth/components/allowed.client.d.mts +2 -2
  137. package/dist/modules/auth/components/allowed.client.d.mts.map +1 -1
  138. package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
  139. package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
  140. package/dist/modules/auth/components/auth-loading.d.mts +2 -2
  141. package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
  142. package/dist/modules/auth/components/create-first-user-page.client.d.mts.map +1 -1
  143. package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
  144. package/dist/modules/auth/components/forget-password-page.client.d.mts.map +1 -1
  145. package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
  146. package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
  147. package/dist/modules/auth/components/guard.server.d.mts +2 -2
  148. package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
  149. package/dist/modules/auth/components/login-page.client.d.mts +2 -2
  150. package/dist/modules/auth/components/login-page.client.d.mts.map +1 -1
  151. package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
  152. package/dist/modules/auth/components/reset-password-page.client.d.mts.map +1 -1
  153. package/dist/modules/auth/components/update-password-command.d.mts +2 -2
  154. package/dist/modules/auth/components/update-password-command.d.mts.map +1 -1
  155. package/dist/modules/auth/db/schema.d.mts +73 -73
  156. package/dist/modules/auth/db/schema.d.mts.map +1 -1
  157. package/dist/modules/auth/handler/client.client.d.mts +8 -8
  158. package/dist/modules/auth/hooks/use-permission.d.mts +2 -2
  159. package/dist/modules/auth/hooks/use-session.d.mts +4 -4
  160. package/dist/modules/auth/lib/validators.d.mts +2 -2
  161. package/dist/modules/auth/lib/validators.d.mts.map +1 -1
  162. package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
  163. package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
  164. package/dist/modules/commands/components/click-command.client.d.mts +2 -2
  165. package/dist/modules/commands/components/click-command.client.d.mts.map +1 -1
  166. package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
  167. package/dist/modules/commands/components/command-trigger.client.d.mts.map +1 -1
  168. package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
  169. package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
  170. package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
  171. package/dist/modules/commands/components/dropdown-command.client.d.mts.map +1 -1
  172. package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
  173. package/dist/modules/commands/components/empty-command.client.d.mts.map +1 -1
  174. package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
  175. package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
  176. package/dist/modules/commands/hooks/use-command-mutation.client.d.mts +2 -2
  177. package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
  178. package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
  179. package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
  180. package/dist/modules/commands/menus/dropdown-menu.client.d.mts.map +1 -1
  181. package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
  182. package/dist/modules/commands/menus/inline-menu.client.d.mts.map +1 -1
  183. package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
  184. package/dist/modules/commands/menus/responsive-menu.client.d.mts.map +1 -1
  185. package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
  186. package/dist/modules/commands/utils/archive-command.client.d.mts.map +1 -1
  187. package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
  188. package/dist/modules/commands/utils/delete-command.client.d.mts.map +1 -1
  189. package/dist/modules/config/db/helpers.d.mts +5 -5
  190. package/dist/modules/config/db/helpers.d.mts.map +1 -1
  191. package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
  192. package/dist/modules/data-tables/components/cell/common.client.d.mts.map +1 -1
  193. package/dist/modules/data-tables/components/column-header.d.mts +2 -2
  194. package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
  195. package/dist/modules/data-tables/components/filters/combobox.client.d.mts.map +1 -1
  196. package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
  197. package/dist/modules/data-tables/components/filters/slider.client.d.mts.map +1 -1
  198. package/dist/modules/data-tables/components/header.d.mts +4 -4
  199. package/dist/modules/data-tables/components/layout.d.mts +2 -2
  200. package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
  201. package/dist/modules/data-tables/components/search-input.client.d.mts.map +1 -1
  202. package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
  203. package/dist/modules/data-tables/components/table.d.mts +7 -7
  204. package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
  205. package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
  206. package/dist/modules/data-tables/hooks/use-context.client.d.mts.map +1 -1
  207. package/dist/modules/data-tables/lib/filters/parsers.d.mts +6 -1
  208. package/dist/modules/data-tables/lib/filters/parsers.d.mts.map +1 -1
  209. package/dist/modules/data-tables/lib/filters/parsers.mjs +6 -1
  210. package/dist/modules/data-tables/lib/filters/parsers.mjs.map +1 -1
  211. package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
  212. package/dist/modules/data-tables/tables/data-table/components/table.d.mts.map +1 -1
  213. package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
  214. package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts.map +1 -1
  215. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
  216. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts.map +1 -1
  217. package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts +2 -2
  218. package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts.map +1 -1
  219. package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts +2 -2
  220. package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts.map +1 -1
  221. package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts +3 -3
  222. package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts.map +1 -1
  223. package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts +2 -2
  224. package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts.map +1 -1
  225. package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts +2 -2
  226. package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts.map +1 -1
  227. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
  228. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts.map +1 -1
  229. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
  230. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts.map +1 -1
  231. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +6 -4
  232. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts.map +1 -1
  233. package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs +11 -6
  234. package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs.map +1 -1
  235. package/dist/modules/inline-edit/components/combobox.client.d.mts +6 -4
  236. package/dist/modules/inline-edit/components/combobox.client.d.mts.map +1 -1
  237. package/dist/modules/inline-edit/components/combobox.client.mjs +7 -5
  238. package/dist/modules/inline-edit/components/combobox.client.mjs.map +1 -1
  239. package/dist/modules/inline-edit/components/date-input.client.d.mts +5 -3
  240. package/dist/modules/inline-edit/components/date-input.client.d.mts.map +1 -1
  241. package/dist/modules/inline-edit/components/date-input.client.mjs +26 -13
  242. package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
  243. package/dist/modules/inline-edit/components/date-picker.client.d.mts +6 -4
  244. package/dist/modules/inline-edit/components/date-picker.client.d.mts.map +1 -1
  245. package/dist/modules/inline-edit/components/date-picker.client.mjs +12 -7
  246. package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
  247. package/dist/modules/inline-edit/components/editor.client.d.mts +6 -4
  248. package/dist/modules/inline-edit/components/editor.client.d.mts.map +1 -1
  249. package/dist/modules/inline-edit/components/editor.client.mjs +11 -6
  250. package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
  251. package/dist/modules/inline-edit/components/input-recipient.client.d.mts +6 -4
  252. package/dist/modules/inline-edit/components/input-recipient.client.d.mts.map +1 -1
  253. package/dist/modules/inline-edit/components/input-recipient.client.mjs +11 -6
  254. package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
  255. package/dist/modules/inline-edit/components/input-toggle.client.d.mts +6 -4
  256. package/dist/modules/inline-edit/components/input-toggle.client.d.mts.map +1 -1
  257. package/dist/modules/inline-edit/components/input-toggle.client.mjs +9 -7
  258. package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
  259. package/dist/modules/inline-edit/components/input.client.d.mts +13 -10
  260. package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
  261. package/dist/modules/inline-edit/components/input.client.mjs +35 -19
  262. package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
  263. package/dist/modules/inline-edit/components/select.client.d.mts +10 -9
  264. package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
  265. package/dist/modules/inline-edit/components/select.client.mjs +14 -7
  266. package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
  267. package/dist/modules/inline-edit/components/switch.client.d.mts +5 -3
  268. package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
  269. package/dist/modules/inline-edit/components/switch.client.mjs +8 -6
  270. package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
  271. package/dist/modules/inline-edit/components/toggle.client.d.mts +6 -4
  272. package/dist/modules/inline-edit/components/toggle.client.d.mts.map +1 -1
  273. package/dist/modules/inline-edit/components/toggle.client.mjs +9 -7
  274. package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
  275. package/dist/modules/inline-edit/hooks/use-inline.client.d.mts +35 -3
  276. package/dist/modules/inline-edit/hooks/use-inline.client.d.mts.map +1 -1
  277. package/dist/modules/inline-edit/hooks/use-inline.client.mjs +71 -9
  278. package/dist/modules/inline-edit/hooks/use-inline.client.mjs.map +1 -1
  279. package/dist/modules/inline-edit/lib/variants.d.mts +1 -0
  280. package/dist/modules/inline-edit/lib/variants.d.mts.map +1 -1
  281. package/dist/modules/inline-edit/lib/variants.mjs +12 -4
  282. package/dist/modules/inline-edit/lib/variants.mjs.map +1 -1
  283. package/dist/modules/router/handler/init.server.d.mts +6 -6
  284. package/dist/modules/router/handler/init.server.d.mts.map +1 -1
  285. package/dist/modules/router/lib/query-client.server.d.mts +2 -2
  286. package/dist/modules/storage/components/dropzone-context.client.d.mts +2 -2
  287. package/dist/modules/storage/components/dropzone-context.client.d.mts.map +1 -1
  288. package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
  289. package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
  290. package/dist/modules/storage/components/dropzone.client.mjs +1 -1
  291. package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
  292. package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
  293. package/dist/modules/storage/components/image-grid.client.mjs +3 -3
  294. package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
  295. package/dist/modules/storage/components/upload-zone-context.client.d.mts +3 -11
  296. package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
  297. package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
  298. package/dist/modules/storage/components/upload-zone.client.d.mts +10 -31
  299. package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
  300. package/dist/modules/storage/components/upload-zone.client.mjs +19 -91
  301. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  302. package/dist/modules/storage/config/filters.d.mts +2 -0
  303. package/dist/modules/storage/config/filters.d.mts.map +1 -1
  304. package/dist/modules/storage/config/filters.mjs +3 -1
  305. package/dist/modules/storage/config/filters.mjs.map +1 -1
  306. package/dist/modules/storage/lib/create-upload.client.d.mts +56 -0
  307. package/dist/modules/storage/lib/create-upload.client.d.mts.map +1 -0
  308. package/dist/modules/storage/lib/create-upload.client.mjs +98 -0
  309. package/dist/modules/storage/lib/create-upload.client.mjs.map +1 -0
  310. package/dist/modules/storage/lib/helpers.d.mts +2 -2
  311. package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
  312. package/dist/modules/storage/lib/helpers.mjs +1 -0
  313. package/dist/modules/storage/lib/helpers.mjs.map +1 -1
  314. package/dist/modules/storage/lib/router.server.d.mts +4181 -2283
  315. package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
  316. package/dist/modules/storage/lib/router.server.mjs +5 -2
  317. package/dist/modules/storage/lib/router.server.mjs.map +1 -1
  318. package/dist/modules/storage/lib/schema.d.mts +156 -88
  319. package/dist/modules/storage/lib/schema.d.mts.map +1 -1
  320. package/dist/modules/storage/lib/schema.mjs +3 -1
  321. package/dist/modules/storage/lib/schema.mjs.map +1 -1
  322. package/dist/modules/storage/lib/service.server.d.mts +54 -38
  323. package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
  324. package/dist/modules/storage/lib/service.server.mjs +11 -5
  325. package/dist/modules/storage/lib/service.server.mjs.map +1 -1
  326. package/dist/modules/storage/lib/validators.d.mts +232 -71
  327. package/dist/modules/storage/lib/validators.d.mts.map +1 -1
  328. package/dist/modules/storage/lib/validators.mjs +16 -25
  329. package/dist/modules/storage/lib/validators.mjs.map +1 -1
  330. package/dist/storage/client.d.mts +2 -1
  331. package/dist/storage/client.mjs +2 -8
  332. package/dist/storage.d.mts +3 -3
  333. package/dist/storage.mjs +3 -3
  334. package/package.json +2 -1
  335. package/src/components/editor/components/editor.client.tsx +7 -2
  336. package/src/components/editor/components/menu.client.tsx +26 -0
  337. package/src/components/editor/extensions/file-handler/extension.ts +69 -0
  338. package/src/components/editor/extensions/file-handler/strategy.ts +167 -0
  339. package/src/components/editor/extensions/file-handler/utils.ts +51 -0
  340. package/src/components/editor/extensions/image/extension.ts +57 -0
  341. package/src/components/editor/extensions/skeleton/extension.ts +35 -0
  342. package/src/components/editor/extensions/skeleton/renderer.tsx +14 -0
  343. package/src/components/editor/lib/constants.ts +16 -2
  344. package/src/components/editor/lib/extensions.ts +4 -1
  345. package/src/components/editor/lib/utils.ts +32 -0
  346. package/src/components/editor/lib/variants.ts +72 -1
  347. package/src/components/entry.ts +2 -1
  348. package/src/lib/hooks/use-indicator.tsx +27 -18
  349. package/src/modules/data-tables/lib/filters/parsers.ts +14 -0
  350. package/src/modules/inline-edit/components/combobox-dropdown.client.tsx +21 -12
  351. package/src/modules/inline-edit/components/combobox.client.tsx +13 -6
  352. package/src/modules/inline-edit/components/date-input.client.tsx +29 -13
  353. package/src/modules/inline-edit/components/date-picker.client.tsx +13 -9
  354. package/src/modules/inline-edit/components/editor.client.tsx +14 -14
  355. package/src/modules/inline-edit/components/input-recipient.client.tsx +15 -8
  356. package/src/modules/inline-edit/components/input-toggle.client.tsx +16 -9
  357. package/src/modules/inline-edit/components/input.client.tsx +38 -24
  358. package/src/modules/inline-edit/components/select.client.tsx +16 -9
  359. package/src/modules/inline-edit/components/switch.client.tsx +10 -6
  360. package/src/modules/inline-edit/components/toggle.client.tsx +13 -9
  361. package/src/modules/inline-edit/entry.client.ts +0 -1
  362. package/src/modules/inline-edit/hooks/use-inline.client copy.tsx +97 -0
  363. package/src/modules/inline-edit/hooks/use-inline.client.tsx +139 -20
  364. package/src/modules/inline-edit/lib/variants.ts +7 -0
  365. package/src/modules/storage/components/image-grid.client.tsx +2 -2
  366. package/src/modules/storage/components/upload-zone-context.client.tsx +3 -4
  367. package/src/modules/storage/components/upload-zone.client.tsx +17 -113
  368. package/src/modules/storage/config/filters.ts +2 -0
  369. package/src/modules/storage/entry.client.ts +2 -1
  370. package/src/modules/storage/lib/create-upload.client.ts +134 -0
  371. package/src/modules/storage/lib/helpers.ts +3 -2
  372. package/src/modules/storage/lib/router.server.ts +1 -0
  373. package/src/modules/storage/lib/schema.ts +2 -0
  374. package/src/modules/storage/lib/service.server.ts +18 -4
  375. package/src/modules/storage/lib/validators.ts +21 -31
  376. package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts +0 -21
  377. package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts.map +0 -1
  378. package/dist/modules/inline-edit/components/deprecated-editor.client.mjs +0 -37
  379. package/dist/modules/inline-edit/components/deprecated-editor.client.mjs.map +0 -1
  380. package/dist/storage/client.mjs.map +0 -1
  381. package/src/modules/inline-edit/components/deprecated-editor.client.tsx +0 -48
@@ -1,18 +1,20 @@
1
1
  import { Input } from "../../../components/ui/input.mjs";
2
2
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
3
- import * as react_jsx_runtime17 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
4
4
  import { ComponentProps } from "react";
5
5
 
6
6
  //#region src/modules/inline-edit/components/input-toggle.client.d.ts
7
- type InlineStringInputToggleProps<TValue> = Omit<ComponentProps<typeof Input>, "type"> & useInlineEditOptions<TValue>;
8
- declare function InlineStringInputToggle({
7
+ type InlineStringInputToggleProps<Required extends boolean = false> = Omit<ComponentProps<typeof Input>, "type"> & useInlineEditOptions<string, Required>;
8
+ declare function InlineStringInputToggle<Required extends boolean>({
9
9
  initialValue,
10
10
  action,
11
11
  disabled,
12
12
  permission,
13
+ updateStrategy,
14
+ isRequired,
13
15
  className,
14
16
  ...props
15
- }: InlineStringInputToggleProps<string>): react_jsx_runtime17.JSX.Element;
17
+ }: InlineStringInputToggleProps<Required>): react_jsx_runtime8.JSX.Element;
16
18
  //#endregion
17
19
  export { InlineStringInputToggle };
18
20
  //# sourceMappingURL=input-toggle.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-toggle.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/input-toggle.client.tsx"],"sourcesContent":[],"mappings":";;;;;;KASK,uCAAuC,KAAK,sBAAsB,kBACrE,qBAAqB;iBAEP,uBAAA;;;;;;;GAOb,uCAAoC,mBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"input-toggle.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/input-toggle.client.tsx"],"sourcesContent":[],"mappings":";;;;;;KASK,iEAAiE,KACpE,sBAAsB,kBAGtB,6BAA6B;iBAEf;;;;;;;;;GASb,6BAA6B,YAAS,kBAAA,CAAA,GAAA,CAAA"}
@@ -9,17 +9,19 @@ import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { useState } from "react";
10
10
 
11
11
  //#region src/modules/inline-edit/components/input-toggle.client.tsx
12
- function InlineStringInputToggle({ initialValue, action, disabled, permission, className, ...props }) {
12
+ function InlineStringInputToggle({ initialValue, action, disabled, permission, updateStrategy, isRequired, className, ...props }) {
13
13
  const [enabled, setEnabled] = useState(!!initialValue);
14
- const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({
14
+ const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({
15
15
  initialValue,
16
16
  action,
17
- permission
17
+ permission,
18
+ updateStrategy,
19
+ isRequired
18
20
  });
19
21
  function handleToggle() {
20
22
  setEnabled(!enabled);
21
23
  if (!enabled) return;
22
- handleUpdate("");
24
+ handleBlur(null);
23
25
  }
24
26
  const isDisabled = !enabled || disabled || !isAllowed;
25
27
  return /* @__PURE__ */ jsxs("div", {
@@ -27,10 +29,10 @@ function InlineStringInputToggle({ initialValue, action, disabled, permission, c
27
29
  children: [/* @__PURE__ */ jsx(Input, {
28
30
  ...props,
29
31
  type: "text",
30
- value,
32
+ value: value ?? void 0,
31
33
  disabled: isDisabled,
32
- onChange: (e) => setValue(e.target.value),
33
- onBlur: (e) => handleUpdate(e.target.value),
34
+ onChange: (e) => handleChange(e.target.value ? e.target.value : null),
35
+ onBlur: (e) => handleBlur(e.target.value ? e.target.value : null),
34
36
  className: cn("border-border/70 hover:border-border w-full", className)
35
37
  }), /* @__PURE__ */ jsx(Button, {
36
38
  variant: "ghost",
@@ -1 +1 @@
1
- {"version":3,"file":"input-toggle.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input-toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/entry\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { ComponentProps, useState } from \"react\";\nimport { useInlineEdit, useInlineEditOptions } from \"../hooks/use-inline.client\";\n\ntype InlineStringInputToggleProps<TValue> = Omit<ComponentProps<typeof Input>, \"type\"> &\n useInlineEditOptions<TValue>;\n\nexport function InlineStringInputToggle({\n initialValue,\n action,\n disabled,\n permission,\n className,\n ...props\n}: InlineStringInputToggleProps<string>) {\n const [enabled, setEnabled] = useState(!!initialValue);\n\n const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n });\n\n function handleToggle() {\n setEnabled(!enabled);\n if (!enabled) return;\n\n handleUpdate(\"\");\n }\n\n const isDisabled = !enabled || disabled || !isAllowed;\n\n return (\n <div className=\"relative\">\n <Input\n {...props}\n type=\"text\"\n value={value}\n disabled={isDisabled}\n onChange={(e) => setValue(e.target.value)}\n onBlur={(e) => handleUpdate(e.target.value)}\n className={cn(\"border-border/70 hover:border-border w-full\", className)}\n />\n\n <Button\n variant=\"ghost\"\n onClick={handleToggle}\n tabIndex={-1}\n className={cn(\n \"absolute bottom-0 right-0 top-0 opacity-50\",\n !value && \"text-muted-foreground\",\n )}\n >\n {enabled ? <CheckIcon /> : <XIcon />}\n </Button>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,wBAAwB,EACtC,cACA,QACA,UACA,YACA,WACA,GAAG,SACoC;CACvC,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC,CAAC,aAAa;CAEtD,MAAM,EAAE,OAAO,UAAU,cAAc,cAAc,cAAc;EACjE;EACA;EACA;EACD,CAAC;CAEF,SAAS,eAAe;AACtB,aAAW,CAAC,QAAQ;AACpB,MAAI,CAAC,QAAS;AAEd,eAAa,GAAG;;CAGlB,MAAM,aAAa,CAAC,WAAW,YAAY,CAAC;AAE5C,QACE,qBAAC;EAAI,WAAU;aACb,oBAAC;GACC,GAAI;GACJ,MAAK;GACE;GACP,UAAU;GACV,WAAW,MAAM,SAAS,EAAE,OAAO,MAAM;GACzC,SAAS,MAAM,aAAa,EAAE,OAAO,MAAM;GAC3C,WAAW,GAAG,+CAA+C,UAAU;IACvE,EAEF,oBAAC;GACC,SAAQ;GACR,SAAS;GACT,UAAU;GACV,WAAW,GACT,8CACA,CAAC,SAAS,wBACX;aAEA,UAAU,oBAAC,cAAY,GAAG,oBAAC,UAAQ;IAC7B;GACL"}
1
+ {"version":3,"file":"input-toggle.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input-toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/entry\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { ComponentProps, useState } from \"react\";\nimport { useInlineEdit, useInlineEditOptions } from \"../hooks/use-inline.client\";\n\ntype InlineStringInputToggleProps<Required extends boolean = false> = Omit<\n ComponentProps<typeof Input>,\n \"type\"\n> &\n useInlineEditOptions<string, Required>;\n\nexport function InlineStringInputToggle<Required extends boolean>({\n initialValue,\n action,\n disabled,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineStringInputToggleProps<Required>) {\n const [enabled, setEnabled] = useState(!!initialValue);\n\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n function handleToggle() {\n setEnabled(!enabled);\n if (!enabled) return;\n\n handleBlur(null);\n }\n\n const isDisabled = !enabled || disabled || !isAllowed;\n\n return (\n <div className=\"relative\">\n <Input\n {...props}\n type=\"text\"\n value={value ?? undefined}\n disabled={isDisabled}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\"border-border/70 hover:border-border w-full\", className)}\n />\n\n <Button\n variant=\"ghost\"\n onClick={handleToggle}\n tabIndex={-1}\n className={cn(\n \"absolute bottom-0 right-0 top-0 opacity-50\",\n !value && \"text-muted-foreground\",\n )}\n >\n {enabled ? <CheckIcon /> : <XIcon />}\n </Button>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,wBAAkD,EAChE,cACA,QACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SACsC;CACzC,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC,CAAC,aAAa;CAEtD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,SAAS,eAAe;AACtB,aAAW,CAAC,QAAQ;AACpB,MAAI,CAAC,QAAS;AAEd,aAAW,KAAK;;CAGlB,MAAM,aAAa,CAAC,WAAW,YAAY,CAAC;AAE5C,QACE,qBAAC;EAAI,WAAU;aACb,oBAAC;GACC,GAAI;GACJ,MAAK;GACL,OAAO,SAAS;GAChB,UAAU;GACV,WAAW,MAAM,aAAa,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;GACrE,SAAS,MAAM,WAAW,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;GACjE,WAAW,GAAG,+CAA+C,UAAU;IACvE,EAEF,oBAAC;GACC,SAAQ;GACR,SAAS;GACT,UAAU;GACV,WAAW,GACT,8CACA,CAAC,SAAS,wBACX;aAEA,UAAU,oBAAC,cAAY,GAAG,oBAAC,UAAQ;IAC7B;GACL"}
@@ -1,35 +1,36 @@
1
1
  import { Input } from "../../../components/ui/input.mjs";
2
2
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
3
3
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
4
- import * as react_jsx_runtime18 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime9 from "react/jsx-runtime";
5
5
  import { ComponentProps } from "react";
6
6
 
7
7
  //#region src/modules/inline-edit/components/input.client.d.ts
8
- type InlineEditInputProps<TValue> = Omit<ComponentProps<typeof Input>, "type"> & useInlineEditOptions<TValue> & InlineEditVariantsProps;
8
+ type InlineEditInputProps<TValue, Required extends boolean = false> = Omit<ComponentProps<typeof Input>, "type"> & useInlineEditOptions<TValue, Required> & InlineEditVariantsProps;
9
9
  /**
10
10
  * The inline edit string input component.
11
11
  */
12
- declare function InlineStringInput({
12
+ declare function InlineStringInput<Required extends boolean = false>({
13
13
  initialValue,
14
14
  action,
15
15
  variant,
16
16
  className,
17
17
  permission,
18
+ updateStrategy,
19
+ isRequired,
18
20
  disabled,
19
21
  ...props
20
- }: InlineEditInputProps<string | undefined>): react_jsx_runtime18.JSX.Element;
21
- /**
22
- * The inline edit number input component.
23
- */
24
- declare function InlineNumberInput({
22
+ }: InlineEditInputProps<string, Required>): react_jsx_runtime9.JSX.Element;
23
+ declare function InlineNumberInput<Required extends boolean = false>({
25
24
  initialValue,
26
25
  action,
27
26
  variant,
28
27
  className,
29
28
  permission,
29
+ updateStrategy,
30
+ isRequired,
30
31
  disabled,
31
32
  ...props
32
- }: InlineEditInputProps<number | undefined>): react_jsx_runtime18.JSX.Element;
33
+ }: InlineEditInputProps<number, Required>): react_jsx_runtime9.JSX.Element;
33
34
  /**
34
35
  * The inline edit decimal input component.
35
36
  */
@@ -39,9 +40,11 @@ declare function InlineDecimalInput({
39
40
  variant,
40
41
  className,
41
42
  permission,
43
+ updateStrategy,
44
+ isRequired,
42
45
  disabled,
43
46
  ...props
44
- }: InlineEditInputProps<string | undefined>): react_jsx_runtime18.JSX.Element;
47
+ }: InlineEditInputProps<string>): react_jsx_runtime9.JSX.Element;
45
48
  //#endregion
46
49
  export { InlineDecimalInput, InlineNumberInput, InlineStringInput };
47
50
  //# sourceMappingURL=input.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/input.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;KAQK,+BAA+B,KAAK,sBAAsB,kBAC7D,qBAAqB,UACrB;;;AAJ4E;AAEf,iBAO/C,iBAAA,CAP+C;EAAA,YAAA;EAAA,MAAA;EAAA,OAAA;EAAA,SAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAe5D,oBAf4D,CAAA,MAAA,GAAA,SAAA,CAAA,CAAA,EAepB,mBAAA,CAAA,GAAA,CAAA,OAfoB;;;;AAC7D,iBAyCc,iBAAA,CAzCd;EAAA,YAAA;EAAA,MAAA;EAAA,OAAA;EAAA,SAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAiDC,oBAjDD,CAAA,MAAA,GAAA,SAAA,CAAA,CAAA,EAiDyC,mBAAA,CAAA,GAAA,CAAA,OAjDzC;;;AAMF;AACE,iBAyEc,kBAAA,CAzEd;EAAA,YAAA;EAAA,MAAA;EAAA,OAAA;EAAA,SAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAiFC,oBAjFD,CAAA,MAAA,GAAA,SAAA,CAAA,CAAA,EAiFyC,mBAAA,CAAA,GAAA,CAAA,OAjFzC"}
1
+ {"version":3,"file":"input.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/input.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;KAQK,iEAAiE,KACpE,sBAAsB,kBAGtB,qBAAqB,QAAQ,YAC7B;;;AAP4E;AAGtD,iBASR,iBATQ,CAAA,iBAAA,OAAA,GAAA,KAAA,CAAA,CAAA;EAAA,YAAA;EAAA,MAAA;EAAA,OAAA;EAAA,SAAA;EAAA,UAAA;EAAA,cAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAmBrB,oBAnBqB,CAAA,MAAA,EAmBQ,QAnBR,CAAA,CAAA,EAmBiB,kBAAA,CAAA,GAAA,CAAA,OAnBjB;AAAtB,iBAmDc,iBAnDd,CAAA,iBAAA,OAAA,GAAA,KAAA,CAAA,CAAA;EAAA,YAAA;EAAA,MAAA;EAAA,OAAA;EAAA,SAAA;EAAA,UAAA;EAAA,cAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EA6DC,oBA7DD,CAAA,MAAA,EA6D8B,QA7D9B,CAAA,CAAA,EA6DuC,kBAAA,CAAA,GAAA,CAAA,OA7DvC;;;;AAGA,iBAuFc,kBAAA,CAvFd;EAAA,YAAA;EAAA,MAAA;EAAA,OAAA;EAAA,SAAA;EAAA,UAAA;EAAA,cAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAiGC,oBAjGD,CAAA,MAAA,CAAA,CAAA,EAiG6B,kBAAA,CAAA,GAAA,CAAA,OAjG7B"}
@@ -10,58 +10,74 @@ import { jsx } from "react/jsx-runtime";
10
10
  /**
11
11
  * The inline edit string input component.
12
12
  */
13
- function InlineStringInput({ initialValue, action, variant, className, permission, disabled, ...props }) {
14
- const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({
13
+ function InlineStringInput({ initialValue, action, variant, className, permission, updateStrategy, isRequired, disabled, ...props }) {
14
+ const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({
15
15
  initialValue,
16
16
  action,
17
- permission
17
+ permission,
18
+ updateStrategy,
19
+ isRequired
18
20
  });
19
21
  return /* @__PURE__ */ jsx(Input, {
20
22
  ...props,
21
23
  type: "text",
22
- value,
24
+ value: value ?? void 0,
23
25
  disabled: disabled || !isAllowed,
24
- onChange: (e) => setValue(e.target.value),
25
- onBlur: (e) => handleUpdate(e.target.value),
26
- className: cn("border-border/70 hover:border-border w-full", inlineEditVariants({ variant }), className)
26
+ onChange: (e) => handleChange(e.target.value ? e.target.value : null),
27
+ onBlur: (e) => handleBlur(e.target.value ? e.target.value : null),
28
+ className: cn("border-border/70 hover:border-border w-full", inlineEditVariants({
29
+ variant,
30
+ status
31
+ }), className)
27
32
  });
28
33
  }
29
34
  /**
30
35
  * The inline edit number input component.
31
36
  */
32
- function InlineNumberInput({ initialValue, action, variant, className, permission, disabled, ...props }) {
33
- const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({
37
+ const parseValueAsNumber = (valueAsNumber) => !isNaN(Number(valueAsNumber)) ? valueAsNumber : null;
38
+ function InlineNumberInput({ initialValue, action, variant, className, permission, updateStrategy, isRequired, disabled, ...props }) {
39
+ const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({
34
40
  initialValue,
35
41
  action,
36
- permission
42
+ permission,
43
+ updateStrategy,
44
+ isRequired
37
45
  });
38
46
  return /* @__PURE__ */ jsx(Input, {
39
47
  ...props,
40
48
  type: "number",
41
49
  value: value ?? void 0,
42
50
  disabled: disabled || !isAllowed,
43
- onChange: (e) => setValue(!isNaN(e.target.valueAsNumber) ? e.target.valueAsNumber : void 0),
44
- onBlur: (e) => handleUpdate(!isNaN(e.target.valueAsNumber) ? e.target.valueAsNumber : void 0),
45
- className: cn("border-border/70 hover:border-border w-full", inlineEditVariants({ variant }), className)
51
+ onChange: (e) => handleChange(parseValueAsNumber(e.target.valueAsNumber)),
52
+ onBlur: (e) => handleBlur(parseValueAsNumber(e.target.valueAsNumber)),
53
+ className: cn("border-border/70 hover:border-border w-full", inlineEditVariants({
54
+ variant,
55
+ status
56
+ }), className)
46
57
  });
47
58
  }
48
59
  /**
49
60
  * The inline edit decimal input component.
50
61
  */
51
- function InlineDecimalInput({ initialValue, action, variant, className, permission, disabled, ...props }) {
52
- const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({
62
+ function InlineDecimalInput({ initialValue, action, variant, className, permission, updateStrategy, isRequired, disabled, ...props }) {
63
+ const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({
53
64
  initialValue,
54
65
  action,
55
- permission
66
+ permission,
67
+ updateStrategy,
68
+ isRequired
56
69
  });
57
70
  return /* @__PURE__ */ jsx(Input, {
58
71
  ...props,
59
72
  type: "number",
60
73
  value: value ?? void 0,
61
74
  disabled: disabled || !isAllowed,
62
- onChange: (e) => setValue(e.target.value),
63
- onBlur: (e) => handleUpdate(e.target.value ? e.target.value : void 0),
64
- className: cn("border-border/70 hover:border-border w-full", inlineEditVariants({ variant }), className)
75
+ onChange: (e) => handleChange(e.target.value ? e.target.value : null),
76
+ onBlur: (e) => handleBlur(e.target.value ? e.target.value : null),
77
+ className: cn("border-border/70 hover:border-border w-full", inlineEditVariants({
78
+ variant,
79
+ status
80
+ }), className)
65
81
  });
66
82
  }
67
83
 
@@ -1 +1 @@
1
- {"version":3,"file":"input.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { ComponentProps } from \"react\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { inlineEditVariants, InlineEditVariantsProps } from \"../lib/variants\";\n\ntype InlineEditInputProps<TValue> = Omit<ComponentProps<typeof Input>, \"type\"> &\n useInlineEditOptions<TValue> &\n InlineEditVariantsProps;\n\n/**\n * The inline edit string input component.\n */\nexport function InlineStringInput({\n initialValue,\n action,\n variant,\n className,\n permission,\n disabled,\n ...props\n}: InlineEditInputProps<string | undefined>) {\n const { value, setValue, handleUpdate, isAllowed } = useInlineEdit<string | undefined>({\n initialValue,\n action,\n permission,\n });\n\n return (\n <Input\n {...props}\n type=\"text\"\n value={value}\n disabled={disabled || !isAllowed}\n onChange={(e) => setValue(e.target.value)}\n onBlur={(e) => handleUpdate(e.target.value)}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant }),\n className,\n )}\n />\n );\n}\n\n/**\n * The inline edit number input component.\n */\nexport function InlineNumberInput({\n initialValue,\n action,\n variant,\n className,\n permission,\n disabled,\n ...props\n}: InlineEditInputProps<number | undefined>) {\n const { value, setValue, handleUpdate, isAllowed } = useInlineEdit<number | undefined>({\n initialValue,\n action,\n permission,\n });\n\n return (\n <Input\n {...props}\n type=\"number\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) =>\n setValue(!isNaN(e.target.valueAsNumber) ? e.target.valueAsNumber : undefined)\n }\n onBlur={(e) =>\n handleUpdate(!isNaN(e.target.valueAsNumber) ? e.target.valueAsNumber : undefined)\n }\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant }),\n className,\n )}\n />\n );\n}\n\n/**\n * The inline edit decimal input component.\n */\nexport function InlineDecimalInput({\n initialValue,\n action,\n variant,\n className,\n permission,\n disabled,\n ...props\n}: InlineEditInputProps<string | undefined>) {\n const { value, setValue, handleUpdate, isAllowed } = useInlineEdit<string | undefined>({\n initialValue,\n action,\n permission,\n });\n\n return (\n <Input\n {...props}\n type=\"number\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => setValue(e.target.value)}\n onBlur={(e) => handleUpdate(e.target.value ? e.target.value : undefined)}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant }),\n className,\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAgB,kBAAkB,EAChC,cACA,QACA,SACA,WACA,YACA,UACA,GAAG,SACwC;CAC3C,MAAM,EAAE,OAAO,UAAU,cAAc,cAAc,cAAkC;EACrF;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACE;EACP,UAAU,YAAY,CAAC;EACvB,WAAW,MAAM,SAAS,EAAE,OAAO,MAAM;EACzC,SAAS,MAAM,aAAa,EAAE,OAAO,MAAM;EAC3C,WAAW,GACT,+CACA,mBAAmB,EAAE,SAAS,CAAC,EAC/B,UACD;GACD;;;;;AAON,SAAgB,kBAAkB,EAChC,cACA,QACA,SACA,WACA,YACA,UACA,GAAG,SACwC;CAC3C,MAAM,EAAE,OAAO,UAAU,cAAc,cAAc,cAAkC;EACrF;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACL,OAAO,SAAS;EAChB,UAAU,YAAY,CAAC;EACvB,WAAW,MACT,SAAS,CAAC,MAAM,EAAE,OAAO,cAAc,GAAG,EAAE,OAAO,gBAAgB,OAAU;EAE/E,SAAS,MACP,aAAa,CAAC,MAAM,EAAE,OAAO,cAAc,GAAG,EAAE,OAAO,gBAAgB,OAAU;EAEnF,WAAW,GACT,+CACA,mBAAmB,EAAE,SAAS,CAAC,EAC/B,UACD;GACD;;;;;AAON,SAAgB,mBAAmB,EACjC,cACA,QACA,SACA,WACA,YACA,UACA,GAAG,SACwC;CAC3C,MAAM,EAAE,OAAO,UAAU,cAAc,cAAc,cAAkC;EACrF;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACL,OAAO,SAAS;EAChB,UAAU,YAAY,CAAC;EACvB,WAAW,MAAM,SAAS,EAAE,OAAO,MAAM;EACzC,SAAS,MAAM,aAAa,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,OAAU;EACxE,WAAW,GACT,+CACA,mBAAmB,EAAE,SAAS,CAAC,EAC/B,UACD;GACD"}
1
+ {"version":3,"file":"input.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { ComponentProps } from \"react\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { inlineEditVariants, InlineEditVariantsProps } from \"../lib/variants\";\n\ntype InlineEditInputProps<TValue, Required extends boolean = false> = Omit<\n ComponentProps<typeof Input>,\n \"type\"\n> &\n useInlineEditOptions<TValue, Required> &\n InlineEditVariantsProps;\n\n/**\n * The inline edit string input component.\n */\nexport function InlineStringInput<Required extends boolean = false>({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<string, Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Input\n {...props}\n type=\"text\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n\n/**\n * The inline edit number input component.\n */\nconst parseValueAsNumber = (valueAsNumber: number): number | null =>\n !isNaN(Number(valueAsNumber)) ? valueAsNumber : null;\n\nexport function InlineNumberInput<Required extends boolean = false>({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<number, Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Input\n {...props}\n type=\"number\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(parseValueAsNumber(e.target.valueAsNumber))}\n onBlur={(e) => handleBlur(parseValueAsNumber(e.target.valueAsNumber))}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n\n/**\n * The inline edit decimal input component.\n */\nexport function InlineDecimalInput({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<string>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Input\n {...props}\n type=\"number\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAgB,kBAAoD,EAClE,cACA,QACA,SACA,WACA,YACA,gBACA,YACA,UACA,GAAG,SACsC;CACzC,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACL,OAAO,SAAS;EAChB,UAAU,YAAY,CAAC;EACvB,WAAW,MAAM,aAAa,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;EACrE,SAAS,MAAM,WAAW,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;EACjE,WAAW,GACT,+CACA,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EACvC,UACD;GACD;;;;;AAON,MAAM,sBAAsB,kBAC1B,CAAC,MAAM,OAAO,cAAc,CAAC,GAAG,gBAAgB;AAElD,SAAgB,kBAAoD,EAClE,cACA,QACA,SACA,WACA,YACA,gBACA,YACA,UACA,GAAG,SACsC;CACzC,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACL,OAAO,SAAS;EAChB,UAAU,YAAY,CAAC;EACvB,WAAW,MAAM,aAAa,mBAAmB,EAAE,OAAO,cAAc,CAAC;EACzE,SAAS,MAAM,WAAW,mBAAmB,EAAE,OAAO,cAAc,CAAC;EACrE,WAAW,GACT,+CACA,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EACvC,UACD;GACD;;;;;AAON,SAAgB,mBAAmB,EACjC,cACA,QACA,SACA,WACA,YACA,gBACA,YACA,UACA,GAAG,SAC4B;CAC/B,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACL,OAAO,SAAS;EAChB,UAAU,YAAY,CAAC;EACvB,WAAW,MAAM,aAAa,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;EACrE,SAAS,MAAM,WAAW,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;EACjE,WAAW,GACT,+CACA,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EACvC,UACD;GACD"}
@@ -1,29 +1,30 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
2
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
3
- import * as react_jsx_runtime21 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime12 from "react/jsx-runtime";
4
4
  import { SelectContentProps, SelectItemProps, SelectProps, SelectTriggerProps, SelectValueProps } from "@radix-ui/react-select";
5
5
 
6
6
  //#region src/modules/inline-edit/components/select.client.d.ts
7
- type InlineSelectProps = SelectProps & useInlineEditOptions<string>;
8
- declare function InlineSelect({
7
+ declare function InlineSelect<Required extends boolean = false>({
9
8
  initialValue,
10
9
  action,
11
10
  permission,
11
+ updateStrategy,
12
+ isRequired,
12
13
  disabled,
13
14
  ...props
14
- }: InlineSelectProps): react_jsx_runtime21.JSX.Element;
15
+ }: SelectProps & useInlineEditOptions<string, Required>): react_jsx_runtime12.JSX.Element;
15
16
  type InlineSelectTriggerProps = SelectTriggerProps;
16
17
  declare function InlineSelectTrigger({
17
18
  variant,
18
19
  className,
19
20
  ...props
20
- }: InlineSelectTriggerProps & InlineEditVariantsProps): react_jsx_runtime21.JSX.Element;
21
+ }: InlineSelectTriggerProps & InlineEditVariantsProps): react_jsx_runtime12.JSX.Element;
21
22
  type InlineSelectContentProps = SelectContentProps;
22
- declare function InlineSelectContent(props: InlineSelectContentProps): react_jsx_runtime21.JSX.Element;
23
+ declare function InlineSelectContent(props: InlineSelectContentProps): react_jsx_runtime12.JSX.Element;
23
24
  type InlineSelectValueProps = SelectValueProps;
24
- declare function InlineSelectValue(props: InlineSelectValueProps): react_jsx_runtime21.JSX.Element;
25
+ declare function InlineSelectValue(props: InlineSelectValueProps): react_jsx_runtime12.JSX.Element;
25
26
  type InlineSelectItenProps = SelectItemProps;
26
- declare function InlineSelectItem(props: InlineSelectItenProps): react_jsx_runtime21.JSX.Element;
27
+ declare function InlineSelectItem(props: InlineSelectItenProps): react_jsx_runtime12.JSX.Element;
27
28
  //#endregion
28
- export { InlineSelect, InlineSelectContent, InlineSelectContentProps, InlineSelectItem, InlineSelectItenProps, InlineSelectProps, InlineSelectTrigger, InlineSelectTriggerProps, InlineSelectValue, InlineSelectValueProps };
29
+ export { InlineSelect, InlineSelectContent, InlineSelectContentProps, InlineSelectItem, InlineSelectItenProps, InlineSelectTrigger, InlineSelectTriggerProps, InlineSelectValue, InlineSelectValueProps };
29
30
  //# sourceMappingURL=select.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":[],"mappings":";;;;;;KAoBY,iBAAA,GAAoB,cAAc;iBAE9B,YAAA;;;;;;GAMb,oBAAiB,mBAAA,CAAA,GAAA,CAAA;KAoBR,wBAAA,GAA2B;AA5B3B,iBA8BI,mBAAA,CA9BgB;EAAA,OAAc;EAAA,SAAA;EAAA,GAAA;AAAoB,CAAA,EAkC/D,wBAlC+D,GAkCpC,uBAlCoC,CAAA,EAkCb,mBAAA,CAAA,GAAA,CAAA,OAlCa;AAElD,KAoCJ,wBAAA,GAA2B,kBApCX;AAC1B,iBAqCc,mBAAA,CArCd,KAAA,EAqCyC,wBArCzC,CAAA,EAqCiE,mBAAA,CAAA,GAAA,CAAA,OArCjE;AACA,KAwCU,sBAAA,GAAyB,gBAxCnC;AACA,iBAyCc,iBAAA,CAzCd,KAAA,EAyCuC,sBAzCvC,CAAA,EAyC6D,mBAAA,CAAA,GAAA,CAAA,OAzC7D;AACA,KA4CU,qBAAA,GAAwB,eA5ClC;AAEC,iBA4Ca,gBAAA,CA5Cb,KAAA,EA4CqC,qBA5CrC,CAAA,EA4C0D,mBAAA,CAAA,GAAA,CAAA,OA5C1D"}
1
+ {"version":3,"file":"select.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":[],"mappings":";;;;;;iBAqBgB;;;;;;;;GAQb,cAAc,6BAA6B,YAAS,mBAAA,CAAA,GAAA,CAAA;KAsB3C,wBAAA,GAA2B;iBAEvB,mBAAA;;;;GAIb,2BAA2B,0BAAuB,mBAAA,CAAA,GAAA,CAAA;AApCrC,KA4CJ,wBAAA,GAA2B,kBA5CX;AAC1B,iBA6Cc,mBAAA,CA7Cd,KAAA,EA6CyC,wBA7CzC,CAAA,EA6CiE,mBAAA,CAAA,GAAA,CAAA,OA7CjE;AACA,KAgDU,sBAAA,GAAyB,gBAhDnC;AACA,iBAiDc,iBAAA,CAjDd,KAAA,EAiDuC,sBAjDvC,CAAA,EAiD6D,mBAAA,CAAA,GAAA,CAAA,OAjD7D;AACA,KAoDU,qBAAA,GAAwB,eApDlC;AACA,iBAqDc,gBAAA,CArDd,KAAA,EAqDsC,qBArDtC,CAAA,EAqD2D,mBAAA,CAAA,GAAA,CAAA,OArD3D"}
@@ -1,32 +1,39 @@
1
1
  "use client";
2
2
 
3
3
  import { cn } from "../../../lib/utils/cn.mjs";
4
+ import { useIndicator } from "../../../lib/hooks/use-indicator.mjs";
4
5
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select.client.mjs";
5
6
  import { useInlineEdit } from "../hooks/use-inline.client.mjs";
6
7
  import { inlineEditVariants } from "../lib/variants.mjs";
7
8
  import { jsx } from "react/jsx-runtime";
8
9
 
9
10
  //#region src/modules/inline-edit/components/select.client.tsx
10
- function InlineSelect({ initialValue, action, permission, disabled, ...props }) {
11
- const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({
11
+ function InlineSelect({ initialValue, action, permission, updateStrategy, isRequired, disabled, ...props }) {
12
+ const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({
12
13
  initialValue,
13
14
  action,
14
- permission
15
+ permission,
16
+ updateStrategy,
17
+ isRequired
15
18
  });
16
19
  return /* @__PURE__ */ jsx(Select, {
17
20
  ...props,
18
21
  disabled: disabled || !isAllowed,
19
- defaultValue: value,
22
+ defaultValue: value ?? void 0,
20
23
  onValueChange: (value$1) => {
21
- setValue(value$1);
22
- handleUpdate(value$1);
24
+ handleChange(value$1 ? value$1 : null);
25
+ handleBlur(value$1 ? value$1 : null);
23
26
  }
24
27
  });
25
28
  }
26
29
  function InlineSelectTrigger({ variant, className, ...props }) {
30
+ const { status } = useIndicator();
27
31
  return /* @__PURE__ */ jsx(SelectTrigger, {
28
32
  ...props,
29
- className: cn(inlineEditVariants({ variant }), className)
33
+ className: cn(inlineEditVariants({
34
+ variant,
35
+ status
36
+ }), className)
30
37
  });
31
38
  }
32
39
  function InlineSelectContent(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"select.client.mjs","names":["value"],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport type {\n SelectContentProps,\n SelectItemProps,\n SelectProps,\n SelectTriggerProps,\n SelectValueProps,\n} from \"@radix-ui/react-select\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { inlineEditVariants, InlineEditVariantsProps } from \"../lib/variants\";\n\nexport type InlineSelectProps = SelectProps & useInlineEditOptions<string>;\n\nexport function InlineSelect({\n initialValue,\n action,\n permission,\n disabled,\n ...props\n}: InlineSelectProps) {\n const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n });\n\n return (\n <Select\n {...props}\n disabled={disabled || !isAllowed}\n defaultValue={value}\n onValueChange={(value) => {\n setValue(value);\n handleUpdate(value);\n }}\n />\n );\n}\n\nexport type InlineSelectTriggerProps = SelectTriggerProps;\n\nexport function InlineSelectTrigger({\n variant,\n className,\n ...props\n}: InlineSelectTriggerProps & InlineEditVariantsProps) {\n return <SelectTrigger {...props} className={cn(inlineEditVariants({ variant }), className)} />;\n}\n\nexport type InlineSelectContentProps = SelectContentProps;\n\nexport function InlineSelectContent(props: InlineSelectContentProps) {\n return <SelectContent {...props} />;\n}\n\nexport type InlineSelectValueProps = SelectValueProps;\n\nexport function InlineSelectValue(props: InlineSelectValueProps) {\n return <SelectValue {...props} />;\n}\n\nexport type InlineSelectItenProps = SelectItemProps;\n\nexport function InlineSelectItem(props: InlineSelectItenProps) {\n return <SelectItem {...props} />;\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,aAAa,EAC3B,cACA,QACA,YACA,UACA,GAAG,SACiB;CACpB,MAAM,EAAE,OAAO,UAAU,cAAc,cAAc,cAAc;EACjE;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,YAAY,CAAC;EACvB,cAAc;EACd,gBAAgB,YAAU;AACxB,YAASA,QAAM;AACf,gBAAaA,QAAM;;GAErB;;AAMN,SAAgB,oBAAoB,EAClC,SACA,WACA,GAAG,SACkD;AACrD,QAAO,oBAAC;EAAc,GAAI;EAAO,WAAW,GAAG,mBAAmB,EAAE,SAAS,CAAC,EAAE,UAAU;GAAI;;AAKhG,SAAgB,oBAAoB,OAAiC;AACnE,QAAO,oBAAC,iBAAc,GAAI,QAAS;;AAKrC,SAAgB,kBAAkB,OAA+B;AAC/D,QAAO,oBAAC,eAAY,GAAI,QAAS;;AAKnC,SAAgB,iBAAiB,OAA8B;AAC7D,QAAO,oBAAC,cAAW,GAAI,QAAS"}
1
+ {"version":3,"file":"select.client.mjs","names":["value"],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select.client\";\nimport { useIndicator } from \"@/lib/entry.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport type {\n SelectContentProps,\n SelectItemProps,\n SelectProps,\n SelectTriggerProps,\n SelectValueProps,\n} from \"@radix-ui/react-select\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { inlineEditVariants, InlineEditVariantsProps } from \"../lib/variants\";\n\nexport function InlineSelect<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: SelectProps & useInlineEditOptions<string, Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Select\n {...props}\n disabled={disabled || !isAllowed}\n defaultValue={value ?? undefined}\n onValueChange={(value) => {\n handleChange(value ? value : null);\n handleBlur(value ? value : null);\n }}\n />\n );\n}\n\nexport type InlineSelectTriggerProps = SelectTriggerProps;\n\nexport function InlineSelectTrigger({\n variant,\n className,\n ...props\n}: InlineSelectTriggerProps & InlineEditVariantsProps) {\n const { status } = useIndicator();\n\n return (\n <SelectTrigger {...props} className={cn(inlineEditVariants({ variant, status }), className)} />\n );\n}\n\nexport type InlineSelectContentProps = SelectContentProps;\n\nexport function InlineSelectContent(props: InlineSelectContentProps) {\n return <SelectContent {...props} />;\n}\n\nexport type InlineSelectValueProps = SelectValueProps;\n\nexport function InlineSelectValue(props: InlineSelectValueProps) {\n return <SelectValue {...props} />;\n}\n\nexport type InlineSelectItenProps = SelectItemProps;\n\nexport function InlineSelectItem(props: InlineSelectItenProps) {\n return <SelectItem {...props} />;\n}\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,gBACA,YACA,UACA,GAAG,SACoD;CACvD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,YAAY,CAAC;EACvB,cAAc,SAAS;EACvB,gBAAgB,YAAU;AACxB,gBAAaA,UAAQA,UAAQ,KAAK;AAClC,cAAWA,UAAQA,UAAQ,KAAK;;GAElC;;AAMN,SAAgB,oBAAoB,EAClC,SACA,WACA,GAAG,SACkD;CACrD,MAAM,EAAE,WAAW,cAAc;AAEjC,QACE,oBAAC;EAAc,GAAI;EAAO,WAAW,GAAG,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EAAE,UAAU;GAAI;;AAMnG,SAAgB,oBAAoB,OAAiC;AACnE,QAAO,oBAAC,iBAAc,GAAI,QAAS;;AAKrC,SAAgB,kBAAkB,OAA+B;AAC/D,QAAO,oBAAC,eAAY,GAAI,QAAS;;AAKnC,SAAgB,iBAAiB,OAA8B;AAC7D,QAAO,oBAAC,cAAW,GAAI,QAAS"}
@@ -1,15 +1,17 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
- import * as react_jsx_runtime26 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime17 from "react/jsx-runtime";
3
3
  import { SwitchProps } from "@radix-ui/react-switch";
4
4
 
5
5
  //#region src/modules/inline-edit/components/switch.client.d.ts
6
- declare function InlineSwitch({
6
+ declare function InlineSwitch<Required extends boolean = false>({
7
7
  initialValue,
8
8
  action,
9
9
  permission,
10
+ updateStrategy,
11
+ isRequired,
10
12
  disabled,
11
13
  ...props
12
- }: SwitchProps & useInlineEditOptions<boolean>): react_jsx_runtime26.JSX.Element;
14
+ }: SwitchProps & useInlineEditOptions<boolean, Required>): react_jsx_runtime17.JSX.Element;
13
15
  //#endregion
14
16
  export { InlineSwitch };
15
17
  //# sourceMappingURL=switch.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":[],"mappings":";;;;;iBAMgB,YAAA;;;;;;GAMb,cAAc,gCAA6B,mBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"switch.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":[],"mappings":";;;;;iBAMgB;;;;;;;;GAQb,cAAc,8BAA8B,YAAS,mBAAA,CAAA,GAAA,CAAA"}
@@ -5,19 +5,21 @@ import { useInlineEdit } from "../hooks/use-inline.client.mjs";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/modules/inline-edit/components/switch.client.tsx
8
- function InlineSwitch({ initialValue, action, permission, disabled, ...props }) {
9
- const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({
8
+ function InlineSwitch({ initialValue, action, permission, updateStrategy, isRequired, disabled, ...props }) {
9
+ const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({
10
10
  initialValue,
11
11
  action,
12
- permission
12
+ permission,
13
+ updateStrategy,
14
+ isRequired
13
15
  });
14
16
  return /* @__PURE__ */ jsx(Switch, {
15
17
  ...props,
16
18
  disabled: disabled || !isAllowed,
17
- defaultChecked: value,
19
+ defaultChecked: value ?? void 0,
18
20
  onCheckedChange: (checked) => {
19
- setValue(checked);
20
- handleUpdate(checked);
21
+ handleChange(checked ?? null);
22
+ handleBlur(checked ?? null);
21
23
  }
22
24
  });
23
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"switch.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Switch } from \"@/components/ui/switch\";\nimport { type SwitchProps } from \"@radix-ui/react-switch\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport function InlineSwitch({\n initialValue,\n action,\n permission,\n disabled,\n ...props\n}: SwitchProps & useInlineEditOptions<boolean>) {\n const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n });\n\n return (\n <Switch\n {...props}\n disabled={disabled || !isAllowed}\n defaultChecked={value}\n onCheckedChange={(checked) => {\n setValue(checked);\n handleUpdate(checked);\n }}\n />\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,aAAa,EAC3B,cACA,QACA,YACA,UACA,GAAG,SAC2C;CAC9C,MAAM,EAAE,OAAO,UAAU,cAAc,cAAc,cAAc;EACjE;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,YAAY,CAAC;EACvB,gBAAgB;EAChB,kBAAkB,YAAY;AAC5B,YAAS,QAAQ;AACjB,gBAAa,QAAQ;;GAEvB"}
1
+ {"version":3,"file":"switch.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Switch } from \"@/components/ui/switch\";\nimport { type SwitchProps } from \"@radix-ui/react-switch\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport function InlineSwitch<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: SwitchProps & useInlineEditOptions<boolean, Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Switch\n {...props}\n disabled={disabled || !isAllowed}\n defaultChecked={value ?? undefined}\n onCheckedChange={(checked) => {\n handleChange(checked ?? null);\n handleBlur(checked ?? null);\n }}\n />\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,gBACA,YACA,UACA,GAAG,SACqD;CACxD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,YAAY,CAAC;EACvB,gBAAgB,SAAS;EACzB,kBAAkB,YAAY;AAC5B,gBAAa,WAAW,KAAK;AAC7B,cAAW,WAAW,KAAK;;GAE7B"}
@@ -1,17 +1,19 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
- import * as react_jsx_runtime27 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/modules/inline-edit/components/toggle.client.d.ts
6
- type InlineEditToggleProps = React.HTMLAttributes<HTMLDivElement> & useInlineEditOptions<boolean>;
7
- declare function InlineToggle({
6
+ type InlineEditToggleProps<Required extends boolean = false> = React.HTMLAttributes<HTMLDivElement> & useInlineEditOptions<boolean, Required>;
7
+ declare function InlineToggle<Required extends boolean = false>({
8
8
  initialValue,
9
9
  action,
10
10
  children,
11
11
  permission,
12
+ updateStrategy,
13
+ isRequired,
12
14
  className,
13
15
  ...props
14
- }: InlineEditToggleProps): react_jsx_runtime27.JSX.Element;
16
+ }: InlineEditToggleProps<Required>): react_jsx_runtime19.JSX.Element;
15
17
  //#endregion
16
18
  export { InlineEditToggleProps, InlineToggle };
17
19
  //# sourceMappingURL=toggle.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":[],"mappings":";;;;;KAOY,qBAAA,GAAwB,KAAA,CAAM,eAAe,kBACvD;iBAEc,YAAA;;;;;;;GAOb,wBAAqB,mBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"toggle.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":[],"mappings":";;;;;KAOY,0DACV,KAAA,CAAM,eAAe,kBAAkB,8BAA8B;iBAEvD;;;;;;;;;GASb,sBAAsB,YAAS,mBAAA,CAAA,GAAA,CAAA"}
@@ -6,11 +6,13 @@ import { useInlineEdit } from "../hooks/use-inline.client.mjs";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
 
8
8
  //#region src/modules/inline-edit/components/toggle.client.tsx
9
- function InlineToggle({ initialValue, action, children, permission, className, ...props }) {
10
- const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({
9
+ function InlineToggle({ initialValue, action, children, permission, updateStrategy, isRequired, className, ...props }) {
10
+ const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({
11
11
  initialValue,
12
12
  action,
13
- permission
13
+ permission,
14
+ updateStrategy,
15
+ isRequired
14
16
  });
15
17
  return /* @__PURE__ */ jsx("div", {
16
18
  ...props,
@@ -18,11 +20,11 @@ function InlineToggle({ initialValue, action, children, permission, className, .
18
20
  children: /* @__PURE__ */ jsx(Toggle, {
19
21
  disabled: !isAllowed,
20
22
  variant: "outline",
21
- pressed: value,
22
- defaultChecked: initialValue,
23
+ pressed: value ?? void 0,
24
+ defaultChecked: initialValue ?? void 0,
23
25
  onPressedChange: (value$1) => {
24
- setValue(value$1);
25
- handleUpdate(value$1);
26
+ handleChange(value$1);
27
+ handleBlur(value$1);
26
28
  },
27
29
  children
28
30
  })
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.client.mjs","names":["value"],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toggle } from \"@/components/ui/toggle\";\nimport { cn } from \"@/lib/utils/cn\";\nimport type React from \"react\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport type InlineEditToggleProps = React.HTMLAttributes<HTMLDivElement> &\n useInlineEditOptions<boolean>;\n\nexport function InlineToggle({\n initialValue,\n action,\n children,\n permission,\n className,\n ...props\n}: InlineEditToggleProps) {\n const { value, setValue, handleUpdate, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n });\n\n return (\n <div {...props} className={cn(\"flex flex-wrap items-center justify-start gap-1\", className)}>\n <Toggle\n disabled={!isAllowed}\n variant=\"outline\"\n pressed={value}\n defaultChecked={initialValue}\n onPressedChange={(value) => {\n setValue(value);\n handleUpdate(value);\n }}\n >\n {children}\n </Toggle>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,aAAa,EAC3B,cACA,QACA,UACA,YACA,WACA,GAAG,SACqB;CACxB,MAAM,EAAE,OAAO,UAAU,cAAc,cAAc,cAAc;EACjE;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EAAI,GAAI;EAAO,WAAW,GAAG,mDAAmD,UAAU;YACzF,oBAAC;GACC,UAAU,CAAC;GACX,SAAQ;GACR,SAAS;GACT,gBAAgB;GAChB,kBAAkB,YAAU;AAC1B,aAASA,QAAM;AACf,iBAAaA,QAAM;;GAGpB;IACM;GACL"}
1
+ {"version":3,"file":"toggle.client.mjs","names":["value"],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toggle } from \"@/components/ui/toggle\";\nimport { cn } from \"@/lib/utils/cn\";\nimport type React from \"react\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport type InlineEditToggleProps<Required extends boolean = false> =\n React.HTMLAttributes<HTMLDivElement> & useInlineEditOptions<boolean, Required>;\n\nexport function InlineToggle<Required extends boolean = false>({\n initialValue,\n action,\n children,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineEditToggleProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <div {...props} className={cn(\"flex flex-wrap items-center justify-start gap-1\", className)}>\n <Toggle\n disabled={!isAllowed}\n variant=\"outline\"\n pressed={value ?? undefined}\n defaultChecked={initialValue ?? undefined}\n onPressedChange={(value) => {\n handleChange(value);\n handleBlur(value);\n }}\n >\n {children}\n </Toggle>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,aAA+C,EAC7D,cACA,QACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SAC+B;CAClC,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,oBAAC;EAAI,GAAI;EAAO,WAAW,GAAG,mDAAmD,UAAU;YACzF,oBAAC;GACC,UAAU,CAAC;GACX,SAAQ;GACR,SAAS,SAAS;GAClB,gBAAgB,gBAAgB;GAChC,kBAAkB,YAAU;AAC1B,iBAAaA,QAAM;AACnB,eAAWA,QAAM;;GAGlB;IACM;GACL"}
@@ -1,15 +1,47 @@
1
1
  import { Permission } from "../../auth/lib/permissions.mjs";
2
2
  import "../../../components.mjs";
3
+ import "../../../lib/client.mjs";
3
4
  import "react";
4
5
 
5
6
  //#region src/modules/inline-edit/hooks/use-inline.client.d.ts
6
- type useInlineEditOptions<TValue> = {
7
- initialValue?: TValue;
7
+ type UpdateStrategy = {
8
+ mode: "change";
9
+ delay?: number;
10
+ } | {
11
+ mode: "blur";
12
+ };
13
+ type MaybeValue<TValue, Required extends boolean> = Required extends true ? TValue : TValue | null;
14
+ /**
15
+ * Use the inline edit hook options.
16
+ */
17
+ type useInlineEditOptions<TValue, Required extends boolean = false> = {
18
+ /**
19
+ * Initial value
20
+ */
21
+ initialValue?: MaybeValue<TValue, Required>;
22
+ /**
23
+ * Action to execute on update
24
+ */
8
25
  action: (value: {
9
26
  id: string;
10
- value: TValue;
27
+ value: MaybeValue<TValue, Required>;
11
28
  }) => Promise<unknown>;
29
+ /**
30
+ * Permission required to edit
31
+ */
12
32
  permission?: Permission;
33
+ /**
34
+ * Update strategy
35
+ * - trigger: when to update the value (default: "blur")
36
+ * - delay: delay in milliseconds before updating the value (only for "change" trigger)
37
+ * @default { trigger: "blur" }
38
+ */
39
+ updateStrategy?: UpdateStrategy;
40
+ /**
41
+ * Is the value required
42
+ * @default false
43
+ */
44
+ isRequired?: Required;
13
45
  };
14
46
  //#endregion
15
47
  export { useInlineEditOptions };
@@ -1 +1 @@
1
- {"version":3,"file":"use-inline.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"sourcesContent":[],"mappings":";;;;;KAUY;iBACK;;IADL,EAAA,EAAA,MAAA;IACK,KAAA,EACsB,MADtB;EACsB,CAAA,EAAA,GAAa,OAAb,CAAA,OAAA,CAAA;EAAa,UAAA,CAAA,EACrC,UADqC;CACrC"}
1
+ {"version":3,"file":"use-inline.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"sourcesContent":[],"mappings":";;;;;;KAYK,cAAA;;;;EAAA,IAAA,EAAA,MAAA;AAAc,CAAA;KAad,UAA+C,CAAA,MAAA,EAAA,iBAAA,OAAA,CAAA,GAAA,QAAA,SAAA,IAAA,GAAwB,MAAxB,GAAiC,MAAjC,GAAA,IAAA;;;;AAKxC,KAAA,oBAAoB,CAAA,MAAA,EAAA,iBAAA,OAAA,GAAA,KAAA,CAAA,GAAA;EAIJ;;;EAIsB,YAAA,CAAA,EAJjC,UAIiC,CAJtB,MAIsB,EAJd,QAIc,CAAA;EAAQ;;;EAI3C,MAAA,EAAA,CAAA,KAAA,EAAA;IAOI,EAAA,EAAA,MAAA;IAKJ,KAAA,EAhBwB,UAgBxB,CAhBmC,MAgBnC,EAhB2C,QAgB3C,CAAA;EAAQ,CAAA,EAAA,GAhBmD,OAgBnD,CAAA,OAAA,CAAA;;;;eAZR;;;;;;;mBAOI;;;;;eAKJ"}