@chaibuilder/sdk 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apply-binding-BEdnEDe4.cjs → apply-binding-CExho6DS.cjs} +1 -1
- package/dist/{apply-binding-FoDMumPo.js → apply-binding-w7OMcHcu.js} +142 -142
- package/dist/{code-editor-DHjchara.js → code-editor-BwCdfuDZ.js} +1 -1
- package/dist/{code-editor-BF_Dj7wT.cjs → code-editor-CDL8REEJ.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +2 -2
- package/dist/{index-0I-fi22L.js → index-DdxrsPQZ.js} +429 -385
- package/dist/index-HYzn6bSR.cjs +128 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +2 -2
- package/dist/{rte-widget-modal-BZJ8UA08.cjs → rte-widget-modal-DZyjkwMa.cjs} +1 -1
- package/dist/{rte-widget-modal-DxyV3u6C.js → rte-widget-modal-DrMYNEN2.js} +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +28 -28
- package/package.json +1 -1
- package/dist/index-kJFsIwFo.cjs +0 -128
package/dist/render.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./plugin-CSgw-f78.cjs"),u=require("./apply-binding-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./plugin-CSgw-f78.cjs"),u=require("./apply-binding-CExho6DS.cjs"),t=require("lodash-es"),q=require("@tailwindcss/aspect-ratio"),L=require("@tailwindcss/forms"),E=require("@tailwindcss/typography");require("tailwindcss-animate");const $=require("./get-chai-builder-theme-B1tr_NJB.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),R=require("@tailwindcss/container-queries"),m=require("react/jsx-runtime"),p=require("react"),M=require("@chaibuilder/runtime");function j(e,a){const r=e.filter(({_type:i})=>i==="GlobalBlock"||i==="PartialBlock");for(let i=0;i<r.length;i++){const o=r[i],c=t.get(o,"partialBlockId",t.get(o,"globalBlock",""));if(c==="")continue;let s=t.cloneDeep(t.get(a,c,[]));o._parent&&(s==null?void 0:s.length)>0&&(s=s.map(l=>(t.isEmpty(l._parent)&&(l._parent=o._parent),l)));const n=e.indexOf(o);e.splice(n,1,...s)}return e}const D=e=>{if(!e)return[];try{return JSON.parse(A(e)).filter(r=>!r._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function A(e){const a=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(a,r=>{const i=decodeURIComponent(r),o=i.indexOf("public");return o!==-1?i.substring(o+6):i})}async function O(e,a=[],r=!1){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:a,theme:{extend:{...$.getChaiBuilderTheme(),keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}},plugins:[L,E,q,R,k.chaiBuilderPlugin],corePlugins:{preflight:r}}}).generateStylesFromContent(` ${r?"@tailwind base;":""}
|
|
2
2
|
@tailwind components;
|
|
3
3
|
@tailwind utilities;`,e)}const K=(e,a)=>{const r=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return O([r],[],a)},N=async(e,a=!1)=>await K(e,a);async function J(e){const a={pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1},r=await e.dataProvider(a);return t.has(r,"$metadata")&&t.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,r.$metadata),e.children({...t.omit(r,"$metadata")})}const H=()=>m.jsx("div",{}),V=e=>{const{block:a,lang:r,fallbackLang:i,children:o,externalData:c,blocks:s,draft:n,pageProps:l,dataProviderMetadataCallback:y}=e,d=M.getRegisteredChaiBlock(a._type),h=t.get(d,"component",null),P=t.get(e.repeaterData,"index",-1),f=t.get(e.repeaterData,"dataKey",""),b=r===i?"":r,g=u.applyBindingToBlockProps(u.applyLanguage(a,b,d),c,{index:P,key:f}),C=u.getBlockTagAttributes(a,!1),T=U(s,a._id,u.getBlockRuntimeProps(a._type)),S=t.has(d,"dataProvider")&&t.isFunction(d.dataProvider),B={...g,...C,...T},w={blockProps:{},inBuilder:!1,lang:r||i,...B},v=t.get(B,"_show",!0);if(t.isNull(h)||!v)return null;if(S){const I=t.get(d,"suspenseFallback",H);return m.jsx(p.Suspense,{fallback:p.createElement(I),children:m.jsx(J,{lang:r,pageProps:l,block:B,dataProvider:d.dataProvider,...y?{dataProviderMetadataCallback:y}:{},draft:n,children:x=>p.createElement(h,{...w,...x,children:o({_id:a._id,_type:a._type,...t.isArray(g.repeaterItems)?{repeaterItems:u.applyLimit(g.repeaterItems,a),$repeaterItemsKey:g.$repeaterItemsKey,repeaterTotalItems:g.repeaterTotalItems??-1}:{}})})})})}return m.jsx(p.Suspense,{children:p.createElement(h,{...w,children:o({_id:a._id,_type:a._type,...t.isArray(g.repeaterItems)?{repeaterItems:u.applyLimit(g.repeaterItems,a),$repeaterItemsKey:g.$repeaterItemsKey,repeaterTotalItems:g.repeaterTotalItems??-1}:{}})})})},_=e=>{const{blocks:a,parent:r,repeaterData:i,type:o}=e;let c=t.uniqBy(t.filter(a,n=>t.has(n,"_id")&&(t.isEmpty(r)?!n._parent:n._parent===r)),"_id");const s=n=>t.filter(a,l=>l._parent===n).length>0;return(o==="Heading"||o==="Paragraph"||o==="Link")&&(c=u.adjustSpacingInContentBlocks(c)),t.map(c,n=>n?p.createElement(V,{...e,key:n._id,block:n},({_id:l,_type:y,repeaterItems:d,$repeaterItemsKey:h})=>y==="Repeater"?t.isArray(d)&&d.map((P,f)=>p.createElement(_,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}-${f}`,repeaterData:{index:f,dataKey:h}})):s(l)?p.createElement(_,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}`,repeaterData:i,type:n._type}):null):null)},U=(e,a,r)=>t.isEmpty(r)?{}:Object.entries(r).reduce((i,[o,c])=>{const s=[];let n=t.find(e,{_id:a});for(;n;)s.push(n),n=t.find(e,{_id:n._parent});const l=t.find(s,{_type:c.block});return l&&(i[o]=t.get(l,t.get(c,"prop"),null)),i},{});function W(e){if(t.isEmpty(e.lang)&&!t.isEmpty(e.fallbackLang))throw new Error("lang prop is required when fallbackLang is provided");if(t.isEmpty(e.blocks))return null;const a=e.lang??"en",r=e.fallbackLang??a;return m.jsx(_,{...e,lang:a,fallbackLang:r})}exports.getChaiThemeCssVariables=k.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=k.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=k.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=u.applyChaiDataBinding;exports.convertHTMLToChaiBlocks=u.getBlocksFromHTML;exports.RenderChaiBlocks=W;exports.convertToBlocks=D;exports.getMergedPartialBlocks=j;exports.getStylesForBlocks=N;
|
package/dist/render.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as K } from "./plugin-BOcGV_IY.js";
|
|
2
2
|
import { a as ve, b as Se, e as xe } from "./plugin-BOcGV_IY.js";
|
|
3
|
-
import { a as M, b as O, g as A, c as N, d as I, e as J } from "./apply-binding-
|
|
4
|
-
import { f as $e, h as Le } from "./apply-binding-
|
|
3
|
+
import { a as M, b as O, g as A, c as N, d as I, e as J } from "./apply-binding-w7OMcHcu.js";
|
|
4
|
+
import { f as $e, h as Le } from "./apply-binding-w7OMcHcu.js";
|
|
5
5
|
import { get as s, cloneDeep as j, isEmpty as g, has as b, isFunction as x, omit as E, isNull as q, isArray as B, uniqBy as H, filter as v, map as U, find as _ } from "lodash-es";
|
|
6
6
|
import V from "@tailwindcss/aspect-ratio";
|
|
7
7
|
import W from "@tailwindcss/forms";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-HYzn6bSR.cjs"),n=require("./tooltip-C2BCZ8Al.cjs");require("clsx");require("tailwind-merge");const S=({isOpen:m,onClose:l,editor:t,rteElement:f})=>{const r=u.usePageExternalData(),j=o=>{if(!t)return;const i=`{{${o}}}`;t.commands.focus();const{from:p,to:g}=t.state.selection;if(p!==g)t.chain().deleteSelection().insertContent(i).run();else{const{state:c}=t,s=c.selection.from,x=c.doc.textBetween(Math.max(0,s-1),s),a=c.doc.textBetween(s,Math.min(s+1,c.doc.content.size));let d="";s>0&&x!==" "&&!/[.,!?;:]/.test(x)&&(d=" ");let h="";a&&a!==" "&&!/[.,!?;:]/.test(a)&&(h=" "),t.chain().insertContent(d+i+h).run()}};return e.jsx(n.Dialog,{open:m,onOpenChange:o=>!o&&l(),children:e.jsxs(n.DialogContent,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[800px]",children:[e.jsx(n.DialogHeader,{children:e.jsxs(n.DialogTitle,{className:"flex items-center justify-between pr-8",children:[e.jsx("span",{children:"Rich Text Editor"}),Object.keys(r).length>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-2 text-sm text-muted-foreground",children:"Add field:"}),e.jsx("div",{className:"rte-path-selector",children:e.jsx(u.NestedPathSelector,{data:r,onSelect:j})})]})]})}),f,e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(n.Button,{onClick:l,children:"Done"})})]})})};exports.default=S;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { d as N, N as D } from "./index-
|
|
2
|
+
import { d as N, N as D } from "./index-DdxrsPQZ.js";
|
|
3
3
|
import { a1 as v, a3 as S, a6 as j, a9 as w, v as y } from "./tooltip-4-b9QGDK.js";
|
|
4
4
|
import "clsx";
|
|
5
5
|
import "tailwind-merge";
|
package/dist/ui.d.ts
CHANGED
|
@@ -367,7 +367,7 @@ export declare const SheetTitle: React_2.ForwardRefExoticComponent<Omit<DialogPr
|
|
|
367
367
|
export declare const SheetTrigger: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
|
|
368
368
|
|
|
369
369
|
declare const sheetVariants: (props?: {
|
|
370
|
-
side?: "
|
|
370
|
+
side?: "left" | "right" | "bottom" | "top";
|
|
371
371
|
} & ClassProp) => string;
|
|
372
372
|
|
|
373
373
|
export declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX_2.Element;
|
package/dist/web-blocks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),C=require("./common-functions-BZmyleS1.cjs"),x=require("react"),u=require("@radix-ui/react-icons"),d=require("lodash-es");function j(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const y=j(x),k=({className:e="",inBuilder:o})=>o?i.jsx("div",{className:C.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.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,L=e=>{const{blockProps:o,inBuilder:t,backgroundImage:r,children:s,tag:a="div",styles:n}=e;let c=s;s||(c=i.jsx(k,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),y.createElement(a,{...o,...n,style:p},c)},_={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]},backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}}}}),canAcceptBlock:()=>!0},N=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:a,children:n,iconPos:c,link:p,inBuilder:m}=e,g=r,h=n||i.jsxs(i.Fragment,{children:[s&&i.jsx("span",{children:s}),g&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(s?c==="order-first"?"mr-2":"ml-2":"")||"",dangerouslySetInnerHTML:{__html:g}})]}),f=x.createElement("button",{...o,...a,type:"button","aria-label":s},h);return d.isEmpty(d.get(p,"href"))?f:m?i.jsx("span",{children:f}):i.jsx("a",{"aria-label":s,href:d.get(p,"href")||"/",target:d.get(p,"target","_self"),children:f})},T={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:u.ButtonIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"],enumNames:["Left","Right"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!0,title:"Prefetch Link"}}}),i18nProps:["content","link"],aiProps:["content"]},E=e=>{const{blockProps:o,styles:t,htmlCode:r,inBuilder:s}=e;return s?i.jsxs("div",{className:"relative",...o,children:[s?i.jsx("div",{...t,className:"absolute z-20 h-full w-full"}):null,y.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):y.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:r}})},R={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:u.CodeIcon,group:"advanced",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}}),i18nProps:["htmlCode"]},M=e=>{const{scripts:o,inBuilder:t,blockProps:r}=e;return t?i.jsx("div",{...r,children:i.jsx("div",{className:C.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.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"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},A={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:u.CodeIcon,hidden:!0,group:"advanced",...l.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},H=e=>{const{blockProps:o,inBuilder:t,children:r,globalBlock:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Global Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},$={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},P=(e,...o)=>({...e,className:C.cn(e.className,...o)}),D=e=>{const{blockProps:o,icon:t,styles:r,width:s,inBuilder:a,height:n}=e,c=P(r,"");if(d.isEmpty(t))return i.jsx(k,{inBuilder:a,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return y.createElement("span",{...o,...c,style:{width:s?`${s}px`:"auto",height:n?`${n}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},z={type:"Icon",label:"web_blocks.icon",category:"core",description:"Icon block is used to display an icon/svg.",icon:u.SketchLogoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),icon:{type:"string",title:"Icon",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>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},V=e=>{const{blockProps:o,inBuilder:t,children:r,partialBlockId:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Partial Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},U={type:"PartialBlock",description:"A partial block component. Partial blocks are global blocks that can be used in multiple pages.",label:"Partial Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},S={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},F=e=>{const{blockProps:o,children:t,styles:r,colSpan:s,tabletColSpan:a,desktopColSpan:n}=e,p={className:[d.get(r,"className",""),d.get(S,["SMALL",isNaN(s)||!s?6:s],""),a?d.get(S,["MEDIUM",a||s],""):"",n?d.get(S,["LARGE",a||s],""):""].join(" ")};return i.jsx("div",{...o,...r,...p,children:t||i.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},q={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:u.LayoutIcon,wrapper:!0,hidden:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),colSpan:{type:"number",title:"Column Span",default:6,enum:[1,2,3,4,5,6,7,8,9,10,11,12]},tabletColSpan:{type:"number",title:"Column Span (Tablet)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]},desktopColSpan:{type:"number",title:"Column Span (Desktop)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]}}})},O=e=>{const{blockProps:o,children:t,styles:r,gutter:s}=e,n={className:[d.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${s}px`:n.style={gap:`${s}px`},i.jsx("div",{...o,...r,...n,children:t})},Z={type:"Row",description:"A row component",label:"Row",group:"basic",icon:u.RowsIcon,hidden:!0,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},G=e=>{const{blockProps:o,styles:t}=e;return x.createElement("hr",{...t,...o})},W={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:u.DividerHorizontalIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},Y=e=>{const{blockProps:o,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),y.createElement("div",{...o,...t,style:s})},Q={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},J=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:a,required:n,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...a,name:t,type:"checkbox",required:n,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...a,...s,type:"checkbox",required:n,defaultChecked:c})},X={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:u.CheckboxIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},K=e=>{const{children:o,blockProps:t,errorMessage:r,successMessage:s,action:a,styles:n,inBuilder:c}=e;let p=o;o||(p=i.jsx(k,{inBuilder:c}));const m={"x-data":"{}","x-on:submit.prevent":"post"},g={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...m,"data-error":r,"data-success":s,method:"post",action:a,...t,...n,children:[i.jsx("div",{...g}),p]})},ee={type:"Form",label:"Form",category:"core",icon:u.FileTextIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},te=e=>{const{blockProps:o,inBuilder:t,label:r,styles:s,icon:a,iconSize:n,iconPos:c}=e;return i.jsxs("button",{...s,...o||{},type:t?"button":"submit","aria-label":r,children:[r,a&&i.jsx("div",{style:{width:n+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},oe={type:"FormButton",label:"Submit Button",category:"core",icon:u.ButtonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},le=e=>{const o={type:"text",autocomplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autocomplete:"on"}:e==="email"?{type:"email",autocomplete:"email"}:e==="tel"?{type:"tel",autocomplete:"tel"}:e==="url"?{type:"url",autocomplete:"url"}:{off:{type:"text",autocomplete:"off"},on:{type:"text",autocomplete:"on"},name:{type:"text",autocomplete:"name"},"honorific-prefix":{type:"text",autocomplete:"honorific-prefix"},"given-name":{type:"text",autocomplete:"given-name"},"additional-name":{type:"text",autocomplete:"additional-name"},"family-name":{type:"text",autocomplete:"family-name"},"honorific-suffix":{type:"text",autocomplete:"honorific-suffix"},nickname:{type:"text",autocomplete:"nickname"},firstName:{type:"text",autocomplete:"given-name"},lastName:{type:"text",autocomplete:"family-name"},email:{type:"email",autocomplete:"email"},tel:{type:"tel",autocomplete:"tel"},"tel-country-code":{type:"tel",autocomplete:"tel-country-code"},"tel-national":{type:"tel",autocomplete:"tel-national"},"tel-area-code":{type:"tel",autocomplete:"tel-area-code"},"tel-local":{type:"tel",autocomplete:"tel-local"},"tel-extension":{type:"tel",autocomplete:"tel-extension"},"street-address":{type:"text",autocomplete:"street-address"},"address-line1":{type:"text",autocomplete:"address-line1"},"address-line2":{type:"text",autocomplete:"address-line2"},"address-line3":{type:"text",autocomplete:"address-line3"},"address-level1":{type:"text",autocomplete:"address-level1"},"address-level2":{type:"text",autocomplete:"address-level2"},"address-level3":{type:"text",autocomplete:"address-level3"},"address-level4":{type:"text",autocomplete:"address-level4"},country:{type:"text",autocomplete:"country"},"country-name":{type:"text",autocomplete:"country-name"},"postal-code":{type:"text",autocomplete:"postal-code"},"cc-name":{type:"text",autocomplete:"cc-name"},"cc-given-name":{type:"text",autocomplete:"cc-given-name"},"cc-additional-name":{type:"text",autocomplete:"cc-additional-name"},"cc-family-name":{type:"text",autocomplete:"cc-family-name"},"cc-number":{type:"text",autocomplete:"cc-number"},"cc-exp":{type:"text",autocomplete:"cc-exp"},"cc-exp-month":{type:"number",autocomplete:"cc-exp-month"},"cc-exp-year":{type:"number",autocomplete:"cc-exp-year"},"cc-csc":{type:"text",autocomplete:"cc-csc"},"cc-type":{type:"text",autocomplete:"cc-type"},bday:{type:"date",autocomplete:"bday"},"bday-day":{type:"number",autocomplete:"bday-day"},"bday-month":{type:"number",autocomplete:"bday-month"},"bday-year":{type:"number",autocomplete:"bday-year"},username:{type:"text",autocomplete:"username"},"new-password":{type:"password",autocomplete:"new-password"},"current-password":{type:"password",autocomplete:"current-password"},"one-time-code":{type:"text",autocomplete:"one-time-code"},"transaction-currency":{type:"text",autocomplete:"transaction-currency"},"transaction-amount":{type:"number",autocomplete:"transaction-amount"},url:{type:"url",autocomplete:"url"},photo:{type:"url",autocomplete:"photo"},sex:{type:"text",autocomplete:"sex"},"organization-title":{type:"text",autocomplete:"organization-title"},organization:{type:"text",autocomplete:"organization"},language:{type:"text",autocomplete:"language"}}[e]||o:o},re=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,showLabel:c,required:p,inputType:m,defaultValue:g}=e,{type:h,autocomplete:f}=le(m);return c?i.jsxs("div",{...a,...o,children:[c&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("input",{name:t,defaultValue:g,...n,type:h,placeholder:s,required:p,autoComplete:f})]}):i.jsx("input",{name:t,...o,...n,...a,type:h,placeholder:s,required:p,autoComplete:f,defaultValue:g})},ie={type:"Input",label:"web_blocks.input",category:"core",icon:u.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},inputType:{type:"string",title:"Type",default:"email",oneOf:[{const:"text",title:"Text"},{const:"email",title:"Email"},{const:"password",title:"Password"},{const:"number",title:"Number"},{const:"tel",title:"Telephone"},{const:"hidden",title:"Hidden"},{const:"range",title:"Range"},{const:"color",title:"Color"},{const:"date",title:"Date"},{const:"time",title:"Time"},{const:"url",title:"URL"},{const:"name",title:"Name"},{const:"firstName",title:"First Name"},{const:"lastName",title:"Last Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},se=e=>{const{blockProps:o,content:t,styles:r,children:s}=e,a={...r,...o};return s?y.createElement("label",a,s):y.createElement("label",{...a,dangerouslySetInnerHTML:{__html:t}})},ae={type:"Label",label:"Label",category:"core",icon:u.LetterCaseToggleIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},ne=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:a,required:n,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...a,name:t,type:"radio",required:n,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...a,...s,type:"radio",required:n,checked:c})},ce={type:"Radio",label:"web_blocks.radio",category:"core",icon:u.RadiobuttonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},pe=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,required:c,showLabel:p,_multiple:m,options:g,defaultValue:h}=e,f=m&&h?h.split(",").map(b=>b.trim()):h||"";return p?i.jsxs("div",{...a,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsxs("select",{...n,required:c,multiple:m,name:t,defaultValue:f,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(g,b=>i.jsx("option",{value:b==null?void 0:b.value,children:b==null?void 0:b.label},b==null?void 0:b.value))]})]}):i.jsxs("select",{...a,...o,required:c,multiple:m,name:t,defaultValue:f,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(g,b=>i.jsx("option",{value:b==null?void 0:b.value,children:b==null?void 0:b.label},b==null?void 0:b.value))]})},de={type:"Select",label:"web_blocks.select",category:"core",icon:u.DropdownMenuIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ue=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,rows:c,showLabel:p,required:m,defaultValue:g}=e;return p?i.jsxs("div",{...a,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("textarea",{name:t,...n,placeholder:s,rows:c,required:m,defaultValue:g})]}):i.jsx("textarea",{name:t,...o,...n,...a,placeholder:s,rows:c,required:m,defaultValue:g})},me={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:u.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},rows:{type:"number",title:"Rows",default:3},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ye=e=>{const{blockProps:o,styles:t,content:r,tag:s="h1",children:a=null}=e;return a?y.createElement(s,{...t,...o},a):y.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:r}})},ge={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:u.HeadingIcon,group:"typography",...l.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:l.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea","ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},he=e=>{const{blockProps:o,styles:t}=e;return x.createElement("br",{...o,...t})},be={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},fe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("table",{...o,...r},t):i.jsx(k,{})},xe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("thead",{...o,...r},t):i.jsx(k,{})},ke=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tbody",{...o,...r},t):i.jsx(k,{})},Ce=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tr",{...o,...r},t):i.jsx(k,{})},Be=e=>{const{blockProps:o,children:t,content:r,styles:s}=e;return!t&&d.isEmpty(r)?i.jsx(k,{}):t?x.createElement("td",{...o,...s},t):x.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:r}})};l.registerChaiBlock(fe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:u.TableIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("Table")});l.registerChaiBlock(xe,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:u.BorderTopIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableHead")});l.registerChaiBlock(ke,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:u.BorderAllIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableBody")});l.registerChaiBlock(Ce,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:u.ViewHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableRow")});l.registerChaiBlock(Be,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:u.DragHandleHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),blocks:B("TableCell"),i18nProps:["content"],aiProps:["content"]});function B(e){const o=(a,n)=>({_id:C.generateUUID(),_parent:a,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+n}`}),t=a=>{const n=C.generateUUID(),c={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return a&&(c._parent=a),[c,o(n,"1"),o(n,"2"),o(n,"3")]},r=a=>{const n=C.generateUUID(),c={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return a&&(c._parent=a),[c,...t(n)]},s=a=>{const n=C.generateUUID(),c={_id:n,_type:"TableBody",styles:"#styles:,"};return a&&(c._parent=a),[c,...t(n),...t(n)]};if(e==="Table"){const a=C.generateUUID();return[{_id:a,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(a),...s(a)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const Se="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",we=e=>{const{blockProps:o,image:t,mobileImage:r,styles:s,alt:a,height:n,width:c,lazyLoading:p,mobileWidth:m,mobileHeight:g}=e;return d.isEmpty(t)?i.jsx(k,{className:"h-36"}):i.jsxs("picture",{children:[r&&i.jsx("source",{srcSet:r,media:"(max-width: 480px)",width:m,height:g}),i.jsx("img",{...o,...s,src:t,alt:a,loading:p?"lazy":"eager",width:c,height:n})]})},Pe={type:"Image",description:"A image component",label:"Image",category:"core",icon:u.ImageIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),image:{type:"string",title:"Image",default:Se,ui:{"ui:widget":"image"}},width:{type:"string",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"string",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},mobileWidth:{type:"string",title:"Mobile Width",default:"",ui:{"ui:placeholder":"Enter width"}},mobileHeight:{type:"string",title:"Mobile Height",default:"",ui:{"ui:placeholder":"Enter height"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0}}}),aiProps:["alt"],i18nProps:["alt","image","_imageId","mobileImage","_mobileImageId"]},ve=e=>{const{blockProps:o,link:t,children:r,styles:s,inBuilder:a,content:n}=e;let c={};return!r&&d.isEmpty(n)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),a?r?i.jsx("span",{role:"link",...o,style:c,...s,children:r}):x.createElement("span",{...o,...s,style:c,role:"link"},n):r?i.jsx("a",{"aria-label":n,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...s,children:r}):x.createElement("a",{...o,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":n},n)},Ie={type:"Link",description:"A link component",label:"Link",category:"core",icon:u.Link1Icon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),aiProps:["content"],i18nProps:["content","link"],canAcceptBlock:e=>e!=="Link"},je=e=>{const{blockProps:o,children:t,styles:r,tag:s,inBuilder:a}=e;return!t&&d.isEmpty(r==null?void 0:r.className)?i.jsx(k,{inBuilder:a}):y.createElement(s||"ul",{...o,...r},t)},Le={type:"List",description:"A list component",label:"List",icon:u.RowsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},_e=e=>{const{blockProps:o,content:t,styles:r,children:s,tag:a}=e;return s?y.createElement(a||"li",{...r,...o},s):y.createElement(a||"li",{...r,...o,dangerouslySetInnerHTML:{__html:t}})},Ne={type:"ListItem",description:"A list item component",label:"List Item",icon:u.ColumnsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"||e==="Repeater"},Te=e=>{const{blockProps:o,styles:t,content:r}=e;if(!d.isNull(e.children))return y.createElement("p",{...t,...o},e.children);const s=P(t,"rte");return y.createElement("div",{...s,...o,dangerouslySetInnerHTML:{__html:r}})},Ee={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:u.TextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.",ui:{"ui:widget":"richtext","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},Re=e=>{const{blockProps:o,content:t,styles:r}=e,s=P(r,"rte");return i.jsx("div",{...o,...s,dangerouslySetInnerHTML:{__html:t}})},Me={type:"RichText",description:"A rich text block",label:"Rich Text",hidden:!0,category:"core",icon:u.CursorTextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},Ae=e=>{const{blockProps:o,styles:t,content:r,children:s=null,tag:a}=e;return s?y.createElement("span",{...t,...o},s):y.createElement(a||"span",{...t,...o,dangerouslySetInnerHTML:{__html:r||""}})},He={type:"Span",description:"A span component",label:"Span",category:"core",group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},$e=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,De={type:"Text",description:"A text component with no styling",label:"Raw Text",category:"core",group:"typography",blocks:()=>[{_id:"a",_type:"Text",_name:"Raw Text",content:""}],icon:u.SpaceBetweenVerticallyIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},w={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},v=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,I=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,ze=(e,o)=>{const t=d.get(o,"autoplay",!1),r=d.get(o,"controls",!1),s=d.get(o,"loop",!1),a=t||d.get(o,"muted",!0);if(v.test(e)){const n=e.match(v);if(n){const c=n[4];let p=`https://www.youtube.com/embed/${c}`,m=t?"autoplay=1":"";return m+=s?`&loop=1&playlist=${c}`:"",m+=a?"&mute=1&muted=1":"",m+=r?"&controls=1":"&controls=0",`${p}?${m}`}}if(I.test(e)){const n=e.match(I);if(n){const c=n[1];let p="";return p+=t?"autoplay=1":"",p+=r?"&controls=1":"&controls=0",p+=a?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},Ve=e=>{const{url:o,blockProps:t,styles:r,controls:s,videoSource:a,inBuilder:n}=e,c=ze(o,s);return i.jsxs("div",{...d.omit(r,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!c&&n?i.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:d.isEmpty(o)?`Provided ${a} video link in settings Video URL.`:`Provided ${a} video link is invalid.`}):i.jsx("iframe",{width:"100%",src:c,...d.pick(r,"className")}),n&&i.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Ue=e=>{const{url:o,styles:t,controls:r,sources:s,poster:a,blockProps:n}=e;let c=a;const p=[...d.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&p.push({url:o,width:"9999"});const m=p.sort((h,f)=>parseInt(h.width)-parseInt(f.width)).filter(h=>!d.isEmpty(h.url)&&!d.isEmpty(h.width));m.length===0&&!c&&(c="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const g=d.get(r,"autoplay",!1)||d.get(r,"muted",!0);return(c||!d.isEmpty(m))&&i.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:x.createElement("video",{...t,...n,key:JSON.stringify(m),controls:d.get(r,"controls",!1),autoPlay:d.get(r,"autoplay",!1),loop:d.get(r,"loop",!1),poster:c,...g?{muted:!0}:{}},m.map(h=>{if(!h.url||h.url.length<4||isNaN(h.width))return null;const f=`(max-width: ${h.width}px)`;return i.jsx("source",{src:h.url,media:f,type:h.type},h.url)}),"Your browser does not support the video tag.")})},Fe=e=>{const{videoSource:o}=e;return o==="Custom"?i.jsx(Ue,{...e}):o==="Youtube"||o==="Vimeo"?i.jsx(Ve,{...e}):i.jsxs("div",{children:["Invalid video source : ",o]})},qe={type:"Video",label:"Video",category:"core",icon:u.VideoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"}},allOf:[{if:{properties:{videoSource:{const:"Custom"}}},then:{properties:{url:{type:"string",title:"Video URL",default:""},poster:{type:"string",title:"Poster URL",default:""},sources:{type:"object",default:{srcsets:[]}},controls:{...w}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...w}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...w}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url"]},Oe=e=>{const{paginationStyles:o}=e,t=l.getRegisteredChaiBlock("Pagination");return i.jsx("div",{...o,children:t?y.createElement(t.component,{...d.omit(e,["paginationStyles"]),blockProps:{}}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",disabled:!0,children:i.jsx(u.ChevronLeftIcon,{className:"h-4 w-4"})}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-blue-500 bg-blue-500 font-medium text-white",children:"1"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"2"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"3"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"4"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"5"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50",children:i.jsx(u.ChevronRightIcon,{className:"h-4 w-4"})})]})})},Ze=e=>{const{children:o,tag:t,styles:r,blockProps:s,$loading:a}=e,{pagination:n,inBuilder:c}=e;let p=o;return d.isEmpty(p)&&c&&(p=i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Choose a collection to display items"})),t==="none"?a&&c?Array.from({length:2}).map((m,g)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},g)):p:i.jsxs(i.Fragment,{children:[y.createElement(t,{...s,...r},a&&c?Array.from({length:2}).map((m,g)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},g)):p),n&&i.jsx(Oe,{...d.pick(e,["limit","totalItems","paginationStrategy","inBuilder","draft","lang","paginationStyles"])})]})},Ge={type:"Repeater",label:"Repeater",icon:u.LoopIcon,group:"basic",description:"Repeater block is used to display a list of items based on data binding in repeaterItems",dataProviderMode:"live",dataProviderDependencies:["filter","sort","limit","repeaterItems"],blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_name:"Repeater Item",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("grid gap-4 md:grid-cols-2 xl:grid-cols-3"),paginationStyles:l.stylesProp("flex items-center justify-center gap-2 p-4"),repeaterItems:{title:"Collection",type:"string",binding:"array",default:"",ui:{"ui:widget":"repeaterBinding","ui:readonly":!0}},tag:{title:"Tag",type:"string",default:"ul",enum:["none","div","ul","ol"]},filter:{title:"Filter by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},sort:{title:"Sort by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},pagination:{title:"Pagination",type:"boolean",default:!1}},allOf:[{if:{properties:{pagination:{const:!0}}},then:{properties:{paginationStrategy:{type:"string",title:"Pagination Strategy",default:"segment",enum:["query","segment"],enumNames:["Query(/items?page=1)","Segment(/items/1)"]},limit:{type:"number",title:"Items Per Page",default:10,minimum:1}}}},{if:{properties:{pagination:{const:!1}}},then:{properties:{limit:{type:"number",title:"Max items",default:10,minimum:1}}}}]}),canAcceptBlock:e=>e==="Pagination"},We=({children:e,blockProps:o,styles:t,parentTag:r,inBuilder:s})=>{let a="li";switch(r){case"ul":a="li";break;case"ol":a="li";break;default:a="div"}return!e&&s?y.createElement(a,{...o,...t},i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Add children to repeater item"})):y.createElement(a,{...o,...t},e)},Ye={type:"RepeaterItem",label:"Repeater Item",icon:u.LoopIcon,hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp(""),parentTag:l.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Qe=({children:e,blockProps:o,styles:t})=>y.createElement("div",{...o,...t},e),Je={type:"RepeaterEmptyState",label:"Empty State",hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("p-5 flex items-center justify-center")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Xe=()=>{l.registerChaiBlock(L,_),l.registerChaiBlock(Y,Q),l.registerChaiBlock(N,T),l.registerChaiBlock(ye,ge),l.registerChaiBlock(Te,Ee),l.registerChaiBlock(Ae,He),l.registerChaiBlock(Re,Me),l.registerChaiBlock(ve,Ie),l.registerChaiBlock(je,Le),l.registerChaiBlock(_e,Ne),l.registerChaiBlock(D,z),l.registerChaiBlock(we,Pe),l.registerChaiBlock(Fe,qe),l.registerChaiBlock(E,R),l.registerChaiBlock(M,A),l.registerChaiBlock($e,De),l.registerChaiBlock(K,ee),l.registerChaiBlock(te,oe),l.registerChaiBlock(re,ie),l.registerChaiBlock(J,X),l.registerChaiBlock(ne,ce),l.registerChaiBlock(pe,de),l.registerChaiBlock(ue,me),l.registerChaiBlock(se,ae),l.registerChaiBlock(he,be),l.registerChaiBlock(G,W),l.registerChaiBlock(H,$),l.registerChaiBlock(V,U),l.registerChaiBlock(O,Z),l.registerChaiBlock(F,q),l.registerChaiBlock(Ze,Ge),l.registerChaiBlock(We,Ye),l.registerChaiBlock(Qe,Je)};exports.loadWebBlocks=Xe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),C=require("./common-functions-BZmyleS1.cjs"),x=require("react"),u=require("@radix-ui/react-icons"),d=require("lodash-es");function j(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const y=j(x),k=({className:e="",inBuilder:o})=>o?i.jsx("div",{className:C.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.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,L=e=>{const{blockProps:o,inBuilder:t,backgroundImage:r,children:s,tag:a="div",styles:n}=e;let c=s;s||(c=i.jsx(k,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),y.createElement(a,{...o,...n,style:p},c)},_={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]},backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}}}}),canAcceptBlock:()=>!0},N=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:a,children:n,iconPos:c,link:p,inBuilder:m}=e,g=r,h=n||i.jsxs(i.Fragment,{children:[s&&i.jsx("span",{children:s}),g&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(s?c==="order-first"?"mr-2":"ml-2":"")||"",dangerouslySetInnerHTML:{__html:g}})]}),f=x.createElement("button",{...o,...a,type:"button","aria-label":s},h);return d.isEmpty(d.get(p,"href"))?f:m?i.jsx("span",{children:f}):i.jsx("a",{"aria-label":s,href:d.get(p,"href")||"/",target:d.get(p,"target","_self"),children:f})},T={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:u.ButtonIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"],enumNames:["Left","Right"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!0,title:"Prefetch Link"}}}),i18nProps:["content","link"],aiProps:["content"]},E=e=>{const{blockProps:o,styles:t,htmlCode:r,inBuilder:s}=e;return s?i.jsxs("div",{className:"relative",...o,children:[s?i.jsx("div",{...t,className:"absolute z-20 h-full w-full"}):null,y.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):y.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:r}})},R={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:u.CodeIcon,group:"advanced",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}}),i18nProps:["htmlCode"]},A=e=>{const{scripts:o,inBuilder:t,blockProps:r}=e;return t?i.jsx("div",{...r,children:i.jsx("div",{className:C.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.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"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},M={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:u.CodeIcon,hidden:!0,group:"advanced",...l.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},H=e=>{const{blockProps:o,inBuilder:t,children:r,globalBlock:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Global Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},$={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},P=(e,...o)=>({...e,className:C.cn(e.className,...o)}),D=e=>{const{blockProps:o,icon:t,styles:r,width:s,inBuilder:a,height:n}=e,c=P(r,"");if(d.isEmpty(t))return i.jsx(k,{inBuilder:a,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return y.createElement("span",{...o,...c,style:{width:s?`${s}px`:"auto",height:n?`${n}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},z={type:"Icon",label:"web_blocks.icon",category:"core",description:"Icon block is used to display an icon/svg.",icon:u.SketchLogoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),icon:{type:"string",title:"Icon",default:'<svg xmlns="http://www.w3.org/2000/svg" class="chai-default-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-diamond-icon lucide-diamond"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},V=e=>{const{blockProps:o,inBuilder:t,children:r,partialBlockId:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Partial Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},U={type:"PartialBlock",description:"A partial block component. Partial blocks are global blocks that can be used in multiple pages.",label:"Partial Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},S={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},F=e=>{const{blockProps:o,children:t,styles:r,colSpan:s,tabletColSpan:a,desktopColSpan:n}=e,p={className:[d.get(r,"className",""),d.get(S,["SMALL",isNaN(s)||!s?6:s],""),a?d.get(S,["MEDIUM",a||s],""):"",n?d.get(S,["LARGE",a||s],""):""].join(" ")};return i.jsx("div",{...o,...r,...p,children:t||i.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},q={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:u.LayoutIcon,wrapper:!0,hidden:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),colSpan:{type:"number",title:"Column Span",default:6,enum:[1,2,3,4,5,6,7,8,9,10,11,12]},tabletColSpan:{type:"number",title:"Column Span (Tablet)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]},desktopColSpan:{type:"number",title:"Column Span (Desktop)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]}}})},O=e=>{const{blockProps:o,children:t,styles:r,gutter:s}=e,n={className:[d.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${s}px`:n.style={gap:`${s}px`},i.jsx("div",{...o,...r,...n,children:t})},Z={type:"Row",description:"A row component",label:"Row",group:"basic",icon:u.RowsIcon,hidden:!0,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},G=e=>{const{blockProps:o,styles:t}=e;return x.createElement("hr",{...t,...o})},W={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:u.DividerHorizontalIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},Y=e=>{const{blockProps:o,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),y.createElement("div",{...o,...t,style:s})},Q={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},J=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:a,required:n,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...a,name:t,type:"checkbox",required:n,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...a,...s,type:"checkbox",required:n,defaultChecked:c})},X={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:u.CheckboxIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},K=e=>{const{children:o,blockProps:t,errorMessage:r,successMessage:s,action:a,styles:n,inBuilder:c}=e;let p=o;o||(p=i.jsx(k,{inBuilder:c}));const m={"x-data":"{}","x-on:submit.prevent":"post"},g={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...m,"data-error":r,"data-success":s,method:"post",action:a,...t,...n,children:[i.jsx("div",{...g}),p]})},ee={type:"Form",label:"Form",category:"core",icon:u.FileTextIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},te=e=>{const{blockProps:o,inBuilder:t,label:r,styles:s,icon:a,iconSize:n,iconPos:c}=e;return i.jsxs("button",{...s,...o||{},type:t?"button":"submit","aria-label":r,children:[r,a&&i.jsx("div",{style:{width:n+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},oe={type:"FormButton",label:"Submit Button",category:"core",icon:u.ButtonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},le=e=>{const o={type:"text",autocomplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autocomplete:"on"}:e==="email"?{type:"email",autocomplete:"email"}:e==="tel"?{type:"tel",autocomplete:"tel"}:e==="url"?{type:"url",autocomplete:"url"}:{off:{type:"text",autocomplete:"off"},on:{type:"text",autocomplete:"on"},name:{type:"text",autocomplete:"name"},"honorific-prefix":{type:"text",autocomplete:"honorific-prefix"},"given-name":{type:"text",autocomplete:"given-name"},"additional-name":{type:"text",autocomplete:"additional-name"},"family-name":{type:"text",autocomplete:"family-name"},"honorific-suffix":{type:"text",autocomplete:"honorific-suffix"},nickname:{type:"text",autocomplete:"nickname"},firstName:{type:"text",autocomplete:"given-name"},lastName:{type:"text",autocomplete:"family-name"},email:{type:"email",autocomplete:"email"},tel:{type:"tel",autocomplete:"tel"},"tel-country-code":{type:"tel",autocomplete:"tel-country-code"},"tel-national":{type:"tel",autocomplete:"tel-national"},"tel-area-code":{type:"tel",autocomplete:"tel-area-code"},"tel-local":{type:"tel",autocomplete:"tel-local"},"tel-extension":{type:"tel",autocomplete:"tel-extension"},"street-address":{type:"text",autocomplete:"street-address"},"address-line1":{type:"text",autocomplete:"address-line1"},"address-line2":{type:"text",autocomplete:"address-line2"},"address-line3":{type:"text",autocomplete:"address-line3"},"address-level1":{type:"text",autocomplete:"address-level1"},"address-level2":{type:"text",autocomplete:"address-level2"},"address-level3":{type:"text",autocomplete:"address-level3"},"address-level4":{type:"text",autocomplete:"address-level4"},country:{type:"text",autocomplete:"country"},"country-name":{type:"text",autocomplete:"country-name"},"postal-code":{type:"text",autocomplete:"postal-code"},"cc-name":{type:"text",autocomplete:"cc-name"},"cc-given-name":{type:"text",autocomplete:"cc-given-name"},"cc-additional-name":{type:"text",autocomplete:"cc-additional-name"},"cc-family-name":{type:"text",autocomplete:"cc-family-name"},"cc-number":{type:"text",autocomplete:"cc-number"},"cc-exp":{type:"text",autocomplete:"cc-exp"},"cc-exp-month":{type:"number",autocomplete:"cc-exp-month"},"cc-exp-year":{type:"number",autocomplete:"cc-exp-year"},"cc-csc":{type:"text",autocomplete:"cc-csc"},"cc-type":{type:"text",autocomplete:"cc-type"},bday:{type:"date",autocomplete:"bday"},"bday-day":{type:"number",autocomplete:"bday-day"},"bday-month":{type:"number",autocomplete:"bday-month"},"bday-year":{type:"number",autocomplete:"bday-year"},username:{type:"text",autocomplete:"username"},"new-password":{type:"password",autocomplete:"new-password"},"current-password":{type:"password",autocomplete:"current-password"},"one-time-code":{type:"text",autocomplete:"one-time-code"},"transaction-currency":{type:"text",autocomplete:"transaction-currency"},"transaction-amount":{type:"number",autocomplete:"transaction-amount"},url:{type:"url",autocomplete:"url"},photo:{type:"url",autocomplete:"photo"},sex:{type:"text",autocomplete:"sex"},"organization-title":{type:"text",autocomplete:"organization-title"},organization:{type:"text",autocomplete:"organization"},language:{type:"text",autocomplete:"language"}}[e]||o:o},re=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,showLabel:c,required:p,inputType:m,defaultValue:g}=e,{type:h,autocomplete:f}=le(m);return c?i.jsxs("div",{...a,...o,children:[c&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("input",{name:t,defaultValue:g,...n,type:h,placeholder:s,required:p,autoComplete:f})]}):i.jsx("input",{name:t,...o,...n,...a,type:h,placeholder:s,required:p,autoComplete:f,defaultValue:g})},ie={type:"Input",label:"web_blocks.input",category:"core",icon:u.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},inputType:{type:"string",title:"Type",default:"email",oneOf:[{const:"text",title:"Text"},{const:"email",title:"Email"},{const:"password",title:"Password"},{const:"number",title:"Number"},{const:"tel",title:"Telephone"},{const:"hidden",title:"Hidden"},{const:"range",title:"Range"},{const:"color",title:"Color"},{const:"date",title:"Date"},{const:"time",title:"Time"},{const:"url",title:"URL"},{const:"name",title:"Name"},{const:"firstName",title:"First Name"},{const:"lastName",title:"Last Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},se=e=>{const{blockProps:o,content:t,styles:r,children:s}=e,a={...r,...o};return s?y.createElement("label",a,s):y.createElement("label",{...a,dangerouslySetInnerHTML:{__html:t}})},ae={type:"Label",label:"Label",category:"core",icon:u.LetterCaseToggleIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},ne=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:a,required:n,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...a,name:t,type:"radio",required:n,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...a,...s,type:"radio",required:n,checked:c})},ce={type:"Radio",label:"web_blocks.radio",category:"core",icon:u.RadiobuttonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},pe=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,required:c,showLabel:p,_multiple:m,options:g,defaultValue:h}=e,f=m&&h?h.split(",").map(b=>b.trim()):h||"";return p?i.jsxs("div",{...a,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsxs("select",{...n,required:c,multiple:m,name:t,defaultValue:f,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(g,b=>i.jsx("option",{value:b==null?void 0:b.value,children:b==null?void 0:b.label},b==null?void 0:b.value))]})]}):i.jsxs("select",{...a,...o,required:c,multiple:m,name:t,defaultValue:f,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(g,b=>i.jsx("option",{value:b==null?void 0:b.value,children:b==null?void 0:b.label},b==null?void 0:b.value))]})},de={type:"Select",label:"web_blocks.select",category:"core",icon:u.DropdownMenuIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ue=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,rows:c,showLabel:p,required:m,defaultValue:g}=e;return p?i.jsxs("div",{...a,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("textarea",{name:t,...n,placeholder:s,rows:c,required:m,defaultValue:g})]}):i.jsx("textarea",{name:t,...o,...n,...a,placeholder:s,rows:c,required:m,defaultValue:g})},me={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:u.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},rows:{type:"number",title:"Rows",default:3},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ye=e=>{const{blockProps:o,styles:t,content:r,tag:s="h1",children:a=null}=e;return a?y.createElement(s,{...t,...o},a):y.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:r}})},ge={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:u.HeadingIcon,group:"typography",...l.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:l.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea","ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},he=e=>{const{blockProps:o,styles:t}=e;return x.createElement("br",{...o,...t})},be={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},fe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("table",{...o,...r},t):i.jsx(k,{})},xe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("thead",{...o,...r},t):i.jsx(k,{})},ke=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tbody",{...o,...r},t):i.jsx(k,{})},Ce=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tr",{...o,...r},t):i.jsx(k,{})},Be=e=>{const{blockProps:o,children:t,content:r,styles:s}=e;return!t&&d.isEmpty(r)?i.jsx(k,{}):t?x.createElement("td",{...o,...s},t):x.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:r}})};l.registerChaiBlock(fe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:u.TableIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("Table")});l.registerChaiBlock(xe,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:u.BorderTopIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableHead")});l.registerChaiBlock(ke,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:u.BorderAllIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableBody")});l.registerChaiBlock(Ce,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:u.ViewHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableRow")});l.registerChaiBlock(Be,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:u.DragHandleHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),blocks:B("TableCell"),i18nProps:["content"],aiProps:["content"]});function B(e){const o=(a,n)=>({_id:C.generateUUID(),_parent:a,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+n}`}),t=a=>{const n=C.generateUUID(),c={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return a&&(c._parent=a),[c,o(n,"1"),o(n,"2"),o(n,"3")]},r=a=>{const n=C.generateUUID(),c={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return a&&(c._parent=a),[c,...t(n)]},s=a=>{const n=C.generateUUID(),c={_id:n,_type:"TableBody",styles:"#styles:,"};return a&&(c._parent=a),[c,...t(n),...t(n)]};if(e==="Table"){const a=C.generateUUID();return[{_id:a,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(a),...s(a)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const Se="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",we=e=>{const{blockProps:o,image:t,mobileImage:r,styles:s,alt:a,height:n,width:c,lazyLoading:p,mobileWidth:m,mobileHeight:g}=e;return d.isEmpty(t)?i.jsx(k,{className:"h-36"}):i.jsxs("picture",{children:[r&&i.jsx("source",{srcSet:r,media:"(max-width: 480px)",width:m,height:g}),i.jsx("img",{...o,...s,src:t,alt:a,loading:p?"lazy":"eager",width:c,height:n})]})},Pe={type:"Image",description:"A image component",label:"Image",category:"core",icon:u.ImageIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),image:{type:"string",title:"Image",default:Se,ui:{"ui:widget":"image"}},width:{type:"string",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"string",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},mobileWidth:{type:"string",title:"Mobile Width",default:"",ui:{"ui:placeholder":"Enter width"}},mobileHeight:{type:"string",title:"Mobile Height",default:"",ui:{"ui:placeholder":"Enter height"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0}}}),aiProps:["alt"],i18nProps:["alt","image","_imageId","mobileImage","_mobileImageId"]},ve=e=>{const{blockProps:o,link:t,children:r,styles:s,inBuilder:a,content:n}=e;let c={};return!r&&d.isEmpty(n)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),a?r?i.jsx("span",{role:"link",...o,style:c,...s,children:r}):x.createElement("span",{...o,...s,style:c,role:"link"},n):r?i.jsx("a",{"aria-label":n,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...s,children:r}):x.createElement("a",{...o,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":n},n)},Ie={type:"Link",description:"A link component",label:"Link",category:"core",icon:u.Link1Icon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),aiProps:["content"],i18nProps:["content","link"],canAcceptBlock:e=>e!=="Link"},je=e=>{const{blockProps:o,children:t,styles:r,tag:s,inBuilder:a}=e;return!t&&d.isEmpty(r==null?void 0:r.className)?i.jsx(k,{inBuilder:a}):y.createElement(s||"ul",{...o,...r},t)},Le={type:"List",description:"A list component",label:"List",icon:u.RowsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},_e=e=>{const{blockProps:o,content:t,styles:r,children:s,tag:a}=e;return s?y.createElement(a||"li",{...r,...o},s):y.createElement(a||"li",{...r,...o,dangerouslySetInnerHTML:{__html:t}})},Ne={type:"ListItem",description:"A list item component",label:"List Item",icon:u.ColumnsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"||e==="Repeater"},Te=e=>{const{blockProps:o,styles:t,content:r}=e;if(!d.isNull(e.children))return y.createElement("p",{...t,...o},e.children);const s=P(t,"rte");return y.createElement("div",{...s,...o,dangerouslySetInnerHTML:{__html:r}})},Ee={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:u.TextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.",ui:{"ui:widget":"richtext","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},Re=e=>{const{blockProps:o,content:t,styles:r}=e,s=P(r,"rte");return i.jsx("div",{...o,...s,dangerouslySetInnerHTML:{__html:t}})},Ae={type:"RichText",description:"A rich text block",label:"Rich Text",hidden:!0,category:"core",icon:u.CursorTextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},Me=e=>{const{blockProps:o,styles:t,content:r,children:s=null,tag:a}=e;return s?y.createElement("span",{...t,...o},s):y.createElement(a||"span",{...t,...o,dangerouslySetInnerHTML:{__html:r||""}})},He={type:"Span",description:"A span component",label:"Span",category:"core",group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},$e=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,De={type:"Text",description:"A text component with no styling",label:"Raw Text",category:"core",group:"typography",blocks:()=>[{_id:"a",_type:"Text",_name:"Raw Text",content:""}],icon:u.SpaceBetweenVerticallyIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},w={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},v=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,I=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,ze=(e,o)=>{const t=d.get(o,"autoplay",!1),r=d.get(o,"controls",!1),s=d.get(o,"loop",!1),a=t||d.get(o,"muted",!0);if(v.test(e)){const n=e.match(v);if(n){const c=n[4];let p=`https://www.youtube.com/embed/${c}`,m=t?"autoplay=1":"";return m+=s?`&loop=1&playlist=${c}`:"",m+=a?"&mute=1&muted=1":"",m+=r?"&controls=1":"&controls=0",`${p}?${m}`}}if(I.test(e)){const n=e.match(I);if(n){const c=n[1];let p="";return p+=t?"autoplay=1":"",p+=r?"&controls=1":"&controls=0",p+=a?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},Ve=e=>{const{url:o,blockProps:t,styles:r,controls:s,videoSource:a,inBuilder:n}=e,c=ze(o,s);return i.jsxs("div",{...d.omit(r,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!c&&n?i.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:d.isEmpty(o)?`Provided ${a} video link in settings Video URL.`:`Provided ${a} video link is invalid.`}):i.jsx("iframe",{width:"100%",src:c,...d.pick(r,"className")}),n&&i.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Ue=e=>{const{url:o,styles:t,controls:r,sources:s,poster:a,blockProps:n}=e;let c=a;const p=[...d.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&p.push({url:o,width:"9999"});const m=p.sort((h,f)=>parseInt(h.width)-parseInt(f.width)).filter(h=>!d.isEmpty(h.url)&&!d.isEmpty(h.width));m.length===0&&!c&&(c="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const g=d.get(r,"autoplay",!1)||d.get(r,"muted",!0);return(c||!d.isEmpty(m))&&i.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:x.createElement("video",{...t,...n,key:JSON.stringify(m),controls:d.get(r,"controls",!1),autoPlay:d.get(r,"autoplay",!1),loop:d.get(r,"loop",!1),poster:c,...g?{muted:!0}:{}},m.map(h=>{if(!h.url||h.url.length<4||isNaN(h.width))return null;const f=`(max-width: ${h.width}px)`;return i.jsx("source",{src:h.url,media:f,type:h.type},h.url)}),"Your browser does not support the video tag.")})},Fe=e=>{const{videoSource:o}=e;return o==="Custom"?i.jsx(Ue,{...e}):o==="Youtube"||o==="Vimeo"?i.jsx(Ve,{...e}):i.jsxs("div",{children:["Invalid video source : ",o]})},qe={type:"Video",label:"Video",category:"core",icon:u.VideoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"}},allOf:[{if:{properties:{videoSource:{const:"Custom"}}},then:{properties:{url:{type:"string",title:"Video URL",default:""},poster:{type:"string",title:"Poster URL",default:""},sources:{type:"object",default:{srcsets:[]}},controls:{...w}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...w}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...w}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url"]},Oe=e=>{const{paginationStyles:o}=e,t=l.getRegisteredChaiBlock("Pagination");return i.jsx("div",{...o,children:t?y.createElement(t.component,{...d.omit(e,["paginationStyles"]),blockProps:{}}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",disabled:!0,children:i.jsx(u.ChevronLeftIcon,{className:"h-4 w-4"})}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-blue-500 bg-blue-500 font-medium text-white",children:"1"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"2"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"3"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"4"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"5"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50",children:i.jsx(u.ChevronRightIcon,{className:"h-4 w-4"})})]})})},Ze=e=>{const{children:o,tag:t,styles:r,blockProps:s,$loading:a}=e,{pagination:n,inBuilder:c}=e;let p=o;return d.isEmpty(p)&&c&&(p=i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Choose a collection to display items"})),t==="none"?a&&c?Array.from({length:2}).map((m,g)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},g)):p:i.jsxs(i.Fragment,{children:[y.createElement(t,{...s,...r},a&&c?Array.from({length:2}).map((m,g)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},g)):p),n&&i.jsx(Oe,{...d.pick(e,["limit","totalItems","paginationStrategy","inBuilder","draft","lang","paginationStyles"])})]})},Ge={type:"Repeater",label:"Repeater",icon:u.LoopIcon,group:"basic",description:"Repeater block is used to display a list of items based on data binding in repeaterItems",dataProviderMode:"live",dataProviderDependencies:["filter","sort","limit","repeaterItems"],blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_name:"Repeater Item",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("grid gap-4 md:grid-cols-2 xl:grid-cols-3"),paginationStyles:l.stylesProp("flex items-center justify-center gap-2 p-4"),repeaterItems:{title:"Collection",type:"string",binding:"array",default:"",ui:{"ui:widget":"repeaterBinding","ui:readonly":!0}},tag:{title:"Tag",type:"string",default:"ul",enum:["none","div","ul","ol"]},filter:{title:"Filter by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},sort:{title:"Sort by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},pagination:{title:"Pagination",type:"boolean",default:!1}},allOf:[{if:{properties:{pagination:{const:!0}}},then:{properties:{paginationStrategy:{type:"string",title:"Pagination Strategy",default:"segment",enum:["query","segment"],enumNames:["Query(/items?page=1)","Segment(/items/1)"]},limit:{type:"number",title:"Items Per Page",default:10,minimum:1}}}},{if:{properties:{pagination:{const:!1}}},then:{properties:{limit:{type:"number",title:"Max items",default:10,minimum:1}}}}]}),canAcceptBlock:e=>e==="Pagination"},We=({children:e,blockProps:o,styles:t,parentTag:r,inBuilder:s})=>{let a="li";switch(r){case"ul":a="li";break;case"ol":a="li";break;default:a="div"}return!e&&s?y.createElement(a,{...o,...t},i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Add children to repeater item"})):y.createElement(a,{...o,...t},e)},Ye={type:"RepeaterItem",label:"Repeater Item",icon:u.LoopIcon,hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp(""),parentTag:l.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Qe=({children:e,blockProps:o,styles:t})=>y.createElement("div",{...o,...t},e),Je={type:"RepeaterEmptyState",label:"Empty State",hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("p-5 flex items-center justify-center")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Xe=()=>{l.registerChaiBlock(L,_),l.registerChaiBlock(Y,Q),l.registerChaiBlock(N,T),l.registerChaiBlock(ye,ge),l.registerChaiBlock(Te,Ee),l.registerChaiBlock(Me,He),l.registerChaiBlock(Re,Ae),l.registerChaiBlock(ve,Ie),l.registerChaiBlock(je,Le),l.registerChaiBlock(_e,Ne),l.registerChaiBlock(D,z),l.registerChaiBlock(we,Pe),l.registerChaiBlock(Fe,qe),l.registerChaiBlock(E,R),l.registerChaiBlock(A,M),l.registerChaiBlock($e,De),l.registerChaiBlock(K,ee),l.registerChaiBlock(te,oe),l.registerChaiBlock(re,ie),l.registerChaiBlock(J,X),l.registerChaiBlock(ne,ce),l.registerChaiBlock(pe,de),l.registerChaiBlock(ue,me),l.registerChaiBlock(se,ae),l.registerChaiBlock(he,be),l.registerChaiBlock(G,W),l.registerChaiBlock(H,$),l.registerChaiBlock(V,U),l.registerChaiBlock(O,Z),l.registerChaiBlock(F,q),l.registerChaiBlock(Ze,Ge),l.registerChaiBlock(We,Ye),l.registerChaiBlock(Qe,Je)};exports.loadWebBlocks=Xe;
|
package/dist/web-blocks.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { registerChaiBlockSchema as p, StylesProp as u, registerChaiBlock as d, getRegisteredChaiBlock as U, stylesProp as L, closestBlockProp as
|
|
1
|
+
import { registerChaiBlockSchema as p, StylesProp as u, registerChaiBlock as d, getRegisteredChaiBlock as U, stylesProp as L, closestBlockProp as Z } from "@chaibuilder/runtime";
|
|
2
2
|
import { jsx as a, jsxs as g, Fragment as N } from "react/jsx-runtime";
|
|
3
3
|
import { c as _, g as I } from "./common-functions-BGzDsf1z.js";
|
|
4
4
|
import * as y from "react";
|
|
5
5
|
import { createElement as w } from "react";
|
|
6
|
-
import { ButtonIcon as
|
|
6
|
+
import { ButtonIcon as M, CodeIcon as H, FrameIcon as $, SketchLogoIcon as q, LayoutIcon as G, RowsIcon as j, DividerHorizontalIcon as W, CheckboxIcon as O, FileTextIcon as Y, InputIcon as D, LetterCaseToggleIcon as Q, RadiobuttonIcon as J, DropdownMenuIcon as X, HeadingIcon as K, TableIcon as ee, BorderTopIcon as te, BorderAllIcon as oe, ViewHorizontalIcon as le, DragHandleHorizontalIcon as re, ImageIcon as ne, Link1Icon as ae, ColumnsIcon as ie, TextIcon as se, CursorTextIcon as ce, SpaceBetweenVerticallyIcon as de, VideoIcon as pe, ChevronLeftIcon as ue, ChevronRightIcon as me, LoopIcon as z } from "@radix-ui/react-icons";
|
|
7
7
|
import { isEmpty as v, get as k, map as R, isNull as ye, omit as V, pick as F } from "lodash-es";
|
|
8
8
|
const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div", { className: _("pointer-events-none flex h-20 flex-col items-center justify-center p-2", e), children: /* @__PURE__ */ a("div", { className: "h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800", children: /* @__PURE__ */ a("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, ge = (e) => {
|
|
9
9
|
const { blockProps: o, inBuilder: t, backgroundImage: l, children: r, tag: n = "div", styles: i } = e;
|
|
@@ -80,7 +80,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
80
80
|
description: "similar to a button element in HTML",
|
|
81
81
|
label: "Button",
|
|
82
82
|
category: "core",
|
|
83
|
-
icon:
|
|
83
|
+
icon: M,
|
|
84
84
|
group: "basic",
|
|
85
85
|
...p({
|
|
86
86
|
properties: {
|
|
@@ -240,7 +240,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
240
240
|
label: "web_blocks.icon",
|
|
241
241
|
category: "core",
|
|
242
242
|
description: "Icon block is used to display an icon/svg.",
|
|
243
|
-
icon:
|
|
243
|
+
icon: q,
|
|
244
244
|
group: "media",
|
|
245
245
|
...p({
|
|
246
246
|
properties: {
|
|
@@ -248,7 +248,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
248
248
|
icon: {
|
|
249
249
|
type: "string",
|
|
250
250
|
title: "Icon",
|
|
251
|
-
default: '<svg
|
|
251
|
+
default: '<svg xmlns="http://www.w3.org/2000/svg" class="chai-default-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-diamond-icon lucide-diamond"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/></svg>',
|
|
252
252
|
ui: { "ui:widget": "icon" }
|
|
253
253
|
},
|
|
254
254
|
width: {
|
|
@@ -393,7 +393,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
393
393
|
description: "A row component",
|
|
394
394
|
label: "Row",
|
|
395
395
|
group: "basic",
|
|
396
|
-
icon:
|
|
396
|
+
icon: j,
|
|
397
397
|
hidden: !0,
|
|
398
398
|
blocks: () => [
|
|
399
399
|
{ _type: "Row", _id: "row", styles: "#styles:,p-1" },
|
|
@@ -423,7 +423,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
423
423
|
}, Ae = (e) => {
|
|
424
424
|
const { blockProps: o, styles: t } = e;
|
|
425
425
|
return w("hr", { ...t, ...o });
|
|
426
|
-
},
|
|
426
|
+
}, Ee = {
|
|
427
427
|
type: "Divider",
|
|
428
428
|
description: "A horizontal line component",
|
|
429
429
|
label: "Divider",
|
|
@@ -435,7 +435,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
435
435
|
styles: u("bg-gray-900 h-0.5 py-2 my-1")
|
|
436
436
|
}
|
|
437
437
|
})
|
|
438
|
-
},
|
|
438
|
+
}, Me = (e) => {
|
|
439
439
|
const { blockProps: o, styles: t, backgroundImage: l } = e;
|
|
440
440
|
let r = {};
|
|
441
441
|
return l && (r = { backgroundImage: `url(${l})` }), y.createElement("div", { ...o, ...t, style: r });
|
|
@@ -473,7 +473,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
473
473
|
defaultChecked: s
|
|
474
474
|
}
|
|
475
475
|
);
|
|
476
|
-
},
|
|
476
|
+
}, je = {
|
|
477
477
|
type: "Checkbox",
|
|
478
478
|
label: "web_blocks.checkbox",
|
|
479
479
|
category: "core",
|
|
@@ -512,7 +512,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
512
512
|
}),
|
|
513
513
|
aiProps: ["label"],
|
|
514
514
|
i18nProps: ["label"]
|
|
515
|
-
},
|
|
515
|
+
}, De = (e) => {
|
|
516
516
|
const { children: o, blockProps: t, errorMessage: l, successMessage: r, action: n, styles: i, inBuilder: s } = e;
|
|
517
517
|
let c = o;
|
|
518
518
|
return o || (c = /* @__PURE__ */ a(C, { inBuilder: s })), /* @__PURE__ */ g(
|
|
@@ -537,7 +537,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
537
537
|
]
|
|
538
538
|
}
|
|
539
539
|
);
|
|
540
|
-
},
|
|
540
|
+
}, ze = {
|
|
541
541
|
type: "Form",
|
|
542
542
|
label: "Form",
|
|
543
543
|
category: "core",
|
|
@@ -595,7 +595,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
595
595
|
type: "FormButton",
|
|
596
596
|
label: "Submit Button",
|
|
597
597
|
category: "core",
|
|
598
|
-
icon:
|
|
598
|
+
icon: M,
|
|
599
599
|
group: "form",
|
|
600
600
|
...p({
|
|
601
601
|
properties: {
|
|
@@ -698,7 +698,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
698
698
|
organization: { type: "text", autocomplete: "organization" },
|
|
699
699
|
language: { type: "text", autocomplete: "language" }
|
|
700
700
|
}[e] || o : o;
|
|
701
|
-
},
|
|
701
|
+
}, Ze = (e) => {
|
|
702
702
|
const {
|
|
703
703
|
blockProps: o,
|
|
704
704
|
fieldName: t,
|
|
@@ -739,11 +739,11 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
739
739
|
defaultValue: h
|
|
740
740
|
}
|
|
741
741
|
);
|
|
742
|
-
},
|
|
742
|
+
}, qe = {
|
|
743
743
|
type: "Input",
|
|
744
744
|
label: "web_blocks.input",
|
|
745
745
|
category: "core",
|
|
746
|
-
icon:
|
|
746
|
+
icon: D,
|
|
747
747
|
group: "form",
|
|
748
748
|
...p({
|
|
749
749
|
properties: {
|
|
@@ -1080,7 +1080,7 @@ const C = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ a("div",
|
|
|
1080
1080
|
type: "TextArea",
|
|
1081
1081
|
label: "web_blocks.textarea",
|
|
1082
1082
|
category: "core",
|
|
1083
|
-
icon:
|
|
1083
|
+
icon: D,
|
|
1084
1084
|
group: "form",
|
|
1085
1085
|
...p({
|
|
1086
1086
|
properties: {
|
|
@@ -1469,7 +1469,7 @@ const ct = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1469
1469
|
type: "List",
|
|
1470
1470
|
description: "A list component",
|
|
1471
1471
|
label: "List",
|
|
1472
|
-
icon:
|
|
1472
|
+
icon: j,
|
|
1473
1473
|
category: "core",
|
|
1474
1474
|
group: "basic",
|
|
1475
1475
|
...p({
|
|
@@ -1665,7 +1665,7 @@ const ct = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1665
1665
|
default: !1
|
|
1666
1666
|
}
|
|
1667
1667
|
}
|
|
1668
|
-
}, A = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,
|
|
1668
|
+
}, A = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/, E = /(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/, Lt = (e, o) => {
|
|
1669
1669
|
const t = k(o, "autoplay", !1), l = k(o, "controls", !1), r = k(o, "loop", !1), n = t || k(o, "muted", !0);
|
|
1670
1670
|
if (A.test(e)) {
|
|
1671
1671
|
const i = e.match(A);
|
|
@@ -1675,8 +1675,8 @@ const ct = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1675
1675
|
return m += r ? `&loop=1&playlist=${s}` : "", m += n ? "&mute=1&muted=1" : "", m += l ? "&controls=1" : "&controls=0", `${c}?${m}`;
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
|
-
if (
|
|
1679
|
-
const i = e.match(
|
|
1678
|
+
if (E.test(e)) {
|
|
1679
|
+
const i = e.match(E);
|
|
1680
1680
|
if (i) {
|
|
1681
1681
|
const s = i[1];
|
|
1682
1682
|
let c = "";
|
|
@@ -1859,7 +1859,7 @@ const ct = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1859
1859
|
}, At = {
|
|
1860
1860
|
type: "Repeater",
|
|
1861
1861
|
label: "Repeater",
|
|
1862
|
-
icon:
|
|
1862
|
+
icon: z,
|
|
1863
1863
|
group: "basic",
|
|
1864
1864
|
description: "Repeater block is used to display a list of items based on data binding in repeaterItems",
|
|
1865
1865
|
dataProviderMode: "live",
|
|
@@ -1951,7 +1951,7 @@ const ct = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1951
1951
|
]
|
|
1952
1952
|
}),
|
|
1953
1953
|
canAcceptBlock: (e) => e === "Pagination"
|
|
1954
|
-
},
|
|
1954
|
+
}, Et = ({
|
|
1955
1955
|
children: e,
|
|
1956
1956
|
blockProps: o,
|
|
1957
1957
|
styles: t,
|
|
@@ -1974,16 +1974,16 @@ const ct = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1974
1974
|
{ ...o, ...t },
|
|
1975
1975
|
/* @__PURE__ */ a("div", { className: "col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground", children: "Add children to repeater item" })
|
|
1976
1976
|
) : y.createElement(n, { ...o, ...t }, e);
|
|
1977
|
-
},
|
|
1977
|
+
}, Mt = {
|
|
1978
1978
|
type: "RepeaterItem",
|
|
1979
1979
|
label: "Repeater Item",
|
|
1980
|
-
icon:
|
|
1980
|
+
icon: z,
|
|
1981
1981
|
hidden: !0,
|
|
1982
1982
|
group: "basic",
|
|
1983
1983
|
...p({
|
|
1984
1984
|
properties: {
|
|
1985
1985
|
styles: L(""),
|
|
1986
|
-
parentTag:
|
|
1986
|
+
parentTag: Z("Repeater", "tag")
|
|
1987
1987
|
}
|
|
1988
1988
|
}),
|
|
1989
1989
|
canAcceptBlock: (e) => e !== "RepeaterItem",
|
|
@@ -2006,9 +2006,9 @@ const ct = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
2006
2006
|
canDelete: () => !1,
|
|
2007
2007
|
canMove: () => !1,
|
|
2008
2008
|
canDuplicate: () => !1
|
|
2009
|
-
},
|
|
2010
|
-
d(ge, be), d(
|
|
2009
|
+
}, Zt = () => {
|
|
2010
|
+
d(ge, be), d(Me, He), d(fe, he), d(et, tt), d(ht, kt), d(vt, Ct), d(xt, wt), d(ut, mt), d(yt, gt), d(bt, ft), d(Pe, Le), d(dt, pt), d(Nt, _t), d(ke, xe), d(we, ve), d(It, Pt), d(De, ze), d(Ve, Fe), d(Ze, qe), d($e, je), d(Oe, Ye), d(Qe, Je), d(Xe, Ke), d(Ge, We), d(ot, lt), d(Ae, Ee), d(Ce, Ie), d(Be, Se), d(Te, Re), d(Ne, _e), d(Rt, At), d(Et, Mt), d(Ht, $t);
|
|
2011
2011
|
};
|
|
2012
2012
|
export {
|
|
2013
|
-
|
|
2013
|
+
Zt as loadWebBlocks
|
|
2014
2014
|
};
|