@levo-so/react 0.0.1-alpha → 0.1.0
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/Checbox-sq-atGlJ.js +28 -0
- package/dist/CheckboxWidget-CD4lv7B4.js +118 -0
- package/dist/CollectionFormBuilder-a0pzMkWL.js +734 -0
- package/dist/CurrencyWidget-DRMqUgbP.js +60 -0
- package/dist/DateTimeWidget-FmBvE_lk.js +103 -0
- package/dist/DefaultFormVariant-BzHB74Ie.js +80 -0
- package/dist/DropdownWidget-CW0GSjwE.js +115 -0
- package/dist/EmailWidget-Nyc76pT8.js +42 -0
- package/dist/GeocoderWidget-Ib15NJcx.js +309 -0
- package/dist/Input-2CvZ90f8.js +54 -0
- package/dist/LevoProvider-DNbYyEaf.js +21 -0
- package/dist/MultiGeocoderWidget-BuW8i48_.js +49 -0
- package/dist/PhoneWidget-COo3SBNU.js +47 -0
- package/dist/RadioWidget-C8syq1dO.js +109 -0
- package/dist/RichTextWidget-B5qxi5OE.js +309 -0
- package/dist/Sonner-t6JVKA0a.js +39 -0
- package/dist/Spinner-CuUosd-S.js +297 -0
- package/dist/StepsFormVariant-NSTSIoVV.js +137 -0
- package/dist/SwitchWidget-C-p7lICr.js +53 -0
- package/dist/TextWidget-BtZp3DRk.js +34 -0
- package/dist/TextareaWidget-D0TbFUjX.js +30 -0
- package/dist/ToggleCheckboxWidget-BbVq_dAC.js +44 -0
- package/dist/Tooltip-CI4i4mYr.js +144 -0
- package/dist/URLWidget-00u8Svwt.js +14 -0
- package/dist/UploadWidget-Dim2TEFc.js +503 -0
- package/dist/audience/{block.d.ts → components/block.d.ts} +1 -1
- package/dist/audience/components/block.d.ts.map +1 -0
- package/dist/audience/{component.d.ts → components/component.d.ts} +1 -1
- package/dist/audience/components/component.d.ts.map +1 -0
- package/dist/audience/{page.d.ts → components/page.d.ts} +1 -1
- package/dist/audience/components/page.d.ts.map +1 -0
- package/dist/audience/components/useScrollDepth.d.ts.map +1 -0
- package/dist/audience/index.d.ts +3 -3
- package/dist/audience/index.d.ts.map +1 -0
- package/dist/audience/index.js +4 -2303
- package/dist/byteToSize-BFKZSBu1.js +8 -0
- package/dist/cn-C9QoOYNG.js +6 -0
- package/dist/collection/components/CollectionFormBuilder.d.ts +12 -0
- package/dist/collection/components/CollectionFormBuilder.d.ts.map +1 -0
- package/dist/collection/components/FieldRenderer.d.ts +9 -0
- package/dist/collection/components/FieldRenderer.d.ts.map +1 -0
- package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts +5 -0
- package/dist/collection/components/core/AsyncSelectPaginate/AsyncSelectPaginate.d.ts.map +1 -0
- package/dist/collection/components/core/Checkbox/Checbox.d.ts +5 -0
- package/dist/collection/components/core/Checkbox/Checbox.d.ts.map +1 -0
- package/dist/collection/components/core/Input/Input.d.ts +11 -0
- package/dist/collection/components/core/Input/Input.d.ts.map +1 -0
- package/dist/collection/components/core/Switch/Switch.d.ts +5 -0
- package/dist/collection/components/core/Switch/Switch.d.ts.map +1 -0
- package/dist/collection/components/renderer/RenderArrayWidget.d.ts +5 -0
- package/dist/collection/components/renderer/RenderArrayWidget.d.ts.map +1 -0
- package/dist/collection/components/renderer/RenderCommonField.d.ts +5 -0
- package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -0
- package/dist/collection/components/renderer/RenderRecordWidget.d.ts +4 -0
- package/dist/collection/components/renderer/RenderRecordWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/ErrorMessage.d.ts +6 -0
- package/dist/collection/components/widgets/ErrorMessage.d.ts.map +1 -0
- package/dist/collection/components/widgets/FieldWrapper.d.ts +14 -0
- package/dist/collection/components/widgets/FieldWrapper.d.ts.map +1 -0
- package/dist/collection/components/widgets/FormHelperText.d.ts +6 -0
- package/dist/collection/components/widgets/FormHelperText.d.ts.map +1 -0
- package/dist/collection/components/widgets/FormLabel.d.ts +8 -0
- package/dist/collection/components/widgets/FormLabel.d.ts.map +1 -0
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +8 -0
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts +7 -0
- package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts +9 -0
- package/dist/collection/components/widgets/currencyWidget/CurrencyWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts +10 -0
- package/dist/collection/components/widgets/dateTimeWidget/DateTimeWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts +9 -0
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts +9 -0
- package/dist/collection/components/widgets/emailWidget/EmailWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts +8 -0
- package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts +8 -0
- package/dist/collection/components/widgets/multiGeocoderWidget/MultiGeocoderWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts +8 -0
- package/dist/collection/components/widgets/phoneWidget/PhoneWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts +11 -0
- package/dist/collection/components/widgets/radioWidget/RadioWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts +12 -0
- package/dist/collection/components/widgets/richTextWidget/RichTextWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/switchWidget/SwitchWidget.d.ts +8 -0
- package/dist/collection/components/widgets/switchWidget/SwitchWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts +10 -0
- package/dist/collection/components/widgets/textWidget/TextWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts +8 -0
- package/dist/collection/components/widgets/textareaWidget/TextareaWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/toggleCheckboxWidget/ToggleCheckboxWidget.d.ts +8 -0
- package/dist/collection/components/widgets/toggleCheckboxWidget/ToggleCheckboxWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts +10 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts +13 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts +11 -0
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts +19 -0
- package/dist/collection/components/widgets/uploadWidget/UploadWidget.d.ts.map +1 -0
- package/dist/collection/components/widgets/urlWidget/URLWidget.d.ts +5 -0
- package/dist/collection/components/widgets/urlWidget/URLWidget.d.ts.map +1 -0
- package/dist/collection/index.d.ts +5 -0
- package/dist/collection/index.d.ts.map +1 -0
- package/dist/collection/index.js +19 -0
- package/dist/collection/lib/FormBuilder.d.ts +8 -0
- package/dist/collection/lib/FormBuilder.d.ts.map +1 -0
- package/dist/collection/lib/SaveDraftValues.d.ts +7 -0
- package/dist/collection/lib/SaveDraftValues.d.ts.map +1 -0
- package/dist/collection/lib/hooks/useLevoForm.d.ts +18 -0
- package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -0
- package/dist/collection/lib/provider/LevoFormProvider.d.ts +9 -0
- package/dist/collection/lib/provider/LevoFormProvider.d.ts.map +1 -0
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts +3 -0
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -0
- package/dist/collection/lib/variants/StepsFormVariant.d.ts +4 -0
- package/dist/collection/lib/variants/StepsFormVariant.d.ts.map +1 -0
- package/dist/collection/types/context.d.ts +34 -0
- package/dist/collection/types/context.d.ts.map +1 -0
- package/dist/collection/types/errors.d.ts +7 -0
- package/dist/collection/types/errors.d.ts.map +1 -0
- package/dist/collection/types/formVariant.d.ts +18 -0
- package/dist/collection/types/formVariant.d.ts.map +1 -0
- package/dist/collection/types/forms.d.ts +31 -0
- package/dist/collection/types/forms.d.ts.map +1 -0
- package/dist/collection/types/index.d.ts +4 -0
- package/dist/collection/types/index.d.ts.map +1 -0
- package/dist/collection/types/renderer.d.ts +6 -0
- package/dist/collection/types/renderer.d.ts.map +1 -0
- package/dist/collection/utils/formHelpers.d.ts +47 -0
- package/dist/collection/utils/formHelpers.d.ts.map +1 -0
- package/dist/collection/utils/getFieldValidations.d.ts +6 -0
- package/dist/collection/utils/getFieldValidations.d.ts.map +1 -0
- package/dist/collection/utils/index.d.ts +4 -0
- package/dist/collection/utils/index.d.ts.map +1 -0
- package/dist/collection/utils/schema.d.ts +3 -0
- package/dist/collection/utils/schema.d.ts.map +1 -0
- package/dist/collection/utils/setFormErrors.d.ts +4 -0
- package/dist/collection/utils/setFormErrors.d.ts.map +1 -0
- package/dist/collection/utils/storage.d.ts +11 -0
- package/dist/collection/utils/storage.d.ts.map +1 -0
- package/dist/components/Dialog.d.ts +21 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/DialogWrapper.d.ts +11 -0
- package/dist/components/DialogWrapper.d.ts.map +1 -0
- package/dist/components/Sonner.d.ts +7 -0
- package/dist/components/Sonner.d.ts.map +1 -0
- package/dist/components/Spinner.d.ts +5 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Tabs.d.ts +8 -0
- package/dist/components/Tabs.d.ts.map +1 -0
- package/dist/components/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/button/Button.d.ts +12 -0
- package/dist/components/button/Button.d.ts.map +1 -0
- package/dist/components/button/buttonVariants.d.ts +6 -0
- package/dist/components/button/buttonVariants.d.ts.map +1 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/constants/fileUploadPresets.d.ts +34 -0
- package/dist/constants/fileUploadPresets.d.ts.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/errorHandler-BJcFS2qV.js +26 -0
- package/dist/fileUploadPresets-2raQmHT0.js +74 -0
- package/dist/index-wTf_TtOG.js +131 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +84 -0
- package/dist/isEmptyObject-C5s4GzLE.js +8 -0
- package/dist/jsx-runtime-B6kdoens.js +634 -0
- package/dist/membership/components/OAuth/Button.d.ts +8 -0
- package/dist/membership/components/OAuth/Button.d.ts.map +1 -0
- package/dist/membership/components/OAuth/Container.d.ts +24 -0
- package/dist/membership/components/OAuth/Container.d.ts.map +1 -0
- package/dist/membership/components/OAuth/Core.d.ts +17 -0
- package/dist/membership/components/OAuth/Core.d.ts.map +1 -0
- package/dist/membership/components/OAuth/Popup.d.ts +15 -0
- package/dist/membership/components/OAuth/Popup.d.ts.map +1 -0
- package/dist/membership/components/index.d.ts +8 -0
- package/dist/membership/components/index.d.ts.map +1 -0
- package/dist/membership/index.d.ts +2 -0
- package/dist/membership/index.d.ts.map +1 -0
- package/dist/membership/index.js +4 -0
- package/dist/page-CxaKoH22.js +205 -0
- package/dist/providers/LevoProvider.d.ts +25 -0
- package/dist/providers/LevoProvider.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/useLevoForm-CR3q-L5Z.js +166 -0
- package/dist/utils/byteToSize.d.ts +3 -0
- package/dist/utils/byteToSize.d.ts.map +1 -0
- package/dist/utils/cn.d.ts +4 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/errorHandler.d.ts +2 -0
- package/dist/utils/errorHandler.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +14 -0
- package/dist/utils/isDateObject.d.ts +2 -0
- package/dist/utils/isDateObject.d.ts.map +1 -0
- package/dist/utils/isEmptyObject.d.ts +5 -0
- package/dist/utils/isEmptyObject.d.ts.map +1 -0
- package/dist/utils/isNullOrUndefined.d.ts +2 -0
- package/dist/utils/isNullOrUndefined.d.ts.map +1 -0
- package/dist/utils/isObject.d.ts +3 -0
- package/dist/utils/isObject.d.ts.map +1 -0
- package/package.json +96 -16
- /package/dist/audience/{useScrollDepth.d.ts → components/useScrollDepth.d.ts} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
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 { h as w, j as C, k } from "./CollectionFormBuilder-a0pzMkWL.js";
|
|
5
|
+
import { c as N } from "./cn-C9QoOYNG.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: h, ...x },
|
|
13
|
+
fieldState: s
|
|
14
|
+
} = j({
|
|
15
|
+
name: o,
|
|
16
|
+
rules: w(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
|
+
C,
|
|
20
|
+
{
|
|
21
|
+
ref: h,
|
|
22
|
+
error: g,
|
|
23
|
+
helperText: p,
|
|
24
|
+
readOnly: e,
|
|
25
|
+
children: [
|
|
26
|
+
n && /* @__PURE__ */ t.jsx(k, { 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: N(
|
|
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
|
+
...x,
|
|
50
|
+
...m
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
V as CurrencyWidget,
|
|
59
|
+
V as default
|
|
60
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
+
import { Calendar as w, X as F } from "lucide-react";
|
|
3
|
+
import { useRef as y } from "react";
|
|
4
|
+
import k from "react-flatpickr";
|
|
5
|
+
import { useController as C } from "react-hook-form";
|
|
6
|
+
import { h as N, j as z, k as R } from "./CollectionFormBuilder-a0pzMkWL.js";
|
|
7
|
+
import { c as l } from "./cn-C9QoOYNG.js";
|
|
8
|
+
const D = ({
|
|
9
|
+
field: r,
|
|
10
|
+
enableTime: x,
|
|
11
|
+
...b
|
|
12
|
+
}) => {
|
|
13
|
+
var p;
|
|
14
|
+
const { key: h = "", label: a = "", helper_text: v = "", readonly: d = !1 } = r, o = h, {
|
|
15
|
+
field: { value: u, onBlur: m, onChange: s, ...g },
|
|
16
|
+
fieldState: i
|
|
17
|
+
} = C({
|
|
18
|
+
name: o,
|
|
19
|
+
rules: N(r)
|
|
20
|
+
}), j = !!(r != null && r.required), c = (p = i == null ? void 0 : i.error) == null ? void 0 : p.message, n = y(null);
|
|
21
|
+
return /* @__PURE__ */ e.jsxs(z, { helperText: v, readOnly: d, error: c, children: [
|
|
22
|
+
a && /* @__PURE__ */ e.jsx(R, { htmlFor: o, isRequired: j, children: a }),
|
|
23
|
+
/* @__PURE__ */ e.jsxs(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
ref: n,
|
|
27
|
+
className: "h-9 w-full relative rounded-md [&_.flatpickr-wrapper]:w-full [&_.flatpickr-calendar]:z-50",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ e.jsx(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: l(
|
|
33
|
+
"absolute left-0 top-0 bottom-0 w-9 flex items-center justify-center rounded-l-md overflow-hidden pointer-events-none"
|
|
34
|
+
),
|
|
35
|
+
children: /* @__PURE__ */ e.jsx(w, { size: "20px", className: "text-muted-foreground" })
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ e.jsx(
|
|
39
|
+
k,
|
|
40
|
+
{
|
|
41
|
+
id: o,
|
|
42
|
+
className: l(
|
|
43
|
+
"flex h-9 w-full relative 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 pl-10 !max-w-none",
|
|
44
|
+
c && "border-destructive focus-visible:ring-destructive",
|
|
45
|
+
d && "focus-visible:ring-0"
|
|
46
|
+
),
|
|
47
|
+
options: x ? {
|
|
48
|
+
dateFormat: "F j, Y h:i K",
|
|
49
|
+
position: "auto",
|
|
50
|
+
enableTime: !0,
|
|
51
|
+
allowInput: !0,
|
|
52
|
+
static: !1,
|
|
53
|
+
positionElement: n.current ?? void 0
|
|
54
|
+
} : {
|
|
55
|
+
altInput: !0,
|
|
56
|
+
altFormat: "F j, Y",
|
|
57
|
+
dateFormat: "d-m-Y",
|
|
58
|
+
position: "auto",
|
|
59
|
+
static: !1,
|
|
60
|
+
positionElement: n.current ?? void 0
|
|
61
|
+
},
|
|
62
|
+
value: u,
|
|
63
|
+
onChange: (t) => {
|
|
64
|
+
var f;
|
|
65
|
+
s && s((f = t[0]) == null ? void 0 : f.toISOString());
|
|
66
|
+
},
|
|
67
|
+
onBlur: () => {
|
|
68
|
+
m && m();
|
|
69
|
+
},
|
|
70
|
+
autoComplete: "off",
|
|
71
|
+
"aria-autocomplete": "none",
|
|
72
|
+
autoSave: "off",
|
|
73
|
+
...g,
|
|
74
|
+
...b
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
u && /* @__PURE__ */ e.jsx(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: l(
|
|
81
|
+
"absolute right-0 top-0 bottom-0 w-9 z-10 flex items-center justify-center rounded-l-md overflow-hidden"
|
|
82
|
+
),
|
|
83
|
+
children: /* @__PURE__ */ e.jsx(
|
|
84
|
+
"button",
|
|
85
|
+
{
|
|
86
|
+
type: "button",
|
|
87
|
+
onClick: (t) => {
|
|
88
|
+
t == null || t.preventDefault(), t == null || t.stopPropagation(), s && s(o, null);
|
|
89
|
+
},
|
|
90
|
+
children: /* @__PURE__ */ e.jsx(F, { size: "20px", className: "text-muted-foreground" })
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] });
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
D as DateTimeWidget,
|
|
102
|
+
D as default
|
|
103
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
+
import { FormProvider as S } from "react-hook-form";
|
|
3
|
+
import { m as b, F as y } from "./CollectionFormBuilder-a0pzMkWL.js";
|
|
4
|
+
import { u as F, S as N } from "./useLevoForm-CR3q-L5Z.js";
|
|
5
|
+
import { c as m } from "./cn-C9QoOYNG.js";
|
|
6
|
+
import { B as g } from "./Spinner-CuUosd-S.js";
|
|
7
|
+
const E = () => {
|
|
8
|
+
var d;
|
|
9
|
+
const {
|
|
10
|
+
schema: l,
|
|
11
|
+
containerStyles: i,
|
|
12
|
+
uiConfig: o,
|
|
13
|
+
isInternal: x,
|
|
14
|
+
submitButtonConfig: r,
|
|
15
|
+
isDisabled: c
|
|
16
|
+
} = b(), {
|
|
17
|
+
methods: t,
|
|
18
|
+
allFormValues: p,
|
|
19
|
+
isError: u,
|
|
20
|
+
isLoading: h,
|
|
21
|
+
handleContentId: j,
|
|
22
|
+
handleSubmit: f
|
|
23
|
+
} = F({
|
|
24
|
+
schema: l,
|
|
25
|
+
saveToRemote: !0
|
|
26
|
+
}), {
|
|
27
|
+
formState: { isSubmitting: v }
|
|
28
|
+
} = t;
|
|
29
|
+
return /* @__PURE__ */ e.jsxs(S, { ...t, children: [
|
|
30
|
+
/* @__PURE__ */ e.jsx(
|
|
31
|
+
N,
|
|
32
|
+
{
|
|
33
|
+
getContentId: (s) => j(s),
|
|
34
|
+
isError: u,
|
|
35
|
+
currentValues: p
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ e.jsx("div", { className: m("w-full", i), children: /* @__PURE__ */ e.jsxs(
|
|
39
|
+
"form",
|
|
40
|
+
{
|
|
41
|
+
className: m(
|
|
42
|
+
"w-full bg-white rounded-md border border-[rgb(229, 231, 235)] flex flex-col gap-6 px-4 md:px-8 py-6",
|
|
43
|
+
h && "opacity-50 pointer-events-none"
|
|
44
|
+
),
|
|
45
|
+
id: "collection-form",
|
|
46
|
+
onSubmit: f,
|
|
47
|
+
children: [
|
|
48
|
+
(d = l == null ? void 0 : l.sections) == null ? void 0 : d.map((s) => {
|
|
49
|
+
var n;
|
|
50
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "w-full", children: [
|
|
51
|
+
!(o != null && o.hideSectionHeadings) && /* @__PURE__ */ e.jsx("p", { className: m("mb-4 text-lg font-semibold"), children: s == null ? void 0 : s.label }),
|
|
52
|
+
/* @__PURE__ */ e.jsx("div", { className: m("flex flex-col gap-4"), children: (n = s == null ? void 0 : s.fields) == null ? void 0 : n.map((a) => a && !a.hidden ? /* @__PURE__ */ e.jsx(
|
|
53
|
+
y,
|
|
54
|
+
{
|
|
55
|
+
field: a,
|
|
56
|
+
isInternal: x
|
|
57
|
+
},
|
|
58
|
+
a == null ? void 0 : a.key
|
|
59
|
+
) : null) })
|
|
60
|
+
] }, s.id);
|
|
61
|
+
}),
|
|
62
|
+
(r == null ? void 0 : r.show) && /* @__PURE__ */ e.jsx("div", { className: "w-full flex items-center justify-end mt-6", children: /* @__PURE__ */ e.jsx(
|
|
63
|
+
g,
|
|
64
|
+
{
|
|
65
|
+
className: r == null ? void 0 : r.styles,
|
|
66
|
+
loadingText: "Saving",
|
|
67
|
+
isLoading: v,
|
|
68
|
+
disabled: c,
|
|
69
|
+
type: "submit",
|
|
70
|
+
children: (r == null ? void 0 : r.text) || "Save"
|
|
71
|
+
}
|
|
72
|
+
) })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
) })
|
|
76
|
+
] });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
E as default
|
|
80
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { j as i } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
+
import { useState as f, useEffect as j } from "react";
|
|
4
|
+
import { useController as k } from "react-hook-form";
|
|
5
|
+
import D from "react-select";
|
|
6
|
+
import { h as N, j as q, k as B } from "./CollectionFormBuilder-a0pzMkWL.js";
|
|
7
|
+
import { I as L } from "./Input-2CvZ90f8.js";
|
|
8
|
+
import { c as x } from "./cn-C9QoOYNG.js";
|
|
9
|
+
const G = ({
|
|
10
|
+
field: s,
|
|
11
|
+
...r
|
|
12
|
+
}) => {
|
|
13
|
+
var O;
|
|
14
|
+
const [t, w] = f([]), [h, g] = f(""), [I, b] = f(!1), {
|
|
15
|
+
key: S = "",
|
|
16
|
+
label: p = "",
|
|
17
|
+
helper_text: C = "",
|
|
18
|
+
readonly: v = !1,
|
|
19
|
+
values: n = [],
|
|
20
|
+
options: y = {}
|
|
21
|
+
} = s, u = S, {
|
|
22
|
+
field: { value: o, onBlur: P, onChange: a, disabled: E, ...F },
|
|
23
|
+
fieldState: c
|
|
24
|
+
} = k({
|
|
25
|
+
name: u,
|
|
26
|
+
rules: N(s)
|
|
27
|
+
}), M = !!(s != null && s.required), R = (O = c == null ? void 0 : c.error) == null ? void 0 : O.message, d = !!(y != null && y.custom_input);
|
|
28
|
+
return j(() => {
|
|
29
|
+
if (n != null && n.length) {
|
|
30
|
+
const l = [...n == null ? void 0 : n.map((m) => ({
|
|
31
|
+
label: m,
|
|
32
|
+
value: m
|
|
33
|
+
}))];
|
|
34
|
+
d && l.push({
|
|
35
|
+
label: "Other, Please Specify",
|
|
36
|
+
value: "Other"
|
|
37
|
+
}), w(l);
|
|
38
|
+
}
|
|
39
|
+
}, [n, d]), j(() => {
|
|
40
|
+
!(r != null && r.isMulti) && d && typeof o == "string" && o && (t == null ? void 0 : t.findIndex(
|
|
41
|
+
(e) => (e == null ? void 0 : e.value) !== "Other" && (e == null ? void 0 : e.value) === o
|
|
42
|
+
)) === -1 && (b(!0), g(o));
|
|
43
|
+
}, [o]), /* @__PURE__ */ i.jsxs(q, { error: R, helperText: C, readOnly: v, children: [
|
|
44
|
+
p && /* @__PURE__ */ i.jsx(B, { htmlFor: u, isRequired: M, children: p }),
|
|
45
|
+
/* @__PURE__ */ i.jsx(
|
|
46
|
+
D,
|
|
47
|
+
{
|
|
48
|
+
id: u,
|
|
49
|
+
value: I ? {
|
|
50
|
+
label: "Other, Please Specify",
|
|
51
|
+
value: "Other"
|
|
52
|
+
} : o ? r != null && r.isMulti ? t == null ? void 0 : t.filter(
|
|
53
|
+
(e) => o == null ? void 0 : o.includes(e == null ? void 0 : e.value)
|
|
54
|
+
) : t == null ? void 0 : t.find((e) => (e == null ? void 0 : e.value) === o) : null,
|
|
55
|
+
onChange: (e) => {
|
|
56
|
+
d && (e == null ? void 0 : e.value) === "Other" && (e == null ? void 0 : e.label) === "Other, Please Specify" ? (b(!0), a(h)) : (b(!1), r != null && r.isMulti ? a(e == null ? void 0 : e.map((l) => l == null ? void 0 : l.value)) : a(e == null ? void 0 : e.value));
|
|
57
|
+
},
|
|
58
|
+
onBlur: () => P(),
|
|
59
|
+
options: t,
|
|
60
|
+
isDisabled: E,
|
|
61
|
+
menuPlacement: "auto",
|
|
62
|
+
...F,
|
|
63
|
+
...r,
|
|
64
|
+
unstyled: !0,
|
|
65
|
+
classNames: {
|
|
66
|
+
container: () => x("w-full min-w-none h-auto min-h-none"),
|
|
67
|
+
control: ({ isFocused: e, isMulti: l, isDisabled: m }) => x(
|
|
68
|
+
"w-full pl-3",
|
|
69
|
+
l ? "!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
|
+
v && "ring-0",
|
|
74
|
+
m && "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: l }) => x(
|
|
90
|
+
"text-sm font-medium hover:cursor-pointer px-3 py-2 rounded",
|
|
91
|
+
l && "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
|
+
d && /* @__PURE__ */ i.jsx("div", { className: "w-full", children: /* @__PURE__ */ i.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
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { j as t } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
+
import y from "react";
|
|
3
|
+
import { useController as C } from "react-hook-form";
|
|
4
|
+
import { G as F } from "./Spinner-CuUosd-S.js";
|
|
5
|
+
import { h as I, j as R, k as V } from "./CollectionFormBuilder-a0pzMkWL.js";
|
|
6
|
+
import { I as b } from "./Input-2CvZ90f8.js";
|
|
7
|
+
function w(e) {
|
|
8
|
+
return F({ 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);
|
|
9
|
+
}
|
|
10
|
+
const E = ({ field: e, ...c }) => {
|
|
11
|
+
var l;
|
|
12
|
+
const { key: u = "", label: s = "", helper_text: d = "", readonly: p = !1 } = e, r = u, {
|
|
13
|
+
field: { value: h, onBlur: x, onChange: g, ...f },
|
|
14
|
+
fieldState: a
|
|
15
|
+
} = C({
|
|
16
|
+
name: r,
|
|
17
|
+
rules: I(e)
|
|
18
|
+
}), j = !!(e != null && e.required), v = (l = a == null ? void 0 : a.error) == null ? void 0 : l.message;
|
|
19
|
+
return /* @__PURE__ */ t.jsxs(R, { error: v, helperText: d, children: [
|
|
20
|
+
s && /* @__PURE__ */ t.jsx(V, { htmlFor: r, isRequired: j, children: s }),
|
|
21
|
+
/* @__PURE__ */ t.jsx(
|
|
22
|
+
b,
|
|
23
|
+
{
|
|
24
|
+
id: r,
|
|
25
|
+
type: "email",
|
|
26
|
+
leftIcon: /* @__PURE__ */ t.jsx("div", { className: "w-full h-full flex items-center justify-center bg-muted", children: /* @__PURE__ */ t.jsx(w, { size: "20px", className: "text-muted-foreground" }) }),
|
|
27
|
+
value: h || "",
|
|
28
|
+
onChange: (o) => {
|
|
29
|
+
var n, m, i;
|
|
30
|
+
return g((i = (m = (n = o == null ? void 0 : o.target) == null ? void 0 : n.value) == null ? void 0 : m.trim()) == null ? void 0 : i.toLocaleLowerCase());
|
|
31
|
+
},
|
|
32
|
+
onBlur: x,
|
|
33
|
+
readOnly: p,
|
|
34
|
+
...f,
|
|
35
|
+
...c
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] });
|
|
39
|
+
}, k = y.memo(E);
|
|
40
|
+
export {
|
|
41
|
+
k as default
|
|
42
|
+
};
|