@levo-so/react 0.1.12 → 0.1.13
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.
- package/dist/{CheckboxWidget-BLxjrwGY.js → CheckboxWidget-BctVOZiO.js} +1 -1
- package/dist/{CollectionFormBuilder-dqQC2Vnj.js → CollectionFormBuilder-B6CAVKhg.js} +123 -98
- package/dist/{CurrencyWidget-CAMx9DJF.js → CurrencyWidget-COoMkfsA.js} +1 -1
- package/dist/{DateTimeWidget-DaLajxcA.js → DateTimeWidget-DcbQ3smI.js} +1 -1
- package/dist/{DefaultFormVariant-CpnU1wDu.js → DefaultFormVariant-C6zbKgwB.js} +2 -2
- package/dist/{DropdownWidget-6qBfLQ2N.js → DropdownWidget-DszCTSWr.js} +1 -1
- package/dist/{EmailWidget-p5rZwhuj.js → EmailWidget-CG9oNUM5.js} +1 -1
- package/dist/{GeocoderWidget-BbKp8xEY.js → GeocoderWidget-CXu17A7y.js} +1 -1
- package/dist/{MultiGeocoderWidget-BNHx170i.js → MultiGeocoderWidget-D3Xmv8g4.js} +2 -2
- package/dist/MultiTextWidget-CyQRcWC8.js +33 -0
- package/dist/{PhoneWidget-BWzgF1A0.js → PhoneWidget-C1Jt7kXL.js} +1 -1
- package/dist/{RadioWidget-DiHb1y_Q.js → RadioWidget-BrLNF-I2.js} +1 -1
- package/dist/{RichTextWidget-D7o_yfwT.js → RichTextWidget-BogYcPtS.js} +1 -1
- package/dist/{StepsFormVariant-DGmREjGv.js → StepsFormVariant-Bx-jdciC.js} +2 -2
- package/dist/{SwitchWidget-CKHM9_1n.js → SwitchWidget-BT0-waP9.js} +1 -1
- package/dist/{TextWidget-DU_YaDEV.js → TextWidget-Bvsz-hey.js} +1 -1
- package/dist/{TextareaWidget-znTolctc.js → TextareaWidget-8SLym--T.js} +1 -1
- package/dist/{ToggleCheckboxWidget-CcNooLk3.js → ToggleCheckboxWidget-VrCQBF5C.js} +1 -1
- package/dist/{URLWidget-BRXXKqlE.js → URLWidget-B99nKr6N.js} +2 -2
- package/dist/{UploadWidget-Dr8-x83l.js → UploadWidget-ZebPWZZZ.js} +1 -1
- package/dist/audience/components/page.d.ts.map +1 -1
- package/dist/audience/index.js +1 -1
- package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
- package/dist/collection/components/widgets/multiTextWidget/MultiTextWidget.d.ts +7 -0
- package/dist/collection/components/widgets/multiTextWidget/MultiTextWidget.d.ts.map +1 -0
- package/dist/collection/index.js +1 -1
- package/dist/collection/utils/formHelpers.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +2 -2
- package/dist/{page-D6IRG1XF.js → page-BLCSp9NV.js} +65 -63
- package/dist/{useLevoForm-D8moCDuJ.js → useLevoForm-DjvUas25.js} +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ import { j as t } from "./jsx-runtime-B6kdoens.js";
|
|
|
3
3
|
import B, { useState as k } from "react";
|
|
4
4
|
import { useController as C } from "react-hook-form";
|
|
5
5
|
import { c as E } from "./cn-C9QoOYNG.js";
|
|
6
|
-
import { h as I, j as O, k as u } from "./CollectionFormBuilder-
|
|
6
|
+
import { h as I, j as O, k as u } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
7
7
|
import { C as w } from "./Checbox-sq-atGlJ.js";
|
|
8
8
|
import { I as _ } from "./Input-2CvZ90f8.js";
|
|
9
9
|
const T = ({ field: i }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as s } from "./jsx-runtime-B6kdoens.js";
|
|
3
3
|
import { FieldInterfaces as a, defaultByKinds as F, formatsByInterface as se, interfaceKinds as oe, FieldInterfacesList as ae } from "@levo-so/core";
|
|
4
|
-
import
|
|
4
|
+
import b, { useState as T, lazy as h, Suspense as ie, useEffect as le } from "react";
|
|
5
5
|
import { useFieldArray as ce, useController as ue } from "react-hook-form";
|
|
6
6
|
import { G as O, T as de, a as ge, c as me, B as v, d as he, r as pe, s as xe, S as ye } from "./Spinner-DzGH5rKe.js";
|
|
7
7
|
import { Mate as $ } from "@theinternetfolks/mate";
|
|
@@ -11,8 +11,8 @@ import We from "google-libphonenumber";
|
|
|
11
11
|
import P from "validator";
|
|
12
12
|
import w from "validatorjs";
|
|
13
13
|
import { c as f } from "./cn-C9QoOYNG.js";
|
|
14
|
-
import * as
|
|
15
|
-
import { useInView as
|
|
14
|
+
import * as je from "inflection";
|
|
15
|
+
import { useInView as be } from "react-intersection-observer";
|
|
16
16
|
const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
17
17
|
const r = [];
|
|
18
18
|
for (const t of Object.keys(e))
|
|
@@ -52,7 +52,7 @@ const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
|
52
52
|
status: !1,
|
|
53
53
|
errors: ve(t.errors.all())
|
|
54
54
|
};
|
|
55
|
-
},
|
|
55
|
+
}, mt = (e, r) => {
|
|
56
56
|
const t = {};
|
|
57
57
|
for (const o of e.sections)
|
|
58
58
|
for (const c of o.fields) {
|
|
@@ -84,7 +84,7 @@ const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
|
84
84
|
for (const i of e)
|
|
85
85
|
r[i.key] = (t = F) == null ? void 0 : t[i == null ? void 0 : i.kind], (i == null ? void 0 : i.field_interface) === a.RecordWidget && ((n = i == null ? void 0 : i.fields) != null && n.length) && (r[i.key] = C(i.fields));
|
|
86
86
|
return r;
|
|
87
|
-
},
|
|
87
|
+
}, ht = (e) => {
|
|
88
88
|
var t;
|
|
89
89
|
if (!(e != null && e.sections)) return {};
|
|
90
90
|
let r = {};
|
|
@@ -94,7 +94,7 @@ const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
|
94
94
|
...C(n.fields)
|
|
95
95
|
});
|
|
96
96
|
return r;
|
|
97
|
-
}, B = (e) => typeof e < "u" ? e : null,
|
|
97
|
+
}, B = (e) => typeof e < "u" ? e : null, pt = (e, r) => {
|
|
98
98
|
var n;
|
|
99
99
|
if (!(e != null && e.sections)) return {};
|
|
100
100
|
const t = {};
|
|
@@ -109,7 +109,7 @@ const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
return t;
|
|
112
|
-
},
|
|
112
|
+
}, xt = (e, r) => {
|
|
113
113
|
var i;
|
|
114
114
|
const t = { ...e };
|
|
115
115
|
let n = null;
|
|
@@ -138,7 +138,7 @@ const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
|
138
138
|
editable: !0
|
|
139
139
|
}
|
|
140
140
|
]), t.kind = oe[r] || "string", t.default_value || (t.default_value = F[t.kind] || null), r !== a.CollectionWidget && ae.includes(r) && (t.field_interface = r), { field: t, fieldFocused: n };
|
|
141
|
-
},
|
|
141
|
+
}, yt = (e, r) => {
|
|
142
142
|
var d;
|
|
143
143
|
const t = { ...e }, n = [], i = "_id";
|
|
144
144
|
if (r)
|
|
@@ -150,7 +150,7 @@ const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
|
150
150
|
(c) => c[i]
|
|
151
151
|
) : t[o] = t[o][i]);
|
|
152
152
|
return t;
|
|
153
|
-
},
|
|
153
|
+
}, ft = (e, r) => {
|
|
154
154
|
if (Array.isArray(e) && e.length > 0) {
|
|
155
155
|
let t = 0;
|
|
156
156
|
for (const n of e)
|
|
@@ -166,7 +166,7 @@ const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
|
-
function
|
|
169
|
+
function Wt(e) {
|
|
170
170
|
return O({ tag: "svg", attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M9.243 3.03a1 1 0 01.727 1.213L9.53 6h2.94l.56-2.243a1 1 0 111.94.486L14.53 6H17a1 1 0 110 2h-2.97l-1 4H15a1 1 0 110 2h-2.47l-.56 2.242a1 1 0 11-1.94-.485L10.47 14H7.53l-.56 2.242a1 1 0 11-1.94-.485L5.47 14H3a1 1 0 110-2h2.97l1-4H5a1 1 0 110-2h2.47l.56-2.243a1 1 0 011.213-.727zM9.03 8l-1 4h2.938l1-4H9.031z", clipRule: "evenodd" }, child: [] }] })(e);
|
|
171
171
|
}
|
|
172
172
|
function E(e) {
|
|
@@ -196,7 +196,7 @@ const A = ({
|
|
|
196
196
|
field: e,
|
|
197
197
|
isInternal: r
|
|
198
198
|
}) => {
|
|
199
|
-
const { key: t = "", label: n = "", field_interface: i = "", fields: d = [] } = e, [o, c] =
|
|
199
|
+
const { key: t = "", label: n = "", field_interface: i = "", fields: d = [] } = e, [o, c] = T("0"), { fields: u, ...g } = ce({
|
|
200
200
|
name: t
|
|
201
201
|
});
|
|
202
202
|
return !i || !t ? null : /* @__PURE__ */ s.jsxs("div", { className: "w-full max-w-full", children: [
|
|
@@ -235,14 +235,14 @@ const A = ({
|
|
|
235
235
|
value: l.toString(),
|
|
236
236
|
children: [
|
|
237
237
|
/* @__PURE__ */ s.jsx("div", { className: "flex flex-col px-3 py-2 gap-3", children: d.map((p) => {
|
|
238
|
-
const
|
|
238
|
+
const j = {
|
|
239
239
|
...p,
|
|
240
240
|
key: `${t}.${l}.${p == null ? void 0 : p.key}`
|
|
241
241
|
};
|
|
242
242
|
return /* @__PURE__ */ s.jsx(
|
|
243
243
|
J,
|
|
244
244
|
{
|
|
245
|
-
field:
|
|
245
|
+
field: j,
|
|
246
246
|
isInternal: r
|
|
247
247
|
},
|
|
248
248
|
`common-fields-${p == null ? void 0 : p.id}`
|
|
@@ -304,7 +304,7 @@ const A = ({
|
|
|
304
304
|
}
|
|
305
305
|
)
|
|
306
306
|
] });
|
|
307
|
-
},
|
|
307
|
+
}, Re = (e) => {
|
|
308
308
|
const r = e == null ? void 0 : e.key;
|
|
309
309
|
let t = r == null ? void 0 : r.replace(/_/g, " ");
|
|
310
310
|
if (t != null && t.endsWith("Id") && (t = t == null ? void 0 : t.replace("Id", "")), t.includes(".")) {
|
|
@@ -347,12 +347,12 @@ const A = ({
|
|
|
347
347
|
return o && (o == null ? void 0 : o.length) > 0 ? (u = o == null ? void 0 : o[0]) == null ? void 0 : u.message : !0;
|
|
348
348
|
}
|
|
349
349
|
};
|
|
350
|
-
},
|
|
350
|
+
}, _e = b.lazy(
|
|
351
351
|
() => import("react-select-async-paginate").then((e) => ({
|
|
352
352
|
default: e.AsyncPaginate
|
|
353
353
|
}))
|
|
354
|
-
),
|
|
355
|
-
|
|
354
|
+
), Te = (e) => /* @__PURE__ */ s.jsx(
|
|
355
|
+
_e,
|
|
356
356
|
{
|
|
357
357
|
isClearable: !0,
|
|
358
358
|
menuPlacement: "auto",
|
|
@@ -390,11 +390,11 @@ const A = ({
|
|
|
390
390
|
},
|
|
391
391
|
...e
|
|
392
392
|
}
|
|
393
|
-
),
|
|
393
|
+
), Le = ({
|
|
394
394
|
children: e
|
|
395
|
-
}) => /* @__PURE__ */ s.jsx("p", { className: "text-xs font-normal text-red-400 text-wrap", children: e }),
|
|
395
|
+
}) => /* @__PURE__ */ s.jsx("p", { className: "text-xs font-normal text-red-400 text-wrap", children: e }), Ne = ({
|
|
396
396
|
children: e
|
|
397
|
-
}) => /* @__PURE__ */ s.jsx("p", { className: f("text-xs font-normal text-gray-600"), children: e }), Ae =
|
|
397
|
+
}) => /* @__PURE__ */ s.jsx("p", { className: f("text-xs font-normal text-gray-600"), children: e }), Ae = b.forwardRef(({ error: e, helperText: r, containerStyles: t, readOnly: n, children: i }, d) => /* @__PURE__ */ s.jsx(
|
|
398
398
|
"div",
|
|
399
399
|
{
|
|
400
400
|
className: f(
|
|
@@ -405,30 +405,30 @@ const A = ({
|
|
|
405
405
|
ref: d,
|
|
406
406
|
children: /* @__PURE__ */ s.jsxs("div", { className: f("w-full shrink-0", "sm:flex-1"), children: [
|
|
407
407
|
i,
|
|
408
|
-
e && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(
|
|
409
|
-
r && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(
|
|
408
|
+
e && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(Le, { children: e }) }),
|
|
409
|
+
r && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(Ne, { children: r }) })
|
|
410
410
|
] })
|
|
411
411
|
}
|
|
412
412
|
)), Ie = ({
|
|
413
413
|
field: e
|
|
414
414
|
}) => {
|
|
415
415
|
var I, M, D;
|
|
416
|
-
const { collection: r } = G(), [t, n] =
|
|
417
|
-
field: { value: l, onBlur: p, onChange:
|
|
418
|
-
fieldState:
|
|
416
|
+
const { collection: r } = G(), [t, n] = T(!1), { key: i = "", label: d = "", helper_text: o = "", readonly: c = !1 } = e, u = i, g = ((I = e == null ? void 0 : e.options) == null ? void 0 : I.collection_key) || "", x = ((M = e == null ? void 0 : e.options) == null ? void 0 : M.label_field_key) || "", {
|
|
417
|
+
field: { value: l, onBlur: p, onChange: j, ref: W, disabled: X, ...Y },
|
|
418
|
+
fieldState: L
|
|
419
419
|
} = ue({
|
|
420
420
|
name: u,
|
|
421
|
-
rules:
|
|
422
|
-
}), Z = !!(e != null && e.required), ee = (D =
|
|
421
|
+
rules: Re(e)
|
|
422
|
+
}), Z = !!(e != null && e.required), ee = (D = L == null ? void 0 : L.error) == null ? void 0 : D.message, te = async (y, Ye, { page: N = 1 }) => {
|
|
423
423
|
var S;
|
|
424
424
|
n(!0);
|
|
425
425
|
try {
|
|
426
|
-
const
|
|
426
|
+
const R = await (r == null ? void 0 : r.getCollectionContentList({
|
|
427
427
|
collection_key: g,
|
|
428
|
-
page:
|
|
428
|
+
page: N,
|
|
429
429
|
search: y,
|
|
430
430
|
limit: 10
|
|
431
|
-
})), k = (S =
|
|
431
|
+
})), k = (S = R == null ? void 0 : R.content) == null ? void 0 : S.data, V = (k || []).map((m) => {
|
|
432
432
|
const ne = m != null && m[x] ? m == null ? void 0 : m[x] : $.toTitle((m == null ? void 0 : m.slug) || "");
|
|
433
433
|
return {
|
|
434
434
|
value: {
|
|
@@ -443,7 +443,7 @@ const A = ({
|
|
|
443
443
|
options: Array.isArray(V) ? V : [],
|
|
444
444
|
hasMore: k && !((k == null ? void 0 : k.length) < 10),
|
|
445
445
|
additional: {
|
|
446
|
-
page:
|
|
446
|
+
page: N + 1
|
|
447
447
|
}
|
|
448
448
|
};
|
|
449
449
|
} catch {
|
|
@@ -451,7 +451,7 @@ const A = ({
|
|
|
451
451
|
options: [],
|
|
452
452
|
hasMore: !1,
|
|
453
453
|
additional: {
|
|
454
|
-
page:
|
|
454
|
+
page: N
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
457
|
} finally {
|
|
@@ -475,12 +475,12 @@ const A = ({
|
|
|
475
475
|
children: [
|
|
476
476
|
d && /* @__PURE__ */ s.jsx(A, { htmlFor: u, isRequired: Z, children: d }),
|
|
477
477
|
/* @__PURE__ */ s.jsx(
|
|
478
|
-
|
|
478
|
+
Te,
|
|
479
479
|
{
|
|
480
480
|
id: u,
|
|
481
481
|
value: re,
|
|
482
482
|
onChange: (y) => {
|
|
483
|
-
|
|
483
|
+
j((y == null ? void 0 : y.value) || null);
|
|
484
484
|
},
|
|
485
485
|
onBlur: () => {
|
|
486
486
|
p();
|
|
@@ -502,29 +502,31 @@ const A = ({
|
|
|
502
502
|
]
|
|
503
503
|
}
|
|
504
504
|
);
|
|
505
|
-
},
|
|
506
|
-
() => import("./
|
|
507
|
-
), De = h(
|
|
508
|
-
() => import("./
|
|
505
|
+
}, Me = h(
|
|
506
|
+
() => import("./MultiTextWidget-CyQRcWC8.js")
|
|
507
|
+
), H = h(() => import("./TextWidget-Bvsz-hey.js")), De = h(
|
|
508
|
+
() => import("./CurrencyWidget-COoMkfsA.js")
|
|
509
|
+
), Se = h(
|
|
510
|
+
() => import("./CheckboxWidget-BctVOZiO.js")
|
|
509
511
|
), U = h(
|
|
510
|
-
() => import("./DateTimeWidget-
|
|
512
|
+
() => import("./DateTimeWidget-DcbQ3smI.js")
|
|
511
513
|
), q = h(
|
|
512
|
-
() => import("./DropdownWidget-
|
|
513
|
-
),
|
|
514
|
-
() => import("./GeocoderWidget-
|
|
515
|
-
),
|
|
516
|
-
() => import("./MultiGeocoderWidget-
|
|
517
|
-
),
|
|
518
|
-
() => import("./RichTextWidget-
|
|
519
|
-
),
|
|
520
|
-
() => import("./TextareaWidget-
|
|
521
|
-
),
|
|
522
|
-
() => import("./ToggleCheckboxWidget-
|
|
523
|
-
),
|
|
514
|
+
() => import("./DropdownWidget-DszCTSWr.js")
|
|
515
|
+
), Ve = h(() => import("./EmailWidget-CG9oNUM5.js")), $e = h(
|
|
516
|
+
() => import("./GeocoderWidget-CXu17A7y.js")
|
|
517
|
+
), Pe = h(
|
|
518
|
+
() => import("./MultiGeocoderWidget-D3Xmv8g4.js")
|
|
519
|
+
), ze = h(() => import("./PhoneWidget-C1Jt7kXL.js")), Be = h(() => import("./RadioWidget-BrLNF-I2.js")), Ee = h(
|
|
520
|
+
() => import("./RichTextWidget-BogYcPtS.js")
|
|
521
|
+
), He = h(() => import("./SwitchWidget-BT0-waP9.js")), Ue = h(
|
|
522
|
+
() => import("./TextareaWidget-8SLym--T.js")
|
|
523
|
+
), qe = h(
|
|
524
|
+
() => import("./ToggleCheckboxWidget-VrCQBF5C.js")
|
|
525
|
+
), Fe = h(() => import("./URLWidget-B99nKr6N.js")), _ = h(() => import("./UploadWidget-ZebPWZZZ.js")), Oe = ({
|
|
524
526
|
field: e,
|
|
525
527
|
isInternal: r
|
|
526
528
|
}) => {
|
|
527
|
-
var i, d, o
|
|
529
|
+
var i, d, o;
|
|
528
530
|
const { field_interface: t, key: n } = e;
|
|
529
531
|
if (!t || !n)
|
|
530
532
|
return null;
|
|
@@ -534,9 +536,9 @@ const A = ({
|
|
|
534
536
|
case a.NumberWidget:
|
|
535
537
|
return /* @__PURE__ */ s.jsx(H, { type: "number", field: e });
|
|
536
538
|
case a.CurrencyWidget:
|
|
537
|
-
return /* @__PURE__ */ s.jsx(Me, { field: e });
|
|
538
|
-
case a.CheckboxWidget:
|
|
539
539
|
return /* @__PURE__ */ s.jsx(De, { field: e });
|
|
540
|
+
case a.CheckboxWidget:
|
|
541
|
+
return /* @__PURE__ */ s.jsx(Se, { field: e });
|
|
540
542
|
case a.DateTimeWidget:
|
|
541
543
|
return /* @__PURE__ */ s.jsx(U, { field: e });
|
|
542
544
|
case a.DateWidget:
|
|
@@ -545,29 +547,31 @@ const A = ({
|
|
|
545
547
|
return /* @__PURE__ */ s.jsx(q, { field: e, isMulti: !1 });
|
|
546
548
|
case a.MultiDropdownWidget:
|
|
547
549
|
return /* @__PURE__ */ s.jsx(q, { field: e, isMulti: !0 });
|
|
550
|
+
case a.MultiTextWidget:
|
|
551
|
+
return /* @__PURE__ */ s.jsx(Me, { field: e });
|
|
548
552
|
case a.EmailWidget:
|
|
549
|
-
return /* @__PURE__ */ s.jsx(Se, { field: e });
|
|
550
|
-
case a.GeocoderWidget:
|
|
551
553
|
return /* @__PURE__ */ s.jsx(Ve, { field: e });
|
|
552
|
-
case a.
|
|
554
|
+
case a.GeocoderWidget:
|
|
553
555
|
return /* @__PURE__ */ s.jsx($e, { field: e });
|
|
554
|
-
case a.
|
|
556
|
+
case a.MultiGeocoderWidget:
|
|
555
557
|
return /* @__PURE__ */ s.jsx(Pe, { field: e });
|
|
556
|
-
case a.
|
|
558
|
+
case a.PhoneWidget:
|
|
557
559
|
return /* @__PURE__ */ s.jsx(ze, { field: e });
|
|
558
|
-
case a.
|
|
560
|
+
case a.RadioWidget:
|
|
559
561
|
return /* @__PURE__ */ s.jsx(Be, { field: e });
|
|
560
|
-
case a.
|
|
562
|
+
case a.RichTextWidget:
|
|
561
563
|
return /* @__PURE__ */ s.jsx(Ee, { field: e });
|
|
562
|
-
case a.
|
|
564
|
+
case a.SwitchWidget:
|
|
563
565
|
return /* @__PURE__ */ s.jsx(He, { field: e });
|
|
564
|
-
case a.
|
|
566
|
+
case a.TextareaWidget:
|
|
565
567
|
return /* @__PURE__ */ s.jsx(Ue, { field: e });
|
|
566
|
-
case a.
|
|
568
|
+
case a.ToggleCheckboxWidget:
|
|
567
569
|
return /* @__PURE__ */ s.jsx(qe, { field: e });
|
|
570
|
+
case a.URLWidget:
|
|
571
|
+
return /* @__PURE__ */ s.jsx(Fe, { field: e });
|
|
568
572
|
case a.ImageUploadWidget:
|
|
569
573
|
return /* @__PURE__ */ s.jsx(
|
|
570
|
-
|
|
574
|
+
_,
|
|
571
575
|
{
|
|
572
576
|
field: e,
|
|
573
577
|
isMultiple: !1,
|
|
@@ -577,7 +581,7 @@ const A = ({
|
|
|
577
581
|
);
|
|
578
582
|
case a.MultiImageUploadWidget:
|
|
579
583
|
return /* @__PURE__ */ s.jsx(
|
|
580
|
-
|
|
584
|
+
_,
|
|
581
585
|
{
|
|
582
586
|
field: e,
|
|
583
587
|
isMultiple: !0,
|
|
@@ -587,7 +591,7 @@ const A = ({
|
|
|
587
591
|
);
|
|
588
592
|
case a.FileUploadWidget:
|
|
589
593
|
return /* @__PURE__ */ s.jsx(
|
|
590
|
-
|
|
594
|
+
_,
|
|
591
595
|
{
|
|
592
596
|
field: e,
|
|
593
597
|
isMultiple: !1,
|
|
@@ -597,7 +601,7 @@ const A = ({
|
|
|
597
601
|
);
|
|
598
602
|
case a.MultiFileUploadWidget:
|
|
599
603
|
return /* @__PURE__ */ s.jsx(
|
|
600
|
-
|
|
604
|
+
_,
|
|
601
605
|
{
|
|
602
606
|
field: e,
|
|
603
607
|
isMultiple: !0,
|
|
@@ -608,13 +612,34 @@ const A = ({
|
|
|
608
612
|
case a.CollectionWidget:
|
|
609
613
|
return !((i = e == null ? void 0 : e.options) != null && i.collection_key) || !((d = e == null ? void 0 : e.options) != null && d.label_field_key) ? (console.error(
|
|
610
614
|
"[LevoCollection]: Error while rendering collection widget. Collection key of label field key is required."
|
|
611
|
-
), null) : (
|
|
612
|
-
|
|
613
|
-
|
|
615
|
+
), null) : (
|
|
616
|
+
/**
|
|
617
|
+
* @context
|
|
618
|
+
*
|
|
619
|
+
* this includes both `o2m` and `m2m` relationships, which if rendered
|
|
620
|
+
* should be using a multi-select dropdown widget
|
|
621
|
+
*
|
|
622
|
+
*
|
|
623
|
+
* @todo
|
|
624
|
+
* but, if such a field exist, we should be handling that with a modal or a drawer widget
|
|
625
|
+
* which renders a table with a multi-row select.
|
|
626
|
+
*
|
|
627
|
+
* the selected row, would then become connected to the current row.
|
|
628
|
+
*
|
|
629
|
+
* e.g.: `blog` collection key can have an `o2m` relationship with `post` collection key
|
|
630
|
+
*
|
|
631
|
+
* in this case, the `post` collection key should be rendered as a widget which shows count of posts
|
|
632
|
+
* and on clicking which actually opens a modal or a drawer widget which renders a table with a multi-row select
|
|
633
|
+
*
|
|
634
|
+
*/
|
|
635
|
+
(o = e == null ? void 0 : e.options) != null && o.current_have_many_connected ? (console.error(
|
|
636
|
+
"[LevoCollection]: Error while rendering collection widget. Field options not set correctly."
|
|
637
|
+
), null) : /* @__PURE__ */ s.jsx(Ie, { field: e })
|
|
638
|
+
);
|
|
614
639
|
default:
|
|
615
640
|
return null;
|
|
616
641
|
}
|
|
617
|
-
},
|
|
642
|
+
}, Ge = ({
|
|
618
643
|
field: e,
|
|
619
644
|
isInternal: r
|
|
620
645
|
}) => {
|
|
@@ -644,20 +669,20 @@ const A = ({
|
|
|
644
669
|
case a.ArrayWidget:
|
|
645
670
|
return /* @__PURE__ */ s.jsx(Ce, { ...e });
|
|
646
671
|
case a.RecordWidget:
|
|
647
|
-
return /* @__PURE__ */ s.jsx(
|
|
672
|
+
return /* @__PURE__ */ s.jsx(Ge, { ...e });
|
|
648
673
|
default:
|
|
649
|
-
return /* @__PURE__ */ s.jsx(
|
|
674
|
+
return /* @__PURE__ */ s.jsx(Oe, { ...e });
|
|
650
675
|
}
|
|
651
|
-
}, Q =
|
|
676
|
+
}, Q = b.createContext({
|
|
652
677
|
schema: null,
|
|
653
678
|
submitButtonConfig: {
|
|
654
679
|
show: !0
|
|
655
680
|
}
|
|
656
|
-
}),
|
|
681
|
+
}), Ke = ({
|
|
657
682
|
children: e,
|
|
658
683
|
...r
|
|
659
684
|
}) => {
|
|
660
|
-
const { schema: t, onFormView: n } = r, { ref: i } =
|
|
685
|
+
const { schema: t, onFormView: n } = r, { ref: i } = be({
|
|
661
686
|
triggerOnce: !0,
|
|
662
687
|
onChange: (d) => {
|
|
663
688
|
d && (t != null && t.id) && n && n({ schemaId: t.id });
|
|
@@ -667,16 +692,16 @@ const A = ({
|
|
|
667
692
|
/* @__PURE__ */ s.jsx("div", { ref: i }),
|
|
668
693
|
e
|
|
669
694
|
] });
|
|
670
|
-
},
|
|
671
|
-
() => import("./DefaultFormVariant-
|
|
672
|
-
),
|
|
673
|
-
() => import("./StepsFormVariant-
|
|
674
|
-
),
|
|
695
|
+
}, jt = () => b.useContext(Q), Je = b.lazy(
|
|
696
|
+
() => import("./DefaultFormVariant-C6zbKgwB.js")
|
|
697
|
+
), Qe = b.lazy(
|
|
698
|
+
() => import("./StepsFormVariant-Bx-jdciC.js")
|
|
699
|
+
), Xe = ({
|
|
675
700
|
formVariant: e,
|
|
676
701
|
...r
|
|
677
702
|
}) => {
|
|
678
703
|
const { schema: t, uiConfig: n } = r;
|
|
679
|
-
return /* @__PURE__ */ s.jsxs(
|
|
704
|
+
return /* @__PURE__ */ s.jsxs(Ke, { ...r, children: [
|
|
680
705
|
n != null && n.hideFormHeading ? null : /* @__PURE__ */ s.jsxs(
|
|
681
706
|
"h1",
|
|
682
707
|
{
|
|
@@ -686,18 +711,18 @@ const A = ({
|
|
|
686
711
|
),
|
|
687
712
|
children: [
|
|
688
713
|
"Create new ",
|
|
689
|
-
|
|
714
|
+
je.singularize((t == null ? void 0 : t.name) || "")
|
|
690
715
|
]
|
|
691
716
|
}
|
|
692
717
|
),
|
|
693
|
-
/* @__PURE__ */ s.jsx(ie, { children: e === "steps" ? /* @__PURE__ */ s.jsx(
|
|
718
|
+
/* @__PURE__ */ s.jsx(ie, { children: e === "steps" ? /* @__PURE__ */ s.jsx(Qe, {}) : /* @__PURE__ */ s.jsx(Je, {}) })
|
|
694
719
|
] });
|
|
695
720
|
}, bt = ({
|
|
696
721
|
collection_id: e,
|
|
697
722
|
hiddenFields: r,
|
|
698
723
|
...t
|
|
699
724
|
}) => {
|
|
700
|
-
const { collection: n } = G(), [i, d] =
|
|
725
|
+
const { collection: n } = G(), [i, d] = T(!0), [o, c] = T(null);
|
|
701
726
|
return le(() => {
|
|
702
727
|
e ? n == null || n.getCollectionByIDExpanded(e, {
|
|
703
728
|
headers: {
|
|
@@ -709,8 +734,8 @@ const A = ({
|
|
|
709
734
|
if (g)
|
|
710
735
|
g.sections = (l = g == null ? void 0 : g.sections) == null ? void 0 : l.map(
|
|
711
736
|
(p) => {
|
|
712
|
-
var
|
|
713
|
-
return p.fields = (
|
|
737
|
+
var j;
|
|
738
|
+
return p.fields = (j = p == null ? void 0 : p.fields) == null ? void 0 : j.map((W) => (r != null && r.includes(W == null ? void 0 : W.key) && (W.hidden = !0), W)), p;
|
|
714
739
|
}
|
|
715
740
|
), c(g);
|
|
716
741
|
else
|
|
@@ -722,26 +747,26 @@ const A = ({
|
|
|
722
747
|
}) : (console.error(
|
|
723
748
|
"[CollectionFormBuilder] Collection ID or Workspace ID is missing."
|
|
724
749
|
), d(!1));
|
|
725
|
-
}, [e]), /* @__PURE__ */ s.jsx("div", { className: "w-full h-auto", children: i ? /* @__PURE__ */ s.jsx("div", { className: "min-h-[400px] w-full flex justify-center items-center bg-white rounded-md", children: /* @__PURE__ */ s.jsx(ye, {}) }) : o ? /* @__PURE__ */ s.jsx(
|
|
750
|
+
}, [e]), /* @__PURE__ */ s.jsx("div", { className: "w-full h-auto", children: i ? /* @__PURE__ */ s.jsx("div", { className: "min-h-[400px] w-full flex justify-center items-center bg-white rounded-md", children: /* @__PURE__ */ s.jsx(ye, {}) }) : o ? /* @__PURE__ */ s.jsx(Xe, { schema: o, ...t }) : null });
|
|
726
751
|
};
|
|
727
752
|
export {
|
|
728
753
|
bt as C,
|
|
729
754
|
J as F,
|
|
730
|
-
|
|
755
|
+
Wt as H,
|
|
731
756
|
K as a,
|
|
732
|
-
|
|
757
|
+
ht as b,
|
|
733
758
|
B as c,
|
|
734
|
-
|
|
759
|
+
pt as d,
|
|
735
760
|
ve as e,
|
|
736
|
-
|
|
761
|
+
ft as f,
|
|
737
762
|
C as g,
|
|
738
|
-
|
|
763
|
+
Re as h,
|
|
739
764
|
we as i,
|
|
740
765
|
Ae as j,
|
|
741
766
|
A as k,
|
|
742
|
-
|
|
767
|
+
jt as l,
|
|
743
768
|
z as p,
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
769
|
+
yt as s,
|
|
770
|
+
xt as u,
|
|
771
|
+
mt as v
|
|
747
772
|
};
|
|
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-B6kdoens.js";
|
|
|
2
2
|
import { useController as j } from "react-hook-form";
|
|
3
3
|
import { NumericFormat as F } from "react-number-format";
|
|
4
4
|
import { c as w } from "./cn-C9QoOYNG.js";
|
|
5
|
-
import { h as C, j as k, k as N } from "./CollectionFormBuilder-
|
|
5
|
+
import { h as C, j as k, k as N } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
6
6
|
const V = ({
|
|
7
7
|
field: r,
|
|
8
8
|
...m
|
|
@@ -4,7 +4,7 @@ import { Calendar as w, X as N } from "lucide-react";
|
|
|
4
4
|
import * as l from "react-datepicker";
|
|
5
5
|
import { useController as v } from "react-hook-form";
|
|
6
6
|
import { c as p } from "./cn-C9QoOYNG.js";
|
|
7
|
-
import { h as M, j as D, k as C } from "./CollectionFormBuilder-
|
|
7
|
+
import { h as M, j as D, k as C } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
8
8
|
import { I as F } from "./Input-2CvZ90f8.js";
|
|
9
9
|
const T = l.default.default || l.default || l, I = (e) => {
|
|
10
10
|
if (e) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
2
|
import { FormProvider as S } from "react-hook-form";
|
|
3
3
|
import { c as m } from "./cn-C9QoOYNG.js";
|
|
4
|
-
import { l as y, F } from "./CollectionFormBuilder-
|
|
5
|
-
import { u as N, S as w } from "./useLevoForm-
|
|
4
|
+
import { l as y, F } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
5
|
+
import { u as N, S as w } from "./useLevoForm-DjvUas25.js";
|
|
6
6
|
import { B as b } from "./Spinner-DzGH5rKe.js";
|
|
7
7
|
const E = () => {
|
|
8
8
|
var d;
|
|
@@ -4,7 +4,7 @@ import { useState as f, useEffect as j } from "react";
|
|
|
4
4
|
import { useController as k } from "react-hook-form";
|
|
5
5
|
import D from "react-select";
|
|
6
6
|
import { c as x } from "./cn-C9QoOYNG.js";
|
|
7
|
-
import { h as N, j as q, k as B } from "./CollectionFormBuilder-
|
|
7
|
+
import { h as N, j as q, k as B } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
8
8
|
import { I as L } from "./Input-2CvZ90f8.js";
|
|
9
9
|
const G = ({
|
|
10
10
|
field: s,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as r } from "./jsx-runtime-B6kdoens.js";
|
|
2
2
|
import { useController as y } from "react-hook-form";
|
|
3
3
|
import { G as C } from "./Spinner-DzGH5rKe.js";
|
|
4
|
-
import { h as F, j as I, k as V } from "./CollectionFormBuilder-
|
|
4
|
+
import { h as F, j as I, k as V } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
5
5
|
import { I as b } from "./Input-2CvZ90f8.js";
|
|
6
6
|
function w(e) {
|
|
7
7
|
return C({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M1.75 3h20.5c.966 0 1.75.784 1.75 1.75v14a1.75 1.75 0 0 1-1.75 1.75H1.75A1.75 1.75 0 0 1 0 18.75v-14C0 3.784.784 3 1.75 3ZM1.5 7.412V18.75c0 .138.112.25.25.25h20.5a.25.25 0 0 0 .25-.25V7.412l-9.52 6.433c-.592.4-1.368.4-1.96 0Zm0-2.662v.852l10.36 7a.25.25 0 0 0 .28 0l10.36-7V4.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z" }, child: [] }] })(e);
|
|
@@ -4,7 +4,7 @@ import le, { useState as J, useEffect as fe } from "react";
|
|
|
4
4
|
import { c as U } from "./LevoProvider-BI6g_T4E.js";
|
|
5
5
|
import { useController as de } from "react-hook-form";
|
|
6
6
|
import { q as pe } from "./Spinner-DzGH5rKe.js";
|
|
7
|
-
import { h as ge, j as me, k as ye } from "./CollectionFormBuilder-
|
|
7
|
+
import { h as ge, j as me, k as ye } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
8
8
|
import { I as _e } from "./Input-2CvZ90f8.js";
|
|
9
9
|
var ne = {}, ve = "Expected a function", Y = NaN, be = "[object Symbol]", Se = /^\s+|\s+$/g, Pe = /^[-+]0x[0-9a-f]+$/i, Oe = /^0b[01]+$/i, he = /^0o[0-7]+$/i, Te = parseInt, je = typeof U == "object" && U && U.Object === Object && U, xe = typeof self == "object" && self && self.Object === Object && self, Ae = je || xe || Function("return this")(), Le = Object.prototype, Ee = Le.toString, Ie = Math.max, we = Math.min, $ = function() {
|
|
10
10
|
return Ae.Date.now();
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
3
3
|
import { Plus as m } from "lucide-react";
|
|
4
4
|
import { useFieldArray as n } from "react-hook-form";
|
|
5
|
-
import { k as c } from "./CollectionFormBuilder-
|
|
6
|
-
import { GeocoderWidget as d } from "./GeocoderWidget-
|
|
5
|
+
import { k as c } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
6
|
+
import { GeocoderWidget as d } from "./GeocoderWidget-CXu17A7y.js";
|
|
7
7
|
import { B as p } from "./Spinner-DzGH5rKe.js";
|
|
8
8
|
const g = ({
|
|
9
9
|
field: l
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { j as a } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
+
import { useController as C } from "react-hook-form";
|
|
3
|
+
import { h as b, j as k, k as q } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
4
|
+
import { I as A } from "./Input-2CvZ90f8.js";
|
|
5
|
+
const W = ({ field: r }) => {
|
|
6
|
+
var l;
|
|
7
|
+
const { key: u = "", label: n = "", helper_text: c = "", readonly: x = !1 } = r, o = u, {
|
|
8
|
+
field: { value: e, onChange: h, ...d },
|
|
9
|
+
fieldState: s
|
|
10
|
+
} = C({
|
|
11
|
+
name: o,
|
|
12
|
+
rules: b(r)
|
|
13
|
+
}), j = !!(r != null && r.required), g = (l = s == null ? void 0 : s.error) == null ? void 0 : l.message, y = Array.isArray(e) ? e == null ? void 0 : e.join(",") : "";
|
|
14
|
+
return /* @__PURE__ */ a.jsxs(k, { error: g, helperText: c, children: [
|
|
15
|
+
n && /* @__PURE__ */ a.jsx(q, { htmlFor: o, isRequired: j, children: n }),
|
|
16
|
+
/* @__PURE__ */ a.jsx(
|
|
17
|
+
A,
|
|
18
|
+
{
|
|
19
|
+
id: o,
|
|
20
|
+
readOnly: x,
|
|
21
|
+
value: y,
|
|
22
|
+
onChange: (F) => {
|
|
23
|
+
var m, p, i;
|
|
24
|
+
h((i = (p = (m = F.target) == null ? void 0 : m.value) == null ? void 0 : p.split(",")) == null ? void 0 : i.map((t) => t == null ? void 0 : t.trim()));
|
|
25
|
+
},
|
|
26
|
+
...d
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
] });
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
W as default
|
|
33
|
+
};
|
|
@@ -3,7 +3,7 @@ import { j as o } from "./jsx-runtime-B6kdoens.js";
|
|
|
3
3
|
import { useController as f } from "react-hook-form";
|
|
4
4
|
import { PhoneInput as g } from "react-international-phone";
|
|
5
5
|
import { c as l } from "./cn-C9QoOYNG.js";
|
|
6
|
-
import { h as x, j as v, k as j } from "./CollectionFormBuilder-
|
|
6
|
+
import { h as x, j as v, k as j } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
7
7
|
const k = ({ field: e }) => {
|
|
8
8
|
const { key: u = "", label: t = "", helper_text: c = "", readonly: n = !1 } = e, s = u, {
|
|
9
9
|
field: { value: d, onBlur: a, onChange: i, ...m },
|
|
@@ -5,7 +5,7 @@ import * as d from "react";
|
|
|
5
5
|
import { useController as F } from "react-hook-form";
|
|
6
6
|
import { G as E } from "./Spinner-DzGH5rKe.js";
|
|
7
7
|
import { c as N } from "./cn-C9QoOYNG.js";
|
|
8
|
-
import { h as G, j as V, k as f } from "./CollectionFormBuilder-
|
|
8
|
+
import { h as G, j as V, k as f } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
9
9
|
import { I as q } from "./Input-2CvZ90f8.js";
|
|
10
10
|
function B(s) {
|
|
11
11
|
return E({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M416 128 192 384l-96-96" }, child: [] }] })(s);
|
|
@@ -19,7 +19,7 @@ import { useState as D, useEffect as G } from "react";
|
|
|
19
19
|
import { useController as q } from "react-hook-form";
|
|
20
20
|
import { G as p, e as J, f as V, g as W, h as Z, i as _, j as P, k as K, l as Q, m as X, n as Y, o as $, p as nn } from "./Spinner-DzGH5rKe.js";
|
|
21
21
|
import { c as j } from "./cn-C9QoOYNG.js";
|
|
22
|
-
import { h as ln, j as en, k as sn } from "./CollectionFormBuilder-
|
|
22
|
+
import { h as ln, j as en, k as sn } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
23
23
|
function an(n) {
|
|
24
24
|
return p({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 0 0-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z" }, child: [] }] })(n);
|
|
25
25
|
}
|