@chaibuilder/sdk 1.0.20 → 1.0.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/{AddBlocks-U6bHEqmk.js → AddBlocks-0-e393Fn.js} +7 -5
- package/dist/AddBlocks-p68Cz79o.cjs +3 -0
- package/dist/BrandingOptions-HtNCJO9_.cjs +1 -0
- package/dist/{BrandingOptions-qDgIOayU.js → BrandingOptions-QqqJ-YRb.js} +14 -21
- package/dist/{CanvasArea-_poBbOON.js → CanvasArea-0hMAhzxn.js} +14 -13
- package/dist/{CanvasArea-yXpQHB6x.cjs → CanvasArea-pZz5czrV.cjs} +4 -4
- package/dist/{CurrentPage-SrovfgGL.js → CurrentPage-UOkxZISs.js} +15 -14
- package/dist/CurrentPage-phMDH1Ub.cjs +1 -0
- package/dist/Layers-NKZXi2LV.cjs +1 -0
- package/dist/{Layers-OKJ5nkTF.js → Layers-TB-Lriju.js} +17 -16
- package/dist/MODIFIERS-MLfpKQY1.js +73 -0
- package/dist/MODIFIERS-WFzDQfiT.cjs +1 -0
- package/dist/MarkAsGlobalBlock-5h3wP4zj.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-Ynq-S6mW.js → MarkAsGlobalBlock-Pa8po8qP.js} +10 -9
- package/dist/PagesPanel-ffrNyFyp.cjs +1 -0
- package/dist/{PagesPanel-5macGkBU.js → PagesPanel-mAMSbYPt.js} +20 -19
- package/dist/ProjectPanel-1ywILLme.cjs +1 -0
- package/dist/{ProjectPanel-HS_TJ2k0.js → ProjectPanel-XvsYajju.js} +16 -15
- package/dist/{Settings-23ZBoDkz.js → Settings-8AbHXcDP.js} +18 -16
- package/dist/Settings-hdmnT_mI.cjs +1 -0
- package/dist/{SidePanels-HzpyQU1x.js → SidePanels-LQg3mdC4.js} +27 -26
- package/dist/SidePanels-xaNrI3oK.cjs +1 -0
- package/dist/Topbar-A3WZDrK4.cjs +1 -0
- package/dist/{Topbar-tfg74vbT.js → Topbar-wA6jhMj9.js} +26 -25
- package/dist/UnsplashImages-E8zPMgJf.cjs +1 -0
- package/dist/{UnsplashImages-tvUZGbHK.js → UnsplashImages-mzIO1QeT.js} +8 -7
- package/dist/UploadImages-qEuDUEMn.cjs +1 -0
- package/dist/{UploadImages-pKoVEsI7.js → UploadImages-qMeaY4sk.js} +8 -7
- package/dist/add-page-modal-9deiA1W9.cjs +1 -0
- package/dist/{add-page-modal-217go3Eh.js → add-page-modal-oER3yE4F.js} +20 -18
- package/dist/{confirm-alert-AG96Fmck.js → confirm-alert-rDSai_jQ.js} +9 -8
- package/dist/confirm-alert-tH8UCCSF.cjs +1 -0
- package/dist/controls-G0puEH71.js +120 -0
- package/dist/controls-aHZq-q4b.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +72 -71
- package/dist/{delete-page-modal-YYt_TVmB.js → delete-page-modal-QzQdrLYI.js} +21 -20
- package/dist/delete-page-modal-ShTRkqkB.cjs +1 -0
- package/dist/{form-Ik57WNLs.cjs → form-MlgUSEy_.cjs} +1 -1
- package/dist/{form-gIapXg-W.js → form-vWeEsG9Y.js} +2 -2
- package/dist/functions-eu6BbvqO.cjs +2 -0
- package/dist/functions-hmbWDcnW.js +1108 -0
- package/dist/{index-PrUoEet_.js → index-G55KtqnU.js} +190 -189
- package/dist/index-T5MFAHA0.cjs +1 -0
- package/dist/{index-4DQm5fFW.js → index-mLIwGF5W.js} +5439 -5429
- package/dist/{index-tTN-yd28.cjs → index-pCHSFoQO.cjs} +44 -44
- package/dist/{jsx-runtime-qAwJ85SY.js → jsx-runtime-NV737rRe.js} +1 -1
- package/dist/{jsx-runtime-WKRPbKtm.cjs → jsx-runtime-WUGKV8jN.cjs} +6 -6
- package/dist/lib.cjs +1 -2
- package/dist/lib.js +116 -1208
- package/dist/page-viewer-GPNN1H92.cjs +1 -0
- package/dist/{page-viewer-LQSQxs98.js → page-viewer-X3IEOrUC.js} +17 -16
- package/dist/project-general-setting-HZeYf9A1.cjs +1 -0
- package/dist/{project-general-setting-04N25MvJ.js → project-general-setting-oujmeWOG.js} +21 -19
- package/dist/project-seo-setting-3FZQXaTn.cjs +1 -0
- package/dist/{project-seo-setting-zxnjvt3c.js → project-seo-setting-_X6ckVa4.js} +17 -24
- package/dist/render.cjs +1 -1
- package/dist/render.js +40 -44
- package/dist/single-page-detail-ILshOKys.cjs +1 -0
- package/dist/{single-page-detail-lJHZSKqK.js → single-page-detail-SxboE7TI.js} +46 -44
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +20 -19
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +4 -4
- package/dist/ui.js +144 -143
- package/dist/utils-It2K33fU.cjs +1 -0
- package/dist/{Class-nQk08vqd.js → utils-PPBbw5bk.js} +115 -183
- package/package.json +2 -7
- package/dist/AddBlocks-LvIqNyBE.cjs +0 -3
- package/dist/BrandingOptions-viABH78W.cjs +0 -1
- package/dist/Class-RZuPYbUS.cjs +0 -1
- package/dist/CurrentPage-XWSb_RZ8.cjs +0 -1
- package/dist/Layers-oluQMEyo.cjs +0 -1
- package/dist/MarkAsGlobalBlock-PG9EQfno.cjs +0 -1
- package/dist/PagesPanel-wYA8ksbF.cjs +0 -1
- package/dist/ProjectPanel-4hGK3CSo.cjs +0 -1
- package/dist/Settings-KS4sVa5a.cjs +0 -1
- package/dist/SidePanels-IfwzrWxw.cjs +0 -1
- package/dist/Topbar-zZtHp9g8.cjs +0 -1
- package/dist/UnsplashImages-nA7MSE46.cjs +0 -1
- package/dist/UploadImages-Ne7knL-U.cjs +0 -1
- package/dist/add-page-modal-az5Y2__Z.cjs +0 -1
- package/dist/blocks.cjs +0 -1
- package/dist/blocks.d.ts +0 -4
- package/dist/blocks.js +0 -20
- package/dist/confirm-alert-tADWj_Cs.cjs +0 -1
- package/dist/delete-page-modal-iits21u4.cjs +0 -1
- package/dist/index-SSmZipiF.js +0 -1191
- package/dist/index-UXNvQkHk.cjs +0 -1
- package/dist/index-plLNWLKk.cjs +0 -9
- package/dist/page-viewer-2SE5kCoO.cjs +0 -1
- package/dist/project-general-setting-XunBDyuZ.cjs +0 -1
- package/dist/project-seo-setting-_nu22LPz.cjs +0 -1
- package/dist/single-page-detail-TjWZvxFa.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var le=Object.create;var z=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var pe=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var ce=(s,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ue(n))!de.call(s,l)&&l!==r&&z(s,l,{get:()=>n[l],enumerable:!(i=ae(n,l))||i.enumerable});return s};var xe=(s,n,r)=>(r=s!=null?le(pe(s)):{},ce(n||!s||!s.__esModule?z(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),q=require("@react-hookz/web"),t=require("lodash"),ee=require("react-i18next"),d=require("@radix-ui/react-icons"),o=require("./index-T5MFAHA0.cjs"),me=require("@rjsf/core"),ge=require("@rjsf/validator-ajv8"),he=require("./controls-aHZq-q4b.cjs"),_=require("lucide-react"),Y=require("@chaibuilder/runtime"),X=require("./index-pCHSFoQO.cjs"),ye=require("jotai"),be=require("react-autosuggest"),je=require("fuse.js"),V=require("./utils-It2K33fU.cjs"),fe=require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("i18next");require("clsx");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-eu6BbvqO.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("tailwind-merge");require("react-hotkeys-hook");require("sonner");function ve(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}return n.default=s,Object.freeze(n)}const M=ve(m),Re=m.lazy(()=>import("react-json-view"));function Ee(s){const n=[],r={};function i(l,u){t.forEach(u,(c,p)=>{const a=l?`${l}.${p}`:p,g=t.isArray(c)?"list":typeof c;n.push(a),r[a]=g==="string"?"text":g==="object"?"model":g,g==="object"&&!t.isArray(c)&&i(a,c)})}return i("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:n,pathsType:r}}const W=({data:s,fullView:n})=>{if(!s)return null;const r=typeof s;return n?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(X.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Re,{style:{maxHeight:"40vh",overflowY:"auto"},name:"Content",enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:s,collapsed:!0})})]}):e.jsxRuntimeExports.jsxs("div",{className:"text-gray-800/50 text-[12px] leading-4 w-full max-h-36 overflow-x-hidden overflow-y-auto",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},U=({type:s,value:n="",setValue:r,data:i,onChange:l,dataType:u,appliedBindings:c})=>{const{paths:p,pathsType:a}=Ee(i),g=s==="PROP"?Y.getBlockComponent(i==null?void 0:i._type):{},h=s==="PROP",[x,j]=m.useState(!1),b=m.useMemo(()=>s==="PROP"?p.filter(y=>!t.includes(c,y)&&t.get(g,`props.${t.first(t.split(y,"."))}.binding`)):p.filter(y=>u===t.get(a,y,"")),[s,p,c,u,g]);return m.useEffect(()=>{n&&l(n)},[n,s]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(s))}),e.jsxRuntimeExports.jsxs(o.Popover,{open:x,onOpenChange:j,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(n)?"bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white w-44 justify-center":"min-w-[350px] justify-between items-center"}`,children:n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"text-sm pr-8",children:[h&&e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 mr-2 rounded-full",children:t.startCase(u)}),n]}),e.jsxRuntimeExports.jsx("span",{className:"text-[9px] text-blue-400 underline cursor-pointer hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(s))]})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{className:"p-0 z-[999] min-w-[300px]",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(o.Command,{children:[e.jsxRuntimeExports.jsx(o.CommandInput,{placeholder:`Choose ${t.toLower(s)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(b,y=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:y,className:`cursor-pointer ${h?"flex justify-between items-center":"flex flex-col items-start justify-start"}`,onSelect:v=>{r(t.find(b,C=>C===v)||null),j(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(_.Check,{className:`w-4 h-4 text-green-500 ${n===y?"":"opacity-0"}`}),y]}),h?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 rounded-full",children:t.startCase(t.get(a,y,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(W,{data:t.get(i,y)})})]},y))})]})]})})]})]}),!h&&!t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(W,{data:t.get(i,n,""),fullView:!0})})]})},we=({appliedBindings:s=[],onAddBinding:n,editMode:r,item:i})=>{const[l,u]=m.useState(r?i.key:""),[c,p]=m.useState(r?i.value:""),a=o.useSelectedBlock(),[g]=X.useChaiExternalData(),h=m.useCallback((b,y)=>{if(t.isEmpty(b))return"";{const v=t.get(y==="PROP"?a:g,b,"");if(t.isArray(v))return"list";const C=typeof v;return C==="string"?"text":C==="object"?"model":C}},[a,g]),[x,j]=m.useState(r?h(i.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DialogHeader,{children:[e.jsxRuntimeExports.jsx(o.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(o.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 relative",children:[e.jsxRuntimeExports.jsx(U,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:l,setValue:u,onChange:b=>{const y=h(b,"PROP");u(b),x!==y&&p(""),j(y)},data:a,dataType:x,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(U,{type:"PATH",isDisabled:t.isEmpty(l),placeholder:"Enter data path",value:c,setValue:p,onChange:b=>{const y=h(b,"PATH");p(x===y?b:"")},data:g,dataType:x,appliedBindings:s})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(l)&&t.isEmpty(c),onClick:()=>n({key:l,value:c}),children:"Save"})})]})},te=({children:s,onAddBinding:n,appliedBindings:r,editMode:i=!0,item:l={}})=>{const[u,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{asChild:!0,onClick:()=>c(!0),children:s}),u&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(we,{item:l,editMode:i,appliedBindings:r,onAddBinding:p=>{n(p),c(!1)}})})]})},Ce=({item:s,onAddBinding:n,onRemove:r,selectedBlock:i,dataProvider:l,appliedBindings:u})=>{const[c,p]=m.useState("string"),a=(g,h)=>{if(t.isEmpty(g))return"";{const x=t.get(h==="PROP"?i:l,g,"");if(t.isArray(x))return"list";const j=typeof x;return j==="string"?"text":j==="object"?"model":j}};return m.useEffect(()=>p(()=>a(s.key,"PROP")),[s.key]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col border border-gray-200 relative rounded-md p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-gray-500 font-normal text-sm",children:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(W,{data:t.get(l,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(te,{editMode:!0,onAddBinding:n,appliedBindings:u,item:s,children:e.jsxRuntimeExports.jsx(_.EditIcon,{className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-blue-400 hover:text-white border-blue-400 p-1 text-blue-400 hover:scale-105 duration-200"})}),e.jsxRuntimeExports.jsx(_.TrashIcon,{onClick:()=>r(),className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-red-400 hover:text-white border-red-400 p-1 text-red-400 hover:scale-105 duration-200"})]}),!t.isEmpty(c)&&!t.isEmpty(s.key)&&e.jsxRuntimeExports.jsx("div",{className:"mt-px absolute right-0 top-1 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(c)})]})},ke=({bindingData:s,onChange:n})=>{const r=o.useSelectedBlock(),[i]=X.useChaiExternalData(),l=Y.getChaiDataProviders(),[u,c]=m.useState(t.map(s,(x,j)=>({key:j,value:x})));m.useEffect(()=>{c(t.map(s,(x,j)=>({key:j,value:x})))},[r==null?void 0:r._id]);const p=m.useMemo(()=>{if(t.isEmpty(i))return!0;if(t.isEmpty(u))return!1;const x=t.last(u);return t.isEmpty(x==null?void 0:x.key)||t.isEmpty(x==null?void 0:x.value)},[i,u]),a=x=>{const j=t.filter(u,b=>b.key!==x.key);c([...j,x]),h([...j,x])},g=x=>{const j=t.filter(u,(b,y)=>x!==y);h([...j])},h=m.useCallback((x=[])=>{if(c(x),t.isEmpty(x)){n({});return}const j={};t.forEach(x,b=>{!t.isEmpty(b==null?void 0:b.key)&&!t.isEmpty(b==null?void 0:b.value)&&t.set(j,b.key,b.value)}),n(j)},[n]);return t.isEmpty(l)?e.jsxRuntimeExports.jsx("div",{className:"w-full flex items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(u,(x,j)=>e.jsxRuntimeExports.jsx(Ce,{item:x,onAddBinding:a,onRemove:()=>g(j),selectedBlock:r,dataProvider:i,appliedBindings:t.map(u,"key")},x.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(te,{appliedBindings:t.map(u,"key"),onAddBinding:a,children:e.jsxRuntimeExports.jsx("button",{disabled:p,className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${p?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(i)?e.jsxRuntimeExports.jsx("small",{className:"text-gray-500 text-[9.5px]",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),p&&e.jsxRuntimeExports.jsx(o.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(i)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},Ne=()=>e.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),G=({createHistorySnapshot:s,properties:n,formData:r,onChange:i})=>{const[l]=o.useActiveLanguage(),u={type:"object",properties:{}},c={};return Object.keys(n).forEach(p=>{const a=n[p];if(t.includes(["slot","styles"],a.type))return;const g=t.get(a,"i18n",!1)?`${p}-${l}`:p;u.properties[g]=o.getBlockJSONFromSchemas(a,l),c[g]=o.getBlockJSONFromUISchemas(a,l)}),e.jsxRuntimeExports.jsx(me,{widgets:{binding:Ne,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,validator:ge,uiSchema:c,onBlur:s,schema:u,formData:r,onChange:i})};function Se(){const s=o.useSelectedBlock(),{createSnapshot:n}=o.useCanvasHistory(),r=o.useUpdateBlocksPropsRealtime(),i=Y.getBlockComponent(s._type),l={...s},u=()=>n(),c=({formData:h},x)=>{if(x){const j=x.replace("root.","");r([s._id],{[j]:t.get(h,j)})}},p={_name:he.u({title:"Name",default:t.get(s,"_name",s._type)})},a=t.keys(t.get(l,"_bindings",{})),g=m.useMemo(()=>{const h=t.cloneDeep(t.get(i,"props",{}));return t.each(a,x=>{delete h[x]}),h},[i,a]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(G,{onChange:c,createHistorySnapshot:u,formData:l,properties:p}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(s,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(ke,{bindingData:t.get(l,"_bindings",{}),onChange:h=>{c({formData:{...l,_bindings:h}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(o.AccordionContent,{className:"pt-4",children:[t.isEmpty(a)?"":e.jsxRuntimeExports.jsxs("div",{className:"text-xs mx-4 border rounded-sm p-1 mb-1 mt-0 border-orange-500 text-orange-500 bg-orange-100",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(a,t.capitalize).join(", ")})," ",a.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(G,{onChange:c,createHistorySnapshot:u,formData:l,properties:g})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const K=new je(V.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Te(){var S;const[s]=o.useSelectedStylingBlocks(),n=o.useSelectedBlock(),r=o.useAddClassesToBlocks(),i=o.useRemoveClassesFromBlocks(),[l]=o.useSelectedBlockIds(),[u,c]=m.useState(""),p=(S=t.first(s))==null?void 0:S.prop,a=t.reject((t.get(n,p,"").replace(fe.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),g=()=>{const E=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(l,E,!0),c("")},[h,x]=m.useState([]),j=({value:E})=>{const B=E.trim().toLowerCase(),T=B.match(/.+:/g);let w=[];if(T&&T.length>0){const[I]=T,H=B.replace(I,"");w=K.search(H).map(f=>({...f,item:{...f.item,name:I+f.item.name}}))}else w=K.search(B);x(t.map(w,"item"))},b=()=>{x([])},y=E=>E.name,v=E=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:E.name}),C={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:u,onKeyDown:E=>{E.key==="Enter"&&u.trim()!==""&&g()},onChange:(E,{newValue:B})=>c(B),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${h.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-5 overflow-y-auto bg-gray-100 px-px`,children:[e.jsxRuntimeExports.jsx(o.Label,{className:"mt-2",children:"Add Tailwind classes"}),e.jsxRuntimeExports.jsxs("div",{className:"relative -mt-4 flex items-center gap-x-3",children:[e.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:e.jsxRuntimeExports.jsx(be,{suggestions:h,onSuggestionsFetchRequested:j,onSuggestionsClearRequested:b,getSuggestionValue:y,renderSuggestion:v,inputProps:C,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"bg-gray-700 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:g,disabled:u.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(a)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-10 w-full items-center justify-center text-center text-sm text-gray-400",children:"No class added"}),M.Children.toArray(a.map(E=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[E,e.jsxRuntimeExports.jsx(d.Cross2Icon,{onClick:()=>i(l,[E]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},E)))]})]})}const N=["px","%","em","rem","ch","vh","vw"],Ie={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:N,property:"flexBasis"},{type:"range",label:"Order",property:"order"},{type:"dropdown",label:"Flex",property:"flexGrowShrink"},{type:"dropdown",label:"Grow",property:"flexGrow"},{type:"dropdown",label:"Shrink",property:"flexShrink"}]},Be={heading:"Grid Child",items:[{type:"range",label:"Col Span",property:"gridColSpan"},{type:"range",label:"Col Start",property:"gridColStart"},{type:"range",label:"Col End",property:"gridColEnd"},{type:"range",label:"Row Span",property:"gridRowSpan"},{type:"range",label:"Row Start",property:"gridRowStart"},{type:"range",label:"Row End",property:"gridRowEnd"},{type:"range",label:"Order",property:"order"}]},Ae=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:N},{styleType:"accordion",heading:"Flex options",items:[{type:"dropdown",label:"Direction",property:"flexDirection"},{type:"dropdown",label:"Wrap",property:"flexWrap"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"Grid options",items:[{type:"range",label:"Columns",property:"gridColumns"},{type:"range",label:"Rows",property:"gridRows"},{type:"dropdown",label:"Auto Flow",property:"gridAutoFlow"},{type:"dropdown",label:"Auto Cols",property:"gridAutoColumns"},{type:"dropdown",label:"Auto Rows",property:"gridAutoRows"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",units:["px","rem"],options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"Visibility & Opacity",items:[{type:"dropdown",label:"Visibility",property:"visibility",units:N},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...N,"auto"],options:[{key:"margin",label:"All"},{key:"marginX",label:"Left-Right"},{key:"marginY",label:"Top-Bottom"},{key:"marginTop",label:"Top"},{key:"marginRight",label:"Right"},{key:"marginBottom",label:"Bottom"},{key:"marginLeft",label:"Left"}]},{styleType:"multiple",label:"Padding",options:[{key:"padding",label:"All"},{key:"paddingX",label:"Left-Right"},{key:"paddingY",label:"Top-Bottom"},{key:"paddingTop",label:"Top"},{key:"paddingRight",label:"Right"},{key:"paddingBottom",label:"Bottom"},{key:"paddingLeft",label:"Left"}]},{styleType:"multiple",label:"Space Between",options:[{key:"spaceX",label:"Left-Right"},{key:"spaceY",label:"Top-Bottom"}]}]},{heading:"Size",items:[{type:"arbitrary",label:"Width",units:N.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:N.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:N.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:N.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:N.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:N.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"Object options & aspect ratio",items:[{type:"dropdown",label:"Aspect",property:"aspectRatio"},{type:"dropdown",label:"Fit",property:"objectFit"},{type:"dropdown",label:"Position",property:"objectPosition"}]}]},{heading:"Position",items:[{type:"icons",label:"Position",property:"position"},{styleType:"accordion",heading:"Position options",items:[{styleType:"multiple",label:"Direction",options:[{key:"top",label:"Top"},{key:"right",label:"Right"},{key:"bottom",label:"Bottom"},{key:"left",label:"Left"}]},{styleType:"multiple",label:"Inset",options:[{key:"inset",label:"All"},{key:"insetX",label:"Left Right"},{key:"insetY",label:"Top Bottom"}]},{type:"arbitrary",label:"Z-Chai",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"Float & Clear",items:[{type:"icons",label:"Float",property:"float"},{type:"dropdown",label:"Clear",property:"clear"}]},{styleType:"accordion",heading:"Overflow & Overscroll",items:[{styleType:"multiple",type:"dropdown",label:"Overflow",options:[{key:"overflow",label:"All"},{key:"overflowX",label:"Left-Right"},{key:"overflowY",label:"Top-Bottom"}]},{styleType:"multiple",type:"dropdown",label:"Overscroll",options:[{key:"overscroll",label:"All"},{key:"overscrollX",label:"Left-Right"},{key:"overscrollY",label:"Top-Bottom"}]}]}]},{heading:"Typography",items:[{type:"dropdown",property:"fontFamily",label:"Font"},{type:"arbitrary",property:"fontSize",label:"Size",units:N},{type:"arbitrary",property:"lineHeight",label:"Height",units:N.concat("-")},{type:"range",property:"fontWeight",label:"Weight"},{type:"color",property:"textColor",label:"Color"},{styleType:"accordion",heading:"Alignments",items:[{type:"dropdown",property:"textAlign",label:"Align"},{type:"dropdown",property:"verticalAlign",label:"V. Align"}]},{styleType:"accordion",heading:"Spacing, decoration & more",items:[{type:"dropdown",property:"letterSpacing",label:"Spacing"},{type:"dropdown",property:"textDecoration",label:"Decoration"},{type:"range",property:"textDecorationThickness",label:"Thickness"},{type:"dropdown",property:"textTransform",label:"Transform"}]},{styleType:"accordion",heading:"White space & breaks",items:[{type:"dropdown",property:"whitespace",label:"Whitespace"},{type:"dropdown",property:"wordBreak",label:"Wordbreak"}]}]},{heading:"Background",items:[{type:"color",label:"Bg. Color",property:"backgroundColor"},{styleType:"accordion",heading:"Position, Size & more",items:[{type:"dropdown",label:"Attachment",property:"backgroundAttachment"},{type:"dropdown",label:"Clipping",property:"backgroundClip"},{type:"dropdown",label:"Origin",property:"backgroundOrigin"},{type:"dropdown",label:"Position",property:"backgroundPosition"},{type:"dropdown",label:"Repeat",property:"backgroundRepeat"},{type:"dropdown",label:"Size",property:"backgroundSize"}]},{type:"dropdown",label:"Gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"Gradient colors",items:[{type:"color",label:"From",property:"fromColor"},{type:"color",label:"Via",property:"viaColor"},{type:"color",label:"To",property:"toColor"}]}]},{heading:"Border & Outline",items:[{styleType:"multiple",type:"dropdown",label:"Width",options:[{key:"border",label:"All"},{key:"borderX",label:"Left Right"},{key:"borderY",label:"Top bottom"},{key:"borderTop",label:"Top"},{key:"borderRight",label:"Right"},{key:"borderBottom",label:"Bottom"},{key:"borderLeft",label:"Left"}]},{styleType:"multiple",type:"dropdown",label:"Corners",options:[{key:"borderRadius",label:"All"},{key:"borderRadiusTop",label:"Top"},{key:"borderRadiusRight",label:"Right"},{key:"borderRadiusBottom",label:"Bottom"},{key:"borderRadiusLeft",label:"Left"},{key:"borderRadiusTopLeft",label:"Top Left"},{key:"borderRadiusTopRight",label:"Top right"},{key:"borderRadiusBottomRight",label:"Bottom right"},{key:"borderRadiusBottomLeft",label:"Bottom left"}]},{type:"color",label:"Color",property:"borderColor"},{type:"dropdown",label:"Style",property:"borderStyle"},{styleType:"accordion",heading:"Divide options",items:[{styleType:"multiple",type:"range",label:"Width",options:[{key:"divideXWidth",label:"Left Right"},{key:"divideYWidth",label:"Top Bottom"}]},{type:"color",label:"Color",property:"divideColor"},{type:"dropdown",label:"Style",property:"divideStyle"}]},{styleType:"accordion",heading:"Outline styling",items:[{type:"range",label:"Width",property:"outlineWidth"},{type:"range",label:"Offset",property:"outlineOffset"},{type:"dropdown",label:"Style",property:"outlineStyle"}]},{styleType:"accordion",heading:"Ring options",items:[{type:"range",label:"Width",property:"ringWidth"},{type:"color",label:"Color",property:"ringColor"},{type:"range",label:"Offset",property:"ringOffsetWidth"},{type:"color",label:"Off. color",property:"ringOffsetColor"}]}]},{heading:"Effect & Animation",items:[{type:"range",label:"Shadow",property:"boxShadow"},{type:"color",label:"Color",property:"boxShadowColor"},{type:"dropdown",label:"Cursor",property:"cursor"},{styleType:"accordion",heading:"Blend & Cursor",items:[{type:"dropdown",label:"Mix Blend",property:"mixBlendMode"},{type:"dropdown",label:"Bg. Blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"Transform",items:[{type:"dropdown",label:"Origin",property:"transformOrigin"},{styleType:"multiple",label:"Scale",units:["-"],options:[{key:"scale",label:"All"},{key:"scaleX",label:"Left-Right"},{key:"scaleY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Skew",units:["deg"],options:[{key:"skewX",label:"Left-Right"},{key:"skewY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Translate",negative:!0,options:[{key:"translateX",label:"Left-Right"},{key:"translateY",label:"Top-Bottom"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"Rotate",property:"rotate"}]},{styleType:"accordion",heading:"Animation",items:[{type:"dropdown",label:"Animation",property:"animation"},{type:"dropdown",label:"Transition",property:"transition"},{type:"dropdown",label:"Easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"Duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"Delay",property:"delay"}]}]},{heading:"Classes",items:[{component:Te}]}],se={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:d.EyeOpenIcon,invisible:d.EyeClosedIcon,hidden:d.EyeClosedIcon,gap:d.BorderAllIcon,gapX:d.WidthIcon,gapY:d.HeightIcon,spaceX:d.WidthIcon,spaceY:d.HeightIcon,overscroll:d.BorderAllIcon,overscrollX:d.WidthIcon,overscrollY:d.HeightIcon,overflow:d.BorderAllIcon,overflowX:d.WidthIcon,overflowY:d.HeightIcon,top:d.ArrowUpIcon,right:d.ArrowRightIcon,bottom:d.ArrowDownIcon,left:d.ArrowLeftIcon,inset:d.BorderAllIcon,insetX:d.WidthIcon,insetY:d.HeightIcon,border:d.BorderAllIcon,borderX:d.WidthIcon,borderY:d.HeightIcon,borderTop:d.ArrowUpIcon,borderRight:d.ArrowRightIcon,borderBottom:d.ArrowDownIcon,borderLeft:d.ArrowLeftIcon,borderRadius:d.BorderAllIcon,borderRadiusX:d.WidthIcon,borderRadiusY:d.HeightIcon,borderRadiusTop:d.ArrowUpIcon,borderRadiusRight:d.ArrowRightIcon,borderRadiusBottom:d.ArrowDownIcon,borderRadiusLeft:d.ArrowLeftIcon,borderRadiusTopLeft:d.ArrowTopLeftIcon,borderRadiusTopRight:d.ArrowTopRightIcon,borderRadiusBottomRight:d.ArrowBottomRightIcon,borderRadiusBottomLeft:d.ArrowBottomLeftIcon,divideXWidth:d.WidthIcon,divideYWidth:d.HeightIcon,scale:d.BorderAllIcon,scaleX:d.WidthIcon,scaleY:d.HeightIcon,skewX:d.WidthIcon,skewY:d.HeightIcon,translateX:d.WidthIcon,translateY:d.HeightIcon,padding:d.BorderAllIcon,paddingX:d.WidthIcon,paddingY:d.HeightIcon,paddingTop:d.ArrowUpIcon,paddingRight:d.ArrowRightIcon,paddingBottom:d.ArrowDownIcon,paddingLeft:d.ArrowLeftIcon,margin:d.BorderAllIcon,marginX:d.WidthIcon,marginY:d.HeightIcon,marginTop:d.ArrowUpIcon,marginRight:d.ArrowRightIcon,marginBottom:d.ArrowDownIcon,marginLeft:d.ArrowLeftIcon,textLeft:d.AlignLeftIcon,textCenter:d.AlignCenterHorizontallyIcon,textRight:d.AlignRightIcon,textJustify:d.StretchHorizontallyIcon,italic:d.FontItalicIcon,underline:d.UnderlineIcon,overline:d.OverlineIcon,uppercase:d.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":d.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:d.Cross1Icon},L=m.createContext({canReset:!1,canChange:!0}),He=({children:s,canReset:n=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(L.Provider,{value:{canReset:n,canChange:r},children:s}),re=({label:s,property:n,onChange:r})=>{const i=m.useMemo(()=>t.get(V.CLASSES_LIST,`${n}.classes`,[""]),[n]),l=P(n),u=m.useMemo(()=>t.get(l,"cls",""),[l]),{canChange:c}=m.useContext(L),p=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:u}),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(F,{rounded:s,onChange:a=>r(a,n),selected:u,options:i,disabled:!c})})};function F({selected:s,onChange:n,rounded:r=!1,options:i,disabled:l=!1}){const u=s.replace(/.*:/g,"").trim(),{undo:c,redo:p}=o.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!i.length||l,className:`${r?"rounded-md border border-border":"border-0"} w-full disable:bg-gray-500 h-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:a=>n(a.target.value),onKeyDown:a=>{a.ctrlKey&&(a.key==="z"&&c(),a.key==="y"&&p())},value:u,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),m.Children.toArray(i.map(a=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:a,children:a})))]})}const Ve=({property:s,onChange:n})=>{const{canReset:r,canChange:i}=m.useContext(L),l=P(s),u=m.useMemo(()=>t.get(l,"cls",""),[l]),c=m.useMemo(()=>t.get(V.CLASSES_LIST,`${s}.classes`,[""]),[s]),p=c.indexOf(u)>-1?c.indexOf(u):0,a=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:a?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:u}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!i&&(!r||p-1<0),onClick:()=>n(t.nth(c,p-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.MinusIcon,{className:!i&&(!r||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(re,{label:!1,property:s,onChange:n})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!i&&(!r||p+1>=c.length),onClick:()=>n(t.nth(c,p+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{className:!i&&(!r||p+1>=c.length)?"text-gray-500":"text-white/60"})})})]})})},De=({property:s,onChange:n})=>{const r=m.useMemo(()=>t.get(V.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:i}=m.useContext(L),l=P(s),u=m.useMemo(()=>t.get(l,"cls",""),[l]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,c=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!i,onClick:()=>n(c,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${u===c?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:m.createElement(t.get(se,c,d.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(c))})]}))})},Le={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Pe=({property:s,onChange:n})=>{const r=P(s),i=m.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:l}=m.useContext(L),[u,c]=m.useState([]),[p,a]=m.useState({color:"",shade:""}),g=i.split("-"),h=t.get(g,"1",""),x=t.get(g,"2",""),j=m.useCallback(y=>{["current","inherit","transparent","black","white"].includes(y)?(c([]),a({color:y})):(c(["50","100","200","300","400","500","600","700","800","900"]),a(v=>({...v,color:y,shade:v.shade?v.shade:"500"})))},[c,a]);m.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(h))return c([]);c(["50","100","200","300","400","500","600","700","800","900"])},[h]);const b=m.useCallback(y=>{a({color:h,shade:y})},[h]);return m.useEffect(()=>{a({color:"",shade:""})},[r]),m.useEffect(()=>{const v=`${t.get(Le,s,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;v.match(new RegExp(t.get(V.CLASSES_LIST,`${s}.regExp`,"")))&&n(v,s)},[p,n,s]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(F,{disabled:!l,rounded:!0,selected:h,onChange:j,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(F,{rounded:!0,selected:x,disabled:!h||!l,onChange:b,options:u})})]})},J=(s,n)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&n.includes(r))return{value:"",unit:r};const i=n.length?new RegExp(n.join("|"),"g"):/XXXXXX/g;r=r.replace(i,"");const l=s.match(i),u=l&&l.length>1,c=!t.isEmpty(r)&&Number.isNaN(Number(r));return u||c?{error:"Invalid value"}:l&&(l[0]==="auto"||l[0]==="none")?{value:l[0],unit:""}:{value:r,unit:l?l[0]:""}};const $e=s=>{const n=s.startsWith("-")?"-":"",r=s.split("-").pop();if(["auto","none"].includes(r))return{value:"",unit:r};if(r==="px")return{value:"1",unit:"px"};if(r==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(r==="full")return{value:"100",unit:"%"};if(t.includes(s,"skew-"))return{value:`${n}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${n}${r}`,unit:"deg"};if(t.includes(s,"opacity-"))return{value:`${r/100}`,unit:"-"};if(t.includes(s,"duration-")||t.includes(s,"delay-"))return{value:`${r}`,unit:"ms"};if(t.includes(s,"translate-")&&!r.includes("/"))return{value:`${n}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${n}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const i=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(i)return{value:i[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[i,l]=t.map(r.split("/"),u=>parseInt(u,10));return{value:n+(i/l*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${n+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}};const Me=s=>{if(t.isEmpty(s))return{value:"",unit:""};const n=s.match(/\[.*\]/g);if(n===null)return Oe(s);const r=t.get(n,"0","").replace(/\[|\]/g,""),i=s.startsWith("-")?"-":"",l=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${i}${l}`,unit:r.replace(l,"")}},Oe=s=>t.isEmpty(s)?{value:"",unit:""}:$e(s),oe=m.createContext({setDragData:()=>{}}),qe=({unit:s,currentValue:n,onDrag:r,onDragEnd:i,onDragStart:l,negative:u,cssProperty:c})=>{const{setDragData:p}=m.useContext(oe);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:a=>{const g={onDrag:r,onDragEnd:i,dragging:!0,dragStartY:a.pageY,dragStartValue:`${n}`,dragUnit:s,negative:u,cssProperty:c};l(g),p(g)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(d.RowSpacingIcon,{})})},_e=({onSelect:s,current:n,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(i=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:n===i?"primary":void 0,size:"sm",onClick:l=>{l.stopPropagation(),s(i)},children:i},i))}),We=s=>{const[n,r]=m.useState(!1),[i,l]=m.useState(""),{currentClass:u,onChange:c,classPrefix:p,cssProperty:a,units:g,negative:h}=s,[x,j]=m.useState(a!=null&&a.toLowerCase().includes("width")?"%":g[0]),[b,y]=m.useState(!1),[v,C]=m.useState(""),[S,E]=m.useState(!1),[B,T]=m.useState(!1);m.useEffect(()=>{const{value:f,unit:R}=Me(u);if(R===""){l(f),j(a!=null&&a.toLowerCase().includes("width")?"%":g[0]);return}j(R),l(R==="class"||t.isEmpty(f)?"":f)},[u,a,g]);const w=q.useThrottledCallback(f=>{c(f)},[c],200),I=q.useThrottledCallback(f=>{c(f,!1)},[c],200),H=m.useCallback((f=!1)=>{const R=J(`${i}`,g);if(t.get(R,"error",!1)){y(!0);return}const k=t.get(R,"unit")!==""?t.get(R,"unit"):x;if(k==="auto"||k==="none"){w(`${p}${k}`);return}if(t.get(R,"value")==="")return;const D=`${t.get(R,"value","").startsWith("-")?"-":""}${p}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;f?I(D):w(D)},[w,I,i,x,p,g]),$=m.useCallback(f=>{const R=J(`${i}`,g);if(t.get(R,"error",!1)){y(!0);return}if(f==="auto"||f==="none"){w(`${p}${f}`);return}if(t.get(R,"value")==="")return;const k=t.get(R,"unit")!==""?t.get(R,"unit"):f,D=`${t.get(R,"value","").startsWith("-")?"-":""}${p}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;w(D)},[w,i,p,g]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:x==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:u}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${S?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(x)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:x==="class",onKeyPress:f=>{f.key==="Enter"&&H()},onKeyDown:f=>{if(f.keyCode!==38&&f.keyCode!==40)return;f.preventDefault(),T(!0);const R=t.parseInt(f.target.value);let k=t.isNaN(R)?0:R;f.keyCode===38&&(k+=1),f.keyCode===40&&(k-=1);const A=`${k}`,ie=`${A.startsWith("-")?"-":""}${p}[${A.replace("-","")}${x==="-"?"":x}]`;I(ie)},onKeyUp:f=>{B&&(f.preventDefault(),T(!1))},onBlur:()=>H(),onChange:f=>{y(!1),l(f.target.value)},onClick:f=>{var R;(R=f==null?void 0:f.target)==null||R.select(),r(!1)},value:S?v:i,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",b?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:n,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!n),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${g.length===1?"px-2 font-semibold":""}`,children:x}),g.length>1?e.jsxRuntimeExports.jsx(d.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(_e,{units:g,current:x,onSelect:f=>{r(!1),j(f),$(f)}})})})]})]}),["none","auto"].indexOf(x)!==-1||S?null:e.jsxRuntimeExports.jsx(qe,{onDragStart:()=>E(!0),onDragEnd:f=>{if(C(()=>""),E(!1),t.isEmpty(f))return;const R=`${f}`,A=`${R.startsWith("-")?"-":""}${p}[${R.replace("-","")}${x==="-"?"":x}]`;w(A)},onDrag:f=>{if(t.isEmpty(f))return;C(f);const R=`${f}`,A=`${R.startsWith("-")?"-":""}${p}[${R.replace("-","")}${x==="-"?"":x}]`;I(A)},currentValue:i,unit:x,negative:h,cssProperty:a})]})})})},P=s=>{const n=o.useSelectedBlockCurrentClasses();return t.findLast(n,{property:s})},Fe=(s,n)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[n]},Ye={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},Q={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Xe=s=>`${s.toUpperCase()} ${Q[s]?`(${Q[s]} & up)`:""}`,Z=s=>{const{type:n="icons",label:r,property:i,onEmitChange:l=()=>{},units:u,negative:c=!1}=s,[p]=o.useDarkMode(),[a]=o.useStylingState(),[,g]=o.useCanvasWidth(),h=P(i),x=o.useAddClassesToBlocks(),j=o.useRemoveClassesFromBlocks(),[b]=o.useSelectedBlockIds(),y=m.useMemo(()=>t.get(h,"fullCls",""),[h]),v=m.useCallback((w,I=!0)=>{const H={dark:p,mq:g,mod:a,cls:w,property:i,fullCls:""};(p||a!=="")&&(H.mq="xs");const $=V.generateFullClsName(H);x(b,[$],I)},[b,p,g,a,i,x]),C=m.useCallback(()=>{j(b,[y])},[b,y,j]),S=m.useMemo(()=>Fe(h,g),[h,g]);m.useEffect(()=>{l(S,h)},[S,l,h]);const[,,E]=o.useCanvasWidth(),B=m.useCallback(w=>{E({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[w])},[E]),T=t.get(h,"dark",null)===p&&t.get(h,"mod",null)===a&&t.get(h,"mq",null)===g;return e.jsxRuntimeExports.jsx(He,{canChange:S,canReset:h&&T,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${h&&!T?"text-foreground":""}`,children:r})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[n==="arbitrary"?e.jsxRuntimeExports.jsx(We,{currentClass:t.get(h,"cls",""),classPrefix:t.get(Ye,i,""),units:u||[],onChange:v,negative:c,cssProperty:i}):null,n==="icons"&&e.jsxRuntimeExports.jsx(De,{property:i,onChange:v}),n==="range"&&e.jsxRuntimeExports.jsx(Ve,{property:i,onChange:v}),n==="color"&&e.jsxRuntimeExports.jsx(Pe,{property:i,onChange:v}),n==="dropdown"&&e.jsxRuntimeExports.jsx(re,{label:r,property:i,onChange:v})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${y?"visible":"invisible"}`,children:T?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>C(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(d.TrashIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):S&&h?e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold ",children:[Xe(t.get(h,"mq")),p&&!h.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>B(t.get(h,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(h,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Ze=["px","%","em","rem","ch","vh","vw"],ne=({label:s,options:n,borderB:r=!1,borderT:i=!1,type:l="arbitrary",units:u=Ze,negative:c=!1})=>{const[p,a]=m.useState(n[0].key),g=o.useSelectedBlockCurrentClasses(),h=m.useCallback(x=>t.map(g,"property").includes(x),[g]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${i?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:s}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:m.Children.toArray(n.map(({label:x,key:j})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>a(j),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${j===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[m.createElement("div",{className:h(j)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),m.createElement(t.get(se,j,d.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(x))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(Z,{type:l,units:[...u],label:"",property:p,negative:c})})]})},ze=({heading:s,items:n})=>{const r=o.useSelectedBlockCurrentClasses(),i=m.useMemo(()=>{const l=p=>t.flatten(p.map(a=>a.styleType==="multiple"?t.map(a.options,"key"):a.property)),u=t.flatten(n.map(p=>p.styleType==="accordion"?l(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),c=t.map(r,"property");return t.intersection(u,c).length>0},[r,n]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s,i?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:n.map(l=>l.styleType==="multiple"?e.jsxRuntimeExports.jsx(ne,{...l},l.label):e.jsxRuntimeExports.jsx(Z,{...l},l.label))})]})},Ue=m.createContext({}),O=({section:s})=>{const n=o.useSelectedBlockCurrentClasses(),r=m.useCallback((u=[])=>{const c={};for(let a=0;a<n.length;a++)c[n[a].property]=n[a].cls;let p=!0;for(const a in u)if(!t.has(c,a)||c[a]!==u[a]){p=!1;break}return p},[n]),i=m.useMemo(()=>{if(n.length>0&&s.heading==="Classes")return!0;const u=a=>t.flatten(a.map(g=>g.styleType==="multiple"?t.flatten(t.map(g.options,"key")):g.property)),c=t.flatten(s.items.map(a=>a.styleType==="accordion"?u(a.items):a.styleType==="multiple"?t.flatten(t.map(a.options,"key")):a.property)),p=t.map(n,"property");return t.intersection(c,p).length>0},[n,s.heading,s.items]),l=m.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Ue.Provider,{value:l,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}),s.heading]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:m.Children.toArray(s.items.map(u=>t.has(u,"component")?m.createElement(u.component,{key:u.label}):t.has(u,"styleType")?u.styleType==="multiple"?e.jsxRuntimeExports.jsx(ne,{...u},u.label):u.styleType==="accordion"&&r(u==null?void 0:u.conditions)?e.jsxRuntimeExports.jsx(ze,{...u},u.label):null:e.jsxRuntimeExports.jsx(Z,{...u},u.label)))})]})})},Ge=({item:s,index:n,canDelete:r,onChange:i,onRemove:l})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${r?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:u=>i(u,n),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:u=>t.isEmpty(s.key)?{}:i(u,n),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(d.TrashIcon,{onClick:l,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),Ke=({section:s})=>{var j;const{setSyncState:n}=o.useSavePage(),r=o.useSelectedBlock(),[i,l]=m.useState([]),[u]=o.useSelectedStylingBlocks(),c=o.useUpdateBlocksPropsRealtime(),p=`${t.get(u,"0.prop")}_attrs`;M.useEffect(()=>{const b=t.map(t.get(r,p),(y,v)=>({key:v,value:y}));t.isEmpty(b)?l([]):l(b)},[t.get(r,p)]);const a=()=>l([...i,{key:"",value:""}]),g=b=>{const y=t.filter(i,(v,C)=>b!==C);x(y)},h=(b,y)=>{const v=[...i];v[y][b.target.name]=b.target.value,x(v)},x=M.useCallback((b=[])=>{const y={};t.forEach(b,v=>{t.isEmpty(v.key)||t.set(y,v.key,v.value)}),c([t.get(r,"_id")],{[p]:y}),n("UNSAVED")},[r,n,c,p]);return e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsxs(o.Label,{className:"mt-2 flex w-full items-center justify-between",children:["Add Custom attributes",e.jsxRuntimeExports.jsxs("div",{className:`flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!t.isEmpty(i)&&t.isEmpty((j=t.last(i))==null?void 0:j.key)?"cursor-not-allowed border-gray-400 text-gray-400":"cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,onClick:()=>{var b;!t.isEmpty(i)&&t.isEmpty((b=t.last(i))==null?void 0:b.key)||a()},children:[e.jsxRuntimeExports.jsx(d.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(i)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),M.Children.toArray(t.map(i,(b,y)=>{const v=i.length>0&&y<i.length-1;return e.jsxRuntimeExports.jsx(Ge,{item:b,index:y,canDelete:v,onChange:h,onRemove:()=>g(y)})}))]})]})})]})};function Je(){const[s,n]=o.useStylingState(),{flexChild:r,gridChild:i}=o.useSelectedBlocksDisplayChild(),[,l]=ye.useAtom(o.advanceStylingOpenAtom),{t:u}=ee.useTranslation(),[c]=o.useSelectedStylingBlocks();return t.isEmpty(c)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:u("no_styling_block_selected")}),e.jsxRuntimeExports.jsxs("p",{className:"text-xs ",children:["Hint: Styling allowed blocks are highlighted with"," ",e.jsxRuntimeExports.jsx("span",{className:"border border-orange-500 p-px",children:"orange"})," border"]})]})}):e.jsxRuntimeExports.jsxs("div",{onClick:()=>l(!1),className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-x-4 space-y-3 border-b border-border px-4 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(o.Select,{defaultValue:s,onValueChange:p=>n(p),children:[e.jsxRuntimeExports.jsx(o.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(o.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(o.SelectContent,{children:[e.jsxRuntimeExports.jsx(o.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",className:"h-full w-full",children:[r&&e.jsxRuntimeExports.jsx(O,{section:Ie}),i?e.jsxRuntimeExports.jsx(O,{section:Be}):null,Ae.map(p=>e.jsxRuntimeExports.jsx(O,{section:p},p.heading)),e.jsxRuntimeExports.jsx(Ke,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const Qe={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},et=()=>{const s=o.useSelectedBlock(),{t:n}=ee.useTranslation(),[r,i]=m.useState(""),[l,u]=m.useState({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),c=q.useThrottledCallback(a=>{const g=!t.get(l,"negative",!1),h=t.get(l,"cssProperty","");let x=parseFloat(l.dragStartValue);x=t.isNaN(x)?0:x;let j=Qe[l.dragUnit];(t.startsWith(h,"scale")||h==="opacity")&&(j=10);let y=(l.dragStartY-a.pageY)/j+x;g&&y<0&&(y=0),h==="opacity"&&y>1&&(y=1),l.onDrag(`${y}`),i(`${y}`)},[l],50),p=m.useCallback(()=>{setTimeout(()=>l.onDragEnd(`${r}`),100),u({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[l,r,u]);return t.isNull(s)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:n("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(oe.Provider,{value:{setDragData:u},children:[l.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:c,onMouseUp:()=>p(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(o.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(o.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Se,{})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Je,{})})]})]})};exports.default=et;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
1
|
+
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import { PlusIcon as E, Half2Icon as V } from "@radix-ui/react-icons";
|
|
3
3
|
import h, { useState as p, useEffect as L, useMemo as M, lazy as N, Suspense as j } from "react";
|
|
4
4
|
import { useAtom as w } from "jotai";
|
|
5
5
|
import { filter as g, map as k, isNull as H, find as I, isEmpty as R, each as F, get as _ } from "lodash";
|
|
6
|
-
import { ao as O, ap as Y, aq as J, ar as U, as as $, D as q, E as G, F as Z, G as Q, H as W, I as X, J as ee, K as se, at as re, s as ae, t as ie, au as
|
|
6
|
+
import { ao as O, ap as Y, aq as J, ar as U, as as $, D as q, E as G, F as Z, G as Q, H as W, I as X, J as ee, K as se, at as re, s as ae, t as ie, au as te, av as le, aw as oe, ax as ne, ay as C, i as D, az as ce, aA as de, B as b, S as A, aB as me, aC as xe, aD as P, aE as S } from "./index-G55KtqnU.js";
|
|
7
7
|
import "./lib.js";
|
|
8
8
|
import { ListTreeIcon as T, DatabaseIcon as pe } from "lucide-react";
|
|
9
9
|
import { getChaiDataProviders as ue } from "@chaibuilder/runtime";
|
|
10
|
-
import { E as he } from "./index-
|
|
11
|
-
import {
|
|
10
|
+
import { E as he } from "./index-mLIwGF5W.js";
|
|
11
|
+
import { c as fe } from "./utils-PPBbw5bk.js";
|
|
12
|
+
import "./MODIFIERS-MLfpKQY1.js";
|
|
12
13
|
import "@radix-ui/react-toggle";
|
|
13
14
|
import "class-variance-authority";
|
|
14
15
|
import "@radix-ui/react-switch";
|
|
@@ -37,6 +38,7 @@ import "redux-undo";
|
|
|
37
38
|
import "@react-hookz/web";
|
|
38
39
|
import "react-i18next";
|
|
39
40
|
import "himalaya";
|
|
41
|
+
import "./functions-hmbWDcnW.js";
|
|
40
42
|
import "@mhsdesign/jit-browser-tailwindcss";
|
|
41
43
|
import "@bobthered/tailwindcss-palette-generator";
|
|
42
44
|
import "@tailwindcss/forms";
|
|
@@ -46,7 +48,6 @@ import "@tailwindcss/line-clamp";
|
|
|
46
48
|
import "clsx";
|
|
47
49
|
import "tailwind-merge";
|
|
48
50
|
import "i18next";
|
|
49
|
-
import "./index-SSmZipiF.js";
|
|
50
51
|
import "@floating-ui/react-dom";
|
|
51
52
|
import "react-textarea-autosize";
|
|
52
53
|
import "flagged";
|
|
@@ -58,7 +59,7 @@ const ve = h.lazy(() => import("react-json-view")), je = ({ provider: r, onClose
|
|
|
58
59
|
const [a, n] = p(null);
|
|
59
60
|
return L(() => {
|
|
60
61
|
r && (r.mockFn ? r.mockFn : r.dataFn)().then((c) => n(c));
|
|
61
|
-
}, [r]), r ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (
|
|
62
|
+
}, [r]), r ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (t) => t ? "" : o(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(Y, { children: [
|
|
62
63
|
/* @__PURE__ */ e.jsxs(J, { children: [
|
|
63
64
|
/* @__PURE__ */ e.jsxs(U, { children: [
|
|
64
65
|
"Data Provider: ",
|
|
@@ -103,17 +104,17 @@ function ge({
|
|
|
103
104
|
] });
|
|
104
105
|
}
|
|
105
106
|
const be = () => {
|
|
106
|
-
const r = M(() => ue(), []), [o, a] = ae(), [, n] = w(ie), [
|
|
107
|
+
const r = M(() => ue(), []), [o, a] = ae(), [, n] = w(ie), [t, c] = p(
|
|
107
108
|
g(r, (s) => k(o, "providerKey").includes(s.providerKey))
|
|
108
|
-
), [m, y] = p(""), [f,
|
|
109
|
-
r.map((s) => k(
|
|
109
|
+
), [m, y] = p(""), [f, l] = p(null), v = g(
|
|
110
|
+
r.map((s) => k(t, "providerKey").includes(s.providerKey) ? null : { value: s.providerKey, label: s.name }),
|
|
110
111
|
(s) => !H(s)
|
|
111
112
|
), i = (s) => {
|
|
112
113
|
const x = I(r, { providerKey: s });
|
|
113
114
|
c((d) => [...d, x]), a((d) => [...d, { providerKey: x.providerKey, args: {} }]), y(""), n("UNSAVED");
|
|
114
115
|
}, u = (s) => {
|
|
115
116
|
c((x) => g(x, (d) => d.providerKey !== s.providerKey)), a((x) => g(x, (d) => d.providerKey !== s.providerKey)), n("UNSAVED");
|
|
116
|
-
}, B = (s) =>
|
|
117
|
+
}, B = (s) => l(s);
|
|
117
118
|
return R(r) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "text-gray-500 mb-1.5 text-xs p-4", children: [
|
|
118
119
|
"You have no data providers registered. Please add a data provider to your project. ",
|
|
119
120
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -121,17 +122,17 @@ const be = () => {
|
|
|
121
122
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
122
123
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
123
124
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 mb-1.5 text-xs", children: "Add data providers:" }) }),
|
|
124
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(
|
|
125
|
-
/* @__PURE__ */ e.jsx(
|
|
125
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(te, { value: m, onValueChange: (s) => i(s), children: [
|
|
126
|
+
/* @__PURE__ */ e.jsx(le, { className: "w-full", children: /* @__PURE__ */ e.jsx(oe, { placeholder: "Select a provider" }) }),
|
|
126
127
|
/* @__PURE__ */ e.jsxs(ne, { children: [
|
|
127
128
|
/* @__PURE__ */ e.jsx(C, { value: "", children: "Choose" }),
|
|
128
129
|
v.map((s) => /* @__PURE__ */ e.jsx(C, { value: s.value, children: s.label }, s.value))
|
|
129
130
|
] })
|
|
130
131
|
] }) }),
|
|
131
132
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
132
|
-
/* @__PURE__ */ e.jsxs("div", { className: `border-t ${
|
|
133
|
+
/* @__PURE__ */ e.jsxs("div", { className: `border-t ${t.length ? "block" : "hidden"}`, children: [
|
|
133
134
|
/* @__PURE__ */ e.jsx("p", { className: "text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium", children: "Page data providers:" }),
|
|
134
|
-
/* @__PURE__ */ e.jsx("div", { className: "space-y-2", children:
|
|
135
|
+
/* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: t.map((s) => /* @__PURE__ */ e.jsxs(
|
|
135
136
|
"div",
|
|
136
137
|
{
|
|
137
138
|
className: "rounded-lg border bg-card text-card-foreground shadow-sm w-full",
|
|
@@ -199,13 +200,13 @@ const be = () => {
|
|
|
199
200
|
},
|
|
200
201
|
s.providerKey
|
|
201
202
|
)) }),
|
|
202
|
-
/* @__PURE__ */ e.jsx(je, { onClose: () =>
|
|
203
|
+
/* @__PURE__ */ e.jsx(je, { onClose: () => l(null), provider: f })
|
|
203
204
|
] })
|
|
204
205
|
] });
|
|
205
|
-
}, z = N(() => import("./Layers-
|
|
206
|
+
}, z = N(() => import("./Layers-TB-Lriju.js")), ye = N(() => import("./BrandingOptions-QqqJ-YRb.js")), we = N(() => import("./index-G55KtqnU.js").then((r) => r.cz));
|
|
206
207
|
let K = null;
|
|
207
|
-
const
|
|
208
|
-
const r = D("sideBarComponents.top", []), o = D("sideBarComponents.bottom", []), [a, n] = w(ce), [
|
|
208
|
+
const Ds = () => {
|
|
209
|
+
const r = D("sideBarComponents.top", []), o = D("sideBarComponents.bottom", []), [a, n] = w(ce), [t, c] = p(a), [m, y] = p(null), f = {
|
|
209
210
|
layers: z,
|
|
210
211
|
"branding-options": ye,
|
|
211
212
|
images: we
|
|
@@ -213,7 +214,7 @@ const Cs = () => {
|
|
|
213
214
|
F(r, ({ name: i, panel: u }) => {
|
|
214
215
|
f[i] = u;
|
|
215
216
|
});
|
|
216
|
-
const
|
|
217
|
+
const l = (i) => {
|
|
217
218
|
clearTimeout(K), v(!1), a !== "layers" && i === "layers" ? K = setTimeout(() => c("layers"), 500) : c(i), n(i);
|
|
218
219
|
}, [, v] = w(de);
|
|
219
220
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
@@ -233,7 +234,7 @@ const Cs = () => {
|
|
|
233
234
|
/* @__PURE__ */ e.jsx(
|
|
234
235
|
b,
|
|
235
236
|
{
|
|
236
|
-
onClick: () =>
|
|
237
|
+
onClick: () => l("layers"),
|
|
237
238
|
size: "sm",
|
|
238
239
|
variant: a === "layers" ? "default" : "outline",
|
|
239
240
|
children: /* @__PURE__ */ e.jsx(T, { className: "w-4" })
|
|
@@ -242,7 +243,7 @@ const Cs = () => {
|
|
|
242
243
|
/* @__PURE__ */ e.jsx(
|
|
243
244
|
b,
|
|
244
245
|
{
|
|
245
|
-
onClick: () =>
|
|
246
|
+
onClick: () => l("branding-options"),
|
|
246
247
|
size: "sm",
|
|
247
248
|
variant: a === "branding-options" ? "default" : "outline",
|
|
248
249
|
children: /* @__PURE__ */ e.jsx(V, { className: "w-4 max-w-[40px] text-xs" })
|
|
@@ -252,7 +253,7 @@ const Cs = () => {
|
|
|
252
253
|
r.map(({ name: i, icon: u }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(A, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
253
254
|
b,
|
|
254
255
|
{
|
|
255
|
-
onClick: () =>
|
|
256
|
+
onClick: () => l(i),
|
|
256
257
|
size: "sm",
|
|
257
258
|
className: "w-10",
|
|
258
259
|
variant: a === i ? "default" : "outline",
|
|
@@ -269,7 +270,7 @@ const Cs = () => {
|
|
|
269
270
|
"div",
|
|
270
271
|
{
|
|
271
272
|
onClick: () => {
|
|
272
|
-
|
|
273
|
+
l("layers");
|
|
273
274
|
},
|
|
274
275
|
className: "absolute inset-0 right-0 z-50 w-screen bg-black/20" + (a === "layers" ? " hidden" : "")
|
|
275
276
|
}
|
|
@@ -295,11 +296,11 @@ const Cs = () => {
|
|
|
295
296
|
},
|
|
296
297
|
onMouseLeave: () => {
|
|
297
298
|
const i = setTimeout(() => {
|
|
298
|
-
m && (
|
|
299
|
+
m && (l("layers"), clearTimeout(m));
|
|
299
300
|
}, 1e3);
|
|
300
301
|
y(i);
|
|
301
302
|
},
|
|
302
|
-
children: h.createElement(_(f,
|
|
303
|
+
children: h.createElement(_(f, t, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
303
304
|
}
|
|
304
305
|
)
|
|
305
306
|
}
|
|
@@ -333,5 +334,5 @@ const Cs = () => {
|
|
|
333
334
|
] });
|
|
334
335
|
};
|
|
335
336
|
export {
|
|
336
|
-
|
|
337
|
+
Ds as default
|
|
337
338
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var k=Object.create;var b=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var A=(r,o,i,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of S(o))!P.call(r,l)&&l!==i&&b(r,l,{get:()=>o[l],enumerable:!(u=C(o,l))||u.enumerable});return r};var T=(r,o,i)=>(i=r!=null?k(D(r)):{},A(o||!r||!r.__esModule?b(i,"default",{value:r,enumerable:!0}):i,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),y=require("@radix-ui/react-icons"),n=require("react"),R=require("jotai"),x=require("lodash"),s=require("./index-T5MFAHA0.cjs");require("./lib.cjs");const E=require("lucide-react"),z=require("@chaibuilder/runtime"),B=require("./index-pCHSFoQO.cjs"),K=require("./utils-It2K33fU.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("react-i18next");require("himalaya");require("./functions-eu6BbvqO.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");const V=n.lazy(()=>import("react-json-view")),I=({provider:r,onClose:o})=>{const[i,u]=n.useState(null);return n.useEffect(()=>{r&&(r.mockFn?r.mockFn:r.dataFn)().then(d=>u(d))},[r]),r?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:l=>l?"":o(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:["Data Provider: ",r.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:r.description})]}),e.jsxRuntimeExports.jsx(B.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(V,{style:{maxHeight:"80vh",overflowY:"auto"},name:r.providerKey,enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:i})})]})}):null};function L({children:r,name:o,onRemove:i}){return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:r}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogTitle,{children:["Are you sure, you want to remove ",e.jsxRuntimeExports.jsx("span",{className:"text-blue-500",children:o})," provider?"]}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:"Your data provider will be removed from this page and all added data binding will be not visible on blocks."})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:i,className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})]})}const M=()=>{const r=n.useMemo(()=>z.getChaiDataProviders(),[]),[o,i]=s.usePageDataProviders(),[,u]=R.useAtom(s.pageSyncStateAtom),[l,d]=n.useState(x.filter(r,t=>x.map(o,"providerKey").includes(t.providerKey))),[j,g]=n.useState(""),[v,c]=n.useState(null),f=x.filter(r.map(t=>x.map(l,"providerKey").includes(t.providerKey)?null:{value:t.providerKey,label:t.name}),t=>!x.isNull(t)),a=t=>{const p=x.find(r,{providerKey:t});d(m=>[...m,p]),i(m=>[...m,{providerKey:p.providerKey,args:{}}]),g(""),u("UNSAVED")},h=t=>{d(p=>x.filter(p,m=>m.providerKey!==t.providerKey)),i(p=>x.filter(p,m=>m.providerKey!==t.providerKey)),u("UNSAVED")},N=t=>c(t);return x.isEmpty(r)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs p-4",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 mb-1.5 text-xs",children:"Add data providers:"})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:j,onValueChange:t=>a(t),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),f.map(t=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:t.value,children:t.label},t.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${l.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium",children:"Page data providers:"}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:l.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm w-full","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between items-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:t.name}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-400 pt-1",children:t.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"items-center p-2 py-2 flex justify-between",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>N(t),className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View Data"]}),e.jsxRuntimeExports.jsx(L,{onRemove:()=>h(t),name:t.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),"Remove"]})})]})]},t.providerKey))}),e.jsxRuntimeExports.jsx(I,{onClose:()=>c(null),provider:v})]})]})},q=n.lazy(()=>Promise.resolve().then(()=>require("./Layers-NKZXi2LV.cjs"))),H=n.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-HtNCJO9_.cjs"))),O=n.lazy(()=>Promise.resolve().then(()=>require("./index-T5MFAHA0.cjs")).then(r=>r.ImagesPanel));let w=null;const F=()=>{const r=s.useBuilderProp("sideBarComponents.top",[]),o=s.useBuilderProp("sideBarComponents.bottom",[]),[i,u]=R.useAtom(s.activePanelAtom),[l,d]=n.useState(i),[j,g]=n.useState(null),v={layers:q,"branding-options":H,images:O};x.each(r,({name:a,panel:h})=>{v[a]=h});const c=a=>{clearTimeout(w),f(!1),i!=="layers"&&a==="layers"?w=setTimeout(()=>d("layers"),500):d(a),u(a)},[,f]=R.useAtom(s.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{f(!0),u("layers")},size:"sm",variant:i==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(y.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("layers"),size:"sm",variant:i==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("branding-options"),size:"sm",variant:i==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(y.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),n.Children.toArray(r.map(({name:a,icon:h})=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c(a),size:"sm",className:"w-10",variant:i===a?"default":"outline",children:e.jsxRuntimeExports.jsx(h,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:n.Children.toArray(o.map(a=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(a,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{c("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(i==="layers"?" hidden":"")}),e.jsxRuntimeExports.jsx("div",{className:`fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${i!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:K.cn("relative h-full max-h-[93%] bg-background p-1",i==="layers"?"":"z-[100]"),onMouseEnter:()=>{j&&clearTimeout(j)},onMouseLeave:()=>{const a=setTimeout(()=>{j&&(c("layers"),clearTimeout(j))},1e3);g(a)},children:n.createElement(x.get(v,l,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 h-10 grid grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"h-3 mr-2"})," Layers"]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.DatabaseIcon,{className:"w-3 mr-2"}),"Data"]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"layers",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:n.createElement(q)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(M,{})})]})})})]})};exports.default=F;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("react"),l=require("@radix-ui/react-icons"),r=require("./index-T5MFAHA0.cjs"),a=require("react-i18next");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("lodash");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");const o=()=>r.useBuilderProp("languages",["en"]),c=()=>o().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(l.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),p=()=>{const{savePage:i,syncState:s}=r.useSavePage(),{t:x}=a.useTranslation(),u=n.useMemo(()=>{switch(s){case"SAVING":return"animate-pulse bg-gray-500 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[s]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Tooltip,{children:[e.jsxRuntimeExports.jsx(r.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(r.Toggle,{onClick:t=>{t.preventDefault(),i()},className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${u}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx("svg",{fill:"currentColor",width:"16",height:"16",viewBox:"0 0 0.32 0.32",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"})}),s==="SAVING"?"Saving...":s==="SAVED"?x("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(r.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:s==="SAVING"?"Saving...":s==="SAVED"?"Saved":"Save changes"})})]})})},m=()=>{const i=r.useBuilderProp("topBarComponents.left",[]),s=r.useBuilderProp("topBarComponents.center",[]),x=r.useBuilderProp("topBarComponents.right",[]),u=r.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(c,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),u?e.jsxRuntimeExports.jsx(p,{}):null,n.Children.toArray(x.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=m;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
1
|
+
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import o, { useMemo as m, Suspense as c } from "react";
|
|
3
3
|
import { FontFamilyIcon as x } from "@radix-ui/react-icons";
|
|
4
|
-
import { i as
|
|
4
|
+
import { i as a, au as d, av as h, aw as u, ax as g, aF as j, aG as v, ay as r, ag as f, aH as S, aI as b, aJ as N, aK as w, S as p, aL as y } from "./index-G55KtqnU.js";
|
|
5
5
|
import { useTranslation as C } from "react-i18next";
|
|
6
|
-
import "./
|
|
7
|
-
import "clsx";
|
|
8
|
-
import "tailwind-merge";
|
|
9
|
-
import "lodash";
|
|
6
|
+
import "./MODIFIERS-MLfpKQY1.js";
|
|
10
7
|
import "@radix-ui/react-toggle";
|
|
11
8
|
import "class-variance-authority";
|
|
9
|
+
import "./utils-PPBbw5bk.js";
|
|
10
|
+
import "lodash";
|
|
11
|
+
import "clsx";
|
|
12
|
+
import "tailwind-merge";
|
|
12
13
|
import "@radix-ui/react-switch";
|
|
13
14
|
import "@radix-ui/react-slot";
|
|
14
15
|
import "@radix-ui/react-accordion";
|
|
@@ -35,7 +36,7 @@ import "flat-to-nested";
|
|
|
35
36
|
import "redux-undo";
|
|
36
37
|
import "@chaibuilder/runtime";
|
|
37
38
|
import "@react-hookz/web";
|
|
38
|
-
const A = () =>
|
|
39
|
+
const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(d, { children: [
|
|
39
40
|
/* @__PURE__ */ e.jsx(h, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
40
41
|
u,
|
|
41
42
|
{
|
|
@@ -47,15 +48,15 @@ const A = () => r("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
47
48
|
) }),
|
|
48
49
|
/* @__PURE__ */ e.jsx(g, { children: /* @__PURE__ */ e.jsxs(j, { children: [
|
|
49
50
|
/* @__PURE__ */ e.jsx(v, { children: "Fruits" }),
|
|
50
|
-
/* @__PURE__ */ e.jsx(
|
|
51
|
-
/* @__PURE__ */ e.jsx(
|
|
52
|
-
/* @__PURE__ */ e.jsx(
|
|
53
|
-
/* @__PURE__ */ e.jsx(
|
|
54
|
-
/* @__PURE__ */ e.jsx(
|
|
51
|
+
/* @__PURE__ */ e.jsx(r, { value: "apple", children: "Apple" }),
|
|
52
|
+
/* @__PURE__ */ e.jsx(r, { value: "banana", children: "Banana" }),
|
|
53
|
+
/* @__PURE__ */ e.jsx(r, { value: "blueberry", children: "Blueberry" }),
|
|
54
|
+
/* @__PURE__ */ e.jsx(r, { value: "grapes", children: "Grapes" }),
|
|
55
|
+
/* @__PURE__ */ e.jsx(r, { value: "pineapple", children: "Pineapple" })
|
|
55
56
|
] }) })
|
|
56
57
|
] }) }), T = () => {
|
|
57
|
-
const { savePage: l, syncState:
|
|
58
|
-
switch (
|
|
58
|
+
const { savePage: l, syncState: t } = f(), { t: i } = C(), n = m(() => {
|
|
59
|
+
switch (t) {
|
|
59
60
|
case "SAVING":
|
|
60
61
|
return "animate-pulse bg-gray-500 text-gray-900";
|
|
61
62
|
case "SAVED":
|
|
@@ -63,13 +64,13 @@ const A = () => r("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
63
64
|
default:
|
|
64
65
|
return "bg-gray-200 text-gray-500 hover:bg-gray-100";
|
|
65
66
|
}
|
|
66
|
-
}, [
|
|
67
|
+
}, [t]);
|
|
67
68
|
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(S, { children: [
|
|
68
69
|
/* @__PURE__ */ e.jsx(b, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
69
70
|
N,
|
|
70
71
|
{
|
|
71
|
-
onClick: (
|
|
72
|
-
|
|
72
|
+
onClick: (s) => {
|
|
73
|
+
s.preventDefault(), l();
|
|
73
74
|
},
|
|
74
75
|
className: `flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${n}`,
|
|
75
76
|
size: "sm",
|
|
@@ -82,31 +83,31 @@ const A = () => r("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
82
83
|
d: "M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"
|
|
83
84
|
}
|
|
84
85
|
) }),
|
|
85
|
-
|
|
86
|
+
t === "SAVING" ? "Saving..." : t === "SAVED" ? i("Saved") : "Save"
|
|
86
87
|
]
|
|
87
88
|
}
|
|
88
89
|
) }),
|
|
89
|
-
/* @__PURE__ */ e.jsx(w, { children: /* @__PURE__ */ e.jsx("p", { children:
|
|
90
|
+
/* @__PURE__ */ e.jsx(w, { children: /* @__PURE__ */ e.jsx("p", { children: t === "SAVING" ? "Saving..." : t === "SAVED" ? "Saved" : "Save changes" }) })
|
|
90
91
|
] }) });
|
|
91
|
-
},
|
|
92
|
-
const l =
|
|
92
|
+
}, de = () => {
|
|
93
|
+
const l = a("topBarComponents.left", []), t = a("topBarComponents.center", []), i = a("topBarComponents.right", []), n = a("editable", !0);
|
|
93
94
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
94
95
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: o.Children.toArray(
|
|
95
|
-
l.map((
|
|
96
|
+
l.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
96
97
|
) }) }),
|
|
97
98
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: o.Children.toArray(
|
|
98
|
-
|
|
99
|
+
t.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
99
100
|
) }),
|
|
100
101
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
101
102
|
/* @__PURE__ */ e.jsx(B, {}),
|
|
102
103
|
/* @__PURE__ */ e.jsx(y, { orientation: "vertical" }),
|
|
103
104
|
n ? /* @__PURE__ */ e.jsx(T, {}) : null,
|
|
104
105
|
o.Children.toArray(
|
|
105
|
-
i.map((
|
|
106
|
+
i.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
106
107
|
)
|
|
107
108
|
] })
|
|
108
109
|
] });
|
|
109
110
|
};
|
|
110
111
|
export {
|
|
111
|
-
|
|
112
|
+
de as default
|
|
112
113
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),a=require("react"),o=require("lodash"),C=require("@radix-ui/react-icons"),k=require("unsplash-js"),t=require("./index-T5MFAHA0.cjs"),A=require("@react-hookz/web"),T=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("react-i18next");const g=async(d,E)=>new Promise((l,i)=>{k.createApi({accessKey:E}).search.getPhotos(d).then(c=>{l(c)}).catch(c=>i(c))}),z=({isModalView:d,onSelect:E})=>{const l=t.useBuilderProp("unsplashAccessKey"),[i,f]=a.useState([]),[c,q]=a.useState(0),[u,S]=a.useState(),[x,b]=a.useState(),[I,R]=a.useState(0),[j,w]=A.useDebouncedState("",1e3),[h,m]=a.useState(!1),P=async s=>{if(o.isEmpty(j))return;let n=c+1;s&&(s.preventDefault(),n=1),m(!0),q(n);const p={query:j,page:n};u&&(p.orientation=u),x&&(p.color=x),g(p,l).then(r=>{var y,v,N;f(n===1?((y=r==null?void 0:r.response)==null?void 0:y.results)||[]:[...i,...((v=r==null?void 0:r.response)==null?void 0:v.results)||[]]),R((N=r==null?void 0:r.response)==null?void 0:N.total_pages),m(!1)}).catch(()=>{m(!1)})};return a.useEffect(()=>{if(!o.isEmpty(j)){m(!0);const s={query:j,page:1};u&&(s.orientation=u),x&&(s.color=x),q(1),g(s,l).then(n=>{var p,r;f(((p=n==null?void 0:n.response)==null?void 0:p.results)||[]),R((r=n==null?void 0:n.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[u,x,j,l]),o.isEmpty(l)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"underline px-1 hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(t.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>w(s.target.value)}),e.jsxRuntimeExports.jsxs(t.Popover,{children:[e.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(C.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(t.PopoverContent,{side:d?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:u,onValueChange:s=>S(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:x,onValueChange:s=>b(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:o.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(t.ScrollArea,{className:`h-full ${d&&!o.isEmpty(i)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[o.isEmpty(i)&&!h&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),d?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:i.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>E(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):i.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),h&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(T.Loader,{className:"animate-spin w-6 h-6"})," Loading..."]}),!o.isEmpty(i)&&c<I&&!h&&e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>P(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=z;exports.fetchImage=g;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
1
|
+
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import { useState as p, useEffect as D } from "react";
|
|
3
3
|
import { isEmpty as d, startCase as E } from "lodash";
|
|
4
4
|
import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
|
|
5
5
|
import { createApi as B } from "unsplash-js";
|
|
6
|
-
import { i as F, bm as K, b1 as U, b2 as V, b3 as O, au as P, av as C, aw as S, ax as I, ay as h, bp as Q, B as H } from "./index-
|
|
6
|
+
import { i as F, bm as K, b1 as U, b2 as V, b3 as O, au as P, av as C, aw as S, ax as I, ay as h, bp as Q, B as H } from "./index-G55KtqnU.js";
|
|
7
7
|
import { useDebouncedState as R } from "@react-hookz/web";
|
|
8
8
|
import { Loader as $ } from "lucide-react";
|
|
9
|
-
import "./
|
|
10
|
-
import "clsx";
|
|
11
|
-
import "tailwind-merge";
|
|
9
|
+
import "./MODIFIERS-MLfpKQY1.js";
|
|
12
10
|
import "@radix-ui/react-toggle";
|
|
13
11
|
import "class-variance-authority";
|
|
12
|
+
import "./utils-PPBbw5bk.js";
|
|
13
|
+
import "clsx";
|
|
14
|
+
import "tailwind-merge";
|
|
14
15
|
import "@radix-ui/react-switch";
|
|
15
16
|
import "@radix-ui/react-slot";
|
|
16
17
|
import "@radix-ui/react-accordion";
|
|
@@ -41,7 +42,7 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
41
42
|
B({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
42
43
|
o(i);
|
|
43
44
|
}).catch((i) => r(i));
|
|
44
|
-
}),
|
|
45
|
+
}), _e = ({ isModalView: x, onSelect: g }) => {
|
|
45
46
|
const o = F("unsplashAccessKey"), [r, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [z, y] = p(0), [u, T] = R("", 1e3), [f, c] = p(!1), _ = async (s) => {
|
|
46
47
|
if (d(u))
|
|
47
48
|
return;
|
|
@@ -191,6 +192,6 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
191
192
|
] });
|
|
192
193
|
};
|
|
193
194
|
export {
|
|
194
|
-
|
|
195
|
+
_e as default,
|
|
195
196
|
k as fetchImage
|
|
196
197
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),r=require("react"),a=require("lodash"),m=require("@radix-ui/react-icons"),q=require("jotai"),p=require("./index-T5MFAHA0.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const N=q.atom([]),I=({isModalView:t,onSelect:u})=>{const E=p.useBuilderProp("uploadMediaCallback",()=>""),x=p.useBuilderProp("fetchMediaCallback",()=>[]),[i,n]=q.useAtom(N),[o,j]=r.useState(!1),[h,f]=r.useState(!1),[c,d]=r.useState(),[g,R]=r.useState("");r.useEffect(()=>{(async()=>{f(!0);const s=await x();n(s||[]),f(!1)})()},[x,n]);const v=s=>{var l,b;s&&((b=(l=s==null?void 0:s.target)==null?void 0:l.files)==null?void 0:b.length)>0&&d(s.target.files[0])},y=async()=>{j(!0);try{const{url:s}=await E(c);u(s),d(void 0);const l=await x();n(l)}catch(s){n([]),R((s==null?void 0:s.message)||"Something went wrong.")}j(!1)};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[c?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(c),alt:"",className:"h-auto w-full max-w-sm rounded-md max-h-96 object-contain"}),g&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:g}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:y,disabled:o,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[o?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"})," ",o?"Uploading...":"Upload"]}),!o&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.Cross1Icon,{})," Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:t?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:t?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:v})]}),e.jsxRuntimeExports.jsxs(p.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${t?"px-2":""} pt-2`,children:[a.isEmpty(i)&&h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:"Fetching..."})}),a.isEmpty(i)&&!h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),t?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(i,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>u(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.thumbUrl})})},s.id))}):a.map(i,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>u(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=I;
|