@simple-builder/react 1.2.9 → 1.3.0

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