@chaibuilder/sdk 0.1.32 → 1.0.0
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-4f054351.cjs +3 -0
- package/dist/{AddBlocks-4b96d545.js → AddBlocks-f6836e71.js} +5 -4
- package/dist/{BrandingOptions-c91e9d44.js → BrandingOptions-33e6da26.js} +6 -5
- package/dist/BrandingOptions-cfa79ffe.cjs +1 -0
- package/dist/{CanvasArea-957f5f74.js → CanvasArea-1e5fa968.js} +42 -43
- package/dist/CanvasArea-971b3ff8.cjs +46 -0
- package/dist/{CurrentPage-fb4c55bc.js → CurrentPage-223cc3dd.js} +5 -4
- package/dist/CurrentPage-b2d12d83.cjs +1 -0
- package/dist/{ImagesPanel-3fb8087f.js → ImagesPanel-47ac13c3.js} +1 -1
- package/dist/{ImagesPanel-56ca0618.cjs → ImagesPanel-8b7a989d.cjs} +1 -1
- package/dist/Layers-860f5e42.cjs +1 -0
- package/dist/{Layers-6866cb0c.js → Layers-b2c5aa66.js} +48 -47
- package/dist/MarkAsGlobalBlock-1a3d5e53.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-f28148d9.js → MarkAsGlobalBlock-9b0135aa.js} +8 -7
- package/dist/{PagesPanel-003201ca.js → PagesPanel-034efd4c.js} +8 -7
- package/dist/PagesPanel-2a80f9b2.cjs +1 -0
- package/dist/{ProjectPanel-83321040.js → ProjectPanel-3827a349.js} +7 -6
- package/dist/ProjectPanel-5deae7f1.cjs +1 -0
- package/dist/Settings-9f61cc69.cjs +1 -0
- package/dist/{Settings-ad55d8cb.js → Settings-a2d4e9c2.js} +82 -79
- package/dist/SidePanels-0d276d29.cjs +1 -0
- package/dist/{SidePanels-96bf29c6.js → SidePanels-b881185b.js} +33 -34
- package/dist/Topbar-68a0d125.cjs +1 -0
- package/dist/{Topbar-1c4964e5.js → Topbar-fda7588e.js} +38 -37
- package/dist/{UnsplashImages-fe480747.js → UnsplashImages-4edb97e7.js} +6 -5
- package/dist/UnsplashImages-98c085c2.cjs +1 -0
- package/dist/{UploadImages-b14bd152.js → UploadImages-52181c3e.js} +9 -8
- package/dist/UploadImages-61ef83ad.cjs +1 -0
- package/dist/{add-page-modal-2ef8a63c.js → add-page-modal-38af4548.js} +11 -10
- package/dist/add-page-modal-fb51b45b.cjs +1 -0
- package/dist/confirm-alert-c1fdf1e4.js +35 -0
- package/dist/confirm-alert-e1ea5110.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +56 -55
- package/dist/delete-page-modal-305c49fd.cjs +1 -0
- package/dist/{delete-page-modal-961dcc5f.js → delete-page-modal-a226ed3a.js} +18 -19
- package/dist/{form-046bcdbc.js → form-25e1af37.js} +1 -1
- package/dist/{form-2dc05f35.cjs → form-ea21db6c.cjs} +1 -1
- package/dist/{index-86352d44.cjs → index-6fc652ec.cjs} +41 -41
- package/dist/{index-370ce00c.js → index-914d197c.js} +7239 -7070
- package/dist/{link-e71b94f1.cjs → link-24679521.cjs} +1 -1
- package/dist/{link-e3a788f7.js → link-57de608a.js} +2 -2
- package/dist/{page-viewer-0c45ce74.js → page-viewer-682940be.js} +17 -16
- package/dist/page-viewer-857a82f4.cjs +1 -0
- package/dist/{project-general-setting-c5d96f79.js → project-general-setting-0fa55bb9.js} +9 -8
- package/dist/project-general-setting-280ccd16.cjs +1 -0
- package/dist/project-seo-setting-6eef8387.cjs +1 -0
- package/dist/{project-seo-setting-639e4f33.js → project-seo-setting-d81fc1e3.js} +7 -6
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +4 -2
- package/dist/server.js +27 -23
- package/dist/{single-page-detail-22e7bc3b.js → single-page-detail-8b715650.js} +11 -10
- package/dist/single-page-detail-b9c4ac1e.cjs +1 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +105 -106
- package/dist/useBuilderProp-21feb2da.js +296 -0
- package/dist/useBuilderProp-adacf42f.cjs +1 -0
- package/package.json +1 -1
- package/dist/AddBlocks-e4f51b58.cjs +0 -3
- package/dist/BrandingOptions-52f9691c.cjs +0 -1
- package/dist/CanvasArea-b8c26858.cjs +0 -46
- package/dist/CurrentPage-715fe809.cjs +0 -1
- package/dist/Layers-a955d0bb.cjs +0 -1
- package/dist/MarkAsGlobalBlock-cbcb3003.cjs +0 -1
- package/dist/PagesPanel-7b8f54e1.cjs +0 -1
- package/dist/ProjectPanel-6c5f2470.cjs +0 -1
- package/dist/Settings-8f07a4b7.cjs +0 -1
- package/dist/SidePanels-446b93e7.cjs +0 -1
- package/dist/Topbar-5eeea40a.cjs +0 -1
- package/dist/UnsplashImages-ef3b6388.cjs +0 -1
- package/dist/UploadImages-10439fde.cjs +0 -1
- package/dist/add-page-modal-56dc3c56.cjs +0 -1
- package/dist/alert-dialog-4ce6ed22.cjs +0 -1
- package/dist/alert-dialog-ee98f47e.js +0 -64
- package/dist/confirm-alert-4f50caa7.cjs +0 -1
- package/dist/confirm-alert-f2a47cc7.js +0 -36
- package/dist/delete-page-modal-88aeacfd.cjs +0 -1
- package/dist/page-viewer-e0d9895d.cjs +0 -1
- package/dist/project-general-setting-d4d96611.cjs +0 -1
- package/dist/project-seo-setting-6356c72f.cjs +0 -1
- package/dist/single-page-detail-36430438.cjs +0 -1
- package/dist/useBuilderProp-5e57d0c8.cjs +0 -1
- package/dist/useBuilderProp-81a14920.js +0 -238
|
@@ -3,16 +3,16 @@ import { PlusIcon as V, Half2Icon as E } from "@radix-ui/react-icons";
|
|
|
3
3
|
import h, { useMemo as L, useState as u, useEffect as M, lazy as N, Suspense as j } from "react";
|
|
4
4
|
import { useAtom as w } from "jotai";
|
|
5
5
|
import { filter as g, map as k, isNull as H, isEmpty as I, find as R, each as _, get as F } from "lodash";
|
|
6
|
-
import { u as C, B as b, S as D } from "./useBuilderProp-
|
|
7
|
-
import { T as
|
|
8
|
-
import { u as
|
|
6
|
+
import { A as O, b as Y, d as U, e as $, f as J, g as Z, h as q, i as G, k as Q, u as C, B as b, S as D } from "./useBuilderProp-21feb2da.js";
|
|
7
|
+
import { T as W, a as X, b as A, c as P } from "./tabs-85caa1e8.js";
|
|
8
|
+
import { u as ee, p as se, E as re, a as ae, b as le } from "./index-914d197c.js";
|
|
9
9
|
import "react-i18next";
|
|
10
|
-
import { c as
|
|
11
|
-
import { ListTreeIcon as S, DatabaseIcon as
|
|
12
|
-
import { getChaiDataProviders as
|
|
13
|
-
import { A as X, a as ee, b as se, c as re, e as ae, f as le, d as ie, h as te, g as oe } from "./alert-dialog-ee98f47e.js";
|
|
10
|
+
import { c as ie } from "./utils-ac68b2c8.js";
|
|
11
|
+
import { ListTreeIcon as S, DatabaseIcon as te } from "lucide-react";
|
|
12
|
+
import { getChaiDataProviders as oe } from "@chaibuilder/blocks";
|
|
14
13
|
import { D as ne, b as ce, c as de, e as me, f as xe } from "./dialog-18207bef.js";
|
|
15
14
|
import { S as ue, c as pe, b as he, d as fe, f as T } from "./select-7fddd7c3.js";
|
|
15
|
+
import "@radix-ui/react-alert-dialog";
|
|
16
16
|
import "@radix-ui/react-slot";
|
|
17
17
|
import "class-variance-authority";
|
|
18
18
|
import "@radix-ui/react-tooltip";
|
|
@@ -35,7 +35,6 @@ import "redux-undo";
|
|
|
35
35
|
import "@react-hookz/web";
|
|
36
36
|
import "sonner";
|
|
37
37
|
import "tailwind-merge";
|
|
38
|
-
import "@radix-ui/react-alert-dialog";
|
|
39
38
|
import "@radix-ui/react-dialog";
|
|
40
39
|
import "@radix-ui/react-select";
|
|
41
40
|
const ve = h.lazy(() => import("react-json-view")), je = ({ provider: r, onClose: o }) => {
|
|
@@ -50,7 +49,7 @@ const ve = h.lazy(() => import("react-json-view")), je = ({ provider: r, onClose
|
|
|
50
49
|
] }),
|
|
51
50
|
/* @__PURE__ */ e.jsx(xe, { children: r.description })
|
|
52
51
|
] }),
|
|
53
|
-
/* @__PURE__ */ e.jsx(
|
|
52
|
+
/* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx(
|
|
54
53
|
ve,
|
|
55
54
|
{
|
|
56
55
|
style: { maxHeight: "80vh", overflowY: "auto" },
|
|
@@ -68,26 +67,26 @@ function ge({
|
|
|
68
67
|
name: o,
|
|
69
68
|
onRemove: a
|
|
70
69
|
}) {
|
|
71
|
-
return /* @__PURE__ */ e.jsxs(
|
|
72
|
-
/* @__PURE__ */ e.jsx(
|
|
73
|
-
/* @__PURE__ */ e.jsxs(
|
|
74
|
-
/* @__PURE__ */ e.jsxs(
|
|
75
|
-
/* @__PURE__ */ e.jsxs(
|
|
70
|
+
return /* @__PURE__ */ e.jsxs(O, { children: [
|
|
71
|
+
/* @__PURE__ */ e.jsx(Y, { asChild: !0, children: r }),
|
|
72
|
+
/* @__PURE__ */ e.jsxs(U, { children: [
|
|
73
|
+
/* @__PURE__ */ e.jsxs($, { children: [
|
|
74
|
+
/* @__PURE__ */ e.jsxs(J, { children: [
|
|
76
75
|
"Are you sure, you want to remove ",
|
|
77
76
|
/* @__PURE__ */ e.jsx("span", { className: "text-blue-500", children: o }),
|
|
78
77
|
" provider?"
|
|
79
78
|
] }),
|
|
80
|
-
/* @__PURE__ */ e.jsx(
|
|
79
|
+
/* @__PURE__ */ e.jsx(Z, { children: "Your data provider will be removed from this page and all added data binding will be not visible on blocks." })
|
|
81
80
|
] }),
|
|
82
|
-
/* @__PURE__ */ e.jsxs(
|
|
83
|
-
/* @__PURE__ */ e.jsx(
|
|
84
|
-
/* @__PURE__ */ e.jsx(
|
|
81
|
+
/* @__PURE__ */ e.jsxs(q, { children: [
|
|
82
|
+
/* @__PURE__ */ e.jsx(G, { children: "Cancel" }),
|
|
83
|
+
/* @__PURE__ */ e.jsx(Q, { onClick: a, className: "bg-red-600 hover:bg-red-700", children: "Remove" })
|
|
85
84
|
] })
|
|
86
85
|
] })
|
|
87
86
|
] });
|
|
88
87
|
}
|
|
89
88
|
const be = () => {
|
|
90
|
-
const r = L(() =>
|
|
89
|
+
const r = L(() => oe(), []), [o, a] = ee(), [, n] = w(se), [i, c] = u(
|
|
91
90
|
g(r, (s) => k(o, "providerKey").includes(s.providerKey))
|
|
92
91
|
), [m, y] = u(""), [f, t] = u(null), v = g(
|
|
93
92
|
r.map((s) => k(i, "providerKey").includes(s.providerKey) ? null : { value: s.providerKey, label: s.name }),
|
|
@@ -186,11 +185,11 @@ const be = () => {
|
|
|
186
185
|
/* @__PURE__ */ e.jsx(je, { onClose: () => t(null), provider: f })
|
|
187
186
|
] })
|
|
188
187
|
] });
|
|
189
|
-
},
|
|
190
|
-
let
|
|
191
|
-
const
|
|
192
|
-
const r = C("sideBarComponents.top", []), o = C("sideBarComponents.bottom", []), [a, n] = w(
|
|
193
|
-
layers:
|
|
188
|
+
}, z = N(() => import("./Layers-b2c5aa66.js")), ye = N(() => import("./BrandingOptions-33e6da26.js")), we = N(() => import("./ImagesPanel-47ac13c3.js"));
|
|
189
|
+
let K = null;
|
|
190
|
+
const ns = () => {
|
|
191
|
+
const r = C("sideBarComponents.top", []), o = C("sideBarComponents.bottom", []), [a, n] = w(ae), [i, c] = u(a), [m, y] = u(null), f = {
|
|
192
|
+
layers: z,
|
|
194
193
|
"branding-options": ye,
|
|
195
194
|
images: we
|
|
196
195
|
};
|
|
@@ -198,11 +197,11 @@ const cs = () => {
|
|
|
198
197
|
f[l] = p;
|
|
199
198
|
});
|
|
200
199
|
const t = (l) => {
|
|
201
|
-
clearTimeout(
|
|
202
|
-
}, [, v] = w(
|
|
200
|
+
clearTimeout(K), v(!1), a !== "layers" && l === "layers" ? K = setTimeout(() => c("layers"), 500) : c(l), n(l);
|
|
201
|
+
}, [, v] = w(le);
|
|
203
202
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
204
203
|
/* @__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: [
|
|
205
|
-
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14
|
|
204
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: [
|
|
206
205
|
/* @__PURE__ */ e.jsx(
|
|
207
206
|
b,
|
|
208
207
|
{
|
|
@@ -245,7 +244,7 @@ const cs = () => {
|
|
|
245
244
|
) }))
|
|
246
245
|
)
|
|
247
246
|
] }),
|
|
248
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center space-y-2", children: h.Children.toArray(
|
|
247
|
+
/* @__PURE__ */ e.jsx("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: h.Children.toArray(
|
|
249
248
|
o.map((l) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(D, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(l, {}) }))
|
|
250
249
|
) })
|
|
251
250
|
] }),
|
|
@@ -273,7 +272,7 @@ const cs = () => {
|
|
|
273
272
|
children: /* @__PURE__ */ e.jsx(
|
|
274
273
|
"div",
|
|
275
274
|
{
|
|
276
|
-
className:
|
|
275
|
+
className: ie("relative h-full max-h-[93%] bg-background p-1", a === "layers" ? "" : "z-[100]"),
|
|
277
276
|
onMouseEnter: () => {
|
|
278
277
|
m && clearTimeout(m);
|
|
279
278
|
},
|
|
@@ -298,14 +297,14 @@ const cs = () => {
|
|
|
298
297
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
299
298
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
300
299
|
] }),
|
|
301
|
-
children: /* @__PURE__ */ e.jsxs(
|
|
302
|
-
/* @__PURE__ */ e.jsxs(
|
|
300
|
+
children: /* @__PURE__ */ e.jsxs(W, { defaultValue: "layers", className: "flex h-full w-full flex-col py-1", children: [
|
|
301
|
+
/* @__PURE__ */ e.jsxs(X, { className: "mx-1 h-10 grid grid-cols-2", children: [
|
|
303
302
|
/* @__PURE__ */ e.jsxs(A, { value: "layers", children: [
|
|
304
303
|
/* @__PURE__ */ e.jsx(S, { className: "h-3 mr-2" }),
|
|
305
304
|
" Layers"
|
|
306
305
|
] }),
|
|
307
306
|
/* @__PURE__ */ e.jsxs(A, { value: "data-provider", children: [
|
|
308
|
-
/* @__PURE__ */ e.jsx(
|
|
307
|
+
/* @__PURE__ */ e.jsx(te, { className: "w-3 mr-2" }),
|
|
309
308
|
"Data"
|
|
310
309
|
] })
|
|
311
310
|
] }),
|
|
@@ -314,7 +313,7 @@ const cs = () => {
|
|
|
314
313
|
{
|
|
315
314
|
value: "layers",
|
|
316
315
|
className: "no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",
|
|
317
|
-
children: h.createElement(
|
|
316
|
+
children: h.createElement(z)
|
|
318
317
|
}
|
|
319
318
|
),
|
|
320
319
|
/* @__PURE__ */ e.jsx(P, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(be, {}) })
|
|
@@ -324,5 +323,5 @@ const cs = () => {
|
|
|
324
323
|
] });
|
|
325
324
|
};
|
|
326
325
|
export {
|
|
327
|
-
|
|
326
|
+
ns as default
|
|
328
327
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),o=require("@radix-ui/react-icons"),r=require("./select-0e32300c.cjs"),s=require("./useBuilderProp-adacf42f.cjs"),a=require("./separator-a597dba7.cjs"),c=require("./toggle-b90fed97.cjs"),p=require("./index-6fc652ec.cjs"),m=require("react-i18next");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-alert-dialog");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("sonner");require("lucide-react");const j=()=>s.useBuilderProp("languages",["en"]),d=()=>j().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(o.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"})]})})]})}),h=()=>{const{savePage:x,syncState:t}=p.useSavePage(),{t:u}=m.useTranslation(),l=n.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(c.Toggle,{onClick:()=>x(),className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${l}`,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"})})]})})},g=()=>{const x=s.useBuilderProp("topBarComponents.left",[]),t=s.useBuilderProp("topBarComponents.center",[]),u=s.useBuilderProp("topBarComponents.right",[]),l=s.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:n.Children.toArray(x.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(t.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(d,{}),e.jsxRuntimeExports.jsx(a.Separator,{orientation:"vertical"}),l?e.jsxRuntimeExports.jsx(h,{}):null,n.Children.toArray(u.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))]})]})};exports.default=g;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
2
|
-
import
|
|
3
|
-
import { FontFamilyIcon as
|
|
4
|
-
import { S as
|
|
5
|
-
import { u as
|
|
6
|
-
import { S as
|
|
7
|
-
import { T as
|
|
8
|
-
import { c as
|
|
9
|
-
import { useTranslation as
|
|
2
|
+
import o, { useMemo as p, Suspense as c } from "react";
|
|
3
|
+
import { FontFamilyIcon as x } from "@radix-ui/react-icons";
|
|
4
|
+
import { S as d, c as h, b as u, d as g, a as j, e as f, f as t } from "./select-7fddd7c3.js";
|
|
5
|
+
import { u as a, l as v, m as S, n as b, S as m } from "./useBuilderProp-21feb2da.js";
|
|
6
|
+
import { S as N } from "./separator-a80d065b.js";
|
|
7
|
+
import { T as C } from "./toggle-00c9d11e.js";
|
|
8
|
+
import { c as w } from "./index-914d197c.js";
|
|
9
|
+
import { useTranslation as y } from "react-i18next";
|
|
10
10
|
import "@radix-ui/react-select";
|
|
11
11
|
import "./utils-ac68b2c8.js";
|
|
12
12
|
import "clsx";
|
|
13
13
|
import "tailwind-merge";
|
|
14
|
+
import "@radix-ui/react-alert-dialog";
|
|
14
15
|
import "@radix-ui/react-slot";
|
|
15
16
|
import "class-variance-authority";
|
|
16
17
|
import "@radix-ui/react-tooltip";
|
|
@@ -34,29 +35,29 @@ import "himalaya";
|
|
|
34
35
|
import "redux-undo";
|
|
35
36
|
import "@react-hookz/web";
|
|
36
37
|
import "@chaibuilder/blocks";
|
|
37
|
-
import "lucide-react";
|
|
38
38
|
import "sonner";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
import "lucide-react";
|
|
40
|
+
const A = () => a("languages", ["en"]), T = () => A().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(d, { children: [
|
|
41
|
+
/* @__PURE__ */ e.jsx(h, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
42
|
+
u,
|
|
42
43
|
{
|
|
43
44
|
placeholder: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
44
|
-
/* @__PURE__ */ e.jsx(
|
|
45
|
+
/* @__PURE__ */ e.jsx(x, { className: "h-4 w-4" }),
|
|
45
46
|
" English(US)"
|
|
46
47
|
] })
|
|
47
48
|
}
|
|
48
49
|
) }),
|
|
49
|
-
/* @__PURE__ */ e.jsx(
|
|
50
|
-
/* @__PURE__ */ e.jsx(
|
|
50
|
+
/* @__PURE__ */ e.jsx(g, { children: /* @__PURE__ */ e.jsxs(j, { children: [
|
|
51
|
+
/* @__PURE__ */ e.jsx(f, { children: "Fruits" }),
|
|
51
52
|
/* @__PURE__ */ e.jsx(t, { value: "apple", children: "Apple" }),
|
|
52
53
|
/* @__PURE__ */ e.jsx(t, { value: "banana", children: "Banana" }),
|
|
53
54
|
/* @__PURE__ */ e.jsx(t, { value: "blueberry", children: "Blueberry" }),
|
|
54
55
|
/* @__PURE__ */ e.jsx(t, { value: "grapes", children: "Grapes" }),
|
|
55
56
|
/* @__PURE__ */ e.jsx(t, { value: "pineapple", children: "Pineapple" })
|
|
56
57
|
] }) })
|
|
57
|
-
] }) }),
|
|
58
|
-
const { savePage:
|
|
59
|
-
switch (
|
|
58
|
+
] }) }), B = () => {
|
|
59
|
+
const { savePage: l, syncState: r } = w(), { t: i } = y(), n = p(() => {
|
|
60
|
+
switch (r) {
|
|
60
61
|
case "SAVING":
|
|
61
62
|
return "animate-pulse bg-gray-500 text-gray-900";
|
|
62
63
|
case "SAVED":
|
|
@@ -64,13 +65,13 @@ const y = () => i("languages", ["en"]), A = () => y().length === 1 ? null : /* @
|
|
|
64
65
|
default:
|
|
65
66
|
return "bg-gray-200 text-gray-500 hover:bg-gray-100";
|
|
66
67
|
}
|
|
67
|
-
}, [
|
|
68
|
-
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(
|
|
69
|
-
/* @__PURE__ */ e.jsx(
|
|
70
|
-
|
|
68
|
+
}, [r]);
|
|
69
|
+
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(v, { children: [
|
|
70
|
+
/* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
71
|
+
C,
|
|
71
72
|
{
|
|
72
|
-
onClick: () =>
|
|
73
|
-
className: `flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${
|
|
73
|
+
onClick: () => l(),
|
|
74
|
+
className: `flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${n}`,
|
|
74
75
|
size: "sm",
|
|
75
76
|
variant: "outline",
|
|
76
77
|
children: [
|
|
@@ -81,31 +82,31 @@ const y = () => i("languages", ["en"]), A = () => y().length === 1 ? null : /* @
|
|
|
81
82
|
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"
|
|
82
83
|
}
|
|
83
84
|
) }),
|
|
84
|
-
|
|
85
|
+
r === "SAVING" ? "Saving..." : r === "SAVED" ? i("Saved") : "Save"
|
|
85
86
|
]
|
|
86
87
|
}
|
|
87
88
|
) }),
|
|
88
|
-
/* @__PURE__ */ e.jsx(
|
|
89
|
+
/* @__PURE__ */ e.jsx(b, { children: /* @__PURE__ */ e.jsx("p", { children: r === "SAVING" ? "Saving..." : r === "SAVED" ? "Saved" : "Save changes" }) })
|
|
89
90
|
] }) });
|
|
90
|
-
},
|
|
91
|
-
const
|
|
91
|
+
}, he = () => {
|
|
92
|
+
const l = a("topBarComponents.left", []), r = a("topBarComponents.center", []), i = a("topBarComponents.right", []), n = a("editable", !0);
|
|
92
93
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
93
|
-
/* @__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:
|
|
94
|
-
|
|
94
|
+
/* @__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(
|
|
95
|
+
l.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
95
96
|
) }) }),
|
|
96
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children:
|
|
97
|
-
|
|
97
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: o.Children.toArray(
|
|
98
|
+
r.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
98
99
|
) }),
|
|
99
100
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
100
|
-
/* @__PURE__ */ e.jsx(A, {}),
|
|
101
|
-
/* @__PURE__ */ e.jsx(b, { orientation: "vertical" }),
|
|
102
101
|
/* @__PURE__ */ e.jsx(T, {}),
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
/* @__PURE__ */ e.jsx(N, { orientation: "vertical" }),
|
|
103
|
+
n ? /* @__PURE__ */ e.jsx(B, {}) : null,
|
|
104
|
+
o.Children.toArray(
|
|
105
|
+
i.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
105
106
|
)
|
|
106
107
|
] })
|
|
107
108
|
] });
|
|
108
109
|
};
|
|
109
110
|
export {
|
|
110
|
-
|
|
111
|
+
he as default
|
|
111
112
|
};
|
|
@@ -3,7 +3,7 @@ import { useState as d, useEffect as D } from "react";
|
|
|
3
3
|
import { isEmpty as p, startCase as E } from "lodash";
|
|
4
4
|
import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
|
|
5
5
|
import { createApi as B } from "unsplash-js";
|
|
6
|
-
import { u as F, B as K } from "./useBuilderProp-
|
|
6
|
+
import { u as F, B as K } from "./useBuilderProp-21feb2da.js";
|
|
7
7
|
import { I as U } from "./command-6f260f61.js";
|
|
8
8
|
import { S as V } from "./scroll-area-83bd9e8f.js";
|
|
9
9
|
import { P as O, a as Q, b as H } from "./popover-f7addcf4.js";
|
|
@@ -11,11 +11,12 @@ import { S as P, c as S, b as C, d as I, f as h } from "./select-7fddd7c3.js";
|
|
|
11
11
|
import "react-i18next";
|
|
12
12
|
import { useDebouncedState as R } from "@react-hookz/web";
|
|
13
13
|
import { Loader as $ } from "lucide-react";
|
|
14
|
-
import "@radix-ui/react-
|
|
15
|
-
import "class-variance-authority";
|
|
14
|
+
import "@radix-ui/react-alert-dialog";
|
|
16
15
|
import "./utils-ac68b2c8.js";
|
|
17
16
|
import "clsx";
|
|
18
17
|
import "tailwind-merge";
|
|
18
|
+
import "@radix-ui/react-slot";
|
|
19
|
+
import "class-variance-authority";
|
|
19
20
|
import "@radix-ui/react-tooltip";
|
|
20
21
|
import "@radix-ui/react-toast";
|
|
21
22
|
import "jotai";
|
|
@@ -29,7 +30,7 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
29
30
|
B({ accessKey: g }).search.getPhotos(x).then((l) => {
|
|
30
31
|
o(l);
|
|
31
32
|
}).catch((l) => r(l));
|
|
32
|
-
}),
|
|
33
|
+
}), Ne = ({ isModalView: x, onSelect: g }) => {
|
|
33
34
|
const o = F("unsplashAccessKey"), [r, j] = d([]), [l, v] = d(0), [n, A] = d(), [i, q] = d(), [z, y] = d(0), [u, T] = R("", 1e3), [f, c] = d(!1), _ = async (s) => {
|
|
34
35
|
if (p(u))
|
|
35
36
|
return;
|
|
@@ -179,6 +180,6 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
179
180
|
] });
|
|
180
181
|
};
|
|
181
182
|
export {
|
|
182
|
-
|
|
183
|
+
Ne as default,
|
|
183
184
|
k as fetchImage
|
|
184
185
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),o=require("lodash"),k=require("@radix-ui/react-icons"),T=require("unsplash-js"),b=require("./useBuilderProp-adacf42f.cjs"),z=require("./command-b1103666.cjs"),_=require("./scroll-area-bb343b86.cjs"),g=require("./popover-7cb9079b.cjs"),t=require("./select-0e32300c.cjs");require("react-i18next");const D=require("@react-hookz/web"),L=require("lucide-react");require("@radix-ui/react-alert-dialog");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("cmdk");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("@radix-ui/react-scroll-area");require("@radix-ui/react-popover");require("@radix-ui/react-select");const R=async(d,E)=>new Promise((l,a)=>{T.createApi({accessKey:E}).search.getPhotos(d).then(c=>{l(c)}).catch(c=>a(c))}),V=({isModalView:d,onSelect:E})=>{const l=b.useBuilderProp("unsplashAccessKey"),[a,f]=i.useState([]),[c,y]=i.useState(0),[x,I]=i.useState(),[u,w]=i.useState(),[P,v]=i.useState(0),[j,C]=D.useDebouncedState("",1e3),[h,m]=i.useState(!1),A=async s=>{if(o.isEmpty(j))return;let n=c+1;s&&(s.preventDefault(),n=1),m(!0),y(n);const p={query:j,page:n};x&&(p.orientation=x),u&&(p.color=u),R(p,l).then(r=>{var q,N,S;f(n===1?((q=r==null?void 0:r.response)==null?void 0:q.results)||[]:[...a,...((N=r==null?void 0:r.response)==null?void 0:N.results)||[]]),v((S=r==null?void 0:r.response)==null?void 0:S.total_pages),m(!1)}).catch(()=>{m(!1)})};return i.useEffect(()=>{if(!o.isEmpty(j)){m(!0);const s={query:j,page:1};x&&(s.orientation=x),u&&(s.color=u),y(1),R(s,l).then(n=>{var p,r;f(((p=n==null?void 0:n.response)==null?void 0:p.results)||[]),v((r=n==null?void 0:n.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[x,u,j,l]),o.isEmpty(l)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"underline px-1 hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(z.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>C(s.target.value)}),e.jsxRuntimeExports.jsxs(g.Popover,{children:[e.jsxRuntimeExports.jsx(g.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(k.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(g.PopoverContent,{side:d?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:x,onValueChange:s=>I(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:u,onValueChange:s=>w(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:o.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(_.ScrollArea,{className:`h-full ${d&&!o.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[o.isEmpty(a)&&!h&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),d?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>E(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):a.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),h&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(L.Loader,{className:"animate-spin w-6 h-6"})," Loading..."]}),!o.isEmpty(a)&&c<P&&!h&&e.jsxRuntimeExports.jsx(b.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>A(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=V;exports.fetchImage=R;
|
|
@@ -5,22 +5,23 @@ import { GearIcon as C, UploadIcon as U, Cross1Icon as k } from "@radix-ui/react
|
|
|
5
5
|
import { atom as F, useAtom as E } from "jotai";
|
|
6
6
|
import { S as A } from "./scroll-area-83bd9e8f.js";
|
|
7
7
|
import "react-i18next";
|
|
8
|
-
import { u as j } from "./useBuilderProp-
|
|
8
|
+
import { u as j } from "./useBuilderProp-21feb2da.js";
|
|
9
9
|
import "@radix-ui/react-scroll-area";
|
|
10
10
|
import "./utils-ac68b2c8.js";
|
|
11
11
|
import "clsx";
|
|
12
12
|
import "tailwind-merge";
|
|
13
|
+
import "@radix-ui/react-alert-dialog";
|
|
13
14
|
import "@radix-ui/react-slot";
|
|
14
15
|
import "class-variance-authority";
|
|
15
16
|
import "@radix-ui/react-tooltip";
|
|
16
17
|
import "@radix-ui/react-toast";
|
|
17
|
-
const R = F([]),
|
|
18
|
-
const v = j("uploadMediaCallback", () => ""), d = j("fetchMediaCallback", () => []), [l, a] = E(R), [r, u] = i(!1), [
|
|
18
|
+
const R = F([]), X = ({ isModalView: s, onSelect: n }) => {
|
|
19
|
+
const v = j("uploadMediaCallback", () => ""), d = j("fetchMediaCallback", () => []), [l, a] = E(R), [r, u] = i(!1), [p, x] = i(!1), [c, m] = i(), [f, y] = i("");
|
|
19
20
|
w(() => {
|
|
20
21
|
(async () => {
|
|
21
|
-
|
|
22
|
+
x(!0);
|
|
22
23
|
const t = await d();
|
|
23
|
-
a(t || []),
|
|
24
|
+
a(t || []), x(!1);
|
|
24
25
|
})();
|
|
25
26
|
}, [d, a]);
|
|
26
27
|
const N = (t) => {
|
|
@@ -85,8 +86,8 @@ const R = F([]), W = ({ isModalView: s, onSelect: n }) => {
|
|
|
85
86
|
/* @__PURE__ */ e.jsx("input", { type: "file", id: s ? "upload-in-modal" : "upload-in-panel", hidden: !0, onChange: N })
|
|
86
87
|
] }),
|
|
87
88
|
/* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${s ? "px-2" : ""} pt-2`, children: [
|
|
88
|
-
g(l) &&
|
|
89
|
-
g(l) && !
|
|
89
|
+
g(l) && p && /* @__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..." }) }),
|
|
90
|
+
g(l) && !p && /* @__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" }) }),
|
|
90
91
|
s ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(l, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => n(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
91
92
|
"img",
|
|
92
93
|
{
|
|
@@ -109,5 +110,5 @@ const R = F([]), W = ({ isModalView: s, onSelect: n }) => {
|
|
|
109
110
|
] });
|
|
110
111
|
};
|
|
111
112
|
export {
|
|
112
|
-
|
|
113
|
+
X as default
|
|
113
114
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),t=require("react"),a=require("lodash"),m=require("@radix-ui/react-icons"),E=require("jotai"),q=require("./scroll-area-bb343b86.cjs");require("react-i18next");const b=require("./useBuilderProp-adacf42f.cjs");require("@radix-ui/react-scroll-area");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const I=E.atom([]),w=({isModalView:r,onSelect:u})=>{const R=b.useBuilderProp("uploadMediaCallback",()=>""),c=b.useBuilderProp("fetchMediaCallback",()=>[]),[n,o]=E.useAtom(I),[l,p]=t.useState(!1),[j,h]=t.useState(!1),[x,d]=t.useState(),[f,v]=t.useState("");t.useEffect(()=>{(async()=>{h(!0);const s=await c();o(s||[]),h(!1)})()},[c,o]);const y=s=>{var i,g;s&&((g=(i=s==null?void 0:s.target)==null?void 0:i.files)==null?void 0:g.length)>0&&d(s.target.files[0])},N=async()=>{p(!0);try{const{url:s}=await R(x);u(s),d(void 0);const i=await c();o(i)}catch(s){o([]),v((s==null?void 0:s.message)||"Something went wrong.")}p(!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"}),f&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:f}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:N,disabled:l,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:[l?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"})," ",l?"Uploading...":"Upload"]}),!l&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.Cross1Icon,{})," Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:r?"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:r?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:y})]}),e.jsxRuntimeExports.jsxs(q.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${r?"px-2":""} pt-2`,children:[a.isEmpty(n)&&j&&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..."})}),a.isEmpty(n)&&!j&&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"})}),r?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>u(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))}):a.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>u(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=w;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-944c88e2.js";
|
|
2
2
|
import { useState as g } from "react";
|
|
3
3
|
import { kebabCase as j } from "lodash";
|
|
4
|
-
import { B as c } from "./useBuilderProp-
|
|
4
|
+
import { B as c } from "./useBuilderProp-21feb2da.js";
|
|
5
5
|
import { D as b, a as C, b as A } from "./dialog-18207bef.js";
|
|
6
6
|
import { SingleLineText as d } from "@chaibuilder/blocks";
|
|
7
|
-
import { F as D } from "./form-
|
|
8
|
-
import { a0 as N } from "./index-
|
|
9
|
-
import "@radix-ui/react-
|
|
10
|
-
import "class-variance-authority";
|
|
7
|
+
import { F as D } from "./form-25e1af37.js";
|
|
8
|
+
import { a0 as N } from "./index-914d197c.js";
|
|
9
|
+
import "@radix-ui/react-alert-dialog";
|
|
11
10
|
import "./utils-ac68b2c8.js";
|
|
12
11
|
import "clsx";
|
|
13
12
|
import "tailwind-merge";
|
|
13
|
+
import "@radix-ui/react-slot";
|
|
14
|
+
import "class-variance-authority";
|
|
14
15
|
import "@radix-ui/react-tooltip";
|
|
15
16
|
import "@radix-ui/react-icons";
|
|
16
17
|
import "@radix-ui/react-toast";
|
|
@@ -18,10 +19,10 @@ import "jotai";
|
|
|
18
19
|
import "@radix-ui/react-dialog";
|
|
19
20
|
import "@rjsf/core";
|
|
20
21
|
import "@rjsf/validator-ajv8";
|
|
21
|
-
import "./link-
|
|
22
|
+
import "./link-57de608a.js";
|
|
22
23
|
import "react-icons-picker";
|
|
23
24
|
import "react-dom";
|
|
24
|
-
import "./ImagesPanel-
|
|
25
|
+
import "./ImagesPanel-47ac13c3.js";
|
|
25
26
|
import "./tabs-85caa1e8.js";
|
|
26
27
|
import "@radix-ui/react-tabs";
|
|
27
28
|
import "react-quill";
|
|
@@ -39,8 +40,8 @@ import "./html-to-json-45e0e3b5.js";
|
|
|
39
40
|
import "himalaya";
|
|
40
41
|
import "redux-undo";
|
|
41
42
|
import "@react-hookz/web";
|
|
42
|
-
import "lucide-react";
|
|
43
43
|
import "sonner";
|
|
44
|
+
import "lucide-react";
|
|
44
45
|
const S = ({ closeModal: o }) => {
|
|
45
46
|
var s, p;
|
|
46
47
|
const i = N(), [e, u] = g({
|
|
@@ -82,7 +83,7 @@ const S = ({ closeModal: o }) => {
|
|
|
82
83
|
}
|
|
83
84
|
) })
|
|
84
85
|
] });
|
|
85
|
-
},
|
|
86
|
+
}, xt = () => {
|
|
86
87
|
const [o, i] = g(!1);
|
|
87
88
|
return /* @__PURE__ */ t.jsxs(b, { open: o, onOpenChange: () => i(!o), children: [
|
|
88
89
|
/* @__PURE__ */ t.jsx(C, { children: /* @__PURE__ */ t.jsx(c, { size: "sm", variant: "link", className: "text-blue-500", onClick: () => i(!o), children: "+ New Page" }) }),
|
|
@@ -90,5 +91,5 @@ const S = ({ closeModal: o }) => {
|
|
|
90
91
|
] });
|
|
91
92
|
};
|
|
92
93
|
export {
|
|
93
|
-
|
|
94
|
+
xt as default
|
|
94
95
|
};
|
|
@@ -0,0 +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-adacf42f.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-ea21db6c.cjs"),f=require("./index-6fc652ec.cjs");require("@radix-ui/react-alert-dialog");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-icons");require("@radix-ui/react-toast");require("jotai");require("@radix-ui/react-dialog");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-24679521.cjs");require("react-icons-picker");require("react-dom");require("./ImagesPanel-8b7a989d.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("sonner");require("lucide-react");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;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { j as i } from "./jsx-runtime-944c88e2.js";
|
|
2
|
+
import { A as n, d as p, f as c, g as x, i as d, B as j } from "./useBuilderProp-21feb2da.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "@radix-ui/react-alert-dialog";
|
|
5
|
+
import "./utils-ac68b2c8.js";
|
|
6
|
+
import "clsx";
|
|
7
|
+
import "tailwind-merge";
|
|
8
|
+
import "@radix-ui/react-slot";
|
|
9
|
+
import "class-variance-authority";
|
|
10
|
+
import "@radix-ui/react-tooltip";
|
|
11
|
+
import "@radix-ui/react-icons";
|
|
12
|
+
import "@radix-ui/react-toast";
|
|
13
|
+
import "jotai";
|
|
14
|
+
import "lodash";
|
|
15
|
+
const S = ({
|
|
16
|
+
open: o,
|
|
17
|
+
onCancel: e = () => {
|
|
18
|
+
},
|
|
19
|
+
onConfirm: l,
|
|
20
|
+
title: s,
|
|
21
|
+
description: r,
|
|
22
|
+
disabled: t,
|
|
23
|
+
cancelText: a = "Discard",
|
|
24
|
+
confirmText: m = "Save"
|
|
25
|
+
}) => /* @__PURE__ */ i.jsx(n, { open: o, children: /* @__PURE__ */ i.jsxs(p, { children: [
|
|
26
|
+
/* @__PURE__ */ i.jsx(c, { children: s }),
|
|
27
|
+
r && /* @__PURE__ */ i.jsx(x, { children: r }),
|
|
28
|
+
/* @__PURE__ */ i.jsxs("div", { className: "flex items-center justify-end gap-x-3", children: [
|
|
29
|
+
/* @__PURE__ */ i.jsx(d, { disabled: t, onClick: e, children: a }),
|
|
30
|
+
/* @__PURE__ */ i.jsx(j, { variant: "default", onClick: l, disabled: t, children: m })
|
|
31
|
+
] })
|
|
32
|
+
] }) });
|
|
33
|
+
export {
|
|
34
|
+
S as default
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),r=require("./useBuilderProp-adacf42f.cjs");require("react");require("@radix-ui/react-alert-dialog");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-icons");require("@radix-ui/react-toast");require("jotai");require("lodash");const c=({open:s,onCancel:u=()=>{},onConfirm:n,title:l,description:i,disabled:t,cancelText:o="Discard",confirmText:x="Save"})=>e.jsxRuntimeExports.jsx(r.AlertDialog,{open:s,children:e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:l}),i&&e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:i}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:t,onClick:u,children:o}),e.jsxRuntimeExports.jsx(r.Button,{variant:"default",onClick:n,disabled:t,children:x})]})]})});exports.default=c;
|
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-6fc652ec.cjs"),s=require("./useBuilderProp-adacf42f.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("sonner");require("lucide-react");require("@radix-ui/react-alert-dialog");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.d.ts
CHANGED
|
@@ -45,8 +45,9 @@ export declare type ChaiBlock = {
|
|
|
45
45
|
export declare const ChaiBuilderEditor: (props: ChaiBuilderEditorProps) => JSX_2.Element;
|
|
46
46
|
|
|
47
47
|
export declare interface ChaiBuilderEditorProps {
|
|
48
|
-
apiKey?: string;
|
|
49
48
|
blocks?: ChaiBlock[];
|
|
49
|
+
editable?: boolean;
|
|
50
|
+
nonEditableComponent?: ReactComponents;
|
|
50
51
|
brandingOptions?: Record<string, string>;
|
|
51
52
|
canvas?: React_2.FC<any>;
|
|
52
53
|
previewLink?: string;
|