@chaibuilder/sdk 1.2.10 → 1.2.12
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 +10 -12
- package/dist/AddBlocks-ByeMUUzE.js +218 -0
- package/dist/AddBlocks-nMUkm4og.cjs +1 -0
- package/dist/{BrandingOptions-10jJO8mG.js → BrandingOptions--poS5shs.js} +18 -21
- package/dist/BrandingOptions-eeDfvB0R.cjs +1 -0
- package/dist/{CanvasArea-jgBDM5Qd.js → CanvasArea--TKubnIM.js} +184 -185
- package/dist/{CanvasArea-6O8dMPug.cjs → CanvasArea-h4lA4oqP.cjs} +4 -4
- package/dist/{utils-AvyFzbPC.js → Class-17XFhL48.js} +15 -16
- package/dist/Class-5ARpH_Tu.cjs +1 -0
- package/dist/CurrentPage-B3YumhrX.cjs +1 -0
- package/dist/{CurrentPage-lakeZviD.js → CurrentPage-Gw9LJ40j.js} +24 -25
- package/dist/Layers-4r_4F6ST.cjs +1 -0
- package/dist/{Layers-R7TfREUd.js → Layers-d-xge4On.js} +77 -78
- package/dist/{PagesPanel-4mqxCFHq.js → PagesPanel-E4wSgVcE.js} +14 -15
- package/dist/PagesPanel-iZLDBwXQ.cjs +1 -0
- package/dist/ProjectPanel-2TcqGnfN.cjs +1 -0
- package/dist/{ProjectPanel-Wy2nw-1w.js → ProjectPanel-q7upaf7h.js} +17 -18
- package/dist/Settings-NuDNH2dR.cjs +1 -0
- package/dist/{Settings-_K28Ontt.js → Settings-y3DHsT88.js} +163 -164
- package/dist/SidePanels-91l1CjYv.cjs +1 -0
- package/dist/{SidePanels-6slnxdSj.js → SidePanels-BK_QnEh9.js} +40 -41
- package/dist/{Topbar-bwt6HjlL.js → Topbar-b7jnOD57.js} +16 -17
- package/dist/Topbar-rEO5z57t.cjs +1 -0
- package/dist/{UnsplashImages-V29UE-57.js → UnsplashImages-Lb78FYx7.js} +27 -28
- package/dist/UnsplashImages-p-WdKs3b.cjs +1 -0
- package/dist/{UploadImages-E0mi_qn8.js → UploadImages-aWG_1r7N.js} +23 -24
- package/dist/UploadImages-zk-IYDx8.cjs +1 -0
- package/dist/{add-page-modal-FJEAqfD3.js → add-page-modal-7djj9GZj.js} +28 -29
- package/dist/add-page-modal-iUffBbAe.cjs +1 -0
- package/dist/{confirm-alert-5hfE116f.js → confirm-alert-QuqMrpWn.js} +12 -13
- package/dist/confirm-alert-i3FRAgP4.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +9 -50
- package/dist/core.js +47 -56
- package/dist/defaultTheme-IH19g4fv.cjs +1 -0
- package/dist/defaultTheme-YY8mlQS3.js +1055 -0
- package/dist/{delete-page-modal-wH0yLiQI.js → delete-page-modal-DEBiprds.js} +14 -15
- package/dist/delete-page-modal-RllDrgxs.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +100 -81
- package/dist/email.cjs +1 -0
- package/dist/email.d.ts +116 -0
- package/dist/email.js +79 -0
- package/dist/{controls-XPXGHKht.js → empty-slot-MWycClTb.js} +61 -50
- package/dist/empty-slot-TF2kd-0X.cjs +1 -0
- package/dist/{form-UVHCD9N3.js → form-94xR0NG8.js} +1 -1
- package/dist/{form-1j01gADS.cjs → form-yz7h2msc.cjs} +1 -1
- package/dist/{index-B4sL0YTN.js → index-0m8Zuv5X.js} +1434 -1552
- package/dist/{index-c2VLKuhY.js → index-19nTm_cE.js} +2069 -2059
- package/dist/index-TEfD-2ti.cjs +1 -0
- package/dist/{index-xbQL0wpz.cjs → index-XVud0HL8.cjs} +33 -33
- package/dist/lib.cjs +3 -3
- package/dist/lib.js +95 -1125
- package/dist/page-viewer-_ktv1pgX.cjs +1 -0
- package/dist/{page-viewer-TcK0I240.js → page-viewer-xPLhXv6k.js} +16 -17
- package/dist/{project-general-setting-4ruKl033.js → project-general-setting-XlORLtqJ.js} +15 -16
- package/dist/project-general-setting-nULU3Tzw.cjs +1 -0
- package/dist/project-seo-setting-9QkARPhg.cjs +1 -0
- package/dist/{project-seo-setting-d1EZlacB.js → project-seo-setting-KQkeHwny.js} +14 -15
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +2 -0
- package/dist/render.js +111 -70
- package/dist/single-page-detail-Gb6O3Yyw.cjs +1 -0
- package/dist/{single-page-detail-PihQi-dP.js → single-page-detail-gtVN9hxR.js} +44 -45
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +13 -14
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +138 -139
- package/dist/{useAddBlockByDrop-nLzs79He.cjs → useAddBlockByDrop-GU5QLPtz.cjs} +1 -1
- package/dist/{useAddBlockByDrop-rcDR-z9_.js → useAddBlockByDrop-b5KJh_7w.js} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +313 -322
- package/package.json +8 -2
- package/dist/AddBlocks-GiMnBMeQ.js +0 -224
- package/dist/AddBlocks-SzURo9Bj.cjs +0 -1
- package/dist/BrandingOptions-yK-54R-c.cjs +0 -1
- package/dist/CurrentPage-1y62Ne77.cjs +0 -1
- package/dist/Layers-Z4nmm9xK.cjs +0 -1
- package/dist/PagesPanel-ouHdxyOH.cjs +0 -1
- package/dist/ProjectPanel-hHolYZjt.cjs +0 -1
- package/dist/Settings-EYOw02iE.cjs +0 -1
- package/dist/SidePanels-U-_O1QN8.cjs +0 -1
- package/dist/Topbar-dQEoY2P8.cjs +0 -1
- package/dist/UnsplashImages-pGgaUPQy.cjs +0 -1
- package/dist/UploadImages-7oLycdSh.cjs +0 -1
- package/dist/add-page-modal-In6XI-vZ.cjs +0 -1
- package/dist/confirm-alert-Vwd3OzL9.cjs +0 -1
- package/dist/controls-Dy1qa8Dc.cjs +0 -1
- package/dist/delete-page-modal-tl7FLK9J.cjs +0 -1
- package/dist/functions-Ox_svtKm.cjs +0 -1
- package/dist/functions-xIebp8Aw.js +0 -23
- package/dist/index-7ogwGh39.cjs +0 -1
- package/dist/page-viewer-SfQUe0SI.cjs +0 -1
- package/dist/project-general-setting-t7E2Y_w9.cjs +0 -1
- package/dist/project-seo-setting-4b_BJZDF.cjs +0 -1
- package/dist/single-page-detail-KuXd9Mur.cjs +0 -1
- package/dist/utils-PTxFk6qT.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("@radix-ui/react-icons"),i=require("react"),k=require("jotai"),a=require("lodash-es"),s=require("./index-TEfD-2ti.cjs"),g=require("lucide-react"),C=require("@chaibuilder/runtime"),q=require("react-i18next"),b=require("./index-gi1LIOCw.cjs"),P=require("./index-XVud0HL8.cjs"),T=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.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");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("./web-blocks.cjs");require("./empty-slot-TF2kd-0X.cjs");const D=({provider:t,onClose:x})=>{const{t:n}=q.useTranslation(),[l,p]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(u=>p(u))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:c=>c?"":x(),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(P.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(b.JsonView,{data:l,shouldExpandNode:b.allExpanded,style:{...b.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function A({children:t,name:x,onRemove:n}){const{t:l}=q.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:l("remove_provider_confirmation").replace("{name}",x)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:n,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const _=()=>{const{t}=q.useTranslation(),x=i.useMemo(()=>C.getChaiDataProviders(),[]),[n,l]=s.usePageDataProviders(),[,p]=k.useAtom(s.pageSyncStateAtom),[c,u]=i.useState(a.filter(x,r=>a.map(n,"providerKey").includes(r.providerKey))),[E,v]=i.useState(""),[d,f]=i.useState(null),R=a.filter(x.map(r=>a.map(c,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!a.isNull(r)),o=r=>{const j=a.find(x,{providerKey:r});u(m=>[...m,j]),l(m=>[...m,{providerKey:j.providerKey,args:{}}]),v(""),p("UNSAVED")},h=r=>{u(j=>a.filter(j,m=>m.providerKey!==r.providerKey)),l(j=>a.filter(j,m=>m.providerKey!==r.providerKey)),p("UNSAVED")},S=r=>f(r);return a.isEmpty(x)?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:E,onValueChange:r=>o(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")}),R.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 ${c.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:c.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:()=>S(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(A,{onRemove:()=>h(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(D,{onClose:()=>f(null),provider:d})]})]})},B=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-nMUkm4og.cjs"))),y=i.lazy(()=>Promise.resolve().then(()=>require("./Layers-4r_4F6ST.cjs"))),z=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-eeDfvB0R.cjs"))),I=i.lazy(()=>Promise.resolve().then(()=>require("./index-TEfD-2ti.cjs")).then(t=>t.ImagesPanel));let N=null;const K=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[n,l]=k.useAtom(s.activePanelAtom),[p,c]=i.useState(n),[u,E]=i.useState(null),v={"add-blocks":B,layers:y,"branding-options":z,images:I};a.each(t,({name:o,panel:h})=>{v[o]=h});const d=o=>{clearTimeout(N),n!=="layers"&&o==="layers"?N=setTimeout(()=>l("layers"),500):c(o),l(o)},f=s.useBuilderProp("dataBindingSupport",!1);function R(){const o=setTimeout(()=>{u&&(d("layers"),clearTimeout(u))},500);E(o)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[n!=="layers"?e.jsxRuntimeExports.jsx("div",{onMouseEnter:R,onClick:()=>d("layers"),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(w.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("layers"),size:"sm",variant:n==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(g.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(w.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:o,icon:h})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(o),size:"sm",className:"w-10",variant:n===o?"default":"outline",children:e.jsxRuntimeExports.jsx(h,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:i.Children.toArray(x.map(o=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(o,{})})))})]}),e.jsxRuntimeExports.jsx("div",{className:`absolute left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${n!=="layers"?"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:T.cn("relative h-full max-h-[93%] overflow-y-auto overflow-x-hidden bg-background p-1",n==="layers"?"":"z-[100]"),onMouseEnter:()=>{u&&clearTimeout(u)},children:i.createElement(a.get(v,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:f?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(g.ListTreeIcon,{className:"mr-2 h-3"})," Layers"]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(g.DatabaseIcon,{className:"mr-2 w-3"}),"Data"]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"layers",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(y)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(_,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md bg-gray-200 py-1",children:[e.jsxRuntimeExports.jsx(g.ListTreeIcon,{className:"ml-2 mr-2 h-4"})," Layers"]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(y)})]})})})]})};exports.default=K;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import { PlusIcon as V, Half2Icon as M } from "@radix-ui/react-icons";
|
|
3
3
|
import h, { useState as x, useEffect as H, useMemo as I, lazy as y, Suspense as j } from "react";
|
|
4
|
-
import { useAtom as
|
|
5
|
-
import { filter as g, map as _, isNull as L, find as F, isEmpty as R, each as
|
|
6
|
-
import {
|
|
4
|
+
import { useAtom as z } from "jotai";
|
|
5
|
+
import { filter as g, map as _, isNull as L, find as F, isEmpty as R, each as q, get as J } from "lodash-es";
|
|
6
|
+
import { ad as O, ae as U, af as $, ag as G, ah as Z, A as Q, z as W, C as X, D as Y, E as ee, F as se, G as re, H as ae, ai as le, o as te, q as ie, aj as oe, ak as ne, al as ce, am as de, an as P, i as k, ao as me, B as b, S, ap as xe, aq as pe, ar as T, as as E } from "./index-0m8Zuv5X.js";
|
|
7
7
|
import { ListTreeIcon as C, DatabaseIcon as ue } from "lucide-react";
|
|
8
8
|
import { getChaiDataProviders as he } from "@chaibuilder/runtime";
|
|
9
9
|
import { useTranslation as A } from "react-i18next";
|
|
10
10
|
import { J as fe, a as ve, d as je } from "./index-e0c8PmRQ.js";
|
|
11
|
-
import { E as ge } from "./index-
|
|
11
|
+
import { E as ge } from "./index-19nTm_cE.js";
|
|
12
12
|
import { c as be } from "./Functions-7jnEwJyw.js";
|
|
13
13
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
|
+
import "flat-to-nested";
|
|
15
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
16
|
+
import "@react-hookz/web";
|
|
14
17
|
import "@radix-ui/react-toggle";
|
|
15
18
|
import "class-variance-authority";
|
|
16
|
-
import "./
|
|
17
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
19
|
+
import "./Class-17XFhL48.js";
|
|
18
20
|
import "clsx";
|
|
19
21
|
import "tailwind-merge";
|
|
20
22
|
import "@radix-ui/react-switch";
|
|
@@ -38,9 +40,6 @@ import "@radix-ui/react-context-menu";
|
|
|
38
40
|
import "react-icons-picker";
|
|
39
41
|
import "react-dom";
|
|
40
42
|
import "react-quill";
|
|
41
|
-
import "flat-to-nested";
|
|
42
|
-
import "redux-undo";
|
|
43
|
-
import "@react-hookz/web";
|
|
44
43
|
import "i18next";
|
|
45
44
|
import "@floating-ui/react-dom";
|
|
46
45
|
import "react-textarea-autosize";
|
|
@@ -52,12 +51,12 @@ import "sonner";
|
|
|
52
51
|
import "./html-to-json-57841sEK.js";
|
|
53
52
|
import "himalaya";
|
|
54
53
|
import "./web-blocks.js";
|
|
55
|
-
import "./
|
|
54
|
+
import "./empty-slot-MWycClTb.js";
|
|
56
55
|
const ye = ({ provider: r, onClose: i }) => {
|
|
57
|
-
const { t: a } = A(), [
|
|
56
|
+
const { t: a } = A(), [t, p] = x(null);
|
|
58
57
|
return H(() => {
|
|
59
58
|
r && (r.mockFn ? r.mockFn : r.dataFn)().then((o) => p(o));
|
|
60
|
-
}, [r]), r ? /* @__PURE__ */ e.jsx(
|
|
59
|
+
}, [r]), r ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (n) => n ? "" : i(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(U, { children: [
|
|
61
60
|
/* @__PURE__ */ e.jsxs($, { children: [
|
|
62
61
|
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
63
62
|
a("data_provider"),
|
|
@@ -69,7 +68,7 @@ const ye = ({ provider: r, onClose: i }) => {
|
|
|
69
68
|
/* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsx(
|
|
70
69
|
fe,
|
|
71
70
|
{
|
|
72
|
-
data:
|
|
71
|
+
data: t,
|
|
73
72
|
shouldExpandNode: ve,
|
|
74
73
|
style: {
|
|
75
74
|
...je,
|
|
@@ -86,7 +85,7 @@ function we({
|
|
|
86
85
|
name: i,
|
|
87
86
|
onRemove: a
|
|
88
87
|
}) {
|
|
89
|
-
const { t
|
|
88
|
+
const { t } = A();
|
|
90
89
|
return /* @__PURE__ */ e.jsxs(Q, { children: [
|
|
91
90
|
/* @__PURE__ */ e.jsx(W, { asChild: !0, children: r }),
|
|
92
91
|
/* @__PURE__ */ e.jsxs(X, { children: [
|
|
@@ -94,30 +93,30 @@ function we({
|
|
|
94
93
|
/* @__PURE__ */ e.jsx(
|
|
95
94
|
ee,
|
|
96
95
|
{
|
|
97
|
-
dangerouslySetInnerHTML: { __html:
|
|
96
|
+
dangerouslySetInnerHTML: { __html: t("remove_provider_confirmation").replace("{name}", i) }
|
|
98
97
|
}
|
|
99
98
|
),
|
|
100
|
-
/* @__PURE__ */ e.jsx(se, { children:
|
|
99
|
+
/* @__PURE__ */ e.jsx(se, { children: t("remove_provider_warning") })
|
|
101
100
|
] }),
|
|
102
101
|
/* @__PURE__ */ e.jsxs(re, { children: [
|
|
103
|
-
/* @__PURE__ */ e.jsx(ae, { children:
|
|
104
|
-
/* @__PURE__ */ e.jsx(
|
|
102
|
+
/* @__PURE__ */ e.jsx(ae, { children: t("cancel") }),
|
|
103
|
+
/* @__PURE__ */ e.jsx(le, { onClick: a, className: "bg-red-600 hover:bg-red-700", children: t("remove") })
|
|
105
104
|
] })
|
|
106
105
|
] })
|
|
107
106
|
] });
|
|
108
107
|
}
|
|
109
108
|
const Ne = () => {
|
|
110
|
-
const { t: r } = A(), i = I(() => he(), []), [a,
|
|
109
|
+
const { t: r } = A(), i = I(() => he(), []), [a, t] = te(), [, p] = z(ie), [n, o] = x(
|
|
111
110
|
g(i, (s) => _(a, "providerKey").includes(s.providerKey))
|
|
112
111
|
), [w, f] = x(""), [c, v] = x(null), N = g(
|
|
113
112
|
i.map((s) => _(n, "providerKey").includes(s.providerKey) ? null : { value: s.providerKey, label: s.name }),
|
|
114
113
|
(s) => !L(s)
|
|
115
|
-
),
|
|
114
|
+
), l = (s) => {
|
|
116
115
|
const m = F(i, { providerKey: s });
|
|
117
|
-
o((d) => [...d, m]),
|
|
116
|
+
o((d) => [...d, m]), t((d) => [...d, { providerKey: m.providerKey, args: {} }]), f(""), p("UNSAVED");
|
|
118
117
|
}, u = (s) => {
|
|
119
|
-
o((m) => g(m, (d) => d.providerKey !== s.providerKey)),
|
|
120
|
-
},
|
|
118
|
+
o((m) => g(m, (d) => d.providerKey !== s.providerKey)), t((m) => g(m, (d) => d.providerKey !== s.providerKey)), p("UNSAVED");
|
|
119
|
+
}, B = (s) => v(s);
|
|
121
120
|
return R(i) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
122
121
|
r("no_data_providers"),
|
|
123
122
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -125,7 +124,7 @@ const Ne = () => {
|
|
|
125
124
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
126
125
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
127
126
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: r("add_data_providers") }) }),
|
|
128
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(oe, { value: w, onValueChange: (s) =>
|
|
127
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(oe, { value: w, onValueChange: (s) => l(s), children: [
|
|
129
128
|
/* @__PURE__ */ e.jsx(ne, { className: "w-full", children: /* @__PURE__ */ e.jsx(ce, { placeholder: r("select_provider") }) }),
|
|
130
129
|
/* @__PURE__ */ e.jsxs(de, { children: [
|
|
131
130
|
/* @__PURE__ */ e.jsx(P, { value: "", children: r("choose") }),
|
|
@@ -152,7 +151,7 @@ const Ne = () => {
|
|
|
152
151
|
/* @__PURE__ */ e.jsxs(
|
|
153
152
|
"button",
|
|
154
153
|
{
|
|
155
|
-
onClick: () =>
|
|
154
|
+
onClick: () => B(s),
|
|
156
155
|
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",
|
|
157
156
|
children: [
|
|
158
157
|
/* @__PURE__ */ e.jsxs(
|
|
@@ -209,26 +208,26 @@ const Ne = () => {
|
|
|
209
208
|
/* @__PURE__ */ e.jsx(ye, { onClose: () => v(null), provider: c })
|
|
210
209
|
] })
|
|
211
210
|
] });
|
|
212
|
-
}, ke = y(() => import("./AddBlocks-
|
|
213
|
-
let
|
|
214
|
-
const
|
|
215
|
-
const r = k("sideBarComponents.top", []), i = k("sideBarComponents.bottom", []), [a,
|
|
211
|
+
}, ke = y(() => import("./AddBlocks-ByeMUUzE.js")), D = y(() => import("./Layers-d-xge4On.js")), Ce = y(() => import("./BrandingOptions--poS5shs.js")), De = y(() => import("./index-0m8Zuv5X.js").then((r) => r.cq));
|
|
212
|
+
let K = null;
|
|
213
|
+
const As = () => {
|
|
214
|
+
const r = k("sideBarComponents.top", []), i = k("sideBarComponents.bottom", []), [a, t] = z(me), [p, n] = x(a), [o, w] = x(null), f = {
|
|
216
215
|
"add-blocks": ke,
|
|
217
216
|
layers: D,
|
|
218
217
|
"branding-options": Ce,
|
|
219
218
|
images: De
|
|
220
219
|
};
|
|
221
|
-
|
|
222
|
-
f[
|
|
220
|
+
q(r, ({ name: l, panel: u }) => {
|
|
221
|
+
f[l] = u;
|
|
223
222
|
});
|
|
224
|
-
const c = (
|
|
225
|
-
clearTimeout(
|
|
223
|
+
const c = (l) => {
|
|
224
|
+
clearTimeout(K), a !== "layers" && l === "layers" ? K = setTimeout(() => t("layers"), 500) : n(l), t(l);
|
|
226
225
|
}, v = k("dataBindingSupport", !1);
|
|
227
226
|
function N() {
|
|
228
|
-
const
|
|
227
|
+
const l = setTimeout(() => {
|
|
229
228
|
o && (c("layers"), clearTimeout(o));
|
|
230
229
|
}, 500);
|
|
231
|
-
w(
|
|
230
|
+
w(l);
|
|
232
231
|
}
|
|
233
232
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
234
233
|
a !== "layers" ? /* @__PURE__ */ e.jsx(
|
|
@@ -271,20 +270,20 @@ const _s = () => {
|
|
|
271
270
|
}
|
|
272
271
|
),
|
|
273
272
|
h.Children.toArray(
|
|
274
|
-
r.map(({ name:
|
|
273
|
+
r.map(({ name: l, icon: u }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(S, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
275
274
|
b,
|
|
276
275
|
{
|
|
277
|
-
onClick: () => c(
|
|
276
|
+
onClick: () => c(l),
|
|
278
277
|
size: "sm",
|
|
279
278
|
className: "w-10",
|
|
280
|
-
variant: a ===
|
|
279
|
+
variant: a === l ? "default" : "outline",
|
|
281
280
|
children: /* @__PURE__ */ e.jsx(u, {})
|
|
282
281
|
}
|
|
283
282
|
) }))
|
|
284
283
|
)
|
|
285
284
|
] }),
|
|
286
285
|
/* @__PURE__ */ e.jsx("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: h.Children.toArray(
|
|
287
|
-
i.map((
|
|
286
|
+
i.map((l) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(S, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(l, {}) }))
|
|
288
287
|
) })
|
|
289
288
|
] }),
|
|
290
289
|
/* @__PURE__ */ e.jsx(
|
|
@@ -309,7 +308,7 @@ const _s = () => {
|
|
|
309
308
|
onMouseEnter: () => {
|
|
310
309
|
o && clearTimeout(o);
|
|
311
310
|
},
|
|
312
|
-
children: h.createElement(
|
|
311
|
+
children: h.createElement(J(f, a, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
313
312
|
}
|
|
314
313
|
)
|
|
315
314
|
}
|
|
@@ -349,5 +348,5 @@ const _s = () => {
|
|
|
349
348
|
] });
|
|
350
349
|
};
|
|
351
350
|
export {
|
|
352
|
-
|
|
351
|
+
As as default
|
|
353
352
|
};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import o, { useMemo as m, Suspense as c } from "react";
|
|
3
3
|
import { FontFamilyIcon as x } from "@radix-ui/react-icons";
|
|
4
|
-
import { i as a,
|
|
5
|
-
import { useTranslation as
|
|
4
|
+
import { i as a, aj as d, ak as h, al as u, am as j, at as g, au as v, an as r, a9 as f, av as S, aw as b, B as N, ax as w, S as p, ay as y } from "./index-0m8Zuv5X.js";
|
|
5
|
+
import { useTranslation as C } from "react-i18next";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
|
-
import "@radix-ui/react-toggle";
|
|
8
|
-
import "class-variance-authority";
|
|
9
|
-
import "./utils-AvyFzbPC.js";
|
|
10
7
|
import "lodash-es";
|
|
11
|
-
import "./
|
|
8
|
+
import "./Functions-7jnEwJyw.js";
|
|
12
9
|
import "clsx";
|
|
13
10
|
import "tailwind-merge";
|
|
11
|
+
import "@chaibuilder/runtime";
|
|
12
|
+
import "jotai";
|
|
13
|
+
import "flat-to-nested";
|
|
14
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
15
|
+
import "@react-hookz/web";
|
|
16
|
+
import "@radix-ui/react-toggle";
|
|
17
|
+
import "class-variance-authority";
|
|
18
|
+
import "./Class-17XFhL48.js";
|
|
14
19
|
import "@radix-ui/react-switch";
|
|
15
20
|
import "@radix-ui/react-slot";
|
|
16
21
|
import "@radix-ui/react-accordion";
|
|
@@ -32,12 +37,6 @@ import "@radix-ui/react-context-menu";
|
|
|
32
37
|
import "react-icons-picker";
|
|
33
38
|
import "react-dom";
|
|
34
39
|
import "react-quill";
|
|
35
|
-
import "jotai";
|
|
36
|
-
import "flat-to-nested";
|
|
37
|
-
import "./Functions-7jnEwJyw.js";
|
|
38
|
-
import "redux-undo";
|
|
39
|
-
import "@chaibuilder/runtime";
|
|
40
|
-
import "@react-hookz/web";
|
|
41
40
|
const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(d, { children: [
|
|
42
41
|
/* @__PURE__ */ e.jsx(h, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
43
42
|
u,
|
|
@@ -57,7 +56,7 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
57
56
|
/* @__PURE__ */ e.jsx(r, { value: "pineapple", children: "Pineapple" })
|
|
58
57
|
] }) })
|
|
59
58
|
] }) }), T = () => {
|
|
60
|
-
const { savePage: i, syncState: t } = f(), { t: l } =
|
|
59
|
+
const { savePage: i, syncState: t } = f(), { t: l } = C(), n = m(() => {
|
|
61
60
|
switch (t) {
|
|
62
61
|
case "SAVING":
|
|
63
62
|
return "animate-pulse bg-gray-500 text-gray-900";
|
|
@@ -89,9 +88,9 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
89
88
|
]
|
|
90
89
|
}
|
|
91
90
|
) }),
|
|
92
|
-
/* @__PURE__ */ e.jsx(
|
|
91
|
+
/* @__PURE__ */ e.jsx(w, { children: /* @__PURE__ */ e.jsx("p", { children: t === "SAVING" ? "Saving..." : t === "SAVED" ? "Saved" : "Save changes" }) })
|
|
93
92
|
] }) });
|
|
94
|
-
},
|
|
93
|
+
}, he = () => {
|
|
95
94
|
const i = a("topBarComponents.left", []), t = a("topBarComponents.center", []), l = a("topBarComponents.right", []), n = a("editable", !0);
|
|
96
95
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
97
96
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: o.Children.toArray(
|
|
@@ -102,7 +101,7 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
102
101
|
) }),
|
|
103
102
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
104
103
|
/* @__PURE__ */ e.jsx(B, {}),
|
|
105
|
-
/* @__PURE__ */ e.jsx(
|
|
104
|
+
/* @__PURE__ */ e.jsx(y, { orientation: "vertical" }),
|
|
106
105
|
n ? /* @__PURE__ */ e.jsx(T, {}) : null,
|
|
107
106
|
o.Children.toArray(
|
|
108
107
|
l.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
@@ -111,5 +110,5 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
111
110
|
] });
|
|
112
111
|
};
|
|
113
112
|
export {
|
|
114
|
-
|
|
113
|
+
he as default
|
|
115
114
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),l=require("@radix-ui/react-icons"),r=require("./index-TEfD-2ti.cjs"),a=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-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.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 o=()=>r.useBuilderProp("languages",["en"]),c=()=>o().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(l.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),p=()=>{const{savePage:i,syncState:s}=r.useSavePage(),{t:x}=a.useTranslation(),u=n.useMemo(()=>{switch(s){case"SAVING":return"animate-pulse bg-gray-500 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[s]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Tooltip,{children:[e.jsxRuntimeExports.jsx(r.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(r.Button,{onClick:t=>{t.preventDefault(),i()},className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${u}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx("svg",{fill:"currentColor",width:"16",height:"16",viewBox:"0 0 0.32 0.32",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"})}),s==="SAVING"?"Saving...":s==="SAVED"?x("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(r.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:s==="SAVING"?"Saving...":s==="SAVED"?"Saved":"Save changes"})})]})})},m=()=>{const i=r.useBuilderProp("topBarComponents.left",[]),s=r.useBuilderProp("topBarComponents.center",[]),x=r.useBuilderProp("topBarComponents.right",[]),u=r.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(c,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),u?e.jsxRuntimeExports.jsx(p,{}):null,n.Children.toArray(x.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=m;
|
|
@@ -2,17 +2,21 @@ 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 { i as
|
|
5
|
+
import { createApi as U } from "unsplash-js";
|
|
6
|
+
import { i as V, bc as B, aT as F, aU as K, aV as O, aj as P, ak as C, al as S, am as k, an as h, bf as Q, B as H } from "./index-0m8Zuv5X.js";
|
|
7
7
|
import { useDebouncedState as R } from "@react-hookz/web";
|
|
8
8
|
import { Loader as $ } from "lucide-react";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
10
|
-
import "
|
|
11
|
-
import "class-variance-authority";
|
|
12
|
-
import "./utils-AvyFzbPC.js";
|
|
13
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
10
|
+
import "./Functions-7jnEwJyw.js";
|
|
14
11
|
import "clsx";
|
|
15
12
|
import "tailwind-merge";
|
|
13
|
+
import "@chaibuilder/runtime";
|
|
14
|
+
import "jotai";
|
|
15
|
+
import "flat-to-nested";
|
|
16
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
17
|
+
import "@radix-ui/react-toggle";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "./Class-17XFhL48.js";
|
|
16
20
|
import "@radix-ui/react-switch";
|
|
17
21
|
import "@radix-ui/react-slot";
|
|
18
22
|
import "@radix-ui/react-accordion";
|
|
@@ -34,26 +38,21 @@ import "@radix-ui/react-context-menu";
|
|
|
34
38
|
import "react-icons-picker";
|
|
35
39
|
import "react-dom";
|
|
36
40
|
import "react-quill";
|
|
37
|
-
import "jotai";
|
|
38
|
-
import "flat-to-nested";
|
|
39
|
-
import "./Functions-7jnEwJyw.js";
|
|
40
|
-
import "redux-undo";
|
|
41
|
-
import "@chaibuilder/runtime";
|
|
42
41
|
import "react-i18next";
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
const I = async (x, g) => new Promise((o, r) => {
|
|
43
|
+
U({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
45
44
|
o(i);
|
|
46
45
|
}).catch((i) => r(i));
|
|
47
|
-
}),
|
|
48
|
-
const o =
|
|
46
|
+
}), De = ({ isModalView: x, onSelect: g }) => {
|
|
47
|
+
const o = V("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [T, y] = p(0), [u, z] = R("", 1e3), [f, c] = p(!1), _ = async (s) => {
|
|
49
48
|
if (d(u))
|
|
50
49
|
return;
|
|
51
50
|
let t = i + 1;
|
|
52
51
|
s && (s.preventDefault(), t = 1), c(!0), v(t);
|
|
53
52
|
const m = { query: u, page: t };
|
|
54
|
-
l && (m.orientation = l), n && (m.color = n),
|
|
55
|
-
var
|
|
56
|
-
j(t === 1 ? ((
|
|
53
|
+
l && (m.orientation = l), n && (m.color = n), I(m, o).then((a) => {
|
|
54
|
+
var N, b, w;
|
|
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);
|
|
57
56
|
}).catch(() => {
|
|
58
57
|
c(!1);
|
|
59
58
|
});
|
|
@@ -62,7 +61,7 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
62
61
|
if (!d(u) && o) {
|
|
63
62
|
c(!0);
|
|
64
63
|
const s = { query: u, page: 1 };
|
|
65
|
-
l && (s.orientation = l), n && (s.color = n), v(1),
|
|
64
|
+
l && (s.orientation = l), n && (s.color = n), v(1), I(s, o).then((t) => {
|
|
66
65
|
var m, a;
|
|
67
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);
|
|
68
67
|
}).catch(() => {
|
|
@@ -84,17 +83,17 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
84
83
|
] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
85
84
|
/* @__PURE__ */ e.jsxs("form", { className: "flex items-center rounded-md border bg-gray-100 p-px", children: [
|
|
86
85
|
/* @__PURE__ */ e.jsx(
|
|
87
|
-
|
|
86
|
+
B,
|
|
88
87
|
{
|
|
89
88
|
type: "text",
|
|
90
89
|
name: "query",
|
|
91
90
|
className: "input",
|
|
92
91
|
placeholder: 'Try "dog" or "apple"',
|
|
93
|
-
onChange: (s) =>
|
|
92
|
+
onChange: (s) => z(s.target.value)
|
|
94
93
|
}
|
|
95
94
|
),
|
|
96
|
-
/* @__PURE__ */ e.jsxs(
|
|
97
|
-
/* @__PURE__ */ e.jsx(
|
|
95
|
+
/* @__PURE__ */ e.jsxs(F, { children: [
|
|
96
|
+
/* @__PURE__ */ e.jsx(K, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
|
|
98
97
|
/* @__PURE__ */ e.jsx(
|
|
99
98
|
O,
|
|
100
99
|
{
|
|
@@ -104,7 +103,7 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
104
103
|
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
105
104
|
/* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => A(s), children: [
|
|
106
105
|
/* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
107
|
-
/* @__PURE__ */ e.jsxs(
|
|
106
|
+
/* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
|
|
108
107
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
109
108
|
/* @__PURE__ */ e.jsx(h, { value: "landscape", children: "Landscape" }),
|
|
110
109
|
/* @__PURE__ */ e.jsx(h, { value: "portrait", children: "Portrait" }),
|
|
@@ -114,7 +113,7 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
114
113
|
/* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
|
|
115
114
|
/* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) => q(s), children: [
|
|
116
115
|
/* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
117
|
-
/* @__PURE__ */ e.jsxs(
|
|
116
|
+
/* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
|
|
118
117
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
119
118
|
[
|
|
120
119
|
"black_and_white",
|
|
@@ -177,7 +176,7 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
177
176
|
/* @__PURE__ */ e.jsx($, { className: "animate-spin w-6 h-6" }),
|
|
178
177
|
" Loading..."
|
|
179
178
|
] }),
|
|
180
|
-
!d(r) && i <
|
|
179
|
+
!d(r) && i < T && !f && /* @__PURE__ */ e.jsx(
|
|
181
180
|
H,
|
|
182
181
|
{
|
|
183
182
|
size: "sm",
|
|
@@ -194,6 +193,6 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
194
193
|
] });
|
|
195
194
|
};
|
|
196
195
|
export {
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
De as default,
|
|
197
|
+
I as fetchImage
|
|
199
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-TEfD-2ti.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-2FeVfZQ9.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.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;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as a, useEffect as w } from "react";
|
|
3
3
|
import { isEmpty as g, map as b } 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 { i as j,
|
|
6
|
+
import { i as j, bf as A } from "./index-0m8Zuv5X.js";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
|
-
import "
|
|
9
|
-
import "class-variance-authority";
|
|
10
|
-
import "./utils-AvyFzbPC.js";
|
|
11
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
8
|
+
import "./Functions-7jnEwJyw.js";
|
|
12
9
|
import "clsx";
|
|
13
10
|
import "tailwind-merge";
|
|
11
|
+
import "@chaibuilder/runtime";
|
|
12
|
+
import "flat-to-nested";
|
|
13
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
14
|
+
import "@react-hookz/web";
|
|
15
|
+
import "@radix-ui/react-toggle";
|
|
16
|
+
import "class-variance-authority";
|
|
17
|
+
import "./Class-17XFhL48.js";
|
|
14
18
|
import "@radix-ui/react-switch";
|
|
15
19
|
import "@radix-ui/react-slot";
|
|
16
20
|
import "@radix-ui/react-accordion";
|
|
@@ -32,14 +36,9 @@ import "@radix-ui/react-context-menu";
|
|
|
32
36
|
import "react-icons-picker";
|
|
33
37
|
import "react-dom";
|
|
34
38
|
import "react-quill";
|
|
35
|
-
import "flat-to-nested";
|
|
36
|
-
import "./Functions-7jnEwJyw.js";
|
|
37
|
-
import "redux-undo";
|
|
38
|
-
import "@chaibuilder/runtime";
|
|
39
|
-
import "@react-hookz/web";
|
|
40
39
|
import "react-i18next";
|
|
41
|
-
const R = F([]),
|
|
42
|
-
const v = j("uploadMediaCallback", () => ""), c = j("fetchMediaCallback", () => []), [
|
|
40
|
+
const R = F([]), ge = ({ isModalView: r, onSelect: i }) => {
|
|
41
|
+
const v = j("uploadMediaCallback", () => ""), c = j("fetchMediaCallback", () => []), [s, m] = E(R), [o, p] = a(!1), [u, x] = a(!1), [n, d] = a(), [f, y] = a("");
|
|
43
42
|
w(() => {
|
|
44
43
|
(async () => {
|
|
45
44
|
x(!0);
|
|
@@ -54,7 +53,7 @@ const R = F([]), be = ({ isModalView: r, onSelect: a }) => {
|
|
|
54
53
|
p(!0);
|
|
55
54
|
try {
|
|
56
55
|
const { url: t } = await v(n);
|
|
57
|
-
|
|
56
|
+
i(t), d(void 0);
|
|
58
57
|
const l = await c();
|
|
59
58
|
m(l);
|
|
60
59
|
} catch (t) {
|
|
@@ -79,16 +78,16 @@ const R = F([]), be = ({ isModalView: r, onSelect: a }) => {
|
|
|
79
78
|
{
|
|
80
79
|
type: "button",
|
|
81
80
|
onClick: I,
|
|
82
|
-
disabled:
|
|
81
|
+
disabled: o,
|
|
83
82
|
className: "flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",
|
|
84
83
|
children: [
|
|
85
|
-
|
|
84
|
+
o ? /* @__PURE__ */ e.jsx(C, { className: "animate-spin" }) : /* @__PURE__ */ e.jsx(U, { className: "animate-bounce" }),
|
|
86
85
|
" ",
|
|
87
|
-
|
|
86
|
+
o ? "Uploading..." : "Upload"
|
|
88
87
|
]
|
|
89
88
|
}
|
|
90
89
|
),
|
|
91
|
-
!
|
|
90
|
+
!o && /* @__PURE__ */ e.jsxs(
|
|
92
91
|
"button",
|
|
93
92
|
{
|
|
94
93
|
type: "button",
|
|
@@ -109,18 +108,18 @@ const R = F([]), be = ({ isModalView: r, onSelect: a }) => {
|
|
|
109
108
|
/* @__PURE__ */ e.jsx("input", { type: "file", id: r ? "upload-in-modal" : "upload-in-panel", hidden: !0, onChange: N })
|
|
110
109
|
] }),
|
|
111
110
|
/* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
|
|
112
|
-
g(
|
|
113
|
-
g(
|
|
114
|
-
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(
|
|
111
|
+
g(s) && u && /* @__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..." }) }),
|
|
112
|
+
g(s) && !u && /* @__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" }) }),
|
|
113
|
+
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(s, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => i(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
115
114
|
"img",
|
|
116
115
|
{
|
|
117
116
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
118
117
|
alt: t.name,
|
|
119
118
|
src: t.thumbUrl
|
|
120
119
|
}
|
|
121
|
-
) }) }, t.id)) }) : b(
|
|
120
|
+
) }) }, t.id)) }) : b(s, (t) => (
|
|
122
121
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
123
|
-
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () =>
|
|
122
|
+
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => i(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
124
123
|
"img",
|
|
125
124
|
{
|
|
126
125
|
className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
@@ -133,5 +132,5 @@ const R = F([]), be = ({ isModalView: r, onSelect: a }) => {
|
|
|
133
132
|
] });
|
|
134
133
|
};
|
|
135
134
|
export {
|
|
136
|
-
|
|
135
|
+
ge as default
|
|
137
136
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),l=require("lodash-es"),d=require("@radix-ui/react-icons"),q=require("jotai"),m=require("./index-TEfD-2ti.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.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 N=q.atom([]),I=({isModalView:t,onSelect:a})=>{const E=m.useBuilderProp("uploadMediaCallback",()=>""),p=m.useBuilderProp("fetchMediaCallback",()=>[]),[i,u]=q.useAtom(N),[n,j]=r.useState(!1),[h,f]=r.useState(!1),[x,c]=r.useState(),[g,R]=r.useState("");r.useEffect(()=>{(async()=>{f(!0);const s=await p();u(s||[]),f(!1)})()},[]);const v=s=>{var o,b;s&&((b=(o=s==null?void 0:s.target)==null?void 0:o.files)==null?void 0:b.length)>0&&c(s.target.files[0])},y=async()=>{j(!0);try{const{url:s}=await E(x);a(s),c(void 0);const o=await p();u(o)}catch(s){u([]),R((s==null?void 0:s.message)||"Something went wrong.")}j(!1)};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x?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(x),alt:"",className:"h-auto w-full max-w-sm rounded-md max-h-96 object-contain"}),g&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:g}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:y,disabled: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(d.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(d.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:()=>c(void 0),children:[e.jsxRuntimeExports.jsx(d.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(m.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,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>a(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.thumbUrl})})},s.id))}):l.map(i,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>a(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=I;
|