@levo-so/react 0.1.14 → 0.1.15

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.
Files changed (73) hide show
  1. package/dist/CheckboxWidget-BGS61gcL.js +124 -0
  2. package/dist/CollectionFormBuilder-BIvx_z08.js +1197 -0
  3. package/dist/{CurrencyWidget-COoMkfsA.js → CurrencyWidget-sD8ijLvw.js} +5 -5
  4. package/dist/{DateTimeWidget-DcbQ3smI.js → DateTimeWidget-KrcsxgEF.js} +3 -3
  5. package/dist/DefaultFormVariant-j1HgVDiI.js +127 -0
  6. package/dist/DropdownWidget-rm5oUqOE.js +113 -0
  7. package/dist/{EmailWidget-CG9oNUM5.js → EmailWidget-CvZKOywL.js} +11 -11
  8. package/dist/GeocoderWidget-CSsp_-hW.js +68 -0
  9. package/dist/{LevoProvider-BI6g_T4E.js → LevoProvider-Do3jjJ4j.js} +0 -1
  10. package/dist/{MultiGeocoderWidget-D3Xmv8g4.js → MultiGeocoderWidget-Blqz-lHX.js} +6 -6
  11. package/dist/{MultiTextWidget-CyQRcWC8.js → MultiTextWidget-CxVpyf06.js} +14 -14
  12. package/dist/{PhoneWidget-C1Jt7kXL.js → PhoneWidget-DezcchSP.js} +5 -5
  13. package/dist/{RadioWidget-BrLNF-I2.js → RadioWidget-SfD1fFDG.js} +9 -9
  14. package/dist/{RichTextWidget-BogYcPtS.js → RichTextWidget-Cg3RizdO.js} +21 -21
  15. package/dist/Spinner-Bzu2xCFZ.js +405 -0
  16. package/dist/{StepsFormVariant-Bx-jdciC.js → StepsFormVariant-D35dFYK6.js} +9 -9
  17. package/dist/{SwitchWidget-BT0-waP9.js → SwitchWidget-Id6BNlPe.js} +5 -5
  18. package/dist/{TextWidget-Bvsz-hey.js → TextWidget-CtFaQde1.js} +7 -7
  19. package/dist/{TextareaWidget-8SLym--T.js → TextareaWidget-BKzAeMod.js} +3 -3
  20. package/dist/{ToggleCheckboxWidget-VrCQBF5C.js → ToggleCheckboxWidget-nSlie9sE.js} +7 -7
  21. package/dist/Tooltip-DEBnSqlo.js +36 -0
  22. package/dist/{URLWidget-B99nKr6N.js → URLWidget-DtJai3xY.js} +2 -2
  23. package/dist/UploadWidget-Dxx2_FYo.js +616 -0
  24. package/dist/audience/components/page.d.ts.map +1 -1
  25. package/dist/audience/index.js +1 -1
  26. package/dist/collection/components/Altcha.d.ts +10 -0
  27. package/dist/collection/components/Altcha.d.ts.map +1 -0
  28. package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
  29. package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +1 -1
  30. package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -1
  31. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts +7 -0
  32. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts.map +1 -0
  33. package/dist/collection/components/widgets/collectionWidget/{CollectionWidget.d.ts → CollectionWidgetM2O.d.ts} +1 -1
  34. package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2O.d.ts.map +1 -0
  35. package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts +8 -0
  36. package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts.map +1 -0
  37. package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -1
  38. package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +1 -1
  39. package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts +11 -0
  40. package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts.map +1 -0
  41. package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -1
  42. package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -1
  43. package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -1
  44. package/dist/collection/index.js +13 -12
  45. package/dist/collection/lib/hooks/useLevoForm.d.ts +2 -1
  46. package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -1
  47. package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -1
  48. package/dist/collection/utils/formHelpers.d.ts.map +1 -1
  49. package/dist/collection/utils/index.d.ts +2 -0
  50. package/dist/collection/utils/index.d.ts.map +1 -1
  51. package/dist/components/Table.d.ts +11 -0
  52. package/dist/components/Table.d.ts.map +1 -0
  53. package/dist/components/index.js +29 -29
  54. package/dist/constants/fileUploadPresets.d.ts +4 -2
  55. package/dist/constants/fileUploadPresets.d.ts.map +1 -1
  56. package/dist/index.css +1 -1
  57. package/dist/index.js +75 -75
  58. package/dist/membership/index.js +1 -1
  59. package/dist/page-DgqTELmZ.js +212 -0
  60. package/dist/useLevoForm-3jSJ9I6v.js +170 -0
  61. package/package.json +8 -7
  62. package/dist/CheckboxWidget-BctVOZiO.js +0 -118
  63. package/dist/CollectionFormBuilder-B6CAVKhg.js +0 -772
  64. package/dist/DefaultFormVariant-C6zbKgwB.js +0 -80
  65. package/dist/DropdownWidget-DszCTSWr.js +0 -115
  66. package/dist/GeocoderWidget-CXu17A7y.js +0 -310
  67. package/dist/Spinner-DzGH5rKe.js +0 -297
  68. package/dist/Tooltip-CI4i4mYr.js +0 -144
  69. package/dist/UploadWidget-ZebPWZZZ.js +0 -505
  70. package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts.map +0 -1
  71. package/dist/fileUploadPresets-2raQmHT0.js +0 -74
  72. package/dist/page-yeiAPg3O.js +0 -200
  73. package/dist/useLevoForm-DjvUas25.js +0 -166
