@levo-so/studio 0.1.94 → 0.1.96

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 (41) hide show
  1. package/{BillingStep-o2yIMjLk.js → BillingStep-C3jJkLXQ.js} +1 -1
  2. package/{Button-_hpg7Rxx.js → Button-CwN6jTXH.js} +17 -12
  3. package/CollectionField-DnbpB0Z5.js +254 -0
  4. package/CollectionInput-BoNAc4sq.js +132 -0
  5. package/DateTimeWidget-IRleQI-3.js +255 -0
  6. package/{EntryCard-B-feJvrB.js → EntryCard-CZIUBwtE.js} +3 -3
  7. package/{LoginCard-CF9JbU-y.js → LoginCard-Bthy9dcf.js} +3 -3
  8. package/{LoginForm-CdpNCQJa.js → LoginForm-CPMtCyMF.js} +4 -0
  9. package/{LoginModal-ngTHCyli.js → LoginModal-BPI5tOIZ.js} +3 -3
  10. package/{MessageCard-D2uja800.js → MessageCard-BYxgc9dl.js} +2 -2
  11. package/{ModalManager-B7pCzvK1.js → ModalManager-BaIL6HG-.js} +1 -1
  12. package/{PendingApprovalCard-Dut-Xiw1.js → PendingApprovalCard-DEnawzxD.js} +3 -3
  13. package/PhoneWidget-CjhHfwuG.js +100 -0
  14. package/Popover-DHVZdJuv.js +56 -0
  15. package/RichTextWidget-CgT1_zC3.js +1135 -0
  16. package/Tooltip-ByJRyayB.js +78 -0
  17. package/VerifyButton-DFKzKYxC.js +283 -0
  18. package/{bookingCard-CGV9svhn.js → bookingCard-Bw4tvDYh.js} +3 -3
  19. package/collection.d.ts +81 -46
  20. package/collection.js +8 -5
  21. package/dist-D_jY4Tf1.js +3168 -0
  22. package/getFieldValidations-qVzuq6mv.js +195 -0
  23. package/index.d.ts +23 -5
  24. package/index.js +1634 -1420
  25. package/nodeAlignment-CG3qmAuQ.js +180 -0
  26. package/package.json +3 -4
  27. package/studio.css +1 -1
  28. package/theme.cssm-De_pl52g.js +4 -0
  29. package/{utils-KqbqLlMF.js → utils-F6eBcsyI.js} +1 -1
  30. package/widgets-Dvyv5_uj.js +215 -0
  31. package/dist-DDKHTnIW.js +0 -3653
  32. package/widgets-B84lq4lO.js +0 -351
  33. /package/{Beams-CCNNOvfW.js → Beams-Blr-zwvz.js} +0 -0
  34. /package/{Dots-89WGkd-z.js → Dots-DeBKuibU.js} +0 -0
  35. /package/{Gradient-vTa_uWCj.js → Gradient-DGFxOjft.js} +0 -0
  36. /package/{Grid-CrtztrxK.js → Grid-A7HRCQ0T.js} +0 -0
  37. /package/{MessageFooter-Bu-jyPkJ.js → MessageFooter-C6DivT4m.js} +0 -0
  38. /package/{StripePaymentModal-CajqohNM.js → StripePaymentModal-BcePXzmC.js} +0 -0
  39. /package/{Waves-BhA6CLEI.js → Waves-CIT6Ngng.js} +0 -0
  40. /package/{card-DCbhJCO9.js → card-izMd2DvE.js} +0 -0
  41. /package/{dialog-CILIXExr.js → dialog-CCWrvmHd.js} +0 -0
@@ -1,351 +0,0 @@
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