@chaibuilder/sdk 2.0.0-beta.81 → 2.0.0-beta.82

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