@chaibuilder/sdk 0.1.32 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/AddBlocks-4f054351.cjs +3 -0
  2. package/dist/{AddBlocks-4b96d545.js → AddBlocks-f6836e71.js} +5 -4
  3. package/dist/{BrandingOptions-c91e9d44.js → BrandingOptions-33e6da26.js} +6 -5
  4. package/dist/BrandingOptions-cfa79ffe.cjs +1 -0
  5. package/dist/{CanvasArea-957f5f74.js → CanvasArea-1e5fa968.js} +42 -43
  6. package/dist/CanvasArea-971b3ff8.cjs +46 -0
  7. package/dist/{CurrentPage-fb4c55bc.js → CurrentPage-223cc3dd.js} +5 -4
  8. package/dist/CurrentPage-b2d12d83.cjs +1 -0
  9. package/dist/{ImagesPanel-3fb8087f.js → ImagesPanel-47ac13c3.js} +1 -1
  10. package/dist/{ImagesPanel-56ca0618.cjs → ImagesPanel-8b7a989d.cjs} +1 -1
  11. package/dist/Layers-860f5e42.cjs +1 -0
  12. package/dist/{Layers-6866cb0c.js → Layers-b2c5aa66.js} +48 -47
  13. package/dist/MarkAsGlobalBlock-1a3d5e53.cjs +1 -0
  14. package/dist/{MarkAsGlobalBlock-f28148d9.js → MarkAsGlobalBlock-9b0135aa.js} +8 -7
  15. package/dist/{PagesPanel-003201ca.js → PagesPanel-034efd4c.js} +8 -7
  16. package/dist/PagesPanel-2a80f9b2.cjs +1 -0
  17. package/dist/{ProjectPanel-83321040.js → ProjectPanel-3827a349.js} +7 -6
  18. package/dist/ProjectPanel-5deae7f1.cjs +1 -0
  19. package/dist/Settings-9f61cc69.cjs +1 -0
  20. package/dist/{Settings-ad55d8cb.js → Settings-a2d4e9c2.js} +82 -79
  21. package/dist/SidePanels-0d276d29.cjs +1 -0
  22. package/dist/{SidePanels-96bf29c6.js → SidePanels-b881185b.js} +33 -34
  23. package/dist/Topbar-68a0d125.cjs +1 -0
  24. package/dist/{Topbar-1c4964e5.js → Topbar-fda7588e.js} +38 -37
  25. package/dist/{UnsplashImages-fe480747.js → UnsplashImages-4edb97e7.js} +6 -5
  26. package/dist/UnsplashImages-98c085c2.cjs +1 -0
  27. package/dist/{UploadImages-b14bd152.js → UploadImages-52181c3e.js} +9 -8
  28. package/dist/UploadImages-61ef83ad.cjs +1 -0
  29. package/dist/{add-page-modal-2ef8a63c.js → add-page-modal-38af4548.js} +11 -10
  30. package/dist/add-page-modal-fb51b45b.cjs +1 -0
  31. package/dist/confirm-alert-c1fdf1e4.js +35 -0
  32. package/dist/confirm-alert-e1ea5110.cjs +1 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.d.ts +2 -1
  35. package/dist/core.js +56 -55
  36. package/dist/delete-page-modal-305c49fd.cjs +1 -0
  37. package/dist/{delete-page-modal-961dcc5f.js → delete-page-modal-a226ed3a.js} +18 -19
  38. package/dist/{form-046bcdbc.js → form-25e1af37.js} +1 -1
  39. package/dist/{form-2dc05f35.cjs → form-ea21db6c.cjs} +1 -1
  40. package/dist/{index-86352d44.cjs → index-6fc652ec.cjs} +41 -41
  41. package/dist/{index-370ce00c.js → index-914d197c.js} +7239 -7070
  42. package/dist/{link-e71b94f1.cjs → link-24679521.cjs} +1 -1
  43. package/dist/{link-e3a788f7.js → link-57de608a.js} +2 -2
  44. package/dist/{page-viewer-0c45ce74.js → page-viewer-682940be.js} +17 -16
  45. package/dist/page-viewer-857a82f4.cjs +1 -0
  46. package/dist/{project-general-setting-c5d96f79.js → project-general-setting-0fa55bb9.js} +9 -8
  47. package/dist/project-general-setting-280ccd16.cjs +1 -0
  48. package/dist/project-seo-setting-6eef8387.cjs +1 -0
  49. package/dist/{project-seo-setting-639e4f33.js → project-seo-setting-d81fc1e3.js} +7 -6
  50. package/dist/server.cjs +1 -1
  51. package/dist/server.d.ts +4 -2
  52. package/dist/server.js +27 -23
  53. package/dist/{single-page-detail-22e7bc3b.js → single-page-detail-8b715650.js} +11 -10
  54. package/dist/single-page-detail-b9c4ac1e.cjs +1 -0
  55. package/dist/ui.cjs +1 -1
  56. package/dist/ui.js +105 -106
  57. package/dist/useBuilderProp-21feb2da.js +296 -0
  58. package/dist/useBuilderProp-adacf42f.cjs +1 -0
  59. package/package.json +1 -1
  60. package/dist/AddBlocks-e4f51b58.cjs +0 -3
  61. package/dist/BrandingOptions-52f9691c.cjs +0 -1
  62. package/dist/CanvasArea-b8c26858.cjs +0 -46
  63. package/dist/CurrentPage-715fe809.cjs +0 -1
  64. package/dist/Layers-a955d0bb.cjs +0 -1
  65. package/dist/MarkAsGlobalBlock-cbcb3003.cjs +0 -1
  66. package/dist/PagesPanel-7b8f54e1.cjs +0 -1
  67. package/dist/ProjectPanel-6c5f2470.cjs +0 -1
  68. package/dist/Settings-8f07a4b7.cjs +0 -1
  69. package/dist/SidePanels-446b93e7.cjs +0 -1
  70. package/dist/Topbar-5eeea40a.cjs +0 -1
  71. package/dist/UnsplashImages-ef3b6388.cjs +0 -1
  72. package/dist/UploadImages-10439fde.cjs +0 -1
  73. package/dist/add-page-modal-56dc3c56.cjs +0 -1
  74. package/dist/alert-dialog-4ce6ed22.cjs +0 -1
  75. package/dist/alert-dialog-ee98f47e.js +0 -64
  76. package/dist/confirm-alert-4f50caa7.cjs +0 -1
  77. package/dist/confirm-alert-f2a47cc7.js +0 -36
  78. package/dist/delete-page-modal-88aeacfd.cjs +0 -1
  79. package/dist/page-viewer-e0d9895d.cjs +0 -1
  80. package/dist/project-general-setting-d4d96611.cjs +0 -1
  81. package/dist/project-seo-setting-6356c72f.cjs +0 -1
  82. package/dist/single-page-detail-36430438.cjs +0 -1
  83. package/dist/useBuilderProp-5e57d0c8.cjs +0 -1
  84. package/dist/useBuilderProp-81a14920.js +0 -238
