@simple-builder/react 1.0.4 → 1.0.6

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-NP2NHVJP.mjs';
3
- import { buttonVariants, Button, useBuilder } from './chunk-EQMVGJ6X.mjs';
4
- import { cn, DesignWrapper, builder, spacing, Image } from './chunk-BSE6WW6Q.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-DOQHCW2T.mjs';
3
+ import { buttonVariants, Button, useBuilder } from './chunk-JF244SXI.mjs';
4
+ import { cn, tv, DesignWrapper, builder, Image, spacing } from './chunk-PIRC2EWS.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,197 +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
654
- });
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()
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
- container: item.styles?.container ?? true,
664
- background: item.styles?.background ?? "",
665
- color: item.styles?.color ?? "",
666
- padding: {
667
- indipendent: spacing.isIndipendent(
668
- item.styles?.padding ?? ""
669
- ),
670
- horizontal: initialPadding.left,
671
- vertical: initialPadding.top,
672
- left: initialPadding.left,
673
- right: initialPadding.right,
674
- top: initialPadding.top,
675
- 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"))
676
895
  },
677
- margin: {
678
- indipendent: spacing.isIndipendent(
679
- item.styles?.margin ?? ""
680
- ),
681
- horizontal: initialMargin.left,
682
- vertical: initialMargin.top,
683
- left: initialMargin.left,
684
- right: initialMargin.right,
685
- top: initialMargin.top,
686
- bottom: initialMargin.bottom
896
+ mobile: {
897
+ background: getDefaultMobileValue("background"),
898
+ color: getDefaultMobileValue("color"),
899
+ padding: getSpacingValue(getDefaultMobileValue("padding")),
900
+ margin: getSpacingValue(getDefaultMobileValue("margin"))
687
901
  }
688
902
  }
689
903
  });
690
904
  const onSubmit = (values) => {
691
- const { container, background, color, padding: p, margin: m } = values;
692
- const padding = !p.indipendent ? `${p.vertical}px ${p.horizontal}px` : `${p.top}px ${p.right}px ${p.bottom}px ${p.left}px`;
693
- 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 && defaults?.[device2]?.[key] !== res ? { [key]: res } : {}
922
+ };
923
+ }, {});
924
+ };
925
+ const patchedDesktopValues = getPatchedDeviceValues();
926
+ const patchedMobileValues = getPatchedDeviceValues("mobile");
694
927
  patchItem(item.id, {
695
928
  styles: {
696
- container,
697
- background,
698
- color,
699
- padding,
700
- margin
929
+ ...container === false && { container },
930
+ ...Object.keys(patchedDesktopValues).length && {
931
+ desktop: patchedDesktopValues
932
+ },
933
+ ...Object.keys(patchedMobileValues).length && {
934
+ mobile: patchedMobileValues
935
+ }
701
936
  }
702
937
  });
703
938
  };
704
- React12.useEffect(() => {
939
+ React15.useEffect(() => {
705
940
  const subscription = form.watch(() => form.handleSubmit(onSubmit)());
706
941
  return () => subscription.unsubscribe();
707
942
  }, [form.watch, form.handleSubmit]);
708
943
  const [indipendentPadding, indipendentMargin] = form.watch([
709
- "padding.indipendent",
710
- "margin.indipendent"
944
+ `${device}.padding.indipendent`,
945
+ `${device}.margin.indipendent`
711
946
  ]);
712
- 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(
713
948
  FormField,
714
949
  {
715
950
  control: form.control,
716
- name: "background",
717
- 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(
718
954
  BackgroundPicker,
719
955
  {
720
956
  background: field.value,
721
957
  onBackgroundChange: field.onChange
722
958
  }
723
- )), /* @__PURE__ */ React12.createElement(FormMessage, null))
959
+ )), /* @__PURE__ */ React15.createElement(FormMessage, null))
724
960
  }
