@chaibuilder/sdk 1.2.16 → 1.2.18
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 -4
- package/dist/AddBlocks-5Q5w5lPJ.cjs +1 -0
- package/dist/{AddBlocks-TBFBvBvo.js → AddBlocks-uCdu9Xpr.js} +81 -81
- package/dist/{BrandingOptions-t_MjeHSM.js → BrandingOptions-JbHRN7V5.js} +18 -19
- package/dist/BrandingOptions-xrGQI1Kn.cjs +1 -0
- package/dist/{CanvasArea-ZYC8QbQB.js → CanvasArea-aWzbzB9p.js} +89 -95
- package/dist/{CanvasArea-oTylYgH9.cjs → CanvasArea-oUIvLfdq.cjs} +3 -3
- package/dist/{Class-17XFhL48.js → Class-3k8xjeiM.js} +1 -1
- package/dist/{Class-5ARpH_Tu.cjs → Class-MmCxz2Ay.cjs} +1 -1
- package/dist/{CurrentPage-4vC6olJo.js → CurrentPage-AlOLPG4o.js} +16 -16
- package/dist/CurrentPage-atmd8UrZ.cjs +1 -0
- package/dist/MODIFIERS-9EwxLM8V.cjs +1 -0
- package/dist/{MODIFIERS-RiXS5Mn1.js → MODIFIERS-WQdaNvb8.js} +5 -4
- package/dist/{Layers-m61dThGR.js → Outline-oGoAdnBw.js} +153 -145
- package/dist/Outline-uMUTwN-R.cjs +1 -0
- package/dist/{PagesPanel-v3KV_vfG.js → PagesPanel-VbSQHEu_.js} +10 -10
- package/dist/PagesPanel-nN3QUwXp.cjs +1 -0
- package/dist/ProjectPanel-UIEFhref.cjs +1 -0
- package/dist/{ProjectPanel-xsUuVX64.js → ProjectPanel-fqux215P.js} +8 -8
- package/dist/Settings-8qUW0Iow.cjs +1 -0
- package/dist/{Settings-ZNxfF14G.js → Settings-IhWI1ice.js} +293 -293
- package/dist/SidePanels-cOHgPE9y.cjs +1 -0
- package/dist/SidePanels-lMCXrchR.js +389 -0
- package/dist/Topbar-DYiisBtw.js +129 -0
- package/dist/Topbar-vLD-rWl5.cjs +1 -0
- package/dist/{UnsplashImages-SrxA-yNu.cjs → UnsplashImages-1JWfKlBc.cjs} +1 -1
- package/dist/{UnsplashImages-ppQXZ28F.js → UnsplashImages-lGLcqo4M.js} +13 -13
- package/dist/{UploadImages-IKR4oX2k.js → UploadImages-06m6vjbL.js} +35 -31
- package/dist/UploadImages-T4MYMOhW.cjs +1 -0
- package/dist/{add-page-modal-pc5-Yw4C.js → add-page-modal-mEbIXSKX.js} +13 -12
- package/dist/add-page-modal-niwhffYL.cjs +1 -0
- package/dist/{confirm-alert-QKtbNbWz.js → confirm-alert-YETlIRpE.js} +5 -5
- package/dist/{confirm-alert-uV_PtYc3.cjs → confirm-alert-ZpEIxh3X.cjs} +1 -1
- package/dist/controls-Dy1qa8Dc.cjs +1 -0
- package/dist/{empty-slot-5FRrRq1E.js → controls-XPXGHKht.js} +50 -61
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +18 -3
- package/dist/core.js +47 -53
- package/dist/{defaultTheme-IH19g4fv.cjs → defaultTheme-1XwPZT2b.cjs} +1 -1
- package/dist/{defaultTheme-YY8mlQS3.js → defaultTheme-s0cpA5Oy.js} +1 -1
- package/dist/{delete-page-modal-Zf3-4wLg.js → delete-page-modal-J_SmPWrw.js} +12 -12
- package/dist/delete-page-modal-sOqRlmKb.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +11 -10
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +15 -2
- package/dist/email.js +7 -12
- package/dist/empty-slot-ZBlsQi6m.js +15 -0
- package/dist/empty-slot-nzYOgZuS.cjs +1 -0
- package/dist/{form-faX0Yn4Q.js → form-2xJcQs_Y.js} +1 -1
- package/dist/{form-KkP1F7h1.cjs → form-Y0Vb4m04.cjs} +1 -1
- package/dist/{html-to-json-57841sEK.js → html-to-json-C5sExaSD.js} +1 -1
- package/dist/{html-to-json-2PeOCVey.cjs → html-to-json-FGufPv9R.cjs} +1 -1
- package/dist/index-3TQsdso6.cjs +1 -0
- package/dist/index-627XtO9e.js +2202 -0
- package/dist/{index-rktN6W1Y.js → index-LF3KXx4u.js} +22845 -25123
- package/dist/index-T3wfa1kz.cjs +1 -0
- package/dist/index-YpnaudSM.js +63 -0
- package/dist/{index-QGA4ayU7.js → index-ZBqiaKhx.js} +378 -378
- package/dist/index-ZwpjuB-N.cjs +206 -0
- package/dist/index-ecnGWzh9.cjs +1 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +5 -5
- package/dist/page-viewer-6UDraUKW.cjs +1 -0
- package/dist/{page-viewer-Cv_WZY-t.js → page-viewer-7u0SWWmO.js} +11 -11
- package/dist/project-general-setting-AW5Vtmgx.cjs +1 -0
- package/dist/{project-general-setting-x6qqF0T8.js → project-general-setting-SqC85J7F.js} +11 -10
- package/dist/{project-seo-setting-Sl6AE-Q7.js → project-seo-setting-TlQherop.js} +7 -7
- package/dist/project-seo-setting-cWiNZcxW.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +2 -2
- package/dist/{single-page-detail-sGbwXXs1.js → single-page-detail-ClZYIdSO.js} +43 -42
- package/dist/single-page-detail-kJUW6FE9.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +15 -2
- package/dist/studio.js +7 -7
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +4 -4
- package/dist/ui.js +50 -50
- package/dist/useAddBlockByDrop-E343zoB3.cjs +1 -0
- package/dist/useAddBlockByDrop-sPX4lN-O.js +20 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +4 -3
- package/package.json +1 -1
- package/dist/AddBlocks-FUKuRbn6.cjs +0 -1
- package/dist/BrandingOptions-tBWzqas5.cjs +0 -1
- package/dist/CurrentPage-g8aT56B2.cjs +0 -1
- package/dist/Layers-fEb6biiU.cjs +0 -1
- package/dist/MODIFIERS-2FeVfZQ9.cjs +0 -1
- package/dist/PagesPanel-ewHplHej.cjs +0 -1
- package/dist/ProjectPanel-pgpe3fyR.cjs +0 -1
- package/dist/Settings-zk2jUrHc.cjs +0 -1
- package/dist/SidePanels-MbJufIbe.js +0 -352
- package/dist/SidePanels-zXHw8T3P.cjs +0 -1
- package/dist/Topbar-iH2L4pe0.cjs +0 -1
- package/dist/Topbar-ryFhl-PC.js +0 -114
- package/dist/UploadImages-VBiO6lqp.cjs +0 -1
- package/dist/add-page-modal-myA0a2nW.cjs +0 -1
- package/dist/delete-page-modal-q4G_-zBl.cjs +0 -1
- package/dist/empty-slot-2LSrWJaY.cjs +0 -1
- package/dist/index-DT71IahS.cjs +0 -206
- package/dist/index-ERorPL9q.cjs +0 -1
- package/dist/page-viewer-z9Kn4i1K.cjs +0 -1
- package/dist/project-general-setting-ZiLidijs.cjs +0 -1
- package/dist/project-seo-setting-8oJUrOqk.cjs +0 -1
- package/dist/single-page-detail-cnwttu4D.cjs +0 -1
- package/dist/useAddBlockByDrop-LBgi6GL7.cjs +0 -1
- package/dist/useAddBlockByDrop-Y-g4O8UC.js +0 -20
|
@@ -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"),_=require("jotai"),u=require("lodash-es"),s=require("./index-T3wfa1kz.cjs"),R=require("lucide-react"),D=require("@chaibuilder/runtime"),f=require("react-i18next"),w=require("./index-gi1LIOCw.cjs"),K=require("./index-ZwpjuB-N.cjs"),S=require("./Functions-N3yhPYKY.cjs"),l=require("./MODIFIERS-9EwxLM8V.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("flat-to-nested");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");const I=({provider:t,onClose:a})=>{const{t:n}=f.useTranslation(),[o,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:[n("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(K.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(w.JsonView,{data:o,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 C({children:t,name:a,onRemove:n}){const{t:o}=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:o("remove_provider_confirmation").replace("{name}",a)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:o("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:o("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:n,className:"bg-red-600 hover:bg-red-700",children:o("remove")})]})]})]})}const P=()=>{const{t}=f.useTranslation(),a=i.useMemo(()=>D.getChaiDataProviders(),[]),[n,o]=s.usePageDataProviders(),[,h]=_.useAtom(s.pageSyncStateAtom),[m,c]=i.useState(u.filter(a,r=>u.map(n,"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]),o(j=>[...j,{providerKey:p.providerKey,args:{}}]),E(""),h("UNSAVED")},x=r=>{c(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),o(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","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"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(C,{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","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"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(I,{onClose:()=>d(null),provider:g})]})]})},O=()=>{const{t}=f.useTranslation(),a={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},n={"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(o=>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(o)}),e.jsxRuntimeExports.jsx("div",{children:t(a[o])})]}))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(n).map(o=>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(o)}),e.jsxRuntimeExports.jsx("div",{children:t(n[o])})]}))})]})})]})]})},L=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-5Q5w5lPJ.cjs"))),T=i.lazy(()=>Promise.resolve().then(()=>require("./Outline-uMUTwN-R.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-xrGQI1Kn.cjs"))),U=i.lazy(()=>Promise.resolve().then(()=>require("./index-T3wfa1kz.cjs")).then(t=>t.ImagesPanel));let k=null;const B=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),a=s.useBuilderProp("sideBarComponents.bottom",[]),[n,o]=_.useAtom(s.activePanelAtom),[h,m]=i.useState(n),[c,b]=i.useState(null),{t:E}=f.useTranslation(),g={"add-blocks":L,[l.OUTLINE_KEY]:T,"branding-options":A,images:U};u.each(t,({name:x,panel:v})=>{g[x]=v});const d=x=>{clearTimeout(k),n!==l.OUTLINE_KEY&&x===l.OUTLINE_KEY?k=setTimeout(()=>o(l.OUTLINE_KEY),500):m(x),o(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:[n!==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:n==="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:n===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:n==="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:n===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(O,{}),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,{})})))]})]}),e.jsxRuntimeExports.jsx("div",{className:`absolute left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${n!==l.OUTLINE_KEY?"translate-x-0":"-translate-x-full"}`,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:S.cn("relative h-full max-h-[93%] overflow-y-auto overflow-x-hidden bg-background p-1",n===l.OUTLINE_KEY?"":"z-[100]"),onMouseEnter:()=>{c&&clearTimeout(c)},children:i.createElement(u.get(g,n,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),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=B;
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import { KeyboardIcon as U, PlusIcon as J, Half2Icon as q } from "@radix-ui/react-icons";
|
|
3
|
+
import j, { useState as p, useEffect as Y, useMemo as Z, lazy as w, Suspense as y } from "react";
|
|
4
|
+
import { useAtom as M } from "jotai";
|
|
5
|
+
import { filter as N, map as K, isNull as $, find as G, isEmpty as Q, each as W, get as X } from "lodash-es";
|
|
6
|
+
import { ad as H, ae as F, af as L, ag as R, ah as ee, A as se, a as re, b as le, c as ae, d as ie, e as te, f as oe, g as ne, ai as ce, y as de, C as me, aj as xe, ak as pe, al as he, am as ue, an as E, ao as fe, ap as je, aq as ve, B as v, ar as ge, as as B, h as T, at as be, S as z, au as V, av as O, aw as S, ax as _ } from "./index-ZBqiaKhx.js";
|
|
7
|
+
import { ListTreeIcon as A, DatabaseIcon as ye } from "lucide-react";
|
|
8
|
+
import { getChaiDataProviders as Ne } from "@chaibuilder/runtime";
|
|
9
|
+
import { useTranslation as g } from "react-i18next";
|
|
10
|
+
import { J as we, a as ke, d as Ce } from "./index-e0c8PmRQ.js";
|
|
11
|
+
import { E as De } from "./index-LF3KXx4u.js";
|
|
12
|
+
import { c as Te } from "./Functions-7jnEwJyw.js";
|
|
13
|
+
import { O as i } from "./MODIFIERS-WQdaNvb8.js";
|
|
14
|
+
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
15
|
+
import "flat-to-nested";
|
|
16
|
+
import "@react-hookz/web";
|
|
17
|
+
import "@radix-ui/react-toggle";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "./Class-3k8xjeiM.js";
|
|
20
|
+
import "clsx";
|
|
21
|
+
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
|
+
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
|
+
import "@radix-ui/react-toast";
|
|
38
|
+
import "cmdk";
|
|
39
|
+
import "@radix-ui/react-context-menu";
|
|
40
|
+
import "react-icons-picker";
|
|
41
|
+
import "react-dom";
|
|
42
|
+
import "react-quill";
|
|
43
|
+
import "i18next";
|
|
44
|
+
import "@floating-ui/react-dom";
|
|
45
|
+
import "react-textarea-autosize";
|
|
46
|
+
import "flagged";
|
|
47
|
+
import "react-dnd";
|
|
48
|
+
import "@minoru/react-dnd-treeview";
|
|
49
|
+
import "react-hotkeys-hook";
|
|
50
|
+
const Se = ({ provider: s, onClose: o }) => {
|
|
51
|
+
const { t: l } = g(), [a, h] = p(null);
|
|
52
|
+
return Y(() => {
|
|
53
|
+
s && (s.mockFn ? s.mockFn : s.dataFn)().then((n) => h(n));
|
|
54
|
+
}, [s]), s ? /* @__PURE__ */ e.jsx(H, { onOpenChange: (d) => d ? "" : o(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(F, { children: [
|
|
55
|
+
/* @__PURE__ */ e.jsxs(L, { children: [
|
|
56
|
+
/* @__PURE__ */ e.jsxs(R, { children: [
|
|
57
|
+
l("data_provider"),
|
|
58
|
+
": ",
|
|
59
|
+
s.name
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ e.jsx(ee, { children: s.description })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ e.jsx(De, { children: /* @__PURE__ */ e.jsx(
|
|
64
|
+
we,
|
|
65
|
+
{
|
|
66
|
+
data: a,
|
|
67
|
+
shouldExpandNode: ke,
|
|
68
|
+
style: {
|
|
69
|
+
...Ce,
|
|
70
|
+
container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
|
|
71
|
+
stringValue: "text-orange-600",
|
|
72
|
+
label: "text-green-900 font-semibold pr-1 tracking-wider"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
) })
|
|
76
|
+
] }) }) : null;
|
|
77
|
+
};
|
|
78
|
+
function _e({
|
|
79
|
+
children: s,
|
|
80
|
+
name: o,
|
|
81
|
+
onRemove: l
|
|
82
|
+
}) {
|
|
83
|
+
const { t: a } = g();
|
|
84
|
+
return /* @__PURE__ */ e.jsxs(se, { children: [
|
|
85
|
+
/* @__PURE__ */ e.jsx(re, { asChild: !0, children: s }),
|
|
86
|
+
/* @__PURE__ */ e.jsxs(le, { children: [
|
|
87
|
+
/* @__PURE__ */ e.jsxs(ae, { children: [
|
|
88
|
+
/* @__PURE__ */ e.jsx(
|
|
89
|
+
ie,
|
|
90
|
+
{
|
|
91
|
+
dangerouslySetInnerHTML: { __html: a("remove_provider_confirmation").replace("{name}", o) }
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ e.jsx(te, { children: a("remove_provider_warning") })
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ e.jsxs(oe, { children: [
|
|
97
|
+
/* @__PURE__ */ e.jsx(ne, { children: a("cancel") }),
|
|
98
|
+
/* @__PURE__ */ e.jsx(ce, { onClick: l, className: "bg-red-600 hover:bg-red-700", children: a("remove") })
|
|
99
|
+
] })
|
|
100
|
+
] })
|
|
101
|
+
] });
|
|
102
|
+
}
|
|
103
|
+
const Ae = () => {
|
|
104
|
+
const { t: s } = g(), o = Z(() => Ne(), []), [l, a] = de(), [, h] = M(me), [d, n] = p(
|
|
105
|
+
N(o, (r) => K(l, "providerKey").includes(r.providerKey))
|
|
106
|
+
), [k, u] = p(""), [b, c] = p(null), C = N(
|
|
107
|
+
o.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
|
|
108
|
+
(r) => !$(r)
|
|
109
|
+
), D = (r) => {
|
|
110
|
+
const x = G(o, { providerKey: r });
|
|
111
|
+
n((m) => [...m, x]), a((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""), h("UNSAVED");
|
|
112
|
+
}, t = (r) => {
|
|
113
|
+
n((x) => N(x, (m) => m.providerKey !== r.providerKey)), a((x) => N(x, (m) => m.providerKey !== r.providerKey)), h("UNSAVED");
|
|
114
|
+
}, f = (r) => c(r);
|
|
115
|
+
return Q(o) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
116
|
+
s("no_data_providers"),
|
|
117
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
118
|
+
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: s("learn_more") })
|
|
119
|
+
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
120
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
121
|
+
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
|
|
122
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(xe, { value: k, onValueChange: (r) => D(r), children: [
|
|
123
|
+
/* @__PURE__ */ e.jsx(pe, { className: "w-full", children: /* @__PURE__ */ e.jsx(he, { placeholder: s("select_provider") }) }),
|
|
124
|
+
/* @__PURE__ */ e.jsxs(ue, { children: [
|
|
125
|
+
/* @__PURE__ */ e.jsx(E, { value: "", children: s("choose") }),
|
|
126
|
+
C.map((r) => /* @__PURE__ */ e.jsx(E, { value: r.value, children: r.label }, r.value))
|
|
127
|
+
] })
|
|
128
|
+
] }) }),
|
|
129
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
130
|
+
/* @__PURE__ */ e.jsxs("div", { className: `border-t ${d.length ? "block" : "hidden"}`, children: [
|
|
131
|
+
/* @__PURE__ */ e.jsxs("p", { className: "flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500", children: [
|
|
132
|
+
s("page_data_providers"),
|
|
133
|
+
":"
|
|
134
|
+
] }),
|
|
135
|
+
/* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: d.map((r) => /* @__PURE__ */ e.jsxs(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
className: "w-full rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
139
|
+
"data-v0-t": "card",
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
142
|
+
/* @__PURE__ */ e.jsx("h3", { className: "font-medium leading-4", children: r.name }),
|
|
143
|
+
/* @__PURE__ */ e.jsx("p", { className: "pt-1 text-xs text-gray-400", children: r.description })
|
|
144
|
+
] }) }) }),
|
|
145
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
|
|
146
|
+
/* @__PURE__ */ e.jsxs(
|
|
147
|
+
"button",
|
|
148
|
+
{
|
|
149
|
+
onClick: () => f(r),
|
|
150
|
+
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",
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ e.jsxs(
|
|
153
|
+
"svg",
|
|
154
|
+
{
|
|
155
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
156
|
+
width: "24",
|
|
157
|
+
height: "24",
|
|
158
|
+
viewBox: "0 0 24 24",
|
|
159
|
+
fill: "none",
|
|
160
|
+
stroke: "currentColor",
|
|
161
|
+
"stroke-width": "2",
|
|
162
|
+
"stroke-linecap": "round",
|
|
163
|
+
"stroke-linejoin": "round",
|
|
164
|
+
className: "mr-2 h-4 w-4",
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ e.jsx("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
|
|
167
|
+
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
s("view_data")
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__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: [
|
|
176
|
+
/* @__PURE__ */ e.jsxs(
|
|
177
|
+
"svg",
|
|
178
|
+
{
|
|
179
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
180
|
+
width: "24",
|
|
181
|
+
height: "24",
|
|
182
|
+
viewBox: "0 0 24 24",
|
|
183
|
+
fill: "none",
|
|
184
|
+
stroke: "currentColor",
|
|
185
|
+
"stroke-width": "2",
|
|
186
|
+
"stroke-linecap": "round",
|
|
187
|
+
"stroke-linejoin": "round",
|
|
188
|
+
className: "mr-2 h-4 w-4",
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ e.jsx("path", { d: "M3 6h18" }),
|
|
191
|
+
/* @__PURE__ */ e.jsx("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
192
|
+
/* @__PURE__ */ e.jsx("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" })
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
s("remove")
|
|
197
|
+
] }) })
|
|
198
|
+
] })
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
r.providerKey
|
|
202
|
+
)) }),
|
|
203
|
+
/* @__PURE__ */ e.jsx(Se, { onClose: () => c(null), provider: b })
|
|
204
|
+
] })
|
|
205
|
+
] });
|
|
206
|
+
}, Pe = () => {
|
|
207
|
+
const { t: s } = g(), o = {
|
|
208
|
+
"ctrl + Z": "Undo",
|
|
209
|
+
"ctrl + Y": "Redo",
|
|
210
|
+
"ctrl + D": "Duplicate"
|
|
211
|
+
}, l = {
|
|
212
|
+
// "ctrl + /": "Rename block",
|
|
213
|
+
"ctrl + S": "Save page",
|
|
214
|
+
esc: "Deselect blocks",
|
|
215
|
+
del: "Delete block"
|
|
216
|
+
};
|
|
217
|
+
return /* @__PURE__ */ e.jsxs(H, { children: [
|
|
218
|
+
/* @__PURE__ */ e.jsx(fe, { children: /* @__PURE__ */ e.jsxs(je, { children: [
|
|
219
|
+
/* @__PURE__ */ e.jsx(ve, { children: /* @__PURE__ */ e.jsx(v, { size: "sm", className: "w-10", variant: "outline", children: /* @__PURE__ */ e.jsx(U, {}) }) }),
|
|
220
|
+
/* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
|
|
221
|
+
] }) }),
|
|
222
|
+
/* @__PURE__ */ e.jsxs(F, { className: "sm:max-w-[525px]", children: [
|
|
223
|
+
/* @__PURE__ */ e.jsx(L, { children: /* @__PURE__ */ e.jsx(R, { children: s("Keyboard shortcuts") }) }),
|
|
224
|
+
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2", children: [
|
|
225
|
+
/* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(o).map((a) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
226
|
+
/* @__PURE__ */ e.jsx(B, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(a) }),
|
|
227
|
+
/* @__PURE__ */ e.jsx("div", { children: s(o[a]) })
|
|
228
|
+
] })) }),
|
|
229
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(l).map((a) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
230
|
+
/* @__PURE__ */ e.jsx(B, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(a) }),
|
|
231
|
+
/* @__PURE__ */ e.jsx("div", { children: s(l[a]) })
|
|
232
|
+
] })) })
|
|
233
|
+
] }) })
|
|
234
|
+
] })
|
|
235
|
+
] });
|
|
236
|
+
}, Ke = w(() => import("./AddBlocks-uCdu9Xpr.js")), P = w(() => import("./Outline-oGoAdnBw.js")), Ee = w(() => import("./BrandingOptions-JbHRN7V5.js")), Be = w(() => import("./index-ZBqiaKhx.js").then((s) => s.cq));
|
|
237
|
+
let I = null;
|
|
238
|
+
const As = () => {
|
|
239
|
+
const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [l, a] = M(be), [h, d] = p(l), [n, k] = p(null), { t: u } = g(), b = {
|
|
240
|
+
"add-blocks": Ke,
|
|
241
|
+
[i]: P,
|
|
242
|
+
"branding-options": Ee,
|
|
243
|
+
images: Be
|
|
244
|
+
};
|
|
245
|
+
W(s, ({ name: t, panel: f }) => {
|
|
246
|
+
b[t] = f;
|
|
247
|
+
});
|
|
248
|
+
const c = (t) => {
|
|
249
|
+
clearTimeout(I), l !== i && t === i ? I = setTimeout(() => a(i), 500) : d(t), a(t);
|
|
250
|
+
}, C = T("dataBindingSupport", !1);
|
|
251
|
+
function D() {
|
|
252
|
+
const t = setTimeout(() => {
|
|
253
|
+
n && (c(i), clearTimeout(n));
|
|
254
|
+
}, 500);
|
|
255
|
+
k(t);
|
|
256
|
+
}
|
|
257
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
258
|
+
l !== i ? /* @__PURE__ */ e.jsx(
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
onMouseEnter: D,
|
|
262
|
+
onClick: () => c(i),
|
|
263
|
+
className: "fixed inset-0 z-[50] bg-black/20"
|
|
264
|
+
}
|
|
265
|
+
) : null,
|
|
266
|
+
/* @__PURE__ */ e.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: [
|
|
267
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: [
|
|
268
|
+
/* @__PURE__ */ e.jsx(
|
|
269
|
+
v,
|
|
270
|
+
{
|
|
271
|
+
onClick: () => {
|
|
272
|
+
c("add-blocks");
|
|
273
|
+
},
|
|
274
|
+
size: "sm",
|
|
275
|
+
variant: l === "add-blocks" ? "default" : "outline",
|
|
276
|
+
children: /* @__PURE__ */ e.jsx(J, { className: "text-xl" })
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ e.jsx(
|
|
280
|
+
v,
|
|
281
|
+
{
|
|
282
|
+
onClick: () => c(i),
|
|
283
|
+
size: "sm",
|
|
284
|
+
variant: l === i ? "default" : "outline",
|
|
285
|
+
children: /* @__PURE__ */ e.jsx(A, { className: "w-4" })
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
/* @__PURE__ */ e.jsx(
|
|
289
|
+
v,
|
|
290
|
+
{
|
|
291
|
+
onClick: () => c("branding-options"),
|
|
292
|
+
size: "sm",
|
|
293
|
+
variant: l === "branding-options" ? "default" : "outline",
|
|
294
|
+
children: /* @__PURE__ */ e.jsx(q, { className: "w-4 max-w-[40px] text-xs" })
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
j.Children.toArray(
|
|
298
|
+
s.map(({ name: t, icon: f }) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
299
|
+
v,
|
|
300
|
+
{
|
|
301
|
+
onClick: () => c(t),
|
|
302
|
+
size: "sm",
|
|
303
|
+
className: "w-10",
|
|
304
|
+
variant: l === t ? "default" : "outline",
|
|
305
|
+
children: /* @__PURE__ */ e.jsx(f, {})
|
|
306
|
+
}
|
|
307
|
+
) }))
|
|
308
|
+
)
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
|
|
311
|
+
/* @__PURE__ */ e.jsx(Pe, {}),
|
|
312
|
+
j.Children.toArray(
|
|
313
|
+
o.map((t) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
|
|
314
|
+
)
|
|
315
|
+
] })
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ e.jsx(
|
|
318
|
+
"div",
|
|
319
|
+
{
|
|
320
|
+
className: `absolute left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${l !== i ? "translate-x-0" : "-translate-x-full"}`,
|
|
321
|
+
children: /* @__PURE__ */ e.jsx(
|
|
322
|
+
y,
|
|
323
|
+
{
|
|
324
|
+
fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
|
|
325
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
|
|
326
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
327
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
328
|
+
] }),
|
|
329
|
+
children: /* @__PURE__ */ e.jsx(
|
|
330
|
+
"div",
|
|
331
|
+
{
|
|
332
|
+
className: Te(
|
|
333
|
+
"relative h-full max-h-[93%] overflow-y-auto overflow-x-hidden bg-background p-1",
|
|
334
|
+
l === i ? "" : "z-[100]"
|
|
335
|
+
),
|
|
336
|
+
onMouseEnter: () => {
|
|
337
|
+
n && clearTimeout(n);
|
|
338
|
+
},
|
|
339
|
+
children: j.createElement(X(b, l, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
),
|
|
346
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
|
|
347
|
+
y,
|
|
348
|
+
{
|
|
349
|
+
fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
|
|
350
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
|
|
351
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
352
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
353
|
+
] }),
|
|
354
|
+
children: C ? /* @__PURE__ */ e.jsxs(V, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
|
|
355
|
+
/* @__PURE__ */ e.jsxs(O, { className: "mx-1 grid h-10 grid-cols-2", children: [
|
|
356
|
+
/* @__PURE__ */ e.jsxs(S, { value: i, children: [
|
|
357
|
+
/* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
|
|
358
|
+
" ",
|
|
359
|
+
u("Outline")
|
|
360
|
+
] }),
|
|
361
|
+
/* @__PURE__ */ e.jsxs(S, { value: "data-provider", children: [
|
|
362
|
+
/* @__PURE__ */ e.jsx(ye, { className: "mr-2 w-3" }),
|
|
363
|
+
u("Data")
|
|
364
|
+
] })
|
|
365
|
+
] }),
|
|
366
|
+
/* @__PURE__ */ e.jsx(_, { value: i, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: j.createElement(P) }),
|
|
367
|
+
/* @__PURE__ */ e.jsx(_, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(Ae, {}) })
|
|
368
|
+
] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(V, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
|
|
369
|
+
/* @__PURE__ */ e.jsx(O, { className: "mx-1 grid h-10 grid-cols-1", children: /* @__PURE__ */ e.jsxs(S, { value: i, children: [
|
|
370
|
+
/* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
|
|
371
|
+
" ",
|
|
372
|
+
u("Outline")
|
|
373
|
+
] }) }),
|
|
374
|
+
/* @__PURE__ */ e.jsx(
|
|
375
|
+
_,
|
|
376
|
+
{
|
|
377
|
+
value: i,
|
|
378
|
+
className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",
|
|
379
|
+
children: j.createElement(P)
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
] }) })
|
|
383
|
+
}
|
|
384
|
+
) })
|
|
385
|
+
] });
|
|
386
|
+
};
|
|
387
|
+
export {
|
|
388
|
+
As as default
|
|
389
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { j as c } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import z, { useMemo as V, Suspense as n } from "react";
|
|
3
|
+
import { FontFamilyIcon as o, EyeOpenIcon as M } from "@radix-ui/react-icons";
|
|
4
|
+
import { h as s, aj as u, ak as d, al as C, am as L, ay as m, az as p, an as i, z as F, B as g, q as w, S as v, aA as B } from "./index-ZBqiaKhx.js";
|
|
5
|
+
import { G as f } from "./index-YpnaudSM.js";
|
|
6
|
+
import { useTranslation as e } from "react-i18next";
|
|
7
|
+
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
|
+
import "lodash-es";
|
|
9
|
+
import "./Functions-7jnEwJyw.js";
|
|
10
|
+
import "clsx";
|
|
11
|
+
import "tailwind-merge";
|
|
12
|
+
import "@chaibuilder/runtime";
|
|
13
|
+
import "jotai";
|
|
14
|
+
import "flat-to-nested";
|
|
15
|
+
import "./MODIFIERS-WQdaNvb8.js";
|
|
16
|
+
import "@react-hookz/web";
|
|
17
|
+
import "@radix-ui/react-toggle";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "./Class-3k8xjeiM.js";
|
|
20
|
+
import "@radix-ui/react-switch";
|
|
21
|
+
import "@radix-ui/react-slot";
|
|
22
|
+
import "@radix-ui/react-accordion";
|
|
23
|
+
import "@radix-ui/react-alert-dialog";
|
|
24
|
+
import "@radix-ui/react-dialog";
|
|
25
|
+
import "@radix-ui/react-label";
|
|
26
|
+
import "@radix-ui/react-scroll-area";
|
|
27
|
+
import "@radix-ui/react-tabs";
|
|
28
|
+
import "@radix-ui/react-tooltip";
|
|
29
|
+
import "@radix-ui/react-popover";
|
|
30
|
+
import "@radix-ui/react-menubar";
|
|
31
|
+
import "@radix-ui/react-hover-card";
|
|
32
|
+
import "@radix-ui/react-select";
|
|
33
|
+
import "@radix-ui/react-dropdown-menu";
|
|
34
|
+
import "@radix-ui/react-separator";
|
|
35
|
+
import "@radix-ui/react-toast";
|
|
36
|
+
import "cmdk";
|
|
37
|
+
import "@radix-ui/react-context-menu";
|
|
38
|
+
import "react-icons-picker";
|
|
39
|
+
import "react-dom";
|
|
40
|
+
import "react-quill";
|
|
41
|
+
const x = () => s("languages", ["en"]), S = () => x().length === 1 ? null : /* @__PURE__ */ c.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ c.jsxs(u, { children: [
|
|
42
|
+
/* @__PURE__ */ c.jsx(d, { className: "w-[150px] border-0", children: /* @__PURE__ */ c.jsx(
|
|
43
|
+
C,
|
|
44
|
+
{
|
|
45
|
+
placeholder: /* @__PURE__ */ c.jsxs("span", { className: "flex items-center", children: [
|
|
46
|
+
/* @__PURE__ */ c.jsx(o, { className: "h-4 w-4" }),
|
|
47
|
+
" English(US)"
|
|
48
|
+
] })
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
/* @__PURE__ */ c.jsx(L, { children: /* @__PURE__ */ c.jsxs(m, { children: [
|
|
52
|
+
/* @__PURE__ */ c.jsx(p, { children: "Fruits" }),
|
|
53
|
+
/* @__PURE__ */ c.jsx(i, { value: "apple", children: "Apple" }),
|
|
54
|
+
/* @__PURE__ */ c.jsx(i, { value: "banana", children: "Banana" }),
|
|
55
|
+
/* @__PURE__ */ c.jsx(i, { value: "blueberry", children: "Blueberry" }),
|
|
56
|
+
/* @__PURE__ */ c.jsx(i, { value: "grapes", children: "Grapes" }),
|
|
57
|
+
/* @__PURE__ */ c.jsx(i, { value: "pineapple", children: "Pineapple" })
|
|
58
|
+
] }) })
|
|
59
|
+
] }) });
|
|
60
|
+
function A(l) {
|
|
61
|
+
return f({ 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);
|
|
62
|
+
}
|
|
63
|
+
const R = () => {
|
|
64
|
+
const { savePage: l, syncState: t } = F(), { t: r } = e(), h = V(() => {
|
|
65
|
+
switch (t) {
|
|
66
|
+
case "SAVING":
|
|
67
|
+
return "animate-pulse bg-gray-300 text-gray-900";
|
|
68
|
+
case "SAVED":
|
|
69
|
+
return "bg-green-500 text-white hover:bg-green-600 hover:text-white";
|
|
70
|
+
default:
|
|
71
|
+
return "bg-gray-200 text-gray-500 hover:bg-gray-100";
|
|
72
|
+
}
|
|
73
|
+
}, [t]), a = /* @__PURE__ */ c.jsxs(
|
|
74
|
+
g,
|
|
75
|
+
{
|
|
76
|
+
disabled: t === "SAVING",
|
|
77
|
+
onClick: (H) => {
|
|
78
|
+
H.preventDefault(), l();
|
|
79
|
+
},
|
|
80
|
+
className: `flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${h}`,
|
|
81
|
+
size: "sm",
|
|
82
|
+
variant: "outline",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ c.jsx(A, { className: "text-lg" }),
|
|
85
|
+
/* @__PURE__ */ c.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : r(t === "SAVED" ? "Saved" : "Unsaved") })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
return /* @__PURE__ */ c.jsx("div", { className: "flex items-center", children: a });
|
|
90
|
+
}, k = function() {
|
|
91
|
+
const t = s("previewComponent"), [, r] = w(), { t: h } = e();
|
|
92
|
+
return t ? /* @__PURE__ */ c.jsxs(
|
|
93
|
+
g,
|
|
94
|
+
{
|
|
95
|
+
onClick: (a) => {
|
|
96
|
+
a.preventDefault(), r(!0);
|
|
97
|
+
},
|
|
98
|
+
className: "flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",
|
|
99
|
+
size: "sm",
|
|
100
|
+
variant: "outline",
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ c.jsx(M, { className: "text-xs" }),
|
|
103
|
+
/* @__PURE__ */ c.jsx("span", { className: "text-sm", children: h("Preview") })
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
) : null;
|
|
107
|
+
}, d1 = () => {
|
|
108
|
+
const l = s("topBarComponents.left", []), t = s("topBarComponents.center", []), r = s("topBarComponents.right", []), h = s("editable", !0);
|
|
109
|
+
return /* @__PURE__ */ c.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
110
|
+
/* @__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(
|
|
111
|
+
l.map((a) => /* @__PURE__ */ c.jsx(n, { fallback: /* @__PURE__ */ c.jsx(v, { className: "h-10" }), children: /* @__PURE__ */ c.jsx(a, {}) }))
|
|
112
|
+
) }) }),
|
|
113
|
+
/* @__PURE__ */ c.jsx("div", { className: "flex items-center space-x-2", children: z.Children.toArray(
|
|
114
|
+
t.map((a) => /* @__PURE__ */ c.jsx(n, { fallback: /* @__PURE__ */ c.jsx(v, { className: "h-10" }), children: /* @__PURE__ */ c.jsx(a, {}) }))
|
|
115
|
+
) }),
|
|
116
|
+
/* @__PURE__ */ c.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
117
|
+
/* @__PURE__ */ c.jsx(S, {}),
|
|
118
|
+
/* @__PURE__ */ c.jsx(k, {}),
|
|
119
|
+
/* @__PURE__ */ c.jsx(B, { orientation: "vertical" }),
|
|
120
|
+
h ? /* @__PURE__ */ c.jsx(R, {}) : null,
|
|
121
|
+
z.Children.toArray(
|
|
122
|
+
r.map((a) => /* @__PURE__ */ c.jsx(n, { fallback: /* @__PURE__ */ c.jsx(v, { className: "h-10" }), children: /* @__PURE__ */ c.jsx(a, {}) }))
|
|
123
|
+
)
|
|
124
|
+
] })
|
|
125
|
+
] });
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
d1 as default
|
|
129
|
+
};
|
|
@@ -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-T3wfa1kz.cjs"),z=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("flat-to-nested");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");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 v=()=>t.useBuilderProp("languages",["en"]),g=()=>v().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 H(l){return z.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 V=()=>{const{savePage:l,syncState:a}=t.useSavePage(),{t:s}=i.useTranslation(),e=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]),n=c.jsxRuntimeExports.jsxs(t.Button,{disabled:a==="SAVING",onClick:o=>{o.preventDefault(),l()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${e}`,size:"sm",variant:"outline",children:[c.jsxRuntimeExports.jsx(H,{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:n})},M=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},u=()=>{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(g,{}),c.jsxRuntimeExports.jsx(M,{}),c.jsxRuntimeExports.jsx(t.Separator,{orientation:"vertical"}),e?c.jsxRuntimeExports.jsx(V,{}):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=u;
|
|
@@ -1 +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-
|
|
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-T3wfa1kz.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("flat-to-nested");require("./MODIFIERS-9EwxLM8V.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");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("react-i18next");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;
|