@simple-builder/react 1.2.3 → 1.2.5

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