@chaibuilder/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +41 -0
  2. package/dist/AddBlocks-04c49399.js +258 -0
  3. package/dist/AddBlocks-c27c81fa.cjs +3 -0
  4. package/dist/BrandingOptions-055cf22a.js +157 -0
  5. package/dist/BrandingOptions-c25f6370.cjs +1 -0
  6. package/dist/CONTROLS-031e1de3.cjs +1 -0
  7. package/dist/CONTROLS-442caee5.js +6 -0
  8. package/dist/CanvasArea-97dfbb52.cjs +60 -0
  9. package/dist/CanvasArea-a7901131.js +1455 -0
  10. package/dist/Class-0801d193.cjs +1 -0
  11. package/dist/Class-e6b07b79.js +1138 -0
  12. package/dist/ImagesPanel-160aa664.cjs +1 -0
  13. package/dist/ImagesPanel-815d5e6f.js +27 -0
  14. package/dist/Layers-3aa6aae7.cjs +1 -0
  15. package/dist/Layers-6f1c162e.js +370 -0
  16. package/dist/MarkAsGlobalBlock-209ddfd5.js +73 -0
  17. package/dist/MarkAsGlobalBlock-536770e7.cjs +1 -0
  18. package/dist/Settings-2b1ff1a3.cjs +1 -0
  19. package/dist/Settings-b1afcefe.js +1845 -0
  20. package/dist/SidePanels-f48777bb.js +144 -0
  21. package/dist/SidePanels-f79dbace.cjs +1 -0
  22. package/dist/Topbar-64729901.js +105 -0
  23. package/dist/Topbar-bff765dc.cjs +1 -0
  24. package/dist/UnsplashImages-04fffeed.cjs +1 -0
  25. package/dist/UnsplashImages-315ce7a8.js +160 -0
  26. package/dist/UploadImages-43c16a2d.cjs +1 -0
  27. package/dist/UploadImages-f317eef0.js +107 -0
  28. package/dist/_commonjsHelpers-5a53b418.cjs +1 -0
  29. package/dist/_commonjsHelpers-d4512b9c.js +6 -0
  30. package/dist/accordion-0afd8143.cjs +1 -0
  31. package/dist/accordion-c0176dc5.js +42 -0
  32. package/dist/context-menu-e1c240ce.js +122 -0
  33. package/dist/context-menu-fec580f2.cjs +1 -0
  34. package/dist/core.cjs +1 -0
  35. package/dist/core.d.ts +353 -0
  36. package/dist/core.js +83 -0
  37. package/dist/dialog-170eaad9.cjs +1 -0
  38. package/dist/dialog-3d4e82ed.js +65 -0
  39. package/dist/dropdown-menu-a9b096f9.cjs +1 -0
  40. package/dist/dropdown-menu-d912a52e.js +223 -0
  41. package/dist/html-to-json-d8ac554d.cjs +1 -0
  42. package/dist/html-to-json-fecbbe16.js +178 -0
  43. package/dist/index-aea5c557.cjs +2 -0
  44. package/dist/index-cdd49c4c.js +2651 -0
  45. package/dist/jsx-runtime-5c3ac4f7.cjs +27 -0
  46. package/dist/jsx-runtime-944c88e2.js +631 -0
  47. package/dist/label-167415e5.cjs +1 -0
  48. package/dist/label-e770a087.js +10 -0
  49. package/dist/lib.cjs +1 -0
  50. package/dist/lib.d.ts +29 -0
  51. package/dist/lib.js +223 -0
  52. package/dist/link-43d13383.cjs +1 -0
  53. package/dist/link-8594fd8f.js +211 -0
  54. package/dist/popover-7cb9079b.cjs +1 -0
  55. package/dist/popover-f7addcf4.js +23 -0
  56. package/dist/render.cjs +2 -0
  57. package/dist/render.d.ts +49 -0
  58. package/dist/render.js +1171 -0
  59. package/dist/scroll-area-088530b9.cjs +1 -0
  60. package/dist/scroll-area-9f64a082.js +30 -0
  61. package/dist/select-0e32300c.cjs +1 -0
  62. package/dist/select-7fddd7c3.js +75 -0
  63. package/dist/separator-a597dba7.cjs +1 -0
  64. package/dist/separator-a80d065b.js +18 -0
  65. package/dist/style.css +6 -0
  66. package/dist/tabs-85caa1e8.js +46 -0
  67. package/dist/tabs-860e37aa.cjs +1 -0
  68. package/dist/textarea-0750bcd2.js +73 -0
  69. package/dist/textarea-a338ede6.cjs +1 -0
  70. package/dist/toggle-00c9d11e.js +30 -0
  71. package/dist/toggle-b90fed97.cjs +1 -0
  72. package/dist/ui.cjs +1 -0
  73. package/dist/ui.d.ts +471 -0
  74. package/dist/ui.js +442 -0
  75. package/dist/useBuilderProp-5e57d0c8.cjs +1 -0
  76. package/dist/useBuilderProp-81a14920.js +238 -0
  77. package/dist/utils-3c452dd0.cjs +1 -0
  78. package/dist/utils-ac68b2c8.js +6 -0
  79. package/dist/vite.svg +1 -0
  80. package/package.json +156 -0
