@chaibuilder/sdk 1.2.8 → 1.2.10-7.beta.1

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 (122) hide show
  1. package/README.md +26 -21
  2. package/dist/CodeEditor-3Vp79cuE.cjs +1 -0
  3. package/dist/CodeEditor-bUqM7eCa.js +129 -0
  4. package/dist/STRINGS-Xxstm-7I.js +7 -0
  5. package/dist/STRINGS-Yl7cSWDc.cjs +1 -0
  6. package/dist/Topbar-P7-9Rps1.js +124 -0
  7. package/dist/Topbar-xwQ4JUZD.cjs +1 -0
  8. package/dist/UnsplashImages-BxgbXGB6.cjs +1 -0
  9. package/dist/UnsplashImages-nQSvWPU0.js +244 -0
  10. package/dist/UploadImages-L9LlI-jl.cjs +1 -0
  11. package/dist/UploadImages-SVnIHigg.js +153 -0
  12. package/dist/context-menu-YGd09SE1.js +979 -0
  13. package/dist/context-menu-sQn7ryJ6.cjs +1 -0
  14. package/dist/{controls-XPXGHKht.js → controls-lEwMTdPQ.js} +96 -44
  15. package/dist/controls-p9IwFnPx.cjs +1 -0
  16. package/dist/core.cjs +1 -1
  17. package/dist/core.d.ts +344 -119
  18. package/dist/core.js +111 -88
  19. package/dist/iconBase-Ief2hJUZ.js +130 -0
  20. package/dist/iconBase-aZzpqff_.cjs +1 -0
  21. package/dist/index-3NV_rst1.js +9051 -0
  22. package/dist/index-qTKBamQ6.cjs +63 -0
  23. package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
  24. package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
  25. package/dist/mockServiceWorker.js +18 -10
  26. package/dist/plugin-UiUFs2fK.js +44 -0
  27. package/dist/plugin-f6SDZ_Or.js +108 -0
  28. package/dist/plugin-jum1MjXp.cjs +1 -0
  29. package/dist/plugin-xOpS-UNV.cjs +1 -0
  30. package/dist/render.cjs +3 -1
  31. package/dist/render.d.ts +21 -40
  32. package/dist/render.js +129 -85
  33. package/dist/runtime.cjs +1 -0
  34. package/dist/runtime.d.ts +5 -0
  35. package/dist/runtime.js +21 -0
  36. package/dist/style.css +2 -2
  37. package/dist/tailwind.cjs +1 -1
  38. package/dist/tailwind.d.ts +49 -8
  39. package/dist/tailwind.js +16 -20
  40. package/dist/ui.cjs +1 -1
  41. package/dist/ui.d.ts +3 -13
  42. package/dist/ui.js +363 -163
  43. package/dist/web-blocks.cjs +3 -9
  44. package/dist/web-blocks.d.ts +1 -1
  45. package/dist/web-blocks.js +725 -766
  46. package/package.json +66 -83
  47. package/dist/AddBlocks-tMxKPoen.js +0 -225
  48. package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
  49. package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
  50. package/dist/BrandingOptions-QJJ1y5ez.js +0 -194
  51. package/dist/CanvasArea-EfZgx-gN.js +0 -1425
  52. package/dist/CanvasArea-rIDwPHl5.cjs +0 -60
  53. package/dist/CurrentPage-QNFPD078.cjs +0 -1
  54. package/dist/CurrentPage-ulHTz4MD.js +0 -111
  55. package/dist/Functions-7jnEwJyw.js +0 -15
  56. package/dist/Functions-N3yhPYKY.cjs +0 -1
  57. package/dist/Layers-rehZkz78.js +0 -404
  58. package/dist/Layers-v-7k3W2I.cjs +0 -1
  59. package/dist/MODIFIERS-2FeVfZQ9.cjs +0 -1
  60. package/dist/MODIFIERS-RiXS5Mn1.js +0 -67
  61. package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
  62. package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
  63. package/dist/PagesPanel-acGVGJf-.js +0 -69
  64. package/dist/PagesPanel-x5ms_LOD.cjs +0 -1
  65. package/dist/ProjectPanel-5BHQ5ANP.cjs +0 -1
  66. package/dist/ProjectPanel-aLFJq49M.js +0 -90
  67. package/dist/Settings-iOjfw5NQ.cjs +0 -1
  68. package/dist/Settings-v-txwlII.js +0 -2193
  69. package/dist/SidePanels-Vdc-J5wK.js +0 -349
  70. package/dist/SidePanels-t0g9ZQFT.cjs +0 -1
  71. package/dist/Topbar-V8xCetWF.cjs +0 -1
  72. package/dist/Topbar-j4t4AgCq.js +0 -116
  73. package/dist/UnsplashImages-41Y3q5_Q.js +0 -200
  74. package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
  75. package/dist/UploadImages-DnQ95_NW.cjs +0 -1
  76. package/dist/UploadImages-xBg-kbKv.js +0 -138
  77. package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
  78. package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
  79. package/dist/add-page-modal-0YAI9dXr.cjs +0 -1
  80. package/dist/add-page-modal-6DlGzdA4.js +0 -108
  81. package/dist/confirm-alert-U7-NcG7G.cjs +0 -1
  82. package/dist/confirm-alert-i4pM3mOt.js +0 -62
  83. package/dist/controls-Dy1qa8Dc.cjs +0 -1
  84. package/dist/delete-page-modal-T_rlQfNd.js +0 -88
  85. package/dist/delete-page-modal-qXpi_2xR.cjs +0 -1
  86. package/dist/email-blocks.cjs +0 -1
  87. package/dist/email-blocks.d.ts +0 -3
  88. package/dist/email-blocks.js +0 -274
  89. package/dist/form-OVmsLOrc.js +0 -125
  90. package/dist/form-VbouZlAW.cjs +0 -1
  91. package/dist/functions-Ox_svtKm.cjs +0 -1
  92. package/dist/functions-xIebp8Aw.js +0 -23
  93. package/dist/html-to-json-2PeOCVey.cjs +0 -1
  94. package/dist/html-to-json-57841sEK.js +0 -183
  95. package/dist/index-EGUphg4R.js +0 -41620
  96. package/dist/index-H6vIwGfD.cjs +0 -1
  97. package/dist/index-e0c8PmRQ.js +0 -205
  98. package/dist/index-gi1LIOCw.cjs +0 -1
  99. package/dist/index-jw8RxsTv.cjs +0 -206
  100. package/dist/index-niHREMmR.js +0 -2938
  101. package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
  102. package/dist/lib.cjs +0 -4
  103. package/dist/lib.d.ts +0 -78
  104. package/dist/lib.js +0 -1322
  105. package/dist/page-viewer-EoYYnA56.js +0 -115
  106. package/dist/page-viewer-Ou8vDXGV.cjs +0 -1
  107. package/dist/project-general-setting-92q4oEYv.cjs +0 -1
  108. package/dist/project-general-setting-DC_nADG-.js +0 -83
  109. package/dist/project-seo-setting-Snn2nZgS.cjs +0 -1
  110. package/dist/project-seo-setting-wxAGEkd_.js +0 -85
  111. package/dist/server.cjs +0 -1
  112. package/dist/server.d.ts +0 -299
  113. package/dist/server.js +0 -216
  114. package/dist/single-page-detail-QmmhR_h2.cjs +0 -1
  115. package/dist/single-page-detail-xtNZ9YxX.js +0 -222
  116. package/dist/studio.cjs +0 -1
  117. package/dist/studio.d.ts +0 -13
  118. package/dist/studio.js +0 -58
  119. package/dist/useAddBlockByDrop-_nwI4W3q.js +0 -20
  120. package/dist/useAddBlockByDrop-inkD7Lck.cjs +0 -1
  121. package/dist/utils-AvyFzbPC.js +0 -1075
  122. package/dist/utils-PTxFk6qT.cjs +0 -1
