@simple-builder/react 1.2.9 → 1.3.0

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