package/dist/ui.js CHANGED
@@ -1,30 +1,30 @@
1
1
  import { T as we, t as Me } from "./toggle-00c9d11e.js";
2
2
  import { D as ve, f as De, d as je, k as Ie, e as Re, h as Ae, l as ke, p as Pe, g as Le, i as Fe, j as Ge, m as He, n as ze, o as Ve, c as Be, H as Ee, b as Oe, a as qe, S as Je } from "./dropdown-menu-ae3ed09b.js";
3
- import { B as Qe, S as Ue, a as We, d as Xe, f as Ye, g as Ze, T as _e, e as $e, b as et, r as tt, t as at, h as ot } from "./useBuilderProp-81a14920.js";
4
- import { A as rt, c as nt, a as it, b as dt } from "./accordion-c0176dc5.js";
5
- import { A as mt, b as ct, a as pt, C as ut, g as ft, f as gt, d as xt, c as bt, e as ht, T as Ct } from "./textarea-0750bcd2.js";
3
+ import { A as Qe, k as Ue, i as We, d as Xe, g as Ye, h as Ze, e as _e, f as $e, b as et, B as tt, S as at, a as ot, l as st, n as rt, o as nt, T as it, m as dt, j as lt, r as mt, t as ct, p as pt } from "./useBuilderProp-21feb2da.js";
4
+ import { A as ft, c as gt, a as xt, b as bt } from "./accordion-c0176dc5.js";
5
+ import { A as Ct, b as yt, a as Nt, C as St, g as wt, f as Mt, d as Tt, c as vt, e as Dt, T as jt } from "./textarea-0750bcd2.js";
6
6
  import { j as a } from "./jsx-runtime-944c88e2.js";
7
7
  import { cva as m } from "class-variance-authority";
8
8
  import { c as r } from "./utils-ac68b2c8.js";
9
- import { A as Nt, g as St, h as wt, b as Mt, f as Tt, d as vt, c as Dt, e as jt, a as It } from "./alert-dialog-ee98f47e.js";
10
- import { D as At, b as kt, f as Pt, d as Lt, c as Ft, e as Gt, a as Ht } from "./dialog-18207bef.js";
11
- import { C as Vt, a as Bt, d as Et, e as Ot, b as qt, f as Jt, c as Kt, h as Qt, g as Ut, I as Wt } from "./command-6f260f61.js";
12
- import { L as Yt } from "./label-e770a087.js";
13
- import { S as _t, a as $t } from "./scroll-area-83bd9e8f.js";
14
- import { T as ta, c as aa, a as oa, b as sa } from "./tabs-85caa1e8.js";
15
- import { P as na, b as ia, a as da } from "./popover-f7addcf4.js";
9
+ import { D as Rt, b as At, f as kt, d as Pt, c as Lt, e as Ft, a as Gt } from "./dialog-18207bef.js";
10
+ import { C as zt, a as Vt, d as Bt, e as Et, b as Ot, f as qt, c as Jt, h as Kt, g as Qt, I as Ut } from "./command-6f260f61.js";
11
+ import { L as Xt } from "./label-e770a087.js";
12
+ import { S as Zt, a as _t } from "./scroll-area-83bd9e8f.js";
13
+ import { T as ea, c as ta, a as aa, b as oa } from "./tabs-85caa1e8.js";
14
+ import { P as ra, b as na, a as ia } from "./popover-f7addcf4.js";
16
15
  import * as i from "react";
17
16
  import { ChevronRightIcon as f, CheckIcon as g, DotFilledIcon as x, Cross2Icon as b } from "@radix-ui/react-icons";
18
17
  import * as s from "@radix-ui/react-menubar";
19
- import { S as ma, d as ca, a as pa, f as ua, e as fa, g as ga, c as xa, b as ba } from "./select-7fddd7c3.js";
18
+ import { S as la, d as ma, a as ca, f as pa, e as ua, g as fa, c as ga, b as xa } from "./select-7fddd7c3.js";
20
19
  import * as n from "@radix-ui/react-dialog";
21
- import { S as Ca } from "./separator-a80d065b.js";
22
- import { C as Na, d as Sa, b as wa, i as Ma, c as Ta, f as va, j as Da, n as ja, e as Ia, g as Ra, h as Aa, k as ka, l as Pa, m as La, a as Fa } from "./context-menu-e1c240ce.js";
23
- import { I as Ha, a as za, L as Va, R as Ba } from "./link-e3a788f7.js";
20
+ import { S as ha } from "./separator-a80d065b.js";
21
+ import { C as ya, d as Na, b as Sa, i as wa, c as Ma, f as Ta, j as va, n as Da, e as ja, g as Ia, h as Ra, k as Aa, l as ka, m as Pa, a as La } from "./context-menu-e1c240ce.js";
22
+ import { I as Ga, a as Ha, L as za, R as Va } from "./link-57de608a.js";
24
23
  import "@radix-ui/react-toggle";
