@chaibuilder/sdk 1.2.56 → 1.2.57
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-HeYXoex4.js → AddBlocks-05ZH2Suu.js} +46 -50
- package/dist/AddBlocks-MH_fqSRf.cjs +1 -0
- package/dist/{CanvasArea-CqILE5PR.js → CanvasArea-8f_Ki3B7.js} +361 -361
- package/dist/CanvasArea-UisRL54b.cjs +56 -0
- package/dist/CodeEditor-vECReGwz.cjs +1 -0
- package/dist/{CodeEditor-kxV5RCpd.js → CodeEditor-zYBqhBv3.js} +33 -39
- package/dist/CurrentPage-7aEIhzQ0.cjs +1 -0
- package/dist/{CurrentPage-IrFGAb7n.js → CurrentPage-nzo4lszx.js} +26 -25
- package/dist/ListTree-A-097CZ-.cjs +1 -0
- package/dist/{ListTree-0n_G8NJx.js → ListTree-KUGhFsb_.js} +9 -13
- package/dist/PagesPanel-L1mI3y_6.cjs +1 -0
- package/dist/{PagesPanel-RYBf0Yct.js → PagesPanel-hleqqZBo.js} +20 -19
- package/dist/ProjectPanel-HTxa1kHv.cjs +1 -0
- package/dist/{ProjectPanel-Zagx6l3Q.js → ProjectPanel-RXEhYr0a.js} +25 -24
- package/dist/Settings-7EMwx6zL.cjs +1 -0
- package/dist/{Settings-RLDTFFf8.js → Settings-b1ZuIn4y.js} +404 -395
- package/dist/{SidePanels-ao969pMV.js → SidePanels-6hZeCR5Z.js} +89 -88
- package/dist/SidePanels-_6WlMWq_.cjs +1 -0
- package/dist/ThemeConfiguration-PvMN3j6h.cjs +1 -0
- package/dist/{ThemeConfiguration-S7yArRMp.js → ThemeConfiguration-ab7lbA2y.js} +18 -24
- package/dist/Topbar-WdGZIIZp.cjs +1 -0
- package/dist/{Topbar-B8u0whpc.js → Topbar-YfsC1DZ2.js} +39 -38
- package/dist/{UILibrariesPanel-tcfz2ELp.js → UILibrariesPanel-5QxxXYg2.js} +56 -61
- package/dist/UILibrariesPanel-r8nQzXQ-.cjs +1 -0
- package/dist/{UnsplashImages-wWRifkCp.js → UnsplashImages-alt_doTy.js} +42 -47
- package/dist/UnsplashImages-cah1BRL_.cjs +1 -0
- package/dist/UploadImages-5dRETWCo.cjs +1 -0
- package/dist/{UploadImages-lUvZhW_j.js → UploadImages-JqVL_aQd.js} +32 -38
- package/dist/{add-page-modal-04b4l2zu.js → add-page-modal-CtMwNEsW.js} +29 -28
- package/dist/add-page-modal-DA5P4pVu.cjs +1 -0
- package/dist/{confirm-alert-FX5030eR.js → confirm-alert-m85JJlQi.js} +15 -21
- package/dist/confirm-alert-rYsxlfR4.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +44 -43
- package/dist/delete-page-modal-AvUZI9Tk.cjs +1 -0
- package/dist/{delete-page-modal-1u9CyAIP.js → delete-page-modal-TMpN1Dvm.js} +22 -21
- package/dist/email.cjs +1 -1
- package/dist/email.js +19 -19
- package/dist/form-G3PqS2Gc.cjs +1 -0
- package/dist/{form-HRdEJjVq.js → form-MSL4CDff.js} +3 -3
- package/dist/{html-to-json-OnIZDDXw.js → html-to-json-_01DXd-a.js} +37 -36
- package/dist/html-to-json-ndxaXRT8.cjs +1 -0
- package/dist/{index-vfmO3y2d.js → index--hN9ZQsP.js} +19 -19
- package/dist/index-0FIxW0gR.cjs +1 -0
- package/dist/{ChaiBuilderEditor-tkzS851D.js → index-IgLSTkN6.js} +14660 -17763
- package/dist/index-sspgZwTk.cjs +206 -0
- package/dist/index-uLn8W3eR.js +3145 -0
- package/dist/index-zaKhyTQ6.cjs +1 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +17 -16
- package/dist/page-viewer-2BMSxxfd.cjs +1 -0
- package/dist/{page-viewer-dcb3u4OV.js → page-viewer-D8nsi13f.js} +27 -26
- package/dist/project-general-setting--0hX9Otn.cjs +1 -0
- package/dist/{project-general-setting--sS34seu.js → project-general-setting-HGjTNFRx.js} +23 -22
- package/dist/{project-seo-setting-8tc3I-0M.js → project-seo-setting-3kFJ77jY.js} +20 -26
- package/dist/project-seo-setting-C3ilIIeM.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +104 -102
- package/dist/single-page-detail-7BpYAyMO.cjs +1 -0
- package/dist/{single-page-detail-tP2pfgBp.js → single-page-detail-eMnjt_Ih.js} +26 -25
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +19 -18
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +144 -150
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +164 -107
- package/package.json +1 -1
- package/dist/AddBlocks-VHoZezjj.cjs +0 -1
- package/dist/CanvasArea-137WY3Wx.cjs +0 -56
- package/dist/ChaiBuilderEditor-aY8flOgX.cjs +0 -206
- package/dist/CodeEditor-R2jKe97T.cjs +0 -1
- package/dist/CurrentPage-PjrVzHXR.cjs +0 -1
- package/dist/ListTree-C6oCXZDV.cjs +0 -1
- package/dist/PagesPanel-lIC3kYmS.cjs +0 -1
- package/dist/ProjectPanel-0Siyi5YS.cjs +0 -1
- package/dist/Settings-6QRVcl16.cjs +0 -1
- package/dist/SidePanels-j1EFsBlK.cjs +0 -1
- package/dist/ThemeConfiguration-q1471P7b.cjs +0 -1
- package/dist/Topbar-ogFKKDbx.cjs +0 -1
- package/dist/UILibrariesPanel-cm9CFWxc.cjs +0 -1
- package/dist/UnsplashImages-E2L3YDJI.cjs +0 -1
- package/dist/UploadImages-s-eeaGiS.cjs +0 -1
- package/dist/add-page-modal-eroF20lO.cjs +0 -1
- package/dist/confirm-alert-XuxEzG-V.cjs +0 -1
- package/dist/delete-page-modal-pgh7sdfg.cjs +0 -1
- package/dist/form-Z4IRWj0o.cjs +0 -1
- package/dist/html-to-json-rauxDBi6.cjs +0 -1
- package/dist/index-bt7EhwLh.cjs +0 -1
- package/dist/page-viewer-O960kM2x.cjs +0 -1
- package/dist/project-general-setting-lIvNs-Vq.cjs +0 -1
- package/dist/project-seo-setting-MIlAuqcc.cjs +0 -1
- package/dist/single-page-detail-0Z_hvd_j.cjs +0 -1
- package/dist/useCanvasSettings-R0h03UfD.cjs +0 -1
- package/dist/useCanvasSettings-rEZHbw3s.js +0 -6
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import
|
|
3
|
-
import { has as
|
|
4
|
-
import { useAtom as
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
import {
|
|
2
|
+
import N, { createElement as P, useState as b, useEffect as F } from "react";
|
|
3
|
+
import { has as H, isFunction as S, first as x, omit as B, filter as g, groupBy as E, uniq as D, map as k, includes as M, isEmpty as y, reject as C, values as v } from "lodash-es";
|
|
4
|
+
import { useAtom as h } from "jotai";
|
|
5
|
+
import { useTranslation as _ } from "react-i18next";
|
|
6
|
+
import { a2 as w, r as I, ad as z, aJ as L, aF as O, aG as q, aH as G, bu as J, bv as K, bw as R, bx as U, aX as V, T as W, by as X, B as Y, bz as Q, bA as Z, bB as $, h as T, aK as ee, aL as te, aM as A, br as se, L as oe, M as re, N as ae, O as le } from "./index-uLn8W3eR.js";
|
|
7
7
|
import { BoxIcon as ie } from "@radix-ui/react-icons";
|
|
8
8
|
import { syncBlocksWithDefaults as ce, useChaiBlocks as ne } from "@chaibuilder/runtime";
|
|
9
9
|
import { useFeature as de } from "flagged";
|
|
10
10
|
import { O as j } from "./MODIFIERS-fd5XOmum.js";
|
|
11
11
|
import { d as me } from "./atoms-ZOWyNoiC.js";
|
|
12
|
-
import { g as pe } from "./html-to-json-
|
|
12
|
+
import { g as pe } from "./html-to-json-_01DXd-a.js";
|
|
13
13
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
|
-
import "clsx";
|
|
15
|
-
import "react-dom";
|
|
16
|
-
import "@radix-ui/react-scroll-area";
|
|
17
|
-
import "@floating-ui/react-dom";
|
|
18
|
-
import "i18next";
|
|
19
|
-
import "./Functions-7jnEwJyw.js";
|
|
20
|
-
import "tailwind-merge";
|
|
21
|
-
import "@react-hookz/web";
|
|
22
|
-
import "tree-model";
|
|
23
|
-
import "./utils-VpVqnC9m.js";
|
|
24
14
|
import "@radix-ui/react-toggle";
|
|
25
15
|
import "class-variance-authority";
|
|
16
|
+
import "./utils-VpVqnC9m.js";
|
|
17
|
+
import "clsx";
|
|
18
|
+
import "tailwind-merge";
|
|
26
19
|
import "@radix-ui/react-switch";
|
|
27
20
|
import "@radix-ui/react-slot";
|
|
28
21
|
import "@radix-ui/react-accordion";
|
|
29
22
|
import "@radix-ui/react-alert-dialog";
|
|
30
23
|
import "@radix-ui/react-dialog";
|
|
31
24
|
import "@radix-ui/react-label";
|
|
25
|
+
import "@radix-ui/react-scroll-area";
|
|
32
26
|
import "@radix-ui/react-tabs";
|
|
33
27
|
import "@radix-ui/react-tooltip";
|
|
34
28
|
import "@radix-ui/react-popover";
|
|
@@ -41,48 +35,50 @@ import "@radix-ui/react-toast";
|
|
|
41
35
|
import "cmdk";
|
|
42
36
|
import "@radix-ui/react-context-menu";
|
|
43
37
|
import "react-icons-picker";
|
|
38
|
+
import "react-dom";
|
|
44
39
|
import "react-quill";
|
|
45
|
-
import "
|
|
46
|
-
import "
|
|
47
|
-
import "
|
|
40
|
+
import "./Functions-7jnEwJyw.js";
|
|
41
|
+
import "@react-hookz/web";
|
|
42
|
+
import "tree-model";
|
|
48
43
|
import "himalaya";
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
import "lodash";
|
|
45
|
+
const xe = ({ block: t }) => {
|
|
46
|
+
const [, o] = h(me), { type: a, icon: l, label: c } = t, { addCoreBlock: m, addPredefinedBlock: p } = w(), [s, u] = I(), [, f] = z(), [, n] = h(L), i = () => {
|
|
47
|
+
if (H(t, "blocks")) {
|
|
48
|
+
const d = S(t.blocks) ? t.blocks() : t.blocks;
|
|
49
|
+
p(ce(d), x(s));
|
|
54
50
|
} else
|
|
55
|
-
m(t,
|
|
51
|
+
m(t, x(s));
|
|
56
52
|
n(j);
|
|
57
53
|
}, r = de("dnd");
|
|
58
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
|
|
59
|
-
/* @__PURE__ */ e.jsx(
|
|
54
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(O, { children: [
|
|
55
|
+
/* @__PURE__ */ e.jsx(q, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
60
56
|
"button",
|
|
61
57
|
{
|
|
62
58
|
onClick: i,
|
|
63
59
|
type: "button",
|
|
64
60
|
onDragStart: (d) => {
|
|
65
|
-
d.dataTransfer.setData("text/plain", JSON.stringify(
|
|
61
|
+
d.dataTransfer.setData("text/plain", JSON.stringify(B(t, ["component", "icon"]))), d.dataTransfer.setDragImage(new Image(), 0, 0), o(B(t, ["component", "icon"])), setTimeout(() => {
|
|
66
62
|
u([]), f(null), n(j);
|
|
67
63
|
}, 200);
|
|
68
64
|
},
|
|
69
65
|
draggable: "true",
|
|
70
66
|
className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (r ? "cursor-grab" : "cursor-pointer"),
|
|
71
67
|
children: [
|
|
72
|
-
|
|
68
|
+
P(l || ie, { className: "w-4 h-4 mx-auto" }),
|
|
73
69
|
/* @__PURE__ */ e.jsx("p", { className: "text-xs", children: c || a })
|
|
74
70
|
]
|
|
75
71
|
}
|
|
76
72
|
) }),
|
|
77
|
-
/* @__PURE__ */ e.jsx(
|
|
73
|
+
/* @__PURE__ */ e.jsx(G, { children: /* @__PURE__ */ e.jsx("p", { children: c || a }) })
|
|
78
74
|
] }) });
|
|
79
|
-
},
|
|
80
|
-
const { t } =
|
|
75
|
+
}, he = () => {
|
|
76
|
+
const { t } = _(), [o, a] = b(""), { addPredefinedBlock: l } = w(), [c] = I(), [, m] = h(L), p = () => {
|
|
81
77
|
const s = pe(o);
|
|
82
|
-
l([...s],
|
|
78
|
+
l([...s], x(c) || null), a(""), m(j);
|
|
83
79
|
};
|
|
84
|
-
return /* @__PURE__ */ e.jsxs(
|
|
85
|
-
/* @__PURE__ */ e.jsx(
|
|
80
|
+
return /* @__PURE__ */ e.jsxs(J, { className: "border-border/0 p-0 shadow-none", children: [
|
|
81
|
+
/* @__PURE__ */ e.jsx(K, { className: "p-3", children: /* @__PURE__ */ e.jsx(R, { children: t("html_snippet_description") }) }),
|
|
86
82
|
/* @__PURE__ */ e.jsx(U, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
87
83
|
/* @__PURE__ */ e.jsx(V, { htmlFor: "current", className: "text-sm", children: t("tailwind_html_snippet") }),
|
|
88
84
|
/* @__PURE__ */ e.jsx(
|
|
@@ -99,15 +95,15 @@ const he = ({ block: t }) => {
|
|
|
99
95
|
}
|
|
100
96
|
)
|
|
101
97
|
] }) }),
|
|
102
|
-
/* @__PURE__ */ e.jsxs(
|
|
103
|
-
/* @__PURE__ */ e.jsx(
|
|
104
|
-
/* @__PURE__ */ e.jsx(
|
|
98
|
+
/* @__PURE__ */ e.jsxs(X, { className: "flex flex-col justify-end p-3", children: [
|
|
99
|
+
/* @__PURE__ */ e.jsx(Y, { disabled: o.trim() === "", onClick: () => p(), size: "sm", className: "w-full", children: t("import_html") }),
|
|
100
|
+
/* @__PURE__ */ e.jsx(Q, { variant: "default", className: "mt-2 border-none p-1 text-gray-400", children: /* @__PURE__ */ e.jsx(Z, { className: "text-xs font-normal leading-4", children: t("note_imported_html") }) })
|
|
105
101
|
] })
|
|
106
102
|
] });
|
|
107
|
-
},
|
|
108
|
-
const { t } =
|
|
109
|
-
return
|
|
110
|
-
!M(i, l) && !y(i) && !y(l) && c(
|
|
103
|
+
}, at = () => {
|
|
104
|
+
const { t } = _(), [o, a] = b("core"), [l, c] = b("basic"), m = ne(), [, p] = h($), s = T("importHTMLSupport", !0), u = T("filterChaiBlock", () => !0), f = g(m, u), n = E(f, "category"), i = D(k(n.core, "group"));
|
|
105
|
+
return F(() => {
|
|
106
|
+
!M(i, l) && !y(i) && !y(l) && c(x(i));
|
|
111
107
|
}, [i, l]), /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-72 flex-col overflow-hidden", children: [
|
|
112
108
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
113
109
|
/* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: t("add_block") }),
|
|
@@ -122,25 +118,25 @@ const he = ({ block: t }) => {
|
|
|
122
118
|
value: o,
|
|
123
119
|
className: "h-max",
|
|
124
120
|
children: /* @__PURE__ */ e.jsxs(te, { className: "grid w-full " + (s ? "grid-cols-2" : "grid-cols-1"), children: [
|
|
125
|
-
/* @__PURE__ */ e.jsx(
|
|
126
|
-
s ? /* @__PURE__ */ e.jsx(
|
|
121
|
+
/* @__PURE__ */ e.jsx(A, { value: "core", children: t("Blocks") }),
|
|
122
|
+
s ? /* @__PURE__ */ e.jsx(A, { value: "html", children: t("import") }) : null
|
|
127
123
|
] })
|
|
128
124
|
}
|
|
129
125
|
),
|
|
130
|
-
o === "core" && /* @__PURE__ */ e.jsx(se, { className: "-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children:
|
|
131
|
-
|
|
126
|
+
o === "core" && /* @__PURE__ */ e.jsx(se, { className: "-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: N.Children.toArray(
|
|
127
|
+
k(
|
|
132
128
|
i,
|
|
133
129
|
(r) => C(g(v(n.core), { group: r }), { hidden: !0 }).length ? /* @__PURE__ */ e.jsx(oe, { type: "single", value: r, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(re, { value: r, children: [
|
|
134
130
|
/* @__PURE__ */ e.jsx(ae, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: r }),
|
|
135
|
-
/* @__PURE__ */ e.jsx(le, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children:
|
|
136
|
-
C(g(v(n.core), { group: r }), { hidden: !0 }).map((d) => /* @__PURE__ */ e.jsx(
|
|
131
|
+
/* @__PURE__ */ e.jsx(le, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: N.Children.toArray(
|
|
132
|
+
C(g(v(n.core), { group: r }), { hidden: !0 }).map((d) => /* @__PURE__ */ e.jsx(xe, { block: d }))
|
|
137
133
|
) }) })
|
|
138
134
|
] }) }) : null
|
|
139
135
|
)
|
|
140
136
|
) }) }),
|
|
141
|
-
o === "html" && s ? /* @__PURE__ */ e.jsx(
|
|
137
|
+
o === "html" && s ? /* @__PURE__ */ e.jsx(he, {}) : null
|
|
142
138
|
] });
|
|
143
139
|
};
|
|
144
140
|
export {
|
|
145
|
-
|
|
141
|
+
at as default
|
|
146
142
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),t=require("lodash-es"),h=require("jotai"),q=require("react-i18next"),s=require("./index-0FIxW0gR.cjs"),b=require("@radix-ui/react-icons"),R=require("@chaibuilder/runtime"),T=require("flagged"),E=require("./MODIFIERS-mVmfEGgo.cjs"),N=require("./atoms-a0H_593V.cjs"),k=require("./html-to-json-ndxaXRT8.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@react-hookz/web");require("tree-model");require("himalaya");require("lodash");const y=({block:r})=>{const[,i]=h.useAtom(N.draggedBlockAtom),{type:l,icon:c,label:d}=r,{addCoreBlock:p,addPredefinedBlock:j}=s.useAddBlock(),[o,g]=s.useSelectedBlockIds(),[,f]=s.useHighlightBlockId(),[,x]=h.useAtom(s.activePanelAtom),a=()=>{if(t.has(r,"blocks")){const m=t.isFunction(r.blocks)?r.blocks():r.blocks;j(R.syncBlocksWithDefaults(m),t.first(o))}else p(r,t.first(o));x(E.OUTLINE_KEY)},n=T.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:a,type:"button",onDragStart:m=>{m.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),m.dataTransfer.setDragImage(new Image,0,0),i(t.omit(r,["component","icon"])),setTimeout(()=>{g([]),f(null),x(E.OUTLINE_KEY)},200)},draggable:"true",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(n?"cursor-grab":"cursor-pointer"),children:[u.createElement(c||b.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:d||l})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||l})})]})})},B=()=>{const{t:r}=q.useTranslation(),[i,l]=u.useState(""),{addPredefinedBlock:c}=s.useAddBlock(),[d]=s.useSelectedBlockIds(),[,p]=h.useAtom(s.activePanelAtom),j=()=>{const o=k.getBlocksFromHTML(i);c([...o],t.first(d)||null),l(""),p(E.OUTLINE_KEY)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:o=>o&&o.focus(),onChange:o=>l(o.target.value),rows:12,value:i,placeholder:r("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:i.trim()==="",onClick:()=>j(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},v=()=>{const{t:r}=q.useTranslation(),[i,l]=u.useState("core"),[c,d]=u.useState("basic"),p=R.useChaiBlocks(),[,j]=h.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),g=s.useBuilderProp("filterChaiBlock",()=>!0),f=t.filter(p,g),x=t.groupBy(f,"category"),a=t.uniq(t.map(x.core,"group"));return u.useEffect(()=>{!t.includes(a,c)&&!t.isEmpty(a)&&!t.isEmpty(c)&&d(t.first(a))},[a,c]),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-72 flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:n=>{j(""),l(n)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),i==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:u.Children.toArray(t.map(a,n=>t.reject(t.filter(t.values(x.core),{group:n}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:n,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:n,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:n}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:u.Children.toArray(t.reject(t.filter(t.values(x.core),{group:n}),{hidden:!0}).map(m=>e.jsxRuntimeExports.jsx(y,{block:m})))})})]})}):null))})}),i==="html"&&o?e.jsxRuntimeExports.jsx(B,{}):null]})};exports.default=v;
|