@chaibuilder/sdk 1.2.8 → 1.2.10
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-tMxKPoen.js → AddBlocks-GiMnBMeQ.js} +28 -29
- package/dist/AddBlocks-SzURo9Bj.cjs +1 -0
- package/dist/{BrandingOptions-QJJ1y5ez.js → BrandingOptions-10jJO8mG.js} +3 -4
- package/dist/BrandingOptions-yK-54R-c.cjs +1 -0
- package/dist/CanvasArea-6O8dMPug.cjs +60 -0
- package/dist/{CanvasArea-EfZgx-gN.js → CanvasArea-jgBDM5Qd.js} +459 -474
- package/dist/CurrentPage-1y62Ne77.cjs +1 -0
- package/dist/{CurrentPage-ulHTz4MD.js → CurrentPage-lakeZviD.js} +4 -5
- package/dist/{Layers-rehZkz78.js → Layers-R7TfREUd.js} +115 -148
- package/dist/Layers-Z4nmm9xK.cjs +1 -0
- package/dist/{PagesPanel-acGVGJf-.js → PagesPanel-4mqxCFHq.js} +4 -5
- package/dist/PagesPanel-ouHdxyOH.cjs +1 -0
- package/dist/{ProjectPanel-aLFJq49M.js → ProjectPanel-Wy2nw-1w.js} +11 -12
- package/dist/ProjectPanel-hHolYZjt.cjs +1 -0
- package/dist/Settings-EYOw02iE.cjs +1 -0
- package/dist/{Settings-v-txwlII.js → Settings-_K28Ontt.js} +536 -565
- package/dist/{SidePanels-Vdc-J5wK.js → SidePanels-6slnxdSj.js} +45 -41
- package/dist/SidePanels-U-_O1QN8.cjs +1 -0
- package/dist/{Topbar-j4t4AgCq.js → Topbar-bwt6HjlL.js} +4 -5
- package/dist/Topbar-dQEoY2P8.cjs +1 -0
- package/dist/{UnsplashImages-41Y3q5_Q.js → UnsplashImages-V29UE-57.js} +16 -17
- package/dist/UnsplashImages-pGgaUPQy.cjs +1 -0
- package/dist/UploadImages-7oLycdSh.cjs +1 -0
- package/dist/{UploadImages-xBg-kbKv.js → UploadImages-E0mi_qn8.js} +3 -4
- package/dist/{add-page-modal-6DlGzdA4.js → add-page-modal-FJEAqfD3.js} +9 -10
- package/dist/add-page-modal-In6XI-vZ.cjs +1 -0
- package/dist/{confirm-alert-i4pM3mOt.js → confirm-alert-5hfE116f.js} +3 -4
- package/dist/{confirm-alert-U7-NcG7G.cjs → confirm-alert-Vwd3OzL9.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +12 -8
- package/dist/core.js +46 -46
- package/dist/delete-page-modal-tl7FLK9J.cjs +1 -0
- package/dist/{delete-page-modal-T_rlQfNd.js → delete-page-modal-wH0yLiQI.js} +17 -18
- package/dist/{form-VbouZlAW.cjs → form-1j01gADS.cjs} +1 -1
- package/dist/{form-OVmsLOrc.js → form-UVHCD9N3.js} +18 -18
- package/dist/index-7ogwGh39.cjs +1 -0
- package/dist/index-B4sL0YTN.js +3124 -0
- package/dist/{index-EGUphg4R.js → index-c2VLKuhY.js} +4886 -4884
- package/dist/{index-jw8RxsTv.cjs → index-xbQL0wpz.cjs} +25 -25
- package/dist/page-viewer-SfQUe0SI.cjs +1 -0
- package/dist/{page-viewer-EoYYnA56.js → page-viewer-TcK0I240.js} +6 -7
- package/dist/{project-general-setting-DC_nADG-.js → project-general-setting-4ruKl033.js} +5 -6
- package/dist/project-general-setting-t7E2Y_w9.cjs +1 -0
- package/dist/{project-seo-setting-Snn2nZgS.cjs → project-seo-setting-4b_BJZDF.cjs} +1 -1
- package/dist/{project-seo-setting-wxAGEkd_.js → project-seo-setting-d1EZlacB.js} +7 -8
- package/dist/single-page-detail-KuXd9Mur.cjs +1 -0
- package/dist/{single-page-detail-xtNZ9YxX.js → single-page-detail-PihQi-dP.js} +6 -7
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -4
- package/dist/style.css +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +110 -111
- package/dist/{useAddBlockByDrop-inkD7Lck.cjs → useAddBlockByDrop-nLzs79He.cjs} +1 -1
- package/dist/{useAddBlockByDrop-_nwI4W3q.js → useAddBlockByDrop-rcDR-z9_.js} +1 -1
- package/dist/web-blocks.cjs +1 -9
- package/dist/web-blocks.js +460 -455
- package/package.json +1 -1
- package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
- package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
- package/dist/CanvasArea-rIDwPHl5.cjs +0 -60
- package/dist/CurrentPage-QNFPD078.cjs +0 -1
- package/dist/Layers-v-7k3W2I.cjs +0 -1
- package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
- package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
- package/dist/PagesPanel-x5ms_LOD.cjs +0 -1
- package/dist/ProjectPanel-5BHQ5ANP.cjs +0 -1
- package/dist/Settings-iOjfw5NQ.cjs +0 -1
- package/dist/SidePanels-t0g9ZQFT.cjs +0 -1
- package/dist/Topbar-V8xCetWF.cjs +0 -1
- package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
- package/dist/UploadImages-DnQ95_NW.cjs +0 -1
- package/dist/add-page-modal-0YAI9dXr.cjs +0 -1
- package/dist/delete-page-modal-qXpi_2xR.cjs +0 -1
- package/dist/index-H6vIwGfD.cjs +0 -1
- package/dist/index-niHREMmR.js +0 -2938
- package/dist/page-viewer-Ou8vDXGV.cjs +0 -1
- package/dist/project-general-setting-92q4oEYv.cjs +0 -1
- package/dist/single-page-detail-QmmhR_h2.cjs +0 -1
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bh as j, bk as J, bi as K, bj as N, bv as O, bH as Q, A as U, ar as W, H as X, C as Y, F as Z, G as _, D as $, E as aa, z as ea, bw as oa, bI as ta, B as ra, bp as sa, bs as na, br as ia, bu as ba, bq as pa, bK as ua, b3 as ma, cl as ca, b6 as la, b7 as da, b4 as ga, b8 as Ca, b5 as Ma, cn as Sa, cm as Da, bA as Ta, co as xa, bz as Aa, ct as wa, by as ha, cq as Ia, cu as Pa, cy as Fa, cp as Ga, cr as va, cs as Ha, cv as La, cw as ka, cx as Ra, bB as Ba, am as ya, an as Ea, aq as Va, b9 as fa, ao as qa, ap as za, ba as ja, aN as Ja, aS as Ka, aP as Na, cc as Oa, c9 as Qa, aQ as Ua, cd as Wa, ch as Xa, ca as Ya, aR as Za, cb as _a, ce as $a, cf as ae, cg as ee, aO as oe, aK as te, aM as re, aL as se, be as ne, bf as ie, bl as be, aI as pe, bg as ue, bM as me, bT as ce, bP as le, bZ as de, bQ as ge, bS as Ce, bN as Me, bW as Se, bU as De, bV as Te, bR as xe, b$ as Ae, b_ as we, bX as he, bY as Ie, bO as Pe, b0 as Fe, b2 as Ge, b1 as ve, bd as He, bo as Le, bL as ke, as as Re, av as Be, aC as ye, aw as Ee, aD as Ve, c0 as fe, at as qe, au as ze, aH as je, c1 as Je, c3 as Ke, c4 as Ne, c8 as Oe, c6 as Qe, c5 as Ue, c7 as We, c2 as Xe, S as Ye, aJ as Ze, ay as _e, aB as $e, az as ao, aA as eo, bt as oo, y as to, bE as ro, aE as so, aG as no, bm as io, T as bo, aF as po, bJ as uo, bG as mo, ci as co, ck as lo, bF as go, cj as Co } from "./index-B4sL0YTN.js";
|
|
2
2
|
import "./jsx-runtime-WbnYoNE9.js";
|
|
3
3
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
4
4
|
import "react";
|
|
@@ -36,145 +36,144 @@ import "flat-to-nested";
|
|
|
36
36
|
import "./Functions-7jnEwJyw.js";
|
|
37
37
|
import "redux-undo";
|
|
38
38
|
import "@chaibuilder/runtime";
|
|
39
|
-
import "lodash";
|
|
40
39
|
import "@react-hookz/web";
|
|
41
40
|
import "react-i18next";
|
|
42
41
|
export {
|
|
43
42
|
j as Accordion,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
J as AccordionContent,
|
|
44
|
+
K as AccordionItem,
|
|
45
|
+
N as AccordionTrigger,
|
|
46
|
+
O as Alert,
|
|
47
|
+
Q as AlertDescription,
|
|
49
48
|
U as AlertDialog,
|
|
50
49
|
W as AlertDialogAction,
|
|
51
50
|
X as AlertDialogCancel,
|
|
52
51
|
Y as AlertDialogContent,
|
|
53
52
|
Z as AlertDialogDescription,
|
|
54
53
|
_ as AlertDialogFooter,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
$ as AlertDialogHeader,
|
|
55
|
+
aa as AlertDialogTitle,
|
|
56
|
+
ea as AlertDialogTrigger,
|
|
57
|
+
oa as AlertTitle,
|
|
58
|
+
ta as Badge,
|
|
59
|
+
ra as Button,
|
|
60
|
+
sa as Card,
|
|
61
|
+
na as CardContent,
|
|
62
|
+
ia as CardDescription,
|
|
63
|
+
ba as CardFooter,
|
|
64
|
+
pa as CardHeader,
|
|
65
|
+
ua as CardTitle,
|
|
66
|
+
ma as Command,
|
|
68
67
|
ca as CommandDialog,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
la as CommandEmpty,
|
|
69
|
+
da as CommandGroup,
|
|
70
|
+
ga as CommandInput,
|
|
71
|
+
Ca as CommandItem,
|
|
72
|
+
Ma as CommandList,
|
|
73
|
+
Sa as CommandSeparator,
|
|
74
|
+
Da as CommandShortcut,
|
|
75
|
+
Ta as ContextMenu,
|
|
76
|
+
xa as ContextMenuCheckboxItem,
|
|
77
|
+
Aa as ContextMenuContent,
|
|
78
|
+
wa as ContextMenuGroup,
|
|
79
|
+
ha as ContextMenuItem,
|
|
80
|
+
Ia as ContextMenuLabel,
|
|
81
|
+
Pa as ContextMenuPortal,
|
|
82
|
+
Fa as ContextMenuRadioGroup,
|
|
83
|
+
Ga as ContextMenuRadioItem,
|
|
85
84
|
va as ContextMenuSeparator,
|
|
86
85
|
Ha as ContextMenuShortcut,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
La as ContextMenuSub,
|
|
87
|
+
ka as ContextMenuSubContent,
|
|
88
|
+
Ra as ContextMenuSubTrigger,
|
|
89
|
+
Ba as ContextMenuTrigger,
|
|
90
|
+
ya as Dialog,
|
|
91
|
+
Ea as DialogContent,
|
|
92
|
+
Va as DialogDescription,
|
|
93
|
+
fa as DialogFooter,
|
|
94
|
+
qa as DialogHeader,
|
|
95
|
+
za as DialogTitle,
|
|
97
96
|
ja as DialogTrigger,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
Ja as DropdownMenu,
|
|
98
|
+
Ka as DropdownMenuCheckboxItem,
|
|
99
|
+
Na as DropdownMenuContent,
|
|
100
|
+
Oa as DropdownMenuGroup,
|
|
101
|
+
Qa as DropdownMenuItem,
|
|
103
102
|
Ua as DropdownMenuLabel,
|
|
104
103
|
Wa as DropdownMenuPortal,
|
|
105
104
|
Xa as DropdownMenuRadioGroup,
|
|
106
105
|
Ya as DropdownMenuRadioItem,
|
|
107
106
|
Za as DropdownMenuSeparator,
|
|
108
107
|
_a as DropdownMenuShortcut,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
108
|
+
$a as DropdownMenuSub,
|
|
109
|
+
ae as DropdownMenuSubContent,
|
|
110
|
+
ee as DropdownMenuSubTrigger,
|
|
111
|
+
oe as DropdownMenuTrigger,
|
|
112
|
+
te as HoverCard,
|
|
113
|
+
re as HoverCardContent,
|
|
114
|
+
se as HoverCardTrigger,
|
|
115
|
+
ne as IconPickerField,
|
|
116
|
+
ie as ImagePickerField,
|
|
117
|
+
be as Input,
|
|
118
|
+
pe as Label,
|
|
119
|
+
ue as LinkField,
|
|
120
|
+
me as Menubar,
|
|
122
121
|
ce as MenubarCheckboxItem,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
le as MenubarContent,
|
|
123
|
+
de as MenubarGroup,
|
|
124
|
+
ge as MenubarItem,
|
|
125
|
+
Ce as MenubarLabel,
|
|
126
|
+
Me as MenubarMenu,
|
|
127
|
+
Se as MenubarPortal,
|
|
128
|
+
De as MenubarRadioGroup,
|
|
129
|
+
Te as MenubarRadioItem,
|
|
130
|
+
xe as MenubarSeparator,
|
|
131
|
+
Ae as MenubarShortcut,
|
|
132
|
+
we as MenubarSub,
|
|
133
|
+
he as MenubarSubContent,
|
|
134
|
+
Ie as MenubarSubTrigger,
|
|
135
|
+
Pe as MenubarTrigger,
|
|
136
|
+
Fe as Popover,
|
|
137
|
+
Ge as PopoverContent,
|
|
139
138
|
ve as PopoverTrigger,
|
|
140
139
|
He as RTEField,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
140
|
+
Le as ScrollArea,
|
|
141
|
+
ke as ScrollBar,
|
|
142
|
+
Re as Select,
|
|
143
|
+
Be as SelectContent,
|
|
144
|
+
ye as SelectGroup,
|
|
145
|
+
Ee as SelectItem,
|
|
146
|
+
Ve as SelectLabel,
|
|
147
|
+
fe as SelectSeparator,
|
|
148
|
+
qe as SelectTrigger,
|
|
149
|
+
ze as SelectValue,
|
|
151
150
|
je as Separator,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
Je as Sheet,
|
|
152
|
+
Ke as SheetClose,
|
|
153
|
+
Ne as SheetContent,
|
|
154
|
+
Oe as SheetDescription,
|
|
155
|
+
Qe as SheetFooter,
|
|
157
156
|
Ue as SheetHeader,
|
|
158
157
|
We as SheetTitle,
|
|
159
158
|
Xe as SheetTrigger,
|
|
160
159
|
Ye as Skeleton,
|
|
161
160
|
Ze as Switch,
|
|
162
161
|
_e as Tabs,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
162
|
+
$e as TabsContent,
|
|
163
|
+
ao as TabsList,
|
|
164
|
+
eo as TabsTrigger,
|
|
165
|
+
oo as Textarea,
|
|
166
|
+
to as Toaster,
|
|
167
|
+
ro as Toggle,
|
|
168
|
+
so as Tooltip,
|
|
169
|
+
no as TooltipContent,
|
|
170
|
+
io as TooltipPortal,
|
|
171
|
+
bo as TooltipProvider,
|
|
172
|
+
po as TooltipTrigger,
|
|
173
|
+
uo as badgeVariants,
|
|
174
|
+
mo as buttonVariants,
|
|
176
175
|
co as reducer,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
lo as toast,
|
|
177
|
+
go as toggleVariants,
|
|
178
|
+
Co as useToast
|
|
180
179
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react"),u=require("lodash-es"),t=require("./index-
|
|
1
|
+
"use strict";const n=require("react"),u=require("lodash-es"),t=require("./index-7ogwGh39.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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback as n } from "react";
|
|
2
2
|
import { has as s } from "lodash-es";
|
|
3
|
-
import {
|
|
3
|
+
import { L as a, i as u } from "./index-B4sL0YTN.js";
|
|
4
4
|
const B = () => {
|
|
5
5
|
const { addCoreBlock: r } = a(), l = u("getExternalPredefinedBlock");
|
|
6
6
|
return n(
|
package/dist/web-blocks.cjs
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("lodash-es"),v=require("react"),l=require("./controls-Dy1qa8Dc.cjs"),d=require("@chaibuilder/runtime"),a=require("./jsx-runtime-Z_BpKhVy.cjs"),h=require("./Functions-N3yhPYKY.cjs"),p=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function S(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const u=S(v),R=o=>{const{blockProps:e,backgroundImage:t,children:r,styles:n}=o;let s={};return t&&(s={backgroundImage:`url(${t})`}),u.createElement("div",{...e,...n,style:s},r)};d.registerChaiBlock(R,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:l.S({default:"font-body antialiased"}),backgroundImage:l.o({title:"Background Image"})}});const g=({blockProps:o,className:e="",styles:t={}})=>a.jsxRuntimeExports.jsx("div",{...o,className:h.cn("flex h-20 flex-col items-center justify-center",e),...b.omit(t,["className"]),children:a.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300",children:a.jsxRuntimeExports.jsx("span",{className:"opacit flex items-center gap-x-1.5 text-xs font-semibold text-gray-400"})})}),L=u.memo(o=>{const{blockProps:e,backgroundImage:t,children:r,tag:n="div",styles:s}=o;if(!r&&b.isEmpty(s==null?void 0:s.className))return a.jsxRuntimeExports.jsx(g,{blockProps:e,styles:s});let i={};return t&&(i={backgroundImage:`url(${t})`}),u.createElement(n,{...e,...s,style:i},r)});d.registerChaiBlock(L,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:l.S({default:""}),tag:l.f({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:l.o({title:"Background Image"})}});const T=o=>{const{blockProps:e,styles:t,content:r,level:n="h1",children:s=null}=o;return s?u.createElement(n,{...t,...e},s):u.createElement(n,{...t,...e,dangerouslySetInnerHTML:{__html:r}})};d.registerChaiBlock(T,{type:"Heading",label:"Heading",category:"core",icon:p.HeadingIcon,group:"basic",props:{level:l.f({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:l.S({default:"text-3xl"}),content:l.g({title:"Content",default:"Heading goes here"})}});const w=o=>{const{blockProps:e,styles:t,content:r}=o;return b.isNull(o.children)?u.createElement("div",{...t,...e,dangerouslySetInnerHTML:{__html:r}}):u.createElement("p",{...t,...e},o.children)};d.registerChaiBlock(w,{type:"Paragraph",label:"Paragraph",category:"core",icon:p.TextIcon,group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})}});const _=o=>{const{blockProps:e,styles:t,content:r,children:n=null,tag:s}=o;return n?u.createElement("span",{...t,...e},n):u.createElement(s||"span",{...t,...e,dangerouslySetInnerHTML:{__html:r}})};d.registerChaiBlock(_,{type:"Span",label:"Span",category:"core",group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"Enter your content"})}});const C=o=>{const{blockProps:e,content:t,styles:r}=o;return a.jsxRuntimeExports.jsx("div",{className:"prose max-w-full",children:a.jsxRuntimeExports.jsx("div",{...e,...r,dangerouslySetInnerHTML:{__html:t}})})};d.registerChaiBlock(C,{type:"RichText",label:"Rich Text",category:"core",icon:p.CursorTextIcon,group:"basic",props:{styles:l.S({default:""}),content:l.m({title:"Content",default:`Lorem Ipsum Rich Text Editor Demo
|
|
2
|
-
|
|
3
|
-
Welcome to our rich text editor demo! With our powerful editor, you can create stunning documents with ease. Let's explore some of its features:
|
|
4
|
-
|
|
5
|
-
Text Formatting: You can make text bold, italic, or underline it.
|
|
6
|
-
Lists:
|
|
7
|
-
Create ordered lists.
|
|
8
|
-
Craft unordered lists.
|
|
9
|
-
Utilize nested lists for organization.`})}});const P=o=>{const{blockProps:e,iconSize:t,icon:r,content:n,iconPos:s,styles:i,children:c}=o,m=r,f=c||a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[n,m&&a.jsxRuntimeExports.jsx("div",{style:{width:t+"px"},className:s+(s==="order-first"?" mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:m}})]});return u.createElement("button",{...e,...i,type:"button"},f)};d.registerChaiBlock(P,{type:"Button",label:"Button",category:"core",icon:p.ButtonIcon,group:"basic",props:{content:l.u({title:"Label",default:"Button",multiLingual:!0}),styles:l.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),link:l.q({title:"Link",default:{type:"page",href:"",target:"_blank"}}),icon:l.T({title:"Icon",default:""}),iconSize:l.c({title:"Icon Size",default:24}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const N=o=>{const{blockProps:e,link:t,children:r,styles:n,inBuilder:s,content:i}=o;return!r&&b.isEmpty(n==null?void 0:n.className)&&b.isEmpty(i)?a.jsxRuntimeExports.jsx(g,{blockProps:e}):s?r?a.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...e,...n,children:r}):u.createElement("span",{...e,...n,href:t.href||"#",target:t.target||"_self",dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):r?a.jsxRuntimeExports.jsx("a",{href:t.href||"#/",target:t.target,...e,...n,children:r}):u.createElement("a",{...e,...n,href:t.href||"#",target:t.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(N,{type:"Link",label:"Link",category:"core",icon:p.Link1Icon,group:"basic",props:{styles:l.S({default:""}),content:l.u({title:"Content",default:""}),link:l.q({title:"Link",default:{type:"page",target:"_self",href:""}})}});const M=o=>{const{blockProps:e,children:t,listType:r,styles:n,tag:s}=o,i=h.cn(b.get(n,"className",""),r);return!t&&b.isEmpty(n==null?void 0:n.className)?a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"LIST ITEM"}):u.createElement(s||(r==="list-decimal"?"ol":"ul"),{...e,...n,className:i},t)};d.registerChaiBlock(M,{type:"List",label:"List",icon:p.RowsIcon,category:"core",group:"basic",props:{styles:l.S({default:""}),listType:l.f({title:"List type",default:"list-disc",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const H=o=>{const{blockProps:e,content:t,styles:r,children:n,tag:s}=o;return n?u.createElement(s||"li",{...r,...e},n):u.createElement(s||"li",{...r,...e,dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(H,{type:"ListItem",label:"List Item",icon:p.ColumnsIcon,category:"core",group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"List item"})}});const U=o=>{const{blockProps:e,icon:t,styles:r}=o,n={...r,className:h.cn(r.className,"inline-block c-inline-block")};return b.isEmpty(t)?a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"",className:"h-8 w-14"}):u.createElement("span",{...e,...n,dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(U,{type:"Icon",label:"Icon",category:"core",icon:p.SketchLogoIcon,group:"basic",props:{styles:l.S({default:"text-black"}),icon:l.T({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'})}});const D=o=>{const{blockProps:e,image:t,styles:r,alt:n,height:s=200,width:i=200}=o;return b.isEmpty(t)?a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"IMAGE URL",className:"h-36"}):u.createElement("img",{...e,...r,src:t,alt:n,height:s,width:i})};d.registerChaiBlock(D,{type:"Image",label:"Image",category:"core",icon:p.ImageIcon,group:"basic",props:{styles:l.S({default:""}),image:l.o({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.u({title:"Alt",default:""}),width:l.u({title:"Width",default:""}),height:l.u({title:"Height",default:""})}});const q=o=>{var s;const{blockProps:e,styles:t,children:r}=o;let n=null;return r||(n=a.jsxRuntimeExports.jsx("div",{className:h.cn("flex flex-col items-center justify-center",(s=o.emptyStyles)==null?void 0:s.className),children:a.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:a.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",o.name]})})})),u.createElement("div",{...t,...e,droppable:"yes"},r||n)};d.registerChaiBlock(q,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:l.S({default:""}),emptyStyles:l.S({default:""})}});const j=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,I=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,B=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,F=o=>{if(j.test(o)){const e=o.match(j);return e?`https://www.youtube.com/embed/${e[4]}`:o}if(I.test(o)){const e=o.match(I);return e?`https://player.vimeo.com/video/${e[3]}`:o}if(B.test(o)){const e=o.match(B);return e?`https://www.dailymotion.com/embed/video/${e[4]}`:o}return null},z=u.memo(o=>{const{blockProps:e,inBuilder:t,styles:r,url:n,controls:s}=o,i=b.get(s,"autoPlay",!1),c=b.get(s,"controls",!1),m=i||b.get(s,"muted",!0),f=b.get(s,"loop",!1);if(b.isEmpty(n))return a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"VIDEO URL",className:"h-36"});let y=F(n),x=null;if(y){if(!b.isEmpty(y)){const k=[];k.push(`autoplay=${i?1:0}`),k.push(`controls=${s?1:0}`),k.push(`mute=${m?1:0}&muted=${m?1:0}`),k.push(`loop=${f?1:0}`),y=`${y}?${k.join("&")}`}x=u.createElement("iframe",{...e,...r,src:y,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else x=u.createElement("video",{...e,...r,src:n,controls:c,muted:m,autoPlay:t?!1:i,loop:f});return a.jsxRuntimeExports.jsxs("div",{className:"relative h-full w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?a.jsxRuntimeExports.jsx("div",{...e,...r,className:"absolute z-20 h-full w-full"}):null,x]})});d.registerChaiBlock(z,{type:"Video",label:"Video",category:"core",icon:p.VideoIcon,group:"basic",props:{styles:l.S({default:"absolute top-0 left-0 w-full h-full"}),url:l.u({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:l.b({title:"Controls",properties:{autoPlay:l.r({title:"Autoplay",default:!0}),controls:l.r({title:"Show widgets",default:!1}),loop:l.r({title:"Loop",default:!1}),muted:l.r({title:"Muted",default:!0})}})}});const O=u.memo(o=>{const{blockProps:e,styles:t,content:r,inBuilder:n}=o;return a.jsxRuntimeExports.jsxs("div",{className:"relative",children:[n?a.jsxRuntimeExports.jsx("div",{...e,...t,className:"absolute h-full w-full z-20"}):null,u.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r}})]})});d.registerChaiBlock(O,{type:"CustomHTML",label:"CustomHTML",category:"core",icon:p.CodeIcon,group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const A=o=>{const{blockProps:e,styles:t}=o;return u.createElement("hr",{...t,...e})};d.registerChaiBlock(A,{type:"Divider",label:"Divider",category:"core",icon:p.DividerHorizontalIcon,group:"basic",props:{styles:l.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const $=o=>{const{blockProps:e,styles:t}=o;return u.createElement("br",{...e,...t})};d.registerChaiBlock($,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:p.SpaceBetweenVerticallyIcon,props:{styles:l.S({default:""})}});const V=o=>o.inBuilder?a.jsxRuntimeExports.jsx("span",{className:"inline",...o.blockProps,children:o.content}):`${o.content}`;d.registerChaiBlock(V,{type:"Text",label:"Text",hidden:!0,category:"core",group:"basic",icon:p.SpaceBetweenVerticallyIcon,props:{content:l.g({title:"Content",defaultValue:""})}});const E=o=>{const e=(s,i)=>({_id:h.generateUUID(),_parent:s,_type:"TableCell",styles:"#styles:,",content:`${o==="TableHead"?"Table Head":"Table Cell "+i}`}),t=s=>{const i=h.generateUUID(),c={_type:"TableRow",_id:i,styles:"#styles:,border-b"};return s&&(c._parent=s),[c,e(i,"1"),e(i,"2"),e(i,"3")]},r=s=>{const i=h.generateUUID(),c={_id:i,_type:"TableHead",styles:"#styles:,font-medium"};return s&&(c._parent=s),[c,...t(i)]},n=s=>{const i=h.generateUUID(),c={_id:i,_type:"TableBody",styles:"#styles:,"};return s&&(c._parent=s),[c,...t(i),...t(i)]};if(o==="Table"){const s=h.generateUUID();return[{_id:s,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(s),...n(s)]}return o==="TableRow"?t():o==="TableHead"?r():o==="TableBody"?n():[]},W=o=>{const{blockProps:e,children:t,styles:r}=o;return t?u.createElement("table",{...e,...r},t):a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"TABLE HEAD / BODY"})};d.registerChaiBlock(W,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:p.TableIcon,props:{styles:l.S({default:""})},blocks:E("Table")});const G=o=>{const{blockProps:e,children:t,styles:r}=o;return t?u.createElement("thead",{...e,...r},t):a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"TABLE ROW"})};d.registerChaiBlock(G,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:p.BorderTopIcon,props:{styles:l.S({default:""})},blocks:E("TableHead")});const Y=o=>{const{blockProps:e,children:t,styles:r}=o;return t?u.createElement("tbody",{...e,...r},t):a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"TABLE ROW"})};d.registerChaiBlock(Y,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:p.BorderAllIcon,props:{styles:l.S({default:""})},blocks:E("TableBody")});const X=o=>{const{blockProps:e,children:t,styles:r}=o;return t?u.createElement("tr",{...e,...r},t):a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"TABLE CELL"})};d.registerChaiBlock(X,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:p.ViewHorizontalIcon,props:{styles:l.S({default:"w-full"})},blocks:E("TableRow")});const Z=o=>{const{blockProps:e,children:t,content:r,styles:n}=o;return!t&&b.isEmpty(r)?a.jsxRuntimeExports.jsx(g,{blockProps:e}):t?u.createElement("td",{...e,...n},t):u.createElement("td",{...e,...n,dangerouslySetInnerHTML:{__html:r}})};d.registerChaiBlock(Z,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:p.DragHandleHorizontalIcon,props:{styles:l.S({default:""}),content:l.m({title:"Content",default:"Table cell item"})}});const J=o=>{const{blockProps:e,errorMessage:t,name:r,_type:n,successMessage:s,action:i,styles:c,children:m}=o;if(!m&&b.isEmpty(c==null?void 0:c.className))return a.jsxRuntimeExports.jsx(g,{blockProps:e,text:"FORM FIELDS"});const f={"x-data":"useForm","x-on:submit.prevent":"post"},y={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return a.jsxRuntimeExports.jsxs("form",{...f,"data-error":t,"data-success":s,method:"post",action:i,...e,...c,children:[a.jsxRuntimeExports.jsx("div",{...y}),a.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:r||n}),m]})};d.registerChaiBlock(J,{type:"Form",label:"Form",category:"core",icon:p.GroupIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),action:l.u({title:"Submit URL",default:"/api/form/submit"}),errorMessage:l.m({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:l.m({title:"Success Message",default:"Thank you for your submission."})}});const K=o=>{const{blockProps:e,content:t,styles:r,children:n}=o,s={...r,...e};return n?u.createElement("label",s,n):u.createElement("label",{...s,dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(K,{type:"Label",label:"Label",category:"core",icon:p.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),content:l.u({title:"Content",default:"Label"})}});const Q=o=>{const{blockProps:e,label:t,placeholder:r,styles:n,inputStyles:s,showLabel:i,required:c,inputType:m="text",inBuilder:f,fieldName:y}=o,x=h.generateUUID();return!i||m==="submit"?(m==="submit"&&(e.value=t),a.jsxRuntimeExports.jsx("input",{id:x,name:y,readOnly:f,...e,...s,...n,type:m,placeholder:r,required:c})):a.jsxRuntimeExports.jsxs("div",{...n,...e,children:[i&&a.jsxRuntimeExports.jsx("label",{htmlFor:x,children:t}),a.jsxRuntimeExports.jsx("input",{name:y,readOnly:f,...s,id:x,type:m,placeholder:r,required:c})]})};d.registerChaiBlock(Q,{type:"Input",label:"Input",category:"core",icon:p.InputIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),fieldName:l.u({title:"Field Name",default:"input"}),inputType:l.f({title:"Type",options:b.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],o=>({value:o,title:o})),default:"text"}),value:l.u({title:"Value",default:""}),showLabel:l.r({title:"Show label",default:!0}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),required:l.r({title:"Required",default:!1})}});const ee=o=>{const{blockProps:e,fieldName:t,label:r,placeholder:n,styles:s,inputStyles:i,_rows:c,showLabel:m}=o,f=h.generateUUID();return m?a.jsxRuntimeExports.jsxs("div",{...s,...e,children:[m&&a.jsxRuntimeExports.jsx("label",{htmlFor:f,children:r}),a.jsxRuntimeExports.jsx("textarea",{name:t,...i,id:f,placeholder:n,rows:c})]}):a.jsxRuntimeExports.jsx("textarea",{id:f,name:t,...e,...i,...s,placeholder:n,rows:c})};d.registerChaiBlock(ee,{type:"TextArea",label:"TextArea",category:"core",icon:p.InputIcon,group:"form",hidden:!0,props:{fieldName:l.u({title:"Field Name",default:"textarea"}),showLabel:l.r({title:"Show label",default:!0}),styles:l.S({default:""}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),_rows:l.c({title:"Rows",default:3})}});const te=o=>{const{blockProps:e,fieldName:t,label:r,placeholder:n,styles:s,inputStyles:i,required:c,showLabel:m,_multiple:f=!1}=o,y=h.generateUUID();return m?a.jsxRuntimeExports.jsxs("div",{...s,children:[m&&a.jsxRuntimeExports.jsx("label",{htmlFor:y,children:r}),a.jsxRuntimeExports.jsxs("select",{...i,id:y,placeholder:n,required:c,multiple:f,name:t,children:[a.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:n}),b.map(o.options,x=>a.jsxRuntimeExports.jsx("option",{selected:b.get(x,"selected",!1),value:x.value,dangerouslySetInnerHTML:{__html:x.label}},x.value))]})]}):a.jsxRuntimeExports.jsxs("select",{id:y,...s,...e,placeholder:n,required:c,multiple:f,name:t,children:[a.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:n}),b.map(o.options,x=>a.jsxRuntimeExports.jsx("option",{selected:b.get(x,"selected",!1),value:x.value,dangerouslySetInnerHTML:{__html:x.label}},x.value))]})};d.registerChaiBlock(te,{type:"Select",label:"Select",category:"core",icon:p.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),fieldName:l.u({title:"Field Name",default:"select"}),showLabel:l.r({title:"Show label",default:!0}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),required:l.r({title:"Required",default:!1}),_multiple:l.r({title:"Multiple Choice",default:!1}),options:l.h({title:"Options",itemProperties:{label:l.u({title:"Label",default:""}),value:l.u({title:"Value",default:""})}})}});const le=o=>{const{blockProps:e,fieldName:t,label:r,styles:n,inputStyles:s,required:i,checked:c,showLabel:m=!0}=o,f=h.generateUUID();return m?a.jsxRuntimeExports.jsxs("div",{...n,...e,children:[a.jsxRuntimeExports.jsx("input",{...s,name:t,id:f,type:"checkbox",required:i,defaultChecked:c}),r&&r!=="Label"&&a.jsxRuntimeExports.jsx("label",{htmlFor:f,children:r})]}):a.jsxRuntimeExports.jsx("input",{id:f,...e,...s,...n,type:"checkbox",required:i,name:t})};d.registerChaiBlock(le,{type:"Checkbox",label:"Checkbox",category:"core",icon:p.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:l.u({title:"Field Name",default:"checkbox"}),styles:l.S({default:"flex items-center gap-x-2"}),label:l.u({title:"Label",default:"Label"}),checked:l.r({title:"Checked",default:!1}),required:l.r({title:"Required",default:!1})}});const oe=o=>{const{blockProps:e,fieldName:t,label:r,styles:n,inputStyles:s,checked:i,required:c,showLabel:m=!0}=o,f=h.generateUUID();return m?a.jsxRuntimeExports.jsxs("div",{...n,...e,children:[a.jsxRuntimeExports.jsx("input",{...s,name:t,id:f,type:"radio",required:c,defaultChecked:i}),r&&a.jsxRuntimeExports.jsx("label",{htmlFor:f,children:r})]}):a.jsxRuntimeExports.jsx("input",{id:f,...e,...s,...n,type:"radio",required:c,checked:i,name:t})};d.registerChaiBlock(oe,{type:"Radio",label:"Radio",category:"core",icon:p.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:l.S({default:"flex items-center w-max gap-x-2"}),fieldName:l.u({title:"Field Name",default:"radio"}),label:l.u({title:"Label",default:"Label"}),checked:l.r({title:"Checked",default:!1}),required:l.r({title:"Required",default:!1})}});const re=o=>{const{blockProps:e,inBuilder:t,label:r,placeholder:n,styles:s,inputStyles:i,icon:c,iconPos:m}=o,f=h.generateUUID(),y={"x-bind:disabled":"formLoading"};return a.jsxRuntimeExports.jsxs("button",{id:f,...y,...i,...s,...e||{},type:t?"button":"submit",placeholder:n,children:[r,c&&a.jsxRuntimeExports.jsx("span",{className:m,dangerouslySetInnerHTML:{__html:c}})]})};d.registerChaiBlock(re,{type:"FormButton",label:"Submit Button",category:"core",icon:p.ButtonIcon,group:"form",hidden:!0,props:{label:l.u({title:"Label",default:"Submit"}),styles:l.S({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:l.T({title:"Icon",default:""}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const se=b.noop;exports.loadWebBlocks=se;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("lodash-es"),n=require("./jsx-runtime-Z_BpKhVy.cjs"),v=require("react"),l=require("./controls-Dy1qa8Dc.cjs"),d=require("@chaibuilder/runtime"),y=require("./Functions-N3yhPYKY.cjs"),p=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function S(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const u=S(v),g=({blockProps:e,className:t="",styles:s={}})=>n.jsxRuntimeExports.jsx("div",{...e,className:y.cn("flex h-20 flex-col items-center justify-center",t),...h.omit(s,["className"]),children:n.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300",children:n.jsxRuntimeExports.jsx("span",{className:"opacit flex items-center gap-x-1.5 text-xs font-semibold text-gray-400"})})}),R=u.memo(e=>{const{blockProps:t,backgroundImage:s,children:o,tag:a="div",styles:r}=e;if(!o&&h.isEmpty(r==null?void 0:r.className))return n.jsxRuntimeExports.jsx(g,{blockProps:t,styles:r});let i={};return s&&(i={backgroundImage:`url(${s})`}),u.createElement(a,{...t,...r,style:i},o)});d.registerChaiBlock(R,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:l.S({default:""}),tag:l.f({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:l.o({title:"Background Image"})},canAcceptBlock:()=>!0});const L=e=>{const{blockProps:t,styles:s,content:o,level:a="h1",children:r=null}=e;return r?u.createElement(a,{...s,...t},r):u.createElement(a,{...s,...t,dangerouslySetInnerHTML:{__html:o}})};d.registerChaiBlock(L,{type:"Heading",label:"Heading",category:"core",icon:p.HeadingIcon,group:"basic",props:{level:l.f({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:l.S({default:"text-3xl"}),content:l.g({title:"Content",default:"Heading goes here"})},canAcceptBlock:e=>e==="Span"||e==="Text"});const T=e=>{const{blockProps:t,styles:s,content:o}=e;return h.isNull(e.children)?u.createElement("div",{...s,...t,dangerouslySetInnerHTML:{__html:o}}):u.createElement("p",{...s,...t},e.children)};d.registerChaiBlock(T,{type:"Paragraph",label:"Paragraph",category:"core",icon:p.TextIcon,group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:e=>e==="Span"||e==="Link"});const w=e=>{const{blockProps:t,styles:s,content:o,children:a=null,tag:r}=e;return a?u.createElement("span",{...s,...t},a):u.createElement(r||"span",{...s,...t,dangerouslySetInnerHTML:{__html:o}})};d.registerChaiBlock(w,{type:"Span",label:"Span",category:"core",group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"Enter your content"})}});const _=e=>{const{blockProps:t,content:s,styles:o}=e;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{...t,...o,dangerouslySetInnerHTML:{__html:s}})})};d.registerChaiBlock(_,{type:"RichText",label:"Rich Text",category:"core",icon:p.CursorTextIcon,group:"basic",props:{styles:l.S({default:""}),content:l.m({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const C=e=>{const{blockProps:t,iconSize:s,icon:o,content:a,iconPos:r,styles:i,children:c}=e,m=o,f=c||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{children:a}),m&&n.jsxRuntimeExports.jsx("div",{style:{width:s+"px"},className:r+" "+(r==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:m}})]});return u.createElement("button",{...t,...i,type:"button"},f)};d.registerChaiBlock(C,{type:"Button",label:"Button",category:"core",icon:p.ButtonIcon,group:"basic",props:{content:l.u({title:"Label",default:"Button",multiLingual:!0}),styles:l.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:l.T({title:"Icon",default:""}),iconSize:l.c({title:"Icon Size",default:24}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const P=e=>{const{blockProps:t,link:s,children:o,styles:a,inBuilder:r,content:i}=e;return!o&&h.isEmpty(a==null?void 0:a.className)&&h.isEmpty(i)?n.jsxRuntimeExports.jsx(g,{blockProps:t}):r?o?n.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...t,...a,children:o}):u.createElement("span",{...t,...a,href:s.href||"#",target:s.target||"_self",dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):o?n.jsxRuntimeExports.jsx("a",{href:s.href||"#/",target:s.target,...t,...a,children:o}):u.createElement("a",{...t,...a,href:s.href||"#",target:s.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(P,{type:"Link",label:"Link",category:"core",icon:p.Link1Icon,group:"basic",props:{styles:l.S({default:""}),content:l.u({title:"Content",default:""}),link:l.q({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:()=>!0});const N=e=>{const{blockProps:t,children:s,listType:o,styles:a,tag:r}=e,i=y.cn(h.get(a,"className",""),o);return!s&&h.isEmpty(a==null?void 0:a.className)?n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"LIST ITEM"}):u.createElement(r||(o==="list-decimal"?"ol":"ul"),{...t,...a,className:i},s)};d.registerChaiBlock(N,{type:"List",label:"List",icon:p.RowsIcon,category:"core",group:"basic",props:{styles:l.S({default:""}),listType:l.f({title:"List type",default:"list-disc",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const M=e=>{const{blockProps:t,content:s,styles:o,children:a,tag:r}=e;return a?u.createElement(r||"li",{...o,...t},a):u.createElement(r||"li",{...o,...t,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(M,{type:"ListItem",label:"List Item",icon:p.ColumnsIcon,category:"core",group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"List item"})},canAcceptBlock:()=>!0});const H=e=>{const{blockProps:t,icon:s,styles:o,width:a,height:r}=e,i={...o,className:y.cn(o.className,"inline-block c-inline-block",`w-[${a}px]`,`h-[${r}px]`)};return h.isEmpty(s)?n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"",className:"h-8 w-14"}):u.createElement("span",{...t,...i,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(H,{type:"Icon",label:"Icon",category:"core",icon:p.SketchLogoIcon,group:"basic",props:{styles:l.S({default:"text-black"}),icon:l.T({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:l.c({title:"Width",default:40}),height:l.c({title:"Height",default:40})}});const U=e=>{const{blockProps:t,image:s,styles:o,alt:a,height:r,width:i}=e;return h.isEmpty(s)?n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"IMAGE URL",className:"h-36"}):u.createElement("img",{...t,...o,src:s,alt:a,height:r,width:i})};d.registerChaiBlock(U,{type:"Image",label:"Image",category:"core",icon:p.ImageIcon,group:"basic",props:{styles:l.S({default:""}),image:l.o({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.u({title:"Alt",default:""}),width:l.u({title:"Width",default:""}),height:l.u({title:"Height",default:""})}});const D=e=>{var r;const{blockProps:t,styles:s,children:o}=e;let a=null;return o||(a=n.jsxRuntimeExports.jsx("div",{className:y.cn("flex flex-col items-center justify-center",(r=e.emptyStyles)==null?void 0:r.className),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:n.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),u.createElement("div",{...s,...t,droppable:"yes"},o||a)};d.registerChaiBlock(D,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:l.S({default:""}),emptyStyles:l.S({default:""})},canAcceptBlock:()=>!0});const E=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,B=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,I=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,q=e=>{if(E.test(e)){const t=e.match(E);return t?`https://www.youtube.com/embed/${t[4]}`:e}if(B.test(e)){const t=e.match(B);return t?`https://player.vimeo.com/video/${t[3]}`:e}if(I.test(e)){const t=e.match(I);return t?`https://www.dailymotion.com/embed/video/${t[4]}`:e}return null},A=u.memo(e=>{const{blockProps:t,inBuilder:s,styles:o,url:a,controls:r}=e,i=h.get(r,"autoPlay",!1),c=h.get(r,"controls",!1),m=i||h.get(r,"muted",!0),f=h.get(r,"loop",!1);if(h.isEmpty(a))return n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"VIDEO URL",className:"h-36"});let b=q(a),x=null;if(b){if(!h.isEmpty(b)){const k=[];k.push(`autoplay=${i?1:0}`),k.push(`controls=${r?1:0}`),k.push(`mute=${m?1:0}&muted=${m?1:0}`),k.push(`loop=${f?1:0}`),b=`${b}?${k.join("&")}`}x=u.createElement("iframe",{...t,className:"absolute inset-0 w-full h-full",src:b,allow:s?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else x=u.createElement("video",{...t,className:"absolute inset-0 w-full h-full",src:a,controls:c,muted:m,autoPlay:s?!1:i,loop:f});return n.jsxRuntimeExports.jsx("div",{...h.pick(o,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[s?n.jsxRuntimeExports.jsx("div",{...t,...h.omit(o,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,x]})})});d.registerChaiBlock(A,{type:"Video",label:"Video",category:"core",icon:p.VideoIcon,group:"basic",props:{styles:l.S({default:""}),url:l.u({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:l.b({title:"Controls",properties:{autoPlay:l.r({title:"Autoplay",default:!0}),controls:l.r({title:"Show controls",default:!1}),loop:l.r({title:"Loop",default:!1}),muted:l.r({title:"Muted",default:!0})}})}});const F=u.memo(e=>{const{blockProps:t,styles:s,content:o,inBuilder:a}=e;return n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[a?n.jsxRuntimeExports.jsx("div",{...t,...s,className:"absolute h-full w-full z-20"}):null,u.createElement("div",{...s,dangerouslySetInnerHTML:{__html:o}})]})});d.registerChaiBlock(F,{type:"CustomHTML",label:"CustomHTML",category:"core",icon:p.CodeIcon,group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const O=e=>{const{blockProps:t,styles:s}=e;return u.createElement("hr",{...s,...t})};d.registerChaiBlock(O,{type:"Divider",label:"Divider",category:"core",icon:p.DividerHorizontalIcon,group:"basic",props:{styles:l.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const z=e=>e.inBuilder?n.jsxRuntimeExports.jsx("span",{className:"inline",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(z,{type:"Text",label:"Text",hidden:!0,category:"core",group:"basic",icon:p.SpaceBetweenVerticallyIcon,props:{content:l.g({title:"Content",defaultValue:""})}});const $=e=>{const{blockProps:t,backgroundImage:s,children:o,styles:a}=e;let r={};return s&&(r={backgroundImage:`url(${s})`}),u.createElement("div",{...t,...a,style:r},o)};d.registerChaiBlock($,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:l.S({default:"font-body antialiased"}),backgroundImage:l.o({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const V=e=>{const{blockProps:t,styles:s}=e;return u.createElement("br",{...t,...s})};d.registerChaiBlock(V,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:p.SpaceBetweenVerticallyIcon,props:{styles:l.S({default:""})}});const j=e=>{const t=(r,i)=>({_id:y.generateUUID(),_parent:r,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+i}`}),s=r=>{const i=y.generateUUID(),c={_type:"TableRow",_id:i,styles:"#styles:,border-b"};return r&&(c._parent=r),[c,t(i,"1"),t(i,"2"),t(i,"3")]},o=r=>{const i=y.generateUUID(),c={_id:i,_type:"TableHead",styles:"#styles:,font-medium"};return r&&(c._parent=r),[c,...s(i)]},a=r=>{const i=y.generateUUID(),c={_id:i,_type:"TableBody",styles:"#styles:,"};return r&&(c._parent=r),[c,...s(i),...s(i)]};if(e==="Table"){const r=y.generateUUID();return[{_id:r,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...o(r),...a(r)]}return e==="TableRow"?s():e==="TableHead"?o():e==="TableBody"?a():[]},W=e=>{const{blockProps:t,children:s,styles:o}=e;return s?u.createElement("table",{...t,...o},s):n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE HEAD / BODY"})};d.registerChaiBlock(W,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:p.TableIcon,props:{styles:l.S({default:""})},blocks:j("Table")});const G=e=>{const{blockProps:t,children:s,styles:o}=e;return s?u.createElement("thead",{...t,...o},s):n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE ROW"})};d.registerChaiBlock(G,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:p.BorderTopIcon,props:{styles:l.S({default:""})},blocks:j("TableHead")});const Y=e=>{const{blockProps:t,children:s,styles:o}=e;return s?u.createElement("tbody",{...t,...o},s):n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE ROW"})};d.registerChaiBlock(Y,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:p.BorderAllIcon,props:{styles:l.S({default:""})},blocks:j("TableBody")});const X=e=>{const{blockProps:t,children:s,styles:o}=e;return s?u.createElement("tr",{...t,...o},s):n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE CELL"})};d.registerChaiBlock(X,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:p.ViewHorizontalIcon,props:{styles:l.S({default:"w-full"})},blocks:j("TableRow")});const Z=e=>{const{blockProps:t,children:s,content:o,styles:a}=e;return!s&&h.isEmpty(o)?n.jsxRuntimeExports.jsx(g,{blockProps:t}):s?u.createElement("td",{...t,...a},s):u.createElement("td",{...t,...a,dangerouslySetInnerHTML:{__html:o}})};d.registerChaiBlock(Z,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:p.DragHandleHorizontalIcon,props:{styles:l.S({default:""}),content:l.m({title:"Content",default:"Table cell item"})}});const J=e=>{const{blockProps:t,errorMessage:s,name:o,_type:a,successMessage:r,action:i,styles:c,children:m}=e;if(!m&&h.isEmpty(c==null?void 0:c.className))return n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"FORM FIELDS"});const f={"x-data":"useForm","x-on:submit.prevent":"post"},b={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return n.jsxRuntimeExports.jsxs("form",{...f,"data-error":s,"data-success":r,method:"post",action:i,...t,...c,children:[n.jsxRuntimeExports.jsx("div",{...b}),n.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:o||a}),m]})};d.registerChaiBlock(J,{type:"Form",label:"Form",category:"core",icon:p.GroupIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),action:l.u({title:"Submit URL",default:"/api/form/submit"}),errorMessage:l.m({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:l.m({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0});const K=e=>{const{blockProps:t,content:s,styles:o,children:a}=e,r={...o,...t};return a?u.createElement("label",r,a):u.createElement("label",{...r,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(K,{type:"Label",label:"Label",category:"core",icon:p.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),content:l.u({title:"Content",default:"Label"})}});const Q=e=>{const{blockProps:t,inBuilder:s,label:o,placeholder:a,styles:r,inputStyles:i,icon:c,iconPos:m}=e,f=y.generateUUID(),b={"x-bind:disabled":"formLoading"};return n.jsxRuntimeExports.jsxs("button",{id:f,...b,...i,...r,...t||{},type:s?"button":"submit",placeholder:a,children:[o,c&&n.jsxRuntimeExports.jsx("span",{className:m,dangerouslySetInnerHTML:{__html:c}})]})};d.registerChaiBlock(Q,{type:"FormButton",label:"Submit Button",category:"core",icon:p.ButtonIcon,group:"form",hidden:!0,props:{label:l.u({title:"Label",default:"Submit"}),styles:l.S({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:l.T({title:"Icon",default:""}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const ee=e=>{const{blockProps:t,fieldName:s,label:o,styles:a,inputStyles:r,required:i,checked:c,showLabel:m=!0}=e,f=y.generateUUID();return m?n.jsxRuntimeExports.jsxs("div",{...a,...t,children:[n.jsxRuntimeExports.jsx("input",{...r,name:s,id:f,type:"checkbox",required:i,defaultChecked:c}),o&&o!=="Label"&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:o})]}):n.jsxRuntimeExports.jsx("input",{id:f,...t,...r,...a,type:"checkbox",required:i,name:s})};d.registerChaiBlock(ee,{type:"Checkbox",label:"Checkbox",category:"core",icon:p.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:l.u({title:"Field Name",default:"checkbox"}),styles:l.S({default:"flex items-center gap-x-2"}),label:l.u({title:"Label",default:"Label"}),checked:l.r({title:"Checked",default:!1}),required:l.r({title:"Required",default:!1})}});const te=e=>{const{blockProps:t,label:s,placeholder:o,styles:a,inputStyles:r,showLabel:i,required:c,inputType:m="text",inBuilder:f,fieldName:b}=e,x=y.generateUUID();return!i||m==="submit"?(m==="submit"&&(t.value=s),n.jsxRuntimeExports.jsx("input",{id:x,name:b,readOnly:f,...t,...r,...a,type:m,placeholder:o,required:c})):n.jsxRuntimeExports.jsxs("div",{...a,...t,children:[i&&n.jsxRuntimeExports.jsx("label",{htmlFor:x,children:s}),n.jsxRuntimeExports.jsx("input",{name:b,readOnly:f,...r,id:x,type:m,placeholder:o,required:c})]})};d.registerChaiBlock(te,{type:"Input",label:"Input",category:"core",icon:p.InputIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),fieldName:l.u({title:"Field Name",default:"input"}),inputType:l.f({title:"Type",options:h.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],e=>({value:e,title:e})),default:"text"}),value:l.u({title:"Value",default:""}),showLabel:l.r({title:"Show label",default:!0}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),required:l.r({title:"Required",default:!1})}});const le=e=>{const{blockProps:t,fieldName:s,label:o,styles:a,inputStyles:r,checked:i,required:c,showLabel:m=!0}=e,f=y.generateUUID();return m?n.jsxRuntimeExports.jsxs("div",{...a,...t,children:[n.jsxRuntimeExports.jsx("input",{...r,name:s,id:f,type:"radio",required:c,defaultChecked:i}),o&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:o})]}):n.jsxRuntimeExports.jsx("input",{id:f,...t,...r,...a,type:"radio",required:c,checked:i,name:s})};d.registerChaiBlock(le,{type:"Radio",label:"Radio",category:"core",icon:p.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:l.S({default:"flex items-center w-max gap-x-2"}),fieldName:l.u({title:"Field Name",default:"radio"}),label:l.u({title:"Label",default:"Label"}),checked:l.r({title:"Checked",default:!1}),required:l.r({title:"Required",default:!1})}});const se=e=>{const{blockProps:t,fieldName:s,label:o,placeholder:a,styles:r,inputStyles:i,required:c,showLabel:m,_multiple:f=!1}=e,b=y.generateUUID();return m?n.jsxRuntimeExports.jsxs("div",{...r,children:[m&&n.jsxRuntimeExports.jsx("label",{htmlFor:b,children:o}),n.jsxRuntimeExports.jsxs("select",{...i,id:b,placeholder:a,required:c,multiple:f,name:s,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:a}),h.map(e.options,x=>n.jsxRuntimeExports.jsx("option",{selected:h.get(x,"selected",!1),value:x.value,dangerouslySetInnerHTML:{__html:x.label}},x.value))]})]}):n.jsxRuntimeExports.jsxs("select",{id:b,...r,...t,placeholder:a,required:c,multiple:f,name:s,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:a}),h.map(e.options,x=>n.jsxRuntimeExports.jsx("option",{selected:h.get(x,"selected",!1),value:x.value,dangerouslySetInnerHTML:{__html:x.label}},x.value))]})};d.registerChaiBlock(se,{type:"Select",label:"Select",category:"core",icon:p.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),fieldName:l.u({title:"Field Name",default:"select"}),showLabel:l.r({title:"Show label",default:!0}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),required:l.r({title:"Required",default:!1}),_multiple:l.r({title:"Multiple Choice",default:!1}),options:l.h({title:"Options",itemProperties:{label:l.u({title:"Label",default:""}),value:l.u({title:"Value",default:""})}})}});const oe=e=>{const{blockProps:t,fieldName:s,label:o,placeholder:a,styles:r,inputStyles:i,_rows:c,showLabel:m}=e,f=y.generateUUID();return m?n.jsxRuntimeExports.jsxs("div",{...r,...t,children:[m&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:o}),n.jsxRuntimeExports.jsx("textarea",{name:s,...i,id:f,placeholder:a,rows:c})]}):n.jsxRuntimeExports.jsx("textarea",{id:f,name:s,...t,...i,...r,placeholder:a,rows:c})};d.registerChaiBlock(oe,{type:"TextArea",label:"TextArea",category:"core",icon:p.InputIcon,group:"form",hidden:!0,props:{fieldName:l.u({title:"Field Name",default:"textarea"}),showLabel:l.r({title:"Show label",default:!0}),styles:l.S({default:""}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),_rows:l.c({title:"Rows",default:3})}});const re=h.noop;exports.loadWebBlocks=re;
|