@levo-so/react 0.1.15 → 0.1.17
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-BGS61gcL.js → CheckboxWidget-CZWSPzDj.js} +1 -1
- package/dist/{CollectionFormBuilder-BIvx_z08.js → CollectionFormBuilder-nZcXob6G.js} +67 -65
- package/dist/{CurrencyWidget-sD8ijLvw.js → CurrencyWidget-CvosXYBi.js} +1 -1
- package/dist/{DateTimeWidget-KrcsxgEF.js → DateTimeWidget-CE0EPFkl.js} +1 -1
- package/dist/DefaultFormVariant-DiaIcOyu.js +81 -0
- package/dist/{DropdownWidget-rm5oUqOE.js → DropdownWidget-BquZdGIL.js} +4 -2
- package/dist/{EmailWidget-CvZKOywL.js → EmailWidget-KnkQjB4I.js} +1 -1
- package/dist/FormCaptcha-DNPGf2xY.js +197 -0
- package/dist/{GeocoderWidget-CSsp_-hW.js → GeocoderWidget-DNkRmCVB.js} +2 -2
- package/dist/LevoProvider-BAZy7_tP.js +223 -0
- package/dist/{MultiGeocoderWidget-Blqz-lHX.js → MultiGeocoderWidget-D2Vh9SuR.js} +2 -2
- package/dist/{MultiTextWidget-CxVpyf06.js → MultiTextWidget-Ktmx0-ou.js} +1 -1
- package/dist/{PhoneWidget-DezcchSP.js → PhoneWidget-2JMw1hQ-.js} +1 -1
- package/dist/{RadioWidget-SfD1fFDG.js → RadioWidget-CsMqjCtP.js} +1 -1
- package/dist/{RichTextWidget-Cg3RizdO.js → RichTextWidget-CesaOZze.js} +1 -1
- package/dist/{StepsFormVariant-D35dFYK6.js → StepsFormVariant-FXwgPUG0.js} +59 -56
- package/dist/{SwitchWidget-Id6BNlPe.js → SwitchWidget-W7FLoMLu.js} +1 -1
- package/dist/{TextWidget-CtFaQde1.js → TextWidget-B6Y4Jjld.js} +1 -1
- package/dist/{TextareaWidget-BKzAeMod.js → TextareaWidget-TszSrgEj.js} +1 -1
- package/dist/{ToggleCheckboxWidget-nSlie9sE.js → ToggleCheckboxWidget-sJoiRMME.js} +1 -1
- package/dist/{URLWidget-DtJai3xY.js → URLWidget-BjFx8Uf7.js} +2 -2
- package/dist/{UploadWidget-Dxx2_FYo.js → UploadWidget-Dzop6rEv.js} +6 -6
- package/dist/audience/components/block.d.ts.map +1 -1
- package/dist/audience/components/component.d.ts.map +1 -1
- package/dist/audience/components/page.d.ts.map +1 -1
- package/dist/audience/index.js +1 -1
- package/dist/collection/components/Altcha.d.ts.map +1 -1
- package/dist/collection/components/FormCaptcha.d.ts +3 -0
- package/dist/collection/components/FormCaptcha.d.ts.map +1 -0
- package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts.map +1 -1
- package/dist/collection/components/core/Checkbox/Checbox.d.ts.map +1 -1
- package/dist/collection/components/core/Input/Input.d.ts.map +1 -1
- package/dist/collection/components/core/Switch/Switch.d.ts.map +1 -1
- package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
- package/dist/collection/components/widgets/FieldWrapper.d.ts.map +1 -1
- package/dist/collection/components/widgets/FormHelperText.d.ts.map +1 -1
- package/dist/collection/components/widgets/FormLabel.d.ts.map +1 -1
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts.map +1 -1
- package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts.map +1 -1
- package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/multiTextWidget/MultiTextWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts.map +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/lib/FormBuilder.d.ts.map +1 -1
- package/dist/collection/lib/SaveDraftValues.d.ts.map +1 -1
- package/dist/collection/lib/hooks/useLevoForm.d.ts +1 -2
- package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -1
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -1
- package/dist/collection/lib/variants/StepsFormVariant.d.ts.map +1 -1
- package/dist/collection/utils/formHelpers.d.ts.map +1 -1
- package/dist/collection/utils/index.d.ts.map +1 -1
- package/dist/components/Dialog.d.ts.map +1 -1
- package/dist/components/Spinner.d.ts.map +1 -1
- package/dist/components/Table.d.ts.map +1 -1
- package/dist/components/Tabs.d.ts.map +1 -1
- package/dist/components/Tooltip.d.ts.map +1 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/membership/components/Button.d.ts.map +1 -1
- package/dist/membership/components/Container.d.ts.map +1 -1
- package/dist/membership/components/Core.d.ts.map +1 -1
- package/dist/membership/index.js +2 -3
- package/dist/{page-DgqTELmZ.js → page-BKyDlf0z.js} +1 -1
- package/dist/utils/errorHandler.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/DefaultFormVariant-j1HgVDiI.js +0 -127
- package/dist/LevoProvider-Do3jjJ4j.js +0 -211
- package/dist/useLevoForm-3jSJ9I6v.js +0 -170
|
@@ -3,7 +3,7 @@ import { j as a } from "./jsx-runtime-B6kdoens.js";
|
|
|
3
3
|
import { useState as w, useEffect as B } from "react";
|
|
4
4
|
import { useController as E } from "react-hook-form";
|
|
5
5
|
import { c as C } from "./cn-C9QoOYNG.js";
|
|
6
|
-
import { z as O, A as I, B as x } from "./CollectionFormBuilder-
|
|
6
|
+
import { z as O, A as I, B as x } from "./CollectionFormBuilder-nZcXob6G.js";
|
|
7
7
|
import { C as g } from "./Checbox-sq-atGlJ.js";
|
|
8
8
|
import { I as S } from "./Input-2CvZ90f8.js";
|
|
9
9
|
const L = ({ field: i }) => {
|
|
@@ -5,14 +5,14 @@ import * as A from "react";
|
|
|
5
5
|
import E, { useState as w, useEffect as ge, lazy as v, Suspense as _e } from "react";
|
|
6
6
|
import { useFieldArray as Ne, useController as me } from "react-hook-form";
|
|
7
7
|
import { G as H, T as Re, k as Le, l as Te, B as W, m as Me, A as Ae, C as Ie, j as De, n as Be, S as Se } from "./Spinner-Bzu2xCFZ.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import Pe from "
|
|
8
|
+
import { X as Fe } from "lucide-react";
|
|
9
|
+
import { u as X } from "./LevoProvider-BAZy7_tP.js";
|
|
10
|
+
import { Snowflake as Pe } from "@theinternetfolks/snowflake";
|
|
11
|
+
import Ee from "google-libphonenumber";
|
|
11
12
|
import re from "validator";
|
|
12
13
|
import z from "validatorjs";
|
|
13
14
|
import { c as b } from "./cn-C9QoOYNG.js";
|
|
14
|
-
import { Mate as
|
|
15
|
-
import { X as Ee } from "lucide-react";
|
|
15
|
+
import { Mate as Q } from "@theinternetfolks/mate";
|
|
16
16
|
import * as He from "inflection";
|
|
17
17
|
import { useInView as Oe } from "react-intersection-observer";
|
|
18
18
|
const Ve = [
|
|
@@ -74,7 +74,7 @@ const Ve = [
|
|
|
74
74
|
...$.document,
|
|
75
75
|
...$.image,
|
|
76
76
|
...$.video
|
|
77
|
-
}, { PhoneNumberUtil: Xe } =
|
|
77
|
+
}, { PhoneNumberUtil: Xe } = Ee, Je = (e) => {
|
|
78
78
|
const n = [];
|
|
79
79
|
for (const t of Object.keys(e))
|
|
80
80
|
for (const r of (e == null ? void 0 : e[t]) || [])
|
|
@@ -176,7 +176,7 @@ const Ve = [
|
|
|
176
176
|
let r = null;
|
|
177
177
|
return (t.field_interface === l.ArrayWidget && n !== l.ArrayWidget || t.field_interface === l.RecordWidget && n !== l.RecordWidget) && (t.fields = []), (n !== l.MultiDropdownWidget || n !== l.DropdownWidget || n !== l.RadioWidget || n !== l.CheckboxWidget) && t.field_interface !== l.MultiDropdownWidget && t.field_interface !== l.DropdownWidget && t.field_interface !== l.RadioWidget && t.field_interface !== l.CheckboxWidget && ((c = t.values) == null ? void 0 : c.length) !== 0 && (t.values = []), (n === l.MultiDropdownWidget && t.field_interface !== l.MultiDropdownWidget || n === l.DropdownWidget && t.field_interface !== l.DropdownWidget || n === l.RadioWidget && t.field_interface !== l.RadioWidget || n === l.CheckboxWidget && t.field_interface !== l.CheckboxWidget) && (t.values = [""], r = `${t.id}-option-0`), [l.RecordWidget, l.ArrayWidget].includes(
|
|
178
178
|
n
|
|
179
|
-
) && (r = `field-${
|
|
179
|
+
) && (r = `field-${Pe.generate()}`, t.kind = n === l.RecordWidget ? "record" : "group", t.fields = [
|
|
180
180
|
...(t == null ? void 0 : t.fields) || [],
|
|
181
181
|
{
|
|
182
182
|
id: r,
|
|
@@ -202,7 +202,7 @@ const Ve = [
|
|
|
202
202
|
}, Yt = (e, n) => {
|
|
203
203
|
var g;
|
|
204
204
|
const t = { ...e }, r = [], c = "_id";
|
|
205
|
-
if (n)
|
|
205
|
+
if (delete t.__captcha, n)
|
|
206
206
|
for (const a of n.sections ?? [])
|
|
207
207
|
for (const o of a.fields)
|
|
208
208
|
o.field_interface === "CollectionWidget" && r.push(o.key);
|
|
@@ -300,10 +300,10 @@ const q = ({
|
|
|
300
300
|
className: "space-y-4 border rounded bg-secondary/40",
|
|
301
301
|
value: d.toString(),
|
|
302
302
|
children: [
|
|
303
|
-
/* @__PURE__ */ s.jsx("div", { className: "flex flex-col px-3 py-2 gap-3", children: g.map((
|
|
303
|
+
/* @__PURE__ */ s.jsx("div", { className: "flex flex-col px-3 py-2 gap-3", children: g.map((f) => {
|
|
304
304
|
const k = {
|
|
305
|
-
...
|
|
306
|
-
key: `${t}.${d}.${
|
|
305
|
+
...f,
|
|
306
|
+
key: `${t}.${d}.${f == null ? void 0 : f.key}`
|
|
307
307
|
};
|
|
308
308
|
return /* @__PURE__ */ s.jsx(
|
|
309
309
|
ve,
|
|
@@ -311,7 +311,7 @@ const q = ({
|
|
|
311
311
|
field: k,
|
|
312
312
|
isInternal: n
|
|
313
313
|
},
|
|
314
|
-
`common-fields-${
|
|
314
|
+
`common-fields-${f == null ? void 0 : f.id}`
|
|
315
315
|
);
|
|
316
316
|
}) }),
|
|
317
317
|
/* @__PURE__ */ s.jsxs("div", { className: "flex p-2 items-center border-t", children: [
|
|
@@ -430,7 +430,7 @@ const xe = (e) => {
|
|
|
430
430
|
children: e
|
|
431
431
|
}) => /* @__PURE__ */ s.jsx("p", { className: "text-xs font-normal text-red-400 text-wrap", children: e }), ot = ({
|
|
432
432
|
children: e
|
|
433
|
-
}) => /* @__PURE__ */ s.jsx("p", { className: b("text-xs font-normal text-gray-600"), children: e }),
|
|
433
|
+
}) => /* @__PURE__ */ s.jsx("p", { className: b("text-xs font-normal text-gray-600"), children: e }), J = E.forwardRef(({ error: e, helperText: n, containerStyles: t, readOnly: r, children: c }, g) => /* @__PURE__ */ s.jsx(
|
|
434
434
|
"div",
|
|
435
435
|
{
|
|
436
436
|
className: b(
|
|
@@ -445,7 +445,9 @@ const xe = (e) => {
|
|
|
445
445
|
n && /* @__PURE__ */ s.jsx("div", { className: b("w-full mt-3"), children: /* @__PURE__ */ s.jsx(ot, { children: n }) })
|
|
446
446
|
] })
|
|
447
447
|
}
|
|
448
|
-
))
|
|
448
|
+
));
|
|
449
|
+
J.displayName = "FieldWrapper";
|
|
450
|
+
const he = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx(
|
|
449
451
|
"table",
|
|
450
452
|
{
|
|
451
453
|
ref: t,
|
|
@@ -456,7 +458,7 @@ const xe = (e) => {
|
|
|
456
458
|
he.displayName = "Table";
|
|
457
459
|
const at = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx("thead", { ref: t, className: b("[&_tr]:border-b", e), ...n }));
|
|
458
460
|
at.displayName = "TableHeader";
|
|
459
|
-
const
|
|
461
|
+
const ye = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx(
|
|
460
462
|
"tbody",
|
|
461
463
|
{
|
|
462
464
|
ref: t,
|
|
@@ -464,7 +466,7 @@ const fe = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx(
|
|
|
464
466
|
...n
|
|
465
467
|
}
|
|
466
468
|
));
|
|
467
|
-
|
|
469
|
+
ye.displayName = "TableBody";
|
|
468
470
|
const lt = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx(
|
|
469
471
|
"tfoot",
|
|
470
472
|
{
|
|
@@ -474,7 +476,7 @@ const lt = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx(
|
|
|
474
476
|
}
|
|
475
477
|
));
|
|
476
478
|
lt.displayName = "TableFooter";
|
|
477
|
-
const
|
|
479
|
+
const fe = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx(
|
|
478
480
|
"tr",
|
|
479
481
|
{
|
|
480
482
|
ref: t,
|
|
@@ -485,7 +487,7 @@ const ye = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx(
|
|
|
485
487
|
...n
|
|
486
488
|
}
|
|
487
489
|
));
|
|
488
|
-
|
|
490
|
+
fe.displayName = "TableRow";
|
|
489
491
|
const it = A.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ s.jsx(
|
|
490
492
|
"th",
|
|
491
493
|
{
|
|
@@ -564,13 +566,13 @@ const dt = E.lazy(
|
|
|
564
566
|
value: n,
|
|
565
567
|
onChange: t
|
|
566
568
|
}) => {
|
|
567
|
-
var S,
|
|
569
|
+
var S, y;
|
|
568
570
|
const { collection: r } = X(), [c, g] = w(!1), [a, o] = w([]), [i, m] = w(!1), {
|
|
569
571
|
key: x = "",
|
|
570
572
|
label: d = "items",
|
|
571
|
-
helper_text:
|
|
573
|
+
helper_text: f = "",
|
|
572
574
|
readonly: k = !1
|
|
573
|
-
} = e, C = x, B = ((S = e == null ? void 0 : e.options) == null ? void 0 : S.collection_key) || "", _ = ((
|
|
575
|
+
} = e, C = x, B = ((S = e == null ? void 0 : e.options) == null ? void 0 : S.collection_key) || "", _ = ((y = e == null ? void 0 : e.options) == null ? void 0 : y.label_field_key) || "", I = async (j, N, { page: R = 1 }) => {
|
|
574
576
|
var F;
|
|
575
577
|
g(!0);
|
|
576
578
|
try {
|
|
@@ -585,7 +587,7 @@ const dt = E.lazy(
|
|
|
585
587
|
}
|
|
586
588
|
}
|
|
587
589
|
})), h = (F = L == null ? void 0 : L.content) == null ? void 0 : F.data, O = (h || []).map((p) => {
|
|
588
|
-
const P = p != null && p[_] ? p == null ? void 0 : p[_] :
|
|
590
|
+
const P = p != null && p[_] ? p == null ? void 0 : p[_] : Q.toTitle((p == null ? void 0 : p.slug) || "");
|
|
589
591
|
return {
|
|
590
592
|
value: {
|
|
591
593
|
_id: p == null ? void 0 : p._id,
|
|
@@ -627,7 +629,7 @@ const dt = E.lazy(
|
|
|
627
629
|
onClose: () => m(!1),
|
|
628
630
|
contentClassName: "max-w-96",
|
|
629
631
|
children: [
|
|
630
|
-
/* @__PURE__ */ s.jsxs(
|
|
632
|
+
/* @__PURE__ */ s.jsxs(J, { helperText: f, readOnly: k, children: [
|
|
631
633
|
d && /* @__PURE__ */ s.jsx(q, { htmlFor: C, children: d }),
|
|
632
634
|
/* @__PURE__ */ s.jsx(
|
|
633
635
|
be,
|
|
@@ -675,8 +677,8 @@ const dt = E.lazy(
|
|
|
675
677
|
field: e
|
|
676
678
|
}) => {
|
|
677
679
|
var T, M, V;
|
|
678
|
-
const { collection: n } = X(), [t, r] = w(!1), [c, g] = w([]), [a, o] = w(1), [i, m] = w(0), [x, d] = w(0), { key:
|
|
679
|
-
field: { value:
|
|
680
|
+
const { collection: n } = X(), [t, r] = w(!1), [c, g] = w([]), [a, o] = w(1), [i, m] = w(0), [x, d] = w(0), { key: f = "", label: k = "", helper_text: C = "", readonly: B = !1 } = e, _ = f, I = ((T = e == null ? void 0 : e.options) == null ? void 0 : T.collection_key) || "", S = ((M = e == null ? void 0 : e.options) == null ? void 0 : M.label_field_key) || "", {
|
|
681
|
+
field: { value: y, onBlur: j, onChange: N, ref: R, disabled: F, ...L },
|
|
680
682
|
fieldState: h
|
|
681
683
|
} = me({
|
|
682
684
|
name: _,
|
|
@@ -690,16 +692,16 @@ const dt = E.lazy(
|
|
|
690
692
|
limit: 5,
|
|
691
693
|
where: {
|
|
692
694
|
_id: {
|
|
693
|
-
in:
|
|
695
|
+
in: y
|
|
694
696
|
}
|
|
695
697
|
}
|
|
696
698
|
})), D = ((Y = u == null ? void 0 : u.content) == null ? void 0 : Y.data) ?? [], G = ((te = (ee = u == null ? void 0 : u.content) == null ? void 0 : ee.meta) == null ? void 0 : te.pages) ?? 0;
|
|
697
699
|
m(((ne = (se = u == null ? void 0 : u.content) == null ? void 0 : se.meta) == null ? void 0 : ne.total) ?? 0), d(G), a > G && o(G), g(D), r(!1);
|
|
698
700
|
};
|
|
699
701
|
return ge(() => {
|
|
700
|
-
(
|
|
701
|
-
}, [
|
|
702
|
-
|
|
702
|
+
(y == null ? void 0 : y.length) > 0 && P();
|
|
703
|
+
}, [y, a]), /* @__PURE__ */ s.jsxs(
|
|
704
|
+
J,
|
|
703
705
|
{
|
|
704
706
|
ref: R,
|
|
705
707
|
error: p,
|
|
@@ -711,30 +713,30 @@ const dt = E.lazy(
|
|
|
711
713
|
ut,
|
|
712
714
|
{
|
|
713
715
|
onChange: N,
|
|
714
|
-
value:
|
|
716
|
+
value: y ?? [],
|
|
715
717
|
field: e
|
|
716
718
|
}
|
|
717
719
|
),
|
|
718
|
-
|
|
720
|
+
y != null && y.length ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
719
721
|
/* @__PURE__ */ s.jsxs("div", { className: "relative overflow-hidden", children: [
|
|
720
722
|
t ? /* @__PURE__ */ s.jsx("div", { className: "z-10 absolute top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-[rgba(0,0,0,0.05)]", children: /* @__PURE__ */ s.jsxs("div", { className: "flex items-center", children: [
|
|
721
723
|
/* @__PURE__ */ s.jsx(Be, { className: "h-8 w-8 animate-spin mr-2" }),
|
|
722
724
|
"Fetching"
|
|
723
725
|
] }) }) : null,
|
|
724
|
-
/* @__PURE__ */ s.jsx(he, { className:
|
|
726
|
+
/* @__PURE__ */ s.jsx(he, { className: y.length > 5 ? "min-h-72" : "", children: /* @__PURE__ */ s.jsx(ye, { children: c.map((u) => /* @__PURE__ */ s.jsx(fe, { children: /* @__PURE__ */ s.jsxs(je, { className: "flex justify-between", children: [
|
|
725
727
|
u == null ? void 0 : u[S],
|
|
726
728
|
/* @__PURE__ */ s.jsx(
|
|
727
|
-
|
|
729
|
+
Fe,
|
|
728
730
|
{
|
|
729
731
|
className: "cursor-pointer",
|
|
730
732
|
size: 20,
|
|
731
733
|
onClick: () => {
|
|
732
734
|
console.log(
|
|
733
|
-
|
|
734
|
-
|
|
735
|
+
y,
|
|
736
|
+
y == null ? void 0 : y.filter((D) => D !== (u == null ? void 0 : u._id)),
|
|
735
737
|
u
|
|
736
738
|
), N(
|
|
737
|
-
|
|
739
|
+
y == null ? void 0 : y.filter((D) => D !== (u == null ? void 0 : u._id))
|
|
738
740
|
);
|
|
739
741
|
}
|
|
740
742
|
}
|
|
@@ -828,12 +830,12 @@ const dt = E.lazy(
|
|
|
828
830
|
}) => {
|
|
829
831
|
var R, F, L;
|
|
830
832
|
const { collection: n } = X(), [t, r] = w(!1), { key: c = "", label: g = "", helper_text: a = "", readonly: o = !1 } = e, i = c, m = ((R = e == null ? void 0 : e.options) == null ? void 0 : R.collection_key) || "", x = ((F = e == null ? void 0 : e.options) == null ? void 0 : F.label_field_key) || "", {
|
|
831
|
-
field: { value: d, onBlur:
|
|
833
|
+
field: { value: d, onBlur: f, onChange: k, ref: C, disabled: B, ..._ },
|
|
832
834
|
fieldState: I
|
|
833
835
|
} = me({
|
|
834
836
|
name: i,
|
|
835
837
|
rules: xe(e)
|
|
836
|
-
}), S = !!(e != null && e.required),
|
|
838
|
+
}), S = !!(e != null && e.required), y = (L = I == null ? void 0 : I.error) == null ? void 0 : L.message, j = async (h, O, { page: p = 1 }) => {
|
|
837
839
|
var P;
|
|
838
840
|
r(!0);
|
|
839
841
|
try {
|
|
@@ -843,7 +845,7 @@ const dt = E.lazy(
|
|
|
843
845
|
search: h,
|
|
844
846
|
limit: 10
|
|
845
847
|
})), M = (P = T == null ? void 0 : T.content) == null ? void 0 : P.data, V = (M || []).map((u) => {
|
|
846
|
-
const D = u != null && u[x] ? u == null ? void 0 : u[x] :
|
|
848
|
+
const D = u != null && u[x] ? u == null ? void 0 : u[x] : Q.toTitle((u == null ? void 0 : u.slug) || "");
|
|
847
849
|
return {
|
|
848
850
|
value: {
|
|
849
851
|
_id: u == null ? void 0 : u._id,
|
|
@@ -872,7 +874,7 @@ const dt = E.lazy(
|
|
|
872
874
|
r(!1);
|
|
873
875
|
}
|
|
874
876
|
}, N = d ? {
|
|
875
|
-
label: d != null && d[x] ? d == null ? void 0 : d[x] : d != null && d.slug ?
|
|
877
|
+
label: d != null && d[x] ? d == null ? void 0 : d[x] : d != null && d.slug ? Q.toTitle((d == null ? void 0 : d.slug) || "") : "",
|
|
876
878
|
value: {
|
|
877
879
|
_id: d == null ? void 0 : d._id,
|
|
878
880
|
slug: d == null ? void 0 : d.slug,
|
|
@@ -880,10 +882,10 @@ const dt = E.lazy(
|
|
|
880
882
|
}
|
|
881
883
|
} : null;
|
|
882
884
|
return /* @__PURE__ */ s.jsxs(
|
|
883
|
-
|
|
885
|
+
J,
|
|
884
886
|
{
|
|
885
887
|
ref: C,
|
|
886
|
-
error:
|
|
888
|
+
error: y,
|
|
887
889
|
helperText: a,
|
|
888
890
|
readOnly: o,
|
|
889
891
|
children: [
|
|
@@ -897,7 +899,7 @@ const dt = E.lazy(
|
|
|
897
899
|
k((h == null ? void 0 : h.value) || null);
|
|
898
900
|
},
|
|
899
901
|
onBlur: () => {
|
|
900
|
-
|
|
902
|
+
f();
|
|
901
903
|
},
|
|
902
904
|
loadOptions: j,
|
|
903
905
|
debounceTimeout: 500,
|
|
@@ -917,26 +919,26 @@ const dt = E.lazy(
|
|
|
917
919
|
}
|
|
918
920
|
);
|
|
919
921
|
}, pt = v(
|
|
920
|
-
() => import("./MultiTextWidget-
|
|
921
|
-
), ie = v(() => import("./TextWidget-
|
|
922
|
-
() => import("./CurrencyWidget-
|
|
922
|
+
() => import("./MultiTextWidget-Ktmx0-ou.js")
|
|
923
|
+
), ie = v(() => import("./TextWidget-B6Y4Jjld.js")), xt = v(
|
|
924
|
+
() => import("./CurrencyWidget-CvosXYBi.js")
|
|
923
925
|
), ht = v(
|
|
924
|
-
() => import("./CheckboxWidget-
|
|
926
|
+
() => import("./CheckboxWidget-CZWSPzDj.js")
|
|
925
927
|
), ce = v(
|
|
926
|
-
() => import("./DateTimeWidget-
|
|
928
|
+
() => import("./DateTimeWidget-CE0EPFkl.js")
|
|
927
929
|
), de = v(
|
|
928
|
-
() => import("./DropdownWidget-
|
|
929
|
-
),
|
|
930
|
-
() => import("./GeocoderWidget-
|
|
930
|
+
() => import("./DropdownWidget-BquZdGIL.js")
|
|
931
|
+
), yt = v(() => import("./EmailWidget-KnkQjB4I.js")), ft = v(
|
|
932
|
+
() => import("./GeocoderWidget-DNkRmCVB.js")
|
|
931
933
|
), jt = v(
|
|
932
|
-
() => import("./MultiGeocoderWidget-
|
|
933
|
-
), bt = v(() => import("./PhoneWidget-
|
|
934
|
-
() => import("./RichTextWidget-
|
|
935
|
-
), wt = v(() => import("./SwitchWidget-
|
|
936
|
-
() => import("./TextareaWidget-
|
|
934
|
+
() => import("./MultiGeocoderWidget-D2Vh9SuR.js")
|
|
935
|
+
), bt = v(() => import("./PhoneWidget-2JMw1hQ-.js")), vt = v(() => import("./RadioWidget-CsMqjCtP.js")), Ct = v(
|
|
936
|
+
() => import("./RichTextWidget-CesaOZze.js")
|
|
937
|
+
), wt = v(() => import("./SwitchWidget-W7FLoMLu.js")), kt = v(
|
|
938
|
+
() => import("./TextareaWidget-TszSrgEj.js")
|
|
937
939
|
), Wt = v(
|
|
938
|
-
() => import("./ToggleCheckboxWidget-
|
|
939
|
-
), _t = v(() => import("./URLWidget-
|
|
940
|
+
() => import("./ToggleCheckboxWidget-sJoiRMME.js")
|
|
941
|
+
), _t = v(() => import("./URLWidget-BjFx8Uf7.js")), K = v(() => import("./UploadWidget-Dzop6rEv.js")), Nt = ({
|
|
940
942
|
field: e,
|
|
941
943
|
isInternal: n
|
|
942
944
|
}) => {
|
|
@@ -964,9 +966,9 @@ const dt = E.lazy(
|
|
|
964
966
|
case l.MultiTextWidget:
|
|
965
967
|
return /* @__PURE__ */ s.jsx(pt, { field: e });
|
|
966
968
|
case l.EmailWidget:
|
|
967
|
-
return /* @__PURE__ */ s.jsx(ft, { field: e });
|
|
968
|
-
case l.GeocoderWidget:
|
|
969
969
|
return /* @__PURE__ */ s.jsx(yt, { field: e });
|
|
970
|
+
case l.GeocoderWidget:
|
|
971
|
+
return /* @__PURE__ */ s.jsx(ft, { field: e });
|
|
970
972
|
case l.MultiGeocoderWidget:
|
|
971
973
|
return /* @__PURE__ */ s.jsx(jt, { field: e });
|
|
972
974
|
case l.PhoneWidget:
|
|
@@ -1105,9 +1107,9 @@ const dt = E.lazy(
|
|
|
1105
1107
|
e
|
|
1106
1108
|
] });
|
|
1107
1109
|
}, ns = () => E.useContext(Ce), Tt = E.lazy(
|
|
1108
|
-
() => import("./DefaultFormVariant-
|
|
1110
|
+
() => import("./DefaultFormVariant-DiaIcOyu.js")
|
|
1109
1111
|
), Mt = E.lazy(
|
|
1110
|
-
() => import("./StepsFormVariant-
|
|
1112
|
+
() => import("./StepsFormVariant-FXwgPUG0.js")
|
|
1111
1113
|
), At = ({
|
|
1112
1114
|
formVariant: e,
|
|
1113
1115
|
...n
|
|
@@ -1145,9 +1147,9 @@ const dt = E.lazy(
|
|
|
1145
1147
|
const m = (x = i == null ? void 0 : i.content) == null ? void 0 : x.data;
|
|
1146
1148
|
if (m)
|
|
1147
1149
|
m.sections = (d = m == null ? void 0 : m.sections) == null ? void 0 : d.map(
|
|
1148
|
-
(
|
|
1150
|
+
(f) => {
|
|
1149
1151
|
var k;
|
|
1150
|
-
return
|
|
1152
|
+
return f.fields = (k = f == null ? void 0 : f.fields) == null ? void 0 : k.map((C) => (n != null && n.includes(C == null ? void 0 : C.key) && (C.hidden = !0), C)), f;
|
|
1151
1153
|
}
|
|
1152
1154
|
), o(m);
|
|
1153
1155
|
else
|
|
@@ -1162,7 +1164,7 @@ const dt = E.lazy(
|
|
|
1162
1164
|
}, [e]), /* @__PURE__ */ s.jsx("div", { className: "w-full h-auto", children: c ? /* @__PURE__ */ s.jsx("div", { className: "min-h-[400px] w-full flex justify-center items-center bg-white rounded-md", children: /* @__PURE__ */ s.jsx(Se, {}) }) : a ? /* @__PURE__ */ s.jsx(At, { schema: a, ...t }) : null });
|
|
1163
1165
|
};
|
|
1164
1166
|
export {
|
|
1165
|
-
|
|
1167
|
+
J as A,
|
|
1166
1168
|
q as B,
|
|
1167
1169
|
rs as C,
|
|
1168
1170
|
ns as D,
|
|
@@ -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 { z as C, A as B, B as N } from "./CollectionFormBuilder-
|
|
5
|
+
import { z as C, A as B, B as N } from "./CollectionFormBuilder-nZcXob6G.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 { z as M, A as D, B as C } from "./CollectionFormBuilder-
|
|
7
|
+
import { z as M, A as D, B as C } from "./CollectionFormBuilder-nZcXob6G.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) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
+
import { FormProvider as y } from "react-hook-form";
|
|
3
|
+
import { c as t } from "./cn-C9QoOYNG.js";
|
|
4
|
+
import { D as F, F as g } from "./CollectionFormBuilder-nZcXob6G.js";
|
|
5
|
+
import { u as w, S as N, F as b } from "./FormCaptcha-DNPGf2xY.js";
|
|
6
|
+
import { B as D } from "./Spinner-Bzu2xCFZ.js";
|
|
7
|
+
const _ = () => {
|
|
8
|
+
var n;
|
|
9
|
+
const {
|
|
10
|
+
schema: l,
|
|
11
|
+
containerStyles: c,
|
|
12
|
+
uiConfig: m,
|
|
13
|
+
isInternal: d,
|
|
14
|
+
submitButtonConfig: a,
|
|
15
|
+
isDisabled: x
|
|
16
|
+
} = F(), {
|
|
17
|
+
methods: o,
|
|
18
|
+
allFormValues: p,
|
|
19
|
+
isError: h,
|
|
20
|
+
isLoading: u,
|
|
21
|
+
handleContentId: f,
|
|
22
|
+
handleSubmit: j
|
|
23
|
+
} = w({
|
|
24
|
+
schema: l,
|
|
25
|
+
saveToRemote: !0
|
|
26
|
+
}), {
|
|
27
|
+
formState: { isSubmitting: v }
|
|
28
|
+
} = o, S = o.watch("__captcha");
|
|
29
|
+
return /* @__PURE__ */ e.jsxs(y, { ...o, children: [
|
|
30
|
+
/* @__PURE__ */ e.jsx(
|
|
31
|
+
N,
|
|
32
|
+
{
|
|
33
|
+
getContentId: (s) => f(s),
|
|
34
|
+
isError: h,
|
|
35
|
+
currentValues: p
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ e.jsx("div", { className: t("w-full", c), children: /* @__PURE__ */ e.jsxs(
|
|
39
|
+
"form",
|
|
40
|
+
{
|
|
41
|
+
className: t(
|
|
42
|
+
"w-full bg-white rounded-md flex flex-col gap-6 px-4 md:px-8 py-6",
|
|
43
|
+
u && "opacity-50 pointer-events-none"
|
|
44
|
+
),
|
|
45
|
+
id: "collection-form",
|
|
46
|
+
onSubmit: j,
|
|
47
|
+
children: [
|
|
48
|
+
(n = l == null ? void 0 : l.sections) == null ? void 0 : n.map((s) => {
|
|
49
|
+
var i;
|
|
50
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "w-full", children: [
|
|
51
|
+
!(m != null && m.hideSectionHeadings) && /* @__PURE__ */ e.jsx("p", { className: t("mb-4 text-lg font-semibold"), children: s == null ? void 0 : s.label }),
|
|
52
|
+
/* @__PURE__ */ e.jsx("div", { className: t("flex flex-col gap-4"), children: (i = s == null ? void 0 : s.fields) == null ? void 0 : i.map((r) => r && !r.hidden ? /* @__PURE__ */ e.jsx(
|
|
53
|
+
g,
|
|
54
|
+
{
|
|
55
|
+
field: r,
|
|
56
|
+
isInternal: d
|
|
57
|
+
},
|
|
58
|
+
r == null ? void 0 : r.key
|
|
59
|
+
) : null) })
|
|
60
|
+
] }, s.id);
|
|
61
|
+
}),
|
|
62
|
+
!d && /* @__PURE__ */ e.jsx(b, {}),
|
|
63
|
+
(a == null ? void 0 : a.show) && /* @__PURE__ */ e.jsx("div", { className: "w-full flex items-center justify-end mt-6", children: /* @__PURE__ */ e.jsx(
|
|
64
|
+
D,
|
|
65
|
+
{
|
|
66
|
+
className: a == null ? void 0 : a.styles,
|
|
67
|
+
loadingText: "Saving",
|
|
68
|
+
isLoading: v,
|
|
69
|
+
disabled: x,
|
|
70
|
+
type: "submit",
|
|
71
|
+
children: S === "verifying" ? "Verifying..." : (a == null ? void 0 : a.text) || "Save"
|
|
72
|
+
}
|
|
73
|
+
) })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
) })
|
|
77
|
+
] });
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
_ as default
|
|
81
|
+
};
|
|
@@ -4,7 +4,7 @@ import { useState as x, useEffect as w } from "react";
|
|
|
4
4
|
import { useController as B } from "react-hook-form";
|
|
5
5
|
import D from "react-select";
|
|
6
6
|
import { c as y } from "./cn-C9QoOYNG.js";
|
|
7
|
-
import { z as N, A as k, B as q } from "./CollectionFormBuilder-
|
|
7
|
+
import { z as N, A as k, B as q } from "./CollectionFormBuilder-nZcXob6G.js";
|
|
8
8
|
import { I as L } from "./Input-2CvZ90f8.js";
|
|
9
9
|
const G = ({
|
|
10
10
|
field: s,
|
|
@@ -49,7 +49,9 @@ const G = ({
|
|
|
49
49
|
value: p ? {
|
|
50
50
|
label: "Other, Please Specify",
|
|
51
51
|
value: "Other"
|
|
52
|
-
} : l ? o != null && o.isMulti ? t == null ? void 0 : t.filter(
|
|
52
|
+
} : l ? o != null && o.isMulti ? t == null ? void 0 : t.filter(
|
|
53
|
+
(e) => l == null ? void 0 : l.includes(e == null ? void 0 : e.value)
|
|
54
|
+
) : t == null ? void 0 : t.find((e) => (e == null ? void 0 : e.value) === l) : null,
|
|
53
55
|
onChange: (e) => {
|
|
54
56
|
m && (e == null ? void 0 : e.value) === "Other" && (e == null ? void 0 : e.label) === "Other, Please Specify" ? (i(!0), a(h)) : (i(!1), o != null && o.isMulti ? a(e == null ? void 0 : e.map((r) => r == null ? void 0 : r.value)) : a(e == null ? void 0 : e.value));
|
|
55
57
|
},
|
|
@@ -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-Bzu2xCFZ.js";
|
|
4
|
-
import { z as F, A as I, B as V } from "./CollectionFormBuilder-
|
|
4
|
+
import { z as F, A as I, B as V } from "./CollectionFormBuilder-nZcXob6G.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);
|