@levo-so/studio 0.1.90 → 0.1.92

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 (29) hide show
  1. package/{BillingStep-DVKPpBT9.js → BillingStep-o2yIMjLk.js} +1 -1
  2. package/{Button-vQpIKPk7.js → Button-_hpg7Rxx.js} +6 -6
  3. package/{EntryCard-UWxVYAD_.js → EntryCard-B-feJvrB.js} +13 -13
  4. package/{LoginCard-BKq_s4ZT.js → LoginCard-CF9JbU-y.js} +3 -3
  5. package/{LoginForm-54dtpOlx.js → LoginForm-CdpNCQJa.js} +10 -10
  6. package/{LoginModal-DTSAYZLC.js → LoginModal-ngTHCyli.js} +4 -4
  7. package/{MessageCard-YUS-pnpe.js → MessageCard-D2uja800.js} +2 -2
  8. package/{MessageFooter-DrJ6jZ_n.js → MessageFooter-Bu-jyPkJ.js} +1 -1
  9. package/{ModalManager-DLxbnq-i.js → ModalManager-B7pCzvK1.js} +1 -1
  10. package/{PendingApprovalCard-BnteoK24.js → PendingApprovalCard-Dut-Xiw1.js} +20 -20
  11. package/{bookingCard-CPYdqA8t.js → bookingCard-CGV9svhn.js} +4 -4
  12. package/collection.d.ts +360 -0
  13. package/collection.js +28 -0
  14. package/dist-DDKHTnIW.js +3653 -0
  15. package/index.d.ts +101 -2
  16. package/index.js +1419 -1453
  17. package/package.json +14 -3
  18. package/studio.css +1 -1
  19. package/utils-KqbqLlMF.js +5 -0
  20. package/widgets-B84lq4lO.js +351 -0
  21. /package/{AuthProvider-Ch5Ny0il.js → AuthProvider-56TywIOB.js} +0 -0
  22. /package/{Beams-BqUps11n.js → Beams-CCNNOvfW.js} +0 -0
  23. /package/{Dots-BKqlE-Rv.js → Dots-89WGkd-z.js} +0 -0
  24. /package/{Gradient-hC5P0PfD.js → Gradient-vTa_uWCj.js} +0 -0
  25. /package/{Grid-DqZKCasl.js → Grid-CrtztrxK.js} +0 -0
  26. /package/{StripePaymentModal-Kk0GUsIU.js → StripePaymentModal-CajqohNM.js} +0 -0
  27. /package/{Waves-CzQRk01F.js → Waves-BhA6CLEI.js} +0 -0
  28. /package/{card-oIl95-_C.js → card-DCbhJCO9.js} +0 -0
  29. /package/{dialog-BRgfpVtv.js → dialog-CILIXExr.js} +0 -0
