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