@levo-so/react 0.1.1 → 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-ComdVcZ_.js → CheckboxWidget-Bnx-S2j2.js} +7 -7
- package/dist/{CollectionFormBuilder-jwwjyIpv.js → CollectionFormBuilder-B_dXpvPN.js} +114 -105
- package/dist/{CurrencyWidget-DVqD_lsY.js → CurrencyWidget-6Ov8DZpo.js} +6 -6
- package/dist/{DateTimeWidget-CvgzwY1U.js → DateTimeWidget-DI98zHMn.js} +7 -7
- package/dist/{DefaultFormVariant-CbRB9O_e.js → DefaultFormVariant-Bxbh1yc0.js} +22 -22
- package/dist/{DropdownWidget-C2YaM9Cf.js → DropdownWidget-DrMkD9vK.js} +2 -2
- package/dist/{EmailWidget-BBthwF68.js → EmailWidget-DHjXwVCL.js} +2 -2
- package/dist/{GeocoderWidget-Dht_2vi6.js → GeocoderWidget-D8GsLWkV.js} +83 -82
- package/dist/LevoProvider-Cp0CKrgY.js +212 -0
- package/dist/{MultiGeocoderWidget-paCFW0QZ.js → MultiGeocoderWidget-WzlKESyZ.js} +8 -8
- package/dist/{PhoneWidget-CP2T2JDx.js → PhoneWidget-DQSo_DPX.js} +9 -8
- package/dist/{RadioWidget-BuFPz7kK.js → RadioWidget-C8sTnz9B.js} +3 -3
- package/dist/{RichTextWidget-DGFNZ1jl.js → RichTextWidget-DOMiJ9pX.js} +2 -2
- package/dist/{Spinner-CuUosd-S.js → Spinner-DzGH5rKe.js} +49 -49
- package/dist/{StepsFormVariant-5_c3f2Vk.js → StepsFormVariant-CzS2wbMD.js} +8 -8
- package/dist/{SwitchWidget-t8iwhxk9.js → SwitchWidget-CBottoNO.js} +1 -1
- package/dist/TextWidget-Dg-ZYJI2.js +33 -0
- package/dist/{TextareaWidget-CG6J_plD.js → TextareaWidget-wsUSnO28.js} +6 -6
- package/dist/{ToggleCheckboxWidget-dl8ks4VX.js → ToggleCheckboxWidget-IeHYCie0.js} +1 -1
- package/dist/{URLWidget-CHeUEUXl.js → URLWidget-BsIEpzV3.js} +2 -2
- package/dist/{UploadWidget-CzYGViqE.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/renderer/RenderCommonField.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 +2 -1
- 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-BcN8f66y.js → useLevoForm-HS_d5OoW.js} +7 -7
- package/package.json +72 -71
- package/dist/LevoProvider-DNbYyEaf.js +0 -21
- package/dist/TextWidget-D0UBxTxe.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) => {
|
|
@@ -21,7 +21,7 @@ const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
|
21
21
|
return r;
|
|
22
22
|
}, z = ke.getInstance(), we = (e) => {
|
|
23
23
|
try {
|
|
24
|
-
return
|
|
24
|
+
return z.isValidNumber(z.parseAndKeepRawInput(e));
|
|
25
25
|
} catch {
|
|
26
26
|
return !1;
|
|
27
27
|
}
|
|
@@ -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,13 +166,13 @@ 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
|
-
function
|
|
172
|
+
function E(e) {
|
|
173
173
|
return O({ tag: "svg", attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z", clipRule: "evenodd" }, child: [] }] })(e);
|
|
174
174
|
}
|
|
175
|
-
const
|
|
175
|
+
const A = ({
|
|
176
176
|
children: e,
|
|
177
177
|
isRequired: r,
|
|
178
178
|
className: t,
|
|
@@ -196,15 +196,15 @@ const I = ({
|
|
|
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] = 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
|
-
/* @__PURE__ */ s.jsx(
|
|
204
|
-
u && Array.isArray(u) ? /* @__PURE__ */ s.jsxs(
|
|
203
|
+
/* @__PURE__ */ s.jsx(A, { className: "text-md font-medium mb-4", children: n }),
|
|
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(),
|
|
@@ -222,14 +222,14 @@ const I = ({
|
|
|
222
222
|
g.append(C(d)), c(((u == null ? void 0 : u.length) ?? 0).toString());
|
|
223
223
|
},
|
|
224
224
|
children: [
|
|
225
|
-
/* @__PURE__ */ s.jsx(
|
|
225
|
+
/* @__PURE__ */ s.jsx(E, { className: "inline-block mr-1", size: "14px" }),
|
|
226
226
|
"Add"
|
|
227
227
|
]
|
|
228
228
|
}
|
|
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 I = ({
|
|
|
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 I = ({
|
|
|
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
|
] })
|
|
@@ -298,7 +298,7 @@ const I = ({
|
|
|
298
298
|
g.append(C(d)), c("0");
|
|
299
299
|
},
|
|
300
300
|
children: [
|
|
301
|
-
/* @__PURE__ */ s.jsx(
|
|
301
|
+
/* @__PURE__ */ s.jsx(E, { className: "inline-block mr-1", size: "14px" }),
|
|
302
302
|
"Add"
|
|
303
303
|
]
|
|
304
304
|
}
|
|
@@ -347,12 +347,12 @@ const I = ({
|
|
|
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,9 +390,9 @@ const I = ({
|
|
|
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
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",
|
|
@@ -405,27 +405,27 @@ const I = ({
|
|
|
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
|
-
var
|
|
416
|
-
const { collection: r } = G(), [t, n] =
|
|
415
|
+
var I, M, D;
|
|
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
|
-
fieldState:
|
|
419
|
-
} =
|
|
418
|
+
fieldState: N
|
|
419
|
+
} = ue({
|
|
420
420
|
name: u,
|
|
421
|
-
rules:
|
|
422
|
-
}), Z = !!(e != null && e.required), ee = (
|
|
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 {
|
|
426
426
|
const _ = await (r == null ? void 0 : r.getCollectionContentList({
|
|
427
427
|
collection_key: g,
|
|
428
|
-
page:
|
|
428
|
+
page: T,
|
|
429
429
|
search: y,
|
|
430
430
|
limit: 10
|
|
431
431
|
})), k = (S = _ == null ? void 0 : _.content) == null ? void 0 : S.data, V = (k || []).map((m) => {
|
|
@@ -443,7 +443,7 @@ const I = ({
|
|
|
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: T + 1
|
|
447
447
|
}
|
|
448
448
|
};
|
|
449
449
|
} catch {
|
|
@@ -451,7 +451,7 @@ const I = ({
|
|
|
451
451
|
options: [],
|
|
452
452
|
hasMore: !1,
|
|
453
453
|
additional: {
|
|
454
|
-
page:
|
|
454
|
+
page: T
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
457
|
} finally {
|
|
@@ -473,9 +473,9 @@ const I = ({
|
|
|
473
473
|
helperText: o,
|
|
474
474
|
readOnly: c,
|
|
475
475
|
children: [
|
|
476
|
-
d && /* @__PURE__ */ s.jsx(
|
|
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 I = ({
|
|
|
502
502
|
]
|
|
503
503
|
}
|
|
504
504
|
);
|
|
505
|
-
},
|
|
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
|
-
), Ee = h(() => import("./SwitchWidget-
|
|
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
|
}) => {
|
|
@@ -530,13 +530,13 @@ const I = ({
|
|
|
530
530
|
return null;
|
|
531
531
|
switch (t) {
|
|
532
532
|
case a.TextWidget:
|
|
533
|
-
return /* @__PURE__ */ s.jsx(
|
|
533
|
+
return /* @__PURE__ */ s.jsx(H, { field: e });
|
|
534
534
|
case a.NumberWidget:
|
|
535
|
-
return /* @__PURE__ */ s.jsx(
|
|
535
|
+
return /* @__PURE__ */ s.jsx(H, { type: "number", field: e });
|
|
536
536
|
case a.CurrencyWidget:
|
|
537
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,28 +546,28 @@ const I = ({
|
|
|
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
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,
|
|
571
571
|
{
|
|
572
572
|
field: e,
|
|
573
573
|
isMultiple: !1,
|
|
@@ -577,7 +577,7 @@ const I = ({
|
|
|
577
577
|
);
|
|
578
578
|
case a.MultiImageUploadWidget:
|
|
579
579
|
return /* @__PURE__ */ s.jsx(
|
|
580
|
-
|
|
580
|
+
R,
|
|
581
581
|
{
|
|
582
582
|
field: e,
|
|
583
583
|
isMultiple: !0,
|
|
@@ -587,11 +587,21 @@ const I = ({
|
|
|
587
587
|
);
|
|
588
588
|
case a.FileUploadWidget:
|
|
589
589
|
return /* @__PURE__ */ s.jsx(
|
|
590
|
-
|
|
590
|
+
R,
|
|
591
591
|
{
|
|
592
592
|
field: e,
|
|
593
593
|
isMultiple: !1,
|
|
594
|
-
kind: ["document"],
|
|
594
|
+
kind: ["audio", "video", "image", "document"],
|
|
595
|
+
isExternal: !r
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
case a.MultiFileUploadWidget:
|
|
599
|
+
return /* @__PURE__ */ s.jsx(
|
|
600
|
+
R,
|
|
601
|
+
{
|
|
602
|
+
field: e,
|
|
603
|
+
isMultiple: !0,
|
|
604
|
+
kind: ["audio", "video", "image", "document"],
|
|
595
605
|
isExternal: !r
|
|
596
606
|
}
|
|
597
607
|
);
|
|
@@ -600,17 +610,17 @@ const I = ({
|
|
|
600
610
|
"[LevoCollection]: Error while rendering collection widget. Collection key of label field key is required."
|
|
601
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(
|
|
602
612
|
"[LevoCollection]: Error while rendering collection widget. Field options not set correctly."
|
|
603
|
-
), null) : /* @__PURE__ */ s.jsx(
|
|
613
|
+
), null) : /* @__PURE__ */ s.jsx(Ie, { field: e });
|
|
604
614
|
default:
|
|
605
615
|
return null;
|
|
606
616
|
}
|
|
607
|
-
},
|
|
617
|
+
}, Oe = ({
|
|
608
618
|
field: e,
|
|
609
619
|
isInternal: r
|
|
610
620
|
}) => {
|
|
611
621
|
const { key: t = "", label: n = "", field_interface: i = "", fields: d = [] } = e;
|
|
612
622
|
return !i || !t ? null : /* @__PURE__ */ s.jsxs("div", { className: "w-full", children: [
|
|
613
|
-
/* @__PURE__ */ s.jsx(
|
|
623
|
+
/* @__PURE__ */ s.jsx(A, { className: "text-md font-medium mb-4", children: n }),
|
|
614
624
|
/* @__PURE__ */ s.jsx("div", { className: "border rounded bg-secondary/40 flex flex-col px-3 py-4 gap-3", children: d.map((o) => {
|
|
615
625
|
const c = {
|
|
616
626
|
...o,
|
|
@@ -634,16 +644,16 @@ const I = ({
|
|
|
634
644
|
case a.ArrayWidget:
|
|
635
645
|
return /* @__PURE__ */ s.jsx(Ce, { ...e });
|
|
636
646
|
case a.RecordWidget:
|
|
637
|
-
return /* @__PURE__ */ s.jsx(Ge, { ...e });
|
|
638
|
-
default:
|
|
639
647
|
return /* @__PURE__ */ s.jsx(Oe, { ...e });
|
|
648
|
+
default:
|
|
649
|
+
return /* @__PURE__ */ s.jsx(Fe, { ...e });
|
|
640
650
|
}
|
|
641
651
|
}, Q = j.createContext({
|
|
642
652
|
schema: null,
|
|
643
653
|
submitButtonConfig: {
|
|
644
654
|
show: !0
|
|
645
655
|
}
|
|
646
|
-
}),
|
|
656
|
+
}), Ge = ({
|
|
647
657
|
children: e,
|
|
648
658
|
...r
|
|
649
659
|
}) => {
|
|
@@ -657,16 +667,16 @@ const I = ({
|
|
|
657
667
|
/* @__PURE__ */ s.jsx("div", { ref: i }),
|
|
658
668
|
e
|
|
659
669
|
] });
|
|
660
|
-
},
|
|
661
|
-
() => import("./DefaultFormVariant-
|
|
662
|
-
),
|
|
663
|
-
() => import("./StepsFormVariant-
|
|
664
|
-
),
|
|
670
|
+
}, Wt = () => j.useContext(Q), Ke = j.lazy(
|
|
671
|
+
() => import("./DefaultFormVariant-Bxbh1yc0.js")
|
|
672
|
+
), Je = j.lazy(
|
|
673
|
+
() => import("./StepsFormVariant-CzS2wbMD.js")
|
|
674
|
+
), Qe = ({
|
|
665
675
|
formVariant: e,
|
|
666
676
|
...r
|
|
667
677
|
}) => {
|
|
668
678
|
const { schema: t, uiConfig: n } = r;
|
|
669
|
-
return /* @__PURE__ */ s.jsxs(
|
|
679
|
+
return /* @__PURE__ */ s.jsxs(Ge, { ...r, children: [
|
|
670
680
|
n != null && n.hideFormHeading ? null : /* @__PURE__ */ s.jsxs(
|
|
671
681
|
"h1",
|
|
672
682
|
{
|
|
@@ -680,15 +690,15 @@ const I = ({
|
|
|
680
690
|
]
|
|
681
691
|
}
|
|
682
692
|
),
|
|
683
|
-
/* @__PURE__ */ s.jsx(
|
|
693
|
+
/* @__PURE__ */ s.jsx(ie, { children: e === "steps" ? /* @__PURE__ */ s.jsx(Je, {}) : /* @__PURE__ */ s.jsx(Ke, {}) })
|
|
684
694
|
] });
|
|
685
|
-
},
|
|
695
|
+
}, bt = ({
|
|
686
696
|
collection_id: e,
|
|
687
697
|
hiddenFields: r,
|
|
688
698
|
...t
|
|
689
699
|
}) => {
|
|
690
|
-
const { collection: n } = G(), [i, d] =
|
|
691
|
-
return
|
|
700
|
+
const { collection: n } = G(), [i, d] = L(!0), [o, c] = L(null);
|
|
701
|
+
return le(() => {
|
|
692
702
|
e ? n == null || n.getCollectionByIDExpanded(e, {
|
|
693
703
|
headers: {
|
|
694
704
|
"Levo-Workspace": t == null ? void 0 : t.workspace_id
|
|
@@ -712,27 +722,26 @@ const I = ({
|
|
|
712
722
|
}) : (console.error(
|
|
713
723
|
"[CollectionFormBuilder] Collection ID or Workspace ID is missing."
|
|
714
724
|
), d(!1));
|
|
715
|
-
}, [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 });
|
|
716
726
|
};
|
|
717
727
|
export {
|
|
718
|
-
|
|
728
|
+
bt as C,
|
|
719
729
|
J as F,
|
|
720
|
-
|
|
730
|
+
ft as H,
|
|
721
731
|
K as a,
|
|
722
|
-
|
|
732
|
+
mt as b,
|
|
723
733
|
B as c,
|
|
724
|
-
|
|
734
|
+
ht as d,
|
|
725
735
|
ve as e,
|
|
726
|
-
|
|
736
|
+
yt as f,
|
|
727
737
|
C as g,
|
|
728
|
-
|
|
738
|
+
_e as h,
|
|
729
739
|
we as i,
|
|
730
740
|
Ae as j,
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
bt as m,
|
|
741
|
+
A as k,
|
|
742
|
+
Wt as l,
|
|
734
743
|
z as p,
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
744
|
+
xt as s,
|
|
745
|
+
pt as u,
|
|
746
|
+
gt as v
|
|
738
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-jwwjyIpv.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
|
}
|