@chaibuilder/sdk 1.2.99 → 1.2.100

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.
@@ -1,339 +0,0 @@
1
- import { get as r, omit as a } from "lodash-es";
2
- import { clsx as h } from "clsx";
3
- import { twMerge as v } from "tailwind-merge";
4
- import l from "react";
5
- function D(e = 6, t = "abcdefghijklmnopqrstuvwxyzABCD") {
6
- let i = "";
7
- for (let n = e; n > 0; --n)
8
- i += t[Math.floor(Math.random() * t.length)];
9
- return i;
10
- }
11
- const N = (e) => e >= 1536 ? "2XL" : e >= 1280 ? "XL" : e >= 1024 ? "LG" : e >= 768 ? "MD" : e >= 640 ? "SM" : "XS", z = (...e) => v(h(e)), O = "#styles:", L = (e) => ({
12
- type: "singular",
13
- default: e.default || "",
14
- binding: r(e, "binding", !0),
15
- dataType: "string",
16
- schema: {
17
- type: "string",
18
- ...a(e, ["i18n", "ai", "required"])
19
- },
20
- uiSchema: {
21
- "ui:widget": "code"
22
- }
23
- }), M = (e) => ({
24
- type: "singular",
25
- default: e.default || "",
26
- hidden: r(e, "hidden", !1),
27
- binding: r(e, "binding", !0),
28
- dataType: "string",
29
- required: e.required || !1,
30
- ai: e.ai || !1,
31
- i18n: e.i18n || !1,
32
- schema: {
33
- type: "string",
34
- ...a(e, ["ai", "required"])
35
- },
36
- uiSchema: {
37
- "ui:placeholder": e.placeholder || "Enter here"
38
- }
39
- }), B = (e) => ({
40
- type: "singular",
41
- default: e.default || "",
42
- hidden: r(e, "hidden", !1),
43
- binding: r(e, "binding", !0),
44
- dataType: "string",
45
- required: e.required || !1,
46
- ai: e.ai || !1,
47
- i18n: e.i18n || !1,
48
- schema: {
49
- type: "string",
50
- ...a(e, ["i18n", "ai", "required", "rows"])
51
- },
52
- uiSchema: {
53
- "ui:widget": "textarea",
54
- "ui:placeholder": e.placeholder || "Enter here",
55
- "ui:options": {
56
- rows: e.rows || 4
57
- }
58
- }
59
- }), G = (e) => ({
60
- type: "singular",
61
- i18n: e.i18n || !1,
62
- default: e.default || !1,
63
- dataType: "boolean",
64
- hidden: r(e, "hidden", !1),
65
- binding: r(e, "binding", !0),
66
- ai: e.ai || !1,
67
- schema: {
68
- type: "boolean",
69
- ...a(e, ["i18n", "ai", "required"])
70
- },
71
- uiSchema: {
72
- "ui:title": e.title || "Select Item",
73
- "ui:description": ""
74
- }
75
- }), W = (e) => ({
76
- type: "singular",
77
- default: e.default || "",
78
- hidden: r(e, "hidden", !1),
79
- binding: r(e, "binding", !0),
80
- dataType: "number",
81
- required: e.required || !1,
82
- ai: e.ai || !1,
83
- i18n: e.i18n || !1,
84
- schema: {
85
- type: "number",
86
- ...a(e, ["i18n", "ai", "required"])
87
- },
88
- uiSchema: {}
89
- }), X = (e) => ({
90
- type: "singular",
91
- default: e.default || "",
92
- hidden: r(e, "hidden", !1),
93
- binding: r(e, "binding", !0),
94
- required: e.required || !1,
95
- dataType: "string",
96
- ai: e.ai || !1,
97
- i18n: e.i18n || !1,
98
- schema: {
99
- type: "string",
100
- ...a(e, ["i18n", "ai", "required", "options", "binding"]),
101
- oneOf: e.options.map((t) => ({ const: t.value, title: t.title }))
102
- },
103
- uiSchema: {
104
- "ui:widget": "select"
105
- }
106
- }), U = (e) => ({
107
- type: "singular",
108
- default: e.default || "",
109
- hidden: r(e, "hidden", !1),
110
- binding: r(e, "binding", !0),
111
- dataType: "string",
112
- ai: e.ai || !1,
113
- i18n: e.i18n || !1,
114
- schema: {
115
- type: "string",
116
- ...a(e, ["i18n", "ai", "required"])
117
- },
118
- uiSchema: {
119
- "ui:widget": "color"
120
- }
121
- }), $ = (e) => ({
122
- type: "singular",
123
- default: e.default || "",
124
- binding: r(e, "binding", !0),
125
- dataType: "string",
126
- ai: e.ai || !1,
127
- i18n: e.i18n || !1,
128
- schema: {
129
- type: "string",
130
- ...a(e, ["i18n", "ai", "required"])
131
- },
132
- uiSchema: {
133
- "ui:widget": "richtext"
134
- }
135
- }), A = (e) => ({
136
- type: "model",
137
- title: e.title,
138
- dataType: "object",
139
- default: e.default || {},
140
- binding: r(e, "binding", !0),
141
- properties: e.properties
142
- }), K = (e) => ({
143
- type: "list",
144
- itemProperties: e.itemProperties,
145
- binding: r(e, "binding", !0),
146
- title: e.title,
147
- ai: e.ai || !1,
148
- i18n: e.i18n || !1,
149
- dataType: "array",
150
- default: e.default || [],
151
- itemTitle: e.getItemLabel ? e.getItemLabel({}) : () => ""
152
- }), R = (e) => ({
153
- type: "styles",
154
- binding: !1,
155
- default: `${O},${e.default || ""}`,
156
- presets: e.presets || {}
157
- }), V = (e) => ({
158
- default: e.default || "",
159
- binding: r(e, "binding", !0),
160
- type: "singular",
161
- dataType: "string",
162
- ai: e.ai || !1,
163
- i18n: e.i18n || !1,
164
- schema: {
165
- type: "string",
166
- title: "Icon",
167
- default: e.default || ""
168
- },
169
- uiSchema: {
170
- "ui:widget": "icon"
171
- }
172
- }), F = (e) => ({
173
- default: e.default,
174
- type: "singular",
175
- binding: r(e, "binding", !0),
176
- dataType: "object",
177
- ai: e.ai || !1,
178
- i18n: e.i18n || !1,
179
- schema: {
180
- type: "object",
181
- ...e || {},
182
- properties: {
183
- type: { type: "string" },
184
- href: { type: "string" },
185
- target: { type: "string" }
186
- }
187
- },
188
- uiSchema: {
189
- "ui:field": "link"
190
- }
191
- }), H = (e) => ({
192
- type: "singular",
193
- default: e.default || "",
194
- hidden: r(e, "hidden", !1),
195
- binding: r(e, "binding", !0),
196
- dataType: "string",
197
- ai: e.ai || !1,
198
- i18n: e.i18n || !1,
199
- schema: {
200
- type: "string",
201
- ...a(e, ["i18n", "ai", "required"])
202
- },
203
- uiSchema: {
204
- "ui:widget": "image"
205
- }
206
- });
207
- var m = {
208
- color: void 0,
209
- size: void 0,
210
- className: void 0,
211
- style: void 0,
212
- attr: void 0
213
- }, p = l.createContext && /* @__PURE__ */ l.createContext(m), w = ["attr", "size", "title"];
214
- function j(e, t) {
215
- if (e == null)
216
- return {};
217
- var i = P(e, t), n, d;
218
- if (Object.getOwnPropertySymbols) {
219
- var u = Object.getOwnPropertySymbols(e);
220
- for (d = 0; d < u.length; d++)
221
- n = u[d], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
222
- }
223
- return i;
224
- }
225
- function P(e, t) {
226
- if (e == null)
227
- return {};
228
- var i = {};
229
- for (var n in e)
230
- if (Object.prototype.hasOwnProperty.call(e, n)) {
231
- if (t.indexOf(n) >= 0)
232
- continue;
233
- i[n] = e[n];
234
- }
235
- return i;
236
- }
237
- function s() {
238
- return s = Object.assign ? Object.assign.bind() : function(e) {
239
- for (var t = 1; t < arguments.length; t++) {
240
- var i = arguments[t];
241
- for (var n in i)
242
- Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]);
243
- }
244
- return e;
245
- }, s.apply(this, arguments);
246
- }
247
- function f(e, t) {
248
- var i = Object.keys(e);
249
- if (Object.getOwnPropertySymbols) {
250
- var n = Object.getOwnPropertySymbols(e);
251
- t && (n = n.filter(function(d) {
252
- return Object.getOwnPropertyDescriptor(e, d).enumerable;
253
- })), i.push.apply(i, n);
254
- }
255
- return i;
256
- }
257
- function c(e) {
258
- for (var t = 1; t < arguments.length; t++) {
259
- var i = arguments[t] != null ? arguments[t] : {};
260
- t % 2 ? f(Object(i), !0).forEach(function(n) {
261
- S(e, n, i[n]);
262
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(i)) : f(Object(i)).forEach(function(n) {
263
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(i, n));
264
- });
265
- }
266
- return e;
267
- }
268
- function S(e, t, i) {
269
- return t = q(t), t in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = i, e;
270
- }
271
- function q(e) {
272
- var t = T(e, "string");
273
- return typeof t == "symbol" ? t : t + "";
274
- }
275
- function T(e, t) {
276
- if (typeof e != "object" || !e)
277
- return e;
278
- var i = e[Symbol.toPrimitive];
279
- if (i !== void 0) {
280
- var n = i.call(e, t || "default");
281
- if (typeof n != "object")
282
- return n;
283
- throw new TypeError("@@toPrimitive must return a primitive value.");
284
- }
285
- return (t === "string" ? String : Number)(e);
286
- }
287
- function y(e) {
288
- return e && e.map((t, i) => /* @__PURE__ */ l.createElement(t.tag, c({
289
- key: i
290
- }, t.attr), y(t.child)));
291
- }
292
- function J(e) {
293
- return (t) => /* @__PURE__ */ l.createElement(x, s({
294
- attr: c({}, e.attr)
295
- }, t), y(e.child));
296
- }
297
- function x(e) {
298
- var t = (i) => {
299
- var {
300
- attr: n,
301
- size: d,
302
- title: u
303
- } = e, b = j(e, w), g = d || i.size || "1em", o;
304
- return i.className && (o = i.className), e.className && (o = (o ? o + " " : "") + e.className), /* @__PURE__ */ l.createElement("svg", s({
305
- stroke: "currentColor",
306
- fill: "currentColor",
307
- strokeWidth: "0"
308
- }, i.attr, n, b, {
309
- className: o,
310
- style: c(c({
311
- color: e.color || i.color
312
- }, i.style), e.style),
313
- height: g,
314
- width: g,
315
- xmlns: "http://www.w3.org/2000/svg"
316
- }), u && /* @__PURE__ */ l.createElement("title", null, u), e.children);
317
- };
318
- return p !== void 0 ? /* @__PURE__ */ l.createElement(p.Consumer, null, (i) => t(i)) : t(m);
319
- }
320
- export {
321
- J as G,
322
- K as S,
323
- R as T,
324
- N as a,
325
- M as b,
326
- z as c,
327
- G as d,
328
- A as e,
329
- B as f,
330
- D as g,
331
- U as h,
332
- L as l,
333
- $ as m,
334
- V as q,
335
- W as s,
336
- F as w,
337
- H as x,
338
- X as y
339
- };