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