@chaibuilder/sdk 1.2.22 → 1.2.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-l1JENNvq.js +206 -0
- package/dist/AddBlocks-zPPKkeKs.cjs +1 -0
- package/dist/BrandingOptions-DkpqGARR.cjs +1 -0
- package/dist/{BrandingOptions-4961TxX2.js → BrandingOptions-udtH5yJs.js} +11 -10
- package/dist/CanvasArea-IqeMbtOf.js +951 -0
- package/dist/CanvasArea-plZTWifU.cjs +55 -0
- package/dist/{Class-MmCxz2Ay.cjs → Class-PoYusiA5.cjs} +1 -1
- package/dist/{Class-3k8xjeiM.js → Class-lGzsNBOK.js} +1 -1
- package/dist/CurrentPage-7_s9LtEJ.cjs +1 -0
- package/dist/{CurrentPage-oPZN6Gwj.js → CurrentPage-AA0XHYMU.js} +23 -24
- package/dist/ListTree-LAN7QmHQ.cjs +1 -0
- package/dist/ListTree-ZNEtds1d.js +309 -0
- package/dist/MODIFIERS-0g14w5RS.cjs +1 -0
- package/dist/{MODIFIERS-WQdaNvb8.js → MODIFIERS-dytZ-osO.js} +4 -8
- package/dist/PagesPanel-5qMZBatP.cjs +1 -0
- package/dist/{PagesPanel-pRKHw-AZ.js → PagesPanel-883P3_su.js} +9 -10
- package/dist/{ProjectPanel-iU6DY-Yp.js → ProjectPanel-Y8Qcmsn0.js} +11 -12
- package/dist/ProjectPanel-otQb9ceP.cjs +1 -0
- package/dist/STRINGS--j49GZJP.js +7 -0
- package/dist/STRINGS-gPz7CUOk.cjs +1 -0
- package/dist/Settings-Rt342VJ3.cjs +1 -0
- package/dist/{Settings-BhSrj-cE.js → Settings-pIePR1Id.js} +862 -865
- package/dist/{SidePanels-OLOUpKn4.js → SidePanels-NznSn5RN.js} +121 -125
- package/dist/SidePanels-PaQkgjLa.cjs +1 -0
- package/dist/Topbar-CqW7G360.cjs +1 -0
- package/dist/{Topbar-Ny9T-7Zb.js → Topbar-pWzBEOed.js} +39 -35
- package/dist/UnsplashImages-NGskB93R.cjs +1 -0
- package/dist/{UnsplashImages-Y8RGFVSh.js → UnsplashImages-qvwFbV-E.js} +17 -16
- package/dist/{UploadImages-dd8LfyFr.js → UploadImages-9NapgXBq.js} +12 -11
- package/dist/UploadImages-Oh7Glr9A.cjs +1 -0
- package/dist/{add-page-modal-Jni6CY1x.js → add-page-modal-4PiRJgX5.js} +11 -12
- package/dist/add-page-modal-4o2L_7T7.cjs +1 -0
- package/dist/confirm-alert-C4M9eF-o.cjs +1 -0
- package/dist/{confirm-alert-sc8RaWvD.js → confirm-alert-GUhZ_G8w.js} +7 -6
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +5 -3
- package/dist/core.js +48 -49
- package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
- package/dist/{defaultTheme-gunU_Fe5.js → defaultTheme-D8B4-wHO.js} +1 -1
- package/dist/{delete-page-modal-0WiMZFxr.js → delete-page-modal-4l5-RhQB.js} +10 -11
- package/dist/delete-page-modal-Bek5bCf-.cjs +1 -0
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +3 -1
- package/dist/email.js +16 -16
- package/dist/{form-Nj6Kdn3g.js → form-STUz-6nE.js} +1 -1
- package/dist/{form-n1Q6u16z.cjs → form-lBQ_76Uw.cjs} +1 -1
- package/dist/html-to-json-efmv1pCj.cjs +1 -0
- package/dist/{html-to-json-C5sExaSD.js → html-to-json-ngX9ef2u.js} +31 -29
- package/dist/{index-IPJAbzzO.js → index-Gk6sASBd.js} +1242 -1213
- package/dist/{index-0bwkNnA0.cjs → index-dgm-fd8U.cjs} +42 -42
- package/dist/{index-UP_4awU9.js → index-gS-3liKK.js} +4479 -4484
- package/dist/index-h-hd6EvN.cjs +1 -0
- package/dist/index-oCYKBYyT.cjs +1 -0
- package/dist/{index-_VPpjzJu.js → index-xZWaF8AW.js} +118 -119
- package/dist/lib.cjs +3 -3
- package/dist/lib.js +17 -16
- package/dist/page-viewer-JlKEwACu.cjs +1 -0
- package/dist/{page-viewer-L1Dmgj-c.js → page-viewer-rCXavxpd.js} +15 -16
- package/dist/project-general-setting-2FGoUZ-z.cjs +1 -0
- package/dist/{project-general-setting-sUP7JqWK.js → project-general-setting-rmAVpDu9.js} +11 -12
- package/dist/project-seo-setting-mlxL_e2_.cjs +1 -0
- package/dist/{project-seo-setting-NNvAGt4T.js → project-seo-setting-pX34Qsym.js} +8 -7
- package/dist/render.cjs +1 -1
- package/dist/render.js +14 -13
- package/dist/single-page-detail-c6-wRWyN.cjs +1 -0
- package/dist/{single-page-detail-FXg_NebW.js → single-page-detail-rSQomrY5.js} +12 -13
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +3 -1
- package/dist/studio.js +8 -9
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +139 -138
- package/dist/web-blocks.cjs +6 -1
- package/dist/web-blocks.js +462 -354
- package/package.json +3 -5
- package/dist/AddBlocks-157fSrJX.cjs +0 -1
- package/dist/AddBlocks-WgpssWmQ.js +0 -223
- package/dist/BrandingOptions-nwXR9TMl.cjs +0 -1
- package/dist/CanvasArea-MajWGr9z.js +0 -908
- package/dist/CanvasArea-MmTlc5Vb.cjs +0 -55
- package/dist/CurrentPage-LpLr0lDI.cjs +0 -1
- package/dist/ListTree-dvxHTXs4.js +0 -167
- package/dist/ListTree-gTmusfso.cjs +0 -1
- package/dist/MODIFIERS-9EwxLM8V.cjs +0 -1
- package/dist/Outline-2OxsXs1-.js +0 -294
- package/dist/Outline-7CCnnzmK.cjs +0 -1
- package/dist/PagesPanel-8536oBWB.cjs +0 -1
- package/dist/ProjectPanel-oILsUWOH.cjs +0 -1
- package/dist/Settings-jHiYmt0y.cjs +0 -1
- package/dist/SidePanels-bcJJocSq.cjs +0 -1
- package/dist/Topbar-NMvzqQHW.cjs +0 -1
- package/dist/TypeIcon-ElNNPazl.cjs +0 -1
- package/dist/TypeIcon-qO96rNbV.js +0 -69
- package/dist/UnsplashImages-6tZv1q2_.cjs +0 -1
- package/dist/UploadImages-VLlVg9Ur.cjs +0 -1
- package/dist/add-page-modal-IsqDdK7X.cjs +0 -1
- package/dist/confirm-alert-f26zJ7Js.cjs +0 -1
- package/dist/defaultTheme-7Lk2zq60.cjs +0 -1
- package/dist/delete-page-modal-c3b-GCap.cjs +0 -1
- package/dist/html-to-json-FGufPv9R.cjs +0 -1
- package/dist/index-9PHdn80L.cjs +0 -1
- package/dist/index-nwAgi0aD.cjs +0 -1
- package/dist/page-viewer-TnxHhq7S.cjs +0 -1
- package/dist/project-general-setting-1Ot1RU43.cjs +0 -1
- package/dist/project-seo-setting-3-vBkx2v.cjs +0 -1
- package/dist/single-page-detail-btEKYXjE.cjs +0 -1
- package/dist/useAddBlockByDrop-V8xo-PNQ.js +0 -20
- package/dist/useAddBlockByDrop-qRHgy8_0.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as c } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import z, { useMemo as
|
|
3
|
-
import { FontFamilyIcon as
|
|
4
|
-
import { h as
|
|
5
|
-
import { G as
|
|
2
|
+
import z, { useMemo as o, Suspense as n } from "react";
|
|
3
|
+
import { FontFamilyIcon as M, EyeOpenIcon as u } from "@radix-ui/react-icons";
|
|
4
|
+
import { h as r, aj as d, ak as C, al as L, am as m, ay as p, az as F, an as i, z as w, B as g, q as B, S as v, aA as f } from "./index-Gk6sASBd.js";
|
|
5
|
+
import { G as x } from "./index-YpnaudSM.js";
|
|
6
6
|
import { useTranslation as e } from "react-i18next";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
8
|
import "lodash-es";
|
|
@@ -11,11 +11,12 @@ import "clsx";
|
|
|
11
11
|
import "tailwind-merge";
|
|
12
12
|
import "@chaibuilder/runtime";
|
|
13
13
|
import "jotai";
|
|
14
|
-
import "./
|
|
14
|
+
import "./STRINGS--j49GZJP.js";
|
|
15
15
|
import "@react-hookz/web";
|
|
16
|
+
import "./MODIFIERS-dytZ-osO.js";
|
|
17
|
+
import "./Class-lGzsNBOK.js";
|
|
16
18
|
import "@radix-ui/react-toggle";
|
|
17
19
|
import "class-variance-authority";
|
|
18
|
-
import "./Class-3k8xjeiM.js";
|
|
19
20
|
import "@radix-ui/react-switch";
|
|
20
21
|
import "@radix-ui/react-slot";
|
|
21
22
|
import "@radix-ui/react-accordion";
|
|
@@ -37,18 +38,18 @@ import "@radix-ui/react-context-menu";
|
|
|
37
38
|
import "react-icons-picker";
|
|
38
39
|
import "react-dom";
|
|
39
40
|
import "react-quill";
|
|
40
|
-
const
|
|
41
|
-
/* @__PURE__ */ c.jsx(
|
|
42
|
-
|
|
41
|
+
const S = () => r("languages", ["en"]), A = () => S().length === 1 ? null : /* @__PURE__ */ c.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ c.jsxs(d, { children: [
|
|
42
|
+
/* @__PURE__ */ c.jsx(C, { className: "w-[150px] border-0", children: /* @__PURE__ */ c.jsx(
|
|
43
|
+
L,
|
|
43
44
|
{
|
|
44
45
|
placeholder: /* @__PURE__ */ c.jsxs("span", { className: "flex items-center", children: [
|
|
45
|
-
/* @__PURE__ */ c.jsx(
|
|
46
|
+
/* @__PURE__ */ c.jsx(M, { className: "h-4 w-4" }),
|
|
46
47
|
" English(US)"
|
|
47
48
|
] })
|
|
48
49
|
}
|
|
49
50
|
) }),
|
|
50
|
-
/* @__PURE__ */ c.jsx(
|
|
51
|
-
/* @__PURE__ */ c.jsx(
|
|
51
|
+
/* @__PURE__ */ c.jsx(m, { children: /* @__PURE__ */ c.jsxs(p, { children: [
|
|
52
|
+
/* @__PURE__ */ c.jsx(F, { children: "Fruits" }),
|
|
52
53
|
/* @__PURE__ */ c.jsx(i, { value: "apple", children: "Apple" }),
|
|
53
54
|
/* @__PURE__ */ c.jsx(i, { value: "banana", children: "Banana" }),
|
|
54
55
|
/* @__PURE__ */ c.jsx(i, { value: "blueberry", children: "Blueberry" }),
|
|
@@ -56,11 +57,11 @@ const x = () => s("languages", ["en"]), S = () => x().length === 1 ? null : /* @
|
|
|
56
57
|
/* @__PURE__ */ c.jsx(i, { value: "pineapple", children: "Pineapple" })
|
|
57
58
|
] }) })
|
|
58
59
|
] }) });
|
|
59
|
-
function
|
|
60
|
-
return
|
|
60
|
+
function R(l) {
|
|
61
|
+
return x({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z" } }] })(l);
|
|
61
62
|
}
|
|
62
|
-
const
|
|
63
|
-
const { savePage: l,
|
|
63
|
+
const k = () => {
|
|
64
|
+
const { savePage: l, saveState: t } = w(), { t: s } = e(), h = r("hideSaveButton", !1), a = o(() => {
|
|
64
65
|
switch (t) {
|
|
65
66
|
case "SAVING":
|
|
66
67
|
return "animate-pulse bg-gray-300 text-gray-900";
|
|
@@ -69,42 +70,45 @@ const R = () => {
|
|
|
69
70
|
default:
|
|
70
71
|
return "bg-gray-200 text-gray-500 hover:bg-gray-100";
|
|
71
72
|
}
|
|
72
|
-
}, [t])
|
|
73
|
+
}, [t]);
|
|
74
|
+
if (h)
|
|
75
|
+
return null;
|
|
76
|
+
const H = /* @__PURE__ */ c.jsxs(
|
|
73
77
|
g,
|
|
74
78
|
{
|
|
75
79
|
disabled: t === "SAVING",
|
|
76
|
-
onClick: (
|
|
77
|
-
|
|
80
|
+
onClick: (V) => {
|
|
81
|
+
V.preventDefault(), l();
|
|
78
82
|
},
|
|
79
|
-
className: `flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${
|
|
83
|
+
className: `flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${a}`,
|
|
80
84
|
size: "sm",
|
|
81
85
|
variant: "outline",
|
|
82
86
|
children: [
|
|
83
|
-
/* @__PURE__ */ c.jsx(
|
|
84
|
-
/* @__PURE__ */ c.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." :
|
|
87
|
+
/* @__PURE__ */ c.jsx(R, { className: "text-lg" }),
|
|
88
|
+
/* @__PURE__ */ c.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : s(t === "SAVED" ? "Saved" : "Unsaved") })
|
|
85
89
|
]
|
|
86
90
|
}
|
|
87
91
|
);
|
|
88
|
-
return /* @__PURE__ */ c.jsx("div", { className: "flex items-center", children:
|
|
89
|
-
},
|
|
90
|
-
const t =
|
|
92
|
+
return /* @__PURE__ */ c.jsx("div", { className: "flex items-center", children: H });
|
|
93
|
+
}, P = function() {
|
|
94
|
+
const t = r("previewComponent"), [, s] = B(), { t: h } = e();
|
|
91
95
|
return t ? /* @__PURE__ */ c.jsxs(
|
|
92
96
|
g,
|
|
93
97
|
{
|
|
94
98
|
onClick: (a) => {
|
|
95
|
-
a.preventDefault(),
|
|
99
|
+
a.preventDefault(), s(!0);
|
|
96
100
|
},
|
|
97
101
|
className: "flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",
|
|
98
102
|
size: "sm",
|
|
99
103
|
variant: "outline",
|
|
100
104
|
children: [
|
|
101
|
-
/* @__PURE__ */ c.jsx(
|
|
105
|
+
/* @__PURE__ */ c.jsx(u, { className: "text-xs" }),
|
|
102
106
|
/* @__PURE__ */ c.jsx("span", { className: "text-sm", children: h("Preview") })
|
|
103
107
|
]
|
|
104
108
|
}
|
|
105
109
|
) : null;
|
|
106
|
-
},
|
|
107
|
-
const l =
|
|
110
|
+
}, C1 = () => {
|
|
111
|
+
const l = r("topBarComponents.left", []), t = r("topBarComponents.center", []), s = r("topBarComponents.right", []), h = r("editable", !0);
|
|
108
112
|
return /* @__PURE__ */ c.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
109
113
|
/* @__PURE__ */ c.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ c.jsx("div", { className: "flex items-center space-x-2 font-bold", children: z.Children.toArray(
|
|
110
114
|
l.map((a) => /* @__PURE__ */ c.jsx(n, { fallback: /* @__PURE__ */ c.jsx(v, { className: "h-10" }), children: /* @__PURE__ */ c.jsx(a, {}) }))
|
|
@@ -113,16 +117,16 @@ const R = () => {
|
|
|
113
117
|
t.map((a) => /* @__PURE__ */ c.jsx(n, { fallback: /* @__PURE__ */ c.jsx(v, { className: "h-10" }), children: /* @__PURE__ */ c.jsx(a, {}) }))
|
|
114
118
|
) }),
|
|
115
119
|
/* @__PURE__ */ c.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
116
|
-
/* @__PURE__ */ c.jsx(
|
|
117
|
-
/* @__PURE__ */ c.jsx(
|
|
118
|
-
/* @__PURE__ */ c.jsx(
|
|
119
|
-
h ? /* @__PURE__ */ c.jsx(
|
|
120
|
+
/* @__PURE__ */ c.jsx(A, {}),
|
|
121
|
+
/* @__PURE__ */ c.jsx(P, {}),
|
|
122
|
+
/* @__PURE__ */ c.jsx(f, { orientation: "vertical" }),
|
|
123
|
+
h ? /* @__PURE__ */ c.jsx(k, {}) : null,
|
|
120
124
|
z.Children.toArray(
|
|
121
|
-
|
|
125
|
+
s.map((a) => /* @__PURE__ */ c.jsx(n, { fallback: /* @__PURE__ */ c.jsx(v, { className: "h-10" }), children: /* @__PURE__ */ c.jsx(a, {}) }))
|
|
122
126
|
)
|
|
123
127
|
] })
|
|
124
128
|
] });
|
|
125
129
|
};
|
|
126
130
|
export {
|
|
127
|
-
|
|
131
|
+
C1 as default
|
|
128
132
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("react"),l=require("lodash-es"),C=require("@radix-ui/react-icons"),k=require("unsplash-js"),t=require("./index-h-hd6EvN.cjs"),A=require("@react-hookz/web"),T=require("lucide-react");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("./MODIFIERS-0g14w5RS.cjs");require("./Class-PoYusiA5.cjs");require("react-i18next");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");const g=async(d,E)=>new Promise((a,n)=>{k.createApi({accessKey:E}).search.getPhotos(d).then(c=>{a(c)}).catch(c=>n(c))}),z=({isModalView:d,onSelect:E})=>{const a=t.useBuilderProp("unsplashAccessKey",""),[n,f]=o.useState([]),[c,q]=o.useState(0),[u,S]=o.useState(),[x,b]=o.useState(),[I,R]=o.useState(0),[j,w]=A.useDebouncedState("",1e3),[h,m]=o.useState(!1),P=async s=>{if(l.isEmpty(j))return;let i=c+1;s&&(s.preventDefault(),i=1),m(!0),q(i);const p={query:j,page:i};u&&(p.orientation=u),x&&(p.color=x),g(p,a).then(r=>{var y,v,N;f(i===1?((y=r==null?void 0:r.response)==null?void 0:y.results)||[]:[...n,...((v=r==null?void 0:r.response)==null?void 0:v.results)||[]]),R((N=r==null?void 0:r.response)==null?void 0:N.total_pages),m(!1)}).catch(()=>{m(!1)})};return o.useEffect(()=>{if(!l.isEmpty(j)&&a){m(!0);const s={query:j,page:1};u&&(s.orientation=u),x&&(s.color=x),q(1),g(s,a).then(i=>{var p,r;f(((p=i==null?void 0:i.response)==null?void 0:p.results)||[]),R((r=i==null?void 0:i.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[u,x,j,a]),l.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"underline px-1 hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(t.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>w(s.target.value)}),e.jsxRuntimeExports.jsxs(t.Popover,{children:[e.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(C.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(t.PopoverContent,{side:d?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:u,onValueChange:s=>S(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:x,onValueChange:s=>b(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(t.ScrollArea,{className:`h-full ${d&&!l.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(n)&&!h&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),d?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>E(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):n.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),h&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(T.Loader,{className:"animate-spin w-6 h-6"})," Loading..."]}),!l.isEmpty(n)&&c<I&&!h&&e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>P(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=z;exports.fetchImage=g;
|
|
@@ -3,7 +3,7 @@ import { useState as p, useEffect as D } from "react";
|
|
|
3
3
|
import { isEmpty as d, startCase as E } from "lodash-es";
|
|
4
4
|
import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
|
|
5
5
|
import { createApi as V } from "unsplash-js";
|
|
6
|
-
import { h as B, bd as F, aV as K, aW as U, aX as O, aj as P, ak as C, al as S, am as k, an as h, bf as Q, B as H } from "./index-
|
|
6
|
+
import { h as B, bd as F, aV as K, aW as U, aX as O, aj as P, ak as C, al as S, am as k, an as h, bf as Q, B as H } from "./index-Gk6sASBd.js";
|
|
7
7
|
import { useDebouncedState as R } from "@react-hookz/web";
|
|
8
8
|
import { Loader as W } from "lucide-react";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -12,10 +12,12 @@ import "clsx";
|
|
|
12
12
|
import "tailwind-merge";
|
|
13
13
|
import "@chaibuilder/runtime";
|
|
14
14
|
import "jotai";
|
|
15
|
-
import "./
|
|
15
|
+
import "./STRINGS--j49GZJP.js";
|
|
16
|
+
import "./MODIFIERS-dytZ-osO.js";
|
|
17
|
+
import "./Class-lGzsNBOK.js";
|
|
18
|
+
import "react-i18next";
|
|
16
19
|
import "@radix-ui/react-toggle";
|
|
17
20
|
import "class-variance-authority";
|
|
18
|
-
import "./Class-3k8xjeiM.js";
|
|
19
21
|
import "@radix-ui/react-switch";
|
|
20
22
|
import "@radix-ui/react-slot";
|
|
21
23
|
import "@radix-ui/react-accordion";
|
|
@@ -37,19 +39,18 @@ import "@radix-ui/react-context-menu";
|
|
|
37
39
|
import "react-icons-picker";
|
|
38
40
|
import "react-dom";
|
|
39
41
|
import "react-quill";
|
|
40
|
-
import "react-i18next";
|
|
41
42
|
const I = async (x, g) => new Promise((o, r) => {
|
|
42
|
-
V({ accessKey: g }).search.getPhotos(x).then((
|
|
43
|
-
o(
|
|
44
|
-
}).catch((
|
|
45
|
-
}),
|
|
46
|
-
const o = B("unsplashAccessKey", ""), [r, j] = p([]), [
|
|
43
|
+
V({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
44
|
+
o(i);
|
|
45
|
+
}).catch((i) => r(i));
|
|
46
|
+
}), De = ({ isModalView: x, onSelect: g }) => {
|
|
47
|
+
const o = B("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [z, y] = p(0), [u, T] = R("", 1e3), [f, c] = p(!1), _ = async (s) => {
|
|
47
48
|
if (d(u))
|
|
48
49
|
return;
|
|
49
|
-
let t =
|
|
50
|
+
let t = i + 1;
|
|
50
51
|
s && (s.preventDefault(), t = 1), c(!0), v(t);
|
|
51
52
|
const m = { query: u, page: t };
|
|
52
|
-
|
|
53
|
+
l && (m.orientation = l), n && (m.color = n), I(m, o).then((a) => {
|
|
53
54
|
var N, b, w;
|
|
54
55
|
j(t === 1 ? ((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || [] : [...r, ...((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || []]), y((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), c(!1);
|
|
55
56
|
}).catch(() => {
|
|
@@ -60,14 +61,14 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
60
61
|
if (!d(u) && o) {
|
|
61
62
|
c(!0);
|
|
62
63
|
const s = { query: u, page: 1 };
|
|
63
|
-
|
|
64
|
+
l && (s.orientation = l), n && (s.color = n), v(1), I(s, o).then((t) => {
|
|
64
65
|
var m, a;
|
|
65
66
|
j(((m = t == null ? void 0 : t.response) == null ? void 0 : m.results) || []), y((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), c(!1);
|
|
66
67
|
}).catch(() => {
|
|
67
68
|
c(!1);
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
}, [
|
|
71
|
+
}, [l, n, u, o]), d(o) ? /* @__PURE__ */ e.jsx("div", { className: "h-full flex flex-col items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
|
|
71
72
|
"To enable Unsplash, kindly provide your",
|
|
72
73
|
/* @__PURE__ */ e.jsx(
|
|
73
74
|
"a",
|
|
@@ -100,7 +101,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
100
101
|
className: "z-[9999] flex w-max items-center justify-center",
|
|
101
102
|
children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
102
103
|
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
103
|
-
/* @__PURE__ */ e.jsxs(P, { defaultValue:
|
|
104
|
+
/* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => A(s), children: [
|
|
104
105
|
/* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
105
106
|
/* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
|
|
106
107
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
@@ -175,7 +176,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
175
176
|
/* @__PURE__ */ e.jsx(W, { className: "animate-spin w-6 h-6" }),
|
|
176
177
|
" Loading..."
|
|
177
178
|
] }),
|
|
178
|
-
!d(r) &&
|
|
179
|
+
!d(r) && i < z && !f && /* @__PURE__ */ e.jsx(
|
|
179
180
|
H,
|
|
180
181
|
{
|
|
181
182
|
size: "sm",
|
|
@@ -192,6 +193,6 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
192
193
|
] });
|
|
193
194
|
};
|
|
194
195
|
export {
|
|
195
|
-
|
|
196
|
+
De as default,
|
|
196
197
|
I as fetchImage
|
|
197
198
|
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as i, useEffect as w } from "react";
|
|
3
3
|
import { isEmpty as b, map as j } from "lodash-es";
|
|
4
4
|
import { GearIcon as C, UploadIcon as U, Cross1Icon as k } from "@radix-ui/react-icons";
|
|
5
5
|
import { atom as F, useAtom as E } from "jotai";
|
|
6
|
-
import { h as v, bf as A } from "./index-
|
|
6
|
+
import { h as v, bf as A } from "./index-Gk6sASBd.js";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
8
|
import "./Functions-7jnEwJyw.js";
|
|
9
9
|
import "clsx";
|
|
10
10
|
import "tailwind-merge";
|
|
11
11
|
import "@chaibuilder/runtime";
|
|
12
|
-
import "./
|
|
12
|
+
import "./STRINGS--j49GZJP.js";
|
|
13
13
|
import "@react-hookz/web";
|
|
14
|
+
import "./MODIFIERS-dytZ-osO.js";
|
|
15
|
+
import "./Class-lGzsNBOK.js";
|
|
16
|
+
import "react-i18next";
|
|
14
17
|
import "@radix-ui/react-toggle";
|
|
15
18
|
import "class-variance-authority";
|
|
16
|
-
import "./Class-3k8xjeiM.js";
|
|
17
19
|
import "@radix-ui/react-switch";
|
|
18
20
|
import "@radix-ui/react-slot";
|
|
19
21
|
import "@radix-ui/react-accordion";
|
|
@@ -35,9 +37,8 @@ import "@radix-ui/react-context-menu";
|
|
|
35
37
|
import "react-icons-picker";
|
|
36
38
|
import "react-dom";
|
|
37
39
|
import "react-quill";
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const p = v("uploadMediaCallback"), n = v("fetchMediaCallback"), [s, m] = E(R), [o, u] = a(!1), [x, f] = a(!1), [d, c] = a(), [h, y] = a("");
|
|
40
|
+
const R = F([]), ge = ({ isModalView: r, onSelect: a }) => {
|
|
41
|
+
const p = v("uploadMediaCallback"), n = v("fetchMediaCallback"), [s, m] = E(R), [o, u] = i(!1), [x, f] = i(!1), [d, c] = i(), [h, y] = i("");
|
|
41
42
|
w(() => {
|
|
42
43
|
(async () => {
|
|
43
44
|
if (!n)
|
|
@@ -55,7 +56,7 @@ const R = F([]), he = ({ isModalView: r, onSelect: i }) => {
|
|
|
55
56
|
u(!0);
|
|
56
57
|
try {
|
|
57
58
|
const { url: t } = await p(d);
|
|
58
|
-
|
|
59
|
+
a(t), c(void 0);
|
|
59
60
|
const l = await n();
|
|
60
61
|
m(l);
|
|
61
62
|
} catch (t) {
|
|
@@ -113,7 +114,7 @@ const R = F([]), he = ({ isModalView: r, onSelect: i }) => {
|
|
|
113
114
|
/* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
|
|
114
115
|
b(s) && x && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "animate-pulse font-medium", children: "Fetching..." }) }),
|
|
115
116
|
b(s) && !x && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Images" }) }),
|
|
116
|
-
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: j(s, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () =>
|
|
117
|
+
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: j(s, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => a(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
117
118
|
"img",
|
|
118
119
|
{
|
|
119
120
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
@@ -122,7 +123,7 @@ const R = F([]), he = ({ isModalView: r, onSelect: i }) => {
|
|
|
122
123
|
}
|
|
123
124
|
) }) }, t.id)) }) : j(s, (t) => (
|
|
124
125
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
125
|
-
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () =>
|
|
126
|
+
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => a(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
126
127
|
"img",
|
|
127
128
|
{
|
|
128
129
|
className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
@@ -135,5 +136,5 @@ const R = F([]), he = ({ isModalView: r, onSelect: i }) => {
|
|
|
135
136
|
] });
|
|
136
137
|
};
|
|
137
138
|
export {
|
|
138
|
-
|
|
139
|
+
ge as default
|
|
139
140
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("react"),l=require("lodash-es"),m=require("@radix-ui/react-icons"),E=require("jotai"),p=require("./index-h-hd6EvN.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-0g14w5RS.cjs");require("./Class-PoYusiA5.cjs");require("react-i18next");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");const N=E.atom([]),I=({isModalView:t,onSelect:a})=>{const j=p.useBuilderProp("uploadMediaCallback"),u=p.useBuilderProp("fetchMediaCallback"),[i,x]=E.useAtom(N),[n,f]=s.useState(!1),[h,g]=s.useState(!1),[c,d]=s.useState(),[b,R]=s.useState("");s.useEffect(()=>{(async()=>{if(!u)return;g(!0);const r=await u();x(r||[]),g(!1)})()},[]);const v=r=>{var o,q;r&&((q=(o=r==null?void 0:r.target)==null?void 0:o.files)==null?void 0:q.length)>0&&d(r.target.files[0])},y=async()=>{if(j){f(!0);try{const{url:r}=await j(c);a(r),d(void 0);const o=await u();x(o)}catch(r){x([]),R((r==null?void 0:r.message)||"Something went wrong.")}f(!1)}};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[c?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(c),alt:"",className:"h-auto max-h-96 w-full max-w-sm rounded-md object-contain"}),b&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:b}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:y,disabled:n,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[n?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"})," ",n?"Uploading...":"Upload"]}),!n&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.Cross1Icon,{})," Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:t?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:t?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:v})]}),e.jsxRuntimeExports.jsxs(p.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${t?"px-2":""} pt-2`,children:[l.isEmpty(i)&&h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:"Fetching..."})}),l.isEmpty(i)&&!h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),t?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:l.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>a(r.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:r.name,src:r.thumbUrl})})},r.id))}):l.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>a(r.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:r.name,src:r.url})})},r.id))]})]})};exports.default=I;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import { useState as c } from "react";
|
|
3
3
|
import { kebabCase as j } from "lodash-es";
|
|
4
|
-
import { ae as C, B as u, ad as b, ao as A } from "./index-
|
|
4
|
+
import { ae as C, B as u, ad as b, ao as A } from "./index-Gk6sASBd.js";
|
|
5
5
|
import { u as g } from "./controls-OfJWSEqC.js";
|
|
6
|
-
import { F as D } from "./form-
|
|
7
|
-
import { e as N } from "./index-
|
|
6
|
+
import { F as D } from "./form-STUz-6nE.js";
|
|
7
|
+
import { e as N } from "./index-xZWaF8AW.js";
|
|
8
8
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
9
9
|
import "./Functions-7jnEwJyw.js";
|
|
10
10
|
import "clsx";
|
|
11
11
|
import "tailwind-merge";
|
|
12
12
|
import "@chaibuilder/runtime";
|
|
13
13
|
import "jotai";
|
|
14
|
-
import "./
|
|
14
|
+
import "./STRINGS--j49GZJP.js";
|
|
15
15
|
import "@react-hookz/web";
|
|
16
|
+
import "./MODIFIERS-dytZ-osO.js";
|
|
17
|
+
import "./Class-lGzsNBOK.js";
|
|
18
|
+
import "react-i18next";
|
|
16
19
|
import "@radix-ui/react-toggle";
|
|
17
20
|
import "class-variance-authority";
|
|
18
|
-
import "./Class-3k8xjeiM.js";
|
|
19
21
|
import "@radix-ui/react-switch";
|
|
20
22
|
import "@radix-ui/react-slot";
|
|
21
23
|
import "@radix-ui/react-accordion";
|
|
@@ -38,18 +40,15 @@ import "@radix-ui/react-context-menu";
|
|
|
38
40
|
import "react-icons-picker";
|
|
39
41
|
import "react-dom";
|
|
40
42
|
import "react-quill";
|
|
41
|
-
import "react-i18next";
|
|
42
43
|
import "@rjsf/core";
|
|
43
44
|
import "@rjsf/validator-ajv8";
|
|
44
|
-
import "./index-
|
|
45
|
+
import "./index-gS-3liKK.js";
|
|
45
46
|
import "i18next";
|
|
46
47
|
import "@floating-ui/react-dom";
|
|
47
48
|
import "flagged";
|
|
48
|
-
import "react-dnd";
|
|
49
|
-
import "@minoru/react-dnd-treeview";
|
|
50
49
|
import "react-hotkeys-hook";
|
|
51
50
|
import "sonner";
|
|
52
|
-
import "./html-to-json-
|
|
51
|
+
import "./html-to-json-ngX9ef2u.js";
|
|
53
52
|
import "himalaya";
|
|
54
53
|
import "lucide-react";
|
|
55
54
|
import "./index-YpnaudSM.js";
|
|
@@ -93,7 +92,7 @@ const S = ({ closeModal: e }) => {
|
|
|
93
92
|
}
|
|
94
93
|
) })
|
|
95
94
|
] });
|
|
96
|
-
},
|
|
95
|
+
}, vt = () => {
|
|
97
96
|
const [e, i] = c(!1);
|
|
98
97
|
return /* @__PURE__ */ t.jsxs(b, { open: e, onOpenChange: () => i(!e), children: [
|
|
99
98
|
/* @__PURE__ */ t.jsx(A, { asChild: !0, children: /* @__PURE__ */ t.jsx(u, { size: "sm", variant: "link", className: "text-blue-500", onClick: () => i(!e), children: "+ New Page" }) }),
|
|
@@ -101,5 +100,5 @@ const S = ({ closeModal: e }) => {
|
|
|
101
100
|
] });
|
|
102
101
|
};
|
|
103
102
|
export {
|
|
104
|
-
|
|
103
|
+
vt as default
|
|
105
104
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),x=require("react"),P=require("lodash-es"),t=require("./index-h-hd6EvN.cjs"),g=require("./controls-KK2oLIa8.cjs"),R=require("./form-lBQ_76Uw.cjs"),f=require("./index-oCYKBYyT.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-0g14w5RS.cjs");require("./Class-PoYusiA5.cjs");require("react-i18next");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-dgm-fd8U.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("sonner");require("./html-to-json-efmv1pCj.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");const b=({closeModal:i})=>{var l,o;const u=f.useAddPage(),[r,m]=x.useState({name:"",slug:"",blocks:[],type:"STATIC",seoData:{},template:""}),p=()=>{u.mutate(r,{onSuccess:()=>i()})},j=({formData:n},s)=>{m(q=>{var d,c;const a={[s]:n[s]};return s==="name"?a.slug=P.kebabCase((d=n[s])==null?void 0:d.replace(/\d/g,"")):s==="slug"&&(a.slug=(c=n[s])==null?void 0:c.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_")),{...q,...a}})},h={name:g.u({title:"Page Name",default:r.name}),slug:g.u({title:"Page Slug",default:r.slug})};return e.jsxRuntimeExports.jsxs(t.DialogContent,{children:[e.jsxRuntimeExports.jsx("div",{className:"px-1 font-bold",children:"Add Page"}),e.jsxRuntimeExports.jsx(R.Form,{formData:r,properties:h,onChange:j,disabled:u.isPending}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-end",children:e.jsxRuntimeExports.jsx(t.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||u.isPending,onClick:p,children:"Add Page"})})]})},E=()=>{const[i,u]=x.useState(!1);return e.jsxRuntimeExports.jsxs(t.Dialog,{open:i,onOpenChange:()=>u(!i),children:[e.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"link",className:"text-blue-500",onClick:()=>u(!i),children:"+ New Page"})}),i&&e.jsxRuntimeExports.jsx(b,{closeModal:()=>u(!i)})]})};exports.default=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./index-h-hd6EvN.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-0g14w5RS.cjs");require("./Class-PoYusiA5.cjs");require("react-i18next");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");const x=({open:t,onCancel:q=()=>{},onConfirm:s,title:n,description:i,disabled:u,cancelText:l="Discard",confirmText:o="Save"})=>e.jsxRuntimeExports.jsx(r.AlertDialog,{open:t,children:e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:n}),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:u,onClick:q,children:l}),e.jsxRuntimeExports.jsx(r.Button,{variant:"default",onClick:s,disabled:u,children:o})]})]})});exports.default=x;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as i } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { A as a, b as n, d as c, e as x, g as d, B as j } from "./index-
|
|
2
|
+
import { A as a, b as n, d as c, e as x, g as d, B as j } from "./index-Gk6sASBd.js";
|
|
3
3
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "lodash-es";
|
|
@@ -8,11 +8,13 @@ import "clsx";
|
|
|
8
8
|
import "tailwind-merge";
|
|
9
9
|
import "@chaibuilder/runtime";
|
|
10
10
|
import "jotai";
|
|
11
|
-
import "./
|
|
11
|
+
import "./STRINGS--j49GZJP.js";
|
|
12
12
|
import "@react-hookz/web";
|
|
13
|
+
import "./MODIFIERS-dytZ-osO.js";
|
|
14
|
+
import "./Class-lGzsNBOK.js";
|
|
15
|
+
import "react-i18next";
|
|
13
16
|
import "@radix-ui/react-toggle";
|
|
14
17
|
import "class-variance-authority";
|
|
15
|
-
import "./Class-3k8xjeiM.js";
|
|
16
18
|
import "@radix-ui/react-switch";
|
|
17
19
|
import "@radix-ui/react-slot";
|
|
18
20
|
import "@radix-ui/react-accordion";
|
|
@@ -35,8 +37,7 @@ import "@radix-ui/react-context-menu";
|
|
|
35
37
|
import "react-icons-picker";
|
|
36
38
|
import "react-dom";
|
|
37
39
|
import "react-quill";
|
|
38
|
-
|
|
39
|
-
const $ = ({
|
|
40
|
+
const ii = ({
|
|
40
41
|
open: o,
|
|
41
42
|
onCancel: m = () => {
|
|
42
43
|
},
|
|
@@ -55,5 +56,5 @@ const $ = ({
|
|
|
55
56
|
] })
|
|
56
57
|
] }) });
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
+
ii as default
|
|
59
60
|
};
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-dgm-fd8U.cjs"),e=require("./index-h-hd6EvN.cjs"),r=require("react-i18next");require("i18next");require("./jsx-runtime-Z_BpKhVy.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("flagged");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@radix-ui/react-icons");require("react-hotkeys-hook");require("@chaibuilder/runtime");require("@react-hookz/web");require("./STRINGS-gPz7CUOk.cjs");require("./MODIFIERS-0g14w5RS.cjs");require("./Class-PoYusiA5.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");exports.ChaiBuilderEditor=s.ChaiBuilderEditor;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.useBlocksStore=e.useBlocksStore;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;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.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>r.useTranslation});
|
package/dist/core.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export declare type ChaiBlock = {
|
|
|
39
39
|
export declare const ChaiBuilderEditor: (props: ChaiBuilderEditorProps) => JSX_2.Element;
|
|
40
40
|
|
|
41
41
|
export declare interface ChaiBuilderEditorProps {
|
|
42
|
+
hideSaveButton?: boolean;
|
|
43
|
+
filterChaiBlock?: (block: any) => boolean;
|
|
42
44
|
showDebugLogs?: boolean;
|
|
43
45
|
autoSaveSupport?: boolean;
|
|
44
46
|
autoSaveInterval?: TimeInSeconds;
|
|
@@ -75,7 +77,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
75
77
|
onSave?: ({ blocks, providers }: SavePageData) => Promise<boolean | Error>;
|
|
76
78
|
brandingOptions?: Record<string, string>;
|
|
77
79
|
onSaveBrandingOptions?: (brandingOptions: Record<string, any>) => Promise<boolean | Error>;
|
|
78
|
-
|
|
80
|
+
onSaveStateChange?: (syncStatus: "UNSAVED" | "SAVED" | "SAVING") => void;
|
|
79
81
|
previewComponent?: ReactComponentType;
|
|
80
82
|
sideBarComponents?: {
|
|
81
83
|
bottom?: ReactComponentType[];
|
|
@@ -254,8 +256,8 @@ export declare const useRemoveClassesFromBlocks: () => Function;
|
|
|
254
256
|
|
|
255
257
|
export declare const useSavePage: () => {
|
|
256
258
|
savePage: ThrottledFunction<() => Promise<boolean>>;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
+
saveState: "UNSAVED" | "SAVED" | "SAVING";
|
|
260
|
+
setSaveState: (args_0: "UNSAVED" | "SAVED" | "SAVING" | ((prev: "UNSAVED" | "SAVED" | "SAVING") => "UNSAVED" | "SAVED" | "SAVING")) => void;
|
|
259
261
|
};
|
|
260
262
|
|
|
261
263
|
/**
|