25
24
  import "@radix-ui/react-switch";
26
25
  import "@radix-ui/react-hover-card";
27
26
  import "@radix-ui/react-dropdown-menu";
27
+ import "@radix-ui/react-alert-dialog";
28
28
  import "@radix-ui/react-slot";
29
29
  import "@radix-ui/react-tooltip";
30
30
  import "@radix-ui/react-toast";
@@ -33,7 +33,6 @@ import "lodash";
33
33
  import "@radix-ui/react-accordion";
34
34
  import "clsx";
35
35
  import "tailwind-merge";
36
- import "@radix-ui/react-alert-dialog";
37
36
  import "cmdk";
38
37
  import "@radix-ui/react-label";
39
38
  import "@radix-ui/react-scroll-area";
@@ -44,7 +43,7 @@ import "@radix-ui/react-separator";
44
43
  import "@radix-ui/react-context-menu";
45
44
  import "react-icons-picker";
46
45
  import "react-dom";
47
- import "./ImagesPanel-3fb8087f.js";
46
+ import "./ImagesPanel-47ac13c3.js";
48
47
  import "react-quill";
49
48
  import "react-i18next";
50
49
  const h = m(
@@ -237,61 +236,61 @@ L.displayName = n.Title.displayName;
237
236
  const F = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a.jsx(n.Description, { ref: o, className: r("text-sm text-muted-foreground", e), ...t }));
238
237
  F.displayName = n.Description.displayName;
