@tulip-systems/core 0.5.13 → 0.5.15

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 (229) hide show
  1. package/dist/auth/client.d.mts +5 -4
  2. package/dist/auth/client.mjs +6 -5
  3. package/dist/auth.mjs +2 -2
  4. package/dist/components/client.mjs +2 -2
  5. package/dist/components/common/icons.d.mts +52 -52
  6. package/dist/components/common/status.d.mts +3 -3
  7. package/dist/components/editor/components/content.client.d.mts +2 -2
  8. package/dist/components/editor/components/editor.client.d.mts +6 -6
  9. package/dist/components/editor/components/editor.client.d.mts.map +1 -1
  10. package/dist/components/editor/components/menu.client.d.mts +3 -3
  11. package/dist/components/header/back-button.client.d.mts +2 -2
  12. package/dist/components/header/bottom-bar.client.d.mts +3 -3
  13. package/dist/components/header/breadcrumbs.client.d.mts +7 -7
  14. package/dist/components/header/header.client.d.mts +2 -2
  15. package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
  16. package/dist/components/header/top-bar.client.d.mts +4 -4
  17. package/dist/components/layouts/admin-content.client.d.mts +2 -2
  18. package/dist/components/layouts/admin-error-pages.d.mts +4 -4
  19. package/dist/components/layouts/admin-layout.d.mts +2 -2
  20. package/dist/components/layouts/admin-layout.mjs +1 -1
  21. package/dist/components/layouts/admin-layout.mjs.map +1 -1
  22. package/dist/components/layouts/admin-loading.d.mts +2 -2
  23. package/dist/components/layouts/empty-page.d.mts +4 -4
  24. package/dist/components/layouts/error-page.d.mts +9 -9
  25. package/dist/components/layouts/error-sections.d.mts +5 -5
  26. package/dist/components/layouts/list-layout.d.mts +2 -2
  27. package/dist/components/layouts/providers.client.d.mts +2 -2
  28. package/dist/components/layouts/root-error-pages.d.mts +2 -2
  29. package/dist/components/layouts/root-layout.server.d.mts +4 -4
  30. package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
  31. package/dist/components/layouts/root-loading.d.mts +2 -2
  32. package/dist/components/layouts/tab-layout.d.mts +2 -2
  33. package/dist/components/lists/data-list.d.mts +5 -5
  34. package/dist/components/lists/data-stack.d.mts +8 -8
  35. package/dist/components/navigation/admin-sidebar-header.client.mjs +3 -2
  36. package/dist/components/navigation/admin-sidebar-header.client.mjs.map +1 -1
  37. package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
  38. package/dist/components/ui/accordion.d.mts +5 -5
  39. package/dist/components/ui/alert-dialog.d.mts +12 -12
  40. package/dist/components/ui/alert.d.mts +6 -6
  41. package/dist/components/ui/aspect-ratio.d.mts +2 -2
  42. package/dist/components/ui/avatar.client.d.mts +4 -4
  43. package/dist/components/ui/badge.d.mts +4 -4
  44. package/dist/components/ui/breadcrumb.d.mts +8 -8
  45. package/dist/components/ui/button.d.mts +4 -4
  46. package/dist/components/ui/calendar.d.mts +3 -3
  47. package/dist/components/ui/card.d.mts +7 -7
  48. package/dist/components/ui/carousel.d.mts +6 -6
  49. package/dist/components/ui/chart.client.d.mts +5 -5
  50. package/dist/components/ui/checkbox.d.mts +2 -2
  51. package/dist/components/ui/collapsible.client.d.mts +4 -4
  52. package/dist/components/ui/color-picker.client.d.mts +2 -2
  53. package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
  54. package/dist/components/ui/combobox.client.d.mts +2 -2
  55. package/dist/components/ui/command.d.mts +10 -10
  56. package/dist/components/ui/context-menu.d.mts +16 -16
  57. package/dist/components/ui/date-picker.client.d.mts +2 -2
  58. package/dist/components/ui/dialog.client.d.mts +11 -11
  59. package/dist/components/ui/drawer.client.d.mts +11 -11
  60. package/dist/components/ui/dropdown-menu.d.mts +16 -16
  61. package/dist/components/ui/form.client.d.mts +7 -7
  62. package/dist/components/ui/hover-card.client.d.mts +4 -4
  63. package/dist/components/ui/input-recipient.d.mts +2 -2
  64. package/dist/components/ui/input.d.mts +2 -2
  65. package/dist/components/ui/label.d.mts +2 -2
  66. package/dist/components/ui/navigation-menu.d.mts +11 -11
  67. package/dist/components/ui/pagination.d.mts +8 -8
  68. package/dist/components/ui/popover.d.mts +5 -5
  69. package/dist/components/ui/progress.client.d.mts +2 -2
  70. package/dist/components/ui/radio-group.d.mts +3 -3
  71. package/dist/components/ui/resizable.client.d.mts +4 -4
  72. package/dist/components/ui/scroll-area.d.mts +3 -3
  73. package/dist/components/ui/select.client.d.mts +11 -11
  74. package/dist/components/ui/separator.d.mts +2 -2
  75. package/dist/components/ui/sheet.client.d.mts +9 -9
  76. package/dist/components/ui/sidebar.client.d.mts +26 -26
  77. package/dist/components/ui/skeleton.d.mts +2 -2
  78. package/dist/components/ui/slider.d.mts +2 -2
  79. package/dist/components/ui/sonner.client.d.mts +2 -2
  80. package/dist/components/ui/sonner.client.mjs +1 -1
  81. package/dist/components/ui/switch.d.mts +2 -2
  82. package/dist/components/ui/tabs.d.mts +5 -5
  83. package/dist/components/ui/textarea.d.mts +2 -2
  84. package/dist/components/ui/time-input.client.d.mts +2 -2
  85. package/dist/components/ui/toggle-group.client.d.mts +3 -3
  86. package/dist/components/ui/toggle.d.mts +4 -4
  87. package/dist/components/ui/toggle.d.mts.map +1 -1
  88. package/dist/components/ui/tooltip.client.d.mts +5 -5
  89. package/dist/components.mjs +2 -2
  90. package/dist/lib/client.mjs +1 -1
  91. package/dist/lib/hooks/use-action.d.mts +2 -2
  92. package/dist/lib/hooks/use-indicator.d.mts +2 -2
  93. package/dist/modules/auth/components/allowed.client.d.mts +2 -2
  94. package/dist/modules/auth/components/allowed.client.mjs +2 -3
  95. package/dist/modules/auth/components/allowed.client.mjs.map +1 -1
  96. package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
  97. package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
  98. package/dist/modules/auth/components/auth-loading.d.mts +2 -2
  99. package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
  100. package/dist/modules/auth/components/create-first-user-page.client.mjs +4 -3
  101. package/dist/modules/auth/components/create-first-user-page.client.mjs.map +1 -1
  102. package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
  103. package/dist/modules/auth/components/forget-password-page.client.mjs +4 -3
  104. package/dist/modules/auth/components/forget-password-page.client.mjs.map +1 -1
  105. package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
  106. package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
  107. package/dist/modules/auth/components/guard.server.d.mts +3 -2
  108. package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
  109. package/dist/modules/auth/components/guard.server.mjs +1 -0
  110. package/dist/modules/auth/components/guard.server.mjs.map +1 -1
  111. package/dist/modules/auth/components/login-page.client.d.mts +2 -2
  112. package/dist/modules/auth/components/login-page.client.mjs +4 -3
  113. package/dist/modules/auth/components/login-page.client.mjs.map +1 -1
  114. package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
  115. package/dist/modules/auth/components/reset-password-page.client.mjs +4 -3
  116. package/dist/modules/auth/components/reset-password-page.client.mjs.map +1 -1
  117. package/dist/modules/auth/components/update-password-command.d.mts +2 -2
  118. package/dist/modules/auth/components/update-password-command.mjs +1 -1
  119. package/dist/modules/auth/handler/{client.client.d.mts → create-client.client.d.mts} +288 -168
  120. package/dist/modules/auth/handler/create-client.client.d.mts.map +1 -0
  121. package/dist/modules/auth/handler/create-client.client.mjs +26 -0
  122. package/dist/modules/auth/handler/create-client.client.mjs.map +1 -0
  123. package/dist/modules/auth/handler/init.d.mts +133 -133
  124. package/dist/modules/auth/handler/init.d.mts.map +1 -1
  125. package/dist/modules/auth/hooks/use-auth-client.d.mts +24 -0
  126. package/dist/modules/auth/hooks/use-auth-client.d.mts.map +1 -0
  127. package/dist/modules/auth/hooks/use-auth-client.mjs +31 -0
  128. package/dist/modules/auth/hooks/use-auth-client.mjs.map +1 -0
  129. package/dist/modules/auth/hooks/use-permission.d.mts +8 -35
  130. package/dist/modules/auth/hooks/use-permission.d.mts.map +1 -1
  131. package/dist/modules/auth/hooks/use-permission.mjs +47 -93
  132. package/dist/modules/auth/hooks/use-permission.mjs.map +1 -1
  133. package/dist/modules/auth/hooks/use-session.d.mts +5 -119
  134. package/dist/modules/auth/hooks/use-session.d.mts.map +1 -1
  135. package/dist/modules/auth/hooks/use-session.mjs +15 -17
  136. package/dist/modules/auth/hooks/use-session.mjs.map +1 -1
  137. package/dist/modules/auth/lib/helpers.server.mjs +1 -1
  138. package/dist/modules/auth/lib/validators.d.mts +2 -2
  139. package/dist/modules/auth/lib/validators.d.mts.map +1 -1
  140. package/dist/modules/commands/components/alert-dialog-command.client.d.mts +11 -11
  141. package/dist/modules/commands/components/click-command.client.d.mts +2 -2
  142. package/dist/modules/commands/components/command-trigger.client.d.mts +4 -4
  143. package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
  144. package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
  145. package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
  146. package/dist/modules/commands/components/form-dialog-command.client.d.mts +12 -12
  147. package/dist/modules/commands/hooks/use-command-menu.client.mjs.map +1 -1
  148. package/dist/modules/commands/hooks/use-command-mutation.client.mjs +1 -1
  149. package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
  150. package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
  151. package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
  152. package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
  153. package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
  154. package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
  155. package/dist/modules/config/db/helpers.d.mts +5 -5
  156. package/dist/modules/config/db/helpers.d.mts.map +1 -1
  157. package/dist/modules/config/lib/config.d.mts +1 -1
  158. package/dist/modules/config/lib/config.mjs.map +1 -1
  159. package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
  160. package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
  161. package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
  162. package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
  163. package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
  164. package/dist/modules/data-tables/strategies/helpers/sorting.mjs +1 -1
  165. package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
  166. package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
  167. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
  168. package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.d.mts +2 -2
  169. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
  170. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
  171. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +2 -2
  172. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts.map +1 -1
  173. package/dist/modules/inline-edit/components/combobox.client.d.mts +2 -2
  174. package/dist/modules/inline-edit/components/combobox.client.d.mts.map +1 -1
  175. package/dist/modules/inline-edit/components/date-input.client.d.mts +2 -2
  176. package/dist/modules/inline-edit/components/date-input.client.d.mts.map +1 -1
  177. package/dist/modules/inline-edit/components/date-picker.client.d.mts +2 -2
  178. package/dist/modules/inline-edit/components/date-picker.client.d.mts.map +1 -1
  179. package/dist/modules/inline-edit/components/editor.client.d.mts +2 -2
  180. package/dist/modules/inline-edit/components/input-recipient.client.d.mts +2 -2
  181. package/dist/modules/inline-edit/components/input-toggle.client.d.mts +2 -2
  182. package/dist/modules/inline-edit/components/input.client.d.mts +4 -4
  183. package/dist/modules/inline-edit/components/select.client.d.mts +6 -6
  184. package/dist/modules/inline-edit/components/switch.client.d.mts +2 -2
  185. package/dist/modules/inline-edit/components/toggle.client.d.mts +2 -2
  186. package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
  187. package/dist/modules/inline-edit/hooks/context.client.d.mts.map +1 -1
  188. package/dist/modules/inline-edit/hooks/use-inline.client.mjs +2 -6
  189. package/dist/modules/inline-edit/hooks/use-inline.client.mjs.map +1 -1
  190. package/dist/modules/storage/components/dropzone.client.d.mts +4 -4
  191. package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
  192. package/dist/modules/storage/components/image-grid.client.mjs +1 -1
  193. package/dist/modules/storage/components/upload-zone.client.d.mts +2 -2
  194. package/dist/modules/storage/components/upload-zone.client.mjs +1 -2
  195. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  196. package/dist/modules/storage/lib/create-upload.client.d.mts.map +1 -1
  197. package/dist/modules/storage/lib/proxy.server.mjs +1 -1
  198. package/dist/modules/storage/lib/router.server.d.mts +2354 -2324
  199. package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
  200. package/dist/modules/storage/lib/router.server.mjs +2 -3
  201. package/dist/modules/storage/lib/router.server.mjs.map +1 -1
  202. package/dist/modules/storage/lib/service.server.d.mts +18 -18
  203. package/dist/modules/storage/lib/validators.d.mts +90 -90
  204. package/dist/modules/storage/lib/validators.d.mts.map +1 -1
  205. package/package.json +1 -1
  206. package/src/components/layouts/admin-layout.tsx +1 -3
  207. package/src/components/navigation/admin-sidebar-header.client.tsx +3 -20
  208. package/src/modules/auth/components/allowed.client.tsx +2 -2
  209. package/src/modules/auth/components/create-first-user-page.client.tsx +3 -2
  210. package/src/modules/auth/components/forget-password-page.client.tsx +2 -1
  211. package/src/modules/auth/components/guard.server.tsx +2 -0
  212. package/src/modules/auth/components/login-page.client.tsx +2 -1
  213. package/src/modules/auth/components/reset-password-page.client.tsx +3 -1
  214. package/src/modules/auth/entry.client.ts +13 -1
  215. package/src/modules/auth/entry.ts +11 -0
  216. package/src/modules/auth/handler/create-client.client.ts +53 -0
  217. package/src/modules/auth/hooks/use-auth-client.tsx +38 -0
  218. package/src/modules/auth/hooks/use-permission.ts +49 -94
  219. package/src/modules/auth/hooks/use-session.ts +16 -16
  220. package/src/modules/commands/hooks/use-command-menu.client.tsx +0 -6
  221. package/src/modules/config/lib/config.ts +3 -2
  222. package/src/modules/inline-edit/hooks/use-inline.client.tsx +1 -1
  223. package/src/modules/storage/components/upload-zone.client.tsx +0 -2
  224. package/src/modules/storage/lib/router.server.ts +5 -4
  225. package/dist/modules/auth/handler/client.client.d.mts.map +0 -1
  226. package/dist/modules/auth/handler/client.client.mjs +0 -21
  227. package/dist/modules/auth/handler/client.client.mjs.map +0 -1
  228. package/src/modules/auth/components/guard.client.tsx +0 -12
  229. package/src/modules/auth/handler/client.client.ts +0 -16
