@chaibuilder/sdk 2.0.0-beta.9 → 2.0.0-beta.91
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/README.md +1 -3
- 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/chaibuilder-logo.png +0 -0
- package/dist/context-menu-DHla8ofZ.js +893 -0
- package/dist/context-menu-DawHUIXd.cjs +923 -0
- package/dist/core.cjs +11589 -18
- package/dist/core.d.ts +108 -47
- package/dist/core.js +9555 -6679
- 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/mockServiceWorker.js +39 -24
- package/dist/plugin-BcTnEZwx.cjs +26 -0
- package/dist/plugin-DGEKY3uC.js +27 -0
- package/dist/render.cjs +247 -2
- package/dist/render.d.ts +41 -16
- package/dist/render.js +224 -142
- package/dist/runtime.cjs +9 -1
- package/dist/runtime.d.ts +6 -1
- package/dist/runtime.js +0 -20
- package/dist/sdk.css +1341 -0
- package/dist/tailwind.cjs +78 -1
- package/dist/tailwind.d.ts +37 -26
- package/dist/tailwind.js +21 -21
- package/dist/ui.cjs +378 -1
- package/dist/ui.d.ts +12 -51
- package/dist/ui.js +262 -349
- package/dist/web-blocks.cjs +1679 -2
- package/dist/web-blocks.d.ts +6 -0
- package/dist/web-blocks.js +1502 -856
- package/package.json +135 -132
- package/dist/CodeEditor-19TqmVgI.cjs +0 -1
- package/dist/CodeEditor-b5DU6y6j.js +0 -126
- package/dist/STRINGS-Xxstm-7I.js +0 -7
- package/dist/STRINGS-Yl7cSWDc.cjs +0 -1
- package/dist/Topbar-lGFRGO4j.js +0 -73
- package/dist/Topbar-ql6BS8c6.cjs +0 -1
- package/dist/context-menu-MPtzs1fu.cjs +0 -1
- package/dist/context-menu-XEyVy2qm.js +0 -903
- package/dist/controls-lEwMTdPQ.js +0 -234
- package/dist/controls-p9IwFnPx.cjs +0 -1
- package/dist/iconBase-Ief2hJUZ.js +0 -130
- package/dist/iconBase-aZzpqff_.cjs +0 -1
- package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
- package/dist/jsx-runtime-Sp0orL4X.js +0 -631
- package/dist/plugin-Dm5EFGnP.cjs +0 -1
- package/dist/plugin-KIpT3NWi.cjs +0 -1
- package/dist/plugin-PFjzFeON.js +0 -97
- package/dist/plugin-ooqqxWRQ.js +0 -55
- package/dist/style.css +0 -6
package/dist/web-blocks.js
CHANGED
|
@@ -1,351 +1,728 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
6
|
-
import { ButtonIcon
|
|
7
|
-
import {
|
|
8
|
-
import { GlobeIcon
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
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 = {
|
|
18
26
|
type: "Box",
|
|
19
|
-
label: "
|
|
27
|
+
label: "Box",
|
|
20
28
|
category: "core",
|
|
21
29
|
group: "basic",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
...registerChaiBlockSchema({
|
|
31
|
+
properties: {
|
|
32
|
+
styles: StylesProp(""),
|
|
33
|
+
backgroundImage: {
|
|
34
|
+
type: "string",
|
|
35
|
+
default: "",
|
|
36
|
+
title: "Background Image",
|
|
37
|
+
ui: { "ui:widget": "image" }
|
|
38
|
+
},
|
|
39
|
+
tag: {
|
|
40
|
+
type: "string",
|
|
41
|
+
default: "div",
|
|
42
|
+
title: "Tag",
|
|
43
|
+
oneOf: [
|
|
44
|
+
{ const: "div", title: "div" },
|
|
45
|
+
{ const: "header", title: "header" },
|
|
46
|
+
{ const: "footer", title: "footer" },
|
|
47
|
+
{ const: "section", title: "section" },
|
|
48
|
+
{ const: "article", title: "article" },
|
|
49
|
+
{ const: "aside", title: "aside" },
|
|
50
|
+
{ const: "main", title: "main" },
|
|
51
|
+
{ const: "nav", title: "nav" },
|
|
52
|
+
{ const: "figure", title: "figure" },
|
|
53
|
+
{ const: "details", title: "details" },
|
|
54
|
+
{ const: "summary", title: "summary" },
|
|
55
|
+
{ const: "dialog", title: "dialog" },
|
|
56
|
+
{ const: "strike", title: "strike" },
|
|
57
|
+
{ const: "caption", title: "caption" },
|
|
58
|
+
{ const: "legend", title: "legend" },
|
|
59
|
+
{ const: "figcaption", title: "figcaption" },
|
|
60
|
+
{ const: "mark", title: "mark" }
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}),
|
|
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(
|
|
54
73
|
"div",
|
|
55
74
|
{
|
|
56
|
-
style: { width:
|
|
57
|
-
className:
|
|
58
|
-
dangerouslySetInnerHTML: { __html:
|
|
75
|
+
style: { width: iconSize + "px" },
|
|
76
|
+
className: iconPos + " " + (iconPos === "order-first" ? "mr-2" : "ml-2") || "",
|
|
77
|
+
dangerouslySetInnerHTML: { __html: _icon }
|
|
59
78
|
}
|
|
60
79
|
)
|
|
61
80
|
] });
|
|
62
|
-
|
|
81
|
+
const button = createElement(
|
|
63
82
|
"button",
|
|
64
83
|
{
|
|
65
|
-
...
|
|
66
|
-
...
|
|
67
|
-
type: "button"
|
|
84
|
+
...blockProps,
|
|
85
|
+
...styles,
|
|
86
|
+
type: "button",
|
|
87
|
+
"aria-label": content
|
|
68
88
|
},
|
|
69
|
-
|
|
89
|
+
child
|
|
70
90
|
);
|
|
71
|
-
|
|
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 = {
|
|
72
101
|
type: "Button",
|
|
73
|
-
label: "
|
|
102
|
+
label: "Button",
|
|
74
103
|
category: "core",
|
|
75
|
-
icon:
|
|
104
|
+
icon: ButtonIcon,
|
|
76
105
|
group: "basic",
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
106
|
+
...registerChaiBlockSchema({
|
|
107
|
+
properties: {
|
|
108
|
+
styles: StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),
|
|
109
|
+
content: {
|
|
110
|
+
type: "string",
|
|
111
|
+
title: "Button label",
|
|
112
|
+
default: "Button"
|
|
113
|
+
},
|
|
114
|
+
icon: {
|
|
115
|
+
type: "string",
|
|
116
|
+
title: "Icon",
|
|
117
|
+
default: "",
|
|
118
|
+
ui: { "ui:widget": "icon" }
|
|
119
|
+
},
|
|
120
|
+
iconSize: {
|
|
121
|
+
type: "number",
|
|
122
|
+
title: "Icon size",
|
|
123
|
+
default: 16
|
|
124
|
+
},
|
|
125
|
+
iconPos: {
|
|
126
|
+
type: "string",
|
|
127
|
+
title: "Icon position",
|
|
128
|
+
default: "order-last",
|
|
129
|
+
enum: ["order-first", "order-last"]
|
|
130
|
+
},
|
|
131
|
+
link: {
|
|
132
|
+
type: "object",
|
|
133
|
+
properties: {
|
|
134
|
+
type: { type: "string" },
|
|
135
|
+
href: { type: "string" },
|
|
136
|
+
target: { type: "string" }
|
|
137
|
+
},
|
|
138
|
+
default: {
|
|
139
|
+
type: "url",
|
|
140
|
+
href: "",
|
|
141
|
+
target: "_self"
|
|
142
|
+
},
|
|
143
|
+
ui: {
|
|
144
|
+
"ui:field": "link"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}),
|
|
149
|
+
i18nProps: ["content"],
|
|
150
|
+
aiProps: ["content"]
|
|
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, "") }
|
|
98
159
|
})
|
|
99
|
-
] }) :
|
|
100
|
-
...
|
|
101
|
-
...
|
|
102
|
-
dangerouslySetInnerHTML: { __html:
|
|
160
|
+
] }) : React.createElement("div", {
|
|
161
|
+
...blockProps,
|
|
162
|
+
...styles,
|
|
163
|
+
dangerouslySetInnerHTML: { __html: htmlCode }
|
|
103
164
|
});
|
|
104
|
-
}
|
|
165
|
+
};
|
|
166
|
+
const Config$q = {
|
|
105
167
|
type: "CustomHTML",
|
|
106
168
|
label: "web_blocks.custom_html",
|
|
107
169
|
category: "core",
|
|
108
|
-
icon:
|
|
170
|
+
icon: CodeIcon,
|
|
109
171
|
group: "advanced",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
172
|
+
...registerChaiBlockSchema({
|
|
173
|
+
properties: {
|
|
174
|
+
styles: StylesProp(""),
|
|
175
|
+
htmlCode: {
|
|
176
|
+
type: "string",
|
|
177
|
+
default: "<div><p>Enter your HTML code here...</p></div>",
|
|
178
|
+
ui: { "ui:widget": "code" }
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
};
|
|
183
|
+
const EmptyBox = (props) => {
|
|
184
|
+
const { blockProps, styles, backgroundImage } = props;
|
|
185
|
+
let cssStyles = {};
|
|
186
|
+
if (backgroundImage) {
|
|
187
|
+
cssStyles = { backgroundImage: `url(${backgroundImage})` };
|
|
123
188
|
}
|
|
124
|
-
|
|
189
|
+
return React.createElement("div", { ...blockProps, ...styles, style: cssStyles });
|
|
190
|
+
};
|
|
191
|
+
const Config$p = {
|
|
125
192
|
type: "EmptyBox",
|
|
126
|
-
label: "
|
|
193
|
+
label: "Empty Box",
|
|
127
194
|
category: "core",
|
|
128
195
|
group: "basic",
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
196
|
+
...registerChaiBlockSchema({
|
|
197
|
+
properties: {
|
|
198
|
+
styles: StylesProp(""),
|
|
199
|
+
backgroundImage: {
|
|
200
|
+
type: "string",
|
|
201
|
+
title: "Background Image",
|
|
202
|
+
default: "",
|
|
203
|
+
ui: { "ui:widget": "image" }
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
})
|
|
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 }
|
|
141
215
|
});
|
|
142
|
-
}
|
|
216
|
+
};
|
|
217
|
+
const Config$o = {
|
|
143
218
|
type: "Heading",
|
|
144
219
|
label: "web_blocks.heading",
|
|
145
220
|
category: "core",
|
|
146
|
-
icon:
|
|
221
|
+
icon: HeadingIcon,
|
|
147
222
|
group: "typography",
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
223
|
+
...registerChaiBlockSchema({
|
|
224
|
+
properties: {
|
|
225
|
+
tag: {
|
|
226
|
+
type: "string",
|
|
227
|
+
default: "h2",
|
|
228
|
+
title: "Level",
|
|
229
|
+
enum: ["h1", "h2", "h3", "h4", "h5", "h6"]
|
|
230
|
+
},
|
|
231
|
+
styles: StylesProp("text-3xl"),
|
|
232
|
+
content: {
|
|
233
|
+
type: "string",
|
|
234
|
+
default: "Heading goes here",
|
|
235
|
+
title: "Content",
|
|
236
|
+
ui: { "ui:widget": "textarea" }
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}),
|
|
240
|
+
aiProps: ["content"],
|
|
241
|
+
i18nProps: ["content"],
|
|
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 = {
|
|
176
254
|
type: "Paragraph",
|
|
177
255
|
label: "Paragraph",
|
|
178
256
|
category: "core",
|
|
179
|
-
icon:
|
|
257
|
+
icon: TextIcon,
|
|
180
258
|
group: "typography",
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
259
|
+
...registerChaiBlockSchema({
|
|
260
|
+
properties: {
|
|
261
|
+
styles: StylesProp(""),
|
|
262
|
+
content: {
|
|
263
|
+
type: "string",
|
|
264
|
+
title: "Content",
|
|
265
|
+
default: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
|
|
186
266
|
Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
|
|
187
267
|
nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
268
|
+
ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 5 }
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}),
|
|
272
|
+
i18nProps: ["content"],
|
|
273
|
+
aiProps: ["content"],
|
|
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 = {
|
|
288
|
+
type: "RichText",
|
|
289
|
+
label: "Rich Text",
|
|
290
|
+
category: "core",
|
|
291
|
+
icon: CursorTextIcon,
|
|
292
|
+
group: "typography",
|
|
293
|
+
...registerChaiBlockSchema({
|
|
294
|
+
properties: {
|
|
295
|
+
styles: StylesProp(""),
|
|
296
|
+
content: {
|
|
297
|
+
type: "string",
|
|
298
|
+
title: "Content",
|
|
299
|
+
default: "<p>This is a rich text block. You can add text, and other content here.</p>",
|
|
300
|
+
ui: { "ui:widget": "richtext" }
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}),
|
|
304
|
+
aiProps: ["content"],
|
|
305
|
+
i18nProps: ["content"]
|
|
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 || "" }
|
|
200
314
|
});
|
|
201
|
-
}
|
|
315
|
+
};
|
|
316
|
+
const Config$l = {
|
|
202
317
|
type: "Span",
|
|
203
318
|
label: "Span",
|
|
204
319
|
category: "core",
|
|
205
320
|
group: "typography",
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
321
|
+
...registerChaiBlockSchema({
|
|
322
|
+
properties: {
|
|
323
|
+
styles: StylesProp(""),
|
|
324
|
+
content: {
|
|
325
|
+
type: "string",
|
|
326
|
+
title: "Content",
|
|
327
|
+
default: "",
|
|
328
|
+
ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 3 }
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}),
|
|
332
|
+
aiProps: ["content"],
|
|
333
|
+
i18nProps: ["content"],
|
|
334
|
+
canAcceptBlock: () => true
|
|
335
|
+
};
|
|
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);
|
|
338
|
+
}
|
|
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 = {
|
|
346
|
+
type: "CustomScript",
|
|
347
|
+
label: "web_blocks.custom_script",
|
|
226
348
|
category: "core",
|
|
227
|
-
icon:
|
|
228
|
-
group: "
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
349
|
+
icon: DiJavascript,
|
|
350
|
+
group: "advanced",
|
|
351
|
+
...registerChaiBlockSchema({
|
|
352
|
+
properties: {
|
|
353
|
+
scripts: {
|
|
354
|
+
type: "string",
|
|
355
|
+
title: "Script",
|
|
356
|
+
default: "",
|
|
357
|
+
format: "code",
|
|
358
|
+
placeholder: "<script>console.log('Hello, world!');<\/script>"
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
})
|
|
362
|
+
};
|
|
363
|
+
const DividerBlock = (props) => {
|
|
364
|
+
const { blockProps, styles } = props;
|
|
365
|
+
return createElement("hr", { ...styles, ...blockProps });
|
|
366
|
+
};
|
|
367
|
+
const Config$j = {
|
|
368
|
+
type: "Divider",
|
|
369
|
+
label: "web_blocks.divider",
|
|
370
|
+
category: "core",
|
|
371
|
+
icon: DividerHorizontalIcon,
|
|
372
|
+
group: "basic",
|
|
373
|
+
...registerChaiBlockSchema({
|
|
374
|
+
properties: {
|
|
375
|
+
styles: StylesProp("bg-gray-900 h-0.5 py-2 my-1")
|
|
376
|
+
}
|
|
377
|
+
})
|
|
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
|
+
);
|
|
237
396
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
397
|
+
return React.createElement("span", { ...blockProps }, children);
|
|
398
|
+
};
|
|
399
|
+
const Config$i = {
|
|
400
|
+
type: "GlobalBlock",
|
|
401
|
+
label: "Global Block",
|
|
402
|
+
icon: GlobeIcon,
|
|
403
|
+
category: "core",
|
|
404
|
+
group: "basic",
|
|
405
|
+
...registerChaiBlockSchema({
|
|
406
|
+
properties: {
|
|
407
|
+
globalBlock: {
|
|
408
|
+
type: "string",
|
|
409
|
+
title: "Global Block",
|
|
410
|
+
default: "",
|
|
411
|
+
ui: { "ui:widget": "hidden" }
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
})
|
|
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,
|
|
426
|
+
style: {
|
|
427
|
+
width: width ? `${width}px` : "auto",
|
|
428
|
+
height: height ? `${height}px` : "auto"
|
|
248
429
|
},
|
|
249
|
-
|
|
250
|
-
|
|
430
|
+
dangerouslySetInnerHTML: { __html: svg }
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
const Config$h = {
|
|
434
|
+
type: "Icon",
|
|
435
|
+
label: "web_blocks.icon",
|
|
436
|
+
category: "core",
|
|
437
|
+
icon: SketchLogoIcon,
|
|
438
|
+
group: "media",
|
|
439
|
+
...registerChaiBlockSchema({
|
|
440
|
+
properties: {
|
|
441
|
+
styles: StylesProp(""),
|
|
442
|
+
icon: {
|
|
443
|
+
type: "string",
|
|
444
|
+
title: "Icon",
|
|
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>`,
|
|
446
|
+
ui: { "ui:widget": "icon" }
|
|
447
|
+
},
|
|
448
|
+
width: {
|
|
449
|
+
type: "number",
|
|
450
|
+
default: 16,
|
|
451
|
+
title: "Width"
|
|
452
|
+
},
|
|
453
|
+
height: {
|
|
454
|
+
type: "number",
|
|
455
|
+
default: 16,
|
|
456
|
+
title: "Height"
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
})
|
|
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(
|
|
467
|
+
"img",
|
|
468
|
+
{
|
|
469
|
+
...blockProps,
|
|
470
|
+
...styles,
|
|
471
|
+
src: image,
|
|
472
|
+
alt,
|
|
473
|
+
loading: lazyLoading ? "lazy" : "eager",
|
|
474
|
+
width,
|
|
475
|
+
height
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
] });
|
|
479
|
+
};
|
|
480
|
+
const Config$g = {
|
|
481
|
+
type: "Image",
|
|
482
|
+
label: "Image",
|
|
483
|
+
category: "core",
|
|
484
|
+
icon: ImageIcon,
|
|
485
|
+
group: "media",
|
|
486
|
+
...registerChaiBlockSchema({
|
|
487
|
+
properties: {
|
|
488
|
+
styles: StylesProp(""),
|
|
489
|
+
image: {
|
|
490
|
+
type: "string",
|
|
491
|
+
title: "Image",
|
|
492
|
+
default: "https://fakeimg.pl/400x200?text=Choose&font=bebas",
|
|
493
|
+
ui: { "ui:widget": "image" }
|
|
494
|
+
},
|
|
495
|
+
alt: {
|
|
496
|
+
type: "string",
|
|
497
|
+
title: "Alt text",
|
|
498
|
+
default: "",
|
|
499
|
+
ui: { "ui:placeholder": "Enter alt text" }
|
|
500
|
+
},
|
|
501
|
+
lazyLoading: {
|
|
502
|
+
type: "boolean",
|
|
503
|
+
title: "Lazy Load",
|
|
504
|
+
default: true
|
|
505
|
+
},
|
|
506
|
+
width: {
|
|
507
|
+
type: "number",
|
|
508
|
+
title: "Width",
|
|
509
|
+
default: "",
|
|
510
|
+
ui: { "ui:placeholder": "Enter width" }
|
|
511
|
+
},
|
|
512
|
+
height: {
|
|
513
|
+
type: "number",
|
|
514
|
+
title: "Height",
|
|
515
|
+
default: "",
|
|
516
|
+
ui: { "ui:placeholder": "Enter height" }
|
|
517
|
+
},
|
|
518
|
+
mobileImage: {
|
|
519
|
+
type: "string",
|
|
520
|
+
title: "Mobile Image",
|
|
521
|
+
default: "",
|
|
522
|
+
ui: { "ui:widget": "image" }
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}),
|
|
526
|
+
aiProps: ["alt"],
|
|
527
|
+
i18nProps: ["alt"]
|
|
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
|
|
563
|
+
});
|
|
564
|
+
};
|
|
565
|
+
const Config$f = {
|
|
566
|
+
type: "LightBoxLink",
|
|
567
|
+
label: "Lightbox Link",
|
|
568
|
+
category: "core",
|
|
569
|
+
icon: ImageIcon,
|
|
570
|
+
group: "basic",
|
|
571
|
+
...registerChaiBlockSchema({
|
|
572
|
+
properties: {
|
|
573
|
+
styles: StylesProp(""),
|
|
574
|
+
content: {
|
|
575
|
+
type: "string",
|
|
576
|
+
title: "Content",
|
|
577
|
+
default: "Link text or drop blocks inside"
|
|
578
|
+
},
|
|
579
|
+
hrefType: {
|
|
580
|
+
type: "string",
|
|
581
|
+
title: "Type",
|
|
582
|
+
default: "image",
|
|
583
|
+
enum: ["image", "video", "iframe", "inline", "ajax"],
|
|
584
|
+
enumNames: ["Image", "Video", "Iframe", "Inline", "Ajax"]
|
|
585
|
+
},
|
|
586
|
+
href: {
|
|
587
|
+
type: "string",
|
|
588
|
+
title: "Href",
|
|
589
|
+
default: ""
|
|
590
|
+
},
|
|
591
|
+
autoplay: {
|
|
592
|
+
type: "boolean",
|
|
593
|
+
title: "Autoplay (Video only)",
|
|
594
|
+
default: false
|
|
595
|
+
},
|
|
596
|
+
maxWidth: {
|
|
597
|
+
type: "number",
|
|
598
|
+
title: "Max Width",
|
|
599
|
+
default: ""
|
|
600
|
+
},
|
|
601
|
+
backdropColor: {
|
|
602
|
+
type: "string",
|
|
603
|
+
title: "Backdrop Color",
|
|
604
|
+
default: ""
|
|
605
|
+
},
|
|
606
|
+
galleryName: {
|
|
607
|
+
type: "string",
|
|
608
|
+
title: "Gallery Name",
|
|
609
|
+
default: ""
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
dependencies: {
|
|
613
|
+
autoplay: ["hrefType", "video"]
|
|
614
|
+
}
|
|
615
|
+
}),
|
|
616
|
+
i18nProps: ["content"],
|
|
617
|
+
aiProps: ["content"],
|
|
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(
|
|
251
645
|
"a",
|
|
252
646
|
{
|
|
253
|
-
...
|
|
254
|
-
...
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
|
258
652
|
},
|
|
259
|
-
|
|
653
|
+
content
|
|
260
654
|
);
|
|
261
|
-
}
|
|
655
|
+
};
|
|
656
|
+
const Config$e = {
|
|
262
657
|
type: "Link",
|
|
263
658
|
label: "Link",
|
|
264
659
|
category: "core",
|
|
265
|
-
icon:
|
|
266
|
-
group: "basic",
|
|
267
|
-
props: {
|
|
268
|
-
styles: m({ default: "" }),
|
|
269
|
-
content: p({ title: "Content", default: "", ai: !0, i18n: !0 }),
|
|
270
|
-
link: D({
|
|
271
|
-
title: "Link",
|
|
272
|
-
default: { type: "collection", target: "_self", href: "" }
|
|
273
|
-
})
|
|
274
|
-
},
|
|
275
|
-
canAcceptBlock: (e) => e !== "Link"
|
|
276
|
-
}, q = (e, ...l) => ({
|
|
277
|
-
...e,
|
|
278
|
-
className: j(e.className, ...l)
|
|
279
|
-
}), Se = (e) => {
|
|
280
|
-
const { blockProps: l, children: t, styles: o, inBuilder: a, content: r, href: n } = e, { hrefType: i, autoplay: c, maxWidth: d, backdropColor: h, galleryName: f } = e, g = q(o, "cb-lightbox");
|
|
281
|
-
if (!t && k(o == null ? void 0 : o.className) && k(r))
|
|
282
|
-
return /* @__PURE__ */ s.jsx(_, { inBuilder: a });
|
|
283
|
-
if (a)
|
|
284
|
-
return t ? /* @__PURE__ */ s.jsx("span", { ...l, ...g, children: t }) : b.createElement("span", {
|
|
285
|
-
...l,
|
|
286
|
-
...g,
|
|
287
|
-
dangerouslySetInnerHTML: { __html: r }
|
|
288
|
-
});
|
|
289
|
-
const x = {};
|
|
290
|
-
return x["data-vbtype"] = i, c && (x["data-autoplay"] = "true"), d && (x["data-maxwidth"] = d + "px"), h && (x["data-overlay"] = h), f && (x["data-gall"] = f), t ? /* @__PURE__ */ s.jsx("a", { ...x, href: n || "#/", ...l, ...g, children: t }) : b.createElement("a", {
|
|
291
|
-
...l,
|
|
292
|
-
...g,
|
|
293
|
-
...x,
|
|
294
|
-
href: n || "#",
|
|
295
|
-
dangerouslySetInnerHTML: { __html: r }
|
|
296
|
-
});
|
|
297
|
-
}, Me = {
|
|
298
|
-
type: "LightBoxLink",
|
|
299
|
-
label: "Lightbox Link",
|
|
300
|
-
category: "core",
|
|
301
|
-
icon: z,
|
|
660
|
+
icon: Link1Icon,
|
|
302
661
|
group: "basic",
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
662
|
+
...registerChaiBlockSchema({
|
|
663
|
+
properties: {
|
|
664
|
+
styles: StylesProp(""),
|
|
665
|
+
content: {
|
|
666
|
+
type: "string",
|
|
667
|
+
default: "Link goes here",
|
|
668
|
+
title: "Content"
|
|
669
|
+
},
|
|
670
|
+
link: {
|
|
671
|
+
type: "object",
|
|
672
|
+
properties: {
|
|
673
|
+
type: { type: "string" },
|
|
674
|
+
href: { type: "string" },
|
|
675
|
+
target: { type: "string" }
|
|
676
|
+
},
|
|
677
|
+
default: {
|
|
678
|
+
type: "url",
|
|
679
|
+
href: "",
|
|
680
|
+
target: "_self"
|
|
681
|
+
},
|
|
682
|
+
ui: {
|
|
683
|
+
"ui:field": "link"
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}),
|
|
688
|
+
aiProps: ["content"],
|
|
689
|
+
i18nProps: ["content"],
|
|
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
|
|
329
702
|
);
|
|
330
|
-
}
|
|
703
|
+
};
|
|
704
|
+
const Config$d = {
|
|
331
705
|
type: "List",
|
|
332
706
|
label: "web_blocks.list",
|
|
333
|
-
icon:
|
|
707
|
+
icon: RowsIcon,
|
|
334
708
|
category: "core",
|
|
335
709
|
group: "basic",
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
710
|
+
...registerChaiBlockSchema({
|
|
711
|
+
properties: {
|
|
712
|
+
styles: StylesProp(""),
|
|
713
|
+
listType: {
|
|
714
|
+
type: "string",
|
|
715
|
+
title: "List Type",
|
|
716
|
+
default: "list-none",
|
|
717
|
+
oneOf: [
|
|
718
|
+
{ enum: ["list-none"], title: "List None" },
|
|
719
|
+
{ enum: ["list-disc"], title: "Disc" },
|
|
720
|
+
{ enum: ["list-decimal"], title: "Decimal" }
|
|
721
|
+
]
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}),
|
|
725
|
+
canAcceptBlock: (blockType) => blockType === "ListItem",
|
|
349
726
|
blocks: [
|
|
350
727
|
{ _type: "List", _id: "a", listType: "list-none", styles: "#styles:," },
|
|
351
728
|
{
|
|
@@ -370,649 +747,918 @@ const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("d
|
|
|
370
747
|
content: "Item 3"
|
|
371
748
|
}
|
|
372
749
|
]
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
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 = {
|
|
382
763
|
type: "ListItem",
|
|
383
764
|
label: "List Item",
|
|
384
|
-
icon:
|
|
765
|
+
icon: ColumnsIcon,
|
|
385
766
|
category: "core",
|
|
386
767
|
group: "basic",
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
group: "media",
|
|
409
|
-
props: {
|
|
410
|
-
styles: m({ default: "text-black" }),
|
|
411
|
-
icon: N({
|
|
412
|
-
title: "web_blocks.icon",
|
|
413
|
-
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>'
|
|
414
|
-
}),
|
|
415
|
-
width: B({ title: "web_blocks.width", default: "" }),
|
|
416
|
-
height: B({ title: "web_blocks.height", default: "" })
|
|
768
|
+
...registerChaiBlockSchema({
|
|
769
|
+
properties: {
|
|
770
|
+
styles: StylesProp(""),
|
|
771
|
+
content: {
|
|
772
|
+
type: "string",
|
|
773
|
+
default: "List item",
|
|
774
|
+
title: "Content",
|
|
775
|
+
ui: {
|
|
776
|
+
"ui:widget": "textarea"
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}),
|
|
781
|
+
i18nProps: ["content"],
|
|
782
|
+
aiProps: ["content"],
|
|
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 });
|
|
417
789
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
alt: a,
|
|
425
|
-
loading: i ? "lazy" : "eager",
|
|
426
|
-
height: r,
|
|
427
|
-
width: n
|
|
428
|
-
});
|
|
429
|
-
}, Ae = {
|
|
430
|
-
type: "Image",
|
|
431
|
-
label: "Image",
|
|
790
|
+
return `${props.content}`;
|
|
791
|
+
};
|
|
792
|
+
const Config$b = {
|
|
793
|
+
type: "Text",
|
|
794
|
+
label: "Text",
|
|
795
|
+
hidden: true,
|
|
432
796
|
category: "core",
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
797
|
+
group: "typography",
|
|
798
|
+
icon: SpaceBetweenVerticallyIcon,
|
|
799
|
+
...registerChaiBlockSchema({
|
|
800
|
+
properties: {
|
|
801
|
+
styles: StylesProp("text-black"),
|
|
802
|
+
content: {
|
|
803
|
+
type: "string",
|
|
804
|
+
default: ""
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}),
|
|
808
|
+
aiProps: ["content"],
|
|
809
|
+
i18nProps: ["content"]
|
|
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;
|
|
450
822
|
}
|
|
451
|
-
if (
|
|
452
|
-
const
|
|
453
|
-
|
|
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;
|
|
454
830
|
}
|
|
455
|
-
if (
|
|
456
|
-
const
|
|
457
|
-
|
|
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;
|
|
458
838
|
}
|
|
459
839
|
return null;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
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("&")}`;
|
|
858
|
+
}
|
|
859
|
+
videoElement = React.createElement("iframe", {
|
|
860
|
+
...blockProps,
|
|
861
|
+
className: "absolute inset-0 w-full h-full",
|
|
862
|
+
src: embedURL,
|
|
863
|
+
allow: inBuilder ? "" : "autoplay *; fullscreen *",
|
|
864
|
+
allowFullScreen: true,
|
|
865
|
+
frameBorder: 0
|
|
866
|
+
});
|
|
867
|
+
} else {
|
|
868
|
+
videoElement = React.createElement("video", {
|
|
869
|
+
...blockProps,
|
|
870
|
+
className: "absolute inset-0 w-full h-full",
|
|
871
|
+
src: url,
|
|
872
|
+
controls: _controls,
|
|
873
|
+
muted,
|
|
874
|
+
autoPlay: inBuilder ? false : autoplay,
|
|
875
|
+
loop
|
|
876
|
+
});
|
|
493
877
|
}
|
|
494
|
-
),
|
|
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
|
|
881
|
+
] }) });
|
|
882
|
+
});
|
|
883
|
+
const Config$a = {
|
|
495
884
|
type: "Video",
|
|
496
885
|
label: "Video",
|
|
497
886
|
category: "core",
|
|
498
|
-
icon:
|
|
887
|
+
icon: VideoIcon,
|
|
499
888
|
group: "media",
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
889
|
+
...registerChaiBlockSchema({
|
|
890
|
+
properties: {
|
|
891
|
+
styles: StylesProp(""),
|
|
892
|
+
url: {
|
|
893
|
+
type: "string",
|
|
894
|
+
title: "Video URL",
|
|
895
|
+
default: "https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"
|
|
896
|
+
},
|
|
897
|
+
controls: {
|
|
898
|
+
type: "object",
|
|
899
|
+
title: "Controls",
|
|
900
|
+
default: {
|
|
901
|
+
autoplay: false,
|
|
902
|
+
controls: true,
|
|
903
|
+
loop: false,
|
|
904
|
+
muted: false
|
|
905
|
+
},
|
|
906
|
+
properties: {
|
|
907
|
+
autoplay: {
|
|
908
|
+
type: "boolean",
|
|
909
|
+
title: "Autoplay",
|
|
910
|
+
default: false
|
|
911
|
+
},
|
|
912
|
+
controls: {
|
|
913
|
+
type: "boolean",
|
|
914
|
+
title: "Show Controls",
|
|
915
|
+
default: true
|
|
916
|
+
},
|
|
917
|
+
loop: {
|
|
918
|
+
type: "boolean",
|
|
919
|
+
title: "Loop Video",
|
|
920
|
+
default: false
|
|
921
|
+
},
|
|
922
|
+
muted: {
|
|
923
|
+
type: "boolean",
|
|
924
|
+
title: "Muted",
|
|
925
|
+
default: false
|
|
926
|
+
}
|
|
927
|
+
}
|
|
514
928
|
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
929
|
+
}
|
|
930
|
+
}),
|
|
931
|
+
i18nProps: ["url"]
|
|
517
932
|
};
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
type: "
|
|
551
|
-
label: "web_blocks.
|
|
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(
|
|
938
|
+
"input",
|
|
939
|
+
{
|
|
940
|
+
id: fieldId,
|
|
941
|
+
...blockProps,
|
|
942
|
+
...inputStyles,
|
|
943
|
+
...styles,
|
|
944
|
+
type: "checkbox",
|
|
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
|
|
959
|
+
}
|
|
960
|
+
),
|
|
961
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: fieldId, children: label })
|
|
962
|
+
] });
|
|
963
|
+
};
|
|
964
|
+
const Config$9 = {
|
|
965
|
+
type: "Checkbox",
|
|
966
|
+
label: "web_blocks.checkbox",
|
|
552
967
|
category: "core",
|
|
553
|
-
icon:
|
|
554
|
-
group: "
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
_type: "Button",
|
|
585
|
-
// @ts-ignore
|
|
586
|
-
styles_attrs: { type: "button", "x-on:click": "darkMode = 'light'", "x-show": "darkMode === 'dark'" },
|
|
587
|
-
styles: "#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",
|
|
588
|
-
_name: "Light Mode Btn"
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
_id: "sgbhDo",
|
|
592
|
-
_parent: "gesydi",
|
|
593
|
-
_type: "Span",
|
|
594
|
-
tag: "span",
|
|
595
|
-
styles: "#styles:,group inline-flex shrink-0 justify-center items-center size-9"
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
_id: "AdDwBC",
|
|
599
|
-
_parent: "sgbhDo",
|
|
600
|
-
_type: "Icon",
|
|
601
|
-
styles: "#styles:, shrink-0 size-4",
|
|
602
|
-
icon: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"
|
|
603
|
-
}
|
|
604
|
-
]
|
|
605
|
-
}, Ye = (e) => {
|
|
606
|
-
const { blockProps: l, inBuilder: t, children: o, globalBlock: a } = e;
|
|
607
|
-
return t && !a ? /* @__PURE__ */ s.jsxs(
|
|
608
|
-
"div",
|
|
609
|
-
{
|
|
610
|
-
className: "flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",
|
|
611
|
-
...l,
|
|
612
|
-
children: [
|
|
613
|
-
/* @__PURE__ */ s.jsxs("h1", { children: [
|
|
614
|
-
"Global Block - ",
|
|
615
|
-
a
|
|
616
|
-
] }),
|
|
617
|
-
/* @__PURE__ */ s.jsx("p", { children: "Choose a block from the sidebar to add it to this page." })
|
|
618
|
-
]
|
|
968
|
+
icon: CheckboxIcon,
|
|
969
|
+
group: "form",
|
|
970
|
+
...registerChaiBlockSchema({
|
|
971
|
+
properties: {
|
|
972
|
+
styles: StylesProp("flex items-center gap-x-2"),
|
|
973
|
+
inputStyles: StylesProp(""),
|
|
974
|
+
fieldName: {
|
|
975
|
+
type: "string",
|
|
976
|
+
title: "Field Name",
|
|
977
|
+
default: "fieldName"
|
|
978
|
+
},
|
|
979
|
+
label: {
|
|
980
|
+
type: "string",
|
|
981
|
+
title: "Label",
|
|
982
|
+
default: "Label"
|
|
983
|
+
},
|
|
984
|
+
checked: {
|
|
985
|
+
type: "boolean",
|
|
986
|
+
title: "Checked",
|
|
987
|
+
default: false
|
|
988
|
+
},
|
|
989
|
+
required: {
|
|
990
|
+
type: "boolean",
|
|
991
|
+
title: "Required",
|
|
992
|
+
default: false
|
|
993
|
+
},
|
|
994
|
+
showLabel: {
|
|
995
|
+
type: "boolean",
|
|
996
|
+
title: "Show Label",
|
|
997
|
+
default: true
|
|
998
|
+
}
|
|
619
999
|
}
|
|
620
|
-
)
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}
|
|
630
|
-
}, Je = (e) => e.inBuilder || e.forceWrapper ? /* @__PURE__ */ s.jsx("span", { "data-ai-key": "content", ...e.blockProps, children: e.content }) : `${e.content}`, Ke = {
|
|
631
|
-
type: "Text",
|
|
632
|
-
label: "Text",
|
|
633
|
-
hidden: !0,
|
|
634
|
-
category: "core",
|
|
635
|
-
group: "typography",
|
|
636
|
-
icon: A,
|
|
637
|
-
props: {
|
|
638
|
-
content: L({ title: "Content", default: "", ai: !0, i18n: !0 })
|
|
639
|
-
}
|
|
640
|
-
}, Qe = (e) => {
|
|
641
|
-
const { blockProps: l, backgroundImage: t, children: o, styles: a } = e;
|
|
642
|
-
let r = {};
|
|
643
|
-
return t && (r = { backgroundImage: `url(${t})` }), b.createElement("div", { ...l, ...a, style: r }, o);
|
|
644
|
-
}, et = {
|
|
645
|
-
type: "Body",
|
|
646
|
-
label: "Body",
|
|
647
|
-
category: "core",
|
|
648
|
-
group: "basic",
|
|
649
|
-
hidden: !0,
|
|
650
|
-
props: {
|
|
651
|
-
styles: m({ default: "font-body antialiased" }),
|
|
652
|
-
backgroundImage: C({ title: "Background Image" })
|
|
653
|
-
},
|
|
654
|
-
canAcceptBlock: () => !0,
|
|
655
|
-
canDelete: () => !1,
|
|
656
|
-
canMove: () => !1,
|
|
657
|
-
canDuplicate: () => !1
|
|
658
|
-
}, tt = (e) => {
|
|
659
|
-
const { blockProps: l, styles: t } = e;
|
|
660
|
-
return b.createElement("br", { ...l, ...t });
|
|
661
|
-
}, lt = {
|
|
662
|
-
type: "LineBreak",
|
|
663
|
-
label: "Line Break",
|
|
664
|
-
category: "core",
|
|
665
|
-
group: "basic",
|
|
666
|
-
hidden: !0,
|
|
667
|
-
icon: A,
|
|
668
|
-
props: {
|
|
669
|
-
styles: m({ default: "" })
|
|
1000
|
+
}),
|
|
1001
|
+
aiProps: ["label"],
|
|
1002
|
+
i18nProps: ["label"]
|
|
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 });
|
|
670
1009
|
}
|
|
671
|
-
|
|
672
|
-
const { blockProps: l, errorMessage: t, name: o, _type: a, successMessage: r, action: n, styles: i, children: c } = e;
|
|
673
|
-
let d = c;
|
|
674
|
-
c || (d = /* @__PURE__ */ s.jsx(_, {}));
|
|
675
|
-
const h = {
|
|
1010
|
+
const alpineAttrs = {
|
|
676
1011
|
"x-data": "{}",
|
|
677
1012
|
"x-on:submit.prevent": "post"
|
|
678
|
-
}
|
|
1013
|
+
};
|
|
1014
|
+
const formResponseAttr = {
|
|
679
1015
|
"x-html": "",
|
|
680
1016
|
":class": "{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"
|
|
681
1017
|
};
|
|
682
|
-
return /* @__PURE__ */
|
|
1018
|
+
return /* @__PURE__ */ jsxs(
|
|
683
1019
|
"form",
|
|
684
1020
|
{
|
|
685
|
-
...
|
|
686
|
-
"data-error":
|
|
687
|
-
"data-success":
|
|
1021
|
+
...alpineAttrs,
|
|
1022
|
+
"data-error": errorMessage,
|
|
1023
|
+
"data-success": successMessage,
|
|
688
1024
|
method: "post",
|
|
689
|
-
action
|
|
690
|
-
...
|
|
691
|
-
...
|
|
1025
|
+
action,
|
|
1026
|
+
...blockProps,
|
|
1027
|
+
...styles,
|
|
692
1028
|
children: [
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
|
|
695
|
-
d
|
|
1029
|
+
/* @__PURE__ */ jsx("div", { ...formResponseAttr }),
|
|
1030
|
+
nestedChildren
|
|
696
1031
|
]
|
|
697
1032
|
}
|
|
698
1033
|
);
|
|
699
|
-
}
|
|
1034
|
+
};
|
|
1035
|
+
const Config$8 = {
|
|
700
1036
|
type: "Form",
|
|
701
1037
|
label: "Form",
|
|
702
1038
|
category: "core",
|
|
703
|
-
icon:
|
|
1039
|
+
icon: GroupIcon,
|
|
704
1040
|
group: "form",
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
1041
|
+
blocks: () => [
|
|
1042
|
+
{ _type: "Form", _id: "form", styles: "#styles:p-1 space-y-2," },
|
|
1043
|
+
{ _type: "Input", _id: "form_input", _parent: "form", styles: "#styles:," },
|
|
1044
|
+
{
|
|
1045
|
+
_type: "FormButton",
|
|
1046
|
+
_id: "form_submit_btn",
|
|
1047
|
+
_parent: "form",
|
|
1048
|
+
styles: "#styles:bg-black text-white rounded px-3 py-1,"
|
|
1049
|
+
}
|
|
1050
|
+
],
|
|
1051
|
+
...registerChaiBlockSchema({
|
|
1052
|
+
properties: {
|
|
1053
|
+
styles: StylesProp(""),
|
|
1054
|
+
action: {
|
|
1055
|
+
type: "string",
|
|
1056
|
+
title: "Submit URL",
|
|
1057
|
+
default: "/api/form/submit"
|
|
1058
|
+
},
|
|
1059
|
+
errorMessage: {
|
|
1060
|
+
type: "string",
|
|
1061
|
+
title: "Error Message",
|
|
1062
|
+
default: "Something went wrong. Please try again",
|
|
1063
|
+
ui: { "ui:widget": "richtext" }
|
|
1064
|
+
},
|
|
1065
|
+
successMessage: {
|
|
1066
|
+
type: "string",
|
|
1067
|
+
title: "Success Message",
|
|
1068
|
+
default: "Thank you for your submission.",
|
|
1069
|
+
ui: { "ui:widget": "richtext" }
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}),
|
|
1073
|
+
i18nProps: ["errorMessage", "successMessage"],
|
|
1074
|
+
aiProps: ["errorMessage", "successMessage"],
|
|
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 = {
|
|
723
1081
|
"x-bind:disabled": "formLoading"
|
|
724
1082
|
};
|
|
725
|
-
return /* @__PURE__ */
|
|
1083
|
+
return /* @__PURE__ */ jsxs(
|
|
726
1084
|
"button",
|
|
727
1085
|
{
|
|
728
|
-
id:
|
|
729
|
-
...
|
|
730
|
-
...
|
|
731
|
-
...
|
|
732
|
-
...
|
|
733
|
-
type:
|
|
1086
|
+
id: fieldId,
|
|
1087
|
+
...attrs,
|
|
1088
|
+
...inputStyles,
|
|
1089
|
+
...styles,
|
|
1090
|
+
...blockProps || {},
|
|
1091
|
+
type: inBuilder ? "button" : "submit",
|
|
1092
|
+
"aria-label": label,
|
|
734
1093
|
children: [
|
|
735
|
-
|
|
736
|
-
|
|
1094
|
+
label,
|
|
1095
|
+
icon && /* @__PURE__ */ jsx(
|
|
1096
|
+
"div",
|
|
1097
|
+
{
|
|
1098
|
+
style: { width: iconSize + "px" },
|
|
1099
|
+
className: iconPos + " " + (iconPos === "order-first" ? "mr-2" : "ml-2") || "",
|
|
1100
|
+
dangerouslySetInnerHTML: { __html: icon }
|
|
1101
|
+
}
|
|
1102
|
+
)
|
|
737
1103
|
]
|
|
738
1104
|
}
|
|
739
1105
|
);
|
|
740
|
-
}
|
|
1106
|
+
};
|
|
1107
|
+
const Config$7 = {
|
|
741
1108
|
type: "FormButton",
|
|
742
1109
|
label: "Submit Button",
|
|
743
1110
|
category: "core",
|
|
744
|
-
icon:
|
|
1111
|
+
icon: ButtonIcon,
|
|
745
1112
|
group: "form",
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
1113
|
+
...registerChaiBlockSchema({
|
|
1114
|
+
properties: {
|
|
1115
|
+
styles: StylesProp(
|
|
1116
|
+
"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"
|
|
1117
|
+
),
|
|
1118
|
+
inputStyles: StylesProp(""),
|
|
1119
|
+
label: {
|
|
1120
|
+
type: "string",
|
|
1121
|
+
title: "Label",
|
|
1122
|
+
default: "Submit",
|
|
1123
|
+
ai: true,
|
|
1124
|
+
i18n: true
|
|
1125
|
+
},
|
|
1126
|
+
icon: {
|
|
1127
|
+
type: "string",
|
|
1128
|
+
title: "Icon",
|
|
1129
|
+
default: "",
|
|
1130
|
+
ui: { "ui:widget": "icon" }
|
|
1131
|
+
},
|
|
1132
|
+
iconSize: {
|
|
1133
|
+
type: "number",
|
|
1134
|
+
title: "Icon size",
|
|
1135
|
+
default: 24
|
|
1136
|
+
},
|
|
1137
|
+
iconPos: {
|
|
1138
|
+
type: "string",
|
|
1139
|
+
title: "Icon Position",
|
|
1140
|
+
default: "order-last",
|
|
1141
|
+
enum: ["order-first", "order-last"]
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}),
|
|
1145
|
+
i18nProps: ["label"],
|
|
1146
|
+
aiProps: ["label"]
|
|
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(
|
|
1153
|
+
"input",
|
|
1154
|
+
{
|
|
1155
|
+
id: fieldId,
|
|
1156
|
+
name: fieldName,
|
|
1157
|
+
...blockProps,
|
|
1158
|
+
...inputStyles,
|
|
1159
|
+
...styles,
|
|
1160
|
+
type: inputType,
|
|
1161
|
+
placeholder,
|
|
1162
|
+
required
|
|
1163
|
+
}
|
|
1164
|
+
);
|
|
760
1165
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
label: t,
|
|
765
|
-
placeholder: o,
|
|
766
|
-
styles: a,
|
|
767
|
-
inputStyles: r,
|
|
768
|
-
showLabel: n,
|
|
769
|
-
required: i,
|
|
770
|
-
inputType: c = "text",
|
|
771
|
-
inBuilder: d,
|
|
772
|
-
fieldName: h
|
|
773
|
-
} = e, f = I();
|
|
774
|
-
return !n || c === "submit" ? (c === "submit" && (l.value = t), /* @__PURE__ */ s.jsx(
|
|
775
|
-
"input",
|
|
776
|
-
{
|
|
777
|
-
id: f,
|
|
778
|
-
name: h,
|
|
779
|
-
readOnly: d,
|
|
780
|
-
...l,
|
|
781
|
-
...r,
|
|
782
|
-
...a,
|
|
783
|
-
type: c,
|
|
784
|
-
placeholder: o,
|
|
785
|
-
required: i
|
|
786
|
-
}
|
|
787
|
-
)) : /* @__PURE__ */ s.jsxs("div", { ...a, ...l, children: [
|
|
788
|
-
n && /* @__PURE__ */ s.jsx("label", { htmlFor: f, children: t }),
|
|
789
|
-
/* @__PURE__ */ s.jsx(
|
|
1166
|
+
return /* @__PURE__ */ jsxs("div", { ...styles, ...blockProps, children: [
|
|
1167
|
+
showLabel && /* @__PURE__ */ jsx("label", { htmlFor: fieldId, children: label }),
|
|
1168
|
+
/* @__PURE__ */ jsx(
|
|
790
1169
|
"input",
|
|
791
1170
|
{
|
|
792
|
-
name:
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
required: i
|
|
1171
|
+
name: fieldName,
|
|
1172
|
+
...inputStyles,
|
|
1173
|
+
id: fieldId,
|
|
1174
|
+
type: inputType,
|
|
1175
|
+
placeholder,
|
|
1176
|
+
required
|
|
799
1177
|
}
|
|
800
1178
|
)
|
|
801
1179
|
] });
|
|
802
|
-
}
|
|
1180
|
+
};
|
|
1181
|
+
const Config$6 = {
|
|
803
1182
|
type: "Input",
|
|
804
|
-
label: "
|
|
1183
|
+
label: "web_blocks.input",
|
|
805
1184
|
category: "core",
|
|
806
|
-
icon:
|
|
1185
|
+
icon: InputIcon,
|
|
807
1186
|
group: "form",
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
1187
|
+
...registerChaiBlockSchema({
|
|
1188
|
+
properties: {
|
|
1189
|
+
styles: StylesProp(""),
|
|
1190
|
+
inputStyles: StylesProp("w-full p-1"),
|
|
1191
|
+
fieldName: {
|
|
1192
|
+
type: "string",
|
|
1193
|
+
title: "Field Name",
|
|
1194
|
+
default: "fieldName"
|
|
1195
|
+
},
|
|
1196
|
+
showLabel: {
|
|
1197
|
+
type: "boolean",
|
|
1198
|
+
title: "Show Label",
|
|
1199
|
+
default: true
|
|
1200
|
+
},
|
|
1201
|
+
label: {
|
|
1202
|
+
type: "string",
|
|
1203
|
+
title: "Label",
|
|
1204
|
+
default: "Label",
|
|
1205
|
+
ai: true,
|
|
1206
|
+
i18n: true
|
|
1207
|
+
},
|
|
1208
|
+
placeholder: {
|
|
1209
|
+
type: "string",
|
|
1210
|
+
title: "Placeholder",
|
|
1211
|
+
default: "Placeholder"
|
|
1212
|
+
},
|
|
1213
|
+
required: {
|
|
1214
|
+
type: "boolean",
|
|
1215
|
+
title: "Required",
|
|
1216
|
+
default: false
|
|
1217
|
+
},
|
|
1218
|
+
inputType: {
|
|
1219
|
+
type: "string",
|
|
1220
|
+
title: "Input Type",
|
|
1221
|
+
default: "text",
|
|
1222
|
+
enum: [
|
|
1223
|
+
"text",
|
|
1224
|
+
"email",
|
|
1225
|
+
"password",
|
|
1226
|
+
"number",
|
|
1227
|
+
"tel",
|
|
1228
|
+
"file",
|
|
1229
|
+
"hidden",
|
|
1230
|
+
"range",
|
|
1231
|
+
"submit",
|
|
1232
|
+
"color",
|
|
1233
|
+
"date",
|
|
1234
|
+
"time"
|
|
1235
|
+
]
|
|
1236
|
+
}
|
|
848
1237
|
}
|
|
849
|
-
)
|
|
850
|
-
|
|
1238
|
+
}),
|
|
1239
|
+
aiProps: ["label", "placeholder"],
|
|
1240
|
+
i18nProps: ["label", "placeholder"]
|
|
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 }
|
|
1249
|
+
});
|
|
1250
|
+
};
|
|
1251
|
+
const Config$5 = {
|
|
1252
|
+
type: "Label",
|
|
1253
|
+
label: "Label",
|
|
1254
|
+
category: "core",
|
|
1255
|
+
icon: LetterCaseToggleIcon,
|
|
1256
|
+
group: "form",
|
|
1257
|
+
...registerChaiBlockSchema({
|
|
1258
|
+
properties: {
|
|
1259
|
+
styles: StylesProp(),
|
|
1260
|
+
content: {
|
|
1261
|
+
type: "string",
|
|
1262
|
+
title: "Content",
|
|
1263
|
+
default: ""
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
}),
|
|
1267
|
+
aiProps: ["content"],
|
|
1268
|
+
i18nProps: ["content"]
|
|
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 = {
|
|
851
1293
|
type: "Radio",
|
|
852
1294
|
label: "web_blocks.radio",
|
|
853
1295
|
category: "core",
|
|
854
|
-
icon:
|
|
1296
|
+
icon: RadiobuttonIcon,
|
|
855
1297
|
group: "form",
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1298
|
+
...registerChaiBlockSchema({
|
|
1299
|
+
properties: {
|
|
1300
|
+
styles: StylesProp("flex items-center gap-x-2"),
|
|
1301
|
+
inputStyles: StylesProp(""),
|
|
1302
|
+
fieldName: {
|
|
1303
|
+
type: "string",
|
|
1304
|
+
title: "Field Name",
|
|
1305
|
+
default: "fieldName"
|
|
1306
|
+
},
|
|
1307
|
+
label: {
|
|
1308
|
+
type: "string",
|
|
1309
|
+
title: "Label",
|
|
1310
|
+
default: "Label"
|
|
1311
|
+
},
|
|
1312
|
+
checked: {
|
|
1313
|
+
type: "boolean",
|
|
1314
|
+
title: "Checked",
|
|
1315
|
+
default: false
|
|
1316
|
+
},
|
|
1317
|
+
required: {
|
|
1318
|
+
type: "boolean",
|
|
1319
|
+
title: "Required",
|
|
1320
|
+
default: false
|
|
1321
|
+
},
|
|
1322
|
+
showLabel: {
|
|
1323
|
+
type: "boolean",
|
|
1324
|
+
title: "Show Label",
|
|
1325
|
+
default: true
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}),
|
|
1329
|
+
aiProps: ["label"],
|
|
1330
|
+
i18nProps: ["label"]
|
|
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
|
+
] });
|
|
862
1340
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
placeholder: a,
|
|
869
|
-
styles: r,
|
|
870
|
-
inputStyles: n,
|
|
871
|
-
required: i,
|
|
872
|
-
showLabel: c,
|
|
873
|
-
_multiple: d = !1
|
|
874
|
-
} = e, h = I();
|
|
875
|
-
return c ? /* @__PURE__ */ s.jsxs("div", { ...r, children: [
|
|
876
|
-
c && /* @__PURE__ */ s.jsx("label", { htmlFor: h, children: o }),
|
|
877
|
-
/* @__PURE__ */ s.jsxs("select", { ...n, id: h, required: i, multiple: d, name: t, children: [
|
|
878
|
-
/* @__PURE__ */ s.jsx("option", { value: "", disabled: !0, selected: !0, hidden: !0, children: a }),
|
|
879
|
-
M(e.options, (f) => /* @__PURE__ */ s.jsx(
|
|
880
|
-
"option",
|
|
881
|
-
{
|
|
882
|
-
selected: w(f, "selected", !1),
|
|
883
|
-
value: f.value,
|
|
884
|
-
dangerouslySetInnerHTML: { __html: f.label }
|
|
885
|
-
},
|
|
886
|
-
f.value
|
|
887
|
-
))
|
|
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))
|
|
888
1346
|
] })
|
|
889
|
-
] })
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
id: h,
|
|
893
|
-
...r,
|
|
894
|
-
...l,
|
|
895
|
-
required: i,
|
|
896
|
-
multiple: d,
|
|
897
|
-
name: t,
|
|
898
|
-
children: [
|
|
899
|
-
/* @__PURE__ */ s.jsx("option", { value: "", disabled: !0, selected: !0, hidden: !0, children: a }),
|
|
900
|
-
M(e.options, (f) => /* @__PURE__ */ s.jsx(
|
|
901
|
-
"option",
|
|
902
|
-
{
|
|
903
|
-
selected: w(f, "selected", !1),
|
|
904
|
-
value: f.value,
|
|
905
|
-
dangerouslySetInnerHTML: { __html: f.label }
|
|
906
|
-
},
|
|
907
|
-
f.value
|
|
908
|
-
))
|
|
909
|
-
]
|
|
910
|
-
}
|
|
911
|
-
);
|
|
912
|
-
}, pt = {
|
|
1347
|
+
] });
|
|
1348
|
+
};
|
|
1349
|
+
const Config$3 = {
|
|
913
1350
|
type: "Select",
|
|
914
1351
|
label: "web_blocks.select",
|
|
915
1352
|
category: "core",
|
|
916
|
-
icon:
|
|
1353
|
+
icon: DropdownMenuIcon,
|
|
917
1354
|
group: "form",
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1355
|
+
...registerChaiBlockSchema({
|
|
1356
|
+
properties: {
|
|
1357
|
+
styles: StylesProp(""),
|
|
1358
|
+
inputStyles: StylesProp("w-full p-1"),
|
|
1359
|
+
fieldName: {
|
|
1360
|
+
type: "string",
|
|
1361
|
+
title: "Field Name",
|
|
1362
|
+
default: "fieldName"
|
|
1363
|
+
},
|
|
1364
|
+
showLabel: {
|
|
1365
|
+
type: "boolean",
|
|
1366
|
+
title: "Show Label",
|
|
1367
|
+
default: true
|
|
1368
|
+
},
|
|
1369
|
+
label: {
|
|
1370
|
+
type: "string",
|
|
1371
|
+
title: "Label",
|
|
1372
|
+
default: "Label"
|
|
1373
|
+
},
|
|
1374
|
+
placeholder: {
|
|
1375
|
+
type: "string",
|
|
1376
|
+
title: "Placeholder",
|
|
1377
|
+
default: "Placeholder"
|
|
1378
|
+
},
|
|
1379
|
+
required: {
|
|
1380
|
+
type: "boolean",
|
|
1381
|
+
title: "Required",
|
|
1382
|
+
default: false
|
|
1383
|
+
},
|
|
1384
|
+
_multiple: {
|
|
1385
|
+
type: "boolean",
|
|
1386
|
+
title: "Multiple",
|
|
1387
|
+
default: false
|
|
1388
|
+
},
|
|
1389
|
+
options: {
|
|
1390
|
+
title: "Options",
|
|
1391
|
+
type: "array",
|
|
1392
|
+
default: [],
|
|
1393
|
+
items: {
|
|
1394
|
+
type: "object",
|
|
1395
|
+
properties: {
|
|
1396
|
+
label: {
|
|
1397
|
+
type: "string",
|
|
1398
|
+
title: "Label",
|
|
1399
|
+
default: ""
|
|
1400
|
+
},
|
|
1401
|
+
value: {
|
|
1402
|
+
type: "string",
|
|
1403
|
+
title: "Value",
|
|
1404
|
+
default: ""
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
935
1408
|
}
|
|
936
|
-
})
|
|
937
|
-
}
|
|
938
|
-
}, bt = (e) => {
|
|
939
|
-
const { blockProps: l, fieldName: t, label: o, placeholder: a, styles: r, inputStyles: n, _rows: i, showLabel: c } = e, d = I();
|
|
940
|
-
return c ? /* @__PURE__ */ s.jsxs("div", { ...r, ...l, children: [
|
|
941
|
-
c && /* @__PURE__ */ s.jsx("label", { htmlFor: d, children: o }),
|
|
942
|
-
/* @__PURE__ */ s.jsx("textarea", { name: t, ...n, id: d, placeholder: a, rows: i })
|
|
943
|
-
] }) : /* @__PURE__ */ s.jsx(
|
|
944
|
-
"textarea",
|
|
945
|
-
{
|
|
946
|
-
id: d,
|
|
947
|
-
name: t,
|
|
948
|
-
...l,
|
|
949
|
-
...n,
|
|
950
|
-
...r,
|
|
951
|
-
placeholder: a,
|
|
952
|
-
rows: i
|
|
953
1409
|
}
|
|
954
|
-
)
|
|
955
|
-
|
|
1410
|
+
}),
|
|
1411
|
+
aiProps: ["label", "placeholder"],
|
|
1412
|
+
i18nProps: ["label", "placeholder"]
|
|
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 = {
|
|
956
1437
|
type: "TextArea",
|
|
957
1438
|
label: "web_blocks.textarea",
|
|
958
1439
|
category: "core",
|
|
959
|
-
icon:
|
|
1440
|
+
icon: InputIcon,
|
|
960
1441
|
group: "form",
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
type: "
|
|
983
|
-
|
|
984
|
-
|
|
1442
|
+
...registerChaiBlockSchema({
|
|
1443
|
+
properties: {
|
|
1444
|
+
fieldName: {
|
|
1445
|
+
type: "string",
|
|
1446
|
+
title: "Field Name",
|
|
1447
|
+
default: "fieldName"
|
|
1448
|
+
},
|
|
1449
|
+
styles: StylesProp(""),
|
|
1450
|
+
inputStyles: StylesProp("w-full p-1"),
|
|
1451
|
+
showLabel: {
|
|
1452
|
+
type: "boolean",
|
|
1453
|
+
title: "Show Label",
|
|
1454
|
+
default: true
|
|
1455
|
+
},
|
|
1456
|
+
label: {
|
|
1457
|
+
type: "string",
|
|
1458
|
+
title: "Label",
|
|
1459
|
+
default: "Label",
|
|
1460
|
+
ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 3 }
|
|
1461
|
+
},
|
|
1462
|
+
placeholder: {
|
|
1463
|
+
type: "string",
|
|
1464
|
+
title: "Placeholder",
|
|
1465
|
+
default: "Placeholder"
|
|
1466
|
+
},
|
|
1467
|
+
_rows: {
|
|
1468
|
+
type: "number",
|
|
1469
|
+
title: "Rows",
|
|
1470
|
+
default: 3
|
|
985
1471
|
}
|
|
986
|
-
),
|
|
987
|
-
o && o !== "Label" && /* @__PURE__ */ s.jsx("label", { htmlFor: d, children: o })
|
|
988
|
-
] }) : /* @__PURE__ */ s.jsx(
|
|
989
|
-
"input",
|
|
990
|
-
{
|
|
991
|
-
id: d,
|
|
992
|
-
...l,
|
|
993
|
-
...r,
|
|
994
|
-
...a,
|
|
995
|
-
type: "checkbox",
|
|
996
|
-
required: n,
|
|
997
|
-
name: t
|
|
998
1472
|
}
|
|
999
|
-
)
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1473
|
+
}),
|
|
1474
|
+
aiProps: ["label", "placeholder"],
|
|
1475
|
+
i18nProps: ["label", "placeholder"]
|
|
1476
|
+
};
|
|
1477
|
+
const LineBreakBlock = (props) => {
|
|
1478
|
+
const { blockProps, styles } = props;
|
|
1479
|
+
return createElement("br", { ...blockProps, ...styles });
|
|
1480
|
+
};
|
|
1481
|
+
const Config$1 = {
|
|
1482
|
+
type: "LineBreak",
|
|
1483
|
+
label: "Line Break",
|
|
1003
1484
|
category: "core",
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1485
|
+
group: "basic",
|
|
1486
|
+
hidden: true,
|
|
1487
|
+
...registerChaiBlockSchema({
|
|
1488
|
+
properties: {
|
|
1489
|
+
styles: StylesProp("")
|
|
1490
|
+
}
|
|
1491
|
+
}),
|
|
1492
|
+
canAcceptBlock: () => true,
|
|
1493
|
+
canDelete: () => false,
|
|
1494
|
+
canMove: () => false,
|
|
1495
|
+
canDuplicate: () => false
|
|
1496
|
+
};
|
|
1497
|
+
const NUMBER_TO_COL_SPAN = {
|
|
1498
|
+
SMALL: {
|
|
1499
|
+
1: "col-span-1",
|
|
1500
|
+
2: "col-span-2",
|
|
1501
|
+
3: "col-span-3",
|
|
1502
|
+
4: "col-span-4",
|
|
1503
|
+
5: "col-span-5",
|
|
1504
|
+
6: "col-span-6",
|
|
1505
|
+
7: "col-span-7",
|
|
1506
|
+
8: "col-span-8",
|
|
1507
|
+
9: "col-span-9",
|
|
1508
|
+
10: "col-span-10",
|
|
1509
|
+
11: "col-span-11",
|
|
1510
|
+
12: "col-span-12"
|
|
1511
|
+
},
|
|
1512
|
+
MEDIUM: {
|
|
1513
|
+
1: "md:col-span-1",
|
|
1514
|
+
2: "md:col-span-2",
|
|
1515
|
+
3: "md:col-span-3",
|
|
1516
|
+
4: "md:col-span-4",
|
|
1517
|
+
5: "md:col-span-5",
|
|
1518
|
+
6: "md:col-span-6",
|
|
1519
|
+
7: "md:col-span-7",
|
|
1520
|
+
8: "md:col-span-8",
|
|
1521
|
+
9: "md:col-span-9",
|
|
1522
|
+
10: "md:col-span-10",
|
|
1523
|
+
11: "md:col-span-11",
|
|
1524
|
+
12: "md:col-span-12"
|
|
1525
|
+
},
|
|
1526
|
+
LARGE: {
|
|
1527
|
+
1: "lg:col-span-1",
|
|
1528
|
+
2: "lg:col-span-2",
|
|
1529
|
+
3: "lg:col-span-3",
|
|
1530
|
+
4: "lg:col-span-4",
|
|
1531
|
+
5: "lg:col-span-5",
|
|
1532
|
+
6: "lg:col-span-6",
|
|
1533
|
+
7: "lg:col-span-7",
|
|
1534
|
+
8: "lg:col-span-8",
|
|
1535
|
+
9: "lg:col-span-9",
|
|
1536
|
+
10: "lg:col-span-10",
|
|
1537
|
+
11: "lg:col-span-11",
|
|
1538
|
+
12: "lg:col-span-12"
|
|
1539
|
+
}
|
|
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 = {
|
|
1553
|
+
type: "Column",
|
|
1554
|
+
label: "Column",
|
|
1555
|
+
group: "basic",
|
|
1556
|
+
category: "core",
|
|
1557
|
+
icon: Columns,
|
|
1558
|
+
wrapper: true,
|
|
1559
|
+
canDelete: () => true,
|
|
1560
|
+
canAcceptBlock: () => true,
|
|
1561
|
+
canBeNested: (type) => type === "Row",
|
|
1562
|
+
...registerChaiBlockSchema({
|
|
1563
|
+
properties: {
|
|
1564
|
+
styles: StylesProp(""),
|
|
1565
|
+
colSpan: {
|
|
1566
|
+
type: "number",
|
|
1567
|
+
title: "Column Span",
|
|
1568
|
+
default: 6,
|
|
1569
|
+
enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
|
1570
|
+
},
|
|
1571
|
+
tabletColSpan: {
|
|
1572
|
+
type: "number",
|
|
1573
|
+
title: "Column Span (Tablet)",
|
|
1574
|
+
default: null,
|
|
1575
|
+
enumNames: ["Default", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
1576
|
+
enum: [null, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
|
1577
|
+
},
|
|
1578
|
+
desktopColSpan: {
|
|
1579
|
+
type: "number",
|
|
1580
|
+
title: "Column Span (Desktop)",
|
|
1581
|
+
default: null,
|
|
1582
|
+
enumNames: ["Default", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
1583
|
+
enum: [null, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
})
|
|
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` };
|
|
1012
1596
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1597
|
+
return /* @__PURE__ */ jsx("div", { ...blockProps, ...styles, ..._styles, children });
|
|
1598
|
+
};
|
|
1599
|
+
const Config = {
|
|
1600
|
+
type: "Row",
|
|
1601
|
+
label: "Row",
|
|
1602
|
+
group: "basic",
|
|
1603
|
+
icon: Rows,
|
|
1604
|
+
blocks: () => [
|
|
1605
|
+
{ _type: "Row", _id: "row", styles: "#styles:,p-1" },
|
|
1606
|
+
{ _type: "Column", id: "column", _parent: "row", styles: "#styles:," },
|
|
1607
|
+
{ _type: "Column", id: "column", _parent: "row", styles: "#styles:," }
|
|
1608
|
+
],
|
|
1609
|
+
category: "core",
|
|
1610
|
+
wrapper: true,
|
|
1611
|
+
canAcceptBlock: (childType) => childType === "Column",
|
|
1612
|
+
...registerChaiBlockSchema({
|
|
1613
|
+
properties: {
|
|
1614
|
+
styles: StylesProp(""),
|
|
1615
|
+
colCount: {
|
|
1616
|
+
type: "number",
|
|
1617
|
+
default: 2,
|
|
1618
|
+
minimum: 0,
|
|
1619
|
+
ui: { "ui:widget": "colCount" }
|
|
1620
|
+
},
|
|
1621
|
+
gutter: {
|
|
1622
|
+
type: "number",
|
|
1623
|
+
title: "Gutter (in px)",
|
|
1624
|
+
default: 16,
|
|
1625
|
+
minimum: 0
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
})
|
|
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);
|
|
1015
1661
|
};
|
|
1016
1662
|
export {
|
|
1017
|
-
|
|
1663
|
+
loadWebBlocks
|
|
1018
1664
|
};
|