@simple-builder/react 1.2.9 → 1.3.0

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