239
238
  export {
240
- rt as Accordion,
241
- nt as AccordionContent,
242
- it as AccordionItem,
243
- dt as AccordionTrigger,
244
- mt as Alert,
245
- ct as AlertDescription,
246
- Nt as AlertDialog,
247
- St as AlertDialogAction,
248
- wt as AlertDialogCancel,
249
- Mt as AlertDialogContent,
250
- Tt as AlertDialogDescription,
251
- vt as AlertDialogFooter,
252
- Dt as AlertDialogHeader,
253
- jt as AlertDialogTitle,
254
- It as AlertDialogTrigger,
255
- pt as AlertTitle,
239
+ ft as Accordion,
240
+ gt as AccordionContent,
241
+ xt as AccordionItem,
242
+ bt as AccordionTrigger,
243
+ Ct as Alert,
244
+ yt as AlertDescription,
245
+ Qe as AlertDialog,
246
+ Ue as AlertDialogAction,
247
+ We as AlertDialogCancel,
248
+ Xe as AlertDialogContent,
249
+ Ye as AlertDialogDescription,
250
+ Ze as AlertDialogFooter,
251
+ _e as AlertDialogHeader,
252
+ $e as AlertDialogTitle,
253
+ et as AlertDialogTrigger,
254
+ Nt as AlertTitle,
256
255
  pe as Badge,
257
- Qe as Button,
258
- ut as Card,
259
- ft as CardContent,
260
- gt as CardDescription,
261
- xt as CardFooter,
262
- bt as CardHeader,
263
- ht as CardTitle,
264
- Vt as Command,
265
- Bt as CommandDialog,
266
- Et as CommandEmpty,
267
- Ot as CommandGroup,
268
- qt as CommandInput,
269
- Jt as CommandItem,
270
- Kt as CommandList,
271
- Qt as CommandSeparator,
272
- Ut as CommandShortcut,
273
- Na as ContextMenu,
274
- Sa as ContextMenuCheckboxItem,
275
- wa as ContextMenuContent,
276
- Ma as ContextMenuGroup,
277
- Ta as ContextMenuItem,
278
- va as ContextMenuLabel,
279
- Da as ContextMenuPortal,
280
- ja as ContextMenuRadioGroup,
281
- Ia as ContextMenuRadioItem,
282
- Ra as ContextMenuSeparator,
283
- Aa as ContextMenuShortcut,
284
- ka as ContextMenuSub,
285
- Pa as ContextMenuSubContent,
286
- La as ContextMenuSubTrigger,
287
- Fa as ContextMenuTrigger,
288
- At as Dialog,
289
- kt as DialogContent,
290
- Pt as DialogDescription,
291
- Lt as DialogFooter,
292
- Ft as DialogHeader,
293
- Gt as DialogTitle,
294
- Ht as DialogTrigger,
256
+ tt as Button,
257
+ St as Card,
258
+ wt as CardContent,
259
+ Mt as CardDescription,
260
+ Tt as CardFooter,
261
+ vt as CardHeader,
262
+ Dt as CardTitle,
263
+ zt as Command,
264
+ Vt as CommandDialog,
265
+ Bt as CommandEmpty,
266
+ Et as CommandGroup,
267
+ Ot as CommandInput,
268
+ qt as CommandItem,
269
+ Jt as CommandList,
270
+ Kt as CommandSeparator,
271
+ Qt as CommandShortcut,
272
+ ya as ContextMenu,
273
+ Na as ContextMenuCheckboxItem,
274
+ Sa as ContextMenuContent,
275
+ wa as ContextMenuGroup,
276
+ Ma as ContextMenuItem,
277
+ Ta as ContextMenuLabel,
278
+ va as ContextMenuPortal,
279
+ Da as ContextMenuRadioGroup,
280
+ ja as ContextMenuRadioItem,
281
+ Ia as ContextMenuSeparator,
282
+ Ra as ContextMenuShortcut,
283
+ Aa as ContextMenuSub,
284
+ ka as ContextMenuSubContent,
285
+ Pa as ContextMenuSubTrigger,
286
+ La as ContextMenuTrigger,
287
+ Rt as Dialog,
288
+ At as DialogContent,
289
+ kt as DialogDescription,
290
+ Pt as DialogFooter,
291
+ Lt as DialogHeader,
292
+ Ft as DialogTitle,
293
+ Gt as DialogTrigger,
295
294
  ve as DropdownMenu,
296
295
  De as DropdownMenuCheckboxItem,
297
296
  je as DropdownMenuContent,
@@ -310,11 +309,11 @@ export {
310
309
  Ee as HoverCard,
311
310
  Oe as HoverCardContent,
312
311
  qe as HoverCardTrigger,
313
- Ha as IconPickerField,
314
- za as ImagePickerField,
315
- Wt as Input,
316
- Yt as Label,
317
- Va as LinkField,
312
+ Ga as IconPickerField,
313
+ Ha as ImagePickerField,
314
+ Ut as Input,
315
+ Xt as Label,
316
+ za as LinkField,
318
317
  C as Menubar,
319
318
  T as MenubarCheckboxItem,
320
319
  w as MenubarContent,
@@ -331,21 +330,21 @@ export {
331
330
  S as MenubarSubContent,
332
331
  N as MenubarSubTrigger,
333
332
  y as MenubarTrigger,
334
- na as Popover,
335
- ia as PopoverContent,
336
- da as PopoverTrigger,
337
- Ba as RTEField,
338
- _t as ScrollArea,
339
- $t as ScrollBar,
340
- ma as Select,
341
- ca as SelectContent,
342
- pa as SelectGroup,
343
- ua as SelectItem,
344
- fa as SelectLabel,
345
- ga as SelectSeparator,
346
- xa as SelectTrigger,
347
- ba as SelectValue,
348
- Ca as Separator,
333
+ ra as Popover,
334
+ na as PopoverContent,
335
+ ia as PopoverTrigger,
336
+ Va as RTEField,
337
+ Zt as ScrollArea,
338
+ _t as ScrollBar,
339
+ la as Select,
340
+ ma as SelectContent,
341
+ ca as SelectGroup,
342
+ pa as SelectItem,
343
+ ua as SelectLabel,
344
+ fa as SelectSeparator,
345
+ ga as SelectTrigger,
346
+ xa as SelectValue,
347
+ ha as Separator,
349
348
  he as Sheet,
350
349
  ye as SheetClose,
351
350
  A as SheetContent,
@@ -354,24 +353,24 @@ export {
354
353
  k as SheetHeader,
355
354
  L as SheetTitle,
356
355
  Ce as SheetTrigger,
357
- Ue as Skeleton,
356
+ at as Skeleton,
358
357
  Je as Switch,
359
- ta as Tabs,
360
- aa as TabsContent,
361
- oa as TabsList,
362
- sa as TabsTrigger,
363
- Ct as Textarea,
364
- We as Toaster,
358
+ ea as Tabs,
359
+ ta as TabsContent,
360
+ aa as TabsList,
361
+ oa as TabsTrigger,
362
+ jt as Textarea,
363
+ ot as Toaster,
365
364
  we as Toggle,
366
- Xe as Tooltip,
367
- Ye as TooltipContent,
368
- Ze as TooltipPortal,
369
- _e as TooltipProvider,
370
- $e as TooltipTrigger,
365
+ st as Tooltip,
366
+ rt as TooltipContent,
367
+ nt as TooltipPortal,
368
+ it as TooltipProvider,
369
+ dt as TooltipTrigger,
371
370
  h as badgeVariants,
372
- et as buttonVariants,
373
- tt as reducer,
374
- at as toast,
371
+ lt as buttonVariants,
372
+ mt as reducer,
373
+ ct as toast,
375
374
  Me as toggleVariants,
376
- ot as useToast
375
+ pt as useToast
377
376
  };
@@ -0,0 +1,296 @@
1
+ import { j as s } from "./jsx-runtime-944c88e2.js";
2
+ import * as i from "react";
3
+ import * as d from "@radix-ui/react-alert-dialog";
4
+ import { c as a } from "./utils-ac68b2c8.js";
5
+ import { Slot as P } from "@radix-ui/react-slot";
6
+ import { cva as b } from "class-variance-authority";
7
+ import * as c from "@radix-ui/react-tooltip";
8
+ import { Cross2Icon as C } from "@radix-ui/react-icons";
9
+ import * as n from "@radix-ui/react-toast";
10
+ import { atom as T, useAtomValue as E } from "jotai";
11
+ import { get as _ } from "lodash";
12
+ const h = T(null);
13
+ h.debugLabel = "chaiBuilderPropsAtom";
14
+ const V = T(null);
15
+ V.debugLabel = "apiKeyAtom";
16
+ const v = b(
17
+ "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
18
+ {
19
+ variants: {
20
+ variant: {
21
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
22
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
23
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
24
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
25
+ ghost: "hover:bg-accent hover:text-accent-foreground",
26
+ link: "text-primary underline-offset-4 hover:underline"
27
+ },
28
+ size: {
29
+ default: "h-9 px-4 py-2",
30
+ sm: "h-8 rounded-md px-3 text-xs",
31
+ lg: "h-10 rounded-md px-8",
32
+ icon: "h-9 w-9"
33
+ }
34
+ },
35
+ defaultVariants: {
36
+ variant: "default",
37
+ size: "default"
38
+ }
39
+ }
40
+ ), I = i.forwardRef(
41
+ ({ className: e, variant: t, size: o, asChild: r = !1, ...l }, f) => {
42
+ const O = r ? P : "button";
43
+ return /* @__PURE__ */ s.jsx(O, { className: a(v({ variant: t, size: o, className: e })), ref: f, ...l });
44
+ }
45
+ );
46
+ I.displayName = "Button";
47
+ const ie = d.Root, de = d.Trigger, N = ({ className: e, ...t }) => /* @__PURE__ */ s.jsx(d.Portal, { className: a(e), ...t });
48
+ N.displayName = d.Portal.displayName;
49
+ const w = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(
50
+ d.Overlay,
51
+ {
52
+ className: a(
53
+ "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
54
+ e
55
+ ),
56
+ ...t,
57
+ ref: o
58
+ }
59
+ ));
60
+ w.displayName = d.Overlay.displayName;
61
+ const z = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsxs(N, { children: [
62
+ /* @__PURE__ */ s.jsx(w, {}),
63
+ /* @__PURE__ */ s.jsx(
64
+ d.Content,
65
+ {
66
+ ref: o,
67
+ className: a(
68
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
69
+ e
70
+ ),
71
+ ...t
72
+ }
73
+ )
74
+ ] }));
75
+ z.displayName = d.Content.displayName;
76
+ const k = ({ className: e, ...t }) => /* @__PURE__ */ s.jsx("div", { className: a("flex flex-col space-y-2 text-center sm:text-left", e), ...t });
77
+ k.displayName = "AlertDialogHeader";
78
+ const M = ({ className: e, ...t }) => /* @__PURE__ */ s.jsx("div", { className: a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e), ...t });
79
+ M.displayName = "AlertDialogFooter";
80
+ const B = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(d.Title, { ref: o, className: a("text-lg font-semibold", e), ...t }));
81
+ B.displayName = d.Title.displayName;
82
+ const L = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(d.Description, { ref: o, className: a("text-sm text-muted-foreground", e), ...t }));
83
+ L.displayName = d.Description.displayName;
84
+ const U = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(d.Action, { ref: o, className: a(v(), e), ...t }));
85
+ U.displayName = d.Action.displayName;
86
+ const F = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(
87
+ d.Cancel,
88
+ {
89
+ ref: o,
90
+ className: a(v({ variant: "outline" }), "mt-2 sm:mt-0", e),
91
+ ...t
92
+ }
93
+ ));
94
+ F.displayName = d.Cancel.displayName;
95
+ const ne = c.Portal, le = c.Provider, ce = c.Root, me = c.Trigger, H = i.forwardRef(({ className: e, sideOffset: t = 4, ...o }, r) => /* @__PURE__ */ s.jsx(
96
+ c.Content,
97
+ {
98
+ ref: r,
99
+ sideOffset: t,
100
+ className: a(
101
+ "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
102
+ e
103
+ ),
104
+ ...o
105
+ }
106
+ ));
107
+ H.displayName = c.Content.displayName;
108
+ const K = 1, Q = 1e6;
109
+ let g = 0;
110
+ function X() {
111
+ return g = (g + 1) % Number.MAX_VALUE, g.toString();
112
+ }
113
+ const x = /* @__PURE__ */ new Map(), y = (e) => {
114
+ if (x.has(e))
115
+ return;
116
+ const t = setTimeout(() => {
117
+ x.delete(e), m({
118
+ type: "REMOVE_TOAST",
119
+ toastId: e
120
+ });
121
+ }, Q);
122
+ x.set(e, t);
123
+ }, Y = (e, t) => {
124
+ switch (t.type) {
125
+ case "ADD_TOAST":
126
+ return {
127
+ ...e,
128
+ toasts: [t.toast, ...e.toasts].slice(0, K)
129
+ };
130
+ case "UPDATE_TOAST":
131
+ return {
132
+ ...e,
133
+ toasts: e.toasts.map((o) => o.id === t.toast.id ? { ...o, ...t.toast } : o)
134
+ };
135
+ case "DISMISS_TOAST": {
136
+ const { toastId: o } = t;
137
+ return o ? y(o) : e.toasts.forEach((r) => {
138
+ y(r.id);
139
+ }), {
140
+ ...e,
141
+ toasts: e.toasts.map(
142
+ (r) => r.id === o || o === void 0 ? {
143
+ ...r,
144
+ open: !1
145
+ } : r
146
+ )
147
+ };
148
+ }
149
+ case "REMOVE_TOAST":
150
+ return t.toastId === void 0 ? {
151
+ ...e,
152
+ toasts: []
153
+ } : {
154
+ ...e,
155
+ toasts: e.toasts.filter((o) => o.id !== t.toastId)
156
+ };
157
+ }
158
+ }, u = [];
159
+ let p = { toasts: [] };
160
+ function m(e) {
161
+ p = Y(p, e), u.forEach((t) => {
162
+ t(p);
163
+ });
164
+ }
165
+ function q({ ...e }) {
166
+ const t = X(), o = (l) => m({
167
+ type: "UPDATE_TOAST",
168
+ toast: { ...l, id: t }
169
+ }), r = () => m({ type: "DISMISS_TOAST", toastId: t });
170
+ return m({
171
+ type: "ADD_TOAST",
172
+ toast: {
173
+ ...e,
174
+ id: t,
175
+ open: !0,
176
+ onOpenChange: (l) => {
177
+ l || r();
178
+ }
179
+ }
180
+ }), {
181
+ id: t,
182
+ dismiss: r,
183
+ update: o
184
+ };
185
+ }
186
+ function G() {
187
+ const [e, t] = i.useState(p);
188
+ return i.useEffect(() => (u.push(t), () => {
189
+ const o = u.indexOf(t);
190
+ o > -1 && u.splice(o, 1);
191
+ }), [e]), {
192
+ ...e,
193
+ toast: q,
194
+ dismiss: (o) => m({ type: "DISMISS_TOAST", toastId: o })
195
+ };
196
+ }
197
+ const J = n.Provider, A = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(
198
+ n.Viewport,
199
+ {
200
+ ref: o,
201
+ className: a(
202
+ "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
203
+ e
204
+ ),
205
+ ...t
206
+ }
207
+ ));
208
+ A.displayName = n.Viewport.displayName;
209
+ const W = b(
210
+ "group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
211
+ {
212
+ variants: {
213
+ variant: {
214
+ default: "border bg-background",
215
+ destructive: "destructive group border-destructive bg-destructive text-destructive-foreground"
216
+ }
217
+ },
218
+ defaultVariants: {
219
+ variant: "default"
220
+ }
221
+ }
222
+ ), j = i.forwardRef(({ className: e, variant: t, ...o }, r) => /* @__PURE__ */ s.jsx(n.Root, { ref: r, className: a(W({ variant: t }), e), ...o }));
223
+ j.displayName = n.Root.displayName;
224
+ const Z = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(
225
+ n.Action,
226
+ {
227
+ ref: o,
228
+ className: a(
229
+ "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
230
+ e
231
+ ),
232
+ ...t
233
+ }
234
+ ));
235
+ Z.displayName = n.Action.displayName;
236
+ const D = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(
237
+ n.Close,
238
+ {
239
+ ref: o,
240
+ className: a(
241
+ "absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
242
+ e
243
+ ),
244
+ "toast-close": "",
245
+ ...t,
246
+ children: /* @__PURE__ */ s.jsx(C, { className: "h-4 w-4" })
247
+ }
248
+ ));
249
+ D.displayName = n.Close.displayName;
250
+ const S = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(n.Title, { ref: o, className: a("text-sm font-semibold [&+div]:text-xs", e), ...t }));
251
+ S.displayName = n.Title.displayName;
252
+ const R = i.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ s.jsx(n.Description, { ref: o, className: a("text-sm opacity-90", e), ...t }));
253
+ R.displayName = n.Description.displayName;
254
+ function ue() {
255
+ const { toasts: e } = G();
256
+ return /* @__PURE__ */ s.jsxs(J, { children: [
257
+ e.map(({ id: t, title: o, description: r, action: l, ...f }) => /* @__PURE__ */ s.jsxs(j, { ...f, children: [
258
+ /* @__PURE__ */ s.jsxs("div", { className: "grid gap-1", children: [
259
+ o && /* @__PURE__ */ s.jsx(S, { children: o }),
260
+ r && /* @__PURE__ */ s.jsx(R, { children: r })
261
+ ] }),
262
+ l,
263
+ /* @__PURE__ */ s.jsx(D, {})
264
+ ] }, t)),
265
+ /* @__PURE__ */ s.jsx(A, {})
266
+ ] });
267
+ }
268
+ const pe = ({ className: e, ...t }) => /* @__PURE__ */ s.jsx("div", { className: a("animate-pulse rounded-md bg-primary/10", e), ...t }), fe = (e, t = void 0) => {
269
+ const o = E(h);
270
+ return _(o, e, t);
271
+ };
272
+ export {
273
+ ie as A,
274
+ I as B,
275
+ pe as S,
276
+ le as T,
277
+ ue as a,
278
+ de as b,
279
+ h as c,
280
+ z as d,
281
+ k as e,
282
+ B as f,
283
+ L as g,
284
+ M as h,
285
+ F as i,
286
+ v as j,
287
+ U as k,
288
+ ce as l,
289
+ me as m,
290
+ H as n,
291
+ ne as o,
292
+ G as p,
293
+ Y as r,
294
+ q as t,
295
+ fe as u
296
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("./jsx-runtime-5c3ac4f7.cjs"),H=require("react"),U=require("@radix-ui/react-alert-dialog"),r=require("./utils-3c452dd0.cjs"),K=require("@radix-ui/react-slot"),h=require("class-variance-authority"),Q=require("@radix-ui/react-tooltip"),X=require("@radix-ui/react-icons"),Y=require("@radix-ui/react-toast"),T=require("jotai"),G=require("lodash");function x(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const i=x(H),n=x(U),c=x(Q),d=x(Y),j=T.atom(null);j.debugLabel="chaiBuilderPropsAtom";const J=T.atom(null);J.debugLabel="apiKeyAtom";const f=h.cva("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),A=i.forwardRef(({className:t,variant:e,size:o,asChild:a=!1,...l},g)=>{const F=a?K.Slot:"button";return s.jsxRuntimeExports.jsx(F,{className:r.cn(f({variant:e,size:o,className:t})),ref:g,...l})});A.displayName="Button";const W=n.Root,Z=n.Trigger,N=({className:t,...e})=>s.jsxRuntimeExports.jsx(n.Portal,{className:r.cn(t),...e});N.displayName=n.Portal.displayName;const R=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(n.Overlay,{className:r.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:o}));R.displayName=n.Overlay.displayName;const w=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsxs(N,{children:[s.jsxRuntimeExports.jsx(R,{}),s.jsxRuntimeExports.jsx(n.Content,{ref:o,className:r.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...e})]}));w.displayName=n.Content.displayName;const D=({className:t,...e})=>s.jsxRuntimeExports.jsx("div",{className:r.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});D.displayName="AlertDialogHeader";const E=({className:t,...e})=>s.jsxRuntimeExports.jsx("div",{className:r.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});E.displayName="AlertDialogFooter";const S=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(n.Title,{ref:o,className:r.cn("text-lg font-semibold",t),...e}));S.displayName=n.Title.displayName;const P=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(n.Description,{ref:o,className:r.cn("text-sm text-muted-foreground",t),...e}));P.displayName=n.Description.displayName;const O=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(n.Action,{ref:o,className:r.cn(f(),t),...e}));O.displayName=n.Action.displayName;const _=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(n.Cancel,{ref:o,className:r.cn(f({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));_.displayName=n.Cancel.displayName;const $=c.Portal,tt=c.Provider,et=c.Root,ot=c.Trigger,C=i.forwardRef(({className:t,sideOffset:e=4,...o},a)=>s.jsxRuntimeExports.jsx(c.Content,{ref:a,sideOffset:e,className:r.cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...o}));C.displayName=c.Content.displayName;const st=1,at=1e6;let v=0;function rt(){return v=(v+1)%Number.MAX_VALUE,v.toString()}const y=new Map,b=t=>{if(y.has(t))return;const e=setTimeout(()=>{y.delete(t),u({type:"REMOVE_TOAST",toastId:t})},at);y.set(t,e)},V=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,st)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(o=>o.id===e.toast.id?{...o,...e.toast}:o)};case"DISMISS_TOAST":{const{toastId:o}=e;return o?b(o):t.toasts.forEach(a=>{b(a.id)}),{...t,toasts:t.toasts.map(a=>a.id===o||o===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(o=>o.id!==e.toastId)}}},m=[];let p={toasts:[]};function u(t){p=V(p,t),m.forEach(e=>{e(p)})}function I({...t}){const e=rt(),o=l=>u({type:"UPDATE_TOAST",toast:{...l,id:e}}),a=()=>u({type:"DISMISS_TOAST",toastId:e});return u({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:l=>{l||a()}}}),{id:e,dismiss:a,update:o}}function q(){const[t,e]=i.useState(p);return i.useEffect(()=>(m.push(e),()=>{const o=m.indexOf(e);o>-1&&m.splice(o,1)}),[t]),{...t,toast:I,dismiss:o=>u({type:"DISMISS_TOAST",toastId:o})}}const it=d.Provider,z=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(d.Viewport,{ref:o,className:r.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));z.displayName=d.Viewport.displayName;const nt=h.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),k=i.forwardRef(({className:t,variant:e,...o},a)=>s.jsxRuntimeExports.jsx(d.Root,{ref:a,className:r.cn(nt({variant:e}),t),...o}));k.displayName=d.Root.displayName;const dt=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(d.Action,{ref:o,className:r.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));dt.displayName=d.Action.displayName;const M=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(d.Close,{ref:o,className:r.cn("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:s.jsxRuntimeExports.jsx(X.Cross2Icon,{className:"h-4 w-4"})}));M.displayName=d.Close.displayName;const B=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(d.Title,{ref:o,className:r.cn("text-sm font-semibold [&+div]:text-xs",t),...e}));B.displayName=d.Title.displayName;const L=i.forwardRef(({className:t,...e},o)=>s.jsxRuntimeExports.jsx(d.Description,{ref:o,className:r.cn("text-sm opacity-90",t),...e}));L.displayName=d.Description.displayName;function lt(){const{toasts:t}=q();return s.jsxRuntimeExports.jsxs(it,{children:[t.map(({id:e,title:o,description:a,action:l,...g})=>s.jsxRuntimeExports.jsxs(k,{...g,children:[s.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[o&&s.jsxRuntimeExports.jsx(B,{children:o}),a&&s.jsxRuntimeExports.jsx(L,{children:a})]}),l,s.jsxRuntimeExports.jsx(M,{})]},e)),s.jsxRuntimeExports.jsx(z,{})]})}const ct=({className:t,...e})=>s.jsxRuntimeExports.jsx("div",{className:r.cn("animate-pulse rounded-md bg-primary/10",t),...e}),ut=(t,e=void 0)=>{const o=T.useAtomValue(j);return G.get(o,t,e)};exports.AlertDialog=W;exports.AlertDialogAction=O;exports.AlertDialogCancel=_;exports.AlertDialogContent=w;exports.AlertDialogDescription=P;exports.AlertDialogFooter=E;exports.AlertDialogHeader=D;exports.AlertDialogTitle=S;exports.AlertDialogTrigger=Z;exports.Button=A;exports.Skeleton=ct;exports.Toaster=lt;exports.Tooltip=et;exports.TooltipContent=C;exports.TooltipPortal=$;exports.TooltipProvider=tt;exports.TooltipTrigger=ot;exports.buttonVariants=f;exports.chaiBuilderPropsAtom=j;exports.reducer=V;exports.toast=I;exports.useBuilderProp=ut;exports.useToast=q;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chaibuilder/sdk",
3
3
  "private": false,
