@simple-builder/react 1.0.21 → 1.2.0

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.
Files changed (28) hide show
  1. package/dist/{build-container-client-UTWTM32L.css → build-container-client-6NICVHM7.css} +244 -13
  2. package/dist/build-container-client-BAVL356F.js +2282 -0
  3. package/dist/build-container-client-KI3QULNY.mjs +2246 -0
  4. package/dist/build-container-client-UYQEUZU5.mjs +2251 -0
  5. package/dist/build-container-client-XVX67J7D.js +2287 -0
  6. package/dist/{builder-content-BGBWMI6B.js → builder-content-2CLARIDQ.js} +7 -7
  7. package/dist/{builder-content-RQZGNHGE.mjs → builder-content-J45ZXXEM.mjs} +2 -2
  8. package/dist/{builder-content-JWIMCW6L.css → builder-content-P24OTLH4.css} +244 -13
  9. package/dist/builder-content-Y7KZGM4Z.js +42 -0
  10. package/dist/builder-content-YOL4MKX3.mjs +20 -0
  11. package/dist/{chunk-SMX2JVU7.js → chunk-47IWLKYO.js} +1 -1
  12. package/dist/{chunk-YM22QCRZ.mjs → chunk-527WHDFS.mjs} +1 -1
  13. package/dist/chunk-F7EVAQN7.mjs +123 -0
  14. package/dist/{chunk-KD2J6VPO.mjs → chunk-FUIGTZRW.mjs} +2 -2
  15. package/dist/{chunk-Q2EMWEEZ.js → chunk-IAIJXTFG.js} +28 -21
  16. package/dist/chunk-ISTZWAYI.js +263 -0
  17. package/dist/{chunk-GQ2NJQNP.js → chunk-M2YJU6AM.js} +3 -3
  18. package/dist/chunk-MV72DQML.mjs +20 -0
  19. package/dist/{chunk-JDY3WVEQ.mjs → chunk-Q42UV6O3.mjs} +25 -18
  20. package/dist/chunk-TZQPIYI7.mjs +238 -0
  21. package/dist/chunk-U3LGZ4IJ.js +42 -0
  22. package/dist/chunk-ZEA47N62.js +153 -0
  23. package/dist/index.css +244 -13
  24. package/dist/index.js +6 -6
  25. package/dist/index.mjs +2 -2
  26. package/package.json +18 -5
  27. package/dist/build-container-client-EGUVIJQE.mjs +0 -1479
  28. package/dist/build-container-client-VLVAC2RM.js +0 -1509
