@chaibuilder/sdk 2.0.0-beta.81 → 2.0.0-beta.82
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/ChaiThemeFn-DcE5RdLQ.cjs +236 -0
- package/dist/ChaiThemeFn-DzirXKjI.js +237 -0
- package/dist/CodeEditor-C8_JzwHn.cjs +81 -0
- package/dist/CodeEditor-DdIk_PEV.js +81 -0
- package/dist/Topbar-62QmCKWL.cjs +18 -0
- package/dist/Topbar-Cqt0j3Yt.js +18 -0
- package/dist/context-menu-DHla8ofZ.js +893 -0
- package/dist/context-menu-DawHUIXd.cjs +923 -0
- package/dist/core.cjs +11709 -5
- package/dist/core.js +6845 -3957
- package/dist/getSplitClasses-BuALfSLX.js +54 -0
- package/dist/getSplitClasses-mbQmvwI3.cjs +53 -0
- package/dist/iconBase-BSrIcOaG.cjs +146 -0
- package/dist/iconBase-CWgVxu0A.js +147 -0
- package/dist/plugin-BcTnEZwx.cjs +26 -0
- package/dist/plugin-DGEKY3uC.js +27 -0
- package/dist/render.cjs +247 -2
- package/dist/render.js +205 -150
- package/dist/runtime.cjs +9 -1
- package/dist/sdk.css +1336 -1
- package/dist/tailwind.cjs +78 -1
- package/dist/tailwind.js +21 -19
- package/dist/ui.cjs +378 -1
- package/dist/ui.js +254 -244
- package/dist/web-blocks.cjs +1679 -2
- package/dist/web-blocks.js +747 -518
- package/package.json +1 -1
- package/dist/ChaiThemeFn-Cort9tch.js +0 -201
- package/dist/ChaiThemeFn-DQu-2Eh9.cjs +0 -13
- package/dist/CodeEditor-B2x4yruH.cjs +0 -1
- package/dist/CodeEditor-VcQsGvTM.js +0 -65
- package/dist/Topbar-BQsjWb-A.js +0 -16
- package/dist/Topbar-DEw_kBMz.cjs +0 -1
- package/dist/context-menu-C4lLV8gP.cjs +0 -1
- package/dist/context-menu-D5ViOi6K.js +0 -831
- package/dist/getSplitClasses-DodqA_KW.cjs +0 -1
- package/dist/getSplitClasses-DphwgQiE.js +0 -48
- package/dist/iconBase-Cn2BsTrq.cjs +0 -1
- package/dist/iconBase-DHfFLkem.js +0 -124
- package/dist/plugin-2xcljWGM.cjs +0 -1
- package/dist/plugin-kUMxtQR5.js +0 -24
package/dist/web-blocks.js
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
import { registerChaiBlockSchema
|
|
2
|
-
import { jsx
|
|
3
|
-
import * as
|
|
4
|
-
import { createElement
|
|
5
|
-
import { c as
|
|
6
|
-
import { ButtonIcon
|
|
7
|
-
import { isEmpty
|
|
8
|
-
import { GlobeIcon
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { registerChaiBlockSchema, StylesProp, registerChaiBlock } from "@chaibuilder/runtime";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { createElement } from "react";
|
|
5
|
+
import { c as cn, G as GenIcon, g as generateUUID } from "./iconBase-CWgVxu0A.js";
|
|
6
|
+
import { ButtonIcon, CodeIcon, HeadingIcon, TextIcon, CursorTextIcon, DividerHorizontalIcon, SketchLogoIcon, ImageIcon, Link1Icon, RowsIcon, ColumnsIcon, SpaceBetweenVerticallyIcon, VideoIcon, CheckboxIcon, InputIcon, LetterCaseToggleIcon, RadiobuttonIcon, DropdownMenuIcon } from "@radix-ui/react-icons";
|
|
7
|
+
import { isEmpty, get, isNull, pick, omit, map } from "lodash-es";
|
|
8
|
+
import { GlobeIcon, GroupIcon, Columns, Rows } from "lucide-react";
|
|
9
|
+
const EmptySlot = ({ className = "", inBuilder }) => {
|
|
10
|
+
if (!inBuilder) return null;
|
|
11
|
+
return /* @__PURE__ */ jsx("div", { className: cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2", className), children: /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800", children: /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700" }) }) });
|
|
12
|
+
};
|
|
13
|
+
const Component$3 = (props) => {
|
|
14
|
+
const { blockProps, inBuilder, backgroundImage, children, tag = "div", styles } = props;
|
|
15
|
+
let nestedChildren = children;
|
|
16
|
+
if (!children) {
|
|
17
|
+
nestedChildren = /* @__PURE__ */ jsx(EmptySlot, { inBuilder });
|
|
18
|
+
}
|
|
19
|
+
let cssStyles = {};
|
|
20
|
+
if (backgroundImage) {
|
|
21
|
+
cssStyles = { backgroundImage: `url(${backgroundImage})` };
|
|
22
|
+
}
|
|
23
|
+
return React.createElement(tag, { ...blockProps, ...styles, style: cssStyles }, nestedChildren);
|
|
24
|
+
};
|
|
25
|
+
const Config$s = {
|
|
16
26
|
type: "Box",
|
|
17
27
|
label: "Box",
|
|
18
28
|
category: "core",
|
|
19
29
|
group: "basic",
|
|
20
|
-
...
|
|
30
|
+
...registerChaiBlockSchema({
|
|
21
31
|
properties: {
|
|
22
|
-
styles:
|
|
32
|
+
styles: StylesProp(""),
|
|
23
33
|
backgroundImage: {
|
|
24
34
|
type: "string",
|
|
25
35
|
default: "",
|
|
@@ -52,38 +62,50 @@ const v = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ i("div",
|
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
64
|
}),
|
|
55
|
-
canAcceptBlock: () =>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
canAcceptBlock: () => true
|
|
66
|
+
};
|
|
67
|
+
const Component$2 = (props) => {
|
|
68
|
+
const { blockProps, iconSize, icon, content, styles, children, iconPos, link, inBuilder } = props;
|
|
69
|
+
const _icon = icon;
|
|
70
|
+
const child = children || /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
+
/* @__PURE__ */ jsx("span", { "data-ai-key": "content", children: content }),
|
|
72
|
+
_icon && /* @__PURE__ */ jsx(
|
|
60
73
|
"div",
|
|
61
74
|
{
|
|
62
|
-
style: { width:
|
|
63
|
-
className:
|
|
64
|
-
dangerouslySetInnerHTML: { __html:
|
|
75
|
+
style: { width: iconSize + "px" },
|
|
76
|
+
className: iconPos + " " + (iconPos === "order-first" ? "mr-2" : "ml-2") || "",
|
|
77
|
+
dangerouslySetInnerHTML: { __html: _icon }
|
|
65
78
|
}
|
|
66
79
|
)
|
|
67
|
-
] })
|
|
80
|
+
] });
|
|
81
|
+
const button = createElement(
|
|
68
82
|
"button",
|
|
69
83
|
{
|
|
70
|
-
...
|
|
71
|
-
...
|
|
84
|
+
...blockProps,
|
|
85
|
+
...styles,
|
|
72
86
|
type: "button",
|
|
73
|
-
"aria-label":
|
|
87
|
+
"aria-label": content
|
|
74
88
|
},
|
|
75
|
-
|
|
89
|
+
child
|
|
76
90
|
);
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
if (!isEmpty(get(link, "href"))) {
|
|
92
|
+
if (inBuilder) {
|
|
93
|
+
return /* @__PURE__ */ jsx("span", { children: button });
|
|
94
|
+
} else {
|
|
95
|
+
return /* @__PURE__ */ jsx("a", { "aria-label": content, href: get(link, "href") || "/", target: get(link, "target", "_self"), children: button });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return button;
|
|
99
|
+
};
|
|
100
|
+
const Config$r = {
|
|
79
101
|
type: "Button",
|
|
80
102
|
label: "Button",
|
|
81
103
|
category: "core",
|
|
82
|
-
icon:
|
|
104
|
+
icon: ButtonIcon,
|
|
83
105
|
group: "basic",
|
|
84
|
-
...
|
|
106
|
+
...registerChaiBlockSchema({
|
|
85
107
|
properties: {
|
|
86
|
-
styles:
|
|
108
|
+
styles: StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),
|
|
87
109
|
content: {
|
|
88
110
|
type: "string",
|
|
89
111
|
title: "Button label",
|
|
@@ -126,28 +148,30 @@ const v = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ i("div",
|
|
|
126
148
|
}),
|
|
127
149
|
i18nProps: ["content"],
|
|
128
150
|
aiProps: ["content"]
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
151
|
+
};
|
|
152
|
+
const CustomHTMLBlock = (props) => {
|
|
153
|
+
const { blockProps, styles, htmlCode, inBuilder } = props;
|
|
154
|
+
return inBuilder ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
155
|
+
inBuilder ? /* @__PURE__ */ jsx("div", { ...blockProps, ...styles, className: "absolute z-20 h-full w-full" }) : null,
|
|
156
|
+
React.createElement("div", {
|
|
157
|
+
...styles,
|
|
158
|
+
dangerouslySetInnerHTML: { __html: htmlCode.replace(/<script.*?>.*?<\/script>/g, "") }
|
|
136
159
|
})
|
|
137
|
-
] }) :
|
|
138
|
-
...
|
|
139
|
-
...
|
|
140
|
-
dangerouslySetInnerHTML: { __html:
|
|
160
|
+
] }) : React.createElement("div", {
|
|
161
|
+
...blockProps,
|
|
162
|
+
...styles,
|
|
163
|
+
dangerouslySetInnerHTML: { __html: htmlCode }
|
|
141
164
|
});
|
|
142
|
-
}
|
|
165
|
+
};
|
|
166
|
+
const Config$q = {
|
|
143
167
|
type: "CustomHTML",
|
|
144
168
|
label: "web_blocks.custom_html",
|
|
145
169
|
category: "core",
|
|
146
|
-
icon:
|
|
170
|
+
icon: CodeIcon,
|
|
147
171
|
group: "advanced",
|
|
148
|
-
...
|
|
172
|
+
...registerChaiBlockSchema({
|
|
149
173
|
properties: {
|
|
150
|
-
styles:
|
|
174
|
+
styles: StylesProp(""),
|
|
151
175
|
htmlCode: {
|
|
152
176
|
type: "string",
|
|
153
177
|
default: "<div><p>Enter your HTML code here...</p></div>",
|
|
@@ -155,18 +179,23 @@ const v = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ i("div",
|
|
|
155
179
|
}
|
|
156
180
|
}
|
|
157
181
|
})
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
182
|
+
};
|
|
183
|
+
const EmptyBox = (props) => {
|
|
184
|
+
const { blockProps, styles, backgroundImage } = props;
|
|
185
|
+
let cssStyles = {};
|
|
186
|
+
if (backgroundImage) {
|
|
187
|
+
cssStyles = { backgroundImage: `url(${backgroundImage})` };
|
|
188
|
+
}
|
|
189
|
+
return React.createElement("div", { ...blockProps, ...styles, style: cssStyles });
|
|
190
|
+
};
|
|
191
|
+
const Config$p = {
|
|
163
192
|
type: "EmptyBox",
|
|
164
193
|
label: "Empty Box",
|
|
165
194
|
category: "core",
|
|
166
195
|
group: "basic",
|
|
167
|
-
...
|
|
196
|
+
...registerChaiBlockSchema({
|
|
168
197
|
properties: {
|
|
169
|
-
styles:
|
|
198
|
+
styles: StylesProp(""),
|
|
170
199
|
backgroundImage: {
|
|
171
200
|
type: "string",
|
|
172
201
|
title: "Background Image",
|
|
@@ -175,20 +204,23 @@ const v = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ i("div",
|
|
|
175
204
|
}
|
|
176
205
|
}
|
|
177
206
|
})
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
207
|
+
};
|
|
208
|
+
const HeadingBlock = (props) => {
|
|
209
|
+
const { blockProps, styles, content, tag = "h1", children = null } = props;
|
|
210
|
+
if (children) return React.createElement(tag, { ...styles, ...blockProps }, children);
|
|
211
|
+
return React.createElement(tag, {
|
|
212
|
+
...styles,
|
|
213
|
+
...blockProps,
|
|
214
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
184
215
|
});
|
|
185
|
-
}
|
|
216
|
+
};
|
|
217
|
+
const Config$o = {
|
|
186
218
|
type: "Heading",
|
|
187
219
|
label: "web_blocks.heading",
|
|
188
220
|
category: "core",
|
|
189
|
-
icon:
|
|
221
|
+
icon: HeadingIcon,
|
|
190
222
|
group: "typography",
|
|
191
|
-
...
|
|
223
|
+
...registerChaiBlockSchema({
|
|
192
224
|
properties: {
|
|
193
225
|
tag: {
|
|
194
226
|
type: "string",
|
|
@@ -196,7 +228,7 @@ const v = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ i("div",
|
|
|
196
228
|
title: "Level",
|
|
197
229
|
enum: ["h1", "h2", "h3", "h4", "h5", "h6"]
|
|
198
230
|
},
|
|
199
|
-
styles:
|
|
231
|
+
styles: StylesProp("text-3xl"),
|
|
200
232
|
content: {
|
|
201
233
|
type: "string",
|
|
202
234
|
default: "Heading goes here",
|
|
@@ -207,51 +239,60 @@ const v = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ i("div",
|
|
|
207
239
|
}),
|
|
208
240
|
aiProps: ["content"],
|
|
209
241
|
i18nProps: ["content"],
|
|
210
|
-
canAcceptBlock: (
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
242
|
+
canAcceptBlock: (type) => type === "Span" || type === "Text"
|
|
243
|
+
};
|
|
244
|
+
const ParagraphBlock = (props) => {
|
|
245
|
+
const { blockProps, styles, content } = props;
|
|
246
|
+
if (!isNull(props.children)) return React.createElement("p", { ...styles, ...blockProps }, props.children);
|
|
247
|
+
return React.createElement("p", {
|
|
248
|
+
...styles,
|
|
249
|
+
...blockProps,
|
|
250
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
const Config$n = {
|
|
219
254
|
type: "Paragraph",
|
|
220
255
|
label: "Paragraph",
|
|
221
256
|
category: "core",
|
|
222
|
-
icon:
|
|
257
|
+
icon: TextIcon,
|
|
223
258
|
group: "typography",
|
|
224
|
-
...
|
|
259
|
+
...registerChaiBlockSchema({
|
|
225
260
|
properties: {
|
|
226
|
-
styles:
|
|
261
|
+
styles: StylesProp(""),
|
|
227
262
|
content: {
|
|
228
263
|
type: "string",
|
|
229
264
|
title: "Content",
|
|
230
265
|
default: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
|
|
231
266
|
Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
|
|
232
267
|
nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,
|
|
233
|
-
ui: { "ui:widget": "textarea", "ui:autosize":
|
|
268
|
+
ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 5 }
|
|
234
269
|
}
|
|
235
270
|
}
|
|
236
271
|
}),
|
|
237
272
|
i18nProps: ["content"],
|
|
238
273
|
aiProps: ["content"],
|
|
239
|
-
canAcceptBlock: (
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
274
|
+
canAcceptBlock: (type) => type === "Span" || type === "Link" || type === "Text"
|
|
275
|
+
};
|
|
276
|
+
const addForcedClasses = (styles, ...classes) => {
|
|
277
|
+
return {
|
|
278
|
+
...styles,
|
|
279
|
+
className: cn(styles.className, ...classes)
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
const RichTextBlock = (props) => {
|
|
283
|
+
const { blockProps, content, styles } = props;
|
|
284
|
+
const forcedStyles = addForcedClasses(styles, "prose", "max-w-full");
|
|
285
|
+
return /* @__PURE__ */ jsx("div", { ...blockProps, ...forcedStyles, dangerouslySetInnerHTML: { __html: content } });
|
|
286
|
+
};
|
|
287
|
+
const Config$m = {
|
|
247
288
|
type: "RichText",
|
|
248
289
|
label: "Rich Text",
|
|
249
290
|
category: "core",
|
|
250
|
-
icon:
|
|
291
|
+
icon: CursorTextIcon,
|
|
251
292
|
group: "typography",
|
|
252
|
-
...
|
|
293
|
+
...registerChaiBlockSchema({
|
|
253
294
|
properties: {
|
|
254
|
-
styles:
|
|
295
|
+
styles: StylesProp(""),
|
|
255
296
|
content: {
|
|
256
297
|
type: "string",
|
|
257
298
|
title: "Content",
|
|
@@ -262,46 +303,52 @@ const v = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ i("div",
|
|
|
262
303
|
}),
|
|
263
304
|
aiProps: ["content"],
|
|
264
305
|
i18nProps: ["content"]
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
306
|
+
};
|
|
307
|
+
const SpanBlock = (props) => {
|
|
308
|
+
const { blockProps, styles, content, children = null, tag } = props;
|
|
309
|
+
if (children) return React.createElement("span", { ...styles, ...blockProps }, children);
|
|
310
|
+
return React.createElement(tag || "span", {
|
|
311
|
+
...styles,
|
|
312
|
+
...blockProps,
|
|
313
|
+
dangerouslySetInnerHTML: { __html: content || "" }
|
|
271
314
|
});
|
|
272
|
-
}
|
|
315
|
+
};
|
|
316
|
+
const Config$l = {
|
|
273
317
|
type: "Span",
|
|
274
318
|
label: "Span",
|
|
275
319
|
category: "core",
|
|
276
320
|
group: "typography",
|
|
277
|
-
...
|
|
321
|
+
...registerChaiBlockSchema({
|
|
278
322
|
properties: {
|
|
279
|
-
styles:
|
|
323
|
+
styles: StylesProp(""),
|
|
280
324
|
content: {
|
|
281
325
|
type: "string",
|
|
282
326
|
title: "Content",
|
|
283
327
|
default: "",
|
|
284
|
-
ui: { "ui:widget": "textarea", "ui:autosize":
|
|
328
|
+
ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 3 }
|
|
285
329
|
}
|
|
286
330
|
}
|
|
287
331
|
}),
|
|
288
332
|
aiProps: ["content"],
|
|
289
333
|
i18nProps: ["content"],
|
|
290
|
-
canAcceptBlock: () =>
|
|
334
|
+
canAcceptBlock: () => true
|
|
291
335
|
};
|
|
292
|
-
function
|
|
293
|
-
return
|
|
336
|
+
function DiJavascript(props) {
|
|
337
|
+
return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 32 32" }, "child": [{ "tag": "path", "attr": { "d": "M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z" }, "child": [] }] })(props);
|
|
294
338
|
}
|
|
295
|
-
const
|
|
296
|
-
const { scripts
|
|
297
|
-
|
|
298
|
-
|
|
339
|
+
const CustomScript = (props) => {
|
|
340
|
+
const { scripts, inBuilder, blockProps } = props;
|
|
341
|
+
if (inBuilder)
|
|
342
|
+
return /* @__PURE__ */ jsx("div", { ...blockProps, children: /* @__PURE__ */ jsx("div", { className: cn("pointer-events-none flex flex-col items-center justify-center p-2", ""), children: /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800", children: /* @__PURE__ */ jsx("p", { className: "text-left text-xs text-gray-400", children: "Scripts will be only executed in preview and live mode. Place your script at the bottom of the" }) }) }) });
|
|
343
|
+
return /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: scripts } });
|
|
344
|
+
};
|
|
345
|
+
const Config$k = {
|
|
299
346
|
type: "CustomScript",
|
|
300
347
|
label: "web_blocks.custom_script",
|
|
301
348
|
category: "core",
|
|
302
|
-
icon:
|
|
349
|
+
icon: DiJavascript,
|
|
303
350
|
group: "advanced",
|
|
304
|
-
...
|
|
351
|
+
...registerChaiBlockSchema({
|
|
305
352
|
properties: {
|
|
306
353
|
scripts: {
|
|
307
354
|
type: "string",
|
|
@@ -312,43 +359,50 @@ const Le = (e) => {
|
|
|
312
359
|
}
|
|
313
360
|
}
|
|
314
361
|
})
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
362
|
+
};
|
|
363
|
+
const DividerBlock = (props) => {
|
|
364
|
+
const { blockProps, styles } = props;
|
|
365
|
+
return createElement("hr", { ...styles, ...blockProps });
|
|
366
|
+
};
|
|
367
|
+
const Config$j = {
|
|
319
368
|
type: "Divider",
|
|
320
369
|
label: "web_blocks.divider",
|
|
321
370
|
category: "core",
|
|
322
|
-
icon:
|
|
371
|
+
icon: DividerHorizontalIcon,
|
|
323
372
|
group: "basic",
|
|
324
|
-
...
|
|
373
|
+
...registerChaiBlockSchema({
|
|
325
374
|
properties: {
|
|
326
|
-
styles:
|
|
375
|
+
styles: StylesProp("bg-gray-900 h-0.5 py-2 my-1")
|
|
327
376
|
}
|
|
328
377
|
})
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
378
|
+
};
|
|
379
|
+
const Component$1 = (props) => {
|
|
380
|
+
const { blockProps, inBuilder, children, globalBlock } = props;
|
|
381
|
+
if (inBuilder && !globalBlock) {
|
|
382
|
+
return /* @__PURE__ */ jsxs(
|
|
383
|
+
"div",
|
|
384
|
+
{
|
|
385
|
+
className: "flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",
|
|
386
|
+
...blockProps,
|
|
387
|
+
children: [
|
|
388
|
+
/* @__PURE__ */ jsxs("h1", { children: [
|
|
389
|
+
"Global Block - ",
|
|
390
|
+
globalBlock
|
|
391
|
+
] }),
|
|
392
|
+
/* @__PURE__ */ jsx("p", { children: "Choose a block from the sidebar to add it to this page." })
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
return React.createElement("span", { ...blockProps }, children);
|
|
398
|
+
};
|
|
399
|
+
const Config$i = {
|
|
346
400
|
type: "GlobalBlock",
|
|
347
401
|
label: "Global Block",
|
|
348
|
-
icon:
|
|
402
|
+
icon: GlobeIcon,
|
|
349
403
|
category: "core",
|
|
350
404
|
group: "basic",
|
|
351
|
-
...
|
|
405
|
+
...registerChaiBlockSchema({
|
|
352
406
|
properties: {
|
|
353
407
|
globalBlock: {
|
|
354
408
|
type: "string",
|
|
@@ -358,33 +412,37 @@ const Le = (e) => {
|
|
|
358
412
|
}
|
|
359
413
|
}
|
|
360
414
|
})
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
415
|
+
};
|
|
416
|
+
const IconBlock = (props) => {
|
|
417
|
+
const { blockProps, icon, styles, width, inBuilder, height } = props;
|
|
418
|
+
const iStyles = addForcedClasses(styles, "");
|
|
419
|
+
if (isEmpty(icon)) {
|
|
420
|
+
return /* @__PURE__ */ jsx(EmptySlot, { inBuilder, className: "h-8 w-14" });
|
|
421
|
+
}
|
|
422
|
+
const svg = icon.replace(/<svg /g, '<svg class="w-[inherit] h-[inherit]" ');
|
|
423
|
+
return React.createElement("span", {
|
|
424
|
+
...blockProps,
|
|
425
|
+
...iStyles,
|
|
369
426
|
style: {
|
|
370
|
-
width:
|
|
371
|
-
height:
|
|
427
|
+
width: width ? `${width}px` : "auto",
|
|
428
|
+
height: height ? `${height}px` : "auto"
|
|
372
429
|
},
|
|
373
|
-
dangerouslySetInnerHTML: { __html:
|
|
430
|
+
dangerouslySetInnerHTML: { __html: svg }
|
|
374
431
|
});
|
|
375
|
-
}
|
|
432
|
+
};
|
|
433
|
+
const Config$h = {
|
|
376
434
|
type: "Icon",
|
|
377
435
|
label: "web_blocks.icon",
|
|
378
436
|
category: "core",
|
|
379
|
-
icon:
|
|
437
|
+
icon: SketchLogoIcon,
|
|
380
438
|
group: "media",
|
|
381
|
-
...
|
|
439
|
+
...registerChaiBlockSchema({
|
|
382
440
|
properties: {
|
|
383
|
-
styles:
|
|
441
|
+
styles: StylesProp(""),
|
|
384
442
|
icon: {
|
|
385
443
|
type: "string",
|
|
386
444
|
title: "Icon",
|
|
387
|
-
default:
|
|
445
|
+
default: `<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>`,
|
|
388
446
|
ui: { "ui:widget": "icon" }
|
|
389
447
|
},
|
|
390
448
|
width: {
|
|
@@ -399,32 +457,35 @@ const Le = (e) => {
|
|
|
399
457
|
}
|
|
400
458
|
}
|
|
401
459
|
})
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
460
|
+
};
|
|
461
|
+
const ImageBlock = (props) => {
|
|
462
|
+
const { blockProps, image, mobileImage, styles, alt, height, width, lazyLoading } = props;
|
|
463
|
+
if (isEmpty(image)) return /* @__PURE__ */ jsx(EmptySlot, { className: "h-36" });
|
|
464
|
+
return /* @__PURE__ */ jsxs("picture", { children: [
|
|
465
|
+
mobileImage && /* @__PURE__ */ jsx("source", { srcSet: mobileImage, media: "(max-width: 480px)" }),
|
|
466
|
+
/* @__PURE__ */ jsx(
|
|
407
467
|
"img",
|
|
408
468
|
{
|
|
409
|
-
...
|
|
410
|
-
...
|
|
411
|
-
src:
|
|
412
|
-
alt
|
|
413
|
-
loading:
|
|
414
|
-
width
|
|
415
|
-
height
|
|
469
|
+
...blockProps,
|
|
470
|
+
...styles,
|
|
471
|
+
src: image,
|
|
472
|
+
alt,
|
|
473
|
+
loading: lazyLoading ? "lazy" : "eager",
|
|
474
|
+
width,
|
|
475
|
+
height
|
|
416
476
|
}
|
|
417
477
|
)
|
|
418
478
|
] });
|
|
419
|
-
}
|
|
479
|
+
};
|
|
480
|
+
const Config$g = {
|
|
420
481
|
type: "Image",
|
|
421
482
|
label: "Image",
|
|
422
483
|
category: "core",
|
|
423
|
-
icon:
|
|
484
|
+
icon: ImageIcon,
|
|
424
485
|
group: "media",
|
|
425
|
-
...
|
|
486
|
+
...registerChaiBlockSchema({
|
|
426
487
|
properties: {
|
|
427
|
-
styles:
|
|
488
|
+
styles: StylesProp(""),
|
|
428
489
|
image: {
|
|
429
490
|
type: "string",
|
|
430
491
|
title: "Image",
|
|
@@ -440,7 +501,7 @@ const Le = (e) => {
|
|
|
440
501
|
lazyLoading: {
|
|
441
502
|
type: "boolean",
|
|
442
503
|
title: "Lazy Load",
|
|
443
|
-
default:
|
|
504
|
+
default: true
|
|
444
505
|
},
|
|
445
506
|
width: {
|
|
446
507
|
type: "number",
|
|
@@ -464,34 +525,52 @@ const Le = (e) => {
|
|
|
464
525
|
}),
|
|
465
526
|
aiProps: ["alt"],
|
|
466
527
|
i18nProps: ["alt"]
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
528
|
+
};
|
|
529
|
+
const LightBoxLinkBlock = (props) => {
|
|
530
|
+
const { blockProps, children, styles, inBuilder, content, href } = props;
|
|
531
|
+
const { hrefType, autoplay, maxWidth, backdropColor, galleryName } = props;
|
|
532
|
+
const forcedStyles = addForcedClasses(styles, "cb-lightbox vbox-item");
|
|
533
|
+
if (!children && isEmpty(styles == null ? void 0 : styles.className) && isEmpty(content)) {
|
|
534
|
+
return /* @__PURE__ */ jsx(EmptySlot, { inBuilder });
|
|
535
|
+
}
|
|
536
|
+
if (inBuilder) {
|
|
537
|
+
if (children) {
|
|
538
|
+
return /* @__PURE__ */ jsx("span", { ...blockProps, ...forcedStyles, children });
|
|
539
|
+
} else {
|
|
540
|
+
return createElement("span", {
|
|
541
|
+
...blockProps,
|
|
542
|
+
...forcedStyles,
|
|
543
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
const lightBoxAttrs = {};
|
|
548
|
+
if (hrefType !== "image") lightBoxAttrs["data-vbtype"] = hrefType;
|
|
549
|
+
if (autoplay) lightBoxAttrs["data-autoplay"] = "true";
|
|
550
|
+
if (maxWidth) lightBoxAttrs["data-maxwidth"] = maxWidth + "px";
|
|
551
|
+
if (backdropColor) lightBoxAttrs["data-overlay"] = backdropColor;
|
|
552
|
+
if (galleryName) lightBoxAttrs["data-gall"] = galleryName;
|
|
553
|
+
if (children) {
|
|
554
|
+
return /* @__PURE__ */ jsx("a", { "aria-label": content, ...lightBoxAttrs, href: href || "#/", ...blockProps, ...forcedStyles, children });
|
|
555
|
+
}
|
|
556
|
+
return createElement("a", {
|
|
557
|
+
...blockProps,
|
|
558
|
+
...forcedStyles,
|
|
559
|
+
...lightBoxAttrs,
|
|
560
|
+
href: href || "#",
|
|
561
|
+
dangerouslySetInnerHTML: { __html: content },
|
|
562
|
+
"aria-label": content
|
|
485
563
|
});
|
|
486
|
-
}
|
|
564
|
+
};
|
|
565
|
+
const Config$f = {
|
|
487
566
|
type: "LightBoxLink",
|
|
488
567
|
label: "Lightbox Link",
|
|
489
568
|
category: "core",
|
|
490
|
-
icon:
|
|
569
|
+
icon: ImageIcon,
|
|
491
570
|
group: "basic",
|
|
492
|
-
...
|
|
571
|
+
...registerChaiBlockSchema({
|
|
493
572
|
properties: {
|
|
494
|
-
styles:
|
|
573
|
+
styles: StylesProp(""),
|
|
495
574
|
content: {
|
|
496
575
|
type: "string",
|
|
497
576
|
title: "Content",
|
|
@@ -512,7 +591,7 @@ const Le = (e) => {
|
|
|
512
591
|
autoplay: {
|
|
513
592
|
type: "boolean",
|
|
514
593
|
title: "Autoplay (Video only)",
|
|
515
|
-
default:
|
|
594
|
+
default: false
|
|
516
595
|
},
|
|
517
596
|
maxWidth: {
|
|
518
597
|
type: "number",
|
|
@@ -536,38 +615,53 @@ const Le = (e) => {
|
|
|
536
615
|
}),
|
|
537
616
|
i18nProps: ["content"],
|
|
538
617
|
aiProps: ["content"],
|
|
539
|
-
canAcceptBlock: (
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
{
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
618
|
+
canAcceptBlock: (type) => type !== "Link" && type !== "LightBoxLink"
|
|
619
|
+
};
|
|
620
|
+
const LinkBlock = (props) => {
|
|
621
|
+
const { blockProps, link, children, styles, inBuilder, content } = props;
|
|
622
|
+
let emptyStyles = {};
|
|
623
|
+
if (!children && isEmpty(content)) {
|
|
624
|
+
emptyStyles = { minHeight: "50px", display: "flex", alignItems: "center", justifyContent: "center" };
|
|
625
|
+
}
|
|
626
|
+
if (inBuilder) {
|
|
627
|
+
if (children) {
|
|
628
|
+
return /* @__PURE__ */ jsx("span", { ...blockProps, style: emptyStyles, ...styles, children });
|
|
629
|
+
} else {
|
|
630
|
+
return createElement(
|
|
631
|
+
"span",
|
|
632
|
+
{
|
|
633
|
+
...blockProps,
|
|
634
|
+
...styles,
|
|
635
|
+
style: emptyStyles
|
|
636
|
+
},
|
|
637
|
+
content
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
if (children) {
|
|
642
|
+
return /* @__PURE__ */ jsx("a", { "aria-label": content, href: (link == null ? void 0 : link.href) || "#/", target: link == null ? void 0 : link.target, ...blockProps, ...styles, children });
|
|
643
|
+
}
|
|
644
|
+
return createElement(
|
|
552
645
|
"a",
|
|
553
646
|
{
|
|
554
|
-
...
|
|
555
|
-
...
|
|
556
|
-
href: (
|
|
557
|
-
target: (
|
|
558
|
-
"aria-label":
|
|
647
|
+
...blockProps,
|
|
648
|
+
...styles,
|
|
649
|
+
href: (link == null ? void 0 : link.href) || "#",
|
|
650
|
+
target: (link == null ? void 0 : link.target) || "_self",
|
|
651
|
+
"aria-label": content
|
|
559
652
|
},
|
|
560
|
-
|
|
653
|
+
content
|
|
561
654
|
);
|
|
562
|
-
}
|
|
655
|
+
};
|
|
656
|
+
const Config$e = {
|
|
563
657
|
type: "Link",
|
|
564
658
|
label: "Link",
|
|
565
659
|
category: "core",
|
|
566
|
-
icon:
|
|
660
|
+
icon: Link1Icon,
|
|
567
661
|
group: "basic",
|
|
568
|
-
...
|
|
662
|
+
...registerChaiBlockSchema({
|
|
569
663
|
properties: {
|
|
570
|
-
styles:
|
|
664
|
+
styles: StylesProp(""),
|
|
571
665
|
content: {
|
|
572
666
|
type: "string",
|
|
573
667
|
default: "Link goes here",
|
|
@@ -593,23 +687,29 @@ const Le = (e) => {
|
|
|
593
687
|
}),
|
|
594
688
|
aiProps: ["content"],
|
|
595
689
|
i18nProps: ["content"],
|
|
596
|
-
canAcceptBlock: (
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
690
|
+
canAcceptBlock: (type) => type !== "Link"
|
|
691
|
+
};
|
|
692
|
+
const ListBlock = (props) => {
|
|
693
|
+
const { blockProps, children, listType, styles, tag, inBuilder } = props;
|
|
694
|
+
const className = cn(get(styles, "className", ""), listType);
|
|
695
|
+
if (!children && isEmpty(styles == null ? void 0 : styles.className)) {
|
|
696
|
+
return /* @__PURE__ */ jsx(EmptySlot, { inBuilder });
|
|
697
|
+
}
|
|
698
|
+
return React.createElement(
|
|
699
|
+
tag ? tag : listType === "list-decimal" ? "ol" : "ul",
|
|
700
|
+
{ ...blockProps, ...styles, className },
|
|
701
|
+
children
|
|
603
702
|
);
|
|
604
|
-
}
|
|
703
|
+
};
|
|
704
|
+
const Config$d = {
|
|
605
705
|
type: "List",
|
|
606
706
|
label: "web_blocks.list",
|
|
607
|
-
icon:
|
|
707
|
+
icon: RowsIcon,
|
|
608
708
|
category: "core",
|
|
609
709
|
group: "basic",
|
|
610
|
-
...
|
|
710
|
+
...registerChaiBlockSchema({
|
|
611
711
|
properties: {
|
|
612
|
-
styles:
|
|
712
|
+
styles: StylesProp(""),
|
|
613
713
|
listType: {
|
|
614
714
|
type: "string",
|
|
615
715
|
title: "List Type",
|
|
@@ -622,7 +722,7 @@ const Le = (e) => {
|
|
|
622
722
|
}
|
|
623
723
|
}
|
|
624
724
|
}),
|
|
625
|
-
canAcceptBlock: (
|
|
725
|
+
canAcceptBlock: (blockType) => blockType === "ListItem",
|
|
626
726
|
blocks: [
|
|
627
727
|
{ _type: "List", _id: "a", listType: "list-none", styles: "#styles:," },
|
|
628
728
|
{
|
|
@@ -647,22 +747,27 @@ const Le = (e) => {
|
|
|
647
747
|
content: "Item 3"
|
|
648
748
|
}
|
|
649
749
|
]
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
750
|
+
};
|
|
751
|
+
const ListItemBlock = (props) => {
|
|
752
|
+
const { blockProps, content, styles, children, tag } = props;
|
|
753
|
+
if (!children) {
|
|
754
|
+
return React.createElement(tag || "li", {
|
|
755
|
+
...styles,
|
|
756
|
+
...blockProps,
|
|
757
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
return React.createElement(tag || "li", { ...styles, ...blockProps }, children);
|
|
761
|
+
};
|
|
762
|
+
const Config$c = {
|
|
658
763
|
type: "ListItem",
|
|
659
764
|
label: "List Item",
|
|
660
|
-
icon:
|
|
765
|
+
icon: ColumnsIcon,
|
|
661
766
|
category: "core",
|
|
662
767
|
group: "basic",
|
|
663
|
-
...
|
|
768
|
+
...registerChaiBlockSchema({
|
|
664
769
|
properties: {
|
|
665
|
-
styles:
|
|
770
|
+
styles: StylesProp(""),
|
|
666
771
|
content: {
|
|
667
772
|
type: "string",
|
|
668
773
|
default: "List item",
|
|
@@ -675,18 +780,25 @@ const Le = (e) => {
|
|
|
675
780
|
}),
|
|
676
781
|
i18nProps: ["content"],
|
|
677
782
|
aiProps: ["content"],
|
|
678
|
-
canAcceptBlock: (
|
|
679
|
-
canBeNested: (
|
|
680
|
-
}
|
|
783
|
+
canAcceptBlock: (type) => type !== "ListItem",
|
|
784
|
+
canBeNested: (type) => type === "List"
|
|
785
|
+
};
|
|
786
|
+
const RawTextBlock = (props) => {
|
|
787
|
+
if (props.inBuilder || props.forceWrapper) {
|
|
788
|
+
return /* @__PURE__ */ jsx("span", { ...props.blockProps, children: props.content });
|
|
789
|
+
}
|
|
790
|
+
return `${props.content}`;
|
|
791
|
+
};
|
|
792
|
+
const Config$b = {
|
|
681
793
|
type: "Text",
|
|
682
794
|
label: "Text",
|
|
683
|
-
hidden:
|
|
795
|
+
hidden: true,
|
|
684
796
|
category: "core",
|
|
685
797
|
group: "typography",
|
|
686
|
-
icon:
|
|
687
|
-
...
|
|
798
|
+
icon: SpaceBetweenVerticallyIcon,
|
|
799
|
+
...registerChaiBlockSchema({
|
|
688
800
|
properties: {
|
|
689
|
-
styles:
|
|
801
|
+
styles: StylesProp("text-black"),
|
|
690
802
|
content: {
|
|
691
803
|
type: "string",
|
|
692
804
|
default: ""
|
|
@@ -695,60 +807,88 @@ const Le = (e) => {
|
|
|
695
807
|
}),
|
|
696
808
|
aiProps: ["content"],
|
|
697
809
|
i18nProps: ["content"]
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
810
|
+
};
|
|
811
|
+
const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/;
|
|
812
|
+
const VIMEO_REGEX = /^(https?:\/\/)?(www\.)?player.vimeo\.com/;
|
|
813
|
+
const DAILYMOTION_REGEX = /^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/;
|
|
814
|
+
const getEmbedURL = (url) => {
|
|
815
|
+
if (YOUTUBE_REGEX.test(url)) {
|
|
816
|
+
const match = url.match(YOUTUBE_REGEX);
|
|
817
|
+
if (match) {
|
|
818
|
+
const videoId = match[4];
|
|
819
|
+
return `https://www.youtube.com/embed/${videoId}`;
|
|
820
|
+
}
|
|
821
|
+
return url;
|
|
702
822
|
}
|
|
703
|
-
if (
|
|
704
|
-
const
|
|
705
|
-
|
|
823
|
+
if (VIMEO_REGEX.test(url)) {
|
|
824
|
+
const match = url.match(VIMEO_REGEX);
|
|
825
|
+
if (match) {
|
|
826
|
+
const videoId = match[3];
|
|
827
|
+
return `https://player.vimeo.com/video/${videoId}`;
|
|
828
|
+
}
|
|
829
|
+
return url;
|
|
706
830
|
}
|
|
707
|
-
if (
|
|
708
|
-
const
|
|
709
|
-
|
|
831
|
+
if (DAILYMOTION_REGEX.test(url)) {
|
|
832
|
+
const match = url.match(DAILYMOTION_REGEX);
|
|
833
|
+
if (match) {
|
|
834
|
+
const videoId = match[4];
|
|
835
|
+
return `https://www.dailymotion.com/embed/video/${videoId}`;
|
|
836
|
+
}
|
|
837
|
+
return url;
|
|
710
838
|
}
|
|
711
839
|
return null;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
840
|
+
};
|
|
841
|
+
const VideoBlock = React.memo((props) => {
|
|
842
|
+
const { blockProps, inBuilder, styles, url, controls } = props;
|
|
843
|
+
const autoplay = get(controls, "autoPlay", false);
|
|
844
|
+
const _controls = get(controls, "controls", false);
|
|
845
|
+
const muted = autoplay || get(controls, "muted", true);
|
|
846
|
+
const loop = get(controls, "loop", false);
|
|
847
|
+
if (isEmpty(url)) return /* @__PURE__ */ jsx(EmptySlot, { inBuilder, className: "h-36" });
|
|
848
|
+
let embedURL = getEmbedURL(url);
|
|
849
|
+
let videoElement = null;
|
|
850
|
+
if (embedURL) {
|
|
851
|
+
if (!isEmpty(embedURL)) {
|
|
852
|
+
const iframeControls = [];
|
|
853
|
+
iframeControls.push(`autoplay=${autoplay ? 1 : 0}`);
|
|
854
|
+
iframeControls.push(`controls=${controls ? 1 : 0}`);
|
|
855
|
+
iframeControls.push(`mute=${muted ? 1 : 0}&muted=${muted ? 1 : 0}`);
|
|
856
|
+
iframeControls.push(`loop=${loop ? 1 : 0}`);
|
|
857
|
+
embedURL = `${embedURL}?${iframeControls.join("&")}`;
|
|
720
858
|
}
|
|
721
|
-
|
|
722
|
-
...
|
|
859
|
+
videoElement = React.createElement("iframe", {
|
|
860
|
+
...blockProps,
|
|
723
861
|
className: "absolute inset-0 w-full h-full",
|
|
724
|
-
src:
|
|
725
|
-
allow:
|
|
726
|
-
allowFullScreen:
|
|
862
|
+
src: embedURL,
|
|
863
|
+
allow: inBuilder ? "" : "autoplay *; fullscreen *",
|
|
864
|
+
allowFullScreen: true,
|
|
727
865
|
frameBorder: 0
|
|
728
866
|
});
|
|
729
|
-
} else
|
|
730
|
-
|
|
731
|
-
...
|
|
867
|
+
} else {
|
|
868
|
+
videoElement = React.createElement("video", {
|
|
869
|
+
...blockProps,
|
|
732
870
|
className: "absolute inset-0 w-full h-full",
|
|
733
|
-
src:
|
|
734
|
-
controls:
|
|
735
|
-
muted
|
|
736
|
-
autoPlay:
|
|
737
|
-
loop
|
|
871
|
+
src: url,
|
|
872
|
+
controls: _controls,
|
|
873
|
+
muted,
|
|
874
|
+
autoPlay: inBuilder ? false : autoplay,
|
|
875
|
+
loop
|
|
738
876
|
});
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
877
|
+
}
|
|
878
|
+
return /* @__PURE__ */ jsx("div", { ...pick(styles, ["className"]), children: /* @__PURE__ */ jsxs("div", { className: "relative w-full overflow-hidden", style: { paddingBottom: "56.25%" }, children: [
|
|
879
|
+
inBuilder ? /* @__PURE__ */ jsx("div", { ...blockProps, ...omit(styles, ["className"]), className: "absolute inset-0 z-20 h-full w-full" }) : null,
|
|
880
|
+
videoElement
|
|
742
881
|
] }) });
|
|
743
|
-
})
|
|
882
|
+
});
|
|
883
|
+
const Config$a = {
|
|
744
884
|
type: "Video",
|
|
745
885
|
label: "Video",
|
|
746
886
|
category: "core",
|
|
747
|
-
icon:
|
|
887
|
+
icon: VideoIcon,
|
|
748
888
|
group: "media",
|
|
749
|
-
...
|
|
889
|
+
...registerChaiBlockSchema({
|
|
750
890
|
properties: {
|
|
751
|
-
styles:
|
|
891
|
+
styles: StylesProp(""),
|
|
752
892
|
url: {
|
|
753
893
|
type: "string",
|
|
754
894
|
title: "Video URL",
|
|
@@ -758,74 +898,79 @@ const Le = (e) => {
|
|
|
758
898
|
type: "object",
|
|
759
899
|
title: "Controls",
|
|
760
900
|
default: {
|
|
761
|
-
autoplay:
|
|
762
|
-
controls:
|
|
763
|
-
loop:
|
|
764
|
-
muted:
|
|
901
|
+
autoplay: false,
|
|
902
|
+
controls: true,
|
|
903
|
+
loop: false,
|
|
904
|
+
muted: false
|
|
765
905
|
},
|
|
766
906
|
properties: {
|
|
767
907
|
autoplay: {
|
|
768
908
|
type: "boolean",
|
|
769
909
|
title: "Autoplay",
|
|
770
|
-
default:
|
|
910
|
+
default: false
|
|
771
911
|
},
|
|
772
912
|
controls: {
|
|
773
913
|
type: "boolean",
|
|
774
914
|
title: "Show Controls",
|
|
775
|
-
default:
|
|
915
|
+
default: true
|
|
776
916
|
},
|
|
777
917
|
loop: {
|
|
778
918
|
type: "boolean",
|
|
779
919
|
title: "Loop Video",
|
|
780
|
-
default:
|
|
920
|
+
default: false
|
|
781
921
|
},
|
|
782
922
|
muted: {
|
|
783
923
|
type: "boolean",
|
|
784
924
|
title: "Muted",
|
|
785
|
-
default:
|
|
925
|
+
default: false
|
|
786
926
|
}
|
|
787
927
|
}
|
|
788
928
|
}
|
|
789
929
|
}
|
|
790
930
|
}),
|
|
791
931
|
i18nProps: ["url"]
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
932
|
+
};
|
|
933
|
+
const CheckboxBlock = (props) => {
|
|
934
|
+
const { blockProps, fieldName, label, styles, inputStyles, required, checked, showLabel = true } = props;
|
|
935
|
+
const fieldId = generateUUID();
|
|
936
|
+
if (!showLabel)
|
|
937
|
+
return /* @__PURE__ */ jsx(
|
|
796
938
|
"input",
|
|
797
939
|
{
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
940
|
+
id: fieldId,
|
|
941
|
+
...blockProps,
|
|
942
|
+
...inputStyles,
|
|
943
|
+
...styles,
|
|
801
944
|
type: "checkbox",
|
|
802
|
-
required
|
|
803
|
-
|
|
945
|
+
required,
|
|
946
|
+
name: fieldName
|
|
947
|
+
}
|
|
948
|
+
);
|
|
949
|
+
return /* @__PURE__ */ jsxs("div", { ...styles, ...blockProps, children: [
|
|
950
|
+
/* @__PURE__ */ jsx(
|
|
951
|
+
"input",
|
|
952
|
+
{
|
|
953
|
+
...inputStyles,
|
|
954
|
+
name: fieldName,
|
|
955
|
+
id: fieldId,
|
|
956
|
+
type: "checkbox",
|
|
957
|
+
required,
|
|
958
|
+
defaultChecked: checked
|
|
804
959
|
}
|
|
805
960
|
),
|
|
806
|
-
|
|
807
|
-
] })
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
id: y,
|
|
811
|
-
...l,
|
|
812
|
-
...r,
|
|
813
|
-
...o,
|
|
814
|
-
type: "checkbox",
|
|
815
|
-
required: s,
|
|
816
|
-
name: t
|
|
817
|
-
}
|
|
818
|
-
);
|
|
819
|
-
}, Oe = {
|
|
961
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: fieldId, children: label })
|
|
962
|
+
] });
|
|
963
|
+
};
|
|
964
|
+
const Config$9 = {
|
|
820
965
|
type: "Checkbox",
|
|
821
966
|
label: "web_blocks.checkbox",
|
|
822
967
|
category: "core",
|
|
823
|
-
icon:
|
|
968
|
+
icon: CheckboxIcon,
|
|
824
969
|
group: "form",
|
|
825
|
-
...
|
|
970
|
+
...registerChaiBlockSchema({
|
|
826
971
|
properties: {
|
|
827
|
-
styles:
|
|
828
|
-
inputStyles:
|
|
972
|
+
styles: StylesProp("flex items-center gap-x-2"),
|
|
973
|
+
inputStyles: StylesProp(""),
|
|
829
974
|
fieldName: {
|
|
830
975
|
type: "string",
|
|
831
976
|
title: "Field Name",
|
|
@@ -839,52 +984,59 @@ const Le = (e) => {
|
|
|
839
984
|
checked: {
|
|
840
985
|
type: "boolean",
|
|
841
986
|
title: "Checked",
|
|
842
|
-
default:
|
|
987
|
+
default: false
|
|
843
988
|
},
|
|
844
989
|
required: {
|
|
845
990
|
type: "boolean",
|
|
846
991
|
title: "Required",
|
|
847
|
-
default:
|
|
992
|
+
default: false
|
|
848
993
|
},
|
|
849
994
|
showLabel: {
|
|
850
995
|
type: "boolean",
|
|
851
996
|
title: "Show Label",
|
|
852
|
-
default:
|
|
997
|
+
default: true
|
|
853
998
|
}
|
|
854
999
|
}
|
|
855
1000
|
}),
|
|
856
1001
|
aiProps: ["label"],
|
|
857
1002
|
i18nProps: ["label"]
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1003
|
+
};
|
|
1004
|
+
const FormBlock = (props) => {
|
|
1005
|
+
const { children, blockProps, errorMessage, successMessage, action, styles, inBuilder } = props;
|
|
1006
|
+
let nestedChildren = children;
|
|
1007
|
+
if (!children) {
|
|
1008
|
+
nestedChildren = /* @__PURE__ */ jsx(EmptySlot, { inBuilder });
|
|
1009
|
+
}
|
|
1010
|
+
const alpineAttrs = {
|
|
1011
|
+
"x-data": "{}",
|
|
1012
|
+
"x-on:submit.prevent": "post"
|
|
1013
|
+
};
|
|
1014
|
+
const formResponseAttr = {
|
|
1015
|
+
"x-html": "",
|
|
1016
|
+
":class": "{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"
|
|
1017
|
+
};
|
|
1018
|
+
return /* @__PURE__ */ jsxs(
|
|
862
1019
|
"form",
|
|
863
1020
|
{
|
|
864
|
-
...
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
},
|
|
868
|
-
"data-error": n,
|
|
869
|
-
"data-success": o,
|
|
1021
|
+
...alpineAttrs,
|
|
1022
|
+
"data-error": errorMessage,
|
|
1023
|
+
"data-success": successMessage,
|
|
870
1024
|
method: "post",
|
|
871
|
-
action
|
|
872
|
-
...
|
|
873
|
-
...
|
|
1025
|
+
action,
|
|
1026
|
+
...blockProps,
|
|
1027
|
+
...styles,
|
|
874
1028
|
children: [
|
|
875
|
-
/* @__PURE__ */
|
|
876
|
-
|
|
877
|
-
":class": "{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"
|
|
878
|
-
} }),
|
|
879
|
-
c
|
|
1029
|
+
/* @__PURE__ */ jsx("div", { ...formResponseAttr }),
|
|
1030
|
+
nestedChildren
|
|
880
1031
|
]
|
|
881
1032
|
}
|
|
882
1033
|
);
|
|
883
|
-
}
|
|
1034
|
+
};
|
|
1035
|
+
const Config$8 = {
|
|
884
1036
|
type: "Form",
|
|
885
1037
|
label: "Form",
|
|
886
1038
|
category: "core",
|
|
887
|
-
icon:
|
|
1039
|
+
icon: GroupIcon,
|
|
888
1040
|
group: "form",
|
|
889
1041
|
blocks: () => [
|
|
890
1042
|
{ _type: "Form", _id: "form", styles: "#styles:p-1 space-y-2," },
|
|
@@ -896,9 +1048,9 @@ const Le = (e) => {
|
|
|
896
1048
|
styles: "#styles:bg-black text-white rounded px-3 py-1,"
|
|
897
1049
|
}
|
|
898
1050
|
],
|
|
899
|
-
...
|
|
1051
|
+
...registerChaiBlockSchema({
|
|
900
1052
|
properties: {
|
|
901
|
-
styles:
|
|
1053
|
+
styles: StylesProp(""),
|
|
902
1054
|
action: {
|
|
903
1055
|
type: "string",
|
|
904
1056
|
title: "Submit URL",
|
|
@@ -920,52 +1072,56 @@ const Le = (e) => {
|
|
|
920
1072
|
}),
|
|
921
1073
|
i18nProps: ["errorMessage", "successMessage"],
|
|
922
1074
|
aiProps: ["errorMessage", "successMessage"],
|
|
923
|
-
canAcceptBlock: () =>
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
|
|
1075
|
+
canAcceptBlock: () => true
|
|
1076
|
+
};
|
|
1077
|
+
const FormButtonBlock = (props) => {
|
|
1078
|
+
const { blockProps, inBuilder, label, styles, inputStyles, icon, iconSize, iconPos } = props;
|
|
1079
|
+
const fieldId = generateUUID();
|
|
1080
|
+
const attrs = {
|
|
1081
|
+
"x-bind:disabled": "formLoading"
|
|
1082
|
+
};
|
|
1083
|
+
return /* @__PURE__ */ jsxs(
|
|
927
1084
|
"button",
|
|
928
1085
|
{
|
|
929
|
-
id:
|
|
930
|
-
...
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
...
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
type: t ? "button" : "submit",
|
|
937
|
-
"aria-label": n,
|
|
1086
|
+
id: fieldId,
|
|
1087
|
+
...attrs,
|
|
1088
|
+
...inputStyles,
|
|
1089
|
+
...styles,
|
|
1090
|
+
...blockProps || {},
|
|
1091
|
+
type: inBuilder ? "button" : "submit",
|
|
1092
|
+
"aria-label": label,
|
|
938
1093
|
children: [
|
|
939
|
-
|
|
940
|
-
|
|
1094
|
+
label,
|
|
1095
|
+
icon && /* @__PURE__ */ jsx(
|
|
941
1096
|
"div",
|
|
942
1097
|
{
|
|
943
|
-
style: { width:
|
|
944
|
-
className:
|
|
945
|
-
dangerouslySetInnerHTML: { __html:
|
|
1098
|
+
style: { width: iconSize + "px" },
|
|
1099
|
+
className: iconPos + " " + (iconPos === "order-first" ? "mr-2" : "ml-2") || "",
|
|
1100
|
+
dangerouslySetInnerHTML: { __html: icon }
|
|
946
1101
|
}
|
|
947
1102
|
)
|
|
948
1103
|
]
|
|
949
1104
|
}
|
|
950
1105
|
);
|
|
951
|
-
}
|
|
1106
|
+
};
|
|
1107
|
+
const Config$7 = {
|
|
952
1108
|
type: "FormButton",
|
|
953
1109
|
label: "Submit Button",
|
|
954
1110
|
category: "core",
|
|
955
|
-
icon:
|
|
1111
|
+
icon: ButtonIcon,
|
|
956
1112
|
group: "form",
|
|
957
|
-
...
|
|
1113
|
+
...registerChaiBlockSchema({
|
|
958
1114
|
properties: {
|
|
959
|
-
styles:
|
|
1115
|
+
styles: StylesProp(
|
|
960
1116
|
"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"
|
|
961
1117
|
),
|
|
962
|
-
inputStyles:
|
|
1118
|
+
inputStyles: StylesProp(""),
|
|
963
1119
|
label: {
|
|
964
1120
|
type: "string",
|
|
965
1121
|
title: "Label",
|
|
966
1122
|
default: "Submit",
|
|
967
|
-
ai:
|
|
968
|
-
i18n:
|
|
1123
|
+
ai: true,
|
|
1124
|
+
i18n: true
|
|
969
1125
|
},
|
|
970
1126
|
icon: {
|
|
971
1127
|
type: "string",
|
|
@@ -988,44 +1144,50 @@ const Le = (e) => {
|
|
|
988
1144
|
}),
|
|
989
1145
|
i18nProps: ["label"],
|
|
990
1146
|
aiProps: ["label"]
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1147
|
+
};
|
|
1148
|
+
const InputBlock = (props) => {
|
|
1149
|
+
const { blockProps, fieldName, label, placeholder, styles, inputStyles, showLabel, required, inputType } = props;
|
|
1150
|
+
const fieldId = generateUUID();
|
|
1151
|
+
if (!showLabel) {
|
|
1152
|
+
return /* @__PURE__ */ jsx(
|
|
996
1153
|
"input",
|
|
997
1154
|
{
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1155
|
+
id: fieldId,
|
|
1156
|
+
name: fieldName,
|
|
1157
|
+
...blockProps,
|
|
1158
|
+
...inputStyles,
|
|
1159
|
+
...styles,
|
|
1160
|
+
type: inputType,
|
|
1161
|
+
placeholder,
|
|
1162
|
+
required
|
|
1163
|
+
}
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
return /* @__PURE__ */ jsxs("div", { ...styles, ...blockProps, children: [
|
|
1167
|
+
showLabel && /* @__PURE__ */ jsx("label", { htmlFor: fieldId, children: label }),
|
|
1168
|
+
/* @__PURE__ */ jsx(
|
|
1169
|
+
"input",
|
|
1170
|
+
{
|
|
1171
|
+
name: fieldName,
|
|
1172
|
+
...inputStyles,
|
|
1173
|
+
id: fieldId,
|
|
1174
|
+
type: inputType,
|
|
1175
|
+
placeholder,
|
|
1176
|
+
required
|
|
1004
1177
|
}
|
|
1005
1178
|
)
|
|
1006
|
-
] })
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
id: g,
|
|
1010
|
-
name: t,
|
|
1011
|
-
...l,
|
|
1012
|
-
...s,
|
|
1013
|
-
...r,
|
|
1014
|
-
type: y,
|
|
1015
|
-
placeholder: o,
|
|
1016
|
-
required: c
|
|
1017
|
-
}
|
|
1018
|
-
);
|
|
1019
|
-
}, Ke = {
|
|
1179
|
+
] });
|
|
1180
|
+
};
|
|
1181
|
+
const Config$6 = {
|
|
1020
1182
|
type: "Input",
|
|
1021
1183
|
label: "web_blocks.input",
|
|
1022
1184
|
category: "core",
|
|
1023
|
-
icon:
|
|
1185
|
+
icon: InputIcon,
|
|
1024
1186
|
group: "form",
|
|
1025
|
-
...
|
|
1187
|
+
...registerChaiBlockSchema({
|
|
1026
1188
|
properties: {
|
|
1027
|
-
styles:
|
|
1028
|
-
inputStyles:
|
|
1189
|
+
styles: StylesProp(""),
|
|
1190
|
+
inputStyles: StylesProp("w-full p-1"),
|
|
1029
1191
|
fieldName: {
|
|
1030
1192
|
type: "string",
|
|
1031
1193
|
title: "Field Name",
|
|
@@ -1034,14 +1196,14 @@ const Le = (e) => {
|
|
|
1034
1196
|
showLabel: {
|
|
1035
1197
|
type: "boolean",
|
|
1036
1198
|
title: "Show Label",
|
|
1037
|
-
default:
|
|
1199
|
+
default: true
|
|
1038
1200
|
},
|
|
1039
1201
|
label: {
|
|
1040
1202
|
type: "string",
|
|
1041
1203
|
title: "Label",
|
|
1042
1204
|
default: "Label",
|
|
1043
|
-
ai:
|
|
1044
|
-
i18n:
|
|
1205
|
+
ai: true,
|
|
1206
|
+
i18n: true
|
|
1045
1207
|
},
|
|
1046
1208
|
placeholder: {
|
|
1047
1209
|
type: "string",
|
|
@@ -1051,7 +1213,7 @@ const Le = (e) => {
|
|
|
1051
1213
|
required: {
|
|
1052
1214
|
type: "boolean",
|
|
1053
1215
|
title: "Required",
|
|
1054
|
-
default:
|
|
1216
|
+
default: false
|
|
1055
1217
|
},
|
|
1056
1218
|
inputType: {
|
|
1057
1219
|
type: "string",
|
|
@@ -1076,21 +1238,25 @@ const Le = (e) => {
|
|
|
1076
1238
|
}),
|
|
1077
1239
|
aiProps: ["label", "placeholder"],
|
|
1078
1240
|
i18nProps: ["label", "placeholder"]
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1241
|
+
};
|
|
1242
|
+
const LabelBlock = (props) => {
|
|
1243
|
+
const { blockProps, content, styles, children } = props;
|
|
1244
|
+
const labelProps = { ...styles, ...blockProps };
|
|
1245
|
+
if (children) return React.createElement("label", labelProps, children);
|
|
1246
|
+
return React.createElement("label", {
|
|
1247
|
+
...labelProps,
|
|
1248
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
1084
1249
|
});
|
|
1085
|
-
}
|
|
1250
|
+
};
|
|
1251
|
+
const Config$5 = {
|
|
1086
1252
|
type: "Label",
|
|
1087
1253
|
label: "Label",
|
|
1088
1254
|
category: "core",
|
|
1089
|
-
icon:
|
|
1255
|
+
icon: LetterCaseToggleIcon,
|
|
1090
1256
|
group: "form",
|
|
1091
|
-
...
|
|
1257
|
+
...registerChaiBlockSchema({
|
|
1092
1258
|
properties: {
|
|
1093
|
-
styles:
|
|
1259
|
+
styles: StylesProp(),
|
|
1094
1260
|
content: {
|
|
1095
1261
|
type: "string",
|
|
1096
1262
|
title: "Content",
|
|
@@ -1100,34 +1266,39 @@ const Le = (e) => {
|
|
|
1100
1266
|
}),
|
|
1101
1267
|
aiProps: ["content"],
|
|
1102
1268
|
i18nProps: ["content"]
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1269
|
+
};
|
|
1270
|
+
const RadioBlock = (props) => {
|
|
1271
|
+
const { blockProps, fieldName, label, styles, inputStyles, required, checked, showLabel = true } = props;
|
|
1272
|
+
const fieldId = generateUUID();
|
|
1273
|
+
if (!showLabel)
|
|
1274
|
+
return /* @__PURE__ */ jsx(
|
|
1275
|
+
"input",
|
|
1276
|
+
{
|
|
1277
|
+
id: fieldId,
|
|
1278
|
+
...blockProps,
|
|
1279
|
+
...inputStyles,
|
|
1280
|
+
...styles,
|
|
1281
|
+
type: "radio",
|
|
1282
|
+
required,
|
|
1283
|
+
checked,
|
|
1284
|
+
name: fieldName
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1287
|
+
return /* @__PURE__ */ jsxs("div", { ...styles, ...blockProps, children: [
|
|
1288
|
+
/* @__PURE__ */ jsx("input", { ...inputStyles, name: fieldName, id: fieldId, type: "radio", required, defaultChecked: checked }),
|
|
1289
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: fieldId, children: label })
|
|
1290
|
+
] });
|
|
1291
|
+
};
|
|
1292
|
+
const Config$4 = {
|
|
1122
1293
|
type: "Radio",
|
|
1123
1294
|
label: "web_blocks.radio",
|
|
1124
1295
|
category: "core",
|
|
1125
|
-
icon:
|
|
1296
|
+
icon: RadiobuttonIcon,
|
|
1126
1297
|
group: "form",
|
|
1127
|
-
...
|
|
1298
|
+
...registerChaiBlockSchema({
|
|
1128
1299
|
properties: {
|
|
1129
|
-
styles:
|
|
1130
|
-
inputStyles:
|
|
1300
|
+
styles: StylesProp("flex items-center gap-x-2"),
|
|
1301
|
+
inputStyles: StylesProp(""),
|
|
1131
1302
|
fieldName: {
|
|
1132
1303
|
type: "string",
|
|
1133
1304
|
title: "Field Name",
|
|
@@ -1141,44 +1312,50 @@ const Le = (e) => {
|
|
|
1141
1312
|
checked: {
|
|
1142
1313
|
type: "boolean",
|
|
1143
1314
|
title: "Checked",
|
|
1144
|
-
default:
|
|
1315
|
+
default: false
|
|
1145
1316
|
},
|
|
1146
1317
|
required: {
|
|
1147
1318
|
type: "boolean",
|
|
1148
1319
|
title: "Required",
|
|
1149
|
-
default:
|
|
1320
|
+
default: false
|
|
1150
1321
|
},
|
|
1151
1322
|
showLabel: {
|
|
1152
1323
|
type: "boolean",
|
|
1153
1324
|
title: "Show Label",
|
|
1154
|
-
default:
|
|
1325
|
+
default: true
|
|
1155
1326
|
}
|
|
1156
1327
|
}
|
|
1157
1328
|
}),
|
|
1158
1329
|
aiProps: ["label"],
|
|
1159
1330
|
i18nProps: ["label"]
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1331
|
+
};
|
|
1332
|
+
const SelectBlock = (props) => {
|
|
1333
|
+
const { blockProps, fieldName, label, placeholder, styles, inputStyles, required, showLabel, _multiple, options } = props;
|
|
1334
|
+
const fieldId = generateUUID();
|
|
1335
|
+
if (!showLabel) {
|
|
1336
|
+
return /* @__PURE__ */ jsxs("select", { id: fieldId, ...styles, ...blockProps, required, multiple: _multiple, name: fieldName, children: [
|
|
1337
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, selected: true, hidden: true, children: placeholder }),
|
|
1338
|
+
map(options, (option) => /* @__PURE__ */ jsx("option", { value: option == null ? void 0 : option.value, children: option == null ? void 0 : option.label }, option == null ? void 0 : option.value))
|
|
1339
|
+
] });
|
|
1340
|
+
}
|
|
1341
|
+
return /* @__PURE__ */ jsxs("div", { ...styles, ...blockProps, children: [
|
|
1342
|
+
showLabel && /* @__PURE__ */ jsx("label", { htmlFor: fieldId, children: label }),
|
|
1343
|
+
/* @__PURE__ */ jsxs("select", { ...inputStyles, id: fieldId, required, multiple: _multiple, name: fieldName, children: [
|
|
1344
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, selected: true, hidden: true, children: placeholder }),
|
|
1345
|
+
map(options, (option) => /* @__PURE__ */ jsx("option", { value: option == null ? void 0 : option.value, children: option == null ? void 0 : option.label }, option == null ? void 0 : option.value))
|
|
1167
1346
|
] })
|
|
1168
|
-
] }) : /* @__PURE__ */ b("select", { id: k, ...r, ...l, required: a, multiple: y, name: t, children: [
|
|
1169
|
-
/* @__PURE__ */ i("option", { value: "", disabled: !0, selected: !0, hidden: !0, children: o }),
|
|
1170
|
-
P(g, (p) => /* @__PURE__ */ i("option", { value: p == null ? void 0 : p.value, children: p == null ? void 0 : p.label }, p == null ? void 0 : p.value))
|
|
1171
1347
|
] });
|
|
1172
|
-
}
|
|
1348
|
+
};
|
|
1349
|
+
const Config$3 = {
|
|
1173
1350
|
type: "Select",
|
|
1174
1351
|
label: "web_blocks.select",
|
|
1175
1352
|
category: "core",
|
|
1176
|
-
icon:
|
|
1353
|
+
icon: DropdownMenuIcon,
|
|
1177
1354
|
group: "form",
|
|
1178
|
-
...
|
|
1355
|
+
...registerChaiBlockSchema({
|
|
1179
1356
|
properties: {
|
|
1180
|
-
styles:
|
|
1181
|
-
inputStyles:
|
|
1357
|
+
styles: StylesProp(""),
|
|
1358
|
+
inputStyles: StylesProp("w-full p-1"),
|
|
1182
1359
|
fieldName: {
|
|
1183
1360
|
type: "string",
|
|
1184
1361
|
title: "Field Name",
|
|
@@ -1187,7 +1364,7 @@ const Le = (e) => {
|
|
|
1187
1364
|
showLabel: {
|
|
1188
1365
|
type: "boolean",
|
|
1189
1366
|
title: "Show Label",
|
|
1190
|
-
default:
|
|
1367
|
+
default: true
|
|
1191
1368
|
},
|
|
1192
1369
|
label: {
|
|
1193
1370
|
type: "string",
|
|
@@ -1202,12 +1379,12 @@ const Le = (e) => {
|
|
|
1202
1379
|
required: {
|
|
1203
1380
|
type: "boolean",
|
|
1204
1381
|
title: "Required",
|
|
1205
|
-
default:
|
|
1382
|
+
default: false
|
|
1206
1383
|
},
|
|
1207
1384
|
_multiple: {
|
|
1208
1385
|
type: "boolean",
|
|
1209
1386
|
title: "Multiple",
|
|
1210
|
-
default:
|
|
1387
|
+
default: false
|
|
1211
1388
|
},
|
|
1212
1389
|
options: {
|
|
1213
1390
|
title: "Options",
|
|
@@ -1233,48 +1410,54 @@ const Le = (e) => {
|
|
|
1233
1410
|
}),
|
|
1234
1411
|
aiProps: ["label", "placeholder"],
|
|
1235
1412
|
i18nProps: ["label", "placeholder"]
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
}
|
|
1413
|
+
};
|
|
1414
|
+
const TextAreaBlock = (props) => {
|
|
1415
|
+
const { blockProps, fieldName, label, placeholder, styles, inputStyles, _rows, showLabel } = props;
|
|
1416
|
+
const fieldId = generateUUID();
|
|
1417
|
+
if (!showLabel) {
|
|
1418
|
+
return /* @__PURE__ */ jsx(
|
|
1419
|
+
"textarea",
|
|
1420
|
+
{
|
|
1421
|
+
id: fieldId,
|
|
1422
|
+
name: fieldName,
|
|
1423
|
+
...blockProps,
|
|
1424
|
+
...inputStyles,
|
|
1425
|
+
...styles,
|
|
1426
|
+
placeholder,
|
|
1427
|
+
rows: _rows
|
|
1428
|
+
}
|
|
1429
|
+
);
|
|
1430
|
+
}
|
|
1431
|
+
return /* @__PURE__ */ jsxs("div", { ...styles, ...blockProps, children: [
|
|
1432
|
+
showLabel && /* @__PURE__ */ jsx("label", { htmlFor: fieldId, children: label }),
|
|
1433
|
+
/* @__PURE__ */ jsx("textarea", { name: fieldName, ...inputStyles, id: fieldId, placeholder, rows: _rows })
|
|
1434
|
+
] });
|
|
1435
|
+
};
|
|
1436
|
+
const Config$2 = {
|
|
1254
1437
|
type: "TextArea",
|
|
1255
1438
|
label: "web_blocks.textarea",
|
|
1256
1439
|
category: "core",
|
|
1257
|
-
icon:
|
|
1440
|
+
icon: InputIcon,
|
|
1258
1441
|
group: "form",
|
|
1259
|
-
...
|
|
1442
|
+
...registerChaiBlockSchema({
|
|
1260
1443
|
properties: {
|
|
1261
1444
|
fieldName: {
|
|
1262
1445
|
type: "string",
|
|
1263
1446
|
title: "Field Name",
|
|
1264
1447
|
default: "fieldName"
|
|
1265
1448
|
},
|
|
1266
|
-
styles:
|
|
1267
|
-
inputStyles:
|
|
1449
|
+
styles: StylesProp(""),
|
|
1450
|
+
inputStyles: StylesProp("w-full p-1"),
|
|
1268
1451
|
showLabel: {
|
|
1269
1452
|
type: "boolean",
|
|
1270
1453
|
title: "Show Label",
|
|
1271
|
-
default:
|
|
1454
|
+
default: true
|
|
1272
1455
|
},
|
|
1273
1456
|
label: {
|
|
1274
1457
|
type: "string",
|
|
1275
1458
|
title: "Label",
|
|
1276
1459
|
default: "Label",
|
|
1277
|
-
ui: { "ui:widget": "textarea", "ui:autosize":
|
|
1460
|
+
ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 3 }
|
|
1278
1461
|
},
|
|
1279
1462
|
placeholder: {
|
|
1280
1463
|
type: "string",
|
|
@@ -1290,25 +1473,28 @@ const Le = (e) => {
|
|
|
1290
1473
|
}),
|
|
1291
1474
|
aiProps: ["label", "placeholder"],
|
|
1292
1475
|
i18nProps: ["label", "placeholder"]
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1476
|
+
};
|
|
1477
|
+
const LineBreakBlock = (props) => {
|
|
1478
|
+
const { blockProps, styles } = props;
|
|
1479
|
+
return createElement("br", { ...blockProps, ...styles });
|
|
1480
|
+
};
|
|
1481
|
+
const Config$1 = {
|
|
1297
1482
|
type: "LineBreak",
|
|
1298
1483
|
label: "Line Break",
|
|
1299
1484
|
category: "core",
|
|
1300
1485
|
group: "basic",
|
|
1301
|
-
hidden:
|
|
1302
|
-
...
|
|
1486
|
+
hidden: true,
|
|
1487
|
+
...registerChaiBlockSchema({
|
|
1303
1488
|
properties: {
|
|
1304
|
-
styles:
|
|
1489
|
+
styles: StylesProp("")
|
|
1305
1490
|
}
|
|
1306
1491
|
}),
|
|
1307
|
-
canAcceptBlock: () =>
|
|
1308
|
-
canDelete: () =>
|
|
1309
|
-
canMove: () =>
|
|
1310
|
-
canDuplicate: () =>
|
|
1311
|
-
}
|
|
1492
|
+
canAcceptBlock: () => true,
|
|
1493
|
+
canDelete: () => false,
|
|
1494
|
+
canMove: () => false,
|
|
1495
|
+
canDuplicate: () => false
|
|
1496
|
+
};
|
|
1497
|
+
const NUMBER_TO_COL_SPAN = {
|
|
1312
1498
|
SMALL: {
|
|
1313
1499
|
1: "col-span-1",
|
|
1314
1500
|
2: "col-span-2",
|
|
@@ -1351,27 +1537,31 @@ const Le = (e) => {
|
|
|
1351
1537
|
11: "lg:col-span-11",
|
|
1352
1538
|
12: "lg:col-span-12"
|
|
1353
1539
|
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1540
|
+
};
|
|
1541
|
+
const Column = (props) => {
|
|
1542
|
+
const { blockProps, children, styles, colSpan, tabletColSpan, desktopColSpan } = props;
|
|
1543
|
+
const className = [
|
|
1544
|
+
get(styles, "className", ""),
|
|
1545
|
+
get(NUMBER_TO_COL_SPAN, ["SMALL", isNaN(colSpan) || !colSpan ? 6 : colSpan], ""),
|
|
1546
|
+
tabletColSpan ? get(NUMBER_TO_COL_SPAN, ["MEDIUM", tabletColSpan || colSpan], "") : "",
|
|
1547
|
+
desktopColSpan ? get(NUMBER_TO_COL_SPAN, ["LARGE", tabletColSpan || colSpan], "") : ""
|
|
1548
|
+
];
|
|
1549
|
+
const _styles = { className: className.join(" ") };
|
|
1550
|
+
return /* @__PURE__ */ jsx("div", { ...blockProps, ...styles, ..._styles, children: children || /* @__PURE__ */ jsx("div", { className: "h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900" }) });
|
|
1551
|
+
};
|
|
1552
|
+
const ColumnConfig = {
|
|
1363
1553
|
type: "Column",
|
|
1364
1554
|
label: "Column",
|
|
1365
1555
|
group: "basic",
|
|
1366
1556
|
category: "core",
|
|
1367
|
-
icon:
|
|
1368
|
-
wrapper:
|
|
1369
|
-
canDelete: () =>
|
|
1370
|
-
canAcceptBlock: () =>
|
|
1371
|
-
canBeNested: (
|
|
1372
|
-
...
|
|
1557
|
+
icon: Columns,
|
|
1558
|
+
wrapper: true,
|
|
1559
|
+
canDelete: () => true,
|
|
1560
|
+
canAcceptBlock: () => true,
|
|
1561
|
+
canBeNested: (type) => type === "Row",
|
|
1562
|
+
...registerChaiBlockSchema({
|
|
1373
1563
|
properties: {
|
|
1374
|
-
styles:
|
|
1564
|
+
styles: StylesProp(""),
|
|
1375
1565
|
colSpan: {
|
|
1376
1566
|
type: "number",
|
|
1377
1567
|
title: "Column Span",
|
|
@@ -1394,25 +1584,34 @@ const Le = (e) => {
|
|
|
1394
1584
|
}
|
|
1395
1585
|
}
|
|
1396
1586
|
})
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1587
|
+
};
|
|
1588
|
+
const Component = (props) => {
|
|
1589
|
+
const { blockProps, children, styles, gutter } = props;
|
|
1590
|
+
const className = [get(styles, "className", ""), " grid grid-cols-12"];
|
|
1591
|
+
const _styles = { className: className.join() };
|
|
1592
|
+
if (typeof (styles == null ? void 0 : styles.style) === "object") {
|
|
1593
|
+
styles.style.gap = `${gutter}px`;
|
|
1594
|
+
} else {
|
|
1595
|
+
_styles.style = { gap: `${gutter}px` };
|
|
1596
|
+
}
|
|
1597
|
+
return /* @__PURE__ */ jsx("div", { ...blockProps, ...styles, ..._styles, children });
|
|
1598
|
+
};
|
|
1599
|
+
const Config = {
|
|
1401
1600
|
type: "Row",
|
|
1402
1601
|
label: "Row",
|
|
1403
1602
|
group: "basic",
|
|
1404
|
-
icon:
|
|
1603
|
+
icon: Rows,
|
|
1405
1604
|
blocks: () => [
|
|
1406
1605
|
{ _type: "Row", _id: "row", styles: "#styles:,p-1" },
|
|
1407
1606
|
{ _type: "Column", id: "column", _parent: "row", styles: "#styles:," },
|
|
1408
1607
|
{ _type: "Column", id: "column", _parent: "row", styles: "#styles:," }
|
|
1409
1608
|
],
|
|
1410
1609
|
category: "core",
|
|
1411
|
-
wrapper:
|
|
1412
|
-
canAcceptBlock: (
|
|
1413
|
-
...
|
|
1610
|
+
wrapper: true,
|
|
1611
|
+
canAcceptBlock: (childType) => childType === "Column",
|
|
1612
|
+
...registerChaiBlockSchema({
|
|
1414
1613
|
properties: {
|
|
1415
|
-
styles:
|
|
1614
|
+
styles: StylesProp(""),
|
|
1416
1615
|
colCount: {
|
|
1417
1616
|
type: "number",
|
|
1418
1617
|
default: 2,
|
|
@@ -1427,9 +1626,39 @@ const Le = (e) => {
|
|
|
1427
1626
|
}
|
|
1428
1627
|
}
|
|
1429
1628
|
})
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1629
|
+
};
|
|
1630
|
+
const loadWebBlocks = () => {
|
|
1631
|
+
registerChaiBlock(Component$3, Config$s);
|
|
1632
|
+
registerChaiBlock(EmptyBox, Config$p);
|
|
1633
|
+
registerChaiBlock(Component$2, Config$r);
|
|
1634
|
+
registerChaiBlock(HeadingBlock, Config$o);
|
|
1635
|
+
registerChaiBlock(ParagraphBlock, Config$n);
|
|
1636
|
+
registerChaiBlock(SpanBlock, Config$l);
|
|
1637
|
+
registerChaiBlock(RichTextBlock, Config$m);
|
|
1638
|
+
registerChaiBlock(LinkBlock, Config$e);
|
|
1639
|
+
registerChaiBlock(LightBoxLinkBlock, Config$f);
|
|
1640
|
+
registerChaiBlock(ListBlock, Config$d);
|
|
1641
|
+
registerChaiBlock(ListItemBlock, Config$c);
|
|
1642
|
+
registerChaiBlock(IconBlock, Config$h);
|
|
1643
|
+
registerChaiBlock(ImageBlock, Config$g);
|
|
1644
|
+
registerChaiBlock(VideoBlock, Config$a);
|
|
1645
|
+
registerChaiBlock(CustomHTMLBlock, Config$q);
|
|
1646
|
+
registerChaiBlock(CustomScript, Config$k);
|
|
1647
|
+
registerChaiBlock(RawTextBlock, Config$b);
|
|
1648
|
+
registerChaiBlock(FormBlock, Config$8);
|
|
1649
|
+
registerChaiBlock(FormButtonBlock, Config$7);
|
|
1650
|
+
registerChaiBlock(InputBlock, Config$6);
|
|
1651
|
+
registerChaiBlock(CheckboxBlock, Config$9);
|
|
1652
|
+
registerChaiBlock(RadioBlock, Config$4);
|
|
1653
|
+
registerChaiBlock(SelectBlock, Config$3);
|
|
1654
|
+
registerChaiBlock(TextAreaBlock, Config$2);
|
|
1655
|
+
registerChaiBlock(LabelBlock, Config$5);
|
|
1656
|
+
registerChaiBlock(LineBreakBlock, Config$1);
|
|
1657
|
+
registerChaiBlock(DividerBlock, Config$j);
|
|
1658
|
+
registerChaiBlock(Component$1, Config$i);
|
|
1659
|
+
registerChaiBlock(Component, Config);
|
|
1660
|
+
registerChaiBlock(Column, ColumnConfig);
|
|
1432
1661
|
};
|
|
1433
1662
|
export {
|
|
1434
|
-
|
|
1663
|
+
loadWebBlocks
|
|
1435
1664
|
};
|