@simple-builder/react 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1318 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ require('./chunk-N2X3IJBG.js');
5
+ var chunkGSOMMLCG_js = require('./chunk-GSOMMLCG.js');
6
+ var chunkUZFAGH6G_js = require('./chunk-UZFAGH6G.js');
7
+ var React13 = require('react');
8
+ var lucideReact = require('lucide-react');
9
+ var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
10
+ var PopoverPrimitive = require('@radix-ui/react-popover');
11
+ var zod$1 = require('@hookform/resolvers/zod');
12
+ var reactHookForm = require('react-hook-form');
13
+ var zod = require('zod');
14
+ var reactSlot = require('@radix-ui/react-slot');
15
+ var LabelPrimitive = require('@radix-ui/react-label');
16
+ var classVarianceAuthority = require('class-variance-authority');
17
+ var TabsPrimitive = require('@radix-ui/react-tabs');
18
+ var NextImage = require('next/image');
19
+ var SwitchPrimitives = require('@radix-ui/react-switch');
20
+ var TogglePrimitive = require('@radix-ui/react-toggle');
21
+ var dateFns = require('date-fns');
22
+ var reactDayPicker = require('react-day-picker');
23
+
24
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
25
+
26
+ function _interopNamespace(e) {
27
+ if (e && e.__esModule) return e;
28
+ var n = Object.create(null);
29
+ if (e) {
30
+ Object.keys(e).forEach(function (k) {
31
+ if (k !== 'default') {
32
+ var d = Object.getOwnPropertyDescriptor(e, k);
33
+ Object.defineProperty(n, k, d.get ? d : {
34
+ enumerable: true,
35
+ get: function () { return e[k]; }
36
+ });
37
+ }
38
+ });
39
+ }
40
+ n.default = e;
41
+ return Object.freeze(n);
42
+ }
43
+
44
+ var React13__namespace = /*#__PURE__*/_interopNamespace(React13);
45
+ var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
46
+ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
47
+ var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
48
+ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
49
+ var NextImage__default = /*#__PURE__*/_interopDefault(NextImage);
50
+ var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
51
+ var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
52
+
53
+ var AlertDialog = AlertDialogPrimitive__namespace.Root;
54
+ var AlertDialogTrigger = AlertDialogPrimitive__namespace.Trigger;
55
+ var AlertDialogPortal = AlertDialogPrimitive__namespace.Portal;
56
+ var AlertDialogOverlay = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
57
+ AlertDialogPrimitive__namespace.Overlay,
58
+ {
59
+ className: chunkGSOMMLCG_js.cn(
60
+ "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",
61
+ className
62
+ ),
63
+ ...props,
64
+ ref
65
+ }
66
+ ));
67
+ AlertDialogOverlay.displayName = AlertDialogPrimitive__namespace.Overlay.displayName;
68
+ var AlertDialogContent = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(AlertDialogPortal, null, /* @__PURE__ */ React13__namespace.createElement(AlertDialogOverlay, null), /* @__PURE__ */ React13__namespace.createElement(
69
+ AlertDialogPrimitive__namespace.Content,
70
+ {
71
+ ref,
72
+ className: chunkGSOMMLCG_js.cn(
73
+ "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",
74
+ className
75
+ ),
76
+ ...props
77
+ }
78
+ )));
79
+ AlertDialogContent.displayName = AlertDialogPrimitive__namespace.Content.displayName;
80
+ var AlertDialogFooter = ({
81
+ className,
82
+ ...props
83
+ }) => /* @__PURE__ */ React13__namespace.createElement(
84
+ "div",
85
+ {
86
+ className: chunkGSOMMLCG_js.cn(
87
+ "sb-flex sb-flex-col-reverse sm:sb-flex-row sm:sb-justify-end sm:sb-space-x-2",
88
+ className
89
+ ),
90
+ ...props
91
+ }
92
+ );
93
+ AlertDialogFooter.displayName = "AlertDialogFooter";
94
+ var AlertDialogTitle = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
95
+ AlertDialogPrimitive__namespace.Title,
96
+ {
97
+ ref,
98
+ className: chunkGSOMMLCG_js.cn("sb-text-lg sb-font-semibold", className),
99
+ ...props
100
+ }
101
+ ));
102
+ AlertDialogTitle.displayName = AlertDialogPrimitive__namespace.Title.displayName;
103
+ var AlertDialogDescription = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
104
+ AlertDialogPrimitive__namespace.Description,
105
+ {
106
+ ref,
107
+ className: chunkGSOMMLCG_js.cn("sb-text-sm sb-text-muted-foreground", className),
108
+ ...props
109
+ }
110
+ ));
111
+ AlertDialogDescription.displayName = AlertDialogPrimitive__namespace.Description.displayName;
112
+ var AlertDialogAction = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
113
+ AlertDialogPrimitive__namespace.Action,
114
+ {
115
+ ref,
116
+ className: chunkGSOMMLCG_js.cn(chunkGSOMMLCG_js.buttonVariants(), className),
117
+ ...props
118
+ }
119
+ ));
120
+ AlertDialogAction.displayName = AlertDialogPrimitive__namespace.Action.displayName;
121
+ var AlertDialogCancel = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
122
+ AlertDialogPrimitive__namespace.Cancel,
123
+ {
124
+ ref,
125
+ className: chunkGSOMMLCG_js.cn(
126
+ chunkGSOMMLCG_js.buttonVariants({ variant: "outline" }),
127
+ "sb-mt-2 sm:sb-mt-0",
128
+ className
129
+ ),
130
+ ...props
131
+ }
132
+ ));
133
+ AlertDialogCancel.displayName = AlertDialogPrimitive__namespace.Cancel.displayName;
134
+ var Popover = PopoverPrimitive__namespace.Root;
135
+ var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
136
+ var PopoverClose = PopoverPrimitive__namespace.Close;
137
+ var PopoverContent = React13__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React13__namespace.createElement(
138
+ PopoverPrimitive__namespace.Content,
139
+ {
140
+ ref,
141
+ align,
142
+ sideOffset,
143
+ className: chunkGSOMMLCG_js.cn(
144
+ "sb-z-50 sb-w-72 sb-font-roboto 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",
145
+ className
146
+ ),
147
+ ...props
148
+ }
149
+ )));
150
+ PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
151
+ var labelVariants = classVarianceAuthority.cva(
152
+ "sb-text-sm sb-font-medium sb-font-roboto sb-leading-none peer-disabled:sb-cursor-not-allowed peer-disabled:sb-opacity-70"
153
+ );
154
+ var Label = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
155
+ LabelPrimitive__namespace.Root,
156
+ {
157
+ ref,
158
+ className: chunkGSOMMLCG_js.cn(labelVariants(), className),
159
+ ...props
160
+ }
161
+ ));
162
+ Label.displayName = LabelPrimitive__namespace.Root.displayName;
163
+
164
+ // src/components/ui/form.tsx
165
+ var Form = reactHookForm.FormProvider;
166
+ var FormFieldContext = React13__namespace.createContext(
167
+ {}
168
+ );
169
+ var FormField = ({
170
+ ...props
171
+ }) => {
172
+ return /* @__PURE__ */ React13__namespace.createElement(FormFieldContext.Provider, { value: { name: props.name } }, /* @__PURE__ */ React13__namespace.createElement(reactHookForm.Controller, { ...props }));
173
+ };
174
+ var useFormField = () => {
175
+ const fieldContext = React13__namespace.useContext(FormFieldContext);
176
+ const itemContext = React13__namespace.useContext(FormItemContext);
177
+ const { getFieldState, formState } = reactHookForm.useFormContext();
178
+ const fieldState = getFieldState(fieldContext.name, formState);
179
+ if (!fieldContext) {
180
+ throw new Error("useFormField should be used within <FormField>");
181
+ }
182
+ const { id } = itemContext;
183
+ return {
184
+ id,
185
+ name: fieldContext.name,
186
+ formItemId: `${id}-form-item`,
187
+ formDescriptionId: `${id}-form-item-description`,
188
+ formMessageId: `${id}-form-item-message`,
189
+ ...fieldState
190
+ };
191
+ };
192
+ var FormItemContext = React13__namespace.createContext(
193
+ {}
194
+ );
195
+ var FormItem = React13__namespace.forwardRef(({ className, ...props }, ref) => {
196
+ const id = React13__namespace.useId();
197
+ return /* @__PURE__ */ React13__namespace.createElement(FormItemContext.Provider, { value: { id } }, /* @__PURE__ */ React13__namespace.createElement("div", { ref, className: chunkGSOMMLCG_js.cn("sb-space-y-2", className), ...props }));
198
+ });
199
+ FormItem.displayName = "FormItem";
200
+ var FormLabel = React13__namespace.forwardRef(({ className, ...props }, ref) => {
201
+ const { error, formItemId } = useFormField();
202
+ return /* @__PURE__ */ React13__namespace.createElement(
203
+ Label,
204
+ {
205
+ ref,
206
+ className: chunkGSOMMLCG_js.cn(error && "sb-text-destructive", className),
207
+ htmlFor: formItemId,
208
+ ...props
209
+ }
210
+ );
211
+ });
212
+ FormLabel.displayName = "FormLabel";
213
+ var FormControl = React13__namespace.forwardRef(({ ...props }, ref) => {
214
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
215
+ return /* @__PURE__ */ React13__namespace.createElement(
216
+ reactSlot.Slot,
217
+ {
218
+ ref,
219
+ id: formItemId,
220
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
221
+ "aria-invalid": !!error,
222
+ ...props
223
+ }
224
+ );
225
+ });
226
+ FormControl.displayName = "FormControl";
227
+ var FormDescription = React13__namespace.forwardRef(({ className, ...props }, ref) => {
228
+ const { formDescriptionId } = useFormField();
229
+ return /* @__PURE__ */ React13__namespace.createElement(
230
+ "p",
231
+ {
232
+ ref,
233
+ id: formDescriptionId,
234
+ className: chunkGSOMMLCG_js.cn(
235
+ "sb-text-sm sb-font-roboto sb-text-muted-foreground",
236
+ className
237
+ ),
238
+ ...props
239
+ }
240
+ );
241
+ });
242
+ FormDescription.displayName = "FormDescription";
243
+ var FormMessage = React13__namespace.forwardRef(({ className, children, ...props }, ref) => {
244
+ const { error, formMessageId } = useFormField();
245
+ const body = error ? String(error?.message) : children;
246
+ if (!body) {
247
+ return null;
248
+ }
249
+ return /* @__PURE__ */ React13__namespace.createElement(
250
+ "p",
251
+ {
252
+ ref,
253
+ id: formMessageId,
254
+ className: chunkGSOMMLCG_js.cn(
255
+ "sb-text-sm sb-font-roboto sb-font-medium sb-text-destructive",
256
+ className
257
+ ),
258
+ ...props
259
+ },
260
+ body
261
+ );
262
+ });
263
+ FormMessage.displayName = "FormMessage";
264
+ var Tabs = TabsPrimitive__namespace.Root;
265
+ var TabsList = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
266
+ TabsPrimitive__namespace.List,
267
+ {
268
+ ref,
269
+ className: chunkGSOMMLCG_js.cn(
270
+ "sb-flex sb-items-center sb-border-b sb-px-4 sb-space-x-6",
271
+ className
272
+ ),
273
+ ...props
274
+ }
275
+ ));
276
+ TabsList.displayName = TabsPrimitive__namespace.List.displayName;
277
+ var TabsTrigger = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
278
+ TabsPrimitive__namespace.Trigger,
279
+ {
280
+ ref,
281
+ className: chunkGSOMMLCG_js.cn(
282
+ "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",
283
+ className
284
+ ),
285
+ ...props
286
+ }
287
+ ));
288
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
289
+ var TabsContent = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
290
+ TabsPrimitive__namespace.Content,
291
+ {
292
+ ref,
293
+ className: chunkGSOMMLCG_js.cn(
294
+ "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",
295
+ className
296
+ ),
297
+ ...props
298
+ }
299
+ ));
300
+ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
301
+ var Image = (props) => {
302
+ if (typeof NextImage__default.default !== "undefined") {
303
+ return /* @__PURE__ */ React13__namespace.createElement(NextImage__default.default.default, { ...props });
304
+ }
305
+ return /* @__PURE__ */ React13__namespace.createElement("img", { ...props });
306
+ };
307
+
308
+ // src/components/ui/media-input.tsx
309
+ var MediaInput = (props) => {
310
+ const { onFilesChange, limit = 32, multiple = false, onError } = props;
311
+ const id = React13__namespace.useId();
312
+ const [queue, setQueue] = React13__namespace.useState([]);
313
+ const [sources, setSources] = React13__namespace.useState(props.files ?? []);
314
+ const maxConcurrentUploads = 3;
315
+ const uploadingCountRef = React13__namespace.useRef(0);
316
+ const handleFilesAdd = async (e) => {
317
+ const files = e.target.files;
318
+ if (!files || files.length === 0) {
319
+ return;
320
+ }
321
+ if (files.length + sources.length > (multiple ? limit : 1)) {
322
+ onError?.(
323
+ new MediaInputError(
324
+ `Maximaal ${limit} bestanden.`,
325
+ `Je probeerde nu ${files.length + sources.length} bestanden toe te voegen, maar je mag er maximaal ${limit} toevoegen.`
326
+ )
327
+ );
328
+ return;
329
+ }
330
+ const queue2 = Array.from(files);
331
+ setQueue(queue2);
332
+ for (const file of queue2) {
333
+ try {
334
+ while (uploadingCountRef.current >= maxConcurrentUploads && uploadingCountRef.current > 0) {
335
+ await new Promise((resolve) => setTimeout(resolve, 300));
336
+ }
337
+ uploadingCountRef.current++;
338
+ const formData = new FormData();
339
+ formData.append("file", file);
340
+ const res = await fetch("/api/simple-builder/file/upload", {
341
+ method: "POST",
342
+ body: formData
343
+ });
344
+ if (res === void 0 || !res.ok) {
345
+ onError?.(
346
+ new MediaInputError(
347
+ "Bestand uploaden misulukt",
348
+ `Bestand ${file.name} kon niet worden ge\xFCpload.`
349
+ )
350
+ );
351
+ continue;
352
+ }
353
+ const { data: url } = await res.json();
354
+ if (!url) {
355
+ onError?.(
356
+ new MediaInputError(
357
+ "Bestand uploaden misulukt",
358
+ `De URL van bestand ${file.name} kon niet worden opgehaald.`
359
+ )
360
+ );
361
+ continue;
362
+ }
363
+ setSources((prev) => [...prev, url]);
364
+ onFilesChange?.([...sources, url]);
365
+ } catch (e2) {
366
+ onError?.(
367
+ new MediaInputError(
368
+ "Bestand uploaden misulukt",
369
+ `Bestand ${file.name} kon niet worden ge\xFCpload.`
370
+ )
371
+ );
372
+ } finally {
373
+ setQueue((prev) => prev.filter((f) => f !== file));
374
+ uploadingCountRef.current--;
375
+ }
376
+ }
377
+ };
378
+ const handleSourceDelete = async (src) => {
379
+ setSources((prev) => prev.filter((s) => s !== src));
380
+ onFilesChange?.(sources.filter((s) => s !== src));
381
+ await fetch("/api/uploadthing/delete", {
382
+ method: "POST",
383
+ body: JSON.stringify({ src })
384
+ });
385
+ };
386
+ return /* @__PURE__ */ React13__namespace.createElement("div", { className: chunkGSOMMLCG_js.cn("flex flex-wrap gap-4", props.className) }, sources.map((src) => /* @__PURE__ */ React13__namespace.createElement(MediaInputItem, { key: src, className: chunkGSOMMLCG_js.cn("group", props.itemClassName) }, /* @__PURE__ */ React13__namespace.createElement(
387
+ Image,
388
+ {
389
+ src,
390
+ alt: "",
391
+ fill: true,
392
+ className: "sb-absolute sb-inset-0 sb-object-cover sb-pointer-events-none"
393
+ }
394
+ ), /* @__PURE__ */ React13__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__ */ React13__namespace.createElement(
395
+ "button",
396
+ {
397
+ 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",
398
+ onClick: () => handleSourceDelete(src)
399
+ },
400
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.Trash2Icon, { className: "sb-h-4 sb-w-4" })
401
+ )))), queue.map((_, i) => /* @__PURE__ */ React13__namespace.createElement(
402
+ MediaInputItem,
403
+ {
404
+ key: i,
405
+ className: chunkGSOMMLCG_js.cn(
406
+ "sb-flex sb-h-28 sb-w-28 sb-items-center sb-justify-center",
407
+ props.itemClassName
408
+ )
409
+ },
410
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.Loader2Icon, { className: "sb-h-6 sb-w-6 sb-animate-spin" })
411
+ )), multiple || !multiple && !sources.length && !queue.length ? /* @__PURE__ */ React13__namespace.createElement(
412
+ "label",
413
+ {
414
+ htmlFor: id,
415
+ className: chunkGSOMMLCG_js.cn(
416
+ "sb-flex sb-h-28 sb-w-28 sb-cursor-pointer sb-items-center sb-justify-center sb-rounded-lg sb-border",
417
+ props.itemClassName
418
+ )
419
+ },
420
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.PlusIcon, { className: "sb-h-6 sb-w-6" }),
421
+ /* @__PURE__ */ React13__namespace.createElement(
422
+ "input",
423
+ {
424
+ id,
425
+ type: "file",
426
+ onChange: handleFilesAdd,
427
+ multiple,
428
+ accept: ".png,.jpg,.jpeg,.webp,.gif,.svg",
429
+ className: "sb-hidden"
430
+ }
431
+ )
432
+ ) : null);
433
+ };
434
+ var MediaInputItem = (props) => {
435
+ return /* @__PURE__ */ React13__namespace.createElement(
436
+ "div",
437
+ {
438
+ className: chunkGSOMMLCG_js.cn(
439
+ "sb-relative sb-h-28 sb-w-28 sb-overflow-hidden sb-rounded-lg sb-border",
440
+ props.className
441
+ )
442
+ },
443
+ props.children
444
+ );
445
+ };
446
+ var MediaInputError = class extends Error {
447
+ title;
448
+ description;
449
+ constructor(message, description) {
450
+ super(message);
451
+ this.title = message;
452
+ this.description = description;
453
+ }
454
+ };
455
+
456
+ // src/components/ui/background-picker.tsx
457
+ var BackgroundPicker = (props) => {
458
+ const { background, onBackgroundChange, className } = props;
459
+ const solids = props.solids ?? [
460
+ "#000000",
461
+ "#ffffff",
462
+ "#0f172a",
463
+ "#F1F5F9",
464
+ "#64748B",
465
+ "#E6007E",
466
+ "#F8FAFC",
467
+ "#009DD1",
468
+ "#FF0000"
469
+ ];
470
+ const gradients = props.gradients ?? [
471
+ "linear-gradient(to top left,#accbee,#e7f0fd)",
472
+ "linear-gradient(to top left,#d5d4d0,#d5d4d0,#eeeeec)"
473
+ ];
474
+ const images = props.images ?? [
475
+ "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)",
476
+ "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)"
477
+ ];
478
+ const defaultTab = React13__namespace.useMemo(() => {
479
+ if (background.includes("url"))
480
+ return "image";
481
+ if (background.includes("gradient"))
482
+ return "gradient";
483
+ return "solid";
484
+ }, [background]);
485
+ return /* @__PURE__ */ React13__namespace.createElement(Popover, null, /* @__PURE__ */ React13__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React13__namespace.createElement(
486
+ chunkGSOMMLCG_js.Button,
487
+ {
488
+ variant: "outline",
489
+ size: "sm",
490
+ className: chunkGSOMMLCG_js.cn(
491
+ "sb-justify-start sb-text-left sb-font-normal sb-normal-case sb-w-full",
492
+ !background && "sb-text-muted-foreground",
493
+ className
494
+ )
495
+ },
496
+ /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-w-full sb-flex sb-items-center sb-gap-2" }, background ? /* @__PURE__ */ React13__namespace.createElement(
497
+ "div",
498
+ {
499
+ className: "sb-h-4 sb-w-4 sb-rounded !sb-bg-center !sb-bg-cover sb-transition-all sb-border",
500
+ style: { background }
501
+ }
502
+ ) : /* @__PURE__ */ React13__namespace.createElement(lucideReact.PaintbrushIcon, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-truncate sb-flex-1" }, background ? background : "Kies een achtergrond"))
503
+ )), /* @__PURE__ */ React13__namespace.createElement(PopoverContent, { className: "sb-w-64 sb-p-0" }, /* @__PURE__ */ React13__namespace.createElement(Tabs, { defaultValue: defaultTab }, /* @__PURE__ */ React13__namespace.createElement(TabsList, { className: "sb-w-full" }, /* @__PURE__ */ React13__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "solid" }, "Solid"), /* @__PURE__ */ React13__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "gradient" }, "Gradient"), /* @__PURE__ */ React13__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "image" }, "Image")), /* @__PURE__ */ React13__namespace.createElement(
504
+ TabsContent,
505
+ {
506
+ value: "solid",
507
+ className: "data-[state=active]:sb-flex sb-flex-wrap sb-gap-1 sb-p-4"
508
+ },
509
+ solids.map((s) => /* @__PURE__ */ React13__namespace.createElement(
510
+ "div",
511
+ {
512
+ key: s,
513
+ style: { background: s },
514
+ className: "sb-rounded-md sb-h-6 sb-w-6 sb-cursor-pointer active:sb-scale-105 sb-border",
515
+ onClick: () => onBackgroundChange(s)
516
+ }
517
+ ))
518
+ ), /* @__PURE__ */ React13__namespace.createElement(
519
+ TabsContent,
520
+ {
521
+ value: "gradient",
522
+ className: "data-[state=active]:sb-flex sb-flex-wrap sb-gap-1 sb-p-4"
523
+ },
524
+ gradients.map((s) => /* @__PURE__ */ React13__namespace.createElement(
525
+ "div",
526
+ {
527
+ key: s,
528
+ style: { background: s },
529
+ className: "rounded-md h-6 w-6 cursor-pointer active:scale-105 border",
530
+ onClick: () => onBackgroundChange(s)
531
+ }
532
+ ))
533
+ ), /* @__PURE__ */ React13__namespace.createElement(TabsContent, { value: "image" }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-p-4 sb-border-b" }, /* @__PURE__ */ React13__namespace.createElement(
534
+ MediaInput,
535
+ {
536
+ className: "sb-grid sb-grid-cols-2 sb-gap-1",
537
+ itemClassName: "sb-aspect-video sb-h-auto sb-w-full",
538
+ multiple: false,
539
+ onFilesChange: (files) => {
540
+ if (!files.length)
541
+ return;
542
+ onBackgroundChange(`url(${files[0]})`);
543
+ },
544
+ onError: (e) => console.error(
545
+ "[media-input]: Title: " + e?.title,
546
+ "media-input: Error: " + e?.description
547
+ )
548
+ }
549
+ )), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-gap-1 sb-p-4" }, images.map((s) => /* @__PURE__ */ React13__namespace.createElement(
550
+ "div",
551
+ {
552
+ key: s,
553
+ style: { backgroundImage: s },
554
+ 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",
555
+ onClick: () => onBackgroundChange(s)
556
+ }
557
+ )))))));
558
+ };
559
+ var ColorPicker = (props) => {
560
+ const { color, onColorChange, className } = props;
561
+ const colors = props.colors ?? [
562
+ "#000000",
563
+ "#ffffff",
564
+ "#0f172a",
565
+ "#F1F5F9",
566
+ "#64748B",
567
+ "#E6007E",
568
+ "#F8FAFC",
569
+ "#009DD1",
570
+ "#FF0000"
571
+ ];
572
+ return /* @__PURE__ */ React13__namespace.createElement(Popover, null, /* @__PURE__ */ React13__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React13__namespace.createElement(
573
+ chunkGSOMMLCG_js.Button,
574
+ {
575
+ variant: "outline",
576
+ size: "sm",
577
+ className: chunkGSOMMLCG_js.cn(
578
+ "sb-justify-start sb-text-left sb-font-normal sb-normal-case sb-w-full",
579
+ !color && "sb-text-muted-foreground",
580
+ className
581
+ )
582
+ },
583
+ /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-w-full sb-flex sb-items-center sb-gap-2" }, color ? /* @__PURE__ */ React13__namespace.createElement(
584
+ "div",
585
+ {
586
+ className: "sb-h-4 sb-w-4 sb-rounded !sb-bg-center !sb-bg-cover sb-transition-all sb-border",
587
+ style: { background: color }
588
+ }
589
+ ) : /* @__PURE__ */ React13__namespace.createElement(lucideReact.PaintbrushIcon, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-truncate sb-flex-1" }, color ? color : "Kies een kleur"))
590
+ )), /* @__PURE__ */ React13__namespace.createElement(PopoverContent, { className: "sb-w-64 sb-p-4 sb-flex sb-flex-wrap sb-gap-1" }, colors.map((s) => /* @__PURE__ */ React13__namespace.createElement(
591
+ "div",
592
+ {
593
+ key: s,
594
+ style: { background: s },
595
+ className: "sb-rounded-md sb-h-6 sb-w-6 sb-cursor-pointer active:sb-scale-105 sb-border",
596
+ onClick: () => onColorChange(s)
597
+ }
598
+ ))));
599
+ };
600
+ var Input = React13__namespace.forwardRef(
601
+ ({ className, type, ...props }, ref) => {
602
+ return /* @__PURE__ */ React13__namespace.createElement(
603
+ "input",
604
+ {
605
+ type,
606
+ className: chunkGSOMMLCG_js.cn(
607
+ "sb-flex sb-h-8 sb-w-full sb-font-roboto sb-rounded-md sb-border sb-border-input sb-bg-background sb-px-3 sb-py-1 sb-text-sm sb-ring-offset-background file:sb-border-0 file:sb-bg-transparent file:sb-text-sm file:sb-font-medium placeholder:sb-text-muted-foreground focus-visible:sb-outline-none focus-visible:sb-ring-1 focus-visible:ring-sb-ring focus-visible:sb-ring-offset-2 disabled:sb-cursor-not-allowed disabled:sb-opacity-50",
608
+ className
609
+ ),
610
+ ref,
611
+ ...props
612
+ }
613
+ );
614
+ }
615
+ );
616
+ Input.displayName = "Input";
617
+ var AdvancedInput = React13__namespace.forwardRef(
618
+ ({ prepend, append, ...props }, ref) => {
619
+ return /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-relative" }, /* @__PURE__ */ React13__namespace.createElement(Input, { ref, className: "sb-pl-9 sb-pr-7 sb-text-right", ...props }), prepend && /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-absolute sb-font-roboto sb-top-1/2 sb-left-3 sb--translate-y-1/2" }, prepend), append && /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-absolute sb-font-roboto sb-top-1/2 sb-right-3 sb--translate-y-1/2" }, append));
620
+ }
621
+ );
622
+ AdvancedInput.displayName = "AdvancedInput";
623
+ var Switch = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
624
+ SwitchPrimitives__namespace.Root,
625
+ {
626
+ className: chunkGSOMMLCG_js.cn(
627
+ "peer sb-inline-flex sb-h-6 sb-w-11 sb-shrink-0 sb-cursor-pointer sb-items-center sb-rounded-full sb-border-2 sb-border-transparent 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",
628
+ className
629
+ ),
630
+ ...props,
631
+ ref
632
+ },
633
+ /* @__PURE__ */ React13__namespace.createElement(
634
+ SwitchPrimitives__namespace.Thumb,
635
+ {
636
+ className: chunkGSOMMLCG_js.cn(
637
+ "sb-pointer-events-none sb-block sb-h-5 sb-w-5 sb-rounded-full sb-bg-background sb-shadow-lg sb-ring-0 sb-transition-transform data-[state=checked]:sb-translate-x-5 data-[state=unchecked]:sb-translate-x-0"
638
+ )
639
+ }
640
+ )
641
+ ));
642
+ Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
643
+ var toggleVariants = classVarianceAuthority.cva(
644
+ "sb-inline-flex sb-items-center sb-justify-center sb-rounded-md sb-text-sm sb-font-medium sb-ring-offset-background 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 focus-visible:sb-ring-offset-2 disabled:sb-pointer-events-none disabled:sb-opacity-50 data-[state=on]:sb-bg-accent data-[state=on]:sb-text-accent-foreground",
645
+ {
646
+ variants: {
647
+ variant: {
648
+ default: "sb-bg-transparent",
649
+ outline: "sb-border sb-border-input sb-bg-transparent hover:sb-bg-accent hover:sb-text-accent-foreground"
650
+ },
651
+ size: {
652
+ default: "sb-h-10 sb-px-3",
653
+ sm: "sb-h-9 sb-px-2.5",
654
+ lg: "sb-h-11 sb-px-5"
655
+ }
656
+ },
657
+ defaultVariants: {
658
+ variant: "default",
659
+ size: "default"
660
+ }
661
+ }
662
+ );
663
+ var Toggle = React13__namespace.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ React13__namespace.createElement(
664
+ TogglePrimitive__namespace.Root,
665
+ {
666
+ ref,
667
+ className: chunkGSOMMLCG_js.cn(toggleVariants({ variant, size, className })),
668
+ ...props
669
+ }
670
+ ));
671
+ Toggle.displayName = TogglePrimitive__namespace.Root.displayName;
672
+
673
+ // src/components/item-design-form.tsx
674
+ var spacingSchema = zod.z.discriminatedUnion("indipendent", [
675
+ zod.z.object({
676
+ indipendent: zod.z.literal(false),
677
+ horizontal: zod.z.coerce.number(),
678
+ vertical: zod.z.coerce.number()
679
+ }),
680
+ zod.z.object({
681
+ indipendent: zod.z.literal(true),
682
+ left: zod.z.coerce.number(),
683
+ right: zod.z.coerce.number(),
684
+ top: zod.z.coerce.number(),
685
+ bottom: zod.z.coerce.number()
686
+ })
687
+ ]);
688
+ var designSchema = zod.z.object({
689
+ container: zod.z.boolean(),
690
+ background: zod.z.string(),
691
+ color: zod.z.string(),
692
+ padding: spacingSchema,
693
+ margin: spacingSchema
694
+ });
695
+ var ItemDesignForm = (props) => {
696
+ const { item } = props;
697
+ const { patchItem } = chunkGSOMMLCG_js.useBuilder();
698
+ const initialPadding = chunkGSOMMLCG_js.spacing.parse(item.styles?.padding ?? "");
699
+ const initialMargin = chunkGSOMMLCG_js.spacing.parse(item.styles?.margin ?? "");
700
+ const form = reactHookForm.useForm({
701
+ resolver: zod$1.zodResolver(designSchema),
702
+ defaultValues: {
703
+ container: item.styles?.container ?? true,
704
+ background: item.styles?.background ?? "",
705
+ color: item.styles?.color ?? "",
706
+ padding: {
707
+ indipendent: chunkGSOMMLCG_js.spacing.isIndipendent(
708
+ item.styles?.padding ?? ""
709
+ ),
710
+ horizontal: initialPadding.left,
711
+ vertical: initialPadding.top,
712
+ left: initialPadding.left,
713
+ right: initialPadding.right,
714
+ top: initialPadding.top,
715
+ bottom: initialPadding.bottom
716
+ },
717
+ margin: {
718
+ indipendent: chunkGSOMMLCG_js.spacing.isIndipendent(
719
+ item.styles?.margin ?? ""
720
+ ),
721
+ horizontal: initialMargin.left,
722
+ vertical: initialMargin.top,
723
+ left: initialMargin.left,
724
+ right: initialMargin.right,
725
+ top: initialMargin.top,
726
+ bottom: initialMargin.bottom
727
+ }
728
+ }
729
+ });
730
+ const onSubmit = (values) => {
731
+ const { container, background, color, padding: p, margin: m } = values;
732
+ const padding = !p.indipendent ? `${p.vertical}px ${p.horizontal}px` : `${p.top}px ${p.right}px ${p.bottom}px ${p.left}px`;
733
+ const margin = !m.indipendent ? `${m.vertical}px ${m.horizontal}px` : `${m.top}px ${m.right}px ${m.bottom}px ${m.left}px`;
734
+ patchItem(item.id, {
735
+ styles: {
736
+ container,
737
+ background,
738
+ color,
739
+ padding,
740
+ margin
741
+ }
742
+ });
743
+ };
744
+ React13__namespace.useEffect(() => {
745
+ const subscription = form.watch(() => form.handleSubmit(onSubmit)());
746
+ return () => subscription.unsubscribe();
747
+ }, [form.watch, form.handleSubmit]);
748
+ const [indipendentPadding, indipendentMargin] = form.watch([
749
+ "padding.indipendent",
750
+ "margin.indipendent"
751
+ ]);
752
+ return /* @__PURE__ */ React13__namespace.createElement(Form, { ...form }, /* @__PURE__ */ React13__namespace.createElement("form", { onSubmit: form.handleSubmit(onSubmit) }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-space-y-4 sb-p-4" }, /* @__PURE__ */ React13__namespace.createElement(
753
+ FormField,
754
+ {
755
+ control: form.control,
756
+ name: "background",
757
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, "Achtergrond"), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
758
+ BackgroundPicker,
759
+ {
760
+ background: field.value,
761
+ onBackgroundChange: field.onChange
762
+ }
763
+ )), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null))
764
+ }
765
+ ), /* @__PURE__ */ React13__namespace.createElement(
766
+ FormField,
767
+ {
768
+ control: form.control,
769
+ name: "color",
770
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, "Inhoud kleur"), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
771
+ ColorPicker,
772
+ {
773
+ color: field.value,
774
+ onColorChange: field.onChange
775
+ }
776
+ )), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null))
777
+ }
778
+ ), /* @__PURE__ */ React13__namespace.createElement("hr", null), /* @__PURE__ */ React13__namespace.createElement(
779
+ FormField,
780
+ {
781
+ control: form.control,
782
+ name: "container",
783
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, { className: "sb-flex sb-flex-row sb-items-center sb-justify-between sb-space-y-0" }, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, "Volledige breedte"), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
784
+ Switch,
785
+ {
786
+ checked: !field.value,
787
+ onCheckedChange: (v) => field.onChange(!v)
788
+ }
789
+ )), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null))
790
+ }
791
+ ), /* @__PURE__ */ React13__namespace.createElement("hr", null), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-space-y-2" }, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, "Padding"), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-grid sb-grid-cols-[1fr,auto] sb-gap-3" }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-items-center sb-gap-3" }, !indipendentPadding ? /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement(
792
+ FormField,
793
+ {
794
+ control: form.control,
795
+ name: "padding.horizontal",
796
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
797
+ AdvancedInput,
798
+ {
799
+ ...field,
800
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
801
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
802
+ }
803
+ )))
804
+ }
805
+ ), /* @__PURE__ */ React13__namespace.createElement(
806
+ FormField,
807
+ {
808
+ control: form.control,
809
+ name: "padding.vertical",
810
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
811
+ AdvancedInput,
812
+ {
813
+ ...field,
814
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
815
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
816
+ }
817
+ )))
818
+ }
819
+ )) : /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement(
820
+ FormField,
821
+ {
822
+ control: form.control,
823
+ name: "padding.left",
824
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
825
+ AdvancedInput,
826
+ {
827
+ ...field,
828
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
829
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
830
+ }
831
+ )))
832
+ }
833
+ ), /* @__PURE__ */ React13__namespace.createElement(
834
+ FormField,
835
+ {
836
+ control: form.control,
837
+ name: "padding.top",
838
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
839
+ AdvancedInput,
840
+ {
841
+ ...field,
842
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
843
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
844
+ }
845
+ )))
846
+ }
847
+ ), /* @__PURE__ */ React13__namespace.createElement(
848
+ FormField,
849
+ {
850
+ control: form.control,
851
+ name: "padding.right",
852
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
853
+ AdvancedInput,
854
+ {
855
+ ...field,
856
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
857
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
858
+ }
859
+ )))
860
+ }
861
+ ), /* @__PURE__ */ React13__namespace.createElement(
862
+ FormField,
863
+ {
864
+ control: form.control,
865
+ name: "padding.bottom",
866
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
867
+ AdvancedInput,
868
+ {
869
+ ...field,
870
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
871
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
872
+ }
873
+ )))
874
+ }
875
+ ))), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React13__namespace.createElement(
876
+ FormField,
877
+ {
878
+ control: form.control,
879
+ name: "padding.indipendent",
880
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
881
+ Toggle,
882
+ {
883
+ className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
884
+ variant: "outline",
885
+ size: "sm",
886
+ pressed: field.value,
887
+ onPressedChange: field.onChange
888
+ },
889
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.ScanIcon, { className: "sb-h-4 sb-w-4" })
890
+ ))
891
+ }
892
+ ))), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null)), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-space-y-2" }, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, "Margin"), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-grid sb-grid-cols-[1fr,auto] sb-gap-3" }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-items-center sb-gap-3" }, !indipendentMargin ? /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement(
893
+ FormField,
894
+ {
895
+ control: form.control,
896
+ name: "margin.horizontal",
897
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
898
+ AdvancedInput,
899
+ {
900
+ ...field,
901
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
902
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
903
+ }
904
+ )))
905
+ }
906
+ ), /* @__PURE__ */ React13__namespace.createElement(
907
+ FormField,
908
+ {
909
+ control: form.control,
910
+ name: "margin.vertical",
911
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
912
+ AdvancedInput,
913
+ {
914
+ ...field,
915
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
916
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
917
+ }
918
+ )))
919
+ }
920
+ )) : /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement(
921
+ FormField,
922
+ {
923
+ control: form.control,
924
+ name: "margin.left",
925
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
926
+ AdvancedInput,
927
+ {
928
+ ...field,
929
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
930
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
931
+ }
932
+ )))
933
+ }
934
+ ), /* @__PURE__ */ React13__namespace.createElement(
935
+ FormField,
936
+ {
937
+ control: form.control,
938
+ name: "margin.top",
939
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
940
+ AdvancedInput,
941
+ {
942
+ ...field,
943
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
944
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
945
+ }
946
+ )))
947
+ }
948
+ ), /* @__PURE__ */ React13__namespace.createElement(
949
+ FormField,
950
+ {
951
+ control: form.control,
952
+ name: "margin.right",
953
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
954
+ AdvancedInput,
955
+ {
956
+ ...field,
957
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
958
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
959
+ }
960
+ )))
961
+ }
962
+ ), /* @__PURE__ */ React13__namespace.createElement(
963
+ FormField,
964
+ {
965
+ control: form.control,
966
+ name: "margin.bottom",
967
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
968
+ AdvancedInput,
969
+ {
970
+ ...field,
971
+ prepend: /* @__PURE__ */ React13__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
972
+ append: /* @__PURE__ */ React13__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
973
+ }
974
+ )))
975
+ }
976
+ ))), /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React13__namespace.createElement(
977
+ FormField,
978
+ {
979
+ control: form.control,
980
+ name: "margin.indipendent",
981
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
982
+ Toggle,
983
+ {
984
+ className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
985
+ variant: "outline",
986
+ size: "sm",
987
+ pressed: field.value,
988
+ onPressedChange: field.onChange
989
+ },
990
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.ScanIcon, { className: "sb-h-4 sb-w-4" })
991
+ ))
992
+ }
993
+ ))), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null)))));
994
+ };
995
+ function Calendar({
996
+ className,
997
+ classNames,
998
+ showOutsideDays = true,
999
+ ...props
1000
+ }) {
1001
+ return /* @__PURE__ */ React13__namespace.createElement(
1002
+ reactDayPicker.DayPicker,
1003
+ {
1004
+ showOutsideDays,
1005
+ className: chunkGSOMMLCG_js.cn("sb-p-3 sb-font-roboto", className),
1006
+ classNames: {
1007
+ months: "sb-flex sb-flex-col sm:sb-flex-row sb-space-y-4 sm:sb-space-x-4 sm:sb-space-y-0",
1008
+ month: "sb-space-y-4",
1009
+ caption: "sb-flex sb-justify-center sb-pt-1 sb-relative sb-items-center",
1010
+ caption_label: "sb-text-sm sb-font-medium",
1011
+ nav: "sb-space-x-1 sb-flex sb-items-center",
1012
+ nav_button: chunkGSOMMLCG_js.cn(
1013
+ chunkGSOMMLCG_js.buttonVariants({ variant: "outline" }),
1014
+ "sb-h-7 sb-w-7 sb-bg-transparent sb-p-0 sb-opacity-50 hover:sb-opacity-100"
1015
+ ),
1016
+ nav_button_previous: "sb-absolute sb-left-1",
1017
+ nav_button_next: "sb-absolute sb-right-1",
1018
+ table: "sb-w-full sb-border-collapse sb-space-y-1",
1019
+ head_row: "sb-flex",
1020
+ head_cell: "sb-text-muted-foreground sb-rounded-md sb-w-8 sb-font-normal sb-text-[0.8rem]",
1021
+ row: "sb-flex sb-w-full sb-mt-2",
1022
+ cell: chunkGSOMMLCG_js.cn(
1023
+ "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",
1024
+ 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"
1025
+ ),
1026
+ day: chunkGSOMMLCG_js.cn(
1027
+ chunkGSOMMLCG_js.buttonVariants({ variant: "ghost" }),
1028
+ "sb-h-8 sb-w-8 sb-p-0 sb-font-normal aria-selected:sb-opacity-100"
1029
+ ),
1030
+ day_range_start: "day-range-start",
1031
+ day_range_end: "day-range-end",
1032
+ 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",
1033
+ day_today: "sb-bg-accent sb-text-accent-foreground",
1034
+ 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",
1035
+ day_disabled: "sb-text-muted-foreground sb-opacity-50",
1036
+ day_range_middle: "aria-selected:sb-bg-accent aria-selected:sb-text-accent-foreground",
1037
+ day_hidden: "invisible",
1038
+ ...classNames
1039
+ },
1040
+ components: {
1041
+ IconLeft: () => /* @__PURE__ */ React13__namespace.createElement(lucideReact.ChevronLeftIcon, { className: "sb-h-4 sb-w-4" }),
1042
+ IconRight: () => /* @__PURE__ */ React13__namespace.createElement(lucideReact.ChevronRightIcon, { className: "sb-h-4 sb-w-4" })
1043
+ },
1044
+ ...props
1045
+ }
1046
+ );
1047
+ }
1048
+ Calendar.displayName = "Calendar";
1049
+ var Textarea = React13__namespace.forwardRef(
1050
+ ({ className, ...props }, ref) => {
1051
+ return /* @__PURE__ */ React13__namespace.createElement(
1052
+ "textarea",
1053
+ {
1054
+ className: chunkGSOMMLCG_js.cn(
1055
+ "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",
1056
+ className
1057
+ ),
1058
+ ref,
1059
+ ...props
1060
+ }
1061
+ );
1062
+ }
1063
+ );
1064
+ Textarea.displayName = "Textarea";
1065
+
1066
+ // src/components/container-item-form.tsx
1067
+ var ContainerItemForm = (props) => {
1068
+ const { item } = props;
1069
+ const { patchItem } = chunkGSOMMLCG_js.useBuilder();
1070
+ const component = chunkUZFAGH6G_js.builder.getComponent(item.component);
1071
+ if (!component) {
1072
+ throw new Error(
1073
+ `[simple-builder]: Component with id ${item.component} not found in container item form component`
1074
+ );
1075
+ }
1076
+ const form = reactHookForm.useForm({
1077
+ defaultValues: (component.inputs || []).reduce(
1078
+ (acc, input) => ({
1079
+ ...acc,
1080
+ [input.name]: item?.props?.[input.name] ?? input.defaultValue
1081
+ }),
1082
+ {}
1083
+ )
1084
+ });
1085
+ const onSubmit = (values) => {
1086
+ patchItem(item.id, {
1087
+ props: values
1088
+ });
1089
+ };
1090
+ React13__namespace.useEffect(() => {
1091
+ const subscription = form.watch(() => form.handleSubmit(onSubmit)());
1092
+ return () => subscription.unsubscribe();
1093
+ }, [form.watch, form.handleSubmit]);
1094
+ return /* @__PURE__ */ React13__namespace.createElement(Form, { ...form }, /* @__PURE__ */ React13__namespace.createElement("form", { onSubmit: form.handleSubmit(onSubmit) }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-space-y-4 sb-p-4" }, (component.inputs || []).map((input) => /* @__PURE__ */ React13__namespace.createElement(
1095
+ FormField,
1096
+ {
1097
+ key: input.name,
1098
+ control: form.control,
1099
+ name: input.name,
1100
+ render: ({ field }) => /* @__PURE__ */ React13__namespace.createElement(RenderInput, { type: input.type, input, field })
1101
+ }
1102
+ )))));
1103
+ };
1104
+ var RenderInput = (props) => {
1105
+ const { type, input, field } = props;
1106
+ switch (type) {
1107
+ case "string":
1108
+ return /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(Input, { ...field })), input.helperText && /* @__PURE__ */ React13__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null));
1109
+ case "longText":
1110
+ return /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(Textarea, { ...field })), input.helperText && /* @__PURE__ */ React13__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null));
1111
+ case "richText":
1112
+ return /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(Textarea, { ...field })), input.helperText && /* @__PURE__ */ React13__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null));
1113
+ case "number":
1114
+ return /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(Input, { type: "number", ...field })), input.helperText && /* @__PURE__ */ React13__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null));
1115
+ case "color":
1116
+ return /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(ColorPicker, { color: field.value, onColorChange: field.onChange })), input.helperText && /* @__PURE__ */ React13__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null));
1117
+ case "date":
1118
+ return /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(Popover, null, /* @__PURE__ */ React13__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React13__namespace.createElement(
1119
+ chunkGSOMMLCG_js.Button,
1120
+ {
1121
+ variant: "outline",
1122
+ size: "sm",
1123
+ className: chunkGSOMMLCG_js.cn(
1124
+ "sb-w-full sb-flex sb-justify-start sb-text-left sb-font-normal",
1125
+ !field.value && "sb-text-muted-foreground"
1126
+ )
1127
+ },
1128
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.CalendarIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
1129
+ field.value ? dateFns.format(field.value, "PPP") : /* @__PURE__ */ React13__namespace.createElement("span", null, "Pick a date")
1130
+ )), /* @__PURE__ */ React13__namespace.createElement(PopoverContent, { className: "sb-w-auto sb-p-0", align: "start" }, /* @__PURE__ */ React13__namespace.createElement(
1131
+ Calendar,
1132
+ {
1133
+ mode: "single",
1134
+ selected: field.value,
1135
+ onSelect: field.onChange,
1136
+ initialFocus: true
1137
+ }
1138
+ )))), input.helperText && /* @__PURE__ */ React13__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null));
1139
+ case "boolean":
1140
+ return /* @__PURE__ */ React13__namespace.createElement(FormItem, { className: "sb-flex sb-flex-row sb-items-center sb-justify-between sb-space-y-0" }, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(Switch, { checked: field.value, onCheckedChange: field.onChange })), input.helperText && /* @__PURE__ */ React13__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null));
1141
+ case "file":
1142
+ return /* @__PURE__ */ React13__namespace.createElement(FormItem, null, /* @__PURE__ */ React13__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React13__namespace.createElement(FormControl, null, /* @__PURE__ */ React13__namespace.createElement(
1143
+ MediaInput,
1144
+ {
1145
+ className: "sb-grid sb-grid-cols-2 sb-gap-1",
1146
+ itemClassName: "sb-aspect-video sb-h-auto sb-w-full",
1147
+ multiple: false,
1148
+ onFilesChange: (files) => field.onChange(files[0]),
1149
+ onError: (e) => console.error(
1150
+ "[media-input]: Title: " + e?.title,
1151
+ "media-input: Error: " + e?.description
1152
+ )
1153
+ }
1154
+ )), input.helperText && /* @__PURE__ */ React13__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React13__namespace.createElement(FormMessage, null));
1155
+ default:
1156
+ throw new Error(
1157
+ `[simple-builder]: Input type "${props.type}" not supported`
1158
+ );
1159
+ }
1160
+ };
1161
+
1162
+ // src/components/container-item-toolbar.tsx
1163
+ var ContainerItemToolbar = (props) => {
1164
+ const { contentId, canBringUp = false, canBringDown = false } = props;
1165
+ const { bringUp, bringDown } = chunkGSOMMLCG_js.useBuilder();
1166
+ return /* @__PURE__ */ React13__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__ */ React13__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__ */ React13__namespace.createElement(EditButton, { id: contentId }), /* @__PURE__ */ React13__namespace.createElement(
1167
+ chunkGSOMMLCG_js.Button,
1168
+ {
1169
+ variant: "ghost",
1170
+ className: "sb-w-8 sb-h-8 sb-p-0",
1171
+ onClick: () => bringUp(contentId),
1172
+ disabled: !canBringUp
1173
+ },
1174
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.ArrowUp, { className: "sb-h-5 sb-w-5" })
1175
+ ), /* @__PURE__ */ React13__namespace.createElement(
1176
+ chunkGSOMMLCG_js.Button,
1177
+ {
1178
+ variant: "ghost",
1179
+ className: "sb-w-8 sb-h-8 sb-p-0",
1180
+ onClick: () => bringDown(contentId),
1181
+ disabled: !canBringDown
1182
+ },
1183
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.ArrowDown, { className: "sb-h-5 sb-w-5" })
1184
+ ), /* @__PURE__ */ React13__namespace.createElement(DeleteButton, { contentId })));
1185
+ };
1186
+ var EditButton = ({ id }) => {
1187
+ return /* @__PURE__ */ React13__namespace.createElement(Popover, null, /* @__PURE__ */ React13__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React13__namespace.createElement(chunkGSOMMLCG_js.Button, { variant: "ghost", className: "sb-w-8 sb-h-8 sb-p-0" }, /* @__PURE__ */ React13__namespace.createElement(lucideReact.Edit2Icon, { className: "sb-h-5 sb-w-5" }))), /* @__PURE__ */ React13__namespace.createElement(
1188
+ PopoverContent,
1189
+ {
1190
+ side: "left",
1191
+ align: "start",
1192
+ sideOffset: 16,
1193
+ alignOffset: -8,
1194
+ className: "sb-p-0",
1195
+ collisionPadding: 16
1196
+ },
1197
+ /* @__PURE__ */ React13__namespace.createElement(EditPopoverInner, { id })
1198
+ ));
1199
+ };
1200
+ var EditPopoverInner = (props) => {
1201
+ const { id } = props;
1202
+ const { getItem } = chunkGSOMMLCG_js.useBuilder();
1203
+ const item = getItem(id);
1204
+ if (!item) {
1205
+ throw new Error(
1206
+ `[simple-builder]: Item with id ${id} not found in container item form component`
1207
+ );
1208
+ }
1209
+ return /* @__PURE__ */ React13__namespace.createElement(Tabs, null, /* @__PURE__ */ React13__namespace.createElement(TabsList, { defaultValue: "content" }, /* @__PURE__ */ React13__namespace.createElement(TabsTrigger, { value: "content" }, "Inhoud"), /* @__PURE__ */ React13__namespace.createElement(TabsTrigger, { value: "design" }, "Design")), /* @__PURE__ */ React13__namespace.createElement(TabsContent, { value: "content" }, /* @__PURE__ */ React13__namespace.createElement(ContainerItemForm, { item })), /* @__PURE__ */ React13__namespace.createElement(TabsContent, { value: "design" }, /* @__PURE__ */ React13__namespace.createElement(ItemDesignForm, { item })));
1210
+ };
1211
+ var DeleteButton = ({ contentId }) => {
1212
+ const { deleteContent } = chunkGSOMMLCG_js.useBuilder();
1213
+ return /* @__PURE__ */ React13__namespace.createElement(AlertDialog, null, /* @__PURE__ */ React13__namespace.createElement(AlertDialogTrigger, { asChild: true }, /* @__PURE__ */ React13__namespace.createElement(
1214
+ chunkGSOMMLCG_js.Button,
1215
+ {
1216
+ variant: "ghost",
1217
+ className: "sb-w-8 sb-h-8 sb-p-0 sb-text-destructive"
1218
+ },
1219
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.Trash2Icon, { className: "sb-h-5 sb-w-5" })
1220
+ )), /* @__PURE__ */ React13__namespace.createElement(AlertDialogContent, null, /* @__PURE__ */ React13__namespace.createElement(AlertDialogDescription, null, "Weet je zeker dat je dit blok wilt verwijderen?"), /* @__PURE__ */ React13__namespace.createElement(AlertDialogFooter, null, /* @__PURE__ */ React13__namespace.createElement(AlertDialogCancel, null, "Annuleren"), /* @__PURE__ */ React13__namespace.createElement(
1221
+ AlertDialogAction,
1222
+ {
1223
+ className: chunkGSOMMLCG_js.buttonVariants({ variant: "destructive" }),
1224
+ onClick: () => deleteContent(contentId)
1225
+ },
1226
+ "Verwijderen"
1227
+ ))));
1228
+ };
1229
+ var DesignWrapper = (props) => {
1230
+ const { children, className, styles } = props;
1231
+ const { container = true, background, ...rest } = styles || {};
1232
+ const matches = typeof background === "string" ? background.match(/url\(["']?(.*?)["']?\)/) : void 0;
1233
+ const src = matches ? matches[1] : void 0;
1234
+ return /* @__PURE__ */ React13__namespace.createElement(
1235
+ "div",
1236
+ {
1237
+ className: chunkGSOMMLCG_js.cn("sb-relative", className),
1238
+ style: { ...!src && { background }, ...rest }
1239
+ },
1240
+ src && /* @__PURE__ */ React13__namespace.createElement(
1241
+ Image,
1242
+ {
1243
+ src,
1244
+ alt: "",
1245
+ fill: true,
1246
+ className: "sb-object-cover sb-absolute sb-inset-0 sb-pointer-events-none sb--z-[1]"
1247
+ }
1248
+ ),
1249
+ container ? /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-container sb-mx-auto" }, children) : children
1250
+ );
1251
+ };
1252
+
1253
+ // src/components/build-container-client.tsx
1254
+ var BuildContainerInner = (props) => {
1255
+ const { id, name, content, multiple = false } = props;
1256
+ const items = Array.isArray(content) ? content : content?.[name] || [];
1257
+ if (!multiple && items.length > 1) {
1258
+ console.error(
1259
+ "[simple-builder]: Multiple content blocks detected when using property multiple false."
1260
+ );
1261
+ }
1262
+ return /* @__PURE__ */ React13__namespace.createElement("div", null, items.length <= 0 ? /* @__PURE__ */ React13__namespace.createElement(AddContentPlaceholder, { parent: id, container: name, index: 0 }) : multiple && /* @__PURE__ */ React13__namespace.createElement(AddContentDividerButton, { parent: id, container: name, index: 0 }), items.map((item, i) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, { key: item.id }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-relative sb-container-item" }, /* @__PURE__ */ React13__namespace.createElement(DesignWrapper, { styles: item.styles }, chunkUZFAGH6G_js.builder.bindComponent(item, true)), /* @__PURE__ */ React13__namespace.createElement(
1263
+ ContainerItemToolbar,
1264
+ {
1265
+ contentId: item.id,
1266
+ canBringUp: i > 0,
1267
+ canBringDown: i < items.length - 1
1268
+ }
1269
+ )), multiple && /* @__PURE__ */ React13__namespace.createElement(
1270
+ AddContentDividerButton,
1271
+ {
1272
+ parent: id,
1273
+ container: name,
1274
+ index: i + 1
1275
+ }
1276
+ ))));
1277
+ };
1278
+ var build_container_client_default = BuildContainerInner;
1279
+ var AddContentButton = (props) => {
1280
+ const components = chunkUZFAGH6G_js.builder.getComponents();
1281
+ const { addContent } = chunkGSOMMLCG_js.useBuilder();
1282
+ return /* @__PURE__ */ React13__namespace.createElement(Popover, null, /* @__PURE__ */ React13__namespace.createElement(PopoverTrigger, { asChild: true }, props.children), /* @__PURE__ */ React13__namespace.createElement(PopoverContent, { className: "sb-p-1" }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-gap-2" }, components.map((component) => {
1283
+ const Icon = component.icon ?? lucideReact.ImageIcon;
1284
+ return /* @__PURE__ */ React13__namespace.createElement(PopoverClose, { key: component.name, asChild: true }, /* @__PURE__ */ React13__namespace.createElement(
1285
+ chunkGSOMMLCG_js.Button,
1286
+ {
1287
+ variant: "ghost",
1288
+ className: "sb-justify-start",
1289
+ onClick: () => {
1290
+ addContent(
1291
+ component.name,
1292
+ props.container,
1293
+ props.parent,
1294
+ props.index
1295
+ );
1296
+ }
1297
+ },
1298
+ /* @__PURE__ */ React13__namespace.createElement(Icon, { className: "sb-mr-2 sb-h-4 sb-w-4 sb-shrink-0" }),
1299
+ component.friendlyName ?? component.name
1300
+ ));
1301
+ }))));
1302
+ };
1303
+ var AddContentPlaceholder = (props) => {
1304
+ return /* @__PURE__ */ React13__namespace.createElement(AddContentButton, { ...props }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "sb-flex sb-justify-center sb-bg-primary/50 p-4" }, /* @__PURE__ */ React13__namespace.createElement(chunkGSOMMLCG_js.Button, { size: "sm" }, /* @__PURE__ */ React13__namespace.createElement(lucideReact.PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }), "Blok Toevoegen")));
1305
+ };
1306
+ var AddContentDividerButton = (props) => {
1307
+ return /* @__PURE__ */ React13__namespace.createElement(AddContentButton, { ...props }, /* @__PURE__ */ React13__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__ */ React13__namespace.createElement(
1308
+ chunkGSOMMLCG_js.Button,
1309
+ {
1310
+ size: "sm",
1311
+ className: "sb-absolute sb-left-1/2 sb-top-1/2 sb--translate-y-1/2 sb--translate-x-1/2 sb-shadow"
1312
+ },
1313
+ /* @__PURE__ */ React13__namespace.createElement(lucideReact.PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
1314
+ "Blok Toevoegen"
1315
+ )));
1316
+ };
1317
+
1318
+ module.exports = build_container_client_default;