@chaibuilder/sdk 1.2.27 → 1.2.28
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-ksZjjn0k.js → AddBlocks-0sW6gkCO.js} +8 -7
- package/dist/AddBlocks-YJPdSqcY.cjs +1 -0
- package/dist/{BrandingOptions-T_kbQFQv.js → BrandingOptions--vgnQvD1.js} +11 -10
- package/dist/BrandingOptions-RDn_Nhcq.cjs +1 -0
- package/dist/CanvasArea-41QoxuLf.cjs +55 -0
- package/dist/CanvasArea-aii0PyU-.js +1179 -0
- package/dist/{Class-3k8xjeiM.js → Class-6Hz2KzYb.js} +1 -1
- package/dist/{Class-MmCxz2Ay.cjs → Class-Zc8hpE7f.cjs} +1 -1
- package/dist/{CurrentPage-0eeU1V_c.js → CurrentPage-06Iacwyp.js} +9 -8
- package/dist/CurrentPage-2W1pdAOG.cjs +1 -0
- package/dist/ListTree-DnA8gj-7.js +314 -0
- package/dist/ListTree-pdQ14QJC.cjs +1 -0
- package/dist/MODIFIERS-YPHRtwrM.cjs +1 -0
- package/dist/{MODIFIERS-WQdaNvb8.js → MODIFIERS-cBT31iqE.js} +7 -19
- package/dist/PagesPanel-PBFzPSNY.cjs +1 -0
- package/dist/{PagesPanel-rYN28QpN.js → PagesPanel-_1CDTUdE.js} +9 -8
- package/dist/ProjectPanel-755bbzEQ.cjs +1 -0
- package/dist/{ProjectPanel-ivFOhdcz.js → ProjectPanel-pUMeIiUW.js} +14 -13
- package/dist/STRINGS--j49GZJP.js +7 -0
- package/dist/STRINGS-gPz7CUOk.cjs +1 -0
- package/dist/Settings-G9Xtqr7n.cjs +1 -0
- package/dist/{Settings-XWmKzRl9.js → Settings-dnO-s6x0.js} +596 -559
- package/dist/SidePanels-Gq2LdVuY.cjs +1 -0
- package/dist/{SidePanels-ODktnGbC.js → SidePanels-VxSXXkt_.js} +62 -61
- package/dist/{Topbar-Yunooh00.js → Topbar-5zbOSGF6.js} +6 -5
- package/dist/Topbar-J2tb4SA1.cjs +1 -0
- package/dist/{UnsplashImages-QMl0bxix.js → UnsplashImages-4WAWgA4s.js} +20 -19
- package/dist/UnsplashImages-XwjKheek.cjs +1 -0
- package/dist/{UploadImages-Si-A26bc.js → UploadImages-PONIHtn6.js} +11 -10
- package/dist/UploadImages-y7LAQVrT.cjs +1 -0
- package/dist/{add-page-modal-U7AUUrI1.js → add-page-modal-4VrFvgEm.js} +25 -24
- package/dist/add-page-modal-jWcp0w-S.cjs +1 -0
- package/dist/confirm-alert-4OQlXZTJ.cjs +1 -0
- package/dist/{confirm-alert-kV5-c70T.js → confirm-alert-j7b88hsW.js} +6 -5
- package/dist/core.cjs +1 -1
- package/dist/core.js +47 -46
- package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
- package/dist/{defaultTheme-gunU_Fe5.js → defaultTheme-D8B4-wHO.js} +1 -1
- package/dist/{delete-page-modal-UCBpdjLe.js → delete-page-modal--xHHdRAq.js} +9 -8
- package/dist/delete-page-modal-p6b0upz4.cjs +1 -0
- package/dist/email.cjs +1 -1
- package/dist/email.js +7 -6
- package/dist/{form-zmlTjM9j.js → form-_GJb9YcB.js} +1 -1
- package/dist/{form-Ap63cNec.cjs → form-jQj7E-hS.cjs} +1 -1
- package/dist/html-to-json-LJyJsnmZ.js +228 -0
- package/dist/html-to-json-vP1ESB_e.cjs +1 -0
- package/dist/{index-lOJfSheQ.js → index-0QJwevON.js} +2 -2
- package/dist/index-12HbDLon.cjs +1 -0
- package/dist/{index-f0AbmoYY.js → index-Eb5zyh2F.js} +4 -4
- package/dist/{index-Qk028f-N.cjs → index-KArv7pNz.cjs} +1 -1
- package/dist/{index-CFUoB97-.js → index-UHaqEdws.js} +993 -956
- package/dist/{index-l19JVVXI.cjs → index-mlMvwv2b.cjs} +2 -2
- package/dist/lib.cjs +3 -3
- package/dist/lib.js +17 -16
- package/dist/{page-viewer-jOwy--9A.js → page-viewer-00Xx4u8e.js} +10 -9
- package/dist/page-viewer-SZNm7b1n.cjs +1 -0
- package/dist/project-general-setting-C_pHNuZE.cjs +1 -0
- package/dist/{project-general-setting-3N8HZ2fe.js → project-general-setting-asDxlmhZ.js} +10 -9
- package/dist/{project-seo-setting-bSiNgO_1.js → project-seo-setting-DuAaDfDR.js} +7 -6
- package/dist/project-seo-setting-q2953ybQ.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +14 -13
- package/dist/{single-page-detail--AZlZ-pC.js → single-page-detail-UNxXvhl4.js} +17 -16
- package/dist/single-page-detail-oqj6zsLU.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +8 -7
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +134 -133
- package/dist/useCanvasSettings-MR0Glu1b.cjs +1 -0
- package/dist/useCanvasSettings-R6br4J9i.js +6 -0
- package/dist/web-blocks.cjs +33 -1
- package/dist/web-blocks.js +603 -429
- package/package.json +1 -1
- package/dist/AddBlocks-S-4jzdWv.cjs +0 -1
- package/dist/BrandingOptions-EMCT0Wa3.cjs +0 -1
- package/dist/CanvasArea-SDzbubar.cjs +0 -55
- package/dist/CanvasArea-rhOeubmu.js +0 -950
- package/dist/CurrentPage-aTjWjc3o.cjs +0 -1
- package/dist/ListTree-Muu4rAtp.js +0 -308
- package/dist/ListTree-SWsqdfcG.cjs +0 -1
- package/dist/MODIFIERS-9EwxLM8V.cjs +0 -1
- package/dist/PagesPanel-n3x-0ozR.cjs +0 -1
- package/dist/ProjectPanel-pBePMOta.cjs +0 -1
- package/dist/Settings-JRyJayf5.cjs +0 -1
- package/dist/SidePanels-BtUeo6M9.cjs +0 -1
- package/dist/Topbar-QMeD3hvq.cjs +0 -1
- package/dist/UnsplashImages-05JR8oIu.cjs +0 -1
- package/dist/UploadImages-OgSN1HVt.cjs +0 -1
- package/dist/add-page-modal-9pTKItY-.cjs +0 -1
- package/dist/confirm-alert-DhRc-Zcd.cjs +0 -1
- package/dist/defaultTheme-7Lk2zq60.cjs +0 -1
- package/dist/delete-page-modal-4s-6AIy4.cjs +0 -1
- package/dist/html-to-json-C_Eobs_d.cjs +0 -1
- package/dist/html-to-json-p__Fgqdg.js +0 -210
- package/dist/index-F4AQQ6qq.cjs +0 -1
- package/dist/page-viewer-YFrIG3L7.cjs +0 -1
- package/dist/project-general-setting-hK7I7FuN.cjs +0 -1
- package/dist/project-seo-setting-x-FK0pez.cjs +0 -1
- package/dist/single-page-detail-9abF2g2R.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),q=require("@radix-ui/react-icons"),i=require("react"),S=require("jotai"),u=require("lodash-es"),s=require("./index-12HbDLon.cjs"),R=require("lucide-react"),_=require("@chaibuilder/runtime"),f=require("react-i18next"),w=require("./index-gi1LIOCw.cjs"),D=require("./index-mlMvwv2b.cjs"),l=require("./STRINGS-gPz7CUOk.cjs"),K=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("clsx");require("tailwind-merge");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("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");const C=({provider:t,onClose:a})=>{const{t:o}=f.useTranslation(),[n,h]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(c=>h(c))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":a(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(D.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(w.JsonView,{data:n,shouldExpandNode:w.allExpanded,style:{...w.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 I({children:t,name:a,onRemove:o}){const{t:n}=f.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:n("remove_provider_confirmation").replace("{name}",a)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:n("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:n("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:n("remove")})]})]})]})}const P=()=>{const{t}=f.useTranslation(),a=i.useMemo(()=>_.getChaiDataProviders(),[]),[o,n]=s.usePageDataProviders(),[,h]=S.useAtom(s.builderSaveStateAtom),[m,c]=i.useState(u.filter(a,r=>u.map(o,"providerKey").includes(r.providerKey))),[b,E]=i.useState(""),[g,d]=i.useState(null),N=u.filter(a.map(r=>u.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),y=r=>{const p=u.find(a,{providerKey:r});c(j=>[...j,p]),n(j=>[...j,{providerKey:p.providerKey,args:{}}]),E(""),h("UNSAVED")},x=r=>{c(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),n(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),h("UNSAVED")},v=r=>d(r);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:[t("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:t("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:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>y(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),N.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${m.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:m.map(r=>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:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>v(r),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"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(I,{onRemove:()=>x(r),name:r.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"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(C,{onClose:()=>d(null),provider:g})]})]})},L=i.memo(()=>{const{t}=f.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(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(s.Button,{size:"sm",className:"w-10",variant:"outline",children:e.jsxRuntimeExports.jsx(q.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("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(n=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(n)}),e.jsxRuntimeExports.jsx("div",{children:t(a[n])})]},n))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(n=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(n)}),e.jsxRuntimeExports.jsx("div",{children:t(o[n])})]},n))})]})})]})]})}),O=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-YJPdSqcY.cjs"))),T=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-pdQ14QJC.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-RDn_Nhcq.cjs"))),B=i.lazy(()=>Promise.resolve().then(()=>require("./index-12HbDLon.cjs")).then(t=>t.ImagesPanel));let k=null;const U=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),a=s.useBuilderProp("sideBarComponents.bottom",[]),[o,n]=S.useAtom(s.activePanelAtom),[h,m]=i.useState(o),[c,b]=i.useState(null),{t:E}=f.useTranslation(),g={"add-blocks":O,[l.OUTLINE_KEY]:T,"branding-options":A,images:B};u.each(t,({name:x,panel:v})=>{g[x]=v});const d=x=>{clearTimeout(k),o!==l.OUTLINE_KEY&&x===l.OUTLINE_KEY?k=setTimeout(()=>n(l.OUTLINE_KEY),500):m(x),n(x)},N=s.useBuilderProp("dataBindingSupport",!1);function y(){const x=setTimeout(()=>{c&&(d(l.OUTLINE_KEY),clearTimeout(c))},500);b(x)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:y,onClick:()=>d(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(s.Button,{onClick:()=>{d("add-blocks")},size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(q.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(l.OUTLINE_KEY),size:"sm",variant:o===l.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("branding-options"),size:"sm",variant:o==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(q.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:x,icon:v})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(x),size:"sm",className:"w-10",variant:o===x?"default":"outline",children:e.jsxRuntimeExports.jsx(v,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(L,{}),i.Children.toArray(a.map(x=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.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(i.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 z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),onMouseEnter:()=>{c&&clearTimeout(c)},children:i.createElement(u.get(g,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.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:N?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(R.DatabaseIcon,{className:"mr-2 w-3"}),E("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(T)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(P,{})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsx(s.TabsList,{className:"mx-1 grid h-10 grid-cols-1",children:e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]})}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(T)})]})})})})]})};exports.default=U;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { KeyboardIcon as U, PlusIcon as J, Half2Icon as
|
|
3
|
-
import j, { useState as
|
|
2
|
+
import { KeyboardIcon as U, PlusIcon as J, Half2Icon as W } from "@radix-ui/react-icons";
|
|
3
|
+
import j, { useState as p, useEffect as Y, useMemo as Z, memo as q, 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 { ad as M, ae as H, af as F, ag as R, ah as
|
|
7
|
-
import { ListTreeIcon as _, DatabaseIcon as
|
|
8
|
-
import { getChaiDataProviders as
|
|
5
|
+
import { filter as y, map as K, isNull as $, find as G, isEmpty as Q, each as X, get as ee } from "lodash-es";
|
|
6
|
+
import { ad as M, ae as H, af as F, ag as R, ah as se, A as re, a as ae, b as le, c as ie, d as te, e as oe, f as ne, g as ce, ai as de, y as me, C as xe, aj as pe, ak as he, al as ue, am as fe, an as E, ao as je, ap as ve, aq as ge, B as v, ar as be, as as B, h as T, at as Ne, S as z, au as V, av as I, aw as A, ax as S } from "./index-UHaqEdws.js";
|
|
7
|
+
import { ListTreeIcon as _, DatabaseIcon as ye } from "lucide-react";
|
|
8
|
+
import { getChaiDataProviders as we } from "@chaibuilder/runtime";
|
|
9
9
|
import { useTranslation as g } from "react-i18next";
|
|
10
|
-
import { J as
|
|
11
|
-
import { E as
|
|
12
|
-
import { O as i } from "./
|
|
13
|
-
import { c as
|
|
10
|
+
import { J as ke, a as Ce, d as De } from "./index-e0c8PmRQ.js";
|
|
11
|
+
import { E as Te } from "./index-0QJwevON.js";
|
|
12
|
+
import { O as i } from "./STRINGS--j49GZJP.js";
|
|
13
|
+
import { c as Ae } from "./Functions-7jnEwJyw.js";
|
|
14
14
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
15
15
|
import "@react-hookz/web";
|
|
16
|
-
import "./
|
|
16
|
+
import "./MODIFIERS-cBT31iqE.js";
|
|
17
|
+
import "./Class-6Hz2KzYb.js";
|
|
17
18
|
import "clsx";
|
|
18
19
|
import "tailwind-merge";
|
|
19
20
|
import "@radix-ui/react-toggle";
|
|
@@ -43,10 +44,10 @@ import "i18next";
|
|
|
43
44
|
import "@floating-ui/react-dom";
|
|
44
45
|
import "flagged";
|
|
45
46
|
import "react-hotkeys-hook";
|
|
46
|
-
const
|
|
47
|
-
const { t: l } = g(), [a,
|
|
48
|
-
return
|
|
49
|
-
s && (s.mockFn ? s.mockFn : s.dataFn)().then((n) =>
|
|
47
|
+
const Se = ({ provider: s, onClose: o }) => {
|
|
48
|
+
const { t: l } = g(), [a, h] = p(null);
|
|
49
|
+
return Y(() => {
|
|
50
|
+
s && (s.mockFn ? s.mockFn : s.dataFn)().then((n) => h(n));
|
|
50
51
|
}, [s]), s ? /* @__PURE__ */ e.jsx(M, { onOpenChange: (d) => d ? "" : o(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
|
|
51
52
|
/* @__PURE__ */ e.jsxs(F, { children: [
|
|
52
53
|
/* @__PURE__ */ e.jsxs(R, { children: [
|
|
@@ -54,15 +55,15 @@ const Ae = ({ provider: s, onClose: o }) => {
|
|
|
54
55
|
": ",
|
|
55
56
|
s.name
|
|
56
57
|
] }),
|
|
57
|
-
/* @__PURE__ */ e.jsx(
|
|
58
|
+
/* @__PURE__ */ e.jsx(se, { children: s.description })
|
|
58
59
|
] }),
|
|
59
|
-
/* @__PURE__ */ e.jsx(
|
|
60
|
-
|
|
60
|
+
/* @__PURE__ */ e.jsx(Te, { children: /* @__PURE__ */ e.jsx(
|
|
61
|
+
ke,
|
|
61
62
|
{
|
|
62
63
|
data: a,
|
|
63
|
-
shouldExpandNode:
|
|
64
|
+
shouldExpandNode: Ce,
|
|
64
65
|
style: {
|
|
65
|
-
...
|
|
66
|
+
...De,
|
|
66
67
|
container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
|
|
67
68
|
stringValue: "text-orange-600",
|
|
68
69
|
label: "text-green-900 font-semibold pr-1 tracking-wider"
|
|
@@ -71,53 +72,53 @@ const Ae = ({ provider: s, onClose: o }) => {
|
|
|
71
72
|
) })
|
|
72
73
|
] }) }) : null;
|
|
73
74
|
};
|
|
74
|
-
function
|
|
75
|
+
function _e({
|
|
75
76
|
children: s,
|
|
76
77
|
name: o,
|
|
77
78
|
onRemove: l
|
|
78
79
|
}) {
|
|
79
80
|
const { t: a } = g();
|
|
80
|
-
return /* @__PURE__ */ e.jsxs(
|
|
81
|
-
/* @__PURE__ */ e.jsx(
|
|
82
|
-
/* @__PURE__ */ e.jsxs(
|
|
83
|
-
/* @__PURE__ */ e.jsxs(
|
|
81
|
+
return /* @__PURE__ */ e.jsxs(re, { children: [
|
|
82
|
+
/* @__PURE__ */ e.jsx(ae, { asChild: !0, children: s }),
|
|
83
|
+
/* @__PURE__ */ e.jsxs(le, { children: [
|
|
84
|
+
/* @__PURE__ */ e.jsxs(ie, { children: [
|
|
84
85
|
/* @__PURE__ */ e.jsx(
|
|
85
|
-
|
|
86
|
+
te,
|
|
86
87
|
{
|
|
87
88
|
dangerouslySetInnerHTML: { __html: a("remove_provider_confirmation").replace("{name}", o) }
|
|
88
89
|
}
|
|
89
90
|
),
|
|
90
|
-
/* @__PURE__ */ e.jsx(
|
|
91
|
+
/* @__PURE__ */ e.jsx(oe, { children: a("remove_provider_warning") })
|
|
91
92
|
] }),
|
|
92
|
-
/* @__PURE__ */ e.jsxs(
|
|
93
|
-
/* @__PURE__ */ e.jsx(
|
|
94
|
-
/* @__PURE__ */ e.jsx(
|
|
93
|
+
/* @__PURE__ */ e.jsxs(ne, { children: [
|
|
94
|
+
/* @__PURE__ */ e.jsx(ce, { children: a("cancel") }),
|
|
95
|
+
/* @__PURE__ */ e.jsx(de, { onClick: l, className: "bg-red-600 hover:bg-red-700", children: a("remove") })
|
|
95
96
|
] })
|
|
96
97
|
] })
|
|
97
98
|
] });
|
|
98
99
|
}
|
|
99
|
-
const
|
|
100
|
-
const { t: s } = g(), o =
|
|
100
|
+
const Pe = () => {
|
|
101
|
+
const { t: s } = g(), o = Z(() => we(), []), [l, a] = me(), [, h] = O(xe), [d, n] = p(
|
|
101
102
|
y(o, (r) => K(l, "providerKey").includes(r.providerKey))
|
|
102
|
-
), [k, u] =
|
|
103
|
+
), [k, u] = p(""), [b, c] = p(null), C = y(
|
|
103
104
|
o.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
|
|
104
|
-
(r) =>
|
|
105
|
+
(r) => !$(r)
|
|
105
106
|
), D = (r) => {
|
|
106
|
-
const x =
|
|
107
|
-
n((m) => [...m, x]), a((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""),
|
|
107
|
+
const x = G(o, { providerKey: r });
|
|
108
|
+
n((m) => [...m, x]), a((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""), h("UNSAVED");
|
|
108
109
|
}, t = (r) => {
|
|
109
|
-
n((x) => y(x, (m) => m.providerKey !== r.providerKey)), a((x) => y(x, (m) => m.providerKey !== r.providerKey)),
|
|
110
|
+
n((x) => y(x, (m) => m.providerKey !== r.providerKey)), a((x) => y(x, (m) => m.providerKey !== r.providerKey)), h("UNSAVED");
|
|
110
111
|
}, f = (r) => c(r);
|
|
111
|
-
return
|
|
112
|
+
return Q(o) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
112
113
|
s("no_data_providers"),
|
|
113
114
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
114
115
|
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: s("learn_more") })
|
|
115
116
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
116
117
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
117
118
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
|
|
118
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(
|
|
119
|
-
/* @__PURE__ */ e.jsx(he, { className: "w-full", children: /* @__PURE__ */ e.jsx(
|
|
120
|
-
/* @__PURE__ */ e.jsxs(
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(pe, { value: k, onValueChange: (r) => D(r), children: [
|
|
120
|
+
/* @__PURE__ */ e.jsx(he, { className: "w-full", children: /* @__PURE__ */ e.jsx(ue, { placeholder: s("select_provider") }) }),
|
|
121
|
+
/* @__PURE__ */ e.jsxs(fe, { children: [
|
|
121
122
|
/* @__PURE__ */ e.jsx(E, { value: "", children: s("choose") }),
|
|
122
123
|
C.map((r) => /* @__PURE__ */ e.jsx(E, { value: r.value, children: r.label }, r.value))
|
|
123
124
|
] })
|
|
@@ -168,7 +169,7 @@ const _e = () => {
|
|
|
168
169
|
]
|
|
169
170
|
}
|
|
170
171
|
),
|
|
171
|
-
/* @__PURE__ */ e.jsx(
|
|
172
|
+
/* @__PURE__ */ e.jsx(_e, { 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: [
|
|
172
173
|
/* @__PURE__ */ e.jsxs(
|
|
173
174
|
"svg",
|
|
174
175
|
{
|
|
@@ -196,10 +197,10 @@ const _e = () => {
|
|
|
196
197
|
},
|
|
197
198
|
r.providerKey
|
|
198
199
|
)) }),
|
|
199
|
-
/* @__PURE__ */ e.jsx(
|
|
200
|
+
/* @__PURE__ */ e.jsx(Se, { onClose: () => c(null), provider: b })
|
|
200
201
|
] })
|
|
201
202
|
] });
|
|
202
|
-
},
|
|
203
|
+
}, Ke = q(() => {
|
|
203
204
|
const { t: s } = g(), o = {
|
|
204
205
|
"ctrl + Z": "Undo",
|
|
205
206
|
"ctrl + Y": "Redo",
|
|
@@ -211,9 +212,9 @@ const _e = () => {
|
|
|
211
212
|
del: "Delete block"
|
|
212
213
|
};
|
|
213
214
|
return /* @__PURE__ */ e.jsxs(M, { children: [
|
|
214
|
-
/* @__PURE__ */ e.jsx(
|
|
215
|
-
/* @__PURE__ */ e.jsx(
|
|
216
|
-
/* @__PURE__ */ e.jsx(
|
|
215
|
+
/* @__PURE__ */ e.jsx(je, { children: /* @__PURE__ */ e.jsxs(ve, { children: [
|
|
216
|
+
/* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsx(v, { size: "sm", className: "w-10", variant: "outline", children: /* @__PURE__ */ e.jsx(U, {}) }) }),
|
|
217
|
+
/* @__PURE__ */ e.jsx(be, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
|
|
217
218
|
] }) }),
|
|
218
219
|
/* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
|
|
219
220
|
/* @__PURE__ */ e.jsx(F, { children: /* @__PURE__ */ e.jsx(R, { children: s("Keyboard shortcuts") }) }),
|
|
@@ -229,16 +230,16 @@ const _e = () => {
|
|
|
229
230
|
] }) })
|
|
230
231
|
] })
|
|
231
232
|
] });
|
|
232
|
-
},
|
|
233
|
+
}), Ee = w(() => import("./AddBlocks-0sW6gkCO.js")), P = w(() => import("./ListTree-DnA8gj-7.js")), Be = w(() => import("./BrandingOptions--vgnQvD1.js")), ze = w(() => import("./index-UHaqEdws.js").then((s) => s.cu));
|
|
233
234
|
let L = null;
|
|
234
|
-
const
|
|
235
|
-
const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [l, a] = O(
|
|
236
|
-
"add-blocks":
|
|
235
|
+
const As = () => {
|
|
236
|
+
const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [l, a] = O(Ne), [h, d] = p(l), [n, k] = p(null), { t: u } = g(), b = {
|
|
237
|
+
"add-blocks": Ee,
|
|
237
238
|
[i]: P,
|
|
238
|
-
"branding-options":
|
|
239
|
-
images:
|
|
239
|
+
"branding-options": Be,
|
|
240
|
+
images: ze
|
|
240
241
|
};
|
|
241
|
-
|
|
242
|
+
X(s, ({ name: t, panel: f }) => {
|
|
242
243
|
b[t] = f;
|
|
243
244
|
});
|
|
244
245
|
const c = (t) => {
|
|
@@ -287,7 +288,7 @@ const Ds = () => {
|
|
|
287
288
|
onClick: () => c("branding-options"),
|
|
288
289
|
size: "sm",
|
|
289
290
|
variant: l === "branding-options" ? "default" : "outline",
|
|
290
|
-
children: /* @__PURE__ */ e.jsx(
|
|
291
|
+
children: /* @__PURE__ */ e.jsx(W, { className: "w-4 max-w-[40px] text-xs" })
|
|
291
292
|
}
|
|
292
293
|
),
|
|
293
294
|
j.Children.toArray(
|
|
@@ -304,7 +305,7 @@ const Ds = () => {
|
|
|
304
305
|
)
|
|
305
306
|
] }),
|
|
306
307
|
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
|
|
307
|
-
/* @__PURE__ */ e.jsx(
|
|
308
|
+
/* @__PURE__ */ e.jsx(Ke, {}),
|
|
308
309
|
j.Children.toArray(
|
|
309
310
|
o.map((t) => /* @__PURE__ */ e.jsx(N, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
|
|
310
311
|
)
|
|
@@ -325,11 +326,11 @@ const Ds = () => {
|
|
|
325
326
|
children: /* @__PURE__ */ e.jsx(
|
|
326
327
|
"div",
|
|
327
328
|
{
|
|
328
|
-
className:
|
|
329
|
+
className: Ae("relative z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),
|
|
329
330
|
onMouseEnter: () => {
|
|
330
331
|
n && clearTimeout(n);
|
|
331
332
|
},
|
|
332
|
-
children: j.createElement(
|
|
333
|
+
children: j.createElement(ee(b, l, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
333
334
|
}
|
|
334
335
|
)
|
|
335
336
|
}
|
|
@@ -352,12 +353,12 @@ const Ds = () => {
|
|
|
352
353
|
u("Outline")
|
|
353
354
|
] }),
|
|
354
355
|
/* @__PURE__ */ e.jsxs(A, { value: "data-provider", children: [
|
|
355
|
-
/* @__PURE__ */ e.jsx(
|
|
356
|
+
/* @__PURE__ */ e.jsx(ye, { className: "mr-2 w-3" }),
|
|
356
357
|
u("Data")
|
|
357
358
|
] })
|
|
358
359
|
] }),
|
|
359
360
|
/* @__PURE__ */ e.jsx(S, { value: i, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: j.createElement(P) }),
|
|
360
|
-
/* @__PURE__ */ e.jsx(S, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(
|
|
361
|
+
/* @__PURE__ */ e.jsx(S, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(Pe, {}) })
|
|
361
362
|
] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(V, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
|
|
362
363
|
/* @__PURE__ */ e.jsx(I, { className: "mx-1 grid h-10 grid-cols-1", children: /* @__PURE__ */ e.jsxs(A, { value: i, children: [
|
|
363
364
|
/* @__PURE__ */ e.jsx(_, { className: "mr-2 h-3" }),
|
|
@@ -378,5 +379,5 @@ const Ds = () => {
|
|
|
378
379
|
] });
|
|
379
380
|
};
|
|
380
381
|
export {
|
|
381
|
-
|
|
382
|
+
As as default
|
|
382
383
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as c } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import z, { useMemo as o, Suspense as n } from "react";
|
|
3
3
|
import { FontFamilyIcon as M, EyeOpenIcon as u } from "@radix-ui/react-icons";
|
|
4
|
-
import { h as r, aj as d, ak as C, al as L, am as m, ay as p, az as F, an as i, z as w, B as g, q as B, S as v, aA as f } from "./index-
|
|
4
|
+
import { h as r, aj as d, ak as C, al as L, am as m, ay as p, az as F, an as i, z as w, B as g, q as B, S as v, aA as f } from "./index-UHaqEdws.js";
|
|
5
5
|
import { G as x } from "./index-YpnaudSM.js";
|
|
6
6
|
import { useTranslation as e } from "react-i18next";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -11,9 +11,10 @@ import "clsx";
|
|
|
11
11
|
import "tailwind-merge";
|
|
12
12
|
import "@chaibuilder/runtime";
|
|
13
13
|
import "jotai";
|
|
14
|
-
import "./
|
|
14
|
+
import "./STRINGS--j49GZJP.js";
|
|
15
15
|
import "@react-hookz/web";
|
|
16
|
-
import "./
|
|
16
|
+
import "./MODIFIERS-cBT31iqE.js";
|
|
17
|
+
import "./Class-6Hz2KzYb.js";
|
|
17
18
|
import "@radix-ui/react-toggle";
|
|
18
19
|
import "class-variance-authority";
|
|
19
20
|
import "@radix-ui/react-switch";
|
|
@@ -106,7 +107,7 @@ const k = () => {
|
|
|
106
107
|
]
|
|
107
108
|
}
|
|
108
109
|
) : null;
|
|
109
|
-
},
|
|
110
|
+
}, C1 = () => {
|
|
110
111
|
const l = r("topBarComponents.left", []), t = r("topBarComponents.center", []), s = r("topBarComponents.right", []), h = r("editable", !0);
|
|
111
112
|
return /* @__PURE__ */ c.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
112
113
|
/* @__PURE__ */ c.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ c.jsx("div", { className: "flex items-center space-x-2 font-bold", children: z.Children.toArray(
|
|
@@ -127,5 +128,5 @@ const k = () => {
|
|
|
127
128
|
] });
|
|
128
129
|
};
|
|
129
130
|
export {
|
|
130
|
-
|
|
131
|
+
C1 as default
|
|
131
132
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),h=require("@radix-ui/react-icons"),t=require("./index-12HbDLon.cjs"),v=require("./index-ecnGWzh9.cjs"),i=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.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");const g=()=>t.useBuilderProp("languages",["en"]),H=()=>g().length===1?null:c.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:c.jsxRuntimeExports.jsxs(t.Select,{children:[c.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"w-[150px] border-0",children:c.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:c.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[c.jsxRuntimeExports.jsx(h.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),c.jsxRuntimeExports.jsx(t.SelectContent,{children:c.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[c.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Fruits"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"apple",children:"Apple"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"banana",children:"Banana"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"blueberry",children:"Blueberry"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"grapes",children:"Grapes"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})});function V(l){return v.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"}}]})(l)}const M=()=>{const{savePage:l,saveState:a}=t.useSavePage(),{t:s}=i.useTranslation(),e=t.useBuilderProp("hideSaveButton",!1),n=r.useMemo(()=>{switch(a){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"}},[a]);if(e)return null;const o=c.jsxRuntimeExports.jsxs(t.Button,{disabled:a==="SAVING",onClick:z=>{z.preventDefault(),l()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${n}`,size:"sm",variant:"outline",children:[c.jsxRuntimeExports.jsx(V,{className:"text-lg"}),c.jsxRuntimeExports.jsx("span",{className:"text-sm",children:a==="SAVING"?"Saving...":s(a==="SAVED"?"Saved":"Unsaved")})]});return c.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},u=function(){const a=t.useBuilderProp("previewComponent"),[,s]=t.usePreviewMode(),{t:e}=i.useTranslation();return a?c.jsxRuntimeExports.jsxs(t.Button,{onClick:n=>{n.preventDefault(),s(!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:[c.jsxRuntimeExports.jsx(h.EyeOpenIcon,{className:"text-xs"}),c.jsxRuntimeExports.jsx("span",{className:"text-sm",children:e("Preview")})]}):null},d=()=>{const l=t.useBuilderProp("topBarComponents.left",[]),a=t.useBuilderProp("topBarComponents.center",[]),s=t.useBuilderProp("topBarComponents.right",[]),e=t.useBuilderProp("editable",!0);return c.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:r.Children.toArray(l.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))})}),c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:r.Children.toArray(a.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))}),c.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsxRuntimeExports.jsx(H,{}),c.jsxRuntimeExports.jsx(u,{}),c.jsxRuntimeExports.jsx(t.Separator,{orientation:"vertical"}),e?c.jsxRuntimeExports.jsx(M,{}):null,r.Children.toArray(s.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=d;
|
|
@@ -2,8 +2,8 @@ import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
|
2
2
|
import { useState as p, useEffect as D } from "react";
|
|
3
3
|
import { isEmpty as d, startCase as E } from "lodash-es";
|
|
4
4
|
import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
|
|
5
|
-
import { createApi as
|
|
6
|
-
import { h as
|
|
5
|
+
import { createApi as B } from "unsplash-js";
|
|
6
|
+
import { h as F, bf as K, aW as U, aX as V, aY as O, aj as P, ak as C, al as S, am as k, an as h, bh as Q, B as H } from "./index-UHaqEdws.js";
|
|
7
7
|
import { useDebouncedState as R } from "@react-hookz/web";
|
|
8
8
|
import { Loader as W } from "lucide-react";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -12,8 +12,9 @@ import "clsx";
|
|
|
12
12
|
import "tailwind-merge";
|
|
13
13
|
import "@chaibuilder/runtime";
|
|
14
14
|
import "jotai";
|
|
15
|
-
import "./
|
|
16
|
-
import "./
|
|
15
|
+
import "./STRINGS--j49GZJP.js";
|
|
16
|
+
import "./MODIFIERS-cBT31iqE.js";
|
|
17
|
+
import "./Class-6Hz2KzYb.js";
|
|
17
18
|
import "react-i18next";
|
|
18
19
|
import "@radix-ui/react-toggle";
|
|
19
20
|
import "class-variance-authority";
|
|
@@ -39,17 +40,17 @@ import "react-icons-picker";
|
|
|
39
40
|
import "react-dom";
|
|
40
41
|
import "react-quill";
|
|
41
42
|
const I = async (x, g) => new Promise((o, r) => {
|
|
42
|
-
|
|
43
|
-
o(
|
|
44
|
-
}).catch((
|
|
45
|
-
}),
|
|
46
|
-
const o =
|
|
43
|
+
B({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
44
|
+
o(i);
|
|
45
|
+
}).catch((i) => r(i));
|
|
46
|
+
}), De = ({ isModalView: x, onSelect: g }) => {
|
|
47
|
+
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) => {
|
|
47
48
|
if (d(u))
|
|
48
49
|
return;
|
|
49
|
-
let t =
|
|
50
|
+
let t = i + 1;
|
|
50
51
|
s && (s.preventDefault(), t = 1), c(!0), v(t);
|
|
51
52
|
const m = { query: u, page: t };
|
|
52
|
-
|
|
53
|
+
l && (m.orientation = l), n && (m.color = n), I(m, o).then((a) => {
|
|
53
54
|
var N, b, w;
|
|
54
55
|
j(t === 1 ? ((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || [] : [...r, ...((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || []]), y((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), c(!1);
|
|
55
56
|
}).catch(() => {
|
|
@@ -60,14 +61,14 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
60
61
|
if (!d(u) && o) {
|
|
61
62
|
c(!0);
|
|
62
63
|
const s = { query: u, page: 1 };
|
|
63
|
-
|
|
64
|
+
l && (s.orientation = l), n && (s.color = n), v(1), I(s, o).then((t) => {
|
|
64
65
|
var m, a;
|
|
65
66
|
j(((m = t == null ? void 0 : t.response) == null ? void 0 : m.results) || []), y((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), c(!1);
|
|
66
67
|
}).catch(() => {
|
|
67
68
|
c(!1);
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
}, [
|
|
71
|
+
}, [l, n, u, o]), d(o) ? /* @__PURE__ */ e.jsx("div", { className: "h-full flex flex-col items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
|
|
71
72
|
"To enable Unsplash, kindly provide your",
|
|
72
73
|
/* @__PURE__ */ e.jsx(
|
|
73
74
|
"a",
|
|
@@ -82,7 +83,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
82
83
|
] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
83
84
|
/* @__PURE__ */ e.jsxs("form", { className: "flex items-center rounded-md border bg-gray-100 p-px", children: [
|
|
84
85
|
/* @__PURE__ */ e.jsx(
|
|
85
|
-
|
|
86
|
+
K,
|
|
86
87
|
{
|
|
87
88
|
type: "text",
|
|
88
89
|
name: "query",
|
|
@@ -91,8 +92,8 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
91
92
|
onChange: (s) => T(s.target.value)
|
|
92
93
|
}
|
|
93
94
|
),
|
|
94
|
-
/* @__PURE__ */ e.jsxs(
|
|
95
|
-
/* @__PURE__ */ e.jsx(
|
|
95
|
+
/* @__PURE__ */ e.jsxs(U, { children: [
|
|
96
|
+
/* @__PURE__ */ e.jsx(V, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
|
|
96
97
|
/* @__PURE__ */ e.jsx(
|
|
97
98
|
O,
|
|
98
99
|
{
|
|
@@ -100,7 +101,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
100
101
|
className: "z-[9999] flex w-max items-center justify-center",
|
|
101
102
|
children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
102
103
|
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
103
|
-
/* @__PURE__ */ e.jsxs(P, { defaultValue:
|
|
104
|
+
/* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => A(s), children: [
|
|
104
105
|
/* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
105
106
|
/* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
|
|
106
107
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
@@ -175,7 +176,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
175
176
|
/* @__PURE__ */ e.jsx(W, { className: "animate-spin w-6 h-6" }),
|
|
176
177
|
" Loading..."
|
|
177
178
|
] }),
|
|
178
|
-
!d(r) &&
|
|
179
|
+
!d(r) && i < z && !f && /* @__PURE__ */ e.jsx(
|
|
179
180
|
H,
|
|
180
181
|
{
|
|
181
182
|
size: "sm",
|
|
@@ -192,6 +193,6 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
192
193
|
] });
|
|
193
194
|
};
|
|
194
195
|
export {
|
|
195
|
-
|
|
196
|
+
De as default,
|
|
196
197
|
I as fetchImage
|
|
197
198
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("react"),l=require("lodash-es"),C=require("@radix-ui/react-icons"),k=require("unsplash-js"),t=require("./index-12HbDLon.cjs"),A=require("@react-hookz/web"),T=require("lucide-react");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("react-i18next");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");const g=async(d,E)=>new Promise((a,n)=>{k.createApi({accessKey:E}).search.getPhotos(d).then(c=>{a(c)}).catch(c=>n(c))}),z=({isModalView:d,onSelect:E})=>{const a=t.useBuilderProp("unsplashAccessKey",""),[n,f]=o.useState([]),[c,q]=o.useState(0),[u,S]=o.useState(),[x,b]=o.useState(),[I,R]=o.useState(0),[j,w]=A.useDebouncedState("",1e3),[h,m]=o.useState(!1),P=async s=>{if(l.isEmpty(j))return;let i=c+1;s&&(s.preventDefault(),i=1),m(!0),q(i);const p={query:j,page:i};u&&(p.orientation=u),x&&(p.color=x),g(p,a).then(r=>{var y,v,N;f(i===1?((y=r==null?void 0:r.response)==null?void 0:y.results)||[]:[...n,...((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 o.useEffect(()=>{if(!l.isEmpty(j)&&a){m(!0);const s={query:j,page:1};u&&(s.orientation=u),x&&(s.color=x),q(1),g(s,a).then(i=>{var p,r;f(((p=i==null?void 0:i.response)==null?void 0:p.results)||[]),R((r=i==null?void 0:i.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[u,x,j,a]),l.isEmpty(a)?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:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(t.ScrollArea,{className:`h-full ${d&&!l.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(n)&&!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:n.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))}):n.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..."]}),!l.isEmpty(n)&&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,17 +1,18 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as i, useEffect as w } from "react";
|
|
3
3
|
import { isEmpty as b, map as j } from "lodash-es";
|
|
4
4
|
import { GearIcon as C, UploadIcon as U, Cross1Icon as k } from "@radix-ui/react-icons";
|
|
5
5
|
import { atom as F, useAtom as E } from "jotai";
|
|
6
|
-
import { h as v,
|
|
6
|
+
import { h as v, bh as A } from "./index-UHaqEdws.js";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
8
|
import "./Functions-7jnEwJyw.js";
|
|
9
9
|
import "clsx";
|
|
10
10
|
import "tailwind-merge";
|
|
11
11
|
import "@chaibuilder/runtime";
|
|
12
|
-
import "./
|
|
12
|
+
import "./STRINGS--j49GZJP.js";
|
|
13
13
|
import "@react-hookz/web";
|
|
14
|
-
import "./
|
|
14
|
+
import "./MODIFIERS-cBT31iqE.js";
|
|
15
|
+
import "./Class-6Hz2KzYb.js";
|
|
15
16
|
import "react-i18next";
|
|
16
17
|
import "@radix-ui/react-toggle";
|
|
17
18
|
import "class-variance-authority";
|
|
@@ -36,8 +37,8 @@ import "@radix-ui/react-context-menu";
|
|
|
36
37
|
import "react-icons-picker";
|
|
37
38
|
import "react-dom";
|
|
38
39
|
import "react-quill";
|
|
39
|
-
const R = F([]),
|
|
40
|
-
const p = v("uploadMediaCallback"), n = v("fetchMediaCallback"), [s, m] = E(R), [o, u] =
|
|
40
|
+
const R = F([]), ge = ({ isModalView: r, onSelect: a }) => {
|
|
41
|
+
const p = v("uploadMediaCallback"), n = v("fetchMediaCallback"), [s, m] = E(R), [o, u] = i(!1), [x, f] = i(!1), [d, c] = i(), [h, y] = i("");
|
|
41
42
|
w(() => {
|
|
42
43
|
(async () => {
|
|
43
44
|
if (!n)
|
|
@@ -55,7 +56,7 @@ const R = F([]), he = ({ isModalView: r, onSelect: i }) => {
|
|
|
55
56
|
u(!0);
|
|
56
57
|
try {
|
|
57
58
|
const { url: t } = await p(d);
|
|
58
|
-
|
|
59
|
+
a(t), c(void 0);
|
|
59
60
|
const l = await n();
|
|
60
61
|
m(l);
|
|
61
62
|
} catch (t) {
|
|
@@ -113,7 +114,7 @@ const R = F([]), he = ({ isModalView: r, onSelect: i }) => {
|
|
|
113
114
|
/* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
|
|
114
115
|
b(s) && x && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "animate-pulse font-medium", children: "Fetching..." }) }),
|
|
115
116
|
b(s) && !x && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Images" }) }),
|
|
116
|
-
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: j(s, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () =>
|
|
117
|
+
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: j(s, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => a(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
117
118
|
"img",
|
|
118
119
|
{
|
|
119
120
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
@@ -122,7 +123,7 @@ const R = F([]), he = ({ isModalView: r, onSelect: i }) => {
|
|
|
122
123
|
}
|
|
123
124
|
) }) }, t.id)) }) : j(s, (t) => (
|
|
124
125
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
125
|
-
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () =>
|
|
126
|
+
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => a(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
126
127
|
"img",
|
|
127
128
|
{
|
|
128
129
|
className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
@@ -135,5 +136,5 @@ const R = F([]), he = ({ isModalView: r, onSelect: i }) => {
|
|
|
135
136
|
] });
|
|
136
137
|
};
|
|
137
138
|
export {
|
|
138
|
-
|
|
139
|
+
ge as default
|
|
139
140
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("react"),l=require("lodash-es"),m=require("@radix-ui/react-icons"),E=require("jotai"),p=require("./index-12HbDLon.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("react-i18next");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");const N=E.atom([]),I=({isModalView:t,onSelect:a})=>{const j=p.useBuilderProp("uploadMediaCallback"),u=p.useBuilderProp("fetchMediaCallback"),[i,x]=E.useAtom(N),[n,f]=s.useState(!1),[h,g]=s.useState(!1),[c,d]=s.useState(),[b,R]=s.useState("");s.useEffect(()=>{(async()=>{if(!u)return;g(!0);const r=await u();x(r||[]),g(!1)})()},[]);const v=r=>{var o,q;r&&((q=(o=r==null?void 0:r.target)==null?void 0:o.files)==null?void 0:q.length)>0&&d(r.target.files[0])},y=async()=>{if(j){f(!0);try{const{url:r}=await j(c);a(r),d(void 0);const o=await u();x(o)}catch(r){x([]),R((r==null?void 0:r.message)||"Something went wrong.")}f(!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 max-h-96 w-full max-w-sm rounded-md object-contain"}),b&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:b}),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:n,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:[n?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"})," ",n?"Uploading...":"Upload"]}),!n&&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:[l.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..."})}),l.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:l.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>a(r.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:r.name,src:r.thumbUrl})})},r.id))}):l.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>a(r.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:r.name,src:r.url})})},r.id))]})]})};exports.default=I;
|