@simple-builder/react 1.2.5 → 1.2.7

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 (55) hide show
  1. package/dist/build-container-client-56IGH4EB.mjs +2257 -0
  2. package/dist/build-container-client-6D4M5MV6.mjs +2253 -0
  3. package/dist/build-container-client-JR4HENF4.mjs +2255 -0
  4. package/dist/build-container-client-JS3CR4W3.js +2293 -0
  5. package/dist/build-container-client-JXYQOZHZ.js +2289 -0
  6. package/dist/build-container-client-OANZW6DH.mjs +2257 -0
  7. package/dist/build-container-client-QBXLJYQD.js +2293 -0
  8. package/dist/build-container-client-QOFTIHCU.js +2291 -0
  9. package/dist/build-container-client-XNI5DVSE.mjs +2273 -0
  10. package/dist/build-container-client-YTZ4C67E.mjs +9 -0
  11. package/dist/build-container-client-Z34EUPR3.js +9 -0
  12. package/dist/build-container-client-ZXB5JG67.js +2309 -0
  13. package/dist/builder-content-5K55QBEE.js +42 -0
  14. package/dist/builder-content-5K7B4FXR.js +42 -0
  15. package/dist/builder-content-EHVMYKSR.mjs +20 -0
  16. package/dist/builder-content-J6G2PNIM.js +42 -0
  17. package/dist/builder-content-JQ7BYR4W.mjs +20 -0
  18. package/dist/builder-content-KWK44AH6.mjs +20 -0
  19. package/dist/builder-content-LYSSA6KK.js +42 -0
  20. package/dist/builder-content-MPQ7ZQN4.js +42 -0
  21. package/dist/builder-content-OE75E24Z.mjs +20 -0
  22. package/dist/builder-content-STUVQ4ME.mjs +20 -0
  23. package/dist/chunk-2DLJX5FY.mjs +123 -0
  24. package/dist/chunk-2S5KDJXM.js +263 -0
  25. package/dist/chunk-3F3TNWYK.mjs +20 -0
  26. package/dist/chunk-5DXQZNUR.mjs +238 -0
  27. package/dist/chunk-5N4LAZ6V.js +42 -0
  28. package/dist/chunk-5NN2XSII.mjs +238 -0
  29. package/dist/chunk-5VQCJART.js +153 -0
  30. package/dist/chunk-75X4HNGS.mjs +238 -0
  31. package/dist/chunk-BUELIHBX.mjs +238 -0
  32. package/dist/chunk-DMNRRIPC.js +42 -0
  33. package/dist/chunk-EMZAPBOH.mjs +20 -0
  34. package/dist/chunk-FKVC2UHD.js +42 -0
  35. package/dist/chunk-FN6K4WJP.mjs +20 -0
  36. package/dist/chunk-HA4DTJA7.mjs +123 -0
  37. package/dist/chunk-I4TPSTXB.js +263 -0
  38. package/dist/chunk-IACBZNOK.js +153 -0
  39. package/dist/chunk-IVF3GTYS.js +263 -0
  40. package/dist/chunk-JDB6GNKI.js +263 -0
  41. package/dist/chunk-ORODN5Q7.js +153 -0
  42. package/dist/chunk-RCDOLMDG.js +263 -0
  43. package/dist/chunk-RTB6I3Q2.js +153 -0
  44. package/dist/chunk-RUBQ6OAO.mjs +238 -0
  45. package/dist/chunk-SMRPMB3V.js +153 -0
  46. package/dist/chunk-TF7VKEU2.mjs +123 -0
  47. package/dist/chunk-TWGYIJD2.js +42 -0
  48. package/dist/chunk-UFWIAKEA.mjs +20 -0
  49. package/dist/chunk-UH23D2JA.mjs +123 -0
  50. package/dist/chunk-WP7KTUTL.js +42 -0
  51. package/dist/chunk-XFIY7HQO.mjs +123 -0
  52. package/dist/chunk-XULCJNV7.mjs +20 -0
  53. package/dist/index.js +6 -6
  54. package/dist/index.mjs +2 -2
  55. package/package.json +2 -2
