@levo-so/react 0.1.36 → 0.1.40
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/{Sonner-t6JVKA0a.js → Sonner-5IAqCkBs.js} +12 -9
- package/dist/Tooltip-DcdGb876.js +383 -0
- package/dist/audience/components/block.d.ts.map +1 -1
- package/dist/audience/components/component.d.ts +2 -2
- package/dist/audience/components/component.d.ts.map +1 -1
- package/dist/audience/components/page.d.ts.map +1 -1
- package/dist/audience/hooks/useBounce.d.ts +4 -0
- package/dist/audience/hooks/useBounce.d.ts.map +1 -0
- package/dist/audience/hooks/useCurrentTab.d.ts.map +1 -1
- package/dist/audience/hooks/useDownloadSpeed.d.ts.map +1 -1
- package/dist/audience/hooks/useIdentifyAudience.d.ts +7 -0
- package/dist/audience/hooks/useIdentifyAudience.d.ts.map +1 -0
- package/dist/audience/hooks/useOpenTabs.d.ts.map +1 -1
- package/dist/audience/hooks/usePerformanceMetrics.d.ts.map +1 -1
- package/dist/audience/index.js +1 -1
- package/dist/audience/utils/autocapture.d.ts.map +1 -1
- package/dist/components/Sonner.d.ts.map +1 -1
- package/dist/components/Spinner.d.ts.map +1 -1
- package/dist/components/button/buttonVariants.d.ts +1 -1
- package/dist/components/button/buttonVariants.d.ts.map +1 -1
- package/dist/components/index.js +20 -21
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +121 -83
- package/dist/isEmptyObject-B9yh0nbg.js +19 -0
- package/dist/{jsx-runtime-B6kdoens.js → jsx-runtime-D0AQ1Mn7.js} +216 -217
- package/dist/membership/index.d.ts +1 -1
- package/dist/membership/index.d.ts.map +1 -1
- package/dist/membership/index.js +1 -1
- package/dist/page-DweUjn1K.js +627 -0
- package/dist/providers/index.js +1 -1
- package/dist/utils/byteToSize.d.ts.map +1 -1
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/errorHandler.d.ts.map +1 -1
- package/dist/utils/index.js +10 -12
- package/dist/utils/isDateObject.d.ts.map +1 -1
- package/dist/utils/isEmptyObject.d.ts.map +1 -1
- package/dist/utils/isNullOrUndefined.d.ts.map +1 -1
- package/dist/utils/isObject.d.ts.map +1 -1
- package/package.json +7 -12
- package/dist/Checbox-sq-atGlJ.js +0 -28
- package/dist/CheckboxWidget-3qTjxIlp.js +0 -124
- package/dist/CollectionFormBuilder-CUzpwIva.js +0 -1195
- package/dist/CurrencyWidget-DgH4uCpg.js +0 -60
- package/dist/DateTimeWidget-C2hLHKU6.js +0 -80
- package/dist/DefaultFormVariant-Cm9i2BBn.js +0 -81
- package/dist/DropdownWidget-B6mRXcTa.js +0 -115
- package/dist/EmailWidget-CBFnvo9z.js +0 -41
- package/dist/FormCaptcha-btA0HfMx.js +0 -187
- package/dist/GeocoderWidget-DZGXm9Ji.js +0 -68
- package/dist/Input-Vv7mKQFt.js +0 -54
- package/dist/MultiGeocoderWidget-D7ogTcWu.js +0 -49
- package/dist/MultiTextWidget-DYxi8PHm.js +0 -33
- package/dist/PhoneWidget-BxaGCfLs.js +0 -48
- package/dist/RadioWidget-Bkq1Oudi.js +0 -109
- package/dist/RichTextWidget-Caqhw4GK.js +0 -310
- package/dist/Spinner-BcBoT-J5.js +0 -410
- package/dist/StepsFormVariant-D-m93LMv.js +0 -140
- package/dist/SwitchWidget-BpAzgVui.js +0 -53
- package/dist/TextWidget-CHkFlxmT.js +0 -33
- package/dist/TextareaWidget-B0htlijX.js +0 -30
- package/dist/ToggleCheckboxWidget-DLrS6ax4.js +0 -44
- package/dist/Tooltip-DoWyn3Ho.js +0 -37
- package/dist/URLWidget-CnWKNlOF.js +0 -14
- package/dist/UploadWidget-DSvWOBuR.js +0 -656
- package/dist/byteToSize-BFKZSBu1.js +0 -8
- package/dist/cn-C9QoOYNG.js +0 -6
- package/dist/collection/components/Altcha.d.ts +0 -10
- package/dist/collection/components/Altcha.d.ts.map +0 -1
- package/dist/collection/components/CollectionFormBuilder.d.ts +0 -12
- package/dist/collection/components/CollectionFormBuilder.d.ts.map +0 -1
- package/dist/collection/components/FieldRenderer.d.ts +0 -9
- package/dist/collection/components/FieldRenderer.d.ts.map +0 -1
- package/dist/collection/components/FormCaptcha.d.ts +0 -3
- package/dist/collection/components/FormCaptcha.d.ts.map +0 -1
- package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts +0 -5
- package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts.map +0 -1
- package/dist/collection/components/core/Checkbox/Checbox.d.ts +0 -5
- package/dist/collection/components/core/Checkbox/Checbox.d.ts.map +0 -1
- package/dist/collection/components/core/Input/Input.d.ts +0 -11
- package/dist/collection/components/core/Input/Input.d.ts.map +0 -1
- package/dist/collection/components/core/Switch/Switch.d.ts +0 -5
- package/dist/collection/components/core/Switch/Switch.d.ts.map +0 -1
- package/dist/collection/components/renderer/RenderArrayWidget.d.ts +0 -5
- package/dist/collection/components/renderer/RenderArrayWidget.d.ts.map +0 -1
- package/dist/collection/components/renderer/RenderCommonField.d.ts +0 -5
- package/dist/collection/components/renderer/RenderCommonField.d.ts.map +0 -1
- package/dist/collection/components/renderer/RenderRecordWidget.d.ts +0 -4
- package/dist/collection/components/renderer/RenderRecordWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/ErrorMessage.d.ts +0 -6
- package/dist/collection/components/widgets/ErrorMessage.d.ts.map +0 -1
- package/dist/collection/components/widgets/FieldWrapper.d.ts +0 -14
- package/dist/collection/components/widgets/FieldWrapper.d.ts.map +0 -1
- package/dist/collection/components/widgets/FormHelperText.d.ts +0 -6
- package/dist/collection/components/widgets/FormHelperText.d.ts.map +0 -1
- package/dist/collection/components/widgets/FormLabel.d.ts +0 -8
- package/dist/collection/components/widgets/FormLabel.d.ts.map +0 -1
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +0 -8
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts +0 -7
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts.map +0 -1
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2O.d.ts +0 -7
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2O.d.ts.map +0 -1
- package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts +0 -8
- package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts.map +0 -1
- package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts +0 -9
- package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts +0 -8
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts +0 -9
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts +0 -8
- package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts +0 -8
- package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts +0 -8
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/multiTextWidget/MultiTextWidget.d.ts +0 -7
- package/dist/collection/components/widgets/multiTextWidget/MultiTextWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts +0 -8
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts +0 -11
- package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts +0 -12
- package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/switchWidget/SwitchWidget.d.ts +0 -8
- package/dist/collection/components/widgets/switchWidget/SwitchWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts +0 -9
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts +0 -8
- package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/toggleCheckboxWidget/ToggleCheckboxWidget.d.ts +0 -8
- package/dist/collection/components/widgets/toggleCheckboxWidget/ToggleCheckboxWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/uploadWidget/CommonPreview.d.ts +0 -11
- package/dist/collection/components/widgets/uploadWidget/CommonPreview.d.ts.map +0 -1
- package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts +0 -11
- package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts.map +0 -1
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts +0 -10
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +0 -1
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts +0 -13
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +0 -1
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts +0 -11
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +0 -1
- package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts +0 -19
- package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts.map +0 -1
- package/dist/collection/components/widgets/urlWidget/URLWidget.d.ts +0 -5
- package/dist/collection/components/widgets/urlWidget/URLWidget.d.ts.map +0 -1
- package/dist/collection/index.d.ts +0 -5
- package/dist/collection/index.d.ts.map +0 -1
- package/dist/collection/index.js +0 -20
- package/dist/collection/lib/FormBuilder.d.ts +0 -8
- package/dist/collection/lib/FormBuilder.d.ts.map +0 -1
- package/dist/collection/lib/SaveDraftValues.d.ts +0 -7
- package/dist/collection/lib/SaveDraftValues.d.ts.map +0 -1
- package/dist/collection/lib/hooks/useLevoForm.d.ts +0 -18
- package/dist/collection/lib/hooks/useLevoForm.d.ts.map +0 -1
- package/dist/collection/lib/provider/LevoFormProvider.d.ts +0 -9
- package/dist/collection/lib/provider/LevoFormProvider.d.ts.map +0 -1
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts +0 -3
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +0 -1
- package/dist/collection/lib/variants/StepsFormVariant.d.ts +0 -4
- package/dist/collection/lib/variants/StepsFormVariant.d.ts.map +0 -1
- package/dist/collection/types/context.d.ts +0 -34
- package/dist/collection/types/context.d.ts.map +0 -1
- package/dist/collection/types/errors.d.ts +0 -7
- package/dist/collection/types/errors.d.ts.map +0 -1
- package/dist/collection/types/formVariant.d.ts +0 -18
- package/dist/collection/types/formVariant.d.ts.map +0 -1
- package/dist/collection/types/forms.d.ts +0 -31
- package/dist/collection/types/forms.d.ts.map +0 -1
- package/dist/collection/types/index.d.ts +0 -4
- package/dist/collection/types/index.d.ts.map +0 -1
- package/dist/collection/types/renderer.d.ts +0 -6
- package/dist/collection/types/renderer.d.ts.map +0 -1
- package/dist/collection/utils/formHelpers.d.ts +0 -48
- package/dist/collection/utils/formHelpers.d.ts.map +0 -1
- package/dist/collection/utils/getFieldValidations.d.ts +0 -6
- package/dist/collection/utils/getFieldValidations.d.ts.map +0 -1
- package/dist/collection/utils/index.d.ts +0 -6
- package/dist/collection/utils/index.d.ts.map +0 -1
- package/dist/collection/utils/schema.d.ts +0 -3
- package/dist/collection/utils/schema.d.ts.map +0 -1
- package/dist/collection/utils/setFormErrors.d.ts +0 -4
- package/dist/collection/utils/setFormErrors.d.ts.map +0 -1
- package/dist/collection/utils/storage.d.ts +0 -11
- package/dist/collection/utils/storage.d.ts.map +0 -1
- package/dist/errorHandler-_34Yv8wA.js +0 -9
- package/dist/isEmptyObject-C5s4GzLE.js +0 -8
- package/dist/libs.css +0 -1
- package/dist/libs.d.ts +0 -1
- package/dist/page-C1-z2EsC.js +0 -574
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { j as t } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
-
import { useController as j } from "react-hook-form";
|
|
3
|
-
import { NumericFormat as F } from "react-number-format";
|
|
4
|
-
import { c as w } from "./cn-C9QoOYNG.js";
|
|
5
|
-
import { z as C, A as B, B as N } from "./CollectionFormBuilder-CUzpwIva.js";
|
|
6
|
-
const V = ({
|
|
7
|
-
field: r,
|
|
8
|
-
...m
|
|
9
|
-
}) => {
|
|
10
|
-
var u, c;
|
|
11
|
-
const { key: d = "", label: n = "", helper_text: p = "", readonly: e = !1 } = r, o = d, {
|
|
12
|
-
field: { value: f, onBlur: a, onChange: l, ref: x, ...h },
|
|
13
|
-
fieldState: s
|
|
14
|
-
} = j({
|
|
15
|
-
name: o,
|
|
16
|
-
rules: C(r)
|
|
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
|
-
return /* @__PURE__ */ t.jsxs(
|
|
19
|
-
B,
|
|
20
|
-
{
|
|
21
|
-
ref: x,
|
|
22
|
-
error: g,
|
|
23
|
-
helperText: p,
|
|
24
|
-
readOnly: e,
|
|
25
|
-
children: [
|
|
26
|
-
n && /* @__PURE__ */ t.jsx(N, { htmlFor: o, isRequired: b, children: n }),
|
|
27
|
-
/* @__PURE__ */ t.jsx(
|
|
28
|
-
F,
|
|
29
|
-
{
|
|
30
|
-
thousandSeparator: !0,
|
|
31
|
-
prefix: i || "$",
|
|
32
|
-
thousandsGroupStyle: i === "₹" ? "lakh" : "thousand",
|
|
33
|
-
suffix: "",
|
|
34
|
-
allowNegative: !1,
|
|
35
|
-
id: o,
|
|
36
|
-
onValueChange: (y) => {
|
|
37
|
-
const { value: v } = y;
|
|
38
|
-
l && l(v);
|
|
39
|
-
},
|
|
40
|
-
onBlur: () => {
|
|
41
|
-
a && a();
|
|
42
|
-
},
|
|
43
|
-
value: f,
|
|
44
|
-
readOnly: e,
|
|
45
|
-
className: w(
|
|
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
|
-
e && "focus-visible:ring-0"
|
|
48
|
-
),
|
|
49
|
-
...h,
|
|
50
|
-
...m
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
export {
|
|
58
|
-
V as CurrencyWidget,
|
|
59
|
-
V as default
|
|
60
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { j as r } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
-
import { FieldInterfaces as b } from "@levo-so/core";
|
|
3
|
-
import { Calendar as w, X as N } from "lucide-react";
|
|
4
|
-
import * as l from "react-datepicker";
|
|
5
|
-
import { useController as v } from "react-hook-form";
|
|
6
|
-
import { c as p } from "./cn-C9QoOYNG.js";
|
|
7
|
-
import { z as M, A as D, B as C } from "./CollectionFormBuilder-CUzpwIva.js";
|
|
8
|
-
import { I as F } from "./Input-Vv7mKQFt.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
|
-
}, q = ({ 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) === b.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: "relative w-full rounded-md", children: [
|
|
27
|
-
/* @__PURE__ */ r.jsx(
|
|
28
|
-
"div",
|
|
29
|
-
{
|
|
30
|
-
className: p(
|
|
31
|
-
"pointer-events-none absolute bottom-0 left-0 top-0 flex w-9 items-center justify-center overflow-hidden rounded-l-md"
|
|
32
|
-
),
|
|
33
|
-
children: /* @__PURE__ */ r.jsx(w, { 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 bottom-0 right-0 top-0 z-10 flex w-9 items-center justify-center overflow-hidden rounded-l-md"
|
|
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(N, { size: "20px", className: "text-muted-foreground" })
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
)
|
|
75
|
-
] })
|
|
76
|
-
] });
|
|
77
|
-
};
|
|
78
|
-
export {
|
|
79
|
-
q as default
|
|
80
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
-
import { FormProvider as y } from "react-hook-form";
|
|
3
|
-
import { c as t } from "./cn-C9QoOYNG.js";
|
|
4
|
-
import { D as F, F as N } from "./CollectionFormBuilder-CUzpwIva.js";
|
|
5
|
-
import { u as g, S as w, F as b } from "./FormCaptcha-btA0HfMx.js";
|
|
6
|
-
import { B as D } from "./Spinner-BcBoT-J5.js";
|
|
7
|
-
const _ = () => {
|
|
8
|
-
var n;
|
|
9
|
-
const {
|
|
10
|
-
schema: l,
|
|
11
|
-
containerStyles: c,
|
|
12
|
-
uiConfig: m,
|
|
13
|
-
isInternal: d,
|
|
14
|
-
submitButtonConfig: a,
|
|
15
|
-
isDisabled: x
|
|
16
|
-
} = F(), {
|
|
17
|
-
methods: o,
|
|
18
|
-
allFormValues: p,
|
|
19
|
-
isError: h,
|
|
20
|
-
isLoading: u,
|
|
21
|
-
handleContentId: f,
|
|
22
|
-
handleSubmit: j
|
|
23
|
-
} = g({
|
|
24
|
-
schema: l,
|
|
25
|
-
saveToRemote: !0
|
|
26
|
-
}), {
|
|
27
|
-
formState: { isSubmitting: v }
|
|
28
|
-
} = o, S = o.watch("__captcha");
|
|
29
|
-
return /* @__PURE__ */ e.jsxs(y, { ...o, children: [
|
|
30
|
-
/* @__PURE__ */ e.jsx(
|
|
31
|
-
w,
|
|
32
|
-
{
|
|
33
|
-
getContentId: (s) => f(s),
|
|
34
|
-
isError: h,
|
|
35
|
-
currentValues: p
|
|
36
|
-
}
|
|
37
|
-
),
|
|
38
|
-
/* @__PURE__ */ e.jsx("div", { className: t("w-full", c), children: /* @__PURE__ */ e.jsxs(
|
|
39
|
-
"form",
|
|
40
|
-
{
|
|
41
|
-
className: t(
|
|
42
|
-
"flex w-full flex-col gap-6 rounded-md px-4 py-6 text-text-1 md:px-8",
|
|
43
|
-
u && "pointer-events-none opacity-50"
|
|
44
|
-
),
|
|
45
|
-
id: "collection-form",
|
|
46
|
-
onSubmit: j,
|
|
47
|
-
children: [
|
|
48
|
-
(n = l == null ? void 0 : l.sections) == null ? void 0 : n.map((s) => {
|
|
49
|
-
var i;
|
|
50
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "w-full", children: [
|
|
51
|
-
!(m != null && m.hideSectionHeadings) && /* @__PURE__ */ e.jsx("p", { className: t("mb-4 text-lg font-semibold"), children: s == null ? void 0 : s.label }),
|
|
52
|
-
/* @__PURE__ */ e.jsx("div", { className: t("flex flex-col gap-4"), children: (i = s == null ? void 0 : s.fields) == null ? void 0 : i.map((r) => r && !r.hidden ? /* @__PURE__ */ e.jsx(
|
|
53
|
-
N,
|
|
54
|
-
{
|
|
55
|
-
field: r,
|
|
56
|
-
isInternal: d
|
|
57
|
-
},
|
|
58
|
-
r == null ? void 0 : r.key
|
|
59
|
-
) : null) })
|
|
60
|
-
] }, s.id);
|
|
61
|
-
}),
|
|
62
|
-
!d && /* @__PURE__ */ e.jsx(b, {}),
|
|
63
|
-
(a == null ? void 0 : a.show) && /* @__PURE__ */ e.jsx("div", { className: "mt-6 flex w-full items-center justify-end", children: /* @__PURE__ */ e.jsx(
|
|
64
|
-
D,
|
|
65
|
-
{
|
|
66
|
-
className: a == null ? void 0 : a.styles,
|
|
67
|
-
loadingText: "Saving",
|
|
68
|
-
isLoading: v,
|
|
69
|
-
disabled: x,
|
|
70
|
-
type: "submit",
|
|
71
|
-
children: S === "verifying" ? "Verifying..." : (a == null ? void 0 : a.text) || "Save"
|
|
72
|
-
}
|
|
73
|
-
) })
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
) })
|
|
77
|
-
] });
|
|
78
|
-
};
|
|
79
|
-
export {
|
|
80
|
-
_ as default
|
|
81
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { j as d } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
-
import { useState as f, useEffect as w } from "react";
|
|
4
|
-
import { useController as R } from "react-hook-form";
|
|
5
|
-
import B from "react-select";
|
|
6
|
-
import { c as y } from "./cn-C9QoOYNG.js";
|
|
7
|
-
import { z as D, A as N, B as q } from "./CollectionFormBuilder-CUzpwIva.js";
|
|
8
|
-
import { I as L } from "./Input-Vv7mKQFt.js";
|
|
9
|
-
const G = ({
|
|
10
|
-
field: s,
|
|
11
|
-
...o
|
|
12
|
-
}) => {
|
|
13
|
-
var j;
|
|
14
|
-
const [t, I] = f([]), [h, g] = f(""), [p, i] = f(!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: k, onChange: a, disabled: E, ...F },
|
|
23
|
-
fieldState: x
|
|
24
|
-
} = R({
|
|
25
|
-
name: u,
|
|
26
|
-
rules: D(s)
|
|
27
|
-
}), M = !!(s != null && s.required), P = (j = x == null ? void 0 : x.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(N, { error: P, helperText: S, readOnly: O, children: [
|
|
44
|
-
v && /* @__PURE__ */ d.jsx(q, { htmlFor: u, isRequired: M, children: v }),
|
|
45
|
-
/* @__PURE__ */ d.jsx(
|
|
46
|
-
B,
|
|
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(
|
|
53
|
-
(e) => l == null ? void 0 : l.includes(e == null ? void 0 : e.value)
|
|
54
|
-
) : t == null ? void 0 : t.find((e) => (e == null ? void 0 : e.value) === l) : null,
|
|
55
|
-
onChange: (e) => {
|
|
56
|
-
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));
|
|
57
|
-
},
|
|
58
|
-
onBlur: () => k(),
|
|
59
|
-
options: t,
|
|
60
|
-
isDisabled: E,
|
|
61
|
-
menuPlacement: "auto",
|
|
62
|
-
...F,
|
|
63
|
-
...o,
|
|
64
|
-
unstyled: !0,
|
|
65
|
-
classNames: {
|
|
66
|
-
container: () => y("w-full min-w-none h-auto min-h-none"),
|
|
67
|
-
control: ({ isFocused: e, isMulti: r, isDisabled: b }) => y(
|
|
68
|
-
"w-full pl-3 text-black/80",
|
|
69
|
-
r ? "!min-h-9 h-auto" : "h-9 !min-h-none",
|
|
70
|
-
"rounded-md border bg-transparent hover:cursor-pointer border-input text-sm shadow-sm transition-colors",
|
|
71
|
-
"flex ",
|
|
72
|
-
e && "outline-none ring-1 ring-ring",
|
|
73
|
-
O && "ring-0",
|
|
74
|
-
b && "cursor-not-allowed opacity-50"
|
|
75
|
-
),
|
|
76
|
-
input: () => "",
|
|
77
|
-
valueContainer: () => "gap-[4px] py-1",
|
|
78
|
-
singleValue: () => "",
|
|
79
|
-
multiValue: () => "bg-gray-100 rounded items-center py-0.5 pl-2 pr-1 gap-1.5",
|
|
80
|
-
multiValueLabel: () => "py-0.5",
|
|
81
|
-
multiValueRemove: () => "border border-gray-200 bg-white hover:bg-red-50 hover:text-red-800 text-gray-500 hover:border-red-300 rounded-md",
|
|
82
|
-
indicatorsContainer: () => "",
|
|
83
|
-
clearIndicator: () => "text-gray-500 p-1 rounded-md hover:bg-red-50 hover:text-red-800",
|
|
84
|
-
indicatorSeparator: () => "",
|
|
85
|
-
dropdownIndicator: () => "p-1 hover:bg-gray-100 text-gray-500 rounded-md hover:text-black",
|
|
86
|
-
menu: () => "p-1 mt-2 border border-gray-200 bg-white rounded-md",
|
|
87
|
-
groupHeading: () => "ml-3 mt-2 mb-1 text-gray-500 text-sm",
|
|
88
|
-
placeholder: () => "text-gray-500 pl-1 py-0.5",
|
|
89
|
-
option: ({ isSelected: e, isFocused: r }) => y(
|
|
90
|
-
"text-black/80 text-sm font-medium hover:cursor-pointer px-3 py-2 rounded",
|
|
91
|
-
r && "bg-gray-100 active:bg-gray-200",
|
|
92
|
-
e && "text-white bg-primary/80"
|
|
93
|
-
),
|
|
94
|
-
noOptionsMessage: () => "text-gray-500 p-2 bg-gray-50 border border-dashed border-gray-200 rounded-sm"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
p && /* @__PURE__ */ d.jsx("div", { className: "w-full", children: /* @__PURE__ */ d.jsx(
|
|
99
|
-
L,
|
|
100
|
-
{
|
|
101
|
-
name: `select-other-${u}`,
|
|
102
|
-
value: h,
|
|
103
|
-
onChange: (e) => {
|
|
104
|
-
a == null || a(e.target.value), g(e.target.value);
|
|
105
|
-
},
|
|
106
|
-
className: "mt-4",
|
|
107
|
-
placeholder: "Other, Please Specify"
|
|
108
|
-
}
|
|
109
|
-
) })
|
|
110
|
-
] });
|
|
111
|
-
};
|
|
112
|
-
export {
|
|
113
|
-
G as DropdownWidget,
|
|
114
|
-
G as default
|
|
115
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
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-BcBoT-J5.js";
|
|
4
|
-
import { z as F, A as I, B as V } from "./CollectionFormBuilder-CUzpwIva.js";
|
|
5
|
-
import { I as b } from "./Input-Vv7mKQFt.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 Z = ({ field: e, ...c }) => {
|
|
10
|
-
var l;
|
|
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
|
-
fieldState: a
|
|
14
|
-
} = y({
|
|
15
|
-
name: t,
|
|
16
|
-
rules: F(e)
|
|
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
|
-
/* @__PURE__ */ r.jsx(
|
|
21
|
-
b,
|
|
22
|
-
{
|
|
23
|
-
id: t,
|
|
24
|
-
type: "email",
|
|
25
|
-
leftIcon: /* @__PURE__ */ r.jsx("div", { className: "flex h-full w-full items-center justify-center bg-muted", children: /* @__PURE__ */ r.jsx(w, { size: "20px", className: "text-muted-foreground" }) }),
|
|
26
|
-
value: h || "",
|
|
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: p,
|
|
33
|
-
...f,
|
|
34
|
-
...c
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
] });
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
Z as default
|
|
41
|
-
};
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect as k, useState as b, useRef as J } from "react";
|
|
3
|
-
import { useFormContext as W, useWatch as Y, useForm as B, useController as G } from "react-hook-form";
|
|
4
|
-
import { useDebouncedCallback as H } from "use-debounce";
|
|
5
|
-
import { useLevo as x } from "./providers/index.js";
|
|
6
|
-
import { D as C, s as z, h as Q, c as X, A as Z } from "./CollectionFormBuilder-CUzpwIva.js";
|
|
7
|
-
import { s as m } from "./Sonner-t6JVKA0a.js";
|
|
8
|
-
import { e as D } from "./errorHandler-_34Yv8wA.js";
|
|
9
|
-
import { a as h } from "./isEmptyObject-C5s4GzLE.js";
|
|
10
|
-
import { j as U } from "./jsx-runtime-B6kdoens.js";
|
|
11
|
-
import "altcha";
|
|
12
|
-
const R = {
|
|
13
|
-
FORM_DIRTY: "form-dirty",
|
|
14
|
-
FORM_VALUES: "form-values"
|
|
15
|
-
}, tt = (t) => {
|
|
16
|
-
const s = localStorage.getItem(`${t}-${R.FORM_VALUES}`);
|
|
17
|
-
return s ? JSON.parse(s) : {};
|
|
18
|
-
}, et = (t, s) => {
|
|
19
|
-
localStorage.setItem(
|
|
20
|
-
`${t}-${R.FORM_VALUES}`,
|
|
21
|
-
JSON.stringify(s)
|
|
22
|
-
);
|
|
23
|
-
}, M = (t) => {
|
|
24
|
-
localStorage.removeItem(`${t}-${R.FORM_VALUES}`);
|
|
25
|
-
}, dt = ({ currentValues: t, isError: s, getContentId: g }) => {
|
|
26
|
-
var O;
|
|
27
|
-
const { schema: n, isLoggedIn: a } = C(), e = W(), l = Y(), S = x(), I = H((v) => {
|
|
28
|
-
n != null && n.key && !s && n != null && n.allow_draft && (a ? fetch(`${S.apiUrl}/v1/bevy/content/${n == null ? void 0 : n.key}/save-entry`, {
|
|
29
|
-
method: "POST",
|
|
30
|
-
body: JSON.stringify({ ...v }),
|
|
31
|
-
headers: {
|
|
32
|
-
"Content-Type": "application/json"
|
|
33
|
-
}
|
|
34
|
-
}).then((o) => o.json()).then((o) => {
|
|
35
|
-
var _, V, c, E;
|
|
36
|
-
(V = (_ = o == null ? void 0 : o.content) == null ? void 0 : _.data) != null && V._id && g((E = (c = o == null ? void 0 : o.content) == null ? void 0 : c.data) == null ? void 0 : E._id);
|
|
37
|
-
}).catch(() => {
|
|
38
|
-
console.error("saving entry failed");
|
|
39
|
-
}) : et(n == null ? void 0 : n.key, v));
|
|
40
|
-
}, 2500);
|
|
41
|
-
return k(() => {
|
|
42
|
-
var v, o;
|
|
43
|
-
s || (v = e == null ? void 0 : e.formState) != null && v.isDirty && ((o = Object == null ? void 0 : Object.keys(l || {})) == null ? void 0 : o.length) > 0 && (I.cancel(), I({
|
|
44
|
-
...t,
|
|
45
|
-
...l
|
|
46
|
-
}));
|
|
47
|
-
}, [(O = e == null ? void 0 : e.formState) == null ? void 0 : O.isDirty, s, a, l]), null;
|
|
48
|
-
}, yt = ({
|
|
49
|
-
schema: t,
|
|
50
|
-
saveToRemote: s,
|
|
51
|
-
onSubmit: g,
|
|
52
|
-
onSubmitSuccess: n,
|
|
53
|
-
onSubmitError: a
|
|
54
|
-
}) => {
|
|
55
|
-
const { collection: e } = x(), {
|
|
56
|
-
toastConfig: l,
|
|
57
|
-
onSuccess: S,
|
|
58
|
-
onError: I,
|
|
59
|
-
isLoggedIn: O,
|
|
60
|
-
isDisabled: v,
|
|
61
|
-
externalInitialValues: o = {}
|
|
62
|
-
} = C(), [_, V] = b({}), [c, E] = b(null), [N, $] = b(!1), [P, A] = b(!1), r = J({}), F = B({
|
|
63
|
-
mode: "all",
|
|
64
|
-
disabled: v,
|
|
65
|
-
defaultValues: _,
|
|
66
|
-
values: _,
|
|
67
|
-
resetOptions: {
|
|
68
|
-
keepErrors: !0
|
|
69
|
-
}
|
|
70
|
-
}), q = F.handleSubmit(async (d) => {
|
|
71
|
-
var L, p, y, i, j, T;
|
|
72
|
-
if (r.current = {
|
|
73
|
-
...r.current || {},
|
|
74
|
-
...d
|
|
75
|
-
}, s && e) {
|
|
76
|
-
if (t)
|
|
77
|
-
try {
|
|
78
|
-
const f = z(r == null ? void 0 : r.current, t);
|
|
79
|
-
let u = null;
|
|
80
|
-
if (c ? u = await (e == null ? void 0 : e.submitDraftEntry(t == null ? void 0 : t.key, f).catch((w) => (D(w), null))) : u = await (e == null ? void 0 : e.saveCollectionData({
|
|
81
|
-
collection_id: t == null ? void 0 : t.id,
|
|
82
|
-
data: f
|
|
83
|
-
}).catch((w) => (D(w), null))), (L = u == null ? void 0 : u.content) != null && L.data)
|
|
84
|
-
return l != null && l.showSuccessToast && m(
|
|
85
|
-
l.successToastText || "Form submitted successfully."
|
|
86
|
-
), r.current = h(o) ? {} : { ...o }, M(t == null ? void 0 : t.key), E(null), S && S({
|
|
87
|
-
schemaId: t == null ? void 0 : t.id,
|
|
88
|
-
response: (p = u == null ? void 0 : u.content) == null ? void 0 : p.data
|
|
89
|
-
}), n && n(), F.reset(), F.clearErrors(), !0;
|
|
90
|
-
throw new Error("Failed to save form details, API response invalid");
|
|
91
|
-
} catch (f) {
|
|
92
|
-
const u = (j = (i = (y = f == null ? void 0 : f.response) == null ? void 0 : y.data) == null ? void 0 : i.content) == null ? void 0 : j.errors;
|
|
93
|
-
return Q(u, F.setError), a && a(u), I && I(((T = f == null ? void 0 : f.response) == null ? void 0 : T.data) || f), !1;
|
|
94
|
-
}
|
|
95
|
-
return !1;
|
|
96
|
-
}
|
|
97
|
-
d && g && g(d);
|
|
98
|
-
}), K = (d) => {
|
|
99
|
-
d && d !== c && E(d);
|
|
100
|
-
};
|
|
101
|
-
return k(() => {
|
|
102
|
-
if (t && e) {
|
|
103
|
-
const d = X(t);
|
|
104
|
-
if (r.current = {
|
|
105
|
-
...d,
|
|
106
|
-
...o || {},
|
|
107
|
-
...r.current || {}
|
|
108
|
-
}, !c && t != null && t.allow_draft) {
|
|
109
|
-
if (O) {
|
|
110
|
-
$(!0), e == null || e.getDraftEntry(t == null ? void 0 : t.key).then((p) => {
|
|
111
|
-
if (p === null) {
|
|
112
|
-
A(!0);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
A(!1);
|
|
116
|
-
const y = Array.isArray(p) ? p == null ? void 0 : p.filter((i) => (i == null ? void 0 : i._status) === "draft") : [];
|
|
117
|
-
if ((y == null ? void 0 : y.length) > 0) {
|
|
118
|
-
const i = (y == null ? void 0 : y[0]) || {};
|
|
119
|
-
i != null && i._id && (r.current = {
|
|
120
|
-
...r.current || {},
|
|
121
|
-
...i
|
|
122
|
-
}, E(i == null ? void 0 : i._id));
|
|
123
|
-
}
|
|
124
|
-
}).catch(() => null).finally(() => {
|
|
125
|
-
V({
|
|
126
|
-
...r == null ? void 0 : r.current
|
|
127
|
-
}), $(!1);
|
|
128
|
-
});
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const L = tt(t == null ? void 0 : t.key);
|
|
132
|
-
L && (r.current = {
|
|
133
|
-
...r.current || {},
|
|
134
|
-
...L
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
V({
|
|
138
|
-
...(r == null ? void 0 : r.current) || {}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}, [t]), k(() => {
|
|
142
|
-
t && c && M(t == null ? void 0 : t.key);
|
|
143
|
-
}, [c]), {
|
|
144
|
-
methods: F,
|
|
145
|
-
isLoading: N,
|
|
146
|
-
isError: P,
|
|
147
|
-
contentId: c,
|
|
148
|
-
allFormValues: r.current,
|
|
149
|
-
handleContentId: K,
|
|
150
|
-
handleSubmit: q
|
|
151
|
-
};
|
|
152
|
-
}, pt = () => {
|
|
153
|
-
const { isInternal: t } = C(), s = x(), g = J(null), {
|
|
154
|
-
field: { onChange: n },
|
|
155
|
-
fieldState: { error: a }
|
|
156
|
-
} = G({
|
|
157
|
-
name: "__captcha",
|
|
158
|
-
rules: {
|
|
159
|
-
required: t ? !1 : "Verification is required"
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
return k(() => {
|
|
163
|
-
const e = (S) => {
|
|
164
|
-
"detail" in S && n(S.detail.state || null);
|
|
165
|
-
}, { current: l } = g;
|
|
166
|
-
if (l)
|
|
167
|
-
return l.addEventListener("statechange", e), () => l.removeEventListener("statechange", e);
|
|
168
|
-
}, []), /* @__PURE__ */ U.jsx(Z, { error: a == null ? void 0 : a.message, children: /* @__PURE__ */ U.jsx(
|
|
169
|
-
"altcha-widget",
|
|
170
|
-
{
|
|
171
|
-
ref: g,
|
|
172
|
-
style: {
|
|
173
|
-
"--altcha-max-width": "100%"
|
|
174
|
-
},
|
|
175
|
-
hidelogo: !0,
|
|
176
|
-
auto: "onfocus",
|
|
177
|
-
hidefooter: !0,
|
|
178
|
-
challengeurl: `${s.apiUrl}/v1/identity/captcha/create-challenge`,
|
|
179
|
-
verifyurl: `${s.apiUrl}/v1/identity/captcha/verify-challenge`
|
|
180
|
-
}
|
|
181
|
-
) });
|
|
182
|
-
};
|
|
183
|
-
export {
|
|
184
|
-
pt as F,
|
|
185
|
-
dt as S,
|
|
186
|
-
yt as u
|
|
187
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
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 k } from "react-hook-form";
|
|
5
|
-
import { o as z } from "./Spinner-BcBoT-J5.js";
|
|
6
|
-
import { z as T, A as q, B as A } from "./CollectionFormBuilder-CUzpwIva.js";
|
|
7
|
-
import { I as E } from "./Input-Vv7mKQFt.js";
|
|
8
|
-
import { useLevo as O } from "./providers/index.js";
|
|
9
|
-
const $ = ({ field: t }) => {
|
|
10
|
-
var _;
|
|
11
|
-
const [c, h] = p(""), [m, d] = p(!1), [l, N] = p([]), [g, i] = p(!1), a = O(), { key: u = "", label: f = "", helper_text: w = "", readonly: j = !1 } = t, {
|
|
12
|
-
field: { value: s, onBlur: F, onChange: y, ...L },
|
|
13
|
-
fieldState: x
|
|
14
|
-
} = k({
|
|
15
|
-
name: u,
|
|
16
|
-
rules: T(t)
|
|
17
|
-
}), B = !!(t != null && t.required), C = (_ = x == null ? void 0 : x.error) == null ? void 0 : _.message, I = (e) => {
|
|
18
|
-
i(!0), d(!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), d(!0));
|
|
36
|
-
}, [s]), /* @__PURE__ */ o.jsx(q, { error: C, helperText: w, readOnly: j, children: /* @__PURE__ */ o.jsxs("div", { className: "relative w-full", children: [
|
|
37
|
-
f && /* @__PURE__ */ o.jsx(A, { htmlFor: u, isRequired: B, children: f }),
|
|
38
|
-
/* @__PURE__ */ o.jsx(
|
|
39
|
-
E,
|
|
40
|
-
{
|
|
41
|
-
id: u,
|
|
42
|
-
value: c,
|
|
43
|
-
onChange: (e) => {
|
|
44
|
-
d(!1), h(e.target.value);
|
|
45
|
-
},
|
|
46
|
-
onBlur: () => {
|
|
47
|
-
F();
|
|
48
|
-
},
|
|
49
|
-
rightIcon: g && /* @__PURE__ */ o.jsx(z, { size: "20px", className: "animate-spin" }),
|
|
50
|
-
readOnly: j,
|
|
51
|
-
...L
|
|
52
|
-
}
|
|
53
|
-
),
|
|
54
|
-
c && !g && !m && /* @__PURE__ */ o.jsx("div", { className: "absolute left-[-1px] z-50 w-full rounded-[6px] bg-white p-[4px] shadow-[0_0_8px_rgba(0,0,0,0.25)]", children: l != null && l.length ? l.map((e) => /* @__PURE__ */ o.jsx(
|
|
55
|
-
"p",
|
|
56
|
-
{
|
|
57
|
-
className: "text-md cursor-pointer rounded-[6px] p-[8px] text-black 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
|
-
};
|
package/dist/Input-Vv7mKQFt.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
-
import u from "react";
|
|
3
|
-
import { c as r } from "./cn-C9QoOYNG.js";
|
|
4
|
-
const b = u.forwardRef(
|
|
5
|
-
({
|
|
6
|
-
className: l,
|
|
7
|
-
leftIcon: t,
|
|
8
|
-
rightIcon: o,
|
|
9
|
-
leftIconBoxStyles: i,
|
|
10
|
-
rightIconBoxStyles: d,
|
|
11
|
-
containerStyles: n,
|
|
12
|
-
...s
|
|
13
|
-
}, a) => /* @__PURE__ */ e.jsxs("div", { className: r("relative w-full", n), children: [
|
|
14
|
-
t ? /* @__PURE__ */ e.jsx(
|
|
15
|
-
"div",
|
|
16
|
-
{
|
|
17
|
-
className: r(
|
|
18
|
-
"absolute bottom-0 left-0 top-0 flex w-9 items-center justify-center overflow-hidden rounded-l-md",
|
|
19
|
-
"border border-transparent",
|
|
20
|
-
i
|
|
21
|
-
),
|
|
22
|
-
children: t
|
|
23
|
-
}
|
|
24
|
-
) : null,
|
|
25
|
-
/* @__PURE__ */ e.jsx(
|
|
26
|
-
"input",
|
|
27
|
-
{
|
|
28
|
-
ref: a,
|
|
29
|
-
className: r(
|
|
30
|
-
"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",
|
|
31
|
-
s.readOnly ? "focus-visible:ring-0" : "",
|
|
32
|
-
t ? "pl-11" : "",
|
|
33
|
-
o ? "pr-11" : "",
|
|
34
|
-
l
|
|
35
|
-
),
|
|
36
|
-
...s
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
o ? /* @__PURE__ */ e.jsx(
|
|
40
|
-
"div",
|
|
41
|
-
{
|
|
42
|
-
className: r(
|
|
43
|
-
"absolute bottom-0 right-0 top-0 flex w-9 items-center justify-center overflow-hidden rounded-r-md",
|
|
44
|
-
"border border-transparent",
|
|
45
|
-
d
|
|
46
|
-
),
|
|
47
|
-
children: o
|
|
48
|
-
}
|
|
49
|
-
) : null
|
|
50
|
-
] })
|
|
51
|
-
);
|
|
52
|
-
export {
|
|
53
|
-
b as I
|
|
54
|
-
};
|