@simple-builder/react 1.2.10 → 1.3.1

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