4
- "version": "0.1.32",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -1,3 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),s=require("lodash"),b=require("jotai"),w=require("./accordion-0afd8143.cjs"),q=require("./scroll-area-bb343b86.cjs"),k=require("./tabs-860e37aa.cjs"),y=require("./useBuilderProp-5e57d0c8.cjs"),v=require("react-dnd"),C=require("@radix-ui/react-icons"),l=require("./index-86352d44.cjs");require("react-i18next");const T=require("@chaibuilder/blocks"),I=require("lucide-react"),L=require("./utils-3c452dd0.cjs"),f=require("./textarea-a338ede6.cjs"),P=require("./label-167415e5.cjs"),S=require("./html-to-json-aadcbf66.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("./MODIFIERS-4716c669.cjs");require("clsx");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("sonner");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const M=({block:t})=>{const{type:r,icon:o,label:c}=t,{addCoreBlock:u,addPredefinedBlock:m}=l.useAddBlock(),[p]=l.useSelectedBlockIds(),[,x]=b.useAtom(l.activePanelAtom),[,i]=b.useAtom(l.addBlocksModalAtom),E=()=>{s.has(t,"blocks")?m(T.syncBlocksWithDefaults(t.blocks),s.first(p)):u(t,s.first(p)),i(!1),x("layers")},[,g,j]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(y.Tooltip,{children:[e.jsxRuntimeExports.jsx(y.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:g,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(o||C.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||r})]})}),e.jsxRuntimeExports.jsx(y.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||r})})]})]})},F=({block:t,closePopover:r})=>{var j;const[o,c]=n.useState(!1),u=y.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=l.useAddBlock(),[x]=l.useSelectedBlockIds(),[,i,E]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),g=n.useCallback(async R=>{if(R.stopPropagation(),s.has(t,"component")){m(t,s.first(x)),r();return}c(!0);const a=await u(t);s.isEmpty(a)||p(T.syncBlocksWithDefaults(a),s.first(x)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=t.name||t.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:o?()=>{}:g,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:[o&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(I.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.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:t.name})})]})]})},H=()=>{const{data:t,isLoading:r}=l.useUILibraryBlocks(),o=T.useChaiBlocks(),c=s.filter(s.values(o),{category:"custom"}),u=s.groupBy(c,"group"),m=s.groupBy(t,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>s.mergeWith(u,m,(a,h)=>{if(s.isArray(a)&&s.isArray(h))return[...a,...h]}),[u,m]),[,E]=b.useAtom(l.addBlocksModalAtom),[g,j]=n.useState("Navbar"),R=s.get(i,g,[]);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:r?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(s.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const B=setTimeout(()=>{j(h)},300);x(B)},onClick:()=>j(h),className:L.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",g===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(R.map(a=>e.jsxRuntimeExports.jsx(F,{block:a,closePopover:()=>E(!1)})))})]})},D=()=>{const[t,r]=n.useState(""),{addPredefinedBlock:o}=l.useAddBlock(),[c]=l.useSelectedBlockIds(),[,u]=b.useAtom(l.addBlockOffCanvasAtom),[,m]=b.useAtom(l.activePanelAtom),[,p]=b.useAtom(l.addBlocksModalAtom),x=()=>{const i=S.getBlocksFromHTML(t);o([...i],s.first(c)||null),r(""),u(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(f.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(f.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(f.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(f.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(f.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(P.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(f.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:t,onChange:i=>r(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(f.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(f.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(C.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(f.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."})]})]})]})},O=D,N=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],U=(t,r)=>{if(!t)return!s.includes(N,r);const o=t._type;return o==="List"?r==="ListItem":o==="Table"?r==="TableHead"||r==="TableBody":o==="TableHead"||o==="TableBody"?r==="TableRow":o==="TableRow"?r==="TableCell":o==="Row"?r==="Column":!s.includes(N,r)},z=()=>{const[t,r]=n.useState("core"),[o,c]=n.useState("basic"),u=T.useChaiBlocks(),[,m]=b.useAtom(l.showPredefinedBlockCategoryAtom),[,p]=b.useAtom(l.addBlocksModalAtom),[x]=l.useSelectedBlockIds(),i=l.useAllBlocks(),E=s.find(i,{_id:s.first(x)}),{data:g,isLoading:j}=l.useUILibraryBlocks(),R=s.groupBy(s.filter(u,d=>U(E,d.type)),"category"),a=s.uniq(s.map(R.core,"group"));n.useEffect(()=>{!s.includes(a,o)&&!s.isEmpty(a)&&!s.isEmpty(o)&&c(s.first(a))},[a,o]);const h=d=>c(A=>A===d?"":d),B=!j&&!s.isEmpty(g)||s.find(s.values(u),{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:t==="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(C.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(k.Tabs,{onValueChange:d=>{m(""),r(d)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(k.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"core",children:"Core"}),B?e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(q.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(w.Accordion,{type:"single",value:o,className:"w-full px-3",children:n.Children.toArray(s.map(a,d=>s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(w.AccordionItem,{value:d,className:"border-border",children:[e.jsxRuntimeExports.jsx(w.AccordionTrigger,{onClick:()=>h(d),className:"py-2 capitalize",children:d}),e.jsxRuntimeExports.jsx(w.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(s.reject(s.filter(s.values(R.core),{group:d}),{hidden:!0}).map(A=>e.jsxRuntimeExports.jsx(M,{block:A})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(y.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(H,{})}),t==="html"&&e.jsxRuntimeExports.jsx(O,{})]})};exports.default=z;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-5c3ac4f7.cjs"),O=require("react"),C=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),j=require("./index-86352d44.cjs");require("react-i18next");const R=require("./useBuilderProp-5e57d0c8.cjs"),e=require("@chaibuilder/blocks"),P=require("lodash");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@radix-ui/react-icons");require("lucide-react");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");function k(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}return t.default=r,Object.freeze(t)}const c=k(O),v=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],D=()=>{const r=R.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,i]=j.useBrandingOptions(),a=c.useRef(t);c.useEffect(()=>()=>{P.isEqual(t,a.current)||r(a.current)},[]);const p=({formData:l},u)=>{u&&(i(l),a.current=l)},{bodyFont:g,headingFont:f,primaryColor:b,bodyTextDarkColor:m,bodyTextLightColor:y,bodyBgDarkColor:q,secondaryColor:x,bodyBgLightColor:h,roundedCorners:S}=t,s={headingFont:e.SelectOption({title:"Heading font",default:f,options:v}),bodyFont:e.SelectOption({title:"Body font",default:g,options:v}),roundedCorners:e.Numeric({title:"Rounded Corner",default:parseInt(S||5,10)}),primaryColor:e.Color({title:"Primary",default:b}),secondaryColor:e.Color({title:"Secondary",default:x}),bodyBgLightColor:e.Color({title:"Body Background (Light)",default:h}),bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:q}),bodyTextLightColor:e.Color({title:"Body Text (Light)",default:m}),bodyTextDarkColor:e.Color({title:"Body Text (Dark)",default:y})},n={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const u=s[l];return n.properties||(n.properties={}),n.properties[l]=u.schema,d[l]=u.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(B,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:n,formData:t,validator:C,onChange:p})})]})};exports.default=D;