@chaibuilder/sdk 0.1.22 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddBlocks-254892c5.js → AddBlocks-5818ee33.js} +13 -14
- package/dist/AddBlocks-97c464e1.cjs +3 -0
- package/dist/{BrandingOptions-81fb41d9.js → BrandingOptions-3095a1ac.js} +1 -1
- package/dist/{BrandingOptions-10c05f85.cjs → BrandingOptions-a4de85eb.cjs} +1 -1
- package/dist/{CanvasArea-a261378b.cjs → CanvasArea-45062968.cjs} +2 -2
- package/dist/{CanvasArea-7e09f98e.js → CanvasArea-a6706381.js} +2 -2
- package/dist/{CurrentPage-b67bee36.cjs → CurrentPage-181bbdc0.cjs} +1 -1
- package/dist/{CurrentPage-ce5a51fa.js → CurrentPage-36e1f888.js} +1 -1
- package/dist/{Layers-b3a452cc.js → Layers-066e5450.js} +2 -2
- package/dist/{Layers-4e859d15.cjs → Layers-884713c8.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-1a1039f8.cjs → MarkAsGlobalBlock-3336e964.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-7d9f5e11.js → MarkAsGlobalBlock-dc93e527.js} +1 -1
- package/dist/{PagesPanel-163b7771.cjs → PagesPanel-574a0a87.cjs} +1 -1
- package/dist/{PagesPanel-2559ea9e.js → PagesPanel-dba3d5fa.js} +2 -2
- package/dist/{ProjectPanel-e78931cd.cjs → ProjectPanel-a737a211.cjs} +1 -1
- package/dist/{ProjectPanel-fab32a4f.js → ProjectPanel-b7c44110.js} +2 -2
- package/dist/Settings-7d129d30.cjs +1 -0
- package/dist/{Settings-a2638a6e.js → Settings-a3117310.js} +584 -579
- package/dist/SidePanels-b4ba0640.cjs +1 -0
- package/dist/SidePanels-ffe30d1c.js +329 -0
- package/dist/{Topbar-ef648e78.js → Topbar-4e04e218.js} +1 -1
- package/dist/{Topbar-c131ef83.cjs → Topbar-836552a6.cjs} +1 -1
- package/dist/{add-page-modal-7d645bf7.cjs → add-page-modal-217f08a5.cjs} +1 -1
- package/dist/{add-page-modal-8c9dad17.js → add-page-modal-41831178.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-ec091c19.js → delete-page-modal-9c81fd1f.js} +1 -1
- package/dist/{delete-page-modal-19001f8d.cjs → delete-page-modal-a58fb14e.cjs} +1 -1
- package/dist/{index-e6e838ec.js → index-088a9534.js} +6 -6
- package/dist/{index-2f61b040.cjs → index-e2dad9ec.cjs} +18 -18
- package/dist/{page-viewer-dec9a6d2.js → page-viewer-6a9db9cc.js} +2 -2
- package/dist/{page-viewer-65e2ca1a.cjs → page-viewer-ff2173dd.cjs} +1 -1
- package/dist/{project-general-setting-c7d95cc0.cjs → project-general-setting-695a14fa.cjs} +1 -1
- package/dist/{project-general-setting-067afe22.js → project-general-setting-d0cb6eca.js} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +2 -4
- package/dist/render.js +59 -67
- package/dist/{single-page-detail-f110be66.js → single-page-detail-ac77d6d0.js} +2 -2
- package/dist/{single-page-detail-14e7a650.cjs → single-page-detail-f54b60af.cjs} +1 -1
- package/dist/textarea-0750bcd2.js +73 -0
- package/dist/textarea-a338ede6.cjs +1 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +72 -73
- package/package.json +3 -3
- package/dist/AddBlocks-a86eec32.cjs +0 -3
- package/dist/Settings-d9df3548.cjs +0 -1
- package/dist/SidePanels-1439e695.cjs +0 -1
- package/dist/SidePanels-aa583e71.js +0 -242
- package/dist/card-14e1d020.cjs +0 -1
- package/dist/card-f8f4f985.js +0 -33
- package/dist/textarea-20b2f6b2.cjs +0 -1
- package/dist/textarea-9dfb6a32.js +0 -45
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),k=require("@radix-ui/react-icons"),r=require("react"),q=require("jotai"),o=require("lodash"),u=require("./useBuilderProp-5e57d0c8.cjs"),v=require("./tabs-860e37aa.cjs"),y=require("./index-e2dad9ec.cjs");require("react-i18next");const P=require("./utils-3c452dd0.cjs"),w=require("lucide-react"),A=require("@chaibuilder/blocks"),l=require("./alert-dialog-4ce6ed22.cjs"),R=require("./dialog-170eaad9.cjs"),f=require("./select-0e32300c.cjs"),T=require("react-json-view");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-tabs");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("sonner");require("tailwind-merge");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-select");const B=({provider:t,onClose:c})=>{const[i,d]=r.useState(null);return r.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(m=>d(m))},[t]),t?e.jsxRuntimeExports.jsx(R.Dialog,{onOpenChange:a=>a?"":c(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(R.DialogContent,{children:[e.jsxRuntimeExports.jsxs(R.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(R.DialogTitle,{children:["Data Provider: ",t.name]}),e.jsxRuntimeExports.jsx(R.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(T,{style:{maxHeight:"80vh",overflowY:"auto"},name:t.providerKey,enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:i})]})}):null};function K({children:t,name:c,onRemove:i}){return e.jsxRuntimeExports.jsxs(l.AlertDialog,{children:[e.jsxRuntimeExports.jsx(l.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(l.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(l.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsxs(l.AlertDialogTitle,{children:["Are you sure, you want to remove ",e.jsxRuntimeExports.jsx("span",{className:"text-blue-500",children:c})," provider?"]}),e.jsxRuntimeExports.jsx(l.AlertDialogDescription,{children:"Your data provider will be removed from this page and all added data binding will be not visible on blocks."})]}),e.jsxRuntimeExports.jsxs(l.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(l.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(l.AlertDialogAction,{onClick:i,className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})]})}const z=()=>{const t=r.useMemo(()=>A.getChaiDataProviders(),[]),[c,i]=y.usePageDataProviders(),[,d]=q.useAtom(y.pageSyncStateAtom),[a,m]=r.useState(o.filter(t,s=>o.map(c,"providerKey").includes(s.providerKey))),[p,N]=r.useState(""),[E,x]=r.useState(null),b=o.filter(t.map(s=>o.map(a,"providerKey").includes(s.providerKey)?null:{value:s.providerKey,label:s.name}),s=>!o.isNull(s)),n=s=>{const h=o.find(t,{providerKey:s});m(j=>[...j,h]),i(j=>[...j,{providerKey:h.providerKey,args:{}}]),N(""),d("UNSAVED")},g=s=>{m(h=>o.filter(h,j=>j.providerKey!==s.providerKey)),i(h=>o.filter(h,j=>j.providerKey!==s.providerKey)),d("UNSAVED")},S=s=>x(s);return o.isEmpty(t)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs p-4",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 mb-1.5 text-xs",children:"Add data providers:"})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(f.Select,{value:p,onValueChange:s=>n(s),children:[e.jsxRuntimeExports.jsx(f.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(f.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(f.SelectContent,{children:[e.jsxRuntimeExports.jsx(f.SelectItem,{value:"",children:"Choose"}),b.map(s=>e.jsxRuntimeExports.jsx(f.SelectItem,{value:s.value,children:s.label},s.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${a.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium",children:"Page data providers:"}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:a.map(s=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm w-full","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between items-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:s.name}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-400 pt-1",children:s.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"items-center p-2 py-2 flex justify-between",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>S(s),className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View Data"]}),e.jsxRuntimeExports.jsx(K,{onRemove:()=>g(s),name:s.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),"Remove"]})})]})]},s.providerKey))}),e.jsxRuntimeExports.jsx(B,{onClose:()=>x(null),provider:E})]})]})},C=r.lazy(()=>Promise.resolve().then(()=>require("./Layers-884713c8.cjs"))),V=r.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-a4de85eb.cjs"))),I=r.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-0db5c72f.cjs")));let D=null;const M=()=>{const t=u.useBuilderProp("sideBarComponents.top",[]),c=u.useBuilderProp("sideBarComponents.bottom",[]),[i,d]=q.useAtom(y.activePanelAtom),[a,m]=r.useState(i),[p,N]=r.useState(null),E={layers:C,"branding-options":V,images:I};o.each(t,({name:n,panel:g})=>{E[n]=g});const x=n=>{clearTimeout(D),b(!1),i!=="layers"&&n==="layers"?D=setTimeout(()=>m("layers"),500):m(n),d(n)},[,b]=q.useAtom(y.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[e.jsxRuntimeExports.jsx(u.Button,{onClick:()=>{b(!0),d("layers")},size:"sm",variant:i==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(u.Button,{onClick:()=>x("layers"),size:"sm",variant:i==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(w.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(u.Button,{onClick:()=>x("branding-options"),size:"sm",variant:i==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),r.Children.toArray(t.map(({name:n,icon:g})=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(u.Button,{onClick:()=>x(n),size:"sm",className:"w-10",variant:i===n?"default":"outline",children:e.jsxRuntimeExports.jsx(g,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-2",children:r.Children.toArray(c.map(n=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{x("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(i==="layers"?" hidden":"")}),e.jsxRuntimeExports.jsx("div",{className:`fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${i!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:P.cn("relative h-full max-h-[93%] bg-background p-1",i==="layers"?"":"z-[100]"),onMouseEnter:()=>{p&&clearTimeout(p)},onMouseLeave:()=>{const n=setTimeout(()=>{p&&(x("layers"),clearTimeout(p))},1e3);N(n)},children:r.createElement(o.get(E,a,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsxs(v.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(v.TabsList,{className:"mx-1 h-10 grid grid-cols-2",children:[e.jsxRuntimeExports.jsxs(v.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(w.ListTreeIcon,{className:"h-3 mr-2"})," Layers"]}),e.jsxRuntimeExports.jsxs(v.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(w.DatabaseIcon,{className:"w-3 mr-2"}),"Data"]})]}),e.jsxRuntimeExports.jsx(v.TabsContent,{value:"layers",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:r.createElement(C)}),e.jsxRuntimeExports.jsx(v.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(z,{})})]})})})]})};exports.default=M;
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
+
import { PlusIcon as V, Half2Icon as E } from "@radix-ui/react-icons";
|
|
3
|
+
import v, { useMemo as M, useState as u, useEffect as L, lazy as w, Suspense as j } from "react";
|
|
4
|
+
import { useAtom as N } from "jotai";
|
|
5
|
+
import { filter as g, map as k, isNull as R, isEmpty as H, find as I, each as _, get as F } from "lodash";
|
|
6
|
+
import { u as C, B as b, S as D } from "./useBuilderProp-81a14920.js";
|
|
7
|
+
import { T as O, a as Y, b as A, c as P } from "./tabs-85caa1e8.js";
|
|
8
|
+
import { u as J, p as U, a as $, b as Z } from "./index-088a9534.js";
|
|
9
|
+
import "react-i18next";
|
|
10
|
+
import { c as q } from "./utils-ac68b2c8.js";
|
|
11
|
+
import { ListTreeIcon as S, DatabaseIcon as G } from "lucide-react";
|
|
12
|
+
import { getChaiDataProviders as Q } from "@chaibuilder/blocks";
|
|
13
|
+
import { A as W, a as X, b as ee, c as se, e as re, f as ae, d as le, h as ie, g as te } from "./alert-dialog-ee98f47e.js";
|
|
14
|
+
import { D as oe, a as ne, c as ce, e as de, f as me } from "./dialog-3d4e82ed.js";
|
|
15
|
+
import { S as xe, c as ue, b as pe, d as he, f as T } from "./select-7fddd7c3.js";
|
|
16
|
+
import fe from "react-json-view";
|
|
17
|
+
import "@radix-ui/react-slot";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "@radix-ui/react-tooltip";
|
|
20
|
+
import "@radix-ui/react-toast";
|
|
21
|
+
import "@radix-ui/react-tabs";
|
|
22
|
+
import "./MODIFIERS-2f19c314.js";
|
|
23
|
+
import "clsx";
|
|
24
|
+
import "@radix-ui/react-scroll-area";
|
|
25
|
+
import "react-dom";
|
|
26
|
+
import "@floating-ui/react-dom";
|
|
27
|
+
import "i18next";
|
|
28
|
+
import "flagged";
|
|
29
|
+
import "react-dnd";
|
|
30
|
+
import "@minoru/react-dnd-treeview";
|
|
31
|
+
import "react-hotkeys-hook";
|
|
32
|
+
import "flat-to-nested";
|
|
33
|
+
import "./html-to-json-45e0e3b5.js";
|
|
34
|
+
import "himalaya";
|
|
35
|
+
import "redux-undo";
|
|
36
|
+
import "@react-hookz/web";
|
|
37
|
+
import "sonner";
|
|
38
|
+
import "tailwind-merge";
|
|
39
|
+
import "@radix-ui/react-alert-dialog";
|
|
40
|
+
import "@radix-ui/react-dialog";
|
|
41
|
+
import "@radix-ui/react-select";
|
|
42
|
+
const ve = ({ provider: r, onClose: o }) => {
|
|
43
|
+
const [a, n] = u(null);
|
|
44
|
+
return L(() => {
|
|
45
|
+
r && (r.mockFn ? r.mockFn : r.dataFn)().then((c) => n(c));
|
|
46
|
+
}, [r]), r ? /* @__PURE__ */ e.jsx(oe, { onOpenChange: (i) => i ? "" : o(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(ne, { children: [
|
|
47
|
+
/* @__PURE__ */ e.jsxs(ce, { children: [
|
|
48
|
+
/* @__PURE__ */ e.jsxs(de, { children: [
|
|
49
|
+
"Data Provider: ",
|
|
50
|
+
r.name
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ e.jsx(me, { children: r.description })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ e.jsx(
|
|
55
|
+
fe,
|
|
56
|
+
{
|
|
57
|
+
style: { maxHeight: "80vh", overflowY: "auto" },
|
|
58
|
+
name: r.providerKey,
|
|
59
|
+
enableClipboard: !1,
|
|
60
|
+
displayObjectSize: !1,
|
|
61
|
+
displayDataTypes: !1,
|
|
62
|
+
src: a
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] }) }) : null;
|
|
66
|
+
};
|
|
67
|
+
function je({
|
|
68
|
+
children: r,
|
|
69
|
+
name: o,
|
|
70
|
+
onRemove: a
|
|
71
|
+
}) {
|
|
72
|
+
return /* @__PURE__ */ e.jsxs(W, { children: [
|
|
73
|
+
/* @__PURE__ */ e.jsx(X, { asChild: !0, children: r }),
|
|
74
|
+
/* @__PURE__ */ e.jsxs(ee, { children: [
|
|
75
|
+
/* @__PURE__ */ e.jsxs(se, { children: [
|
|
76
|
+
/* @__PURE__ */ e.jsxs(re, { children: [
|
|
77
|
+
"Are you sure, you want to remove ",
|
|
78
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-blue-500", children: o }),
|
|
79
|
+
" provider?"
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ e.jsx(ae, { children: "Your data provider will be removed from this page and all added data binding will be not visible on blocks." })
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ e.jsxs(le, { children: [
|
|
84
|
+
/* @__PURE__ */ e.jsx(ie, { children: "Cancel" }),
|
|
85
|
+
/* @__PURE__ */ e.jsx(te, { onClick: a, className: "bg-red-600 hover:bg-red-700", children: "Remove" })
|
|
86
|
+
] })
|
|
87
|
+
] })
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
const ge = () => {
|
|
91
|
+
const r = M(() => Q(), []), [o, a] = J(), [, n] = N(U), [i, c] = u(
|
|
92
|
+
g(r, (s) => k(o, "providerKey").includes(s.providerKey))
|
|
93
|
+
), [m, y] = u(""), [h, t] = u(null), f = g(
|
|
94
|
+
r.map((s) => k(i, "providerKey").includes(s.providerKey) ? null : { value: s.providerKey, label: s.name }),
|
|
95
|
+
(s) => !R(s)
|
|
96
|
+
), l = (s) => {
|
|
97
|
+
const x = I(r, { providerKey: s });
|
|
98
|
+
c((d) => [...d, x]), a((d) => [...d, { providerKey: x.providerKey, args: {} }]), y(""), n("UNSAVED");
|
|
99
|
+
}, p = (s) => {
|
|
100
|
+
c((x) => g(x, (d) => d.providerKey !== s.providerKey)), a((x) => g(x, (d) => d.providerKey !== s.providerKey)), n("UNSAVED");
|
|
101
|
+
}, B = (s) => t(s);
|
|
102
|
+
return H(r) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "text-gray-500 mb-1.5 text-xs p-4", children: [
|
|
103
|
+
"You have no data providers registered. Please add a data provider to your project. ",
|
|
104
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
105
|
+
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
|
|
106
|
+
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
107
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
108
|
+
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 mb-1.5 text-xs", children: "Add data providers:" }) }),
|
|
109
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(xe, { value: m, onValueChange: (s) => l(s), children: [
|
|
110
|
+
/* @__PURE__ */ e.jsx(ue, { className: "w-full", children: /* @__PURE__ */ e.jsx(pe, { placeholder: "Select a provider" }) }),
|
|
111
|
+
/* @__PURE__ */ e.jsxs(he, { children: [
|
|
112
|
+
/* @__PURE__ */ e.jsx(T, { value: "", children: "Choose" }),
|
|
113
|
+
f.map((s) => /* @__PURE__ */ e.jsx(T, { value: s.value, children: s.label }, s.value))
|
|
114
|
+
] })
|
|
115
|
+
] }) }),
|
|
116
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
117
|
+
/* @__PURE__ */ e.jsxs("div", { className: `border-t ${i.length ? "block" : "hidden"}`, children: [
|
|
118
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium", children: "Page data providers:" }),
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: i.map((s) => /* @__PURE__ */ e.jsxs(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
className: "rounded-lg border bg-card text-card-foreground shadow-sm w-full",
|
|
123
|
+
"data-v0-t": "card",
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ e.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
126
|
+
/* @__PURE__ */ e.jsx("h3", { className: "font-medium leading-4", children: s.name }),
|
|
127
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-400 pt-1", children: s.description })
|
|
128
|
+
] }) }) }),
|
|
129
|
+
/* @__PURE__ */ e.jsxs("div", { className: "items-center p-2 py-2 flex justify-between", children: [
|
|
130
|
+
/* @__PURE__ */ e.jsxs(
|
|
131
|
+
"button",
|
|
132
|
+
{
|
|
133
|
+
onClick: () => B(s),
|
|
134
|
+
className: "inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ e.jsxs(
|
|
137
|
+
"svg",
|
|
138
|
+
{
|
|
139
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
140
|
+
width: "24",
|
|
141
|
+
height: "24",
|
|
142
|
+
viewBox: "0 0 24 24",
|
|
143
|
+
fill: "none",
|
|
144
|
+
stroke: "currentColor",
|
|
145
|
+
"stroke-width": "2",
|
|
146
|
+
"stroke-linecap": "round",
|
|
147
|
+
"stroke-linejoin": "round",
|
|
148
|
+
className: "w-4 h-4 mr-2",
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ e.jsx("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
|
|
151
|
+
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
"View Data"
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ e.jsx(je, { onRemove: () => p(s), name: s.name, children: /* @__PURE__ */ e.jsxs("button", { className: "inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500", children: [
|
|
160
|
+
/* @__PURE__ */ e.jsxs(
|
|
161
|
+
"svg",
|
|
162
|
+
{
|
|
163
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
164
|
+
width: "24",
|
|
165
|
+
height: "24",
|
|
166
|
+
viewBox: "0 0 24 24",
|
|
167
|
+
fill: "none",
|
|
168
|
+
stroke: "currentColor",
|
|
169
|
+
"stroke-width": "2",
|
|
170
|
+
"stroke-linecap": "round",
|
|
171
|
+
"stroke-linejoin": "round",
|
|
172
|
+
className: "w-4 h-4 mr-2",
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ e.jsx("path", { d: "M3 6h18" }),
|
|
175
|
+
/* @__PURE__ */ e.jsx("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
176
|
+
/* @__PURE__ */ e.jsx("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" })
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
"Remove"
|
|
181
|
+
] }) })
|
|
182
|
+
] })
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
s.providerKey
|
|
186
|
+
)) }),
|
|
187
|
+
/* @__PURE__ */ e.jsx(ve, { onClose: () => t(null), provider: h })
|
|
188
|
+
] })
|
|
189
|
+
] });
|
|
190
|
+
}, K = w(() => import("./Layers-066e5450.js")), be = w(() => import("./BrandingOptions-3095a1ac.js")), ye = w(() => import("./ImagesPanel-38c44785.js"));
|
|
191
|
+
let z = null;
|
|
192
|
+
const cs = () => {
|
|
193
|
+
const r = C("sideBarComponents.top", []), o = C("sideBarComponents.bottom", []), [a, n] = N($), [i, c] = u(a), [m, y] = u(null), h = {
|
|
194
|
+
layers: K,
|
|
195
|
+
"branding-options": be,
|
|
196
|
+
images: ye
|
|
197
|
+
};
|
|
198
|
+
_(r, ({ name: l, panel: p }) => {
|
|
199
|
+
h[l] = p;
|
|
200
|
+
});
|
|
201
|
+
const t = (l) => {
|
|
202
|
+
clearTimeout(z), f(!1), a !== "layers" && l === "layers" ? z = setTimeout(() => c("layers"), 500) : c(l), n(l);
|
|
203
|
+
}, [, f] = N(Z);
|
|
204
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
205
|
+
/* @__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: [
|
|
206
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: [
|
|
207
|
+
/* @__PURE__ */ e.jsx(
|
|
208
|
+
b,
|
|
209
|
+
{
|
|
210
|
+
onClick: () => {
|
|
211
|
+
f(!0), n("layers");
|
|
212
|
+
},
|
|
213
|
+
size: "sm",
|
|
214
|
+
variant: a === "add-blocks" ? "default" : "outline",
|
|
215
|
+
children: /* @__PURE__ */ e.jsx(V, { className: "text-xl" })
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ e.jsx(
|
|
219
|
+
b,
|
|
220
|
+
{
|
|
221
|
+
onClick: () => t("layers"),
|
|
222
|
+
size: "sm",
|
|
223
|
+
variant: a === "layers" ? "default" : "outline",
|
|
224
|
+
children: /* @__PURE__ */ e.jsx(S, { className: "w-4" })
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
/* @__PURE__ */ e.jsx(
|
|
228
|
+
b,
|
|
229
|
+
{
|
|
230
|
+
onClick: () => t("branding-options"),
|
|
231
|
+
size: "sm",
|
|
232
|
+
variant: a === "branding-options" ? "default" : "outline",
|
|
233
|
+
children: /* @__PURE__ */ e.jsx(E, { className: "w-4 max-w-[40px] text-xs" })
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
v.Children.toArray(
|
|
237
|
+
r.map(({ name: l, icon: p }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(D, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
238
|
+
b,
|
|
239
|
+
{
|
|
240
|
+
onClick: () => t(l),
|
|
241
|
+
size: "sm",
|
|
242
|
+
className: "w-10",
|
|
243
|
+
variant: a === l ? "default" : "outline",
|
|
244
|
+
children: /* @__PURE__ */ e.jsx(p, {})
|
|
245
|
+
}
|
|
246
|
+
) }))
|
|
247
|
+
)
|
|
248
|
+
] }),
|
|
249
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center space-y-2", children: v.Children.toArray(
|
|
250
|
+
o.map((l) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(D, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(l, {}) }))
|
|
251
|
+
) })
|
|
252
|
+
] }),
|
|
253
|
+
/* @__PURE__ */ e.jsx(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
onClick: () => {
|
|
257
|
+
t("layers");
|
|
258
|
+
},
|
|
259
|
+
className: "absolute inset-0 right-0 z-50 w-screen bg-black/20" + (a === "layers" ? " hidden" : "")
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ e.jsx(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
className: `fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${a !== "layers" ? "translate-x-0" : "-translate-x-full"}`,
|
|
266
|
+
children: /* @__PURE__ */ e.jsx(
|
|
267
|
+
j,
|
|
268
|
+
{
|
|
269
|
+
fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
|
|
270
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
|
|
271
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
272
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
273
|
+
] }),
|
|
274
|
+
children: /* @__PURE__ */ e.jsx(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
className: q("relative h-full max-h-[93%] bg-background p-1", a === "layers" ? "" : "z-[100]"),
|
|
278
|
+
onMouseEnter: () => {
|
|
279
|
+
m && clearTimeout(m);
|
|
280
|
+
},
|
|
281
|
+
onMouseLeave: () => {
|
|
282
|
+
const l = setTimeout(() => {
|
|
283
|
+
m && (t("layers"), clearTimeout(m));
|
|
284
|
+
}, 1e3);
|
|
285
|
+
y(l);
|
|
286
|
+
},
|
|
287
|
+
children: v.createElement(F(h, i, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
|
|
295
|
+
j,
|
|
296
|
+
{
|
|
297
|
+
fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
|
|
298
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
|
|
299
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
300
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
301
|
+
] }),
|
|
302
|
+
children: /* @__PURE__ */ e.jsxs(O, { defaultValue: "layers", className: "flex h-full w-full flex-col py-1", children: [
|
|
303
|
+
/* @__PURE__ */ e.jsxs(Y, { className: "mx-1 h-10 grid grid-cols-2", children: [
|
|
304
|
+
/* @__PURE__ */ e.jsxs(A, { value: "layers", children: [
|
|
305
|
+
/* @__PURE__ */ e.jsx(S, { className: "h-3 mr-2" }),
|
|
306
|
+
" Layers"
|
|
307
|
+
] }),
|
|
308
|
+
/* @__PURE__ */ e.jsxs(A, { value: "data-provider", children: [
|
|
309
|
+
/* @__PURE__ */ e.jsx(G, { className: "w-3 mr-2" }),
|
|
310
|
+
"Data"
|
|
311
|
+
] })
|
|
312
|
+
] }),
|
|
313
|
+
/* @__PURE__ */ e.jsx(
|
|
314
|
+
P,
|
|
315
|
+
{
|
|
316
|
+
value: "layers",
|
|
317
|
+
className: "no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",
|
|
318
|
+
children: v.createElement(K)
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ e.jsx(P, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ge, {}) })
|
|
322
|
+
] })
|
|
323
|
+
}
|
|
324
|
+
) })
|
|
325
|
+
] });
|
|
326
|
+
};
|
|
327
|
+
export {
|
|
328
|
+
cs as default
|
|
329
|
+
};
|
|
@@ -5,7 +5,7 @@ import { S as x, c as d, b as h, d as u, a as g, e as j, f as t } from "./select
|
|
|
5
5
|
import { u as i, d as f, e as v, f as S, S as c } from "./useBuilderProp-81a14920.js";
|
|
6
6
|
import { S as b } from "./separator-a80d065b.js";
|
|
7
7
|
import { T as N } from "./toggle-00c9d11e.js";
|
|
8
|
-
import { c as C } from "./index-
|
|
8
|
+
import { c as C } from "./index-088a9534.js";
|
|
9
9
|
import { useTranslation as w } from "react-i18next";
|
|
10
10
|
import "@radix-ui/react-select";
|
|
11
11
|
import "./utils-ac68b2c8.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),l=require("@radix-ui/react-icons"),r=require("./select-0e32300c.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),o=require("./separator-a597dba7.cjs"),a=require("./toggle-b90fed97.cjs"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),l=require("@radix-ui/react-icons"),r=require("./select-0e32300c.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),o=require("./separator-a597dba7.cjs"),a=require("./toggle-b90fed97.cjs"),c=require("./index-e2dad9ec.cjs"),p=require("react-i18next");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-separator");require("@radix-ui/react-toggle");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const m=()=>s.useBuilderProp("languages",["en"]),j=()=>m().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"})]})})]})}),d=()=>{const{savePage:x,syncState:t}=c.useSavePage(),{t:u}=p.useTranslation(),n=i.useMemo(()=>{switch(t){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"}},[t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(a.Toggle,{onClick:()=>x(),className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${n}`,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"})}),t==="SAVING"?"Saving...":t==="SAVED"?u("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t==="SAVING"?"Saving...":t==="SAVED"?"Saved":"Save changes"})})]})})},h=()=>{const x=s.useBuilderProp("topBarComponents.left",[]),t=s.useBuilderProp("topBarComponents.center",[]),u=s.useBuilderProp("topBarComponents.right",[]);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:i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:i.Children.toArray(t.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(j,{}),e.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(d,{}),i.Children.toArray(u.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),R=require("lodash"),x=require("./useBuilderProp-5e57d0c8.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-99b51245.cjs"),f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),R=require("lodash"),x=require("./useBuilderProp-5e57d0c8.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-99b51245.cjs"),f=require("./index-e2dad9ec.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("@radix-ui/react-dialog");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-86ac8848.cjs");require("react-icons-picker");require("react-dom");require("./ImagesPanel-0db5c72f.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("lucide-react");require("sonner");const E=({closeModal:i})=>{var l,o;const s=f.useAddPage(),[r,m]=g.useState({name:"",slug:"",blocks:[],type:"STATIC",seoData:{}}),p=()=>{s.mutate(r,{onSuccess:()=>i()})},j=({formData:u},t)=>{m(h=>{var d,c;const n={[t]:u[t]};return t==="name"?n.slug=R.kebabCase((d=u[t])==null?void 0:d.replace(/\d/g,"")):t==="slug"&&(n.slug=(c=u[t])==null?void 0:c.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_")),{...h,...n}})},P={name:q.SingleLineText({title:"Page Name",default:r.name}),slug:q.SingleLineText({title:"Page Slug",default:r.slug})};return e.jsxRuntimeExports.jsxs(a.DialogContent,{children:[e.jsxRuntimeExports.jsx("div",{className:"px-1 font-bold",children:"Add Page"}),e.jsxRuntimeExports.jsx(b.Form,{formData:r,properties:P,onChange:j,disabled:s.isPending}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-end",children:e.jsxRuntimeExports.jsx(x.Button,{type:"submit",disabled:!r.name||!r.slug||((l=r.name)==null?void 0:l.length)<2||((o=r.slug)==null?void 0:o.length)<2||s.isPending,onClick:p,children:"Add Page"})})]})},S=()=>{const[i,s]=g.useState(!1);return e.jsxRuntimeExports.jsxs(a.Dialog,{open:i,onOpenChange:()=>s(!i),children:[e.jsxRuntimeExports.jsx(a.DialogTrigger,{children:e.jsxRuntimeExports.jsx(x.Button,{size:"sm",variant:"link",className:"text-blue-500",onClick:()=>s(!i),children:"+ New Page"})}),i&&e.jsxRuntimeExports.jsx(E,{closeModal:()=>s(!i)})]})};exports.default=S;
|
|
@@ -5,7 +5,7 @@ import { B as c } from "./useBuilderProp-81a14920.js";
|
|
|
5
5
|
import { D as b, b as C, a as A } from "./dialog-3d4e82ed.js";
|
|
6
6
|
import { SingleLineText as d } from "@chaibuilder/blocks";
|
|
7
7
|
import { F as D } from "./form-725e3191.js";
|
|
8
|
-
import { a0 as N } from "./index-
|
|
8
|
+
import { a0 as N } from "./index-088a9534.js";
|
|
9
9
|
import "@radix-ui/react-slot";
|
|
10
10
|
import "class-variance-authority";
|
|
11
11
|
import "./utils-ac68b2c8.js";
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-e2dad9ec.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),u=require("react-i18next");require("./jsx-runtime-5c3ac4f7.cjs");require("react");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("@radix-ui/react-icons");require("lucide-react");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiBuilderStudio=e.ChaiBuilderStudio;exports.useActiveLanguage=e.useActiveLanguage;exports.useActiveModal=e.useActiveModal;exports.useActivePanel=e.useActivePanel;exports.useAddBlock=e.useAddBlock;exports.useAddBlockParent=e.useAddBlockParent;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAllBlocks=e.useAllBlocks;exports.useBlockContentByLanguage=e.useBlockContentByLanguage;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderReset=e.useBuilderReset;exports.useBuildingBlocks=e.useBuildingBlocks;exports.useCanvasHistory=e.useCanvasHistory;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCurrentPage=e.useCurrentPage$1;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDeveloperPreviewMode=e.useDeveloperPreviewMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useFeatureSupport=e.useFeatureSupport;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useMarkAsGlobalBlock=e.useMarkAsGlobalBlock;exports.useMoveBlocks=e.useMoveBlocks;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.usePrimaryLanguage=e.usePrimaryLanguage;exports.useProject=e.useProject$1;exports.useReadOnlyMode=e.useReadOnlyMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSetAllBlocks=e.useSetAllBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTranslations=e.useTranslations;exports.useTreeData=e.useTreeData;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useBuilderProp=s.useBuilderProp;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>u.useTranslation});
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a5 as T, ap as b, H as j, a8 as x, ak as G, W as O, al as U, K as w, B as F, ao as W, z as Z, a6 as q, a9 as z, d as E, f as K, l as N, o as V, aa as J, n as Q, e as X, ab as Y, m as _, k as $, ac as ss, V as es, A as as, an as os, a1 as ts, ad as us, q as rs, s as is, am as ls, ae as ps, a7 as cs, t as ds, L as ms, c as Bs, D as ks, ag as ns, N as gs, i as Cs, O as Ss, g as vs, j as Ps, h as As, ah as ys, M as hs, af as Ms, ai as Ds, Z as Is, aj as Ls, G as fs } from "./index-
|
|
1
|
+
import { a5 as T, ap as b, H as j, a8 as x, ak as G, W as O, al as U, K as w, B as F, ao as W, z as Z, a6 as q, a9 as z, d as E, f as K, l as N, o as V, aa as J, n as Q, e as X, ab as Y, m as _, k as $, ac as ss, V as es, A as as, an as os, a1 as ts, ad as us, q as rs, s as is, am as ls, ae as ps, a7 as cs, t as ds, L as ms, c as Bs, D as ks, ag as ns, N as gs, i as Cs, O as Ss, g as vs, j as Ps, h as As, ah as ys, M as hs, af as Ms, ai as Ds, Z as Is, aj as Ls, G as fs } from "./index-088a9534.js";
|
|
2
2
|
import { u as Hs } from "./useBuilderProp-81a14920.js";
|
|
3
3
|
import { useTranslation as bs } from "react-i18next";
|
|
4
4
|
import "./jsx-runtime-944c88e2.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
2
|
import { B as l } from "./useBuilderProp-81a14920.js";
|
|
3
3
|
import { A as n, a as d, b as a, e as p, f as c, h as u } from "./alert-dialog-ee98f47e.js";
|
|
4
|
-
import { a4 as h } from "./index-
|
|
4
|
+
import { a4 as h } from "./index-088a9534.js";
|
|
5
5
|
import { TrashIcon as x } from "@radix-ui/react-icons";
|
|
6
6
|
import "react";
|
|
7
7
|
import "@radix-ui/react-slot";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("./useBuilderProp-5e57d0c8.cjs"),r=require("./alert-dialog-4ce6ed22.cjs"),d=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("./useBuilderProp-5e57d0c8.cjs"),r=require("./alert-dialog-4ce6ed22.cjs"),d=require("./index-e2dad9ec.cjs"),c=require("@radix-ui/react-icons");require("react");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-alert-dialog");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=({pageData:i,projectData:s})=>{const n={},t=d.useDeletePage(),u=i.uuid===s.homepage,o=()=>{t.mutate(i,{onSuccess:()=>{n({uuid:s.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:u,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${u?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx(c.TrashIcon,{})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(l.Button,{variant:"destructive",onClick:o,disabled:t.isPending,children:"Yes, Delete"})]})]})]})};exports.default=x;
|
|
@@ -27488,7 +27488,7 @@ const uZ = () => {
|
|
|
27488
27488
|
const a = pr(e);
|
|
27489
27489
|
Cf(a) && (n = [a, ...pL(t, a)]), r(n);
|
|
27490
27490
|
}, [e, t, r]);
|
|
27491
|
-
}, FZ = () => Ge(fA), bL = Fn(() => import("./SidePanels-
|
|
27491
|
+
}, FZ = () => Ge(fA), bL = Fn(() => import("./SidePanels-ffe30d1c.js")), gL = Fn(() => import("./Topbar-4e04e218.js")), mL = Fn(() => import("./CanvasArea-a6706381.js")), vL = Fn(() => import("./Settings-a3117310.js")), yL = () => {
|
|
27492
27492
|
const [e] = Me(Oc), t = (r) => {
|
|
27493
27493
|
r.preventDefault();
|
|
27494
27494
|
};
|
|
@@ -28743,7 +28743,7 @@ function hW() {
|
|
|
28743
28743
|
};
|
|
28744
28744
|
return nW(om(om({}, t), e));
|
|
28745
28745
|
}
|
|
28746
|
-
const bW = "@chaibuilder/sdk", gW = "0.1.
|
|
28746
|
+
const bW = "@chaibuilder/sdk", gW = "0.1.24", mW = "module", vW = [
|
|
28747
28747
|
"dist"
|
|
28748
28748
|
], yW = "dist/core.js", wW = !1, SW = {
|
|
28749
28749
|
".": {
|
|
@@ -28843,12 +28843,12 @@ const bW = "@chaibuilder/sdk", gW = "0.1.22", mW = "module", vW = [
|
|
|
28843
28843
|
"lucide-react": "^0.244.0",
|
|
28844
28844
|
nanoid: "^4.0.2",
|
|
28845
28845
|
"post-robot": "10.0.46",
|
|
28846
|
-
react: "^18
|
|
28846
|
+
react: "^18",
|
|
28847
28847
|
"react-autosuggest": "10.1.0",
|
|
28848
28848
|
"react-colorful": "5.6.1",
|
|
28849
28849
|
"react-dnd": "16.0.1",
|
|
28850
28850
|
"react-dnd-html5-backend": "16.0.1",
|
|
28851
|
-
"react-dom": "^18
|
|
28851
|
+
"react-dom": "^18",
|
|
28852
28852
|
"react-hotkeys-hook": "4.4.1",
|
|
28853
28853
|
"react-i18next": "13.0.1",
|
|
28854
28854
|
"react-icons": "^4.10.1",
|
|
@@ -30826,7 +30826,7 @@ const ls = () => {
|
|
|
30826
30826
|
})).json();
|
|
30827
30827
|
}
|
|
30828
30828
|
});
|
|
30829
|
-
}, vK = Fn(() => import("./PagesPanel-
|
|
30829
|
+
}, vK = Fn(() => import("./PagesPanel-dba3d5fa.js")), yK = Fn(() => import("./ProjectPanel-b7c44110.js")), wK = Fn(() => import("./CurrentPage-36e1f888.js")), SK = () => /* @__PURE__ */ oe.jsx("h2", { children: "Your Logo" }), AK = () => {
|
|
30830
30830
|
const e = Pr();
|
|
30831
30831
|
return /* @__PURE__ */ oe.jsx("div", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ oe.jsx(
|
|
30832
30832
|
kE,
|
|
@@ -30857,7 +30857,7 @@ const ls = () => {
|
|
|
30857
30857
|
blocks: (o == null ? void 0 : o.blocks) || [],
|
|
30858
30858
|
brandingOptions: t.brandingOptions,
|
|
30859
30859
|
darkMode: e.darkMode || !1,
|
|
30860
|
-
dataProviders:
|
|
30860
|
+
dataProviders: (o == null ? void 0 : o.providers) || [],
|
|
30861
30861
|
onSavePage: async ({ blocks: v, providers: w }) => (console.log({ blocks: v, providers: w }), i({ blocks: v, providers: w, uuid: l }), !0),
|
|
30862
30862
|
onSaveBrandingOptions: async (v) => (s({ brandingOptions: v }), !0),
|
|
30863
30863
|
topBarComponents: {
|