@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.
Files changed (56) hide show
  1. package/README.md +1 -3
  2. package/dist/ChaiThemeFn-DcE5RdLQ.cjs +236 -0
  3. package/dist/ChaiThemeFn-DzirXKjI.js +237 -0
  4. package/dist/CodeEditor-C8_JzwHn.cjs +81 -0
  5. package/dist/CodeEditor-DdIk_PEV.js +81 -0
  6. package/dist/Topbar-62QmCKWL.cjs +18 -0
  7. package/dist/Topbar-Cqt0j3Yt.js +18 -0
  8. package/dist/chaibuilder-logo.png +0 -0
  9. package/dist/context-menu-DHla8ofZ.js +893 -0
  10. package/dist/context-menu-DawHUIXd.cjs +923 -0
  11. package/dist/core.cjs +11589 -18
  12. package/dist/core.d.ts +108 -47
  13. package/dist/core.js +9555 -6679
  14. package/dist/getSplitClasses-BuALfSLX.js +54 -0
  15. package/dist/getSplitClasses-mbQmvwI3.cjs +53 -0
  16. package/dist/iconBase-BSrIcOaG.cjs +146 -0
  17. package/dist/iconBase-CWgVxu0A.js +147 -0
  18. package/dist/mockServiceWorker.js +39 -24
  19. package/dist/plugin-BcTnEZwx.cjs +26 -0
  20. package/dist/plugin-DGEKY3uC.js +27 -0
  21. package/dist/render.cjs +247 -2
  22. package/dist/render.d.ts +41 -16
  23. package/dist/render.js +224 -142
  24. package/dist/runtime.cjs +9 -1
  25. package/dist/runtime.d.ts +6 -1
  26. package/dist/runtime.js +0 -20
  27. package/dist/sdk.css +1341 -0
  28. package/dist/tailwind.cjs +78 -1
  29. package/dist/tailwind.d.ts +37 -26
  30. package/dist/tailwind.js +21 -21
  31. package/dist/ui.cjs +378 -1
  32. package/dist/ui.d.ts +12 -51
  33. package/dist/ui.js +262 -349
  34. package/dist/web-blocks.cjs +1679 -2
  35. package/dist/web-blocks.d.ts +6 -0
  36. package/dist/web-blocks.js +1502 -856
  37. package/package.json +135 -132
  38. package/dist/CodeEditor-19TqmVgI.cjs +0 -1
  39. package/dist/CodeEditor-b5DU6y6j.js +0 -126
  40. package/dist/STRINGS-Xxstm-7I.js +0 -7
  41. package/dist/STRINGS-Yl7cSWDc.cjs +0 -1
  42. package/dist/Topbar-lGFRGO4j.js +0 -73
  43. package/dist/Topbar-ql6BS8c6.cjs +0 -1
  44. package/dist/context-menu-MPtzs1fu.cjs +0 -1
  45. package/dist/context-menu-XEyVy2qm.js +0 -903
  46. package/dist/controls-lEwMTdPQ.js +0 -234
  47. package/dist/controls-p9IwFnPx.cjs +0 -1
  48. package/dist/iconBase-Ief2hJUZ.js +0 -130
  49. package/dist/iconBase-aZzpqff_.cjs +0 -1
  50. package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
  51. package/dist/jsx-runtime-Sp0orL4X.js +0 -631
  52. package/dist/plugin-Dm5EFGnP.cjs +0 -1
  53. package/dist/plugin-KIpT3NWi.cjs +0 -1
  54. package/dist/plugin-PFjzFeON.js +0 -97
  55. package/dist/plugin-ooqqxWRQ.js +0 -55
  56. package/dist/style.css +0 -6