@@ -0,0 +1,5 @@
1
+ import { h as e } from "./widgets-B84lq4lO.js";
2
+ //#region ../../libraries/react-collection/dist/utils.js
3
+ var t = (t) => Object.entries(e).find(([e, n]) => Object.keys(n).includes(t))?.[0];
4
+ //#endregion
5
+ export { t };
@@ -0,0 +1,351 @@
1
+ import e, { createContext as t, useContext as n, useRef as r } from "react";
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import { FieldInterfaces as a, FieldInterfacesList as o, defaultByKinds as s, formatsByInterface as c, interfaceKinds as l } from "@levo-so/core";
4
+ import { c as u } from "react/compiler-runtime";
5
+ import d from "clsx";
6
+ import { Snowflake as f } from "@theinternetfolks/snowflake";
7
+ import { isPossiblePhoneNumber as p, isValidPhoneNumber as m } from "react-phone-number-input";
8
+ import * as h from "yup";
9
+ //#region ../../libraries/rich-text-editor/dist/styles/content.css.js
10
+ var g = "d3c9ok0", _ = "_7afiv40", v = "_1er5g5a0", y = "_1bi3v3x0", b = /* @__PURE__ */ new Set(), x = {}, S = t(null), C = (e) => {
11
+ let t = u(29), a, o, s, c, l;
12
+ t[0] === e ? (a = t[1], o = t[2], s = t[3], c = t[4], l = t[5]) : ({children: a, cssReset: s, className: o, style: l, ...c} = e, t[0] = e, t[1] = a, t[2] = o, t[3] = s, t[4] = c, t[5] = l);
13
+ let f = n(S), p = r(null), m = !f && s !== !1 ? v : "", h = f?.classes ?? b, g = f?.overrides ?? x, _;
14
+ if (t[6] !== o || t[7] !== h) {
15
+ let e = o ? o.split(/\s+/).filter(Boolean) : [];
16
+ _ = new Set(h);
17
+ for (let t of e) _.add(t);
18
+ t[6] = o, t[7] = h, t[8] = _;
19
+ } else _ = t[8];
20
+ let y;
21
+ t[9] !== g || t[10] !== l ? (y = {
22
+ ...g,
23
+ ...l
24
+ }, t[9] = g, t[10] = l, t[11] = y) : y = t[11];
25
+ let C = y, w;
26
+ t[12] !== _ || t[13] !== C ? (w = {
27
+ rootRef: p,
28
+ classes: _,
29
+ overrides: C
30
+ }, t[12] = _, t[13] = C, t[14] = w) : w = t[14];
31
+ let T = w, E;
32
+ t[15] !== o || t[16] !== h || t[17] !== m ? (E = d(m, ...o ? o.split(/\s+/).filter((e) => e && !h.has(e)) : []), t[15] = o, t[16] = h, t[17] = m, t[18] = E) : E = t[18];
33
+ let D = E, O;
34
+ t[19] === l ? O = t[20] : (O = {
35
+ display: "contents",
36
+ ...l
37
+ }, t[19] = l, t[20] = O);
38
+ let k;
39
+ t[21] !== D || t[22] !== a || t[23] !== c || t[24] !== O ? (k = /* @__PURE__ */ i("div", {
40
+ ref: p,
41
+ className: D,
42
+ style: O,
43
+ ...c,
44
+ children: a
45
+ }), t[21] = D, t[22] = a, t[23] = c, t[24] = O, t[25] = k) : k = t[25];
46
+ let A;
47
+ return t[26] !== T || t[27] !== k ? (A = /* @__PURE__ */ i(S.Provider, {
48
+ value: T,
49
+ children: k
50
+ }), t[26] = T, t[27] = k, t[28] = A) : A = t[28], A;
51
+ }, w = (e) => {
52
+ let t = u(6), { children: n, theme: r } = e, a = r?.className, o;
53
+ t[0] === a ? o = t[1] : (o = d(y, _, a), t[0] = a, t[1] = o);
54
+ let s = r?.style, c;
55
+ return t[2] !== n || t[3] !== o || t[4] !== s ? (c = /* @__PURE__ */ i(C, {
56
+ className: o,
57
+ style: s,
58
+ children: n
59
+ }), t[2] = n, t[3] = o, t[4] = s, t[5] = c) : c = t[5], c;
60
+ }, T = [
61
+ "pdf",
62
+ "xls",
63
+ "xlsx",
64
+ "doc",
65
+ "docx",
66
+ "csv"
67
+ ], E = [
68
+ "svg",
69
+ "png",
70
+ "jpg",
71
+ "jpeg",
72
+ "webp",
73
+ "gif",
74
+ "avif"
75
+ ], D = ["mpeg", "mp4"], O = [
76
+ "mp3",
77
+ "ogg",
78
+ "oga"
79
+ ], k = {
80
+ "application/pdf": [".pdf"],
81
+ "application/msword": [".doc"],
82
+ "application/vnd.ms-excel": [".xls"],
83
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
84
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
85
+ "text/csv": [".csv"]
86
+ }, A = {
87
+ "image/jpeg": [".jpeg", ".jpg"],
88
+ "image/png": [".png"],
89
+ "image/gif": [".gif"],
90
+ "image/svg+xml": [".svg"],
91
+ "image/webp": [".webp"],
92
+ "image/avif": [".avif"]
93
+ }, j = {
94
+ "video/mp4": [".mp4"],
95
+ "video/mpeg": [".mpeg"]
96
+ }, M = {
97
+ audio: {
98
+ "audio/mpeg": [".mp3"],
99
+ "audio/ogg": [".oga"]
100
+ },
101
+ document: k,
102
+ image: A,
103
+ video: j
104
+ }, N = {
105
+ audio: O,
106
+ document: T,
107
+ image: E,
108
+ video: D
109
+ };
110
+ [
111
+ ...N.audio,
112
+ ...N.document,
113
+ ...N.image,
114
+ ...N.video
115
+ ], {
116
+ ...M.audio,
117
+ ...M.document,
118
+ ...M.image,
119
+ ...M.video
120
+ };
121
+ //#endregion
122
+ //#region ../../libraries/react-collection/dist/utils/formHelpers.js
123
+ var P = (e) => {
124
+ let t = [];
125
+ for (let n of Object.keys(e)) for (let r of e?.[n] || []) t.push({
126
+ message: r,
127
+ name: n
128
+ });
129
+ return t;
130
+ }, F = (e) => e ? p(e) : !1, I = (e, t) => {
131
+ let n = [];
132
+ for (let [r, i] of Object.entries(t)) {
133
+ let t = e?.[r], a = h.string();
134
+ for (let e of i) if (typeof e == "string") switch (e) {
135
+ case "required":
136
+ a = a.required(`The ${r} field is required`);
137
+ break;
138
+ case "email":
139
+ a = a.email("The email address is not valid");
140
+ break;
141
+ case "phone_number":
142
+ a = a.test("phone", "The phone number has incorrect format", (e) => e ? F(e) : !0);
143
+ break;
144
+ case "url":
145
+ a = a.url("The URL is not valid");
146
+ break;
147
+ case "data_uri":
148
+ a = a.test("data_uri", "The field does not have a valid file", (e) => typeof e == "string" ? e.startsWith("data:") && e.includes(",") : !1);
149
+ break;
150
+ }
151
+ else if (typeof e == "object" && e) {
152
+ let t = e;
153
+ "max" in e && t.max?.[0] && (a = a.max(Number(t.max[0]))), "min" in e && t.min?.[0] && (a = a.min(Number(t.min[0])));
154
+ }
155
+ try {
156
+ a.validateSync(t);
157
+ } catch (e) {
158
+ e instanceof h.ValidationError && n.push({
159
+ message: e.message,
160
+ name: r
161
+ });
162
+ }
163
+ }
164
+ return n.length > 0 ? {
165
+ status: !1,
166
+ errors: n
167
+ } : { status: !0 };
168
+ }, L = (e, t) => {
169
+ let n = {};
170
+ for (let t of e.sections) for (let e of t.fields) {
171
+ let t = [];
172
+ switch (e.required && t.push("required"), e.max !== void 0 && e.max !== null && t.push({ max: [e.max] }), e.min !== void 0 && e.min !== null && t.push({ min: [e.min] }), e.field_interface) {
173
+ case a.EmailWidget:
174
+ t.push("email");
175
+ break;
176
+ case a.PhoneWidget:
177
+ t.push("phone_number");
178
+ break;
179
+ case a.URLWidget:
180
+ t.push("url");
181
+ break;
182
+ default: break;
183
+ }
184
+ n[e.key] = t;
185
+ }
186
+ let { errors: r } = I(t, n), i = {};
187
+ return r && r.map((e) => {
188
+ i[e.name] = e.message;
189
+ }), i;
190
+ }, R = (e) => {
191
+ let t = {};
192
+ for (let n of e) {
193
+ if (n.kind === "collection") {
194
+ let e = n.options?.current_have_many_connected, r = n.options?.connected_have_many_current;
195
+ e && r ? t[n.key] = s.collection.m2m : t[n.key] = s.collection.m2o;
196
+ } else t[n.key] = s?.[n?.kind];
197
+ n?.field_interface === a.RecordWidget && n?.fields?.length && (t[n.key] = R(n.fields));
198
+ }
199
+ return t;
200
+ }, z = (e) => {
201
+ if (!e?.sections) return {};
202
+ let t = {};
203
+ for (let n of e.sections) n?.fields && n?.fields?.length > 0 && (t = {
204
+ ...t,
205
+ ...R(n.fields)
206
+ });
207
+ return t;
208
+ }, B = (e) => e === void 0 ? null : e, V = (e, t) => {
209
+ if (!e?.sections) return {};
210
+ let n = {};
211
+ for (let r of e.sections) {
212
+ let e = R(r.fields ?? []);
213
+ for (let i of r.fields) {
214
+ let r = B(t?.[i?.key]);
215
+ Array.isArray(r) && r?.length > 0 && Array.isArray(i?.values) && i?.values?.length > 0 && !i?.options?.custom_input && (r = r?.filter((e) => i?.values?.includes(e))), n[i.key] = r ?? B(i?.default_value) ?? e[i.key];
216
+ }
217
+ }
218
+ return n;
219
+ }, H = (e, t) => {
220
+ let n = { ...e }, r = null;
221
+ if ((n.field_interface === a.ArrayWidget && t !== a.ArrayWidget || n.field_interface === a.RecordWidget && t !== a.RecordWidget) && (n.fields = []), (t !== a.MultiDropdownWidget || t !== a.DropdownWidget || t !== a.RadioWidget || t !== a.CheckboxWidget) && n.field_interface !== a.MultiDropdownWidget && n.field_interface !== a.DropdownWidget && n.field_interface !== a.RadioWidget && n.field_interface !== a.CheckboxWidget && n.values?.length !== 0 && (n.values = []), (t === a.MultiDropdownWidget && n.field_interface !== a.MultiDropdownWidget || t === a.DropdownWidget && n.field_interface !== a.DropdownWidget || t === a.RadioWidget && n.field_interface !== a.RadioWidget || t === a.CheckboxWidget && n.field_interface !== a.CheckboxWidget) && (n.values = [""], r = `${n.id}-option-0`), [a.RecordWidget, a.ArrayWidget].includes(t) && (r = `field-${f.generate()}`, n.kind = t === a.RecordWidget ? "record" : "group", n.fields = [...n?.fields || [], {
222
+ id: r,
223
+ key: "title",
224
+ label: "Title",
225
+ helper_text: "",
226
+ kind: "string",
227
+ field_interface: a.TextWidget,
228
+ default_value: "",
229
+ options: {},
230
+ fields: [],
231
+ hidden: !1,
232
+ readonly: !1,
233
+ required: !1,
234
+ unique: !1,
235
+ min: null,
236
+ max: null,
237
+ formats: c[t] || [],
238
+ values: [],
239
+ editable: !0
240
+ }]), n.kind = l[t] || "string", !n.default_value) if (n.kind === "collection") {
241
+ let e = n.options?.current_have_many_connected, t = n.options?.connected_have_many_current;
242
+ e && t ? n.default_value = s.collection.m2m : n.default_value = s.collection.m2o;
243
+ } else n.default_value = s[n.kind] || null;
244
+ return t !== a.CollectionWidget && o.includes(t) && (n.field_interface = t), {
245
+ field: n,
246
+ fieldFocused: r
247
+ };
248
+ }, U = (e, t) => {
249
+ let n = {};
250
+ if (t) for (let r of t?.sections ?? []) for (let t of r?.fields) if (t.field_interface === "CollectionWidget") {
251
+ let r = e?.[t?.key];
252
+ r && typeof r == "object" && (Array.isArray(r) ? n[t?.key] = r?.filter((e) => e) : n[t?.key] = r._id);
253
+ } else n[t?.key] = e?.[t?.key];
254
+ return n;
255
+ }, W = (e) => e.every((e) => {
256
+ let { field_interface: t = "", key: n = "", hidden: r } = e;
257
+ return !t || !n || r;
258
+ }), G = (e, t) => {
259
+ let n = (e?.label || e?.key || "")?.replace(/_/g, " ");
260
+ if (n?.endsWith("Id") && (n = n?.replace("Id", "")), n.includes(".")) {
261
+ let [e] = n.split(".");
262
+ e && (n = e);
263
+ }
264
+ let r = (t) => {
265
+ let r = t;
266
+ return e.max !== void 0 && e.max !== null && e.max !== "" && (r = r.max(Number(e.max), `The ${n} value is too large (max ${e.max})`)), e.min !== void 0 && e.min !== null && e.min !== "" && (r = r.min(Number(e.min), `The ${n} value is too small (min ${e.min})`)), r;
267
+ }, i;
268
+ switch (e.field_interface) {
269
+ case a.NumberWidget:
270
+ i = r(h.number());
271
+ break;
272
+ case a.ArrayWidget:
273
+ i = r(h.array().typeError("The field must be an array"));
274
+ break;
275
+ case a.RecordWidget:
276
+ i = h.object();
277
+ break;
278
+ case a.EmailWidget:
279
+ i = r(h.string().email("The email address is not valid"));
280
+ break;
281
+ case a.PhoneWidget:
282
+ i = r(h.string().test("phone", "The phone number has incorrect format", (e) => {
283
+ if (e) try {
284
+ return m(e);
285
+ } catch {
286
+ return !1;
287
+ }
288
+ return !0;
289
+ }));
290
+ break;
291
+ case a.URLWidget:
292
+ i = r(h.string().matches(/^(?:https?:\/\/)?(?:[a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+(?:\.[a-zA-Z]{2,})+(?:\/[^\s?#]*)?(?:\?[^\s]*)?$/, "The URL is not valid"));
293
+ break;
294
+ case a.ImageUploadWidget:
295
+ case a.FileUploadWidget:
296
+ case a.GeocoderWidget:
297
+ i = h.object();
298
+ break;
299
+ case a.MultiImageUploadWidget:
300
+ case a.MultiFileUploadWidget:
301
+ case a.MultiGeocoderWidget:
302
+ i = h.array().of(h.object());
303
+ break;
304
+ case a.JSONWidget:
305
+ case a.DropdownWidget:
306
+ i = h.string();
307
+ break;
308
+ case a.MultiTextWidget:
309
+ case a.MultiDropdownWidget:
310
+ case a.CheckboxWidget:
311
+ i = h.array().of(h.string());
312
+ break;
313
+ case a.ToggleCheckboxWidget:
314
+ i = h.boolean();
315
+ break;
316
+ case a.CollectionWidget:
317
+ i = e.options.current_have_many_connected ? h.array() : h.object();
318
+ break;
319
+ default:
320
+ i = r(h.string());
321
+ break;
322
+ }
323
+ if (e.options?.validationsPresets && Array.isArray(e.options.validationsPresets)) {
324
+ let t = e.options.validationsPresets;
325
+ (e.field_interface === a.TextWidget || e.field_interface === a.TextareaWidget) && (t.includes("exclude_special_chars") && (i = i.matches(/^[a-zA-Z0-9\s]*$/, "Special characters are not allowed")), t.includes("exclude_numbers") && (i = i.matches(/^[^0-9]*$/, "Numbers are not allowed")));
326
+ }
327
+ return {
328
+ required: {
329
+ value: !!e?.required,
330
+ message: `The ${n} field is required`
331
+ },
332
+ validate: (n) => {
333
+ if (e?.options?.disableValidation || n === "" || n == null) return !0;
334
+ try {
335
+ return i.validateSync(n), t ? t(n) : !0;
336
+ } catch (e) {
337
+ return e instanceof h.ValidationError ? e.message : !0;
338
+ }
339
+ }
340
+ };
341
+ }, K = (e, t) => {
342
+ if (Array.isArray(e) && e.length > 0) {
343
+ let n = 0;
344
+ for (let r of e) n += 1, r?.param && t && t(r?.param, {
345
+ type: "server_error",
346
+ message: r?.message
347
+ }, { shouldFocus: n === 0 });
348
+ }
349
+ }, q = (t) => e.memo(t);
350
+ //#endregion
351
+ export { g as _, P as a, H as c, B as d, z as f, w as g, M as h, U as i, V as l, N as m, K as n, L as o, W as p, G as r, R as s, q as t, F as u };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes