@simple-builder/react 1.2.5 → 1.2.6

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