@simple-builder/react 1.3.3 → 1.3.6

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