@simple-builder/react 1.2.3 → 1.2.4

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