@levo-so/react 0.1.2 → 0.1.4
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-BV2nPDdB.js → CheckboxWidget-Bnx-S2j2.js} +7 -7
- package/dist/{CollectionFormBuilder-uvr15jvu.js → CollectionFormBuilder-B_dXpvPN.js} +87 -88
- package/dist/{CurrencyWidget-VzBWDdzQ.js → CurrencyWidget-6Ov8DZpo.js} +6 -6
- package/dist/{DateTimeWidget-QmZXdxzS.js → DateTimeWidget-DI98zHMn.js} +7 -7
- package/dist/{DefaultFormVariant-DyyCGXvB.js → DefaultFormVariant-Bxbh1yc0.js} +22 -22
- package/dist/{DropdownWidget-CxWQF6r3.js → DropdownWidget-DrMkD9vK.js} +2 -2
- package/dist/{EmailWidget-BxxtgUGU.js → EmailWidget-DHjXwVCL.js} +2 -2
- package/dist/{GeocoderWidget-lh46EUHn.js → GeocoderWidget-D8GsLWkV.js} +83 -82
- package/dist/LevoProvider-Cp0CKrgY.js +212 -0
- package/dist/{MultiGeocoderWidget-C84ZYxpR.js → MultiGeocoderWidget-WzlKESyZ.js} +8 -8
- package/dist/{PhoneWidget-_-cBcZ_D.js → PhoneWidget-DQSo_DPX.js} +1 -1
- package/dist/{RadioWidget-BJ1qwTRO.js → RadioWidget-C8sTnz9B.js} +3 -3
- package/dist/{RichTextWidget-CC6uShje.js → RichTextWidget-DOMiJ9pX.js} +2 -2
- package/dist/{Spinner-CuUosd-S.js → Spinner-DzGH5rKe.js} +49 -49
- package/dist/{StepsFormVariant-BxANsU4Z.js → StepsFormVariant-CzS2wbMD.js} +8 -8
- package/dist/{SwitchWidget-CbCYweyx.js → SwitchWidget-CBottoNO.js} +1 -1
- package/dist/TextWidget-Dg-ZYJI2.js +33 -0
- package/dist/{TextareaWidget-Dqt4CVV-.js → TextareaWidget-wsUSnO28.js} +6 -6
- package/dist/{ToggleCheckboxWidget-D8CxllEX.js → ToggleCheckboxWidget-IeHYCie0.js} +1 -1
- package/dist/{URLWidget-C07DCMOd.js → URLWidget-BsIEpzV3.js} +2 -2
- package/dist/{UploadWidget-DoY_CPLy.js → UploadWidget-BJPmoAW-.js} +170 -168
- package/dist/audience/components/component.d.ts.map +1 -1
- package/dist/audience/index.js +1 -1
- package/dist/collection/components/CollectionFormBuilder.d.ts.map +1 -1
- package/dist/collection/components/renderer/RenderArrayWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts +1 -1
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.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/hooks/useLevoForm.d.ts.map +1 -1
- package/dist/collection/utils/formHelpers.d.ts +1 -0
- package/dist/collection/utils/formHelpers.d.ts.map +1 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{index-wTf_TtOG.js → index-BFJ48R-4.js} +1 -1
- package/dist/index.css +1 -0
- package/dist/index.js +5 -5
- package/dist/libs.css +1 -0
- package/dist/libs.d.ts +1 -0
- package/dist/membership/components/OAuth/Button.d.ts +1 -1
- package/dist/membership/components/OAuth/Button.d.ts.map +1 -1
- package/dist/membership/components/OAuth/Container.d.ts +1 -1
- package/dist/membership/components/OAuth/Container.d.ts.map +1 -1
- package/dist/membership/index.js +1 -1
- package/dist/page-YRcNFGqi.js +205 -0
- package/dist/providers/LevoProvider.d.ts +7 -7
- package/dist/providers/LevoProvider.d.ts.map +1 -1
- package/dist/{useLevoForm-B4Dmf73H.js → useLevoForm-HS_d5OoW.js} +7 -7
- package/package.json +72 -71
- package/dist/LevoProvider-DNbYyEaf.js +0 -21
- package/dist/TextWidget-CfEeuyFV.js +0 -33
- package/dist/page-CxaKoH22.js +0 -205
- package/dist/style.css +0 -1
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
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
|
-
import {
|
|
5
|
+
import { c as E } from "./cn-C9QoOYNG.js";
|
|
6
|
+
import { h as I, j as O, k as u } from "./CollectionFormBuilder-B_dXpvPN.js";
|
|
6
7
|
import { C as w } from "./Checbox-sq-atGlJ.js";
|
|
7
|
-
import { I as
|
|
8
|
-
import { c as _ } from "./cn-C9QoOYNG.js";
|
|
8
|
+
import { I as _ } from "./Input-2CvZ90f8.js";
|
|
9
9
|
const T = ({ field: i }) => {
|
|
10
10
|
const [n, p] = k(""), [o, j] = k(!1), {
|
|
11
11
|
key: $ = "",
|
|
@@ -19,7 +19,7 @@ const T = ({ field: i }) => {
|
|
|
19
19
|
fieldState: { error: x }
|
|
20
20
|
} = C({
|
|
21
21
|
name: $,
|
|
22
|
-
rules:
|
|
22
|
+
rules: I(i)
|
|
23
23
|
}), N = (e) => {
|
|
24
24
|
let s = Array.isArray(r || null) ? [...r] : [];
|
|
25
25
|
s.includes(e) ? s = s == null ? void 0 : s.filter((m) => m !== e) : s.push(e), l(s);
|
|
@@ -27,7 +27,7 @@ const T = ({ field: i }) => {
|
|
|
27
27
|
return B.useEffect(() => {
|
|
28
28
|
o || r && (c == null ? void 0 : c.findIndex((e) => e === r)) === -1 && (j(!0), p(r));
|
|
29
29
|
}, [r]), /* @__PURE__ */ t.jsxs(
|
|
30
|
-
|
|
30
|
+
O,
|
|
31
31
|
{
|
|
32
32
|
error: x == null ? void 0 : x.message,
|
|
33
33
|
helperText: g,
|
|
@@ -38,7 +38,7 @@ const T = ({ field: i }) => {
|
|
|
38
38
|
/* @__PURE__ */ t.jsx(
|
|
39
39
|
"div",
|
|
40
40
|
{
|
|
41
|
-
className:
|
|
41
|
+
className: E(
|
|
42
42
|
"w-full flex gap-4 flex-col flex-wrap pt-1",
|
|
43
43
|
y && "pointer-events-none cursor-not-allowed"
|
|
44
44
|
),
|
|
@@ -92,7 +92,7 @@ const T = ({ field: i }) => {
|
|
|
92
92
|
] })
|
|
93
93
|
] }),
|
|
94
94
|
/* @__PURE__ */ t.jsx(
|
|
95
|
-
|
|
95
|
+
_,
|
|
96
96
|
{
|
|
97
97
|
name: `other-checkbox-${a}`,
|
|
98
98
|
containerStyles: "max-w-[300px] ml-3",
|
|
@@ -1,16 +1,16 @@
|
|
|
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
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
4
|
+
import j, { useState as L, lazy as h, Suspense as ie, useEffect as le } from "react";
|
|
5
|
+
import { useFieldArray as ce, useController as ue } from "react-hook-form";
|
|
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";
|
|
8
|
+
import { u as G } from "./LevoProvider-Cp0CKrgY.js";
|
|
8
9
|
import { Snowflake as fe } from "@theinternetfolks/snowflake";
|
|
9
10
|
import We from "google-libphonenumber";
|
|
10
11
|
import P from "validator";
|
|
11
12
|
import w from "validatorjs";
|
|
12
13
|
import { c as f } from "./cn-C9QoOYNG.js";
|
|
13
|
-
import { u as G } from "./LevoProvider-DNbYyEaf.js";
|
|
14
14
|
import * as be from "inflection";
|
|
15
15
|
import { useInView as je } from "react-intersection-observer";
|
|
16
16
|
const { PhoneNumberUtil: ke } = We, ve = (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
|
+
}, gt = (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
|
+
}, mt = (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, ht = (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
|
+
}, pt = (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
|
+
}, xt = (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
|
+
}, yt = (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 ft(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,15 +196,15 @@ 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] = L("0"), { fields: u, ...g } =
|
|
199
|
+
const { key: t = "", label: n = "", field_interface: i = "", fields: d = [] } = e, [o, c] = L("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: [
|
|
203
203
|
/* @__PURE__ */ s.jsx(A, { className: "text-md font-medium mb-4", children: n }),
|
|
204
|
-
u && Array.isArray(u) ? /* @__PURE__ */ s.jsxs(
|
|
204
|
+
u && Array.isArray(u) ? /* @__PURE__ */ s.jsxs(de, { value: o, onValueChange: c, className: "w-full", children: [
|
|
205
205
|
/* @__PURE__ */ s.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
|
|
206
|
-
u.length ? /* @__PURE__ */ s.jsx(
|
|
207
|
-
|
|
206
|
+
u.length ? /* @__PURE__ */ s.jsx(ge, { className: "h-11 overflow-y-hidden overflow-x-auto flex-1 w-1 justify-start", children: u == null ? void 0 : u.map((x, l) => /* @__PURE__ */ s.jsx(
|
|
207
|
+
me,
|
|
208
208
|
{
|
|
209
209
|
id: `${e == null ? void 0 : e.key}-${l}`,
|
|
210
210
|
value: l.toString(),
|
|
@@ -229,7 +229,7 @@ const A = ({
|
|
|
229
229
|
)
|
|
230
230
|
] }),
|
|
231
231
|
u == null ? void 0 : u.map((x, l) => /* @__PURE__ */ s.jsxs(
|
|
232
|
-
|
|
232
|
+
he,
|
|
233
233
|
{
|
|
234
234
|
className: "space-y-4 border rounded bg-secondary/40",
|
|
235
235
|
value: l.toString(),
|
|
@@ -258,7 +258,7 @@ const A = ({
|
|
|
258
258
|
disabled: l === 0,
|
|
259
259
|
size: "icon",
|
|
260
260
|
className: "rounded-full w-8 h-8",
|
|
261
|
-
children: /* @__PURE__ */ s.jsx(
|
|
261
|
+
children: /* @__PURE__ */ s.jsx(pe, { size: "24px" })
|
|
262
262
|
}
|
|
263
263
|
),
|
|
264
264
|
/* @__PURE__ */ s.jsx(
|
|
@@ -281,7 +281,7 @@ const A = ({
|
|
|
281
281
|
},
|
|
282
282
|
disabled: l >= u.length - 1,
|
|
283
283
|
size: "icon",
|
|
284
|
-
children: /* @__PURE__ */ s.jsx(
|
|
284
|
+
children: /* @__PURE__ */ s.jsx(xe, { size: "24px" })
|
|
285
285
|
}
|
|
286
286
|
)
|
|
287
287
|
] })
|
|
@@ -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
|
-
}, Re =
|
|
350
|
+
}, Re = j.lazy(
|
|
351
351
|
() => import("react-select-async-paginate").then((e) => ({
|
|
352
352
|
default: e.AsyncPaginate
|
|
353
353
|
}))
|
|
354
|
-
),
|
|
355
|
-
|
|
354
|
+
), Le = (e) => /* @__PURE__ */ s.jsx(
|
|
355
|
+
Re,
|
|
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
|
+
), Ne = ({
|
|
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 }), Te = ({
|
|
396
396
|
children: e
|
|
397
|
-
}) => /* @__PURE__ */ s.jsx("p", { className: f("text-xs font-normal text-gray-600"), children: e }),
|
|
397
|
+
}) => /* @__PURE__ */ s.jsx("p", { className: f("text-xs font-normal text-gray-600"), children: e }), Ae = j.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,21 +405,21 @@ 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(Ne, { children: e }) }),
|
|
409
|
+
r && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(Te, { children: r }) })
|
|
410
410
|
] })
|
|
411
411
|
}
|
|
412
|
-
)),
|
|
412
|
+
)), Ie = ({
|
|
413
413
|
field: e
|
|
414
414
|
}) => {
|
|
415
415
|
var I, M, D;
|
|
416
416
|
const { collection: r } = G(), [t, n] = L(!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
417
|
field: { value: l, onBlur: p, onChange: b, ref: W, disabled: X, ...Y },
|
|
418
418
|
fieldState: N
|
|
419
|
-
} =
|
|
419
|
+
} = ue({
|
|
420
420
|
name: u,
|
|
421
|
-
rules:
|
|
422
|
-
}), Z = !!(e != null && e.required), ee = (D = N == null ? void 0 : N.error) == null ? void 0 : D.message, te = async (y,
|
|
421
|
+
rules: _e(e)
|
|
422
|
+
}), Z = !!(e != null && e.required), ee = (D = N == null ? void 0 : N.error) == null ? void 0 : D.message, te = async (y, Xe, { page: T = 1 }) => {
|
|
423
423
|
var S;
|
|
424
424
|
n(!0);
|
|
425
425
|
try {
|
|
@@ -466,7 +466,7 @@ const A = ({
|
|
|
466
466
|
}
|
|
467
467
|
} : null;
|
|
468
468
|
return /* @__PURE__ */ s.jsxs(
|
|
469
|
-
|
|
469
|
+
Ae,
|
|
470
470
|
{
|
|
471
471
|
ref: W,
|
|
472
472
|
error: ee,
|
|
@@ -475,7 +475,7 @@ 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
|
+
Le,
|
|
479
479
|
{
|
|
480
480
|
id: u,
|
|
481
481
|
value: re,
|
|
@@ -502,25 +502,25 @@ const A = ({
|
|
|
502
502
|
]
|
|
503
503
|
}
|
|
504
504
|
);
|
|
505
|
-
}, H = h(() => import("./TextWidget-
|
|
506
|
-
() => import("./CurrencyWidget-
|
|
507
|
-
),
|
|
508
|
-
() => import("./CheckboxWidget-
|
|
505
|
+
}, H = h(() => import("./TextWidget-Dg-ZYJI2.js")), Me = h(
|
|
506
|
+
() => import("./CurrencyWidget-6Ov8DZpo.js")
|
|
507
|
+
), De = h(
|
|
508
|
+
() => import("./CheckboxWidget-Bnx-S2j2.js")
|
|
509
509
|
), U = h(
|
|
510
|
-
() => import("./DateTimeWidget-
|
|
510
|
+
() => import("./DateTimeWidget-DI98zHMn.js")
|
|
511
511
|
), 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
|
-
),
|
|
512
|
+
() => import("./DropdownWidget-DrMkD9vK.js")
|
|
513
|
+
), Se = h(() => import("./EmailWidget-DHjXwVCL.js")), Ve = h(
|
|
514
|
+
() => import("./GeocoderWidget-D8GsLWkV.js")
|
|
515
|
+
), $e = h(
|
|
516
|
+
() => import("./MultiGeocoderWidget-WzlKESyZ.js")
|
|
517
|
+
), Pe = h(() => import("./PhoneWidget-DQSo_DPX.js")), ze = h(() => import("./RadioWidget-C8sTnz9B.js")), Be = h(
|
|
518
|
+
() => import("./RichTextWidget-DOMiJ9pX.js")
|
|
519
|
+
), Ee = h(() => import("./SwitchWidget-CBottoNO.js")), He = h(
|
|
520
|
+
() => import("./TextareaWidget-wsUSnO28.js")
|
|
521
|
+
), Ue = h(
|
|
522
|
+
() => import("./ToggleCheckboxWidget-IeHYCie0.js")
|
|
523
|
+
), qe = h(() => import("./URLWidget-BsIEpzV3.js")), R = h(() => import("./UploadWidget-BJPmoAW-.js")), Fe = ({
|
|
524
524
|
field: e,
|
|
525
525
|
isInternal: r
|
|
526
526
|
}) => {
|
|
@@ -534,9 +534,9 @@ const A = ({
|
|
|
534
534
|
case a.NumberWidget:
|
|
535
535
|
return /* @__PURE__ */ s.jsx(H, { type: "number", field: e });
|
|
536
536
|
case a.CurrencyWidget:
|
|
537
|
-
return /* @__PURE__ */ s.jsx(
|
|
537
|
+
return /* @__PURE__ */ s.jsx(Me, { field: e });
|
|
538
538
|
case a.CheckboxWidget:
|
|
539
|
-
return /* @__PURE__ */ s.jsx(
|
|
539
|
+
return /* @__PURE__ */ s.jsx(De, { field: e });
|
|
540
540
|
case a.DateTimeWidget:
|
|
541
541
|
return /* @__PURE__ */ s.jsx(U, { field: e });
|
|
542
542
|
case a.DateWidget:
|
|
@@ -546,25 +546,25 @@ const A = ({
|
|
|
546
546
|
case a.MultiDropdownWidget:
|
|
547
547
|
return /* @__PURE__ */ s.jsx(q, { field: e, isMulti: !0 });
|
|
548
548
|
case a.EmailWidget:
|
|
549
|
-
return /* @__PURE__ */ s.jsx(
|
|
549
|
+
return /* @__PURE__ */ s.jsx(Se, { field: e });
|
|
550
550
|
case a.GeocoderWidget:
|
|
551
|
-
return /* @__PURE__ */ s.jsx(
|
|
551
|
+
return /* @__PURE__ */ s.jsx(Ve, { field: e });
|
|
552
552
|
case a.MultiGeocoderWidget:
|
|
553
|
-
return /* @__PURE__ */ s.jsx(
|
|
553
|
+
return /* @__PURE__ */ s.jsx($e, { field: e });
|
|
554
554
|
case a.PhoneWidget:
|
|
555
|
-
return /* @__PURE__ */ s.jsx(
|
|
555
|
+
return /* @__PURE__ */ s.jsx(Pe, { field: e });
|
|
556
556
|
case a.RadioWidget:
|
|
557
|
-
return /* @__PURE__ */ s.jsx(
|
|
557
|
+
return /* @__PURE__ */ s.jsx(ze, { field: e });
|
|
558
558
|
case a.RichTextWidget:
|
|
559
|
-
return /* @__PURE__ */ s.jsx(
|
|
559
|
+
return /* @__PURE__ */ s.jsx(Be, { field: e });
|
|
560
560
|
case a.SwitchWidget:
|
|
561
|
-
return /* @__PURE__ */ s.jsx(
|
|
561
|
+
return /* @__PURE__ */ s.jsx(Ee, { field: e });
|
|
562
562
|
case a.TextareaWidget:
|
|
563
|
-
return /* @__PURE__ */ s.jsx(
|
|
563
|
+
return /* @__PURE__ */ s.jsx(He, { field: e });
|
|
564
564
|
case a.ToggleCheckboxWidget:
|
|
565
|
-
return /* @__PURE__ */ s.jsx(
|
|
565
|
+
return /* @__PURE__ */ s.jsx(Ue, { field: e });
|
|
566
566
|
case a.URLWidget:
|
|
567
|
-
return /* @__PURE__ */ s.jsx(
|
|
567
|
+
return /* @__PURE__ */ s.jsx(qe, { field: e });
|
|
568
568
|
case a.ImageUploadWidget:
|
|
569
569
|
return /* @__PURE__ */ s.jsx(
|
|
570
570
|
R,
|
|
@@ -610,11 +610,11 @@ const A = ({
|
|
|
610
610
|
"[LevoCollection]: Error while rendering collection widget. Collection key of label field key is required."
|
|
611
611
|
), null) : (o = e == null ? void 0 : e.options) != null && o.connected_have_many_current && ((c = e == null ? void 0 : e.options) != null && c.current_have_many_connected) ? (console.error(
|
|
612
612
|
"[LevoCollection]: Error while rendering collection widget. Field options not set correctly."
|
|
613
|
-
), null) : /* @__PURE__ */ s.jsx(
|
|
613
|
+
), null) : /* @__PURE__ */ s.jsx(Ie, { field: e });
|
|
614
614
|
default:
|
|
615
615
|
return null;
|
|
616
616
|
}
|
|
617
|
-
},
|
|
617
|
+
}, Oe = ({
|
|
618
618
|
field: e,
|
|
619
619
|
isInternal: r
|
|
620
620
|
}) => {
|
|
@@ -644,16 +644,16 @@ const A = ({
|
|
|
644
644
|
case a.ArrayWidget:
|
|
645
645
|
return /* @__PURE__ */ s.jsx(Ce, { ...e });
|
|
646
646
|
case a.RecordWidget:
|
|
647
|
-
return /* @__PURE__ */ s.jsx(Ge, { ...e });
|
|
648
|
-
default:
|
|
649
647
|
return /* @__PURE__ */ s.jsx(Oe, { ...e });
|
|
648
|
+
default:
|
|
649
|
+
return /* @__PURE__ */ s.jsx(Fe, { ...e });
|
|
650
650
|
}
|
|
651
651
|
}, Q = j.createContext({
|
|
652
652
|
schema: null,
|
|
653
653
|
submitButtonConfig: {
|
|
654
654
|
show: !0
|
|
655
655
|
}
|
|
656
|
-
}),
|
|
656
|
+
}), Ge = ({
|
|
657
657
|
children: e,
|
|
658
658
|
...r
|
|
659
659
|
}) => {
|
|
@@ -667,16 +667,16 @@ const A = ({
|
|
|
667
667
|
/* @__PURE__ */ s.jsx("div", { ref: i }),
|
|
668
668
|
e
|
|
669
669
|
] });
|
|
670
|
-
},
|
|
671
|
-
() => import("./DefaultFormVariant-
|
|
672
|
-
),
|
|
673
|
-
() => import("./StepsFormVariant-
|
|
674
|
-
),
|
|
670
|
+
}, Wt = () => j.useContext(Q), Ke = j.lazy(
|
|
671
|
+
() => import("./DefaultFormVariant-Bxbh1yc0.js")
|
|
672
|
+
), Je = j.lazy(
|
|
673
|
+
() => import("./StepsFormVariant-CzS2wbMD.js")
|
|
674
|
+
), Qe = ({
|
|
675
675
|
formVariant: e,
|
|
676
676
|
...r
|
|
677
677
|
}) => {
|
|
678
678
|
const { schema: t, uiConfig: n } = r;
|
|
679
|
-
return /* @__PURE__ */ s.jsxs(
|
|
679
|
+
return /* @__PURE__ */ s.jsxs(Ge, { ...r, children: [
|
|
680
680
|
n != null && n.hideFormHeading ? null : /* @__PURE__ */ s.jsxs(
|
|
681
681
|
"h1",
|
|
682
682
|
{
|
|
@@ -690,15 +690,15 @@ const A = ({
|
|
|
690
690
|
]
|
|
691
691
|
}
|
|
692
692
|
),
|
|
693
|
-
/* @__PURE__ */ s.jsx(
|
|
693
|
+
/* @__PURE__ */ s.jsx(ie, { children: e === "steps" ? /* @__PURE__ */ s.jsx(Je, {}) : /* @__PURE__ */ s.jsx(Ke, {}) })
|
|
694
694
|
] });
|
|
695
|
-
},
|
|
695
|
+
}, bt = ({
|
|
696
696
|
collection_id: e,
|
|
697
697
|
hiddenFields: r,
|
|
698
698
|
...t
|
|
699
699
|
}) => {
|
|
700
700
|
const { collection: n } = G(), [i, d] = L(!0), [o, c] = L(null);
|
|
701
|
-
return
|
|
701
|
+
return le(() => {
|
|
702
702
|
e ? n == null || n.getCollectionByIDExpanded(e, {
|
|
703
703
|
headers: {
|
|
704
704
|
"Levo-Workspace": t == null ? void 0 : t.workspace_id
|
|
@@ -722,27 +722,26 @@ const A = ({
|
|
|
722
722
|
}) : (console.error(
|
|
723
723
|
"[CollectionFormBuilder] Collection ID or Workspace ID is missing."
|
|
724
724
|
), 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(
|
|
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(Qe, { schema: o, ...t }) : null });
|
|
726
726
|
};
|
|
727
727
|
export {
|
|
728
|
-
|
|
728
|
+
bt as C,
|
|
729
729
|
J as F,
|
|
730
|
-
|
|
730
|
+
ft as H,
|
|
731
731
|
K as a,
|
|
732
|
-
|
|
732
|
+
mt as b,
|
|
733
733
|
B as c,
|
|
734
|
-
|
|
734
|
+
ht as d,
|
|
735
735
|
ve as e,
|
|
736
|
-
|
|
736
|
+
yt as f,
|
|
737
737
|
C as g,
|
|
738
|
-
|
|
738
|
+
_e as h,
|
|
739
739
|
we as i,
|
|
740
|
-
|
|
740
|
+
Ae as j,
|
|
741
741
|
A as k,
|
|
742
|
-
|
|
743
|
-
bt as m,
|
|
742
|
+
Wt as l,
|
|
744
743
|
z as p,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
744
|
+
xt as s,
|
|
745
|
+
pt as u,
|
|
746
|
+
gt as v
|
|
748
747
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { c as w } from "./cn-C9QoOYNG.js";
|
|
5
|
+
import { h as C, j as k, k as N } from "./CollectionFormBuilder-B_dXpvPN.js";
|
|
6
6
|
const V = ({
|
|
7
7
|
field: r,
|
|
8
8
|
...m
|
|
@@ -13,17 +13,17 @@ const V = ({
|
|
|
13
13
|
fieldState: s
|
|
14
14
|
} = j({
|
|
15
15
|
name: o,
|
|
16
|
-
rules:
|
|
16
|
+
rules: C(r)
|
|
17
17
|
}), b = !!(r != null && r.required), g = (u = s == null ? void 0 : s.error) == null ? void 0 : u.message, i = (c = r == null ? void 0 : r.options) == null ? void 0 : c.currency_code;
|
|
18
18
|
return /* @__PURE__ */ t.jsxs(
|
|
19
|
-
|
|
19
|
+
k,
|
|
20
20
|
{
|
|
21
21
|
ref: h,
|
|
22
22
|
error: g,
|
|
23
23
|
helperText: p,
|
|
24
24
|
readOnly: e,
|
|
25
25
|
children: [
|
|
26
|
-
n && /* @__PURE__ */ t.jsx(
|
|
26
|
+
n && /* @__PURE__ */ t.jsx(N, { htmlFor: o, isRequired: b, children: n }),
|
|
27
27
|
/* @__PURE__ */ t.jsx(
|
|
28
28
|
F,
|
|
29
29
|
{
|
|
@@ -42,7 +42,7 @@ const V = ({
|
|
|
42
42
|
},
|
|
43
43
|
value: f,
|
|
44
44
|
readOnly: e,
|
|
45
|
-
className:
|
|
45
|
+
className: w(
|
|
46
46
|
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
47
47
|
e && "focus-visible:ring-0"
|
|
48
48
|
),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as r } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
-
import {
|
|
2
|
+
import { FieldInterfaces as b } from "@levo-so/core";
|
|
3
|
+
import { Calendar as w, X as N } from "lucide-react";
|
|
3
4
|
import * as l from "react-datepicker";
|
|
4
|
-
import { FieldInterfaces as N } from "@levo-so/core";
|
|
5
5
|
import { useController as v } from "react-hook-form";
|
|
6
|
-
import { h as M, j as D, k as C } from "./CollectionFormBuilder-uvr15jvu.js";
|
|
7
|
-
import { I as F } from "./Input-2CvZ90f8.js";
|
|
8
6
|
import { c as p } from "./cn-C9QoOYNG.js";
|
|
7
|
+
import { h as M, j as D, k as C } from "./CollectionFormBuilder-B_dXpvPN.js";
|
|
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) {
|
|
11
11
|
const o = new Date(e);
|
|
@@ -20,7 +20,7 @@ const T = l.default.default || l.default || l, I = (e) => {
|
|
|
20
20
|
} = v({
|
|
21
21
|
name: n,
|
|
22
22
|
rules: M(e)
|
|
23
|
-
}), y = !!(e != null && e.required), g = (d = a == null ? void 0 : a.error) == null ? void 0 : d.message, c = (e == null ? void 0 : e.field_interface) ===
|
|
23
|
+
}), y = !!(e != null && e.required), g = (d = a == null ? void 0 : a.error) == null ? void 0 : d.message, c = (e == null ? void 0 : e.field_interface) === b.DateTimeWidget;
|
|
24
24
|
return /* @__PURE__ */ r.jsxs(D, { helperText: f, readOnly: x, error: g, children: [
|
|
25
25
|
m && /* @__PURE__ */ r.jsx(C, { htmlFor: n, isRequired: y, children: m }),
|
|
26
26
|
/* @__PURE__ */ r.jsxs("div", { className: "w-full relative rounded-md", children: [
|
|
@@ -30,7 +30,7 @@ const T = l.default.default || l.default || l, I = (e) => {
|
|
|
30
30
|
className: p(
|
|
31
31
|
"absolute left-0 top-0 bottom-0 w-9 flex items-center justify-center rounded-l-md overflow-hidden pointer-events-none"
|
|
32
32
|
),
|
|
33
|
-
children: /* @__PURE__ */ r.jsx(
|
|
33
|
+
children: /* @__PURE__ */ r.jsx(w, { size: "20px", className: "text-muted-foreground" })
|
|
34
34
|
}
|
|
35
35
|
),
|
|
36
36
|
/* @__PURE__ */ r.jsx(
|
|
@@ -67,7 +67,7 @@ const T = l.default.default || l.default || l, I = (e) => {
|
|
|
67
67
|
onClick: (t) => {
|
|
68
68
|
t == null || t.preventDefault(), t == null || t.stopPropagation(), s && s(null);
|
|
69
69
|
},
|
|
70
|
-
children: /* @__PURE__ */ r.jsx(
|
|
70
|
+
children: /* @__PURE__ */ r.jsx(N, { size: "20px", className: "text-muted-foreground" })
|
|
71
71
|
}
|
|
72
72
|
)
|
|
73
73
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
2
|
import { FormProvider as S } from "react-hook-form";
|
|
3
|
-
import { m as b, F as y } from "./CollectionFormBuilder-uvr15jvu.js";
|
|
4
|
-
import { u as F, S as N } from "./useLevoForm-B4Dmf73H.js";
|
|
5
3
|
import { c as m } from "./cn-C9QoOYNG.js";
|
|
6
|
-
import {
|
|
4
|
+
import { l as y, F } from "./CollectionFormBuilder-B_dXpvPN.js";
|
|
5
|
+
import { u as N, S as w } from "./useLevoForm-HS_d5OoW.js";
|
|
6
|
+
import { B as b } from "./Spinner-DzGH5rKe.js";
|
|
7
7
|
const E = () => {
|
|
8
8
|
var d;
|
|
9
9
|
const {
|
|
10
10
|
schema: l,
|
|
11
11
|
containerStyles: i,
|
|
12
|
-
uiConfig:
|
|
12
|
+
uiConfig: t,
|
|
13
13
|
isInternal: x,
|
|
14
|
-
submitButtonConfig:
|
|
14
|
+
submitButtonConfig: s,
|
|
15
15
|
isDisabled: c
|
|
16
|
-
} =
|
|
17
|
-
methods:
|
|
16
|
+
} = y(), {
|
|
17
|
+
methods: o,
|
|
18
18
|
allFormValues: p,
|
|
19
19
|
isError: u,
|
|
20
20
|
isLoading: h,
|
|
21
21
|
handleContentId: j,
|
|
22
22
|
handleSubmit: f
|
|
23
|
-
} =
|
|
23
|
+
} = N({
|
|
24
24
|
schema: l,
|
|
25
25
|
saveToRemote: !0
|
|
26
26
|
}), {
|
|
27
27
|
formState: { isSubmitting: v }
|
|
28
|
-
} =
|
|
29
|
-
return /* @__PURE__ */ e.jsxs(S, { ...
|
|
28
|
+
} = o;
|
|
29
|
+
return /* @__PURE__ */ e.jsxs(S, { ...o, children: [
|
|
30
30
|
/* @__PURE__ */ e.jsx(
|
|
31
|
-
|
|
31
|
+
w,
|
|
32
32
|
{
|
|
33
|
-
getContentId: (
|
|
33
|
+
getContentId: (r) => j(r),
|
|
34
34
|
isError: u,
|
|
35
35
|
currentValues: p
|
|
36
36
|
}
|
|
@@ -39,35 +39,35 @@ const E = () => {
|
|
|
39
39
|
"form",
|
|
40
40
|
{
|
|
41
41
|
className: m(
|
|
42
|
-
"w-full bg-white rounded-md
|
|
42
|
+
"w-full bg-white rounded-md flex flex-col gap-6 px-4 md:px-8 py-6",
|
|
43
43
|
h && "opacity-50 pointer-events-none"
|
|
44
44
|
),
|
|
45
45
|
id: "collection-form",
|
|
46
46
|
onSubmit: f,
|
|
47
47
|
children: [
|
|
48
|
-
(d = l == null ? void 0 : l.sections) == null ? void 0 : d.map((
|
|
48
|
+
(d = l == null ? void 0 : l.sections) == null ? void 0 : d.map((r) => {
|
|
49
49
|
var n;
|
|
50
50
|
return /* @__PURE__ */ e.jsxs("div", { className: "w-full", children: [
|
|
51
|
-
!(
|
|
52
|
-
/* @__PURE__ */ e.jsx("div", { className: m("flex flex-col gap-4"), children: (n =
|
|
53
|
-
|
|
51
|
+
!(t != null && t.hideSectionHeadings) && /* @__PURE__ */ e.jsx("p", { className: m("mb-4 text-lg font-semibold"), children: r == null ? void 0 : r.label }),
|
|
52
|
+
/* @__PURE__ */ e.jsx("div", { className: m("flex flex-col gap-4"), children: (n = r == null ? void 0 : r.fields) == null ? void 0 : n.map((a) => a && !a.hidden ? /* @__PURE__ */ e.jsx(
|
|
53
|
+
F,
|
|
54
54
|
{
|
|
55
55
|
field: a,
|
|
56
56
|
isInternal: x
|
|
57
57
|
},
|
|
58
58
|
a == null ? void 0 : a.key
|
|
59
59
|
) : null) })
|
|
60
|
-
] },
|
|
60
|
+
] }, r.id);
|
|
61
61
|
}),
|
|
62
|
-
(
|
|
63
|
-
|
|
62
|
+
(s == null ? void 0 : s.show) && /* @__PURE__ */ e.jsx("div", { className: "w-full flex items-center justify-end mt-6", children: /* @__PURE__ */ e.jsx(
|
|
63
|
+
b,
|
|
64
64
|
{
|
|
65
|
-
className:
|
|
65
|
+
className: s == null ? void 0 : s.styles,
|
|
66
66
|
loadingText: "Saving",
|
|
67
67
|
isLoading: v,
|
|
68
68
|
disabled: c,
|
|
69
69
|
type: "submit",
|
|
70
|
-
children: (
|
|
70
|
+
children: (s == null ? void 0 : s.text) || "Save"
|
|
71
71
|
}
|
|
72
72
|
) })
|
|
73
73
|
]
|
|
@@ -3,9 +3,9 @@ import { j as i } from "./jsx-runtime-B6kdoens.js";
|
|
|
3
3
|
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
|
-
import { h as N, j as q, k as B } from "./CollectionFormBuilder-uvr15jvu.js";
|
|
7
|
-
import { I as L } from "./Input-2CvZ90f8.js";
|
|
8
6
|
import { c as x } from "./cn-C9QoOYNG.js";
|
|
7
|
+
import { h as N, j as q, k as B } from "./CollectionFormBuilder-B_dXpvPN.js";
|
|
8
|
+
import { I as L } from "./Input-2CvZ90f8.js";
|
|
9
9
|
const G = ({
|
|
10
10
|
field: s,
|
|
11
11
|
...r
|
|
@@ -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
|
-
import { G as C } from "./Spinner-
|
|
4
|
-
import { h as F, j as I, k as V } from "./CollectionFormBuilder-
|
|
3
|
+
import { G as C } from "./Spinner-DzGH5rKe.js";
|
|
4
|
+
import { h as F, j as I, k as V } from "./CollectionFormBuilder-B_dXpvPN.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);
|