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