@@ -0,0 +1,2287 @@
1
+ 'use client';
2
+ 'use client';
3
+ 'use client';
4
+ 'use client';
5
+ 'use client';
6
+ 'use strict';
7
+
8
+ require('./chunk-M2YJU6AM.js');
9
+ var chunkIAIJXTFG_js = require('./chunk-IAIJXTFG.js');
10
+ var chunk47IWLKYO_js = require('./chunk-47IWLKYO.js');
11
+ var React25 = require('react');
12
+ var lucideReact = require('lucide-react');
13
+ var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
14
+ var PopoverPrimitive = require('@radix-ui/react-popover');
15
+ var react = require('@tiptap/react');
16
+ var extensionColor = require('@tiptap/extension-color');
17
+ var extensionTextStyle = require('@tiptap/extension-text-style');
18
+ var extensionUnderline = require('@tiptap/extension-underline');
19
+ var starterKit = require('@tiptap/starter-kit');
20
+ var TiptapLink = require('@tiptap/extension-link');
21
+ var state = require('@tiptap/pm/state');
22
+ var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
23
+ var SeparatorPrimitive = require('@radix-ui/react-separator');
24
+ var TogglePrimitive = require('@radix-ui/react-toggle');
25
+ var classVarianceAuthority = require('class-variance-authority');
26
+ var lu = require('react-icons/lu');
27
+ var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
28
+ var DialogPrimitive = require('@radix-ui/react-dialog');
29
+ var reactSlot = require('@radix-ui/react-slot');
30
+ var reactHookForm = require('react-hook-form');
31
+ var LabelPrimitive = require('@radix-ui/react-label');
32
+ var SwitchPrimitives = require('@radix-ui/react-switch');
33
+ var zod$1 = require('@hookform/resolvers/zod');
34
+ var zod = require('zod');
35
+ var dateFns = require('date-fns');
36
+ var reactDayPicker = require('react-day-picker');
37
+ var SelectPrimitive = require('@radix-ui/react-select');
38
+ var TabsPrimitive = require('@radix-ui/react-tabs');
39
+ var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
40
+
41
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
42
+
43
+ function _interopNamespace(e) {
44
+ if (e && e.__esModule) return e;
45
+ var n = Object.create(null);
46
+ if (e) {
47
+ Object.keys(e).forEach(function (k) {
48
+ if (k !== 'default') {
49
+ var d = Object.getOwnPropertyDescriptor(e, k);
50
+ Object.defineProperty(n, k, d.get ? d : {
51
+ enumerable: true,
52
+ get: function () { return e[k]; }
53
+ });
54
+ }
55
+ });
56
+ }
57
+ n.default = e;
58
+ return Object.freeze(n);
59
+ }
60
+
61
+ var React25__namespace = /*#__PURE__*/_interopNamespace(React25);
62
+ var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
63
+ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
64
+ var TiptapLink__default = /*#__PURE__*/_interopDefault(TiptapLink);
65
+ var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
66
+ var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
67
+ var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
68
+ var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
69
+ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
70
+ var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
71
+ var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
72
+ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
73
+ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
74
+ var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
75
+
76
+ var AlertDialog = AlertDialogPrimitive__namespace.Root;
77
+ var AlertDialogTrigger = AlertDialogPrimitive__namespace.Trigger;
78
+ var AlertDialogPortal = AlertDialogPrimitive__namespace.Portal;
79
+ var AlertDialogOverlay = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
80
+ AlertDialogPrimitive__namespace.Overlay,
81
+ {
82
+ className: chunk47IWLKYO_js.cn(
83
+ "sb-fixed sb-inset-0 sb-z-50 sb-bg-background/80 sb-backdrop-blur-sm data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0",
84
+ className
85
+ ),
86
+ ...props,
87
+ ref
88
+ }
89
+ ));
90
+ AlertDialogOverlay.displayName = AlertDialogPrimitive__namespace.Overlay.displayName;
91
+ var AlertDialogContent = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(AlertDialogPortal, null, /* @__PURE__ */ React25__namespace.createElement(AlertDialogOverlay, null), /* @__PURE__ */ React25__namespace.createElement(
92
+ AlertDialogPrimitive__namespace.Content,
93
+ {
94
+ ref,
95
+ className: chunk47IWLKYO_js.cn(
96
+ "sb-fixed sb-font-roboto sb-left-[50%] sb-top-[50%] sb-z-50 sb-grid sb-w-full sb-max-w-lg sb-translate-x-[-50%] sb-translate-y-[-50%] sb-gap-4 sb-border sb-bg-background sb-p-6 sb-shadow-lg sb-duration-200 data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[state=closed]:sb-slide-out-to-left-1/2 data-[state=closed]:sb-slide-out-to-top-[48%] data-[state=open]:sb-slide-in-from-left-1/2 data-[state=open]:sb-slide-in-from-top-[48%] sm:sb-rounded-lg",
97
+ className
98
+ ),
99
+ ...props
100
+ }
101
+ )));
102
+ AlertDialogContent.displayName = AlertDialogPrimitive__namespace.Content.displayName;
103
+ var AlertDialogFooter = ({
104
+ className,
105
+ ...props
106
+ }) => /* @__PURE__ */ React25__namespace.createElement(
107
+ "div",
108
+ {
109
+ className: chunk47IWLKYO_js.cn(
110
+ "sb-flex sb-flex-col-reverse sm:sb-flex-row sm:sb-justify-end sm:sb-space-x-2",
111
+ className
112
+ ),
113
+ ...props
114
+ }
115
+ );
116
+ AlertDialogFooter.displayName = "AlertDialogFooter";
117
+ var AlertDialogTitle = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
118
+ AlertDialogPrimitive__namespace.Title,
119
+ {
120
+ ref,
121
+ className: chunk47IWLKYO_js.cn("sb-text-lg sb-font-semibold", className),
122
+ ...props
123
+ }
124
+ ));
125
+ AlertDialogTitle.displayName = AlertDialogPrimitive__namespace.Title.displayName;
126
+ var AlertDialogDescription = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
127
+ AlertDialogPrimitive__namespace.Description,
128
+ {
129
+ ref,
130
+ className: chunk47IWLKYO_js.cn("sb-text-sm sb-text-muted-foreground", className),
131
+ ...props
132
+ }
133
+ ));
134
+ AlertDialogDescription.displayName = AlertDialogPrimitive__namespace.Description.displayName;
135
+ var AlertDialogAction = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
136
+ AlertDialogPrimitive__namespace.Action,
137
+ {
138
+ ref,
139
+ className: chunk47IWLKYO_js.cn(chunkIAIJXTFG_js.buttonVariants(), className),
140
+ ...props
141
+ }
142
+ ));
143
+ AlertDialogAction.displayName = AlertDialogPrimitive__namespace.Action.displayName;
144
+ var AlertDialogCancel = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
145
+ AlertDialogPrimitive__namespace.Cancel,
146
+ {
147
+ ref,
148
+ className: chunk47IWLKYO_js.cn(
149
+ chunkIAIJXTFG_js.buttonVariants({ variant: "outline" }),
150
+ "sb-mt-2 sm:sb-mt-0",
151
+ className
152
+ ),
153
+ ...props
154
+ }
155
+ ));
156
+ AlertDialogCancel.displayName = AlertDialogPrimitive__namespace.Cancel.displayName;
157
+ var Popover = PopoverPrimitive__namespace.Root;
158
+ var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
159
+ var PopoverClose = PopoverPrimitive__namespace.Close;
160
+ var PopoverContent = React25__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(PopoverPrimitive__namespace.Portal, null, /* @__PURE__ */ React25__namespace.createElement(
161
+ PopoverPrimitive__namespace.Content,
162
+ {
163
+ ref,
164
+ align,
165
+ sideOffset,
166
+ className: chunk47IWLKYO_js.cn(
167
+ "sb-z-50 sb-w-72 sb-rounded-md sb-border sb-bg-popover sb-p-4 sb-text-popover-foreground sb-shadow-md sb-outline-none data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[side=bottom]:sb-slide-in-from-top-2 data-[side=left]:sb-slide-in-from-right-2 data-[side=right]:sb-slide-in-from-left-2 data-[side=top]:sb-slide-in-from-bottom-2 sb-origin-[--radix-popover-content-transform-origin]",
168
+ className
169
+ ),
170
+ ...props
171
+ }
172
+ )));
173
+ PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
174
+ var Link = TiptapLink__default.default.extend({
175
+ inclusive: false,
176
+ parseHTML() {
177
+ return [{ tag: 'a[href]:not([data-type="button"]):not([href *= "javascript:" i])' }];
178
+ },
179
+ renderHTML({ HTMLAttributes }) {
180
+ return ["a", react.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
181
+ },
182
+ addOptions() {
183
+ return {
184
+ ...this.parent?.(),
185
+ openOnClick: false
186
+ };
187
+ },
188
+ addProseMirrorPlugins() {
189
+ return [
190
+ ...this.parent?.() || [],
191
+ new state.Plugin({
192
+ props: {
193
+ handleClick(view, pos) {
194
+ const { schema: schema2, doc, tr } = view.state;
195
+ const range = react.getMarkRange(doc.resolve(pos), schema2.marks.link);
196
+ if (!range) {
197
+ return;
198
+ }
199
+ const { from, to } = range;
200
+ const start = Math.min(from, to);
201
+ const end = Math.max(from, to);
202
+ if (pos < start || pos > end) {
203
+ return;
204
+ }
205
+ const $start = doc.resolve(start);
206
+ const $end = doc.resolve(end);
207
+ const transaction = tr.setSelection(new state.TextSelection($start, $end));
208
+ view.dispatch(transaction);
209
+ }
210
+ }
211
+ })
212
+ ];
213
+ }
214
+ });
215
+
216
+ // src/features/rich-text-editor/utils/get-output.ts
217
+ var getOutput = (editor, format2) => {
218
+ switch (format2) {
219
+ case "json":
220
+ return editor.getJSON();
221
+ case "html":
222
+ return editor.isEmpty ? "" : editor.getHTML();
223
+ default:
224
+ return editor.getText();
225
+ }
226
+ };
227
+
228
+ // src/features/rich-text-editor/hooks/useRichTextEditor.ts
229
+ var useRichTextEditor = ({
230
+ value,
231
+ output = "html",
232
+ editorClassName,
233
+ onUpdate,
234
+ onBlur,
235
+ ...options
236
+ }) => {
237
+ const handleCreate = React25.useCallback(
238
+ (editor2) => {
239
+ if (value && editor2.isEmpty) {
240
+ editor2.commands.setContent(value);
241
+ }
242
+ },
243
+ [value]
244
+ );
245
+ const handleUpdate = React25.useCallback(
246
+ (editor2) => {
247
+ onUpdate?.(getOutput(editor2, output));
248
+ },
249
+ [output]
250
+ );
251
+ const handleBlur = React25.useCallback(
252
+ (editor2) => {
253
+ onBlur?.(getOutput(editor2, output));
254
+ },
255
+ [output, onBlur]
256
+ );
257
+ const editor = react.useEditor({
258
+ extensions: [starterKit.StarterKit, extensionUnderline.Underline, extensionColor.Color, extensionTextStyle.TextStyle, Link],
259
+ editorProps: {
260
+ attributes: {
261
+ autocomplete: "off",
262
+ autocorrect: "off",
263
+ autocapitalize: "off",
264
+ class: chunk47IWLKYO_js.cn("sb-focus:outline-none", editorClassName)
265
+ }
266
+ },
267
+ onCreate: ({ editor: editor2 }) => handleCreate(editor2),
268
+ onUpdate: ({ editor: editor2 }) => handleUpdate(editor2),
269
+ onBlur: ({ editor: editor2 }) => handleBlur(editor2),
270
+ ...options
271
+ });
272
+ return editor;
273
+ };
274
+ var DropdownMenu = DropdownMenuPrimitive__namespace.Root;
275
+ var DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
276
+ var DropdownMenuSubTrigger = React25__namespace.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
277
+ DropdownMenuPrimitive__namespace.SubTrigger,
278
+ {
279
+ ref,
280
+ className: chunk47IWLKYO_js.cn(
281
+ "sb-flex sb-cursor-default sb-select-none sb-items-center sb-gap-2 sb-rounded-sm sb-px-2 sb-py-1.5 sb-text-sm sb-outline-none focus:sb-bg-accent data-[state=open]:sb-bg-accent [&_svg]:sb-pointer-events-none [&_svg]:sb-size-4 [&_svg]:sb-shrink-0",
282
+ inset && "sb-pl-8",
283
+ className
284
+ ),
285
+ ...props
286
+ },
287
+ children,
288
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronRight, { className: "sb-ml-auto" })
289
+ ));
290
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
291
+ var DropdownMenuSubContent = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
292
+ DropdownMenuPrimitive__namespace.SubContent,
293
+ {
294
+ ref,
295
+ className: chunk47IWLKYO_js.cn(
296
+ "sb-z-50 sb-min-w-[8rem] sb-overflow-hidden sb-rounded-md sb-border sb-bg-popover sb-p-1 sb-text-popover-foreground sb-shadow-lg data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[side=bottom]:sb-slide-in-from-top-2 data-[side=left]:sb-slide-in-from-right-2 data-[side=right]:sb-slide-in-from-left-2 data-[side=top]:sb-slide-in-from-bottom-2 sb-origin-[--radix-dropdown-menu-content-transform-origin]",
297
+ className
298
+ ),
299
+ ...props
300
+ }
301
+ ));
302
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
303
+ var DropdownMenuContent = React25__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(DropdownMenuPrimitive__namespace.Portal, null, /* @__PURE__ */ React25__namespace.createElement(
304
+ DropdownMenuPrimitive__namespace.Content,
305
+ {
306
+ ref,
307
+ sideOffset,
308
+ className: chunk47IWLKYO_js.cn(
309
+ "sb-z-50 sb-max-h-[var(--radix-dropdown-menu-content-available-height)] sb-min-w-[8rem] sb-overflow-y-auto sb-overflow-x-hidden sb-rounded-md sb-border sb-bg-popover sb-p-1 sb-text-popover-foreground sb-shadow-md",
310
+ "data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[side=bottom]:sb-slide-in-from-top-2 data-[side=left]:sb-slide-in-from-right-2 data-[side=right]:sb-slide-in-from-left-2 data-[side=top]:sb-slide-in-from-bottom-2 sb-origin-[--radix-dropdown-menu-content-transform-origin]",
311
+ className
312
+ ),
313
+ ...props
314
+ }
315
+ )));
316
+ DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
317
+ var DropdownMenuItem = React25__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
318
+ DropdownMenuPrimitive__namespace.Item,
319
+ {
320
+ ref,
321
+ className: chunk47IWLKYO_js.cn(
322
+ "sb-relative sb-flex sb-cursor-default sb-select-none sb-items-center sb-gap-2 sb-rounded-sm sb-px-2 sb-py-1.5 sb-text-sm sb-outline-none sb-transition-colors focus:sb-bg-accent focus:sb-text-accent-foreground data-[disabled]:sb-pointer-events-none data-[disabled]:sb-opacity-50 [&>svg]:sb-size-4 [&>svg]:sb-shrink-0",
323
+ inset && "sb-pl-8",
324
+ className
325
+ ),
326
+ ...props
327
+ }
328
+ ));
329
+ DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
330
+ var DropdownMenuCheckboxItem = React25__namespace.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
331
+ DropdownMenuPrimitive__namespace.CheckboxItem,
332
+ {
333
+ ref,
334
+ className: chunk47IWLKYO_js.cn(
335
+ "sb-relative sb-flex sb-cursor-default sb-select-none sb-items-center sb-rounded-sm sb-py-1.5 sb-pl-8 sb-pr-2 sb-text-sm sb-outline-none sb-transition-colors focus:sb-bg-accent focus:sb-text-accent-foreground data-[disabled]:sb-pointer-events-none data-[disabled]:sb-opacity-50",
336
+ className
337
+ ),
338
+ checked,
339
+ ...props
340
+ },
341
+ /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-absolute sb-left-2 sb-flex sb-h-3.5 sb-w-3.5 sb-items-center sb-justify-center" }, /* @__PURE__ */ React25__namespace.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React25__namespace.createElement(lucideReact.Check, { className: "sb-h-4 sb-w-4" }))),
342
+ children
343
+ ));
344
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
345
+ var DropdownMenuRadioItem = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
346
+ DropdownMenuPrimitive__namespace.RadioItem,
347
+ {
348
+ ref,
349
+ className: chunk47IWLKYO_js.cn(
350
+ "sb-relative sb-flex sb-cursor-default sb-select-none sb-items-center sb-rounded-sm sb-py-1.5 sb-pl-8 sb-pr-2 sb-text-sm sb-outline-none sb-transition-colors focus:sb-bg-accent focus:sb-text-accent-foreground data-[disabled]:sb-pointer-events-none data-[disabled]:sb-opacity-50",
351
+ className
352
+ ),
353
+ ...props
354
+ },
355
+ /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-absolute sb-left-2 sb-flex sb-h-3.5 sb-w-3.5 sb-items-center sb-justify-center" }, /* @__PURE__ */ React25__namespace.createElement(DropdownMenuPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React25__namespace.createElement(lucideReact.Circle, { className: "sb-h-2 sb-w-2 sb-fill-current" }))),
356
+ children
357
+ ));
358
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
359
+ var DropdownMenuLabel = React25__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
360
+ DropdownMenuPrimitive__namespace.Label,
361
+ {
362
+ ref,
363
+ className: chunk47IWLKYO_js.cn(
364
+ "sb-px-2 sb-py-1.5 sb-text-sm sb-font-semibold",
365
+ inset && "sb-pl-8",
366
+ className
367
+ ),
368
+ ...props
369
+ }
370
+ ));
371
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
372
+ var DropdownMenuSeparator = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
373
+ DropdownMenuPrimitive__namespace.Separator,
374
+ {
375
+ ref,
376
+ className: chunk47IWLKYO_js.cn("sb--mx-1 sb-my-1 sb-h-px sb-bg-muted", className),
377
+ ...props
378
+ }
379
+ ));
380
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive__namespace.Separator.displayName;
381
+ var Separator2 = React25__namespace.forwardRef(
382
+ ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
383
+ SeparatorPrimitive__namespace.Root,
384
+ {
385
+ ref,
386
+ decorative,
387
+ orientation,
388
+ className: chunk47IWLKYO_js.cn(
389
+ "sb-shrink-0 sb-bg-border",
390
+ orientation === "horizontal" ? "sb-h-[1px] sb-w-full" : "sb-h-full sb-w-[1px]",
391
+ className
392
+ ),
393
+ ...props
394
+ }
395
+ )
396
+ );
397
+ Separator2.displayName = SeparatorPrimitive__namespace.Root.displayName;
398
+ var toggleVariants = classVarianceAuthority.cva(
399
+ "sb-inline-flex sb-items-center sb-justify-center sb-gap-2 sb-rounded-md sb-text-sm sb-font-medium 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 disabled:sb-pointer-events-none disabled:sb-opacity-50 data-[state=on]:sb-bg-accent data-[state=on]:sb-text-accent-foreground [&_svg]:sb-pointer-events-none [&_svg]:sb-size-4 [&_svg]:sb-shrink-0",
400
+ {
401
+ variants: {
402
+ variant: {
403
+ default: "sb-bg-transparent",
404
+ outline: "sb-border sb-border-input sb-bg-transparent sb-shadow-sm hover:sb-bg-accent hover:sb-text-accent-foreground"
405
+ },
406
+ size: {
407
+ default: "sb-h-9 sb-px-2 sb-min-w-9",
408
+ sm: "sb-h-8 sb-px-1.5 sb-min-w-8",
409
+ lg: "sb-h-10 sb-px-2.5 sb-min-w-10"
410
+ }
411
+ },
412
+ defaultVariants: {
413
+ variant: "default",
414
+ size: "default"
415
+ }
416
+ }
417
+ );
418
+ var Toggle = React25__namespace.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
419
+ TogglePrimitive__namespace.Root,
420
+ {
421
+ ref,
422
+ className: chunk47IWLKYO_js.cn(toggleVariants({ variant, size, className })),
423
+ ...props
424
+ }
425
+ ));
426
+ Toggle.displayName = TogglePrimitive__namespace.Root.displayName;
427
+ var ToggleGroupContext = React25__namespace.createContext({
428
+ size: "default",
429
+ variant: "default"
430
+ });
431
+ var ToggleGroup = React25__namespace.forwardRef(({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
432
+ ToggleGroupPrimitive__namespace.Root,
433
+ {
434
+ ref,
435
+ className: chunk47IWLKYO_js.cn("sb-flex sb-items-center sb-justify-center sb-gap-1", className),
436
+ ...props
437
+ },
438
+ /* @__PURE__ */ React25__namespace.createElement(ToggleGroupContext.Provider, { value: { variant, size } }, children)
439
+ ));
440
+ ToggleGroup.displayName = ToggleGroupPrimitive__namespace.Root.displayName;
441
+ var ToggleGroupItem = React25__namespace.forwardRef(({ className, children, variant, size, ...props }, ref) => {
442
+ const context = React25__namespace.useContext(ToggleGroupContext);
443
+ return /* @__PURE__ */ React25__namespace.createElement(
444
+ ToggleGroupPrimitive__namespace.Item,
445
+ {
446
+ ref,
447
+ className: chunk47IWLKYO_js.cn(
448
+ toggleVariants({
449
+ variant: context.variant || variant,
450
+ size: context.size || size
451
+ }),
452
+ className
453
+ ),
454
+ ...props
455
+ },
456
+ children
457
+ );
458
+ });
459
+ ToggleGroupItem.displayName = ToggleGroupPrimitive__namespace.Item.displayName;
460
+ var PALETTES = [
461
+ {
462
+ inverse: "hsl(var(--background))",
463
+ colors: [
464
+ { cssVar: "hsl(var(--foreground))" },
465
+ { cssVar: "hsl(var(--secondary-foreground))" },
466
+ { cssVar: "hsl(var(--muted-foreground))" },
467
+ { cssVar: "hsl(var(--accent-foreground))" },
468
+ { cssVar: "hsl(var(--destructive-foreground))" }
469
+ ]
470
+ },
471
+ {
472
+ inverse: "hsl(var(--foreground))",
473
+ colors: [
474
+ { cssVar: "hsl(var(--background))" },
475
+ { cssVar: "hsl(var(--secondary))" },
476
+ { cssVar: "hsl(var(--muted))" },
477
+ { cssVar: "hsl(var(--accent))" },
478
+ { cssVar: "hsl(var(--destructive))" }
479
+ ]
480
+ }
481
+ ];
482
+ var ColorTool = ({ editor }) => {
483
+ const color = editor.getAttributes("textStyle")?.color || "hsl(var(--foreground))";
484
+ const [selectedColor, setSelectedColor] = React25__namespace.useState(color);
485
+ React25__namespace.useEffect(() => {
486
+ setSelectedColor(color);
487
+ }, [color]);
488
+ const handleColorChange = React25__namespace.useCallback(
489
+ (value) => {
490
+ setSelectedColor(value);
491
+ editor.chain().focus().setColor(value).run();
492
+ },
493
+ [editor]
494
+ );
495
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, { modal: true }, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(ToolbarButton, { className: "sb-w-12" }, /* @__PURE__ */ React25__namespace.createElement(
496
+ "svg",
497
+ {
498
+ xmlns: "http://www.w3.org/2000/svg",
499
+ width: "24",
500
+ height: "24",
501
+ viewBox: "0 0 24 24",
502
+ fill: "none",
503
+ stroke: "currentColor",
504
+ strokeWidth: "2",
505
+ strokeLinecap: "round",
506
+ strokeLinejoin: "round",
507
+ className: "sb-size-5",
508
+ style: { color: selectedColor }
509
+ },
510
+ /* @__PURE__ */ React25__namespace.createElement("path", { d: "M4 20h16" }),
511
+ /* @__PURE__ */ React25__namespace.createElement("path", { d: "m6 16 6-12 6 12" }),
512
+ /* @__PURE__ */ React25__namespace.createElement("path", { d: "M8 12h8" })
513
+ ), /* @__PURE__ */ React25__namespace.createElement(lu.LuChevronDown, { className: "sb-size-5" }))), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { align: "start", className: "sb-w-full" }, /* @__PURE__ */ React25__namespace.createElement(
514
+ ToggleGroup,
515
+ {
516
+ type: "single",
517
+ value: selectedColor,
518
+ onValueChange: handleColorChange,
519
+ className: "sb-flex-col sb-gap-1.5"
520
+ },
521
+ PALETTES.map((pallete, i) => /* @__PURE__ */ React25__namespace.createElement("div", { key: i, className: "sb-flex sb-gap-1.5" }, pallete.colors.map((color2, j) => /* @__PURE__ */ React25__namespace.createElement(
522
+ ToggleGroupItem,
523
+ {
524
+ tabIndex: 0,
525
+ key: j,
526
+ className: "sb-relative sb-size-7 sb-rounded-md sb-border sb-p-0",
527
+ value: color2.cssVar,
528
+ style: { backgroundColor: color2.cssVar }
529
+ },
530
+ selectedColor === color2.cssVar && /* @__PURE__ */ React25__namespace.createElement(
531
+ lu.LuCheck,
532
+ {
533
+ className: "sb-absolute sb-inset-0 sb-m-auto sb-size-6",
534
+ style: { color: pallete.inverse }
535
+ }
536
+ )
537
+ ))))
538
+ )));
539
+ };
540
+ var formatActions = [
541
+ {
542
+ label: "Normal Text",
543
+ element: "span",
544
+ className: "sb-grow"
545
+ },
546
+ {
547
+ label: "Heading 1",
548
+ element: "h1",
549
+ level: 1,
550
+ className: "sb-m-0 sb-grow sb-text-3xl sb-font-extrabold"
551
+ },
552
+ {
553
+ label: "Heading 2",
554
+ element: "h2",
555
+ level: 2,
556
+ className: "sb-m-0 sb-grow sb-text-xl sb-font-bold"
557
+ },
558
+ {
559
+ label: "Heading 3",
560
+ element: "h3",
561
+ level: 3,
562
+ className: "sb-m-0 sb-grow sb-text-lg sb-font-semibold"
563
+ },
564
+ {
565
+ label: "Heading 4",
566
+ element: "h4",
567
+ level: 4,
568
+ className: "sb-m-0 sb-grow sb-text-base sb-font-semibold"
569
+ }
570
+ ];
571
+ var ElementTool = ({ editor }) => {
572
+ const isActive = editor.isActive("heading");
573
+ const handleFormatChange = React25__namespace.useCallback(
574
+ (level) => {
575
+ if (level) {
576
+ editor.chain().focus().toggleHeading({ level }).run();
577
+ } else {
578
+ editor.chain().focus().setParagraph().run();
579
+ }
580
+ },
581
+ [editor]
582
+ );
583
+ return /* @__PURE__ */ React25__namespace.createElement(DropdownMenu, null, /* @__PURE__ */ React25__namespace.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
584
+ ToolbarButton,
585
+ {
586
+ className: "sb-w-12 data-[state=open]:sb-bg-accent",
587
+ pressed: isActive
588
+ },
589
+ /* @__PURE__ */ React25__namespace.createElement(lu.LuHeading, { className: "sb-size-5" }),
590
+ /* @__PURE__ */ React25__namespace.createElement(lu.LuChevronDown, { className: "sb-size-5" })
591
+ )), /* @__PURE__ */ React25__namespace.createElement(DropdownMenuContent, { align: "start" }, formatActions.map(({ element: Element, ...action }) => /* @__PURE__ */ React25__namespace.createElement(
592
+ DropdownMenuItem,
593
+ {
594
+ key: action.label,
595
+ className: chunk47IWLKYO_js.cn({
596
+ "sb-bg-accent": action.level ? editor.isActive("heading", { level: action.level }) : editor.isActive("paragraph")
597
+ }),
598
+ onClick: () => handleFormatChange(action.level)
599
+ },
600
+ /* @__PURE__ */ React25__namespace.createElement(Element, { className: action.className }, action.label)
601
+ ))));
602
+ };
603
+ var actions = [
604
+ {
605
+ value: "bold",
606
+ label: "Bold",
607
+ icon: lu.LuBold,
608
+ action: (editor) => editor.chain().focus().toggleBold().run(),
609
+ isActive: (editor) => editor.isActive("bold"),
610
+ canExecute: (editor) => editor.can().chain().focus().toggleBold().run() && !editor.isActive("codeBlock")
611
+ },
612
+ {
613
+ value: "italic",
614
+ label: "Italic",
615
+ icon: lu.LuItalic,
616
+ action: (editor) => editor.chain().focus().toggleItalic().run(),
617
+ isActive: (editor) => editor.isActive("italic"),
618
+ canExecute: (editor) => editor.can().chain().focus().toggleItalic().run() && !editor.isActive("codeBlock")
619
+ },
620
+ {
621
+ value: "underline",
622
+ label: "Underline",
623
+ icon: lu.LuUnderline,
624
+ action: (editor) => editor.chain().focus().toggleUnderline().run(),
625
+ isActive: (editor) => editor.isActive("underline"),
626
+ canExecute: (editor) => editor.can().chain().focus().toggleUnderline().run() && !editor.isActive("codeBlock")
627
+ },
628
+ {
629
+ value: "strikethrough",
630
+ label: "Strikethrough",
631
+ icon: lu.LuStrikethrough,
632
+ action: (editor) => editor.chain().focus().toggleStrike().run(),
633
+ isActive: (editor) => editor.isActive("strike"),
634
+ canExecute: (editor) => editor.can().chain().focus().toggleStrike().run() && !editor.isActive("codeBlock")
635
+ },
636
+ {
637
+ value: "code",
638
+ label: "Code",
639
+ icon: lu.LuCode,
640
+ action: (editor) => editor.chain().focus().toggleCode().run(),
641
+ isActive: (editor) => editor.isActive("code"),
642
+ canExecute: (editor) => editor.can().chain().focus().toggleCode().run() && !editor.isActive("codeBlock")
643
+ },
644
+ {
645
+ value: "clearFormatting",
646
+ label: "Clear formatting",
647
+ icon: lu.LuRemoveFormatting,
648
+ action: (editor) => editor.chain().focus().unsetAllMarks().run(),
649
+ isActive: () => false,
650
+ canExecute: (editor) => editor.can().chain().focus().unsetAllMarks().run() && !editor.isActive("codeBlock")
651
+ }
652
+ ];
653
+ var FormatTool = ({ editor }) => {
654
+ return /* @__PURE__ */ React25__namespace.createElement(ToolbarSection, { editor, actions, mainActionCount: 1 });
655
+ };
656
+ var actions2 = [
657
+ {
658
+ value: "codeBlock",
659
+ label: "Code block",
660
+ icon: lu.LuCode,
661
+ action: (editor) => editor.chain().focus().toggleCodeBlock().run(),
662
+ isActive: (editor) => editor.isActive("codeBlock"),
663
+ canExecute: (editor) => editor.can().chain().focus().toggleCodeBlock().run()
664
+ },
665
+ {
666
+ value: "blockquote",
667
+ label: "Blockquote",
668
+ icon: lu.LuQuote,
669
+ action: (editor) => editor.chain().focus().toggleBlockquote().run(),
670
+ isActive: (editor) => editor.isActive("blockquote"),
671
+ canExecute: (editor) => editor.can().chain().focus().toggleBlockquote().run()
672
+ },
673
+ {
674
+ value: "horizontalRule",
675
+ label: "Divider",
676
+ icon: lu.LuMinus,
677
+ action: (editor) => editor.chain().focus().setHorizontalRule().run(),
678
+ isActive: () => false,
679
+ canExecute: (editor) => editor.can().chain().focus().setHorizontalRule().run()
680
+ }
681
+ ];
682
+ var InsertTool = ({ editor }) => {
683
+ return /* @__PURE__ */ React25__namespace.createElement(ToolbarSection, { editor, actions: actions2, mainActionCount: 0 });
684
+ };
685
+ var Dialog = DialogPrimitive__namespace.Root;
686
+ var DialogTrigger = DialogPrimitive__namespace.Trigger;
687
+ var DialogPortal = DialogPrimitive__namespace.Portal;
688
+ var DialogOverlay = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
689
+ DialogPrimitive__namespace.Overlay,
690
+ {
691
+ ref,
692
+ className: chunk47IWLKYO_js.cn(
693
+ "sb-fixed sb-inset-0 sb-z-50 sb-bg-black/80 sb- data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0",
694
+ className
695
+ ),
696
+ ...props
697
+ }
698
+ ));
699
+ DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
700
+ var DialogContent = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(DialogPortal, null, /* @__PURE__ */ React25__namespace.createElement(DialogOverlay, null), /* @__PURE__ */ React25__namespace.createElement(
701
+ DialogPrimitive__namespace.Content,
702
+ {
703
+ ref,
704
+ className: chunk47IWLKYO_js.cn(
705
+ "sb-fixed sb-left-[50%] sb-top-[50%] sb-z-50 sb-grid sb-w-full sb-max-w-lg sb-translate-x-[-50%] sb-translate-y-[-50%] sb-gap-4 sb-border sb-bg-background sb-p-6 sb-shadow-lg sb-duration-200 data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[state=closed]:sb-slide-out-to-left-1/2 data-[state=closed]:sb-slide-out-to-top-[48%] data-[state=open]:sb-slide-in-from-left-1/2 data-[state=open]:sb-slide-in-from-top-[48%] sm:sb-rounded-lg",
706
+ className
707
+ ),
708
+ ...props
709
+ },
710
+ children,
711
+ /* @__PURE__ */ React25__namespace.createElement(DialogPrimitive__namespace.Close, { className: "sb-absolute sb-right-4 sb-top-4 sb-rounded-sm sb-opacity-70 sb-ring-offset-background sb-transition-opacity hover:sb-opacity-100 focus:sb-outline-none focus:sb-ring-2 focus:sb-ring-ring focus:sb-ring-offset-2 disabled:sb-pointer-events-none data-[state=open]:sb-bg-accent data-[state=open]:sb-text-muted-foreground" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.X, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-sr-only" }, "Close"))
712
+ )));
713
+ DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
714
+ var DialogHeader = ({
715
+ className,
716
+ ...props
717
+ }) => /* @__PURE__ */ React25__namespace.createElement(
718
+ "div",
719
+ {
720
+ className: chunk47IWLKYO_js.cn(
721
+ "sb-flex sb-flex-col sb-space-y-1.5 sb-text-center sm:sb-text-left",
722
+ className
723
+ ),
724
+ ...props
725
+ }
726
+ );
727
+ DialogHeader.displayName = "DialogHeader";
728
+ var DialogTitle = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
729
+ DialogPrimitive__namespace.Title,
730
+ {
731
+ ref,
732
+ className: chunk47IWLKYO_js.cn(
733
+ "sb-text-lg sb-font-semibold sb-leading-none sb-tracking-tight",
734
+ className
735
+ ),
736
+ ...props
737
+ }
738
+ ));
739
+ DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
740
+ var DialogDescription = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
741
+ DialogPrimitive__namespace.Description,
742
+ {
743
+ ref,
744
+ className: chunk47IWLKYO_js.cn("sb-text-sm sb-text-muted-foreground", className),
745
+ ...props
746
+ }
747
+ ));
748
+ DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
749
+ var labelVariants = classVarianceAuthority.cva(
750
+ "sb-text-sm sb-font-medium sb-leading-none peer-disabled:sb-cursor-not-allowed peer-disabled:sb-opacity-70"
751
+ );
752
+ var Label2 = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
753
+ LabelPrimitive__namespace.Root,
754
+ {
755
+ ref,
756
+ className: chunk47IWLKYO_js.cn(labelVariants(), className),
757
+ ...props
758
+ }
759
+ ));
760
+ Label2.displayName = LabelPrimitive__namespace.Root.displayName;
761
+
762
+ // src/components/ui/form.tsx
763
+ var Form = reactHookForm.FormProvider;
764
+ var FormFieldContext = React25__namespace.createContext(
765
+ {}
766
+ );
767
+ var FormField = ({
768
+ ...props
769
+ }) => {
770
+ return /* @__PURE__ */ React25__namespace.createElement(FormFieldContext.Provider, { value: { name: props.name } }, /* @__PURE__ */ React25__namespace.createElement(reactHookForm.Controller, { ...props }));
771
+ };
772
+ var useFormField = () => {
773
+ const fieldContext = React25__namespace.useContext(FormFieldContext);
774
+ const itemContext = React25__namespace.useContext(FormItemContext);
775
+ const { getFieldState, formState } = reactHookForm.useFormContext();
776
+ const fieldState = getFieldState(fieldContext.name, formState);
777
+ if (!fieldContext) {
778
+ throw new Error("useFormField should be used within <FormField>");
779
+ }
780
+ const { id } = itemContext;
781
+ return {
782
+ id,
783
+ name: fieldContext.name,
784
+ formItemId: `${id}-form-item`,
785
+ formDescriptionId: `${id}-form-item-description`,
786
+ formMessageId: `${id}-form-item-message`,
787
+ ...fieldState
788
+ };
789
+ };
790
+ var FormItemContext = React25__namespace.createContext(
791
+ {}
792
+ );
793
+ var FormItem = React25__namespace.forwardRef(({ className, ...props }, ref) => {
794
+ const id = React25__namespace.useId();
795
+ return /* @__PURE__ */ React25__namespace.createElement(FormItemContext.Provider, { value: { id } }, /* @__PURE__ */ React25__namespace.createElement("div", { ref, className: chunk47IWLKYO_js.cn("sb-space-y-2", className), ...props }));
796
+ });
797
+ FormItem.displayName = "FormItem";
798
+ var FormLabel = React25__namespace.forwardRef(({ className, ...props }, ref) => {
799
+ const { error, formItemId } = useFormField();
800
+ return /* @__PURE__ */ React25__namespace.createElement(
801
+ Label2,
802
+ {
803
+ ref,
804
+ className: chunk47IWLKYO_js.cn(error && "sb-text-destructive", className),
805
+ htmlFor: formItemId,
806
+ ...props
807
+ }
808
+ );
809
+ });
810
+ FormLabel.displayName = "FormLabel";
811
+ var FormControl = React25__namespace.forwardRef(({ ...props }, ref) => {
812
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
813
+ return /* @__PURE__ */ React25__namespace.createElement(
814
+ reactSlot.Slot,
815
+ {
816
+ ref,
817
+ id: formItemId,
818
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
819
+ "aria-invalid": !!error,
820
+ ...props
821
+ }
822
+ );
823
+ });
824
+ FormControl.displayName = "FormControl";
825
+ var FormDescription = React25__namespace.forwardRef(({ className, ...props }, ref) => {
826
+ const { formDescriptionId } = useFormField();
827
+ return /* @__PURE__ */ React25__namespace.createElement(
828
+ "p",
829
+ {
830
+ ref,
831
+ id: formDescriptionId,
832
+ className: chunk47IWLKYO_js.cn("sb-text-[0.8rem] sb-text-muted-foreground", className),
833
+ ...props
834
+ }
835
+ );
836
+ });
837
+ FormDescription.displayName = "FormDescription";
838
+ var FormMessage = React25__namespace.forwardRef(({ className, children, ...props }, ref) => {
839
+ const { error, formMessageId } = useFormField();
840
+ const body = error ? String(error?.message ?? "") : children;
841
+ if (!body) {
842
+ return null;
843
+ }
844
+ return /* @__PURE__ */ React25__namespace.createElement(
845
+ "p",
846
+ {
847
+ ref,
848
+ id: formMessageId,
849
+ className: chunk47IWLKYO_js.cn("sb-text-[0.8rem] sb-font-medium sb-text-destructive", className),
850
+ ...props
851
+ },
852
+ body
853
+ );
854
+ });
855
+ FormMessage.displayName = "FormMessage";
856
+ var Input = React25__namespace.forwardRef(
857
+ ({ className, type, ...props }, ref) => {
858
+ return /* @__PURE__ */ React25__namespace.createElement(
859
+ "input",
860
+ {
861
+ type,
862
+ className: chunk47IWLKYO_js.cn(
863
+ "sb-flex sb-h-9 sb-w-full sb-rounded-md sb-border sb-border-input sb-bg-transparent sb-px-3 sb-py-1 sb-text-base sb-shadow-sm sb-transition-colors file:sb-border-0 file:sb-bg-transparent file:sb-text-sm file:sb-font-medium file:sb-text-foreground 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 md:sb-text-sm",
864
+ className
865
+ ),
866
+ ref,
867
+ ...props
868
+ }
869
+ );
870
+ }
871
+ );
872
+ Input.displayName = "Input";
873
+ var AdvancedInput = React25__namespace.forwardRef(
874
+ ({ prepend, append, ...props }, ref) => {
875
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-relative" }, /* @__PURE__ */ React25__namespace.createElement(Input, { ref, className: "sb-pl-9 sb-pr-7 sb-text-right", ...props }), prepend && /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-absolute sb-font-roboto sb-top-1/2 sb-left-3 sb--translate-y-1/2" }, prepend), append && /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-absolute sb-font-roboto sb-top-1/2 sb-right-3 sb--translate-y-1/2" }, append));
876
+ }
877
+ );
878
+ AdvancedInput.displayName = "AdvancedInput";
879
+ var Switch = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
880
+ SwitchPrimitives__namespace.Root,
881
+ {
882
+ className: chunk47IWLKYO_js.cn(
883
+ "sb-peer sb-inline-flex sb-h-5 sb-w-9 sb-shrink-0 sb-cursor-pointer sb-items-center sb-rounded-full sb-border-2 sb-border-transparent sb-shadow-sm 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",
884
+ className
885
+ ),
886
+ ...props,
887
+ ref
888
+ },
889
+ /* @__PURE__ */ React25__namespace.createElement(
890
+ SwitchPrimitives__namespace.Thumb,
891
+ {
892
+ className: chunk47IWLKYO_js.cn(
893
+ "sb-pointer-events-none sb-block sb-h-4 sb-w-4 sb-rounded-full sb-bg-background sb-shadow-lg sb-ring-0 sb-transition-transform data-[state=checked]:sb-translate-x-4 data-[state=unchecked]:sb-translate-x-0"
894
+ )
895
+ }
896
+ )
897
+ ));
898
+ Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
899
+ var LinkTool = ({ editor }) => {
900
+ const [open, setOpen] = React25__namespace.useState(false);
901
+ const { from, to } = editor.state.selection;
902
+ const text = editor.state.doc.textBetween(from, to, " ");
903
+ const handleSetLink = React25__namespace.useCallback(
904
+ (url, text2, openInNewTab) => {
905
+ editor.chain().focus().extendMarkRange("link").insertContent({
906
+ type: "text",
907
+ text: text2 || url,
908
+ marks: [
909
+ {
910
+ type: "link",
911
+ attrs: {
912
+ href: url,
913
+ target: openInNewTab ? "_blank" : ""
914
+ }
915
+ }
916
+ ]
917
+ }).setLink({ href: url }).run();
918
+ editor.commands.enter();
919
+ setOpen(false);
920
+ },
921
+ [editor]
922
+ );
923
+ return /* @__PURE__ */ React25__namespace.createElement(Dialog, { open, onOpenChange: setOpen }, /* @__PURE__ */ React25__namespace.createElement(DialogTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
924
+ ToolbarButton,
925
+ {
926
+ pressed: editor.isActive("link"),
927
+ disabled: editor.isActive("codeBlock")
928
+ },
929
+ /* @__PURE__ */ React25__namespace.createElement(lu.LuLink2, { className: "sb-size-5" })
930
+ )), /* @__PURE__ */ React25__namespace.createElement(DialogContent, { className: "sb-w-full sb-min-w-80" }, /* @__PURE__ */ React25__namespace.createElement(LinkForm, { onSave: handleSetLink, defaultText: text })));
931
+ };
932
+ var schema = zod.z.object({
933
+ url: zod.z.string().min(0),
934
+ text: zod.z.string().optional(),
935
+ isNewTab: zod.z.boolean().optional()
936
+ });
937
+ var LinkForm = ({
938
+ onSave,
939
+ defaultIsNewTab,
940
+ defaultUrl,
941
+ defaultText
942
+ }) => {
943
+ const form = reactHookForm.useForm({
944
+ resolver: zod$1.zodResolver(schema),
945
+ defaultValues: {
946
+ url: defaultUrl || "",
947
+ text: defaultText || "",
948
+ isNewTab: defaultIsNewTab || false
949
+ }
950
+ });
951
+ const handleSubmit = (values) => {
952
+ onSave(values.url, values.text, values.isNewTab);
953
+ };
954
+ return /* @__PURE__ */ React25__namespace.createElement(Form, { ...form }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-6" }, /* @__PURE__ */ React25__namespace.createElement(
955
+ FormField,
956
+ {
957
+ control: form.control,
958
+ name: "url",
959
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "URL"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(Input, { type: "url", ...field, autoFocus: true })), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
960
+ }
961
+ ), /* @__PURE__ */ React25__namespace.createElement(
962
+ FormField,
963
+ {
964
+ control: form.control,
965
+ name: "text",
966
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Text"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(Input, { ...field })), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
967
+ }
968
+ ), /* @__PURE__ */ React25__namespace.createElement(
969
+ FormField,
970
+ {
971
+ control: form.control,
972
+ name: "isNewTab",
973
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-items-center sb-space-x-2" }, /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
974
+ Switch,
975
+ {
976
+ checked: field.value,
977
+ onCheckedChange: field.onChange
978
+ }
979
+ )), /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Open in new tab")), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
980
+ }
981
+ ), /* @__PURE__ */ React25__namespace.createElement(chunkIAIJXTFG_js.Button, { type: "button", onClick: form.handleSubmit(handleSubmit) }, "Save")));
982
+ };
983
+ var actions3 = [
984
+ {
985
+ value: "orderedList",
986
+ label: "Numbered list",
987
+ icon: lu.LuListOrdered,
988
+ action: (editor) => editor.chain().focus().toggleOrderedList().run(),
989
+ isActive: (editor) => editor.isActive("orderedList"),
990
+ canExecute: (editor) => editor.can().chain().focus().toggleOrderedList().run()
991
+ },
992
+ {
993
+ value: "bulletList",
994
+ label: "Bullet list",
995
+ icon: lu.LuList,
996
+ action: (editor) => editor.chain().focus().toggleBulletList().run(),
997
+ isActive: (editor) => editor.isActive("bulletList"),
998
+ canExecute: (editor) => editor.can().chain().focus().toggleBulletList().run()
999
+ }
1000
+ ];
1001
+ var ListTool = ({ editor }) => {
1002
+ return /* @__PURE__ */ React25__namespace.createElement(ToolbarSection, { editor, actions: actions3, mainActionCount: 2 });
1003
+ };
1004
+
1005
+ // src/features/rich-text-editor/components/toolbar.tsx
1006
+ var Toolbar = ({ editor }) => {
1007
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-shrink-0 sb-overflow-x-auto sb-border-b sb-border-border sb-p-2" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-w-max sb-items-center sb-gap-px" }, /* @__PURE__ */ React25__namespace.createElement(ElementTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(Separator2, { orientation: "vertical", className: "sb-mx-2 sb-h-7" }), /* @__PURE__ */ React25__namespace.createElement(FormatTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(Separator2, { orientation: "vertical", className: "sb-mx-2 sb-h-7" }), /* @__PURE__ */ React25__namespace.createElement(ColorTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(Separator2, { orientation: "vertical", className: "sb-mx-2 sb-h-7" }), /* @__PURE__ */ React25__namespace.createElement(ListTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(Separator2, { orientation: "vertical", className: "sb-mx-2 sb-h-7" }), /* @__PURE__ */ React25__namespace.createElement(LinkTool, { editor }), /* @__PURE__ */ React25__namespace.createElement(InsertTool, { editor })));
1008
+ };
1009
+ var ToolbarSection = ({
1010
+ editor,
1011
+ actions: actions4,
1012
+ mainActionCount = 0
1013
+ }) => {
1014
+ const { mainActions, dropdownActions } = React25__namespace.useMemo(() => {
1015
+ return {
1016
+ mainActions: actions4.slice(0, mainActionCount),
1017
+ dropdownActions: actions4.slice(mainActionCount)
1018
+ };
1019
+ }, [actions4, mainActionCount]);
1020
+ const isDropdownActive = React25__namespace.useMemo(() => {
1021
+ return dropdownActions.some((action) => action.isActive(editor));
1022
+ }, [dropdownActions, editor]);
1023
+ return /* @__PURE__ */ React25__namespace.createElement(React25__namespace.Fragment, null, mainActions.map((action) => /* @__PURE__ */ React25__namespace.createElement(
1024
+ ToolbarButton,
1025
+ {
1026
+ key: action.label,
1027
+ onClick: () => action.action(editor),
1028
+ disabled: !action.canExecute(editor),
1029
+ pressed: action.isActive(editor)
1030
+ },
1031
+ /* @__PURE__ */ React25__namespace.createElement(action.icon, { className: "sb-size-5" })
1032
+ )), dropdownActions.length > 0 && /* @__PURE__ */ React25__namespace.createElement(DropdownMenu, null, /* @__PURE__ */ React25__namespace.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(ToolbarButton, { pressed: isDropdownActive }, /* @__PURE__ */ React25__namespace.createElement(lu.LuEllipsis, { className: "sb-size-5" }))), /* @__PURE__ */ React25__namespace.createElement(DropdownMenuContent, { align: "start" }, dropdownActions.map((action) => /* @__PURE__ */ React25__namespace.createElement(
1033
+ DropdownMenuItem,
1034
+ {
1035
+ key: action.label,
1036
+ className: chunk47IWLKYO_js.cn("sb-flex sb-flex-row sb-items-center sb-gap-2", {
1037
+ "sb-bg-accent": action.isActive(editor)
1038
+ }),
1039
+ onClick: () => action.action(editor),
1040
+ disabled: !action.canExecute(editor)
1041
+ },
1042
+ /* @__PURE__ */ React25__namespace.createElement(action.icon, { className: "sb-size-4" }),
1043
+ /* @__PURE__ */ React25__namespace.createElement("span", null, action.label)
1044
+ )))));
1045
+ };
1046
+ var ToolbarButton = ({
1047
+ className,
1048
+ ...props
1049
+ }) => {
1050
+ return /* @__PURE__ */ React25__namespace.createElement(
1051
+ Toggle,
1052
+ {
1053
+ size: "sm",
1054
+ className: chunk47IWLKYO_js.cn(
1055
+ "sb-size-8 sb-p-0 data-[state=on]:sb-bg-accent",
1056
+ { "sb-bg-accent": props.pressed },
1057
+ className
1058
+ ),
1059
+ ...props
1060
+ }
1061
+ );
1062
+ };
1063
+
1064
+ // src/features/rich-text-editor/components/rich-text-editor.tsx
1065
+ var RichTextEditor = ({
1066
+ value,
1067
+ onChange,
1068
+ className,
1069
+ editorClassName,
1070
+ editorContentClassName,
1071
+ ...props
1072
+ }) => {
1073
+ const editor = useRichTextEditor({
1074
+ value,
1075
+ onUpdate: onChange,
1076
+ editorClassName: chunk47IWLKYO_js.cn("sb-flex-1 sb-px-3 sb-py-1", editorClassName),
1077
+ ...props
1078
+ });
1079
+ if (!editor) {
1080
+ return null;
1081
+ }
1082
+ return /* @__PURE__ */ React25__namespace.createElement(
1083
+ "div",
1084
+ {
1085
+ className: chunk47IWLKYO_js.cn(
1086
+ "sb-flex sb-h-auto sb-min-h-72 sb-w-full sb-flex-col sb-rounded-md sb-border sb-border-input sb-shadow-sm focus-within:sb-border-primary",
1087
+ className
1088
+ )
1089
+ },
1090
+ /* @__PURE__ */ React25__namespace.createElement(Toolbar, { editor }),
1091
+ /* @__PURE__ */ React25__namespace.createElement(
1092
+ react.EditorContent,
1093
+ {
1094
+ editor,
1095
+ className: chunk47IWLKYO_js.cn(
1096
+ "sb-editflow sb-prose sb-flex sb-flex-1",
1097
+ editorContentClassName
1098
+ )
1099
+ }
1100
+ )
1101
+ );
1102
+ };
1103
+ function Calendar({
1104
+ className,
1105
+ classNames,
1106
+ showOutsideDays = true,
1107
+ ...props
1108
+ }) {
1109
+ return /* @__PURE__ */ React25__namespace.createElement(
1110
+ reactDayPicker.DayPicker,
1111
+ {
1112
+ showOutsideDays,
1113
+ className: chunk47IWLKYO_js.cn("sb-p-3 sb-font-roboto", className),
1114
+ classNames: {
1115
+ months: "sb-flex sb-flex-col sm:sb-flex-row sb-space-y-4 sm:sb-space-x-4 sm:sb-space-y-0",
1116
+ month: "sb-space-y-4",
1117
+ caption: "sb-flex sb-justify-center sb-pt-1 sb-relative sb-items-center",
1118
+ caption_label: "sb-text-sm sb-font-medium",
1119
+ nav: "sb-space-x-1 sb-flex sb-items-center",
1120
+ nav_button: chunk47IWLKYO_js.cn(
1121
+ chunkIAIJXTFG_js.buttonVariants({ variant: "outline" }),
1122
+ "sb-h-7 sb-w-7 sb-bg-transparent sb-p-0 sb-opacity-50 hover:sb-opacity-100"
1123
+ ),
1124
+ nav_button_previous: "sb-absolute sb-left-1",
1125
+ nav_button_next: "sb-absolute sb-right-1",
1126
+ table: "sb-w-full sb-border-collapse sb-space-y-1",
1127
+ head_row: "sb-flex",
1128
+ head_cell: "sb-text-muted-foreground sb-rounded-md sb-w-8 sb-font-normal sb-text-[0.8rem]",
1129
+ row: "sb-flex sb-w-full sb-mt-2",
1130
+ cell: chunk47IWLKYO_js.cn(
1131
+ "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",
1132
+ 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"
1133
+ ),
1134
+ day: chunk47IWLKYO_js.cn(
1135
+ chunkIAIJXTFG_js.buttonVariants({ variant: "ghost" }),
1136
+ "sb-h-8 sb-w-8 sb-p-0 sb-font-normal aria-selected:sb-opacity-100"
1137
+ ),
1138
+ day_range_start: "day-range-start",
1139
+ day_range_end: "day-range-end",
1140
+ 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",
1141
+ day_today: "sb-bg-accent sb-text-accent-foreground",
1142
+ 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",
1143
+ day_disabled: "sb-text-muted-foreground sb-opacity-50",
1144
+ day_range_middle: "aria-selected:sb-bg-accent aria-selected:sb-text-accent-foreground",
1145
+ day_hidden: "invisible",
1146
+ ...classNames
1147
+ },
1148
+ components: {
1149
+ IconLeft: () => /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronLeftIcon, { className: "sb-h-4 sb-w-4" }),
1150
+ IconRight: () => /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronRightIcon, { className: "sb-h-4 sb-w-4" })
1151
+ },
1152
+ ...props
1153
+ }
1154
+ );
1155
+ }
1156
+ Calendar.displayName = "Calendar";
1157
+ var ColorPicker = (props) => {
1158
+ const { color, onColorChange, className } = props;
1159
+ const colors = props.colors ?? [
1160
+ "#000000",
1161
+ "#ffffff",
1162
+ "#0f172a",
1163
+ "#F1F5F9",
1164
+ "#64748B",
1165
+ "#E6007E",
1166
+ "#F8FAFC",
1167
+ "#009DD1",
1168
+ "#FF0000"
1169
+ ];
1170
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, null, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
1171
+ chunkIAIJXTFG_js.Button,
1172
+ {
1173
+ variant: "outline",
1174
+ size: "sm",
1175
+ className: chunk47IWLKYO_js.cn(
1176
+ "sb-justify-start sb-text-left sb-font-normal sb-normal-case sb-w-full",
1177
+ !color && "sb-text-muted-foreground",
1178
+ className
1179
+ )
1180
+ },
1181
+ /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-w-full sb-flex sb-items-center sb-gap-2" }, color ? /* @__PURE__ */ React25__namespace.createElement(
1182
+ "div",
1183
+ {
1184
+ className: "sb-h-4 sb-w-4 sb-rounded !sb-bg-center !sb-bg-cover sb-transition-all sb-border",
1185
+ style: { background: color }
1186
+ }
1187
+ ) : /* @__PURE__ */ React25__namespace.createElement(lucideReact.PaintbrushIcon, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-truncate sb-flex-1" }, color ? color : "Kies een kleur"))
1188
+ )), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { className: "sb-w-64 sb-p-4 sb-flex sb-flex-wrap sb-gap-1" }, colors.map((s) => /* @__PURE__ */ React25__namespace.createElement(
1189
+ "div",
1190
+ {
1191
+ key: s,
1192
+ style: { background: s },
1193
+ className: "sb-rounded-md sb-h-6 sb-w-6 sb-cursor-pointer active:sb-scale-105 sb-border",
1194
+ onClick: () => onColorChange(s)
1195
+ }
1196
+ ))));
1197
+ };
1198
+ var MediaInput = (props) => {
1199
+ const { onFilesChange, limit = 32, multiple = false, onError } = props;
1200
+ const id = React25__namespace.useId();
1201
+ const [queue, setQueue] = React25__namespace.useState([]);
1202
+ const [sources, setSources] = React25__namespace.useState(props.files ?? []);
1203
+ const maxConcurrentUploads = 3;
1204
+ const uploadingCountRef = React25__namespace.useRef(0);
1205
+ const handleFilesAdd = async (e) => {
1206
+ const files = e.target.files;
1207
+ if (!files || files.length === 0) {
1208
+ return;
1209
+ }
1210
+ if (files.length + sources.length > (multiple ? limit : 1)) {
1211
+ onError?.(
1212
+ new MediaInputError(
1213
+ `Maximaal ${limit} bestanden.`,
1214
+ `Je probeerde nu ${files.length + sources.length} bestanden toe te voegen, maar je mag er maximaal ${limit} toevoegen.`
1215
+ )
1216
+ );
1217
+ return;
1218
+ }
1219
+ const queue2 = Array.from(files);
1220
+ setQueue(queue2);
1221
+ for (const file of queue2) {
1222
+ try {
1223
+ while (uploadingCountRef.current >= maxConcurrentUploads && uploadingCountRef.current > 0) {
1224
+ await new Promise((resolve) => setTimeout(resolve, 300));
1225
+ }
1226
+ uploadingCountRef.current++;
1227
+ const formData = new FormData();
1228
+ formData.append("file", file);
1229
+ const res = await fetch("/api/simple-builder/file/upload", {
1230
+ method: "POST",
1231
+ body: formData
1232
+ });
1233
+ if (res === void 0 || !res.ok) {
1234
+ onError?.(
1235
+ new MediaInputError(
1236
+ "Bestand uploaden misulukt",
1237
+ `Bestand ${file.name} kon niet worden ge\xFCpload.`
1238
+ )
1239
+ );
1240
+ continue;
1241
+ }
1242
+ const { data: url } = await res.json();
1243
+ if (!url) {
1244
+ onError?.(
1245
+ new MediaInputError(
1246
+ "Bestand uploaden misulukt",
1247
+ `De URL van bestand ${file.name} kon niet worden opgehaald.`
1248
+ )
1249
+ );
1250
+ continue;
1251
+ }
1252
+ setSources((prev) => [...prev, url]);
1253
+ onFilesChange?.([...sources, url]);
1254
+ } catch (e2) {
1255
+ onError?.(
1256
+ new MediaInputError(
1257
+ "Bestand uploaden misulukt",
1258
+ `Bestand ${file.name} kon niet worden ge\xFCpload.`
1259
+ )
1260
+ );
1261
+ } finally {
1262
+ setQueue((prev) => prev.filter((f) => f !== file));
1263
+ uploadingCountRef.current--;
1264
+ }
1265
+ }
1266
+ };
1267
+ const handleSourceDelete = async (src) => {
1268
+ setSources((prev) => prev.filter((s) => s !== src));
1269
+ onFilesChange?.(sources.filter((s) => s !== src));
1270
+ await fetch("/api/uploadthing/delete", {
1271
+ method: "POST",
1272
+ body: JSON.stringify({ src })
1273
+ });
1274
+ };
1275
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: chunk47IWLKYO_js.cn("flex flex-wrap gap-4", props.className) }, sources.map((src) => /* @__PURE__ */ React25__namespace.createElement(MediaInputItem, { key: src, className: chunk47IWLKYO_js.cn("group", props.itemClassName) }, /* @__PURE__ */ React25__namespace.createElement(
1276
+ chunk47IWLKYO_js.Image,
1277
+ {
1278
+ src,
1279
+ alt: "",
1280
+ fill: true,
1281
+ className: "sb-absolute sb-inset-0 sb-object-cover sb-pointer-events-none"
1282
+ }
1283
+ ), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-absolute sb-right-1 sb-top-1 sb-z-30 sb-flex sb-items-center sb-justify-end sb-gap-3 sb-opacity-0 sb-transition-opacity group-hover:sb-opacity-100" }, /* @__PURE__ */ React25__namespace.createElement(
1284
+ "button",
1285
+ {
1286
+ 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",
1287
+ onClick: () => handleSourceDelete(src)
1288
+ },
1289
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.Trash2Icon, { className: "sb-h-4 sb-w-4" })
1290
+ )))), queue.map((_, i) => /* @__PURE__ */ React25__namespace.createElement(
1291
+ MediaInputItem,
1292
+ {
1293
+ key: i,
1294
+ className: chunk47IWLKYO_js.cn(
1295
+ "sb-flex sb-h-28 sb-w-28 sb-items-center sb-justify-center",
1296
+ props.itemClassName
1297
+ )
1298
+ },
1299
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.Loader2Icon, { className: "sb-h-6 sb-w-6 sb-animate-spin" })
1300
+ )), multiple || !multiple && !sources.length && !queue.length ? /* @__PURE__ */ React25__namespace.createElement(
1301
+ "label",
1302
+ {
1303
+ htmlFor: id,
1304
+ className: chunk47IWLKYO_js.cn(
1305
+ "sb-flex sb-h-28 sb-w-28 sb-cursor-pointer sb-items-center sb-justify-center sb-rounded-lg sb-border",
1306
+ props.itemClassName
1307
+ )
1308
+ },
1309
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.PlusIcon, { className: "sb-h-6 sb-w-6" }),
1310
+ /* @__PURE__ */ React25__namespace.createElement(
1311
+ "input",
1312
+ {
1313
+ id,
1314
+ type: "file",
1315
+ onChange: handleFilesAdd,
1316
+ multiple,
1317
+ accept: ".png,.jpg,.jpeg,.webp,.gif,.svg",
1318
+ className: "sb-hidden"
1319
+ }
1320
+ )
1321
+ ) : null);
1322
+ };
1323
+ var MediaInputItem = (props) => {
1324
+ return /* @__PURE__ */ React25__namespace.createElement(
1325
+ "div",
1326
+ {
1327
+ className: chunk47IWLKYO_js.cn(
1328
+ "sb-relative sb-h-28 sb-w-28 sb-overflow-hidden sb-rounded-lg sb-border",
1329
+ props.className
1330
+ )
1331
+ },
1332
+ props.children
1333
+ );
1334
+ };
1335
+ var MediaInputError = class extends Error {
1336
+ title;
1337
+ description;
1338
+ constructor(message, description) {
1339
+ super(message);
1340
+ this.title = message;
1341
+ this.description = description;
1342
+ }
1343
+ };
1344
+ var Select = SelectPrimitive__namespace.Root;
1345
+ var SelectValue = SelectPrimitive__namespace.Value;
1346
+ var SelectTrigger = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1347
+ SelectPrimitive__namespace.Trigger,
1348
+ {
1349
+ ref,
1350
+ className: chunk47IWLKYO_js.cn(
1351
+ "sb-flex sb-h-10 sb-w-full sb-items-center sb-justify-between sb-rounded-md sb-border sb-border-input sb-bg-background sb-px-3 sb-py-2 sb-text-sm sb-ring-offset-background placeholder:sb-text-muted-foreground focus:sb-outline-none focus:sb-ring-2 focus:sb-ring-ring focus:sb-ring-offset-2 disabled:sb-cursor-not-allowed disabled:sb-opacity-50 [&>span]:sb-line-clamp-1",
1352
+ className
1353
+ ),
1354
+ ...props
1355
+ },
1356
+ children,
1357
+ /* @__PURE__ */ React25__namespace.createElement(SelectPrimitive__namespace.Icon, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronDown, { className: "sb-h-4 sb-w-4 sb-opacity-50" }))
1358
+ ));
1359
+ SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
1360
+ var SelectScrollUpButton = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1361
+ SelectPrimitive__namespace.ScrollUpButton,
1362
+ {
1363
+ ref,
1364
+ className: chunk47IWLKYO_js.cn(
1365
+ "sb-flex sb-cursor-default sb-items-center sb-justify-center sb-py-1",
1366
+ className
1367
+ ),
1368
+ ...props
1369
+ },
1370
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronUp, { className: "sb-h-4 sb-w-4" })
1371
+ ));
1372
+ SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
1373
+ var SelectScrollDownButton = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1374
+ SelectPrimitive__namespace.ScrollDownButton,
1375
+ {
1376
+ ref,
1377
+ className: chunk47IWLKYO_js.cn(
1378
+ "sb-flex sb-cursor-default sb-items-center sb-justify-center sb-py-1",
1379
+ className
1380
+ ),
1381
+ ...props
1382
+ },
1383
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ChevronDown, { className: "sb-h-4 sb-w-4" })
1384
+ ));
1385
+ SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
1386
+ var SelectContent = React25__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(SelectPrimitive__namespace.Portal, null, /* @__PURE__ */ React25__namespace.createElement(
1387
+ SelectPrimitive__namespace.Content,
1388
+ {
1389
+ ref,
1390
+ className: chunk47IWLKYO_js.cn(
1391
+ "sb-relative sb-z-50 sb-max-h-96 sb-min-w-[8rem] sb-overflow-hidden sb-rounded-md sb-border sb-bg-popover sb-text-popover-foreground sb-shadow-md data-[state=open]:sb-animate-in data-[state=closed]:sb-animate-out data-[state=closed]:sb-fade-out-0 data-[state=open]:sb-fade-in-0 data-[state=closed]:sb-zoom-out-95 data-[state=open]:sb-zoom-in-95 data-[side=bottom]:sb-slide-in-from-top-2 data-[side=left]:sb-slide-in-from-right-2 data-[side=right]:sb-slide-in-from-left-2 data-[side=top]:sb-slide-in-from-bottom-2",
1392
+ position === "popper" && "data-[side=bottom]:sb-translate-y-1 data-[side=left]:sb--translate-x-1 data-[side=right]:sb-translate-x-1 data-[side=top]:sb--translate-y-1",
1393
+ className
1394
+ ),
1395
+ position,
1396
+ ...props
1397
+ },
1398
+ /* @__PURE__ */ React25__namespace.createElement(SelectScrollUpButton, null),
1399
+ /* @__PURE__ */ React25__namespace.createElement(
1400
+ SelectPrimitive__namespace.Viewport,
1401
+ {
1402
+ className: chunk47IWLKYO_js.cn(
1403
+ "sb-p-1",
1404
+ position === "popper" && "sb-h-[var(--radix-select-trigger-height)] sb-w-full sb-min-w-[var(--radix-select-trigger-width)]"
1405
+ )
1406
+ },
1407
+ children
1408
+ ),
1409
+ /* @__PURE__ */ React25__namespace.createElement(SelectScrollDownButton, null)
1410
+ )));
1411
+ SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
1412
+ var SelectLabel = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1413
+ SelectPrimitive__namespace.Label,
1414
+ {
1415
+ ref,
1416
+ className: chunk47IWLKYO_js.cn(
1417
+ "sb-py-1.5 sb-pl-8 sb-pr-2 sb-text-sm sb-font-semibold",
1418
+ className
1419
+ ),
1420
+ ...props
1421
+ }
1422
+ ));
1423
+ SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
1424
+ var SelectItem = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1425
+ SelectPrimitive__namespace.Item,
1426
+ {
1427
+ ref,
1428
+ className: chunk47IWLKYO_js.cn(
1429
+ "sb-relative sb-flex sb-w-full sb-cursor-default sb-select-none sb-items-center sb-rounded-sm sb-py-1.5 sb-pl-8 sb-pr-2 sb-text-sm sb-outline-none focus:sb-bg-accent focus:sb-text-accent-foreground data-[disabled]:sb-pointer-events-none data-[disabled]:sb-opacity-50",
1430
+ className
1431
+ ),
1432
+ ...props
1433
+ },
1434
+ /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-absolute sb-left-2 sb-flex sb-h-3.5 sb-w-3.5 sb-items-center sb-justify-center" }, /* @__PURE__ */ React25__namespace.createElement(SelectPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React25__namespace.createElement(lucideReact.Check, { className: "sb-h-4 sb-w-4" }))),
1435
+ /* @__PURE__ */ React25__namespace.createElement(SelectPrimitive__namespace.ItemText, null, children)
1436
+ ));
1437
+ SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
1438
+ var SelectSeparator = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1439
+ SelectPrimitive__namespace.Separator,
1440
+ {
1441
+ ref,
1442
+ className: chunk47IWLKYO_js.cn("sb--mx-1 sb-my-1 sb-h-px sb-bg-muted", className),
1443
+ ...props
1444
+ }
1445
+ ));
1446
+ SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
1447
+ var Textarea = React25__namespace.forwardRef(
1448
+ ({ className, ...props }, ref) => {
1449
+ return /* @__PURE__ */ React25__namespace.createElement(
1450
+ "textarea",
1451
+ {
1452
+ className: chunk47IWLKYO_js.cn(
1453
+ "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",
1454
+ className
1455
+ ),
1456
+ ref,
1457
+ ...props
1458
+ }
1459
+ );
1460
+ }
1461
+ );
1462
+ Textarea.displayName = "Textarea";
1463
+
1464
+ // src/components/container-item-form.tsx
1465
+ var ContainerItemForm = (props) => {
1466
+ const { item } = props;
1467
+ const { patchItem } = chunkIAIJXTFG_js.useBuilder();
1468
+ const component = chunk47IWLKYO_js.builder.getComponent(item.component);
1469
+ if (!component) {
1470
+ throw new Error(
1471
+ `[simple-builder]: Component with id ${item.component} not found in container item form component`
1472
+ );
1473
+ }
1474
+ const form = reactHookForm.useForm({
1475
+ defaultValues: (component.inputs || []).reduce(
1476
+ (acc, input) => ({
1477
+ ...acc,
1478
+ [input.name]: item?.props?.[input.name] ?? input.defaultValue
1479
+ }),
1480
+ {}
1481
+ )
1482
+ });
1483
+ const onSubmit = (values) => {
1484
+ patchItem(item.id, {
1485
+ props: values
1486
+ });
1487
+ };
1488
+ React25__namespace.useEffect(() => {
1489
+ const subscription = form.watch(() => form.handleSubmit(onSubmit)());
1490
+ return () => subscription.unsubscribe();
1491
+ }, [form.watch, form.handleSubmit]);
1492
+ return /* @__PURE__ */ React25__namespace.createElement(Form, { ...form }, /* @__PURE__ */ React25__namespace.createElement("form", { onSubmit: form.handleSubmit(onSubmit) }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-4 sb-p-4" }, (component.inputs || []).map((input) => /* @__PURE__ */ React25__namespace.createElement(
1493
+ RenderFormField,
1494
+ {
1495
+ key: input.name,
1496
+ type: input.type,
1497
+ input,
1498
+ form
1499
+ }
1500
+ )))));
1501
+ };
1502
+ var RenderFormField = (props) => {
1503
+ const { type, input, form } = props;
1504
+ const fieldArray = reactHookForm.useFieldArray({
1505
+ control: form.control,
1506
+ name: input.name
1507
+ });
1508
+ if (input.multiple) {
1509
+ return /* @__PURE__ */ React25__namespace.createElement("fieldset", { className: "sb-space-y-2" }, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-4" }, fieldArray.fields.map(
1510
+ (field, i) => type !== "grouped" ? /* @__PURE__ */ React25__namespace.createElement(
1511
+ FormField,
1512
+ {
1513
+ key: field.id,
1514
+ control: form.control,
1515
+ name: `${input.name}.${i}`,
1516
+ render: ({ field: field2 }) => /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-items-center sb-gap-3" }, /* @__PURE__ */ React25__namespace.createElement(RenderInput, { field: field2, type: input.type }), /* @__PURE__ */ React25__namespace.createElement("button", { type: "button", onClick: () => fieldArray.remove(i) }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.XIcon, { className: "sb-h-4 sb-w-4" })))
1517
+ }
1518
+ ) : /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-items-center sb-relative" }, /* @__PURE__ */ React25__namespace.createElement(
1519
+ RenderFormField,
1520
+ {
1521
+ key: field.id,
1522
+ form,
1523
+ type,
1524
+ input: {
1525
+ ...input,
1526
+ name: `${input.name}.${i}`,
1527
+ multiple: false,
1528
+ friendlyName: ""
1529
+ }
1530
+ }
1531
+ ), /* @__PURE__ */ React25__namespace.createElement(
1532
+ "button",
1533
+ {
1534
+ type: "button",
1535
+ onClick: () => fieldArray.remove(i),
1536
+ className: "sb-absolute sb-top-2 sb-right-2 sb-text-foreground/70 hover:sb-text-foreground"
1537
+ },
1538
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.XIcon, { className: "sb-h-4 sb-w-4" })
1539
+ ))
1540
+ ), /* @__PURE__ */ React25__namespace.createElement(
1541
+ chunkIAIJXTFG_js.Button,
1542
+ {
1543
+ type: "button",
1544
+ variant: "outline",
1545
+ size: "sm",
1546
+ className: chunk47IWLKYO_js.cn(
1547
+ "sb-w-[89%] sb-border-2 sb-border-dashed sb-text-muted-foreground",
1548
+ type === "grouped" && "sb-w-full"
1549
+ ),
1550
+ onClick: () => fieldArray.append(void 0)
1551
+ },
1552
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.PlusCircleIcon, { className: "sb-h-4 sb-w-4" })
1553
+ )));
1554
+ }
1555
+ switch (type) {
1556
+ case "string":
1557
+ case "number":
1558
+ case "longText":
1559
+ case "color":
1560
+ case "date":
1561
+ case "file":
1562
+ return /* @__PURE__ */ React25__namespace.createElement(
1563
+ FormField,
1564
+ {
1565
+ key: input.name,
1566
+ control: form.control,
1567
+ name: input.name,
1568
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(RenderInput, { type, field, options: input?.enum })), input.helperText && /* @__PURE__ */ React25__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
1569
+ }
1570
+ );
1571
+ case "richText":
1572
+ return /* @__PURE__ */ React25__namespace.createElement(Dialog, null, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-2" }, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement(DialogTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(chunkIAIJXTFG_js.Button, { variant: "outline", className: "sb-w-full" }, input.friendlyName || input.name, " bewerken"))), /* @__PURE__ */ React25__namespace.createElement(DialogContent, { className: "sb-max-w-3xl sb-p-0" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-h-full sb-max-h-svh sb-w-full sb-flex-col sm:sb-max-h-[90svh]" }, /* @__PURE__ */ React25__namespace.createElement(DialogHeader, { className: "sb-flex-none sb-border-b sb-p-6" }, /* @__PURE__ */ React25__namespace.createElement(DialogTitle, null, input.friendlyName || input.name, " editor")), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex-1 sb-overflow-y-auto" }, /* @__PURE__ */ React25__namespace.createElement(
1573
+ FormField,
1574
+ {
1575
+ key: input.name,
1576
+ control: form.control,
1577
+ name: input.name,
1578
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(RenderInput, { type, field })), input.helperText && /* @__PURE__ */ React25__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
1579
+ }
1580
+ )))));
1581
+ case "boolean":
1582
+ return /* @__PURE__ */ React25__namespace.createElement(
1583
+ FormField,
1584
+ {
1585
+ key: input.name,
1586
+ control: form.control,
1587
+ name: input.name,
1588
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, { className: "sb-flex sb-flex-row sb-items-center sb-justify-between sb-space-y-0" }, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(RenderInput, { type, field })), input.helperText && /* @__PURE__ */ React25__namespace.createElement(FormDescription, null, input.helperText), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
1589
+ }
1590
+ );
1591
+ case "grouped":
1592
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-2 sb-w-full" }, input.friendlyName !== "" && /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, input.friendlyName || input.name), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-2 sb-p-3 sb-w-full sb-border sb-rounded-lg" }, input.inputs.map((sub) => /* @__PURE__ */ React25__namespace.createElement(
1593
+ RenderFormField,
1594
+ {
1595
+ key: `${input.name}.${sub.name}`,
1596
+ type: sub.type,
1597
+ input: {
1598
+ ...sub,
1599
+ name: `${input.name}.${sub.name}`
1600
+ },
1601
+ form
1602
+ }
1603
+ ))));
1604
+ default:
1605
+ throw new Error(
1606
+ `[simple-builder]: Input type "${props.type}" not supported in render form field.`
1607
+ );
1608
+ }
1609
+ };
1610
+ var RenderInput = (props) => {
1611
+ const { type, options, field } = props;
1612
+ switch (type) {
1613
+ case "string":
1614
+ if (!options)
1615
+ return /* @__PURE__ */ React25__namespace.createElement(Input, { ...field });
1616
+ return /* @__PURE__ */ React25__namespace.createElement(Select, { onValueChange: field.onChange, defaultValue: field.value }, /* @__PURE__ */ React25__namespace.createElement(SelectTrigger, null, /* @__PURE__ */ React25__namespace.createElement(SelectValue, null)), /* @__PURE__ */ React25__namespace.createElement(SelectContent, null, options.map((option) => /* @__PURE__ */ React25__namespace.createElement(SelectItem, { key: option, value: option }, option))));
1617
+ case "longText":
1618
+ return /* @__PURE__ */ React25__namespace.createElement(Textarea, { ...field });
1619
+ case "richText":
1620
+ return /* @__PURE__ */ React25__namespace.createElement(RichTextEditor, { ...field });
1621
+ case "number":
1622
+ return /* @__PURE__ */ React25__namespace.createElement(Input, { type: "number", ...field });
1623
+ case "color":
1624
+ return /* @__PURE__ */ React25__namespace.createElement(ColorPicker, { color: field.value, onColorChange: field.onChange });
1625
+ case "date":
1626
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, null, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
1627
+ chunkIAIJXTFG_js.Button,
1628
+ {
1629
+ variant: "outline",
1630
+ size: "sm",
1631
+ className: chunk47IWLKYO_js.cn(
1632
+ "sb-w-full sb-flex sb-justify-start sb-text-left sb-font-normal",
1633
+ !field.value && "sb-text-muted-foreground"
1634
+ )
1635
+ },
1636
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.CalendarIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
1637
+ field.value && !Array.isArray(field.value) ? dateFns.format(field.value, "PPP") : /* @__PURE__ */ React25__namespace.createElement("span", null, "Pick a date")
1638
+ )), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { className: "sb-w-auto sb-p-0", align: "start" }, /* @__PURE__ */ React25__namespace.createElement(
1639
+ Calendar,
1640
+ {
1641
+ mode: "single",
1642
+ selected: field.value,
1643
+ onSelect: field.onChange,
1644
+ initialFocus: true
1645
+ }
1646
+ )));
1647
+ case "boolean":
1648
+ return /* @__PURE__ */ React25__namespace.createElement(Switch, { checked: field.value, onCheckedChange: field.onChange });
1649
+ case "file":
1650
+ return /* @__PURE__ */ React25__namespace.createElement(
1651
+ MediaInput,
1652
+ {
1653
+ className: "sb-grid sb-grid-cols-2 sb-gap-1",
1654
+ itemClassName: "sb-aspect-video sb-h-auto sb-w-full",
1655
+ multiple: false,
1656
+ files: field.value ? [field.value] : [],
1657
+ onFilesChange: (files) => field.onChange(files[0]),
1658
+ onError: (e) => console.error(
1659
+ "[media-input]: Title: " + e?.title,
1660
+ "media-input: Error: " + e?.description
1661
+ )
1662
+ }
1663
+ );
1664
+ default:
1665
+ throw new Error(
1666
+ `[simple-builder]: Input type "${props.type}" not supported in render input.`
1667
+ );
1668
+ }
1669
+ };
1670
+ var Tabs = TabsPrimitive__namespace.Root;
1671
+ var tabsListVariants = chunk47IWLKYO_js.tv({
1672
+ variants: {
1673
+ variant: {
1674
+ 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",
1675
+ text: "sb-flex sb-items-center sb-border-b sb-px-4 sb-space-x-6"
1676
+ }
1677
+ },
1678
+ defaultVariants: {
1679
+ variant: "contained"
1680
+ }
1681
+ });
1682
+ var TabsList = React25__namespace.forwardRef(({ variant, className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1683
+ TabsPrimitive__namespace.List,
1684
+ {
1685
+ ref,
1686
+ className: tabsListVariants({ variant, className }),
1687
+ ...props
1688
+ }
1689
+ ));
1690
+ TabsList.displayName = TabsPrimitive__namespace.List.displayName;
1691
+ var tabsTriggerVariants = chunk47IWLKYO_js.tv({
1692
+ variants: {
1693
+ variant: {
1694
+ 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",
1695
+ 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"
1696
+ }
1697
+ },
1698
+ defaultVariants: {
1699
+ variant: "contained"
1700
+ }
1701
+ });
1702
+ var TabsTrigger = React25__namespace.forwardRef(({ variant, className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1703
+ TabsPrimitive__namespace.Trigger,
1704
+ {
1705
+ ref,
1706
+ className: tabsTriggerVariants({ variant, className }),
1707
+ ...props
1708
+ }
1709
+ ));
1710
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
1711
+ var TabsContent = React25__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
1712
+ TabsPrimitive__namespace.Content,
1713
+ {
1714
+ ref,
1715
+ className: chunk47IWLKYO_js.cn(
1716
+ "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",
1717
+ className
1718
+ ),
1719
+ ...props
1720
+ }
1721
+ ));
1722
+ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
1723
+
1724
+ // src/components/ui/background-picker.tsx
1725
+ var BackgroundPicker = (props) => {
1726
+ const { background, onBackgroundChange, className } = props;
1727
+ const solids = props.solids ?? [
1728
+ "#000000",
1729
+ "#ffffff",
1730
+ "#0f172a",
1731
+ "#F1F5F9",
1732
+ "#64748B",
1733
+ "#E6007E",
1734
+ "#F8FAFC",
1735
+ "#009DD1",
1736
+ "#FF0000"
1737
+ ];
1738
+ const gradients = props.gradients ?? [
1739
+ "linear-gradient(to top left,#accbee,#e7f0fd)",
1740
+ "linear-gradient(to top left,#d5d4d0,#d5d4d0,#eeeeec)"
1741
+ ];
1742
+ const images = props.images ?? [
1743
+ "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)",
1744
+ "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)"
1745
+ ];
1746
+ const defaultTab = React25__namespace.useMemo(() => {
1747
+ if (background.includes("url"))
1748
+ return "image";
1749
+ if (background.includes("gradient"))
1750
+ return "gradient";
1751
+ return "solid";
1752
+ }, [background]);
1753
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, null, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
1754
+ chunkIAIJXTFG_js.Button,
1755
+ {
1756
+ variant: "outline",
1757
+ size: "sm",
1758
+ className: chunk47IWLKYO_js.cn(
1759
+ "sb-justify-start sb-text-left sb-font-normal sb-normal-case sb-w-full",
1760
+ !background && "sb-text-muted-foreground",
1761
+ className
1762
+ )
1763
+ },
1764
+ /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-w-full sb-flex sb-items-center sb-gap-2" }, background ? /* @__PURE__ */ React25__namespace.createElement(
1765
+ "div",
1766
+ {
1767
+ className: "sb-h-4 sb-w-4 sb-rounded !sb-bg-center !sb-bg-cover sb-transition-all sb-border",
1768
+ style: { background }
1769
+ }
1770
+ ) : /* @__PURE__ */ React25__namespace.createElement(lucideReact.PaintbrushIcon, { className: "sb-h-4 sb-w-4" }), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-truncate sb-flex-1" }, background ? background : "Kies een achtergrond"))
1771
+ )), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { className: "sb-w-64 sb-p-0" }, /* @__PURE__ */ React25__namespace.createElement(Tabs, { defaultValue: defaultTab }, /* @__PURE__ */ React25__namespace.createElement(TabsList, { className: "sb-w-full" }, /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "solid" }, "Solid"), /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "gradient" }, "Gradient"), /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { className: "sb-flex-1", value: "image" }, "Image")), /* @__PURE__ */ React25__namespace.createElement(
1772
+ TabsContent,
1773
+ {
1774
+ value: "solid",
1775
+ className: "data-[state=active]:sb-flex sb-flex-wrap sb-gap-1 sb-p-4"
1776
+ },
1777
+ solids.map((s) => /* @__PURE__ */ React25__namespace.createElement(
1778
+ "div",
1779
+ {
1780
+ key: s,
1781
+ style: { background: s },
1782
+ className: "sb-rounded-md sb-h-6 sb-w-6 sb-cursor-pointer active:sb-scale-105 sb-border",
1783
+ onClick: () => onBackgroundChange(s)
1784
+ }
1785
+ ))
1786
+ ), /* @__PURE__ */ React25__namespace.createElement(
1787
+ TabsContent,
1788
+ {
1789
+ value: "gradient",
1790
+ className: "data-[state=active]:sb-flex sb-flex-wrap sb-gap-1 sb-p-4"
1791
+ },
1792
+ gradients.map((s) => /* @__PURE__ */ React25__namespace.createElement(
1793
+ "div",
1794
+ {
1795
+ key: s,
1796
+ style: { background: s },
1797
+ className: "rounded-md h-6 w-6 cursor-pointer active:scale-105 border",
1798
+ onClick: () => onBackgroundChange(s)
1799
+ }
1800
+ ))
1801
+ ), /* @__PURE__ */ React25__namespace.createElement(TabsContent, { value: "image" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-p-4 sb-border-b" }, /* @__PURE__ */ React25__namespace.createElement(
1802
+ MediaInput,
1803
+ {
1804
+ className: "sb-grid sb-grid-cols-2 sb-gap-1",
1805
+ itemClassName: "sb-aspect-video sb-h-auto sb-w-full",
1806
+ multiple: false,
1807
+ onFilesChange: (files) => {
1808
+ if (!files.length)
1809
+ return;
1810
+ onBackgroundChange(`url(${files[0]})`);
1811
+ },
1812
+ onError: (e) => console.error(
1813
+ "[media-input]: Title: " + e?.title,
1814
+ "media-input: Error: " + e?.description
1815
+ )
1816
+ }
1817
+ )), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-gap-1 sb-p-4" }, images.map((s) => /* @__PURE__ */ React25__namespace.createElement(
1818
+ "div",
1819
+ {
1820
+ key: s,
1821
+ style: { backgroundImage: s },
1822
+ className: "sb-rounded-md sb-bg-cover sb-bg-center sb-aspect-video sb-w-full sb-cursor-pointer sb-border active:sb-scale-105",
1823
+ onClick: () => onBackgroundChange(s)
1824
+ }
1825
+ )))))));
1826
+ };
1827
+ var SpacingInput = (props) => {
1828
+ const [value, setValue] = React25__namespace.useState(parse(props.value || "0px"));
1829
+ const [indipendent, setIndipendent] = React25__namespace.useState(
1830
+ isIndipendent(parse(props.value || "0px"))
1831
+ );
1832
+ React25__namespace.useEffect(() => {
1833
+ if (!props.onChange)
1834
+ return;
1835
+ props.onChange(stringify(value));
1836
+ }, [value, props.onChange]);
1837
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-grid sb-grid-cols-[1fr,auto] sb-gap-3" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-items-center sb-gap-3" }, !indipendent ? /* @__PURE__ */ React25__namespace.createElement(React25__namespace.Fragment, null, /* @__PURE__ */ React25__namespace.createElement(
1838
+ AdvancedInput,
1839
+ {
1840
+ value: value.left,
1841
+ pattern: "\\d+",
1842
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, left: +value2, right: +value2 })),
1843
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4" }),
1844
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1845
+ }
1846
+ ), /* @__PURE__ */ React25__namespace.createElement(
1847
+ AdvancedInput,
1848
+ {
1849
+ value: value.top,
1850
+ pattern: "\\d+",
1851
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, top: +value2, bottom: +value2 })),
1852
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalSpaceAroundIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
1853
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1854
+ }
1855
+ )) : /* @__PURE__ */ React25__namespace.createElement(React25__namespace.Fragment, null, /* @__PURE__ */ React25__namespace.createElement(
1856
+ AdvancedInput,
1857
+ {
1858
+ value: value.left,
1859
+ pattern: "\\d+",
1860
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, left: +value2 })),
1861
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4" }),
1862
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1863
+ }
1864
+ ), /* @__PURE__ */ React25__namespace.createElement(
1865
+ AdvancedInput,
1866
+ {
1867
+ value: value.top,
1868
+ pattern: "\\d+",
1869
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, top: +value2 })),
1870
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-90" }),
1871
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1872
+ }
1873
+ ), /* @__PURE__ */ React25__namespace.createElement(
1874
+ AdvancedInput,
1875
+ {
1876
+ value: value.right,
1877
+ pattern: "\\d+",
1878
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, right: +value2 })),
1879
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb-rotate-180" }),
1880
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1881
+ }
1882
+ ), /* @__PURE__ */ React25__namespace.createElement(
1883
+ AdvancedInput,
1884
+ {
1885
+ value: value.bottom,
1886
+ pattern: "\\d+",
1887
+ onChange: ({ target: { value: value2 } }) => setValue((prev) => ({ ...prev, bottom: +value2 })),
1888
+ prepend: /* @__PURE__ */ React25__namespace.createElement(lucideReact.AlignHorizontalJustifyStartIcon, { className: "sb-h-4 sb-w-4 sb--rotate-90" }),
1889
+ append: /* @__PURE__ */ React25__namespace.createElement("span", { className: "sb-text-muted-foreground" }, "px")
1890
+ }
1891
+ ))), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-shrink-0" }, /* @__PURE__ */ React25__namespace.createElement(
1892
+ Toggle,
1893
+ {
1894
+ className: "sb-shrink-0 sb-flex sb-w-8 sb-h-8 sb-p-0",
1895
+ variant: "outline",
1896
+ size: "sm",
1897
+ pressed: indipendent,
1898
+ onPressedChange: setIndipendent
1899
+ },
1900
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ScanIcon, { className: "sb-h-4 sb-w-4" })
1901
+ )));
1902
+ };
1903
+ var isIndipendent = (value) => {
1904
+ const { top, right, bottom, left } = value;
1905
+ return top !== bottom || right !== left;
1906
+ };
1907
+ var parse = (value) => {
1908
+ const matches = value.match(/(\d+)/gm);
1909
+ const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
1910
+ switch (matches?.length) {
1911
+ case 1:
1912
+ return { top, right: top, bottom: top, left: top };
1913
+ case 2:
1914
+ return { top, bottom: top, left: right, right };
1915
+ case 3:
1916
+ return { top, right, left: right, bottom };
1917
+ default:
1918
+ return { top, right, bottom, left };
1919
+ }
1920
+ };
1921
+ var stringify = (value) => {
1922
+ const { top, right, bottom, left } = value;
1923
+ if (top === right && top === bottom && top === left) {
1924
+ return `${top}px`;
1925
+ }
1926
+ if (top === bottom && right === left) {
1927
+ return `${top}px ${right}px`;
1928
+ }
1929
+ if (right === left) {
1930
+ return `${top}px ${right}px ${bottom}px`;
1931
+ }
1932
+ return `${top}px ${right}px ${bottom}px ${left}px`;
1933
+ };
1934
+
1935
+ // src/components/item-design-form.tsx
1936
+ var designSchema = zod.z.object({
1937
+ container: zod.z.coerce.boolean(),
1938
+ hidden: zod.z.enum(["always", "mobile", "desktop", "never"]),
1939
+ desktop: zod.z.object({
1940
+ background: zod.z.string(),
1941
+ color: zod.z.string(),
1942
+ padding: zod.z.string(),
1943
+ margin: zod.z.string()
1944
+ }),
1945
+ mobile: zod.z.object({
1946
+ background: zod.z.string(),
1947
+ color: zod.z.string(),
1948
+ padding: zod.z.string(),
1949
+ margin: zod.z.string()
1950
+ })
1951
+ });
1952
+ var ItemDesignForm = (props) => {
1953
+ const { item } = props;
1954
+ const component = chunk47IWLKYO_js.builder.getComponent(item.component);
1955
+ if (!component) {
1956
+ throw new Error(
1957
+ `[simple-builder]: Component "${item.component}" not found`
1958
+ );
1959
+ }
1960
+ const getDefaultDeviceValue = (params) => {
1961
+ const { device: device2 = "desktop", key, fallback = "" } = params;
1962
+ if (item.styles?.[device2]?.[key] !== void 0) {
1963
+ return item.styles[device2][key];
1964
+ }
1965
+ if (component.defaultStyles?.[device2]?.[key] !== void 0) {
1966
+ return component.defaultStyles[device2][key];
1967
+ }
1968
+ if (device2 === "mobile") {
1969
+ const desktopValue = getDefaultDeviceValue({
1970
+ ...params,
1971
+ device: "desktop"
1972
+ });
1973
+ if (desktopValue !== void 0) {
1974
+ return desktopValue;
1975
+ }
1976
+ }
1977
+ return fallback;
1978
+ };
1979
+ const getDefaultDeviceValues = (device2) => {
1980
+ return {
1981
+ background: getDefaultDeviceValue({ device: device2, key: "background" }),
1982
+ color: getDefaultDeviceValue({ device: device2, key: "color" }),
1983
+ padding: getDefaultDeviceValue({ device: device2, key: "padding" }),
1984
+ margin: getDefaultDeviceValue({ device: device2, key: "margin" })
1985
+ };
1986
+ };
1987
+ const form = reactHookForm.useForm({
1988
+ resolver: zod$1.zodResolver(designSchema),
1989
+ values: {
1990
+ container: item.styles?.container ?? true,
1991
+ hidden: item.styles?.hidden ?? "never",
1992
+ desktop: getDefaultDeviceValues("desktop"),
1993
+ mobile: getDefaultDeviceValues("mobile")
1994
+ }
1995
+ });
1996
+ const { patchItem } = chunkIAIJXTFG_js.useBuilder();
1997
+ const onSubmit = (values) => {
1998
+ const { container, hidden, desktop, mobile } = values;
1999
+ const dirtyFields = form.formState.dirtyFields;
2000
+ const desktopPatch = Object.entries(desktop).reduce(
2001
+ (acc, [key, value]) => ({
2002
+ ...acc,
2003
+ ...value && { [key]: value }
2004
+ }),
2005
+ { ...item.styles?.desktop }
2006
+ );
2007
+ const mobilePatch = Object.entries(mobile).reduce(
2008
+ (acc, [key, value]) => {
2009
+ const desktopValue = desktop[key];
2010
+ const isDirty = dirtyFields.desktop?.[key];
2011
+ if (value === desktopValue || isDirty) {
2012
+ return acc;
2013
+ }
2014
+ if (["padding", "margin"].includes(key)) {
2015
+ if (value === "0px" && desktopValue === "0px") {
2016
+ return acc;
2017
+ }
2018
+ }
2019
+ return {
2020
+ ...acc,
2021
+ ...value && { [key]: value }
2022
+ };
2023
+ },
2024
+ { ...item.styles?.mobile }
2025
+ );
2026
+ patchItem(item.id, {
2027
+ styles: {
2028
+ ...container === false && { container },
2029
+ ...hidden !== "never" && { hidden },
2030
+ ...Object.keys(desktopPatch).length && { desktop: desktopPatch },
2031
+ ...Object.keys(mobilePatch).length && { mobile: mobilePatch }
2032
+ }
2033
+ });
2034
+ };
2035
+ const [device, setDevice] = React25__namespace.useState("desktop");
2036
+ React25__namespace.useEffect(() => {
2037
+ const subscription = form.watch(() => form.handleSubmit(onSubmit)());
2038
+ return () => subscription.unsubscribe();
2039
+ }, [form.watch, form.handleSubmit]);
2040
+ return /* @__PURE__ */ React25__namespace.createElement(Form, { ...form }, /* @__PURE__ */ React25__namespace.createElement("form", { onSubmit: form.handleSubmit(onSubmit) }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-4 sb-p-4" }, /* @__PURE__ */ React25__namespace.createElement(
2041
+ Tabs,
2042
+ {
2043
+ defaultValue: device,
2044
+ onValueChange: (device2) => setDevice(device2)
2045
+ },
2046
+ /* @__PURE__ */ React25__namespace.createElement(TabsList, { className: "sb-h-9 sb-grid sb-w-full sb-grid-cols-2" }, /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { value: "desktop", className: "sb-text-xs" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.MonitorIcon, { className: "sb-h-4 sb-w-4 sb-mr-2" }), /* @__PURE__ */ React25__namespace.createElement("span", null, "Desktop")), /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { value: "mobile", className: "sb-text-xs" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.SmartphoneIcon, { className: "sb-h-4 sb-w-4 sb-mr-2" }), /* @__PURE__ */ React25__namespace.createElement("span", null, "Mobiel")))
2047
+ ), /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-space-y-4" }, /* @__PURE__ */ React25__namespace.createElement(
2048
+ FormField,
2049
+ {
2050
+ control: form.control,
2051
+ key: `${device}.background`,
2052
+ name: `${device}.background`,
2053
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Achtergrond"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2054
+ BackgroundPicker,
2055
+ {
2056
+ background: field.value,
2057
+ onBackgroundChange: field.onChange
2058
+ }
2059
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2060
+ }
2061
+ ), /* @__PURE__ */ React25__namespace.createElement(
2062
+ FormField,
2063
+ {
2064
+ control: form.control,
2065
+ key: `${device}.color`,
2066
+ name: `${device}.color`,
2067
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Inhoud kleur"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2068
+ ColorPicker,
2069
+ {
2070
+ color: field.value,
2071
+ onColorChange: field.onChange
2072
+ }
2073
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2074
+ }
2075
+ ), /* @__PURE__ */ React25__namespace.createElement("hr", null), /* @__PURE__ */ React25__namespace.createElement(
2076
+ FormField,
2077
+ {
2078
+ control: form.control,
2079
+ name: "hidden",
2080
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Verbergen"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(Select, { value: field.value, onValueChange: field.onChange }, /* @__PURE__ */ React25__namespace.createElement(SelectTrigger, null, /* @__PURE__ */ React25__namespace.createElement(SelectValue, null)), /* @__PURE__ */ React25__namespace.createElement(SelectContent, null, /* @__PURE__ */ React25__namespace.createElement(SelectItem, { value: "never" }, "Nooit"), /* @__PURE__ */ React25__namespace.createElement(SelectItem, { value: "desktop" }, "Op desktop"), /* @__PURE__ */ React25__namespace.createElement(SelectItem, { value: "mobile" }, "Op mobiel"), /* @__PURE__ */ React25__namespace.createElement(SelectItem, { value: "always" }, "Altijd")))), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2081
+ }
2082
+ ), /* @__PURE__ */ React25__namespace.createElement("hr", null), /* @__PURE__ */ React25__namespace.createElement(
2083
+ FormField,
2084
+ {
2085
+ control: form.control,
2086
+ name: "container",
2087
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, { className: "sb-flex sb-flex-row sb-items-center sb-justify-between sb-space-y-0" }, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Volledige breedte"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2088
+ Switch,
2089
+ {
2090
+ checked: !field.value,
2091
+ onCheckedChange: (v) => field.onChange(!v)
2092
+ }
2093
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2094
+ }
2095
+ ), /* @__PURE__ */ React25__namespace.createElement("hr", null), /* @__PURE__ */ React25__namespace.createElement(
2096
+ FormField,
2097
+ {
2098
+ control: form.control,
2099
+ key: `${device}.padding`,
2100
+ name: `${device}.padding`,
2101
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Padding"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2102
+ SpacingInput,
2103
+ {
2104
+ value: field.value,
2105
+ onChange: field.onChange
2106
+ }
2107
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2108
+ }
2109
+ ), /* @__PURE__ */ React25__namespace.createElement(
2110
+ FormField,
2111
+ {
2112
+ control: form.control,
2113
+ key: `${device}.margin`,
2114
+ name: `${device}.margin`,
2115
+ render: ({ field }) => /* @__PURE__ */ React25__namespace.createElement(FormItem, null, /* @__PURE__ */ React25__namespace.createElement(FormLabel, null, "Margin"), /* @__PURE__ */ React25__namespace.createElement(FormControl, null, /* @__PURE__ */ React25__namespace.createElement(
2116
+ SpacingInput,
2117
+ {
2118
+ value: field.value,
2119
+ onChange: field.onChange
2120
+ }
2121
+ )), /* @__PURE__ */ React25__namespace.createElement(FormMessage, null))
2122
+ }
2123
+ )))));
2124
+ };
2125
+ var ScrollArea = React25__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
2126
+ ScrollAreaPrimitive__namespace.Root,
2127
+ {
2128
+ ref,
2129
+ className: chunk47IWLKYO_js.cn("sb-relative sb-overflow-hidden", className),
2130
+ ...props
2131
+ },
2132
+ /* @__PURE__ */ React25__namespace.createElement(ScrollAreaPrimitive__namespace.Viewport, { className: "sb-h-full sb-max-h-[80vh] sb-w-full sb-rounded-[inherit]" }, children),
2133
+ /* @__PURE__ */ React25__namespace.createElement(ScrollBar, null),
2134
+ /* @__PURE__ */ React25__namespace.createElement(ScrollAreaPrimitive__namespace.Corner, null)
2135
+ ));
2136
+ ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
2137
+ var ScrollBar = React25__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React25__namespace.createElement(
2138
+ ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
2139
+ {
2140
+ ref,
2141
+ orientation,
2142
+ className: chunk47IWLKYO_js.cn(
2143
+ "sb-flex sb-touch-none sb-select-none sb-transition-colors",
2144
+ orientation === "vertical" && "sb-h-full sb-w-2.5 sb-border-l sb-border-l-transparent sb-p-[1px]",
2145
+ orientation === "horizontal" && "sb-h-2.5 sb-flex-col sb-border-t sb-border-t-transparent sb-p-[1px]",
2146
+ className
2147
+ ),
2148
+ ...props
2149
+ },
2150
+ /* @__PURE__ */ React25__namespace.createElement(ScrollAreaPrimitive__namespace.ScrollAreaThumb, { className: "sb-relative sb-flex-1 sb-rounded-full sb-bg-border" })
2151
+ ));
2152
+ ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displayName;
2153
+
2154
+ // src/components/container-item-toolbar.tsx
2155
+ var ContainerItemToolbar = (props) => {
2156
+ const { contentId, canBringUp = false, canBringDown = false } = props;
2157
+ const { bringUp, bringDown } = chunkIAIJXTFG_js.useBuilder();
2158
+ return /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-absolute sb-z-20 sb-top-1 sb-right-1 sb-rounded-md sb-shadow sb-flex sb-flex-col sb-gap-1 sb-p-1 sb-bg-card sb-text-card-foreground sb-item-toolbar sb-opacity-0 sb-transition-opacity" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-h-10 sb-p-1 sb-border sb-border-input sb-bg-background sb-rounded-md sb-text-sm sb-font-medium sb-flex sb-gap-1 sb-items-center sb-justify-start" }, /* @__PURE__ */ React25__namespace.createElement(EditButton, { id: contentId }), /* @__PURE__ */ React25__namespace.createElement(
2159
+ chunkIAIJXTFG_js.Button,
2160
+ {
2161
+ variant: "ghost",
2162
+ className: "sb-w-8 sb-h-8 sb-p-0",
2163
+ onClick: () => bringUp(contentId),
2164
+ disabled: !canBringUp
2165
+ },
2166
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ArrowUp, { className: "sb-h-5 sb-w-5" })
2167
+ ), /* @__PURE__ */ React25__namespace.createElement(
2168
+ chunkIAIJXTFG_js.Button,
2169
+ {
2170
+ variant: "ghost",
2171
+ className: "sb-w-8 sb-h-8 sb-p-0",
2172
+ onClick: () => bringDown(contentId),
2173
+ disabled: !canBringDown
2174
+ },
2175
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.ArrowDown, { className: "sb-h-5 sb-w-5" })
2176
+ ), /* @__PURE__ */ React25__namespace.createElement(DeleteButton, { contentId })));
2177
+ };
2178
+ var EditButton = ({ id }) => {
2179
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, { modal: true }, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(chunkIAIJXTFG_js.Button, { variant: "ghost", className: "sb-w-8 sb-h-8 sb-p-0" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.Edit2Icon, { className: "sb-h-5 sb-w-5" }))), /* @__PURE__ */ React25__namespace.createElement(
2180
+ PopoverContent,
2181
+ {
2182
+ side: "left",
2183
+ align: "start",
2184
+ sideOffset: 16,
2185
+ alignOffset: -8,
2186
+ className: "sb-p-0 sb-relative",
2187
+ collisionPadding: 16
2188
+ },
2189
+ /* @__PURE__ */ React25__namespace.createElement(EditPopoverInner, { id })
2190
+ ));
2191
+ };
2192
+ var EditPopoverInner = (props) => {
2193
+ const { id } = props;
2194
+ const { getItem } = chunkIAIJXTFG_js.useBuilder();
2195
+ const item = getItem(id);
2196
+ if (!item) {
2197
+ throw new Error(
2198
+ `[simple-builder]: Item with id ${id} not found in container item form component`
2199
+ );
2200
+ }
2201
+ return /* @__PURE__ */ React25__namespace.createElement(Tabs, null, /* @__PURE__ */ React25__namespace.createElement(TabsList, { variant: "text", defaultValue: "content" }, /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { variant: "text", value: "content" }, "Inhoud"), /* @__PURE__ */ React25__namespace.createElement(TabsTrigger, { variant: "text", value: "design" }, "Design")), /* @__PURE__ */ React25__namespace.createElement(TabsContent, { value: "content" }, /* @__PURE__ */ React25__namespace.createElement(ScrollArea, null, /* @__PURE__ */ React25__namespace.createElement(ContainerItemForm, { item }))), /* @__PURE__ */ React25__namespace.createElement(TabsContent, { value: "design" }, /* @__PURE__ */ React25__namespace.createElement(ItemDesignForm, { item })));
2202
+ };
2203
+ var DeleteButton = ({ contentId }) => {
2204
+ const { deleteContent } = chunkIAIJXTFG_js.useBuilder();
2205
+ return /* @__PURE__ */ React25__namespace.createElement(AlertDialog, null, /* @__PURE__ */ React25__namespace.createElement(AlertDialogTrigger, { asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
2206
+ chunkIAIJXTFG_js.Button,
2207
+ {
2208
+ variant: "ghost",
2209
+ className: "sb-w-8 sb-h-8 sb-p-0 sb-text-destructive"
2210
+ },
2211
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.Trash2Icon, { className: "sb-h-5 sb-w-5" })
2212
+ )), /* @__PURE__ */ React25__namespace.createElement(AlertDialogContent, null, /* @__PURE__ */ React25__namespace.createElement(AlertDialogDescription, null, "Weet je zeker dat je dit blok wilt verwijderen?"), /* @__PURE__ */ React25__namespace.createElement(AlertDialogFooter, null, /* @__PURE__ */ React25__namespace.createElement(AlertDialogCancel, null, "Annuleren"), /* @__PURE__ */ React25__namespace.createElement(
2213
+ AlertDialogAction,
2214
+ {
2215
+ className: chunkIAIJXTFG_js.buttonVariants({ variant: "destructive" }),
2216
+ onClick: () => deleteContent(contentId)
2217
+ },
2218
+ "Verwijderen"
2219
+ ))));
2220
+ };
2221
+
2222
+ // src/components/build-container-client.tsx
2223
+ var BuildContainerInner = (props) => {
2224
+ const { id, name, content, multiple = false } = props;
2225
+ const items = Array.isArray(content) ? content : content?.[name] || [];
2226
+ if (!multiple && items.length > 1) {
2227
+ console.error(
2228
+ "[simple-builder]: Multiple content blocks detected when using property multiple false."
2229
+ );
2230
+ }
2231
+ return /* @__PURE__ */ React25__namespace.createElement("div", null, items.length <= 0 ? /* @__PURE__ */ React25__namespace.createElement(AddContentPlaceholder, { parent: id, container: name, index: 0 }) : multiple && /* @__PURE__ */ React25__namespace.createElement(AddContentDividerButton, { parent: id, container: name, index: 0 }), items.map((item, i) => /* @__PURE__ */ React25__namespace.createElement(React25__namespace.Fragment, { key: item.id }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-relative sb-container-item" }, /* @__PURE__ */ React25__namespace.createElement(chunk47IWLKYO_js.DesignWrapper, { building: true, styles: item.styles }, chunk47IWLKYO_js.builder.bindComponent(item, true)), /* @__PURE__ */ React25__namespace.createElement(
2232
+ ContainerItemToolbar,
2233
+ {
2234
+ contentId: item.id,
2235
+ canBringUp: i > 0,
2236
+ canBringDown: i < items.length - 1
2237
+ }
2238
+ )), multiple && /* @__PURE__ */ React25__namespace.createElement(
2239
+ AddContentDividerButton,
2240
+ {
2241
+ parent: id,
2242
+ container: name,
2243
+ index: i + 1
2244
+ }
2245
+ ))));
2246
+ };
2247
+ var build_container_client_default = BuildContainerInner;
2248
+ var AddContentButton = (props) => {
2249
+ const components = chunk47IWLKYO_js.builder.getComponents();
2250
+ const { addContent } = chunkIAIJXTFG_js.useBuilder();
2251
+ return /* @__PURE__ */ React25__namespace.createElement(Popover, null, /* @__PURE__ */ React25__namespace.createElement(PopoverTrigger, { asChild: true }, props.children), /* @__PURE__ */ React25__namespace.createElement(PopoverContent, { className: "sb-p-1" }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-grid sb-grid-cols-2 sb-gap-2" }, components.map((component) => {
2252
+ const Icon2 = component.icon ?? lucideReact.ImageIcon;
2253
+ return /* @__PURE__ */ React25__namespace.createElement(PopoverClose, { key: component.name, asChild: true }, /* @__PURE__ */ React25__namespace.createElement(
2254
+ chunkIAIJXTFG_js.Button,
2255
+ {
2256
+ variant: "ghost",
2257
+ className: "sb-justify-start",
2258
+ onClick: () => {
2259
+ addContent(
2260
+ component.name,
2261
+ props.container,
2262
+ props.parent,
2263
+ props.index
2264
+ );
2265
+ }
2266
+ },
2267
+ /* @__PURE__ */ React25__namespace.createElement(Icon2, { className: "sb-mr-2 sb-h-4 sb-w-4 sb-shrink-0" }),
2268
+ component.friendlyName ?? component.name
2269
+ ));
2270
+ }))));
2271
+ };
2272
+ var AddContentPlaceholder = (props) => {
2273
+ return /* @__PURE__ */ React25__namespace.createElement(AddContentButton, { ...props }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-flex sb-justify-center sb-bg-primary/50 p-4" }, /* @__PURE__ */ React25__namespace.createElement(chunkIAIJXTFG_js.Button, { size: "sm" }, /* @__PURE__ */ React25__namespace.createElement(lucideReact.PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }), "Blok Toevoegen")));
2274
+ };
2275
+ var AddContentDividerButton = (props) => {
2276
+ return /* @__PURE__ */ React25__namespace.createElement(AddContentButton, { ...props }, /* @__PURE__ */ React25__namespace.createElement("div", { className: "sb-w-full sb-h-1 sb--my-[2px] sb-bg-primary sb-relative sb-z-20 sb-opacity-0 add-content-divider-button sb-transition-opacity" }, /* @__PURE__ */ React25__namespace.createElement(
2277
+ chunkIAIJXTFG_js.Button,
2278
+ {
2279
+ size: "sm",
2280
+ className: "sb-absolute sb-left-1/2 sb-top-1/2 sb--translate-y-1/2 sb--translate-x-1/2 sb-shadow"
2281
+ },
2282
+ /* @__PURE__ */ React25__namespace.createElement(lucideReact.PlusIcon, { className: "sb-mr-2 sb-h-4 sb-w-4" }),
2283
+ "Blok Toevoegen"
2284
+ )));
2285
+ };
2286
+
2287
+ module.exports = build_container_client_default;