@chaibuilder/sdk 1.0.23 → 1.1.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-P3qHuE5J.cjs +1 -0
- package/dist/AddBlocks-imyQSCbI.js +230 -0
- package/dist/{BrandingOptions-Fyo8qs4o.cjs → BrandingOptions-_2XBEPab.cjs} +1 -1
- package/dist/{BrandingOptions-orZyDGiL.js → BrandingOptions-tSNtQ1Kv.js} +1 -1
- package/dist/CanvasArea-TzIgm_vh.cjs +58 -0
- package/dist/CanvasArea-dS2B20gv.js +1421 -0
- package/dist/{CurrentPage-lIithDJy.cjs → CurrentPage-_Em0U2gh.cjs} +1 -1
- package/dist/{CurrentPage-70sBzc2_.js → CurrentPage-pSsaLyEf.js} +2 -2
- package/dist/Layers-RyVRzaUa.cjs +1 -0
- package/dist/{Layers-W0N2zfnf.js → Layers-wp2Uc2Y5.js} +119 -137
- package/dist/{MarkAsGlobalBlock-FPCQmRIh.js → MarkAsGlobalBlock-aqik3ouc.js} +1 -1
- package/dist/{MarkAsGlobalBlock-EOsABFjY.cjs → MarkAsGlobalBlock-p_wvHkQZ.cjs} +1 -1
- package/dist/{PagesPanel-RbHN6lvQ.js → PagesPanel-L2VS8RyZ.js} +3 -3
- package/dist/{PagesPanel-i-MQEmm_.cjs → PagesPanel-ZuXc2610.cjs} +1 -1
- package/dist/{ProjectPanel-0BGx-hP-.cjs → ProjectPanel-SErKorHi.cjs} +1 -1
- package/dist/{ProjectPanel-CzwuyR0N.js → ProjectPanel-T3AXGe7O.js} +3 -3
- package/dist/Settings-GJHtwQaa.cjs +1 -0
- package/dist/{Settings-lxTrbI-C.js → Settings-xkL3U3Y-.js} +301 -308
- package/dist/{SidePanels-pUOJTYfr.cjs → SidePanels-5FNROZe7.cjs} +1 -1
- package/dist/{SidePanels-g4M6oTs-.js → SidePanels-pd7HYv8I.js} +33 -32
- package/dist/{Topbar-KqZt4TEY.js → Topbar-Jc74a6oE.js} +1 -1
- package/dist/{Topbar-kHffytzr.cjs → Topbar-ZjAs5fDc.cjs} +1 -1
- package/dist/{UnsplashImages-Ua7ksJ8c.js → UnsplashImages-_PxEYx5c.js} +1 -1
- package/dist/{UnsplashImages-y7I_7_W7.cjs → UnsplashImages-nXceZLmd.cjs} +1 -1
- package/dist/{UploadImages-RzEm0Stb.cjs → UploadImages-tcQb5NZu.cjs} +1 -1
- package/dist/{UploadImages-YP_J6erG.js → UploadImages-zzSgKmP9.js} +10 -10
- package/dist/{add-page-modal-btGWaXyq.js → add-page-modal-Njd5M7E2.js} +3 -3
- package/dist/{add-page-modal-ekFis5D8.cjs → add-page-modal-U8EH-GIa.cjs} +1 -1
- package/dist/{confirm-alert-Py2WqZhJ.js → confirm-alert-2JxcNf3T.js} +1 -1
- package/dist/{confirm-alert-mAhT8vln.cjs → confirm-alert-mzlwOW9w.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -3
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal-QzleoJG2.cjs → delete-page-modal-0LQiM0fX.cjs} +1 -1
- package/dist/{delete-page-modal-Rq4ThQpu.js → delete-page-modal-NT7df4pk.js} +2 -2
- package/dist/{form-Lm3bupAq.js → form-TQ7vwDYO.js} +1 -1
- package/dist/{form-kAjrBaV-.cjs → form-bSW-Pkw9.cjs} +1 -1
- package/dist/{index-WPlT_Q87.js → index-N3mTbV2j.js} +6 -4
- package/dist/{index-Vx4ctSV6.js → index-ORFlyrBx.js} +569 -556
- package/dist/{index-fvoD_laH.cjs → index-pYZXf7hY.cjs} +2 -2
- package/dist/index-zkc4SQCu.cjs +1 -0
- package/dist/{page-viewer-AlOCzh1b.cjs → page-viewer-UxwOwHCO.cjs} +1 -1
- package/dist/{page-viewer-_wGsV2_o.js → page-viewer-e3lOBAH3.js} +3 -3
- package/dist/{project-general-setting-XnNyOpXO.cjs → project-general-setting-DrLwWE-6.cjs} +1 -1
- package/dist/{project-general-setting-B8uuHccU.js → project-general-setting-el86II8N.js} +3 -3
- package/dist/{project-seo-setting-QJBATF59.cjs → project-seo-setting-cERASO9j.cjs} +1 -1
- package/dist/{project-seo-setting-Zg2Z-Frr.js → project-seo-setting-k0HlefUD.js} +2 -2
- package/dist/{single-page-detail-HXpxgQnU.js → single-page-detail-UFEXRI81.js} +4 -4
- package/dist/{single-page-detail-MWh30E_-.cjs → single-page-detail-fUh22jZE.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +57 -57
- package/dist/useAddBlockByDrop-DPV32UHP.cjs +1 -0
- package/dist/useAddBlockByDrop-UA_Iw_4l.js +20 -0
- package/package.json +3 -3
- package/dist/AddBlocks-Izn_rxXD.js +0 -270
- package/dist/AddBlocks-RHuwwfe5.cjs +0 -3
- package/dist/CanvasArea-C30uJLef.js +0 -1298
- package/dist/CanvasArea-IM2K8bud.cjs +0 -46
- package/dist/Layers-YMtavzUG.cjs +0 -1
- package/dist/Settings-mTWkKG82.cjs +0 -1
- package/dist/index-W5drgyWI.cjs +0 -1
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bk as K, bn as f, bl as j, bm as q, bz as z, bJ as N, D as O, at as Q, K as U, F as W, I as X, J as Y, G as Z, H as _, E as $, bA as aa, bK as ea, B as oa, bt as ta, bw as ra, bv as sa, by as na, bu as ia, bM as ba, b6 as pa, cn as ua, b9 as ca, ba as la, b7 as ma, bb as da, b8 as Ca, cp as ga, co as Ma, bE as Sa, cq as Da, bD as Ta, cv as xa, bC as Aa, cs as wa, cw as Ia, cA as ha, cr as Pa, ct as Fa, cu as va, cx as Ga, cy as Ha, cz as La, bF as ka, ao as Ra, ap as Va, as as Ba, bc as Ea, aq as ya, ar as Ja, bd as Ka, aR as fa, aW as ja, aT as qa, ce as za, cb as Na, aU as Oa, cf as Qa, cj as Ua, cc as Wa, aV as Xa, cd as Ya, cg as Za, ch as _a, ci as $a, aS as ae, aO as ee, aQ as oe, aP as te, bh as re, bi as se, bo as ne, aM as ie, bj as be, bO as pe, bV as ue, bR as ce, b$ as le, bS as me, bU as de, bP as Ce, bY as ge, bW as Me, bX as Se, bT as De, c1 as Te, c0 as xe, bZ as Ae, b_ as we, bQ as Ie, b3 as he, b5 as Pe, b4 as Fe, bg as ve, br as Ge, bN as He, au as Le, ax as ke, aF as Re, ay as Ve, aG as Be, c2 as Ee, av as ye, aw as Je, aL as Ke, c3 as fe, c5 as je, c6 as qe, ca as ze, c8 as Ne, c7 as Oe, c9 as Qe, c4 as Ue, S as We, aN as Xe, aB as Ye, aE as Ze, aC as _e, aD as $e, bx as ao, C as eo, aJ as oo, aH as to, aK as ro, bp as so, T as no, aI as io, bL as bo, bI as po, ck as uo, cm as co, bH as lo, cl as mo } from "./index-ORFlyrBx.js";
|
|
2
2
|
import "./jsx-runtime-NV737rRe.js";
|
|
3
3
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
4
4
|
import "react";
|
|
@@ -37,16 +37,16 @@ import "@chaibuilder/runtime";
|
|
|
37
37
|
import "@react-hookz/web";
|
|
38
38
|
import "react-i18next";
|
|
39
39
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
K as Accordion,
|
|
41
|
+
f as AccordionContent,
|
|
42
|
+
j as AccordionItem,
|
|
43
|
+
q as AccordionTrigger,
|
|
44
|
+
z as Alert,
|
|
45
|
+
N as AlertDescription,
|
|
46
|
+
O as AlertDialog,
|
|
47
|
+
Q as AlertDialogAction,
|
|
48
|
+
U as AlertDialogCancel,
|
|
49
|
+
W as AlertDialogContent,
|
|
50
50
|
X as AlertDialogDescription,
|
|
51
51
|
Y as AlertDialogFooter,
|
|
52
52
|
Z as AlertDialogHeader,
|
|
@@ -66,41 +66,41 @@ export {
|
|
|
66
66
|
ca as CommandEmpty,
|
|
67
67
|
la as CommandGroup,
|
|
68
68
|
ma as CommandInput,
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
da as CommandItem,
|
|
70
|
+
Ca as CommandList,
|
|
71
71
|
ga as CommandSeparator,
|
|
72
72
|
Ma as CommandShortcut,
|
|
73
73
|
Sa as ContextMenu,
|
|
74
74
|
Da as ContextMenuCheckboxItem,
|
|
75
75
|
Ta as ContextMenuContent,
|
|
76
76
|
xa as ContextMenuGroup,
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
Aa as ContextMenuItem,
|
|
78
|
+
wa as ContextMenuLabel,
|
|
79
79
|
Ia as ContextMenuPortal,
|
|
80
80
|
ha as ContextMenuRadioGroup,
|
|
81
81
|
Pa as ContextMenuRadioItem,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
Fa as ContextMenuSeparator,
|
|
83
|
+
va as ContextMenuShortcut,
|
|
84
|
+
Ga as ContextMenuSub,
|
|
85
|
+
Ha as ContextMenuSubContent,
|
|
86
|
+
La as ContextMenuSubTrigger,
|
|
87
|
+
ka as ContextMenuTrigger,
|
|
88
88
|
Ra as Dialog,
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
Va as DialogContent,
|
|
90
|
+
Ba as DialogDescription,
|
|
91
91
|
Ea as DialogFooter,
|
|
92
92
|
ya as DialogHeader,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
Ja as DialogTitle,
|
|
94
|
+
Ka as DialogTrigger,
|
|
95
|
+
fa as DropdownMenu,
|
|
96
|
+
ja as DropdownMenuCheckboxItem,
|
|
97
|
+
qa as DropdownMenuContent,
|
|
98
|
+
za as DropdownMenuGroup,
|
|
99
|
+
Na as DropdownMenuItem,
|
|
100
|
+
Oa as DropdownMenuLabel,
|
|
101
|
+
Qa as DropdownMenuPortal,
|
|
102
|
+
Ua as DropdownMenuRadioGroup,
|
|
103
|
+
Wa as DropdownMenuRadioItem,
|
|
104
104
|
Xa as DropdownMenuSeparator,
|
|
105
105
|
Ya as DropdownMenuShortcut,
|
|
106
106
|
Za as DropdownMenuSub,
|
|
@@ -120,41 +120,41 @@ export {
|
|
|
120
120
|
ce as MenubarContent,
|
|
121
121
|
le as MenubarGroup,
|
|
122
122
|
me as MenubarItem,
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
de as MenubarLabel,
|
|
124
|
+
Ce as MenubarMenu,
|
|
125
125
|
ge as MenubarPortal,
|
|
126
126
|
Me as MenubarRadioGroup,
|
|
127
127
|
Se as MenubarRadioItem,
|
|
128
128
|
De as MenubarSeparator,
|
|
129
129
|
Te as MenubarShortcut,
|
|
130
130
|
xe as MenubarSub,
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
Ae as MenubarSubContent,
|
|
132
|
+
we as MenubarSubTrigger,
|
|
133
133
|
Ie as MenubarTrigger,
|
|
134
134
|
he as Popover,
|
|
135
135
|
Pe as PopoverContent,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
Fe as PopoverTrigger,
|
|
137
|
+
ve as RTEField,
|
|
138
|
+
Ge as ScrollArea,
|
|
139
|
+
He as ScrollBar,
|
|
140
|
+
Le as Select,
|
|
141
|
+
ke as SelectContent,
|
|
142
142
|
Re as SelectGroup,
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
Ve as SelectItem,
|
|
144
|
+
Be as SelectLabel,
|
|
145
145
|
Ee as SelectSeparator,
|
|
146
146
|
ye as SelectTrigger,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
147
|
+
Je as SelectValue,
|
|
148
|
+
Ke as Separator,
|
|
149
|
+
fe as Sheet,
|
|
150
|
+
je as SheetClose,
|
|
151
|
+
qe as SheetContent,
|
|
152
|
+
ze as SheetDescription,
|
|
153
|
+
Ne as SheetFooter,
|
|
154
|
+
Oe as SheetHeader,
|
|
155
|
+
Qe as SheetTitle,
|
|
156
|
+
Ue as SheetTrigger,
|
|
157
|
+
We as Skeleton,
|
|
158
158
|
Xe as Switch,
|
|
159
159
|
Ye as Tabs,
|
|
160
160
|
Ze as TabsContent,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("react"),u=require("lodash"),t=require("./index-zkc4SQCu.cjs"),a=()=>{const{addCoreBlock:r}=t.useAddBlock(),l=t.useBuilderProp("getExternalPredefinedBlock");return n.useCallback(async s=>{const{block:o,dropTargetId:e,relativeIndex:c}=s;if(u.has(o,"format")){const d=await l(o);return r({blocks:d},e===0?null:e,c)}return r(o,e===0?null:e,c)},[r])};exports.useAddBlockByDrop=a;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useCallback as n } from "react";
|
|
2
|
+
import { has as s } from "lodash";
|
|
3
|
+
import { O as a, i as u } from "./index-ORFlyrBx.js";
|
|
4
|
+
const B = () => {
|
|
5
|
+
const { addCoreBlock: r } = a(), l = u("getExternalPredefinedBlock");
|
|
6
|
+
return n(
|
|
7
|
+
async (c) => {
|
|
8
|
+
const { block: e, dropTargetId: o, relativeIndex: t } = c;
|
|
9
|
+
if (s(e, "format")) {
|
|
10
|
+
const d = await l(e);
|
|
11
|
+
return r({ blocks: d }, o === 0 ? null : o, t);
|
|
12
|
+
}
|
|
13
|
+
return r(e, o === 0 ? null : o, t);
|
|
14
|
+
},
|
|
15
|
+
[r]
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
B as u
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaibuilder/sdk",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "Open source low-code visual builder",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Suraj Air",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"homepage": "https://chaibuilder.com",
|
|
8
|
-
"version": "1.0
|
|
8
|
+
"version": "1.1.0",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@bobthered/tailwindcss-palette-generator": "3.1.1",
|
|
76
|
-
"@chaibuilder/runtime": "0.1.
|
|
76
|
+
"@chaibuilder/runtime": "0.1.8",
|
|
77
77
|
"@floating-ui/dom": "1.4.5",
|
|
78
78
|
"@floating-ui/react-dom": "2.0.1",
|
|
79
79
|
"@mhsdesign/jit-browser-tailwindcss": "0.4.0",
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
-
import v, { createElement as K, useState as j, useCallback as q, useMemo as V, useEffect as W, Suspense as J } from "react";
|
|
3
|
-
import { has as z, first as g, isEmpty as w, filter as k, values as B, groupBy as I, mergeWith as Q, isArray as H, get as X, map as L, includes as P, find as E, uniq as Y, reject as M } from "lodash";
|
|
4
|
-
import { useAtom as h } from "jotai";
|
|
5
|
-
import { O as F, j as C, az as D, aA as N, aH as Z, aI as $, aK as ee, i as se, a8 as O, bv as re, bw as te, bx as oe, by as le, bz as ae, bA as ie, aM as ce, bB as ne, bC as de, B as me, bD as pe, bE as ue, bF as xe, ae as he, aB as fe, aC as be, aD as A, bp as ge, bi as je, bj as ye, bk as we, bl as ke, S as Be } from "./index-Vx4ctSV6.js";
|
|
6
|
-
import { useDrag as R, DragPreviewImage as _ } from "react-dnd";
|
|
7
|
-
import { BoxIcon as ve, ExclamationTriangleIcon as Ce, Cross1Icon as Ne } from "@radix-ui/react-icons";
|
|
8
|
-
import { syncBlocksWithDefaults as G, useChaiBlocks as U } from "@chaibuilder/runtime";
|
|
9
|
-
import { Loader as Te } from "lucide-react";
|
|
10
|
-
import { getBlocksFromHTML as Ae } from "./lib.js";
|
|
11
|
-
import { c as Ie } from "./utils-PPBbw5bk.js";
|
|
12
|
-
import "./MODIFIERS-MLfpKQY1.js";
|
|
13
|
-
import "@radix-ui/react-toggle";
|
|
14
|
-
import "class-variance-authority";
|
|
15
|
-
import "@radix-ui/react-switch";
|
|
16
|
-
import "@radix-ui/react-slot";
|
|
17
|
-
import "@radix-ui/react-accordion";
|
|
18
|
-
import "@radix-ui/react-alert-dialog";
|
|
19
|
-
import "@radix-ui/react-dialog";
|
|
20
|
-
import "@radix-ui/react-label";
|
|
21
|
-
import "@radix-ui/react-scroll-area";
|
|
22
|
-
import "@radix-ui/react-tabs";
|
|
23
|
-
import "@radix-ui/react-tooltip";
|
|
24
|
-
import "@radix-ui/react-popover";
|
|
25
|
-
import "@radix-ui/react-menubar";
|
|
26
|
-
import "@radix-ui/react-hover-card";
|
|
27
|
-
import "@radix-ui/react-select";
|
|
28
|
-
import "@radix-ui/react-dropdown-menu";
|
|
29
|
-
import "@radix-ui/react-separator";
|
|
30
|
-
import "@radix-ui/react-toast";
|
|
31
|
-
import "cmdk";
|
|
32
|
-
import "@radix-ui/react-context-menu";
|
|
33
|
-
import "react-icons-picker";
|
|
34
|
-
import "react-dom";
|
|
35
|
-
import "react-quill";
|
|
36
|
-
import "flat-to-nested";
|
|
37
|
-
import "redux-undo";
|
|
38
|
-
import "@react-hookz/web";
|
|
39
|
-
import "react-i18next";
|
|
40
|
-
import "himalaya";
|
|
41
|
-
import "./functions-JFP-oMsY.js";
|
|
42
|
-
import "@mhsdesign/jit-browser-tailwindcss";
|
|
43
|
-
import "@bobthered/tailwindcss-palette-generator";
|
|
44
|
-
import "@tailwindcss/forms";
|
|
45
|
-
import "@tailwindcss/typography";
|
|
46
|
-
import "@tailwindcss/aspect-ratio";
|
|
47
|
-
import "@tailwindcss/line-clamp";
|
|
48
|
-
import "./tailwind-config-d1VL1lzE.js";
|
|
49
|
-
import "clsx";
|
|
50
|
-
import "tailwind-merge";
|
|
51
|
-
const Le = ({ block: s }) => {
|
|
52
|
-
const { type: r, icon: t, label: a } = s, { addCoreBlock: c, addPredefinedBlock: d } = F(), [m] = C(), [, n] = h(D), [, o] = h(N), f = () => {
|
|
53
|
-
z(s, "blocks") ? d(G(s.blocks), g(m)) : c(s, g(m)), o(!1), n("layers");
|
|
54
|
-
}, [, x, p] = R(() => ({
|
|
55
|
-
type: "CHAI_BLOCK",
|
|
56
|
-
item: s
|
|
57
|
-
}));
|
|
58
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
59
|
-
/* @__PURE__ */ e.jsx(
|
|
60
|
-
_,
|
|
61
|
-
{
|
|
62
|
-
connect: p,
|
|
63
|
-
src: "https://placehold.co/100x30/000000/FFF?text=" + (a || r).replace(/ /g, "+")
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
/* @__PURE__ */ e.jsxs(Z, { children: [
|
|
67
|
-
/* @__PURE__ */ e.jsx($, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
68
|
-
"button",
|
|
69
|
-
{
|
|
70
|
-
onClick: f,
|
|
71
|
-
type: "button",
|
|
72
|
-
ref: x,
|
|
73
|
-
className: "cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",
|
|
74
|
-
children: [
|
|
75
|
-
K(t || ve, { className: "w-4 h-4 mx-auto" }),
|
|
76
|
-
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: a || r })
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
) }),
|
|
80
|
-
/* @__PURE__ */ e.jsx(ee, { children: /* @__PURE__ */ e.jsx("p", { children: a || r }) })
|
|
81
|
-
] })
|
|
82
|
-
] });
|
|
83
|
-
}, Pe = ({ block: s, closePopover: r }) => {
|
|
84
|
-
var p;
|
|
85
|
-
const [t, a] = j(!1), c = se("getExternalPredefinedBlock"), { addCoreBlock: d, addPredefinedBlock: m } = F(), [n] = C(), [, o, f] = R(
|
|
86
|
-
() => ({
|
|
87
|
-
type: "CHAI_BLOCK",
|
|
88
|
-
item: s
|
|
89
|
-
}),
|
|
90
|
-
[s]
|
|
91
|
-
), x = q(
|
|
92
|
-
async (b) => {
|
|
93
|
-
if (b.stopPropagation(), z(s, "component")) {
|
|
94
|
-
d(s, g(n)), r();
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
a(!0);
|
|
98
|
-
const l = await c(s);
|
|
99
|
-
w(l) || m(G(l), g(n)), r();
|
|
100
|
-
},
|
|
101
|
-
[s]
|
|
102
|
-
);
|
|
103
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
104
|
-
/* @__PURE__ */ e.jsx(
|
|
105
|
-
_,
|
|
106
|
-
{
|
|
107
|
-
connect: f,
|
|
108
|
-
src: "https://placehold.co/100x30/000000/FFF?text=" + ((p = s.name || s.label) == null ? void 0 : p.replace(" ", "+"))
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
/* @__PURE__ */ e.jsxs(
|
|
112
|
-
"div",
|
|
113
|
-
{
|
|
114
|
-
ref: o,
|
|
115
|
-
onClick: t ? () => {
|
|
116
|
-
} : x,
|
|
117
|
-
className: "relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
|
|
118
|
-
children: [
|
|
119
|
-
t && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
|
|
120
|
-
/* @__PURE__ */ e.jsx(Te, { className: "animate-spin", size: 15, color: "white" }),
|
|
121
|
-
" ",
|
|
122
|
-
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
123
|
-
] }),
|
|
124
|
-
s.preview ? /* @__PURE__ */ e.jsx("img", { src: s.preview, className: "min-h-[50px] w-full rounded-md border border-gray-300", alt: s.name }) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.name }) })
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
)
|
|
128
|
-
] });
|
|
129
|
-
}, Fe = () => {
|
|
130
|
-
const { data: s, isLoading: r } = O(), t = U(), a = k(B(t), { category: "custom" }), c = I(a, "group"), d = I(s, "group"), [m, n] = j(null), o = V(() => Q(c, d, (l, u) => {
|
|
131
|
-
if (H(l) && H(u))
|
|
132
|
-
return [...l, ...u];
|
|
133
|
-
}), [c, d]), [, f] = h(N), [x, p] = j("Navbar"), b = X(o, x, []);
|
|
134
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full overflow-hidden py-2", children: [
|
|
135
|
-
/* @__PURE__ */ e.jsx("ul", { className: "sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2", children: r ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
136
|
-
/* @__PURE__ */ e.jsx("li", { className: "h-8 w-full animate-pulse bg-gray-200" }),
|
|
137
|
-
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
138
|
-
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
139
|
-
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
140
|
-
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
|
|
141
|
-
/* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" })
|
|
142
|
-
] }) : v.Children.toArray(
|
|
143
|
-
L(o, (l, u) => /* @__PURE__ */ e.jsx(
|
|
144
|
-
"li",
|
|
145
|
-
{
|
|
146
|
-
onMouseOut: () => {
|
|
147
|
-
clearTimeout(m), n(null);
|
|
148
|
-
},
|
|
149
|
-
onMouseEnter: () => {
|
|
150
|
-
const y = setTimeout(() => {
|
|
151
|
-
p(u);
|
|
152
|
-
}, 300);
|
|
153
|
-
n(y);
|
|
154
|
-
},
|
|
155
|
-
onClick: () => p(u),
|
|
156
|
-
className: Ie(
|
|
157
|
-
"-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",
|
|
158
|
-
x === u ? "bg-blue-500 text-white" : " text-gray-700 hover:bg-foreground/10"
|
|
159
|
-
),
|
|
160
|
-
children: u
|
|
161
|
-
}
|
|
162
|
-
))
|
|
163
|
-
) }),
|
|
164
|
-
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children: v.Children.toArray(
|
|
165
|
-
b.map((l) => /* @__PURE__ */ e.jsx(Pe, { block: l, closePopover: () => f(!1) }))
|
|
166
|
-
) })
|
|
167
|
-
] });
|
|
168
|
-
}, He = () => {
|
|
169
|
-
const [s, r] = j(""), { addPredefinedBlock: t } = F(), [a] = C(), [, c] = h(re), [, d] = h(D), [, m] = h(N), n = () => {
|
|
170
|
-
const o = Ae(s);
|
|
171
|
-
t([...o], g(a) || null), r(""), c(!1), d("layers"), m(!1);
|
|
172
|
-
};
|
|
173
|
-
return /* @__PURE__ */ e.jsxs(te, { className: "border-border/0 p-0 shadow-none", children: [
|
|
174
|
-
/* @__PURE__ */ e.jsxs(oe, { className: "p-3", children: [
|
|
175
|
-
/* @__PURE__ */ e.jsx(le, { children: "Import HTML" }),
|
|
176
|
-
/* @__PURE__ */ e.jsx(ae, { children: "Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported." })
|
|
177
|
-
] }),
|
|
178
|
-
/* @__PURE__ */ e.jsx(ie, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
179
|
-
/* @__PURE__ */ e.jsx(ce, { htmlFor: "current", className: "text-sm", children: "Enter HTML Code:" }),
|
|
180
|
-
/* @__PURE__ */ e.jsx(
|
|
181
|
-
ne,
|
|
182
|
-
{
|
|
183
|
-
autoFocus: !0,
|
|
184
|
-
tabIndex: 1,
|
|
185
|
-
ref: (o) => o && o.focus(),
|
|
186
|
-
defaultValue: s,
|
|
187
|
-
onChange: (o) => r(o.target.value),
|
|
188
|
-
rows: 12,
|
|
189
|
-
placeholder: `<div>
|
|
190
|
-
<h1>Enter code here</h1>
|
|
191
|
-
</div>`,
|
|
192
|
-
className: "resize-none overflow-x-auto whitespace-pre font-mono font-normal"
|
|
193
|
-
}
|
|
194
|
-
)
|
|
195
|
-
] }) }),
|
|
196
|
-
/* @__PURE__ */ e.jsxs(de, { className: "flex flex-col justify-end p-3", children: [
|
|
197
|
-
/* @__PURE__ */ e.jsx(me, { disabled: s.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: "Import" }),
|
|
198
|
-
/* @__PURE__ */ e.jsxs(pe, { variant: "default", className: "mt-2 p-1 text-blue-400", children: [
|
|
199
|
-
/* @__PURE__ */ e.jsx(Ce, { className: "h-4 w-4" }),
|
|
200
|
-
/* @__PURE__ */ e.jsx(ue, { className: "text-sm leading-4", children: "Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page." })
|
|
201
|
-
] })
|
|
202
|
-
] })
|
|
203
|
-
] });
|
|
204
|
-
}, S = ["ListItem", "TableHead", "TableBody", "TableRow", "TableCell", "Column"], Ee = (s, r) => {
|
|
205
|
-
if (!s)
|
|
206
|
-
return !P(S, r);
|
|
207
|
-
const t = s._type;
|
|
208
|
-
return t === "List" ? r === "ListItem" : t === "Table" ? r === "TableHead" || r === "TableBody" : t === "TableHead" || t === "TableBody" ? r === "TableRow" : t === "TableRow" ? r === "TableCell" : t === "Row" ? r === "Column" : !P(S, r);
|
|
209
|
-
}, Ps = () => {
|
|
210
|
-
const [s, r] = j("core"), [t, a] = j("basic"), c = U(), [, d] = h(xe), [, m] = h(N), [n] = C(), o = he(), f = E(o, { _id: g(n) }), { data: x, isLoading: p } = O(), b = I(
|
|
211
|
-
k(c, (i) => Ee(f, i.type)),
|
|
212
|
-
"category"
|
|
213
|
-
), l = Y(L(b.core, "group"));
|
|
214
|
-
W(() => {
|
|
215
|
-
!P(l, t) && !w(l) && !w(t) && a(g(l));
|
|
216
|
-
}, [l, t]);
|
|
217
|
-
const u = (i) => a((T) => T === i ? "" : i), y = !p && !w(x) || E(B(c), { category: "custom" }) !== void 0;
|
|
218
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
219
|
-
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex justify-between rounded-md bg-background/30 p-1", children: [
|
|
220
|
-
/* @__PURE__ */ e.jsxs("h1", { className: "flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row", children: [
|
|
221
|
-
"Add block",
|
|
222
|
-
/* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s === "html" ? "(Enter or paste your own HTML code)" : "(Drag & drop into tree view or click to add)" })
|
|
223
|
-
] }),
|
|
224
|
-
/* @__PURE__ */ e.jsxs(
|
|
225
|
-
"button",
|
|
226
|
-
{
|
|
227
|
-
onClick: () => m(!1),
|
|
228
|
-
className: "flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",
|
|
229
|
-
children: [
|
|
230
|
-
/* @__PURE__ */ e.jsx(Ne, { width: 12 }),
|
|
231
|
-
" Close"
|
|
232
|
-
]
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
] }),
|
|
236
|
-
/* @__PURE__ */ e.jsx(
|
|
237
|
-
fe,
|
|
238
|
-
{
|
|
239
|
-
onValueChange: (i) => {
|
|
240
|
-
d(""), r(i);
|
|
241
|
-
},
|
|
242
|
-
value: s,
|
|
243
|
-
className: "h-max",
|
|
244
|
-
children: /* @__PURE__ */ e.jsxs(be, { className: "grid w-full " + (y ? "grid-cols-3" : "grid-cols-2"), children: [
|
|
245
|
-
/* @__PURE__ */ e.jsx(A, { value: "core", children: "Core" }),
|
|
246
|
-
y ? /* @__PURE__ */ e.jsx(A, { value: "ui-blocks", children: "UI Blocks" }) : null,
|
|
247
|
-
/* @__PURE__ */ e.jsx(A, { value: "html", children: "Import" })
|
|
248
|
-
] })
|
|
249
|
-
}
|
|
250
|
-
),
|
|
251
|
-
s === "core" && /* @__PURE__ */ e.jsx(ge, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(je, { type: "single", value: t, className: "w-full px-3", children: v.Children.toArray(
|
|
252
|
-
L(
|
|
253
|
-
l,
|
|
254
|
-
(i) => M(k(B(b.core), { group: i }), {
|
|
255
|
-
hidden: !0
|
|
256
|
-
}).length ? /* @__PURE__ */ e.jsxs(ye, { value: i, className: "border-border", children: [
|
|
257
|
-
/* @__PURE__ */ e.jsx(we, { onClick: () => u(i), className: "py-2 capitalize", children: i }),
|
|
258
|
-
/* @__PURE__ */ e.jsx(ke, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children: v.Children.toArray(
|
|
259
|
-
M(k(B(b.core), { group: i }), { hidden: !0 }).map((T) => /* @__PURE__ */ e.jsx(Le, { block: T }))
|
|
260
|
-
) }) })
|
|
261
|
-
] }) : null
|
|
262
|
-
)
|
|
263
|
-
) }) }),
|
|
264
|
-
s === "ui-blocks" && /* @__PURE__ */ e.jsx(J, { fallback: /* @__PURE__ */ e.jsx(Be, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
265
|
-
s === "html" && /* @__PURE__ */ e.jsx(He, {})
|
|
266
|
-
] });
|
|
267
|
-
};
|
|
268
|
-
export {
|
|
269
|
-
Ps as default
|
|
270
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-W5drgyWI.cjs"),y=require("react-dnd"),w=require("@radix-ui/react-icons"),k=require("@chaibuilder/runtime"),q=require("lucide-react"),A=require("./lib.cjs"),T=require("./utils-It2K33fU.cjs");require("./MODIFIERS-WFzDQfiT.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-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("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("react-i18next");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");const C=({block:r})=>{const{type:o,icon:l,label:c}=r,{addCoreBlock:d,addPredefinedBlock:m}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.activePanelAtom),[,i]=g.useAtom(s.addBlocksModalAtom),E=()=>{t.has(r,"blocks")?m(k.syncBlocksWithDefaults(r.blocks),t.first(p)):d(r,t.first(p)),i(!1),x("layers")},[,f,j]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||o).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:f,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(l||w.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||o})})]})]})},N=({block:r,closePopover:o})=>{var j;const[l,c]=n.useState(!1),d=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=s.useAddBlock(),[x]=s.useSelectedBlockIds(),[,i,E]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),f=n.useCallback(async b=>{if(b.stopPropagation(),t.has(r,"component")){m(r,t.first(x)),o();return}c(!0);const a=await d(r);t.isEmpty(a)||p(k.syncBlocksWithDefaults(a),t.first(x)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=r.name||r.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:l?()=>{}:f,className:"relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(q.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.name})})]})]})},I=()=>{const{data:r,isLoading:o}=s.useUILibraryBlocks(),l=k.useChaiBlocks(),c=t.filter(t.values(l),{category:"custom"}),d=t.groupBy(c,"group"),m=t.groupBy(r,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>t.mergeWith(d,m,(a,h)=>{if(t.isArray(a)&&t.isArray(h))return[...a,...h]}),[d,m]),[,E]=g.useAtom(s.addBlocksModalAtom),[f,j]=n.useState("Navbar"),b=t.get(i,f,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:o?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):n.Children.toArray(t.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const R=setTimeout(()=>{j(h)},300);x(R)},onClick:()=>j(h),className:T.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",f===h?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:h})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:n.Children.toArray(b.map(a=>e.jsxRuntimeExports.jsx(N,{block:a,closePopover:()=>E(!1)})))})]})},L=()=>{const[r,o]=n.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[c]=s.useSelectedBlockIds(),[,d]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,p]=g.useAtom(s.addBlocksModalAtom),x=()=>{const i=A.getBlocksFromHTML(r);l([...i],t.first(c)||null),o(""),d(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(s.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(s.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),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:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:r,onChange:i=>o(i.target.value),rows:12,placeholder:`<div>
|
|
2
|
-
<h1>Enter code here</h1>
|
|
3
|
-
</div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:r.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(s.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(w.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},v=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],P=(r,o)=>{if(!r)return!t.includes(v,o);const l=r._type;return l==="List"?o==="ListItem":l==="Table"?o==="TableHead"||o==="TableBody":l==="TableHead"||l==="TableBody"?o==="TableRow":l==="TableRow"?o==="TableCell":l==="Row"?o==="Column":!t.includes(v,o)},S=()=>{const[r,o]=n.useState("core"),[l,c]=n.useState("basic"),d=k.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[,p]=g.useAtom(s.addBlocksModalAtom),[x]=s.useSelectedBlockIds(),i=s.useAllBlocks(),E=t.find(i,{_id:t.first(x)}),{data:f,isLoading:j}=s.useUILibraryBlocks(),b=t.groupBy(t.filter(d,u=>P(E,u.type)),"category"),a=t.uniq(t.map(b.core,"group"));n.useEffect(()=>{!t.includes(a,l)&&!t.isEmpty(a)&&!t.isEmpty(l)&&c(t.first(a))},[a,l]);const h=u=>c(B=>B===u?"":u),R=!j&&!t.isEmpty(f)||t.find(t.values(d),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(w.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:u=>{m(""),o(u)},value:r,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(R?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),R?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:"Import"})]})}),r==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:l,className:"w-full px-3",children:n.Children.toArray(t.map(a,u=>t.reject(t.filter(t.values(b.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>h(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(t.reject(t.filter(t.values(b.core),{group:u}),{hidden:!0}).map(B=>e.jsxRuntimeExports.jsx(C,{block:B})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(I,{})}),r==="html"&&e.jsxRuntimeExports.jsx(L,{})]})};exports.default=S;
|