@@ -0,0 +1,2289 @@
1
+ 'use client';
2
+ 'use client';
3
+ 'use client';
4
+ 'use client';
5
+ 'use strict';
6
+
7
+ require('./chunk-TWGYIJD2.js');
8
+ var chunkIVF3GTYS_js = require('./chunk-IVF3GTYS.js');
9
+ var chunk5VQCJART_js = require('./chunk-5VQCJART.js');
10
+ var React25 = require('react');
11
+ var lucideReact = require('lucide-react');
12
+ var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
13
+ var PopoverPrimitive = require('@radix-ui/react-popover');
14
+ var react = require('@tiptap/react');
15
+ var extensionColor = require('@tiptap/extension-color');
16
+ var extensionTextStyle = require('@tiptap/extension-text-style');
17
+ var extensionUnderline = require('@tiptap/extension-underline');
18
+ var starterKit = require('@tiptap/starter-kit');
19
+ var TiptapLink = require('@tiptap/extension-link');
20
+ var state = require('@tiptap/pm/state');
21
+ var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
22
+ var SeparatorPrimitive = require('@radix-ui/react-separator');
23
+ var TogglePrimitive = require('@radix-ui/react-toggle');
24
+ var classVarianceAuthority = require('class-variance-authority');
25
+ var lu = require('react-icons/lu');
26
+ var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
27
+ var DialogPrimitive = require('@radix-ui/react-dialog');
28
+ var reactSlot = require('@radix-ui/react-slot');
29
+ var reactHookForm = require('react-hook-form');
30
+ var LabelPrimitive = require('@radix-ui/react-label');
31
+ var SwitchPrimitives = require('@radix-ui/react-switch');
32
+ var zod$1 = require('@hookform/resolvers/zod');
33
+ var zod = require('zod');
34
+ var dateFns = require('date-fns');
35
+ var reactDayPicker = require('react-day-picker');
36
+ var SelectPrimitive = require('@radix-ui/react-select');
37
+ var TabsPrimitive = require('@radix-ui/react-tabs');
38
+ var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
39
+
40
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
41
+
42
+ function _interopNamespace(e) {
43
+ if (e && e.__esModule) return e;
44
+ var n = Object.create(null);
45
+ if (e) {
46
+ Object.keys(e).forEach(function (k) {
47
+ if (k !== 'default') {
48
+ var d = Object.getOwnPropertyDescriptor(e, k);
49
+ Object.defineProperty(n, k, d.get ? d : {
50
+ enumerable: true,
51
+ get: function () { return e[k]; }
52
+ });
53
+ }
54
+ });
55
+ }
56
+ n.default = e;
57
+ return Object.freeze(n);
58
+ }
59
+
60
+ var React25__namespace = /*#__PURE__*/_interopNamespace(React25);
61
+ var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
62
+ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
63
+ var TiptapLink__default = /*#__PURE__*/_interopDefault(TiptapLink);
64
+ var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
65
+ var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
66
+ var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
67
+ var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
68
+ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
69
+ var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
70
+ var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
71
+ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
72
+ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
73
+ var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
74
+
75
+ var AlertDialog = AlertDialogPrimitive__namespace.Root;
76
+ var AlertDialogTrigger = AlertDialogPrimitive__namespace.Trigger;
77
+ var AlertDialogPortal = AlertDialogPrimitive__namespace.Portal;
78
+ var AlertDialogOverlay = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
79
+ AlertDialogPrimitive__namespace.Overlay,
80
+ {
81
+ className: chunk5VQCJART_js.cn(
82
+ "sb-fixed sb-inset-0 sb-z-50 sb-bg-background/80 sb-backdrop-blur-sm data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0",
83
+ className
84
+ ),
85
+ ...props,
86
+ ref
87
+ }
88
+ ));
89
+ AlertDialogOverlay.displayName = AlertDialogPrimitive__namespace.Overlay.displayName;
90
+ var AlertDialogContent = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(AlertDialogPortal, null, /* @__PURE__ */ React25__namespace.createElement(AlertDialogOverlay, null), /* @__PURE__ */ React25__namespace.createElement(
91
+ AlertDialogPrimitive__namespace.Content,
92
+ {
93
+ ref,
94
+ className: chunk5VQCJART_js.cn(
95
+ "sb-fixed sb-font-roboto sb-left-[50%] sb-top-[50%] sb-z-50 sb-grid sb-w-full sb-max-w-lg sb-translate-x-[-50%] sb-translate-y-[-50%] sb-gap-4 sb-border sb-bg-background sb-p-6 sb-shadow-lg sb-duration-200 data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[state=closed]:sb-slide-out-to-left-1/2 data-[state=closed]:sb-slide-out-to-top-[48%] data-[state=open]:sb-slide-in-from-left-1/2 data-[state=open]:sb-slide-in-from-top-[48%] sm:sb-rounded-lg",
96
+ className
97
+ ),
98
+ ...props
99
+ }
100
+ )));
101
+ AlertDialogContent.displayName = AlertDialogPrimitive__namespace.Content.displayName;
102
+ var AlertDialogFooter = ({
103
+ className,
104
+ ...props
105
+ }) => /* @__PURE__ */ React25__namespace.createElement(
106
+ "div",
107
+ {
108
+ className: chunk5VQCJART_js.cn(
109
+ "sb-flex sb-flex-col-reverse sm:sb-flex-row sm:sb-justify-end sm:sb-space-x-2",
110
+ className
111
+ ),
112
+ ...props
113
+ }
114
+ );
115
+ AlertDialogFooter.displayName = "AlertDialogFooter";
116
+ var AlertDialogTitle = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
117
+ AlertDialogPrimitive__namespace.Title,
118
+ {
119
+ ref,
120
+ className: chunk5VQCJART_js.cn("sb-text-lg sb-font-semibold", className),
121
+ ...props
122
+ }
123
+ ));
124
+ AlertDialogTitle.displayName = AlertDialogPrimitive__namespace.Title.displayName;
125
+ var AlertDialogDescription = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
126
+ AlertDialogPrimitive__namespace.Description,
127
+ {
128
+ ref,
129
+ className: chunk5VQCJART_js.cn("sb-text-sm sb-text-muted-foreground", className),
130
+ ...props
131
+ }
132
+ ));
133
+ AlertDialogDescription.displayName = AlertDialogPrimitive__namespace.Description.displayName;
134
+ var AlertDialogAction = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
135
+ AlertDialogPrimitive__namespace.Action,
136
+ {
137
+ ref,
138
+ className: chunk5VQCJART_js.cn(chunkIVF3GTYS_js.buttonVariants(), className),
139
+ ...props
140
+ }
141
+ ));
142
+ AlertDialogAction.displayName = AlertDialogPrimitive__namespace.Action.displayName;
143
+ var AlertDialogCancel = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
144
+ AlertDialogPrimitive__namespace.Cancel,
145
+ {
146
+ ref,
147
+ className: chunk5VQCJART_js.cn(
148
+ chunkIVF3GTYS_js.buttonVariants({ variant: "outline" }),
149
+ "sb-mt-2 sm:sb-mt-0",
150
+ className
151
+ ),
152
+ ...props
153
+ }
154
+ ));
155
+ AlertDialogCancel.displayName = AlertDialogPrimitive__namespace.Cancel.displayName;
156
+ var Popover = PopoverPrimitive__namespace.Root;
157
+ var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
158
+ var PopoverClose = PopoverPrimitive__namespace.Close;
159
+ var PopoverContent = React25__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React25__namespace.createElement(
160
+ PopoverPrimitive__namespace.Content,
161
+ {
162
+ ref,
163
+ align,
164
+ sideOffset,
165
+ className: chunk5VQCJART_js.cn(
166
+ "sb-z-50 sb-w-72 sb-rounded-md sb-border sb-bg-popover sb-p-4 sb-text-popover-foreground sb-shadow-md sb-outline-none data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[side=bottom]:sb-slide-in-from-top-2 data-[side=left]:sb-slide-in-from-right-2 data-[side=right]:sb-slide-in-from-left-2 data-[side=top]:sb-slide-in-from-bottom-2 sb-origin-[--radix-popover-content-transform-origin]",
167
+ className
168
+ ),
169
+ ...props
170
+ }
171
+ )));
172
+ PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
173
+ var Link = TiptapLink__default.default.extend({
174
+ inclusive: false,
175
+ parseHTML() {
176
+ return [{ tag: 'a[href]:not([data-type="button"]):not([href *= "javascript:" i])' }];
177
+ },
178
+ renderHTML({ HTMLAttributes }) {
179
+ return ["a", react.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
180
+ },
181
+ addOptions() {
182
+ return {
183
+ ...this.parent?.(),
184
+ openOnClick: false
185
+ };
186
+ },
187
+ addProseMirrorPlugins() {
188
+ return [
189
+ ...this.parent?.() || [],
190
+ new state.Plugin({
191
+ props: {
192
+ handleClick(view, pos) {
193
+ const { schema: schema2, doc, tr } = view.state;
194
+ const range = react.getMarkRange(doc.resolve(pos), schema2.marks.link);
195
+ if (!range) {
196
+ return;
197
+ }
198
+ const { from, to } = range;
199
+ const start = Math.min(from, to);
200
+ const end = Math.max(from, to);
201
+ if (pos < start || pos > end) {
202
+ return;
203
+ }
204
+ const $start = doc.resolve(start);
205
+ const $end = doc.resolve(end);
206
+ const transaction = tr.setSelection(new state.TextSelection($start, $end));
207
+ view.dispatch(transaction);
208
+ }
209
+ }
210
+ })
211
+ ];
212
+ }
213
+ });
214
+
215
+ // src/features/rich-text-editor/utils/get-output.ts
216
+ var getOutput = (editor, format2) => {
217
+ switch (format2) {
218
+ case "json":
219
+ return editor.getJSON();
220
+ case "html":
221
+ return editor.isEmpty ? "" : editor.getHTML();
222
+ default:
223
+ return editor.getText();
224
+ }
225
+ };
226
+
227
+ // src/features/rich-text-editor/hooks/useRichTextEditor.ts
228
+ var useRichTextEditor = ({
229
+ value,
230
+ output = "html",
231
+ editorClassName,
232
+ onUpdate,
233
+ onBlur,
234
+ ...options
235
+ }) => {
236
+ const handleCreate = React25.useCallback(
237
+ (editor2) => {
238
+ if (value && editor2.isEmpty) {
239
+ editor2.commands.setContent(value);
240
+ }
241
+ },
242
+ [value]
243
+ );
244
+ const handleUpdate = React25.useCallback(
245
+ (editor2) => {
246
+ onUpdate?.(getOutput(editor2, output));
247
+ },
248
+ [output, onUpdate]
249
+ );
250
+ const handleBlur = React25.useCallback(
251
+ (editor2) => {
252
+ onBlur?.(getOutput(editor2, output));
253
+ },
254
+ [output, onBlur]
255
+ );
256
+ const editor = react.useEditor({
257
+ extensions: [starterKit.StarterKit, extensionUnderline.Underline, extensionColor.Color, extensionTextStyle.TextStyle, Link],
258
+ editorProps: {
259
+ attributes: {
260
+ autocomplete: "off",
261
+ autocorrect: "off",
262
+ autocapitalize: "off",
263
+ class: chunk5VQCJART_js.cn("sb-focus:outline-none", editorClassName)
264
+ }
265
+ },
266
+ onCreate: ({ editor: editor2 }) => handleCreate(editor2),
267
+ onUpdate: ({ editor: editor2 }) => handleUpdate(editor2),
268
+ onBlur: ({ editor: editor2 }) => handleBlur(editor2),
269
+ ...options
270
+ });
271
+ return editor;
272
+ };
273
+ var DropdownMenu = DropdownMenuPrimitive__namespace.Root;
274
+ var DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
275
+ var DropdownMenuSubTrigger = React25__namespace.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
276
+ DropdownMenuPrimitive__namespace.SubTrigger,
277
+ {
278
+ ref,
279
+ className: chunk5VQCJART_js.cn(
280
+ "sb-flex sb-cursor-default sb-select-none sb-items-center sb-gap-2 sb-rounded-sm sb-px-2 sb-py-1.5 sb-text-sm sb-outline-none focus:sb-bg-accent data-[state=open]:sb-bg-accent [&_svg]:sb-pointer-events-none [&_svg]:sb-size-4 [&_svg]:sb-shrink-0",
281
+ inset && "sb-pl-8",
282
+ className
283
+ ),
284
+ ...props
285
+ },
286
+ children,
287
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronRight, { className: "sb-ml-auto" })
288
+ ));
289
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
290
+ var DropdownMenuSubContent = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
291
+ DropdownMenuPrimitive__namespace.SubContent,
292
+ {
293
+ ref,
294
+ className: chunk5VQCJART_js.cn(
295
+ "sb-z-50 sb-min-w-[8rem] sb-overflow-hidden sb-rounded-md sb-border sb-bg-popover sb-p-1 sb-text-popover-foreground sb-shadow-lg data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[side=bottom]:sb-slide-in-from-top-2 data-[side=left]:sb-slide-in-from-right-2 data-[side=right]:sb-slide-in-from-left-2 data-[side=top]:sb-slide-in-from-bottom-2 sb-origin-[--radix-dropdown-menu-content-transform-origin]",
296
+ className
297
+ ),
298
+ ...props
299
+ }
300
+ ));
301
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
302
+ var DropdownMenuContent = React25__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React25__namespace.createElement(
303
+ DropdownMenuPrimitive__namespace.Content,
304
+ {
305
+ ref,
306
+ sideOffset,
307
+ className: chunk5VQCJART_js.cn(
308
+ "sb-z-50 sb-max-h-[var(--radix-dropdown-menu-content-available-height)] sb-min-w-[8rem] sb-overflow-y-auto sb-overflow-x-hidden sb-rounded-md sb-border sb-bg-popover sb-p-1 sb-text-popover-foreground sb-shadow-md",
309
+ "data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[side=bottom]:sb-slide-in-from-top-2 data-[side=left]:sb-slide-in-from-right-2 data-[side=right]:sb-slide-in-from-left-2 data-[side=top]:sb-slide-in-from-bottom-2 sb-origin-[--radix-dropdown-menu-content-transform-origin]",
310
+ className
311
+ ),
312
+ ...props
313
+ }
314
+ )));
315
+ DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
316
+ var DropdownMenuItem = React25__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
317
+ DropdownMenuPrimitive__namespace.Item,
318
+ {
319
+ ref,
320
+ className: chunk5VQCJART_js.cn(
321
+ "sb-relative sb-flex sb-cursor-default sb-select-none sb-items-center sb-gap-2 sb-rounded-sm sb-px-2 sb-py-1.5 sb-text-sm sb-outline-none sb-transition-colors focus:sb-bg-accent focus:sb-text-accent-foreground data-[disabled]:sb-pointer-events-none data-[disabled]:sb-opacity-50 [&>svg]:sb-size-4 [&>svg]:sb-shrink-0",
322
+ inset && "sb-pl-8",
323
+ className
324
+ ),
325
+ ...props
326
+ }
327
+ ));
328
+ DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
329
+ var DropdownMenuCheckboxItem = React25__namespace.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
330
+ DropdownMenuPrimitive__namespace.CheckboxItem,
331
+ {
332
+ ref,
333
+ className: chunk5VQCJART_js.cn(
334
+ "sb-relative sb-flex sb-cursor-default sb-select-none sb-items-center sb-rounded-sm sb-py-1.5 sb-pl-8 sb-pr-2 sb-text-sm sb-outline-none sb-transition-colors focus:sb-bg-accent focus:sb-text-accent-foreground data-[disabled]:sb-pointer-events-none data-[disabled]:sb-opacity-50",
335
+ className
336
+ ),
337
+ checked,
338
+ ...props
339
+ },
340
+ /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-absolute sb-left-2 sb-flex sb-h-3.5 sb-w-3.5 sb-items-center sb-justify-center" }, /* @__PURE__ */ React25__namespace.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React25__namespace.createElement(lucideReact.Check, { className: "sb-h-4 sb-w-4" }))),
341
+ children
342
+ ));
343
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
344
+ var DropdownMenuRadioItem = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
345
+ DropdownMenuPrimitive__namespace.RadioItem,
346
+ {
347
+ ref,
348
+ className: chunk5VQCJART_js.cn(
349
+ "sb-relative sb-flex sb-cursor-default sb-select-none sb-items-center sb-rounded-sm sb-py-1.5 sb-pl-8 sb-pr-2 sb-text-sm sb-outline-none sb-transition-colors focus:sb-bg-accent focus:sb-text-accent-foreground data-[disabled]:sb-pointer-events-none data-[disabled]:sb-opacity-50",
350
+ className
351
+ ),
352
+ ...props
353
+ },
354
+ /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-absolute sb-left-2 sb-flex sb-h-3.5 sb-w-3.5 sb-items-center sb-justify-center" }, /* @__PURE__ */ React25__namespace.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React25__namespace.createElement(lucideReact.Circle, { className: "sb-h-2 sb-w-2 sb-fill-current" }))),
355
+ children
356
+ ));
357
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
358
+ var DropdownMenuLabel = React25__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
359
+ DropdownMenuPrimitive__namespace.Label,
360
+ {
361
+ ref,
362
+ className: chunk5VQCJART_js.cn(
363
+ "sb-px-2 sb-py-1.5 sb-text-sm sb-font-semibold",
364
+ inset && "sb-pl-8",
365
+ className
366
+ ),
367
+ ...props
368
+ }
369
+ ));
370
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
371
+ var DropdownMenuSeparator = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
372
+ DropdownMenuPrimitive__namespace.Separator,
373
+ {
374
+ ref,
375
+ className: chunk5VQCJART_js.cn("sb--mx-1 sb-my-1 sb-h-px sb-bg-muted", className),
376
+ ...props
377
+ }
378
+ ));
379
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive__namespace.Separator.displayName;
380
+ var Separator2 = React25__namespace.forwardRef(
381
+ ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
382
+ SeparatorPrimitive__namespace.Root,
383
+ {
384
+ ref,
385
+ decorative,
386
+ orientation,
387
+ className: chunk5VQCJART_js.cn(
388
+ "sb-shrink-0 sb-bg-border",
389
+ orientation === "horizontal" ? "sb-h-[1px] sb-w-full" : "sb-h-full sb-w-[1px]",
390
+ className
391
+ ),
392
+ ...props
393
+ }
394
+ )
395
+ );
396
+ Separator2.displayName = SeparatorPrimitive__namespace.Root.displayName;
397
+ var toggleVariants = classVarianceAuthority.cva(
398
+ "sb-inline-flex sb-items-center sb-justify-center sb-gap-2 sb-rounded-md sb-text-sm sb-font-medium sb-transition-colors hover:sb-bg-muted hover:sb-text-muted-foreground focus-visible:sb-outline-none focus-visible:sb-ring-1 focus-visible:sb-ring-ring disabled:sb-pointer-events-none disabled:sb-opacity-50 data-[state=on]:sb-bg-accent data-[state=on]:sb-text-accent-foreground [&_svg]:sb-pointer-events-none [&_svg]:sb-size-4 [&_svg]:sb-shrink-0",
399
+ {
400
+ variants: {
401
+ variant: {
402
+ default: "sb-bg-transparent",
403
+ outline: "sb-border sb-border-input sb-bg-transparent sb-shadow-sm hover:sb-bg-accent hover:sb-text-accent-foreground"
404
+ },
405
+ size: {
406
+ default: "sb-h-9 sb-px-2 sb-min-w-9",
407
+ sm: "sb-h-8 sb-px-1.5 sb-min-w-8",
408
+ lg: "sb-h-10 sb-px-2.5 sb-min-w-10"
409
+ }
410
+ },
411
+ defaultVariants: {
412
+ variant: "default",
413
+ size: "default"
414
+ }
415
+ }
416
+ );
417
+ var Toggle = React25__namespace.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
418
+ TogglePrimitive__namespace.Root,
419
+ {
420
+ ref,
421
+ className: chunk5VQCJART_js.cn(toggleVariants({ variant, size, className })),
422
+ ...props
423
+ }
424
+ ));
425
+ Toggle.displayName = TogglePrimitive__namespace.Root.displayName;
426
+ var ToggleGroupContext = React25__namespace.createContext({
427
+ size: "default",
428
+ variant: "default"
429
+ });
430
+ var ToggleGroup = React25__namespace.forwardRef(({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
431
+ ToggleGroupPrimitive__namespace.Root,
432
+ {
433
+ ref,
434
+ className: chunk5VQCJART_js.cn("sb-flex sb-items-center sb-justify-center sb-gap-1", className),
435
+ ...props
436
+ },
437
+ /* @__PURE__ */ React25__namespace.createElement(ToggleGroupContext.Provider, { value: { variant, size } }, children)
438
+ ));
439
+ ToggleGroup.displayName = ToggleGroupPrimitive__namespace.Root.displayName;
440
+ var ToggleGroupItem = React25__namespace.forwardRef(({ className, children, variant, size, ...props }, ref) => {
441
+ const context = React25__namespace.useContext(ToggleGroupContext);
442
+ return /* @__PURE__ */ React25__namespace.createElement(
443
+ ToggleGroupPrimitive__namespace.Item,
444
+ {
445
+ ref,
446
+ className: chunk5VQCJART_js.cn(
447
+ toggleVariants({
448
+ variant: context.variant || variant,
449
+ size: context.size || size
450
+ }),
451
+ className
452
+ ),
453
+ ...props
454
+ },
455
+ children
456
+ );
457
+ });
458
+ ToggleGroupItem.displayName = ToggleGroupPrimitive__namespace.Item.displayName;
459
+ var PALETTES = [
460
+ {
461
+ inverse: "hsl(var(--background))",
462
+ colors: [
463
+ { cssVar: "hsl(var(--foreground))" },
464
+ { cssVar: "hsl(var(--primary-foreground))" },
465
+ { cssVar: "hsl(var(--secondary-foreground))" },
466
+ { cssVar: "hsl(var(--tertiary-foreground))" },
467
+ { cssVar: "hsl(var(--muted-foreground))" },
468
+ { cssVar: "hsl(var(--accent-foreground))" },
469
+ { cssVar: "hsl(var(--destructive-foreground))" }
470
+ ]
471
+ },
472
+ {
473
+ inverse: "hsl(var(--foreground))",
474
+ colors: [
475
+ { cssVar: "hsl(var(--background))" },
476
+ { cssVar: "hsl(var(--primary))" },
477
+ { cssVar: "hsl(var(--secondary))" },
478
+ { cssVar: "hsl(var(--tertiary))" },
479
+ { cssVar: "hsl(var(--muted))" },
480
+ { cssVar: "hsl(var(--accent))" },
481
+ { cssVar: "hsl(var(--destructive))" }
482
+ ]
483
+ }
484
+ ];
485
+ var ColorTool = ({ editor }) => {
486
+ const color = editor.getAttributes("textStyle")?.color || "hsl(var(--foreground))";
487
+ const [selectedColor, setSelectedColor] = React25__namespace.useState(color);
488
+ React25__namespace.useEffect(() => {
489
+ setSelectedColor(color);
490
+ }, [color]);
491
+ const handleColorChange = React25__namespace.useCallback(
492
+ (value) => {
493
+ setSelectedColor(value);
494
+ editor.chain().focus().setColor(value).run();
495
+ },
496
+ [editor]
497
+ );
498
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, { modal: true }, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(ToolbarButton, { className: "sb-w-12" }, /* @__PURE__ */ React25__namespace.createElement(
499
+ "svg",
500
+ {
501
+ xmlns: "http://www.w3.org/2000/svg",
502
+ width: "24",
503
+ height: "24",
504
+ viewBox: "0 0 24 24",
505
+ fill: "none",
506
+ stroke: "currentColor",
507
+ strokeWidth: "2",
508
+ strokeLinecap: "round",
509
+ strokeLinejoin: "round",
510
+ className: "sb-size-5",
511
+ style: { color: selectedColor }
512
+ },
513
+ /* @__PURE__ */ React25__namespace.createElement("path", { d: "M4 20h16" }),
514
+ /* @__PURE__ */ React25__namespace.createElement("path", { d: "m6 16 6-12 6 12" }),
515
+ /* @__PURE__ */ React25__namespace.createElement("path", { d: "M8 12h8" })
516
+ ), /* @__PURE__ */ React25__namespace.createElement(lu.LuChevronDown, { className: "sb-size-5" }))), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { align: "start", className: "sb-w-full" }, /* @__PURE__ */ React25__namespace.createElement(
517
+ ToggleGroup,
518
+ {
519
+ type: "single",
520
+ value: selectedColor,
521
+ onValueChange: handleColorChange,
522
+ className: "sb-flex-col sb-gap-1.5"
523
+ },
524
+ PALETTES.map((pallete, i) => /* @__PURE__ */ React25__namespace.createElement("div", { key: i, className: "sb-flex sb-gap-1.5" }, pallete.colors.map((color2, j) => /* @__PURE__ */ React25__namespace.createElement(
525
+ ToggleGroupItem,
526
+ {
527
+ tabIndex: 0,
528
+ key: j,
529
+ className: "sb-relative sb-size-7 sb-rounded-md sb-border sb-p-0",
530
+ value: color2.cssVar,
531
+ style: { backgroundColor: color2.cssVar }
532
+ },
533
+ selectedColor === color2.cssVar && /* @__PURE__ */ React25__namespace.createElement(
534
+ lu.LuCheck,
535
+ {
536
+ className: "sb-absolute sb-inset-0 sb-m-auto sb-size-6",
537
+ style: { color: pallete.inverse }
538
+ }
539
+ )
540
+ ))))
541
+ )));
542
+ };
543
+ var formatActions = [
544
+ {
545
+ label: "Normal Text",
546
+ element: "span",
547
+ className: "sb-grow"
548
+ },
549
+ {
550
+ label: "Heading 1",
551
+ element: "h1",
552
+ level: 1,
553
+ className: "sb-m-0 sb-grow sb-text-3xl sb-font-extrabold"
554
+ },
555
+ {
556
+ label: "Heading 2",
557
+ element: "h2",
558
+ level: 2,
559
+ className: "sb-m-0 sb-grow sb-text-xl sb-font-bold"
560
+ },
561
+ {
562
+ label: "Heading 3",
563
+ element: "h3",
564
+ level: 3,
565
+ className: "sb-m-0 sb-grow sb-text-lg sb-font-semibold"
566
+ },
567
+ {
568
+ label: "Heading 4",
569
+ element: "h4",
570
+ level: 4,
571
+ className: "sb-m-0 sb-grow sb-text-base sb-font-semibold"
572
+ }
573
+ ];
574
+ var ElementTool = ({ editor }) => {
575
+ const isActive = editor.isActive("heading");
576
+ const handleFormatChange = React25__namespace.useCallback(
577
+ (level) => {
578
+ if (level) {
579
+ editor.chain().focus().toggleHeading({ level }).run();
580
+ } else {
581
+ editor.chain().focus().setParagraph().run();
582
+ }
583
+ },
584
+ [editor]
585
+ );
586
+ return /* @__PURE__ */ React25__namespace.createElement(DropdownMenu, null, /* @__PURE__ */ React25__namespace.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
587
+ ToolbarButton,
588
+ {
589
+ className: "sb-w-12 data-[state=open]:sb-bg-accent",
590
+ pressed: isActive
591
+ },
592
+ /* @__PURE__ */ React25__namespace.createElement(lu.LuHeading, { className: "sb-size-5" }),
593
+ /* @__PURE__ */ React25__namespace.createElement(lu.LuChevronDown, { className: "sb-size-5" })
594
+ )), /* @__PURE__ */ React25__namespace.createElement(DropdownMenuContent, { align: "start" }, formatActions.map(({ element: Element, ...action }) => /* @__PURE__ */ React25__namespace.createElement(
595
+ DropdownMenuItem,
596
+ {
597
+ key: action.label,
598
+ className: chunk5VQCJART_js.cn({
599
+ "sb-bg-accent": action.level ? editor.isActive("heading", { level: action.level }) : editor.isActive("paragraph")
600
+ }),
601
+ onClick: () => handleFormatChange(action.level)
602
+ },
603
+ /* @__PURE__ */ React25__namespace.createElement(Element, { className: action.className }, action.label)
604
+ ))));
605
+ };
606
+ var actions = [
607
+ {
608
+ value: "bold",
609
+ label: "Bold",
610
+ icon: lu.LuBold,
611
+ action: (editor) => editor.chain().focus().toggleBold().run(),
612
+ isActive: (editor) => editor.isActive("bold"),
613
+ canExecute: (editor) => editor.can().chain().focus().toggleBold().run() && !editor.isActive("codeBlock")
614
+ },
615
+ {
616
+ value: "italic",
617
+ label: "Italic",
618
+ icon: lu.LuItalic,
619
+ action: (editor) => editor.chain().focus().toggleItalic().run(),
620
+ isActive: (editor) => editor.isActive("italic"),
621
+ canExecute: (editor) => editor.can().chain().focus().toggleItalic().run() && !editor.isActive("codeBlock")
622
+ },
623
+ {
624
+ value: "underline",
625
+ label: "Underline",
626
+ icon: lu.LuUnderline,
627
+ action: (editor) => editor.chain().focus().toggleUnderline().run(),
628
+ isActive: (editor) => editor.isActive("underline"),
629
+ canExecute: (editor) => editor.can().chain().focus().toggleUnderline().run() && !editor.isActive("codeBlock")
630
+ },
631
+ {
632
+ value: "strikethrough",
633
+ label: "Strikethrough",
634
+ icon: lu.LuStrikethrough,
635
+ action: (editor) => editor.chain().focus().toggleStrike().run(),
636
+ isActive: (editor) => editor.isActive("strike"),
637
+ canExecute: (editor) => editor.can().chain().focus().toggleStrike().run() && !editor.isActive("codeBlock")
638
+ },
639
+ {
640
+ value: "code",
641
+ label: "Code",
642
+ icon: lu.LuCode,
643
+ action: (editor) => editor.chain().focus().toggleCode().run(),
644
+ isActive: (editor) => editor.isActive("code"),
645
+ canExecute: (editor) => editor.can().chain().focus().toggleCode().run() && !editor.isActive("codeBlock")
646
+ },
647
+ {
648
+ value: "clearFormatting",
649
+ label: "Clear formatting",
650
+ icon: lu.LuRemoveFormatting,
651
+ action: (editor) => editor.chain().focus().unsetAllMarks().run(),
652
+ isActive: () => false,
653
+ canExecute: (editor) => editor.can().chain().focus().unsetAllMarks().run() && !editor.isActive("codeBlock")
654
+ }
655
+ ];
656
+ var FormatTool = ({ editor }) => {
657
+ return /* @__PURE__ */ React25__namespace.createElement(ToolbarSection, { editor, actions, mainActionCount: 1 });
658
+ };
659
+ var actions2 = [
660
+ {
661
+ value: "codeBlock",
662
+ label: "Code block",
663
+ icon: lu.LuCode,
664
+ action: (editor) => editor.chain().focus().toggleCodeBlock().run(),
665
+ isActive: (editor) => editor.isActive("codeBlock"),
666
+ canExecute: (editor) => editor.can().chain().focus().toggleCodeBlock().run()
667
+ },
668
+ {
669
+ value: "blockquote",
670
+ label: "Blockquote",
671
+ icon: lu.LuQuote,
672
+ action: (editor) => editor.chain().focus().toggleBlockquote().run(),
673
+ isActive: (editor) => editor.isActive("blockquote"),
674
+ canExecute: (editor) => editor.can().chain().focus().toggleBlockquote().run()
675
+ },
676
+ {
677
+ value: "horizontalRule",
678
+ label: "Divider",
679
+ icon: lu.LuMinus,
680
+ action: (editor) => editor.chain().focus().setHorizontalRule().run(),
681
+ isActive: () => false,
682
+ canExecute: (editor) => editor.can().chain().focus().setHorizontalRule().run()
683
+ }
684
+ ];
685
+ var InsertTool = ({ editor }) => {
686
+ return /* @__PURE__ */ React25__namespace.createElement(ToolbarSection, { editor, actions: actions2, mainActionCount: 0 });
687
+ };
688
+ var Dialog = DialogPrimitive__namespace.Root;
689
+ var DialogTrigger = DialogPrimitive__namespace.Trigger;
690
+ var DialogPortal = DialogPrimitive__namespace.Portal;
691
+ var DialogOverlay = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
692
+ DialogPrimitive__namespace.Overlay,
693
+ {
694
+ ref,
695
+ className: chunk5VQCJART_js.cn(
696
+ "sb-fixed sb-inset-0 sb-z-50 sb-bg-black/80 sb- data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0",
697
+ className
698
+ ),
699
+ ...props
700
+ }
701
+ ));
702
+ DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
703
+ var DialogContent = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(DialogPortal, null, /* @__PURE__ */ React25__namespace.createElement(DialogOverlay, null), /* @__PURE__ */ React25__namespace.createElement(
704
+ DialogPrimitive__namespace.Content,
705
+ {
706
+ ref,
707
+ className: chunk5VQCJART_js.cn(
708
+ "sb-fixed sb-left-[50%] sb-top-[50%] sb-z-50 sb-grid sb-w-full sb-max-w-lg sb-translate-x-[-50%] sb-translate-y-[-50%] sb-gap-4 sb-border sb-bg-background sb-p-6 sb-shadow-lg sb-duration-200 data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[state=closed]:sb-slide-out-to-left-1/2 data-[state=closed]:sb-slide-out-to-top-[48%] data-[state=open]:sb-slide-in-from-left-1/2 data-[state=open]:sb-slide-in-from-top-[48%] sm:sb-rounded-lg",
709
+ className
710
+ ),
711
+ ...props
712
+ },
713
+ children,
714
+ /* @__PURE__ */ React25__namespace.createElement(DialogPrimitive__namespace.Close, { className: "sb-absolute sb-right-4 sb-top-4 sb-rounded-sm sb-opacity-70 sb-ring-offset-background sb-transition-opacity hover:sb-opacity-100 focus:sb-outline-none focus:sb-ring-2 focus:sb-ring-ring focus:sb-ring-offset-2 disabled:sb-pointer-events-none data-[state=open]:sb-bg-accent data-[state=open]:sb-text-muted-foreground" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.X, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-sr-only" }, "Close"))
715
+ )));
716
+ DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
717
+ var DialogHeader = ({
718
+ className,
719
+ ...props
720
+ }) => /* @__PURE__ */ React25__namespace.createElement(
721
+ "div",
722
+ {
723
+ className: chunk5VQCJART_js.cn(
724
+ "sb-flex sb-flex-col sb-space-y-1.5 sb-text-center sm:sb-text-left",
725
+ className
726
+ ),
727
+ ...props
728
+ }
729
+ );
730
+ DialogHeader.displayName = "DialogHeader";
731
+ var DialogTitle = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
732
+ DialogPrimitive__namespace.Title,
733
+ {
734
+ ref,
735
+ className: chunk5VQCJART_js.cn(
736
+ "sb-text-lg sb-font-semibold sb-leading-none sb-tracking-tight",
737
+ className
738
+ ),
739
+ ...props
740
+ }
741
+ ));
742
+ DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
743
+ var DialogDescription = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
744
+ DialogPrimitive__namespace.Description,
745
+ {
746
+ ref,
747
+ className: chunk5VQCJART_js.cn("sb-text-sm sb-text-muted-foreground", className),
748
+ ...props
749
+ }
750
+ ));
751
+ DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
752
+ var labelVariants = classVarianceAuthority.cva(
753
+ "sb-text-sm sb-font-medium sb-leading-none peer-disabled:sb-cursor-not-allowed peer-disabled:sb-opacity-70"
754
+ );
755
+ var Label2 = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
756
+ LabelPrimitive__namespace.Root,
757
+ {
758
+ ref,
759
+ className: chunk5VQCJART_js.cn(labelVariants(), className),
760
+ ...props
761
+ }
762
+ ));
763
+ Label2.displayName = LabelPrimitive__namespace.Root.displayName;
764
+
765
+ // src/components/ui/form.tsx
766
+ var Form = reactHookForm.FormProvider;
767
+ var FormFieldContext = React25__namespace.createContext(
768
+ {}
769
+ );
770
+ var FormField = ({
771
+ ...props
772
+ }) => {
773
+ return /* @__PURE__ */ React25__namespace.createElement(FormFieldContext.Provider, { value: { name: props.name } }, /* @__PURE__ */ React25__namespace.createElement(reactHookForm.Controller, { ...props }));
774
+ };
775
+ var useFormField = () => {
776
+ const fieldContext = React25__namespace.useContext(FormFieldContext);
777
+ const itemContext = React25__namespace.useContext(FormItemContext);
778
+ const { getFieldState, formState } = reactHookForm.useFormContext();
779
+ const fieldState = getFieldState(fieldContext.name, formState);
780
+ if (!fieldContext) {
781
+ throw new Error("useFormField should be used within <FormField>");
782
+ }
783
+ const { id } = itemContext;
784
+ return {
785
+ id,
786
+ name: fieldContext.name,
787
+ formItemId: `${id}-form-item`,
788
+ formDescriptionId: `${id}-form-item-description`,
789
+ formMessageId: `${id}-form-item-message`,
790
+ ...fieldState
791
+ };
792
+ };
793
+ var FormItemContext = React25__namespace.createContext(
794
+ {}
795
+ );
796
+ var FormItem = React25__namespace.forwardRef(({ className, ...props }, ref) => {
797
+ const id = React25__namespace.useId();
798
+ return /* @__PURE__ */ React25__namespace.createElement(FormItemContext.Provider, { value: { id } }, /* @__PURE__ */ React25__namespace.createElement("div", { ref, className: chunk5VQCJART_js.cn("sb-space-y-2", className), ...props }));
799
+ });
800
+ FormItem.displayName = "FormItem";
801
+ var FormLabel = React25__namespace.forwardRef(({ className, ...props }, ref) => {
802
+ const { error, formItemId } = useFormField();
803
+ return /* @__PURE__ */ React25__namespace.createElement(
804
+ Label2,
805
+ {
806
+ ref,
807
+ className: chunk5VQCJART_js.cn(error && "sb-text-destructive", className),
808
+ htmlFor: formItemId,
809
+ ...props
810
+ }
811
+ );
812
+ });
813
+ FormLabel.displayName = "FormLabel";
814
+ var FormControl = React25__namespace.forwardRef(({ ...props }, ref) => {
815
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
816
+ return /* @__PURE__ */ React25__namespace.createElement(
817
+ reactSlot.Slot,
818
+ {
819
+ ref,
820
+ id: formItemId,
821
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
822
+ "aria-invalid": !!error,
823
+ ...props
824
+ }
825
+ );
826
+ });
827
+ FormControl.displayName = "FormControl";
828
+ var FormDescription = React25__namespace.forwardRef(({ className, ...props }, ref) => {
829
+ const { formDescriptionId } = useFormField();
830
+ return /* @__PURE__ */ React25__namespace.createElement(
831
+ "p",
832
+ {
833
+ ref,
834
+ id: formDescriptionId,
835
+ className: chunk5VQCJART_js.cn("sb-text-[0.8rem] sb-text-muted-foreground", className),
836
+ ...props
837
+ }
838
+ );
839
+ });
840
+ FormDescription.displayName = "FormDescription";
841
+ var FormMessage = React25__namespace.forwardRef(({ className, children, ...props }, ref) => {
842
+ const { error, formMessageId } = useFormField();
843
+ const body = error ? String(error?.message ?? "") : children;
844
+ if (!body) {
845
+ return null;
846
+ }
847
+ return /* @__PURE__ */ React25__namespace.createElement(
848
+ "p",
849
+ {
850
+ ref,
851
+ id: formMessageId,
852
+ className: chunk5VQCJART_js.cn("sb-text-[0.8rem] sb-font-medium sb-text-destructive", className),
853
+ ...props
854
+ },
855
+ body
856
+ );
857
+ });
858
+ FormMessage.displayName = "FormMessage";
859
+ var Input = React25__namespace.forwardRef(
860
+ ({ className, type, ...props }, ref) => {
861
+ return /* @__PURE__ */ React25__namespace.createElement(
862
+ "input",
863
+ {
864
+ type,
865
+ className: chunk5VQCJART_js.cn(
866
+ "sb-flex sb-h-9 sb-w-full sb-rounded-md sb-border sb-border-input sb-bg-transparent sb-px-3 sb-py-1 sb-text-base sb-shadow-sm sb-transition-colors file:sb-border-0 file:sb-bg-transparent file:sb-text-sm file:sb-font-medium file:sb-text-foreground placeholder:sb-text-muted-foreground focus-visible:sb-outline-none focus-visible:sb-ring-1 focus-visible:sb-ring-ring disabled:sb-cursor-not-allowed disabled:sb-opacity-50 md:sb-text-sm",
867
+ className
868
+ ),
869
+ ref,
870
+ ...props
871
+ }
872
+ );
873
+ }
874
+ );
875
+ Input.displayName = "Input";
876
+ var AdvancedInput = React25__namespace.forwardRef(
877
+ ({ prepend, append, ...props }, ref) => {
878
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-relative" }, /* @__PURE__ */ React25__namespace.createElement(Input, { ref, className: "sb-pl-9 sb-pr-7 sb-text-right", ...props }), prepend && /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-absolute sb-font-roboto sb-top-1/2 sb-left-3 sb--translate-y-1/2" }, prepend), append && /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-absolute sb-font-roboto sb-top-1/2 sb-right-3 sb--translate-y-1/2" }, append));
879
+ }
880
+ );
881
+ AdvancedInput.displayName = "AdvancedInput";
882
+ var Switch = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
883
+ SwitchPrimitives__namespace.Root,
884
+ {
885
+ className: chunk5VQCJART_js.cn(
886
+ "sb-peer sb-inline-flex sb-h-5 sb-w-9 sb-shrink-0 sb-cursor-pointer sb-items-center sb-rounded-full sb-border-2 sb-border-transparent sb-shadow-sm sb-transition-colors focus-visible:sb-outline-none focus-visible:sb-ring-2 focus-visible:sb-ring-ring focus-visible:sb-ring-offset-2 focus-visible:sb-ring-offset-background disabled:sb-cursor-not-allowed disabled:sb-opacity-50 data-[state=checked]:sb-bg-primary data-[state=unchecked]:sb-bg-input",
887
+ className
888
+ ),
889
+ ...props,
890
+ ref
891
+ },
892
+ /* @__PURE__ */ React25__namespace.createElement(
893
+ SwitchPrimitives__namespace.Thumb,
894
+ {
895
+ className: chunk5VQCJART_js.cn(
896
+ "sb-pointer-events-none sb-block sb-h-4 sb-w-4 sb-rounded-full sb-bg-background sb-shadow-lg sb-ring-0 sb-transition-transform data-[state=checked]:sb-translate-x-4 data-[state=unchecked]:sb-translate-x-0"
897
+ )
898
+ }
899
+ )
900
+ ));
901
+ Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
902
+ var LinkTool = ({ editor }) => {
903
+ const [open, setOpen] = React25__namespace.useState(false);
904
+ const { from, to } = editor.state.selection;
905
+ const text = editor.state.doc.textBetween(from, to, " ");
906
+ const handleSetLink = React25__namespace.useCallback(
907
+ (url, text2, openInNewTab) => {
908
+ editor.chain().focus().extendMarkRange("link").insertContent({
909
+ type: "text",
910
+ text: text2 || url,
911
+ marks: [
912
+ {
913
+ type: "link",
914
+ attrs: {
915
+ href: url,
916
+ target: openInNewTab ? "_blank" : ""
917
+ }
918
+ }
919
+ ]
920
+ }).setLink({ href: url }).run();
921
+ editor.commands.enter();
922
+ setOpen(false);
923
+ },
924
+ [editor]
925
+ );
926
+ return /* @__PURE__ */ React25__namespace.createElement(Dialog, { open, onOpenChange: setOpen }, /* @__PURE__ */ React25__namespace.createElement(DialogTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
927
+ ToolbarButton,
928
+ {
929
+ pressed: editor.isActive("link"),
930
+ disabled: editor.isActive("codeBlock")
931
+ },
932
+ /* @__PURE__ */ React25__namespace.createElement(lu.LuLink2, { className: "sb-size-5" })
933
+ )), /* @__PURE__ */ React25__namespace.createElement(DialogContent, { className: "sb-w-full sb-min-w-80" }, /* @__PURE__ */ React25__namespace.createElement(LinkForm, { onSave: handleSetLink, defaultText: text })));
934
+ };
935
+ var schema = zod.z.object({
936
+ url: zod.z.string().min(0),
937
+ text: zod.z.string().optional(),
938
+ isNewTab: zod.z.boolean().optional()
939
+ });
940
+ var LinkForm = ({
941
+ onSave,
942
+ defaultIsNewTab,
943
+ defaultUrl,
944
+ defaultText
945
+ }) => {
946
+ const form = reactHookForm.useForm({
947
+ resolver: zod$1.zodResolver(schema),
948
+ defaultValues: {
949
+ url: defaultUrl || "",
950
+ text: defaultText || "",
951
+ isNewTab: defaultIsNewTab || false
952
+ }
953
+ });
954
+ const handleSubmit = (values) => {
955
+ onSave(values.url, values.text, values.isNewTab);
956
+ };
957
+ return /* @__PURE__ */ React25__namespace.createElement(Form, { ...form }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-6" }, /* @__PURE__ */ React25__namespace.createElement(
958
+ FormField,
959
+ {
960
+ control: form.control,
961
+ name: "url",
962
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "URL"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(Input, { type: "url", ...field, autoFocus: true })), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
963
+ }
964
+ ), /* @__PURE__ */ React25__namespace.createElement(
965
+ FormField,
966
+ {
967
+ control: form.control,
968
+ name: "text",
969
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Text"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(Input, { ...field })), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
970
+ }
971
+ ), /* @__PURE__ */ React25__namespace.createElement(
972
+ FormField,
973
+ {
974
+ control: form.control,
975
+ name: "isNewTab",
976
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-items-center sb-space-x-2" }, /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
977
+ Switch,
978
+ {
979
+ checked: field.value,
980
+ onCheckedChange: field.onChange
981
+ }
982
+ )), /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Open in new tab")), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
983
+ }
984
+ ), /* @__PURE__ */ React25__namespace.createElement(chunkIVF3GTYS_js.Button, { type: "button", onClick: form.handleSubmit(handleSubmit) }, "Save")));
985
+ };
986
+ var actions3 = [
987
+ {
988
+ value: "orderedList",
989
+ label: "Numbered list",
990
+ icon: lu.LuListOrdered,
991
+ action: (editor) => editor.chain().focus().toggleOrderedList().run(),
992
+ isActive: (editor) => editor.isActive("orderedList"),
993
+ canExecute: (editor) => editor.can().chain().focus().toggleOrderedList().run()
994
+ },
995
+ {
996
+ value: "bulletList",
997
+ label: "Bullet list",
998
+ icon: lu.LuList,
999
+ action: (editor) => editor.chain().focus().toggleBulletList().run(),
1000
+ isActive: (editor) => editor.isActive("bulletList"),
1001
+ canExecute: (editor) => editor.can().chain().focus().toggleBulletList().run()
1002
+ }
1003
+ ];
1004
+ var ListTool = ({ editor }) => {
1005
+ return /* @__PURE__ */ React25__namespace.createElement(ToolbarSection, { editor, actions: actions3, mainActionCount: 2 });
1006
+ };
1007
+
1008
+ // src/features/rich-text-editor/components/toolbar.tsx
1009
+ var Toolbar = ({ editor }) => {
1010
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-shrink-0 sb-overflow-x-auto sb-border-b sb-border-border sb-p-2" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-w-max sb-items-center sb-gap-px" }, /* @__PURE__ */ React25__namespace.createElement(ElementTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(Separator2, { orientation: "vertical", className: "sb-mx-2 sb-h-7" }), /* @__PURE__ */ React25__namespace.createElement(FormatTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(Separator2, { orientation: "vertical", className: "sb-mx-2 sb-h-7" }), /* @__PURE__ */ React25__namespace.createElement(ColorTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(Separator2, { orientation: "vertical", className: "sb-mx-2 sb-h-7" }), /* @__PURE__ */ React25__namespace.createElement(ListTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(Separator2, { orientation: "vertical", className: "sb-mx-2 sb-h-7" }), /* @__PURE__ */ React25__namespace.createElement(LinkTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(InsertTool, { editor })));
1011
+ };
1012
+ var ToolbarSection = ({
1013
+ editor,
1014
+ actions: actions4,
1015
+ mainActionCount = 0
1016
+ }) => {
1017
+ const { mainActions, dropdownActions } = React25__namespace.useMemo(() => {
1018
+ return {
1019
+ mainActions: actions4.slice(0, mainActionCount),
1020
+ dropdownActions: actions4.slice(mainActionCount)
1021
+ };
1022
+ }, [actions4, mainActionCount]);
1023
+ const isDropdownActive = React25__namespace.useMemo(() => {
1024
+ return dropdownActions.some((action) => action.isActive(editor));
1025
+ }, [dropdownActions, editor]);
1026
+ return /* @__PURE__ */ React25__namespace.createElement(React25__namespace.Fragment, null, mainActions.map((action) => /* @__PURE__ */ React25__namespace.createElement(
1027
+ ToolbarButton,
1028
+ {
1029
+ key: action.label,
1030
+ onClick: () => action.action(editor),
1031
+ disabled: !action.canExecute(editor),
1032
+ pressed: action.isActive(editor)
1033
+ },
1034
+ /* @__PURE__ */ React25__namespace.createElement(action.icon, { className: "sb-size-5" })
1035
+ )), dropdownActions.length > 0 && /* @__PURE__ */ React25__namespace.createElement(DropdownMenu, null, /* @__PURE__ */ React25__namespace.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(ToolbarButton, { pressed: isDropdownActive }, /* @__PURE__ */ React25__namespace.createElement(lu.LuEllipsis, { className: "sb-size-5" }))), /* @__PURE__ */ React25__namespace.createElement(DropdownMenuContent, { align: "start" }, dropdownActions.map((action) => /* @__PURE__ */ React25__namespace.createElement(
1036
+ DropdownMenuItem,
1037
+ {
1038
+ key: action.label,
1039
+ className: chunk5VQCJART_js.cn("sb-flex sb-flex-row sb-items-center sb-gap-2", {
1040
+ "sb-bg-accent": action.isActive(editor)
1041
+ }),
1042
+ onClick: () => action.action(editor),
1043
+ disabled: !action.canExecute(editor)
1044
+ },
1045
+ /* @__PURE__ */ React25__namespace.createElement(action.icon, { className: "sb-size-4" }),
1046
+ /* @__PURE__ */ React25__namespace.createElement("span", null, action.label)
1047
+ )))));
1048
+ };
1049
+ var ToolbarButton = React25__namespace.forwardRef(({ className, ...props }, ref) => {
1050
+ return /* @__PURE__ */ React25__namespace.createElement(
1051
+ Toggle,
1052
+ {
1053
+ size: "sm",
1054
+ className: chunk5VQCJART_js.cn(
1055
+ "sb-size-8 sb-p-0 data-[state=on]:sb-bg-accent",
1056
+ { "sb-bg-accent": props.pressed },
1057
+ className
1058
+ ),
1059
+ ref,
1060
+ ...props
1061
+ }
1062
+ );
1063
+ });
1064
+ ToolbarButton.displayName = "ToolbarButton";
1065
+
1066
+ // src/features/rich-text-editor/components/rich-text-editor.tsx
1067
+ var RichTextEditor = ({
1068
+ value,
1069
+ onChange,
1070
+ className,
1071
+ editorClassName,
1072
+ editorContentClassName,
1073
+ ...props
1074
+ }) => {
1075
+ const editor = useRichTextEditor({
1076
+ value,
1077
+ onUpdate: onChange,
1078
+ editorClassName: chunk5VQCJART_js.cn("sb-flex-1 sb-px-3 sb-py-1", editorClassName),
1079
+ ...props
1080
+ });
1081
+ if (!editor) {
1082
+ return null;
1083
+ }
1084
+ return /* @__PURE__ */ React25__namespace.createElement(
1085
+ "div",
1086
+ {
1087
+ className: chunk5VQCJART_js.cn(
1088
+ "sb-flex sb-h-auto sb-min-h-72 sb-w-full sb-flex-col sb-rounded-md sb-border sb-border-input sb-shadow-sm focus-within:sb-border-primary",
1089
+ className
1090
+ )
1091
+ },
1092
+ /* @__PURE__ */ React25__namespace.createElement(Toolbar, { editor }),
1093
+ /* @__PURE__ */ React25__namespace.createElement(
1094
+ react.EditorContent,
1095
+ {
1096
+ editor,
1097
+ className: chunk5VQCJART_js.cn(
1098
+ "sb-editflow prose sb-flex sb-flex-1",
1099
+ editorContentClassName
1100
+ )
1101
+ }
1102
+ )
1103
+ );
1104
+ };
1105
+ function Calendar({
1106
+ className,
1107
+ classNames,
1108
+ showOutsideDays = true,
1109
+ ...props
1110
+ }) {
1111
+ return /* @__PURE__ */ React25__namespace.createElement(
1112
+ reactDayPicker.DayPicker,
1113
+ {
1114
+ showOutsideDays,
1115
+ className: chunk5VQCJART_js.cn("sb-p-3 sb-font-roboto", className),
1116
+ classNames: {
1117
+ months: "sb-flex sb-flex-col sm:sb-flex-row sb-space-y-4 sm:sb-space-x-4 sm:sb-space-y-0",
1118
+ month: "sb-space-y-4",
1119
+ caption: "sb-flex sb-justify-center sb-pt-1 sb-relative sb-items-center",
1120
+ caption_label: "sb-text-sm sb-font-medium",
1121
+ nav: "sb-space-x-1 sb-flex sb-items-center",
1122
+ nav_button: chunk5VQCJART_js.cn(
1123
+ chunkIVF3GTYS_js.buttonVariants({ variant: "outline" }),
1124
+ "sb-h-7 sb-w-7 sb-bg-transparent sb-p-0 sb-opacity-50 hover:sb-opacity-100"
1125
+ ),
1126
+ nav_button_previous: "sb-absolute sb-left-1",
1127
+ nav_button_next: "sb-absolute sb-right-1",
1128
+ table: "sb-w-full sb-border-collapse sb-space-y-1",
1129
+ head_row: "sb-flex",
1130
+ head_cell: "sb-text-muted-foreground sb-rounded-md sb-w-8 sb-font-normal sb-text-[0.8rem]",
1131
+ row: "sb-flex sb-w-full sb-mt-2",
1132
+ cell: chunk5VQCJART_js.cn(
1133
+ "sb-relative sb-p-0 sb-text-center sb-text-sm focus-within:sb-relative focus-within:sb-z-20 [&:has([aria-selected])]:sb-bg-accent [&:has([aria-selected].day-outside)]:sb-bg-accent/50 [&:has([aria-selected].day-range-end)]:sb-rounded-r-md",
1134
+ props.mode === "range" ? "[&:has(>.day-range-end)]:sb-rounded-r-md [&:has(>.day-range-start)]:sb-rounded-l-md first:[&:has([aria-selected])]:sb-rounded-l-md last:[&:has([aria-selected])]:sb-rounded-r-md" : "[&:has([aria-selected])]:sb-rounded-md"
1135
+ ),
1136
+ day: chunk5VQCJART_js.cn(
1137
+ chunkIVF3GTYS_js.buttonVariants({ variant: "ghost" }),
1138
+ "sb-h-8 sb-w-8 sb-p-0 sb-font-normal aria-selected:sb-opacity-100"
1139
+ ),
1140
+ day_range_start: "day-range-start",
1141
+ day_range_end: "day-range-end",
1142
+ day_selected: "sb-bg-primary sb-text-primary-foreground hover:sb-bg-primary hover:sb-text-primary-foreground focus:sb-bg-primary focus:sb-text-primary-foreground",
1143
+ day_today: "sb-bg-accent sb-text-accent-foreground",
1144
+ day_outside: "day-outside sb-text-muted-foreground sb-opacity-50 aria-selected:sb-bg-accent/50 aria-selected:sb-text-muted-foreground aria-selected:sb-opacity-30",
1145
+ day_disabled: "sb-text-muted-foreground sb-opacity-50",
1146
+ day_range_middle: "aria-selected:sb-bg-accent aria-selected:sb-text-accent-foreground",
1147
+ day_hidden: "invisible",
1148
+ ...classNames
1149
+ },
1150
+ components: {
1151
+ IconLeft: () => /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronLeftIcon, { className: "sb-h-4 sb-w-4" }),
1152
+ IconRight: () => /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronRightIcon, { className: "sb-h-4 sb-w-4" })
1153
+ },
1154
+ ...props
1155
+ }
1156
+ );
1157
+ }
1158
+ Calendar.displayName = "Calendar";
1159
+ var ColorPicker = (props) => {
1160
+ const { color, onColorChange, className } = props;
1161
+ const colors = props.colors ?? [
1162
+ "#000000",
1163
+ "#ffffff",
1164
+ "#0f172a",
1165
+ "#F1F5F9",
1166
+ "#64748B",
1167
+ "#E6007E",
1168
+ "#F8FAFC",
1169
+ "#009DD1",
1170
+ "#FF0000"
1171
+ ];
1172
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, null, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
1173
+ chunkIVF3GTYS_js.Button,
1174
+ {
1175
+ variant: "outline",
1176
+ size: "sm",
1177
+ className: chunk5VQCJART_js.cn(
1178
+ "sb-justify-start sb-text-left sb-font-normal sb-normal-case sb-w-full",
1179
+ !color && "sb-text-muted-foreground",
1180
+ className
1181
+ )
1182
+ },
1183
+ /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-w-full sb-flex sb-items-center sb-gap-2" }, color ? /* @__PURE__ */ React25__namespace.createElement(
1184
+ "div",
1185
+ {
1186
+ className: "sb-h-4 sb-w-4 sb-rounded !sb-bg-center !sb-bg-cover sb-transition-all sb-border",
1187
+ style: { background: color }
1188
+ }
1189
+ ) : /* @__PURE__ */ React25__namespace.createElement(lucideReact.PaintbrushIcon, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-truncate sb-flex-1" }, color ? color : "Kies een kleur"))
1190
+ )), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { className: "sb-w-64 sb-p-4 sb-flex sb-flex-wrap sb-gap-1" }, colors.map((s) => /* @__PURE__ */ React25__namespace.createElement(
1191
+ "div",
1192
+ {
1193
+ key: s,
1194
+ style: { background: s },
1195
+ className: "sb-rounded-md sb-h-6 sb-w-6 sb-cursor-pointer active:sb-scale-105 sb-border",
1196
+ onClick: () => onColorChange(s)
1197
+ }
1198
+ ))));
1199
+ };
1200
+ var MediaInput = (props) => {
1201
+ const { onFilesChange, limit = 32, multiple = false, onError } = props;
1202
+ const id = React25__namespace.useId();
1203
+ const [queue, setQueue] = React25__namespace.useState([]);
1204
+ const [sources, setSources] = React25__namespace.useState(props.files ?? []);
1205
+ const maxConcurrentUploads = 3;
1206
+ const uploadingCountRef = React25__namespace.useRef(0);
1207
+ const handleFilesAdd = async (e) => {
1208
+ const files = e.target.files;
1209
+ if (!files || files.length === 0) {
1210
+ return;
1211
+ }
1212
+ if (files.length + sources.length > (multiple ? limit : 1)) {
1213
+ onError?.(
1214
+ new MediaInputError(
1215
+ `Maximaal ${limit} bestanden.`,
1216
+ `Je probeerde nu ${files.length + sources.length} bestanden toe te voegen, maar je mag er maximaal ${limit} toevoegen.`
1217
+ )
1218
+ );
1219
+ return;
1220
+ }
1221
+ const queue2 = Array.from(files);
1222
+ setQueue(queue2);
1223
+ for (const file of queue2) {
1224
+ try {
1225
+ while (uploadingCountRef.current >= maxConcurrentUploads && uploadingCountRef.current > 0) {
1226
+ await new Promise((resolve) => setTimeout(resolve, 300));
1227
+ }
1228
+ uploadingCountRef.current++;
1229
+ const formData = new FormData();
1230
+ formData.append("file", file);
1231
+ const res = await fetch("/api/simple-builder/file/upload", {
1232
+ method: "POST",
1233
+ body: formData
1234
+ });
1235
+ if (res === void 0 || !res.ok) {
1236
+ onError?.(
1237
+ new MediaInputError(
1238
+ "Bestand uploaden misulukt",
1239
+ `Bestand ${file.name} kon niet worden ge\xFCpload.`
1240
+ )
1241
+ );
1242
+ continue;
1243
+ }
1244
+ const { data: url } = await res.json();
1245
+ if (!url) {
1246
+ onError?.(
1247
+ new MediaInputError(
1248
+ "Bestand uploaden misulukt",
1249
+ `De URL van bestand ${file.name} kon niet worden opgehaald.`
1250
+ )
1251
+ );
1252
+ continue;
1253
+ }
1254
+ setSources((prev) => [...prev, url]);
1255
+ onFilesChange?.([...sources, url]);
1256
+ } catch (e2) {
1257
+ onError?.(
1258
+ new MediaInputError(
1259
+ "Bestand uploaden misulukt",
1260
+ `Bestand ${file.name} kon niet worden ge\xFCpload.`
1261
+ )
1262
+ );
1263
+ } finally {
1264
+ setQueue((prev) => prev.filter((f) => f !== file));
1265
+ uploadingCountRef.current--;
1266
+ }
1267
+ }
1268
+ };
1269
+ const handleSourceDelete = async (src) => {
1270
+ setSources((prev) => prev.filter((s) => s !== src));
1271
+ onFilesChange?.(sources.filter((s) => s !== src));
1272
+ await fetch("/api/uploadthing/delete", {
1273
+ method: "POST",
1274
+ body: JSON.stringify({ src })
1275
+ });
1276
+ };
1277
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: chunk5VQCJART_js.cn("flex flex-wrap gap-4", props.className) }, sources.map((src) => /* @__PURE__ */ React25__namespace.createElement(MediaInputItem, { key: src, className: chunk5VQCJART_js.cn("group", props.itemClassName) }, /* @__PURE__ */ React25__namespace.createElement(
1278
+ chunk5VQCJART_js.Image,
1279
+ {
1280
+ src,
1281
+ alt: "",
1282
+ fill: true,
1283
+ className: "sb-absolute sb-inset-0 sb-object-cover sb-pointer-events-none"
1284
+ }
1285
+ ), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-absolute sb-right-1 sb-top-1 sb-z-30 sb-flex sb-items-center sb-justify-end sb-gap-3 sb-opacity-0 sb-transition-opacity group-hover:sb-opacity-100" }, /* @__PURE__ */ React25__namespace.createElement(
1286
+ "button",
1287
+ {
1288
+ className: "sb-flex sb-h-8 sb-w-8 sb-items-center sb-justify-center sb-rounded-full sb-border sb-bg-secondary sb-text-secondary-foreground sb-opacity-90 sb-shadow sb-transition-opacity hover:sb-opacity-100",
1289
+ onClick: () => handleSourceDelete(src)
1290
+ },
1291
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.Trash2Icon, { className: "sb-h-4 sb-w-4" })
1292
+ )))), queue.map((_, i) => /* @__PURE__ */ React25__namespace.createElement(
1293
+ MediaInputItem,
1294
+ {
1295
+ key: i,
1296
+ className: chunk5VQCJART_js.cn(
1297
+ "sb-flex sb-h-28 sb-w-28 sb-items-center sb-justify-center",
1298
+ props.itemClassName
1299
+ )
1300
+ },
1301
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.Loader2Icon, { className: "sb-h-6 sb-w-6 sb-animate-spin" })
1302
+ )), multiple || !multiple && !sources.length && !queue.length ? /* @__PURE__ */ React25__namespace.createElement(
1303
+ "label",
1304
+ {
1305
+ htmlFor: id,
1306
+ className: chunk5VQCJART_js.cn(
1307
+ "sb-flex sb-h-28 sb-w-28 sb-cursor-pointer sb-items-center sb-justify-center sb-rounded-lg sb-border",
1308
+ props.itemClassName
1309
+ )
1310
+ },
1311
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.PlusIcon, { className: "sb-h-6 sb-w-6" }),
1312
+ /* @__PURE__ */ React25__namespace.createElement(
1313
+ "input",
1314
+ {
1315
+ id,
1316
+ type: "file",
1317
+ onChange: handleFilesAdd,
1318
+ multiple,
1319
+ accept: ".png,.jpg,.jpeg,.webp,.gif,.svg",
1320
+ className: "sb-hidden"
1321
+ }
1322
+ )
1323
+ ) : null);
1324
+ };
1325
+ var MediaInputItem = (props) => {
1326
+ return /* @__PURE__ */ React25__namespace.createElement(
1327
+ "div",
1328
+ {
1329
+ className: chunk5VQCJART_js.cn(
1330
+ "sb-relative sb-h-28 sb-w-28 sb-overflow-hidden sb-rounded-lg sb-border",
1331
+ props.className
1332
+ )
1333
+ },
1334
+ props.children
1335
+ );
1336
+ };
1337
+ var MediaInputError = class extends Error {
1338
+ title;
1339
+ description;
1340
+ constructor(message, description) {
1341
+ super(message);
1342
+ this.title = message;
1343
+ this.description = description;
1344
+ }
1345
+ };
1346
+ var Select = SelectPrimitive__namespace.Root;
1347
+ var SelectValue = SelectPrimitive__namespace.Value;
1348
+ var SelectTrigger = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1349
+ SelectPrimitive__namespace.Trigger,
1350
+ {
1351
+ ref,
1352
+ className: chunk5VQCJART_js.cn(
1353
+ "sb-flex sb-h-10 sb-w-full sb-items-center sb-justify-between sb-rounded-md sb-border sb-border-input sb-bg-background sb-px-3 sb-py-2 sb-text-sm sb-ring-offset-background placeholder:sb-text-muted-foreground focus:sb-outline-none focus:sb-ring-2 focus:sb-ring-ring focus:sb-ring-offset-2 disabled:sb-cursor-not-allowed disabled:sb-opacity-50 [&>span]:sb-line-clamp-1",
1354
+ className
1355
+ ),
1356
+ ...props
1357
+ },
1358
+ children,
1359
+ /* @__PURE__ */ React25__namespace.createElement(SelectPrimitive__namespace.Icon, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronDown, { className: "sb-h-4 sb-w-4 sb-opacity-50" }))
1360
+ ));
1361
+ SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
1362
+ var SelectScrollUpButton = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1363
+ SelectPrimitive__namespace.ScrollUpButton,
1364
+ {
1365
+ ref,
1366
+ className: chunk5VQCJART_js.cn(
1367
+ "sb-flex sb-cursor-default sb-items-center sb-justify-center sb-py-1",
1368
+ className
1369
+ ),
1370
+ ...props
1371
+ },
1372
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronUp, { className: "sb-h-4 sb-w-4" })
1373
+ ));
1374
+ SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
1375
+ var SelectScrollDownButton = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1376
+ SelectPrimitive__namespace.ScrollDownButton,
1377
+ {
1378
+ ref,
1379
+ className: chunk5VQCJART_js.cn(
1380
+ "sb-flex sb-cursor-default sb-items-center sb-justify-center sb-py-1",
1381
+ className
1382
+ ),
1383
+ ...props
1384
+ },
1385
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronDown, { className: "sb-h-4 sb-w-4" })
1386
+ ));
1387
+ SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
1388
+ var SelectContent = React25__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(SelectPrimitive__namespace.Portal, null, /* @__PURE__ */ React25__namespace.createElement(
1389
+ SelectPrimitive__namespace.Content,
1390
+ {
1391
+ ref,
1392
+ className: chunk5VQCJART_js.cn(
1393
+ "sb-relative sb-z-50 sb-max-h-96 sb-min-w-[8rem] sb-overflow-hidden sb-rounded-md sb-border sb-bg-popover sb-text-popover-foreground sb-shadow-md data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[side=bottom]:sb-slide-in-from-top-2 data-[side=left]:sb-slide-in-from-right-2 data-[side=right]:sb-slide-in-from-left-2 data-[side=top]:sb-slide-in-from-bottom-2",
1394
+ position === "popper" && "data-[side=bottom]:sb-translate-y-1 data-[side=left]:sb--translate-x-1 data-[side=right]:sb-translate-x-1 data-[side=top]:sb--translate-y-1",
1395
+ className
1396
+ ),
1397
+ position,
1398
+ ...props
1399
+ },
1400
+ /* @__PURE__ */ React25__namespace.createElement(SelectScrollUpButton, null),
1401
+ /* @__PURE__ */ React25__namespace.createElement(
1402
+ SelectPrimitive__namespace.Viewport,
1403
+ {
1404
+ className: chunk5VQCJART_js.cn(
1405
+ "sb-p-1",
1406
+ position === "popper" && "sb-h-[var(--radix-select-trigger-height)] sb-w-full sb-min-w-[var(--radix-select-trigger-width)]"
1407
+ )
1408
+ },
1409
+ children
1410
+ ),
1411
+ /* @__PURE__ */ React25__namespace.createElement(SelectScrollDownButton, null)
1412
+ )));
1413
+ SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
1414
+ var SelectLabel = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1415
+ SelectPrimitive__namespace.Label,
1416
+ {
1417
+ ref,
1418
+ className: chunk5VQCJART_js.cn(
1419
+ "sb-py-1.5 sb-pl-8 sb-pr-2 sb-text-sm sb-font-semibold",
1420
+ className
1421
+ ),
1422
+ ...props
1423
+ }
1424
+ ));
1425
+ SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
1426
+ var SelectItem = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1427
+ SelectPrimitive__namespace.Item,
1428
+ {
1429
+ ref,
1430
+ className: chunk5VQCJART_js.cn(
1431
+ "sb-relative sb-flex sb-w-full sb-cursor-default sb-select-none sb-items-center sb-rounded-sm sb-py-1.5 sb-pl-8 sb-pr-2 sb-text-sm sb-outline-none focus:sb-bg-accent focus:sb-text-accent-foreground data-[disabled]:sb-pointer-events-none data-[disabled]:sb-opacity-50",
1432
+ className
1433
+ ),
1434
+ ...props
1435
+ },
1436
+ /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-absolute sb-left-2 sb-flex sb-h-3.5 sb-w-3.5 sb-items-center sb-justify-center" }, /* @__PURE__ */ React25__namespace.createElement(SelectPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React25__namespace.createElement(lucideReact.Check, { className: "sb-h-4 sb-w-4" }))),
1437
+ /* @__PURE__ */ React25__namespace.createElement(SelectPrimitive__namespace.ItemText, null, children)
1438
+ ));
1439
+ SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
1440
+ var SelectSeparator = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1441
+ SelectPrimitive__namespace.Separator,
1442
+ {
1443
+ ref,
1444
+ className: chunk5VQCJART_js.cn("sb--mx-1 sb-my-1 sb-h-px sb-bg-muted", className),
1445
+ ...props
1446
+ }
1447
+ ));
1448
+ SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
1449
+ var Textarea = React25__namespace.forwardRef(
1450
+ ({ className, ...props }, ref) => {
1451
+ return /* @__PURE__ */ React25__namespace.createElement(
1452
+ "textarea",
1453
+ {
1454
+ className: chunk5VQCJART_js.cn(
1455
+ "sb-flex sb-min-h-[60px] sb-font-roboto sb-w-full sb-rounded-md sb-border sb-border-input sb-bg-transparent sb-px-3 sb-py-2 sb-text-sm sb-shadow-sm placeholder:sb-text-muted-foreground focus-visible:sb-outline-none focus-visible:sb-ring-1 focus-visible:sb-ring-ring disabled:sb-cursor-not-allowed disabled:sb-opacity-50",
1456
+ className
1457
+ ),
1458
+ ref,
1459
+ ...props
1460
+ }
1461
+ );
1462
+ }
1463
+ );
1464
+ Textarea.displayName = "Textarea";
1465
+
1466
+ // src/components/container-item-form.tsx
1467
+ var ContainerItemForm = (props) => {
1468
+ const { item } = props;
1469
+ const { patchItem } = chunkIVF3GTYS_js.useBuilder();
1470
+ const component = chunk5VQCJART_js.builder.getComponent(item.component);
1471
+ if (!component) {
1472
+ throw new Error(
1473
+ `[simple-builder]: Component with id ${item.component} not found in container item form component`
1474
+ );
1475
+ }
1476
+ const form = reactHookForm.useForm({
1477
+ defaultValues: (component.inputs || []).reduce(
1478
+ (acc, input) => ({
1479
+ ...acc,
1480
+ [input.name]: item?.props?.[input.name] ?? input.defaultValue
1481
+ }),
1482
+ {}
1483
+ )
1484
+ });
1485
+ const onSubmit = (values) => {
1486
+ patchItem(item.id, {
1487
+ props: values
1488
+ });
1489
+ };
1490
+ React25__namespace.useEffect(() => {
1491
+ const subscription = form.watch(() => form.handleSubmit(onSubmit)());
1492
+ return () => subscription.unsubscribe();
1493
+ }, [form.watch, form.handleSubmit]);
1494
+ return /* @__PURE__ */ React25__namespace.createElement(Form, { ...form }, /* @__PURE__ */ React25__namespace.createElement("form", { onSubmit: form.handleSubmit(onSubmit) }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-4 sb-p-4" }, (component.inputs || []).map((input) => /* @__PURE__ */ React25__namespace.createElement(
1495
+ RenderFormField,
1496
+ {
1497
+ key: input.name,
1498
+ type: input.type,
1499
+ input,
1500
+ form
1501
+ }
1502
+ )))));
1503
+ };
1504
+ var RenderFormField = (props) => {
1505
+ const { type, input, form } = props;
1506
+ const fieldArray = reactHookForm.useFieldArray({
1507
+ control: form.control,
1508
+ name: input.name
1509
+ });
1510
+ if (input.multiple) {
1511
+ return /* @__PURE__ */ React25__namespace.createElement("fieldset", { className: "sb-space-y-2" }, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-4" }, fieldArray.fields.map(
1512
+ (field, i) => type !== "grouped" ? /* @__PURE__ */ React25__namespace.createElement(
1513
+ FormField,
1514
+ {
1515
+ key: field.id,
1516
+ control: form.control,
1517
+ name: `${input.name}.${i}`,
1518
+ render: ({ field: field2 }) => /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-items-center sb-gap-3" }, /* @__PURE__ */ React25__namespace.createElement(RenderInput, { field: field2, type: input.type }), /* @__PURE__ */ React25__namespace.createElement("button", { type: "button", onClick: () => fieldArray.remove(i) }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.XIcon, { className: "sb-h-4 sb-w-4" })))
1519
+ }
1520
+ ) : /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-items-center sb-relative" }, /* @__PURE__ */ React25__namespace.createElement(
1521
+ RenderFormField,
1522
+ {
1523
+ key: field.id,
1524
+ form,
1525
+ type,
1526
+ input: {
1527
+ ...input,
1528
+ name: `${input.name}.${i}`,
1529
+ multiple: false,
1530
+ friendlyName: ""
1531
+ }
1532
+ }
1533
+ ), /* @__PURE__ */ React25__namespace.createElement(
1534
+ "button",
1535
+ {
1536
+ type: "button",
1537
+ onClick: () => fieldArray.remove(i),
1538
+ className: "sb-absolute sb-top-2 sb-right-2 sb-text-foreground/70 hover:sb-text-foreground"
1539
+ },
1540
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.XIcon, { className: "sb-h-4 sb-w-4" })
1541
+ ))
1542
+ ), /* @__PURE__ */ React25__namespace.createElement(
1543
+ chunkIVF3GTYS_js.Button,
1544
+ {
1545
+ type: "button",
1546
+ variant: "outline",
1547
+ size: "sm",
1548
+ className: chunk5VQCJART_js.cn(
1549
+ "sb-w-[89%] sb-border-2 sb-border-dashed sb-text-muted-foreground",
1550
+ type === "grouped" && "sb-w-full"
1551
+ ),
1552
+ onClick: () => fieldArray.append(void 0)
1553
+ },
1554
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.PlusCircleIcon, { className: "sb-h-4 sb-w-4" })
1555
+ )));
1556
+ }
1557
+ switch (type) {
1558
+ case "string":
1559
+ case "number":
1560
+ case "longText":
1561
+ case "color":
1562
+ case "date":
1563
+ case "file":
1564
+ return /* @__PURE__ */ React25__namespace.createElement(
1565
+ FormField,
1566
+ {
1567
+ key: input.name,
1568
+ control: form.control,
1569
+ name: input.name,
1570
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(RenderInput, { type, field, options: input?.enum })), input.helperText && /* @__PURE__ */ React25__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
1571
+ }
1572
+ );
1573
+ case "richText":
1574
+ return /* @__PURE__ */ React25__namespace.createElement(Dialog, null, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-2" }, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement(DialogTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(chunkIVF3GTYS_js.Button, { variant: "outline", className: "sb-w-full" }, input.friendlyName || input.name, " bewerken"))), /* @__PURE__ */ React25__namespace.createElement(DialogContent, { className: "sb-max-w-3xl sb-p-0" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-h-full sb-max-h-svh sb-w-full sb-flex-col sm:sb-max-h-[90svh]" }, /* @__PURE__ */ React25__namespace.createElement(DialogHeader, { className: "sb-flex-none sb-border-b sb-p-6" }, /* @__PURE__ */ React25__namespace.createElement(DialogTitle, null, input.friendlyName || input.name, " editor")), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex-1 sb-overflow-y-auto" }, /* @__PURE__ */ React25__namespace.createElement(
1575
+ FormField,
1576
+ {
1577
+ key: input.name,
1578
+ control: form.control,
1579
+ name: input.name,
1580
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(RenderInput, { type, field })), input.helperText && /* @__PURE__ */ React25__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
1581
+ }
1582
+ )))));
1583
+ case "boolean":
1584
+ return /* @__PURE__ */ React25__namespace.createElement(
1585
+ FormField,
1586
+ {
1587
+ key: input.name,
1588
+ control: form.control,
1589
+ name: input.name,
1590
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, { className: "sb-flex sb-flex-row sb-items-center sb-justify-between sb-space-y-0" }, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(RenderInput, { type, field })), input.helperText && /* @__PURE__ */ React25__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
1591
+ }
1592
+ );
1593
+ case "grouped":
1594
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-2 sb-w-full" }, input.friendlyName !== "" && /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-2 sb-p-3 sb-w-full sb-border sb-rounded-lg" }, input.inputs.map((sub) => /* @__PURE__ */ React25__namespace.createElement(
1595
+ RenderFormField,
1596
+ {
1597
+ key: `${input.name}.${sub.name}`,
1598
+ type: sub.type,
1599
+ input: {
1600
+ ...sub,
1601
+ name: `${input.name}.${sub.name}`
1602
+ },
1603
+ form
1604
+ }
1605
+ ))));
1606
+ default:
1607
+ throw new Error(
1608
+ `[simple-builder]: Input type "${props.type}" not supported in render form field.`
1609
+ );
1610
+ }
1611
+ };
1612
+ var RenderInput = (props) => {
1613
+ const { type, options, field } = props;
1614
+ switch (type) {
1615
+ case "string":
1616
+ if (!options)
1617
+ return /* @__PURE__ */ React25__namespace.createElement(Input, { ...field });
1618
+ return /* @__PURE__ */ React25__namespace.createElement(Select, { onValueChange: field.onChange, defaultValue: field.value }, /* @__PURE__ */ React25__namespace.createElement(SelectTrigger, null, /* @__PURE__ */ React25__namespace.createElement(SelectValue, null)), /* @__PURE__ */ React25__namespace.createElement(SelectContent, null, options.map((option) => /* @__PURE__ */ React25__namespace.createElement(SelectItem, { key: option, value: option }, option))));
1619
+ case "longText":
1620
+ return /* @__PURE__ */ React25__namespace.createElement(Textarea, { ...field });
1621
+ case "richText":
1622
+ return /* @__PURE__ */ React25__namespace.createElement(RichTextEditor, { ...field });
1623
+ case "number":
1624
+ return /* @__PURE__ */ React25__namespace.createElement(Input, { type: "number", ...field });
1625
+ case "color":
1626
+ return /* @__PURE__ */ React25__namespace.createElement(ColorPicker, { color: field.value, onColorChange: field.onChange });
1627
+ case "date":
1628
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, null, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
1629
+ chunkIVF3GTYS_js.Button,
1630
+ {
1631
+ variant: "outline",
1632
+ size: "sm",
1633
+ className: chunk5VQCJART_js.cn(
1634
+ "sb-w-full sb-flex sb-justify-start sb-text-left sb-font-normal",
1635
+ !field.value && "sb-text-muted-foreground"
1636
+ )
1637
+ },
1638
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.CalendarIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
1639
+ field.value && !Array.isArray(field.value) ? dateFns.format(field.value, "PPP") : /* @__PURE__ */ React25__namespace.createElement("span", null, "Pick a date")
1640
+ )), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { className: "sb-w-auto sb-p-0", align: "start" }, /* @__PURE__ */ React25__namespace.createElement(
1641
+ Calendar,
1642
+ {
1643
+ mode: "single",
1644
+ selected: field.value,
1645
+ onSelect: field.onChange,
1646
+ initialFocus: true
1647
+ }
1648
+ )));
1649
+ case "boolean":
1650
+ return /* @__PURE__ */ React25__namespace.createElement(Switch, { checked: field.value, onCheckedChange: field.onChange });
1651
+ case "file":
1652
+ return /* @__PURE__ */ React25__namespace.createElement(
1653
+ MediaInput,
1654
+ {
1655
+ className: "sb-grid sb-grid-cols-2 sb-gap-1",
1656
+ itemClassName: "sb-aspect-video sb-h-auto sb-w-full",
1657
+ multiple: false,
1658
+ files: field.value ? [field.value] : [],
1659
+ onFilesChange: (files) => field.onChange(files[0]),
1660
+ onError: (e) => console.error(
1661
+ "[media-input]: Title: " + e?.title,
1662
+ "media-input: Error: " + e?.description
1663
+ )
1664
+ }
1665
+ );
1666
+ default:
1667
+ throw new Error(
1668
+ `[simple-builder]: Input type "${props.type}" not supported in render input.`
1669
+ );
1670
+ }
1671
+ };
1672
+ var Tabs = TabsPrimitive__namespace.Root;
1673
+ var tabsListVariants = chunk5VQCJART_js.tv({
1674
+ variants: {
1675
+ variant: {
1676
+ contained: "sb-inline-flex sb-h-10 sb-items-center sb-justify-center sb-rounded-md sb-bg-muted sb-p-1 sb-text-muted-foreground",
1677
+ text: "sb-flex sb-items-center sb-border-b sb-px-4 sb-space-x-6"
1678
+ }
1679
+ },
1680
+ defaultVariants: {
1681
+ variant: "contained"
1682
+ }
1683
+ });
1684
+ var TabsList = React25__namespace.forwardRef(({ variant, className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1685
+ TabsPrimitive__namespace.List,
1686
+ {
1687
+ ref,
1688
+ className: tabsListVariants({ variant, className }),
1689
+ ...props
1690
+ }
1691
+ ));
1692
+ TabsList.displayName = TabsPrimitive__namespace.List.displayName;
1693
+ var tabsTriggerVariants = chunk5VQCJART_js.tv({
1694
+ variants: {
1695
+ variant: {
1696
+ contained: "sb-inline-flex sb-items-center sb-justify-center sb-whitespace-nowrap sb-rounded-sm sb-px-3 sb-py-1.5 sb-text-sm sb-font-medium sb-ring-offset-background sb-transition-all focus-visible:sb-outline-none focus-visible:sb-ring-2 focus-visible:sb-ring-ring focus-visible:sb-ring-offset-2 disabled:sb-pointer-events-none disabled:sb-opacity-50 data-[state=active]:sb-bg-background data-[state=active]:sb-text-foreground data-[state=active]:sb-shadow-sm",
1697
+ text: "sb-inline-flex sb-font-roboto sb-items-center sb-justify-center sb-whitespace-nowrap sb-py-3 sb-text-sm sb-font-medium sb-transition-all focus-visible:sb-outline-none disabled:sb-pointer-events-none disabled:sb-opacity-50 data-[state=active]:sb-border-black sb-border-b-2 sb-border-transparent data-[state=active]:sb-text-foreground sb-text-muted-foreground"
1698
+ }
1699
+ },
1700
+ defaultVariants: {
1701
+ variant: "contained"
1702
+ }
1703
+ });
1704
+ var TabsTrigger = React25__namespace.forwardRef(({ variant, className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1705
+ TabsPrimitive__namespace.Trigger,
1706
+ {
1707
+ ref,
1708
+ className: tabsTriggerVariants({ variant, className }),
1709
+ ...props
1710
+ }
1711
+ ));
1712
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
1713
+ var TabsContent = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1714
+ TabsPrimitive__namespace.Content,
1715
+ {
1716
+ ref,
1717
+ className: chunk5VQCJART_js.cn(
1718
+ "sb-ring-offset-background sb-font-roboto focus-visible:sb-outline-none focus-visible:sb-ring-2 focus-visible:sb-ring-ring focus-visible:sb-ring-offset-2",
1719
+ className
1720
+ ),
1721
+ ...props
1722
+ }
1723
+ ));
1724
+ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
1725
+
1726
+ // src/components/ui/background-picker.tsx
1727
+ var BackgroundPicker = (props) => {
1728
+ const { background, onBackgroundChange, className } = props;
1729
+ const solids = props.solids ?? [
1730
+ "#000000",
1731
+ "#ffffff",
1732
+ "#0f172a",
1733
+ "#F1F5F9",
1734
+ "#64748B",
1735
+ "#E6007E",
1736
+ "#F8FAFC",
1737
+ "#009DD1",
1738
+ "#FF0000"
1739
+ ];
1740
+ const gradients = props.gradients ?? [
1741
+ "linear-gradient(to top left,#accbee,#e7f0fd)",
1742
+ "linear-gradient(to top left,#d5d4d0,#d5d4d0,#eeeeec)"
1743
+ ];
1744
+ const images = props.images ?? [
1745
+ "url(https://images.unsplash.com/photo-1688822863426-8c5f9b257090?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2532&q=90)",
1746
+ "url(https://images.unsplash.com/photo-1691225850735-6e4e51834cad?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2532&q=90)"
1747
+ ];
1748
+ const defaultTab = React25__namespace.useMemo(() => {
1749
+ if (background.includes("url"))
1750
+ return "image";
1751
+ if (background.includes("gradient"))
1752
+ return "gradient";
1753
+ return "solid";
1754
+ }, [background]);
1755
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, null, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
1756
+ chunkIVF3GTYS_js.Button,
1757
+ {
1758
+ variant: "outline",
1759
+ size: "sm",
1760
+ className: chunk5VQCJART_js.cn(
1761
+ "sb-justify-start sb-text-left sb-font-normal sb-normal-case sb-w-full",
1762
+ !background && "sb-text-muted-foreground",
1763
+ className
1764
+ )
1765
+ },
1766
+ /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-w-full sb-flex sb-items-center sb-gap-2" }, background ? /* @__PURE__ */ React25__namespace.createElement(
1767
+ "div",
1768
+ {
1769
+ className: "sb-h-4 sb-w-4 sb-rounded !sb-bg-center !sb-bg-cover sb-transition-all sb-border",
1770
+ style: { background }
1771
+ }
1772
+ ) : /* @__PURE__ */ React25__namespace.createElement(lucideReact.PaintbrushIcon, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-truncate sb-flex-1" }, background ? background : "Kies een achtergrond"))
1773
+ )), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { className: "sb-w-64 sb-p-0" }, /* @__PURE__ */ React25__namespace.createElement(Tabs, { defaultValue: defaultTab }, /* @__PURE__ */ React25__namespace.createElement(TabsList, { className: "sb-w-full" }, /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "solid" }, "Solid"), /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "gradient" }, "Gradient"), /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "image" }, "Image")), /* @__PURE__ */ React25__namespace.createElement(
1774
+ TabsContent,
1775
+ {
1776
+ value: "solid",
1777
+ className: "data-[state=active]:sb-flex sb-flex-wrap sb-gap-1 sb-p-4"
1778
+ },
1779
+ solids.map((s) => /* @__PURE__ */ React25__namespace.createElement(
1780
+ "div",
1781
+ {
1782
+ key: s,
1783
+ style: { background: s },
1784
+ className: "sb-rounded-md sb-h-6 sb-w-6 sb-cursor-pointer active:sb-scale-105 sb-border",
1785
+ onClick: () => onBackgroundChange(s)
1786
+ }
1787
+ ))
1788
+ ), /* @__PURE__ */ React25__namespace.createElement(
1789
+ TabsContent,
1790
+ {
1791
+ value: "gradient",
1792
+ className: "data-[state=active]:sb-flex sb-flex-wrap sb-gap-1 sb-p-4"
1793
+ },
1794
+ gradients.map((s) => /* @__PURE__ */ React25__namespace.createElement(
1795
+ "div",
1796
+ {
1797
+ key: s,
1798
+ style: { background: s },
1799
+ className: "rounded-md h-6 w-6 cursor-pointer active:scale-105 border",
1800
+ onClick: () => onBackgroundChange(s)
1801
+ }
1802
+ ))
1803
+ ), /* @__PURE__ */ React25__namespace.createElement(TabsContent, { value: "image" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-p-4 sb-border-b" }, /* @__PURE__ */ React25__namespace.createElement(
1804
+ MediaInput,
1805
+ {
1806
+ className: "sb-grid sb-grid-cols-2 sb-gap-1",
1807
+ itemClassName: "sb-aspect-video sb-h-auto sb-w-full",
1808
+ multiple: false,
1809
+ onFilesChange: (files) => {
1810
+ if (!files.length)
1811
+ return;
1812
+ onBackgroundChange(`url(${files[0]})`);
1813
+ },
1814
+ onError: (e) => console.error(
1815
+ "[media-input]: Title: " + e?.title,
1816
+ "media-input: Error: " + e?.description
1817
+ )
1818
+ }
1819
+ )), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-gap-1 sb-p-4" }, images.map((s) => /* @__PURE__ */ React25__namespace.createElement(
1820
+ "div",
1821
+ {
1822
+ key: s,
1823
+ style: { backgroundImage: s },
1824
+ className: "sb-rounded-md sb-bg-cover sb-bg-center sb-aspect-video sb-w-full sb-cursor-pointer sb-border active:sb-scale-105",
1825
+ onClick: () => onBackgroundChange(s)
1826
+ }
1827
+ )))))));
1828
+ };
1829
+ var SpacingInput = (props) => {
1830
+ const [value, setValue] = React25__namespace.useState(parse(props.value || "0px"));
1831
+ const [indipendent, setIndipendent] = React25__namespace.useState(
1832
+ isIndipendent(parse(props.value || "0px"))
1833
+ );
1834
+ React25__namespace.useEffect(() => {
1835
+ if (!props.onChange)
1836
+ return;
1837
+ props.onChange(stringify(value));
1838
+ }, [value, props.onChange]);
1839
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-grid sb-grid-cols-[1fr,auto] sb-gap-3" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-items-center sb-gap-3" }, !indipendent ? /* @__PURE__ */ React25__namespace.createElement(React25__namespace.Fragment, null, /* @__PURE__ */ React25__namespace.createElement(
1840
+ AdvancedInput,
1841
+ {
1842
+ value: value.left,
1843
+ pattern: "\\d+",
1844
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, left: +value2, right: +value2 })),
1845
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
1846
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1847
+ }
1848
+ ), /* @__PURE__ */ React25__namespace.createElement(
1849
+ AdvancedInput,
1850
+ {
1851
+ value: value.top,
1852
+ pattern: "\\d+",
1853
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, top: +value2, bottom: +value2 })),
1854
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
1855
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1856
+ }
1857
+ )) : /* @__PURE__ */ React25__namespace.createElement(React25__namespace.Fragment, null, /* @__PURE__ */ React25__namespace.createElement(
1858
+ AdvancedInput,
1859
+ {
1860
+ value: value.left,
1861
+ pattern: "\\d+",
1862
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, left: +value2 })),
1863
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
1864
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1865
+ }
1866
+ ), /* @__PURE__ */ React25__namespace.createElement(
1867
+ AdvancedInput,
1868
+ {
1869
+ value: value.top,
1870
+ pattern: "\\d+",
1871
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, top: +value2 })),
1872
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
1873
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1874
+ }
1875
+ ), /* @__PURE__ */ React25__namespace.createElement(
1876
+ AdvancedInput,
1877
+ {
1878
+ value: value.right,
1879
+ pattern: "\\d+",
1880
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, right: +value2 })),
1881
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
1882
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1883
+ }
1884
+ ), /* @__PURE__ */ React25__namespace.createElement(
1885
+ AdvancedInput,
1886
+ {
1887
+ value: value.bottom,
1888
+ pattern: "\\d+",
1889
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, bottom: +value2 })),
1890
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
1891
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1892
+ }
1893
+ ))), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React25__namespace.createElement(
1894
+ Toggle,
1895
+ {
1896
+ className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
1897
+ variant: "outline",
1898
+ size: "sm",
1899
+ pressed: indipendent,
1900
+ onPressedChange: setIndipendent
1901
+ },
1902
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ScanIcon, { className: "sb-h-4 sb-w-4" })
1903
+ )));
1904
+ };
1905
+ var isIndipendent = (value) => {
1906
+ const { top, right, bottom, left } = value;
1907
+ return top !== bottom || right !== left;
1908
+ };
1909
+ var parse = (value) => {
1910
+ const matches = value.match(/(\d+)/gm);
1911
+ const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
1912
+ switch (matches?.length) {
1913
+ case 1:
1914
+ return { top, right: top, bottom: top, left: top };
1915
+ case 2:
1916
+ return { top, bottom: top, left: right, right };
1917
+ case 3:
1918
+ return { top, right, left: right, bottom };
1919
+ default:
1920
+ return { top, right, bottom, left };
1921
+ }
1922
+ };
1923
+ var stringify = (value) => {
1924
+ const { top, right, bottom, left } = value;
1925
+ if (top === right && top === bottom && top === left) {
1926
+ return `${top}px`;
1927
+ }
1928
+ if (top === bottom && right === left) {
1929
+ return `${top}px ${right}px`;
1930
+ }
1931
+ if (right === left) {
1932
+ return `${top}px ${right}px ${bottom}px`;
1933
+ }
1934
+ return `${top}px ${right}px ${bottom}px ${left}px`;
1935
+ };
1936
+
1937
+ // src/components/item-design-form.tsx
1938
+ var designSchema = zod.z.object({
1939
+ container: zod.z.coerce.boolean(),
1940
+ hidden: zod.z.enum(["always", "mobile", "desktop", "never"]),
1941
+ desktop: zod.z.object({
1942
+ background: zod.z.string(),
1943
+ color: zod.z.string(),
1944
+ padding: zod.z.string(),
1945
+ margin: zod.z.string()
1946
+ }),
1947
+ mobile: zod.z.object({
1948
+ background: zod.z.string(),
1949
+ color: zod.z.string(),
1950
+ padding: zod.z.string(),
1951
+ margin: zod.z.string()
1952
+ })
1953
+ });
1954
+ var ItemDesignForm = (props) => {
1955
+ const { item } = props;
1956
+ const component = chunk5VQCJART_js.builder.getComponent(item.component);
1957
+ if (!component) {
1958
+ throw new Error(
1959
+ `[simple-builder]: Component "${item.component}" not found`
1960
+ );
1961
+ }
1962
+ const getDefaultDeviceValue = (params) => {
1963
+ const { device: device2 = "desktop", key, fallback = "" } = params;
1964
+ if (item.styles?.[device2]?.[key] !== void 0) {
1965
+ return item.styles[device2][key];
1966
+ }
1967
+ if (component.defaultStyles?.[device2]?.[key] !== void 0) {
1968
+ return component.defaultStyles[device2][key];
1969
+ }
1970
+ if (device2 === "mobile") {
1971
+ const desktopValue = getDefaultDeviceValue({
1972
+ ...params,
1973
+ device: "desktop"
1974
+ });
1975
+ if (desktopValue !== void 0) {
1976
+ return desktopValue;
1977
+ }
1978
+ }
1979
+ return fallback;
1980
+ };
1981
+ const getDefaultDeviceValues = (device2) => {
1982
+ return {
1983
+ background: getDefaultDeviceValue({ device: device2, key: "background" }),
1984
+ color: getDefaultDeviceValue({ device: device2, key: "color" }),
1985
+ padding: getDefaultDeviceValue({ device: device2, key: "padding" }),
1986
+ margin: getDefaultDeviceValue({ device: device2, key: "margin" })
1987
+ };
1988
+ };
1989
+ const form = reactHookForm.useForm({
1990
+ resolver: zod$1.zodResolver(designSchema),
1991
+ values: {
1992
+ container: item.styles?.container ?? true,
1993
+ hidden: item.styles?.hidden ?? "never",
1994
+ desktop: getDefaultDeviceValues("desktop"),
1995
+ mobile: getDefaultDeviceValues("mobile")
1996
+ }
1997
+ });
1998
+ const { patchItem } = chunkIVF3GTYS_js.useBuilder();
1999
+ const onSubmit = (values) => {
2000
+ const { container, hidden, desktop, mobile } = values;
2001
+ const dirtyFields = form.formState.dirtyFields;
2002
+ const desktopPatch = Object.entries(desktop).reduce(
2003
+ (acc, [key, value]) => ({
2004
+ ...acc,
2005
+ ...value && { [key]: value }
2006
+ }),
2007
+ { ...item.styles?.desktop }
2008
+ );
2009
+ const mobilePatch = Object.entries(mobile).reduce(
2010
+ (acc, [key, value]) => {
2011
+ const desktopValue = desktop[key];
2012
+ const isDirty = dirtyFields.desktop?.[key];
2013
+ if (value === desktopValue || isDirty) {
2014
+ return acc;
2015
+ }
2016
+ if (["padding", "margin"].includes(key)) {
2017
+ if (value === "0px" && desktopValue === "0px") {
2018
+ return acc;
2019
+ }
2020
+ }
2021
+ return {
2022
+ ...acc,
2023
+ ...value && { [key]: value }
2024
+ };
2025
+ },
2026
+ { ...item.styles?.mobile }
2027
+ );
2028
+ patchItem(item.id, {
2029
+ styles: {
2030
+ ...container === false && { container },
2031
+ ...hidden !== "never" && { hidden },
2032
+ ...Object.keys(desktopPatch).length && { desktop: desktopPatch },
2033
+ ...Object.keys(mobilePatch).length && { mobile: mobilePatch }
2034
+ }
2035
+ });
2036
+ };
2037
+ const [device, setDevice] = React25__namespace.useState("desktop");
2038
+ React25__namespace.useEffect(() => {
2039
+ const subscription = form.watch(() => form.handleSubmit(onSubmit)());
2040
+ return () => subscription.unsubscribe();
2041
+ }, [form.watch, form.handleSubmit]);
2042
+ return /* @__PURE__ */ React25__namespace.createElement(Form, { ...form }, /* @__PURE__ */ React25__namespace.createElement("form", { onSubmit: form.handleSubmit(onSubmit) }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-4 sb-p-4" }, /* @__PURE__ */ React25__namespace.createElement(
2043
+ Tabs,
2044
+ {
2045
+ defaultValue: device,
2046
+ onValueChange: (device2) => setDevice(device2)
2047
+ },
2048
+ /* @__PURE__ */ React25__namespace.createElement(TabsList, { className: "sb-h-9 sb-grid sb-w-full sb-grid-cols-2" }, /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { value: "desktop", className: "sb-text-xs" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.MonitorIcon, { className: "sb-h-4 sb-w-4 sb-mr-2" }), /* @__PURE__ */ React25__namespace.createElement("span", null, "Desktop")), /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { value: "mobile", className: "sb-text-xs" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.SmartphoneIcon, { className: "sb-h-4 sb-w-4 sb-mr-2" }), /* @__PURE__ */ React25__namespace.createElement("span", null, "Mobiel")))
2049
+ ), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-4" }, /* @__PURE__ */ React25__namespace.createElement(
2050
+ FormField,
2051
+ {
2052
+ control: form.control,
2053
+ key: `${device}.background`,
2054
+ name: `${device}.background`,
2055
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Achtergrond"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2056
+ BackgroundPicker,
2057
+ {
2058
+ background: field.value,
2059
+ onBackgroundChange: field.onChange
2060
+ }
2061
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2062
+ }
2063
+ ), /* @__PURE__ */ React25__namespace.createElement(
2064
+ FormField,
2065
+ {
2066
+ control: form.control,
2067
+ key: `${device}.color`,
2068
+ name: `${device}.color`,
2069
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Inhoud kleur"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2070
+ ColorPicker,
2071
+ {
2072
+ color: field.value,
2073
+ onColorChange: field.onChange
2074
+ }
2075
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2076
+ }
2077
+ ), /* @__PURE__ */ React25__namespace.createElement("hr", null), /* @__PURE__ */ React25__namespace.createElement(
2078
+ FormField,
2079
+ {
2080
+ control: form.control,
2081
+ name: "hidden",
2082
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Verbergen"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(Select, { value: field.value, onValueChange: field.onChange }, /* @__PURE__ */ React25__namespace.createElement(SelectTrigger, null, /* @__PURE__ */ React25__namespace.createElement(SelectValue, null)), /* @__PURE__ */ React25__namespace.createElement(SelectContent, null, /* @__PURE__ */ React25__namespace.createElement(SelectItem, { value: "never" }, "Nooit"), /* @__PURE__ */ React25__namespace.createElement(SelectItem, { value: "desktop" }, "Op desktop"), /* @__PURE__ */ React25__namespace.createElement(SelectItem, { value: "mobile" }, "Op mobiel"), /* @__PURE__ */ React25__namespace.createElement(SelectItem, { value: "always" }, "Altijd")))), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2083
+ }
2084
+ ), /* @__PURE__ */ React25__namespace.createElement("hr", null), /* @__PURE__ */ React25__namespace.createElement(
2085
+ FormField,
2086
+ {
2087
+ control: form.control,
2088
+ name: "container",
2089
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, { className: "sb-flex sb-flex-row sb-items-center sb-justify-between sb-space-y-0" }, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Volledige breedte"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2090
+ Switch,
2091
+ {
2092
+ checked: !field.value,
2093
+ onCheckedChange: (v) => field.onChange(!v)
2094
+ }
2095
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2096
+ }
2097
+ ), /* @__PURE__ */ React25__namespace.createElement("hr", null), /* @__PURE__ */ React25__namespace.createElement(
2098
+ FormField,
2099
+ {
2100
+ control: form.control,
2101
+ key: `${device}.padding`,
2102
+ name: `${device}.padding`,
2103
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Padding"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2104
+ SpacingInput,
2105
+ {
2106
+ value: field.value,
2107
+ onChange: field.onChange
2108
+ }
2109
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2110
+ }
2111
+ ), /* @__PURE__ */ React25__namespace.createElement(
2112
+ FormField,
2113
+ {
2114
+ control: form.control,
2115
+ key: `${device}.margin`,
2116
+ name: `${device}.margin`,
2117
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Margin"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2118
+ SpacingInput,
2119
+ {
2120
+ value: field.value,
2121
+ onChange: field.onChange
2122
+ }
2123
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2124
+ }
2125
+ )))));
2126
+ };
2127
+ var ScrollArea = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
2128
+ ScrollAreaPrimitive__namespace.Root,
2129
+ {
2130
+ ref,
2131
+ className: chunk5VQCJART_js.cn("sb-relative sb-overflow-hidden", className),
2132
+ ...props
2133
+ },
2134
+ /* @__PURE__ */ React25__namespace.createElement(ScrollAreaPrimitive__namespace.Viewport, { className: "sb-h-full sb-max-h-[80vh] sb-w-full sb-rounded-[inherit]" }, children),
2135
+ /* @__PURE__ */ React25__namespace.createElement(ScrollBar, null),
2136
+ /* @__PURE__ */ React25__namespace.createElement(ScrollAreaPrimitive__namespace.Corner, null)
2137
+ ));
2138
+ ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
2139
+ var ScrollBar = React25__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
2140
+ ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
2141
+ {
2142
+ ref,
2143
+ orientation,
2144
+ className: chunk5VQCJART_js.cn(
2145
+ "sb-flex sb-touch-none sb-select-none sb-transition-colors",
2146
+ orientation === "vertical" && "sb-h-full sb-w-2.5 sb-border-l sb-border-l-transparent sb-p-[1px]",
2147
+ orientation === "horizontal" && "sb-h-2.5 sb-flex-col sb-border-t sb-border-t-transparent sb-p-[1px]",
2148
+ className
2149
+ ),
2150
+ ...props
2151
+ },
2152
+ /* @__PURE__ */ React25__namespace.createElement(ScrollAreaPrimitive__namespace.ScrollAreaThumb, { className: "sb-relative sb-flex-1 sb-rounded-full sb-bg-border" })
2153
+ ));
2154
+ ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displayName;
2155
+
2156
+ // src/components/container-item-toolbar.tsx
2157
+ var ContainerItemToolbar = (props) => {
2158
+ const { contentId, canBringUp = false, canBringDown = false } = props;
2159
+ const { bringUp, bringDown } = chunkIVF3GTYS_js.useBuilder();
2160
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-absolute sb-z-20 sb-top-1 sb-right-1 sb-rounded-md sb-shadow sb-flex sb-flex-col sb-gap-1 sb-p-1 sb-bg-card sb-text-card-foreground sb-item-toolbar sb-opacity-0 sb-transition-opacity" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-h-10 sb-p-1 sb-border sb-border-input sb-bg-background sb-rounded-md sb-text-sm sb-font-medium sb-flex sb-gap-1 sb-items-center sb-justify-start" }, /* @__PURE__ */ React25__namespace.createElement(EditButton, { id: contentId }), /* @__PURE__ */ React25__namespace.createElement(
2161
+ chunkIVF3GTYS_js.Button,
2162
+ {
2163
+ variant: "ghost",
2164
+ className: "sb-w-8 sb-h-8 sb-p-0",
2165
+ onClick: () => bringUp(contentId),
2166
+ disabled: !canBringUp
2167
+ },
2168
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ArrowUp, { className: "sb-h-5 sb-w-5" })
2169
+ ), /* @__PURE__ */ React25__namespace.createElement(
2170
+ chunkIVF3GTYS_js.Button,
2171
+ {
2172
+ variant: "ghost",
2173
+ className: "sb-w-8 sb-h-8 sb-p-0",
2174
+ onClick: () => bringDown(contentId),
2175
+ disabled: !canBringDown
2176
+ },
2177
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ArrowDown, { className: "sb-h-5 sb-w-5" })
2178
+ ), /* @__PURE__ */ React25__namespace.createElement(DeleteButton, { contentId })));
2179
+ };
2180
+ var EditButton = ({ id }) => {
2181
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, { modal: true }, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(chunkIVF3GTYS_js.Button, { variant: "ghost", className: "sb-w-8 sb-h-8 sb-p-0" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.Edit2Icon, { className: "sb-h-5 sb-w-5" }))), /* @__PURE__ */ React25__namespace.createElement(
2182
+ PopoverContent,
2183
+ {
2184
+ side: "left",
2185
+ align: "start",
2186
+ sideOffset: 16,
2187
+ alignOffset: -8,
2188
+ className: "sb-p-0 sb-relative",
2189
+ collisionPadding: 16
2190
+ },
2191
+ /* @__PURE__ */ React25__namespace.createElement(EditPopoverInner, { id })
2192
+ ));
2193
+ };
2194
+ var EditPopoverInner = (props) => {
2195
+ const { id } = props;
2196
+ const { getItem } = chunkIVF3GTYS_js.useBuilder();
2197
+ const item = getItem(id);
2198
+ if (!item) {
2199
+ throw new Error(
2200
+ `[simple-builder]: Item with id ${id} not found in container item form component`
2201
+ );
2202
+ }
2203
+ return /* @__PURE__ */ React25__namespace.createElement(Tabs, null, /* @__PURE__ */ React25__namespace.createElement(TabsList, { variant: "text", defaultValue: "content" }, /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { variant: "text", value: "content" }, "Inhoud"), /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { variant: "text", value: "design" }, "Design")), /* @__PURE__ */ React25__namespace.createElement(TabsContent, { value: "content" }, /* @__PURE__ */ React25__namespace.createElement(ScrollArea, null, /* @__PURE__ */ React25__namespace.createElement(ContainerItemForm, { item }))), /* @__PURE__ */ React25__namespace.createElement(TabsContent, { value: "design" }, /* @__PURE__ */ React25__namespace.createElement(ItemDesignForm, { item })));
2204
+ };
2205
+ var DeleteButton = ({ contentId }) => {
2206
+ const { deleteContent } = chunkIVF3GTYS_js.useBuilder();
2207
+ return /* @__PURE__ */ React25__namespace.createElement(AlertDialog, null, /* @__PURE__ */ React25__namespace.createElement(AlertDialogTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
2208
+ chunkIVF3GTYS_js.Button,
2209
+ {
2210
+ variant: "ghost",
2211
+ className: "sb-w-8 sb-h-8 sb-p-0 sb-text-destructive"
2212
+ },
2213
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.Trash2Icon, { className: "sb-h-5 sb-w-5" })
2214
+ )), /* @__PURE__ */ React25__namespace.createElement(AlertDialogContent, null, /* @__PURE__ */ React25__namespace.createElement(AlertDialogDescription, null, "Weet je zeker dat je dit blok wilt verwijderen?"), /* @__PURE__ */ React25__namespace.createElement(AlertDialogFooter, null, /* @__PURE__ */ React25__namespace.createElement(AlertDialogCancel, null, "Annuleren"), /* @__PURE__ */ React25__namespace.createElement(
2215
+ AlertDialogAction,
2216
+ {
2217
+ className: chunkIVF3GTYS_js.buttonVariants({ variant: "destructive" }),
2218
+ onClick: () => deleteContent(contentId)
2219
+ },
2220
+ "Verwijderen"
2221
+ ))));
2222
+ };
2223
+
2224
+ // src/components/build-container-client.tsx
2225
+ var BuildContainerInner = (props) => {
2226
+ const { id, name, content, multiple = false } = props;
2227
+ const items = Array.isArray(content) ? content : content?.[name] || [];
2228
+ if (!multiple && items.length > 1) {
2229
+ console.error(
2230
+ "[simple-builder]: Multiple content blocks detected when using property multiple false."
2231
+ );
2232
+ }
2233
+ return /* @__PURE__ */ React25__namespace.createElement("div", null, items.length <= 0 ? /* @__PURE__ */ React25__namespace.createElement(AddContentPlaceholder, { parent: id, container: name, index: 0 }) : multiple && /* @__PURE__ */ React25__namespace.createElement(AddContentDividerButton, { parent: id, container: name, index: 0 }), items.map((item, i) => /* @__PURE__ */ React25__namespace.createElement(React25__namespace.Fragment, { key: item.id }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-relative sb-container-item" }, /* @__PURE__ */ React25__namespace.createElement(chunk5VQCJART_js.DesignWrapper, { building: true, styles: item.styles }, chunk5VQCJART_js.builder.bindComponent(item, true)), /* @__PURE__ */ React25__namespace.createElement(
2234
+ ContainerItemToolbar,
2235
+ {
2236
+ contentId: item.id,
2237
+ canBringUp: i > 0,
2238
+ canBringDown: i < items.length - 1
2239
+ }
2240
+ )), multiple && /* @__PURE__ */ React25__namespace.createElement(
2241
+ AddContentDividerButton,
2242
+ {
2243
+ parent: id,
2244
+ container: name,
2245
+ index: i + 1
2246
+ }
2247
+ ))));
2248
+ };
2249
+ var build_container_client_default = BuildContainerInner;
2250
+ var AddContentButton = (props) => {
2251
+ const components = chunk5VQCJART_js.builder.getComponents();
2252
+ const { addContent } = chunkIVF3GTYS_js.useBuilder();
2253
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, null, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, props.children), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { className: "sb-p-1" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-gap-2" }, components.map((component) => {
2254
+ const Icon2 = component.icon ?? lucideReact.ImageIcon;
2255
+ return /* @__PURE__ */ React25__namespace.createElement(PopoverClose, { key: component.name, asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
2256
+ chunkIVF3GTYS_js.Button,
2257
+ {
2258
+ variant: "ghost",
2259
+ className: "sb-justify-start",
2260
+ onClick: () => {
2261
+ addContent(
2262
+ component.name,
2263
+ props.container,
2264
+ props.parent,
2265
+ props.index
2266
+ );
2267
+ }
2268
+ },
2269
+ /* @__PURE__ */ React25__namespace.createElement(Icon2, { className: "sb-mr-2 sb-h-4 sb-w-4 sb-shrink-0" }),
2270
+ component.friendlyName ?? component.name
2271
+ ));
2272
+ }))));
2273
+ };
2274
+ var AddContentPlaceholder = (props) => {
2275
+ return /* @__PURE__ */ React25__namespace.createElement(AddContentButton, { ...props }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-justify-center sb-bg-primary/50 p-4" }, /* @__PURE__ */ React25__namespace.createElement(chunkIVF3GTYS_js.Button, { size: "sm" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }), "Blok Toevoegen")));
2276
+ };
2277
+ var AddContentDividerButton = (props) => {
2278
+ return /* @__PURE__ */ React25__namespace.createElement(AddContentButton, { ...props }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-w-full sb-h-1 sb--my-[2px] sb-bg-primary sb-relative sb-z-20 sb-opacity-0 add-content-divider-button sb-transition-opacity" }, /* @__PURE__ */ React25__namespace.createElement(
2279
+ chunkIVF3GTYS_js.Button,
2280
+ {
2281
+ size: "sm",
2282
+ className: "sb-absolute sb-left-1/2 sb-top-1/2 sb--translate-y-1/2 sb--translate-x-1/2 sb-shadow"
2283
+ },
2284
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
2285
+ "Blok Toevoegen"
2286
+ )));
2287
+ };
2288
+
2289
+ module.exports = build_container_client_default;