@@ -1,351 +1,728 @@
1
- import { registerChaiBlock as u } from "@chaibuilder/runtime";
2
- import { j as s } from "./jsx-runtime-Sp0orL4X.js";
3
- import * as b from "react";
4
- import { T as m, y as v, x as C, g as p, q as N, s as B, l as T, f as L, m as S, w as D, c as y, b as F, S as G } from "./controls-lEwMTdPQ.js";
5
- import { c as j, G as V, g as I } from "./iconBase-Ief2hJUZ.js";
6
- import { ButtonIcon as H, CodeIcon as U, HeadingIcon as O, TextIcon as W, CursorTextIcon as X, Link1Icon as Y, ImageIcon as z, RowsIcon as Z, ColumnsIcon as J, SketchLogoIcon as K, VideoIcon as Q, DividerHorizontalIcon as ee, MoonIcon as te, SpaceBetweenVerticallyIcon as A, GroupIcon as le, InputIcon as R, RadiobuttonIcon as oe, DropdownMenuIcon as ae, CheckboxIcon as se } from "@radix-ui/react-icons";
7
- import { isNull as re, isEmpty as k, get as w, pick as ne, omit as ie, map as M } from "lodash-es";
8
- import { GlobeIcon as ce } from "lucide-react";
9
- import "clsx";
10
- import "tailwind-merge";
11
- const de = ({ className: e = "", inBuilder: l }) => l ? /* @__PURE__ */ s.jsx("div", { className: j("pointer-events-none flex h-20 flex-col items-center justify-center p-2", e), children: /* @__PURE__ */ s.jsx("div", { className: "h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800", children: /* @__PURE__ */ s.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" }) }) }) : null, _ = de, ue = (e) => {
12
- const { blockProps: l, inBuilder: t, backgroundImage: o, children: a, tag: r = "div", styles: n } = e;
13
- let i = a;
14
- a || (i = /* @__PURE__ */ s.jsx(_, { inBuilder: t }));
15
- let c = {};
16
- return o && (c = { backgroundImage: `url(${o})` }), b.createElement(r, { ...l, ...n, style: c }, i);
17
- }, pe = {
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: "web_blocks.box",
27
+ label: "Box",
20
28
  category: "core",
21
29
  group: "basic",
22
- props: {
23
- styles: m({ default: "" }),
24
- tag: v({
25
- title: "web_blocks.tag",
26
- default: "div",
27
- options: [
28
- { value: "div", title: "web_blocks.div" },
29
- { value: "header", title: "web_blocks.header" },
30
- { value: "footer", title: "web_blocks.footer" },
31
- { value: "section", title: "web_blocks.section" },
32
- { value: "article", title: "web_blocks.article" },
33
- { value: "aside", title: "web_blocks.aside" },
34
- { value: "main", title: "web_blocks.main" },
35
- { value: "nav", title: "web_blocks.nav" },
36
- { value: "figure", title: "web_blocks.figure" },
37
- { value: "details", title: "web_blocks.details" },
38
- { value: "summary", title: "web_blocks.summary" },
39
- { value: "dialog", title: "web_blocks.dialog" },
40
- { value: "strike", title: "web_blocks.strike" },
41
- { value: "caption", title: "web_blocks.caption" },
42
- { value: "legend", title: "web_blocks.legend" },
43
- { value: "figcaption", title: "web_blocks.figcaption" },
44
- { value: "mark", title: "web_blocks.mark" }
45
- ]
46
- }),
47
- backgroundImage: C({ title: "web_blocks.background_image" })
48
- },
49
- canAcceptBlock: () => !0
50
- }, be = (e) => {
51
- const { blockProps: l, iconSize: t, icon: o, content: a, iconPos: r, styles: n, children: i } = e, c = o, d = i || /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
52
- /* @__PURE__ */ s.jsx("span", { "data-ai-key": "content", children: a }),
53
- c && /* @__PURE__ */ s.jsx(
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: t + "px" },
57
- className: r + " " + (r === "order-first" ? "mr-2" : "ml-2") || "",
58
- dangerouslySetInnerHTML: { __html: c }
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
- return b.createElement(
81
+ const button = createElement(
63
82
  "button",
64
83
  {
65
- ...l,
66
- ...n,
67
- type: "button"
84
+ ...blockProps,
85
+ ...styles,
86
+ type: "button",
87
+ "aria-label": content
68
88
  },
69
- d
89
+ child
70
90
  );
71
- }, me = {
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: "web_blocks.button",
102
+ label: "Button",
74
103
  category: "core",
75
- icon: H,
104
+ icon: ButtonIcon,
76
105
  group: "basic",
77
- props: {
78
- content: p({ title: "web_blocks.label", default: "Button", ai: !0, i18n: !0 }),
79
- styles: m({ default: "text-white bg-primary px-4 py-2 rounded-global flex items-center" }),
80
- icon: N({ title: "web_blocks.icon", default: "" }),
81
- iconSize: B({ title: "web_blocks.icon_size", default: 24 }),
82
- iconPos: v({
83
- title: "web_blocks.icon_position",
84
- default: "order-last",
85
- options: [
86
- { title: "web_blocks.start", value: "order-first" },
87
- { title: "web_blocks.end", value: "order-last" }
88
- ]
89
- })
90
- }
91
- }, fe = (e) => {
92
- const { blockProps: l, styles: t, htmlCode: o, inBuilder: a } = e;
93
- return a ? /* @__PURE__ */ s.jsxs("div", { className: "relative", children: [
94
- a ? /* @__PURE__ */ s.jsx("div", { ...l, ...t, className: "absolute z-20 h-full w-full" }) : null,
95
- b.createElement("div", {
96
- ...t,
97
- dangerouslySetInnerHTML: { __html: o.replace(/<script.*?>.*?<\/script>/g, "") }
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
- ] }) : b.createElement("div", {
100
- ...l,
101
- ...t,
102
- dangerouslySetInnerHTML: { __html: o }
160
+ ] }) : React.createElement("div", {
161
+ ...blockProps,
162
+ ...styles,
163
+ dangerouslySetInnerHTML: { __html: htmlCode }
103
164
  });
104
- }, he = {
165
+ };
166
+ const Config$q = {
105
167
  type: "CustomHTML",
106
168
  label: "web_blocks.custom_html",
107
169
  category: "core",
108
- icon: U,
170
+ icon: CodeIcon,
109
171
  group: "advanced",
110
- props: {
111
- styles: m({ default: "" }),
112
- htmlCode: T({
113
- title: "web_blocks.html_code",
114
- default: "<div><p>Enter your HTML code here...</p></div>",
115
- placeholder: "web_blocks.placeholder"
116
- })
117
- }
118
- }, ye = b.memo(
119
- (e) => {
120
- const { blockProps: l, styles: t, backgroundImage: o } = e;
121
- let a = {};
122
- return o && (a = { backgroundImage: `url(${o})` }), b.createElement("div", { ...l, ...t, style: a });
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
- ), ge = {
189
+ return React.createElement("div", { ...blockProps, ...styles, style: cssStyles });
190
+ };
191
+ const Config$p = {
125
192
  type: "EmptyBox",
126
- label: "web_blocks.empty_box",
193
+ label: "Empty Box",
127
194
  category: "core",
128
195
  group: "basic",
129
- props: {
130
- styles: m({ default: "" }),
131
- backgroundImage: C({ title: "Background Image" })
132
- }
133
- }, ke = (e) => {
134
- const { blockProps: l, styles: t, content: o, level: a = "h1", children: r = null } = e;
135
- return r ? b.createElement(a, { ...t, ...l }, r) : b.createElement(a, {
136
- ...t,
137
- ...l,
138
- "data-ai-key": "content",
139
- "data-ai-type": "html",
140
- dangerouslySetInnerHTML: { __html: o }
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
- }, xe = {
216
+ };
217
+ const Config$o = {
143
218
  type: "Heading",
144
219
  label: "web_blocks.heading",
145
220
  category: "core",
146
- icon: O,
221
+ icon: HeadingIcon,
147
222
  group: "typography",
148
- props: {
149
- level: v({
150
- title: "web_blocks.level",
151
- default: "h2",
152
- binding: !1,
153
- options: [
154
- { value: "h1", title: "h1" },
155
- { value: "h2", title: "h2" },
156
- { value: "h3", title: "h3" },
157
- { value: "h4", title: "h4" },
158
- { value: "h5", title: "h5" },
159
- { value: "h6", title: "h6" }
160
- ]
161
- }),
162
- styles: m({ default: "text-3xl" }),
163
- content: L({ title: "Content", default: "Heading goes here", ai: !0, i18n: !0 })
164
- },
165
- canAcceptBlock: (e) => e === "Span" || e === "Text"
166
- }, we = (e) => {
167
- const { blockProps: l, styles: t, content: o } = e;
168
- return re(e.children) ? b.createElement("p", {
169
- ...t,
170
- ...l,
171
- "data-ai-key": "content",
172
- "data-ai-type": "html",
173
- dangerouslySetInnerHTML: { __html: o }
174
- }) : b.createElement("p", { ...t, ...l }, e.children);
175
- }, ve = {
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: W,
257
+ icon: TextIcon,
180
258
  group: "typography",
181
- props: {
182
- styles: m({ default: "" }),
183
- content: L({
184
- title: "Content",
185
- default: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
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
- ai: !0,
189
- i18n: !0
190
- })
191
- },
192
- canAcceptBlock: (e) => e === "Span" || e === "Link" || e === "Text"
193
- }, _e = (e) => {
194
- const { blockProps: l, styles: t, content: o, children: a = null, tag: r } = e;
195
- return a ? b.createElement("span", { ...t, ...l }, a) : b.createElement(r || "span", {
196
- ...t,
197
- ...l,
198
- "data-ai-key": "content",
199
- dangerouslySetInnerHTML: { __html: o || "" }
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
- }, Ie = {
315
+ };
316
+ const Config$l = {
202
317
  type: "Span",
203
318
  label: "Span",
204
319
  category: "core",
205
320
  group: "typography",
206
- props: {
207
- styles: m({ default: "" }),
208
- content: L({ title: "Content", default: "", ai: !0, i18n: !0 })
209
- },
210
- canAcceptBlock: () => !0
211
- }, Be = (e) => {
212
- const { blockProps: l, content: t, styles: o } = e;
213
- return /* @__PURE__ */ s.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ s.jsx(
214
- "div",
215
- {
216
- "data-ai-key": "content",
217
- "data-ai-type": "richtext",
218
- ...l,
219
- ...o,
220
- dangerouslySetInnerHTML: { __html: t }
221
- }
222
- ) });
223
- }, Le = {
224
- type: "RichText",
225
- label: "Rich Text",
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: X,
228
- group: "typography",
229
- props: {
230
- styles: m({ default: "" }),
231
- content: S({
232
- title: "Content",
233
- ai: !0,
234
- i18n: !0,
235
- default: "<p>This is a rich text block. You can add text, and other content here.</p>"
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
- }, je = (e) => {
239
- const { blockProps: l, link: t, children: o, styles: a, inBuilder: r, content: n } = e;
240
- let i = {};
241
- return !o && k(n) && (i = { minHeight: "50px", display: "flex", alignItems: "center", justifyContent: "center" }), r ? o ? /* @__PURE__ */ s.jsx("span", { ...l, style: i, ...a, children: o }) : b.createElement(
242
- "span",
243
- {
244
- ...l,
245
- ...a,
246
- style: i,
247
- "data-ai-key": "content"
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
- n
250
- ) : o ? /* @__PURE__ */ s.jsx("a", { href: (t == null ? void 0 : t.href) || "#/", target: t == null ? void 0 : t.target, ...l, ...a, children: o }) : b.createElement(
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
- ...l,
254
- ...a,
255
- "data-ai-key": "content",
256
- href: (t == null ? void 0 : t.href) || "#",
257
- target: (t == null ? void 0 : t.target) || "_self"
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
- n
653
+ content
260
654
  );
261
- }, Ce = {
655
+ };
656
+ const Config$e = {
262
657
  type: "Link",
263
658
  label: "Link",
264
659
  category: "core",
265
- icon: Y,
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
- props: {
304
- styles: m({ default: "" }),
305
- content: p({ title: "Content", default: "Link text or drop blocks inside", ai: !0, i18n: !0 }),
306
- href: p({ title: "Href", default: "" }),
307
- hrefType: v({
308
- title: "Type",
309
- default: "video",
310
- options: [
311
- { value: "video", title: "Video" },
312
- { value: "iframe", title: "Iframe" },
313
- { value: "inline", title: "Inline" },
314
- { value: "ajax", title: "Ajax" }
315
- ]
316
- }),
317
- autoplay: y({ title: "Autoplay", default: !1 }),
318
- maxWidth: B({ title: "Max Width", default: "" }),
319
- backdropColor: p({ title: "Backdrop Color", default: "" }),
320
- galleryName: p({ title: "Gallery Name", default: "" })
321
- },
322
- canAcceptBlock: (e) => e !== "Link" && e !== "LightBoxLink"
323
- }, Ne = (e) => {
324
- const { blockProps: l, children: t, listType: o, styles: a, tag: r, inBuilder: n } = e, i = j(w(a, "className", ""), o);
325
- return !t && k(a == null ? void 0 : a.className) ? /* @__PURE__ */ s.jsx(_, { inBuilder: n }) : b.createElement(
326
- r || (o === "list-decimal" ? "ol" : "ul"),
327
- { ...l, ...a, className: i },
328
- t
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
- }, Pe = {
703
+ };
704
+ const Config$d = {
331
705
  type: "List",
332
706
  label: "web_blocks.list",
333
- icon: Z,
707
+ icon: RowsIcon,
334
708
  category: "core",
335
709
  group: "basic",
336
- props: {
337
- styles: m({ default: "" }),
338
- listType: v({
339
- title: "web_blocks.list_type",
340
- default: "list-none",
341
- options: [
342
- { value: "list-none", title: "web_blocks.none" },
343
- { value: "list-disc", title: "web_blocks.disc" },
344
- { value: "list-decimal", title: "web_blocks.number" }
345
- ]
346
- })
347
- },
348
- canAcceptBlock: (e) => e === "ListItem",
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
- }, Ee = (e) => {
374
- const { blockProps: l, content: t, styles: o, children: a, tag: r } = e;
375
- return a ? b.createElement(r || "li", { ...o, ...l }, a) : b.createElement(r || "li", {
376
- ...o,
377
- ...l,
378
- "data-ai-key": "content",
379
- dangerouslySetInnerHTML: { __html: t }
380
- });
381
- }, $e = {
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: J,
765
+ icon: ColumnsIcon,
385
766
  category: "core",
386
767
  group: "basic",
387
- props: {
388
- styles: m({ default: "" }),
389
- content: L({ title: "Content", default: "List item", ai: !0, i18n: !0 })
390
- },
391
- canAcceptBlock: (e) => e !== "ListItem",
392
- canBeNested: (e) => e === "List"
393
- }, Te = (e) => {
394
- const { blockProps: l, icon: t, styles: o, width: a, inBuilder: r, height: n } = e, i = q(o, j(a ? `w-[${a}px]` : "", n ? `h-[${n}px]` : ""));
395
- if (k(t))
396
- return /* @__PURE__ */ s.jsx(_, { inBuilder: r, className: "h-8 w-14" });
397
- const c = t.replace(/<svg /g, '<svg class="w-[inherit] h-[inherit]" ');
398
- return b.createElement("span", {
399
- ...l,
400
- ...i,
401
- dangerouslySetInnerHTML: { __html: c }
402
- });
403
- }, He = {
404
- type: "Icon",
405
- label: "web_blocks.icon",
406
- category: "core",
407
- icon: K,
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
- }, ze = (e) => {
419
- const { blockProps: l, image: t, styles: o, alt: a, height: r, width: n, lazyLoading: i } = e;
420
- return k(t) ? /* @__PURE__ */ s.jsx(_, { className: "h-36" }) : b.createElement("img", {
421
- ...l,
422
- ...o,
423
- src: t,
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
- icon: z,
434
- group: "media",
435
- props: {
436
- styles: m({ default: "" }),
437
- image: C({
438
- title: "Image",
439
- default: "https://fakeimg.pl/400x200?text=Choose&font=bebas"
440
- }),
441
- alt: p({ title: "Alt text", default: "", ai: !0, i18n: !0 }),
442
- width: p({ title: "Width", default: "" }),
443
- height: p({ title: "Height", default: "" }),
444
- lazyLoading: y({ title: "Lazy Load", default: !0 })
445
- }
446
- }, P = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/, E = /^(https?:\/\/)?(www\.)?player.vimeo\.com/, $ = /^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/, Re = (e) => {
447
- if (P.test(e)) {
448
- const l = e.match(P);
449
- return l ? `https://www.youtube.com/embed/${l[4]}` : e;
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 (E.test(e)) {
452
- const l = e.match(E);
453
- return l ? `https://player.vimeo.com/video/${l[3]}` : e;
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 ($.test(e)) {
456
- const l = e.match($);
457
- return l ? `https://www.dailymotion.com/embed/video/${l[4]}` : e;
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
- }, qe = b.memo(
461
- (e) => {
462
- const { blockProps: l, inBuilder: t, styles: o, url: a, controls: r } = e, n = w(r, "autoPlay", !1), i = w(r, "controls", !1), c = n || w(r, "muted", !0), d = w(r, "loop", !1);
463
- if (k(a))
464
- return /* @__PURE__ */ s.jsx(_, { inBuilder: t, className: "h-36" });
465
- let h = Re(a), f = null;
466
- if (h) {
467
- if (!k(h)) {
468
- const g = [];
469
- g.push(`autoplay=${n ? 1 : 0}`), g.push(`controls=${r ? 1 : 0}`), g.push(`mute=${c ? 1 : 0}&muted=${c ? 1 : 0}`), g.push(`loop=${d ? 1 : 0}`), h = `${h}?${g.join("&")}`;
470
- }
471
- f = b.createElement("iframe", {
472
- ...l,
473
- className: "absolute inset-0 w-full h-full",
474
- src: h,
475
- allow: t ? "" : "autoplay *; fullscreen *",
476
- allowFullScreen: !0,
477
- frameBorder: 0
478
- });
479
- } else
480
- f = b.createElement("video", {
481
- ...l,
482
- className: "absolute inset-0 w-full h-full",
483
- src: a,
484
- controls: i,
485
- muted: c,
486
- autoPlay: t ? !1 : n,
487
- loop: d
488
- });
489
- return /* @__PURE__ */ s.jsx("div", { ...ne(o, ["className"]), children: /* @__PURE__ */ s.jsxs("div", { className: "relative w-full overflow-hidden", style: { paddingBottom: "56.25%" }, children: [
490
- t ? /* @__PURE__ */ s.jsx("div", { ...l, ...ie(o, ["className"]), className: "absolute inset-0 z-20 h-full w-full" }) : null,
491
- f
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
- ), De = {
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: Q,
887
+ icon: VideoIcon,
499
888
  group: "media",
500
- props: {
501
- styles: m({ default: "" }),
502
- url: p({
503
- title: "Video URL",
504
- default: "https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann",
505
- i18n: !0
506
- }),
507
- controls: F({
508
- title: "Controls",
509
- properties: {
510
- autoPlay: y({ title: "Autoplay", default: !0 }),
511
- controls: y({ title: "Controls", default: !1 }),
512
- loop: y({ title: "Loop", default: !1 }),
513
- muted: y({ title: "Muted", default: !0 })
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
- function Fe(e) {
519
- return V({ 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: [] }] })(e);
520
- }
521
- const Ge = (e) => {
522
- const { scripts: l, inBuilder: t, blockProps: o } = e;
523
- return t ? /* @__PURE__ */ s.jsx("div", { ...o, children: /* @__PURE__ */ s.jsx("div", { className: j("pointer-events-none flex flex-col items-center justify-center p-2", ""), children: /* @__PURE__ */ s.jsx("div", { className: "h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800", children: /* @__PURE__ */ s.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" }) }) }) }) : /* @__PURE__ */ s.jsx("div", { dangerouslySetInnerHTML: { __html: l } });
524
- }, Ve = {
525
- type: "CustomScript",
526
- label: "web_blocks.custom_script",
527
- category: "core",
528
- icon: Fe,
529
- group: "advanced",
530
- props: {
531
- scripts: T({
532
- title: "Script",
533
- default: "",
534
- placeholder: "<script>console.log('Hello, world!');<\/script>"
535
- })
536
- }
537
- }, Ue = (e) => {
538
- const { blockProps: l, styles: t } = e;
539
- return b.createElement("hr", { ...t, ...l });
540
- }, Oe = {
541
- type: "Divider",
542
- label: "web_blocks.divider",
543
- category: "core",
544
- icon: ee,
545
- group: "basic",
546
- props: {
547
- styles: m({ default: "bg-gray-900 h-0.5 py-2 my-1" })
548
- }
549
- }, We = () => null, Xe = {
550
- type: "Dark Mode",
551
- label: "web_blocks.dark_mode",
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: te,
554
- group: "advanced",
555
- props: {},
556
- blocks: () => [
557
- { _id: "ultqCh", _type: "Span", tag: "span", styles: "#styles:,", _name: "Dark Mode Switcher" },
558
- {
559
- _id: "vroabi",
560
- _parent: "ultqCh",
561
- _type: "Button",
562
- // @ts-ignore
563
- styles_attrs: { type: "button", "x-on:click": "darkMode = 'dark'", "x-show": "darkMode === 'light'" },
564
- 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",
565
- _name: "Dark Mode Btn"
566
- },
567
- {
568
- _id: "eweibk",
569
- _parent: "vroabi",
570
- _type: "Span",
571
- tag: "span",
572
- styles: "#styles:,group inline-flex shrink-0 justify-center items-center size-9"
573
- },
574
- {
575
- _id: "nltBrv",
576
- _parent: "eweibk",
577
- _type: "Icon",
578
- styles: "#styles:, shrink-0 size-4",
579
- 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'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"
580
- },
581
- {
582
- _id: "gesydi",
583
- _parent: "ultqCh",
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
- ) : b.createElement("div", { ...l }, o);
621
- }, Ze = {
622
- type: "GlobalBlock",
623
- label: "Global Block",
624
- icon: ce,
625
- category: "core",
626
- group: "advanced",
627
- props: {
628
- globalBlock: p({ title: "global block", default: "", hidden: !0 })
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
- }, ot = (e) => {
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
- }, f = {
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__ */ s.jsxs(
1018
+ return /* @__PURE__ */ jsxs(
683
1019
  "form",
684
1020
  {
685
- ...h,
686
- "data-error": t,
687
- "data-success": r,
1021
+ ...alpineAttrs,
1022
+ "data-error": errorMessage,
1023
+ "data-success": successMessage,
688
1024
  method: "post",
689
- action: n,
690
- ...l,
691
- ...i,
1025
+ action,
1026
+ ...blockProps,
1027
+ ...styles,
692
1028
  children: [
693
- /* @__PURE__ */ s.jsx("div", { ...f }),
694
- /* @__PURE__ */ s.jsx("input", { name: "formname", type: "hidden", value: o || a }),
695
- d
1029
+ /* @__PURE__ */ jsx("div", { ...formResponseAttr }),
1030
+ nestedChildren
696
1031
  ]
697
1032
  }
698
1033
  );
699
- }, at = {
1034
+ };
1035
+ const Config$8 = {
700
1036
  type: "Form",
701
1037
  label: "Form",
702
1038
  category: "core",
703
- icon: le,
1039
+ icon: GroupIcon,
704
1040
  group: "form",
705
- props: {
706
- styles: m({ default: "" }),
707
- action: p({
708
- title: "Submit URL",
709
- default: "/api/form/submit"
710
- }),
711
- errorMessage: S({
712
- title: "Error Message",
713
- default: "Something went wrong. Please try again"
714
- }),
715
- successMessage: S({
716
- title: "Success Message",
717
- default: "Thank you for your submission."
718
- })
719
- },
720
- canAcceptBlock: () => !0
721
- }, st = (e) => {
722
- const { blockProps: l, inBuilder: t, label: o, styles: a, inputStyles: r, icon: n, iconPos: i } = e, c = I(), d = {
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__ */ s.jsxs(
1083
+ return /* @__PURE__ */ jsxs(
726
1084
  "button",
727
1085
  {
728
- id: c,
729
- ...d,
730
- ...r,
731
- ...a,
732
- ...l || {},
733
- type: t ? "button" : "submit",
1086
+ id: fieldId,
1087
+ ...attrs,
1088
+ ...inputStyles,
1089
+ ...styles,
1090
+ ...blockProps || {},
1091
+ type: inBuilder ? "button" : "submit",
1092
+ "aria-label": label,
734
1093
  children: [
735
- o,
736
- n && /* @__PURE__ */ s.jsx("span", { className: i, dangerouslySetInnerHTML: { __html: n } })
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
- }, rt = {
1106
+ };
1107
+ const Config$7 = {
741
1108
  type: "FormButton",
742
1109
  label: "Submit Button",
743
1110
  category: "core",
744
- icon: H,
1111
+ icon: ButtonIcon,
745
1112
  group: "form",
746
- props: {
747
- label: p({ title: "Label", default: "Submit", ai: !0, i18n: !0 }),
748
- styles: m({
749
- default: "text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"
750
- }),
751
- icon: N({ title: "Icon", default: "" }),
752
- iconPos: v({
753
- title: "Icon Position",
754
- default: "order-last",
755
- options: [
756
- { title: "Start", value: "order-first" },
757
- { title: "End", value: "order-last" }
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
- }, nt = (e) => {
762
- const {
763
- blockProps: l,
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: h,
793
- readOnly: d,
794
- ...r,
795
- id: f,
796
- type: c,
797
- placeholder: o,
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
- }, it = {
1180
+ };
1181
+ const Config$6 = {
803
1182
  type: "Input",
804
- label: "Input",
1183
+ label: "web_blocks.input",
805
1184
  category: "core",
806
- icon: R,
1185
+ icon: InputIcon,
807
1186
  group: "form",
808
- props: {
809
- styles: m({ default: "" }),
810
- fieldName: p({ title: "Field Name", default: "input" }),
811
- inputType: v({
812
- title: "Type",
813
- options: M(
814
- ["text", "email", "password", "number", "tel", "file", "hidden", "range", "submit", "color", "date", "time"],
815
- (e) => ({
816
- value: e,
817
- title: e
818
- })
819
- ),
820
- default: "text"
821
- }),
822
- value: p({ title: "Value", default: "", ai: !0, i18n: !0 }),
823
- showLabel: y({ title: "Show Label", default: !0 }),
824
- inputStyles: m({ default: "w-full p-1" }),
825
- label: p({ title: "Label", default: "Label", ai: !0, i18n: !0 }),
826
- placeholder: p({
827
- title: "Placeholder",
828
- default: "Placeholder"
829
- }),
830
- required: y({ title: "Required", default: !1 })
831
- }
832
- }, ct = (e) => {
833
- const { blockProps: l, fieldName: t, label: o, styles: a, inputStyles: r, checked: n, required: i, showLabel: c = !0 } = e, d = I();
834
- return c ? /* @__PURE__ */ s.jsxs("div", { ...a, ...l, children: [
835
- /* @__PURE__ */ s.jsx("input", { ...r, name: t, id: d, type: "radio", required: i, defaultChecked: n }),
836
- o && /* @__PURE__ */ s.jsx("label", { htmlFor: d, children: o })
837
- ] }) : /* @__PURE__ */ s.jsx(
838
- "input",
839
- {
840
- id: d,
841
- ...l,
842
- ...r,
843
- ...a,
844
- type: "radio",
845
- required: i,
846
- checked: n,
847
- name: t
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
- }, dt = {
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: oe,
1296
+ icon: RadiobuttonIcon,
855
1297
  group: "form",
856
- props: {
857
- styles: m({ default: "flex items-center w-max gap-x-2" }),
858
- fieldName: p({ title: "web_blocks.field_name", default: "radio" }),
859
- label: p({ title: "web_blocks.label", default: "Label" }),
860
- checked: y({ title: "web_blocks.checked", default: !1 }),
861
- required: y({ title: "web_blocks.required", default: !1 })
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
- }, ut = (e) => {
864
- const {
865
- blockProps: l,
866
- fieldName: t,
867
- label: o,
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
- ] }) : /* @__PURE__ */ s.jsxs(
890
- "select",
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: ae,
1353
+ icon: DropdownMenuIcon,
917
1354
  group: "form",
918
- props: {
919
- styles: m({ default: "" }),
920
- fieldName: p({ title: "Field Name", default: "select" }),
921
- showLabel: y({ title: "Show Label", default: !0 }),
922
- inputStyles: m({ default: "w-full p-1" }),
923
- label: p({ title: "Label", default: "Label", ai: !0, i18n: !0 }),
924
- placeholder: p({
925
- title: "Placeholder",
926
- default: "Placeholder"
927
- }),
928
- required: y({ title: "Required", default: !1 }),
929
- _multiple: y({ title: "Multiple", default: !1 }),
930
- options: G({
931
- title: "Options",
932
- itemProperties: {
933
- label: p({ title: "Label", default: "", ai: !0, i18n: !0 }),
934
- value: p({ title: "Value", default: "" })
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
- }, mt = {
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: R,
1440
+ icon: InputIcon,
960
1441
  group: "form",
961
- props: {
962
- fieldName: p({ title: "Field Name", default: "textarea" }),
963
- showLabel: y({ title: "Show Label", default: !0 }),
964
- styles: m({ default: "" }),
965
- inputStyles: m({ default: "w-full p-1" }),
966
- label: p({ title: "Label", default: "Label", ai: !0, i18n: !0 }),
967
- placeholder: p({
968
- title: "Placeholder",
969
- default: "Placeholder"
970
- }),
971
- _rows: B({ title: "Rows", default: 3 })
972
- }
973
- }, ft = (e) => {
974
- const { blockProps: l, fieldName: t, label: o, styles: a, inputStyles: r, required: n, checked: i, showLabel: c = !0 } = e, d = I();
975
- return c ? /* @__PURE__ */ s.jsxs("div", { ...a, ...l, children: [
976
- /* @__PURE__ */ s.jsx(
977
- "input",
978
- {
979
- ...r,
980
- name: t,
981
- id: d,
982
- type: "checkbox",
983
- required: n,
984
- defaultChecked: i
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
- }, ht = {
1001
- type: "Checkbox",
1002
- label: "web_blocks.checkbox",
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
- icon: se,
1005
- group: "form",
1006
- props: {
1007
- fieldName: p({ title: "Field Name", default: "checkbox" }),
1008
- styles: m({ default: "flex items-center gap-x-2" }),
1009
- label: p({ title: "web_blocks.label", default: "Label" }),
1010
- checked: y({ title: "web_blocks.checked", default: !1 }),
1011
- required: y({ title: "web_blocks.required", default: !1 })
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
- }, Lt = () => {
1014
- u(ue, pe), u(ye, ge), u(be, me), u(ke, xe), u(we, ve), u(_e, Ie), u(Be, Le), u(je, Ce), u(Se, Me), u(Ne, Pe), u(Ee, $e), u(Te, He), u(ze, Ae), u(qe, De), u(fe, he), u(Je, Ke), u(ot, at), u(st, rt), u(nt, it), u(ft, ht), u(ct, dt), u(ut, pt), u(bt, mt), u(tt, lt), u(Qe, et), u(Ge, Ve), u(Ue, Oe), u(We, Xe), u(Ye, Ze);
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
- Lt as loadWebBlocks
1663
+ loadWebBlocks
1018
1664
  };