@levo-so/react 0.1.0 → 0.1.1
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-CD4lv7B4.js → CheckboxWidget-ComdVcZ_.js} +1 -1
- package/dist/{CollectionFormBuilder-a0pzMkWL.js → CollectionFormBuilder-jwwjyIpv.js} +69 -65
- package/dist/{CurrencyWidget-DRMqUgbP.js → CurrencyWidget-DVqD_lsY.js} +1 -1
- package/dist/DateTimeWidget-CvgzwY1U.js +80 -0
- package/dist/{DefaultFormVariant-BzHB74Ie.js → DefaultFormVariant-CbRB9O_e.js} +2 -2
- package/dist/{DropdownWidget-CW0GSjwE.js → DropdownWidget-C2YaM9Cf.js} +1 -1
- package/dist/EmailWidget-BBthwF68.js +41 -0
- package/dist/{GeocoderWidget-Ib15NJcx.js → GeocoderWidget-Dht_2vi6.js} +1 -1
- package/dist/{MultiGeocoderWidget-BuW8i48_.js → MultiGeocoderWidget-paCFW0QZ.js} +2 -2
- package/dist/{PhoneWidget-COo3SBNU.js → PhoneWidget-CP2T2JDx.js} +1 -1
- package/dist/{RadioWidget-C8syq1dO.js → RadioWidget-BuFPz7kK.js} +1 -1
- package/dist/{RichTextWidget-B5qxi5OE.js → RichTextWidget-DGFNZ1jl.js} +14 -13
- package/dist/{StepsFormVariant-NSTSIoVV.js → StepsFormVariant-5_c3f2Vk.js} +2 -2
- package/dist/{SwitchWidget-C-p7lICr.js → SwitchWidget-t8iwhxk9.js} +1 -1
- package/dist/TextWidget-D0UBxTxe.js +33 -0
- package/dist/{TextareaWidget-D0TbFUjX.js → TextareaWidget-CG6J_plD.js} +1 -1
- package/dist/{ToggleCheckboxWidget-BbVq_dAC.js → ToggleCheckboxWidget-dl8ks4VX.js} +1 -1
- package/dist/{URLWidget-00u8Svwt.js → URLWidget-CHeUEUXl.js} +2 -2
- package/dist/{UploadWidget-Dim2TEFc.js → UploadWidget-CzYGViqE.js} +1 -1
- package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts +3 -5
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts +2 -3
- package/dist/collection/components/widgets/emailWidget/EmailWidget.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 +2 -3
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/utils/formHelpers.d.ts +1 -1
- package/dist/collection/utils/formHelpers.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{useLevoForm-CR3q-L5Z.js → useLevoForm-BcN8f66y.js} +1 -1
- package/package.json +20 -14
- package/dist/DateTimeWidget-FmBvE_lk.js +0 -103
- package/dist/EmailWidget-Nyc76pT8.js +0 -42
- package/dist/TextWidget-BtZp3DRk.js +0 -34
|
@@ -2,7 +2,7 @@
|
|
|
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 { h as E, j as I, k as u } from "./CollectionFormBuilder-
|
|
5
|
+
import { h as E, j as I, k as u } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
6
6
|
import { C as w } from "./Checbox-sq-atGlJ.js";
|
|
7
7
|
import { I as O } from "./Input-2CvZ90f8.js";
|
|
8
8
|
import { c as _ } from "./cn-C9QoOYNG.js";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as s } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
-
import { FieldInterfaces as a, defaultByKinds as
|
|
4
|
-
import { G as
|
|
3
|
+
import { FieldInterfaces as a, defaultByKinds as F, formatsByInterface as se, interfaceKinds as oe, FieldInterfacesList as ae } from "@levo-so/core";
|
|
4
|
+
import { G as O, T as ie, a as le, c as ce, B as v, d as ue, r as de, s as ge, S as me } from "./Spinner-CuUosd-S.js";
|
|
5
5
|
import j, { useState as R, lazy as h, Suspense as he, useEffect as pe } from "react";
|
|
6
6
|
import { useFieldArray as xe, useController as ye } from "react-hook-form";
|
|
7
7
|
import { Mate as $ } from "@theinternetfolks/mate";
|
|
8
8
|
import { Snowflake as fe } from "@theinternetfolks/snowflake";
|
|
9
|
-
import
|
|
9
|
+
import We from "google-libphonenumber";
|
|
10
10
|
import P from "validator";
|
|
11
11
|
import w from "validatorjs";
|
|
12
12
|
import { c as f } from "./cn-C9QoOYNG.js";
|
|
13
13
|
import { u as G } from "./LevoProvider-DNbYyEaf.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as be from "inflection";
|
|
15
15
|
import { useInView as je } from "react-intersection-observer";
|
|
16
|
-
const { PhoneNumberUtil: ke } =
|
|
16
|
+
const { PhoneNumberUtil: ke } = We, ve = (e) => {
|
|
17
17
|
const r = [];
|
|
18
18
|
for (const t of Object.keys(e))
|
|
19
19
|
for (const n of (e == null ? void 0 : e[t]) || [])
|
|
@@ -21,7 +21,7 @@ const { PhoneNumberUtil: ke } = be, ve = (e) => {
|
|
|
21
21
|
return r;
|
|
22
22
|
}, z = ke.getInstance(), we = (e) => {
|
|
23
23
|
try {
|
|
24
|
-
return z.isValidNumber(z.parseAndKeepRawInput(e));
|
|
24
|
+
return e && (e == null ? void 0 : e.trim().length) > 3 ? z.isValidNumber(z.parseAndKeepRawInput(e)) : !0;
|
|
25
25
|
} catch {
|
|
26
26
|
return !1;
|
|
27
27
|
}
|
|
@@ -82,7 +82,7 @@ const { PhoneNumberUtil: ke } = be, ve = (e) => {
|
|
|
82
82
|
var t, n;
|
|
83
83
|
const r = {};
|
|
84
84
|
for (const i of e)
|
|
85
|
-
r[i.key] = (t =
|
|
85
|
+
r[i.key] = (t = F) == null ? void 0 : t[i == null ? void 0 : i.kind], (i == null ? void 0 : i.field_interface) === a.RecordWidget && ((n = i == null ? void 0 : i.fields) != null && n.length) && (r[i.key] = C(i.fields));
|
|
86
86
|
return r;
|
|
87
87
|
}, ht = (e) => {
|
|
88
88
|
var t;
|
|
@@ -137,7 +137,7 @@ const { PhoneNumberUtil: ke } = be, ve = (e) => {
|
|
|
137
137
|
values: [],
|
|
138
138
|
editable: !0
|
|
139
139
|
}
|
|
140
|
-
]), t.kind = oe[r] || "string", t.default_value || (t.default_value =
|
|
140
|
+
]), t.kind = oe[r] || "string", t.default_value || (t.default_value = F[t.kind] || null), r !== a.CollectionWidget && ae.includes(r) && (t.field_interface = r), { field: t, fieldFocused: n };
|
|
141
141
|
}, yt = (e, r) => {
|
|
142
142
|
var d;
|
|
143
143
|
const t = { ...e }, n = [], i = "_id";
|
|
@@ -166,13 +166,13 @@ const { PhoneNumberUtil: ke } = be, ve = (e) => {
|
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
|
-
function
|
|
170
|
-
return
|
|
169
|
+
function Wt(e) {
|
|
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 H(e) {
|
|
173
|
-
return
|
|
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 I = ({
|
|
176
176
|
children: e,
|
|
177
177
|
isRequired: r,
|
|
178
178
|
className: t,
|
|
@@ -200,7 +200,7 @@ const L = ({
|
|
|
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(
|
|
203
|
+
/* @__PURE__ */ s.jsx(I, { className: "text-md font-medium mb-4", children: n }),
|
|
204
204
|
u && Array.isArray(u) ? /* @__PURE__ */ s.jsxs(ie, { value: o, onValueChange: c, className: "w-full", children: [
|
|
205
205
|
/* @__PURE__ */ s.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
|
|
206
206
|
u.length ? /* @__PURE__ */ s.jsx(le, { 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(
|
|
@@ -235,14 +235,14 @@ const L = ({
|
|
|
235
235
|
value: l.toString(),
|
|
236
236
|
children: [
|
|
237
237
|
/* @__PURE__ */ s.jsx("div", { className: "flex flex-col px-3 py-2 gap-3", children: d.map((p) => {
|
|
238
|
-
const
|
|
238
|
+
const b = {
|
|
239
239
|
...p,
|
|
240
240
|
key: `${t}.${l}.${p == null ? void 0 : p.key}`
|
|
241
241
|
};
|
|
242
242
|
return /* @__PURE__ */ s.jsx(
|
|
243
243
|
J,
|
|
244
244
|
{
|
|
245
|
-
field:
|
|
245
|
+
field: b,
|
|
246
246
|
isInternal: r
|
|
247
247
|
},
|
|
248
248
|
`common-fields-${p == null ? void 0 : p.id}`
|
|
@@ -334,7 +334,7 @@ const L = ({
|
|
|
334
334
|
},
|
|
335
335
|
validate: (i) => {
|
|
336
336
|
var c, u;
|
|
337
|
-
if ((c = e == null ? void 0 : e.options) != null && c.disableValidation)
|
|
337
|
+
if ((c = e == null ? void 0 : e.options) != null && c.disableValidation || !i)
|
|
338
338
|
return !0;
|
|
339
339
|
const d = K(
|
|
340
340
|
{
|
|
@@ -347,12 +347,12 @@ const L = ({
|
|
|
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 = _e,
|
|
350
|
+
}, Re = _e, Le = j.lazy(
|
|
351
351
|
() => import("react-select-async-paginate").then((e) => ({
|
|
352
352
|
default: e.AsyncPaginate
|
|
353
353
|
}))
|
|
354
354
|
), Ne = (e) => /* @__PURE__ */ s.jsx(
|
|
355
|
-
|
|
355
|
+
Le,
|
|
356
356
|
{
|
|
357
357
|
isClearable: !0,
|
|
358
358
|
menuPlacement: "auto",
|
|
@@ -390,9 +390,9 @@ const L = ({
|
|
|
390
390
|
},
|
|
391
391
|
...e
|
|
392
392
|
}
|
|
393
|
-
),
|
|
393
|
+
), Te = ({
|
|
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 }), Ie = ({
|
|
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,8 +405,8 @@ const L = ({
|
|
|
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(Te, { children: e }) }),
|
|
409
|
+
r && /* @__PURE__ */ s.jsx("div", { className: f("w-full mt-3"), children: /* @__PURE__ */ s.jsx(Ie, { children: r }) })
|
|
410
410
|
] })
|
|
411
411
|
}
|
|
412
412
|
)), De = ({
|
|
@@ -414,12 +414,12 @@ const L = ({
|
|
|
414
414
|
}) => {
|
|
415
415
|
var A, D, M;
|
|
416
416
|
const { collection: r } = G(), [t, n] = R(!1), { key: i = "", label: d = "", helper_text: o = "", readonly: c = !1 } = e, u = i, g = ((A = e == null ? void 0 : e.options) == null ? void 0 : A.collection_key) || "", x = ((D = e == null ? void 0 : e.options) == null ? void 0 : D.label_field_key) || "", {
|
|
417
|
-
field: { value: l, onBlur: p, onChange:
|
|
418
|
-
fieldState:
|
|
417
|
+
field: { value: l, onBlur: p, onChange: b, ref: W, disabled: X, ...Y },
|
|
418
|
+
fieldState: L
|
|
419
419
|
} = ye({
|
|
420
420
|
name: u,
|
|
421
421
|
rules: Re(e)
|
|
422
|
-
}), Z = !!(e != null && e.required), ee = (M =
|
|
422
|
+
}), Z = !!(e != null && e.required), ee = (M = L == null ? void 0 : L.error) == null ? void 0 : M.message, te = async (y, Ye, { page: N = 1 }) => {
|
|
423
423
|
var S;
|
|
424
424
|
n(!0);
|
|
425
425
|
try {
|
|
@@ -468,19 +468,19 @@ const L = ({
|
|
|
468
468
|
return /* @__PURE__ */ s.jsxs(
|
|
469
469
|
Ae,
|
|
470
470
|
{
|
|
471
|
-
ref:
|
|
471
|
+
ref: W,
|
|
472
472
|
error: ee,
|
|
473
473
|
helperText: o,
|
|
474
474
|
readOnly: c,
|
|
475
475
|
children: [
|
|
476
|
-
d && /* @__PURE__ */ s.jsx(
|
|
476
|
+
d && /* @__PURE__ */ s.jsx(I, { htmlFor: u, isRequired: Z, children: d }),
|
|
477
477
|
/* @__PURE__ */ s.jsx(
|
|
478
478
|
Ne,
|
|
479
479
|
{
|
|
480
480
|
id: u,
|
|
481
481
|
value: re,
|
|
482
482
|
onChange: (y) => {
|
|
483
|
-
|
|
483
|
+
b((y == null ? void 0 : y.value) || null);
|
|
484
484
|
},
|
|
485
485
|
onBlur: () => {
|
|
486
486
|
p();
|
|
@@ -502,25 +502,25 @@ const L = ({
|
|
|
502
502
|
]
|
|
503
503
|
}
|
|
504
504
|
);
|
|
505
|
-
},
|
|
506
|
-
() => import("./CurrencyWidget-
|
|
505
|
+
}, E = h(() => import("./TextWidget-D0UBxTxe.js")), Me = h(
|
|
506
|
+
() => import("./CurrencyWidget-DVqD_lsY.js")
|
|
507
507
|
), Se = h(
|
|
508
|
-
() => import("./CheckboxWidget-
|
|
509
|
-
),
|
|
510
|
-
() => import("./DateTimeWidget-
|
|
508
|
+
() => import("./CheckboxWidget-ComdVcZ_.js")
|
|
509
|
+
), U = h(
|
|
510
|
+
() => import("./DateTimeWidget-CvgzwY1U.js")
|
|
511
511
|
), q = h(
|
|
512
|
-
() => import("./DropdownWidget-
|
|
513
|
-
), Ve = h(() => import("./EmailWidget-
|
|
514
|
-
() => import("./GeocoderWidget-
|
|
512
|
+
() => import("./DropdownWidget-C2YaM9Cf.js")
|
|
513
|
+
), Ve = h(() => import("./EmailWidget-BBthwF68.js")), $e = h(
|
|
514
|
+
() => import("./GeocoderWidget-Dht_2vi6.js")
|
|
515
515
|
), Pe = h(
|
|
516
|
-
() => import("./MultiGeocoderWidget-
|
|
517
|
-
), ze = h(() => import("./PhoneWidget-
|
|
518
|
-
() => import("./RichTextWidget-
|
|
519
|
-
),
|
|
520
|
-
() => import("./TextareaWidget-
|
|
516
|
+
() => import("./MultiGeocoderWidget-paCFW0QZ.js")
|
|
517
|
+
), ze = h(() => import("./PhoneWidget-CP2T2JDx.js")), Be = h(() => import("./RadioWidget-BuFPz7kK.js")), He = h(
|
|
518
|
+
() => import("./RichTextWidget-DGFNZ1jl.js")
|
|
519
|
+
), Ee = h(() => import("./SwitchWidget-t8iwhxk9.js")), Ue = h(
|
|
520
|
+
() => import("./TextareaWidget-CG6J_plD.js")
|
|
521
521
|
), qe = h(
|
|
522
|
-
() => import("./ToggleCheckboxWidget-
|
|
523
|
-
),
|
|
522
|
+
() => import("./ToggleCheckboxWidget-dl8ks4VX.js")
|
|
523
|
+
), Fe = h(() => import("./URLWidget-CHeUEUXl.js")), T = h(() => import("./UploadWidget-CzYGViqE.js")), Oe = ({
|
|
524
524
|
field: e,
|
|
525
525
|
isInternal: r
|
|
526
526
|
}) => {
|
|
@@ -530,17 +530,17 @@ const L = ({
|
|
|
530
530
|
return null;
|
|
531
531
|
switch (t) {
|
|
532
532
|
case a.TextWidget:
|
|
533
|
-
return /* @__PURE__ */ s.jsx(
|
|
533
|
+
return /* @__PURE__ */ s.jsx(E, { field: e });
|
|
534
534
|
case a.NumberWidget:
|
|
535
|
-
return /* @__PURE__ */ s.jsx(
|
|
535
|
+
return /* @__PURE__ */ s.jsx(E, { type: "number", field: e });
|
|
536
536
|
case a.CurrencyWidget:
|
|
537
537
|
return /* @__PURE__ */ s.jsx(Me, { field: e });
|
|
538
538
|
case a.CheckboxWidget:
|
|
539
539
|
return /* @__PURE__ */ s.jsx(Se, { field: e });
|
|
540
540
|
case a.DateTimeWidget:
|
|
541
|
-
return /* @__PURE__ */ s.jsx(
|
|
541
|
+
return /* @__PURE__ */ s.jsx(U, { field: e });
|
|
542
542
|
case a.DateWidget:
|
|
543
|
-
return /* @__PURE__ */ s.jsx(
|
|
543
|
+
return /* @__PURE__ */ s.jsx(U, { field: e });
|
|
544
544
|
case a.DropdownWidget:
|
|
545
545
|
return /* @__PURE__ */ s.jsx(q, { field: e, isMulti: !1 });
|
|
546
546
|
case a.MultiDropdownWidget:
|
|
@@ -558,16 +558,16 @@ const L = ({
|
|
|
558
558
|
case a.RichTextWidget:
|
|
559
559
|
return /* @__PURE__ */ s.jsx(He, { field: e });
|
|
560
560
|
case a.SwitchWidget:
|
|
561
|
-
return /* @__PURE__ */ s.jsx(Ue, { field: e });
|
|
562
|
-
case a.TextareaWidget:
|
|
563
561
|
return /* @__PURE__ */ s.jsx(Ee, { field: e });
|
|
562
|
+
case a.TextareaWidget:
|
|
563
|
+
return /* @__PURE__ */ s.jsx(Ue, { field: e });
|
|
564
564
|
case a.ToggleCheckboxWidget:
|
|
565
565
|
return /* @__PURE__ */ s.jsx(qe, { field: e });
|
|
566
566
|
case a.URLWidget:
|
|
567
|
-
return /* @__PURE__ */ s.jsx(
|
|
567
|
+
return /* @__PURE__ */ s.jsx(Fe, { field: e });
|
|
568
568
|
case a.ImageUploadWidget:
|
|
569
569
|
return /* @__PURE__ */ s.jsx(
|
|
570
|
-
|
|
570
|
+
T,
|
|
571
571
|
{
|
|
572
572
|
field: e,
|
|
573
573
|
isMultiple: !1,
|
|
@@ -577,7 +577,7 @@ const L = ({
|
|
|
577
577
|
);
|
|
578
578
|
case a.MultiImageUploadWidget:
|
|
579
579
|
return /* @__PURE__ */ s.jsx(
|
|
580
|
-
|
|
580
|
+
T,
|
|
581
581
|
{
|
|
582
582
|
field: e,
|
|
583
583
|
isMultiple: !0,
|
|
@@ -587,7 +587,7 @@ const L = ({
|
|
|
587
587
|
);
|
|
588
588
|
case a.FileUploadWidget:
|
|
589
589
|
return /* @__PURE__ */ s.jsx(
|
|
590
|
-
|
|
590
|
+
T,
|
|
591
591
|
{
|
|
592
592
|
field: e,
|
|
593
593
|
isMultiple: !1,
|
|
@@ -596,7 +596,11 @@ const L = ({
|
|
|
596
596
|
}
|
|
597
597
|
);
|
|
598
598
|
case a.CollectionWidget:
|
|
599
|
-
return !((i = e == null ? void 0 : e.options) != null && i.collection_key) || !((d = e == null ? void 0 : e.options) != null && d.label_field_key)
|
|
599
|
+
return !((i = e == null ? void 0 : e.options) != null && i.collection_key) || !((d = e == null ? void 0 : e.options) != null && d.label_field_key) ? (console.error(
|
|
600
|
+
"[LevoCollection]: Error while rendering collection widget. Collection key of label field key is required."
|
|
601
|
+
), 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
|
+
"[LevoCollection]: Error while rendering collection widget. Field options not set correctly."
|
|
603
|
+
), null) : /* @__PURE__ */ s.jsx(De, { field: e });
|
|
600
604
|
default:
|
|
601
605
|
return null;
|
|
602
606
|
}
|
|
@@ -606,7 +610,7 @@ const L = ({
|
|
|
606
610
|
}) => {
|
|
607
611
|
const { key: t = "", label: n = "", field_interface: i = "", fields: d = [] } = e;
|
|
608
612
|
return !i || !t ? null : /* @__PURE__ */ s.jsxs("div", { className: "w-full", children: [
|
|
609
|
-
/* @__PURE__ */ s.jsx(
|
|
613
|
+
/* @__PURE__ */ s.jsx(I, { className: "text-md font-medium mb-4", children: n }),
|
|
610
614
|
/* @__PURE__ */ s.jsx("div", { className: "border rounded bg-secondary/40 flex flex-col px-3 py-4 gap-3", children: d.map((o) => {
|
|
611
615
|
const c = {
|
|
612
616
|
...o,
|
|
@@ -632,7 +636,7 @@ const L = ({
|
|
|
632
636
|
case a.RecordWidget:
|
|
633
637
|
return /* @__PURE__ */ s.jsx(Ge, { ...e });
|
|
634
638
|
default:
|
|
635
|
-
return /* @__PURE__ */ s.jsx(
|
|
639
|
+
return /* @__PURE__ */ s.jsx(Oe, { ...e });
|
|
636
640
|
}
|
|
637
641
|
}, Q = j.createContext({
|
|
638
642
|
schema: null,
|
|
@@ -653,10 +657,10 @@ const L = ({
|
|
|
653
657
|
/* @__PURE__ */ s.jsx("div", { ref: i }),
|
|
654
658
|
e
|
|
655
659
|
] });
|
|
656
|
-
},
|
|
657
|
-
() => import("./DefaultFormVariant-
|
|
660
|
+
}, bt = () => j.useContext(Q), Je = j.lazy(
|
|
661
|
+
() => import("./DefaultFormVariant-CbRB9O_e.js")
|
|
658
662
|
), Qe = j.lazy(
|
|
659
|
-
() => import("./StepsFormVariant-
|
|
663
|
+
() => import("./StepsFormVariant-5_c3f2Vk.js")
|
|
660
664
|
), Xe = ({
|
|
661
665
|
formVariant: e,
|
|
662
666
|
...r
|
|
@@ -672,7 +676,7 @@ const L = ({
|
|
|
672
676
|
),
|
|
673
677
|
children: [
|
|
674
678
|
"Create new ",
|
|
675
|
-
|
|
679
|
+
be.singularize((t == null ? void 0 : t.name) || "")
|
|
676
680
|
]
|
|
677
681
|
}
|
|
678
682
|
),
|
|
@@ -695,8 +699,8 @@ const L = ({
|
|
|
695
699
|
if (g)
|
|
696
700
|
g.sections = (l = g == null ? void 0 : g.sections) == null ? void 0 : l.map(
|
|
697
701
|
(p) => {
|
|
698
|
-
var
|
|
699
|
-
return p.fields = (
|
|
702
|
+
var b;
|
|
703
|
+
return p.fields = (b = p == null ? void 0 : p.fields) == null ? void 0 : b.map((W) => (r != null && r.includes(W == null ? void 0 : W.key) && (W.hidden = !0), W)), p;
|
|
700
704
|
}
|
|
701
705
|
), c(g);
|
|
702
706
|
else
|
|
@@ -713,7 +717,7 @@ const L = ({
|
|
|
713
717
|
export {
|
|
714
718
|
jt as C,
|
|
715
719
|
J as F,
|
|
716
|
-
|
|
720
|
+
Wt as H,
|
|
717
721
|
K as a,
|
|
718
722
|
ht as b,
|
|
719
723
|
B as c,
|
|
@@ -724,9 +728,9 @@ export {
|
|
|
724
728
|
Re as h,
|
|
725
729
|
we as i,
|
|
726
730
|
Ae as j,
|
|
727
|
-
|
|
731
|
+
I as k,
|
|
728
732
|
_e as l,
|
|
729
|
-
|
|
733
|
+
bt as m,
|
|
730
734
|
z as p,
|
|
731
735
|
yt as s,
|
|
732
736
|
xt as u,
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { h as w, j as C, k } from "./CollectionFormBuilder-
|
|
4
|
+
import { h as w, j as C, k } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
5
5
|
import { c as N } from "./cn-C9QoOYNG.js";
|
|
6
6
|
const V = ({
|
|
7
7
|
field: r,
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { j as r } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
+
import { Calendar as b, X as w } from "lucide-react";
|
|
3
|
+
import * as l from "react-datepicker";
|
|
4
|
+
import { FieldInterfaces as N } from "@levo-so/core";
|
|
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
|
+
import { c as p } from "./cn-C9QoOYNG.js";
|
|
9
|
+
const T = l.default.default || l.default || l, I = (e) => {
|
|
10
|
+
if (e) {
|
|
11
|
+
const o = new Date(e);
|
|
12
|
+
return Number.isNaN(o.getTime()) ? null : o;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}, B = ({ field: e }) => {
|
|
16
|
+
var d;
|
|
17
|
+
const { key: o = "", label: m = "", helper_text: f = "", readonly: x = !1 } = e, n = o, {
|
|
18
|
+
field: { value: i, onBlur: u, onChange: s, ref: h, ...j },
|
|
19
|
+
fieldState: a
|
|
20
|
+
} = v({
|
|
21
|
+
name: n,
|
|
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) === N.DateTimeWidget;
|
|
24
|
+
return /* @__PURE__ */ r.jsxs(D, { helperText: f, readOnly: x, error: g, children: [
|
|
25
|
+
m && /* @__PURE__ */ r.jsx(C, { htmlFor: n, isRequired: y, children: m }),
|
|
26
|
+
/* @__PURE__ */ r.jsxs("div", { className: "w-full relative rounded-md", children: [
|
|
27
|
+
/* @__PURE__ */ r.jsx(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: p(
|
|
31
|
+
"absolute left-0 top-0 bottom-0 w-9 flex items-center justify-center rounded-l-md overflow-hidden pointer-events-none"
|
|
32
|
+
),
|
|
33
|
+
children: /* @__PURE__ */ r.jsx(b, { size: "20px", className: "text-muted-foreground" })
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ r.jsx(
|
|
37
|
+
T,
|
|
38
|
+
{
|
|
39
|
+
id: n,
|
|
40
|
+
selected: I(i),
|
|
41
|
+
onChange: (t) => {
|
|
42
|
+
s && s((t == null ? void 0 : t.toISOString()) || null);
|
|
43
|
+
},
|
|
44
|
+
onBlur: () => {
|
|
45
|
+
u && u();
|
|
46
|
+
},
|
|
47
|
+
className: "w-full pl-8",
|
|
48
|
+
showTimeSelect: c,
|
|
49
|
+
customInput: /* @__PURE__ */ r.jsx(F, { ref: h }),
|
|
50
|
+
autoComplete: "off",
|
|
51
|
+
dateFormat: c ? "d MMMM, yyyy h:mm aa" : "d MMMM, yyyy",
|
|
52
|
+
popperPlacement: "bottom-start",
|
|
53
|
+
showPopperArrow: !1,
|
|
54
|
+
...j
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
i && /* @__PURE__ */ r.jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: p(
|
|
61
|
+
"absolute right-0 top-0 bottom-0 w-9 z-10 flex items-center justify-center rounded-l-md overflow-hidden"
|
|
62
|
+
),
|
|
63
|
+
children: /* @__PURE__ */ r.jsx(
|
|
64
|
+
"button",
|
|
65
|
+
{
|
|
66
|
+
type: "button",
|
|
67
|
+
onClick: (t) => {
|
|
68
|
+
t == null || t.preventDefault(), t == null || t.stopPropagation(), s && s(null);
|
|
69
|
+
},
|
|
70
|
+
children: /* @__PURE__ */ r.jsx(w, { size: "20px", className: "text-muted-foreground" })
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] })
|
|
76
|
+
] });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
B as default
|
|
80
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
4
|
-
import { u as F, S as N } from "./useLevoForm-
|
|
3
|
+
import { m as b, F as y } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
4
|
+
import { u as F, S as N } from "./useLevoForm-BcN8f66y.js";
|
|
5
5
|
import { c as m } from "./cn-C9QoOYNG.js";
|
|
6
6
|
import { B as g } from "./Spinner-CuUosd-S.js";
|
|
7
7
|
const E = () => {
|
|
@@ -3,7 +3,7 @@ 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-
|
|
6
|
+
import { h as N, j as q, k as B } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
7
7
|
import { I as L } from "./Input-2CvZ90f8.js";
|
|
8
8
|
import { c as x } from "./cn-C9QoOYNG.js";
|
|
9
9
|
const G = ({
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { j as r } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
+
import { useController as y } from "react-hook-form";
|
|
3
|
+
import { G as C } from "./Spinner-CuUosd-S.js";
|
|
4
|
+
import { h as F, j as I, k as V } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
5
|
+
import { I as b } from "./Input-2CvZ90f8.js";
|
|
6
|
+
function w(e) {
|
|
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);
|
|
8
|
+
}
|
|
9
|
+
const k = ({ field: e, ...c }) => {
|
|
10
|
+
var l;
|
|
11
|
+
const { key: u = "", label: s = "", helper_text: d = "", readonly: h = !1 } = e, t = u, {
|
|
12
|
+
field: { value: p, onBlur: x, onChange: g, ...f },
|
|
13
|
+
fieldState: a
|
|
14
|
+
} = y({
|
|
15
|
+
name: t,
|
|
16
|
+
rules: F(e)
|
|
17
|
+
}), j = !!(e != null && e.required), v = (l = a == null ? void 0 : a.error) == null ? void 0 : l.message;
|
|
18
|
+
return /* @__PURE__ */ r.jsxs(I, { error: v, helperText: d, children: [
|
|
19
|
+
s && /* @__PURE__ */ r.jsx(V, { htmlFor: t, isRequired: j, children: s }),
|
|
20
|
+
/* @__PURE__ */ r.jsx(
|
|
21
|
+
b,
|
|
22
|
+
{
|
|
23
|
+
id: t,
|
|
24
|
+
type: "email",
|
|
25
|
+
leftIcon: /* @__PURE__ */ r.jsx("div", { className: "w-full h-full flex items-center justify-center bg-muted", children: /* @__PURE__ */ r.jsx(w, { size: "20px", className: "text-muted-foreground" }) }),
|
|
26
|
+
value: p || "",
|
|
27
|
+
onChange: (o) => {
|
|
28
|
+
var n, i, m;
|
|
29
|
+
return g((m = (i = (n = o == null ? void 0 : o.target) == null ? void 0 : n.value) == null ? void 0 : i.trim()) == null ? void 0 : m.toLocaleLowerCase());
|
|
30
|
+
},
|
|
31
|
+
onBlur: x,
|
|
32
|
+
readOnly: h,
|
|
33
|
+
...f,
|
|
34
|
+
...c
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] });
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
k as default
|
|
41
|
+
};
|
|
@@ -3,7 +3,7 @@ import { j as h } from "./jsx-runtime-B6kdoens.js";
|
|
|
3
3
|
import le, { useState as J, useEffect as fe } from "react";
|
|
4
4
|
import { useController as de } from "react-hook-form";
|
|
5
5
|
import { q as pe } from "./Spinner-CuUosd-S.js";
|
|
6
|
-
import { h as ge, j as me, k as ye } from "./CollectionFormBuilder-
|
|
6
|
+
import { h as ge, j as me, k as ye } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
7
7
|
import { I as _e } from "./Input-2CvZ90f8.js";
|
|
8
8
|
var U = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ne = {}, ve = "Expected a function", Y = NaN, be = "[object Symbol]", Se = /^\s+|\s+$/g, Pe = /^[-+]0x[0-9a-f]+$/i, Oe = /^0b[01]+$/i, he = /^0o[0-7]+$/i, Te = parseInt, je = typeof U == "object" && U && U.Object === Object && U, xe = typeof self == "object" && self && self.Object === Object && self, Ae = je || xe || Function("return this")(), Le = Object.prototype, Ee = Le.toString, we = Math.max, Ie = Math.min, $ = function() {
|
|
9
9
|
return Ae.Date.now();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
3
3
|
import { useFieldArray as m } from "react-hook-form";
|
|
4
|
-
import { k as n } from "./CollectionFormBuilder-
|
|
4
|
+
import { k as n } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
5
5
|
import { Plus as c } from "lucide-react";
|
|
6
|
-
import { GeocoderWidget as d } from "./GeocoderWidget-
|
|
6
|
+
import { GeocoderWidget as d } from "./GeocoderWidget-Dht_2vi6.js";
|
|
7
7
|
import { B as p } from "./Spinner-CuUosd-S.js";
|
|
8
8
|
const g = ({
|
|
9
9
|
field: l
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { j as o } from "./jsx-runtime-B6kdoens.js";
|
|
3
3
|
import { useController as f } from "react-hook-form";
|
|
4
4
|
import { PhoneInput as g } from "react-international-phone";
|
|
5
|
-
import { h as x, j as v, k as j } from "./CollectionFormBuilder-
|
|
5
|
+
import { h as x, j as v, k as j } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
6
6
|
import { c as l } from "./cn-C9QoOYNG.js";
|
|
7
7
|
const q = ({ field: e }) => {
|
|
8
8
|
const { key: u = "", label: n = "", helper_text: c = "", readonly: t = !1 } = e, s = u, {
|
|
@@ -4,7 +4,7 @@ import * as n from "@radix-ui/react-radio-group";
|
|
|
4
4
|
import * as d from "react";
|
|
5
5
|
import { useController as F } from "react-hook-form";
|
|
6
6
|
import { G as E } from "./Spinner-CuUosd-S.js";
|
|
7
|
-
import { h as G, j as V, k as f } from "./CollectionFormBuilder-
|
|
7
|
+
import { h as G, j as V, k as f } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
8
8
|
import { I as q } from "./Input-2CvZ90f8.js";
|
|
9
9
|
import { c as N } from "./cn-C9QoOYNG.js";
|
|
10
10
|
function B(s) {
|
|
@@ -3,11 +3,11 @@ import { j as l } from "./jsx-runtime-B6kdoens.js";
|
|
|
3
3
|
import B from "@tiptap/extension-bold";
|
|
4
4
|
import d from "@tiptap/extension-bullet-list";
|
|
5
5
|
import w from "@tiptap/extension-document";
|
|
6
|
-
import { HardBreak as
|
|
7
|
-
import
|
|
6
|
+
import { HardBreak as y } from "@tiptap/extension-hard-break";
|
|
7
|
+
import z from "@tiptap/extension-history";
|
|
8
8
|
import S from "@tiptap/extension-italic";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import R from "@tiptap/extension-link";
|
|
10
|
+
import M from "@tiptap/extension-list-item";
|
|
11
11
|
import U from "@tiptap/extension-ordered-list";
|
|
12
12
|
import T from "@tiptap/extension-paragraph";
|
|
13
13
|
import H from "@tiptap/extension-strike";
|
|
@@ -18,7 +18,7 @@ import { useEditor as I, EditorContent as E } from "@tiptap/react";
|
|
|
18
18
|
import { useState as D, useEffect as G } from "react";
|
|
19
19
|
import { useController as q } from "react-hook-form";
|
|
20
20
|
import { G as p, e as J, f as V, g as W, h as Z, i as _, j as P, k as K, l as Q, m as X, n as Y, o as $, p as nn } from "./Spinner-CuUosd-S.js";
|
|
21
|
-
import { h as ln, j as en, k as sn } from "./CollectionFormBuilder-
|
|
21
|
+
import { h as ln, j as en, k as sn } from "./CollectionFormBuilder-jwwjyIpv.js";
|
|
22
22
|
import { c as j } from "./cn-C9QoOYNG.js";
|
|
23
23
|
function an(n) {
|
|
24
24
|
return p({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 0 0-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z" }, child: [] }] })(n);
|
|
@@ -222,7 +222,7 @@ const e = ({
|
|
|
222
222
|
)
|
|
223
223
|
] })
|
|
224
224
|
] });
|
|
225
|
-
},
|
|
225
|
+
}, Rn = ({ field: n }) => {
|
|
226
226
|
var b;
|
|
227
227
|
const [c, t] = D(!1), { key: i = "", label: u = "", helper_text: r = "", readonly: h = !1 } = n, o = i, {
|
|
228
228
|
field: { value: x, onBlur: k, onChange: L, ...m },
|
|
@@ -241,9 +241,9 @@ const e = ({
|
|
|
241
241
|
H,
|
|
242
242
|
U,
|
|
243
243
|
d,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
M,
|
|
245
|
+
y,
|
|
246
|
+
R.configure({
|
|
247
247
|
HTMLAttributes: {
|
|
248
248
|
target: "_blank"
|
|
249
249
|
},
|
|
@@ -252,7 +252,7 @@ const e = ({
|
|
|
252
252
|
O.configure({
|
|
253
253
|
types: ["heading", "paragraph"]
|
|
254
254
|
}),
|
|
255
|
-
|
|
255
|
+
z
|
|
256
256
|
],
|
|
257
257
|
content: x,
|
|
258
258
|
editable: !m.disabled && !h,
|
|
@@ -262,7 +262,8 @@ const e = ({
|
|
|
262
262
|
onUpdate: ({ editor: f }) => {
|
|
263
263
|
const C = f.getHTML();
|
|
264
264
|
L(C);
|
|
265
|
-
}
|
|
265
|
+
},
|
|
266
|
+
immediatelyRender: !1
|
|
266
267
|
});
|
|
267
268
|
return G(() => {
|
|
268
269
|
s != null && s.commands && !c && (s.commands.setContent(x || ""), t(!0));
|
|
@@ -303,7 +304,7 @@ const e = ({
|
|
|
303
304
|
] });
|
|
304
305
|
};
|
|
305
306
|
export {
|
|
306
|
-
|
|
307
|
+
Rn as RichTextWidget,
|
|
307
308
|
e as ToolbarButton,
|
|
308
|
-
|
|
309
|
+
Rn as default
|
|
309
310
|
};
|