@simple-builder/react 1.0.8 → 1.0.9

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