@simple-builder/react 1.2.10 → 1.3.1

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