@simple-builder/react 1.2.0 → 1.2.2

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