@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
|
@@ -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-jwwjyIpv.js";
|
|
4
|
-
import { u as F, S as N } from "./useLevoForm-BcN8f66y.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-jwwjyIpv.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);
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as h } from "./jsx-runtime-B6kdoens.js";
|
|
3
3
|
import le, { useState as J, useEffect as fe } from "react";
|
|
4
|
+
import { c as U } from "./LevoProvider-Cp0CKrgY.js";
|
|
4
5
|
import { useController as de } from "react-hook-form";
|
|
5
|
-
import { q as pe } from "./Spinner-
|
|
6
|
-
import { h as ge, j as me, k as ye } from "./CollectionFormBuilder-
|
|
6
|
+
import { q as pe } from "./Spinner-DzGH5rKe.js";
|
|
7
|
+
import { h as ge, j as me, k as ye } from "./CollectionFormBuilder-B_dXpvPN.js";
|
|
7
8
|
import { I as _e } from "./Input-2CvZ90f8.js";
|
|
8
|
-
var
|
|
9
|
+
var ne = {}, ve = "Expected a function", Y = NaN, be = "[object Symbol]", Se = /^\s+|\s+$/g, Pe = /^[-+]0x[0-9a-f]+$/i, Oe = /^0b[01]+$/i, he = /^0o[0-7]+$/i, Te = parseInt, je = typeof U == "object" && U && U.Object === Object && U, xe = typeof self == "object" && self && self.Object === Object && self, Ae = je || xe || Function("return this")(), Le = Object.prototype, Ee = Le.toString, Ie = Math.max, we = Math.min, $ = function() {
|
|
9
10
|
return Ae.Date.now();
|
|
10
11
|
};
|
|
11
|
-
function Ce(e,
|
|
12
|
-
var n, a, c, u, s, l,
|
|
12
|
+
function Ce(e, r, t) {
|
|
13
|
+
var n, a, c, u, s, l, m = 0, d = !1, v = !1, T = !0;
|
|
13
14
|
if (typeof e != "function")
|
|
14
15
|
throw new TypeError(ve);
|
|
15
|
-
|
|
16
|
+
r = Z(r) || 0, q(t) && (d = !!t.leading, v = "maxWait" in t, c = v ? Ie(Z(t.maxWait) || 0, r) : c, T = "trailing" in t ? !!t.trailing : T);
|
|
16
17
|
function P(i) {
|
|
17
18
|
var o = n, f = a;
|
|
18
|
-
return n = a = void 0,
|
|
19
|
+
return n = a = void 0, m = i, u = e.apply(f, o), u;
|
|
19
20
|
}
|
|
20
21
|
function j(i) {
|
|
21
|
-
return
|
|
22
|
+
return m = i, s = setTimeout(y, r), d ? P(i) : u;
|
|
22
23
|
}
|
|
23
24
|
function A(i) {
|
|
24
|
-
var o = i - l, f = i -
|
|
25
|
-
return v ?
|
|
25
|
+
var o = i - l, f = i - m, O = r - o;
|
|
26
|
+
return v ? we(O, c - f) : O;
|
|
26
27
|
}
|
|
27
28
|
function L(i) {
|
|
28
|
-
var o = i - l, f = i -
|
|
29
|
-
return l === void 0 || o >=
|
|
29
|
+
var o = i - l, f = i - m;
|
|
30
|
+
return l === void 0 || o >= r || o < 0 || v && f >= c;
|
|
30
31
|
}
|
|
31
32
|
function y() {
|
|
32
33
|
var i = $();
|
|
@@ -38,9 +39,9 @@ function Ce(e, t, r) {
|
|
|
38
39
|
return s = void 0, T && n ? P(i) : (n = a = void 0, u);
|
|
39
40
|
}
|
|
40
41
|
function E() {
|
|
41
|
-
s !== void 0 && clearTimeout(s),
|
|
42
|
+
s !== void 0 && clearTimeout(s), m = 0, n = l = a = s = void 0;
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function I() {
|
|
44
45
|
return s === void 0 ? u : b($());
|
|
45
46
|
}
|
|
46
47
|
function S() {
|
|
@@ -49,15 +50,15 @@ function Ce(e, t, r) {
|
|
|
49
50
|
if (s === void 0)
|
|
50
51
|
return j(l);
|
|
51
52
|
if (v)
|
|
52
|
-
return s = setTimeout(y,
|
|
53
|
+
return s = setTimeout(y, r), P(l);
|
|
53
54
|
}
|
|
54
|
-
return s === void 0 && (s = setTimeout(y,
|
|
55
|
+
return s === void 0 && (s = setTimeout(y, r)), u;
|
|
55
56
|
}
|
|
56
|
-
return S.cancel = E, S.flush =
|
|
57
|
+
return S.cancel = E, S.flush = I, S;
|
|
57
58
|
}
|
|
58
59
|
function q(e) {
|
|
59
|
-
var
|
|
60
|
-
return !!e && (
|
|
60
|
+
var r = typeof e;
|
|
61
|
+
return !!e && (r == "object" || r == "function");
|
|
61
62
|
}
|
|
62
63
|
function Me(e) {
|
|
63
64
|
return !!e && typeof e == "object";
|
|
@@ -71,14 +72,14 @@ function Z(e) {
|
|
|
71
72
|
if (ke(e))
|
|
72
73
|
return Y;
|
|
73
74
|
if (q(e)) {
|
|
74
|
-
var
|
|
75
|
-
e = q(
|
|
75
|
+
var r = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
76
|
+
e = q(r) ? r + "" : r;
|
|
76
77
|
}
|
|
77
78
|
if (typeof e != "string")
|
|
78
79
|
return e === 0 ? e : +e;
|
|
79
80
|
e = e.replace(Se, "");
|
|
80
|
-
var
|
|
81
|
-
return
|
|
81
|
+
var t = Oe.test(e);
|
|
82
|
+
return t || he.test(e) ? Te(e.slice(2), t ? 2 : 8) : Pe.test(e) ? Y : +e;
|
|
82
83
|
}
|
|
83
84
|
var Ge = Ce, k = {};
|
|
84
85
|
Object.defineProperty(k, "__esModule", {
|
|
@@ -87,10 +88,10 @@ Object.defineProperty(k, "__esModule", {
|
|
|
87
88
|
k.loadGoogleMapScript = k.isBrowser = void 0;
|
|
88
89
|
var oe = typeof window < "u" && window.document;
|
|
89
90
|
k.isBrowser = oe;
|
|
90
|
-
var Re = function(
|
|
91
|
+
var Re = function(r, t) {
|
|
91
92
|
if (!oe || typeof google < "u" && google.maps && google.maps.api)
|
|
92
93
|
return Promise.resolve();
|
|
93
|
-
var n = document.querySelectorAll('script[src*="'.concat(
|
|
94
|
+
var n = document.querySelectorAll('script[src*="'.concat(r, '"]'));
|
|
94
95
|
if (n && n.length)
|
|
95
96
|
return new Promise(function(u) {
|
|
96
97
|
if (typeof google < "u") return u();
|
|
@@ -98,7 +99,7 @@ var Re = function(t, r) {
|
|
|
98
99
|
return u();
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
|
-
var a = new URL(
|
|
102
|
+
var a = new URL(t);
|
|
102
103
|
a.searchParams.set("callback", "__REACT_GOOGLE_AUTOCOMPLETE_CALLBACK__");
|
|
103
104
|
var c = document.createElement("script");
|
|
104
105
|
return c.src = a.toString(), new Promise(function(u) {
|
|
@@ -116,67 +117,67 @@ N.GOOGLE_MAP_SCRIPT_BASE_URL = Be;
|
|
|
116
117
|
Object.defineProperty(ne, "__esModule", {
|
|
117
118
|
value: !0
|
|
118
119
|
});
|
|
119
|
-
var Ue = ne.default = Ve,
|
|
120
|
+
var Ue = ne.default = Ve, g = le, D = Qe(Ge), ee = k, Ne = N;
|
|
120
121
|
function Qe(e) {
|
|
121
122
|
return e && e.__esModule ? e : { default: e };
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
-
var
|
|
124
|
+
function re(e, r) {
|
|
125
|
+
var t = Object.keys(e);
|
|
125
126
|
if (Object.getOwnPropertySymbols) {
|
|
126
127
|
var n = Object.getOwnPropertySymbols(e);
|
|
127
|
-
|
|
128
|
+
r && (n = n.filter(function(a) {
|
|
128
129
|
return Object.getOwnPropertyDescriptor(e, a).enumerable;
|
|
129
|
-
})),
|
|
130
|
+
})), t.push.apply(t, n);
|
|
130
131
|
}
|
|
131
|
-
return
|
|
132
|
+
return t;
|
|
132
133
|
}
|
|
133
134
|
function C(e) {
|
|
134
|
-
for (var
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
$e(e, n,
|
|
138
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(
|
|
139
|
-
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(
|
|
135
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
136
|
+
var t = arguments[r] != null ? arguments[r] : {};
|
|
137
|
+
r % 2 ? re(Object(t), !0).forEach(function(n) {
|
|
138
|
+
$e(e, n, t[n]);
|
|
139
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : re(Object(t)).forEach(function(n) {
|
|
140
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n));
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
143
|
return e;
|
|
143
144
|
}
|
|
144
|
-
function $e(e,
|
|
145
|
-
return
|
|
145
|
+
function $e(e, r, t) {
|
|
146
|
+
return r in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e;
|
|
146
147
|
}
|
|
147
|
-
function M(e,
|
|
148
|
-
return We(e) || Ke(e,
|
|
148
|
+
function M(e, r) {
|
|
149
|
+
return We(e) || Ke(e, r) || Fe(e, r) || qe();
|
|
149
150
|
}
|
|
150
151
|
function qe() {
|
|
151
152
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
152
153
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
153
154
|
}
|
|
154
|
-
function Fe(e,
|
|
155
|
+
function Fe(e, r) {
|
|
155
156
|
if (e) {
|
|
156
|
-
if (typeof e == "string") return
|
|
157
|
-
var
|
|
158
|
-
if (
|
|
159
|
-
if (
|
|
157
|
+
if (typeof e == "string") return te(e, r);
|
|
158
|
+
var t = Object.prototype.toString.call(e).slice(8, -1);
|
|
159
|
+
if (t === "Object" && e.constructor && (t = e.constructor.name), t === "Map" || t === "Set") return Array.from(e);
|
|
160
|
+
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return te(e, r);
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
-
(
|
|
164
|
-
for (var
|
|
165
|
-
n[
|
|
163
|
+
function te(e, r) {
|
|
164
|
+
(r == null || r > e.length) && (r = e.length);
|
|
165
|
+
for (var t = 0, n = new Array(r); t < r; t++)
|
|
166
|
+
n[t] = e[t];
|
|
166
167
|
return n;
|
|
167
168
|
}
|
|
168
|
-
function Ke(e,
|
|
169
|
-
var
|
|
170
|
-
if (
|
|
169
|
+
function Ke(e, r) {
|
|
170
|
+
var t = e && (typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"]);
|
|
171
|
+
if (t != null) {
|
|
171
172
|
var n = [], a = !0, c = !1, u, s;
|
|
172
173
|
try {
|
|
173
|
-
for (
|
|
174
|
+
for (t = t.call(e); !(a = (u = t.next()).done) && (n.push(u.value), !(r && n.length === r)); a = !0)
|
|
174
175
|
;
|
|
175
176
|
} catch (l) {
|
|
176
177
|
c = !0, s = l;
|
|
177
178
|
} finally {
|
|
178
179
|
try {
|
|
179
|
-
!a &&
|
|
180
|
+
!a && t.return != null && t.return();
|
|
180
181
|
} finally {
|
|
181
182
|
if (c) throw s;
|
|
182
183
|
}
|
|
@@ -188,37 +189,37 @@ function We(e) {
|
|
|
188
189
|
if (Array.isArray(e)) return e;
|
|
189
190
|
}
|
|
190
191
|
function Ve(e) {
|
|
191
|
-
var
|
|
192
|
+
var r = e.apiKey, t = e.libraries, n = t === void 0 ? "places" : t, a = e.googleMapsScriptBaseUrl, c = a === void 0 ? Ne.GOOGLE_MAP_SCRIPT_BASE_URL : a, u = e.debounce, s = u === void 0 ? 300 : u, l = e.options, m = l === void 0 ? {} : l, d = e.sessionToken, v = e.language, T = v ? "&language=".concat(v) : "", P = "".concat(c, "?key=").concat(r, "&libraries=").concat(n).concat(T), j = (0, g.useState)([]), A = M(j, 2), L = A[0], y = A[1], b = (0, g.useState)(!1), E = M(b, 2), I = E[0], S = E[1], i = (0, g.useState)(null), o = M(i, 2), f = o[0], O = o[1], R = (0, g.useState)(!1), G = M(R, 2), B = G[0], Q = G[1], ie = (0, g.useState)(!1), F = M(ie, 2), ae = F[0], K = F[1], se = (0, g.useState)([]), W = M(se, 2), ue = W[0], V = W[1], w = (0, g.useRef)(null), H = (0, g.useRef)(null), x = (0, g.useRef)(null), ce = (0, g.useCallback)(function() {
|
|
192
193
|
return (0, ee.loadGoogleMapScript)(c, P);
|
|
193
|
-
}, [c, P]), z = (0,
|
|
194
|
-
|
|
194
|
+
}, [c, P]), z = (0, g.useCallback)((0, D.default)(function(_) {
|
|
195
|
+
w.current && _.input && w.current.getPlacePredictions(C(C(C({}, d && x.current ? {
|
|
195
196
|
sessionToken: x.current
|
|
196
|
-
} : {}),
|
|
197
|
+
} : {}), m), _), function(p) {
|
|
197
198
|
S(!1), y(p || []);
|
|
198
199
|
});
|
|
199
|
-
}, s), [s]), X = (0,
|
|
200
|
-
|
|
200
|
+
}, s), [s]), X = (0, g.useCallback)((0, D.default)(function(_) {
|
|
201
|
+
w.current && _.input && w.current.getQueryPredictions(C(C(C({}, d && x.current ? {
|
|
201
202
|
sessionToken: x.current
|
|
202
|
-
} : {}),
|
|
203
|
+
} : {}), m), _), function(p) {
|
|
203
204
|
Q(!1), V(p || []);
|
|
204
205
|
});
|
|
205
206
|
}, s), [s]);
|
|
206
|
-
return (0,
|
|
207
|
+
return (0, g.useEffect)(function() {
|
|
207
208
|
if (ee.isBrowser) {
|
|
208
209
|
var _ = function() {
|
|
209
210
|
if (!google) return console.error("Google has not been found. Make sure your provide apiKey prop.");
|
|
210
|
-
|
|
211
|
+
w.current = new google.maps.places.AutocompleteService(), H.current = new google.maps.places.PlacesService(document.createElement("div")), d && (x.current = new google.maps.places.AutocompleteSessionToken());
|
|
211
212
|
};
|
|
212
|
-
|
|
213
|
+
r ? ce().then(function() {
|
|
213
214
|
return _();
|
|
214
215
|
}) : _();
|
|
215
216
|
}
|
|
216
217
|
}, []), {
|
|
217
218
|
placesService: H.current,
|
|
218
219
|
autocompleteSessionToken: x.current,
|
|
219
|
-
placesAutocompleteService:
|
|
220
|
+
placesAutocompleteService: w.current,
|
|
220
221
|
placePredictions: f ? L : [],
|
|
221
|
-
isPlacePredictionsLoading:
|
|
222
|
+
isPlacePredictionsLoading: I,
|
|
222
223
|
getPlacePredictions: function(p) {
|
|
223
224
|
if (p.input) {
|
|
224
225
|
O(p.input), S(!0), z(p);
|
|
@@ -240,19 +241,19 @@ function Ve(e) {
|
|
|
240
241
|
}
|
|
241
242
|
};
|
|
242
243
|
}
|
|
243
|
-
const
|
|
244
|
+
const er = ({ field: e }) => {
|
|
244
245
|
var i;
|
|
245
|
-
const [
|
|
246
|
+
const [r, t] = J(""), [n, a] = J(!1), { key: c = "", label: u = "", helper_text: s = "", readonly: l = !1 } = e, m = c, {
|
|
246
247
|
field: { value: d, onBlur: v, onChange: T, ...P },
|
|
247
248
|
fieldState: j
|
|
248
249
|
} = de({
|
|
249
|
-
name:
|
|
250
|
+
name: m,
|
|
250
251
|
rules: ge(e)
|
|
251
252
|
}), A = !!(e != null && e.required), L = (i = j == null ? void 0 : j.error) == null ? void 0 : i.message, {
|
|
252
253
|
placesService: y,
|
|
253
254
|
placePredictions: b,
|
|
254
255
|
getPlacePredictions: E,
|
|
255
|
-
isPlacePredictionsLoading:
|
|
256
|
+
isPlacePredictionsLoading: I
|
|
256
257
|
} = Ue({
|
|
257
258
|
apiKey: process.env.NEXT_PUBLIC_GOOGLE_MAPS,
|
|
258
259
|
debounce: 200
|
|
@@ -263,7 +264,7 @@ const De = ({ field: e }) => {
|
|
|
263
264
|
},
|
|
264
265
|
(f) => {
|
|
265
266
|
var O, R, G, B;
|
|
266
|
-
T(
|
|
267
|
+
T({
|
|
267
268
|
...f,
|
|
268
269
|
place_name: o == null ? void 0 : o.description,
|
|
269
270
|
latitude: ((R = (O = f == null ? void 0 : f.geometry) == null ? void 0 : O.location) == null ? void 0 : R.lat()) || 0,
|
|
@@ -273,26 +274,26 @@ const De = ({ field: e }) => {
|
|
|
273
274
|
), a(!0);
|
|
274
275
|
};
|
|
275
276
|
return fe(() => {
|
|
276
|
-
d != null && d.place_name && (
|
|
277
|
+
d != null && d.place_name && (t(d == null ? void 0 : d.place_name), a(!0));
|
|
277
278
|
}, [d]), /* @__PURE__ */ h.jsx(me, { error: L, helperText: s, readOnly: l, children: /* @__PURE__ */ h.jsxs("div", { className: "w-full relative", children: [
|
|
278
|
-
u && /* @__PURE__ */ h.jsx(ye, { htmlFor:
|
|
279
|
+
u && /* @__PURE__ */ h.jsx(ye, { htmlFor: m, isRequired: A, children: u }),
|
|
279
280
|
/* @__PURE__ */ h.jsx(
|
|
280
281
|
_e,
|
|
281
282
|
{
|
|
282
|
-
id:
|
|
283
|
-
value:
|
|
283
|
+
id: m,
|
|
284
|
+
value: r,
|
|
284
285
|
onChange: (o) => {
|
|
285
|
-
a(!1), E({ input: o.target.value }),
|
|
286
|
+
a(!1), E({ input: o.target.value }), t(o.target.value);
|
|
286
287
|
},
|
|
287
288
|
onBlur: () => {
|
|
288
289
|
v();
|
|
289
290
|
},
|
|
290
|
-
rightIcon:
|
|
291
|
+
rightIcon: I && /* @__PURE__ */ h.jsx(pe, { size: "20px", className: "animate-spin" }),
|
|
291
292
|
readOnly: l,
|
|
292
293
|
...P
|
|
293
294
|
}
|
|
294
295
|
),
|
|
295
|
-
|
|
296
|
+
r && !I && !n && /* @__PURE__ */ h.jsx("div", { className: "absolute bg-white left-[-1px] z-50 p-[4px] w-full shadow-[0_0_8px_rgba(0,0,0,0.25)] rounded-[6px]", children: b != null && b.length ? b.map((o) => /* @__PURE__ */ h.jsx(
|
|
296
297
|
"p",
|
|
297
298
|
{
|
|
298
299
|
className: "text-md p-[8px] cursor-pointer rounded-[6px] hover:bg-gray-200",
|
|
@@ -304,6 +305,6 @@ const De = ({ field: e }) => {
|
|
|
304
305
|
] }) });
|
|
305
306
|
};
|
|
306
307
|
export {
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
er as GeocoderWidget,
|
|
309
|
+
er as default
|
|
309
310
|
};
|