@simple-builder/react 1.0.7 → 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-CMWYMBFS.mjs → build-container-client-BOFDDL56.mjs} +310 -420
- package/dist/{build-container-client-6RF5K7DV.js → build-container-client-PB2K64X3.js} +361 -471
- package/dist/{builder-content-MAJ7XTFP.mjs → builder-content-DNX5TNK2.mjs} +2 -2
- package/dist/{builder-content-PG6VWJYE.js → builder-content-SSON3UB4.js} +7 -7
- package/dist/{chunk-PL6PDFN7.mjs → chunk-2GQCSML3.mjs} +2 -4
- package/dist/{chunk-G3675W7A.js → chunk-ECJUPPTG.js} +1 -45
- package/dist/{chunk-YWYOBSS7.mjs → chunk-LULPEBSO.mjs} +2 -2
- package/dist/{chunk-YGH42ZBJ.mjs → chunk-OCMLPCSW.mjs} +2 -45
- package/dist/{chunk-JQVW2IR2.js → chunk-VFH3LVDU.js} +3 -3
- package/dist/{chunk-3FCXE75X.js → chunk-YGI2WZVP.js} +6 -8
- package/dist/index.js +6 -6
- package/dist/index.mjs +2 -2
- package/package.json +6 -6
|
@@ -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,372 +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
|
-
const value = item.styles?.mobile?.[key];
|
|
862
|
-
const desktopValue = item.styles?.desktop?.[key];
|
|
863
|
-
const def = defaults?.mobile?.[key];
|
|
864
|
-
const desktopDef = defaults?.desktop?.[key];
|
|
865
|
-
if (value !== void 0) {
|
|
866
|
-
return value;
|
|
867
|
-
} else if (def !== void 0) {
|
|
868
|
-
return def;
|
|
869
|
-
} else if (desktopValue !== void 0) {
|
|
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];
|
|
875
952
|
}
|
|
953
|
+
if (device2 === "mobile") {
|
|
954
|
+
const desktopValue = getDefaultDeviceValue({
|
|
955
|
+
...params,
|
|
956
|
+
device: "desktop"
|
|
957
|
+
});
|
|
958
|
+
if (desktopValue !== void 0) {
|
|
959
|
+
return desktopValue;
|
|
960
|
+
}
|
|
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
|
-
|
|
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;
|
|
918
997
|
}
|
|
919
998
|
return {
|
|
920
999
|
...acc,
|
|
921
|
-
...
|
|
1000
|
+
...value && { [key]: value }
|
|
922
1001
|
};
|
|
923
|
-
},
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
const patchedMobileValues = getPatchedDeviceValues("mobile");
|
|
1002
|
+
},
|
|
1003
|
+
{ ...item.styles?.mobile }
|
|
1004
|
+
);
|
|
927
1005
|
patchItem(item.id, {
|
|
928
1006
|
styles: {
|
|
929
1007
|
...container === false && { container },
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
},
|
|
933
|
-
...Object.keys(patchedMobileValues).length && {
|
|
934
|
-
mobile: patchedMobileValues
|
|
935
|
-
}
|
|
1008
|
+
desktop: desktopPatch,
|
|
1009
|
+
mobile: mobilePatch
|
|
936
1010
|
}
|
|
937
1011
|
});
|
|
938
1012
|
};
|
|
939
|
-
|
|
1013
|
+
const [device, setDevice] = React11.useState("desktop");
|
|
1014
|
+
React11.useEffect(() => {
|
|
940
1015
|
const subscription = form.watch(() => form.handleSubmit(onSubmit)());
|
|
941
1016
|
return () => subscription.unsubscribe();
|
|
942
1017
|
}, [form.watch, form.handleSubmit]);
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
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(
|
|
948
1026
|
FormField,
|
|
949
1027
|
{
|
|
950
1028
|
control: form.control,
|
|
951
1029
|
key: `${device}.background`,
|
|
952
1030
|
name: `${device}.background`,
|
|
953
|
-
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(
|
|
954
1032
|
BackgroundPicker,
|
|
955
1033
|
{
|
|
956
1034
|
background: field.value,
|
|
957
1035
|
onBackgroundChange: field.onChange
|
|
958
1036
|
}
|
|
959
|
-
)), /* @__PURE__ */
|
|
1037
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
960
1038
|
}
|
|
961
|
-
), /* @__PURE__ */
|
|
1039
|
+
), /* @__PURE__ */ React11.createElement(
|
|
962
1040
|
FormField,
|
|
963
1041
|
{
|
|
964
1042
|
control: form.control,
|
|
965
1043
|
key: `${device}.color`,
|
|
966
1044
|
name: `${device}.color`,
|
|
967
|
-
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(
|
|
968
1046
|
ColorPicker,
|
|
969
1047
|
{
|
|
970
1048
|
color: field.value,
|
|
971
1049
|
onColorChange: field.onChange
|
|
972
1050
|
}
|
|
973
|
-
)), /* @__PURE__ */
|
|
1051
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
974
1052
|
}
|
|
975
|
-
), /* @__PURE__ */
|
|
1053
|
+
), /* @__PURE__ */ React11.createElement("hr", null), /* @__PURE__ */ React11.createElement(
|
|
976
1054
|
FormField,
|
|
977
1055
|
{
|
|
978
1056
|
control: form.control,
|
|
979
1057
|
name: "container",
|
|
980
|
-
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(
|
|
981
1059
|
Switch,
|
|
982
1060
|
{
|
|
983
1061
|
checked: !field.value,
|
|
984
1062
|
onCheckedChange: (v) => field.onChange(!v)
|
|
985
1063
|
}
|
|
986
|
-
)), /* @__PURE__ */
|
|
987
|
-
}
|
|
988
|
-
), /* @__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(
|
|
989
|
-
FormField,
|
|
990
|
-
{
|
|
991
|
-
control: form.control,
|
|
992
|
-
key: `${device}.padding.horizontal`,
|
|
993
|
-
name: `${device}.padding.horizontal`,
|
|
994
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
995
|
-
AdvancedInput,
|
|
996
|
-
{
|
|
997
|
-
...field,
|
|
998
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
|
|
999
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1000
|
-
}
|
|
1001
|
-
)))
|
|
1002
|
-
}
|
|
1003
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1004
|
-
FormField,
|
|
1005
|
-
{
|
|
1006
|
-
control: form.control,
|
|
1007
|
-
key: `${device}.padding.vertical`,
|
|
1008
|
-
name: `${device}.padding.vertical`,
|
|
1009
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1010
|
-
AdvancedInput,
|
|
1011
|
-
{
|
|
1012
|
-
...field,
|
|
1013
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
1014
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1015
|
-
}
|
|
1016
|
-
)))
|
|
1017
|
-
}
|
|
1018
|
-
)) : /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
1019
|
-
FormField,
|
|
1020
|
-
{
|
|
1021
|
-
control: form.control,
|
|
1022
|
-
key: `${device}.padding.left`,
|
|
1023
|
-
name: `${device}.padding.left`,
|
|
1024
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1025
|
-
AdvancedInput,
|
|
1026
|
-
{
|
|
1027
|
-
...field,
|
|
1028
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
|
|
1029
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1030
|
-
}
|
|
1031
|
-
)))
|
|
1032
|
-
}
|
|
1033
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1034
|
-
FormField,
|
|
1035
|
-
{
|
|
1036
|
-
control: form.control,
|
|
1037
|
-
key: `${device}.padding.top`,
|
|
1038
|
-
name: `${device}.padding.top`,
|
|
1039
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1040
|
-
AdvancedInput,
|
|
1041
|
-
{
|
|
1042
|
-
...field,
|
|
1043
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
1044
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1045
|
-
}
|
|
1046
|
-
)))
|
|
1047
|
-
}
|
|
1048
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1049
|
-
FormField,
|
|
1050
|
-
{
|
|
1051
|
-
control: form.control,
|
|
1052
|
-
key: `${device}.padding.right`,
|
|
1053
|
-
name: `${device}.padding.right`,
|
|
1054
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1055
|
-
AdvancedInput,
|
|
1056
|
-
{
|
|
1057
|
-
...field,
|
|
1058
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
|
|
1059
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1060
|
-
}
|
|
1061
|
-
)))
|
|
1062
|
-
}
|
|
1063
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1064
|
-
FormField,
|
|
1065
|
-
{
|
|
1066
|
-
control: form.control,
|
|
1067
|
-
key: `${device}.padding.bottom`,
|
|
1068
|
-
name: `${device}.padding.bottom`,
|
|
1069
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1070
|
-
AdvancedInput,
|
|
1071
|
-
{
|
|
1072
|
-
...field,
|
|
1073
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
|
|
1074
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1075
|
-
}
|
|
1076
|
-
)))
|
|
1077
|
-
}
|
|
1078
|
-
))), /* @__PURE__ */ React15.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React15.createElement(
|
|
1079
|
-
FormField,
|
|
1080
|
-
{
|
|
1081
|
-
control: form.control,
|
|
1082
|
-
key: `${device}.padding.indipendent`,
|
|
1083
|
-
name: `${device}.padding.indipendent`,
|
|
1084
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1085
|
-
Toggle,
|
|
1086
|
-
{
|
|
1087
|
-
className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
|
|
1088
|
-
variant: "outline",
|
|
1089
|
-
size: "sm",
|
|
1090
|
-
pressed: field.value,
|
|
1091
|
-
onPressedChange: field.onChange
|
|
1092
|
-
},
|
|
1093
|
-
/* @__PURE__ */ React15.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
|
|
1094
|
-
))
|
|
1095
|
-
}
|
|
1096
|
-
))), /* @__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(
|
|
1097
|
-
FormField,
|
|
1098
|
-
{
|
|
1099
|
-
control: form.control,
|
|
1100
|
-
key: `${device}.margin.horizontal`,
|
|
1101
|
-
name: `${device}.margin.horizontal`,
|
|
1102
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1103
|
-
AdvancedInput,
|
|
1104
|
-
{
|
|
1105
|
-
...field,
|
|
1106
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
|
|
1107
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1108
|
-
}
|
|
1109
|
-
)))
|
|
1110
|
-
}
|
|
1111
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1112
|
-
FormField,
|
|
1113
|
-
{
|
|
1114
|
-
control: form.control,
|
|
1115
|
-
key: `${device}.margin.vertical`,
|
|
1116
|
-
name: `${device}.margin.vertical`,
|
|
1117
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1118
|
-
AdvancedInput,
|
|
1119
|
-
{
|
|
1120
|
-
...field,
|
|
1121
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
1122
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1123
|
-
}
|
|
1124
|
-
)))
|
|
1125
|
-
}
|
|
1126
|
-
)) : /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
1127
|
-
FormField,
|
|
1128
|
-
{
|
|
1129
|
-
control: form.control,
|
|
1130
|
-
key: `${device}.margin.left`,
|
|
1131
|
-
name: `${device}.margin.left`,
|
|
1132
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1133
|
-
AdvancedInput,
|
|
1134
|
-
{
|
|
1135
|
-
...field,
|
|
1136
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
|
|
1137
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1138
|
-
}
|
|
1139
|
-
)))
|
|
1140
|
-
}
|
|
1141
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1142
|
-
FormField,
|
|
1143
|
-
{
|
|
1144
|
-
control: form.control,
|
|
1145
|
-
key: `${device}.margin.top`,
|
|
1146
|
-
name: `${device}.margin.top`,
|
|
1147
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormItem, null, /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1148
|
-
AdvancedInput,
|
|
1149
|
-
{
|
|
1150
|
-
...field,
|
|
1151
|
-
prepend: /* @__PURE__ */ React15.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
|
|
1152
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1153
|
-
}
|
|
1154
|
-
)))
|
|
1064
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
1155
1065
|
}
|
|
1156
|
-
), /* @__PURE__ */
|
|
1066
|
+
), /* @__PURE__ */ React11.createElement("hr", null), /* @__PURE__ */ React11.createElement(
|
|
1157
1067
|
FormField,
|
|
1158
1068
|
{
|
|
1159
1069
|
control: form.control,
|
|
1160
|
-
key: `${device}.
|
|
1161
|
-
name: `${device}.
|
|
1162
|
-
render: ({ field }) => /* @__PURE__ */
|
|
1163
|
-
|
|
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,
|
|
1164
1074
|
{
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1075
|
+
value: field.value,
|
|
1076
|
+
onChange: field.onChange
|
|
1168
1077
|
}
|
|
1169
|
-
)))
|
|
1078
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
1170
1079
|
}
|
|
1171
|
-
), /* @__PURE__ */
|
|
1080
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1172
1081
|
FormField,
|
|
1173
1082
|
{
|
|
1174
1083
|
control: form.control,
|
|
1175
|
-
key: `${device}.margin
|
|
1176
|
-
name: `${device}.margin
|
|
1177
|
-
render: ({ field }) => /* @__PURE__ */
|
|
1178
|
-
|
|
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,
|
|
1179
1088
|
{
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
append: /* @__PURE__ */ React15.createElement("span", { className: "sb-text-muted-foreground" }, "px")
|
|
1089
|
+
value: field.value,
|
|
1090
|
+
onChange: field.onChange
|
|
1183
1091
|
}
|
|
1184
|
-
)))
|
|
1185
|
-
}
|
|
1186
|
-
))), /* @__PURE__ */ React15.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React15.createElement(
|
|
1187
|
-
FormField,
|
|
1188
|
-
{
|
|
1189
|
-
control: form.control,
|
|
1190
|
-
key: `${device}.margin.indipendent`,
|
|
1191
|
-
name: `${device}.margin.indipendent`,
|
|
1192
|
-
render: ({ field }) => /* @__PURE__ */ React15.createElement(FormControl, null, /* @__PURE__ */ React15.createElement(
|
|
1193
|
-
Toggle,
|
|
1194
|
-
{
|
|
1195
|
-
className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
|
|
1196
|
-
variant: "outline",
|
|
1197
|
-
size: "sm",
|
|
1198
|
-
pressed: field.value,
|
|
1199
|
-
onPressedChange: field.onChange
|
|
1200
|
-
},
|
|
1201
|
-
/* @__PURE__ */ React15.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
|
|
1202
|
-
))
|
|
1092
|
+
)), /* @__PURE__ */ React11.createElement(FormMessage, null))
|
|
1203
1093
|
}
|
|
1204
|
-
)))
|
|
1094
|
+
)))));
|
|
1205
1095
|
};
|
|
1206
1096
|
|
|
1207
1097
|
// src/components/container-item-toolbar.tsx
|
|
1208
1098
|
var ContainerItemToolbar = (props) => {
|
|
1209
1099
|
const { contentId, canBringUp = false, canBringDown = false } = props;
|
|
1210
1100
|
const { bringUp, bringDown } = useBuilder();
|
|
1211
|
-
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(
|
|
1212
1102
|
Button,
|
|
1213
1103
|
{
|
|
1214
1104
|
variant: "ghost",
|
|
@@ -1216,8 +1106,8 @@ var ContainerItemToolbar = (props) => {
|
|
|
1216
1106
|
onClick: () => bringUp(contentId),
|
|
1217
1107
|
disabled: !canBringUp
|
|
1218
1108
|
},
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
), /* @__PURE__ */
|
|
1109
|
+
/* @__PURE__ */ React11.createElement(ArrowUp, { className: "sb-h-5 sb-w-5" })
|
|
1110
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1221
1111
|
Button,
|
|
1222
1112
|
{
|
|
1223
1113
|
variant: "ghost",
|
|
@@ -1225,11 +1115,11 @@ var ContainerItemToolbar = (props) => {
|
|
|
1225
1115
|
onClick: () => bringDown(contentId),
|
|
1226
1116
|
disabled: !canBringDown
|
|
1227
1117
|
},
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
), /* @__PURE__ */
|
|
1118
|
+
/* @__PURE__ */ React11.createElement(ArrowDown, { className: "sb-h-5 sb-w-5" })
|
|
1119
|
+
), /* @__PURE__ */ React11.createElement(DeleteButton, { contentId })));
|
|
1230
1120
|
};
|
|
1231
1121
|
var EditButton = ({ id }) => {
|
|
1232
|
-
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(
|
|
1233
1123
|
PopoverContent,
|
|
1234
1124
|
{
|
|
1235
1125
|
side: "left",
|
|
@@ -1239,7 +1129,7 @@ var EditButton = ({ id }) => {
|
|
|
1239
1129
|
className: "sb-p-0",
|
|
1240
1130
|
collisionPadding: 16
|
|
1241
1131
|
},
|
|
1242
|
-
/* @__PURE__ */
|
|
1132
|
+
/* @__PURE__ */ React11.createElement(EditPopoverInner, { id })
|
|
1243
1133
|
));
|
|
1244
1134
|
};
|
|
1245
1135
|
var EditPopoverInner = (props) => {
|
|
@@ -1251,18 +1141,18 @@ var EditPopoverInner = (props) => {
|
|
|
1251
1141
|
`[simple-builder]: Item with id ${id} not found in container item form component`
|
|
1252
1142
|
);
|
|
1253
1143
|
}
|
|
1254
|
-
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 })));
|
|
1255
1145
|
};
|
|
1256
1146
|
var DeleteButton = ({ contentId }) => {
|
|
1257
1147
|
const { deleteContent } = useBuilder();
|
|
1258
|
-
return /* @__PURE__ */
|
|
1148
|
+
return /* @__PURE__ */ React11.createElement(AlertDialog, null, /* @__PURE__ */ React11.createElement(AlertDialogTrigger, { asChild: true }, /* @__PURE__ */ React11.createElement(
|
|
1259
1149
|
Button,
|
|
1260
1150
|
{
|
|
1261
1151
|
variant: "ghost",
|
|
1262
1152
|
className: "sb-w-8 sb-h-8 sb-p-0 sb-text-destructive"
|
|
1263
1153
|
},
|
|
1264
|
-
/* @__PURE__ */
|
|
1265
|
-
)), /* @__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(
|
|
1266
1156
|
AlertDialogAction,
|
|
1267
1157
|
{
|
|
1268
1158
|
className: buttonVariants({ variant: "destructive" }),
|
|
@@ -1281,14 +1171,14 @@ var BuildContainerInner = (props) => {
|
|
|
1281
1171
|
"[simple-builder]: Multiple content blocks detected when using property multiple false."
|
|
1282
1172
|
);
|
|
1283
1173
|
}
|
|
1284
|
-
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(
|
|
1285
1175
|
ContainerItemToolbar,
|
|
1286
1176
|
{
|
|
1287
1177
|
contentId: item.id,
|
|
1288
1178
|
canBringUp: i > 0,
|
|
1289
1179
|
canBringDown: i < items.length - 1
|
|
1290
1180
|
}
|
|
1291
|
-
)), multiple && /* @__PURE__ */
|
|
1181
|
+
)), multiple && /* @__PURE__ */ React11.createElement(
|
|
1292
1182
|
AddContentDividerButton,
|
|
1293
1183
|
{
|
|
1294
1184
|
parent: id,
|
|
@@ -1301,9 +1191,9 @@ var build_container_client_default = BuildContainerInner;
|
|
|
1301
1191
|
var AddContentButton = (props) => {
|
|
1302
1192
|
const components = builder.getComponents();
|
|
1303
1193
|
const { addContent } = useBuilder();
|
|
1304
|
-
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) => {
|
|
1305
1195
|
const Icon = component.icon ?? ImageIcon;
|
|
1306
|
-
return /* @__PURE__ */
|
|
1196
|
+
return /* @__PURE__ */ React11.createElement(PopoverClose, { key: component.name, asChild: true }, /* @__PURE__ */ React11.createElement(
|
|
1307
1197
|
Button,
|
|
1308
1198
|
{
|
|
1309
1199
|
variant: "ghost",
|
|
@@ -1317,22 +1207,22 @@ var AddContentButton = (props) => {
|
|
|
1317
1207
|
);
|
|
1318
1208
|
}
|
|
1319
1209
|
},
|
|
1320
|
-
/* @__PURE__ */
|
|
1210
|
+
/* @__PURE__ */ React11.createElement(Icon, { className: "sb-mr-2 sb-h-4 sb-w-4 sb-shrink-0" }),
|
|
1321
1211
|
component.friendlyName ?? component.name
|
|
1322
1212
|
));
|
|
1323
1213
|
}))));
|
|
1324
1214
|
};
|
|
1325
1215
|
var AddContentPlaceholder = (props) => {
|
|
1326
|
-
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")));
|
|
1327
1217
|
};
|
|
1328
1218
|
var AddContentDividerButton = (props) => {
|
|
1329
|
-
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(
|
|
1330
1220
|
Button,
|
|
1331
1221
|
{
|
|
1332
1222
|
size: "sm",
|
|
1333
1223
|
className: "sb-absolute sb-left-1/2 sb-top-1/2 sb--translate-y-1/2 sb--translate-x-1/2 sb-shadow"
|
|
1334
1224
|
},
|
|
1335
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ React11.createElement(PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
|
|
1336
1226
|
"Blok Toevoegen"
|
|
1337
1227
|
)));
|
|
1338
1228
|
};
|