@@ -2,23 +2,23 @@ import { j as t } from "./jsx-runtime-B6kdoens.js";
2
2
  import { useController as j } from "react-hook-form";
3
3
  import { NumericFormat as F } from "react-number-format";
4
4
  import { c as w } from "./cn-C9QoOYNG.js";
5
- import { h as C, j as k, k as N } from "./CollectionFormBuilder-B6CAVKhg.js";
5
+ import { z as C, A as B, B as N } from "./CollectionFormBuilder-BIvx_z08.js";
6
6
  const V = ({
7
7
  field: r,
8
8
  ...m
9
9
  }) => {
10
10
  var u, c;
11
11
  const { key: d = "", label: n = "", helper_text: p = "", readonly: e = !1 } = r, o = d, {
12
- field: { value: f, onBlur: a, onChange: l, ref: h, ...x },
12
+ field: { value: f, onBlur: a, onChange: l, ref: x, ...h },
13
13
  fieldState: s
14
14
  } = j({
15
15
  name: o,
16
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
- k,
19
+ B,
20
20
  {
21
- ref: h,
21
+ ref: x,
22
22
  error: g,
23
23
  helperText: p,
24
24
  readOnly: e,
@@ -46,7 +46,7 @@ const V = ({
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
  ),
49
- ...x,
49
+ ...h,
50
50
  ...m
51
51
  }
52
52
  )
@@ -4,7 +4,7 @@ import { Calendar as w, X as N } from "lucide-react";
4
4
  import * as l from "react-datepicker";
5
5
  import { useController as v } from "react-hook-form";
6
6
  import { c as p } from "./cn-C9QoOYNG.js";
7
- import { h as M, j as D, k as C } from "./CollectionFormBuilder-B6CAVKhg.js";
7
+ import { z as M, A as D, B as C } from "./CollectionFormBuilder-BIvx_z08.js";
8
8
  import { I as F } from "./Input-2CvZ90f8.js";
9
9
  const T = l.default.default || l.default || l, I = (e) => {
10
10
  if (e) {
@@ -12,7 +12,7 @@ const T = l.default.default || l.default || l, I = (e) => {
12
12
  return Number.isNaN(o.getTime()) ? null : o;
13
13
  }
14
14
  return null;
15
- }, B = ({ field: e }) => {
15
+ }, q = ({ field: e }) => {
16
16
  var d;
17
17
  const { key: o = "", label: m = "", helper_text: f = "", readonly: x = !1 } = e, n = o, {
18
18
  field: { value: i, onBlur: u, onChange: s, ref: h, ...j },
@@ -76,5 +76,5 @@ const T = l.default.default || l.default || l, I = (e) => {
76
76
  ] });
77
77
  };
78
78
  export {
79
- B as default
79
+ q as default
80
80
  };
@@ -0,0 +1,127 @@
1
+ import { j as l } from "./jsx-runtime-B6kdoens.js";
2
+ import { forwardRef as L, useRef as v, useState as j, useImperativeHandle as N, useEffect as R } from "react";
3
+ import { FormProvider as b } from "react-hook-form";
4
+ import { c as u } from "./cn-C9QoOYNG.js";
5
+ import { D as E, F as D } from "./CollectionFormBuilder-BIvx_z08.js";
6
+ import { u as I, S as A } from "./useLevoForm-3jSJ9I6v.js";
7
+ import "altcha";
8
+ import { u as H } from "./LevoProvider-Do3jjJ4j.js";
9
+ import { B as T } from "./Spinner-Bzu2xCFZ.js";
10
+ const U = L(
11
+ ({ onStateChange: a, challengeurl: f, verifyurl: i }, n) => {
12
+ const e = v(null), [c, d] = j(null);
13
+ return N(
14
+ n,
15
+ () => ({
16
+ get value() {
17
+ return c;
18
+ }
19
+ }),
20
+ [c]
21
+ ), R(() => {
22
+ const m = (o) => {
23
+ "detail" in o && (d(o.detail.state || null), a == null || a(o));
24
+ }, { current: r } = e;
25
+ if (r)
26
+ return r.addEventListener("statechange", m), () => r.removeEventListener("statechange", m);
27
+ }, [a]), /* @__PURE__ */ l.jsx(
28
+ "altcha-widget",
29
+ {
30
+ ref: e,
31
+ style: {
32
+ "--altcha-max-width": "100%"
33
+ },
34
+ hidelogo: !0,
35
+ auto: "onfocus",
36
+ hidefooter: !0,
37
+ challengeurl: f,
38
+ verifyurl: i
39
+ }
40
+ );
41
+ }
42
+ ), O = () => {
43
+ var p;
44
+ const {
45
+ schema: a,
46
+ containerStyles: f,
47
+ uiConfig: i,
48
+ isInternal: n,
49
+ submitButtonConfig: e,
50
+ isDisabled: c
51
+ } = E(), { client: d } = H(), m = v(null), [r, o] = j(null), {
52
+ methods: h,
53
+ allFormValues: y,
54
+ isError: g,
55
+ isLoading: w,
56
+ handleContentId: S,
57
+ handleSubmit: V
58
+ } = I({
59
+ schema: a,
60
+ saveToRemote: !0,
61
+ captchaValue: r
62
+ }), {
63
+ formState: { isSubmitting: F }
64
+ } = h;
65
+ return /* @__PURE__ */ l.jsxs(b, { ...h, children: [
66
+ /* @__PURE__ */ l.jsx(
67
+ A,
68
+ {
69
+ getContentId: (t) => S(t),
70
+ isError: g,
71
+ currentValues: y
72
+ }
73
+ ),
74
+ /* @__PURE__ */ l.jsx("div", { className: u("w-full", f), children: /* @__PURE__ */ l.jsxs(
75
+ "form",
76
+ {
77
+ className: u(
78
+ "w-full bg-white rounded-md flex flex-col gap-6 px-4 md:px-8 py-6",
79
+ w && "opacity-50 pointer-events-none"
80
+ ),
81
+ id: "collection-form",
82
+ onSubmit: V,
83
+ children: [
84
+ (p = a == null ? void 0 : a.sections) == null ? void 0 : p.map((t) => {
85
+ var x;
86
+ return /* @__PURE__ */ l.jsxs("div", { className: "w-full", children: [
87
+ !(i != null && i.hideSectionHeadings) && /* @__PURE__ */ l.jsx("p", { className: u("mb-4 text-lg font-semibold"), children: t == null ? void 0 : t.label }),
88
+ /* @__PURE__ */ l.jsx("div", { className: u("flex flex-col gap-4"), children: (x = t == null ? void 0 : t.fields) == null ? void 0 : x.map((s) => s && !s.hidden ? /* @__PURE__ */ l.jsx(
89
+ D,
90
+ {
91
+ field: s,
92
+ isInternal: n
93
+ },
94
+ s == null ? void 0 : s.key
95
+ ) : null) })
96
+ ] }, t.id);
97
+ }),
98
+ !n && /* @__PURE__ */ l.jsx(
99
+ U,
100
+ {
101
+ onStateChange: (t) => {
102
+ "detail" in t && o(t.detail.state || null);
103
+ },
104
+ ref: m,
105
+ challengeurl: `${d.apiUrl}/v1/identity/captcha/create-challenge`,
106
+ verifyurl: `${d.apiUrl}/v1/identity/captcha/verify-challenge`
107
+ }
108
+ ),
109
+ (e == null ? void 0 : e.show) && /* @__PURE__ */ l.jsx("div", { className: "w-full flex items-center justify-end mt-6", children: /* @__PURE__ */ l.jsx(
110
+ T,
111
+ {
112
+ className: e == null ? void 0 : e.styles,
113
+ loadingText: "Saving",
114
+ isLoading: F,
115
+ disabled: c || !n && r !== "verified",
116
+ type: "submit",
117
+ children: r === "verifying" ? "Verifying..." : (e == null ? void 0 : e.text) || "Save"
118
+ }
119
+ ) })
120
+ ]
121
+ }
122
+ ) })
123
+ ] });
124
+ };
125
+ export {
126
+ O as default
127
+ };
@@ -0,0 +1,113 @@
1
+ "use client";
2
+ import { j as d } from "./jsx-runtime-B6kdoens.js";
3
+ import { useState as x, useEffect as w } from "react";
4
+ import { useController as B } from "react-hook-form";
5
+ import D from "react-select";
6
+ import { c as y } from "./cn-C9QoOYNG.js";
7
+ import { z as N, A as k, B as q } from "./CollectionFormBuilder-BIvx_z08.js";
8
+ import { I as L } from "./Input-2CvZ90f8.js";
9
+ const G = ({
10
+ field: s,
11
+ ...o
12
+ }) => {
13
+ var j;
14
+ const [t, I] = x([]), [h, g] = x(""), [p, i] = x(!1), {
15
+ key: C = "",
16
+ label: v = "",
17
+ helper_text: S = "",
18
+ readonly: O = !1,
19
+ values: n = [],
20
+ options: c = {}
21
+ } = s, u = C, {
22
+ field: { value: l, onBlur: E, onChange: a, disabled: F, ...M },
23
+ fieldState: f
24
+ } = B({
25
+ name: u,
26
+ rules: N(s)
27
+ }), P = !!(s != null && s.required), R = (j = f == null ? void 0 : f.error) == null ? void 0 : j.message, m = !!(c != null && c.custom_input);
28
+ return w(() => {
29
+ if (n != null && n.length) {
30
+ const r = [...n == null ? void 0 : n.map((b) => ({
31
+ label: b,
32
+ value: b
33
+ }))];
34
+ m && r.push({
35
+ label: "Other",
36
+ value: "Other"
37
+ }), I(r);
38
+ }
39
+ }, [n, m]), w(() => {
40
+ !(o != null && o.isMulti) && m && typeof l == "string" && l && ((t == null ? void 0 : t.findIndex(
41
+ (r) => (r == null ? void 0 : r.value) !== "Other" && (r == null ? void 0 : r.value) === l
42
+ )) === -1 ? (i(!0), g(l)) : i(!1));
43
+ }, [l, t]), /* @__PURE__ */ d.jsxs(k, { error: R, helperText: S, readOnly: O, children: [
44
+ v && /* @__PURE__ */ d.jsx(q, { htmlFor: u, isRequired: P, children: v }),
45
+ /* @__PURE__ */ d.jsx(
46
+ D,
47
+ {
48
+ id: u,
49
+ value: p ? {
50
+ label: "Other, Please Specify",
51
+ value: "Other"
52
+ } : l ? o != null && o.isMulti ? t == null ? void 0 : t.filter((e) => l == null ? void 0 : l.includes(e == null ? void 0 : e.value)) : t == null ? void 0 : t.find((e) => (e == null ? void 0 : e.value) === l) : null,
53
+ onChange: (e) => {
54
+ m && (e == null ? void 0 : e.value) === "Other" && (e == null ? void 0 : e.label) === "Other, Please Specify" ? (i(!0), a(h)) : (i(!1), o != null && o.isMulti ? a(e == null ? void 0 : e.map((r) => r == null ? void 0 : r.value)) : a(e == null ? void 0 : e.value));
55
+ },
56
+ onBlur: () => E(),
57
+ options: t,
58
+ isDisabled: F,
59
+ menuPlacement: "auto",
60
+ ...M,
61
+ ...o,
62
+ unstyled: !0,
63
+ classNames: {
64
+ container: () => y("w-full min-w-none h-auto min-h-none"),
65
+ control: ({ isFocused: e, isMulti: r, isDisabled: b }) => y(
66
+ "w-full pl-3",
67
+ r ? "!min-h-9 h-auto" : "h-9 !min-h-none",
68
+ "rounded-md border bg-transparent hover:cursor-pointer border-input text-sm shadow-sm transition-colors",
69
+ "flex ",
70
+ e && "outline-none ring-1 ring-ring",
71
+ O && "ring-0",
72
+ b && "cursor-not-allowed opacity-50"
73
+ ),
74
+ input: () => "",
75
+ valueContainer: () => "gap-[4px] py-1",
76
+ singleValue: () => "",
77
+ multiValue: () => "bg-gray-100 rounded items-center py-0.5 pl-2 pr-1 gap-1.5",
78
+ multiValueLabel: () => "py-0.5",
79
+ multiValueRemove: () => "border border-gray-200 bg-white hover:bg-red-50 hover:text-red-800 text-gray-500 hover:border-red-300 rounded-md",
80
+ indicatorsContainer: () => "",
81
+ clearIndicator: () => "text-gray-500 p-1 rounded-md hover:bg-red-50 hover:text-red-800",
82
+ indicatorSeparator: () => "",
83
+ dropdownIndicator: () => "p-1 hover:bg-gray-100 text-gray-500 rounded-md hover:text-black",
84
+ menu: () => "p-1 mt-2 border border-gray-200 bg-white rounded-md",
85
+ groupHeading: () => "ml-3 mt-2 mb-1 text-gray-500 text-sm",
86
+ placeholder: () => "text-gray-500 pl-1 py-0.5",
87
+ option: ({ isSelected: e, isFocused: r }) => y(
88
+ "text-sm font-medium hover:cursor-pointer px-3 py-2 rounded",
89
+ r && "bg-gray-100 active:bg-gray-200",
90
+ e && "text-white bg-primary/80"
91
+ ),
92
+ noOptionsMessage: () => "text-gray-500 p-2 bg-gray-50 border border-dashed border-gray-200 rounded-sm"
93
+ }
94
+ }
95
+ ),
96
+ p && /* @__PURE__ */ d.jsx("div", { className: "w-full", children: /* @__PURE__ */ d.jsx(
97
+ L,
98
+ {
99
+ name: `select-other-${u}`,
100
+ value: h,
101
+ onChange: (e) => {
102
+ a == null || a(e.target.value), g(e.target.value);
103
+ },
104
+ className: "mt-4",
105
+ placeholder: "Other, Please Specify"
106
+ }
107
+ ) })
108
+ ] });
109
+ };
110
+ export {
111
+ G as DropdownWidget,
112
+ G as default
113
+ };
@@ -1,35 +1,35 @@
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-DzGH5rKe.js";
4
- import { h as F, j as I, k as V } from "./CollectionFormBuilder-B6CAVKhg.js";
3
+ import { G as C } from "./Spinner-Bzu2xCFZ.js";
4
+ import { z as F, A as I, B as V } from "./CollectionFormBuilder-BIvx_z08.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);
8
8
  }
9
- const k = ({ field: e, ...c }) => {
9
+ const Z = ({ field: e, ...c }) => {
10
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 },
11
+ const { key: u = "", label: s = "", helper_text: d = "", readonly: p = !1 } = e, t = u, {
12
+ field: { value: h, onBlur: x, onChange: g, ...f },
13
13
  fieldState: a
14
14
  } = y({
15
15
  name: t,
16
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 }),
17
+ }), v = !!(e != null && e.required), j = (l = a == null ? void 0 : a.error) == null ? void 0 : l.message;
18
+ return /* @__PURE__ */ r.jsxs(I, { error: j, helperText: d, children: [
19
+ s && /* @__PURE__ */ r.jsx(V, { htmlFor: t, isRequired: v, children: s }),
20
20
  /* @__PURE__ */ r.jsx(
21
21
  b,
22
22
  {
23
23
  id: t,
24
24
  type: "email",
25
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 || "",
26
+ value: h || "",
27
27
  onChange: (o) => {
28
28
  var n, i, m;
29
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
30
  },
31
31
  onBlur: x,
32
- readOnly: h,
32
+ readOnly: p,
33
33
  ...f,
34
34
  ...c
35
35
  }
@@ -37,5 +37,5 @@ const k = ({ field: e, ...c }) => {
37
37
  ] });
38
38
  };
39
39
  export {
40
- k as default
40
+ Z as default
41
41
  };
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import { j as o } from "./jsx-runtime-B6kdoens.js";
3
+ import { useState as p, useEffect as v } from "react";
4
+ import { useController as z } from "react-hook-form";
5
+ import { n as T } from "./Spinner-Bzu2xCFZ.js";
6
+ import { z as k, A as q, B as A } from "./CollectionFormBuilder-BIvx_z08.js";
7
+ import { I as E } from "./Input-2CvZ90f8.js";
8
+ import { u as O } from "./LevoProvider-Do3jjJ4j.js";
9
+ const $ = ({ field: t }) => {
10
+ var _;
11
+ const [c, h] = p(""), [m, u] = p(!1), [l, N] = p([]), [g, i] = p(!1), { client: a } = O(), { key: d = "", label: f = "", helper_text: w = "", readonly: j = !1 } = t, {
12
+ field: { value: s, onBlur: F, onChange: y, ...L },
13
+ fieldState: x
14
+ } = z({
15
+ name: d,
16
+ rules: k(t)
17
+ }), B = !!(t != null && t.required), C = (_ = x == null ? void 0 : x.error) == null ? void 0 : _.message, I = (e) => {
18
+ i(!0), u(!0), a == null || a.fetch.url(`/v1/bevy/content/location/${e == null ? void 0 : e.place_id}/get-location-details`).get().json().then((n) => {
19
+ var r;
20
+ y && y((r = n == null ? void 0 : n.content) == null ? void 0 : r.data);
21
+ }).finally(() => i(!1));
22
+ };
23
+ return v(() => {
24
+ var e, n;
25
+ c && !m && (i(!0), a == null || a.fetch.url("/v1/bevy/content/location/search-location").post({
26
+ search: c,
27
+ where: (e = t == null ? void 0 : t.options) != null && e.location_type ? {
28
+ location_type: (n = t == null ? void 0 : t.options) == null ? void 0 : n.location_type
29
+ } : {}
30
+ }).json().then((r) => {
31
+ var b;
32
+ N((b = r == null ? void 0 : r.content) == null ? void 0 : b.data);
33
+ }).finally(() => i(!1)));
34
+ }, [c, m]), v(() => {
35
+ s != null && s.place_name && (h(s == null ? void 0 : s.place_name), u(!0));
36
+ }, [s]), /* @__PURE__ */ o.jsx(q, { error: C, helperText: w, readOnly: j, children: /* @__PURE__ */ o.jsxs("div", { className: "w-full relative", children: [
37
+ f && /* @__PURE__ */ o.jsx(A, { htmlFor: d, isRequired: B, children: f }),
38
+ /* @__PURE__ */ o.jsx(
39
+ E,
40
+ {
41
+ id: d,
42
+ value: c,
43
+ onChange: (e) => {
44
+ u(!1), h(e.target.value);
45
+ },
46
+ onBlur: () => {
47
+ F();
48
+ },
49
+ rightIcon: g && /* @__PURE__ */ o.jsx(T, { size: "20px", className: "animate-spin" }),
50
+ readOnly: j,
51
+ ...L
52
+ }
53
+ ),
54
+ c && !g && !m && /* @__PURE__ */ o.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: l != null && l.length ? l.map((e) => /* @__PURE__ */ o.jsx(
55
+ "p",
56
+ {
57
+ className: "text-md p-[8px] cursor-pointer rounded-[6px] hover:bg-gray-200",
58
+ onClick: () => I(e),
59
+ children: e.description
60
+ },
61
+ e.place_id
62
+ )) : /* @__PURE__ */ o.jsx("p", { className: "text-md p-[8px] text-muted-foreground", children: "No results found" }) })
63
+ ] }) });
64
+ };
65
+ export {
66
+ $ as GeocoderWidget,
67
+ $ as default
68
+ };
@@ -207,6 +207,5 @@ const R = G(null), X = ({
207
207
  };
208
208
  export {
209
209
  X as L,
210
- q as c,
211
210
  Z as u
212
211
  };
@@ -2,10 +2,10 @@
2
2
  import { j as e } from "./jsx-runtime-B6kdoens.js";
3
3
  import { Plus as m } from "lucide-react";
4
4
  import { useFieldArray as n } from "react-hook-form";
5
- import { k as c } from "./CollectionFormBuilder-B6CAVKhg.js";
6
- import { GeocoderWidget as d } from "./GeocoderWidget-CXu17A7y.js";
7
- import { B as p } from "./Spinner-DzGH5rKe.js";
8
- const g = ({
5
+ import { B as c } from "./CollectionFormBuilder-BIvx_z08.js";
6
+ import { GeocoderWidget as d } from "./GeocoderWidget-CSsp_-hW.js";
7
+ import { B as p } from "./Spinner-Bzu2xCFZ.js";
8
+ const k = ({
9
9
  field: l
10
10
  }) => {
11
11
  const { key: s = "", label: o = "" } = l, { fields: r, ...i } = n({
@@ -44,6 +44,6 @@ const g = ({
44
44
  ] });
45
45
  };
46
46
  export {
47
- g as MultiGeocoderWidget,
48
- g as default
47
+ k as MultiGeocoderWidget,
48
+ k as default
49
49
  };
@@ -1,33 +1,33 @@
1
1
  import { j as a } from "./jsx-runtime-B6kdoens.js";
2
- import { useController as C } from "react-hook-form";
3
- import { h as b, j as k, k as q } from "./CollectionFormBuilder-B6CAVKhg.js";
4
- import { I as A } from "./Input-2CvZ90f8.js";
5
- const W = ({ field: r }) => {
2
+ import { useController as A } from "react-hook-form";
3
+ import { z as C, A as b, B as q } from "./CollectionFormBuilder-BIvx_z08.js";
4
+ import { I } from "./Input-2CvZ90f8.js";
5
+ const f = ({ field: r }) => {
6
6
  var l;
7
7
  const { key: u = "", label: n = "", helper_text: c = "", readonly: x = !1 } = r, o = u, {
8
- field: { value: e, onChange: h, ...d },
8
+ field: { value: e, onChange: d, ...h },
9
9
  fieldState: s
10
- } = C({
10
+ } = A({
11
11
  name: o,
12
- rules: b(r)
13
- }), j = !!(r != null && r.required), g = (l = s == null ? void 0 : s.error) == null ? void 0 : l.message, y = Array.isArray(e) ? e == null ? void 0 : e.join(",") : "";
14
- return /* @__PURE__ */ a.jsxs(k, { error: g, helperText: c, children: [
15
- n && /* @__PURE__ */ a.jsx(q, { htmlFor: o, isRequired: j, children: n }),
12
+ rules: C(r)
13
+ }), g = !!(r != null && r.required), j = (l = s == null ? void 0 : s.error) == null ? void 0 : l.message, y = Array.isArray(e) ? e == null ? void 0 : e.join(",") : "";
14
+ return /* @__PURE__ */ a.jsxs(b, { error: j, helperText: c, children: [
15
+ n && /* @__PURE__ */ a.jsx(q, { htmlFor: o, isRequired: g, children: n }),
16
16
  /* @__PURE__ */ a.jsx(
17
- A,
17
+ I,
18
18
  {
19
19
  id: o,
20
20
  readOnly: x,
21
21
  value: y,
22
22
  onChange: (F) => {
23
23
  var m, p, i;
24
- h((i = (p = (m = F.target) == null ? void 0 : m.value) == null ? void 0 : p.split(",")) == null ? void 0 : i.map((t) => t == null ? void 0 : t.trim()));
24
+ d((i = (p = (m = F.target) == null ? void 0 : m.value) == null ? void 0 : p.split(",")) == null ? void 0 : i.map((t) => t == null ? void 0 : t.trim()));
25
25
  },
26
- ...d
26
+ ...h
27
27
  }
28
28
  )
29
29
  ] });
30
30
  };
31
31
  export {
32
- W as default
32
+ f as default
33
33
  };
@@ -3,8 +3,8 @@ 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
5
  import { c as l } from "./cn-C9QoOYNG.js";
6
- import { h as x, j as v, k as j } from "./CollectionFormBuilder-B6CAVKhg.js";
7
- const k = ({ field: e }) => {
6
+ import { z as x, A as v, B as y } from "./CollectionFormBuilder-BIvx_z08.js";
7
+ const P = ({ field: e }) => {
8
8
  const { key: u = "", label: t = "", helper_text: c = "", readonly: n = !1 } = e, s = u, {
9
9
  field: { value: d, onBlur: a, onChange: i, ...m },
10
10
  fieldState: { error: r }
@@ -13,7 +13,7 @@ const k = ({ field: e }) => {
13
13
  rules: x(e)
14
14
  }), p = !!(e != null && e.required), h = r == null ? void 0 : r.message;
15
15
  return /* @__PURE__ */ o.jsxs(v, { error: h, helperText: c, readOnly: n, children: [
16
- t && /* @__PURE__ */ o.jsx(j, { htmlFor: s, isRequired: p, children: t }),
16
+ t && /* @__PURE__ */ o.jsx(y, { htmlFor: s, isRequired: p, children: t }),
17
17
  /* @__PURE__ */ o.jsx(
18
18
  g,
19
19
  {
@@ -43,6 +43,6 @@ const k = ({ field: e }) => {
43
43
  ] });
44
44
  };
45
45
  export {
46
- k as PhoneWidget,
47
- k as default
46
+ P as PhoneWidget,
47
+ P as default
48
48
  };
@@ -3,12 +3,12 @@ import { j as r } from "./jsx-runtime-B6kdoens.js";
3
3
  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
- import { G as E } from "./Spinner-DzGH5rKe.js";
6
+ import { G as B } from "./Spinner-Bzu2xCFZ.js";
7
7
  import { c as N } from "./cn-C9QoOYNG.js";
8
- import { h as G, j as V, k as f } from "./CollectionFormBuilder-B6CAVKhg.js";
9
- import { I as q } from "./Input-2CvZ90f8.js";
10
- function B(s) {
11
- return E({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M416 128 192 384l-96-96" }, child: [] }] })(s);
8
+ import { z as E, A as G, B as f } from "./CollectionFormBuilder-BIvx_z08.js";
9
+ import { I as V } from "./Input-2CvZ90f8.js";
10
+ function q(s) {
11
+ return B({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M416 128 192 384l-96-96" }, child: [] }] })(s);
12
12
  }
13
13
  const C = ({ field: s }) => {
14
14
  var y;
@@ -24,11 +24,11 @@ const C = ({ field: s }) => {
24
24
  fieldState: p
25
25
  } = F({
26
26
  name: a,
27
- rules: G(s)
27
+ rules: E(s)
28
28
  }), O = !!(s != null && s.required), k = (y = p == null ? void 0 : p.error) == null ? void 0 : y.message;
29
29
  return d.useEffect(() => {
30
30
  u || i && (t == null ? void 0 : t.findIndex((e) => e === i)) === -1 && (h(!0), m(i));
31
- }, [i]), /* @__PURE__ */ r.jsxs(V, { error: k, helperText: $, readOnly: g, children: [
31
+ }, [i]), /* @__PURE__ */ r.jsxs(G, { error: k, helperText: $, readOnly: g, children: [
32
32
  j && /* @__PURE__ */ r.jsx(f, { htmlFor: a, isRequired: O, children: j }),
33
33
  /* @__PURE__ */ r.jsxs(
34
34
  n.Root,
@@ -69,7 +69,7 @@ const C = ({ field: s }) => {
69
69
  }
70
70
  ),
71
71
  /* @__PURE__ */ r.jsx(
72
- q,
72
+ V,
73
73
  {
74
74
  className: "max-w-[300px]",
75
75
  name: `radio-other-${a}`,
@@ -98,7 +98,7 @@ const x = d.forwardRef(({ className: s, ...c }, m) => /* @__PURE__ */ r.jsx(
98
98
  s
99
99
  ),
100
100
  ...c,
101
- children: /* @__PURE__ */ r.jsx(n.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ r.jsx(B, { className: "h-3.5 w-3.5 fill-primary" }) })
101
+ children: /* @__PURE__ */ r.jsx(n.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ r.jsx(q, { className: "h-3.5 w-3.5 fill-primary" }) })
102
102
  }
103
103
  ));
104
104
  x.displayName = n.Item.displayName;