@levo-so/studio 0.1.105 → 0.1.107

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 (45) hide show
  1. package/{BillingStep-2cKT5Pir.js → BillingStep-CJqmdIz2.js} +1 -1
  2. package/{Button-DtPwDEN0.js → Button-DujHjtOV.js} +29 -29
  3. package/CollectionField-BPl8E9MW.js +318 -0
  4. package/CollectionFormBuilder-BvFtiZeH.js +3668 -0
  5. package/{DateTimeWidget-DPHIhkAi.js → DateTimeWidget-CbpvxQ9s.js} +3 -4
  6. package/{EntryCard-j4uZb2cE.js → EntryCard-Drnobf4s.js} +3 -3
  7. package/{LoginCard-asvOHIRg.js → LoginCard-B9HKjZEk.js} +3 -3
  8. package/{LoginForm-BdsPVHdO.js → LoginForm-DpgxFh89.js} +2 -2
  9. package/{LoginModal-CyvbEK26.js → LoginModal-CaqsScly.js} +3 -3
  10. package/{MessageCard-lrXKEsBP.js → MessageCard-DojQRKnf.js} +2 -2
  11. package/{MessageFooter-D-dCrzJH.js → MessageFooter-C4qC8cem.js} +1 -1
  12. package/{ModalManager-BcPk4sbK.js → ModalManager-CaBZKQR2.js} +1 -1
  13. package/{PendingApprovalCard-hYkupl9A.js → PendingApprovalCard-CrdOrMRu.js} +3 -3
  14. package/{PhoneWidget-BOFhs8Ra.js → PhoneWidget-BxW2gL28.js} +3 -4
  15. package/{PopupRenderer-C7OHYphU-IWM6d7gW.js → PopupRenderer-CV5HY1dP-hICGc5AG.js} +281 -280
  16. package/{RichTextWidget-18XLL8wW.js → RichTextWidget-DCzgJ9EA.js} +3 -4
  17. package/{Toolbar-Y6JtgPFn.js → Toolbar-B5UZer_x.js} +3 -3
  18. package/{VerifyButton-TNkt-SDu.js → VerifyButton-DFAg6STD.js} +1 -1
  19. package/{bookingCard-BdV2YSkq.js → bookingCard-BgApvrcj.js} +3 -3
  20. package/collection.d.ts +5 -4
  21. package/collection.js +7 -8
  22. package/dist-DZbXWctg.js +97 -0
  23. package/index.d.ts +10 -0
  24. package/index.js +1392 -1391
  25. package/{generateRadiusScale-BpcgkGtN.js → inlineCollectionTheme-WpCvMKrW.js} +19 -4
  26. package/package.json +1 -1
  27. package/studio.css +1 -1
  28. package/{utils-CZLafTgN.js → utils-CUqS5dMC.js} +1 -1
  29. package/CollectionField-xa-jed3_.js +0 -232
  30. package/dist-CsX9NP5P.js +0 -3188
  31. package/getFieldValidations-CSkSV2hW.js +0 -90
  32. package/widgets-eu5zXTf-.js +0 -230
  33. /package/{Beams-DEybrmUZ.js → Beams-DboMUgCv.js} +0 -0
  34. /package/{CollectionInput-CpNGIXJx.js → CollectionInput-DcNJT5Pg.js} +0 -0
  35. /package/{Dots-CMyy77GM.js → Dots-a8xSboDv.js} +0 -0
  36. /package/{Gradient-DBn_zXzI.js → Gradient-NacpoDCM.js} +0 -0
  37. /package/{Grid-kGCr-6by.js → Grid-BJQvxnks.js} +0 -0
  38. /package/{Popover-O1poOHk2.js → Popover-DOvRAGzc.js} +0 -0
  39. /package/{StripePaymentModal-DrLMN18M.js → StripePaymentModal-Do1xHctU.js} +0 -0
  40. /package/{Tooltip-NEMQqPyr.js → Tooltip-CJINDx93.js} +0 -0
  41. /package/{Waves-DjLcbiBu.js → Waves-DUuT_IFr.js} +0 -0
  42. /package/{authentication-hnV1BI8s.js → authentication-ClOFcry8.js} +0 -0
  43. /package/{card-5ooLmYSr.js → card-E2LKF9nT.js} +0 -0
  44. /package/{dialog-C8-iHixJ.js → dialog-DoxC50i0.js} +0 -0
  45. /package/{useLogin-B2qE8710.js → useLogin-D4A5iRey.js} +0 -0
