@levo-so/studio 0.1.98 → 0.1.99

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 (33) hide show
  1. package/{BillingStep-C3jJkLXQ.js → BillingStep-CD-nP5Zg.js} +1 -1
  2. package/{Button-CwN6jTXH.js → Button-BN9tHQ7U.js} +1 -1
  3. package/{CollectionInput-BoNAc4sq.js → CollectionInput-57OEuaRO.js} +1 -1
  4. package/{DateTimeWidget-IRleQI-3.js → DateTimeWidget-BlOQYia2.js} +4 -4
  5. package/{EntryCard-xpo36vUc.js → EntryCard-DMxKxYzC.js} +1 -1
  6. package/{LoginCard-DG8NAN0B.js → LoginCard-Dgl3uq38.js} +1 -1
  7. package/{LoginModal-BPI5tOIZ.js → LoginModal-CVh8k24t.js} +2 -2
  8. package/{ModalManager-BaIL6HG-.js → ModalManager-D2pV7Ba2.js} +1 -1
  9. package/{PendingApprovalCard-DID1FhwF.js → PendingApprovalCard-ZIhBzT3K.js} +1 -1
  10. package/{PhoneWidget-CjhHfwuG.js → PhoneWidget-cSp-CqJl.js} +4 -4
  11. package/{Popover-DHVZdJuv.js → Popover-ieqK7ZXF.js} +1 -1
  12. package/{RichTextWidget-CgT1_zC3.js → RichTextWidget-BeUcHYmx.js} +337 -341
  13. package/Tooltip-9zds9Zoi.js +67 -0
  14. package/{VerifyButton-DFKzKYxC.js → VerifyButton-faa0wOES.js} +2 -2
  15. package/{bookingCard-Bw4tvDYh.js → bookingCard-OUT621LL.js} +3 -3
  16. package/collection.js +7 -7
  17. package/dist-IAADcuph.js +3113 -0
  18. package/{getFieldValidations-qVzuq6mv.js → getFieldValidations-j341NV59.js} +5 -2
  19. package/index.d.ts +90 -1
  20. package/index.js +1227 -1194
  21. package/{nodeAlignment-CG3qmAuQ.js → nodeAlignment-UpurkBVP.js} +37 -37
  22. package/package.json +3 -3
  23. package/studio.css +1 -1
  24. package/theme.cssm-2YTdd8Yh.js +15 -0
  25. package/{utils-F6eBcsyI.js → utils-C_ATWxPM.js} +1 -1
  26. package/widgets-BHUjv2OM.js +289 -0
  27. package/Tooltip-ByJRyayB.js +0 -78
  28. package/dist-B7TPxn7o.js +0 -3180
  29. package/theme.cssm-De_pl52g.js +0 -4
  30. package/widgets-Dvyv5_uj.js +0 -215
  31. /package/{CollectionField-DnbpB0Z5.js → CollectionField-BpRjsPIl.js} +0 -0
  32. /package/{StripePaymentModal-BcePXzmC.js → StripePaymentModal-DC-ySB_o.js} +0 -0
  33. /package/{dialog-CCWrvmHd.js → dialog-BJpM4UEG.js} +0 -0
@@ -0,0 +1,15 @@
1
+ import { assignInlineVars as e } from "@vanilla-extract/dynamic";
2
+ //#region ../../libraries/levocn/dist/theme/utils/createThemeExtension.js
3
+ var t = (e, n) => {
4
+ let r = {};
5
+ for (let i of Object.keys(n)) {
6
+ let a = n[i], o = e[i];
7
+ if (!(a === void 0 || o === void 0)) if (typeof a == "object" && a && !Array.isArray(a)) {
8
+ let e = t(o, a);
9
+ Object.assign(r, e);
10
+ } else typeof o == "string" && (r[o] = String(a));
11
+ }
12
+ return r;
13
+ }, n = (n) => (r) => r ? e(t(n, r)) : {}, r = "_1bi3v3x0";
14
+ //#endregion
15
+ export { n, r as t };
@@ -1,4 +1,4 @@
1
- import { m as e } from "./widgets-Dvyv5_uj.js";
1
+ import { m as e } from "./widgets-BHUjv2OM.js";
2
2
  //#region ../../libraries/react-collection/dist/utils.js