@@ -0,0 +1,144 @@
1
+ import { j as e } from "./jsx-runtime-944c88e2.js";
2
+ import { PlusIcon as w, StackIcon as C, Half2Icon as z } from "@radix-ui/react-icons";
3
+ import i, { lazy as c, useState as x, Suspense as r } from "react";
4
+ import { useAtom as u } from "jotai";
5
+ import { each as P, get as A } from "lodash";
6
+ import { u as f, B as o, S as h } from "./useBuilderProp-81a14920.js";
7
+ import { a as B, b as T } from "./index-cdd49c4c.js";
8
+ import "react-i18next";
9
+ import { c as S } from "./utils-ac68b2c8.js";
10
+ import "@radix-ui/react-slot";
11
+ import "class-variance-authority";
12
+ import "@radix-ui/react-tooltip";
13
+ import "@radix-ui/react-toast";
14
+ import "i18next";
15
+ import "flagged";
16
+ import "react-dnd";
17
+ import "@minoru/react-dnd-treeview";
18
+ import "react-hotkeys-hook";
19
+ import "flat-to-nested";
20
+ import "./Class-e6b07b79.js";
21
+ import "redux-undo";
22
+ import "@react-hookz/web";
23
+ import "chaibuilder-blocks";
24
+ import "./CONTROLS-442caee5.js";
25
+ import "clsx";
26
+ import "tailwind-merge";
27
+ const b = c(() => import("./Layers-6f1c162e.js")), E = c(() => import("./BrandingOptions-055cf22a.js")), I = c(() => import("./ImagesPanel-815d5e6f.js"));
28
+ let j = null;
29
+ const re = () => {
30
+ const m = f("sideBarComponents.top", []), g = f("sideBarComponents.bottom", []), [a, v] = u(B), [y, d] = x(a), [t, N] = x(null), p = {
31
+ layers: b,
32
+ "branding-options": E,
33
+ images: I
34
+ };
35
+ P(m, ({ name: s, panel: n }) => {
36
+ p[s] = n;
37
+ });
38
+ const l = (s) => {
39
+ clearTimeout(j), a !== "layers" && s === "layers" ? j = setTimeout(() => d("layers"), 500) : d(s), v(s);
40
+ }, [, k] = u(T);
41
+ return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
42
+ /* @__PURE__ */ e.jsxs("div", { className: "z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2", children: [
43
+ /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: [
44
+ /* @__PURE__ */ e.jsx(
45
+ o,
46
+ {
47
+ onClick: () => k(!0),
48
+ size: "sm",
49
+ variant: a === "add-blocks" ? "default" : "outline",
50
+ children: /* @__PURE__ */ e.jsx(w, { className: "text-xl" })
51
+ }
52
+ ),
53
+ /* @__PURE__ */ e.jsx(
54
+ o,
55
+ {
56
+ onClick: () => l("layers"),
57
+ size: "sm",
58
+ variant: a === "layers" ? "default" : "outline",
59
+ children: /* @__PURE__ */ e.jsx(C, { className: "text-xl" })
60
+ }
61
+ ),
62
+ /* @__PURE__ */ e.jsx(
63
+ o,
64
+ {
65
+ onClick: () => l("branding-options"),
66
+ size: "sm",
67
+ variant: a === "branding-options" ? "default" : "outline",
68
+ children: /* @__PURE__ */ e.jsx(z, { className: "w-4 max-w-[40px] text-xs" })
69
+ }
70
+ ),
71
+ i.Children.toArray(
72
+ m.map(({ name: s, icon: n }) => /* @__PURE__ */ e.jsx(r, { fallback: /* @__PURE__ */ e.jsx(h, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
73
+ o,
74
+ {
75
+ onClick: () => l(s),
76
+ size: "sm",
77
+ className: "w-10",
78
+ variant: a === s ? "default" : "outline",
79
+ children: /* @__PURE__ */ e.jsx(n, {})
80
+ }
81
+ ) }))
82
+ )
83
+ ] }),
84
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center space-y-2", children: i.Children.toArray(
85
+ g.map((s) => /* @__PURE__ */ e.jsx(r, { fallback: /* @__PURE__ */ e.jsx(h, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
86
+ ) })
87
+ ] }),
88
+ /* @__PURE__ */ e.jsx(
89
+ "div",
90
+ {
91
+ onClick: () => {
92
+ l("layers");
93
+ },
94
+ className: "absolute inset-0 right-0 z-50 w-screen bg-black/20" + (a === "layers" ? " hidden" : "")
95
+ }
96
+ ),
97
+ /* @__PURE__ */ e.jsx(
98
+ "div",
99
+ {
100
+ className: `fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${a !== "layers" ? "translate-x-0" : "-translate-x-full"}`,
101
+ children: /* @__PURE__ */ e.jsx(
102
+ r,
103
+ {
104
+ fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
105
+ /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
106
+ /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
107
+ /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
108
+ ] }),
109
+ children: /* @__PURE__ */ e.jsx(
110
+ "div",
111
+ {
112
+ className: S("relative h-full max-h-[93%] bg-background p-1", a === "layers" ? "" : "z-[100]"),
113
+ onMouseEnter: () => {
114
+ t && clearTimeout(t);
115
+ },
116
+ onMouseLeave: () => {
117
+ const s = setTimeout(() => {
118
+ t && (l("layers"), clearTimeout(t));
119
+ }, 1e3);
120
+ N(s);
121
+ },
122
+ children: i.createElement(A(p, y, () => /* @__PURE__ */ e.jsx("div", {})))
123
+ }
124
+ )
125
+ }
126
+ )
127
+ }
128
+ ),
129
+ /* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
130
+ r,
131
+ {
132
+ fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
133
+ /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
134
+ /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
135
+ /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
136
+ ] }),
137
+ children: i.createElement(b)
138
+ }
139
+ ) })
140
+ ] });
141
+ };
142
+ export {
143
+ re as default
144
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),s=require("react"),m=require("jotai"),d=require("lodash"),i=require("./useBuilderProp-5e57d0c8.cjs"),j=require("./index-aea5c557.cjs");require("react-i18next");const g=require("./utils-3c452dd0.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("./CONTROLS-031e1de3.cjs");require("clsx");require("tailwind-merge");const p=s.lazy(()=>Promise.resolve().then(()=>require("./Layers-3aa6aae7.cjs"))),y=s.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-c25f6370.cjs"))),q=s.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-160aa664.cjs")));let h=null;const N=()=>{const u=i.useBuilderProp("sideBarComponents.top",[]),f=i.useBuilderProp("sideBarComponents.bottom",[]),[r,b]=m.useAtom(j.activePanelAtom),[E,x]=s.useState(r),[n,v]=s.useState(null),c={layers:p,"branding-options":y,images:q};d.each(u,({name:t,panel:a})=>{c[t]=a});const l=t=>{clearTimeout(h),r!=="layers"&&t==="layers"?h=setTimeout(()=>x("layers"),500):x(t),b(t)},[,R]=m.useAtom(j.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>R(!0),size:"sm",variant:r==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(o.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>l("layers"),size:"sm",variant:r==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(o.StackIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>l("branding-options"),size:"sm",variant:r==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(o.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),s.Children.toArray(u.map(({name:t,icon:a})=>e.jsxRuntimeExports.jsx(s.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>l(t),size:"sm",className:"w-10",variant:r===t?"default":"outline",children:e.jsxRuntimeExports.jsx(a,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-2",children:s.Children.toArray(f.map(t=>e.jsxRuntimeExports.jsx(s.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{l("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(r==="layers"?" hidden":"")}),e.jsxRuntimeExports.jsx("div",{className:`fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${r!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(s.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:g.cn("relative h-full max-h-[93%] bg-background p-1",r==="layers"?"":"z-[100]"),onMouseEnter:()=>{n&&clearTimeout(n)},onMouseLeave:()=>{const t=setTimeout(()=>{n&&(l("layers"),clearTimeout(n))},1e3);v(t)},children:s.createElement(d.get(c,E,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(s.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:s.createElement(p)})})]})};exports.default=N;
@@ -0,0 +1,105 @@
1
+ import { j as e } from "./jsx-runtime-944c88e2.js";
2
+ import i, { useMemo as m, Suspense as o } from "react";
3
+ import { FontFamilyIcon as p } from "@radix-ui/react-icons";
4
+ import { S as x, c as d, b as h, d as u, a as g, e as j, f as t } from "./select-7fddd7c3.js";
5
+ import { u as l, d as f, e as v, f as S, S as c } from "./useBuilderProp-81a14920.js";
6
+ import { S as b } from "./separator-a80d065b.js";
7
+ import { T as N } from "./toggle-00c9d11e.js";
8
+ import { u as C } from "./index-cdd49c4c.js";
9
+ import { useTranslation as w } from "react-i18next";
10
+ import "@radix-ui/react-select";
11
+ import "./utils-ac68b2c8.js";
12
+ import "clsx";
13
+ import "tailwind-merge";
14
+ import "@radix-ui/react-slot";
15
+ import "class-variance-authority";
16
+ import "@radix-ui/react-tooltip";
17
+ import "@radix-ui/react-toast";
18
+ import "jotai";
19
+ import "lodash";
20
+ import "@radix-ui/react-separator";
21
+ import "@radix-ui/react-toggle";
22
+ import "i18next";
23
+ import "flagged";
24
+ import "react-dnd";
25
+ import "@minoru/react-dnd-treeview";
26
+ import "react-hotkeys-hook";
27
+ import "flat-to-nested";
28
+ import "./Class-e6b07b79.js";
29
+ import "redux-undo";
30
+ import "@react-hookz/web";
31
+ import "chaibuilder-blocks";
32
+ import "./CONTROLS-442caee5.js";
33
+ const y = () => l("languages", ["en"]), A = () => y().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(x, { children: [
34
+ /* @__PURE__ */ e.jsx(d, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
35
+ h,
36
+ {
37
+ placeholder: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
38
+ /* @__PURE__ */ e.jsx(p, { className: "h-4 w-4" }),
39
+ " English(US)"
40
+ ] })
41
+ }
42
+ ) }),
43
+ /* @__PURE__ */ e.jsx(u, { children: /* @__PURE__ */ e.jsxs(g, { children: [
44
+ /* @__PURE__ */ e.jsx(j, { children: "Fruits" }),
45
+ /* @__PURE__ */ e.jsx(t, { value: "apple", children: "Apple" }),
46
+ /* @__PURE__ */ e.jsx(t, { value: "banana", children: "Banana" }),
47
+ /* @__PURE__ */ e.jsx(t, { value: "blueberry", children: "Blueberry" }),
48
+ /* @__PURE__ */ e.jsx(t, { value: "grapes", children: "Grapes" }),
49
+ /* @__PURE__ */ e.jsx(t, { value: "pineapple", children: "Pineapple" })
50
+ ] }) })
51
+ ] }) }), T = () => {
52
+ const { savePage: a, syncState: s } = C(), { t: n } = w(), r = m(() => {
53
+ switch (s) {
54
+ case "SAVING":
55
+ return "animate-pulse bg-gray-500 text-gray-900";
56
+ case "SAVED":
57
+ return "bg-green-500 text-white hover:bg-green-600 hover:text-white";
58
+ default:
59
+ return "bg-gray-200 text-gray-500 hover:bg-gray-100";
60
+ }
61
+ }, [s]);
62
+ return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(f, { children: [
63
+ /* @__PURE__ */ e.jsx(v, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
64
+ N,
65
+ {
66
+ onClick: () => a(),
67
+ className: `flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${r}`,
68
+ size: "sm",
69
+ variant: "outline",
70
+ children: [
71
+ /* @__PURE__ */ e.jsx("svg", { fill: "currentColor", width: "16", height: "16", viewBox: "0 0 0.32 0.32", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e.jsx(
72
+ "path",
73
+ {
74
+ fillRule: "evenodd",
75
+ d: "M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"
76
+ }
77
+ ) }),
78
+ s === "SAVING" ? "Saving..." : s === "SAVED" ? n("Saved") : "Save"
79
+ ]
80
+ }
81
+ ) }),
82
+ /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx("p", { children: s === "SAVING" ? "Saving..." : s === "SAVED" ? "Saved" : "Save changes" }) })
83
+ ] }) });
84
+ }, ne = () => {
85
+ const a = l("topBarComponents.left", []), s = l("topBarComponents.center", []), n = l("topBarComponents.right", []);
86
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
87
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: i.Children.toArray(
88
+ a.map((r) => /* @__PURE__ */ e.jsx(o, { fallback: /* @__PURE__ */ e.jsx(c, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
89
+ ) }) }),
90
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: i.Children.toArray(
91
+ s.map((r) => /* @__PURE__ */ e.jsx(o, { fallback: /* @__PURE__ */ e.jsx(c, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
92
+ ) }),
93
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
94
+ /* @__PURE__ */ e.jsx(A, {}),
95
+ /* @__PURE__ */ e.jsx(b, { orientation: "vertical" }),
96
+ /* @__PURE__ */ e.jsx(T, {}),
97
+ i.Children.toArray(
98
+ n.map((r) => /* @__PURE__ */ e.jsx(o, { fallback: /* @__PURE__ */ e.jsx(c, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
99
+ )
100
+ ] })
101
+ ] });
102
+ };
103
+ export {
104
+ ne as default
105
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),o=require("@radix-ui/react-icons"),s=require("./select-0e32300c.cjs"),r=require("./useBuilderProp-5e57d0c8.cjs"),u=require("./separator-a597dba7.cjs"),a=require("./toggle-b90fed97.cjs"),c=require("./index-aea5c557.cjs"),p=require("react-i18next");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-separator");require("@radix-ui/react-toggle");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("./CONTROLS-031e1de3.cjs");const m=()=>r.useBuilderProp("languages",["en"]),j=()=>m().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(s.SelectContent,{children:e.jsxRuntimeExports.jsxs(s.SelectGroup,{children:[e.jsxRuntimeExports.jsx(s.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),d=()=>{const{savePage:x,syncState:t}=c.useSavePage(),{t:l}=p.useTranslation(),n=i.useMemo(()=>{switch(t){case"SAVING":return"animate-pulse bg-gray-500 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Tooltip,{children:[e.jsxRuntimeExports.jsx(r.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(a.Toggle,{onClick:()=>x(),className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${n}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx("svg",{fill:"currentColor",width:"16",height:"16",viewBox:"0 0 0.32 0.32",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"})}),t==="SAVING"?"Saving...":t==="SAVED"?l("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(r.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t==="SAVING"?"Saving...":t==="SAVED"?"Saved":"Save changes"})})]})})},h=()=>{const x=r.useBuilderProp("topBarComponents.left",[]),t=r.useBuilderProp("topBarComponents.center",[]),l=r.useBuilderProp("topBarComponents.right",[]);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:i.Children.toArray(t.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(j,{}),e.jsxRuntimeExports.jsx(u.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(d,{}),i.Children.toArray(l.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=h;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("react"),p=require("lodash"),I=require("@radix-ui/react-icons"),w=require("unsplash-js"),P=require("./useBuilderProp-5e57d0c8.cjs"),A=require("./link-43d13383.cjs"),k=require("./scroll-area-088530b9.cjs"),h=require("./popover-7cb9079b.cjs"),t=require("./select-0e32300c.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-160aa664.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("@radix-ui/react-scroll-area");require("@radix-ui/react-popover");require("@radix-ui/react-select");const T="phfFCfD_A95ICxvwEYsFxsgHD-1veFwGA4Cu8qxvcec",_=w.createApi({accessKey:T}),E=async u=>new Promise((d,i)=>{_.search.getPhotos(u).then(m=>{d(m)}).catch(m=>i(m))}),z=({isModalView:u,onSelect:d})=>{const[i,m]=a.useState(""),[o,j]=a.useState([]),[g,f]=a.useState(0),[l,N]=a.useState(),[c,b]=a.useState(),[C,R]=a.useState(0),v=async s=>{let n=g+1;s&&(s.preventDefault(),n=1),f(n);const x={query:i,page:n};l&&(x.orientation=l),c&&(x.color=c),E(x).then(r=>{var q,S,y;j(n===1?((q=r==null?void 0:r.response)==null?void 0:q.results)||[]:[...o,...((S=r==null?void 0:r.response)==null?void 0:S.results)||[]]),R((y=r==null?void 0:r.response)==null?void 0:y.total_pages)}).catch(()=>{})};return a.useEffect(()=>{if(!p.isEmpty(i)){const s={query:i,page:1};l&&(s.orientation=l),c&&(s.color=c),f(1),E(s).then(n=>{var x,r;j(((x=n==null?void 0:n.response)==null?void 0:x.results)||[]),R((r=n==null?void 0:n.response)==null?void 0:r.total_pages)}).catch(()=>{})}},[l,c,i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center rounded-md border bg-gray-100 p-px",onSubmit:v,children:[e.jsxRuntimeExports.jsx(A.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',value:i,onChange:s=>m(s.target.value)}),e.jsxRuntimeExports.jsxs(h.Popover,{children:[e.jsxRuntimeExports.jsx(h.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(I.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(h.PopoverContent,{side:u?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:l,onValueChange:s=>N(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:c,onValueChange:s=>b(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:p.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(k.ScrollArea,{className:`h-full ${u&&!p.isEmpty(o)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[p.isEmpty(o)&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),u?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:o.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>d(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):o.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),!p.isEmpty(o)&&g<C&&e.jsxRuntimeExports.jsx(P.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>v(void 0),children:"Load More"})]})]})};exports.default=z;exports.fetchImage=E;
@@ -0,0 +1,160 @@
1
+ import { j as e } from "./jsx-runtime-944c88e2.js";
2
+ import { useState as c, useEffect as _ } from "react";
3
+ import { isEmpty as h, startCase as k } from "lodash";
4
+ import { MixerHorizontalIcon as z } from "@radix-ui/react-icons";
5
+ import { createApi as D } from "unsplash-js";
6
+ import { B as F } from "./useBuilderProp-81a14920.js";
7
+ import { I as T } from "./link-8594fd8f.js";
8
+ import { S as V } from "./scroll-area-9f64a082.js";
9
+ import { P as B, a as H, b as K } from "./popover-f7addcf4.js";
10
+ import { S as C, c as S, b as w, d as P, f as m } from "./select-7fddd7c3.js";
11
+ import "@radix-ui/react-slot";
12
+ import "class-variance-authority";
13
+ import "./utils-ac68b2c8.js";
14
+ import "clsx";
15
+ import "tailwind-merge";
16
+ import "@radix-ui/react-tooltip";
17
+ import "@radix-ui/react-toast";
18
+ import "jotai";
19
+ import "react-icons-picker";
20
+ import "react-dom";
21
+ import "./dialog-3d4e82ed.js";
22
+ import "@radix-ui/react-dialog";
23
+ import "./ImagesPanel-815d5e6f.js";
24
+ import "./tabs-85caa1e8.js";
25
+ import "@radix-ui/react-tabs";
26
+ import "react-quill";
27
+ import "react-i18next";
28
+ import "@radix-ui/react-scroll-area";
29
+ import "@radix-ui/react-popover";
30
+ import "@radix-ui/react-select";
31
+ const L = "phfFCfD_A95ICxvwEYsFxsgHD-1veFwGA4Cu8qxvcec", O = D({ accessKey: L }), I = async (p) => new Promise((x, r) => {
32
+ O.search.getPhotos(p).then((d) => {
33
+ x(d);
34
+ }).catch((d) => r(d));
35
+ }), ve = ({ isModalView: p, onSelect: x }) => {
36
+ const [r, d] = c(""), [o, f] = c([]), [u, g] = c(0), [l, A] = c(), [i, E] = c(), [q, j] = c(0), v = async (s) => {
37
+ let t = u + 1;
38
+ s && (s.preventDefault(), t = 1), g(t);
39
+ const n = { query: r, page: t };
40
+ l && (n.orientation = l), i && (n.color = i), I(n).then((a) => {
41
+ var N, y, b;
42
+ f(t === 1 ? ((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || [] : [...o, ...((y = a == null ? void 0 : a.response) == null ? void 0 : y.results) || []]), j((b = a == null ? void 0 : a.response) == null ? void 0 : b.total_pages);
43
+ }).catch(() => {
44
+ });
45
+ };
46
+ return _(() => {
47
+ if (!h(r)) {
48
+ const s = { query: r, page: 1 };
49
+ l && (s.orientation = l), i && (s.color = i), g(1), I(s).then((t) => {
50
+ var n, a;
51
+ f(((n = t == null ? void 0 : t.response) == null ? void 0 : n.results) || []), j((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages);
52
+ }).catch(() => {
53
+ });
54
+ }
55
+ }, [l, i, r]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
56
+ /* @__PURE__ */ e.jsxs("form", { className: "flex items-center rounded-md border bg-gray-100 p-px", onSubmit: v, children: [
57
+ /* @__PURE__ */ e.jsx(
58
+ T,
59
+ {
60
+ type: "text",
61
+ name: "query",
62
+ className: "input",
63
+ placeholder: 'Try "dog" or "apple"',
64
+ value: r,
65
+ onChange: (s) => d(s.target.value)
66
+ }
67
+ ),
68
+ /* @__PURE__ */ e.jsxs(B, { children: [
69
+ /* @__PURE__ */ e.jsx(H, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(z, {}) }),
70
+ /* @__PURE__ */ e.jsx(
71
+ K,
72
+ {
73
+ side: p ? "bottom" : "right",
74
+ className: "z-[9999] flex w-max items-center justify-center",
75
+ children: /* @__PURE__ */ e.jsxs("div", { children: [
76
+ /* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
77
+ /* @__PURE__ */ e.jsxs(C, { defaultValue: l, onValueChange: (s) => A(s), children: [
78
+ /* @__PURE__ */ e.jsx(S, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(w, { placeholder: "Select" }) }),
79
+ /* @__PURE__ */ e.jsxs(P, { className: "z-[9999]", children: [
80
+ /* @__PURE__ */ e.jsx(m, { value: "", children: "All" }),
81
+ /* @__PURE__ */ e.jsx(m, { value: "landscape", children: "Landscape" }),
82
+ /* @__PURE__ */ e.jsx(m, { value: "portrait", children: "Portrait" }),
83
+ /* @__PURE__ */ e.jsx(m, { value: "squarish", children: "Square" })
84
+ ] })
85
+ ] }),
86
+ /* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
87
+ /* @__PURE__ */ e.jsxs(C, { defaultValue: i, onValueChange: (s) => E(s), children: [
88
+ /* @__PURE__ */ e.jsx(S, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(w, { placeholder: "Select" }) }),
89
+ /* @__PURE__ */ e.jsxs(P, { className: "z-[9999]", children: [
90
+ /* @__PURE__ */ e.jsx(m, { value: "", children: "All" }),
91
+ [
92
+ "black_and_white",
93
+ "black",
94
+ "white",
95
+ "yellow",
96
+ "orange",
97
+ "red",
98
+ "purple",
99
+ "magenta",
100
+ "green",
101
+ "teal",
102
+ "blue"
103
+ ].map((s) => /* @__PURE__ */ e.jsx(m, { value: s, children: k(s) }, s))
104
+ ] })
105
+ ] })
106
+ ] })
107
+ }
108
+ )
109
+ ] })
110
+ ] }),
111
+ /* @__PURE__ */ e.jsxs(
112
+ V,
113
+ {
114
+ className: `h-full ${p && !h(o) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
115
+ children: [
116
+ h(o) && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
117
+ /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
118
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
119
+ ] }),
120
+ p ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: o.map((s) => (
121
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
122
+ /* @__PURE__ */ e.jsx(
123
+ "div",
124
+ {
125
+ role: "button",
126
+ tabIndex: 0,
127
+ className: "my-1 flex",
128
+ onClick: () => x(s.urls.regular),
129
+ children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
130
+ "img",
131
+ {
132
+ className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
133
+ alt: s.alt_description,
134
+ src: s.urls.small
135
+ }
136
+ ) })
137
+ },
138
+ s.id
139
+ )
140
+ )) }) : o.map((s) => (
141
+ // TODO: Drag and Drop Image to Canvas from Here use `pic.urls.[small, regular, full]` for image quality
142
+ /* @__PURE__ */ e.jsx("div", { className: "w-full px-2 py-1", children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
143
+ "img",
144
+ {
145
+ className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
146
+ alt: s.alt_description,
147
+ src: s.urls.small
148
+ }
149
+ ) }) }, s.id)
150
+ )),
151
+ !h(o) && u < q && /* @__PURE__ */ e.jsx(F, { size: "sm", variant: "link", className: "w-full", onClick: () => v(void 0), children: "Load More" })
152
+ ]
153
+ }
154
+ )
155
+ ] });
156
+ };
157
+ export {
158
+ ve as default,
159
+ I as fetchImage
160
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),t=require("react"),a=require("lodash"),m=require("@radix-ui/react-icons"),E=require("jotai"),q=require("./scroll-area-088530b9.cjs");require("react-i18next");const b=require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-scroll-area");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const I=E.atom([]),w=({isModalView:r,onSelect:u})=>{const R=b.useBuilderProp("uploadMediaCallback",()=>""),x=b.useBuilderProp("fetchMediaCallback",()=>[]),[l,n]=E.useAtom(I),[o,p]=t.useState(!1),[j,f]=t.useState(!1),[c,d]=t.useState(),[h,v]=t.useState("");t.useEffect(()=>{(async()=>{f(!0);const s=await x();n(s||[]),f(!1)})()},[x,n]);const y=s=>{var i,g;s&&((g=(i=s==null?void 0:s.target)==null?void 0:i.files)==null?void 0:g.length)>0&&d(s.target.files[0])},N=async()=>{p(!0);try{const s=await R(c),i=await x();n(i),u(s),d(void 0)}catch(s){n([]),v((s==null?void 0:s.message)||"Something went wrong.")}p(!1)};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[c?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(c),alt:"",className:"h-auto w-full max-w-sm rounded-md"}),h&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:h}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:N,disabled:o,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[o?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"}),"  ",o?"Uploading...":"Upload"]}),!o&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.Cross1Icon,{}),"  Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:r?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:r?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:y})]}),e.jsxRuntimeExports.jsxs(q.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${r?"px-2":""} pt-2`,children:[a.isEmpty(l)&&j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:"Fetching..."})}),a.isEmpty(l)&&!j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),r?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(l,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>u(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))}):a.map(l,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>u(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=w;
@@ -0,0 +1,107 @@
1
+ import { j as e } from "./jsx-runtime-944c88e2.js";
2
+ import { useState as i, useEffect as w } from "react";
3
+ import { isEmpty as g, map as b } from "lodash";
4
+ import { GearIcon as C, UploadIcon as U, Cross1Icon as k } from "@radix-ui/react-icons";
5
+ import { atom as F, useAtom as E } from "jotai";
6
+ import { S as A } from "./scroll-area-9f64a082.js";
7
+ import "react-i18next";
8
+ import { u as j } from "./useBuilderProp-81a14920.js";
9
+ import "@radix-ui/react-scroll-area";
10
+ import "./utils-ac68b2c8.js";
11
+ import "clsx";
12
+ import "tailwind-merge";
13
+ import "@radix-ui/react-slot";
14
+ import "class-variance-authority";
15
+ import "@radix-ui/react-tooltip";
16
+ import "@radix-ui/react-toast";
17
+ const R = F([]), W = ({ isModalView: t, onSelect: n }) => {
18
+ const v = j("uploadMediaCallback", () => ""), d = j("fetchMediaCallback", () => []), [l, a] = E(R), [r, u] = i(!1), [p, x] = i(!1), [c, m] = i(), [f, y] = i("");
19
+ w(() => {
20
+ (async () => {
21
+ x(!0);
22
+ const s = await d();
23
+ a(s || []), x(!1);
24
+ })();
25
+ }, [d, a]);
26
+ const N = (s) => {
27
+ var o, h;
28
+ s && ((h = (o = s == null ? void 0 : s.target) == null ? void 0 : o.files) == null ? void 0 : h.length) > 0 && m(s.target.files[0]);
29
+ }, I = async () => {
30
+ u(!0);
31
+ try {
32
+ const s = await v(c), o = await d();
33
+ a(o), n(s), m(void 0);
34
+ } catch (s) {
35
+ a([]), y((s == null ? void 0 : s.message) || "Something went wrong.");
36
+ }
37
+ u(!1);
38
+ };
39
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
40
+ c ? /* @__PURE__ */ e.jsxs("div", { className: "relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1", children: [
41
+ /* @__PURE__ */ e.jsx("img", { src: URL.createObjectURL(c), alt: "", className: "h-auto w-full max-w-sm rounded-md" }),
42
+ f && /* @__PURE__ */ e.jsx("div", { className: "w-full pt-2 text-center text-sm text-red-500", children: f }),
43
+ /* @__PURE__ */ e.jsxs("div", { className: "flex w-full items-center justify-center gap-2 pt-2", children: [
44
+ /* @__PURE__ */ e.jsxs(
45
+ "button",
46
+ {
47
+ type: "button",
48
+ onClick: I,
49
+ disabled: r,
50
+ className: "flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",
51
+ children: [
52
+ r ? /* @__PURE__ */ e.jsx(C, { className: "animate-spin" }) : /* @__PURE__ */ e.jsx(U, { className: "animate-bounce" }),
53
+ "  ",
54
+ r ? "Uploading..." : "Upload"
55
+ ]
56
+ }
57
+ ),
58
+ !r && /* @__PURE__ */ e.jsxs(
59
+ "button",
60
+ {
61
+ type: "button",
62
+ className: "flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",
63
+ onClick: () => m(void 0),
64
+ children: [
65
+ /* @__PURE__ */ e.jsx(k, {}),
66
+ "  Cancel"
67
+ ]
68
+ }
69
+ )
70
+ ] })
71
+ ] }) : /* @__PURE__ */ e.jsxs("label", { htmlFor: t ? "upload-in-modal" : "upload-in-panel", children: [
72
+ /* @__PURE__ */ e.jsxs("div", { className: "flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50", children: [
73
+ /* @__PURE__ */ e.jsx("div", { className: "text-3xl", children: "+" }),
74
+ /* @__PURE__ */ e.jsx("div", { children: "Click to choose file" })
75
+ ] }),
76
+ /* @__PURE__ */ e.jsx("input", { type: "file", id: t ? "upload-in-modal" : "upload-in-panel", hidden: !0, onChange: N })
77
+ ] }),
78
+ /* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${t ? "px-2" : ""} pt-2`, children: [
79
+ g(l) && p && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "animate-pulse font-medium", children: "Fetching..." }) }),
80
+ g(l) && !p && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Images" }) }),
81
+ t ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(l, (s) => (
82
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
83
+ /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => n(s.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
84
+ "img",
85
+ {
86
+ className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
87
+ alt: s.name,
88
+ src: s.url
89
+ }
90
+ ) }) }, s.id)
91
+ )) }) : b(l, (s) => (
92
+ // TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
93
+ /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => n(s.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
94
+ "img",
95
+ {
96
+ className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
97
+ alt: s.name,
98
+ src: s.url
99
+ }
100
+ ) }) }, s.id)
101
+ ))
102
+ ] })
103
+ ] });
104
+ };
105
+ export {
106
+ W as default
107
+ };
@@ -0,0 +1 @@
1
+ "use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}exports.getDefaultExportFromCjs=e;
@@ -0,0 +1,6 @@
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3
+ }
4
+ export {
5
+ e as g
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("./jsx-runtime-5c3ac4f7.cjs"),u=require("react"),x=require("@radix-ui/react-accordion"),p=require("@radix-ui/react-icons"),c=require("./utils-3c452dd0.cjs");function a(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const i=a(u),o=a(x),f=o.Root,d=i.forwardRef(({className:e,...n},t)=>s.jsxRuntimeExports.jsx(o.Item,{ref:t,className:c.cn("border-b",e),...n}));d.displayName="AccordionItem";const m=i.forwardRef(({className:e,children:n,...t},r)=>s.jsxRuntimeExports.jsx(o.Header,{className:"flex",children:s.jsxRuntimeExports.jsxs(o.Trigger,{ref:r,className:c.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...t,children:[n,s.jsxRuntimeExports.jsx(p.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));m.displayName=o.Trigger.displayName;const l=i.forwardRef(({className:e,children:n,...t},r)=>s.jsxRuntimeExports.jsx(o.Content,{ref:r,className:c.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...t,children:s.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:n})}));l.displayName=o.Content.displayName;exports.Accordion=f;exports.AccordionContent=l;exports.AccordionItem=d;exports.AccordionTrigger=m;
@@ -0,0 +1,42 @@
1
+ import { j as a } from "./jsx-runtime-944c88e2.js";
2
+ import * as n from "react";
3
+ import * as e from "@radix-ui/react-accordion";
4
+ import { ChevronDownIcon as c } from "@radix-ui/react-icons";
5
+ import { c as i } from "./utils-ac68b2c8.js";
6
+ const N = e.Root, m = n.forwardRef(({ className: o, ...t }, r) => /* @__PURE__ */ a.jsx(e.Item, { ref: r, className: i("border-b", o), ...t }));
7
+ m.displayName = "AccordionItem";
8
+ const d = n.forwardRef(({ className: o, children: t, ...r }, s) => /* @__PURE__ */ a.jsx(e.Header, { className: "flex", children: /* @__PURE__ */ a.jsxs(
9
+ e.Trigger,
10
+ {
11
+ ref: s,
12
+ className: i(
13
+ "flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
14
+ o
15
+ ),
16
+ ...r,
17
+ children: [
18
+ t,
19
+ /* @__PURE__ */ a.jsx(c, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" })
20
+ ]
21
+ }
22
+ ) }));
23
+ d.displayName = e.Trigger.displayName;
24
+ const l = n.forwardRef(({ className: o, children: t, ...r }, s) => /* @__PURE__ */ a.jsx(
25
+ e.Content,
26
+ {
27
+ ref: s,
28
+ className: i(
29
+ "text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
30
+ o
31
+ ),
32
+ ...r,
33
+ children: /* @__PURE__ */ a.jsx("div", { className: "pb-4 pt-0", children: t })
34
+ }
35
+ ));
36
+ l.displayName = e.Content.displayName;
37
+ export {
38
+ N as A,
39
+ m as a,
40
+ d as b,
41
+ l as c
42
+ };