725
- ), /* @__PURE__ */ React12.createElement(
961
+ ), /* @__PURE__ */ React15.createElement(
726
962
  FormField,
727
963
  {
728
964
  control: form.control,
729
- name: "color",
730
- 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(
731
968
  ColorPicker,
732
969
  {
733
970
  color: field.value,
734
971
  onColorChange: field.onChange
735
972
  }
736
- )), /* @__PURE__ */ React12.createElement(FormMessage, null))
973
+ )), /* @__PURE__ */ React15.createElement(FormMessage, null))
737
974
  }
738
- ), /* @__PURE__ */ React12.createElement("hr", null), /* @__PURE__ */ React12.createElement(
975
+ ), /* @__PURE__ */ React15.createElement("hr", null), /* @__PURE__ */ React15.createElement(
739
976
  FormField,
740
977
  {
741
978
  control: form.control,
742
979
  name: "container",
743
- 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(
744
981
  Switch,
745
982
  {
746
983
  checked: !field.value,
747
984
  onCheckedChange: (v) => field.onChange(!v)
748
985
  }
749
- )), /* @__PURE__ */ React12.createElement(FormMessage, null))
986
+ )), /* @__PURE__ */ React15.createElement(FormMessage, null))
750
987
  }
751
- ), /* @__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(
752
989
  FormField,
753
990
  {
754
991
  control: form.control,
755
- name: "padding.horizontal",
756
- 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(
757
995
  AdvancedInput,
758
996
  {
759
997
  ...field,
760
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
761
- 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")
762
1000
  }
763
1001
  )))
764
1002
  }
765
- ), /* @__PURE__ */ React12.createElement(
1003
+ ), /* @__PURE__ */ React15.createElement(
766
1004
  FormField,
767
1005
  {
768
1006
  control: form.control,
769
- name: "padding.vertical",
770
- 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(
771
1010
  AdvancedInput,
772
1011
  {
773
1012
  ...field,
774
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
775
- 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")
776
1015
  }
777
1016
  )))
778
1017
  }
779
- )) : /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
1018
+ )) : /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
780
1019
  FormField,
781
1020
  {
782
1021
  control: form.control,
783
- name: "padding.left",
784
- 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(
785
1025
  AdvancedInput,
786
1026
  {
787
1027
  ...field,
788
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
789
- 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")
790
1030
  }
791
1031
  )))
792
1032
  }
793
- ), /* @__PURE__ */ React12.createElement(
1033
+ ), /* @__PURE__ */ React15.createElement(
794
1034
  FormField,
795
1035
  {
796
1036
  control: form.control,
797
- name: "padding.top",
798
- 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(
799
1040
  AdvancedInput,
800
1041
  {
801
1042
  ...field,
802
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
803
- 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")
804
1045
  }
805
1046
  )))
806
1047
  }
807
- ), /* @__PURE__ */ React12.createElement(
1048
+ ), /* @__PURE__ */ React15.createElement(
808
1049
  FormField,
809
1050
  {
810
1051
  control: form.control,
811
- name: "padding.right",
812
- 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(
813
1055
  AdvancedInput,
814
1056
  {
815
1057
  ...field,
816
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
817
- 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")
818
1060
  }
819
1061
  )))
820
1062
  }
821
- ), /* @__PURE__ */ React12.createElement(
1063
+ ), /* @__PURE__ */ React15.createElement(
822
1064
  FormField,
823
1065
  {
824
1066
  control: form.control,
825
- name: "padding.bottom",
826
- 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(
827
1070
  AdvancedInput,
828
1071
  {
829
1072
  ...field,
830
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
831
- 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")
832
1075
  }
833
1076
  )))
834
1077
  }
