@simple-builder/react 1.0.5 → 1.0.7

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