@chaibuilder/sdk 1.2.23 → 1.2.25
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/README.md +6 -5
- package/dist/AddBlocks-Ol3iIVKa.js +207 -0
- package/dist/AddBlocks-a1c-7Ewz.cjs +1 -0
- package/dist/BrandingOptions-6rnt0UaA.cjs +1 -0
- package/dist/{BrandingOptions-eUSoIgjj.js → BrandingOptions-iTyWpwTs.js} +40 -54
- package/dist/CanvasArea-R4ogF9AT.cjs +55 -0
- package/dist/{CanvasArea-ulUy_rmB.js → CanvasArea-dZjng782.js} +340 -324
- package/dist/ChaiBuilderEditor-m30yoOgJ.cjs +163 -0
- package/dist/ChaiBuilderEditor-vP4at00I.js +27974 -0
- package/dist/{Class-lGzsNBOK.js → Class-ahc3NIbq.js} +26 -29
- package/dist/Class-eieto7e-.cjs +1 -0
- package/dist/Controls-3Cc1XYXg.js +105 -0
- package/dist/Controls-ky25Ebo3.cjs +1 -0
- package/dist/CurrentPage-3gQTH0Zt.cjs +1 -0
- package/dist/{CurrentPage-SFhXzQMy.js → CurrentPage-Kmfp-kFk.js} +41 -55
- package/dist/Functions-Hvon6AMZ.cjs +1 -0
- package/dist/Functions-NzT2Six_.js +15 -0
- package/dist/ImagesPanel-J1RlG7xG.cjs +1 -0
- package/dist/ImagesPanel-Wb0GF_NA.js +29 -0
- package/dist/ListTree-CZ-mtjZ9.cjs +1 -0
- package/dist/{ListTree-ZeVWczTF.js → ListTree-N3jeD790.js} +92 -102
- package/dist/{MODIFIERS-dytZ-osO.js → MODIFIERS-CNqNUapY.js} +10 -4
- package/dist/MODIFIERS-o1p3VnpS.cjs +1 -0
- package/dist/PagesPanel-Gi0z6gaf.cjs +1 -0
- package/dist/PagesPanel-u1IB-nRr.js +48 -0
- package/dist/ProjectPanel-EydGZmMW.js +71 -0
- package/dist/ProjectPanel-kiiljG4H.cjs +1 -0
- package/dist/{STRINGS--j49GZJP.js → STRINGS-b432aBJJ.js} +2 -2
- package/dist/Settings-8ilCSH8b.cjs +1 -0
- package/dist/{Settings-FZWm8Fc3.js → Settings-jCcd-VE6.js} +407 -401
- package/dist/SidePanels-T36C6Lhc.cjs +1 -0
- package/dist/{SidePanels-wrkkpcGE.js → SidePanels-pHMYprpW.js} +107 -117
- package/dist/Topbar-CvWQuspR.cjs +1 -0
- package/dist/Topbar-pbIDUE_B.js +122 -0
- package/dist/UnsplashImages-KBZPd9dv.cjs +1 -0
- package/dist/{UnsplashImages-eZedbK2J.js → UnsplashImages-L7x_3RQf.js} +50 -63
- package/dist/UploadImages-GkkJVAgG.cjs +1 -0
- package/dist/{UploadImages-71QziLbr.js → UploadImages-zdEJRLD8.js} +37 -60
- package/dist/accordion-oPUeqPCZ.js +42 -0
- package/dist/accordion-ynvFtV_p.cjs +1 -0
- package/dist/add-page-modal-9SGv2hgc.cjs +1 -0
- package/dist/add-page-modal-JCDXZIPW.js +95 -0
- package/dist/alert-dialog-P9xMMB6C.cjs +1 -0
- package/dist/alert-dialog-rypfO5ly.js +64 -0
- package/dist/badge-E-S7CqUt.cjs +1 -0
- package/dist/badge-tEwO7C51.js +23 -0
- package/dist/block-helpers-OKHmRRol.cjs +1 -0
- package/dist/block-helpers-oSFpSsGz.js +23 -0
- package/dist/command-BxR6jaCI.cjs +1 -0
- package/dist/command-Pn3HKDuV.js +97 -0
- package/dist/confirm-alert-uNm0lZ0y.cjs +1 -0
- package/dist/confirm-alert-wR5_VJ1l.js +36 -0
- package/dist/context-menu-8dC9uGXj.js +122 -0
- package/dist/context-menu-IgLbIuth.cjs +1 -0
- package/dist/{controls-OfJWSEqC.js → controls-IS5qnRce.js} +20 -85
- package/dist/controls-L7DPvB0m.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +7 -4
- package/dist/core.js +150 -75
- package/dist/{defaultTheme-D8B4-wHO.js → defaultTheme-4kA60XdB.js} +6 -8
- package/dist/defaultTheme-mrkeGFGI.cjs +1 -0
- package/dist/delete-page-modal-7KmP1elv.js +67 -0
- package/dist/delete-page-modal-SgfwvfNu.cjs +1 -0
- package/dist/dropdown-menu-El86_9Uo.js +124 -0
- package/dist/dropdown-menu-SiHzqWwZ.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +3 -292
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +5 -2
- package/dist/email.js +18 -37
- package/dist/{form-zKUMQFuB.js → form-0_RLz2TB.js} +12 -12
- package/dist/form-W58AVUdf.cjs +1 -0
- package/dist/hover-card-KUwpDkW8.cjs +1 -0
- package/dist/hover-card-q138xxXR.js +45 -0
- package/dist/{html-to-json-ngX9ef2u.js → html-to-json-2xtb7520.js} +41 -41
- package/dist/{html-to-json-efmv1pCj.cjs → html-to-json-uSnxl72F.cjs} +1 -1
- package/dist/iconBase-gbUAAO2L.cjs +1 -0
- package/dist/iconBase-h4DuR_XT.js +63 -0
- package/dist/index-9MmykVSc.cjs +1 -0
- package/dist/index-hElOGcFr.js +2200 -0
- package/dist/index-lDTsQp7h.js +188 -0
- package/dist/index-rq5Y9ZDy.cjs +1 -0
- package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
- package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
- package/dist/label-KaP7MRrs.js +10 -0
- package/dist/label-tFm8HZdb.cjs +1 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +62 -66
- package/dist/link-WbcKdQ9k.cjs +1 -0
- package/dist/link-xuhP-4dN.js +196 -0
- package/dist/page-viewer-Hx5hxHKm.cjs +1 -0
- package/dist/{page-viewer-7AwzWRtB.js → page-viewer-NnOwmAmu.js} +44 -58
- package/dist/popover-a84pbVhQ.js +23 -0
- package/dist/popover-fKjgcRUx.cjs +1 -0
- package/dist/{project-general-setting-pYPoqvqd.js → project-general-setting-9ju3TDju.js} +35 -43
- package/dist/project-general-setting-FxkwjvJz.cjs +1 -0
- package/dist/{project-seo-setting-zXKOcjep.js → project-seo-setting-36CdUszM.js} +23 -40
- package/dist/project-seo-setting-RU7qiXxb.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +13 -14
- package/dist/scroll-area-FiHvy-TZ.cjs +1 -0
- package/dist/scroll-area-ewXbxc3n.js +30 -0
- package/dist/select-7bjg-rr9.cjs +1 -0
- package/dist/select-POGdEDHT.js +75 -0
- package/dist/separator-3Civ-6hb.cjs +1 -0
- package/dist/separator-SctTn0Qi.js +18 -0
- package/dist/single-page-detail-beY0MT1b.cjs +1 -0
- package/dist/{single-page-detail-q2TDxN-P.js → single-page-detail-hD1jKZ8k.js} +65 -73
- package/dist/skeleton-STeL9VrJ.cjs +1 -0
- package/dist/skeleton-lu8e7q2y.js +239 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +5 -2
- package/dist/studio.js +24 -40
- package/dist/tabs-_4WbA1cc.cjs +1 -0
- package/dist/tabs-yQ3oGziM.js +106 -0
- package/dist/textarea-1kZEh7ki.cjs +1 -0
- package/dist/textarea-b2QvVhrK.js +73 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +364 -159
- package/dist/useAddBlock-8pxOEYIl.cjs +1 -0
- package/dist/useAddBlock-FEKFJNwQ.js +69 -0
- package/dist/useChaiExternalData-fkFgoS80.js +6 -0
- package/dist/useChaiExternalData-rwoAZ6uU.cjs +1 -0
- package/dist/useDarkMode-7i57segK.cjs +1 -0
- package/dist/useDarkMode-8VHJlYyE.js +23 -0
- package/dist/useSelectedBreakpoints-6NK5qd7T.js +10 -0
- package/dist/useSelectedBreakpoints-7ONXb-vN.cjs +1 -0
- package/dist/useStylingState-Iuj84yvc.js +186 -0
- package/dist/useStylingState-OIvJMV6p.cjs +1 -0
- package/dist/useUiLibraries-nCdauJ4N.cjs +1 -0
- package/dist/useUiLibraries-psyWFbNc.js +12 -0
- package/dist/useUpdateBlocksProps-Unn8lUyj.cjs +1 -0
- package/dist/useUpdateBlocksProps-vWcDp-P9.js +23 -0
- package/dist/utils-dze1SGvB.js +6 -0
- package/dist/utils-qK_SjzzV.cjs +1 -0
- package/dist/web-blocks.cjs +1 -6
- package/dist/web-blocks.js +3 -1153
- package/package.json +1 -1
- package/dist/AddBlocks-b0Vk6eqO.js +0 -206
- package/dist/AddBlocks-bgu08YJC.cjs +0 -1
- package/dist/BrandingOptions-AljW1cXz.cjs +0 -1
- package/dist/CanvasArea-dp1tzDkK.cjs +0 -55
- package/dist/Class-PoYusiA5.cjs +0 -1
- package/dist/CurrentPage-rWHgPomd.cjs +0 -1
- package/dist/Functions-7jnEwJyw.js +0 -15
- package/dist/Functions-N3yhPYKY.cjs +0 -1
- package/dist/ListTree-5n8U4-IF.cjs +0 -1
- package/dist/MODIFIERS-0g14w5RS.cjs +0 -1
- package/dist/PagesPanel-IkZjy0Gn.js +0 -64
- package/dist/PagesPanel-sBN51kKZ.cjs +0 -1
- package/dist/ProjectPanel-e98TJLfI.js +0 -85
- package/dist/ProjectPanel-lbQH31jc.cjs +0 -1
- package/dist/Settings-qytQoyTv.cjs +0 -1
- package/dist/SidePanels-YRIM1IPq.cjs +0 -1
- package/dist/Topbar-LUyDFBkK.js +0 -129
- package/dist/Topbar-NOSnWo7V.cjs +0 -1
- package/dist/UnsplashImages-f-ObKOC-.cjs +0 -1
- package/dist/UploadImages-oOnccvT9.cjs +0 -1
- package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
- package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
- package/dist/add-page-modal-g3fd00P5.cjs +0 -1
- package/dist/add-page-modal-yQ6qL6Ui.js +0 -104
- package/dist/confirm-alert-3flAvzWH.js +0 -60
- package/dist/confirm-alert-LQsGNYz8.cjs +0 -1
- package/dist/controls-KK2oLIa8.cjs +0 -1
- package/dist/defaultTheme-7VqqhOcp.cjs +0 -1
- package/dist/delete-page-modal-iMmkPec0.js +0 -83
- package/dist/delete-page-modal-tzZmqGzE.cjs +0 -1
- package/dist/empty-slot-ZBlsQi6m.js +0 -15
- package/dist/empty-slot-nzYOgZuS.cjs +0 -1
- package/dist/form-LBHtTduy.cjs +0 -1
- package/dist/index--dUsFH1I.cjs +0 -1
- package/dist/index-HD1UKc4P.js +0 -3079
- package/dist/index-YpnaudSM.js +0 -63
- package/dist/index-bOWwCMRF.cjs +0 -206
- package/dist/index-e0c8PmRQ.js +0 -205
- package/dist/index-ecnGWzh9.cjs +0 -1
- package/dist/index-fvMaxES9.cjs +0 -1
- package/dist/index-gi1LIOCw.cjs +0 -1
- package/dist/index-m4WGov7e.js +0 -2202
- package/dist/index-uLtBNl55.js +0 -39503
- package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
- package/dist/page-viewer-5gTszT-n.cjs +0 -1
- package/dist/project-general-setting-52CTYL_w.cjs +0 -1
- package/dist/project-seo-setting-jTweI1DX.cjs +0 -1
- package/dist/single-page-detail-jy2SPcp1.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),_=require("@radix-ui/react-icons"),r=require("react"),I=require("jotai"),u=require("lodash-es"),c=require("./skeleton-STeL9VrJ.cjs"),n=require("./tabs-_4WbA1cc.cjs"),w=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),b=require("react-i18next"),y=require("lucide-react"),L=require("@chaibuilder/runtime"),j=require("./alert-dialog-P9xMMB6C.cjs"),v=require("./select-7bjg-rr9.cjs"),D=require("./index-rq5Y9ZDy.cjs"),l=require("./STRINGS-gPz7CUOk.cjs"),C=require("./badge-E-S7CqUt.cjs"),P=require("./Functions-Hvon6AMZ.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-dialog");require("@radix-ui/react-tabs");require("./MODIFIERS-o1p3VnpS.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-hotkeys-hook");require("@react-hookz/web");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-select");const O=({provider:s,onClose:a})=>{const{t:o}=b.useTranslation(),[i,f]=r.useState(null);return r.useEffect(()=>{s&&(s.mockFn?s.mockFn:s.dataFn)().then(d=>f(d))},[s]),s?e.jsxRuntimeExports.jsx(n.Dialog,{onOpenChange:p=>p?"":a(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(n.DialogContent,{children:[e.jsxRuntimeExports.jsxs(n.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(n.DialogTitle,{children:[o("data_provider"),": ",s.name]}),e.jsxRuntimeExports.jsx(n.DialogDescription,{children:s.description})]}),e.jsxRuntimeExports.jsx(w.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(D.JsonView,{data:i,shouldExpandNode:D.allExpanded,style:{...D.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function A({children:s,name:a,onRemove:o}){const{t:i}=b.useTranslation();return e.jsxRuntimeExports.jsxs(j.AlertDialog,{children:[e.jsxRuntimeExports.jsx(j.AlertDialogTrigger,{asChild:!0,children:s}),e.jsxRuntimeExports.jsxs(j.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(j.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(j.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:i("remove_provider_confirmation").replace("{name}",a)}}),e.jsxRuntimeExports.jsx(j.AlertDialogDescription,{children:i("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(j.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(j.AlertDialogCancel,{children:i("cancel")}),e.jsxRuntimeExports.jsx(j.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:i("remove")})]})]})]})}const B=()=>{const{t:s}=b.useTranslation(),a=r.useMemo(()=>L.getChaiDataProviders(),[]),[o,i]=w.usePageDataProviders(),[,f]=I.useAtom(w.builderSaveStateAtom),[p,d]=r.useState(u.filter(a,t=>u.map(o,"providerKey").includes(t.providerKey))),[T,g]=r.useState(""),[N,m]=r.useState(null),k=u.filter(a.map(t=>u.map(p,"providerKey").includes(t.providerKey)?null:{value:t.providerKey,label:t.name}),t=>!u.isNull(t)),q=t=>{const E=u.find(a,{providerKey:t});d(h=>[...h,E]),i(h=>[...h,{providerKey:E.providerKey,args:{}}]),g(""),f("UNSAVED")},x=t=>{d(E=>u.filter(E,h=>h.providerKey!==t.providerKey)),i(E=>u.filter(E,h=>h.providerKey!==t.providerKey)),f("UNSAVED")},R=t=>m(t);return u.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[s("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:s("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:s("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(v.Select,{value:T,onValueChange:t=>q(t),children:[e.jsxRuntimeExports.jsx(v.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(v.SelectValue,{placeholder:s("select_provider")})}),e.jsxRuntimeExports.jsxs(v.SelectContent,{children:[e.jsxRuntimeExports.jsx(v.SelectItem,{value:"",children:s("choose")}),k.map(t=>e.jsxRuntimeExports.jsx(v.SelectItem,{value:t.value,children:t.label},t.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${p.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[s("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:p.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","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 items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:t.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:t.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>R(t),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",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",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",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"})]}),s("view_data")]}),e.jsxRuntimeExports.jsx(A,{onRemove:()=>x(t),name:t.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",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",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",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"})]}),s("remove")]})})]})]},t.providerKey))}),e.jsxRuntimeExports.jsx(O,{onClose:()=>m(null),provider:N})]})]})},U=()=>{const{t:s}=b.useTranslation(),a={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(n.Dialog,{children:[e.jsxRuntimeExports.jsx(n.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(c.Tooltip,{children:[e.jsxRuntimeExports.jsx(c.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(c.Button,{size:"sm",className:"w-10",variant:"outline",children:e.jsxRuntimeExports.jsx(_.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(c.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:s("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(n.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(n.DialogHeader,{children:e.jsxRuntimeExports.jsx(n.DialogTitle,{children:s("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(a).map(i=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(C.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:s(i)}),e.jsxRuntimeExports.jsx("div",{children:s(a[i])})]},i))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(i=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(C.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:s(i)}),e.jsxRuntimeExports.jsx("div",{children:s(o[i])})]},i))})]})})]})]})},Y=r.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-a1c-7Ewz.cjs"))),S=r.lazy(()=>Promise.resolve().then(()=>require("./ListTree-CZ-mtjZ9.cjs"))),z=r.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-6rnt0UaA.cjs"))),V=r.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-J1RlG7xG.cjs")));let K=null;const M=()=>{const s=c.useBuilderProp("sideBarComponents.top",[]),a=c.useBuilderProp("sideBarComponents.bottom",[]),[o,i]=I.useAtom(w.activePanelAtom),[f,p]=r.useState(o),[d,T]=r.useState(null),{t:g}=b.useTranslation(),N={"add-blocks":Y,[l.OUTLINE_KEY]:S,"branding-options":z,images:V};u.each(s,({name:x,panel:R})=>{N[x]=R});const m=x=>{clearTimeout(K),o!==l.OUTLINE_KEY&&x===l.OUTLINE_KEY?K=setTimeout(()=>i(l.OUTLINE_KEY),500):p(x),i(x)},k=c.useBuilderProp("dataBindingSupport",!1);function q(){const x=setTimeout(()=>{d&&(m(l.OUTLINE_KEY),clearTimeout(d))},500);T(x)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:q,onClick:()=>m(l.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,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(c.Button,{onClick:()=>{m("add-blocks")},size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(_.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(c.Button,{onClick:()=>m(l.OUTLINE_KEY),size:"sm",variant:o===l.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(y.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(c.Button,{onClick:()=>m("branding-options"),size:"sm",variant:o==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(_.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),r.Children.toArray(s.map(({name:x,icon:R})=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(c.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(c.Button,{onClick:()=>m(x),size:"sm",className:"w-10",variant:o===x?"default":"outline",children:e.jsxRuntimeExports.jsx(R,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(U,{}),r.Children.toArray(a.map(x=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(c.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(x,{})})))]})]}),o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-full w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(r.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:P.cn("relative z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),onMouseEnter:()=>{d&&clearTimeout(d)},children:r.createElement(u.get(N,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(r.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:k?e.jsxRuntimeExports.jsxs(n.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(n.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(n.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(y.ListTreeIcon,{className:"mr-2 h-3"})," ",g("Outline")]}),e.jsxRuntimeExports.jsxs(n.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(y.DatabaseIcon,{className:"mr-2 w-3"}),g("Data")]})]}),e.jsxRuntimeExports.jsx(n.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:r.createElement(S)}),e.jsxRuntimeExports.jsx(n.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(B,{})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(n.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsx(n.TabsList,{className:"mx-1 grid h-10 grid-cols-1",children:e.jsxRuntimeExports.jsxs(n.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(y.ListTreeIcon,{className:"mr-2 h-3"})," ",g("Outline")]})}),e.jsxRuntimeExports.jsx(n.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:r.createElement(S)})]})})})})]})};exports.default=M;
|
|
@@ -1,67 +1,57 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
2
|
-
import { KeyboardIcon as U, PlusIcon as J, Half2Icon as
|
|
3
|
-
import j, {
|
|
1
|
+
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
+
import { KeyboardIcon as U, PlusIcon as J, Half2Icon as W } from "@radix-ui/react-icons";
|
|
3
|
+
import j, { useMemo as Y, useState as h, useEffect as Z, lazy as w, Suspense as N } from "react";
|
|
4
4
|
import { useAtom as O } from "jotai";
|
|
5
|
-
import { filter as y, map as K, isNull as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { filter as y, map as K, isNull as q, isEmpty as $, find as G, each as Q, get as X } from "lodash-es";
|
|
6
|
+
import { T as ee, a as se, B as v, c as re, u as T, S as E } from "./skeleton-lu8e7q2y.js";
|
|
7
|
+
import { D as M, b as H, c as F, e as R, f as le, a as ae, T as B, g as z, h as S, i as A } from "./tabs-yQ3oGziM.js";
|
|
8
|
+
import { o as ie, q as te, E as oe, s as ne } from "./ChaiBuilderEditor-vP4at00I.js";
|
|
9
9
|
import { useTranslation as g } from "react-i18next";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { c as
|
|
14
|
-
import "./
|
|
15
|
-
import "
|
|
16
|
-
import "./
|
|
17
|
-
import "
|
|
10
|
+
import { ListTreeIcon as _, DatabaseIcon as ce } from "lucide-react";
|
|
11
|
+
import { getChaiDataProviders as de } from "@chaibuilder/runtime";
|
|
12
|
+
import { A as me, a as xe, b as he, c as ue, e as pe, f as fe, d as je, h as ve, g as ge } from "./alert-dialog-rypfO5ly.js";
|
|
13
|
+
import { S as be, c as Ne, b as ye, d as we, f as V } from "./select-POGdEDHT.js";
|
|
14
|
+
import { J as ke, a as De, d as Ce } from "./index-lDTsQp7h.js";
|
|
15
|
+
import { O as i } from "./STRINGS-b432aBJJ.js";
|
|
16
|
+
import { B as I } from "./badge-tEwO7C51.js";
|
|
17
|
+
import { c as Te } from "./Functions-NzT2Six_.js";
|
|
18
|
+
import "@radix-ui/react-slot";
|
|
18
19
|
import "class-variance-authority";
|
|
19
|
-
import "./
|
|
20
|
+
import "./utils-dze1SGvB.js";
|
|
20
21
|
import "clsx";
|
|
21
22
|
import "tailwind-merge";
|
|
22
|
-
import "@radix-ui/react-switch";
|
|
23
|
-
import "@radix-ui/react-slot";
|
|
24
|
-
import "@radix-ui/react-accordion";
|
|
25
|
-
import "@radix-ui/react-alert-dialog";
|
|
26
|
-
import "@radix-ui/react-dialog";
|
|
27
|
-
import "@radix-ui/react-label";
|
|
28
|
-
import "@radix-ui/react-scroll-area";
|
|
29
|
-
import "@radix-ui/react-tabs";
|
|
30
23
|
import "@radix-ui/react-tooltip";
|
|
31
|
-
import "@radix-ui/react-popover";
|
|
32
|
-
import "@radix-ui/react-menubar";
|
|
33
|
-
import "@radix-ui/react-hover-card";
|
|
34
|
-
import "@radix-ui/react-select";
|
|
35
|
-
import "@radix-ui/react-dropdown-menu";
|
|
36
|
-
import "@radix-ui/react-separator";
|
|
37
24
|
import "@radix-ui/react-toast";
|
|
38
|
-
import "
|
|
39
|
-
import "@radix-ui/react-
|
|
40
|
-
import "
|
|
25
|
+
import "@radix-ui/react-dialog";
|
|
26
|
+
import "@radix-ui/react-tabs";
|
|
27
|
+
import "./MODIFIERS-CNqNUapY.js";
|
|
28
|
+
import "@radix-ui/react-scroll-area";
|
|
41
29
|
import "react-dom";
|
|
42
|
-
import "react-quill";
|
|
43
|
-
import "i18next";
|
|
44
30
|
import "@floating-ui/react-dom";
|
|
31
|
+
import "i18next";
|
|
45
32
|
import "flagged";
|
|
46
33
|
import "react-hotkeys-hook";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
import "@react-hookz/web";
|
|
35
|
+
import "@radix-ui/react-alert-dialog";
|
|
36
|
+
import "@radix-ui/react-select";
|
|
37
|
+
const Se = ({ provider: s, onClose: o }) => {
|
|
38
|
+
const { t: a } = g(), [l, u] = h(null);
|
|
39
|
+
return Z(() => {
|
|
40
|
+
s && (s.mockFn ? s.mockFn : s.dataFn)().then((n) => u(n));
|
|
51
41
|
}, [s]), s ? /* @__PURE__ */ e.jsx(M, { onOpenChange: (d) => d ? "" : o(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
|
|
52
42
|
/* @__PURE__ */ e.jsxs(F, { children: [
|
|
53
43
|
/* @__PURE__ */ e.jsxs(R, { children: [
|
|
54
|
-
|
|
44
|
+
a("data_provider"),
|
|
55
45
|
": ",
|
|
56
46
|
s.name
|
|
57
47
|
] }),
|
|
58
|
-
/* @__PURE__ */ e.jsx(
|
|
48
|
+
/* @__PURE__ */ e.jsx(le, { children: s.description })
|
|
59
49
|
] }),
|
|
60
|
-
/* @__PURE__ */ e.jsx(
|
|
61
|
-
|
|
50
|
+
/* @__PURE__ */ e.jsx(oe, { children: /* @__PURE__ */ e.jsx(
|
|
51
|
+
ke,
|
|
62
52
|
{
|
|
63
|
-
data:
|
|
64
|
-
shouldExpandNode:
|
|
53
|
+
data: l,
|
|
54
|
+
shouldExpandNode: De,
|
|
65
55
|
style: {
|
|
66
56
|
...Ce,
|
|
67
57
|
container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
|
|
@@ -72,55 +62,55 @@ const Ae = ({ provider: s, onClose: o }) => {
|
|
|
72
62
|
) })
|
|
73
63
|
] }) }) : null;
|
|
74
64
|
};
|
|
75
|
-
function
|
|
65
|
+
function Ae({
|
|
76
66
|
children: s,
|
|
77
67
|
name: o,
|
|
78
|
-
onRemove:
|
|
68
|
+
onRemove: a
|
|
79
69
|
}) {
|
|
80
|
-
const { t:
|
|
81
|
-
return /* @__PURE__ */ e.jsxs(
|
|
82
|
-
/* @__PURE__ */ e.jsx(
|
|
83
|
-
/* @__PURE__ */ e.jsxs(
|
|
84
|
-
/* @__PURE__ */ e.jsxs(
|
|
70
|
+
const { t: l } = g();
|
|
71
|
+
return /* @__PURE__ */ e.jsxs(me, { children: [
|
|
72
|
+
/* @__PURE__ */ e.jsx(xe, { asChild: !0, children: s }),
|
|
73
|
+
/* @__PURE__ */ e.jsxs(he, { children: [
|
|
74
|
+
/* @__PURE__ */ e.jsxs(ue, { children: [
|
|
85
75
|
/* @__PURE__ */ e.jsx(
|
|
86
|
-
|
|
76
|
+
pe,
|
|
87
77
|
{
|
|
88
|
-
dangerouslySetInnerHTML: { __html:
|
|
78
|
+
dangerouslySetInnerHTML: { __html: l("remove_provider_confirmation").replace("{name}", o) }
|
|
89
79
|
}
|
|
90
80
|
),
|
|
91
|
-
/* @__PURE__ */ e.jsx(
|
|
81
|
+
/* @__PURE__ */ e.jsx(fe, { children: l("remove_provider_warning") })
|
|
92
82
|
] }),
|
|
93
|
-
/* @__PURE__ */ e.jsxs(
|
|
94
|
-
/* @__PURE__ */ e.jsx(
|
|
95
|
-
/* @__PURE__ */ e.jsx(
|
|
83
|
+
/* @__PURE__ */ e.jsxs(je, { children: [
|
|
84
|
+
/* @__PURE__ */ e.jsx(ve, { children: l("cancel") }),
|
|
85
|
+
/* @__PURE__ */ e.jsx(ge, { onClick: a, className: "bg-red-600 hover:bg-red-700", children: l("remove") })
|
|
96
86
|
] })
|
|
97
87
|
] })
|
|
98
88
|
] });
|
|
99
89
|
}
|
|
100
90
|
const _e = () => {
|
|
101
|
-
const { t: s } = g(), o = Y(() =>
|
|
102
|
-
y(o, (r) => K(
|
|
103
|
-
), [k,
|
|
91
|
+
const { t: s } = g(), o = Y(() => de(), []), [a, l] = ie(), [, u] = O(te), [d, n] = h(
|
|
92
|
+
y(o, (r) => K(a, "providerKey").includes(r.providerKey))
|
|
93
|
+
), [k, p] = h(""), [b, c] = h(null), D = y(
|
|
104
94
|
o.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
|
|
105
|
-
(r) => !
|
|
106
|
-
),
|
|
107
|
-
const x =
|
|
108
|
-
n((m) => [...m, x]),
|
|
95
|
+
(r) => !q(r)
|
|
96
|
+
), C = (r) => {
|
|
97
|
+
const x = G(o, { providerKey: r });
|
|
98
|
+
n((m) => [...m, x]), l((m) => [...m, { providerKey: x.providerKey, args: {} }]), p(""), u("UNSAVED");
|
|
109
99
|
}, t = (r) => {
|
|
110
|
-
n((x) => y(x, (m) => m.providerKey !== r.providerKey)),
|
|
100
|
+
n((x) => y(x, (m) => m.providerKey !== r.providerKey)), l((x) => y(x, (m) => m.providerKey !== r.providerKey)), u("UNSAVED");
|
|
111
101
|
}, f = (r) => c(r);
|
|
112
|
-
return
|
|
102
|
+
return $(o) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
113
103
|
s("no_data_providers"),
|
|
114
104
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
115
105
|
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: s("learn_more") })
|
|
116
106
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
117
107
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
118
108
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
|
|
119
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(
|
|
120
|
-
/* @__PURE__ */ e.jsx(
|
|
121
|
-
/* @__PURE__ */ e.jsxs(
|
|
122
|
-
/* @__PURE__ */ e.jsx(
|
|
123
|
-
|
|
109
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(be, { value: k, onValueChange: (r) => C(r), children: [
|
|
110
|
+
/* @__PURE__ */ e.jsx(Ne, { className: "w-full", children: /* @__PURE__ */ e.jsx(ye, { placeholder: s("select_provider") }) }),
|
|
111
|
+
/* @__PURE__ */ e.jsxs(we, { children: [
|
|
112
|
+
/* @__PURE__ */ e.jsx(V, { value: "", children: s("choose") }),
|
|
113
|
+
D.map((r) => /* @__PURE__ */ e.jsx(V, { value: r.value, children: r.label }, r.value))
|
|
124
114
|
] })
|
|
125
115
|
] }) }),
|
|
126
116
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -169,7 +159,7 @@ const _e = () => {
|
|
|
169
159
|
]
|
|
170
160
|
}
|
|
171
161
|
),
|
|
172
|
-
/* @__PURE__ */ e.jsx(
|
|
162
|
+
/* @__PURE__ */ e.jsx(Ae, { onRemove: () => t(r), name: r.name, children: /* @__PURE__ */ e.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
|
|
173
163
|
/* @__PURE__ */ e.jsxs(
|
|
174
164
|
"svg",
|
|
175
165
|
{
|
|
@@ -197,7 +187,7 @@ const _e = () => {
|
|
|
197
187
|
},
|
|
198
188
|
r.providerKey
|
|
199
189
|
)) }),
|
|
200
|
-
/* @__PURE__ */ e.jsx(
|
|
190
|
+
/* @__PURE__ */ e.jsx(Se, { onClose: () => c(null), provider: b })
|
|
201
191
|
] })
|
|
202
192
|
] });
|
|
203
193
|
}, Pe = () => {
|
|
@@ -205,35 +195,35 @@ const _e = () => {
|
|
|
205
195
|
"ctrl + Z": "Undo",
|
|
206
196
|
"ctrl + Y": "Redo",
|
|
207
197
|
"ctrl + D": "Duplicate"
|
|
208
|
-
},
|
|
198
|
+
}, a = {
|
|
209
199
|
// "ctrl + /": "Rename block",
|
|
210
200
|
"ctrl + S": "Save page",
|
|
211
201
|
esc: "Deselect blocks",
|
|
212
202
|
del: "Delete block"
|
|
213
203
|
};
|
|
214
204
|
return /* @__PURE__ */ e.jsxs(M, { children: [
|
|
215
|
-
/* @__PURE__ */ e.jsx(
|
|
216
|
-
/* @__PURE__ */ e.jsx(
|
|
217
|
-
/* @__PURE__ */ e.jsx(
|
|
205
|
+
/* @__PURE__ */ e.jsx(ae, { children: /* @__PURE__ */ e.jsxs(ee, { children: [
|
|
206
|
+
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx(v, { size: "sm", className: "w-10", variant: "outline", children: /* @__PURE__ */ e.jsx(U, {}) }) }),
|
|
207
|
+
/* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
|
|
218
208
|
] }) }),
|
|
219
209
|
/* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
|
|
220
210
|
/* @__PURE__ */ e.jsx(F, { children: /* @__PURE__ */ e.jsx(R, { children: s("Keyboard shortcuts") }) }),
|
|
221
211
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2", children: [
|
|
222
|
-
/* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(o).map((
|
|
223
|
-
/* @__PURE__ */ e.jsx(
|
|
224
|
-
/* @__PURE__ */ e.jsx("div", { children: s(o[
|
|
225
|
-
] },
|
|
226
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(
|
|
227
|
-
/* @__PURE__ */ e.jsx(
|
|
228
|
-
/* @__PURE__ */ e.jsx("div", { children: s(l
|
|
229
|
-
] },
|
|
212
|
+
/* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(o).map((l) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
213
|
+
/* @__PURE__ */ e.jsx(I, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
|
|
214
|
+
/* @__PURE__ */ e.jsx("div", { children: s(o[l]) })
|
|
215
|
+
] }, l)) }),
|
|
216
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(a).map((l) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
217
|
+
/* @__PURE__ */ e.jsx(I, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
|
|
218
|
+
/* @__PURE__ */ e.jsx("div", { children: s(a[l]) })
|
|
219
|
+
] }, l)) })
|
|
230
220
|
] }) })
|
|
231
221
|
] })
|
|
232
222
|
] });
|
|
233
|
-
}, Ke = w(() => import("./AddBlocks-
|
|
223
|
+
}, Ke = w(() => import("./AddBlocks-Ol3iIVKa.js")), P = w(() => import("./ListTree-N3jeD790.js")), Ee = w(() => import("./BrandingOptions-iTyWpwTs.js")), Be = w(() => import("./ImagesPanel-Wb0GF_NA.js"));
|
|
234
224
|
let L = null;
|
|
235
|
-
const
|
|
236
|
-
const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [
|
|
225
|
+
const js = () => {
|
|
226
|
+
const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [a, l] = O(ne), [u, d] = h(a), [n, k] = h(null), { t: p } = g(), b = {
|
|
237
227
|
"add-blocks": Ke,
|
|
238
228
|
[i]: P,
|
|
239
229
|
"branding-options": Ee,
|
|
@@ -243,19 +233,19 @@ const Ts = () => {
|
|
|
243
233
|
b[t] = f;
|
|
244
234
|
});
|
|
245
235
|
const c = (t) => {
|
|
246
|
-
clearTimeout(L),
|
|
247
|
-
},
|
|
248
|
-
function
|
|
236
|
+
clearTimeout(L), a !== i && t === i ? L = setTimeout(() => l(i), 500) : d(t), l(t);
|
|
237
|
+
}, D = T("dataBindingSupport", !1);
|
|
238
|
+
function C() {
|
|
249
239
|
const t = setTimeout(() => {
|
|
250
240
|
n && (c(i), clearTimeout(n));
|
|
251
241
|
}, 500);
|
|
252
242
|
k(t);
|
|
253
243
|
}
|
|
254
244
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
255
|
-
|
|
245
|
+
a !== i ? /* @__PURE__ */ e.jsx(
|
|
256
246
|
"div",
|
|
257
247
|
{
|
|
258
|
-
onMouseEnter:
|
|
248
|
+
onMouseEnter: C,
|
|
259
249
|
onClick: () => c(i),
|
|
260
250
|
className: "fixed inset-0 z-[50] bg-black/20"
|
|
261
251
|
}
|
|
@@ -269,7 +259,7 @@ const Ts = () => {
|
|
|
269
259
|
c("add-blocks");
|
|
270
260
|
},
|
|
271
261
|
size: "sm",
|
|
272
|
-
variant:
|
|
262
|
+
variant: a === "add-blocks" ? "default" : "outline",
|
|
273
263
|
children: /* @__PURE__ */ e.jsx(J, { className: "text-xl" })
|
|
274
264
|
}
|
|
275
265
|
),
|
|
@@ -278,7 +268,7 @@ const Ts = () => {
|
|
|
278
268
|
{
|
|
279
269
|
onClick: () => c(i),
|
|
280
270
|
size: "sm",
|
|
281
|
-
variant:
|
|
271
|
+
variant: a === i ? "default" : "outline",
|
|
282
272
|
children: /* @__PURE__ */ e.jsx(_, { className: "w-4" })
|
|
283
273
|
}
|
|
284
274
|
),
|
|
@@ -287,18 +277,18 @@ const Ts = () => {
|
|
|
287
277
|
{
|
|
288
278
|
onClick: () => c("branding-options"),
|
|
289
279
|
size: "sm",
|
|
290
|
-
variant:
|
|
291
|
-
children: /* @__PURE__ */ e.jsx(
|
|
280
|
+
variant: a === "branding-options" ? "default" : "outline",
|
|
281
|
+
children: /* @__PURE__ */ e.jsx(W, { className: "w-4 max-w-[40px] text-xs" })
|
|
292
282
|
}
|
|
293
283
|
),
|
|
294
284
|
j.Children.toArray(
|
|
295
|
-
s.map(({ name: t, icon: f }) => /* @__PURE__ */ e.jsx(N, { fallback: /* @__PURE__ */ e.jsx(
|
|
285
|
+
s.map(({ name: t, icon: f }) => /* @__PURE__ */ e.jsx(N, { fallback: /* @__PURE__ */ e.jsx(E, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
296
286
|
v,
|
|
297
287
|
{
|
|
298
288
|
onClick: () => c(t),
|
|
299
289
|
size: "sm",
|
|
300
290
|
className: "w-10",
|
|
301
|
-
variant:
|
|
291
|
+
variant: a === t ? "default" : "outline",
|
|
302
292
|
children: /* @__PURE__ */ e.jsx(f, {})
|
|
303
293
|
}
|
|
304
294
|
) }))
|
|
@@ -307,11 +297,11 @@ const Ts = () => {
|
|
|
307
297
|
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
|
|
308
298
|
/* @__PURE__ */ e.jsx(Pe, {}),
|
|
309
299
|
j.Children.toArray(
|
|
310
|
-
o.map((t) => /* @__PURE__ */ e.jsx(N, { fallback: /* @__PURE__ */ e.jsx(
|
|
300
|
+
o.map((t) => /* @__PURE__ */ e.jsx(N, { fallback: /* @__PURE__ */ e.jsx(E, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
|
|
311
301
|
)
|
|
312
302
|
] })
|
|
313
303
|
] }),
|
|
314
|
-
|
|
304
|
+
a !== i ? /* @__PURE__ */ e.jsx(
|
|
315
305
|
"div",
|
|
316
306
|
{
|
|
317
307
|
className: "absolute left-14 z-[50] h-full w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",
|
|
@@ -330,7 +320,7 @@ const Ts = () => {
|
|
|
330
320
|
onMouseEnter: () => {
|
|
331
321
|
n && clearTimeout(n);
|
|
332
322
|
},
|
|
333
|
-
children: j.createElement(X(b,
|
|
323
|
+
children: j.createElement(X(b, a, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
334
324
|
}
|
|
335
325
|
)
|
|
336
326
|
}
|
|
@@ -345,28 +335,28 @@ const Ts = () => {
|
|
|
345
335
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
346
336
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
347
337
|
] }),
|
|
348
|
-
children:
|
|
349
|
-
/* @__PURE__ */ e.jsxs(
|
|
350
|
-
/* @__PURE__ */ e.jsxs(
|
|
338
|
+
children: D ? /* @__PURE__ */ e.jsxs(B, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
|
|
339
|
+
/* @__PURE__ */ e.jsxs(z, { className: "mx-1 grid h-10 grid-cols-2", children: [
|
|
340
|
+
/* @__PURE__ */ e.jsxs(S, { value: i, children: [
|
|
351
341
|
/* @__PURE__ */ e.jsx(_, { className: "mr-2 h-3" }),
|
|
352
342
|
" ",
|
|
353
|
-
|
|
343
|
+
p("Outline")
|
|
354
344
|
] }),
|
|
355
|
-
/* @__PURE__ */ e.jsxs(
|
|
356
|
-
/* @__PURE__ */ e.jsx(
|
|
357
|
-
|
|
345
|
+
/* @__PURE__ */ e.jsxs(S, { value: "data-provider", children: [
|
|
346
|
+
/* @__PURE__ */ e.jsx(ce, { className: "mr-2 w-3" }),
|
|
347
|
+
p("Data")
|
|
358
348
|
] })
|
|
359
349
|
] }),
|
|
360
|
-
/* @__PURE__ */ e.jsx(
|
|
361
|
-
/* @__PURE__ */ e.jsx(
|
|
362
|
-
] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
|
|
363
|
-
/* @__PURE__ */ e.jsx(
|
|
350
|
+
/* @__PURE__ */ e.jsx(A, { value: i, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: j.createElement(P) }),
|
|
351
|
+
/* @__PURE__ */ e.jsx(A, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(_e, {}) })
|
|
352
|
+
] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(B, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
|
|
353
|
+
/* @__PURE__ */ e.jsx(z, { className: "mx-1 grid h-10 grid-cols-1", children: /* @__PURE__ */ e.jsxs(S, { value: i, children: [
|
|
364
354
|
/* @__PURE__ */ e.jsx(_, { className: "mr-2 h-3" }),
|
|
365
355
|
" ",
|
|
366
|
-
|
|
356
|
+
p("Outline")
|
|
367
357
|
] }) }),
|
|
368
358
|
/* @__PURE__ */ e.jsx(
|
|
369
|
-
|
|
359
|
+
A,
|
|
370
360
|
{
|
|
371
361
|
value: i,
|
|
372
362
|
className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",
|
|
@@ -379,5 +369,5 @@ const Ts = () => {
|
|
|
379
369
|
] });
|
|
380
370
|
};
|
|
381
371
|
export {
|
|
382
|
-
|
|
372
|
+
js as default
|
|
383
373
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),a=require("react"),l=require("@radix-ui/react-icons"),t=require("./select-7bjg-rr9.cjs"),s=require("./skeleton-STeL9VrJ.cjs"),j=require("./separator-3Civ-6hb.cjs"),o=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),c=require("react-i18next"),d=require("./iconBase-gbUAAO2L.cjs");require("@radix-ui/react-select");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("jotai");require("lodash-es");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-separator");require("./MODIFIERS-o1p3VnpS.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("./Functions-Hvon6AMZ.cjs");require("react-hotkeys-hook");require("@react-hookz/web");require("@chaibuilder/runtime");const h=()=>s.useBuilderProp("languages",["en"]),E=()=>h().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(t.Select,{children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(t.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(t.SelectContent,{children:e.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[e.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})});function g(i){return d.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"}}]})(i)}const R=()=>{const{savePage:i,saveState:r}=o.useSavePage(),{t:u}=c.useTranslation(),x=s.useBuilderProp("hideSaveButton",!1),n=a.useMemo(()=>{switch(r){case"SAVING":return"animate-pulse bg-gray-300 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"}},[r]);if(x)return null;const p=e.jsxRuntimeExports.jsxs(s.Button,{disabled:r==="SAVING",onClick:m=>{m.preventDefault(),i()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${n}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(g,{className:"text-lg"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:r==="SAVING"?"Saving...":u(r==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:p})},v=function(){const r=s.useBuilderProp("previewComponent"),[,u]=o.usePreviewMode(),{t:x}=c.useTranslation();return r?e.jsxRuntimeExports.jsxs(s.Button,{onClick:n=>{n.preventDefault(),u(!0)},className:"flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(l.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:x("Preview")})]}):null},f=()=>{const i=s.useBuilderProp("topBarComponents.left",[]),r=s.useBuilderProp("topBarComponents.center",[]),u=s.useBuilderProp("topBarComponents.right",[]),x=s.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:a.Children.toArray(i.map(n=>e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:a.Children.toArray(r.map(n=>e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(E,{}),e.jsxRuntimeExports.jsx(v,{}),e.jsxRuntimeExports.jsx(j.Separator,{orientation:"vertical"}),x?e.jsxRuntimeExports.jsx(R,{}):null,a.Children.toArray(u.map(n=>e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=f;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
+
import o, { useMemo as h, Suspense as c } from "react";
|
|
3
|
+
import { FontFamilyIcon as f, EyeOpenIcon as j } from "@radix-ui/react-icons";
|
|
4
|
+
import { S as g, c as v, b as S, d as b, a as N, e as w, f as i } from "./select-POGdEDHT.js";
|
|
5
|
+
import { u as a, B as p, S as m } from "./skeleton-lu8e7q2y.js";
|
|
6
|
+
import { S as y } from "./separator-SctTn0Qi.js";
|
|
7
|
+
import { m as C, g as B } from "./ChaiBuilderEditor-vP4at00I.js";
|
|
8
|
+
import { useTranslation as x } from "react-i18next";
|
|
9
|
+
import { G as A } from "./iconBase-h4DuR_XT.js";
|
|
10
|
+
import "@radix-ui/react-select";
|
|
11
|
+
import "./utils-dze1SGvB.js";
|
|
12
|
+
import "clsx";
|
|
13
|
+
import "tailwind-merge";
|
|
14
|
+
import "jotai";
|
|
15
|
+
import "lodash-es";
|
|
16
|
+
import "@radix-ui/react-slot";
|
|
17
|
+
import "class-variance-authority";
|
|
18
|
+
import "@radix-ui/react-tooltip";
|
|
19
|
+
import "@radix-ui/react-toast";
|
|
20
|
+
import "@radix-ui/react-separator";
|
|
21
|
+
import "./MODIFIERS-CNqNUapY.js";
|
|
22
|
+
import "@radix-ui/react-scroll-area";
|
|
23
|
+
import "react-dom";
|
|
24
|
+
import "@floating-ui/react-dom";
|
|
25
|
+
import "i18next";
|
|
26
|
+
import "flagged";
|
|
27
|
+
import "./Functions-NzT2Six_.js";
|
|
28
|
+
import "react-hotkeys-hook";
|
|
29
|
+
import "@react-hookz/web";
|
|
30
|
+
import "@chaibuilder/runtime";
|
|
31
|
+
const P = () => a("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(g, { children: [
|
|
32
|
+
/* @__PURE__ */ e.jsx(v, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
33
|
+
S,
|
|
34
|
+
{
|
|
35
|
+
placeholder: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
36
|
+
/* @__PURE__ */ e.jsx(f, { className: "h-4 w-4" }),
|
|
37
|
+
" English(US)"
|
|
38
|
+
] })
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ e.jsx(b, { children: /* @__PURE__ */ e.jsxs(N, { children: [
|
|
42
|
+
/* @__PURE__ */ e.jsx(w, { children: "Fruits" }),
|
|
43
|
+
/* @__PURE__ */ e.jsx(i, { value: "apple", children: "Apple" }),
|
|
44
|
+
/* @__PURE__ */ e.jsx(i, { value: "banana", children: "Banana" }),
|
|
45
|
+
/* @__PURE__ */ e.jsx(i, { value: "blueberry", children: "Blueberry" }),
|
|
46
|
+
/* @__PURE__ */ e.jsx(i, { value: "grapes", children: "Grapes" }),
|
|
47
|
+
/* @__PURE__ */ e.jsx(i, { value: "pineapple", children: "Pineapple" })
|
|
48
|
+
] }) })
|
|
49
|
+
] }) });
|
|
50
|
+
function G(r) {
|
|
51
|
+
return A({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z" } }] })(r);
|
|
52
|
+
}
|
|
53
|
+
const I = () => {
|
|
54
|
+
const { savePage: r, saveState: t } = C(), { t: n } = x(), l = a("hideSaveButton", !1), s = h(() => {
|
|
55
|
+
switch (t) {
|
|
56
|
+
case "SAVING":
|
|
57
|
+
return "animate-pulse bg-gray-300 text-gray-900";
|
|
58
|
+
case "SAVED":
|
|
59
|
+
return "bg-green-500 text-white hover:bg-green-600 hover:text-white";
|
|
60
|
+
default:
|
|
61
|
+
return "bg-gray-200 text-gray-500 hover:bg-gray-100";
|
|
62
|
+
}
|
|
63
|
+
}, [t]);
|
|
64
|
+
if (l)
|
|
65
|
+
return null;
|
|
66
|
+
const u = /* @__PURE__ */ e.jsxs(
|
|
67
|
+
p,
|
|
68
|
+
{
|
|
69
|
+
disabled: t === "SAVING",
|
|
70
|
+
onClick: (d) => {
|
|
71
|
+
d.preventDefault(), r();
|
|
72
|
+
},
|
|
73
|
+
className: `flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${s}`,
|
|
74
|
+
size: "sm",
|
|
75
|
+
variant: "outline",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ e.jsx(G, { className: "text-lg" }),
|
|
78
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : n(t === "SAVED" ? "Saved" : "Unsaved") })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
|
|
83
|
+
}, V = function() {
|
|
84
|
+
const t = a("previewComponent"), [, n] = B(), { t: l } = x();
|
|
85
|
+
return t ? /* @__PURE__ */ e.jsxs(
|
|
86
|
+
p,
|
|
87
|
+
{
|
|
88
|
+
onClick: (s) => {
|
|
89
|
+
s.preventDefault(), n(!0);
|
|
90
|
+
},
|
|
91
|
+
className: "flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",
|
|
92
|
+
size: "sm",
|
|
93
|
+
variant: "outline",
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ e.jsx(j, { className: "text-xs" }),
|
|
96
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: l("Preview") })
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
) : null;
|
|
100
|
+
}, ce = () => {
|
|
101
|
+
const r = a("topBarComponents.left", []), t = a("topBarComponents.center", []), n = a("topBarComponents.right", []), l = a("editable", !0);
|
|
102
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
103
|
+
/* @__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(
|
|
104
|
+
r.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
105
|
+
) }) }),
|
|
106
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: o.Children.toArray(
|
|
107
|
+
t.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
108
|
+
) }),
|
|
109
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
110
|
+
/* @__PURE__ */ e.jsx(k, {}),
|
|
111
|
+
/* @__PURE__ */ e.jsx(V, {}),
|
|
112
|
+
/* @__PURE__ */ e.jsx(y, { orientation: "vertical" }),
|
|
113
|
+
l ? /* @__PURE__ */ e.jsx(I, {}) : null,
|
|
114
|
+
o.Children.toArray(
|
|
115
|
+
n.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
116
|
+
)
|
|
117
|
+
] })
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
ce as default
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),o=require("react"),l=require("lodash-es"),A=require("@radix-ui/react-icons"),T=require("unsplash-js"),b=require("./skeleton-STeL9VrJ.cjs"),z=require("./command-BxR6jaCI.cjs"),_=require("./scroll-area-FiHvy-TZ.cjs"),g=require("./popover-fKjgcRUx.cjs"),t=require("./select-7bjg-rr9.cjs");require("react-i18next");const D=require("@react-hookz/web"),L=require("lucide-react");require("jotai");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("cmdk");require("./tabs-_4WbA1cc.cjs");require("@radix-ui/react-dialog");require("@radix-ui/react-tabs");require("@radix-ui/react-scroll-area");require("@radix-ui/react-popover");require("@radix-ui/react-select");const R=async(d,E)=>new Promise((i,a)=>{T.createApi({accessKey:E}).search.getPhotos(d).then(c=>{i(c)}).catch(c=>a(c))}),V=({isModalView:d,onSelect:E})=>{const i=b.useBuilderProp("unsplashAccessKey",""),[a,f]=o.useState([]),[c,y]=o.useState(0),[x,I]=o.useState(),[u,w]=o.useState(),[P,v]=o.useState(0),[j,C]=D.useDebouncedState("",1e3),[h,m]=o.useState(!1),k=async s=>{if(l.isEmpty(j))return;let n=c+1;s&&(s.preventDefault(),n=1),m(!0),y(n);const p={query:j,page:n};x&&(p.orientation=x),u&&(p.color=u),R(p,i).then(r=>{var q,N,S;f(n===1?((q=r==null?void 0:r.response)==null?void 0:q.results)||[]:[...a,...((N=r==null?void 0:r.response)==null?void 0:N.results)||[]]),v((S=r==null?void 0:r.response)==null?void 0:S.total_pages),m(!1)}).catch(()=>{m(!1)})};return o.useEffect(()=>{if(!l.isEmpty(j)&&i){m(!0);const s={query:j,page:1};x&&(s.orientation=x),u&&(s.color=u),y(1),R(s,i).then(n=>{var p,r;f(((p=n==null?void 0:n.response)==null?void 0:p.results)||[]),v((r=n==null?void 0:n.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[x,u,j,i]),l.isEmpty(i)?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(z.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>C(s.target.value)}),e.jsxRuntimeExports.jsxs(g.Popover,{children:[e.jsxRuntimeExports.jsx(g.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(A.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(g.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:x,onValueChange:s=>I(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:u,onValueChange:s=>w(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:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(_.ScrollArea,{className:`h-full ${d&&!l.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(a)&&!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:a.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))}):a.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(L.Loader,{className:"animate-spin w-6 h-6"})," Loading..."]}),!l.isEmpty(a)&&c<P&&!h&&e.jsxRuntimeExports.jsx(b.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>k(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=V;exports.fetchImage=R;
|