835
- ))), /* @__PURE__ */ React12.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React12.createElement(
1078
+ ))), /* @__PURE__ */ React15.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React15.createElement(
836
1079
  FormField,
837
1080
  {
838
1081
  control: form.control,
839
- name: "padding.indipendent",
840
- 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(
841
1085
  Toggle,
842
1086
  {
843
1087
  className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
@@ -846,99 +1090,106 @@ var ItemDesignForm = (props) => {
846
1090
  pressed: field.value,
847
1091
  onPressedChange: field.onChange
848
1092
  },
849
- /* @__PURE__ */ React12.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
1093
+ /* @__PURE__ */ React15.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
850
1094
  ))
851
1095
  }
852
- ))), /* @__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(
853
1097
  FormField,
854
1098
  {
855
1099
  control: form.control,
856
- name: "margin.horizontal",
857
- 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(
858
1103
  AdvancedInput,
859
1104
  {
860
1105
  ...field,
861
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
862
- 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")
863
1108
  }
864
1109
  )))
865
1110
  }
866
- ), /* @__PURE__ */ React12.createElement(
1111
+ ), /* @__PURE__ */ React15.createElement(
867
1112
  FormField,
868
1113
  {
869
1114
  control: form.control,
870
- name: "margin.vertical",
871
- 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(
872
1118
  AdvancedInput,
873
1119
  {
874
1120
  ...field,
875
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
876
- 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")
877
1123
  }
878
1124
  )))
879
1125
  }
880
- )) : /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
1126
+ )) : /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
881
1127
  FormField,
882
1128
  {
883
1129
  control: form.control,
884
- name: "margin.left",
885
- 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(
886
1133
  AdvancedInput,
887
1134
  {
888
1135
  ...field,
889
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
890
- 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")
891
1138
  }
892
1139
  )))
893
1140
  }
894
- ), /* @__PURE__ */ React12.createElement(
1141
+ ), /* @__PURE__ */ React15.createElement(
895
1142
  FormField,
896
1143
  {
897
1144
  control: form.control,
898
- name: "margin.top",
899
- 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(
900
1148
  AdvancedInput,
901
1149
  {
902
1150
  ...field,
903
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
904
- 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")
905
1153
  }
906
1154
  )))
907
1155
  }
908
- ), /* @__PURE__ */ React12.createElement(
1156
+ ), /* @__PURE__ */ React15.createElement(
909
1157
  FormField,
910
1158
  {
911
1159
  control: form.control,
912
- name: "margin.right",
913
- 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(
914
1163
  AdvancedInput,
915
1164
  {
916
1165
  ...field,
917
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
918
- 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")
919
1168
  }
920
1169
  )))
921
1170
  }
922
- ), /* @__PURE__ */ React12.createElement(
1171
+ ), /* @__PURE__ */ React15.createElement(
923
1172
  FormField,
924
1173
  {
925
1174
  control: form.control,
926
- name: "margin.bottom",
927
- 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(
928
1178
  AdvancedInput,
929
1179
  {
930
1180
  ...field,
931
- prepend: /* @__PURE__ */ React12.createElement(AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
932
- 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")
933
1183
  }
934
1184
  )))
935
1185
  }