@@ -1,90 +0,0 @@
1
- import { FieldInterfaces as e } from "@levo-so/core";
2
- import { isValidPhoneNumber as t } from "react-phone-number-input";
3
- import * as n from "yup";
4
- //#region ../../libraries/react-collection/dist/utils/getFieldValidations.js
5
- var r = (r, i) => {
6
- let a = (r?.label || r?.key || "")?.replace(/_/g, " ");
7
- if (a?.endsWith("Id") && (a = a?.replace("Id", "")), a.includes(".")) {
8
- let [e] = a.split(".");
9
- e && (a = e);
10
- }
11
- let o = (e) => {
12
- let t = e;
13
- return r.max !== void 0 && r.max !== null && r.max !== "" && (t = t.max(Number(r.max), `The ${a} value is too large (max ${r.max})`)), r.min !== void 0 && r.min !== null && r.min !== "" && (t = t.min(Number(r.min), `The ${a} value is too small (min ${r.min})`)), t;
14
- }, s;
15
- switch (r.field_interface) {
16
- case e.NumberWidget:
17
- s = o(n.number());
18
- break;
19
- case e.ArrayWidget:
20
- s = o(n.array().typeError("The field must be an array"));
21
- break;
22
- case e.RecordWidget:
23
- s = n.object();
24
- break;
25
- case e.EmailWidget:
26
- s = o(n.string().email("The email address is not valid"));
27
- break;
28
- case e.PhoneWidget:
29
- s = o(n.string().test("phone", "The phone number has incorrect format", (e) => {
30
- if (e) try {
31
- return t(e);
32
- } catch {
33
- return !1;
34
- }
35
- return !0;
36
- }));
37
- break;
38
- case e.URLWidget:
39
- s = o(n.string().matches(/^(?:https?:\/\/)?(?:[a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+(?:\.[a-zA-Z]{2,})+(?:\/[^\s?#]*)?(?:\?[^\s]*)?$/, "The URL is not valid"));
40
- break;
41
- case e.ImageUploadWidget:
42
- case e.FileUploadWidget:
43
- case e.GeocoderWidget:
44
- s = n.object();
45
- break;
46
- case e.MultiImageUploadWidget:
47
- case e.MultiFileUploadWidget:
48
- case e.MultiGeocoderWidget:
49
- s = n.array().of(n.object());
50
- break;
51
- case e.JSONWidget:
52
- case e.DropdownWidget:
53
- s = n.string();
54
- break;
55
- case e.MultiTextWidget:
56
- case e.MultiDropdownWidget:
57
- case e.CheckboxWidget:
58
- s = n.array().of(n.string());
59
- break;
60
- case e.ToggleCheckboxWidget:
61
- s = n.boolean();
62
- break;
63
- case e.CollectionWidget:
64
- s = r.options.current_have_many_connected ? n.array() : n.object();
65
- break;
66
- default:
67
- s = o(n.string());
68
- break;
69
- }
70
- if (r.options?.validationsPresets && Array.isArray(r.options.validationsPresets)) {
71
- let t = r.options.validationsPresets;
72
- (r.field_interface === e.TextWidget || r.field_interface === e.TextareaWidget) && (t.includes("exclude_special_chars") && (s = s.matches(/^[a-zA-Z0-9\s]*$/, "Special characters are not allowed")), t.includes("exclude_numbers") && (s = s.matches(/^[^0-9]*$/, "Numbers are not allowed")));
73
- }
74
- return {
75
- required: {
76
- value: !!r?.required,
77
- message: `The ${a} field is required`
78
- },
79
- validate: (e) => {
80
- if (r?.options?.disableValidation || e === "" || e == null) return !0;
81
- try {
82
- return s.validateSync(e), i ? i(e) : !0;
83
- } catch (e) {
84
- return e instanceof n.ValidationError ? e.message : !0;
85
- }
86
- }
87
- };
88
- };
89
- //#endregion
90
- export { r as t };
@@ -1,230 +0,0 @@
1
- import { n as e } from "./theme.cssm-BXDp-ojp.js";
2
- import t from "react";
3
- import { FieldInterfaces as n, FieldInterfacesList as r, defaultByKinds as i, formatsByInterface as a, interfaceKinds as o } from "@levo-so/core";
4
- import { Snowflake as s } from "@theinternetfolks/snowflake";
5
- import { isPossiblePhoneNumber as c } from "react-phone-number-input";
6
- import * as l from "yup";
7
- //#region ../../libraries/react-collection/dist/theme/collectionThemeVars.cssm.js
8
- var u = {
9
- form: {
10
- maxWidth: "var(--_1092q7b0)",
11
- gap: "var(--_1092q7b1)",
12
- borderRadius: "var(--_1092q7b2)",
13
- labelFontSize: "var(--_1092q7b3)",
14
- helpFontSize: "var(--_1092q7b4)"
15
- },
16
- input: {
17
- fontSize: "var(--_1092q7b5)",
18
- height: "var(--_1092q7b6)",
19
- borderRadius: "var(--_1092q7b7)"
20
- },
21
- checkbox: { labelFontSize: "var(--_1092q7b8)" }
22
- }, d = e(u), f = [
23
- "pdf",
24
- "xls",
25
- "xlsx",
26
- "doc",
27
- "docx",
28
- "csv"
29
- ], p = [
30
- "svg",
31
- "png",
32
- "jpg",
33
- "jpeg",
34
- "webp",
35
- "gif",
36
- "avif"
37
- ], m = ["mpeg", "mp4"], h = [
38
- "mp3",
39
- "ogg",
40
- "oga"
41
- ], g = {
42
- audio: {
43
- "audio/mpeg": [".mp3"],
44
- "audio/ogg": [".oga"]
45
- },
46
- document: {
47
- "application/pdf": [".pdf"],
48
- "application/msword": [".doc"],
49
- "application/vnd.ms-excel": [".xls"],
50
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
51
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
52
- "text/csv": [".csv"]
53
- },
54
- image: {
55
- "image/jpeg": [".jpeg", ".jpg"],
56
- "image/png": [".png"],
57
- "image/gif": [".gif"],
58
- "image/svg+xml": [".svg"],
59
- "image/webp": [".webp"],
60
- "image/avif": [".avif"]
61
- },
62
- video: {
63
- "video/mp4": [".mp4"],
64
- "video/mpeg": [".mpeg"]
65
- }
66
- }, _ = {
67
- audio: h,
68
- document: f,
69
- image: p,
70
- video: m
71
- };
72
- [
73
- ..._.audio,
74
- ..._.document,
75
- ..._.image,
76
- ..._.video
77
- ], {
78
- ...g.audio,
79
- ...g.document,
80
- ...g.image,
81
- ...g.video
82
- };
83
- //#endregion
84
- //#region ../../libraries/react-collection/dist/utils/formHelpers.js
85
- var v = (e) => {
86
- let t = [];
87
- for (let n of Object.keys(e)) for (let r of e?.[n] || []) t.push({
88
- message: r,
89
- name: n
90
- });
91
- return t;
92
- }, y = (e) => e ? c(e) : !1, b = (e, t) => {
93
- let n = [];
94
- for (let [r, i] of Object.entries(t)) {
95
- let t = e?.[r], a = l.string();
96
- for (let e of i) if (typeof e == "string") switch (e) {
97
- case "required":
98
- a = a.required(`The ${r} field is required`);
99
- break;
100
- case "email":
101
- a = a.email("The email address is not valid");
102
- break;
103
- case "phone_number":
104
- a = a.test("phone", "The phone number has incorrect format", (e) => e ? y(e) : !0);
105
- break;
106
- case "url":
107
- a = a.url("The URL is not valid");
108
- break;
109
- case "data_uri":
110
- a = a.test("data_uri", "The field does not have a valid file", (e) => typeof e == "string" ? e.startsWith("data:") && e.includes(",") : !1);
111
- break;
112
- }
113
- else if (typeof e == "object" && e) {
114
- let t = e;
115
- "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])));
116
- }
117
- try {
118
- a.validateSync(t);
119
- } catch (e) {
120
- e instanceof l.ValidationError && n.push({
121
- message: e.message,
122
- name: r
123
- });
124
- }
125
- }
126
- return n.length > 0 ? {
127
- status: !1,
128
- errors: n
129
- } : { status: !0 };
130
- }, x = (e, t) => {
131
- let r = {};
132
- for (let t of e.sections) for (let e of t.fields) {
133
- let t = [];
134
- 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) {
135
- case n.EmailWidget:
136
- t.push("email");
137
- break;
138
- case n.PhoneWidget:
139
- t.push("phone_number");
140
- break;
141
- case n.URLWidget:
142
- t.push("url");
143
- break;
144
- default: break;
145
- }
146
- r[e.key] = t;
147
- }
148
- let { errors: i } = b(t, r), a = {};
149
- return i && i.map((e) => {
150
- a[e.name] = e.message;
151
- }), a;
152
- }, S = (e) => {
153
- let t = {};
154
- for (let r of e) {
155
- if (r.kind === "collection") {
156
- let e = r.options?.current_have_many_connected, n = r.options?.connected_have_many_current;
157
- e && n ? t[r.key] = i.collection.m2m : t[r.key] = i.collection.m2o;
158
- } else t[r.key] = i?.[r?.kind];
159
- r?.field_interface === n.RecordWidget && r?.fields?.length && (t[r.key] = S(r.fields));
160
- }
161
- return t;
162
- }, C = (e) => {
163
- if (!e?.sections) return {};
164
- let t = {};
165
- for (let n of e.sections) n?.fields && n?.fields?.length > 0 && (t = {
166
- ...t,
167
- ...S(n.fields)
168
- });
169
- return t;
170
- }, w = (e) => e === void 0 ? null : e, T = (e, t) => {
171
- if (!e?.sections) return {};
172
- let n = {};
173
- for (let r of e.sections) {
174
- let e = S(r.fields ?? []);
175
- for (let i of r.fields) {
176
- let r = w(t?.[i?.key]);
177
- 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 ?? w(i?.default_value) ?? e[i.key];
178
- }
179
- }
180
- return n;
181
- }, E = (e, t) => {
182
- let c = { ...e }, l = null;
183
- if ((c.field_interface === n.ArrayWidget && t !== n.ArrayWidget || c.field_interface === n.RecordWidget && t !== n.RecordWidget) && (c.fields = []), (t !== n.MultiDropdownWidget || t !== n.DropdownWidget || t !== n.RadioWidget || t !== n.CheckboxWidget) && c.field_interface !== n.MultiDropdownWidget && c.field_interface !== n.DropdownWidget && c.field_interface !== n.RadioWidget && c.field_interface !== n.CheckboxWidget && c.values?.length !== 0 && (c.values = []), (t === n.MultiDropdownWidget && c.field_interface !== n.MultiDropdownWidget || t === n.DropdownWidget && c.field_interface !== n.DropdownWidget || t === n.RadioWidget && c.field_interface !== n.RadioWidget || t === n.CheckboxWidget && c.field_interface !== n.CheckboxWidget) && (c.values = [""], l = `${c.id}-option-0`), [n.RecordWidget, n.ArrayWidget].includes(t) && (l = `field-${s.generate()}`, c.kind = t === n.RecordWidget ? "record" : "group", c.fields = [...c?.fields || [], {
184
- id: l,
185
- key: "title",
186
- label: "Title",
187
- helper_text: "",
188
- kind: "string",
189
- field_interface: n.TextWidget,
190
- default_value: "",
191
- options: {},
192
- fields: [],
193
- hidden: !1,
194
- readonly: !1,
195
- required: !1,
196
- unique: !1,
197
- min: null,
198
- max: null,
199
- formats: a[t] || [],
200
- values: [],
201
- editable: !0
202
- }]), c.kind = o[t] || "string", !c.default_value) if (c.kind === "collection") {
203
- let e = c.options?.current_have_many_connected, t = c.options?.connected_have_many_current;
204
- e && t ? c.default_value = i.collection.m2m : c.default_value = i.collection.m2o;
205
- } else c.default_value = i[c.kind] || null;
206
- return t !== n.CollectionWidget && r.includes(t) && (c.field_interface = t), {
207
- field: c,
208
- fieldFocused: l
209
- };
210
- }, D = (e, t) => {
211
- let n = {};
212
- if (t) for (let r of t?.sections ?? []) for (let t of r?.fields) if (t.field_interface === "CollectionWidget") {
213
- let r = e?.[t?.key];
214
- r && typeof r == "object" && (Array.isArray(r) ? n[t?.key] = r?.filter((e) => e) : n[t?.key] = r._id);
215
- } else n[t?.key] = e?.[t?.key];
216
- return n;
217
- }, O = (e) => e.every((e) => {
218
- let { field_interface: t = "", key: n = "", hidden: r } = e;
219
- return !t || !n || r;
220
- }), k = (e, t) => {
221
- if (Array.isArray(e) && e.length > 0) {
222
- let n = 0;
223
- for (let r of e) n += 1, r?.param && t && t(r?.param, {
224
- type: "server_error",
225
- message: r?.message
226
- }, { shouldFocus: n === 0 });
227
- }
228
- }, A = (e) => t.memo(e);
229
- //#endregion
230
- export { x as a, T as c, C as d, O as f, u as g, d as h, v as i, y as l, g as m, k as n, S as o, _ as p, D as r, E as s, A as t, w as u };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes