@simple-builder/react 1.2.10 → 1.3.1

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