936
- ))), /* @__PURE__ */ React12.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React12.createElement(
1186
+ ))), /* @__PURE__ */ React15.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React15.createElement(
937
1187
  FormField,
938
1188
  {
939
1189
  control: form.control,
940
- name: "margin.indipendent",
941
- 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(
942
1193
  Toggle,
943
1194
  {
944
1195
  className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
@@ -947,183 +1198,17 @@ var ItemDesignForm = (props) => {
947
1198
  pressed: field.value,
948
1199
  onPressedChange: field.onChange
949
1200
  },
950
- /* @__PURE__ */ React12.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
1201
+ /* @__PURE__ */ React15.createElement(ScanIcon, { className: "sb-h-4 sb-w-4" })
951
1202
  ))
952
1203
  }
953
- ))), /* @__PURE__ */ React12.createElement(FormMessage, null)))));
954
- };
955
- function Calendar({
956
- className,
957
- classNames,
958
- showOutsideDays = true,
959
- ...props
960
- }) {
961
- return /* @__PURE__ */ React12.createElement(
962
- DayPicker,
963
- {
964
- showOutsideDays,
965
- className: cn("sb-p-3 sb-font-roboto", className),
966
- classNames: {
967
- months: "sb-flex sb-flex-col sm:sb-flex-row sb-space-y-4 sm:sb-space-x-4 sm:sb-space-y-0",
968
- month: "sb-space-y-4",
969
- caption: "sb-flex sb-justify-center sb-pt-1 sb-relative sb-items-center",
970
- caption_label: "sb-text-sm sb-font-medium",
971
- nav: "sb-space-x-1 sb-flex sb-items-center",
972
- nav_button: cn(
973
- buttonVariants({ variant: "outline" }),
974
- "sb-h-7 sb-w-7 sb-bg-transparent sb-p-0 sb-opacity-50 hover:sb-opacity-100"
975
- ),
976
- nav_button_previous: "sb-absolute sb-left-1",
977
- nav_button_next: "sb-absolute sb-right-1",
978
- table: "sb-w-full sb-border-collapse sb-space-y-1",
979
- head_row: "sb-flex",
980
- head_cell: "sb-text-muted-foreground sb-rounded-md sb-w-8 sb-font-normal sb-text-[0.8rem]",
981
- row: "sb-flex sb-w-full sb-mt-2",
982
- cell: cn(
983
- "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",
984
- 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"
985
- ),
986
- day: cn(
987
- buttonVariants({ variant: "ghost" }),
988
- "sb-h-8 sb-w-8 sb-p-0 sb-font-normal aria-selected:sb-opacity-100"
989
- ),
990
- day_range_start: "day-range-start",
991
- day_range_end: "day-range-end",
992
- 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",
993
- day_today: "sb-bg-accent sb-text-accent-foreground",
994
- 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",
995
- day_disabled: "sb-text-muted-foreground sb-opacity-50",
996
- day_range_middle: "aria-selected:sb-bg-accent aria-selected:sb-text-accent-foreground",
997
- day_hidden: "invisible",
998
- ...classNames
999
- },
1000
- components: {
1001
- IconLeft: () => /* @__PURE__ */ React12.createElement(ChevronLeftIcon, { className: "sb-h-4 sb-w-4" }),
1002
- IconRight: () => /* @__PURE__ */ React12.createElement(ChevronRightIcon, { className: "sb-h-4 sb-w-4" })
1003
- },
1004
- ...props
1005
- }
1006
- );
1007
- }
1008
- Calendar.displayName = "Calendar";
1009
- var Textarea = React12.forwardRef(
1010
- ({ className, ...props }, ref) => {
1011
- return /* @__PURE__ */ React12.createElement(
1012
- "textarea",
1013
- {
1014
- className: cn(
1015
- "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",
1016
- className
1017
- ),
1018
- ref,
1019
- ...props
1020
- }
1021
- );
1022
- }
1023
- );
1024
- Textarea.displayName = "Textarea";
1025
-
1026
- // src/components/container-item-form.tsx
1027
- var ContainerItemForm = (props) => {
1028
- const { item } = props;
1029
- const { patchItem } = useBuilder();
1030
- const component = builder.getComponent(item.component);
1031
- if (!component) {
1032
- throw new Error(
1033
- `[simple-builder]: Component with id ${item.component} not found in container item form component`
1034
- );
1035
- }
1036
- const form = useForm({
1037
- defaultValues: (component.inputs || []).reduce(
1038
- (acc, input) => ({
1039
- ...acc,
1040
- [input.name]: item?.props?.[input.name] ?? input.defaultValue
1041
- }),
1042
- {}
1043
- )
1044
- });
1045
- const onSubmit = (values) => {
1046
- patchItem(item.id, {
1047
- props: values
1048
- });
1049
- };
1050
- React12.useEffect(() => {
1051
- const subscription = form.watch(() => form.handleSubmit(onSubmit)());
1052
- return () => subscription.unsubscribe();
1053
- }, [form.watch, form.handleSubmit]);
1054
- 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(
1055
- FormField,
1056
- {
1057
- key: input.name,
1058
- control: form.control,
1059
- name: input.name,
1060
- render: ({ field }) => /* @__PURE__ */ React12.createElement(RenderInput, { type: input.type, input, field })
1061
- }
1062
- )))));
1063
- };
1064
- var RenderInput = (props) => {
1065
- const { type, input, field } = props;
1066
- switch (type) {
1067
- case "string":
1068
- 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));
1069
- case "longText":
1070
- 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));
1071
- case "richText":
1072
- 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));
1073
- case "number":
1074
- 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));
1075
- case "color":
1076
- 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));
1077
- case "date":
1078
- 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(
1079
- Button,
1080
- {
1081
- variant: "outline",
1082
- size: "sm",
1083
- className: cn(
1084
- "sb-w-full sb-flex sb-justify-start sb-text-left sb-font-normal",
1085
- !field.value && "sb-text-muted-foreground"
1086
- )
1087
- },
1088
- /* @__PURE__ */ React12.createElement(CalendarIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
1089
- field.value ? format(field.value, "PPP") : /* @__PURE__ */ React12.createElement("span", null, "Pick a date")
1090
- )), /* @__PURE__ */ React12.createElement(PopoverContent, { className: "sb-w-auto sb-p-0", align: "start" }, /* @__PURE__ */ React12.createElement(
1091
- Calendar,
1092
- {
1093
- mode: "single",
1094
- selected: field.value,
1095
- onSelect: field.onChange,
1096
- initialFocus: true
1097
- }
1098
- )))), input.helperText && /* @__PURE__ */ React12.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React12.createElement(FormMessage, null));
1099
- case "boolean":
1100
- 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));
1101
- case "file":
1102
- return /* @__PURE__ */ React12.createElement(FormItem, null, /* @__PURE__ */ React12.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React12.createElement(FormControl, null, /* @__PURE__ */ React12.createElement(
1103
- MediaInput,
1104
- {
1105
- className: "sb-grid sb-grid-cols-2 sb-gap-1",
1106
- itemClassName: "sb-aspect-video sb-h-auto sb-w-full",
1107
- multiple: false,
1108
- onFilesChange: (files) => field.onChange(files[0]),
1109
- onError: (e) => console.error(
1110
- "[media-input]: Title: " + e?.title,
1111
- "media-input: Error: " + e?.description
1112
- )
1113
- }
1114
- )), input.helperText && /* @__PURE__ */ React12.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React12.createElement(FormMessage, null));
1115
- default:
1116
- throw new Error(
1117
- `[simple-builder]: Input type "${props.type}" not supported`
1118
- );
1119
- }
1204
+ ))), /* @__PURE__ */ React15.createElement(FormMessage, null))))));
1120
1205
  };
1121
1206
 
1122
1207
  // src/components/container-item-toolbar.tsx
1123
1208
  var ContainerItemToolbar = (props) => {
1124
1209
  const { contentId, canBringUp = false, canBringDown = false } = props;
1125
1210
  const { bringUp, bringDown } = useBuilder();
1126
- 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(
1127
1212
  Button,
1128
1213
  {
1129
1214
  variant: "ghost",
@@ -1131,8 +1216,8 @@ var ContainerItemToolbar = (props) => {
1131
1216
  onClick: () => bringUp(contentId),
1132
1217
  disabled: !canBringUp
1133
1218
  },
1134
- /* @__PURE__ */ React12.createElement(ArrowUp, { className: "sb-h-5 sb-w-5" })
1135
- ), /* @__PURE__ */ React12.createElement(
1219
+ /* @__PURE__ */ React15.createElement(ArrowUp, { className: "sb-h-5 sb-w-5" })
1220
+ ), /* @__PURE__ */ React15.createElement(
1136
1221
  Button,
1137
1222
  {
1138
1223
  variant: "ghost",
@@ -1140,11 +1225,11 @@ var ContainerItemToolbar = (props) => {
1140
1225
  onClick: () => bringDown(contentId),
1141
1226
  disabled: !canBringDown
1142
1227
  },
1143
- /* @__PURE__ */ React12.createElement(ArrowDown, { className: "sb-h-5 sb-w-5" })
1144
- ), /* @__PURE__ */ React12.createElement(DeleteButton, { contentId })));
1228
+ /* @__PURE__ */ React15.createElement(ArrowDown, { className: "sb-h-5 sb-w-5" })
1229
+ ), /* @__PURE__ */ React15.createElement(DeleteButton, { contentId })));
1145
1230
  };
