@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.
- package/dist/{build-container-client-TRHCXW7W.mjs → build-container-client-BOFDDL56.mjs} +310 -424
- package/dist/build-container-client-PB2K64X3.js +1258 -0
- package/dist/{builder-content-WVKVDIRR.mjs → builder-content-DNX5TNK2.mjs} +2 -2
- package/dist/{builder-content-XAIOE6LA.js → builder-content-SSON3UB4.js} +7 -7
- package/dist/{chunk-4Z4JII4A.mjs → chunk-2GQCSML3.mjs} +2 -4
- package/dist/{chunk-LJSVUW4D.js → chunk-ECJUPPTG.js} +1 -45
- package/dist/{chunk-EFA2EAPD.mjs → chunk-LULPEBSO.mjs} +2 -2
- package/dist/{chunk-S3NVED5S.mjs → chunk-OCMLPCSW.mjs} +2 -45
- package/dist/{chunk-MSCSJUNQ.js → chunk-VFH3LVDU.js} +3 -3
- package/dist/{chunk-I2LWMDYD.js → chunk-YGI2WZVP.js} +6 -8
- package/dist/index.js +6 -6
- package/dist/index.mjs +2 -2
- package/package.json +6 -6
- package/dist/build-container-client-64PFJ5XN.js +0 -1372
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import './chunk-
|
|
3
|
-
import { buttonVariants, Button, useBuilder } from './chunk-
|
|
4
|
-
import { cn, tv, DesignWrapper, builder, Image
|
|
5
|
-
import * as
|
|
6
|
-
import { PlusIcon, ArrowUp, ArrowDown, Edit2Icon, Trash2Icon, ImageIcon, CalendarIcon, MonitorIcon, SmartphoneIcon,
|
|
2
|
+
import './chunk-LULPEBSO.mjs';
|
|
3
|
+
import { buttonVariants, Button, useBuilder } from './chunk-2GQCSML3.mjs';
|
|
4
|
+
import { cn, tv, DesignWrapper, builder, Image } from './chunk-OCMLPCSW.mjs';
|
|
5
|
+
import * as React11 from 'react';
|
|
6
|
+
import { PlusIcon, ArrowUp, ArrowDown, Edit2Icon, Trash2Icon, ImageIcon, CalendarIcon, MonitorIcon, SmartphoneIcon, ChevronLeftIcon, ChevronRightIcon, PaintbrushIcon, Loader2Icon, AlignHorizontalSpaceAroundIcon, AlignHorizontalJustifyStartIcon, ScanIcon } from 'lucide-react';
|
|
7
7
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
8
8
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
9
9
|
import { format } from 'date-fns';
|
|
@@ -20,7 +20,7 @@ import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
|
20
20
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
21
21
|
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
22
22
|
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
23
|
-
var AlertDialogOverlay =
|
|
23
|
+
var AlertDialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
24
24
|
AlertDialogPrimitive.Overlay,
|
|
25
25
|
{
|
|
26
26
|
className: cn(
|
|
@@ -32,7 +32,7 @@ var AlertDialogOverlay = React15.forwardRef(({ className, ...props }, ref) => /*
|
|
|
32
32
|
}
|
|
33
33
|
));
|
|
34
34
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
35
|
-
var AlertDialogContent =
|
|
35
|
+
var AlertDialogContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(AlertDialogPortal, null, /* @__PURE__ */ React11.createElement(AlertDialogOverlay, null), /* @__PURE__ */ React11.createElement(
|
|
36
36
|
AlertDialogPrimitive.Content,
|
|
37
37
|
{
|
|
38
38
|
ref,
|
|
@@ -47,7 +47,7 @@ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
|
47
47
|
var AlertDialogFooter = ({
|
|
48
48
|
className,
|
|
49
49
|
...props
|
|
50
|
-
}) => /* @__PURE__ */
|
|
50
|
+
}) => /* @__PURE__ */ React11.createElement(
|
|
51
51
|
"div",
|
|
52
52
|
{
|
|
53
53
|
className: cn(
|
|
@@ -58,7 +58,7 @@ var AlertDialogFooter = ({
|
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
61
|
-
var AlertDialogTitle =
|
|
61
|
+
var AlertDialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
62
62
|
AlertDialogPrimitive.Title,
|
|
63
63
|
{
|
|
64
64
|
ref,
|
|
@@ -67,7 +67,7 @@ var AlertDialogTitle = React15.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
67
67
|
}
|
|
68
68
|
));
|
|
69
69
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
70
|
-
var AlertDialogDescription =
|
|
70
|
+
var AlertDialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
71
71
|
AlertDialogPrimitive.Description,
|
|
72
72
|
{
|
|
73
73
|
ref,
|
|
@@ -76,7 +76,7 @@ var AlertDialogDescription = React15.forwardRef(({ className, ...props }, ref) =
|
|
|
76
76
|
}
|
|
77
77
|
));
|
|
78
78
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
79
|
-
var AlertDialogAction =
|
|
79
|
+
var AlertDialogAction = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
80
80
|
AlertDialogPrimitive.Action,
|
|
81
81
|
{
|
|
82
82
|
ref,
|
|
@@ -85,7 +85,7 @@ var AlertDialogAction = React15.forwardRef(({ className, ...props }, ref) => /*
|
|
|
85
85
|
}
|
|
86
86
|
));
|
|
87
87
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
88
|
-
var AlertDialogCancel =
|
|
88
|
+
var AlertDialogCancel = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
89
89
|
AlertDialogPrimitive.Cancel,
|
|
90
90
|
{
|
|
91
91
|
ref,
|
|
@@ -101,7 +101,7 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
|
101
101
|
var Popover = PopoverPrimitive.Root;
|
|
102
102
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
103
103
|
var PopoverClose = PopoverPrimitive.Close;
|
|
104
|
-
var PopoverContent =
|
|
104
|
+
var PopoverContent = React11.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React11.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React11.createElement(
|
|
105
105
|
PopoverPrimitive.Content,
|
|
106
106
|
{
|
|
107
107
|
ref,
|
|
@@ -121,7 +121,7 @@ function Calendar({
|
|
|
121
121
|
showOutsideDays = true,
|
|
122
122
|
...props
|
|
123
123
|
}) {
|
|
124
|
-
return /* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ React11.createElement(
|
|
125
125
|
DayPicker,
|
|
126
126
|
{
|
|
127
127
|
showOutsideDays,
|
|
@@ -161,8 +161,8 @@ function Calendar({
|
|
|
161
161
|
...classNames
|
|
162
162
|
},
|
|
163
163
|
components: {
|
|
164
|
-
IconLeft: () => /* @__PURE__ */
|
|
165
|
-
IconRight: () => /* @__PURE__ */
|
|
164
|
+
IconLeft: () => /* @__PURE__ */ React11.createElement(ChevronLeftIcon, { className: "sb-h-4 sb-w-4" }),
|
|
165
|
+
IconRight: () => /* @__PURE__ */ React11.createElement(ChevronRightIcon, { className: "sb-h-4 sb-w-4" })
|
|
166
166
|
},
|
|
167
167
|
...props
|
|
168
168
|
}
|
|
@@ -182,7 +182,7 @@ var ColorPicker = (props) => {
|
|
|
182
182
|
"#009DD1",
|
|
183
183
|
"#FF0000"
|
|
184
184
|
];
|
|
185
|
-
return /* @__PURE__ */
|
|
185
|
+
return /* @__PURE__ */ React11.createElement(Popover, null, /* @__PURE__ */ React11.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React11.createElement(
|
|
186
186
|
Button,
|
|
187
187
|
{
|
|
188
188
|
variant: "outline",
|
|
@@ -193,14 +193,14 @@ var ColorPicker = (props) => {
|
|
|
193
193
|
className
|
|
194
194
|
)
|
|
195
195
|
},
|
|
196
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ React11.createElement("div", { className: "sb-w-full sb-flex sb-items-center sb-gap-2" }, color ? /* @__PURE__ */ React11.createElement(
|
|
197
197
|
"div",
|
|
198
198
|
{
|
|
199
199
|
className: "sb-h-4 sb-w-4 sb-rounded !sb-bg-center !sb-bg-cover sb-transition-all sb-border",
|
|
200
200
|
style: { background: color }
|
|
201
201
|
}
|
|
202
|
-
) : /* @__PURE__ */
|
|
203
|
-
)), /* @__PURE__ */
|
|
202
|
+
) : /* @__PURE__ */ React11.createElement(PaintbrushIcon, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React11.createElement("div", { className: "sb-truncate sb-flex-1" }, color ? color : "Kies een kleur"))
|
|
203
|
+
)), /* @__PURE__ */ React11.createElement(PopoverContent, { className: "sb-w-64 sb-p-4 sb-flex sb-flex-wrap sb-gap-1" }, colors.map((s) => /* @__PURE__ */ React11.createElement(
|
|
204
204
|
"div",
|
|
205
205
|
{
|
|
206
206
|
key: s,
|
|
@@ -213,7 +213,7 @@ var ColorPicker = (props) => {
|
|
|
213
213
|
var labelVariants = tv({
|
|
214
214
|
base: "sb-text-sm sb-font-medium sb-font-roboto sb-leading-none peer-disabled:sb-cursor-not-allowed peer-disabled:sb-opacity-70"
|
|
215
215
|
});
|
|
216
|
-
var Label =
|
|
216
|
+
var Label = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
217
217
|
LabelPrimitive.Root,
|
|
218
218
|
{
|
|
219
219
|
ref,
|
|
@@ -225,17 +225,17 @@ Label.displayName = LabelPrimitive.Root.displayName;
|
|
|
225
225
|
|
|
226
226
|
// src/components/ui/form.tsx
|
|
227
227
|
var Form = FormProvider;
|
|
228
|
-
var FormFieldContext =
|
|
228
|
+
var FormFieldContext = React11.createContext(
|
|
229
229
|
{}
|
|
230
230
|
);
|
|
231
231
|
var FormField = ({
|
|
232
232
|
...props
|
|
233
233
|
}) => {
|
|
234
|
-
return /* @__PURE__ */
|
|
234
|
+
return /* @__PURE__ */ React11.createElement(FormFieldContext.Provider, { value: { name: props.name } }, /* @__PURE__ */ React11.createElement(Controller, { ...props }));
|
|
235
235
|
};
|
|
236
236
|
var useFormField = () => {
|
|
237
|
-
const fieldContext =
|
|
238
|
-
const itemContext =
|
|
237
|
+
const fieldContext = React11.useContext(FormFieldContext);
|
|
238
|
+
const itemContext = React11.useContext(FormItemContext);
|
|
239
239
|
const { getFieldState, formState } = useFormContext();
|
|
240
240
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
241
241
|
if (!fieldContext) {
|
|
@@ -251,17 +251,17 @@ var useFormField = () => {
|
|
|
251
251
|
...fieldState
|
|
252
252
|
};
|
|
253
253
|
};
|
|
254
|
-
var FormItemContext =
|
|
254
|
+
var FormItemContext = React11.createContext(
|
|
255
255
|
{}
|
|
256
256
|
);
|
|
257
|
-
var FormItem =
|
|
258
|
-
const id =
|
|
259
|
-
return /* @__PURE__ */
|
|
257
|
+
var FormItem = React11.forwardRef(({ className, ...props }, ref) => {
|
|
258
|
+
const id = React11.useId();
|
|
259
|
+
return /* @__PURE__ */ React11.createElement(FormItemContext.Provider, { value: { id } }, /* @__PURE__ */ React11.createElement("div", { ref, className: cn("sb-space-y-2", className), ...props }));
|
|
260
260
|
});
|
|
261
261
|
FormItem.displayName = "FormItem";
|
|
262
|
-
var FormLabel =
|
|
262
|
+
var FormLabel = React11.forwardRef(({ className, ...props }, ref) => {
|
|
263
263
|
const { error, formItemId } = useFormField();
|
|
264
|
-
return /* @__PURE__ */
|
|
264
|
+
return /* @__PURE__ */ React11.createElement(
|
|
265
265
|
Label,
|
|
266
266
|
{
|
|
267
267
|
ref,
|
|
@@ -272,9 +272,9 @@ var FormLabel = React15.forwardRef(({ className, ...props }, ref) => {
|
|
|
272
272
|
);
|
|
273
273
|
});
|
|
274
274
|
FormLabel.displayName = "FormLabel";
|
|
275
|
-
var FormControl =
|
|
275
|
+
var FormControl = React11.forwardRef(({ ...props }, ref) => {
|
|
276
276
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
277
|
-
return /* @__PURE__ */
|
|
277
|
+
return /* @__PURE__ */ React11.createElement(
|
|
278
278
|
Slot,
|
|
279
279
|
{
|
|
280
280
|
ref,
|
|
@@ -286,9 +286,9 @@ var FormControl = React15.forwardRef(({ ...props }, ref) => {
|
|
|
286
286
|
);
|
|
287
287
|
});
|
|
288
288
|
FormControl.displayName = "FormControl";
|
|
289
|
-
var FormDescription =
|
|
289
|
+
var FormDescription = React11.forwardRef(({ className, ...props }, ref) => {
|
|
290
290
|
const { formDescriptionId } = useFormField();
|
|
291
|
-
return /* @__PURE__ */
|
|
291
|
+
return /* @__PURE__ */ React11.createElement(
|
|
292
292
|
"p",
|
|
293
293
|
{
|
|
294
294
|
ref,
|
|
@@ -302,13 +302,13 @@ var FormDescription = React15.forwardRef(({ className, ...props }, ref) => {
|
|
|
302
302
|
);
|
|
303
303
|
});
|
|
304
304
|
FormDescription.displayName = "FormDescription";
|
|
305
|
-
var FormMessage =
|
|
305
|
+
var FormMessage = React11.forwardRef(({ className, children, ...props }, ref) => {
|
|
306
306
|
const { error, formMessageId } = useFormField();
|
|
307
307
|
const body = error ? String(error?.message) : children;
|
|
308
308
|
if (!body) {
|
|
309
309
|
return null;
|
|
310
310
|
}
|
|
311
|
-
return /* @__PURE__ */
|
|
311
|
+
return /* @__PURE__ */ React11.createElement(
|
|
312
312
|
"p",
|
|
313
313
|
{
|
|
314
314
|
ref,
|
|
@@ -323,9 +323,9 @@ var FormMessage = React15.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
323
323
|
);
|
|
324
324
|
});
|
|
325
325
|
FormMessage.displayName = "FormMessage";
|
|
326
|
-
var Input =
|
|
326
|
+
var Input = React11.forwardRef(
|
|
327
327
|
({ className, type, ...props }, ref) => {
|
|
328
|
-
return /* @__PURE__ */
|
|
328
|
+
return /* @__PURE__ */ React11.createElement(
|
|
329
329
|
"input",
|
|
330
330
|
{
|
|
331
331
|
type,
|
|
@@ -340,19 +340,19 @@ var Input = React15.forwardRef(
|
|
|
340
340
|
}
|
|
341
341
|
);
|
|
342
342
|
Input.displayName = "Input";
|
|
343
|
-
var AdvancedInput =
|
|
343
|
+
var AdvancedInput = React11.forwardRef(
|
|
344
344
|
({ prepend, append, ...props }, ref) => {
|
|
345
|
-
return /* @__PURE__ */
|
|
345
|
+
return /* @__PURE__ */ React11.createElement("div", { className: "sb-relative" }, /* @__PURE__ */ React11.createElement(Input, { ref, className: "sb-pl-9 sb-pr-7 sb-text-right", ...props }), prepend && /* @__PURE__ */ React11.createElement("div", { className: "sb-absolute sb-font-roboto sb-top-1/2 sb-left-3 sb--translate-y-1/2" }, prepend), append && /* @__PURE__ */ React11.createElement("div", { className: "sb-absolute sb-font-roboto sb-top-1/2 sb-right-3 sb--translate-y-1/2" }, append));
|
|
346
346
|
}
|
|
347
347
|
);
|
|
348
348
|
AdvancedInput.displayName = "AdvancedInput";
|
|
349
349
|
var MediaInput = (props) => {
|
|
350
350
|
const { onFilesChange, limit = 32, multiple = false, onError } = props;
|
|
351
|
-
const id =
|
|
352
|
-
const [queue, setQueue] =
|
|
353
|
-
const [sources, setSources] =
|
|
351
|
+
const id = React11.useId();
|
|
352
|
+
const [queue, setQueue] = React11.useState([]);
|
|
353
|
+
const [sources, setSources] = React11.useState(props.files ?? []);
|
|
354
354
|
const maxConcurrentUploads = 3;
|
|
355
|
-
const uploadingCountRef =
|
|
355
|
+
const uploadingCountRef = React11.useRef(0);
|
|
356
356
|
const handleFilesAdd = async (e) => {
|
|
357
357
|
const files = e.target.files;
|
|
358
358
|
if (!files || files.length === 0) {
|
|
@@ -423,7 +423,7 @@ var MediaInput = (props) => {
|
|
|
423
423
|
body: JSON.stringify({ src })
|
|
424
424
|
});
|
|
425
425
|
};
|
|
426
|
-
return /* @__PURE__ */
|
|
426
|
+
return /* @__PURE__ */ React11.createElement("div", { className: cn("flex flex-wrap gap-4", props.className) }, sources.map((src) => /* @__PURE__ */ React11.createElement(MediaInputItem, { key: src, className: cn("group", props.itemClassName) }, /* @__PURE__ */ React11.createElement(
|
|
427
427
|
Image,
|
|
428
428
|
{
|
|
429
429
|
src,
|
|
@@ -431,14 +431,14 @@ var MediaInput = (props) => {
|
|
|
431
431
|
fill: true,
|
|
432
432
|
className: "sb-absolute sb-inset-0 sb-object-cover sb-pointer-events-none"
|
|
433
433
|
}
|
|
434
|
-
), /* @__PURE__ */
|
|
434
|
+
), /* @__PURE__ */ React11.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.createElement(
|
|
435
435
|
"button",
|
|
436
436
|
{
|
|
437
437
|
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",
|
|
438
438
|
onClick: () => handleSourceDelete(src)
|
|
439
439
|
},
|
|
440
|
-
/* @__PURE__ */
|
|
441
|
-
)))), queue.map((_, i) => /* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ React11.createElement(Trash2Icon, { className: "sb-h-4 sb-w-4" })
|
|
441
|
+
)))), queue.map((_, i) => /* @__PURE__ */ React11.createElement(
|
|
442
442
|
MediaInputItem,
|
|
443
443
|
{
|
|
444
444
|
key: i,
|
|
@@ -447,8 +447,8 @@ var MediaInput = (props) => {
|
|
|
447
447
|
props.itemClassName
|
|
448
448
|
)
|
|
449
449
|
},
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
)), multiple || !multiple && !sources.length && !queue.length ? /* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ React11.createElement(Loader2Icon, { className: "sb-h-6 sb-w-6 sb-animate-spin" })
|
|
451
|
+
)), multiple || !multiple && !sources.length && !queue.length ? /* @__PURE__ */ React11.createElement(
|
|
452
452
|
"label",
|
|
453
453
|
{
|
|
454
454
|
htmlFor: id,
|
|
@@ -457,8 +457,8 @@ var MediaInput = (props) => {
|
|
|
457
457
|
props.itemClassName
|
|
458
458
|
)
|
|
459
459
|
},
|
|
460
|
-
/* @__PURE__ */
|
|
461
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ React11.createElement(PlusIcon, { className: "sb-h-6 sb-w-6" }),
|
|
461
|
+
/* @__PURE__ */ React11.createElement(
|
|
462
462
|
"input",
|
|
463
463
|
{
|
|
464
464
|
id,
|
|
@@ -472,7 +472,7 @@ var MediaInput = (props) => {
|
|
|
472
472
|
) : null);
|
|
473
473
|
};
|
|
474
474
|
var MediaInputItem = (props) => {
|
|
475
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ React11.createElement(
|
|
476
476
|
"div",
|
|
477
477
|
{
|
|
478
478
|
className: cn(
|
|
@@ -492,7 +492,7 @@ var MediaInputError = class extends Error {
|
|
|
492
492
|
this.description = description;
|
|
493
493
|
}
|
|
494
494
|
};
|
|
495
|
-
var Switch =
|
|
495
|
+
var Switch = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
496
496
|
SwitchPrimitives.Root,
|
|
497
497
|
{
|
|
498
498
|
className: cn(
|
|
@@ -502,7 +502,7 @@ var Switch = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
502
502
|
...props,
|
|
503
503
|
ref
|
|
504
504
|
},
|
|
505
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ React11.createElement(
|
|
506
506
|
SwitchPrimitives.Thumb,
|
|
507
507
|
{
|
|
508
508
|
className: cn(
|
|
@@ -512,9 +512,9 @@ var Switch = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
512
512
|
)
|
|
513
513
|
));
|
|
514
514
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
515
|
-
var Textarea =
|
|
515
|
+
var Textarea = React11.forwardRef(
|
|
516
516
|
({ className, ...props }, ref) => {
|
|
517
|
-
return /* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ React11.createElement(
|
|
518
518
|
"textarea",
|
|
519
519
|
{
|
|
520
520
|
className: cn(
|
|
@@ -553,17 +553,17 @@ var ContainerItemForm = (props) => {
|
|
|
553
553
|
props: values
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
|
-
|
|
556
|
+
React11.useEffect(() => {
|
|
557
557
|
const subscription = form.watch(() => form.handleSubmit(onSubmit)());
|
|
558
558
|
return () => subscription.unsubscribe();
|
|
559
559
|
}, [form.watch, form.handleSubmit]);
|
|
560
|
-
return /* @__PURE__ */
|
|
560
|
+
return /* @__PURE__ */ React11.createElement(Form, { ...form }, /* @__PURE__ */ React11.createElement("form", { onSubmit: form.handleSubmit(onSubmit) }, /* @__PURE__ */ React11.createElement("div", { className: "sb-space-y-4 sb-p-4" }, (component.inputs || []).map((input) => /* @__PURE__ */ React11.createElement(
|
|
561
561
|
FormField,
|
|
562
562
|
{
|
|
563
563
|
key: input.name,
|
|
564
564
|
control: form.control,
|
|
565
565
|
name: input.name,
|
|
566
|
-
render: ({ field }) => /* @__PURE__ */
|
|
566
|
+
render: ({ field }) => /* @__PURE__ */ React11.createElement(RenderInput, { type: input.type, input, field })
|
|
567
567
|
}
|
|
568
568
|
)))));
|
|
569
569
|
};
|
|
@@ -571,17 +571,17 @@ var RenderInput = (props) => {
|
|
|
571
571
|
const { type, input, field } = props;
|
|
572
572
|
switch (type) {
|
|
573
573
|
case "string":
|
|
574
|
-
return /* @__PURE__ */
|
|
574
|
+
return /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(Input, { ...field })), input.helperText && /* @__PURE__ */ React11.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React11.createElement(FormMessage, null));
|
|
575
575
|
case "longText":
|
|
576
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(Textarea, { ...field })), input.helperText && /* @__PURE__ */ React11.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React11.createElement(FormMessage, null));
|
|
577
577
|
case "richText":
|
|
578
|
-
return /* @__PURE__ */
|
|
578
|
+
return /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(Textarea, { ...field })), input.helperText && /* @__PURE__ */ React11.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React11.createElement(FormMessage, null));
|
|
579
579
|
case "number":
|
|
580
|
-
return /* @__PURE__ */
|
|
580
|
+
return /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(Input, { type: "number", ...field })), input.helperText && /* @__PURE__ */ React11.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React11.createElement(FormMessage, null));
|
|
581
581
|
case "color":
|
|
582
|
-
return /* @__PURE__ */
|
|
582
|
+
return /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(ColorPicker, { color: field.value, onColorChange: field.onChange })), input.helperText && /* @__PURE__ */ React11.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React11.createElement(FormMessage, null));
|
|
583
583
|
case "date":
|
|
584
|
-
return /* @__PURE__ */
|
|
584
|
+
return /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(Popover, null, /* @__PURE__ */ React11.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React11.createElement(
|
|
585
585
|
Button,
|
|
586
586
|
{
|
|
587
587
|
variant: "outline",
|
|
@@ -591,9 +591,9 @@ var RenderInput = (props) => {
|
|
|
591
591
|
!field.value && "sb-text-muted-foreground"
|
|
592
592
|
)
|
|
593
593
|
},
|
|
594
|
-
/* @__PURE__ */
|
|
595
|
-
field.value ? format(field.value, "PPP") : /* @__PURE__ */
|
|
596
|
-
)), /* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ React11.createElement(CalendarIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
|
|
595
|
+
field.value ? format(field.value, "PPP") : /* @__PURE__ */ React11.createElement("span", null, "Pick a date")
|
|
596
|
+
)), /* @__PURE__ */ React11.createElement(PopoverContent, { className: "sb-w-auto sb-p-0", align: "start" }, /* @__PURE__ */ React11.createElement(
|
|
597
597
|
Calendar,
|
|
598
598
|
{
|
|
599
599
|
mode: "single",
|
|
@@ -601,11 +601,11 @@ var RenderInput = (props) => {
|
|
|
601
601
|
onSelect: field.onChange,
|
|
602
602
|
initialFocus: true
|
|
603
603
|
}
|
|
604
|
-
)))), input.helperText && /* @__PURE__ */
|
|
604
|
+
)))), input.helperText && /* @__PURE__ */ React11.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React11.createElement(FormMessage, null));
|
|
605
605
|
case "boolean":
|
|
606
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ React11.createElement(FormItem, { className: "sb-flex sb-flex-row sb-items-center sb-justify-between sb-space-y-0" }, /* @__PURE__ */ React11.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(Switch, { checked: field.value, onCheckedChange: field.onChange })), input.helperText && /* @__PURE__ */ React11.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React11.createElement(FormMessage, null));
|
|
607
607
|
case "file":
|
|
608
|
-
return /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(
|
|
609
609
|
MediaInput,
|
|
610
610
|
{
|
|
611
611
|
className: "sb-grid sb-grid-cols-2 sb-gap-1",
|
|
@@ -617,7 +617,7 @@ var RenderInput = (props) => {
|
|
|
617
617
|
"media-input: Error: " + e?.description
|
|
618
618
|
)
|
|
619
619
|
}
|
|
620
|
-
)), input.helperText && /* @__PURE__ */
|
|
620
|
+
)), input.helperText && /* @__PURE__ */ React11.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React11.createElement(FormMessage, null));
|
|
621
621
|
default:
|
|
622
622
|
throw new Error(
|
|
623
623
|
`[simple-builder]: Input type "${props.type}" not supported`
|
|
@@ -636,7 +636,7 @@ var tabsListVariants = tv({
|
|
|
636
636
|
variant: "contained"
|
|
637
637
|
}
|
|
638
638
|
});
|
|
639
|
-
var TabsList =
|
|
639
|
+
var TabsList = React11.forwardRef(({ variant, className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
640
640
|
TabsPrimitive.List,
|
|
641
641
|
{
|
|
642
642
|
ref,
|
|
@@ -656,7 +656,7 @@ var tabsTriggerVariants = tv({
|
|
|
656
656
|
variant: "contained"
|
|
657
657
|
}
|
|
658
658
|
});
|
|
659
|
-
var TabsTrigger =
|
|
659
|
+
var TabsTrigger = React11.forwardRef(({ variant, className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
660
660
|
TabsPrimitive.Trigger,
|
|
661
661
|
{
|
|
662
662
|
ref,
|
|
@@ -665,7 +665,7 @@ var TabsTrigger = React15.forwardRef(({ variant, className, ...props }, ref) =>
|
|
|
665
665
|
}
|
|
666
666
|
));
|
|
667
667
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
668
|
-
var TabsContent =
|
|
668
|
+
var TabsContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
669
669
|
TabsPrimitive.Content,
|
|
670
670
|
{
|
|
671
671
|
ref,
|
|
@@ -700,14 +700,14 @@ var BackgroundPicker = (props) => {
|
|
|
700
700
|
"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)",
|
|
701
701
|
"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)"
|
|
702
702
|
];
|
|
703
|
-
const defaultTab =
|
|
703
|
+
const defaultTab = React11.useMemo(() => {
|
|
704
704
|
if (background.includes("url"))
|
|
705
705
|
return "image";
|
|
706
706
|
if (background.includes("gradient"))
|
|
707
707
|
return "gradient";
|
|
708
708
|
return "solid";
|
|
709
709
|
}, [background]);
|
|
710
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ React11.createElement(Popover, null, /* @__PURE__ */ React11.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React11.createElement(
|
|
711
711
|
Button,
|
|
712
712
|
{
|
|
713
713
|
variant: "outline",
|
|
@@ -718,20 +718,20 @@ var BackgroundPicker = (props) => {
|
|
|
718
718
|
className
|
|
719
719
|
)
|
|
720
720
|
},
|
|
721
|
-
/* @__PURE__ */
|
|
721
|
+
/* @__PURE__ */ React11.createElement("div", { className: "sb-w-full sb-flex sb-items-center sb-gap-2" }, background ? /* @__PURE__ */ React11.createElement(
|
|
722
722
|
"div",
|
|
723
723
|
{
|
|
724
724
|
className: "sb-h-4 sb-w-4 sb-rounded !sb-bg-center !sb-bg-cover sb-transition-all sb-border",
|
|
725
725
|
style: { background }
|
|
726
726
|
}
|
|
727
|
-
) : /* @__PURE__ */
|
|
728
|
-
)), /* @__PURE__ */
|
|
727
|
+
) : /* @__PURE__ */ React11.createElement(PaintbrushIcon, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React11.createElement("div", { className: "sb-truncate sb-flex-1" }, background ? background : "Kies een achtergrond"))
|
|
728
|
+
)), /* @__PURE__ */ React11.createElement(PopoverContent, { className: "sb-w-64 sb-p-0" }, /* @__PURE__ */ React11.createElement(Tabs, { defaultValue: defaultTab }, /* @__PURE__ */ React11.createElement(TabsList, { className: "sb-w-full" }, /* @__PURE__ */ React11.createElement(TabsTrigger, { className: "sb-flex-1", value: "solid" }, "Solid"), /* @__PURE__ */ React11.createElement(TabsTrigger, { className: "sb-flex-1", value: "gradient" }, "Gradient"), /* @__PURE__ */ React11.createElement(TabsTrigger, { className: "sb-flex-1", value: "image" }, "Image")), /* @__PURE__ */ React11.createElement(
|
|
729
729
|
TabsContent,
|
|
730
730
|
{
|
|
731
731
|
value: "solid",
|
|
732
732
|
className: "data-[state=active]:sb-flex sb-flex-wrap sb-gap-1 sb-p-4"
|
|
733
733
|
},
|
|
734
|
-
solids.map((s) => /* @__PURE__ */
|
|
734
|
+
solids.map((s) => /* @__PURE__ */ React11.createElement(
|
|
735
735
|
"div",
|
|
736
736
|
{
|
|
737
737
|
key: s,
|
|
@@ -740,13 +740,13 @@ var BackgroundPicker = (props) => {
|
|
|
740
740
|
onClick: () => onBackgroundChange(s)
|
|
741
741
|
}
|
|
742
742
|
))
|
|
743
|
-
), /* @__PURE__ */
|
|
743
|
+
), /* @__PURE__ */ React11.createElement(
|
|
744
744
|
TabsContent,
|
|
745
745
|
{
|
|
746
746
|
value: "gradient",
|
|
747
747
|
className: "data-[state=active]:sb-flex sb-flex-wrap sb-gap-1 sb-p-4"
|
|
748
748
|
},
|
|
749
|
-
gradients.map((s) => /* @__PURE__ */
|
|
749
|
+
gradients.map((s) => /* @__PURE__ */ React11.createElement(
|
|
750
750
|
"div",
|
|
751
751
|
{
|
|
752
752
|
key: s,
|
|
@@ -755,7 +755,7 @@ var BackgroundPicker = (props) => {
|
|
|
755
755
|
onClick: () => onBackgroundChange(s)
|
|
756
756
|
}
|
|
757
757
|
))
|
|
758
|
-
), /* @__PURE__ */
|
|
758
|
+
), /* @__PURE__ */ React11.createElement(TabsContent, { value: "image" }, /* @__PURE__ */ React11.createElement("div", { className: "sb-p-4 sb-border-b" }, /* @__PURE__ */ React11.createElement(
|
|
759
759
|
MediaInput,
|
|
760
760
|
{
|
|
761
761
|
className: "sb-grid sb-grid-cols-2 sb-gap-1",
|
|
@@ -771,7 +771,7 @@ var BackgroundPicker = (props) => {
|
|
|
771
771
|
"media-input: Error: " + e?.description
|
|
772
772
|
)
|
|
773
773
|
}
|
|
774
|
-
)), /* @__PURE__ */
|
|
774
|
+
)), /* @__PURE__ */ React11.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-gap-1 sb-p-4" }, images.map((s) => /* @__PURE__ */ React11.createElement(
|
|
775
775
|
"div",
|
|
776
776
|
{
|
|
777
777
|
key: s,
|
|
@@ -799,7 +799,7 @@ var toggleVariants = tv({
|
|
|
799
799
|
size: "default"
|
|
800
800
|
}
|
|
801
801
|
});
|
|
802
|
-
var Toggle =
|
|
802
|
+
var Toggle = React11.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
803
803
|
TogglePrimitive.Root,
|
|
804
804
|
{
|
|
805
805
|
ref,
|
|
@@ -809,32 +809,131 @@ var Toggle = React15.forwardRef(({ className, variant, size, ...props }, ref) =>
|
|
|
809
809
|
));
|
|
810
810
|
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
811
811
|
|
|
812
|
+
// src/components/ui/spacing-input.tsx
|
|
813
|
+
var SpacingInput = (props) => {
|
|
814
|
+
const [value, setValue] = React11.useState(parse(props.value || "0px"));
|
|
815
|
+
const [indipendent, setIndipendent] = React11.useState(
|
|
816
|
+
isIndipendent(parse(props.value || "0px"))
|
|
817
|
+
);
|
|
818
|
+
React11.useEffect(() => {
|
|
819
|
+
if (!props.onChange)
|
|
820
|
+
return;
|
|
821
|
+
props.onChange(stringify(value));
|
|
822
|
+
}, [value, props.onChange]);
|
|
823
|
+
return /* @__PURE__ */ React11.createElement("div", { className: "sb-grid sb-grid-cols-[1fr,auto] sb-gap-3" }, /* @__PURE__ */ React11.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-items-center sb-gap-3" }, !indipendent ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
824
|
+
AdvancedInput,
|
|
825
|
+
{
|
|
826
|
+
value: value.left,
|
|
827
|
+
pattern: "\\d+",
|
|
828
|
+
onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, left: +value2, right: +value2 })),
|
|
829
|
+
prepend: /* @__PURE__ */ React11.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
|
|
830
|
+
append: /* @__PURE__ */ React11.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
831
|
+
}
|
|
832
|
+
), /* @__PURE__ */ React11.createElement(
|
|
833
|
+
AdvancedInput,
|
|
834
|
+
{
|
|
835
|
+
value: value.top,
|
|
836
|
+
pattern: "\\d+",
|
|
837
|
+
onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, top: +value2, bottom: +value2 })),
|
|
838
|
+
prepend: /* @__PURE__ */ React11.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
839
|
+
append: /* @__PURE__ */ React11.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
840
|
+
}
|
|
841
|
+
)) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
842
|
+
AdvancedInput,
|
|
843
|
+
{
|
|
844
|
+
value: value.left,
|
|
845
|
+
pattern: "\\d+",
|
|
846
|
+
onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, left: +value2 })),
|
|
847
|
+
prepend: /* @__PURE__ */ React11.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
|
|
848
|
+
append: /* @__PURE__ */ React11.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
849
|
+
}
|
|
850
|
+
), /* @__PURE__ */ React11.createElement(
|
|
851
|
+
AdvancedInput,
|
|
852
|
+
{
|
|
853
|
+
value: value.top,
|
|
854
|
+
pattern: "\\d+",
|
|
855
|
+
onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, top: +value2 })),
|
|
856
|
+
prepend: /* @__PURE__ */ React11.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
857
|
+
append: /* @__PURE__ */ React11.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
858
|
+
}
|
|
859
|
+
), /* @__PURE__ */ React11.createElement(
|
|
860
|
+
AdvancedInput,
|
|
861
|
+
{
|
|
862
|
+
value: value.right,
|
|
863
|
+
pattern: "\\d+",
|
|
864
|
+
onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, right: +value2 })),
|
|
865
|
+
prepend: /* @__PURE__ */ React11.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
|
|
866
|
+
append: /* @__PURE__ */ React11.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
867
|
+
}
|
|
868
|
+
), /* @__PURE__ */ React11.createElement(
|
|
869
|
+
AdvancedInput,
|
|
870
|
+
{
|
|
871
|
+
value: value.bottom,
|
|
872
|
+
pattern: "\\d+",
|
|
873
|
+
onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, bottom: +value2 })),
|
|
874
|
+
prepend: /* @__PURE__ */ React11.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
|
|
875
|
+
append: /* @__PURE__ */ React11.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
876
|
+
}
|
|
877
|
+
))), /* @__PURE__ */ React11.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React11.createElement(
|
|
878
|
+
Toggle,
|
|
879
|
+
{
|
|
880
|
+
className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
|
|
881
|
+
variant: "outline",
|
|
882
|
+
size: "sm",
|
|
883
|
+
pressed: indipendent,
|
|
884
|
+
onPressedChange: setIndipendent
|
|
885
|
+
},
|
|
886
|
+
/* @__PURE__ */ React11.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
|
|
887
|
+
)));
|
|
888
|
+
};
|
|
889
|
+
var isIndipendent = (value) => {
|
|
890
|
+
const { top, right, bottom, left } = value;
|
|
891
|
+
return top !== bottom || right !== left;
|
|
892
|
+
};
|
|
893
|
+
var parse = (value) => {
|
|
894
|
+
const matches = value.match(/(\d+)/gm);
|
|
895
|
+
const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
|
|
896
|
+
switch (matches?.length) {
|
|
897
|
+
case 1:
|
|
898
|
+
return { top, right: top, bottom: top, left: top };
|
|
899
|
+
case 2:
|
|
900
|
+
return { top, bottom: top, left: right, right };
|
|
901
|
+
case 3:
|
|
902
|
+
return { top, right, left: right, bottom };
|
|
903
|
+
default:
|
|
904
|
+
return { top, right, bottom, left };
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
var stringify = (value) => {
|
|
908
|
+
const { top, right, bottom, left } = value;
|
|
909
|
+
if (top === right && top === bottom && top === left) {
|
|
910
|
+
return `${top}px`;
|
|
911
|
+
}
|
|
912
|
+
if (top === bottom && right === left) {
|
|
913
|
+
return `${top}px ${right}px`;
|
|
914
|
+
}
|
|
915
|
+
if (right === left) {
|
|
916
|
+
return `${top}px ${right}px ${bottom}px`;
|
|
917
|
+
}
|
|
918
|
+
return `${top}px ${right}px ${bottom}px ${left}px`;
|
|
919
|
+
};
|
|
920
|
+
|
|
812
921
|
// src/components/item-design-form.tsx
|
|
813
|
-
var spacingSchema = z.discriminatedUnion("indipendent", [
|
|
814
|
-
z.object({
|
|
815
|
-
indipendent: z.literal(false),
|
|
816
|
-
horizontal: z.coerce.number(),
|
|
817
|
-
vertical: z.coerce.number()
|
|
818
|
-
}),
|
|
819
|
-
z.object({
|
|
820
|
-
indipendent: z.literal(true),
|
|
821
|
-
left: z.coerce.number(),
|
|
822
|
-
right: z.coerce.number(),
|
|
823
|
-
top: z.coerce.number(),
|
|
824
|
-
bottom: z.coerce.number()
|
|
825
|
-
})
|
|
826
|
-
]);
|
|
827
922
|
var designSchema = z.object({
|
|
828
|
-
container: z.boolean(),
|
|
923
|
+
container: z.coerce.boolean(),
|
|
829
924
|
desktop: z.object({
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
925
|
+
background: z.string(),
|
|
926
|
+
color: z.string(),
|
|
927
|
+
padding: z.string(),
|
|
928
|
+
margin: z.string()
|
|
929
|
+
}),
|
|
833
930
|
mobile: z.object({
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
931
|
+
background: z.string(),
|
|
932
|
+
color: z.string(),
|
|
933
|
+
padding: z.string(),
|
|
934
|
+
margin: z.string()
|
|
935
|
+
})
|
|
936
|
+
});
|
|
838
937
|
var ItemDesignForm = (props) => {
|
|
839
938
|
const { item } = props;
|
|
840
939
|
const component = builder.getComponent(item.component);
|
|
@@ -843,376 +942,163 @@ var ItemDesignForm = (props) => {
|
|
|
843
942
|
`[simple-builder]: Component "${item.component}" not found`
|
|
844
943
|
);
|
|
845
944
|
}
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
const value = item.styles?.desktop?.[key];
|
|
851
|
-
const def = defaults?.desktop?.[key];
|
|
852
|
-
if (value !== void 0) {
|
|
853
|
-
return value;
|
|
854
|
-
} else if (def !== void 0) {
|
|
855
|
-
return def;
|
|
856
|
-
} else {
|
|
857
|
-
return initial;
|
|
945
|
+
const getDefaultDeviceValue = (params) => {
|
|
946
|
+
const { device: device2 = "desktop", key, fallback = "" } = params;
|
|
947
|
+
if (item.styles?.[device2]?.[key] !== void 0) {
|
|
948
|
+
return item.styles[device2][key];
|
|
858
949
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
return desktopValue;
|
|
871
|
-
} else if (desktopDef !== void 0) {
|
|
872
|
-
return desktopDef;
|
|
873
|
-
} else {
|
|
874
|
-
return initial;
|
|
950
|
+
if (component.defaultStyles?.[device2]?.[key] !== void 0) {
|
|
951
|
+
return component.defaultStyles[device2][key];
|
|
952
|
+
}
|
|
953
|
+
if (device2 === "mobile") {
|
|
954
|
+
const desktopValue = getDefaultDeviceValue({
|
|
955
|
+
...params,
|
|
956
|
+
device: "desktop"
|
|
957
|
+
});
|
|
958
|
+
if (desktopValue !== void 0) {
|
|
959
|
+
return desktopValue;
|
|
960
|
+
}
|
|
875
961
|
}
|
|
962
|
+
return fallback;
|
|
876
963
|
};
|
|
877
|
-
const
|
|
878
|
-
const parsed = spacing.parse(str);
|
|
964
|
+
const getDefaultDeviceValues = (device2) => {
|
|
879
965
|
return {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
966
|
+
background: getDefaultDeviceValue({ device: device2, key: "background" }),
|
|
967
|
+
color: getDefaultDeviceValue({ device: device2, key: "color" }),
|
|
968
|
+
padding: getDefaultDeviceValue({ device: device2, key: "padding" }),
|
|
969
|
+
margin: getDefaultDeviceValue({ device: device2, key: "margin" })
|
|
884
970
|
};
|
|
885
971
|
};
|
|
886
972
|
const form = useForm({
|
|
887
973
|
resolver: zodResolver(designSchema),
|
|
888
|
-
|
|
889
|
-
container: item.styles?.container
|
|
890
|
-
desktop:
|
|
891
|
-
|
|
892
|
-
color: getDefaultDesktopValue("color"),
|
|
893
|
-
padding: getSpacingValue(getDefaultDesktopValue("padding")),
|
|
894
|
-
margin: getSpacingValue(getDefaultDesktopValue("margin"))
|
|
895
|
-
},
|
|
896
|
-
mobile: {
|
|
897
|
-
background: getDefaultMobileValue("background"),
|
|
898
|
-
color: getDefaultMobileValue("color"),
|
|
899
|
-
padding: getSpacingValue(getDefaultMobileValue("padding")),
|
|
900
|
-
margin: getSpacingValue(getDefaultMobileValue("margin"))
|
|
901
|
-
}
|
|
974
|
+
values: {
|
|
975
|
+
container: item.styles?.container ?? true,
|
|
976
|
+
desktop: getDefaultDeviceValues("desktop"),
|
|
977
|
+
mobile: getDefaultDeviceValues("mobile")
|
|
902
978
|
}
|
|
903
979
|
});
|
|
980
|
+
const { patchItem } = useBuilder();
|
|
904
981
|
const onSubmit = (values) => {
|
|
905
|
-
const { container } = values;
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
};
|
|
921
|
-
res = spacing.stringify(params);
|
|
982
|
+
const { container, desktop, mobile } = values;
|
|
983
|
+
const dirtyFields = form.formState.dirtyFields;
|
|
984
|
+
const desktopPatch = Object.entries(desktop).reduce(
|
|
985
|
+
(acc, [key, value]) => ({
|
|
986
|
+
...acc,
|
|
987
|
+
...value && { [key]: value }
|
|
988
|
+
}),
|
|
989
|
+
{ ...item.styles?.desktop }
|
|
990
|
+
);
|
|
991
|
+
const mobilePatch = Object.entries(mobile).reduce(
|
|
992
|
+
(acc, [key, value]) => {
|
|
993
|
+
const desktopValue = desktop[key];
|
|
994
|
+
const isDirty = dirtyFields.desktop?.[key];
|
|
995
|
+
if (value === desktopValue || isDirty) {
|
|
996
|
+
return acc;
|
|
922
997
|
}
|
|
923
998
|
return {
|
|
924
999
|
...acc,
|
|
925
|
-
...
|
|
1000
|
+
...value && { [key]: value }
|
|
926
1001
|
};
|
|
927
|
-
},
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
const patchedMobileValues = getPatchedDeviceValues("mobile");
|
|
1002
|
+
},
|
|
1003
|
+
{ ...item.styles?.mobile }
|
|
1004
|
+
);
|
|
931
1005
|
patchItem(item.id, {
|
|
932
1006
|
styles: {
|
|
933
1007
|
...container === false && { container },
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
},
|
|
937
|
-
...Object.keys(patchedMobileValues).length && {
|
|
938
|
-
mobile: patchedMobileValues
|
|
939
|
-
}
|
|
1008
|
+
desktop: desktopPatch,
|
|
1009
|
+
mobile: mobilePatch
|
|
940
1010
|
}
|
|
941
1011
|
});
|
|
942
1012
|
};
|
|
943
|
-
|
|
1013
|
+
const [device, setDevice] = React11.useState("desktop");
|
|
1014
|
+
React11.useEffect(() => {
|
|
944
1015
|
const subscription = form.watch(() => form.handleSubmit(onSubmit)());
|
|
945
1016
|
return () => subscription.unsubscribe();
|
|
946
1017
|
}, [form.watch, form.handleSubmit]);
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1018
|
+
return /* @__PURE__ */ React11.createElement(Form, { ...form }, /* @__PURE__ */ React11.createElement("form", { onSubmit: form.handleSubmit(onSubmit) }, /* @__PURE__ */ React11.createElement("div", { className: "sb-space-y-4 sb-p-4" }, /* @__PURE__ */ React11.createElement(
|
|
1019
|
+
Tabs,
|
|
1020
|
+
{
|
|
1021
|
+
defaultValue: device,
|
|
1022
|
+
onValueChange: (device2) => setDevice(device2)
|
|
1023
|
+
},
|
|
1024
|
+
/* @__PURE__ */ React11.createElement(TabsList, { className: "sb-h-9 sb-grid sb-w-full sb-grid-cols-2" }, /* @__PURE__ */ React11.createElement(TabsTrigger, { value: "desktop", className: "sb-text-xs" }, /* @__PURE__ */ React11.createElement(MonitorIcon, { className: "sb-h-4 sb-w-4 sb-mr-2" }), /* @__PURE__ */ React11.createElement("span", null, "Desktop")), /* @__PURE__ */ React11.createElement(TabsTrigger, { value: "mobile", className: "sb-text-xs" }, /* @__PURE__ */ React11.createElement(SmartphoneIcon, { className: "sb-h-4 sb-w-4 sb-mr-2" }), /* @__PURE__ */ React11.createElement("span", null, "Mobiel")))
|
|
1025
|
+
), /* @__PURE__ */ React11.createElement("div", { className: "sb-space-y-4" }, /* @__PURE__ */ React11.createElement(
|
|
952
1026
|
FormField,
|
|
953
1027
|
{
|
|
954
1028
|
control: form.control,
|
|
955
1029
|
key: `${device}.background`,
|
|
956
1030
|
name: `${device}.background`,
|
|
957
|
-
render: ({ field }) => /* @__PURE__ */
|
|
1031
|
+
render: ({ field }) => /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, "Achtergrond"), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(
|
|
958
1032
|
BackgroundPicker,
|
|
959
1033
|
{
|
|
960
1034
|
background: field.value,
|
|
961
1035
|
onBackgroundChange: field.onChange
|
|
962
1036
|
}
|
|
963
|
-
)), /* @__PURE__ */
|
|
1037
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
964
1038
|
}
|
|
965
|
-
), /* @__PURE__ */
|
|
1039
|
+
), /* @__PURE__ */ React11.createElement(
|
|
966
1040
|
FormField,
|
|
967
1041
|
{
|
|
968
1042
|
control: form.control,
|
|
969
1043
|
key: `${device}.color`,
|
|
970
1044
|
name: `${device}.color`,
|
|
971
|
-
render: ({ field }) => /* @__PURE__ */
|
|
1045
|
+
render: ({ field }) => /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, "Inhoud kleur"), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(
|
|
972
1046
|
ColorPicker,
|
|
973
1047
|
{
|
|
974
1048
|
color: field.value,
|
|
975
1049
|
onColorChange: field.onChange
|
|
976
1050
|
}
|
|
977
|
-
)), /* @__PURE__ */
|
|
1051
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
978
1052
|
}
|
|
979
|
-
), /* @__PURE__ */
|
|
1053
|
+
), /* @__PURE__ */ React11.createElement("hr", null), /* @__PURE__ */ React11.createElement(
|
|
980
1054
|
FormField,
|
|
981
1055
|
{
|
|
982
1056
|
control: form.control,
|
|
983
1057
|
name: "container",
|
|
984
|
-
render: ({ field }) => /* @__PURE__ */
|
|
1058
|
+
render: ({ field }) => /* @__PURE__ */ React11.createElement(FormItem, { className: "sb-flex sb-flex-row sb-items-center sb-justify-between sb-space-y-0" }, /* @__PURE__ */ React11.createElement(FormLabel, null, "Volledige breedte"), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(
|
|
985
1059
|
Switch,
|
|
986
1060
|
{
|
|
987
1061
|
checked: !field.value,
|
|
988
1062
|
onCheckedChange: (v) => field.onChange(!v)
|
|
989
1063
|
}
|
|
990
|
-
)), /* @__PURE__ */
|
|
991
|
-
}
|
|
992
|
-
), /* @__PURE__ */ React15.createElement("hr", null), /* @__PURE__ */ React15.createElement("div", { className: "sb-space-y-2" }, /* @__PURE__ */ React15.createElement(FormLabel, null, "Padding"), /* @__PURE__ */ React15.createElement("div", { className: "sb-grid sb-grid-cols-[1fr,auto] sb-gap-3" }, /* @__PURE__ */ React15.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-items-center sb-gap-3" }, !indipendentPadding ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
993
|
-
FormField,
|
|
994
|
-
{
|
|
995
|
-
control: form.control,
|
|
996
|
-
key: `${device}.padding.horizontal`,
|
|
997
|
-
name: `${device}.padding.horizontal`,
|
|
998
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
999
|
-
AdvancedInput,
|
|
1000
|
-
{
|
|
1001
|
-
...field,
|
|
1002
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
|
|
1003
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1004
|
-
}
|
|
1005
|
-
)))
|
|
1006
|
-
}
|
|
1007
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1008
|
-
FormField,
|
|
1009
|
-
{
|
|
1010
|
-
control: form.control,
|
|
1011
|
-
key: `${device}.padding.vertical`,
|
|
1012
|
-
name: `${device}.padding.vertical`,
|
|
1013
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1014
|
-
AdvancedInput,
|
|
1015
|
-
{
|
|
1016
|
-
...field,
|
|
1017
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
1018
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1019
|
-
}
|
|
1020
|
-
)))
|
|
1064
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
1021
1065
|
}
|
|
1022
|
-
)
|
|
1066
|
+
), /* @__PURE__ */ React11.createElement("hr", null), /* @__PURE__ */ React11.createElement(
|
|
1023
1067
|
FormField,
|
|
1024
1068
|
{
|
|
1025
1069
|
control: form.control,
|
|
1026
|
-
key: `${device}.padding
|
|
1027
|
-
name: `${device}.padding
|
|
1028
|
-
render: ({ field }) => /* @__PURE__ */
|
|
1029
|
-
|
|
1070
|
+
key: `${device}.padding`,
|
|
1071
|
+
name: `${device}.padding`,
|
|
1072
|
+
render: ({ field }) => /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, "Padding"), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(
|
|
1073
|
+
SpacingInput,
|
|
1030
1074
|
{
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1075
|
+
value: field.value,
|
|
1076
|
+
onChange: field.onChange
|
|
1034
1077
|
}
|
|
1035
|
-
)))
|
|
1078
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
1036
1079
|
}
|
|
1037
|
-
), /* @__PURE__ */
|
|
1080
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1038
1081
|
FormField,
|
|
1039
1082
|
{
|
|
1040
1083
|
control: form.control,
|
|
1041
|
-
key: `${device}.
|
|
1042
|
-
name: `${device}.
|
|
1043
|
-
render: ({ field }) => /* @__PURE__ */
|
|
1044
|
-
|
|
1084
|
+
key: `${device}.margin`,
|
|
1085
|
+
name: `${device}.margin`,
|
|
1086
|
+
render: ({ field }) => /* @__PURE__ */ React11.createElement(FormItem, null, /* @__PURE__ */ React11.createElement(FormLabel, null, "Margin"), /* @__PURE__ */ React11.createElement(FormControl, null, /* @__PURE__ */ React11.createElement(
|
|
1087
|
+
SpacingInput,
|
|
1045
1088
|
{
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1089
|
+
value: field.value,
|
|
1090
|
+
onChange: field.onChange
|
|
1049
1091
|
}
|
|
1050
|
-
)))
|
|
1092
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
1051
1093
|
}
|
|
1052
|
-
)
|
|
1053
|
-
FormField,
|
|
1054
|
-
{
|
|
1055
|
-
control: form.control,
|
|
1056
|
-
key: `${device}.padding.right`,
|
|
1057
|
-
name: `${device}.padding.right`,
|
|
1058
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1059
|
-
AdvancedInput,
|
|
1060
|
-
{
|
|
1061
|
-
...field,
|
|
1062
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
|
|
1063
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1064
|
-
}
|
|
1065
|
-
)))
|
|
1066
|
-
}
|
|
1067
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1068
|
-
FormField,
|
|
1069
|
-
{
|
|
1070
|
-
control: form.control,
|
|
1071
|
-
key: `${device}.padding.bottom`,
|
|
1072
|
-
name: `${device}.padding.bottom`,
|
|
1073
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1074
|
-
AdvancedInput,
|
|
1075
|
-
{
|
|
1076
|
-
...field,
|
|
1077
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
|
|
1078
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1079
|
-
}
|
|
1080
|
-
)))
|
|
1081
|
-
}
|
|
1082
|
-
))), /* @__PURE__ */ React15.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React15.createElement(
|
|
1083
|
-
FormField,
|
|
1084
|
-
{
|
|
1085
|
-
control: form.control,
|
|
1086
|
-
key: `${device}.padding.indipendent`,
|
|
1087
|
-
name: `${device}.padding.indipendent`,
|
|
1088
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1089
|
-
Toggle,
|
|
1090
|
-
{
|
|
1091
|
-
className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
|
|
1092
|
-
variant: "outline",
|
|
1093
|
-
size: "sm",
|
|
1094
|
-
pressed: field.value,
|
|
1095
|
-
onPressedChange: field.onChange
|
|
1096
|
-
},
|
|
1097
|
-
/* @__PURE__ */ React15.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
|
|
1098
|
-
))
|
|
1099
|
-
}
|
|
1100
|
-
))), /* @__PURE__ */ React15.createElement(FormMessage, null)), /* @__PURE__ */ React15.createElement("div", { className: "sb-space-y-2" }, /* @__PURE__ */ React15.createElement(FormLabel, null, "Margin"), /* @__PURE__ */ React15.createElement("div", { className: "sb-grid sb-grid-cols-[1fr,auto] sb-gap-3" }, /* @__PURE__ */ React15.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-items-center sb-gap-3" }, !indipendentMargin ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
1101
|
-
FormField,
|
|
1102
|
-
{
|
|
1103
|
-
control: form.control,
|
|
1104
|
-
key: `${device}.margin.horizontal`,
|
|
1105
|
-
name: `${device}.margin.horizontal`,
|
|
1106
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1107
|
-
AdvancedInput,
|
|
1108
|
-
{
|
|
1109
|
-
...field,
|
|
1110
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
|
|
1111
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1112
|
-
}
|
|
1113
|
-
)))
|
|
1114
|
-
}
|
|
1115
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1116
|
-
FormField,
|
|
1117
|
-
{
|
|
1118
|
-
control: form.control,
|
|
1119
|
-
key: `${device}.margin.vertical`,
|
|
1120
|
-
name: `${device}.margin.vertical`,
|
|
1121
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1122
|
-
AdvancedInput,
|
|
1123
|
-
{
|
|
1124
|
-
...field,
|
|
1125
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
1126
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1127
|
-
}
|
|
1128
|
-
)))
|
|
1129
|
-
}
|
|
1130
|
-
)) : /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
1131
|
-
FormField,
|
|
1132
|
-
{
|
|
1133
|
-
control: form.control,
|
|
1134
|
-
key: `${device}.margin.left`,
|
|
1135
|
-
name: `${device}.margin.left`,
|
|
1136
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1137
|
-
AdvancedInput,
|
|
1138
|
-
{
|
|
1139
|
-
...field,
|
|
1140
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
|
|
1141
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1142
|
-
}
|
|
1143
|
-
)))
|
|
1144
|
-
}
|
|
1145
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1146
|
-
FormField,
|
|
1147
|
-
{
|
|
1148
|
-
control: form.control,
|
|
1149
|
-
key: `${device}.margin.top`,
|
|
1150
|
-
name: `${device}.margin.top`,
|
|
1151
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1152
|
-
AdvancedInput,
|
|
1153
|
-
{
|
|
1154
|
-
...field,
|
|
1155
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
1156
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1157
|
-
}
|
|
1158
|
-
)))
|
|
1159
|
-
}
|
|
1160
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1161
|
-
FormField,
|
|
1162
|
-
{
|
|
1163
|
-
control: form.control,
|
|
1164
|
-
key: `${device}.margin.right`,
|
|
1165
|
-
name: `${device}.margin.right`,
|
|
1166
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1167
|
-
AdvancedInput,
|
|
1168
|
-
{
|
|
1169
|
-
...field,
|
|
1170
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
|
|
1171
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1172
|
-
}
|
|
1173
|
-
)))
|
|
1174
|
-
}
|
|
1175
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1176
|
-
FormField,
|
|
1177
|
-
{
|
|
1178
|
-
control: form.control,
|
|
1179
|
-
key: `${device}.margin.bottom`,
|
|
1180
|
-
name: `${device}.margin.bottom`,
|
|
1181
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1182
|
-
AdvancedInput,
|
|
1183
|
-
{
|
|
1184
|
-
...field,
|
|
1185
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
|
|
1186
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1187
|
-
}
|
|
1188
|
-
)))
|
|
1189
|
-
}
|
|
1190
|
-
))), /* @__PURE__ */ React15.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React15.createElement(
|
|
1191
|
-
FormField,
|
|
1192
|
-
{
|
|
1193
|
-
control: form.control,
|
|
1194
|
-
key: `${device}.margin.indipendent`,
|
|
1195
|
-
name: `${device}.margin.indipendent`,
|
|
1196
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1197
|
-
Toggle,
|
|
1198
|
-
{
|
|
1199
|
-
className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
|
|
1200
|
-
variant: "outline",
|
|
1201
|
-
size: "sm",
|
|
1202
|
-
pressed: field.value,
|
|
1203
|
-
onPressedChange: field.onChange
|
|
1204
|
-
},
|
|
1205
|
-
/* @__PURE__ */ React15.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
|
|
1206
|
-
))
|
|
1207
|
-
}
|
|
1208
|
-
))), /* @__PURE__ */ React15.createElement(FormMessage, null))))));
|
|
1094
|
+
)))));
|
|
1209
1095
|
};
|
|
1210
1096
|
|
|
1211
1097
|
// src/components/container-item-toolbar.tsx
|
|
1212
1098
|
var ContainerItemToolbar = (props) => {
|
|
1213
1099
|
const { contentId, canBringUp = false, canBringDown = false } = props;
|
|
1214
1100
|
const { bringUp, bringDown } = useBuilder();
|
|
1215
|
-
return /* @__PURE__ */
|
|
1101
|
+
return /* @__PURE__ */ React11.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.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.createElement(EditButton, { id: contentId }), /* @__PURE__ */ React11.createElement(
|
|
1216
1102
|
Button,
|
|
1217
1103
|
{
|
|
1218
1104
|
variant: "ghost",
|
|
@@ -1220,8 +1106,8 @@ var ContainerItemToolbar = (props) => {
|
|
|
1220
1106
|
onClick: () => bringUp(contentId),
|
|
1221
1107
|
disabled: !canBringUp
|
|
1222
1108
|
},
|
|
1223
|
-
/* @__PURE__ */
|
|
1224
|
-
), /* @__PURE__ */
|
|
1109
|
+
/* @__PURE__ */ React11.createElement(ArrowUp, { className: "sb-h-5 sb-w-5" })
|
|
1110
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1225
1111
|
Button,
|
|
1226
1112
|
{
|
|
1227
1113
|
variant: "ghost",
|
|
@@ -1229,11 +1115,11 @@ var ContainerItemToolbar = (props) => {
|
|
|
1229
1115
|
onClick: () => bringDown(contentId),
|
|
1230
1116
|
disabled: !canBringDown
|
|
1231
1117
|
},
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
), /* @__PURE__ */
|
|
1118
|
+
/* @__PURE__ */ React11.createElement(ArrowDown, { className: "sb-h-5 sb-w-5" })
|
|
1119
|
+
), /* @__PURE__ */ React11.createElement(DeleteButton, { contentId })));
|
|
1234
1120
|
};
|
|
1235
1121
|
var EditButton = ({ id }) => {
|
|
1236
|
-
return /* @__PURE__ */
|
|
1122
|
+
return /* @__PURE__ */ React11.createElement(Popover, null, /* @__PURE__ */ React11.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React11.createElement(Button, { variant: "ghost", className: "sb-w-8 sb-h-8 sb-p-0" }, /* @__PURE__ */ React11.createElement(Edit2Icon, { className: "sb-h-5 sb-w-5" }))), /* @__PURE__ */ React11.createElement(
|
|
1237
1123
|
PopoverContent,
|
|
1238
1124
|
{
|
|
1239
1125
|
side: "left",
|
|
@@ -1243,7 +1129,7 @@ var EditButton = ({ id }) => {
|
|
|
1243
1129
|
className: "sb-p-0",
|
|
1244
1130
|
collisionPadding: 16
|
|
1245
1131
|
},
|
|
1246
|
-
/* @__PURE__ */
|
|
1132
|
+
/* @__PURE__ */ React11.createElement(EditPopoverInner, { id })
|
|
1247
1133
|
));
|
|
1248
1134
|
};
|
|
1249
1135
|
var EditPopoverInner = (props) => {
|
|
@@ -1255,18 +1141,18 @@ var EditPopoverInner = (props) => {
|
|
|
1255
1141
|
`[simple-builder]: Item with id ${id} not found in container item form component`
|
|
1256
1142
|
);
|
|
1257
1143
|
}
|
|
1258
|
-
return /* @__PURE__ */
|
|
1144
|
+
return /* @__PURE__ */ React11.createElement(Tabs, null, /* @__PURE__ */ React11.createElement(TabsList, { variant: "text", defaultValue: "content" }, /* @__PURE__ */ React11.createElement(TabsTrigger, { variant: "text", value: "content" }, "Inhoud"), /* @__PURE__ */ React11.createElement(TabsTrigger, { variant: "text", value: "design" }, "Design")), /* @__PURE__ */ React11.createElement(TabsContent, { value: "content" }, /* @__PURE__ */ React11.createElement(ContainerItemForm, { item })), /* @__PURE__ */ React11.createElement(TabsContent, { value: "design" }, /* @__PURE__ */ React11.createElement(ItemDesignForm, { item })));
|
|
1259
1145
|
};
|
|
1260
1146
|
var DeleteButton = ({ contentId }) => {
|
|
1261
1147
|
const { deleteContent } = useBuilder();
|
|
1262
|
-
return /* @__PURE__ */
|
|
1148
|
+
return /* @__PURE__ */ React11.createElement(AlertDialog, null, /* @__PURE__ */ React11.createElement(AlertDialogTrigger, { asChild: true }, /* @__PURE__ */ React11.createElement(
|
|
1263
1149
|
Button,
|
|
1264
1150
|
{
|
|
1265
1151
|
variant: "ghost",
|
|
1266
1152
|
className: "sb-w-8 sb-h-8 sb-p-0 sb-text-destructive"
|
|
1267
1153
|
},
|
|
1268
|
-
/* @__PURE__ */
|
|
1269
|
-
)), /* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ React11.createElement(Trash2Icon, { className: "sb-h-5 sb-w-5" })
|
|
1155
|
+
)), /* @__PURE__ */ React11.createElement(AlertDialogContent, null, /* @__PURE__ */ React11.createElement(AlertDialogDescription, null, "Weet je zeker dat je dit blok wilt verwijderen?"), /* @__PURE__ */ React11.createElement(AlertDialogFooter, null, /* @__PURE__ */ React11.createElement(AlertDialogCancel, null, "Annuleren"), /* @__PURE__ */ React11.createElement(
|
|
1270
1156
|
AlertDialogAction,
|
|
1271
1157
|
{
|
|
1272
1158
|
className: buttonVariants({ variant: "destructive" }),
|
|
@@ -1285,14 +1171,14 @@ var BuildContainerInner = (props) => {
|
|
|
1285
1171
|
"[simple-builder]: Multiple content blocks detected when using property multiple false."
|
|
1286
1172
|
);
|
|
1287
1173
|
}
|
|
1288
|
-
return /* @__PURE__ */
|
|
1174
|
+
return /* @__PURE__ */ React11.createElement("div", null, items.length <= 0 ? /* @__PURE__ */ React11.createElement(AddContentPlaceholder, { parent: id, container: name, index: 0 }) : multiple && /* @__PURE__ */ React11.createElement(AddContentDividerButton, { parent: id, container: name, index: 0 }), items.map((item, i) => /* @__PURE__ */ React11.createElement(React11.Fragment, { key: item.id }, /* @__PURE__ */ React11.createElement("div", { className: "sb-relative sb-container-item" }, /* @__PURE__ */ React11.createElement(DesignWrapper, { styles: item.styles }, builder.bindComponent(item, true)), /* @__PURE__ */ React11.createElement(
|
|
1289
1175
|
ContainerItemToolbar,
|
|
1290
1176
|
{
|
|
1291
1177
|
contentId: item.id,
|
|
1292
1178
|
canBringUp: i > 0,
|
|
1293
1179
|
canBringDown: i < items.length - 1
|
|
1294
1180
|
}
|
|
1295
|
-
)), multiple && /* @__PURE__ */
|
|
1181
|
+
)), multiple && /* @__PURE__ */ React11.createElement(
|
|
1296
1182
|
AddContentDividerButton,
|
|
1297
1183
|
{
|
|
1298
1184
|
parent: id,
|
|
@@ -1305,9 +1191,9 @@ var build_container_client_default = BuildContainerInner;
|
|
|
1305
1191
|
var AddContentButton = (props) => {
|
|
1306
1192
|
const components = builder.getComponents();
|
|
1307
1193
|
const { addContent } = useBuilder();
|
|
1308
|
-
return /* @__PURE__ */
|
|
1194
|
+
return /* @__PURE__ */ React11.createElement(Popover, null, /* @__PURE__ */ React11.createElement(PopoverTrigger, { asChild: true }, props.children), /* @__PURE__ */ React11.createElement(PopoverContent, { className: "sb-p-1" }, /* @__PURE__ */ React11.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-gap-2" }, components.map((component) => {
|
|
1309
1195
|
const Icon = component.icon ?? ImageIcon;
|
|
1310
|
-
return /* @__PURE__ */
|
|
1196
|
+
return /* @__PURE__ */ React11.createElement(PopoverClose, { key: component.name, asChild: true }, /* @__PURE__ */ React11.createElement(
|
|
1311
1197
|
Button,
|
|
1312
1198
|
{
|
|
1313
1199
|
variant: "ghost",
|
|
@@ -1321,22 +1207,22 @@ var AddContentButton = (props) => {
|
|
|
1321
1207
|
);
|
|
1322
1208
|
}
|
|
1323
1209
|
},
|
|
1324
|
-
/* @__PURE__ */
|
|
1210
|
+
/* @__PURE__ */ React11.createElement(Icon, { className: "sb-mr-2 sb-h-4 sb-w-4 sb-shrink-0" }),
|
|
1325
1211
|
component.friendlyName ?? component.name
|
|
1326
1212
|
));
|
|
1327
1213
|
}))));
|
|
1328
1214
|
};
|
|
1329
1215
|
var AddContentPlaceholder = (props) => {
|
|
1330
|
-
return /* @__PURE__ */
|
|
1216
|
+
return /* @__PURE__ */ React11.createElement(AddContentButton, { ...props }, /* @__PURE__ */ React11.createElement("div", { className: "sb-flex sb-justify-center sb-bg-primary/50 p-4" }, /* @__PURE__ */ React11.createElement(Button, { size: "sm" }, /* @__PURE__ */ React11.createElement(PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }), "Blok Toevoegen")));
|
|
1331
1217
|
};
|
|
1332
1218
|
var AddContentDividerButton = (props) => {
|
|
1333
|
-
return /* @__PURE__ */
|
|
1219
|
+
return /* @__PURE__ */ React11.createElement(AddContentButton, { ...props }, /* @__PURE__ */ React11.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.createElement(
|
|
1334
1220
|
Button,
|
|
1335
1221
|
{
|
|
1336
1222
|
size: "sm",
|
|
1337
1223
|
className: "sb-absolute sb-left-1/2 sb-top-1/2 sb--translate-y-1/2 sb--translate-x-1/2 sb-shadow"
|
|
1338
1224
|
},
|
|
1339
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ React11.createElement(PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
|
|
1340
1226
|
"Blok Toevoegen"
|
|
1341
1227
|
)));
|
|
1342
1228
|
};
|