@chaibuilder/sdk 2.0.0-beta.2 → 2.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChaiThemeFn--DgGggh_.js +190 -0
- package/dist/ChaiThemeFn-bugxb1Cl.cjs +13 -0
- package/dist/{CodeEditor-xhb27i29.js → CodeEditor-7Cs6j_Wn.js} +14 -14
- package/dist/CodeEditor-Ifwz-vPV.cjs +1 -0
- package/dist/STRINGS-26RPxXyi.cjs +1 -0
- package/dist/STRINGS-BnWT5XcX.js +5 -0
- package/dist/Topbar-J_gRMjOQ.js +73 -0
- package/dist/Topbar-tTu3ihcy.cjs +1 -0
- package/dist/context-menu-4nQs6OxC.cjs +1 -0
- package/dist/{context-menu-I8woggB3.js → context-menu-oLipAPzI.js} +237 -254
- package/dist/core.cjs +61 -1
- package/dist/core.d.ts +56 -34
- package/dist/core.js +8598 -107
- package/dist/plugin-4xaTkTNB.cjs +1 -0
- package/dist/plugin-GuIj4Ul0.js +24 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +34 -16
- package/dist/render.js +119 -121
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +0 -20
- package/dist/style.css +1 -1
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +26 -25
- package/dist/tailwind.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +238 -223
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.js +1079 -703
- package/package.json +6 -9
- package/dist/CodeEditor-e9zXhHFt.cjs +0 -1
- package/dist/STRINGS-Xxstm-7I.js +0 -7
- package/dist/STRINGS-Yl7cSWDc.cjs +0 -1
- package/dist/Topbar-CofpLWzO.cjs +0 -1
- package/dist/Topbar-xrdjosmc.js +0 -160
- package/dist/context-menu-0lRey9QY.cjs +0 -1
- package/dist/controls-lEwMTdPQ.js +0 -234
- package/dist/controls-p9IwFnPx.cjs +0 -1
- package/dist/index-CHYv1sC2.cjs +0 -63
- package/dist/index-s4RPN00p.js +0 -8540
- package/dist/plugin-UiUFs2fK.js +0 -44
- package/dist/plugin-f6SDZ_Or.js +0 -108
- package/dist/plugin-jum1MjXp.cjs +0 -1
- package/dist/plugin-xOpS-UNV.cjs +0 -1
package/dist/web-blocks.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@chaibuilder/runtime"),i=require("./jsx-runtime-JYMCiFoE.cjs"),v=require("react"),f=require("./iconBase-aZzpqff_.cjs"),g=require("@radix-ui/react-icons"),y=require("lodash-es"),w=require("lucide-react");require("clsx");require("tailwind-merge");function E(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const d=E(v),P=({className:e="",inBuilder:r})=>r?i.jsxRuntimeExports.jsx("div",{className:f.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsxRuntimeExports.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,k=P,I=e=>{const{blockProps:r,inBuilder:t,backgroundImage:s,children:l,tag:n="div",styles:a}=e;let c=l;l||(c=i.jsxRuntimeExports.jsx(k,{inBuilder:t}));let p={};return s&&(p={backgroundImage:`url(${s})`}),d.createElement(n,{...r,...a,style:p},c)},L={type:"Box",label:"Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},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"}]}}}),canAcceptBlock:()=>!0},_=e=>{const{blockProps:r,iconSize:t,icon:s,content:l,styles:n,children:a,iconPos:c}=e,p=s,u=a||i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:l}),p&&i.jsxRuntimeExports.jsx("div",{style:{width:t+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:p}})]});return d.createElement("button",{...r,...n,type:"button"},u)},R={type:"Button",label:"Button",category:"core",icon:g.ButtonIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.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:24},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["content"],aiProps:["content"]},M=e=>{const{blockProps:r,styles:t,htmlCode:s,inBuilder:l}=e;return l?i.jsxRuntimeExports.jsxs("div",{className:"relative",children:[l?i.jsxRuntimeExports.jsx("div",{...r,...t,className:"absolute z-20 h-full w-full"}):null,d.createElement("div",{...t,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):d.createElement("div",{...r,...t,dangerouslySetInnerHTML:{__html:s}})},T={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:g.CodeIcon,group:"advanced",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}})},$=e=>{const{blockProps:r,styles:t,backgroundImage:s}=e;let l={};return s&&(l={backgroundImage:`url(${s})`}),d.createElement("div",{...r,...t,style:l})},N={type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},z=e=>{const{blockProps:r,styles:t,content:s,level:l="h1",children:n=null}=e;return n?d.createElement(l,{...t,...r},n):d.createElement(l,{...t,...r,dangerouslySetInnerHTML:{__html:s}})},H={type:"Heading",label:"web_blocks.heading",category:"core",icon:g.HeadingIcon,group:"typography",...o.registerChaiBlockSchema({properties:{level:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:o.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Text"},D=e=>{const{blockProps:r,styles:t,content:s}=e;return y.isNull(e.children)?d.createElement("p",{...t,...r,dangerouslySetInnerHTML:{__html:s}}):d.createElement("p",{...t,...r},e.children)},q={type:"Paragraph",label:"Paragraph",category:"core",icon:g.TextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
|
|
2
2
|
Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
|
|
3
|
-
nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,ai:!0,i18n:!0})},canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},U=e=>{const{blockProps:o,styles:l,content:s,children:r=null,tag:n}=e;return r?m.createElement("span",{...l,...o},r):m.createElement(n||"span",{...l,...o,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s||""}})},F={type:"Span",label:"Span",category:"core",group:"typography",props:{styles:t.T({default:""}),content:t.f({title:"Content",default:"",ai:!0,i18n:!0})},canAcceptBlock:()=>!0},O=e=>{const{blockProps:o,content:l,styles:s}=e;return i.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...o,...s,dangerouslySetInnerHTML:{__html:l}})})},V={type:"RichText",label:"Rich Text",category:"core",icon:g.CursorTextIcon,group:"typography",props:{styles:t.T({default:""}),content:t.m({title:"Content",ai:!0,i18n:!0,default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}},G=e=>{const{blockProps:o,link:l,children:s,styles:r,inBuilder:n,content:a}=e;let c={};return!s&&h.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?s?i.jsxRuntimeExports.jsx("span",{...o,style:c,...r,children:s}):m.createElement("span",{...o,...r,style:c,"data-ai-key":"content"},a):s?i.jsxRuntimeExports.jsx("a",{href:(l==null?void 0:l.href)||"#/",target:l==null?void 0:l.target,...o,...r,children:s}):m.createElement("a",{...o,...r,"data-ai-key":"content",href:(l==null?void 0:l.href)||"#",target:(l==null?void 0:l.target)||"_self"},a)},W={type:"Link",label:"Link",category:"core",icon:g.Link1Icon,group:"basic",props:{styles:t.T({default:""}),content:t.g({title:"Content",default:"",ai:!0,i18n:!0}),link:t.w({title:"Link",default:{type:"collection",target:"_self",href:""}})},canAcceptBlock:e=>e!=="Link"},B=(e,...o)=>({...e,className:y.cn(e.className,...o)}),X=e=>{const{blockProps:o,children:l,styles:s,inBuilder:r,content:n,href:a}=e,{hrefType:c,autoplay:u,maxWidth:d,backdropColor:f,galleryName:b}=e,x=B(s,"cb-lightbox");if(!l&&h.isEmpty(s==null?void 0:s.className)&&h.isEmpty(n))return i.jsxRuntimeExports.jsx(w,{inBuilder:r});if(r)return l?i.jsxRuntimeExports.jsx("span",{...o,...x,children:l}):m.createElement("span",{...o,...x,dangerouslySetInnerHTML:{__html:n}});const k={};return k["data-vbtype"]=c,u&&(k["data-autoplay"]="true"),d&&(k["data-maxwidth"]=d+"px"),f&&(k["data-overlay"]=f),b&&(k["data-gall"]=b),l?i.jsxRuntimeExports.jsx("a",{...k,href:a||"#/",...o,...x,children:l}):m.createElement("a",{...o,...x,...k,href:a||"#",dangerouslySetInnerHTML:{__html:n}})},Y={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:g.ImageIcon,group:"basic",props:{styles:t.T({default:""}),content:t.g({title:"Content",default:"Link text or drop blocks inside",ai:!0,i18n:!0}),href:t.g({title:"Href",default:""}),hrefType:t.y({title:"Type",default:"video",options:[{value:"video",title:"Video"},{value:"iframe",title:"Iframe"},{value:"inline",title:"Inline"},{value:"ajax",title:"Ajax"}]}),autoplay:t.c({title:"Autoplay",default:!1}),maxWidth:t.s({title:"Max Width",default:""}),backdropColor:t.g({title:"Backdrop Color",default:""}),galleryName:t.g({title:"Gallery Name",default:""})},canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},Z=e=>{const{blockProps:o,children:l,listType:s,styles:r,tag:n,inBuilder:a}=e,c=y.cn(h.get(r,"className",""),s);return!l&&h.isEmpty(r==null?void 0:r.className)?i.jsxRuntimeExports.jsx(w,{inBuilder:a}):m.createElement(n||(s==="list-decimal"?"ol":"ul"),{...o,...r,className:c},l)},J={type:"List",label:"web_blocks.list",icon:g.RowsIcon,category:"core",group:"basic",props:{styles:t.T({default:""}),listType:t.y({title:"web_blocks.list_type",default:"list-none",options:[{value:"list-none",title:"web_blocks.none"},{value:"list-disc",title:"web_blocks.disc"},{value:"list-decimal",title:"web_blocks.number"}]})},canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",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"}]},K=e=>{const{blockProps:o,content:l,styles:s,children:r,tag:n}=e;return r?m.createElement(n||"li",{...s,...o},r):m.createElement(n||"li",{...s,...o,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:l}})},Q={type:"ListItem",label:"List Item",icon:g.ColumnsIcon,category:"core",group:"basic",props:{styles:t.T({default:""}),content:t.f({title:"Content",default:"List item",ai:!0,i18n:!0})},canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"},ee=e=>{const{blockProps:o,icon:l,styles:s,width:r,inBuilder:n,height:a}=e,c=B(s,y.cn(r?`w-[${r}px]`:"",a?`h-[${a}px]`:""));if(h.isEmpty(l))return i.jsxRuntimeExports.jsx(w,{inBuilder:n,className:"h-8 w-14"});const u=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return m.createElement("span",{...o,...c,dangerouslySetInnerHTML:{__html:u}})},te={type:"Icon",label:"web_blocks.icon",category:"core",icon:g.SketchLogoIcon,group:"media",props:{styles:t.T({default:"text-black"}),icon:t.q({title:"web_blocks.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>'}),width:t.s({title:"web_blocks.width",default:""}),height:t.s({title:"web_blocks.height",default:""})}},le=e=>{const{blockProps:o,image:l,styles:s,alt:r,height:n,width:a,lazyLoading:c}=e;return h.isEmpty(l)?i.jsxRuntimeExports.jsx(w,{className:"h-36"}):m.createElement("img",{...o,...s,src:l,alt:r,loading:c?"lazy":"eager",height:n,width:a})},oe={type:"Image",label:"Image",category:"core",icon:g.ImageIcon,group:"media",props:{styles:t.T({default:""}),image:t.x({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:t.g({title:"Alt text",default:"",ai:!0,i18n:!0}),width:t.g({title:"Width",default:""}),height:t.g({title:"Height",default:""}),lazyLoading:t.c({title:"Lazy Load",default:!0})}},v=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,_=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,j=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,se=e=>{if(v.test(e)){const o=e.match(v);return o?`https://www.youtube.com/embed/${o[4]}`:e}if(_.test(e)){const o=e.match(_);return o?`https://player.vimeo.com/video/${o[3]}`:e}if(j.test(e)){const o=e.match(j);return o?`https://www.dailymotion.com/embed/video/${o[4]}`:e}return null},re=m.memo(e=>{const{blockProps:o,inBuilder:l,styles:s,url:r,controls:n}=e,a=h.get(n,"autoPlay",!1),c=h.get(n,"controls",!1),u=a||h.get(n,"muted",!0),d=h.get(n,"loop",!1);if(h.isEmpty(r))return i.jsxRuntimeExports.jsx(w,{inBuilder:l,className:"h-36"});let f=se(r),b=null;if(f){if(!h.isEmpty(f)){const x=[];x.push(`autoplay=${a?1:0}`),x.push(`controls=${n?1:0}`),x.push(`mute=${u?1:0}&muted=${u?1:0}`),x.push(`loop=${d?1:0}`),f=`${f}?${x.join("&")}`}b=m.createElement("iframe",{...o,className:"absolute inset-0 w-full h-full",src:f,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else b=m.createElement("video",{...o,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:u,autoPlay:l?!1:a,loop:d});return i.jsxRuntimeExports.jsx("div",{...h.pick(s,["className"]),children:i.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?i.jsxRuntimeExports.jsx("div",{...o,...h.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,b]})})}),ie={type:"Video",label:"Video",category:"core",icon:g.VideoIcon,group:"media",props:{styles:t.T({default:""}),url:t.g({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann",i18n:!0}),controls:t.b({title:"Controls",properties:{autoPlay:t.c({title:"Autoplay",default:!0}),controls:t.c({title:"Controls",default:!1}),loop:t.c({title:"Loop",default:!1}),muted:t.c({title:"Muted",default:!0})}})}};function ne(e){return y.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(e)}const ae=e=>{const{scripts:o,inBuilder:l,blockProps:s}=e;return l?i.jsxRuntimeExports.jsx("div",{...s,children:i.jsxRuntimeExports.jsx("div",{className:y.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsxRuntimeExports.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.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},ce={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:ne,group:"advanced",props:{scripts:t.l({title:"Script",default:"",placeholder:"<script>console.log('Hello, world!');<\/script>"})}},ue=e=>{const{blockProps:o,styles:l}=e;return m.createElement("hr",{...l,...o})},de={type:"Divider",label:"web_blocks.divider",category:"core",icon:g.DividerHorizontalIcon,group:"basic",props:{styles:t.T({default:"bg-gray-900 h-0.5 py-2 my-1"})}},pe=()=>null,me={type:"Dark Mode",label:"web_blocks.dark_mode",category:"core",icon:g.MoonIcon,group:"advanced",props:{},blocks:()=>[{_id:"ultqCh",_type:"Span",tag:"span",styles:"#styles:,",_name:"Dark Mode Switcher"},{_id:"vroabi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"eweibk",_parent:"vroabi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"nltBrv",_parent:"eweibk",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"sgbhDo",_parent:"gesydi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"AdDwBC",_parent:"sgbhDo",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]},ge=e=>{const{blockProps:o,inBuilder:l,children:s,globalBlock:r}=e;return l&&!r?i.jsxRuntimeExports.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.jsxRuntimeExports.jsxs("h1",{children:["Global Block - ",r]}),i.jsxRuntimeExports.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):m.createElement("div",{...o},s)},be={type:"GlobalBlock",label:"Global Block",icon:C.GlobeIcon,category:"core",group:"advanced",props:{globalBlock:t.g({title:"global block",default:"",hidden:!0})}},he=e=>e.inBuilder||e.forceWrapper?i.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...e.blockProps,children:e.content}):`${e.content}`,fe={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:g.SpaceBetweenVerticallyIcon,props:{content:t.f({title:"Content",default:"",ai:!0,i18n:!0})}},ye=e=>{const{blockProps:o,backgroundImage:l,children:s,styles:r}=e;let n={};return l&&(n={backgroundImage:`url(${l})`}),m.createElement("div",{...o,...r,style:n},s)},xe={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:t.T({default:"font-body antialiased"}),backgroundImage:t.x({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},ke=e=>{const{blockProps:o,styles:l}=e;return m.createElement("br",{...o,...l})},we={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:g.SpaceBetweenVerticallyIcon,props:{styles:t.T({default:""})}},ve=e=>{const{blockProps:o,errorMessage:l,name:s,_type:r,successMessage:n,action:a,styles:c,children:u}=e;let d=u;u||(d=i.jsxRuntimeExports.jsx(w,{}));const f={"x-data":"{}","x-on:submit.prevent":"post"},b={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxRuntimeExports.jsxs("form",{...f,"data-error":l,"data-success":n,method:"post",action:a,...o,...c,children:[i.jsxRuntimeExports.jsx("div",{...b}),i.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:s||r}),d]})},_e={type:"Form",label:"Form",category:"core",icon:g.GroupIcon,group:"form",props:{styles:t.T({default:""}),action:t.g({title:"Submit URL",default:"/api/form/submit"}),errorMessage:t.m({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:t.m({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0},je=e=>{const{blockProps:o,inBuilder:l,label:s,styles:r,inputStyles:n,icon:a,iconPos:c}=e,u=y.generateUUID(),d={"x-bind:disabled":"formLoading"};return i.jsxRuntimeExports.jsxs("button",{id:u,...d,...n,...r,...o||{},type:l?"button":"submit",children:[s,a&&i.jsxRuntimeExports.jsx("span",{className:c,dangerouslySetInnerHTML:{__html:a}})]})},Be={type:"FormButton",label:"Submit Button",category:"core",icon:g.ButtonIcon,group:"form",props:{label:t.g({title:"Label",default:"Submit",ai:!0,i18n:!0}),styles:t.T({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:t.q({title:"Icon",default:""}),iconPos:t.y({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}},Ee=e=>{const{blockProps:o,label:l,placeholder:s,styles:r,inputStyles:n,showLabel:a,required:c,inputType:u="text",inBuilder:d,fieldName:f}=e,b=y.generateUUID();return!a||u==="submit"?(u==="submit"&&(o.value=l),i.jsxRuntimeExports.jsx("input",{id:b,name:f,readOnly:d,...o,...n,...r,type:u,placeholder:s,required:c})):i.jsxRuntimeExports.jsxs("div",{...r,...o,children:[a&&i.jsxRuntimeExports.jsx("label",{htmlFor:b,children:l}),i.jsxRuntimeExports.jsx("input",{name:f,readOnly:d,...n,id:b,type:u,placeholder:s,required:c})]})},Ce={type:"Input",label:"Input",category:"core",icon:g.InputIcon,group:"form",props:{styles:t.T({default:""}),fieldName:t.g({title:"Field Name",default:"input"}),inputType:t.y({title:"Type",options:h.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],e=>({value:e,title:e})),default:"text"}),value:t.g({title:"Value",default:"",ai:!0,i18n:!0}),showLabel:t.c({title:"Show Label",default:!0}),inputStyles:t.T({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label",ai:!0,i18n:!0}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),required:t.c({title:"Required",default:!1})}},Ie=e=>{const{blockProps:o,fieldName:l,label:s,styles:r,inputStyles:n,checked:a,required:c,showLabel:u=!0}=e,d=y.generateUUID();return u?i.jsxRuntimeExports.jsxs("div",{...r,...o,children:[i.jsxRuntimeExports.jsx("input",{...n,name:l,id:d,type:"radio",required:c,defaultChecked:a}),s&&i.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s})]}):i.jsxRuntimeExports.jsx("input",{id:d,...o,...n,...r,type:"radio",required:c,checked:a,name:l})},Re={type:"Radio",label:"web_blocks.radio",category:"core",icon:g.RadiobuttonIcon,group:"form",props:{styles:t.T({default:"flex items-center w-max gap-x-2"}),fieldName:t.g({title:"web_blocks.field_name",default:"radio"}),label:t.g({title:"web_blocks.label",default:"Label"}),checked:t.c({title:"web_blocks.checked",default:!1}),required:t.c({title:"web_blocks.required",default:!1})}},Le=e=>{const{blockProps:o,fieldName:l,label:s,placeholder:r,styles:n,inputStyles:a,required:c,showLabel:u,_multiple:d=!1}=e,f=y.generateUUID();return u?i.jsxRuntimeExports.jsxs("div",{...n,children:[u&&i.jsxRuntimeExports.jsx("label",{htmlFor:f,children:s}),i.jsxRuntimeExports.jsxs("select",{...a,id:f,required:c,multiple:d,name:l,children:[i.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),h.map(e.options,b=>i.jsxRuntimeExports.jsx("option",{selected:h.get(b,"selected",!1),value:b.value,dangerouslySetInnerHTML:{__html:b.label}},b.value))]})]}):i.jsxRuntimeExports.jsxs("select",{id:f,...n,...o,required:c,multiple:d,name:l,children:[i.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),h.map(e.options,b=>i.jsxRuntimeExports.jsx("option",{selected:h.get(b,"selected",!1),value:b.value,dangerouslySetInnerHTML:{__html:b.label}},b.value))]})},Se={type:"Select",label:"web_blocks.select",category:"core",icon:g.DropdownMenuIcon,group:"form",props:{styles:t.T({default:""}),fieldName:t.g({title:"Field Name",default:"select"}),showLabel:t.c({title:"Show Label",default:!0}),inputStyles:t.T({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label",ai:!0,i18n:!0}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),required:t.c({title:"Required",default:!1}),_multiple:t.c({title:"Multiple",default:!1}),options:t.S({title:"Options",itemProperties:{label:t.g({title:"Label",default:"",ai:!0,i18n:!0}),value:t.g({title:"Value",default:""})}})}},Te=e=>{const{blockProps:o,fieldName:l,label:s,placeholder:r,styles:n,inputStyles:a,_rows:c,showLabel:u}=e,d=y.generateUUID();return u?i.jsxRuntimeExports.jsxs("div",{...n,...o,children:[u&&i.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s}),i.jsxRuntimeExports.jsx("textarea",{name:l,...a,id:d,placeholder:r,rows:c})]}):i.jsxRuntimeExports.jsx("textarea",{id:d,name:l,...o,...a,...n,placeholder:r,rows:c})},Me={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:g.InputIcon,group:"form",props:{fieldName:t.g({title:"Field Name",default:"textarea"}),showLabel:t.c({title:"Show Label",default:!0}),styles:t.T({default:""}),inputStyles:t.T({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label",ai:!0,i18n:!0}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),_rows:t.s({title:"Rows",default:3})}},Pe=e=>{const{blockProps:o,fieldName:l,label:s,styles:r,inputStyles:n,required:a,checked:c,showLabel:u=!0}=e,d=y.generateUUID();return u?i.jsxRuntimeExports.jsxs("div",{...r,...o,children:[i.jsxRuntimeExports.jsx("input",{...n,name:l,id:d,type:"checkbox",required:a,defaultChecked:c}),s&&s!=="Label"&&i.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s})]}):i.jsxRuntimeExports.jsx("input",{id:d,...o,...n,...r,type:"checkbox",required:a,name:l})},Ne={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:g.CheckboxIcon,group:"form",props:{fieldName:t.g({title:"Field Name",default:"checkbox"}),styles:t.T({default:"flex items-center gap-x-2"}),label:t.g({title:"web_blocks.label",default:"Label"}),checked:t.c({title:"web_blocks.checked",default:!1}),required:t.c({title:"web_blocks.required",default:!1})}},$e=()=>{p.registerChaiBlock(L,S),p.registerChaiBlock($,q),p.registerChaiBlock(T,M),p.registerChaiBlock(H,z),p.registerChaiBlock(D,A),p.registerChaiBlock(U,F),p.registerChaiBlock(O,V),p.registerChaiBlock(G,W),p.registerChaiBlock(X,Y),p.registerChaiBlock(Z,J),p.registerChaiBlock(K,Q),p.registerChaiBlock(ee,te),p.registerChaiBlock(le,oe),p.registerChaiBlock(re,ie),p.registerChaiBlock(P,N),p.registerChaiBlock(he,fe),p.registerChaiBlock(ve,_e),p.registerChaiBlock(je,Be),p.registerChaiBlock(Ee,Ce),p.registerChaiBlock(Pe,Ne),p.registerChaiBlock(Ie,Re),p.registerChaiBlock(Le,Se),p.registerChaiBlock(Te,Me),p.registerChaiBlock(ke,we),p.registerChaiBlock(ye,xe),p.registerChaiBlock(ae,ce),p.registerChaiBlock(ue,de),p.registerChaiBlock(pe,me),p.registerChaiBlock(ge,be)};exports.loadWebBlocks=$e;
|
|
3
|
+
nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},A=e=>{const{blockProps:r,styles:t,content:s,children:l=null,tag:n}=e;return l?d.createElement("span",{...t,...r},l):d.createElement(n||"span",{...t,...r,dangerouslySetInnerHTML:{__html:s||""}})},U={type:"Span",label:"Span",category:"core",group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},O=e=>{const{blockProps:r,content:t,styles:s}=e;return i.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i.jsxRuntimeExports.jsx("div",{...r,...s,dangerouslySetInnerHTML:{__html:t}})})},F={type:"RichText",label:"Rich Text",category:"core",icon:g.CursorTextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.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"]},G=e=>{const{blockProps:r,link:t,children:s,styles:l,inBuilder:n,content:a}=e;let c={};return!s&&y.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?s?i.jsxRuntimeExports.jsx("span",{...r,style:c,...l,children:s}):d.createElement("span",{...r,...l,style:c},a):s?i.jsxRuntimeExports.jsx("a",{href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...r,...l,children:s}):d.createElement("a",{...r,...l,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self"},a)},V={type:"Link",label:"Link",category:"core",icon:g.Link1Icon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.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"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},C=(e,...r)=>({...e,className:f.cn(e.className,...r)}),W=e=>{const{blockProps:r,children:t,styles:s,inBuilder:l,content:n,href:a}=e,{hrefType:c,autoplay:p,maxWidth:u,backdropColor:h,galleryName:b}=e,m=C(s,"cb-lightbox");if(!t&&y.isEmpty(s==null?void 0:s.className)&&y.isEmpty(n))return i.jsxRuntimeExports.jsx(k,{inBuilder:l});if(l)return t?i.jsxRuntimeExports.jsx("span",{...r,...m,children:t}):d.createElement("span",{...r,...m,dangerouslySetInnerHTML:{__html:n}});const x={};return x["data-vbtype"]=c,p&&(x["data-autoplay"]="true"),u&&(x["data-maxwidth"]=u+"px"),h&&(x["data-overlay"]=h),b&&(x["data-gall"]=b),t?i.jsxRuntimeExports.jsx("a",{...x,href:a||"#/",...r,...m,children:t}):d.createElement("a",{...r,...m,...x,href:a||"#",dangerouslySetInnerHTML:{__html:n}})},X={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:g.ImageIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"Link text or drop blocks inside"},href:{type:"string",title:"Href",default:""},hrefType:{type:"string",title:"Type",default:"video",oneOf:[{type:"string",title:"Video",enum:["video"]},{type:"string",title:"Iframe",enum:["iframe"]},{type:"string",title:"Inline",enum:["inline"]},{type:"string",title:"Ajax",enum:["ajax"]}]},autoplay:{type:"boolean",title:"Autoplay",default:!1,dependencies:{hrefType:["video"]}},maxWidth:{type:"number",title:"Max Width",default:""},backdropColor:{type:"string",title:"Backdrop Color",default:""},galleryName:{type:"string",title:"Gallery Name",default:""}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},Y=e=>{const{blockProps:r,children:t,listType:s,styles:l,tag:n,inBuilder:a}=e,c=f.cn(y.get(l,"className",""),s);return!t&&y.isEmpty(l==null?void 0:l.className)?i.jsxRuntimeExports.jsx(k,{inBuilder:a}):d.createElement(n||(s==="list-decimal"?"ol":"ul"),{...r,...l,className:c},t)},Z={type:"List",label:"web_blocks.list",icon:g.RowsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),listType:{type:"string",title:"List Type",default:"list-none",oneOf:[{enum:["list-none"],title:"List None"},{enum:["list-disc"],title:"Disc"},{enum:["list-decimal"],title:"Decimal"}]}}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",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"}]},J=e=>{const{blockProps:r,content:t,styles:s,children:l,tag:n}=e;return l?d.createElement(n||"li",{...s,...r},l):d.createElement(n||"li",{...s,...r,dangerouslySetInnerHTML:{__html:t}})},K={type:"ListItem",label:"List Item",icon:g.ColumnsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.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"},Q=e=>{const{blockProps:r,icon:t,styles:s,width:l,inBuilder:n,height:a}=e,c=C(s,f.cn(l?`w-[${l}px]`:"",a?`h-[${a}px]`:""));if(y.isEmpty(t))return i.jsxRuntimeExports.jsx(k,{inBuilder:n,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return d.createElement("span",{...r,...c,dangerouslySetInnerHTML:{__html:p}})},ee={type:"Icon",label:"web_blocks.icon",category:"core",icon:g.SketchLogoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-black"),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"}}})},te=e=>{const{blockProps:r,image:t,styles:s,alt:l,height:n,width:a,lazyLoading:c}=e;return y.isEmpty(t)?i.jsxRuntimeExports.jsx(k,{className:"h-36"}):d.createElement("img",{...r,...s,src:t,alt:l,loading:c?"lazy":"eager",height:n,width:a})},oe={type:"Image",label:"Image",category:"core",icon:g.ImageIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},mobileWidth:{type:"number",title:"Mobile Width",default:"",ui:{"ui:placeholder":"Enter width"}},mobileHeight:{type:"number",title:"Mobile Height",default:"",ui:{"ui:placeholder":"Enter height"}}}}),aiProps:["alt"],i18nProps:["alt"]},B=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,j=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,S=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,re=e=>{if(B.test(e)){const r=e.match(B);return r?`https://www.youtube.com/embed/${r[4]}`:e}if(j.test(e)){const r=e.match(j);return r?`https://player.vimeo.com/video/${r[3]}`:e}if(S.test(e)){const r=e.match(S);return r?`https://www.dailymotion.com/embed/video/${r[4]}`:e}return null},se=d.memo(e=>{const{blockProps:r,inBuilder:t,styles:s,url:l,controls:n}=e,a=y.get(n,"autoPlay",!1),c=y.get(n,"controls",!1),p=a||y.get(n,"muted",!0),u=y.get(n,"loop",!1);if(y.isEmpty(l))return i.jsxRuntimeExports.jsx(k,{inBuilder:t,className:"h-36"});let h=re(l),b=null;if(h){if(!y.isEmpty(h)){const m=[];m.push(`autoplay=${a?1:0}`),m.push(`controls=${n?1:0}`),m.push(`mute=${p?1:0}&muted=${p?1:0}`),m.push(`loop=${u?1:0}`),h=`${h}?${m.join("&")}`}b=d.createElement("iframe",{...r,className:"absolute inset-0 w-full h-full",src:h,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else b=d.createElement("video",{...r,className:"absolute inset-0 w-full h-full",src:l,controls:c,muted:p,autoPlay:t?!1:a,loop:u});return i.jsxRuntimeExports.jsx("div",{...y.pick(s,["className"]),children:i.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?i.jsxRuntimeExports.jsx("div",{...r,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,b]})})}),le={type:"Video",label:"Video",category:"core",icon:g.VideoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),url:{type:"string",title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"},controls:{type:"object",title:"Controls",default:{autoplay:!1,controls:!0,loop:!1,muted:!1},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}}}}}),i18nProps:["url"]},ie=e=>{const{blockProps:r,styles:t}=e;return d.createElement("hr",{...t,...r})},ne={type:"Divider",label:"web_blocks.divider",category:"core",icon:g.DividerHorizontalIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})};function ae(e){return f.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(e)}const ce=e=>{const{scripts:r,inBuilder:t,blockProps:s}=e;return t?i.jsxRuntimeExports.jsx("div",{...s,children:i.jsxRuntimeExports.jsx("div",{className:f.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsxRuntimeExports.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.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:r}})},pe={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:ae,group:"advanced",...o.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},ue=e=>null,de={type:"Dark Mode",label:"web_blocks.dark_mode",category:"core",icon:g.MoonIcon,group:"advanced",...o.registerChaiBlockSchema({properties:{}}),blocks:()=>[{_id:"ultqCh",_type:"Span",tag:"span",styles:"#styles:,",_name:"Dark Mode Switcher"},{_id:"vroabi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"eweibk",_parent:"vroabi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"nltBrv",_parent:"eweibk",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"sgbhDo",_parent:"gesydi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"AdDwBC",_parent:"sgbhDo",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]},ge=e=>{const{blockProps:r,inBuilder:t,children:s,globalBlock:l}=e;return t&&!l?i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...r,children:[i.jsxRuntimeExports.jsxs("h1",{children:["Global Block - ",l]}),i.jsxRuntimeExports.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):d.createElement("div",{...r},s)},me={type:"GlobalBlock",label:"Global Block",icon:w.GlobeIcon,category:"core",group:"advanced",...o.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},ye=e=>e.inBuilder||e.forceWrapper?i.jsxRuntimeExports.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,he={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:g.SpaceBetweenVerticallyIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-black"),content:{type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},fe=e=>{const{blockProps:r,backgroundImage:t,children:s,styles:l,tag:n}=e;let a={};return t&&(a={backgroundImage:`url(${t})`}),d.createElement(n||"div",{...r,...l,style:a},s)},be={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("font-body antialiased"),backgroundImage:{type:"string",title:"Image",default:"",ui:{"ui:widget":"image"}},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"}]}}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},xe=e=>{const{blockProps:r,styles:t}=e;return d.createElement("br",{...r,...t})},ke={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Be=e=>{const{children:r,blockProps:t,errorMessage:s,successMessage:l,action:n,styles:a}=e;let c=r;r||(c=i.jsxRuntimeExports.jsx(k,{}));const p={"x-data":"{}","x-on:submit.prevent":"post"},u={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxRuntimeExports.jsxs("form",{...p,"data-error":s,"data-success":l,method:"post",action:n,...t,...a,children:[i.jsxRuntimeExports.jsx("div",{...u}),c]})},je={type:"Form",label:"Form",category:"core",icon:w.GroupIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form/submit"},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},Se=e=>{const{blockProps:r,inBuilder:t,label:s,styles:l,inputStyles:n,icon:a,iconSize:c,iconPos:p}=e,u=f.generateUUID(),h={"x-bind:disabled":"formLoading"};return i.jsxRuntimeExports.jsxs("button",{id:u,...h,...n,...l,...r||{},type:t?"button":"submit",children:[s,a&&i.jsxRuntimeExports.jsx("div",{style:{width:c+"px"},className:p+" "+(p==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},we={type:"FormButton",label:"Submit Button",category:"core",icon:g.ButtonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),inputStyles:o.StylesProp(""),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"]},Ce=e=>{const{blockProps:r,fieldName:t,label:s,placeholder:l,styles:n,inputStyles:a,showLabel:c,required:p,inputType:u}=e,h=f.generateUUID();return c?i.jsxRuntimeExports.jsxs("div",{...n,...r,children:[c&&i.jsxRuntimeExports.jsx("label",{htmlFor:h,children:s}),i.jsxRuntimeExports.jsx("input",{name:t,...a,id:h,type:u,placeholder:l,required:p})]}):i.jsxRuntimeExports.jsx("input",{id:h,name:t,...r,...a,...n,type:u,placeholder:l,required:p})},ve={type:"Input",label:"web_blocks.input",category:"core",icon:g.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),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},inputType:{type:"string",title:"Input Type",default:"text",enum:["text","email","password","number","tel","file","hidden","range","submit","color","date","time"]}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Ee=e=>{const{blockProps:r,fieldName:t,label:s,styles:l,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,u=f.generateUUID();return p?i.jsxRuntimeExports.jsxs("div",{...l,...r,children:[i.jsxRuntimeExports.jsx("input",{...n,name:t,id:u,type:"radio",required:a,defaultChecked:c}),s&&i.jsxRuntimeExports.jsx("label",{htmlFor:u,children:s})]}):i.jsxRuntimeExports.jsx("input",{id:u,...r,...n,...l,type:"radio",required:a,checked:c,name:t})},Pe={type:"Radio",label:"web_blocks.radio",category:"core",icon:g.RadiobuttonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),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"]},Ie=e=>{const{blockProps:r,fieldName:t,label:s,placeholder:l,styles:n,inputStyles:a,required:c,showLabel:p,_multiple:u,options:h}=e,b=f.generateUUID();return p?i.jsxRuntimeExports.jsxs("div",{...n,...r,children:[p&&i.jsxRuntimeExports.jsx("label",{htmlFor:b,children:s}),i.jsxRuntimeExports.jsxs("select",{...a,id:b,required:c,multiple:u,name:t,children:[i.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:l}),y.map(h,m=>i.jsxRuntimeExports.jsx("option",{value:m.value,dangerouslySetInnerHTML:{__html:m.label}},m.value))]})]}):i.jsxRuntimeExports.jsxs("select",{id:b,...n,...r,required:c,multiple:u,name:t,children:[i.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:l}),y.map(h,m=>i.jsxRuntimeExports.jsx("option",{value:m.value,dangerouslySetInnerHTML:{__html:m.label}},m.value))]})},Le={type:"Select",label:"web_blocks.select",category:"core",icon:g.DropdownMenuIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),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},_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"]},_e=e=>{const{blockProps:r,fieldName:t,label:s,placeholder:l,styles:n,inputStyles:a,_rows:c,showLabel:p}=e,u=f.generateUUID();return p?i.jsxRuntimeExports.jsxs("div",{...n,...r,children:[p&&i.jsxRuntimeExports.jsx("label",{htmlFor:u,children:s}),i.jsxRuntimeExports.jsx("textarea",{name:t,...a,id:u,placeholder:l,rows:c})]}):i.jsxRuntimeExports.jsx("textarea",{id:u,name:t,...r,...a,...n,placeholder:l,rows:c})},Re={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:g.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.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}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Me=e=>{const{blockProps:r,fieldName:t,label:s,styles:l,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,u=f.generateUUID();return p?i.jsxRuntimeExports.jsxs("div",{...l,...r,children:[i.jsxRuntimeExports.jsx("input",{...n,name:t,id:u,type:"checkbox",required:a,defaultChecked:c}),s&&i.jsxRuntimeExports.jsx("label",{htmlFor:u,children:s})]}):i.jsxRuntimeExports.jsx("input",{id:u,...r,...n,...l,type:"checkbox",required:a,name:t})},Te={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:g.CheckboxIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),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"]},$e=e=>{const{blockProps:r,content:t,styles:s,children:l}=e,n={...s,...r};return l?d.createElement("label",n,l):d.createElement("label",{...n,dangerouslySetInnerHTML:{__html:t}})},Ne={type:"Label",label:"Label",category:"core",icon:g.LetterCaseToggleIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(),content:{type:"string",title:"Content",default:""}}})},ze=()=>{o.registerChaiBlock(I,L),o.registerChaiBlock($,N),o.registerChaiBlock(_,R),o.registerChaiBlock(z,H),o.registerChaiBlock(D,q),o.registerChaiBlock(A,U),o.registerChaiBlock(O,F),o.registerChaiBlock(G,V),o.registerChaiBlock(W,X),o.registerChaiBlock(Y,Z),o.registerChaiBlock(J,K),o.registerChaiBlock(Q,ee),o.registerChaiBlock(te,oe),o.registerChaiBlock(se,le),o.registerChaiBlock(M,T),o.registerChaiBlock(ce,pe),o.registerChaiBlock(ye,he),o.registerChaiBlock(Be,je),o.registerChaiBlock(Se,we),o.registerChaiBlock(Ce,ve),o.registerChaiBlock(Me,Te),o.registerChaiBlock(Ee,Pe),o.registerChaiBlock(Ie,Le),o.registerChaiBlock(_e,Re),o.registerChaiBlock($e,Ne),o.registerChaiBlock(xe,ke),o.registerChaiBlock(fe,be),o.registerChaiBlock(ie,ne),o.registerChaiBlock(ue,de),o.registerChaiBlock(ge,me)};exports.loadWebBlocks=ze;
|