1146
1231
  var EditButton = ({ id }) => {
1147
- 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(
1148
1233
  PopoverContent,
1149
1234
  {
1150
1235
  side: "left",
@@ -1154,7 +1239,7 @@ var EditButton = ({ id }) => {
1154
1239
  className: "sb-p-0",
1155
1240
  collisionPadding: 16
1156
1241
  },
1157
- /* @__PURE__ */ React12.createElement(EditPopoverInner, { id })
1242
+ /* @__PURE__ */ React15.createElement(EditPopoverInner, { id })
1158
1243
  ));
1159
1244
  };
1160
1245
  var EditPopoverInner = (props) => {
@@ -1166,18 +1251,18 @@ var EditPopoverInner = (props) => {
1166
1251
  `[simple-builder]: Item with id ${id} not found in container item form component`
1167
1252
  );
1168
1253
  }
1169
- 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 })));
1170
1255
  };
1171
1256
  var DeleteButton = ({ contentId }) => {
1172
1257
  const { deleteContent } = useBuilder();
1173
- 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(
1174
1259
  Button,
1175
1260
  {
1176
1261
  variant: "ghost",
1177
1262
  className: "sb-w-8 sb-h-8 sb-p-0 sb-text-destructive"
1178
1263
  },
1179
- /* @__PURE__ */ React12.createElement(Trash2Icon, { className: "sb-h-5 sb-w-5" })
1180
- )), /* @__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(
1181
1266
  AlertDialogAction,
1182
1267
  {
1183
1268
  className: buttonVariants({ variant: "destructive" }),
@@ -1196,14 +1281,14 @@ var BuildContainerInner = (props) => {
1196
1281
  "[simple-builder]: Multiple content blocks detected when using property multiple false."
1197
1282
  );
1198
1283
  }
1199
- 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(
1200
1285
  ContainerItemToolbar,
1201
1286
  {
1202
1287
  contentId: item.id,
1203
1288
  canBringUp: i > 0,
1204
1289
  canBringDown: i < items.length - 1
1205
1290
  }
1206
- )), multiple && /* @__PURE__ */ React12.createElement(
1291
+ )), multiple && /* @__PURE__ */ React15.createElement(
1207
1292
  AddContentDividerButton,
1208
1293
  {
1209
1294
  parent: id,
@@ -1216,9 +1301,9 @@ var build_container_client_default = BuildContainerInner;
1216
1301
  var AddContentButton = (props) => {
1217
1302
  const components = builder.getComponents();
1218
1303
  const { addContent } = useBuilder();
1219
- 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) => {
1220
1305
  const Icon = component.icon ?? ImageIcon;
1221
- 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(
1222
1307
  Button,
1223
1308
  {
1224
1309
  variant: "ghost",
@@ -1232,22 +1317,22 @@ var AddContentButton = (props) => {
1232
1317
  );
1233
1318
  }
1234
1319
  },
1235
- /* @__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" }),
1236
1321
  component.friendlyName ?? component.name
1237
1322
  ));
1238
1323
  }))));
1239
1324
  };
1240
1325
  var AddContentPlaceholder = (props) => {
1241
- 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")));
1242
1327
  };
1243
1328
  var AddContentDividerButton = (props) => {
1244
- 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(
1245
1330
  Button,
1246
1331
  {
1247
1332
  size: "sm",
1248
1333
  className: "sb-absolute sb-left-1/2 sb-top-1/2 sb--translate-y-1/2 sb--translate-x-1/2 sb-shadow"
1249
1334
  },
1250
- /* @__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" }),
1251
1336
  "Blok Toevoegen"
1252
1337
  )));
1253
1338
  };