@chaibuilder/sdk 1.2.72 → 1.2.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Suraj Air",
6
6
  "license": "BSD-3-Clause",
7
7
  "homepage": "https://chaibuilder.com",
8
- "version": "1.2.72",
8
+ "version": "1.2.73",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),o=require("react"),l=require("lodash-es"),k=require("@radix-ui/react-icons"),A=require("unsplash-js"),d=require("./context-menu-Lx_MAqsu.cjs"),r=require("./select-FnytvxNn.cjs");require("react-i18next");const T=require("./index-xFV80sAn.cjs"),z=require("@react-hookz/web"),_=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");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-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("@radix-ui/react-select");require("jotai");require("./iconBase-vJD0OXxU.cjs");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("tree-model");require("react-quill");require("./STRINGS-hZpwIZMT.cjs");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const g=async(j,E)=>new Promise((a,n)=>{A.createApi({accessKey:E}).search.getPhotos(j).then(u=>{a(u)}).catch(u=>n(u))}),D=({isModalView:j,onSelect:E})=>{const a=T.useBuilderProp("unsplashAccessKey",""),[n,f]=o.useState([]),[u,R]=o.useState(0),[c,b]=o.useState(),[x,I]=o.useState(),[w,y]=o.useState(0),[h,P]=z.useDebouncedState("",1e3),[q,m]=o.useState(!1),C=async s=>{if(l.isEmpty(h))return;let i=u+1;s&&(s.preventDefault(),i=1),m(!0),R(i);const p={query:h,page:i};c&&(p.orientation=c),x&&(p.color=x),g(p,a).then(t=>{var v,N,S;f(i===1?((v=t==null?void 0:t.response)==null?void 0:v.results)||[]:[...n,...((N=t==null?void 0:t.response)==null?void 0:N.results)||[]]),y((S=t==null?void 0:t.response)==null?void 0:S.total_pages),m(!1)}).catch(()=>{m(!1)})};return o.useEffect(()=>{if(!l.isEmpty(h)&&a){m(!0);const s={query:h,page:1};c&&(s.orientation=c),x&&(s.color=x),R(1),g(s,a).then(i=>{var p,t;f(((p=i==null?void 0:i.response)==null?void 0:p.results)||[]),y((t=i==null?void 0:i.response)==null?void 0:t.total_pages),m(!1)}).catch(()=>{m(!1)})}},[c,x,h,a]),l.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex 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:"underline px-1 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 rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(d.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>P(s.target.value)}),e.jsxRuntimeExports.jsxs(d.Popover,{children:[e.jsxRuntimeExports.jsx(d.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(k.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(d.PopoverContent,{side:j?"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(r.Select,{defaultValue:c,onValueChange:s=>b(s),children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(r.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(r.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(r.Select,{defaultValue:x,onValueChange:s=>I(s),children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(r.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(r.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(r.SelectItem,{value:s,children:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(d.ScrollArea,{className:`h-full ${j&&!l.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(n)&&!q&&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"})]}),j?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>E(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))}):n.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)),q&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(_.Loader,{className:"animate-spin w-6 h-6"}),"  Loading..."]}),!l.isEmpty(n)&&u<w&&!q&&e.jsxRuntimeExports.jsx(d.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>C(void 0),disabled:q,children:q?"":"Load More"})]})]})};exports.default=D;exports.fetchImage=g;
@@ -1,216 +0,0 @@
1
- import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
- import { useState as p, useEffect as D } from "react";
3
- import { isEmpty as d, startCase as E } from "lodash-es";
4
- import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
5
- import { createApi as V } from "unsplash-js";
6
- import { N as B, P as F, r as K, s as U, V as O, B as Q } from "./context-menu-zu6r7B6f.js";
7
- import { S as P, c as S, b as C, d as I, f as h } from "./select-1WwjQDp6.js";
8
- import "react-i18next";
9
- import { d as H } from "./index-ZUADC6Lh.js";
10
- import { useDebouncedState as R } from "@react-hookz/web";
11
- import { Loader as $ } from "lucide-react";
12
- import "@radix-ui/react-switch";
13
- import "@radix-ui/react-accordion";
14
- import "@radix-ui/react-alert-dialog";
15
- import "@radix-ui/react-slot";
16
- import "class-variance-authority";
17
- import "@radix-ui/react-label";
18
- import "@radix-ui/react-scroll-area";
19
- import "@radix-ui/react-tabs";
20
- import "@radix-ui/react-tooltip";
21
- import "@radix-ui/react-popover";
22
- import "@radix-ui/react-hover-card";
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 "@radix-ui/react-select";
32
- import "jotai";
33
- import "./iconBase-zweRWSz0.js";
34
- import "@chaibuilder/runtime";
35
- import "./plugin-sJ3Hzvpv.js";
36
- import "tree-model";
37
- import "react-quill";
38
- import "./STRINGS-rPGH65PW.js";
39
- import "react-hotkeys-hook";
40
- import "@floating-ui/dom";
41
- import "@floating-ui/react-dom";
42
- import "flagged";
43
- import "@tailwindcss/typography";
44
- import "@tailwindcss/forms";
45
- import "@tailwindcss/aspect-ratio";
46
- import "tailwindcss-palette-generator";
47
- import "react-wrap-balancer";
48
- import "react-dom";
49
- import "prop-types";
50
- import "re-resizable";
51
- import "@rjsf/validator-ajv8";
52
- import "@rjsf/core";
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 k = async (x, g) => new Promise((o, a) => {
61
- V({ accessKey: g }).search.getPhotos(x).then((i) => {
62
- o(i);
63
- }).catch((i) => a(i));
64
- }), Ye = ({ isModalView: x, onSelect: g }) => {
65
- const o = H("unsplashAccessKey", ""), [a, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [z, y] = p(0), [u, T] = R("", 1e3), [f, c] = p(!1), _ = async (s) => {
66
- if (d(u))
67
- return;
68
- let r = i + 1;
69
- s && (s.preventDefault(), r = 1), c(!0), v(r);
70
- const m = { query: u, page: r };
71
- l && (m.orientation = l), n && (m.color = n), k(m, o).then((t) => {
72
- var N, b, w;
73
- j(r === 1 ? ((N = t == null ? void 0 : t.response) == null ? void 0 : N.results) || [] : [...a, ...((b = t == null ? void 0 : t.response) == null ? void 0 : b.results) || []]), y((w = t == null ? void 0 : t.response) == null ? void 0 : w.total_pages), c(!1);
74
- }).catch(() => {
75
- c(!1);
76
- });
77
- };
78
- return D(() => {
79
- if (!d(u) && o) {
80
- c(!0);
81
- const s = { query: u, page: 1 };
82
- l && (s.orientation = l), n && (s.color = n), v(1), k(s, o).then((r) => {
83
- var m, t;
84
- j(((m = r == null ? void 0 : r.response) == null ? void 0 : m.results) || []), y((t = r == null ? void 0 : r.response) == null ? void 0 : t.total_pages), c(!1);
85
- }).catch(() => {
86
- c(!1);
87
- });
88
- }
89
- }, [l, n, u, o]), d(o) ? /* @__PURE__ */ e.jsx("div", { className: "h-full flex flex-col items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
90
- "To enable Unsplash, kindly provide your",
91
- /* @__PURE__ */ e.jsx(
92
- "a",
93
- {
94
- href: "https://unsplash.com/documentation#public-authentication",
95
- className: "underline px-1 hover:text-blue-400",
96
- target: "_blank",
97
- rel: "noopener noreferrer",
98
- children: "Unsplash Access Key"
99
- }
100
- )
101
- ] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
102
- /* @__PURE__ */ e.jsxs("form", { className: "flex items-center rounded-md border bg-gray-100 p-px", children: [
103
- /* @__PURE__ */ e.jsx(
104
- B,
105
- {
106
- type: "text",
107
- name: "query",
108
- className: "input",
109
- placeholder: 'Try "dog" or "apple"',
110
- onChange: (s) => T(s.target.value)
111
- }
112
- ),
113
- /* @__PURE__ */ e.jsxs(F, { children: [
114
- /* @__PURE__ */ e.jsx(K, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
115
- /* @__PURE__ */ e.jsx(
116
- U,
117
- {
118
- side: x ? "bottom" : "right",
119
- className: "z-[9999] flex w-max items-center justify-center",
120
- children: /* @__PURE__ */ e.jsxs("div", { children: [
121
- /* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
122
- /* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => A(s), children: [
123
- /* @__PURE__ */ e.jsx(S, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(C, { placeholder: "Select" }) }),
124
- /* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
125
- /* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
126
- /* @__PURE__ */ e.jsx(h, { value: "landscape", children: "Landscape" }),
127
- /* @__PURE__ */ e.jsx(h, { value: "portrait", children: "Portrait" }),
128
- /* @__PURE__ */ e.jsx(h, { value: "squarish", children: "Square" })
129
- ] })
130
- ] }),
131
- /* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
132
- /* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) => q(s), children: [
133
- /* @__PURE__ */ e.jsx(S, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(C, { placeholder: "Select" }) }),
134
- /* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
135
- /* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
136
- [
137
- "black_and_white",
138
- "black",
139
- "white",
140
- "yellow",
141
- "orange",
142
- "red",
143
- "purple",
144
- "magenta",
145
- "green",
146
- "teal",
147
- "blue"
148
- ].map((s) => /* @__PURE__ */ e.jsx(h, { value: s, children: E(s) }, s))
149
- ] })
150
- ] })
151
- ] })
152
- }
153
- )
154
- ] })
155
- ] }),
156
- /* @__PURE__ */ e.jsxs(
157
- O,
158
- {
159
- className: `h-full ${x && !d(a) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
160
- children: [
161
- d(a) && !f && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
162
- /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
163
- /* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
164
- ] }),
165
- x ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: a.map((s) => /* @__PURE__ */ e.jsx(
166
- "div",
167
- {
168
- role: "button",
169
- tabIndex: 0,
170
- className: "my-1 flex",
171
- onClick: () => g(s.urls.regular),
172
- children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
173
- "img",
174
- {
175
- className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
176
- alt: s.alt_description,
177
- src: s.urls.small
178
- }
179
- ) })
180
- },
181
- s.id
182
- )) }) : a.map((s) => (
183
- // TODO: Drag and Drop Image to Canvas from Here use `pic.urls.[small, regular, full]` for image quality
184
- /* @__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(
185
- "img",
186
- {
187
- className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
188
- alt: s.alt_description,
189
- src: s.urls.small
190
- }
191
- ) }) }, s.id)
192
- )),
193
- f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
194
- /* @__PURE__ */ e.jsx($, { className: "animate-spin w-6 h-6" }),
195
- "  Loading..."
196
- ] }),
197
- !d(a) && i < z && !f && /* @__PURE__ */ e.jsx(
198
- Q,
199
- {
200
- size: "sm",
201
- variant: "link",
202
- className: "w-full",
203
- onClick: () => _(void 0),
204
- disabled: f,
205
- children: f ? "" : "Load More"
206
- }
207
- )
208
- ]
209
- }
210
- )
211
- ] });
212
- };
213
- export {
214
- Ye as default,
215
- k as fetchImage
216
- };