3
3
  var t = (t) => Object.entries(e).find(([e, n]) => Object.keys(n).includes(t))?.[0];
4
4
  //#endregion
@@ -0,0 +1,289 @@
1
+ import { n as e } from "./theme.cssm-2YTdd8Yh.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/levocn/dist/styles/theme/themeVars.cssm.js
8
+ var u = {
9
+ colors: {
10
+ background: "var(--_1i5egzy0)",
11
+ foreground: "var(--_1i5egzy1)",
12
+ text: "var(--_1i5egzy2)",
13
+ heading: "var(--_1i5egzy3)",
14
+ card: "var(--_1i5egzy4)",
15
+ cardForeground: "var(--_1i5egzy5)",
16
+ popover: "var(--_1i5egzy6)",
17
+ popoverForeground: "var(--_1i5egzy7)",
18
+ primary: "var(--_1i5egzy8)",
19
+ primaryForeground: "var(--_1i5egzy9)",
20
+ secondary: "var(--_1i5egzya)",
21
+ secondaryForeground: "var(--_1i5egzyb)",
22
+ muted: "var(--_1i5egzyc)",
23
+ mutedForeground: "var(--_1i5egzyd)",
24
+ accent: "var(--_1i5egzye)",
25
+ accentForeground: "var(--_1i5egzyf)",
26
+ destructive: "var(--_1i5egzyg)",
27
+ border: "var(--_1i5egzyh)",
28
+ input: "var(--_1i5egzyi)",
29
+ ring: "var(--_1i5egzyj)"
30
+ },
31
+ radius: "var(--_1i5egzyk)",
32
+ radiusScale: {
33
+ sm: "var(--_1i5egzyl)",
34
+ base: "var(--_1i5egzym)",
35
+ md: "var(--_1i5egzyn)",
36
+ lg: "var(--_1i5egzyo)",
37
+ xl: "var(--_1i5egzyp)",
38
+ "2xl": "var(--_1i5egzyq)",
39
+ "3xl": "var(--_1i5egzyr)",
40
+ "4xl": "var(--_1i5egzys)",
41
+ "5xl": "var(--_1i5egzyt)",
42
+ "6xl": "var(--_1i5egzyu)",
43
+ "7xl": "var(--_1i5egzyv)",
44
+ "8xl": "var(--_1i5egzyw)",
45
+ full: "var(--_1i5egzyx)"
46
+ },
47
+ baseFontSize: "var(--_1i5egzyy)",
48
+ fonts: {
49
+ body: "var(--_1i5egzyz)",
50
+ heading: "var(--_1i5egzy10)"
51
+ },
52
+ shadow: {
53
+ xs: "var(--_1i5egzy11)",
54
+ sm: "var(--_1i5egzy12)",
55
+ md: "var(--_1i5egzy13)",
56
+ lg: "var(--_1i5egzy14)",
57
+ xl: "var(--_1i5egzy15)",
58
+ inner: "var(--_1i5egzy16)"
59
+ }
60
+ }, d = {
61
+ form: {
62
+ maxWidth: "var(--_1092q7b0)",
63
+ gap: "var(--_1092q7b1)",
64
+ borderRadius: "var(--_1092q7b2)",
65
+ labelFontSize: "var(--_1092q7b3)",
66
+ helpFontSize: "var(--_1092q7b4)",
67
+ textColor: "var(--_1092q7b5)",
68
+ helperTextColor: "var(--_1092q7b6)"
69
+ },
70
+ input: {
71
+ fontSize: "var(--_1092q7b7)",
72
+ height: "var(--_1092q7b8)",
73
+ borderRadius: "var(--_1092q7b9)"
74
+ },
75
+ checkbox: { labelFontSize: "var(--_1092q7ba)" },
76
+ button: {
77
+ fontSize: "var(--_1092q7bb)",
78
+ padding: "var(--_1092q7bc)",
79
+ borderRadius: "var(--_1092q7bd)"
80
+ }
81
+ }, f = e(d), p = [
82
+ "pdf",
83
+ "xls",
84
+ "xlsx",
85
+ "doc",
86
+ "docx",
87
+ "csv"
88
+ ], m = [
89
+ "svg",
90
+ "png",
91
+ "jpg",
92
+ "jpeg",
93
+ "webp",
94
+ "gif",
95
+ "avif"
96
+ ], h = ["mpeg", "mp4"], g = [
97
+ "mp3",
98
+ "ogg",
99
+ "oga"
100
+ ], _ = {
101
+ "application/pdf": [".pdf"],
102
+ "application/msword": [".doc"],
103
+ "application/vnd.ms-excel": [".xls"],
104
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
105
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
106
+ "text/csv": [".csv"]
107
+ }, v = {
108
+ "image/jpeg": [".jpeg", ".jpg"],
109
+ "image/png": [".png"],
110
+ "image/gif": [".gif"],
111
+ "image/svg+xml": [".svg"],
112
+ "image/webp": [".webp"],
113
+ "image/avif": [".avif"]
114
+ }, y = {
115
+ "video/mp4": [".mp4"],
116
+ "video/mpeg": [".mpeg"]
117
+ }, b = {
118
+ audio: {
119
+ "audio/mpeg": [".mp3"],
120
+ "audio/ogg": [".oga"]
121
+ },
122
+ document: _,
123
+ image: v,
124
+ video: y
125
+ }, x = {
126
+ audio: g,
127
+ document: p,
128
+ image: m,
129
+ video: h
130
+ };
131
+ [
132
+ ...x.audio,
133
+ ...x.document,
134
+ ...x.image,
135
+ ...x.video
136
+ ], {
137
+ ...b.audio,
138
+ ...b.document,
139
+ ...b.image,
140
+ ...b.video
141
+ };
142
+ //#endregion
143
+ //#region ../../libraries/react-collection/dist/utils/formHelpers.js
144
+ var S = (e) => {
145
+ let t = [];
146
+ for (let n of Object.keys(e)) for (let r of e?.[n] || []) t.push({
147
+ message: r,
148
+ name: n
149
+ });
150
+ return t;
151
+ }, C = (e) => e ? c(e) : !1, w = (e, t) => {
152
+ let n = [];
153
+ for (let [r, i] of Object.entries(t)) {
154
+ let t = e?.[r], a = l.string();
155
+ for (let e of i) if (typeof e == "string") switch (e) {
156
+ case "required":
157
+ a = a.required(`The ${r} field is required`);
158
+ break;
159
+ case "email":
160
+ a = a.email("The email address is not valid");
161
+ break;
162
+ case "phone_number":
163
+ a = a.test("phone", "The phone number has incorrect format", (e) => e ? C(e) : !0);
164
+ break;
165
+ case "url":
166
+ a = a.url("The URL is not valid");
167
+ break;
168
+ case "data_uri":
169
+ a = a.test("data_uri", "The field does not have a valid file", (e) => typeof e == "string" ? e.startsWith("data:") && e.includes(",") : !1);
170
+ break;
171
+ }
172
+ else if (typeof e == "object" && e) {
173
+ let t = e;
174
+ "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])));
175
+ }
176
+ try {
177
+ a.validateSync(t);
178
+ } catch (e) {
179
+ e instanceof l.ValidationError && n.push({
180
+ message: e.message,
181
+ name: r
182
+ });
183
+ }
184
+ }
185
+ return n.length > 0 ? {
186
+ status: !1,
187
+ errors: n
188
+ } : { status: !0 };
189
+ }, T = (e, t) => {
190
+ let r = {};
191
+ for (let t of e.sections) for (let e of t.fields) {
192
+ let t = [];
193
+ 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) {
194
+ case n.EmailWidget:
195
+ t.push("email");
196
+ break;
197
+ case n.PhoneWidget:
198
+ t.push("phone_number");
199
+ break;
200
+ case n.URLWidget:
201
+ t.push("url");
202
+ break;
203
+ default: break;
204
+ }
205
+ r[e.key] = t;
206
+ }
207
+ let { errors: i } = w(t, r), a = {};
208
+ return i && i.map((e) => {
209
+ a[e.name] = e.message;
210
+ }), a;
211
+ }, E = (e) => {
212
+ let t = {};
213
+ for (let r of e) {
214
+ if (r.kind === "collection") {
215
+ let e = r.options?.current_have_many_connected, n = r.options?.connected_have_many_current;
216
+ e && n ? t[r.key] = i.collection.m2m : t[r.key] = i.collection.m2o;
217
+ } else t[r.key] = i?.[r?.kind];
218
+ r?.field_interface === n.RecordWidget && r?.fields?.length && (t[r.key] = E(r.fields));
219
+ }
220
+ return t;
221
+ }, D = (e) => {
222
+ if (!e?.sections) return {};
223
+ let t = {};
224
+ for (let n of e.sections) n?.fields && n?.fields?.length > 0 && (t = {
225
+ ...t,
226
+ ...E(n.fields)
227
+ });
228
+ return t;
229
+ }, O = (e) => e === void 0 ? null : e, k = (e, t) => {
230
+ if (!e?.sections) return {};
231
+ let n = {};
232
+ for (let r of e.sections) {
233
+ let e = E(r.fields ?? []);
234
+ for (let i of r.fields) {
235
+ let r = O(t?.[i?.key]);
236
+ 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 ?? O(i?.default_value) ?? e[i.key];
237
+ }
238
+ }
239
+ return n;
240
+ }, A = (e, t) => {
241
+ let c = { ...e }, l = null;
242
+ 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 || [], {
243
+ id: l,
244
+ key: "title",
245
+ label: "Title",
246
+ helper_text: "",
247
+ kind: "string",
248
+ field_interface: n.TextWidget,
249
+ default_value: "",
250
+ options: {},
251
+ fields: [],
252
+ hidden: !1,
253
+ readonly: !1,
254
+ required: !1,
255
+ unique: !1,
256
+ min: null,
257
+ max: null,
258
+ formats: a[t] || [],
259
+ values: [],
260
+ editable: !0
261
+ }]), c.kind = o[t] || "string", !c.default_value) if (c.kind === "collection") {
262
+ let e = c.options?.current_have_many_connected, t = c.options?.connected_have_many_current;
263
+ e && t ? c.default_value = i.collection.m2m : c.default_value = i.collection.m2o;
264
+ } else c.default_value = i[c.kind] || null;
265
+ return t !== n.CollectionWidget && r.includes(t) && (c.field_interface = t), {
266
+ field: c,
267
+ fieldFocused: l
268
+ };
269
+ }, j = (e, t) => {
270
+ let n = {};
271
+ if (t) for (let r of t?.sections ?? []) for (let t of r?.fields) if (t.field_interface === "CollectionWidget") {
272
+ let r = e?.[t?.key];
273
+ r && typeof r == "object" && (Array.isArray(r) ? n[t?.key] = r?.filter((e) => e) : n[t?.key] = r._id);
274
+ } else n[t?.key] = e?.[t?.key];
275
+ return n;
276
+ }, M = (e) => e.every((e) => {
277
+ let { field_interface: t = "", key: n = "", hidden: r } = e;
278
+ return !t || !n || r;
279
+ }), N = (e, t) => {
280
+ if (Array.isArray(e) && e.length > 0) {
281
+ let n = 0;
282
+ for (let r of e) n += 1, r?.param && t && t(r?.param, {
283
+ type: "server_error",
284
+ message: r?.message
285
+ }, { shouldFocus: n === 0 });
286
+ }
287
+ }, P = (e) => t.memo(e);
288
+ //#endregion
289
+ export { u as _, T as a, k as c, D as d, M as f, d as g, f as h, S as i, C as l, b as m, N as n, E as o, x as p, j as r, A as s, P as t, O as u };
@@ -1,78 +0,0 @@
1
- import { i as e, r as t } from "./getFieldValidations-qVzuq6mv.js";
2
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
- import { assignInlineVars as i } from "@vanilla-extract/dynamic";
4
- import { c as a } from "react/compiler-runtime";
5
- import o from "clsx";
6
- import { Tooltip as s } from "@base-ui/react/tooltip";
7
- //#region ../../libraries/levocn/dist/theme/utils/createThemeExtension.js
8
- var c = (e, t) => {
9
- let n = {};
10
- for (let r of Object.keys(t)) {
11
- let i = t[r], a = e[r];
12
- if (!(i === void 0 || a === void 0)) if (typeof i == "object" && i && !Array.isArray(i)) {
13
- let e = c(a, i);
14
- Object.assign(n, e);
15
- } else typeof a == "string" && (n[a] = String(i));
16
- }
17
- return n;
18
- }, l = (e) => (t) => t ? i(c(e, t)) : {}, u = "_3zwjqd0", d = "_3zwjqd1", f = "_3zwjqd2", p = (e) => {
19
- let t = a(6), r, i;
20
- t[0] === e ? (r = t[1], i = t[2]) : ({delay: i, ...r} = e, t[0] = e, t[1] = r, t[2] = i);
21
- let o = i === void 0 ? 0 : i, c;
22
- return t[3] !== o || t[4] !== r ? (c = /* @__PURE__ */ n(s.Provider, {
23
- "data-slot": "tooltip-provider",
24
- delay: o,
25
- ...r
26
- }), t[3] = o, t[4] = r, t[5] = c) : c = t[5], c;
27
- }, m = (e) => {
28
- let t = a(4), r;
29
- t[0] === e ? r = t[1] : ({...r} = e, t[0] = e, t[1] = r);
30
- let i;
31
- return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ n(s.Root, {
32
- "data-slot": "tooltip",
33
- ...r
34
- }), t[2] = r, t[3] = i), i;
35
- }, h = (e) => {
36
- let r = a(12), i, c, l, u;
37
- r[0] === e ? (i = r[1], c = r[2], l = r[3], u = r[4]) : ({className: i, variant: u, size: l, ...c} = e, r[0] = e, r[1] = i, r[2] = c, r[3] = l, r[4] = u);
38
- let d;
39
- r[5] !== i || r[6] !== l || r[7] !== u ? (d = o(t({
40
- variant: u,
41
- size: l
42
- }), i), r[5] = i, r[6] = l, r[7] = u, r[8] = d) : d = r[8];
43
- let f;
44
- return r[9] !== c || r[10] !== d ? (f = /* @__PURE__ */ n(s.Trigger, {
45
- className: d,
46
- ...c
47
- }), r[9] = c, r[10] = d, r[11] = f) : f = r[11], f;
48
- }, g = (t) => {
49
- let i = a(24), c, l, p, m, h, g, _;
50
- i[0] === t ? (c = i[1], l = i[2], p = i[3], m = i[4], h = i[5], g = i[6], _ = i[7]) : ({className: l, side: m, sideOffset: h, align: g, alignOffset: _, children: c, ...p} = t, i[0] = t, i[1] = c, i[2] = l, i[3] = p, i[4] = m, i[5] = h, i[6] = g, i[7] = _);
51
- let v = m === void 0 ? "top" : m, y = h === void 0 ? 8 : h, b = g === void 0 ? "center" : g, x = _ === void 0 ? 0 : _, { portalRef: S } = e(), C;
52
- i[8] === l ? C = i[9] : (C = o(u, l), i[8] = l, i[9] = C);
53
- let w;
54
- i[10] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ n(s.Arrow, { className: d }), i[10] = w) : w = i[10];
55
- let T;
56
- i[11] !== c || i[12] !== p || i[13] !== C ? (T = /* @__PURE__ */ r(s.Popup, {
57
- "data-slot": "tooltip-content",
58
- className: C,
59
- ...p,
60
- children: [c, w]
61
- }), i[11] = c, i[12] = p, i[13] = C, i[14] = T) : T = i[14];
62
- let E;
63
- i[15] !== b || i[16] !== x || i[17] !== v || i[18] !== y || i[19] !== T ? (E = /* @__PURE__ */ n(s.Positioner, {
64
- align: b,
65
- alignOffset: x,
66
- side: v,
67
- sideOffset: y,
68
- className: f,
69
- children: T
70
- }), i[15] = b, i[16] = x, i[17] = v, i[18] = y, i[19] = T, i[20] = E) : E = i[20];
71
- let D;
72
- return i[21] !== S || i[22] !== E ? (D = /* @__PURE__ */ n(s.Portal, {
73
- container: S,
74
- children: E
75
- }), i[21] = S, i[22] = E, i[23] = D) : D = i[23], D;
76
- };
77
- //#endregion
78
- export { l as a, p as i, h as n, g as r, m as t };