@@ -1,6 +1,6 @@
1
1
  import { TableColumnDef } from "../../../../lib/types.mjs";
2
2
  import "../../../../../../data-tables.mjs";
3
- import * as react_jsx_runtime32 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime91 from "react/jsx-runtime";
4
4
  import { CellContext } from "@tanstack/react-table";
5
5
 
6
6
  //#region src/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.ts
@@ -15,7 +15,7 @@ declare function TableDragHandle<TData, TValue>({
15
15
  row,
16
16
  className,
17
17
  disabled
18
- }: TableDragHandleProps<TData, TValue>): react_jsx_runtime32.JSX.Element;
18
+ }: TableDragHandleProps<TData, TValue>): react_jsx_runtime91.JSX.Element;
19
19
  /**
20
20
  * Create a new column with the drag handle
21
21
  */
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime34 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime94 from "react/jsx-runtime";
2
2
  import React from "react";
3
3
 
4
4
  //#region src/modules/data-tables/tables/inline-table/components/cells/read-only.d.ts
@@ -6,7 +6,7 @@ declare function InlineDataTableReadOnly({
6
6
  className,
7
7
  children,
8
8
  ...props
9
- }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime34.JSX.Element;
9
+ }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime94.JSX.Element;
10
10
  //#endregion
11
11
  export { InlineDataTableReadOnly };
12
12
  //# sourceMappingURL=read-only.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { Table } from "../../../components/table.mjs";
2
2
  import { InlineTableProvider } from "../hooks/context.client.mjs";
3
- import * as react_jsx_runtime35 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime95 from "react/jsx-runtime";
4
4
  import { ComponentProps } from "react";
5
5
 
6
6
  //#region src/modules/data-tables/tables/inline-table/components/table.d.ts
@@ -10,7 +10,7 @@ declare function InlineTable<TData extends {
10
10
  disabledColumns,
11
11
  moveRowAction,
12
12
  ...props
13
- }: ComponentProps<typeof Table> & ComponentProps<typeof InlineTableProvider>): react_jsx_runtime35.JSX.Element;
13
+ }: ComponentProps<typeof Table> & ComponentProps<typeof InlineTableProvider>): react_jsx_runtime95.JSX.Element;
14
14
  //#endregion
15
15
  export { InlineTable };
16
16
  //# sourceMappingURL=table.d.mts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime36 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime96 from "react/jsx-runtime";
2
2
  import { PropsWithChildren } from "react";
3
3
  import { VisibilityState } from "@tanstack/react-table";
4
4
 
@@ -41,7 +41,7 @@ declare function InlineTableProvider<TData extends {
41
41
  fromIndex: number;
42
42
  toIndex: number;
43
43
  }) => Promise<unknown>;
44
- }>): react_jsx_runtime36.JSX.Element;
44
+ }>): react_jsx_runtime96.JSX.Element;
45
45
  //#endregion
46
46
  export { InlineTableContextValue, InlineTableProvider, useInlineTableContext };
47
47
  //# sourceMappingURL=context.client.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { ComboboxDropdownItem, ComboboxDropdownProps } from "../../../components/ui/combobox-dropdown.client.mjs";
2
2
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
3
3
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
4
- import * as react_jsx_runtime6 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime67 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/modules/inline-edit/components/combobox-dropdown.client.d.ts
7
7
  type InlineEditComboboxDropdownProps<TValue extends ComboboxDropdownItem, Required extends boolean = false> = useInlineEditOptions<string, Required> & InlineEditVariantsProps & Omit<ComboboxDropdownProps<TValue>, "onSelect"> & {
@@ -19,7 +19,7 @@ declare function InlineComboboxDropdown<TValue extends ComboboxDropdownItem, Req
19
19
  isRequired,
20
20
  disabled,
21
21
  ...props
22
- }: InlineEditComboboxDropdownProps<TValue, Required>): react_jsx_runtime6.JSX.Element;
22
+ }: InlineEditComboboxDropdownProps<TValue, Required>): react_jsx_runtime67.JSX.Element;
23
23
  //#endregion
24
24
  export { InlineComboboxDropdown, InlineEditComboboxDropdownProps };
25
25
  //# sourceMappingURL=combobox-dropdown.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-dropdown.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/combobox-dropdown.client.tsx"],"sourcesContent":[],"mappings":";;;;;;KAWY,+CACK,0DAEb,6BAA6B,YAC/B,0BACA,KAAK,sBAAsB;aACd,sBAAsB;;AANzB,iBASI,sBAT2B,CAAA,eAU1B,oBAV0B,EAAA,iBAAA,OAAA,CAAA,CAAA;EAAA,YAAA;EAAA,OAAA;EAAA,SAAA;EAAA,QAAA;EAAA,YAAA;EAAA,MAAA;EAAA,UAAA;EAAA,cAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAwBxC,+BAxBwC,CAwBR,MAxBQ,EAwBA,QAxBA,CAAA,CAAA,EAwBS,kBAAA,CAAA,GAAA,CAAA,OAxBT"}
1
+ {"version":3,"file":"combobox-dropdown.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/combobox-dropdown.client.tsx"],"sourcesContent":[],"mappings":";;;;;;KAWY,+CACK,0DAEb,6BAA6B,YAC/B,0BACA,KAAK,sBAAsB;aACd,sBAAsB;;AANzB,iBASI,sBAT2B,CAAA,eAU1B,oBAV0B,EAAA,iBAAA,OAAA,CAAA,CAAA;EAAA,YAAA;EAAA,OAAA;EAAA,SAAA;EAAA,QAAA;EAAA,YAAA;EAAA,MAAA;EAAA,UAAA;EAAA,cAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAwBxC,+BAxBwC,CAwBR,MAxBQ,EAwBA,QAxBA,CAAA,CAAA,EAwBS,mBAAA,CAAA,GAAA,CAAA,OAxBT"}
@@ -1,6 +1,6 @@
1
1
  import { ComboboxProps } from "../../../components/ui/combobox.client.mjs";
2
2
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
3
- import * as react_jsx_runtime7 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime68 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/modules/inline-edit/components/combobox.client.d.ts
6
6
  type InlineComboboxProps<TValue, Required extends boolean = false> = useInlineEditOptions<string, Required> & Omit<ComboboxProps<TValue>, "value">;
@@ -14,7 +14,7 @@ declare function InlineCombobox<TValue, Required extends boolean>({
14
14
  updateStrategy,
15
15
  isRequired,
16
16
  ...props
17
- }: InlineComboboxProps<TValue, Required>): react_jsx_runtime7.JSX.Element;
17
+ }: InlineComboboxProps<TValue, Required>): react_jsx_runtime68.JSX.Element;
18
18
  //#endregion
19
19
  export { InlineCombobox, InlineComboboxProps };
20
20
  //# sourceMappingURL=combobox.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/combobox.client.tsx"],"sourcesContent":[],"mappings":";;;;;KAKY,gEAAgE,6BAE1E,YAEA,KAAK,cAAc;iBAEL;;;;;;;;;;GAUb,oBAAoB,QAAQ,YAAS,kBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"combobox.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/combobox.client.tsx"],"sourcesContent":[],"mappings":";;;;;KAKY,gEAAgE,6BAE1E,YAEA,KAAK,cAAc;iBAEL;;;;;;;;;;GAUb,oBAAoB,QAAQ,YAAS,mBAAA,CAAA,GAAA,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
2
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
3
- import * as react_jsx_runtime8 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime69 from "react/jsx-runtime";
4
4
  import { ComponentProps } from "react";
5
5
 
6
6
  //#region src/modules/inline-edit/components/date-input.client.d.ts
@@ -13,7 +13,7 @@ declare function InlineDateInput<Required extends boolean = false>({
13
13
  updateStrategy,
14
14
  isRequired,
15
15
  ...props
16
- }: ComponentProps<"div"> & useInlineEditOptions<Date, Required> & InlineEditVariantsProps): react_jsx_runtime8.JSX.Element;
16
+ }: ComponentProps<"div"> & useInlineEditOptions<Date, Required> & InlineEditVariantsProps): react_jsx_runtime69.JSX.Element;
17
17
  //#endregion
18
18
  export { InlineDateInput };
19
19
  //# sourceMappingURL=date-input.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-input.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/date-input.client.tsx"],"sourcesContent":[],"mappings":";;;;;;iBAiBgB;;;;;;;;;GASb,wBAAwB,qBAAqB,MAAM,YAAY,0BAAuB,kBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"date-input.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/date-input.client.tsx"],"sourcesContent":[],"mappings":";;;;;;iBAiBgB;;;;;;;;;GASb,wBAAwB,qBAAqB,MAAM,YAAY,0BAAuB,mBAAA,CAAA,GAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { Button } from "../../../components/ui/button.mjs";
2
2
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
3
3
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
4
- import * as react_jsx_runtime9 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime70 from "react/jsx-runtime";
5
5
  import { ComponentProps } from "react";
6
6
 
7
7
  //#region src/modules/inline-edit/components/date-picker.client.d.ts
@@ -16,7 +16,7 @@ declare function InlineDatePicker<Required extends boolean = false>({
16
16
  updateStrategy,
17
17
  isRequired,
18
18
  ...props
19
- }: InlineEditDatePickerProps<Required>): react_jsx_runtime9.JSX.Element;
19
+ }: InlineEditDatePickerProps<Required>): react_jsx_runtime70.JSX.Element;
20
20
  //#endregion
21
21
  export { InlineDatePicker };
22
22
  //# sourceMappingURL=date-picker.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/date-picker.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;KAYK,sDAAsD,sBAAsB,UAC/E,qBAAqB,MAAM,YAC3B;iBAEc;;;;;;;;;;GAUb,0BAA0B,YAAS,kBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"date-picker.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/date-picker.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;KAYK,sDAAsD,sBAAsB,UAC/E,qBAAqB,MAAM,YAC3B;iBAEc;;;;;;;;;;GAUb,0BAA0B,YAAS,mBAAA,CAAA,GAAA,CAAA"}
@@ -2,7 +2,7 @@ import { EditorJSONContent } from "../../../components/editor/lib/types.mjs";
2
2
  import { EditorProps } from "../../../components/editor/components/editor.client.mjs";
3
3
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
4
4
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
5
- import * as react_jsx_runtime10 from "react/jsx-runtime";
5
+ import * as react_jsx_runtime71 from "react/jsx-runtime";
6
6
 
7
7
  //#region src/modules/inline-edit/components/editor.client.d.ts
8
8
  type InlineEditorProps<Required extends boolean = false> = useInlineEditOptions<EditorJSONContent, Required> & InlineEditVariantsProps & Omit<EditorProps, "value" | "onUpdate" | "onBlur" | "variant">;
@@ -17,7 +17,7 @@ declare function InlineEditor<Required extends boolean = false>({
17
17
  isRequired,
18
18
  className,
19
19
  children
20
- }: InlineEditorProps<Required>): react_jsx_runtime10.JSX.Element;
20
+ }: InlineEditorProps<Required>): react_jsx_runtime71.JSX.Element;
21
21
  //#endregion
22
22
  export { InlineEditor, InlineEditorProps };
23
23
  //# sourceMappingURL=editor.client.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
2
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
3
3
  import { Contact, RecipientInput } from "../../../components/ui/input-recipient.mjs";
4
- import * as react_jsx_runtime11 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime72 from "react/jsx-runtime";
5
5
  import { ComponentProps } from "react";
6
6
 
7
7
  //#region src/modules/inline-edit/components/input-recipient.client.d.ts
@@ -22,7 +22,7 @@ declare function InlineRecipientInput<Required extends boolean = false>({
22
22
  isRequired,
23
23
  className,
24
24
  ...props
25
- }: InlineRecipientInputProps<Required>): react_jsx_runtime11.JSX.Element;
25
+ }: InlineRecipientInputProps<Required>): react_jsx_runtime72.JSX.Element;
26
26
  //#endregion
27
27
  export { InlineRecipientInput };
28
28
  //# sourceMappingURL=input-recipient.client.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { Input } from "../../../components/ui/input.mjs";
2
2
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
3
- import * as react_jsx_runtime12 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime73 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
@@ -14,7 +14,7 @@ declare function InlineStringInputToggle<Required extends boolean>({
14
14
  isRequired,
15
15
  className,
16
16
  ...props
17
- }: InlineStringInputToggleProps<Required>): react_jsx_runtime12.JSX.Element;
17
+ }: InlineStringInputToggleProps<Required>): react_jsx_runtime73.JSX.Element;
18
18
  //#endregion
19
19
  export { InlineStringInputToggle };
20
20
  //# sourceMappingURL=input-toggle.client.d.mts.map
@@ -1,7 +1,7 @@
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_runtime13 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime74 from "react/jsx-runtime";
5
5
  import { ComponentProps } from "react";
6
6
 
7
7
  //#region src/modules/inline-edit/components/input.client.d.ts
@@ -19,7 +19,7 @@ declare function InlineStringInput<Required extends boolean = false>({
19
19
  isRequired,
20
20
  disabled,
21
21
  ...props
22
- }: InlineEditInputProps<string, Required>): react_jsx_runtime13.JSX.Element;
22
+ }: InlineEditInputProps<string, Required>): react_jsx_runtime74.JSX.Element;
23
23
  declare function InlineNumberInput<Required extends boolean = false>({
24
24
  initialValue,
25
25
  action,
@@ -30,7 +30,7 @@ declare function InlineNumberInput<Required extends boolean = false>({
30
30
  isRequired,
31
31
  disabled,
32
32
  ...props
33
- }: InlineEditInputProps<number, Required>): react_jsx_runtime13.JSX.Element;
33
+ }: InlineEditInputProps<number, Required>): react_jsx_runtime74.JSX.Element;
34
34
  /**
35
35
  * The inline edit decimal input component.
36
36
  */
@@ -44,7 +44,7 @@ declare function InlineDecimalInput({
44
44
  isRequired,
45
45
  disabled,
46
46
  ...props
47
- }: InlineEditInputProps<string>): react_jsx_runtime13.JSX.Element;
47
+ }: InlineEditInputProps<string>): react_jsx_runtime74.JSX.Element;
48
48
  //#endregion
49
49
  export { InlineDecimalInput, InlineNumberInput, InlineStringInput };
50
50
  //# sourceMappingURL=input.client.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
2
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
3
- import * as react_jsx_runtime16 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime77 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
@@ -12,19 +12,19 @@ declare function InlineSelect<Required extends boolean = false>({
12
12
  isRequired,
13
13
  disabled,
14
14
  ...props
15
- }: SelectProps & useInlineEditOptions<string, Required>): react_jsx_runtime16.JSX.Element;
15
+ }: SelectProps & useInlineEditOptions<string, Required>): react_jsx_runtime77.JSX.Element;
16
16
  type InlineSelectTriggerProps = SelectTriggerProps;
17
17
  declare function InlineSelectTrigger({
18
18
  variant,
19
19
  className,
20
20
  ...props
21
- }: InlineSelectTriggerProps & InlineEditVariantsProps): react_jsx_runtime16.JSX.Element;
21
+ }: InlineSelectTriggerProps & InlineEditVariantsProps): react_jsx_runtime77.JSX.Element;
22
22
  type InlineSelectContentProps = SelectContentProps;
23
- declare function InlineSelectContent(props: InlineSelectContentProps): react_jsx_runtime16.JSX.Element;
23
+ declare function InlineSelectContent(props: InlineSelectContentProps): react_jsx_runtime77.JSX.Element;
24
24
  type InlineSelectValueProps = SelectValueProps;
25
- declare function InlineSelectValue(props: InlineSelectValueProps): react_jsx_runtime16.JSX.Element;
25
+ declare function InlineSelectValue(props: InlineSelectValueProps): react_jsx_runtime77.JSX.Element;
26
26
  type InlineSelectItenProps = SelectItemProps;
27
- declare function InlineSelectItem(props: InlineSelectItenProps): react_jsx_runtime16.JSX.Element;
27
+ declare function InlineSelectItem(props: InlineSelectItenProps): react_jsx_runtime77.JSX.Element;
28
28
  //#endregion
29
29
  export { InlineSelect, InlineSelectContent, InlineSelectContentProps, InlineSelectItem, InlineSelectItenProps, InlineSelectTrigger, InlineSelectTriggerProps, InlineSelectValue, InlineSelectValueProps };
30
30
  //# sourceMappingURL=select.client.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
- import * as react_jsx_runtime21 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime82 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
@@ -11,7 +11,7 @@ declare function InlineSwitch<Required extends boolean = false>({
11
11
  isRequired,
12
12
  disabled,
13
13
  ...props
14
- }: SwitchProps & useInlineEditOptions<boolean, Required>): react_jsx_runtime21.JSX.Element;
14
+ }: SwitchProps & useInlineEditOptions<boolean, Required>): react_jsx_runtime82.JSX.Element;
15
15
  //#endregion
16
16
  export { InlineSwitch };
17
17
  //# sourceMappingURL=switch.client.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
- import * as react_jsx_runtime22 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime83 from "react/jsx-runtime";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/modules/inline-edit/components/toggle.client.d.ts
@@ -13,7 +13,7 @@ declare function InlineToggle<Required extends boolean = false>({
13
13
  isRequired,
14
14
  className,
15
15
  ...props
16
- }: InlineEditToggleProps<Required>): react_jsx_runtime22.JSX.Element;
16
+ }: InlineEditToggleProps<Required>): react_jsx_runtime83.JSX.Element;
17
17
  //#endregion
18
18
  export { InlineEditToggleProps, InlineToggle };
19
19
  //# sourceMappingURL=toggle.client.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { Permission } from "../../auth/lib/permissions.mjs";
2
- import * as react_jsx_runtime23 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/modules/inline-edit/hooks/context.client.d.ts
@@ -22,7 +22,7 @@ declare function InlineEditProvider({
22
22
  ...value
23
23
  }: InlineEditContextParams & {
24
24
  children: React.ReactNode;
25
- }): react_jsx_runtime23.JSX.Element;
25
+ }): react_jsx_runtime1.JSX.Element;
26
26
  //#endregion
27
27
  export { InlineEditContextParams, InlineEditProvider, useInlineEditContext };
28
28
  //# sourceMappingURL=context.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/context.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAQY,KAAA,uBAAA,GAAuB;EAMnB,EAAA,EAAA,MAAA;EASA,UAAA,CAAA,EAfiD,UAe/B;CAChC;;;;AAEwD,iBAZ1C,oBAAA,CAAA,CAY0C,EAZtB,uBAYsB;;;;iBAH1C,kBAAA;;;GAGb;YAAsC,KAAA,CAAM;IAAW,mBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"context.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/context.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAQY,KAAA,uBAAA,GAAuB;EAMnB,EAAA,EAAA,MAAA;EASA,UAAA,CAAA,EAfiD,UAe/B;CAChC;;;;AAEwD,iBAZ1C,oBAAA,CAAA,CAY0C,EAZtB,uBAYsB;;;;iBAH1C,kBAAA;;;GAGb;YAAsC,KAAA,CAAM;IAAW,kBAAA,CAAA,GAAA,CAAA"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
3
  import { useLocalIndicator } from "../../../lib/hooks/use-indicator.mjs";
4
- import { useAction } from "../../../lib/hooks/use-action.mjs";
5
4
  import { usePermission } from "../../auth/hooks/use-permission.mjs";
5
+ import { useAction } from "../../../lib/hooks/use-action.mjs";
6
6
  import { useInlineEditContext } from "./context.client.mjs";
7
7
  import { useCallback, useState } from "react";
8
8
  import { toast } from "sonner";
@@ -31,11 +31,7 @@ function useInlineEdit(props) {
31
31
  * The indicator status.
32
32
  */
33
33
  const { status, setStatus } = useLocalIndicator();
34
- /**
35
- * Permission guard
36
- */
37
- const { data } = usePermission(props.permission ?? context.permission ?? {});
38
- const isAllowed = data?.success;
34
+ const isAllowed = usePermission(props.permission ?? context.permission ?? {})?.success;
39
35
  /**
40
36
  * Execute the action to update the value.
41
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"use-inline.client.mjs","names":["defaultUpdateStrategy: UpdateStrategy","value"],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { EditorJSONContent } from \"@/components/entry\";\nimport { useLocalIndicator } from \"@/lib/entry.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { usePermission } from \"@/modules/auth/hooks/use-permission\";\nimport { Permission } from \"@/modules/auth/lib/permissions\";\nimport { useCallback, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport { useDebouncedCallback } from \"use-debounce\";\nimport { useInlineEditContext } from \"./context.client\";\n\ntype UpdateStrategy =\n | {\n mode: \"change\";\n delay?: number;\n }\n | {\n mode: \"blur\";\n };\n\nconst defaultUpdateStrategy: UpdateStrategy = {\n mode: \"blur\",\n};\n\ntype MaybeValue<TValue, Required extends boolean> = Required extends true ? TValue : TValue | null;\n\n/**\n * Use the inline edit hook options.\n */\nexport type useInlineEditOptions<TValue, Required extends boolean = false> = {\n /**\n * Initial value\n */\n initialValue?: MaybeValue<TValue, Required>;\n /**\n * Action to execute on update\n */\n action: (value: { id: string; value: MaybeValue<TValue, Required> }) => Promise<unknown>;\n /**\n * Permission required to edit\n */\n permission?: Permission;\n /**\n * Update strategy\n * - trigger: when to update the value (default: \"blur\")\n * - delay: delay in milliseconds before updating the value (only for \"change\" trigger)\n * @default { trigger: \"blur\" }\n */\n updateStrategy?: UpdateStrategy;\n /**\n * Is the value required\n * @default false\n */\n isRequired?: Required;\n};\n\n/**\n * Use the inline edit hook.\n */\nexport function useInlineEdit<\n TValue extends string | number | Date | boolean | JSON | EditorJSONContent,\n Required extends boolean = false,\n>(props: useInlineEditOptions<TValue, Required>) {\n /**\n * The update strategy.\n */\n const strategy = props.updateStrategy ?? defaultUpdateStrategy;\n const delay = strategy.mode === \"change\" ? (strategy.delay ?? 0) : 0;\n\n /**\n * The inline edit context.\n */\n const context = useInlineEditContext();\n\n /**\n * The current value of the inline edit.\n */\n const [value, setValue] = useState<MaybeValue<TValue, Required> | undefined>(props.initialValue);\n\n /**\n * The indicator status.\n */\n const { status, setStatus } = useLocalIndicator();\n\n /**\n * Permission guard\n */\n const { data } = usePermission(props.permission ?? context.permission ?? {});\n const isAllowed = data?.success;\n\n /**\n * Execute the action to update the value.\n */\n const mutation = useAction({\n mutationFn: props.action,\n onMutate: () => {\n setStatus(\"pending\");\n },\n onSuccess: () => {\n setStatus(\"success\");\n },\n onError: (error) => {\n setValue(props.initialValue);\n toast.error(\"Er is iets misgegaan\", {\n description: error instanceof Error ? error.message : undefined,\n });\n },\n });\n\n /**\n * Handle instant mutate\n */\n const handleMutateInstant = useCallback(\n (value: MaybeValue<TValue, Required>) => {\n // Permission guard\n if (!isAllowed) {\n toast.error(\"Je hebt geen toestemming om dit te bewerken\");\n return;\n }\n\n // If the value is the same as the initial value, do nothing\n if (value === props.initialValue) return;\n\n // Update the value\n return mutation.mutate({ id: context.id, value });\n },\n [isAllowed, props.initialValue, mutation, context.id],\n );\n\n /**\n * Handle mutate with debounce\n */\n const handleMutateDebounced = useDebouncedCallback(handleMutateInstant, delay);\n\n /**\n * Handle change updates\n */\n function handleChange(next: MaybeValue<TValue, Required> | null) {\n // Set value in state\n setValue(next ?? undefined);\n\n // If the strategy is not change, exit\n if (strategy.mode !== \"change\") return;\n\n // If it is required and the value is null or empty, reset to initial value\n if (props.isRequired && next === null) {\n setValue(props.initialValue ?? undefined);\n setStatus(\"error\");\n toast.error(\"Dit veld is verplicht\");\n return;\n }\n\n // If the strategy is change, update the value after the delay\n handleMutateDebounced(next as MaybeValue<TValue, Required>);\n }\n\n /**\n * Handle blur updates\n */\n function handleBlur(next: MaybeValue<TValue, Required> | null) {\n // Set value in state\n setValue(next ?? undefined);\n\n // If the strategy is not blur, exit\n if (strategy.mode !== \"blur\") return;\n\n // If it is required and the value is null or empty, reset to initial value\n if (props.isRequired && next === null) {\n setValue(props.initialValue ?? undefined);\n setStatus(\"error\");\n toast.error(\"Dit veld is verplicht\");\n return;\n }\n\n // If the strategy is blur, update the value\n handleMutateInstant(next as MaybeValue<TValue, Required>);\n }\n\n return { value, setValue, handleChange, handleBlur, status, isAllowed };\n}\n"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,wBAAwC,EAC5C,MAAM,QACP;;;;AAqCD,SAAgB,cAGd,OAA+C;;;;CAI/C,MAAM,WAAW,MAAM,kBAAkB;CACzC,MAAM,QAAQ,SAAS,SAAS,WAAY,SAAS,SAAS,IAAK;;;;CAKnE,MAAM,UAAU,sBAAsB;;;;CAKtC,MAAM,CAAC,OAAO,YAAY,SAAmD,MAAM,aAAa;;;;CAKhG,MAAM,EAAE,QAAQ,cAAc,mBAAmB;;;;CAKjD,MAAM,EAAE,SAAS,cAAc,MAAM,cAAc,QAAQ,cAAc,EAAE,CAAC;CAC5E,MAAM,YAAY,MAAM;;;;CAKxB,MAAM,WAAW,UAAU;EACzB,YAAY,MAAM;EAClB,gBAAgB;AACd,aAAU,UAAU;;EAEtB,iBAAiB;AACf,aAAU,UAAU;;EAEtB,UAAU,UAAU;AAClB,YAAS,MAAM,aAAa;AAC5B,SAAM,MAAM,wBAAwB,EAClC,aAAa,iBAAiB,QAAQ,MAAM,UAAU,QACvD,CAAC;;EAEL,CAAC;;;;CAKF,MAAM,sBAAsB,aACzB,YAAwC;AAEvC,MAAI,CAAC,WAAW;AACd,SAAM,MAAM,8CAA8C;AAC1D;;AAIF,MAAIC,YAAU,MAAM,aAAc;AAGlC,SAAO,SAAS,OAAO;GAAE,IAAI,QAAQ;GAAI;GAAO,CAAC;IAEnD;EAAC;EAAW,MAAM;EAAc;EAAU,QAAQ;EAAG,CACtD;;;;CAKD,MAAM,wBAAwB,qBAAqB,qBAAqB,MAAM;;;;CAK9E,SAAS,aAAa,MAA2C;AAE/D,WAAS,QAAQ,OAAU;AAG3B,MAAI,SAAS,SAAS,SAAU;AAGhC,MAAI,MAAM,cAAc,SAAS,MAAM;AACrC,YAAS,MAAM,gBAAgB,OAAU;AACzC,aAAU,QAAQ;AAClB,SAAM,MAAM,wBAAwB;AACpC;;AAIF,wBAAsB,KAAqC;;;;;CAM7D,SAAS,WAAW,MAA2C;AAE7D,WAAS,QAAQ,OAAU;AAG3B,MAAI,SAAS,SAAS,OAAQ;AAG9B,MAAI,MAAM,cAAc,SAAS,MAAM;AACrC,YAAS,MAAM,gBAAgB,OAAU;AACzC,aAAU,QAAQ;AAClB,SAAM,MAAM,wBAAwB;AACpC;;AAIF,sBAAoB,KAAqC;;AAG3D,QAAO;EAAE;EAAO;EAAU;EAAc;EAAY;EAAQ;EAAW"}
1
+ {"version":3,"file":"use-inline.client.mjs","names":["defaultUpdateStrategy: UpdateStrategy","value"],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { EditorJSONContent } from \"@/components/entry\";\nimport { useLocalIndicator } from \"@/lib/entry.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { usePermission } from \"@/modules/auth/hooks/use-permission\";\nimport { Permission } from \"@/modules/auth/lib/permissions\";\nimport { useCallback, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport { useDebouncedCallback } from \"use-debounce\";\nimport { useInlineEditContext } from \"./context.client\";\n\ntype UpdateStrategy =\n | {\n mode: \"change\";\n delay?: number;\n }\n | {\n mode: \"blur\";\n };\n\nconst defaultUpdateStrategy: UpdateStrategy = {\n mode: \"blur\",\n};\n\ntype MaybeValue<TValue, Required extends boolean> = Required extends true ? TValue : TValue | null;\n\n/**\n * Use the inline edit hook options.\n */\nexport type useInlineEditOptions<TValue, Required extends boolean = false> = {\n /**\n * Initial value\n */\n initialValue?: MaybeValue<TValue, Required>;\n /**\n * Action to execute on update\n */\n action: (value: { id: string; value: MaybeValue<TValue, Required> }) => Promise<unknown>;\n /**\n * Permission required to edit\n */\n permission?: Permission;\n /**\n * Update strategy\n * - trigger: when to update the value (default: \"blur\")\n * - delay: delay in milliseconds before updating the value (only for \"change\" trigger)\n * @default { trigger: \"blur\" }\n */\n updateStrategy?: UpdateStrategy;\n /**\n * Is the value required\n * @default false\n */\n isRequired?: Required;\n};\n\n/**\n * Use the inline edit hook.\n */\nexport function useInlineEdit<\n TValue extends string | number | Date | boolean | JSON | EditorJSONContent,\n Required extends boolean = false,\n>(props: useInlineEditOptions<TValue, Required>) {\n /**\n * The update strategy.\n */\n const strategy = props.updateStrategy ?? defaultUpdateStrategy;\n const delay = strategy.mode === \"change\" ? (strategy.delay ?? 0) : 0;\n\n /**\n * The inline edit context.\n */\n const context = useInlineEditContext();\n\n /**\n * The current value of the inline edit.\n */\n const [value, setValue] = useState<MaybeValue<TValue, Required> | undefined>(props.initialValue);\n\n /**\n * The indicator status.\n */\n const { status, setStatus } = useLocalIndicator();\n\n /**\n * Permission guard\n */\n const data = usePermission(props.permission ?? context.permission ?? {});\n const isAllowed = data?.success;\n\n /**\n * Execute the action to update the value.\n */\n const mutation = useAction({\n mutationFn: props.action,\n onMutate: () => {\n setStatus(\"pending\");\n },\n onSuccess: () => {\n setStatus(\"success\");\n },\n onError: (error) => {\n setValue(props.initialValue);\n toast.error(\"Er is iets misgegaan\", {\n description: error instanceof Error ? error.message : undefined,\n });\n },\n });\n\n /**\n * Handle instant mutate\n */\n const handleMutateInstant = useCallback(\n (value: MaybeValue<TValue, Required>) => {\n // Permission guard\n if (!isAllowed) {\n toast.error(\"Je hebt geen toestemming om dit te bewerken\");\n return;\n }\n\n // If the value is the same as the initial value, do nothing\n if (value === props.initialValue) return;\n\n // Update the value\n return mutation.mutate({ id: context.id, value });\n },\n [isAllowed, props.initialValue, mutation, context.id],\n );\n\n /**\n * Handle mutate with debounce\n */\n const handleMutateDebounced = useDebouncedCallback(handleMutateInstant, delay);\n\n /**\n * Handle change updates\n */\n function handleChange(next: MaybeValue<TValue, Required> | null) {\n // Set value in state\n setValue(next ?? undefined);\n\n // If the strategy is not change, exit\n if (strategy.mode !== \"change\") return;\n\n // If it is required and the value is null or empty, reset to initial value\n if (props.isRequired && next === null) {\n setValue(props.initialValue ?? undefined);\n setStatus(\"error\");\n toast.error(\"Dit veld is verplicht\");\n return;\n }\n\n // If the strategy is change, update the value after the delay\n handleMutateDebounced(next as MaybeValue<TValue, Required>);\n }\n\n /**\n * Handle blur updates\n */\n function handleBlur(next: MaybeValue<TValue, Required> | null) {\n // Set value in state\n setValue(next ?? undefined);\n\n // If the strategy is not blur, exit\n if (strategy.mode !== \"blur\") return;\n\n // If it is required and the value is null or empty, reset to initial value\n if (props.isRequired && next === null) {\n setValue(props.initialValue ?? undefined);\n setStatus(\"error\");\n toast.error(\"Dit veld is verplicht\");\n return;\n }\n\n // If the strategy is blur, update the value\n handleMutateInstant(next as MaybeValue<TValue, Required>);\n }\n\n return { value, setValue, handleChange, handleBlur, status, isAllowed };\n}\n"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,wBAAwC,EAC5C,MAAM,QACP;;;;AAqCD,SAAgB,cAGd,OAA+C;;;;CAI/C,MAAM,WAAW,MAAM,kBAAkB;CACzC,MAAM,QAAQ,SAAS,SAAS,WAAY,SAAS,SAAS,IAAK;;;;CAKnE,MAAM,UAAU,sBAAsB;;;;CAKtC,MAAM,CAAC,OAAO,YAAY,SAAmD,MAAM,aAAa;;;;CAKhG,MAAM,EAAE,QAAQ,cAAc,mBAAmB;CAMjD,MAAM,YADO,cAAc,MAAM,cAAc,QAAQ,cAAc,EAAE,CAAC,EAChD;;;;CAKxB,MAAM,WAAW,UAAU;EACzB,YAAY,MAAM;EAClB,gBAAgB;AACd,aAAU,UAAU;;EAEtB,iBAAiB;AACf,aAAU,UAAU;;EAEtB,UAAU,UAAU;AAClB,YAAS,MAAM,aAAa;AAC5B,SAAM,MAAM,wBAAwB,EAClC,aAAa,iBAAiB,QAAQ,MAAM,UAAU,QACvD,CAAC;;EAEL,CAAC;;;;CAKF,MAAM,sBAAsB,aACzB,YAAwC;AAEvC,MAAI,CAAC,WAAW;AACd,SAAM,MAAM,8CAA8C;AAC1D;;AAIF,MAAIC,YAAU,MAAM,aAAc;AAGlC,SAAO,SAAS,OAAO;GAAE,IAAI,QAAQ;GAAI;GAAO,CAAC;IAEnD;EAAC;EAAW,MAAM;EAAc;EAAU,QAAQ;EAAG,CACtD;;;;CAKD,MAAM,wBAAwB,qBAAqB,qBAAqB,MAAM;;;;CAK9E,SAAS,aAAa,MAA2C;AAE/D,WAAS,QAAQ,OAAU;AAG3B,MAAI,SAAS,SAAS,SAAU;AAGhC,MAAI,MAAM,cAAc,SAAS,MAAM;AACrC,YAAS,MAAM,gBAAgB,OAAU;AACzC,aAAU,QAAQ;AAClB,SAAM,MAAM,wBAAwB;AACpC;;AAIF,wBAAsB,KAAqC;;;;;CAM7D,SAAS,WAAW,MAA2C;AAE7D,WAAS,QAAQ,OAAU;AAG3B,MAAI,SAAS,SAAS,OAAQ;AAG9B,MAAI,MAAM,cAAc,SAAS,MAAM;AACrC,YAAS,MAAM,gBAAgB,OAAU;AACzC,aAAU,QAAQ;AAClB,SAAM,MAAM,wBAAwB;AACpC;;AAIF,sBAAoB,KAAqC;;AAG3D,QAAO;EAAE;EAAO;EAAU;EAAc;EAAY;EAAQ;EAAW"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
2
2
  import * as react0 from "react";
3
3
  import { ReactNode } from "react";
4
4
  import { DropEvent, DropzoneOptions, FileRejection } from "react-dropzone";
@@ -25,7 +25,7 @@ declare function Dropzone({
25
25
  className,
26
26
  children,
27
27
  ...props
28
- }: DropzoneProps): react_jsx_runtime0.JSX.Element;
28
+ }: DropzoneProps): react_jsx_runtime2.JSX.Element;
29
29
  /**
30
30
  * DropzoneContent
31
31
  */
@@ -36,7 +36,7 @@ type DropzoneContentProps = {
36
36
  declare function DropzoneContent({
37
37
  children,
38
38
  className
39
- }: DropzoneContentProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null;
39
+ }: DropzoneContentProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime2.JSX.Element | null;
40
40
  /**
41
41
  * DropzoneEmptyState
42
42
  */
@@ -47,7 +47,7 @@ type DropzoneEmptyStateProps = {
47
47
  declare function DropzoneEmptyState({
48
48
  children,
49
49
  className
50
- }: DropzoneEmptyStateProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null;
50
+ }: DropzoneEmptyStateProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime2.JSX.Element | null;
51
51
  //#endregion
52
52
  export { Dropzone, DropzoneContent, DropzoneContentProps, DropzoneEmptyState, DropzoneEmptyStateProps, DropzoneProps };
53
53
  //# sourceMappingURL=dropzone.client.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { FileNode } from "../lib/validators.mjs";
2
- import * as react_jsx_runtime3 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
3
3
  import { ComponentProps } from "react";
4
4
 
5
5
  //#region src/modules/storage/components/image-grid.client.d.ts
@@ -26,8 +26,8 @@ declare function ImageGrid({
26
26
  optimistic,
27
27
  disabled,
28
28
  ...props
29
- }: ImageGridProps): react_jsx_runtime3.JSX.Element;
30
- declare function ImageGridSkeleton(props: ComponentProps<"div">): react_jsx_runtime3.JSX.Element;
29
+ }: ImageGridProps): react_jsx_runtime5.JSX.Element;
30
+ declare function ImageGridSkeleton(props: ComponentProps<"div">): react_jsx_runtime5.JSX.Element;
31
31
  //#endregion
32
32
  export { ImageGrid, ImageGridSkeleton };
33
33
  //# sourceMappingURL=image-grid.client.d.mts.map
@@ -7,9 +7,9 @@ import { getFileUrl, imageLoader } from "../lib/helpers.mjs";
7
7
  import { Skeleton } from "../../../components/ui/skeleton.mjs";
8
8
  import { Input } from "../../../components/ui/input.mjs";
9
9
  import { Dialog, DialogContent, DialogTrigger } from "../../../components/ui/dialog.client.mjs";
10
- import { useAction } from "../../../lib/hooks/use-action.mjs";
11
10
  import { Card } from "../../../components/ui/card.mjs";
12
11
  import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "../../../components/ui/carousel.mjs";
12
+ import { useAction } from "../../../lib/hooks/use-action.mjs";
13
13
  import { useUploadZone } from "./upload-zone-context.client.mjs";
14
14
  import { GripIcon, UploadIcon } from "lucide-react";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Node, UploadFileSchema } from "../lib/validators.mjs";
2
2
  import { UploadHooks } from "../lib/create-upload.client.mjs";
3
3
  import { UploadZoneContextValue } from "./upload-zone-context.client.mjs";
4
- import * as react_jsx_runtime5 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
5
5
  import { ComponentProps } from "react";
6
6
 
7
7
  //#region src/modules/storage/components/upload-zone.client.d.ts
@@ -21,7 +21,7 @@ declare function UploadZone({
21
21
  children,
22
22
  className,
23
23
  ...props
24
- }: UploadZoneProps): react_jsx_runtime5.JSX.Element;
24
+ }: UploadZoneProps): react_jsx_runtime7.JSX.Element;
25
25
  //#endregion
26
26
  export { UploadZone, UploadZoneProps };
27
27
  //# sourceMappingURL=upload-zone.client.d.mts.map
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
3
  import { cn } from "../../../lib/utils/cn.mjs";
4
- import { useAction } from "../../../lib/hooks/use-action.mjs";
5
4
  import { toast } from "../../../components/ui/sonner.client.mjs";
5
+ import { useAction } from "../../../lib/hooks/use-action.mjs";
6
6
  import { UploadZoneContext } from "./upload-zone-context.client.mjs";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { useCallback } from "react";
@@ -78,7 +78,6 @@ function UploadZone({ variables, optimistic, uploadClient, uploadHooks, onUpload
78
78
  }, [onUpload]),
79
79
  noClick: true
80
80
  });
81
- console.log("isDragActive", isDragActive);
82
81
  return /* @__PURE__ */ jsxs("div", {
83
82
  ...props,
84
83
  ...getRootProps(),
@@ -1 +1 @@
1
- {"version":3,"file":"upload-zone.client.mjs","names":["variables"],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { toast } from \"@/components/ui/sonner.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { ComponentProps, useCallback } from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport { UploadFileRequest, UploadHooks } from \"../lib/create-upload.client\";\nimport { FileNode, Node, UploadFileSchema } from \"../lib/validators\";\nimport { UploadZoneContext, UploadZoneContextValue } from \"./upload-zone-context.client\";\n\nexport type UploadZoneProps = ComponentProps<\"div\"> &\n Pick<UploadZoneContextValue, \"optimistic\" | \"uploadClient\"> & {\n variables: Pick<UploadFileSchema, \"namespace\" | \"parentId\" | \"mode\" | \"hidden\" | \"readonly\">;\n uploadHooks?: UploadHooks;\n\n onUploadCompleted?: (node: Node) => Promise<void> | void;\n onUploadFailed?: (error: unknown) => Promise<void> | void;\n };\n\nexport function UploadZone({\n variables,\n optimistic,\n uploadClient,\n uploadHooks,\n onUploadCompleted,\n onUploadFailed,\n children,\n className,\n ...props\n}: UploadZoneProps) {\n /**\n * Delete mutation\n */\n const deleteMutation = useAction({\n mutationFn: async (ids: string[]) => uploadClient.deleteFiles(ids),\n onMutate: async (ids) => {\n await optimistic?.cancel?.();\n await optimistic?.remove?.(ids);\n },\n onError: async (error) => {\n console.error(\"Delete failed upload error: \", error);\n await onUploadFailed?.(error);\n },\n onSettled: () => {\n optimistic?.invalidate?.();\n },\n });\n\n /**\n * Upload mutation\n */\n const uploadMutation = useAction({\n mutationFn: async (params: UploadFileRequest) => uploadClient.upload(params, uploadHooks),\n onMutate: async (variables) => {\n // Generate a new node\n const newNode = {\n ...variables,\n type: \"file\",\n isPending: true,\n } as FileNode;\n\n await optimistic?.cancel?.();\n await optimistic?.add?.(newNode);\n },\n onSuccess: async (data) => {\n await onUploadCompleted?.(data);\n toast.success(`Succesvol geupload: ${data.name}`);\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Upload error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync([variables.id]);\n },\n onSettled: () => {\n optimistic?.invalidate?.();\n },\n });\n\n /**\n * Upload file handler\n */\n const onUpload = useCallback(\n async (file: File) => {\n console.info(\"Uploading file\", file);\n const req = uploadClient.prepareUpload({ ...variables, file });\n return await uploadMutation.mutateAsync(req);\n },\n [uploadClient, variables, uploadMutation],\n );\n\n /**\n * Drop handler\n */\n const onDrop = useCallback(\n async (acceptedFiles: File[]) => {\n if (acceptedFiles.length === 0) return;\n await Promise.allSettled(acceptedFiles.map(onUpload));\n },\n [onUpload],\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, noClick: true });\n\n console.log(\"isDragActive\", isDragActive);\n\n return (\n <div {...props} {...getRootProps()} className={cn(\"relative z-0\", className)}>\n <input {...getInputProps()} />\n\n {/* Show drag overlay when drag is active */}\n {isDragActive && (\n <div className=\"bg-primary/20 absolute inset-0 z-10 rounded-md opacity-70 backdrop-blur-3xl\" />\n )}\n\n <UploadZoneContext\n value={{\n uploadClient,\n onUpload,\n onRemove: deleteMutation.mutateAsync,\n optimistic,\n }}\n >\n {children}\n </UploadZoneContext>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAoBA,SAAgB,WAAW,EACzB,WACA,YACA,cACA,aACA,mBACA,gBACA,UACA,WACA,GAAG,SACe;;;;CAIlB,MAAM,iBAAiB,UAAU;EAC/B,YAAY,OAAO,QAAkB,aAAa,YAAY,IAAI;EAClE,UAAU,OAAO,QAAQ;AACvB,SAAM,YAAY,UAAU;AAC5B,SAAM,YAAY,SAAS,IAAI;;EAEjC,SAAS,OAAO,UAAU;AACxB,WAAQ,MAAM,gCAAgC,MAAM;AACpD,SAAM,iBAAiB,MAAM;;EAE/B,iBAAiB;AACf,eAAY,cAAc;;EAE7B,CAAC;;;;CAKF,MAAM,iBAAiB,UAAU;EAC/B,YAAY,OAAO,WAA8B,aAAa,OAAO,QAAQ,YAAY;EACzF,UAAU,OAAO,gBAAc;GAE7B,MAAM,UAAU;IACd,GAAGA;IACH,MAAM;IACN,WAAW;IACZ;AAED,SAAM,YAAY,UAAU;AAC5B,SAAM,YAAY,MAAM,QAAQ;;EAElC,WAAW,OAAO,SAAS;AACzB,SAAM,oBAAoB,KAAK;AAC/B,SAAM,QAAQ,uBAAuB,KAAK,OAAO;;EAEnD,SAAS,OAAO,OAAO,gBAAc;AACnC,SAAM,iBAAiB,MAAM;AAE7B,WAAQ,MAAM,kBAAkB,MAAM;AACtC,SAAM,MAAM,4BAA4B,EACtC,aAAa,iBAAiB,QAAQ,MAAM,UAAU,QACvD,CAAC;AAEF,WAAQ,KAAK,yBAAyB;AACtC,SAAM,eAAe,YAAY,CAACA,YAAU,GAAG,CAAC;;EAElD,iBAAiB;AACf,eAAY,cAAc;;EAE7B,CAAC;;;;CAKF,MAAM,WAAW,YACf,OAAO,SAAe;AACpB,UAAQ,KAAK,kBAAkB,KAAK;EACpC,MAAM,MAAM,aAAa,cAAc;GAAE,GAAG;GAAW;GAAM,CAAC;AAC9D,SAAO,MAAM,eAAe,YAAY,IAAI;IAE9C;EAAC;EAAc;EAAW;EAAe,CAC1C;CAaD,MAAM,EAAE,cAAc,eAAe,iBAAiB,YAAY;EAAE,QARrD,YACb,OAAO,kBAA0B;AAC/B,OAAI,cAAc,WAAW,EAAG;AAChC,SAAM,QAAQ,WAAW,cAAc,IAAI,SAAS,CAAC;KAEvD,CAAC,SAAS,CACX;EAE2E,SAAS;EAAM,CAAC;AAE5F,SAAQ,IAAI,gBAAgB,aAAa;AAEzC,QACE,qBAAC;EAAI,GAAI;EAAO,GAAI,cAAc;EAAE,WAAW,GAAG,gBAAgB,UAAU;;GAC1E,oBAAC,WAAM,GAAI,eAAe,GAAI;GAG7B,gBACC,oBAAC,SAAI,WAAU,gFAAgF;GAGjG,oBAAC;IACC,OAAO;KACL;KACA;KACA,UAAU,eAAe;KACzB;KACD;IAEA;KACiB;;GAChB"}
1
+ {"version":3,"file":"upload-zone.client.mjs","names":["variables"],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { toast } from \"@/components/ui/sonner.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { ComponentProps, useCallback } from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport { UploadFileRequest, UploadHooks } from \"../lib/create-upload.client\";\nimport { FileNode, Node, UploadFileSchema } from \"../lib/validators\";\nimport { UploadZoneContext, UploadZoneContextValue } from \"./upload-zone-context.client\";\n\nexport type UploadZoneProps = ComponentProps<\"div\"> &\n Pick<UploadZoneContextValue, \"optimistic\" | \"uploadClient\"> & {\n variables: Pick<UploadFileSchema, \"namespace\" | \"parentId\" | \"mode\" | \"hidden\" | \"readonly\">;\n uploadHooks?: UploadHooks;\n\n onUploadCompleted?: (node: Node) => Promise<void> | void;\n onUploadFailed?: (error: unknown) => Promise<void> | void;\n };\n\nexport function UploadZone({\n variables,\n optimistic,\n uploadClient,\n uploadHooks,\n onUploadCompleted,\n onUploadFailed,\n children,\n className,\n ...props\n}: UploadZoneProps) {\n /**\n * Delete mutation\n */\n const deleteMutation = useAction({\n mutationFn: async (ids: string[]) => uploadClient.deleteFiles(ids),\n onMutate: async (ids) => {\n await optimistic?.cancel?.();\n await optimistic?.remove?.(ids);\n },\n onError: async (error) => {\n console.error(\"Delete failed upload error: \", error);\n await onUploadFailed?.(error);\n },\n onSettled: () => {\n optimistic?.invalidate?.();\n },\n });\n\n /**\n * Upload mutation\n */\n const uploadMutation = useAction({\n mutationFn: async (params: UploadFileRequest) => uploadClient.upload(params, uploadHooks),\n onMutate: async (variables) => {\n // Generate a new node\n const newNode = {\n ...variables,\n type: \"file\",\n isPending: true,\n } as FileNode;\n\n await optimistic?.cancel?.();\n await optimistic?.add?.(newNode);\n },\n onSuccess: async (data) => {\n await onUploadCompleted?.(data);\n toast.success(`Succesvol geupload: ${data.name}`);\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Upload error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync([variables.id]);\n },\n onSettled: () => {\n optimistic?.invalidate?.();\n },\n });\n\n /**\n * Upload file handler\n */\n const onUpload = useCallback(\n async (file: File) => {\n console.info(\"Uploading file\", file);\n const req = uploadClient.prepareUpload({ ...variables, file });\n return await uploadMutation.mutateAsync(req);\n },\n [uploadClient, variables, uploadMutation],\n );\n\n /**\n * Drop handler\n */\n const onDrop = useCallback(\n async (acceptedFiles: File[]) => {\n if (acceptedFiles.length === 0) return;\n await Promise.allSettled(acceptedFiles.map(onUpload));\n },\n [onUpload],\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, noClick: true });\n\n return (\n <div {...props} {...getRootProps()} className={cn(\"relative z-0\", className)}>\n <input {...getInputProps()} />\n\n {/* Show drag overlay when drag is active */}\n {isDragActive && (\n <div className=\"bg-primary/20 absolute inset-0 z-10 rounded-md opacity-70 backdrop-blur-3xl\" />\n )}\n\n <UploadZoneContext\n value={{\n uploadClient,\n onUpload,\n onRemove: deleteMutation.mutateAsync,\n optimistic,\n }}\n >\n {children}\n </UploadZoneContext>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAoBA,SAAgB,WAAW,EACzB,WACA,YACA,cACA,aACA,mBACA,gBACA,UACA,WACA,GAAG,SACe;;;;CAIlB,MAAM,iBAAiB,UAAU;EAC/B,YAAY,OAAO,QAAkB,aAAa,YAAY,IAAI;EAClE,UAAU,OAAO,QAAQ;AACvB,SAAM,YAAY,UAAU;AAC5B,SAAM,YAAY,SAAS,IAAI;;EAEjC,SAAS,OAAO,UAAU;AACxB,WAAQ,MAAM,gCAAgC,MAAM;AACpD,SAAM,iBAAiB,MAAM;;EAE/B,iBAAiB;AACf,eAAY,cAAc;;EAE7B,CAAC;;;;CAKF,MAAM,iBAAiB,UAAU;EAC/B,YAAY,OAAO,WAA8B,aAAa,OAAO,QAAQ,YAAY;EACzF,UAAU,OAAO,gBAAc;GAE7B,MAAM,UAAU;IACd,GAAGA;IACH,MAAM;IACN,WAAW;IACZ;AAED,SAAM,YAAY,UAAU;AAC5B,SAAM,YAAY,MAAM,QAAQ;;EAElC,WAAW,OAAO,SAAS;AACzB,SAAM,oBAAoB,KAAK;AAC/B,SAAM,QAAQ,uBAAuB,KAAK,OAAO;;EAEnD,SAAS,OAAO,OAAO,gBAAc;AACnC,SAAM,iBAAiB,MAAM;AAE7B,WAAQ,MAAM,kBAAkB,MAAM;AACtC,SAAM,MAAM,4BAA4B,EACtC,aAAa,iBAAiB,QAAQ,MAAM,UAAU,QACvD,CAAC;AAEF,WAAQ,KAAK,yBAAyB;AACtC,SAAM,eAAe,YAAY,CAACA,YAAU,GAAG,CAAC;;EAElD,iBAAiB;AACf,eAAY,cAAc;;EAE7B,CAAC;;;;CAKF,MAAM,WAAW,YACf,OAAO,SAAe;AACpB,UAAQ,KAAK,kBAAkB,KAAK;EACpC,MAAM,MAAM,aAAa,cAAc;GAAE,GAAG;GAAW;GAAM,CAAC;AAC9D,SAAO,MAAM,eAAe,YAAY,IAAI;IAE9C;EAAC;EAAc;EAAW;EAAe,CAC1C;CAaD,MAAM,EAAE,cAAc,eAAe,iBAAiB,YAAY;EAAE,QARrD,YACb,OAAO,kBAA0B;AAC/B,OAAI,cAAc,WAAW,EAAG;AAChC,SAAM,QAAQ,WAAW,cAAc,IAAI,SAAS,CAAC;KAEvD,CAAC,SAAS,CACX;EAE2E,SAAS;EAAM,CAAC;AAE5F,QACE,qBAAC;EAAI,GAAI;EAAO,GAAI,cAAc;EAAE,WAAW,GAAG,gBAAgB,UAAU;;GAC1E,oBAAC,WAAM,GAAI,eAAe,GAAI;GAG7B,gBACC,oBAAC,SAAI,WAAU,gFAAgF;GAGjG,oBAAC;IACC,OAAO;KACL;KACA;KACA,UAAU,eAAe;KACzB;KACD;IAEA;KACiB;;GAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-upload.client.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/create-upload.client.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAOY,KAAA,kBAAA,GAAqB,IAAH,CAAQ,iBAAA,EAAL,IAAA,GAAI,MAAA,GAAA,MAAA,GAAA,aAAA,CAAA;AACzB,KAAA,iBAAA,GAAoB,iBAAA,GAAA;EACpB,IAAA,EADgD,IAChD;CACc;AAAsB,KADpC,WAAA,GACoC;EAC0B,aAAA,CAAA,EAAA,CAAA,KAAA,EADhD,iBACgD,EAAA,GAD1B,OAC0B,CAAA,IAAA,CAAA,GAAA,IAAA;EACC,YAAA,CAAA,EAAA,CAAA,aAAA,EAAA;IACnD,EAAA,EAAA,MAAA;IAAqB,YAAA,EAAA,MAAA;EAAO,CAAA,EAAA,GAFsB,OAEtB,CAAA,IAAA,CAAA,GAAA,IAAA;EAMxC,aAAA,CAAA,EAAY,CAAA,aAAA,EAAA;IACC,EAAA,EAAA,MAAA;IAAuB,YAAA,EAAA,MAAA;EAC9B,CAAA,EAAA,GATyD,OASzD,CAAA,IAAA,CAAA,GAAA,IAAA;EAA2B,YAAA,CAAA,EAAA,CAAA,IAAA,EARrB,gBAQqB,EAAA,GARA,OAQA,CAAA,IAAA,CAAA,GAAA,IAAA;CAAwB;;;;AAEP,KAJlD,YAAA,GAIkD;EAAR,aAAA,EAAA,CAAA,KAAA,EAH7B,kBAG6B,EAAA,GAHN,iBAGM;EAAO,MAAA,EAAA,CAAA,KAAA,EAF3C,iBAE2C,EAAA,KAAA,CAAA,EAFhB,WAEgB,EAAA,GAFA,OAEA,CAFQ,gBAER,CAAA;EAMxD,WAAA,EAAA,CAAA,GAAA,EAAA,MAAA,EAAuB,EAAA,GAPM,OAON,CAAA,IAAA,CAAA;EAEP,UAAA,EAAA,CAAA,EAAA,EAAA,MAAA,EAAA,IAAA,EARY,gBAQZ,EAAA,GARiC,OAQjC,CARyC,gBAQzC,CAAA;CAAsB;;;;KAFtC,uBAAA,GAIyC;EACF,SAAA,EAAA;IAA+B,OAAA,EAAA,CAAA,KAAA,EAHtD,iBAGsD,EAAA,GAHhC,OAGgC,CAAA;MAAR,EAAA,EAAA,MAAA;MAAO,YAAA,EAAA,MAAA;IAI1D,CAAA,CAAA;;;UANwB,QAAQ;yBACvB,qBAAqB;;;YACF;UAAuB,QAAQ;;;iBAI3D,kBAAA,QAA0B,0BAA0B"}
1
+ {"version":3,"file":"create-upload.client.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/create-upload.client.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAOY,KAAA,kBAAA,GAAqB,IAAK,CAAA,iBAAA,EAAL,IAAI,GAAA,MAAA,GAAA,MAAA,GAAA,aAAA,CAAA;AACzB,KAAA,iBAAA,GAAoB,iBAAA,GAAA;EACpB,IAAA,EADgD,IAChD;CACc;AAAsB,KADpC,WAAA,GACoC;EAC0B,aAAA,CAAA,EAAA,CAAA,KAAA,EADhD,iBACgD,EAAA,GAD1B,OAC0B,CAAA,IAAA,CAAA,GAAA,IAAA;EACC,YAAA,CAAA,EAAA,CAAA,aAAA,EAAA;IACnD,EAAA,EAAA,MAAA;IAAqB,YAAA,EAAA,MAAA;EAAO,CAAA,EAAA,GAFsB,OAEtB,CAAA,IAAA,CAAA,GAAA,IAAA;EAMxC,aAAA,CAAA,EAAY,CAAA,aAAA,EAAA;IACC,EAAA,EAAA,MAAA;IAAuB,YAAA,EAAA,MAAA;EAC9B,CAAA,EAAA,GATyD,OASzD,CAAA,IAAA,CAAA,GAAA,IAAA;EAA2B,YAAA,CAAA,EAAA,CAAA,IAAA,EARrB,gBAQqB,EAAA,GARA,OAQA,CAAA,IAAA,CAAA,GAAA,IAAA;CAAwB;;;;AAEP,KAJlD,YAAA,GAIkD;EAAR,aAAA,EAAA,CAAA,KAAA,EAH7B,kBAG6B,EAAA,GAHN,iBAGM;EAAO,MAAA,EAAA,CAAA,KAAA,EAF3C,iBAE2C,EAAA,KAAA,CAAA,EAFhB,WAEgB,EAAA,GAFA,OAEA,CAFQ,gBAER,CAAA;EAMxD,WAAA,EAAA,CAAA,GAAA,EAAA,MAAA,EAAuB,EAAA,GAPM,OAON,CAAA,IAAA,CAAA;EAEP,UAAA,EAAA,CAAA,EAAA,EAAA,MAAA,EAAA,IAAA,EARY,gBAQZ,EAAA,GARiC,OAQjC,CARyC,gBAQzC,CAAA;CAAsB;;;;KAFtC,uBAAA,GAIyC;EACF,SAAA,EAAA;IAA+B,OAAA,EAAA,CAAA,KAAA,EAHtD,iBAGsD,EAAA,GAHhC,OAGgC,CAAA;MAAR,EAAA,EAAA,MAAA;MAAO,YAAA,EAAA,MAAA;IAI1D,CAAA,CAAA;;;UANwB,QAAQ;yBACvB,qBAAqB;;;YACF;UAAuB,QAAQ;;;iBAI3D,kBAAA,QAA0B,0BAA0B"}
@@ -1,8 +1,8 @@
1
1
  import { getSession } from "../../auth/lib/helpers.server.mjs";
2
2
  import { nodes } from "./schema.mjs";
3
3
  import { getFileURLSchema } from "./validators.mjs";
4
- import { eq } from "drizzle-orm";
5
4
  import "server-cli-only";
5
+ import { eq } from "drizzle-orm";
6
6
  import { connection } from "next/server";
7
7
 
8
8
  //#region src/modules/storage/lib/proxy.server.ts