package/README.md CHANGED
@@ -1,25 +1,27 @@
1
- # Chai Builder - Low-Code Visual Builder
1
+ # Chai Builder - Open Source Tailwind Builder
2
2
 
3
- Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder. Its a simple React component which can be integrated into any React based framework.
3
+ Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder.
4
+ It allows you to create web pages visually by dragging and dropping elements onto the canvas.
5
+ It is a simple React component that renders a full-fledged visual builder into any React application.
4
6
 
5
- ### Try Chai Builder:
6
- [Demo Link](https://chaibuilder-demo.vercel.app)
7
-    |    [GitHub](https://github.com/surajair/demo)
7
+ #### [View Demo](https://chaibuilder.com/demos/web)
8
+ #### [Documentation](https://chaibuilder.com/docs/sdk/introduction)
9
+ #### [API References](https://api-reference.chaibuilder.com)
8
10
 
9
11
  ---
10
12
 
11
- ### Getting Started:
13
+ ### Manual installation:
12
14
 
13
15
  Step 1: Install the packages
14
16
  ```bash
15
- npm install @chaibuilder/sdk @chaibuilder/runtime tailwindcss
17
+ npm install @chaibuilder/sdk
16
18
  ```
17
19
 
18
20
  Step 2: Add a custom tailwind config.
19
21
  Create a new file: `tailwind.chaibuilder.config.ts`. <br /> Pass the path to your source files.
20
22
  ```tsx
21
- import { chaiBuilderTailwindConfig } from "@chaibuilder/sdk/tailwind";
22
- export default chaiBuilderTailwindConfig(["./src/**/*.{js,ts,jsx,tsx}"]);
23
+ import { getChaiBuilderTailwindConfig } from "@chaibuilder/sdk/tailwind";
24
+ export default getChaiBuilderTailwindConfig(["./src/**/*.{js,ts,jsx,tsx}"]);
23
25
 
24
26
  ```
25
27
 
@@ -36,34 +38,37 @@ Step 4: Add the builder to your page.
36
38
  ```tsx
37
39
  import "./chaibuilder.tailwind.css";
38
40
  import "@chaibuilder/sdk/styles";
39
- import {ChaiBuilderEditor} from "@chaibuilder/sdk";
41
+ import {loadWebBlocks} from "@chaibuilder/sdk/web-blocks";
42
+ import { ChaiBuilderEditor } from "@chaibuilder/sdk";
43
+
44
+ loadWebBlocks();
40
45
 
41
46
  const BuilderFullPage = () => {
42
47
  return (
43
48
  <ChaiBuilderEditor
44
- blocks={[]}
45
- onSavePage={async (blocks) => await saveBlocks(blocks)}
46
- onSaveBrandingOptions={async (branding) => await saveBranding(branding)}
49
+ blocks={[{_type: 'Heading', _id: 'a', content: 'This is a heading', styles: '#styles:,text-3xl font-bold'}]}
50
+ onSave={async ({ blocks, providers, brandingOptions } ) => {
51
+ console.log(blocks, providers, brandingOptions );
52
+ return true
53
+ }}
47
54
  />
48
55
  );
49
56
  }
50
57
  ```
51
58
 
52
- Step 5: Render the blocks on your page.
59
+ ### Render the blocks on your page.
60
+
53
61
  ```tsx
54
- export default async () => {
55
- const styles = await getStylesForBlocks(blocks, brandingOptions);
56
- return <>
57
- <style>{styles}</style>
58
- <RenderChaiBlocks blocks={blocks} />
59
- </>
62
+ export default () => {
63
+ return <RenderChaiBlocks blocks={blocks}/>
60
64
  }
61
65
  ```
62
66
 
67
+ ---
63
68
  ## Support
64
69
  If you like the project, you can assist us in expanding. ChaiBuilder is a collaborative endeavor crafted by developers in their free time. We value every contribution, no matter how modest, as each one represents a significant step forward in various ways, particularly in fueling our drive to enhance this tool continually.
65
70
 
66
- <a href="https://www.buymeacoffee.com/chaibuilder" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
71
+ <a href="https://www.buymeacoffee.com/chaibuilder" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 30px !important;width: 117px !important;" ></a>
67
72
 
68
73
 
69
74
  ## Acknowledgments
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),b=require("@monaco-editor/react"),k=require("./context-menu-sQn7ryJ6.cjs"),C=require("react-i18next"),u=require("react"),n=require("./index-qTKBamQ6.cjs"),E=require("@radix-ui/react-icons"),R=require("@react-hookz/web");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-aZzpqff_.cjs");require("@chaibuilder/runtime");require("./plugin-xOpS-UNV.cjs");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const a=s=>{const i=document.createElement("div");return i.innerHTML=s,i.innerHTML};function g(){const{t:s}=C.useTranslation(),[i,d]=u.useState(!1),[l,q]=u.useState(""),[r,o]=n.useCodeEditor(),[c]=n.useSelectedBlockIds(),x=n.useUpdateBlocksProps(),m=n.useUpdateBlocksPropsRealtime(),p=R.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=u.useCallback(()=>{if(i){const t=a(l);x([r.blockId],{[r.blockProp]:t})}},[i,l]);u.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:s("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:s("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(k.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(E.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),q(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=g;
@@ -0,0 +1,129 @@
1
+ import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
+ import k from "@monaco-editor/react";
3
+ import { B as C } from "./context-menu-YGd09SE1.js";
4
+ import { useTranslation as j } from "react-i18next";
5
+ import { useState as l, useCallback as v, useEffect as g } from "react";
6
+ import { u as y, a as N, b as T, c as E } from "./index-3NV_rst1.js";
7
+ import { Cross2Icon as w } from "@radix-ui/react-icons";
8
+ import { useThrottledCallback as B } from "@react-hookz/web";
9
+ import "@radix-ui/react-switch";
10
+ import "@radix-ui/react-accordion";
11
+ import "class-variance-authority";
12
+ import "@radix-ui/react-alert-dialog";
13
+ import "@radix-ui/react-slot";
14
+ import "@radix-ui/react-label";
15
+ import "@radix-ui/react-scroll-area";
16
+ import "@radix-ui/react-tabs";
17
+ import "@radix-ui/react-tooltip";
18
+ import "@radix-ui/react-popover";
19
+ import "@radix-ui/react-hover-card";
20
+ import "@radix-ui/react-select";
21
+ import "@radix-ui/react-dropdown-menu";
22
+ import "@radix-ui/react-separator";
23
+ import "@radix-ui/react-toast";
24
+ import "cmdk";
25
+ import "@radix-ui/react-dialog";
26
+ import "@radix-ui/react-context-menu";
27
+ import "clsx";
28
+ import "tailwind-merge";
29
+ import "lodash-es";
30
+ import "jotai";
31
+ import "./iconBase-Ief2hJUZ.js";
32
+ import "@chaibuilder/runtime";
33
+ import "./plugin-f6SDZ_Or.js";
34
+ import "tree-model";
35
+ import "react-quill";
36
+ import "./STRINGS-Xxstm-7I.js";
37
+ import "flagged";
38
+ import "react-hotkeys-hook";
39
+ import "@floating-ui/dom";
40
+ import "@floating-ui/react-dom";
41
+ import "react-event-hook";
42
+ import "@tailwindcss/typography";
43
+ import "@tailwindcss/forms";
44
+ import "@tailwindcss/aspect-ratio";
45
+ import "react-wrap-balancer";
46
+ import "react-dom";
47
+ import "prop-types";
48
+ import "react-error-boundary";
49
+ import "re-resizable";
50
+ import "lucide-react";
51
+ import "@rjsf/validator-ajv8";
52
+ import "@rjsf/core";
53
+ import "./controls-lEwMTdPQ.js";
54
+ import "react-arborist";
55
+ import "himalaya";
56
+ import "react-icons-picker";
57
+ import "react-autosuggest";
58
+ import "fuse.js";
59
+ import "i18next";
60
+ import "framer-motion";
61
+ const a = (r) => {
62
+ const i = document.createElement("div");
63
+ return i.innerHTML = r, i.innerHTML;
64
+ };
65
+ function Rt() {
66
+ const { t: r } = j(), [i, n] = l(!1), [m, c] = l(""), [o, s] = y(), [p] = N(), d = T(), u = E(), f = B(
67
+ (e) => {
68
+ const b = a(e);
69
+ u([o.blockId], { [o.blockProp]: b });
70
+ },
71
+ [],
72
+ 300
73
+ ), x = v(() => {
74
+ if (i) {
75
+ const e = a(m);
76
+ d([o.blockId], { [o.blockProp]: e });
77
+ }
78
+ }, [i, m]);
79
+ g(() => {
80
+ p.includes(o == null ? void 0 : o.blockId) || (x(), s(null));
81
+ }, [p]);
82
+ const h = () => {
83
+ s(null);
84
+ };
85
+ return /* @__PURE__ */ t.jsxs("div", { className: "h-full rounded-t-lg border-t-4 border-black bg-black text-white", children: [
86
+ /* @__PURE__ */ t.jsx("button", { onClick: h, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
87
+ /* @__PURE__ */ t.jsxs("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
88
+ /* @__PURE__ */ t.jsxs("div", { className: "-mt-1 flex items-center justify-between px-2 py-2", children: [
89
+ /* @__PURE__ */ t.jsxs("h3", { className: "space-x-3 text-sm font-semibold", children: [
90
+ /* @__PURE__ */ t.jsx("span", { children: r("HTML Code Editor |") }),
91
+ /* @__PURE__ */ t.jsx("span", { className: "text-xs text-gray-400", children: r("Scripts will be only executed in preview and live mode.") })
92
+ ] }),
93
+ /* @__PURE__ */ t.jsx("div", { className: "flex gap-x-2", children: /* @__PURE__ */ t.jsx(
94
+ C,
95
+ {
96
+ onClick: () => s(null),
97
+ size: "sm",
98
+ variant: "destructive",
99
+ className: "h-6 w-fit",
100
+ children: /* @__PURE__ */ t.jsx(w, {})
101
+ }
102
+ ) })
103
+ ] }),
104
+ /* @__PURE__ */ t.jsx(
105
+ k,
106
+ {
107
+ onMount: (e) => {
108
+ e.setValue(o.initialCode);
109
+ },
110
+ onChange: (e) => {
111
+ n(!0), c(e), f(e);
112
+ },
113
+ height: "100%",
114
+ defaultLanguage: "html",
115
+ theme: "vs-dark",
116
+ defaultValue: "",
117
+ options: {
118
+ minimap: {
119
+ enabled: !1
120
+ }
121
+ }
122
+ }
123
+ )
124
+ ] })
125
+ ] });
126
+ }
127
+ export {
128
+ Rt as default
129
+ };
@@ -0,0 +1,7 @@
1
+ const s = "#styles:", _ = "#slots:", t = "#i18n", E = "__ADD_BLOCK_INTERNAL_ROOT";
2
+ export {
3
+ t as I,
4
+ E as R,
5
+ s as S,
6
+ _ as a
7
+ };
@@ -0,0 +1 @@
1
+ "use strict";const _="#styles:",E="#slots:",s="#i18n",T="__ADD_BLOCK_INTERNAL_ROOT";exports.I18N_KEY=s;exports.ROOT_TEMP_KEY=T;exports.SLOT_KEY=E;exports.STYLES_KEY=_;
@@ -0,0 +1,124 @@
1
+ import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
+ import m, { Suspense as p } from "react";
3
+ import { B as l, a as n, b as x } from "./context-menu-YGd09SE1.js";
4
+ import { e as d, F as h, d as o, f } from "./index-3NV_rst1.js";
5
+ import { useTranslation as c } from "react-i18next";
6
+ import { c as u } from "./iconBase-Ief2hJUZ.js";
7
+ import { EyeOpenIcon as v } from "@radix-ui/react-icons";
8
+ import "@radix-ui/react-switch";
9
+ import "@radix-ui/react-accordion";
10
+ import "class-variance-authority";
11
+ import "@radix-ui/react-alert-dialog";
12
+ import "@radix-ui/react-slot";
13
+ import "@radix-ui/react-label";
14
+ import "@radix-ui/react-scroll-area";
15
+ import "@radix-ui/react-tabs";
16
+ import "@radix-ui/react-tooltip";
17
+ import "@radix-ui/react-popover";
18
+ import "@radix-ui/react-hover-card";
19
+ import "@radix-ui/react-select";
20
+ import "@radix-ui/react-dropdown-menu";
21
+ import "@radix-ui/react-separator";
22
+ import "@radix-ui/react-toast";
23
+ import "cmdk";
24
+ import "@radix-ui/react-dialog";
25
+ import "@radix-ui/react-context-menu";
26
+ import "clsx";
27
+ import "tailwind-merge";
28
+ import "lodash-es";
29
+ import "jotai";
30
+ import "@chaibuilder/runtime";
31
+ import "./plugin-f6SDZ_Or.js";
32
+ import "@react-hookz/web";
33
+ import "tree-model";
34
+ import "react-quill";
35
+ import "./STRINGS-Xxstm-7I.js";
36
+ import "flagged";
37
+ import "react-hotkeys-hook";
38
+ import "@floating-ui/dom";
39
+ import "@floating-ui/react-dom";
40
+ import "react-event-hook";
41
+ import "@tailwindcss/typography";
42
+ import "@tailwindcss/forms";
43
+ import "@tailwindcss/aspect-ratio";
44
+ import "react-wrap-balancer";
45
+ import "react-dom";
46
+ import "prop-types";
47
+ import "react-error-boundary";
48
+ import "re-resizable";
49
+ import "lucide-react";
50
+ import "@rjsf/validator-ajv8";
51
+ import "@rjsf/core";
52
+ import "./controls-lEwMTdPQ.js";
53
+ import "react-arborist";
54
+ import "himalaya";
55
+ import "react-icons-picker";
56
+ import "react-autosuggest";
57
+ import "fuse.js";
58
+ import "i18next";
59
+ import "framer-motion";
60
+ const j = () => {
61
+ const { savePage: a, saveState: e } = d(), { t: s } = c(), i = /* @__PURE__ */ t.jsxs(
62
+ l,
63
+ {
64
+ disabled: e === "SAVING",
65
+ onClick: (r) => {
66
+ r.preventDefault(), a();
67
+ },
68
+ className: u(
69
+ "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
70
+ // UNSAVED sate
71
+ "bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",
72
+ {
73
+ "animate-pulse bg-gray-300 text-gray-900": e === "SAVING",
74
+ "bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white": e === "SAVED"
75
+ }
76
+ ),
77
+ size: "sm",
78
+ variant: "outline",
79
+ children: [
80
+ /* @__PURE__ */ t.jsx(h, { className: "text-sm text-white" }),
81
+ /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: s(e === "SAVING" ? "saving" : e === "SAVED" ? "saved" : "unsaved") })
82
+ ]
83
+ }
84
+ );
85
+ return /* @__PURE__ */ t.jsx("div", { className: "flex items-center", children: i });
86
+ }, g = function() {
87
+ const e = o("previewComponent"), [, s] = f(), { t: i } = c();
88
+ return e ? /* @__PURE__ */ t.jsxs(
89
+ l,
90
+ {
91
+ onClick: (r) => {
92
+ r.preventDefault(), s(!0);
93
+ },
94
+ className: "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
95
+ size: "sm",
96
+ variant: "outline",
97
+ children: [
98
+ /* @__PURE__ */ t.jsx(v, { className: "text-xs" }),
99
+ /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: i("preview") })
100
+ ]
101
+ }
102
+ ) : null;
103
+ }, kt = () => {
104
+ const a = o("topBarComponents.left", []), e = o("topBarComponents.center", []), s = o("topBarComponents.right", []), i = o("editable", !0);
105
+ return /* @__PURE__ */ t.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
106
+ /* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2 font-bold", children: m.Children.toArray(
107
+ a.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
108
+ ) }) }),
109
+ /* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2", children: m.Children.toArray(
110
+ e.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
111
+ ) }),
112
+ /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-1", children: [
113
+ /* @__PURE__ */ t.jsx(g, {}),
114
+ /* @__PURE__ */ t.jsx(x, { orientation: "vertical" }),
115
+ i ? /* @__PURE__ */ t.jsx(j, {}) : null,
116
+ m.Children.toArray(
117
+ s.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
118
+ )
119
+ ] })
120
+ ] });
121
+ };
122
+ export {
123
+ kt as default
124
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),u=require("./context-menu-sQn7ryJ6.cjs"),s=require("./index-qTKBamQ6.cjs"),x=require("react-i18next"),c=require("./iconBase-aZzpqff_.cjs"),l=require("@radix-ui/react-icons");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("@chaibuilder/runtime");require("./plugin-xOpS-UNV.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const p=()=>{const{savePage:a,saveState:r}=s.useSavePage(),{t:i}=x.useTranslation(),o=e.jsxRuntimeExports.jsxs(u.Button,{disabled:r==="SAVING",onClick:t=>{t.preventDefault(),a()},className:c.cn("flex h-auto w-fit items-center gap-x-2 p-1 px-2","bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",{"animate-pulse bg-gray-300 text-gray-900":r==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":r==="SAVED"}),size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(s.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:i(r==="SAVING"?"saving":r==="SAVED"?"saved":"unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},m=function(){const r=s.useBuilderProp("previewComponent"),[,i]=s.usePreviewMode(),{t:o}=x.useTranslation();return r?e.jsxRuntimeExports.jsxs(u.Button,{onClick:t=>{t.preventDefault(),i(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(l.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:o("preview")})]}):null},q=()=>{const a=s.useBuilderProp("topBarComponents.left",[]),r=s.useBuilderProp("topBarComponents.center",[]),i=s.useBuilderProp("topBarComponents.right",[]),o=s.useBuilderProp("editable",!0);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:n.Children.toArray(a.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(m,{}),e.jsxRuntimeExports.jsx(u.Separator,{orientation:"vertical"}),o?e.jsxRuntimeExports.jsx(p,{}):null,n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=q;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),p=require("lodash-es"),A=require("unsplash-js"),f=require("./context-menu-sQn7ryJ6.cjs"),_=require("react-i18next"),g=require("./index-qTKBamQ6.cjs"),T=require("@react-hookz/web"),B=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("jotai");require("./iconBase-aZzpqff_.cjs");require("@chaibuilder/runtime");require("./plugin-xOpS-UNV.cjs");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const v=async(h,j)=>new Promise((i,a)=>{A.createApi({accessKey:j}).search.getPhotos(h).then(l=>{i(l)}).catch(l=>a(l))}),D=({isModalView:h,onSelect:j})=>{const i=g.useBuilderProp("unsplashAccessKey",""),[a,q]=n.useState([]),[l,b]=n.useState(0),[o,w]=n.useState(),[u,k]=n.useState(),[C,y]=n.useState(0),[d,P]=T.useDebouncedState("",1e3),[m,c]=n.useState(!1),{t:E}=_.useTranslation(),I=async r=>{if(p.isEmpty(d))return;let t=l+1;r&&(r.preventDefault(),t=1),c(!0),b(t);const x={query:d,page:t};o&&(x.orientation=o),u&&(x.color=u),v(x,i).then(s=>{var R,N,S;q(t===1?((R=s==null?void 0:s.response)==null?void 0:R.results)||[]:[...a,...((N=s==null?void 0:s.response)==null?void 0:N.results)||[]]),y((S=s==null?void 0:s.response)==null?void 0:S.total_pages),c(!1)}).catch(()=>{c(!1)})};return n.useEffect(()=>{if(!p.isEmpty(d)&&i){c(!0);const r={query:d,page:1};o&&(r.orientation=o),u&&(r.color=u),b(1),v(r,i).then(t=>{var x,s;q(((x=t==null?void 0:t.response)==null?void 0:x.results)||[]),y((s=t==null?void 0:t.response)==null?void 0:s.total_pages),c(!1)}).catch(()=>{c(!1)})}},[o,u,d,i]),p.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"flex h-full flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"px-1 underline hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center gap-x-2 rounded-md border border-border bg-background p-px",children:[e.jsxRuntimeExports.jsx(f.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:r=>P(r.target.value)}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(g.ChaiSelect,{className:"w-40",placeholder:E("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:o,onValueChange:r=>w(r)})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(g.ChaiSelect,{placeholder:E("Color"),options:[{value:"",label:"All"},{value:"black_and_white",label:"Black and White"},{value:"black",label:"Black"},{value:"white",label:"White"},{value:"night",label:"Night"},{value:"warm",label:"Warm"},{value:"cool",label:"Cool"},{value:"sepia",label:"Sepia"}],defaultValue:u,onValueChange:r=>k(r)})})]}),e.jsxRuntimeExports.jsxs(f.ScrollArea,{className:`h-full ${h&&!p.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[p.isEmpty(a)&&!m&&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"})]}),h?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>j(r.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:r.alt_description,src:r.urls.small})})},r.id))}):a.map(r=>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:r.alt_description,src:r.urls.small})})},r.id)),m&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(B.Loader,{className:"h-6 w-6 animate-spin"}),"  Loading..."]}),!p.isEmpty(a)&&l<C&&!m&&e.jsxRuntimeExports.jsx(f.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>I(void 0),disabled:m,children:m?"":"Load More"})]})]})};exports.default=D;exports.fetchImage=v;
@@ -0,0 +1,244 @@
1
+ import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
+ import { useState as c, useEffect as q } from "react";
3
+ import { isEmpty as d } from "lodash-es";
4
+ import { createApi as B } from "unsplash-js";
5
+ import { I as D, S as E, B as L } from "./context-menu-YGd09SE1.js";
6
+ import { useTranslation as T } from "react-i18next";
7
+ import { d as F, C as k } from "./index-3NV_rst1.js";
8
+ import { useDebouncedState as K } from "@react-hookz/web";
9
+ import { Loader as U } from "lucide-react";
10
+ import "@radix-ui/react-switch";
11
+ import "@radix-ui/react-accordion";
12
+ import "@radix-ui/react-icons";
13
+ import "class-variance-authority";
14
+ import "@radix-ui/react-alert-dialog";
15
+ import "@radix-ui/react-slot";
16
+ import "@radix-ui/react-label";
17
+ import "@radix-ui/react-scroll-area";
18
+ import "@radix-ui/react-tabs";
19
+ import "@radix-ui/react-tooltip";
20
+ import "@radix-ui/react-popover";
21
+ import "@radix-ui/react-hover-card";
22
+ import "@radix-ui/react-select";
23
+ import "@radix-ui/react-dropdown-menu";
24
+ import "@radix-ui/react-separator";
25
+ import "@radix-ui/react-toast";
26
+ import "cmdk";
27
+ import "@radix-ui/react-dialog";
28
+ import "@radix-ui/react-context-menu";
29
+ import "clsx";
30
+ import "tailwind-merge";
31
+ import "jotai";
32
+ import "./iconBase-Ief2hJUZ.js";
33
+ import "@chaibuilder/runtime";
34
+ import "./plugin-f6SDZ_Or.js";
35
+ import "tree-model";
36
+ import "react-quill";
37
+ import "./STRINGS-Xxstm-7I.js";
38
+ import "flagged";
39
+ import "react-hotkeys-hook";
40
+ import "@floating-ui/dom";
41
+ import "@floating-ui/react-dom";
42
+ import "react-event-hook";
43
+ import "@tailwindcss/typography";
44
+ import "@tailwindcss/forms";
45
+ import "@tailwindcss/aspect-ratio";
46
+ import "react-wrap-balancer";
47
+ import "react-dom";
48
+ import "prop-types";
49
+ import "react-error-boundary";
50
+ import "re-resizable";
51
+ import "@rjsf/validator-ajv8";
52
+ import "@rjsf/core";
53
+ import "./controls-lEwMTdPQ.js";
54
+ import "react-arborist";
55
+ import "himalaya";
56
+ import "react-icons-picker";
57
+ import "react-autosuggest";
58
+ import "fuse.js";
59
+ import "i18next";
60
+ import "framer-motion";
61
+ const C = async (f, g) => new Promise((s, r) => {
62
+ B({ accessKey: g }).search.getPhotos(f).then((i) => {
63
+ s(i);
64
+ }).catch((i) => r(i));
65
+ }), $e = ({ isModalView: f, onSelect: g }) => {
66
+ const s = F("unsplashAccessKey", ""), [r, x] = c([]), [i, v] = c(0), [l, P] = c(), [n, A] = c(), [I, b] = c(0), [h, S] = K("", 1e3), [u, m] = c(!1), { t: j } = T(), _ = async (a) => {
67
+ if (d(h))
68
+ return;
69
+ let t = i + 1;
70
+ a && (a.preventDefault(), t = 1), m(!0), v(t);
71
+ const p = { query: h, page: t };
72
+ l && (p.orientation = l), n && (p.color = n), C(p, s).then((o) => {
73
+ var y, N, w;
74
+ x(t === 1 ? ((y = o == null ? void 0 : o.response) == null ? void 0 : y.results) || [] : [...r, ...((N = o == null ? void 0 : o.response) == null ? void 0 : N.results) || []]), b((w = o == null ? void 0 : o.response) == null ? void 0 : w.total_pages), m(!1);
75
+ }).catch(() => {
76
+ m(!1);
77
+ });
78
+ };
79
+ return q(() => {
80
+ if (!d(h) && s) {
81
+ m(!0);
82
+ const a = { query: h, page: 1 };
83
+ l && (a.orientation = l), n && (a.color = n), v(1), C(a, s).then((t) => {
84
+ var p, o;
85
+ x(((p = t == null ? void 0 : t.response) == null ? void 0 : p.results) || []), b((o = t == null ? void 0 : t.response) == null ? void 0 : o.total_pages), m(!1);
86
+ }).catch(() => {
87
+ m(!1);
88
+ });
89
+ }
90
+ }, [l, n, h, s]), d(s) ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full flex-col items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
91
+ "To enable Unsplash, kindly provide your",
92
+ /* @__PURE__ */ e.jsx(
93
+ "a",
94
+ {
95
+ href: "https://unsplash.com/documentation#public-authentication",
96
+ className: "px-1 underline hover:text-blue-400",
97
+ target: "_blank",
98
+ rel: "noopener noreferrer",
99
+ children: "Unsplash Access Key"
100
+ }
101
+ )
102
+ ] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
103
+ /* @__PURE__ */ e.jsxs("form", { className: "flex items-center gap-x-2 rounded-md border border-border bg-background p-px", children: [
104
+ /* @__PURE__ */ e.jsx(
105
+ D,
106
+ {
107
+ type: "text",
108
+ name: "query",
109
+ className: "text-foreground",
110
+ placeholder: 'Try "dog" or "apple"',
111
+ onChange: (a) => S(a.target.value)
112
+ }
113
+ ),
114
+ /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
115
+ k,
116
+ {
117
+ className: "w-40",
118
+ placeholder: j("Orientation"),
119
+ options: [
120
+ {
121
+ value: "",
122
+ label: "All"
123
+ },
124
+ {
125
+ value: "landscape",
126
+ label: "Landscape"
127
+ },
128
+ {
129
+ value: "portrait",
130
+ label: "Portrait"
131
+ },
132
+ {
133
+ value: "squarish",
134
+ label: "Square"
135
+ }
136
+ ],
137
+ defaultValue: l,
138
+ onValueChange: (a) => P(a)
139
+ }
140
+ ) }),
141
+ /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
142
+ k,
143
+ {
144
+ placeholder: j("Color"),
145
+ options: [
146
+ {
147
+ value: "",
148
+ label: "All"
149
+ },
150
+ {
151
+ value: "black_and_white",
152
+ label: "Black and White"
153
+ },
154
+ {
155
+ value: "black",
156
+ label: "Black"
157
+ },
158
+ {
159
+ value: "white",
160
+ label: "White"
161
+ },
162
+ {
163
+ value: "night",
164
+ label: "Night"
165
+ },
166
+ {
167
+ value: "warm",
168
+ label: "Warm"
169
+ },
170
+ {
171
+ value: "cool",
172
+ label: "Cool"
173
+ },
174
+ {
175
+ value: "sepia",
176
+ label: "Sepia"
177
+ }
178
+ ],
179
+ defaultValue: n,
180
+ onValueChange: (a) => A(a)
181
+ }
182
+ ) })
183
+ ] }),
184
+ /* @__PURE__ */ e.jsxs(
185
+ E,
186
+ {
187
+ className: `h-full ${f && !d(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
188
+ children: [
189
+ d(r) && !u && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
190
+ /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
191
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
192
+ ] }),
193
+ f ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((a) => /* @__PURE__ */ e.jsx(
194
+ "div",
195
+ {
196
+ role: "button",
197
+ tabIndex: 0,
198
+ className: "my-1 flex",
199
+ onClick: () => g(a.urls.regular),
200
+ children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
201
+ "img",
202
+ {
203
+ className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
204
+ alt: a.alt_description,
205
+ src: a.urls.small
206
+ }
207
+ ) })
208
+ },
209
+ a.id
210
+ )) }) : r.map((a) => (
211
+ // TODO: Drag and Drop Image to Canvas from Here use `pic.urls.[small, regular, full]` for image quality
212
+ /* @__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(
213
+ "img",
214
+ {
215
+ className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
216
+ alt: a.alt_description,
217
+ src: a.urls.small
218
+ }
219
+ ) }) }, a.id)
220
+ )),
221
+ u && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
222
+ /* @__PURE__ */ e.jsx(U, { className: "h-6 w-6 animate-spin" }),
223
+ "  Loading..."
224
+ ] }),
225
+ !d(r) && i < I && !u && /* @__PURE__ */ e.jsx(
226
+ L,
227
+ {
228
+ size: "sm",
229
+ variant: "link",
230
+ className: "w-full",
231
+ onClick: () => _(void 0),
232
+ disabled: u,
233
+ children: u ? "" : "Load More"
234
+ }
235
+ )
236
+ ]
237
+ }
238
+ )
239
+ ] });
240
+ };
241
+ export {
242
+ $e as default,
243
+ C as fetchImage
244
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),i=require("react"),n=require("lodash-es"),E=require("jotai"),I=require("./context-menu-sQn7ryJ6.cjs"),w=require("react-i18next"),g=require("./index-qTKBamQ6.cjs"),b=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("./iconBase-aZzpqff_.cjs");require("@chaibuilder/runtime");require("./plugin-xOpS-UNV.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const k=E.atom([]),S=({isModalView:a,onSelect:o})=>{const{t:s}=w.useTranslation(),d=g.useBuilderProp("uploadMediaCallback"),x=g.useBuilderProp("fetchMediaCallback"),[u,c]=E.useAtom(k),[R,p]=i.useState(!1),[j,q]=i.useState(!1),[,y]=i.useState(),[h,m]=i.useState("");i.useEffect(()=>{(async()=>{if(!x)return;q(!0);const r=await x();c(r||[]),q(!1)})()},[]);const N=r=>{var t,l;if(m(""),r&&((l=(t=r==null?void 0:r.target)==null?void 0:t.files)==null?void 0:l.length)>0){const f=r.target.files[0];f.type.startsWith("image")?v(f):m(s("Please select an image"))}},v=async r=>{if(d){p(!0);try{const{url:t}=await d(r);o(t),y(void 0);const l=await x();c(l)}catch(t){c([]),m((t==null?void 0:t.message)||"Something went wrong.")}p(!1)}};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("label",{htmlFor:a?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center rounded-lg",children:e.jsxRuntimeExports.jsxs("label",{htmlFor:"image-upload",className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center pb-6 pt-5",children:[e.jsxRuntimeExports.jsx(b.Upload,{className:"mb-3 h-10 w-10 text-gray-400"}),e.jsxRuntimeExports.jsx("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:e.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:s("Click to upload")})}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s("SVG, PNG, JPG or GIF (Max. 2mb)")})]}),R?e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full items-center justify-center",children:[e.jsxRuntimeExports.jsx(b.Loader,{className:"h-6 w-6 animate-spin"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 text-sm text-gray-500",children:s("Uploading...")})]}):null,h&&e.jsxRuntimeExports.jsx("p",{className:"pb-2 text-xs text-red-500",children:h||s("Something went wrong")})]})}),e.jsxRuntimeExports.jsx("input",{type:"file",id:"image-upload",accept:"image/*",hidden:!0,onChange:N})]}),e.jsxRuntimeExports.jsxs(I.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${a?"px-2":""} pt-2`,children:[n.isEmpty(u)&&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:s("Fetching...")})}),n.isEmpty(u)&&!j&&e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-4 h-12 rounded-full p-6"}),e.jsxRuntimeExports.jsx("h3",{className:"mb-2 text-sm font-semibold",children:s("No images found")}),e.jsxRuntimeExports.jsx("p",{className:"mb-4 max-w-sm text-muted-foreground",children:s("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.")})]}),a?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(u,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>o(r.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:r.name,src:r.thumbUrl})})},r.id))}):n.map(u,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>o(r.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:r.name,src:r.url})})},r.id))]})]})};exports.default=S;